@vercel/build-utils 14.9.1 → 14.9.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/CHANGELOG.md +14 -0
- package/build.mjs +23 -2
- package/dist/fs/find-package-json.d.ts +36 -0
- package/dist/fs/find-package-json.js +95 -0
- package/dist/fs/run-user-scripts.d.ts +2 -36
- package/dist/fs/run-user-scripts.js +10 -59
- package/dist/index.d.ts +9 -8
- package/dist/index.js +144 -41196
- package/dist/max-duration.d.ts +1 -1
- package/dist/max-duration.js +1 -1
- package/lazy-entry.mjs +39 -0
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @vercel/build-utils
|
|
2
2
|
|
|
3
|
+
## 14.9.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 55e8d1e: Reduce CLI startup and deployment preparation time through lazy shared dependencies, smaller bundles, parallel Git metadata and file collection, and native executable startup caching. Allow deployment options to resolve asynchronously while the client collects local files.
|
|
8
|
+
|
|
9
|
+
Keep startup regression tests compatible with asynchronous prompts and Windows Git paths, and allow the NestJS build fixture sufficient time for cold dependency installation.
|
|
10
|
+
|
|
11
|
+
## 14.9.2
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- b174f14: Raise the client-side `maxDuration` validation limit to 3600 seconds.
|
|
16
|
+
|
|
3
17
|
## 14.9.1
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
package/build.mjs
CHANGED
|
@@ -1,5 +1,26 @@
|
|
|
1
|
-
import { rm } from 'node:fs/promises';
|
|
1
|
+
import { appendFile, rm } from 'node:fs/promises';
|
|
2
|
+
import { createRequire } from 'node:module';
|
|
2
3
|
import { tsc, esbuild } from '../../utils/build.mjs';
|
|
4
|
+
import { lazyEntryPlugin } from './lazy-entry.mjs';
|
|
3
5
|
|
|
4
6
|
await rm(new URL('./dist', import.meta.url), { recursive: true, force: true });
|
|
5
|
-
await Promise.all([
|
|
7
|
+
await Promise.all([
|
|
8
|
+
tsc(),
|
|
9
|
+
esbuild().then(() =>
|
|
10
|
+
esbuild({
|
|
11
|
+
bundle: true,
|
|
12
|
+
minifySyntax: true,
|
|
13
|
+
minifyWhitespace: true,
|
|
14
|
+
plugins: [lazyEntryPlugin()],
|
|
15
|
+
})
|
|
16
|
+
),
|
|
17
|
+
]);
|
|
18
|
+
|
|
19
|
+
// Node's CommonJS lexer needs literal export names to support ESM named
|
|
20
|
+
// imports. Enumerating the barrel does not invoke its lazy property getters.
|
|
21
|
+
const require = createRequire(import.meta.url);
|
|
22
|
+
const names = Object.keys(require('./dist/index.js'));
|
|
23
|
+
await appendFile(
|
|
24
|
+
new URL('./dist/index.js', import.meta.url),
|
|
25
|
+
`\n// Named exports for Node's CommonJS lexer.\n0 && (module.exports = {${names.map(name => `${JSON.stringify(name)}: null`).join(',')}});\n`
|
|
26
|
+
);
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { PackageJson } from '../types';
|
|
2
|
+
export interface FindPackageJsonResult {
|
|
3
|
+
/**
|
|
4
|
+
* The file path of found `package.json` file, or `undefined` if not found.
|
|
5
|
+
*/
|
|
6
|
+
packageJsonPath?: string;
|
|
7
|
+
/**
|
|
8
|
+
* The contents of found `package.json` file, when the `readPackageJson`
|
|
9
|
+
* option is enabled.
|
|
10
|
+
*/
|
|
11
|
+
packageJson?: PackageJson;
|
|
12
|
+
}
|
|
13
|
+
export interface TraverseUpDirectoriesProps {
|
|
14
|
+
/**
|
|
15
|
+
* The directory to start iterating from, typically the same directory of the entrypoint.
|
|
16
|
+
*/
|
|
17
|
+
start: string;
|
|
18
|
+
/**
|
|
19
|
+
* The highest directory, typically the workPath root of the project.
|
|
20
|
+
*/
|
|
21
|
+
base?: string;
|
|
22
|
+
}
|
|
23
|
+
export interface WalkParentDirsProps extends Required<TraverseUpDirectoriesProps> {
|
|
24
|
+
/**
|
|
25
|
+
* The name of the file to search for, typically `package.json` or `Gemfile`.
|
|
26
|
+
*/
|
|
27
|
+
filename: string;
|
|
28
|
+
}
|
|
29
|
+
export declare function traverseUpDirectories({ start, base, }: TraverseUpDirectoriesProps): Generator<string, void, unknown>;
|
|
30
|
+
/**
|
|
31
|
+
* Traverses up directories to find and optionally read package.json.
|
|
32
|
+
* This is a lightweight alternative to `scanParentDirs` when only
|
|
33
|
+
* package.json information is needed (without lockfile detection).
|
|
34
|
+
*/
|
|
35
|
+
export declare function findPackageJson(destPath: string, readPackageJson?: boolean, base?: string): Promise<FindPackageJsonResult>;
|
|
36
|
+
export declare function walkParentDirs({ base, start, filename, }: WalkParentDirsProps): Promise<string | null>;
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var find_package_json_exports = {};
|
|
30
|
+
__export(find_package_json_exports, {
|
|
31
|
+
findPackageJson: () => findPackageJson,
|
|
32
|
+
traverseUpDirectories: () => traverseUpDirectories,
|
|
33
|
+
walkParentDirs: () => walkParentDirs
|
|
34
|
+
});
|
|
35
|
+
module.exports = __toCommonJS(find_package_json_exports);
|
|
36
|
+
var import_assert = __toESM(require("assert"));
|
|
37
|
+
var import_fs_extra = __toESM(require("fs-extra"));
|
|
38
|
+
var import_path = __toESM(require("path"));
|
|
39
|
+
function* traverseUpDirectories({
|
|
40
|
+
start,
|
|
41
|
+
base
|
|
42
|
+
}) {
|
|
43
|
+
let current = import_path.default.normalize(start);
|
|
44
|
+
const normalizedRoot = base ? import_path.default.normalize(base) : void 0;
|
|
45
|
+
while (current) {
|
|
46
|
+
yield current;
|
|
47
|
+
if (current === normalizedRoot)
|
|
48
|
+
break;
|
|
49
|
+
const next = import_path.default.join(current, "..");
|
|
50
|
+
current = next === current ? void 0 : next;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
async function findPackageJson(destPath, readPackageJson = false, base = "/") {
|
|
54
|
+
(0, import_assert.default)(import_path.default.isAbsolute(destPath));
|
|
55
|
+
const pkgJsonPath = await walkParentDirs({
|
|
56
|
+
base,
|
|
57
|
+
start: destPath,
|
|
58
|
+
filename: "package.json"
|
|
59
|
+
});
|
|
60
|
+
let packageJson;
|
|
61
|
+
if (readPackageJson && pkgJsonPath) {
|
|
62
|
+
try {
|
|
63
|
+
packageJson = JSON.parse(await import_fs_extra.default.readFile(pkgJsonPath, "utf8"));
|
|
64
|
+
} catch (err) {
|
|
65
|
+
throw new Error(
|
|
66
|
+
`Could not read ${pkgJsonPath}: ${err.message}.`
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
return {
|
|
71
|
+
packageJsonPath: pkgJsonPath || void 0,
|
|
72
|
+
packageJson
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
async function walkParentDirs({
|
|
76
|
+
base,
|
|
77
|
+
start,
|
|
78
|
+
filename
|
|
79
|
+
}) {
|
|
80
|
+
(0, import_assert.default)(import_path.default.isAbsolute(base), 'Expected "base" to be absolute path');
|
|
81
|
+
(0, import_assert.default)(import_path.default.isAbsolute(start), 'Expected "start" to be absolute path');
|
|
82
|
+
for (const dir of traverseUpDirectories({ start, base })) {
|
|
83
|
+
const fullPath = import_path.default.join(dir, filename);
|
|
84
|
+
if (await import_fs_extra.default.pathExists(fullPath)) {
|
|
85
|
+
return fullPath;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
return null;
|
|
89
|
+
}
|
|
90
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
91
|
+
0 && (module.exports = {
|
|
92
|
+
findPackageJson,
|
|
93
|
+
traverseUpDirectories,
|
|
94
|
+
walkParentDirs
|
|
95
|
+
});
|
|
@@ -1,17 +1,8 @@
|
|
|
1
|
+
import { type FindPackageJsonResult, type TraverseUpDirectoriesProps } from './find-package-json';
|
|
2
|
+
export { findPackageJson, walkParentDirs, traverseUpDirectories, type FindPackageJsonResult, type TraverseUpDirectoriesProps, type WalkParentDirsProps, } from './find-package-json';
|
|
1
3
|
import { SpawnOptions } from 'child_process';
|
|
2
4
|
import { Meta, PackageJson, NodeVersion, Config, BunVersion } from '../types';
|
|
3
5
|
export type CliType = 'yarn' | 'npm' | 'pnpm' | 'bun' | 'vlt';
|
|
4
|
-
export interface FindPackageJsonResult {
|
|
5
|
-
/**
|
|
6
|
-
* The file path of found `package.json` file, or `undefined` if not found.
|
|
7
|
-
*/
|
|
8
|
-
packageJsonPath?: string;
|
|
9
|
-
/**
|
|
10
|
-
* The contents of found `package.json` file, when the `readPackageJson`
|
|
11
|
-
* option is enabled.
|
|
12
|
-
*/
|
|
13
|
-
packageJson?: PackageJson;
|
|
14
|
-
}
|
|
15
6
|
export interface ScanParentDirsResult extends FindPackageJsonResult {
|
|
16
7
|
/**
|
|
17
8
|
* "yarn", "npm", or "pnpm" depending on the presence of lockfiles.
|
|
@@ -44,22 +35,6 @@ export interface ScanParentDirsResult extends FindPackageJsonResult {
|
|
|
44
35
|
*/
|
|
45
36
|
turboSupportsCorepackHome?: boolean;
|
|
46
37
|
}
|
|
47
|
-
export interface TraverseUpDirectoriesProps {
|
|
48
|
-
/**
|
|
49
|
-
* The directory to start iterating from, typically the same directory of the entrypoint.
|
|
50
|
-
*/
|
|
51
|
-
start: string;
|
|
52
|
-
/**
|
|
53
|
-
* The highest directory, typically the workPath root of the project.
|
|
54
|
-
*/
|
|
55
|
-
base?: string;
|
|
56
|
-
}
|
|
57
|
-
export interface WalkParentDirsProps extends Required<TraverseUpDirectoriesProps> {
|
|
58
|
-
/**
|
|
59
|
-
* The name of the file to search for, typically `package.json` or `Gemfile`.
|
|
60
|
-
*/
|
|
61
|
-
filename: string;
|
|
62
|
-
}
|
|
63
38
|
export interface WalkParentDirsMultiProps extends Required<TraverseUpDirectoriesProps> {
|
|
64
39
|
/**
|
|
65
40
|
* The name of the file to search for, typically `package.json` or `Gemfile`.
|
|
@@ -101,7 +76,6 @@ export interface NpmInstallOutput {
|
|
|
101
76
|
export declare function spawnAsync(command: string, args: string[], opts?: SpawnOptionsExtended): Promise<void>;
|
|
102
77
|
export declare function spawnCommand(command: string, options?: SpawnOptions): import("child_process").ChildProcess;
|
|
103
78
|
export declare function execCommand(command: string, options?: SpawnOptions): Promise<boolean>;
|
|
104
|
-
export declare function traverseUpDirectories({ start, base, }: TraverseUpDirectoriesProps): Generator<string, void, unknown>;
|
|
105
79
|
/**
|
|
106
80
|
* @deprecated Use `getNodeBinPaths()` instead.
|
|
107
81
|
*/
|
|
@@ -117,18 +91,11 @@ export declare function runShellScript(fsPath: string, args?: string[], spawnOpt
|
|
|
117
91
|
*/
|
|
118
92
|
export declare function getSpawnOptions(meta: Meta, nodeVersion: NodeVersion): SpawnOptions;
|
|
119
93
|
export declare function getNodeVersion(destPath: string, fallbackVersion?: string | undefined, config?: Config, meta?: Meta, availableVersions?: number[]): Promise<NodeVersion | BunVersion>;
|
|
120
|
-
/**
|
|
121
|
-
* Traverses up directories to find and optionally read package.json.
|
|
122
|
-
* This is a lightweight alternative to `scanParentDirs` when only
|
|
123
|
-
* package.json information is needed (without lockfile detection).
|
|
124
|
-
*/
|
|
125
|
-
export declare function findPackageJson(destPath: string, readPackageJson?: boolean, base?: string): Promise<FindPackageJsonResult>;
|
|
126
94
|
export declare function scanParentDirs(destPath: string, readPackageJson?: boolean, base?: string): Promise<ScanParentDirsResult>;
|
|
127
95
|
export declare function turboVersionSpecifierSupportsCorepack(turboVersionSpecifier: string): boolean;
|
|
128
96
|
export declare function usingCorepack(env: {
|
|
129
97
|
[x: string]: string | undefined;
|
|
130
98
|
}, packageJsonPackageManager: string | undefined, turboSupportsCorepackHome: boolean | undefined): boolean;
|
|
131
|
-
export declare function walkParentDirs({ base, start, filename, }: WalkParentDirsProps): Promise<string | null>;
|
|
132
99
|
/**
|
|
133
100
|
* Reset the customInstallCommandSet. This should be called at the start of each build
|
|
134
101
|
* to prevent custom install commands from being skipped due to the set persisting
|
|
@@ -256,4 +223,3 @@ export declare function getScriptName(pkg: Pick<PackageJson, 'scripts'> | null |
|
|
|
256
223
|
* Please use runNpmInstall() instead.
|
|
257
224
|
*/
|
|
258
225
|
export declare const installDependencies: typeof runNpmInstall;
|
|
259
|
-
export {};
|
|
@@ -32,7 +32,7 @@ __export(run_user_scripts_exports, {
|
|
|
32
32
|
PNPM_11_PREFERRED_AT: () => PNPM_11_PREFERRED_AT,
|
|
33
33
|
detectPackageManager: () => detectPackageManager,
|
|
34
34
|
execCommand: () => execCommand,
|
|
35
|
-
findPackageJson: () => findPackageJson,
|
|
35
|
+
findPackageJson: () => import_find_package_json2.findPackageJson,
|
|
36
36
|
getEnvForPackageManager: () => getEnvForPackageManager,
|
|
37
37
|
getNodeBinPath: () => getNodeBinPath,
|
|
38
38
|
getNodeBinPaths: () => getNodeBinPaths,
|
|
@@ -52,12 +52,14 @@ __export(run_user_scripts_exports, {
|
|
|
52
52
|
scanParentDirs: () => scanParentDirs,
|
|
53
53
|
spawnAsync: () => spawnAsync,
|
|
54
54
|
spawnCommand: () => spawnCommand,
|
|
55
|
-
traverseUpDirectories: () => traverseUpDirectories,
|
|
55
|
+
traverseUpDirectories: () => import_find_package_json2.traverseUpDirectories,
|
|
56
56
|
turboVersionSpecifierSupportsCorepack: () => turboVersionSpecifierSupportsCorepack,
|
|
57
57
|
usingCorepack: () => usingCorepack,
|
|
58
|
-
walkParentDirs: () => walkParentDirs
|
|
58
|
+
walkParentDirs: () => import_find_package_json2.walkParentDirs
|
|
59
59
|
});
|
|
60
60
|
module.exports = __toCommonJS(run_user_scripts_exports);
|
|
61
|
+
var import_find_package_json = require("./find-package-json");
|
|
62
|
+
var import_find_package_json2 = require("./find-package-json");
|
|
61
63
|
var import_assert = __toESM(require("assert"));
|
|
62
64
|
var import_fs_extra = __toESM(require("fs-extra"));
|
|
63
65
|
var import_path = __toESM(require("path"));
|
|
@@ -128,26 +130,12 @@ async function execCommand(command, options = {}) {
|
|
|
128
130
|
}
|
|
129
131
|
return true;
|
|
130
132
|
}
|
|
131
|
-
function* traverseUpDirectories({
|
|
132
|
-
start,
|
|
133
|
-
base
|
|
134
|
-
}) {
|
|
135
|
-
let current = import_path.default.normalize(start);
|
|
136
|
-
const normalizedRoot = base ? import_path.default.normalize(base) : void 0;
|
|
137
|
-
while (current) {
|
|
138
|
-
yield current;
|
|
139
|
-
if (current === normalizedRoot)
|
|
140
|
-
break;
|
|
141
|
-
const next = import_path.default.join(current, "..");
|
|
142
|
-
current = next === current ? void 0 : next;
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
133
|
async function readProjectRootInfo({
|
|
146
134
|
start,
|
|
147
135
|
base
|
|
148
136
|
}) {
|
|
149
137
|
let curRootPackageJsonPath;
|
|
150
|
-
for (const dir of traverseUpDirectories({ start, base })) {
|
|
138
|
+
for (const dir of (0, import_find_package_json.traverseUpDirectories)({ start, base })) {
|
|
151
139
|
const packageJsonPath = import_path.default.join(dir, "package.json");
|
|
152
140
|
if (await import_fs_extra.default.pathExists(packageJsonPath)) {
|
|
153
141
|
curRootPackageJsonPath = packageJsonPath;
|
|
@@ -169,7 +157,7 @@ function getNodeBinPaths({
|
|
|
169
157
|
start,
|
|
170
158
|
base
|
|
171
159
|
}) {
|
|
172
|
-
return Array.from(traverseUpDirectories({ start, base })).map(
|
|
160
|
+
return Array.from((0, import_find_package_json.traverseUpDirectories)({ start, base })).map(
|
|
173
161
|
(dir) => import_path.default.join(dir, "node_modules/.bin")
|
|
174
162
|
);
|
|
175
163
|
}
|
|
@@ -218,7 +206,7 @@ function getSpawnOptions(meta, nodeVersion) {
|
|
|
218
206
|
return opts;
|
|
219
207
|
}
|
|
220
208
|
async function getNodeVersion(destPath, fallbackVersion = process.env.VERCEL_PROJECT_SETTINGS_NODE_VERSION, config = {}, meta = {}, availableVersions = (0, import_node_version.getAvailableNodeVersions)()) {
|
|
221
|
-
const { packageJson } = await findPackageJson(destPath, true);
|
|
209
|
+
const { packageJson } = await (0, import_find_package_json.findPackageJson)(destPath, true);
|
|
222
210
|
const packageJsonNodeVersion = packageJson?.engines?.node;
|
|
223
211
|
const packageJsonBunVersion = packageJson?.engines?.bun;
|
|
224
212
|
const latestNodeVersion = (0, import_node_version.getLatestNodeVersion)(availableVersions);
|
|
@@ -290,31 +278,9 @@ async function getNodeVersion(destPath, fallbackVersion = process.env.VERCEL_PRO
|
|
|
290
278
|
return (0, import_node_version.getSupportedBunVersion)("1.x");
|
|
291
279
|
}
|
|
292
280
|
}
|
|
293
|
-
async function findPackageJson(destPath, readPackageJson = false, base = "/") {
|
|
294
|
-
(0, import_assert.default)(import_path.default.isAbsolute(destPath));
|
|
295
|
-
const pkgJsonPath = await walkParentDirs({
|
|
296
|
-
base,
|
|
297
|
-
start: destPath,
|
|
298
|
-
filename: "package.json"
|
|
299
|
-
});
|
|
300
|
-
let packageJson;
|
|
301
|
-
if (readPackageJson && pkgJsonPath) {
|
|
302
|
-
try {
|
|
303
|
-
packageJson = JSON.parse(await import_fs_extra.default.readFile(pkgJsonPath, "utf8"));
|
|
304
|
-
} catch (err) {
|
|
305
|
-
throw new Error(
|
|
306
|
-
`Could not read ${pkgJsonPath}: ${err.message}.`
|
|
307
|
-
);
|
|
308
|
-
}
|
|
309
|
-
}
|
|
310
|
-
return {
|
|
311
|
-
packageJsonPath: pkgJsonPath || void 0,
|
|
312
|
-
packageJson
|
|
313
|
-
};
|
|
314
|
-
}
|
|
315
281
|
async function scanParentDirs(destPath, readPackageJson = false, base = "/") {
|
|
316
282
|
(0, import_assert.default)(import_path.default.isAbsolute(destPath));
|
|
317
|
-
const { packageJsonPath: pkgJsonPath, packageJson } = await findPackageJson(
|
|
283
|
+
const { packageJsonPath: pkgJsonPath, packageJson } = await (0, import_find_package_json.findPackageJson)(
|
|
318
284
|
destPath,
|
|
319
285
|
readPackageJson,
|
|
320
286
|
base
|
|
@@ -491,21 +457,6 @@ function usingCorepack(env, packageJsonPackageManager, turboSupportsCorepackHome
|
|
|
491
457
|
}
|
|
492
458
|
return true;
|
|
493
459
|
}
|
|
494
|
-
async function walkParentDirs({
|
|
495
|
-
base,
|
|
496
|
-
start,
|
|
497
|
-
filename
|
|
498
|
-
}) {
|
|
499
|
-
(0, import_assert.default)(import_path.default.isAbsolute(base), 'Expected "base" to be absolute path');
|
|
500
|
-
(0, import_assert.default)(import_path.default.isAbsolute(start), 'Expected "start" to be absolute path');
|
|
501
|
-
for (const dir of traverseUpDirectories({ start, base })) {
|
|
502
|
-
const fullPath = import_path.default.join(dir, filename);
|
|
503
|
-
if (await import_fs_extra.default.pathExists(fullPath)) {
|
|
504
|
-
return fullPath;
|
|
505
|
-
}
|
|
506
|
-
}
|
|
507
|
-
return null;
|
|
508
|
-
}
|
|
509
460
|
async function walkParentDirsMulti({
|
|
510
461
|
base,
|
|
511
462
|
start,
|
|
@@ -513,7 +464,7 @@ async function walkParentDirsMulti({
|
|
|
513
464
|
}) {
|
|
514
465
|
let packageManager;
|
|
515
466
|
let devEngines;
|
|
516
|
-
for (const dir of traverseUpDirectories({ start, base })) {
|
|
467
|
+
for (const dir of (0, import_find_package_json.traverseUpDirectories)({ start, base })) {
|
|
517
468
|
const fullPaths = filenames.map((f) => import_path.default.join(dir, f));
|
|
518
469
|
const existResults = await Promise.all(
|
|
519
470
|
fullPaths.map((f) => import_fs_extra.default.pathExists(f))
|
package/dist/index.d.ts
CHANGED
|
@@ -4,12 +4,13 @@ import FileRef from './file-ref';
|
|
|
4
4
|
import { Lambda, createLambda, getLambdaOptionsFromFunction, sanitizeConsumerName } from './lambda';
|
|
5
5
|
import { NodejsLambda, type NodejsLambdaOptions } from './nodejs-lambda';
|
|
6
6
|
import { Prerender, type PrerenderInitialMetadata } from './prerender';
|
|
7
|
-
import download, { downloadFile, DownloadedFiles, isSymbolicLink, isDirectory, isExternalSymlink, isExternalSymlinkTarget, getSymlinkTarget } from './fs/download';
|
|
7
|
+
import download, { downloadFile, type DownloadedFiles, isSymbolicLink, isDirectory, isExternalSymlink, isExternalSymlinkTarget, getSymlinkTarget } from './fs/download';
|
|
8
8
|
import getWriteableDirectory from './fs/get-writable-directory';
|
|
9
|
-
import glob, { GlobOptions } from './fs/glob';
|
|
9
|
+
import glob, { type GlobOptions } from './fs/glob';
|
|
10
10
|
import rename from './fs/rename';
|
|
11
|
-
import { spawnAsync, execCommand, spawnCommand,
|
|
11
|
+
import { spawnAsync, execCommand, spawnCommand, getScriptName, installDependencies, runPackageJsonScript, runNpmInstall, runBundleInstall, runPipInstall, runShellScript, runCustomInstallCommand, resetCustomInstallCommandSet, getEnvForPackageManager, getNodeVersion, getPathForPackageManager, detectPackageManager, getSpawnOptions, getNodeBinPath, getNodeBinPaths, scanParentDirs, type PipInstallResult, type NpmInstallOutput, type CliType } from './fs/run-user-scripts';
|
|
12
12
|
import { getLatestNodeVersion, getDiscontinuedNodeVersions, getSupportedNodeVersion, isBunVersion, getSupportedBunVersion } from './fs/node-version';
|
|
13
|
+
import { findPackageJson, walkParentDirs, traverseUpDirectories } from './fs/find-package-json';
|
|
13
14
|
import streamToBuffer, { streamToBufferChunks } from './fs/stream-to-buffer';
|
|
14
15
|
import { getOrCreateBunBinary } from './fs/bun-helpers';
|
|
15
16
|
import debug from './debug';
|
|
@@ -23,15 +24,15 @@ import { getNodeExecPath } from './get-node-exec-path';
|
|
|
23
24
|
import { validateNpmrc } from './validate-npmrc';
|
|
24
25
|
export type { NodejsLambdaOptions, PrerenderInitialMetadata };
|
|
25
26
|
export type { LambdaAffinity } from './lambda';
|
|
26
|
-
export { FileBlob, FileFsRef, FileRef, Lambda, NodejsLambda, createLambda, Prerender, download, downloadFile, DownloadedFiles, getWriteableDirectory, glob, GlobOptions, rename, spawnAsync, getScriptName, installDependencies, runPackageJsonScript, execCommand, spawnCommand, walkParentDirs, getNodeBinPath, getNodeBinPaths, getNodeExecPath, getSupportedNodeVersion, isBunVersion, getSupportedBunVersion, getOrCreateBunBinary, detectPackageManager, runNpmInstall, NpmInstallOutput, runBundleInstall, runPipInstall, PipInstallResult, runShellScript, runCustomInstallCommand, resetCustomInstallCommandSet, getEnvForPackageManager, getNodeVersion, getPathForPackageManager, getLatestNodeVersion, getDiscontinuedNodeVersions, getSpawnOptions, getPlatformEnv, getPrefixedEnvVars, getServiceUrlEnvVars, getExperimentalServiceUrlEnvVars, streamToBuffer, streamToBufferChunks, debug, isSymbolicLink, isDirectory, isExternalSymlink, isExternalSymlinkTarget, getSymlinkTarget, getLambdaOptionsFromFunction, sanitizeConsumerName, scanParentDirs, findPackageJson, getIgnoreFilter, cloneEnv, hardLinkDir, traverseUpDirectories, validateNpmrc, type CliType, };
|
|
27
|
+
export { FileBlob, FileFsRef, FileRef, Lambda, NodejsLambda, createLambda, Prerender, download, downloadFile, type DownloadedFiles, getWriteableDirectory, glob, type GlobOptions, rename, spawnAsync, getScriptName, installDependencies, runPackageJsonScript, execCommand, spawnCommand, walkParentDirs, getNodeBinPath, getNodeBinPaths, getNodeExecPath, getSupportedNodeVersion, isBunVersion, getSupportedBunVersion, getOrCreateBunBinary, detectPackageManager, runNpmInstall, type NpmInstallOutput, runBundleInstall, runPipInstall, type PipInstallResult, runShellScript, runCustomInstallCommand, resetCustomInstallCommandSet, getEnvForPackageManager, getNodeVersion, getPathForPackageManager, getLatestNodeVersion, getDiscontinuedNodeVersions, getSpawnOptions, getPlatformEnv, getPrefixedEnvVars, getServiceUrlEnvVars, getExperimentalServiceUrlEnvVars, streamToBuffer, streamToBufferChunks, debug, isSymbolicLink, isDirectory, isExternalSymlink, isExternalSymlinkTarget, getSymlinkTarget, getLambdaOptionsFromFunction, sanitizeConsumerName, scanParentDirs, findPackageJson, getIgnoreFilter, cloneEnv, hardLinkDir, traverseUpDirectories, validateNpmrc, type CliType, };
|
|
27
28
|
export { EdgeFunction } from './edge-function';
|
|
28
29
|
export { ContainerImage } from './container-image';
|
|
29
30
|
export type { ContainerImageConfig } from './container-image';
|
|
30
31
|
export { readConfigFile, getPackageJson } from './fs/read-config-file';
|
|
31
32
|
export { normalizePath } from './fs/normalize-path';
|
|
32
33
|
export { getProvidedRuntime } from './provided-runtime';
|
|
33
|
-
export
|
|
34
|
-
export
|
|
34
|
+
export { shouldServe } from './should-serve';
|
|
35
|
+
export { getFunctionsSchema, functionsSchema, buildsSchema, packageManifestSchema, } from './schemas';
|
|
35
36
|
export { DEFAULT_MAX_DURATION_LIMIT, SKIP_MAX_DURATION_LIMIT_ENV, getMaxDurationLimit, getMaxDurationSchema, } from './max-duration';
|
|
36
37
|
export * from './package-manifest';
|
|
37
38
|
export * from './deploy-manifest';
|
|
@@ -46,8 +47,8 @@ export { isPackageInstalled } from './is-package-installed';
|
|
|
46
47
|
export { defaultCachePathGlob } from './default-cache-path-glob';
|
|
47
48
|
export { generateNodeBuilderFunctions } from './generate-node-builder-functions';
|
|
48
49
|
export { getRegExpFromMatchers, resolveMiddlewareMatcher, } from './middleware-matcher';
|
|
49
|
-
export { BACKEND_FRAMEWORKS, BACKEND_BUILDERS, UNIFIED_BACKEND_BUILDER, BackendFramework, isBackendFramework, isNodeBackendFramework, isBackendBuilder, isExperimentalBackendsEnabled, isExperimentalBackendsWithoutIntrospectionEnabled, shouldUseExperimentalBackends, PYTHON_FRAMEWORKS, PythonFramework, isPythonFramework, } from './framework-helpers';
|
|
50
|
-
export
|
|
50
|
+
export { BACKEND_FRAMEWORKS, BACKEND_BUILDERS, UNIFIED_BACKEND_BUILDER, type BackendFramework, isBackendFramework, isNodeBackendFramework, isBackendBuilder, isExperimentalBackendsEnabled, isExperimentalBackendsWithoutIntrospectionEnabled, shouldUseExperimentalBackends, PYTHON_FRAMEWORKS, type PythonFramework, isPythonFramework, } from './framework-helpers';
|
|
51
|
+
export { isNodeEntrypoint } from './node-entrypoint';
|
|
51
52
|
export * from './service-path-utils';
|
|
52
53
|
export { getEncryptedEnv, type EncryptedEnvFile, } from './process-serverless/get-encrypted-env-file';
|
|
53
54
|
export { getLambdaEnvironment } from './process-serverless/get-lambda-environment';
|