@modern-js/app-tools 2.3.1-alpha.2 → 2.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +115 -0
- package/README.md +14 -18
- package/dist/{js/node → cjs}/analyze/constants.js +0 -0
- package/dist/cjs/analyze/generateCode.js +249 -0
- package/dist/{js/node → cjs}/analyze/getBundleEntry.js +6 -0
- package/dist/{js/node → cjs}/analyze/getClientRoutes/getRoutes.js +1 -18
- package/dist/{js/node → cjs}/analyze/getClientRoutes/getRoutesLegacy.js +1 -18
- package/dist/{js/node → cjs}/analyze/getClientRoutes/index.js +0 -0
- package/dist/{js/node → cjs}/analyze/getClientRoutes/utils.js +0 -0
- package/dist/{js/node → cjs}/analyze/getFileSystemEntry.js +0 -0
- package/dist/{js/node → cjs}/analyze/getHtmlTemplate.js +4 -24
- package/dist/{js/node → cjs}/analyze/getServerRoutes.js +22 -42
- package/dist/cjs/analyze/index.js +290 -0
- package/dist/{js/node → cjs}/analyze/isDefaultExportFunction.js +0 -0
- package/dist/{js/node → cjs}/analyze/makeLegalIdentifier.js +0 -0
- package/dist/{js/node → cjs}/analyze/nestedRoutes.js +16 -50
- package/dist/{js/node → cjs}/analyze/templates.js +16 -49
- package/dist/{js/node → cjs}/analyze/utils.js +9 -29
- package/dist/cjs/builder/builder-rspack/index.js +31 -0
- package/dist/cjs/builder/builder-webpack/builderPlugins/compatModern.js +64 -0
- package/dist/cjs/builder/builder-webpack/index.js +78 -0
- package/dist/{js/node/builder/webpackPlugins/routerPlugin.js → cjs/builder/builder-webpack/webpackPlugins/RouterPlugin.js} +14 -29
- package/dist/cjs/builder/builder-webpack/webpackPlugins/index.js +17 -0
- package/dist/cjs/builder/generator/createBuilderOptions.js +47 -0
- package/dist/{js/node/config/initial/index.js → cjs/builder/generator/createBuilderProviderConfig.js} +26 -18
- package/dist/cjs/builder/generator/getBuilderTargets.js +39 -0
- package/dist/cjs/builder/generator/index.js +58 -0
- package/dist/cjs/builder/index.js +46 -0
- package/dist/{js/node/builder/builderPlugins/compatModern.js → cjs/builder/shared/builderPlugins/adapterModern.js} +109 -137
- package/dist/{js/node/builder/webpackPlugins/htmlAsyncChunkPlugin.js → cjs/builder/shared/bundlerPlugins/HtmlAsyncChunkPlugin.js} +17 -20
- package/dist/{js/node/builder/webpackPlugins/htmlBottomTemplate.js → cjs/builder/shared/bundlerPlugins/HtmlBottomTemplate.js} +21 -24
- package/dist/{js/node/builder/share.js → cjs/builder/shared/createCopyPattern.js} +3 -3
- package/dist/cjs/builder/shared/index.js +19 -0
- package/dist/{js/node/builder → cjs/builder/shared}/loaders/serverModuleLoader.js +0 -0
- package/dist/{js/node/utils → cjs/builder/shared}/types.js +0 -0
- package/dist/{js/node → cjs}/commands/build.js +9 -46
- package/dist/cjs/commands/deploy.js +31 -0
- package/dist/{js/node → cjs}/commands/dev.js +17 -52
- package/dist/{js/node → cjs}/commands/index.js +0 -0
- package/dist/{js/node → cjs}/commands/inspect.js +2 -22
- package/dist/{js/node → cjs}/commands/serve.js +8 -28
- package/dist/{js/node → cjs}/config/default.js +16 -27
- package/dist/cjs/config/index.js +19 -0
- package/dist/cjs/config/initialize/index.js +35 -0
- package/dist/{js/node/config/initial → cjs/config/initialize}/inits.js +8 -22
- package/dist/{js/node/config/initial → cjs/config/legacy}/createHtmlConfig.js +0 -0
- package/dist/{js/node/config/initial → cjs/config/legacy}/createOutputConfig.js +0 -0
- package/dist/{js/node/config/initial → cjs/config/legacy}/createSourceConfig.js +0 -0
- package/dist/{js/node/config/initial → cjs/config/legacy}/createToolsConfig.js +0 -0
- package/dist/{js/node/config/initial/transformNormalizedConfig.js → cjs/config/legacy/index.js} +8 -3
- package/dist/cjs/defineConfig.js +33 -0
- package/dist/{js/node → cjs}/exports/server.js +0 -0
- package/dist/{js/node → cjs}/hooks.js +0 -0
- package/dist/cjs/index.js +198 -0
- package/dist/cjs/initialize/index.js +102 -0
- package/dist/{js/node → cjs}/locale/en.js +0 -0
- package/dist/{js/node → cjs}/locale/index.js +0 -0
- package/dist/{js/node → cjs}/locale/zh.js +1 -1
- package/dist/{js/node → cjs}/schema/Schema.js +0 -0
- package/dist/{js/node → cjs}/schema/index.js +0 -0
- package/dist/{js/node → cjs}/schema/legacy.js +0 -0
- package/dist/{js/node → cjs}/types/config/deploy.js +0 -0
- package/dist/{js/node → cjs}/types/config/dev.js +0 -0
- package/dist/{js/node → cjs}/types/config/experiments.js +0 -0
- package/dist/{js/node → cjs}/types/config/html.js +0 -0
- package/dist/{js/node → cjs}/types/config/index.js +0 -0
- package/dist/{js/node → cjs}/types/config/output.js +0 -0
- package/dist/{js/node → cjs}/types/config/performance.js +0 -0
- package/dist/{js/node → cjs}/types/config/security.js +0 -0
- package/dist/{js/node → cjs}/types/config/source.js +0 -0
- package/dist/{js/node → cjs}/types/config/tools.js +0 -0
- package/dist/{js/node → cjs}/types/hooks.js +0 -0
- package/dist/{js/node → cjs}/types/index.js +0 -0
- package/dist/{js/node → cjs}/types/legacyConfig/deploy.js +0 -0
- package/dist/{js/node → cjs}/types/legacyConfig/dev.js +0 -0
- package/dist/{js/node → cjs}/types/legacyConfig/index.js +0 -0
- package/dist/{js/node → cjs}/types/legacyConfig/output.js +0 -0
- package/dist/{js/node → cjs}/types/legacyConfig/source.js +0 -0
- package/dist/{js/node → cjs}/types/legacyConfig/tools.js +0 -0
- package/dist/cjs/types/utils.js +15 -0
- package/dist/{js/node → cjs}/utils/config.js +19 -57
- package/dist/{js/node → cjs}/utils/createServer.js +10 -46
- package/dist/{js/node → cjs}/utils/env.js +0 -0
- package/dist/{js/node → cjs}/utils/generateWatchFiles.js +16 -38
- package/dist/{js/node → cjs}/utils/getSelectedEntries.js +3 -23
- package/dist/{js/node/config/index.js → cjs/utils/getServerInternalPlugins.js} +20 -13
- package/dist/{js/node → cjs}/utils/language.js +0 -0
- package/dist/{js/node → cjs}/utils/printInstructions.js +3 -23
- package/dist/cjs/utils/restart.js +45 -0
- package/dist/{js/node → cjs}/utils/routes.js +3 -23
- package/dist/cjs/utils/types.js +15 -0
- package/dist/{js/treeshaking → esm}/analyze/constants.js +0 -0
- package/dist/{js/treeshaking → esm}/analyze/generateCode.js +14 -14
- package/dist/{js/treeshaking → esm}/analyze/getBundleEntry.js +4 -2
- package/dist/{js/treeshaking → esm}/analyze/getClientRoutes/getRoutes.js +1 -1
- package/dist/{js/treeshaking → esm}/analyze/getClientRoutes/getRoutesLegacy.js +1 -1
- package/dist/{js/treeshaking → esm}/analyze/getClientRoutes/index.js +0 -0
- package/dist/{js/treeshaking → esm}/analyze/getClientRoutes/utils.js +0 -0
- package/dist/{js/treeshaking → esm}/analyze/getFileSystemEntry.js +1 -1
- package/dist/{js/treeshaking → esm}/analyze/getHtmlTemplate.js +0 -0
- package/dist/{js/treeshaking → esm}/analyze/getServerRoutes.js +8 -6
- package/dist/{js/treeshaking → esm}/analyze/index.js +142 -137
- package/dist/{js/treeshaking → esm}/analyze/isDefaultExportFunction.js +0 -0
- package/dist/{js/treeshaking → esm}/analyze/makeLegalIdentifier.js +0 -0
- package/dist/{js/treeshaking → esm}/analyze/nestedRoutes.js +5 -5
- package/dist/{js/treeshaking → esm}/analyze/templates.js +8 -7
- package/dist/{js/treeshaking → esm}/analyze/utils.js +3 -3
- package/dist/esm/builder/builder-rspack/index.js +6 -0
- package/dist/esm/builder/builder-webpack/builderPlugins/compatModern.js +64 -0
- package/dist/{js/treeshaking/builder → esm/builder/builder-webpack}/index.js +44 -117
- package/dist/{js/treeshaking/builder/webpackPlugins/routerPlugin.js → esm/builder/builder-webpack/webpackPlugins/RouterPlugin.js} +6 -3
- package/dist/esm/builder/builder-webpack/webpackPlugins/index.js +1 -0
- package/dist/esm/builder/generator/createBuilderOptions.js +41 -0
- package/dist/esm/builder/generator/createBuilderProviderConfig.js +70 -0
- package/dist/esm/builder/generator/getBuilderTargets.js +16 -0
- package/dist/esm/builder/generator/index.js +199 -0
- package/dist/esm/builder/index.js +175 -0
- package/dist/{js/treeshaking/builder/builderPlugins/compatModern.js → esm/builder/shared/builderPlugins/adapterModern.js} +138 -142
- package/dist/{js/treeshaking/builder/webpackPlugins/htmlAsyncChunkPlugin.js → esm/builder/shared/bundlerPlugins/HtmlAsyncChunkPlugin.js} +0 -0
- package/dist/{js/treeshaking/builder/webpackPlugins/htmlBottomTemplate.js → esm/builder/shared/bundlerPlugins/HtmlBottomTemplate.js} +2 -2
- package/dist/{js/treeshaking/builder/share.js → esm/builder/shared/createCopyPattern.js} +0 -0
- package/dist/esm/builder/shared/index.js +3 -0
- package/dist/{js/treeshaking/builder → esm/builder/shared}/loaders/serverModuleLoader.js +0 -0
- package/dist/{js/treeshaking/utils → esm/builder/shared}/types.js +0 -0
- package/dist/{js/treeshaking → esm}/commands/build.js +0 -0
- package/dist/{js/treeshaking → esm}/commands/deploy.js +0 -0
- package/dist/{js/treeshaking → esm}/commands/dev.js +2 -2
- package/dist/{js/treeshaking → esm}/commands/index.js +0 -0
- package/dist/{js/treeshaking → esm}/commands/inspect.js +0 -0
- package/dist/{js/treeshaking → esm}/commands/serve.js +2 -2
- package/dist/{js/treeshaking → esm}/config/default.js +2 -2
- package/dist/esm/config/index.js +3 -0
- package/dist/esm/config/initialize/index.js +10 -0
- package/dist/{js/treeshaking/config/initial → esm/config/initialize}/inits.js +6 -4
- package/dist/esm/config/legacy/createHtmlConfig.js +19 -0
- package/dist/{js/treeshaking/config/initial → esm/config/legacy}/createOutputConfig.js +1 -1
- package/dist/{js/treeshaking/config/initial → esm/config/legacy}/createSourceConfig.js +1 -1
- package/dist/{js/treeshaking/config/initial → esm/config/legacy}/createToolsConfig.js +1 -1
- package/dist/{js/treeshaking/config/initial/transformNormalizedConfig.js → esm/config/legacy/index.js} +4 -1
- package/dist/{js/treeshaking → esm}/defineConfig.js +0 -0
- package/dist/{js/treeshaking → esm}/exports/server.js +0 -0
- package/dist/{js/treeshaking → esm}/hooks.js +0 -0
- package/dist/{js/treeshaking → esm}/index.js +19 -12
- package/dist/{js/treeshaking → esm}/initialize/index.js +36 -28
- package/dist/{js/treeshaking → esm}/locale/en.js +0 -0
- package/dist/{js/treeshaking → esm}/locale/index.js +0 -0
- package/dist/{js/treeshaking → esm}/locale/zh.js +1 -1
- package/dist/{js/treeshaking → esm}/schema/Schema.js +0 -0
- package/dist/{js/treeshaking → esm}/schema/index.js +0 -0
- package/dist/{js/treeshaking → esm}/schema/legacy.js +0 -0
- package/dist/{js/treeshaking → esm}/types/config/deploy.js +0 -0
- package/dist/{js/treeshaking → esm}/types/config/dev.js +0 -0
- package/dist/{js/treeshaking → esm}/types/config/experiments.js +0 -0
- package/dist/{js/treeshaking → esm}/types/config/html.js +0 -0
- package/dist/{js/treeshaking → esm}/types/config/index.js +0 -0
- package/dist/{js/treeshaking → esm}/types/config/output.js +0 -0
- package/dist/{js/treeshaking → esm}/types/config/performance.js +0 -0
- package/dist/{js/treeshaking → esm}/types/config/security.js +0 -0
- package/dist/{js/treeshaking → esm}/types/config/source.js +0 -0
- package/dist/{js/treeshaking → esm}/types/config/tools.js +0 -0
- package/dist/{js/treeshaking → esm}/types/hooks.js +0 -0
- package/dist/{js/treeshaking → esm}/types/index.js +0 -0
- package/dist/{js/treeshaking → esm}/types/legacyConfig/deploy.js +0 -0
- package/dist/{js/treeshaking → esm}/types/legacyConfig/dev.js +0 -0
- package/dist/{js/treeshaking → esm}/types/legacyConfig/index.js +0 -0
- package/dist/{js/treeshaking → esm}/types/legacyConfig/output.js +0 -0
- package/dist/{js/treeshaking → esm}/types/legacyConfig/source.js +0 -0
- package/dist/{js/treeshaking → esm}/types/legacyConfig/tools.js +0 -0
- package/dist/esm/types/utils.js +1 -0
- package/dist/{js/treeshaking → esm}/utils/config.js +2 -2
- package/dist/{js/treeshaking → esm}/utils/createServer.js +0 -0
- package/dist/{js/treeshaking → esm}/utils/env.js +0 -0
- package/dist/{js/treeshaking → esm}/utils/generateWatchFiles.js +0 -0
- package/dist/{js/treeshaking → esm}/utils/getSelectedEntries.js +0 -0
- package/dist/{js/treeshaking → esm}/utils/getServerInternalPlugins.js +2 -2
- package/dist/{js/treeshaking → esm}/utils/language.js +0 -0
- package/dist/{js/treeshaking → esm}/utils/printInstructions.js +0 -0
- package/dist/{js/treeshaking → esm}/utils/restart.js +0 -0
- package/dist/{js/treeshaking → esm}/utils/routes.js +0 -0
- package/dist/esm/utils/types.js +1 -0
- package/dist/{js/modern → esm-node}/analyze/constants.js +0 -0
- package/dist/esm-node/analyze/generateCode.js +225 -0
- package/dist/{js/modern → esm-node}/analyze/getBundleEntry.js +6 -0
- package/dist/{js/modern → esm-node}/analyze/getClientRoutes/getRoutes.js +1 -20
- package/dist/{js/modern → esm-node}/analyze/getClientRoutes/getRoutesLegacy.js +1 -20
- package/dist/{js/modern → esm-node}/analyze/getClientRoutes/index.js +0 -0
- package/dist/{js/modern → esm-node}/analyze/getClientRoutes/utils.js +0 -0
- package/dist/{js/modern → esm-node}/analyze/getFileSystemEntry.js +0 -0
- package/dist/{js/modern → esm-node}/analyze/getHtmlTemplate.js +4 -24
- package/dist/{js/modern → esm-node}/analyze/getServerRoutes.js +24 -45
- package/dist/esm-node/analyze/index.js +281 -0
- package/dist/{js/modern → esm-node}/analyze/isDefaultExportFunction.js +0 -0
- package/dist/{js/modern → esm-node}/analyze/makeLegalIdentifier.js +0 -0
- package/dist/{js/modern → esm-node}/analyze/nestedRoutes.js +16 -52
- package/dist/{js/modern → esm-node}/analyze/templates.js +16 -51
- package/dist/{js/modern → esm-node}/analyze/utils.js +9 -29
- package/dist/esm-node/builder/builder-rspack/index.js +8 -0
- package/dist/esm-node/builder/builder-webpack/builderPlugins/compatModern.js +41 -0
- package/dist/esm-node/builder/builder-webpack/index.js +51 -0
- package/dist/{js/modern/builder/webpackPlugins/routerPlugin.js → esm-node/builder/builder-webpack/webpackPlugins/RouterPlugin.js} +8 -25
- package/dist/esm-node/builder/builder-webpack/webpackPlugins/index.js +1 -0
- package/dist/esm-node/builder/generator/createBuilderOptions.js +24 -0
- package/dist/esm-node/builder/generator/createBuilderProviderConfig.js +26 -0
- package/dist/esm-node/builder/generator/getBuilderTargets.js +21 -0
- package/dist/esm-node/builder/generator/index.js +29 -0
- package/dist/esm-node/builder/index.js +17 -0
- package/dist/{js/modern/builder/builderPlugins/compatModern.js → esm-node/builder/shared/builderPlugins/adapterModern.js} +104 -135
- package/dist/esm-node/builder/shared/bundlerPlugins/HtmlAsyncChunkPlugin.js +27 -0
- package/dist/esm-node/builder/shared/bundlerPlugins/HtmlBottomTemplate.js +34 -0
- package/dist/{js/modern/builder/share.js → esm-node/builder/shared/createCopyPattern.js} +0 -0
- package/dist/esm-node/builder/shared/index.js +3 -0
- package/dist/{js/modern/builder → esm-node/builder/shared}/loaders/serverModuleLoader.js +0 -0
- package/dist/{js/modern/utils → esm-node/builder/shared}/types.js +0 -0
- package/dist/esm-node/commands/build.js +52 -0
- package/dist/esm-node/commands/deploy.js +8 -0
- package/dist/esm-node/commands/dev.js +72 -0
- package/dist/{js/modern → esm-node}/commands/index.js +0 -0
- package/dist/esm-node/commands/inspect.js +18 -0
- package/dist/{js/modern → esm-node}/commands/serve.js +8 -28
- package/dist/{js/modern → esm-node}/config/default.js +16 -29
- package/dist/esm-node/config/index.js +3 -0
- package/dist/esm-node/config/initialize/index.js +12 -0
- package/dist/{js/modern/config/initial → esm-node/config/initialize}/inits.js +8 -24
- package/dist/{js/modern/config/initial → esm-node/config/legacy}/createHtmlConfig.js +0 -0
- package/dist/{js/modern/config/initial → esm-node/config/legacy}/createOutputConfig.js +0 -0
- package/dist/{js/modern/config/initial → esm-node/config/legacy}/createSourceConfig.js +0 -0
- package/dist/{js/modern/config/initial → esm-node/config/legacy}/createToolsConfig.js +0 -0
- package/dist/{js/modern/config/initial/transformNormalizedConfig.js → esm-node/config/legacy/index.js} +4 -0
- package/dist/esm-node/defineConfig.js +9 -0
- package/dist/{js/modern → esm-node}/exports/server.js +0 -0
- package/dist/{js/modern → esm-node}/hooks.js +0 -0
- package/dist/esm-node/index.js +172 -0
- package/dist/esm-node/initialize/index.js +91 -0
- package/dist/{js/modern → esm-node}/locale/en.js +0 -0
- package/dist/{js/modern → esm-node}/locale/index.js +0 -0
- package/dist/{js/modern → esm-node}/locale/zh.js +1 -1
- package/dist/{js/modern → esm-node}/schema/Schema.js +0 -0
- package/dist/{js/modern → esm-node}/schema/index.js +0 -0
- package/dist/{js/modern → esm-node}/schema/legacy.js +0 -0
- package/dist/{js/modern → esm-node}/types/config/deploy.js +0 -0
- package/dist/{js/modern → esm-node}/types/config/dev.js +0 -0
- package/dist/{js/modern → esm-node}/types/config/experiments.js +0 -0
- package/dist/{js/modern → esm-node}/types/config/html.js +0 -0
- package/dist/{js/modern → esm-node}/types/config/index.js +0 -0
- package/dist/{js/modern → esm-node}/types/config/output.js +0 -0
- package/dist/{js/modern → esm-node}/types/config/performance.js +0 -0
- package/dist/{js/modern → esm-node}/types/config/security.js +0 -0
- package/dist/{js/modern → esm-node}/types/config/source.js +0 -0
- package/dist/{js/modern → esm-node}/types/config/tools.js +0 -0
- package/dist/{js/modern → esm-node}/types/hooks.js +0 -0
- package/dist/{js/modern → esm-node}/types/index.js +0 -0
- package/dist/{js/modern → esm-node}/types/legacyConfig/deploy.js +0 -0
- package/dist/{js/modern → esm-node}/types/legacyConfig/dev.js +0 -0
- package/dist/{js/modern → esm-node}/types/legacyConfig/index.js +0 -0
- package/dist/{js/modern → esm-node}/types/legacyConfig/output.js +0 -0
- package/dist/{js/modern → esm-node}/types/legacyConfig/source.js +0 -0
- package/dist/{js/modern → esm-node}/types/legacyConfig/tools.js +0 -0
- package/dist/esm-node/types/utils.js +0 -0
- package/dist/esm-node/utils/config.js +88 -0
- package/dist/esm-node/utils/createServer.js +37 -0
- package/dist/{js/modern → esm-node}/utils/env.js +0 -0
- package/dist/esm-node/utils/generateWatchFiles.js +33 -0
- package/dist/{js/modern → esm-node}/utils/getSelectedEntries.js +3 -23
- package/dist/esm-node/utils/getServerInternalPlugins.js +18 -0
- package/dist/{js/modern → esm-node}/utils/language.js +0 -0
- package/dist/esm-node/utils/printInstructions.js +11 -0
- package/dist/esm-node/utils/restart.js +22 -0
- package/dist/esm-node/utils/routes.js +10 -0
- package/dist/esm-node/utils/types.js +0 -0
- package/dist/types/analyze/generateCode.d.ts +1 -1
- package/dist/types/analyze/getBundleEntry.d.ts +1 -1
- package/dist/types/analyze/getFileSystemEntry.d.ts +1 -1
- package/dist/types/analyze/getHtmlTemplate.d.ts +2 -2
- package/dist/types/analyze/getServerRoutes.d.ts +1 -1
- package/dist/types/analyze/index.d.ts +5 -1
- package/dist/types/builder/builder-rspack/index.d.ts +2 -0
- package/dist/types/builder/{builderPlugins → builder-webpack/builderPlugins}/compatModern.d.ts +2 -2
- package/dist/types/builder/builder-webpack/index.d.ts +4 -0
- package/dist/types/builder/{webpackPlugins/routerPlugin.d.ts → builder-webpack/webpackPlugins/RouterPlugin.d.ts} +1 -1
- package/dist/types/builder/builder-webpack/webpackPlugins/index.d.ts +1 -0
- package/dist/types/builder/generator/createBuilderOptions.d.ts +3 -0
- package/dist/types/builder/generator/createBuilderProviderConfig.d.ts +2 -0
- package/dist/types/builder/generator/getBuilderTargets.d.ts +3 -0
- package/dist/types/builder/generator/index.d.ts +17 -0
- package/dist/types/builder/index.d.ts +1 -18
- package/dist/types/builder/shared/builderPlugins/adapterModern.d.ts +13 -0
- package/dist/types/builder/{webpackPlugins/htmlAsyncChunkPlugin.d.ts → shared/bundlerPlugins/HtmlAsyncChunkPlugin.d.ts} +2 -1
- package/dist/types/builder/{webpackPlugins/htmlBottomTemplate.d.ts → shared/bundlerPlugins/HtmlBottomTemplate.d.ts} +2 -1
- package/dist/types/builder/{share.d.ts → shared/createCopyPattern.d.ts} +1 -1
- package/dist/types/builder/shared/index.d.ts +3 -0
- package/dist/types/builder/shared/loaders/serverModuleLoader.d.ts +4 -0
- package/dist/types/builder/shared/types.d.ts +16 -0
- package/dist/types/commands/build.d.ts +1 -1
- package/dist/types/commands/deploy.d.ts +1 -1
- package/dist/types/commands/dev.d.ts +1 -1
- package/dist/types/commands/inspect.d.ts +1 -1
- package/dist/types/commands/serve.d.ts +1 -1
- package/dist/types/config/default.d.ts +1 -1
- package/dist/types/config/index.d.ts +3 -2
- package/dist/types/config/initialize/index.d.ts +2 -0
- package/dist/types/config/{initial → initialize}/inits.d.ts +3 -3
- package/dist/types/config/{initial → legacy}/createHtmlConfig.d.ts +1 -1
- package/dist/types/config/{initial → legacy}/createOutputConfig.d.ts +1 -1
- package/dist/types/config/{initial → legacy}/createSourceConfig.d.ts +1 -1
- package/dist/types/config/{initial → legacy}/createToolsConfig.d.ts +1 -1
- package/dist/types/config/legacy/index.d.ts +3 -0
- package/dist/types/defineConfig.d.ts +2 -2
- package/dist/types/index.d.ts +7 -3
- package/dist/types/initialize/index.d.ts +6 -2
- package/dist/types/types/config/deploy.d.ts +1 -2
- package/dist/types/types/config/dev.d.ts +2 -3
- package/dist/types/types/config/experiments.d.ts +1 -2
- package/dist/types/types/config/html.d.ts +5 -3
- package/dist/types/types/config/index.d.ts +41 -48
- package/dist/types/types/config/output.d.ts +8 -3
- package/dist/types/types/config/performance.d.ts +6 -3
- package/dist/types/types/config/security.d.ts +3 -3
- package/dist/types/types/config/source.d.ts +7 -3
- package/dist/types/types/config/tools.d.ts +10 -4
- package/dist/types/types/hooks.d.ts +6 -4
- package/dist/types/types/index.d.ts +19 -7
- package/dist/types/types/utils.d.ts +7 -0
- package/dist/types/utils/config.d.ts +1 -1
- package/dist/types/utils/getServerInternalPlugins.d.ts +1 -1
- package/dist/types/utils/printInstructions.d.ts +1 -1
- package/package.json +40 -32
- package/dist/js/modern/analyze/generateCode.js +0 -247
- package/dist/js/modern/analyze/index.js +0 -332
- package/dist/js/modern/builder/index.js +0 -159
- package/dist/js/modern/builder/webpackPlugins/htmlAsyncChunkPlugin.js +0 -30
- package/dist/js/modern/builder/webpackPlugins/htmlBottomTemplate.js +0 -37
- package/dist/js/modern/commands/build.js +0 -91
- package/dist/js/modern/commands/deploy.js +0 -28
- package/dist/js/modern/commands/dev.js +0 -109
- package/dist/js/modern/commands/inspect.js +0 -38
- package/dist/js/modern/config/index.js +0 -8
- package/dist/js/modern/config/initial/index.js +0 -16
- package/dist/js/modern/defineConfig.js +0 -27
- package/dist/js/modern/index.js +0 -211
- package/dist/js/modern/initialize/index.js +0 -124
- package/dist/js/modern/utils/config.js +0 -128
- package/dist/js/modern/utils/createServer.js +0 -75
- package/dist/js/modern/utils/generateWatchFiles.js +0 -55
- package/dist/js/modern/utils/getServerInternalPlugins.js +0 -58
- package/dist/js/modern/utils/printInstructions.js +0 -31
- package/dist/js/modern/utils/restart.js +0 -44
- package/dist/js/modern/utils/routes.js +0 -30
- package/dist/js/node/analyze/generateCode.js +0 -271
- package/dist/js/node/analyze/index.js +0 -339
- package/dist/js/node/builder/index.js +0 -177
- package/dist/js/node/commands/deploy.js +0 -51
- package/dist/js/node/defineConfig.js +0 -49
- package/dist/js/node/index.js +0 -235
- package/dist/js/node/initialize/index.js +0 -134
- package/dist/js/node/utils/getServerInternalPlugins.js +0 -79
- package/dist/js/node/utils/restart.js +0 -67
- package/dist/js/treeshaking/config/index.js +0 -3
- package/dist/js/treeshaking/config/initial/createHtmlConfig.js +0 -19
- package/dist/js/treeshaking/config/initial/index.js +0 -12
- package/dist/types/builder/loaders/serverModuleLoader.d.ts +0 -3
- package/dist/types/config/initial/index.d.ts +0 -4
- package/dist/types/config/initial/transformNormalizedConfig.d.ts +0 -2
|
@@ -1,159 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __defProps = Object.defineProperties;
|
|
3
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
-
var __spreadValues = (a, b) => {
|
|
9
|
-
for (var prop in b || (b = {}))
|
|
10
|
-
if (__hasOwnProp.call(b, prop))
|
|
11
|
-
__defNormalProp(a, prop, b[prop]);
|
|
12
|
-
if (__getOwnPropSymbols)
|
|
13
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
-
if (__propIsEnum.call(b, prop))
|
|
15
|
-
__defNormalProp(a, prop, b[prop]);
|
|
16
|
-
}
|
|
17
|
-
return a;
|
|
18
|
-
};
|
|
19
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
-
var __async = (__this, __arguments, generator) => {
|
|
21
|
-
return new Promise((resolve, reject) => {
|
|
22
|
-
var fulfilled = (value) => {
|
|
23
|
-
try {
|
|
24
|
-
step(generator.next(value));
|
|
25
|
-
} catch (e) {
|
|
26
|
-
reject(e);
|
|
27
|
-
}
|
|
28
|
-
};
|
|
29
|
-
var rejected = (value) => {
|
|
30
|
-
try {
|
|
31
|
-
step(generator.throw(value));
|
|
32
|
-
} catch (e) {
|
|
33
|
-
reject(e);
|
|
34
|
-
}
|
|
35
|
-
};
|
|
36
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
37
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
38
|
-
});
|
|
39
|
-
};
|
|
40
|
-
import {
|
|
41
|
-
createBuilder
|
|
42
|
-
} from "@modern-js/builder";
|
|
43
|
-
import {
|
|
44
|
-
builderWebpackProvider
|
|
45
|
-
} from "@modern-js/builder-webpack-provider";
|
|
46
|
-
import {
|
|
47
|
-
applyOptionsChain,
|
|
48
|
-
isProd,
|
|
49
|
-
isSSR,
|
|
50
|
-
isUseSSRBundle
|
|
51
|
-
} from "@modern-js/utils";
|
|
52
|
-
import {
|
|
53
|
-
PluginCompatModern
|
|
54
|
-
} from "./builderPlugins/compatModern";
|
|
55
|
-
import { createCopyPattern } from "./share";
|
|
56
|
-
function getBuilderTargets(normalizedConfig) {
|
|
57
|
-
const targets = ["web"];
|
|
58
|
-
const useNodeTarget = isProd() ? isUseSSRBundle(normalizedConfig) : isSSR(normalizedConfig);
|
|
59
|
-
if (useNodeTarget) {
|
|
60
|
-
targets.push("node");
|
|
61
|
-
}
|
|
62
|
-
return targets;
|
|
63
|
-
}
|
|
64
|
-
function createBuilderForModern(_0) {
|
|
65
|
-
return __async(this, arguments, function* ({
|
|
66
|
-
normalizedConfig,
|
|
67
|
-
appContext,
|
|
68
|
-
compatPluginConfig
|
|
69
|
-
}) {
|
|
70
|
-
const builderConfig = createBuilderProviderConfig(
|
|
71
|
-
normalizedConfig,
|
|
72
|
-
appContext
|
|
73
|
-
);
|
|
74
|
-
const webpackProvider = builderWebpackProvider({
|
|
75
|
-
builderConfig
|
|
76
|
-
});
|
|
77
|
-
const target = getBuilderTargets(normalizedConfig);
|
|
78
|
-
const builderOptions = createBuilderOptions(target, appContext);
|
|
79
|
-
const builder = yield createBuilder(webpackProvider, builderOptions);
|
|
80
|
-
yield applyBuilderPlugins(
|
|
81
|
-
builder,
|
|
82
|
-
normalizedConfig,
|
|
83
|
-
appContext,
|
|
84
|
-
compatPluginConfig
|
|
85
|
-
);
|
|
86
|
-
return builder;
|
|
87
|
-
});
|
|
88
|
-
}
|
|
89
|
-
function createBuilderProviderConfig(normalizedConfig, appContext) {
|
|
90
|
-
const output = createOutputConfig(normalizedConfig, appContext);
|
|
91
|
-
const htmlConfig = __spreadValues({}, normalizedConfig.html);
|
|
92
|
-
if (!htmlConfig.template) {
|
|
93
|
-
htmlConfig.templateByEntries = __spreadValues(__spreadValues({}, htmlConfig.templateByEntries), appContext.htmlTemplates);
|
|
94
|
-
}
|
|
95
|
-
return __spreadProps(__spreadValues({}, normalizedConfig), {
|
|
96
|
-
output,
|
|
97
|
-
dev: __spreadProps(__spreadValues({}, normalizedConfig.dev), {
|
|
98
|
-
port: appContext.port
|
|
99
|
-
}),
|
|
100
|
-
html: htmlConfig
|
|
101
|
-
});
|
|
102
|
-
function createOutputConfig(config, appContext2) {
|
|
103
|
-
const defaultCopyPattern = createCopyPattern(appContext2, config, "upload");
|
|
104
|
-
const { copy } = config.output;
|
|
105
|
-
const copyOptions = Array.isArray(copy) ? copy : copy == null ? void 0 : copy.patterns;
|
|
106
|
-
const builderCopy = [...copyOptions || [], defaultCopyPattern];
|
|
107
|
-
return __spreadProps(__spreadValues({}, config.output), {
|
|
108
|
-
copy: builderCopy,
|
|
109
|
-
cleanDistPath: false
|
|
110
|
-
});
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
function createBuilderOptions(target, appContext) {
|
|
114
|
-
const entries = {};
|
|
115
|
-
const { entrypoints = [], checkedEntries } = appContext;
|
|
116
|
-
for (const { entryName, entry } of entrypoints) {
|
|
117
|
-
if (checkedEntries && !checkedEntries.includes(entryName)) {
|
|
118
|
-
continue;
|
|
119
|
-
}
|
|
120
|
-
if (entryName in entries) {
|
|
121
|
-
entries[entryName].push(entry);
|
|
122
|
-
} else {
|
|
123
|
-
entries[entryName] = [entry];
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
return {
|
|
127
|
-
cwd: appContext.appDirectory,
|
|
128
|
-
target,
|
|
129
|
-
configPath: appContext.configFile || void 0,
|
|
130
|
-
entry: entries,
|
|
131
|
-
framework: appContext.metaName
|
|
132
|
-
};
|
|
133
|
-
}
|
|
134
|
-
function applyBuilderPlugins(builder, normalizedConfig, appContext, compatPluginConfig) {
|
|
135
|
-
return __async(this, null, function* () {
|
|
136
|
-
if (!normalizedConfig.output.disableNodePolyfill) {
|
|
137
|
-
const { builderPluginNodePolyfill } = yield import("@modern-js/builder-plugin-node-polyfill");
|
|
138
|
-
builder.addPlugins([builderPluginNodePolyfill()]);
|
|
139
|
-
}
|
|
140
|
-
if (normalizedConfig.tools.esbuild) {
|
|
141
|
-
const { esbuild: esbuildOptions } = normalizedConfig.tools;
|
|
142
|
-
const { builderPluginEsbuild } = yield import("@modern-js/builder-plugin-esbuild");
|
|
143
|
-
builder.addPlugins([
|
|
144
|
-
builderPluginEsbuild({
|
|
145
|
-
loader: false,
|
|
146
|
-
minimize: applyOptionsChain({}, esbuildOptions)
|
|
147
|
-
})
|
|
148
|
-
]);
|
|
149
|
-
}
|
|
150
|
-
builder.addPlugins([
|
|
151
|
-
PluginCompatModern(appContext, normalizedConfig, compatPluginConfig)
|
|
152
|
-
]);
|
|
153
|
-
});
|
|
154
|
-
}
|
|
155
|
-
export {
|
|
156
|
-
createBuilderForModern,
|
|
157
|
-
createBuilderOptions,
|
|
158
|
-
createBuilderProviderConfig
|
|
159
|
-
};
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
class HtmlAsyncChunkPlugin {
|
|
2
|
-
constructor(htmlWebpackPlugin) {
|
|
3
|
-
this.name = "HtmlAsyncChunkPlugin";
|
|
4
|
-
this.htmlWebpackPlugin = htmlWebpackPlugin;
|
|
5
|
-
}
|
|
6
|
-
apply(compiler) {
|
|
7
|
-
compiler.hooks.compilation.tap(
|
|
8
|
-
this.name,
|
|
9
|
-
(compilation) => {
|
|
10
|
-
const hooks = this.htmlWebpackPlugin.getHooks(compilation);
|
|
11
|
-
hooks.alterAssetTagGroups.tap(this.name, (assets) => {
|
|
12
|
-
const tags = [...assets.headTags, ...assets.bodyTags];
|
|
13
|
-
for (const tag of tags) {
|
|
14
|
-
if (tag.tagName === "script") {
|
|
15
|
-
const { attributes } = tag;
|
|
16
|
-
if (attributes && attributes.defer === true) {
|
|
17
|
-
attributes.async = true;
|
|
18
|
-
delete attributes.defer;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
return assets;
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
export {
|
|
29
|
-
HtmlAsyncChunkPlugin
|
|
30
|
-
};
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
class BottomTemplatePlugin {
|
|
2
|
-
constructor(htmlWebpackPlugin) {
|
|
3
|
-
this.bottomTemplateReg = /<!--<\?-\s*bottomTemplate\s*\?>-->/;
|
|
4
|
-
this.bodyRegExp = /(<\/\s*body\s*>)/i;
|
|
5
|
-
this.htmlWebpackPlugin = htmlWebpackPlugin;
|
|
6
|
-
this.name = "bottom-template";
|
|
7
|
-
}
|
|
8
|
-
apply(compiler) {
|
|
9
|
-
compiler.hooks.compilation.tap(
|
|
10
|
-
this.name,
|
|
11
|
-
(compilation) => {
|
|
12
|
-
this.htmlWebpackPlugin.getHooks(compilation).beforeEmit.tap(this.name, (data) => {
|
|
13
|
-
var _a;
|
|
14
|
-
if (!((_a = data.plugin.options) == null ? void 0 : _a.__internal__)) {
|
|
15
|
-
return data;
|
|
16
|
-
}
|
|
17
|
-
if (this.bottomTemplateReg.test(data.html)) {
|
|
18
|
-
data.html = data.html.replace(this.bottomTemplateReg, "");
|
|
19
|
-
const { bottomTemplate } = data.plugin.options;
|
|
20
|
-
if (bottomTemplate) {
|
|
21
|
-
data.html = data.html.replace(
|
|
22
|
-
this.bodyRegExp,
|
|
23
|
-
(match) => `
|
|
24
|
-
${bottomTemplate}
|
|
25
|
-
${match}`
|
|
26
|
-
);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
return data;
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
);
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
export {
|
|
36
|
-
BottomTemplatePlugin
|
|
37
|
-
};
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __defProps = Object.defineProperties;
|
|
3
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
-
var __spreadValues = (a, b) => {
|
|
9
|
-
for (var prop in b || (b = {}))
|
|
10
|
-
if (__hasOwnProp.call(b, prop))
|
|
11
|
-
__defNormalProp(a, prop, b[prop]);
|
|
12
|
-
if (__getOwnPropSymbols)
|
|
13
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
-
if (__propIsEnum.call(b, prop))
|
|
15
|
-
__defNormalProp(a, prop, b[prop]);
|
|
16
|
-
}
|
|
17
|
-
return a;
|
|
18
|
-
};
|
|
19
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
-
var __async = (__this, __arguments, generator) => {
|
|
21
|
-
return new Promise((resolve, reject) => {
|
|
22
|
-
var fulfilled = (value) => {
|
|
23
|
-
try {
|
|
24
|
-
step(generator.next(value));
|
|
25
|
-
} catch (e) {
|
|
26
|
-
reject(e);
|
|
27
|
-
}
|
|
28
|
-
};
|
|
29
|
-
var rejected = (value) => {
|
|
30
|
-
try {
|
|
31
|
-
step(generator.throw(value));
|
|
32
|
-
} catch (e) {
|
|
33
|
-
reject(e);
|
|
34
|
-
}
|
|
35
|
-
};
|
|
36
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
37
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
38
|
-
});
|
|
39
|
-
};
|
|
40
|
-
import { ResolvedConfigContext } from "@modern-js/core";
|
|
41
|
-
import { logger, printBuildError } from "@modern-js/utils";
|
|
42
|
-
import { generateRoutes } from "../utils/routes";
|
|
43
|
-
import { buildServerConfig } from "../utils/config";
|
|
44
|
-
const build = (api, options) => __async(void 0, null, function* () {
|
|
45
|
-
if (options == null ? void 0 : options.analyze) {
|
|
46
|
-
process.env.BUNDLE_ANALYZE = "true";
|
|
47
|
-
}
|
|
48
|
-
let resolvedConfig = api.useResolvedConfigContext();
|
|
49
|
-
const appContext = api.useAppContext();
|
|
50
|
-
const hookRunners = api.useHookRunners();
|
|
51
|
-
const { apiOnly } = appContext;
|
|
52
|
-
if (apiOnly) {
|
|
53
|
-
const { appDirectory: appDirectory2, distDirectory: distDirectory2, serverConfigFile: serverConfigFile2 } = appContext;
|
|
54
|
-
yield hookRunners.beforeBuild({
|
|
55
|
-
bundlerConfigs: void 0
|
|
56
|
-
});
|
|
57
|
-
yield buildServerConfig({
|
|
58
|
-
appDirectory: appDirectory2,
|
|
59
|
-
distDirectory: distDirectory2,
|
|
60
|
-
configFile: serverConfigFile2
|
|
61
|
-
});
|
|
62
|
-
yield generateRoutes(appContext);
|
|
63
|
-
yield hookRunners.afterBuild({
|
|
64
|
-
stats: void 0
|
|
65
|
-
});
|
|
66
|
-
return;
|
|
67
|
-
}
|
|
68
|
-
resolvedConfig = __spreadProps(__spreadValues({}, resolvedConfig), { cliOptions: options });
|
|
69
|
-
ResolvedConfigContext.set(resolvedConfig);
|
|
70
|
-
const { distDirectory, appDirectory, serverConfigFile } = appContext;
|
|
71
|
-
yield buildServerConfig({
|
|
72
|
-
appDirectory,
|
|
73
|
-
distDirectory,
|
|
74
|
-
configFile: serverConfigFile
|
|
75
|
-
});
|
|
76
|
-
try {
|
|
77
|
-
logger.info("Create a production build...\n");
|
|
78
|
-
if (!appContext.builder) {
|
|
79
|
-
throw new Error(
|
|
80
|
-
"Expect the Builder to have been initialized, But the appContext.builder received `undefined`"
|
|
81
|
-
);
|
|
82
|
-
}
|
|
83
|
-
yield appContext.builder.build();
|
|
84
|
-
} catch (error) {
|
|
85
|
-
printBuildError(error);
|
|
86
|
-
process.exit(1);
|
|
87
|
-
}
|
|
88
|
-
});
|
|
89
|
-
export {
|
|
90
|
-
build
|
|
91
|
-
};
|
|
@@ -1,28 +0,0 @@
|
|
|
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
|
-
const deploy = (api, options) => __async(void 0, null, function* () {
|
|
22
|
-
const hookRunners = api.useHookRunners();
|
|
23
|
-
yield hookRunners.beforeDeploy(options);
|
|
24
|
-
yield hookRunners.afterDeploy(options);
|
|
25
|
-
});
|
|
26
|
-
export {
|
|
27
|
-
deploy
|
|
28
|
-
};
|
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __defProps = Object.defineProperties;
|
|
3
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
-
var __spreadValues = (a, b) => {
|
|
9
|
-
for (var prop in b || (b = {}))
|
|
10
|
-
if (__hasOwnProp.call(b, prop))
|
|
11
|
-
__defNormalProp(a, prop, b[prop]);
|
|
12
|
-
if (__getOwnPropSymbols)
|
|
13
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
-
if (__propIsEnum.call(b, prop))
|
|
15
|
-
__defNormalProp(a, prop, b[prop]);
|
|
16
|
-
}
|
|
17
|
-
return a;
|
|
18
|
-
};
|
|
19
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
-
var __async = (__this, __arguments, generator) => {
|
|
21
|
-
return new Promise((resolve, reject) => {
|
|
22
|
-
var fulfilled = (value) => {
|
|
23
|
-
try {
|
|
24
|
-
step(generator.next(value));
|
|
25
|
-
} catch (e) {
|
|
26
|
-
reject(e);
|
|
27
|
-
}
|
|
28
|
-
};
|
|
29
|
-
var rejected = (value) => {
|
|
30
|
-
try {
|
|
31
|
-
step(generator.throw(value));
|
|
32
|
-
} catch (e) {
|
|
33
|
-
reject(e);
|
|
34
|
-
}
|
|
35
|
-
};
|
|
36
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
37
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
38
|
-
});
|
|
39
|
-
};
|
|
40
|
-
import { ResolvedConfigContext } from "@modern-js/core";
|
|
41
|
-
import { printInstructions } from "../utils/printInstructions";
|
|
42
|
-
import {
|
|
43
|
-
setServer,
|
|
44
|
-
createServer,
|
|
45
|
-
injectDataLoaderPlugin
|
|
46
|
-
} from "../utils/createServer";
|
|
47
|
-
import { generateRoutes } from "../utils/routes";
|
|
48
|
-
import { buildServerConfig } from "../utils/config";
|
|
49
|
-
import { getServerInternalPlugins } from "../utils/getServerInternalPlugins";
|
|
50
|
-
const dev = (api, options) => __async(void 0, null, function* () {
|
|
51
|
-
var _a;
|
|
52
|
-
if (options.analyze) {
|
|
53
|
-
process.env.BUNDLE_ANALYZE = "true";
|
|
54
|
-
}
|
|
55
|
-
let normalizedConfig = api.useResolvedConfigContext();
|
|
56
|
-
const appContext = api.useAppContext();
|
|
57
|
-
const hookRunners = api.useHookRunners();
|
|
58
|
-
normalizedConfig = __spreadProps(__spreadValues({}, normalizedConfig), { cliOptions: options });
|
|
59
|
-
ResolvedConfigContext.set(normalizedConfig);
|
|
60
|
-
const { appDirectory, distDirectory, port, apiOnly, serverConfigFile } = appContext;
|
|
61
|
-
yield buildServerConfig({
|
|
62
|
-
appDirectory,
|
|
63
|
-
distDirectory,
|
|
64
|
-
configFile: serverConfigFile,
|
|
65
|
-
options: {
|
|
66
|
-
esbuildOptions: {
|
|
67
|
-
watch: true
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
});
|
|
71
|
-
yield hookRunners.beforeDev();
|
|
72
|
-
if (!appContext.builder && !apiOnly) {
|
|
73
|
-
throw new Error(
|
|
74
|
-
"Expect the Builder to have been initialized, But the appContext.builder received `undefined`"
|
|
75
|
-
);
|
|
76
|
-
}
|
|
77
|
-
yield generateRoutes(appContext);
|
|
78
|
-
const serverInternalPlugins = yield getServerInternalPlugins(api);
|
|
79
|
-
const serverOptions = {
|
|
80
|
-
dev: __spreadValues({
|
|
81
|
-
port,
|
|
82
|
-
https: normalizedConfig.dev.https
|
|
83
|
-
}, (_a = normalizedConfig.tools) == null ? void 0 : _a.devServer),
|
|
84
|
-
pwd: appDirectory,
|
|
85
|
-
config: normalizedConfig,
|
|
86
|
-
serverConfigFile,
|
|
87
|
-
internalPlugins: injectDataLoaderPlugin(serverInternalPlugins)
|
|
88
|
-
};
|
|
89
|
-
if (apiOnly) {
|
|
90
|
-
const app = yield createServer(__spreadProps(__spreadValues({}, serverOptions), {
|
|
91
|
-
compiler: null
|
|
92
|
-
}));
|
|
93
|
-
app.listen(port, (err) => __async(void 0, null, function* () {
|
|
94
|
-
if (err) {
|
|
95
|
-
throw err;
|
|
96
|
-
}
|
|
97
|
-
printInstructions(hookRunners, appContext, normalizedConfig);
|
|
98
|
-
}));
|
|
99
|
-
} else {
|
|
100
|
-
const { server } = yield appContext.builder.startDevServer({
|
|
101
|
-
printURLs: false,
|
|
102
|
-
serverOptions
|
|
103
|
-
});
|
|
104
|
-
setServer(server);
|
|
105
|
-
}
|
|
106
|
-
});
|
|
107
|
-
export {
|
|
108
|
-
dev
|
|
109
|
-
};
|
|
@@ -1,38 +0,0 @@
|
|
|
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
|
-
import { join } from "path";
|
|
22
|
-
const inspect = (api, options) => __async(void 0, null, function* () {
|
|
23
|
-
const appContext = api.useAppContext();
|
|
24
|
-
if (!appContext.builder) {
|
|
25
|
-
throw new Error(
|
|
26
|
-
"Expect the Builder to have been initialized, But the appContext.builder received `undefined`"
|
|
27
|
-
);
|
|
28
|
-
}
|
|
29
|
-
return appContext.builder.inspectConfig({
|
|
30
|
-
env: options.env,
|
|
31
|
-
verbose: options.verbose,
|
|
32
|
-
outputPath: join(appContext == null ? void 0 : appContext.builder.context.distPath, options.output),
|
|
33
|
-
writeToDisk: true
|
|
34
|
-
});
|
|
35
|
-
});
|
|
36
|
-
export {
|
|
37
|
-
inspect
|
|
38
|
-
};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { createDefaultConfig, createLegacyDefaultConfig } from "./default";
|
|
2
|
-
import { initialNormalizedConfig, checkIsLegacyConfig } from "./initial";
|
|
3
|
-
export {
|
|
4
|
-
checkIsLegacyConfig,
|
|
5
|
-
createDefaultConfig,
|
|
6
|
-
createLegacyDefaultConfig,
|
|
7
|
-
initialNormalizedConfig
|
|
8
|
-
};
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { initHtmlConfig, initSourceConfig, initToolsConfig } from "./inits";
|
|
2
|
-
import { transformNormalizedConfig } from "./transformNormalizedConfig";
|
|
3
|
-
function checkIsLegacyConfig(config) {
|
|
4
|
-
return Boolean(config.legacy);
|
|
5
|
-
}
|
|
6
|
-
function initialNormalizedConfig(config, appContext) {
|
|
7
|
-
initHtmlConfig(config, appContext);
|
|
8
|
-
initSourceConfig(config, appContext);
|
|
9
|
-
initToolsConfig(config);
|
|
10
|
-
return config;
|
|
11
|
-
}
|
|
12
|
-
export {
|
|
13
|
-
checkIsLegacyConfig,
|
|
14
|
-
initialNormalizedConfig,
|
|
15
|
-
transformNormalizedConfig
|
|
16
|
-
};
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __defProps = Object.defineProperties;
|
|
3
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
-
var __spreadValues = (a, b) => {
|
|
9
|
-
for (var prop in b || (b = {}))
|
|
10
|
-
if (__hasOwnProp.call(b, prop))
|
|
11
|
-
__defNormalProp(a, prop, b[prop]);
|
|
12
|
-
if (__getOwnPropSymbols)
|
|
13
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
-
if (__propIsEnum.call(b, prop))
|
|
15
|
-
__defNormalProp(a, prop, b[prop]);
|
|
16
|
-
}
|
|
17
|
-
return a;
|
|
18
|
-
};
|
|
19
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
-
const defineConfig = (config) => config;
|
|
21
|
-
const defineLegacyConfig = (config) => __spreadProps(__spreadValues({}, config), {
|
|
22
|
-
legacy: true
|
|
23
|
-
});
|
|
24
|
-
export {
|
|
25
|
-
defineConfig,
|
|
26
|
-
defineLegacyConfig
|
|
27
|
-
};
|