@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,63 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
21
|
+
mod
|
|
22
|
+
));
|
|
23
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
24
|
+
var serve_exports = {};
|
|
25
|
+
__export(serve_exports, {
|
|
26
|
+
start: () => start
|
|
27
|
+
});
|
|
28
|
+
module.exports = __toCommonJS(serve_exports);
|
|
29
|
+
var import_utils = require("@modern-js/utils");
|
|
30
|
+
var import_prod_server = __toESM(require("@modern-js/prod-server"));
|
|
31
|
+
var import_printInstructions = require("../utils/printInstructions");
|
|
32
|
+
var import_createServer = require("../utils/createServer");
|
|
33
|
+
var import_getServerInternalPlugins = require("../utils/getServerInternalPlugins");
|
|
34
|
+
const start = async (api) => {
|
|
35
|
+
var _a;
|
|
36
|
+
const appContext = api.useAppContext();
|
|
37
|
+
const userConfig = api.useResolvedConfigContext();
|
|
38
|
+
const hookRunners = api.useHookRunners();
|
|
39
|
+
const { appDirectory, port, serverConfigFile } = appContext;
|
|
40
|
+
import_utils.logger.log(import_utils.chalk.cyan(`Starting the modern server...`));
|
|
41
|
+
const apiOnly = await (0, import_utils.isApiOnly)(
|
|
42
|
+
appContext.appDirectory,
|
|
43
|
+
(_a = userConfig == null ? void 0 : userConfig.source) == null ? void 0 : _a.entriesDir
|
|
44
|
+
);
|
|
45
|
+
const serverInternalPlugins = await (0, import_getServerInternalPlugins.getServerInternalPlugins)(api);
|
|
46
|
+
const app = await (0, import_prod_server.default)({
|
|
47
|
+
pwd: appDirectory,
|
|
48
|
+
config: userConfig,
|
|
49
|
+
serverConfigFile,
|
|
50
|
+
internalPlugins: (0, import_createServer.injectDataLoaderPlugin)(serverInternalPlugins),
|
|
51
|
+
apiOnly
|
|
52
|
+
});
|
|
53
|
+
app.listen(port, async (err) => {
|
|
54
|
+
if (err) {
|
|
55
|
+
throw err;
|
|
56
|
+
}
|
|
57
|
+
await (0, import_printInstructions.printInstructions)(hookRunners, appContext, userConfig);
|
|
58
|
+
});
|
|
59
|
+
};
|
|
60
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
61
|
+
0 && (module.exports = {
|
|
62
|
+
start
|
|
63
|
+
});
|
|
@@ -0,0 +1,186 @@
|
|
|
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 default_exports = {};
|
|
19
|
+
__export(default_exports, {
|
|
20
|
+
createDefaultConfig: () => createDefaultConfig,
|
|
21
|
+
createLegacyDefaultConfig: () => createLegacyDefaultConfig
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(default_exports);
|
|
24
|
+
var import_builder_webpack_provider = require("@modern-js/builder-webpack-provider");
|
|
25
|
+
function createDefaultConfig(appContext, bundler) {
|
|
26
|
+
const defaultBuilderConfig = (0, import_builder_webpack_provider.createDefaultConfig)();
|
|
27
|
+
const dev = {
|
|
28
|
+
...defaultBuilderConfig.dev,
|
|
29
|
+
port: void 0
|
|
30
|
+
};
|
|
31
|
+
const output = {
|
|
32
|
+
...defaultBuilderConfig.output,
|
|
33
|
+
disableNodePolyfill: true
|
|
34
|
+
};
|
|
35
|
+
const source = {
|
|
36
|
+
...defaultBuilderConfig.source,
|
|
37
|
+
entries: void 0,
|
|
38
|
+
enableAsyncEntry: false,
|
|
39
|
+
disableDefaultEntries: false,
|
|
40
|
+
entriesDir: "./src",
|
|
41
|
+
configDir: "./config",
|
|
42
|
+
alias: {
|
|
43
|
+
[appContext.internalDirAlias]: appContext.internalDirectory,
|
|
44
|
+
[appContext.internalSrcAlias]: appContext.srcDirectory,
|
|
45
|
+
"@": appContext.srcDirectory,
|
|
46
|
+
"@shared": appContext.sharedDirectory
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
const html = {
|
|
50
|
+
...defaultBuilderConfig.html,
|
|
51
|
+
title: "",
|
|
52
|
+
meta: {
|
|
53
|
+
charset: { charset: "utf-8" },
|
|
54
|
+
viewport: "width=device-width, initial-scale=1.0, shrink-to-fit=no, viewport-fit=cover, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no",
|
|
55
|
+
"http-equiv": { "http-equiv": "x-ua-compatible", content: "ie=edge" },
|
|
56
|
+
renderer: "webkit",
|
|
57
|
+
layoutmode: "standard",
|
|
58
|
+
imagemode: "force",
|
|
59
|
+
"wap-font-scale": "no",
|
|
60
|
+
"format-detection": "telephone=no"
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
const server = {
|
|
64
|
+
routes: void 0,
|
|
65
|
+
publicRoutes: void 0,
|
|
66
|
+
ssr: void 0,
|
|
67
|
+
ssrByEntries: void 0,
|
|
68
|
+
baseUrl: "/",
|
|
69
|
+
port: 8080
|
|
70
|
+
};
|
|
71
|
+
const tools = bundler === "webpack" ? {
|
|
72
|
+
...defaultBuilderConfig.tools
|
|
73
|
+
} : void 0;
|
|
74
|
+
return {
|
|
75
|
+
source,
|
|
76
|
+
output,
|
|
77
|
+
server,
|
|
78
|
+
dev,
|
|
79
|
+
html,
|
|
80
|
+
tools,
|
|
81
|
+
plugins: [],
|
|
82
|
+
builderPlugins: [],
|
|
83
|
+
runtime: {},
|
|
84
|
+
runtimeByEntries: {}
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
function createLegacyDefaultConfig(appContext) {
|
|
88
|
+
const defaultAlias = appContext ? {
|
|
89
|
+
[appContext.internalDirAlias]: appContext.internalDirectory,
|
|
90
|
+
[appContext.internalSrcAlias]: appContext.srcDirectory,
|
|
91
|
+
"@": appContext.srcDirectory,
|
|
92
|
+
"@shared": appContext.sharedDirectory
|
|
93
|
+
} : {};
|
|
94
|
+
const sourceDefaults = {
|
|
95
|
+
entries: void 0,
|
|
96
|
+
enableAsyncEntry: false,
|
|
97
|
+
disableDefaultEntries: false,
|
|
98
|
+
entriesDir: "./src",
|
|
99
|
+
configDir: "./config",
|
|
100
|
+
apiDir: "./api",
|
|
101
|
+
envVars: [],
|
|
102
|
+
globalVars: void 0,
|
|
103
|
+
alias: defaultAlias,
|
|
104
|
+
moduleScopes: void 0,
|
|
105
|
+
include: []
|
|
106
|
+
};
|
|
107
|
+
const outputDefaults = {
|
|
108
|
+
assetPrefix: "/",
|
|
109
|
+
htmlPath: "html",
|
|
110
|
+
jsPath: "static/js",
|
|
111
|
+
cssPath: "static/css",
|
|
112
|
+
mediaPath: "static/media",
|
|
113
|
+
path: "dist",
|
|
114
|
+
title: "",
|
|
115
|
+
titleByEntries: void 0,
|
|
116
|
+
meta: {
|
|
117
|
+
charset: { charset: "utf-8" },
|
|
118
|
+
viewport: "width=device-width, initial-scale=1.0, shrink-to-fit=no, viewport-fit=cover, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no",
|
|
119
|
+
"http-equiv": { "http-equiv": "x-ua-compatible", content: "ie=edge" },
|
|
120
|
+
renderer: "webkit",
|
|
121
|
+
layoutmode: "standard",
|
|
122
|
+
imagemode: "force",
|
|
123
|
+
"wap-font-scale": "no",
|
|
124
|
+
"format-detection": "telephone=no"
|
|
125
|
+
},
|
|
126
|
+
metaByEntries: void 0,
|
|
127
|
+
inject: "head",
|
|
128
|
+
injectByEntries: void 0,
|
|
129
|
+
mountId: "root",
|
|
130
|
+
favicon: "",
|
|
131
|
+
faviconByEntries: void 0,
|
|
132
|
+
copy: void 0,
|
|
133
|
+
disableHtmlFolder: false,
|
|
134
|
+
disableCssModuleExtension: false,
|
|
135
|
+
disableCssExtract: false,
|
|
136
|
+
enableCssModuleTSDeclaration: false,
|
|
137
|
+
disableMinimize: false,
|
|
138
|
+
enableInlineStyles: false,
|
|
139
|
+
enableInlineScripts: false,
|
|
140
|
+
disableSourceMap: false,
|
|
141
|
+
disableInlineRuntimeChunk: false,
|
|
142
|
+
disableAssetsCache: false,
|
|
143
|
+
enableLatestDecorators: false,
|
|
144
|
+
polyfill: "entry",
|
|
145
|
+
dataUriLimit: 1e4,
|
|
146
|
+
templateParameters: {},
|
|
147
|
+
templateParametersByEntries: void 0,
|
|
148
|
+
cssModuleLocalIdentName: void 0,
|
|
149
|
+
disableNodePolyfill: false,
|
|
150
|
+
enableTsLoader: false
|
|
151
|
+
};
|
|
152
|
+
const serverDefaults = {
|
|
153
|
+
routes: void 0,
|
|
154
|
+
publicRoutes: void 0,
|
|
155
|
+
ssr: void 0,
|
|
156
|
+
ssrByEntries: void 0,
|
|
157
|
+
baseUrl: "/",
|
|
158
|
+
port: 8080
|
|
159
|
+
};
|
|
160
|
+
const devDefaults = { assetPrefix: false, https: false };
|
|
161
|
+
const toolsDefaults = {
|
|
162
|
+
webpack: void 0,
|
|
163
|
+
babel: void 0,
|
|
164
|
+
postcss: void 0,
|
|
165
|
+
autoprefixer: void 0,
|
|
166
|
+
lodash: void 0,
|
|
167
|
+
devServer: void 0,
|
|
168
|
+
tsLoader: void 0,
|
|
169
|
+
terser: void 0,
|
|
170
|
+
minifyCss: void 0
|
|
171
|
+
};
|
|
172
|
+
return {
|
|
173
|
+
source: sourceDefaults,
|
|
174
|
+
output: outputDefaults,
|
|
175
|
+
server: serverDefaults,
|
|
176
|
+
dev: devDefaults,
|
|
177
|
+
tools: toolsDefaults,
|
|
178
|
+
runtime: {},
|
|
179
|
+
runtimeByEntries: {}
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
183
|
+
0 && (module.exports = {
|
|
184
|
+
createDefaultConfig,
|
|
185
|
+
createLegacyDefaultConfig
|
|
186
|
+
});
|
|
@@ -0,0 +1,19 @@
|
|
|
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 __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
+
var config_exports = {};
|
|
16
|
+
module.exports = __toCommonJS(config_exports);
|
|
17
|
+
__reExport(config_exports, require("./legacy"), module.exports);
|
|
18
|
+
__reExport(config_exports, require("./initialize"), module.exports);
|
|
19
|
+
__reExport(config_exports, require("./default"), module.exports);
|
|
@@ -15,27 +15,21 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
15
15
|
return to;
|
|
16
16
|
};
|
|
17
17
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
-
var
|
|
19
|
-
__export(
|
|
20
|
-
|
|
21
|
-
initialNormalizedConfig: () => initialNormalizedConfig,
|
|
22
|
-
transformNormalizedConfig: () => import_transformNormalizedConfig.transformNormalizedConfig
|
|
18
|
+
var initialize_exports = {};
|
|
19
|
+
__export(initialize_exports, {
|
|
20
|
+
initialNormalizedConfig: () => initialNormalizedConfig
|
|
23
21
|
});
|
|
24
|
-
module.exports = __toCommonJS(
|
|
22
|
+
module.exports = __toCommonJS(initialize_exports);
|
|
25
23
|
var import_inits = require("./inits");
|
|
26
|
-
|
|
27
|
-
function checkIsLegacyConfig(config) {
|
|
28
|
-
return Boolean(config.legacy);
|
|
29
|
-
}
|
|
30
|
-
function initialNormalizedConfig(config, appContext) {
|
|
24
|
+
function initialNormalizedConfig(config, appContext, bundler) {
|
|
31
25
|
(0, import_inits.initHtmlConfig)(config, appContext);
|
|
32
|
-
(0, import_inits.initSourceConfig)(config, appContext);
|
|
33
|
-
(
|
|
26
|
+
(0, import_inits.initSourceConfig)(config, appContext, bundler);
|
|
27
|
+
if (bundler === "webpack") {
|
|
28
|
+
(0, import_inits.initToolsConfig)(config);
|
|
29
|
+
}
|
|
34
30
|
return config;
|
|
35
31
|
}
|
|
36
32
|
// Annotate the CommonJS export names for ESM import in node:
|
|
37
33
|
0 && (module.exports = {
|
|
38
|
-
|
|
39
|
-
initialNormalizedConfig,
|
|
40
|
-
transformNormalizedConfig
|
|
34
|
+
initialNormalizedConfig
|
|
41
35
|
});
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
21
|
+
mod
|
|
22
|
+
));
|
|
23
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
24
|
+
var inits_exports = {};
|
|
25
|
+
__export(inits_exports, {
|
|
26
|
+
initHtmlConfig: () => initHtmlConfig,
|
|
27
|
+
initSourceConfig: () => initSourceConfig,
|
|
28
|
+
initToolsConfig: () => initToolsConfig
|
|
29
|
+
});
|
|
30
|
+
module.exports = __toCommonJS(inits_exports);
|
|
31
|
+
var import_path = __toESM(require("path"));
|
|
32
|
+
var import_utils = require("@modern-js/utils");
|
|
33
|
+
var import_env = require("../../utils/env");
|
|
34
|
+
function initHtmlConfig(config, appContext) {
|
|
35
|
+
const ICON_EXTENSIONS = ["png", "jpg", "jpeg", "svg", "ico"];
|
|
36
|
+
config.html.appIcon = createBuilderAppIcon(config, appContext);
|
|
37
|
+
config.html.favicon = createBuilderFavicon(config, appContext);
|
|
38
|
+
return config.html;
|
|
39
|
+
function createBuilderAppIcon(config2, appContext2) {
|
|
40
|
+
const { configDir } = config2.source;
|
|
41
|
+
const appIcon = (0, import_utils.findExists)(
|
|
42
|
+
ICON_EXTENSIONS.map(
|
|
43
|
+
(ext) => import_path.default.resolve(
|
|
44
|
+
appContext2.appDirectory,
|
|
45
|
+
configDir || "./config",
|
|
46
|
+
`icon.${ext}`
|
|
47
|
+
)
|
|
48
|
+
)
|
|
49
|
+
);
|
|
50
|
+
return typeof appIcon === "string" ? appIcon : void 0;
|
|
51
|
+
}
|
|
52
|
+
function createBuilderFavicon(config2, appContext2) {
|
|
53
|
+
const { configDir } = config2.source;
|
|
54
|
+
const { favicon } = config2.html;
|
|
55
|
+
const defaultFavicon = (0, import_utils.findExists)(
|
|
56
|
+
ICON_EXTENSIONS.map(
|
|
57
|
+
(ext) => import_path.default.resolve(
|
|
58
|
+
appContext2.appDirectory,
|
|
59
|
+
configDir || "./config",
|
|
60
|
+
`favicon.${ext}`
|
|
61
|
+
)
|
|
62
|
+
)
|
|
63
|
+
);
|
|
64
|
+
return favicon || defaultFavicon || void 0;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
function initSourceConfig(config, appContext, bundler) {
|
|
68
|
+
config.source.include = createBuilderInclude(config, appContext);
|
|
69
|
+
config.source.globalVars = createBuilderGlobalVars(config, appContext);
|
|
70
|
+
if (bundler === "webpack") {
|
|
71
|
+
config.source.moduleScopes = createBuilderModuleScope(config);
|
|
72
|
+
}
|
|
73
|
+
function createBuilderGlobalVars(config2, appContext2) {
|
|
74
|
+
const { globalVars = {} } = config2.source;
|
|
75
|
+
const publicEnv = (0, import_env.getAutoInjectEnv)(appContext2);
|
|
76
|
+
return { ...globalVars, ...publicEnv };
|
|
77
|
+
}
|
|
78
|
+
function createBuilderInclude(config2, appContext2) {
|
|
79
|
+
const { include } = config2.source;
|
|
80
|
+
const defaultInclude = [appContext2.internalDirectory];
|
|
81
|
+
const transformInclude = (include || []).map((include2) => {
|
|
82
|
+
if (typeof include2 === "string") {
|
|
83
|
+
if ((0, import_path.isAbsolute)(include2)) {
|
|
84
|
+
return include2;
|
|
85
|
+
}
|
|
86
|
+
return new RegExp(include2);
|
|
87
|
+
}
|
|
88
|
+
return include2;
|
|
89
|
+
}).concat(defaultInclude);
|
|
90
|
+
const root = (0, import_utils.findMonorepoRoot)(appContext2.appDirectory);
|
|
91
|
+
if (!root) {
|
|
92
|
+
return transformInclude;
|
|
93
|
+
}
|
|
94
|
+
const modernjsMonorepo = (0, import_utils.isModernjsMonorepo)(root);
|
|
95
|
+
if (modernjsMonorepo) {
|
|
96
|
+
const paths = import_utils.globby.sync(import_path.posix.join(root, "features", "**", "package.json"), {
|
|
97
|
+
ignore: ["**/node_modules/**/*"]
|
|
98
|
+
}).map((pathname) => (0, import_path.dirname)(pathname) + import_path.sep);
|
|
99
|
+
return [...paths, ...transformInclude];
|
|
100
|
+
}
|
|
101
|
+
return transformInclude;
|
|
102
|
+
}
|
|
103
|
+
function createBuilderModuleScope(config2) {
|
|
104
|
+
const { moduleScopes } = config2.source;
|
|
105
|
+
if (moduleScopes) {
|
|
106
|
+
let builderModuleScope = [];
|
|
107
|
+
const DEFAULT_SCOPES = [
|
|
108
|
+
"./src",
|
|
109
|
+
"./shared",
|
|
110
|
+
/node_modules/
|
|
111
|
+
];
|
|
112
|
+
if (Array.isArray(moduleScopes)) {
|
|
113
|
+
if (isPrimitiveScope(moduleScopes)) {
|
|
114
|
+
builderModuleScope = DEFAULT_SCOPES.concat(moduleScopes);
|
|
115
|
+
} else {
|
|
116
|
+
builderModuleScope = [DEFAULT_SCOPES, ...moduleScopes];
|
|
117
|
+
}
|
|
118
|
+
} else {
|
|
119
|
+
builderModuleScope = [DEFAULT_SCOPES, moduleScopes];
|
|
120
|
+
}
|
|
121
|
+
return builderModuleScope;
|
|
122
|
+
} else {
|
|
123
|
+
return void 0;
|
|
124
|
+
}
|
|
125
|
+
function isPrimitiveScope(items) {
|
|
126
|
+
return items.every(
|
|
127
|
+
(item) => typeof item === "string" || Object.prototype.toString.call(item) === "[object RegExp]"
|
|
128
|
+
);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
function initToolsConfig(config) {
|
|
133
|
+
const defaultTsChecker = {
|
|
134
|
+
issue: {
|
|
135
|
+
include: [{ file: "**/src/**/*" }],
|
|
136
|
+
exclude: [
|
|
137
|
+
{ file: "**/*.(spec|test).ts" },
|
|
138
|
+
{ file: "**/node_modules/**/*" }
|
|
139
|
+
]
|
|
140
|
+
}
|
|
141
|
+
};
|
|
142
|
+
const { tsChecker, tsLoader } = config.tools;
|
|
143
|
+
config.tools.tsChecker = (0, import_utils.applyOptionsChain)(defaultTsChecker, tsChecker);
|
|
144
|
+
tsLoader && (config.tools.tsLoader = (tsLoaderConfig, utils) => {
|
|
145
|
+
(0, import_utils.applyOptionsChain)(
|
|
146
|
+
{
|
|
147
|
+
...tsLoaderConfig,
|
|
148
|
+
transpileOnly: false,
|
|
149
|
+
allowTsInNodeModules: true
|
|
150
|
+
},
|
|
151
|
+
tsLoader || {},
|
|
152
|
+
utils
|
|
153
|
+
);
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
157
|
+
0 && (module.exports = {
|
|
158
|
+
initHtmlConfig,
|
|
159
|
+
initSourceConfig,
|
|
160
|
+
initToolsConfig
|
|
161
|
+
});
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/dist/{js/node/config/initial/transformNormalizedConfig.js → cjs/config/legacy/index.js}
RENAMED
|
@@ -15,11 +15,12 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
15
15
|
return to;
|
|
16
16
|
};
|
|
17
17
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
-
var
|
|
19
|
-
__export(
|
|
18
|
+
var legacy_exports = {};
|
|
19
|
+
__export(legacy_exports, {
|
|
20
|
+
checkIsLegacyConfig: () => checkIsLegacyConfig,
|
|
20
21
|
transformNormalizedConfig: () => transformNormalizedConfig
|
|
21
22
|
});
|
|
22
|
-
module.exports = __toCommonJS(
|
|
23
|
+
module.exports = __toCommonJS(legacy_exports);
|
|
23
24
|
var import_createToolsConfig = require("./createToolsConfig");
|
|
24
25
|
var import_createSourceConfig = require("./createSourceConfig");
|
|
25
26
|
var import_createOutputConfig = require("./createOutputConfig");
|
|
@@ -64,7 +65,11 @@ function transformNormalizedConfig(config) {
|
|
|
64
65
|
}
|
|
65
66
|
};
|
|
66
67
|
}
|
|
68
|
+
function checkIsLegacyConfig(config) {
|
|
69
|
+
return Boolean(config.legacy);
|
|
70
|
+
}
|
|
67
71
|
// Annotate the CommonJS export names for ESM import in node:
|
|
68
72
|
0 && (module.exports = {
|
|
73
|
+
checkIsLegacyConfig,
|
|
69
74
|
transformNormalizedConfig
|
|
70
75
|
});
|
|
@@ -0,0 +1,33 @@
|
|
|
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 defineConfig_exports = {};
|
|
19
|
+
__export(defineConfig_exports, {
|
|
20
|
+
defineConfig: () => defineConfig,
|
|
21
|
+
defineLegacyConfig: () => defineLegacyConfig
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(defineConfig_exports);
|
|
24
|
+
const defineConfig = (config) => config;
|
|
25
|
+
const defineLegacyConfig = (config) => ({
|
|
26
|
+
...config,
|
|
27
|
+
legacy: true
|
|
28
|
+
});
|
|
29
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
30
|
+
0 && (module.exports = {
|
|
31
|
+
defineConfig,
|
|
32
|
+
defineLegacyConfig
|
|
33
|
+
});
|
|
@@ -0,0 +1,27 @@
|
|
|
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 server_exports = {};
|
|
19
|
+
__export(server_exports, {
|
|
20
|
+
defineConfig: () => import_config.defineServerConfig
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(server_exports);
|
|
23
|
+
var import_config = require("../utils/config");
|
|
24
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
25
|
+
0 && (module.exports = {
|
|
26
|
+
defineConfig
|
|
27
|
+
});
|
|
@@ -0,0 +1,54 @@
|
|
|
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 hooks_exports = {};
|
|
19
|
+
__export(hooks_exports, {
|
|
20
|
+
hooks: () => hooks
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(hooks_exports);
|
|
23
|
+
var import_plugin = require("@modern-js/plugin");
|
|
24
|
+
const hooks = {
|
|
25
|
+
modifyEntryExport: (0, import_plugin.createAsyncWaterfall)(),
|
|
26
|
+
modifyEntryImports: (0, import_plugin.createAsyncWaterfall)(),
|
|
27
|
+
modifyEntryRuntimePlugins: (0, import_plugin.createAsyncWaterfall)(),
|
|
28
|
+
modifyEntryRenderFunction: (0, import_plugin.createAsyncWaterfall)(),
|
|
29
|
+
modifyAsyncEntry: (0, import_plugin.createAsyncWaterfall)(),
|
|
30
|
+
modifyFileSystemRoutes: (0, import_plugin.createAsyncWaterfall)(),
|
|
31
|
+
modifyServerRoutes: (0, import_plugin.createAsyncWaterfall)(),
|
|
32
|
+
htmlPartials: (0, import_plugin.createAsyncWaterfall)(),
|
|
33
|
+
beforeGenerateRoutes: (0, import_plugin.createAsyncWaterfall)(),
|
|
34
|
+
addDefineTypes: (0, import_plugin.createAsyncWaterfall)(),
|
|
35
|
+
collectServerPlugins: (0, import_plugin.createAsyncWaterfall)(),
|
|
36
|
+
beforeDev: (0, import_plugin.createAsyncWorkflow)(),
|
|
37
|
+
afterDev: (0, import_plugin.createAsyncWorkflow)(),
|
|
38
|
+
beforeCreateCompiler: (0, import_plugin.createAsyncWorkflow)(),
|
|
39
|
+
afterCreateCompiler: (0, import_plugin.createAsyncWorkflow)(),
|
|
40
|
+
beforePrintInstructions: (0, import_plugin.createAsyncWaterfall)(),
|
|
41
|
+
beforeBuild: (0, import_plugin.createAsyncWorkflow)(),
|
|
42
|
+
afterBuild: (0, import_plugin.createAsyncWorkflow)(),
|
|
43
|
+
beforeDeploy: (0, import_plugin.createAsyncWorkflow)(),
|
|
44
|
+
afterDeploy: (0, import_plugin.createAsyncWorkflow)(),
|
|
45
|
+
beforeRestart: (0, import_plugin.createAsyncWorkflow)(),
|
|
46
|
+
registerDev: (0, import_plugin.createParallelWorkflow)(),
|
|
47
|
+
beforeDevTask: (0, import_plugin.createParallelWorkflow)(),
|
|
48
|
+
registerBuildPlatform: (0, import_plugin.createParallelWorkflow)(),
|
|
49
|
+
beforeBuildPlatform: (0, import_plugin.createParallelWorkflow)()
|
|
50
|
+
};
|
|
51
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
52
|
+
0 && (module.exports = {
|
|
53
|
+
hooks
|
|
54
|
+
});
|