@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
|
@@ -44,19 +44,21 @@ import {
|
|
|
44
44
|
isDevCommand
|
|
45
45
|
} from "@modern-js/utils";
|
|
46
46
|
import { legacySchema, schema } from "../schema";
|
|
47
|
-
import { transformNormalizedConfig } from "../config/initial/transformNormalizedConfig";
|
|
48
47
|
import {
|
|
49
48
|
checkIsLegacyConfig,
|
|
50
49
|
createDefaultConfig,
|
|
51
|
-
createLegacyDefaultConfig
|
|
50
|
+
createLegacyDefaultConfig,
|
|
51
|
+
transformNormalizedConfig
|
|
52
52
|
} from "../config";
|
|
53
|
-
var initialize_default = (
|
|
53
|
+
var initialize_default = ({
|
|
54
|
+
bundler
|
|
55
|
+
}) => ({
|
|
54
56
|
name: "@modern-js/plugin-initialize",
|
|
55
57
|
setup(api) {
|
|
56
58
|
const config = () => {
|
|
57
59
|
const appContext = api.useAppContext();
|
|
58
60
|
const userConfig = api.useConfigContext();
|
|
59
|
-
return checkIsLegacyConfig(userConfig) ? createLegacyDefaultConfig(appContext) : createDefaultConfig(appContext);
|
|
61
|
+
return checkIsLegacyConfig(userConfig) ? createLegacyDefaultConfig(appContext) : createDefaultConfig(appContext, bundler);
|
|
60
62
|
};
|
|
61
63
|
const validateSchema = () => {
|
|
62
64
|
const userConfig = api.useConfigContext();
|
|
@@ -81,35 +83,41 @@ var initialize_default = () => ({
|
|
|
81
83
|
});
|
|
82
84
|
api.setAppContext(appContext);
|
|
83
85
|
const normalizedConfig = checkIsLegacyConfig(resolved) ? transformNormalizedConfig(resolved) : resolved;
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
}
|
|
86
|
+
resolved._raw = userConfig;
|
|
87
|
+
resolved.server = __spreadProps(__spreadValues({}, normalizedConfig.server || {}), {
|
|
88
|
+
port
|
|
89
|
+
});
|
|
90
|
+
resolved.autoLoadPlugins = normalizedConfig.autoLoadPlugins || false;
|
|
91
|
+
stabilizeConfig(resolved, normalizedConfig, [
|
|
92
|
+
"source",
|
|
93
|
+
"bff",
|
|
94
|
+
"dev",
|
|
95
|
+
"html",
|
|
96
|
+
"output",
|
|
97
|
+
"tools",
|
|
98
|
+
"testing",
|
|
99
|
+
"plugins",
|
|
100
|
+
"builderPlugins",
|
|
101
|
+
"runtime",
|
|
102
|
+
"runtimeByEntries",
|
|
103
|
+
"deploy",
|
|
104
|
+
"performance"
|
|
105
|
+
]);
|
|
106
|
+
if (bundler === "webpack") {
|
|
107
|
+
resolved.security = normalizedConfig.security || {};
|
|
108
|
+
resolved.experiments = normalizedConfig.experiments;
|
|
109
|
+
}
|
|
110
|
+
return { resolved };
|
|
108
111
|
});
|
|
109
112
|
}
|
|
110
113
|
};
|
|
111
114
|
}
|
|
112
115
|
});
|
|
116
|
+
function stabilizeConfig(resolve, config, keys) {
|
|
117
|
+
keys.forEach((key) => {
|
|
118
|
+
resolve[key] = config[key] || {};
|
|
119
|
+
});
|
|
120
|
+
}
|
|
113
121
|
function getServerPort(config) {
|
|
114
122
|
return __async(this, null, function* () {
|
|
115
123
|
const prodPort = config.server.port || 8080;
|
|
@@ -17,7 +17,7 @@ const ZH_LOCALE = {
|
|
|
17
17
|
serve: { describe: "应用启动命令" },
|
|
18
18
|
deploy: { describe: "部署应用命令" },
|
|
19
19
|
new: {
|
|
20
|
-
describe: "
|
|
20
|
+
describe: "Web App 项目中执行生成器",
|
|
21
21
|
debug: "开启 Debug 模式,打印调试日志信息",
|
|
22
22
|
config: "生成器运行默认配置(JSON 字符串)",
|
|
23
23
|
distTag: "生成器使用特殊的 npm Tag 版本",
|
|
File without changes
|
|
@@ -66,16 +66,18 @@ module.exports = __toCommonJS(analyze_exports);
|
|
|
66
66
|
var path = __toESM(require("path"));
|
|
67
67
|
var import_utils = require("@modern-js/utils");
|
|
68
68
|
var import_lodash = require("@modern-js/utils/lodash");
|
|
69
|
-
var import_builder = require("../builder");
|
|
70
69
|
var import_printInstructions = require("../utils/printInstructions");
|
|
71
70
|
var import_routes = require("../utils/routes");
|
|
72
71
|
var import_config = require("../utils/config");
|
|
73
72
|
var import_getSelectedEntries = require("../utils/getSelectedEntries");
|
|
74
73
|
var import_config2 = require("../config");
|
|
74
|
+
var import_builder = require("../builder");
|
|
75
75
|
var import_utils2 = require("./utils");
|
|
76
76
|
var import_constants = require("./constants");
|
|
77
77
|
const debug = (0, import_utils.createDebugger)("plugin-analyze");
|
|
78
|
-
var analyze_default = (
|
|
78
|
+
var analyze_default = ({
|
|
79
|
+
bundler
|
|
80
|
+
}) => ({
|
|
79
81
|
name: "@modern-js/plugin-analyze",
|
|
80
82
|
setup: (api) => {
|
|
81
83
|
let pagesDir = [];
|
|
@@ -167,56 +169,51 @@ var analyze_default = () => ({
|
|
|
167
169
|
if (buildCommands.includes(command)) {
|
|
168
170
|
let _b;
|
|
169
171
|
const normalizedConfig = api.useResolvedConfigContext();
|
|
170
|
-
const
|
|
172
|
+
const createBuilderForModern = yield (0, import_builder.createBuilderGenerator)(bundler);
|
|
173
|
+
const builder = yield createBuilderForModern({
|
|
171
174
|
normalizedConfig,
|
|
172
175
|
appContext,
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
(0, import_printInstructions.printInstructions)(
|
|
198
|
-
hookRunners2,
|
|
199
|
-
appContext,
|
|
200
|
-
normalizedConfig
|
|
201
|
-
);
|
|
202
|
-
}
|
|
176
|
+
onBeforeBuild(_0) {
|
|
177
|
+
return __async(this, arguments, function* ({ bundlerConfigs }) {
|
|
178
|
+
const hookRunners2 = api.useHookRunners();
|
|
179
|
+
yield (0, import_routes.generateRoutes)(appContext);
|
|
180
|
+
yield hookRunners2.beforeBuild({ bundlerConfigs });
|
|
181
|
+
});
|
|
182
|
+
},
|
|
183
|
+
onAfterBuild(_0) {
|
|
184
|
+
return __async(this, arguments, function* ({ stats }) {
|
|
185
|
+
const hookRunners2 = api.useHookRunners();
|
|
186
|
+
yield hookRunners2.afterBuild({ stats });
|
|
187
|
+
yield (0, import_config.emitResolvedConfig)(
|
|
188
|
+
appContext.appDirectory,
|
|
189
|
+
normalizedConfig
|
|
190
|
+
);
|
|
191
|
+
});
|
|
192
|
+
},
|
|
193
|
+
onDevCompileDone(_0) {
|
|
194
|
+
return __async(this, arguments, function* ({ isFirstCompile }) {
|
|
195
|
+
const hookRunners2 = api.useHookRunners();
|
|
196
|
+
if (process.stdout.isTTY || isFirstCompile) {
|
|
197
|
+
hookRunners2.afterDev();
|
|
198
|
+
if (isFirstCompile) {
|
|
199
|
+
(0, import_printInstructions.printInstructions)(hookRunners2, appContext, normalizedConfig);
|
|
203
200
|
}
|
|
201
|
+
}
|
|
202
|
+
});
|
|
203
|
+
},
|
|
204
|
+
onBeforeCreateCompiler(_0) {
|
|
205
|
+
return __async(this, arguments, function* ({ bundlerConfigs }) {
|
|
206
|
+
const hookRunners2 = api.useHookRunners();
|
|
207
|
+
yield hookRunners2.beforeCreateCompiler({
|
|
208
|
+
bundlerConfigs
|
|
204
209
|
});
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
});
|
|
213
|
-
},
|
|
214
|
-
onAfterCreateCompiler(_0) {
|
|
215
|
-
return __async(this, arguments, function* ({ compiler }) {
|
|
216
|
-
const hookRunners2 = api.useHookRunners();
|
|
217
|
-
yield hookRunners2.afterCreateCompiler({ compiler });
|
|
218
|
-
});
|
|
219
|
-
}
|
|
210
|
+
});
|
|
211
|
+
},
|
|
212
|
+
onAfterCreateCompiler(_0) {
|
|
213
|
+
return __async(this, arguments, function* ({ compiler }) {
|
|
214
|
+
const hookRunners2 = api.useHookRunners();
|
|
215
|
+
yield hookRunners2.afterCreateCompiler({ compiler });
|
|
216
|
+
});
|
|
220
217
|
}
|
|
221
218
|
});
|
|
222
219
|
builder.addPlugins(resolvedConfig.builderPlugins);
|
|
@@ -259,7 +256,7 @@ var analyze_default = () => ({
|
|
|
259
256
|
},
|
|
260
257
|
resolvedConfig({ resolved }) {
|
|
261
258
|
const appContext = api.useAppContext();
|
|
262
|
-
const config = (0, import_config2.initialNormalizedConfig)(resolved, appContext);
|
|
259
|
+
const config = (0, import_config2.initialNormalizedConfig)(resolved, appContext, bundler);
|
|
263
260
|
return {
|
|
264
261
|
resolved: config
|
|
265
262
|
};
|
|
@@ -183,7 +183,7 @@ const walk = (dirname, rootDir, alias, entryName) => __async(void 0, null, funct
|
|
|
183
183
|
route.error = (0, import_utils2.replaceWithAlias)(alias.basename, itemPath, alias.name);
|
|
184
184
|
}
|
|
185
185
|
}
|
|
186
|
-
|
|
186
|
+
let finalRoute = createRoute(
|
|
187
187
|
route,
|
|
188
188
|
rootDir,
|
|
189
189
|
path.join(dirname, `${import_constants.NESTED_ROUTE.LAYOUT_FILE}.ts`),
|
|
@@ -196,6 +196,15 @@ const walk = (dirname, rootDir, alias, entryName) => __async(void 0, null, funct
|
|
|
196
196
|
if (route.children && route.children.length === 0 && !route.index) {
|
|
197
197
|
return null;
|
|
198
198
|
}
|
|
199
|
+
if (finalRoute.children && finalRoute.children.length === 1 && !finalRoute._component) {
|
|
200
|
+
const childRoute = finalRoute.children[0];
|
|
201
|
+
if (childRoute.path === "*") {
|
|
202
|
+
const path2 = `${finalRoute.path || ""}/${childRoute.path || ""}`;
|
|
203
|
+
finalRoute = __spreadProps(__spreadValues({}, childRoute), {
|
|
204
|
+
path: path2
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
}
|
|
199
208
|
return finalRoute;
|
|
200
209
|
});
|
|
201
210
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -228,7 +228,6 @@ const fileSystemRoutes = (_0) => __async(void 0, [_0], function* ({
|
|
|
228
228
|
import loadable, { lazy as loadableLazy } from "@modern-js/runtime/loadable"
|
|
229
229
|
`;
|
|
230
230
|
let rootLayoutCode = ``;
|
|
231
|
-
let componentLoaderPath = "";
|
|
232
231
|
const getDataLoaderPath = (loaderId) => {
|
|
233
232
|
if (!ssrMode) {
|
|
234
233
|
return "";
|
|
@@ -241,12 +240,6 @@ const fileSystemRoutes = (_0) => __async(void 0, [_0], function* ({
|
|
|
241
240
|
}
|
|
242
241
|
return dataLoaderPath;
|
|
243
242
|
};
|
|
244
|
-
if (ssrMode) {
|
|
245
|
-
componentLoaderPath = `${import_path.default.join(
|
|
246
|
-
__dirname,
|
|
247
|
-
"../builder/loaders/routerLoader"
|
|
248
|
-
)}!`;
|
|
249
|
-
}
|
|
250
243
|
const traverseRouteTree = (route) => {
|
|
251
244
|
var _a;
|
|
252
245
|
let children;
|
|
@@ -282,10 +275,10 @@ const fileSystemRoutes = (_0) => __async(void 0, [_0], function* ({
|
|
|
282
275
|
rootLayoutCode = `import RootLayout from '${route._component}'`;
|
|
283
276
|
component = `RootLayout`;
|
|
284
277
|
} else if (ssrMode === "string") {
|
|
285
|
-
lazyImport = `() => import(/* webpackChunkName: "${route.id}" */ '${
|
|
278
|
+
lazyImport = `() => import(/* webpackChunkName: "${route.id}" */ '${route._component}')`;
|
|
286
279
|
component = `loadable(${lazyImport})`;
|
|
287
280
|
} else {
|
|
288
|
-
lazyImport = `() => import(/* webpackChunkName: "${route.id}" */ '${
|
|
281
|
+
lazyImport = `() => import(/* webpackChunkName: "${route.id}" */ '${route._component}')`;
|
|
289
282
|
component = `lazy(${lazyImport})`;
|
|
290
283
|
}
|
|
291
284
|
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var builder_rspack_exports = {};
|
|
19
|
+
__export(builder_rspack_exports, {
|
|
20
|
+
createRspackBuilderForModern: () => createRspackBuilderForModern
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(builder_rspack_exports);
|
|
23
|
+
var import_builder_rspack_provider = require("@modern-js/builder-rspack-provider");
|
|
24
|
+
var import_generator = require("../generator");
|
|
25
|
+
function createRspackBuilderForModern(options) {
|
|
26
|
+
return (0, import_generator.generateBuilder)(options, import_builder_rspack_provider.builderRspackProvider);
|
|
27
|
+
}
|
|
28
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
29
|
+
0 && (module.exports = {
|
|
30
|
+
createRspackBuilderForModern
|
|
31
|
+
});
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var compatModern_exports = {};
|
|
19
|
+
__export(compatModern_exports, {
|
|
20
|
+
PluginCompatModern: () => PluginCompatModern
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(compatModern_exports);
|
|
23
|
+
var import_path = require("path");
|
|
24
|
+
var import_shared = require("../../shared");
|
|
25
|
+
var import_webpackPlugins = require("../webpackPlugins");
|
|
26
|
+
const PluginCompatModern = (options) => ({
|
|
27
|
+
name: "builder-plugin-compat-modern",
|
|
28
|
+
setup(api) {
|
|
29
|
+
const { normalizedConfig: modernConfig, appContext } = options;
|
|
30
|
+
api.modifyWebpackChain((chain, { CHAIN_ID }) => {
|
|
31
|
+
var _a;
|
|
32
|
+
chain.resolve.modules.add("node_modules").add((0, import_path.join)(api.context.rootPath, "node_modules"));
|
|
33
|
+
if (chain.plugins.has(CHAIN_ID.PLUGIN.COPY)) {
|
|
34
|
+
const defaultCopyPattern = (0, import_shared.createCopyPattern)(
|
|
35
|
+
appContext,
|
|
36
|
+
modernConfig,
|
|
37
|
+
"public",
|
|
38
|
+
chain
|
|
39
|
+
);
|
|
40
|
+
chain.plugin(CHAIN_ID.PLUGIN.COPY).tap((args) => {
|
|
41
|
+
var _a2;
|
|
42
|
+
return [
|
|
43
|
+
{
|
|
44
|
+
patterns: [...((_a2 = args[0]) == null ? void 0 : _a2.patterns) || [], defaultCopyPattern]
|
|
45
|
+
}
|
|
46
|
+
];
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
const { entrypoints } = appContext;
|
|
50
|
+
const existNestedRoutes = entrypoints.some(
|
|
51
|
+
(entrypoint) => entrypoint.nestedRoutesEntry
|
|
52
|
+
);
|
|
53
|
+
const routerConfig = (_a = modernConfig == null ? void 0 : modernConfig.runtime) == null ? void 0 : _a.router;
|
|
54
|
+
const routerManifest = Boolean(routerConfig == null ? void 0 : routerConfig.manifest);
|
|
55
|
+
if (existNestedRoutes || routerManifest) {
|
|
56
|
+
chain.plugin("route-plugin").use(import_webpackPlugins.RouterPlugin);
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
62
|
+
0 && (module.exports = {
|
|
63
|
+
PluginCompatModern
|
|
64
|
+
});
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __defProps = Object.defineProperties;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
8
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
9
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
10
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
11
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
12
|
+
var __spreadValues = (a, b) => {
|
|
13
|
+
for (var prop in b || (b = {}))
|
|
14
|
+
if (__hasOwnProp.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
if (__getOwnPropSymbols)
|
|
17
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
18
|
+
if (__propIsEnum.call(b, prop))
|
|
19
|
+
__defNormalProp(a, prop, b[prop]);
|
|
20
|
+
}
|
|
21
|
+
return a;
|
|
22
|
+
};
|
|
23
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
24
|
+
var __export = (target, all) => {
|
|
25
|
+
for (var name in all)
|
|
26
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
27
|
+
};
|
|
28
|
+
var __copyProps = (to, from, except, desc) => {
|
|
29
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
30
|
+
for (let key of __getOwnPropNames(from))
|
|
31
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
32
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
33
|
+
}
|
|
34
|
+
return to;
|
|
35
|
+
};
|
|
36
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
37
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
38
|
+
mod
|
|
39
|
+
));
|
|
40
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
41
|
+
var __async = (__this, __arguments, generator) => {
|
|
42
|
+
return new Promise((resolve, reject) => {
|
|
43
|
+
var fulfilled = (value) => {
|
|
44
|
+
try {
|
|
45
|
+
step(generator.next(value));
|
|
46
|
+
} catch (e) {
|
|
47
|
+
reject(e);
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
var rejected = (value) => {
|
|
51
|
+
try {
|
|
52
|
+
step(generator.throw(value));
|
|
53
|
+
} catch (e) {
|
|
54
|
+
reject(e);
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
58
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
59
|
+
});
|
|
60
|
+
};
|
|
61
|
+
var builder_webpack_exports = {};
|
|
62
|
+
__export(builder_webpack_exports, {
|
|
63
|
+
createWebpackBuilderForModern: () => createWebpackBuilderForModern
|
|
64
|
+
});
|
|
65
|
+
module.exports = __toCommonJS(builder_webpack_exports);
|
|
66
|
+
var import_builder_webpack_provider = require("@modern-js/builder-webpack-provider");
|
|
67
|
+
var import_utils = require("@modern-js/utils");
|
|
68
|
+
var import_shared = require("../shared");
|
|
69
|
+
var import_generator = require("../generator");
|
|
70
|
+
var import_compatModern = require("./builderPlugins/compatModern");
|
|
71
|
+
function createWebpackBuilderForModern(options) {
|
|
72
|
+
return (0, import_generator.generateBuilder)(options, import_builder_webpack_provider.builderWebpackProvider, {
|
|
73
|
+
modifyBuilderConfig(config) {
|
|
74
|
+
modifyOutputConfig(config, options.appContext);
|
|
75
|
+
},
|
|
76
|
+
modifyBuilderInstance(builder) {
|
|
77
|
+
return __async(this, null, function* () {
|
|
78
|
+
yield applyBuilderPlugins(builder, options);
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
function modifyOutputConfig(config, appContext) {
|
|
84
|
+
config.output = createOutputConfig(config, appContext);
|
|
85
|
+
function createOutputConfig(config2, appContext2) {
|
|
86
|
+
const defaultCopyPattern = (0, import_shared.createCopyPattern)(appContext2, config2, "upload");
|
|
87
|
+
const { copy } = config2.output;
|
|
88
|
+
const copyOptions = Array.isArray(copy) ? copy : copy == null ? void 0 : copy.patterns;
|
|
89
|
+
const builderCopy = [...copyOptions || [], defaultCopyPattern];
|
|
90
|
+
return __spreadProps(__spreadValues({}, config2.output), {
|
|
91
|
+
copy: builderCopy
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
function applyBuilderPlugins(builder, options) {
|
|
96
|
+
return __async(this, null, function* () {
|
|
97
|
+
const { normalizedConfig } = options;
|
|
98
|
+
if (!normalizedConfig.output.disableNodePolyfill) {
|
|
99
|
+
const { PluginNodePolyfill } = yield Promise.resolve().then(() => __toESM(require("@modern-js/builder-plugin-node-polyfill")));
|
|
100
|
+
builder.addPlugins([PluginNodePolyfill()]);
|
|
101
|
+
}
|
|
102
|
+
if (normalizedConfig.tools.esbuild) {
|
|
103
|
+
const { esbuild: esbuildOptions } = normalizedConfig.tools;
|
|
104
|
+
const { PluginEsbuild } = yield Promise.resolve().then(() => __toESM(require("@modern-js/builder-plugin-esbuild")));
|
|
105
|
+
builder.addPlugins([
|
|
106
|
+
PluginEsbuild({
|
|
107
|
+
loader: false,
|
|
108
|
+
minimize: (0, import_utils.applyOptionsChain)({}, esbuildOptions)
|
|
109
|
+
})
|
|
110
|
+
]);
|
|
111
|
+
}
|
|
112
|
+
builder.addPlugins([(0, import_compatModern.PluginCompatModern)(options)]);
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
116
|
+
0 && (module.exports = {
|
|
117
|
+
createWebpackBuilderForModern
|
|
118
|
+
});
|
|
@@ -41,11 +41,11 @@ var __async = (__this, __arguments, generator) => {
|
|
|
41
41
|
step((generator = generator.apply(__this, __arguments)).next());
|
|
42
42
|
});
|
|
43
43
|
};
|
|
44
|
-
var
|
|
45
|
-
__export(
|
|
46
|
-
|
|
44
|
+
var RouterPlugin_exports = {};
|
|
45
|
+
__export(RouterPlugin_exports, {
|
|
46
|
+
RouterPlugin: () => RouterPlugin
|
|
47
47
|
});
|
|
48
|
-
module.exports = __toCommonJS(
|
|
48
|
+
module.exports = __toCommonJS(RouterPlugin_exports);
|
|
49
49
|
var import_path = __toESM(require("path"));
|
|
50
50
|
var import_utils = require("@modern-js/utils");
|
|
51
51
|
const PLUGIN_NAME = "ModernjsRoutePlugin";
|
|
@@ -132,4 +132,6 @@ class RouterPlugin {
|
|
|
132
132
|
}
|
|
133
133
|
}
|
|
134
134
|
// Annotate the CommonJS export names for ESM import in node:
|
|
135
|
-
0 && (module.exports = {
|
|
135
|
+
0 && (module.exports = {
|
|
136
|
+
RouterPlugin
|
|
137
|
+
});
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __copyProps = (to, from, except, desc) => {
|
|
6
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
7
|
+
for (let key of __getOwnPropNames(from))
|
|
8
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
9
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
10
|
+
}
|
|
11
|
+
return to;
|
|
12
|
+
};
|
|
13
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
+
var webpackPlugins_exports = {};
|
|
16
|
+
module.exports = __toCommonJS(webpackPlugins_exports);
|
|
17
|
+
__reExport(webpackPlugins_exports, require("./RouterPlugin"), module.exports);
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var createBuilderOptions_exports = {};
|
|
19
|
+
__export(createBuilderOptions_exports, {
|
|
20
|
+
createBuilderOptions: () => createBuilderOptions
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(createBuilderOptions_exports);
|
|
23
|
+
function createBuilderOptions(target, appContext) {
|
|
24
|
+
const entries = {};
|
|
25
|
+
const { entrypoints = [], checkedEntries } = appContext;
|
|
26
|
+
for (const { entryName, entry } of entrypoints) {
|
|
27
|
+
if (checkedEntries && !checkedEntries.includes(entryName)) {
|
|
28
|
+
continue;
|
|
29
|
+
}
|
|
30
|
+
if (entryName in entries) {
|
|
31
|
+
entries[entryName].push(entry);
|
|
32
|
+
} else {
|
|
33
|
+
entries[entryName] = [entry];
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
return {
|
|
37
|
+
cwd: appContext.appDirectory,
|
|
38
|
+
target,
|
|
39
|
+
configPath: appContext.configFile || void 0,
|
|
40
|
+
entry: entries,
|
|
41
|
+
framework: appContext.metaName
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
45
|
+
0 && (module.exports = {
|
|
46
|
+
createBuilderOptions
|
|
47
|
+
});
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defProps = Object.defineProperties;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
9
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
10
|
+
var __spreadValues = (a, b) => {
|
|
11
|
+
for (var prop in b || (b = {}))
|
|
12
|
+
if (__hasOwnProp.call(b, prop))
|
|
13
|
+
__defNormalProp(a, prop, b[prop]);
|
|
14
|
+
if (__getOwnPropSymbols)
|
|
15
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
16
|
+
if (__propIsEnum.call(b, prop))
|
|
17
|
+
__defNormalProp(a, prop, b[prop]);
|
|
18
|
+
}
|
|
19
|
+
return a;
|
|
20
|
+
};
|
|
21
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
22
|
+
var __export = (target, all) => {
|
|
23
|
+
for (var name in all)
|
|
24
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
25
|
+
};
|
|
26
|
+
var __copyProps = (to, from, except, desc) => {
|
|
27
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
28
|
+
for (let key of __getOwnPropNames(from))
|
|
29
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
30
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
31
|
+
}
|
|
32
|
+
return to;
|
|
33
|
+
};
|
|
34
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
35
|
+
var createBuilderProviderConfig_exports = {};
|
|
36
|
+
__export(createBuilderProviderConfig_exports, {
|
|
37
|
+
createBuilderProviderConfig: () => createBuilderProviderConfig
|
|
38
|
+
});
|
|
39
|
+
module.exports = __toCommonJS(createBuilderProviderConfig_exports);
|
|
40
|
+
function createBuilderProviderConfig(resolveConfig, appContext, modifyBuilderConfig) {
|
|
41
|
+
const htmlConfig = __spreadValues({}, resolveConfig.html);
|
|
42
|
+
if (!htmlConfig.template) {
|
|
43
|
+
htmlConfig.templateByEntries = __spreadValues(__spreadValues({}, htmlConfig.templateByEntries), appContext.htmlTemplates);
|
|
44
|
+
}
|
|
45
|
+
const config = __spreadProps(__spreadValues({}, resolveConfig), {
|
|
46
|
+
dev: __spreadProps(__spreadValues({}, resolveConfig.dev), {
|
|
47
|
+
port: appContext.port
|
|
48
|
+
}),
|
|
49
|
+
html: htmlConfig,
|
|
50
|
+
output: __spreadProps(__spreadValues({}, resolveConfig.output), {
|
|
51
|
+
cleanDistPath: false
|
|
52
|
+
})
|
|
53
|
+
});
|
|
54
|
+
modifyBuilderConfig == null ? void 0 : modifyBuilderConfig(config);
|
|
55
|
+
return config;
|
|
56
|
+
}
|
|
57
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
58
|
+
0 && (module.exports = {
|
|
59
|
+
createBuilderProviderConfig
|
|
60
|
+
});
|