@vercel/build-utils 4.2.1 → 5.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/fs/run-user-scripts.d.ts +1 -1
- package/dist/fs/run-user-scripts.js +28 -7
- package/dist/index.d.ts +0 -14
- package/dist/index.js +36 -7552
- package/package.json +2 -3
- package/dist/detect-builders.d.ts +0 -37
- package/dist/detect-builders.js +0 -841
- package/dist/detect-file-system-api.d.ts +0 -34
- package/dist/detect-file-system-api.js +0 -173
- package/dist/detect-framework.d.ts +0 -12
- package/dist/detect-framework.js +0 -60
- package/dist/detectors/filesystem.d.ts +0 -54
- package/dist/detectors/filesystem.js +0 -78
- package/dist/fs/get-glob-fs.d.ts +0 -6
- package/dist/fs/get-glob-fs.js +0 -71
- package/dist/get-project-paths.d.ts +0 -9
- package/dist/get-project-paths.js +0 -39
- package/dist/monorepos/monorepo-managers.d.ts +0 -16
- package/dist/monorepos/monorepo-managers.js +0 -34
- package/dist/workspaces/get-workspace-package-paths.d.ts +0 -11
- package/dist/workspaces/get-workspace-package-paths.js +0 -62
- package/dist/workspaces/get-workspaces.d.ts +0 -12
- package/dist/workspaces/get-workspaces.js +0 -35
- package/dist/workspaces/workspace-managers.d.ts +0 -16
- package/dist/workspaces/workspace-managers.js +0 -60
@@ -61,7 +61,7 @@ export declare function spawnCommand(command: string, options?: SpawnOptions): i
|
|
61
61
|
export declare function execCommand(command: string, options?: SpawnOptions): Promise<boolean>;
|
62
62
|
export declare function getNodeBinPath({ cwd, }: {
|
63
63
|
cwd: string;
|
64
|
-
}): Promise<string
|
64
|
+
}): Promise<string>;
|
65
65
|
export declare function runShellScript(fsPath: string, args?: string[], spawnOpts?: SpawnOptions): Promise<boolean>;
|
66
66
|
export declare function getSpawnOptions(meta: Meta, nodeVersion: NodeVersion): SpawnOptions;
|
67
67
|
export declare function getNodeVersion(destPath: string, _nodeVersion?: string, config?: Config, meta?: Meta): Promise<NodeVersion>;
|
@@ -138,8 +138,20 @@ function getSpawnOptions(meta, nodeVersion) {
|
|
138
138
|
env: { ...process.env },
|
139
139
|
};
|
140
140
|
if (!meta.isDev) {
|
141
|
-
|
142
|
-
|
141
|
+
let found = false;
|
142
|
+
const oldPath = opts.env.PATH || process.env.PATH || '';
|
143
|
+
const pathSegments = oldPath.split(path_1.default.delimiter).map(segment => {
|
144
|
+
if (/^\/node[0-9]+\/bin/.test(segment)) {
|
145
|
+
found = true;
|
146
|
+
return `/node${nodeVersion.major}/bin`;
|
147
|
+
}
|
148
|
+
return segment;
|
149
|
+
});
|
150
|
+
if (!found) {
|
151
|
+
// If we didn't find & replace, prepend at beginning of PATH
|
152
|
+
pathSegments.unshift(`/node${nodeVersion.major}/bin`);
|
153
|
+
}
|
154
|
+
opts.env.PATH = pathSegments.filter(Boolean).join(path_1.default.delimiter);
|
143
155
|
}
|
144
156
|
return opts;
|
145
157
|
}
|
@@ -323,19 +335,28 @@ async function runNpmInstall(destPath, args = [], spawnOpts, meta, nodeVersion)
|
|
323
335
|
exports.runNpmInstall = runNpmInstall;
|
324
336
|
function getEnvForPackageManager({ cliType, lockfileVersion, nodeVersion, env, }) {
|
325
337
|
const newEnv = { ...env };
|
338
|
+
const oldPath = env.PATH + '';
|
339
|
+
const npm7 = '/node16/bin-npm7';
|
340
|
+
const pnpm7 = '/pnpm7/node_modules/.bin';
|
341
|
+
const corepackEnabled = env.ENABLE_EXPERIMENTAL_COREPACK === '1';
|
326
342
|
if (cliType === 'npm') {
|
327
343
|
if (typeof lockfileVersion === 'number' &&
|
328
344
|
lockfileVersion >= 2 &&
|
329
|
-
(nodeVersion?.major || 0) < 16
|
345
|
+
(nodeVersion?.major || 0) < 16 &&
|
346
|
+
!oldPath.includes(npm7) &&
|
347
|
+
!corepackEnabled) {
|
330
348
|
// Ensure that npm 7 is at the beginning of the `$PATH`
|
331
|
-
newEnv.PATH =
|
332
|
-
console.log('Detected `package-lock.json` generated by npm 7
|
349
|
+
newEnv.PATH = `${npm7}${path_1.default.delimiter}${oldPath}`;
|
350
|
+
console.log('Detected `package-lock.json` generated by npm 7+...');
|
333
351
|
}
|
334
352
|
}
|
335
353
|
else if (cliType === 'pnpm') {
|
336
|
-
if (typeof lockfileVersion === 'number' &&
|
354
|
+
if (typeof lockfileVersion === 'number' &&
|
355
|
+
lockfileVersion === 5.4 &&
|
356
|
+
!oldPath.includes(pnpm7) &&
|
357
|
+
!corepackEnabled) {
|
337
358
|
// Ensure that pnpm 7 is at the beginning of the `$PATH`
|
338
|
-
newEnv.PATH =
|
359
|
+
newEnv.PATH = `${pnpm7}${path_1.default.delimiter}${oldPath}`;
|
339
360
|
console.log('Detected `pnpm-lock.yaml` generated by pnpm 7...');
|
340
361
|
}
|
341
362
|
}
|
package/dist/index.d.ts
CHANGED
@@ -16,23 +16,9 @@ import getIgnoreFilter from './get-ignore-filter';
|
|
16
16
|
import { getPlatformEnv } from './get-platform-env';
|
17
17
|
export { FileBlob, FileFsRef, FileRef, Lambda, NodejsLambda, createLambda, Prerender, download, DownloadedFiles, getWriteableDirectory, glob, GlobOptions, rename, execAsync, spawnAsync, getScriptName, installDependencies, runPackageJsonScript, execCommand, spawnCommand, walkParentDirs, getNodeBinPath, runNpmInstall, runBundleInstall, runPipInstall, runShellScript, runCustomInstallCommand, getEnvForPackageManager, getNodeVersion, getLatestNodeVersion, getDiscontinuedNodeVersions, getSpawnOptions, getPlatformEnv, streamToBuffer, debug, isSymbolicLink, getLambdaOptionsFromFunction, scanParentDirs, getIgnoreFilter, };
|
18
18
|
export { EdgeFunction } from './edge-function';
|
19
|
-
export { detectBuilders, detectOutputDirectory, detectApiDirectory, detectApiExtensions, } from './detect-builders';
|
20
|
-
export { detectFileSystemAPI } from './detect-file-system-api';
|
21
|
-
export { detectFramework } from './detect-framework';
|
22
|
-
export { getProjectPaths } from './get-project-paths';
|
23
|
-
export { DetectorFilesystem } from './detectors/filesystem';
|
24
19
|
export { readConfigFile } from './fs/read-config-file';
|
25
20
|
export { normalizePath } from './fs/normalize-path';
|
26
21
|
export * from './should-serve';
|
27
22
|
export * from './schemas';
|
28
23
|
export * from './types';
|
29
24
|
export * from './errors';
|
30
|
-
/**
|
31
|
-
* Helper function to support both `@vercel` and legacy `@now` official Runtimes.
|
32
|
-
*/
|
33
|
-
export declare const isOfficialRuntime: (desired: string, name?: string | undefined) => boolean;
|
34
|
-
export declare const isStaticRuntime: (name?: string | undefined) => boolean;
|
35
|
-
export { workspaceManagers } from './workspaces/workspace-managers';
|
36
|
-
export { getWorkspaces, GetWorkspaceOptions, Workspace, WorkspaceType, } from './workspaces/get-workspaces';
|
37
|
-
export { getWorkspacePackagePaths, GetWorkspacePackagePathsOptions, } from './workspaces/get-workspace-package-paths';
|
38
|
-
export { monorepoManagers } from './monorepos/monorepo-managers';
|