@vercel/build-utils 13.26.5 → 13.27.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 +14 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +32 -0
- package/dist/is-package-installed.d.ts +1 -0
- package/dist/is-package-installed.js +53 -0
- package/dist/types.d.ts +49 -39
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @vercel/build-utils
|
|
2
2
|
|
|
3
|
+
## 13.27.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 338cc35: Add isPackageInstalled util for detecting dependencies during build.
|
|
8
|
+
Fix Vercel Flags dependency detection for emitting datafiles during builds with OIDC tokens.
|
|
9
|
+
|
|
10
|
+
## 13.26.6
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- 3019788: [services] Remove the `services` field from `vercel.json` and the `VERCEL_USE_SERVICES` gate.
|
|
15
|
+
- fe893ec: [services] Add `experimentalServicesV2` field to `vercel.json` implementing the new schema for services.
|
|
16
|
+
|
|
3
17
|
## 13.26.5
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
package/dist/index.d.ts
CHANGED
|
@@ -34,6 +34,7 @@ export * from './errors';
|
|
|
34
34
|
export * from './trace';
|
|
35
35
|
export { NODE_VERSIONS } from './fs/node-version';
|
|
36
36
|
export { getInstalledPackageVersion } from './get-installed-package-version';
|
|
37
|
+
export { isPackageInstalled } from './is-package-installed';
|
|
37
38
|
export { defaultCachePathGlob } from './default-cache-path-glob';
|
|
38
39
|
export { generateNodeBuilderFunctions } from './generate-node-builder-functions';
|
|
39
40
|
export { BACKEND_FRAMEWORKS, BACKEND_BUILDERS, UNIFIED_BACKEND_BUILDER, BackendFramework, isBackendFramework, isNodeBackendFramework, isBackendBuilder, isExperimentalBackendsEnabled, isExperimentalBackendsWithoutIntrospectionEnabled, shouldUseExperimentalBackends, PYTHON_FRAMEWORKS, PythonFramework, isPythonFramework, } from './framework-helpers';
|
package/dist/index.js
CHANGED
|
@@ -18367,6 +18367,8 @@ var require_dist = __commonJS({
|
|
|
18367
18367
|
var src_exports2 = {};
|
|
18368
18368
|
__export2(src_exports2, {
|
|
18369
18369
|
errorToString: () => errorToString,
|
|
18370
|
+
errorToStringFriendly: () => errorToStringFriendly,
|
|
18371
|
+
getSystemErrorMessage: () => getSystemErrorMessage,
|
|
18370
18372
|
isErrnoException: () => isErrnoException3,
|
|
18371
18373
|
isError: () => isError,
|
|
18372
18374
|
isErrorLike: () => isErrorLike,
|
|
@@ -18383,6 +18385,10 @@ var require_dist = __commonJS({
|
|
|
18383
18385
|
var isErrnoException3 = (error) => {
|
|
18384
18386
|
return isError(error) && "code" in error;
|
|
18385
18387
|
};
|
|
18388
|
+
var nativeGetSystemErrorMessage = import_node_util.default.getSystemErrorMessage;
|
|
18389
|
+
var getSystemErrorMessageFallback = (errno) => {
|
|
18390
|
+
return import_node_util.default.getSystemErrorMap().get(errno)?.[1] ?? `Unknown system error ${errno}`;
|
|
18391
|
+
};
|
|
18386
18392
|
var isErrorLike = (error) => isObject(error) && "message" in error;
|
|
18387
18393
|
var errorToString = (error, fallback) => {
|
|
18388
18394
|
if (isError(error) || isErrorLike(error))
|
|
@@ -18391,6 +18397,13 @@ var require_dist = __commonJS({
|
|
|
18391
18397
|
return error;
|
|
18392
18398
|
return fallback ?? "An unknown error has ocurred.";
|
|
18393
18399
|
};
|
|
18400
|
+
var getSystemErrorMessage = nativeGetSystemErrorMessage ?? getSystemErrorMessageFallback;
|
|
18401
|
+
var errorToStringFriendly = (error, fallback) => {
|
|
18402
|
+
if (isErrnoException3(error) && typeof error.errno === "number") {
|
|
18403
|
+
return getSystemErrorMessage(error.errno);
|
|
18404
|
+
}
|
|
18405
|
+
return errorToString(error, fallback);
|
|
18406
|
+
};
|
|
18394
18407
|
var normalizeError = (error) => {
|
|
18395
18408
|
if (isError(error))
|
|
18396
18409
|
return error;
|
|
@@ -34587,6 +34600,7 @@ __export(src_exports, {
|
|
|
34587
34600
|
isExternalSymlinkTarget: () => isExternalSymlinkTarget,
|
|
34588
34601
|
isNodeBackendFramework: () => isNodeBackendFramework,
|
|
34589
34602
|
isNodeEntrypoint: () => isNodeEntrypoint,
|
|
34603
|
+
isPackageInstalled: () => isPackageInstalled,
|
|
34590
34604
|
isPythonEntrypoint: () => isPythonEntrypoint,
|
|
34591
34605
|
isPythonFramework: () => isPythonFramework,
|
|
34592
34606
|
isQueueBackedService: () => isQueueBackedService,
|
|
@@ -38999,6 +39013,23 @@ async function getInstalledPackageVersion(packageName, path8) {
|
|
|
38999
39013
|
}
|
|
39000
39014
|
}
|
|
39001
39015
|
|
|
39016
|
+
// src/is-package-installed.ts
|
|
39017
|
+
async function isPackageInstalled(packageName, path8) {
|
|
39018
|
+
try {
|
|
39019
|
+
const resolved = require.resolve(packageName, {
|
|
39020
|
+
paths: path8 ? Array.isArray(path8) ? path8 : [path8] : [process.cwd()]
|
|
39021
|
+
});
|
|
39022
|
+
require(resolved);
|
|
39023
|
+
return true;
|
|
39024
|
+
} catch (err) {
|
|
39025
|
+
debug(
|
|
39026
|
+
`Could not resolve package "${packageName}". Package is not installed.`,
|
|
39027
|
+
err
|
|
39028
|
+
);
|
|
39029
|
+
return false;
|
|
39030
|
+
}
|
|
39031
|
+
}
|
|
39032
|
+
|
|
39002
39033
|
// src/default-cache-path-glob.ts
|
|
39003
39034
|
var defaultCachePathGlob = "**/{node_modules,.yarn/cache}/**";
|
|
39004
39035
|
|
|
@@ -40424,6 +40455,7 @@ function getExtendedPayload({
|
|
|
40424
40455
|
isExternalSymlinkTarget,
|
|
40425
40456
|
isNodeBackendFramework,
|
|
40426
40457
|
isNodeEntrypoint,
|
|
40458
|
+
isPackageInstalled,
|
|
40427
40459
|
isPythonEntrypoint,
|
|
40428
40460
|
isPythonFramework,
|
|
40429
40461
|
isQueueBackedService,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function isPackageInstalled(packageName: string, path?: string | string[]): Promise<boolean>;
|
|
@@ -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 is_package_installed_exports = {};
|
|
30
|
+
__export(is_package_installed_exports, {
|
|
31
|
+
isPackageInstalled: () => isPackageInstalled
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(is_package_installed_exports);
|
|
34
|
+
var import_debug = __toESM(require("./debug"));
|
|
35
|
+
async function isPackageInstalled(packageName, path) {
|
|
36
|
+
try {
|
|
37
|
+
const resolved = require.resolve(packageName, {
|
|
38
|
+
paths: path ? Array.isArray(path) ? path : [path] : [process.cwd()]
|
|
39
|
+
});
|
|
40
|
+
require(resolved);
|
|
41
|
+
return true;
|
|
42
|
+
} catch (err) {
|
|
43
|
+
(0, import_debug.default)(
|
|
44
|
+
`Could not resolve package "${packageName}". Package is not installed.`,
|
|
45
|
+
err
|
|
46
|
+
);
|
|
47
|
+
return false;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
51
|
+
0 && (module.exports = {
|
|
52
|
+
isPackageInstalled
|
|
53
|
+
});
|
package/dist/types.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ import type { Lambda, LambdaArchitecture } from './lambda';
|
|
|
5
5
|
import type { Prerender } from './prerender';
|
|
6
6
|
import type { EdgeFunction } from './edge-function';
|
|
7
7
|
import type { Span } from './trace';
|
|
8
|
-
import type { HasField } from '@vercel/routing-utils';
|
|
8
|
+
import type { HasField, Route, Rewrite, Redirect, Header } from '@vercel/routing-utils';
|
|
9
9
|
export interface Env {
|
|
10
10
|
[name: string]: string | undefined;
|
|
11
11
|
}
|
|
@@ -775,54 +775,64 @@ export interface ExperimentalServiceConfig {
|
|
|
775
775
|
*/
|
|
776
776
|
export type ExperimentalServices = Record<string, ExperimentalServiceConfig>;
|
|
777
777
|
/**
|
|
778
|
-
*
|
|
778
|
+
* Map of service group name to array of service names belonging to that group.
|
|
779
|
+
* @experimental This feature is experimental and may change.
|
|
780
|
+
* @example
|
|
781
|
+
* {
|
|
782
|
+
* "app": ["site", "backend"],
|
|
783
|
+
* "admin": ["admin", "backend"]
|
|
784
|
+
* }
|
|
779
785
|
*/
|
|
780
|
-
export
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
786
|
+
export type ExperimentalServiceGroups = Record<string, string[]>;
|
|
787
|
+
export interface ExperimentalServiceV2Binding {
|
|
788
|
+
/** Must be `"service"` for Service-to-Service HTTP bindings. */
|
|
789
|
+
type: 'service';
|
|
790
|
+
/** Target service name from `experimentalServicesV2`. */
|
|
791
|
+
service: string;
|
|
792
|
+
/** Generated value shape, must be `"url"`. */
|
|
793
|
+
format: 'url';
|
|
794
|
+
/** Environment variable name that will store the generated value */
|
|
795
|
+
env: string;
|
|
796
|
+
}
|
|
797
|
+
/**
|
|
798
|
+
* Configuration for a service in `experimentalServicesV2` in `vercel.json`.
|
|
799
|
+
*
|
|
800
|
+
* @experimental This feature is experimental and may change.
|
|
801
|
+
*/
|
|
802
|
+
export interface ExperimentalServiceV2Config {
|
|
803
|
+
/** Path to the service root, relative to `vercel.json`. */
|
|
804
|
+
root: string;
|
|
805
|
+
/** Framework for this service. */
|
|
806
|
+
framework?: string;
|
|
807
|
+
/** Runtime for this service. */
|
|
808
|
+
runtime?: string;
|
|
789
809
|
/**
|
|
790
810
|
* Service entrypoint, relative to the service root directory.
|
|
791
|
-
* Can be
|
|
792
|
-
* (service workspace for framework-based services).
|
|
811
|
+
* Can be a file path or a module specification (for Python).
|
|
793
812
|
*/
|
|
794
813
|
entrypoint?: string;
|
|
795
|
-
|
|
796
|
-
framework?: string;
|
|
797
|
-
/** Specific lambda runtime to use, e.g. nodejs24.x, python3.14 */
|
|
798
|
-
runtime?: string;
|
|
814
|
+
installCommand?: string;
|
|
799
815
|
buildCommand?: string;
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
816
|
+
devCommand?: string;
|
|
817
|
+
ignoreCommand?: string;
|
|
818
|
+
outputDirectory?: string;
|
|
819
|
+
/** Caller-side bindings that grant this service access to another service. */
|
|
820
|
+
bindings?: ExperimentalServiceV2Binding[];
|
|
821
|
+
/** Function configuration scoped to this service root. */
|
|
822
|
+
functions?: BuilderFunctions;
|
|
823
|
+
headers?: Header[];
|
|
824
|
+
redirects?: Redirect[];
|
|
825
|
+
rewrites?: Rewrite[];
|
|
826
|
+
routes?: Route[];
|
|
827
|
+
cleanUrls?: boolean;
|
|
828
|
+
trailingSlash?: boolean;
|
|
811
829
|
}
|
|
812
830
|
/**
|
|
813
|
-
* Map of service name to
|
|
814
|
-
|
|
815
|
-
export type Services = Record<string, ServiceConfig>;
|
|
816
|
-
/**
|
|
817
|
-
* Map of service group name to array of service names belonging to that group.
|
|
831
|
+
* Map of service name to service configuration for `experimentalServicesV2`.
|
|
832
|
+
*
|
|
818
833
|
* @experimental This feature is experimental and may change.
|
|
819
|
-
* @example
|
|
820
|
-
* {
|
|
821
|
-
* "app": ["site", "backend"],
|
|
822
|
-
* "admin": ["admin", "backend"]
|
|
823
|
-
* }
|
|
824
834
|
*/
|
|
825
|
-
export type
|
|
835
|
+
export type ExperimentalServicesV2 = Record<string, ExperimentalServiceV2Config>;
|
|
826
836
|
/**
|
|
827
837
|
* Result of a runtime builder's normalized entrypoint detection.
|
|
828
838
|
*
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vercel/build-utils",
|
|
3
|
-
"version": "13.
|
|
3
|
+
"version": "13.27.0",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.js",
|
|
@@ -55,8 +55,8 @@
|
|
|
55
55
|
"vitest": "2.0.1",
|
|
56
56
|
"typescript": "4.9.5",
|
|
57
57
|
"yazl": "2.5.1",
|
|
58
|
-
"@vercel/
|
|
59
|
-
"@vercel/
|
|
58
|
+
"@vercel/routing-utils": "6.2.0",
|
|
59
|
+
"@vercel/error-utils": "2.2.0"
|
|
60
60
|
},
|
|
61
61
|
"scripts": {
|
|
62
62
|
"build": "node build.mjs",
|