@modern-js/app-tools 2.3.1-alpha.1 → 2.4.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 +56 -0
- package/README.md +14 -18
- package/dist/js/modern/analyze/index.js +45 -48
- package/dist/js/modern/analyze/nestedRoutes.js +10 -1
- package/dist/js/modern/analyze/templates.js +2 -9
- 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} +1 -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 +12 -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} +81 -111
- 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/index.js +46 -49
- package/dist/js/node/analyze/nestedRoutes.js +10 -1
- package/dist/js/node/analyze/templates.js +2 -9
- 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} +7 -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/{loaders/routerLoader.js → generator/getBuilderTargets.js} +13 -16
- 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} +86 -115
- 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/index.js +135 -130
- package/dist/js/treeshaking/analyze/nestedRoutes.js +10 -1
- package/dist/js/treeshaking/analyze/templates.js +3 -7
- 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} +1 -1
- 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 +12 -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} +103 -156
- 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} +0 -0
- 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/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 +4 -2
- package/dist/js/treeshaking/config/{initial → legacy}/createHtmlConfig.js +0 -0
- package/dist/js/treeshaking/config/{initial → legacy}/createOutputConfig.js +0 -0
- package/dist/js/treeshaking/config/{initial → legacy}/createSourceConfig.js +0 -0
- package/dist/js/treeshaking/config/{initial → legacy}/createToolsConfig.js +0 -0
- 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 +34 -26
- package/dist/js/treeshaking/locale/zh.js +1 -1
- package/dist/js/treeshaking/types/utils.js +1 -0
- 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 +3 -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 +4 -3
- package/dist/types/types/index.d.ts +16 -6
- 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/loaders/routerLoader.js +0 -17
- 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/builder/loaders/routerLoader.js +0 -13
- package/dist/js/treeshaking/config/initial/index.js +0 -12
- package/dist/types/builder/loaders/routerLoader.d.ts +0 -3
- 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 ref;
|
|
99
|
+
return ((ref = config.tools) === null || ref === void 0 ? void 0 : ref.htmlPlugin) !== false && target !== "node" && 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,14 +109,9 @@ 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");
|
|
111
117
|
} else if (target === "modern-web") {
|
|
@@ -113,55 +119,30 @@ var PluginCompatModern = function(appContext, modernConfig, options) {
|
|
|
113
119
|
} else {
|
|
114
120
|
chain.name("client");
|
|
115
121
|
}
|
|
116
|
-
chain.resolve.modules.add("node_modules").add(join(api.context.rootPath, "node_modules"));
|
|
117
122
|
if (target === "node") {
|
|
118
|
-
applyNodeCompat(chain,
|
|
123
|
+
applyNodeCompat(chain, normalizedConfig, isProd);
|
|
119
124
|
}
|
|
120
|
-
if (isHtmlEnabled(
|
|
121
|
-
|
|
125
|
+
if (isHtmlEnabled(builderConfig, target)) {
|
|
126
|
+
applyBottomHtmlPlugin({
|
|
122
127
|
api: api,
|
|
123
128
|
chain: chain,
|
|
124
|
-
|
|
129
|
+
modernConfig: normalizedConfig,
|
|
125
130
|
appContext: appContext,
|
|
126
|
-
|
|
131
|
+
CHAIN_ID: CHAIN_ID
|
|
127
132
|
});
|
|
128
133
|
applyAsyncChunkHtmlPlugin({
|
|
129
134
|
chain: chain,
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
});
|
|
133
|
-
}
|
|
134
|
-
if (chain.plugins.has(CHAIN_ID.PLUGIN.COPY)) {
|
|
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
|
-
];
|
|
135
|
+
modernConfig: normalizedConfig,
|
|
136
|
+
CHAIN_ID: CHAIN_ID
|
|
145
137
|
});
|
|
146
138
|
}
|
|
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
139
|
if (target !== "node") {
|
|
157
140
|
var bareServerModuleReg = /\.(server|node)\.[tj]sx?$/;
|
|
158
141
|
chain.module.rule(CHAIN_ID.RULE.JS).exclude.add(bareServerModuleReg);
|
|
159
142
|
chain.module.rule("bare-server-module").test(bareServerModuleReg).use("server-module-loader").loader(require.resolve("../loaders/serverModuleLoader"));
|
|
160
143
|
}
|
|
161
144
|
});
|
|
162
|
-
|
|
163
|
-
applyCallbacks(api, options);
|
|
164
|
-
}
|
|
145
|
+
applyCallbacks(api, options);
|
|
165
146
|
}
|
|
166
147
|
};
|
|
167
148
|
};
|
|
@@ -175,52 +156,7 @@ function applyCallbacks(api, options) {
|
|
|
175
156
|
options.onDevCompileDone && api.onDevCompileDone(options.onDevCompileDone);
|
|
176
157
|
options.onExit && api.onExit(options.onExit);
|
|
177
158
|
}
|
|
178
|
-
function
|
|
179
|
-
var filterEntriesBySSRConfig = function filterEntriesBySSRConfig(isProd2, chain2, serverConfig, outputConfig) {
|
|
180
|
-
var ref;
|
|
181
|
-
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 : (ref = outputConfig.ssg) === null || ref === void 0 ? void 0 : ref[0]) === "function")) {
|
|
183
|
-
return;
|
|
184
|
-
}
|
|
185
|
-
if (typeof entries === "undefined") {
|
|
186
|
-
throw new Error("No entry found, one of src/routes/layout.tsx, src/App.tsx, src/index.tsx is required");
|
|
187
|
-
}
|
|
188
|
-
var entryNames = Object.keys(entries);
|
|
189
|
-
if (isProd2 && entryNames.length === 1 && (outputConfig === null || outputConfig === void 0 ? void 0 : outputConfig.ssg)) {
|
|
190
|
-
return;
|
|
191
|
-
}
|
|
192
|
-
var ssgEntries = [];
|
|
193
|
-
if (isProd2 && (outputConfig === null || outputConfig === void 0 ? void 0 : outputConfig.ssg)) {
|
|
194
|
-
var ssg = outputConfig.ssg;
|
|
195
|
-
entryNames.forEach(function(name) {
|
|
196
|
-
if (ssg[name]) {
|
|
197
|
-
ssgEntries.push(name);
|
|
198
|
-
}
|
|
199
|
-
});
|
|
200
|
-
}
|
|
201
|
-
var ref1 = serverConfig || {}, ssr = ref1.ssr, ssrByEntries = ref1.ssrByEntries;
|
|
202
|
-
entryNames.forEach(function(name) {
|
|
203
|
-
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
|
-
chain2.entryPoints.delete(name);
|
|
205
|
-
}
|
|
206
|
-
});
|
|
207
|
-
};
|
|
208
|
-
for(var _i = 0, _iter = [
|
|
209
|
-
".node.js",
|
|
210
|
-
".node.jsx",
|
|
211
|
-
".node.ts",
|
|
212
|
-
".node.tsx",
|
|
213
|
-
".server.js",
|
|
214
|
-
".server.ts",
|
|
215
|
-
".server.ts",
|
|
216
|
-
".server.tsx"
|
|
217
|
-
]; _i < _iter.length; _i++){
|
|
218
|
-
var ext = _iter[_i];
|
|
219
|
-
chain.resolve.extensions.prepend(ext);
|
|
220
|
-
}
|
|
221
|
-
filterEntriesBySSRConfig(isProd, chain, modernConfig.server, modernConfig.output);
|
|
222
|
-
}
|
|
223
|
-
function applyBottomHtmlWebpackPlugin(param) {
|
|
159
|
+
function applyBottomHtmlPlugin(param) {
|
|
224
160
|
var api = param.api, chain = param.chain, modernConfig = param.modernConfig, appContext = param.appContext, CHAIN_ID = param.CHAIN_ID;
|
|
225
161
|
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
226
162
|
try {
|
|
@@ -259,40 +195,6 @@ function applyBottomHtmlWebpackPlugin(param) {
|
|
|
259
195
|
HtmlWebpackPlugin
|
|
260
196
|
]);
|
|
261
197
|
}
|
|
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;
|
|
272
|
-
try {
|
|
273
|
-
for(var _iterator = Object.keys(server.ssrByEntries)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
274
|
-
var name = _step.value;
|
|
275
|
-
if (isStreaming(server.ssrByEntries[name])) {
|
|
276
|
-
return true;
|
|
277
|
-
}
|
|
278
|
-
}
|
|
279
|
-
} catch (err) {
|
|
280
|
-
_didIteratorError = true;
|
|
281
|
-
_iteratorError = err;
|
|
282
|
-
} finally{
|
|
283
|
-
try {
|
|
284
|
-
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
285
|
-
_iterator.return();
|
|
286
|
-
}
|
|
287
|
-
} finally{
|
|
288
|
-
if (_didIteratorError) {
|
|
289
|
-
throw _iteratorError;
|
|
290
|
-
}
|
|
291
|
-
}
|
|
292
|
-
}
|
|
293
|
-
}
|
|
294
|
-
return false;
|
|
295
|
-
};
|
|
296
198
|
function applyAsyncChunkHtmlPlugin(param) {
|
|
297
199
|
var chain = param.chain, modernConfig = param.modernConfig, CHAIN_ID = param.CHAIN_ID;
|
|
298
200
|
if (isStreamingSSR(modernConfig)) {
|
|
@@ -301,4 +203,49 @@ function applyAsyncChunkHtmlPlugin(param) {
|
|
|
301
203
|
]);
|
|
302
204
|
}
|
|
303
205
|
}
|
|
304
|
-
|
|
206
|
+
function applyNodeCompat(chain, modernConfig, isProd) {
|
|
207
|
+
var filterEntriesBySSRConfig = function filterEntriesBySSRConfig(isProd2, chain2, serverConfig, outputConfig) {
|
|
208
|
+
var ref;
|
|
209
|
+
var entries = chain2.entryPoints.entries();
|
|
210
|
+
if (isProd2 && ((outputConfig === null || outputConfig === void 0 ? void 0 : outputConfig.ssg) === true || typeof (outputConfig === null || outputConfig === void 0 ? void 0 : (ref = outputConfig.ssg) === null || ref === void 0 ? void 0 : ref[0]) === "function")) {
|
|
211
|
+
return;
|
|
212
|
+
}
|
|
213
|
+
if (typeof entries === "undefined") {
|
|
214
|
+
throw new Error("No entry found, one of src/routes/layout.tsx, src/App.tsx, src/index.tsx is required");
|
|
215
|
+
}
|
|
216
|
+
var entryNames = Object.keys(entries);
|
|
217
|
+
if (isProd2 && entryNames.length === 1 && (outputConfig === null || outputConfig === void 0 ? void 0 : outputConfig.ssg)) {
|
|
218
|
+
return;
|
|
219
|
+
}
|
|
220
|
+
var ssgEntries = [];
|
|
221
|
+
if (isProd2 && (outputConfig === null || outputConfig === void 0 ? void 0 : outputConfig.ssg)) {
|
|
222
|
+
var ssg = outputConfig.ssg;
|
|
223
|
+
entryNames.forEach(function(name) {
|
|
224
|
+
if (ssg[name]) {
|
|
225
|
+
ssgEntries.push(name);
|
|
226
|
+
}
|
|
227
|
+
});
|
|
228
|
+
}
|
|
229
|
+
var ref1 = serverConfig || {}, ssr = ref1.ssr, ssrByEntries = ref1.ssrByEntries;
|
|
230
|
+
entryNames.forEach(function(name) {
|
|
231
|
+
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]))) {
|
|
232
|
+
chain2.entryPoints.delete(name);
|
|
233
|
+
}
|
|
234
|
+
});
|
|
235
|
+
};
|
|
236
|
+
for(var _i = 0, _iter = [
|
|
237
|
+
".node.js",
|
|
238
|
+
".node.jsx",
|
|
239
|
+
".node.ts",
|
|
240
|
+
".node.tsx",
|
|
241
|
+
".server.js",
|
|
242
|
+
".server.ts",
|
|
243
|
+
".server.ts",
|
|
244
|
+
".server.tsx"
|
|
245
|
+
]; _i < _iter.length; _i++){
|
|
246
|
+
var ext = _iter[_i];
|
|
247
|
+
chain.resolve.extensions.prepend(ext);
|
|
248
|
+
}
|
|
249
|
+
filterEntriesBySSRConfig(isProd, chain, modernConfig.server, modernConfig.output);
|
|
250
|
+
}
|
|
251
|
+
export { applyCallbacks, builderPluginAdapterModern };
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -51,12 +51,11 @@ function _objectSpreadProps(target, source) {
|
|
|
51
51
|
return target;
|
|
52
52
|
}
|
|
53
53
|
import { createDefaultConfig as createDefaultBuilderConfig } from "@modern-js/builder-webpack-provider";
|
|
54
|
-
function createDefaultConfig(appContext) {
|
|
54
|
+
function createDefaultConfig(appContext, bundler) {
|
|
55
55
|
var defaultBuilderConfig = createDefaultBuilderConfig();
|
|
56
56
|
var dev = _objectSpreadProps(_objectSpread({}, defaultBuilderConfig.dev), {
|
|
57
57
|
port: void 0
|
|
58
58
|
});
|
|
59
|
-
var tools = _objectSpread({}, defaultBuilderConfig.tools);
|
|
60
59
|
var output = _objectSpreadProps(_objectSpread({}, defaultBuilderConfig.output), {
|
|
61
60
|
disableNodePolyfill: true
|
|
62
61
|
});
|
|
@@ -95,6 +94,7 @@ function createDefaultConfig(appContext) {
|
|
|
95
94
|
baseUrl: "/",
|
|
96
95
|
port: 8080
|
|
97
96
|
};
|
|
97
|
+
var tools = bundler === "webpack" ? _objectSpread({}, defaultBuilderConfig.tools) : void 0;
|
|
98
98
|
return {
|
|
99
99
|
source: source,
|
|
100
100
|
output: output,
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export
|
|
1
|
+
export * from "./legacy";
|
|
2
|
+
export * from "./initialize";
|
|
3
|
+
export * from "./default";
|