@modern-js/app-tools 2.5.1-alpha.1 → 2.7.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 +102 -0
- package/dist/cjs/analyze/generateCode.js +18 -23
- package/dist/cjs/analyze/getBundleEntry.js +5 -1
- package/dist/cjs/analyze/getClientRoutes/getRoutes.js +5 -1
- package/dist/cjs/analyze/getClientRoutes/getRoutesLegacy.js +5 -1
- 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 +11 -1
- package/dist/cjs/analyze/isDefaultExportFunction.js +4 -0
- package/dist/cjs/analyze/nestedRoutes.js +5 -1
- 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 -6
- package/dist/cjs/commands/serve.js +4 -0
- 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 +8 -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 +27 -41
- package/dist/esm/analyze/getBundleEntry.js +2 -2
- package/dist/esm/analyze/getClientRoutes/getRoutes.js +1 -1
- package/dist/esm/analyze/getClientRoutes/getRoutesLegacy.js +1 -1
- package/dist/esm/analyze/index.js +6 -2
- package/dist/esm/analyze/nestedRoutes.js +1 -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 -3
- 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/schema/index.js +7 -0
- package/dist/esm-node/analyze/generateCode.js +15 -26
- package/dist/esm-node/analyze/getBundleEntry.js +3 -2
- package/dist/esm-node/analyze/getClientRoutes/getRoutes.js +1 -1
- package/dist/esm-node/analyze/getClientRoutes/getRoutesLegacy.js +1 -1
- package/dist/esm-node/analyze/index.js +7 -1
- package/dist/esm-node/analyze/nestedRoutes.js +1 -1
- 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 -6
- 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/esm-node/schema/index.js +4 -0
- package/dist/types/analyze/templates.d.ts +2 -2
- package/dist/types/builder/builder-webpack/builderPlugins/compatModern.d.ts +1 -7
- package/lib/types.d.ts +1 -1
- 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
|
@@ -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
|
));
|
|
@@ -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();
|
package/dist/cjs/schema/index.js
CHANGED
|
@@ -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
|
));
|
|
@@ -60,6 +64,10 @@ const bff = {
|
|
|
60
64
|
prefix: {
|
|
61
65
|
type: "string"
|
|
62
66
|
},
|
|
67
|
+
httpMethodDecider: {
|
|
68
|
+
type: "string",
|
|
69
|
+
enum: ["functionName", "inputParams"]
|
|
70
|
+
},
|
|
63
71
|
proxy: {
|
|
64
72
|
type: "object",
|
|
65
73
|
additionalProperties: {
|
package/dist/cjs/utils/config.js
CHANGED
|
@@ -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
|
));
|
package/dist/cjs/utils/routes.js
CHANGED
|
@@ -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
|
));
|
|
@@ -148,8 +148,7 @@ var __generator = this && this.__generator || function(thisArg, body) {
|
|
|
148
148
|
}
|
|
149
149
|
};
|
|
150
150
|
import path from "path";
|
|
151
|
-
import { fs, getEntryOptions, logger } from "@modern-js/utils";
|
|
152
|
-
import { useResolvedConfigContext } from "@modern-js/core";
|
|
151
|
+
import { fs, getEntryOptions, isRouterV5, logger } from "@modern-js/utils";
|
|
153
152
|
import * as templates from "./templates";
|
|
154
153
|
import { getClientRoutes, getClientRoutesLegacy } from "./getClientRoutes";
|
|
155
154
|
import { FILE_SYSTEM_ROUTES_FILE_NAME, ENTRY_POINT_FILE_NAME, ENTRY_BOOTSTRAP_FILE_NAME } from "./constants";
|
|
@@ -240,7 +239,7 @@ var createImportStatements = function(statements) {
|
|
|
240
239
|
};
|
|
241
240
|
var generateCode = function() {
|
|
242
241
|
var _ref = _asyncToGenerator(function(appContext, config, entrypoints, api) {
|
|
243
|
-
var
|
|
242
|
+
var internalDirectory, srcDirectory, internalDirAlias, internalSrcAlias, packageName, hookRunners, isV5, mountId, getRoutes;
|
|
244
243
|
function generateEntryCode(entrypoint) {
|
|
245
244
|
return _generateEntryCode.apply(this, arguments);
|
|
246
245
|
}
|
|
@@ -253,11 +252,11 @@ var generateCode = function() {
|
|
|
253
252
|
entryName = entrypoint.entryName, isAutoMount = entrypoint.isAutoMount, customBootstrap = entrypoint.customBootstrap, fileSystemRoutes = entrypoint.fileSystemRoutes;
|
|
254
253
|
if (!isAutoMount) return [
|
|
255
254
|
3,
|
|
256
|
-
|
|
255
|
+
16
|
|
257
256
|
];
|
|
258
257
|
if (!fileSystemRoutes) return [
|
|
259
258
|
3,
|
|
260
|
-
|
|
259
|
+
9
|
|
261
260
|
];
|
|
262
261
|
initialRoutes = [];
|
|
263
262
|
nestedRoute = null;
|
|
@@ -270,11 +269,7 @@ var generateCode = function() {
|
|
|
270
269
|
internalDirAlias: internalDirAlias
|
|
271
270
|
});
|
|
272
271
|
}
|
|
273
|
-
if (!entrypoint.nestedRoutesEntry) return [
|
|
274
|
-
3,
|
|
275
|
-
3
|
|
276
|
-
];
|
|
277
|
-
if (!!isV5) return [
|
|
272
|
+
if (!(!isV5 && entrypoint.nestedRoutesEntry)) return [
|
|
278
273
|
3,
|
|
279
274
|
2
|
|
280
275
|
];
|
|
@@ -290,15 +285,8 @@ var generateCode = function() {
|
|
|
290
285
|
if (nestedRoute) {
|
|
291
286
|
initialRoutes.unshift(nestedRoute);
|
|
292
287
|
}
|
|
293
|
-
|
|
294
|
-
3,
|
|
295
|
-
3
|
|
296
|
-
];
|
|
288
|
+
_state.label = 2;
|
|
297
289
|
case 2:
|
|
298
|
-
logger.error("Nested routes is not supported in legacy mode.");
|
|
299
|
-
process.exit(1);
|
|
300
|
-
_state.label = 3;
|
|
301
|
-
case 3:
|
|
302
290
|
return [
|
|
303
291
|
4,
|
|
304
292
|
hookRunners.modifyFileSystemRoutes({
|
|
@@ -306,14 +294,12 @@ var generateCode = function() {
|
|
|
306
294
|
routes: initialRoutes
|
|
307
295
|
})
|
|
308
296
|
];
|
|
309
|
-
case
|
|
297
|
+
case 3:
|
|
310
298
|
routes = _state.sent().routes;
|
|
311
|
-
config2 = useResolvedConfigContext();
|
|
299
|
+
config2 = api.useResolvedConfigContext();
|
|
312
300
|
ssr = getEntryOptions(entryName, config2.server.ssr, config2.server.ssrByEntries, packageName);
|
|
313
301
|
if (ssr) {
|
|
314
302
|
mode = typeof ssr === "object" ? ssr.mode || "string" : "string";
|
|
315
|
-
} else {
|
|
316
|
-
mode = false;
|
|
317
303
|
}
|
|
318
304
|
if (mode === "stream") {
|
|
319
305
|
hasPageRoute = routes.some(function(route) {
|
|
@@ -338,18 +324,18 @@ var generateCode = function() {
|
|
|
338
324
|
internalDirectory: internalDirectory
|
|
339
325
|
})
|
|
340
326
|
];
|
|
341
|
-
case
|
|
327
|
+
case 4:
|
|
342
328
|
return [
|
|
343
329
|
4,
|
|
344
330
|
_.apply(hookRunners, [
|
|
345
331
|
(_tmp.code = _state.sent(), _tmp)
|
|
346
332
|
])
|
|
347
333
|
];
|
|
348
|
-
case
|
|
334
|
+
case 5:
|
|
349
335
|
_ref = _state.sent(), code2 = _ref.code;
|
|
350
336
|
if (!(entrypoint.nestedRoutesEntry && mode)) return [
|
|
351
337
|
3,
|
|
352
|
-
|
|
338
|
+
8
|
|
353
339
|
];
|
|
354
340
|
routesServerFile = getServerLoadersFile(internalDirectory, entryName);
|
|
355
341
|
code3 = templates.routesForServer({
|
|
@@ -359,19 +345,19 @@ var generateCode = function() {
|
|
|
359
345
|
4,
|
|
360
346
|
fs.ensureFile(routesServerFile)
|
|
361
347
|
];
|
|
362
|
-
case
|
|
348
|
+
case 6:
|
|
363
349
|
_state.sent();
|
|
364
350
|
return [
|
|
365
351
|
4,
|
|
366
352
|
fs.writeFile(routesServerFile, code3)
|
|
367
353
|
];
|
|
368
|
-
case
|
|
354
|
+
case 7:
|
|
369
355
|
_state.sent();
|
|
356
|
+
_state.label = 8;
|
|
357
|
+
case 8:
|
|
358
|
+
fs.outputFileSync(path.resolve(internalDirectory, "./".concat(entryName, "/").concat(FILE_SYSTEM_ROUTES_FILE_NAME)), code2, "utf8");
|
|
370
359
|
_state.label = 9;
|
|
371
360
|
case 9:
|
|
372
|
-
fs.outputFileSync(path.resolve(internalDirectory, "./".concat(entryName, "/").concat(FILE_SYSTEM_ROUTES_FILE_NAME)), code2, "utf8");
|
|
373
|
-
_state.label = 10;
|
|
374
|
-
case 10:
|
|
375
361
|
return [
|
|
376
362
|
4,
|
|
377
363
|
hookRunners.modifyEntryImports({
|
|
@@ -385,7 +371,7 @@ var generateCode = function() {
|
|
|
385
371
|
})
|
|
386
372
|
})
|
|
387
373
|
];
|
|
388
|
-
case
|
|
374
|
+
case 10:
|
|
389
375
|
_ref1 = _state.sent(), importStatements = _ref1.imports;
|
|
390
376
|
return [
|
|
391
377
|
4,
|
|
@@ -394,7 +380,7 @@ var generateCode = function() {
|
|
|
394
380
|
plugins: []
|
|
395
381
|
})
|
|
396
382
|
];
|
|
397
|
-
case
|
|
383
|
+
case 11:
|
|
398
384
|
plugins = _state.sent().plugins;
|
|
399
385
|
return [
|
|
400
386
|
4,
|
|
@@ -407,7 +393,7 @@ var generateCode = function() {
|
|
|
407
393
|
})
|
|
408
394
|
})
|
|
409
395
|
];
|
|
410
|
-
case
|
|
396
|
+
case 12:
|
|
411
397
|
_ref2 = _state.sent(), renderFunction = _ref2.code;
|
|
412
398
|
return [
|
|
413
399
|
4,
|
|
@@ -416,7 +402,7 @@ var generateCode = function() {
|
|
|
416
402
|
exportStatement: "export default AppWrapper;"
|
|
417
403
|
})
|
|
418
404
|
];
|
|
419
|
-
case
|
|
405
|
+
case 13:
|
|
420
406
|
exportStatement = _state.sent().exportStatement;
|
|
421
407
|
code = templates.index({
|
|
422
408
|
mountId: mountId,
|
|
@@ -428,7 +414,7 @@ var generateCode = function() {
|
|
|
428
414
|
entrypoint.entry = entryFile;
|
|
429
415
|
if (!config.source.enableAsyncEntry) return [
|
|
430
416
|
3,
|
|
431
|
-
|
|
417
|
+
15
|
|
432
418
|
];
|
|
433
419
|
return [
|
|
434
420
|
4,
|
|
@@ -437,19 +423,19 @@ var generateCode = function() {
|
|
|
437
423
|
code: "import('./".concat(ENTRY_BOOTSTRAP_FILE_NAME, "');")
|
|
438
424
|
})
|
|
439
425
|
];
|
|
440
|
-
case
|
|
426
|
+
case 14:
|
|
441
427
|
_ref3 = _state.sent(), asyncEntryCode = _ref3.code;
|
|
442
428
|
fs.outputFileSync(entryFile, asyncEntryCode, "utf8");
|
|
443
429
|
bootstrapFile = path.resolve(internalDirectory, "./".concat(entryName, "/").concat(ENTRY_BOOTSTRAP_FILE_NAME));
|
|
444
430
|
fs.outputFileSync(bootstrapFile, code, "utf8");
|
|
445
431
|
return [
|
|
446
432
|
3,
|
|
447
|
-
|
|
433
|
+
16
|
|
448
434
|
];
|
|
449
|
-
case
|
|
435
|
+
case 15:
|
|
450
436
|
fs.outputFileSync(entryFile, code, "utf8");
|
|
451
|
-
_state.label =
|
|
452
|
-
case
|
|
437
|
+
_state.label = 16;
|
|
438
|
+
case 16:
|
|
453
439
|
return [
|
|
454
440
|
2
|
|
455
441
|
];
|
|
@@ -463,7 +449,7 @@ var generateCode = function() {
|
|
|
463
449
|
case 0:
|
|
464
450
|
internalDirectory = appContext.internalDirectory, srcDirectory = appContext.srcDirectory, internalDirAlias = appContext.internalDirAlias, internalSrcAlias = appContext.internalSrcAlias, packageName = appContext.packageName;
|
|
465
451
|
hookRunners = api.useHookRunners();
|
|
466
|
-
isV5 =
|
|
452
|
+
isV5 = isRouterV5(config);
|
|
467
453
|
mountId = config.html.mountId;
|
|
468
454
|
getRoutes = isV5 ? getClientRoutesLegacy : getClientRoutes;
|
|
469
455
|
return [
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import path from "path";
|
|
2
|
-
import { ensureAbsolutePath, fs, findExists, MAIN_ENTRY_NAME } from "@modern-js/utils";
|
|
2
|
+
import { ensureAbsolutePath, fs, findExists, MAIN_ENTRY_NAME, isRouterV5 } from "@modern-js/utils";
|
|
3
3
|
import { getFileSystemEntry } from "./getFileSystemEntry";
|
|
4
4
|
import { JS_EXTENSIONS } from "./constants";
|
|
5
5
|
var ensureExtensions = function(file) {
|
|
@@ -43,7 +43,7 @@ var getBundleEntry = function(appContext, config) {
|
|
|
43
43
|
customBootstrap: value.customBootstrap && ensureAbsolutePath(appDirectory, value.customBootstrap),
|
|
44
44
|
fileSystemRoutes: fs.statSync(ensureAbsolutePath(appDirectory, value.entry)).isDirectory() ? {} : void 0
|
|
45
45
|
};
|
|
46
|
-
if (entrypoint.fileSystemRoutes) {
|
|
46
|
+
if (entrypoint.fileSystemRoutes && isRouterV5(config)) {
|
|
47
47
|
entrypoint.nestedRoutesEntry = entrypoint.entry;
|
|
48
48
|
}
|
|
49
49
|
if (!ifAlreadyExists(defaults, entrypoint)) {
|
|
@@ -111,7 +111,7 @@ var recursiveReadDir = function(param) {
|
|
|
111
111
|
}
|
|
112
112
|
}
|
|
113
113
|
var route1 = {
|
|
114
|
-
path: "".concat(basePath).concat(dynamicRouteMatched ? ":".concat(dynamicRouteMatched[1]).concat(dynamicRouteMatched[2]) : filename),
|
|
114
|
+
path: "".concat(basePath).concat(dynamicRouteMatched ? ":".concat(dynamicRouteMatched[1].replace(/\$$/, "?")).concat(dynamicRouteMatched[2]) : filename),
|
|
115
115
|
_component: alias1,
|
|
116
116
|
component: componentName1,
|
|
117
117
|
parent: parent,
|
|
@@ -111,7 +111,7 @@ var recursiveReadDirLegacy = function(param) {
|
|
|
111
111
|
}
|
|
112
112
|
}
|
|
113
113
|
var route1 = {
|
|
114
|
-
path: "".concat(basePath).concat(dynamicRouteMatched ? ":".concat(dynamicRouteMatched[1]).concat(dynamicRouteMatched[2]) : filename),
|
|
114
|
+
path: "".concat(basePath).concat(dynamicRouteMatched ? ":".concat(dynamicRouteMatched[1].replace(/\$$/, "?")).concat(dynamicRouteMatched[2]) : filename),
|
|
115
115
|
_component: alias1,
|
|
116
116
|
component: componentName1,
|
|
117
117
|
exact: true,
|
|
@@ -223,6 +223,7 @@ var __generator = this && this.__generator || function(thisArg, body) {
|
|
|
223
223
|
import * as path from "path";
|
|
224
224
|
import { createDebugger, findExists, fs, getEntryOptions, isApiOnly, minimist, getCommand, isDevCommand } from "@modern-js/utils";
|
|
225
225
|
import { cloneDeep } from "@modern-js/utils/lodash";
|
|
226
|
+
import { createVirtualModule } from "@modern-js/builder-shared";
|
|
226
227
|
import { printInstructions } from "../utils/printInstructions";
|
|
227
228
|
import { generateRoutes } from "../utils/routes";
|
|
228
229
|
import { emitResolvedConfig } from "../utils/config";
|
|
@@ -554,8 +555,10 @@ var analyze_default = function(param) {
|
|
|
554
555
|
var entryName = entrypoint.entryName;
|
|
555
556
|
var ssr = getEntryOptions(entryName, resolvedConfig.server.ssr, resolvedConfig.server.ssrByEntries, packageName);
|
|
556
557
|
if (entrypoint.nestedRoutesEntry && ssr && name === "server") {
|
|
558
|
+
var serverLoaderRuntime = require.resolve("@modern-js/plugin-data-loader/runtime");
|
|
557
559
|
var serverLoadersFile = getServerLoadersFile(internalDirectory, entryName);
|
|
558
|
-
|
|
560
|
+
var combinedModule = createVirtualModule('export * from "'.concat(serverLoaderRuntime, '"; export * from "').concat(serverLoadersFile, '"'));
|
|
561
|
+
chain.entry("".concat(entryName, "-server-loaders")).add(combinedModule);
|
|
559
562
|
}
|
|
560
563
|
});
|
|
561
564
|
}
|
|
@@ -570,7 +573,8 @@ var analyze_default = function(param) {
|
|
|
570
573
|
resolved: config
|
|
571
574
|
};
|
|
572
575
|
},
|
|
573
|
-
modifyEntryImports:
|
|
576
|
+
modifyEntryImports: // This logic is not in the router plugin to avoid having to include some dependencies in the utils package
|
|
577
|
+
function modifyEntryImports(param) {
|
|
574
578
|
var entrypoint = param.entrypoint, imports = param.imports;
|
|
575
579
|
return _asyncToGenerator(function() {
|
|
576
580
|
var appContext, srcDirectory, internalSrcAlias, fileSystemRoutes, nestedRoutesEntry, rootLayoutPath, rootLayoutFile, rootLayoutBuffer, rootLayout, _ref, moduleExports, hasAppConfig, generateLayoutPath, hasAppInit;
|
|
@@ -26,7 +26,7 @@ function _unsupportedIterableToArray(o, minLen) {
|
|
|
26
26
|
import { join } from "path";
|
|
27
27
|
import { createCopyPattern } from "../../shared";
|
|
28
28
|
import { RouterPlugin } from "../webpackPlugins";
|
|
29
|
-
var
|
|
29
|
+
var builderPluginCompatModern = function(options) {
|
|
30
30
|
return {
|
|
31
31
|
name: "builder-plugin-compat-modern",
|
|
32
32
|
setup: function setup(api) {
|
|
@@ -61,4 +61,4 @@ var PluginCompatModern = function(options) {
|
|
|
61
61
|
}
|
|
62
62
|
};
|
|
63
63
|
};
|
|
64
|
-
export {
|
|
64
|
+
export { builderPluginCompatModern };
|
|
@@ -200,10 +200,9 @@ var __generator = this && this.__generator || function(thisArg, body) {
|
|
|
200
200
|
}
|
|
201
201
|
};
|
|
202
202
|
import { builderWebpackProvider } from "@modern-js/builder-webpack-provider";
|
|
203
|
-
import { applyOptionsChain } from "@modern-js/utils";
|
|
204
203
|
import { createCopyPattern } from "../shared";
|
|
205
204
|
import { generateBuilder } from "../generator";
|
|
206
|
-
import {
|
|
205
|
+
import { builderPluginCompatModern } from "./builderPlugins/compatModern";
|
|
207
206
|
function createWebpackBuilderForModern(options) {
|
|
208
207
|
return generateBuilder(options, builderWebpackProvider, {
|
|
209
208
|
modifyBuilderConfig: function modifyBuilderConfig(config) {
|
|
@@ -248,7 +247,7 @@ function applyBuilderPlugins(builder, options) {
|
|
|
248
247
|
}
|
|
249
248
|
function _applyBuilderPlugins() {
|
|
250
249
|
_applyBuilderPlugins = _asyncToGenerator(function(builder, options) {
|
|
251
|
-
var normalizedConfig,
|
|
250
|
+
var normalizedConfig, builderPluginNodePolyfill, _normalizedConfig_tools, esbuildOptions, builderPluginEsbuild;
|
|
252
251
|
return __generator(this, function(_state) {
|
|
253
252
|
switch(_state.label){
|
|
254
253
|
case 0:
|
|
@@ -262,9 +261,9 @@ function _applyBuilderPlugins() {
|
|
|
262
261
|
import("@modern-js/builder-plugin-node-polyfill")
|
|
263
262
|
];
|
|
264
263
|
case 1:
|
|
265
|
-
|
|
264
|
+
builderPluginNodePolyfill = _state.sent().builderPluginNodePolyfill;
|
|
266
265
|
builder.addPlugins([
|
|
267
|
-
|
|
266
|
+
builderPluginNodePolyfill()
|
|
268
267
|
]);
|
|
269
268
|
_state.label = 2;
|
|
270
269
|
case 2:
|
|
@@ -278,17 +277,14 @@ function _applyBuilderPlugins() {
|
|
|
278
277
|
import("@modern-js/builder-plugin-esbuild")
|
|
279
278
|
];
|
|
280
279
|
case 3:
|
|
281
|
-
|
|
280
|
+
builderPluginEsbuild = _state.sent().builderPluginEsbuild;
|
|
282
281
|
builder.addPlugins([
|
|
283
|
-
|
|
284
|
-
loader: false,
|
|
285
|
-
minimize: applyOptionsChain({}, esbuildOptions)
|
|
286
|
-
})
|
|
282
|
+
builderPluginEsbuild(esbuildOptions)
|
|
287
283
|
]);
|
|
288
284
|
_state.label = 4;
|
|
289
285
|
case 4:
|
|
290
286
|
builder.addPlugins([
|
|
291
|
-
|
|
287
|
+
builderPluginCompatModern(options)
|
|
292
288
|
]);
|
|
293
289
|
return [
|
|
294
290
|
2
|
|
@@ -61,6 +61,7 @@ function createBuilderProviderConfig(resolveConfig, appContext, modifyBuilderCon
|
|
|
61
61
|
}),
|
|
62
62
|
html: htmlConfig,
|
|
63
63
|
output: _objectSpreadProps(_objectSpread({}, resolveConfig.output), {
|
|
64
|
+
// 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
|
|
64
65
|
cleanDistPath: false
|
|
65
66
|
})
|
|
66
67
|
});
|
|
@@ -7,7 +7,7 @@ function getBuilderTargets(normalizedConfig) {
|
|
|
7
7
|
if (useNodeTarget) {
|
|
8
8
|
targets.push("node");
|
|
9
9
|
}
|
|
10
|
-
var useWorkerTarget =
|
|
10
|
+
var useWorkerTarget = isServiceWorker(normalizedConfig);
|
|
11
11
|
if (useWorkerTarget) {
|
|
12
12
|
targets.push("service-worker");
|
|
13
13
|
}
|
|
@@ -7,6 +7,9 @@ function createCopyPattern(appContext, config, patternsType, chain) {
|
|
|
7
7
|
var minifiedJsRexExp = /\.min\.js/;
|
|
8
8
|
var info = function(file) {
|
|
9
9
|
return {
|
|
10
|
+
// If the file name ends with `.min.js`, we assume it's a compressed file.
|
|
11
|
+
// So we don't want copy-webpack-plugin to minify it.
|
|
12
|
+
// ref: https://github.com/webpack-contrib/copy-webpack-plugin#info
|
|
10
13
|
minimized: minifiedJsRexExp.test(file.sourceFilename)
|
|
11
14
|
};
|
|
12
15
|
};
|
|
@@ -20,6 +23,7 @@ function createCopyPattern(appContext, config, patternsType, chain) {
|
|
|
20
23
|
to: "public",
|
|
21
24
|
context: publicDir,
|
|
22
25
|
noErrorOnMissing: true,
|
|
26
|
+
// eslint-disable-next-line node/prefer-global/buffer
|
|
23
27
|
transform: function(content, absoluteFrom) {
|
|
24
28
|
if (!/\.html?$/.test(absoluteFrom)) {
|
|
25
29
|
return content;
|
|
@@ -199,6 +199,7 @@ var build = function() {
|
|
|
199
199
|
return [
|
|
200
200
|
4,
|
|
201
201
|
hookRunners.beforeBuild({
|
|
202
|
+
// "null" bundlerConfigs
|
|
202
203
|
bundlerConfigs: void 0
|
|
203
204
|
})
|
|
204
205
|
];
|
|
@@ -223,6 +224,7 @@ var build = function() {
|
|
|
223
224
|
return [
|
|
224
225
|
4,
|
|
225
226
|
hookRunners.afterBuild({
|
|
227
|
+
// "null" stats
|
|
226
228
|
stats: void 0
|
|
227
229
|
})
|
|
228
230
|
];
|
package/dist/esm/commands/dev.js
CHANGED
|
@@ -175,6 +175,7 @@ var __generator = this && this.__generator || function(thisArg, body) {
|
|
|
175
175
|
}
|
|
176
176
|
};
|
|
177
177
|
import { ResolvedConfigContext } from "@modern-js/core";
|
|
178
|
+
import { DEFAULT_DEV_HOST } from "@modern-js/utils";
|
|
178
179
|
import { printInstructions } from "../utils/printInstructions";
|
|
179
180
|
import { setServer, createServer, injectDataLoaderPlugin } from "../utils/createServer";
|
|
180
181
|
import { generateRoutes } from "../utils/routes";
|
|
@@ -182,7 +183,7 @@ import { buildServerConfig } from "../utils/config";
|
|
|
182
183
|
import { getServerInternalPlugins } from "../utils/getServerInternalPlugins";
|
|
183
184
|
var dev = function() {
|
|
184
185
|
var _ref = _asyncToGenerator(function(api, options) {
|
|
185
|
-
var _normalizedConfig_tools, normalizedConfig, appContext, hookRunners, appDirectory, distDirectory, port, apiOnly, serverConfigFile, serverInternalPlugins, serverOptions, app, server;
|
|
186
|
+
var _normalizedConfig_tools, normalizedConfig, appContext, hookRunners, appDirectory, distDirectory, port, apiOnly, serverConfigFile, serverInternalPlugins, serverOptions, _normalizedConfig_dev, app, host, server;
|
|
186
187
|
return __generator(this, function(_state) {
|
|
187
188
|
switch(_state.label){
|
|
188
189
|
case 0:
|
|
@@ -236,7 +237,8 @@ var dev = function() {
|
|
|
236
237
|
serverOptions = {
|
|
237
238
|
dev: _objectSpread({
|
|
238
239
|
port: port,
|
|
239
|
-
https: normalizedConfig.dev.https
|
|
240
|
+
https: normalizedConfig.dev.https,
|
|
241
|
+
host: normalizedConfig.dev.host
|
|
240
242
|
}, (_normalizedConfig_tools = normalizedConfig.tools) === null || _normalizedConfig_tools === void 0 ? void 0 : _normalizedConfig_tools.devServer),
|
|
241
243
|
appContext: {
|
|
242
244
|
appDirectory: appContext.appDirectory,
|
|
@@ -261,7 +263,11 @@ var dev = function() {
|
|
|
261
263
|
];
|
|
262
264
|
case 5:
|
|
263
265
|
app = _state.sent();
|
|
264
|
-
|
|
266
|
+
host = ((_normalizedConfig_dev = normalizedConfig.dev) === null || _normalizedConfig_dev === void 0 ? void 0 : _normalizedConfig_dev.host) || DEFAULT_DEV_HOST;
|
|
267
|
+
app.listen({
|
|
268
|
+
port: port,
|
|
269
|
+
host: host
|
|
270
|
+
}, function() {
|
|
265
271
|
var _ref = _asyncToGenerator(function(err) {
|
|
266
272
|
return __generator(this, function(_state) {
|
|
267
273
|
if (err) {
|
|
@@ -54,6 +54,8 @@ import { createDefaultConfig as createDefaultBuilderConfig } from "@modern-js/bu
|
|
|
54
54
|
function createDefaultConfig(appContext, bundler) {
|
|
55
55
|
var defaultBuilderConfig = createDefaultBuilderConfig();
|
|
56
56
|
var dev = _objectSpreadProps(_objectSpread({}, defaultBuilderConfig.dev), {
|
|
57
|
+
// `dev.port` should not have a default value
|
|
58
|
+
// because we will use `server.port` by default
|
|
57
59
|
port: void 0
|
|
58
60
|
});
|
|
59
61
|
var output = _objectSpreadProps(_objectSpread({}, defaultBuilderConfig.output), {
|
|
@@ -8,6 +8,7 @@ function createOutputConfig(config) {
|
|
|
8
8
|
css: cssPath,
|
|
9
9
|
js: jsPath,
|
|
10
10
|
html: htmlPath,
|
|
11
|
+
// modern.js v1 output all media files to `dist/media` by default
|
|
11
12
|
svg: mediaPath || "media",
|
|
12
13
|
image: mediaPath || "media",
|
|
13
14
|
font: mediaPath || "media",
|
|
@@ -33,6 +34,7 @@ function createOutputConfig(config) {
|
|
|
33
34
|
disableFilenameHash: disableAssetsCache,
|
|
34
35
|
enableLatestDecorators: enableLatestDecorators,
|
|
35
36
|
ssg: ssg,
|
|
37
|
+
// set `true`, only in legacy config
|
|
36
38
|
enableAssetFallback: true,
|
|
37
39
|
enableAssetManifest: true,
|
|
38
40
|
disableNodePolyfill: disableNodePolyfill
|