@modern-js/app-tools 2.3.1-alpha.2 → 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 +115 -0
- package/README.md +14 -18
- 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/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/{js/node/builder/webpackPlugins/routerPlugin.js → cjs/builder/builder-webpack/webpackPlugins/RouterPlugin.js} +14 -29
- package/dist/cjs/builder/builder-webpack/webpackPlugins/index.js +17 -0
- package/dist/cjs/builder/generator/createBuilderOptions.js +47 -0
- package/dist/{js/node/config/initial/index.js → cjs/builder/generator/createBuilderProviderConfig.js} +26 -18
- 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/{js/node/builder/builderPlugins/compatModern.js → cjs/builder/shared/builderPlugins/adapterModern.js} +109 -137
- 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/{js/node/utils → 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 +16 -27
- package/dist/cjs/config/index.js +19 -0
- package/dist/cjs/config/initialize/index.js +35 -0
- package/dist/{js/node/config/initial → cjs/config/initialize}/inits.js +8 -22
- 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/{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 +1 -1
- 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/cjs/types/utils.js +15 -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/{js/node/config/index.js → cjs/utils/getServerInternalPlugins.js} +20 -13
- 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/cjs/utils/types.js +15 -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 +142 -137
- 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/esm/builder/builder-rspack/index.js +6 -0
- package/dist/esm/builder/builder-webpack/builderPlugins/compatModern.js +64 -0
- package/dist/{js/treeshaking/builder → esm/builder/builder-webpack}/index.js +44 -117
- package/dist/{js/treeshaking/builder/webpackPlugins/routerPlugin.js → esm/builder/builder-webpack/webpackPlugins/RouterPlugin.js} +6 -3
- 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/{js/treeshaking/builder/builderPlugins/compatModern.js → esm/builder/shared/builderPlugins/adapterModern.js} +138 -142
- package/dist/{js/treeshaking/builder/webpackPlugins/htmlAsyncChunkPlugin.js → esm/builder/shared/bundlerPlugins/HtmlAsyncChunkPlugin.js} +0 -0
- package/dist/{js/treeshaking/builder/webpackPlugins/htmlBottomTemplate.js → esm/builder/shared/bundlerPlugins/HtmlBottomTemplate.js} +2 -2
- 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/{js/treeshaking/utils → 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 +2 -2
- package/dist/esm/config/index.js +3 -0
- package/dist/esm/config/initialize/index.js +10 -0
- package/dist/{js/treeshaking/config/initial → esm/config/initialize}/inits.js +6 -4
- package/dist/esm/config/legacy/createHtmlConfig.js +19 -0
- package/dist/{js/treeshaking/config/initial → esm/config/legacy}/createOutputConfig.js +1 -1
- package/dist/{js/treeshaking/config/initial → esm/config/legacy}/createSourceConfig.js +1 -1
- package/dist/{js/treeshaking/config/initial → esm/config/legacy}/createToolsConfig.js +1 -1
- package/dist/{js/treeshaking/config/initial/transformNormalizedConfig.js → esm/config/legacy/index.js} +4 -1
- 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 +19 -12
- package/dist/{js/treeshaking → esm}/initialize/index.js +36 -28
- 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 +1 -1
- 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/esm/types/utils.js +1 -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/esm/utils/types.js +1 -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/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/{js/modern/builder/webpackPlugins/routerPlugin.js → esm-node/builder/builder-webpack/webpackPlugins/RouterPlugin.js} +8 -25
- 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/{js/modern/builder/builderPlugins/compatModern.js → esm-node/builder/shared/builderPlugins/adapterModern.js} +104 -135
- 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/{js/modern/utils → 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 +16 -29
- package/dist/esm-node/config/index.js +3 -0
- package/dist/esm-node/config/initialize/index.js +12 -0
- package/dist/{js/modern/config/initial → esm-node/config/initialize}/inits.js +8 -24
- 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/{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 +1 -1
- 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/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/esm-node/utils/types.js +0 -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/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/analyze/generateCode.js +0 -247
- package/dist/js/modern/analyze/index.js +0 -332
- package/dist/js/modern/builder/index.js +0 -159
- package/dist/js/modern/builder/webpackPlugins/htmlAsyncChunkPlugin.js +0 -30
- package/dist/js/modern/builder/webpackPlugins/htmlBottomTemplate.js +0 -37
- 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/config/index.js +0 -8
- package/dist/js/modern/config/initial/index.js +0 -16
- package/dist/js/modern/defineConfig.js +0 -27
- package/dist/js/modern/index.js +0 -211
- package/dist/js/modern/initialize/index.js +0 -124
- 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 -339
- package/dist/js/node/builder/index.js +0 -177
- package/dist/js/node/commands/deploy.js +0 -51
- package/dist/js/node/defineConfig.js +0 -49
- package/dist/js/node/index.js +0 -235
- package/dist/js/node/initialize/index.js +0 -134
- package/dist/js/node/utils/getServerInternalPlugins.js +0 -79
- package/dist/js/node/utils/restart.js +0 -67
- package/dist/js/treeshaking/config/index.js +0 -3
- package/dist/js/treeshaking/config/initial/createHtmlConfig.js +0 -19
- 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
|
@@ -1,177 +0,0 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __defProps = Object.defineProperties;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
6
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
8
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
9
|
-
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
|
-
var __export = (target, all) => {
|
|
25
|
-
for (var name in all)
|
|
26
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
27
|
-
};
|
|
28
|
-
var __copyProps = (to, from, except, desc) => {
|
|
29
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
30
|
-
for (let key of __getOwnPropNames(from))
|
|
31
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
32
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
33
|
-
}
|
|
34
|
-
return to;
|
|
35
|
-
};
|
|
36
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
37
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
38
|
-
mod
|
|
39
|
-
));
|
|
40
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
41
|
-
var __async = (__this, __arguments, generator) => {
|
|
42
|
-
return new Promise((resolve, reject) => {
|
|
43
|
-
var fulfilled = (value) => {
|
|
44
|
-
try {
|
|
45
|
-
step(generator.next(value));
|
|
46
|
-
} catch (e) {
|
|
47
|
-
reject(e);
|
|
48
|
-
}
|
|
49
|
-
};
|
|
50
|
-
var rejected = (value) => {
|
|
51
|
-
try {
|
|
52
|
-
step(generator.throw(value));
|
|
53
|
-
} catch (e) {
|
|
54
|
-
reject(e);
|
|
55
|
-
}
|
|
56
|
-
};
|
|
57
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
58
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
59
|
-
});
|
|
60
|
-
};
|
|
61
|
-
var builder_exports = {};
|
|
62
|
-
__export(builder_exports, {
|
|
63
|
-
createBuilderForModern: () => createBuilderForModern,
|
|
64
|
-
createBuilderOptions: () => createBuilderOptions,
|
|
65
|
-
createBuilderProviderConfig: () => createBuilderProviderConfig
|
|
66
|
-
});
|
|
67
|
-
module.exports = __toCommonJS(builder_exports);
|
|
68
|
-
var import_builder = require("@modern-js/builder");
|
|
69
|
-
var import_builder_webpack_provider = require("@modern-js/builder-webpack-provider");
|
|
70
|
-
var import_utils = require("@modern-js/utils");
|
|
71
|
-
var import_compatModern = require("./builderPlugins/compatModern");
|
|
72
|
-
var import_share = require("./share");
|
|
73
|
-
function getBuilderTargets(normalizedConfig) {
|
|
74
|
-
const targets = ["web"];
|
|
75
|
-
const useNodeTarget = (0, import_utils.isProd)() ? (0, import_utils.isUseSSRBundle)(normalizedConfig) : (0, import_utils.isSSR)(normalizedConfig);
|
|
76
|
-
if (useNodeTarget) {
|
|
77
|
-
targets.push("node");
|
|
78
|
-
}
|
|
79
|
-
return targets;
|
|
80
|
-
}
|
|
81
|
-
function createBuilderForModern(_0) {
|
|
82
|
-
return __async(this, arguments, function* ({
|
|
83
|
-
normalizedConfig,
|
|
84
|
-
appContext,
|
|
85
|
-
compatPluginConfig
|
|
86
|
-
}) {
|
|
87
|
-
const builderConfig = createBuilderProviderConfig(
|
|
88
|
-
normalizedConfig,
|
|
89
|
-
appContext
|
|
90
|
-
);
|
|
91
|
-
const webpackProvider = (0, import_builder_webpack_provider.builderWebpackProvider)({
|
|
92
|
-
builderConfig
|
|
93
|
-
});
|
|
94
|
-
const target = getBuilderTargets(normalizedConfig);
|
|
95
|
-
const builderOptions = createBuilderOptions(target, appContext);
|
|
96
|
-
const builder = yield (0, import_builder.createBuilder)(webpackProvider, builderOptions);
|
|
97
|
-
yield applyBuilderPlugins(
|
|
98
|
-
builder,
|
|
99
|
-
normalizedConfig,
|
|
100
|
-
appContext,
|
|
101
|
-
compatPluginConfig
|
|
102
|
-
);
|
|
103
|
-
return builder;
|
|
104
|
-
});
|
|
105
|
-
}
|
|
106
|
-
function createBuilderProviderConfig(normalizedConfig, appContext) {
|
|
107
|
-
const output = createOutputConfig(normalizedConfig, appContext);
|
|
108
|
-
const htmlConfig = __spreadValues({}, normalizedConfig.html);
|
|
109
|
-
if (!htmlConfig.template) {
|
|
110
|
-
htmlConfig.templateByEntries = __spreadValues(__spreadValues({}, htmlConfig.templateByEntries), appContext.htmlTemplates);
|
|
111
|
-
}
|
|
112
|
-
return __spreadProps(__spreadValues({}, normalizedConfig), {
|
|
113
|
-
output,
|
|
114
|
-
dev: __spreadProps(__spreadValues({}, normalizedConfig.dev), {
|
|
115
|
-
port: appContext.port
|
|
116
|
-
}),
|
|
117
|
-
html: htmlConfig
|
|
118
|
-
});
|
|
119
|
-
function createOutputConfig(config, appContext2) {
|
|
120
|
-
const defaultCopyPattern = (0, import_share.createCopyPattern)(appContext2, config, "upload");
|
|
121
|
-
const { copy } = config.output;
|
|
122
|
-
const copyOptions = Array.isArray(copy) ? copy : copy == null ? void 0 : copy.patterns;
|
|
123
|
-
const builderCopy = [...copyOptions || [], defaultCopyPattern];
|
|
124
|
-
return __spreadProps(__spreadValues({}, config.output), {
|
|
125
|
-
copy: builderCopy,
|
|
126
|
-
cleanDistPath: false
|
|
127
|
-
});
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
function createBuilderOptions(target, appContext) {
|
|
131
|
-
const entries = {};
|
|
132
|
-
const { entrypoints = [], checkedEntries } = appContext;
|
|
133
|
-
for (const { entryName, entry } of entrypoints) {
|
|
134
|
-
if (checkedEntries && !checkedEntries.includes(entryName)) {
|
|
135
|
-
continue;
|
|
136
|
-
}
|
|
137
|
-
if (entryName in entries) {
|
|
138
|
-
entries[entryName].push(entry);
|
|
139
|
-
} else {
|
|
140
|
-
entries[entryName] = [entry];
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
return {
|
|
144
|
-
cwd: appContext.appDirectory,
|
|
145
|
-
target,
|
|
146
|
-
configPath: appContext.configFile || void 0,
|
|
147
|
-
entry: entries,
|
|
148
|
-
framework: appContext.metaName
|
|
149
|
-
};
|
|
150
|
-
}
|
|
151
|
-
function applyBuilderPlugins(builder, normalizedConfig, appContext, compatPluginConfig) {
|
|
152
|
-
return __async(this, null, function* () {
|
|
153
|
-
if (!normalizedConfig.output.disableNodePolyfill) {
|
|
154
|
-
const { builderPluginNodePolyfill } = yield Promise.resolve().then(() => __toESM(require("@modern-js/builder-plugin-node-polyfill")));
|
|
155
|
-
builder.addPlugins([builderPluginNodePolyfill()]);
|
|
156
|
-
}
|
|
157
|
-
if (normalizedConfig.tools.esbuild) {
|
|
158
|
-
const { esbuild: esbuildOptions } = normalizedConfig.tools;
|
|
159
|
-
const { builderPluginEsbuild } = yield Promise.resolve().then(() => __toESM(require("@modern-js/builder-plugin-esbuild")));
|
|
160
|
-
builder.addPlugins([
|
|
161
|
-
builderPluginEsbuild({
|
|
162
|
-
loader: false,
|
|
163
|
-
minimize: (0, import_utils.applyOptionsChain)({}, esbuildOptions)
|
|
164
|
-
})
|
|
165
|
-
]);
|
|
166
|
-
}
|
|
167
|
-
builder.addPlugins([
|
|
168
|
-
(0, import_compatModern.PluginCompatModern)(appContext, normalizedConfig, compatPluginConfig)
|
|
169
|
-
]);
|
|
170
|
-
});
|
|
171
|
-
}
|
|
172
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
173
|
-
0 && (module.exports = {
|
|
174
|
-
createBuilderForModern,
|
|
175
|
-
createBuilderOptions,
|
|
176
|
-
createBuilderProviderConfig
|
|
177
|
-
});
|
|
@@ -1,51 +0,0 @@
|
|
|
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 __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
|
-
var deploy_exports = {};
|
|
39
|
-
__export(deploy_exports, {
|
|
40
|
-
deploy: () => deploy
|
|
41
|
-
});
|
|
42
|
-
module.exports = __toCommonJS(deploy_exports);
|
|
43
|
-
const deploy = (api, options) => __async(void 0, null, function* () {
|
|
44
|
-
const hookRunners = api.useHookRunners();
|
|
45
|
-
yield hookRunners.beforeDeploy(options);
|
|
46
|
-
yield hookRunners.afterDeploy(options);
|
|
47
|
-
});
|
|
48
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
49
|
-
0 && (module.exports = {
|
|
50
|
-
deploy
|
|
51
|
-
});
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __defProps = Object.defineProperties;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
7
|
-
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
|
-
var __export = (target, all) => {
|
|
23
|
-
for (var name in all)
|
|
24
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
25
|
-
};
|
|
26
|
-
var __copyProps = (to, from, except, desc) => {
|
|
27
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
28
|
-
for (let key of __getOwnPropNames(from))
|
|
29
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
30
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
31
|
-
}
|
|
32
|
-
return to;
|
|
33
|
-
};
|
|
34
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
35
|
-
var defineConfig_exports = {};
|
|
36
|
-
__export(defineConfig_exports, {
|
|
37
|
-
defineConfig: () => defineConfig,
|
|
38
|
-
defineLegacyConfig: () => defineLegacyConfig
|
|
39
|
-
});
|
|
40
|
-
module.exports = __toCommonJS(defineConfig_exports);
|
|
41
|
-
const defineConfig = (config) => config;
|
|
42
|
-
const defineLegacyConfig = (config) => __spreadProps(__spreadValues({}, config), {
|
|
43
|
-
legacy: true
|
|
44
|
-
});
|
|
45
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
46
|
-
0 && (module.exports = {
|
|
47
|
-
defineConfig,
|
|
48
|
-
defineLegacyConfig
|
|
49
|
-
});
|
package/dist/js/node/index.js
DELETED
|
@@ -1,235 +0,0 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __defProps = Object.defineProperties;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
6
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
8
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
9
|
-
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
|
-
var __export = (target, all) => {
|
|
25
|
-
for (var name in all)
|
|
26
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
27
|
-
};
|
|
28
|
-
var __copyProps = (to, from, except, desc) => {
|
|
29
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
30
|
-
for (let key of __getOwnPropNames(from))
|
|
31
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
32
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
33
|
-
}
|
|
34
|
-
return to;
|
|
35
|
-
};
|
|
36
|
-
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
37
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
38
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
39
|
-
mod
|
|
40
|
-
));
|
|
41
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
42
|
-
var __async = (__this, __arguments, generator) => {
|
|
43
|
-
return new Promise((resolve, reject) => {
|
|
44
|
-
var fulfilled = (value) => {
|
|
45
|
-
try {
|
|
46
|
-
step(generator.next(value));
|
|
47
|
-
} catch (e) {
|
|
48
|
-
reject(e);
|
|
49
|
-
}
|
|
50
|
-
};
|
|
51
|
-
var rejected = (value) => {
|
|
52
|
-
try {
|
|
53
|
-
step(generator.throw(value));
|
|
54
|
-
} catch (e) {
|
|
55
|
-
reject(e);
|
|
56
|
-
}
|
|
57
|
-
};
|
|
58
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
59
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
60
|
-
});
|
|
61
|
-
};
|
|
62
|
-
var src_exports = {};
|
|
63
|
-
__export(src_exports, {
|
|
64
|
-
buildCommand: () => buildCommand,
|
|
65
|
-
default: () => src_default,
|
|
66
|
-
devCommand: () => devCommand
|
|
67
|
-
});
|
|
68
|
-
module.exports = __toCommonJS(src_exports);
|
|
69
|
-
var import_path = __toESM(require("path"));
|
|
70
|
-
var import_plugin_lint = __toESM(require("@modern-js/plugin-lint"));
|
|
71
|
-
var import_utils = require("@modern-js/utils");
|
|
72
|
-
var import_lodash = require("@modern-js/utils/lodash");
|
|
73
|
-
var import_analyze = __toESM(require("./analyze"));
|
|
74
|
-
var import_initialize = __toESM(require("./initialize"));
|
|
75
|
-
var import_hooks = require("./hooks");
|
|
76
|
-
var import_locale = require("./locale");
|
|
77
|
-
var import_language = require("./utils/language");
|
|
78
|
-
var import_restart = require("./utils/restart");
|
|
79
|
-
var import_generateWatchFiles = require("./utils/generateWatchFiles");
|
|
80
|
-
__reExport(src_exports, require("./defineConfig"), module.exports);
|
|
81
|
-
__reExport(src_exports, require("./types"), module.exports);
|
|
82
|
-
const upgradeModel = import_utils.Import.lazy(
|
|
83
|
-
"@modern-js/upgrade",
|
|
84
|
-
require
|
|
85
|
-
);
|
|
86
|
-
const devCommand = (program, api) => __async(void 0, null, function* () {
|
|
87
|
-
const runner = api.useHookRunners();
|
|
88
|
-
const devToolMetas = yield runner.registerDev();
|
|
89
|
-
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((options) => __async(void 0, null, function* () {
|
|
90
|
-
const { dev } = yield Promise.resolve().then(() => __toESM(require("./commands/dev")));
|
|
91
|
-
yield dev(api, options);
|
|
92
|
-
}));
|
|
93
|
-
for (const meta of devToolMetas) {
|
|
94
|
-
if (!meta.subCommands) {
|
|
95
|
-
continue;
|
|
96
|
-
}
|
|
97
|
-
for (const subCmd of meta.subCommands) {
|
|
98
|
-
devProgram.command(subCmd).action((..._0) => __async(void 0, [..._0], function* (options = {}) {
|
|
99
|
-
const { appDirectory } = api.useAppContext();
|
|
100
|
-
const { isTypescript } = yield Promise.resolve().then(() => __toESM(require("@modern-js/utils")));
|
|
101
|
-
yield runner.beforeDevTask(meta);
|
|
102
|
-
yield meta.action(options, {
|
|
103
|
-
isTsProject: isTypescript(appDirectory)
|
|
104
|
-
});
|
|
105
|
-
}));
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
});
|
|
109
|
-
const buildCommand = (program, api) => __async(void 0, null, function* () {
|
|
110
|
-
const runner = api.useHookRunners();
|
|
111
|
-
const platformBuilders = yield runner.registerBuildPlatform();
|
|
112
|
-
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((options) => __async(void 0, null, function* () {
|
|
113
|
-
const { build } = yield Promise.resolve().then(() => __toESM(require("./commands/build")));
|
|
114
|
-
yield build(api, options);
|
|
115
|
-
}));
|
|
116
|
-
for (const platformBuilder of platformBuilders) {
|
|
117
|
-
const platforms = (0, import_lodash.castArray)(platformBuilder.platform);
|
|
118
|
-
for (const platform of platforms) {
|
|
119
|
-
buildProgram.command(platform).action(() => __async(void 0, null, function* () {
|
|
120
|
-
const { appDirectory } = api.useAppContext();
|
|
121
|
-
const { isTypescript } = yield Promise.resolve().then(() => __toESM(require("@modern-js/utils")));
|
|
122
|
-
yield runner.beforeBuildPlatform(platformBuilders);
|
|
123
|
-
yield platformBuilder.build(platform, {
|
|
124
|
-
isTsProject: isTypescript(appDirectory)
|
|
125
|
-
});
|
|
126
|
-
}));
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
});
|
|
130
|
-
var src_default = () => ({
|
|
131
|
-
name: "@modern-js/app-tools",
|
|
132
|
-
post: [
|
|
133
|
-
"@modern-js/plugin-initialize",
|
|
134
|
-
"@modern-js/plugin-analyze",
|
|
135
|
-
"@modern-js/plugin-ssr",
|
|
136
|
-
"@modern-js/plugin-document",
|
|
137
|
-
"@modern-js/plugin-state",
|
|
138
|
-
"@modern-js/plugin-router",
|
|
139
|
-
"@modern-js/plugin-router-v5",
|
|
140
|
-
"@modern-js/plugin-polyfill"
|
|
141
|
-
],
|
|
142
|
-
registerHook: import_hooks.hooks,
|
|
143
|
-
usePlugins: [(0, import_initialize.default)(), (0, import_analyze.default)(), (0, import_plugin_lint.default)()],
|
|
144
|
-
setup: (api) => {
|
|
145
|
-
const locale = (0, import_language.getLocaleLanguage)();
|
|
146
|
-
import_locale.i18n.changeLanguage({ locale });
|
|
147
|
-
return {
|
|
148
|
-
commands(_0) {
|
|
149
|
-
return __async(this, arguments, function* ({ program }) {
|
|
150
|
-
yield devCommand(program, api);
|
|
151
|
-
yield buildCommand(program, api);
|
|
152
|
-
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(
|
|
153
|
-
"-c --config <config>",
|
|
154
|
-
import_locale.i18n.t(import_locale.localeKeys.command.shared.config)
|
|
155
|
-
).action(() => __async(this, null, function* () {
|
|
156
|
-
const { start } = yield Promise.resolve().then(() => __toESM(require("./commands/serve")));
|
|
157
|
-
yield start(api);
|
|
158
|
-
}));
|
|
159
|
-
program.command("deploy").usage("[options]").option(
|
|
160
|
-
"-c --config <config>",
|
|
161
|
-
import_locale.i18n.t(import_locale.localeKeys.command.shared.config)
|
|
162
|
-
).description(import_locale.i18n.t(import_locale.localeKeys.command.deploy.describe)).action((options) => __async(this, null, function* () {
|
|
163
|
-
const { build } = yield Promise.resolve().then(() => __toESM(require("./commands/build")));
|
|
164
|
-
yield build(api);
|
|
165
|
-
const { deploy } = yield Promise.resolve().then(() => __toESM(require("./commands/deploy")));
|
|
166
|
-
yield deploy(api, options);
|
|
167
|
-
process.exit(0);
|
|
168
|
-
}));
|
|
169
|
-
program.command("new").usage("[options]").description(import_locale.i18n.t(import_locale.localeKeys.command.new.describe)).option("--lang <lang>", import_locale.i18n.t(import_locale.localeKeys.command.new.lang)).option("-d, --debug", import_locale.i18n.t(import_locale.localeKeys.command.new.debug), false).option(
|
|
170
|
-
"-c, --config <config>",
|
|
171
|
-
import_locale.i18n.t(import_locale.localeKeys.command.new.config)
|
|
172
|
-
).option("--dist-tag <tag>", import_locale.i18n.t(import_locale.localeKeys.command.new.distTag)).option("--registry", import_locale.i18n.t(import_locale.localeKeys.command.new.registry)).action((options) => __async(this, null, function* () {
|
|
173
|
-
const { MWANewAction } = yield Promise.resolve().then(() => __toESM(require("@modern-js/new-action")));
|
|
174
|
-
yield MWANewAction(__spreadProps(__spreadValues({}, options), { locale: options.lang || locale }));
|
|
175
|
-
}));
|
|
176
|
-
program.command("inspect").description("inspect internal webpack config").option(
|
|
177
|
-
`--env <env>`,
|
|
178
|
-
import_locale.i18n.t(import_locale.localeKeys.command.inspect.env),
|
|
179
|
-
"development"
|
|
180
|
-
).option(
|
|
181
|
-
"--output <output>",
|
|
182
|
-
import_locale.i18n.t(import_locale.localeKeys.command.inspect.output),
|
|
183
|
-
"/"
|
|
184
|
-
).option("--verbose", import_locale.i18n.t(import_locale.localeKeys.command.inspect.verbose)).option(
|
|
185
|
-
"-c --config <config>",
|
|
186
|
-
import_locale.i18n.t(import_locale.localeKeys.command.shared.config)
|
|
187
|
-
).action((options) => __async(this, null, function* () {
|
|
188
|
-
const { inspect } = yield Promise.resolve().then(() => __toESM(require("./commands/inspect")));
|
|
189
|
-
inspect(api, options);
|
|
190
|
-
}));
|
|
191
|
-
upgradeModel.defineCommand(program.command("upgrade"));
|
|
192
|
-
});
|
|
193
|
-
},
|
|
194
|
-
prepare() {
|
|
195
|
-
return __async(this, null, function* () {
|
|
196
|
-
const command = (0, import_utils.getCommand)();
|
|
197
|
-
if (command === "dev" || command === "start" || command === "build") {
|
|
198
|
-
const appContext = api.useAppContext();
|
|
199
|
-
yield (0, import_utils.emptyDir)(appContext.distDirectory);
|
|
200
|
-
}
|
|
201
|
-
});
|
|
202
|
-
},
|
|
203
|
-
watchFiles() {
|
|
204
|
-
return __async(this, null, function* () {
|
|
205
|
-
const appContext = api.useAppContext();
|
|
206
|
-
const config = api.useResolvedConfigContext();
|
|
207
|
-
return (0, import_generateWatchFiles.generateWatchFiles)(appContext, config.source.configDir);
|
|
208
|
-
});
|
|
209
|
-
},
|
|
210
|
-
fileChange(e) {
|
|
211
|
-
return __async(this, null, function* () {
|
|
212
|
-
const { filename, eventType } = e;
|
|
213
|
-
const appContext = api.useAppContext();
|
|
214
|
-
const { appDirectory, srcDirectory } = appContext;
|
|
215
|
-
const absolutePath = import_path.default.resolve(appDirectory, filename);
|
|
216
|
-
if (!absolutePath.includes(srcDirectory) && (eventType === "change" || eventType === "unlink")) {
|
|
217
|
-
const { closeServer } = yield Promise.resolve().then(() => __toESM(require("./utils/createServer")));
|
|
218
|
-
yield closeServer();
|
|
219
|
-
yield (0, import_restart.restart)(api.useHookRunners(), filename);
|
|
220
|
-
}
|
|
221
|
-
});
|
|
222
|
-
},
|
|
223
|
-
beforeRestart() {
|
|
224
|
-
return __async(this, null, function* () {
|
|
225
|
-
(0, import_utils.cleanRequireCache)([require.resolve("./analyze")]);
|
|
226
|
-
});
|
|
227
|
-
}
|
|
228
|
-
};
|
|
229
|
-
}
|
|
230
|
-
});
|
|
231
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
232
|
-
0 && (module.exports = {
|
|
233
|
-
buildCommand,
|
|
234
|
-
devCommand
|
|
235
|
-
});
|
|
@@ -1,134 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __defProps = Object.defineProperties;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
7
|
-
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
|
-
var __export = (target, all) => {
|
|
23
|
-
for (var name in all)
|
|
24
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
25
|
-
};
|
|
26
|
-
var __copyProps = (to, from, except, desc) => {
|
|
27
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
28
|
-
for (let key of __getOwnPropNames(from))
|
|
29
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
30
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
31
|
-
}
|
|
32
|
-
return to;
|
|
33
|
-
};
|
|
34
|
-
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
|
-
var initialize_exports = {};
|
|
56
|
-
__export(initialize_exports, {
|
|
57
|
-
default: () => initialize_default
|
|
58
|
-
});
|
|
59
|
-
module.exports = __toCommonJS(initialize_exports);
|
|
60
|
-
var import_utils = require("@modern-js/utils");
|
|
61
|
-
var import_schema = require("../schema");
|
|
62
|
-
var import_transformNormalizedConfig = require("../config/initial/transformNormalizedConfig");
|
|
63
|
-
var import_config = require("../config");
|
|
64
|
-
var initialize_default = () => ({
|
|
65
|
-
name: "@modern-js/plugin-initialize",
|
|
66
|
-
setup(api) {
|
|
67
|
-
const config = () => {
|
|
68
|
-
const appContext = api.useAppContext();
|
|
69
|
-
const userConfig = api.useConfigContext();
|
|
70
|
-
return (0, import_config.checkIsLegacyConfig)(userConfig) ? (0, import_config.createLegacyDefaultConfig)(appContext) : (0, import_config.createDefaultConfig)(appContext);
|
|
71
|
-
};
|
|
72
|
-
const validateSchema = () => {
|
|
73
|
-
const userConfig = api.useConfigContext();
|
|
74
|
-
const schemas = (0, import_config.checkIsLegacyConfig)(userConfig) ? import_schema.legacySchema : import_schema.schema;
|
|
75
|
-
return schemas.generate();
|
|
76
|
-
};
|
|
77
|
-
return {
|
|
78
|
-
config,
|
|
79
|
-
validateSchema,
|
|
80
|
-
resolvedConfig(_0) {
|
|
81
|
-
return __async(this, arguments, function* ({ resolved }) {
|
|
82
|
-
var _a2;
|
|
83
|
-
let appContext = api.useAppContext();
|
|
84
|
-
const userConfig = api.useConfigContext();
|
|
85
|
-
const port = yield getServerPort(resolved);
|
|
86
|
-
appContext = __spreadProps(__spreadValues({}, appContext), {
|
|
87
|
-
port,
|
|
88
|
-
distDirectory: (0, import_utils.ensureAbsolutePath)(
|
|
89
|
-
appContext.distDirectory,
|
|
90
|
-
((_a2 = resolved.output.distPath) == null ? void 0 : _a2.root) || "dist"
|
|
91
|
-
)
|
|
92
|
-
});
|
|
93
|
-
api.setAppContext(appContext);
|
|
94
|
-
const normalizedConfig = (0, import_config.checkIsLegacyConfig)(resolved) ? (0, import_transformNormalizedConfig.transformNormalizedConfig)(resolved) : resolved;
|
|
95
|
-
return {
|
|
96
|
-
resolved: {
|
|
97
|
-
_raw: userConfig,
|
|
98
|
-
source: normalizedConfig.source || {},
|
|
99
|
-
server: __spreadProps(__spreadValues({}, normalizedConfig.server || {}), {
|
|
100
|
-
port
|
|
101
|
-
}),
|
|
102
|
-
bff: normalizedConfig.bff || {},
|
|
103
|
-
dev: normalizedConfig.dev || {},
|
|
104
|
-
html: normalizedConfig.html || {},
|
|
105
|
-
output: normalizedConfig.output || {},
|
|
106
|
-
security: normalizedConfig.security || {},
|
|
107
|
-
tools: normalizedConfig.tools || {},
|
|
108
|
-
testing: normalizedConfig.testing || {},
|
|
109
|
-
plugins: normalizedConfig.plugins || [],
|
|
110
|
-
builderPlugins: normalizedConfig.builderPlugins || [],
|
|
111
|
-
runtime: normalizedConfig.runtime || {},
|
|
112
|
-
runtimeByEntries: normalizedConfig.runtimeByEntries || {},
|
|
113
|
-
deploy: normalizedConfig.deploy || {},
|
|
114
|
-
performance: normalizedConfig.performance || {},
|
|
115
|
-
experiments: normalizedConfig.experiments || {},
|
|
116
|
-
autoLoadPlugins: normalizedConfig.autoLoadPlugins || false
|
|
117
|
-
}
|
|
118
|
-
};
|
|
119
|
-
});
|
|
120
|
-
}
|
|
121
|
-
};
|
|
122
|
-
}
|
|
123
|
-
});
|
|
124
|
-
function getServerPort(config) {
|
|
125
|
-
return __async(this, null, function* () {
|
|
126
|
-
const prodPort = config.server.port || 8080;
|
|
127
|
-
if ((0, import_utils.isDev)() && (0, import_utils.isDevCommand)()) {
|
|
128
|
-
return (0, import_utils.getPort)(config.dev.port || prodPort);
|
|
129
|
-
}
|
|
130
|
-
return prodPort;
|
|
131
|
-
});
|
|
132
|
-
}
|
|
133
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
134
|
-
0 && (module.exports = {});
|