@modern-js/app-tools 2.5.1-alpha.1 → 2.6.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 +50 -0
- package/dist/cjs/analyze/generateCode.js +17 -19
- package/dist/cjs/analyze/getBundleEntry.js +5 -1
- package/dist/cjs/analyze/getClientRoutes/getRoutes.js +4 -0
- package/dist/cjs/analyze/getClientRoutes/getRoutesLegacy.js +4 -0
- package/dist/cjs/analyze/getClientRoutes/utils.js +4 -0
- package/dist/cjs/analyze/getFileSystemEntry.js +4 -0
- package/dist/cjs/analyze/getHtmlTemplate.js +4 -0
- package/dist/cjs/analyze/getServerRoutes.js +4 -0
- package/dist/cjs/analyze/index.js +5 -0
- package/dist/cjs/analyze/isDefaultExportFunction.js +4 -0
- package/dist/cjs/analyze/nestedRoutes.js +4 -0
- package/dist/cjs/analyze/templates.js +5 -1
- package/dist/cjs/analyze/utils.js +4 -0
- package/dist/cjs/builder/builder-webpack/builderPlugins/compatModern.js +3 -3
- package/dist/cjs/builder/builder-webpack/index.js +9 -11
- package/dist/cjs/builder/builder-webpack/webpackPlugins/RouterPlugin.js +4 -0
- package/dist/cjs/builder/generator/createBuilderProviderConfig.js +1 -0
- package/dist/cjs/builder/generator/getBuilderTargets.js +1 -1
- package/dist/cjs/builder/generator/index.js +4 -0
- package/dist/cjs/builder/index.js +4 -0
- package/dist/cjs/builder/shared/builderPlugins/adapterModern.js +4 -0
- package/dist/cjs/builder/shared/createCopyPattern.js +8 -0
- package/dist/cjs/commands/build.js +2 -0
- package/dist/cjs/commands/dev.js +15 -12
- package/dist/cjs/commands/serve.js +4 -17
- package/dist/cjs/config/default.js +2 -0
- package/dist/cjs/config/initialize/inits.js +4 -0
- package/dist/cjs/config/legacy/createOutputConfig.js +2 -0
- package/dist/cjs/config/legacy/createToolsConfig.js +4 -1
- package/dist/cjs/index.js +5 -0
- package/dist/cjs/schema/index.js +4 -0
- package/dist/cjs/utils/config.js +4 -0
- package/dist/cjs/utils/createServer.js +4 -0
- package/dist/cjs/utils/generateWatchFiles.js +4 -0
- package/dist/cjs/utils/routes.js +4 -0
- package/dist/esm/analyze/generateCode.js +26 -37
- package/dist/esm/analyze/getBundleEntry.js +2 -2
- package/dist/esm/analyze/index.js +2 -1
- package/dist/esm/builder/builder-webpack/builderPlugins/compatModern.js +2 -2
- package/dist/esm/builder/builder-webpack/index.js +7 -11
- package/dist/esm/builder/generator/createBuilderProviderConfig.js +1 -0
- package/dist/esm/builder/generator/getBuilderTargets.js +1 -1
- package/dist/esm/builder/shared/createCopyPattern.js +4 -0
- package/dist/esm/commands/build.js +2 -0
- package/dist/esm/commands/dev.js +9 -9
- package/dist/esm/commands/serve.js +1 -6
- package/dist/esm/config/default.js +2 -0
- package/dist/esm/config/legacy/createOutputConfig.js +2 -0
- package/dist/esm/config/legacy/createToolsConfig.js +4 -1
- package/dist/esm/index.js +2 -1
- package/dist/esm-node/analyze/generateCode.js +14 -20
- package/dist/esm-node/analyze/getBundleEntry.js +3 -2
- package/dist/esm-node/analyze/index.js +1 -0
- package/dist/esm-node/analyze/templates.js +1 -1
- package/dist/esm-node/builder/builder-webpack/builderPlugins/compatModern.js +2 -2
- package/dist/esm-node/builder/builder-webpack/index.js +6 -12
- package/dist/esm-node/builder/generator/createBuilderProviderConfig.js +1 -0
- package/dist/esm-node/builder/generator/getBuilderTargets.js +1 -1
- package/dist/esm-node/builder/shared/createCopyPattern.js +4 -0
- package/dist/esm-node/commands/build.js +2 -0
- package/dist/esm-node/commands/dev.js +15 -12
- package/dist/esm-node/commands/serve.js +1 -18
- package/dist/esm-node/config/default.js +2 -0
- package/dist/esm-node/config/legacy/createOutputConfig.js +2 -0
- package/dist/esm-node/config/legacy/createToolsConfig.js +4 -1
- package/dist/esm-node/index.js +1 -0
- package/dist/types/builder/builder-webpack/builderPlugins/compatModern.d.ts +1 -7
- package/package.json +26 -26
- package/dist/js/modern/analyze/constants.js +0 -56
- package/dist/js/modern/analyze/generateCode.js +0 -247
- package/dist/js/modern/analyze/getBundleEntry.js +0 -71
- package/dist/js/modern/analyze/getClientRoutes/getRoutes.js +0 -220
- package/dist/js/modern/analyze/getClientRoutes/getRoutesLegacy.js +0 -216
- package/dist/js/modern/analyze/getClientRoutes/index.js +0 -6
- package/dist/js/modern/analyze/getClientRoutes/utils.js +0 -31
- package/dist/js/modern/analyze/getFileSystemEntry.js +0 -109
- package/dist/js/modern/analyze/getHtmlTemplate.js +0 -115
- package/dist/js/modern/analyze/getServerRoutes.js +0 -178
- package/dist/js/modern/analyze/index.js +0 -333
- package/dist/js/modern/analyze/isDefaultExportFunction.js +0 -42
- package/dist/js/modern/analyze/makeLegalIdentifier.js +0 -13
- package/dist/js/modern/analyze/nestedRoutes.js +0 -186
- package/dist/js/modern/analyze/templates.js +0 -328
- package/dist/js/modern/analyze/utils.js +0 -141
- package/dist/js/modern/builder/builder-rspack/index.js +0 -8
- package/dist/js/modern/builder/builder-webpack/builderPlugins/compatModern.js +0 -41
- package/dist/js/modern/builder/builder-webpack/index.js +0 -93
- package/dist/js/modern/builder/builder-webpack/webpackPlugins/RouterPlugin.js +0 -116
- package/dist/js/modern/builder/builder-webpack/webpackPlugins/index.js +0 -1
- package/dist/js/modern/builder/generator/createBuilderOptions.js +0 -24
- package/dist/js/modern/builder/generator/createBuilderProviderConfig.js +0 -39
- package/dist/js/modern/builder/generator/getBuilderTargets.js +0 -21
- package/dist/js/modern/builder/generator/index.js +0 -53
- package/dist/js/modern/builder/index.js +0 -39
- package/dist/js/modern/builder/shared/builderPlugins/adapterModern.js +0 -219
- package/dist/js/modern/builder/shared/bundlerPlugins/HtmlAsyncChunkPlugin.js +0 -27
- package/dist/js/modern/builder/shared/bundlerPlugins/HtmlBottomTemplate.js +0 -34
- package/dist/js/modern/builder/shared/createCopyPattern.js +0 -46
- package/dist/js/modern/builder/shared/index.js +0 -3
- package/dist/js/modern/builder/shared/loaders/serverModuleLoader.js +0 -7
- package/dist/js/modern/builder/shared/types.js +0 -0
- 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/index.js +0 -3
- package/dist/js/modern/commands/inspect.js +0 -38
- package/dist/js/modern/commands/serve.js +0 -54
- package/dist/js/modern/config/default.js +0 -175
- package/dist/js/modern/config/index.js +0 -3
- package/dist/js/modern/config/initialize/index.js +0 -12
- package/dist/js/modern/config/initialize/inits.js +0 -154
- package/dist/js/modern/config/legacy/createHtmlConfig.js +0 -35
- package/dist/js/modern/config/legacy/createOutputConfig.js +0 -68
- package/dist/js/modern/config/legacy/createSourceConfig.js +0 -39
- package/dist/js/modern/config/legacy/createToolsConfig.js +0 -42
- package/dist/js/modern/config/legacy/index.js +0 -51
- package/dist/js/modern/defineConfig.js +0 -27
- package/dist/js/modern/exports/server.js +0 -4
- package/dist/js/modern/hooks.js +0 -35
- package/dist/js/modern/index.js +0 -221
- package/dist/js/modern/initialize/index.js +0 -132
- package/dist/js/modern/locale/en.js +0 -36
- package/dist/js/modern/locale/index.js +0 -9
- package/dist/js/modern/locale/zh.js +0 -36
- package/dist/js/modern/schema/Schema.js +0 -40
- package/dist/js/modern/schema/index.js +0 -88
- package/dist/js/modern/schema/legacy.js +0 -148
- package/dist/js/modern/types/config/deploy.js +0 -0
- package/dist/js/modern/types/config/dev.js +0 -0
- package/dist/js/modern/types/config/experiments.js +0 -0
- package/dist/js/modern/types/config/html.js +0 -0
- package/dist/js/modern/types/config/index.js +0 -1
- package/dist/js/modern/types/config/output.js +0 -0
- package/dist/js/modern/types/config/performance.js +0 -0
- package/dist/js/modern/types/config/security.js +0 -0
- package/dist/js/modern/types/config/source.js +0 -0
- package/dist/js/modern/types/config/tools.js +0 -0
- package/dist/js/modern/types/hooks.js +0 -0
- package/dist/js/modern/types/index.js +0 -3
- package/dist/js/modern/types/legacyConfig/deploy.js +0 -0
- package/dist/js/modern/types/legacyConfig/dev.js +0 -0
- package/dist/js/modern/types/legacyConfig/index.js +0 -0
- package/dist/js/modern/types/legacyConfig/output.js +0 -0
- package/dist/js/modern/types/legacyConfig/source.js +0 -0
- package/dist/js/modern/types/legacyConfig/tools.js +0 -0
- package/dist/js/modern/types/utils.js +0 -0
- package/dist/js/modern/utils/config.js +0 -128
- package/dist/js/modern/utils/createServer.js +0 -75
- package/dist/js/modern/utils/env.js +0 -15
- package/dist/js/modern/utils/generateWatchFiles.js +0 -55
- package/dist/js/modern/utils/getSelectedEntries.js +0 -58
- package/dist/js/modern/utils/getServerInternalPlugins.js +0 -58
- package/dist/js/modern/utils/language.js +0 -8
- 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/modern/utils/types.js +0 -0
- package/dist/js/node/analyze/constants.js +0 -100
- package/dist/js/node/analyze/generateCode.js +0 -271
- package/dist/js/node/analyze/getBundleEntry.js +0 -95
- package/dist/js/node/analyze/getClientRoutes/getRoutes.js +0 -242
- package/dist/js/node/analyze/getClientRoutes/getRoutesLegacy.js +0 -238
- package/dist/js/node/analyze/getClientRoutes/index.js +0 -30
- package/dist/js/node/analyze/getClientRoutes/utils.js +0 -58
- package/dist/js/node/analyze/getFileSystemEntry.js +0 -131
- package/dist/js/node/analyze/getHtmlTemplate.js +0 -144
- package/dist/js/node/analyze/getServerRoutes.js +0 -196
- package/dist/js/node/analyze/index.js +0 -340
- package/dist/js/node/analyze/isDefaultExportFunction.js +0 -71
- package/dist/js/node/analyze/makeLegalIdentifier.js +0 -36
- package/dist/js/node/analyze/nestedRoutes.js +0 -213
- package/dist/js/node/analyze/templates.js +0 -359
- package/dist/js/node/analyze/utils.js +0 -172
- package/dist/js/node/builder/builder-rspack/index.js +0 -31
- package/dist/js/node/builder/builder-webpack/builderPlugins/compatModern.js +0 -64
- package/dist/js/node/builder/builder-webpack/index.js +0 -118
- package/dist/js/node/builder/builder-webpack/webpackPlugins/RouterPlugin.js +0 -140
- package/dist/js/node/builder/builder-webpack/webpackPlugins/index.js +0 -17
- package/dist/js/node/builder/generator/createBuilderOptions.js +0 -47
- package/dist/js/node/builder/generator/createBuilderProviderConfig.js +0 -60
- package/dist/js/node/builder/generator/getBuilderTargets.js +0 -39
- package/dist/js/node/builder/generator/index.js +0 -82
- package/dist/js/node/builder/index.js +0 -68
- package/dist/js/node/builder/shared/builderPlugins/adapterModern.js +0 -245
- package/dist/js/node/builder/shared/bundlerPlugins/HtmlAsyncChunkPlugin.js +0 -50
- package/dist/js/node/builder/shared/bundlerPlugins/HtmlBottomTemplate.js +0 -57
- package/dist/js/node/builder/shared/createCopyPattern.js +0 -75
- package/dist/js/node/builder/shared/index.js +0 -19
- package/dist/js/node/builder/shared/loaders/serverModuleLoader.js +0 -28
- package/dist/js/node/builder/shared/types.js +0 -15
- package/dist/js/node/commands/build.js +0 -112
- package/dist/js/node/commands/deploy.js +0 -51
- package/dist/js/node/commands/dev.js +0 -126
- package/dist/js/node/commands/index.js +0 -19
- package/dist/js/node/commands/inspect.js +0 -61
- package/dist/js/node/commands/serve.js +0 -83
- package/dist/js/node/config/default.js +0 -197
- package/dist/js/node/config/index.js +0 -19
- package/dist/js/node/config/initialize/index.js +0 -35
- package/dist/js/node/config/initialize/inits.js +0 -177
- package/dist/js/node/config/legacy/createHtmlConfig.js +0 -58
- package/dist/js/node/config/legacy/createOutputConfig.js +0 -91
- package/dist/js/node/config/legacy/createSourceConfig.js +0 -62
- package/dist/js/node/config/legacy/createToolsConfig.js +0 -65
- package/dist/js/node/config/legacy/index.js +0 -75
- package/dist/js/node/defineConfig.js +0 -49
- package/dist/js/node/exports/server.js +0 -27
- package/dist/js/node/hooks.js +0 -54
- package/dist/js/node/index.js +0 -245
- package/dist/js/node/initialize/index.js +0 -141
- package/dist/js/node/locale/en.js +0 -59
- package/dist/js/node/locale/index.js +0 -33
- package/dist/js/node/locale/zh.js +0 -59
- package/dist/js/node/schema/Schema.js +0 -63
- package/dist/js/node/schema/index.js +0 -118
- package/dist/js/node/schema/legacy.js +0 -169
- package/dist/js/node/types/config/deploy.js +0 -15
- package/dist/js/node/types/config/dev.js +0 -15
- package/dist/js/node/types/config/experiments.js +0 -15
- package/dist/js/node/types/config/html.js +0 -15
- package/dist/js/node/types/config/index.js +0 -17
- package/dist/js/node/types/config/output.js +0 -15
- package/dist/js/node/types/config/performance.js +0 -15
- package/dist/js/node/types/config/security.js +0 -15
- package/dist/js/node/types/config/source.js +0 -15
- package/dist/js/node/types/config/tools.js +0 -15
- package/dist/js/node/types/hooks.js +0 -15
- package/dist/js/node/types/index.js +0 -19
- package/dist/js/node/types/legacyConfig/deploy.js +0 -15
- package/dist/js/node/types/legacyConfig/dev.js +0 -15
- package/dist/js/node/types/legacyConfig/index.js +0 -15
- package/dist/js/node/types/legacyConfig/output.js +0 -15
- package/dist/js/node/types/legacyConfig/source.js +0 -15
- package/dist/js/node/types/legacyConfig/tools.js +0 -15
- package/dist/js/node/types/utils.js +0 -15
- package/dist/js/node/utils/config.js +0 -153
- package/dist/js/node/utils/createServer.js +0 -106
- package/dist/js/node/utils/env.js +0 -38
- package/dist/js/node/utils/generateWatchFiles.js +0 -85
- package/dist/js/node/utils/getSelectedEntries.js +0 -81
- package/dist/js/node/utils/getServerInternalPlugins.js +0 -79
- package/dist/js/node/utils/language.js +0 -31
- package/dist/js/node/utils/printInstructions.js +0 -54
- package/dist/js/node/utils/restart.js +0 -67
- package/dist/js/node/utils/routes.js +0 -59
- package/dist/js/node/utils/types.js +0 -15
- package/dist/js/treeshaking/analyze/constants.js +0 -42
- package/dist/js/treeshaking/analyze/generateCode.js +0 -485
- package/dist/js/treeshaking/analyze/getBundleEntry.js +0 -62
- package/dist/js/treeshaking/analyze/getClientRoutes/getRoutes.js +0 -233
- package/dist/js/treeshaking/analyze/getClientRoutes/getRoutesLegacy.js +0 -231
- package/dist/js/treeshaking/analyze/getClientRoutes/index.js +0 -3
- package/dist/js/treeshaking/analyze/getClientRoutes/utils.js +0 -23
- package/dist/js/treeshaking/analyze/getFileSystemEntry.js +0 -107
- package/dist/js/treeshaking/analyze/getHtmlTemplate.js +0 -302
- package/dist/js/treeshaking/analyze/getServerRoutes.js +0 -224
- package/dist/js/treeshaking/analyze/index.js +0 -702
- package/dist/js/treeshaking/analyze/isDefaultExportFunction.js +0 -47
- package/dist/js/treeshaking/analyze/makeLegalIdentifier.js +0 -13
- package/dist/js/treeshaking/analyze/nestedRoutes.js +0 -409
- package/dist/js/treeshaking/analyze/templates.js +0 -465
- package/dist/js/treeshaking/analyze/utils.js +0 -374
- package/dist/js/treeshaking/builder/builder-rspack/index.js +0 -6
- package/dist/js/treeshaking/builder/builder-webpack/builderPlugins/compatModern.js +0 -64
- package/dist/js/treeshaking/builder/builder-webpack/index.js +0 -301
- package/dist/js/treeshaking/builder/builder-webpack/webpackPlugins/RouterPlugin.js +0 -346
- package/dist/js/treeshaking/builder/builder-webpack/webpackPlugins/index.js +0 -1
- package/dist/js/treeshaking/builder/generator/createBuilderOptions.js +0 -41
- package/dist/js/treeshaking/builder/generator/createBuilderProviderConfig.js +0 -70
- package/dist/js/treeshaking/builder/generator/getBuilderTargets.js +0 -16
- package/dist/js/treeshaking/builder/generator/index.js +0 -199
- package/dist/js/treeshaking/builder/index.js +0 -175
- package/dist/js/treeshaking/builder/shared/builderPlugins/adapterModern.js +0 -300
- package/dist/js/treeshaking/builder/shared/bundlerPlugins/HtmlAsyncChunkPlugin.js +0 -110
- package/dist/js/treeshaking/builder/shared/bundlerPlugins/HtmlBottomTemplate.js +0 -72
- package/dist/js/treeshaking/builder/shared/createCopyPattern.js +0 -40
- package/dist/js/treeshaking/builder/shared/index.js +0 -3
- package/dist/js/treeshaking/builder/shared/loaders/serverModuleLoader.js +0 -5
- package/dist/js/treeshaking/builder/shared/types.js +0 -1
- package/dist/js/treeshaking/commands/build.js +0 -291
- package/dist/js/treeshaking/commands/deploy.js +0 -154
- package/dist/js/treeshaking/commands/dev.js +0 -301
- package/dist/js/treeshaking/commands/index.js +0 -3
- package/dist/js/treeshaking/commands/inspect.js +0 -149
- package/dist/js/treeshaking/commands/serve.js +0 -199
- package/dist/js/treeshaking/config/default.js +0 -210
- package/dist/js/treeshaking/config/index.js +0 -3
- package/dist/js/treeshaking/config/initialize/index.js +0 -10
- package/dist/js/treeshaking/config/initialize/inits.js +0 -211
- package/dist/js/treeshaking/config/legacy/createHtmlConfig.js +0 -19
- package/dist/js/treeshaking/config/legacy/createOutputConfig.js +0 -41
- package/dist/js/treeshaking/config/legacy/createSourceConfig.js +0 -42
- package/dist/js/treeshaking/config/legacy/createToolsConfig.js +0 -23
- package/dist/js/treeshaking/config/legacy/index.js +0 -38
- package/dist/js/treeshaking/defineConfig.js +0 -61
- package/dist/js/treeshaking/exports/server.js +0 -2
- package/dist/js/treeshaking/hooks.js +0 -29
- package/dist/js/treeshaking/index.js +0 -713
- package/dist/js/treeshaking/initialize/index.js +0 -284
- package/dist/js/treeshaking/locale/en.js +0 -38
- package/dist/js/treeshaking/locale/index.js +0 -9
- package/dist/js/treeshaking/locale/zh.js +0 -38
- package/dist/js/treeshaking/schema/Schema.js +0 -273
- package/dist/js/treeshaking/schema/index.js +0 -181
- package/dist/js/treeshaking/schema/legacy.js +0 -337
- package/dist/js/treeshaking/types/config/deploy.js +0 -1
- package/dist/js/treeshaking/types/config/dev.js +0 -1
- package/dist/js/treeshaking/types/config/experiments.js +0 -1
- package/dist/js/treeshaking/types/config/html.js +0 -1
- package/dist/js/treeshaking/types/config/index.js +0 -1
- package/dist/js/treeshaking/types/config/output.js +0 -1
- package/dist/js/treeshaking/types/config/performance.js +0 -1
- package/dist/js/treeshaking/types/config/security.js +0 -1
- package/dist/js/treeshaking/types/config/source.js +0 -1
- package/dist/js/treeshaking/types/config/tools.js +0 -1
- package/dist/js/treeshaking/types/hooks.js +0 -1
- package/dist/js/treeshaking/types/index.js +0 -3
- package/dist/js/treeshaking/types/legacyConfig/deploy.js +0 -1
- package/dist/js/treeshaking/types/legacyConfig/dev.js +0 -1
- package/dist/js/treeshaking/types/legacyConfig/index.js +0 -1
- package/dist/js/treeshaking/types/legacyConfig/output.js +0 -1
- package/dist/js/treeshaking/types/legacyConfig/source.js +0 -1
- package/dist/js/treeshaking/types/legacyConfig/tools.js +0 -1
- package/dist/js/treeshaking/types/utils.js +0 -1
- package/dist/js/treeshaking/utils/config.js +0 -302
- package/dist/js/treeshaking/utils/createServer.js +0 -258
- package/dist/js/treeshaking/utils/env.js +0 -13
- package/dist/js/treeshaking/utils/generateWatchFiles.js +0 -214
- package/dist/js/treeshaking/utils/getSelectedEntries.js +0 -186
- package/dist/js/treeshaking/utils/getServerInternalPlugins.js +0 -210
- package/dist/js/treeshaking/utils/language.js +0 -6
- package/dist/js/treeshaking/utils/printInstructions.js +0 -152
- package/dist/js/treeshaking/utils/restart.js +0 -187
- package/dist/js/treeshaking/utils/routes.js +0 -153
- package/dist/js/treeshaking/utils/types.js +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,55 @@
|
|
|
1
1
|
# @modern-js/app-tools
|
|
2
2
|
|
|
3
|
+
## 2.6.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 88f7b34: fix(app-tools): incorrect tools.esbuild config
|
|
8
|
+
|
|
9
|
+
fix(app-tools): 修复 tools.esbuild 格式与文档不一致的问题
|
|
10
|
+
|
|
11
|
+
- e1f799e: fix: use 0.0.0.0 instead of localhost as the default dev host
|
|
12
|
+
fix: 使用 0.0.0.0 代替 localhost 作为默认的 dev host
|
|
13
|
+
- 7915ab3: fix: should not assign nestedRoutesEntry to entrypoint if use v5 router
|
|
14
|
+
fix: 使用 v5 路由的时候,不应该在 entrypoint 上挂载 nestedRoutesEntry 属性
|
|
15
|
+
- 08cb975: feat: optimize worker build
|
|
16
|
+
|
|
17
|
+
feat: 优化 worker 构建
|
|
18
|
+
|
|
19
|
+
- Updated dependencies [671477d]
|
|
20
|
+
- Updated dependencies [b92d6db]
|
|
21
|
+
- Updated dependencies [36164a2]
|
|
22
|
+
- Updated dependencies [d638438]
|
|
23
|
+
- Updated dependencies [ba6db6e]
|
|
24
|
+
- Updated dependencies [ba6db6e]
|
|
25
|
+
- Updated dependencies [e1f799e]
|
|
26
|
+
- Updated dependencies [107f674]
|
|
27
|
+
- Updated dependencies [7915ab3]
|
|
28
|
+
- Updated dependencies [03d7f7d]
|
|
29
|
+
- Updated dependencies [1c76d0e]
|
|
30
|
+
- Updated dependencies [fae9d1b]
|
|
31
|
+
- Updated dependencies [49fa0b1]
|
|
32
|
+
- Updated dependencies [0fe658a]
|
|
33
|
+
- Updated dependencies [62930b9]
|
|
34
|
+
- @modern-js/builder-webpack-provider@2.6.0
|
|
35
|
+
- @modern-js/builder-shared@2.6.0
|
|
36
|
+
- @modern-js/prod-server@2.6.0
|
|
37
|
+
- @modern-js/plugin-data-loader@2.6.0
|
|
38
|
+
- @modern-js/server@2.6.0
|
|
39
|
+
- @modern-js/utils@2.6.0
|
|
40
|
+
- @modern-js/builder@2.6.0
|
|
41
|
+
- @modern-js/types@2.6.0
|
|
42
|
+
- @modern-js/builder-rspack-provider@2.6.0
|
|
43
|
+
- @modern-js/builder-plugin-esbuild@2.6.0
|
|
44
|
+
- @modern-js/builder-plugin-node-polyfill@2.6.0
|
|
45
|
+
- @modern-js/core@2.6.0
|
|
46
|
+
- @modern-js/plugin-i18n@2.6.0
|
|
47
|
+
- @modern-js/plugin-lint@2.6.0
|
|
48
|
+
- @modern-js/new-action@2.6.0
|
|
49
|
+
- @modern-js/node-bundle-require@2.6.0
|
|
50
|
+
- @modern-js/upgrade@2.6.0
|
|
51
|
+
- @modern-js/plugin@2.6.0
|
|
52
|
+
|
|
3
53
|
## 2.5.0
|
|
4
54
|
|
|
5
55
|
### Patch Changes
|
|
@@ -17,6 +17,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
return to;
|
|
18
18
|
};
|
|
19
19
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
20
24
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
21
25
|
mod
|
|
22
26
|
));
|
|
@@ -83,7 +87,6 @@ ${initialize || ""}`
|
|
|
83
87
|
).join("\n");
|
|
84
88
|
};
|
|
85
89
|
const generateCode = async (appContext, config, entrypoints, api) => {
|
|
86
|
-
var _a, _b, _c;
|
|
87
90
|
const {
|
|
88
91
|
internalDirectory,
|
|
89
92
|
srcDirectory,
|
|
@@ -92,7 +95,7 @@ const generateCode = async (appContext, config, entrypoints, api) => {
|
|
|
92
95
|
packageName
|
|
93
96
|
} = appContext;
|
|
94
97
|
const hookRunners = api.useHookRunners();
|
|
95
|
-
const isV5 =
|
|
98
|
+
const isV5 = (0, import_utils.isRouterV5)(config);
|
|
96
99
|
const { mountId } = config.html;
|
|
97
100
|
const getRoutes = isV5 ? import_getClientRoutes.getClientRoutesLegacy : import_getClientRoutes.getClientRoutes;
|
|
98
101
|
await Promise.all(entrypoints.map(generateEntryCode));
|
|
@@ -111,23 +114,18 @@ const generateCode = async (appContext, config, entrypoints, api) => {
|
|
|
111
114
|
internalDirAlias
|
|
112
115
|
});
|
|
113
116
|
}
|
|
114
|
-
if (entrypoint.nestedRoutesEntry) {
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
initialRoutes.unshift(nestedRoute);
|
|
127
|
-
}
|
|
128
|
-
} else {
|
|
129
|
-
import_utils.logger.error("Nested routes is not supported in legacy mode.");
|
|
130
|
-
process.exit(1);
|
|
117
|
+
if (!isV5 && entrypoint.nestedRoutesEntry) {
|
|
118
|
+
nestedRoute = await (0, import_nestedRoutes.walk)(
|
|
119
|
+
entrypoint.nestedRoutesEntry,
|
|
120
|
+
entrypoint.nestedRoutesEntry,
|
|
121
|
+
{
|
|
122
|
+
name: internalSrcAlias,
|
|
123
|
+
basename: srcDirectory
|
|
124
|
+
},
|
|
125
|
+
entrypoint.entryName
|
|
126
|
+
);
|
|
127
|
+
if (nestedRoute) {
|
|
128
|
+
initialRoutes.unshift(nestedRoute);
|
|
131
129
|
}
|
|
132
130
|
}
|
|
133
131
|
const { routes } = await hookRunners.modifyFileSystemRoutes({
|
|
@@ -17,6 +17,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
return to;
|
|
18
18
|
};
|
|
19
19
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
20
24
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
21
25
|
mod
|
|
22
26
|
));
|
|
@@ -78,7 +82,7 @@ const getBundleEntry = (appContext, config) => {
|
|
|
78
82
|
customBootstrap: value.customBootstrap && (0, import_utils.ensureAbsolutePath)(appDirectory, value.customBootstrap),
|
|
79
83
|
fileSystemRoutes: import_utils.fs.statSync((0, import_utils.ensureAbsolutePath)(appDirectory, value.entry)).isDirectory() ? {} : void 0
|
|
80
84
|
};
|
|
81
|
-
if (entrypoint.fileSystemRoutes) {
|
|
85
|
+
if (entrypoint.fileSystemRoutes && (0, import_utils.isRouterV5)(config)) {
|
|
82
86
|
entrypoint.nestedRoutesEntry = entrypoint.entry;
|
|
83
87
|
}
|
|
84
88
|
if (!ifAlreadyExists(defaults, entrypoint)) {
|
|
@@ -17,6 +17,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
return to;
|
|
18
18
|
};
|
|
19
19
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
20
24
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
21
25
|
mod
|
|
22
26
|
));
|
|
@@ -17,6 +17,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
return to;
|
|
18
18
|
};
|
|
19
19
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
20
24
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
21
25
|
mod
|
|
22
26
|
));
|
|
@@ -17,6 +17,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
return to;
|
|
18
18
|
};
|
|
19
19
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
20
24
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
21
25
|
mod
|
|
22
26
|
));
|
|
@@ -17,6 +17,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
return to;
|
|
18
18
|
};
|
|
19
19
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
20
24
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
21
25
|
mod
|
|
22
26
|
));
|
|
@@ -17,6 +17,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
return to;
|
|
18
18
|
};
|
|
19
19
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
20
24
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
21
25
|
mod
|
|
22
26
|
));
|
|
@@ -17,6 +17,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
return to;
|
|
18
18
|
};
|
|
19
19
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
20
24
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
21
25
|
mod
|
|
22
26
|
));
|
|
@@ -17,6 +17,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
return to;
|
|
18
18
|
};
|
|
19
19
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
20
24
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
21
25
|
mod
|
|
22
26
|
));
|
|
@@ -219,6 +223,7 @@ var analyze_default = ({
|
|
|
219
223
|
resolved: config
|
|
220
224
|
};
|
|
221
225
|
},
|
|
226
|
+
// This logic is not in the router plugin to avoid having to include some dependencies in the utils package
|
|
222
227
|
async modifyEntryImports({ entrypoint, imports }) {
|
|
223
228
|
const appContext = api.useAppContext();
|
|
224
229
|
const { srcDirectory, internalSrcAlias } = appContext;
|
|
@@ -17,6 +17,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
return to;
|
|
18
18
|
};
|
|
19
19
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
20
24
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
21
25
|
mod
|
|
22
26
|
));
|
|
@@ -17,6 +17,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
return to;
|
|
18
18
|
};
|
|
19
19
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
20
24
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
21
25
|
mod
|
|
22
26
|
));
|
|
@@ -17,6 +17,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
return to;
|
|
18
18
|
};
|
|
19
19
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
20
24
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
21
25
|
mod
|
|
22
26
|
));
|
|
@@ -101,7 +105,7 @@ const html = (partials) => `
|
|
|
101
105
|
|
|
102
106
|
<script>
|
|
103
107
|
window.__assetPrefix__ = '<%= assetPrefix %>';
|
|
104
|
-
|
|
108
|
+
</script>
|
|
105
109
|
${partials.head.join("\n")}
|
|
106
110
|
|
|
107
111
|
<!--<?- chunksMap.css ?>-->
|
|
@@ -17,6 +17,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
return to;
|
|
18
18
|
};
|
|
19
19
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
20
24
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
21
25
|
mod
|
|
22
26
|
));
|
|
@@ -17,13 +17,13 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
18
|
var compatModern_exports = {};
|
|
19
19
|
__export(compatModern_exports, {
|
|
20
|
-
|
|
20
|
+
builderPluginCompatModern: () => builderPluginCompatModern
|
|
21
21
|
});
|
|
22
22
|
module.exports = __toCommonJS(compatModern_exports);
|
|
23
23
|
var import_path = require("path");
|
|
24
24
|
var import_shared = require("../../shared");
|
|
25
25
|
var import_webpackPlugins = require("../webpackPlugins");
|
|
26
|
-
const
|
|
26
|
+
const builderPluginCompatModern = (options) => ({
|
|
27
27
|
name: "builder-plugin-compat-modern",
|
|
28
28
|
setup(api) {
|
|
29
29
|
const { normalizedConfig: modernConfig, appContext } = options;
|
|
@@ -60,5 +60,5 @@ const PluginCompatModern = (options) => ({
|
|
|
60
60
|
});
|
|
61
61
|
// Annotate the CommonJS export names for ESM import in node:
|
|
62
62
|
0 && (module.exports = {
|
|
63
|
-
|
|
63
|
+
builderPluginCompatModern
|
|
64
64
|
});
|
|
@@ -17,6 +17,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
return to;
|
|
18
18
|
};
|
|
19
19
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
20
24
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
21
25
|
mod
|
|
22
26
|
));
|
|
@@ -27,7 +31,6 @@ __export(builder_webpack_exports, {
|
|
|
27
31
|
});
|
|
28
32
|
module.exports = __toCommonJS(builder_webpack_exports);
|
|
29
33
|
var import_builder_webpack_provider = require("@modern-js/builder-webpack-provider");
|
|
30
|
-
var import_utils = require("@modern-js/utils");
|
|
31
34
|
var import_shared = require("../shared");
|
|
32
35
|
var import_generator = require("../generator");
|
|
33
36
|
var import_compatModern = require("./builderPlugins/compatModern");
|
|
@@ -57,20 +60,15 @@ function modifyOutputConfig(config, appContext) {
|
|
|
57
60
|
async function applyBuilderPlugins(builder, options) {
|
|
58
61
|
const { normalizedConfig } = options;
|
|
59
62
|
if (!normalizedConfig.output.disableNodePolyfill) {
|
|
60
|
-
const {
|
|
61
|
-
builder.addPlugins([
|
|
63
|
+
const { builderPluginNodePolyfill } = await Promise.resolve().then(() => __toESM(require("@modern-js/builder-plugin-node-polyfill")));
|
|
64
|
+
builder.addPlugins([builderPluginNodePolyfill()]);
|
|
62
65
|
}
|
|
63
66
|
if (normalizedConfig.tools.esbuild) {
|
|
64
67
|
const { esbuild: esbuildOptions } = normalizedConfig.tools;
|
|
65
|
-
const {
|
|
66
|
-
builder.addPlugins([
|
|
67
|
-
PluginEsbuild({
|
|
68
|
-
loader: false,
|
|
69
|
-
minimize: (0, import_utils.applyOptionsChain)({}, esbuildOptions)
|
|
70
|
-
})
|
|
71
|
-
]);
|
|
68
|
+
const { builderPluginEsbuild } = await Promise.resolve().then(() => __toESM(require("@modern-js/builder-plugin-esbuild")));
|
|
69
|
+
builder.addPlugins([builderPluginEsbuild(esbuildOptions)]);
|
|
72
70
|
}
|
|
73
|
-
builder.addPlugins([(0, import_compatModern.
|
|
71
|
+
builder.addPlugins([(0, import_compatModern.builderPluginCompatModern)(options)]);
|
|
74
72
|
}
|
|
75
73
|
// Annotate the CommonJS export names for ESM import in node:
|
|
76
74
|
0 && (module.exports = {
|
|
@@ -17,6 +17,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
return to;
|
|
18
18
|
};
|
|
19
19
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
20
24
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
21
25
|
mod
|
|
22
26
|
));
|
|
@@ -37,6 +37,7 @@ function createBuilderProviderConfig(resolveConfig, appContext, modifyBuilderCon
|
|
|
37
37
|
html: htmlConfig,
|
|
38
38
|
output: {
|
|
39
39
|
...resolveConfig.output,
|
|
40
|
+
// We need to do this in the app-tools prepare hook because some files will be generated into the dist directory in the analyze process
|
|
40
41
|
cleanDistPath: false
|
|
41
42
|
}
|
|
42
43
|
};
|
|
@@ -27,7 +27,7 @@ function getBuilderTargets(normalizedConfig) {
|
|
|
27
27
|
if (useNodeTarget) {
|
|
28
28
|
targets.push("node");
|
|
29
29
|
}
|
|
30
|
-
const useWorkerTarget = (0, import_utils.
|
|
30
|
+
const useWorkerTarget = (0, import_utils.isServiceWorker)(normalizedConfig);
|
|
31
31
|
if (useWorkerTarget) {
|
|
32
32
|
targets.push("service-worker");
|
|
33
33
|
}
|
|
@@ -17,6 +17,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
return to;
|
|
18
18
|
};
|
|
19
19
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
20
24
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
21
25
|
mod
|
|
22
26
|
));
|
|
@@ -17,6 +17,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
return to;
|
|
18
18
|
};
|
|
19
19
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
20
24
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
21
25
|
mod
|
|
22
26
|
));
|
|
@@ -17,6 +17,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
return to;
|
|
18
18
|
};
|
|
19
19
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
20
24
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
21
25
|
mod
|
|
22
26
|
));
|
|
@@ -17,6 +17,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
return to;
|
|
18
18
|
};
|
|
19
19
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
20
24
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
21
25
|
mod
|
|
22
26
|
));
|
|
@@ -37,6 +41,9 @@ function createCopyPattern(appContext, config, patternsType, chain) {
|
|
|
37
41
|
const publicDir = import_path.default.posix.join(configDir.replace(/\\/g, "/"), "public");
|
|
38
42
|
const minifiedJsRexExp = /\.min\.js/;
|
|
39
43
|
const info = (file) => ({
|
|
44
|
+
// If the file name ends with `.min.js`, we assume it's a compressed file.
|
|
45
|
+
// So we don't want copy-webpack-plugin to minify it.
|
|
46
|
+
// ref: https://github.com/webpack-contrib/copy-webpack-plugin#info
|
|
40
47
|
minimized: minifiedJsRexExp.test(file.sourceFilename)
|
|
41
48
|
});
|
|
42
49
|
if (patternsType === "public") {
|
|
@@ -49,6 +56,7 @@ function createCopyPattern(appContext, config, patternsType, chain) {
|
|
|
49
56
|
to: "public",
|
|
50
57
|
context: publicDir,
|
|
51
58
|
noErrorOnMissing: true,
|
|
59
|
+
// eslint-disable-next-line node/prefer-global/buffer
|
|
52
60
|
transform: (content, absoluteFrom) => {
|
|
53
61
|
if (!/\.html?$/.test(absoluteFrom)) {
|
|
54
62
|
return content;
|
|
@@ -35,6 +35,7 @@ const build = async (api, options) => {
|
|
|
35
35
|
if (apiOnly) {
|
|
36
36
|
const { appDirectory: appDirectory2, distDirectory: distDirectory2, serverConfigFile: serverConfigFile2 } = appContext;
|
|
37
37
|
await hookRunners.beforeBuild({
|
|
38
|
+
// "null" bundlerConfigs
|
|
38
39
|
bundlerConfigs: void 0
|
|
39
40
|
});
|
|
40
41
|
await (0, import_config.buildServerConfig)({
|
|
@@ -44,6 +45,7 @@ const build = async (api, options) => {
|
|
|
44
45
|
});
|
|
45
46
|
await (0, import_routes.generateRoutes)(appContext);
|
|
46
47
|
await hookRunners.afterBuild({
|
|
48
|
+
// "null" stats
|
|
47
49
|
stats: void 0
|
|
48
50
|
});
|
|
49
51
|
return;
|
package/dist/cjs/commands/dev.js
CHANGED
|
@@ -21,13 +21,14 @@ __export(dev_exports, {
|
|
|
21
21
|
});
|
|
22
22
|
module.exports = __toCommonJS(dev_exports);
|
|
23
23
|
var import_core = require("@modern-js/core");
|
|
24
|
+
var import_utils = require("@modern-js/utils");
|
|
24
25
|
var import_printInstructions = require("../utils/printInstructions");
|
|
25
26
|
var import_createServer = require("../utils/createServer");
|
|
26
27
|
var import_routes = require("../utils/routes");
|
|
27
28
|
var import_config = require("../utils/config");
|
|
28
29
|
var import_getServerInternalPlugins = require("../utils/getServerInternalPlugins");
|
|
29
30
|
const dev = async (api, options) => {
|
|
30
|
-
var _a;
|
|
31
|
+
var _a, _b;
|
|
31
32
|
if (options.analyze) {
|
|
32
33
|
process.env.BUNDLE_ANALYZE = "true";
|
|
33
34
|
}
|
|
@@ -59,14 +60,9 @@ const dev = async (api, options) => {
|
|
|
59
60
|
dev: {
|
|
60
61
|
port,
|
|
61
62
|
https: normalizedConfig.dev.https,
|
|
63
|
+
host: normalizedConfig.dev.host,
|
|
62
64
|
...(_a = normalizedConfig.tools) == null ? void 0 : _a.devServer
|
|
63
65
|
},
|
|
64
|
-
appContext: {
|
|
65
|
-
appDirectory: appContext.appDirectory,
|
|
66
|
-
sharedDirectory: appContext.sharedDirectory,
|
|
67
|
-
apiDirectory: appContext.apiDirectory,
|
|
68
|
-
lambdaDirectory: appContext.lambdaDirectory
|
|
69
|
-
},
|
|
70
66
|
pwd: appDirectory,
|
|
71
67
|
config: normalizedConfig,
|
|
72
68
|
serverConfigFile,
|
|
@@ -77,12 +73,19 @@ const dev = async (api, options) => {
|
|
|
77
73
|
...serverOptions,
|
|
78
74
|
compiler: null
|
|
79
75
|
});
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
76
|
+
const host = ((_b = normalizedConfig.dev) == null ? void 0 : _b.host) || import_utils.DEFAULT_DEV_HOST;
|
|
77
|
+
app.listen(
|
|
78
|
+
{
|
|
79
|
+
port,
|
|
80
|
+
host
|
|
81
|
+
},
|
|
82
|
+
async (err) => {
|
|
83
|
+
if (err) {
|
|
84
|
+
throw err;
|
|
85
|
+
}
|
|
86
|
+
(0, import_printInstructions.printInstructions)(hookRunners, appContext, normalizedConfig);
|
|
83
87
|
}
|
|
84
|
-
|
|
85
|
-
});
|
|
88
|
+
);
|
|
86
89
|
} else {
|
|
87
90
|
const { server } = await appContext.builder.startDevServer({
|
|
88
91
|
printURLs: false,
|
|
@@ -17,6 +17,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
return to;
|
|
18
18
|
};
|
|
19
19
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
20
24
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
21
25
|
mod
|
|
22
26
|
));
|
|
@@ -46,23 +50,6 @@ const start = async (api) => {
|
|
|
46
50
|
const app = await (0, import_prod_server.default)({
|
|
47
51
|
pwd: appDirectory,
|
|
48
52
|
config: userConfig,
|
|
49
|
-
appContext: {
|
|
50
|
-
sharedDirectory: (0, import_utils.getTargetDir)(
|
|
51
|
-
appContext.sharedDirectory,
|
|
52
|
-
appContext.appDirectory,
|
|
53
|
-
appContext.distDirectory
|
|
54
|
-
),
|
|
55
|
-
apiDirectory: (0, import_utils.getTargetDir)(
|
|
56
|
-
appContext.apiDirectory,
|
|
57
|
-
appContext.appDirectory,
|
|
58
|
-
appContext.distDirectory
|
|
59
|
-
),
|
|
60
|
-
lambdaDirectory: (0, import_utils.getTargetDir)(
|
|
61
|
-
appContext.lambdaDirectory,
|
|
62
|
-
appContext.appDirectory,
|
|
63
|
-
appContext.distDirectory
|
|
64
|
-
)
|
|
65
|
-
},
|
|
66
53
|
serverConfigFile,
|
|
67
54
|
internalPlugins: (0, import_createServer.injectDataLoaderPlugin)(serverInternalPlugins),
|
|
68
55
|
apiOnly
|
|
@@ -26,6 +26,8 @@ function createDefaultConfig(appContext, bundler) {
|
|
|
26
26
|
const defaultBuilderConfig = (0, import_builder_webpack_provider.createDefaultConfig)();
|
|
27
27
|
const dev = {
|
|
28
28
|
...defaultBuilderConfig.dev,
|
|
29
|
+
// `dev.port` should not have a default value
|
|
30
|
+
// because we will use `server.port` by default
|
|
29
31
|
port: void 0
|
|
30
32
|
};
|
|
31
33
|
const output = {
|
|
@@ -17,6 +17,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
return to;
|
|
18
18
|
};
|
|
19
19
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
20
24
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
21
25
|
mod
|
|
22
26
|
));
|
|
@@ -55,6 +55,7 @@ function createOutputConfig(config) {
|
|
|
55
55
|
css: cssPath,
|
|
56
56
|
js: jsPath,
|
|
57
57
|
html: htmlPath,
|
|
58
|
+
// modern.js v1 output all media files to `dist/media` by default
|
|
58
59
|
svg: mediaPath || "media",
|
|
59
60
|
image: mediaPath || "media",
|
|
60
61
|
font: mediaPath || "media",
|
|
@@ -80,6 +81,7 @@ function createOutputConfig(config) {
|
|
|
80
81
|
disableFilenameHash: disableAssetsCache,
|
|
81
82
|
enableLatestDecorators,
|
|
82
83
|
ssg,
|
|
84
|
+
// set `true`, only in legacy config
|
|
83
85
|
enableAssetFallback: true,
|
|
84
86
|
enableAssetManifest: true,
|
|
85
87
|
disableNodePolyfill
|
package/dist/cjs/index.js
CHANGED
|
@@ -18,6 +18,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
};
|
|
19
19
|
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
20
20
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
21
25
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
26
|
mod
|
|
23
27
|
));
|
|
@@ -174,6 +178,7 @@ var src_default = (options = {
|
|
|
174
178
|
const config = api.useResolvedConfigContext();
|
|
175
179
|
return (0, import_generateWatchFiles.generateWatchFiles)(appContext, config.source.configDir);
|
|
176
180
|
},
|
|
181
|
+
// 这里会被 core/initWatcher 监听的文件变动触发,如果是 src 目录下的文件变动,则不做 restart
|
|
177
182
|
async fileChange(e) {
|
|
178
183
|
const { filename, eventType } = e;
|
|
179
184
|
const appContext = api.useAppContext();
|