@serwist/webpack-plugin 9.0.5 → 9.0.6
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/LICENSE +1 -1
- package/dist/index.js +3 -11
- package/dist/inject-manifest.d.ts.map +1 -1
- package/dist/lib/types.d.ts +2 -1
- package/dist/lib/types.d.ts.map +1 -1
- package/package.json +11 -8
- package/src/inject-manifest.ts +9 -15
- package/src/lib/types.ts +2 -1
package/LICENSE
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c) 2018 Google LLC, 2019 ShadowWalker w@weiw.io https://weiw.io, 2023 Serwist
|
|
3
|
+
Copyright (c) 2018-2023 Google LLC, 2019-2023 ShadowWalker w@weiw.io https://weiw.io, 2020-2023 Anthony Fu <https://github.com/antfu>, 2023-PRESENT Serwist
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
package/dist/index.js
CHANGED
|
@@ -222,18 +222,10 @@ class InjectManifest {
|
|
|
222
222
|
});
|
|
223
223
|
}
|
|
224
224
|
async performChildCompilation(compilation, parentCompiler) {
|
|
225
|
-
const
|
|
225
|
+
const childCompiler = compilation.createChildCompiler(this.constructor.name, {
|
|
226
226
|
filename: this.config.swDest
|
|
227
|
-
};
|
|
228
|
-
|
|
229
|
-
childCompiler.context = parentCompiler.context;
|
|
230
|
-
childCompiler.inputFileSystem = parentCompiler.inputFileSystem;
|
|
231
|
-
childCompiler.outputFileSystem = parentCompiler.outputFileSystem;
|
|
232
|
-
if (Array.isArray(this.config.webpackCompilationPlugins)) {
|
|
233
|
-
for (const plugin of this.config.webpackCompilationPlugins){
|
|
234
|
-
plugin.apply(childCompiler);
|
|
235
|
-
}
|
|
236
|
-
}
|
|
227
|
+
}, this.config.webpackCompilationPlugins);
|
|
228
|
+
new this.webpack.webworker.WebWorkerTemplatePlugin().apply(childCompiler);
|
|
237
229
|
new this.webpack.EntryPlugin(parentCompiler.context, this.config.swSrc, this.constructor.name).apply(childCompiler);
|
|
238
230
|
await new Promise((resolve, reject)=>{
|
|
239
231
|
childCompiler.runAsChild((error, _entries, childCompilation)=>{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inject-manifest.d.ts","sourceRoot":"","sources":["../src/inject-manifest.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAe,QAAQ,EAAoC,MAAM,SAAS,CAAC;AACvF,OAAO,KAAK,EAAE,qBAAqB,EAAE,6BAA6B,EAAE,MAAM,gBAAgB,CAAC;AAW3F;;;;;;;;;;;;;;;;;;;;;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;IAOzC;;;;OAIG;IACH,OAAO,CAAC,sBAAsB;IAa9B;;;;OAIG;YACW,kBAAkB;IAwChC;;;;OAIG;IACH,KAAK,CAAC,QAAQ,EAAE,QAAQ,GAAG,IAAI;IA6B/B;;;;;OAKG;YACW,uBAAuB;
|
|
1
|
+
{"version":3,"file":"inject-manifest.d.ts","sourceRoot":"","sources":["../src/inject-manifest.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAe,QAAQ,EAAoC,MAAM,SAAS,CAAC;AACvF,OAAO,KAAK,EAAE,qBAAqB,EAAE,6BAA6B,EAAE,MAAM,gBAAgB,CAAC;AAW3F;;;;;;;;;;;;;;;;;;;;;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;IAOzC;;;;OAIG;IACH,OAAO,CAAC,sBAAsB;IAa9B;;;;OAIG;YACW,kBAAkB;IAwChC;;;;OAIG;IACH,KAAK,CAAC,QAAQ,EAAE,QAAQ,GAAG,IAAI;IA6B/B;;;;;OAKG;YACW,uBAAuB;IA8BrC;;;;;OAKG;IACH,OAAO,CAAC,cAAc;IAKtB;;;;;OAKG;YACW,UAAU;IAiBxB;;;;OAIG;YACW,SAAS;CAmDxB"}
|
package/dist/lib/types.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { BasePartial, BaseResolved, InjectPartial as BaseInjectPartial, InjectResolved as BaseInjectResolved, OptionalSwDestPartial, OptionalSwDestResolved } from "@serwist/build";
|
|
2
2
|
import type { Require } from "@serwist/utils";
|
|
3
|
+
import type { WebpackPluginFunction, WebpackPluginInstance } from "webpack";
|
|
3
4
|
export interface WebpackPartial {
|
|
4
5
|
/**
|
|
5
6
|
* One or more chunk names whose corresponding output files should be included
|
|
@@ -44,7 +45,7 @@ export interface InjectPartial {
|
|
|
44
45
|
* Optional webpack plugins that will be used when compiling the `swSrc`
|
|
45
46
|
* file. Only valid if `compileSrc` is `true`.
|
|
46
47
|
*/
|
|
47
|
-
webpackCompilationPlugins?:
|
|
48
|
+
webpackCompilationPlugins?: (WebpackPluginFunction | WebpackPluginInstance)[];
|
|
48
49
|
}
|
|
49
50
|
export type InjectResolved = Require<InjectPartial, "compileSrc">;
|
|
50
51
|
export interface InjectManifestOptions extends BasePartial, WebpackPartial, BaseInjectPartial, OptionalSwDestPartial, InjectPartial {
|
package/dist/lib/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/lib/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,WAAW,EACX,YAAY,EACZ,aAAa,IAAI,iBAAiB,EAClC,cAAc,IAAI,kBAAkB,EACpC,qBAAqB,EACrB,sBAAsB,EACvB,MAAM,gBAAgB,CAAC;AACxB,OAAO,KA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AAEtI,MAAM,WAAW,6BAA8B,SAAQ,YAAY,EAAE,eAAe,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,cAAc;CAAG"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@serwist/webpack-plugin",
|
|
3
|
-
"version": "9.0.
|
|
3
|
+
"version": "9.0.6",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A plugin for your webpack build process, helping you generate a manifest of local files that should be precached.",
|
|
6
6
|
"files": [
|
|
@@ -22,7 +22,10 @@
|
|
|
22
22
|
"engines": {
|
|
23
23
|
"node": ">=18.0.0"
|
|
24
24
|
},
|
|
25
|
-
"author": "Google's Web DevRel Team
|
|
25
|
+
"author": "Google's Web DevRel Team",
|
|
26
|
+
"contributors": [
|
|
27
|
+
"Serwist <ducanh2912.rusty@gmail.com> (https://serwist.pages.dev/)"
|
|
28
|
+
],
|
|
26
29
|
"license": "MIT",
|
|
27
30
|
"repository": "https://github.com/serwist/serwist",
|
|
28
31
|
"bugs": "https://github.com/serwist/serwist/issues",
|
|
@@ -58,16 +61,16 @@
|
|
|
58
61
|
"pretty-bytes": "6.1.1",
|
|
59
62
|
"upath": "2.0.1",
|
|
60
63
|
"zod": "3.23.8",
|
|
61
|
-
"@serwist/build": "9.0.
|
|
64
|
+
"@serwist/build": "9.0.6"
|
|
62
65
|
},
|
|
63
66
|
"devDependencies": {
|
|
64
|
-
"@types/node": "
|
|
67
|
+
"@types/node": "22.5.0",
|
|
65
68
|
"@types/webpack": "5.28.5",
|
|
66
|
-
"rollup": "4.
|
|
67
|
-
"typescript": "5.5.
|
|
69
|
+
"rollup": "4.21.0",
|
|
70
|
+
"typescript": "5.5.4",
|
|
68
71
|
"webpack": "5.93.0",
|
|
69
|
-
"@serwist/
|
|
70
|
-
"@serwist/
|
|
72
|
+
"@serwist/utils": "9.0.6",
|
|
73
|
+
"@serwist/configs": "9.0.6"
|
|
71
74
|
},
|
|
72
75
|
"peerDependencies": {
|
|
73
76
|
"typescript": ">=5.0.0",
|
package/src/inject-manifest.ts
CHANGED
|
@@ -154,21 +154,15 @@ export class InjectManifest {
|
|
|
154
154
|
* @private
|
|
155
155
|
*/
|
|
156
156
|
private async performChildCompilation(compilation: Compilation, parentCompiler: Compiler): Promise<void> {
|
|
157
|
-
const
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
childCompiler.inputFileSystem = parentCompiler.inputFileSystem;
|
|
165
|
-
childCompiler.outputFileSystem = parentCompiler.outputFileSystem;
|
|
157
|
+
const childCompiler = compilation.createChildCompiler(
|
|
158
|
+
this.constructor.name,
|
|
159
|
+
{
|
|
160
|
+
filename: this.config.swDest,
|
|
161
|
+
},
|
|
162
|
+
this.config.webpackCompilationPlugins,
|
|
163
|
+
);
|
|
166
164
|
|
|
167
|
-
|
|
168
|
-
for (const plugin of this.config.webpackCompilationPlugins) {
|
|
169
|
-
plugin.apply(childCompiler);
|
|
170
|
-
}
|
|
171
|
-
}
|
|
165
|
+
new this.webpack.webworker.WebWorkerTemplatePlugin().apply(childCompiler);
|
|
172
166
|
|
|
173
167
|
new this.webpack.EntryPlugin(parentCompiler.context, this.config.swSrc, this.constructor.name).apply(childCompiler);
|
|
174
168
|
|
|
@@ -196,7 +190,7 @@ export class InjectManifest {
|
|
|
196
190
|
* @private
|
|
197
191
|
*/
|
|
198
192
|
private addSrcToAssets(compilation: Compilation, parentCompiler: Compiler): void {
|
|
199
|
-
const source =
|
|
193
|
+
const source = parentCompiler.inputFileSystem!.readFileSync!(this.config.swSrc);
|
|
200
194
|
compilation.emitAsset(this.config.swDest!, new this.webpack.sources.RawSource(source));
|
|
201
195
|
}
|
|
202
196
|
|
package/src/lib/types.ts
CHANGED
|
@@ -7,6 +7,7 @@ import type {
|
|
|
7
7
|
OptionalSwDestResolved,
|
|
8
8
|
} from "@serwist/build";
|
|
9
9
|
import type { Require } from "@serwist/utils";
|
|
10
|
+
import type { WebpackPluginFunction, WebpackPluginInstance } from "webpack";
|
|
10
11
|
|
|
11
12
|
export interface WebpackPartial {
|
|
12
13
|
/**
|
|
@@ -57,7 +58,7 @@ export interface InjectPartial {
|
|
|
57
58
|
* Optional webpack plugins that will be used when compiling the `swSrc`
|
|
58
59
|
* file. Only valid if `compileSrc` is `true`.
|
|
59
60
|
*/
|
|
60
|
-
webpackCompilationPlugins?:
|
|
61
|
+
webpackCompilationPlugins?: (WebpackPluginFunction | WebpackPluginInstance)[];
|
|
61
62
|
}
|
|
62
63
|
|
|
63
64
|
export type InjectResolved = Require<InjectPartial, "compileSrc">;
|