@vercel/build-utils 14.4.0 → 14.5.1
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 +18 -0
- package/dist/fs/run-user-scripts.d.ts +0 -1
- package/dist/fs/run-user-scripts.js +46 -74
- package/dist/generate-node-builder-functions.js +16 -0
- package/dist/index.js +98 -92
- package/dist/trace/trace.d.ts +8 -0
- package/dist/trace/trace.js +16 -0
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @vercel/build-utils
|
|
2
2
|
|
|
3
|
+
## 14.5.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- a443e57: Revert dependency install log rewriting that piped pnpm stdout through an unread Transform and could hang large installs.
|
|
8
|
+
|
|
9
|
+
## 14.5.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- 90afd71: Expose the resolved rewrite destination as the request path observed by Node backend framework applications (express, hono, h3, koa, nestjs, fastify, elysia) and the unified backends builder, and warn affected backend projects about the behavior change.
|
|
14
|
+
|
|
15
|
+
## 14.4.1
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- e5b0363: Add `Span.reportChildEvents()` so a tree of trace events produced in another process (e.g. a forked build worker) can be reported under an existing span. Its root events are reparented to that span while links internal to the set are preserved, keeping trace nesting intact.
|
|
20
|
+
|
|
3
21
|
## 14.4.0
|
|
4
22
|
|
|
5
23
|
### Minor Changes
|
|
@@ -129,7 +129,6 @@ export declare function usingCorepack(env: {
|
|
|
129
129
|
[x: string]: string | undefined;
|
|
130
130
|
}, packageJsonPackageManager: string | undefined, turboSupportsCorepackHome: boolean | undefined): boolean;
|
|
131
131
|
export declare function walkParentDirs({ base, start, filename, }: WalkParentDirsProps): Promise<string | null>;
|
|
132
|
-
export declare function stripPnpmVersionFooter(line: string): string;
|
|
133
132
|
/**
|
|
134
133
|
* Reset the customInstallCommandSet. This should be called at the start of each build
|
|
135
134
|
* to prevent custom install commands from being skipped due to the set persisting
|
|
@@ -52,7 +52,6 @@ __export(run_user_scripts_exports, {
|
|
|
52
52
|
scanParentDirs: () => scanParentDirs,
|
|
53
53
|
spawnAsync: () => spawnAsync,
|
|
54
54
|
spawnCommand: () => spawnCommand,
|
|
55
|
-
stripPnpmVersionFooter: () => stripPnpmVersionFooter,
|
|
56
55
|
traverseUpDirectories: () => traverseUpDirectories,
|
|
57
56
|
turboVersionSpecifierSupportsCorepack: () => turboVersionSpecifierSupportsCorepack,
|
|
58
57
|
usingCorepack: () => usingCorepack,
|
|
@@ -65,7 +64,6 @@ var import_path = __toESM(require("path"));
|
|
|
65
64
|
var import_async_sema = __toESM(require("async-sema"));
|
|
66
65
|
var import_cross_spawn = __toESM(require("cross-spawn"));
|
|
67
66
|
var import_semver = require("semver");
|
|
68
|
-
var import_stream = require("stream");
|
|
69
67
|
var import_util = require("util");
|
|
70
68
|
var import_debug = __toESM(require("../debug"));
|
|
71
69
|
var import_errors = require("../errors");
|
|
@@ -578,29 +576,6 @@ function getInstallCommandForPackageManager(packageManager, args) {
|
|
|
578
576
|
};
|
|
579
577
|
}
|
|
580
578
|
}
|
|
581
|
-
function stripPnpmVersionFooter(line) {
|
|
582
|
-
return line.replace(/ using pnpm v\d+\.\d+\.\d+(?=\r?$)/, "");
|
|
583
|
-
}
|
|
584
|
-
function createPnpmOutputFilter(destination) {
|
|
585
|
-
let incompleteLine = "";
|
|
586
|
-
return new import_stream.Transform({
|
|
587
|
-
transform(chunk, _encoding, callback) {
|
|
588
|
-
const lines = `${incompleteLine}${chunk.toString()}`.split("\n");
|
|
589
|
-
incompleteLine = lines.pop() ?? "";
|
|
590
|
-
for (const line of lines) {
|
|
591
|
-
destination.write(`${stripPnpmVersionFooter(line)}
|
|
592
|
-
`);
|
|
593
|
-
}
|
|
594
|
-
callback();
|
|
595
|
-
},
|
|
596
|
-
flush(callback) {
|
|
597
|
-
if (incompleteLine) {
|
|
598
|
-
destination.write(stripPnpmVersionFooter(incompleteLine));
|
|
599
|
-
}
|
|
600
|
-
callback();
|
|
601
|
-
}
|
|
602
|
-
});
|
|
603
|
-
}
|
|
604
579
|
async function runInstallCommand({
|
|
605
580
|
packageManager,
|
|
606
581
|
args,
|
|
@@ -612,9 +587,8 @@ async function runInstallCommand({
|
|
|
612
587
|
if (process.env.NPM_ONLY_PRODUCTION) {
|
|
613
588
|
commandArguments.push("--production");
|
|
614
589
|
}
|
|
615
|
-
|
|
616
|
-
opts.
|
|
617
|
-
opts.errorStream = shouldFilterPnpmOutput ? output?.stderr ?? process.stderr : output?.stderr;
|
|
590
|
+
opts.outputStream = output?.stdout;
|
|
591
|
+
opts.errorStream = output?.stderr;
|
|
618
592
|
await spawnAsync(packageManager, commandArguments, opts);
|
|
619
593
|
}
|
|
620
594
|
function initializeSet(set) {
|
|
@@ -697,6 +671,12 @@ async function runNpmInstall(destPath, args = [], spawnOpts, meta, projectCreate
|
|
|
697
671
|
}
|
|
698
672
|
}
|
|
699
673
|
const installTime = Date.now();
|
|
674
|
+
if (output?.stdout) {
|
|
675
|
+
output.stdout.write("Installing dependencies...\n");
|
|
676
|
+
} else {
|
|
677
|
+
console.log("Installing dependencies...");
|
|
678
|
+
}
|
|
679
|
+
(0, import_debug.default)(`Installing to ${destPath}`);
|
|
700
680
|
const opts = { cwd: destPath, ...spawnOpts };
|
|
701
681
|
const env = (0, import_clone_env.cloneEnv)(opts.env || process.env);
|
|
702
682
|
delete env.NODE_ENV;
|
|
@@ -710,20 +690,6 @@ async function runNpmInstall(destPath, args = [], spawnOpts, meta, projectCreate
|
|
|
710
690
|
turboSupportsCorepackHome,
|
|
711
691
|
projectCreatedAt
|
|
712
692
|
});
|
|
713
|
-
const packageManager = getPackageManagerDisplayName({
|
|
714
|
-
cliType,
|
|
715
|
-
lockfileVersion,
|
|
716
|
-
packageJsonPackageManager,
|
|
717
|
-
env: opts.env
|
|
718
|
-
});
|
|
719
|
-
const installMessage = `Installing dependencies with ${packageManager}`;
|
|
720
|
-
if (output?.stdout) {
|
|
721
|
-
output.stdout.write(`${installMessage}
|
|
722
|
-
`);
|
|
723
|
-
} else {
|
|
724
|
-
console.log(installMessage);
|
|
725
|
-
}
|
|
726
|
-
(0, import_debug.default)(`Installing to ${destPath}`);
|
|
727
693
|
const maySeeDynamicRequireYarnBug = process.env?.ENABLE_EXPERIMENTAL_COREPACK && packageJson?.packageManager?.startsWith("yarn") && packageJson?.type === "module";
|
|
728
694
|
if (maySeeDynamicRequireYarnBug) {
|
|
729
695
|
console.warn(
|
|
@@ -742,37 +708,6 @@ async function runNpmInstall(destPath, args = [], spawnOpts, meta, projectCreate
|
|
|
742
708
|
runNpmInstallSema.release();
|
|
743
709
|
}
|
|
744
710
|
}
|
|
745
|
-
function getPackageManagerDisplayName({
|
|
746
|
-
cliType,
|
|
747
|
-
lockfileVersion,
|
|
748
|
-
packageJsonPackageManager,
|
|
749
|
-
env
|
|
750
|
-
}) {
|
|
751
|
-
const versionResult = import_cross_spawn.default.sync(cliType, ["--version"], {
|
|
752
|
-
env,
|
|
753
|
-
encoding: "utf8"
|
|
754
|
-
});
|
|
755
|
-
const version = versionResult.status === 0 ? versionResult.stdout.trim() : "";
|
|
756
|
-
if (version) {
|
|
757
|
-
return `${cliType} ${version}`;
|
|
758
|
-
}
|
|
759
|
-
if (packageJsonPackageManager && env.ENABLE_EXPERIMENTAL_COREPACK) {
|
|
760
|
-
return packageJsonPackageManager.replace("@", " ");
|
|
761
|
-
}
|
|
762
|
-
if (cliType === "pnpm") {
|
|
763
|
-
const selectedPath = env.PATH?.split(import_path.default.delimiter).find(
|
|
764
|
-
(segment) => /^\/pnpm\d+\/node_modules\/\.bin$/.test(segment)
|
|
765
|
-
);
|
|
766
|
-
const major = selectedPath?.match(/^\/pnpm(\d+)\//)?.[1];
|
|
767
|
-
if (major) {
|
|
768
|
-
return `pnpm ${major}`;
|
|
769
|
-
}
|
|
770
|
-
}
|
|
771
|
-
if (cliType === "yarn") {
|
|
772
|
-
return detectYarnVersion(lockfileVersion).replace("@", " ").replace(/\.x$/, "");
|
|
773
|
-
}
|
|
774
|
-
return cliType;
|
|
775
|
-
}
|
|
776
711
|
function getEnvForPackageManager({
|
|
777
712
|
cliType,
|
|
778
713
|
lockfileVersion,
|
|
@@ -831,6 +766,44 @@ function getEnvForPackageManager({
|
|
|
831
766
|
if (pathsToPrepend.length > 0) {
|
|
832
767
|
const oldPath = env.PATH + "";
|
|
833
768
|
newEnv.PATH = `${pathsToPrepend.join(import_path.default.delimiter)}${oldPath ? import_path.default.delimiter : ""}${oldPath}`;
|
|
769
|
+
if (newPath && pathsToPrepend.includes(newPath) && detectedLockfile && detectedPackageManager) {
|
|
770
|
+
const versionString = cliType === "pnpm" ? `version ${lockfileVersion} ` : "";
|
|
771
|
+
const pin = resolveCompatiblePnpmPin({
|
|
772
|
+
cliType,
|
|
773
|
+
lockfileVersion,
|
|
774
|
+
packageJsonDevEngines,
|
|
775
|
+
corepackPackageManager: packageJsonPackageManager
|
|
776
|
+
});
|
|
777
|
+
const usedPin = Boolean(pin) && detectedPackageManager === pin?.override.detectedPackageManager;
|
|
778
|
+
const lockfileDefault = detectPackageManager(
|
|
779
|
+
cliType,
|
|
780
|
+
lockfileVersion,
|
|
781
|
+
projectCreatedAt,
|
|
782
|
+
nodeVersion
|
|
783
|
+
);
|
|
784
|
+
const usedEnginesSelector = Boolean(packageJsonEngines?.pnpm) && !usedPin && detectedPackageManager !== lockfileDefault?.detectedPackageManager;
|
|
785
|
+
const detectedV9PnpmLockfile = detectedLockfile === "pnpm-lock.yaml" && lockfileVersion === 9;
|
|
786
|
+
if (usedPin && pin) {
|
|
787
|
+
const pinField = pin.source === "devEngines" ? "package.json#devEngines.packageManager" : `package.json#packageManager ${packageJsonPackageManager}`;
|
|
788
|
+
console.log(
|
|
789
|
+
`Detected \`${detectedLockfile}\` ${versionString}generated by ${detectedPackageManager} from ${pinField}`
|
|
790
|
+
);
|
|
791
|
+
} else if (usedEnginesSelector) {
|
|
792
|
+
console.log(
|
|
793
|
+
`Detected \`${detectedLockfile}\` ${versionString}generated by ${detectedPackageManager} from package.json#engines.pnpm ${packageJsonEngines?.pnpm}`
|
|
794
|
+
);
|
|
795
|
+
} else if (detectedV9PnpmLockfile) {
|
|
796
|
+
console.log(
|
|
797
|
+
`Detected \`${detectedLockfile}\` ${lockfileVersion} which may be generated by pnpm@9.x, pnpm@10.x, or pnpm@11.x
|
|
798
|
+
Using ${detectedPackageManager} based on project creation date
|
|
799
|
+
To use a different version, set package.json#packageManager or package.json#devEngines.packageManager`
|
|
800
|
+
);
|
|
801
|
+
} else {
|
|
802
|
+
console.log(
|
|
803
|
+
`Detected \`${detectedLockfile}\` ${versionString}generated by ${detectedPackageManager}`
|
|
804
|
+
);
|
|
805
|
+
}
|
|
806
|
+
}
|
|
834
807
|
}
|
|
835
808
|
if (cliType === "yarn" && !env.YARN_NODE_LINKER) {
|
|
836
809
|
newEnv.YARN_NODE_LINKER = "node-modules";
|
|
@@ -1396,7 +1369,6 @@ const installDependencies = (0, import_util.deprecate)(
|
|
|
1396
1369
|
scanParentDirs,
|
|
1397
1370
|
spawnAsync,
|
|
1398
1371
|
spawnCommand,
|
|
1399
|
-
stripPnpmVersionFooter,
|
|
1400
1372
|
traverseUpDirectories,
|
|
1401
1373
|
turboVersionSpecifierSupportsCorepack,
|
|
1402
1374
|
usingCorepack,
|
|
@@ -76,6 +76,22 @@ function generateNodeBuilderFunctions(frameworkName, regex, validFilenames, vali
|
|
|
76
76
|
slug: frameworkName,
|
|
77
77
|
version
|
|
78
78
|
};
|
|
79
|
+
if (!res.routes) {
|
|
80
|
+
res.routes = [
|
|
81
|
+
{ handle: "filesystem" },
|
|
82
|
+
{
|
|
83
|
+
src: "/(.*)",
|
|
84
|
+
dest: "/",
|
|
85
|
+
transforms: [
|
|
86
|
+
{
|
|
87
|
+
type: "request.path",
|
|
88
|
+
op: "set",
|
|
89
|
+
args: "/$1"
|
|
90
|
+
}
|
|
91
|
+
]
|
|
92
|
+
}
|
|
93
|
+
];
|
|
94
|
+
}
|
|
79
95
|
return res;
|
|
80
96
|
};
|
|
81
97
|
const entrypointCallback = async (args) => {
|
package/dist/index.js
CHANGED
|
@@ -2024,11 +2024,11 @@ var require_stream_readable = __commonJS({
|
|
|
2024
2024
|
var require_stream_transform = __commonJS({
|
|
2025
2025
|
"../../node_modules/.pnpm/readable-stream@2.3.8/node_modules/readable-stream/lib/_stream_transform.js"(exports, module2) {
|
|
2026
2026
|
"use strict";
|
|
2027
|
-
module2.exports =
|
|
2027
|
+
module2.exports = Transform;
|
|
2028
2028
|
var Duplex = require_stream_duplex();
|
|
2029
2029
|
var util = Object.create(require_util());
|
|
2030
2030
|
util.inherits = require_inherits();
|
|
2031
|
-
util.inherits(
|
|
2031
|
+
util.inherits(Transform, Duplex);
|
|
2032
2032
|
function afterTransform(er, data) {
|
|
2033
2033
|
var ts = this._transformState;
|
|
2034
2034
|
ts.transforming = false;
|
|
@@ -2047,9 +2047,9 @@ var require_stream_transform = __commonJS({
|
|
|
2047
2047
|
this._read(rs.highWaterMark);
|
|
2048
2048
|
}
|
|
2049
2049
|
}
|
|
2050
|
-
function
|
|
2051
|
-
if (!(this instanceof
|
|
2052
|
-
return new
|
|
2050
|
+
function Transform(options) {
|
|
2051
|
+
if (!(this instanceof Transform))
|
|
2052
|
+
return new Transform(options);
|
|
2053
2053
|
Duplex.call(this, options);
|
|
2054
2054
|
this._transformState = {
|
|
2055
2055
|
afterTransform: afterTransform.bind(this),
|
|
@@ -2079,14 +2079,14 @@ var require_stream_transform = __commonJS({
|
|
|
2079
2079
|
done(this, null, null);
|
|
2080
2080
|
}
|
|
2081
2081
|
}
|
|
2082
|
-
|
|
2082
|
+
Transform.prototype.push = function(chunk, encoding) {
|
|
2083
2083
|
this._transformState.needTransform = false;
|
|
2084
2084
|
return Duplex.prototype.push.call(this, chunk, encoding);
|
|
2085
2085
|
};
|
|
2086
|
-
|
|
2086
|
+
Transform.prototype._transform = function(chunk, encoding, cb) {
|
|
2087
2087
|
throw new Error("_transform() is not implemented");
|
|
2088
2088
|
};
|
|
2089
|
-
|
|
2089
|
+
Transform.prototype._write = function(chunk, encoding, cb) {
|
|
2090
2090
|
var ts = this._transformState;
|
|
2091
2091
|
ts.writecb = cb;
|
|
2092
2092
|
ts.writechunk = chunk;
|
|
@@ -2097,7 +2097,7 @@ var require_stream_transform = __commonJS({
|
|
|
2097
2097
|
this._read(rs.highWaterMark);
|
|
2098
2098
|
}
|
|
2099
2099
|
};
|
|
2100
|
-
|
|
2100
|
+
Transform.prototype._read = function(n) {
|
|
2101
2101
|
var ts = this._transformState;
|
|
2102
2102
|
if (ts.writechunk !== null && ts.writecb && !ts.transforming) {
|
|
2103
2103
|
ts.transforming = true;
|
|
@@ -2106,7 +2106,7 @@ var require_stream_transform = __commonJS({
|
|
|
2106
2106
|
ts.needTransform = true;
|
|
2107
2107
|
}
|
|
2108
2108
|
};
|
|
2109
|
-
|
|
2109
|
+
Transform.prototype._destroy = function(err, cb) {
|
|
2110
2110
|
var _this2 = this;
|
|
2111
2111
|
Duplex.prototype._destroy.call(this, err, function(err2) {
|
|
2112
2112
|
cb(err2);
|
|
@@ -2132,14 +2132,14 @@ var require_stream_passthrough = __commonJS({
|
|
|
2132
2132
|
"../../node_modules/.pnpm/readable-stream@2.3.8/node_modules/readable-stream/lib/_stream_passthrough.js"(exports, module2) {
|
|
2133
2133
|
"use strict";
|
|
2134
2134
|
module2.exports = PassThrough;
|
|
2135
|
-
var
|
|
2135
|
+
var Transform = require_stream_transform();
|
|
2136
2136
|
var util = Object.create(require_util());
|
|
2137
2137
|
util.inherits = require_inherits();
|
|
2138
|
-
util.inherits(PassThrough,
|
|
2138
|
+
util.inherits(PassThrough, Transform);
|
|
2139
2139
|
function PassThrough(options) {
|
|
2140
2140
|
if (!(this instanceof PassThrough))
|
|
2141
2141
|
return new PassThrough(options);
|
|
2142
|
-
|
|
2142
|
+
Transform.call(this, options);
|
|
2143
2143
|
}
|
|
2144
2144
|
PassThrough.prototype._transform = function(chunk, encoding, cb) {
|
|
2145
2145
|
cb(null, chunk);
|
|
@@ -6016,7 +6016,7 @@ var require_buffer_crc32 = __commonJS({
|
|
|
6016
6016
|
var require_yazl = __commonJS({
|
|
6017
6017
|
"../../node_modules/.pnpm/yazl@2.5.1/node_modules/yazl/index.js"(exports) {
|
|
6018
6018
|
var fs11 = require("fs");
|
|
6019
|
-
var
|
|
6019
|
+
var Transform = require("stream").Transform;
|
|
6020
6020
|
var PassThrough = require("stream").PassThrough;
|
|
6021
6021
|
var zlib = require("zlib");
|
|
6022
6022
|
var util = require("util");
|
|
@@ -6540,18 +6540,18 @@ var require_yazl = __commonJS({
|
|
|
6540
6540
|
buffer.writeUInt32LE(low, offset);
|
|
6541
6541
|
buffer.writeUInt32LE(high, offset + 4);
|
|
6542
6542
|
}
|
|
6543
|
-
util.inherits(ByteCounter,
|
|
6543
|
+
util.inherits(ByteCounter, Transform);
|
|
6544
6544
|
function ByteCounter(options) {
|
|
6545
|
-
|
|
6545
|
+
Transform.call(this, options);
|
|
6546
6546
|
this.byteCount = 0;
|
|
6547
6547
|
}
|
|
6548
6548
|
ByteCounter.prototype._transform = function(chunk, encoding, cb) {
|
|
6549
6549
|
this.byteCount += chunk.length;
|
|
6550
6550
|
cb(null, chunk);
|
|
6551
6551
|
};
|
|
6552
|
-
util.inherits(Crc32Watcher,
|
|
6552
|
+
util.inherits(Crc32Watcher, Transform);
|
|
6553
6553
|
function Crc32Watcher(options) {
|
|
6554
|
-
|
|
6554
|
+
Transform.call(this, options);
|
|
6555
6555
|
this.crc32 = 0;
|
|
6556
6556
|
}
|
|
6557
6557
|
Crc32Watcher.prototype._transform = function(chunk, encoding, cb) {
|
|
@@ -35662,7 +35662,6 @@ var import_path6 = __toESM(require("path"));
|
|
|
35662
35662
|
var import_async_sema4 = __toESM(require_async_sema());
|
|
35663
35663
|
var import_cross_spawn = __toESM(require_cross_spawn());
|
|
35664
35664
|
var import_semver2 = __toESM(require_semver2());
|
|
35665
|
-
var import_stream2 = require("stream");
|
|
35666
35665
|
var import_util6 = require("util");
|
|
35667
35666
|
|
|
35668
35667
|
// src/fs/node-version.ts
|
|
@@ -37204,29 +37203,6 @@ function getInstallCommandForPackageManager(packageManager, args) {
|
|
|
37204
37203
|
};
|
|
37205
37204
|
}
|
|
37206
37205
|
}
|
|
37207
|
-
function stripPnpmVersionFooter(line) {
|
|
37208
|
-
return line.replace(/ using pnpm v\d+\.\d+\.\d+(?=\r?$)/, "");
|
|
37209
|
-
}
|
|
37210
|
-
function createPnpmOutputFilter(destination) {
|
|
37211
|
-
let incompleteLine = "";
|
|
37212
|
-
return new import_stream2.Transform({
|
|
37213
|
-
transform(chunk, _encoding, callback) {
|
|
37214
|
-
const lines = `${incompleteLine}${chunk.toString()}`.split("\n");
|
|
37215
|
-
incompleteLine = lines.pop() ?? "";
|
|
37216
|
-
for (const line of lines) {
|
|
37217
|
-
destination.write(`${stripPnpmVersionFooter(line)}
|
|
37218
|
-
`);
|
|
37219
|
-
}
|
|
37220
|
-
callback();
|
|
37221
|
-
},
|
|
37222
|
-
flush(callback) {
|
|
37223
|
-
if (incompleteLine) {
|
|
37224
|
-
destination.write(stripPnpmVersionFooter(incompleteLine));
|
|
37225
|
-
}
|
|
37226
|
-
callback();
|
|
37227
|
-
}
|
|
37228
|
-
});
|
|
37229
|
-
}
|
|
37230
37206
|
async function runInstallCommand({
|
|
37231
37207
|
packageManager,
|
|
37232
37208
|
args,
|
|
@@ -37238,9 +37214,8 @@ async function runInstallCommand({
|
|
|
37238
37214
|
if (process.env.NPM_ONLY_PRODUCTION) {
|
|
37239
37215
|
commandArguments.push("--production");
|
|
37240
37216
|
}
|
|
37241
|
-
|
|
37242
|
-
opts.
|
|
37243
|
-
opts.errorStream = shouldFilterPnpmOutput ? output?.stderr ?? process.stderr : output?.stderr;
|
|
37217
|
+
opts.outputStream = output?.stdout;
|
|
37218
|
+
opts.errorStream = output?.stderr;
|
|
37244
37219
|
await spawnAsync(packageManager, commandArguments, opts);
|
|
37245
37220
|
}
|
|
37246
37221
|
function initializeSet(set) {
|
|
@@ -37323,6 +37298,12 @@ async function runNpmInstall(destPath, args = [], spawnOpts, meta, projectCreate
|
|
|
37323
37298
|
}
|
|
37324
37299
|
}
|
|
37325
37300
|
const installTime = Date.now();
|
|
37301
|
+
if (output?.stdout) {
|
|
37302
|
+
output.stdout.write("Installing dependencies...\n");
|
|
37303
|
+
} else {
|
|
37304
|
+
console.log("Installing dependencies...");
|
|
37305
|
+
}
|
|
37306
|
+
debug(`Installing to ${destPath}`);
|
|
37326
37307
|
const opts = { cwd: destPath, ...spawnOpts };
|
|
37327
37308
|
const env = cloneEnv(opts.env || process.env);
|
|
37328
37309
|
delete env.NODE_ENV;
|
|
@@ -37336,20 +37317,6 @@ async function runNpmInstall(destPath, args = [], spawnOpts, meta, projectCreate
|
|
|
37336
37317
|
turboSupportsCorepackHome,
|
|
37337
37318
|
projectCreatedAt
|
|
37338
37319
|
});
|
|
37339
|
-
const packageManager = getPackageManagerDisplayName({
|
|
37340
|
-
cliType,
|
|
37341
|
-
lockfileVersion,
|
|
37342
|
-
packageJsonPackageManager,
|
|
37343
|
-
env: opts.env
|
|
37344
|
-
});
|
|
37345
|
-
const installMessage = `Installing dependencies with ${packageManager}`;
|
|
37346
|
-
if (output?.stdout) {
|
|
37347
|
-
output.stdout.write(`${installMessage}
|
|
37348
|
-
`);
|
|
37349
|
-
} else {
|
|
37350
|
-
console.log(installMessage);
|
|
37351
|
-
}
|
|
37352
|
-
debug(`Installing to ${destPath}`);
|
|
37353
37320
|
const maySeeDynamicRequireYarnBug = process.env?.ENABLE_EXPERIMENTAL_COREPACK && packageJson?.packageManager?.startsWith("yarn") && packageJson?.type === "module";
|
|
37354
37321
|
if (maySeeDynamicRequireYarnBug) {
|
|
37355
37322
|
console.warn(
|
|
@@ -37368,37 +37335,6 @@ async function runNpmInstall(destPath, args = [], spawnOpts, meta, projectCreate
|
|
|
37368
37335
|
runNpmInstallSema.release();
|
|
37369
37336
|
}
|
|
37370
37337
|
}
|
|
37371
|
-
function getPackageManagerDisplayName({
|
|
37372
|
-
cliType,
|
|
37373
|
-
lockfileVersion,
|
|
37374
|
-
packageJsonPackageManager,
|
|
37375
|
-
env
|
|
37376
|
-
}) {
|
|
37377
|
-
const versionResult = import_cross_spawn.default.sync(cliType, ["--version"], {
|
|
37378
|
-
env,
|
|
37379
|
-
encoding: "utf8"
|
|
37380
|
-
});
|
|
37381
|
-
const version = versionResult.status === 0 ? versionResult.stdout.trim() : "";
|
|
37382
|
-
if (version) {
|
|
37383
|
-
return `${cliType} ${version}`;
|
|
37384
|
-
}
|
|
37385
|
-
if (packageJsonPackageManager && env.ENABLE_EXPERIMENTAL_COREPACK) {
|
|
37386
|
-
return packageJsonPackageManager.replace("@", " ");
|
|
37387
|
-
}
|
|
37388
|
-
if (cliType === "pnpm") {
|
|
37389
|
-
const selectedPath = env.PATH?.split(import_path6.default.delimiter).find(
|
|
37390
|
-
(segment) => /^\/pnpm\d+\/node_modules\/\.bin$/.test(segment)
|
|
37391
|
-
);
|
|
37392
|
-
const major = selectedPath?.match(/^\/pnpm(\d+)\//)?.[1];
|
|
37393
|
-
if (major) {
|
|
37394
|
-
return `pnpm ${major}`;
|
|
37395
|
-
}
|
|
37396
|
-
}
|
|
37397
|
-
if (cliType === "yarn") {
|
|
37398
|
-
return detectYarnVersion(lockfileVersion).replace("@", " ").replace(/\.x$/, "");
|
|
37399
|
-
}
|
|
37400
|
-
return cliType;
|
|
37401
|
-
}
|
|
37402
37338
|
function getEnvForPackageManager({
|
|
37403
37339
|
cliType,
|
|
37404
37340
|
lockfileVersion,
|
|
@@ -37457,6 +37393,44 @@ function getEnvForPackageManager({
|
|
|
37457
37393
|
if (pathsToPrepend.length > 0) {
|
|
37458
37394
|
const oldPath = env.PATH + "";
|
|
37459
37395
|
newEnv.PATH = `${pathsToPrepend.join(import_path6.default.delimiter)}${oldPath ? import_path6.default.delimiter : ""}${oldPath}`;
|
|
37396
|
+
if (newPath && pathsToPrepend.includes(newPath) && detectedLockfile && detectedPackageManager) {
|
|
37397
|
+
const versionString = cliType === "pnpm" ? `version ${lockfileVersion} ` : "";
|
|
37398
|
+
const pin = resolveCompatiblePnpmPin({
|
|
37399
|
+
cliType,
|
|
37400
|
+
lockfileVersion,
|
|
37401
|
+
packageJsonDevEngines,
|
|
37402
|
+
corepackPackageManager: packageJsonPackageManager
|
|
37403
|
+
});
|
|
37404
|
+
const usedPin = Boolean(pin) && detectedPackageManager === pin?.override.detectedPackageManager;
|
|
37405
|
+
const lockfileDefault = detectPackageManager(
|
|
37406
|
+
cliType,
|
|
37407
|
+
lockfileVersion,
|
|
37408
|
+
projectCreatedAt,
|
|
37409
|
+
nodeVersion
|
|
37410
|
+
);
|
|
37411
|
+
const usedEnginesSelector = Boolean(packageJsonEngines?.pnpm) && !usedPin && detectedPackageManager !== lockfileDefault?.detectedPackageManager;
|
|
37412
|
+
const detectedV9PnpmLockfile = detectedLockfile === "pnpm-lock.yaml" && lockfileVersion === 9;
|
|
37413
|
+
if (usedPin && pin) {
|
|
37414
|
+
const pinField = pin.source === "devEngines" ? "package.json#devEngines.packageManager" : `package.json#packageManager ${packageJsonPackageManager}`;
|
|
37415
|
+
console.log(
|
|
37416
|
+
`Detected \`${detectedLockfile}\` ${versionString}generated by ${detectedPackageManager} from ${pinField}`
|
|
37417
|
+
);
|
|
37418
|
+
} else if (usedEnginesSelector) {
|
|
37419
|
+
console.log(
|
|
37420
|
+
`Detected \`${detectedLockfile}\` ${versionString}generated by ${detectedPackageManager} from package.json#engines.pnpm ${packageJsonEngines?.pnpm}`
|
|
37421
|
+
);
|
|
37422
|
+
} else if (detectedV9PnpmLockfile) {
|
|
37423
|
+
console.log(
|
|
37424
|
+
`Detected \`${detectedLockfile}\` ${lockfileVersion} which may be generated by pnpm@9.x, pnpm@10.x, or pnpm@11.x
|
|
37425
|
+
Using ${detectedPackageManager} based on project creation date
|
|
37426
|
+
To use a different version, set package.json#packageManager or package.json#devEngines.packageManager`
|
|
37427
|
+
);
|
|
37428
|
+
} else {
|
|
37429
|
+
console.log(
|
|
37430
|
+
`Detected \`${detectedLockfile}\` ${versionString}generated by ${detectedPackageManager}`
|
|
37431
|
+
);
|
|
37432
|
+
}
|
|
37433
|
+
}
|
|
37460
37434
|
}
|
|
37461
37435
|
if (cliType === "yarn" && !env.YARN_NODE_LINKER) {
|
|
37462
37436
|
newEnv.YARN_NODE_LINKER = "node-modules";
|
|
@@ -39344,6 +39318,22 @@ var Span = class _Span {
|
|
|
39344
39318
|
reporter: this._reporter
|
|
39345
39319
|
});
|
|
39346
39320
|
}
|
|
39321
|
+
/**
|
|
39322
|
+
* Report already-finalized trace events (e.g. collected in a child process) to this span's
|
|
39323
|
+
* reporter so they appear nested under this span. Any event that is a root of the passed set —
|
|
39324
|
+
* i.e. whose `parentId` refers to a span not present in `events` — is reparented to this span;
|
|
39325
|
+
* links internal to the set are preserved. Safe to call with events from any process: the
|
|
39326
|
+
* caller does not need to know or set this span's id.
|
|
39327
|
+
*/
|
|
39328
|
+
reportChildEvents(events) {
|
|
39329
|
+
if (!this._reporter)
|
|
39330
|
+
return;
|
|
39331
|
+
const ids = new Set(events.map((event) => event.id));
|
|
39332
|
+
for (const event of events) {
|
|
39333
|
+
const isRoot = event.parentId === void 0 || !ids.has(event.parentId);
|
|
39334
|
+
this._reporter.report(isRoot ? { ...event, parentId: this.id } : event);
|
|
39335
|
+
}
|
|
39336
|
+
}
|
|
39347
39337
|
async trace(fn) {
|
|
39348
39338
|
try {
|
|
39349
39339
|
return await fn(this);
|
|
@@ -39440,6 +39430,22 @@ function generateNodeBuilderFunctions(frameworkName, regex, validFilenames, vali
|
|
|
39440
39430
|
slug: frameworkName,
|
|
39441
39431
|
version
|
|
39442
39432
|
};
|
|
39433
|
+
if (!res.routes) {
|
|
39434
|
+
res.routes = [
|
|
39435
|
+
{ handle: "filesystem" },
|
|
39436
|
+
{
|
|
39437
|
+
src: "/(.*)",
|
|
39438
|
+
dest: "/",
|
|
39439
|
+
transforms: [
|
|
39440
|
+
{
|
|
39441
|
+
type: "request.path",
|
|
39442
|
+
op: "set",
|
|
39443
|
+
args: "/$1"
|
|
39444
|
+
}
|
|
39445
|
+
]
|
|
39446
|
+
}
|
|
39447
|
+
];
|
|
39448
|
+
}
|
|
39443
39449
|
return res;
|
|
39444
39450
|
};
|
|
39445
39451
|
const entrypointCallback = async (args) => {
|
|
@@ -40185,11 +40191,11 @@ function getAndVerifyOutputLambdasOrEdgeFuncs(buildResponse) {
|
|
|
40185
40191
|
}
|
|
40186
40192
|
|
|
40187
40193
|
// src/collect-build-result/stream-with-extended-payload.ts
|
|
40188
|
-
var
|
|
40194
|
+
var import_stream2 = require("stream");
|
|
40189
40195
|
function streamWithExtendedPayload(stream, data) {
|
|
40190
40196
|
return data ? new MultipartContentStream(stream, data) : stream;
|
|
40191
40197
|
}
|
|
40192
|
-
var MultipartContentStream = class extends
|
|
40198
|
+
var MultipartContentStream = class extends import_stream2.Readable {
|
|
40193
40199
|
constructor(stream, data) {
|
|
40194
40200
|
super();
|
|
40195
40201
|
stream.on("error", (err) => {
|
package/dist/trace/trace.d.ts
CHANGED
|
@@ -32,6 +32,14 @@ export declare class Span {
|
|
|
32
32
|
stop(): void;
|
|
33
33
|
setAttributes(attrs: Attributes): void;
|
|
34
34
|
child(name: string, attrs?: Attributes): Span;
|
|
35
|
+
/**
|
|
36
|
+
* Report already-finalized trace events (e.g. collected in a child process) to this span's
|
|
37
|
+
* reporter so they appear nested under this span. Any event that is a root of the passed set —
|
|
38
|
+
* i.e. whose `parentId` refers to a span not present in `events` — is reparented to this span;
|
|
39
|
+
* links internal to the set are preserved. Safe to call with events from any process: the
|
|
40
|
+
* caller does not need to know or set this span's id.
|
|
41
|
+
*/
|
|
42
|
+
reportChildEvents(events: TraceEvent[]): void;
|
|
35
43
|
trace<T>(fn: (span: Span) => T | Promise<T>): Promise<T>;
|
|
36
44
|
}
|
|
37
45
|
export {};
|
package/dist/trace/trace.js
CHANGED
|
@@ -78,6 +78,22 @@ class Span {
|
|
|
78
78
|
reporter: this._reporter
|
|
79
79
|
});
|
|
80
80
|
}
|
|
81
|
+
/**
|
|
82
|
+
* Report already-finalized trace events (e.g. collected in a child process) to this span's
|
|
83
|
+
* reporter so they appear nested under this span. Any event that is a root of the passed set —
|
|
84
|
+
* i.e. whose `parentId` refers to a span not present in `events` — is reparented to this span;
|
|
85
|
+
* links internal to the set are preserved. Safe to call with events from any process: the
|
|
86
|
+
* caller does not need to know or set this span's id.
|
|
87
|
+
*/
|
|
88
|
+
reportChildEvents(events) {
|
|
89
|
+
if (!this._reporter)
|
|
90
|
+
return;
|
|
91
|
+
const ids = new Set(events.map((event) => event.id));
|
|
92
|
+
for (const event of events) {
|
|
93
|
+
const isRoot = event.parentId === void 0 || !ids.has(event.parentId);
|
|
94
|
+
this._reporter.report(isRoot ? { ...event, parentId: this.id } : event);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
81
97
|
async trace(fn) {
|
|
82
98
|
try {
|
|
83
99
|
return await fn(this);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vercel/build-utils",
|
|
3
|
-
"version": "14.
|
|
3
|
+
"version": "14.5.1",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.js",
|
|
@@ -52,8 +52,8 @@
|
|
|
52
52
|
"vitest": "4.1.10",
|
|
53
53
|
"typescript": "4.9.5",
|
|
54
54
|
"yazl": "2.5.1",
|
|
55
|
-
"@vercel/
|
|
56
|
-
"@vercel/
|
|
55
|
+
"@vercel/routing-utils": "6.5.0",
|
|
56
|
+
"@vercel/error-utils": "2.2.1"
|
|
57
57
|
},
|
|
58
58
|
"scripts": {
|
|
59
59
|
"build": "node build.mjs",
|