@modern-js/app-tools 2.14.0 → 2.16.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 +74 -0
- package/dist/cjs/analyze/constants.js +37 -61
- package/dist/cjs/analyze/generateCode.js +102 -127
- package/dist/cjs/analyze/getBundleEntry.js +33 -66
- package/dist/cjs/analyze/getClientRoutes/getRoutes.js +61 -117
- package/dist/cjs/analyze/getClientRoutes/getRoutesLegacy.js +61 -115
- package/dist/cjs/analyze/getClientRoutes/index.js +15 -28
- package/dist/cjs/analyze/getClientRoutes/utils.js +24 -48
- package/dist/cjs/analyze/getFileSystemEntry.js +39 -79
- package/dist/cjs/analyze/getHtmlTemplate.js +88 -98
- package/dist/cjs/analyze/getServerRoutes.js +67 -110
- package/dist/cjs/analyze/index.js +265 -257
- package/dist/cjs/analyze/isDefaultExportFunction.js +66 -44
- package/dist/cjs/analyze/makeLegalIdentifier.js +7 -25
- package/dist/cjs/analyze/nestedRoutes.js +99 -104
- package/dist/cjs/analyze/templates.js +49 -110
- package/dist/cjs/analyze/utils.js +98 -102
- package/dist/cjs/builder/builder-rspack/adapterCopy.js +58 -100
- package/dist/cjs/builder/builder-rspack/index.js +14 -30
- package/dist/cjs/builder/builder-webpack/adapterModern.js +33 -50
- package/dist/cjs/builder/builder-webpack/createCopyPattern.js +16 -32
- package/dist/cjs/builder/builder-webpack/index.js +65 -46
- package/dist/cjs/builder/generator/createBuilderOptions.js +10 -26
- package/dist/cjs/builder/generator/createBuilderProviderConfig.js +11 -27
- package/dist/cjs/builder/generator/getBuilderTargets.js +13 -29
- package/dist/cjs/builder/generator/index.js +61 -55
- package/dist/cjs/builder/index.js +53 -43
- package/dist/cjs/builder/shared/builderPlugins/adapterBasic.js +13 -36
- package/dist/cjs/builder/shared/builderPlugins/adapterHtml.js +90 -90
- package/dist/cjs/builder/shared/builderPlugins/adapterSSR.js +108 -111
- package/dist/cjs/builder/shared/builderPlugins/index.js +20 -19
- package/dist/cjs/builder/shared/bundlerPlugins/HtmlAsyncChunkPlugin.js +30 -30
- package/dist/cjs/builder/shared/bundlerPlugins/HtmlBottomTemplate.js +32 -38
- package/dist/cjs/builder/shared/bundlerPlugins/RouterPlugin.js +86 -116
- package/dist/cjs/builder/shared/bundlerPlugins/index.js +20 -19
- package/dist/cjs/builder/shared/createCopyInfo.js +16 -42
- package/dist/cjs/builder/shared/index.js +20 -19
- package/dist/cjs/builder/shared/loaders/serverModuleLoader.js +8 -24
- package/dist/cjs/builder/shared/types.js +4 -15
- package/dist/cjs/commands/build.js +23 -40
- package/dist/cjs/commands/deploy.js +7 -25
- package/dist/cjs/commands/dev.js +38 -57
- package/dist/cjs/commands/index.js +20 -19
- package/dist/cjs/commands/inspect.js +10 -30
- package/dist/cjs/commands/serve.js +28 -66
- package/dist/cjs/config/default.js +34 -34
- package/dist/cjs/config/index.js +20 -19
- package/dist/cjs/config/initialize/index.js +11 -29
- package/dist/cjs/config/initialize/inits.js +103 -82
- package/dist/cjs/config/legacy/createHtmlConfig.js +8 -40
- package/dist/cjs/config/legacy/createOutputConfig.js +8 -51
- package/dist/cjs/config/legacy/createSourceConfig.js +8 -38
- package/dist/cjs/config/legacy/createToolsConfig.js +8 -43
- package/dist/cjs/config/legacy/index.js +22 -46
- package/dist/cjs/defineConfig.js +16 -31
- package/dist/cjs/exports/server.js +7 -25
- package/dist/cjs/hooks.js +33 -51
- package/dist/cjs/index.js +185 -166
- package/dist/cjs/initialize/index.js +84 -100
- package/dist/cjs/locale/en.js +13 -27
- package/dist/cjs/locale/index.js +18 -28
- package/dist/cjs/locale/zh.js +13 -27
- package/dist/cjs/schema/Schema.js +27 -31
- package/dist/cjs/schema/index.js +141 -71
- package/dist/cjs/schema/legacy.js +273 -96
- package/dist/cjs/types/config/deploy.js +4 -15
- package/dist/cjs/types/config/dev.js +4 -15
- package/dist/cjs/types/config/experiments.js +4 -15
- package/dist/cjs/types/config/html.js +4 -15
- package/dist/cjs/types/config/index.js +18 -17
- package/dist/cjs/types/config/output.js +4 -15
- package/dist/cjs/types/config/performance.js +4 -15
- package/dist/cjs/types/config/security.js +4 -15
- package/dist/cjs/types/config/source.js +4 -15
- package/dist/cjs/types/config/tools.js +4 -15
- package/dist/cjs/types/hooks.js +4 -15
- package/dist/cjs/types/index.js +20 -19
- package/dist/cjs/types/legacyConfig/deploy.js +4 -15
- package/dist/cjs/types/legacyConfig/dev.js +4 -15
- package/dist/cjs/types/legacyConfig/index.js +4 -15
- package/dist/cjs/types/legacyConfig/output.js +4 -15
- package/dist/cjs/types/legacyConfig/source.js +4 -15
- package/dist/cjs/types/legacyConfig/tools.js +4 -15
- package/dist/cjs/types/utils.js +4 -15
- package/dist/cjs/utils/config.js +74 -79
- package/dist/cjs/utils/createServer.js +16 -42
- package/dist/cjs/utils/env.js +7 -25
- package/dist/cjs/utils/generateWatchFiles.js +31 -52
- package/dist/cjs/utils/getSelectedEntries.js +13 -35
- package/dist/cjs/utils/getServerInternalPlugins.js +8 -29
- package/dist/cjs/utils/printInstructions.js +10 -28
- package/dist/cjs/utils/restart.js +13 -31
- package/dist/cjs/utils/routes.js +18 -39
- package/dist/cjs/utils/types.js +4 -15
- package/dist/esm/analyze/constants.js +40 -41
- package/dist/esm/analyze/generateCode.js +477 -455
- package/dist/esm/analyze/getBundleEntry.js +53 -54
- package/dist/esm/analyze/getClientRoutes/getRoutes.js +201 -202
- package/dist/esm/analyze/getClientRoutes/getRoutesLegacy.js +199 -200
- package/dist/esm/analyze/getClientRoutes/index.js +2 -3
- package/dist/esm/analyze/getClientRoutes/utils.js +15 -15
- package/dist/esm/analyze/getFileSystemEntry.js +86 -87
- package/dist/esm/analyze/getHtmlTemplate.js +289 -278
- package/dist/esm/analyze/getServerRoutes.js +203 -190
- package/dist/esm/analyze/index.js +679 -651
- package/dist/esm/analyze/isDefaultExportFunction.js +38 -39
- package/dist/esm/analyze/makeLegalIdentifier.js +8 -9
- package/dist/esm/analyze/nestedRoutes.js +400 -392
- package/dist/esm/analyze/templates.js +536 -509
- package/dist/esm/analyze/utils.js +357 -336
- package/dist/esm/builder/builder-rspack/adapterCopy.js +347 -330
- package/dist/esm/builder/builder-rspack/index.js +8 -9
- package/dist/esm/builder/builder-webpack/adapterModern.js +51 -43
- package/dist/esm/builder/builder-webpack/createCopyPattern.js +31 -32
- package/dist/esm/builder/builder-webpack/index.js +266 -249
- package/dist/esm/builder/generator/createBuilderOptions.js +37 -38
- package/dist/esm/builder/generator/createBuilderProviderConfig.js +62 -63
- package/dist/esm/builder/generator/getBuilderTargets.js +13 -14
- package/dist/esm/builder/generator/index.js +203 -196
- package/dist/esm/builder/index.js +183 -176
- package/dist/esm/builder/shared/builderPlugins/adapterBasic.js +90 -91
- package/dist/esm/builder/shared/builderPlugins/adapterHtml.js +300 -291
- package/dist/esm/builder/shared/builderPlugins/adapterSSR.js +337 -329
- package/dist/esm/builder/shared/bundlerPlugins/HtmlAsyncChunkPlugin.js +108 -97
- package/dist/esm/builder/shared/bundlerPlugins/HtmlBottomTemplate.js +66 -64
- package/dist/esm/builder/shared/bundlerPlugins/RouterPlugin.js +364 -337
- package/dist/esm/builder/shared/createCopyInfo.js +9 -10
- package/dist/esm/builder/shared/loaders/serverModuleLoader.js +2 -3
- package/dist/esm/builder/shared/types.js +1 -1
- package/dist/esm/commands/build.js +279 -272
- package/dist/esm/commands/deploy.js +150 -144
- package/dist/esm/commands/dev.js +296 -289
- package/dist/esm/commands/inspect.js +144 -138
- package/dist/esm/commands/serve.js +241 -235
- package/dist/esm/config/default.js +202 -203
- package/dist/esm/config/initialize/index.js +7 -8
- package/dist/esm/config/initialize/inits.js +189 -181
- package/dist/esm/config/legacy/createHtmlConfig.js +17 -18
- package/dist/esm/config/legacy/createOutputConfig.js +41 -42
- package/dist/esm/config/legacy/createSourceConfig.js +38 -39
- package/dist/esm/config/legacy/createToolsConfig.js +24 -25
- package/dist/esm/config/legacy/index.js +31 -32
- package/dist/esm/defineConfig.js +52 -53
- package/dist/esm/exports/server.js +1 -2
- package/dist/esm/hooks.js +26 -27
- package/dist/esm/index.js +685 -671
- package/dist/esm/initialize/index.js +276 -269
- package/dist/esm/locale/en.js +36 -37
- package/dist/esm/locale/index.js +2 -2
- package/dist/esm/locale/zh.js +36 -37
- package/dist/esm/schema/Schema.js +255 -244
- package/dist/esm/schema/index.js +165 -165
- package/dist/esm/schema/legacy.js +316 -317
- package/dist/esm/types/config/deploy.js +1 -1
- package/dist/esm/types/config/dev.js +1 -1
- package/dist/esm/types/config/experiments.js +1 -1
- package/dist/esm/types/config/html.js +1 -1
- package/dist/esm/types/config/output.js +1 -1
- package/dist/esm/types/config/performance.js +1 -1
- package/dist/esm/types/config/security.js +1 -1
- package/dist/esm/types/config/source.js +1 -1
- package/dist/esm/types/config/tools.js +1 -1
- package/dist/esm/types/hooks.js +1 -1
- package/dist/esm/types/legacyConfig/deploy.js +1 -1
- package/dist/esm/types/legacyConfig/dev.js +1 -1
- package/dist/esm/types/legacyConfig/index.js +1 -1
- package/dist/esm/types/legacyConfig/output.js +1 -1
- package/dist/esm/types/legacyConfig/source.js +1 -1
- package/dist/esm/types/legacyConfig/tools.js +1 -1
- package/dist/esm/types/utils.js +1 -1
- package/dist/esm/utils/config.js +285 -278
- package/dist/esm/utils/createServer.js +242 -234
- package/dist/esm/utils/env.js +11 -12
- package/dist/esm/utils/generateWatchFiles.js +205 -190
- package/dist/esm/utils/getSelectedEntries.js +180 -173
- package/dist/esm/utils/getServerInternalPlugins.js +197 -191
- package/dist/esm/utils/printInstructions.js +147 -141
- package/dist/esm/utils/restart.js +179 -173
- package/dist/esm/utils/routes.js +146 -139
- package/dist/esm/utils/types.js +1 -1
- package/dist/esm-node/analyze/constants.js +31 -46
- package/dist/esm-node/analyze/generateCode.js +28 -94
- package/dist/esm-node/analyze/getBundleEntry.js +8 -27
- package/dist/esm-node/analyze/getClientRoutes/getRoutes.js +24 -65
- package/dist/esm-node/analyze/getClientRoutes/getRoutesLegacy.js +24 -63
- package/dist/esm-node/analyze/getClientRoutes/index.js +2 -6
- package/dist/esm-node/analyze/getClientRoutes/utils.js +5 -19
- package/dist/esm-node/analyze/getFileSystemEntry.js +10 -37
- package/dist/esm-node/analyze/getHtmlTemplate.js +29 -59
- package/dist/esm-node/analyze/getServerRoutes.js +43 -75
- package/dist/esm-node/analyze/index.js +208 -230
- package/dist/esm-node/analyze/isDefaultExportFunction.js +7 -5
- package/dist/esm-node/analyze/makeLegalIdentifier.js +1 -4
- package/dist/esm-node/analyze/nestedRoutes.js +23 -43
- package/dist/esm-node/analyze/templates.js +22 -69
- package/dist/esm-node/analyze/utils.js +66 -60
- package/dist/esm-node/builder/builder-rspack/adapterCopy.js +40 -62
- package/dist/esm-node/builder/builder-rspack/index.js +4 -5
- package/dist/esm-node/builder/builder-webpack/adapterModern.js +24 -26
- package/dist/esm-node/builder/builder-webpack/createCopyPattern.js +3 -10
- package/dist/esm-node/builder/builder-webpack/index.js +13 -11
- package/dist/esm-node/builder/generator/createBuilderOptions.js +4 -5
- package/dist/esm-node/builder/generator/createBuilderProviderConfig.js +5 -6
- package/dist/esm-node/builder/generator/getBuilderTargets.js +5 -11
- package/dist/esm-node/builder/generator/index.js +7 -16
- package/dist/esm-node/builder/index.js +2 -7
- package/dist/esm-node/builder/shared/builderPlugins/adapterBasic.js +2 -6
- package/dist/esm-node/builder/shared/builderPlugins/adapterHtml.js +34 -60
- package/dist/esm-node/builder/shared/builderPlugins/adapterSSR.js +54 -74
- package/dist/esm-node/builder/shared/bundlerPlugins/HtmlAsyncChunkPlugin.js +23 -8
- package/dist/esm-node/builder/shared/bundlerPlugins/HtmlBottomTemplate.js +25 -16
- package/dist/esm-node/builder/shared/bundlerPlugins/RouterPlugin.js +66 -76
- package/dist/esm-node/builder/shared/createCopyInfo.js +2 -8
- package/dist/esm-node/builder/shared/loaders/serverModuleLoader.js +1 -4
- package/dist/esm-node/builder/shared/types.js +1 -0
- package/dist/esm-node/commands/build.js +7 -9
- package/dist/esm-node/commands/deploy.js +1 -4
- package/dist/esm-node/commands/dev.js +19 -27
- package/dist/esm-node/commands/inspect.js +3 -8
- package/dist/esm-node/commands/serve.js +7 -25
- package/dist/esm-node/config/default.js +20 -11
- package/dist/esm-node/config/initialize/index.js +1 -4
- package/dist/esm-node/config/initialize/inits.js +48 -54
- package/dist/esm-node/config/legacy/createHtmlConfig.js +2 -19
- package/dist/esm-node/config/legacy/createOutputConfig.js +2 -30
- package/dist/esm-node/config/legacy/createSourceConfig.js +2 -17
- package/dist/esm-node/config/legacy/createToolsConfig.js +2 -22
- package/dist/esm-node/config/legacy/index.js +3 -18
- package/dist/esm-node/defineConfig.js +7 -13
- package/dist/esm-node/exports/server.js +1 -4
- package/dist/esm-node/hooks.js +2 -9
- package/dist/esm-node/index.js +95 -120
- package/dist/esm-node/initialize/index.js +74 -87
- package/dist/esm-node/locale/en.js +7 -6
- package/dist/esm-node/locale/index.js +5 -5
- package/dist/esm-node/locale/zh.js +7 -6
- package/dist/esm-node/schema/Schema.js +19 -8
- package/dist/esm-node/schema/index.js +121 -36
- package/dist/esm-node/schema/legacy.js +262 -72
- package/dist/esm-node/types/config/deploy.js +1 -0
- package/dist/esm-node/types/config/dev.js +1 -0
- package/dist/esm-node/types/config/experiments.js +1 -0
- package/dist/esm-node/types/config/html.js +1 -0
- package/dist/esm-node/types/config/output.js +1 -0
- package/dist/esm-node/types/config/performance.js +1 -0
- package/dist/esm-node/types/config/security.js +1 -0
- package/dist/esm-node/types/config/source.js +1 -0
- package/dist/esm-node/types/config/tools.js +1 -0
- package/dist/esm-node/types/hooks.js +1 -0
- package/dist/esm-node/types/legacyConfig/deploy.js +1 -0
- package/dist/esm-node/types/legacyConfig/dev.js +1 -0
- package/dist/esm-node/types/legacyConfig/index.js +1 -0
- package/dist/esm-node/types/legacyConfig/output.js +1 -0
- package/dist/esm-node/types/legacyConfig/source.js +1 -0
- package/dist/esm-node/types/legacyConfig/tools.js +1 -0
- package/dist/esm-node/types/utils.js +1 -0
- package/dist/esm-node/utils/config.js +16 -47
- package/dist/esm-node/utils/createServer.js +5 -12
- package/dist/esm-node/utils/env.js +1 -4
- package/dist/esm-node/utils/generateWatchFiles.js +13 -20
- package/dist/esm-node/utils/getSelectedEntries.js +2 -9
- package/dist/esm-node/utils/getServerInternalPlugins.js +2 -8
- package/dist/esm-node/utils/printInstructions.js +1 -4
- package/dist/esm-node/utils/restart.js +2 -11
- package/dist/esm-node/utils/routes.js +4 -4
- package/dist/esm-node/utils/types.js +1 -0
- package/dist/types/index.d.ts +2 -2
- package/lib/types.d.ts +1 -0
- package/package.json +29 -25
|
@@ -1,204 +1,212 @@
|
|
|
1
|
-
function
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
function _array_like_to_array(arr, len) {
|
|
2
|
+
if (len == null || len > arr.length)
|
|
3
|
+
len = arr.length;
|
|
4
|
+
for (var i = 0, arr2 = new Array(len); i < len; i++)
|
|
5
|
+
arr2[i] = arr[i];
|
|
6
|
+
return arr2;
|
|
5
7
|
}
|
|
6
|
-
function
|
|
7
|
-
|
|
8
|
+
function _array_without_holes(arr) {
|
|
9
|
+
if (Array.isArray(arr))
|
|
10
|
+
return _array_like_to_array(arr);
|
|
8
11
|
}
|
|
9
|
-
function
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
12
|
+
function _define_property(obj, key, value) {
|
|
13
|
+
if (key in obj) {
|
|
14
|
+
Object.defineProperty(obj, key, {
|
|
15
|
+
value,
|
|
16
|
+
enumerable: true,
|
|
17
|
+
configurable: true,
|
|
18
|
+
writable: true
|
|
19
|
+
});
|
|
20
|
+
} else {
|
|
21
|
+
obj[key] = value;
|
|
22
|
+
}
|
|
23
|
+
return obj;
|
|
21
24
|
}
|
|
22
|
-
function
|
|
23
|
-
|
|
25
|
+
function _iterable_to_array(iter) {
|
|
26
|
+
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null)
|
|
27
|
+
return Array.from(iter);
|
|
24
28
|
}
|
|
25
|
-
function
|
|
26
|
-
|
|
29
|
+
function _non_iterable_spread() {
|
|
30
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
27
31
|
}
|
|
28
|
-
function
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}
|
|
37
|
-
ownKeys.forEach(function(key) {
|
|
38
|
-
_defineProperty(target, key, source[key]);
|
|
39
|
-
});
|
|
32
|
+
function _object_spread(target) {
|
|
33
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
34
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
35
|
+
var ownKeys2 = Object.keys(source);
|
|
36
|
+
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
37
|
+
ownKeys2 = ownKeys2.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
38
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
39
|
+
}));
|
|
40
40
|
}
|
|
41
|
-
|
|
41
|
+
ownKeys2.forEach(function(key) {
|
|
42
|
+
_define_property(target, key, source[key]);
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
return target;
|
|
42
46
|
}
|
|
43
47
|
function ownKeys(object, enumerableOnly) {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
}
|
|
52
|
-
keys.push.apply(keys, symbols);
|
|
48
|
+
var keys = Object.keys(object);
|
|
49
|
+
if (Object.getOwnPropertySymbols) {
|
|
50
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
51
|
+
if (enumerableOnly) {
|
|
52
|
+
symbols = symbols.filter(function(sym) {
|
|
53
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
54
|
+
});
|
|
53
55
|
}
|
|
54
|
-
|
|
56
|
+
keys.push.apply(keys, symbols);
|
|
57
|
+
}
|
|
58
|
+
return keys;
|
|
55
59
|
}
|
|
56
|
-
function
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
60
|
+
function _object_spread_props(target, source) {
|
|
61
|
+
source = source != null ? source : {};
|
|
62
|
+
if (Object.getOwnPropertyDescriptors) {
|
|
63
|
+
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
64
|
+
} else {
|
|
65
|
+
ownKeys(Object(source)).forEach(function(key) {
|
|
66
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
return target;
|
|
66
70
|
}
|
|
67
|
-
function
|
|
68
|
-
|
|
71
|
+
function _to_consumable_array(arr) {
|
|
72
|
+
return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
|
|
69
73
|
}
|
|
70
|
-
function
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
74
|
+
function _unsupported_iterable_to_array(o, minLen) {
|
|
75
|
+
if (!o)
|
|
76
|
+
return;
|
|
77
|
+
if (typeof o === "string")
|
|
78
|
+
return _array_like_to_array(o, minLen);
|
|
79
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
80
|
+
if (n === "Object" && o.constructor)
|
|
81
|
+
n = o.constructor.name;
|
|
82
|
+
if (n === "Map" || n === "Set")
|
|
83
|
+
return Array.from(n);
|
|
84
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))
|
|
85
|
+
return _array_like_to_array(o, minLen);
|
|
77
86
|
}
|
|
78
87
|
import path, { dirname, isAbsolute, posix, sep } from "path";
|
|
79
88
|
import { applyOptionsChain, findExists, findMonorepoRoot, globby, isModernjsMonorepo } from "@modern-js/utils";
|
|
80
|
-
function initHtmlConfig(config, appContext) {
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
89
|
+
export function initHtmlConfig(config, appContext) {
|
|
90
|
+
var createBuilderAppIcon = function createBuilderAppIcon2(config2, appContext2) {
|
|
91
|
+
var configDir = config2.source.configDir;
|
|
92
|
+
var appIcon = findExists(ICON_EXTENSIONS.map(function(ext) {
|
|
93
|
+
return path.resolve(appContext2.appDirectory, configDir || "./config", "icon.".concat(ext));
|
|
94
|
+
}));
|
|
95
|
+
return typeof appIcon === "string" ? appIcon : void 0;
|
|
96
|
+
};
|
|
97
|
+
var createBuilderFavicon = function createBuilderFavicon2(config2, appContext2) {
|
|
98
|
+
var configDir = config2.source.configDir;
|
|
99
|
+
var favicon = config2.html.favicon;
|
|
100
|
+
var defaultFavicon = findExists(ICON_EXTENSIONS.map(function(ext) {
|
|
101
|
+
return path.resolve(appContext2.appDirectory, configDir || "./config", "favicon.".concat(ext));
|
|
102
|
+
}));
|
|
103
|
+
return favicon || defaultFavicon || void 0;
|
|
104
|
+
};
|
|
105
|
+
var ICON_EXTENSIONS = [
|
|
106
|
+
"png",
|
|
107
|
+
"jpg",
|
|
108
|
+
"jpeg",
|
|
109
|
+
"svg",
|
|
110
|
+
"ico"
|
|
111
|
+
];
|
|
112
|
+
config.html.appIcon = createBuilderAppIcon(config, appContext);
|
|
113
|
+
config.html.favicon = createBuilderFavicon(config, appContext);
|
|
114
|
+
return config.html;
|
|
106
115
|
}
|
|
107
|
-
function initSourceConfig(config, appContext, bundler) {
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
}
|
|
118
|
-
return new RegExp(include2);
|
|
119
|
-
}
|
|
120
|
-
return include2;
|
|
121
|
-
}).concat(defaultInclude);
|
|
122
|
-
var root = findMonorepoRoot(appContext2.appDirectory);
|
|
123
|
-
if (!root) {
|
|
124
|
-
return transformInclude;
|
|
125
|
-
}
|
|
126
|
-
var modernjsMonorepo = isModernjsMonorepo(root);
|
|
127
|
-
if (modernjsMonorepo) {
|
|
128
|
-
var paths = globby.sync(posix.join(root, "features", "**", "package.json"), {
|
|
129
|
-
ignore: [
|
|
130
|
-
"**/node_modules/**/*"
|
|
131
|
-
]
|
|
132
|
-
}).map(function(pathname) {
|
|
133
|
-
return dirname(pathname) + sep;
|
|
134
|
-
});
|
|
135
|
-
return _toConsumableArray(paths).concat(_toConsumableArray(transformInclude));
|
|
116
|
+
export function initSourceConfig(config, appContext, bundler) {
|
|
117
|
+
var createBuilderInclude = function createBuilderInclude2(config2, appContext2) {
|
|
118
|
+
var include = config2.source.include;
|
|
119
|
+
var defaultInclude = [
|
|
120
|
+
appContext2.internalDirectory
|
|
121
|
+
];
|
|
122
|
+
var transformInclude = (include || []).map(function(include2) {
|
|
123
|
+
if (typeof include2 === "string") {
|
|
124
|
+
if (isAbsolute(include2)) {
|
|
125
|
+
return include2;
|
|
136
126
|
}
|
|
137
|
-
return
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
127
|
+
return new RegExp(include2);
|
|
128
|
+
}
|
|
129
|
+
return include2;
|
|
130
|
+
}).concat(defaultInclude);
|
|
131
|
+
var root = findMonorepoRoot(appContext2.appDirectory);
|
|
132
|
+
if (!root) {
|
|
133
|
+
return transformInclude;
|
|
134
|
+
}
|
|
135
|
+
var modernjsMonorepo = isModernjsMonorepo(root);
|
|
136
|
+
if (modernjsMonorepo) {
|
|
137
|
+
var paths = globby.sync(posix.join(root, "features", "**", "package.json"), {
|
|
138
|
+
ignore: [
|
|
139
|
+
"**/node_modules/**/*"
|
|
140
|
+
]
|
|
141
|
+
}).map(function(pathname) {
|
|
142
|
+
return dirname(pathname) + sep;
|
|
143
|
+
});
|
|
144
|
+
return _to_consumable_array(paths).concat(_to_consumable_array(transformInclude));
|
|
145
|
+
}
|
|
146
|
+
return transformInclude;
|
|
147
|
+
};
|
|
148
|
+
var createBuilderModuleScope = function createBuilderModuleScope2(config2) {
|
|
149
|
+
var moduleScopes = config2.source.moduleScopes;
|
|
150
|
+
if (moduleScopes) {
|
|
151
|
+
var builderModuleScope = [];
|
|
152
|
+
var DEFAULT_SCOPES = [
|
|
153
|
+
"./src",
|
|
154
|
+
"./shared",
|
|
155
|
+
/node_modules/
|
|
156
|
+
];
|
|
157
|
+
if (Array.isArray(moduleScopes)) {
|
|
158
|
+
if (isPrimitiveScope(moduleScopes)) {
|
|
159
|
+
builderModuleScope = DEFAULT_SCOPES.concat(moduleScopes);
|
|
163
160
|
} else {
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
return items.every(function(item) {
|
|
168
|
-
return typeof item === "string" || Object.prototype.toString.call(item) === "[object RegExp]";
|
|
169
|
-
});
|
|
161
|
+
builderModuleScope = [
|
|
162
|
+
DEFAULT_SCOPES
|
|
163
|
+
].concat(_to_consumable_array(moduleScopes));
|
|
170
164
|
}
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
165
|
+
} else {
|
|
166
|
+
builderModuleScope = [
|
|
167
|
+
DEFAULT_SCOPES,
|
|
168
|
+
moduleScopes
|
|
169
|
+
];
|
|
170
|
+
}
|
|
171
|
+
return builderModuleScope;
|
|
172
|
+
} else {
|
|
173
|
+
return void 0;
|
|
174
|
+
}
|
|
175
|
+
function isPrimitiveScope(items) {
|
|
176
|
+
return items.every(function(item) {
|
|
177
|
+
return typeof item === "string" || Object.prototype.toString.call(item) === "[object RegExp]";
|
|
178
|
+
});
|
|
175
179
|
}
|
|
180
|
+
};
|
|
181
|
+
config.source.include = createBuilderInclude(config, appContext);
|
|
182
|
+
if (bundler === "webpack") {
|
|
183
|
+
config.source.moduleScopes = createBuilderModuleScope(config);
|
|
184
|
+
}
|
|
176
185
|
}
|
|
177
|
-
function initToolsConfig(config) {
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
}
|
|
184
|
-
],
|
|
185
|
-
exclude: [
|
|
186
|
-
{
|
|
187
|
-
file: "**/*.(spec|test).ts"
|
|
188
|
-
},
|
|
189
|
-
{
|
|
190
|
-
file: "**/node_modules/**/*"
|
|
191
|
-
}
|
|
192
|
-
]
|
|
186
|
+
export function initToolsConfig(config) {
|
|
187
|
+
var defaultTsChecker = {
|
|
188
|
+
issue: {
|
|
189
|
+
include: [
|
|
190
|
+
{
|
|
191
|
+
file: "**/src/**/*"
|
|
193
192
|
}
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
}
|
|
202
|
-
|
|
193
|
+
],
|
|
194
|
+
exclude: [
|
|
195
|
+
{
|
|
196
|
+
file: "**/*.(spec|test).ts"
|
|
197
|
+
},
|
|
198
|
+
{
|
|
199
|
+
file: "**/node_modules/**/*"
|
|
200
|
+
}
|
|
201
|
+
]
|
|
202
|
+
}
|
|
203
|
+
};
|
|
204
|
+
var _config_tools = config.tools, tsChecker = _config_tools.tsChecker, tsLoader = _config_tools.tsLoader;
|
|
205
|
+
config.tools.tsChecker = applyOptionsChain(defaultTsChecker, tsChecker);
|
|
206
|
+
tsLoader && (config.tools.tsLoader = function(tsLoaderConfig, utils) {
|
|
207
|
+
applyOptionsChain(_object_spread_props(_object_spread({}, tsLoaderConfig), {
|
|
208
|
+
transpileOnly: false,
|
|
209
|
+
allowTsInNodeModules: true
|
|
210
|
+
}), tsLoader || {}, utils);
|
|
211
|
+
});
|
|
203
212
|
}
|
|
204
|
-
export { initHtmlConfig, initSourceConfig, initToolsConfig };
|
|
@@ -1,19 +1,18 @@
|
|
|
1
|
-
function createHtmlConfig(config) {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
1
|
+
export function createHtmlConfig(config) {
|
|
2
|
+
var _config_output = config.output, disableHtmlFolder = _config_output.disableHtmlFolder, favicon = _config_output.favicon, faviconByEntries = _config_output.faviconByEntries, inject = _config_output.inject, injectByEntries = _config_output.injectByEntries, meta = _config_output.meta, metaByEntries = _config_output.metaByEntries, mountId = _config_output.mountId, title = _config_output.title, titleByEntries = _config_output.titleByEntries, templateParameters = _config_output.templateParameters, templateParametersByEntries = _config_output.templateParametersByEntries, crossorigin = _config_output.crossorigin;
|
|
3
|
+
return {
|
|
4
|
+
disableHtmlFolder,
|
|
5
|
+
favicon,
|
|
6
|
+
faviconByEntries,
|
|
7
|
+
inject,
|
|
8
|
+
injectByEntries,
|
|
9
|
+
meta,
|
|
10
|
+
metaByEntries,
|
|
11
|
+
mountId,
|
|
12
|
+
title,
|
|
13
|
+
titleByEntries,
|
|
14
|
+
crossorigin,
|
|
15
|
+
templateParameters,
|
|
16
|
+
templateParametersByEntries
|
|
17
|
+
};
|
|
18
18
|
}
|
|
19
|
-
export { createHtmlConfig };
|
|
@@ -1,43 +1,42 @@
|
|
|
1
|
-
function createOutputConfig(config) {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
1
|
+
export function createOutputConfig(config) {
|
|
2
|
+
var _config_output = config.output, assetPrefix = _config_output.assetPrefix, copy = _config_output.copy, cssModuleLocalIdentName = _config_output.cssModuleLocalIdentName, cssPath = _config_output.cssPath, jsPath = _config_output.jsPath, htmlPath = _config_output.htmlPath, mediaPath = _config_output.mediaPath, enableTsLoader = _config_output.enableTsLoader, path = _config_output.path, disableInlineRuntimeChunk = _config_output.disableInlineRuntimeChunk, disableCssExtract = _config_output.disableCssExtract, disableMinimize = _config_output.disableMinimize, disableSourceMap = _config_output.disableSourceMap, disableTsChecker = _config_output.disableTsChecker, enableCssModuleTSDeclaration = _config_output.enableCssModuleTSDeclaration, enableInlineScripts = _config_output.enableInlineScripts, enableInlineStyles = _config_output.enableInlineStyles, polyfill = _config_output.polyfill, dataUriLimit = _config_output.dataUriLimit, disableAssetsCache = _config_output.disableAssetsCache, enableLatestDecorators = _config_output.enableLatestDecorators, disableCssModuleExtension = _config_output.disableCssModuleExtension, ssg = _config_output.ssg, disableNodePolyfill = _config_output.disableNodePolyfill;
|
|
3
|
+
return {
|
|
4
|
+
assetPrefix,
|
|
5
|
+
copy,
|
|
6
|
+
distPath: {
|
|
7
|
+
root: path,
|
|
8
|
+
css: cssPath,
|
|
9
|
+
js: jsPath,
|
|
10
|
+
html: htmlPath,
|
|
11
|
+
// modern.js v1 output all media files to `dist/media` by default
|
|
12
|
+
svg: mediaPath || "media",
|
|
13
|
+
image: mediaPath || "media",
|
|
14
|
+
font: mediaPath || "media",
|
|
15
|
+
media: mediaPath || "media"
|
|
16
|
+
},
|
|
17
|
+
dataUriLimit: {
|
|
18
|
+
svg: dataUriLimit,
|
|
19
|
+
image: dataUriLimit,
|
|
20
|
+
font: dataUriLimit,
|
|
21
|
+
media: dataUriLimit
|
|
22
|
+
},
|
|
23
|
+
cssModuleLocalIdentName,
|
|
24
|
+
disableCssExtract,
|
|
25
|
+
disableCssModuleExtension,
|
|
26
|
+
disableInlineRuntimeChunk,
|
|
27
|
+
disableMinimize,
|
|
28
|
+
disableSourceMap,
|
|
29
|
+
disableTsChecker: disableTsChecker || enableTsLoader,
|
|
30
|
+
enableCssModuleTSDeclaration,
|
|
31
|
+
enableInlineScripts,
|
|
32
|
+
enableInlineStyles,
|
|
33
|
+
polyfill,
|
|
34
|
+
disableFilenameHash: disableAssetsCache,
|
|
35
|
+
enableLatestDecorators,
|
|
36
|
+
ssg,
|
|
37
|
+
// set `true`, only in legacy config
|
|
38
|
+
enableAssetFallback: true,
|
|
39
|
+
enableAssetManifest: true,
|
|
40
|
+
disableNodePolyfill
|
|
41
|
+
};
|
|
42
42
|
}
|
|
43
|
-
export { createOutputConfig };
|
|
@@ -1,42 +1,41 @@
|
|
|
1
|
-
function createSourceConfig(config) {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
export function createSourceConfig(config) {
|
|
2
|
+
var _config_source = config.source, alias = _config_source.alias, envVars = _config_source.envVars, globalVars = _config_source.globalVars, include = _config_source.include, moduleScopes = _config_source.moduleScopes, preEntry = _config_source.preEntry, entries = _config_source.entries, enableAsyncEntry = _config_source.enableAsyncEntry, disableDefaultEntries = _config_source.disableDefaultEntries, entriesDir = _config_source.entriesDir, configDir = _config_source.configDir;
|
|
3
|
+
var builderGlobalVars = globalVars || {};
|
|
4
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
|
|
5
|
+
try {
|
|
6
|
+
for (var _iterator = (envVars || [])[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
|
7
|
+
var envVar = _step.value;
|
|
8
|
+
var envVarValue = process.env[envVar];
|
|
9
|
+
envVarValue && (builderGlobalVars["process.env.".concat(envVar)] = envVarValue);
|
|
10
|
+
}
|
|
11
|
+
} catch (err) {
|
|
12
|
+
_didIteratorError = true;
|
|
13
|
+
_iteratorError = err;
|
|
14
|
+
} finally {
|
|
5
15
|
try {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
16
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
17
|
+
_iterator.return();
|
|
18
|
+
}
|
|
19
|
+
} finally {
|
|
20
|
+
if (_didIteratorError) {
|
|
21
|
+
throw _iteratorError;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
return {
|
|
26
|
+
alias,
|
|
27
|
+
moduleScopes,
|
|
28
|
+
globalVars: builderGlobalVars,
|
|
29
|
+
include,
|
|
30
|
+
preEntry,
|
|
31
|
+
entries,
|
|
32
|
+
enableAsyncEntry,
|
|
33
|
+
disableDefaultEntries,
|
|
34
|
+
entriesDir,
|
|
35
|
+
configDir,
|
|
36
|
+
resolveExtensionPrefix: {
|
|
37
|
+
web: ".web",
|
|
38
|
+
node: ".node"
|
|
24
39
|
}
|
|
25
|
-
|
|
26
|
-
alias: alias,
|
|
27
|
-
moduleScopes: moduleScopes,
|
|
28
|
-
globalVars: builderGlobalVars,
|
|
29
|
-
include: include,
|
|
30
|
-
preEntry: preEntry,
|
|
31
|
-
entries: entries,
|
|
32
|
-
enableAsyncEntry: enableAsyncEntry,
|
|
33
|
-
disableDefaultEntries: disableDefaultEntries,
|
|
34
|
-
entriesDir: entriesDir,
|
|
35
|
-
configDir: configDir,
|
|
36
|
-
resolveExtensionPrefix: {
|
|
37
|
-
web: ".web",
|
|
38
|
-
node: ".node"
|
|
39
|
-
}
|
|
40
|
-
};
|
|
40
|
+
};
|
|
41
41
|
}
|
|
42
|
-
export { createSourceConfig };
|