@modern-js/app-tools 2.11.1-alpha.1 → 2.13.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 +103 -0
- package/dist/cjs/analyze/templates.js +8 -14
- package/dist/cjs/builder/builder-rspack/index.js +1 -22
- package/dist/cjs/builder/builder-webpack/index.js +0 -4
- package/dist/cjs/builder/generator/index.js +5 -0
- package/dist/cjs/builder/shared/builderPlugins/adapterHtml.js +39 -2
- package/dist/cjs/builder/shared/builderPlugins/adapterSSR.js +20 -0
- package/dist/cjs/builder/shared/bundlerPlugins/RouterPlugin.js +2 -10
- package/dist/cjs/config/legacy/index.js +3 -2
- package/dist/cjs/defineConfig.js +8 -4
- package/dist/cjs/index.js +7 -4
- package/dist/cjs/initialize/index.js +14 -2
- package/dist/cjs/locale/index.js +1 -1
- package/dist/cjs/utils/restart.js +1 -1
- package/dist/esm/analyze/templates.js +5 -6
- package/dist/esm/builder/builder-rspack/index.js +1 -169
- package/dist/esm/builder/builder-webpack/index.js +5 -20
- package/dist/esm/builder/generator/index.js +17 -1
- package/dist/esm/builder/shared/builderPlugins/adapterHtml.js +216 -14
- package/dist/esm/builder/shared/builderPlugins/adapterSSR.js +10 -0
- package/dist/esm/builder/shared/bundlerPlugins/RouterPlugin.js +4 -5
- package/dist/esm/config/legacy/index.js +2 -2
- package/dist/esm/defineConfig.js +3 -1
- package/dist/esm/index.js +3 -2
- package/dist/esm/initialize/index.js +13 -2
- package/dist/esm/locale/index.js +1 -1
- package/dist/esm/utils/restart.js +2 -2
- package/dist/esm-node/analyze/templates.js +8 -14
- package/dist/esm-node/builder/builder-rspack/index.js +1 -12
- package/dist/esm-node/builder/builder-webpack/index.js +0 -4
- package/dist/esm-node/builder/generator/index.js +5 -0
- package/dist/esm-node/builder/shared/builderPlugins/adapterHtml.js +35 -3
- package/dist/esm-node/builder/shared/builderPlugins/adapterSSR.js +10 -0
- package/dist/esm-node/builder/shared/bundlerPlugins/RouterPlugin.js +3 -11
- package/dist/esm-node/config/legacy/index.js +3 -2
- package/dist/esm-node/defineConfig.js +8 -4
- package/dist/esm-node/index.js +4 -2
- package/dist/esm-node/initialize/index.js +14 -2
- package/dist/esm-node/locale/index.js +1 -1
- package/dist/esm-node/utils/restart.js +2 -2
- package/dist/types/builder/builder-rspack/index.d.ts +1 -2
- package/dist/types/builder/shared/builderPlugins/adapterHtml.d.ts +1 -1
- package/dist/types/defineConfig.d.ts +3 -2
- package/dist/types/index.d.ts +1 -0
- package/package.json +25 -24
- package/dist/cjs/utils/language.js +0 -31
- package/dist/esm/utils/language.js +0 -6
- package/dist/esm-node/utils/language.js +0 -8
- 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/dist/types/utils/language.d.ts +0 -1
|
@@ -123,7 +123,7 @@ var __generator = this && this.__generator || function(thisArg, body) {
|
|
|
123
123
|
}
|
|
124
124
|
};
|
|
125
125
|
import { cli } from "@modern-js/core";
|
|
126
|
-
import { chalk, clearConsole,
|
|
126
|
+
import { chalk, clearConsole, getFullArgv, logger, program } from "@modern-js/utils";
|
|
127
127
|
function restart(hooksRunner, filename) {
|
|
128
128
|
return _restart.apply(this, arguments);
|
|
129
129
|
}
|
|
@@ -170,7 +170,7 @@ function _restart() {
|
|
|
170
170
|
];
|
|
171
171
|
case 5:
|
|
172
172
|
if (!hasGetError) {
|
|
173
|
-
program.parse(
|
|
173
|
+
program.parse(getFullArgv());
|
|
174
174
|
}
|
|
175
175
|
return [
|
|
176
176
|
7
|
|
@@ -68,9 +68,6 @@ const html = (partials) => `
|
|
|
68
68
|
|
|
69
69
|
${partials.top.join("\n")}
|
|
70
70
|
|
|
71
|
-
<script>
|
|
72
|
-
window.__assetPrefix__ = '<%= assetPrefix %>';
|
|
73
|
-
</script>
|
|
74
71
|
${partials.head.join("\n")}
|
|
75
72
|
|
|
76
73
|
</head>
|
|
@@ -168,13 +165,10 @@ const fileSystemRoutes = async ({
|
|
|
168
165
|
if (!ssrMode) {
|
|
169
166
|
return "";
|
|
170
167
|
}
|
|
171
|
-
let dataLoaderPath = require.resolve("@modern-js/plugin-data-loader/loader");
|
|
172
168
|
if (nestedRoutesEntry) {
|
|
173
|
-
|
|
174
|
-
loadersMapFile
|
|
175
|
-
)}&loaderId=${loaderId}!`;
|
|
169
|
+
return `?mapFile=${slash(loadersMapFile)}&loaderId=${loaderId}`;
|
|
176
170
|
}
|
|
177
|
-
return
|
|
171
|
+
return "";
|
|
178
172
|
};
|
|
179
173
|
const traverseRouteTree = (route) => {
|
|
180
174
|
var _a;
|
|
@@ -292,14 +286,14 @@ const fileSystemRoutes = async ({
|
|
|
292
286
|
let importLoadersCode = "";
|
|
293
287
|
for (const [key, loaderInfo] of Object.entries(loadersMap)) {
|
|
294
288
|
if (loaderInfo.inline) {
|
|
295
|
-
importLoadersCode += `import { loader as ${key} } from "${
|
|
296
|
-
|
|
297
|
-
)}${
|
|
289
|
+
importLoadersCode += `import { loader as ${key} } from "${slash(
|
|
290
|
+
loaderInfo.filePath
|
|
291
|
+
)}${getDataLoaderPath(key)}";
|
|
298
292
|
`;
|
|
299
293
|
} else {
|
|
300
|
-
importLoadersCode += `import ${key} from "${
|
|
301
|
-
|
|
302
|
-
)}${
|
|
294
|
+
importLoadersCode += `import ${key} from "${slash(
|
|
295
|
+
loaderInfo.filePath
|
|
296
|
+
)}${getDataLoaderPath(key)}";
|
|
303
297
|
`;
|
|
304
298
|
}
|
|
305
299
|
}
|
|
@@ -1,18 +1,7 @@
|
|
|
1
1
|
import { builderRspackProvider } from "@modern-js/builder-rspack-provider";
|
|
2
2
|
import { generateBuilder } from "../generator";
|
|
3
3
|
function createRspackBuilderForModern(options) {
|
|
4
|
-
return generateBuilder(options, builderRspackProvider
|
|
5
|
-
async modifyBuilderInstance(builder) {
|
|
6
|
-
applyBuilderPlugins(builder, options);
|
|
7
|
-
}
|
|
8
|
-
});
|
|
9
|
-
}
|
|
10
|
-
async function applyBuilderPlugins(builder, options) {
|
|
11
|
-
const { normalizedConfig } = options;
|
|
12
|
-
if (!normalizedConfig.output.disableNodePolyfill) {
|
|
13
|
-
const { builderPluginNodePolyfill } = await import("@modern-js/builder-plugin-node-polyfill");
|
|
14
|
-
builder.addPlugins([builderPluginNodePolyfill()]);
|
|
15
|
-
}
|
|
4
|
+
return generateBuilder(options, builderRspackProvider);
|
|
16
5
|
}
|
|
17
6
|
export {
|
|
18
7
|
createRspackBuilderForModern
|
|
@@ -29,10 +29,6 @@ function modifyOutputConfig(config, appContext) {
|
|
|
29
29
|
}
|
|
30
30
|
async function applyBuilderPlugins(builder, options) {
|
|
31
31
|
const { normalizedConfig } = options;
|
|
32
|
-
if (!normalizedConfig.output.disableNodePolyfill) {
|
|
33
|
-
const { builderPluginNodePolyfill } = await import("@modern-js/builder-plugin-node-polyfill");
|
|
34
|
-
builder.addPlugins([builderPluginNodePolyfill()]);
|
|
35
|
-
}
|
|
36
32
|
if (normalizedConfig.tools.esbuild) {
|
|
37
33
|
const { esbuild: esbuildOptions } = normalizedConfig.tools;
|
|
38
34
|
const { builderPluginEsbuild } = await import("@modern-js/builder-plugin-esbuild");
|
|
@@ -31,6 +31,11 @@ async function applyBuilderPlugins(builder, options) {
|
|
|
31
31
|
builderPluginAdapterSSR(options),
|
|
32
32
|
builderPluginAdapterHtml(options)
|
|
33
33
|
]);
|
|
34
|
+
const { normalizedConfig } = options;
|
|
35
|
+
if (!normalizedConfig.output.disableNodePolyfill) {
|
|
36
|
+
const { builderPluginNodePolyfill } = await import("@modern-js/builder-plugin-node-polyfill");
|
|
37
|
+
builder.addPlugins([builderPluginNodePolyfill()]);
|
|
38
|
+
}
|
|
34
39
|
}
|
|
35
40
|
export {
|
|
36
41
|
generateBuilder
|
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
createVirtualModule
|
|
3
|
+
} from "@modern-js/builder-shared";
|
|
4
|
+
import {
|
|
5
|
+
getEntryOptions,
|
|
6
|
+
removeTailSlash
|
|
7
|
+
} from "@modern-js/utils";
|
|
2
8
|
import { template as lodashTemplate } from "@modern-js/utils/lodash";
|
|
3
9
|
import { BottomTemplatePlugin } from "../bundlerPlugins";
|
|
4
10
|
function isHtmlEnabled(config, target) {
|
|
@@ -6,10 +12,10 @@ function isHtmlEnabled(config, target) {
|
|
|
6
12
|
return ((_a = config.tools) == null ? void 0 : _a.htmlPlugin) !== false && target !== "node" && target !== "service-worker" && target !== "web-worker";
|
|
7
13
|
}
|
|
8
14
|
const builderPluginAdapterHtml = (options) => ({
|
|
9
|
-
name: "builder-plugin-
|
|
15
|
+
name: "builder-plugin-adapter-modern-html",
|
|
10
16
|
setup(api) {
|
|
11
17
|
api.modifyBundlerChain(
|
|
12
|
-
(chain, { CHAIN_ID, target, HtmlPlugin: HtmlBundlerPlugin }) => {
|
|
18
|
+
async (chain, { CHAIN_ID, target, HtmlPlugin: HtmlBundlerPlugin }) => {
|
|
13
19
|
const builderConfig = api.getNormalizedConfig();
|
|
14
20
|
if (isHtmlEnabled(builderConfig, target)) {
|
|
15
21
|
applyBottomHtmlPlugin({
|
|
@@ -19,11 +25,37 @@ const builderPluginAdapterHtml = (options) => ({
|
|
|
19
25
|
CHAIN_ID,
|
|
20
26
|
HtmlBundlerPlugin
|
|
21
27
|
});
|
|
28
|
+
await injectAssetPrefix({
|
|
29
|
+
api,
|
|
30
|
+
chain
|
|
31
|
+
});
|
|
22
32
|
}
|
|
23
33
|
}
|
|
24
34
|
);
|
|
25
35
|
}
|
|
26
36
|
});
|
|
37
|
+
async function injectAssetPrefix({
|
|
38
|
+
api,
|
|
39
|
+
chain
|
|
40
|
+
}) {
|
|
41
|
+
const entries = chain.entryPoints.entries() || {};
|
|
42
|
+
const entryNames = Object.keys(entries);
|
|
43
|
+
const assetPrefix = removeTailSlash(chain.output.get("publicPath") || "");
|
|
44
|
+
const code = `window.__assetPrefix__ = '${assetPrefix}';`;
|
|
45
|
+
const isRspack = api.context.bundlerType === "rspack";
|
|
46
|
+
if (isRspack) {
|
|
47
|
+
const fileName = "rspack-asset-prefix";
|
|
48
|
+
const { default: RspackVirtualModulePlugin } = await import("rspack-plugin-virtual-module");
|
|
49
|
+
entryNames.forEach((entryName) => {
|
|
50
|
+
entries[entryName].prepend(fileName);
|
|
51
|
+
chain.plugin("rspack-asset-prefix").use(RspackVirtualModulePlugin, [{ [fileName]: code }]);
|
|
52
|
+
});
|
|
53
|
+
} else {
|
|
54
|
+
entryNames.forEach((entryName) => {
|
|
55
|
+
entries[entryName].prepend(createVirtualModule(code));
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
}
|
|
27
59
|
function applyBottomHtmlPlugin({
|
|
28
60
|
api,
|
|
29
61
|
chain,
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import * as path from "path";
|
|
1
2
|
import {
|
|
2
3
|
mergeBuilderConfig
|
|
3
4
|
} from "@modern-js/builder-shared";
|
|
@@ -26,6 +27,7 @@ const builderPluginAdapterSSR = (options) => ({
|
|
|
26
27
|
applyRouterPlugin(chain, options);
|
|
27
28
|
if (isSSR(normalizedConfig2)) {
|
|
28
29
|
await applySSRLoaderEntry(chain, options, isServer);
|
|
30
|
+
applySSRDataLoader(chain, options);
|
|
29
31
|
}
|
|
30
32
|
if (["node", "service-worker"].includes(target)) {
|
|
31
33
|
applyFilterEntriesBySSRConfig({
|
|
@@ -141,6 +143,14 @@ async function applySSRLoaderEntry(chain, optinos, isServer) {
|
|
|
141
143
|
})
|
|
142
144
|
);
|
|
143
145
|
}
|
|
146
|
+
function applySSRDataLoader(chain, options) {
|
|
147
|
+
const { normalizedConfig, appContext } = options;
|
|
148
|
+
const { appDirectory } = appContext;
|
|
149
|
+
const { entriesDir = "./src" } = normalizedConfig.source;
|
|
150
|
+
const absolutePath = path.resolve(appDirectory, entriesDir);
|
|
151
|
+
const reg = new RegExp(`${absolutePath}.*\\.loader\\.[t|j]s$`);
|
|
152
|
+
chain.module.rule("ssr-data-loader").test(reg).use("data-loader").loader(require.resolve("@modern-js/plugin-data-loader/loader")).end();
|
|
153
|
+
}
|
|
144
154
|
export {
|
|
145
155
|
builderPluginAdapterSSR
|
|
146
156
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import path from "path";
|
|
2
|
-
import { fs
|
|
2
|
+
import { fs } from "@modern-js/utils";
|
|
3
3
|
import { ROUTE_MANIFEST_FILE } from "@modern-js/utils/constants";
|
|
4
4
|
import { ROUTE_MANIFEST } from "@modern-js/utils/universal/constants";
|
|
5
5
|
const PLUGIN_NAME = "ModernjsRoutePlugin";
|
|
@@ -39,17 +39,9 @@ class RouterPlugin {
|
|
|
39
39
|
chunks: true,
|
|
40
40
|
ids: true
|
|
41
41
|
});
|
|
42
|
-
const {
|
|
43
|
-
publicPath,
|
|
44
|
-
chunks = [],
|
|
45
|
-
assetsByChunkName,
|
|
46
|
-
namedChunkGroups
|
|
47
|
-
} = stats;
|
|
42
|
+
const { publicPath, chunks = [], namedChunkGroups } = stats;
|
|
48
43
|
const routeAssets = {};
|
|
49
|
-
if (!namedChunkGroups
|
|
50
|
-
logger.warn(
|
|
51
|
-
"Route manifest does not exist, performance will be affected"
|
|
52
|
-
);
|
|
44
|
+
if (!namedChunkGroups) {
|
|
53
45
|
return;
|
|
54
46
|
}
|
|
55
47
|
for (const [name, chunkGroup] of Object.entries(namedChunkGroups)) {
|
|
@@ -16,7 +16,8 @@ function transformNormalizedConfig(config) {
|
|
|
16
16
|
server,
|
|
17
17
|
cliOptions,
|
|
18
18
|
plugins,
|
|
19
|
-
testing
|
|
19
|
+
testing,
|
|
20
|
+
autoLoadPlugins
|
|
20
21
|
} = config;
|
|
21
22
|
return {
|
|
22
23
|
source,
|
|
@@ -36,7 +37,7 @@ function transformNormalizedConfig(config) {
|
|
|
36
37
|
security: {},
|
|
37
38
|
_raw: {},
|
|
38
39
|
experiments: {},
|
|
39
|
-
autoLoadPlugins
|
|
40
|
+
autoLoadPlugins,
|
|
40
41
|
performance: {
|
|
41
42
|
removeMomentLocale: true
|
|
42
43
|
}
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
const defineConfig = (config) => config;
|
|
2
|
-
const defineLegacyConfig = (config) =>
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
const defineLegacyConfig = (config) => {
|
|
3
|
+
var _a;
|
|
4
|
+
return {
|
|
5
|
+
...config,
|
|
6
|
+
legacy: true,
|
|
7
|
+
autoLoadPlugins: (_a = config.autoLoadPlugins) != null ? _a : true
|
|
8
|
+
};
|
|
9
|
+
};
|
|
6
10
|
export {
|
|
7
11
|
defineConfig,
|
|
8
12
|
defineLegacyConfig
|
package/dist/esm-node/index.js
CHANGED
|
@@ -7,13 +7,14 @@ import {
|
|
|
7
7
|
getCommand
|
|
8
8
|
} from "@modern-js/utils";
|
|
9
9
|
import { castArray } from "@modern-js/utils/lodash";
|
|
10
|
+
import { getLocaleLanguage } from "@modern-js/plugin-i18n/language-detector";
|
|
10
11
|
import analyzePlugin from "./analyze";
|
|
11
12
|
import initializePlugin from "./initialize";
|
|
12
13
|
import { hooks } from "./hooks";
|
|
13
14
|
import { i18n, localeKeys } from "./locale";
|
|
14
|
-
import { getLocaleLanguage } from "./utils/language";
|
|
15
15
|
import { restart } from "./utils/restart";
|
|
16
16
|
import { generateWatchFiles } from "./utils/generateWatchFiles";
|
|
17
|
+
import { mergeConfig } from "@modern-js/core";
|
|
17
18
|
export * from "./defineConfig";
|
|
18
19
|
export * from "./types";
|
|
19
20
|
const upgradeModel = Import.lazy(
|
|
@@ -169,5 +170,6 @@ var src_default = (options = {
|
|
|
169
170
|
export {
|
|
170
171
|
buildCommand,
|
|
171
172
|
src_default as default,
|
|
172
|
-
devCommand
|
|
173
|
+
devCommand,
|
|
174
|
+
mergeConfig
|
|
173
175
|
};
|
|
@@ -15,10 +15,22 @@ var initialize_default = ({
|
|
|
15
15
|
bundler
|
|
16
16
|
}) => ({
|
|
17
17
|
name: "@modern-js/plugin-initialize",
|
|
18
|
+
post: [
|
|
19
|
+
"@modern-js/plugin-ssr",
|
|
20
|
+
"@modern-js/plugin-document",
|
|
21
|
+
"@modern-js/plugin-state",
|
|
22
|
+
"@modern-js/plugin-router",
|
|
23
|
+
"@modern-js/plugin-router-v5",
|
|
24
|
+
"@modern-js/plugin-polyfill"
|
|
25
|
+
],
|
|
18
26
|
setup(api) {
|
|
19
27
|
const config = () => {
|
|
20
28
|
const appContext = api.useAppContext();
|
|
21
29
|
const userConfig = api.useConfigContext();
|
|
30
|
+
api.setAppContext({
|
|
31
|
+
...appContext,
|
|
32
|
+
bundlerType: bundler
|
|
33
|
+
});
|
|
22
34
|
return checkIsLegacyConfig(userConfig) ? createLegacyDefaultConfig(appContext) : createDefaultConfig(appContext, bundler);
|
|
23
35
|
};
|
|
24
36
|
const validateSchema = () => {
|
|
@@ -30,7 +42,7 @@ var initialize_default = ({
|
|
|
30
42
|
config,
|
|
31
43
|
validateSchema,
|
|
32
44
|
async resolvedConfig({ resolved }) {
|
|
33
|
-
var _a;
|
|
45
|
+
var _a, _b;
|
|
34
46
|
let appContext = api.useAppContext();
|
|
35
47
|
const userConfig = api.useConfigContext();
|
|
36
48
|
const port = await getServerPort(resolved);
|
|
@@ -49,7 +61,7 @@ var initialize_default = ({
|
|
|
49
61
|
...normalizedConfig.server || {},
|
|
50
62
|
port
|
|
51
63
|
};
|
|
52
|
-
resolved.autoLoadPlugins = normalizedConfig.autoLoadPlugins
|
|
64
|
+
resolved.autoLoadPlugins = (_b = normalizedConfig.autoLoadPlugins) != null ? _b : false;
|
|
53
65
|
stabilizeConfig(resolved, normalizedConfig, [
|
|
54
66
|
"source",
|
|
55
67
|
"bff",
|
|
@@ -2,7 +2,7 @@ import { I18n } from "@modern-js/plugin-i18n";
|
|
|
2
2
|
import { ZH_LOCALE } from "./zh";
|
|
3
3
|
import { EN_LOCALE } from "./en";
|
|
4
4
|
const i18n = new I18n();
|
|
5
|
-
const localeKeys = i18n.init("
|
|
5
|
+
const localeKeys = i18n.init("en", { zh: ZH_LOCALE, en: EN_LOCALE });
|
|
6
6
|
export {
|
|
7
7
|
i18n,
|
|
8
8
|
localeKeys
|
|
@@ -2,7 +2,7 @@ import { cli } from "@modern-js/core";
|
|
|
2
2
|
import {
|
|
3
3
|
chalk,
|
|
4
4
|
clearConsole,
|
|
5
|
-
|
|
5
|
+
getFullArgv,
|
|
6
6
|
logger,
|
|
7
7
|
program
|
|
8
8
|
} from "@modern-js/utils";
|
|
@@ -19,7 +19,7 @@ async function restart(hooksRunner, filename) {
|
|
|
19
19
|
hasGetError = true;
|
|
20
20
|
} finally {
|
|
21
21
|
if (!hasGetError) {
|
|
22
|
-
program.parse(
|
|
22
|
+
program.parse(getFullArgv());
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
25
|
}
|
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
import { BuilderInstance } from '@modern-js/builder-shared';
|
|
2
1
|
import { BuilderOptions } from '../shared';
|
|
3
|
-
export declare function createRspackBuilderForModern(options: BuilderOptions<'rspack'>): Promise<BuilderInstance<import("@modern-js/builder-shared").BuilderProvider<Record<string, any>, Record<string, any>, Record<string, any>, Record<string, any>>>>;
|
|
2
|
+
export declare function createRspackBuilderForModern(options: BuilderOptions<'rspack'>): Promise<import("@modern-js/builder-shared").BuilderInstance<import("@modern-js/builder-shared").BuilderProvider<Record<string, any>, Record<string, any>, Record<string, any>, Record<string, any>>>>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { BuilderPlugin, BuilderTarget } from '@modern-js/builder-shared';
|
|
2
2
|
import { Bundler } from '../../../types';
|
|
3
3
|
import type { BuilderNormalizedConfig, BuilderOptions, BuilderPluginAPI } from '../types';
|
|
4
4
|
export declare function isHtmlEnabled(config: BuilderNormalizedConfig, target: BuilderTarget): boolean;
|
|
@@ -2,8 +2,9 @@ import type { UserConfigExport } from '@modern-js/core';
|
|
|
2
2
|
import type { AppLegacyUserConfig, AppUserConfig } from './types';
|
|
3
3
|
export declare const defineConfig: <B extends "webpack" | "rspack" = "webpack">(config: UserConfigExport<AppUserConfig<B>>) => UserConfigExport<AppUserConfig<B>>;
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
6
|
-
*
|
|
5
|
+
* Recommend use `defineConfig` first.
|
|
6
|
+
*
|
|
7
|
+
* `defineLegacyConfig` will be deprecated in the future.
|
|
7
8
|
*/
|
|
8
9
|
|
|
9
10
|
export declare const defineLegacyConfig: (config: AppLegacyUserConfig) => AppLegacyUserConfig;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Command } from '@modern-js/utils';
|
|
2
2
|
import { CliPlugin, PluginAPI } from '@modern-js/core';
|
|
3
3
|
import { AppTools } from './types';
|
|
4
|
+
export { mergeConfig } from '@modern-js/core';
|
|
4
5
|
export * from './defineConfig';
|
|
5
6
|
export * from './types';
|
|
6
7
|
export type { RuntimeUserConfig } from './types/config';
|
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"modern",
|
|
12
12
|
"modern.js"
|
|
13
13
|
],
|
|
14
|
-
"version": "2.
|
|
14
|
+
"version": "2.13.0",
|
|
15
15
|
"jsnext:source": "./src/index.ts",
|
|
16
16
|
"types": "./dist/types/index.d.ts",
|
|
17
17
|
"main": "./dist/cjs/index.js",
|
|
@@ -68,23 +68,24 @@
|
|
|
68
68
|
"@babel/types": "^7.18.0",
|
|
69
69
|
"es-module-lexer": "^1.1.0",
|
|
70
70
|
"esbuild": "0.15.7",
|
|
71
|
-
"
|
|
72
|
-
"@modern-js/builder
|
|
73
|
-
"@modern-js/builder-
|
|
74
|
-
"@modern-js/
|
|
75
|
-
"@modern-js/
|
|
76
|
-
"@modern-js/
|
|
77
|
-
"@modern-js/
|
|
78
|
-
"@modern-js/
|
|
79
|
-
"@modern-js/
|
|
80
|
-
"@modern-js/
|
|
81
|
-
"@modern-js/
|
|
82
|
-
"@modern-js/
|
|
83
|
-
"@modern-js/
|
|
84
|
-
"@modern-js/
|
|
85
|
-
"@modern-js/
|
|
86
|
-
"@modern-js/
|
|
87
|
-
"@modern-js/
|
|
71
|
+
"rspack-plugin-virtual-module": "0.1.0",
|
|
72
|
+
"@modern-js/builder": "2.13.0",
|
|
73
|
+
"@modern-js/builder-plugin-esbuild": "2.13.0",
|
|
74
|
+
"@modern-js/builder-plugin-node-polyfill": "2.13.0",
|
|
75
|
+
"@modern-js/builder-shared": "2.13.0",
|
|
76
|
+
"@modern-js/builder-webpack-provider": "2.13.0",
|
|
77
|
+
"@modern-js/core": "2.13.0",
|
|
78
|
+
"@modern-js/new-action": "2.13.0",
|
|
79
|
+
"@modern-js/node-bundle-require": "2.13.0",
|
|
80
|
+
"@modern-js/plugin": "2.13.0",
|
|
81
|
+
"@modern-js/plugin-data-loader": "2.13.0",
|
|
82
|
+
"@modern-js/plugin-i18n": "2.13.0",
|
|
83
|
+
"@modern-js/plugin-lint": "2.13.0",
|
|
84
|
+
"@modern-js/prod-server": "2.13.0",
|
|
85
|
+
"@modern-js/server": "2.13.0",
|
|
86
|
+
"@modern-js/types": "2.13.0",
|
|
87
|
+
"@modern-js/upgrade": "2.13.0",
|
|
88
|
+
"@modern-js/utils": "2.13.0"
|
|
88
89
|
},
|
|
89
90
|
"devDependencies": {
|
|
90
91
|
"@types/babel__traverse": "^7.14.2",
|
|
@@ -93,14 +94,14 @@
|
|
|
93
94
|
"jest": "^29",
|
|
94
95
|
"typescript": "^4",
|
|
95
96
|
"webpack": "^5.76.2",
|
|
96
|
-
"@modern-js/builder-
|
|
97
|
-
"@
|
|
98
|
-
"@modern-js/server-core": "2.
|
|
99
|
-
"@scripts/jest-config": "2.
|
|
100
|
-
"@
|
|
97
|
+
"@modern-js/builder-plugin-swc": "2.13.0",
|
|
98
|
+
"@modern-js/builder-rspack-provider": "2.13.0",
|
|
99
|
+
"@modern-js/server-core": "2.13.0",
|
|
100
|
+
"@scripts/jest-config": "2.13.0",
|
|
101
|
+
"@scripts/build": "2.13.0"
|
|
101
102
|
},
|
|
102
103
|
"peerDependencies": {
|
|
103
|
-
"@modern-js/builder-rspack-provider": "^2.
|
|
104
|
+
"@modern-js/builder-rspack-provider": "^2.13.0"
|
|
104
105
|
},
|
|
105
106
|
"peerDependenciesMeta": {
|
|
106
107
|
"@modern-js/builder-rspack-provider": {
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __export = (target, all) => {
|
|
6
|
-
for (var name in all)
|
|
7
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
-
};
|
|
9
|
-
var __copyProps = (to, from, except, desc) => {
|
|
10
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
-
for (let key of __getOwnPropNames(from))
|
|
12
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
-
}
|
|
15
|
-
return to;
|
|
16
|
-
};
|
|
17
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
-
var language_exports = {};
|
|
19
|
-
__export(language_exports, {
|
|
20
|
-
getLocaleLanguage: () => getLocaleLanguage
|
|
21
|
-
});
|
|
22
|
-
module.exports = __toCommonJS(language_exports);
|
|
23
|
-
var import_language_detector = require("@modern-js/plugin-i18n/language-detector");
|
|
24
|
-
function getLocaleLanguage() {
|
|
25
|
-
const detector = new import_language_detector.I18CLILanguageDetector();
|
|
26
|
-
return detector.detect();
|
|
27
|
-
}
|
|
28
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
29
|
-
0 && (module.exports = {
|
|
30
|
-
getLocaleLanguage
|
|
31
|
-
});
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
const JS_EXTENSIONS = [".js", ".ts", ".jsx", ".tsx"];
|
|
2
|
-
const INDEX_FILE_NAME = "index";
|
|
3
|
-
const APP_FILE_NAME = "App";
|
|
4
|
-
const PAGES_DIR_NAME = "pages";
|
|
5
|
-
const NESTED_ROUTES_DIR = "routes";
|
|
6
|
-
const FILE_SYSTEM_ROUTES_FILE_NAME = "routes.js";
|
|
7
|
-
const LOADER_EXPORT_NAME = "loader";
|
|
8
|
-
const TEMP_LOADERS_DIR = "__loaders__";
|
|
9
|
-
const ENTRY_POINT_FILE_NAME = "index.js";
|
|
10
|
-
const ENTRY_BOOTSTRAP_FILE_NAME = "bootstrap.js";
|
|
11
|
-
const FILE_SYSTEM_ROUTES_DYNAMIC_REGEXP = /^\[(\S+)\]([*+?]?)$/;
|
|
12
|
-
const FILE_SYSTEM_ROUTES_LAYOUT = "_layout";
|
|
13
|
-
const FILE_SYSTEM_ROUTES_GLOBAL_LAYOUT = "_app";
|
|
14
|
-
const FILE_SYSTEM_ROUTES_INDEX = "index";
|
|
15
|
-
const FILE_SYSTEM_ROUTES_IGNORED_REGEX = /\.(d|test|spec|e2e)\.(js|jsx|ts|tsx)$/;
|
|
16
|
-
const HTML_PARTIALS_FOLDER = "html";
|
|
17
|
-
const HTML_PARTIALS_EXTENSIONS = [".htm", ".html", ".ejs"];
|
|
18
|
-
const FILE_SYSTEM_ROUTES_COMPONENTS_DIR = "internal_components";
|
|
19
|
-
const NESTED_ROUTE = {
|
|
20
|
-
LAYOUT_FILE: "layout",
|
|
21
|
-
LAYOUT_LOADER_FILE: "layout.loader",
|
|
22
|
-
PAGE_FILE: "page",
|
|
23
|
-
PAGE_LOADER_FILE: "page.loader",
|
|
24
|
-
LOADING_FILE: "loading",
|
|
25
|
-
ERROR_FILE: "error",
|
|
26
|
-
LOADER_FILE: "loader",
|
|
27
|
-
SPLATE_FILE: "$",
|
|
28
|
-
SPLATE_LOADER_FILE: "$.loader"
|
|
29
|
-
};
|
|
30
|
-
const APP_CONFIG_NAME = "config";
|
|
31
|
-
const APP_INIT_EXPORTED = "init";
|
|
32
|
-
const APP_INIT_IMPORTED = "appInit";
|
|
33
|
-
export {
|
|
34
|
-
APP_CONFIG_NAME,
|
|
35
|
-
APP_FILE_NAME,
|
|
36
|
-
APP_INIT_EXPORTED,
|
|
37
|
-
APP_INIT_IMPORTED,
|
|
38
|
-
ENTRY_BOOTSTRAP_FILE_NAME,
|
|
39
|
-
ENTRY_POINT_FILE_NAME,
|
|
40
|
-
FILE_SYSTEM_ROUTES_COMPONENTS_DIR,
|
|
41
|
-
FILE_SYSTEM_ROUTES_DYNAMIC_REGEXP,
|
|
42
|
-
FILE_SYSTEM_ROUTES_FILE_NAME,
|
|
43
|
-
FILE_SYSTEM_ROUTES_GLOBAL_LAYOUT,
|
|
44
|
-
FILE_SYSTEM_ROUTES_IGNORED_REGEX,
|
|
45
|
-
FILE_SYSTEM_ROUTES_INDEX,
|
|
46
|
-
FILE_SYSTEM_ROUTES_LAYOUT,
|
|
47
|
-
HTML_PARTIALS_EXTENSIONS,
|
|
48
|
-
HTML_PARTIALS_FOLDER,
|
|
49
|
-
INDEX_FILE_NAME,
|
|
50
|
-
JS_EXTENSIONS,
|
|
51
|
-
LOADER_EXPORT_NAME,
|
|
52
|
-
NESTED_ROUTE,
|
|
53
|
-
NESTED_ROUTES_DIR,
|
|
54
|
-
PAGES_DIR_NAME,
|
|
55
|
-
TEMP_LOADERS_DIR
|
|
56
|
-
};
|