@serwist/cli 9.5.14 → 9.5.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/bin.d.mts CHANGED
@@ -1,8 +1,6 @@
1
- import { n as AnyFlags, r as BooleanFlag } from "./chunks/types-DIGJFlHE.js";
2
- //#region src/bin.d.ts
1
+ import { n as AnyFlags, r as BooleanFlag } from "./chunks/types-DVHukkmb.js";
3
2
  export interface SupportedFlags extends AnyFlags {
4
3
  debug: BooleanFlag;
5
4
  watch: BooleanFlag;
6
5
  }
7
- //#endregion
8
6
  //# sourceMappingURL=bin.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"bin.d.mts","names":[],"sources":["../src/bin.ts"],"mappings":";;iBAiBiB,uBAAuB;EACtC,OAAO;EACP,OAAO"}
1
+ {"version":3,"file":"bin.d.mts","names":[],"sources":["../src/bin.ts"],"mappings":";iBAiBiB,uBAAuB;EACtC,OAAO;EACP,OAAO"}
package/dist/bin.mjs CHANGED
@@ -1,5 +1,5 @@
1
- import { i as logger, n as runBuildCommand, r as runInjectManifestCommand, t as errors } from "./chunks/errors-DXCDZqq6.js";
2
- import { n as constants } from "./chunks/constants-Dcy7HyXu.js";
1
+ import { i as logger, n as runBuildCommand, r as runInjectManifestCommand, t as errors } from "./chunks/errors-1m418BLR.js";
2
+ import { n as constants } from "./chunks/constants-CFc5chua.js";
3
3
  import chokidar from "chokidar";
4
4
  import { glob } from "glob";
5
5
  import path from "node:path";
@@ -11,12 +11,11 @@ import { statSync, writeFileSync } from "node:fs";
11
11
  import stringifyObject from "stringify-object";
12
12
  import { Separator, checkbox, input, select } from "@inquirer/prompts";
13
13
  import { toUnix } from "@serwist/utils";
14
- //#region src/lib/read-config.ts
14
+ // src/lib/read-config.ts
15
15
  const readConfig = async (configFile) => {
16
16
  return (await import(configFile)).default;
17
17
  };
18
- //#endregion
19
- //#region src/lib/ask-questions.ts
18
+ // src/lib/ask-questions.ts
20
19
  /**
21
20
  * @returns The subdirectories of the current
22
21
  * working directory, with hidden and ignored ones filtered out.
@@ -124,8 +123,7 @@ const askQuestions = async () => {
124
123
  configLocation
125
124
  };
126
125
  };
127
- //#endregion
128
- //#region src/lib/run-wizard.ts
126
+ // src/lib/run-wizard.ts
129
127
  async function runWizard() {
130
128
  const { configLocation, config } = await askQuestions();
131
129
  const contents = `/** @type {import("@serwist/build").InjectManifestOptions} */\nexport default ${stringifyObject(config)};`;
@@ -137,8 +135,7 @@ async function runWizard() {
137
135
  as part of a build process.`);
138
136
  logger.log(`You can further customize your service worker by making changes to ${configLocation}. See https://serwist.pages.dev/docs/build/configuring for details.`);
139
137
  }
140
- //#endregion
141
- //#region src/app.ts
138
+ // src/app.ts
142
139
  const app = async (params) => {
143
140
  assert(params && Array.isArray(params.input), errors["missing-input"]);
144
141
  const [command = "help", option] = params.input;
@@ -217,8 +214,7 @@ const app = async (params) => {
217
214
  default: throw new Error(`${errors["unknown-command"]} ${command}`);
218
215
  }
219
216
  };
220
- //#endregion
221
- //#region src/lib/cleanup-stack-trace.ts
217
+ // src/lib/cleanup-stack-trace.ts
222
218
  const cleanupStackTrace = (error, moduleName) => {
223
219
  if (!error.stack) return "";
224
220
  const frames = error.stack.split("\n");
@@ -230,8 +226,7 @@ const cleanupStackTrace = (error, moduleName) => {
230
226
  });
231
227
  return frames.slice(startFrame, lastFrame + 1).join("\n");
232
228
  };
233
- //#endregion
234
- //#region src/lib/help-text.ts
229
+ // src/lib/help-text.ts
235
230
  const helpText = `Usage:
236
231
  $ serwist <command> [options]
237
232
 
@@ -268,8 +263,7 @@ Examples:
268
263
  $ serwist inject-manifest configs/serwist-config.js
269
264
  $ serwist build configs/serwist-config.js
270
265
  `;
271
- //#endregion
272
- //#region src/bin.ts
266
+ // src/bin.ts
273
267
  (async () => {
274
268
  const params = meow(helpText, { importMeta: import.meta });
275
269
  updateNotifier({ pkg: params.pkg }).notify();
@@ -287,7 +281,6 @@ Examples:
287
281
  process.exit(1);
288
282
  }
289
283
  })();
290
- //#endregion
291
284
  export {};
292
285
 
293
286
  //# sourceMappingURL=bin.mjs.map
package/dist/bin.mjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"bin.mjs","names":[],"sources":["../src/lib/read-config.ts","../src/lib/ask-questions.ts","../src/lib/run-wizard.ts","../src/app.ts","../src/lib/cleanup-stack-trace.ts","../src/lib/help-text.ts","../src/bin.ts"],"sourcesContent":["/*\n Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport type { InjectManifestOptions } from \"@serwist/build\";\n\nexport const readConfig = async <T extends InjectManifestOptions = InjectManifestOptions>(configFile: string): Promise<T> => {\n return (await import(configFile)).default as T | Promise<T>;\n};\n","import assert from \"node:assert\";\nimport { statSync } from \"node:fs\";\nimport path from \"node:path\";\nimport { checkbox, input, Separator, select } from \"@inquirer/prompts\";\nimport type { InjectManifestOptions } from \"@serwist/build\";\nimport { toUnix } from \"@serwist/utils\";\nimport { glob } from \"glob\";\nimport { constants } from \"./constants.js\";\nimport { errors } from \"./errors.js\";\n\n/**\n * @returns The subdirectories of the current\n * working directory, with hidden and ignored ones filtered out.\n */\nconst getSubdirectories = async (): Promise<string[]> => {\n return await glob(\"*/\", {\n ignore: constants.ignoredDirectories.map((directory) => `${directory}/`),\n });\n};\n\nconst askRootOfWebApp = async (): Promise<string> => {\n const subdirectories = await getSubdirectories();\n\n const { globDirectory, manualDirectoryInput } = await (async () => {\n if (subdirectories.length > 0) {\n const manualEntryChoice = \"Manually enter path\";\n const globDirectory = await select({\n message: \"What is the root of your web app (i.e. which directory do you deploy)?\",\n choices: [...subdirectories.map((dir) => ({ value: dir })), new Separator(), { value: manualEntryChoice }],\n });\n let manualDirectoryInput: string | undefined;\n if (globDirectory === manualEntryChoice) {\n manualDirectoryInput = await input({ message: \"Please enter the path to the root of your web app:\" });\n }\n return {\n globDirectory,\n manualDirectoryInput,\n };\n }\n\n const globDirectory = await input({ message: \"Please enter the path to the root of your web app:\", default: \".\" });\n\n return {\n globDirectory,\n manualDirectoryInput: undefined,\n };\n })();\n\n const stat = statSync(manualDirectoryInput || globDirectory);\n\n assert(stat.isDirectory(), errors[\"glob-directory-invalid\"]);\n\n return manualDirectoryInput || globDirectory;\n};\n\n/**\n * @param globDirectory The directory used for the root of globbing.\n * @returns The unique file extensions corresponding\n * to all of the files under globDirectory.\n */\nconst getAllFileExtensions = async (globDirectory: string) => {\n // Use a pattern to match any file that contains a '.', since that signifies\n // the presence of a file extension.\n const files: string[] = await glob(\"**/*.*\", {\n cwd: globDirectory,\n nodir: true,\n ignore: [\n ...constants.ignoredDirectories.map((directory) => `**/${directory}/**`),\n ...constants.ignoredFileExtensions.map((extension) => `**/*.${extension}`),\n ],\n });\n\n const extensions: Set<string> = new Set();\n for (const file of files) {\n const extension = path.extname(file);\n if (extension) {\n // Get rid of the leading . character.\n extensions.add(extension.replace(/^\\./, \"\"));\n }\n }\n\n return [...extensions];\n};\n\ninterface ConfigWithConfigLocation {\n config: {\n [key: string]: any;\n };\n configLocation: string;\n}\n\nexport const askQuestions = async (): Promise<ConfigWithConfigLocation> => {\n const globDirectory = await askRootOfWebApp();\n\n const fileExtensions = await getAllFileExtensions(globDirectory);\n\n assert(fileExtensions.length > 0, errors[\"no-file-extensions-found\"]);\n\n const swSrc = await input({\n message: \"Where's your existing service worker file? To be used with 'injectManifest', it should include a call to 'self.__SW_MANIFEST'\",\n validate(input) {\n if (typeof input !== \"string\") {\n return \"You must provide a valid 'swSrc'!\";\n }\n if (!statSync(input, { throwIfNoEntry: false })?.isFile()) {\n return \"'swSrc' must point to a valid file!\";\n }\n return true;\n },\n });\n\n const swDest = await input({\n message: \"Where would you like your service worker file to be saved?\",\n default: toUnix(path.join(globDirectory, \"sw.js\")),\n validate(input) {\n if (typeof input !== \"string\") {\n return \"You must provide a valid 'swDest'!\";\n }\n return true;\n },\n });\n\n const selectedExtensions = await checkbox({\n message: \"Which file types would you like to precache?\",\n choices: fileExtensions.map((ext) => ({ value: ext, checked: true })),\n validate(input) {\n if (!Array.isArray(input)) {\n return \"'selectedExtensions' is not an array. This is most likely a bug.\";\n }\n if (input.length === 0) {\n return errors[\"no-file-extensions-selected\"];\n }\n return true;\n },\n });\n\n const configLocation = await input({\n message: \"Where would you like to save these configuration options?\",\n default: constants.defaultConfigFile,\n validate(input) {\n if (typeof input !== \"string\") {\n return \"You must provide a valid location!\";\n }\n return true;\n },\n });\n\n // glob isn't happy with a single option inside of a {} group, so use a\n // pattern without a {} group when there's only one extension.\n const globPatterns = [`**/*.${selectedExtensions.length === 1 ? selectedExtensions[0] : `{${selectedExtensions.join(\",\")}}`}`];\n\n const config = {\n globDirectory,\n globPatterns,\n swSrc,\n swDest,\n } satisfies InjectManifestOptions;\n\n return {\n config,\n configLocation,\n };\n};\n","/*\n Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport { writeFileSync } from \"node:fs\";\nimport stringifyObject from \"stringify-object\";\n\nimport { askQuestions } from \"./ask-questions.js\";\nimport { logger } from \"./logger.js\";\n\nexport async function runWizard(): Promise<void> {\n const { configLocation, config } = await askQuestions();\n\n const contents = `/** @type {import(\"@serwist/build\").InjectManifestOptions} */\\nexport default ${stringifyObject(config)};`;\n\n writeFileSync(configLocation, contents);\n\n logger.log(`To build your service worker, run\n\n serwist inject-manifest ${configLocation}\n\nas part of a build process.`);\n\n logger.log(\n `You can further customize your service worker by making changes to ${configLocation}. See https://serwist.pages.dev/docs/build/configuring for details.`,\n );\n}\n","/*\n Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport assert from \"node:assert\";\nimport path from \"node:path\";\nimport { pathToFileURL } from \"node:url\";\nimport type { InjectManifestOptions } from \"@serwist/build\";\nimport chokidar from \"chokidar\";\nimport { glob } from \"glob\";\nimport type { Result as MeowResult } from \"meow\";\n\nimport type { SupportedFlags } from \"./bin.js\";\nimport { runBuildCommand, runInjectManifestCommand } from \"./lib/build.js\";\nimport { constants } from \"./lib/constants.js\";\nimport { errors } from \"./lib/errors.js\";\nimport { logger } from \"./lib/logger.js\";\nimport { readConfig } from \"./lib/read-config.js\";\nimport { runWizard } from \"./lib/run-wizard.js\";\nimport type { BuildOptions } from \"./types.js\";\n\nexport const app = async (params: MeowResult<SupportedFlags>): Promise<void> => {\n // This should not be a user-visible error, unless meow() messes something up.\n assert(params && Array.isArray(params.input), errors[\"missing-input\"]);\n\n // Default to showing the help message if there's no command provided.\n const [command = \"help\", option] = params.input;\n\n process.env.SERWIST_ENV = params.flags.watch ? \"watch\" : \"build\";\n\n if (!process.env.NODE_ENV) {\n process.env.NODE_ENV = params.flags.watch ? \"development\" : \"production\";\n }\n\n switch (command) {\n case \"wizard\": {\n await runWizard();\n break;\n }\n\n case \"build\": {\n const configPath = path.resolve(process.cwd(), option || constants.defaultConfigFile);\n const configUrl = pathToFileURL(configPath).href;\n\n let config: BuildOptions | null;\n try {\n config = await readConfig<BuildOptions>(configUrl);\n } catch (error) {\n config = null;\n if (error instanceof Error) {\n logger.error(errors[\"invalid-common-js-module\"]);\n throw error;\n }\n }\n\n if (config === null) {\n throw logger.error(errors[\"invalid-config-location\"]);\n }\n\n logger.log(`Using configuration from ${configPath}.`);\n\n await runBuildCommand({ config, watch: !!params.flags.watch });\n\n break;\n }\n\n case \"inject-manifest\": {\n const configPath = path.resolve(process.cwd(), option || constants.defaultConfigFile);\n const configUrl = pathToFileURL(configPath).href;\n\n let config: InjectManifestOptions | null;\n try {\n config = await readConfig(configUrl);\n } catch (error) {\n config = null;\n if (error instanceof Error) {\n logger.error(errors[\"invalid-common-js-module\"]);\n throw error;\n }\n }\n\n if (config === null) {\n throw logger.error(errors[\"invalid-config-location\"]);\n }\n\n logger.log(`Using configuration from ${configPath}.`);\n\n // Determine whether we're in --watch mode, or one-off mode.\n if (params.flags.watch) {\n if (config.globPatterns) {\n chokidar\n .watch(\n await glob(config.globPatterns, {\n cwd: config.globDirectory,\n follow: config.globFollow,\n ignore: config.globIgnores,\n }),\n {\n ignoreInitial: true,\n cwd: config.globDirectory,\n },\n )\n .on(\"all\", async () => {\n if (config === null) return;\n await runInjectManifestCommand({\n config,\n watch: true,\n });\n })\n .on(\"ready\", async () => {\n if (config === null) return;\n await runInjectManifestCommand({\n config,\n watch: true,\n });\n })\n .on(\"error\", (err) => {\n logger.error(err instanceof Error ? err.toString() : \"Unknown error\");\n });\n }\n } else {\n await runInjectManifestCommand({ config, watch: false });\n }\n break;\n }\n\n // biome-ignore lint/suspicious/noFallthroughSwitchClause: Biome.js doesn't handle functions that return `never`... yet.\n case \"help\": {\n params.showHelp();\n }\n\n default: {\n throw new Error(`${errors[\"unknown-command\"]} ${command}`);\n }\n }\n};\n","/*\n Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\n\n// Helper to parse out less relevant info from an Error's stack trace.\n// Removes the initial portion, since that's obtained from error.message.\n// Removes every stack frame earlier than the last instance of moduleName,\n// since that's just frames related to the Node runtime/loader.\nexport const cleanupStackTrace = (error: Error, moduleName: string): string => {\n if (!error.stack) {\n return \"\";\n }\n const frames = error.stack.split(\"\\n\");\n let startFrame: number | undefined;\n let lastFrame = 0;\n frames.forEach((frame, index) => {\n if (startFrame === undefined && frame.includes(\" at \")) {\n startFrame = index;\n }\n\n if (frame.includes(`${moduleName}:`)) {\n lastFrame = index;\n }\n });\n return frames.slice(startFrame, lastFrame + 1).join(\"\\n\");\n};\n","/*\n Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\n\nexport const helpText = `Usage:\n$ serwist <command> [options]\n\nCommands:\n wizard\n Runs the configuration wizard, which will generate a\n config file based on answers to questions.\n\n inject-manifest [<path/to/config.js>] [--watch]\n Takes an existing service worker file and creates a\n copy of it with a precache manifest injected. The precache \n manifest is generated based on the options in the config file \n (defaults to 'serwist.config.js'). If '--watch' is provided, the \n CLI will stay running and rebuild the service worker each \n time a file in the precache manifest changes. See \n https://serwist.pages.dev/docs/cli for more information.\n\n build [<path/to/config.js>] [--watch]\n Takes a service worker file and bundles it with a precache manifest\n injected using esbuild. The precache manifest is generated based\n on the options in the config file (defaults to 'serwist.config.js').\n If '--watch' is provided, the CLI will stay running and rebuild\n the service worker each time a file in the precache manifest changes.\n See https://serwist.pages.dev/docs/cli for more information.\n\nConfiguration file:\n The 'inject-manifest' and 'build' commands expect the configuration \n file to be a JavaScript file. By default, it is assumed \n to be named 'serwist.config.js' and located in the current\n directory, but this can be overridden.\n\nExamples:\n $ serwist wizard\n $ serwist inject-manifest configs/serwist-config.js\n $ serwist build configs/serwist-config.js\n`;\n","/*\n Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\n\nimport type { Result as MeowResult } from \"meow\";\nimport meow from \"meow\";\nimport updateNotifier, { type Package } from \"update-notifier\";\nimport { app } from \"./app.js\";\nimport { cleanupStackTrace } from \"./lib/cleanup-stack-trace.js\";\nimport { helpText } from \"./lib/help-text.js\";\nimport { logger } from \"./lib/logger.js\";\nimport type { AnyFlags, BooleanFlag } from \"./types.js\";\n\nexport interface SupportedFlags extends AnyFlags {\n debug: BooleanFlag;\n watch: BooleanFlag;\n}\n\nvoid (async () => {\n const params: MeowResult<any> = meow(helpText, {\n importMeta: import.meta,\n });\n\n updateNotifier({ pkg: params.pkg as Package }).notify();\n\n try {\n await app(params);\n } catch (error) {\n if (error instanceof Error) {\n // Show the full error and stack trace if we're run with --debug.\n if (params.flags.debug) {\n if (error.stack) {\n logger.error(`\\n${error.stack}`);\n }\n } else {\n logger.error(`\\n${error.message}`);\n logger.debug(`${cleanupStackTrace(error, \"app.js\")}\\n`);\n }\n }\n\n process.ex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CAAC,KAAK,IAAI;AAC1D;;;ACrBA,MAAa,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CCclB,YAAY;CAChB,MAAM,SAA0B,KAAK,UAAU,EAC7C,YAAY,YACd,CAAC;CAED,eAAe,EAAE,KAAK,OAAO,IAAe,CAAC,CAAC,CAAC,OAAO;CAEtD,IAAI;EACF,MAAM,IAAI,MAAM;CAClB,SAAS,OAAO;EACd,IAAI,iBAAiB,OAAO;GAE1B,IAAI,OAAO,MAAM,OACX;QAAA,MAAM,OACR,OAAO,MAAM,KAAK,MAAM,OAAO;GAAA,OAE5B;IACL,OAAO,MAAM,KAAK,MAAM,SAAS;IACjC,OAAO,MAAM,GAAG,kBAAkB,OAAO,QAAQ,EAAE,GAAG;GACxD;EACF;EAEA,QAAQ,KAAK,CAAC;CAChB;AACF,EAAA,CAAG"}
1
+ {"version":3,"file":"bin.mjs","names":[],"sources":["../src/lib/read-config.ts","../src/lib/ask-questions.ts","../src/lib/run-wizard.ts","../src/app.ts","../src/lib/cleanup-stack-trace.ts","../src/lib/help-text.ts","../src/bin.ts"],"sourcesContent":["/*\n Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport type { InjectManifestOptions } from \"@serwist/build\";\n\nexport const readConfig = async <T extends InjectManifestOptions = InjectManifestOptions>(configFile: string): Promise<T> => {\n return (await import(configFile)).default as T | Promise<T>;\n};\n","import assert from \"node:assert\";\nimport { statSync } from \"node:fs\";\nimport path from \"node:path\";\nimport { checkbox, input, Separator, select } from \"@inquirer/prompts\";\nimport type { InjectManifestOptions } from \"@serwist/build\";\nimport { toUnix } from \"@serwist/utils\";\nimport { glob } from \"glob\";\nimport { constants } from \"./constants.js\";\nimport { errors } from \"./errors.js\";\n\n/**\n * @returns The subdirectories of the current\n * working directory, with hidden and ignored ones filtered out.\n */\nconst getSubdirectories = async (): Promise<string[]> => {\n return await glob(\"*/\", {\n ignore: constants.ignoredDirectories.map((directory) => `${directory}/`),\n });\n};\n\nconst askRootOfWebApp = async (): Promise<string> => {\n const subdirectories = await getSubdirectories();\n\n const { globDirectory, manualDirectoryInput } = await (async () => {\n if (subdirectories.length > 0) {\n const manualEntryChoice = \"Manually enter path\";\n const globDirectory = await select({\n message: \"What is the root of your web app (i.e. which directory do you deploy)?\",\n choices: [...subdirectories.map((dir) => ({ value: dir })), new Separator(), { value: manualEntryChoice }],\n });\n let manualDirectoryInput: string | undefined;\n if (globDirectory === manualEntryChoice) {\n manualDirectoryInput = await input({ message: \"Please enter the path to the root of your web app:\" });\n }\n return {\n globDirectory,\n manualDirectoryInput,\n };\n }\n\n const globDirectory = await input({ message: \"Please enter the path to the root of your web app:\", default: \".\" });\n\n return {\n globDirectory,\n manualDirectoryInput: undefined,\n };\n })();\n\n const stat = statSync(manualDirectoryInput || globDirectory);\n\n assert(stat.isDirectory(), errors[\"glob-directory-invalid\"]);\n\n return manualDirectoryInput || globDirectory;\n};\n\n/**\n * @param globDirectory The directory used for the root of globbing.\n * @returns The unique file extensions corresponding\n * to all of the files under globDirectory.\n */\nconst getAllFileExtensions = async (globDirectory: string) => {\n // Use a pattern to match any file that contains a '.', since that signifies\n // the presence of a file extension.\n const files: string[] = await glob(\"**/*.*\", {\n cwd: globDirectory,\n nodir: true,\n ignore: [\n ...constants.ignoredDirectories.map((directory) => `**/${directory}/**`),\n ...constants.ignoredFileExtensions.map((extension) => `**/*.${extension}`),\n ],\n });\n\n const extensions: Set<string> = new Set();\n for (const file of files) {\n const extension = path.extname(file);\n if (extension) {\n // Get rid of the leading . character.\n extensions.add(extension.replace(/^\\./, \"\"));\n }\n }\n\n return [...extensions];\n};\n\ninterface ConfigWithConfigLocation {\n config: {\n [key: string]: any;\n };\n configLocation: string;\n}\n\nexport const askQuestions = async (): Promise<ConfigWithConfigLocation> => {\n const globDirectory = await askRootOfWebApp();\n\n const fileExtensions = await getAllFileExtensions(globDirectory);\n\n assert(fileExtensions.length > 0, errors[\"no-file-extensions-found\"]);\n\n const swSrc = await input({\n message: \"Where's your existing service worker file? To be used with 'injectManifest', it should include a call to 'self.__SW_MANIFEST'\",\n validate(input) {\n if (typeof input !== \"string\") {\n return \"You must provide a valid 'swSrc'!\";\n }\n if (!statSync(input, { throwIfNoEntry: false })?.isFile()) {\n return \"'swSrc' must point to a valid file!\";\n }\n return true;\n },\n });\n\n const swDest = await input({\n message: \"Where would you like your service worker file to be saved?\",\n default: toUnix(path.join(globDirectory, \"sw.js\")),\n validate(input) {\n if (typeof input !== \"string\") {\n return \"You must provide a valid 'swDest'!\";\n }\n return true;\n },\n });\n\n const selectedExtensions = await checkbox({\n message: \"Which file types would you like to precache?\",\n choices: fileExtensions.map((ext) => ({ value: ext, checked: true })),\n validate(input) {\n if (!Array.isArray(input)) {\n return \"'selectedExtensions' is not an array. This is most likely a bug.\";\n }\n if (input.length === 0) {\n return errors[\"no-file-extensions-selected\"];\n }\n return true;\n },\n });\n\n const configLocation = await input({\n message: \"Where would you like to save these configuration options?\",\n default: constants.defaultConfigFile,\n validate(input) {\n if (typeof input !== \"string\") {\n return \"You must provide a valid location!\";\n }\n return true;\n },\n });\n\n // glob isn't happy with a single option inside of a {} group, so use a\n // pattern without a {} group when there's only one extension.\n const globPatterns = [`**/*.${selectedExtensions.length === 1 ? selectedExtensions[0] : `{${selectedExtensions.join(\",\")}}`}`];\n\n const config = {\n globDirectory,\n globPatterns,\n swSrc,\n swDest,\n } satisfies InjectManifestOptions;\n\n return {\n config,\n configLocation,\n };\n};\n","/*\n Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport { writeFileSync } from \"node:fs\";\nimport stringifyObject from \"stringify-object\";\n\nimport { askQuestions } from \"./ask-questions.js\";\nimport { logger } from \"./logger.js\";\n\nexport async function runWizard(): Promise<void> {\n const { configLocation, config } = await askQuestions();\n\n const contents = `/** @type {import(\"@serwist/build\").InjectManifestOptions} */\\nexport default ${stringifyObject(config)};`;\n\n writeFileSync(configLocation, contents);\n\n logger.log(`To build your service worker, run\n\n serwist inject-manifest ${configLocation}\n\nas part of a build process.`);\n\n logger.log(\n `You can further customize your service worker by making changes to ${configLocation}. See https://serwist.pages.dev/docs/build/configuring for details.`,\n );\n}\n","/*\n Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport assert from \"node:assert\";\nimport path from \"node:path\";\nimport { pathToFileURL } from \"node:url\";\nimport type { InjectManifestOptions } from \"@serwist/build\";\nimport chokidar from \"chokidar\";\nimport { glob } from \"glob\";\nimport type { Result as MeowResult } from \"meow\";\n\nimport type { SupportedFlags } from \"./bin.js\";\nimport { runBuildCommand, runInjectManifestCommand } from \"./lib/build.js\";\nimport { constants } from \"./lib/constants.js\";\nimport { errors } from \"./lib/errors.js\";\nimport { logger } from \"./lib/logger.js\";\nimport { readConfig } from \"./lib/read-config.js\";\nimport { runWizard } from \"./lib/run-wizard.js\";\nimport type { BuildOptions } from \"./types.js\";\n\nexport const app = async (params: MeowResult<SupportedFlags>): Promise<void> => {\n // This should not be a user-visible error, unless meow() messes something up.\n assert(params && Array.isArray(params.input), errors[\"missing-input\"]);\n\n // Default to showing the help message if there's no command provided.\n const [command = \"help\", option] = params.input;\n\n process.env.SERWIST_ENV = params.flags.watch ? \"watch\" : \"build\";\n\n if (!process.env.NODE_ENV) {\n process.env.NODE_ENV = params.flags.watch ? \"development\" : \"production\";\n }\n\n switch (command) {\n case \"wizard\": {\n await runWizard();\n break;\n }\n\n case \"build\": {\n const configPath = path.resolve(process.cwd(), option || constants.defaultConfigFile);\n const configUrl = pathToFileURL(configPath).href;\n\n let config: BuildOptions | null;\n try {\n config = await readConfig<BuildOptions>(configUrl);\n } catch (error) {\n config = null;\n if (error instanceof Error) {\n logger.error(errors[\"invalid-common-js-module\"]);\n throw error;\n }\n }\n\n if (config === null) {\n throw logger.error(errors[\"invalid-config-location\"]);\n }\n\n logger.log(`Using configuration from ${configPath}.`);\n\n await runBuildCommand({ config, watch: !!params.flags.watch });\n\n break;\n }\n\n case \"inject-manifest\": {\n const configPath = path.resolve(process.cwd(), option || constants.defaultConfigFile);\n const configUrl = pathToFileURL(configPath).href;\n\n let config: InjectManifestOptions | null;\n try {\n config = await readConfig(configUrl);\n } catch (error) {\n config = null;\n if (error instanceof Error) {\n logger.error(errors[\"invalid-common-js-module\"]);\n throw error;\n }\n }\n\n if (config === null) {\n throw logger.error(errors[\"invalid-config-location\"]);\n }\n\n logger.log(`Using configuration from ${configPath}.`);\n\n // Determine whether we're in --watch mode, or one-off mode.\n if (params.flags.watch) {\n if (config.globPatterns) {\n chokidar\n .watch(\n await glob(config.globPatterns, {\n cwd: config.globDirectory,\n follow: config.globFollow,\n ignore: config.globIgnores,\n }),\n {\n ignoreInitial: true,\n cwd: config.globDirectory,\n },\n )\n .on(\"all\", async () => {\n if (config === null) return;\n await runInjectManifestCommand({\n config,\n watch: true,\n });\n })\n .on(\"ready\", async () => {\n if (config === null) return;\n await runInjectManifestCommand({\n config,\n watch: true,\n });\n })\n .on(\"error\", (err) => {\n logger.error(err instanceof Error ? err.toString() : \"Unknown error\");\n });\n }\n } else {\n await runInjectManifestCommand({ config, watch: false });\n }\n break;\n }\n\n // biome-ignore lint/suspicious/noFallthroughSwitchClause: Biome.js doesn't handle functions that return `never`... yet.\n case \"help\": {\n params.showHelp();\n }\n\n default: {\n throw new Error(`${errors[\"unknown-command\"]} ${command}`);\n }\n }\n};\n","/*\n Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\n\n// Helper to parse out less relevant info from an Error's stack trace.\n// Removes the initial portion, since that's obtained from error.message.\n// Removes every stack frame earlier than the last instance of moduleName,\n// since that's just frames related to the Node runtime/loader.\nexport const cleanupStackTrace = (error: Error, moduleName: string): string => {\n if (!error.stack) {\n return \"\";\n }\n const frames = error.stack.split(\"\\n\");\n let startFrame: number | undefined;\n let lastFrame = 0;\n frames.forEach((frame, index) => {\n if (startFrame === undefined && frame.includes(\" at \")) {\n startFrame = index;\n }\n\n if (frame.includes(`${moduleName}:`)) {\n lastFrame = index;\n }\n });\n return frames.slice(startFrame, lastFrame + 1).join(\"\\n\");\n};\n","/*\n Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\n\nexport const helpText = `Usage:\n$ serwist <command> [options]\n\nCommands:\n wizard\n Runs the configuration wizard, which will generate a\n config file based on answers to questions.\n\n inject-manifest [<path/to/config.js>] [--watch]\n Takes an existing service worker file and creates a\n copy of it with a precache manifest injected. The precache \n manifest is generated based on the options in the config file \n (defaults to 'serwist.config.js'). If '--watch' is provided, the \n CLI will stay running and rebuild the service worker each \n time a file in the precache manifest changes. See \n https://serwist.pages.dev/docs/cli for more information.\n\n build [<path/to/config.js>] [--watch]\n Takes a service worker file and bundles it with a precache manifest\n injected using esbuild. The precache manifest is generated based\n on the options in the config file (defaults to 'serwist.config.js').\n If '--watch' is provided, the CLI will stay running and rebuild\n the service worker each time a file in the precache manifest changes.\n See https://serwist.pages.dev/docs/cli for more information.\n\nConfiguration file:\n The 'inject-manifest' and 'build' commands expect the configuration \n file to be a JavaScript file. By default, it is assumed \n to be named 'serwist.config.js' and located in the current\n directory, but this can be overridden.\n\nExamples:\n $ serwist wizard\n $ serwist inject-manifest configs/serwist-config.js\n $ serwist build configs/serwist-config.js\n`;\n","/*\n Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\n\nimport type { Result as MeowResult } from \"meow\";\nimport meow from \"meow\";\nimport updateNotifier, { type Package } from \"update-notifier\";\nimport { app } from \"./app.js\";\nimport { cleanupStackTrace } from \"./lib/cleanup-stack-trace.js\";\nimport { helpText } from \"./lib/help-text.js\";\nimport { logger } from \"./lib/logger.js\";\nimport type { AnyFlags, BooleanFlag } from \"./types.js\";\n\nexport interface SupportedFlags extends AnyFlags {\n debug: BooleanFlag;\n watch: BooleanFlag;\n}\n\nvoid (async () => {\n const params: MeowResult<any> = meow(helpText, {\n importMeta: import.meta,\n });\n\n updateNotifier({ pkg: params.pkg as Package }).notify();\n\n try {\n await app(params);\n } catch (error) {\n if (error instanceof Error) {\n // Show the full error and stack trace if we're run with --debug.\n if (params.flags.debug) {\n if (error.stack) {\n logger.error(`\\n${error.stack}`);\n }\n } else {\n logger.error(`\\n${error.message}`);\n logger.debug(`${cleanupStackTrace(error, \"app.js\")}\\n`);\n }\n }\n\n process.exit(1);\n }\n})();\n"],"mappings":";;;;;;;;;;;;;;AASA,MAAa,aAAa,OAAgE,eAAmC;CAC3H,QAAQ,MAAM,OAAO,YAAA,CAAa;AACpC;;;;;;ACGA,MAAM,oBAAoB,YAA+B;CACvD,OAAO,MAAM,KAAK,MAAM,EACtB,QAAQ,UAAU,mBAAmB,KAAK,cAAc,GAAG,UAAU,EAAE,EACzE,CAAC;AACH;AAEA,MAAM,kBAAkB,YAA6B;CACnD,MAAM,iBAAiB,MAAM,kBAAkB;CAE/C,MAAM,EAAE,eAAe,yBAAyB,OAAO,YAAY;EACjE,IAAI,eAAe,SAAS,GAAG;GAC7B,MAAM,oBAAoB;GAC1B,MAAM,gBAAgB,MAAM,OAAO;IACjC,SAAS;IACT,SAAS;KAAC,GAAG,eAAe,KAAK,SAAS,EAAE,OAAO,IAAI,EAAE;KAAG,IAAI,UAAU;KAAG,EAAE,OAAO,kBAAkB;IAAC;GAC3G,CAAC;GACD,IAAI;GACJ,IAAI,kBAAkB,mBACpB,uBAAuB,MAAM,MAAM,EAAE,SAAS,qDAAqD,CAAC;GAEtG,OAAO;IACL;IACA;GACF;EACF;EAIA,OAAO;GACL,eAAA,MAH0B,MAAM;IAAE,SAAS;IAAsD,SAAS;GAAI,CAAC;GAI/G,sBAAsB,KAA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AS;EAGlB,SACE,MAAM,IAAI,MAAM,GAAG,OAAO,mBAAmB,GAAG,SAAS;CAE7D;AACF;;AC9HA,MAAa,qBAAqB,OAAc,eAA+B;CAC7E,IAAI,CAAC,MAAM,OACT,OAAO;CAET,MAAM,SAAS,MAAM,MAAM,MAAM,IAAI;CACrC,IAAI;CACJ,IAAI,YAAY;CAChB,OAAO,SAAS,OAAO,UAAU;EAC/B,IAAI,eAAe,KAAA,KAAa,MAAM,SAAS,SAAS,GACtD,aAAa;EAGf,IAAI,MAAM,SAAS,GAAG,WAAW,EAAE,GACjC,YAAY;CAEhB,CAAC;CACD,OAAO,OAAO,MAAM,YAAY,YAAY,CAAC,CAAC,CAAC,KAAK,IAAI;AAC1D;;ACrBA,MAAa,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CCclB,YAAY;CAChB,MAAM,SAA0B,KAAK,UAAU,EAC7C,YAAY,YACd,CAAC;CAED,eAAe,EAAE,KAAK,OAAO,IAAe,CAAC,CAAC,CAAC,OAAO;CAEtD,IAAI;EACF,MAAM,IAAI,MAAM;CAClB,SAAS,OAAO;EACd,IAAI,iBAAiB,OAAO;GAE1B,IAAI,OAAO,MAAM,OACX;QAAA,MAAM,OACR,OAAO,MAAM,KAAK,MAAM,OAAO;GAAA,OAE5B;IACL,OAAO,MAAM,KAAK,MAAM,SAAS;IACjC,OAAO,MAAM,GAAG,kBAAkB,OAAO,QAAQ,EAAE,GAAG;GACxD;EACF;EAEA,QAAQ,KAAK,CAAC;CAChB;AACF,EAAA,CAAG"}
@@ -1,16 +1,15 @@
1
1
  import { SerwistConfigError, validationErrorMap } from "@serwist/build/schema";
2
2
  import z from "zod";
3
- //#region src/lib/validation.ts
3
+ // src/lib/validation.ts
4
4
  const validateBuildOptions = async (input) => {
5
- const result = await (await import("./schema-DXN5gKwC.js").then((n) => n.r)).buildOptions.spa(input, { error: validationErrorMap });
5
+ const result = await (await import("./schema-DXNYFiGi.js").then((n) => n.r)).buildOptions.spa(input, { error: validationErrorMap });
6
6
  if (!result.success) throw new SerwistConfigError({
7
7
  moduleName: "@serwist/cli",
8
8
  message: z.prettifyError(result.error)
9
9
  });
10
10
  return result.data;
11
11
  };
12
- //#endregion
13
- //#region src/lib/constants.ts
12
+ // src/lib/constants.ts
14
13
  const constants = {
15
14
  defaultConfigFile: "serwist.config.js",
16
15
  ignoredDirectories: ["node_modules"],
@@ -73,7 +72,6 @@ const SUPPORTED_ESBUILD_OPTIONS = [
73
72
  "footer",
74
73
  "plugins"
75
74
  ];
76
- //#endregion
77
75
  export { constants as n, validateBuildOptions as r, SUPPORTED_ESBUILD_OPTIONS as t };
78
76
 
79
- //# sourceMappingURL=constants-Dcy7HyXu.js.map
77
+ //# sourceMappingURL=constants-CFc5chua.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants-Dcy7HyXu.js","names":[],"sources":["../../src/lib/validation.ts","../../src/lib/constants.ts"],"sourcesContent":["import { SerwistConfigError, validationErrorMap } from \"@serwist/build/schema\";\nimport z from \"zod\";\nimport type { BuildOptionsComplete } from \"../types.js\";\n\nexport const validateBuildOptions = async (input: unknown): Promise<BuildOptionsComplete> => {\n const result = await (await import(\"./schema.js\")).buildOptions.spa(input, { error: validationErrorMap });\n if (!result.success) {\n throw new SerwistConfigError({\n moduleName: \"@serwist/cli\",\n message: z.prettifyError(result.error),\n });\n }\n return result.data;\n};\n","/*\n Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport type { BuildOptions } from \"esbuild\";\n\nexport const constants = {\n defaultConfigFile: \"serwist.config.js\",\n ignoredDirectories: [\"node_modules\"],\n ignoredFileExtensions: [\"map\"],\n};\n\nexport const SUPPORTED_ESBUILD_OPTIONS = [\n // CommonOptions\n \"sourcemap\",\n \"legalComments\",\n \"sourceRoot\",\n \"sourcesContent\",\n \"format\",\n \"globalName\",\n \"target\",\n \"supported\",\n \"define\",\n \"treeShaking\",\n \"minify\",\n \"mangleProps\",\n \"reserveProps\",\n \"mangleQuoted\",\n \"mangleCache\",\n \"drop\",\n \"dropLabels\",\n \"minifyWhitespace\",\n \"minifyIdentifiers\",\n \"minifySyntax\",\n \"lineLimit\",\n \"charset\",\n \"ignoreAnnotations\",\n \"jsx\",\n \"jsxFactory\",\n \"jsxFragment\",\n \"jsxImportSource\",\n \"jsxDev\",\n \"jsxSideEffects\",\n \"pure\",\n \"keepNames\",\n \"absPaths\",\n \"color\",\n \"logLevel\",\n \"logLimit\",\n \"logOverride\",\n \"tsconfigRaw\",\n // BuildOptions\n \"bundle\",\n \"splitting\",\n \"preserveSymlinks\",\n \"external\",\n \"packages\",\n \"alias\",\n \"loader\",\n \"resolveExtensions\",\n \"mainFields\",\n \"conditions\",\n \"allowOverwrite\",\n \"tsconfig\",\n \"outExtension\",\n \"publicPath\",\n \"inject\",\n \"banner\",\n \"footer\",\n \"plugins\",\n] as const satisfies readonly (keyof BuildOptions)[];\n"],"mappings":";;;AAIA,MAAa,uBAAuB,OAAO,UAAkD;CAC3F,MAAM,SAAS,OAAO,MAAM,OAAO,uBAAc,CAAA,MAAA,MAAA,EAAA,CAAA,EAAA,CAAE,aAAa,IAAI,OAAO,EAAE,OAAO,mBAAmB,CAAC;CACxG,IAAI,CAAC,OAAO,SACV,MAAM,IAAI,mBAAmB;EAC3B,YAAY;EACZ,SAAS,EAAE,cAAc,OAAO,KAAK;CACvC,CAAC;CAEH,OAAO,OAAO;AAChB;;;ACJA,MAAa,YAAY;CACvB,mBAAmB;CACnB,oBAAoB,CAAC,cAAc;CACnC,uBAAuB,CAAC,KAAK;AAC/B;AAEA,MAAa,4BAA4B;CAEvC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAEA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF"}
1
+ {"version":3,"file":"constants-CFc5chua.js","names":[],"sources":["../../src/lib/validation.ts","../../src/lib/constants.ts"],"sourcesContent":["import { SerwistConfigError, validationErrorMap } from \"@serwist/build/schema\";\nimport z from \"zod\";\nimport type { BuildOptionsComplete } from \"../types.js\";\n\nexport const validateBuildOptions = async (input: unknown): Promise<BuildOptionsComplete> => {\n const result = await (await import(\"./schema.js\")).buildOptions.spa(input, { error: validationErrorMap });\n if (!result.success) {\n throw new SerwistConfigError({\n moduleName: \"@serwist/cli\",\n message: z.prettifyError(result.error),\n });\n }\n return result.data;\n};\n","/*\n Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport type { BuildOptions } from \"esbuild\";\n\nexport const constants = {\n defaultConfigFile: \"serwist.config.js\",\n ignoredDirectories: [\"node_modules\"],\n ignoredFileExtensions: [\"map\"],\n};\n\nexport const SUPPORTED_ESBUILD_OPTIONS = [\n // CommonOptions\n \"sourcemap\",\n \"legalComments\",\n \"sourceRoot\",\n \"sourcesContent\",\n \"format\",\n \"globalName\",\n \"target\",\n \"supported\",\n \"define\",\n \"treeShaking\",\n \"minify\",\n \"mangleProps\",\n \"reserveProps\",\n \"mangleQuoted\",\n \"mangleCache\",\n \"drop\",\n \"dropLabels\",\n \"minifyWhitespace\",\n \"minifyIdentifiers\",\n \"minifySyntax\",\n \"lineLimit\",\n \"charset\",\n \"ignoreAnnotations\",\n \"jsx\",\n \"jsxFactory\",\n \"jsxFragment\",\n \"jsxImportSource\",\n \"jsxDev\",\n \"jsxSideEffects\",\n \"pure\",\n \"keepNames\",\n \"absPaths\",\n \"color\",\n \"logLevel\",\n \"logLimit\",\n \"logOverride\",\n \"tsconfigRaw\",\n // BuildOptions\n \"bundle\",\n \"splitting\",\n \"preserveSymlinks\",\n \"external\",\n \"packages\",\n \"alias\",\n \"loader\",\n \"resolveExtensions\",\n \"mainFields\",\n \"conditions\",\n \"allowOverwrite\",\n \"tsconfig\",\n \"outExtension\",\n \"publicPath\",\n \"inject\",\n \"banner\",\n \"footer\",\n \"plugins\",\n] as const satisfies readonly (keyof BuildOptions)[];\n"],"mappings":";;;AAIA,MAAa,uBAAuB,OAAO,UAAkD;CAC3F,MAAM,SAAS,OAAO,MAAM,OAAO,uBAAc,CAAA,MAAA,MAAA,EAAA,CAAA,EAAA,CAAE,aAAa,IAAI,OAAO,EAAE,OAAO,mBAAmB,CAAC;CACxG,IAAI,CAAC,OAAO,SACV,MAAM,IAAI,mBAAmB;EAC3B,YAAY;EACZ,SAAS,EAAE,cAAc,OAAO,KAAK;CACvC,CAAC;CAEH,OAAO,OAAO;AAChB;;ACJA,MAAa,YAAY;CACvB,mBAAmB;CACnB,oBAAoB,CAAC,cAAc;CACnC,uBAAuB,CAAC,KAAK;AAC/B;AAEA,MAAa,4BAA4B;CAEvC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAEA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF"}
@@ -1,4 +1,4 @@
1
- import { r as validateBuildOptions } from "./constants-Dcy7HyXu.js";
1
+ import { r as validateBuildOptions } from "./constants-CFc5chua.js";
2
2
  import { getFileManifestEntries, injectManifest } from "@serwist/build";
3
3
  import chokidar from "chokidar";
4
4
  import { glob } from "glob";
@@ -6,15 +6,14 @@ import path from "node:path";
6
6
  import prettyBytes from "pretty-bytes";
7
7
  import chalk from "chalk";
8
8
  import { oneLine } from "common-tags";
9
- //#region src/lib/logger.ts
9
+ // src/lib/logger.ts
10
10
  const logger = {
11
11
  debug: (...args) => console.log(chalk.gray(...args)),
12
12
  log: (...args) => console.log(...args),
13
13
  warn: (...args) => console.warn(chalk.yellow(...args)),
14
14
  error: (...args) => console.error(chalk.red.bold(...args))
15
15
  };
16
- //#endregion
17
- //#region src/lib/build.ts
16
+ // src/lib/build.ts
18
17
  /**
19
18
  * Runs the specified build command with the provided configuration.
20
19
  *
@@ -105,8 +104,7 @@ const runBuildCommand = async ({ config, watch }) => {
105
104
  await esbuildContext.dispose();
106
105
  }
107
106
  };
108
- //#endregion
109
- //#region src/lib/errors.ts
107
+ // src/lib/errors.ts
110
108
  const errors = {
111
109
  "missing-input": "params.input value was not set properly.",
112
110
  "missing-dest-dir-param": oneLine`Please provide the path to a directory in which
@@ -132,7 +130,6 @@ const errors = {
132
130
  "invalid-search-parameters-supplied": oneLine`Please provide the valid URL search parameter(s)
133
131
  without the leading '/' or '?' (i.e. source,version,language).`
134
132
  };
135
- //#endregion
136
133
  export { logger as i, runBuildCommand as n, runInjectManifestCommand as r, errors as t };
137
134
 
138
- //# sourceMappingURL=errors-DXCDZqq6.js.map
135
+ //# sourceMappingURL=errors-1m418BLR.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"errors-DXCDZqq6.js","names":[],"sources":["../../src/lib/logger.ts","../../src/lib/build.ts","../../src/lib/errors.ts"],"sourcesContent":["/*\n Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\n\nimport chalk from \"chalk\";\n\nexport const logger = {\n debug: (...args: string[]): void => console.log(chalk.gray(...args)),\n log: (...args: string[]): void => console.log(...args),\n warn: (...args: string[]): void => console.warn(chalk.yellow(...args)),\n error: (...args: string[]): void => console.error(chalk.red.bold(...args)),\n};\n","import { getFileManifestEntries, injectManifest, type InjectManifestOptions } from \"@serwist/build\";\nimport chokidar from \"chokidar\";\nimport { glob } from \"glob\";\nimport path from \"node:path\";\nimport prettyBytes from \"pretty-bytes\";\n\nimport type { BuildOptions } from \"../types.js\";\nimport { logger } from \"./logger.js\";\nimport { validateBuildOptions } from \"./validation.js\";\n\nexport interface InjectManifestCommand {\n watch: boolean;\n config: InjectManifestOptions;\n}\n\n/**\n * Runs the specified build command with the provided configuration.\n *\n * @param options\n */\nexport const runInjectManifestCommand = async ({ config, watch }: InjectManifestCommand) => {\n const { count, filePaths, size, warnings } = await injectManifest(config);\n\n for (const warning of warnings) {\n logger.warn(warning);\n }\n\n if (filePaths.length === 1) {\n logger.log(`The service worker file was written to ${config.swDest}.`);\n } else {\n const message = filePaths\n .sort()\n .map((filePath) => ` • ${filePath}`)\n .join(\"\\n\");\n logger.log(`The service worker files were written to:\\n${message}`);\n }\n\n if (count > 0) {\n logger.log(`The service worker will precache ${count} URLs, ` + `totaling ${prettyBytes(size)}.`);\n }\n\n if (watch) {\n logger.log(\"\\nWatching for changes...\");\n }\n};\n\nexport interface BuildCommand {\n config: BuildOptions;\n watch: boolean;\n}\n\nexport const runBuildCommand = async ({ config, watch }: BuildCommand) => {\n const isDev = process.env.NODE_ENV === \"development\";\n const options = await validateBuildOptions(config);\n const { count, manifestEntries, size, warnings } = await getFileManifestEntries(options);\n\n for (const warning of warnings) {\n logger.warn(warning);\n }\n\n const manifestString = manifestEntries === undefined ? \"undefined\" : JSON.stringify(manifestEntries, null, 2);\n\n let esbuild: typeof import(\"esbuild\");\n try {\n esbuild = await import(\"esbuild\");\n } catch (err) {\n throw logger.error(`${err}\\nThis command needs esbuild. Install it using \"npm i esbuild\".`);\n }\n\n const parsedDest = path.parse(config.swDest);\n\n const esbuildContext = await esbuild.context({\n metafile: true,\n sourcemap: isDev,\n format: \"esm\",\n target: [\"chrome111\", \"edge111\", \"firefox111\", \"safari16\"],\n treeShaking: true,\n // `minify` would also automatically set `NODE_ENV` to `\"production\"` when true.\n minify: !isDev,\n bundle: true,\n ...options.esbuildOptions,\n platform: \"browser\",\n define: {\n ...options.esbuildOptions.define,\n ...(options.injectionPoint ? { [options.injectionPoint]: manifestString } : {}),\n },\n outdir: parsedDest.dir,\n entryNames: \"[name]\",\n // Asset and chunk names must be at the top, as our path is `/serwist/[path]`,\n // not `/serwist/[...path]`, meaning that we can't resolve paths deeper\n // than one level.\n assetNames: \"[name]-[hash]\",\n chunkNames: \"[name]-[hash]\",\n entryPoints: [{ in: config.swSrc, out: parsedDest.name }],\n });\n\n const rebuild = async () => {\n const result = await esbuildContext.rebuild();\n\n const filePaths = Object.keys(result.metafile.outputs);\n\n if (filePaths.length === 1) {\n logger.log(`The service worker file was written to ${config.swDest}.`);\n } else {\n const message = filePaths\n .sort()\n .map((filePath) => ` • ${filePath}`)\n .join(\"\\n\");\n logger.log(`The service worker files were written to:\\n${message}`);\n }\n\n if (count > 0) {\n logger.log(`The service worker will precache ${count} URLs, ` + `totaling ${prettyBytes(size)}.`);\n }\n\n if (watch) {\n logger.log(\"\\nWatching for changes...\");\n }\n };\n\n if (watch) {\n if (config.globPatterns) {\n chokidar\n .watch(\n [\n config.swSrc,\n ...(config.disablePrecacheManifest\n ? []\n : await glob(config.globPatterns, {\n cwd: config.globDirectory,\n follow: config.globFollow,\n ignore: config.globIgnores,\n })),\n ],\n {\n ignoreInitial: true,\n cwd: config.globDirectory,\n },\n )\n .on(\"all\", async () => {\n if (config === null) return;\n await rebuild();\n })\n .on(\"ready\", async () => {\n if (config === null) return;\n await rebuild();\n })\n .on(\"error\", (err) => {\n logger.error(err instanceof Error ? err.toString() : \"Unknown error\");\n });\n }\n } else {\n await rebuild();\n await esbuildContext.dispose();\n }\n};\n","/*\n Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport { oneLine as ol } from \"common-tags\";\n\nexport const errors = {\n \"missing-input\": \"params.input value was not set properly.\",\n \"missing-dest-dir-param\": ol`Please provide the path to a directory in which\n the libraries will be copied.`,\n \"invalid-common-js-module\": ol`Please pass in a valid module that\n exports your configuration.`,\n \"config-validation-failed\": \"Your configuration is invalid:\",\n \"serwist-build-runtime-error\": \"Service worker generation failed:\",\n \"unknown-command\": \"Unknown command:\",\n \"no-file-extensions-found\": ol`No files could be found that are suitable for\n caching.`,\n \"no-file-extensions-selected\": \"Please select at least one file extension.\",\n \"invalid-sw-dest\": ol`Please enter a valid path to use for the service worker\n file that's created.`,\n \"glob-directory-invalid\": ol`The path you entered isn't a valid directory.`,\n \"invalid-config-location\": ol`Please enter a valid path to use for the saved\n configuration file.`,\n \"sw-src-missing-injection-point\": ol`That is not a valid source service worker\n file. Please try again with a file containing\n 'self.__SW_MANIFEST'.`,\n \"no-search-parameters-supplied\": ol`Please provide the url search param(s)\n you would like to ignore.`,\n \"invalid-search-parameters-supplied\": ol`Please provide the valid URL search parameter(s)\n without the leading '/' or '?' (i.e. source,version,language).`,\n};\n"],"mappings":";;;;;;;;;AAUA,MAAa,SAAS;CACpB,QAAQ,GAAG,SAAyB,QAAQ,IAAI,MAAM,KAAK,GAAG,IAAI,CAAC;CACnE,MAAM,GAAG,SAAyB,QAAQ,IAAI,GAAG,IAAI;CACrD,OAAO,GAAG,SAAyB,QAAQ,KAAK,MAAM,OAAO,GAAG,IAAI,CAAC;CACrE,QAAQ,GAAG,SAAyB,QAAQ,MAAM,MAAM,IAAI,KAAK,GAAG,IAAI,CAAC;AAC3E;;;;;;;;ACKA,MAAa,2BAA2B,OAAO,EAAE,QAAQ,YAAmC;CAC1F,MAAM,EAAE,OAAO,WAAW,MAAM,aAAa,MAAM,eAAe,MAAM;CAExE,KAAK,MAAM,WAAW,UACpB,OAAO,KAAK,OAAO;CAGrB,IAAI,UAAU,WAAW,GACvB,OAAO,IAAI,0CAA0C,OAAO,OAAO,EAAE;MAChE;EACL,MAAM,UAAU,UACb,KAAK,CAAC,CACN,KAAK,aAAa,OAAO,UAAU,CAAC,CACpC,KAAK,IAAI;EACZ,OAAO,IAAI,8CAA8C,SAAS;CACpE;CAEA,IAAI,QAAQ,GACV,OAAO,IAAI,oCAAoC,MAAM,kBAAu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UAAU,CAAC,CACpC,KAAK,IAAI;GACZ,OAAO,IAAI,8CAA8C,SAAS;EACpE;EAEA,IAAI,QAAQ,GACV,OAAO,IAAI,oCAAoC,MAAM,kBAAuB,YAAY,IAAI,EAAE,EAAE;EAGlG,IAAI,OACF,OAAO,IAAI,2BAA2B;CAE1C;CAEA,IAAI,OACE;MAAA,OAAO,cACT,SACG,MACC,CACE,OAAO,OACP,GAAI,OAAO,0BACP,CAAC,IACD,MAAM,KAAK,OAAO,cAAc;GAC9B,KAAK,OAAO;GACZ,QAAQ,OAAO;GACf,QAAQ,OAAO;EACjB,CAAC,CACP,GACA;GACE,eAAe;GACf,KAAK,OAAO;EACd,CACF,CAAC,CACA,GAAG,OAAO,YAAY;GACrB,IAAI,WAAW,MAAM;GACrB,MAAM,QAAQ;EAChB,CAAC,CAAC,CACD,GAAG,SAAS,YAAY;GACvB,IAAI,WAAW,MAAM;GACrB,MAAM,QAAQ;EAChB,CAAC,CAAC,CACD,GAAG,UAAU,QAAQ;GACpB,OAAO,MAAM,eAAe,QAAQ,IAAI,SAAS,IAAI,eAAe;EACtE,CAAC;CAAA,OAEA;EACL,MAAM,QAAQ;EACd,MAAM,eAAe,QAAQ;CAC/B;AACF;;;AClJA,MAAa,SAAS;CACpB,iBAAiB;CACjB,0BAA0B,OAAE;;CAE5B,4BAA4B,OAAE;;CAE9B,4BAA4B;CAC5B,+BAA+B;CAC/B,mBAAmB;CACnB,4BAA4B,OAAE;;CAE9B,+BAA+B;CAC/B,mBAAmB,OAAE;;CAErB,0BAA0B,OAAE;CAC5B,2BAA2B,OAAE;;CAE7B,kCAAkC,OAAE;;;CAGpC,iCAAiC,OAAE;;CAEnC,sCAAsC,OAAE;;AAE1C"}
1
+ {"version":3,"file":"errors-1m418BLR.js","names":[],"sources":["../../src/lib/logger.ts","../../src/lib/build.ts","../../src/lib/errors.ts"],"sourcesContent":["/*\n Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\n\nimport chalk from \"chalk\";\n\nexport const logger = {\n debug: (...args: string[]): void => console.log(chalk.gray(...args)),\n log: (...args: string[]): void => console.log(...args),\n warn: (...args: string[]): void => console.warn(chalk.yellow(...args)),\n error: (...args: string[]): void => console.error(chalk.red.bold(...args)),\n};\n","import { getFileManifestEntries, injectManifest, type InjectManifestOptions } from \"@serwist/build\";\nimport chokidar from \"chokidar\";\nimport { glob } from \"glob\";\nimport path from \"node:path\";\nimport prettyBytes from \"pretty-bytes\";\n\nimport type { BuildOptions } from \"../types.js\";\nimport { logger } from \"./logger.js\";\nimport { validateBuildOptions } from \"./validation.js\";\n\nexport interface InjectManifestCommand {\n watch: boolean;\n config: InjectManifestOptions;\n}\n\n/**\n * Runs the specified build command with the provided configuration.\n *\n * @param options\n */\nexport const runInjectManifestCommand = async ({ config, watch }: InjectManifestCommand) => {\n const { count, filePaths, size, warnings } = await injectManifest(config);\n\n for (const warning of warnings) {\n logger.warn(warning);\n }\n\n if (filePaths.length === 1) {\n logger.log(`The service worker file was written to ${config.swDest}.`);\n } else {\n const message = filePaths\n .sort()\n .map((filePath) => ` • ${filePath}`)\n .join(\"\\n\");\n logger.log(`The service worker files were written to:\\n${message}`);\n }\n\n if (count > 0) {\n logger.log(`The service worker will precache ${count} URLs, ` + `totaling ${prettyBytes(size)}.`);\n }\n\n if (watch) {\n logger.log(\"\\nWatching for changes...\");\n }\n};\n\nexport interface BuildCommand {\n config: BuildOptions;\n watch: boolean;\n}\n\nexport const runBuildCommand = async ({ config, watch }: BuildCommand) => {\n const isDev = process.env.NODE_ENV === \"development\";\n const options = await validateBuildOptions(config);\n const { count, manifestEntries, size, warnings } = await getFileManifestEntries(options);\n\n for (const warning of warnings) {\n logger.warn(warning);\n }\n\n const manifestString = manifestEntries === undefined ? \"undefined\" : JSON.stringify(manifestEntries, null, 2);\n\n let esbuild: typeof import(\"esbuild\");\n try {\n esbuild = await import(\"esbuild\");\n } catch (err) {\n throw logger.error(`${err}\\nThis command needs esbuild. Install it using \"npm i esbuild\".`);\n }\n\n const parsedDest = path.parse(config.swDest);\n\n const esbuildContext = await esbuild.context({\n metafile: true,\n sourcemap: isDev,\n format: \"esm\",\n target: [\"chrome111\", \"edge111\", \"firefox111\", \"safari16\"],\n treeShaking: true,\n // `minify` would also automatically set `NODE_ENV` to `\"production\"` when true.\n minify: !isDev,\n bundle: true,\n ...options.esbuildOptions,\n platform: \"browser\",\n define: {\n ...options.esbuildOptions.define,\n ...(options.injectionPoint ? { [options.injectionPoint]: manifestString } : {}),\n },\n outdir: parsedDest.dir,\n entryNames: \"[name]\",\n // Asset and chunk names must be at the top, as our path is `/serwist/[path]`,\n // not `/serwist/[...path]`, meaning that we can't resolve paths deeper\n // than one level.\n assetNames: \"[name]-[hash]\",\n chunkNames: \"[name]-[hash]\",\n entryPoints: [{ in: config.swSrc, out: parsedDest.name }],\n });\n\n const rebuild = async () => {\n const result = await esbuildContext.rebuild();\n\n const filePaths = Object.keys(result.metafile.outputs);\n\n if (filePaths.length === 1) {\n logger.log(`The service worker file was written to ${config.swDest}.`);\n } else {\n const message = filePaths\n .sort()\n .map((filePath) => ` • ${filePath}`)\n .join(\"\\n\");\n logger.log(`The service worker files were written to:\\n${message}`);\n }\n\n if (count > 0) {\n logger.log(`The service worker will precache ${count} URLs, ` + `totaling ${prettyBytes(size)}.`);\n }\n\n if (watch) {\n logger.log(\"\\nWatching for changes...\");\n }\n };\n\n if (watch) {\n if (config.globPatterns) {\n chokidar\n .watch(\n [\n config.swSrc,\n ...(config.disablePrecacheManifest\n ? []\n : await glob(config.globPatterns, {\n cwd: config.globDirectory,\n follow: config.globFollow,\n ignore: config.globIgnores,\n })),\n ],\n {\n ignoreInitial: true,\n cwd: config.globDirectory,\n },\n )\n .on(\"all\", async () => {\n if (config === null) return;\n await rebuild();\n })\n .on(\"ready\", async () => {\n if (config === null) return;\n await rebuild();\n })\n .on(\"error\", (err) => {\n logger.error(err instanceof Error ? err.toString() : \"Unknown error\");\n });\n }\n } else {\n await rebuild();\n await esbuildContext.dispose();\n }\n};\n","/*\n Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport { oneLine as ol } from \"common-tags\";\n\nexport const errors = {\n \"missing-input\": \"params.input value was not set properly.\",\n \"missing-dest-dir-param\": ol`Please provide the path to a directory in which\n the libraries will be copied.`,\n \"invalid-common-js-module\": ol`Please pass in a valid module that\n exports your configuration.`,\n \"config-validation-failed\": \"Your configuration is invalid:\",\n \"serwist-build-runtime-error\": \"Service worker generation failed:\",\n \"unknown-command\": \"Unknown command:\",\n \"no-file-extensions-found\": ol`No files could be found that are suitable for\n caching.`,\n \"no-file-extensions-selected\": \"Please select at least one file extension.\",\n \"invalid-sw-dest\": ol`Please enter a valid path to use for the service worker\n file that's created.`,\n \"glob-directory-invalid\": ol`The path you entered isn't a valid directory.`,\n \"invalid-config-location\": ol`Please enter a valid path to use for the saved\n configuration file.`,\n \"sw-src-missing-injection-point\": ol`That is not a valid source service worker\n file. Please try again with a file containing\n 'self.__SW_MANIFEST'.`,\n \"no-search-parameters-supplied\": ol`Please provide the url search param(s)\n you would like to ignore.`,\n \"invalid-search-parameters-supplied\": ol`Please provide the valid URL search parameter(s)\n without the leading '/' or '?' (i.e. source,version,language).`,\n};\n"],"mappings":";;;;;;;;;AAUA,MAAa,SAAS;CACpB,QAAQ,GAAG,SAAyB,QAAQ,IAAI,MAAM,KAAK,GAAG,IAAI,CAAC;CACnE,MAAM,GAAG,SAAyB,QAAQ,IAAI,GAAG,IAAI;CACrD,OAAO,GAAG,SAAyB,QAAQ,KAAK,MAAM,OAAO,GAAG,IAAI,CAAC;CACrE,QAAQ,GAAG,SAAyB,QAAQ,MAAM,MAAM,IAAI,KAAK,GAAG,IAAI,CAAC;AAC3E;;;;;;;ACKA,MAAa,2BAA2B,OAAO,EAAE,QAAQ,YAAmC;CAC1F,MAAM,EAAE,OAAO,W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A4B,OAAE;;CAE9B,+BAA+B;CAC/B,mBAAmB,OAAE;;CAErB,0BAA0B,OAAE;CAC5B,2BAA2B,OAAE;;CAE7B,kCAAkC,OAAE;;;CAGpC,iCAAiC,OAAE;;CAEnC,sCAAsC,OAAE;;AAE1C"}
@@ -1,7 +1,7 @@
1
- import { t as SUPPORTED_ESBUILD_OPTIONS } from "./constants-Dcy7HyXu.js";
1
+ import { t as SUPPORTED_ESBUILD_OPTIONS } from "./constants-CFc5chua.js";
2
2
  import { injectManifestOptions } from "@serwist/build/schema";
3
3
  import z from "zod";
4
- //#region \0rolldown/runtime.js
4
+ // \0rolldown/runtime.js
5
5
  var __defProp = Object.defineProperty;
6
6
  var __exportAll = (all, no_symbols) => {
7
7
  let target = {};
@@ -12,18 +12,13 @@ var __exportAll = (all, no_symbols) => {
12
12
  if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
13
13
  return target;
14
14
  };
15
- //#endregion
16
- //#region src/lib/schema.ts
17
- var schema_exports = /* @__PURE__ */ __exportAll({
18
- buildOptions: () => buildOptions,
19
- buildPartial: () => buildPartial
20
- });
15
+ // src/lib/schema.ts
16
+ var schema_exports = /* @__PURE__ */ __exportAll({ buildOptions: () => buildOptions });
21
17
  const buildPartial = z.strictObject({ esbuildOptions: z.partialRecord(z.literal(SUPPORTED_ESBUILD_OPTIONS), z.any()).prefault({}) });
22
18
  const buildOptions = z.strictObject({
23
19
  ...injectManifestOptions.shape,
24
20
  ...buildPartial.shape
25
21
  });
26
- //#endregion
27
22
  export { buildPartial as n, schema_exports as r, buildOptions as t };
28
23
 
29
- //# sourceMappingURL=schema-DXN5gKwC.js.map
24
+ //# sourceMappingURL=schema-DXNYFiGi.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"schema-DXN5gKwC.js","names":[],"sources":["../../src/lib/schema.ts"],"sourcesContent":["import { injectManifestOptions } from \"@serwist/build/schema\";\nimport z from \"zod\";\nimport { SUPPORTED_ESBUILD_OPTIONS } from \"./constants.js\";\n\nexport const buildPartial = z.strictObject({\n esbuildOptions: z.partialRecord(z.literal(SUPPORTED_ESBUILD_OPTIONS), z.any()).prefault({}),\n});\n\nexport const buildOptions = z.strictObject({\n ...injectManifestOptions.shape,\n ...buildPartial.shape,\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAIA,MAAa,eAAe,EAAE,aAAa,EACzC,gBAAgB,EAAE,cAAc,EAAE,QAAQ,yBAAyB,GAAG,EAAE,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,EAC5F,CAAC;AAED,MAAa,eAAe,EAAE,aAAa;CACzC,GAAG,sBAAsB;CACzB,GAAG,aAAa;AAClB,CAAC"}
1
+ {"version":3,"file":"schema-DXNYFiGi.js","names":[],"sources":["../../src/lib/schema.ts"],"sourcesContent":["import { injectManifestOptions } from \"@serwist/build/schema\";\nimport z from \"zod\";\nimport { SUPPORTED_ESBUILD_OPTIONS } from \"./constants.js\";\n\nexport const buildPartial = z.strictObject({\n esbuildOptions: z.partialRecord(z.literal(SUPPORTED_ESBUILD_OPTIONS), z.any()).prefault({}),\n});\n\nexport const buildOptions = z.strictObject({\n ...injectManifestOptions.shape,\n ...buildPartial.shape,\n});\n"],"mappings":";;;;;;;;;;;;;;;;AAIA,MAAa,eAAe,EAAE,aAAa,EACzC,gBAAgB,EAAE,cAAc,EAAE,QAAQ,yBAAyB,GAAG,EAAE,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,EAC5F,CAAC;AAED,MAAa,eAAe,EAAE,aAAa;CACzC,GAAG,sBAAsB;CACzB,GAAG,aAAa;AAClB,CAAC"}
@@ -2,15 +2,12 @@ import { InjectManifestOptions, InjectManifestOptionsComplete } from "@serwist/b
2
2
  import { Flag } from "meow";
3
3
  import { Prettify, Require } from "@serwist/utils";
4
4
  import { BuildOptions } from "esbuild";
5
- //#region src/lib/constants.d.ts
6
5
  declare const constants: {
7
6
  defaultConfigFile: string;
8
7
  ignoredDirectories: string[];
9
8
  ignoredFileExtensions: string[];
10
9
  };
11
10
  declare const SUPPORTED_ESBUILD_OPTIONS: readonly ["sourcemap", "legalComments", "sourceRoot", "sourcesContent", "format", "globalName", "target", "supported", "define", "treeShaking", "minify", "mangleProps", "reserveProps", "mangleQuoted", "mangleCache", "drop", "dropLabels", "minifyWhitespace", "minifyIdentifiers", "minifySyntax", "lineLimit", "charset", "ignoreAnnotations", "jsx", "jsxFactory", "jsxFragment", "jsxImportSource", "jsxDev", "jsxSideEffects", "pure", "keepNames", "absPaths", "color", "logLevel", "logLimit", "logOverride", "tsconfigRaw", "bundle", "splitting", "preserveSymlinks", "external", "packages", "alias", "loader", "resolveExtensions", "mainFields", "conditions", "allowOverwrite", "tsconfig", "outExtension", "publicPath", "inject", "banner", "footer", "plugins"];
12
- //#endregion
13
- //#region src/types.d.ts
14
11
  type StringFlag = Flag<"string", string> | Flag<"string", string[], true>;
15
12
  type BooleanFlag = Flag<"boolean", boolean> | Flag<"boolean", boolean[], true>;
16
13
  type NumberFlag = Flag<"number", number> | Flag<"number", number[], true>;
@@ -28,6 +25,5 @@ interface BuildPartial {
28
25
  type BuildResolved = Require<BuildPartial, "esbuildOptions">;
29
26
  type BuildOptions$1 = Prettify<InjectManifestOptions & BuildPartial>;
30
27
  type BuildOptionsComplete = Prettify<InjectManifestOptionsComplete & BuildResolved>;
31
- //#endregion
32
28
  export { BuildOptionsComplete as a, EsbuildOptions as c, StringFlag as d, SUPPORTED_ESBUILD_OPTIONS as f, BuildOptions$1 as i, EsbuildSupportedOptions as l, AnyFlags as n, BuildPartial as o, constants as p, BooleanFlag as r, BuildResolved as s, AnyFlag as t, NumberFlag as u };
33
- //# sourceMappingURL=types-DIGJFlHE.d.ts.map
29
+ //# sourceMappingURL=types-DVHukkmb.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types-DVHukkmb.d.ts","names":["BaseEsbuildOptions","BuildOptions"],"sources":["../../src/lib/constants.ts","../../src/types.ts"],"mappings":";;;;cASa;EACX;EACA;EACA;;cAGW;KCTD,aAAa,yBAAyB;KACtC,cAAc,2BAA2B;KACzC,aAAa,yBAAyB;KACtC,UAAU,aAAa,cAAc;KACrC,WAAW,eAAe;KAE1B,kCAAkC;KAElC,iBAAiB,KAAKA,cAAoB;UAErC;;;;;EAKf,iBAAiB;;KAGP,gBAAgB,QAAQ;KAExBC,iBAAe,SAAS,wBAAwB;KAEhD,uBAAuB,SAAS,gCAAgC"}
package/dist/index.d.mts CHANGED
@@ -1,6 +1,5 @@
1
- import { a as BuildOptionsComplete, c as EsbuildOptions, d as StringFlag, f as SUPPORTED_ESBUILD_OPTIONS, i as BuildOptions, l as EsbuildSupportedOptions, n as AnyFlags, o as BuildPartial, p as constants, r as BooleanFlag, s as BuildResolved, t as AnyFlag, u as NumberFlag } from "./chunks/types-DIGJFlHE.js";
1
+ import { a as BuildOptionsComplete, c as EsbuildOptions, d as StringFlag, f as SUPPORTED_ESBUILD_OPTIONS, i as BuildOptions, l as EsbuildSupportedOptions, n as AnyFlags, o as BuildPartial, p as constants, r as BooleanFlag, s as BuildResolved, t as AnyFlag, u as NumberFlag } from "./chunks/types-DVHukkmb.js";
2
2
  import { InjectManifestOptions } from "@serwist/build";
3
- //#region src/lib/build.d.ts
4
3
  interface InjectManifestCommand {
5
4
  watch: boolean;
6
5
  config: InjectManifestOptions;
@@ -16,8 +15,6 @@ interface BuildCommand {
16
15
  watch: boolean;
17
16
  }
18
17
  export declare const runBuildCommand: ({ config, watch }: BuildCommand) => Promise<void>;
19
- //#endregion
20
- //#region src/lib/errors.d.ts
21
18
  export declare const errors: {
22
19
  "missing-input": string;
23
20
  "missing-dest-dir-param": string;
@@ -34,6 +31,5 @@ export declare const errors: {
34
31
  "no-search-parameters-supplied": string;
35
32
  "invalid-search-parameters-supplied": string;
36
33
  };
37
- //#endregion
38
34
  export { type AnyFlag, type AnyFlags, type BooleanFlag, type BuildCommand, type BuildOptions, type BuildOptionsComplete, type BuildPartial, type BuildResolved, type EsbuildOptions, type EsbuildSupportedOptions, type InjectManifestCommand, type NumberFlag, SUPPORTED_ESBUILD_OPTIONS, type StringFlag, constants };
39
35
  //# sourceMappingURL=index.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../src/lib/build.ts","../src/lib/errors.ts"],"mappings":";;;UAUiB;EACf;EACA,QAAQ;;;;;;;qBAQG,6BAAwB,QAAA,SAA6B,0BAAqB;UA0BtE;EACf,QAAQ;EACR;;qBAGW,oBAAe,QAAA,SAA6B,iBAAY;;;qBC1CxD;EACX;EACA;EAEA;EAEA;EACA;EACA;EACA;EAEA;EACA;EAEA;EACA;EAEA;EAGA;EAEA"}
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../src/lib/build.ts","../src/lib/errors.ts"],"mappings":";;UAUiB;EACf;EACA,QAAQ;;;;;;;qBAQG,6BAAwB,QAAA,SAA6B,0BAAqB;UA0BtE;EACf,QAAQ;EACR;;qBAGW,oBAAe,QAAA,SAA6B,iBAAY;qBC1CxD;EACX;EACA;EAEA;EAEA;EACA;EACA;EACA;EAEA;EACA;EAEA;EACA;EAEA;EAGA;EAEA"}
package/dist/index.mjs CHANGED
@@ -1,3 +1,3 @@
1
- import { n as runBuildCommand, r as runInjectManifestCommand, t as errors } from "./chunks/errors-DXCDZqq6.js";
2
- import { n as constants, t as SUPPORTED_ESBUILD_OPTIONS } from "./chunks/constants-Dcy7HyXu.js";
1
+ import { n as runBuildCommand, r as runInjectManifestCommand, t as errors } from "./chunks/errors-1m418BLR.js";
2
+ import { n as constants, t as SUPPORTED_ESBUILD_OPTIONS } from "./chunks/constants-CFc5chua.js";
3
3
  export { SUPPORTED_ESBUILD_OPTIONS, constants, errors, runBuildCommand, runInjectManifestCommand };
@@ -1,6 +1,5 @@
1
- import { a as BuildOptionsComplete } from "./chunks/types-DIGJFlHE.js";
1
+ import { a as BuildOptionsComplete } from "./chunks/types-DVHukkmb.js";
2
2
  import z from "zod";
3
- //#region src/lib/schema.d.ts
4
3
  export declare const buildPartial: z.ZodObject<{
5
4
  esbuildOptions: z.ZodPrefault<z.ZodRecord<z.ZodLiteral<"absPaths" | "alias" | "allowOverwrite" | "banner" | "bundle" | "charset" | "color" | "conditions" | "define" | "drop" | "dropLabels" | "external" | "footer" | "format" | "globalName" | "ignoreAnnotations" | "inject" | "jsx" | "jsxDev" | "jsxFactory" | "jsxFragment" | "jsxImportSource" | "jsxSideEffects" | "keepNames" | "legalComments" | "lineLimit" | "loader" | "logLevel" | "logLimit" | "logOverride" | "mainFields" | "mangleCache" | "mangleProps" | "mangleQuoted" | "minify" | "minifyIdentifiers" | "minifySyntax" | "minifyWhitespace" | "outExtension" | "packages" | "plugins" | "preserveSymlinks" | "publicPath" | "pure" | "reserveProps" | "resolveExtensions" | "sourceRoot" | "sourcemap" | "sourcesContent" | "splitting" | "supported" | "target" | "treeShaking" | "tsconfig" | "tsconfigRaw"> & z.core.$partial, z.ZodAny>>;
6
5
  }, z.core.$strict>;
@@ -78,8 +77,5 @@ export declare const buildOptions: z.ZodObject<{
78
77
  swSrc: z.ZodString;
79
78
  esbuildOptions: z.ZodPrefault<z.ZodRecord<z.ZodLiteral<"absPaths" | "alias" | "allowOverwrite" | "banner" | "bundle" | "charset" | "color" | "conditions" | "define" | "drop" | "dropLabels" | "external" | "footer" | "format" | "globalName" | "ignoreAnnotations" | "inject" | "jsx" | "jsxDev" | "jsxFactory" | "jsxFragment" | "jsxImportSource" | "jsxSideEffects" | "keepNames" | "legalComments" | "lineLimit" | "loader" | "logLevel" | "logLimit" | "logOverride" | "mainFields" | "mangleCache" | "mangleProps" | "mangleQuoted" | "minify" | "minifyIdentifiers" | "minifySyntax" | "minifyWhitespace" | "outExtension" | "packages" | "plugins" | "preserveSymlinks" | "publicPath" | "pure" | "reserveProps" | "resolveExtensions" | "sourceRoot" | "sourcemap" | "sourcesContent" | "splitting" | "supported" | "target" | "treeShaking" | "tsconfig" | "tsconfigRaw"> & z.core.$partial, z.ZodAny>>;
80
79
  }, z.core.$strict>;
81
- //#endregion
82
- //#region src/lib/validation.d.ts
83
80
  export declare const validateBuildOptions: (input: unknown) => Promise<BuildOptionsComplete>;
84
- //#endregion
85
81
  //# sourceMappingURL=index.schema.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.schema.d.mts","names":[],"sources":["../src/lib/schema.ts","../src/lib/validation.ts"],"mappings":";;;qBAIa,cAAY,EAAA;;GAEvB,EAAA,KAAA;qBAEW,cAAY,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAGvB,EAAA,KAAA;;;qBCPW,uBAAoB,mBAA2B,QAAQ"}
1
+ {"version":3,"file":"index.schema.d.mts","names":[],"sources":["../src/lib/schema.ts","../src/lib/validation.ts"],"mappings":";;qBAIa,cAAY,EAAA;;GAEvB,EAAA,KAAA;qBAEW,cAAY,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAGvB,EAAA,KAAA;qBCPW,uBAAoB,mBAA2B,QAAQ"}
@@ -1,3 +1,3 @@
1
- import { n as buildPartial, t as buildOptions } from "./chunks/schema-DXN5gKwC.js";
2
- import { r as validateBuildOptions } from "./chunks/constants-Dcy7HyXu.js";
1
+ import { n as buildPartial, t as buildOptions } from "./chunks/schema-DXNYFiGi.js";
2
+ import { r as validateBuildOptions } from "./chunks/constants-CFc5chua.js";
3
3
  export { buildOptions, buildPartial, validateBuildOptions };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@serwist/cli",
3
- "version": "9.5.14",
3
+ "version": "9.5.15",
4
4
  "type": "module",
5
5
  "description": "The command line interface of Serwist.",
6
6
  "files": [
@@ -55,12 +55,12 @@
55
55
  },
56
56
  "dependencies": {
57
57
  "@inquirer/prompts": "8.7.2",
58
- "@serwist/build": "9.5.14",
59
- "@serwist/utils": "9.5.14",
58
+ "@serwist/build": "9.5.15",
59
+ "@serwist/utils": "9.5.15",
60
60
  "chalk": "6.0.1",
61
61
  "chokidar": "5.0.0",
62
62
  "common-tags": "1.8.2",
63
- "glob": "13.0.6",
63
+ "glob": "~14.0.6",
64
64
  "meow": "14.1.0",
65
65
  "pretty-bytes": "6.1.1",
66
66
  "stringify-object": "6.0.0",
@@ -1 +0,0 @@
1
- {"version":3,"file":"types-DIGJFlHE.d.ts","names":["BaseEsbuildOptions","BuildOptions"],"sources":["../../src/lib/constants.ts","../../src/types.ts"],"mappings":";;;;;cASa;EACX;EACA;EACA;;cAGW;;;KCTD,aAAa,yBAAyB;KACtC,cAAc,2BAA2B;KACzC,aAAa,yBAAyB;KACtC,UAAU,aAAa,cAAc;KACrC,WAAW,eAAe;KAE1B,kCAAkC;KAElC,iBAAiB,KAAKA,cAAoB;UAErC;;;;;EAKf,iBAAiB;;KAGP,gBAAgB,QAAQ;KAExBC,iBAAe,SAAS,wBAAwB;KAEhD,uBAAuB,SAAS,gCAAgC"}