@modern-js/app-tools 2.35.1 → 2.35.2-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/analyze/constants.js +68 -75
- package/dist/cjs/analyze/generateCode.js +74 -57
- package/dist/cjs/analyze/getBundleEntry.js +53 -27
- package/dist/cjs/analyze/getClientRoutes/getRoutes.js +63 -37
- package/dist/cjs/analyze/getClientRoutes/getRoutesLegacy.js +63 -37
- package/dist/cjs/analyze/getClientRoutes/index.js +27 -17
- package/dist/cjs/analyze/getClientRoutes/utils.js +47 -30
- package/dist/cjs/analyze/getFileSystemEntry.js +58 -32
- package/dist/cjs/analyze/getHtmlTemplate.js +45 -20
- package/dist/cjs/analyze/getServerRoutes.js +55 -29
- package/dist/cjs/analyze/index.js +77 -55
- package/dist/cjs/analyze/isDefaultExportFunction.js +42 -17
- package/dist/cjs/analyze/makeLegalIdentifier.js +24 -7
- package/dist/cjs/analyze/nestedRoutes.js +108 -65
- package/dist/cjs/analyze/templates.js +135 -53
- package/dist/cjs/analyze/utils.js +101 -67
- package/dist/cjs/builder/builder-rspack/adapterCopy.js +46 -20
- package/dist/cjs/builder/builder-rspack/index.js +29 -12
- package/dist/cjs/builder/builder-webpack/adapterModern.js +28 -11
- package/dist/cjs/builder/builder-webpack/createCopyPattern.js +30 -20
- package/dist/cjs/builder/builder-webpack/index.js +40 -14
- package/dist/cjs/builder/generator/createBuilderOptions.js +24 -7
- package/dist/cjs/builder/generator/createBuilderProviderConfig.js +26 -9
- package/dist/cjs/builder/generator/getBuilderTargets.js +27 -10
- package/dist/cjs/builder/generator/index.js +44 -18
- package/dist/cjs/builder/index.js +39 -13
- package/dist/cjs/builder/shared/builderPlugins/adapterBasic.js +34 -7
- package/dist/cjs/builder/shared/builderPlugins/adapterHtml.js +36 -19
- package/dist/cjs/builder/shared/builderPlugins/adapterSSR.js +47 -21
- package/dist/cjs/builder/shared/builderPlugins/index.js +24 -6
- package/dist/cjs/builder/shared/bundlerPlugins/HtmlAsyncChunkPlugin.js +27 -10
- package/dist/cjs/builder/shared/bundlerPlugins/HtmlBottomTemplate.js +29 -12
- package/dist/cjs/builder/shared/bundlerPlugins/RouterPlugin.js +42 -25
- package/dist/cjs/builder/shared/bundlerPlugins/index.js +24 -6
- package/dist/cjs/builder/shared/createCopyInfo.js +38 -12
- package/dist/cjs/builder/shared/index.js +24 -6
- package/dist/cjs/builder/shared/loaders/serverModuleLoader.js +21 -8
- package/dist/cjs/builder/shared/types.js +15 -3
- package/dist/cjs/commands/build.js +33 -16
- package/dist/cjs/commands/deploy.js +24 -7
- package/dist/cjs/commands/dev.js +40 -23
- package/dist/cjs/commands/index.js +24 -6
- package/dist/cjs/commands/inspect.js +26 -9
- package/dist/cjs/commands/serve.js +48 -22
- package/dist/cjs/config/default.js +33 -23
- package/dist/cjs/config/index.js +24 -6
- package/dist/cjs/config/initialize/index.js +27 -10
- package/dist/cjs/config/initialize/inits.js +44 -25
- package/dist/cjs/config/legacy/createHtmlConfig.js +24 -7
- package/dist/cjs/config/legacy/createOutputConfig.js +24 -7
- package/dist/cjs/config/legacy/createSourceConfig.js +24 -7
- package/dist/cjs/config/legacy/createToolsConfig.js +24 -7
- package/dist/cjs/config/legacy/index.js +34 -23
- package/dist/cjs/defineConfig.js +25 -15
- package/dist/cjs/exports/server.js +25 -8
- package/dist/cjs/hooks.js +50 -33
- package/dist/cjs/index.js +95 -80
- package/dist/cjs/initialize/index.js +30 -17
- package/dist/cjs/locale/en.js +24 -7
- package/dist/cjs/locale/index.js +31 -21
- package/dist/cjs/locale/zh.js +24 -7
- package/dist/cjs/schema/Schema.js +28 -11
- package/dist/cjs/schema/index.js +40 -21
- package/dist/cjs/schema/legacy.js +30 -17
- package/dist/cjs/types/config/deploy.js +15 -3
- package/dist/cjs/types/config/dev.js +15 -3
- package/dist/cjs/types/config/experiments.js +15 -3
- package/dist/cjs/types/config/html.js +15 -3
- package/dist/cjs/types/config/index.js +20 -4
- package/dist/cjs/types/config/output.js +15 -3
- package/dist/cjs/types/config/performance.js +15 -3
- package/dist/cjs/types/config/security.js +15 -3
- package/dist/cjs/types/config/source.js +15 -3
- package/dist/cjs/types/config/testing.js +15 -3
- package/dist/cjs/types/config/tools.js +15 -3
- package/dist/cjs/types/hooks.js +15 -3
- package/dist/cjs/types/index.js +24 -6
- package/dist/cjs/types/legacyConfig/deploy.js +15 -3
- package/dist/cjs/types/legacyConfig/dev.js +15 -3
- package/dist/cjs/types/legacyConfig/index.js +15 -3
- package/dist/cjs/types/legacyConfig/output.js +15 -3
- package/dist/cjs/types/legacyConfig/source.js +15 -3
- package/dist/cjs/types/legacyConfig/testing.js +15 -3
- package/dist/cjs/types/legacyConfig/tools.js +15 -3
- package/dist/cjs/types/utils.js +15 -3
- package/dist/cjs/utils/config.js +50 -33
- package/dist/cjs/utils/createServer.js +43 -26
- package/dist/cjs/utils/env.js +26 -9
- package/dist/cjs/utils/generateWatchFiles.js +41 -22
- package/dist/cjs/utils/getSelectedEntries.js +30 -13
- package/dist/cjs/utils/getServerInternalPlugins.js +24 -7
- package/dist/cjs/utils/printInstructions.js +27 -10
- package/dist/cjs/utils/restart.js +30 -13
- package/dist/cjs/utils/routes.js +37 -11
- package/dist/cjs/utils/types.js +15 -3
- package/dist/esm/analyze/constants.js +48 -22
- package/dist/esm/analyze/generateCode.js +38 -33
- package/dist/esm/analyze/getBundleEntry.js +4 -1
- package/dist/esm/analyze/getClientRoutes/getRoutes.js +12 -9
- package/dist/esm/analyze/getClientRoutes/getRoutesLegacy.js +12 -9
- package/dist/esm/analyze/getClientRoutes/index.js +6 -2
- package/dist/esm/analyze/getClientRoutes/utils.js +9 -4
- package/dist/esm/analyze/getFileSystemEntry.js +10 -7
- package/dist/esm/analyze/getHtmlTemplate.js +7 -4
- package/dist/esm/analyze/getServerRoutes.js +8 -5
- package/dist/esm/analyze/index.js +27 -24
- package/dist/esm/analyze/isDefaultExportFunction.js +4 -1
- package/dist/esm/analyze/makeLegalIdentifier.js +4 -1
- package/dist/esm/analyze/nestedRoutes.js +90 -30
- package/dist/esm/analyze/templates.js +121 -30
- package/dist/esm/analyze/utils.js +103 -18
- package/dist/esm/builder/builder-rspack/adapterCopy.js +4 -1
- package/dist/esm/builder/builder-rspack/index.js +4 -1
- package/dist/esm/builder/builder-webpack/adapterModern.js +4 -1
- package/dist/esm/builder/builder-webpack/createCopyPattern.js +8 -4
- package/dist/esm/builder/builder-webpack/index.js +4 -1
- package/dist/esm/builder/generator/createBuilderOptions.js +5 -2
- package/dist/esm/builder/generator/createBuilderProviderConfig.js +4 -1
- package/dist/esm/builder/generator/getBuilderTargets.js +4 -1
- package/dist/esm/builder/generator/index.js +5 -2
- package/dist/esm/builder/index.js +4 -1
- package/dist/esm/builder/shared/builderPlugins/adapterBasic.js +4 -1
- package/dist/esm/builder/shared/builderPlugins/adapterHtml.js +11 -8
- package/dist/esm/builder/shared/builderPlugins/adapterSSR.js +10 -7
- package/dist/esm/builder/shared/bundlerPlugins/HtmlAsyncChunkPlugin.js +4 -1
- package/dist/esm/builder/shared/bundlerPlugins/HtmlBottomTemplate.js +4 -1
- package/dist/esm/builder/shared/bundlerPlugins/RouterPlugin.js +7 -4
- package/dist/esm/builder/shared/createCopyInfo.js +7 -4
- package/dist/esm/builder/shared/loaders/serverModuleLoader.js +4 -1
- package/dist/esm/builder/shared/types.js +0 -1
- package/dist/esm/commands/build.js +6 -3
- package/dist/esm/commands/deploy.js +4 -1
- package/dist/esm/commands/dev.js +12 -9
- package/dist/esm/commands/inspect.js +4 -1
- package/dist/esm/commands/serve.js +7 -4
- package/dist/esm/config/default.js +12 -8
- package/dist/esm/config/initialize/index.js +4 -1
- package/dist/esm/config/initialize/inits.js +6 -2
- package/dist/esm/config/legacy/createHtmlConfig.js +17 -14
- package/dist/esm/config/legacy/createOutputConfig.js +19 -16
- package/dist/esm/config/legacy/createSourceConfig.js +14 -11
- package/dist/esm/config/legacy/createToolsConfig.js +18 -15
- package/dist/esm/config/legacy/index.js +21 -16
- package/dist/esm/defineConfig.js +6 -2
- package/dist/esm/exports/server.js +4 -1
- package/dist/esm/hooks.js +4 -1
- package/dist/esm/index.js +19 -11
- package/dist/esm/initialize/index.js +9 -6
- package/dist/esm/locale/en.js +4 -1
- package/dist/esm/locale/index.js +4 -1
- package/dist/esm/locale/zh.js +4 -1
- package/dist/esm/schema/Schema.js +6 -3
- package/dist/esm/schema/index.js +5 -2
- package/dist/esm/schema/legacy.js +4 -1
- package/dist/esm/types/config/deploy.js +0 -1
- package/dist/esm/types/config/dev.js +0 -1
- package/dist/esm/types/config/experiments.js +0 -1
- package/dist/esm/types/config/html.js +0 -1
- package/dist/esm/types/config/output.js +0 -1
- package/dist/esm/types/config/performance.js +0 -1
- package/dist/esm/types/config/security.js +0 -1
- package/dist/esm/types/config/source.js +0 -1
- package/dist/esm/types/config/testing.js +0 -1
- package/dist/esm/types/config/tools.js +0 -1
- package/dist/esm/types/hooks.js +0 -1
- package/dist/esm/types/legacyConfig/deploy.js +0 -1
- package/dist/esm/types/legacyConfig/dev.js +0 -1
- package/dist/esm/types/legacyConfig/index.js +0 -1
- package/dist/esm/types/legacyConfig/output.js +0 -1
- package/dist/esm/types/legacyConfig/source.js +0 -1
- package/dist/esm/types/legacyConfig/testing.js +0 -1
- package/dist/esm/types/legacyConfig/tools.js +0 -1
- package/dist/esm/types/utils.js +0 -1
- package/dist/esm/utils/config.js +12 -6
- package/dist/esm/utils/createServer.js +12 -5
- package/dist/esm/utils/env.js +4 -1
- package/dist/esm/utils/generateWatchFiles.js +6 -2
- package/dist/esm/utils/getSelectedEntries.js +4 -1
- package/dist/esm/utils/getServerInternalPlugins.js +5 -2
- package/dist/esm/utils/printInstructions.js +4 -1
- package/dist/esm/utils/restart.js +4 -1
- package/dist/esm/utils/routes.js +3 -1
- package/dist/esm/utils/types.js +0 -1
- package/dist/esm-node/analyze/constants.js +48 -22
- package/dist/esm-node/analyze/generateCode.js +8 -3
- package/dist/esm-node/analyze/getBundleEntry.js +4 -1
- package/dist/esm-node/analyze/getClientRoutes/getRoutes.js +4 -1
- package/dist/esm-node/analyze/getClientRoutes/getRoutesLegacy.js +4 -1
- package/dist/esm-node/analyze/getClientRoutes/index.js +6 -2
- package/dist/esm-node/analyze/getClientRoutes/utils.js +9 -4
- package/dist/esm-node/analyze/getFileSystemEntry.js +4 -1
- package/dist/esm-node/analyze/getHtmlTemplate.js +4 -1
- package/dist/esm-node/analyze/getServerRoutes.js +4 -1
- package/dist/esm-node/analyze/index.js +4 -1
- package/dist/esm-node/analyze/isDefaultExportFunction.js +4 -1
- package/dist/esm-node/analyze/makeLegalIdentifier.js +4 -1
- package/dist/esm-node/analyze/nestedRoutes.js +39 -9
- package/dist/esm-node/analyze/templates.js +93 -18
- package/dist/esm-node/analyze/utils.js +48 -16
- package/dist/esm-node/builder/builder-rspack/adapterCopy.js +4 -1
- package/dist/esm-node/builder/builder-rspack/index.js +4 -1
- package/dist/esm-node/builder/builder-webpack/adapterModern.js +4 -1
- package/dist/esm-node/builder/builder-webpack/createCopyPattern.js +6 -2
- package/dist/esm-node/builder/builder-webpack/index.js +4 -1
- package/dist/esm-node/builder/generator/createBuilderOptions.js +4 -1
- package/dist/esm-node/builder/generator/createBuilderProviderConfig.js +4 -1
- package/dist/esm-node/builder/generator/getBuilderTargets.js +4 -1
- package/dist/esm-node/builder/generator/index.js +4 -1
- package/dist/esm-node/builder/index.js +4 -1
- package/dist/esm-node/builder/shared/builderPlugins/adapterBasic.js +4 -1
- package/dist/esm-node/builder/shared/builderPlugins/adapterHtml.js +4 -1
- package/dist/esm-node/builder/shared/builderPlugins/adapterSSR.js +4 -1
- package/dist/esm-node/builder/shared/bundlerPlugins/HtmlAsyncChunkPlugin.js +4 -1
- package/dist/esm-node/builder/shared/bundlerPlugins/HtmlBottomTemplate.js +4 -1
- package/dist/esm-node/builder/shared/bundlerPlugins/RouterPlugin.js +4 -1
- package/dist/esm-node/builder/shared/createCopyInfo.js +4 -1
- package/dist/esm-node/builder/shared/loaders/serverModuleLoader.js +4 -1
- package/dist/esm-node/builder/shared/types.js +0 -1
- package/dist/esm-node/commands/build.js +4 -1
- package/dist/esm-node/commands/deploy.js +4 -1
- package/dist/esm-node/commands/dev.js +4 -1
- package/dist/esm-node/commands/inspect.js +4 -1
- package/dist/esm-node/commands/serve.js +4 -1
- package/dist/esm-node/config/default.js +6 -2
- package/dist/esm-node/config/initialize/index.js +4 -1
- package/dist/esm-node/config/initialize/inits.js +6 -2
- package/dist/esm-node/config/legacy/createHtmlConfig.js +4 -1
- package/dist/esm-node/config/legacy/createOutputConfig.js +4 -1
- package/dist/esm-node/config/legacy/createSourceConfig.js +4 -1
- package/dist/esm-node/config/legacy/createToolsConfig.js +4 -1
- package/dist/esm-node/config/legacy/index.js +7 -2
- package/dist/esm-node/defineConfig.js +6 -2
- package/dist/esm-node/exports/server.js +4 -1
- package/dist/esm-node/hooks.js +4 -1
- package/dist/esm-node/index.js +14 -6
- package/dist/esm-node/initialize/index.js +4 -1
- package/dist/esm-node/locale/en.js +4 -1
- package/dist/esm-node/locale/index.js +4 -1
- package/dist/esm-node/locale/zh.js +4 -1
- package/dist/esm-node/schema/Schema.js +4 -1
- package/dist/esm-node/schema/index.js +5 -2
- package/dist/esm-node/schema/legacy.js +4 -1
- package/dist/esm-node/types/config/deploy.js +0 -1
- package/dist/esm-node/types/config/dev.js +0 -1
- package/dist/esm-node/types/config/experiments.js +0 -1
- package/dist/esm-node/types/config/html.js +0 -1
- package/dist/esm-node/types/config/output.js +0 -1
- package/dist/esm-node/types/config/performance.js +0 -1
- package/dist/esm-node/types/config/security.js +0 -1
- package/dist/esm-node/types/config/source.js +0 -1
- package/dist/esm-node/types/config/testing.js +0 -1
- package/dist/esm-node/types/config/tools.js +0 -1
- package/dist/esm-node/types/hooks.js +0 -1
- package/dist/esm-node/types/legacyConfig/deploy.js +0 -1
- package/dist/esm-node/types/legacyConfig/dev.js +0 -1
- package/dist/esm-node/types/legacyConfig/index.js +0 -1
- package/dist/esm-node/types/legacyConfig/output.js +0 -1
- package/dist/esm-node/types/legacyConfig/source.js +0 -1
- package/dist/esm-node/types/legacyConfig/testing.js +0 -1
- package/dist/esm-node/types/legacyConfig/tools.js +0 -1
- package/dist/esm-node/types/utils.js +0 -1
- package/dist/esm-node/utils/config.js +10 -4
- package/dist/esm-node/utils/createServer.js +12 -5
- package/dist/esm-node/utils/env.js +4 -1
- package/dist/esm-node/utils/generateWatchFiles.js +6 -2
- package/dist/esm-node/utils/getSelectedEntries.js +4 -1
- package/dist/esm-node/utils/getServerInternalPlugins.js +4 -1
- package/dist/esm-node/utils/printInstructions.js +4 -1
- package/dist/esm-node/utils/restart.js +4 -1
- package/dist/esm-node/utils/routes.js +3 -1
- package/dist/esm-node/utils/types.js +0 -1
- package/dist/js/modern/analyze/constants.js +54 -0
- package/dist/js/modern/analyze/generateCode.js +247 -0
- package/dist/js/modern/analyze/getBundleEntry.js +71 -0
- package/dist/js/modern/analyze/getClientRoutes/getRoutes.js +220 -0
- package/dist/js/modern/analyze/getClientRoutes/getRoutesLegacy.js +216 -0
- package/dist/js/modern/analyze/getClientRoutes/index.js +6 -0
- package/dist/js/modern/analyze/getClientRoutes/utils.js +31 -0
- package/dist/js/modern/analyze/getFileSystemEntry.js +109 -0
- package/dist/js/modern/analyze/getHtmlTemplate.js +115 -0
- package/dist/js/modern/analyze/getServerRoutes.js +175 -0
- package/dist/js/modern/analyze/index.js +332 -0
- package/dist/js/modern/analyze/isDefaultExportFunction.js +42 -0
- package/dist/js/modern/analyze/makeLegalIdentifier.js +13 -0
- package/dist/js/modern/analyze/nestedRoutes.js +157 -0
- package/dist/js/modern/analyze/templates.js +334 -0
- package/dist/js/modern/analyze/utils.js +141 -0
- package/dist/js/modern/builder/builderPlugins/compatModern.js +233 -0
- package/dist/js/modern/builder/index.js +159 -0
- package/dist/js/modern/builder/loaders/routerLoader.js +17 -0
- package/dist/js/modern/builder/loaders/serverModuleLoader.js +7 -0
- package/dist/js/modern/builder/share.js +46 -0
- package/dist/js/modern/builder/webpackPlugins/htmlAsyncChunkPlugin.js +30 -0
- package/dist/js/modern/builder/webpackPlugins/htmlBottomTemplate.js +37 -0
- package/dist/js/modern/builder/webpackPlugins/routerPlugin.js +113 -0
- package/dist/js/modern/commands/build.js +91 -0
- package/dist/js/modern/commands/deploy.js +28 -0
- package/dist/js/modern/commands/dev.js +109 -0
- package/dist/js/modern/commands/index.js +3 -0
- package/dist/js/modern/commands/inspect.js +38 -0
- package/dist/js/modern/commands/serve.js +54 -0
- package/dist/js/modern/config/default.js +175 -0
- package/dist/js/modern/config/index.js +8 -0
- package/dist/js/modern/config/initial/createHtmlConfig.js +35 -0
- package/dist/js/modern/config/initial/createOutputConfig.js +68 -0
- package/dist/js/modern/config/initial/createSourceConfig.js +39 -0
- package/dist/js/modern/config/initial/createToolsConfig.js +42 -0
- package/dist/js/modern/config/initial/index.js +16 -0
- package/dist/js/modern/config/initial/inits.js +152 -0
- package/dist/js/modern/config/initial/transformNormalizedConfig.js +47 -0
- package/dist/js/modern/defineConfig.js +27 -0
- package/dist/js/modern/exports/server.js +4 -0
- package/dist/js/modern/hooks.js +35 -0
- package/dist/js/modern/index.js +211 -0
- package/dist/js/modern/initialize/index.js +124 -0
- package/dist/js/modern/locale/en.js +36 -0
- package/dist/js/modern/locale/index.js +9 -0
- package/dist/js/modern/locale/zh.js +36 -0
- package/dist/js/modern/schema/Schema.js +40 -0
- package/dist/js/modern/schema/index.js +88 -0
- package/dist/js/modern/schema/legacy.js +148 -0
- package/dist/js/modern/types/config/deploy.js +0 -0
- package/dist/js/modern/types/config/dev.js +0 -0
- package/dist/js/modern/types/config/experiments.js +0 -0
- package/dist/js/modern/types/config/html.js +0 -0
- package/dist/js/modern/types/config/index.js +1 -0
- package/dist/js/modern/types/config/output.js +0 -0
- package/dist/js/modern/types/config/performance.js +0 -0
- package/dist/js/modern/types/config/security.js +0 -0
- package/dist/js/modern/types/config/source.js +0 -0
- package/dist/js/modern/types/config/tools.js +0 -0
- package/dist/js/modern/types/hooks.js +0 -0
- package/dist/js/modern/types/index.js +3 -0
- package/dist/js/modern/types/legacyConfig/deploy.js +0 -0
- package/dist/js/modern/types/legacyConfig/dev.js +0 -0
- package/dist/js/modern/types/legacyConfig/index.js +0 -0
- package/dist/js/modern/types/legacyConfig/output.js +0 -0
- package/dist/js/modern/types/legacyConfig/source.js +0 -0
- package/dist/js/modern/types/legacyConfig/tools.js +0 -0
- package/dist/js/modern/utils/config.js +128 -0
- package/dist/js/modern/utils/createServer.js +75 -0
- package/dist/js/modern/utils/env.js +15 -0
- package/dist/js/modern/utils/generateWatchFiles.js +55 -0
- package/dist/js/modern/utils/getSelectedEntries.js +58 -0
- package/dist/js/modern/utils/getServerInternalPlugins.js +58 -0
- package/dist/js/modern/utils/language.js +8 -0
- package/dist/js/modern/utils/printInstructions.js +31 -0
- package/dist/js/modern/utils/restart.js +44 -0
- package/dist/js/modern/utils/routes.js +30 -0
- package/dist/js/modern/utils/types.js +0 -0
- package/dist/js/node/analyze/constants.js +98 -0
- package/dist/js/node/analyze/generateCode.js +271 -0
- package/dist/js/node/analyze/getBundleEntry.js +95 -0
- package/dist/js/node/analyze/getClientRoutes/getRoutes.js +242 -0
- package/dist/js/node/analyze/getClientRoutes/getRoutesLegacy.js +238 -0
- package/dist/js/node/analyze/getClientRoutes/index.js +30 -0
- package/dist/js/node/analyze/getClientRoutes/utils.js +58 -0
- package/dist/js/node/analyze/getFileSystemEntry.js +131 -0
- package/dist/js/node/analyze/getHtmlTemplate.js +144 -0
- package/dist/js/node/analyze/getServerRoutes.js +194 -0
- package/dist/js/node/analyze/index.js +339 -0
- package/dist/js/node/analyze/isDefaultExportFunction.js +71 -0
- package/dist/js/node/analyze/makeLegalIdentifier.js +36 -0
- package/dist/js/node/analyze/nestedRoutes.js +184 -0
- package/dist/js/node/analyze/templates.js +365 -0
- package/dist/js/node/analyze/utils.js +172 -0
- package/dist/js/node/builder/builderPlugins/compatModern.js +258 -0
- package/dist/js/node/builder/index.js +177 -0
- package/dist/js/node/builder/loaders/routerLoader.js +38 -0
- package/dist/js/node/builder/loaders/serverModuleLoader.js +28 -0
- package/dist/js/node/builder/share.js +75 -0
- package/dist/js/node/builder/webpackPlugins/htmlAsyncChunkPlugin.js +53 -0
- package/dist/js/node/builder/webpackPlugins/htmlBottomTemplate.js +60 -0
- package/dist/js/node/builder/webpackPlugins/routerPlugin.js +135 -0
- package/dist/js/node/commands/build.js +112 -0
- package/dist/js/node/commands/deploy.js +51 -0
- package/dist/js/node/commands/dev.js +126 -0
- package/dist/js/node/commands/index.js +19 -0
- package/dist/js/node/commands/inspect.js +61 -0
- package/dist/js/node/commands/serve.js +83 -0
- package/dist/js/node/config/default.js +197 -0
- package/dist/js/node/config/index.js +34 -0
- package/dist/js/node/config/initial/createHtmlConfig.js +58 -0
- package/dist/js/node/config/initial/createOutputConfig.js +91 -0
- package/dist/js/node/config/initial/createSourceConfig.js +62 -0
- package/dist/js/node/config/initial/createToolsConfig.js +65 -0
- package/dist/js/node/config/initial/index.js +41 -0
- package/dist/js/node/config/initial/inits.js +175 -0
- package/dist/js/node/config/initial/transformNormalizedConfig.js +70 -0
- package/dist/js/node/defineConfig.js +49 -0
- package/dist/js/node/exports/server.js +27 -0
- package/dist/js/node/hooks.js +54 -0
- package/dist/js/node/index.js +235 -0
- package/dist/js/node/initialize/index.js +134 -0
- package/dist/js/node/locale/en.js +59 -0
- package/dist/js/node/locale/index.js +33 -0
- package/dist/js/node/locale/zh.js +59 -0
- package/dist/js/node/schema/Schema.js +63 -0
- package/dist/js/node/schema/index.js +118 -0
- package/dist/js/node/schema/legacy.js +169 -0
- package/dist/js/node/types/config/deploy.js +15 -0
- package/dist/js/node/types/config/dev.js +15 -0
- package/dist/js/node/types/config/experiments.js +15 -0
- package/dist/js/node/types/config/html.js +15 -0
- package/dist/js/node/types/config/index.js +17 -0
- package/dist/js/node/types/config/output.js +15 -0
- package/dist/js/node/types/config/performance.js +15 -0
- package/dist/js/node/types/config/security.js +15 -0
- package/dist/js/node/types/config/source.js +15 -0
- package/dist/js/node/types/config/tools.js +15 -0
- package/dist/js/node/types/hooks.js +15 -0
- package/dist/js/node/types/index.js +19 -0
- package/dist/js/node/types/legacyConfig/deploy.js +15 -0
- package/dist/js/node/types/legacyConfig/dev.js +15 -0
- package/dist/js/node/types/legacyConfig/index.js +15 -0
- package/dist/js/node/types/legacyConfig/output.js +15 -0
- package/dist/js/node/types/legacyConfig/source.js +15 -0
- package/dist/js/node/types/legacyConfig/tools.js +15 -0
- package/dist/js/node/utils/config.js +153 -0
- package/dist/js/node/utils/createServer.js +106 -0
- package/dist/js/node/utils/env.js +38 -0
- package/dist/js/node/utils/generateWatchFiles.js +85 -0
- package/dist/js/node/utils/getSelectedEntries.js +81 -0
- package/dist/js/node/utils/getServerInternalPlugins.js +79 -0
- package/dist/js/node/utils/language.js +31 -0
- package/dist/js/node/utils/printInstructions.js +54 -0
- package/dist/js/node/utils/restart.js +67 -0
- package/dist/js/node/utils/routes.js +59 -0
- package/dist/js/node/utils/types.js +15 -0
- package/dist/js/treeshaking/analyze/constants.js +40 -0
- package/dist/js/treeshaking/analyze/generateCode.js +485 -0
- package/dist/js/treeshaking/analyze/getBundleEntry.js +62 -0
- package/dist/js/treeshaking/analyze/getClientRoutes/getRoutes.js +233 -0
- package/dist/js/treeshaking/analyze/getClientRoutes/getRoutesLegacy.js +231 -0
- package/dist/js/treeshaking/analyze/getClientRoutes/index.js +3 -0
- package/dist/js/treeshaking/analyze/getClientRoutes/utils.js +23 -0
- package/dist/js/treeshaking/analyze/getFileSystemEntry.js +107 -0
- package/dist/js/treeshaking/analyze/getHtmlTemplate.js +302 -0
- package/dist/js/treeshaking/analyze/getServerRoutes.js +222 -0
- package/dist/js/treeshaking/analyze/index.js +697 -0
- package/dist/js/treeshaking/analyze/isDefaultExportFunction.js +47 -0
- package/dist/js/treeshaking/analyze/makeLegalIdentifier.js +13 -0
- package/dist/js/treeshaking/analyze/nestedRoutes.js +384 -0
- package/dist/js/treeshaking/analyze/templates.js +468 -0
- package/dist/js/treeshaking/analyze/utils.js +374 -0
- package/dist/js/treeshaking/builder/builderPlugins/compatModern.js +304 -0
- package/dist/js/treeshaking/builder/index.js +374 -0
- package/dist/js/treeshaking/builder/loaders/routerLoader.js +13 -0
- package/dist/js/treeshaking/builder/loaders/serverModuleLoader.js +5 -0
- package/dist/js/treeshaking/builder/share.js +40 -0
- package/dist/js/treeshaking/builder/webpackPlugins/htmlAsyncChunkPlugin.js +110 -0
- package/dist/js/treeshaking/builder/webpackPlugins/htmlBottomTemplate.js +72 -0
- package/dist/js/treeshaking/builder/webpackPlugins/routerPlugin.js +343 -0
- package/dist/js/treeshaking/commands/build.js +291 -0
- package/dist/js/treeshaking/commands/deploy.js +154 -0
- package/dist/js/treeshaking/commands/dev.js +301 -0
- package/dist/js/treeshaking/commands/index.js +3 -0
- package/dist/js/treeshaking/commands/inspect.js +149 -0
- package/dist/js/treeshaking/commands/serve.js +199 -0
- package/dist/js/treeshaking/config/default.js +210 -0
- package/dist/js/treeshaking/config/index.js +3 -0
- package/dist/js/treeshaking/config/initial/createHtmlConfig.js +19 -0
- package/dist/js/treeshaking/config/initial/createOutputConfig.js +41 -0
- package/dist/js/treeshaking/config/initial/createSourceConfig.js +42 -0
- package/dist/js/treeshaking/config/initial/createToolsConfig.js +23 -0
- package/dist/js/treeshaking/config/initial/index.js +12 -0
- package/dist/js/treeshaking/config/initial/inits.js +209 -0
- package/dist/js/treeshaking/config/initial/transformNormalizedConfig.js +35 -0
- package/dist/js/treeshaking/defineConfig.js +61 -0
- package/dist/js/treeshaking/exports/server.js +2 -0
- package/dist/js/treeshaking/hooks.js +29 -0
- package/dist/js/treeshaking/index.js +706 -0
- package/dist/js/treeshaking/initialize/index.js +276 -0
- package/dist/js/treeshaking/locale/en.js +38 -0
- package/dist/js/treeshaking/locale/index.js +9 -0
- package/dist/js/treeshaking/locale/zh.js +38 -0
- package/dist/js/treeshaking/schema/Schema.js +273 -0
- package/dist/js/treeshaking/schema/index.js +181 -0
- package/dist/js/treeshaking/schema/legacy.js +337 -0
- package/dist/js/treeshaking/types/config/deploy.js +1 -0
- package/dist/js/treeshaking/types/config/dev.js +1 -0
- package/dist/js/treeshaking/types/config/experiments.js +1 -0
- package/dist/js/treeshaking/types/config/html.js +1 -0
- package/dist/js/treeshaking/types/config/index.js +1 -0
- package/dist/js/treeshaking/types/config/output.js +1 -0
- package/dist/js/treeshaking/types/config/performance.js +1 -0
- package/dist/js/treeshaking/types/config/security.js +1 -0
- package/dist/js/treeshaking/types/config/source.js +1 -0
- package/dist/js/treeshaking/types/config/tools.js +1 -0
- package/dist/js/treeshaking/types/hooks.js +1 -0
- package/dist/js/treeshaking/types/index.js +3 -0
- package/dist/js/treeshaking/types/legacyConfig/deploy.js +1 -0
- package/dist/js/treeshaking/types/legacyConfig/dev.js +1 -0
- package/dist/js/treeshaking/types/legacyConfig/index.js +1 -0
- package/dist/js/treeshaking/types/legacyConfig/output.js +1 -0
- package/dist/js/treeshaking/types/legacyConfig/source.js +1 -0
- package/dist/js/treeshaking/types/legacyConfig/tools.js +1 -0
- package/dist/js/treeshaking/utils/config.js +302 -0
- package/dist/js/treeshaking/utils/createServer.js +258 -0
- package/dist/js/treeshaking/utils/env.js +13 -0
- package/dist/js/treeshaking/utils/generateWatchFiles.js +214 -0
- package/dist/js/treeshaking/utils/getSelectedEntries.js +186 -0
- package/dist/js/treeshaking/utils/getServerInternalPlugins.js +210 -0
- package/dist/js/treeshaking/utils/language.js +6 -0
- package/dist/js/treeshaking/utils/printInstructions.js +152 -0
- package/dist/js/treeshaking/utils/restart.js +187 -0
- package/dist/js/treeshaking/utils/routes.js +153 -0
- package/dist/js/treeshaking/utils/types.js +1 -0
- package/dist/types/analyze/constants.d.ts +1 -0
- package/dist/types/analyze/utils.d.ts +2 -1
- package/dist/types/types/config/index.d.ts +3 -2
- package/package.json +12 -12
@@ -1,82 +1,48 @@
|
|
1
1
|
"use strict";
|
2
|
-
Object.defineProperty
|
3
|
-
|
4
|
-
|
5
|
-
|
2
|
+
var __defProp = Object.defineProperty;
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
6
|
+
var __export = (target, all) => {
|
6
7
|
for (var name in all)
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
return JS_EXTENSIONS;
|
15
|
-
},
|
16
|
-
INDEX_FILE_NAME: function() {
|
17
|
-
return INDEX_FILE_NAME;
|
18
|
-
},
|
19
|
-
APP_FILE_NAME: function() {
|
20
|
-
return APP_FILE_NAME;
|
21
|
-
},
|
22
|
-
PAGES_DIR_NAME: function() {
|
23
|
-
return PAGES_DIR_NAME;
|
24
|
-
},
|
25
|
-
NESTED_ROUTES_DIR: function() {
|
26
|
-
return NESTED_ROUTES_DIR;
|
27
|
-
},
|
28
|
-
FILE_SYSTEM_ROUTES_FILE_NAME: function() {
|
29
|
-
return FILE_SYSTEM_ROUTES_FILE_NAME;
|
30
|
-
},
|
31
|
-
LOADER_EXPORT_NAME: function() {
|
32
|
-
return LOADER_EXPORT_NAME;
|
33
|
-
},
|
34
|
-
TEMP_LOADERS_DIR: function() {
|
35
|
-
return TEMP_LOADERS_DIR;
|
36
|
-
},
|
37
|
-
ENTRY_POINT_FILE_NAME: function() {
|
38
|
-
return ENTRY_POINT_FILE_NAME;
|
39
|
-
},
|
40
|
-
ENTRY_BOOTSTRAP_FILE_NAME: function() {
|
41
|
-
return ENTRY_BOOTSTRAP_FILE_NAME;
|
42
|
-
},
|
43
|
-
FILE_SYSTEM_ROUTES_DYNAMIC_REGEXP: function() {
|
44
|
-
return FILE_SYSTEM_ROUTES_DYNAMIC_REGEXP;
|
45
|
-
},
|
46
|
-
FILE_SYSTEM_ROUTES_LAYOUT: function() {
|
47
|
-
return FILE_SYSTEM_ROUTES_LAYOUT;
|
48
|
-
},
|
49
|
-
FILE_SYSTEM_ROUTES_GLOBAL_LAYOUT: function() {
|
50
|
-
return FILE_SYSTEM_ROUTES_GLOBAL_LAYOUT;
|
51
|
-
},
|
52
|
-
FILE_SYSTEM_ROUTES_INDEX: function() {
|
53
|
-
return FILE_SYSTEM_ROUTES_INDEX;
|
54
|
-
},
|
55
|
-
FILE_SYSTEM_ROUTES_IGNORED_REGEX: function() {
|
56
|
-
return FILE_SYSTEM_ROUTES_IGNORED_REGEX;
|
57
|
-
},
|
58
|
-
HTML_PARTIALS_FOLDER: function() {
|
59
|
-
return HTML_PARTIALS_FOLDER;
|
60
|
-
},
|
61
|
-
HTML_PARTIALS_EXTENSIONS: function() {
|
62
|
-
return HTML_PARTIALS_EXTENSIONS;
|
63
|
-
},
|
64
|
-
FILE_SYSTEM_ROUTES_COMPONENTS_DIR: function() {
|
65
|
-
return FILE_SYSTEM_ROUTES_COMPONENTS_DIR;
|
66
|
-
},
|
67
|
-
NESTED_ROUTE: function() {
|
68
|
-
return NESTED_ROUTE;
|
69
|
-
},
|
70
|
-
APP_CONFIG_NAME: function() {
|
71
|
-
return APP_CONFIG_NAME;
|
72
|
-
},
|
73
|
-
APP_INIT_EXPORTED: function() {
|
74
|
-
return APP_INIT_EXPORTED;
|
75
|
-
},
|
76
|
-
APP_INIT_IMPORTED: function() {
|
77
|
-
return APP_INIT_IMPORTED;
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
9
|
+
};
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
12
|
+
for (let key of __getOwnPropNames(from))
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
78
15
|
}
|
16
|
+
return to;
|
17
|
+
};
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
19
|
+
var constants_exports = {};
|
20
|
+
__export(constants_exports, {
|
21
|
+
ACTION_EXPORT_NAME: () => ACTION_EXPORT_NAME,
|
22
|
+
APP_CONFIG_NAME: () => APP_CONFIG_NAME,
|
23
|
+
APP_FILE_NAME: () => APP_FILE_NAME,
|
24
|
+
APP_INIT_EXPORTED: () => APP_INIT_EXPORTED,
|
25
|
+
APP_INIT_IMPORTED: () => APP_INIT_IMPORTED,
|
26
|
+
ENTRY_BOOTSTRAP_FILE_NAME: () => ENTRY_BOOTSTRAP_FILE_NAME,
|
27
|
+
ENTRY_POINT_FILE_NAME: () => ENTRY_POINT_FILE_NAME,
|
28
|
+
FILE_SYSTEM_ROUTES_COMPONENTS_DIR: () => FILE_SYSTEM_ROUTES_COMPONENTS_DIR,
|
29
|
+
FILE_SYSTEM_ROUTES_DYNAMIC_REGEXP: () => FILE_SYSTEM_ROUTES_DYNAMIC_REGEXP,
|
30
|
+
FILE_SYSTEM_ROUTES_FILE_NAME: () => FILE_SYSTEM_ROUTES_FILE_NAME,
|
31
|
+
FILE_SYSTEM_ROUTES_GLOBAL_LAYOUT: () => FILE_SYSTEM_ROUTES_GLOBAL_LAYOUT,
|
32
|
+
FILE_SYSTEM_ROUTES_IGNORED_REGEX: () => FILE_SYSTEM_ROUTES_IGNORED_REGEX,
|
33
|
+
FILE_SYSTEM_ROUTES_INDEX: () => FILE_SYSTEM_ROUTES_INDEX,
|
34
|
+
FILE_SYSTEM_ROUTES_LAYOUT: () => FILE_SYSTEM_ROUTES_LAYOUT,
|
35
|
+
HTML_PARTIALS_EXTENSIONS: () => HTML_PARTIALS_EXTENSIONS,
|
36
|
+
HTML_PARTIALS_FOLDER: () => HTML_PARTIALS_FOLDER,
|
37
|
+
INDEX_FILE_NAME: () => INDEX_FILE_NAME,
|
38
|
+
JS_EXTENSIONS: () => JS_EXTENSIONS,
|
39
|
+
LOADER_EXPORT_NAME: () => LOADER_EXPORT_NAME,
|
40
|
+
NESTED_ROUTE: () => NESTED_ROUTE,
|
41
|
+
NESTED_ROUTES_DIR: () => NESTED_ROUTES_DIR,
|
42
|
+
PAGES_DIR_NAME: () => PAGES_DIR_NAME,
|
43
|
+
TEMP_LOADERS_DIR: () => TEMP_LOADERS_DIR
|
79
44
|
});
|
45
|
+
module.exports = __toCommonJS(constants_exports);
|
80
46
|
const JS_EXTENSIONS = [
|
81
47
|
".js",
|
82
48
|
".ts",
|
@@ -89,6 +55,7 @@ const PAGES_DIR_NAME = "pages";
|
|
89
55
|
const NESTED_ROUTES_DIR = "routes";
|
90
56
|
const FILE_SYSTEM_ROUTES_FILE_NAME = "routes.js";
|
91
57
|
const LOADER_EXPORT_NAME = "loader";
|
58
|
+
const ACTION_EXPORT_NAME = "action";
|
92
59
|
const TEMP_LOADERS_DIR = "__loaders__";
|
93
60
|
const ENTRY_POINT_FILE_NAME = "index.jsx";
|
94
61
|
const ENTRY_BOOTSTRAP_FILE_NAME = "bootstrap.jsx";
|
@@ -127,3 +94,29 @@ const NESTED_ROUTE = {
|
|
127
94
|
const APP_CONFIG_NAME = "config";
|
128
95
|
const APP_INIT_EXPORTED = "init";
|
129
96
|
const APP_INIT_IMPORTED = "appInit";
|
97
|
+
// Annotate the CommonJS export names for ESM import in node:
|
98
|
+
0 && (module.exports = {
|
99
|
+
ACTION_EXPORT_NAME,
|
100
|
+
APP_CONFIG_NAME,
|
101
|
+
APP_FILE_NAME,
|
102
|
+
APP_INIT_EXPORTED,
|
103
|
+
APP_INIT_IMPORTED,
|
104
|
+
ENTRY_BOOTSTRAP_FILE_NAME,
|
105
|
+
ENTRY_POINT_FILE_NAME,
|
106
|
+
FILE_SYSTEM_ROUTES_COMPONENTS_DIR,
|
107
|
+
FILE_SYSTEM_ROUTES_DYNAMIC_REGEXP,
|
108
|
+
FILE_SYSTEM_ROUTES_FILE_NAME,
|
109
|
+
FILE_SYSTEM_ROUTES_GLOBAL_LAYOUT,
|
110
|
+
FILE_SYSTEM_ROUTES_IGNORED_REGEX,
|
111
|
+
FILE_SYSTEM_ROUTES_INDEX,
|
112
|
+
FILE_SYSTEM_ROUTES_LAYOUT,
|
113
|
+
HTML_PARTIALS_EXTENSIONS,
|
114
|
+
HTML_PARTIALS_FOLDER,
|
115
|
+
INDEX_FILE_NAME,
|
116
|
+
JS_EXTENSIONS,
|
117
|
+
LOADER_EXPORT_NAME,
|
118
|
+
NESTED_ROUTE,
|
119
|
+
NESTED_ROUTES_DIR,
|
120
|
+
PAGES_DIR_NAME,
|
121
|
+
TEMP_LOADERS_DIR
|
122
|
+
});
|
@@ -1,34 +1,45 @@
|
|
1
1
|
"use strict";
|
2
|
-
Object.
|
3
|
-
|
4
|
-
|
5
|
-
|
2
|
+
var __create = Object.create;
|
3
|
+
var __defProp = Object.defineProperty;
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
8
|
+
var __export = (target, all) => {
|
6
9
|
for (var name in all)
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
return createImportStatements;
|
15
|
-
},
|
16
|
-
generateCode: function() {
|
17
|
-
return generateCode;
|
18
|
-
},
|
19
|
-
generateIndexCode: function() {
|
20
|
-
return generateIndexCode;
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
11
|
+
};
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
14
|
+
for (let key of __getOwnPropNames(from))
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
21
17
|
}
|
18
|
+
return to;
|
19
|
+
};
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
26
|
+
mod
|
27
|
+
));
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
29
|
+
var generateCode_exports = {};
|
30
|
+
__export(generateCode_exports, {
|
31
|
+
createImportStatements: () => createImportStatements,
|
32
|
+
generateCode: () => generateCode,
|
33
|
+
generateIndexCode: () => generateIndexCode
|
22
34
|
});
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
const _nestedRoutes = require("./nestedRoutes");
|
35
|
+
module.exports = __toCommonJS(generateCode_exports);
|
36
|
+
var import_path = __toESM(require("path"));
|
37
|
+
var import_utils = require("@modern-js/utils");
|
38
|
+
var templates = __toESM(require("./templates"));
|
39
|
+
var import_getClientRoutes = require("./getClientRoutes");
|
40
|
+
var import_constants = require("./constants");
|
41
|
+
var import_utils2 = require("./utils");
|
42
|
+
var import_nestedRoutes = require("./nestedRoutes");
|
32
43
|
const createImportSpecifier = (specifiers) => {
|
33
44
|
let defaults = "";
|
34
45
|
const named = [];
|
@@ -76,8 +87,8 @@ ${initialize || ""}`).join("\n");
|
|
76
87
|
const generateCode = async (appContext, config, entrypoints, api) => {
|
77
88
|
const { internalDirectory, srcDirectory, internalDirAlias, internalSrcAlias, packageName } = appContext;
|
78
89
|
const hookRunners = api.useHookRunners();
|
79
|
-
const isV5 = (0,
|
80
|
-
const getRoutes = isV5 ?
|
90
|
+
const isV5 = (0, import_utils.isRouterV5)(config);
|
91
|
+
const getRoutes = isV5 ? import_getClientRoutes.getClientRoutesLegacy : import_getClientRoutes.getClientRoutes;
|
81
92
|
const importsStatemets = /* @__PURE__ */ new Map();
|
82
93
|
const oldVersion = typeof (config === null || config === void 0 ? void 0 : config.runtime.router) === "object" ? Boolean((config === null || config === void 0 ? void 0 : config.runtime.router).oldVersion) : false;
|
83
94
|
await Promise.all(entrypoints.map(generateEntryCode));
|
@@ -101,7 +112,7 @@ const generateCode = async (appContext, config, entrypoints, api) => {
|
|
101
112
|
});
|
102
113
|
}
|
103
114
|
if (!isV5 && entrypoint.nestedRoutesEntry) {
|
104
|
-
nestedRoutes = await (0,
|
115
|
+
nestedRoutes = await (0, import_nestedRoutes.walk)(entrypoint.nestedRoutesEntry, entrypoint.nestedRoutesEntry, {
|
105
116
|
name: internalSrcAlias,
|
106
117
|
basename: srcDirectory
|
107
118
|
}, entrypoint.entryName, entrypoint.isMainEntry, oldVersion);
|
@@ -121,8 +132,8 @@ const generateCode = async (appContext, config, entrypoints, api) => {
|
|
121
132
|
routes: initialRoutes
|
122
133
|
});
|
123
134
|
const config2 = api.useResolvedConfigContext();
|
124
|
-
const ssr = (0,
|
125
|
-
const useSSG = (0,
|
135
|
+
const ssr = (0, import_utils.getEntryOptions)(entryName, isMainEntry, config2.server.ssr, config2.server.ssrByEntries, packageName);
|
136
|
+
const useSSG = (0, import_utils.isSSGEntry)(config2, entryName, entrypoints);
|
126
137
|
let mode;
|
127
138
|
if (ssr) {
|
128
139
|
mode = typeof ssr === "object" ? ssr.mode || "string" : "string";
|
@@ -130,13 +141,13 @@ const generateCode = async (appContext, config, entrypoints, api) => {
|
|
130
141
|
if (mode === "stream") {
|
131
142
|
const hasPageRoute = routes.some((route) => "type" in route && route.type === "page");
|
132
143
|
if (hasPageRoute) {
|
133
|
-
|
144
|
+
import_utils.logger.error("Streaming ssr is not supported when pages dir exists");
|
134
145
|
process.exit(1);
|
135
146
|
}
|
136
147
|
}
|
137
148
|
const { code } = await hookRunners.beforeGenerateRoutes({
|
138
149
|
entrypoint,
|
139
|
-
code: await
|
150
|
+
code: await templates.fileSystemRoutes({
|
140
151
|
routes,
|
141
152
|
ssrMode: useSSG ? "string" : mode,
|
142
153
|
nestedRoutesEntry: entrypoint.nestedRoutesEntry,
|
@@ -145,24 +156,24 @@ const generateCode = async (appContext, config, entrypoints, api) => {
|
|
145
156
|
splitRouteChunks: config2 === null || config2 === void 0 ? void 0 : (_config_output = config2.output) === null || _config_output === void 0 ? void 0 : _config_output.splitRouteChunks
|
146
157
|
})
|
147
158
|
});
|
148
|
-
if (entrypoint.nestedRoutesEntry && (0,
|
149
|
-
const routesServerFile = (0,
|
150
|
-
const code2 =
|
159
|
+
if (entrypoint.nestedRoutesEntry && (0, import_utils.isUseSSRBundle)(config2)) {
|
160
|
+
const routesServerFile = (0, import_utils2.getServerLoadersFile)(internalDirectory, entryName);
|
161
|
+
const code2 = templates.routesForServer({
|
151
162
|
routes
|
152
163
|
});
|
153
|
-
await
|
154
|
-
await
|
164
|
+
await import_utils.fs.ensureFile(routesServerFile);
|
165
|
+
await import_utils.fs.writeFile(routesServerFile, code2);
|
155
166
|
}
|
156
|
-
const serverLoaderCombined =
|
167
|
+
const serverLoaderCombined = templates.ssrLoaderCombinedModule(entrypoints, entrypoint, config2, appContext);
|
157
168
|
if (serverLoaderCombined) {
|
158
|
-
const serverLoaderFile = (0,
|
159
|
-
await
|
169
|
+
const serverLoaderFile = (0, import_utils2.getServerCombinedModueFile)(internalDirectory, entryName);
|
170
|
+
await import_utils.fs.outputFile(serverLoaderFile, serverLoaderCombined);
|
160
171
|
}
|
161
|
-
|
172
|
+
import_utils.fs.outputFileSync(import_path.default.resolve(internalDirectory, `./${entryName}/${import_constants.FILE_SYSTEM_ROUTES_FILE_NAME}`), code, "utf8");
|
162
173
|
}
|
163
174
|
const { imports } = await hookRunners.modifyEntryImports({
|
164
175
|
entrypoint,
|
165
|
-
imports: (0,
|
176
|
+
imports: (0, import_utils2.getDefaultImports)({
|
166
177
|
entrypoint,
|
167
178
|
srcDirectory,
|
168
179
|
internalSrcAlias,
|
@@ -171,7 +182,7 @@ const generateCode = async (appContext, config, entrypoints, api) => {
|
|
171
182
|
})
|
172
183
|
});
|
173
184
|
importsStatemets.set(entryName, imports);
|
174
|
-
const entryFile =
|
185
|
+
const entryFile = import_path.default.resolve(internalDirectory, `./${entryName}/${import_constants.ENTRY_POINT_FILE_NAME}`);
|
175
186
|
entrypoint.internalEntry = entryFile;
|
176
187
|
}
|
177
188
|
}
|
@@ -190,7 +201,7 @@ const generateIndexCode = async ({ appContext, api, entrypoints, config, imports
|
|
190
201
|
});
|
191
202
|
const { code: renderFunction } = await hookRunners.modifyEntryRenderFunction({
|
192
203
|
entrypoint,
|
193
|
-
code:
|
204
|
+
code: templates.renderFunction({
|
194
205
|
plugins,
|
195
206
|
customBootstrap,
|
196
207
|
fileSystemRoutes
|
@@ -201,25 +212,25 @@ const generateIndexCode = async ({ appContext, api, entrypoints, config, imports
|
|
201
212
|
exportStatement: "export default AppWrapper;"
|
202
213
|
});
|
203
214
|
const imports = importsStatemets.get(entryName);
|
204
|
-
const code =
|
215
|
+
const code = templates.index({
|
205
216
|
mountId,
|
206
217
|
imports: createImportStatements(imports),
|
207
218
|
renderFunction,
|
208
219
|
exportStatement
|
209
220
|
});
|
210
|
-
const entryFile =
|
221
|
+
const entryFile = import_path.default.resolve(internalDirectory, `./${entryName}/${import_constants.ENTRY_POINT_FILE_NAME}`);
|
211
222
|
if (config.source.enableAsyncEntry) {
|
212
|
-
let rawAsyncEntryCode = `import('./${
|
213
|
-
const ssr = (0,
|
223
|
+
let rawAsyncEntryCode = `import('./${import_constants.ENTRY_BOOTSTRAP_FILE_NAME}');`;
|
224
|
+
const ssr = (0, import_utils.getEntryOptions)(entryName, isMainEntry, config.server.ssr, config.server.ssrByEntries, packageName);
|
214
225
|
if (ssr) {
|
215
226
|
rawAsyncEntryCode = `
|
216
|
-
export const ${
|
227
|
+
export const ${import_utils.SERVER_RENDER_FUNCTION_NAME} = async (...args) => {
|
217
228
|
let entry = await ${rawAsyncEntryCode};
|
218
229
|
if (entry.default instanceof Promise){
|
219
230
|
entry = await entry.default;
|
220
|
-
return entry.default.${
|
231
|
+
return entry.default.${import_utils.SERVER_RENDER_FUNCTION_NAME}.apply(null, args);
|
221
232
|
}
|
222
|
-
return entry.${
|
233
|
+
return entry.${import_utils.SERVER_RENDER_FUNCTION_NAME}.apply(null, args);
|
223
234
|
};
|
224
235
|
if(typeof window!=='undefined'){
|
225
236
|
${rawAsyncEntryCode}
|
@@ -230,12 +241,18 @@ const generateIndexCode = async ({ appContext, api, entrypoints, config, imports
|
|
230
241
|
entrypoint,
|
231
242
|
code: rawAsyncEntryCode
|
232
243
|
});
|
233
|
-
|
234
|
-
const bootstrapFile =
|
235
|
-
|
244
|
+
import_utils.fs.outputFileSync(entryFile, asyncEntryCode, "utf8");
|
245
|
+
const bootstrapFile = import_path.default.resolve(internalDirectory, `./${entryName}/${import_constants.ENTRY_BOOTSTRAP_FILE_NAME}`);
|
246
|
+
import_utils.fs.outputFileSync(bootstrapFile, code, "utf8");
|
236
247
|
} else {
|
237
|
-
|
248
|
+
import_utils.fs.outputFileSync(entryFile, code, "utf8");
|
238
249
|
}
|
239
250
|
}
|
240
251
|
}));
|
241
252
|
};
|
253
|
+
// Annotate the CommonJS export names for ESM import in node:
|
254
|
+
0 && (module.exports = {
|
255
|
+
createImportStatements,
|
256
|
+
generateCode,
|
257
|
+
generateIndexCode
|
258
|
+
});
|
@@ -1,25 +1,47 @@
|
|
1
1
|
"use strict";
|
2
|
-
Object.
|
3
|
-
|
4
|
-
|
5
|
-
Object.
|
6
|
-
|
7
|
-
|
8
|
-
|
2
|
+
var __create = Object.create;
|
3
|
+
var __defProp = Object.defineProperty;
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
8
|
+
var __export = (target, all) => {
|
9
|
+
for (var name in all)
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
11
|
+
};
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
14
|
+
for (let key of __getOwnPropNames(from))
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
9
17
|
}
|
18
|
+
return to;
|
19
|
+
};
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
26
|
+
mod
|
27
|
+
));
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
29
|
+
var getBundleEntry_exports = {};
|
30
|
+
__export(getBundleEntry_exports, {
|
31
|
+
getBundleEntry: () => getBundleEntry
|
10
32
|
});
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
33
|
+
module.exports = __toCommonJS(getBundleEntry_exports);
|
34
|
+
var import_path = __toESM(require("path"));
|
35
|
+
var import_utils = require("@modern-js/utils");
|
36
|
+
var import_getFileSystemEntry = require("./getFileSystemEntry");
|
37
|
+
var import_constants = require("./constants");
|
16
38
|
const ensureExtensions = (file) => {
|
17
|
-
if (!
|
18
|
-
return (0,
|
39
|
+
if (!import_path.default.extname(file)) {
|
40
|
+
return (0, import_utils.findExists)(import_constants.JS_EXTENSIONS.map((ext) => `${file}${ext}`)) || file;
|
19
41
|
}
|
20
42
|
return file;
|
21
43
|
};
|
22
|
-
const isDirectory = (file) => !
|
44
|
+
const isDirectory = (file) => !import_path.default.extname(file);
|
23
45
|
const ifAlreadyExists = (entrypoints, checked) => entrypoints.some((entrypoint) => {
|
24
46
|
if (ensureExtensions(entrypoint.entry) === ensureExtensions(checked.entry)) {
|
25
47
|
checked.entryName = entrypoint.entryName;
|
@@ -36,27 +58,27 @@ const ifAlreadyExists = (entrypoints, checked) => entrypoints.some((entrypoint)
|
|
36
58
|
const getBundleEntry = (appContext, config) => {
|
37
59
|
const { appDirectory, packageName } = appContext;
|
38
60
|
const { disableDefaultEntries, entries, entriesDir, mainEntryName } = config.source;
|
39
|
-
const defaults = disableDefaultEntries ? [] : (0,
|
61
|
+
const defaults = disableDefaultEntries ? [] : (0, import_getFileSystemEntry.getFileSystemEntry)(appContext, config);
|
40
62
|
if (entries) {
|
41
63
|
Object.keys(entries).forEach((name) => {
|
42
64
|
const value = entries[name];
|
43
65
|
const entrypoint = typeof value === "string" ? {
|
44
66
|
entryName: name,
|
45
67
|
isMainEntry: false,
|
46
|
-
entry: (0,
|
47
|
-
absoluteEntryDir: isDirectory((0,
|
68
|
+
entry: (0, import_utils.ensureAbsolutePath)(appDirectory, value),
|
69
|
+
absoluteEntryDir: isDirectory((0, import_utils.ensureAbsolutePath)(appDirectory, value)) ? (0, import_utils.ensureAbsolutePath)(appDirectory, value) : import_path.default.dirname((0, import_utils.ensureAbsolutePath)(appDirectory, value)),
|
48
70
|
isAutoMount: true,
|
49
|
-
fileSystemRoutes:
|
71
|
+
fileSystemRoutes: import_utils.fs.statSync((0, import_utils.ensureAbsolutePath)(appDirectory, value)).isDirectory() ? {} : void 0
|
50
72
|
} : {
|
51
73
|
entryName: name,
|
52
74
|
isMainEntry: false,
|
53
|
-
entry: (0,
|
54
|
-
absoluteEntryDir: isDirectory((0,
|
75
|
+
entry: (0, import_utils.ensureAbsolutePath)(appDirectory, value.entry),
|
76
|
+
absoluteEntryDir: isDirectory((0, import_utils.ensureAbsolutePath)(appDirectory, value.entry)) ? (0, import_utils.ensureAbsolutePath)(appDirectory, value.entry) : import_path.default.dirname((0, import_utils.ensureAbsolutePath)(appDirectory, value.entry)),
|
55
77
|
isAutoMount: !value.disableMount,
|
56
|
-
customBootstrap: value.customBootstrap && (0,
|
57
|
-
fileSystemRoutes:
|
78
|
+
customBootstrap: value.customBootstrap && (0, import_utils.ensureAbsolutePath)(appDirectory, value.customBootstrap),
|
79
|
+
fileSystemRoutes: import_utils.fs.statSync((0, import_utils.ensureAbsolutePath)(appDirectory, value.entry)).isDirectory() ? {} : void 0
|
58
80
|
};
|
59
|
-
if (entrypoint.fileSystemRoutes && !(0,
|
81
|
+
if (entrypoint.fileSystemRoutes && !(0, import_utils.isRouterV5)(config)) {
|
60
82
|
entrypoint.nestedRoutesEntry = entrypoint.entry;
|
61
83
|
}
|
62
84
|
if (!ifAlreadyExists(defaults, entrypoint)) {
|
@@ -65,12 +87,16 @@ const getBundleEntry = (appContext, config) => {
|
|
65
87
|
});
|
66
88
|
}
|
67
89
|
if (!disableDefaultEntries) {
|
68
|
-
const entriesDirAbs = (0,
|
69
|
-
const found = defaults.find(({ entryName, entry, nestedRoutesEntry = "" }) => entryName === packageName ||
|
90
|
+
const entriesDirAbs = (0, import_utils.ensureAbsolutePath)(appDirectory, entriesDir || "");
|
91
|
+
const found = defaults.find(({ entryName, entry, nestedRoutesEntry = "" }) => entryName === packageName || import_path.default.dirname(entry) === entriesDirAbs || import_path.default.dirname(nestedRoutesEntry) === entriesDirAbs);
|
70
92
|
if (found) {
|
71
|
-
found.entryName = mainEntryName ||
|
93
|
+
found.entryName = mainEntryName || import_utils.MAIN_ENTRY_NAME;
|
72
94
|
found.isMainEntry = true;
|
73
95
|
}
|
74
96
|
}
|
75
97
|
return defaults;
|
76
98
|
};
|
99
|
+
// Annotate the CommonJS export names for ESM import in node:
|
100
|
+
0 && (module.exports = {
|
101
|
+
getBundleEntry
|
102
|
+
});
|