@modern-js/app-tools 2.58.1 → 2.58.3
Sign up to get free protection for your applications and to get access to all the features.
- 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
@@ -1,394 +0,0 @@
|
|
1
|
-
import { _ as _async_to_generator } from "@swc/helpers/_/_async_to_generator";
|
2
|
-
import { _ as _object_spread } from "@swc/helpers/_/_object_spread";
|
3
|
-
import { _ as _to_consumable_array } from "@swc/helpers/_/_to_consumable_array";
|
4
|
-
import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator";
|
5
|
-
import path from "path";
|
6
|
-
import os from "node:os";
|
7
|
-
import { fs as fse } from "@modern-js/utils";
|
8
|
-
import { parseNodeModulePath } from "mlly";
|
9
|
-
import { nodeFileTrace } from "@vercel/nft";
|
10
|
-
function applyPublicCondition(pkg) {
|
11
|
-
var _pkg_publishConfig;
|
12
|
-
if (pkg === null || pkg === void 0 ? void 0 : (_pkg_publishConfig = pkg.publishConfig) === null || _pkg_publishConfig === void 0 ? void 0 : _pkg_publishConfig.exports) {
|
13
|
-
var _pkg_publishConfig1;
|
14
|
-
pkg.exports = pkg === null || pkg === void 0 ? void 0 : (_pkg_publishConfig1 = pkg.publishConfig) === null || _pkg_publishConfig1 === void 0 ? void 0 : _pkg_publishConfig1.exports;
|
15
|
-
}
|
16
|
-
}
|
17
|
-
var writePackage = function() {
|
18
|
-
var _ref = _async_to_generator(function(options) {
|
19
|
-
var pkg, version, projectDir, _pkgPath, pkgPath, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, src, subpath, dest, dirname, subpath1, dest1, dirname1, err, pkgJSON, packageJsonPath;
|
20
|
-
return _ts_generator(this, function(_state) {
|
21
|
-
switch (_state.label) {
|
22
|
-
case 0:
|
23
|
-
pkg = options.pkg, version = options.version, projectDir = options.projectDir, _pkgPath = options._pkgPath;
|
24
|
-
pkgPath = _pkgPath || pkg.name;
|
25
|
-
_iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
|
26
|
-
_state.label = 1;
|
27
|
-
case 1:
|
28
|
-
_state.trys.push([
|
29
|
-
1,
|
30
|
-
10,
|
31
|
-
11,
|
32
|
-
12
|
33
|
-
]);
|
34
|
-
_iterator = pkg.versions[version].files[Symbol.iterator]();
|
35
|
-
_state.label = 2;
|
36
|
-
case 2:
|
37
|
-
if (!!(_iteratorNormalCompletion = (_step = _iterator.next()).done))
|
38
|
-
return [
|
39
|
-
3,
|
40
|
-
9
|
41
|
-
];
|
42
|
-
src = _step.value;
|
43
|
-
if (!src.includes("node_modules"))
|
44
|
-
return [
|
45
|
-
3,
|
46
|
-
5
|
47
|
-
];
|
48
|
-
subpath = parseNodeModulePath(src).subpath;
|
49
|
-
dest = path.join(projectDir, "node_modules", pkgPath, subpath);
|
50
|
-
dirname = path.dirname(dest);
|
51
|
-
return [
|
52
|
-
4,
|
53
|
-
fse.ensureDir(dirname)
|
54
|
-
];
|
55
|
-
case 3:
|
56
|
-
_state.sent();
|
57
|
-
return [
|
58
|
-
4,
|
59
|
-
fse.copyFile(src, dest)
|
60
|
-
];
|
61
|
-
case 4:
|
62
|
-
_state.sent();
|
63
|
-
return [
|
64
|
-
3,
|
65
|
-
8
|
66
|
-
];
|
67
|
-
case 5:
|
68
|
-
subpath1 = path.relative(pkg.versions[version].path, src);
|
69
|
-
dest1 = path.join(projectDir, "node_modules", pkgPath, subpath1);
|
70
|
-
dirname1 = path.dirname(dest1);
|
71
|
-
return [
|
72
|
-
4,
|
73
|
-
fse.ensureDir(dirname1)
|
74
|
-
];
|
75
|
-
case 6:
|
76
|
-
_state.sent();
|
77
|
-
return [
|
78
|
-
4,
|
79
|
-
fse.copyFile(src, dest1)
|
80
|
-
];
|
81
|
-
case 7:
|
82
|
-
_state.sent();
|
83
|
-
_state.label = 8;
|
84
|
-
case 8:
|
85
|
-
_iteratorNormalCompletion = true;
|
86
|
-
return [
|
87
|
-
3,
|
88
|
-
2
|
89
|
-
];
|
90
|
-
case 9:
|
91
|
-
return [
|
92
|
-
3,
|
93
|
-
12
|
94
|
-
];
|
95
|
-
case 10:
|
96
|
-
err = _state.sent();
|
97
|
-
_didIteratorError = true;
|
98
|
-
_iteratorError = err;
|
99
|
-
return [
|
100
|
-
3,
|
101
|
-
12
|
102
|
-
];
|
103
|
-
case 11:
|
104
|
-
try {
|
105
|
-
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
106
|
-
_iterator.return();
|
107
|
-
}
|
108
|
-
} finally {
|
109
|
-
if (_didIteratorError) {
|
110
|
-
throw _iteratorError;
|
111
|
-
}
|
112
|
-
}
|
113
|
-
return [
|
114
|
-
7
|
115
|
-
];
|
116
|
-
case 12:
|
117
|
-
pkgJSON = pkg.versions[version].pkgJSON;
|
118
|
-
applyPublicCondition(pkgJSON);
|
119
|
-
packageJsonPath = path.join(projectDir, "node_modules", pkgPath, "package.json");
|
120
|
-
return [
|
121
|
-
4,
|
122
|
-
fse.ensureDir(path.dirname(packageJsonPath))
|
123
|
-
];
|
124
|
-
case 13:
|
125
|
-
_state.sent();
|
126
|
-
return [
|
127
|
-
4,
|
128
|
-
fse.writeFile(packageJsonPath, JSON.stringify(pkgJSON, null, 2))
|
129
|
-
];
|
130
|
-
case 14:
|
131
|
-
_state.sent();
|
132
|
-
return [
|
133
|
-
2
|
134
|
-
];
|
135
|
-
}
|
136
|
-
});
|
137
|
-
});
|
138
|
-
return function writePackage2(options) {
|
139
|
-
return _ref.apply(this, arguments);
|
140
|
-
};
|
141
|
-
}();
|
142
|
-
var isWindows = os.platform() === "win32";
|
143
|
-
var linkPackage = function() {
|
144
|
-
var _ref = _async_to_generator(function(from, to, projectRootDir) {
|
145
|
-
var src, dest, dstStat, exists;
|
146
|
-
return _ts_generator(this, function(_state) {
|
147
|
-
switch (_state.label) {
|
148
|
-
case 0:
|
149
|
-
src = path.join(projectRootDir, "node_modules", from);
|
150
|
-
dest = path.join(projectRootDir, "node_modules", to);
|
151
|
-
return [
|
152
|
-
4,
|
153
|
-
fse.lstat(dest).catch(function() {
|
154
|
-
return null;
|
155
|
-
})
|
156
|
-
];
|
157
|
-
case 1:
|
158
|
-
dstStat = _state.sent();
|
159
|
-
exists = dstStat === null || dstStat === void 0 ? void 0 : dstStat.isSymbolicLink();
|
160
|
-
if (exists) {
|
161
|
-
return [
|
162
|
-
2
|
163
|
-
];
|
164
|
-
}
|
165
|
-
return [
|
166
|
-
4,
|
167
|
-
fse.mkdir(path.dirname(dest), {
|
168
|
-
recursive: true
|
169
|
-
})
|
170
|
-
];
|
171
|
-
case 2:
|
172
|
-
_state.sent();
|
173
|
-
return [
|
174
|
-
4,
|
175
|
-
fse.symlink(path.relative(path.dirname(dest), src), dest, isWindows ? "junction" : "dir").catch(function(error) {
|
176
|
-
console.error("Cannot link", from, "to", to, error);
|
177
|
-
})
|
178
|
-
];
|
179
|
-
case 3:
|
180
|
-
_state.sent();
|
181
|
-
return [
|
182
|
-
2
|
183
|
-
];
|
184
|
-
}
|
185
|
-
});
|
186
|
-
});
|
187
|
-
return function linkPackage2(from, to, projectRootDir) {
|
188
|
-
return _ref.apply(this, arguments);
|
189
|
-
};
|
190
|
-
}();
|
191
|
-
var readDirRecursive = function() {
|
192
|
-
var _ref = _async_to_generator(function(dir) {
|
193
|
-
var options, filter, files, filesAndDirs;
|
194
|
-
var _arguments = arguments;
|
195
|
-
return _ts_generator(this, function(_state) {
|
196
|
-
switch (_state.label) {
|
197
|
-
case 0:
|
198
|
-
options = _arguments.length > 1 && _arguments[1] !== void 0 ? _arguments[1] : {};
|
199
|
-
filter = options.filter;
|
200
|
-
return [
|
201
|
-
4,
|
202
|
-
fse.readdir(dir, {
|
203
|
-
withFileTypes: true
|
204
|
-
})
|
205
|
-
];
|
206
|
-
case 1:
|
207
|
-
files = _state.sent();
|
208
|
-
return [
|
209
|
-
4,
|
210
|
-
Promise.all(files.map(function() {
|
211
|
-
var _ref2 = _async_to_generator(function(file) {
|
212
|
-
var resolvedPath;
|
213
|
-
return _ts_generator(this, function(_state2) {
|
214
|
-
resolvedPath = path.resolve(dir, file.name);
|
215
|
-
if (file.isDirectory()) {
|
216
|
-
return [
|
217
|
-
2,
|
218
|
-
readDirRecursive(resolvedPath, options)
|
219
|
-
];
|
220
|
-
} else {
|
221
|
-
return [
|
222
|
-
2,
|
223
|
-
filter && !filter(resolvedPath) ? [] : resolvedPath
|
224
|
-
];
|
225
|
-
}
|
226
|
-
return [
|
227
|
-
2
|
228
|
-
];
|
229
|
-
});
|
230
|
-
});
|
231
|
-
return function(file) {
|
232
|
-
return _ref2.apply(this, arguments);
|
233
|
-
};
|
234
|
-
}()))
|
235
|
-
];
|
236
|
-
case 2:
|
237
|
-
filesAndDirs = _state.sent();
|
238
|
-
return [
|
239
|
-
2,
|
240
|
-
filesAndDirs.flat()
|
241
|
-
];
|
242
|
-
}
|
243
|
-
});
|
244
|
-
});
|
245
|
-
return function readDirRecursive2(dir) {
|
246
|
-
return _ref.apply(this, arguments);
|
247
|
-
};
|
248
|
-
}();
|
249
|
-
var isFile = function() {
|
250
|
-
var _ref = _async_to_generator(function(file) {
|
251
|
-
var stat, error;
|
252
|
-
return _ts_generator(this, function(_state) {
|
253
|
-
switch (_state.label) {
|
254
|
-
case 0:
|
255
|
-
_state.trys.push([
|
256
|
-
0,
|
257
|
-
2,
|
258
|
-
,
|
259
|
-
3
|
260
|
-
]);
|
261
|
-
return [
|
262
|
-
4,
|
263
|
-
fse.stat(file)
|
264
|
-
];
|
265
|
-
case 1:
|
266
|
-
stat = _state.sent();
|
267
|
-
return [
|
268
|
-
2,
|
269
|
-
stat.isFile()
|
270
|
-
];
|
271
|
-
case 2:
|
272
|
-
error = _state.sent();
|
273
|
-
if (error.code === "ENOENT") {
|
274
|
-
return [
|
275
|
-
2,
|
276
|
-
false
|
277
|
-
];
|
278
|
-
}
|
279
|
-
throw error;
|
280
|
-
case 3:
|
281
|
-
return [
|
282
|
-
2
|
283
|
-
];
|
284
|
-
}
|
285
|
-
});
|
286
|
-
});
|
287
|
-
return function isFile2(file) {
|
288
|
-
return _ref.apply(this, arguments);
|
289
|
-
};
|
290
|
-
}();
|
291
|
-
var findEntryFiles = function() {
|
292
|
-
var _ref = _async_to_generator(function(rootDir, entryFilter) {
|
293
|
-
var files;
|
294
|
-
return _ts_generator(this, function(_state) {
|
295
|
-
switch (_state.label) {
|
296
|
-
case 0:
|
297
|
-
return [
|
298
|
-
4,
|
299
|
-
readDirRecursive(rootDir, {
|
300
|
-
filter: entryFilter
|
301
|
-
})
|
302
|
-
];
|
303
|
-
case 1:
|
304
|
-
files = _state.sent();
|
305
|
-
return [
|
306
|
-
2,
|
307
|
-
files.filter(function(file) {
|
308
|
-
return file.endsWith(".mjs") || file.endsWith(".cjs") || file.endsWith(".js");
|
309
|
-
})
|
310
|
-
];
|
311
|
-
}
|
312
|
-
});
|
313
|
-
});
|
314
|
-
return function findEntryFiles2(rootDir, entryFilter) {
|
315
|
-
return _ref.apply(this, arguments);
|
316
|
-
};
|
317
|
-
}();
|
318
|
-
var findPackageParents = function(pkg, version, tracedFiles) {
|
319
|
-
var versionFiles = pkg.versions[version].files.map(function(path2) {
|
320
|
-
return tracedFiles[path2];
|
321
|
-
});
|
322
|
-
var parentPkgs = _to_consumable_array(new Set(versionFiles.flatMap(function(file) {
|
323
|
-
return (
|
324
|
-
// Because it supports copyWholePackage configuration, not all files exist.
|
325
|
-
file === null || file === void 0 ? void 0 : file.parents.map(function(parentPath) {
|
326
|
-
var parentFile = tracedFiles[parentPath];
|
327
|
-
if (!parentFile || parentFile.pkgName === pkg.name) {
|
328
|
-
return null;
|
329
|
-
}
|
330
|
-
return "".concat(parentFile.pkgName, "@").concat(parentFile.pkgVersion);
|
331
|
-
}).filter(Boolean)
|
332
|
-
);
|
333
|
-
})));
|
334
|
-
return parentPkgs.filter(function(parentPkg) {
|
335
|
-
return parentPkg;
|
336
|
-
});
|
337
|
-
};
|
338
|
-
var traceFiles = function() {
|
339
|
-
var _ref = _async_to_generator(function(param) {
|
340
|
-
var entryFiles, serverRootDir, _param_base, base, traceOptions;
|
341
|
-
return _ts_generator(this, function(_state) {
|
342
|
-
switch (_state.label) {
|
343
|
-
case 0:
|
344
|
-
entryFiles = param.entryFiles, serverRootDir = param.serverRootDir, _param_base = param.base, base = _param_base === void 0 ? "/" : _param_base, traceOptions = param.traceOptions;
|
345
|
-
return [
|
346
|
-
4,
|
347
|
-
nodeFileTrace(entryFiles, _object_spread({
|
348
|
-
base,
|
349
|
-
processCwd: serverRootDir
|
350
|
-
}, traceOptions))
|
351
|
-
];
|
352
|
-
case 1:
|
353
|
-
return [
|
354
|
-
2,
|
355
|
-
_state.sent()
|
356
|
-
];
|
357
|
-
}
|
358
|
-
});
|
359
|
-
});
|
360
|
-
return function traceFiles2(_) {
|
361
|
-
return _ref.apply(this, arguments);
|
362
|
-
};
|
363
|
-
}();
|
364
|
-
var resolveTracedPath = function() {
|
365
|
-
var _ref = _async_to_generator(function(base, p) {
|
366
|
-
return _ts_generator(this, function(_state) {
|
367
|
-
return [
|
368
|
-
2,
|
369
|
-
fse.realpath(path.resolve(base, p))
|
370
|
-
];
|
371
|
-
});
|
372
|
-
});
|
373
|
-
return function resolveTracedPath2(base, p) {
|
374
|
-
return _ref.apply(this, arguments);
|
375
|
-
};
|
376
|
-
}();
|
377
|
-
var isSubPath = function(parentPath, childPath) {
|
378
|
-
if (!parentPath || !childPath) {
|
379
|
-
return false;
|
380
|
-
}
|
381
|
-
var relative = path.relative(parentPath, childPath);
|
382
|
-
return relative && !relative.startsWith("..");
|
383
|
-
};
|
384
|
-
export {
|
385
|
-
findEntryFiles,
|
386
|
-
findPackageParents,
|
387
|
-
isFile,
|
388
|
-
isSubPath,
|
389
|
-
linkPackage,
|
390
|
-
readDirRecursive,
|
391
|
-
resolveTracedPath,
|
392
|
-
traceFiles,
|
393
|
-
writePackage
|
394
|
-
};
|
@@ -1,135 +0,0 @@
|
|
1
|
-
import { _ as _async_to_generator } from "@swc/helpers/_/_async_to_generator";
|
2
|
-
import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator";
|
3
|
-
import { provider } from "std-env";
|
4
|
-
import { getProjectUsage } from "./utils";
|
5
|
-
import { createNodePreset } from "./platforms/node";
|
6
|
-
import { createVercelPreset } from "./platforms/vercel";
|
7
|
-
import { createNetlifyPreset } from "./platforms/netlify";
|
8
|
-
var deployPresets = {
|
9
|
-
node: createNodePreset,
|
10
|
-
vercel: createVercelPreset,
|
11
|
-
netlify: createNetlifyPreset
|
12
|
-
};
|
13
|
-
function getDeployPreset(appContext, modernConfig, deployTarget) {
|
14
|
-
return _getDeployPreset.apply(this, arguments);
|
15
|
-
}
|
16
|
-
function _getDeployPreset() {
|
17
|
-
_getDeployPreset = _async_to_generator(function(appContext, modernConfig, deployTarget) {
|
18
|
-
var appDirectory, distDirectory, _getProjectUsage, useSSR, useAPI, useWebServer, needModernServer, createPreset;
|
19
|
-
return _ts_generator(this, function(_state) {
|
20
|
-
appDirectory = appContext.appDirectory, distDirectory = appContext.distDirectory;
|
21
|
-
_getProjectUsage = getProjectUsage(appDirectory, distDirectory), useSSR = _getProjectUsage.useSSR, useAPI = _getProjectUsage.useAPI, useWebServer = _getProjectUsage.useWebServer;
|
22
|
-
needModernServer = useSSR || useAPI || useWebServer;
|
23
|
-
createPreset = deployPresets[deployTarget];
|
24
|
-
if (!createPreset) {
|
25
|
-
throw new Error("Unknown deploy target: '".concat(deployTarget, "'. MODERNJS_DEPLOY should be 'node', 'vercel', or 'netlify'."));
|
26
|
-
}
|
27
|
-
return [
|
28
|
-
2,
|
29
|
-
createPreset(appContext, modernConfig, needModernServer)
|
30
|
-
];
|
31
|
-
});
|
32
|
-
});
|
33
|
-
return _getDeployPreset.apply(this, arguments);
|
34
|
-
}
|
35
|
-
function deploy_default() {
|
36
|
-
return {
|
37
|
-
name: "@modern-js/plugin-deploy",
|
38
|
-
setup: function(api) {
|
39
|
-
var deployTarget = process.env.MODERNJS_DEPLOY || provider || "node";
|
40
|
-
return {
|
41
|
-
deploy: function deploy() {
|
42
|
-
return _async_to_generator(function() {
|
43
|
-
var appContext, metaName, modernConfig, deployPreset, _tmp, _tmp1, _tmp2, _tmp3;
|
44
|
-
return _ts_generator(this, function(_state) {
|
45
|
-
switch (_state.label) {
|
46
|
-
case 0:
|
47
|
-
appContext = api.useAppContext();
|
48
|
-
metaName = appContext.metaName;
|
49
|
-
if (metaName !== "modern-js" && !process.env.MODERNJS_DEPLOY) {
|
50
|
-
return [
|
51
|
-
2
|
52
|
-
];
|
53
|
-
}
|
54
|
-
modernConfig = api.useResolvedConfigContext();
|
55
|
-
return [
|
56
|
-
4,
|
57
|
-
getDeployPreset(appContext, modernConfig, deployTarget)
|
58
|
-
];
|
59
|
-
case 1:
|
60
|
-
deployPreset = _state.sent();
|
61
|
-
_tmp = deployPreset === null || deployPreset === void 0 ? void 0 : deployPreset.prepare;
|
62
|
-
if (!_tmp)
|
63
|
-
return [
|
64
|
-
3,
|
65
|
-
3
|
66
|
-
];
|
67
|
-
return [
|
68
|
-
4,
|
69
|
-
deployPreset === null || deployPreset === void 0 ? void 0 : deployPreset.prepare()
|
70
|
-
];
|
71
|
-
case 2:
|
72
|
-
_tmp = _state.sent();
|
73
|
-
_state.label = 3;
|
74
|
-
case 3:
|
75
|
-
_tmp;
|
76
|
-
_tmp1 = deployPreset === null || deployPreset === void 0 ? void 0 : deployPreset.writeOutput;
|
77
|
-
if (!_tmp1)
|
78
|
-
return [
|
79
|
-
3,
|
80
|
-
5
|
81
|
-
];
|
82
|
-
return [
|
83
|
-
4,
|
84
|
-
deployPreset === null || deployPreset === void 0 ? void 0 : deployPreset.writeOutput()
|
85
|
-
];
|
86
|
-
case 4:
|
87
|
-
_tmp1 = _state.sent();
|
88
|
-
_state.label = 5;
|
89
|
-
case 5:
|
90
|
-
_tmp1;
|
91
|
-
_tmp2 = deployPreset === null || deployPreset === void 0 ? void 0 : deployPreset.genEntry;
|
92
|
-
if (!_tmp2)
|
93
|
-
return [
|
94
|
-
3,
|
95
|
-
7
|
96
|
-
];
|
97
|
-
return [
|
98
|
-
4,
|
99
|
-
deployPreset === null || deployPreset === void 0 ? void 0 : deployPreset.genEntry()
|
100
|
-
];
|
101
|
-
case 6:
|
102
|
-
_tmp2 = _state.sent();
|
103
|
-
_state.label = 7;
|
104
|
-
case 7:
|
105
|
-
_tmp2;
|
106
|
-
_tmp3 = deployPreset === null || deployPreset === void 0 ? void 0 : deployPreset.end;
|
107
|
-
if (!_tmp3)
|
108
|
-
return [
|
109
|
-
3,
|
110
|
-
9
|
111
|
-
];
|
112
|
-
return [
|
113
|
-
4,
|
114
|
-
deployPreset === null || deployPreset === void 0 ? void 0 : deployPreset.end()
|
115
|
-
];
|
116
|
-
case 8:
|
117
|
-
_tmp3 = _state.sent();
|
118
|
-
_state.label = 9;
|
119
|
-
case 9:
|
120
|
-
_tmp3;
|
121
|
-
return [
|
122
|
-
2
|
123
|
-
];
|
124
|
-
}
|
125
|
-
});
|
126
|
-
})();
|
127
|
-
}
|
128
|
-
};
|
129
|
-
}
|
130
|
-
};
|
131
|
-
}
|
132
|
-
;
|
133
|
-
export {
|
134
|
-
deploy_default as default
|
135
|
-
};
|