@modern-js/app-tools 2.3.1-alpha.2 → 3.0.0-beta.0
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +87 -0
- package/README.md +14 -18
- package/dist/js/modern/analyze/getServerRoutes.js +5 -2
- package/dist/js/modern/analyze/index.js +47 -46
- package/dist/js/modern/builder/builder-rspack/index.js +8 -0
- package/dist/js/modern/builder/builder-webpack/builderPlugins/compatModern.js +41 -0
- package/dist/js/modern/builder/builder-webpack/index.js +93 -0
- package/dist/js/modern/builder/{webpackPlugins/routerPlugin.js → builder-webpack/webpackPlugins/RouterPlugin.js} +4 -1
- package/dist/js/modern/builder/builder-webpack/webpackPlugins/index.js +1 -0
- package/dist/js/modern/builder/generator/createBuilderOptions.js +24 -0
- package/dist/js/modern/builder/generator/createBuilderProviderConfig.js +39 -0
- package/dist/js/modern/builder/generator/getBuilderTargets.js +21 -0
- package/dist/js/modern/builder/generator/index.js +53 -0
- package/dist/js/modern/builder/index.js +13 -133
- package/dist/js/modern/builder/{builderPlugins/compatModern.js → shared/builderPlugins/adapterModern.js} +102 -116
- package/dist/js/modern/builder/shared/bundlerPlugins/HtmlAsyncChunkPlugin.js +27 -0
- package/dist/js/modern/builder/shared/bundlerPlugins/HtmlBottomTemplate.js +34 -0
- package/dist/js/modern/builder/{share.js → shared/createCopyPattern.js} +0 -0
- package/dist/js/modern/builder/shared/index.js +3 -0
- package/dist/js/modern/builder/{loaders → shared/loaders}/serverModuleLoader.js +0 -0
- package/dist/js/modern/builder/shared/types.js +0 -0
- package/dist/js/modern/config/default.js +2 -2
- package/dist/js/modern/config/index.js +3 -8
- package/dist/js/modern/config/initialize/index.js +12 -0
- package/dist/js/modern/config/{initial → initialize}/inits.js +4 -2
- package/dist/js/modern/config/{initial → legacy}/createHtmlConfig.js +0 -0
- package/dist/js/modern/config/{initial → legacy}/createOutputConfig.js +0 -0
- package/dist/js/modern/config/{initial → legacy}/createSourceConfig.js +0 -0
- package/dist/js/modern/config/{initial → legacy}/createToolsConfig.js +0 -0
- package/dist/js/modern/config/{initial/transformNormalizedConfig.js → legacy/index.js} +4 -0
- package/dist/js/modern/index.js +18 -8
- package/dist/js/modern/initialize/index.js +36 -28
- package/dist/js/modern/locale/zh.js +1 -1
- package/dist/js/modern/types/utils.js +0 -0
- package/dist/js/node/analyze/getServerRoutes.js +3 -1
- package/dist/js/node/analyze/index.js +48 -47
- package/dist/js/node/builder/builder-rspack/index.js +31 -0
- package/dist/js/node/builder/builder-webpack/builderPlugins/compatModern.js +64 -0
- package/dist/js/node/builder/builder-webpack/index.js +118 -0
- package/dist/js/node/builder/{webpackPlugins/routerPlugin.js → builder-webpack/webpackPlugins/RouterPlugin.js} +10 -5
- package/dist/js/node/builder/builder-webpack/webpackPlugins/index.js +17 -0
- package/dist/js/node/builder/generator/createBuilderOptions.js +47 -0
- package/dist/js/node/builder/generator/createBuilderProviderConfig.js +60 -0
- package/dist/js/node/builder/generator/getBuilderTargets.js +39 -0
- package/dist/js/node/builder/generator/index.js +82 -0
- package/dist/js/node/builder/index.js +14 -123
- package/dist/js/node/builder/{builderPlugins/compatModern.js → shared/builderPlugins/adapterModern.js} +107 -120
- package/dist/js/node/builder/{webpackPlugins/htmlAsyncChunkPlugin.js → shared/bundlerPlugins/HtmlAsyncChunkPlugin.js} +17 -20
- package/dist/js/node/builder/{webpackPlugins/htmlBottomTemplate.js → shared/bundlerPlugins/HtmlBottomTemplate.js} +21 -24
- package/dist/js/node/builder/{share.js → shared/createCopyPattern.js} +3 -3
- package/dist/js/node/builder/shared/index.js +19 -0
- package/dist/js/node/builder/{loaders → shared/loaders}/serverModuleLoader.js +0 -0
- package/dist/js/node/builder/shared/types.js +15 -0
- package/dist/js/node/config/default.js +2 -2
- package/dist/js/node/config/index.js +4 -19
- package/dist/js/node/config/{initial → initialize}/index.js +10 -16
- package/dist/js/node/config/{initial → initialize}/inits.js +4 -2
- package/dist/js/node/config/{initial → legacy}/createHtmlConfig.js +0 -0
- package/dist/js/node/config/{initial → legacy}/createOutputConfig.js +0 -0
- package/dist/js/node/config/{initial → legacy}/createSourceConfig.js +0 -0
- package/dist/js/node/config/{initial → legacy}/createToolsConfig.js +0 -0
- package/dist/js/node/config/{initial/transformNormalizedConfig.js → legacy/index.js} +8 -3
- package/dist/js/node/index.js +18 -8
- package/dist/js/node/initialize/index.js +35 -28
- package/dist/js/node/locale/zh.js +1 -1
- package/dist/js/node/types/utils.js +15 -0
- package/dist/js/treeshaking/analyze/generateCode.js +14 -14
- package/dist/js/treeshaking/analyze/getBundleEntry.js +2 -2
- package/dist/js/treeshaking/analyze/getClientRoutes/getRoutes.js +1 -1
- package/dist/js/treeshaking/analyze/getClientRoutes/getRoutesLegacy.js +1 -1
- package/dist/js/treeshaking/analyze/getFileSystemEntry.js +1 -1
- package/dist/js/treeshaking/analyze/getServerRoutes.js +8 -6
- package/dist/js/treeshaking/analyze/index.js +142 -137
- package/dist/js/treeshaking/analyze/nestedRoutes.js +5 -5
- package/dist/js/treeshaking/analyze/templates.js +6 -6
- package/dist/js/treeshaking/analyze/utils.js +3 -3
- package/dist/js/treeshaking/builder/builder-rspack/index.js +6 -0
- package/dist/js/treeshaking/builder/builder-webpack/builderPlugins/compatModern.js +64 -0
- package/dist/js/treeshaking/builder/builder-webpack/index.js +301 -0
- package/dist/js/treeshaking/builder/{webpackPlugins/routerPlugin.js → builder-webpack/webpackPlugins/RouterPlugin.js} +6 -3
- package/dist/js/treeshaking/builder/builder-webpack/webpackPlugins/index.js +1 -0
- package/dist/js/treeshaking/builder/generator/createBuilderOptions.js +41 -0
- package/dist/js/treeshaking/builder/generator/createBuilderProviderConfig.js +70 -0
- package/dist/js/treeshaking/builder/generator/getBuilderTargets.js +16 -0
- package/dist/js/treeshaking/builder/generator/index.js +199 -0
- package/dist/js/treeshaking/builder/index.js +29 -228
- package/dist/js/treeshaking/builder/{builderPlugins/compatModern.js → shared/builderPlugins/adapterModern.js} +138 -142
- package/dist/js/treeshaking/builder/{webpackPlugins/htmlAsyncChunkPlugin.js → shared/bundlerPlugins/HtmlAsyncChunkPlugin.js} +0 -0
- package/dist/js/treeshaking/builder/{webpackPlugins/htmlBottomTemplate.js → shared/bundlerPlugins/HtmlBottomTemplate.js} +2 -2
- package/dist/js/treeshaking/builder/{share.js → shared/createCopyPattern.js} +0 -0
- package/dist/js/treeshaking/builder/shared/index.js +3 -0
- package/dist/js/treeshaking/builder/{loaders → shared/loaders}/serverModuleLoader.js +0 -0
- package/dist/js/treeshaking/builder/shared/types.js +1 -0
- package/dist/js/treeshaking/commands/dev.js +2 -2
- package/dist/js/treeshaking/commands/serve.js +2 -2
- package/dist/js/treeshaking/config/default.js +2 -2
- package/dist/js/treeshaking/config/index.js +3 -3
- package/dist/js/treeshaking/config/initialize/index.js +10 -0
- package/dist/js/treeshaking/config/{initial → initialize}/inits.js +6 -4
- package/dist/js/treeshaking/config/legacy/createHtmlConfig.js +19 -0
- package/dist/js/treeshaking/config/{initial → legacy}/createOutputConfig.js +1 -1
- package/dist/js/treeshaking/config/{initial → legacy}/createSourceConfig.js +1 -1
- package/dist/js/treeshaking/config/{initial → legacy}/createToolsConfig.js +1 -1
- package/dist/js/treeshaking/config/{initial/transformNormalizedConfig.js → legacy/index.js} +4 -1
- package/dist/js/treeshaking/index.js +19 -12
- package/dist/js/treeshaking/initialize/index.js +36 -28
- package/dist/js/treeshaking/locale/zh.js +1 -1
- package/dist/js/treeshaking/types/utils.js +1 -0
- package/dist/js/treeshaking/utils/config.js +2 -2
- package/dist/js/treeshaking/utils/getServerInternalPlugins.js +2 -2
- package/dist/types/analyze/generateCode.d.ts +1 -1
- package/dist/types/analyze/getBundleEntry.d.ts +1 -1
- package/dist/types/analyze/getFileSystemEntry.d.ts +1 -1
- package/dist/types/analyze/getHtmlTemplate.d.ts +2 -2
- package/dist/types/analyze/getServerRoutes.d.ts +1 -1
- package/dist/types/analyze/index.d.ts +5 -1
- package/dist/types/builder/builder-rspack/index.d.ts +2 -0
- package/dist/types/builder/{builderPlugins → builder-webpack/builderPlugins}/compatModern.d.ts +2 -2
- package/dist/types/builder/builder-webpack/index.d.ts +4 -0
- package/dist/types/builder/{webpackPlugins/routerPlugin.d.ts → builder-webpack/webpackPlugins/RouterPlugin.d.ts} +1 -1
- package/dist/types/builder/builder-webpack/webpackPlugins/index.d.ts +1 -0
- package/dist/types/builder/generator/createBuilderOptions.d.ts +3 -0
- package/dist/types/builder/generator/createBuilderProviderConfig.d.ts +2 -0
- package/dist/types/builder/generator/getBuilderTargets.d.ts +3 -0
- package/dist/types/builder/generator/index.d.ts +17 -0
- package/dist/types/builder/index.d.ts +1 -18
- package/dist/types/builder/shared/builderPlugins/adapterModern.d.ts +13 -0
- package/dist/types/builder/{webpackPlugins/htmlAsyncChunkPlugin.d.ts → shared/bundlerPlugins/HtmlAsyncChunkPlugin.d.ts} +2 -1
- package/dist/types/builder/{webpackPlugins/htmlBottomTemplate.d.ts → shared/bundlerPlugins/HtmlBottomTemplate.d.ts} +2 -1
- package/dist/types/builder/{share.d.ts → shared/createCopyPattern.d.ts} +1 -1
- package/dist/types/builder/shared/index.d.ts +3 -0
- package/dist/types/builder/shared/loaders/serverModuleLoader.d.ts +4 -0
- package/dist/types/builder/shared/types.d.ts +16 -0
- package/dist/types/commands/build.d.ts +1 -1
- package/dist/types/commands/deploy.d.ts +1 -1
- package/dist/types/commands/dev.d.ts +1 -1
- package/dist/types/commands/inspect.d.ts +1 -1
- package/dist/types/commands/serve.d.ts +1 -1
- package/dist/types/config/default.d.ts +1 -1
- package/dist/types/config/index.d.ts +3 -2
- package/dist/types/config/initialize/index.d.ts +2 -0
- package/dist/types/config/{initial → initialize}/inits.d.ts +3 -3
- package/dist/types/config/{initial → legacy}/createHtmlConfig.d.ts +1 -1
- package/dist/types/config/{initial → legacy}/createOutputConfig.d.ts +1 -1
- package/dist/types/config/{initial → legacy}/createSourceConfig.d.ts +1 -1
- package/dist/types/config/{initial → legacy}/createToolsConfig.d.ts +1 -1
- package/dist/types/config/legacy/index.d.ts +3 -0
- package/dist/types/defineConfig.d.ts +2 -2
- package/dist/types/index.d.ts +7 -3
- package/dist/types/initialize/index.d.ts +6 -2
- package/dist/types/types/config/deploy.d.ts +1 -2
- package/dist/types/types/config/dev.d.ts +2 -3
- package/dist/types/types/config/experiments.d.ts +1 -2
- package/dist/types/types/config/html.d.ts +5 -3
- package/dist/types/types/config/index.d.ts +41 -48
- package/dist/types/types/config/output.d.ts +8 -3
- package/dist/types/types/config/performance.d.ts +6 -3
- package/dist/types/types/config/security.d.ts +3 -3
- package/dist/types/types/config/source.d.ts +7 -3
- package/dist/types/types/config/tools.d.ts +10 -4
- package/dist/types/types/hooks.d.ts +6 -4
- package/dist/types/types/index.d.ts +19 -7
- package/dist/types/types/utils.d.ts +7 -0
- package/dist/types/utils/config.d.ts +1 -1
- package/dist/types/utils/getServerInternalPlugins.d.ts +1 -1
- package/dist/types/utils/printInstructions.d.ts +1 -1
- package/package.json +34 -25
- package/dist/js/modern/builder/webpackPlugins/htmlAsyncChunkPlugin.js +0 -30
- package/dist/js/modern/builder/webpackPlugins/htmlBottomTemplate.js +0 -37
- package/dist/js/modern/config/initial/index.js +0 -16
- package/dist/js/treeshaking/config/initial/createHtmlConfig.js +0 -19
- package/dist/js/treeshaking/config/initial/index.js +0 -12
- package/dist/types/builder/loaders/serverModuleLoader.d.ts +0 -3
- package/dist/types/config/initial/index.d.ts +0 -4
- package/dist/types/config/initial/transformNormalizedConfig.d.ts +0 -2
@@ -1,11 +1,3 @@
|
|
1
|
-
function _arrayLikeToArray(arr, len) {
|
2
|
-
if (len == null || len > arr.length) len = arr.length;
|
3
|
-
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
4
|
-
return arr2;
|
5
|
-
}
|
6
|
-
function _arrayWithoutHoles(arr) {
|
7
|
-
if (Array.isArray(arr)) return _arrayLikeToArray(arr);
|
8
|
-
}
|
9
1
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
10
2
|
try {
|
11
3
|
var info = gen[key](arg);
|
@@ -35,75 +27,6 @@ function _asyncToGenerator(fn) {
|
|
35
27
|
});
|
36
28
|
};
|
37
29
|
}
|
38
|
-
function _defineProperty(obj, key, value) {
|
39
|
-
if (key in obj) {
|
40
|
-
Object.defineProperty(obj, key, {
|
41
|
-
value: value,
|
42
|
-
enumerable: true,
|
43
|
-
configurable: true,
|
44
|
-
writable: true
|
45
|
-
});
|
46
|
-
} else {
|
47
|
-
obj[key] = value;
|
48
|
-
}
|
49
|
-
return obj;
|
50
|
-
}
|
51
|
-
function _iterableToArray(iter) {
|
52
|
-
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
53
|
-
}
|
54
|
-
function _nonIterableSpread() {
|
55
|
-
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
56
|
-
}
|
57
|
-
function _objectSpread(target) {
|
58
|
-
for(var i = 1; i < arguments.length; i++){
|
59
|
-
var source = arguments[i] != null ? arguments[i] : {};
|
60
|
-
var ownKeys = Object.keys(source);
|
61
|
-
if (typeof Object.getOwnPropertySymbols === "function") {
|
62
|
-
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
63
|
-
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
64
|
-
}));
|
65
|
-
}
|
66
|
-
ownKeys.forEach(function(key) {
|
67
|
-
_defineProperty(target, key, source[key]);
|
68
|
-
});
|
69
|
-
}
|
70
|
-
return target;
|
71
|
-
}
|
72
|
-
function ownKeys(object, enumerableOnly) {
|
73
|
-
var keys = Object.keys(object);
|
74
|
-
if (Object.getOwnPropertySymbols) {
|
75
|
-
var symbols = Object.getOwnPropertySymbols(object);
|
76
|
-
if (enumerableOnly) {
|
77
|
-
symbols = symbols.filter(function(sym) {
|
78
|
-
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
79
|
-
});
|
80
|
-
}
|
81
|
-
keys.push.apply(keys, symbols);
|
82
|
-
}
|
83
|
-
return keys;
|
84
|
-
}
|
85
|
-
function _objectSpreadProps(target, source) {
|
86
|
-
source = source != null ? source : {};
|
87
|
-
if (Object.getOwnPropertyDescriptors) {
|
88
|
-
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
89
|
-
} else {
|
90
|
-
ownKeys(Object(source)).forEach(function(key) {
|
91
|
-
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
92
|
-
});
|
93
|
-
}
|
94
|
-
return target;
|
95
|
-
}
|
96
|
-
function _toConsumableArray(arr) {
|
97
|
-
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
|
98
|
-
}
|
99
|
-
function _unsupportedIterableToArray(o, minLen) {
|
100
|
-
if (!o) return;
|
101
|
-
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
102
|
-
var n = Object.prototype.toString.call(o).slice(8, -1);
|
103
|
-
if (n === "Object" && o.constructor) n = o.constructor.name;
|
104
|
-
if (n === "Map" || n === "Set") return Array.from(n);
|
105
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
106
|
-
}
|
107
30
|
var __generator = this && this.__generator || function(thisArg, body) {
|
108
31
|
var f, y, t, g, _ = {
|
109
32
|
label: 0,
|
@@ -199,176 +122,54 @@ var __generator = this && this.__generator || function(thisArg, body) {
|
|
199
122
|
};
|
200
123
|
}
|
201
124
|
};
|
202
|
-
|
203
|
-
|
204
|
-
import { applyOptionsChain, isProd, isSSR, isUseSSRBundle } from "@modern-js/utils";
|
205
|
-
import { PluginCompatModern } from "./builderPlugins/compatModern";
|
206
|
-
import { createCopyPattern } from "./share";
|
207
|
-
function getBuilderTargets(normalizedConfig) {
|
208
|
-
var targets = [
|
209
|
-
"web"
|
210
|
-
];
|
211
|
-
var useNodeTarget = isProd() ? isUseSSRBundle(normalizedConfig) : isSSR(normalizedConfig);
|
212
|
-
if (useNodeTarget) {
|
213
|
-
targets.push("node");
|
214
|
-
}
|
215
|
-
return targets;
|
125
|
+
function createBuilderGenerator(bundler) {
|
126
|
+
return _createBuilderGenerator.apply(this, arguments);
|
216
127
|
}
|
217
|
-
function
|
218
|
-
|
219
|
-
|
220
|
-
function _createBuilderForModern() {
|
221
|
-
_createBuilderForModern = _asyncToGenerator(function(param) {
|
222
|
-
var normalizedConfig, appContext, compatPluginConfig, builderConfig, webpackProvider, target, builderOptions, builder;
|
128
|
+
function _createBuilderGenerator() {
|
129
|
+
_createBuilderGenerator = _asyncToGenerator(function(bundler) {
|
130
|
+
var createRspackBuilderForModern, _, createWebpackBuilderForModern;
|
223
131
|
return __generator(this, function(_state) {
|
224
132
|
switch(_state.label){
|
225
133
|
case 0:
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
builderConfig: builderConfig
|
230
|
-
});
|
231
|
-
target = getBuilderTargets(normalizedConfig);
|
232
|
-
builderOptions = createBuilderOptions(target, appContext);
|
233
|
-
return [
|
234
|
-
4,
|
235
|
-
createBuilder(webpackProvider, builderOptions)
|
134
|
+
if (!(bundler === "rspack")) return [
|
135
|
+
3,
|
136
|
+
4
|
236
137
|
];
|
138
|
+
_state.label = 1;
|
237
139
|
case 1:
|
238
|
-
|
140
|
+
_state.trys.push([
|
141
|
+
1,
|
142
|
+
3,
|
143
|
+
,
|
144
|
+
4
|
145
|
+
]);
|
239
146
|
return [
|
240
147
|
4,
|
241
|
-
|
148
|
+
import("./builder-rspack")
|
242
149
|
];
|
243
150
|
case 2:
|
244
|
-
_state.sent();
|
151
|
+
createRspackBuilderForModern = _state.sent().createRspackBuilderForModern;
|
245
152
|
return [
|
246
153
|
2,
|
247
|
-
|
154
|
+
createRspackBuilderForModern
|
248
155
|
];
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
}
|
254
|
-
function createBuilderProviderConfig(normalizedConfig, appContext) {
|
255
|
-
var createOutputConfig = function createOutputConfig(config, appContext2) {
|
256
|
-
var defaultCopyPattern = createCopyPattern(appContext2, config, "upload");
|
257
|
-
var copy = config.output.copy;
|
258
|
-
var copyOptions = Array.isArray(copy) ? copy : copy === null || copy === void 0 ? void 0 : copy.patterns;
|
259
|
-
var builderCopy = _toConsumableArray(copyOptions || []).concat([
|
260
|
-
defaultCopyPattern
|
261
|
-
]);
|
262
|
-
return _objectSpreadProps(_objectSpread({}, config.output), {
|
263
|
-
copy: builderCopy,
|
264
|
-
cleanDistPath: false
|
265
|
-
});
|
266
|
-
};
|
267
|
-
var output = createOutputConfig(normalizedConfig, appContext);
|
268
|
-
var htmlConfig = _objectSpread({}, normalizedConfig.html);
|
269
|
-
if (!htmlConfig.template) {
|
270
|
-
htmlConfig.templateByEntries = _objectSpread({}, htmlConfig.templateByEntries, appContext.htmlTemplates);
|
271
|
-
}
|
272
|
-
return _objectSpreadProps(_objectSpread({}, normalizedConfig), {
|
273
|
-
output: output,
|
274
|
-
dev: _objectSpreadProps(_objectSpread({}, normalizedConfig.dev), {
|
275
|
-
port: appContext.port
|
276
|
-
}),
|
277
|
-
html: htmlConfig
|
278
|
-
});
|
279
|
-
}
|
280
|
-
function createBuilderOptions(target, appContext) {
|
281
|
-
var entries = {};
|
282
|
-
var _entrypoints = appContext.entrypoints, entrypoints = _entrypoints === void 0 ? [] : _entrypoints, checkedEntries = appContext.checkedEntries;
|
283
|
-
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
284
|
-
try {
|
285
|
-
for(var _iterator = entrypoints[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
286
|
-
var _value = _step.value, entryName = _value.entryName, entry = _value.entry;
|
287
|
-
if (checkedEntries && !checkedEntries.includes(entryName)) {
|
288
|
-
continue;
|
289
|
-
}
|
290
|
-
if (entryName in entries) {
|
291
|
-
entries[entryName].push(entry);
|
292
|
-
} else {
|
293
|
-
entries[entryName] = [
|
294
|
-
entry
|
295
|
-
];
|
296
|
-
}
|
297
|
-
}
|
298
|
-
} catch (err) {
|
299
|
-
_didIteratorError = true;
|
300
|
-
_iteratorError = err;
|
301
|
-
} finally{
|
302
|
-
try {
|
303
|
-
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
304
|
-
_iterator.return();
|
305
|
-
}
|
306
|
-
} finally{
|
307
|
-
if (_didIteratorError) {
|
308
|
-
throw _iteratorError;
|
309
|
-
}
|
310
|
-
}
|
311
|
-
}
|
312
|
-
return {
|
313
|
-
cwd: appContext.appDirectory,
|
314
|
-
target: target,
|
315
|
-
configPath: appContext.configFile || void 0,
|
316
|
-
entry: entries,
|
317
|
-
framework: appContext.metaName
|
318
|
-
};
|
319
|
-
}
|
320
|
-
function applyBuilderPlugins(builder, normalizedConfig, appContext, compatPluginConfig) {
|
321
|
-
return _applyBuilderPlugins.apply(this, arguments);
|
322
|
-
}
|
323
|
-
function _applyBuilderPlugins() {
|
324
|
-
_applyBuilderPlugins = _asyncToGenerator(function(builder, normalizedConfig, appContext, compatPluginConfig) {
|
325
|
-
var builderPluginNodePolyfill, _tools, esbuildOptions, builderPluginEsbuild;
|
326
|
-
return __generator(this, function(_state) {
|
327
|
-
switch(_state.label){
|
328
|
-
case 0:
|
329
|
-
if (!!normalizedConfig.output.disableNodePolyfill) return [
|
330
|
-
3,
|
331
|
-
2
|
332
|
-
];
|
333
|
-
return [
|
334
|
-
4,
|
335
|
-
import("@modern-js/builder-plugin-node-polyfill")
|
336
|
-
];
|
337
|
-
case 1:
|
338
|
-
builderPluginNodePolyfill = _state.sent().builderPluginNodePolyfill;
|
339
|
-
builder.addPlugins([
|
340
|
-
builderPluginNodePolyfill()
|
341
|
-
]);
|
342
|
-
_state.label = 2;
|
343
|
-
case 2:
|
344
|
-
if (!normalizedConfig.tools.esbuild) return [
|
345
|
-
3,
|
346
|
-
4
|
347
|
-
];
|
348
|
-
_tools = normalizedConfig.tools, esbuildOptions = _tools.esbuild;
|
156
|
+
case 3:
|
157
|
+
_ = _state.sent();
|
158
|
+
throw new Error("Failed to use rspack, please check if you have `@modern-js/builder-rspack-provider` installed");
|
159
|
+
case 4:
|
349
160
|
return [
|
350
161
|
4,
|
351
|
-
import("
|
162
|
+
import("./builder-webpack")
|
352
163
|
];
|
353
|
-
case
|
354
|
-
|
355
|
-
builder.addPlugins([
|
356
|
-
builderPluginEsbuild({
|
357
|
-
loader: false,
|
358
|
-
minimize: applyOptionsChain({}, esbuildOptions)
|
359
|
-
})
|
360
|
-
]);
|
361
|
-
_state.label = 4;
|
362
|
-
case 4:
|
363
|
-
builder.addPlugins([
|
364
|
-
PluginCompatModern(appContext, normalizedConfig, compatPluginConfig)
|
365
|
-
]);
|
164
|
+
case 5:
|
165
|
+
createWebpackBuilderForModern = _state.sent().createWebpackBuilderForModern;
|
366
166
|
return [
|
367
|
-
2
|
167
|
+
2,
|
168
|
+
createWebpackBuilderForModern
|
368
169
|
];
|
369
170
|
}
|
370
171
|
});
|
371
172
|
});
|
372
|
-
return
|
173
|
+
return _createBuilderGenerator.apply(this, arguments);
|
373
174
|
}
|
374
|
-
export {
|
175
|
+
export { createBuilderGenerator };
|
@@ -1,11 +1,3 @@
|
|
1
|
-
function _arrayLikeToArray(arr, len) {
|
2
|
-
if (len == null || len > arr.length) len = arr.length;
|
3
|
-
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
4
|
-
return arr2;
|
5
|
-
}
|
6
|
-
function _arrayWithoutHoles(arr) {
|
7
|
-
if (Array.isArray(arr)) return _arrayLikeToArray(arr);
|
8
|
-
}
|
9
1
|
function _defineProperty(obj, key, value) {
|
10
2
|
if (key in obj) {
|
11
3
|
Object.defineProperty(obj, key, {
|
@@ -19,12 +11,6 @@ function _defineProperty(obj, key, value) {
|
|
19
11
|
}
|
20
12
|
return obj;
|
21
13
|
}
|
22
|
-
function _iterableToArray(iter) {
|
23
|
-
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
24
|
-
}
|
25
|
-
function _nonIterableSpread() {
|
26
|
-
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
|
-
}
|
28
14
|
function _objectSpread(target) {
|
29
15
|
for(var i = 1; i < arguments.length; i++){
|
30
16
|
var source = arguments[i] != null ? arguments[i] : {};
|
@@ -64,32 +50,57 @@ function _objectSpreadProps(target, source) {
|
|
64
50
|
}
|
65
51
|
return target;
|
66
52
|
}
|
67
|
-
function _toConsumableArray(arr) {
|
68
|
-
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
|
69
|
-
}
|
70
|
-
function _unsupportedIterableToArray(o, minLen) {
|
71
|
-
if (!o) return;
|
72
|
-
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
73
|
-
var n = Object.prototype.toString.call(o).slice(8, -1);
|
74
|
-
if (n === "Object" && o.constructor) n = o.constructor.name;
|
75
|
-
if (n === "Map" || n === "Set") return Array.from(n);
|
76
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
77
|
-
}
|
78
|
-
import { join } from "path";
|
79
53
|
import { mergeBuilderConfig } from "@modern-js/builder-shared";
|
80
|
-
import { template as lodashTemplate } from "@modern-js/utils/lodash";
|
81
|
-
import HtmlWebpackPlugin from "@modern-js/builder-webpack-provider/html-webpack-plugin";
|
82
54
|
import { getEntryOptions } from "@modern-js/utils";
|
83
|
-
import
|
84
|
-
import {
|
85
|
-
import {
|
86
|
-
import
|
87
|
-
var
|
55
|
+
import HtmlWebpackPlugin from "@modern-js/builder-webpack-provider/html-webpack-plugin";
|
56
|
+
import { template as lodashTemplate } from "@modern-js/utils/lodash";
|
57
|
+
import { HtmlAsyncChunkPlugin } from "../bundlerPlugins/HtmlAsyncChunkPlugin";
|
58
|
+
import { BottomTemplatePlugin } from "../bundlerPlugins/HtmlBottomTemplate";
|
59
|
+
var isStreamingSSR = function(userConfig) {
|
60
|
+
var isStreaming = function(ssr) {
|
61
|
+
return ssr && typeof ssr === "object" && ssr.mode === "stream";
|
62
|
+
};
|
63
|
+
var server = userConfig.server;
|
64
|
+
if (isStreaming(server.ssr)) {
|
65
|
+
return true;
|
66
|
+
}
|
67
|
+
if ((server === null || server === void 0 ? void 0 : server.ssrByEntries) && typeof server.ssrByEntries === "object") {
|
68
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
69
|
+
try {
|
70
|
+
for(var _iterator = Object.keys(server.ssrByEntries)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
71
|
+
var name = _step.value;
|
72
|
+
if (isStreaming(server.ssrByEntries[name])) {
|
73
|
+
return true;
|
74
|
+
}
|
75
|
+
}
|
76
|
+
} catch (err) {
|
77
|
+
_didIteratorError = true;
|
78
|
+
_iteratorError = err;
|
79
|
+
} finally{
|
80
|
+
try {
|
81
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
82
|
+
_iterator.return();
|
83
|
+
}
|
84
|
+
} finally{
|
85
|
+
if (_didIteratorError) {
|
86
|
+
throw _iteratorError;
|
87
|
+
}
|
88
|
+
}
|
89
|
+
}
|
90
|
+
}
|
91
|
+
return false;
|
92
|
+
};
|
93
|
+
var builderPluginAdapterModern = function(options) {
|
88
94
|
return {
|
89
|
-
name: "builder-plugin-
|
95
|
+
name: "builder-plugin-adapter-modern",
|
90
96
|
setup: function setup(api) {
|
97
|
+
var isHtmlEnabled = function isHtmlEnabled(config, target) {
|
98
|
+
var _config_tools;
|
99
|
+
return ((_config_tools = config.tools) === null || _config_tools === void 0 ? void 0 : _config_tools.htmlPlugin) !== false && target !== "node" && target !== "service-worker" && target !== "web-worker";
|
100
|
+
};
|
101
|
+
var normalizedConfig = options.normalizedConfig, appContext = options.appContext;
|
91
102
|
api.modifyBuilderConfig(function(config) {
|
92
|
-
if (isStreamingSSR(
|
103
|
+
if (isStreamingSSR(normalizedConfig)) {
|
93
104
|
return mergeBuilderConfig(config, {
|
94
105
|
html: {
|
95
106
|
inject: "body"
|
@@ -98,70 +109,44 @@ var PluginCompatModern = function(appContext, modernConfig, options) {
|
|
98
109
|
}
|
99
110
|
return config;
|
100
111
|
});
|
101
|
-
api.
|
112
|
+
api.modifyBundlerChain(function(chain, param) {
|
102
113
|
var target = param.target, CHAIN_ID = param.CHAIN_ID, isProd = param.isProd;
|
103
|
-
var
|
104
|
-
var ref;
|
105
|
-
return ((ref = config.tools) === null || ref === void 0 ? void 0 : ref.htmlPlugin) !== false && target2 !== "node" && target2 !== "web-worker";
|
106
|
-
};
|
107
|
-
var ref;
|
108
|
-
var builderNormalizedConfig = api.getNormalizedConfig();
|
114
|
+
var builderConfig = api.getNormalizedConfig();
|
109
115
|
if (target === "node") {
|
110
116
|
chain.name("server");
|
117
|
+
} else if (target === "service-worker") {
|
118
|
+
chain.name("service-worker");
|
119
|
+
} else if (target === "web-worker") {
|
120
|
+
chain.name("worker");
|
111
121
|
} else if (target === "modern-web") {
|
112
122
|
chain.name("modern");
|
113
123
|
} else {
|
114
124
|
chain.name("client");
|
115
125
|
}
|
116
|
-
|
117
|
-
|
118
|
-
applyNodeCompat(chain, modernConfig, isProd);
|
126
|
+
if (target === "node" || target === "service-worker") {
|
127
|
+
applyNodeCompat(target, chain, normalizedConfig, isProd);
|
119
128
|
}
|
120
|
-
if (isHtmlEnabled(
|
121
|
-
|
129
|
+
if (isHtmlEnabled(builderConfig, target)) {
|
130
|
+
applyBottomHtmlPlugin({
|
122
131
|
api: api,
|
123
132
|
chain: chain,
|
124
|
-
|
133
|
+
modernConfig: normalizedConfig,
|
125
134
|
appContext: appContext,
|
126
|
-
|
135
|
+
CHAIN_ID: CHAIN_ID
|
127
136
|
});
|
128
137
|
applyAsyncChunkHtmlPlugin({
|
129
138
|
chain: chain,
|
130
|
-
|
131
|
-
|
139
|
+
modernConfig: normalizedConfig,
|
140
|
+
CHAIN_ID: CHAIN_ID
|
132
141
|
});
|
133
142
|
}
|
134
|
-
if (
|
135
|
-
var defaultCopyPattern = createCopyPattern(appContext, modernConfig, "public", chain);
|
136
|
-
chain.plugin(CHAIN_ID.PLUGIN.COPY).tap(function(args) {
|
137
|
-
var ref;
|
138
|
-
return [
|
139
|
-
{
|
140
|
-
patterns: _toConsumableArray(((ref = args[0]) === null || ref === void 0 ? void 0 : ref.patterns) || []).concat([
|
141
|
-
defaultCopyPattern
|
142
|
-
])
|
143
|
-
}
|
144
|
-
];
|
145
|
-
});
|
146
|
-
}
|
147
|
-
var entrypoints = appContext.entrypoints;
|
148
|
-
var existNestedRoutes = entrypoints.some(function(entrypoint) {
|
149
|
-
return entrypoint.nestedRoutesEntry;
|
150
|
-
});
|
151
|
-
var routerConfig = modernConfig === null || modernConfig === void 0 ? void 0 : (ref = modernConfig.runtime) === null || ref === void 0 ? void 0 : ref.router;
|
152
|
-
var routerManifest = Boolean(routerConfig === null || routerConfig === void 0 ? void 0 : routerConfig.manifest);
|
153
|
-
if (existNestedRoutes || routerManifest) {
|
154
|
-
chain.plugin("route-plugin").use(RouterPlugin);
|
155
|
-
}
|
156
|
-
if (target !== "node") {
|
143
|
+
if (target !== "node" && target !== "web-worker" && target !== "service-worker") {
|
157
144
|
var bareServerModuleReg = /\.(server|node)\.[tj]sx?$/;
|
158
145
|
chain.module.rule(CHAIN_ID.RULE.JS).exclude.add(bareServerModuleReg);
|
159
146
|
chain.module.rule("bare-server-module").test(bareServerModuleReg).use("server-module-loader").loader(require.resolve("../loaders/serverModuleLoader"));
|
160
147
|
}
|
161
148
|
});
|
162
|
-
|
163
|
-
applyCallbacks(api, options);
|
164
|
-
}
|
149
|
+
applyCallbacks(api, options);
|
165
150
|
}
|
166
151
|
};
|
167
152
|
};
|
@@ -175,11 +160,58 @@ function applyCallbacks(api, options) {
|
|
175
160
|
options.onDevCompileDone && api.onDevCompileDone(options.onDevCompileDone);
|
176
161
|
options.onExit && api.onExit(options.onExit);
|
177
162
|
}
|
178
|
-
function
|
163
|
+
function applyBottomHtmlPlugin(param) {
|
164
|
+
var api = param.api, chain = param.chain, modernConfig = param.modernConfig, appContext = param.appContext, CHAIN_ID = param.CHAIN_ID;
|
165
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
166
|
+
try {
|
167
|
+
var _loop = function() {
|
168
|
+
var entryName = _step.value;
|
169
|
+
var baseTemplateParams = _objectSpread({
|
170
|
+
entryName: entryName,
|
171
|
+
title: getEntryOptions(entryName, modernConfig.html.title, modernConfig.html.titleByEntries, appContext.packageName),
|
172
|
+
mountId: modernConfig.html.mountId
|
173
|
+
}, getEntryOptions(entryName, modernConfig.html.templateParameters, modernConfig.html.templateParametersByEntries, appContext.packageName));
|
174
|
+
chain.plugin("".concat(CHAIN_ID.PLUGIN.HTML, "-").concat(entryName)).tap(function(args) {
|
175
|
+
return [
|
176
|
+
_objectSpreadProps(_objectSpread({}, args[0] || {}), {
|
177
|
+
__internal__: true,
|
178
|
+
bottomTemplate: appContext.htmlTemplates["__".concat(entryName, "-bottom__")] && lodashTemplate(appContext.htmlTemplates["__".concat(entryName, "-bottom__")])(baseTemplateParams)
|
179
|
+
})
|
180
|
+
];
|
181
|
+
});
|
182
|
+
};
|
183
|
+
for(var _iterator = Object.keys(api.context.entry)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true)_loop();
|
184
|
+
} catch (err) {
|
185
|
+
_didIteratorError = true;
|
186
|
+
_iteratorError = err;
|
187
|
+
} finally{
|
188
|
+
try {
|
189
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
190
|
+
_iterator.return();
|
191
|
+
}
|
192
|
+
} finally{
|
193
|
+
if (_didIteratorError) {
|
194
|
+
throw _iteratorError;
|
195
|
+
}
|
196
|
+
}
|
197
|
+
}
|
198
|
+
chain.plugin(CHAIN_ID.PLUGIN.BOTTOM_TEMPLATE).use(BottomTemplatePlugin, [
|
199
|
+
HtmlWebpackPlugin
|
200
|
+
]);
|
201
|
+
}
|
202
|
+
function applyAsyncChunkHtmlPlugin(param) {
|
203
|
+
var chain = param.chain, modernConfig = param.modernConfig, CHAIN_ID = param.CHAIN_ID;
|
204
|
+
if (isStreamingSSR(modernConfig)) {
|
205
|
+
chain.plugin(CHAIN_ID.PLUGIN.HTML_ASYNC_CHUNK).use(HtmlAsyncChunkPlugin, [
|
206
|
+
HtmlWebpackPlugin
|
207
|
+
]);
|
208
|
+
}
|
209
|
+
}
|
210
|
+
function applyNodeCompat(target, chain, modernConfig, isProd) {
|
179
211
|
var filterEntriesBySSRConfig = function filterEntriesBySSRConfig(isProd2, chain2, serverConfig, outputConfig) {
|
180
|
-
var
|
212
|
+
var _outputConfig_ssg;
|
181
213
|
var entries = chain2.entryPoints.entries();
|
182
|
-
if (isProd2 && ((outputConfig === null || outputConfig === void 0 ? void 0 : outputConfig.ssg) === true || typeof (outputConfig === null || outputConfig === void 0 ? void 0 : (
|
214
|
+
if (isProd2 && ((outputConfig === null || outputConfig === void 0 ? void 0 : outputConfig.ssg) === true || typeof (outputConfig === null || outputConfig === void 0 ? void 0 : (_outputConfig_ssg = outputConfig.ssg) === null || _outputConfig_ssg === void 0 ? void 0 : _outputConfig_ssg[0]) === "function")) {
|
183
215
|
return;
|
184
216
|
}
|
185
217
|
if (typeof entries === "undefined") {
|
@@ -198,14 +230,14 @@ function applyNodeCompat(chain, modernConfig, isProd) {
|
|
198
230
|
}
|
199
231
|
});
|
200
232
|
}
|
201
|
-
var
|
233
|
+
var _ref = serverConfig || {}, ssr = _ref.ssr, ssrByEntries = _ref.ssrByEntries;
|
202
234
|
entryNames.forEach(function(name) {
|
203
235
|
if (!ssgEntries.includes(name) && (ssr && (ssrByEntries === null || ssrByEntries === void 0 ? void 0 : ssrByEntries[name]) === false || !ssr && !(ssrByEntries === null || ssrByEntries === void 0 ? void 0 : ssrByEntries[name]))) {
|
204
236
|
chain2.entryPoints.delete(name);
|
205
237
|
}
|
206
238
|
});
|
207
239
|
};
|
208
|
-
|
240
|
+
var nodeExts = [
|
209
241
|
".node.js",
|
210
242
|
".node.jsx",
|
211
243
|
".node.ts",
|
@@ -214,33 +246,19 @@ function applyNodeCompat(chain, modernConfig, isProd) {
|
|
214
246
|
".server.ts",
|
215
247
|
".server.ts",
|
216
248
|
".server.tsx"
|
217
|
-
];
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
var api = param.api, chain = param.chain, modernConfig = param.modernConfig, appContext = param.appContext, CHAIN_ID = param.CHAIN_ID;
|
249
|
+
];
|
250
|
+
var webWorkerExts = [
|
251
|
+
".worker.js",
|
252
|
+
".worker.jsx",
|
253
|
+
".worker.ts",
|
254
|
+
".worker.tsx"
|
255
|
+
];
|
225
256
|
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
226
257
|
try {
|
227
|
-
var
|
228
|
-
var
|
229
|
-
|
230
|
-
|
231
|
-
title: getEntryOptions(entryName, modernConfig.html.title, modernConfig.html.titleByEntries, appContext.packageName),
|
232
|
-
mountId: modernConfig.html.mountId
|
233
|
-
}, getEntryOptions(entryName, modernConfig.html.templateParameters, modernConfig.html.templateParametersByEntries, appContext.packageName));
|
234
|
-
chain.plugin("".concat(CHAIN_ID.PLUGIN.HTML, "-").concat(entryName)).tap(function(args) {
|
235
|
-
return [
|
236
|
-
_objectSpreadProps(_objectSpread({}, args[0] || {}), {
|
237
|
-
__internal__: true,
|
238
|
-
bottomTemplate: appContext.htmlTemplates["__".concat(entryName, "-bottom__")] && lodashTemplate(appContext.htmlTemplates["__".concat(entryName, "-bottom__")])(baseTemplateParams)
|
239
|
-
})
|
240
|
-
];
|
241
|
-
});
|
242
|
-
};
|
243
|
-
for(var _iterator = Object.keys(api.context.entry)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true)_loop();
|
258
|
+
for(var _iterator = nodeExts[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
259
|
+
var ext = _step.value;
|
260
|
+
chain.resolve.extensions.prepend(ext);
|
261
|
+
}
|
244
262
|
} catch (err) {
|
245
263
|
_didIteratorError = true;
|
246
264
|
_iteratorError = err;
|
@@ -255,50 +273,28 @@ function applyBottomHtmlWebpackPlugin(param) {
|
|
255
273
|
}
|
256
274
|
}
|
257
275
|
}
|
258
|
-
|
259
|
-
|
260
|
-
]);
|
261
|
-
}
|
262
|
-
var isStreamingSSR = function(userConfig) {
|
263
|
-
var isStreaming = function(ssr) {
|
264
|
-
return ssr && typeof ssr === "object" && ssr.mode === "stream";
|
265
|
-
};
|
266
|
-
var server = userConfig.server;
|
267
|
-
if (isStreaming(server.ssr)) {
|
268
|
-
return true;
|
269
|
-
}
|
270
|
-
if ((server === null || server === void 0 ? void 0 : server.ssrByEntries) && typeof server.ssrByEntries === "object") {
|
271
|
-
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
276
|
+
if (target === "service-worker") {
|
277
|
+
var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = undefined;
|
272
278
|
try {
|
273
|
-
for(var
|
274
|
-
var
|
275
|
-
|
276
|
-
return true;
|
277
|
-
}
|
279
|
+
for(var _iterator1 = webWorkerExts[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true){
|
280
|
+
var ext1 = _step1.value;
|
281
|
+
chain.resolve.extensions.prepend(ext1);
|
278
282
|
}
|
279
283
|
} catch (err) {
|
280
|
-
|
281
|
-
|
284
|
+
_didIteratorError1 = true;
|
285
|
+
_iteratorError1 = err;
|
282
286
|
} finally{
|
283
287
|
try {
|
284
|
-
if (!
|
285
|
-
|
288
|
+
if (!_iteratorNormalCompletion1 && _iterator1.return != null) {
|
289
|
+
_iterator1.return();
|
286
290
|
}
|
287
291
|
} finally{
|
288
|
-
if (
|
289
|
-
throw
|
292
|
+
if (_didIteratorError1) {
|
293
|
+
throw _iteratorError1;
|
290
294
|
}
|
291
295
|
}
|
292
296
|
}
|
293
297
|
}
|
294
|
-
|
295
|
-
};
|
296
|
-
function applyAsyncChunkHtmlPlugin(param) {
|
297
|
-
var chain = param.chain, modernConfig = param.modernConfig, CHAIN_ID = param.CHAIN_ID;
|
298
|
-
if (isStreamingSSR(modernConfig)) {
|
299
|
-
chain.plugin(CHAIN_ID.PLUGIN.HTML_ASYNC_CHUNK).use(HtmlAsyncChunkPlugin, [
|
300
|
-
HtmlWebpackPlugin
|
301
|
-
]);
|
302
|
-
}
|
298
|
+
filterEntriesBySSRConfig(isProd, chain, modernConfig.server, modernConfig.output);
|
303
299
|
}
|
304
|
-
export {
|
300
|
+
export { applyCallbacks, builderPluginAdapterModern };
|