@modern-js/app-tools 2.10.1-alpha.0 → 2.11.1-alpha.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 +66 -0
- package/dist/cjs/analyze/index.js +1 -1
- package/dist/cjs/builder/index.js +2 -2
- package/dist/cjs/builder/shared/builderPlugins/adapterSSR.js +1 -1
- package/dist/cjs/builder/shared/bundlerPlugins/RouterPlugin.js +17 -12
- package/dist/cjs/utils/restart.js +1 -1
- package/dist/esm/analyze/index.js +2 -2
- package/dist/esm/builder/index.js +14 -9
- package/dist/esm/builder/shared/builderPlugins/adapterSSR.js +1 -1
- package/dist/esm/builder/shared/bundlerPlugins/RouterPlugin.js +20 -13
- package/dist/esm/utils/restart.js +2 -2
- package/dist/esm-node/analyze/index.js +3 -2
- package/dist/esm-node/builder/index.js +1 -1
- package/dist/esm-node/builder/shared/builderPlugins/adapterSSR.js +1 -1
- package/dist/esm-node/builder/shared/bundlerPlugins/RouterPlugin.js +17 -12
- package/dist/esm-node/utils/restart.js +8 -2
- package/dist/js/modern/analyze/constants.js +3 -1
- package/dist/js/modern/analyze/getServerRoutes.js +5 -2
- package/dist/js/modern/analyze/index.js +47 -46
- package/dist/js/modern/analyze/nestedRoutes.js +32 -3
- package/dist/js/modern/analyze/templates.js +4 -10
- 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/shared/index.js +3 -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/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/constants.js +3 -1
- package/dist/js/node/analyze/getServerRoutes.js +3 -1
- package/dist/js/node/analyze/index.js +48 -47
- package/dist/js/node/analyze/nestedRoutes.js +32 -3
- package/dist/js/node/analyze/templates.js +4 -10
- package/dist/js/node/{config/initial → builder/builder-rspack}/index.js +9 -19
- 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/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/{builder/loaders/routerLoader.js → config/initialize/index.js} +14 -17
- package/dist/js/node/config/{initial → initialize}/inits.js +4 -2
- 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/constants.js +3 -1
- 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 +29 -4
- package/dist/js/treeshaking/analyze/templates.js +10 -13
- 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/htmlBottomTemplate.js → shared/bundlerPlugins/HtmlBottomTemplate.js} +2 -2
- package/dist/js/treeshaking/builder/shared/index.js +3 -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/types/config/source.d.ts +2 -2
- package/package.json +24 -24
- 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/createHtmlConfig.js +0 -19
- package/dist/js/treeshaking/config/initial/index.js +0 -12
- /package/dist/js/modern/builder/{share.js → shared/createCopyPattern.js} +0 -0
- /package/dist/js/modern/builder/{loaders → shared/loaders}/serverModuleLoader.js +0 -0
- /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/node/builder/{loaders → shared/loaders}/serverModuleLoader.js +0 -0
- /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/treeshaking/builder/{webpackPlugins/htmlAsyncChunkPlugin.js → shared/bundlerPlugins/HtmlAsyncChunkPlugin.js} +0 -0
- /package/dist/js/treeshaking/builder/{share.js → shared/createCopyPattern.js} +0 -0
- /package/dist/js/treeshaking/builder/{loaders → shared/loaders}/serverModuleLoader.js +0 -0
|
@@ -439,6 +439,9 @@ var buildCommand = function() {
|
|
|
439
439
|
};
|
|
440
440
|
}();
|
|
441
441
|
var src_default = function() {
|
|
442
|
+
var options = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {
|
|
443
|
+
bundler: "webpack"
|
|
444
|
+
};
|
|
442
445
|
return {
|
|
443
446
|
name: "@modern-js/app-tools",
|
|
444
447
|
post: [
|
|
@@ -453,8 +456,12 @@ var src_default = function() {
|
|
|
453
456
|
],
|
|
454
457
|
registerHook: hooks,
|
|
455
458
|
usePlugins: [
|
|
456
|
-
initializePlugin(
|
|
457
|
-
|
|
459
|
+
initializePlugin({
|
|
460
|
+
bundler: (options === null || options === void 0 ? void 0 : options.bundler) === "experimental-rspack" ? "rspack" : "webpack"
|
|
461
|
+
}),
|
|
462
|
+
analyzePlugin({
|
|
463
|
+
bundler: (options === null || options === void 0 ? void 0 : options.bundler) === "experimental-rspack" ? "rspack" : "webpack"
|
|
464
|
+
}),
|
|
458
465
|
lintPlugin()
|
|
459
466
|
],
|
|
460
467
|
setup: function(api) {
|
|
@@ -505,7 +512,7 @@ var src_default = function() {
|
|
|
505
512
|
});
|
|
506
513
|
}));
|
|
507
514
|
program.command("deploy").usage("[options]").option("-c --config <config>", i18n.t(localeKeys.command.shared.config)).description(i18n.t(localeKeys.command.deploy.describe)).action(function() {
|
|
508
|
-
var _ref = _asyncToGenerator(function(
|
|
515
|
+
var _ref = _asyncToGenerator(function(options2) {
|
|
509
516
|
var build, deploy;
|
|
510
517
|
return __generator(this, function(_state) {
|
|
511
518
|
switch(_state.label){
|
|
@@ -530,7 +537,7 @@ var src_default = function() {
|
|
|
530
537
|
deploy = _state.sent().deploy;
|
|
531
538
|
return [
|
|
532
539
|
4,
|
|
533
|
-
deploy(api,
|
|
540
|
+
deploy(api, options2)
|
|
534
541
|
];
|
|
535
542
|
case 4:
|
|
536
543
|
_state.sent();
|
|
@@ -541,12 +548,12 @@ var src_default = function() {
|
|
|
541
548
|
}
|
|
542
549
|
});
|
|
543
550
|
});
|
|
544
|
-
return function(
|
|
551
|
+
return function(options2) {
|
|
545
552
|
return _ref.apply(this, arguments);
|
|
546
553
|
};
|
|
547
554
|
}());
|
|
548
555
|
program.command("new").usage("[options]").description(i18n.t(localeKeys.command.new.describe)).option("--lang <lang>", i18n.t(localeKeys.command.new.lang)).option("-d, --debug", i18n.t(localeKeys.command.new.debug), false).option("-c, --config <config>", i18n.t(localeKeys.command.new.config)).option("--dist-tag <tag>", i18n.t(localeKeys.command.new.distTag)).option("--registry", i18n.t(localeKeys.command.new.registry)).action(function() {
|
|
549
|
-
var _ref = _asyncToGenerator(function(
|
|
556
|
+
var _ref = _asyncToGenerator(function(options2) {
|
|
550
557
|
var MWANewAction;
|
|
551
558
|
return __generator(this, function(_state) {
|
|
552
559
|
switch(_state.label){
|
|
@@ -559,8 +566,8 @@ var src_default = function() {
|
|
|
559
566
|
MWANewAction = _state.sent().MWANewAction;
|
|
560
567
|
return [
|
|
561
568
|
4,
|
|
562
|
-
MWANewAction(_objectSpreadProps(_objectSpread({},
|
|
563
|
-
locale:
|
|
569
|
+
MWANewAction(_objectSpreadProps(_objectSpread({}, options2), {
|
|
570
|
+
locale: options2.lang || locale
|
|
564
571
|
}))
|
|
565
572
|
];
|
|
566
573
|
case 2:
|
|
@@ -571,12 +578,12 @@ var src_default = function() {
|
|
|
571
578
|
}
|
|
572
579
|
});
|
|
573
580
|
});
|
|
574
|
-
return function(
|
|
581
|
+
return function(options2) {
|
|
575
582
|
return _ref.apply(this, arguments);
|
|
576
583
|
};
|
|
577
584
|
}());
|
|
578
585
|
program.command("inspect").description("inspect internal webpack config").option("--env <env>", i18n.t(localeKeys.command.inspect.env), "development").option("--output <output>", i18n.t(localeKeys.command.inspect.output), "/").option("--verbose", i18n.t(localeKeys.command.inspect.verbose)).option("-c --config <config>", i18n.t(localeKeys.command.shared.config)).action(function() {
|
|
579
|
-
var _ref = _asyncToGenerator(function(
|
|
586
|
+
var _ref = _asyncToGenerator(function(options2) {
|
|
580
587
|
var inspect;
|
|
581
588
|
return __generator(this, function(_state) {
|
|
582
589
|
switch(_state.label){
|
|
@@ -587,14 +594,14 @@ var src_default = function() {
|
|
|
587
594
|
];
|
|
588
595
|
case 1:
|
|
589
596
|
inspect = _state.sent().inspect;
|
|
590
|
-
inspect(api,
|
|
597
|
+
inspect(api, options2);
|
|
591
598
|
return [
|
|
592
599
|
2
|
|
593
600
|
];
|
|
594
601
|
}
|
|
595
602
|
});
|
|
596
603
|
});
|
|
597
|
-
return function(
|
|
604
|
+
return function(options2) {
|
|
598
605
|
return _ref.apply(this, arguments);
|
|
599
606
|
};
|
|
600
607
|
}());
|
|
@@ -176,16 +176,16 @@ var __generator = this && this.__generator || function(thisArg, body) {
|
|
|
176
176
|
};
|
|
177
177
|
import { ensureAbsolutePath, getPort, isDev, isDevCommand } from "@modern-js/utils";
|
|
178
178
|
import { legacySchema, schema } from "../schema";
|
|
179
|
-
import { transformNormalizedConfig } from "../config
|
|
180
|
-
|
|
181
|
-
var
|
|
179
|
+
import { checkIsLegacyConfig, createDefaultConfig, createLegacyDefaultConfig, transformNormalizedConfig } from "../config";
|
|
180
|
+
var initialize_default = function(param) {
|
|
181
|
+
var bundler = param.bundler;
|
|
182
182
|
return {
|
|
183
183
|
name: "@modern-js/plugin-initialize",
|
|
184
184
|
setup: function setup(api) {
|
|
185
185
|
var config = function() {
|
|
186
186
|
var appContext = api.useAppContext();
|
|
187
187
|
var userConfig = api.useConfigContext();
|
|
188
|
-
return checkIsLegacyConfig(userConfig) ? createLegacyDefaultConfig(appContext) : createDefaultConfig(appContext);
|
|
188
|
+
return checkIsLegacyConfig(userConfig) ? createLegacyDefaultConfig(appContext) : createDefaultConfig(appContext, bundler);
|
|
189
189
|
};
|
|
190
190
|
var validateSchema = function() {
|
|
191
191
|
var userConfig = api.useConfigContext();
|
|
@@ -198,7 +198,7 @@ var initialize_default = function() {
|
|
|
198
198
|
resolvedConfig: function resolvedConfig(param) {
|
|
199
199
|
var resolved = param.resolved;
|
|
200
200
|
return _asyncToGenerator(function() {
|
|
201
|
-
var
|
|
201
|
+
var _resolved_output_distPath, appContext, userConfig, port, normalizedConfig;
|
|
202
202
|
return __generator(this, function(_state) {
|
|
203
203
|
switch(_state.label){
|
|
204
204
|
case 0:
|
|
@@ -212,35 +212,38 @@ var initialize_default = function() {
|
|
|
212
212
|
port = _state.sent();
|
|
213
213
|
appContext = _objectSpreadProps(_objectSpread({}, appContext), {
|
|
214
214
|
port: port,
|
|
215
|
-
distDirectory: ensureAbsolutePath(appContext.distDirectory, ((
|
|
215
|
+
distDirectory: ensureAbsolutePath(appContext.distDirectory, ((_resolved_output_distPath = resolved.output.distPath) === null || _resolved_output_distPath === void 0 ? void 0 : _resolved_output_distPath.root) || "dist")
|
|
216
216
|
});
|
|
217
217
|
api.setAppContext(appContext);
|
|
218
218
|
normalizedConfig = checkIsLegacyConfig(resolved) ? transformNormalizedConfig(resolved) : resolved;
|
|
219
|
+
resolved._raw = userConfig;
|
|
220
|
+
resolved.server = _objectSpreadProps(_objectSpread({}, normalizedConfig.server || {}), {
|
|
221
|
+
port: port
|
|
222
|
+
});
|
|
223
|
+
resolved.autoLoadPlugins = normalizedConfig.autoLoadPlugins || false;
|
|
224
|
+
stabilizeConfig(resolved, normalizedConfig, [
|
|
225
|
+
"source",
|
|
226
|
+
"bff",
|
|
227
|
+
"dev",
|
|
228
|
+
"html",
|
|
229
|
+
"output",
|
|
230
|
+
"tools",
|
|
231
|
+
"testing",
|
|
232
|
+
"plugins",
|
|
233
|
+
"builderPlugins",
|
|
234
|
+
"runtime",
|
|
235
|
+
"runtimeByEntries",
|
|
236
|
+
"deploy",
|
|
237
|
+
"performance"
|
|
238
|
+
]);
|
|
239
|
+
if (bundler === "webpack") {
|
|
240
|
+
resolved.security = normalizedConfig.security || {};
|
|
241
|
+
resolved.experiments = normalizedConfig.experiments;
|
|
242
|
+
}
|
|
219
243
|
return [
|
|
220
244
|
2,
|
|
221
245
|
{
|
|
222
|
-
resolved:
|
|
223
|
-
_raw: userConfig,
|
|
224
|
-
source: normalizedConfig.source || {},
|
|
225
|
-
server: _objectSpreadProps(_objectSpread({}, normalizedConfig.server || {}), {
|
|
226
|
-
port: port
|
|
227
|
-
}),
|
|
228
|
-
bff: normalizedConfig.bff || {},
|
|
229
|
-
dev: normalizedConfig.dev || {},
|
|
230
|
-
html: normalizedConfig.html || {},
|
|
231
|
-
output: normalizedConfig.output || {},
|
|
232
|
-
security: normalizedConfig.security || {},
|
|
233
|
-
tools: normalizedConfig.tools || {},
|
|
234
|
-
testing: normalizedConfig.testing || {},
|
|
235
|
-
plugins: normalizedConfig.plugins || [],
|
|
236
|
-
builderPlugins: normalizedConfig.builderPlugins || [],
|
|
237
|
-
runtime: normalizedConfig.runtime || {},
|
|
238
|
-
runtimeByEntries: normalizedConfig.runtimeByEntries || {},
|
|
239
|
-
deploy: normalizedConfig.deploy || {},
|
|
240
|
-
performance: normalizedConfig.performance || {},
|
|
241
|
-
experiments: normalizedConfig.experiments || {},
|
|
242
|
-
autoLoadPlugins: normalizedConfig.autoLoadPlugins || false
|
|
243
|
-
}
|
|
246
|
+
resolved: resolved
|
|
244
247
|
}
|
|
245
248
|
];
|
|
246
249
|
}
|
|
@@ -251,6 +254,11 @@ var initialize_default = function() {
|
|
|
251
254
|
}
|
|
252
255
|
};
|
|
253
256
|
};
|
|
257
|
+
function stabilizeConfig(resolve, config, keys) {
|
|
258
|
+
keys.forEach(function(key) {
|
|
259
|
+
resolve[key] = config[key] || {};
|
|
260
|
+
});
|
|
261
|
+
}
|
|
254
262
|
function getServerPort(config) {
|
|
255
263
|
return _getServerPort.apply(this, arguments);
|
|
256
264
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -275,11 +275,11 @@ var safeReplacer = function() {
|
|
|
275
275
|
};
|
|
276
276
|
var emitResolvedConfig = function() {
|
|
277
277
|
var _ref = _asyncToGenerator(function(appDirectory, resolvedConfig) {
|
|
278
|
-
var
|
|
278
|
+
var _resolvedConfig_output_distPath, outputPath;
|
|
279
279
|
return __generator(this, function(_state) {
|
|
280
280
|
switch(_state.label){
|
|
281
281
|
case 0:
|
|
282
|
-
outputPath = path.join(appDirectory, ((
|
|
282
|
+
outputPath = path.join(appDirectory, ((_resolvedConfig_output_distPath = resolvedConfig.output.distPath) === null || _resolvedConfig_output_distPath === void 0 ? void 0 : _resolvedConfig_output_distPath.root) || "./dist", OUTPUT_CONFIG_FILE);
|
|
283
283
|
return [
|
|
284
284
|
4,
|
|
285
285
|
fs.writeJSON(outputPath, resolvedConfig, {
|
|
@@ -179,7 +179,7 @@ function getServerInternalPlugins(api) {
|
|
|
179
179
|
}
|
|
180
180
|
function _getServerInternalPlugins() {
|
|
181
181
|
_getServerInternalPlugins = _asyncToGenerator(function(api) {
|
|
182
|
-
var hookRunners,
|
|
182
|
+
var hookRunners, _ref, serverPlugins, serverInternalPlugins;
|
|
183
183
|
return __generator(this, function(_state) {
|
|
184
184
|
switch(_state.label){
|
|
185
185
|
case 0:
|
|
@@ -191,7 +191,7 @@ function _getServerInternalPlugins() {
|
|
|
191
191
|
})
|
|
192
192
|
];
|
|
193
193
|
case 1:
|
|
194
|
-
|
|
194
|
+
_ref = _state.sent(), serverPlugins = _ref.plugins;
|
|
195
195
|
serverInternalPlugins = serverPlugins.reduce(function(result, plugin) {
|
|
196
196
|
return Object.assign(result, plugin);
|
|
197
197
|
}, {});
|
|
@@ -24,5 +24,5 @@ export interface SharedSourceConfig extends BuilderSharedSourceConfig {
|
|
|
24
24
|
|
|
25
25
|
designSystem?: Record<string, any>;
|
|
26
26
|
}
|
|
27
|
-
export
|
|
28
|
-
export
|
|
27
|
+
export type SourceUserConfig = BuilderSourceConfig & SharedSourceConfig;
|
|
28
|
+
export type RsSourceUserConfig = RsBuilderSourceConfig & SharedSourceConfig;
|
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"modern",
|
|
12
12
|
"modern.js"
|
|
13
13
|
],
|
|
14
|
-
"version": "2.
|
|
14
|
+
"version": "2.11.1-alpha.0",
|
|
15
15
|
"jsnext:source": "./src/index.ts",
|
|
16
16
|
"types": "./dist/types/index.d.ts",
|
|
17
17
|
"main": "./dist/cjs/index.js",
|
|
@@ -68,23 +68,23 @@
|
|
|
68
68
|
"@babel/types": "^7.18.0",
|
|
69
69
|
"es-module-lexer": "^1.1.0",
|
|
70
70
|
"esbuild": "0.15.7",
|
|
71
|
-
"@modern-js/builder": "2.
|
|
72
|
-
"@modern-js/builder-
|
|
73
|
-
"@modern-js/builder-plugin-node-polyfill": "2.
|
|
74
|
-
"@modern-js/builder-
|
|
75
|
-
"@modern-js/
|
|
76
|
-
"@modern-js/
|
|
77
|
-
"@modern-js/
|
|
78
|
-
"@modern-js/
|
|
79
|
-
"@modern-js/plugin
|
|
80
|
-
"@modern-js/plugin-lint": "2.
|
|
81
|
-
"@modern-js/plugin": "2.
|
|
82
|
-
"@modern-js/
|
|
83
|
-
"@modern-js/server": "2.
|
|
84
|
-
"@modern-js/
|
|
85
|
-
"@modern-js/upgrade": "2.
|
|
86
|
-
"@modern-js/utils": "2.
|
|
87
|
-
"@modern-js/
|
|
71
|
+
"@modern-js/builder": "2.11.0",
|
|
72
|
+
"@modern-js/builder-plugin-esbuild": "2.11.0",
|
|
73
|
+
"@modern-js/builder-plugin-node-polyfill": "2.11.0",
|
|
74
|
+
"@modern-js/builder-shared": "2.11.0",
|
|
75
|
+
"@modern-js/builder-webpack-provider": "2.11.0",
|
|
76
|
+
"@modern-js/core": "2.11.0",
|
|
77
|
+
"@modern-js/new-action": "2.11.0",
|
|
78
|
+
"@modern-js/node-bundle-require": "2.11.0",
|
|
79
|
+
"@modern-js/plugin": "2.11.0",
|
|
80
|
+
"@modern-js/plugin-lint": "2.11.0",
|
|
81
|
+
"@modern-js/plugin-i18n": "2.11.0",
|
|
82
|
+
"@modern-js/prod-server": "2.11.0",
|
|
83
|
+
"@modern-js/server": "2.11.0",
|
|
84
|
+
"@modern-js/types": "2.11.0",
|
|
85
|
+
"@modern-js/upgrade": "2.11.0",
|
|
86
|
+
"@modern-js/utils": "2.11.0",
|
|
87
|
+
"@modern-js/plugin-data-loader": "2.11.0"
|
|
88
88
|
},
|
|
89
89
|
"devDependencies": {
|
|
90
90
|
"@types/babel__traverse": "^7.14.2",
|
|
@@ -93,14 +93,14 @@
|
|
|
93
93
|
"jest": "^29",
|
|
94
94
|
"typescript": "^4",
|
|
95
95
|
"webpack": "^5.76.2",
|
|
96
|
-
"@
|
|
97
|
-
"@modern-js/builder-
|
|
98
|
-
"@scripts/
|
|
99
|
-
"@modern-js/
|
|
100
|
-
"@
|
|
96
|
+
"@scripts/build": "2.11.0",
|
|
97
|
+
"@modern-js/builder-plugin-swc": "2.11.0",
|
|
98
|
+
"@scripts/jest-config": "2.11.0",
|
|
99
|
+
"@modern-js/server-core": "2.11.0",
|
|
100
|
+
"@modern-js/builder-rspack-provider": "2.11.0"
|
|
101
101
|
},
|
|
102
102
|
"peerDependencies": {
|
|
103
|
-
"@modern-js/builder-rspack-provider": "^2.
|
|
103
|
+
"@modern-js/builder-rspack-provider": "^2.11.0"
|
|
104
104
|
},
|
|
105
105
|
"peerDependenciesMeta": {
|
|
106
106
|
"@modern-js/builder-rspack-provider": {
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { slash } from "@modern-js/utils";
|
|
2
|
-
function loader(source) {
|
|
3
|
-
this.cacheable();
|
|
4
|
-
const { target } = this._compiler.options;
|
|
5
|
-
if (target === "node" || Array.isArray(target) && target.includes("node")) {
|
|
6
|
-
return source;
|
|
7
|
-
}
|
|
8
|
-
const { resourcePath } = this;
|
|
9
|
-
const code = `
|
|
10
|
-
export { default } from "${slash(resourcePath)}";
|
|
11
|
-
`;
|
|
12
|
-
return code;
|
|
13
|
-
}
|
|
14
|
-
var routerLoader_default = loader;
|
|
15
|
-
export {
|
|
16
|
-
routerLoader_default as default
|
|
17
|
-
};
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
class HtmlAsyncChunkPlugin {
|
|
2
|
-
constructor(htmlWebpackPlugin) {
|
|
3
|
-
this.name = "HtmlAsyncChunkPlugin";
|
|
4
|
-
this.htmlWebpackPlugin = htmlWebpackPlugin;
|
|
5
|
-
}
|
|
6
|
-
apply(compiler) {
|
|
7
|
-
compiler.hooks.compilation.tap(
|
|
8
|
-
this.name,
|
|
9
|
-
(compilation) => {
|
|
10
|
-
const hooks = this.htmlWebpackPlugin.getHooks(compilation);
|
|
11
|
-
hooks.alterAssetTagGroups.tap(this.name, (assets) => {
|
|
12
|
-
const tags = [...assets.headTags, ...assets.bodyTags];
|
|
13
|
-
for (const tag of tags) {
|
|
14
|
-
if (tag.tagName === "script") {
|
|
15
|
-
const { attributes } = tag;
|
|
16
|
-
if (attributes && attributes.defer === true) {
|
|
17
|
-
attributes.async = true;
|
|
18
|
-
delete attributes.defer;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
return assets;
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
export {
|
|
29
|
-
HtmlAsyncChunkPlugin
|
|
30
|
-
};
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
class BottomTemplatePlugin {
|
|
2
|
-
constructor(htmlWebpackPlugin) {
|
|
3
|
-
this.bottomTemplateReg = /<!--<\?-\s*bottomTemplate\s*\?>-->/;
|
|
4
|
-
this.bodyRegExp = /(<\/\s*body\s*>)/i;
|
|
5
|
-
this.htmlWebpackPlugin = htmlWebpackPlugin;
|
|
6
|
-
this.name = "bottom-template";
|
|
7
|
-
}
|
|
8
|
-
apply(compiler) {
|
|
9
|
-
compiler.hooks.compilation.tap(
|
|
10
|
-
this.name,
|
|
11
|
-
(compilation) => {
|
|
12
|
-
this.htmlWebpackPlugin.getHooks(compilation).beforeEmit.tap(this.name, (data) => {
|
|
13
|
-
var _a;
|
|
14
|
-
if (!((_a = data.plugin.options) == null ? void 0 : _a.__internal__)) {
|
|
15
|
-
return data;
|
|
16
|
-
}
|
|
17
|
-
if (this.bottomTemplateReg.test(data.html)) {
|
|
18
|
-
data.html = data.html.replace(this.bottomTemplateReg, "");
|
|
19
|
-
const { bottomTemplate } = data.plugin.options;
|
|
20
|
-
if (bottomTemplate) {
|
|
21
|
-
data.html = data.html.replace(
|
|
22
|
-
this.bodyRegExp,
|
|
23
|
-
(match) => `
|
|
24
|
-
${bottomTemplate}
|
|
25
|
-
${match}`
|
|
26
|
-
);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
return data;
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
);
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
export {
|
|
36
|
-
BottomTemplatePlugin
|
|
37
|
-
};
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { initHtmlConfig, initSourceConfig, initToolsConfig } from "./inits";
|
|
2
|
-
import { transformNormalizedConfig } from "./transformNormalizedConfig";
|
|
3
|
-
function checkIsLegacyConfig(config) {
|
|
4
|
-
return Boolean(config.legacy);
|
|
5
|
-
}
|
|
6
|
-
function initialNormalizedConfig(config, appContext) {
|
|
7
|
-
initHtmlConfig(config, appContext);
|
|
8
|
-
initSourceConfig(config, appContext);
|
|
9
|
-
initToolsConfig(config);
|
|
10
|
-
return config;
|
|
11
|
-
}
|
|
12
|
-
export {
|
|
13
|
-
checkIsLegacyConfig,
|
|
14
|
-
initialNormalizedConfig,
|
|
15
|
-
transformNormalizedConfig
|
|
16
|
-
};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { slash } from "@modern-js/utils";
|
|
2
|
-
function loader(source) {
|
|
3
|
-
this.cacheable();
|
|
4
|
-
var target = this._compiler.options.target;
|
|
5
|
-
if (target === "node" || Array.isArray(target) && target.includes("node")) {
|
|
6
|
-
return source;
|
|
7
|
-
}
|
|
8
|
-
var resourcePath = this.resourcePath;
|
|
9
|
-
var code = '\n export { default } from "'.concat(slash(resourcePath), '";\n ');
|
|
10
|
-
return code;
|
|
11
|
-
}
|
|
12
|
-
var routerLoader_default = loader;
|
|
13
|
-
export { routerLoader_default as default };
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
function createHtmlConfig(config) {
|
|
2
|
-
var _output = config.output, disableHtmlFolder = _output.disableHtmlFolder, favicon = _output.favicon, faviconByEntries = _output.faviconByEntries, inject = _output.inject, injectByEntries = _output.injectByEntries, meta = _output.meta, metaByEntries = _output.metaByEntries, mountId = _output.mountId, title = _output.title, titleByEntries = _output.titleByEntries, templateParameters = _output.templateParameters, templateParametersByEntries = _output.templateParametersByEntries, crossorigin = _output.crossorigin;
|
|
3
|
-
return {
|
|
4
|
-
disableHtmlFolder: disableHtmlFolder,
|
|
5
|
-
favicon: favicon,
|
|
6
|
-
faviconByEntries: faviconByEntries,
|
|
7
|
-
inject: inject,
|
|
8
|
-
injectByEntries: injectByEntries,
|
|
9
|
-
meta: meta,
|
|
10
|
-
metaByEntries: metaByEntries,
|
|
11
|
-
mountId: mountId,
|
|
12
|
-
title: title,
|
|
13
|
-
titleByEntries: titleByEntries,
|
|
14
|
-
crossorigin: crossorigin,
|
|
15
|
-
templateParameters: templateParameters,
|
|
16
|
-
templateParametersByEntries: templateParametersByEntries
|
|
17
|
-
};
|
|
18
|
-
}
|
|
19
|
-
export { createHtmlConfig };
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { initHtmlConfig, initSourceConfig, initToolsConfig } from "./inits";
|
|
2
|
-
import { transformNormalizedConfig } from "./transformNormalizedConfig";
|
|
3
|
-
function checkIsLegacyConfig(config) {
|
|
4
|
-
return Boolean(config.legacy);
|
|
5
|
-
}
|
|
6
|
-
function initialNormalizedConfig(config, appContext) {
|
|
7
|
-
initHtmlConfig(config, appContext);
|
|
8
|
-
initSourceConfig(config, appContext);
|
|
9
|
-
initToolsConfig(config);
|
|
10
|
-
return config;
|
|
11
|
-
}
|
|
12
|
-
export { checkIsLegacyConfig, initialNormalizedConfig, transformNormalizedConfig };
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|