Socket
Socket
Sign inDemoInstall

@vercel/build-utils

Package Overview
Dependencies
Maintainers
14
Versions
311
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@vercel/build-utils - npm Package Compare versions

Comparing version 2.4.2-canary.0 to 2.4.2-canary.1

5

dist/fs/run-user-scripts.d.ts
/// <reference types="node" />
import { SpawnOptions } from 'child_process';
import { Meta, NodeVersion, Config } from '../types';
import { Meta, PackageJson, NodeVersion, Config } from '../types';
interface SpawnOptionsExtended extends SpawnOptions {

@@ -41,3 +41,4 @@ prettyCommand?: string;

export declare function runPipInstall(destPath: string, args?: string[], spawnOpts?: SpawnOptions, meta?: Meta): Promise<void>;
export declare function runPackageJsonScript(destPath: string, scriptName: string, spawnOpts?: SpawnOptions): Promise<boolean>;
export declare function getScriptName(pkg: Pick<PackageJson, 'scripts'> | null | undefined, possibleNames: Iterable<string>): string | null;
export declare function runPackageJsonScript(destPath: string, scriptNames: string | Iterable<string>, spawnOpts?: SpawnOptions): Promise<boolean>;
/**

@@ -44,0 +45,0 @@ * @deprecate installDependencies() is deprecated.

25

dist/fs/run-user-scripts.js

@@ -6,3 +6,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.installDependencies = exports.runPackageJsonScript = exports.runPipInstall = exports.runBundleInstall = exports.runNpmInstall = exports.walkParentDirs = exports.getNodeVersion = exports.getSpawnOptions = exports.runShellScript = exports.getNodeBinPath = exports.execCommand = exports.spawnCommand = exports.execAsync = exports.spawnAsync = void 0;
exports.installDependencies = exports.runPackageJsonScript = exports.getScriptName = exports.runPipInstall = exports.runBundleInstall = exports.runNpmInstall = exports.walkParentDirs = exports.getNodeVersion = exports.getSpawnOptions = exports.runShellScript = exports.getNodeBinPath = exports.execCommand = exports.spawnCommand = exports.execAsync = exports.spawnAsync = void 0;
const assert_1 = __importDefault(require("assert"));

@@ -251,11 +251,21 @@ const fs_extra_1 = __importDefault(require("fs-extra"));

exports.runPipInstall = runPipInstall;
async function runPackageJsonScript(destPath, scriptName, spawnOpts) {
function getScriptName(pkg, possibleNames) {
if (pkg && pkg.scripts) {
for (const name of possibleNames) {
if (name in pkg.scripts) {
return name;
}
}
}
return null;
}
exports.getScriptName = getScriptName;
async function runPackageJsonScript(destPath, scriptNames, spawnOpts) {
assert_1.default(path_1.default.isAbsolute(destPath));
const { packageJson, cliType } = await scanParentDirs(destPath, true);
const hasScript = Boolean(packageJson &&
packageJson.scripts &&
scriptName &&
packageJson.scripts[scriptName]);
if (!hasScript)
const scriptName = getScriptName(packageJson, typeof scriptNames === 'string' ? [scriptNames] : scriptNames);
if (!scriptName)
return false;
debug_1.default('Running user script...');
const runScriptTime = Date.now();
if (cliType === 'npm') {

@@ -279,2 +289,3 @@ const prettyCommand = `npm run ${scriptName}`;

}
debug_1.default(`Script complete [${Date.now() - runScriptTime}ms]`);
return true;

@@ -281,0 +292,0 @@ }

@@ -10,3 +10,3 @@ import FileBlob from './file-blob';

import rename from './fs/rename';
import { execAsync, spawnAsync, execCommand, spawnCommand, walkParentDirs, installDependencies, runPackageJsonScript, runNpmInstall, runBundleInstall, runPipInstall, runShellScript, getNodeVersion, getSpawnOptions, getNodeBinPath } from './fs/run-user-scripts';
import { execAsync, spawnAsync, execCommand, spawnCommand, walkParentDirs, getScriptName, installDependencies, runPackageJsonScript, runNpmInstall, runBundleInstall, runPipInstall, runShellScript, getNodeVersion, getSpawnOptions, getNodeBinPath } from './fs/run-user-scripts';
import { getLatestNodeVersion, getDiscontinuedNodeVersions } from './fs/node-version';

@@ -16,3 +16,3 @@ import streamToBuffer from './fs/stream-to-buffer';

import debug from './debug';
export { FileBlob, FileFsRef, FileRef, Lambda, createLambda, Prerender, download, DownloadedFiles, getWriteableDirectory, glob, GlobOptions, rename, execAsync, spawnAsync, installDependencies, runPackageJsonScript, execCommand, spawnCommand, walkParentDirs, getNodeBinPath, runNpmInstall, runBundleInstall, runPipInstall, runShellScript, getNodeVersion, getLatestNodeVersion, getDiscontinuedNodeVersions, getSpawnOptions, streamToBuffer, shouldServe, debug, isSymbolicLink, getLambdaOptionsFromFunction, };
export { FileBlob, FileFsRef, FileRef, Lambda, createLambda, Prerender, download, DownloadedFiles, getWriteableDirectory, glob, GlobOptions, rename, execAsync, spawnAsync, getScriptName, installDependencies, runPackageJsonScript, execCommand, spawnCommand, walkParentDirs, getNodeBinPath, runNpmInstall, runBundleInstall, runPipInstall, runShellScript, getNodeVersion, getLatestNodeVersion, getDiscontinuedNodeVersions, getSpawnOptions, streamToBuffer, shouldServe, debug, isSymbolicLink, getLambdaOptionsFromFunction, };
export { detectBuilders, detectOutputDirectory, detectApiDirectory, detectApiExtensions, } from './detect-builders';

@@ -19,0 +19,0 @@ export { detectFramework } from './detect-framework';

{
"name": "@vercel/build-utils",
"version": "2.4.2-canary.0",
"version": "2.4.2-canary.1",
"license": "MIT",

@@ -51,3 +51,3 @@ "main": "./dist/index.js",

},
"gitHead": "1a1271509609ff0e48f947d61f0a267798238cd7"
"gitHead": "727ae587dbe3582f85e252ff32c57f70c41e7c1c"
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc