@modern-js/app-tools 2.3.1-alpha.2 → 2.5.0-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/CHANGELOG.md +115 -0
- package/README.md +14 -18
- package/dist/cjs/analyze/constants.js +100 -0
- package/dist/cjs/analyze/generateCode.js +251 -0
- package/dist/cjs/analyze/getBundleEntry.js +101 -0
- package/dist/cjs/analyze/getClientRoutes/getRoutes.js +225 -0
- package/dist/cjs/analyze/getClientRoutes/getRoutesLegacy.js +221 -0
- package/dist/cjs/analyze/getClientRoutes/index.js +30 -0
- package/dist/cjs/analyze/getClientRoutes/utils.js +58 -0
- package/dist/cjs/analyze/getFileSystemEntry.js +131 -0
- package/dist/cjs/analyze/getHtmlTemplate.js +124 -0
- package/dist/cjs/analyze/getServerRoutes.js +174 -0
- package/dist/cjs/analyze/index.js +294 -0
- package/dist/cjs/analyze/isDefaultExportFunction.js +71 -0
- package/dist/cjs/analyze/makeLegalIdentifier.js +36 -0
- package/dist/cjs/analyze/nestedRoutes.js +179 -0
- package/dist/cjs/analyze/templates.js +330 -0
- package/dist/cjs/analyze/utils.js +152 -0
- package/dist/cjs/builder/builder-rspack/index.js +31 -0
- package/dist/cjs/builder/builder-webpack/builderPlugins/compatModern.js +64 -0
- package/dist/cjs/builder/builder-webpack/index.js +78 -0
- package/dist/cjs/builder/builder-webpack/webpackPlugins/RouterPlugin.js +120 -0
- package/dist/cjs/builder/builder-webpack/webpackPlugins/index.js +17 -0
- package/dist/cjs/builder/generator/createBuilderOptions.js +47 -0
- package/dist/cjs/builder/generator/createBuilderProviderConfig.js +49 -0
- package/dist/cjs/builder/generator/getBuilderTargets.js +39 -0
- package/dist/cjs/builder/generator/index.js +58 -0
- package/dist/cjs/builder/index.js +46 -0
- package/dist/cjs/builder/shared/builderPlugins/adapterModern.js +230 -0
- package/dist/{js/node/builder/webpackPlugins/htmlAsyncChunkPlugin.js → cjs/builder/shared/bundlerPlugins/HtmlAsyncChunkPlugin.js} +17 -20
- package/dist/{js/node/builder/webpackPlugins/htmlBottomTemplate.js → cjs/builder/shared/bundlerPlugins/HtmlBottomTemplate.js} +21 -24
- package/dist/{js/node/builder/share.js → cjs/builder/shared/createCopyPattern.js} +3 -3
- package/dist/cjs/builder/shared/index.js +19 -0
- package/dist/{js/node/builder → cjs/builder/shared}/loaders/serverModuleLoader.js +0 -0
- package/dist/cjs/builder/shared/types.js +15 -0
- package/dist/cjs/commands/build.js +75 -0
- package/dist/cjs/commands/deploy.js +31 -0
- package/dist/cjs/commands/dev.js +91 -0
- package/dist/cjs/commands/index.js +19 -0
- package/dist/cjs/commands/inspect.js +41 -0
- package/dist/cjs/commands/serve.js +63 -0
- package/dist/cjs/config/default.js +186 -0
- package/dist/cjs/config/index.js +19 -0
- package/dist/{js/node/config/initial → cjs/config/initialize}/index.js +10 -16
- package/dist/cjs/config/initialize/inits.js +161 -0
- package/dist/{js/node/config/initial → cjs/config/legacy}/createHtmlConfig.js +0 -0
- package/dist/{js/node/config/initial → cjs/config/legacy}/createOutputConfig.js +0 -0
- package/dist/{js/node/config/initial → cjs/config/legacy}/createSourceConfig.js +0 -0
- package/dist/{js/node/config/initial → cjs/config/legacy}/createToolsConfig.js +0 -0
- package/dist/{js/node/config/initial/transformNormalizedConfig.js → cjs/config/legacy/index.js} +8 -3
- package/dist/cjs/defineConfig.js +33 -0
- package/dist/cjs/exports/server.js +27 -0
- package/dist/cjs/hooks.js +54 -0
- package/dist/cjs/index.js +198 -0
- package/dist/cjs/initialize/index.js +102 -0
- package/dist/cjs/locale/en.js +59 -0
- package/dist/cjs/locale/index.js +33 -0
- package/dist/cjs/locale/zh.js +59 -0
- package/dist/cjs/schema/Schema.js +63 -0
- package/dist/cjs/schema/index.js +118 -0
- package/dist/cjs/schema/legacy.js +169 -0
- package/dist/cjs/types/config/deploy.js +15 -0
- package/dist/cjs/types/config/dev.js +15 -0
- package/dist/cjs/types/config/experiments.js +15 -0
- package/dist/cjs/types/config/html.js +15 -0
- package/dist/cjs/types/config/index.js +17 -0
- package/dist/cjs/types/config/output.js +15 -0
- package/dist/cjs/types/config/performance.js +15 -0
- package/dist/cjs/types/config/security.js +15 -0
- package/dist/cjs/types/config/source.js +15 -0
- package/dist/cjs/types/config/tools.js +15 -0
- package/dist/cjs/types/hooks.js +15 -0
- package/dist/cjs/types/index.js +19 -0
- package/dist/cjs/types/legacyConfig/deploy.js +15 -0
- package/dist/cjs/types/legacyConfig/dev.js +15 -0
- package/dist/cjs/types/legacyConfig/index.js +15 -0
- package/dist/cjs/types/legacyConfig/output.js +15 -0
- package/dist/cjs/types/legacyConfig/source.js +15 -0
- package/dist/cjs/types/legacyConfig/tools.js +15 -0
- package/dist/cjs/types/utils.js +15 -0
- package/dist/cjs/utils/config.js +115 -0
- package/dist/cjs/utils/createServer.js +70 -0
- package/dist/cjs/utils/env.js +38 -0
- package/dist/cjs/utils/generateWatchFiles.js +63 -0
- package/dist/cjs/utils/getSelectedEntries.js +61 -0
- package/dist/cjs/utils/getServerInternalPlugins.js +41 -0
- package/dist/cjs/utils/language.js +31 -0
- package/dist/cjs/utils/printInstructions.js +34 -0
- package/dist/cjs/utils/restart.js +45 -0
- package/dist/cjs/utils/routes.js +39 -0
- package/dist/cjs/utils/types.js +15 -0
- package/dist/esm/analyze/constants.js +42 -0
- package/dist/esm/analyze/generateCode.js +486 -0
- package/dist/esm/analyze/getBundleEntry.js +64 -0
- package/dist/esm/analyze/getClientRoutes/getRoutes.js +233 -0
- package/dist/esm/analyze/getClientRoutes/getRoutesLegacy.js +231 -0
- package/dist/esm/analyze/getClientRoutes/index.js +3 -0
- package/dist/esm/analyze/getClientRoutes/utils.js +23 -0
- package/dist/esm/analyze/getFileSystemEntry.js +107 -0
- package/dist/esm/analyze/getHtmlTemplate.js +302 -0
- package/dist/esm/analyze/getServerRoutes.js +224 -0
- package/dist/esm/analyze/index.js +703 -0
- package/dist/esm/analyze/isDefaultExportFunction.js +47 -0
- package/dist/esm/analyze/makeLegalIdentifier.js +13 -0
- package/dist/esm/analyze/nestedRoutes.js +409 -0
- package/dist/esm/analyze/templates.js +466 -0
- package/dist/esm/analyze/utils.js +374 -0
- package/dist/esm/builder/builder-rspack/index.js +6 -0
- package/dist/esm/builder/builder-webpack/builderPlugins/compatModern.js +64 -0
- package/dist/esm/builder/builder-webpack/index.js +301 -0
- package/dist/esm/builder/builder-webpack/webpackPlugins/RouterPlugin.js +346 -0
- package/dist/esm/builder/builder-webpack/webpackPlugins/index.js +1 -0
- package/dist/esm/builder/generator/createBuilderOptions.js +41 -0
- package/dist/esm/builder/generator/createBuilderProviderConfig.js +70 -0
- package/dist/esm/builder/generator/getBuilderTargets.js +16 -0
- package/dist/esm/builder/generator/index.js +199 -0
- package/dist/esm/builder/index.js +175 -0
- package/dist/esm/builder/shared/builderPlugins/adapterModern.js +300 -0
- package/dist/{js/treeshaking/builder/webpackPlugins/htmlAsyncChunkPlugin.js → esm/builder/shared/bundlerPlugins/HtmlAsyncChunkPlugin.js} +0 -0
- package/dist/esm/builder/shared/bundlerPlugins/HtmlBottomTemplate.js +72 -0
- package/dist/{js/treeshaking/builder/share.js → esm/builder/shared/createCopyPattern.js} +0 -0
- package/dist/esm/builder/shared/index.js +3 -0
- package/dist/{js/treeshaking/builder → esm/builder/shared}/loaders/serverModuleLoader.js +0 -0
- package/dist/esm/builder/shared/types.js +1 -0
- package/dist/esm/commands/build.js +291 -0
- package/dist/esm/commands/deploy.js +154 -0
- package/dist/esm/commands/dev.js +301 -0
- package/dist/esm/commands/index.js +3 -0
- package/dist/esm/commands/inspect.js +149 -0
- package/dist/esm/commands/serve.js +199 -0
- package/dist/esm/config/default.js +210 -0
- package/dist/esm/config/index.js +3 -0
- package/dist/esm/config/initialize/index.js +10 -0
- package/dist/esm/config/initialize/inits.js +211 -0
- package/dist/esm/config/legacy/createHtmlConfig.js +19 -0
- package/dist/esm/config/legacy/createOutputConfig.js +41 -0
- package/dist/esm/config/legacy/createSourceConfig.js +42 -0
- package/dist/esm/config/legacy/createToolsConfig.js +23 -0
- package/dist/{js/treeshaking/config/initial/transformNormalizedConfig.js → esm/config/legacy/index.js} +4 -1
- package/dist/esm/defineConfig.js +61 -0
- package/dist/esm/exports/server.js +2 -0
- package/dist/esm/hooks.js +29 -0
- package/dist/esm/index.js +713 -0
- package/dist/esm/initialize/index.js +284 -0
- package/dist/esm/locale/en.js +38 -0
- package/dist/esm/locale/index.js +9 -0
- package/dist/esm/locale/zh.js +38 -0
- package/dist/esm/schema/Schema.js +273 -0
- package/dist/esm/schema/index.js +181 -0
- package/dist/esm/schema/legacy.js +337 -0
- package/dist/esm/types/config/deploy.js +1 -0
- package/dist/esm/types/config/dev.js +1 -0
- package/dist/esm/types/config/experiments.js +1 -0
- package/dist/esm/types/config/html.js +1 -0
- package/dist/esm/types/config/index.js +1 -0
- package/dist/esm/types/config/output.js +1 -0
- package/dist/esm/types/config/performance.js +1 -0
- package/dist/esm/types/config/security.js +1 -0
- package/dist/esm/types/config/source.js +1 -0
- package/dist/esm/types/config/tools.js +1 -0
- package/dist/esm/types/hooks.js +1 -0
- package/dist/esm/types/index.js +3 -0
- package/dist/esm/types/legacyConfig/deploy.js +1 -0
- package/dist/esm/types/legacyConfig/dev.js +1 -0
- package/dist/esm/types/legacyConfig/index.js +1 -0
- package/dist/esm/types/legacyConfig/output.js +1 -0
- package/dist/esm/types/legacyConfig/source.js +1 -0
- package/dist/esm/types/legacyConfig/tools.js +1 -0
- package/dist/esm/types/utils.js +1 -0
- package/dist/esm/utils/config.js +302 -0
- package/dist/esm/utils/createServer.js +258 -0
- package/dist/esm/utils/env.js +13 -0
- package/dist/esm/utils/generateWatchFiles.js +214 -0
- package/dist/esm/utils/getSelectedEntries.js +186 -0
- package/dist/esm/utils/getServerInternalPlugins.js +210 -0
- package/dist/esm/utils/language.js +6 -0
- package/dist/esm/utils/printInstructions.js +152 -0
- package/dist/esm/utils/restart.js +187 -0
- package/dist/esm/utils/routes.js +153 -0
- package/dist/esm/utils/types.js +1 -0
- package/dist/esm-node/analyze/constants.js +56 -0
- package/dist/esm-node/analyze/generateCode.js +227 -0
- package/dist/esm-node/analyze/getBundleEntry.js +77 -0
- package/dist/esm-node/analyze/getClientRoutes/getRoutes.js +201 -0
- package/dist/esm-node/analyze/getClientRoutes/getRoutesLegacy.js +197 -0
- package/dist/esm-node/analyze/getClientRoutes/index.js +6 -0
- package/dist/esm-node/analyze/getClientRoutes/utils.js +31 -0
- package/dist/esm-node/analyze/getFileSystemEntry.js +109 -0
- package/dist/esm-node/analyze/getHtmlTemplate.js +95 -0
- package/dist/esm-node/analyze/getServerRoutes.js +154 -0
- package/dist/esm-node/analyze/index.js +285 -0
- package/dist/esm-node/analyze/isDefaultExportFunction.js +42 -0
- package/dist/esm-node/analyze/makeLegalIdentifier.js +13 -0
- package/dist/esm-node/analyze/nestedRoutes.js +150 -0
- package/dist/esm-node/analyze/templates.js +297 -0
- package/dist/esm-node/analyze/utils.js +121 -0
- package/dist/esm-node/builder/builder-rspack/index.js +8 -0
- package/dist/esm-node/builder/builder-webpack/builderPlugins/compatModern.js +41 -0
- package/dist/esm-node/builder/builder-webpack/index.js +51 -0
- package/dist/esm-node/builder/builder-webpack/webpackPlugins/RouterPlugin.js +96 -0
- package/dist/esm-node/builder/builder-webpack/webpackPlugins/index.js +1 -0
- package/dist/esm-node/builder/generator/createBuilderOptions.js +24 -0
- package/dist/esm-node/builder/generator/createBuilderProviderConfig.js +26 -0
- package/dist/esm-node/builder/generator/getBuilderTargets.js +21 -0
- package/dist/esm-node/builder/generator/index.js +29 -0
- package/dist/esm-node/builder/index.js +17 -0
- package/dist/esm-node/builder/shared/builderPlugins/adapterModern.js +202 -0
- package/dist/esm-node/builder/shared/bundlerPlugins/HtmlAsyncChunkPlugin.js +27 -0
- package/dist/esm-node/builder/shared/bundlerPlugins/HtmlBottomTemplate.js +34 -0
- package/dist/{js/modern/builder/share.js → esm-node/builder/shared/createCopyPattern.js} +0 -0
- package/dist/esm-node/builder/shared/index.js +3 -0
- package/dist/{js/modern/builder → esm-node/builder/shared}/loaders/serverModuleLoader.js +0 -0
- package/dist/esm-node/builder/shared/types.js +0 -0
- package/dist/esm-node/commands/build.js +52 -0
- package/dist/esm-node/commands/deploy.js +8 -0
- package/dist/esm-node/commands/dev.js +72 -0
- package/dist/esm-node/commands/index.js +3 -0
- package/dist/esm-node/commands/inspect.js +18 -0
- package/dist/esm-node/commands/serve.js +34 -0
- package/dist/esm-node/config/default.js +162 -0
- package/dist/esm-node/config/index.js +3 -0
- package/dist/esm-node/config/initialize/index.js +12 -0
- package/dist/esm-node/config/initialize/inits.js +136 -0
- package/dist/{js/modern/config/initial → esm-node/config/legacy}/createHtmlConfig.js +0 -0
- package/dist/{js/modern/config/initial → esm-node/config/legacy}/createOutputConfig.js +0 -0
- package/dist/{js/modern/config/initial → esm-node/config/legacy}/createSourceConfig.js +0 -0
- package/dist/{js/modern/config/initial → esm-node/config/legacy}/createToolsConfig.js +0 -0
- package/dist/{js/modern/config/initial/transformNormalizedConfig.js → esm-node/config/legacy/index.js} +4 -0
- package/dist/esm-node/defineConfig.js +9 -0
- package/dist/esm-node/exports/server.js +4 -0
- package/dist/esm-node/hooks.js +35 -0
- package/dist/esm-node/index.js +172 -0
- package/dist/esm-node/initialize/index.js +91 -0
- package/dist/esm-node/locale/en.js +36 -0
- package/dist/esm-node/locale/index.js +9 -0
- package/dist/esm-node/locale/zh.js +36 -0
- package/dist/esm-node/schema/Schema.js +40 -0
- package/dist/esm-node/schema/index.js +88 -0
- package/dist/esm-node/schema/legacy.js +148 -0
- package/dist/esm-node/types/config/deploy.js +0 -0
- package/dist/esm-node/types/config/dev.js +0 -0
- package/dist/esm-node/types/config/experiments.js +0 -0
- package/dist/esm-node/types/config/html.js +0 -0
- package/dist/esm-node/types/config/index.js +1 -0
- package/dist/esm-node/types/config/output.js +0 -0
- package/dist/esm-node/types/config/performance.js +0 -0
- package/dist/esm-node/types/config/security.js +0 -0
- package/dist/esm-node/types/config/source.js +0 -0
- package/dist/esm-node/types/config/tools.js +0 -0
- package/dist/esm-node/types/hooks.js +0 -0
- package/dist/esm-node/types/index.js +3 -0
- package/dist/esm-node/types/legacyConfig/deploy.js +0 -0
- package/dist/esm-node/types/legacyConfig/dev.js +0 -0
- package/dist/esm-node/types/legacyConfig/index.js +0 -0
- package/dist/esm-node/types/legacyConfig/output.js +0 -0
- package/dist/esm-node/types/legacyConfig/source.js +0 -0
- package/dist/esm-node/types/legacyConfig/tools.js +0 -0
- package/dist/esm-node/types/utils.js +0 -0
- package/dist/esm-node/utils/config.js +88 -0
- package/dist/esm-node/utils/createServer.js +37 -0
- package/dist/esm-node/utils/env.js +15 -0
- package/dist/esm-node/utils/generateWatchFiles.js +33 -0
- package/dist/esm-node/utils/getSelectedEntries.js +38 -0
- package/dist/esm-node/utils/getServerInternalPlugins.js +18 -0
- package/dist/esm-node/utils/language.js +8 -0
- package/dist/esm-node/utils/printInstructions.js +11 -0
- package/dist/esm-node/utils/restart.js +22 -0
- package/dist/esm-node/utils/routes.js +10 -0
- package/dist/esm-node/utils/types.js +0 -0
- package/dist/js/modern/analyze/index.js +45 -48
- package/dist/js/modern/analyze/nestedRoutes.js +1 -10
- package/dist/js/modern/builder/builder-rspack/index.js +8 -0
- package/dist/js/modern/builder/builder-webpack/builderPlugins/compatModern.js +41 -0
- package/dist/js/modern/builder/builder-webpack/index.js +93 -0
- package/dist/js/modern/builder/{webpackPlugins/routerPlugin.js → builder-webpack/webpackPlugins/RouterPlugin.js} +1 -1
- package/dist/js/modern/builder/builder-webpack/webpackPlugins/index.js +1 -0
- package/dist/js/modern/builder/generator/createBuilderOptions.js +24 -0
- package/dist/js/modern/builder/generator/createBuilderProviderConfig.js +39 -0
- package/dist/js/modern/builder/generator/getBuilderTargets.js +12 -0
- package/dist/js/modern/builder/generator/index.js +53 -0
- package/dist/js/modern/builder/index.js +13 -133
- package/dist/js/modern/builder/{builderPlugins/compatModern.js → shared/builderPlugins/adapterModern.js} +81 -111
- package/dist/js/modern/builder/shared/bundlerPlugins/HtmlAsyncChunkPlugin.js +27 -0
- package/dist/js/modern/builder/shared/bundlerPlugins/HtmlBottomTemplate.js +34 -0
- package/dist/js/modern/builder/shared/createCopyPattern.js +46 -0
- package/dist/js/modern/builder/shared/index.js +3 -0
- package/dist/js/modern/builder/shared/loaders/serverModuleLoader.js +7 -0
- package/dist/js/modern/builder/shared/types.js +0 -0
- package/dist/js/modern/config/default.js +2 -2
- package/dist/js/modern/config/index.js +3 -8
- package/dist/js/modern/config/initialize/index.js +12 -0
- package/dist/js/modern/config/{initial → initialize}/inits.js +4 -2
- package/dist/js/modern/config/legacy/createHtmlConfig.js +35 -0
- package/dist/js/modern/config/legacy/createOutputConfig.js +68 -0
- package/dist/js/modern/config/legacy/createSourceConfig.js +39 -0
- package/dist/js/modern/config/legacy/createToolsConfig.js +42 -0
- package/dist/js/modern/config/legacy/index.js +51 -0
- package/dist/js/modern/index.js +18 -8
- package/dist/js/modern/initialize/index.js +36 -28
- package/dist/js/modern/locale/zh.js +1 -1
- package/dist/js/modern/types/utils.js +0 -0
- package/dist/js/node/analyze/index.js +46 -49
- package/dist/js/node/analyze/nestedRoutes.js +1 -10
- package/dist/js/node/builder/builder-rspack/index.js +31 -0
- package/dist/js/node/builder/builder-webpack/builderPlugins/compatModern.js +64 -0
- package/dist/js/node/builder/builder-webpack/index.js +118 -0
- package/dist/js/node/builder/{webpackPlugins/routerPlugin.js → builder-webpack/webpackPlugins/RouterPlugin.js} +7 -5
- package/dist/js/node/builder/builder-webpack/webpackPlugins/index.js +17 -0
- package/dist/js/node/builder/generator/createBuilderOptions.js +47 -0
- package/dist/js/node/builder/generator/createBuilderProviderConfig.js +60 -0
- package/dist/js/node/builder/generator/getBuilderTargets.js +35 -0
- package/dist/js/node/builder/generator/index.js +82 -0
- package/dist/js/node/builder/index.js +14 -123
- package/dist/js/node/builder/{builderPlugins/compatModern.js → shared/builderPlugins/adapterModern.js} +86 -115
- package/dist/js/node/builder/shared/bundlerPlugins/HtmlAsyncChunkPlugin.js +50 -0
- package/dist/js/node/builder/shared/bundlerPlugins/HtmlBottomTemplate.js +57 -0
- package/dist/js/node/builder/shared/createCopyPattern.js +75 -0
- package/dist/js/node/builder/shared/index.js +19 -0
- package/dist/js/node/builder/shared/loaders/serverModuleLoader.js +28 -0
- package/dist/js/node/builder/shared/types.js +15 -0
- package/dist/js/node/config/default.js +2 -2
- package/dist/js/node/config/index.js +4 -19
- package/dist/js/node/config/initialize/index.js +35 -0
- package/dist/js/node/config/{initial → initialize}/inits.js +4 -2
- package/dist/js/node/config/legacy/createHtmlConfig.js +58 -0
- package/dist/js/node/config/legacy/createOutputConfig.js +91 -0
- package/dist/js/node/config/legacy/createSourceConfig.js +62 -0
- package/dist/js/node/config/legacy/createToolsConfig.js +65 -0
- package/dist/js/node/config/legacy/index.js +75 -0
- package/dist/js/node/index.js +18 -8
- package/dist/js/node/initialize/index.js +35 -28
- package/dist/js/node/locale/zh.js +1 -1
- package/dist/js/node/types/utils.js +15 -0
- package/dist/js/treeshaking/analyze/index.js +135 -130
- package/dist/js/treeshaking/analyze/nestedRoutes.js +1 -10
- package/dist/js/treeshaking/builder/builder-rspack/index.js +6 -0
- package/dist/js/treeshaking/builder/builder-webpack/builderPlugins/compatModern.js +64 -0
- package/dist/js/treeshaking/builder/builder-webpack/index.js +301 -0
- package/dist/js/treeshaking/builder/{webpackPlugins/routerPlugin.js → builder-webpack/webpackPlugins/RouterPlugin.js} +1 -1
- package/dist/js/treeshaking/builder/builder-webpack/webpackPlugins/index.js +1 -0
- package/dist/js/treeshaking/builder/generator/createBuilderOptions.js +41 -0
- package/dist/js/treeshaking/builder/generator/createBuilderProviderConfig.js +70 -0
- package/dist/js/treeshaking/builder/generator/getBuilderTargets.js +12 -0
- package/dist/js/treeshaking/builder/generator/index.js +199 -0
- package/dist/js/treeshaking/builder/index.js +29 -228
- package/dist/js/treeshaking/builder/{builderPlugins/compatModern.js → shared/builderPlugins/adapterModern.js} +103 -156
- package/dist/js/treeshaking/builder/shared/bundlerPlugins/HtmlAsyncChunkPlugin.js +110 -0
- package/dist/js/treeshaking/builder/{webpackPlugins/htmlBottomTemplate.js → shared/bundlerPlugins/HtmlBottomTemplate.js} +0 -0
- package/dist/js/treeshaking/builder/shared/createCopyPattern.js +40 -0
- package/dist/js/treeshaking/builder/shared/index.js +3 -0
- package/dist/js/treeshaking/builder/shared/loaders/serverModuleLoader.js +5 -0
- package/dist/js/treeshaking/builder/shared/types.js +1 -0
- package/dist/js/treeshaking/config/default.js +2 -2
- package/dist/js/treeshaking/config/index.js +3 -3
- package/dist/js/treeshaking/config/initialize/index.js +10 -0
- package/dist/js/treeshaking/config/{initial → initialize}/inits.js +4 -2
- package/dist/js/treeshaking/config/{initial → legacy}/createHtmlConfig.js +0 -0
- package/dist/js/treeshaking/config/{initial → legacy}/createOutputConfig.js +0 -0
- package/dist/js/treeshaking/config/{initial → legacy}/createSourceConfig.js +0 -0
- package/dist/js/treeshaking/config/{initial → legacy}/createToolsConfig.js +0 -0
- package/dist/js/treeshaking/config/legacy/index.js +38 -0
- package/dist/js/treeshaking/index.js +19 -12
- package/dist/js/treeshaking/initialize/index.js +34 -26
- package/dist/js/treeshaking/locale/zh.js +1 -1
- package/dist/js/treeshaking/types/utils.js +1 -0
- package/dist/types/analyze/generateCode.d.ts +1 -1
- package/dist/types/analyze/getBundleEntry.d.ts +1 -1
- package/dist/types/analyze/getFileSystemEntry.d.ts +1 -1
- package/dist/types/analyze/getHtmlTemplate.d.ts +2 -2
- package/dist/types/analyze/getServerRoutes.d.ts +1 -1
- package/dist/types/analyze/index.d.ts +5 -1
- package/dist/types/analyze/templates.d.ts +3 -1
- package/dist/types/builder/builder-rspack/index.d.ts +2 -0
- package/dist/types/builder/{builderPlugins → builder-webpack/builderPlugins}/compatModern.d.ts +2 -2
- package/dist/types/builder/builder-webpack/index.d.ts +4 -0
- package/dist/types/builder/{webpackPlugins/routerPlugin.d.ts → builder-webpack/webpackPlugins/RouterPlugin.d.ts} +1 -1
- package/dist/types/builder/builder-webpack/webpackPlugins/index.d.ts +1 -0
- package/dist/types/builder/generator/createBuilderOptions.d.ts +3 -0
- package/dist/types/builder/generator/createBuilderProviderConfig.d.ts +2 -0
- package/dist/types/builder/generator/getBuilderTargets.d.ts +3 -0
- package/dist/types/builder/generator/index.d.ts +17 -0
- package/dist/types/builder/index.d.ts +1 -18
- package/dist/types/builder/shared/builderPlugins/adapterModern.d.ts +13 -0
- package/dist/types/builder/{webpackPlugins/htmlAsyncChunkPlugin.d.ts → shared/bundlerPlugins/HtmlAsyncChunkPlugin.d.ts} +2 -1
- package/dist/types/builder/{webpackPlugins/htmlBottomTemplate.d.ts → shared/bundlerPlugins/HtmlBottomTemplate.d.ts} +2 -1
- package/dist/types/builder/{share.d.ts → shared/createCopyPattern.d.ts} +1 -1
- package/dist/types/builder/shared/index.d.ts +3 -0
- package/dist/types/builder/shared/loaders/serverModuleLoader.d.ts +4 -0
- package/dist/types/builder/shared/types.d.ts +16 -0
- package/dist/types/commands/build.d.ts +1 -1
- package/dist/types/commands/deploy.d.ts +1 -1
- package/dist/types/commands/dev.d.ts +1 -1
- package/dist/types/commands/inspect.d.ts +1 -1
- package/dist/types/commands/serve.d.ts +1 -1
- package/dist/types/config/default.d.ts +1 -1
- package/dist/types/config/index.d.ts +3 -2
- package/dist/types/config/initialize/index.d.ts +2 -0
- package/dist/types/config/{initial → initialize}/inits.d.ts +3 -3
- package/dist/types/config/{initial → legacy}/createHtmlConfig.d.ts +1 -1
- package/dist/types/config/{initial → legacy}/createOutputConfig.d.ts +1 -1
- package/dist/types/config/{initial → legacy}/createSourceConfig.d.ts +1 -1
- package/dist/types/config/{initial → legacy}/createToolsConfig.d.ts +1 -1
- package/dist/types/config/legacy/index.d.ts +3 -0
- package/dist/types/defineConfig.d.ts +2 -2
- package/dist/types/index.d.ts +7 -3
- package/dist/types/initialize/index.d.ts +6 -2
- package/dist/types/types/config/deploy.d.ts +1 -2
- package/dist/types/types/config/dev.d.ts +2 -3
- package/dist/types/types/config/experiments.d.ts +1 -2
- package/dist/types/types/config/html.d.ts +5 -3
- package/dist/types/types/config/index.d.ts +41 -48
- package/dist/types/types/config/output.d.ts +8 -3
- package/dist/types/types/config/performance.d.ts +6 -3
- package/dist/types/types/config/security.d.ts +3 -3
- package/dist/types/types/config/source.d.ts +7 -3
- package/dist/types/types/config/tools.d.ts +10 -4
- package/dist/types/types/hooks.d.ts +6 -4
- package/dist/types/types/index.d.ts +19 -7
- package/dist/types/types/utils.d.ts +7 -0
- package/dist/types/utils/config.d.ts +1 -1
- package/dist/types/utils/getServerInternalPlugins.d.ts +1 -1
- package/dist/types/utils/printInstructions.d.ts +1 -1
- package/package.json +40 -32
- package/dist/js/modern/builder/webpackPlugins/htmlAsyncChunkPlugin.js +0 -30
- package/dist/js/modern/builder/webpackPlugins/htmlBottomTemplate.js +0 -37
- package/dist/js/modern/config/initial/index.js +0 -16
- package/dist/js/treeshaking/config/initial/index.js +0 -12
- package/dist/types/builder/loaders/serverModuleLoader.d.ts +0 -3
- package/dist/types/config/initial/index.d.ts +0 -4
- package/dist/types/config/initial/transformNormalizedConfig.d.ts +0 -2
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var createOutputConfig_exports = {};
|
|
19
|
+
__export(createOutputConfig_exports, {
|
|
20
|
+
createOutputConfig: () => createOutputConfig
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(createOutputConfig_exports);
|
|
23
|
+
function createOutputConfig(config) {
|
|
24
|
+
const {
|
|
25
|
+
assetPrefix,
|
|
26
|
+
copy,
|
|
27
|
+
cssModuleLocalIdentName,
|
|
28
|
+
cssPath,
|
|
29
|
+
jsPath,
|
|
30
|
+
htmlPath,
|
|
31
|
+
mediaPath,
|
|
32
|
+
enableTsLoader,
|
|
33
|
+
path,
|
|
34
|
+
disableInlineRuntimeChunk,
|
|
35
|
+
disableCssExtract,
|
|
36
|
+
disableMinimize,
|
|
37
|
+
disableSourceMap,
|
|
38
|
+
disableTsChecker,
|
|
39
|
+
enableCssModuleTSDeclaration,
|
|
40
|
+
enableInlineScripts,
|
|
41
|
+
enableInlineStyles,
|
|
42
|
+
polyfill,
|
|
43
|
+
dataUriLimit,
|
|
44
|
+
disableAssetsCache,
|
|
45
|
+
enableLatestDecorators,
|
|
46
|
+
disableCssModuleExtension,
|
|
47
|
+
ssg,
|
|
48
|
+
disableNodePolyfill
|
|
49
|
+
} = config.output;
|
|
50
|
+
return {
|
|
51
|
+
assetPrefix,
|
|
52
|
+
copy,
|
|
53
|
+
distPath: {
|
|
54
|
+
root: path,
|
|
55
|
+
css: cssPath,
|
|
56
|
+
js: jsPath,
|
|
57
|
+
html: htmlPath,
|
|
58
|
+
svg: mediaPath || "media",
|
|
59
|
+
image: mediaPath || "media",
|
|
60
|
+
font: mediaPath || "media",
|
|
61
|
+
media: mediaPath || "media"
|
|
62
|
+
},
|
|
63
|
+
dataUriLimit: {
|
|
64
|
+
svg: dataUriLimit,
|
|
65
|
+
image: dataUriLimit,
|
|
66
|
+
font: dataUriLimit,
|
|
67
|
+
media: dataUriLimit
|
|
68
|
+
},
|
|
69
|
+
cssModuleLocalIdentName,
|
|
70
|
+
disableCssExtract,
|
|
71
|
+
disableCssModuleExtension,
|
|
72
|
+
disableInlineRuntimeChunk,
|
|
73
|
+
disableMinimize,
|
|
74
|
+
disableSourceMap,
|
|
75
|
+
disableTsChecker: disableTsChecker || enableTsLoader,
|
|
76
|
+
enableCssModuleTSDeclaration,
|
|
77
|
+
enableInlineScripts,
|
|
78
|
+
enableInlineStyles,
|
|
79
|
+
polyfill,
|
|
80
|
+
disableFilenameHash: disableAssetsCache,
|
|
81
|
+
enableLatestDecorators,
|
|
82
|
+
ssg,
|
|
83
|
+
enableAssetFallback: true,
|
|
84
|
+
enableAssetManifest: true,
|
|
85
|
+
disableNodePolyfill
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
89
|
+
0 && (module.exports = {
|
|
90
|
+
createOutputConfig
|
|
91
|
+
});
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var createSourceConfig_exports = {};
|
|
19
|
+
__export(createSourceConfig_exports, {
|
|
20
|
+
createSourceConfig: () => createSourceConfig
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(createSourceConfig_exports);
|
|
23
|
+
function createSourceConfig(config) {
|
|
24
|
+
const {
|
|
25
|
+
alias,
|
|
26
|
+
envVars,
|
|
27
|
+
globalVars,
|
|
28
|
+
include,
|
|
29
|
+
moduleScopes,
|
|
30
|
+
preEntry,
|
|
31
|
+
entries,
|
|
32
|
+
enableAsyncEntry,
|
|
33
|
+
disableDefaultEntries,
|
|
34
|
+
entriesDir,
|
|
35
|
+
configDir
|
|
36
|
+
} = config.source;
|
|
37
|
+
const builderGlobalVars = globalVars || {};
|
|
38
|
+
for (const envVar of envVars || []) {
|
|
39
|
+
const envVarValue = process.env[envVar];
|
|
40
|
+
envVarValue && (builderGlobalVars[`process.env.${envVar}`] = envVarValue);
|
|
41
|
+
}
|
|
42
|
+
return {
|
|
43
|
+
alias,
|
|
44
|
+
moduleScopes,
|
|
45
|
+
globalVars: builderGlobalVars,
|
|
46
|
+
include,
|
|
47
|
+
preEntry,
|
|
48
|
+
entries,
|
|
49
|
+
enableAsyncEntry,
|
|
50
|
+
disableDefaultEntries,
|
|
51
|
+
entriesDir,
|
|
52
|
+
configDir,
|
|
53
|
+
resolveExtensionPrefix: {
|
|
54
|
+
web: ".web",
|
|
55
|
+
node: ".node"
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
60
|
+
0 && (module.exports = {
|
|
61
|
+
createSourceConfig
|
|
62
|
+
});
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var createToolsConfig_exports = {};
|
|
19
|
+
__export(createToolsConfig_exports, {
|
|
20
|
+
createToolsConfig: () => createToolsConfig
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(createToolsConfig_exports);
|
|
23
|
+
function createToolsConfig(config) {
|
|
24
|
+
const {
|
|
25
|
+
autoprefixer,
|
|
26
|
+
babel,
|
|
27
|
+
minifyCss,
|
|
28
|
+
terser,
|
|
29
|
+
webpack,
|
|
30
|
+
webpackChain,
|
|
31
|
+
tsLoader,
|
|
32
|
+
styledComponents,
|
|
33
|
+
sass,
|
|
34
|
+
postcss,
|
|
35
|
+
less,
|
|
36
|
+
htmlPlugin,
|
|
37
|
+
devServer,
|
|
38
|
+
tailwindcss,
|
|
39
|
+
jest,
|
|
40
|
+
esbuild
|
|
41
|
+
} = config.tools;
|
|
42
|
+
const { enableTsLoader } = config.output;
|
|
43
|
+
return {
|
|
44
|
+
tsLoader: enableTsLoader ? tsLoader : void 0,
|
|
45
|
+
autoprefixer,
|
|
46
|
+
babel,
|
|
47
|
+
minifyCss,
|
|
48
|
+
terser,
|
|
49
|
+
webpack,
|
|
50
|
+
webpackChain,
|
|
51
|
+
styledComponents,
|
|
52
|
+
sass,
|
|
53
|
+
postcss,
|
|
54
|
+
less,
|
|
55
|
+
htmlPlugin,
|
|
56
|
+
devServer,
|
|
57
|
+
tailwindcss,
|
|
58
|
+
jest,
|
|
59
|
+
esbuild
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
63
|
+
0 && (module.exports = {
|
|
64
|
+
createToolsConfig
|
|
65
|
+
});
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var legacy_exports = {};
|
|
19
|
+
__export(legacy_exports, {
|
|
20
|
+
checkIsLegacyConfig: () => checkIsLegacyConfig,
|
|
21
|
+
transformNormalizedConfig: () => transformNormalizedConfig
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(legacy_exports);
|
|
24
|
+
var import_createToolsConfig = require("./createToolsConfig");
|
|
25
|
+
var import_createSourceConfig = require("./createSourceConfig");
|
|
26
|
+
var import_createOutputConfig = require("./createOutputConfig");
|
|
27
|
+
var import_createHtmlConfig = require("./createHtmlConfig");
|
|
28
|
+
function transformNormalizedConfig(config) {
|
|
29
|
+
const html = (0, import_createHtmlConfig.createHtmlConfig)(config);
|
|
30
|
+
const output = (0, import_createOutputConfig.createOutputConfig)(config);
|
|
31
|
+
const source = (0, import_createSourceConfig.createSourceConfig)(config);
|
|
32
|
+
const tools = (0, import_createToolsConfig.createToolsConfig)(config);
|
|
33
|
+
const {
|
|
34
|
+
bff,
|
|
35
|
+
dev,
|
|
36
|
+
deploy,
|
|
37
|
+
runtime,
|
|
38
|
+
runtimeByEntries,
|
|
39
|
+
server,
|
|
40
|
+
cliOptions,
|
|
41
|
+
plugins,
|
|
42
|
+
testing
|
|
43
|
+
} = config;
|
|
44
|
+
return {
|
|
45
|
+
source,
|
|
46
|
+
html,
|
|
47
|
+
output,
|
|
48
|
+
tools,
|
|
49
|
+
bff,
|
|
50
|
+
dev,
|
|
51
|
+
deploy,
|
|
52
|
+
runtime,
|
|
53
|
+
runtimeByEntries,
|
|
54
|
+
server,
|
|
55
|
+
cliOptions,
|
|
56
|
+
testing,
|
|
57
|
+
builderPlugins: [],
|
|
58
|
+
plugins,
|
|
59
|
+
security: {},
|
|
60
|
+
_raw: {},
|
|
61
|
+
experiments: {},
|
|
62
|
+
autoLoadPlugins: true,
|
|
63
|
+
performance: {
|
|
64
|
+
removeMomentLocale: true
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
function checkIsLegacyConfig(config) {
|
|
69
|
+
return Boolean(config.legacy);
|
|
70
|
+
}
|
|
71
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
72
|
+
0 && (module.exports = {
|
|
73
|
+
checkIsLegacyConfig,
|
|
74
|
+
transformNormalizedConfig
|
|
75
|
+
});
|
package/dist/js/node/index.js
CHANGED
|
@@ -127,7 +127,9 @@ const buildCommand = (program, api) => __async(void 0, null, function* () {
|
|
|
127
127
|
}
|
|
128
128
|
}
|
|
129
129
|
});
|
|
130
|
-
var src_default = (
|
|
130
|
+
var src_default = (options = {
|
|
131
|
+
bundler: "webpack"
|
|
132
|
+
}) => ({
|
|
131
133
|
name: "@modern-js/app-tools",
|
|
132
134
|
post: [
|
|
133
135
|
"@modern-js/plugin-initialize",
|
|
@@ -140,7 +142,15 @@ var src_default = () => ({
|
|
|
140
142
|
"@modern-js/plugin-polyfill"
|
|
141
143
|
],
|
|
142
144
|
registerHook: import_hooks.hooks,
|
|
143
|
-
usePlugins: [
|
|
145
|
+
usePlugins: [
|
|
146
|
+
(0, import_initialize.default)({
|
|
147
|
+
bundler: (options == null ? void 0 : options.bundler) === "experimental-rspack" ? "rspack" : "webpack"
|
|
148
|
+
}),
|
|
149
|
+
(0, import_analyze.default)({
|
|
150
|
+
bundler: (options == null ? void 0 : options.bundler) === "experimental-rspack" ? "rspack" : "webpack"
|
|
151
|
+
}),
|
|
152
|
+
(0, import_plugin_lint.default)()
|
|
153
|
+
],
|
|
144
154
|
setup: (api) => {
|
|
145
155
|
const locale = (0, import_language.getLocaleLanguage)();
|
|
146
156
|
import_locale.i18n.changeLanguage({ locale });
|
|
@@ -159,19 +169,19 @@ var src_default = () => ({
|
|
|
159
169
|
program.command("deploy").usage("[options]").option(
|
|
160
170
|
"-c --config <config>",
|
|
161
171
|
import_locale.i18n.t(import_locale.localeKeys.command.shared.config)
|
|
162
|
-
).description(import_locale.i18n.t(import_locale.localeKeys.command.deploy.describe)).action((
|
|
172
|
+
).description(import_locale.i18n.t(import_locale.localeKeys.command.deploy.describe)).action((options2) => __async(this, null, function* () {
|
|
163
173
|
const { build } = yield Promise.resolve().then(() => __toESM(require("./commands/build")));
|
|
164
174
|
yield build(api);
|
|
165
175
|
const { deploy } = yield Promise.resolve().then(() => __toESM(require("./commands/deploy")));
|
|
166
|
-
yield deploy(api,
|
|
176
|
+
yield deploy(api, options2);
|
|
167
177
|
process.exit(0);
|
|
168
178
|
}));
|
|
169
179
|
program.command("new").usage("[options]").description(import_locale.i18n.t(import_locale.localeKeys.command.new.describe)).option("--lang <lang>", import_locale.i18n.t(import_locale.localeKeys.command.new.lang)).option("-d, --debug", import_locale.i18n.t(import_locale.localeKeys.command.new.debug), false).option(
|
|
170
180
|
"-c, --config <config>",
|
|
171
181
|
import_locale.i18n.t(import_locale.localeKeys.command.new.config)
|
|
172
|
-
).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)).action((
|
|
182
|
+
).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)).action((options2) => __async(this, null, function* () {
|
|
173
183
|
const { MWANewAction } = yield Promise.resolve().then(() => __toESM(require("@modern-js/new-action")));
|
|
174
|
-
yield MWANewAction(__spreadProps(__spreadValues({},
|
|
184
|
+
yield MWANewAction(__spreadProps(__spreadValues({}, options2), { locale: options2.lang || locale }));
|
|
175
185
|
}));
|
|
176
186
|
program.command("inspect").description("inspect internal webpack config").option(
|
|
177
187
|
`--env <env>`,
|
|
@@ -184,9 +194,9 @@ var src_default = () => ({
|
|
|
184
194
|
).option("--verbose", import_locale.i18n.t(import_locale.localeKeys.command.inspect.verbose)).option(
|
|
185
195
|
"-c --config <config>",
|
|
186
196
|
import_locale.i18n.t(import_locale.localeKeys.command.shared.config)
|
|
187
|
-
).action((
|
|
197
|
+
).action((options2) => __async(this, null, function* () {
|
|
188
198
|
const { inspect } = yield Promise.resolve().then(() => __toESM(require("./commands/inspect")));
|
|
189
|
-
inspect(api,
|
|
199
|
+
inspect(api, options2);
|
|
190
200
|
}));
|
|
191
201
|
upgradeModel.defineCommand(program.command("upgrade"));
|
|
192
202
|
});
|
|
@@ -59,15 +59,16 @@ __export(initialize_exports, {
|
|
|
59
59
|
module.exports = __toCommonJS(initialize_exports);
|
|
60
60
|
var import_utils = require("@modern-js/utils");
|
|
61
61
|
var import_schema = require("../schema");
|
|
62
|
-
var import_transformNormalizedConfig = require("../config/initial/transformNormalizedConfig");
|
|
63
62
|
var import_config = require("../config");
|
|
64
|
-
var initialize_default = (
|
|
63
|
+
var initialize_default = ({
|
|
64
|
+
bundler
|
|
65
|
+
}) => ({
|
|
65
66
|
name: "@modern-js/plugin-initialize",
|
|
66
67
|
setup(api) {
|
|
67
68
|
const config = () => {
|
|
68
69
|
const appContext = api.useAppContext();
|
|
69
70
|
const userConfig = api.useConfigContext();
|
|
70
|
-
return (0, import_config.checkIsLegacyConfig)(userConfig) ? (0, import_config.createLegacyDefaultConfig)(appContext) : (0, import_config.createDefaultConfig)(appContext);
|
|
71
|
+
return (0, import_config.checkIsLegacyConfig)(userConfig) ? (0, import_config.createLegacyDefaultConfig)(appContext) : (0, import_config.createDefaultConfig)(appContext, bundler);
|
|
71
72
|
};
|
|
72
73
|
const validateSchema = () => {
|
|
73
74
|
const userConfig = api.useConfigContext();
|
|
@@ -91,36 +92,42 @@ var initialize_default = () => ({
|
|
|
91
92
|
)
|
|
92
93
|
});
|
|
93
94
|
api.setAppContext(appContext);
|
|
94
|
-
const normalizedConfig = (0, import_config.checkIsLegacyConfig)(resolved) ? (0,
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
}
|
|
95
|
+
const normalizedConfig = (0, import_config.checkIsLegacyConfig)(resolved) ? (0, import_config.transformNormalizedConfig)(resolved) : resolved;
|
|
96
|
+
resolved._raw = userConfig;
|
|
97
|
+
resolved.server = __spreadProps(__spreadValues({}, normalizedConfig.server || {}), {
|
|
98
|
+
port
|
|
99
|
+
});
|
|
100
|
+
resolved.autoLoadPlugins = normalizedConfig.autoLoadPlugins || false;
|
|
101
|
+
stabilizeConfig(resolved, normalizedConfig, [
|
|
102
|
+
"source",
|
|
103
|
+
"bff",
|
|
104
|
+
"dev",
|
|
105
|
+
"html",
|
|
106
|
+
"output",
|
|
107
|
+
"tools",
|
|
108
|
+
"testing",
|
|
109
|
+
"plugins",
|
|
110
|
+
"builderPlugins",
|
|
111
|
+
"runtime",
|
|
112
|
+
"runtimeByEntries",
|
|
113
|
+
"deploy",
|
|
114
|
+
"performance"
|
|
115
|
+
]);
|
|
116
|
+
if (bundler === "webpack") {
|
|
117
|
+
resolved.security = normalizedConfig.security || {};
|
|
118
|
+
resolved.experiments = normalizedConfig.experiments;
|
|
119
|
+
}
|
|
120
|
+
return { resolved };
|
|
119
121
|
});
|
|
120
122
|
}
|
|
121
123
|
};
|
|
122
124
|
}
|
|
123
125
|
});
|
|
126
|
+
function stabilizeConfig(resolve, config, keys) {
|
|
127
|
+
keys.forEach((key) => {
|
|
128
|
+
resolve[key] = config[key] || {};
|
|
129
|
+
});
|
|
130
|
+
}
|
|
124
131
|
function getServerPort(config) {
|
|
125
132
|
return __async(this, null, function* () {
|
|
126
133
|
const prodPort = config.server.port || 8080;
|
|
@@ -39,7 +39,7 @@ const ZH_LOCALE = {
|
|
|
39
39
|
serve: { describe: "应用启动命令" },
|
|
40
40
|
deploy: { describe: "部署应用命令" },
|
|
41
41
|
new: {
|
|
42
|
-
describe: "
|
|
42
|
+
describe: "Web App 项目中执行生成器",
|
|
43
43
|
debug: "开启 Debug 模式,打印调试日志信息",
|
|
44
44
|
config: "生成器运行默认配置(JSON 字符串)",
|
|
45
45
|
distTag: "生成器使用特殊的 npm Tag 版本",
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __copyProps = (to, from, except, desc) => {
|
|
6
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
7
|
+
for (let key of __getOwnPropNames(from))
|
|
8
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
9
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
10
|
+
}
|
|
11
|
+
return to;
|
|
12
|
+
};
|
|
13
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
14
|
+
var utils_exports = {};
|
|
15
|
+
module.exports = __toCommonJS(utils_exports);
|