@vercel/build-utils 7.11.0 → 7.12.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/CHANGELOG.md
CHANGED
@@ -0,0 +1 @@
|
|
1
|
+
export declare function getInstalledPackageVersion(packageName: string, path?: string | string[]): Promise<string | undefined>;
|
@@ -0,0 +1,53 @@
|
|
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 get_installed_package_version_exports = {};
|
30
|
+
__export(get_installed_package_version_exports, {
|
31
|
+
getInstalledPackageVersion: () => getInstalledPackageVersion
|
32
|
+
});
|
33
|
+
module.exports = __toCommonJS(get_installed_package_version_exports);
|
34
|
+
var import_debug = __toESM(require("./debug"));
|
35
|
+
async function getInstalledPackageVersion(packageName, path) {
|
36
|
+
try {
|
37
|
+
const resolved = require.resolve(`${packageName}/package.json`, {
|
38
|
+
paths: path ? Array.isArray(path) ? path : [path] : [process.cwd()]
|
39
|
+
});
|
40
|
+
const version = require(resolved).version;
|
41
|
+
return version;
|
42
|
+
} catch (err) {
|
43
|
+
(0, import_debug.default)(
|
44
|
+
`Could not resolve package "${packageName}". Package is not installed.`,
|
45
|
+
err
|
46
|
+
);
|
47
|
+
return void 0;
|
48
|
+
}
|
49
|
+
}
|
50
|
+
// Annotate the CommonJS export names for ESM import in node:
|
51
|
+
0 && (module.exports = {
|
52
|
+
getInstalledPackageVersion
|
53
|
+
});
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
@@ -20729,6 +20729,7 @@ __export(src_exports, {
|
|
20729
20729
|
getDiscontinuedNodeVersions: () => getDiscontinuedNodeVersions,
|
20730
20730
|
getEnvForPackageManager: () => getEnvForPackageManager,
|
20731
20731
|
getIgnoreFilter: () => get_ignore_filter_default,
|
20732
|
+
getInstalledPackageVersion: () => getInstalledPackageVersion,
|
20732
20733
|
getLambdaOptionsFromFunction: () => getLambdaOptionsFromFunction,
|
20733
20734
|
getLatestNodeVersion: () => getLatestNodeVersion,
|
20734
20735
|
getNodeBinPath: () => getNodeBinPath,
|
@@ -22586,6 +22587,23 @@ var buildsSchema = {
|
|
22586
22587
|
}
|
22587
22588
|
}
|
22588
22589
|
};
|
22590
|
+
|
22591
|
+
// src/get-installed-package-version.ts
|
22592
|
+
async function getInstalledPackageVersion(packageName, path7) {
|
22593
|
+
try {
|
22594
|
+
const resolved = require.resolve(`${packageName}/package.json`, {
|
22595
|
+
paths: path7 ? Array.isArray(path7) ? path7 : [path7] : [process.cwd()]
|
22596
|
+
});
|
22597
|
+
const version = require(resolved).version;
|
22598
|
+
return version;
|
22599
|
+
} catch (err) {
|
22600
|
+
debug(
|
22601
|
+
`Could not resolve package "${packageName}". Package is not installed.`,
|
22602
|
+
err
|
22603
|
+
);
|
22604
|
+
return void 0;
|
22605
|
+
}
|
22606
|
+
}
|
22589
22607
|
// Annotate the CommonJS export names for ESM import in node:
|
22590
22608
|
0 && (module.exports = {
|
22591
22609
|
EdgeFunction,
|
@@ -22608,6 +22626,7 @@ var buildsSchema = {
|
|
22608
22626
|
getDiscontinuedNodeVersions,
|
22609
22627
|
getEnvForPackageManager,
|
22610
22628
|
getIgnoreFilter,
|
22629
|
+
getInstalledPackageVersion,
|
22611
22630
|
getLambdaOptionsFromFunction,
|
22612
22631
|
getLatestNodeVersion,
|
22613
22632
|
getNodeBinPath,
|