braintrust 0.0.26 → 0.0.28
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/README.md +3 -3
- package/dist/browser.d.ts +1 -0
- package/dist/browser.js +3 -0
- package/dist/cli.js +23188 -312
- package/dist/index.d.ts +3 -3
- package/dist/index.js +18515 -53
- package/dist/isomorph.d.ts +19 -0
- package/dist/logger.d.ts +35 -0
- package/dist/oai.d.ts +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +23 -10
- package/dist/cache.js +0 -31
- package/dist/framework.js +0 -104
- package/dist/gitutil.js +0 -147
- package/dist/jest/nodeModulesPaths.js +0 -101
- package/dist/jest/tryRealpath.js +0 -21
- package/dist/logger.js +0 -800
- package/dist/oai.js +0 -104
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
4
|
-
*
|
|
5
|
-
* This source code is licensed under the MIT license found in the
|
|
6
|
-
* LICENSE file in the root directory of this source tree.
|
|
7
|
-
*
|
|
8
|
-
* Adapted from: https://github.com/substack/node-resolve
|
|
9
|
-
*/
|
|
10
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
11
|
-
if (k2 === undefined) k2 = k;
|
|
12
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
13
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
14
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
15
|
-
}
|
|
16
|
-
Object.defineProperty(o, k2, desc);
|
|
17
|
-
}) : (function(o, m, k, k2) {
|
|
18
|
-
if (k2 === undefined) k2 = k;
|
|
19
|
-
o[k2] = m[k];
|
|
20
|
-
}));
|
|
21
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
22
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
23
|
-
}) : function(o, v) {
|
|
24
|
-
o["default"] = v;
|
|
25
|
-
});
|
|
26
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
27
|
-
if (mod && mod.__esModule) return mod;
|
|
28
|
-
var result = {};
|
|
29
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
30
|
-
__setModuleDefault(result, mod);
|
|
31
|
-
return result;
|
|
32
|
-
};
|
|
33
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
34
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
35
|
-
};
|
|
36
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
|
-
exports.GlobalPaths = void 0;
|
|
38
|
-
const path = __importStar(require("path"));
|
|
39
|
-
// BRAINTRUST: This was changed to be a relative import
|
|
40
|
-
const tryRealpath_1 = __importDefault(require("./tryRealpath"));
|
|
41
|
-
function nodeModulesPaths(basedir, options) {
|
|
42
|
-
const modules = options && options.moduleDirectory
|
|
43
|
-
? Array.from(options.moduleDirectory)
|
|
44
|
-
: ["node_modules"];
|
|
45
|
-
// ensure that `basedir` is an absolute path at this point,
|
|
46
|
-
// resolving against the process' current working directory
|
|
47
|
-
const basedirAbs = path.resolve(basedir);
|
|
48
|
-
let prefix = "/";
|
|
49
|
-
if (/^([A-Za-z]:)/.test(basedirAbs)) {
|
|
50
|
-
prefix = "";
|
|
51
|
-
}
|
|
52
|
-
else if (/^\\\\/.test(basedirAbs)) {
|
|
53
|
-
prefix = "\\\\";
|
|
54
|
-
}
|
|
55
|
-
// The node resolution algorithm (as implemented by NodeJS and TypeScript)
|
|
56
|
-
// traverses parents of the physical path, not the symlinked path
|
|
57
|
-
let physicalBasedir;
|
|
58
|
-
try {
|
|
59
|
-
physicalBasedir = (0, tryRealpath_1.default)(basedirAbs);
|
|
60
|
-
}
|
|
61
|
-
catch (_a) {
|
|
62
|
-
// realpath can throw, e.g. on mapped drives
|
|
63
|
-
physicalBasedir = basedirAbs;
|
|
64
|
-
}
|
|
65
|
-
const paths = [physicalBasedir];
|
|
66
|
-
let parsed = path.parse(physicalBasedir);
|
|
67
|
-
while (parsed.dir !== paths[paths.length - 1]) {
|
|
68
|
-
paths.push(parsed.dir);
|
|
69
|
-
parsed = path.parse(parsed.dir);
|
|
70
|
-
}
|
|
71
|
-
const dirs = paths.reduce((dirs, aPath) => {
|
|
72
|
-
for (const moduleDir of modules) {
|
|
73
|
-
if (path.isAbsolute(moduleDir)) {
|
|
74
|
-
if (aPath === basedirAbs && moduleDir) {
|
|
75
|
-
dirs.push(moduleDir);
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
else {
|
|
79
|
-
dirs.push(path.join(prefix, aPath, moduleDir));
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
return dirs;
|
|
83
|
-
}, []);
|
|
84
|
-
if (options.paths) {
|
|
85
|
-
dirs.push(...options.paths);
|
|
86
|
-
}
|
|
87
|
-
return dirs;
|
|
88
|
-
}
|
|
89
|
-
exports.default = nodeModulesPaths;
|
|
90
|
-
function findGlobalPaths() {
|
|
91
|
-
const { root } = path.parse(process.cwd());
|
|
92
|
-
const globalPath = path.join(root, "node_modules");
|
|
93
|
-
const resolvePaths = require.resolve.paths("/");
|
|
94
|
-
if (resolvePaths) {
|
|
95
|
-
// the global paths start one after the root node_modules
|
|
96
|
-
const rootIndex = resolvePaths.indexOf(globalPath);
|
|
97
|
-
return rootIndex > -1 ? resolvePaths.slice(rootIndex + 1) : [];
|
|
98
|
-
}
|
|
99
|
-
return [];
|
|
100
|
-
}
|
|
101
|
-
exports.GlobalPaths = findGlobalPaths();
|
package/dist/jest/tryRealpath.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
4
|
-
*
|
|
5
|
-
* This source code is licensed under the MIT license found in the
|
|
6
|
-
* LICENSE file in the root directory of this source tree.
|
|
7
|
-
*/
|
|
8
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
const graceful_fs_1 = require("graceful-fs");
|
|
10
|
-
function tryRealpath(path) {
|
|
11
|
-
try {
|
|
12
|
-
path = graceful_fs_1.realpathSync.native(path);
|
|
13
|
-
}
|
|
14
|
-
catch (error) {
|
|
15
|
-
if (error.code !== "ENOENT" && error.code !== "EISDIR") {
|
|
16
|
-
throw error;
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
return path;
|
|
20
|
-
}
|
|
21
|
-
exports.default = tryRealpath;
|