@modern-js/app-tools 2.4.0 → 2.5.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 +59 -0
- package/dist/{js/node → cjs}/analyze/constants.js +0 -0
- package/dist/cjs/analyze/generateCode.js +249 -0
- package/dist/{js/node → cjs}/analyze/getBundleEntry.js +6 -0
- package/dist/{js/node → cjs}/analyze/getClientRoutes/getRoutes.js +1 -18
- package/dist/{js/node → cjs}/analyze/getClientRoutes/getRoutesLegacy.js +1 -18
- package/dist/{js/node → cjs}/analyze/getClientRoutes/index.js +0 -0
- package/dist/{js/node → cjs}/analyze/getClientRoutes/utils.js +0 -0
- package/dist/{js/node → cjs}/analyze/getFileSystemEntry.js +0 -0
- package/dist/{js/node → cjs}/analyze/getHtmlTemplate.js +4 -24
- package/dist/{js/node → cjs}/analyze/getServerRoutes.js +22 -42
- package/dist/cjs/analyze/index.js +290 -0
- package/dist/{js/node → cjs}/analyze/isDefaultExportFunction.js +0 -0
- package/dist/{js/node → cjs}/analyze/makeLegalIdentifier.js +0 -0
- package/dist/{js/node → cjs}/analyze/nestedRoutes.js +16 -50
- package/dist/{js/node → cjs}/analyze/templates.js +16 -49
- package/dist/{js/node → cjs}/analyze/utils.js +9 -29
- package/dist/{js/node → cjs}/builder/builder-rspack/index.js +0 -0
- package/dist/{js/node → cjs}/builder/builder-webpack/builderPlugins/compatModern.js +0 -0
- package/dist/{js/node → cjs}/builder/builder-webpack/index.js +22 -62
- package/dist/{js/node → cjs}/builder/builder-webpack/webpackPlugins/RouterPlugin.js +7 -24
- package/dist/{js/node → cjs}/builder/builder-webpack/webpackPlugins/index.js +0 -0
- package/dist/{js/node → cjs}/builder/generator/createBuilderOptions.js +0 -0
- package/dist/{js/node → cjs}/builder/generator/createBuilderProviderConfig.js +14 -25
- package/dist/{js/node → cjs}/builder/generator/getBuilderTargets.js +4 -0
- package/dist/cjs/builder/generator/index.js +58 -0
- package/dist/{js/node → cjs}/builder/index.js +12 -34
- package/dist/{js/node → cjs}/builder/shared/builderPlugins/adapterModern.js +35 -34
- package/dist/{js/node → cjs}/builder/shared/bundlerPlugins/HtmlAsyncChunkPlugin.js +0 -0
- package/dist/{js/node → cjs}/builder/shared/bundlerPlugins/HtmlBottomTemplate.js +0 -0
- package/dist/{js/node → cjs}/builder/shared/createCopyPattern.js +0 -0
- package/dist/{js/node → cjs}/builder/shared/index.js +0 -0
- package/dist/{js/node → cjs}/builder/shared/loaders/serverModuleLoader.js +0 -0
- package/dist/{js/node → cjs}/builder/shared/types.js +0 -0
- package/dist/{js/node → cjs}/commands/build.js +9 -46
- package/dist/cjs/commands/deploy.js +31 -0
- package/dist/{js/node → cjs}/commands/dev.js +17 -52
- package/dist/{js/node → cjs}/commands/index.js +0 -0
- package/dist/{js/node → cjs}/commands/inspect.js +2 -22
- package/dist/{js/node → cjs}/commands/serve.js +8 -28
- package/dist/{js/node → cjs}/config/default.js +15 -26
- package/dist/{js/node → cjs}/config/index.js +0 -0
- package/dist/{js/node → cjs}/config/initialize/index.js +0 -0
- package/dist/{js/node → cjs}/config/initialize/inits.js +4 -20
- package/dist/{js/node → cjs}/config/legacy/createHtmlConfig.js +0 -0
- package/dist/{js/node → cjs}/config/legacy/createOutputConfig.js +0 -0
- package/dist/{js/node → cjs}/config/legacy/createSourceConfig.js +0 -0
- package/dist/{js/node → cjs}/config/legacy/createToolsConfig.js +0 -0
- package/dist/{js/node → cjs}/config/legacy/index.js +0 -0
- package/dist/cjs/defineConfig.js +33 -0
- package/dist/{js/node → cjs}/exports/server.js +0 -0
- package/dist/{js/node → cjs}/hooks.js +0 -0
- package/dist/cjs/index.js +198 -0
- package/dist/cjs/initialize/index.js +102 -0
- package/dist/{js/node → cjs}/locale/en.js +0 -0
- package/dist/{js/node → cjs}/locale/index.js +0 -0
- package/dist/{js/node → cjs}/locale/zh.js +0 -0
- package/dist/{js/node → cjs}/schema/Schema.js +0 -0
- package/dist/{js/node → cjs}/schema/index.js +0 -0
- package/dist/{js/node → cjs}/schema/legacy.js +0 -0
- package/dist/{js/node → cjs}/types/config/deploy.js +0 -0
- package/dist/{js/node → cjs}/types/config/dev.js +0 -0
- package/dist/{js/node → cjs}/types/config/experiments.js +0 -0
- package/dist/{js/node → cjs}/types/config/html.js +0 -0
- package/dist/{js/node → cjs}/types/config/index.js +0 -0
- package/dist/{js/node → cjs}/types/config/output.js +0 -0
- package/dist/{js/node → cjs}/types/config/performance.js +0 -0
- package/dist/{js/node → cjs}/types/config/security.js +0 -0
- package/dist/{js/node → cjs}/types/config/source.js +0 -0
- package/dist/{js/node → cjs}/types/config/tools.js +0 -0
- package/dist/{js/node → cjs}/types/hooks.js +0 -0
- package/dist/{js/node → cjs}/types/index.js +0 -0
- package/dist/{js/node → cjs}/types/legacyConfig/deploy.js +0 -0
- package/dist/{js/node → cjs}/types/legacyConfig/dev.js +0 -0
- package/dist/{js/node → cjs}/types/legacyConfig/index.js +0 -0
- package/dist/{js/node → cjs}/types/legacyConfig/output.js +0 -0
- package/dist/{js/node → cjs}/types/legacyConfig/source.js +0 -0
- package/dist/{js/node → cjs}/types/legacyConfig/tools.js +0 -0
- package/dist/{js/node → cjs}/types/utils.js +0 -0
- package/dist/{js/node → cjs}/utils/config.js +19 -57
- package/dist/{js/node → cjs}/utils/createServer.js +10 -46
- package/dist/{js/node → cjs}/utils/env.js +0 -0
- package/dist/{js/node → cjs}/utils/generateWatchFiles.js +16 -38
- package/dist/{js/node → cjs}/utils/getSelectedEntries.js +3 -23
- package/dist/cjs/utils/getServerInternalPlugins.js +41 -0
- package/dist/{js/node → cjs}/utils/language.js +0 -0
- package/dist/{js/node → cjs}/utils/printInstructions.js +3 -23
- package/dist/cjs/utils/restart.js +45 -0
- package/dist/{js/node → cjs}/utils/routes.js +3 -23
- package/dist/{js/node → cjs}/utils/types.js +0 -0
- package/dist/{js/treeshaking → esm}/analyze/constants.js +0 -0
- package/dist/{js/treeshaking → esm}/analyze/generateCode.js +14 -14
- package/dist/{js/treeshaking → esm}/analyze/getBundleEntry.js +4 -2
- package/dist/{js/treeshaking → esm}/analyze/getClientRoutes/getRoutes.js +1 -1
- package/dist/{js/treeshaking → esm}/analyze/getClientRoutes/getRoutesLegacy.js +1 -1
- package/dist/{js/treeshaking → esm}/analyze/getClientRoutes/index.js +0 -0
- package/dist/{js/treeshaking → esm}/analyze/getClientRoutes/utils.js +0 -0
- package/dist/{js/treeshaking → esm}/analyze/getFileSystemEntry.js +1 -1
- package/dist/{js/treeshaking → esm}/analyze/getHtmlTemplate.js +0 -0
- package/dist/{js/treeshaking → esm}/analyze/getServerRoutes.js +8 -6
- package/dist/{js/treeshaking → esm}/analyze/index.js +8 -8
- package/dist/{js/treeshaking → esm}/analyze/isDefaultExportFunction.js +0 -0
- package/dist/{js/treeshaking → esm}/analyze/makeLegalIdentifier.js +0 -0
- package/dist/{js/treeshaking → esm}/analyze/nestedRoutes.js +5 -5
- package/dist/{js/treeshaking → esm}/analyze/templates.js +8 -7
- package/dist/{js/treeshaking → esm}/analyze/utils.js +3 -3
- package/dist/{js/treeshaking → esm}/builder/builder-rspack/index.js +0 -0
- package/dist/{js/treeshaking → esm}/builder/builder-webpack/builderPlugins/compatModern.js +4 -4
- package/dist/{js/treeshaking → esm}/builder/builder-webpack/index.js +2 -2
- package/dist/{js/treeshaking → esm}/builder/builder-webpack/webpackPlugins/RouterPlugin.js +5 -2
- package/dist/{js/treeshaking → esm}/builder/builder-webpack/webpackPlugins/index.js +0 -0
- package/dist/{js/treeshaking → esm}/builder/generator/createBuilderOptions.js +2 -2
- package/dist/{js/treeshaking → esm}/builder/generator/createBuilderProviderConfig.js +0 -0
- package/dist/{js/treeshaking → esm}/builder/generator/getBuilderTargets.js +5 -1
- package/dist/{js/treeshaking → esm}/builder/generator/index.js +2 -2
- package/dist/{js/treeshaking → esm}/builder/index.js +0 -0
- package/dist/{js/treeshaking → esm}/builder/shared/builderPlugins/adapterModern.js +62 -13
- package/dist/{js/treeshaking → esm}/builder/shared/bundlerPlugins/HtmlAsyncChunkPlugin.js +0 -0
- package/dist/{js/treeshaking → esm}/builder/shared/bundlerPlugins/HtmlBottomTemplate.js +2 -2
- package/dist/{js/treeshaking → esm}/builder/shared/createCopyPattern.js +0 -0
- package/dist/{js/treeshaking → esm}/builder/shared/index.js +0 -0
- package/dist/{js/treeshaking → esm}/builder/shared/loaders/serverModuleLoader.js +0 -0
- package/dist/{js/treeshaking → esm}/builder/shared/types.js +0 -0
- package/dist/{js/treeshaking → esm}/commands/build.js +0 -0
- package/dist/{js/treeshaking → esm}/commands/deploy.js +0 -0
- package/dist/{js/treeshaking → esm}/commands/dev.js +2 -2
- package/dist/{js/treeshaking → esm}/commands/index.js +0 -0
- package/dist/{js/treeshaking → esm}/commands/inspect.js +0 -0
- package/dist/{js/treeshaking → esm}/commands/serve.js +2 -2
- package/dist/{js/treeshaking → esm}/config/default.js +0 -0
- package/dist/{js/treeshaking → esm}/config/index.js +0 -0
- package/dist/{js/treeshaking → esm}/config/initialize/index.js +0 -0
- package/dist/{js/treeshaking → esm}/config/initialize/inits.js +2 -2
- package/dist/esm/config/legacy/createHtmlConfig.js +19 -0
- package/dist/{js/treeshaking → esm}/config/legacy/createOutputConfig.js +1 -1
- package/dist/{js/treeshaking → esm}/config/legacy/createSourceConfig.js +1 -1
- package/dist/{js/treeshaking → esm}/config/legacy/createToolsConfig.js +1 -1
- package/dist/{js/treeshaking → esm}/config/legacy/index.js +0 -0
- package/dist/{js/treeshaking → esm}/defineConfig.js +0 -0
- package/dist/{js/treeshaking → esm}/exports/server.js +0 -0
- package/dist/{js/treeshaking → esm}/hooks.js +0 -0
- package/dist/{js/treeshaking → esm}/index.js +0 -0
- package/dist/{js/treeshaking → esm}/initialize/index.js +2 -2
- package/dist/{js/treeshaking → esm}/locale/en.js +0 -0
- package/dist/{js/treeshaking → esm}/locale/index.js +0 -0
- package/dist/{js/treeshaking → esm}/locale/zh.js +0 -0
- package/dist/{js/treeshaking → esm}/schema/Schema.js +0 -0
- package/dist/{js/treeshaking → esm}/schema/index.js +0 -0
- package/dist/{js/treeshaking → esm}/schema/legacy.js +0 -0
- package/dist/{js/treeshaking → esm}/types/config/deploy.js +0 -0
- package/dist/{js/treeshaking → esm}/types/config/dev.js +0 -0
- package/dist/{js/treeshaking → esm}/types/config/experiments.js +0 -0
- package/dist/{js/treeshaking → esm}/types/config/html.js +0 -0
- package/dist/{js/treeshaking → esm}/types/config/index.js +0 -0
- package/dist/{js/treeshaking → esm}/types/config/output.js +0 -0
- package/dist/{js/treeshaking → esm}/types/config/performance.js +0 -0
- package/dist/{js/treeshaking → esm}/types/config/security.js +0 -0
- package/dist/{js/treeshaking → esm}/types/config/source.js +0 -0
- package/dist/{js/treeshaking → esm}/types/config/tools.js +0 -0
- package/dist/{js/treeshaking → esm}/types/hooks.js +0 -0
- package/dist/{js/treeshaking → esm}/types/index.js +0 -0
- package/dist/{js/treeshaking → esm}/types/legacyConfig/deploy.js +0 -0
- package/dist/{js/treeshaking → esm}/types/legacyConfig/dev.js +0 -0
- package/dist/{js/treeshaking → esm}/types/legacyConfig/index.js +0 -0
- package/dist/{js/treeshaking → esm}/types/legacyConfig/output.js +0 -0
- package/dist/{js/treeshaking → esm}/types/legacyConfig/source.js +0 -0
- package/dist/{js/treeshaking → esm}/types/legacyConfig/tools.js +0 -0
- package/dist/{js/treeshaking → esm}/types/utils.js +0 -0
- package/dist/{js/treeshaking → esm}/utils/config.js +2 -2
- package/dist/{js/treeshaking → esm}/utils/createServer.js +0 -0
- package/dist/{js/treeshaking → esm}/utils/env.js +0 -0
- package/dist/{js/treeshaking → esm}/utils/generateWatchFiles.js +0 -0
- package/dist/{js/treeshaking → esm}/utils/getSelectedEntries.js +0 -0
- package/dist/{js/treeshaking → esm}/utils/getServerInternalPlugins.js +2 -2
- package/dist/{js/treeshaking → esm}/utils/language.js +0 -0
- package/dist/{js/treeshaking → esm}/utils/printInstructions.js +0 -0
- package/dist/{js/treeshaking → esm}/utils/restart.js +0 -0
- package/dist/{js/treeshaking → esm}/utils/routes.js +0 -0
- package/dist/{js/treeshaking → esm}/utils/types.js +0 -0
- package/dist/{js/modern → esm-node}/analyze/constants.js +0 -0
- package/dist/esm-node/analyze/generateCode.js +225 -0
- package/dist/{js/modern → esm-node}/analyze/getBundleEntry.js +6 -0
- package/dist/{js/modern → esm-node}/analyze/getClientRoutes/getRoutes.js +1 -20
- package/dist/{js/modern → esm-node}/analyze/getClientRoutes/getRoutesLegacy.js +1 -20
- package/dist/{js/modern → esm-node}/analyze/getClientRoutes/index.js +0 -0
- package/dist/{js/modern → esm-node}/analyze/getClientRoutes/utils.js +0 -0
- package/dist/{js/modern → esm-node}/analyze/getFileSystemEntry.js +0 -0
- package/dist/{js/modern → esm-node}/analyze/getHtmlTemplate.js +4 -24
- package/dist/{js/modern → esm-node}/analyze/getServerRoutes.js +24 -45
- package/dist/esm-node/analyze/index.js +281 -0
- package/dist/{js/modern → esm-node}/analyze/isDefaultExportFunction.js +0 -0
- package/dist/{js/modern → esm-node}/analyze/makeLegalIdentifier.js +0 -0
- package/dist/{js/modern → esm-node}/analyze/nestedRoutes.js +16 -52
- package/dist/{js/modern → esm-node}/analyze/templates.js +16 -51
- package/dist/{js/modern → esm-node}/analyze/utils.js +9 -29
- package/dist/{js/modern → esm-node}/builder/builder-rspack/index.js +0 -0
- package/dist/{js/modern → esm-node}/builder/builder-webpack/builderPlugins/compatModern.js +0 -0
- package/dist/esm-node/builder/builder-webpack/index.js +51 -0
- package/dist/{js/modern → esm-node}/builder/builder-webpack/webpackPlugins/RouterPlugin.js +7 -24
- package/dist/{js/modern → esm-node}/builder/builder-webpack/webpackPlugins/index.js +0 -0
- package/dist/{js/modern → esm-node}/builder/generator/createBuilderOptions.js +0 -0
- package/dist/esm-node/builder/generator/createBuilderProviderConfig.js +26 -0
- package/dist/{js/modern → esm-node}/builder/generator/getBuilderTargets.js +10 -1
- package/dist/esm-node/builder/generator/index.js +29 -0
- package/dist/esm-node/builder/index.js +17 -0
- package/dist/{js/modern → esm-node}/builder/shared/builderPlugins/adapterModern.js +35 -36
- package/dist/{js/modern → esm-node}/builder/shared/bundlerPlugins/HtmlAsyncChunkPlugin.js +0 -0
- package/dist/{js/modern → esm-node}/builder/shared/bundlerPlugins/HtmlBottomTemplate.js +0 -0
- package/dist/{js/modern → esm-node}/builder/shared/createCopyPattern.js +0 -0
- package/dist/{js/modern → esm-node}/builder/shared/index.js +0 -0
- package/dist/{js/modern → esm-node}/builder/shared/loaders/serverModuleLoader.js +0 -0
- package/dist/{js/modern → 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/{js/modern → esm-node}/commands/index.js +0 -0
- package/dist/esm-node/commands/inspect.js +18 -0
- package/dist/{js/modern → esm-node}/commands/serve.js +8 -28
- package/dist/{js/modern → esm-node}/config/default.js +15 -28
- package/dist/{js/modern → esm-node}/config/index.js +0 -0
- package/dist/{js/modern → esm-node}/config/initialize/index.js +0 -0
- package/dist/{js/modern → esm-node}/config/initialize/inits.js +4 -22
- package/dist/{js/modern → esm-node}/config/legacy/createHtmlConfig.js +0 -0
- package/dist/{js/modern → esm-node}/config/legacy/createOutputConfig.js +0 -0
- package/dist/{js/modern → esm-node}/config/legacy/createSourceConfig.js +0 -0
- package/dist/{js/modern → esm-node}/config/legacy/createToolsConfig.js +0 -0
- package/dist/{js/modern → esm-node}/config/legacy/index.js +0 -0
- package/dist/esm-node/defineConfig.js +9 -0
- package/dist/{js/modern → esm-node}/exports/server.js +0 -0
- package/dist/{js/modern → esm-node}/hooks.js +0 -0
- package/dist/esm-node/index.js +172 -0
- package/dist/esm-node/initialize/index.js +91 -0
- package/dist/{js/modern → esm-node}/locale/en.js +0 -0
- package/dist/{js/modern → esm-node}/locale/index.js +0 -0
- package/dist/{js/modern → esm-node}/locale/zh.js +0 -0
- package/dist/{js/modern → esm-node}/schema/Schema.js +0 -0
- package/dist/{js/modern → esm-node}/schema/index.js +0 -0
- package/dist/{js/modern → esm-node}/schema/legacy.js +0 -0
- package/dist/{js/modern → esm-node}/types/config/deploy.js +0 -0
- package/dist/{js/modern → esm-node}/types/config/dev.js +0 -0
- package/dist/{js/modern → esm-node}/types/config/experiments.js +0 -0
- package/dist/{js/modern → esm-node}/types/config/html.js +0 -0
- package/dist/{js/modern → esm-node}/types/config/index.js +0 -0
- package/dist/{js/modern → esm-node}/types/config/output.js +0 -0
- package/dist/{js/modern → esm-node}/types/config/performance.js +0 -0
- package/dist/{js/modern → esm-node}/types/config/security.js +0 -0
- package/dist/{js/modern → esm-node}/types/config/source.js +0 -0
- package/dist/{js/modern → esm-node}/types/config/tools.js +0 -0
- package/dist/{js/modern → esm-node}/types/hooks.js +0 -0
- package/dist/{js/modern → esm-node}/types/index.js +0 -0
- package/dist/{js/modern → esm-node}/types/legacyConfig/deploy.js +0 -0
- package/dist/{js/modern → esm-node}/types/legacyConfig/dev.js +0 -0
- package/dist/{js/modern → esm-node}/types/legacyConfig/index.js +0 -0
- package/dist/{js/modern → esm-node}/types/legacyConfig/output.js +0 -0
- package/dist/{js/modern → esm-node}/types/legacyConfig/source.js +0 -0
- package/dist/{js/modern → esm-node}/types/legacyConfig/tools.js +0 -0
- package/dist/{js/modern → 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/{js/modern → esm-node}/utils/env.js +0 -0
- package/dist/esm-node/utils/generateWatchFiles.js +33 -0
- package/dist/{js/modern → esm-node}/utils/getSelectedEntries.js +3 -23
- package/dist/esm-node/utils/getServerInternalPlugins.js +18 -0
- package/dist/{js/modern → esm-node}/utils/language.js +0 -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/{js/modern → esm-node}/utils/types.js +0 -0
- package/dist/types/types/config/tools.d.ts +1 -1
- package/dist/types/types/hooks.d.ts +5 -4
- package/dist/types/types/index.d.ts +3 -1
- package/package.json +30 -31
- package/dist/js/modern/analyze/generateCode.js +0 -247
- package/dist/js/modern/analyze/index.js +0 -329
- package/dist/js/modern/builder/builder-webpack/index.js +0 -93
- package/dist/js/modern/builder/generator/createBuilderProviderConfig.js +0 -39
- package/dist/js/modern/builder/generator/index.js +0 -53
- package/dist/js/modern/builder/index.js +0 -39
- package/dist/js/modern/commands/build.js +0 -91
- package/dist/js/modern/commands/deploy.js +0 -28
- package/dist/js/modern/commands/dev.js +0 -109
- package/dist/js/modern/commands/inspect.js +0 -38
- package/dist/js/modern/defineConfig.js +0 -27
- package/dist/js/modern/index.js +0 -221
- package/dist/js/modern/initialize/index.js +0 -132
- package/dist/js/modern/utils/config.js +0 -128
- package/dist/js/modern/utils/createServer.js +0 -75
- package/dist/js/modern/utils/generateWatchFiles.js +0 -55
- package/dist/js/modern/utils/getServerInternalPlugins.js +0 -58
- package/dist/js/modern/utils/printInstructions.js +0 -31
- package/dist/js/modern/utils/restart.js +0 -44
- package/dist/js/modern/utils/routes.js +0 -30
- package/dist/js/node/analyze/generateCode.js +0 -271
- package/dist/js/node/analyze/index.js +0 -336
- package/dist/js/node/builder/generator/index.js +0 -82
- package/dist/js/node/commands/deploy.js +0 -51
- package/dist/js/node/defineConfig.js +0 -49
- package/dist/js/node/index.js +0 -245
- package/dist/js/node/initialize/index.js +0 -141
- package/dist/js/node/utils/getServerInternalPlugins.js +0 -79
- package/dist/js/node/utils/restart.js +0 -67
- package/dist/js/treeshaking/config/legacy/createHtmlConfig.js +0 -19
|
@@ -1,24 +1,7 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
|
-
var __defProps = Object.defineProperties;
|
|
3
2
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
5
3
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
7
4
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
9
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
10
|
-
var __spreadValues = (a, b) => {
|
|
11
|
-
for (var prop in b || (b = {}))
|
|
12
|
-
if (__hasOwnProp.call(b, prop))
|
|
13
|
-
__defNormalProp(a, prop, b[prop]);
|
|
14
|
-
if (__getOwnPropSymbols)
|
|
15
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
16
|
-
if (__propIsEnum.call(b, prop))
|
|
17
|
-
__defNormalProp(a, prop, b[prop]);
|
|
18
|
-
}
|
|
19
|
-
return a;
|
|
20
|
-
};
|
|
21
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
22
5
|
var __export = (target, all) => {
|
|
23
6
|
for (var name in all)
|
|
24
7
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -32,26 +15,6 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
32
15
|
return to;
|
|
33
16
|
};
|
|
34
17
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
35
|
-
var __async = (__this, __arguments, generator) => {
|
|
36
|
-
return new Promise((resolve, reject) => {
|
|
37
|
-
var fulfilled = (value) => {
|
|
38
|
-
try {
|
|
39
|
-
step(generator.next(value));
|
|
40
|
-
} catch (e) {
|
|
41
|
-
reject(e);
|
|
42
|
-
}
|
|
43
|
-
};
|
|
44
|
-
var rejected = (value) => {
|
|
45
|
-
try {
|
|
46
|
-
step(generator.throw(value));
|
|
47
|
-
} catch (e) {
|
|
48
|
-
reject(e);
|
|
49
|
-
}
|
|
50
|
-
};
|
|
51
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
52
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
53
|
-
});
|
|
54
|
-
};
|
|
55
18
|
var dev_exports = {};
|
|
56
19
|
__export(dev_exports, {
|
|
57
20
|
dev: () => dev
|
|
@@ -63,7 +26,7 @@ var import_createServer = require("../utils/createServer");
|
|
|
63
26
|
var import_routes = require("../utils/routes");
|
|
64
27
|
var import_config = require("../utils/config");
|
|
65
28
|
var import_getServerInternalPlugins = require("../utils/getServerInternalPlugins");
|
|
66
|
-
const dev = (api, options) =>
|
|
29
|
+
const dev = async (api, options) => {
|
|
67
30
|
var _a;
|
|
68
31
|
if (options.analyze) {
|
|
69
32
|
process.env.BUNDLE_ANALYZE = "true";
|
|
@@ -71,10 +34,10 @@ const dev = (api, options) => __async(void 0, null, function* () {
|
|
|
71
34
|
let normalizedConfig = api.useResolvedConfigContext();
|
|
72
35
|
const appContext = api.useAppContext();
|
|
73
36
|
const hookRunners = api.useHookRunners();
|
|
74
|
-
normalizedConfig =
|
|
37
|
+
normalizedConfig = { ...normalizedConfig, cliOptions: options };
|
|
75
38
|
import_core.ResolvedConfigContext.set(normalizedConfig);
|
|
76
39
|
const { appDirectory, distDirectory, port, apiOnly, serverConfigFile } = appContext;
|
|
77
|
-
|
|
40
|
+
await (0, import_config.buildServerConfig)({
|
|
78
41
|
appDirectory,
|
|
79
42
|
distDirectory,
|
|
80
43
|
configFile: serverConfigFile,
|
|
@@ -84,42 +47,44 @@ const dev = (api, options) => __async(void 0, null, function* () {
|
|
|
84
47
|
}
|
|
85
48
|
}
|
|
86
49
|
});
|
|
87
|
-
|
|
50
|
+
await hookRunners.beforeDev();
|
|
88
51
|
if (!appContext.builder && !apiOnly) {
|
|
89
52
|
throw new Error(
|
|
90
53
|
"Expect the Builder to have been initialized, But the appContext.builder received `undefined`"
|
|
91
54
|
);
|
|
92
55
|
}
|
|
93
|
-
|
|
94
|
-
const serverInternalPlugins =
|
|
56
|
+
await (0, import_routes.generateRoutes)(appContext);
|
|
57
|
+
const serverInternalPlugins = await (0, import_getServerInternalPlugins.getServerInternalPlugins)(api);
|
|
95
58
|
const serverOptions = {
|
|
96
|
-
dev:
|
|
59
|
+
dev: {
|
|
97
60
|
port,
|
|
98
|
-
https: normalizedConfig.dev.https
|
|
99
|
-
|
|
61
|
+
https: normalizedConfig.dev.https,
|
|
62
|
+
...(_a = normalizedConfig.tools) == null ? void 0 : _a.devServer
|
|
63
|
+
},
|
|
100
64
|
pwd: appDirectory,
|
|
101
65
|
config: normalizedConfig,
|
|
102
66
|
serverConfigFile,
|
|
103
67
|
internalPlugins: (0, import_createServer.injectDataLoaderPlugin)(serverInternalPlugins)
|
|
104
68
|
};
|
|
105
69
|
if (apiOnly) {
|
|
106
|
-
const app =
|
|
70
|
+
const app = await (0, import_createServer.createServer)({
|
|
71
|
+
...serverOptions,
|
|
107
72
|
compiler: null
|
|
108
|
-
})
|
|
109
|
-
app.listen(port, (err) =>
|
|
73
|
+
});
|
|
74
|
+
app.listen(port, async (err) => {
|
|
110
75
|
if (err) {
|
|
111
76
|
throw err;
|
|
112
77
|
}
|
|
113
78
|
(0, import_printInstructions.printInstructions)(hookRunners, appContext, normalizedConfig);
|
|
114
|
-
})
|
|
79
|
+
});
|
|
115
80
|
} else {
|
|
116
|
-
const { server } =
|
|
81
|
+
const { server } = await appContext.builder.startDevServer({
|
|
117
82
|
printURLs: false,
|
|
118
83
|
serverOptions
|
|
119
84
|
});
|
|
120
85
|
(0, import_createServer.setServer)(server);
|
|
121
86
|
}
|
|
122
|
-
}
|
|
87
|
+
};
|
|
123
88
|
// Annotate the CommonJS export names for ESM import in node:
|
|
124
89
|
0 && (module.exports = {
|
|
125
90
|
dev
|
|
File without changes
|
|
@@ -15,33 +15,13 @@ 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 __async = (__this, __arguments, generator) => {
|
|
19
|
-
return new Promise((resolve, reject) => {
|
|
20
|
-
var fulfilled = (value) => {
|
|
21
|
-
try {
|
|
22
|
-
step(generator.next(value));
|
|
23
|
-
} catch (e) {
|
|
24
|
-
reject(e);
|
|
25
|
-
}
|
|
26
|
-
};
|
|
27
|
-
var rejected = (value) => {
|
|
28
|
-
try {
|
|
29
|
-
step(generator.throw(value));
|
|
30
|
-
} catch (e) {
|
|
31
|
-
reject(e);
|
|
32
|
-
}
|
|
33
|
-
};
|
|
34
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
35
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
36
|
-
});
|
|
37
|
-
};
|
|
38
18
|
var inspect_exports = {};
|
|
39
19
|
__export(inspect_exports, {
|
|
40
20
|
inspect: () => inspect
|
|
41
21
|
});
|
|
42
22
|
module.exports = __toCommonJS(inspect_exports);
|
|
43
23
|
var import_path = require("path");
|
|
44
|
-
const inspect = (api, options) =>
|
|
24
|
+
const inspect = async (api, options) => {
|
|
45
25
|
const appContext = api.useAppContext();
|
|
46
26
|
if (!appContext.builder) {
|
|
47
27
|
throw new Error(
|
|
@@ -54,7 +34,7 @@ const inspect = (api, options) => __async(void 0, null, function* () {
|
|
|
54
34
|
outputPath: (0, import_path.join)(appContext == null ? void 0 : appContext.builder.context.distPath, options.output),
|
|
55
35
|
writeToDisk: true
|
|
56
36
|
});
|
|
57
|
-
}
|
|
37
|
+
};
|
|
58
38
|
// Annotate the CommonJS export names for ESM import in node:
|
|
59
39
|
0 && (module.exports = {
|
|
60
40
|
inspect
|
|
@@ -21,26 +21,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
21
21
|
mod
|
|
22
22
|
));
|
|
23
23
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
24
|
-
var __async = (__this, __arguments, generator) => {
|
|
25
|
-
return new Promise((resolve, reject) => {
|
|
26
|
-
var fulfilled = (value) => {
|
|
27
|
-
try {
|
|
28
|
-
step(generator.next(value));
|
|
29
|
-
} catch (e) {
|
|
30
|
-
reject(e);
|
|
31
|
-
}
|
|
32
|
-
};
|
|
33
|
-
var rejected = (value) => {
|
|
34
|
-
try {
|
|
35
|
-
step(generator.throw(value));
|
|
36
|
-
} catch (e) {
|
|
37
|
-
reject(e);
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
41
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
42
|
-
});
|
|
43
|
-
};
|
|
44
24
|
var serve_exports = {};
|
|
45
25
|
__export(serve_exports, {
|
|
46
26
|
start: () => start
|
|
@@ -51,32 +31,32 @@ var import_prod_server = __toESM(require("@modern-js/prod-server"));
|
|
|
51
31
|
var import_printInstructions = require("../utils/printInstructions");
|
|
52
32
|
var import_createServer = require("../utils/createServer");
|
|
53
33
|
var import_getServerInternalPlugins = require("../utils/getServerInternalPlugins");
|
|
54
|
-
const start = (api) =>
|
|
34
|
+
const start = async (api) => {
|
|
55
35
|
var _a;
|
|
56
36
|
const appContext = api.useAppContext();
|
|
57
37
|
const userConfig = api.useResolvedConfigContext();
|
|
58
38
|
const hookRunners = api.useHookRunners();
|
|
59
39
|
const { appDirectory, port, serverConfigFile } = appContext;
|
|
60
40
|
import_utils.logger.log(import_utils.chalk.cyan(`Starting the modern server...`));
|
|
61
|
-
const apiOnly =
|
|
41
|
+
const apiOnly = await (0, import_utils.isApiOnly)(
|
|
62
42
|
appContext.appDirectory,
|
|
63
43
|
(_a = userConfig == null ? void 0 : userConfig.source) == null ? void 0 : _a.entriesDir
|
|
64
44
|
);
|
|
65
|
-
const serverInternalPlugins =
|
|
66
|
-
const app =
|
|
45
|
+
const serverInternalPlugins = await (0, import_getServerInternalPlugins.getServerInternalPlugins)(api);
|
|
46
|
+
const app = await (0, import_prod_server.default)({
|
|
67
47
|
pwd: appDirectory,
|
|
68
48
|
config: userConfig,
|
|
69
49
|
serverConfigFile,
|
|
70
50
|
internalPlugins: (0, import_createServer.injectDataLoaderPlugin)(serverInternalPlugins),
|
|
71
51
|
apiOnly
|
|
72
52
|
});
|
|
73
|
-
app.listen(port, (err) =>
|
|
53
|
+
app.listen(port, async (err) => {
|
|
74
54
|
if (err) {
|
|
75
55
|
throw err;
|
|
76
56
|
}
|
|
77
|
-
|
|
78
|
-
})
|
|
79
|
-
}
|
|
57
|
+
await (0, import_printInstructions.printInstructions)(hookRunners, appContext, userConfig);
|
|
58
|
+
});
|
|
59
|
+
};
|
|
80
60
|
// Annotate the CommonJS export names for ESM import in node:
|
|
81
61
|
0 && (module.exports = {
|
|
82
62
|
start
|
|
@@ -1,24 +1,7 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
|
-
var __defProps = Object.defineProperties;
|
|
3
2
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
5
3
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
7
4
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
9
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
10
|
-
var __spreadValues = (a, b) => {
|
|
11
|
-
for (var prop in b || (b = {}))
|
|
12
|
-
if (__hasOwnProp.call(b, prop))
|
|
13
|
-
__defNormalProp(a, prop, b[prop]);
|
|
14
|
-
if (__getOwnPropSymbols)
|
|
15
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
16
|
-
if (__propIsEnum.call(b, prop))
|
|
17
|
-
__defNormalProp(a, prop, b[prop]);
|
|
18
|
-
}
|
|
19
|
-
return a;
|
|
20
|
-
};
|
|
21
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
22
5
|
var __export = (target, all) => {
|
|
23
6
|
for (var name in all)
|
|
24
7
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -41,13 +24,16 @@ module.exports = __toCommonJS(default_exports);
|
|
|
41
24
|
var import_builder_webpack_provider = require("@modern-js/builder-webpack-provider");
|
|
42
25
|
function createDefaultConfig(appContext, bundler) {
|
|
43
26
|
const defaultBuilderConfig = (0, import_builder_webpack_provider.createDefaultConfig)();
|
|
44
|
-
const dev =
|
|
27
|
+
const dev = {
|
|
28
|
+
...defaultBuilderConfig.dev,
|
|
45
29
|
port: void 0
|
|
46
|
-
}
|
|
47
|
-
const output =
|
|
30
|
+
};
|
|
31
|
+
const output = {
|
|
32
|
+
...defaultBuilderConfig.output,
|
|
48
33
|
disableNodePolyfill: true
|
|
49
|
-
}
|
|
50
|
-
const source =
|
|
34
|
+
};
|
|
35
|
+
const source = {
|
|
36
|
+
...defaultBuilderConfig.source,
|
|
51
37
|
entries: void 0,
|
|
52
38
|
enableAsyncEntry: false,
|
|
53
39
|
disableDefaultEntries: false,
|
|
@@ -59,8 +45,9 @@ function createDefaultConfig(appContext, bundler) {
|
|
|
59
45
|
"@": appContext.srcDirectory,
|
|
60
46
|
"@shared": appContext.sharedDirectory
|
|
61
47
|
}
|
|
62
|
-
}
|
|
63
|
-
const html =
|
|
48
|
+
};
|
|
49
|
+
const html = {
|
|
50
|
+
...defaultBuilderConfig.html,
|
|
64
51
|
title: "",
|
|
65
52
|
meta: {
|
|
66
53
|
charset: { charset: "utf-8" },
|
|
@@ -72,7 +59,7 @@ function createDefaultConfig(appContext, bundler) {
|
|
|
72
59
|
"wap-font-scale": "no",
|
|
73
60
|
"format-detection": "telephone=no"
|
|
74
61
|
}
|
|
75
|
-
}
|
|
62
|
+
};
|
|
76
63
|
const server = {
|
|
77
64
|
routes: void 0,
|
|
78
65
|
publicRoutes: void 0,
|
|
@@ -81,7 +68,9 @@ function createDefaultConfig(appContext, bundler) {
|
|
|
81
68
|
baseUrl: "/",
|
|
82
69
|
port: 8080
|
|
83
70
|
};
|
|
84
|
-
const tools = bundler === "webpack" ?
|
|
71
|
+
const tools = bundler === "webpack" ? {
|
|
72
|
+
...defaultBuilderConfig.tools
|
|
73
|
+
} : void 0;
|
|
85
74
|
return {
|
|
86
75
|
source,
|
|
87
76
|
output,
|
|
File without changes
|
|
File without changes
|
|
@@ -1,26 +1,9 @@
|
|
|
1
1
|
var __create = Object.create;
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
|
-
var __defProps = Object.defineProperties;
|
|
4
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
6
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
8
5
|
var __getProtoOf = Object.getPrototypeOf;
|
|
9
6
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
10
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
11
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
12
|
-
var __spreadValues = (a, b) => {
|
|
13
|
-
for (var prop in b || (b = {}))
|
|
14
|
-
if (__hasOwnProp.call(b, prop))
|
|
15
|
-
__defNormalProp(a, prop, b[prop]);
|
|
16
|
-
if (__getOwnPropSymbols)
|
|
17
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
18
|
-
if (__propIsEnum.call(b, prop))
|
|
19
|
-
__defNormalProp(a, prop, b[prop]);
|
|
20
|
-
}
|
|
21
|
-
return a;
|
|
22
|
-
};
|
|
23
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
24
7
|
var __export = (target, all) => {
|
|
25
8
|
for (var name in all)
|
|
26
9
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -90,7 +73,7 @@ function initSourceConfig(config, appContext, bundler) {
|
|
|
90
73
|
function createBuilderGlobalVars(config2, appContext2) {
|
|
91
74
|
const { globalVars = {} } = config2.source;
|
|
92
75
|
const publicEnv = (0, import_env.getAutoInjectEnv)(appContext2);
|
|
93
|
-
return
|
|
76
|
+
return { ...globalVars, ...publicEnv };
|
|
94
77
|
}
|
|
95
78
|
function createBuilderInclude(config2, appContext2) {
|
|
96
79
|
const { include } = config2.source;
|
|
@@ -160,10 +143,11 @@ function initToolsConfig(config) {
|
|
|
160
143
|
config.tools.tsChecker = (0, import_utils.applyOptionsChain)(defaultTsChecker, tsChecker);
|
|
161
144
|
tsLoader && (config.tools.tsLoader = (tsLoaderConfig, utils) => {
|
|
162
145
|
(0, import_utils.applyOptionsChain)(
|
|
163
|
-
|
|
146
|
+
{
|
|
147
|
+
...tsLoaderConfig,
|
|
164
148
|
transpileOnly: false,
|
|
165
149
|
allowTsInNodeModules: true
|
|
166
|
-
}
|
|
150
|
+
},
|
|
167
151
|
tsLoader || {},
|
|
168
152
|
utils
|
|
169
153
|
);
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -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
|
+
});
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,198 @@
|
|
|
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 __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
|
+
mod
|
|
23
|
+
));
|
|
24
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
25
|
+
var src_exports = {};
|
|
26
|
+
__export(src_exports, {
|
|
27
|
+
buildCommand: () => buildCommand,
|
|
28
|
+
default: () => src_default,
|
|
29
|
+
devCommand: () => devCommand
|
|
30
|
+
});
|
|
31
|
+
module.exports = __toCommonJS(src_exports);
|
|
32
|
+
var import_path = __toESM(require("path"));
|
|
33
|
+
var import_plugin_lint = __toESM(require("@modern-js/plugin-lint"));
|
|
34
|
+
var import_utils = require("@modern-js/utils");
|
|
35
|
+
var import_lodash = require("@modern-js/utils/lodash");
|
|
36
|
+
var import_analyze = __toESM(require("./analyze"));
|
|
37
|
+
var import_initialize = __toESM(require("./initialize"));
|
|
38
|
+
var import_hooks = require("./hooks");
|
|
39
|
+
var import_locale = require("./locale");
|
|
40
|
+
var import_language = require("./utils/language");
|
|
41
|
+
var import_restart = require("./utils/restart");
|
|
42
|
+
var import_generateWatchFiles = require("./utils/generateWatchFiles");
|
|
43
|
+
__reExport(src_exports, require("./defineConfig"), module.exports);
|
|
44
|
+
__reExport(src_exports, require("./types"), module.exports);
|
|
45
|
+
const upgradeModel = import_utils.Import.lazy(
|
|
46
|
+
"@modern-js/upgrade",
|
|
47
|
+
require
|
|
48
|
+
);
|
|
49
|
+
const devCommand = async (program, api) => {
|
|
50
|
+
const runner = api.useHookRunners();
|
|
51
|
+
const devToolMetas = await runner.registerDev();
|
|
52
|
+
const devProgram = program.command("dev").alias("start").usage("[options]").description(import_locale.i18n.t(import_locale.localeKeys.command.dev.describe)).option("-c --config <config>", import_locale.i18n.t(import_locale.localeKeys.command.shared.config)).option("-e --entry [entry...]", import_locale.i18n.t(import_locale.localeKeys.command.dev.entry)).option("--analyze", import_locale.i18n.t(import_locale.localeKeys.command.shared.analyze)).option("--api-only", import_locale.i18n.t(import_locale.localeKeys.command.dev.apiOnly)).action(async (options) => {
|
|
53
|
+
const { dev } = await Promise.resolve().then(() => __toESM(require("./commands/dev")));
|
|
54
|
+
await dev(api, options);
|
|
55
|
+
});
|
|
56
|
+
for (const meta of devToolMetas) {
|
|
57
|
+
if (!meta.subCommands) {
|
|
58
|
+
continue;
|
|
59
|
+
}
|
|
60
|
+
for (const subCmd of meta.subCommands) {
|
|
61
|
+
devProgram.command(subCmd).action(async (options = {}) => {
|
|
62
|
+
const { appDirectory } = api.useAppContext();
|
|
63
|
+
const { isTypescript } = await Promise.resolve().then(() => __toESM(require("@modern-js/utils")));
|
|
64
|
+
await runner.beforeDevTask(meta);
|
|
65
|
+
await meta.action(options, {
|
|
66
|
+
isTsProject: isTypescript(appDirectory)
|
|
67
|
+
});
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
const buildCommand = async (program, api) => {
|
|
73
|
+
const runner = api.useHookRunners();
|
|
74
|
+
const platformBuilders = await runner.registerBuildPlatform();
|
|
75
|
+
const buildProgram = program.command("build").usage("[options]").description(import_locale.i18n.t(import_locale.localeKeys.command.build.describe)).option("-c --config <config>", import_locale.i18n.t(import_locale.localeKeys.command.shared.config)).option("--analyze", import_locale.i18n.t(import_locale.localeKeys.command.shared.analyze)).action(async (options) => {
|
|
76
|
+
const { build } = await Promise.resolve().then(() => __toESM(require("./commands/build")));
|
|
77
|
+
await build(api, options);
|
|
78
|
+
});
|
|
79
|
+
for (const platformBuilder of platformBuilders) {
|
|
80
|
+
const platforms = (0, import_lodash.castArray)(platformBuilder.platform);
|
|
81
|
+
for (const platform of platforms) {
|
|
82
|
+
buildProgram.command(platform).action(async () => {
|
|
83
|
+
const { appDirectory } = api.useAppContext();
|
|
84
|
+
const { isTypescript } = await Promise.resolve().then(() => __toESM(require("@modern-js/utils")));
|
|
85
|
+
await runner.beforeBuildPlatform(platformBuilders);
|
|
86
|
+
await platformBuilder.build(platform, {
|
|
87
|
+
isTsProject: isTypescript(appDirectory)
|
|
88
|
+
});
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
var src_default = (options = {
|
|
94
|
+
bundler: "webpack"
|
|
95
|
+
}) => ({
|
|
96
|
+
name: "@modern-js/app-tools",
|
|
97
|
+
post: [
|
|
98
|
+
"@modern-js/plugin-initialize",
|
|
99
|
+
"@modern-js/plugin-analyze",
|
|
100
|
+
"@modern-js/plugin-ssr",
|
|
101
|
+
"@modern-js/plugin-document",
|
|
102
|
+
"@modern-js/plugin-state",
|
|
103
|
+
"@modern-js/plugin-router",
|
|
104
|
+
"@modern-js/plugin-router-v5",
|
|
105
|
+
"@modern-js/plugin-polyfill"
|
|
106
|
+
],
|
|
107
|
+
registerHook: import_hooks.hooks,
|
|
108
|
+
usePlugins: [
|
|
109
|
+
(0, import_initialize.default)({
|
|
110
|
+
bundler: (options == null ? void 0 : options.bundler) === "experimental-rspack" ? "rspack" : "webpack"
|
|
111
|
+
}),
|
|
112
|
+
(0, import_analyze.default)({
|
|
113
|
+
bundler: (options == null ? void 0 : options.bundler) === "experimental-rspack" ? "rspack" : "webpack"
|
|
114
|
+
}),
|
|
115
|
+
(0, import_plugin_lint.default)()
|
|
116
|
+
],
|
|
117
|
+
setup: (api) => {
|
|
118
|
+
const locale = (0, import_language.getLocaleLanguage)();
|
|
119
|
+
import_locale.i18n.changeLanguage({ locale });
|
|
120
|
+
return {
|
|
121
|
+
async commands({ program }) {
|
|
122
|
+
await devCommand(program, api);
|
|
123
|
+
await buildCommand(program, api);
|
|
124
|
+
program.command("serve").usage("[options]").description(import_locale.i18n.t(import_locale.localeKeys.command.serve.describe)).option("--api-only", import_locale.i18n.t(import_locale.localeKeys.command.dev.apiOnly)).option(
|
|
125
|
+
"-c --config <config>",
|
|
126
|
+
import_locale.i18n.t(import_locale.localeKeys.command.shared.config)
|
|
127
|
+
).action(async () => {
|
|
128
|
+
const { start } = await Promise.resolve().then(() => __toESM(require("./commands/serve")));
|
|
129
|
+
await start(api);
|
|
130
|
+
});
|
|
131
|
+
program.command("deploy").usage("[options]").option(
|
|
132
|
+
"-c --config <config>",
|
|
133
|
+
import_locale.i18n.t(import_locale.localeKeys.command.shared.config)
|
|
134
|
+
).description(import_locale.i18n.t(import_locale.localeKeys.command.deploy.describe)).action(async (options2) => {
|
|
135
|
+
const { build } = await Promise.resolve().then(() => __toESM(require("./commands/build")));
|
|
136
|
+
await build(api);
|
|
137
|
+
const { deploy } = await Promise.resolve().then(() => __toESM(require("./commands/deploy")));
|
|
138
|
+
await deploy(api, options2);
|
|
139
|
+
process.exit(0);
|
|
140
|
+
});
|
|
141
|
+
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(
|
|
142
|
+
"-c, --config <config>",
|
|
143
|
+
import_locale.i18n.t(import_locale.localeKeys.command.new.config)
|
|
144
|
+
).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(async (options2) => {
|
|
145
|
+
const { MWANewAction } = await Promise.resolve().then(() => __toESM(require("@modern-js/new-action")));
|
|
146
|
+
await MWANewAction({ ...options2, locale: options2.lang || locale });
|
|
147
|
+
});
|
|
148
|
+
program.command("inspect").description("inspect internal webpack config").option(
|
|
149
|
+
`--env <env>`,
|
|
150
|
+
import_locale.i18n.t(import_locale.localeKeys.command.inspect.env),
|
|
151
|
+
"development"
|
|
152
|
+
).option(
|
|
153
|
+
"--output <output>",
|
|
154
|
+
import_locale.i18n.t(import_locale.localeKeys.command.inspect.output),
|
|
155
|
+
"/"
|
|
156
|
+
).option("--verbose", import_locale.i18n.t(import_locale.localeKeys.command.inspect.verbose)).option(
|
|
157
|
+
"-c --config <config>",
|
|
158
|
+
import_locale.i18n.t(import_locale.localeKeys.command.shared.config)
|
|
159
|
+
).action(async (options2) => {
|
|
160
|
+
const { inspect } = await Promise.resolve().then(() => __toESM(require("./commands/inspect")));
|
|
161
|
+
inspect(api, options2);
|
|
162
|
+
});
|
|
163
|
+
upgradeModel.defineCommand(program.command("upgrade"));
|
|
164
|
+
},
|
|
165
|
+
async prepare() {
|
|
166
|
+
const command = (0, import_utils.getCommand)();
|
|
167
|
+
if (command === "dev" || command === "start" || command === "build") {
|
|
168
|
+
const appContext = api.useAppContext();
|
|
169
|
+
await (0, import_utils.emptyDir)(appContext.distDirectory);
|
|
170
|
+
}
|
|
171
|
+
},
|
|
172
|
+
async watchFiles() {
|
|
173
|
+
const appContext = api.useAppContext();
|
|
174
|
+
const config = api.useResolvedConfigContext();
|
|
175
|
+
return (0, import_generateWatchFiles.generateWatchFiles)(appContext, config.source.configDir);
|
|
176
|
+
},
|
|
177
|
+
async fileChange(e) {
|
|
178
|
+
const { filename, eventType } = e;
|
|
179
|
+
const appContext = api.useAppContext();
|
|
180
|
+
const { appDirectory, srcDirectory } = appContext;
|
|
181
|
+
const absolutePath = import_path.default.resolve(appDirectory, filename);
|
|
182
|
+
if (!absolutePath.includes(srcDirectory) && (eventType === "change" || eventType === "unlink")) {
|
|
183
|
+
const { closeServer } = await Promise.resolve().then(() => __toESM(require("./utils/createServer")));
|
|
184
|
+
await closeServer();
|
|
185
|
+
await (0, import_restart.restart)(api.useHookRunners(), filename);
|
|
186
|
+
}
|
|
187
|
+
},
|
|
188
|
+
async beforeRestart() {
|
|
189
|
+
(0, import_utils.cleanRequireCache)([require.resolve("./analyze")]);
|
|
190
|
+
}
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
});
|
|
194
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
195
|
+
0 && (module.exports = {
|
|
196
|
+
buildCommand,
|
|
197
|
+
devCommand
|
|
198
|
+
});
|