@modern-js/app-tools 2.17.1 → 2.18.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/analyze/constants.js +2 -2
- package/dist/cjs/initialize/index.js +2 -2
- package/dist/esm/analyze/constants.js +2 -2
- package/dist/esm/analyze/generateCode.js +28 -28
- package/dist/esm/analyze/getClientRoutes/getRoutes.js +9 -9
- package/dist/esm/analyze/getClientRoutes/getRoutesLegacy.js +9 -9
- package/dist/esm/analyze/getFileSystemEntry.js +6 -6
- package/dist/esm/analyze/getHtmlTemplate.js +2 -2
- package/dist/esm/analyze/getServerRoutes.js +4 -4
- package/dist/esm/analyze/index.js +18 -18
- package/dist/esm/analyze/nestedRoutes.js +3 -3
- package/dist/esm/analyze/templates.js +13 -22
- package/dist/esm/analyze/utils.js +1 -1
- package/dist/esm/builder/builder-rspack/adapterCopy.js +1 -1
- package/dist/esm/builder/builder-webpack/createCopyPattern.js +2 -2
- package/dist/esm/builder/builder-webpack/index.js +1 -1
- package/dist/esm/builder/generator/createBuilderOptions.js +1 -1
- package/dist/esm/builder/generator/createBuilderProviderConfig.js +1 -1
- package/dist/esm/builder/generator/index.js +1 -1
- package/dist/esm/builder/shared/builderPlugins/adapterHtml.js +9 -9
- package/dist/esm/builder/shared/builderPlugins/adapterSSR.js +5 -5
- package/dist/esm/builder/shared/bundlerPlugins/HtmlAsyncChunkPlugin.js +1 -1
- package/dist/esm/builder/shared/bundlerPlugins/HtmlBottomTemplate.js +1 -1
- package/dist/esm/builder/shared/bundlerPlugins/RouterPlugin.js +3 -3
- package/dist/esm/builder/shared/createCopyInfo.js +3 -3
- package/dist/esm/commands/build.js +3 -3
- package/dist/esm/commands/dev.js +8 -8
- package/dist/esm/commands/serve.js +3 -3
- package/dist/esm/config/default.js +7 -7
- package/dist/esm/config/initialize/inits.js +1 -1
- package/dist/esm/config/legacy/createHtmlConfig.js +13 -13
- package/dist/esm/config/legacy/createOutputConfig.js +15 -15
- package/dist/esm/config/legacy/createSourceConfig.js +9 -9
- package/dist/esm/config/legacy/createToolsConfig.js +14 -14
- package/dist/esm/config/legacy/index.js +14 -14
- package/dist/esm/defineConfig.js +1 -1
- package/dist/esm/index.js +2 -2
- package/dist/esm/initialize/index.js +8 -8
- package/dist/esm/schema/Schema.js +3 -3
- package/dist/esm/schema/index.js +1 -1
- package/dist/esm/schema/legacy.js +1 -1
- package/dist/esm/utils/config.js +2 -2
- package/dist/esm/utils/createServer.js +1 -1
- package/dist/esm/utils/getServerInternalPlugins.js +2 -2
- package/dist/esm-node/analyze/constants.js +2 -2
- package/dist/esm-node/initialize/index.js +2 -2
- package/dist/types/analyze/constants.d.ts +2 -2
- package/package.json +24 -24
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,30 @@
|
|
|
1
1
|
# @modern-js/app-tools
|
|
2
2
|
|
|
3
|
+
## 2.18.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [ea60b58]
|
|
8
|
+
- Updated dependencies [7de6599]
|
|
9
|
+
- @modern-js/builder-rspack-provider@2.18.0
|
|
10
|
+
- @modern-js/builder-plugin-node-polyfill@2.18.0
|
|
11
|
+
- @modern-js/builder@2.18.0
|
|
12
|
+
- @modern-js/builder-shared@2.18.0
|
|
13
|
+
- @modern-js/builder-webpack-provider@2.18.0
|
|
14
|
+
- @modern-js/builder-plugin-esbuild@2.18.0
|
|
15
|
+
- @modern-js/core@2.18.0
|
|
16
|
+
- @modern-js/plugin-data-loader@2.18.0
|
|
17
|
+
- @modern-js/plugin-i18n@2.18.0
|
|
18
|
+
- @modern-js/plugin-lint@2.18.0
|
|
19
|
+
- @modern-js/new-action@2.18.0
|
|
20
|
+
- @modern-js/prod-server@2.18.0
|
|
21
|
+
- @modern-js/server@2.18.0
|
|
22
|
+
- @modern-js/node-bundle-require@2.18.0
|
|
23
|
+
- @modern-js/plugin@2.18.0
|
|
24
|
+
- @modern-js/types@2.18.0
|
|
25
|
+
- @modern-js/upgrade@2.18.0
|
|
26
|
+
- @modern-js/utils@2.18.0
|
|
27
|
+
|
|
3
28
|
## 2.17.1
|
|
4
29
|
|
|
5
30
|
### Patch Changes
|
|
@@ -46,8 +46,8 @@ const NESTED_ROUTES_DIR = "routes";
|
|
|
46
46
|
const FILE_SYSTEM_ROUTES_FILE_NAME = "routes.js";
|
|
47
47
|
const LOADER_EXPORT_NAME = "loader";
|
|
48
48
|
const TEMP_LOADERS_DIR = "__loaders__";
|
|
49
|
-
const ENTRY_POINT_FILE_NAME = "index.
|
|
50
|
-
const ENTRY_BOOTSTRAP_FILE_NAME = "bootstrap.
|
|
49
|
+
const ENTRY_POINT_FILE_NAME = "index.jsx";
|
|
50
|
+
const ENTRY_BOOTSTRAP_FILE_NAME = "bootstrap.jsx";
|
|
51
51
|
const FILE_SYSTEM_ROUTES_DYNAMIC_REGEXP = /^\[(\S+)\]([*+?]?)$/;
|
|
52
52
|
const FILE_SYSTEM_ROUTES_LAYOUT = "_layout";
|
|
53
53
|
const FILE_SYSTEM_ROUTES_GLOBAL_LAYOUT = "_app";
|
|
@@ -90,9 +90,9 @@ function stabilizeConfig(resolve, config, keys) {
|
|
|
90
90
|
});
|
|
91
91
|
}
|
|
92
92
|
async function getServerPort(config) {
|
|
93
|
-
const prodPort = config.server.port || 8080;
|
|
93
|
+
const prodPort = Number(process.env.PORT) || config.server.port || 8080;
|
|
94
94
|
if ((0, _utils.isDev)() && (0, _utils.isDevCommand)()) {
|
|
95
|
-
return (0, _utils.getPort)(config.dev.port || prodPort);
|
|
95
|
+
return (0, _utils.getPort)(Number(process.env.PORT) || config.dev.port || prodPort);
|
|
96
96
|
}
|
|
97
97
|
return prodPort;
|
|
98
98
|
}
|
|
@@ -11,8 +11,8 @@ export var NESTED_ROUTES_DIR = "routes";
|
|
|
11
11
|
export var FILE_SYSTEM_ROUTES_FILE_NAME = "routes.js";
|
|
12
12
|
export var LOADER_EXPORT_NAME = "loader";
|
|
13
13
|
export var TEMP_LOADERS_DIR = "__loaders__";
|
|
14
|
-
export var ENTRY_POINT_FILE_NAME = "index.
|
|
15
|
-
export var ENTRY_BOOTSTRAP_FILE_NAME = "bootstrap.
|
|
14
|
+
export var ENTRY_POINT_FILE_NAME = "index.jsx";
|
|
15
|
+
export var ENTRY_BOOTSTRAP_FILE_NAME = "bootstrap.jsx";
|
|
16
16
|
export var FILE_SYSTEM_ROUTES_DYNAMIC_REGEXP = /^\[(\S+)\]([*+?]?)$/;
|
|
17
17
|
export var FILE_SYSTEM_ROUTES_LAYOUT = "_layout";
|
|
18
18
|
export var FILE_SYSTEM_ROUTES_GLOBAL_LAYOUT = "_app";
|
|
@@ -216,9 +216,9 @@ export var createImportStatements = function(statements) {
|
|
|
216
216
|
var _step_value = _step.value, value = _step_value.value, specifiers = _step_value.specifiers, initialize = _step_value.initialize;
|
|
217
217
|
if (!seen.has(value)) {
|
|
218
218
|
deDuplicated.push({
|
|
219
|
-
value,
|
|
220
|
-
specifiers,
|
|
221
|
-
initialize
|
|
219
|
+
value: value,
|
|
220
|
+
specifiers: specifiers,
|
|
221
|
+
initialize: initialize
|
|
222
222
|
});
|
|
223
223
|
seen.set(value, specifiers);
|
|
224
224
|
} else {
|
|
@@ -281,11 +281,11 @@ export var generateCode = function() {
|
|
|
281
281
|
nestedRoute = null;
|
|
282
282
|
if (entrypoint.entry) {
|
|
283
283
|
initialRoutes = getRoutes({
|
|
284
|
-
entrypoint,
|
|
285
|
-
srcDirectory,
|
|
284
|
+
entrypoint: entrypoint,
|
|
285
|
+
srcDirectory: srcDirectory,
|
|
286
286
|
srcAlias: internalSrcAlias,
|
|
287
|
-
internalDirectory,
|
|
288
|
-
internalDirAlias
|
|
287
|
+
internalDirectory: internalDirectory,
|
|
288
|
+
internalDirAlias: internalDirAlias
|
|
289
289
|
});
|
|
290
290
|
}
|
|
291
291
|
if (!(!isV5 && entrypoint.nestedRoutesEntry))
|
|
@@ -310,7 +310,7 @@ export var generateCode = function() {
|
|
|
310
310
|
return [
|
|
311
311
|
4,
|
|
312
312
|
hookRunners.modifyFileSystemRoutes({
|
|
313
|
-
entrypoint,
|
|
313
|
+
entrypoint: entrypoint,
|
|
314
314
|
routes: initialRoutes
|
|
315
315
|
})
|
|
316
316
|
];
|
|
@@ -333,16 +333,16 @@ export var generateCode = function() {
|
|
|
333
333
|
}
|
|
334
334
|
_ = hookRunners.beforeGenerateRoutes;
|
|
335
335
|
_tmp = {
|
|
336
|
-
entrypoint
|
|
336
|
+
entrypoint: entrypoint
|
|
337
337
|
};
|
|
338
338
|
return [
|
|
339
339
|
4,
|
|
340
340
|
templates.fileSystemRoutes({
|
|
341
|
-
routes,
|
|
341
|
+
routes: routes,
|
|
342
342
|
ssrMode: useSSG ? "string" : mode,
|
|
343
343
|
nestedRoutesEntry: entrypoint.nestedRoutesEntry,
|
|
344
344
|
entryName: entrypoint.entryName,
|
|
345
|
-
internalDirectory,
|
|
345
|
+
internalDirectory: internalDirectory,
|
|
346
346
|
splitRouteChunks: _$config === null || _$config === void 0 ? void 0 : (_config_output = _$config.output) === null || _config_output === void 0 ? void 0 : _config_output.splitRouteChunks
|
|
347
347
|
})
|
|
348
348
|
];
|
|
@@ -362,7 +362,7 @@ export var generateCode = function() {
|
|
|
362
362
|
];
|
|
363
363
|
routesServerFile = getServerLoadersFile(internalDirectory, entryName);
|
|
364
364
|
code1 = templates.routesForServer({
|
|
365
|
-
routes
|
|
365
|
+
routes: routes
|
|
366
366
|
});
|
|
367
367
|
return [
|
|
368
368
|
4,
|
|
@@ -399,13 +399,13 @@ export var generateCode = function() {
|
|
|
399
399
|
return [
|
|
400
400
|
4,
|
|
401
401
|
hookRunners.modifyEntryImports({
|
|
402
|
-
entrypoint,
|
|
402
|
+
entrypoint: entrypoint,
|
|
403
403
|
imports: getDefaultImports({
|
|
404
|
-
entrypoint,
|
|
405
|
-
srcDirectory,
|
|
406
|
-
internalSrcAlias,
|
|
407
|
-
internalDirAlias,
|
|
408
|
-
internalDirectory
|
|
404
|
+
entrypoint: entrypoint,
|
|
405
|
+
srcDirectory: srcDirectory,
|
|
406
|
+
internalSrcAlias: internalSrcAlias,
|
|
407
|
+
internalDirAlias: internalDirAlias,
|
|
408
|
+
internalDirectory: internalDirectory
|
|
409
409
|
})
|
|
410
410
|
})
|
|
411
411
|
];
|
|
@@ -414,7 +414,7 @@ export var generateCode = function() {
|
|
|
414
414
|
return [
|
|
415
415
|
4,
|
|
416
416
|
hookRunners.modifyEntryRuntimePlugins({
|
|
417
|
-
entrypoint,
|
|
417
|
+
entrypoint: entrypoint,
|
|
418
418
|
plugins: []
|
|
419
419
|
})
|
|
420
420
|
];
|
|
@@ -423,11 +423,11 @@ export var generateCode = function() {
|
|
|
423
423
|
return [
|
|
424
424
|
4,
|
|
425
425
|
hookRunners.modifyEntryRenderFunction({
|
|
426
|
-
entrypoint,
|
|
426
|
+
entrypoint: entrypoint,
|
|
427
427
|
code: templates.renderFunction({
|
|
428
|
-
plugins,
|
|
429
|
-
customBootstrap,
|
|
430
|
-
fileSystemRoutes
|
|
428
|
+
plugins: plugins,
|
|
429
|
+
customBootstrap: customBootstrap,
|
|
430
|
+
fileSystemRoutes: fileSystemRoutes
|
|
431
431
|
})
|
|
432
432
|
})
|
|
433
433
|
];
|
|
@@ -436,17 +436,17 @@ export var generateCode = function() {
|
|
|
436
436
|
return [
|
|
437
437
|
4,
|
|
438
438
|
hookRunners.modifyEntryExport({
|
|
439
|
-
entrypoint,
|
|
439
|
+
entrypoint: entrypoint,
|
|
440
440
|
exportStatement: "export default AppWrapper;"
|
|
441
441
|
})
|
|
442
442
|
];
|
|
443
443
|
case 15:
|
|
444
444
|
exportStatement = _state.sent().exportStatement;
|
|
445
445
|
code2 = templates.index({
|
|
446
|
-
mountId,
|
|
446
|
+
mountId: mountId,
|
|
447
447
|
imports: createImportStatements(importStatements),
|
|
448
|
-
renderFunction,
|
|
449
|
-
exportStatement
|
|
448
|
+
renderFunction: renderFunction,
|
|
449
|
+
exportStatement: exportStatement
|
|
450
450
|
});
|
|
451
451
|
entryFile = path.resolve(internalDirectory, "./".concat(entryName, "/").concat(ENTRY_POINT_FILE_NAME));
|
|
452
452
|
entrypoint.entry = entryFile;
|
|
@@ -458,7 +458,7 @@ export var generateCode = function() {
|
|
|
458
458
|
return [
|
|
459
459
|
4,
|
|
460
460
|
hookRunners.modifyAsyncEntry({
|
|
461
|
-
entrypoint,
|
|
461
|
+
entrypoint: entrypoint,
|
|
462
462
|
code: "import('./".concat(ENTRY_BOOTSTRAP_FILE_NAME, "');")
|
|
463
463
|
})
|
|
464
464
|
];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
function _define_property(obj, key, value) {
|
|
2
2
|
if (key in obj) {
|
|
3
3
|
Object.defineProperty(obj, key, {
|
|
4
|
-
value,
|
|
4
|
+
value: value,
|
|
5
5
|
enumerable: true,
|
|
6
6
|
configurable: true,
|
|
7
7
|
writable: true
|
|
@@ -83,7 +83,7 @@ var recursiveReadDir = function(param) {
|
|
|
83
83
|
children: [],
|
|
84
84
|
_component: alias,
|
|
85
85
|
component: componentName,
|
|
86
|
-
parent,
|
|
86
|
+
parent: parent,
|
|
87
87
|
type: "page"
|
|
88
88
|
};
|
|
89
89
|
parent = route;
|
|
@@ -114,16 +114,16 @@ var recursiveReadDir = function(param) {
|
|
|
114
114
|
path: "".concat(basePath).concat(dynamicRouteMatched ? ":".concat(dynamicRouteMatched[1].replace(/\$$/, "?")).concat(dynamicRouteMatched[2]) : filename),
|
|
115
115
|
_component: alias1,
|
|
116
116
|
component: componentName1,
|
|
117
|
-
parent,
|
|
117
|
+
parent: parent,
|
|
118
118
|
type: "page"
|
|
119
119
|
};
|
|
120
120
|
if (fs.statSync(filePath).isDirectory()) {
|
|
121
121
|
recursiveReadDir({
|
|
122
122
|
dir: filePath,
|
|
123
|
-
routes,
|
|
123
|
+
routes: routes,
|
|
124
124
|
basePath: "".concat(route1.path, "/"),
|
|
125
|
-
srcDirectory,
|
|
126
|
-
srcAlias
|
|
125
|
+
srcDirectory: srcDirectory,
|
|
126
|
+
srcAlias: srcAlias
|
|
127
127
|
});
|
|
128
128
|
continue;
|
|
129
129
|
}
|
|
@@ -211,10 +211,10 @@ export var getClientRoutes = function(param) {
|
|
|
211
211
|
var routes = [];
|
|
212
212
|
recursiveReadDir({
|
|
213
213
|
dir: pageRoutesEntry,
|
|
214
|
-
routes,
|
|
214
|
+
routes: routes,
|
|
215
215
|
basePath: "/",
|
|
216
|
-
srcDirectory,
|
|
217
|
-
srcAlias
|
|
216
|
+
srcDirectory: srcDirectory,
|
|
217
|
+
srcAlias: srcAlias
|
|
218
218
|
});
|
|
219
219
|
var internalComponentsDir = path.resolve(internalDirectory, "".concat(entryName, "/").concat(FILE_SYSTEM_ROUTES_COMPONENTS_DIR));
|
|
220
220
|
fs.emptyDirSync(internalComponentsDir);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
function _define_property(obj, key, value) {
|
|
2
2
|
if (key in obj) {
|
|
3
3
|
Object.defineProperty(obj, key, {
|
|
4
|
-
value,
|
|
4
|
+
value: value,
|
|
5
5
|
enumerable: true,
|
|
6
6
|
configurable: true,
|
|
7
7
|
writable: true
|
|
@@ -84,7 +84,7 @@ var recursiveReadDirLegacy = function(param) {
|
|
|
84
84
|
routes: [],
|
|
85
85
|
_component: alias,
|
|
86
86
|
component: componentName,
|
|
87
|
-
parent
|
|
87
|
+
parent: parent
|
|
88
88
|
};
|
|
89
89
|
parent = route;
|
|
90
90
|
resetParent = true;
|
|
@@ -115,15 +115,15 @@ var recursiveReadDirLegacy = function(param) {
|
|
|
115
115
|
_component: alias1,
|
|
116
116
|
component: componentName1,
|
|
117
117
|
exact: true,
|
|
118
|
-
parent
|
|
118
|
+
parent: parent
|
|
119
119
|
};
|
|
120
120
|
if (fs.statSync(filePath).isDirectory()) {
|
|
121
121
|
recursiveReadDirLegacy({
|
|
122
122
|
dir: filePath,
|
|
123
|
-
routes,
|
|
123
|
+
routes: routes,
|
|
124
124
|
basePath: "".concat(route1.path, "/"),
|
|
125
|
-
srcDirectory,
|
|
126
|
-
srcAlias
|
|
125
|
+
srcDirectory: srcDirectory,
|
|
126
|
+
srcAlias: srcAlias
|
|
127
127
|
});
|
|
128
128
|
continue;
|
|
129
129
|
}
|
|
@@ -209,10 +209,10 @@ export var getClientRoutes = function(param) {
|
|
|
209
209
|
var routes = [];
|
|
210
210
|
recursiveReadDirLegacy({
|
|
211
211
|
dir: entry,
|
|
212
|
-
routes,
|
|
212
|
+
routes: routes,
|
|
213
213
|
basePath: "/",
|
|
214
|
-
srcDirectory,
|
|
215
|
-
srcAlias
|
|
214
|
+
srcDirectory: srcDirectory,
|
|
215
|
+
srcAlias: srcAlias
|
|
216
216
|
});
|
|
217
217
|
var internalComponentsDir = path.resolve(internalDirectory, "".concat(entryName, "/").concat(FILE_SYSTEM_ROUTES_COMPONENTS_DIR));
|
|
218
218
|
fs.emptyDirSync(internalComponentsDir);
|
|
@@ -29,7 +29,7 @@ var scanDir = function(dirs) {
|
|
|
29
29
|
var entryName = path.basename(dir);
|
|
30
30
|
if (indexFile && !customBootstrap) {
|
|
31
31
|
return {
|
|
32
|
-
entryName,
|
|
32
|
+
entryName: entryName,
|
|
33
33
|
entry: indexFile,
|
|
34
34
|
absoluteEntryDir: path.resolve(dir),
|
|
35
35
|
isAutoMount: false
|
|
@@ -38,18 +38,18 @@ var scanDir = function(dirs) {
|
|
|
38
38
|
var isHasApp = hasApp(dir);
|
|
39
39
|
if (isHasApp) {
|
|
40
40
|
return {
|
|
41
|
-
entryName,
|
|
41
|
+
entryName: entryName,
|
|
42
42
|
entry: path.join(dir, APP_FILE_NAME),
|
|
43
43
|
isAutoMount: true,
|
|
44
44
|
absoluteEntryDir: path.resolve(dir),
|
|
45
|
-
customBootstrap
|
|
45
|
+
customBootstrap: customBootstrap
|
|
46
46
|
};
|
|
47
47
|
}
|
|
48
48
|
var isHasNestedRoutes = hasNestedRoutes(dir);
|
|
49
49
|
var isHasPages = hasPages(dir);
|
|
50
50
|
if (isHasNestedRoutes || isHasPages) {
|
|
51
51
|
var entrypoint = {
|
|
52
|
-
entryName,
|
|
52
|
+
entryName: entryName,
|
|
53
53
|
entry: "",
|
|
54
54
|
fileSystemRoutes: {
|
|
55
55
|
globalApp: findExists(JS_EXTENSIONS.map(function(ext) {
|
|
@@ -58,7 +58,7 @@ var scanDir = function(dirs) {
|
|
|
58
58
|
},
|
|
59
59
|
isAutoMount: true,
|
|
60
60
|
absoluteEntryDir: path.resolve(dir),
|
|
61
|
-
customBootstrap
|
|
61
|
+
customBootstrap: customBootstrap
|
|
62
62
|
};
|
|
63
63
|
if (isHasPages) {
|
|
64
64
|
entrypoint.entry = path.join(dir, PAGES_DIR_NAME);
|
|
@@ -71,7 +71,7 @@ var scanDir = function(dirs) {
|
|
|
71
71
|
return entrypoint;
|
|
72
72
|
}
|
|
73
73
|
return {
|
|
74
|
-
entryName,
|
|
74
|
+
entryName: entryName,
|
|
75
75
|
entry: indexFile,
|
|
76
76
|
absoluteEntryDir: path.resolve(dir),
|
|
77
77
|
isAutoMount: false
|
|
@@ -167,7 +167,7 @@ var findPartials = function(dir, entryName, position) {
|
|
|
167
167
|
return path.resolve(dir, entryName, "".concat(position).concat(ext));
|
|
168
168
|
})) || base : base;
|
|
169
169
|
return file ? {
|
|
170
|
-
file,
|
|
170
|
+
file: file,
|
|
171
171
|
content: fs.readFileSync(file, "utf8")
|
|
172
172
|
} : null;
|
|
173
173
|
}
|
|
@@ -217,7 +217,7 @@ export var getHtmlTemplate = function() {
|
|
|
217
217
|
return [
|
|
218
218
|
4,
|
|
219
219
|
hookRunners.htmlPartials({
|
|
220
|
-
entrypoint,
|
|
220
|
+
entrypoint: entrypoint,
|
|
221
221
|
partials: [
|
|
222
222
|
PartialPosition.TOP,
|
|
223
223
|
PartialPosition.HEAD,
|
|
@@ -12,7 +12,7 @@ function _array_without_holes(arr) {
|
|
|
12
12
|
function _define_property(obj, key, value) {
|
|
13
13
|
if (key in obj) {
|
|
14
14
|
Object.defineProperty(obj, key, {
|
|
15
|
-
value,
|
|
15
|
+
value: value,
|
|
16
16
|
enumerable: true,
|
|
17
17
|
configurable: true,
|
|
18
18
|
writable: true
|
|
@@ -165,7 +165,7 @@ var applyRouteOptions = function(original, routeOptions) {
|
|
|
165
165
|
]);
|
|
166
166
|
routes = [
|
|
167
167
|
_object_spread_props(_object_spread({}, original, other), {
|
|
168
|
-
urlPath
|
|
168
|
+
urlPath: urlPath
|
|
169
169
|
})
|
|
170
170
|
];
|
|
171
171
|
} else {
|
|
@@ -195,10 +195,10 @@ var collectHtmlRoutes = function(entrypoints, appContext, config) {
|
|
|
195
195
|
var resHeaders = ((routes === null || routes === void 0 ? void 0 : routes[entryName]) || {}).resHeaders;
|
|
196
196
|
var route = {
|
|
197
197
|
urlPath: "/".concat(entryName === MAIN_ENTRY_NAME ? "" : entryName),
|
|
198
|
-
entryName,
|
|
198
|
+
entryName: entryName,
|
|
199
199
|
entryPath: removeLeadingSlash(path.posix.normalize("".concat(htmlPath, "/").concat(entryName).concat(disableHtmlFolder ? ".html" : "/index.html"))),
|
|
200
200
|
isSPA: true,
|
|
201
|
-
isSSR,
|
|
201
|
+
isSSR: isSSR,
|
|
202
202
|
responseHeaders: resHeaders,
|
|
203
203
|
worker: isWorker ? "".concat(SERVER_WORKER_BUNDLE_DIRECTORY, "/").concat(entryName, ".js") : void 0,
|
|
204
204
|
bundle: isSSR ? "".concat(SERVER_BUNDLE_DIRECTORY, "/").concat(entryName, ".js") : void 0
|
|
@@ -41,7 +41,7 @@ function _async_to_generator(fn) {
|
|
|
41
41
|
function _define_property(obj, key, value) {
|
|
42
42
|
if (key in obj) {
|
|
43
43
|
Object.defineProperty(obj, key, {
|
|
44
|
-
value,
|
|
44
|
+
value: value,
|
|
45
45
|
enumerable: true,
|
|
46
46
|
configurable: true,
|
|
47
47
|
writable: true
|
|
@@ -300,7 +300,7 @@ export default function(param) {
|
|
|
300
300
|
routes = _state.sent().routes;
|
|
301
301
|
debug("server routes: %o", routes);
|
|
302
302
|
appContext = _object_spread_props(_object_spread({}, appContext), {
|
|
303
|
-
apiOnly,
|
|
303
|
+
apiOnly: apiOnly,
|
|
304
304
|
serverRoutes: routes
|
|
305
305
|
});
|
|
306
306
|
api.setAppContext(appContext);
|
|
@@ -325,7 +325,7 @@ export default function(param) {
|
|
|
325
325
|
entrypoints = getBundleEntry(appContext, resolvedConfig);
|
|
326
326
|
debug("entrypoints: %o", entrypoints);
|
|
327
327
|
initialRoutes = getServerRoutes(entrypoints, {
|
|
328
|
-
appContext,
|
|
328
|
+
appContext: appContext,
|
|
329
329
|
config: resolvedConfig
|
|
330
330
|
});
|
|
331
331
|
return [
|
|
@@ -338,7 +338,7 @@ export default function(param) {
|
|
|
338
338
|
routes1 = _state.sent().routes;
|
|
339
339
|
debug("server routes: %o", routes1);
|
|
340
340
|
appContext = _object_spread_props(_object_spread({}, appContext), {
|
|
341
|
-
entrypoints,
|
|
341
|
+
entrypoints: entrypoints,
|
|
342
342
|
serverRoutes: routes1
|
|
343
343
|
});
|
|
344
344
|
api.setAppContext(appContext);
|
|
@@ -358,7 +358,7 @@ export default function(param) {
|
|
|
358
358
|
return [
|
|
359
359
|
4,
|
|
360
360
|
getHtmlTemplate(entrypoints, api, {
|
|
361
|
-
appContext,
|
|
361
|
+
appContext: appContext,
|
|
362
362
|
config: resolvedConfig
|
|
363
363
|
})
|
|
364
364
|
];
|
|
@@ -390,11 +390,11 @@ export default function(param) {
|
|
|
390
390
|
_state.label = 11;
|
|
391
391
|
case 11:
|
|
392
392
|
appContext = _object_spread_props(_object_spread({}, appContext), {
|
|
393
|
-
entrypoints,
|
|
394
|
-
checkedEntries,
|
|
395
|
-
apiOnly,
|
|
393
|
+
entrypoints: entrypoints,
|
|
394
|
+
checkedEntries: checkedEntries,
|
|
395
|
+
apiOnly: apiOnly,
|
|
396
396
|
serverRoutes: routes1,
|
|
397
|
-
htmlTemplates
|
|
397
|
+
htmlTemplates: htmlTemplates
|
|
398
398
|
});
|
|
399
399
|
api.setAppContext(appContext);
|
|
400
400
|
command = getCommand();
|
|
@@ -420,8 +420,8 @@ export default function(param) {
|
|
|
420
420
|
return [
|
|
421
421
|
4,
|
|
422
422
|
createBuilderForModern({
|
|
423
|
-
normalizedConfig,
|
|
424
|
-
appContext,
|
|
423
|
+
normalizedConfig: normalizedConfig,
|
|
424
|
+
appContext: appContext,
|
|
425
425
|
onBeforeBuild: function onBeforeBuild(param2) {
|
|
426
426
|
var bundlerConfigs = param2.bundlerConfigs;
|
|
427
427
|
return _async_to_generator(function() {
|
|
@@ -439,7 +439,7 @@ export default function(param) {
|
|
|
439
439
|
return [
|
|
440
440
|
4,
|
|
441
441
|
hookRunners2.beforeBuild({
|
|
442
|
-
bundlerConfigs
|
|
442
|
+
bundlerConfigs: bundlerConfigs
|
|
443
443
|
})
|
|
444
444
|
];
|
|
445
445
|
case 2:
|
|
@@ -462,7 +462,7 @@ export default function(param) {
|
|
|
462
462
|
return [
|
|
463
463
|
4,
|
|
464
464
|
hookRunners2.afterBuild({
|
|
465
|
-
stats
|
|
465
|
+
stats: stats
|
|
466
466
|
})
|
|
467
467
|
];
|
|
468
468
|
case 1:
|
|
@@ -509,7 +509,7 @@ export default function(param) {
|
|
|
509
509
|
return [
|
|
510
510
|
4,
|
|
511
511
|
hookRunners2.beforeCreateCompiler({
|
|
512
|
-
bundlerConfigs
|
|
512
|
+
bundlerConfigs: bundlerConfigs
|
|
513
513
|
})
|
|
514
514
|
];
|
|
515
515
|
case 1:
|
|
@@ -532,7 +532,7 @@ export default function(param) {
|
|
|
532
532
|
return [
|
|
533
533
|
4,
|
|
534
534
|
hookRunners2.afterCreateCompiler({
|
|
535
|
-
compiler
|
|
535
|
+
compiler: compiler
|
|
536
536
|
})
|
|
537
537
|
];
|
|
538
538
|
case 1:
|
|
@@ -550,7 +550,7 @@ export default function(param) {
|
|
|
550
550
|
builder = _state.sent();
|
|
551
551
|
builder.addPlugins(resolvedConfig.builderPlugins);
|
|
552
552
|
appContext = _object_spread_props(_object_spread({}, appContext), {
|
|
553
|
-
builder
|
|
553
|
+
builder: builder
|
|
554
554
|
});
|
|
555
555
|
api.setAppContext(appContext);
|
|
556
556
|
_state.label = 14;
|
|
@@ -656,8 +656,8 @@ export default function(param) {
|
|
|
656
656
|
return [
|
|
657
657
|
2,
|
|
658
658
|
{
|
|
659
|
-
entrypoint,
|
|
660
|
-
imports
|
|
659
|
+
entrypoint: entrypoint,
|
|
660
|
+
imports: imports
|
|
661
661
|
}
|
|
662
662
|
];
|
|
663
663
|
}
|
|
@@ -30,7 +30,7 @@ function _async_to_generator(fn) {
|
|
|
30
30
|
function _define_property(obj, key, value) {
|
|
31
31
|
if (key in obj) {
|
|
32
32
|
Object.defineProperty(obj, key, {
|
|
33
|
-
value,
|
|
33
|
+
value: value,
|
|
34
34
|
enumerable: true,
|
|
35
35
|
configurable: true,
|
|
36
36
|
writable: true
|
|
@@ -198,7 +198,7 @@ var createIndexRoute = function(routeInfo, rootDir, filename, entryName) {
|
|
|
198
198
|
var createRoute = function(routeInfo, rootDir, filename, entryName) {
|
|
199
199
|
var id = getRouteId(filename, rootDir, entryName);
|
|
200
200
|
return _object_spread_props(_object_spread({}, routeInfo), {
|
|
201
|
-
id,
|
|
201
|
+
id: id,
|
|
202
202
|
type: "nested"
|
|
203
203
|
});
|
|
204
204
|
};
|
|
@@ -245,7 +245,7 @@ export var walk = function() {
|
|
|
245
245
|
route = {
|
|
246
246
|
path: routePath === null || routePath === void 0 ? void 0 : routePath.replace(/\$$/, "?"),
|
|
247
247
|
children: [],
|
|
248
|
-
isRoot
|
|
248
|
+
isRoot: isRoot
|
|
249
249
|
};
|
|
250
250
|
pageLoaderFile = "";
|
|
251
251
|
pageRoute = null;
|
|
@@ -41,7 +41,7 @@ function _async_to_generator(fn) {
|
|
|
41
41
|
function _define_property(obj, key, value) {
|
|
42
42
|
if (key in obj) {
|
|
43
43
|
Object.defineProperty(obj, key, {
|
|
44
|
-
value,
|
|
44
|
+
value: value,
|
|
45
45
|
enumerable: true,
|
|
46
46
|
configurable: true,
|
|
47
47
|
writable: true
|
|
@@ -256,16 +256,7 @@ export var renderFunction = function(param) {
|
|
|
256
256
|
}).join("\n"), "\n ]\n })(").concat(fileSystemRoutes2 ? "" : "App", ")\n\n\n if(!AppWrapper.init && typeof appInit !== 'undefined') {\n AppWrapper.init = appInit;\n }\n\n\n if (IS_BROWSER) {\n ").concat(customBootstrap ? "customBootstrap(AppWrapper, () => ".concat(bootstrap, ");") : "".concat(bootstrap, ";"), "\n }\n\n return AppWrapper\n");
|
|
257
257
|
};
|
|
258
258
|
export var html = function(partials) {
|
|
259
|
-
return "\n<!DOCTYPE html>\n<html>\n<head>\n <%= meta %>\n <title><%= title %></title>\n\n ".concat(partials.top.join("\n"), "\n\n ").concat(partials.head.join("\n"),
|
|
260
|
-
|
|
261
|
-
</head>
|
|
262
|
-
|
|
263
|
-
<body>
|
|
264
|
-
<noscript>
|
|
265
|
-
We're sorry but react app doesn't work properly without JavaScript enabled. Please enable it to continue.
|
|
266
|
-
</noscript>
|
|
267
|
-
<div id="<%= mountId %>"><!--<?- html ?>--></div>
|
|
268
|
-
`).concat(partials.body.join("\n"), "\n <!--<?- chunksMap.js ?>-->\n <!--<?- SSRDataScript ?>-->\n <!--<?- bottomTemplate ?>-->\n</body>\n\n</html>\n");
|
|
259
|
+
return "\n<!DOCTYPE html>\n<html>\n<head>\n <%= meta %>\n <title><%= title %></title>\n\n ".concat(partials.top.join("\n"), "\n\n ").concat(partials.head.join("\n"), "\n\n</head>\n\n<body>\n <noscript>\n We're sorry but react app doesn't work properly without JavaScript enabled. Please enable it to continue.\n </noscript>\n <div id=\"<%= mountId %>\"><!--<?- html ?>--></div>\n ").concat(partials.body.join("\n"), "\n <!--<?- chunksMap.js ?>-->\n <!--<?- SSRDataScript ?>-->\n <!--<?- bottomTemplate ?>-->\n</body>\n\n</html>\n");
|
|
269
260
|
};
|
|
270
261
|
export var routesForServer = function(param) {
|
|
271
262
|
var routes = param.routes;
|
|
@@ -284,8 +275,8 @@ export var routesForServer = function(param) {
|
|
|
284
275
|
}
|
|
285
276
|
}
|
|
286
277
|
var finalRoute = _object_spread_props(_object_spread({}, route2), {
|
|
287
|
-
loader,
|
|
288
|
-
children
|
|
278
|
+
loader: loader,
|
|
279
|
+
children: children
|
|
289
280
|
});
|
|
290
281
|
return finalRoute;
|
|
291
282
|
};
|
|
@@ -396,10 +387,10 @@ export var fileSystemRoutes = function() {
|
|
|
396
387
|
rootLayoutCode = "import RootLayout from '".concat(route2._component, "'");
|
|
397
388
|
component2 = "RootLayout";
|
|
398
389
|
} else if (ssrMode === "string") {
|
|
399
|
-
lazyImport = '() => import(/* webpackChunkName: "'.concat(route2.id,
|
|
390
|
+
lazyImport = '() => import(/* webpackChunkName: "'.concat(route2.id, "\" */ '").concat(route2._component, "')");
|
|
400
391
|
component2 = "loadable(".concat(lazyImport, ")");
|
|
401
392
|
} else {
|
|
402
|
-
lazyImport = '() => import(/* webpackChunkName: "'.concat(route2.id,
|
|
393
|
+
lazyImport = '() => import(/* webpackChunkName: "'.concat(route2.id, "\" */ '").concat(route2._component, "')");
|
|
403
394
|
component2 = "lazy(".concat(lazyImport, ")");
|
|
404
395
|
}
|
|
405
396
|
} else {
|
|
@@ -417,12 +408,12 @@ export var fileSystemRoutes = function() {
|
|
|
417
408
|
}
|
|
418
409
|
}
|
|
419
410
|
var finalRoute2 = _object_spread_props(_object_spread({}, route2), {
|
|
420
|
-
lazyImport,
|
|
421
|
-
loading,
|
|
422
|
-
loader,
|
|
423
|
-
config,
|
|
424
|
-
error,
|
|
425
|
-
children
|
|
411
|
+
lazyImport: lazyImport,
|
|
412
|
+
loading: loading,
|
|
413
|
+
loader: loader,
|
|
414
|
+
config: config,
|
|
415
|
+
error: error,
|
|
416
|
+
children: children
|
|
426
417
|
});
|
|
427
418
|
if (route2._component) {
|
|
428
419
|
finalRoute2.component = component2;
|
|
@@ -453,7 +444,7 @@ export var fileSystemRoutes = function() {
|
|
|
453
444
|
} else {
|
|
454
445
|
component = "loadable(() => import('".concat(route._component, "'))");
|
|
455
446
|
finalRoute = _object_spread_props(_object_spread({}, route), {
|
|
456
|
-
component
|
|
447
|
+
component: component
|
|
457
448
|
});
|
|
458
449
|
keywords1 = [
|
|
459
450
|
"component",
|