@modern-js/app-tools 2.4.0 → 2.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +59 -0
- package/dist/{js/node → cjs}/analyze/constants.js +0 -0
- package/dist/cjs/analyze/generateCode.js +249 -0
- package/dist/{js/node → cjs}/analyze/getBundleEntry.js +6 -0
- package/dist/{js/node → cjs}/analyze/getClientRoutes/getRoutes.js +1 -18
- package/dist/{js/node → cjs}/analyze/getClientRoutes/getRoutesLegacy.js +1 -18
- package/dist/{js/node → cjs}/analyze/getClientRoutes/index.js +0 -0
- package/dist/{js/node → cjs}/analyze/getClientRoutes/utils.js +0 -0
- package/dist/{js/node → cjs}/analyze/getFileSystemEntry.js +0 -0
- package/dist/{js/node → cjs}/analyze/getHtmlTemplate.js +4 -24
- package/dist/{js/node → cjs}/analyze/getServerRoutes.js +22 -42
- package/dist/cjs/analyze/index.js +290 -0
- package/dist/{js/node → cjs}/analyze/isDefaultExportFunction.js +0 -0
- package/dist/{js/node → cjs}/analyze/makeLegalIdentifier.js +0 -0
- package/dist/{js/node → cjs}/analyze/nestedRoutes.js +16 -50
- package/dist/{js/node → cjs}/analyze/templates.js +16 -49
- package/dist/{js/node → cjs}/analyze/utils.js +9 -29
- package/dist/{js/node → cjs}/builder/builder-rspack/index.js +0 -0
- package/dist/{js/node → cjs}/builder/builder-webpack/builderPlugins/compatModern.js +0 -0
- package/dist/{js/node → cjs}/builder/builder-webpack/index.js +22 -62
- package/dist/{js/node → cjs}/builder/builder-webpack/webpackPlugins/RouterPlugin.js +7 -24
- package/dist/{js/node → cjs}/builder/builder-webpack/webpackPlugins/index.js +0 -0
- package/dist/{js/node → cjs}/builder/generator/createBuilderOptions.js +0 -0
- package/dist/{js/node → cjs}/builder/generator/createBuilderProviderConfig.js +14 -25
- package/dist/{js/node → cjs}/builder/generator/getBuilderTargets.js +4 -0
- package/dist/cjs/builder/generator/index.js +58 -0
- package/dist/{js/node → cjs}/builder/index.js +12 -34
- package/dist/{js/node → cjs}/builder/shared/builderPlugins/adapterModern.js +35 -34
- package/dist/{js/node → cjs}/builder/shared/bundlerPlugins/HtmlAsyncChunkPlugin.js +0 -0
- package/dist/{js/node → cjs}/builder/shared/bundlerPlugins/HtmlBottomTemplate.js +0 -0
- package/dist/{js/node → cjs}/builder/shared/createCopyPattern.js +0 -0
- package/dist/{js/node → cjs}/builder/shared/index.js +0 -0
- package/dist/{js/node → cjs}/builder/shared/loaders/serverModuleLoader.js +0 -0
- package/dist/{js/node → cjs}/builder/shared/types.js +0 -0
- package/dist/{js/node → cjs}/commands/build.js +9 -46
- package/dist/cjs/commands/deploy.js +31 -0
- package/dist/{js/node → cjs}/commands/dev.js +17 -52
- package/dist/{js/node → cjs}/commands/index.js +0 -0
- package/dist/{js/node → cjs}/commands/inspect.js +2 -22
- package/dist/{js/node → cjs}/commands/serve.js +8 -28
- package/dist/{js/node → cjs}/config/default.js +15 -26
- package/dist/{js/node → cjs}/config/index.js +0 -0
- package/dist/{js/node → cjs}/config/initialize/index.js +0 -0
- package/dist/{js/node → cjs}/config/initialize/inits.js +4 -20
- package/dist/{js/node → cjs}/config/legacy/createHtmlConfig.js +0 -0
- package/dist/{js/node → cjs}/config/legacy/createOutputConfig.js +0 -0
- package/dist/{js/node → cjs}/config/legacy/createSourceConfig.js +0 -0
- package/dist/{js/node → cjs}/config/legacy/createToolsConfig.js +0 -0
- package/dist/{js/node → cjs}/config/legacy/index.js +0 -0
- package/dist/cjs/defineConfig.js +33 -0
- package/dist/{js/node → cjs}/exports/server.js +0 -0
- package/dist/{js/node → cjs}/hooks.js +0 -0
- package/dist/cjs/index.js +198 -0
- package/dist/cjs/initialize/index.js +102 -0
- package/dist/{js/node → cjs}/locale/en.js +0 -0
- package/dist/{js/node → cjs}/locale/index.js +0 -0
- package/dist/{js/node → cjs}/locale/zh.js +0 -0
- package/dist/{js/node → cjs}/schema/Schema.js +0 -0
- package/dist/{js/node → cjs}/schema/index.js +0 -0
- package/dist/{js/node → cjs}/schema/legacy.js +0 -0
- package/dist/{js/node → cjs}/types/config/deploy.js +0 -0
- package/dist/{js/node → cjs}/types/config/dev.js +0 -0
- package/dist/{js/node → cjs}/types/config/experiments.js +0 -0
- package/dist/{js/node → cjs}/types/config/html.js +0 -0
- package/dist/{js/node → cjs}/types/config/index.js +0 -0
- package/dist/{js/node → cjs}/types/config/output.js +0 -0
- package/dist/{js/node → cjs}/types/config/performance.js +0 -0
- package/dist/{js/node → cjs}/types/config/security.js +0 -0
- package/dist/{js/node → cjs}/types/config/source.js +0 -0
- package/dist/{js/node → cjs}/types/config/tools.js +0 -0
- package/dist/{js/node → cjs}/types/hooks.js +0 -0
- package/dist/{js/node → cjs}/types/index.js +0 -0
- package/dist/{js/node → cjs}/types/legacyConfig/deploy.js +0 -0
- package/dist/{js/node → cjs}/types/legacyConfig/dev.js +0 -0
- package/dist/{js/node → cjs}/types/legacyConfig/index.js +0 -0
- package/dist/{js/node → cjs}/types/legacyConfig/output.js +0 -0
- package/dist/{js/node → cjs}/types/legacyConfig/source.js +0 -0
- package/dist/{js/node → cjs}/types/legacyConfig/tools.js +0 -0
- package/dist/{js/node → cjs}/types/utils.js +0 -0
- package/dist/{js/node → cjs}/utils/config.js +19 -57
- package/dist/{js/node → cjs}/utils/createServer.js +10 -46
- package/dist/{js/node → cjs}/utils/env.js +0 -0
- package/dist/{js/node → cjs}/utils/generateWatchFiles.js +16 -38
- package/dist/{js/node → cjs}/utils/getSelectedEntries.js +3 -23
- package/dist/cjs/utils/getServerInternalPlugins.js +41 -0
- package/dist/{js/node → cjs}/utils/language.js +0 -0
- package/dist/{js/node → cjs}/utils/printInstructions.js +3 -23
- package/dist/cjs/utils/restart.js +45 -0
- package/dist/{js/node → cjs}/utils/routes.js +3 -23
- package/dist/{js/node → cjs}/utils/types.js +0 -0
- package/dist/{js/treeshaking → esm}/analyze/constants.js +0 -0
- package/dist/{js/treeshaking → esm}/analyze/generateCode.js +14 -14
- package/dist/{js/treeshaking → esm}/analyze/getBundleEntry.js +4 -2
- package/dist/{js/treeshaking → esm}/analyze/getClientRoutes/getRoutes.js +1 -1
- package/dist/{js/treeshaking → esm}/analyze/getClientRoutes/getRoutesLegacy.js +1 -1
- package/dist/{js/treeshaking → esm}/analyze/getClientRoutes/index.js +0 -0
- package/dist/{js/treeshaking → esm}/analyze/getClientRoutes/utils.js +0 -0
- package/dist/{js/treeshaking → esm}/analyze/getFileSystemEntry.js +1 -1
- package/dist/{js/treeshaking → esm}/analyze/getHtmlTemplate.js +0 -0
- package/dist/{js/treeshaking → esm}/analyze/getServerRoutes.js +8 -6
- package/dist/{js/treeshaking → esm}/analyze/index.js +8 -8
- package/dist/{js/treeshaking → esm}/analyze/isDefaultExportFunction.js +0 -0
- package/dist/{js/treeshaking → esm}/analyze/makeLegalIdentifier.js +0 -0
- package/dist/{js/treeshaking → esm}/analyze/nestedRoutes.js +5 -5
- package/dist/{js/treeshaking → esm}/analyze/templates.js +8 -7
- package/dist/{js/treeshaking → esm}/analyze/utils.js +3 -3
- package/dist/{js/treeshaking → esm}/builder/builder-rspack/index.js +0 -0
- package/dist/{js/treeshaking → esm}/builder/builder-webpack/builderPlugins/compatModern.js +4 -4
- package/dist/{js/treeshaking → esm}/builder/builder-webpack/index.js +2 -2
- package/dist/{js/treeshaking → esm}/builder/builder-webpack/webpackPlugins/RouterPlugin.js +5 -2
- package/dist/{js/treeshaking → esm}/builder/builder-webpack/webpackPlugins/index.js +0 -0
- package/dist/{js/treeshaking → esm}/builder/generator/createBuilderOptions.js +2 -2
- package/dist/{js/treeshaking → esm}/builder/generator/createBuilderProviderConfig.js +0 -0
- package/dist/{js/treeshaking → esm}/builder/generator/getBuilderTargets.js +5 -1
- package/dist/{js/treeshaking → esm}/builder/generator/index.js +2 -2
- package/dist/{js/treeshaking → esm}/builder/index.js +0 -0
- package/dist/{js/treeshaking → esm}/builder/shared/builderPlugins/adapterModern.js +62 -13
- package/dist/{js/treeshaking → esm}/builder/shared/bundlerPlugins/HtmlAsyncChunkPlugin.js +0 -0
- package/dist/{js/treeshaking → esm}/builder/shared/bundlerPlugins/HtmlBottomTemplate.js +2 -2
- package/dist/{js/treeshaking → esm}/builder/shared/createCopyPattern.js +0 -0
- package/dist/{js/treeshaking → esm}/builder/shared/index.js +0 -0
- package/dist/{js/treeshaking → esm}/builder/shared/loaders/serverModuleLoader.js +0 -0
- package/dist/{js/treeshaking → esm}/builder/shared/types.js +0 -0
- package/dist/{js/treeshaking → esm}/commands/build.js +0 -0
- package/dist/{js/treeshaking → esm}/commands/deploy.js +0 -0
- package/dist/{js/treeshaking → esm}/commands/dev.js +2 -2
- package/dist/{js/treeshaking → esm}/commands/index.js +0 -0
- package/dist/{js/treeshaking → esm}/commands/inspect.js +0 -0
- package/dist/{js/treeshaking → esm}/commands/serve.js +2 -2
- package/dist/{js/treeshaking → esm}/config/default.js +0 -0
- package/dist/{js/treeshaking → esm}/config/index.js +0 -0
- package/dist/{js/treeshaking → esm}/config/initialize/index.js +0 -0
- package/dist/{js/treeshaking → esm}/config/initialize/inits.js +2 -2
- package/dist/esm/config/legacy/createHtmlConfig.js +19 -0
- package/dist/{js/treeshaking → esm}/config/legacy/createOutputConfig.js +1 -1
- package/dist/{js/treeshaking → esm}/config/legacy/createSourceConfig.js +1 -1
- package/dist/{js/treeshaking → esm}/config/legacy/createToolsConfig.js +1 -1
- package/dist/{js/treeshaking → esm}/config/legacy/index.js +0 -0
- package/dist/{js/treeshaking → esm}/defineConfig.js +0 -0
- package/dist/{js/treeshaking → esm}/exports/server.js +0 -0
- package/dist/{js/treeshaking → esm}/hooks.js +0 -0
- package/dist/{js/treeshaking → esm}/index.js +0 -0
- package/dist/{js/treeshaking → esm}/initialize/index.js +2 -2
- package/dist/{js/treeshaking → esm}/locale/en.js +0 -0
- package/dist/{js/treeshaking → esm}/locale/index.js +0 -0
- package/dist/{js/treeshaking → esm}/locale/zh.js +0 -0
- package/dist/{js/treeshaking → esm}/schema/Schema.js +0 -0
- package/dist/{js/treeshaking → esm}/schema/index.js +0 -0
- package/dist/{js/treeshaking → esm}/schema/legacy.js +0 -0
- package/dist/{js/treeshaking → esm}/types/config/deploy.js +0 -0
- package/dist/{js/treeshaking → esm}/types/config/dev.js +0 -0
- package/dist/{js/treeshaking → esm}/types/config/experiments.js +0 -0
- package/dist/{js/treeshaking → esm}/types/config/html.js +0 -0
- package/dist/{js/treeshaking → esm}/types/config/index.js +0 -0
- package/dist/{js/treeshaking → esm}/types/config/output.js +0 -0
- package/dist/{js/treeshaking → esm}/types/config/performance.js +0 -0
- package/dist/{js/treeshaking → esm}/types/config/security.js +0 -0
- package/dist/{js/treeshaking → esm}/types/config/source.js +0 -0
- package/dist/{js/treeshaking → esm}/types/config/tools.js +0 -0
- package/dist/{js/treeshaking → esm}/types/hooks.js +0 -0
- package/dist/{js/treeshaking → esm}/types/index.js +0 -0
- package/dist/{js/treeshaking → esm}/types/legacyConfig/deploy.js +0 -0
- package/dist/{js/treeshaking → esm}/types/legacyConfig/dev.js +0 -0
- package/dist/{js/treeshaking → esm}/types/legacyConfig/index.js +0 -0
- package/dist/{js/treeshaking → esm}/types/legacyConfig/output.js +0 -0
- package/dist/{js/treeshaking → esm}/types/legacyConfig/source.js +0 -0
- package/dist/{js/treeshaking → esm}/types/legacyConfig/tools.js +0 -0
- package/dist/{js/treeshaking → esm}/types/utils.js +0 -0
- package/dist/{js/treeshaking → esm}/utils/config.js +2 -2
- package/dist/{js/treeshaking → esm}/utils/createServer.js +0 -0
- package/dist/{js/treeshaking → esm}/utils/env.js +0 -0
- package/dist/{js/treeshaking → esm}/utils/generateWatchFiles.js +0 -0
- package/dist/{js/treeshaking → esm}/utils/getSelectedEntries.js +0 -0
- package/dist/{js/treeshaking → esm}/utils/getServerInternalPlugins.js +2 -2
- package/dist/{js/treeshaking → esm}/utils/language.js +0 -0
- package/dist/{js/treeshaking → esm}/utils/printInstructions.js +0 -0
- package/dist/{js/treeshaking → esm}/utils/restart.js +0 -0
- package/dist/{js/treeshaking → esm}/utils/routes.js +0 -0
- package/dist/{js/treeshaking → esm}/utils/types.js +0 -0
- package/dist/{js/modern → esm-node}/analyze/constants.js +0 -0
- package/dist/esm-node/analyze/generateCode.js +225 -0
- package/dist/{js/modern → esm-node}/analyze/getBundleEntry.js +6 -0
- package/dist/{js/modern → esm-node}/analyze/getClientRoutes/getRoutes.js +1 -20
- package/dist/{js/modern → esm-node}/analyze/getClientRoutes/getRoutesLegacy.js +1 -20
- package/dist/{js/modern → esm-node}/analyze/getClientRoutes/index.js +0 -0
- package/dist/{js/modern → esm-node}/analyze/getClientRoutes/utils.js +0 -0
- package/dist/{js/modern → esm-node}/analyze/getFileSystemEntry.js +0 -0
- package/dist/{js/modern → esm-node}/analyze/getHtmlTemplate.js +4 -24
- package/dist/{js/modern → esm-node}/analyze/getServerRoutes.js +24 -45
- package/dist/esm-node/analyze/index.js +281 -0
- package/dist/{js/modern → esm-node}/analyze/isDefaultExportFunction.js +0 -0
- package/dist/{js/modern → esm-node}/analyze/makeLegalIdentifier.js +0 -0
- package/dist/{js/modern → esm-node}/analyze/nestedRoutes.js +16 -52
- package/dist/{js/modern → esm-node}/analyze/templates.js +16 -51
- package/dist/{js/modern → esm-node}/analyze/utils.js +9 -29
- package/dist/{js/modern → esm-node}/builder/builder-rspack/index.js +0 -0
- package/dist/{js/modern → esm-node}/builder/builder-webpack/builderPlugins/compatModern.js +0 -0
- package/dist/esm-node/builder/builder-webpack/index.js +51 -0
- package/dist/{js/modern → esm-node}/builder/builder-webpack/webpackPlugins/RouterPlugin.js +7 -24
- package/dist/{js/modern → esm-node}/builder/builder-webpack/webpackPlugins/index.js +0 -0
- package/dist/{js/modern → esm-node}/builder/generator/createBuilderOptions.js +0 -0
- package/dist/esm-node/builder/generator/createBuilderProviderConfig.js +26 -0
- package/dist/{js/modern → esm-node}/builder/generator/getBuilderTargets.js +10 -1
- package/dist/esm-node/builder/generator/index.js +29 -0
- package/dist/esm-node/builder/index.js +17 -0
- package/dist/{js/modern → esm-node}/builder/shared/builderPlugins/adapterModern.js +35 -36
- package/dist/{js/modern → esm-node}/builder/shared/bundlerPlugins/HtmlAsyncChunkPlugin.js +0 -0
- package/dist/{js/modern → esm-node}/builder/shared/bundlerPlugins/HtmlBottomTemplate.js +0 -0
- package/dist/{js/modern → esm-node}/builder/shared/createCopyPattern.js +0 -0
- package/dist/{js/modern → esm-node}/builder/shared/index.js +0 -0
- package/dist/{js/modern → esm-node}/builder/shared/loaders/serverModuleLoader.js +0 -0
- package/dist/{js/modern → esm-node}/builder/shared/types.js +0 -0
- package/dist/esm-node/commands/build.js +52 -0
- package/dist/esm-node/commands/deploy.js +8 -0
- package/dist/esm-node/commands/dev.js +72 -0
- package/dist/{js/modern → esm-node}/commands/index.js +0 -0
- package/dist/esm-node/commands/inspect.js +18 -0
- package/dist/{js/modern → esm-node}/commands/serve.js +8 -28
- package/dist/{js/modern → esm-node}/config/default.js +15 -28
- package/dist/{js/modern → esm-node}/config/index.js +0 -0
- package/dist/{js/modern → esm-node}/config/initialize/index.js +0 -0
- package/dist/{js/modern → esm-node}/config/initialize/inits.js +4 -22
- package/dist/{js/modern → esm-node}/config/legacy/createHtmlConfig.js +0 -0
- package/dist/{js/modern → esm-node}/config/legacy/createOutputConfig.js +0 -0
- package/dist/{js/modern → esm-node}/config/legacy/createSourceConfig.js +0 -0
- package/dist/{js/modern → esm-node}/config/legacy/createToolsConfig.js +0 -0
- package/dist/{js/modern → esm-node}/config/legacy/index.js +0 -0
- package/dist/esm-node/defineConfig.js +9 -0
- package/dist/{js/modern → esm-node}/exports/server.js +0 -0
- package/dist/{js/modern → esm-node}/hooks.js +0 -0
- package/dist/esm-node/index.js +172 -0
- package/dist/esm-node/initialize/index.js +91 -0
- package/dist/{js/modern → esm-node}/locale/en.js +0 -0
- package/dist/{js/modern → esm-node}/locale/index.js +0 -0
- package/dist/{js/modern → esm-node}/locale/zh.js +0 -0
- package/dist/{js/modern → esm-node}/schema/Schema.js +0 -0
- package/dist/{js/modern → esm-node}/schema/index.js +0 -0
- package/dist/{js/modern → esm-node}/schema/legacy.js +0 -0
- package/dist/{js/modern → esm-node}/types/config/deploy.js +0 -0
- package/dist/{js/modern → esm-node}/types/config/dev.js +0 -0
- package/dist/{js/modern → esm-node}/types/config/experiments.js +0 -0
- package/dist/{js/modern → esm-node}/types/config/html.js +0 -0
- package/dist/{js/modern → esm-node}/types/config/index.js +0 -0
- package/dist/{js/modern → esm-node}/types/config/output.js +0 -0
- package/dist/{js/modern → esm-node}/types/config/performance.js +0 -0
- package/dist/{js/modern → esm-node}/types/config/security.js +0 -0
- package/dist/{js/modern → esm-node}/types/config/source.js +0 -0
- package/dist/{js/modern → esm-node}/types/config/tools.js +0 -0
- package/dist/{js/modern → esm-node}/types/hooks.js +0 -0
- package/dist/{js/modern → esm-node}/types/index.js +0 -0
- package/dist/{js/modern → esm-node}/types/legacyConfig/deploy.js +0 -0
- package/dist/{js/modern → esm-node}/types/legacyConfig/dev.js +0 -0
- package/dist/{js/modern → esm-node}/types/legacyConfig/index.js +0 -0
- package/dist/{js/modern → esm-node}/types/legacyConfig/output.js +0 -0
- package/dist/{js/modern → esm-node}/types/legacyConfig/source.js +0 -0
- package/dist/{js/modern → esm-node}/types/legacyConfig/tools.js +0 -0
- package/dist/{js/modern → esm-node}/types/utils.js +0 -0
- package/dist/esm-node/utils/config.js +88 -0
- package/dist/esm-node/utils/createServer.js +37 -0
- package/dist/{js/modern → esm-node}/utils/env.js +0 -0
- package/dist/esm-node/utils/generateWatchFiles.js +33 -0
- package/dist/{js/modern → esm-node}/utils/getSelectedEntries.js +3 -23
- package/dist/esm-node/utils/getServerInternalPlugins.js +18 -0
- package/dist/{js/modern → esm-node}/utils/language.js +0 -0
- package/dist/esm-node/utils/printInstructions.js +11 -0
- package/dist/esm-node/utils/restart.js +22 -0
- package/dist/esm-node/utils/routes.js +10 -0
- package/dist/{js/modern → esm-node}/utils/types.js +0 -0
- package/dist/types/types/config/tools.d.ts +1 -1
- package/dist/types/types/hooks.d.ts +5 -4
- package/dist/types/types/index.d.ts +3 -1
- package/package.json +30 -31
- package/dist/js/modern/analyze/generateCode.js +0 -247
- package/dist/js/modern/analyze/index.js +0 -329
- package/dist/js/modern/builder/builder-webpack/index.js +0 -93
- package/dist/js/modern/builder/generator/createBuilderProviderConfig.js +0 -39
- package/dist/js/modern/builder/generator/index.js +0 -53
- package/dist/js/modern/builder/index.js +0 -39
- package/dist/js/modern/commands/build.js +0 -91
- package/dist/js/modern/commands/deploy.js +0 -28
- package/dist/js/modern/commands/dev.js +0 -109
- package/dist/js/modern/commands/inspect.js +0 -38
- package/dist/js/modern/defineConfig.js +0 -27
- package/dist/js/modern/index.js +0 -221
- package/dist/js/modern/initialize/index.js +0 -132
- package/dist/js/modern/utils/config.js +0 -128
- package/dist/js/modern/utils/createServer.js +0 -75
- package/dist/js/modern/utils/generateWatchFiles.js +0 -55
- package/dist/js/modern/utils/getServerInternalPlugins.js +0 -58
- package/dist/js/modern/utils/printInstructions.js +0 -31
- package/dist/js/modern/utils/restart.js +0 -44
- package/dist/js/modern/utils/routes.js +0 -30
- package/dist/js/node/analyze/generateCode.js +0 -271
- package/dist/js/node/analyze/index.js +0 -336
- package/dist/js/node/builder/generator/index.js +0 -82
- package/dist/js/node/commands/deploy.js +0 -51
- package/dist/js/node/defineConfig.js +0 -49
- package/dist/js/node/index.js +0 -245
- package/dist/js/node/initialize/index.js +0 -141
- package/dist/js/node/utils/getServerInternalPlugins.js +0 -79
- package/dist/js/node/utils/restart.js +0 -67
- package/dist/js/treeshaking/config/legacy/createHtmlConfig.js +0 -19
|
@@ -1,26 +1,9 @@
|
|
|
1
1
|
var __create = Object.create;
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
|
-
var __defProps = Object.defineProperties;
|
|
4
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
6
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
8
5
|
var __getProtoOf = Object.getPrototypeOf;
|
|
9
6
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
10
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
11
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
12
|
-
var __spreadValues = (a, b) => {
|
|
13
|
-
for (var prop in b || (b = {}))
|
|
14
|
-
if (__hasOwnProp.call(b, prop))
|
|
15
|
-
__defNormalProp(a, prop, b[prop]);
|
|
16
|
-
if (__getOwnPropSymbols)
|
|
17
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
18
|
-
if (__propIsEnum.call(b, prop))
|
|
19
|
-
__defNormalProp(a, prop, b[prop]);
|
|
20
|
-
}
|
|
21
|
-
return a;
|
|
22
|
-
};
|
|
23
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
24
7
|
var __export = (target, all) => {
|
|
25
8
|
for (var name in all)
|
|
26
9
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -38,26 +21,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
38
21
|
mod
|
|
39
22
|
));
|
|
40
23
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
41
|
-
var __async = (__this, __arguments, generator) => {
|
|
42
|
-
return new Promise((resolve, reject) => {
|
|
43
|
-
var fulfilled = (value) => {
|
|
44
|
-
try {
|
|
45
|
-
step(generator.next(value));
|
|
46
|
-
} catch (e) {
|
|
47
|
-
reject(e);
|
|
48
|
-
}
|
|
49
|
-
};
|
|
50
|
-
var rejected = (value) => {
|
|
51
|
-
try {
|
|
52
|
-
step(generator.throw(value));
|
|
53
|
-
} catch (e) {
|
|
54
|
-
reject(e);
|
|
55
|
-
}
|
|
56
|
-
};
|
|
57
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
58
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
59
|
-
});
|
|
60
|
-
};
|
|
61
24
|
var builder_webpack_exports = {};
|
|
62
25
|
__export(builder_webpack_exports, {
|
|
63
26
|
createWebpackBuilderForModern: () => createWebpackBuilderForModern
|
|
@@ -73,10 +36,8 @@ function createWebpackBuilderForModern(options) {
|
|
|
73
36
|
modifyBuilderConfig(config) {
|
|
74
37
|
modifyOutputConfig(config, options.appContext);
|
|
75
38
|
},
|
|
76
|
-
modifyBuilderInstance(builder) {
|
|
77
|
-
|
|
78
|
-
yield applyBuilderPlugins(builder, options);
|
|
79
|
-
});
|
|
39
|
+
async modifyBuilderInstance(builder) {
|
|
40
|
+
await applyBuilderPlugins(builder, options);
|
|
80
41
|
}
|
|
81
42
|
});
|
|
82
43
|
}
|
|
@@ -87,30 +48,29 @@ function modifyOutputConfig(config, appContext) {
|
|
|
87
48
|
const { copy } = config2.output;
|
|
88
49
|
const copyOptions = Array.isArray(copy) ? copy : copy == null ? void 0 : copy.patterns;
|
|
89
50
|
const builderCopy = [...copyOptions || [], defaultCopyPattern];
|
|
90
|
-
return
|
|
51
|
+
return {
|
|
52
|
+
...config2.output,
|
|
91
53
|
copy: builderCopy
|
|
92
|
-
}
|
|
54
|
+
};
|
|
93
55
|
}
|
|
94
56
|
}
|
|
95
|
-
function applyBuilderPlugins(builder, options) {
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
builder.addPlugins([(0, import_compatModern.PluginCompatModern)(options)]);
|
|
113
|
-
});
|
|
57
|
+
async function applyBuilderPlugins(builder, options) {
|
|
58
|
+
const { normalizedConfig } = options;
|
|
59
|
+
if (!normalizedConfig.output.disableNodePolyfill) {
|
|
60
|
+
const { PluginNodePolyfill } = await Promise.resolve().then(() => __toESM(require("@modern-js/builder-plugin-node-polyfill")));
|
|
61
|
+
builder.addPlugins([PluginNodePolyfill()]);
|
|
62
|
+
}
|
|
63
|
+
if (normalizedConfig.tools.esbuild) {
|
|
64
|
+
const { esbuild: esbuildOptions } = normalizedConfig.tools;
|
|
65
|
+
const { PluginEsbuild } = await Promise.resolve().then(() => __toESM(require("@modern-js/builder-plugin-esbuild")));
|
|
66
|
+
builder.addPlugins([
|
|
67
|
+
PluginEsbuild({
|
|
68
|
+
loader: false,
|
|
69
|
+
minimize: (0, import_utils.applyOptionsChain)({}, esbuildOptions)
|
|
70
|
+
})
|
|
71
|
+
]);
|
|
72
|
+
}
|
|
73
|
+
builder.addPlugins([(0, import_compatModern.PluginCompatModern)(options)]);
|
|
114
74
|
}
|
|
115
75
|
// Annotate the CommonJS export names for ESM import in node:
|
|
116
76
|
0 && (module.exports = {
|
|
@@ -21,26 +21,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
21
21
|
mod
|
|
22
22
|
));
|
|
23
23
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
24
|
-
var __async = (__this, __arguments, generator) => {
|
|
25
|
-
return new Promise((resolve, reject) => {
|
|
26
|
-
var fulfilled = (value) => {
|
|
27
|
-
try {
|
|
28
|
-
step(generator.next(value));
|
|
29
|
-
} catch (e) {
|
|
30
|
-
reject(e);
|
|
31
|
-
}
|
|
32
|
-
};
|
|
33
|
-
var rejected = (value) => {
|
|
34
|
-
try {
|
|
35
|
-
step(generator.throw(value));
|
|
36
|
-
} catch (e) {
|
|
37
|
-
reject(e);
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
41
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
42
|
-
});
|
|
43
|
-
};
|
|
44
24
|
var RouterPlugin_exports = {};
|
|
45
25
|
__export(RouterPlugin_exports, {
|
|
46
26
|
RouterPlugin: () => RouterPlugin
|
|
@@ -55,6 +35,9 @@ class RouterPlugin {
|
|
|
55
35
|
if (target === "node" || Array.isArray(target) && target.includes("node")) {
|
|
56
36
|
return;
|
|
57
37
|
}
|
|
38
|
+
if (target === "webworker" || Array.isArray(target) && target.includes("webworker")) {
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
58
41
|
const { webpack } = compiler;
|
|
59
42
|
const { Compilation, sources } = webpack;
|
|
60
43
|
const { RawSource } = sources;
|
|
@@ -73,7 +56,7 @@ class RouterPlugin {
|
|
|
73
56
|
name: PLUGIN_NAME,
|
|
74
57
|
stage: PROCESS_ASSETS_STAGE_REPORT
|
|
75
58
|
},
|
|
76
|
-
() =>
|
|
59
|
+
async () => {
|
|
77
60
|
const stats = compilation.getStats().toJson({
|
|
78
61
|
chunkGroups: true,
|
|
79
62
|
chunks: true
|
|
@@ -124,9 +107,9 @@ class RouterPlugin {
|
|
|
124
107
|
compilation.updateAsset(file, new RawSource(newContent));
|
|
125
108
|
}
|
|
126
109
|
const filename = import_path.default.join(outputPath, import_utils.ROUTE_MINIFEST_FILE);
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
}
|
|
110
|
+
await import_utils.fs.ensureFile(filename);
|
|
111
|
+
await import_utils.fs.writeFile(filename, JSON.stringify(manifest, null, 2));
|
|
112
|
+
}
|
|
130
113
|
);
|
|
131
114
|
});
|
|
132
115
|
}
|
|
File without changes
|
|
File without changes
|
|
@@ -1,24 +1,7 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
|
-
var __defProps = Object.defineProperties;
|
|
3
2
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
5
3
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
7
4
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
9
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
10
|
-
var __spreadValues = (a, b) => {
|
|
11
|
-
for (var prop in b || (b = {}))
|
|
12
|
-
if (__hasOwnProp.call(b, prop))
|
|
13
|
-
__defNormalProp(a, prop, b[prop]);
|
|
14
|
-
if (__getOwnPropSymbols)
|
|
15
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
16
|
-
if (__propIsEnum.call(b, prop))
|
|
17
|
-
__defNormalProp(a, prop, b[prop]);
|
|
18
|
-
}
|
|
19
|
-
return a;
|
|
20
|
-
};
|
|
21
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
22
5
|
var __export = (target, all) => {
|
|
23
6
|
for (var name in all)
|
|
24
7
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -38,19 +21,25 @@ __export(createBuilderProviderConfig_exports, {
|
|
|
38
21
|
});
|
|
39
22
|
module.exports = __toCommonJS(createBuilderProviderConfig_exports);
|
|
40
23
|
function createBuilderProviderConfig(resolveConfig, appContext, modifyBuilderConfig) {
|
|
41
|
-
const htmlConfig =
|
|
24
|
+
const htmlConfig = { ...resolveConfig.html };
|
|
42
25
|
if (!htmlConfig.template) {
|
|
43
|
-
htmlConfig.templateByEntries =
|
|
26
|
+
htmlConfig.templateByEntries = {
|
|
27
|
+
...htmlConfig.templateByEntries,
|
|
28
|
+
...appContext.htmlTemplates
|
|
29
|
+
};
|
|
44
30
|
}
|
|
45
|
-
const config =
|
|
46
|
-
|
|
31
|
+
const config = {
|
|
32
|
+
...resolveConfig,
|
|
33
|
+
dev: {
|
|
34
|
+
...resolveConfig.dev,
|
|
47
35
|
port: appContext.port
|
|
48
|
-
}
|
|
36
|
+
},
|
|
49
37
|
html: htmlConfig,
|
|
50
|
-
output:
|
|
38
|
+
output: {
|
|
39
|
+
...resolveConfig.output,
|
|
51
40
|
cleanDistPath: false
|
|
52
|
-
}
|
|
53
|
-
}
|
|
41
|
+
}
|
|
42
|
+
};
|
|
54
43
|
modifyBuilderConfig == null ? void 0 : modifyBuilderConfig(config);
|
|
55
44
|
return config;
|
|
56
45
|
}
|
|
@@ -27,6 +27,10 @@ function getBuilderTargets(normalizedConfig) {
|
|
|
27
27
|
if (useNodeTarget) {
|
|
28
28
|
targets.push("node");
|
|
29
29
|
}
|
|
30
|
+
const useWorkerTarget = (0, import_utils.isProd)() ? (0, import_utils.isServiceWorker)(normalizedConfig) : false;
|
|
31
|
+
if (useWorkerTarget) {
|
|
32
|
+
targets.push("service-worker");
|
|
33
|
+
}
|
|
30
34
|
return targets;
|
|
31
35
|
}
|
|
32
36
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
21
|
+
mod
|
|
22
|
+
));
|
|
23
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
24
|
+
var generator_exports = {};
|
|
25
|
+
__export(generator_exports, {
|
|
26
|
+
generateBuilder: () => generateBuilder
|
|
27
|
+
});
|
|
28
|
+
module.exports = __toCommonJS(generator_exports);
|
|
29
|
+
var import_builder = require("@modern-js/builder");
|
|
30
|
+
var import_createBuilderProviderConfig = require("./createBuilderProviderConfig");
|
|
31
|
+
var import_getBuilderTargets = require("./getBuilderTargets");
|
|
32
|
+
var import_createBuilderOptions = require("./createBuilderOptions");
|
|
33
|
+
async function generateBuilder(options, generateProvider, utils) {
|
|
34
|
+
const { normalizedConfig, appContext } = options;
|
|
35
|
+
const { modifyBuilderConfig, modifyBuilderInstance } = utils || {};
|
|
36
|
+
const builderConfig = (0, import_createBuilderProviderConfig.createBuilderProviderConfig)(
|
|
37
|
+
normalizedConfig,
|
|
38
|
+
appContext,
|
|
39
|
+
modifyBuilderConfig
|
|
40
|
+
);
|
|
41
|
+
const provider = generateProvider({
|
|
42
|
+
builderConfig
|
|
43
|
+
});
|
|
44
|
+
const target = (0, import_getBuilderTargets.getBuilderTargets)(normalizedConfig);
|
|
45
|
+
const builderOptions = (0, import_createBuilderOptions.createBuilderOptions)(target, appContext);
|
|
46
|
+
const builder = await (0, import_builder.createBuilder)(provider, builderOptions);
|
|
47
|
+
await applyBuilderPlugins(builder, options);
|
|
48
|
+
await (modifyBuilderInstance == null ? void 0 : modifyBuilderInstance(builder));
|
|
49
|
+
return builder;
|
|
50
|
+
}
|
|
51
|
+
async function applyBuilderPlugins(builder, options) {
|
|
52
|
+
const { builderPluginAdapterModern } = await Promise.resolve().then(() => __toESM(require("../shared/builderPlugins/adapterModern")));
|
|
53
|
+
builder.addPlugins([builderPluginAdapterModern(options)]);
|
|
54
|
+
}
|
|
55
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
56
|
+
0 && (module.exports = {
|
|
57
|
+
generateBuilder
|
|
58
|
+
});
|
|
@@ -21,46 +21,24 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
21
21
|
mod
|
|
22
22
|
));
|
|
23
23
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
24
|
-
var __async = (__this, __arguments, generator) => {
|
|
25
|
-
return new Promise((resolve, reject) => {
|
|
26
|
-
var fulfilled = (value) => {
|
|
27
|
-
try {
|
|
28
|
-
step(generator.next(value));
|
|
29
|
-
} catch (e) {
|
|
30
|
-
reject(e);
|
|
31
|
-
}
|
|
32
|
-
};
|
|
33
|
-
var rejected = (value) => {
|
|
34
|
-
try {
|
|
35
|
-
step(generator.throw(value));
|
|
36
|
-
} catch (e) {
|
|
37
|
-
reject(e);
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
41
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
42
|
-
});
|
|
43
|
-
};
|
|
44
24
|
var builder_exports = {};
|
|
45
25
|
__export(builder_exports, {
|
|
46
26
|
createBuilderGenerator: () => createBuilderGenerator
|
|
47
27
|
});
|
|
48
28
|
module.exports = __toCommonJS(builder_exports);
|
|
49
|
-
function createBuilderGenerator(bundler) {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
);
|
|
59
|
-
}
|
|
29
|
+
async function createBuilderGenerator(bundler) {
|
|
30
|
+
if (bundler === "rspack") {
|
|
31
|
+
try {
|
|
32
|
+
const { createRspackBuilderForModern } = await Promise.resolve().then(() => __toESM(require("./builder-rspack")));
|
|
33
|
+
return createRspackBuilderForModern;
|
|
34
|
+
} catch (_) {
|
|
35
|
+
throw new Error(
|
|
36
|
+
"Failed to use rspack, please check if you have `@modern-js/builder-rspack-provider` installed"
|
|
37
|
+
);
|
|
60
38
|
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
39
|
+
}
|
|
40
|
+
const { createWebpackBuilderForModern } = await Promise.resolve().then(() => __toESM(require("./builder-webpack")));
|
|
41
|
+
return createWebpackBuilderForModern;
|
|
64
42
|
}
|
|
65
43
|
// Annotate the CommonJS export names for ESM import in node:
|
|
66
44
|
0 && (module.exports = {
|
|
@@ -1,26 +1,9 @@
|
|
|
1
1
|
var __create = Object.create;
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
|
-
var __defProps = Object.defineProperties;
|
|
4
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
6
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
8
5
|
var __getProtoOf = Object.getPrototypeOf;
|
|
9
6
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
10
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
11
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
12
|
-
var __spreadValues = (a, b) => {
|
|
13
|
-
for (var prop in b || (b = {}))
|
|
14
|
-
if (__hasOwnProp.call(b, prop))
|
|
15
|
-
__defNormalProp(a, prop, b[prop]);
|
|
16
|
-
if (__getOwnPropSymbols)
|
|
17
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
18
|
-
if (__propIsEnum.call(b, prop))
|
|
19
|
-
__defNormalProp(a, prop, b[prop]);
|
|
20
|
-
}
|
|
21
|
-
return a;
|
|
22
|
-
};
|
|
23
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
24
7
|
var __export = (target, all) => {
|
|
25
8
|
for (var name in all)
|
|
26
9
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -83,13 +66,17 @@ const builderPluginAdapterModern = (options) => ({
|
|
|
83
66
|
const builderConfig = api.getNormalizedConfig();
|
|
84
67
|
if (target === "node") {
|
|
85
68
|
chain.name("server");
|
|
69
|
+
} else if (target === "service-worker") {
|
|
70
|
+
chain.name("service-worker");
|
|
71
|
+
} else if (target === "web-worker") {
|
|
72
|
+
chain.name("worker");
|
|
86
73
|
} else if (target === "modern-web") {
|
|
87
74
|
chain.name("modern");
|
|
88
75
|
} else {
|
|
89
76
|
chain.name("client");
|
|
90
77
|
}
|
|
91
|
-
if (target === "node") {
|
|
92
|
-
applyNodeCompat(chain, normalizedConfig, isProd);
|
|
78
|
+
if (target === "node" || target === "service-worker") {
|
|
79
|
+
applyNodeCompat(target, chain, normalizedConfig, isProd);
|
|
93
80
|
}
|
|
94
81
|
if (isHtmlEnabled(builderConfig, target)) {
|
|
95
82
|
applyBottomHtmlPlugin({
|
|
@@ -105,7 +92,7 @@ const builderPluginAdapterModern = (options) => ({
|
|
|
105
92
|
CHAIN_ID
|
|
106
93
|
});
|
|
107
94
|
}
|
|
108
|
-
if (target !== "node") {
|
|
95
|
+
if (target !== "node" && target !== "web-worker" && target !== "service-worker") {
|
|
109
96
|
const bareServerModuleReg = /\.(server|node)\.[tj]sx?$/;
|
|
110
97
|
chain.module.rule(CHAIN_ID.RULE.JS).exclude.add(bareServerModuleReg);
|
|
111
98
|
chain.module.rule("bare-server-module").test(bareServerModuleReg).use("server-module-loader").loader(require.resolve("../loaders/serverModuleLoader"));
|
|
@@ -114,7 +101,7 @@ const builderPluginAdapterModern = (options) => ({
|
|
|
114
101
|
applyCallbacks(api, options);
|
|
115
102
|
function isHtmlEnabled(config, target) {
|
|
116
103
|
var _a;
|
|
117
|
-
return ((_a = config.tools) == null ? void 0 : _a.htmlPlugin) !== false && target !== "node" && target !== "web-worker";
|
|
104
|
+
return ((_a = config.tools) == null ? void 0 : _a.htmlPlugin) !== false && target !== "node" && target !== "service-worker" && target !== "web-worker";
|
|
118
105
|
}
|
|
119
106
|
}
|
|
120
107
|
});
|
|
@@ -136,7 +123,7 @@ function applyBottomHtmlPlugin({
|
|
|
136
123
|
CHAIN_ID
|
|
137
124
|
}) {
|
|
138
125
|
for (const entryName of Object.keys(api.context.entry)) {
|
|
139
|
-
const baseTemplateParams =
|
|
126
|
+
const baseTemplateParams = {
|
|
140
127
|
entryName,
|
|
141
128
|
title: (0, import_utils.getEntryOptions)(
|
|
142
129
|
entryName,
|
|
@@ -144,20 +131,22 @@ function applyBottomHtmlPlugin({
|
|
|
144
131
|
modernConfig.html.titleByEntries,
|
|
145
132
|
appContext.packageName
|
|
146
133
|
),
|
|
147
|
-
mountId: modernConfig.html.mountId
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
134
|
+
mountId: modernConfig.html.mountId,
|
|
135
|
+
...(0, import_utils.getEntryOptions)(
|
|
136
|
+
entryName,
|
|
137
|
+
modernConfig.html.templateParameters,
|
|
138
|
+
modernConfig.html.templateParametersByEntries,
|
|
139
|
+
appContext.packageName
|
|
140
|
+
)
|
|
141
|
+
};
|
|
154
142
|
chain.plugin(`${CHAIN_ID.PLUGIN.HTML}-${entryName}`).tap((args) => [
|
|
155
|
-
|
|
143
|
+
{
|
|
144
|
+
...args[0] || {},
|
|
156
145
|
__internal__: true,
|
|
157
146
|
bottomTemplate: appContext.htmlTemplates[`__${entryName}-bottom__`] && (0, import_lodash.template)(appContext.htmlTemplates[`__${entryName}-bottom__`])(
|
|
158
147
|
baseTemplateParams
|
|
159
148
|
)
|
|
160
|
-
}
|
|
149
|
+
}
|
|
161
150
|
]);
|
|
162
151
|
}
|
|
163
152
|
chain.plugin(CHAIN_ID.PLUGIN.BOTTOM_TEMPLATE).use(import_HtmlBottomTemplate.BottomTemplatePlugin, [import_html_webpack_plugin.default]);
|
|
@@ -171,8 +160,8 @@ function applyAsyncChunkHtmlPlugin({
|
|
|
171
160
|
chain.plugin(CHAIN_ID.PLUGIN.HTML_ASYNC_CHUNK).use(import_HtmlAsyncChunkPlugin.HtmlAsyncChunkPlugin, [import_html_webpack_plugin.default]);
|
|
172
161
|
}
|
|
173
162
|
}
|
|
174
|
-
function applyNodeCompat(chain, modernConfig, isProd) {
|
|
175
|
-
|
|
163
|
+
function applyNodeCompat(target, chain, modernConfig, isProd) {
|
|
164
|
+
const nodeExts = [
|
|
176
165
|
".node.js",
|
|
177
166
|
".node.jsx",
|
|
178
167
|
".node.ts",
|
|
@@ -181,9 +170,21 @@ function applyNodeCompat(chain, modernConfig, isProd) {
|
|
|
181
170
|
".server.ts",
|
|
182
171
|
".server.ts",
|
|
183
172
|
".server.tsx"
|
|
184
|
-
]
|
|
173
|
+
];
|
|
174
|
+
const webWorkerExts = [
|
|
175
|
+
".worker.js",
|
|
176
|
+
".worker.jsx",
|
|
177
|
+
".worker.ts",
|
|
178
|
+
".worker.tsx"
|
|
179
|
+
];
|
|
180
|
+
for (const ext of nodeExts) {
|
|
185
181
|
chain.resolve.extensions.prepend(ext);
|
|
186
182
|
}
|
|
183
|
+
if (target === "service-worker") {
|
|
184
|
+
for (const ext of webWorkerExts) {
|
|
185
|
+
chain.resolve.extensions.prepend(ext);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
187
188
|
filterEntriesBySSRConfig(
|
|
188
189
|
isProd,
|
|
189
190
|
chain,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -1,24 +1,7 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
|
-
var __defProps = Object.defineProperties;
|
|
3
2
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
5
3
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
7
4
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
9
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
10
|
-
var __spreadValues = (a, b) => {
|
|
11
|
-
for (var prop in b || (b = {}))
|
|
12
|
-
if (__hasOwnProp.call(b, prop))
|
|
13
|
-
__defNormalProp(a, prop, b[prop]);
|
|
14
|
-
if (__getOwnPropSymbols)
|
|
15
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
16
|
-
if (__propIsEnum.call(b, prop))
|
|
17
|
-
__defNormalProp(a, prop, b[prop]);
|
|
18
|
-
}
|
|
19
|
-
return a;
|
|
20
|
-
};
|
|
21
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
22
5
|
var __export = (target, all) => {
|
|
23
6
|
for (var name in all)
|
|
24
7
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -32,26 +15,6 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
32
15
|
return to;
|
|
33
16
|
};
|
|
34
17
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
35
|
-
var __async = (__this, __arguments, generator) => {
|
|
36
|
-
return new Promise((resolve, reject) => {
|
|
37
|
-
var fulfilled = (value) => {
|
|
38
|
-
try {
|
|
39
|
-
step(generator.next(value));
|
|
40
|
-
} catch (e) {
|
|
41
|
-
reject(e);
|
|
42
|
-
}
|
|
43
|
-
};
|
|
44
|
-
var rejected = (value) => {
|
|
45
|
-
try {
|
|
46
|
-
step(generator.throw(value));
|
|
47
|
-
} catch (e) {
|
|
48
|
-
reject(e);
|
|
49
|
-
}
|
|
50
|
-
};
|
|
51
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
52
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
53
|
-
});
|
|
54
|
-
};
|
|
55
18
|
var build_exports = {};
|
|
56
19
|
__export(build_exports, {
|
|
57
20
|
build: () => build
|
|
@@ -61,7 +24,7 @@ var import_core = require("@modern-js/core");
|
|
|
61
24
|
var import_utils = require("@modern-js/utils");
|
|
62
25
|
var import_routes = require("../utils/routes");
|
|
63
26
|
var import_config = require("../utils/config");
|
|
64
|
-
const build = (api, options) =>
|
|
27
|
+
const build = async (api, options) => {
|
|
65
28
|
if (options == null ? void 0 : options.analyze) {
|
|
66
29
|
process.env.BUNDLE_ANALYZE = "true";
|
|
67
30
|
}
|
|
@@ -71,24 +34,24 @@ const build = (api, options) => __async(void 0, null, function* () {
|
|
|
71
34
|
const { apiOnly } = appContext;
|
|
72
35
|
if (apiOnly) {
|
|
73
36
|
const { appDirectory: appDirectory2, distDirectory: distDirectory2, serverConfigFile: serverConfigFile2 } = appContext;
|
|
74
|
-
|
|
37
|
+
await hookRunners.beforeBuild({
|
|
75
38
|
bundlerConfigs: void 0
|
|
76
39
|
});
|
|
77
|
-
|
|
40
|
+
await (0, import_config.buildServerConfig)({
|
|
78
41
|
appDirectory: appDirectory2,
|
|
79
42
|
distDirectory: distDirectory2,
|
|
80
43
|
configFile: serverConfigFile2
|
|
81
44
|
});
|
|
82
|
-
|
|
83
|
-
|
|
45
|
+
await (0, import_routes.generateRoutes)(appContext);
|
|
46
|
+
await hookRunners.afterBuild({
|
|
84
47
|
stats: void 0
|
|
85
48
|
});
|
|
86
49
|
return;
|
|
87
50
|
}
|
|
88
|
-
resolvedConfig =
|
|
51
|
+
resolvedConfig = { ...resolvedConfig, cliOptions: options };
|
|
89
52
|
import_core.ResolvedConfigContext.set(resolvedConfig);
|
|
90
53
|
const { distDirectory, appDirectory, serverConfigFile } = appContext;
|
|
91
|
-
|
|
54
|
+
await (0, import_config.buildServerConfig)({
|
|
92
55
|
appDirectory,
|
|
93
56
|
distDirectory,
|
|
94
57
|
configFile: serverConfigFile
|
|
@@ -100,12 +63,12 @@ const build = (api, options) => __async(void 0, null, function* () {
|
|
|
100
63
|
"Expect the Builder to have been initialized, But the appContext.builder received `undefined`"
|
|
101
64
|
);
|
|
102
65
|
}
|
|
103
|
-
|
|
66
|
+
await appContext.builder.build();
|
|
104
67
|
} catch (error) {
|
|
105
68
|
(0, import_utils.printBuildError)(error);
|
|
106
69
|
process.exit(1);
|
|
107
70
|
}
|
|
108
|
-
}
|
|
71
|
+
};
|
|
109
72
|
// Annotate the CommonJS export names for ESM import in node:
|
|
110
73
|
0 && (module.exports = {
|
|
111
74
|
build
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var deploy_exports = {};
|
|
19
|
+
__export(deploy_exports, {
|
|
20
|
+
deploy: () => deploy
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(deploy_exports);
|
|
23
|
+
const deploy = async (api, options) => {
|
|
24
|
+
const hookRunners = api.useHookRunners();
|
|
25
|
+
await hookRunners.beforeDeploy(options);
|
|
26
|
+
await hookRunners.afterDeploy(options);
|
|
27
|
+
};
|
|
28
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
29
|
+
0 && (module.exports = {
|
|
30
|
+
deploy
|
|
31
|
+
});
|