@modern-js/app-tools 2.21.0 → 2.22.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 +79 -0
- package/dist/cjs/analyze/constants.js +66 -22
- package/dist/cjs/analyze/generateCode.js +48 -24
- package/dist/cjs/analyze/getBundleEntry.js +3 -1
- package/dist/cjs/analyze/getClientRoutes/getRoutes.js +3 -1
- package/dist/cjs/analyze/getClientRoutes/getRoutesLegacy.js +3 -1
- package/dist/cjs/analyze/getClientRoutes/index.js +6 -2
- package/dist/cjs/analyze/getClientRoutes/utils.js +12 -4
- package/dist/cjs/analyze/getFileSystemEntry.js +3 -1
- package/dist/cjs/analyze/getHtmlTemplate.js +3 -1
- package/dist/cjs/analyze/getServerRoutes.js +3 -1
- package/dist/cjs/analyze/index.js +13 -2
- package/dist/cjs/analyze/isDefaultExportFunction.js +3 -1
- package/dist/cjs/analyze/makeLegalIdentifier.js +3 -1
- package/dist/cjs/analyze/nestedRoutes.js +3 -1
- package/dist/cjs/analyze/templates.js +18 -6
- package/dist/cjs/analyze/utils.js +24 -8
- package/dist/cjs/builder/builder-rspack/adapterCopy.js +3 -1
- package/dist/cjs/builder/builder-rspack/index.js +3 -1
- package/dist/cjs/builder/builder-webpack/adapterModern.js +3 -1
- package/dist/cjs/builder/builder-webpack/createCopyPattern.js +6 -2
- package/dist/cjs/builder/builder-webpack/index.js +3 -1
- package/dist/cjs/builder/generator/createBuilderOptions.js +7 -4
- package/dist/cjs/builder/generator/createBuilderProviderConfig.js +5 -3
- package/dist/cjs/builder/generator/getBuilderTargets.js +3 -1
- package/dist/cjs/builder/generator/index.js +3 -1
- package/dist/cjs/builder/index.js +3 -1
- package/dist/cjs/builder/shared/builderPlugins/adapterBasic.js +6 -2
- package/dist/cjs/builder/shared/builderPlugins/adapterHtml.js +3 -1
- package/dist/cjs/builder/shared/builderPlugins/adapterSSR.js +3 -1
- package/dist/cjs/builder/shared/bundlerPlugins/HtmlAsyncChunkPlugin.js +3 -1
- package/dist/cjs/builder/shared/bundlerPlugins/HtmlBottomTemplate.js +3 -1
- package/dist/cjs/builder/shared/bundlerPlugins/RouterPlugin.js +29 -6
- package/dist/cjs/builder/shared/createCopyInfo.js +3 -1
- package/dist/cjs/builder/shared/loaders/serverModuleLoader.js +3 -1
- package/dist/cjs/commands/build.js +3 -1
- package/dist/cjs/commands/deploy.js +3 -1
- package/dist/cjs/commands/dev.js +3 -1
- package/dist/cjs/commands/inspect.js +3 -1
- package/dist/cjs/commands/serve.js +3 -1
- package/dist/cjs/config/default.js +6 -2
- package/dist/cjs/config/initialize/index.js +3 -1
- package/dist/cjs/config/initialize/inits.js +9 -3
- package/dist/cjs/config/legacy/createHtmlConfig.js +3 -1
- package/dist/cjs/config/legacy/createOutputConfig.js +3 -1
- package/dist/cjs/config/legacy/createSourceConfig.js +3 -1
- package/dist/cjs/config/legacy/createToolsConfig.js +3 -1
- package/dist/cjs/config/legacy/index.js +6 -2
- package/dist/cjs/defineConfig.js +6 -2
- package/dist/cjs/exports/server.js +3 -1
- package/dist/cjs/hooks.js +3 -1
- package/dist/cjs/index.js +12 -4
- package/dist/cjs/initialize/index.js +3 -1
- package/dist/cjs/locale/en.js +3 -1
- package/dist/cjs/locale/index.js +6 -2
- package/dist/cjs/locale/zh.js +3 -1
- package/dist/cjs/schema/Schema.js +3 -1
- package/dist/cjs/schema/index.js +6 -2
- package/dist/cjs/schema/legacy.js +3 -1
- package/dist/cjs/utils/config.js +12 -4
- package/dist/cjs/utils/createServer.js +15 -5
- package/dist/cjs/utils/env.js +3 -1
- package/dist/cjs/utils/generateWatchFiles.js +6 -2
- package/dist/cjs/utils/getSelectedEntries.js +3 -1
- package/dist/cjs/utils/getServerInternalPlugins.js +3 -1
- package/dist/cjs/utils/printInstructions.js +3 -1
- package/dist/cjs/utils/restart.js +3 -1
- package/dist/cjs/utils/routes.js +3 -1
- package/dist/esm/analyze/generateCode.js +131 -75
- package/dist/esm/analyze/index.js +17 -3
- package/dist/esm/builder/generator/createBuilderOptions.js +4 -3
- package/dist/esm/builder/generator/createBuilderProviderConfig.js +1 -1
- package/dist/esm/builder/shared/bundlerPlugins/RouterPlugin.js +126 -118
- package/dist/esm-node/analyze/generateCode.js +39 -22
- package/dist/esm-node/analyze/index.js +10 -1
- package/dist/esm-node/builder/generator/createBuilderOptions.js +4 -3
- package/dist/esm-node/builder/generator/createBuilderProviderConfig.js +2 -2
- package/dist/esm-node/builder/shared/bundlerPlugins/RouterPlugin.js +27 -6
- package/dist/types/analyze/generateCode.d.ts +19 -2
- package/dist/types/builder/shared/bundlerPlugins/RouterPlugin.d.ts +7 -0
- package/dist/types/types/hooks.d.ts +1 -0
- package/package.json +24 -24
|
@@ -4,7 +4,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
});
|
|
5
5
|
Object.defineProperty(exports, "getSelectedEntries", {
|
|
6
6
|
enumerable: true,
|
|
7
|
-
get: ()
|
|
7
|
+
get: function() {
|
|
8
|
+
return getSelectedEntries;
|
|
9
|
+
}
|
|
8
10
|
});
|
|
9
11
|
const _utils = require("@modern-js/utils");
|
|
10
12
|
const _locale = require("../locale");
|
|
@@ -4,7 +4,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
});
|
|
5
5
|
Object.defineProperty(exports, "getServerInternalPlugins", {
|
|
6
6
|
enumerable: true,
|
|
7
|
-
get: ()
|
|
7
|
+
get: function() {
|
|
8
|
+
return getServerInternalPlugins;
|
|
9
|
+
}
|
|
8
10
|
});
|
|
9
11
|
async function getServerInternalPlugins(api) {
|
|
10
12
|
const hookRunners = api.useHookRunners();
|
|
@@ -4,7 +4,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
});
|
|
5
5
|
Object.defineProperty(exports, "printInstructions", {
|
|
6
6
|
enumerable: true,
|
|
7
|
-
get: ()
|
|
7
|
+
get: function() {
|
|
8
|
+
return printInstructions;
|
|
9
|
+
}
|
|
8
10
|
});
|
|
9
11
|
const _utils = require("@modern-js/utils");
|
|
10
12
|
const printInstructions = async (hookRunners, appContext, config) => {
|
|
@@ -4,7 +4,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
});
|
|
5
5
|
Object.defineProperty(exports, "restart", {
|
|
6
6
|
enumerable: true,
|
|
7
|
-
get: ()
|
|
7
|
+
get: function() {
|
|
8
|
+
return restart;
|
|
9
|
+
}
|
|
8
10
|
});
|
|
9
11
|
const _core = require("@modern-js/core");
|
|
10
12
|
const _utils = require("@modern-js/utils");
|
package/dist/cjs/utils/routes.js
CHANGED
|
@@ -4,7 +4,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
});
|
|
5
5
|
Object.defineProperty(exports, "generateRoutes", {
|
|
6
6
|
enumerable: true,
|
|
7
|
-
get: ()
|
|
7
|
+
get: function() {
|
|
8
|
+
return generateRoutes;
|
|
9
|
+
}
|
|
8
10
|
});
|
|
9
11
|
const _interop_require_default = require("@swc/helpers/_/_interop_require_default");
|
|
10
12
|
const _path = /* @__PURE__ */ _interop_require_default._(require("path"));
|
|
@@ -94,21 +94,21 @@ export var createImportStatements = function(statements) {
|
|
|
94
94
|
};
|
|
95
95
|
export var generateCode = function() {
|
|
96
96
|
var _ref = _async_to_generator(function(appContext, config, entrypoints, api) {
|
|
97
|
-
var internalDirectory, srcDirectory, internalDirAlias, internalSrcAlias, packageName, hookRunners, isV5,
|
|
97
|
+
var internalDirectory, srcDirectory, internalDirAlias, internalSrcAlias, packageName, hookRunners, isV5, getRoutes, importsStatemets;
|
|
98
98
|
function generateEntryCode(entrypoint) {
|
|
99
99
|
return _generateEntryCode.apply(this, arguments);
|
|
100
100
|
}
|
|
101
101
|
function _generateEntryCode() {
|
|
102
102
|
_generateEntryCode = _async_to_generator(function(entrypoint) {
|
|
103
|
-
var entryName, isAutoMount,
|
|
103
|
+
var entryName, isAutoMount, fileSystemRoutes, _config_output, initialRoutes, nestedRoute, routes, _$config, ssr, useSSG, mode, hasPageRoute, code, _, _tmp, routesServerFile, code1, serverLoaderCombined, serverLoaderFile, imports, entryFile;
|
|
104
104
|
return _ts_generator(this, function(_state) {
|
|
105
105
|
switch (_state.label) {
|
|
106
106
|
case 0:
|
|
107
|
-
entryName = entrypoint.entryName, isAutoMount = entrypoint.isAutoMount,
|
|
107
|
+
entryName = entrypoint.entryName, isAutoMount = entrypoint.isAutoMount, fileSystemRoutes = entrypoint.fileSystemRoutes;
|
|
108
108
|
if (!isAutoMount)
|
|
109
109
|
return [
|
|
110
110
|
3,
|
|
111
|
-
|
|
111
|
+
13
|
|
112
112
|
];
|
|
113
113
|
if (!fileSystemRoutes)
|
|
114
114
|
return [
|
|
@@ -248,76 +248,12 @@ export var generateCode = function() {
|
|
|
248
248
|
})
|
|
249
249
|
];
|
|
250
250
|
case 12:
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
4,
|
|
254
|
-
hookRunners.modifyEntryRuntimePlugins({
|
|
255
|
-
entrypoint: entrypoint,
|
|
256
|
-
plugins: []
|
|
257
|
-
})
|
|
258
|
-
];
|
|
259
|
-
case 13:
|
|
260
|
-
plugins = _state.sent().plugins;
|
|
261
|
-
return [
|
|
262
|
-
4,
|
|
263
|
-
hookRunners.modifyEntryRenderFunction({
|
|
264
|
-
entrypoint: entrypoint,
|
|
265
|
-
code: templates.renderFunction({
|
|
266
|
-
plugins: plugins,
|
|
267
|
-
customBootstrap: customBootstrap,
|
|
268
|
-
fileSystemRoutes: fileSystemRoutes
|
|
269
|
-
})
|
|
270
|
-
})
|
|
271
|
-
];
|
|
272
|
-
case 14:
|
|
273
|
-
_ref1 = _state.sent(), renderFunction = _ref1.code;
|
|
274
|
-
return [
|
|
275
|
-
4,
|
|
276
|
-
hookRunners.modifyEntryExport({
|
|
277
|
-
entrypoint: entrypoint,
|
|
278
|
-
exportStatement: "export default AppWrapper;"
|
|
279
|
-
})
|
|
280
|
-
];
|
|
281
|
-
case 15:
|
|
282
|
-
exportStatement = _state.sent().exportStatement;
|
|
283
|
-
code2 = templates.index({
|
|
284
|
-
mountId: mountId,
|
|
285
|
-
imports: createImportStatements(importStatements),
|
|
286
|
-
renderFunction: renderFunction,
|
|
287
|
-
exportStatement: exportStatement
|
|
288
|
-
});
|
|
251
|
+
imports = _state.sent().imports;
|
|
252
|
+
importsStatemets.set(entryName, imports);
|
|
289
253
|
entryFile = path.resolve(internalDirectory, "./".concat(entryName, "/").concat(ENTRY_POINT_FILE_NAME));
|
|
290
|
-
entrypoint.
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
3,
|
|
294
|
-
17
|
|
295
|
-
];
|
|
296
|
-
rawAsyncEntryCode = "import('./".concat(ENTRY_BOOTSTRAP_FILE_NAME, "');");
|
|
297
|
-
ssr1 = getEntryOptions(entryName, config.server.ssr, config.server.ssrByEntries, packageName);
|
|
298
|
-
if (ssr1) {
|
|
299
|
-
rawAsyncEntryCode = "\n export const ".concat(SERVER_RENDER_FUNCTION_NAME, " = async (...args) => {\n let entry = await ").concat(rawAsyncEntryCode, ";\n if (entry.default instanceof Promise){\n entry = await entry.default;\n return entry.default.").concat(SERVER_RENDER_FUNCTION_NAME, ".apply(null, args);\n }\n return entry.").concat(SERVER_RENDER_FUNCTION_NAME, ".apply(null, args);\n };\n if(typeof window!=='undefined'){\n ").concat(rawAsyncEntryCode, "\n }\n ");
|
|
300
|
-
}
|
|
301
|
-
return [
|
|
302
|
-
4,
|
|
303
|
-
hookRunners.modifyAsyncEntry({
|
|
304
|
-
entrypoint: entrypoint,
|
|
305
|
-
code: rawAsyncEntryCode
|
|
306
|
-
})
|
|
307
|
-
];
|
|
308
|
-
case 16:
|
|
309
|
-
_ref22 = _state.sent(), asyncEntryCode = _ref22.code;
|
|
310
|
-
fs.outputFileSync(entryFile, asyncEntryCode, "utf8");
|
|
311
|
-
bootstrapFile = path.resolve(internalDirectory, "./".concat(entryName, "/").concat(ENTRY_BOOTSTRAP_FILE_NAME));
|
|
312
|
-
fs.outputFileSync(bootstrapFile, code2, "utf8");
|
|
313
|
-
return [
|
|
314
|
-
3,
|
|
315
|
-
18
|
|
316
|
-
];
|
|
317
|
-
case 17:
|
|
318
|
-
fs.outputFileSync(entryFile, code2, "utf8");
|
|
319
|
-
_state.label = 18;
|
|
320
|
-
case 18:
|
|
254
|
+
entrypoint.internalEntry = entryFile;
|
|
255
|
+
_state.label = 13;
|
|
256
|
+
case 13:
|
|
321
257
|
return [
|
|
322
258
|
2
|
|
323
259
|
];
|
|
@@ -332,8 +268,8 @@ export var generateCode = function() {
|
|
|
332
268
|
internalDirectory = appContext.internalDirectory, srcDirectory = appContext.srcDirectory, internalDirAlias = appContext.internalDirAlias, internalSrcAlias = appContext.internalSrcAlias, packageName = appContext.packageName;
|
|
333
269
|
hookRunners = api.useHookRunners();
|
|
334
270
|
isV5 = isRouterV5(config);
|
|
335
|
-
mountId = config.html.mountId;
|
|
336
271
|
getRoutes = isV5 ? getClientRoutesLegacy : getClientRoutes;
|
|
272
|
+
importsStatemets = /* @__PURE__ */ new Map();
|
|
337
273
|
return [
|
|
338
274
|
4,
|
|
339
275
|
Promise.all(entrypoints.map(generateEntryCode))
|
|
@@ -341,7 +277,10 @@ export var generateCode = function() {
|
|
|
341
277
|
case 1:
|
|
342
278
|
_state.sent();
|
|
343
279
|
return [
|
|
344
|
-
2
|
|
280
|
+
2,
|
|
281
|
+
{
|
|
282
|
+
importsStatemets: importsStatemets
|
|
283
|
+
}
|
|
345
284
|
];
|
|
346
285
|
}
|
|
347
286
|
});
|
|
@@ -350,3 +289,120 @@ export var generateCode = function() {
|
|
|
350
289
|
return _ref.apply(this, arguments);
|
|
351
290
|
};
|
|
352
291
|
}();
|
|
292
|
+
export var generateIndexCode = function() {
|
|
293
|
+
var _ref = _async_to_generator(function(param) {
|
|
294
|
+
var appContext, api, entrypoints, config, importsStatemets, bundlerConfigs, hookRunners, mountId, internalDirectory, packageName;
|
|
295
|
+
return _ts_generator(this, function(_state) {
|
|
296
|
+
switch (_state.label) {
|
|
297
|
+
case 0:
|
|
298
|
+
appContext = param.appContext, api = param.api, entrypoints = param.entrypoints, config = param.config, importsStatemets = param.importsStatemets, bundlerConfigs = param.bundlerConfigs;
|
|
299
|
+
hookRunners = api.useHookRunners();
|
|
300
|
+
mountId = config.html.mountId;
|
|
301
|
+
internalDirectory = appContext.internalDirectory, packageName = appContext.packageName;
|
|
302
|
+
return [
|
|
303
|
+
4,
|
|
304
|
+
Promise.all(entrypoints.map(function() {
|
|
305
|
+
var _ref2 = _async_to_generator(function(entrypoint) {
|
|
306
|
+
var entryName, isAutoMount, customBootstrap, fileSystemRoutes, plugins, _ref3, renderFunction, exportStatement, imports, code, entryFile, rawAsyncEntryCode, ssr, _ref1, asyncEntryCode, bootstrapFile;
|
|
307
|
+
return _ts_generator(this, function(_state2) {
|
|
308
|
+
switch (_state2.label) {
|
|
309
|
+
case 0:
|
|
310
|
+
entryName = entrypoint.entryName, isAutoMount = entrypoint.isAutoMount, customBootstrap = entrypoint.customBootstrap, fileSystemRoutes = entrypoint.fileSystemRoutes;
|
|
311
|
+
if (!isAutoMount)
|
|
312
|
+
return [
|
|
313
|
+
3,
|
|
314
|
+
6
|
|
315
|
+
];
|
|
316
|
+
return [
|
|
317
|
+
4,
|
|
318
|
+
hookRunners.modifyEntryRuntimePlugins({
|
|
319
|
+
entrypoint: entrypoint,
|
|
320
|
+
plugins: [],
|
|
321
|
+
bundlerConfigs: bundlerConfigs
|
|
322
|
+
})
|
|
323
|
+
];
|
|
324
|
+
case 1:
|
|
325
|
+
plugins = _state2.sent().plugins;
|
|
326
|
+
return [
|
|
327
|
+
4,
|
|
328
|
+
hookRunners.modifyEntryRenderFunction({
|
|
329
|
+
entrypoint: entrypoint,
|
|
330
|
+
code: templates.renderFunction({
|
|
331
|
+
plugins: plugins,
|
|
332
|
+
customBootstrap: customBootstrap,
|
|
333
|
+
fileSystemRoutes: fileSystemRoutes
|
|
334
|
+
})
|
|
335
|
+
})
|
|
336
|
+
];
|
|
337
|
+
case 2:
|
|
338
|
+
_ref3 = _state2.sent(), renderFunction = _ref3.code;
|
|
339
|
+
return [
|
|
340
|
+
4,
|
|
341
|
+
hookRunners.modifyEntryExport({
|
|
342
|
+
entrypoint: entrypoint,
|
|
343
|
+
exportStatement: "export default AppWrapper;"
|
|
344
|
+
})
|
|
345
|
+
];
|
|
346
|
+
case 3:
|
|
347
|
+
exportStatement = _state2.sent().exportStatement;
|
|
348
|
+
imports = importsStatemets.get(entryName);
|
|
349
|
+
code = templates.index({
|
|
350
|
+
mountId: mountId,
|
|
351
|
+
imports: createImportStatements(imports),
|
|
352
|
+
renderFunction: renderFunction,
|
|
353
|
+
exportStatement: exportStatement
|
|
354
|
+
});
|
|
355
|
+
entryFile = path.resolve(internalDirectory, "./".concat(entryName, "/").concat(ENTRY_POINT_FILE_NAME));
|
|
356
|
+
if (!config.source.enableAsyncEntry)
|
|
357
|
+
return [
|
|
358
|
+
3,
|
|
359
|
+
5
|
|
360
|
+
];
|
|
361
|
+
rawAsyncEntryCode = "import('./".concat(ENTRY_BOOTSTRAP_FILE_NAME, "');");
|
|
362
|
+
ssr = getEntryOptions(entryName, config.server.ssr, config.server.ssrByEntries, packageName);
|
|
363
|
+
if (ssr) {
|
|
364
|
+
rawAsyncEntryCode = "\n export const ".concat(SERVER_RENDER_FUNCTION_NAME, " = async (...args) => {\n let entry = await ").concat(rawAsyncEntryCode, ";\n if (entry.default instanceof Promise){\n entry = await entry.default;\n return entry.default.").concat(SERVER_RENDER_FUNCTION_NAME, ".apply(null, args);\n }\n return entry.").concat(SERVER_RENDER_FUNCTION_NAME, ".apply(null, args);\n };\n if(typeof window!=='undefined'){\n ").concat(rawAsyncEntryCode, "\n }\n ");
|
|
365
|
+
}
|
|
366
|
+
return [
|
|
367
|
+
4,
|
|
368
|
+
hookRunners.modifyAsyncEntry({
|
|
369
|
+
entrypoint: entrypoint,
|
|
370
|
+
code: rawAsyncEntryCode
|
|
371
|
+
})
|
|
372
|
+
];
|
|
373
|
+
case 4:
|
|
374
|
+
_ref1 = _state2.sent(), asyncEntryCode = _ref1.code;
|
|
375
|
+
fs.outputFileSync(entryFile, asyncEntryCode, "utf8");
|
|
376
|
+
bootstrapFile = path.resolve(internalDirectory, "./".concat(entryName, "/").concat(ENTRY_BOOTSTRAP_FILE_NAME));
|
|
377
|
+
fs.outputFileSync(bootstrapFile, code, "utf8");
|
|
378
|
+
return [
|
|
379
|
+
3,
|
|
380
|
+
6
|
|
381
|
+
];
|
|
382
|
+
case 5:
|
|
383
|
+
fs.outputFileSync(entryFile, code, "utf8");
|
|
384
|
+
_state2.label = 6;
|
|
385
|
+
case 6:
|
|
386
|
+
return [
|
|
387
|
+
2
|
|
388
|
+
];
|
|
389
|
+
}
|
|
390
|
+
});
|
|
391
|
+
});
|
|
392
|
+
return function(entrypoint) {
|
|
393
|
+
return _ref2.apply(this, arguments);
|
|
394
|
+
};
|
|
395
|
+
}()))
|
|
396
|
+
];
|
|
397
|
+
case 1:
|
|
398
|
+
_state.sent();
|
|
399
|
+
return [
|
|
400
|
+
2
|
|
401
|
+
];
|
|
402
|
+
}
|
|
403
|
+
});
|
|
404
|
+
});
|
|
405
|
+
return function generateIndexCode2(_) {
|
|
406
|
+
return _ref.apply(this, arguments);
|
|
407
|
+
};
|
|
408
|
+
}();
|
|
@@ -14,6 +14,7 @@ import { initialNormalizedConfig } from "../config";
|
|
|
14
14
|
import { createBuilderGenerator } from "../builder";
|
|
15
15
|
import { isPageComponentFile, parseModule, replaceWithAlias } from "./utils";
|
|
16
16
|
import { APP_CONFIG_NAME, APP_INIT_EXPORTED, APP_INIT_IMPORTED } from "./constants";
|
|
17
|
+
import { generateIndexCode } from "./generateCode";
|
|
17
18
|
var debug = createDebugger("plugin-analyze");
|
|
18
19
|
export default function(param) {
|
|
19
20
|
var bundler = param.bundler;
|
|
@@ -26,7 +27,7 @@ export default function(param) {
|
|
|
26
27
|
return {
|
|
27
28
|
prepare: function prepare() {
|
|
28
29
|
return _async_to_generator(function() {
|
|
29
|
-
var _resolvedConfig_source, appContext, resolvedConfig, hookRunners, apiOnly, routes, _ref, getBundleEntry, getServerRoutes, generateCode, getHtmlTemplate, entrypoints, initialRoutes, routes1, htmlTemplates, checkedEntries, entry, command, buildCommands, normalizedConfig, createBuilderForModern, builder;
|
|
30
|
+
var _resolvedConfig_source, appContext, resolvedConfig, hookRunners, apiOnly, routes, _ref, getBundleEntry, getServerRoutes, generateCode, getHtmlTemplate, entrypoints, initialRoutes, routes1, importsStatemets, htmlTemplates, checkedEntries, entry, command, buildCommands, normalizedConfig, createBuilderForModern, builder;
|
|
30
31
|
return _ts_generator(this, function(_state) {
|
|
31
32
|
switch (_state.label) {
|
|
32
33
|
case 0:
|
|
@@ -120,7 +121,7 @@ export default function(param) {
|
|
|
120
121
|
generateCode(appContext, resolvedConfig, entrypoints, api)
|
|
121
122
|
];
|
|
122
123
|
case 7:
|
|
123
|
-
_state.sent();
|
|
124
|
+
importsStatemets = _state.sent().importsStatemets;
|
|
124
125
|
return [
|
|
125
126
|
4,
|
|
126
127
|
getHtmlTemplate(entrypoints, api, {
|
|
@@ -276,11 +277,24 @@ export default function(param) {
|
|
|
276
277
|
hookRunners2 = api.useHookRunners();
|
|
277
278
|
return [
|
|
278
279
|
4,
|
|
279
|
-
|
|
280
|
+
generateIndexCode({
|
|
281
|
+
appContext: appContext,
|
|
282
|
+
config: resolvedConfig,
|
|
283
|
+
entrypoints: entrypoints,
|
|
284
|
+
api: api,
|
|
285
|
+
importsStatemets: importsStatemets,
|
|
280
286
|
bundlerConfigs: bundlerConfigs
|
|
281
287
|
})
|
|
282
288
|
];
|
|
283
289
|
case 1:
|
|
290
|
+
_state2.sent();
|
|
291
|
+
return [
|
|
292
|
+
4,
|
|
293
|
+
hookRunners2.beforeCreateCompiler({
|
|
294
|
+
bundlerConfigs: bundlerConfigs
|
|
295
|
+
})
|
|
296
|
+
];
|
|
297
|
+
case 2:
|
|
284
298
|
_state2.sent();
|
|
285
299
|
return [
|
|
286
300
|
2
|
|
@@ -4,15 +4,16 @@ export function createBuilderOptions(target, appContext) {
|
|
|
4
4
|
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
|
|
5
5
|
try {
|
|
6
6
|
for (var _iterator = entrypoints[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
|
7
|
-
var _step_value = _step.value, entryName = _step_value.entryName, entry = _step_value.entry;
|
|
7
|
+
var _step_value = _step.value, entryName = _step_value.entryName, internalEntry = _step_value.internalEntry, entry = _step_value.entry;
|
|
8
8
|
if (checkedEntries && !checkedEntries.includes(entryName)) {
|
|
9
9
|
continue;
|
|
10
10
|
}
|
|
11
|
+
var finalEntry = internalEntry || entry;
|
|
11
12
|
if (entryName in entries) {
|
|
12
|
-
entries[entryName].push(
|
|
13
|
+
entries[entryName].push(finalEntry);
|
|
13
14
|
} else {
|
|
14
15
|
entries[entryName] = [
|
|
15
|
-
|
|
16
|
+
finalEntry
|
|
16
17
|
];
|
|
17
18
|
}
|
|
18
19
|
}
|
|
@@ -3,7 +3,7 @@ import { _ as _object_spread_props } from "@swc/helpers/_/_object_spread_props";
|
|
|
3
3
|
export function createBuilderProviderConfig(resolveConfig, appContext, modifyBuilderConfig) {
|
|
4
4
|
var htmlConfig = _object_spread({}, resolveConfig.html);
|
|
5
5
|
if (!htmlConfig.template) {
|
|
6
|
-
htmlConfig.templateByEntries = _object_spread({},
|
|
6
|
+
htmlConfig.templateByEntries = _object_spread({}, appContext.htmlTemplates, htmlConfig.templateByEntries);
|
|
7
7
|
}
|
|
8
8
|
var config = _object_spread_props(_object_spread({}, resolveConfig), {
|
|
9
9
|
dev: _object_spread_props(_object_spread({}, resolveConfig.dev), {
|