@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
package/dist/cjs/index.js
CHANGED
@@ -1,58 +1,63 @@
|
|
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 _core.mergeConfig;
|
15
|
-
},
|
16
|
-
dev: function() {
|
17
|
-
return _commands.dev;
|
18
|
-
},
|
19
|
-
devCommand: function() {
|
20
|
-
return devCommand;
|
21
|
-
},
|
22
|
-
buildCommand: function() {
|
23
|
-
return buildCommand;
|
24
|
-
},
|
25
|
-
appTools: function() {
|
26
|
-
return appTools;
|
27
|
-
},
|
28
|
-
default: function() {
|
29
|
-
return _default;
|
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 });
|
30
17
|
}
|
18
|
+
return to;
|
19
|
+
};
|
20
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
21
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
22
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
23
|
+
// file that has been converted to a CommonJS file using a Babel-
|
24
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
25
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
26
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
27
|
+
mod
|
28
|
+
));
|
29
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
30
|
+
var src_exports = {};
|
31
|
+
__export(src_exports, {
|
32
|
+
appTools: () => appTools,
|
33
|
+
buildCommand: () => buildCommand,
|
34
|
+
default: () => src_default,
|
35
|
+
dev: () => import_commands.dev,
|
36
|
+
devCommand: () => devCommand,
|
37
|
+
mergeConfig: () => import_core.mergeConfig
|
31
38
|
});
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
_export_star._(require("./defineConfig"), exports);
|
49
|
-
_export_star._(require("./types"), exports);
|
39
|
+
module.exports = __toCommonJS(src_exports);
|
40
|
+
var import_path = __toESM(require("path"));
|
41
|
+
var import_plugin_lint = require("@modern-js/plugin-lint");
|
42
|
+
var import_utils = require("@modern-js/utils");
|
43
|
+
var import_lodash = require("@modern-js/utils/lodash");
|
44
|
+
var import_language_detector = require("@modern-js/plugin-i18n/language-detector");
|
45
|
+
var import_analyze = __toESM(require("./analyze"));
|
46
|
+
var import_initialize = __toESM(require("./initialize"));
|
47
|
+
var import_hooks = require("./hooks");
|
48
|
+
var import_locale = require("./locale");
|
49
|
+
var import_restart = require("./utils/restart");
|
50
|
+
var import_generateWatchFiles = require("./utils/generateWatchFiles");
|
51
|
+
var import_core = require("@modern-js/core");
|
52
|
+
var import_commands = require("./commands");
|
53
|
+
__reExport(src_exports, require("./defineConfig"), module.exports);
|
54
|
+
__reExport(src_exports, require("./types"), module.exports);
|
50
55
|
const devCommand = async (program, api) => {
|
51
56
|
const runner = api.useHookRunners();
|
52
57
|
const devToolMetas = await runner.registerDev();
|
53
|
-
const devProgram = program.command("dev").alias("start").usage("[options]").description(
|
54
|
-
const { dev } = await Promise.resolve().then(() =>
|
55
|
-
await
|
58
|
+
const devProgram = program.command("dev").alias("start").usage("[options]").description(import_locale.i18n.t(import_locale.localeKeys.command.dev.describe)).option("-c --config <config>", import_locale.i18n.t(import_locale.localeKeys.command.shared.config)).option("-e --entry [entry...]", import_locale.i18n.t(import_locale.localeKeys.command.dev.entry)).option("--analyze", import_locale.i18n.t(import_locale.localeKeys.command.shared.analyze)).option("--api-only", import_locale.i18n.t(import_locale.localeKeys.command.dev.apiOnly)).option("--web-only", import_locale.i18n.t(import_locale.localeKeys.command.dev.webOnly)).action(async (options) => {
|
59
|
+
const { dev: dev2 } = await Promise.resolve().then(() => __toESM(require("./commands/dev")));
|
60
|
+
await dev2(api, options);
|
56
61
|
});
|
57
62
|
for (const meta of devToolMetas) {
|
58
63
|
if (!meta.subCommands) {
|
@@ -61,7 +66,7 @@ const devCommand = async (program, api) => {
|
|
61
66
|
for (const subCmd of meta.subCommands) {
|
62
67
|
devProgram.command(subCmd).action(async (options = {}) => {
|
63
68
|
const { appDirectory } = api.useAppContext();
|
64
|
-
const { isTypescript } = await Promise.resolve().then(() =>
|
69
|
+
const { isTypescript } = await Promise.resolve().then(() => __toESM(require("@modern-js/utils")));
|
65
70
|
await runner.beforeDevTask(meta);
|
66
71
|
await meta.action(options, {
|
67
72
|
isTsProject: isTypescript(appDirectory)
|
@@ -73,16 +78,16 @@ const devCommand = async (program, api) => {
|
|
73
78
|
const buildCommand = async (program, api) => {
|
74
79
|
const runner = api.useHookRunners();
|
75
80
|
const platformBuilders = await runner.registerBuildPlatform();
|
76
|
-
const buildProgram = program.command("build").usage("[options]").description(
|
77
|
-
const { build } = await Promise.resolve().then(() =>
|
81
|
+
const buildProgram = program.command("build").usage("[options]").description(import_locale.i18n.t(import_locale.localeKeys.command.build.describe)).option("-c --config <config>", import_locale.i18n.t(import_locale.localeKeys.command.shared.config)).option("--analyze", import_locale.i18n.t(import_locale.localeKeys.command.shared.analyze)).action(async (options) => {
|
82
|
+
const { build } = await Promise.resolve().then(() => __toESM(require("./commands/build")));
|
78
83
|
await build(api, options);
|
79
84
|
});
|
80
85
|
for (const platformBuilder of platformBuilders) {
|
81
|
-
const platforms = (0,
|
86
|
+
const platforms = (0, import_lodash.castArray)(platformBuilder.platform);
|
82
87
|
for (const platform of platforms) {
|
83
88
|
buildProgram.command(platform).action(async () => {
|
84
89
|
const { appDirectory } = api.useAppContext();
|
85
|
-
const { isTypescript } = await Promise.resolve().then(() =>
|
90
|
+
const { isTypescript } = await Promise.resolve().then(() => __toESM(require("@modern-js/utils")));
|
86
91
|
await runner.beforeBuildPlatform(platformBuilders);
|
87
92
|
await platformBuilder.build(platform, {
|
88
93
|
isTsProject: isTypescript(appDirectory)
|
@@ -93,140 +98,147 @@ const buildCommand = async (program, api) => {
|
|
93
98
|
};
|
94
99
|
const appTools = (options = {
|
95
100
|
bundler: "webpack"
|
96
|
-
}) => {
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
...appContext2,
|
139
|
-
internalDirectory: _path.default.resolve(appContext2.appDirectory, userConfig.output.tempDir)
|
140
|
-
});
|
141
|
-
}
|
142
|
-
},
|
143
|
-
async commands({ program }) {
|
144
|
-
await devCommand(program, api);
|
145
|
-
await buildCommand(program, api);
|
146
|
-
program.command("serve").usage("[options]").description(_locale.i18n.t(_locale.localeKeys.command.serve.describe)).option("--api-only", _locale.i18n.t(_locale.localeKeys.command.dev.apiOnly)).option("-c --config <config>", _locale.i18n.t(_locale.localeKeys.command.shared.config)).action(async () => {
|
147
|
-
const { start } = await Promise.resolve().then(() => /* @__PURE__ */ _interop_require_wildcard._(require("./commands/serve")));
|
148
|
-
await start(api);
|
149
|
-
});
|
150
|
-
program.command("deploy").usage("[options]").option("-c --config <config>", _locale.i18n.t(_locale.localeKeys.command.shared.config)).option("-s --skip-build", _locale.i18n.t(_locale.localeKeys.command.shared.skipBuild)).description(_locale.i18n.t(_locale.localeKeys.command.deploy.describe)).action(async (options2) => {
|
151
|
-
if (!options2.skipBuild) {
|
152
|
-
const { build } = await Promise.resolve().then(() => /* @__PURE__ */ _interop_require_wildcard._(require("./commands/build")));
|
153
|
-
await build(api);
|
154
|
-
}
|
155
|
-
const { deploy } = await Promise.resolve().then(() => /* @__PURE__ */ _interop_require_wildcard._(require("./commands/deploy")));
|
156
|
-
await deploy(api, options2);
|
157
|
-
process.exit(0);
|
101
|
+
}) => ({
|
102
|
+
name: "@modern-js/app-tools",
|
103
|
+
post: [
|
104
|
+
"@modern-js/plugin-initialize",
|
105
|
+
"@modern-js/plugin-analyze",
|
106
|
+
"@modern-js/plugin-ssr",
|
107
|
+
"@modern-js/plugin-document",
|
108
|
+
"@modern-js/plugin-state",
|
109
|
+
"@modern-js/plugin-router",
|
110
|
+
"@modern-js/plugin-router-v5",
|
111
|
+
"@modern-js/plugin-polyfill"
|
112
|
+
],
|
113
|
+
registerHook: import_hooks.hooks,
|
114
|
+
usePlugins: [
|
115
|
+
(0, import_initialize.default)({
|
116
|
+
bundler: (options === null || options === void 0 ? void 0 : options.bundler) === "experimental-rspack" ? "rspack" : "webpack"
|
117
|
+
}),
|
118
|
+
(0, import_analyze.default)({
|
119
|
+
bundler: (options === null || options === void 0 ? void 0 : options.bundler) === "experimental-rspack" ? "rspack" : "webpack"
|
120
|
+
}),
|
121
|
+
(0, import_plugin_lint.lintPlugin)()
|
122
|
+
],
|
123
|
+
setup: (api) => {
|
124
|
+
const appContext = api.useAppContext();
|
125
|
+
api.setAppContext({
|
126
|
+
...appContext,
|
127
|
+
toolsType: "app-tools"
|
128
|
+
});
|
129
|
+
const nestedRoutes = {};
|
130
|
+
const locale = (0, import_language_detector.getLocaleLanguage)();
|
131
|
+
import_locale.i18n.changeLanguage({
|
132
|
+
locale
|
133
|
+
});
|
134
|
+
return {
|
135
|
+
async beforeConfig() {
|
136
|
+
var _userConfig_output;
|
137
|
+
const userConfig = api.useConfigContext();
|
138
|
+
const appContext2 = api.useAppContext();
|
139
|
+
if ((_userConfig_output = userConfig.output) === null || _userConfig_output === void 0 ? void 0 : _userConfig_output.tempDir) {
|
140
|
+
api.setAppContext({
|
141
|
+
...appContext2,
|
142
|
+
internalDirectory: import_path.default.resolve(appContext2.appDirectory, userConfig.output.tempDir)
|
158
143
|
});
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
144
|
+
}
|
145
|
+
},
|
146
|
+
async commands({ program }) {
|
147
|
+
await devCommand(program, api);
|
148
|
+
await buildCommand(program, api);
|
149
|
+
program.command("serve").usage("[options]").description(import_locale.i18n.t(import_locale.localeKeys.command.serve.describe)).option("--api-only", import_locale.i18n.t(import_locale.localeKeys.command.dev.apiOnly)).option("-c --config <config>", import_locale.i18n.t(import_locale.localeKeys.command.shared.config)).action(async () => {
|
150
|
+
const { start } = await Promise.resolve().then(() => __toESM(require("./commands/serve")));
|
151
|
+
await start(api);
|
152
|
+
});
|
153
|
+
program.command("deploy").usage("[options]").option("-c --config <config>", import_locale.i18n.t(import_locale.localeKeys.command.shared.config)).option("-s --skip-build", import_locale.i18n.t(import_locale.localeKeys.command.shared.skipBuild)).description(import_locale.i18n.t(import_locale.localeKeys.command.deploy.describe)).action(async (options2) => {
|
154
|
+
if (!options2.skipBuild) {
|
155
|
+
const { build } = await Promise.resolve().then(() => __toESM(require("./commands/build")));
|
156
|
+
await build(api);
|
157
|
+
}
|
158
|
+
const { deploy } = await Promise.resolve().then(() => __toESM(require("./commands/deploy")));
|
159
|
+
await deploy(api, options2);
|
160
|
+
process.exit(0);
|
161
|
+
});
|
162
|
+
program.command("new").usage("[options]").description(import_locale.i18n.t(import_locale.localeKeys.command.new.describe)).option("--config-file <configFile>", import_locale.i18n.t(import_locale.localeKeys.command.shared.config)).option("--lang <lang>", import_locale.i18n.t(import_locale.localeKeys.command.new.lang)).option("-c, --config <config>", import_locale.i18n.t(import_locale.localeKeys.command.new.config)).option("-d, --debug", import_locale.i18n.t(import_locale.localeKeys.command.new.debug), false).option("--dist-tag <tag>", import_locale.i18n.t(import_locale.localeKeys.command.new.distTag)).option("--registry", import_locale.i18n.t(import_locale.localeKeys.command.new.registry)).option("--no-need-install", import_locale.i18n.t(import_locale.localeKeys.command.shared.noNeedInstall)).action(async (options2) => {
|
163
|
+
const { MWANewAction } = await Promise.resolve().then(() => __toESM(require("@modern-js/new-action")));
|
164
|
+
await MWANewAction({
|
165
|
+
...options2,
|
166
|
+
locale: options2.lang || locale
|
165
167
|
});
|
166
|
-
|
167
|
-
|
168
|
-
|
168
|
+
});
|
169
|
+
program.command("inspect").description("inspect the internal configs").option(`--env <env>`, import_locale.i18n.t(import_locale.localeKeys.command.inspect.env), "development").option("--output <output>", import_locale.i18n.t(import_locale.localeKeys.command.inspect.output), "/").option("--verbose", import_locale.i18n.t(import_locale.localeKeys.command.inspect.verbose)).option("-c --config <config>", import_locale.i18n.t(import_locale.localeKeys.command.shared.config)).action(async (options2) => {
|
170
|
+
const { inspect } = await Promise.resolve().then(() => __toESM(require("./commands/inspect")));
|
171
|
+
inspect(api, options2);
|
172
|
+
});
|
173
|
+
const { defineCommand } = await Promise.resolve().then(() => __toESM(require("@modern-js/upgrade")));
|
174
|
+
defineCommand(program.command("upgrade").option("-c --config <config>", import_locale.i18n.t(import_locale.localeKeys.command.shared.config)).option("--no-need-install", import_locale.i18n.t(import_locale.localeKeys.command.shared.noNeedInstall)));
|
175
|
+
},
|
176
|
+
async prepare() {
|
177
|
+
const command = (0, import_utils.getCommand)();
|
178
|
+
if (command === "deploy") {
|
179
|
+
const isSkipBuild = [
|
180
|
+
"-s",
|
181
|
+
"--skip-build"
|
182
|
+
].some((tag) => {
|
183
|
+
return (0, import_utils.getArgv)().includes(tag);
|
169
184
|
});
|
170
|
-
|
171
|
-
|
172
|
-
},
|
173
|
-
async prepare() {
|
174
|
-
const command = (0, _utils.getCommand)();
|
175
|
-
if (command === "deploy") {
|
176
|
-
const isSkipBuild = [
|
177
|
-
"-s",
|
178
|
-
"--skip-build"
|
179
|
-
].some((tag) => {
|
180
|
-
return (0, _utils.getArgv)().includes(tag);
|
181
|
-
});
|
182
|
-
if (isSkipBuild) {
|
183
|
-
return;
|
184
|
-
}
|
185
|
-
}
|
186
|
-
if (command === "dev" || command === "start" || command === "build" || command === "deploy") {
|
187
|
-
const resolvedConfig = api.useResolvedConfigContext();
|
188
|
-
if (resolvedConfig.output.cleanDistPath) {
|
189
|
-
const appContext2 = api.useAppContext();
|
190
|
-
await (0, _utils.emptyDir)(appContext2.distDirectory);
|
191
|
-
}
|
185
|
+
if (isSkipBuild) {
|
186
|
+
return;
|
192
187
|
}
|
193
|
-
}
|
194
|
-
|
195
|
-
const
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
// 这里会被 core/initWatcher 监听的文件变动触发,如果是 src 目录下的文件变动,则不做 restart
|
200
|
-
async fileChange(e) {
|
201
|
-
const { filename, eventType, isPrivate } = e;
|
202
|
-
if (!isPrivate && (eventType === "change" || eventType === "unlink")) {
|
203
|
-
const { closeServer } = await Promise.resolve().then(() => /* @__PURE__ */ _interop_require_wildcard._(require("./utils/createServer")));
|
204
|
-
await closeServer();
|
205
|
-
await (0, _restart.restart)(api.useHookRunners(), filename);
|
188
|
+
}
|
189
|
+
if (command === "dev" || command === "start" || command === "build" || command === "deploy") {
|
190
|
+
const resolvedConfig = api.useResolvedConfigContext();
|
191
|
+
if (resolvedConfig.output.cleanDistPath) {
|
192
|
+
const appContext2 = api.useAppContext();
|
193
|
+
await (0, import_utils.emptyDir)(appContext2.distDirectory);
|
206
194
|
}
|
207
|
-
},
|
208
|
-
async beforeRestart() {
|
209
|
-
(0, _utils.cleanRequireCache)([
|
210
|
-
require.resolve("./analyze")
|
211
|
-
]);
|
212
|
-
},
|
213
|
-
async modifyFileSystemRoutes({ entrypoint, routes }) {
|
214
|
-
nestedRoutes[entrypoint.entryName] = routes;
|
215
|
-
return {
|
216
|
-
entrypoint,
|
217
|
-
routes
|
218
|
-
};
|
219
|
-
},
|
220
|
-
async beforeGenerateRoutes({ entrypoint, code }) {
|
221
|
-
const { distDirectory } = api.useAppContext();
|
222
|
-
await _utils.fs.outputJSON(_path.default.resolve(distDirectory, _utils.NESTED_ROUTE_SPEC_FILE), nestedRoutes);
|
223
|
-
return {
|
224
|
-
entrypoint,
|
225
|
-
code
|
226
|
-
};
|
227
195
|
}
|
228
|
-
}
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
196
|
+
},
|
197
|
+
async watchFiles() {
|
198
|
+
const appContext2 = api.useAppContext();
|
199
|
+
const config = api.useResolvedConfigContext();
|
200
|
+
return await (0, import_generateWatchFiles.generateWatchFiles)(appContext2, config.source.configDir);
|
201
|
+
},
|
202
|
+
// 这里会被 core/initWatcher 监听的文件变动触发,如果是 src 目录下的文件变动,则不做 restart
|
203
|
+
async fileChange(e) {
|
204
|
+
const { filename, eventType, isPrivate } = e;
|
205
|
+
if (!isPrivate && (eventType === "change" || eventType === "unlink")) {
|
206
|
+
const { closeServer } = await Promise.resolve().then(() => __toESM(require("./utils/createServer")));
|
207
|
+
await closeServer();
|
208
|
+
await (0, import_restart.restart)(api.useHookRunners(), filename);
|
209
|
+
}
|
210
|
+
},
|
211
|
+
async beforeRestart() {
|
212
|
+
(0, import_utils.cleanRequireCache)([
|
213
|
+
require.resolve("./analyze")
|
214
|
+
]);
|
215
|
+
},
|
216
|
+
async modifyFileSystemRoutes({ entrypoint, routes }) {
|
217
|
+
nestedRoutes[entrypoint.entryName] = routes;
|
218
|
+
return {
|
219
|
+
entrypoint,
|
220
|
+
routes
|
221
|
+
};
|
222
|
+
},
|
223
|
+
async beforeGenerateRoutes({ entrypoint, code }) {
|
224
|
+
const { distDirectory } = api.useAppContext();
|
225
|
+
await import_utils.fs.outputJSON(import_path.default.resolve(distDirectory, import_utils.NESTED_ROUTE_SPEC_FILE), nestedRoutes);
|
226
|
+
return {
|
227
|
+
entrypoint,
|
228
|
+
code
|
229
|
+
};
|
230
|
+
}
|
231
|
+
};
|
232
|
+
}
|
233
|
+
});
|
234
|
+
var src_default = appTools;
|
235
|
+
// Annotate the CommonJS export names for ESM import in node:
|
236
|
+
0 && (module.exports = {
|
237
|
+
appTools,
|
238
|
+
buildCommand,
|
239
|
+
dev,
|
240
|
+
devCommand,
|
241
|
+
mergeConfig,
|
242
|
+
...require("./defineConfig"),
|
243
|
+
...require("./types")
|
244
|
+
});
|
@@ -1,17 +1,30 @@
|
|
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 initialize_exports = {};
|
20
|
+
__export(initialize_exports, {
|
21
|
+
default: () => initialize_default
|
10
22
|
});
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
23
|
+
module.exports = __toCommonJS(initialize_exports);
|
24
|
+
var import_utils = require("@modern-js/utils");
|
25
|
+
var import_schema = require("../schema");
|
26
|
+
var import_config = require("../config");
|
27
|
+
var initialize_default = ({ bundler }) => ({
|
15
28
|
name: "@modern-js/plugin-initialize",
|
16
29
|
post: [
|
17
30
|
"@modern-js/plugin-ssr",
|
@@ -29,11 +42,11 @@ const _default = ({ bundler }) => ({
|
|
29
42
|
...appContext,
|
30
43
|
bundlerType: bundler
|
31
44
|
});
|
32
|
-
return (0,
|
45
|
+
return (0, import_config.checkIsLegacyConfig)(userConfig) ? (0, import_config.createLegacyDefaultConfig)(appContext) : (0, import_config.createDefaultConfig)(appContext, bundler);
|
33
46
|
};
|
34
47
|
const validateSchema = () => {
|
35
48
|
const userConfig = api.useConfigContext();
|
36
|
-
const schemas = (0,
|
49
|
+
const schemas = (0, import_config.checkIsLegacyConfig)(userConfig) ? import_schema.legacySchema : import_schema.schema;
|
37
50
|
return schemas.generate();
|
38
51
|
};
|
39
52
|
return {
|
@@ -47,10 +60,10 @@ const _default = ({ bundler }) => ({
|
|
47
60
|
appContext = {
|
48
61
|
...appContext,
|
49
62
|
port,
|
50
|
-
distDirectory: (0,
|
63
|
+
distDirectory: (0, import_utils.ensureAbsolutePath)(appContext.distDirectory, ((_resolved_output_distPath = resolved.output.distPath) === null || _resolved_output_distPath === void 0 ? void 0 : _resolved_output_distPath.root) || "dist")
|
51
64
|
};
|
52
65
|
api.setAppContext(appContext);
|
53
|
-
const normalizedConfig = (0,
|
66
|
+
const normalizedConfig = (0, import_config.checkIsLegacyConfig)(resolved) ? (0, import_config.transformNormalizedConfig)(resolved) : resolved;
|
54
67
|
resolved._raw = userConfig;
|
55
68
|
resolved.server = {
|
56
69
|
...normalizedConfig.server || {},
|
@@ -91,8 +104,8 @@ function stabilizeConfig(resolve, config, keys) {
|
|
91
104
|
}
|
92
105
|
async function getServerPort(config) {
|
93
106
|
const prodPort = Number(process.env.PORT) || config.server.port || 8080;
|
94
|
-
if ((0,
|
95
|
-
return (0,
|
107
|
+
if ((0, import_utils.isDev)() && (0, import_utils.isDevCommand)()) {
|
108
|
+
return (0, import_utils.getPort)(Number(process.env.PORT) || config.dev.port || prodPort);
|
96
109
|
}
|
97
110
|
return prodPort;
|
98
111
|
}
|
package/dist/cjs/locale/en.js
CHANGED
@@ -1,13 +1,26 @@
|
|
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 en_exports = {};
|
20
|
+
__export(en_exports, {
|
21
|
+
EN_LOCALE: () => EN_LOCALE
|
10
22
|
});
|
23
|
+
module.exports = __toCommonJS(en_exports);
|
11
24
|
const EN_LOCALE = {
|
12
25
|
command: {
|
13
26
|
shared: {
|
@@ -48,3 +61,7 @@ const EN_LOCALE = {
|
|
48
61
|
}
|
49
62
|
}
|
50
63
|
};
|
64
|
+
// Annotate the CommonJS export names for ESM import in node:
|
65
|
+
0 && (module.exports = {
|
66
|
+
EN_LOCALE
|
67
|
+
});
|
package/dist/cjs/locale/index.js
CHANGED
@@ -1,27 +1,37 @@
|
|
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 i18n;
|
15
|
-
},
|
16
|
-
localeKeys: function() {
|
17
|
-
return localeKeys;
|
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 });
|
18
15
|
}
|
16
|
+
return to;
|
17
|
+
};
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
19
|
+
var locale_exports = {};
|
20
|
+
__export(locale_exports, {
|
21
|
+
i18n: () => i18n,
|
22
|
+
localeKeys: () => localeKeys
|
19
23
|
});
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
+
module.exports = __toCommonJS(locale_exports);
|
25
|
+
var import_plugin_i18n = require("@modern-js/plugin-i18n");
|
26
|
+
var import_zh = require("./zh");
|
27
|
+
var import_en = require("./en");
|
28
|
+
const i18n = new import_plugin_i18n.I18n();
|
24
29
|
const localeKeys = i18n.init("en", {
|
25
|
-
zh:
|
26
|
-
en:
|
30
|
+
zh: import_zh.ZH_LOCALE,
|
31
|
+
en: import_en.EN_LOCALE
|
32
|
+
});
|
33
|
+
// Annotate the CommonJS export names for ESM import in node:
|
34
|
+
0 && (module.exports = {
|
35
|
+
i18n,
|
36
|
+
localeKeys
|
27
37
|
});
|