@modern-js/plugin-worker 2.27.0 → 2.29.0
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/CHANGELOG.md +25 -0
- package/dist/cjs/index.js +43 -45
- package/dist/esm/index.js +43 -45
- package/package.json +9 -9
package/CHANGELOG.md
CHANGED
@@ -1,5 +1,30 @@
|
|
1
1
|
# @modern-js/plugin-worker
|
2
2
|
|
3
|
+
## 2.29.0
|
4
|
+
|
5
|
+
### Patch Changes
|
6
|
+
|
7
|
+
- Updated dependencies [e6b5355]
|
8
|
+
- Updated dependencies [16e5195]
|
9
|
+
- Updated dependencies [93db783]
|
10
|
+
- Updated dependencies [cba7675]
|
11
|
+
- Updated dependencies [76ace5d]
|
12
|
+
- Updated dependencies [99052ea]
|
13
|
+
- Updated dependencies [1d71d2e]
|
14
|
+
- @modern-js/utils@2.29.0
|
15
|
+
- @modern-js/prod-server@2.29.0
|
16
|
+
- @modern-js/server-utils@2.29.0
|
17
|
+
|
18
|
+
## 2.28.0
|
19
|
+
|
20
|
+
### Patch Changes
|
21
|
+
|
22
|
+
- Updated dependencies [6eae1e7]
|
23
|
+
- Updated dependencies [00b58a7]
|
24
|
+
- @modern-js/prod-server@2.28.0
|
25
|
+
- @modern-js/utils@2.28.0
|
26
|
+
- @modern-js/server-utils@2.28.0
|
27
|
+
|
3
28
|
## 2.27.0
|
4
29
|
|
5
30
|
### Patch Changes
|
package/dist/cjs/index.js
CHANGED
@@ -22,54 +22,52 @@ const _path = /* @__PURE__ */ _interop_require_default._(require("path"));
|
|
22
22
|
const _utils = require("@modern-js/utils");
|
23
23
|
const _constants = require("./constants");
|
24
24
|
const _code = require("./code");
|
25
|
-
const workerPlugin = () => {
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
disableNodePolyfill: false
|
34
|
-
}
|
35
|
-
};
|
36
|
-
},
|
37
|
-
validateSchema() {
|
38
|
-
return [
|
39
|
-
{
|
40
|
-
target: "deploy.worker.ssr",
|
41
|
-
schema: {
|
42
|
-
type: [
|
43
|
-
"boolean"
|
44
|
-
]
|
45
|
-
}
|
46
|
-
}
|
47
|
-
];
|
48
|
-
},
|
49
|
-
async afterDev() {
|
50
|
-
var _configContext_deploy_worker;
|
51
|
-
const { appDirectory, distDirectory } = ctx.useAppContext();
|
52
|
-
const configContext = ctx.useResolvedConfigContext();
|
53
|
-
if (!(0, _utils.isServiceWorker)(configContext)) {
|
54
|
-
return;
|
25
|
+
const workerPlugin = () => ({
|
26
|
+
name: "@modern-js/plugin-worker",
|
27
|
+
setup: (ctx) => {
|
28
|
+
return {
|
29
|
+
async config() {
|
30
|
+
return {
|
31
|
+
output: {
|
32
|
+
disableNodePolyfill: false
|
55
33
|
}
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
34
|
+
};
|
35
|
+
},
|
36
|
+
validateSchema() {
|
37
|
+
return [
|
38
|
+
{
|
39
|
+
target: "deploy.worker.ssr",
|
40
|
+
schema: {
|
41
|
+
type: [
|
42
|
+
"boolean"
|
43
|
+
]
|
44
|
+
}
|
65
45
|
}
|
66
|
-
|
67
|
-
|
46
|
+
];
|
47
|
+
},
|
48
|
+
async afterDev() {
|
49
|
+
var _configContext_deploy_worker;
|
50
|
+
const { appDirectory, distDirectory } = ctx.useAppContext();
|
51
|
+
const configContext = ctx.useResolvedConfigContext();
|
52
|
+
if (!(0, _utils.isServiceWorker)(configContext)) {
|
53
|
+
return;
|
68
54
|
}
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
55
|
+
const enableWorkerInWeb = configContext.deploy.enableWorker || ((_configContext_deploy_worker = configContext.deploy.worker) === null || _configContext_deploy_worker === void 0 ? void 0 : _configContext_deploy_worker.web);
|
56
|
+
writeWorkerServerFile(appDirectory, distDirectory, enableWorkerInWeb);
|
57
|
+
},
|
58
|
+
async afterBuild() {
|
59
|
+
var _configContext_deploy_worker;
|
60
|
+
const { appDirectory, distDirectory } = ctx.useAppContext();
|
61
|
+
const configContext = ctx.useResolvedConfigContext();
|
62
|
+
if (!(0, _utils.isServiceWorker)(configContext)) {
|
63
|
+
return;
|
64
|
+
}
|
65
|
+
const enableWorkerInWeb = configContext.deploy.enableWorker || ((_configContext_deploy_worker = configContext.deploy.worker) === null || _configContext_deploy_worker === void 0 ? void 0 : _configContext_deploy_worker.web);
|
66
|
+
writeWorkerServerFile(appDirectory, distDirectory, enableWorkerInWeb);
|
67
|
+
}
|
68
|
+
};
|
69
|
+
}
|
70
|
+
});
|
73
71
|
const writeWorkerServerFile = (appDirectory, distDirectory, enableWorkerInWeb) => {
|
74
72
|
const workServerDir = _path.default.join(distDirectory, _constants.WORKER_SERVER);
|
75
73
|
const serverHookDir = _path.default.join(appDirectory, _utils.SERVER_DIR, _constants.WEB_APP_NAME);
|
package/dist/esm/index.js
CHANGED
@@ -2,54 +2,52 @@ import path from "path";
|
|
2
2
|
import { fs, isServiceWorker, ROUTE_SPEC_FILE, SERVER_DIR } from "@modern-js/utils";
|
3
3
|
import { MANIFEST_FILE, PKG_FILE, SERVER_HOOKS, WEB_APP_NAME, WORKER_SERVER, WORKER_SERVER_ENTRY, WRANGLER_FILE } from "./constants";
|
4
4
|
import { worker } from "./code";
|
5
|
-
export const workerPlugin = () => {
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
disableNodePolyfill: false
|
14
|
-
}
|
15
|
-
};
|
16
|
-
},
|
17
|
-
validateSchema() {
|
18
|
-
return [
|
19
|
-
{
|
20
|
-
target: "deploy.worker.ssr",
|
21
|
-
schema: {
|
22
|
-
type: [
|
23
|
-
"boolean"
|
24
|
-
]
|
25
|
-
}
|
26
|
-
}
|
27
|
-
];
|
28
|
-
},
|
29
|
-
async afterDev() {
|
30
|
-
var _configContext_deploy_worker;
|
31
|
-
const { appDirectory, distDirectory } = ctx.useAppContext();
|
32
|
-
const configContext = ctx.useResolvedConfigContext();
|
33
|
-
if (!isServiceWorker(configContext)) {
|
34
|
-
return;
|
5
|
+
export const workerPlugin = () => ({
|
6
|
+
name: "@modern-js/plugin-worker",
|
7
|
+
setup: (ctx) => {
|
8
|
+
return {
|
9
|
+
async config() {
|
10
|
+
return {
|
11
|
+
output: {
|
12
|
+
disableNodePolyfill: false
|
35
13
|
}
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
14
|
+
};
|
15
|
+
},
|
16
|
+
validateSchema() {
|
17
|
+
return [
|
18
|
+
{
|
19
|
+
target: "deploy.worker.ssr",
|
20
|
+
schema: {
|
21
|
+
type: [
|
22
|
+
"boolean"
|
23
|
+
]
|
24
|
+
}
|
45
25
|
}
|
46
|
-
|
47
|
-
|
26
|
+
];
|
27
|
+
},
|
28
|
+
async afterDev() {
|
29
|
+
var _configContext_deploy_worker;
|
30
|
+
const { appDirectory, distDirectory } = ctx.useAppContext();
|
31
|
+
const configContext = ctx.useResolvedConfigContext();
|
32
|
+
if (!isServiceWorker(configContext)) {
|
33
|
+
return;
|
48
34
|
}
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
35
|
+
const enableWorkerInWeb = configContext.deploy.enableWorker || ((_configContext_deploy_worker = configContext.deploy.worker) === null || _configContext_deploy_worker === void 0 ? void 0 : _configContext_deploy_worker.web);
|
36
|
+
writeWorkerServerFile(appDirectory, distDirectory, enableWorkerInWeb);
|
37
|
+
},
|
38
|
+
async afterBuild() {
|
39
|
+
var _configContext_deploy_worker;
|
40
|
+
const { appDirectory, distDirectory } = ctx.useAppContext();
|
41
|
+
const configContext = ctx.useResolvedConfigContext();
|
42
|
+
if (!isServiceWorker(configContext)) {
|
43
|
+
return;
|
44
|
+
}
|
45
|
+
const enableWorkerInWeb = configContext.deploy.enableWorker || ((_configContext_deploy_worker = configContext.deploy.worker) === null || _configContext_deploy_worker === void 0 ? void 0 : _configContext_deploy_worker.web);
|
46
|
+
writeWorkerServerFile(appDirectory, distDirectory, enableWorkerInWeb);
|
47
|
+
}
|
48
|
+
};
|
49
|
+
}
|
50
|
+
});
|
53
51
|
const writeWorkerServerFile = (appDirectory, distDirectory, enableWorkerInWeb) => {
|
54
52
|
const workServerDir = path.join(distDirectory, WORKER_SERVER);
|
55
53
|
const serverHookDir = path.join(appDirectory, SERVER_DIR, WEB_APP_NAME);
|
package/package.json
CHANGED
@@ -15,7 +15,7 @@
|
|
15
15
|
"modern",
|
16
16
|
"modern.js"
|
17
17
|
],
|
18
|
-
"version": "2.
|
18
|
+
"version": "2.29.0",
|
19
19
|
"types": "./dist/types/index.d.ts",
|
20
20
|
"jsnext:source": "./src/index.ts",
|
21
21
|
"main": "./dist/cjs/index.js",
|
@@ -43,20 +43,20 @@
|
|
43
43
|
},
|
44
44
|
"dependencies": {
|
45
45
|
"@swc/helpers": "0.5.1",
|
46
|
-
"@modern-js/server
|
47
|
-
"@modern-js/utils": "2.
|
48
|
-
"@modern-js/
|
46
|
+
"@modern-js/prod-server": "2.29.0",
|
47
|
+
"@modern-js/utils": "2.29.0",
|
48
|
+
"@modern-js/server-utils": "2.29.0"
|
49
49
|
},
|
50
50
|
"devDependencies": {
|
51
51
|
"typescript": "^5",
|
52
52
|
"@types/jest": "^29",
|
53
53
|
"@types/node": "^14",
|
54
54
|
"jest": "^29",
|
55
|
-
"@modern-js/core": "2.
|
56
|
-
"@modern-js/types": "2.
|
57
|
-
"@modern-js/app-tools": "2.
|
58
|
-
"@scripts/
|
59
|
-
"@scripts/
|
55
|
+
"@modern-js/core": "2.29.0",
|
56
|
+
"@modern-js/types": "2.29.0",
|
57
|
+
"@modern-js/app-tools": "2.29.0",
|
58
|
+
"@scripts/jest-config": "2.29.0",
|
59
|
+
"@scripts/build": "2.29.0"
|
60
60
|
},
|
61
61
|
"sideEffects": [
|
62
62
|
"*.css",
|