braintrust 3.7.1 → 3.9.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/dev/dist/index.d.mts +228 -5
- package/dev/dist/index.d.ts +228 -5
- package/dev/dist/index.js +6259 -1261
- package/dev/dist/index.mjs +6161 -1163
- package/dist/auto-instrumentations/bundler/esbuild.cjs +995 -55
- package/dist/auto-instrumentations/bundler/esbuild.mjs +2 -2
- package/dist/auto-instrumentations/bundler/rollup.cjs +995 -55
- package/dist/auto-instrumentations/bundler/rollup.mjs +2 -2
- package/dist/auto-instrumentations/bundler/vite.cjs +995 -55
- package/dist/auto-instrumentations/bundler/vite.mjs +2 -2
- package/dist/auto-instrumentations/bundler/webpack-loader.cjs +995 -55
- package/dist/auto-instrumentations/bundler/webpack-loader.d.ts +11 -9
- package/dist/auto-instrumentations/bundler/webpack.cjs +995 -55
- package/dist/auto-instrumentations/bundler/webpack.mjs +2 -2
- package/dist/auto-instrumentations/{chunk-NY4CGTN6.mjs → chunk-G7F6HZGE.mjs} +9 -1
- package/dist/auto-instrumentations/{chunk-EVUKFMHG.mjs → chunk-ITP7RAUY.mjs} +21 -3
- package/dist/auto-instrumentations/chunk-KIMMUFAK.mjs +1781 -0
- package/dist/auto-instrumentations/{chunk-VLEJ5AEK.mjs → chunk-P5YLNB2A.mjs} +21 -3
- package/dist/auto-instrumentations/hook.mjs +1206 -82
- package/dist/auto-instrumentations/index.cjs +1161 -55
- package/dist/auto-instrumentations/index.d.mts +22 -1
- package/dist/auto-instrumentations/index.d.ts +22 -1
- package/dist/auto-instrumentations/index.mjs +172 -1
- package/dist/auto-instrumentations/loader/cjs-patch.cjs +34 -6
- package/dist/auto-instrumentations/loader/cjs-patch.d.mts +1 -0
- package/dist/auto-instrumentations/loader/cjs-patch.d.ts +1 -0
- package/dist/auto-instrumentations/loader/cjs-patch.mjs +15 -5
- package/dist/auto-instrumentations/loader/esm-hook.mjs +10 -4
- package/dist/auto-instrumentations/loader/get-package-version.cjs +20 -2
- package/dist/auto-instrumentations/loader/get-package-version.mjs +1 -1
- package/dist/browser.d.mts +501 -18
- package/dist/browser.d.ts +501 -18
- package/dist/browser.js +6985 -1211
- package/dist/browser.mjs +6985 -1211
- package/dist/cli.js +6160 -1133
- package/dist/edge-light.d.mts +1 -1
- package/dist/edge-light.d.ts +1 -1
- package/dist/edge-light.js +16054 -10191
- package/dist/edge-light.mjs +16054 -10191
- package/dist/index.d.mts +501 -18
- package/dist/index.d.ts +501 -18
- package/dist/index.js +7144 -1370
- package/dist/index.mjs +6985 -1211
- package/dist/instrumentation/index.d.mts +17 -0
- package/dist/instrumentation/index.d.ts +17 -0
- package/dist/instrumentation/index.js +5929 -1053
- package/dist/instrumentation/index.mjs +5929 -1053
- package/dist/workerd.d.mts +1 -1
- package/dist/workerd.d.ts +1 -1
- package/dist/workerd.js +16054 -10191
- package/dist/workerd.mjs +16054 -10191
- package/package.json +13 -8
- package/util/dist/index.d.mts +42 -1
- package/util/dist/index.d.ts +42 -1
- package/util/dist/index.js +5 -1
- package/util/dist/index.mjs +4 -0
- package/dist/auto-instrumentations/chunk-YCKND42U.mjs +0 -839
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/auto-instrumentations/loader/get-package-version.ts
|
|
2
|
-
import { readFileSync } from "fs";
|
|
2
|
+
import { readFileSync, realpathSync } from "fs";
|
|
3
3
|
import { join } from "path";
|
|
4
4
|
var packageVersions = /* @__PURE__ */ new Map();
|
|
5
5
|
var packageNames = /* @__PURE__ */ new Map();
|
|
@@ -12,11 +12,29 @@ function readPackageJson(baseDir) {
|
|
|
12
12
|
return void 0;
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
|
+
function resolvePackageBaseDir(baseDir) {
|
|
16
|
+
try {
|
|
17
|
+
return realpathSync(baseDir);
|
|
18
|
+
} catch {
|
|
19
|
+
return baseDir;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
function readPackageJsonWithFallback(baseDir) {
|
|
23
|
+
const packageJson = readPackageJson(baseDir);
|
|
24
|
+
if (packageJson) {
|
|
25
|
+
return packageJson;
|
|
26
|
+
}
|
|
27
|
+
const resolvedBaseDir = resolvePackageBaseDir(baseDir);
|
|
28
|
+
if (resolvedBaseDir === baseDir) {
|
|
29
|
+
return void 0;
|
|
30
|
+
}
|
|
31
|
+
return readPackageJson(resolvedBaseDir);
|
|
32
|
+
}
|
|
15
33
|
function getPackageVersion(baseDir) {
|
|
16
34
|
if (packageVersions.has(baseDir)) {
|
|
17
35
|
return packageVersions.get(baseDir);
|
|
18
36
|
}
|
|
19
|
-
const packageJson =
|
|
37
|
+
const packageJson = readPackageJsonWithFallback(baseDir);
|
|
20
38
|
if (typeof packageJson?.version === "string") {
|
|
21
39
|
packageVersions.set(baseDir, packageJson.version);
|
|
22
40
|
return packageJson.version;
|
|
@@ -27,7 +45,7 @@ function getPackageName(baseDir) {
|
|
|
27
45
|
if (packageNames.has(baseDir)) {
|
|
28
46
|
return packageNames.get(baseDir);
|
|
29
47
|
}
|
|
30
|
-
const packageJson =
|
|
48
|
+
const packageJson = readPackageJsonWithFallback(baseDir);
|
|
31
49
|
if (typeof packageJson?.name === "string") {
|
|
32
50
|
packageNames.set(baseDir, packageJson.name);
|
|
33
51
|
return packageJson.name;
|