@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
|
@@ -199,133 +199,60 @@ var __generator = this && this.__generator || function(thisArg, body) {
|
|
|
199
199
|
};
|
|
200
200
|
}
|
|
201
201
|
};
|
|
202
|
-
import { createBuilder } from "@modern-js/builder";
|
|
203
202
|
import { builderWebpackProvider } from "@modern-js/builder-webpack-provider";
|
|
204
|
-
import { applyOptionsChain
|
|
203
|
+
import { applyOptionsChain } from "@modern-js/utils";
|
|
204
|
+
import { createCopyPattern } from "../shared";
|
|
205
|
+
import { generateBuilder } from "../generator";
|
|
205
206
|
import { PluginCompatModern } from "./builderPlugins/compatModern";
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
builderConfig: builderConfig
|
|
230
|
-
});
|
|
231
|
-
target = getBuilderTargets(normalizedConfig);
|
|
232
|
-
builderOptions = createBuilderOptions(target, appContext);
|
|
233
|
-
return [
|
|
234
|
-
4,
|
|
235
|
-
createBuilder(webpackProvider, builderOptions)
|
|
236
|
-
];
|
|
237
|
-
case 1:
|
|
238
|
-
builder = _state.sent();
|
|
239
|
-
return [
|
|
240
|
-
4,
|
|
241
|
-
applyBuilderPlugins(builder, normalizedConfig, appContext, compatPluginConfig)
|
|
242
|
-
];
|
|
243
|
-
case 2:
|
|
244
|
-
_state.sent();
|
|
245
|
-
return [
|
|
246
|
-
2,
|
|
247
|
-
builder
|
|
248
|
-
];
|
|
249
|
-
}
|
|
250
|
-
});
|
|
207
|
+
function createWebpackBuilderForModern(options) {
|
|
208
|
+
return generateBuilder(options, builderWebpackProvider, {
|
|
209
|
+
modifyBuilderConfig: function modifyBuilderConfig(config) {
|
|
210
|
+
modifyOutputConfig(config, options.appContext);
|
|
211
|
+
},
|
|
212
|
+
modifyBuilderInstance: function modifyBuilderInstance(builder) {
|
|
213
|
+
return _asyncToGenerator(function() {
|
|
214
|
+
return __generator(this, function(_state) {
|
|
215
|
+
switch(_state.label){
|
|
216
|
+
case 0:
|
|
217
|
+
return [
|
|
218
|
+
4,
|
|
219
|
+
applyBuilderPlugins(builder, options)
|
|
220
|
+
];
|
|
221
|
+
case 1:
|
|
222
|
+
_state.sent();
|
|
223
|
+
return [
|
|
224
|
+
2
|
|
225
|
+
];
|
|
226
|
+
}
|
|
227
|
+
});
|
|
228
|
+
})();
|
|
229
|
+
}
|
|
251
230
|
});
|
|
252
|
-
return _createBuilderForModern.apply(this, arguments);
|
|
253
231
|
}
|
|
254
|
-
function
|
|
255
|
-
var createOutputConfig = function createOutputConfig(
|
|
256
|
-
var defaultCopyPattern = createCopyPattern(appContext2,
|
|
257
|
-
var copy =
|
|
232
|
+
function modifyOutputConfig(config, appContext) {
|
|
233
|
+
var createOutputConfig = function createOutputConfig(config2, appContext2) {
|
|
234
|
+
var defaultCopyPattern = createCopyPattern(appContext2, config2, "upload");
|
|
235
|
+
var copy = config2.output.copy;
|
|
258
236
|
var copyOptions = Array.isArray(copy) ? copy : copy === null || copy === void 0 ? void 0 : copy.patterns;
|
|
259
237
|
var builderCopy = _toConsumableArray(copyOptions || []).concat([
|
|
260
238
|
defaultCopyPattern
|
|
261
239
|
]);
|
|
262
|
-
return _objectSpreadProps(_objectSpread({},
|
|
263
|
-
copy: builderCopy
|
|
264
|
-
cleanDistPath: false
|
|
240
|
+
return _objectSpreadProps(_objectSpread({}, config2.output), {
|
|
241
|
+
copy: builderCopy
|
|
265
242
|
});
|
|
266
243
|
};
|
|
267
|
-
|
|
268
|
-
var htmlConfig = _objectSpread({}, normalizedConfig.html);
|
|
269
|
-
if (!htmlConfig.template) {
|
|
270
|
-
htmlConfig.templateByEntries = _objectSpread({}, htmlConfig.templateByEntries, appContext.htmlTemplates);
|
|
271
|
-
}
|
|
272
|
-
return _objectSpreadProps(_objectSpread({}, normalizedConfig), {
|
|
273
|
-
output: output,
|
|
274
|
-
dev: _objectSpreadProps(_objectSpread({}, normalizedConfig.dev), {
|
|
275
|
-
port: appContext.port
|
|
276
|
-
}),
|
|
277
|
-
html: htmlConfig
|
|
278
|
-
});
|
|
279
|
-
}
|
|
280
|
-
function createBuilderOptions(target, appContext) {
|
|
281
|
-
var entries = {};
|
|
282
|
-
var _entrypoints = appContext.entrypoints, entrypoints = _entrypoints === void 0 ? [] : _entrypoints, checkedEntries = appContext.checkedEntries;
|
|
283
|
-
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
284
|
-
try {
|
|
285
|
-
for(var _iterator = entrypoints[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
286
|
-
var _value = _step.value, entryName = _value.entryName, entry = _value.entry;
|
|
287
|
-
if (checkedEntries && !checkedEntries.includes(entryName)) {
|
|
288
|
-
continue;
|
|
289
|
-
}
|
|
290
|
-
if (entryName in entries) {
|
|
291
|
-
entries[entryName].push(entry);
|
|
292
|
-
} else {
|
|
293
|
-
entries[entryName] = [
|
|
294
|
-
entry
|
|
295
|
-
];
|
|
296
|
-
}
|
|
297
|
-
}
|
|
298
|
-
} catch (err) {
|
|
299
|
-
_didIteratorError = true;
|
|
300
|
-
_iteratorError = err;
|
|
301
|
-
} finally{
|
|
302
|
-
try {
|
|
303
|
-
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
304
|
-
_iterator.return();
|
|
305
|
-
}
|
|
306
|
-
} finally{
|
|
307
|
-
if (_didIteratorError) {
|
|
308
|
-
throw _iteratorError;
|
|
309
|
-
}
|
|
310
|
-
}
|
|
311
|
-
}
|
|
312
|
-
return {
|
|
313
|
-
cwd: appContext.appDirectory,
|
|
314
|
-
target: target,
|
|
315
|
-
configPath: appContext.configFile || void 0,
|
|
316
|
-
entry: entries,
|
|
317
|
-
framework: appContext.metaName
|
|
318
|
-
};
|
|
244
|
+
config.output = createOutputConfig(config, appContext);
|
|
319
245
|
}
|
|
320
|
-
function applyBuilderPlugins(builder,
|
|
246
|
+
function applyBuilderPlugins(builder, options) {
|
|
321
247
|
return _applyBuilderPlugins.apply(this, arguments);
|
|
322
248
|
}
|
|
323
249
|
function _applyBuilderPlugins() {
|
|
324
|
-
_applyBuilderPlugins = _asyncToGenerator(function(builder,
|
|
325
|
-
var
|
|
250
|
+
_applyBuilderPlugins = _asyncToGenerator(function(builder, options) {
|
|
251
|
+
var normalizedConfig, PluginNodePolyfill, _normalizedConfig_tools, esbuildOptions, PluginEsbuild;
|
|
326
252
|
return __generator(this, function(_state) {
|
|
327
253
|
switch(_state.label){
|
|
328
254
|
case 0:
|
|
255
|
+
normalizedConfig = options.normalizedConfig;
|
|
329
256
|
if (!!normalizedConfig.output.disableNodePolyfill) return [
|
|
330
257
|
3,
|
|
331
258
|
2
|
|
@@ -335,9 +262,9 @@ function _applyBuilderPlugins() {
|
|
|
335
262
|
import("@modern-js/builder-plugin-node-polyfill")
|
|
336
263
|
];
|
|
337
264
|
case 1:
|
|
338
|
-
|
|
265
|
+
PluginNodePolyfill = _state.sent().PluginNodePolyfill;
|
|
339
266
|
builder.addPlugins([
|
|
340
|
-
|
|
267
|
+
PluginNodePolyfill()
|
|
341
268
|
]);
|
|
342
269
|
_state.label = 2;
|
|
343
270
|
case 2:
|
|
@@ -345,15 +272,15 @@ function _applyBuilderPlugins() {
|
|
|
345
272
|
3,
|
|
346
273
|
4
|
|
347
274
|
];
|
|
348
|
-
|
|
275
|
+
_normalizedConfig_tools = normalizedConfig.tools, esbuildOptions = _normalizedConfig_tools.esbuild;
|
|
349
276
|
return [
|
|
350
277
|
4,
|
|
351
278
|
import("@modern-js/builder-plugin-esbuild")
|
|
352
279
|
];
|
|
353
280
|
case 3:
|
|
354
|
-
|
|
281
|
+
PluginEsbuild = _state.sent().PluginEsbuild;
|
|
355
282
|
builder.addPlugins([
|
|
356
|
-
|
|
283
|
+
PluginEsbuild({
|
|
357
284
|
loader: false,
|
|
358
285
|
minimize: applyOptionsChain({}, esbuildOptions)
|
|
359
286
|
})
|
|
@@ -361,7 +288,7 @@ function _applyBuilderPlugins() {
|
|
|
361
288
|
_state.label = 4;
|
|
362
289
|
case 4:
|
|
363
290
|
builder.addPlugins([
|
|
364
|
-
PluginCompatModern(
|
|
291
|
+
PluginCompatModern(options)
|
|
365
292
|
]);
|
|
366
293
|
return [
|
|
367
294
|
2
|
|
@@ -371,4 +298,4 @@ function _applyBuilderPlugins() {
|
|
|
371
298
|
});
|
|
372
299
|
return _applyBuilderPlugins.apply(this, arguments);
|
|
373
300
|
}
|
|
374
|
-
export {
|
|
301
|
+
export { createWebpackBuilderForModern };
|
|
@@ -215,6 +215,9 @@ var RouterPlugin = /*#__PURE__*/ function() {
|
|
|
215
215
|
if (target === "node" || Array.isArray(target) && target.includes("node")) {
|
|
216
216
|
return;
|
|
217
217
|
}
|
|
218
|
+
if (target === "webworker" || Array.isArray(target) && target.includes("webworker")) {
|
|
219
|
+
return;
|
|
220
|
+
}
|
|
218
221
|
var webpack = compiler.webpack;
|
|
219
222
|
var Compilation = webpack.Compilation, sources = webpack.sources;
|
|
220
223
|
var RawSource = sources.RawSource;
|
|
@@ -232,7 +235,7 @@ var RouterPlugin = /*#__PURE__*/ function() {
|
|
|
232
235
|
name: PLUGIN_NAME,
|
|
233
236
|
stage: PROCESS_ASSETS_STAGE_REPORT
|
|
234
237
|
}, /*#__PURE__*/ _asyncToGenerator(function() {
|
|
235
|
-
var stats, publicPath, routeAssets, namedChunkGroups, assetsByChunkName, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step,
|
|
238
|
+
var stats, publicPath, routeAssets, namedChunkGroups, assetsByChunkName, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, _step_value, name, chunkGroup, manifest, injectedContent, entrypointsArray, entryChunkIds, entryChunks, entryChunkFiles, _iteratorNormalCompletion1, _didIteratorError1, _iteratorError1, _iterator1, _step1, file, asset, newContent, filename;
|
|
236
239
|
return __generator(this, function(_state) {
|
|
237
240
|
switch(_state.label){
|
|
238
241
|
case 0:
|
|
@@ -252,7 +255,7 @@ var RouterPlugin = /*#__PURE__*/ function() {
|
|
|
252
255
|
_iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
253
256
|
try {
|
|
254
257
|
for(_iterator = Object.entries(namedChunkGroups)[Symbol.iterator](); !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
255
|
-
|
|
258
|
+
_step_value = _slicedToArray(_step.value, 2), name = _step_value[0], chunkGroup = _step_value[1];
|
|
256
259
|
if (assetsByChunkName[name]) {
|
|
257
260
|
routeAssets[name] = {
|
|
258
261
|
chunkIds: chunkGroup.chunks,
|
|
@@ -340,4 +343,4 @@ var RouterPlugin = /*#__PURE__*/ function() {
|
|
|
340
343
|
]);
|
|
341
344
|
return RouterPlugin;
|
|
342
345
|
}();
|
|
343
|
-
export { RouterPlugin
|
|
346
|
+
export { RouterPlugin };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./RouterPlugin";
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
function createBuilderOptions(target, appContext) {
|
|
2
|
+
var entries = {};
|
|
3
|
+
var _appContext_entrypoints = appContext.entrypoints, entrypoints = _appContext_entrypoints === void 0 ? [] : _appContext_entrypoints, checkedEntries = appContext.checkedEntries;
|
|
4
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
5
|
+
try {
|
|
6
|
+
for(var _iterator = entrypoints[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
7
|
+
var _step_value = _step.value, entryName = _step_value.entryName, entry = _step_value.entry;
|
|
8
|
+
if (checkedEntries && !checkedEntries.includes(entryName)) {
|
|
9
|
+
continue;
|
|
10
|
+
}
|
|
11
|
+
if (entryName in entries) {
|
|
12
|
+
entries[entryName].push(entry);
|
|
13
|
+
} else {
|
|
14
|
+
entries[entryName] = [
|
|
15
|
+
entry
|
|
16
|
+
];
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
} catch (err) {
|
|
20
|
+
_didIteratorError = true;
|
|
21
|
+
_iteratorError = err;
|
|
22
|
+
} finally{
|
|
23
|
+
try {
|
|
24
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
25
|
+
_iterator.return();
|
|
26
|
+
}
|
|
27
|
+
} finally{
|
|
28
|
+
if (_didIteratorError) {
|
|
29
|
+
throw _iteratorError;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
return {
|
|
34
|
+
cwd: appContext.appDirectory,
|
|
35
|
+
target: target,
|
|
36
|
+
configPath: appContext.configFile || void 0,
|
|
37
|
+
entry: entries,
|
|
38
|
+
framework: appContext.metaName
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
export { createBuilderOptions };
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
function _defineProperty(obj, key, value) {
|
|
2
|
+
if (key in obj) {
|
|
3
|
+
Object.defineProperty(obj, key, {
|
|
4
|
+
value: value,
|
|
5
|
+
enumerable: true,
|
|
6
|
+
configurable: true,
|
|
7
|
+
writable: true
|
|
8
|
+
});
|
|
9
|
+
} else {
|
|
10
|
+
obj[key] = value;
|
|
11
|
+
}
|
|
12
|
+
return obj;
|
|
13
|
+
}
|
|
14
|
+
function _objectSpread(target) {
|
|
15
|
+
for(var i = 1; i < arguments.length; i++){
|
|
16
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
17
|
+
var ownKeys = Object.keys(source);
|
|
18
|
+
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
19
|
+
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
20
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
21
|
+
}));
|
|
22
|
+
}
|
|
23
|
+
ownKeys.forEach(function(key) {
|
|
24
|
+
_defineProperty(target, key, source[key]);
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
return target;
|
|
28
|
+
}
|
|
29
|
+
function ownKeys(object, enumerableOnly) {
|
|
30
|
+
var keys = Object.keys(object);
|
|
31
|
+
if (Object.getOwnPropertySymbols) {
|
|
32
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
33
|
+
if (enumerableOnly) {
|
|
34
|
+
symbols = symbols.filter(function(sym) {
|
|
35
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
keys.push.apply(keys, symbols);
|
|
39
|
+
}
|
|
40
|
+
return keys;
|
|
41
|
+
}
|
|
42
|
+
function _objectSpreadProps(target, source) {
|
|
43
|
+
source = source != null ? source : {};
|
|
44
|
+
if (Object.getOwnPropertyDescriptors) {
|
|
45
|
+
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
46
|
+
} else {
|
|
47
|
+
ownKeys(Object(source)).forEach(function(key) {
|
|
48
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
return target;
|
|
52
|
+
}
|
|
53
|
+
function createBuilderProviderConfig(resolveConfig, appContext, modifyBuilderConfig) {
|
|
54
|
+
var htmlConfig = _objectSpread({}, resolveConfig.html);
|
|
55
|
+
if (!htmlConfig.template) {
|
|
56
|
+
htmlConfig.templateByEntries = _objectSpread({}, htmlConfig.templateByEntries, appContext.htmlTemplates);
|
|
57
|
+
}
|
|
58
|
+
var config = _objectSpreadProps(_objectSpread({}, resolveConfig), {
|
|
59
|
+
dev: _objectSpreadProps(_objectSpread({}, resolveConfig.dev), {
|
|
60
|
+
port: appContext.port
|
|
61
|
+
}),
|
|
62
|
+
html: htmlConfig,
|
|
63
|
+
output: _objectSpreadProps(_objectSpread({}, resolveConfig.output), {
|
|
64
|
+
cleanDistPath: false
|
|
65
|
+
})
|
|
66
|
+
});
|
|
67
|
+
modifyBuilderConfig === null || modifyBuilderConfig === void 0 ? void 0 : modifyBuilderConfig(config);
|
|
68
|
+
return config;
|
|
69
|
+
}
|
|
70
|
+
export { createBuilderProviderConfig };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { isProd, isServiceWorker, isSSR, isUseSSRBundle } from "@modern-js/utils";
|
|
2
|
+
function getBuilderTargets(normalizedConfig) {
|
|
3
|
+
var targets = [
|
|
4
|
+
"web"
|
|
5
|
+
];
|
|
6
|
+
var useNodeTarget = isProd() ? isUseSSRBundle(normalizedConfig) : isSSR(normalizedConfig);
|
|
7
|
+
if (useNodeTarget) {
|
|
8
|
+
targets.push("node");
|
|
9
|
+
}
|
|
10
|
+
var useWorkerTarget = isProd() ? isServiceWorker(normalizedConfig) : false;
|
|
11
|
+
if (useWorkerTarget) {
|
|
12
|
+
targets.push("service-worker");
|
|
13
|
+
}
|
|
14
|
+
return targets;
|
|
15
|
+
}
|
|
16
|
+
export { getBuilderTargets };
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
2
|
+
try {
|
|
3
|
+
var info = gen[key](arg);
|
|
4
|
+
var value = info.value;
|
|
5
|
+
} catch (error) {
|
|
6
|
+
reject(error);
|
|
7
|
+
return;
|
|
8
|
+
}
|
|
9
|
+
if (info.done) {
|
|
10
|
+
resolve(value);
|
|
11
|
+
} else {
|
|
12
|
+
Promise.resolve(value).then(_next, _throw);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
function _asyncToGenerator(fn) {
|
|
16
|
+
return function() {
|
|
17
|
+
var self = this, args = arguments;
|
|
18
|
+
return new Promise(function(resolve, reject) {
|
|
19
|
+
var gen = fn.apply(self, args);
|
|
20
|
+
function _next(value) {
|
|
21
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
22
|
+
}
|
|
23
|
+
function _throw(err) {
|
|
24
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
25
|
+
}
|
|
26
|
+
_next(undefined);
|
|
27
|
+
});
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
var __generator = this && this.__generator || function(thisArg, body) {
|
|
31
|
+
var f, y, t, g, _ = {
|
|
32
|
+
label: 0,
|
|
33
|
+
sent: function() {
|
|
34
|
+
if (t[0] & 1) throw t[1];
|
|
35
|
+
return t[1];
|
|
36
|
+
},
|
|
37
|
+
trys: [],
|
|
38
|
+
ops: []
|
|
39
|
+
};
|
|
40
|
+
return g = {
|
|
41
|
+
next: verb(0),
|
|
42
|
+
"throw": verb(1),
|
|
43
|
+
"return": verb(2)
|
|
44
|
+
}, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
45
|
+
return this;
|
|
46
|
+
}), g;
|
|
47
|
+
function verb(n) {
|
|
48
|
+
return function(v) {
|
|
49
|
+
return step([
|
|
50
|
+
n,
|
|
51
|
+
v
|
|
52
|
+
]);
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
function step(op) {
|
|
56
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
57
|
+
while(_)try {
|
|
58
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
59
|
+
if (y = 0, t) op = [
|
|
60
|
+
op[0] & 2,
|
|
61
|
+
t.value
|
|
62
|
+
];
|
|
63
|
+
switch(op[0]){
|
|
64
|
+
case 0:
|
|
65
|
+
case 1:
|
|
66
|
+
t = op;
|
|
67
|
+
break;
|
|
68
|
+
case 4:
|
|
69
|
+
_.label++;
|
|
70
|
+
return {
|
|
71
|
+
value: op[1],
|
|
72
|
+
done: false
|
|
73
|
+
};
|
|
74
|
+
case 5:
|
|
75
|
+
_.label++;
|
|
76
|
+
y = op[1];
|
|
77
|
+
op = [
|
|
78
|
+
0
|
|
79
|
+
];
|
|
80
|
+
continue;
|
|
81
|
+
case 7:
|
|
82
|
+
op = _.ops.pop();
|
|
83
|
+
_.trys.pop();
|
|
84
|
+
continue;
|
|
85
|
+
default:
|
|
86
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
87
|
+
_ = 0;
|
|
88
|
+
continue;
|
|
89
|
+
}
|
|
90
|
+
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
91
|
+
_.label = op[1];
|
|
92
|
+
break;
|
|
93
|
+
}
|
|
94
|
+
if (op[0] === 6 && _.label < t[1]) {
|
|
95
|
+
_.label = t[1];
|
|
96
|
+
t = op;
|
|
97
|
+
break;
|
|
98
|
+
}
|
|
99
|
+
if (t && _.label < t[2]) {
|
|
100
|
+
_.label = t[2];
|
|
101
|
+
_.ops.push(op);
|
|
102
|
+
break;
|
|
103
|
+
}
|
|
104
|
+
if (t[2]) _.ops.pop();
|
|
105
|
+
_.trys.pop();
|
|
106
|
+
continue;
|
|
107
|
+
}
|
|
108
|
+
op = body.call(thisArg, _);
|
|
109
|
+
} catch (e) {
|
|
110
|
+
op = [
|
|
111
|
+
6,
|
|
112
|
+
e
|
|
113
|
+
];
|
|
114
|
+
y = 0;
|
|
115
|
+
} finally{
|
|
116
|
+
f = t = 0;
|
|
117
|
+
}
|
|
118
|
+
if (op[0] & 5) throw op[1];
|
|
119
|
+
return {
|
|
120
|
+
value: op[0] ? op[1] : void 0,
|
|
121
|
+
done: true
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
import { createBuilder } from "@modern-js/builder";
|
|
126
|
+
import { createBuilderProviderConfig } from "./createBuilderProviderConfig";
|
|
127
|
+
import { getBuilderTargets } from "./getBuilderTargets";
|
|
128
|
+
import { createBuilderOptions } from "./createBuilderOptions";
|
|
129
|
+
function generateBuilder(options, generateProvider, utils) {
|
|
130
|
+
return _generateBuilder.apply(this, arguments);
|
|
131
|
+
}
|
|
132
|
+
function _generateBuilder() {
|
|
133
|
+
_generateBuilder = _asyncToGenerator(function(options, generateProvider, utils) {
|
|
134
|
+
var normalizedConfig, appContext, _ref, modifyBuilderConfig, modifyBuilderInstance, builderConfig, provider, target, builderOptions, builder;
|
|
135
|
+
return __generator(this, function(_state) {
|
|
136
|
+
switch(_state.label){
|
|
137
|
+
case 0:
|
|
138
|
+
normalizedConfig = options.normalizedConfig, appContext = options.appContext;
|
|
139
|
+
_ref = utils || {}, modifyBuilderConfig = _ref.modifyBuilderConfig, modifyBuilderInstance = _ref.modifyBuilderInstance;
|
|
140
|
+
builderConfig = createBuilderProviderConfig(normalizedConfig, appContext, modifyBuilderConfig);
|
|
141
|
+
provider = generateProvider({
|
|
142
|
+
builderConfig: builderConfig
|
|
143
|
+
});
|
|
144
|
+
target = getBuilderTargets(normalizedConfig);
|
|
145
|
+
builderOptions = createBuilderOptions(target, appContext);
|
|
146
|
+
return [
|
|
147
|
+
4,
|
|
148
|
+
createBuilder(provider, builderOptions)
|
|
149
|
+
];
|
|
150
|
+
case 1:
|
|
151
|
+
builder = _state.sent();
|
|
152
|
+
return [
|
|
153
|
+
4,
|
|
154
|
+
applyBuilderPlugins(builder, options)
|
|
155
|
+
];
|
|
156
|
+
case 2:
|
|
157
|
+
_state.sent();
|
|
158
|
+
return [
|
|
159
|
+
4,
|
|
160
|
+
modifyBuilderInstance === null || modifyBuilderInstance === void 0 ? void 0 : modifyBuilderInstance(builder)
|
|
161
|
+
];
|
|
162
|
+
case 3:
|
|
163
|
+
_state.sent();
|
|
164
|
+
return [
|
|
165
|
+
2,
|
|
166
|
+
builder
|
|
167
|
+
];
|
|
168
|
+
}
|
|
169
|
+
});
|
|
170
|
+
});
|
|
171
|
+
return _generateBuilder.apply(this, arguments);
|
|
172
|
+
}
|
|
173
|
+
function applyBuilderPlugins(builder, options) {
|
|
174
|
+
return _applyBuilderPlugins.apply(this, arguments);
|
|
175
|
+
}
|
|
176
|
+
function _applyBuilderPlugins() {
|
|
177
|
+
_applyBuilderPlugins = _asyncToGenerator(function(builder, options) {
|
|
178
|
+
var builderPluginAdapterModern;
|
|
179
|
+
return __generator(this, function(_state) {
|
|
180
|
+
switch(_state.label){
|
|
181
|
+
case 0:
|
|
182
|
+
return [
|
|
183
|
+
4,
|
|
184
|
+
import("../shared/builderPlugins/adapterModern")
|
|
185
|
+
];
|
|
186
|
+
case 1:
|
|
187
|
+
builderPluginAdapterModern = _state.sent().builderPluginAdapterModern;
|
|
188
|
+
builder.addPlugins([
|
|
189
|
+
builderPluginAdapterModern(options)
|
|
190
|
+
]);
|
|
191
|
+
return [
|
|
192
|
+
2
|
|
193
|
+
];
|
|
194
|
+
}
|
|
195
|
+
});
|
|
196
|
+
});
|
|
197
|
+
return _applyBuilderPlugins.apply(this, arguments);
|
|
198
|
+
}
|
|
199
|
+
export { generateBuilder };
|