@modern-js/plugin-worker 0.0.0-next-1690354890697 → 0.0.0-next-1690383964237

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 CHANGED
@@ -1,14 +1,14 @@
1
1
  # @modern-js/plugin-worker
2
2
 
3
- ## 0.0.0-next-1690354890697
3
+ ## 0.0.0-next-1690383964237
4
4
 
5
5
  ### Patch Changes
6
6
 
7
- - Updated dependencies [6eae1e7dc3]
8
- - Updated dependencies [00b58a71c1]
9
- - @modern-js/prod-server@0.0.0-next-1690354890697
10
- - @modern-js/utils@0.0.0-next-1690354890697
11
- - @modern-js/server-utils@0.0.0-next-1690354890697
7
+ - Updated dependencies [6eae1e7dc]
8
+ - Updated dependencies [00b58a71c]
9
+ - @modern-js/prod-server@0.0.0-next-1690383964237
10
+ - @modern-js/utils@0.0.0-next-1690383964237
11
+ - @modern-js/server-utils@0.0.0-next-1690383964237
12
12
 
13
13
  ## 2.27.0
14
14
 
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
- return {
27
- name: "@modern-js/plugin-worker",
28
- setup: (ctx) => {
29
- return {
30
- async config() {
31
- return {
32
- output: {
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
- const enableWorkerInWeb = configContext.deploy.enableWorker || ((_configContext_deploy_worker = configContext.deploy.worker) === null || _configContext_deploy_worker === void 0 ? void 0 : _configContext_deploy_worker.web);
57
- writeWorkerServerFile(appDirectory, distDirectory, enableWorkerInWeb);
58
- },
59
- async afterBuild() {
60
- var _configContext_deploy_worker;
61
- const { appDirectory, distDirectory } = ctx.useAppContext();
62
- const configContext = ctx.useResolvedConfigContext();
63
- if (!(0, _utils.isServiceWorker)(configContext)) {
64
- return;
34
+ };
35
+ },
36
+ validateSchema() {
37
+ return [
38
+ {
39
+ target: "deploy.worker.ssr",
40
+ schema: {
41
+ type: [
42
+ "boolean"
43
+ ]
44
+ }
65
45
  }
66
- const enableWorkerInWeb = configContext.deploy.enableWorker || ((_configContext_deploy_worker = configContext.deploy.worker) === null || _configContext_deploy_worker === void 0 ? void 0 : _configContext_deploy_worker.web);
67
- writeWorkerServerFile(appDirectory, distDirectory, enableWorkerInWeb);
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
- return {
7
- name: "@modern-js/plugin-worker",
8
- setup: (ctx) => {
9
- return {
10
- async config() {
11
- return {
12
- output: {
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
- const enableWorkerInWeb = configContext.deploy.enableWorker || ((_configContext_deploy_worker = configContext.deploy.worker) === null || _configContext_deploy_worker === void 0 ? void 0 : _configContext_deploy_worker.web);
37
- writeWorkerServerFile(appDirectory, distDirectory, enableWorkerInWeb);
38
- },
39
- async afterBuild() {
40
- var _configContext_deploy_worker;
41
- const { appDirectory, distDirectory } = ctx.useAppContext();
42
- const configContext = ctx.useResolvedConfigContext();
43
- if (!isServiceWorker(configContext)) {
44
- return;
14
+ };
15
+ },
16
+ validateSchema() {
17
+ return [
18
+ {
19
+ target: "deploy.worker.ssr",
20
+ schema: {
21
+ type: [
22
+ "boolean"
23
+ ]
24
+ }
45
25
  }
46
- const enableWorkerInWeb = configContext.deploy.enableWorker || ((_configContext_deploy_worker = configContext.deploy.worker) === null || _configContext_deploy_worker === void 0 ? void 0 : _configContext_deploy_worker.web);
47
- writeWorkerServerFile(appDirectory, distDirectory, enableWorkerInWeb);
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": "0.0.0-next-1690354890697",
18
+ "version": "0.0.0-next-1690383964237",
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-utils": "0.0.0-next-1690354890697",
47
- "@modern-js/utils": "0.0.0-next-1690354890697",
48
- "@modern-js/prod-server": "0.0.0-next-1690354890697"
46
+ "@modern-js/server-utils": "0.0.0-next-1690383964237",
47
+ "@modern-js/prod-server": "0.0.0-next-1690383964237",
48
+ "@modern-js/utils": "0.0.0-next-1690383964237"
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/app-tools": "0.0.0-next-1690354890697",
56
- "@modern-js/core": "0.0.0-next-1690354890697",
57
- "@scripts/build": "0.0.0-next-1690354890697",
58
- "@modern-js/types": "0.0.0-next-1690354890697",
59
- "@scripts/jest-config": "0.0.0-next-1690354890697"
55
+ "@modern-js/app-tools": "0.0.0-next-1690383964237",
56
+ "@modern-js/core": "0.0.0-next-1690383964237",
57
+ "@scripts/build": "0.0.0-next-1690383964237",
58
+ "@modern-js/types": "0.0.0-next-1690383964237",
59
+ "@scripts/jest-config": "0.0.0-next-1690383964237"
60
60
  },
61
61
  "sideEffects": [
62
62
  "*.css",