@modern-js/app-tools 2.4.0 → 2.5.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 +59 -0
- package/dist/{js/node → cjs}/analyze/constants.js +0 -0
- package/dist/cjs/analyze/generateCode.js +249 -0
- package/dist/{js/node → cjs}/analyze/getBundleEntry.js +6 -0
- package/dist/{js/node → cjs}/analyze/getClientRoutes/getRoutes.js +1 -18
- package/dist/{js/node → cjs}/analyze/getClientRoutes/getRoutesLegacy.js +1 -18
- package/dist/{js/node → cjs}/analyze/getClientRoutes/index.js +0 -0
- package/dist/{js/node → cjs}/analyze/getClientRoutes/utils.js +0 -0
- package/dist/{js/node → cjs}/analyze/getFileSystemEntry.js +0 -0
- package/dist/{js/node → cjs}/analyze/getHtmlTemplate.js +4 -24
- package/dist/{js/node → cjs}/analyze/getServerRoutes.js +22 -42
- package/dist/cjs/analyze/index.js +290 -0
- package/dist/{js/node → cjs}/analyze/isDefaultExportFunction.js +0 -0
- package/dist/{js/node → cjs}/analyze/makeLegalIdentifier.js +0 -0
- package/dist/{js/node → cjs}/analyze/nestedRoutes.js +16 -50
- package/dist/{js/node → cjs}/analyze/templates.js +16 -49
- package/dist/{js/node → cjs}/analyze/utils.js +9 -29
- package/dist/{js/node → cjs}/builder/builder-rspack/index.js +0 -0
- package/dist/{js/node → cjs}/builder/builder-webpack/builderPlugins/compatModern.js +0 -0
- package/dist/{js/node → cjs}/builder/builder-webpack/index.js +22 -62
- package/dist/{js/node → cjs}/builder/builder-webpack/webpackPlugins/RouterPlugin.js +7 -24
- package/dist/{js/node → cjs}/builder/builder-webpack/webpackPlugins/index.js +0 -0
- package/dist/{js/node → cjs}/builder/generator/createBuilderOptions.js +0 -0
- package/dist/{js/node → cjs}/builder/generator/createBuilderProviderConfig.js +14 -25
- package/dist/{js/node → cjs}/builder/generator/getBuilderTargets.js +4 -0
- package/dist/cjs/builder/generator/index.js +58 -0
- package/dist/{js/node → cjs}/builder/index.js +12 -34
- package/dist/{js/node → cjs}/builder/shared/builderPlugins/adapterModern.js +35 -34
- package/dist/{js/node → cjs}/builder/shared/bundlerPlugins/HtmlAsyncChunkPlugin.js +0 -0
- package/dist/{js/node → cjs}/builder/shared/bundlerPlugins/HtmlBottomTemplate.js +0 -0
- package/dist/{js/node → cjs}/builder/shared/createCopyPattern.js +0 -0
- package/dist/{js/node → cjs}/builder/shared/index.js +0 -0
- package/dist/{js/node → cjs}/builder/shared/loaders/serverModuleLoader.js +0 -0
- package/dist/{js/node → cjs}/builder/shared/types.js +0 -0
- package/dist/{js/node → cjs}/commands/build.js +9 -46
- package/dist/cjs/commands/deploy.js +31 -0
- package/dist/{js/node → cjs}/commands/dev.js +17 -52
- package/dist/{js/node → cjs}/commands/index.js +0 -0
- package/dist/{js/node → cjs}/commands/inspect.js +2 -22
- package/dist/{js/node → cjs}/commands/serve.js +8 -28
- package/dist/{js/node → cjs}/config/default.js +15 -26
- package/dist/{js/node → cjs}/config/index.js +0 -0
- package/dist/{js/node → cjs}/config/initialize/index.js +0 -0
- package/dist/{js/node → cjs}/config/initialize/inits.js +4 -20
- package/dist/{js/node → cjs}/config/legacy/createHtmlConfig.js +0 -0
- package/dist/{js/node → cjs}/config/legacy/createOutputConfig.js +0 -0
- package/dist/{js/node → cjs}/config/legacy/createSourceConfig.js +0 -0
- package/dist/{js/node → cjs}/config/legacy/createToolsConfig.js +0 -0
- package/dist/{js/node → cjs}/config/legacy/index.js +0 -0
- package/dist/cjs/defineConfig.js +33 -0
- package/dist/{js/node → cjs}/exports/server.js +0 -0
- package/dist/{js/node → cjs}/hooks.js +0 -0
- package/dist/cjs/index.js +198 -0
- package/dist/cjs/initialize/index.js +102 -0
- package/dist/{js/node → cjs}/locale/en.js +0 -0
- package/dist/{js/node → cjs}/locale/index.js +0 -0
- package/dist/{js/node → cjs}/locale/zh.js +0 -0
- package/dist/{js/node → cjs}/schema/Schema.js +0 -0
- package/dist/{js/node → cjs}/schema/index.js +0 -0
- package/dist/{js/node → cjs}/schema/legacy.js +0 -0
- package/dist/{js/node → cjs}/types/config/deploy.js +0 -0
- package/dist/{js/node → cjs}/types/config/dev.js +0 -0
- package/dist/{js/node → cjs}/types/config/experiments.js +0 -0
- package/dist/{js/node → cjs}/types/config/html.js +0 -0
- package/dist/{js/node → cjs}/types/config/index.js +0 -0
- package/dist/{js/node → cjs}/types/config/output.js +0 -0
- package/dist/{js/node → cjs}/types/config/performance.js +0 -0
- package/dist/{js/node → cjs}/types/config/security.js +0 -0
- package/dist/{js/node → cjs}/types/config/source.js +0 -0
- package/dist/{js/node → cjs}/types/config/tools.js +0 -0
- package/dist/{js/node → cjs}/types/hooks.js +0 -0
- package/dist/{js/node → cjs}/types/index.js +0 -0
- package/dist/{js/node → cjs}/types/legacyConfig/deploy.js +0 -0
- package/dist/{js/node → cjs}/types/legacyConfig/dev.js +0 -0
- package/dist/{js/node → cjs}/types/legacyConfig/index.js +0 -0
- package/dist/{js/node → cjs}/types/legacyConfig/output.js +0 -0
- package/dist/{js/node → cjs}/types/legacyConfig/source.js +0 -0
- package/dist/{js/node → cjs}/types/legacyConfig/tools.js +0 -0
- package/dist/{js/node → cjs}/types/utils.js +0 -0
- package/dist/{js/node → cjs}/utils/config.js +19 -57
- package/dist/{js/node → cjs}/utils/createServer.js +10 -46
- package/dist/{js/node → cjs}/utils/env.js +0 -0
- package/dist/{js/node → cjs}/utils/generateWatchFiles.js +16 -38
- package/dist/{js/node → cjs}/utils/getSelectedEntries.js +3 -23
- package/dist/cjs/utils/getServerInternalPlugins.js +41 -0
- package/dist/{js/node → cjs}/utils/language.js +0 -0
- package/dist/{js/node → cjs}/utils/printInstructions.js +3 -23
- package/dist/cjs/utils/restart.js +45 -0
- package/dist/{js/node → cjs}/utils/routes.js +3 -23
- package/dist/{js/node → cjs}/utils/types.js +0 -0
- package/dist/{js/treeshaking → esm}/analyze/constants.js +0 -0
- package/dist/{js/treeshaking → esm}/analyze/generateCode.js +14 -14
- package/dist/{js/treeshaking → esm}/analyze/getBundleEntry.js +4 -2
- package/dist/{js/treeshaking → esm}/analyze/getClientRoutes/getRoutes.js +1 -1
- package/dist/{js/treeshaking → esm}/analyze/getClientRoutes/getRoutesLegacy.js +1 -1
- package/dist/{js/treeshaking → esm}/analyze/getClientRoutes/index.js +0 -0
- package/dist/{js/treeshaking → esm}/analyze/getClientRoutes/utils.js +0 -0
- package/dist/{js/treeshaking → esm}/analyze/getFileSystemEntry.js +1 -1
- package/dist/{js/treeshaking → esm}/analyze/getHtmlTemplate.js +0 -0
- package/dist/{js/treeshaking → esm}/analyze/getServerRoutes.js +8 -6
- package/dist/{js/treeshaking → esm}/analyze/index.js +8 -8
- package/dist/{js/treeshaking → esm}/analyze/isDefaultExportFunction.js +0 -0
- package/dist/{js/treeshaking → esm}/analyze/makeLegalIdentifier.js +0 -0
- package/dist/{js/treeshaking → esm}/analyze/nestedRoutes.js +5 -5
- package/dist/{js/treeshaking → esm}/analyze/templates.js +8 -7
- package/dist/{js/treeshaking → esm}/analyze/utils.js +3 -3
- package/dist/{js/treeshaking → esm}/builder/builder-rspack/index.js +0 -0
- package/dist/{js/treeshaking → esm}/builder/builder-webpack/builderPlugins/compatModern.js +4 -4
- package/dist/{js/treeshaking → esm}/builder/builder-webpack/index.js +2 -2
- package/dist/{js/treeshaking → esm}/builder/builder-webpack/webpackPlugins/RouterPlugin.js +5 -2
- package/dist/{js/treeshaking → esm}/builder/builder-webpack/webpackPlugins/index.js +0 -0
- package/dist/{js/treeshaking → esm}/builder/generator/createBuilderOptions.js +2 -2
- package/dist/{js/treeshaking → esm}/builder/generator/createBuilderProviderConfig.js +0 -0
- package/dist/{js/treeshaking → esm}/builder/generator/getBuilderTargets.js +5 -1
- package/dist/{js/treeshaking → esm}/builder/generator/index.js +2 -2
- package/dist/{js/treeshaking → esm}/builder/index.js +0 -0
- package/dist/{js/treeshaking → esm}/builder/shared/builderPlugins/adapterModern.js +62 -13
- package/dist/{js/treeshaking → esm}/builder/shared/bundlerPlugins/HtmlAsyncChunkPlugin.js +0 -0
- package/dist/{js/treeshaking → esm}/builder/shared/bundlerPlugins/HtmlBottomTemplate.js +2 -2
- package/dist/{js/treeshaking → esm}/builder/shared/createCopyPattern.js +0 -0
- package/dist/{js/treeshaking → esm}/builder/shared/index.js +0 -0
- package/dist/{js/treeshaking → esm}/builder/shared/loaders/serverModuleLoader.js +0 -0
- package/dist/{js/treeshaking → esm}/builder/shared/types.js +0 -0
- package/dist/{js/treeshaking → esm}/commands/build.js +0 -0
- package/dist/{js/treeshaking → esm}/commands/deploy.js +0 -0
- package/dist/{js/treeshaking → esm}/commands/dev.js +2 -2
- package/dist/{js/treeshaking → esm}/commands/index.js +0 -0
- package/dist/{js/treeshaking → esm}/commands/inspect.js +0 -0
- package/dist/{js/treeshaking → esm}/commands/serve.js +2 -2
- package/dist/{js/treeshaking → esm}/config/default.js +0 -0
- package/dist/{js/treeshaking → esm}/config/index.js +0 -0
- package/dist/{js/treeshaking → esm}/config/initialize/index.js +0 -0
- package/dist/{js/treeshaking → esm}/config/initialize/inits.js +2 -2
- package/dist/esm/config/legacy/createHtmlConfig.js +19 -0
- package/dist/{js/treeshaking → esm}/config/legacy/createOutputConfig.js +1 -1
- package/dist/{js/treeshaking → esm}/config/legacy/createSourceConfig.js +1 -1
- package/dist/{js/treeshaking → esm}/config/legacy/createToolsConfig.js +1 -1
- package/dist/{js/treeshaking → esm}/config/legacy/index.js +0 -0
- package/dist/{js/treeshaking → esm}/defineConfig.js +0 -0
- package/dist/{js/treeshaking → esm}/exports/server.js +0 -0
- package/dist/{js/treeshaking → esm}/hooks.js +0 -0
- package/dist/{js/treeshaking → esm}/index.js +0 -0
- package/dist/{js/treeshaking → esm}/initialize/index.js +2 -2
- package/dist/{js/treeshaking → esm}/locale/en.js +0 -0
- package/dist/{js/treeshaking → esm}/locale/index.js +0 -0
- package/dist/{js/treeshaking → esm}/locale/zh.js +0 -0
- package/dist/{js/treeshaking → esm}/schema/Schema.js +0 -0
- package/dist/{js/treeshaking → esm}/schema/index.js +0 -0
- package/dist/{js/treeshaking → esm}/schema/legacy.js +0 -0
- package/dist/{js/treeshaking → esm}/types/config/deploy.js +0 -0
- package/dist/{js/treeshaking → esm}/types/config/dev.js +0 -0
- package/dist/{js/treeshaking → esm}/types/config/experiments.js +0 -0
- package/dist/{js/treeshaking → esm}/types/config/html.js +0 -0
- package/dist/{js/treeshaking → esm}/types/config/index.js +0 -0
- package/dist/{js/treeshaking → esm}/types/config/output.js +0 -0
- package/dist/{js/treeshaking → esm}/types/config/performance.js +0 -0
- package/dist/{js/treeshaking → esm}/types/config/security.js +0 -0
- package/dist/{js/treeshaking → esm}/types/config/source.js +0 -0
- package/dist/{js/treeshaking → esm}/types/config/tools.js +0 -0
- package/dist/{js/treeshaking → esm}/types/hooks.js +0 -0
- package/dist/{js/treeshaking → esm}/types/index.js +0 -0
- package/dist/{js/treeshaking → esm}/types/legacyConfig/deploy.js +0 -0
- package/dist/{js/treeshaking → esm}/types/legacyConfig/dev.js +0 -0
- package/dist/{js/treeshaking → esm}/types/legacyConfig/index.js +0 -0
- package/dist/{js/treeshaking → esm}/types/legacyConfig/output.js +0 -0
- package/dist/{js/treeshaking → esm}/types/legacyConfig/source.js +0 -0
- package/dist/{js/treeshaking → esm}/types/legacyConfig/tools.js +0 -0
- package/dist/{js/treeshaking → esm}/types/utils.js +0 -0
- package/dist/{js/treeshaking → esm}/utils/config.js +2 -2
- package/dist/{js/treeshaking → esm}/utils/createServer.js +0 -0
- package/dist/{js/treeshaking → esm}/utils/env.js +0 -0
- package/dist/{js/treeshaking → esm}/utils/generateWatchFiles.js +0 -0
- package/dist/{js/treeshaking → esm}/utils/getSelectedEntries.js +0 -0
- package/dist/{js/treeshaking → esm}/utils/getServerInternalPlugins.js +2 -2
- package/dist/{js/treeshaking → esm}/utils/language.js +0 -0
- package/dist/{js/treeshaking → esm}/utils/printInstructions.js +0 -0
- package/dist/{js/treeshaking → esm}/utils/restart.js +0 -0
- package/dist/{js/treeshaking → esm}/utils/routes.js +0 -0
- package/dist/{js/treeshaking → esm}/utils/types.js +0 -0
- package/dist/{js/modern → esm-node}/analyze/constants.js +0 -0
- package/dist/esm-node/analyze/generateCode.js +225 -0
- package/dist/{js/modern → esm-node}/analyze/getBundleEntry.js +6 -0
- package/dist/{js/modern → esm-node}/analyze/getClientRoutes/getRoutes.js +1 -20
- package/dist/{js/modern → esm-node}/analyze/getClientRoutes/getRoutesLegacy.js +1 -20
- package/dist/{js/modern → esm-node}/analyze/getClientRoutes/index.js +0 -0
- package/dist/{js/modern → esm-node}/analyze/getClientRoutes/utils.js +0 -0
- package/dist/{js/modern → esm-node}/analyze/getFileSystemEntry.js +0 -0
- package/dist/{js/modern → esm-node}/analyze/getHtmlTemplate.js +4 -24
- package/dist/{js/modern → esm-node}/analyze/getServerRoutes.js +24 -45
- package/dist/esm-node/analyze/index.js +281 -0
- package/dist/{js/modern → esm-node}/analyze/isDefaultExportFunction.js +0 -0
- package/dist/{js/modern → esm-node}/analyze/makeLegalIdentifier.js +0 -0
- package/dist/{js/modern → esm-node}/analyze/nestedRoutes.js +16 -52
- package/dist/{js/modern → esm-node}/analyze/templates.js +16 -51
- package/dist/{js/modern → esm-node}/analyze/utils.js +9 -29
- package/dist/{js/modern → esm-node}/builder/builder-rspack/index.js +0 -0
- package/dist/{js/modern → esm-node}/builder/builder-webpack/builderPlugins/compatModern.js +0 -0
- package/dist/esm-node/builder/builder-webpack/index.js +51 -0
- package/dist/{js/modern → esm-node}/builder/builder-webpack/webpackPlugins/RouterPlugin.js +7 -24
- package/dist/{js/modern → esm-node}/builder/builder-webpack/webpackPlugins/index.js +0 -0
- package/dist/{js/modern → esm-node}/builder/generator/createBuilderOptions.js +0 -0
- package/dist/esm-node/builder/generator/createBuilderProviderConfig.js +26 -0
- package/dist/{js/modern → esm-node}/builder/generator/getBuilderTargets.js +10 -1
- package/dist/esm-node/builder/generator/index.js +29 -0
- package/dist/esm-node/builder/index.js +17 -0
- package/dist/{js/modern → esm-node}/builder/shared/builderPlugins/adapterModern.js +35 -36
- package/dist/{js/modern → esm-node}/builder/shared/bundlerPlugins/HtmlAsyncChunkPlugin.js +0 -0
- package/dist/{js/modern → esm-node}/builder/shared/bundlerPlugins/HtmlBottomTemplate.js +0 -0
- package/dist/{js/modern → esm-node}/builder/shared/createCopyPattern.js +0 -0
- package/dist/{js/modern → esm-node}/builder/shared/index.js +0 -0
- package/dist/{js/modern → esm-node}/builder/shared/loaders/serverModuleLoader.js +0 -0
- package/dist/{js/modern → esm-node}/builder/shared/types.js +0 -0
- package/dist/esm-node/commands/build.js +52 -0
- package/dist/esm-node/commands/deploy.js +8 -0
- package/dist/esm-node/commands/dev.js +72 -0
- package/dist/{js/modern → esm-node}/commands/index.js +0 -0
- package/dist/esm-node/commands/inspect.js +18 -0
- package/dist/{js/modern → esm-node}/commands/serve.js +8 -28
- package/dist/{js/modern → esm-node}/config/default.js +15 -28
- package/dist/{js/modern → esm-node}/config/index.js +0 -0
- package/dist/{js/modern → esm-node}/config/initialize/index.js +0 -0
- package/dist/{js/modern → esm-node}/config/initialize/inits.js +4 -22
- package/dist/{js/modern → esm-node}/config/legacy/createHtmlConfig.js +0 -0
- package/dist/{js/modern → esm-node}/config/legacy/createOutputConfig.js +0 -0
- package/dist/{js/modern → esm-node}/config/legacy/createSourceConfig.js +0 -0
- package/dist/{js/modern → esm-node}/config/legacy/createToolsConfig.js +0 -0
- package/dist/{js/modern → esm-node}/config/legacy/index.js +0 -0
- package/dist/esm-node/defineConfig.js +9 -0
- package/dist/{js/modern → esm-node}/exports/server.js +0 -0
- package/dist/{js/modern → esm-node}/hooks.js +0 -0
- package/dist/esm-node/index.js +172 -0
- package/dist/esm-node/initialize/index.js +91 -0
- package/dist/{js/modern → esm-node}/locale/en.js +0 -0
- package/dist/{js/modern → esm-node}/locale/index.js +0 -0
- package/dist/{js/modern → esm-node}/locale/zh.js +0 -0
- package/dist/{js/modern → esm-node}/schema/Schema.js +0 -0
- package/dist/{js/modern → esm-node}/schema/index.js +0 -0
- package/dist/{js/modern → esm-node}/schema/legacy.js +0 -0
- package/dist/{js/modern → esm-node}/types/config/deploy.js +0 -0
- package/dist/{js/modern → esm-node}/types/config/dev.js +0 -0
- package/dist/{js/modern → esm-node}/types/config/experiments.js +0 -0
- package/dist/{js/modern → esm-node}/types/config/html.js +0 -0
- package/dist/{js/modern → esm-node}/types/config/index.js +0 -0
- package/dist/{js/modern → esm-node}/types/config/output.js +0 -0
- package/dist/{js/modern → esm-node}/types/config/performance.js +0 -0
- package/dist/{js/modern → esm-node}/types/config/security.js +0 -0
- package/dist/{js/modern → esm-node}/types/config/source.js +0 -0
- package/dist/{js/modern → esm-node}/types/config/tools.js +0 -0
- package/dist/{js/modern → esm-node}/types/hooks.js +0 -0
- package/dist/{js/modern → esm-node}/types/index.js +0 -0
- package/dist/{js/modern → esm-node}/types/legacyConfig/deploy.js +0 -0
- package/dist/{js/modern → esm-node}/types/legacyConfig/dev.js +0 -0
- package/dist/{js/modern → esm-node}/types/legacyConfig/index.js +0 -0
- package/dist/{js/modern → esm-node}/types/legacyConfig/output.js +0 -0
- package/dist/{js/modern → esm-node}/types/legacyConfig/source.js +0 -0
- package/dist/{js/modern → esm-node}/types/legacyConfig/tools.js +0 -0
- package/dist/{js/modern → esm-node}/types/utils.js +0 -0
- package/dist/esm-node/utils/config.js +88 -0
- package/dist/esm-node/utils/createServer.js +37 -0
- package/dist/{js/modern → esm-node}/utils/env.js +0 -0
- package/dist/esm-node/utils/generateWatchFiles.js +33 -0
- package/dist/{js/modern → esm-node}/utils/getSelectedEntries.js +3 -23
- package/dist/esm-node/utils/getServerInternalPlugins.js +18 -0
- package/dist/{js/modern → esm-node}/utils/language.js +0 -0
- package/dist/esm-node/utils/printInstructions.js +11 -0
- package/dist/esm-node/utils/restart.js +22 -0
- package/dist/esm-node/utils/routes.js +10 -0
- package/dist/{js/modern → esm-node}/utils/types.js +0 -0
- package/dist/types/types/config/tools.d.ts +1 -1
- package/dist/types/types/hooks.d.ts +5 -4
- package/dist/types/types/index.d.ts +3 -1
- package/package.json +30 -31
- package/dist/js/modern/analyze/generateCode.js +0 -247
- package/dist/js/modern/analyze/index.js +0 -329
- package/dist/js/modern/builder/builder-webpack/index.js +0 -93
- package/dist/js/modern/builder/generator/createBuilderProviderConfig.js +0 -39
- package/dist/js/modern/builder/generator/index.js +0 -53
- package/dist/js/modern/builder/index.js +0 -39
- package/dist/js/modern/commands/build.js +0 -91
- package/dist/js/modern/commands/deploy.js +0 -28
- package/dist/js/modern/commands/dev.js +0 -109
- package/dist/js/modern/commands/inspect.js +0 -38
- package/dist/js/modern/defineConfig.js +0 -27
- package/dist/js/modern/index.js +0 -221
- package/dist/js/modern/initialize/index.js +0 -132
- package/dist/js/modern/utils/config.js +0 -128
- package/dist/js/modern/utils/createServer.js +0 -75
- package/dist/js/modern/utils/generateWatchFiles.js +0 -55
- package/dist/js/modern/utils/getServerInternalPlugins.js +0 -58
- package/dist/js/modern/utils/printInstructions.js +0 -31
- package/dist/js/modern/utils/restart.js +0 -44
- package/dist/js/modern/utils/routes.js +0 -30
- package/dist/js/node/analyze/generateCode.js +0 -271
- package/dist/js/node/analyze/index.js +0 -336
- package/dist/js/node/builder/generator/index.js +0 -82
- package/dist/js/node/commands/deploy.js +0 -51
- package/dist/js/node/defineConfig.js +0 -49
- package/dist/js/node/index.js +0 -245
- package/dist/js/node/initialize/index.js +0 -141
- package/dist/js/node/utils/getServerInternalPlugins.js +0 -79
- package/dist/js/node/utils/restart.js +0 -67
- package/dist/js/treeshaking/config/legacy/createHtmlConfig.js +0 -19
|
@@ -0,0 +1,290 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
21
|
+
mod
|
|
22
|
+
));
|
|
23
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
24
|
+
var analyze_exports = {};
|
|
25
|
+
__export(analyze_exports, {
|
|
26
|
+
default: () => analyze_default
|
|
27
|
+
});
|
|
28
|
+
module.exports = __toCommonJS(analyze_exports);
|
|
29
|
+
var path = __toESM(require("path"));
|
|
30
|
+
var import_utils = require("@modern-js/utils");
|
|
31
|
+
var import_lodash = require("@modern-js/utils/lodash");
|
|
32
|
+
var import_printInstructions = require("../utils/printInstructions");
|
|
33
|
+
var import_routes = require("../utils/routes");
|
|
34
|
+
var import_config = require("../utils/config");
|
|
35
|
+
var import_getSelectedEntries = require("../utils/getSelectedEntries");
|
|
36
|
+
var import_config2 = require("../config");
|
|
37
|
+
var import_builder = require("../builder");
|
|
38
|
+
var import_utils2 = require("./utils");
|
|
39
|
+
var import_constants = require("./constants");
|
|
40
|
+
const debug = (0, import_utils.createDebugger)("plugin-analyze");
|
|
41
|
+
var analyze_default = ({
|
|
42
|
+
bundler
|
|
43
|
+
}) => ({
|
|
44
|
+
name: "@modern-js/plugin-analyze",
|
|
45
|
+
setup: (api) => {
|
|
46
|
+
let pagesDir = [];
|
|
47
|
+
let nestedRouteEntries = [];
|
|
48
|
+
let originEntrypoints = [];
|
|
49
|
+
return {
|
|
50
|
+
async prepare() {
|
|
51
|
+
var _a;
|
|
52
|
+
let appContext = api.useAppContext();
|
|
53
|
+
const resolvedConfig = api.useResolvedConfigContext();
|
|
54
|
+
const hookRunners = api.useHookRunners();
|
|
55
|
+
try {
|
|
56
|
+
import_utils.fs.emptydirSync(appContext.internalDirectory);
|
|
57
|
+
} catch {
|
|
58
|
+
}
|
|
59
|
+
const apiOnly = await (0, import_utils.isApiOnly)(
|
|
60
|
+
appContext.appDirectory,
|
|
61
|
+
(_a = resolvedConfig.source) == null ? void 0 : _a.entriesDir
|
|
62
|
+
);
|
|
63
|
+
await hookRunners.addRuntimeExports();
|
|
64
|
+
if (apiOnly) {
|
|
65
|
+
const { routes: routes2 } = await hookRunners.modifyServerRoutes({
|
|
66
|
+
routes: []
|
|
67
|
+
});
|
|
68
|
+
debug(`server routes: %o`, routes2);
|
|
69
|
+
appContext = {
|
|
70
|
+
...appContext,
|
|
71
|
+
apiOnly,
|
|
72
|
+
serverRoutes: routes2
|
|
73
|
+
};
|
|
74
|
+
api.setAppContext(appContext);
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
const [
|
|
78
|
+
{ getBundleEntry },
|
|
79
|
+
{ getServerRoutes },
|
|
80
|
+
{ generateCode },
|
|
81
|
+
{ getHtmlTemplate }
|
|
82
|
+
] = await Promise.all([
|
|
83
|
+
Promise.resolve().then(() => __toESM(require("./getBundleEntry"))),
|
|
84
|
+
Promise.resolve().then(() => __toESM(require("./getServerRoutes"))),
|
|
85
|
+
Promise.resolve().then(() => __toESM(require("./generateCode"))),
|
|
86
|
+
Promise.resolve().then(() => __toESM(require("./getHtmlTemplate")))
|
|
87
|
+
]);
|
|
88
|
+
const entrypoints = getBundleEntry(appContext, resolvedConfig);
|
|
89
|
+
debug(`entrypoints: %o`, entrypoints);
|
|
90
|
+
const initialRoutes = getServerRoutes(entrypoints, {
|
|
91
|
+
appContext,
|
|
92
|
+
config: resolvedConfig
|
|
93
|
+
});
|
|
94
|
+
const { routes } = await hookRunners.modifyServerRoutes({
|
|
95
|
+
routes: initialRoutes
|
|
96
|
+
});
|
|
97
|
+
debug(`server routes: %o`, routes);
|
|
98
|
+
appContext = {
|
|
99
|
+
...appContext,
|
|
100
|
+
entrypoints,
|
|
101
|
+
serverRoutes: routes
|
|
102
|
+
};
|
|
103
|
+
api.setAppContext(appContext);
|
|
104
|
+
nestedRouteEntries = entrypoints.map((point) => point.nestedRoutesEntry).filter(Boolean);
|
|
105
|
+
pagesDir = entrypoints.map((point) => point.entry).filter(Boolean).concat(nestedRouteEntries);
|
|
106
|
+
originEntrypoints = (0, import_lodash.cloneDeep)(entrypoints);
|
|
107
|
+
await generateCode(appContext, resolvedConfig, entrypoints, api);
|
|
108
|
+
const htmlTemplates = await getHtmlTemplate(entrypoints, api, {
|
|
109
|
+
appContext,
|
|
110
|
+
config: resolvedConfig
|
|
111
|
+
});
|
|
112
|
+
debug(`html templates: %o`, htmlTemplates);
|
|
113
|
+
await hookRunners.addDefineTypes();
|
|
114
|
+
debug(`add Define Types`);
|
|
115
|
+
let checkedEntries = entrypoints.map((point) => point.entryName);
|
|
116
|
+
if ((0, import_utils.isDevCommand)()) {
|
|
117
|
+
const { entry } = (0, import_utils.minimist)(process.argv.slice(2));
|
|
118
|
+
checkedEntries = await (0, import_getSelectedEntries.getSelectedEntries)(
|
|
119
|
+
typeof entry === "string" ? entry.split(",") : entry,
|
|
120
|
+
entrypoints
|
|
121
|
+
);
|
|
122
|
+
}
|
|
123
|
+
appContext = {
|
|
124
|
+
...appContext,
|
|
125
|
+
entrypoints,
|
|
126
|
+
checkedEntries,
|
|
127
|
+
apiOnly,
|
|
128
|
+
serverRoutes: routes,
|
|
129
|
+
htmlTemplates
|
|
130
|
+
};
|
|
131
|
+
api.setAppContext(appContext);
|
|
132
|
+
const command = (0, import_utils.getCommand)();
|
|
133
|
+
const buildCommands = ["dev", "start", "build", "inspect", "deploy"];
|
|
134
|
+
if (buildCommands.includes(command)) {
|
|
135
|
+
const normalizedConfig = api.useResolvedConfigContext();
|
|
136
|
+
const createBuilderForModern = await (0, import_builder.createBuilderGenerator)(bundler);
|
|
137
|
+
const builder = await createBuilderForModern({
|
|
138
|
+
normalizedConfig,
|
|
139
|
+
appContext,
|
|
140
|
+
async onBeforeBuild({ bundlerConfigs }) {
|
|
141
|
+
const hookRunners2 = api.useHookRunners();
|
|
142
|
+
await (0, import_routes.generateRoutes)(appContext);
|
|
143
|
+
await hookRunners2.beforeBuild({
|
|
144
|
+
bundlerConfigs
|
|
145
|
+
});
|
|
146
|
+
},
|
|
147
|
+
async onAfterBuild({ stats }) {
|
|
148
|
+
const hookRunners2 = api.useHookRunners();
|
|
149
|
+
await hookRunners2.afterBuild({ stats });
|
|
150
|
+
await (0, import_config.emitResolvedConfig)(
|
|
151
|
+
appContext.appDirectory,
|
|
152
|
+
normalizedConfig
|
|
153
|
+
);
|
|
154
|
+
},
|
|
155
|
+
async onDevCompileDone({ isFirstCompile }) {
|
|
156
|
+
const hookRunners2 = api.useHookRunners();
|
|
157
|
+
if (process.stdout.isTTY || isFirstCompile) {
|
|
158
|
+
hookRunners2.afterDev();
|
|
159
|
+
if (isFirstCompile) {
|
|
160
|
+
(0, import_printInstructions.printInstructions)(hookRunners2, appContext, normalizedConfig);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
},
|
|
164
|
+
async onBeforeCreateCompiler({ bundlerConfigs }) {
|
|
165
|
+
const hookRunners2 = api.useHookRunners();
|
|
166
|
+
await hookRunners2.beforeCreateCompiler({
|
|
167
|
+
bundlerConfigs
|
|
168
|
+
});
|
|
169
|
+
},
|
|
170
|
+
async onAfterCreateCompiler({ compiler }) {
|
|
171
|
+
const hookRunners2 = api.useHookRunners();
|
|
172
|
+
await hookRunners2.afterCreateCompiler({
|
|
173
|
+
compiler
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
});
|
|
177
|
+
builder.addPlugins(resolvedConfig.builderPlugins);
|
|
178
|
+
appContext = {
|
|
179
|
+
...appContext,
|
|
180
|
+
builder
|
|
181
|
+
};
|
|
182
|
+
api.setAppContext(appContext);
|
|
183
|
+
}
|
|
184
|
+
},
|
|
185
|
+
watchFiles() {
|
|
186
|
+
return pagesDir;
|
|
187
|
+
},
|
|
188
|
+
config() {
|
|
189
|
+
return {
|
|
190
|
+
tools: {
|
|
191
|
+
webpackChain: (chain, { name }) => {
|
|
192
|
+
const appContext = api.useAppContext();
|
|
193
|
+
const resolvedConfig = api.useResolvedConfigContext();
|
|
194
|
+
const { entrypoints, internalDirectory, packageName } = appContext;
|
|
195
|
+
entrypoints.forEach((entrypoint) => {
|
|
196
|
+
const { entryName } = entrypoint;
|
|
197
|
+
const ssr = (0, import_utils.getEntryOptions)(
|
|
198
|
+
entryName,
|
|
199
|
+
resolvedConfig.server.ssr,
|
|
200
|
+
resolvedConfig.server.ssrByEntries,
|
|
201
|
+
packageName
|
|
202
|
+
);
|
|
203
|
+
if (entrypoint.nestedRoutesEntry && ssr && name === "server") {
|
|
204
|
+
const serverLoadersFile = (0, import_utils2.getServerLoadersFile)(
|
|
205
|
+
internalDirectory,
|
|
206
|
+
entryName
|
|
207
|
+
);
|
|
208
|
+
chain.entry(`${entryName}-server-loaders`).add(serverLoadersFile);
|
|
209
|
+
}
|
|
210
|
+
});
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
};
|
|
214
|
+
},
|
|
215
|
+
resolvedConfig({ resolved }) {
|
|
216
|
+
const appContext = api.useAppContext();
|
|
217
|
+
const config = (0, import_config2.initialNormalizedConfig)(resolved, appContext, bundler);
|
|
218
|
+
return {
|
|
219
|
+
resolved: config
|
|
220
|
+
};
|
|
221
|
+
},
|
|
222
|
+
async modifyEntryImports({ entrypoint, imports }) {
|
|
223
|
+
const appContext = api.useAppContext();
|
|
224
|
+
const { srcDirectory, internalSrcAlias } = appContext;
|
|
225
|
+
const { fileSystemRoutes, nestedRoutesEntry } = entrypoint;
|
|
226
|
+
if (fileSystemRoutes && nestedRoutesEntry) {
|
|
227
|
+
const rootLayoutPath = path.join(nestedRoutesEntry, "layout");
|
|
228
|
+
const rootLayoutFile = (0, import_utils.findExists)(
|
|
229
|
+
[".js", ".ts", ".jsx", ".tsx"].map(
|
|
230
|
+
(ext) => `${rootLayoutPath}${ext}`
|
|
231
|
+
)
|
|
232
|
+
);
|
|
233
|
+
if (rootLayoutFile) {
|
|
234
|
+
const rootLayoutBuffer = await import_utils.fs.readFile(rootLayoutFile);
|
|
235
|
+
const rootLayout = rootLayoutBuffer.toString();
|
|
236
|
+
const [, moduleExports] = await (0, import_utils2.parseModule)({
|
|
237
|
+
source: rootLayout.toString(),
|
|
238
|
+
filename: rootLayoutFile
|
|
239
|
+
});
|
|
240
|
+
const hasAppConfig = moduleExports.some(
|
|
241
|
+
(e) => e.n === import_constants.APP_CONFIG_NAME
|
|
242
|
+
);
|
|
243
|
+
const generateLayoutPath = (0, import_utils2.replaceWithAlias)(
|
|
244
|
+
srcDirectory,
|
|
245
|
+
rootLayoutFile,
|
|
246
|
+
internalSrcAlias
|
|
247
|
+
);
|
|
248
|
+
if (hasAppConfig) {
|
|
249
|
+
imports.push({
|
|
250
|
+
value: generateLayoutPath,
|
|
251
|
+
specifiers: [{ imported: import_constants.APP_CONFIG_NAME }]
|
|
252
|
+
});
|
|
253
|
+
}
|
|
254
|
+
const hasAppInit = moduleExports.some(
|
|
255
|
+
(e) => e.n === import_constants.APP_INIT_EXPORTED
|
|
256
|
+
);
|
|
257
|
+
if (hasAppInit) {
|
|
258
|
+
imports.push({
|
|
259
|
+
value: generateLayoutPath,
|
|
260
|
+
specifiers: [
|
|
261
|
+
{ imported: import_constants.APP_INIT_EXPORTED, local: import_constants.APP_INIT_IMPORTED }
|
|
262
|
+
]
|
|
263
|
+
});
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
return {
|
|
268
|
+
entrypoint,
|
|
269
|
+
imports
|
|
270
|
+
};
|
|
271
|
+
},
|
|
272
|
+
async fileChange(e) {
|
|
273
|
+
const appContext = api.useAppContext();
|
|
274
|
+
const { appDirectory } = appContext;
|
|
275
|
+
const { filename, eventType } = e;
|
|
276
|
+
const isPageFile = (name) => pagesDir.some((pageDir) => name.includes(pageDir));
|
|
277
|
+
const absoluteFilePath = path.resolve(appDirectory, filename);
|
|
278
|
+
const isRouteComponent = isPageFile(absoluteFilePath) && (0, import_utils2.isPageComponentFile)(absoluteFilePath);
|
|
279
|
+
if (isRouteComponent && (eventType === "add" || eventType === "unlink")) {
|
|
280
|
+
const resolvedConfig = api.useResolvedConfigContext();
|
|
281
|
+
const { generateCode } = await Promise.resolve().then(() => __toESM(require("./generateCode")));
|
|
282
|
+
const entrypoints = (0, import_lodash.cloneDeep)(originEntrypoints);
|
|
283
|
+
generateCode(appContext, resolvedConfig, entrypoints, api);
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
};
|
|
287
|
+
}
|
|
288
|
+
});
|
|
289
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
290
|
+
0 && (module.exports = {});
|
|
File without changes
|
|
File without changes
|
|
@@ -1,26 +1,9 @@
|
|
|
1
1
|
var __create = Object.create;
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
|
-
var __defProps = Object.defineProperties;
|
|
4
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
6
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
8
5
|
var __getProtoOf = Object.getPrototypeOf;
|
|
9
6
|
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
7
|
var __export = (target, all) => {
|
|
25
8
|
for (var name in all)
|
|
26
9
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -38,26 +21,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
38
21
|
mod
|
|
39
22
|
));
|
|
40
23
|
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
24
|
var nestedRoutes_exports = {};
|
|
62
25
|
__export(nestedRoutes_exports, {
|
|
63
26
|
walk: () => walk
|
|
@@ -73,10 +36,11 @@ const replaceDynamicPath = (routePath) => {
|
|
|
73
36
|
};
|
|
74
37
|
const createIndexRoute = (routeInfo, rootDir, filename, entryName) => {
|
|
75
38
|
return createRoute(
|
|
76
|
-
|
|
39
|
+
{
|
|
40
|
+
...routeInfo,
|
|
77
41
|
index: true,
|
|
78
42
|
children: void 0
|
|
79
|
-
}
|
|
43
|
+
},
|
|
80
44
|
rootDir,
|
|
81
45
|
filename,
|
|
82
46
|
entryName
|
|
@@ -84,17 +48,18 @@ const createIndexRoute = (routeInfo, rootDir, filename, entryName) => {
|
|
|
84
48
|
};
|
|
85
49
|
const createRoute = (routeInfo, rootDir, filename, entryName) => {
|
|
86
50
|
const id = (0, import_utils.getRouteId)(filename, rootDir, entryName);
|
|
87
|
-
return
|
|
51
|
+
return {
|
|
52
|
+
...routeInfo,
|
|
88
53
|
id,
|
|
89
54
|
type: "nested"
|
|
90
|
-
}
|
|
55
|
+
};
|
|
91
56
|
};
|
|
92
|
-
const walk = (dirname, rootDir, alias, entryName) =>
|
|
57
|
+
const walk = async (dirname, rootDir, alias, entryName) => {
|
|
93
58
|
var _a, _b, _c, _d;
|
|
94
|
-
if (!
|
|
59
|
+
if (!await import_utils.fs.pathExists(dirname)) {
|
|
95
60
|
return null;
|
|
96
61
|
}
|
|
97
|
-
const isDirectory = (
|
|
62
|
+
const isDirectory = (await import_utils.fs.stat(dirname)).isDirectory();
|
|
98
63
|
if (!isDirectory) {
|
|
99
64
|
return null;
|
|
100
65
|
}
|
|
@@ -118,14 +83,14 @@ const walk = (dirname, rootDir, alias, entryName) => __async(void 0, null, funct
|
|
|
118
83
|
let pageRoute = null;
|
|
119
84
|
let splatLoaderFile = "";
|
|
120
85
|
let splatRoute = null;
|
|
121
|
-
const items =
|
|
86
|
+
const items = await import_utils.fs.readdir(dirname);
|
|
122
87
|
for (const item of items) {
|
|
123
88
|
const itemPath = path.join(dirname, item);
|
|
124
89
|
const extname = path.extname(item);
|
|
125
90
|
const itemWithoutExt = item.slice(0, -extname.length);
|
|
126
|
-
const isDirectory2 = (
|
|
91
|
+
const isDirectory2 = (await import_utils.fs.stat(itemPath)).isDirectory();
|
|
127
92
|
if (isDirectory2) {
|
|
128
|
-
const childRoute =
|
|
93
|
+
const childRoute = await walk(itemPath, rootDir, alias, entryName);
|
|
129
94
|
if (childRoute) {
|
|
130
95
|
(_a = route.children) == null ? void 0 : _a.push(childRoute);
|
|
131
96
|
}
|
|
@@ -200,13 +165,14 @@ const walk = (dirname, rootDir, alias, entryName) => __async(void 0, null, funct
|
|
|
200
165
|
const childRoute = finalRoute.children[0];
|
|
201
166
|
if (childRoute.path === "*") {
|
|
202
167
|
const path2 = `${finalRoute.path || ""}/${childRoute.path || ""}`;
|
|
203
|
-
finalRoute =
|
|
168
|
+
finalRoute = {
|
|
169
|
+
...childRoute,
|
|
204
170
|
path: path2
|
|
205
|
-
}
|
|
171
|
+
};
|
|
206
172
|
}
|
|
207
173
|
}
|
|
208
174
|
return finalRoute;
|
|
209
|
-
}
|
|
175
|
+
};
|
|
210
176
|
// Annotate the CommonJS export names for ESM import in node:
|
|
211
177
|
0 && (module.exports = {
|
|
212
178
|
walk
|
|
@@ -1,26 +1,9 @@
|
|
|
1
1
|
var __create = Object.create;
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
|
-
var __defProps = Object.defineProperties;
|
|
4
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
6
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
8
5
|
var __getProtoOf = Object.getPrototypeOf;
|
|
9
6
|
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
7
|
var __export = (target, all) => {
|
|
25
8
|
for (var name in all)
|
|
26
9
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -38,26 +21,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
38
21
|
mod
|
|
39
22
|
));
|
|
40
23
|
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
24
|
var templates_exports = {};
|
|
62
25
|
__export(templates_exports, {
|
|
63
26
|
fileSystemRoutes: () => fileSystemRoutes,
|
|
@@ -99,6 +62,7 @@ const renderFunction = ({
|
|
|
99
62
|
customBootstrap,
|
|
100
63
|
fileSystemRoutes: fileSystemRoutes2
|
|
101
64
|
}) => {
|
|
65
|
+
const bootstrap = "bootstrap(AppWrapper, MOUNT_ID, root, ReactDOM)";
|
|
102
66
|
return `
|
|
103
67
|
const finalAppConfig = {
|
|
104
68
|
...App.config,
|
|
@@ -120,7 +84,7 @@ const renderFunction = ({
|
|
|
120
84
|
|
|
121
85
|
|
|
122
86
|
if (IS_BROWSER) {
|
|
123
|
-
${customBootstrap ? `customBootstrap(AppWrapper);` :
|
|
87
|
+
${customBootstrap ? `customBootstrap(AppWrapper, () => ${bootstrap});` : `${bootstrap};`}
|
|
124
88
|
}
|
|
125
89
|
|
|
126
90
|
return AppWrapper
|
|
@@ -173,10 +137,11 @@ const routesForServer = ({
|
|
|
173
137
|
loader = `loader_${loaders.length - 1}`;
|
|
174
138
|
}
|
|
175
139
|
}
|
|
176
|
-
const finalRoute =
|
|
140
|
+
const finalRoute = {
|
|
141
|
+
...route,
|
|
177
142
|
loader,
|
|
178
143
|
children
|
|
179
|
-
}
|
|
144
|
+
};
|
|
180
145
|
return finalRoute;
|
|
181
146
|
};
|
|
182
147
|
let routesCode = `
|
|
@@ -206,13 +171,13 @@ const routesForServer = ({
|
|
|
206
171
|
${routesCode}
|
|
207
172
|
`;
|
|
208
173
|
};
|
|
209
|
-
const fileSystemRoutes =
|
|
174
|
+
const fileSystemRoutes = async ({
|
|
210
175
|
routes,
|
|
211
176
|
ssrMode,
|
|
212
177
|
nestedRoutesEntry,
|
|
213
178
|
entryName,
|
|
214
179
|
internalDirectory
|
|
215
|
-
}) {
|
|
180
|
+
}) => {
|
|
216
181
|
const loadings = [];
|
|
217
182
|
const errors = [];
|
|
218
183
|
const loaders = [];
|
|
@@ -286,13 +251,14 @@ const fileSystemRoutes = (_0) => __async(void 0, [_0], function* ({
|
|
|
286
251
|
lazyImport = `() => import('${route._component}')`;
|
|
287
252
|
component = `loadable(${lazyImport})`;
|
|
288
253
|
}
|
|
289
|
-
const finalRoute =
|
|
254
|
+
const finalRoute = {
|
|
255
|
+
...route,
|
|
290
256
|
lazyImport,
|
|
291
257
|
loading,
|
|
292
258
|
loader,
|
|
293
259
|
error,
|
|
294
260
|
children
|
|
295
|
-
}
|
|
261
|
+
};
|
|
296
262
|
if (route._component) {
|
|
297
263
|
finalRoute.component = component;
|
|
298
264
|
}
|
|
@@ -307,9 +273,10 @@ const fileSystemRoutes = (_0) => __async(void 0, [_0], function* ({
|
|
|
307
273
|
routeComponentsCode += `${JSON.stringify(newRoute, null, 2).replace(/"(loadable.*\))"/g, "$1").replace(/"(loadableLazy.*\))"/g, "$1").replace(/"(\(\)[^,]+)",/g, "$1,").replace(/"(lazy\(.*\))"/g, "$1").replace(/"(loading_[^"])"/g, "$1").replace(/"(loader_[^"])"/g, "$1").replace(/"(RootLayout)"/g, "$1").replace(/"(error_[^"])"/g, "$1").replace(/\\"/g, '"')},`;
|
|
308
274
|
} else {
|
|
309
275
|
const component = `loadable(() => import('${route._component}'))`;
|
|
310
|
-
const finalRoute =
|
|
276
|
+
const finalRoute = {
|
|
277
|
+
...route,
|
|
311
278
|
component
|
|
312
|
-
}
|
|
279
|
+
};
|
|
313
280
|
routeComponentsCode += `${JSON.stringify(finalRoute, null, 2).replace(/"(loadable[^"]*)"/g, "$1").replace(/"(lazy[^"]*)"/g, "$1")},`;
|
|
314
281
|
}
|
|
315
282
|
}
|
|
@@ -337,8 +304,8 @@ const fileSystemRoutes = (_0) => __async(void 0, [_0], function* ({
|
|
|
337
304
|
`;
|
|
338
305
|
}
|
|
339
306
|
}
|
|
340
|
-
|
|
341
|
-
|
|
307
|
+
await import_utils.fs.ensureFile(loadersMapFile);
|
|
308
|
+
await import_utils.fs.writeJSON(loadersMapFile, loadersMap);
|
|
342
309
|
return `
|
|
343
310
|
${importLazyCode}
|
|
344
311
|
${rootLayoutCode}
|
|
@@ -347,7 +314,7 @@ const fileSystemRoutes = (_0) => __async(void 0, [_0], function* ({
|
|
|
347
314
|
${importLoadersCode}
|
|
348
315
|
${routeComponentsCode}
|
|
349
316
|
`;
|
|
350
|
-
}
|
|
317
|
+
};
|
|
351
318
|
// Annotate the CommonJS export names for ESM import in node:
|
|
352
319
|
0 && (module.exports = {
|
|
353
320
|
fileSystemRoutes,
|
|
@@ -21,26 +21,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
21
21
|
mod
|
|
22
22
|
));
|
|
23
23
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
24
|
-
var __async = (__this, __arguments, generator) => {
|
|
25
|
-
return new Promise((resolve, reject) => {
|
|
26
|
-
var fulfilled = (value) => {
|
|
27
|
-
try {
|
|
28
|
-
step(generator.next(value));
|
|
29
|
-
} catch (e) {
|
|
30
|
-
reject(e);
|
|
31
|
-
}
|
|
32
|
-
};
|
|
33
|
-
var rejected = (value) => {
|
|
34
|
-
try {
|
|
35
|
-
step(generator.throw(value));
|
|
36
|
-
} catch (e) {
|
|
37
|
-
reject(e);
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
41
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
42
|
-
});
|
|
43
|
-
};
|
|
44
24
|
var utils_exports = {};
|
|
45
25
|
__export(utils_exports, {
|
|
46
26
|
getDefaultImports: () => getDefaultImports,
|
|
@@ -135,28 +115,28 @@ const isPageComponentFile = (filePath) => {
|
|
|
135
115
|
return false;
|
|
136
116
|
};
|
|
137
117
|
const replaceWithAlias = (base, filePath, alias) => (0, import_utils.normalizeToPosixPath)(import_path.default.join(alias, import_path.default.relative(base, filePath)));
|
|
138
|
-
const parseModule =
|
|
118
|
+
const parseModule = async ({
|
|
139
119
|
source,
|
|
140
120
|
filename
|
|
141
|
-
}) {
|
|
121
|
+
}) => {
|
|
142
122
|
let content = source;
|
|
143
123
|
if (import_constants.JS_EXTENSIONS.some((ext) => filename.endsWith(ext))) {
|
|
144
|
-
const result =
|
|
124
|
+
const result = await (0, import_esbuild.transform)(content, {
|
|
145
125
|
loader: import_path.default.extname(filename).slice(1),
|
|
146
126
|
format: "esm"
|
|
147
127
|
});
|
|
148
128
|
content = result.code;
|
|
149
129
|
}
|
|
150
|
-
return
|
|
151
|
-
}
|
|
152
|
-
const hasLoader = (filename) =>
|
|
153
|
-
const source =
|
|
154
|
-
const [, moduleExports] =
|
|
130
|
+
return await (0, import_es_module_lexer.parse)(content);
|
|
131
|
+
};
|
|
132
|
+
const hasLoader = async (filename) => {
|
|
133
|
+
const source = await import_utils.fs.readFile(filename);
|
|
134
|
+
const [, moduleExports] = await parseModule({
|
|
155
135
|
source: source.toString(),
|
|
156
136
|
filename
|
|
157
137
|
});
|
|
158
138
|
return moduleExports.some((e) => e.n === import_constants.LOADER_EXPORT_NAME);
|
|
159
|
-
}
|
|
139
|
+
};
|
|
160
140
|
const getServerLoadersFile = (internalDirectory, entryName) => {
|
|
161
141
|
return import_path.default.join(internalDirectory, entryName, "route-server-loaders.js");
|
|
162
142
|
};
|
|
File without changes
|
|
File without changes
|