@serwist/webpack-plugin 9.5.6 → 9.5.8

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 (51) hide show
  1. package/dist/chunks/relative-to-output-path-Gvhd54pA.js +49 -0
  2. package/dist/chunks/relative-to-output-path-Gvhd54pA.js.map +1 -0
  3. package/dist/chunks/schema-CpgCa1bB.js +51 -0
  4. package/dist/chunks/schema-CpgCa1bB.js.map +1 -0
  5. package/dist/index.d.mts +137 -0
  6. package/dist/index.d.mts.map +1 -0
  7. package/dist/index.internal.d.mts +44 -0
  8. package/dist/index.internal.d.mts.map +1 -0
  9. package/dist/index.internal.mjs +31 -0
  10. package/dist/index.internal.mjs.map +1 -0
  11. package/dist/index.mjs +345 -0
  12. package/dist/index.mjs.map +1 -0
  13. package/dist/index.schema.d.mts +90 -0
  14. package/dist/index.schema.d.mts.map +1 -0
  15. package/dist/index.schema.mjs +2 -0
  16. package/package.json +19 -20
  17. package/dist/chunks/relative-to-output-path.js +0 -34
  18. package/dist/chunks/schema.js +0 -37
  19. package/dist/index.d.ts +0 -6
  20. package/dist/index.d.ts.map +0 -1
  21. package/dist/index.internal.d.ts +0 -4
  22. package/dist/index.internal.d.ts.map +0 -1
  23. package/dist/index.internal.js +0 -21
  24. package/dist/index.js +0 -281
  25. package/dist/index.schema.d.ts +0 -3
  26. package/dist/index.schema.d.ts.map +0 -1
  27. package/dist/index.schema.js +0 -3
  28. package/dist/inject-manifest.d.ts +0 -72
  29. package/dist/inject-manifest.d.ts.map +0 -1
  30. package/dist/lib/child-compilation-plugin.d.ts +0 -24
  31. package/dist/lib/child-compilation-plugin.d.ts.map +0 -1
  32. package/dist/lib/get-asset-hash.d.ts +0 -9
  33. package/dist/lib/get-asset-hash.d.ts.map +0 -1
  34. package/dist/lib/get-manifest-entries-from-compilation.d.ts +0 -8
  35. package/dist/lib/get-manifest-entries-from-compilation.d.ts.map +0 -1
  36. package/dist/lib/get-script-files-for-chunks.d.ts +0 -3
  37. package/dist/lib/get-script-files-for-chunks.d.ts.map +0 -1
  38. package/dist/lib/get-sourcemap-asset-name.d.ts +0 -20
  39. package/dist/lib/get-sourcemap-asset-name.d.ts.map +0 -1
  40. package/dist/lib/perform-child-compilation.d.ts +0 -16
  41. package/dist/lib/perform-child-compilation.d.ts.map +0 -1
  42. package/dist/lib/relative-to-output-path.d.ts +0 -12
  43. package/dist/lib/relative-to-output-path.d.ts.map +0 -1
  44. package/dist/lib/resolve-webpack-url.d.ts +0 -13
  45. package/dist/lib/resolve-webpack-url.d.ts.map +0 -1
  46. package/dist/lib/schema.d.ts +0 -86
  47. package/dist/lib/schema.d.ts.map +0 -1
  48. package/dist/lib/types.d.ts +0 -61
  49. package/dist/lib/types.d.ts.map +0 -1
  50. package/dist/lib/validator.d.ts +0 -3
  51. package/dist/lib/validator.d.ts.map +0 -1
package/dist/index.d.ts DELETED
@@ -1,6 +0,0 @@
1
- import { InjectManifest } from "./inject-manifest.js";
2
- import type { InjectManifestOptions, InjectManifestOptionsComplete, WebpackPartial, WebpackResolved } from "./lib/types.js";
3
- import { validateInjectManifestOptions } from "./lib/validator.js";
4
- export { InjectManifest, validateInjectManifestOptions };
5
- export type { InjectManifestOptions, InjectManifestOptionsComplete, WebpackPartial, WebpackResolved };
6
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,KAAK,EAAE,qBAAqB,EAAE,6BAA6B,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAC5H,OAAO,EAAE,6BAA6B,EAAE,MAAM,oBAAoB,CAAC;AAEnE,OAAO,EAAE,cAAc,EAAE,6BAA6B,EAAE,CAAC;AACzD,YAAY,EAAE,qBAAqB,EAAE,6BAA6B,EAAE,cAAc,EAAE,eAAe,EAAE,CAAC"}
@@ -1,4 +0,0 @@
1
- import { ChildCompilationPlugin } from "./lib/child-compilation-plugin.js";
2
- import { relativeToOutputPath } from "./lib/relative-to-output-path.js";
3
- export { ChildCompilationPlugin, relativeToOutputPath };
4
- //# sourceMappingURL=index.internal.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.internal.d.ts","sourceRoot":"","sources":["../src/index.internal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAC3E,OAAO,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;AAExE,OAAO,EAAE,sBAAsB,EAAE,oBAAoB,EAAE,CAAC"}
@@ -1,21 +0,0 @@
1
- import { p as performChildCompilation, r as relativeToOutputPath } from './chunks/relative-to-output-path.js';
2
- import 'node:path';
3
- import '@serwist/utils';
4
-
5
- class ChildCompilationPlugin {
6
- src;
7
- dest;
8
- plugins;
9
- constructor({ src, dest, plugins }){
10
- this.src = src;
11
- this.dest = dest;
12
- this.plugins = plugins;
13
- }
14
- apply(compiler) {
15
- compiler.hooks.make.tapPromise(this.constructor.name, (compilation)=>performChildCompilation(compiler, compilation, this.constructor.name, this.src, relativeToOutputPath(compilation, this.dest), this.plugins).catch((error)=>{
16
- compilation.errors.push(error);
17
- }));
18
- }
19
- }
20
-
21
- export { ChildCompilationPlugin, relativeToOutputPath };
package/dist/index.js DELETED
@@ -1,281 +0,0 @@
1
- import path from 'node:path';
2
- import { transformManifest, getSourceMapURL, escapeRegExp, replaceAndUpdateSourceMap } from '@serwist/build';
3
- import { toUnix } from '@serwist/utils';
4
- import prettyBytes from 'pretty-bytes';
5
- import crypto from 'node:crypto';
6
- import { r as relativeToOutputPath, p as performChildCompilation } from './chunks/relative-to-output-path.js';
7
- import { validationErrorMap, SerwistConfigError } from '@serwist/build/schema';
8
-
9
- const getAssetHash = (asset)=>{
10
- if (asset.info?.immutable) {
11
- return null;
12
- }
13
- return crypto.createHash("md5").update(asset.source.source()).digest("hex");
14
- };
15
-
16
- const resolveWebpackURL = (publicPath, ...paths)=>{
17
- if (publicPath === "auto") {
18
- return paths.join("");
19
- }
20
- return [
21
- publicPath,
22
- ...paths
23
- ].join("");
24
- };
25
-
26
- const checkConditions = (asset, compilation, conditions = [])=>{
27
- const matchPart = compilation.compiler.webpack.ModuleFilenameHelpers.matchPart;
28
- for (const condition of conditions){
29
- if (typeof condition === "function") {
30
- if (condition({
31
- asset,
32
- compilation
33
- })) {
34
- return true;
35
- }
36
- } else if (matchPart(asset.name, condition)) {
37
- return true;
38
- }
39
- }
40
- return false;
41
- };
42
- const getNamesOfAssetsInChunkOrGroup = (compilation, chunkOrGroup)=>{
43
- const chunkGroup = compilation.namedChunkGroups?.get(chunkOrGroup);
44
- if (chunkGroup) {
45
- const assetNames = [];
46
- for (const chunk of chunkGroup.chunks){
47
- assetNames.push(...getNamesOfAssetsInChunk(chunk));
48
- }
49
- return assetNames;
50
- }
51
- const chunk = compilation.namedChunks?.get(chunkOrGroup);
52
- if (chunk) {
53
- return getNamesOfAssetsInChunk(chunk);
54
- }
55
- return null;
56
- };
57
- const getNamesOfAssetsInChunk = (chunk)=>{
58
- const assetNames = [];
59
- assetNames.push(...chunk.files);
60
- if (chunk.auxiliaryFiles) {
61
- assetNames.push(...chunk.auxiliaryFiles);
62
- }
63
- return assetNames;
64
- };
65
- const filterAssets = (compilation, config)=>{
66
- const filteredAssets = new Set();
67
- const assets = compilation.getAssets();
68
- const allowedAssetNames = new Set();
69
- if (Array.isArray(config.chunks)) {
70
- for (const name of config.chunks){
71
- const assetsInChunkOrGroup = getNamesOfAssetsInChunkOrGroup(compilation, name);
72
- if (assetsInChunkOrGroup) {
73
- for (const assetName of assetsInChunkOrGroup){
74
- allowedAssetNames.add(assetName);
75
- }
76
- } else {
77
- compilation.warnings.push(new Error(`The chunk '${name}' was provided in your Serwist chunks config, but was not found in the compilation.`));
78
- }
79
- }
80
- }
81
- const deniedAssetNames = new Set();
82
- if (Array.isArray(config.excludeChunks)) {
83
- for (const name of config.excludeChunks){
84
- const assetsInChunkOrGroup = getNamesOfAssetsInChunkOrGroup(compilation, name);
85
- if (assetsInChunkOrGroup) {
86
- for (const assetName of assetsInChunkOrGroup){
87
- deniedAssetNames.add(assetName);
88
- }
89
- }
90
- }
91
- }
92
- for (const asset of assets){
93
- if (deniedAssetNames.has(asset.name)) {
94
- continue;
95
- }
96
- if (Array.isArray(config.chunks) && !allowedAssetNames.has(asset.name)) {
97
- continue;
98
- }
99
- const isExcluded = checkConditions(asset, compilation, config.exclude);
100
- if (isExcluded) {
101
- continue;
102
- }
103
- const isIncluded = !Array.isArray(config.include) || checkConditions(asset, compilation, config.include);
104
- if (!isIncluded) {
105
- continue;
106
- }
107
- filteredAssets.add(asset);
108
- }
109
- return filteredAssets;
110
- };
111
- const getManifestEntriesFromCompilation = async (compilation, config)=>{
112
- const filteredAssets = filterAssets(compilation, config);
113
- const { publicPath } = compilation.options.output;
114
- const fileDetails = Array.from(filteredAssets).map((asset)=>{
115
- return {
116
- file: resolveWebpackURL(publicPath, asset.name),
117
- hash: getAssetHash(asset),
118
- size: asset.source.size() || 0
119
- };
120
- });
121
- const { manifestEntries, size, warnings } = await transformManifest({
122
- fileDetails,
123
- additionalPrecacheEntries: config.additionalPrecacheEntries,
124
- dontCacheBustURLsMatching: config.dontCacheBustURLsMatching,
125
- manifestTransforms: config.manifestTransforms,
126
- maximumFileSizeToCacheInBytes: config.maximumFileSizeToCacheInBytes,
127
- modifyURLPrefix: config.modifyURLPrefix,
128
- transformParam: compilation,
129
- disablePrecacheManifest: config.disablePrecacheManifest
130
- });
131
- for (const warning of warnings){
132
- compilation.warnings.push(new Error(warning));
133
- }
134
- const sortedEntries = manifestEntries?.sort((a, b)=>a.url === b.url ? 0 : a.url > b.url ? 1 : -1);
135
- return {
136
- size,
137
- sortedEntries
138
- };
139
- };
140
-
141
- const getSourcemapAssetName = (compilation, swContents, swDest)=>{
142
- const url = getSourceMapURL(swContents);
143
- if (url) {
144
- const swAssetDirname = path.dirname(swDest);
145
- const sourcemapURLAssetName = path.normalize(path.join(swAssetDirname, url));
146
- if (compilation.getAsset(sourcemapURLAssetName)) {
147
- return sourcemapURLAssetName;
148
- }
149
- }
150
- return undefined;
151
- };
152
-
153
- const validateInjectManifestOptions = async (input)=>{
154
- const result = await (await import('./chunks/schema.js')).injectManifestOptions.spa(input, {
155
- error: validationErrorMap
156
- });
157
- if (!result.success) {
158
- throw new SerwistConfigError({
159
- moduleName: "@serwist/webpack-plugin",
160
- message: JSON.stringify(result.error.format(), null, 2)
161
- });
162
- }
163
- return result.data;
164
- };
165
-
166
- const _generatedAssetNames = new Set();
167
- class InjectManifest {
168
- config;
169
- alreadyCalled;
170
- webpack;
171
- constructor(config){
172
- this.config = config;
173
- this.alreadyCalled = false;
174
- this.webpack = null;
175
- }
176
- propagateWebpackConfig(compiler) {
177
- this.webpack = compiler.webpack;
178
- const parsedSwSrc = path.parse(this.config.swSrc);
179
- this.config = {
180
- swDest: `${parsedSwSrc.name}.js`,
181
- ...this.config
182
- };
183
- }
184
- async getManifestEntries(compilation, config) {
185
- if (config.disablePrecacheManifest) {
186
- return {
187
- size: 0,
188
- sortedEntries: undefined,
189
- manifestString: "undefined"
190
- };
191
- }
192
- if (this.alreadyCalled) {
193
- const warningMessage = `${this.constructor.name} has been called multiple times, perhaps due to running webpack in --watch mode. The precache manifest generated after the first call may be inaccurate! Please see https://github.com/GoogleChrome/workbox/issues/1790 for more information.`;
194
- if (!compilation.warnings.some((warning)=>warning instanceof Error && warning.message === warningMessage)) {
195
- compilation.warnings.push(new Error(warningMessage));
196
- }
197
- } else {
198
- this.alreadyCalled = true;
199
- }
200
- config.exclude.push(({ asset })=>_generatedAssetNames.has(asset.name));
201
- const { size, sortedEntries } = await getManifestEntriesFromCompilation(compilation, config);
202
- let manifestString = JSON.stringify(sortedEntries);
203
- if (this.config.compileSrc && !(compilation.options?.devtool === "eval-cheap-source-map" && compilation.options.optimization?.minimize)) {
204
- manifestString = manifestString.replace(/"/g, `'`);
205
- }
206
- return {
207
- size,
208
- sortedEntries,
209
- manifestString
210
- };
211
- }
212
- apply(compiler) {
213
- this.propagateWebpackConfig(compiler);
214
- compiler.hooks.make.tapPromise(this.constructor.name, (compilation)=>this.handleMake(compiler, compilation).catch((error)=>{
215
- compilation.errors.push(error);
216
- }));
217
- const { PROCESS_ASSETS_STAGE_OPTIMIZE_TRANSFER } = this.webpack.Compilation;
218
- compiler.hooks.thisCompilation.tap(this.constructor.name, (compilation)=>{
219
- compilation.hooks.processAssets.tapPromise({
220
- name: this.constructor.name,
221
- stage: PROCESS_ASSETS_STAGE_OPTIMIZE_TRANSFER - 10
222
- }, ()=>this.addAssets(compilation).catch((error)=>{
223
- compilation.errors.push(error);
224
- }));
225
- });
226
- }
227
- addSrcToAssets(compiler, compilation) {
228
- const source = compiler.inputFileSystem.readFileSync(this.config.swSrc);
229
- compilation.emitAsset(this.config.swDest, new this.webpack.sources.RawSource(source));
230
- }
231
- async handleMake(compiler, compilation) {
232
- this.config = await validateInjectManifestOptions(this.config);
233
- this.config.swDest = relativeToOutputPath(compilation, this.config.swDest);
234
- _generatedAssetNames.add(this.config.swDest);
235
- if (this.config.compileSrc) {
236
- await performChildCompilation(compiler, compilation, this.constructor.name, this.config.swSrc, this.config.swDest, this.config.webpackCompilationPlugins);
237
- } else {
238
- this.addSrcToAssets(compiler, compilation);
239
- if (Array.isArray(this.config.webpackCompilationPlugins) && this.config.webpackCompilationPlugins.length > 0) {
240
- compilation.warnings.push(new Error("'compileSrc' is 'false', so the 'webpackCompilationPlugins' option will be ignored."));
241
- }
242
- }
243
- }
244
- async addAssets(compilation) {
245
- const config = Object.assign({}, this.config);
246
- const { size, sortedEntries, manifestString } = await this.getManifestEntries(compilation, config);
247
- compilation.fileDependencies.add(path.resolve(config.swSrc));
248
- const swAsset = compilation.getAsset(config.swDest);
249
- const swAssetString = swAsset.source.source().toString();
250
- const globalRegexp = new RegExp(escapeRegExp(config.injectionPoint), "g");
251
- const injectionResults = swAssetString.match(globalRegexp);
252
- if (!injectionResults) {
253
- throw new Error(`Can't find ${config.injectionPoint} in your SW source.`);
254
- }
255
- if (injectionResults.length !== 1) {
256
- throw new Error(`Multiple instances of ${config.injectionPoint} were found in your SW source. Include it only once. For more info, see https://github.com/GoogleChrome/workbox/issues/2681`);
257
- }
258
- const sourcemapAssetName = getSourcemapAssetName(compilation, swAssetString, config.swDest);
259
- if (sourcemapAssetName) {
260
- _generatedAssetNames.add(sourcemapAssetName);
261
- const sourcemapAsset = compilation.getAsset(sourcemapAssetName);
262
- const { source, map } = await replaceAndUpdateSourceMap({
263
- jsFilename: toUnix(config.swDest),
264
- originalMap: JSON.parse(sourcemapAsset.source.source().toString()),
265
- originalSource: swAssetString,
266
- replaceString: manifestString,
267
- searchString: config.injectionPoint
268
- });
269
- compilation.updateAsset(sourcemapAssetName, new this.webpack.sources.RawSource(map));
270
- compilation.updateAsset(config.swDest, new this.webpack.sources.RawSource(source));
271
- } else {
272
- compilation.updateAsset(config.swDest, new this.webpack.sources.RawSource(swAssetString.replace(config.injectionPoint, manifestString)));
273
- }
274
- if (compilation.getLogger) {
275
- const logger = compilation.getLogger(this.constructor.name);
276
- logger.info(`The service worker at ${config.swDest ?? ""} will precache ${sortedEntries?.length ?? 0} URLs, totaling ${prettyBytes(size)}.`);
277
- }
278
- }
279
- }
280
-
281
- export { InjectManifest, validateInjectManifestOptions };
@@ -1,3 +0,0 @@
1
- import { injectManifestOptions, injectPartial, webpackPartial } from "./lib/schema.js";
2
- export { webpackPartial, injectPartial as injectManifestPartial, injectManifestOptions };
3
- //# sourceMappingURL=index.schema.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.schema.d.ts","sourceRoot":"","sources":["../src/index.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEvF,OAAO,EAAE,cAAc,EAAE,aAAa,IAAI,qBAAqB,EAAE,qBAAqB,EAAE,CAAC"}
@@ -1,3 +0,0 @@
1
- export { injectManifestOptions, injectPartial as injectManifestPartial, webpackPartial } from './chunks/schema.js';
2
- import '@serwist/build/schema';
3
- import 'zod';
@@ -1,72 +0,0 @@
1
- import type { Compiler } from "webpack";
2
- import type { InjectManifestOptions, InjectManifestOptionsComplete } from "./lib/types.js";
3
- /**
4
- * This class supports compiling a service worker file provided via `swSrc`,
5
- * and injecting into that service worker a list of URLs and revision
6
- * information for precaching based on the webpack asset pipeline.
7
- *
8
- * Use an instance of `InjectManifest` in the
9
- * [`plugins` array](https://webpack.js.org/concepts/plugins/#usage) of a
10
- * webpack config.
11
- *
12
- * In addition to injecting the manifest, this plugin will perform a compilation
13
- * of the `swSrc` file, using the options from the main webpack configuration.
14
- *
15
- * ```
16
- * // The following lists some common options; see the rest of the documentation
17
- * // for the full set of options and defaults.
18
- * new InjectManifest({
19
- * exclude: [/.../, '...'],
20
- * maximumFileSizeToCacheInBytes: ...,
21
- * swSrc: '...',
22
- * });
23
- * ```
24
- */
25
- export declare class InjectManifest {
26
- protected config: InjectManifestOptionsComplete;
27
- private alreadyCalled;
28
- private webpack;
29
- /**
30
- * Creates an instance of InjectManifest.
31
- */
32
- constructor(config: InjectManifestOptions);
33
- /**
34
- * @param compiler default compiler object passed from webpack
35
- *
36
- * @private
37
- */
38
- private propagateWebpackConfig;
39
- /**
40
- * `getManifestEntriesFromCompilation` with a few additional checks.
41
- *
42
- * @private
43
- */
44
- private getManifestEntries;
45
- /**
46
- * @param compiler default compiler object passed from webpack
47
- *
48
- * @private
49
- */
50
- apply(compiler: Compiler): void;
51
- /**
52
- * @param compiler The webpack parent compiler.
53
- * @param compilation The webpack compilation.
54
- *
55
- * @private
56
- */
57
- private addSrcToAssets;
58
- /**
59
- * @param compiler The webpack parent compiler.
60
- * @param compilation The webpack compilation.
61
- *
62
- * @private
63
- */
64
- private handleMake;
65
- /**
66
- * @param compilation The webpack compilation.
67
- *
68
- * @private
69
- */
70
- private addAssets;
71
- }
72
- //# sourceMappingURL=inject-manifest.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"inject-manifest.d.ts","sourceRoot":"","sources":["../src/inject-manifest.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAe,QAAQ,EAAoC,MAAM,SAAS,CAAC;AAKvF,OAAO,KAAK,EAAE,qBAAqB,EAAE,6BAA6B,EAAE,MAAM,gBAAgB,CAAC;AAO3F;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,qBAAa,cAAc;IACzB,SAAS,CAAC,MAAM,EAAE,6BAA6B,CAAC;IAChD,OAAO,CAAC,aAAa,CAAU;IAC/B,OAAO,CAAC,OAAO,CAAiB;IAEhC;;OAEG;gBACS,MAAM,EAAE,qBAAqB;IAQzC;;;;OAIG;IACH,OAAO,CAAC,sBAAsB;IAa9B;;;;OAIG;YACW,kBAAkB;IAuChC;;;;OAIG;IACH,KAAK,CAAC,QAAQ,EAAE,QAAQ,GAAG,IAAI;IA6B/B;;;;;OAKG;IACH,OAAO,CAAC,cAAc;IAKtB;;;;;OAKG;YACW,UAAU;IAwBxB;;;;OAIG;YACW,SAAS;CAiDxB"}
@@ -1,24 +0,0 @@
1
- import type { Compiler, WebpackPluginInstance } from "webpack";
2
- export interface ChildCompilationPluginOptions {
3
- src: string;
4
- dest: string;
5
- plugins?: WebpackPluginInstance[];
6
- }
7
- /**
8
- * Compile a file by creating a child of the hooked compiler.
9
- *
10
- * @private
11
- */
12
- export declare class ChildCompilationPlugin implements WebpackPluginInstance {
13
- src: string;
14
- dest: string;
15
- plugins: WebpackPluginInstance[] | undefined;
16
- constructor({ src, dest, plugins }: ChildCompilationPluginOptions);
17
- /**
18
- * @param compiler default compiler object passed from webpack
19
- *
20
- * @private
21
- */
22
- apply(compiler: Compiler): void;
23
- }
24
- //# sourceMappingURL=child-compilation-plugin.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"child-compilation-plugin.d.ts","sourceRoot":"","sources":["../../src/lib/child-compilation-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAgB,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAI7E,MAAM,WAAW,6BAA6B;IAC5C,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,qBAAqB,EAAE,CAAC;CACnC;AAED;;;;GAIG;AACH,qBAAa,sBAAuB,YAAW,qBAAqB;IAClE,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,qBAAqB,EAAE,GAAG,SAAS,CAAC;gBACjC,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,6BAA6B;IAKjE;;;;OAIG;IACH,KAAK,CAAC,QAAQ,EAAE,QAAQ;CAczB"}
@@ -1,9 +0,0 @@
1
- import type { Asset } from "webpack";
2
- /**
3
- * @param asset
4
- * @returns The MD5 hash of the asset's source.
5
- *
6
- * @private
7
- */
8
- export declare const getAssetHash: (asset: Asset) => string | null;
9
- //# sourceMappingURL=get-asset-hash.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"get-asset-hash.d.ts","sourceRoot":"","sources":["../../src/lib/get-asset-hash.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAErC;;;;;GAKG;AACH,eAAO,MAAM,YAAY,GAAI,OAAO,KAAK,KAAG,MAAM,GAAG,IASpD,CAAC"}
@@ -1,8 +0,0 @@
1
- import type { ManifestEntry } from "@serwist/build";
2
- import type { Compilation } from "webpack";
3
- import type { InjectManifestOptionsComplete } from "./types.js";
4
- export declare const getManifestEntriesFromCompilation: (compilation: Compilation, config: InjectManifestOptionsComplete) => Promise<{
5
- size: number;
6
- sortedEntries: ManifestEntry[] | undefined;
7
- }>;
8
- //# sourceMappingURL=get-manifest-entries-from-compilation.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"get-manifest-entries-from-compilation.d.ts","sourceRoot":"","sources":["../../src/lib/get-manifest-entries-from-compilation.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAe,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAEjE,OAAO,KAAK,EAAgB,WAAW,EAAgB,MAAM,SAAS,CAAC;AAIvE,OAAO,KAAK,EAAyB,6BAA6B,EAAE,MAAM,YAAY,CAAC;AAiKvF,eAAO,MAAM,iCAAiC,GAC5C,aAAa,WAAW,EACxB,QAAQ,6BAA6B,KACpC,OAAO,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,aAAa,EAAE,aAAa,EAAE,GAAG,SAAS,CAAA;CAAE,CAiCtE,CAAC"}
@@ -1,3 +0,0 @@
1
- import type { Compilation } from "webpack";
2
- export declare const getScriptFilesForChunks: (compilation: Compilation, chunkNames: string[]) => string[];
3
- //# sourceMappingURL=get-script-files-for-chunks.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"get-script-files-for-chunks.d.ts","sourceRoot":"","sources":["../../src/lib/get-script-files-for-chunks.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,WAAW,EAAgB,MAAM,SAAS,CAAC;AAIzD,eAAO,MAAM,uBAAuB,GAAI,aAAa,WAAW,EAAE,YAAY,MAAM,EAAE,KAAG,MAAM,EAwB9F,CAAC"}
@@ -1,20 +0,0 @@
1
- import type { Compilation } from "webpack";
2
- /**
3
- * If our bundled swDest file contains a sourcemap, we would invalidate that
4
- * mapping if we just replaced injectionPoint with the stringified manifest.
5
- * Instead, we need to update the swDest contents as well as the sourcemap
6
- * at the same time.
7
- *
8
- * See https://github.com/GoogleChrome/workbox/issues/2235
9
- *
10
- * @param compilation The current webpack compilation.
11
- * @param swContents The contents of the swSrc file, which may or
12
- * may not include a valid sourcemap comment.
13
- * @param swDest The configured swDest value.
14
- * @returns If the swContents contains a valid sourcemap
15
- * comment pointing to an asset present in the compilation, this will return the
16
- * name of that asset. Otherwise, it will return undefined.
17
- * @private
18
- */
19
- export declare const getSourcemapAssetName: (compilation: Compilation, swContents: string, swDest: string) => string | undefined;
20
- //# sourceMappingURL=get-sourcemap-asset-name.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"get-sourcemap-asset-name.d.ts","sourceRoot":"","sources":["../../src/lib/get-sourcemap-asset-name.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAE3C;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,qBAAqB,GAAI,aAAa,WAAW,EAAE,YAAY,MAAM,EAAE,QAAQ,MAAM,KAAG,MAAM,GAAG,SAgB7G,CAAC"}
@@ -1,16 +0,0 @@
1
- import type { Compilation, Compiler } from "webpack";
2
- import type { WebpackPlugin } from "./types.js";
3
- /**
4
- * Perform a child compilation.
5
- *
6
- * @param compiler The parent webpack compiler.
7
- * @param compilation The webpack compilation.
8
- * @param name The name of the child compiler.
9
- * @param src The source file. Should be absolute.
10
- * @param dest The destination file. Should be relative to the compilation.
11
- * @param plugins Additional webpack plugins.
12
- *
13
- * @private
14
- */
15
- export declare const performChildCompilation: (compiler: Compiler, compilation: Compilation, name: string, src: string, dest: string, plugins: WebpackPlugin[] | undefined) => Promise<void>;
16
- //# sourceMappingURL=perform-child-compilation.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"perform-child-compilation.d.ts","sourceRoot":"","sources":["../../src/lib/perform-child-compilation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACrD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAEhD;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,uBAAuB,GAClC,UAAU,QAAQ,EAClB,aAAa,WAAW,EACxB,MAAM,MAAM,EACZ,KAAK,MAAM,EACX,MAAM,MAAM,EACZ,SAAS,aAAa,EAAE,GAAG,SAAS,kBAuBrC,CAAC"}
@@ -1,12 +0,0 @@
1
- import type { Compilation } from "webpack";
2
- /**
3
- * @param compilation The webpack compilation.
4
- * @param originalPath The original path value.
5
- *
6
- * @returns If path was not absolute, the returns path as-is.
7
- * Otherwise, returns path relative to the compilation's output path.
8
- *
9
- * @private
10
- */
11
- export declare const relativeToOutputPath: (compilation: Compilation, originalPath: string) => string;
12
- //# sourceMappingURL=relative-to-output-path.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"relative-to-output-path.d.ts","sourceRoot":"","sources":["../../src/lib/relative-to-output-path.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAE3C;;;;;;;;GAQG;AACH,eAAO,MAAM,oBAAoB,GAAI,aAAa,WAAW,EAAE,cAAc,MAAM,KAAG,MAQrF,CAAC"}
@@ -1,13 +0,0 @@
1
- /**
2
- * Resolves a url in the way that webpack would (with string concatenation)
3
- *
4
- * Use publicPath + filePath instead of url.resolve(publicPath, filePath) see:
5
- * https://webpack.js.org/configuration/output/#output-publicpath
6
- *
7
- * @param publicPath The publicPath value from webpack's compilation.
8
- * @param paths File paths to join
9
- * @returns Joined file path
10
- * @private
11
- */
12
- export declare const resolveWebpackURL: (publicPath: string, ...paths: string[]) => string;
13
- //# sourceMappingURL=resolve-webpack-url.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"resolve-webpack-url.d.ts","sourceRoot":"","sources":["../../src/lib/resolve-webpack-url.ts"],"names":[],"mappings":"AAQA;;;;;;;;;;GAUG;AACH,eAAO,MAAM,iBAAiB,GAAI,YAAY,MAAM,EAAE,GAAG,OAAO,MAAM,EAAE,KAAG,MAO1E,CAAC"}
@@ -1,86 +0,0 @@
1
- import { z } from "zod";
2
- export declare const webpackPartial: z.ZodObject<{
3
- chunks: z.ZodOptional<z.ZodArray<z.ZodString>>;
4
- exclude: z.ZodDefault<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodCustom<RegExp, RegExp>, z.ZodPipe<z.ZodCustom<z.core.$InferInnerFunctionType<z.ZodTuple<[z.ZodAny], null>, z.ZodBoolean>, z.core.$InferInnerFunctionType<z.ZodTuple<[z.ZodAny], null>, z.ZodBoolean>>, z.ZodTransform<(args_0: any) => boolean, z.core.$InferInnerFunctionType<z.ZodTuple<[z.ZodAny], null>, z.ZodBoolean>>>]>>>;
5
- excludeChunks: z.ZodOptional<z.ZodArray<z.ZodString>>;
6
- include: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodCustom<RegExp, RegExp>, z.ZodPipe<z.ZodCustom<z.core.$InferInnerFunctionType<z.ZodTuple<[z.ZodAny], null>, z.ZodBoolean>, z.core.$InferInnerFunctionType<z.ZodTuple<[z.ZodAny], null>, z.ZodBoolean>>, z.ZodTransform<(args_0: any) => boolean, z.core.$InferInnerFunctionType<z.ZodTuple<[z.ZodAny], null>, z.ZodBoolean>>>]>>>;
7
- }, z.core.$strict>;
8
- export declare const injectPartial: z.ZodObject<{
9
- compileSrc: z.ZodDefault<z.ZodBoolean>;
10
- swDest: z.ZodOptional<z.ZodString>;
11
- webpackCompilationPlugins: z.ZodOptional<z.ZodArray<z.ZodAny>>;
12
- }, z.core.$strict>;
13
- export declare const injectManifestOptions: z.ZodObject<{
14
- compileSrc: z.ZodDefault<z.ZodBoolean>;
15
- swDest: z.ZodOptional<z.ZodString>;
16
- webpackCompilationPlugins: z.ZodOptional<z.ZodArray<z.ZodAny>>;
17
- injectionPoint: z.ZodDefault<z.ZodString>;
18
- swSrc: z.ZodString;
19
- chunks: z.ZodOptional<z.ZodArray<z.ZodString>>;
20
- exclude: z.ZodDefault<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodCustom<RegExp, RegExp>, z.ZodPipe<z.ZodCustom<z.core.$InferInnerFunctionType<z.ZodTuple<[z.ZodAny], null>, z.ZodBoolean>, z.core.$InferInnerFunctionType<z.ZodTuple<[z.ZodAny], null>, z.ZodBoolean>>, z.ZodTransform<(args_0: any) => boolean, z.core.$InferInnerFunctionType<z.ZodTuple<[z.ZodAny], null>, z.ZodBoolean>>>]>>>;
21
- excludeChunks: z.ZodOptional<z.ZodArray<z.ZodString>>;
22
- include: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodCustom<RegExp, RegExp>, z.ZodPipe<z.ZodCustom<z.core.$InferInnerFunctionType<z.ZodTuple<[z.ZodAny], null>, z.ZodBoolean>, z.core.$InferInnerFunctionType<z.ZodTuple<[z.ZodAny], null>, z.ZodBoolean>>, z.ZodTransform<(args_0: any) => boolean, z.core.$InferInnerFunctionType<z.ZodTuple<[z.ZodAny], null>, z.ZodBoolean>>>]>>>;
23
- additionalPrecacheEntries: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
24
- integrity: z.ZodOptional<z.ZodString>;
25
- revision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
26
- url: z.ZodString;
27
- }, z.core.$strict>]>>>;
28
- disablePrecacheManifest: z.ZodDefault<z.ZodBoolean>;
29
- dontCacheBustURLsMatching: z.ZodOptional<z.ZodCustom<RegExp, RegExp>>;
30
- manifestTransforms: z.ZodOptional<z.ZodArray<z.ZodPipe<z.ZodCustom<z.core.$InferInnerFunctionTypeAsync<z.ZodTuple<[z.ZodArray<z.ZodObject<{
31
- size: z.ZodNumber;
32
- integrity: z.ZodOptional<z.ZodString>;
33
- revision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
34
- url: z.ZodString;
35
- }, z.core.$strip>>, z.ZodOptional<z.ZodUnknown>], null>, z.ZodObject<{
36
- manifest: z.ZodArray<z.ZodObject<{
37
- size: z.ZodNumber;
38
- integrity: z.ZodOptional<z.ZodString>;
39
- revision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
40
- url: z.ZodString;
41
- }, z.core.$strip>>;
42
- warnings: z.ZodOptional<z.ZodArray<z.ZodString>>;
43
- }, z.core.$strict>>, z.core.$InferInnerFunctionTypeAsync<z.ZodTuple<[z.ZodArray<z.ZodObject<{
44
- size: z.ZodNumber;
45
- integrity: z.ZodOptional<z.ZodString>;
46
- revision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
47
- url: z.ZodString;
48
- }, z.core.$strip>>, z.ZodOptional<z.ZodUnknown>], null>, z.ZodObject<{
49
- manifest: z.ZodArray<z.ZodObject<{
50
- size: z.ZodNumber;
51
- integrity: z.ZodOptional<z.ZodString>;
52
- revision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
53
- url: z.ZodString;
54
- }, z.core.$strip>>;
55
- warnings: z.ZodOptional<z.ZodArray<z.ZodString>>;
56
- }, z.core.$strict>>>, z.ZodTransform<z.core.$InferOuterFunctionTypeAsync<z.ZodTuple<[z.ZodArray<z.ZodObject<{
57
- size: z.ZodNumber;
58
- integrity: z.ZodOptional<z.ZodString>;
59
- revision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
60
- url: z.ZodString;
61
- }, z.core.$strip>>, z.ZodOptional<z.ZodUnknown>], null>, z.ZodObject<{
62
- manifest: z.ZodArray<z.ZodObject<{
63
- size: z.ZodNumber;
64
- integrity: z.ZodOptional<z.ZodString>;
65
- revision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
66
- url: z.ZodString;
67
- }, z.core.$strip>>;
68
- warnings: z.ZodOptional<z.ZodArray<z.ZodString>>;
69
- }, z.core.$strict>>, z.core.$InferInnerFunctionTypeAsync<z.ZodTuple<[z.ZodArray<z.ZodObject<{
70
- size: z.ZodNumber;
71
- integrity: z.ZodOptional<z.ZodString>;
72
- revision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
73
- url: z.ZodString;
74
- }, z.core.$strip>>, z.ZodOptional<z.ZodUnknown>], null>, z.ZodObject<{
75
- manifest: z.ZodArray<z.ZodObject<{
76
- size: z.ZodNumber;
77
- integrity: z.ZodOptional<z.ZodString>;
78
- revision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
79
- url: z.ZodString;
80
- }, z.core.$strip>>;
81
- warnings: z.ZodOptional<z.ZodArray<z.ZodString>>;
82
- }, z.core.$strict>>>>>>;
83
- maximumFileSizeToCacheInBytes: z.ZodDefault<z.ZodNumber>;
84
- modifyURLPrefix: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
85
- }, z.core.$strict>;
86
- //# sourceMappingURL=schema.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/lib/schema.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AASxB,eAAO,MAAM,cAAc;;;;;kBAKzB,CAAC;AAEH,eAAO,MAAM,aAAa;;;;kBAIxB,CAAC;AAEH,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAMhC,CAAC"}