@vercel/build-utils 9.1.1 → 9.2.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 +12 -0
- package/dist/default-cache-path-glob.d.ts +1 -0
- package/dist/default-cache-path-glob.js +28 -0
- package/dist/fs/run-user-scripts.d.ts +1 -1
- package/dist/fs/run-user-scripts.js +1 -1
- package/dist/index.d.ts +4 -2
- package/dist/index.js +81 -1
- package/dist/trace/constants.d.ts +2 -0
- package/dist/trace/constants.js +31 -0
- package/dist/trace/index.d.ts +3 -0
- package/dist/trace/index.js +33 -0
- package/dist/trace/trace.d.ts +39 -0
- package/dist/trace/trace.js +88 -0
- package/dist/types.d.ts +5 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
@@ -1,5 +1,17 @@
|
|
1
1
|
# @vercel/build-utils
|
2
2
|
|
3
|
+
## 9.2.1
|
4
|
+
|
5
|
+
### Patch Changes
|
6
|
+
|
7
|
+
- Add tracer utility to @vercel/build-utils ([#13013](https://github.com/vercel/vercel/pull/13013))
|
8
|
+
|
9
|
+
## 9.2.0
|
10
|
+
|
11
|
+
### Minor Changes
|
12
|
+
|
13
|
+
- Add .yarn/cache to build cache ([#12961](https://github.com/vercel/vercel/pull/12961))
|
14
|
+
|
3
15
|
## 9.1.1
|
4
16
|
|
5
17
|
### Patch Changes
|
@@ -0,0 +1 @@
|
|
1
|
+
export declare const defaultCachePathGlob = "**/{node_modules,.yarn/cache}/**";
|
@@ -0,0 +1,28 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __defProp = Object.defineProperty;
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
6
|
+
var __export = (target, all) => {
|
7
|
+
for (var name in all)
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
9
|
+
};
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
12
|
+
for (let key of __getOwnPropNames(from))
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
15
|
+
}
|
16
|
+
return to;
|
17
|
+
};
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
19
|
+
var default_cache_path_glob_exports = {};
|
20
|
+
__export(default_cache_path_glob_exports, {
|
21
|
+
defaultCachePathGlob: () => defaultCachePathGlob
|
22
|
+
});
|
23
|
+
module.exports = __toCommonJS(default_cache_path_glob_exports);
|
24
|
+
const defaultCachePathGlob = "**/{node_modules,.yarn/cache}/**";
|
25
|
+
// Annotate the CommonJS export names for ESM import in node:
|
26
|
+
0 && (module.exports = {
|
27
|
+
defaultCachePathGlob
|
28
|
+
});
|
@@ -198,7 +198,7 @@ export declare function runCustomInstallCommand({ destPath, installCommand, node
|
|
198
198
|
export declare function runPackageJsonScript(destPath: string, scriptNames: string | Iterable<string>, spawnOpts?: SpawnOptions): Promise<boolean>;
|
199
199
|
export declare function runBundleInstall(destPath: string, args?: string[], spawnOpts?: SpawnOptions, meta?: Meta): Promise<void>;
|
200
200
|
export declare function runPipInstall(destPath: string, args?: string[], spawnOpts?: SpawnOptions, meta?: Meta): Promise<void>;
|
201
|
-
export declare function getScriptName(pkg: Pick<PackageJson, 'scripts'> | null | undefined, possibleNames: Iterable<string>): string |
|
201
|
+
export declare function getScriptName(pkg: Pick<PackageJson, 'scripts'> | null | undefined, possibleNames: Iterable<string>): string | undefined;
|
202
202
|
/**
|
203
203
|
* @deprecate installDependencies() is deprecated.
|
204
204
|
* Please use runNpmInstall() instead.
|
package/dist/index.d.ts
CHANGED
@@ -8,7 +8,7 @@ import download, { downloadFile, DownloadedFiles, isSymbolicLink, isDirectory }
|
|
8
8
|
import getWriteableDirectory from './fs/get-writable-directory';
|
9
9
|
import glob, { GlobOptions } from './fs/glob';
|
10
10
|
import rename from './fs/rename';
|
11
|
-
import { spawnAsync, execCommand, spawnCommand, walkParentDirs, getScriptName, installDependencies, runPackageJsonScript, runNpmInstall, runBundleInstall, runPipInstall, runShellScript, runCustomInstallCommand, getEnvForPackageManager, getNodeVersion, getPathForPackageManager, getSpawnOptions, getNodeBinPath, getNodeBinPaths, scanParentDirs, traverseUpDirectories } from './fs/run-user-scripts';
|
11
|
+
import { spawnAsync, execCommand, spawnCommand, walkParentDirs, getScriptName, installDependencies, runPackageJsonScript, runNpmInstall, runBundleInstall, runPipInstall, runShellScript, runCustomInstallCommand, getEnvForPackageManager, getNodeVersion, getPathForPackageManager, detectPackageManager, getSpawnOptions, getNodeBinPath, getNodeBinPaths, scanParentDirs, traverseUpDirectories } from './fs/run-user-scripts';
|
12
12
|
import { getLatestNodeVersion, getDiscontinuedNodeVersions, getSupportedNodeVersion } from './fs/node-version';
|
13
13
|
import streamToBuffer, { streamToBufferChunks } from './fs/stream-to-buffer';
|
14
14
|
import debug from './debug';
|
@@ -18,7 +18,7 @@ import { getPrefixedEnvVars } from './get-prefixed-env-vars';
|
|
18
18
|
import { cloneEnv } from './clone-env';
|
19
19
|
import { hardLinkDir } from './hard-link-dir';
|
20
20
|
import { validateNpmrc } from './validate-npmrc';
|
21
|
-
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, runNpmInstall, runBundleInstall, runPipInstall, runShellScript, runCustomInstallCommand, getEnvForPackageManager, getNodeVersion, getPathForPackageManager, getLatestNodeVersion, getDiscontinuedNodeVersions, getSpawnOptions, getPlatformEnv, getPrefixedEnvVars, streamToBuffer, streamToBufferChunks, debug, isSymbolicLink, isDirectory, getLambdaOptionsFromFunction, scanParentDirs, getIgnoreFilter, cloneEnv, hardLinkDir, traverseUpDirectories, validateNpmrc, };
|
21
|
+
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, detectPackageManager, runNpmInstall, runBundleInstall, runPipInstall, runShellScript, runCustomInstallCommand, getEnvForPackageManager, getNodeVersion, getPathForPackageManager, getLatestNodeVersion, getDiscontinuedNodeVersions, getSpawnOptions, getPlatformEnv, getPrefixedEnvVars, streamToBuffer, streamToBufferChunks, debug, isSymbolicLink, isDirectory, getLambdaOptionsFromFunction, scanParentDirs, getIgnoreFilter, cloneEnv, hardLinkDir, traverseUpDirectories, validateNpmrc, };
|
22
22
|
export { EdgeFunction } from './edge-function';
|
23
23
|
export { readConfigFile } from './fs/read-config-file';
|
24
24
|
export { normalizePath } from './fs/normalize-path';
|
@@ -27,5 +27,7 @@ export * from './should-serve';
|
|
27
27
|
export * from './schemas';
|
28
28
|
export * from './types';
|
29
29
|
export * from './errors';
|
30
|
+
export * from './trace';
|
30
31
|
export { NODE_VERSIONS } from './fs/node-version';
|
31
32
|
export { getInstalledPackageVersion } from './get-installed-package-version';
|
33
|
+
export { defaultCachePathGlob } from './default-cache-path-glob';
|
package/dist/index.js
CHANGED
@@ -21845,6 +21845,8 @@ var require_ignore = __commonJS({
|
|
21845
21845
|
// src/index.ts
|
21846
21846
|
var src_exports = {};
|
21847
21847
|
__export(src_exports, {
|
21848
|
+
BUILDER_COMPILE_STEP: () => BUILDER_COMPILE_STEP,
|
21849
|
+
BUILDER_INSTALLER_STEP: () => BUILDER_INSTALLER_STEP,
|
21848
21850
|
EdgeFunction: () => EdgeFunction,
|
21849
21851
|
FileBlob: () => FileBlob,
|
21850
21852
|
FileFsRef: () => file_fs_ref_default,
|
@@ -21855,11 +21857,14 @@ __export(src_exports, {
|
|
21855
21857
|
NodejsLambda: () => NodejsLambda,
|
21856
21858
|
NowBuildError: () => NowBuildError,
|
21857
21859
|
Prerender: () => Prerender,
|
21860
|
+
Span: () => Span,
|
21858
21861
|
Version: () => Version,
|
21859
21862
|
buildsSchema: () => buildsSchema,
|
21860
21863
|
cloneEnv: () => cloneEnv,
|
21861
21864
|
createLambda: () => createLambda,
|
21862
21865
|
debug: () => debug,
|
21866
|
+
defaultCachePathGlob: () => defaultCachePathGlob,
|
21867
|
+
detectPackageManager: () => detectPackageManager,
|
21863
21868
|
download: () => download,
|
21864
21869
|
downloadFile: () => downloadFile,
|
21865
21870
|
execCommand: () => execCommand,
|
@@ -23917,7 +23922,7 @@ function getScriptName(pkg, possibleNames) {
|
|
23917
23922
|
}
|
23918
23923
|
}
|
23919
23924
|
}
|
23920
|
-
return
|
23925
|
+
return void 0;
|
23921
23926
|
}
|
23922
23927
|
var installDependencies = (0, import_util2.deprecate)(
|
23923
23928
|
runNpmInstall,
|
@@ -24224,6 +24229,73 @@ var buildsSchema = {
|
|
24224
24229
|
}
|
24225
24230
|
};
|
24226
24231
|
|
24232
|
+
// src/trace/trace.ts
|
24233
|
+
var import_node_crypto = require("crypto");
|
24234
|
+
function mapUndefinedAttributes(attrs) {
|
24235
|
+
return Object.fromEntries(
|
24236
|
+
Object.entries(attrs ?? {}).filter(
|
24237
|
+
(attr) => !!attr[1]
|
24238
|
+
)
|
24239
|
+
);
|
24240
|
+
}
|
24241
|
+
var Span = class _Span {
|
24242
|
+
constructor({
|
24243
|
+
name,
|
24244
|
+
parentId,
|
24245
|
+
attrs,
|
24246
|
+
reporter
|
24247
|
+
}) {
|
24248
|
+
this.name = name;
|
24249
|
+
this.parentId = parentId;
|
24250
|
+
this.attrs = mapUndefinedAttributes(attrs);
|
24251
|
+
this.status = "started";
|
24252
|
+
this.id = (0, import_node_crypto.randomUUID)();
|
24253
|
+
this._start = Date.now();
|
24254
|
+
this._reporter = reporter;
|
24255
|
+
}
|
24256
|
+
stop() {
|
24257
|
+
if (this.status === "stopped") {
|
24258
|
+
throw new Error(`Cannot stop a span which is already stopped`);
|
24259
|
+
}
|
24260
|
+
this.status = "stopped";
|
24261
|
+
const duration = Date.now() - this._start;
|
24262
|
+
const traceEvent = {
|
24263
|
+
name: this.name,
|
24264
|
+
duration: Number(duration),
|
24265
|
+
timestamp: this._start,
|
24266
|
+
id: this.id,
|
24267
|
+
parentId: this.parentId,
|
24268
|
+
tags: this.attrs,
|
24269
|
+
startTime: this._start
|
24270
|
+
};
|
24271
|
+
if (this._reporter) {
|
24272
|
+
this._reporter.report(traceEvent);
|
24273
|
+
}
|
24274
|
+
}
|
24275
|
+
setAttributes(attrs) {
|
24276
|
+
Object.assign(this.attrs, mapUndefinedAttributes(attrs));
|
24277
|
+
}
|
24278
|
+
child(name, attrs) {
|
24279
|
+
return new _Span({
|
24280
|
+
name,
|
24281
|
+
parentId: this.id,
|
24282
|
+
attrs,
|
24283
|
+
reporter: this._reporter
|
24284
|
+
});
|
24285
|
+
}
|
24286
|
+
async trace(fn) {
|
24287
|
+
try {
|
24288
|
+
return await fn(this);
|
24289
|
+
} finally {
|
24290
|
+
this.stop();
|
24291
|
+
}
|
24292
|
+
}
|
24293
|
+
};
|
24294
|
+
|
24295
|
+
// src/trace/constants.ts
|
24296
|
+
var BUILDER_INSTALLER_STEP = "vc.builder.install";
|
24297
|
+
var BUILDER_COMPILE_STEP = "vc.builder.build";
|
24298
|
+
|
24227
24299
|
// src/get-installed-package-version.ts
|
24228
24300
|
async function getInstalledPackageVersion(packageName, path7) {
|
24229
24301
|
try {
|
@@ -24240,8 +24312,13 @@ async function getInstalledPackageVersion(packageName, path7) {
|
|
24240
24312
|
return void 0;
|
24241
24313
|
}
|
24242
24314
|
}
|
24315
|
+
|
24316
|
+
// src/default-cache-path-glob.ts
|
24317
|
+
var defaultCachePathGlob = "**/{node_modules,.yarn/cache}/**";
|
24243
24318
|
// Annotate the CommonJS export names for ESM import in node:
|
24244
24319
|
0 && (module.exports = {
|
24320
|
+
BUILDER_COMPILE_STEP,
|
24321
|
+
BUILDER_INSTALLER_STEP,
|
24245
24322
|
EdgeFunction,
|
24246
24323
|
FileBlob,
|
24247
24324
|
FileFsRef,
|
@@ -24252,11 +24329,14 @@ async function getInstalledPackageVersion(packageName, path7) {
|
|
24252
24329
|
NodejsLambda,
|
24253
24330
|
NowBuildError,
|
24254
24331
|
Prerender,
|
24332
|
+
Span,
|
24255
24333
|
Version,
|
24256
24334
|
buildsSchema,
|
24257
24335
|
cloneEnv,
|
24258
24336
|
createLambda,
|
24259
24337
|
debug,
|
24338
|
+
defaultCachePathGlob,
|
24339
|
+
detectPackageManager,
|
24260
24340
|
download,
|
24261
24341
|
downloadFile,
|
24262
24342
|
execCommand,
|
@@ -0,0 +1,31 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __defProp = Object.defineProperty;
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
6
|
+
var __export = (target, all) => {
|
7
|
+
for (var name in all)
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
9
|
+
};
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
12
|
+
for (let key of __getOwnPropNames(from))
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
15
|
+
}
|
16
|
+
return to;
|
17
|
+
};
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
19
|
+
var constants_exports = {};
|
20
|
+
__export(constants_exports, {
|
21
|
+
BUILDER_COMPILE_STEP: () => BUILDER_COMPILE_STEP,
|
22
|
+
BUILDER_INSTALLER_STEP: () => BUILDER_INSTALLER_STEP
|
23
|
+
});
|
24
|
+
module.exports = __toCommonJS(constants_exports);
|
25
|
+
const BUILDER_INSTALLER_STEP = "vc.builder.install";
|
26
|
+
const BUILDER_COMPILE_STEP = "vc.builder.build";
|
27
|
+
// Annotate the CommonJS export names for ESM import in node:
|
28
|
+
0 && (module.exports = {
|
29
|
+
BUILDER_COMPILE_STEP,
|
30
|
+
BUILDER_INSTALLER_STEP
|
31
|
+
});
|
@@ -0,0 +1,33 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __defProp = Object.defineProperty;
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
6
|
+
var __export = (target, all) => {
|
7
|
+
for (var name in all)
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
9
|
+
};
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
12
|
+
for (let key of __getOwnPropNames(from))
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
15
|
+
}
|
16
|
+
return to;
|
17
|
+
};
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
19
|
+
var trace_exports = {};
|
20
|
+
__export(trace_exports, {
|
21
|
+
BUILDER_COMPILE_STEP: () => import_constants.BUILDER_COMPILE_STEP,
|
22
|
+
BUILDER_INSTALLER_STEP: () => import_constants.BUILDER_INSTALLER_STEP,
|
23
|
+
Span: () => import_trace.Span
|
24
|
+
});
|
25
|
+
module.exports = __toCommonJS(trace_exports);
|
26
|
+
var import_trace = require("./trace");
|
27
|
+
var import_constants = require("./constants");
|
28
|
+
// Annotate the CommonJS export names for ESM import in node:
|
29
|
+
0 && (module.exports = {
|
30
|
+
BUILDER_COMPILE_STEP,
|
31
|
+
BUILDER_INSTALLER_STEP,
|
32
|
+
Span
|
33
|
+
});
|
@@ -0,0 +1,39 @@
|
|
1
|
+
export type SpanId = string;
|
2
|
+
export type TraceEvent = {
|
3
|
+
parentId?: SpanId;
|
4
|
+
name: string;
|
5
|
+
id: SpanId;
|
6
|
+
timestamp: number;
|
7
|
+
duration: number;
|
8
|
+
tags: Record<string, string>;
|
9
|
+
startTime: number;
|
10
|
+
};
|
11
|
+
export type Reporter = {
|
12
|
+
flushAll: (opts?: {
|
13
|
+
end: boolean;
|
14
|
+
}) => Promise<void> | void;
|
15
|
+
report: (event: TraceEvent) => void;
|
16
|
+
};
|
17
|
+
interface Attributes {
|
18
|
+
[key: string]: string | undefined;
|
19
|
+
}
|
20
|
+
export declare class Span {
|
21
|
+
private name;
|
22
|
+
private id;
|
23
|
+
private parentId?;
|
24
|
+
private attrs;
|
25
|
+
private status;
|
26
|
+
private _start;
|
27
|
+
private _reporter;
|
28
|
+
constructor({ name, parentId, attrs, reporter, }: {
|
29
|
+
name: string;
|
30
|
+
parentId?: SpanId;
|
31
|
+
attrs?: Attributes;
|
32
|
+
reporter?: Reporter;
|
33
|
+
});
|
34
|
+
stop(): void;
|
35
|
+
setAttributes(attrs: Attributes): void;
|
36
|
+
child(name: string, attrs?: Attributes): Span;
|
37
|
+
trace<T>(fn: (span: Span) => T | Promise<T>): Promise<T>;
|
38
|
+
}
|
39
|
+
export {};
|
@@ -0,0 +1,88 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __defProp = Object.defineProperty;
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
6
|
+
var __export = (target, all) => {
|
7
|
+
for (var name in all)
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
9
|
+
};
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
12
|
+
for (let key of __getOwnPropNames(from))
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
15
|
+
}
|
16
|
+
return to;
|
17
|
+
};
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
19
|
+
var trace_exports = {};
|
20
|
+
__export(trace_exports, {
|
21
|
+
Span: () => Span
|
22
|
+
});
|
23
|
+
module.exports = __toCommonJS(trace_exports);
|
24
|
+
var import_node_crypto = require("node:crypto");
|
25
|
+
function mapUndefinedAttributes(attrs) {
|
26
|
+
return Object.fromEntries(
|
27
|
+
Object.entries(attrs ?? {}).filter(
|
28
|
+
(attr) => !!attr[1]
|
29
|
+
)
|
30
|
+
);
|
31
|
+
}
|
32
|
+
class Span {
|
33
|
+
constructor({
|
34
|
+
name,
|
35
|
+
parentId,
|
36
|
+
attrs,
|
37
|
+
reporter
|
38
|
+
}) {
|
39
|
+
this.name = name;
|
40
|
+
this.parentId = parentId;
|
41
|
+
this.attrs = mapUndefinedAttributes(attrs);
|
42
|
+
this.status = "started";
|
43
|
+
this.id = (0, import_node_crypto.randomUUID)();
|
44
|
+
this._start = Date.now();
|
45
|
+
this._reporter = reporter;
|
46
|
+
}
|
47
|
+
stop() {
|
48
|
+
if (this.status === "stopped") {
|
49
|
+
throw new Error(`Cannot stop a span which is already stopped`);
|
50
|
+
}
|
51
|
+
this.status = "stopped";
|
52
|
+
const duration = Date.now() - this._start;
|
53
|
+
const traceEvent = {
|
54
|
+
name: this.name,
|
55
|
+
duration: Number(duration),
|
56
|
+
timestamp: this._start,
|
57
|
+
id: this.id,
|
58
|
+
parentId: this.parentId,
|
59
|
+
tags: this.attrs,
|
60
|
+
startTime: this._start
|
61
|
+
};
|
62
|
+
if (this._reporter) {
|
63
|
+
this._reporter.report(traceEvent);
|
64
|
+
}
|
65
|
+
}
|
66
|
+
setAttributes(attrs) {
|
67
|
+
Object.assign(this.attrs, mapUndefinedAttributes(attrs));
|
68
|
+
}
|
69
|
+
child(name, attrs) {
|
70
|
+
return new Span({
|
71
|
+
name,
|
72
|
+
parentId: this.id,
|
73
|
+
attrs,
|
74
|
+
reporter: this._reporter
|
75
|
+
});
|
76
|
+
}
|
77
|
+
async trace(fn) {
|
78
|
+
try {
|
79
|
+
return await fn(this);
|
80
|
+
} finally {
|
81
|
+
this.stop();
|
82
|
+
}
|
83
|
+
}
|
84
|
+
}
|
85
|
+
// Annotate the CommonJS export names for ESM import in node:
|
86
|
+
0 && (module.exports = {
|
87
|
+
Span
|
88
|
+
});
|
package/dist/types.d.ts
CHANGED
@@ -5,6 +5,7 @@ import type FileBlob from './file-blob';
|
|
5
5
|
import type { Lambda } from './lambda';
|
6
6
|
import type { Prerender } from './prerender';
|
7
7
|
import type { EdgeFunction } from './edge-function';
|
8
|
+
import type { Span } from './trace';
|
8
9
|
export interface Env {
|
9
10
|
[name: string]: string | undefined;
|
10
11
|
}
|
@@ -102,6 +103,10 @@ export interface BuildOptions {
|
|
102
103
|
* fully processed
|
103
104
|
*/
|
104
105
|
buildCallback?: (opts: Omit<BuildOptions, 'buildCallback'>) => Promise<void>;
|
106
|
+
/**
|
107
|
+
* The current trace state from the internal vc tracing
|
108
|
+
*/
|
109
|
+
span?: Span;
|
105
110
|
}
|
106
111
|
export interface PrepareCacheOptions {
|
107
112
|
/**
|