@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
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import * as path from "path";
|
|
2
|
+
import { bundle } from "@modern-js/node-bundle-require";
|
|
3
|
+
import {
|
|
4
|
+
CONFIG_FILE_EXTENSIONS,
|
|
5
|
+
fs,
|
|
6
|
+
getServerConfig,
|
|
7
|
+
OUTPUT_CONFIG_FILE
|
|
8
|
+
} from "@modern-js/utils";
|
|
9
|
+
const defineServerConfig = (config) => config;
|
|
10
|
+
const buildServerConfig = async ({
|
|
11
|
+
appDirectory,
|
|
12
|
+
distDirectory,
|
|
13
|
+
configFile,
|
|
14
|
+
options
|
|
15
|
+
}) => {
|
|
16
|
+
const configFilePath = await getServerConfig(appDirectory, configFile);
|
|
17
|
+
const getOutputFile = async (filepath) => path.resolve(
|
|
18
|
+
distDirectory,
|
|
19
|
+
`${filepath.replace(
|
|
20
|
+
new RegExp(CONFIG_FILE_EXTENSIONS.join("|")),
|
|
21
|
+
""
|
|
22
|
+
)}.js`
|
|
23
|
+
);
|
|
24
|
+
if (configFilePath) {
|
|
25
|
+
const configHelperFilePath = path.normalize(
|
|
26
|
+
path.join(distDirectory, "./config-helper.js")
|
|
27
|
+
);
|
|
28
|
+
const helperCode = `
|
|
29
|
+
export const defineConfig = (config) => config;
|
|
30
|
+
`;
|
|
31
|
+
await fs.ensureDir(distDirectory);
|
|
32
|
+
await fs.writeFile(configHelperFilePath, helperCode);
|
|
33
|
+
await bundle(configFilePath, {
|
|
34
|
+
...options,
|
|
35
|
+
getOutputFile,
|
|
36
|
+
esbuildPlugins: [
|
|
37
|
+
{
|
|
38
|
+
name: "native-build-config",
|
|
39
|
+
setup(ctx) {
|
|
40
|
+
ctx.onResolve(
|
|
41
|
+
{
|
|
42
|
+
filter: /app-tools\/server/
|
|
43
|
+
},
|
|
44
|
+
() => {
|
|
45
|
+
return {
|
|
46
|
+
path: configHelperFilePath
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
]
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
const safeReplacer = () => {
|
|
57
|
+
const cache = [];
|
|
58
|
+
const keyCache = [];
|
|
59
|
+
return function(key, value) {
|
|
60
|
+
if (typeof value === "object" && value !== null) {
|
|
61
|
+
const index = cache.indexOf(value);
|
|
62
|
+
if (index !== -1) {
|
|
63
|
+
return `[Circular ${keyCache[index]}]`;
|
|
64
|
+
}
|
|
65
|
+
cache.push(value);
|
|
66
|
+
keyCache.push(key || "root");
|
|
67
|
+
}
|
|
68
|
+
return value;
|
|
69
|
+
};
|
|
70
|
+
};
|
|
71
|
+
const emitResolvedConfig = async (appDirectory, resolvedConfig) => {
|
|
72
|
+
var _a;
|
|
73
|
+
const outputPath = path.join(
|
|
74
|
+
appDirectory,
|
|
75
|
+
((_a = resolvedConfig.output.distPath) == null ? void 0 : _a.root) || "./dist",
|
|
76
|
+
OUTPUT_CONFIG_FILE
|
|
77
|
+
);
|
|
78
|
+
await fs.writeJSON(outputPath, resolvedConfig, {
|
|
79
|
+
spaces: 2,
|
|
80
|
+
replacer: safeReplacer()
|
|
81
|
+
});
|
|
82
|
+
};
|
|
83
|
+
export {
|
|
84
|
+
buildServerConfig,
|
|
85
|
+
defineServerConfig,
|
|
86
|
+
emitResolvedConfig,
|
|
87
|
+
safeReplacer
|
|
88
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { Server } from "@modern-js/server";
|
|
2
|
+
let server = null;
|
|
3
|
+
const getServer = () => server;
|
|
4
|
+
const setServer = (newServer) => {
|
|
5
|
+
server = newServer;
|
|
6
|
+
};
|
|
7
|
+
const closeServer = async () => {
|
|
8
|
+
if (server) {
|
|
9
|
+
await server.close();
|
|
10
|
+
server = null;
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
const createServer = async (options) => {
|
|
14
|
+
if (server) {
|
|
15
|
+
await server.close();
|
|
16
|
+
}
|
|
17
|
+
server = new Server(options);
|
|
18
|
+
const app = await server.init();
|
|
19
|
+
return app;
|
|
20
|
+
};
|
|
21
|
+
const injectDataLoaderPlugin = (internalPlugins) => {
|
|
22
|
+
const DataLoaderPlugin = require.resolve("@modern-js/plugin-data-loader/server");
|
|
23
|
+
return {
|
|
24
|
+
...internalPlugins,
|
|
25
|
+
"@modern-js/plugin-data-loader": {
|
|
26
|
+
path: DataLoaderPlugin,
|
|
27
|
+
forced: true
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
export {
|
|
32
|
+
closeServer,
|
|
33
|
+
createServer,
|
|
34
|
+
getServer,
|
|
35
|
+
injectDataLoaderPlugin,
|
|
36
|
+
setServer
|
|
37
|
+
};
|
|
File without changes
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import path from "path";
|
|
2
|
+
import { fs, getServerConfig } from "@modern-js/utils";
|
|
3
|
+
const getPackageConfig = (appDirectory, packageJsonConfig) => {
|
|
4
|
+
const PACKAGE_JSON_CONFIG_NAME = "modernConfig";
|
|
5
|
+
const json = JSON.parse(
|
|
6
|
+
fs.readFileSync(path.resolve(appDirectory, "./package.json"), "utf8")
|
|
7
|
+
);
|
|
8
|
+
return json[packageJsonConfig != null ? packageJsonConfig : PACKAGE_JSON_CONFIG_NAME];
|
|
9
|
+
};
|
|
10
|
+
const addServerConfigToDeps = async (dependencies, appDirectory, serverConfigFile) => {
|
|
11
|
+
const serverConfig = await getServerConfig(appDirectory, serverConfigFile);
|
|
12
|
+
if (serverConfig) {
|
|
13
|
+
dependencies.push(serverConfig);
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
async function generateWatchFiles(appContext, configDir) {
|
|
17
|
+
const { appDirectory, configFile } = appContext;
|
|
18
|
+
const configPath = path.join(appDirectory, configDir || "");
|
|
19
|
+
const dependencies = getPackageConfig(
|
|
20
|
+
appContext.appDirectory,
|
|
21
|
+
appContext.packageName
|
|
22
|
+
) ? [path.resolve(appDirectory, "./package.json")] : [];
|
|
23
|
+
await addServerConfigToDeps(
|
|
24
|
+
dependencies,
|
|
25
|
+
appContext.appDirectory,
|
|
26
|
+
appContext.serverConfigFile
|
|
27
|
+
);
|
|
28
|
+
return [`${configPath}/html`, configFile || "./config", ...dependencies];
|
|
29
|
+
}
|
|
30
|
+
export {
|
|
31
|
+
addServerConfigToDeps,
|
|
32
|
+
generateWatchFiles
|
|
33
|
+
};
|
|
@@ -1,32 +1,12 @@
|
|
|
1
|
-
var __async = (__this, __arguments, generator) => {
|
|
2
|
-
return new Promise((resolve, reject) => {
|
|
3
|
-
var fulfilled = (value) => {
|
|
4
|
-
try {
|
|
5
|
-
step(generator.next(value));
|
|
6
|
-
} catch (e) {
|
|
7
|
-
reject(e);
|
|
8
|
-
}
|
|
9
|
-
};
|
|
10
|
-
var rejected = (value) => {
|
|
11
|
-
try {
|
|
12
|
-
step(generator.throw(value));
|
|
13
|
-
} catch (e) {
|
|
14
|
-
reject(e);
|
|
15
|
-
}
|
|
16
|
-
};
|
|
17
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
18
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
19
|
-
});
|
|
20
|
-
};
|
|
21
1
|
import { chalk, inquirer } from "@modern-js/utils";
|
|
22
2
|
import { i18n, localeKeys } from "../locale";
|
|
23
|
-
const getSelectedEntries = (entry, entrypoints) =>
|
|
3
|
+
const getSelectedEntries = async (entry, entrypoints) => {
|
|
24
4
|
const entryNames = entrypoints.map((e) => e.entryName);
|
|
25
5
|
if (!entry) {
|
|
26
6
|
return entryNames;
|
|
27
7
|
}
|
|
28
8
|
if (typeof entry === "boolean") {
|
|
29
|
-
const { selected } =
|
|
9
|
+
const { selected } = await inquirer.prompt([
|
|
30
10
|
{
|
|
31
11
|
type: "checkbox",
|
|
32
12
|
name: "selected",
|
|
@@ -52,7 +32,7 @@ const getSelectedEntries = (entry, entrypoints) => __async(void 0, null, functio
|
|
|
52
32
|
}
|
|
53
33
|
});
|
|
54
34
|
return entry;
|
|
55
|
-
}
|
|
35
|
+
};
|
|
56
36
|
export {
|
|
57
37
|
getSelectedEntries
|
|
58
38
|
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
async function getServerInternalPlugins(api) {
|
|
2
|
+
const hookRunners = api.useHookRunners();
|
|
3
|
+
const { plugins: serverPlugins } = await hookRunners.collectServerPlugins({
|
|
4
|
+
plugins: []
|
|
5
|
+
});
|
|
6
|
+
const serverInternalPlugins = serverPlugins.reduce(
|
|
7
|
+
(result, plugin) => Object.assign(result, plugin),
|
|
8
|
+
{}
|
|
9
|
+
);
|
|
10
|
+
api.setAppContext({
|
|
11
|
+
...api.useAppContext(),
|
|
12
|
+
serverInternalPlugins
|
|
13
|
+
});
|
|
14
|
+
return serverInternalPlugins;
|
|
15
|
+
}
|
|
16
|
+
export {
|
|
17
|
+
getServerInternalPlugins
|
|
18
|
+
};
|
|
File without changes
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { prettyInstructions, logger } from "@modern-js/utils";
|
|
2
|
+
const printInstructions = async (hookRunners, appContext, config) => {
|
|
3
|
+
const message = prettyInstructions(appContext, config);
|
|
4
|
+
const { instructions } = await hookRunners.beforePrintInstructions({
|
|
5
|
+
instructions: message
|
|
6
|
+
});
|
|
7
|
+
logger.info(instructions);
|
|
8
|
+
};
|
|
9
|
+
export {
|
|
10
|
+
printInstructions
|
|
11
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { cli } from "@modern-js/core";
|
|
2
|
+
import { chalk, clearConsole, logger, program } from "@modern-js/utils";
|
|
3
|
+
async function restart(hooksRunner, filename) {
|
|
4
|
+
clearConsole();
|
|
5
|
+
logger.info(`Restart because ${chalk.yellow(filename)} is changed...
|
|
6
|
+
`);
|
|
7
|
+
let hasGetError = false;
|
|
8
|
+
await hooksRunner.beforeRestart();
|
|
9
|
+
try {
|
|
10
|
+
await cli.init(cli.getPrevInitOptions());
|
|
11
|
+
} catch (err) {
|
|
12
|
+
console.error(err);
|
|
13
|
+
hasGetError = true;
|
|
14
|
+
} finally {
|
|
15
|
+
if (!hasGetError) {
|
|
16
|
+
program.parse(process.argv);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
export {
|
|
21
|
+
restart
|
|
22
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import path from "path";
|
|
2
|
+
import { fs, ROUTE_SPEC_FILE } from "@modern-js/utils";
|
|
3
|
+
const generateRoutes = async (appContext) => {
|
|
4
|
+
const { serverRoutes, distDirectory } = appContext;
|
|
5
|
+
const output = JSON.stringify({ routes: serverRoutes }, null, 2);
|
|
6
|
+
await fs.outputFile(path.join(distDirectory, ROUTE_SPEC_FILE), output);
|
|
7
|
+
};
|
|
8
|
+
export {
|
|
9
|
+
generateRoutes
|
|
10
|
+
};
|
|
File without changes
|
|
@@ -2,4 +2,4 @@ import { IAppContext, PluginAPI } from '@modern-js/core';
|
|
|
2
2
|
import type { Entrypoint } from '@modern-js/types';
|
|
3
3
|
import { AppNormalizedConfig, AppTools, ImportStatement } from '../types';
|
|
4
4
|
export declare const createImportStatements: (statements: ImportStatement[]) => string;
|
|
5
|
-
export declare const generateCode: (appContext: IAppContext, config: AppNormalizedConfig
|
|
5
|
+
export declare const generateCode: (appContext: IAppContext, config: AppNormalizedConfig<'shared'>, entrypoints: Entrypoint[], api: PluginAPI<AppTools<'shared'>>) => Promise<void>;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { Entrypoint } from '@modern-js/types';
|
|
2
2
|
import type { AppNormalizedConfig, IAppContext } from '../types';
|
|
3
|
-
export declare const getBundleEntry: (appContext: IAppContext, config: AppNormalizedConfig) => Entrypoint[];
|
|
3
|
+
export declare const getBundleEntry: (appContext: IAppContext, config: AppNormalizedConfig<'shared'>) => Entrypoint[];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { Entrypoint } from '@modern-js/types';
|
|
2
2
|
import type { AppNormalizedConfig, IAppContext } from '../types';
|
|
3
3
|
export type { Entrypoint };
|
|
4
|
-
export declare const getFileSystemEntry: (appContext: IAppContext, config: AppNormalizedConfig) => Entrypoint[];
|
|
4
|
+
export declare const getFileSystemEntry: (appContext: IAppContext, config: AppNormalizedConfig<'shared'>) => Entrypoint[];
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { Entrypoint, HtmlTemplates } from '@modern-js/types';
|
|
2
2
|
import type { AppNormalizedConfig, AppTools, IAppContext, PluginAPI } from '../types';
|
|
3
|
-
export declare const getHtmlTemplate: (entrypoints: Entrypoint[], api: PluginAPI<AppTools
|
|
3
|
+
export declare const getHtmlTemplate: (entrypoints: Entrypoint[], api: PluginAPI<AppTools<'shared'>>, {
|
|
4
4
|
appContext,
|
|
5
5
|
config
|
|
6
6
|
}: {
|
|
7
7
|
appContext: IAppContext;
|
|
8
|
-
config: AppNormalizedConfig
|
|
8
|
+
config: AppNormalizedConfig<'shared'>;
|
|
9
9
|
}) => Promise<HtmlTemplates>;
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import type { CliPlugin } from '@modern-js/core';
|
|
2
2
|
import { AppTools } from '../types';
|
|
3
3
|
|
|
4
|
-
declare const _default: (
|
|
4
|
+
declare const _default: ({
|
|
5
|
+
bundler
|
|
6
|
+
}: {
|
|
7
|
+
bundler: 'webpack' | 'rspack';
|
|
8
|
+
}) => CliPlugin<AppTools<'shared'>>;
|
|
5
9
|
|
|
6
10
|
export default _default;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { BuilderOptions } from '../shared';
|
|
2
|
+
export declare function createRspackBuilderForModern(options: BuilderOptions<'rspack'>): Promise<import("@modern-js/builder-shared").BuilderInstance<import("@modern-js/builder-shared").BuilderProvider<Record<string, any>, Record<string, any>, Record<string, any>, Record<string, any>>>>;
|
package/dist/types/builder/{builderPlugins → builder-webpack/builderPlugins}/compatModern.d.ts
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BuilderPlugin } from '@modern-js/builder-shared';
|
|
2
2
|
import type { BuilderPluginAPI } from '@modern-js/builder-webpack-provider';
|
|
3
|
-
import
|
|
3
|
+
import { BuilderOptions } from '../../shared';
|
|
4
4
|
type Parameter<T extends (arg: any) => void> = Parameters<T>[0];
|
|
5
5
|
type FnParameter<T extends {
|
|
6
6
|
[p: string]: (arg: any) => void;
|
|
@@ -10,5 +10,5 @@ export type PluginCompatModernOptions = FnParameter<Partial<Pick<BuilderPluginAP
|
|
|
10
10
|
* Provides default configuration consistent with modern.js v1
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
-
export declare const PluginCompatModern: (
|
|
13
|
+
export declare const PluginCompatModern: (options: BuilderOptions<'webpack'>) => BuilderPlugin<BuilderPluginAPI>;
|
|
14
14
|
export {};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { BuilderInstance } from '@modern-js/builder';
|
|
2
|
+
import { BuilderWebpackProvider } from '@modern-js/builder-webpack-provider';
|
|
3
|
+
import { BuilderOptions } from '../shared';
|
|
4
|
+
export declare function createWebpackBuilderForModern(options: BuilderOptions<'webpack'>): Promise<BuilderInstance<BuilderWebpackProvider>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './RouterPlugin';
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import type { AppNormalizedConfig, Bundler, IAppContext } from '../../types';
|
|
2
|
+
export declare function createBuilderProviderConfig<B extends Bundler>(resolveConfig: AppNormalizedConfig<B>, appContext: IAppContext, modifyBuilderConfig?: (config: AppNormalizedConfig<B>) => void): AppNormalizedConfig<B>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { BuilderProvider, BuilderInstance } from '@modern-js/builder-shared';
|
|
2
|
+
import { BuilderOptions, ModifyBuilderConfig, ModifyBuilderInstance } from '../shared';
|
|
3
|
+
import { Bundler } from '../../types';
|
|
4
|
+
export type GenerateProvider = (c: {
|
|
5
|
+
builderConfig: any;
|
|
6
|
+
}) => BuilderProvider;
|
|
7
|
+
/**
|
|
8
|
+
* @param options BuilderOptions
|
|
9
|
+
* @param generateProvider GenerateProvider
|
|
10
|
+
* @param utils - ModifyBuilderConfig, ModifyBuilderInstance
|
|
11
|
+
* @returns BuilderInstance
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
export declare function generateBuilder<B extends Bundler>(options: BuilderOptions<B>, generateProvider: GenerateProvider, utils?: {
|
|
15
|
+
modifyBuilderConfig?: ModifyBuilderConfig<B>;
|
|
16
|
+
modifyBuilderInstance?: ModifyBuilderInstance;
|
|
17
|
+
}): Promise<BuilderInstance<BuilderProvider<Record<string, any>, Record<string, any>, Record<string, any>, Record<string, any>>>>;
|
|
@@ -1,18 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { BuilderConfig, BuilderWebpackProvider } from '@modern-js/builder-webpack-provider';
|
|
3
|
-
import type { IAppContext } from '@modern-js/core';
|
|
4
|
-
import type { AppNormalizedConfig } from '../types';
|
|
5
|
-
import { PluginCompatModernOptions } from './builderPlugins/compatModern';
|
|
6
|
-
export type BuilderOptions = {
|
|
7
|
-
target?: BuilderTarget | BuilderTarget[];
|
|
8
|
-
normalizedConfig: AppNormalizedConfig;
|
|
9
|
-
appContext: IAppContext;
|
|
10
|
-
compatPluginConfig?: PluginCompatModernOptions;
|
|
11
|
-
};
|
|
12
|
-
export declare function createBuilderForModern({
|
|
13
|
-
normalizedConfig,
|
|
14
|
-
appContext,
|
|
15
|
-
compatPluginConfig
|
|
16
|
-
}: BuilderOptions): Promise<BuilderInstance<BuilderWebpackProvider>>;
|
|
17
|
-
export declare function createBuilderProviderConfig(normalizedConfig: AppNormalizedConfig, appContext: IAppContext): BuilderConfig;
|
|
18
|
-
export declare function createBuilderOptions(target: BuilderTarget | BuilderTarget[], appContext: IAppContext): CreateBuilderOptions;
|
|
1
|
+
export declare function createBuilderGenerator(bundler: 'webpack' | 'rspack'): Promise<typeof import("./builder-rspack").createRspackBuilderForModern | typeof import("./builder-webpack").createWebpackBuilderForModern>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { BuilderPlugin, DefaultBuilderPluginAPI } from '@modern-js/builder-shared';
|
|
2
|
+
import { BuilderConfig as RspackBuilderConfig, NormalizedConfig as RspackNormalizedConfig } from '@modern-js/builder-rspack-provider';
|
|
3
|
+
import { BuilderConfig as WebpackBuilderConfig, NormalizedConfig as WebpackNormalizedConfig } from '@modern-js/builder-webpack-provider';
|
|
4
|
+
import type { BuilderOptions } from '../types';
|
|
5
|
+
import type { Bundler } from '../../../types';
|
|
6
|
+
type BuilderConfig = RspackBuilderConfig | WebpackBuilderConfig;
|
|
7
|
+
type NormalizedConfig = RspackNormalizedConfig | WebpackNormalizedConfig;
|
|
8
|
+
type BuilderPluginAPI = DefaultBuilderPluginAPI<BuilderConfig, NormalizedConfig>;
|
|
9
|
+
export declare const builderPluginAdapterModern: <B extends Bundler>(options: BuilderOptions<B>) => BuilderPlugin<BuilderPluginAPI>;
|
|
10
|
+
/** register builder hooks callback */
|
|
11
|
+
|
|
12
|
+
export declare function applyCallbacks<B extends Bundler>(api: BuilderPluginAPI, options: BuilderOptions<B>): void;
|
|
13
|
+
export {};
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import type { webpack } from '@modern-js/builder-webpack-provider';
|
|
2
|
+
import type { Rspack } from '@modern-js/builder-rspack-provider';
|
|
2
3
|
import type HtmlWebpackPlugin from '@modern-js/builder-webpack-provider/html-webpack-plugin';
|
|
3
4
|
export declare class HtmlAsyncChunkPlugin {
|
|
4
5
|
name: string;
|
|
5
6
|
htmlWebpackPlugin: typeof HtmlWebpackPlugin;
|
|
6
7
|
constructor(htmlWebpackPlugin: typeof HtmlWebpackPlugin);
|
|
7
|
-
apply(compiler: webpack.Compiler): void;
|
|
8
|
+
apply(compiler: webpack.Compiler | Rspack.Compiler): void;
|
|
8
9
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { webpack } from '@modern-js/builder-webpack-provider';
|
|
2
|
+
import type { Rspack } from '@modern-js/builder-rspack-provider';
|
|
2
3
|
import type HtmlWebpackPlugin from '@modern-js/builder-webpack-provider/html-webpack-plugin';
|
|
3
4
|
export declare class BottomTemplatePlugin {
|
|
4
5
|
htmlWebpackPlugin: typeof HtmlWebpackPlugin;
|
|
@@ -6,5 +7,5 @@ export declare class BottomTemplatePlugin {
|
|
|
6
7
|
bodyRegExp: RegExp;
|
|
7
8
|
name: string;
|
|
8
9
|
constructor(htmlWebpackPlugin: typeof HtmlWebpackPlugin);
|
|
9
|
-
apply(compiler: webpack.Compiler): void;
|
|
10
|
+
apply(compiler: Rspack.Compiler | webpack.Compiler): void;
|
|
10
11
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import { WebpackChain } from '@modern-js/builder-webpack-provider';
|
|
3
|
-
import { AppNormalizedConfig, IAppContext } from '
|
|
3
|
+
import { AppNormalizedConfig, IAppContext } from '../../types';
|
|
4
4
|
export declare function createCopyPattern(appContext: IAppContext, config: AppNormalizedConfig, patternsType: 'upload' | 'public', chain?: WebpackChain): {
|
|
5
5
|
info: (file: {
|
|
6
6
|
sourceFilename: string;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { BuilderPluginAPI as WebpackBuilderPluginAPI } from '@modern-js/builder-webpack-provider';
|
|
2
|
+
import type { BuilderPluginAPI as RspackBuilderPluginAPI } from '@modern-js/builder-rspack-provider';
|
|
3
|
+
import { BuilderInstance } from '@modern-js/builder-shared';
|
|
4
|
+
import { AppNormalizedConfig, Bundler, IAppContext } from '../../types';
|
|
5
|
+
type Parameter<T extends (arg: any) => void> = Parameters<T>[0];
|
|
6
|
+
type FnParameter<T extends {
|
|
7
|
+
[p: string]: (arg: any) => void;
|
|
8
|
+
}> = { [P in keyof T]: Parameter<T[P]> };
|
|
9
|
+
type BuilderPluginCallbacks<B extends Bundler> = FnParameter<Partial<Pick<B extends 'rspack' ? RspackBuilderPluginAPI : WebpackBuilderPluginAPI, 'onAfterBuild' | 'onAfterCreateCompiler' | 'onAfterStartDevServer' | 'onBeforeBuild' | 'onBeforeCreateCompiler' | 'onBeforeStartDevServer' | 'onDevCompileDone' | 'onExit'>>>;
|
|
10
|
+
export type BuilderOptions<B extends Bundler> = {
|
|
11
|
+
normalizedConfig: AppNormalizedConfig<B>;
|
|
12
|
+
appContext: IAppContext;
|
|
13
|
+
} & BuilderPluginCallbacks<B>;
|
|
14
|
+
export type ModifyBuilderConfig<B extends Bundler> = (config: AppNormalizedConfig<B>) => Promise<void> | void;
|
|
15
|
+
export type ModifyBuilderInstance = (builder: BuilderInstance) => Promise<void> | void;
|
|
16
|
+
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { PluginAPI } from '@modern-js/core';
|
|
2
2
|
import type { BuildOptions } from '../utils/types';
|
|
3
3
|
import type { AppTools } from '../types';
|
|
4
|
-
export declare const build: (api: PluginAPI<AppTools
|
|
4
|
+
export declare const build: (api: PluginAPI<AppTools<'shared'>>, options?: BuildOptions) => Promise<void>;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { PluginAPI } from '@modern-js/core';
|
|
2
2
|
import type { AppTools } from '../types';
|
|
3
|
-
export declare const deploy: (api: PluginAPI<AppTools
|
|
3
|
+
export declare const deploy: (api: PluginAPI<AppTools<'shared'>>, options: any) => Promise<void>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { PluginAPI } from '@modern-js/core';
|
|
2
2
|
import { DevOptions } from '../utils/types';
|
|
3
3
|
import type { AppTools } from '../types';
|
|
4
|
-
export declare const dev: (api: PluginAPI<AppTools
|
|
4
|
+
export declare const dev: (api: PluginAPI<AppTools<'shared'>>, options: DevOptions) => Promise<void>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { PluginAPI } from '@modern-js/core';
|
|
2
2
|
import type { InspectOptions } from '../utils/types';
|
|
3
3
|
import type { AppTools } from '../types';
|
|
4
|
-
export declare const inspect: (api: PluginAPI<AppTools
|
|
4
|
+
export declare const inspect: (api: PluginAPI<AppTools<'shared'>>, options: InspectOptions) => Promise<{
|
|
5
5
|
builderConfig: string;
|
|
6
6
|
bundlerConfigs: string[];
|
|
7
7
|
origin: {
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { IAppContext, AppUserConfig, AppLegacyUserConfig } from '../types';
|
|
2
|
-
export declare function createDefaultConfig(appContext: IAppContext): AppUserConfig
|
|
2
|
+
export declare function createDefaultConfig(appContext: IAppContext, bundler: 'webpack' | 'rspack'): AppUserConfig<'webpack'> | AppUserConfig<'rspack'>;
|
|
3
3
|
export declare function createLegacyDefaultConfig(appContext: IAppContext): AppLegacyUserConfig;
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
1
|
+
export * from './legacy';
|
|
2
|
+
export * from './initialize';
|
|
3
|
+
export * from './default';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { AppNormalizedConfig, IAppContext } from '../../types';
|
|
2
|
-
export declare function initHtmlConfig(config: AppNormalizedConfig
|
|
3
|
-
export declare function initSourceConfig(config: AppNormalizedConfig
|
|
4
|
-
export declare function initToolsConfig(config: AppNormalizedConfig): void;
|
|
2
|
+
export declare function initHtmlConfig(config: AppNormalizedConfig<'shared'>, appContext: IAppContext): import("@modern-js/builder-shared").SharedHtmlConfig;
|
|
3
|
+
export declare function initSourceConfig(config: AppNormalizedConfig<'shared'>, appContext: IAppContext, bundler: 'webpack' | 'rspack'): void;
|
|
4
|
+
export declare function initToolsConfig(config: AppNormalizedConfig<'webpack'>): void;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { AppLegacyNormalizedConfig, AppNormalizedConfig } from '../../types';
|
|
2
|
-
export declare function createHtmlConfig(config: Readonly<AppLegacyNormalizedConfig>): AppNormalizedConfig['html'];
|
|
2
|
+
export declare function createHtmlConfig(config: Readonly<AppLegacyNormalizedConfig>): AppNormalizedConfig<'webpack'>['html'];
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { AppLegacyNormalizedConfig, AppNormalizedConfig } from '../../types';
|
|
2
|
-
export declare function createOutputConfig(config: Readonly<AppLegacyNormalizedConfig>): AppNormalizedConfig['output'];
|
|
2
|
+
export declare function createOutputConfig(config: Readonly<AppLegacyNormalizedConfig>): AppNormalizedConfig<'webpack'>['output'];
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { AppLegacyNormalizedConfig, AppNormalizedConfig } from '../../types';
|
|
2
|
-
export declare function createSourceConfig(config: AppLegacyNormalizedConfig): AppNormalizedConfig['source'];
|
|
2
|
+
export declare function createSourceConfig(config: AppLegacyNormalizedConfig): AppNormalizedConfig<'webpack'>['source'];
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { AppLegacyNormalizedConfig, AppNormalizedConfig } from '../../types';
|
|
2
|
-
export declare function createToolsConfig(config: AppLegacyNormalizedConfig): AppNormalizedConfig['tools'];
|
|
2
|
+
export declare function createToolsConfig(config: AppLegacyNormalizedConfig): AppNormalizedConfig<'webpack'>['tools'];
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { AppLegacyNormalizedConfig, AppLegacyUserConfig, AppNormalizedConfig, AppUserConfig } from '../../types';
|
|
2
|
+
export declare function transformNormalizedConfig(config: AppLegacyNormalizedConfig): AppNormalizedConfig<'webpack'>;
|
|
3
|
+
export declare function checkIsLegacyConfig(config: AppLegacyUserConfig | AppUserConfig): config is AppLegacyUserConfig;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { UserConfigExport } from '@modern-js/core';
|
|
2
|
-
import type {
|
|
3
|
-
export declare const defineConfig: (config: UserConfigExport<AppUserConfig
|
|
2
|
+
import type { AppLegacyUserConfig, AppUserConfig } from './types';
|
|
3
|
+
export declare const defineConfig: <B extends "webpack" | "rspack" = "webpack">(config: UserConfigExport<AppUserConfig<B>>) => UserConfigExport<AppUserConfig<B>>;
|
|
4
4
|
/**
|
|
5
5
|
* @deprecated
|
|
6
6
|
* Using defineConfig first.
|