@modern-js/utils 2.4.0 → 2.4.1-beta.0

Sign up to get free protection for your applications and to get access to all the features.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # @modern-js/utils
2
2
 
3
+ ## 2.4.1-beta.0
4
+
5
+ ### Patch Changes
6
+
7
+ - 11c053b: feat: ssr support deploy worker
8
+
9
+ feat: ssr 支持边缘部署
10
+
3
11
  ## 2.4.0
4
12
 
5
13
  ### Patch Changes
@@ -19,6 +19,10 @@ export declare const LAUNCH_EDITOR_ENDPOINT = "/__open-stack-frame-in-editor";
19
19
  * server side bundles directory, which relative to dist.
20
20
  */
21
21
  export declare const SERVER_BUNDLE_DIRECTORY = "bundles";
22
+ /**
23
+ * server side bundles directory, which relative to dist.
24
+ */
25
+ export declare const SERVER_WORKER_BUNDLE_DIRECTORY = "worker";
22
26
  /**
23
27
  * entry name pattern used for ajv pattern properties.
24
28
  */
package/dist/constants.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PLUGIN_SCHEMAS = exports.INTERNAL_SERVER_PLUGINS = exports.SERVER_PLUGIN_POLYFILL = exports.SERVER_PLUGIN_SERVER = exports.SERVER_PLUGIN_NEST = exports.SERVER_PLUGIN_KOA = exports.SERVER_PLUGIN_EGG = exports.SERVER_PLUGIN_EXPRESS = exports.SERVER_PLUGIN_BFF = exports.INTERNAL_CLI_PLUGINS = exports.INTERNAL_DOC_TOOLS_PLUGINS = exports.INTERNAL_MONOREPO_TOOLS_PLUGINS = exports.INTERNAL_MODULE_TOOLS_PLUGINS = exports.INTERNAL_APP_TOOLS_RUNTIME_PLUGINS = exports.INTERNAL_APP_TOOLS_PLUGINS = exports.LOADER_ROUTES_DIR = exports.ROUTE_MANIFEST = exports.ROUTE_MINIFEST_FILE = exports.DEFAULT_SERVER_CONFIG = exports.OUTPUT_CONFIG_FILE = exports.CONFIG_FILE_EXTENSIONS = exports.CONFIG_CACHE_DIR = exports.SHARED_DIR = exports.SERVER_DIR = exports.API_DIR = exports.LOADABLE_STATS_FILE = exports.SERVER_RENDER_FUNCTION_NAME = exports.ENTRY_NAME_PATTERN = exports.SERVER_BUNDLE_DIRECTORY = exports.LAUNCH_EDITOR_ENDPOINT = exports.MAIN_ENTRY_NAME = exports.ROUTE_SPEC_FILE = exports.HMR_SOCK_PATH = void 0;
3
+ exports.PLUGIN_SCHEMAS = exports.INTERNAL_SERVER_PLUGINS = exports.SERVER_PLUGIN_POLYFILL = exports.SERVER_PLUGIN_SERVER = exports.SERVER_PLUGIN_NEST = exports.SERVER_PLUGIN_KOA = exports.SERVER_PLUGIN_EGG = exports.SERVER_PLUGIN_EXPRESS = exports.SERVER_PLUGIN_BFF = exports.INTERNAL_CLI_PLUGINS = exports.INTERNAL_DOC_TOOLS_PLUGINS = exports.INTERNAL_MONOREPO_TOOLS_PLUGINS = exports.INTERNAL_MODULE_TOOLS_PLUGINS = exports.INTERNAL_APP_TOOLS_RUNTIME_PLUGINS = exports.INTERNAL_APP_TOOLS_PLUGINS = exports.LOADER_ROUTES_DIR = exports.ROUTE_MANIFEST = exports.ROUTE_MINIFEST_FILE = exports.DEFAULT_SERVER_CONFIG = exports.OUTPUT_CONFIG_FILE = exports.CONFIG_FILE_EXTENSIONS = exports.CONFIG_CACHE_DIR = exports.SHARED_DIR = exports.SERVER_DIR = exports.API_DIR = exports.LOADABLE_STATS_FILE = exports.SERVER_RENDER_FUNCTION_NAME = exports.ENTRY_NAME_PATTERN = exports.SERVER_WORKER_BUNDLE_DIRECTORY = exports.SERVER_BUNDLE_DIRECTORY = exports.LAUNCH_EDITOR_ENDPOINT = exports.MAIN_ENTRY_NAME = exports.ROUTE_SPEC_FILE = exports.HMR_SOCK_PATH = void 0;
4
4
  /**
5
5
  * hmr socket connect path
6
6
  */
@@ -21,6 +21,10 @@ exports.LAUNCH_EDITOR_ENDPOINT = '/__open-stack-frame-in-editor';
21
21
  * server side bundles directory, which relative to dist.
22
22
  */
23
23
  exports.SERVER_BUNDLE_DIRECTORY = 'bundles';
24
+ /**
25
+ * server side bundles directory, which relative to dist.
26
+ */
27
+ exports.SERVER_WORKER_BUNDLE_DIRECTORY = 'worker';
24
28
  /**
25
29
  * entry name pattern used for ajv pattern properties.
26
30
  */
@@ -28,6 +28,13 @@ export declare const isEmpty: (o: Record<string, unknown>) => boolean;
28
28
  */
29
29
  export declare const isSSR: (config: any) => boolean;
30
30
  export declare const isUseSSRBundle: (config: any) => boolean;
31
+ /**
32
+ * Is Worker project
33
+ *
34
+ * @param config - User config.
35
+ * @returns Whether to use worker deploy.
36
+ */
37
+ export declare const isServiceWorker: (config: any) => boolean;
31
38
  export declare const isFastRefresh: () => boolean;
32
39
  export * from './node-env';
33
40
  export * from './platform';
package/dist/is/index.js CHANGED
@@ -17,7 +17,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
17
17
  return (mod && mod.__esModule) ? mod : { "default": mod };
18
18
  };
19
19
  Object.defineProperty(exports, "__esModule", { value: true });
20
- exports.isFastRefresh = exports.isUseSSRBundle = exports.isSSR = exports.isEmpty = exports.isTypescript = exports.isDepExists = void 0;
20
+ exports.isFastRefresh = exports.isServiceWorker = exports.isUseSSRBundle = exports.isSSR = exports.isEmpty = exports.isTypescript = exports.isDepExists = void 0;
21
21
  const fs_1 = __importDefault(require("fs"));
22
22
  const path_1 = __importDefault(require("path"));
23
23
  const debug_1 = require("../debug");
@@ -86,6 +86,20 @@ const isUseSSRBundle = (config) => {
86
86
  return (0, exports.isSSR)(config);
87
87
  };
88
88
  exports.isUseSSRBundle = isUseSSRBundle;
89
+ /**
90
+ * Is Worker project
91
+ *
92
+ * @param config - User config.
93
+ * @returns Whether to use worker deploy.
94
+ */
95
+ const isServiceWorker = (config) => {
96
+ const { output, server } = config;
97
+ if ((server === null || server === void 0 ? void 0 : server.worker) && ((output === null || output === void 0 ? void 0 : output.ssg) || (0, exports.isSSR)(config))) {
98
+ return true;
99
+ }
100
+ return false;
101
+ };
102
+ exports.isServiceWorker = isServiceWorker;
89
103
  const isFastRefresh = () => (0, node_env_1.isDev)() && process.env.FAST_REFRESH !== 'false';
90
104
  exports.isFastRefresh = isFastRefresh;
91
105
  __exportStar(require("./node-env"), exports);
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "modern",
12
12
  "modern.js"
13
13
  ],
14
- "version": "2.4.0",
14
+ "version": "2.4.1-beta.0",
15
15
  "jsnext:source": "./src/index.ts",
16
16
  "types": "./dist/index.d.ts",
17
17
  "main": "./dist/index.js",