@modern-js/app-tools 2.58.1 → 2.58.3
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/dist/cjs/builder/builder-rspack/adapterCopy.js +1 -1
- package/dist/cjs/builder/builder-webpack/createCopyPattern.js +0 -1
- package/dist/cjs/builder/builder-webpack/index.js +1 -1
- package/dist/cjs/builder/generator/getBuilderEnvironments.js +1 -1
- package/dist/cjs/builder/generator/index.js +2 -2
- package/dist/cjs/builder/index.js +2 -2
- package/dist/cjs/builder/shared/builderPlugins/adapterSSR.js +8 -13
- package/dist/cjs/builder/shared/bundlerPlugins/RouterPlugin.js +2 -5
- package/dist/cjs/commands/build.js +21 -2
- package/dist/cjs/commands/dev.js +15 -5
- package/dist/cjs/commands/index.js +9 -9
- package/dist/cjs/commands/serve.js +4 -3
- package/dist/cjs/config/initialize/inits.js +4 -4
- package/dist/cjs/config/legacy/index.js +3 -3
- package/dist/cjs/esm/esbuild-loader.mjs +20 -0
- package/dist/cjs/esm/register-esm.mjs +66 -0
- package/dist/cjs/esm/ts-node-loader.mjs +21 -0
- package/dist/cjs/esm/utils.mjs +43 -0
- package/dist/cjs/index.js +8 -8
- package/dist/cjs/locale/index.js +1 -1
- package/dist/cjs/plugins/analyze/getServerRoutes.js +2 -2
- package/dist/cjs/plugins/analyze/index.js +9 -9
- package/dist/cjs/plugins/analyze/utils.js +1 -1
- package/dist/cjs/plugins/deploy/dependencies/index.js +2 -1
- package/dist/cjs/plugins/deploy/dependencies/utils.js +13 -2
- package/dist/cjs/plugins/deploy/index.js +2 -2
- package/dist/cjs/plugins/deploy/platforms/netlify-entry.js +3 -0
- package/dist/cjs/plugins/deploy/platforms/netlify-entry.mjs +1 -0
- package/dist/cjs/plugins/deploy/platforms/{netlifyEntry.js → netlify-handler.js} +6 -4
- package/dist/cjs/plugins/deploy/platforms/netlify.js +15 -6
- package/dist/cjs/plugins/deploy/platforms/node.js +14 -5
- package/dist/cjs/plugins/deploy/platforms/vercel-entry.js +3 -0
- package/dist/cjs/plugins/deploy/platforms/vercel-entry.mjs +3 -0
- package/dist/cjs/plugins/deploy/platforms/{vercelEntry.js → vercel-handler.js} +4 -1
- package/dist/cjs/plugins/deploy/platforms/vercel.js +15 -6
- package/dist/cjs/plugins/serverBuild.js +2 -2
- package/dist/cjs/utils/config.js +1 -1
- package/dist/cjs/utils/createServer.js +1 -1
- package/dist/cjs/utils/loadPlugins.js +1 -1
- package/dist/cjs/utils/register.js +50 -23
- package/dist/types/builder/builder-rspack/adapterCopy.d.ts +2 -2
- package/dist/types/builder/builder-rspack/index.d.ts +1 -1
- package/dist/types/builder/builder-webpack/adapterModern.d.ts +2 -2
- package/dist/types/builder/builder-webpack/index.d.ts +1 -1
- package/dist/types/builder/generator/createBuilderProviderConfig.d.ts +1 -1
- package/dist/types/builder/generator/index.d.ts +3 -3
- package/dist/types/builder/index.d.ts +1 -1
- package/dist/types/builder/shared/builderPlugins/adapterHtml.d.ts +1 -1
- package/dist/types/builder/shared/builderPlugins/adapterSSR.d.ts +1 -1
- package/dist/types/builder/shared/bundlerPlugins/HtmlAsyncChunkPlugin.d.ts +1 -1
- package/dist/types/builder/shared/bundlerPlugins/HtmlBottomTemplate.d.ts +1 -1
- package/dist/types/builder/shared/bundlerPlugins/RouterPlugin.d.ts +1 -1
- package/dist/types/builder/shared/createCopyInfo.d.ts +1 -1
- package/dist/types/builder/shared/loaders/serverModuleLoader.d.ts +1 -1
- package/dist/types/builder/shared/types.d.ts +1 -1
- package/dist/types/commands/build.d.ts +2 -2
- package/dist/types/commands/dev.d.ts +3 -3
- package/dist/types/commands/index.d.ts +3 -3
- package/dist/types/commands/inspect.d.ts +1 -1
- package/dist/types/config/default.d.ts +1 -1
- package/dist/types/config/initialize/inits.d.ts +1 -1
- package/dist/types/config/legacy/createHtmlConfig.d.ts +1 -1
- package/dist/types/config/legacy/createOutputConfig.d.ts +1 -1
- package/dist/types/config/legacy/createSourceConfig.d.ts +1 -1
- package/dist/types/config/legacy/createToolsConfig.d.ts +1 -1
- package/dist/types/esm/esbuild-loader.d.mts +6 -0
- package/dist/types/esm/register-esm.d.mts +5 -0
- package/dist/types/esm/ts-node-loader.d.mts +6 -0
- package/dist/types/esm/utils.d.mts +6 -0
- package/dist/types/exports/server.d.ts +1 -1
- package/dist/types/hooks.d.ts +1 -1
- package/dist/types/index.d.ts +2 -2
- package/dist/types/plugins/analyze/getBundleEntry.d.ts +1 -1
- package/dist/types/plugins/analyze/getFileSystemEntry.d.ts +1 -1
- package/dist/types/plugins/analyze/index.d.ts +1 -1
- package/dist/types/plugins/deploy/dependencies/index.d.ts +1 -1
- package/dist/types/plugins/deploy/dependencies/utils.d.ts +1 -1
- package/dist/types/plugins/deploy/index.d.ts +2 -2
- package/dist/types/plugins/deploy/platforms/netlify-entry.d.cts +1 -0
- package/dist/types/plugins/deploy/platforms/netlify-entry.d.mts +1 -0
- package/dist/types/plugins/deploy/platforms/netlify-handler.d.cts +1 -0
- package/dist/types/plugins/deploy/platforms/netlify.d.ts +1 -1
- package/dist/types/plugins/deploy/platforms/node.d.ts +1 -1
- package/dist/types/plugins/deploy/platforms/platform.d.ts +2 -2
- package/dist/types/plugins/deploy/platforms/vercel-entry.d.mts +2 -0
- package/dist/types/plugins/deploy/platforms/vercel-entry.d.ts +2 -0
- package/dist/types/plugins/deploy/platforms/vercel-handler.d.cts +1 -0
- package/dist/types/plugins/deploy/platforms/vercel.d.ts +1 -1
- package/dist/types/plugins/deploy/utils.d.ts +1 -1
- package/dist/types/plugins/initialize/index.d.ts +1 -1
- package/dist/types/plugins/serverBuild.d.ts +1 -1
- package/dist/types/types/config/index.d.ts +8 -8
- package/dist/types/types/config/output.d.ts +1 -1
- package/dist/types/types/config/tools.d.ts +3 -3
- package/dist/types/types/hooks.d.ts +3 -3
- package/dist/types/types/index.d.ts +3 -3
- package/dist/types/types/legacyConfig/index.d.ts +3 -3
- package/dist/types/types/legacyConfig/tools.d.ts +1 -1
- package/dist/types/utils/createServer.d.ts +1 -1
- package/dist/types/utils/generateWatchFiles.d.ts +1 -1
- package/dist/types/utils/getSelectedEntries.d.ts +1 -1
- package/dist/types/utils/loadPlugins.d.ts +3 -3
- package/dist/types/utils/printInstructions.d.ts +1 -1
- package/dist/types/utils/register.d.ts +2 -2
- package/dist/types/utils/restart.d.ts +2 -2
- package/lib/types.d.ts +15 -0
- package/package.json +20 -20
- package/dist/esm/builder/builder-rspack/adapterCopy.js +0 -166
- package/dist/esm/builder/builder-rspack/index.js +0 -34
- package/dist/esm/builder/builder-webpack/adapterModern.js +0 -29
- package/dist/esm/builder/builder-webpack/createCopyPattern.js +0 -44
- package/dist/esm/builder/builder-webpack/index.js +0 -52
- package/dist/esm/builder/generator/createBuilderProviderConfig.js +0 -37
- package/dist/esm/builder/generator/getBuilderEnvironments.js +0 -81
- package/dist/esm/builder/generator/index.js +0 -94
- package/dist/esm/builder/index.js +0 -45
- package/dist/esm/builder/shared/builderPlugins/adapterBasic.js +0 -85
- package/dist/esm/builder/shared/builderPlugins/adapterHtml.js +0 -126
- package/dist/esm/builder/shared/builderPlugins/adapterSSR.js +0 -270
- package/dist/esm/builder/shared/builderPlugins/adapterWorker.js +0 -43
- package/dist/esm/builder/shared/builderPlugins/index.js +0 -4
- package/dist/esm/builder/shared/bundlerPlugins/HtmlAsyncChunkPlugin.js +0 -51
- package/dist/esm/builder/shared/bundlerPlugins/HtmlBottomTemplate.js +0 -37
- package/dist/esm/builder/shared/bundlerPlugins/RouterPlugin.js +0 -317
- package/dist/esm/builder/shared/bundlerPlugins/index.js +0 -3
- package/dist/esm/builder/shared/createCopyInfo.js +0 -14
- package/dist/esm/builder/shared/index.js +0 -3
- package/dist/esm/builder/shared/loaders/serverModuleLoader.js +0 -7
- package/dist/esm/builder/shared/types.js +0 -0
- package/dist/esm/commands/build.js +0 -117
- package/dist/esm/commands/deploy.js +0 -48
- package/dist/esm/commands/dev.js +0 -169
- package/dist/esm/commands/index.js +0 -411
- package/dist/esm/commands/inspect.js +0 -28
- package/dist/esm/commands/serve.js +0 -93
- package/dist/esm/config/default.js +0 -190
- package/dist/esm/config/index.js +0 -3
- package/dist/esm/config/initialize/index.js +0 -9
- package/dist/esm/config/initialize/inits.js +0 -85
- package/dist/esm/config/legacy/createHtmlConfig.js +0 -21
- package/dist/esm/config/legacy/createOutputConfig.js +0 -45
- package/dist/esm/config/legacy/createSourceConfig.js +0 -46
- package/dist/esm/config/legacy/createToolsConfig.js +0 -28
- package/dist/esm/config/legacy/index.js +0 -43
- package/dist/esm/defineConfig.js +0 -16
- package/dist/esm/exports/server.js +0 -4
- package/dist/esm/hooks.js +0 -34
- package/dist/esm/index.js +0 -239
- package/dist/esm/locale/en.js +0 -43
- package/dist/esm/locale/index.js +0 -12
- package/dist/esm/locale/zh.js +0 -43
- package/dist/esm/plugins/analyze/constants.js +0 -14
- package/dist/esm/plugins/analyze/getBundleEntry.js +0 -102
- package/dist/esm/plugins/analyze/getFileSystemEntry.js +0 -238
- package/dist/esm/plugins/analyze/getHtmlTemplate.js +0 -178
- package/dist/esm/plugins/analyze/getServerRoutes.js +0 -132
- package/dist/esm/plugins/analyze/index.js +0 -380
- package/dist/esm/plugins/analyze/isDefaultExportFunction.js +0 -49
- package/dist/esm/plugins/analyze/templates.js +0 -6
- package/dist/esm/plugins/analyze/utils.js +0 -101
- package/dist/esm/plugins/deploy/dependencies/index.js +0 -614
- package/dist/esm/plugins/deploy/dependencies/utils.js +0 -394
- package/dist/esm/plugins/deploy/exports.js +0 -4
- package/dist/esm/plugins/deploy/index.js +0 -135
- package/dist/esm/plugins/deploy/platforms/netlify.js +0 -299
- package/dist/esm/plugins/deploy/platforms/netlifyEntry.js +0 -203
- package/dist/esm/plugins/deploy/platforms/node.js +0 -133
- package/dist/esm/plugins/deploy/platforms/nodeEntry.js +0 -108
- package/dist/esm/plugins/deploy/platforms/platform.js +0 -0
- package/dist/esm/plugins/deploy/platforms/vercel.js +0 -233
- package/dist/esm/plugins/deploy/platforms/vercelEntry.js +0 -203
- package/dist/esm/plugins/deploy/utils.js +0 -47
- package/dist/esm/plugins/initialize/index.js +0 -119
- package/dist/esm/plugins/serverBuild.js +0 -87
- package/dist/esm/types/config/deploy.js +0 -0
- package/dist/esm/types/config/dev.js +0 -0
- package/dist/esm/types/config/experiments.js +0 -0
- package/dist/esm/types/config/html.js +0 -0
- package/dist/esm/types/config/index.js +0 -1
- package/dist/esm/types/config/output.js +0 -0
- package/dist/esm/types/config/performance.js +0 -0
- package/dist/esm/types/config/security.js +0 -0
- package/dist/esm/types/config/source.js +0 -0
- package/dist/esm/types/config/testing.js +0 -0
- package/dist/esm/types/config/tools.js +0 -0
- package/dist/esm/types/hooks.js +0 -0
- package/dist/esm/types/index.js +0 -3
- package/dist/esm/types/legacyConfig/deploy.js +0 -0
- package/dist/esm/types/legacyConfig/dev.js +0 -0
- package/dist/esm/types/legacyConfig/index.js +0 -0
- package/dist/esm/types/legacyConfig/output.js +0 -0
- package/dist/esm/types/legacyConfig/source.js +0 -0
- package/dist/esm/types/legacyConfig/testing.js +0 -0
- package/dist/esm/types/legacyConfig/tools.js +0 -0
- package/dist/esm/types/utils.js +0 -0
- package/dist/esm/utils/config.js +0 -122
- package/dist/esm/utils/createServer.js +0 -58
- package/dist/esm/utils/env.js +0 -16
- package/dist/esm/utils/generateWatchFiles.js +0 -71
- package/dist/esm/utils/getSelectedEntries.js +0 -67
- package/dist/esm/utils/loadPlugins.js +0 -69
- package/dist/esm/utils/printInstructions.js +0 -32
- package/dist/esm/utils/register.js +0 -129
- package/dist/esm/utils/restart.js +0 -67
- package/dist/esm/utils/routes.js +0 -42
- package/dist/esm/utils/types.js +0 -0
- package/dist/esm-node/builder/builder-rspack/adapterCopy.js +0 -67
- package/dist/esm-node/builder/builder-rspack/index.js +0 -12
- package/dist/esm-node/builder/builder-webpack/adapterModern.js +0 -26
- package/dist/esm-node/builder/builder-webpack/createCopyPattern.js +0 -42
- package/dist/esm-node/builder/builder-webpack/index.js +0 -20
- package/dist/esm-node/builder/generator/createBuilderProviderConfig.js +0 -44
- package/dist/esm-node/builder/generator/getBuilderEnvironments.js +0 -60
- package/dist/esm-node/builder/generator/index.js +0 -37
- package/dist/esm-node/builder/index.js +0 -11
- package/dist/esm-node/builder/shared/builderPlugins/adapterBasic.js +0 -48
- package/dist/esm-node/builder/shared/builderPlugins/adapterHtml.js +0 -60
- package/dist/esm-node/builder/shared/builderPlugins/adapterSSR.js +0 -156
- package/dist/esm-node/builder/shared/builderPlugins/adapterWorker.js +0 -27
- package/dist/esm-node/builder/shared/builderPlugins/index.js +0 -4
- package/dist/esm-node/builder/shared/bundlerPlugins/HtmlAsyncChunkPlugin.js +0 -30
- package/dist/esm-node/builder/shared/bundlerPlugins/HtmlBottomTemplate.js +0 -31
- package/dist/esm-node/builder/shared/bundlerPlugins/RouterPlugin.js +0 -231
- package/dist/esm-node/builder/shared/bundlerPlugins/index.js +0 -3
- package/dist/esm-node/builder/shared/createCopyInfo.js +0 -14
- package/dist/esm-node/builder/shared/index.js +0 -3
- package/dist/esm-node/builder/shared/loaders/serverModuleLoader.js +0 -7
- package/dist/esm-node/builder/shared/types.js +0 -0
- package/dist/esm-node/commands/build.js +0 -55
- package/dist/esm-node/commands/deploy.js +0 -12
- package/dist/esm-node/commands/dev.js +0 -95
- package/dist/esm-node/commands/index.js +0 -92
- package/dist/esm-node/commands/inspect.js +0 -15
- package/dist/esm-node/commands/serve.js +0 -51
- package/dist/esm-node/config/default.js +0 -197
- package/dist/esm-node/config/index.js +0 -3
- package/dist/esm-node/config/initialize/index.js +0 -9
- package/dist/esm-node/config/initialize/inits.js +0 -79
- package/dist/esm-node/config/legacy/createHtmlConfig.js +0 -21
- package/dist/esm-node/config/legacy/createOutputConfig.js +0 -45
- package/dist/esm-node/config/legacy/createSourceConfig.js +0 -29
- package/dist/esm-node/config/legacy/createToolsConfig.js +0 -28
- package/dist/esm-node/config/legacy/index.js +0 -43
- package/dist/esm-node/defineConfig.js +0 -13
- package/dist/esm-node/exports/server.js +0 -4
- package/dist/esm-node/hooks.js +0 -34
- package/dist/esm-node/index.js +0 -124
- package/dist/esm-node/locale/en.js +0 -43
- package/dist/esm-node/locale/index.js +0 -12
- package/dist/esm-node/locale/zh.js +0 -43
- package/dist/esm-node/plugins/analyze/constants.js +0 -14
- package/dist/esm-node/plugins/analyze/getBundleEntry.js +0 -61
- package/dist/esm-node/plugins/analyze/getFileSystemEntry.js +0 -100
- package/dist/esm-node/plugins/analyze/getHtmlTemplate.js +0 -74
- package/dist/esm-node/plugins/analyze/getServerRoutes.js +0 -132
- package/dist/esm-node/plugins/analyze/index.js +0 -166
- package/dist/esm-node/plugins/analyze/isDefaultExportFunction.js +0 -47
- package/dist/esm-node/plugins/analyze/templates.js +0 -24
- package/dist/esm-node/plugins/analyze/utils.js +0 -68
- package/dist/esm-node/plugins/deploy/dependencies/index.js +0 -201
- package/dist/esm-node/plugins/deploy/dependencies/utils.js +0 -126
- package/dist/esm-node/plugins/deploy/exports.js +0 -4
- package/dist/esm-node/plugins/deploy/index.js +0 -44
- package/dist/esm-node/plugins/deploy/platforms/netlify.js +0 -108
- package/dist/esm-node/plugins/deploy/platforms/netlifyEntry.js +0 -69
- package/dist/esm-node/plugins/deploy/platforms/node.js +0 -63
- package/dist/esm-node/plugins/deploy/platforms/nodeEntry.js +0 -44
- package/dist/esm-node/plugins/deploy/platforms/platform.js +0 -0
- package/dist/esm-node/plugins/deploy/platforms/vercel.js +0 -120
- package/dist/esm-node/plugins/deploy/platforms/vercelEntry.js +0 -69
- package/dist/esm-node/plugins/deploy/utils.js +0 -44
- package/dist/esm-node/plugins/initialize/index.js +0 -84
- package/dist/esm-node/plugins/serverBuild.js +0 -58
- package/dist/esm-node/types/config/deploy.js +0 -0
- package/dist/esm-node/types/config/dev.js +0 -0
- package/dist/esm-node/types/config/experiments.js +0 -0
- package/dist/esm-node/types/config/html.js +0 -0
- package/dist/esm-node/types/config/index.js +0 -1
- package/dist/esm-node/types/config/output.js +0 -0
- package/dist/esm-node/types/config/performance.js +0 -0
- package/dist/esm-node/types/config/security.js +0 -0
- package/dist/esm-node/types/config/source.js +0 -0
- package/dist/esm-node/types/config/testing.js +0 -0
- package/dist/esm-node/types/config/tools.js +0 -0
- package/dist/esm-node/types/hooks.js +0 -0
- package/dist/esm-node/types/index.js +0 -3
- package/dist/esm-node/types/legacyConfig/deploy.js +0 -0
- package/dist/esm-node/types/legacyConfig/dev.js +0 -0
- package/dist/esm-node/types/legacyConfig/index.js +0 -0
- package/dist/esm-node/types/legacyConfig/output.js +0 -0
- package/dist/esm-node/types/legacyConfig/source.js +0 -0
- package/dist/esm-node/types/legacyConfig/testing.js +0 -0
- package/dist/esm-node/types/legacyConfig/tools.js +0 -0
- package/dist/esm-node/types/utils.js +0 -0
- package/dist/esm-node/utils/config.js +0 -49
- package/dist/esm-node/utils/createServer.js +0 -26
- package/dist/esm-node/utils/env.js +0 -16
- package/dist/esm-node/utils/generateWatchFiles.js +0 -30
- package/dist/esm-node/utils/getSelectedEntries.js +0 -34
- package/dist/esm-node/utils/loadPlugins.js +0 -22
- package/dist/esm-node/utils/printInstructions.js +0 -11
- package/dist/esm-node/utils/register.js +0 -69
- package/dist/esm-node/utils/restart.js +0 -22
- package/dist/esm-node/utils/routes.js +0 -21
- package/dist/esm-node/utils/types.js +0 -0
- package/dist/types/plugins/deploy/platforms/netlifyEntry.d.ts +0 -2
- package/dist/types/plugins/deploy/platforms/vercelEntry.d.ts +0 -2
- /package/dist/cjs/plugins/deploy/platforms/{nodeEntry.js → node-entry.js} +0 -0
- /package/dist/types/plugins/deploy/platforms/{nodeEntry.d.ts → node-entry.d.ts} +0 -0
|
@@ -33,12 +33,12 @@ __export(analyze_exports, {
|
|
|
33
33
|
module.exports = __toCommonJS(analyze_exports);
|
|
34
34
|
var path = __toESM(require("path"));
|
|
35
35
|
var import_utils = require("@modern-js/utils");
|
|
36
|
+
var import_builder = require("../../builder");
|
|
37
|
+
var import_config = require("../../config");
|
|
38
|
+
var import_config2 = require("../../utils/config");
|
|
39
|
+
var import_getSelectedEntries = require("../../utils/getSelectedEntries");
|
|
36
40
|
var import_printInstructions = require("../../utils/printInstructions");
|
|
37
41
|
var import_routes = require("../../utils/routes");
|
|
38
|
-
var import_config = require("../../utils/config");
|
|
39
|
-
var import_getSelectedEntries = require("../../utils/getSelectedEntries");
|
|
40
|
-
var import_config2 = require("../../config");
|
|
41
|
-
var import_builder = require("../../builder");
|
|
42
42
|
var import_utils2 = require("./utils");
|
|
43
43
|
const debug = (0, import_utils.createDebugger)("plugin-analyze");
|
|
44
44
|
var analyze_default = ({ bundler }) => ({
|
|
@@ -77,9 +77,9 @@ var analyze_default = ({ bundler }) => ({
|
|
|
77
77
|
return;
|
|
78
78
|
}
|
|
79
79
|
const [{ getBundleEntry }, { getServerRoutes }, { getHtmlTemplate }] = await Promise.all([
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
80
|
+
import("./getBundleEntry.js"),
|
|
81
|
+
import("./getServerRoutes.js"),
|
|
82
|
+
import("./getHtmlTemplate.js")
|
|
83
83
|
]);
|
|
84
84
|
const { entrypoints } = await hookRunners.modifyEntrypoints({
|
|
85
85
|
entrypoints: await getBundleEntry(hookRunners, appContext, resolvedConfig)
|
|
@@ -147,7 +147,7 @@ var analyze_default = ({ bundler }) => ({
|
|
|
147
147
|
await hookRunners2.afterBuild({
|
|
148
148
|
stats
|
|
149
149
|
});
|
|
150
|
-
await (0,
|
|
150
|
+
await (0, import_config2.emitResolvedConfig)(appContext.appDirectory, normalizedConfig);
|
|
151
151
|
});
|
|
152
152
|
builder.onDevCompileDone(async ({ isFirstCompile }) => {
|
|
153
153
|
const hookRunners2 = api.useHookRunners();
|
|
@@ -186,7 +186,7 @@ var analyze_default = ({ bundler }) => ({
|
|
|
186
186
|
},
|
|
187
187
|
resolvedConfig({ resolved }) {
|
|
188
188
|
const appContext = api.useAppContext();
|
|
189
|
-
const config = (0,
|
|
189
|
+
const config = (0, import_config.initialNormalizedConfig)(resolved, appContext, bundler);
|
|
190
190
|
return {
|
|
191
191
|
resolved: config
|
|
192
192
|
};
|
|
@@ -39,8 +39,8 @@ module.exports = __toCommonJS(utils_exports);
|
|
|
39
39
|
var import_fs = __toESM(require("fs"));
|
|
40
40
|
var import_path = __toESM(require("path"));
|
|
41
41
|
var import_utils = require("@modern-js/utils");
|
|
42
|
-
var import_esbuild = require("esbuild");
|
|
43
42
|
var import_es_module_lexer = require("es-module-lexer");
|
|
43
|
+
var import_esbuild = require("esbuild");
|
|
44
44
|
const walkDirectory = (dir) => import_fs.default.readdirSync(dir).reduce((previous, filename) => {
|
|
45
45
|
const filePath = import_path.default.join(dir, filename);
|
|
46
46
|
if (import_fs.default.statSync(filePath).isDirectory()) {
|
|
@@ -34,8 +34,8 @@ __export(dependencies_exports, {
|
|
|
34
34
|
module.exports = __toCommonJS(dependencies_exports);
|
|
35
35
|
var import_node_path = __toESM(require("node:path"));
|
|
36
36
|
var import_utils = require("@modern-js/utils");
|
|
37
|
-
var import_pkg_types = require("pkg-types");
|
|
38
37
|
var import_mlly = require("mlly");
|
|
38
|
+
var import_pkg_types = require("pkg-types");
|
|
39
39
|
var import_utils2 = require("./utils");
|
|
40
40
|
var import_nft = require("@vercel/nft");
|
|
41
41
|
const handleDependencies = async ({ appDir, serverRootDir, includeEntries, traceFiles = import_utils2.traceFiles, entryFilter, modifyPackageJson, copyWholePackage, traceOptions }) => {
|
|
@@ -219,6 +219,7 @@ const handleDependencies = async ({ appDir, serverRootDir, includeEntries, trace
|
|
|
219
219
|
name: `${projectPkgJson.name || "modernjs-project"}-prod`,
|
|
220
220
|
version: projectPkgJson.version || "0.0.0",
|
|
221
221
|
private: true,
|
|
222
|
+
type: projectPkgJson.type || "commonjs",
|
|
222
223
|
dependencies: Object.fromEntries([
|
|
223
224
|
...Object.values(tracedPackages).map((pkg) => [
|
|
224
225
|
pkg.name,
|
|
@@ -39,11 +39,11 @@ __export(utils_exports, {
|
|
|
39
39
|
writePackage: () => writePackage
|
|
40
40
|
});
|
|
41
41
|
module.exports = __toCommonJS(utils_exports);
|
|
42
|
-
var import_path = __toESM(require("path"));
|
|
43
42
|
var import_node_os = __toESM(require("node:os"));
|
|
43
|
+
var import_path = __toESM(require("path"));
|
|
44
44
|
var import_utils = require("@modern-js/utils");
|
|
45
|
-
var import_mlly = require("mlly");
|
|
46
45
|
var import_nft = require("@vercel/nft");
|
|
46
|
+
var import_mlly = require("mlly");
|
|
47
47
|
function applyPublicCondition(pkg) {
|
|
48
48
|
var _pkg_publishConfig;
|
|
49
49
|
if (pkg === null || pkg === void 0 ? void 0 : (_pkg_publishConfig = pkg.publishConfig) === null || _pkg_publishConfig === void 0 ? void 0 : _pkg_publishConfig.exports) {
|
|
@@ -143,6 +143,17 @@ const traceFiles = async ({ entryFiles, serverRootDir, base = "/", traceOptions
|
|
|
143
143
|
return await (0, import_nft.nodeFileTrace)(entryFiles, {
|
|
144
144
|
base,
|
|
145
145
|
processCwd: serverRootDir,
|
|
146
|
+
resolve: async (id, parent, job, isCjs) => {
|
|
147
|
+
if (id.startsWith("@modern-js/prod-server")) {
|
|
148
|
+
return require.resolve(id, {
|
|
149
|
+
paths: [
|
|
150
|
+
require.resolve("@modern-js/app-tools")
|
|
151
|
+
]
|
|
152
|
+
});
|
|
153
|
+
} else {
|
|
154
|
+
return (0, import_nft.resolve)(id, parent, job, isCjs);
|
|
155
|
+
}
|
|
156
|
+
},
|
|
146
157
|
...traceOptions
|
|
147
158
|
});
|
|
148
159
|
};
|
|
@@ -22,10 +22,10 @@ __export(deploy_exports, {
|
|
|
22
22
|
});
|
|
23
23
|
module.exports = __toCommonJS(deploy_exports);
|
|
24
24
|
var import_std_env = require("std-env");
|
|
25
|
-
var
|
|
25
|
+
var import_netlify = require("./platforms/netlify");
|
|
26
26
|
var import_node = require("./platforms/node");
|
|
27
27
|
var import_vercel = require("./platforms/vercel");
|
|
28
|
-
var
|
|
28
|
+
var import_utils = require("./utils");
|
|
29
29
|
const deployPresets = {
|
|
30
30
|
node: import_node.createNodePreset,
|
|
31
31
|
vercel: import_vercel.createVercelPreset,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { handler as default } from './netlify-handler.cjs';
|
|
@@ -53,9 +53,11 @@ async function createHandler() {
|
|
|
53
53
|
return requestHandler;
|
|
54
54
|
}
|
|
55
55
|
createHandler();
|
|
56
|
-
module.exports
|
|
57
|
-
|
|
58
|
-
|
|
56
|
+
module.exports = {
|
|
57
|
+
handler: async (request, context) => {
|
|
58
|
+
if (!requestHandler) {
|
|
59
|
+
await createHandler();
|
|
60
|
+
}
|
|
61
|
+
return requestHandler(request, context);
|
|
59
62
|
}
|
|
60
|
-
return requestHandler(request, context);
|
|
61
63
|
};
|
|
@@ -34,8 +34,8 @@ module.exports = __toCommonJS(netlify_exports);
|
|
|
34
34
|
var import_node_path = __toESM(require("node:path"));
|
|
35
35
|
var import_utils = require("@modern-js/utils");
|
|
36
36
|
var import_routes = require("../../../utils/routes");
|
|
37
|
-
var import_utils2 = require("../utils");
|
|
38
37
|
var import_dependencies = require("../dependencies");
|
|
38
|
+
var import_utils2 = require("../utils");
|
|
39
39
|
async function cleanDistDirectory(dir) {
|
|
40
40
|
try {
|
|
41
41
|
const items = await import_utils.fs.readdir(dir);
|
|
@@ -50,11 +50,13 @@ async function cleanDistDirectory(dir) {
|
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
52
|
const createNetlifyPreset = (appContext, modernConfig, needModernServer) => {
|
|
53
|
-
const { appDirectory, distDirectory, entrypoints, serverPlugins } = appContext;
|
|
53
|
+
const { appDirectory, distDirectory, entrypoints, serverPlugins, moduleType } = appContext;
|
|
54
|
+
const isEsmProject = moduleType === "module";
|
|
54
55
|
const plugins = serverPlugins.map((plugin) => plugin.name);
|
|
55
56
|
const netlifyOutput = import_node_path.default.join(appDirectory, ".netlify");
|
|
56
57
|
const funcsDirectory = import_node_path.default.join(netlifyOutput, "functions");
|
|
57
58
|
const entryFilePath = import_node_path.default.join(funcsDirectory, "index.js");
|
|
59
|
+
const handlerFilePath = import_node_path.default.join(funcsDirectory, "netlify-handler.cjs");
|
|
58
60
|
return {
|
|
59
61
|
async prepare() {
|
|
60
62
|
await import_utils.fs.remove(netlifyOutput);
|
|
@@ -103,7 +105,9 @@ const createNetlifyPreset = (appContext, modernConfig, needModernServer) => {
|
|
|
103
105
|
prefix: modernConfig === null || modernConfig === void 0 ? void 0 : (_modernConfig_bff = modernConfig.bff) === null || _modernConfig_bff === void 0 ? void 0 : _modernConfig_bff.prefix
|
|
104
106
|
},
|
|
105
107
|
output: {
|
|
106
|
-
|
|
108
|
+
distPath: {
|
|
109
|
+
root: "."
|
|
110
|
+
}
|
|
107
111
|
}
|
|
108
112
|
};
|
|
109
113
|
const pluginImportCode = (0, import_utils2.genPluginImportsCode)(plugins || []);
|
|
@@ -114,10 +118,15 @@ const createNetlifyPreset = (appContext, modernConfig, needModernServer) => {
|
|
|
114
118
|
const pluginsCode = `[${plugins.map((plugin, index) => {
|
|
115
119
|
return `plugin_${index}()`;
|
|
116
120
|
}).join(",")}]`;
|
|
117
|
-
let
|
|
121
|
+
let handlerCode = (await import_utils.fs.readFile(import_node_path.default.join(__dirname, "./netlify-handler.js"))).toString();
|
|
118
122
|
const serverAppContext = (0, import_utils2.serverAppContenxtTemplate)(appContext);
|
|
119
|
-
|
|
120
|
-
await import_utils.fs.writeFile(
|
|
123
|
+
handlerCode = handlerCode.replace("p_genPluginImportsCode", pluginImportCode).replace("p_ROUTE_SPEC_FILE", `"${import_utils.ROUTE_SPEC_FILE}"`).replace("p_dynamicProdOptions", JSON.stringify(dynamicProdOptions)).replace("p_plugins", pluginsCode).replace("p_sharedDirectory", serverAppContext.sharedDirectory).replace("p_apiDirectory", serverAppContext.apiDirectory).replace("p_lambdaDirectory", serverAppContext.lambdaDirectory);
|
|
124
|
+
await import_utils.fs.writeFile(handlerFilePath, handlerCode);
|
|
125
|
+
if (isEsmProject) {
|
|
126
|
+
await import_utils.fs.copy(import_node_path.default.join(__dirname, "./netlify-entry.mjs"), entryFilePath);
|
|
127
|
+
} else {
|
|
128
|
+
await import_utils.fs.copy(import_node_path.default.join(__dirname, "./netlify-entry.js"), entryFilePath);
|
|
129
|
+
}
|
|
121
130
|
},
|
|
122
131
|
async end() {
|
|
123
132
|
if (process.env.NODE_ENV !== "development") {
|
|
@@ -33,10 +33,11 @@ __export(node_exports, {
|
|
|
33
33
|
module.exports = __toCommonJS(node_exports);
|
|
34
34
|
var import_node_path = __toESM(require("node:path"));
|
|
35
35
|
var import_utils = require("@modern-js/utils");
|
|
36
|
-
var import_utils2 = require("../utils");
|
|
37
36
|
var import_dependencies = require("../dependencies");
|
|
37
|
+
var import_utils2 = require("../utils");
|
|
38
38
|
const createNodePreset = (appContext, config) => {
|
|
39
|
-
const { appDirectory, distDirectory, serverPlugins } = appContext;
|
|
39
|
+
const { appDirectory, distDirectory, serverPlugins, moduleType } = appContext;
|
|
40
|
+
const isEsmProject = moduleType === "module";
|
|
40
41
|
const plugins = serverPlugins.map((plugin) => plugin.name);
|
|
41
42
|
const outputDirectory = import_node_path.default.join(appDirectory, ".output");
|
|
42
43
|
const staticDirectory = import_node_path.default.join(outputDirectory, "static");
|
|
@@ -58,7 +59,9 @@ const createNodePreset = (appContext, config) => {
|
|
|
58
59
|
prefix: config === null || config === void 0 ? void 0 : (_config_bff = config.bff) === null || _config_bff === void 0 ? void 0 : _config_bff.prefix
|
|
59
60
|
},
|
|
60
61
|
output: {
|
|
61
|
-
|
|
62
|
+
distPath: {
|
|
63
|
+
root: "."
|
|
64
|
+
}
|
|
62
65
|
}
|
|
63
66
|
};
|
|
64
67
|
const pluginImportCode = (0, import_utils2.genPluginImportsCode)(plugins || []);
|
|
@@ -69,10 +72,16 @@ const createNodePreset = (appContext, config) => {
|
|
|
69
72
|
const pluginsCode = `[${plugins.map((plugin, index) => {
|
|
70
73
|
return `plugin_${index}()`;
|
|
71
74
|
}).join(",")}]`;
|
|
72
|
-
let entryCode = (await import_utils.fs.readFile(import_node_path.default.join(__dirname, "./
|
|
75
|
+
let entryCode = (await import_utils.fs.readFile(import_node_path.default.join(__dirname, "./node-entry.js"))).toString();
|
|
73
76
|
const serverAppContext = (0, import_utils2.serverAppContenxtTemplate)(appContext);
|
|
74
77
|
entryCode = entryCode.replace("p_genPluginImportsCode", pluginImportCode).replace("p_ROUTE_SPEC_FILE", `"${import_utils.ROUTE_SPEC_FILE}"`).replace("p_dynamicProdOptions", JSON.stringify(dynamicProdOptions)).replace("p_plugins", pluginsCode).replace("p_sharedDirectory", serverAppContext.sharedDirectory).replace("p_apiDirectory", serverAppContext.apiDirectory).replace("p_lambdaDirectory", serverAppContext.lambdaDirectory);
|
|
75
|
-
|
|
78
|
+
if (isEsmProject) {
|
|
79
|
+
const cjsEntryFilePath = import_node_path.default.join(outputDirectory, "index.cjs");
|
|
80
|
+
await import_utils.fs.writeFile(cjsEntryFilePath, entryCode);
|
|
81
|
+
await import_utils.fs.writeFile(entryFilePath, `import('./index.cjs');`);
|
|
82
|
+
} else {
|
|
83
|
+
await import_utils.fs.writeFile(entryFilePath, entryCode);
|
|
84
|
+
}
|
|
76
85
|
},
|
|
77
86
|
async end() {
|
|
78
87
|
console.log("Static directory:", import_utils.chalk.blue(import_node_path.default.relative(appDirectory, staticDirectory)));
|
|
@@ -53,9 +53,12 @@ async function createHandler() {
|
|
|
53
53
|
return requestHandler;
|
|
54
54
|
}
|
|
55
55
|
createHandler();
|
|
56
|
-
|
|
56
|
+
const handler = async (req, res) => {
|
|
57
57
|
if (!requestHandler) {
|
|
58
58
|
await createHandler();
|
|
59
59
|
}
|
|
60
60
|
return requestHandler(req, res);
|
|
61
61
|
};
|
|
62
|
+
module.exports = {
|
|
63
|
+
handler
|
|
64
|
+
};
|
|
@@ -34,15 +34,17 @@ module.exports = __toCommonJS(vercel_exports);
|
|
|
34
34
|
var import_node_path = __toESM(require("node:path"));
|
|
35
35
|
var import_utils = require("@modern-js/utils");
|
|
36
36
|
var import_routes = require("../../../utils/routes");
|
|
37
|
-
var import_utils2 = require("../utils");
|
|
38
37
|
var import_dependencies = require("../dependencies");
|
|
38
|
+
var import_utils2 = require("../utils");
|
|
39
39
|
const createVercelPreset = (appContext, modernConfig, needModernServer) => {
|
|
40
|
-
const { appDirectory, distDirectory, entrypoints, serverPlugins } = appContext;
|
|
40
|
+
const { appDirectory, distDirectory, entrypoints, serverPlugins, moduleType } = appContext;
|
|
41
|
+
const isEsmProject = moduleType === "module";
|
|
41
42
|
const plugins = serverPlugins.map((plugin) => plugin.name);
|
|
42
43
|
const vercelOutput = import_node_path.default.join(appDirectory, ".vercel");
|
|
43
44
|
const outputDirectory = import_node_path.default.join(vercelOutput, "output");
|
|
44
45
|
const funcsDirectory = import_node_path.default.join(outputDirectory, "functions", "index.func");
|
|
45
46
|
const entryFilePath = import_node_path.default.join(funcsDirectory, "index.js");
|
|
47
|
+
const handlerFilePath = import_node_path.default.join(funcsDirectory, "vercel-handler.cjs");
|
|
46
48
|
return {
|
|
47
49
|
async prepare() {
|
|
48
50
|
await import_utils.fs.remove(vercelOutput);
|
|
@@ -118,7 +120,9 @@ const createVercelPreset = (appContext, modernConfig, needModernServer) => {
|
|
|
118
120
|
prefix: modernConfig === null || modernConfig === void 0 ? void 0 : (_modernConfig_bff = modernConfig.bff) === null || _modernConfig_bff === void 0 ? void 0 : _modernConfig_bff.prefix
|
|
119
121
|
},
|
|
120
122
|
output: {
|
|
121
|
-
|
|
123
|
+
distPath: {
|
|
124
|
+
root: "."
|
|
125
|
+
}
|
|
122
126
|
}
|
|
123
127
|
};
|
|
124
128
|
const pluginImportCode = (0, import_utils2.genPluginImportsCode)(plugins || []);
|
|
@@ -130,9 +134,14 @@ const createVercelPreset = (appContext, modernConfig, needModernServer) => {
|
|
|
130
134
|
return `plugin_${index}()`;
|
|
131
135
|
}).join(",")}]`;
|
|
132
136
|
const serverAppContext = (0, import_utils2.serverAppContenxtTemplate)(appContext);
|
|
133
|
-
let
|
|
134
|
-
|
|
135
|
-
await import_utils.fs.writeFile(
|
|
137
|
+
let handlerCode = (await import_utils.fs.readFile(import_node_path.default.join(__dirname, "./vercel-handler.js"))).toString();
|
|
138
|
+
handlerCode = handlerCode.replace("p_genPluginImportsCode", pluginImportCode).replace("p_ROUTE_SPEC_FILE", `"${import_utils.ROUTE_SPEC_FILE}"`).replace("p_dynamicProdOptions", JSON.stringify(dynamicProdOptions)).replace("p_plugins", pluginsCode).replace("p_sharedDirectory", serverAppContext.sharedDirectory).replace("p_apiDirectory", serverAppContext.apiDirectory).replace("p_lambdaDirectory", serverAppContext.lambdaDirectory);
|
|
139
|
+
await import_utils.fs.writeFile(handlerFilePath, handlerCode);
|
|
140
|
+
if (isEsmProject) {
|
|
141
|
+
await import_utils.fs.copy(import_node_path.default.join(__dirname, "./vercel-entry.mjs"), entryFilePath);
|
|
142
|
+
} else {
|
|
143
|
+
await import_utils.fs.copy(import_node_path.default.join(__dirname, "./vercel-entry.js"), entryFilePath);
|
|
144
|
+
}
|
|
136
145
|
},
|
|
137
146
|
async end() {
|
|
138
147
|
if (!needModernServer) {
|
|
@@ -31,10 +31,10 @@ __export(serverBuild_exports, {
|
|
|
31
31
|
default: () => serverBuild_default
|
|
32
32
|
});
|
|
33
33
|
module.exports = __toCommonJS(serverBuild_exports);
|
|
34
|
-
var import_path = __toESM(require("path"));
|
|
35
34
|
var import_fs = __toESM(require("fs"));
|
|
36
|
-
var
|
|
35
|
+
var import_path = __toESM(require("path"));
|
|
37
36
|
var import_server_utils = require("@modern-js/server-utils");
|
|
37
|
+
var import_utils = require("@modern-js/utils");
|
|
38
38
|
const TS_CONFIG_FILENAME = "tsconfig.json";
|
|
39
39
|
function checkHasCache(appDir) {
|
|
40
40
|
const tsFilepath = import_path.default.resolve(appDir, import_utils.SERVER_DIR, "cache.ts");
|
package/dist/cjs/utils/config.js
CHANGED
|
@@ -40,7 +40,7 @@ var import_flatted = require("flatted");
|
|
|
40
40
|
const defineServerConfig = (config) => config;
|
|
41
41
|
const buildServerConfig = async ({ appDirectory, distDirectory, configFile, options, watch }) => {
|
|
42
42
|
const configFilePath = await (0, import_utils.getServerConfig)(appDirectory, configFile);
|
|
43
|
-
const getOutputFile = async (filepath) => path.resolve(distDirectory, `${filepath.replace(new RegExp(import_utils.CONFIG_FILE_EXTENSIONS.join("|")), "")}.
|
|
43
|
+
const getOutputFile = async (filepath) => path.resolve(distDirectory, `${filepath.replace(new RegExp(import_utils.CONFIG_FILE_EXTENSIONS.join("|")), "")}.cjs`);
|
|
44
44
|
if (configFilePath) {
|
|
45
45
|
const configHelperFilePath = path.normalize(path.join(distDirectory, "./config-helper.js"));
|
|
46
46
|
const helperCode = `
|
|
@@ -24,8 +24,8 @@ __export(createServer_exports, {
|
|
|
24
24
|
setServer: () => setServer
|
|
25
25
|
});
|
|
26
26
|
module.exports = __toCommonJS(createServer_exports);
|
|
27
|
-
var import_server = require("@modern-js/server");
|
|
28
27
|
var import_prod_server = require("@modern-js/prod-server");
|
|
28
|
+
var import_server = require("@modern-js/server");
|
|
29
29
|
let server = null;
|
|
30
30
|
const getServer = () => server;
|
|
31
31
|
const setServer = (newServer) => {
|
|
@@ -37,7 +37,7 @@ async function getServerPlugins(api, metaName = "modern-js") {
|
|
|
37
37
|
}
|
|
38
38
|
async function loadServerPlugins(api, appDirectory, metaName) {
|
|
39
39
|
const plugins = await getServerPlugins(api, metaName);
|
|
40
|
-
const instances = (0, import_prod_server.loadServerPlugins)(plugins, appDirectory);
|
|
40
|
+
const instances = await (0, import_prod_server.loadServerPlugins)(plugins, appDirectory);
|
|
41
41
|
return instances;
|
|
42
42
|
}
|
|
43
43
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -33,7 +33,15 @@ __export(register_exports, {
|
|
|
33
33
|
module.exports = __toCommonJS(register_exports);
|
|
34
34
|
var import_node_path = __toESM(require("node:path"));
|
|
35
35
|
var import_utils = require("@modern-js/utils");
|
|
36
|
-
const
|
|
36
|
+
const registerEsbuild = async ({ isTsProject, tsConfig, distDir }) => {
|
|
37
|
+
const esbuildRegister = await import("esbuild-register/dist/node");
|
|
38
|
+
esbuildRegister.register({
|
|
39
|
+
tsconfigRaw: isTsProject ? tsConfig : void 0,
|
|
40
|
+
hookIgnoreNodeModules: true,
|
|
41
|
+
hookMatcher: (fileName) => !fileName.startsWith(distDir)
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
const registerCompiler = async (appDir, distDir, alias) => {
|
|
37
45
|
const TS_CONFIG_FILENAME = `tsconfig.json`;
|
|
38
46
|
const tsconfigPath = import_node_path.default.resolve(appDir, TS_CONFIG_FILENAME);
|
|
39
47
|
const isTsProject = await import_utils.fs.pathExists(tsconfigPath);
|
|
@@ -44,6 +52,17 @@ const registerCompiler = async (appDir = process.cwd(), distDir, alias) => {
|
|
|
44
52
|
const { paths = {}, absoluteBaseUrl = "./" } = aliasConfig;
|
|
45
53
|
const tsPaths = Object.keys(paths).reduce((o, key) => {
|
|
46
54
|
let tsPath = paths[key];
|
|
55
|
+
if (typeof tsPath === "string" && key.startsWith("@") && tsPath.startsWith("@")) {
|
|
56
|
+
try {
|
|
57
|
+
tsPath = require.resolve(tsPath, {
|
|
58
|
+
paths: [
|
|
59
|
+
process.cwd(),
|
|
60
|
+
...module.paths
|
|
61
|
+
]
|
|
62
|
+
});
|
|
63
|
+
} catch {
|
|
64
|
+
}
|
|
65
|
+
}
|
|
47
66
|
if (typeof tsPath === "string" && import_node_path.default.isAbsolute(tsPath)) {
|
|
48
67
|
tsPath = import_node_path.default.relative(absoluteBaseUrl, tsPath);
|
|
49
68
|
}
|
|
@@ -61,32 +80,40 @@ const registerCompiler = async (appDir = process.cwd(), distDir, alias) => {
|
|
|
61
80
|
if (isTsProject) {
|
|
62
81
|
tsConfig = (0, import_utils.readTsConfigByFile)(tsconfigPath);
|
|
63
82
|
}
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
83
|
+
const { MODERN_NODE_LOADER } = process.env;
|
|
84
|
+
if (MODERN_NODE_LOADER !== "esbuild") {
|
|
85
|
+
try {
|
|
86
|
+
const tsNode = await import("ts-node");
|
|
87
|
+
const tsNodeOptions = tsConfig["ts-node"];
|
|
88
|
+
if (isTsProject) {
|
|
89
|
+
tsNode.register({
|
|
90
|
+
project: tsconfigPath,
|
|
91
|
+
scope: true,
|
|
92
|
+
// for env.d.ts, https://www.npmjs.com/package/ts-node#missing-types
|
|
93
|
+
files: true,
|
|
94
|
+
transpileOnly: true,
|
|
95
|
+
ignore: [
|
|
96
|
+
"(?:^|/)node_modules/",
|
|
97
|
+
`(?:^|/)${import_node_path.default.relative(appDir, distDir)}/`
|
|
98
|
+
],
|
|
99
|
+
...tsNodeOptions
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
} catch (error) {
|
|
103
|
+
await registerEsbuild({
|
|
104
|
+
isTsProject,
|
|
105
|
+
tsConfig,
|
|
106
|
+
distDir
|
|
79
107
|
});
|
|
80
108
|
}
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
hookMatcher: (fileName) => !fileName.startsWith(distDir)
|
|
109
|
+
} else {
|
|
110
|
+
await registerEsbuild({
|
|
111
|
+
isTsProject,
|
|
112
|
+
tsConfig,
|
|
113
|
+
distDir
|
|
87
114
|
});
|
|
88
115
|
}
|
|
89
|
-
const tsConfigPaths = await
|
|
116
|
+
const tsConfigPaths = (await import("@modern-js/utils/tsconfig-paths")).default;
|
|
90
117
|
if (await import_utils.fs.pathExists(appDir)) {
|
|
91
118
|
const loaderRes = tsConfigPaths.loadConfig(appDir);
|
|
92
119
|
if (loaderRes.resultType === "success") {
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { RsbuildPlugin } from '@modern-js/uni-builder';
|
|
2
|
-
import { BuilderOptions } from '../shared';
|
|
1
|
+
import type { RsbuildPlugin } from '@modern-js/uni-builder';
|
|
2
|
+
import { type BuilderOptions } from '../shared';
|
|
3
3
|
export declare const builderPluginAdpaterCopy: (options: BuilderOptions<'rspack'>) => RsbuildPlugin;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { BuilderOptions } from '../shared';
|
|
1
|
+
import type { BuilderOptions } from '../shared';
|
|
2
2
|
export declare function createRspackBuilderForModern(options: BuilderOptions<'rspack'>): Promise<import("@modern-js/uni-builder").UniBuilderInstance>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { RsbuildPlugin } from '@modern-js/uni-builder';
|
|
2
|
-
import { BuilderOptions } from '../shared';
|
|
1
|
+
import type { RsbuildPlugin } from '@modern-js/uni-builder';
|
|
2
|
+
import type { BuilderOptions } from '../shared';
|
|
3
3
|
/**
|
|
4
4
|
* Provides default configuration consistent with modern.js v1
|
|
5
5
|
*/
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { BuilderOptions } from '../shared';
|
|
1
|
+
import type { BuilderOptions } from '../shared';
|
|
2
2
|
export declare function createWebpackBuilderForModern(options: BuilderOptions<'webpack'>): Promise<import("@modern-js/uni-builder").UniBuilderInstance>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { Bundler, IAppContext
|
|
1
|
+
import type { AppNormalizedConfig, Bundler, IAppContext } from '../../types';
|
|
2
2
|
export declare function createBuilderProviderConfig<B extends Bundler>(resolveConfig: AppNormalizedConfig<B>, appContext: IAppContext): Omit<AppNormalizedConfig<B>, 'plugins'>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { type BundlerType, type UniBuilderInstance } from '@modern-js/uni-builder';
|
|
2
|
+
import type { Bundler } from '../../types';
|
|
3
|
+
import type { BuilderOptions } from '../shared';
|
|
4
4
|
/**
|
|
5
5
|
* @param options BuilderOptions
|
|
6
6
|
* @param bundlerType BundlerType
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function createBuilderGenerator(bundler: 'webpack' | 'rspack'): Promise<typeof import("./builder-rspack").createRspackBuilderForModern>;
|
|
1
|
+
export declare function createBuilderGenerator(bundler: 'webpack' | 'rspack'): Promise<typeof import("./builder-rspack/index.js").createRspackBuilderForModern>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { RsbuildPlugin } from '@rsbuild/core';
|
|
2
|
-
import { Bundler } from '../../../types';
|
|
2
|
+
import type { Bundler } from '../../../types';
|
|
3
3
|
import type { BuilderOptions } from '../types';
|
|
4
4
|
export declare const builderPluginAdapterHtml: <B extends Bundler>(options: BuilderOptions<B>) => RsbuildPlugin;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { RsbuildPlugin } from '@rsbuild/core';
|
|
1
|
+
import { type RsbuildPlugin } from '@rsbuild/core';
|
|
2
2
|
import type { Bundler } from '../../../types';
|
|
3
3
|
import type { BuilderOptions } from '../types';
|
|
4
4
|
export declare const builderPluginAdapterSSR: <B extends Bundler>(options: BuilderOptions<B>) => RsbuildPlugin;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Rspack, webpack
|
|
1
|
+
import type { HtmlWebpackPlugin, Rspack, webpack } from '@modern-js/uni-builder';
|
|
2
2
|
export declare class HtmlAsyncChunkPlugin {
|
|
3
3
|
name: string;
|
|
4
4
|
htmlWebpackPlugin: typeof HtmlWebpackPlugin;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Rspack, webpack
|
|
1
|
+
import type { HtmlWebpackPlugin, Rspack, webpack } from '@modern-js/uni-builder';
|
|
2
2
|
export declare class BottomTemplatePlugin {
|
|
3
3
|
htmlWebpackPlugin: typeof HtmlWebpackPlugin;
|
|
4
4
|
bottomTemplateReg: RegExp;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Rspack, webpack
|
|
1
|
+
import type { HtmlWebpackPlugin, Rspack, webpack } from '@modern-js/uni-builder';
|
|
2
2
|
import type { ScriptLoading } from '@rsbuild/core';
|
|
3
3
|
export interface RouteAssets {
|
|
4
4
|
[routeId: string]: {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AppNormalizedConfig, IAppContext } from '../../types';
|
|
1
|
+
import type { AppNormalizedConfig, IAppContext } from '../../types';
|
|
2
2
|
export declare function createCopyInfo(appContext: IAppContext, config: AppNormalizedConfig<'shared'>): {
|
|
3
3
|
configDir: string;
|
|
4
4
|
uploadDir: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { AppNormalizedConfig, Bundler, IAppContext } from '../../types';
|
|
2
2
|
export type BuilderOptions<B extends Bundler> = {
|
|
3
3
|
normalizedConfig: AppNormalizedConfig<B>;
|
|
4
4
|
appContext: IAppContext;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PluginAPI } from '@modern-js/core';
|
|
2
|
-
import type { BuildOptions } from '../utils/types';
|
|
1
|
+
import { type PluginAPI } from '@modern-js/core';
|
|
3
2
|
import type { AppTools } from '../types';
|
|
3
|
+
import type { BuildOptions } from '../utils/types';
|
|
4
4
|
export declare const build: (api: PluginAPI<AppTools<'shared'>>, options?: BuildOptions) => Promise<void>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { PluginAPI } from '@modern-js/core';
|
|
2
|
-
import { ApplyPlugins } from '@modern-js/server';
|
|
3
|
-
import { DevOptions } from '../utils/types';
|
|
1
|
+
import { type PluginAPI } from '@modern-js/core';
|
|
2
|
+
import { type ApplyPlugins } from '@modern-js/server';
|
|
4
3
|
import type { AppTools } from '../types';
|
|
4
|
+
import type { DevOptions } from '../utils/types';
|
|
5
5
|
export interface ExtraServerOptions {
|
|
6
6
|
applyPlugins?: ApplyPlugins;
|
|
7
7
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { PluginAPI } from '@modern-js/core';
|
|
2
|
-
import { Command } from '@modern-js/utils';
|
|
3
|
-
import { AppTools } from '../types';
|
|
1
|
+
import type { PluginAPI } from '@modern-js/core';
|
|
2
|
+
import { type Command } from '@modern-js/utils';
|
|
3
|
+
import type { AppTools } from '../types';
|
|
4
4
|
export declare const devCommand: (program: Command, api: PluginAPI<AppTools<'shared'>>) => Promise<void>;
|
|
5
5
|
export declare const buildCommand: (program: Command, api: PluginAPI<AppTools<'shared'>>) => Promise<void>;
|
|
6
6
|
export declare const serverCommand: (program: Command, api: PluginAPI<AppTools<'shared'>>) => void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { PluginAPI } from '@modern-js/core';
|
|
2
|
-
import type { InspectOptions } from '../utils/types';
|
|
3
2
|
import type { AppTools } from '../types';
|
|
3
|
+
import type { InspectOptions } from '../utils/types';
|
|
4
4
|
export declare const inspect: (api: PluginAPI<AppTools<'shared'>>, options: InspectOptions) => Promise<import("@rsbuild/core").InspectConfigResult<"rspack">>;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { AppLegacyUserConfig, AppUserConfig, IAppContext } from '../types';
|
|
2
2
|
export declare function createDefaultConfig(appContext: IAppContext): AppUserConfig<'webpack'> | AppUserConfig<'rspack'>;
|
|
3
3
|
export declare function createLegacyDefaultConfig(appContext: IAppContext): AppLegacyUserConfig;
|