@serwist/cli 9.0.0-preview.12 → 9.0.0-preview.14

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.
Files changed (31) hide show
  1. package/dist/app.d.ts.map +1 -1
  2. package/dist/bin.d.ts +0 -1
  3. package/dist/bin.d.ts.map +1 -1
  4. package/dist/bin.js +136 -228
  5. package/dist/lib/ask-questions.d.ts +9 -0
  6. package/dist/lib/ask-questions.d.ts.map +1 -0
  7. package/dist/lib/cleanup-stack-trace.d.ts +1 -1
  8. package/dist/lib/cleanup-stack-trace.d.ts.map +1 -1
  9. package/dist/lib/constants.d.ts +0 -1
  10. package/dist/lib/constants.d.ts.map +1 -1
  11. package/dist/lib/help-text.d.ts +1 -1
  12. package/dist/lib/help-text.d.ts.map +1 -1
  13. package/dist/lib/read-config.d.ts +1 -1
  14. package/dist/lib/read-config.d.ts.map +1 -1
  15. package/dist/lib/run-wizard.d.ts +1 -1
  16. package/dist/lib/run-wizard.d.ts.map +1 -1
  17. package/package.json +9 -18
  18. package/dist/lib/questions/ask-config-location.d.ts +0 -2
  19. package/dist/lib/questions/ask-config-location.d.ts.map +0 -1
  20. package/dist/lib/questions/ask-extensions-to-cache.d.ts +0 -2
  21. package/dist/lib/questions/ask-extensions-to-cache.d.ts.map +0 -1
  22. package/dist/lib/questions/ask-questions.d.ts +0 -9
  23. package/dist/lib/questions/ask-questions.d.ts.map +0 -1
  24. package/dist/lib/questions/ask-root-of-web-app.d.ts +0 -2
  25. package/dist/lib/questions/ask-root-of-web-app.d.ts.map +0 -1
  26. package/dist/lib/questions/ask-start_url-query-params.d.ts +0 -2
  27. package/dist/lib/questions/ask-start_url-query-params.d.ts.map +0 -1
  28. package/dist/lib/questions/ask-sw-dest.d.ts +0 -2
  29. package/dist/lib/questions/ask-sw-dest.d.ts.map +0 -1
  30. package/dist/lib/questions/ask-sw-src.d.ts +0 -2
  31. package/dist/lib/questions/ask-sw-src.d.ts.map +0 -1
package/dist/app.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"app.d.ts","sourceRoot":"","sources":["../src/app.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,MAAM,IAAI,UAAU,EAAE,MAAM,MAAM,CAAC;AAIjD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAyC/C,eAAO,MAAM,GAAG,WAAkB,WAAW,cAAc,CAAC,KAAG,QAAQ,IAAI,CAgG1E,CAAC"}
1
+ {"version":3,"file":"app.d.ts","sourceRoot":"","sources":["../src/app.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,MAAM,IAAI,UAAU,EAAE,MAAM,MAAM,CAAC;AAGjD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAyC/C,eAAO,MAAM,GAAG,WAAkB,WAAW,cAAc,CAAC,KAAG,QAAQ,IAAI,CAiF1E,CAAC"}
package/dist/bin.d.ts CHANGED
@@ -2,7 +2,6 @@
2
2
  import type { AnyFlags, BooleanFlag } from "./types.js";
3
3
  export interface SupportedFlags extends AnyFlags {
4
4
  debug: BooleanFlag;
5
- injectManifest: BooleanFlag;
6
5
  watch: BooleanFlag;
7
6
  }
8
7
  //# sourceMappingURL=bin.d.ts.map
package/dist/bin.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"bin.d.ts","sourceRoot":"","sources":["../src/bin.ts"],"names":[],"mappings":";AAkBA,OAAO,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAExD,MAAM,WAAW,cAAe,SAAQ,QAAQ;IAC9C,KAAK,EAAE,WAAW,CAAC;IACnB,cAAc,EAAE,WAAW,CAAC;IAC5B,KAAK,EAAE,WAAW,CAAC;CACpB"}
1
+ {"version":3,"file":"bin.d.ts","sourceRoot":"","sources":["../src/bin.ts"],"names":[],"mappings":";AAiBA,OAAO,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAExD,MAAM,WAAW,cAAe,SAAQ,QAAQ;IAC9C,KAAK,EAAE,WAAW,CAAC;IACnB,KAAK,EAAE,WAAW,CAAC;CACpB"}
package/dist/bin.js CHANGED
@@ -1,19 +1,18 @@
1
1
  #! /usr/bin/env node
2
2
  import meow from 'meow';
3
3
  import updateNotifier from 'update-notifier';
4
- import assert from 'assert';
4
+ import assert from 'node:assert';
5
+ import path from 'node:path';
5
6
  import { injectManifest } from '@serwist/build';
6
7
  import chokidar from 'chokidar';
7
8
  import prettyBytes from 'pretty-bytes';
8
- import upath from 'upath';
9
9
  import { oneLine } from 'common-tags';
10
10
  import chalk from 'chalk';
11
- import { createRequire } from 'node:module';
12
- import fse from 'fs-extra';
11
+ import { statSync, writeFileSync } from 'node:fs';
13
12
  import stringifyObject from 'stringify-object';
14
- import inquirer from 'inquirer';
15
13
  import { glob } from 'glob';
16
- import ora from 'ora';
14
+ import inquirer from 'inquirer';
15
+ import upath from 'upath';
17
16
 
18
17
  const constants = {
19
18
  defaultConfigFile: "serwist.config.js",
@@ -22,10 +21,6 @@ const constants = {
22
21
  ],
23
22
  ignoredFileExtensions: [
24
23
  "map"
25
- ],
26
- ignoreURLParametersMatching: [
27
- /^utm_/,
28
- /^fbclid$/
29
24
  ]
30
25
  };
31
26
 
@@ -62,32 +57,52 @@ const logger = {
62
57
  error: (...args)=>console.error(chalk.red.bold(...args))
63
58
  };
64
59
 
65
- const require = createRequire(import.meta.url);
66
- function readConfig(configFile) {
67
- return require(configFile);
68
- }
69
-
70
- const name$3 = "configLocation";
71
- const configLocationQuestion = {
72
- name: name$3,
73
- message: oneLine`Where would you like to save these configuration options?`,
74
- type: "input",
75
- default: constants.defaultConfigFile
60
+ const readConfig = async (configFile)=>{
61
+ return (await import(configFile)).default;
76
62
  };
77
- function askQuestion$5() {
78
- return inquirer.prompt([
79
- configLocationQuestion
80
- ]);
81
- }
82
- async function askConfigLocation() {
83
- const answers = await askQuestion$5();
84
- const configLocation = answers[name$3].trim();
85
- assert(configLocation, errors["invalid-config-location"]);
86
- return configLocation;
87
- }
88
63
 
89
- const name$2 = "globPatterns";
90
- async function getAllFileExtensions(globDirectory) {
64
+ const getSubdirectories = async ()=>{
65
+ return await glob("*/", {
66
+ ignore: constants.ignoredDirectories.map((directory)=>`${directory}/`)
67
+ });
68
+ };
69
+ const askRootOfWebApp = async ()=>{
70
+ const subdirectories = await getSubdirectories();
71
+ const { manualDirectoryInput, globDirectory } = await (()=>{
72
+ if (subdirectories.length > 0) {
73
+ const manualEntryChoice = "Manually enter path";
74
+ return inquirer.prompt([
75
+ {
76
+ name: "globDirectory",
77
+ type: "list",
78
+ message: oneLine`What is the root of your web app (i.e. which directory do
79
+ you deploy)?`,
80
+ choices: [
81
+ ...subdirectories,
82
+ new inquirer.Separator(),
83
+ manualEntryChoice
84
+ ]
85
+ },
86
+ {
87
+ name: "manualDirectoryInput",
88
+ when: (answers)=>answers.globDirectory === manualEntryChoice,
89
+ message: "Please enter the path to the root of your web app:"
90
+ }
91
+ ]);
92
+ }
93
+ return inquirer.prompt([
94
+ {
95
+ name: "globDirectory",
96
+ message: "Please enter the path to the root of your web app:",
97
+ default: "."
98
+ }
99
+ ]);
100
+ })();
101
+ const stat = statSync(manualDirectoryInput || globDirectory);
102
+ assert(stat.isDirectory(), errors["glob-directory-invalid"]);
103
+ return manualDirectoryInput || globDirectory;
104
+ };
105
+ const getAllFileExtensions = async (globDirectory)=>{
91
106
  const files = await glob("**/*.*", {
92
107
  cwd: globDirectory,
93
108
  nodir: true,
@@ -106,192 +121,99 @@ async function getAllFileExtensions(globDirectory) {
106
121
  return [
107
122
  ...extensions
108
123
  ];
109
- }
110
- async function askQuestion$4(globDirectory) {
111
- const spinner = ora({
112
- text: `Examining files in ${globDirectory}...`,
113
- stream: process.stdout
114
- }).start();
124
+ };
125
+ const askQuestions = async ()=>{
126
+ const globDirectory = await askRootOfWebApp();
115
127
  const fileExtensions = await getAllFileExtensions(globDirectory);
116
- spinner.stop();
117
128
  assert(fileExtensions.length > 0, errors["no-file-extensions-found"]);
118
- return inquirer.prompt([
129
+ const { swSrc, swDest, selectedExtensions, configLocation } = await inquirer.prompt([
119
130
  {
120
- name: name$2,
131
+ name: "swSrc",
132
+ message: oneLine`Where's your existing service worker file? To be used with
133
+ injectManifest, it should include a call to
134
+ 'self.__SW_MANIFEST'`,
135
+ type: "input",
136
+ validate (input) {
137
+ if (typeof input !== "string") {
138
+ return "You must provide a valid 'swSrc'!";
139
+ }
140
+ if (!statSync(input, {
141
+ throwIfNoEntry: false
142
+ })?.isFile()) {
143
+ return "'swSrc' must point to a valid file!";
144
+ }
145
+ return true;
146
+ }
147
+ },
148
+ {
149
+ name: "swDest",
150
+ message: "Where would you like your service worker file to be saved?",
151
+ type: "input",
152
+ default: upath.join(globDirectory, "sw.js"),
153
+ validate (input) {
154
+ if (typeof input !== "string") {
155
+ return "You must provide a valid 'swDest'!";
156
+ }
157
+ return true;
158
+ }
159
+ },
160
+ {
161
+ name: "selectedExtensions",
121
162
  message: "Which file types would you like to precache?",
122
163
  type: "checkbox",
123
164
  choices: fileExtensions,
124
- default: fileExtensions
125
- }
126
- ]);
127
- }
128
- async function askExtensionsToCache(globDirectory) {
129
- const answers = await askQuestion$4(globDirectory);
130
- const extensions = answers[name$2];
131
- assert(extensions.length > 0, errors["no-file-extensions-selected"]);
132
- const extensionsPattern = extensions.length === 1 ? extensions[0] : `{${extensions.join(",")}}`;
133
- return [
134
- `**/*.${extensionsPattern}`
135
- ];
136
- }
137
-
138
- const ROOT_PROMPT = "Please enter the path to the root of your web app:";
139
- const questionRootDirectory = "globDirectory";
140
- const questionManualInput = "manualDirectoryInput";
141
- async function getSubdirectories() {
142
- return await glob("*/", {
143
- ignore: constants.ignoredDirectories.map((directory)=>`${directory}/`)
144
- });
145
- }
146
- async function askQuestion$3() {
147
- const subdirectories = await getSubdirectories();
148
- if (subdirectories.length > 0) {
149
- const manualEntryChoice = "Manually enter path";
150
- return inquirer.prompt([
151
- {
152
- name: questionRootDirectory,
153
- type: "list",
154
- message: oneLine`What is the root of your web app (i.e. which directory do
155
- you deploy)?`,
156
- choices: subdirectories.concat([
157
- new inquirer.Separator(),
158
- manualEntryChoice
159
- ])
160
- },
161
- {
162
- name: questionManualInput,
163
- when: (answers)=>answers.globDirectory === manualEntryChoice,
164
- message: ROOT_PROMPT
165
+ default: fileExtensions,
166
+ validate (input) {
167
+ if (!Array.isArray(input)) {
168
+ return "'selectedExtensions' is not an array. This is most likely a bug.";
169
+ }
170
+ if (input.length === 0) {
171
+ return errors["no-file-extensions-selected"];
172
+ }
173
+ return true;
165
174
  }
166
- ]);
167
- }
168
- return inquirer.prompt([
169
- {
170
- name: questionRootDirectory,
171
- message: ROOT_PROMPT,
172
- default: "."
173
- }
174
- ]);
175
- }
176
- async function askRootOfWebApp() {
177
- const { manualDirectoryInput, globDirectory } = await askQuestion$3();
178
- try {
179
- const stat = await fse.stat(manualDirectoryInput || globDirectory);
180
- assert(stat.isDirectory());
181
- } catch (error) {
182
- throw new Error(errors["glob-directory-invalid"]);
183
- }
184
- return manualDirectoryInput || globDirectory;
185
- }
186
-
187
- const START_URL_QUERY_PARAMS_PROMPT = "Please enter the search parameter(s) that you would like to ignore (separated by comma):";
188
- const question_ignoreURLParametersMatching = "ignoreURLParametersMatching";
189
- const question_shouldAskForIgnoreURLParametersMatching = "shouldAskForIgnoreURLParametersMatching";
190
- async function askQuestion$2() {
191
- return inquirer.prompt([
192
- {
193
- name: question_shouldAskForIgnoreURLParametersMatching,
194
- message: oneLine`Does your web app manifest include search parameter(s)
195
- in the 'start_url', other than 'utm_' or 'fbclid'
196
- (like '?source=pwa')?`,
197
- type: "confirm",
198
- default: false
199
175
  },
200
176
  {
201
- name: question_ignoreURLParametersMatching,
202
- when: (answer)=>answer.shouldAskForIgnoreURLParametersMatching,
203
- message: START_URL_QUERY_PARAMS_PROMPT,
204
- type: "input"
205
- }
206
- ]);
207
- }
208
- async function askQueryParametersInStartUrl(defaultIgnoredSearchParameters = constants.ignoreURLParametersMatching) {
209
- const { shouldAskForIgnoreURLParametersMatching, ignoreURLParametersMatching = "" } = await askQuestion$2();
210
- if (!shouldAskForIgnoreURLParametersMatching) {
211
- return defaultIgnoredSearchParameters;
212
- }
213
- assert(ignoreURLParametersMatching.length > 0, errors["no-search-parameters-supplied"]);
214
- const ignoreSearchParameters = ignoreURLParametersMatching.trim().split(",").filter(Boolean);
215
- assert(ignoreSearchParameters.length > 0, errors["no-search-parameters-supplied"]);
216
- assert(ignoreSearchParameters.every((param)=>!param.match(/^[^\w|-]/g)), errors["invalid-search-parameters-supplied"]);
217
- return defaultIgnoredSearchParameters.concat(ignoreSearchParameters.map((searchParam)=>new RegExp(`^${searchParam}`)));
218
- }
219
-
220
- const name$1 = "swDest";
221
- function askQuestion$1(defaultDir) {
222
- return inquirer.prompt([
223
- {
224
- name: name$1,
225
- message: "Where would you like your service worker file to be saved?",
177
+ name: "configLocation",
178
+ message: "Where would you like to save these configuration options?",
226
179
  type: "input",
227
- default: upath.join(defaultDir, "sw.js")
228
- }
229
- ]);
230
- }
231
- async function askSWDest(defaultDir = ".") {
232
- const answers = await askQuestion$1(defaultDir);
233
- const swDest = answers[name$1].trim();
234
- assert(swDest, errors["invalid-sw-dest"]);
235
- return swDest;
236
- }
237
-
238
- const name = "swSrc";
239
- function askQuestion() {
240
- return inquirer.prompt([
241
- {
242
- name,
243
- message: oneLine`Where's your existing service worker file? To be used with
244
- injectManifest, it should include a call to
245
- 'self.__SW_MANIFEST'`,
246
- type: "input"
180
+ default: constants.defaultConfigFile,
181
+ validate (input) {
182
+ if (typeof input !== "string") {
183
+ return "You must provide a valid location!";
184
+ }
185
+ return true;
186
+ }
247
187
  }
248
188
  ]);
249
- }
250
- async function askSWSrc() {
251
- const answers = await askQuestion();
252
- return answers[name] ? answers[name].trim() : null;
253
- }
254
-
255
- async function askQuestions(options = {}) {
256
- const isInjectManifest = "injectManifest" in options;
257
- const globDirectory = await askRootOfWebApp();
258
- const globPatterns = await askExtensionsToCache(globDirectory);
259
- const swSrc = isInjectManifest ? await askSWSrc() : undefined;
260
- const swDest = await askSWDest(globDirectory);
261
- const configLocation = await askConfigLocation();
262
- const ignoreURLParametersMatching = isInjectManifest ? undefined : await askQueryParametersInStartUrl();
189
+ const globPatterns = [
190
+ `**/*.${selectedExtensions.length === 1 ? selectedExtensions[0] : `{${selectedExtensions.join(",")}}`}`
191
+ ];
263
192
  const config = {
264
193
  globDirectory,
265
194
  globPatterns,
195
+ swSrc,
266
196
  swDest
267
197
  };
268
- if (swSrc) {
269
- config.swSrc = swSrc;
270
- }
271
- if (ignoreURLParametersMatching) {
272
- config.ignoreURLParametersMatching = ignoreURLParametersMatching;
273
- }
274
198
  return {
275
199
  config,
276
200
  configLocation
277
201
  };
278
- }
202
+ };
279
203
 
280
- async function runWizard(options = {}) {
281
- const { configLocation, config } = await askQuestions(options);
282
- const contents = `module.exports = ${stringifyObject(config)};`;
283
- await fse.writeFile(configLocation, contents);
204
+ async function runWizard() {
205
+ const { configLocation, config } = await askQuestions();
206
+ const contents = `/** @type {import("@serwist/build").InjectManifestOptions} */\nexport default ${stringifyObject(config)};`;
207
+ writeFileSync(configLocation, contents);
284
208
  logger.log(`To build your service worker, run
285
209
 
286
- serwist injectManifest ${configLocation}
210
+ serwist inject-manifest ${configLocation}
287
211
 
288
- as part of a build process. See https://goo.gl/fdTQBf for details.`);
289
- const configDocsURL = "injectManifest" in options ? "https://goo.gl/8bs14N" : "https://goo.gl/gVo87N";
290
- logger.log(oneLine`You can further customize your service worker by making changes
291
- to ${configLocation}. See ${configDocsURL} for details.`);
212
+ as part of a build process.`);
213
+ logger.log(`You can further customize your service worker by making changes to ${configLocation}. See https://serwist.pages.dev/docs/build/inject-manifest/configuring for details.`);
292
214
  }
293
215
 
294
- async function runBuildCommand({ config, watch }) {
216
+ const runBuildCommand = async ({ config, watch })=>{
295
217
  const { count, filePaths, size, warnings } = await injectManifest(config);
296
218
  for (const warning of warnings){
297
219
  logger.warn(warning);
@@ -306,27 +228,22 @@ async function runBuildCommand({ config, watch }) {
306
228
  if (watch) {
307
229
  logger.log("\nWatching for changes...");
308
230
  }
309
- }
231
+ };
310
232
  const app = async (params)=>{
311
233
  assert(params && Array.isArray(params.input), errors["missing-input"]);
312
234
  const [command = "help", option] = params.input;
313
235
  switch(command){
314
236
  case "wizard":
315
237
  {
316
- await runWizard(params.flags);
238
+ await runWizard();
317
239
  break;
318
240
  }
319
- case "copyLibraries":
241
+ case "inject-manifest":
320
242
  {
321
- logger.log("This feature is under maintenance. We are really sorry for the inconvenience.");
322
- break;
323
- }
324
- case "injectManifest":
325
- {
326
- const configPath = upath.resolve(process.cwd(), option || constants.defaultConfigFile);
243
+ const configPath = path.resolve(process.cwd(), option || constants.defaultConfigFile);
327
244
  let config;
328
245
  try {
329
- config = readConfig(configPath);
246
+ config = await readConfig(configPath);
330
247
  } catch (error) {
331
248
  config = null;
332
249
  if (error instanceof Error) {
@@ -384,7 +301,7 @@ const app = async (params)=>{
384
301
  }
385
302
  };
386
303
 
387
- function cleanupStackTrace(error, moduleName) {
304
+ const cleanupStackTrace = (error, moduleName)=>{
388
305
  if (!error.stack) {
389
306
  return "";
390
307
  }
@@ -400,43 +317,34 @@ function cleanupStackTrace(error, moduleName) {
400
317
  }
401
318
  });
402
319
  return frames.slice(startFrame, lastFrame + 1).join("\n");
403
- }
320
+ };
404
321
 
405
322
  const helpText = `Usage:
406
323
  $ serwist <command> [options]
407
324
 
408
325
  Commands:
409
- wizard [--injectManifest]
326
+ wizard
410
327
  Runs the configuration wizard, which will generate a
411
328
  config file based on answers to questions.
412
329
 
413
- injectManifest [<path/to/config.js>] [--watch]
330
+ inject-manifest [<path/to/config.js>] [--watch]
414
331
  Takes an existing service worker file and creates a
415
- copy of it with a precache manifest "injected" into
416
- it. The precache manifest is generated based on the
417
- options in the config file (defaults to serwist.config.js).
418
- If --watch is provided, the CLI will stay running, and will
419
- rebuild the service worker each time a file in the precache
420
- manifest changes.
421
- See https://bit.ly/wb-injectManifest
422
-
423
- copyLibraries <path/to/parent/dir>
424
- Makes a local copy of all of the Workbox libraries inside
425
- a version directory at the location specified. This is intended
426
- for developers using injectManifest who prefer using local,
427
- rather than CDN hosted, libraries.
332
+ copy of it with a precache manifest injected. The precache
333
+ manifest is generated based on the options in the config file
334
+ (defaults to 'serwist.config.js'). If '--watch' is provided, the
335
+ CLI will stay running and rebuild the service worker each
336
+ time a file in the precache manifest changes. See
337
+ https://serwist.pages.dev/docs/cli for more information.
428
338
 
429
- Config file:
430
- In 'injectManifest' mode, the config file should be a
431
- JavaScript file, in CommonJS module format.
432
- By default, a config file named serwist.config.js in the current
433
- directory is assumed, but this can be overridden.
339
+ Configuration file:
340
+ The 'inject-manifest' command expects the configuration
341
+ file to be a JavaScript file. By default, it is assumed
342
+ to be named 'serwist.config.js' and located in the current
343
+ directory, but this can be overridden.
434
344
 
435
345
  Examples:
436
346
  $ serwist wizard
437
- $ serwist wizard --injectManifest
438
- $ serwist injectManifest configs/serwist-dev-config.js
439
- $ serwist copyLibraries build/
347
+ $ serwist inject-manifest configs/serwist-config.js
440
348
  `;
441
349
 
442
350
  void (async ()=>{
@@ -0,0 +1,9 @@
1
+ interface ConfigWithConfigLocation {
2
+ config: {
3
+ [key: string]: any;
4
+ };
5
+ configLocation: string;
6
+ }
7
+ export declare const askQuestions: () => Promise<ConfigWithConfigLocation>;
8
+ export {};
9
+ //# sourceMappingURL=ask-questions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ask-questions.d.ts","sourceRoot":"","sources":["../../src/lib/ask-questions.ts"],"names":[],"mappings":"AAuFA,UAAU,wBAAwB;IAChC,MAAM,EAAE;QACN,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;KACpB,CAAC;IACF,cAAc,EAAE,MAAM,CAAC;CACxB;AAED,eAAO,MAAM,YAAY,QAAa,QAAQ,wBAAwB,CAsFrE,CAAC"}
@@ -1,2 +1,2 @@
1
- export declare function cleanupStackTrace(error: Error, moduleName: string): string;
1
+ export declare const cleanupStackTrace: (error: Error, moduleName: string) => string;
2
2
  //# sourceMappingURL=cleanup-stack-trace.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"cleanup-stack-trace.d.ts","sourceRoot":"","sources":["../../src/lib/cleanup-stack-trace.ts"],"names":[],"mappings":"AAYA,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,CAiB1E"}
1
+ {"version":3,"file":"cleanup-stack-trace.d.ts","sourceRoot":"","sources":["../../src/lib/cleanup-stack-trace.ts"],"names":[],"mappings":"AAYA,eAAO,MAAM,iBAAiB,UAAW,KAAK,cAAc,MAAM,KAAG,MAiBpE,CAAC"}
@@ -2,6 +2,5 @@ export declare const constants: {
2
2
  defaultConfigFile: string;
3
3
  ignoredDirectories: string[];
4
4
  ignoredFileExtensions: string[];
5
- ignoreURLParametersMatching: RegExp[];
6
5
  };
7
6
  //# sourceMappingURL=constants.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/lib/constants.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,SAAS;;;;;CAKrB,CAAC"}
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/lib/constants.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,SAAS;;;;CAIrB,CAAC"}
@@ -1,2 +1,2 @@
1
- export declare const helpText = "Usage:\n$ serwist <command> [options]\n\nCommands:\n wizard [--injectManifest]\n Runs the configuration wizard, which will generate a\n config file based on answers to questions.\n\n injectManifest [<path/to/config.js>] [--watch]\n Takes an existing service worker file and creates a\n copy of it with a precache manifest \"injected\" into\n it. The precache manifest is generated based on the\n options in the config file (defaults to serwist.config.js).\n If --watch is provided, the CLI will stay running, and will\n rebuild the service worker each time a file in the precache\n manifest changes.\n See https://bit.ly/wb-injectManifest\n\n copyLibraries <path/to/parent/dir>\n Makes a local copy of all of the Workbox libraries inside\n a version directory at the location specified. This is intended\n for developers using injectManifest who prefer using local,\n rather than CDN hosted, libraries.\n\nConfig file:\n In 'injectManifest' mode, the config file should be a\n JavaScript file, in CommonJS module format.\n By default, a config file named serwist.config.js in the current\n directory is assumed, but this can be overridden.\n\nExamples:\n $ serwist wizard\n $ serwist wizard --injectManifest\n $ serwist injectManifest configs/serwist-dev-config.js\n $ serwist copyLibraries build/\n";
1
+ export declare 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\nConfiguration file:\n The 'inject-manifest' command expects 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";
2
2
  //# sourceMappingURL=help-text.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"help-text.d.ts","sourceRoot":"","sources":["../../src/lib/help-text.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,QAAQ,60CAmCpB,CAAC"}
1
+ {"version":3,"file":"help-text.d.ts","sourceRoot":"","sources":["../../src/lib/help-text.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,QAAQ,4+BA0BpB,CAAC"}
@@ -1,3 +1,3 @@
1
1
  import type { InjectManifestOptions } from "@serwist/build";
2
- export declare function readConfig(configFile: string): InjectManifestOptions;
2
+ export declare const readConfig: (configFile: string) => Promise<InjectManifestOptions>;
3
3
  //# sourceMappingURL=read-config.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"read-config.d.ts","sourceRoot":"","sources":["../../src/lib/read-config.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AAM5D,wBAAgB,UAAU,CAAC,UAAU,EAAE,MAAM,GAAG,qBAAqB,CAEpE"}
1
+ {"version":3,"file":"read-config.d.ts","sourceRoot":"","sources":["../../src/lib/read-config.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AAE5D,eAAO,MAAM,UAAU,eAAsB,MAAM,KAAG,QAAQ,qBAAqB,CAElF,CAAC"}
@@ -1,2 +1,2 @@
1
- export declare function runWizard(options?: {}): Promise<void>;
1
+ export declare function runWizard(): Promise<void>;
2
2
  //# sourceMappingURL=run-wizard.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"run-wizard.d.ts","sourceRoot":"","sources":["../../src/lib/run-wizard.ts"],"names":[],"mappings":"AAeA,wBAAsB,SAAS,CAAC,OAAO,KAAK,GAAG,OAAO,CAAC,IAAI,CAAC,CAiB3D"}
1
+ {"version":3,"file":"run-wizard.d.ts","sourceRoot":"","sources":["../../src/lib/run-wizard.ts"],"names":[],"mappings":"AAaA,wBAAsB,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC,CAgB/C"}
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@serwist/cli",
3
- "version": "9.0.0-preview.12",
3
+ "version": "9.0.0-preview.14",
4
4
  "type": "module",
5
- "description": "@serwist/cli is the command line interface for Serwist.",
5
+ "description": "The command line interface of Serwist.",
6
6
  "files": [
7
7
  "dist"
8
8
  ],
@@ -28,18 +28,17 @@
28
28
  },
29
29
  "dependencies": {
30
30
  "chalk": "5.3.0",
31
- "chokidar": "3.5.3",
31
+ "chokidar": "3.6.0",
32
32
  "common-tags": "1.8.2",
33
33
  "fs-extra": "11.2.0",
34
34
  "glob": "10.3.10",
35
- "inquirer": "9.2.14",
36
- "meow": "13.1.0",
37
- "ora": "8.0.1",
35
+ "inquirer": "9.2.15",
36
+ "meow": "13.2.0",
38
37
  "pretty-bytes": "6.1.1",
39
38
  "stringify-object": "5.0.0",
40
39
  "upath": "2.0.1",
41
40
  "update-notifier": "7.0.0",
42
- "@serwist/build": "9.0.0-preview.12"
41
+ "@serwist/build": "9.0.0-preview.14"
43
42
  },
44
43
  "devDependencies": {
45
44
  "@types/common-tags": "1.8.4",
@@ -47,17 +46,9 @@
47
46
  "@types/inquirer": "9.0.7",
48
47
  "@types/stringify-object": "4.0.5",
49
48
  "@types/update-notifier": "6.0.8",
50
- "rollup": "4.9.6",
51
- "typescript": "5.4.0-dev.20240206",
52
- "@serwist/constants": "9.0.0-preview.12"
53
- },
54
- "peerDependencies": {
55
- "typescript": ">=5.0.0"
56
- },
57
- "peerDependenciesMeta": {
58
- "typescript": {
59
- "optional": true
60
- }
49
+ "rollup": "4.13.0",
50
+ "typescript": "5.5.0-dev.20240312",
51
+ "@serwist/constants": "9.0.0-preview.14"
61
52
  },
62
53
  "scripts": {
63
54
  "build": "rimraf dist && cross-env NODE_ENV=production rollup --config rollup.config.js",
@@ -1,2 +0,0 @@
1
- export declare function askConfigLocation(): Promise<string>;
2
- //# sourceMappingURL=ask-config-location.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ask-config-location.d.ts","sourceRoot":"","sources":["../../../src/lib/questions/ask-config-location.ts"],"names":[],"mappings":"AAgCA,wBAAsB,iBAAiB,IAAI,OAAO,CAAC,MAAM,CAAC,CASzD"}
@@ -1,2 +0,0 @@
1
- export declare function askExtensionsToCache(globDirectory: string): Promise<string[]>;
2
- //# sourceMappingURL=ask-extensions-to-cache.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ask-extensions-to-cache.d.ts","sourceRoot":"","sources":["../../../src/lib/questions/ask-extensions-to-cache.ts"],"names":[],"mappings":"AA8EA,wBAAsB,oBAAoB,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAWnF"}
@@ -1,9 +0,0 @@
1
- interface ConfigWithConfigLocation {
2
- config: {
3
- [key: string]: any;
4
- };
5
- configLocation: string;
6
- }
7
- export declare function askQuestions(options?: {}): Promise<ConfigWithConfigLocation>;
8
- export {};
9
- //# sourceMappingURL=ask-questions.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ask-questions.d.ts","sourceRoot":"","sources":["../../../src/lib/questions/ask-questions.ts"],"names":[],"mappings":"AAeA,UAAU,wBAAwB;IAChC,MAAM,EAAE;QACN,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;KACpB,CAAC;IACF,cAAc,EAAE,MAAM,CAAC;CACxB;AAED,wBAAsB,YAAY,CAAC,OAAO,KAAK,GAAG,OAAO,CAAC,wBAAwB,CAAC,CA6BlF"}
@@ -1,2 +0,0 @@
1
- export declare function askRootOfWebApp(): Promise<string>;
2
- //# sourceMappingURL=ask-root-of-web-app.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ask-root-of-web-app.d.ts","sourceRoot":"","sources":["../../../src/lib/questions/ask-root-of-web-app.ts"],"names":[],"mappings":"AAqEA,wBAAsB,eAAe,IAAI,OAAO,CAAC,MAAM,CAAC,CAWvD"}
@@ -1,2 +0,0 @@
1
- export declare function askQueryParametersInStartUrl(defaultIgnoredSearchParameters?: RegExp[]): Promise<RegExp[]>;
2
- //# sourceMappingURL=ask-start_url-query-params.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ask-start_url-query-params.d.ts","sourceRoot":"","sources":["../../../src/lib/questions/ask-start_url-query-params.ts"],"names":[],"mappings":"AA8CA,wBAAsB,4BAA4B,CAChD,8BAA8B,GAAE,MAAM,EAA0C,GAC/E,OAAO,CAAC,MAAM,EAAE,CAAC,CAkBnB"}
@@ -1,2 +0,0 @@
1
- export declare function askSWDest(defaultDir?: string): Promise<string>;
2
- //# sourceMappingURL=ask-sw-dest.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ask-sw-dest.d.ts","sourceRoot":"","sources":["../../../src/lib/questions/ask-sw-dest.ts"],"names":[],"mappings":"AAiCA,wBAAsB,SAAS,CAAC,UAAU,SAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CASjE"}
@@ -1,2 +0,0 @@
1
- export declare function askSWSrc(): Promise<string | null>;
2
- //# sourceMappingURL=ask-sw-src.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ask-sw-src.d.ts","sourceRoot":"","sources":["../../../src/lib/questions/ask-sw-src.ts"],"names":[],"mappings":"AA8BA,wBAAsB,QAAQ,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAIvD"}