@vercel/build-utils 13.26.2 → 13.26.4

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
@@ -1,5 +1,17 @@
1
1
  # @vercel/build-utils
2
2
 
3
+ ## 13.26.4
4
+
5
+ ### Patch Changes
6
+
7
+ - 6495585: [services] drop top-level `env` support for the new `service-ref` shape for services.
8
+
9
+ ## 13.26.3
10
+
11
+ ### Patch Changes
12
+
13
+ - b66bd3e: Fix prebuilt deployments failing with "invalid relative path" when using the `--standalone` flag in pnpm monorepos by skipping external node_modules symlinks and copying traced files at their logical paths instead.
14
+
3
15
  ## 13.26.2
4
16
 
5
17
  ### Patch Changes
@@ -5,5 +5,8 @@ export interface DownloadedFiles {
5
5
  }
6
6
  export declare function isDirectory(mode: number): boolean;
7
7
  export declare function isSymbolicLink(mode: number): boolean;
8
+ export declare function isExternalSymlinkTarget(target: string): boolean;
9
+ export declare function getSymlinkTarget(file: File): string | null;
10
+ export declare function isExternalSymlink(file: File): boolean;
8
11
  export declare function downloadFile(file: File, fsPath: string): Promise<FileFsRef>;
9
12
  export default function download(files: Files, basePath: string, meta?: Meta): Promise<DownloadedFiles>;
@@ -30,7 +30,10 @@ var download_exports = {};
30
30
  __export(download_exports, {
31
31
  default: () => download,
32
32
  downloadFile: () => downloadFile,
33
+ getSymlinkTarget: () => getSymlinkTarget,
33
34
  isDirectory: () => isDirectory,
35
+ isExternalSymlink: () => isExternalSymlink,
36
+ isExternalSymlinkTarget: () => isExternalSymlinkTarget,
34
37
  isSymbolicLink: () => isSymbolicLink
35
38
  });
36
39
  module.exports = __toCommonJS(download_exports);
@@ -48,6 +51,30 @@ function isDirectory(mode) {
48
51
  function isSymbolicLink(mode) {
49
52
  return (mode & S_IFMT) === S_IFLNK;
50
53
  }
54
+ function isExternalSymlinkTarget(target) {
55
+ return target.startsWith("../") || target.startsWith("..\\") || import_path.default.isAbsolute(target);
56
+ }
57
+ function getSymlinkTarget(file) {
58
+ if (!isSymbolicLink(file.mode)) {
59
+ return null;
60
+ }
61
+ if (file.type === "FileFsRef") {
62
+ try {
63
+ return (0, import_fs_extra.readlinkSync)(file.fsPath);
64
+ } catch {
65
+ return null;
66
+ }
67
+ }
68
+ if (file.type === "FileBlob") {
69
+ const { data } = file;
70
+ return typeof data === "string" ? data : data.toString("utf8");
71
+ }
72
+ return null;
73
+ }
74
+ function isExternalSymlink(file) {
75
+ const target = getSymlinkTarget(file);
76
+ return target !== null && isExternalSymlinkTarget(target);
77
+ }
51
78
  async function prepareSymlinkTarget(file, fsPath) {
52
79
  const mkdirPromise = (0, import_fs_extra.mkdirp)(import_path.default.dirname(fsPath));
53
80
  if (file.type === "FileFsRef") {
@@ -124,7 +151,7 @@ async function download(files, basePath, meta) {
124
151
  for (let i = 1; i < parts.length; i++) {
125
152
  const dir = parts.slice(0, i).join("/");
126
153
  const parent = files[dir];
127
- if (parent && isSymbolicLink(parent.mode)) {
154
+ if (parent && isSymbolicLink(parent.mode) && !isExternalSymlink(parent)) {
128
155
  console.warn(
129
156
  `Warning: file "${name}" is within a symlinked directory "${dir}" and will be ignored`
130
157
  );
@@ -143,6 +170,9 @@ async function download(files, basePath, meta) {
143
170
  // Annotate the CommonJS export names for ESM import in node:
144
171
  0 && (module.exports = {
145
172
  downloadFile,
173
+ getSymlinkTarget,
146
174
  isDirectory,
175
+ isExternalSymlink,
176
+ isExternalSymlinkTarget,
147
177
  isSymbolicLink
148
178
  });
package/dist/index.d.ts CHANGED
@@ -4,7 +4,7 @@ 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 } from './prerender';
7
- import download, { downloadFile, DownloadedFiles, isSymbolicLink, isDirectory } from './fs/download';
7
+ import download, { downloadFile, DownloadedFiles, isSymbolicLink, isDirectory, isExternalSymlink, isExternalSymlinkTarget, getSymlinkTarget } from './fs/download';
8
8
  import getWriteableDirectory from './fs/get-writable-directory';
9
9
  import glob, { GlobOptions } from './fs/glob';
10
10
  import rename from './fs/rename';
@@ -20,7 +20,7 @@ import { cloneEnv } from './clone-env';
20
20
  import { hardLinkDir } from './hard-link-dir';
21
21
  import { validateNpmrc } from './validate-npmrc';
22
22
  export type { NodejsLambdaOptions };
23
- export { FileBlob, FileFsRef, FileRef, Lambda, NodejsLambda, createLambda, Prerender, download, downloadFile, DownloadedFiles, getWriteableDirectory, glob, GlobOptions, rename, spawnAsync, getScriptName, installDependencies, runPackageJsonScript, execCommand, spawnCommand, walkParentDirs, getNodeBinPath, getNodeBinPaths, getSupportedNodeVersion, isBunVersion, getSupportedBunVersion, detectPackageManager, runNpmInstall, NpmInstallOutput, runBundleInstall, runPipInstall, PipInstallResult, runShellScript, runCustomInstallCommand, resetCustomInstallCommandSet, getEnvForPackageManager, getNodeVersion, getPathForPackageManager, getLatestNodeVersion, getDiscontinuedNodeVersions, getSpawnOptions, getPlatformEnv, getPrefixedEnvVars, getServiceUrlEnvVars, getExperimentalServiceUrlEnvVars, streamToBuffer, streamToBufferChunks, debug, isSymbolicLink, isDirectory, getLambdaOptionsFromFunction, sanitizeConsumerName, scanParentDirs, findPackageJson, getIgnoreFilter, cloneEnv, hardLinkDir, traverseUpDirectories, validateNpmrc, };
23
+ export { FileBlob, FileFsRef, FileRef, Lambda, NodejsLambda, createLambda, Prerender, download, downloadFile, DownloadedFiles, getWriteableDirectory, glob, GlobOptions, rename, spawnAsync, getScriptName, installDependencies, runPackageJsonScript, execCommand, spawnCommand, walkParentDirs, getNodeBinPath, getNodeBinPaths, getSupportedNodeVersion, isBunVersion, getSupportedBunVersion, 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, };
24
24
  export { EdgeFunction } from './edge-function';
25
25
  export { readConfigFile, getPackageJson } from './fs/read-config-file';
26
26
  export { normalizePath } from './fs/normalize-path';
package/dist/index.js CHANGED
@@ -34571,6 +34571,7 @@ __export(src_exports, {
34571
34571
  getSpawnOptions: () => getSpawnOptions,
34572
34572
  getSupportedBunVersion: () => getSupportedBunVersion,
34573
34573
  getSupportedNodeVersion: () => getSupportedNodeVersion,
34574
+ getSymlinkTarget: () => getSymlinkTarget,
34574
34575
  getWriteableDirectory: () => getWritableDirectory,
34575
34576
  glob: () => glob,
34576
34577
  hardLinkDir: () => hardLinkDir,
@@ -34582,6 +34583,8 @@ __export(src_exports, {
34582
34583
  isDirectory: () => isDirectory,
34583
34584
  isExperimentalBackendsEnabled: () => isExperimentalBackendsEnabled,
34584
34585
  isExperimentalBackendsWithoutIntrospectionEnabled: () => isExperimentalBackendsWithoutIntrospectionEnabled,
34586
+ isExternalSymlink: () => isExternalSymlink,
34587
+ isExternalSymlinkTarget: () => isExternalSymlinkTarget,
34585
34588
  isNodeBackendFramework: () => isNodeBackendFramework,
34586
34589
  isNodeEntrypoint: () => isNodeEntrypoint,
34587
34590
  isPythonEntrypoint: () => isPythonEntrypoint,
@@ -35053,6 +35056,30 @@ function isDirectory(mode) {
35053
35056
  function isSymbolicLink(mode) {
35054
35057
  return (mode & S_IFMT) === S_IFLNK;
35055
35058
  }
35059
+ function isExternalSymlinkTarget(target) {
35060
+ return target.startsWith("../") || target.startsWith("..\\") || import_path2.default.isAbsolute(target);
35061
+ }
35062
+ function getSymlinkTarget(file) {
35063
+ if (!isSymbolicLink(file.mode)) {
35064
+ return null;
35065
+ }
35066
+ if (file.type === "FileFsRef") {
35067
+ try {
35068
+ return (0, import_fs_extra2.readlinkSync)(file.fsPath);
35069
+ } catch {
35070
+ return null;
35071
+ }
35072
+ }
35073
+ if (file.type === "FileBlob") {
35074
+ const { data } = file;
35075
+ return typeof data === "string" ? data : data.toString("utf8");
35076
+ }
35077
+ return null;
35078
+ }
35079
+ function isExternalSymlink(file) {
35080
+ const target = getSymlinkTarget(file);
35081
+ return target !== null && isExternalSymlinkTarget(target);
35082
+ }
35056
35083
  async function prepareSymlinkTarget(file, fsPath) {
35057
35084
  const mkdirPromise = (0, import_fs_extra2.mkdirp)(import_path2.default.dirname(fsPath));
35058
35085
  if (file.type === "FileFsRef") {
@@ -35129,7 +35156,7 @@ async function download(files, basePath, meta) {
35129
35156
  for (let i = 1; i < parts.length; i++) {
35130
35157
  const dir = parts.slice(0, i).join("/");
35131
35158
  const parent = files[dir];
35132
- if (parent && isSymbolicLink(parent.mode)) {
35159
+ if (parent && isSymbolicLink(parent.mode) && !isExternalSymlink(parent)) {
35133
35160
  console.warn(
35134
35161
  `Warning: file "${name}" is within a symlinked directory "${dir}" and will be ignored`
35135
35162
  );
@@ -40381,6 +40408,7 @@ function getExtendedPayload({
40381
40408
  getSpawnOptions,
40382
40409
  getSupportedBunVersion,
40383
40410
  getSupportedNodeVersion,
40411
+ getSymlinkTarget,
40384
40412
  getWriteableDirectory,
40385
40413
  glob,
40386
40414
  hardLinkDir,
@@ -40392,6 +40420,8 @@ function getExtendedPayload({
40392
40420
  isDirectory,
40393
40421
  isExperimentalBackendsEnabled,
40394
40422
  isExperimentalBackendsWithoutIntrospectionEnabled,
40423
+ isExternalSymlink,
40424
+ isExternalSymlinkTarget,
40395
40425
  isNodeBackendFramework,
40396
40426
  isNodeEntrypoint,
40397
40427
  isPythonEntrypoint,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/build-utils",
3
- "version": "13.26.2",
3
+ "version": "13.26.4",
4
4
  "license": "Apache-2.0",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.js",