diff --git a/.changeset/brown-jeans-cover.md b/.changeset/brown-jeans-cover.md new file mode 100644 index 000000000000..dafd96712ec0 --- /dev/null +++ b/.changeset/brown-jeans-cover.md @@ -0,0 +1,5 @@ +--- +'@sveltejs/kit': patch +--- + +Return the copied files from the adapter's copy\_ utils. diff --git a/packages/kit/src/core/adapt/utils.js b/packages/kit/src/core/adapt/utils.js index 12623819b611..764f84309ac0 100644 --- a/packages/kit/src/core/adapt/utils.js +++ b/packages/kit/src/core/adapt/utils.js @@ -19,15 +19,15 @@ export function get_utils({ cwd, config, build_data, log }) { copy, copy_client_files(dest) { - copy(`${cwd}/${SVELTE_KIT}/output/client`, dest, (file) => file[0] !== '.'); + return copy(`${cwd}/${SVELTE_KIT}/output/client`, dest, (file) => file[0] !== '.'); }, copy_server_files(dest) { - copy(`${cwd}/${SVELTE_KIT}/output/server`, dest, (file) => file[0] !== '.'); + return copy(`${cwd}/${SVELTE_KIT}/output/server`, dest, (file) => file[0] !== '.'); }, copy_static_files(dest) { - copy(config.kit.files.assets, dest); + return copy(config.kit.files.assets, dest); }, async prerender({ all = false, dest, fallback }) { diff --git a/packages/kit/types/config.d.ts b/packages/kit/types/config.d.ts index 3e509fa0981d..5d2214d0eacb 100644 --- a/packages/kit/types/config.d.ts +++ b/packages/kit/types/config.d.ts @@ -6,10 +6,27 @@ export interface AdapterUtils { log: Logger; rimraf(dir: string): void; mkdirp(dir: string): void; - copy_client_files(dest: string): void; - copy_server_files(dest: string): void; - copy_static_files(dest: string): void; - copy(from: string, to: string, filter?: (basename: string) => boolean): void; + /** + * @param dest the destination folder to which files should be copied + * @returns an array of paths corresponding to the files that have been created by the copy + */ + copy_client_files(dest: string): string[]; + /** + * @param dest the destination folder to which files should be copied + * @returns an array of paths corresponding to the files that have been created by the copy + */ + copy_server_files(dest: string): string[]; + /** + * @param dest the destination folder to which files should be copied + * @returns an array of paths corresponding to the files that have been created by the copy + */ + copy_static_files(dest: string): string[]; + /** + * @param from the source folder from which files should be copied + * @param to the destination folder to which files should be copied + * @returns an array of paths corresponding to the files that have been created by the copy + */ + copy(from: string, to: string, filter?: (basename: string) => boolean): string[]; prerender(options: { all?: boolean; dest: string; fallback?: string }): Promise; }