@genesislcap/webpack-builder 15.79.2-alpha-e9d30db797.0 → 15.80.0-GENC-1739.1
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/README.md +0 -7
- package/dist/config/entry.d.ts.map +1 -1
- package/dist/config/entry.js +2 -5
- package/dist/config/plugins.d.ts.map +1 -1
- package/dist/config/plugins.js +8 -2
- package/package.json +2 -5
- package/dist/config/serviceWorker.d.ts +0 -20
- package/dist/config/serviceWorker.d.ts.map +0 -1
- package/dist/config/serviceWorker.js +0 -56
package/README.md
CHANGED
|
@@ -25,13 +25,6 @@ install it, so an app that sets `pwa` needs it in its own devDependencies:
|
|
|
25
25
|
npm install --save-dev webpack-pwa-manifest@^4.3.0
|
|
26
26
|
```
|
|
27
27
|
|
|
28
|
-
# Service worker
|
|
29
|
-
|
|
30
|
-
The `serviceWorker` option compiles `serviceWorker.worker` to `assetName` (default: the worker's file
|
|
31
|
-
name with a `.js` extension), with Workbox `InjectManifest` filling `self.__WB_MANIFEST`. Set
|
|
32
|
-
`precache: false` to compile a worker that doesn't precache. Without `registration`, genx adds an
|
|
33
|
-
entry that registers the worker once the page has loaded.
|
|
34
|
-
|
|
35
28
|
|
|
36
29
|
|
|
37
30
|
## Installation
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entry.d.ts","sourceRoot":"","sources":["../../src/config/entry.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"entry.d.ts","sourceRoot":"","sources":["../../src/config/entry.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAG7C,eAAO,MAAM,KAAK,GAAI,KAAK,YAAY,KAAG,aAAa,CAAC,OAAO,CAkB9D,CAAC"}
|
package/dist/config/entry.js
CHANGED
|
@@ -3,18 +3,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.entry = void 0;
|
|
4
4
|
const node_path_1 = require("node:path");
|
|
5
5
|
const federation_1 = require("./federation");
|
|
6
|
-
const serviceWorker_1 = require("./serviceWorker");
|
|
7
6
|
const entry = (ctx) => {
|
|
8
7
|
const { dirs: { cwd }, config: { serviceWorker }, } = ctx;
|
|
9
8
|
const main = (0, federation_1.federatedIndexExists)()
|
|
10
9
|
? (0, federation_1.resolveFederatedIndex)()
|
|
11
10
|
: (0, node_path_1.resolve)(cwd, './src/' + 'index.ts');
|
|
12
|
-
if (serviceWorker) {
|
|
11
|
+
if (serviceWorker === null || serviceWorker === void 0 ? void 0 : serviceWorker.registration) {
|
|
13
12
|
return {
|
|
14
13
|
main,
|
|
15
|
-
swRegistration: serviceWorker.registration
|
|
16
|
-
? (0, node_path_1.resolve)(cwd, './src/' + serviceWorker.registration)
|
|
17
|
-
: (0, serviceWorker_1.serviceWorkerRegistrationEntry)(serviceWorker),
|
|
14
|
+
swRegistration: (0, node_path_1.resolve)(cwd, './src/' + serviceWorker.registration),
|
|
18
15
|
};
|
|
19
16
|
}
|
|
20
17
|
return main;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugins.d.ts","sourceRoot":"","sources":["../../src/config/plugins.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAM3D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAkC7C,eAAO,MAAM,OAAO,GAAI,KAAK,YAAY,KAAG,aAAa,CAAC,SAAS,
|
|
1
|
+
{"version":3,"file":"plugins.d.ts","sourceRoot":"","sources":["../../src/config/plugins.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAM3D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAkC7C,eAAO,MAAM,OAAO,GAAI,KAAK,YAAY,KAAG,aAAa,CAAC,SAAS,CA8ElE,CAAC"}
|
package/dist/config/plugins.js
CHANGED
|
@@ -12,8 +12,8 @@ const mini_css_extract_plugin_1 = tslib_1.__importDefault(require("mini-css-extr
|
|
|
12
12
|
const webpack_1 = require("webpack");
|
|
13
13
|
const webpack_bundle_analyzer_1 = require("webpack-bundle-analyzer");
|
|
14
14
|
const webpackbar_1 = tslib_1.__importDefault(require("webpackbar"));
|
|
15
|
+
const workbox_webpack_plugin_1 = require("workbox-webpack-plugin");
|
|
15
16
|
const federation_1 = require("./federation");
|
|
16
|
-
const serviceWorker_1 = require("./serviceWorker");
|
|
17
17
|
const createPwaManifestPlugin = (options) => {
|
|
18
18
|
let PwaManifestPlugin;
|
|
19
19
|
try {
|
|
@@ -86,7 +86,13 @@ const plugins = (ctx) => {
|
|
|
86
86
|
sizes: icon.sizes,
|
|
87
87
|
src: (0, node_path_1.resolve)(cwd, icon.src),
|
|
88
88
|
})) })),
|
|
89
|
-
serviceWorker &&
|
|
89
|
+
serviceWorker &&
|
|
90
|
+
new workbox_webpack_plugin_1.InjectManifest({
|
|
91
|
+
swSrc: './src/' + serviceWorker.worker,
|
|
92
|
+
swDest: serviceWorker.assetName,
|
|
93
|
+
exclude: serviceWorker.exclude,
|
|
94
|
+
maximumFileSizeToCacheInBytes: serviceWorker.maximumFileSizeToCache,
|
|
95
|
+
}),
|
|
90
96
|
].filter(Boolean);
|
|
91
97
|
};
|
|
92
98
|
exports.plugins = plugins;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@genesislcap/webpack-builder",
|
|
3
3
|
"description": "Webpack builder",
|
|
4
|
-
"version": "15.
|
|
4
|
+
"version": "15.80.0-GENC-1739.1",
|
|
5
5
|
"license": "SEE LICENSE IN license.txt",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
@@ -13,12 +13,11 @@
|
|
|
13
13
|
"copyfiles": "copyfiles --verbose public/*.* ./dist",
|
|
14
14
|
"clean": "rimraf dist temp tsconfig.tsbuildinfo",
|
|
15
15
|
"dev": "tsc -b ./tsconfig.json -w",
|
|
16
|
-
"test": "uvu -r tsx/cjs test 'test.ts'",
|
|
17
16
|
"lint": "genx lint -l ox",
|
|
18
17
|
"lint:fix": "genx lint -l ox --fix"
|
|
19
18
|
},
|
|
20
19
|
"dependencies": {
|
|
21
|
-
"@genesislcap/build-kit": "15.
|
|
20
|
+
"@genesislcap/build-kit": "15.80.0-GENC-1739.1",
|
|
22
21
|
"@pixability-ui/federated-types": "^0.2.0",
|
|
23
22
|
"@types/webpack-env": "^1.18.4",
|
|
24
23
|
"camel-case": "^4.1.2",
|
|
@@ -47,8 +46,6 @@
|
|
|
47
46
|
"devDependencies": {
|
|
48
47
|
"copyfiles": "^2.4.1",
|
|
49
48
|
"pkg-types": "^1.0.2",
|
|
50
|
-
"tsx": "^4.7.0",
|
|
51
|
-
"uvu": "0.5.6",
|
|
52
49
|
"webpack-pwa-manifest": "^4.3.0"
|
|
53
50
|
},
|
|
54
51
|
"peerDependencies": {
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import type { BuildContext } from '@genesislcap/build-kit';
|
|
2
|
-
import type { Compiler } from 'webpack';
|
|
3
|
-
import { InjectManifest } from 'workbox-webpack-plugin';
|
|
4
|
-
type ServiceWorkerConfig = BuildContext['config']['serviceWorker'];
|
|
5
|
-
/**
|
|
6
|
-
* Compiles the worker the way `InjectManifest` does, without injecting a precache manifest.
|
|
7
|
-
*/
|
|
8
|
-
export declare class CompileServiceWorkerPlugin {
|
|
9
|
-
private readonly swSrc;
|
|
10
|
-
private readonly swDest;
|
|
11
|
-
constructor(swSrc: string, swDest: string);
|
|
12
|
-
apply(compiler: Compiler): void;
|
|
13
|
-
}
|
|
14
|
-
export declare const serviceWorkerPlugin: (serviceWorker: ServiceWorkerConfig) => CompileServiceWorkerPlugin | InjectManifest;
|
|
15
|
-
/**
|
|
16
|
-
* Entry that registers the worker when the genx config has no `serviceWorker.registration`.
|
|
17
|
-
*/
|
|
18
|
-
export declare const serviceWorkerRegistrationEntry: (serviceWorker: ServiceWorkerConfig) => string;
|
|
19
|
-
export {};
|
|
20
|
-
//# sourceMappingURL=serviceWorker.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"serviceWorker.d.ts","sourceRoot":"","sources":["../../src/config/serviceWorker.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAM3D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAExC,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAExD,KAAK,mBAAmB,GAAG,YAAY,CAAC,QAAQ,CAAC,CAAC,eAAe,CAAC,CAAC;AAInE;;GAEG;AACH,qBAAa,0BAA0B;IAEnC,OAAO,CAAC,QAAQ,CAAC,KAAK;IACtB,OAAO,CAAC,QAAQ,CAAC,MAAM;gBADN,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM;IAGjC,KAAK,CAAC,QAAQ,EAAE,QAAQ;CAiBzB;AAED,eAAO,MAAM,mBAAmB,GAAI,eAAe,mBAAmB,gDAerE,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,8BAA8B,GAAI,eAAe,mBAAmB,KAAG,MAOnF,CAAC"}
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.serviceWorkerRegistrationEntry = exports.serviceWorkerPlugin = exports.CompileServiceWorkerPlugin = void 0;
|
|
4
|
-
const node_buffer_1 = require("node:buffer");
|
|
5
|
-
const node_path_1 = require("node:path");
|
|
6
|
-
const build_kit_1 = require("@genesislcap/build-kit");
|
|
7
|
-
const webpack_1 = require("webpack");
|
|
8
|
-
const workbox_webpack_plugin_1 = require("workbox-webpack-plugin");
|
|
9
|
-
const COMPILE_PLUGIN_NAME = 'CompileServiceWorkerPlugin';
|
|
10
|
-
/**
|
|
11
|
-
* Compiles the worker the way `InjectManifest` does, without injecting a precache manifest.
|
|
12
|
-
*/
|
|
13
|
-
class CompileServiceWorkerPlugin {
|
|
14
|
-
constructor(swSrc, swDest) {
|
|
15
|
-
this.swSrc = swSrc;
|
|
16
|
-
this.swDest = swDest;
|
|
17
|
-
}
|
|
18
|
-
apply(compiler) {
|
|
19
|
-
compiler.hooks.make.tapPromise(COMPILE_PLUGIN_NAME, (compilation) => {
|
|
20
|
-
const childCompiler = compilation.createChildCompiler(COMPILE_PLUGIN_NAME, { filename: this.swDest }, [new webpack_1.EntryPlugin(compiler.context, this.swSrc, (0, node_path_1.parse)(this.swDest).name)]);
|
|
21
|
-
return new Promise((resolve, reject) => {
|
|
22
|
-
childCompiler.runAsChild((error, _entries, childCompilation) => {
|
|
23
|
-
if (error)
|
|
24
|
-
return reject(error);
|
|
25
|
-
compilation.warnings.push(...childCompilation.warnings);
|
|
26
|
-
compilation.errors.push(...childCompilation.errors);
|
|
27
|
-
resolve();
|
|
28
|
-
});
|
|
29
|
-
});
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
exports.CompileServiceWorkerPlugin = CompileServiceWorkerPlugin;
|
|
34
|
-
const serviceWorkerPlugin = (serviceWorker) => {
|
|
35
|
-
const swSrc = './src/' + serviceWorker.worker;
|
|
36
|
-
const swDest = (0, build_kit_1.getServiceWorkerAssetName)(serviceWorker);
|
|
37
|
-
if (serviceWorker.precache === false) {
|
|
38
|
-
return new CompileServiceWorkerPlugin(swSrc, swDest);
|
|
39
|
-
}
|
|
40
|
-
// InjectManifest only fills in defaults for options that are absent, not set to undefined
|
|
41
|
-
return new workbox_webpack_plugin_1.InjectManifest(Object.assign(Object.assign({ swSrc,
|
|
42
|
-
swDest }, (serviceWorker.exclude ? { exclude: serviceWorker.exclude } : {})), (serviceWorker.maximumFileSizeToCache
|
|
43
|
-
? { maximumFileSizeToCacheInBytes: serviceWorker.maximumFileSizeToCache }
|
|
44
|
-
: {})));
|
|
45
|
-
};
|
|
46
|
-
exports.serviceWorkerPlugin = serviceWorkerPlugin;
|
|
47
|
-
/**
|
|
48
|
-
* Entry that registers the worker when the genx config has no `serviceWorker.registration`.
|
|
49
|
-
*/
|
|
50
|
-
const serviceWorkerRegistrationEntry = (serviceWorker) => {
|
|
51
|
-
const publicPath = (0, build_kit_1.getPublicPath)();
|
|
52
|
-
const base = publicPath.endsWith('/') ? publicPath : `${publicPath}/`;
|
|
53
|
-
const source = (0, build_kit_1.createServiceWorkerRegistration)(`${base}${(0, build_kit_1.getServiceWorkerAssetName)(serviceWorker)}`);
|
|
54
|
-
return `data:text/javascript;base64,${node_buffer_1.Buffer.from(source).toString('base64')}`;
|
|
55
|
-
};
|
|
56
|
-
exports.serviceWorkerRegistrationEntry = serviceWorkerRegistrationEntry;
|