Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions src/builders/copy/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,13 @@ export async function copyBuild(ctx: BuildContext): Promise<void> {
const patterns = Array.isArray(entry.pattern)
? entry.pattern
: [entry.pattern || "**"];
const paths = await glob(patterns, {
const options = {
cwd: resolve(ctx.options.rootDir, entry.input),
absolute: false,
});
patterns,
};
await ctx.hooks.callHook("copy:entry:options", ctx, entry, options);
const paths = await glob(options);

const outputList = await Promise.allSettled(
paths.map(async (path) => {
Expand Down
6 changes: 6 additions & 0 deletions src/builders/copy/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type { BaseBuildEntry, BuildContext } from "../../types";
import type { GlobOptions } from "tinyglobby";

export interface CopyBuildEntry extends BaseBuildEntry {
builder: "copy";
Expand All @@ -10,5 +11,10 @@ export interface CopyHooks {
ctx: BuildContext,
entries: CopyBuildEntry[],
) => void | Promise<void>;
"copy:entry:options": (
ctx: BuildContext,
entry: CopyBuildEntry,
options: GlobOptions,
) => void | Promise<void>;
"copy:done": (ctx: BuildContext) => void | Promise<void>;
}