@modern-js/app-tools 2.35.0 → 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 +69 -75
- package/dist/cjs/analyze/generateCode.js +77 -61
- 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 -33
- package/dist/cjs/analyze/getHtmlTemplate.js +45 -20
- package/dist/cjs/analyze/getServerRoutes.js +59 -34
- 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 +117 -65
- package/dist/cjs/analyze/templates.js +139 -57
- 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 +27 -11
- 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 +39 -38
- package/dist/cjs/builder/shared/builderPlugins/adapterSSR.js +58 -34
- 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 +43 -26
- 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 +34 -18
- 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 -10
- package/dist/cjs/commands/serve.js +49 -23
- 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 +196 -184
- 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 +49 -22
- package/dist/esm/analyze/generateCode.js +42 -37
- 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 +11 -9
- package/dist/esm/analyze/getHtmlTemplate.js +7 -4
- package/dist/esm/analyze/getServerRoutes.js +12 -10
- 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 +99 -30
- package/dist/esm/analyze/templates.js +125 -34
- 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 +5 -3
- package/dist/esm/builder/generator/getBuilderTargets.js +4 -1
- package/dist/esm/builder/generator/index.js +5 -2
- package/dist/esm/builder/index.js +5 -2
- package/dist/esm/builder/shared/builderPlugins/adapterBasic.js +4 -1
- package/dist/esm/builder/shared/builderPlugins/adapterHtml.js +23 -51
- package/dist/esm/builder/shared/builderPlugins/adapterSSR.js +22 -21
- 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 +9 -6
- 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 +9 -6
- package/dist/esm/commands/deploy.js +4 -1
- package/dist/esm/commands/dev.js +12 -9
- package/dist/esm/commands/inspect.js +6 -3
- package/dist/esm/commands/serve.js +11 -8
- 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 +21 -14
- 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 +14 -8
- 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 +5 -2
- 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 +49 -22
- package/dist/esm-node/analyze/generateCode.js +11 -7
- 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 +5 -3
- package/dist/esm-node/analyze/getHtmlTemplate.js +4 -1
- package/dist/esm-node/analyze/getServerRoutes.js +8 -6
- 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 +49 -10
- package/dist/esm-node/analyze/templates.js +97 -22
- 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 +5 -3
- 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 +5 -2
- package/dist/esm-node/builder/shared/builderPlugins/adapterBasic.js +4 -1
- package/dist/esm-node/builder/shared/builderPlugins/adapterHtml.js +8 -20
- package/dist/esm-node/builder/shared/builderPlugins/adapterSSR.js +16 -15
- 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 +6 -3
- 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 +6 -4
- 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 +5 -3
- package/dist/esm-node/commands/serve.js +8 -5
- 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 +140 -135
- 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 +12 -6
- 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 +5 -2
- 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 +2 -0
- package/dist/types/analyze/utils.d.ts +2 -1
- package/dist/types/builder/shared/bundlerPlugins/RouterPlugin.d.ts +1 -0
- package/dist/types/types/config/index.d.ts +3 -2
- package/package.json +24 -25
@@ -1,19 +1,31 @@
|
|
1
1
|
"use strict";
|
2
|
-
Object.defineProperty
|
3
|
-
|
4
|
-
|
5
|
-
Object.
|
6
|
-
|
7
|
-
|
8
|
-
|
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) => {
|
7
|
+
for (var name in all)
|
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 });
|
9
15
|
}
|
16
|
+
return to;
|
17
|
+
};
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
19
|
+
var createBuilderProviderConfig_exports = {};
|
20
|
+
__export(createBuilderProviderConfig_exports, {
|
21
|
+
createBuilderProviderConfig: () => createBuilderProviderConfig
|
10
22
|
});
|
11
|
-
|
23
|
+
module.exports = __toCommonJS(createBuilderProviderConfig_exports);
|
24
|
+
var import_createCopyPattern = require("../builder-webpack/createCopyPattern");
|
12
25
|
function modifyOutputConfig(config, appContext) {
|
13
|
-
|
14
|
-
const defaultCopyPattern = (0, _createCopyPattern.createUploadPattern)(appContext, config);
|
26
|
+
const defaultCopyPattern = (0, import_createCopyPattern.createUploadPattern)(appContext, config);
|
15
27
|
const { copy } = config.output;
|
16
|
-
const copyOptions = Array.isArray(copy) ? copy :
|
28
|
+
const copyOptions = Array.isArray(copy) ? copy : copy === null || copy === void 0 ? void 0 : copy.patterns;
|
17
29
|
const builderCopy = [
|
18
30
|
...copyOptions || [],
|
19
31
|
defaultCopyPattern
|
@@ -49,3 +61,7 @@ function createBuilderProviderConfig(resolveConfig, appContext) {
|
|
49
61
|
modifyOutputConfig(config, appContext);
|
50
62
|
return config;
|
51
63
|
}
|
64
|
+
// Annotate the CommonJS export names for ESM import in node:
|
65
|
+
0 && (module.exports = {
|
66
|
+
createBuilderProviderConfig
|
67
|
+
});
|
@@ -1,25 +1,42 @@
|
|
1
1
|
"use strict";
|
2
|
-
Object.defineProperty
|
3
|
-
|
4
|
-
|
5
|
-
Object.
|
6
|
-
|
7
|
-
|
8
|
-
|
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) => {
|
7
|
+
for (var name in all)
|
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 });
|
9
15
|
}
|
16
|
+
return to;
|
17
|
+
};
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
19
|
+
var getBuilderTargets_exports = {};
|
20
|
+
__export(getBuilderTargets_exports, {
|
21
|
+
getBuilderTargets: () => getBuilderTargets
|
10
22
|
});
|
11
|
-
|
23
|
+
module.exports = __toCommonJS(getBuilderTargets_exports);
|
24
|
+
var import_utils = require("@modern-js/utils");
|
12
25
|
function getBuilderTargets(normalizedConfig) {
|
13
26
|
const targets = [
|
14
27
|
"web"
|
15
28
|
];
|
16
|
-
const useNodeTarget = (0,
|
29
|
+
const useNodeTarget = (0, import_utils.isProd)() ? (0, import_utils.isUseSSRBundle)(normalizedConfig) : (0, import_utils.isSSR)(normalizedConfig);
|
17
30
|
if (useNodeTarget) {
|
18
31
|
targets.push("node");
|
19
32
|
}
|
20
|
-
const useWorkerTarget = (0,
|
33
|
+
const useWorkerTarget = (0, import_utils.isServiceWorker)(normalizedConfig);
|
21
34
|
if (useWorkerTarget) {
|
22
35
|
targets.push("service-worker");
|
23
36
|
}
|
24
37
|
return targets;
|
25
38
|
}
|
39
|
+
// Annotate the CommonJS export names for ESM import in node:
|
40
|
+
0 && (module.exports = {
|
41
|
+
getBuilderTargets
|
42
|
+
});
|
@@ -1,32 +1,54 @@
|
|
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 generator_exports = {};
|
30
|
+
__export(generator_exports, {
|
31
|
+
generateBuilder: () => generateBuilder
|
10
32
|
});
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
33
|
+
module.exports = __toCommonJS(generator_exports);
|
34
|
+
var import_builder = require("@modern-js/builder");
|
35
|
+
var import_createBuilderProviderConfig = require("./createBuilderProviderConfig");
|
36
|
+
var import_getBuilderTargets = require("./getBuilderTargets");
|
37
|
+
var import_createBuilderOptions = require("./createBuilderOptions");
|
16
38
|
async function generateBuilder(options, generateProvider) {
|
17
39
|
const { normalizedConfig, appContext } = options;
|
18
|
-
const builderConfig = (0,
|
40
|
+
const builderConfig = (0, import_createBuilderProviderConfig.createBuilderProviderConfig)(normalizedConfig, appContext);
|
19
41
|
const provider = generateProvider({
|
20
42
|
builderConfig
|
21
43
|
});
|
22
|
-
const target = (0,
|
23
|
-
const builderOptions = (0,
|
24
|
-
const builder = await (0,
|
44
|
+
const target = (0, import_getBuilderTargets.getBuilderTargets)(normalizedConfig);
|
45
|
+
const builderOptions = (0, import_createBuilderOptions.createBuilderOptions)(target, appContext);
|
46
|
+
const builder = await (0, import_builder.createBuilder)(provider, builderOptions);
|
25
47
|
await applyBuilderPlugins(builder, options);
|
26
48
|
return builder;
|
27
49
|
}
|
28
50
|
async function applyBuilderPlugins(builder, options) {
|
29
|
-
const { builderPluginAdapterBasic, builderPluginAdapterHtml, builderPluginAdapterSSR } = await Promise.resolve().then(() =>
|
51
|
+
const { builderPluginAdapterBasic, builderPluginAdapterHtml, builderPluginAdapterSSR } = await Promise.resolve().then(() => __toESM(require("../shared/builderPlugins")));
|
30
52
|
builder.addPlugins([
|
31
53
|
builderPluginAdapterBasic(),
|
32
54
|
builderPluginAdapterSSR(options),
|
@@ -34,9 +56,13 @@ async function applyBuilderPlugins(builder, options) {
|
|
34
56
|
]);
|
35
57
|
const { normalizedConfig } = options;
|
36
58
|
if (!normalizedConfig.output.disableNodePolyfill) {
|
37
|
-
const { builderPluginNodePolyfill } = await Promise.resolve().then(() =>
|
59
|
+
const { builderPluginNodePolyfill } = await Promise.resolve().then(() => __toESM(require("@modern-js/builder-plugin-node-polyfill")));
|
38
60
|
builder.addPlugins([
|
39
61
|
builderPluginNodePolyfill()
|
40
62
|
]);
|
41
63
|
}
|
42
64
|
}
|
65
|
+
// Annotate the CommonJS export names for ESM import in node:
|
66
|
+
0 && (module.exports = {
|
67
|
+
generateBuilder
|
68
|
+
});
|
@@ -1,27 +1,53 @@
|
|
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 builder_exports = {};
|
30
|
+
__export(builder_exports, {
|
31
|
+
createBuilderGenerator: () => createBuilderGenerator
|
10
32
|
});
|
11
|
-
|
12
|
-
|
33
|
+
module.exports = __toCommonJS(builder_exports);
|
34
|
+
var import_utils = require("@modern-js/utils");
|
13
35
|
async function createBuilderGenerator(bundler) {
|
14
36
|
if (bundler === "rspack") {
|
15
37
|
try {
|
16
|
-
const { createRspackBuilderForModern } = await Promise.resolve().then(() =>
|
17
|
-
const { getRspackVersion } = await Promise.resolve().then(() =>
|
38
|
+
const { createRspackBuilderForModern } = await Promise.resolve().then(() => __toESM(require("./builder-rspack")));
|
39
|
+
const { getRspackVersion } = await Promise.resolve().then(() => __toESM(require("@modern-js/builder-rspack-provider")));
|
18
40
|
const version = await getRspackVersion();
|
19
|
-
|
41
|
+
import_utils.logger.info(`Using Rspack v${version}`);
|
20
42
|
return createRspackBuilderForModern;
|
21
43
|
} catch (_) {
|
22
44
|
throw new Error("Failed to use Rspack, please check if you have `@modern-js/builder-rspack-provider` installed");
|
23
45
|
}
|
24
46
|
}
|
25
|
-
const { createWebpackBuilderForModern } = await Promise.resolve().then(() =>
|
47
|
+
const { createWebpackBuilderForModern } = await Promise.resolve().then(() => __toESM(require("./builder-webpack")));
|
26
48
|
return createWebpackBuilderForModern;
|
27
49
|
}
|
50
|
+
// Annotate the CommonJS export names for ESM import in node:
|
51
|
+
0 && (module.exports = {
|
52
|
+
createBuilderGenerator
|
53
|
+
});
|
@@ -1,13 +1,36 @@
|
|
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 adapterBasic_exports = {};
|
30
|
+
__export(adapterBasic_exports, {
|
31
|
+
builderPluginAdapterBasic: () => builderPluginAdapterBasic
|
10
32
|
});
|
33
|
+
module.exports = __toCommonJS(adapterBasic_exports);
|
11
34
|
const builderPluginAdapterBasic = () => ({
|
12
35
|
name: "builder-plugin-adapter-modern-basic",
|
13
36
|
setup(api) {
|
@@ -60,3 +83,7 @@ function applyNodeCompat(target, chain) {
|
|
60
83
|
}
|
61
84
|
}
|
62
85
|
}
|
86
|
+
// Annotate the CommonJS export names for ESM import in node:
|
87
|
+
0 && (module.exports = {
|
88
|
+
builderPluginAdapterBasic
|
89
|
+
});
|
@@ -1,24 +1,36 @@
|
|
1
1
|
"use strict";
|
2
|
-
Object.defineProperty
|
3
|
-
|
4
|
-
|
5
|
-
Object.
|
6
|
-
|
7
|
-
|
8
|
-
|
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) => {
|
7
|
+
for (var name in all)
|
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 });
|
9
15
|
}
|
16
|
+
return to;
|
17
|
+
};
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
19
|
+
var adapterHtml_exports = {};
|
20
|
+
__export(adapterHtml_exports, {
|
21
|
+
builderPluginAdapterHtml: () => builderPluginAdapterHtml
|
10
22
|
});
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
23
|
+
module.exports = __toCommonJS(adapterHtml_exports);
|
24
|
+
var import_builder_shared = require("@modern-js/builder-shared");
|
25
|
+
var import_utils = require("@modern-js/utils");
|
26
|
+
var import_lodash = require("@modern-js/utils/lodash");
|
27
|
+
var import_bundlerPlugins = require("../bundlerPlugins");
|
16
28
|
const builderPluginAdapterHtml = (options) => ({
|
17
29
|
name: "builder-plugin-adapter-modern-html",
|
18
30
|
setup(api) {
|
19
31
|
api.modifyBundlerChain(async (chain, { CHAIN_ID, target, HtmlPlugin: HtmlBundlerPlugin }) => {
|
20
32
|
const builderConfig = api.getNormalizedConfig();
|
21
|
-
if (!(0,
|
33
|
+
if (!(0, import_builder_shared.isHtmlDisabled)(builderConfig, target)) {
|
22
34
|
applyBottomHtmlPlugin({
|
23
35
|
api,
|
24
36
|
options,
|
@@ -27,56 +39,45 @@ const builderPluginAdapterHtml = (options) => ({
|
|
27
39
|
HtmlBundlerPlugin
|
28
40
|
});
|
29
41
|
await injectAssetPrefix({
|
30
|
-
api,
|
31
42
|
chain
|
32
43
|
});
|
33
44
|
}
|
34
45
|
});
|
35
46
|
}
|
36
47
|
});
|
37
|
-
async function injectAssetPrefix({
|
48
|
+
async function injectAssetPrefix({ chain }) {
|
38
49
|
const entries = chain.entryPoints.entries() || {};
|
39
50
|
const entryNames = Object.keys(entries);
|
40
|
-
const assetPrefix = (0,
|
51
|
+
const assetPrefix = (0, import_utils.removeTailSlash)(chain.output.get("publicPath") || "");
|
41
52
|
const code = `window.__assetPrefix__ = '${assetPrefix}';`;
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
const { default: RspackVirtualModulePlugin } = await Promise.resolve().then(() => /* @__PURE__ */ _interop_require_wildcard._(require("rspack-plugin-virtual-module")));
|
46
|
-
entryNames.forEach((entryName) => {
|
47
|
-
entries[entryName].prepend(fileName);
|
48
|
-
chain.plugin("rspack-asset-prefix").use(RspackVirtualModulePlugin, [
|
49
|
-
{
|
50
|
-
[fileName]: code
|
51
|
-
}
|
52
|
-
]);
|
53
|
-
});
|
54
|
-
} else {
|
55
|
-
entryNames.forEach((entryName) => {
|
56
|
-
entries[entryName].prepend((0, _buildershared.createVirtualModule)(code));
|
57
|
-
});
|
58
|
-
}
|
53
|
+
entryNames.forEach((entryName) => {
|
54
|
+
entries[entryName].prepend((0, import_builder_shared.createVirtualModule)(code));
|
55
|
+
});
|
59
56
|
}
|
60
57
|
function applyBottomHtmlPlugin({ api, chain, options, CHAIN_ID, HtmlBundlerPlugin }) {
|
61
58
|
const { normalizedConfig: modernConfig, appContext } = options;
|
62
59
|
for (const entryName of Object.keys(api.context.entry)) {
|
63
60
|
const { source: { mainEntryName } } = modernConfig;
|
64
|
-
const isMainEntry = entryName === (mainEntryName ||
|
61
|
+
const isMainEntry = entryName === (mainEntryName || import_utils.MAIN_ENTRY_NAME);
|
65
62
|
const baseTemplateParams = {
|
66
63
|
entryName,
|
67
|
-
title: (0,
|
64
|
+
title: (0, import_utils.getEntryOptions)(entryName, isMainEntry, modernConfig.html.title, modernConfig.html.titleByEntries, appContext.packageName),
|
68
65
|
mountId: modernConfig.html.mountId,
|
69
|
-
...(0,
|
66
|
+
...(0, import_utils.getEntryOptions)(entryName, isMainEntry, modernConfig.html.templateParameters, modernConfig.html.templateParametersByEntries, appContext.packageName)
|
70
67
|
};
|
71
68
|
chain.plugin(`${CHAIN_ID.PLUGIN.HTML}-${entryName}`).tap((args) => [
|
72
69
|
{
|
73
70
|
...args[0] || {},
|
74
71
|
__internal__: true,
|
75
|
-
bottomTemplate: appContext.htmlTemplates[`__${entryName}-bottom__`] && (0,
|
72
|
+
bottomTemplate: appContext.htmlTemplates[`__${entryName}-bottom__`] && (0, import_lodash.template)(appContext.htmlTemplates[`__${entryName}-bottom__`])(baseTemplateParams)
|
76
73
|
}
|
77
74
|
]);
|
78
75
|
}
|
79
|
-
chain.plugin(CHAIN_ID.PLUGIN.BOTTOM_TEMPLATE).use(
|
76
|
+
chain.plugin(CHAIN_ID.PLUGIN.BOTTOM_TEMPLATE).use(import_bundlerPlugins.BottomTemplatePlugin, [
|
80
77
|
HtmlBundlerPlugin
|
81
78
|
]);
|
82
79
|
}
|
80
|
+
// Annotate the CommonJS export names for ESM import in node:
|
81
|
+
0 && (module.exports = {
|
82
|
+
builderPluginAdapterHtml
|
83
|
+
});
|
@@ -1,26 +1,48 @@
|
|
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 adapterSSR_exports = {};
|
30
|
+
__export(adapterSSR_exports, {
|
31
|
+
builderPluginAdapterSSR: () => builderPluginAdapterSSR
|
10
32
|
});
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
33
|
+
module.exports = __toCommonJS(adapterSSR_exports);
|
34
|
+
var path = __toESM(require("path"));
|
35
|
+
var import_builder_shared = require("@modern-js/builder-shared");
|
36
|
+
var import_utils = require("@modern-js/utils");
|
37
|
+
var import_bundlerPlugins = require("../bundlerPlugins");
|
38
|
+
var import_utils2 = require("../../../analyze/utils");
|
17
39
|
const builderPluginAdapterSSR = (options) => ({
|
18
40
|
name: "builder-plugin-adapter-modern-ssr",
|
19
41
|
setup(api) {
|
20
42
|
const { normalizedConfig } = options;
|
21
43
|
api.modifyBuilderConfig((config) => {
|
22
44
|
if (isStreamingSSR(normalizedConfig)) {
|
23
|
-
return (0,
|
45
|
+
return (0, import_builder_shared.mergeBuilderConfig)(config, {
|
24
46
|
html: {
|
25
47
|
inject: "body"
|
26
48
|
}
|
@@ -31,8 +53,8 @@ const builderPluginAdapterSSR = (options) => ({
|
|
31
53
|
api.modifyBundlerChain(async (chain, { target, CHAIN_ID, isProd, HtmlPlugin: HtmlBundlerPlugin, isServer }) => {
|
32
54
|
const builderConfig = api.getNormalizedConfig();
|
33
55
|
const { normalizedConfig: normalizedConfig2 } = options;
|
34
|
-
applyRouterPlugin(chain, options, HtmlBundlerPlugin);
|
35
|
-
if ((0,
|
56
|
+
applyRouterPlugin(chain, CHAIN_ID.PLUGIN.ROUTER_MANIFEST, options, HtmlBundlerPlugin);
|
57
|
+
if ((0, import_utils.isSSR)(normalizedConfig2)) {
|
36
58
|
await applySSRLoaderEntry(chain, options, isServer);
|
37
59
|
applySSRDataLoader(chain, options);
|
38
60
|
}
|
@@ -46,7 +68,7 @@ const builderPluginAdapterSSR = (options) => ({
|
|
46
68
|
appNormalizedConfig: normalizedConfig2
|
47
69
|
});
|
48
70
|
}
|
49
|
-
if (!(0,
|
71
|
+
if (!(0, import_builder_shared.isHtmlDisabled)(builderConfig, target)) {
|
50
72
|
applyAsyncChunkHtmlPlugin({
|
51
73
|
chain,
|
52
74
|
modernConfig: options.normalizedConfig,
|
@@ -58,13 +80,12 @@ const builderPluginAdapterSSR = (options) => ({
|
|
58
80
|
}
|
59
81
|
});
|
60
82
|
const isStreamingSSR = (userConfig) => {
|
61
|
-
var _server;
|
62
83
|
const isStreaming = (ssr) => ssr && typeof ssr === "object" && ssr.mode === "stream";
|
63
84
|
const { server } = userConfig;
|
64
85
|
if (isStreaming(server.ssr)) {
|
65
86
|
return true;
|
66
87
|
}
|
67
|
-
if ((
|
88
|
+
if ((server === null || server === void 0 ? void 0 : server.ssrByEntries) && typeof server.ssrByEntries === "object") {
|
68
89
|
for (const name of Object.keys(server.ssrByEntries)) {
|
69
90
|
if (isStreaming(server.ssrByEntries[name])) {
|
70
91
|
return true;
|
@@ -75,22 +96,22 @@ const isStreamingSSR = (userConfig) => {
|
|
75
96
|
};
|
76
97
|
function applyAsyncChunkHtmlPlugin({ chain, modernConfig, CHAIN_ID, HtmlBundlerPlugin }) {
|
77
98
|
if (isStreamingSSR(modernConfig)) {
|
78
|
-
chain.plugin(CHAIN_ID.PLUGIN.HTML_ASYNC_CHUNK).use(
|
99
|
+
chain.plugin(CHAIN_ID.PLUGIN.HTML_ASYNC_CHUNK).use(import_bundlerPlugins.HtmlAsyncChunkPlugin, [
|
79
100
|
HtmlBundlerPlugin
|
80
101
|
]);
|
81
102
|
}
|
82
103
|
}
|
83
|
-
function applyRouterPlugin(chain, options, HtmlBundlerPlugin) {
|
84
|
-
var _normalizedConfig_runtime,
|
104
|
+
function applyRouterPlugin(chain, pluginName, options, HtmlBundlerPlugin) {
|
105
|
+
var _normalizedConfig_runtime, _normalizedConfig_deploy_worker;
|
85
106
|
const { appContext, normalizedConfig } = options;
|
86
107
|
const { entrypoints } = appContext;
|
87
108
|
const existNestedRoutes = entrypoints.some((entrypoint) => entrypoint.nestedRoutesEntry);
|
88
|
-
const routerConfig =
|
89
|
-
const routerManifest = Boolean(
|
109
|
+
const routerConfig = normalizedConfig === null || normalizedConfig === void 0 ? void 0 : (_normalizedConfig_runtime = normalizedConfig.runtime) === null || _normalizedConfig_runtime === void 0 ? void 0 : _normalizedConfig_runtime.router;
|
110
|
+
const routerManifest = Boolean(routerConfig === null || routerConfig === void 0 ? void 0 : routerConfig.manifest);
|
90
111
|
const workerSSR = Boolean((_normalizedConfig_deploy_worker = normalizedConfig.deploy.worker) === null || _normalizedConfig_deploy_worker === void 0 ? void 0 : _normalizedConfig_deploy_worker.ssr);
|
91
112
|
if (existNestedRoutes || routerManifest || workerSSR) {
|
92
113
|
var _normalizedConfig_output_distPath, _normalizedConfig_output, _normalizedConfig_output1, _normalizedConfig_html, _normalizedConfig_security;
|
93
|
-
chain.plugin(
|
114
|
+
chain.plugin(pluginName).use(import_bundlerPlugins.RouterPlugin, [
|
94
115
|
{
|
95
116
|
HtmlBundlerPlugin,
|
96
117
|
enableInlineRouteManifests: normalizedConfig.output.enableInlineRouteManifests,
|
@@ -103,21 +124,21 @@ function applyRouterPlugin(chain, options, HtmlBundlerPlugin) {
|
|
103
124
|
}
|
104
125
|
}
|
105
126
|
function applyFilterEntriesBySSRConfig({ isProd, chain, appNormalizedConfig }) {
|
106
|
-
var
|
127
|
+
var _this;
|
107
128
|
const { server: serverConfig, output: outputConfig } = appNormalizedConfig;
|
108
129
|
const entries = chain.entryPoints.entries();
|
109
|
-
if (isProd && ((
|
130
|
+
if (isProd && ((outputConfig === null || outputConfig === void 0 ? void 0 : outputConfig.ssg) === true || typeof ((_this = outputConfig === null || outputConfig === void 0 ? void 0 : outputConfig.ssg) === null || _this === void 0 ? void 0 : _this[0]) === "function")) {
|
110
131
|
return;
|
111
132
|
}
|
112
133
|
if (typeof entries === "undefined") {
|
113
134
|
throw new Error("No entry found, one of src/routes/layout.tsx, src/App.tsx, src/index.tsx is required");
|
114
135
|
}
|
115
136
|
const entryNames = Object.keys(entries);
|
116
|
-
if (isProd && entryNames.length === 1 && (
|
137
|
+
if (isProd && entryNames.length === 1 && (outputConfig === null || outputConfig === void 0 ? void 0 : outputConfig.ssg)) {
|
117
138
|
return;
|
118
139
|
}
|
119
140
|
const ssgEntries = [];
|
120
|
-
if (isProd && (
|
141
|
+
if (isProd && (outputConfig === null || outputConfig === void 0 ? void 0 : outputConfig.ssg)) {
|
121
142
|
const { ssg } = outputConfig;
|
122
143
|
entryNames.forEach((name) => {
|
123
144
|
if (ssg[name]) {
|
@@ -127,8 +148,7 @@ function applyFilterEntriesBySSRConfig({ isProd, chain, appNormalizedConfig }) {
|
|
127
148
|
}
|
128
149
|
const { ssr, ssrByEntries } = serverConfig || {};
|
129
150
|
entryNames.forEach((name) => {
|
130
|
-
|
131
|
-
if (!ssgEntries.includes(name) && (ssr && ((_ssrByEntries = ssrByEntries) === null || _ssrByEntries === void 0 ? void 0 : _ssrByEntries[name]) === false || !ssr && !((_ssrByEntries1 = ssrByEntries) === null || _ssrByEntries1 === void 0 ? void 0 : _ssrByEntries1[name]))) {
|
151
|
+
if (!ssgEntries.includes(name) && (ssr && (ssrByEntries === null || ssrByEntries === void 0 ? void 0 : ssrByEntries[name]) === false || !ssr && !(ssrByEntries === null || ssrByEntries === void 0 ? void 0 : ssrByEntries[name]))) {
|
132
152
|
chain.entryPoints.delete(name);
|
133
153
|
}
|
134
154
|
});
|
@@ -139,10 +159,10 @@ async function applySSRLoaderEntry(chain, optinos, isServer) {
|
|
139
159
|
const { entrypoints } = appContext;
|
140
160
|
await Promise.all(entrypoints.map(async (entrypoint) => {
|
141
161
|
const { entryName } = entrypoint;
|
142
|
-
const serverLoadersFile = (0,
|
162
|
+
const serverLoadersFile = (0, import_utils2.getServerCombinedModueFile)(internalDirectory, entryName);
|
143
163
|
if (isServer) {
|
144
164
|
try {
|
145
|
-
await
|
165
|
+
await import_utils.fs.access(serverLoadersFile, import_utils.fs.constants.F_OK);
|
146
166
|
chain.entry(`${entryName}-server-loaders`).add(serverLoadersFile);
|
147
167
|
} catch (err) {
|
148
168
|
}
|
@@ -153,7 +173,11 @@ function applySSRDataLoader(chain, options) {
|
|
153
173
|
const { normalizedConfig, appContext } = options;
|
154
174
|
const { appDirectory } = appContext;
|
155
175
|
const { entriesDir = "./src" } = normalizedConfig.source;
|
156
|
-
const absolutePath =
|
176
|
+
const absolutePath = path.resolve(appDirectory, entriesDir).split(path.sep).join("(\\\\|/)");
|
157
177
|
const reg = new RegExp(`${absolutePath}.*\\.(loader|data|data.client)\\.[t|j]sx?$`);
|
158
178
|
chain.module.rule("ssr-data-loader").test(reg).use("data-loader").loader(require.resolve("@modern-js/plugin-data-loader/loader")).end();
|
159
179
|
}
|
180
|
+
// Annotate the CommonJS export names for ESM import in node:
|
181
|
+
0 && (module.exports = {
|
182
|
+
builderPluginAdapterSSR
|
183
|
+
});
|