@modern-js/app-tools 2.0.0-beta.2 → 2.0.0-canary.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 +251 -0
- package/bin/modern.js +10 -1
- package/dist/js/modern/analyze/constants.js +38 -16
- package/dist/js/modern/analyze/generateCode.js +271 -211
- package/dist/js/modern/analyze/getBundleEntry.js +31 -32
- package/dist/js/modern/analyze/getClientRoutes/getRoutes.js +93 -49
- package/dist/js/modern/analyze/getClientRoutes/getRoutesLegacy.js +89 -47
- package/dist/js/modern/analyze/getClientRoutes/index.js +6 -2
- package/dist/js/modern/analyze/getClientRoutes/utils.js +23 -10
- package/dist/js/modern/analyze/getFileSystemEntry.js +43 -22
- package/dist/js/modern/analyze/getHtmlTemplate.js +89 -49
- package/dist/js/modern/analyze/getServerRoutes.js +122 -126
- package/dist/js/modern/analyze/index.js +193 -159
- package/dist/js/modern/analyze/isDefaultExportFunction.js +30 -16
- package/dist/js/modern/analyze/makeLegalIdentifier.js +10 -11
- package/dist/js/modern/analyze/nestedRoutes.js +110 -53
- package/dist/js/modern/analyze/templates.js +190 -77
- package/dist/js/modern/analyze/utils.js +98 -51
- package/dist/js/modern/builder/builderPlugins/compatModern.js +124 -107
- package/dist/js/modern/builder/index.js +123 -86
- package/dist/js/modern/builder/loaders/routerLoader.js +17 -0
- package/dist/js/modern/builder/loaders/serverModuleLoader.js +7 -0
- package/dist/js/modern/builder/share.js +22 -20
- package/dist/js/modern/builder/webpackPlugins/htmlAsyncChunkPlugin.js +23 -22
- package/dist/js/modern/builder/webpackPlugins/htmlBottomTemplate.js +31 -27
- package/dist/js/modern/builder/webpackPlugins/routerPlugin.js +98 -84
- package/dist/js/modern/commands/build.js +67 -42
- package/dist/js/modern/commands/deploy.js +27 -4
- package/dist/js/modern/commands/dev.js +93 -47
- package/dist/js/modern/commands/index.js +1 -1
- package/dist/js/modern/commands/inspect.js +30 -5
- package/dist/js/modern/commands/start.js +37 -16
- package/dist/js/modern/config/default.js +103 -114
- package/dist/js/modern/config/index.js +8 -2
- package/dist/js/modern/config/initial/createHtmlConfig.js +5 -2
- package/dist/js/modern/config/initial/createOutputConfig.js +11 -9
- package/dist/js/modern/config/initial/createSourceConfig.js +5 -2
- package/dist/js/modern/config/initial/createToolsConfig.js +7 -6
- package/dist/js/modern/config/initial/index.js +9 -4
- package/dist/js/modern/config/initial/inits.js +109 -73
- package/dist/js/modern/config/initial/transformNormalizedConfig.js +6 -3
- package/dist/js/modern/defineConfig.js +26 -11
- package/dist/js/modern/exports/server.js +4 -1
- package/dist/js/modern/hooks.js +10 -3
- package/dist/js/modern/index.js +140 -89
- package/dist/js/modern/initialize/index.js +98 -51
- package/dist/js/modern/locale/en.js +20 -21
- package/dist/js/modern/locale/index.js +6 -6
- package/dist/js/modern/locale/zh.js +21 -22
- package/dist/js/modern/schema/Schema.js +6 -5
- package/dist/js/modern/schema/index.js +51 -100
- package/dist/js/modern/schema/legacy.js +96 -231
- package/dist/js/modern/types/config/index.js +0 -1
- package/dist/js/modern/types/index.js +0 -1
- package/dist/js/modern/types/legacyConfig/output.js +0 -1
- package/dist/js/modern/utils/commands.js +5 -2
- package/dist/js/modern/utils/config.js +102 -41
- package/dist/js/modern/utils/createFileWatcher.js +84 -51
- package/dist/js/modern/utils/createServer.js +63 -17
- package/dist/js/modern/utils/getSpecifiedEntries.js +46 -19
- package/dist/js/modern/utils/language.js +6 -3
- package/dist/js/modern/utils/printInstructions.js +27 -8
- package/dist/js/modern/utils/restart.js +43 -16
- package/dist/js/modern/utils/routes.js +29 -12
- package/dist/js/node/analyze/constants.js +54 -35
- package/dist/js/node/analyze/generateCode.js +290 -228
- package/dist/js/node/analyze/getBundleEntry.js +55 -44
- package/dist/js/node/analyze/getClientRoutes/getRoutes.js +132 -76
- package/dist/js/node/analyze/getClientRoutes/getRoutesLegacy.js +128 -74
- package/dist/js/node/analyze/getClientRoutes/index.js +23 -17
- package/dist/js/node/analyze/getClientRoutes/utils.js +44 -21
- package/dist/js/node/analyze/getFileSystemEntry.js +70 -39
- package/dist/js/node/analyze/getHtmlTemplate.js +116 -61
- package/dist/js/node/analyze/getServerRoutes.js +143 -137
- package/dist/js/node/analyze/index.js +240 -174
- package/dist/js/node/analyze/isDefaultExportFunction.js +55 -26
- package/dist/js/node/analyze/makeLegalIdentifier.js +27 -15
- package/dist/js/node/analyze/nestedRoutes.js +140 -67
- package/dist/js/node/analyze/templates.js +211 -84
- package/dist/js/node/analyze/utils.js +123 -62
- package/dist/js/node/builder/builderPlugins/compatModern.js +152 -120
- package/dist/js/node/builder/index.js +151 -95
- package/dist/js/node/builder/loaders/routerLoader.js +36 -0
- package/dist/js/node/builder/loaders/serverModuleLoader.js +26 -0
- package/dist/js/node/builder/share.js +45 -25
- package/dist/js/node/builder/webpackPlugins/htmlAsyncChunkPlugin.js +39 -26
- package/dist/js/node/builder/webpackPlugins/htmlBottomTemplate.js +47 -31
- package/dist/js/node/builder/webpackPlugins/routerPlugin.js +116 -90
- package/dist/js/node/commands/build.js +89 -52
- package/dist/js/node/commands/deploy.js +45 -10
- package/dist/js/node/commands/dev.js +115 -61
- package/dist/js/node/commands/index.js +19 -38
- package/dist/js/node/commands/inspect.js +48 -11
- package/dist/js/node/commands/start.js +65 -27
- package/dist/js/node/config/default.js +119 -118
- package/dist/js/node/config/index.js +25 -29
- package/dist/js/node/config/initial/createHtmlConfig.js +22 -6
- package/dist/js/node/config/initial/createOutputConfig.js +28 -13
- package/dist/js/node/config/initial/createSourceConfig.js +22 -6
- package/dist/js/node/config/initial/createToolsConfig.js +24 -10
- package/dist/js/node/config/initial/index.js +28 -17
- package/dist/js/node/config/initial/inits.js +126 -81
- package/dist/js/node/config/initial/transformNormalizedConfig.js +31 -15
- package/dist/js/node/defineConfig.js +43 -17
- package/dist/js/node/exports/server.js +21 -10
- package/dist/js/node/hooks.js +44 -29
- package/dist/js/node/index.js +190 -130
- package/dist/js/node/initialize/index.js +116 -61
- package/dist/js/node/locale/en.js +36 -25
- package/dist/js/node/locale/index.js +27 -15
- package/dist/js/node/locale/zh.js +37 -26
- package/dist/js/node/schema/Schema.js +23 -10
- package/dist/js/node/schema/index.js +77 -114
- package/dist/js/node/schema/legacy.js +117 -240
- package/dist/js/node/types/config/index.js +17 -16
- package/dist/js/node/types/index.js +19 -38
- package/dist/js/node/types/legacyConfig/output.js +0 -5
- package/dist/js/node/utils/commands.js +21 -6
- package/dist/js/node/utils/config.js +120 -51
- package/dist/js/node/utils/createFileWatcher.js +104 -60
- package/dist/js/node/utils/createServer.js +86 -25
- package/dist/js/node/utils/getSpecifiedEntries.js +64 -25
- package/dist/js/node/utils/language.js +24 -8
- package/dist/js/node/utils/printInstructions.js +47 -16
- package/dist/js/node/utils/restart.js +61 -21
- package/dist/js/node/utils/routes.js +53 -18
- package/dist/js/treeshaking/analyze/constants.js +28 -16
- package/dist/js/treeshaking/analyze/generateCode.js +604 -355
- package/dist/js/treeshaking/analyze/getBundleEntry.js +52 -63
- package/dist/js/treeshaking/analyze/getClientRoutes/getRoutes.js +214 -168
- package/dist/js/treeshaking/analyze/getClientRoutes/getRoutesLegacy.js +215 -169
- package/dist/js/treeshaking/analyze/getClientRoutes/index.js +3 -2
- package/dist/js/treeshaking/analyze/getClientRoutes/utils.js +19 -20
- package/dist/js/treeshaking/analyze/getFileSystemEntry.js +89 -86
- package/dist/js/treeshaking/analyze/getHtmlTemplate.js +298 -125
- package/dist/js/treeshaking/analyze/getServerRoutes.js +210 -146
- package/dist/js/treeshaking/analyze/index.js +558 -303
- package/dist/js/treeshaking/analyze/isDefaultExportFunction.js +45 -26
- package/dist/js/treeshaking/analyze/makeLegalIdentifier.js +13 -16
- package/dist/js/treeshaking/analyze/nestedRoutes.js +414 -160
- package/dist/js/treeshaking/analyze/templates.js +432 -161
- package/dist/js/treeshaking/analyze/utils.js +361 -80
- package/dist/js/treeshaking/builder/builderPlugins/compatModern.js +281 -195
- package/dist/js/treeshaking/builder/index.js +371 -165
- package/dist/js/treeshaking/builder/loaders/routerLoader.js +13 -0
- package/dist/js/treeshaking/builder/loaders/serverModuleLoader.js +5 -0
- package/dist/js/treeshaking/builder/share.js +41 -44
- package/dist/js/treeshaking/builder/webpackPlugins/htmlAsyncChunkPlugin.js +108 -44
- package/dist/js/treeshaking/builder/webpackPlugins/htmlBottomTemplate.js +70 -39
- package/dist/js/treeshaking/builder/webpackPlugins/routerPlugin.js +332 -112
- package/dist/js/treeshaking/commands/build.js +286 -88
- package/dist/js/treeshaking/commands/deploy.js +153 -25
- package/dist/js/treeshaking/commands/dev.js +318 -132
- package/dist/js/treeshaking/commands/index.js +1 -1
- package/dist/js/treeshaking/commands/inspect.js +147 -32
- package/dist/js/treeshaking/commands/start.js +190 -68
- package/dist/js/treeshaking/config/default.js +210 -199
- package/dist/js/treeshaking/config/index.js +3 -2
- package/dist/js/treeshaking/config/initial/createHtmlConfig.js +19 -31
- package/dist/js/treeshaking/config/initial/createOutputConfig.js +43 -67
- package/dist/js/treeshaking/config/initial/createSourceConfig.js +37 -40
- package/dist/js/treeshaking/config/initial/createToolsConfig.js +23 -38
- package/dist/js/treeshaking/config/initial/index.js +10 -9
- package/dist/js/treeshaking/config/initial/inits.js +205 -106
- package/dist/js/treeshaking/config/initial/transformNormalizedConfig.js +27 -34
- package/dist/js/treeshaking/defineConfig.js +60 -13
- package/dist/js/treeshaking/exports/server.js +2 -1
- package/dist/js/treeshaking/hooks.js +26 -25
- package/dist/js/treeshaking/index.js +465 -257
- package/dist/js/treeshaking/initialize/index.js +290 -112
- package/dist/js/treeshaking/locale/en.js +34 -33
- package/dist/js/treeshaking/locale/index.js +5 -5
- package/dist/js/treeshaking/locale/zh.js +34 -33
- package/dist/js/treeshaking/schema/Schema.js +267 -69
- package/dist/js/treeshaking/schema/index.js +165 -121
- package/dist/js/treeshaking/schema/legacy.js +323 -256
- package/dist/js/treeshaking/types/config/deploy.js +1 -0
- package/dist/js/treeshaking/types/config/dev.js +1 -0
- package/dist/js/treeshaking/types/config/experiments.js +1 -0
- package/dist/js/treeshaking/types/config/html.js +1 -0
- package/dist/js/treeshaking/types/config/index.js +0 -1
- package/dist/js/treeshaking/types/config/output.js +1 -0
- package/dist/js/treeshaking/types/config/performance.js +1 -0
- package/dist/js/treeshaking/types/config/security.js +1 -0
- package/dist/js/treeshaking/types/config/source.js +1 -0
- package/dist/js/treeshaking/types/config/tools.js +1 -0
- package/dist/js/treeshaking/types/hooks.js +1 -0
- package/dist/js/treeshaking/types/index.js +0 -1
- package/dist/js/treeshaking/types/legacyConfig/deploy.js +1 -0
- package/dist/js/treeshaking/types/legacyConfig/dev.js +1 -0
- package/dist/js/treeshaking/types/legacyConfig/index.js +1 -0
- package/dist/js/treeshaking/types/legacyConfig/output.js +1 -1
- package/dist/js/treeshaking/types/legacyConfig/source.js +1 -0
- package/dist/js/treeshaking/types/legacyConfig/tools.js +1 -0
- package/dist/js/treeshaking/utils/commands.js +6 -5
- package/dist/js/treeshaking/utils/config.js +295 -117
- package/dist/js/treeshaking/utils/createFileWatcher.js +278 -118
- package/dist/js/treeshaking/utils/createServer.js +252 -67
- package/dist/js/treeshaking/utils/getSpecifiedEntries.js +182 -55
- package/dist/js/treeshaking/utils/language.js +6 -5
- package/dist/js/treeshaking/utils/printInstructions.js +151 -29
- package/dist/js/treeshaking/utils/restart.js +184 -42
- package/dist/js/treeshaking/utils/routes.js +151 -27
- package/dist/js/treeshaking/utils/types.js +1 -0
- package/dist/types/analyze/constants.d.ts +2 -0
- package/dist/types/analyze/index.d.ts +2 -0
- package/dist/types/analyze/templates.d.ts +8 -7
- package/dist/types/analyze/utils.d.ts +9 -1
- package/dist/types/builder/builderPlugins/compatModern.d.ts +2 -1
- package/dist/types/builder/index.d.ts +2 -2
- package/dist/types/builder/loaders/routerLoader.d.ts +3 -0
- package/dist/types/builder/loaders/serverModuleLoader.d.ts +3 -0
- package/dist/types/builder/webpackPlugins/routerPlugin.d.ts +1 -7
- package/dist/types/defineConfig.d.ts +1 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/initialize/index.d.ts +2 -0
- package/dist/types/types/config/index.d.ts +1 -0
- package/dist/types/types/config/output.d.ts +0 -1
- package/dist/types/types/config/source.d.ts +1 -0
- package/dist/types/types/config/tools.d.ts +10 -1
- package/dist/types/types/hooks.d.ts +2 -1
- package/dist/types/types/legacyConfig/dev.d.ts +1 -0
- package/dist/types/types/legacyConfig/output.d.ts +1 -1
- package/dist/types/types/legacyConfig/source.d.ts +1 -0
- package/dist/types/types/legacyConfig/tools.d.ts +1 -0
- package/dist/types/utils/config.d.ts +1 -0
- package/dist/types/utils/createFileWatcher.d.ts +2 -1
- package/dist/types/utils/createServer.d.ts +1 -0
- package/dist/types/utils/restart.d.ts +1 -1
- package/lib/types.d.ts +1 -1
- package/package.json +27 -23
|
@@ -1,38 +1,57 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.
|
|
4
|
-
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var stdin_exports = {};
|
|
19
|
+
__export(stdin_exports, {
|
|
20
|
+
APP_FILE_NAME: () => APP_FILE_NAME,
|
|
21
|
+
ENTRY_BOOTSTRAP_FILE_NAME: () => ENTRY_BOOTSTRAP_FILE_NAME,
|
|
22
|
+
ENTRY_POINT_FILE_NAME: () => ENTRY_POINT_FILE_NAME,
|
|
23
|
+
FILE_SYSTEM_ROUTES_COMPONENTS_DIR: () => FILE_SYSTEM_ROUTES_COMPONENTS_DIR,
|
|
24
|
+
FILE_SYSTEM_ROUTES_DYNAMIC_REGEXP: () => FILE_SYSTEM_ROUTES_DYNAMIC_REGEXP,
|
|
25
|
+
FILE_SYSTEM_ROUTES_FILE_NAME: () => FILE_SYSTEM_ROUTES_FILE_NAME,
|
|
26
|
+
FILE_SYSTEM_ROUTES_GLOBAL_LAYOUT: () => FILE_SYSTEM_ROUTES_GLOBAL_LAYOUT,
|
|
27
|
+
FILE_SYSTEM_ROUTES_IGNORED_REGEX: () => FILE_SYSTEM_ROUTES_IGNORED_REGEX,
|
|
28
|
+
FILE_SYSTEM_ROUTES_INDEX: () => FILE_SYSTEM_ROUTES_INDEX,
|
|
29
|
+
FILE_SYSTEM_ROUTES_LAYOUT: () => FILE_SYSTEM_ROUTES_LAYOUT,
|
|
30
|
+
HTML_PARTIALS_EXTENSIONS: () => HTML_PARTIALS_EXTENSIONS,
|
|
31
|
+
HTML_PARTIALS_FOLDER: () => HTML_PARTIALS_FOLDER,
|
|
32
|
+
INDEX_FILE_NAME: () => INDEX_FILE_NAME,
|
|
33
|
+
JS_EXTENSIONS: () => JS_EXTENSIONS,
|
|
34
|
+
LOADER_EXPORT_NAME: () => LOADER_EXPORT_NAME,
|
|
35
|
+
NESTED_ROUTES_DIR: () => NESTED_ROUTES_DIR,
|
|
36
|
+
PAGES_DIR_NAME: () => PAGES_DIR_NAME,
|
|
37
|
+
TEMP_LOADERS_DIR: () => TEMP_LOADERS_DIR
|
|
5
38
|
});
|
|
6
|
-
|
|
7
|
-
const JS_EXTENSIONS = [
|
|
8
|
-
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
const FILE_SYSTEM_ROUTES_FILE_NAME = 'routes.js';
|
|
18
|
-
exports.FILE_SYSTEM_ROUTES_FILE_NAME = FILE_SYSTEM_ROUTES_FILE_NAME;
|
|
19
|
-
const ENTRY_POINT_FILE_NAME = 'index.js';
|
|
20
|
-
exports.ENTRY_POINT_FILE_NAME = ENTRY_POINT_FILE_NAME;
|
|
21
|
-
const ENTRY_BOOTSTRAP_FILE_NAME = 'bootstrap.js';
|
|
22
|
-
exports.ENTRY_BOOTSTRAP_FILE_NAME = ENTRY_BOOTSTRAP_FILE_NAME;
|
|
39
|
+
module.exports = __toCommonJS(stdin_exports);
|
|
40
|
+
const JS_EXTENSIONS = [".js", ".ts", ".jsx", ".tsx"];
|
|
41
|
+
const INDEX_FILE_NAME = "index";
|
|
42
|
+
const APP_FILE_NAME = "App";
|
|
43
|
+
const PAGES_DIR_NAME = "pages";
|
|
44
|
+
const NESTED_ROUTES_DIR = "routes";
|
|
45
|
+
const FILE_SYSTEM_ROUTES_FILE_NAME = "routes.js";
|
|
46
|
+
const LOADER_EXPORT_NAME = "loader";
|
|
47
|
+
const TEMP_LOADERS_DIR = "__loaders__";
|
|
48
|
+
const ENTRY_POINT_FILE_NAME = "index.js";
|
|
49
|
+
const ENTRY_BOOTSTRAP_FILE_NAME = "bootstrap.js";
|
|
23
50
|
const FILE_SYSTEM_ROUTES_DYNAMIC_REGEXP = /^\[(\S+)\]([*+?]?)$/;
|
|
24
|
-
|
|
25
|
-
const
|
|
26
|
-
|
|
27
|
-
const FILE_SYSTEM_ROUTES_GLOBAL_LAYOUT = '_app';
|
|
28
|
-
exports.FILE_SYSTEM_ROUTES_GLOBAL_LAYOUT = FILE_SYSTEM_ROUTES_GLOBAL_LAYOUT;
|
|
29
|
-
const FILE_SYSTEM_ROUTES_INDEX = 'index';
|
|
30
|
-
exports.FILE_SYSTEM_ROUTES_INDEX = FILE_SYSTEM_ROUTES_INDEX;
|
|
51
|
+
const FILE_SYSTEM_ROUTES_LAYOUT = "_layout";
|
|
52
|
+
const FILE_SYSTEM_ROUTES_GLOBAL_LAYOUT = "_app";
|
|
53
|
+
const FILE_SYSTEM_ROUTES_INDEX = "index";
|
|
31
54
|
const FILE_SYSTEM_ROUTES_IGNORED_REGEX = /\.(d|test|spec|e2e)\.(js|jsx|ts|tsx)$/;
|
|
32
|
-
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
const HTML_PARTIALS_EXTENSIONS = ['.htm', '.html', '.ejs'];
|
|
36
|
-
exports.HTML_PARTIALS_EXTENSIONS = HTML_PARTIALS_EXTENSIONS;
|
|
37
|
-
const FILE_SYSTEM_ROUTES_COMPONENTS_DIR = 'internal_components';
|
|
38
|
-
exports.FILE_SYSTEM_ROUTES_COMPONENTS_DIR = FILE_SYSTEM_ROUTES_COMPONENTS_DIR;
|
|
55
|
+
const HTML_PARTIALS_FOLDER = "html";
|
|
56
|
+
const HTML_PARTIALS_EXTENSIONS = [".htm", ".html", ".ejs"];
|
|
57
|
+
const FILE_SYSTEM_ROUTES_COMPONENTS_DIR = "internal_components";
|
|
@@ -1,29 +1,71 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.
|
|
4
|
-
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
21
|
+
mod
|
|
22
|
+
));
|
|
23
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
24
|
+
var stdin_exports = {};
|
|
25
|
+
__export(stdin_exports, {
|
|
26
|
+
createImportStatements: () => createImportStatements,
|
|
27
|
+
generateCode: () => generateCode
|
|
5
28
|
});
|
|
6
|
-
|
|
7
|
-
var
|
|
8
|
-
var
|
|
9
|
-
var
|
|
10
|
-
var
|
|
11
|
-
var
|
|
12
|
-
var templates =
|
|
13
|
-
var
|
|
14
|
-
var
|
|
15
|
-
var
|
|
16
|
-
var
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
29
|
+
module.exports = __toCommonJS(stdin_exports);
|
|
30
|
+
var import_path = __toESM(require("path"));
|
|
31
|
+
var import_utils = require("@modern-js/utils");
|
|
32
|
+
var import_core = require("@modern-js/core");
|
|
33
|
+
var import_esbuild = require("esbuild");
|
|
34
|
+
var import_commands = require("../utils/commands");
|
|
35
|
+
var templates = __toESM(require("./templates"));
|
|
36
|
+
var import_getClientRoutes = require("./getClientRoutes");
|
|
37
|
+
var import_constants = require("./constants");
|
|
38
|
+
var import_utils2 = require("./utils");
|
|
39
|
+
var import_nestedRoutes = require("./nestedRoutes");
|
|
40
|
+
var __async = (__this, __arguments, generator) => {
|
|
41
|
+
return new Promise((resolve, reject) => {
|
|
42
|
+
var fulfilled = (value) => {
|
|
43
|
+
try {
|
|
44
|
+
step(generator.next(value));
|
|
45
|
+
} catch (e) {
|
|
46
|
+
reject(e);
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
var rejected = (value) => {
|
|
50
|
+
try {
|
|
51
|
+
step(generator.throw(value));
|
|
52
|
+
} catch (e) {
|
|
53
|
+
reject(e);
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
57
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
58
|
+
});
|
|
59
|
+
};
|
|
60
|
+
const loader = {
|
|
61
|
+
".js": "jsx",
|
|
62
|
+
".ts": "tsx"
|
|
63
|
+
};
|
|
64
|
+
const EXTERNAL_REGEXP = /^[^./]|^\.[^./]|^\.\.[^/]/;
|
|
65
|
+
const createImportSpecifier = (specifiers) => {
|
|
66
|
+
let defaults = "";
|
|
22
67
|
const named = [];
|
|
23
|
-
for (const {
|
|
24
|
-
local,
|
|
25
|
-
imported
|
|
26
|
-
} of specifiers) {
|
|
68
|
+
for (const { local, imported } of specifiers) {
|
|
27
69
|
if (local && imported) {
|
|
28
70
|
named.push(`${imported} as ${local}`);
|
|
29
71
|
} else if (local) {
|
|
@@ -33,22 +75,18 @@ const createImportSpecifier = specifiers => {
|
|
|
33
75
|
}
|
|
34
76
|
}
|
|
35
77
|
if (defaults && named.length) {
|
|
36
|
-
return `${defaults}, { ${named.join(
|
|
78
|
+
return `${defaults}, { ${named.join(", ")} }`;
|
|
37
79
|
} else if (defaults) {
|
|
38
80
|
return defaults;
|
|
39
81
|
} else {
|
|
40
|
-
return `{ ${named.join(
|
|
82
|
+
return `{ ${named.join(", ")} }`;
|
|
41
83
|
}
|
|
42
84
|
};
|
|
43
|
-
const createImportStatements = statements => {
|
|
44
|
-
|
|
85
|
+
const createImportStatements = (statements) => {
|
|
86
|
+
var _a, _b;
|
|
45
87
|
const deDuplicated = [];
|
|
46
|
-
const seen = new Map();
|
|
47
|
-
for (const {
|
|
48
|
-
value,
|
|
49
|
-
specifiers,
|
|
50
|
-
initialize
|
|
51
|
-
} of statements) {
|
|
88
|
+
const seen = /* @__PURE__ */ new Map();
|
|
89
|
+
for (const { value, specifiers, initialize } of statements) {
|
|
52
90
|
if (!seen.has(value)) {
|
|
53
91
|
deDuplicated.push({
|
|
54
92
|
value,
|
|
@@ -57,228 +95,252 @@ const createImportStatements = statements => {
|
|
|
57
95
|
});
|
|
58
96
|
seen.set(value, specifiers);
|
|
59
97
|
} else {
|
|
60
|
-
var _deDuplicated$modifyI, _deDuplicated$modifyI2;
|
|
61
98
|
seen.get(value).push(...specifiers);
|
|
62
|
-
|
|
63
|
-
const
|
|
64
|
-
|
|
65
|
-
|
|
99
|
+
const modifyIndex = deDuplicated.findIndex((v) => v.value === value);
|
|
100
|
+
const originInitialize = (_b = (_a = deDuplicated[modifyIndex]) == null ? void 0 : _a.initialize) != null ? _b : "";
|
|
101
|
+
deDuplicated[modifyIndex].initialize = originInitialize.concat(
|
|
102
|
+
`
|
|
103
|
+
${initialize || ""}`
|
|
104
|
+
);
|
|
66
105
|
}
|
|
67
106
|
}
|
|
68
|
-
return deDuplicated.map(
|
|
69
|
-
value,
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
}) => `import ${createImportSpecifier(specifiers)} from '${value}';\n${initialize || ''}`).join('\n');
|
|
107
|
+
return deDuplicated.map(
|
|
108
|
+
({ value, specifiers, initialize }) => `import ${createImportSpecifier(specifiers)} from '${value}';
|
|
109
|
+
${initialize || ""}`
|
|
110
|
+
).join("\n");
|
|
73
111
|
};
|
|
74
|
-
|
|
75
|
-
const
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
const EXTERNAL_REGEXP = /^[^./]|^\.[^./]|^\.\.[^/]/;
|
|
81
|
-
const command = (0, _commands.getCommand)();
|
|
82
|
-
await _esbuild.default.build({
|
|
83
|
-
format: 'cjs',
|
|
84
|
-
platform: 'node',
|
|
85
|
-
target: 'esnext',
|
|
112
|
+
const buildLoader = (entry, outfile) => __async(void 0, null, function* () {
|
|
113
|
+
const command = (0, import_commands.getCommand)();
|
|
114
|
+
yield (0, import_esbuild.build)({
|
|
115
|
+
format: "esm",
|
|
116
|
+
platform: "browser",
|
|
117
|
+
target: "esnext",
|
|
86
118
|
loader,
|
|
87
|
-
watch: command ===
|
|
119
|
+
watch: command === "dev" && {},
|
|
88
120
|
bundle: true,
|
|
89
|
-
logLevel:
|
|
121
|
+
logLevel: "error",
|
|
90
122
|
entryPoints: [entry],
|
|
91
123
|
outfile,
|
|
92
|
-
plugins: [
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
};
|
|
108
|
-
});
|
|
124
|
+
plugins: [
|
|
125
|
+
{
|
|
126
|
+
name: "make-all-packages-external",
|
|
127
|
+
setup(build2) {
|
|
128
|
+
build2.onResolve({ filter: EXTERNAL_REGEXP }, (args) => {
|
|
129
|
+
let external = true;
|
|
130
|
+
if (args.kind === "entry-point") {
|
|
131
|
+
external = false;
|
|
132
|
+
}
|
|
133
|
+
return {
|
|
134
|
+
path: args.path,
|
|
135
|
+
external
|
|
136
|
+
};
|
|
137
|
+
});
|
|
138
|
+
}
|
|
109
139
|
}
|
|
110
|
-
|
|
140
|
+
]
|
|
111
141
|
});
|
|
112
|
-
};
|
|
113
|
-
const
|
|
114
|
-
|
|
142
|
+
});
|
|
143
|
+
const buildServerLoader = (entry, outfile) => __async(void 0, null, function* () {
|
|
144
|
+
const command = (0, import_commands.getCommand)();
|
|
145
|
+
yield (0, import_esbuild.build)({
|
|
146
|
+
format: "cjs",
|
|
147
|
+
platform: "node",
|
|
148
|
+
target: "esnext",
|
|
149
|
+
loader,
|
|
150
|
+
watch: command === "dev" && {},
|
|
151
|
+
bundle: true,
|
|
152
|
+
logLevel: "error",
|
|
153
|
+
entryPoints: [entry],
|
|
154
|
+
outfile
|
|
155
|
+
});
|
|
156
|
+
});
|
|
157
|
+
const generateCode = (appContext, config, entrypoints, api) => __async(void 0, null, function* () {
|
|
158
|
+
var _a, _b;
|
|
115
159
|
const {
|
|
116
160
|
internalDirectory,
|
|
117
161
|
distDirectory,
|
|
118
162
|
srcDirectory,
|
|
119
163
|
internalDirAlias,
|
|
120
|
-
internalSrcAlias
|
|
164
|
+
internalSrcAlias,
|
|
165
|
+
packageName
|
|
121
166
|
} = appContext;
|
|
122
167
|
const hookRunners = api.useHookRunners();
|
|
123
|
-
const islegacy = Boolean(
|
|
124
|
-
const {
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
168
|
+
const islegacy = Boolean((_b = (_a = config == null ? void 0 : config.runtime) == null ? void 0 : _a.router) == null ? void 0 : _b.legacy);
|
|
169
|
+
const { mountId } = config.html;
|
|
170
|
+
const getRoutes = islegacy ? import_getClientRoutes.getClientRoutesLegacy : import_getClientRoutes.getClientRoutes;
|
|
171
|
+
yield Promise.all(entrypoints.map(generateEntryCode));
|
|
172
|
+
function generateEntryCode(entrypoint) {
|
|
173
|
+
return __async(this, null, function* () {
|
|
174
|
+
const { entryName, isAutoMount, customBootstrap, fileSystemRoutes } = entrypoint;
|
|
175
|
+
if (isAutoMount) {
|
|
176
|
+
if (fileSystemRoutes) {
|
|
177
|
+
let initialRoutes = [];
|
|
178
|
+
let nestedRoute = null;
|
|
179
|
+
if (entrypoint.entry) {
|
|
180
|
+
initialRoutes = getRoutes({
|
|
181
|
+
entrypoint,
|
|
182
|
+
srcDirectory,
|
|
183
|
+
srcAlias: internalSrcAlias,
|
|
184
|
+
internalDirectory,
|
|
185
|
+
internalDirAlias
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
if (entrypoint.nestedRoutesEntry) {
|
|
189
|
+
if (!islegacy) {
|
|
190
|
+
nestedRoute = yield (0, import_nestedRoutes.walk)(
|
|
191
|
+
entrypoint.nestedRoutesEntry,
|
|
192
|
+
entrypoint.nestedRoutesEntry,
|
|
193
|
+
{
|
|
194
|
+
name: internalSrcAlias,
|
|
195
|
+
basename: srcDirectory
|
|
196
|
+
},
|
|
197
|
+
entrypoint.entryName
|
|
198
|
+
);
|
|
199
|
+
if (nestedRoute) {
|
|
200
|
+
initialRoutes.unshift(nestedRoute);
|
|
201
|
+
}
|
|
202
|
+
} else {
|
|
203
|
+
import_utils.logger.error("Nested routes is not supported in legacy mode.");
|
|
204
|
+
process.exit(1);
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
const { routes } = yield hookRunners.modifyFileSystemRoutes({
|
|
143
208
|
entrypoint,
|
|
144
|
-
|
|
145
|
-
srcAlias: internalSrcAlias,
|
|
146
|
-
internalDirectory,
|
|
147
|
-
internalDirAlias
|
|
209
|
+
routes: initialRoutes
|
|
148
210
|
});
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
211
|
+
const config2 = (0, import_core.useResolvedConfigContext)();
|
|
212
|
+
const ssr = (0, import_utils.getEntryOptions)(
|
|
213
|
+
entryName,
|
|
214
|
+
config2.server.ssr,
|
|
215
|
+
config2.server.ssrByEntries,
|
|
216
|
+
packageName
|
|
217
|
+
);
|
|
218
|
+
let mode;
|
|
219
|
+
if (ssr) {
|
|
220
|
+
mode = typeof ssr === "object" ? ssr.mode || "string" : "string";
|
|
159
221
|
} else {
|
|
160
|
-
|
|
161
|
-
// eslint-disable-next-line no-process-exit
|
|
162
|
-
process.exit(1);
|
|
222
|
+
mode = false;
|
|
163
223
|
}
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
224
|
+
if (mode === "stream") {
|
|
225
|
+
const hasPageRoute = routes.some(
|
|
226
|
+
(route) => "type" in route && route.type === "page"
|
|
227
|
+
);
|
|
228
|
+
if (hasPageRoute) {
|
|
229
|
+
import_utils.logger.error(
|
|
230
|
+
"Streaming ssr is not supported when pages dir exists"
|
|
231
|
+
);
|
|
232
|
+
process.exit(1);
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
const { code: code2 } = yield hookRunners.beforeGenerateRoutes({
|
|
236
|
+
entrypoint,
|
|
237
|
+
code: yield templates.fileSystemRoutes({
|
|
238
|
+
routes,
|
|
239
|
+
ssrMode: mode,
|
|
240
|
+
nestedRoutesEntry: entrypoint.nestedRoutesEntry,
|
|
241
|
+
entryName: entrypoint.entryName,
|
|
242
|
+
internalDirectory
|
|
243
|
+
})
|
|
244
|
+
});
|
|
245
|
+
if (entrypoint.nestedRoutesEntry) {
|
|
246
|
+
const routesServerFile = import_path.default.join(
|
|
247
|
+
internalDirectory,
|
|
248
|
+
entryName,
|
|
249
|
+
"route-server-loaders.js"
|
|
250
|
+
);
|
|
251
|
+
const outputRoutesServerFile = import_path.default.join(
|
|
252
|
+
distDirectory,
|
|
253
|
+
import_utils.LOADER_ROUTES_DIR,
|
|
254
|
+
entryName,
|
|
255
|
+
"index.js"
|
|
256
|
+
);
|
|
257
|
+
const code3 = templates.routesForServer({
|
|
258
|
+
routes,
|
|
259
|
+
internalDirectory,
|
|
260
|
+
entryName
|
|
261
|
+
});
|
|
262
|
+
yield import_utils.fs.ensureFile(routesServerFile);
|
|
263
|
+
yield import_utils.fs.writeFile(routesServerFile, code3);
|
|
264
|
+
const loaderEntryFile = import_path.default.join(
|
|
265
|
+
internalDirectory,
|
|
266
|
+
entryName,
|
|
267
|
+
import_constants.TEMP_LOADERS_DIR,
|
|
268
|
+
"entry.js"
|
|
269
|
+
);
|
|
270
|
+
const loaderIndexFile = import_path.default.join(
|
|
271
|
+
internalDirectory,
|
|
272
|
+
entryName,
|
|
273
|
+
import_constants.TEMP_LOADERS_DIR,
|
|
274
|
+
"index.js"
|
|
275
|
+
);
|
|
276
|
+
if (yield import_utils.fs.pathExists(loaderEntryFile)) {
|
|
277
|
+
yield buildLoader(loaderEntryFile, loaderIndexFile);
|
|
278
|
+
}
|
|
279
|
+
if (yield import_utils.fs.pathExists(routesServerFile)) {
|
|
280
|
+
yield buildServerLoader(routesServerFile, outputRoutesServerFile);
|
|
281
|
+
}
|
|
185
282
|
}
|
|
283
|
+
import_utils.fs.outputFileSync(
|
|
284
|
+
import_path.default.resolve(
|
|
285
|
+
internalDirectory,
|
|
286
|
+
`./${entryName}/${import_constants.FILE_SYSTEM_ROUTES_FILE_NAME}`
|
|
287
|
+
),
|
|
288
|
+
code2,
|
|
289
|
+
"utf8"
|
|
290
|
+
);
|
|
186
291
|
}
|
|
187
|
-
const {
|
|
188
|
-
code
|
|
189
|
-
} = await hookRunners.beforeGenerateRoutes({
|
|
292
|
+
const { imports: importStatements } = yield hookRunners.modifyEntryImports({
|
|
190
293
|
entrypoint,
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
294
|
+
imports: (0, import_utils2.getDefaultImports)({
|
|
295
|
+
entrypoint,
|
|
296
|
+
srcDirectory,
|
|
297
|
+
internalSrcAlias,
|
|
298
|
+
internalDirAlias,
|
|
299
|
+
internalDirectory
|
|
196
300
|
})
|
|
197
301
|
});
|
|
198
|
-
|
|
199
|
-
// extract nested router loaders
|
|
200
|
-
if (entrypoint.nestedRoutesEntry) {
|
|
201
|
-
const routesServerFile = _path.default.join(internalDirectory, entryName, 'routes.server.js');
|
|
202
|
-
const outputRoutesServerFile = _path.default.join(distDirectory, 'loader-routes', entryName, 'index.js');
|
|
203
|
-
const code = templates.routesForServer({
|
|
204
|
-
routes: routes,
|
|
205
|
-
alias: {
|
|
206
|
-
name: internalSrcAlias,
|
|
207
|
-
basename: srcDirectory
|
|
208
|
-
}
|
|
209
|
-
});
|
|
210
|
-
await _utils.fs.ensureFile(routesServerFile);
|
|
211
|
-
await _utils.fs.writeFile(routesServerFile, code);
|
|
212
|
-
await buildLoader(routesServerFile, outputRoutesServerFile);
|
|
213
|
-
}
|
|
214
|
-
_utils.fs.outputFileSync(_path.default.resolve(internalDirectory, `./${entryName}/${_constants.FILE_SYSTEM_ROUTES_FILE_NAME}`), code, 'utf8');
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
// call modifyEntryImports hook
|
|
218
|
-
const {
|
|
219
|
-
imports: importStatements
|
|
220
|
-
} = await hookRunners.modifyEntryImports({
|
|
221
|
-
entrypoint,
|
|
222
|
-
imports: (0, _utils2.getDefaultImports)({
|
|
302
|
+
const { plugins } = yield hookRunners.modifyEntryRuntimePlugins({
|
|
223
303
|
entrypoint,
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
entrypoint,
|
|
236
|
-
plugins: []
|
|
237
|
-
});
|
|
238
|
-
|
|
239
|
-
// call modifyEntryRenderFunction hook
|
|
240
|
-
const {
|
|
241
|
-
code: renderFunction
|
|
242
|
-
} = await hookRunners.modifyEntryRenderFunction({
|
|
243
|
-
entrypoint,
|
|
244
|
-
code: templates.renderFunction({
|
|
245
|
-
plugins,
|
|
246
|
-
customBootstrap,
|
|
247
|
-
fileSystemRoutes
|
|
248
|
-
})
|
|
249
|
-
});
|
|
250
|
-
|
|
251
|
-
// call modifyEntryExport hook
|
|
252
|
-
const {
|
|
253
|
-
exportStatement
|
|
254
|
-
} = await hookRunners.modifyEntryExport({
|
|
255
|
-
entrypoint,
|
|
256
|
-
exportStatement: 'export default AppWrapper;'
|
|
257
|
-
});
|
|
258
|
-
const code = templates.index({
|
|
259
|
-
mountId: mountId,
|
|
260
|
-
imports: createImportStatements(importStatements),
|
|
261
|
-
renderFunction,
|
|
262
|
-
exportStatement
|
|
263
|
-
});
|
|
264
|
-
const entryFile = _path.default.resolve(internalDirectory, `./${entryName}/${_constants.ENTRY_POINT_FILE_NAME}`);
|
|
265
|
-
entrypoint.entry = entryFile;
|
|
266
|
-
|
|
267
|
-
// generate entry file.
|
|
268
|
-
if (config.source.enableAsyncEntry) {
|
|
269
|
-
const {
|
|
270
|
-
code: asyncEntryCode
|
|
271
|
-
} = await hookRunners.modifyAsyncEntry({
|
|
304
|
+
plugins: []
|
|
305
|
+
});
|
|
306
|
+
const { code: renderFunction } = yield hookRunners.modifyEntryRenderFunction({
|
|
307
|
+
entrypoint,
|
|
308
|
+
code: templates.renderFunction({
|
|
309
|
+
plugins,
|
|
310
|
+
customBootstrap,
|
|
311
|
+
fileSystemRoutes
|
|
312
|
+
})
|
|
313
|
+
});
|
|
314
|
+
const { exportStatement } = yield hookRunners.modifyEntryExport({
|
|
272
315
|
entrypoint,
|
|
273
|
-
|
|
316
|
+
exportStatement: "export default AppWrapper;"
|
|
274
317
|
});
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
318
|
+
const code = templates.index({
|
|
319
|
+
mountId,
|
|
320
|
+
imports: createImportStatements(importStatements),
|
|
321
|
+
renderFunction,
|
|
322
|
+
exportStatement
|
|
323
|
+
});
|
|
324
|
+
const entryFile = import_path.default.resolve(
|
|
325
|
+
internalDirectory,
|
|
326
|
+
`./${entryName}/${import_constants.ENTRY_POINT_FILE_NAME}`
|
|
327
|
+
);
|
|
328
|
+
entrypoint.entry = entryFile;
|
|
329
|
+
if (config.source.enableAsyncEntry) {
|
|
330
|
+
const { code: asyncEntryCode } = yield hookRunners.modifyAsyncEntry({
|
|
331
|
+
entrypoint,
|
|
332
|
+
code: `import('./${import_constants.ENTRY_BOOTSTRAP_FILE_NAME}');`
|
|
333
|
+
});
|
|
334
|
+
import_utils.fs.outputFileSync(entryFile, asyncEntryCode, "utf8");
|
|
335
|
+
const bootstrapFile = import_path.default.resolve(
|
|
336
|
+
internalDirectory,
|
|
337
|
+
`./${entryName}/${import_constants.ENTRY_BOOTSTRAP_FILE_NAME}`
|
|
338
|
+
);
|
|
339
|
+
import_utils.fs.outputFileSync(bootstrapFile, code, "utf8");
|
|
340
|
+
} else {
|
|
341
|
+
import_utils.fs.outputFileSync(entryFile, code, "utf8");
|
|
342
|
+
}
|
|
280
343
|
}
|
|
281
|
-
}
|
|
344
|
+
});
|
|
282
345
|
}
|
|
283
|
-
};
|
|
284
|
-
exports.generateCode = generateCode;
|
|
346
|
+
});
|