Aktueller Stand

This commit is contained in:
2026-01-23 01:33:35 +01:00
parent 082dc5e110
commit 2766dd12c5
10109 changed files with 1578841 additions and 77685 deletions

View File

@@ -1,4 +0,0 @@
/**
* Determines whether Node API is supported on the current platform and throws if not
*/
export declare function assertNodeAPISupported(): void;

View File

@@ -1,25 +0,0 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var assertNodeAPISupported_exports = {};
__export(assertNodeAPISupported_exports, {
assertNodeAPISupported: () => import_chunk_O5EOXX3N.assertNodeAPISupported
});
module.exports = __toCommonJS(assertNodeAPISupported_exports);
var import_chunk_O5EOXX3N = require("./chunk-O5EOXX3N.js");
var import_chunk_2ESYSVXG = require("./chunk-2ESYSVXG.js");

View File

@@ -1,34 +0,0 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var chunk_2U36ISZO_exports = {};
__export(chunk_2U36ISZO_exports, {
getNodeAPIName: () => getNodeAPIName
});
module.exports = __toCommonJS(chunk_2U36ISZO_exports);
var NODE_API_QUERY_ENGINE_URL_BASE = "libquery_engine";
function getNodeAPIName(binaryTarget, type) {
const isUrl = type === "url";
if (binaryTarget.includes("windows")) {
return isUrl ? `query_engine.dll.node` : `query_engine-${binaryTarget}.dll.node`;
} else if (binaryTarget.includes("darwin")) {
return isUrl ? `${NODE_API_QUERY_ENGINE_URL_BASE}.dylib.node` : `${NODE_API_QUERY_ENGINE_URL_BASE}-${binaryTarget}.dylib.node`;
} else {
return isUrl ? `${NODE_API_QUERY_ENGINE_URL_BASE}.so.node` : `${NODE_API_QUERY_ENGINE_URL_BASE}-${binaryTarget}.so.node`;
}
}

View File

@@ -26,8 +26,8 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var chunk_YDM7ULQH_exports = {};
__export(chunk_YDM7ULQH_exports, {
var chunk_7PMGXL6S_exports = {};
__export(chunk_7PMGXL6S_exports, {
computeLibSSLSpecificPaths: () => computeLibSSLSpecificPaths,
getArchFromUname: () => getArchFromUname,
getBinaryTargetForCurrentPlatform: () => getBinaryTargetForCurrentPlatform,
@@ -41,7 +41,7 @@ __export(chunk_YDM7ULQH_exports, {
parseOpenSSLVersion: () => parseOpenSSLVersion,
resolveDistro: () => resolveDistro
});
module.exports = __toCommonJS(chunk_YDM7ULQH_exports);
module.exports = __toCommonJS(chunk_7PMGXL6S_exports);
var import_chunk_FWMN4WME = require("./chunk-FWMN4WME.js");
var import_debug = __toESM(require("@prisma/debug"));
var import_child_process = __toESM(require("child_process"));
@@ -53,52 +53,52 @@ var e = Symbol.for("@ts-pattern/isVariadic");
var n = "@ts-pattern/anonymous-select-key";
var r = (t2) => Boolean(t2 && "object" == typeof t2);
var i = (e2) => e2 && !!e2[t];
var o = (n2, s2, c2) => {
var s = (n2, o2, c2) => {
if (i(n2)) {
const e2 = n2[t](), { matched: r2, selections: i2 } = e2.match(s2);
const e2 = n2[t](), { matched: r2, selections: i2 } = e2.match(o2);
return r2 && i2 && Object.keys(i2).forEach((t2) => c2(t2, i2[t2])), r2;
}
if (r(n2)) {
if (!r(s2)) return false;
if (!r(o2)) return false;
if (Array.isArray(n2)) {
if (!Array.isArray(s2)) return false;
if (!Array.isArray(o2)) return false;
let t2 = [], r2 = [], a = [];
for (const o2 of n2.keys()) {
const s3 = n2[o2];
i(s3) && s3[e] ? a.push(s3) : a.length ? r2.push(s3) : t2.push(s3);
for (const s2 of n2.keys()) {
const o3 = n2[s2];
i(o3) && o3[e] ? a.push(o3) : a.length ? r2.push(o3) : t2.push(o3);
}
if (a.length) {
if (a.length > 1) throw new Error("Pattern error: Using `...P.array(...)` several times in a single pattern is not allowed.");
if (s2.length < t2.length + r2.length) return false;
const e2 = s2.slice(0, t2.length), n3 = 0 === r2.length ? [] : s2.slice(-r2.length), i2 = s2.slice(t2.length, 0 === r2.length ? Infinity : -r2.length);
return t2.every((t3, n4) => o(t3, e2[n4], c2)) && r2.every((t3, e3) => o(t3, n3[e3], c2)) && (0 === a.length || o(a[0], i2, c2));
if (o2.length < t2.length + r2.length) return false;
const e2 = o2.slice(0, t2.length), n3 = 0 === r2.length ? [] : o2.slice(-r2.length), i2 = o2.slice(t2.length, 0 === r2.length ? Infinity : -r2.length);
return t2.every((t3, n4) => s(t3, e2[n4], c2)) && r2.every((t3, e3) => s(t3, n3[e3], c2)) && (0 === a.length || s(a[0], i2, c2));
}
return n2.length === s2.length && n2.every((t3, e2) => o(t3, s2[e2], c2));
return n2.length === o2.length && n2.every((t3, e2) => s(t3, o2[e2], c2));
}
return Object.keys(n2).every((e2) => {
return Reflect.ownKeys(n2).every((e2) => {
const r2 = n2[e2];
return (e2 in s2 || i(a = r2) && "optional" === a[t]().matcherType) && o(r2, s2[e2], c2);
return (e2 in o2 || i(a = r2) && "optional" === a[t]().matcherType) && s(r2, o2[e2], c2);
var a;
});
}
return Object.is(s2, n2);
return Object.is(o2, n2);
};
var s = (e2) => {
var n2, o2, a;
return r(e2) ? i(e2) ? null != (n2 = null == (o2 = (a = e2[t]()).getSelectionKeys) ? void 0 : o2.call(a)) ? n2 : [] : Array.isArray(e2) ? c(e2, s) : c(Object.values(e2), s) : [];
var o = (e2) => {
var n2, s2, a;
return r(e2) ? i(e2) ? null != (n2 = null == (s2 = (a = e2[t]()).getSelectionKeys) ? void 0 : s2.call(a)) ? n2 : [] : Array.isArray(e2) ? c(e2, o) : c(Object.values(e2), o) : [];
};
var c = (t2, e2) => t2.reduce((t3, n2) => t3.concat(e2(n2)), []);
function u(t2) {
return Object.assign(t2, { optional: () => l(t2), and: (e2) => m(t2, e2), or: (e2) => d(t2, e2), select: (e2) => void 0 === e2 ? p(t2) : p(e2, t2) });
return Object.assign(t2, { optional: () => h(t2), and: (e2) => m(t2, e2), or: (e2) => d(t2, e2), select: (e2) => void 0 === e2 ? y(t2) : y(e2, t2) });
}
function l(e2) {
function h(e2) {
return u({ [t]: () => ({ match: (t2) => {
let n2 = {};
const r2 = (t3, e3) => {
n2[t3] = e3;
};
return void 0 === t2 ? (s(e2).forEach((t3) => r2(t3, void 0)), { matched: true, selections: n2 }) : { matched: o(e2, t2, r2), selections: n2 };
}, getSelectionKeys: () => s(e2), matcherType: "optional" }) });
return void 0 === t2 ? (o(e2).forEach((t3) => r2(t3, void 0)), { matched: true, selections: n2 }) : { matched: s(e2, t2, r2), selections: n2 };
}, getSelectionKeys: () => o(e2), matcherType: "optional" }) });
}
function m(...e2) {
return u({ [t]: () => ({ match: (t2) => {
@@ -106,8 +106,8 @@ function m(...e2) {
const r2 = (t3, e3) => {
n2[t3] = e3;
};
return { matched: e2.every((e3) => o(e3, t2, r2)), selections: n2 };
}, getSelectionKeys: () => c(e2, s), matcherType: "and" }) });
return { matched: e2.every((e3) => s(e3, t2, r2)), selections: n2 };
}, getSelectionKeys: () => c(e2, o), matcherType: "and" }) });
}
function d(...e2) {
return u({ [t]: () => ({ match: (t2) => {
@@ -115,20 +115,20 @@ function d(...e2) {
const r2 = (t3, e3) => {
n2[t3] = e3;
};
return c(e2, s).forEach((t3) => r2(t3, void 0)), { matched: e2.some((e3) => o(e3, t2, r2)), selections: n2 };
}, getSelectionKeys: () => c(e2, s), matcherType: "or" }) });
return c(e2, o).forEach((t3) => r2(t3, void 0)), { matched: e2.some((e3) => s(e3, t2, r2)), selections: n2 };
}, getSelectionKeys: () => c(e2, o), matcherType: "or" }) });
}
function y(e2) {
function p(e2) {
return { [t]: () => ({ match: (t2) => ({ matched: Boolean(e2(t2)) }) }) };
}
function p(...e2) {
function y(...e2) {
const r2 = "string" == typeof e2[0] ? e2[0] : void 0, i2 = 2 === e2.length ? e2[1] : "string" == typeof e2[0] ? void 0 : e2[0];
return u({ [t]: () => ({ match: (t2) => {
let e3 = { [null != r2 ? r2 : n]: t2 };
return { matched: void 0 === i2 || o(i2, t2, (t3, n2) => {
return { matched: void 0 === i2 || s(i2, t2, (t3, n2) => {
e3[t3] = n2;
}), selections: e3 };
}, getSelectionKeys: () => [null != r2 ? r2 : n].concat(void 0 === i2 ? [] : s(i2)) }) });
}, getSelectionKeys: () => [null != r2 ? r2 : n].concat(void 0 === i2 ? [] : o(i2)) }) });
}
function v(t2) {
return "number" == typeof t2;
@@ -139,44 +139,55 @@ function b(t2) {
function w(t2) {
return "bigint" == typeof t2;
}
var S = u(y(function(t2) {
var S = u(p(function(t2) {
return true;
}));
var j = (t2) => Object.assign(u(t2), { startsWith: (e2) => {
return j(m(t2, (n2 = e2, y((t3) => b(t3) && t3.startsWith(n2)))));
return j(m(t2, (n2 = e2, p((t3) => b(t3) && t3.startsWith(n2)))));
var n2;
}, endsWith: (e2) => {
return j(m(t2, (n2 = e2, y((t3) => b(t3) && t3.endsWith(n2)))));
return j(m(t2, (n2 = e2, p((t3) => b(t3) && t3.endsWith(n2)))));
var n2;
}, minLength: (e2) => j(m(t2, ((t3) => y((e3) => b(e3) && e3.length >= t3))(e2))), length: (e2) => j(m(t2, ((t3) => y((e3) => b(e3) && e3.length === t3))(e2))), maxLength: (e2) => j(m(t2, ((t3) => y((e3) => b(e3) && e3.length <= t3))(e2))), includes: (e2) => {
return j(m(t2, (n2 = e2, y((t3) => b(t3) && t3.includes(n2)))));
}, minLength: (e2) => j(m(t2, ((t3) => p((e3) => b(e3) && e3.length >= t3))(e2))), length: (e2) => j(m(t2, ((t3) => p((e3) => b(e3) && e3.length === t3))(e2))), maxLength: (e2) => j(m(t2, ((t3) => p((e3) => b(e3) && e3.length <= t3))(e2))), includes: (e2) => {
return j(m(t2, (n2 = e2, p((t3) => b(t3) && t3.includes(n2)))));
var n2;
}, regex: (e2) => {
return j(m(t2, (n2 = e2, y((t3) => b(t3) && Boolean(t3.match(n2))))));
return j(m(t2, (n2 = e2, p((t3) => b(t3) && Boolean(t3.match(n2))))));
var n2;
} });
var E = j(y(b));
var K = (t2) => Object.assign(u(t2), { between: (e2, n2) => K(m(t2, ((t3, e3) => y((n3) => v(n3) && t3 <= n3 && e3 >= n3))(e2, n2))), lt: (e2) => K(m(t2, ((t3) => y((e3) => v(e3) && e3 < t3))(e2))), gt: (e2) => K(m(t2, ((t3) => y((e3) => v(e3) && e3 > t3))(e2))), lte: (e2) => K(m(t2, ((t3) => y((e3) => v(e3) && e3 <= t3))(e2))), gte: (e2) => K(m(t2, ((t3) => y((e3) => v(e3) && e3 >= t3))(e2))), int: () => K(m(t2, y((t3) => v(t3) && Number.isInteger(t3)))), finite: () => K(m(t2, y((t3) => v(t3) && Number.isFinite(t3)))), positive: () => K(m(t2, y((t3) => v(t3) && t3 > 0))), negative: () => K(m(t2, y((t3) => v(t3) && t3 < 0))) });
var x = K(y(v));
var A = (t2) => Object.assign(u(t2), { between: (e2, n2) => A(m(t2, ((t3, e3) => y((n3) => w(n3) && t3 <= n3 && e3 >= n3))(e2, n2))), lt: (e2) => A(m(t2, ((t3) => y((e3) => w(e3) && e3 < t3))(e2))), gt: (e2) => A(m(t2, ((t3) => y((e3) => w(e3) && e3 > t3))(e2))), lte: (e2) => A(m(t2, ((t3) => y((e3) => w(e3) && e3 <= t3))(e2))), gte: (e2) => A(m(t2, ((t3) => y((e3) => w(e3) && e3 >= t3))(e2))), positive: () => A(m(t2, y((t3) => w(t3) && t3 > 0))), negative: () => A(m(t2, y((t3) => w(t3) && t3 < 0))) });
var P = A(y(w));
var T = u(y(function(t2) {
var K = j(p(b));
var x = (t2) => Object.assign(u(t2), { between: (e2, n2) => x(m(t2, ((t3, e3) => p((n3) => v(n3) && t3 <= n3 && e3 >= n3))(e2, n2))), lt: (e2) => x(m(t2, ((t3) => p((e3) => v(e3) && e3 < t3))(e2))), gt: (e2) => x(m(t2, ((t3) => p((e3) => v(e3) && e3 > t3))(e2))), lte: (e2) => x(m(t2, ((t3) => p((e3) => v(e3) && e3 <= t3))(e2))), gte: (e2) => x(m(t2, ((t3) => p((e3) => v(e3) && e3 >= t3))(e2))), int: () => x(m(t2, p((t3) => v(t3) && Number.isInteger(t3)))), finite: () => x(m(t2, p((t3) => v(t3) && Number.isFinite(t3)))), positive: () => x(m(t2, p((t3) => v(t3) && t3 > 0))), negative: () => x(m(t2, p((t3) => v(t3) && t3 < 0))) });
var E = x(p(v));
var A = (t2) => Object.assign(u(t2), { between: (e2, n2) => A(m(t2, ((t3, e3) => p((n3) => w(n3) && t3 <= n3 && e3 >= n3))(e2, n2))), lt: (e2) => A(m(t2, ((t3) => p((e3) => w(e3) && e3 < t3))(e2))), gt: (e2) => A(m(t2, ((t3) => p((e3) => w(e3) && e3 > t3))(e2))), lte: (e2) => A(m(t2, ((t3) => p((e3) => w(e3) && e3 <= t3))(e2))), gte: (e2) => A(m(t2, ((t3) => p((e3) => w(e3) && e3 >= t3))(e2))), positive: () => A(m(t2, p((t3) => w(t3) && t3 > 0))), negative: () => A(m(t2, p((t3) => w(t3) && t3 < 0))) });
var P = A(p(w));
var T = u(p(function(t2) {
return "boolean" == typeof t2;
}));
var k = u(y(function(t2) {
var B = u(p(function(t2) {
return "symbol" == typeof t2;
}));
var B = u(y(function(t2) {
var _ = u(p(function(t2) {
return null == t2;
}));
var _ = u(y(function(t2) {
var k = u(p(function(t2) {
return null != t2;
}));
var W = { matched: false, value: void 0 };
function $(t2) {
return new z(t2, W);
var W = class extends Error {
constructor(t2) {
let e2;
try {
e2 = JSON.stringify(t2);
} catch (n2) {
e2 = t2;
}
super(`Pattern matching error: no pattern matches value ${e2}`), this.input = void 0, this.input = t2;
}
};
var $ = { matched: false, value: void 0 };
function z(t2) {
return new I(t2, $);
}
var z = class _z {
var I = class _I {
constructor(t2, e2) {
this.input = void 0, this.state = void 0, this.input = t2, this.state = e2;
}
@@ -185,29 +196,23 @@ var z = class _z {
const e2 = t2[t2.length - 1], r2 = [t2[0]];
let i2;
3 === t2.length && "function" == typeof t2[1] ? i2 = t2[1] : t2.length > 2 && r2.push(...t2.slice(1, t2.length - 1));
let s2 = false, c2 = {};
let o2 = false, c2 = {};
const a = (t3, e3) => {
s2 = true, c2[t3] = e3;
}, u2 = !r2.some((t3) => o(t3, this.input, a)) || i2 && !Boolean(i2(this.input)) ? W : { matched: true, value: e2(s2 ? n in c2 ? c2[n] : c2 : this.input, this.input) };
return new _z(this.input, u2);
o2 = true, c2[t3] = e3;
}, u2 = !r2.some((t3) => s(t3, this.input, a)) || i2 && !Boolean(i2(this.input)) ? $ : { matched: true, value: e2(o2 ? n in c2 ? c2[n] : c2 : this.input, this.input) };
return new _I(this.input, u2);
}
when(t2, e2) {
if (this.state.matched) return this;
const n2 = Boolean(t2(this.input));
return new _z(this.input, n2 ? { matched: true, value: e2(this.input, this.input) } : W);
return new _I(this.input, n2 ? { matched: true, value: e2(this.input, this.input) } : $);
}
otherwise(t2) {
return this.state.matched ? this.state.value : t2(this.input);
}
exhaustive() {
if (this.state.matched) return this.state.value;
let t2;
try {
t2 = JSON.stringify(this.input);
} catch (e2) {
t2 = this.input;
}
throw new Error(`Pattern matching error: no pattern matches value ${t2}`);
throw new W(this.input);
}
run() {
return this.exhaustive();
@@ -261,7 +266,7 @@ function parseDistro(osReleaseInput) {
const id = idMatch && idMatch[1] && idMatch[1].toLowerCase() || "";
const idLikeMatch = idLikeRegex.exec(osReleaseInput);
const idLike = idLikeMatch && idLikeMatch[1] && idLikeMatch[1].toLowerCase() || "";
const distroInfo = $({ id, idLike }).with(
const distroInfo = z({ id, idLike }).with(
{ id: "alpine" },
({ id: originalDistro }) => ({
targetDistro: "musl",
@@ -375,9 +380,9 @@ function sanitiseSSLVersion(version) {
return void 0;
}
function computeLibSSLSpecificPaths(args) {
return $(args).with({ familyDistro: "musl" }, () => {
return z(args).with({ familyDistro: "musl" }, () => {
debug('Trying platform-specific paths for "alpine"');
return ["/lib"];
return ["/lib", "/usr/lib"];
}).with({ familyDistro: "debian" }, ({ archFromUname }) => {
debug('Trying platform-specific paths for "debian" (and "ubuntu")');
return [`/usr/lib/${archFromUname}-linux-gnu`, `/lib/${archFromUname}-linux-gnu`];
@@ -415,7 +420,7 @@ async function getSSLVersion(libsslSpecificPaths) {
`ldconfig -p | sed "s/.*=>s*//" | sed "s|.*/||" | grep libssl | sort | ${excludeLibssl0x}`
);
if (!libsslFilename) {
libsslFilename = await findLibSSLInLocations(["/lib64", "/usr/lib64", "/lib"]);
libsslFilename = await findLibSSLInLocations(["/lib64", "/usr/lib64", "/lib", "/usr/lib"]);
}
if (libsslFilename) {
debug(`Found libssl.so file using "ldconfig" or other generic paths: ${libsslFilename}`);
@@ -487,7 +492,7 @@ function getBinaryTargetForCurrentPlatformInternal(args) {
}
const defaultLibssl = "1.1.x";
if (platform === "linux" && libssl === void 0) {
const additionalMessage = $({ familyDistro }).with({ familyDistro: "debian" }, () => {
const additionalMessage = z({ familyDistro }).with({ familyDistro: "debian" }, () => {
return "Please manually install OpenSSL via `apt-get update -y && apt-get install -y openssl` and try installing Prisma again. If you're running Prisma on Docker, add this command to your Dockerfile, or switch to an image that already has OpenSSL installed.";
}).otherwise(() => {
return "Please manually install OpenSSL and try installing Prisma again.";

View File

@@ -1,367 +0,0 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var chunk_D7S5FGQN_exports = {};
__export(chunk_D7S5FGQN_exports, {
link: () => link
});
module.exports = __toCommonJS(chunk_D7S5FGQN_exports);
var import_chunk_YVXCXD3A = require("./chunk-YVXCXD3A.js");
var import_chunk_2ESYSVXG = require("./chunk-2ESYSVXG.js");
var require_ansi_escapes = (0, import_chunk_2ESYSVXG.__commonJS)({
"../../node_modules/.pnpm/ansi-escapes@4.3.2/node_modules/ansi-escapes/index.js"(exports, module2) {
"use strict";
var ansiEscapes = module2.exports;
module2.exports.default = ansiEscapes;
var ESC = "\x1B[";
var OSC = "\x1B]";
var BEL = "\x07";
var SEP = ";";
var isTerminalApp = process.env.TERM_PROGRAM === "Apple_Terminal";
ansiEscapes.cursorTo = (x, y) => {
if (typeof x !== "number") {
throw new TypeError("The `x` argument is required");
}
if (typeof y !== "number") {
return ESC + (x + 1) + "G";
}
return ESC + (y + 1) + ";" + (x + 1) + "H";
};
ansiEscapes.cursorMove = (x, y) => {
if (typeof x !== "number") {
throw new TypeError("The `x` argument is required");
}
let ret = "";
if (x < 0) {
ret += ESC + -x + "D";
} else if (x > 0) {
ret += ESC + x + "C";
}
if (y < 0) {
ret += ESC + -y + "A";
} else if (y > 0) {
ret += ESC + y + "B";
}
return ret;
};
ansiEscapes.cursorUp = (count = 1) => ESC + count + "A";
ansiEscapes.cursorDown = (count = 1) => ESC + count + "B";
ansiEscapes.cursorForward = (count = 1) => ESC + count + "C";
ansiEscapes.cursorBackward = (count = 1) => ESC + count + "D";
ansiEscapes.cursorLeft = ESC + "G";
ansiEscapes.cursorSavePosition = isTerminalApp ? "\x1B7" : ESC + "s";
ansiEscapes.cursorRestorePosition = isTerminalApp ? "\x1B8" : ESC + "u";
ansiEscapes.cursorGetPosition = ESC + "6n";
ansiEscapes.cursorNextLine = ESC + "E";
ansiEscapes.cursorPrevLine = ESC + "F";
ansiEscapes.cursorHide = ESC + "?25l";
ansiEscapes.cursorShow = ESC + "?25h";
ansiEscapes.eraseLines = (count) => {
let clear = "";
for (let i = 0; i < count; i++) {
clear += ansiEscapes.eraseLine + (i < count - 1 ? ansiEscapes.cursorUp() : "");
}
if (count) {
clear += ansiEscapes.cursorLeft;
}
return clear;
};
ansiEscapes.eraseEndLine = ESC + "K";
ansiEscapes.eraseStartLine = ESC + "1K";
ansiEscapes.eraseLine = ESC + "2K";
ansiEscapes.eraseDown = ESC + "J";
ansiEscapes.eraseUp = ESC + "1J";
ansiEscapes.eraseScreen = ESC + "2J";
ansiEscapes.scrollUp = ESC + "S";
ansiEscapes.scrollDown = ESC + "T";
ansiEscapes.clearScreen = "\x1Bc";
ansiEscapes.clearTerminal = process.platform === "win32" ? `${ansiEscapes.eraseScreen}${ESC}0f` : (
// 1. Erases the screen (Only done in case `2` is not supported)
// 2. Erases the whole screen including scrollback buffer
// 3. Moves cursor to the top-left position
// More info: https://www.real-world-systems.com/docs/ANSIcode.html
`${ansiEscapes.eraseScreen}${ESC}3J${ESC}H`
);
ansiEscapes.beep = BEL;
ansiEscapes.link = (text, url) => {
return [
OSC,
"8",
SEP,
SEP,
url,
BEL,
text,
OSC,
"8",
SEP,
SEP,
BEL
].join("");
};
ansiEscapes.image = (buffer, options = {}) => {
let ret = `${OSC}1337;File=inline=1`;
if (options.width) {
ret += `;width=${options.width}`;
}
if (options.height) {
ret += `;height=${options.height}`;
}
if (options.preserveAspectRatio === false) {
ret += ";preserveAspectRatio=0";
}
return ret + ":" + buffer.toString("base64") + BEL;
};
ansiEscapes.iTerm = {
setCwd: (cwd = process.cwd()) => `${OSC}50;CurrentDir=${cwd}${BEL}`,
annotation: (message, options = {}) => {
let ret = `${OSC}1337;`;
const hasX = typeof options.x !== "undefined";
const hasY = typeof options.y !== "undefined";
if ((hasX || hasY) && !(hasX && hasY && typeof options.length !== "undefined")) {
throw new Error("`x`, `y` and `length` must be defined when `x` or `y` is defined");
}
message = message.replace(/\|/g, "");
ret += options.isHidden ? "AddHiddenAnnotation=" : "AddAnnotation=";
if (options.length > 0) {
ret += (hasX ? [message, options.length, options.x, options.y] : [options.length, message]).join("|");
} else {
ret += message;
}
return ret + BEL;
}
};
}
});
var require_has_flag = (0, import_chunk_2ESYSVXG.__commonJS)({
"../../node_modules/.pnpm/has-flag@4.0.0/node_modules/has-flag/index.js"(exports, module2) {
"use strict";
module2.exports = (flag, argv = process.argv) => {
const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
const position = argv.indexOf(prefix + flag);
const terminatorPosition = argv.indexOf("--");
return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
};
}
});
var require_supports_color = (0, import_chunk_2ESYSVXG.__commonJS)({
"../../node_modules/.pnpm/supports-color@7.2.0/node_modules/supports-color/index.js"(exports, module2) {
"use strict";
var os = (0, import_chunk_2ESYSVXG.__require)("os");
var tty = (0, import_chunk_2ESYSVXG.__require)("tty");
var hasFlag = require_has_flag();
var { env } = process;
var forceColor;
if (hasFlag("no-color") || hasFlag("no-colors") || hasFlag("color=false") || hasFlag("color=never")) {
forceColor = 0;
} else if (hasFlag("color") || hasFlag("colors") || hasFlag("color=true") || hasFlag("color=always")) {
forceColor = 1;
}
if ("FORCE_COLOR" in env) {
if (env.FORCE_COLOR === "true") {
forceColor = 1;
} else if (env.FORCE_COLOR === "false") {
forceColor = 0;
} else {
forceColor = env.FORCE_COLOR.length === 0 ? 1 : Math.min(parseInt(env.FORCE_COLOR, 10), 3);
}
}
function translateLevel(level) {
if (level === 0) {
return false;
}
return {
level,
hasBasic: true,
has256: level >= 2,
has16m: level >= 3
};
}
function supportsColor(haveStream, streamIsTTY) {
if (forceColor === 0) {
return 0;
}
if (hasFlag("color=16m") || hasFlag("color=full") || hasFlag("color=truecolor")) {
return 3;
}
if (hasFlag("color=256")) {
return 2;
}
if (haveStream && !streamIsTTY && forceColor === void 0) {
return 0;
}
const min = forceColor || 0;
if (env.TERM === "dumb") {
return min;
}
if (process.platform === "win32") {
const osRelease = os.release().split(".");
if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
return Number(osRelease[2]) >= 14931 ? 3 : 2;
}
return 1;
}
if ("CI" in env) {
if (["TRAVIS", "CIRCLECI", "APPVEYOR", "GITLAB_CI", "GITHUB_ACTIONS", "BUILDKITE"].some((sign) => sign in env) || env.CI_NAME === "codeship") {
return 1;
}
return min;
}
if ("TEAMCITY_VERSION" in env) {
return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
}
if (env.COLORTERM === "truecolor") {
return 3;
}
if ("TERM_PROGRAM" in env) {
const version = parseInt((env.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
switch (env.TERM_PROGRAM) {
case "iTerm.app":
return version >= 3 ? 3 : 2;
case "Apple_Terminal":
return 2;
}
}
if (/-256(color)?$/i.test(env.TERM)) {
return 2;
}
if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {
return 1;
}
if ("COLORTERM" in env) {
return 1;
}
return min;
}
function getSupportLevel(stream) {
const level = supportsColor(stream, stream && stream.isTTY);
return translateLevel(level);
}
module2.exports = {
supportsColor: getSupportLevel,
stdout: translateLevel(supportsColor(true, tty.isatty(1))),
stderr: translateLevel(supportsColor(true, tty.isatty(2)))
};
}
});
var require_supports_hyperlinks = (0, import_chunk_2ESYSVXG.__commonJS)({
"../../node_modules/.pnpm/supports-hyperlinks@2.3.0/node_modules/supports-hyperlinks/index.js"(exports, module2) {
"use strict";
var supportsColor = require_supports_color();
var hasFlag = require_has_flag();
function parseVersion(versionString) {
if (/^\d{3,4}$/.test(versionString)) {
const m = /(\d{1,2})(\d{2})/.exec(versionString);
return {
major: 0,
minor: parseInt(m[1], 10),
patch: parseInt(m[2], 10)
};
}
const versions = (versionString || "").split(".").map((n) => parseInt(n, 10));
return {
major: versions[0],
minor: versions[1],
patch: versions[2]
};
}
function supportsHyperlink(stream) {
const { env } = process;
if ("FORCE_HYPERLINK" in env) {
return !(env.FORCE_HYPERLINK.length > 0 && parseInt(env.FORCE_HYPERLINK, 10) === 0);
}
if (hasFlag("no-hyperlink") || hasFlag("no-hyperlinks") || hasFlag("hyperlink=false") || hasFlag("hyperlink=never")) {
return false;
}
if (hasFlag("hyperlink=true") || hasFlag("hyperlink=always")) {
return true;
}
if ("NETLIFY" in env) {
return true;
}
if (!supportsColor.supportsColor(stream)) {
return false;
}
if (stream && !stream.isTTY) {
return false;
}
if (process.platform === "win32") {
return false;
}
if ("CI" in env) {
return false;
}
if ("TEAMCITY_VERSION" in env) {
return false;
}
if ("TERM_PROGRAM" in env) {
const version = parseVersion(env.TERM_PROGRAM_VERSION);
switch (env.TERM_PROGRAM) {
case "iTerm.app":
if (version.major === 3) {
return version.minor >= 1;
}
return version.major > 3;
case "WezTerm":
return version.major >= 20200620;
case "vscode":
return version.major > 1 || version.major === 1 && version.minor >= 72;
}
}
if ("VTE_VERSION" in env) {
if (env.VTE_VERSION === "0.50.0") {
return false;
}
const version = parseVersion(env.VTE_VERSION);
return version.major > 0 || version.minor >= 50;
}
return false;
}
module2.exports = {
supportsHyperlink,
stdout: supportsHyperlink(process.stdout),
stderr: supportsHyperlink(process.stderr)
};
}
});
var require_terminal_link = (0, import_chunk_2ESYSVXG.__commonJS)({
"../../node_modules/.pnpm/terminal-link@2.1.1/node_modules/terminal-link/index.js"(exports, module2) {
"use strict";
var ansiEscapes = require_ansi_escapes();
var supportsHyperlinks = require_supports_hyperlinks();
var terminalLink2 = (text, url, { target = "stdout", ...options } = {}) => {
if (!supportsHyperlinks[target]) {
if (options.fallback === false) {
return text;
}
return typeof options.fallback === "function" ? options.fallback(text, url) : `${text} (\u200B${url}\u200B)`;
}
return ansiEscapes.link(text, url);
};
module2.exports = (text, url, options = {}) => terminalLink2(text, url, options);
module2.exports.stderr = (text, url, options = {}) => terminalLink2(text, url, { target: "stderr", ...options });
module2.exports.isSupported = supportsHyperlinks.stdout;
module2.exports.stderr.isSupported = supportsHyperlinks.stderr;
}
});
var import_terminal_link = (0, import_chunk_2ESYSVXG.__toESM)(require_terminal_link());
function link(url) {
return (0, import_terminal_link.default)(url, url, {
fallback: import_chunk_YVXCXD3A.underline
});
}

View File

@@ -0,0 +1,167 @@
"use strict";
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var chunk_GGL63BNP_exports = {};
__export(chunk_GGL63BNP_exports, {
jestConsoleContext: () => jestConsoleContext,
jestContext: () => jestContext,
jestStdoutContext: () => jestStdoutContext,
processExitContext: () => processExitContext
});
module.exports = __toCommonJS(chunk_GGL63BNP_exports);
var import_chunk_3UEKS5W6 = require("./chunk-3UEKS5W6.js");
var import_chunk_2ESYSVXG = require("./chunk-2ESYSVXG.js");
var import_node_path = __toESM(require("node:path"));
var import_fs_jetpack = (0, import_chunk_2ESYSVXG.__toESM)((0, import_chunk_3UEKS5W6.require_main)());
var import_tempy = (0, import_chunk_2ESYSVXG.__toESM)((0, import_chunk_3UEKS5W6.require_tempy)());
var jestContext = {
new: function(ctx = {}) {
const c = ctx;
beforeEach(() => {
const originalCwd = process.cwd();
c.mocked = c.mocked ?? {
cwd: process.cwd()
};
c.tmpDir = import_tempy.default.directory();
c.fs = import_fs_jetpack.default.cwd(c.tmpDir);
c.tree = (startFrom = c.tmpDir, indent = "") => {
function* generateDirectoryTree(children2, indent2 = "") {
for (const child of children2) {
if (child.name === "node_modules" || child.name === ".git") {
continue;
}
if (child.type === "dir") {
yield `${indent2}\u2514\u2500\u2500 ${child.name}/`;
yield* generateDirectoryTree(child.children, indent2 + " ");
} else if (child.type === "symlink") {
yield `${indent2} -> ${child.relativePath}`;
} else {
yield `${indent2}\u2514\u2500\u2500 ${child.name}`;
}
}
}
const children = c.fs.inspectTree(startFrom, { relativePath: true, symlinks: "report" })?.children || [];
return `
${[...generateDirectoryTree(children, indent)].join("\n")}
`;
};
c.fixture = (name) => {
c.fs.copy(import_node_path.default.join(originalCwd, "src", "__tests__", "fixtures", name), ".", {
overwrite: true
});
c.fs.symlink(import_node_path.default.join(originalCwd, "..", "client"), import_node_path.default.join(c.fs.cwd(), "node_modules", "@prisma", "client"));
c.fs.symlink(import_node_path.default.join(originalCwd, "..", "config"), import_node_path.default.join(c.fs.cwd(), "node_modules", "@prisma", "config"));
};
c.cli = (...input) => {
return (0, import_chunk_3UEKS5W6.execaNode)(import_node_path.default.join(originalCwd, "../cli/build/index.js"), input, {
cwd: c.fs.cwd(),
stdio: "pipe",
all: true
});
};
c.printDir = (dir, extensions) => {
const content = c.fs.list(dir) ?? [];
content.sort((a, b) => a.localeCompare(b));
return content.filter((name) => extensions.includes(import_node_path.default.extname(name))).map((name) => `${name}:
${c.fs.read(import_node_path.default.join(dir, name))}`).join("\n\n");
};
process.chdir(c.tmpDir);
});
afterEach(() => {
process.chdir(c.mocked.cwd);
});
return factory(ctx);
}
};
function factory(ctx) {
return {
add(contextContributor) {
const newCtx = contextContributor(ctx);
return factory(newCtx);
},
assemble() {
return ctx;
}
};
}
var jestConsoleContext = () => (c) => {
const ctx = c;
beforeEach(() => {
ctx.mocked["console.error"] = jest.spyOn(console, "error").mockImplementation(() => {
});
ctx.mocked["console.log"] = jest.spyOn(console, "log").mockImplementation(() => {
});
ctx.mocked["console.info"] = jest.spyOn(console, "info").mockImplementation(() => {
});
ctx.mocked["console.warn"] = jest.spyOn(console, "warn").mockImplementation(() => {
});
});
afterEach(() => {
ctx.mocked["console.error"].mockRestore();
ctx.mocked["console.log"].mockRestore();
ctx.mocked["console.info"].mockRestore();
ctx.mocked["console.warn"].mockRestore();
});
return ctx;
};
var jestStdoutContext = ({ normalizationRules } = { normalizationRules: [] }) => (c) => {
const ctx = c;
const normalize = (text, rules) => {
for (const [pattern, replacement] of rules) {
text = text.replace(pattern, replacement);
}
return text;
};
beforeEach(() => {
ctx.mocked["process.stderr.write"] = jest.spyOn(process.stderr, "write").mockImplementation(() => true);
ctx.mocked["process.stdout.write"] = jest.spyOn(process.stdout, "write").mockImplementation(() => true);
ctx.normalizedCapturedStdout = () => normalize(ctx.mocked["process.stdout.write"].mock.calls.join(""), normalizationRules);
ctx.normalizedCapturedStderr = () => normalize(ctx.mocked["process.stderr.write"].mock.calls.join(""), normalizationRules);
ctx.clearCapturedStdout = () => ctx.mocked["process.stdout.write"].mockClear();
ctx.clearCapturedStderr = () => ctx.mocked["process.stderr.write"].mockClear();
});
afterEach(() => {
ctx.mocked["process.stderr.write"].mockRestore();
ctx.mocked["process.stdout.write"].mockRestore();
});
return ctx;
};
var processExitContext = () => (c) => {
const ctx = c;
beforeEach(() => {
ctx.mocked["process.exit"] = jest.spyOn(process, "exit").mockImplementation((number) => {
throw new Error("process.exit: " + number);
});
ctx.recordedExitCode = () => ctx.mocked["process.exit"].mock.calls[0]?.[0];
});
afterEach(() => {
ctx.mocked["process.exit"].mockRestore();
});
return ctx;
};

View File

@@ -16,37 +16,37 @@ var __copyProps = (to, from, except, desc) => {
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var chunk_B23KD6U3_exports = {};
__export(chunk_B23KD6U3_exports, {
var chunk_IPLRRT6O_exports = {};
__export(chunk_IPLRRT6O_exports, {
binaryTargetRegex: () => binaryTargetRegex,
binaryTargetRegex_exports: () => binaryTargetRegex_exports,
init_binaryTargetRegex: () => init_binaryTargetRegex
});
module.exports = __toCommonJS(chunk_B23KD6U3_exports);
module.exports = __toCommonJS(chunk_IPLRRT6O_exports);
var import_chunk_7MLUNQIZ = require("./chunk-7MLUNQIZ.js");
var import_chunk_2ESYSVXG = require("./chunk-2ESYSVXG.js");
var require_escape_string_regexp = (0, import_chunk_2ESYSVXG.__commonJS)({
"../../node_modules/.pnpm/escape-string-regexp@4.0.0/node_modules/escape-string-regexp/index.js"(exports, module2) {
function escapeStringRegexp(string) {
if (typeof string !== "string") {
throw new TypeError("Expected a string");
}
return string.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&").replace(/-/g, "\\x2d");
}
var init_escape_string_regexp = (0, import_chunk_2ESYSVXG.__esm)({
"../../node_modules/.pnpm/escape-string-regexp@5.0.0/node_modules/escape-string-regexp/index.js"() {
"use strict";
module2.exports = (string) => {
if (typeof string !== "string") {
throw new TypeError("Expected a string");
}
return string.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&").replace(/-/g, "\\x2d");
};
}
});
var binaryTargetRegex_exports = {};
(0, import_chunk_2ESYSVXG.__export)(binaryTargetRegex_exports, {
binaryTargetRegex: () => binaryTargetRegex
});
var import_escape_string_regexp, binaryTargetRegex;
var binaryTargetRegex;
var init_binaryTargetRegex = (0, import_chunk_2ESYSVXG.__esm)({
"src/test-utils/binaryTargetRegex.ts"() {
import_escape_string_regexp = (0, import_chunk_2ESYSVXG.__toESM)(require_escape_string_regexp());
init_escape_string_regexp();
(0, import_chunk_7MLUNQIZ.init_binaryTargets)();
binaryTargetRegex = new RegExp(
"(" + [...import_chunk_7MLUNQIZ.binaryTargets].sort((a, b) => b.length - a.length).map((p) => (0, import_escape_string_regexp.default)(p)).join("|") + ")",
"(" + [...import_chunk_7MLUNQIZ.binaryTargets].sort((a, b) => b.length - a.length).map((p) => escapeStringRegexp(p)).join("|") + ")",
"g"
);
}

View File

@@ -0,0 +1,429 @@
"use strict";
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var chunk_M5T7GI2R_exports = {};
__export(chunk_M5T7GI2R_exports, {
link: () => link2
});
module.exports = __toCommonJS(chunk_M5T7GI2R_exports);
var import_chunk_YVXCXD3A = require("./chunk-YVXCXD3A.js");
var import_chunk_2ESYSVXG = require("./chunk-2ESYSVXG.js");
var import_node_process = __toESM(require("node:process"));
var require_has_flag = (0, import_chunk_2ESYSVXG.__commonJS)({
"../../node_modules/.pnpm/has-flag@4.0.0/node_modules/has-flag/index.js"(exports, module2) {
"use strict";
module2.exports = (flag, argv = process.argv) => {
const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
const position = argv.indexOf(prefix + flag);
const terminatorPosition = argv.indexOf("--");
return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
};
}
});
var require_supports_color = (0, import_chunk_2ESYSVXG.__commonJS)({
"../../node_modules/.pnpm/supports-color@7.2.0/node_modules/supports-color/index.js"(exports, module2) {
"use strict";
var os = (0, import_chunk_2ESYSVXG.__require)("os");
var tty = (0, import_chunk_2ESYSVXG.__require)("tty");
var hasFlag = require_has_flag();
var { env } = process;
var forceColor;
if (hasFlag("no-color") || hasFlag("no-colors") || hasFlag("color=false") || hasFlag("color=never")) {
forceColor = 0;
} else if (hasFlag("color") || hasFlag("colors") || hasFlag("color=true") || hasFlag("color=always")) {
forceColor = 1;
}
if ("FORCE_COLOR" in env) {
if (env.FORCE_COLOR === "true") {
forceColor = 1;
} else if (env.FORCE_COLOR === "false") {
forceColor = 0;
} else {
forceColor = env.FORCE_COLOR.length === 0 ? 1 : Math.min(parseInt(env.FORCE_COLOR, 10), 3);
}
}
function translateLevel(level) {
if (level === 0) {
return false;
}
return {
level,
hasBasic: true,
has256: level >= 2,
has16m: level >= 3
};
}
function supportsColor(haveStream, streamIsTTY) {
if (forceColor === 0) {
return 0;
}
if (hasFlag("color=16m") || hasFlag("color=full") || hasFlag("color=truecolor")) {
return 3;
}
if (hasFlag("color=256")) {
return 2;
}
if (haveStream && !streamIsTTY && forceColor === void 0) {
return 0;
}
const min = forceColor || 0;
if (env.TERM === "dumb") {
return min;
}
if (process.platform === "win32") {
const osRelease = os.release().split(".");
if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
return Number(osRelease[2]) >= 14931 ? 3 : 2;
}
return 1;
}
if ("CI" in env) {
if (["TRAVIS", "CIRCLECI", "APPVEYOR", "GITLAB_CI", "GITHUB_ACTIONS", "BUILDKITE"].some((sign) => sign in env) || env.CI_NAME === "codeship") {
return 1;
}
return min;
}
if ("TEAMCITY_VERSION" in env) {
return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
}
if (env.COLORTERM === "truecolor") {
return 3;
}
if ("TERM_PROGRAM" in env) {
const version = parseInt((env.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
switch (env.TERM_PROGRAM) {
case "iTerm.app":
return version >= 3 ? 3 : 2;
case "Apple_Terminal":
return 2;
}
}
if (/-256(color)?$/i.test(env.TERM)) {
return 2;
}
if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {
return 1;
}
if ("COLORTERM" in env) {
return 1;
}
return min;
}
function getSupportLevel(stream) {
const level = supportsColor(stream, stream && stream.isTTY);
return translateLevel(level);
}
module2.exports = {
supportsColor: getSupportLevel,
stdout: translateLevel(supportsColor(true, tty.isatty(1))),
stderr: translateLevel(supportsColor(true, tty.isatty(2)))
};
}
});
var require_supports_hyperlinks = (0, import_chunk_2ESYSVXG.__commonJS)({
"../../node_modules/.pnpm/supports-hyperlinks@3.2.0/node_modules/supports-hyperlinks/index.js"(exports, module2) {
"use strict";
var supportsColor = require_supports_color();
var hasFlag = require_has_flag();
function parseVersion(versionString) {
if (/^\d{3,4}$/.test(versionString)) {
const m = /(\d{1,2})(\d{2})/.exec(versionString) || [];
return {
major: 0,
minor: parseInt(m[1], 10),
patch: parseInt(m[2], 10)
};
}
const versions = (versionString || "").split(".").map((n) => parseInt(n, 10));
return {
major: versions[0],
minor: versions[1],
patch: versions[2]
};
}
function supportsHyperlink(stream) {
const {
CI,
FORCE_HYPERLINK,
NETLIFY,
TEAMCITY_VERSION,
TERM_PROGRAM,
TERM_PROGRAM_VERSION,
VTE_VERSION,
TERM
} = process.env;
if (FORCE_HYPERLINK) {
return !(FORCE_HYPERLINK.length > 0 && parseInt(FORCE_HYPERLINK, 10) === 0);
}
if (hasFlag("no-hyperlink") || hasFlag("no-hyperlinks") || hasFlag("hyperlink=false") || hasFlag("hyperlink=never")) {
return false;
}
if (hasFlag("hyperlink=true") || hasFlag("hyperlink=always")) {
return true;
}
if (NETLIFY) {
return true;
}
if (!supportsColor.supportsColor(stream)) {
return false;
}
if (stream && !stream.isTTY) {
return false;
}
if ("WT_SESSION" in process.env) {
return true;
}
if (process.platform === "win32") {
return false;
}
if (CI) {
return false;
}
if (TEAMCITY_VERSION) {
return false;
}
if (TERM_PROGRAM) {
const version = parseVersion(TERM_PROGRAM_VERSION || "");
switch (TERM_PROGRAM) {
case "iTerm.app":
if (version.major === 3) {
return version.minor >= 1;
}
return version.major > 3;
case "WezTerm":
return version.major >= 20200620;
case "vscode":
return version.major > 1 || version.major === 1 && version.minor >= 72;
case "ghostty":
return true;
}
}
if (VTE_VERSION) {
if (VTE_VERSION === "0.50.0") {
return false;
}
const version = parseVersion(VTE_VERSION);
return version.major > 0 || version.minor >= 50;
}
switch (TERM) {
case "alacritty":
return true;
}
return false;
}
module2.exports = {
supportsHyperlink,
stdout: supportsHyperlink(process.stdout),
stderr: supportsHyperlink(process.stderr)
};
}
});
var base_exports = {};
(0, import_chunk_2ESYSVXG.__export)(base_exports, {
beep: () => beep,
clearScreen: () => clearScreen,
clearTerminal: () => clearTerminal,
cursorBackward: () => cursorBackward,
cursorDown: () => cursorDown,
cursorForward: () => cursorForward,
cursorGetPosition: () => cursorGetPosition,
cursorHide: () => cursorHide,
cursorLeft: () => cursorLeft,
cursorMove: () => cursorMove,
cursorNextLine: () => cursorNextLine,
cursorPrevLine: () => cursorPrevLine,
cursorRestorePosition: () => cursorRestorePosition,
cursorSavePosition: () => cursorSavePosition,
cursorShow: () => cursorShow,
cursorTo: () => cursorTo,
cursorUp: () => cursorUp,
enterAlternativeScreen: () => enterAlternativeScreen,
eraseDown: () => eraseDown,
eraseEndLine: () => eraseEndLine,
eraseLine: () => eraseLine,
eraseLines: () => eraseLines,
eraseScreen: () => eraseScreen,
eraseStartLine: () => eraseStartLine,
eraseUp: () => eraseUp,
exitAlternativeScreen: () => exitAlternativeScreen,
iTerm: () => iTerm,
image: () => image,
link: () => link,
scrollDown: () => scrollDown,
scrollUp: () => scrollUp
});
var isBrowser = globalThis.window?.document !== void 0;
var isNode = globalThis.process?.versions?.node !== void 0;
var isBun = globalThis.process?.versions?.bun !== void 0;
var isDeno = globalThis.Deno?.version?.deno !== void 0;
var isElectron = globalThis.process?.versions?.electron !== void 0;
var isJsDom = globalThis.navigator?.userAgent?.includes("jsdom") === true;
var isWebWorker = typeof WorkerGlobalScope !== "undefined" && globalThis instanceof WorkerGlobalScope;
var isDedicatedWorker = typeof DedicatedWorkerGlobalScope !== "undefined" && globalThis instanceof DedicatedWorkerGlobalScope;
var isSharedWorker = typeof SharedWorkerGlobalScope !== "undefined" && globalThis instanceof SharedWorkerGlobalScope;
var isServiceWorker = typeof ServiceWorkerGlobalScope !== "undefined" && globalThis instanceof ServiceWorkerGlobalScope;
var platform = globalThis.navigator?.userAgentData?.platform;
var isMacOs = platform === "macOS" || globalThis.navigator?.platform === "MacIntel" || globalThis.navigator?.userAgent?.includes(" Mac ") === true || globalThis.process?.platform === "darwin";
var isWindows = platform === "Windows" || globalThis.navigator?.platform === "Win32" || globalThis.process?.platform === "win32";
var isLinux = platform === "Linux" || globalThis.navigator?.platform?.startsWith("Linux") === true || globalThis.navigator?.userAgent?.includes(" Linux ") === true || globalThis.process?.platform === "linux";
var isIos = platform === "iOS" || globalThis.navigator?.platform === "MacIntel" && globalThis.navigator?.maxTouchPoints > 1 || /iPad|iPhone|iPod/.test(globalThis.navigator?.platform);
var isAndroid = platform === "Android" || globalThis.navigator?.platform === "Android" || globalThis.navigator?.userAgent?.includes(" Android ") === true || globalThis.process?.platform === "android";
var ESC = "\x1B[";
var OSC = "\x1B]";
var BEL = "\x07";
var SEP = ";";
var isTerminalApp = !isBrowser && import_node_process.default.env.TERM_PROGRAM === "Apple_Terminal";
var isWindows2 = !isBrowser && import_node_process.default.platform === "win32";
var cwdFunction = isBrowser ? () => {
throw new Error("`process.cwd()` only works in Node.js, not the browser.");
} : import_node_process.default.cwd;
var cursorTo = (x, y) => {
if (typeof x !== "number") {
throw new TypeError("The `x` argument is required");
}
if (typeof y !== "number") {
return ESC + (x + 1) + "G";
}
return ESC + (y + 1) + SEP + (x + 1) + "H";
};
var cursorMove = (x, y) => {
if (typeof x !== "number") {
throw new TypeError("The `x` argument is required");
}
let returnValue = "";
if (x < 0) {
returnValue += ESC + -x + "D";
} else if (x > 0) {
returnValue += ESC + x + "C";
}
if (y < 0) {
returnValue += ESC + -y + "A";
} else if (y > 0) {
returnValue += ESC + y + "B";
}
return returnValue;
};
var cursorUp = (count = 1) => ESC + count + "A";
var cursorDown = (count = 1) => ESC + count + "B";
var cursorForward = (count = 1) => ESC + count + "C";
var cursorBackward = (count = 1) => ESC + count + "D";
var cursorLeft = ESC + "G";
var cursorSavePosition = isTerminalApp ? "\x1B7" : ESC + "s";
var cursorRestorePosition = isTerminalApp ? "\x1B8" : ESC + "u";
var cursorGetPosition = ESC + "6n";
var cursorNextLine = ESC + "E";
var cursorPrevLine = ESC + "F";
var cursorHide = ESC + "?25l";
var cursorShow = ESC + "?25h";
var eraseLines = (count) => {
let clear = "";
for (let i = 0; i < count; i++) {
clear += eraseLine + (i < count - 1 ? cursorUp() : "");
}
if (count) {
clear += cursorLeft;
}
return clear;
};
var eraseEndLine = ESC + "K";
var eraseStartLine = ESC + "1K";
var eraseLine = ESC + "2K";
var eraseDown = ESC + "J";
var eraseUp = ESC + "1J";
var eraseScreen = ESC + "2J";
var scrollUp = ESC + "S";
var scrollDown = ESC + "T";
var clearScreen = "\x1Bc";
var clearTerminal = isWindows2 ? `${eraseScreen}${ESC}0f` : `${eraseScreen}${ESC}3J${ESC}H`;
var enterAlternativeScreen = ESC + "?1049h";
var exitAlternativeScreen = ESC + "?1049l";
var beep = BEL;
var link = (text, url) => [
OSC,
"8",
SEP,
SEP,
url,
BEL,
text,
OSC,
"8",
SEP,
SEP,
BEL
].join("");
var image = (data, options = {}) => {
let returnValue = `${OSC}1337;File=inline=1`;
if (options.width) {
returnValue += `;width=${options.width}`;
}
if (options.height) {
returnValue += `;height=${options.height}`;
}
if (options.preserveAspectRatio === false) {
returnValue += ";preserveAspectRatio=0";
}
return returnValue + ":" + Buffer.from(data).toString("base64") + BEL;
};
var iTerm = {
setCwd: (cwd = cwdFunction()) => `${OSC}50;CurrentDir=${cwd}${BEL}`,
annotation(message, options = {}) {
let returnValue = `${OSC}1337;`;
const hasX = options.x !== void 0;
const hasY = options.y !== void 0;
if ((hasX || hasY) && !(hasX && hasY && options.length !== void 0)) {
throw new Error("`x`, `y` and `length` must be defined when `x` or `y` is defined");
}
message = message.replaceAll("|", "");
returnValue += options.isHidden ? "AddHiddenAnnotation=" : "AddAnnotation=";
if (options.length > 0) {
returnValue += (hasX ? [message, options.length, options.x, options.y] : [options.length, message]).join("|");
} else {
returnValue += message;
}
return returnValue + BEL;
}
};
var import_supports_hyperlinks = (0, import_chunk_2ESYSVXG.__toESM)(require_supports_hyperlinks(), 1);
function terminalLink(text, url, { target = "stdout", ...options } = {}) {
if (!import_supports_hyperlinks.default[target]) {
if (options.fallback === false) {
return text;
}
return typeof options.fallback === "function" ? options.fallback(text, url) : `${text} (\u200B${url}\u200B)`;
}
return base_exports.link(text, url);
}
terminalLink.isSupported = import_supports_hyperlinks.default.stdout;
terminalLink.stderr = (text, url, options = {}) => terminalLink(text, url, { target: "stderr", ...options });
terminalLink.stderr.isSupported = import_supports_hyperlinks.default.stderr;
function link2(url) {
return terminalLink(url, url, {
fallback: import_chunk_YVXCXD3A.underline
});
}

View File

@@ -1,43 +0,0 @@
"use strict";
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var chunk_O5EOXX3N_exports = {};
__export(chunk_O5EOXX3N_exports, {
assertNodeAPISupported: () => assertNodeAPISupported
});
module.exports = __toCommonJS(chunk_O5EOXX3N_exports);
var import_fs = __toESM(require("fs"));
function assertNodeAPISupported() {
const customLibraryPath = process.env.PRISMA_QUERY_ENGINE_LIBRARY;
const customLibraryExists = customLibraryPath && import_fs.default.existsSync(customLibraryPath);
if (!customLibraryExists && process.arch === "ia32") {
throw new Error(
`The default query engine type (Node-API, "library") is currently not supported for 32bit Node. Please set \`engineType = "binary"\` in the "generator" block of your "schema.prisma" file (or use the environment variables "PRISMA_CLIENT_ENGINE_TYPE=binary" and/or "PRISMA_CLI_QUERY_ENGINE_TYPE=binary".)`
);
}
}

View File

@@ -1,8 +0,0 @@
import { BinaryTarget } from './binaryTargets';
/**
* Gets Node-API Library name depending on the binary target
* @param binaryTarget
* @param type `fs` gets name used on the file system, `url` gets the name required to download the library from S3
* @returns
*/
export declare function getNodeAPIName(binaryTarget: BinaryTarget, type: 'url' | 'fs'): string;

View File

@@ -1,25 +0,0 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var getNodeAPIName_exports = {};
__export(getNodeAPIName_exports, {
getNodeAPIName: () => import_chunk_2U36ISZO.getNodeAPIName
});
module.exports = __toCommonJS(getNodeAPIName_exports);
var import_chunk_2U36ISZO = require("./chunk-2U36ISZO.js");
var import_chunk_2ESYSVXG = require("./chunk-2ESYSVXG.js");

View File

@@ -18,21 +18,21 @@ var __copyProps = (to, from, except, desc) => {
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var getPlatform_exports = {};
__export(getPlatform_exports, {
computeLibSSLSpecificPaths: () => import_chunk_YDM7ULQH.computeLibSSLSpecificPaths,
getArchFromUname: () => import_chunk_YDM7ULQH.getArchFromUname,
getBinaryTargetForCurrentPlatform: () => import_chunk_YDM7ULQH.getBinaryTargetForCurrentPlatform,
getBinaryTargetForCurrentPlatformInternal: () => import_chunk_YDM7ULQH.getBinaryTargetForCurrentPlatformInternal,
getPlatformInfo: () => import_chunk_YDM7ULQH.getPlatformInfo,
getPlatformInfoMemoized: () => import_chunk_YDM7ULQH.getPlatformInfoMemoized,
getSSLVersion: () => import_chunk_YDM7ULQH.getSSLVersion,
getos: () => import_chunk_YDM7ULQH.getos,
parseDistro: () => import_chunk_YDM7ULQH.parseDistro,
parseLibSSLVersion: () => import_chunk_YDM7ULQH.parseLibSSLVersion,
parseOpenSSLVersion: () => import_chunk_YDM7ULQH.parseOpenSSLVersion,
resolveDistro: () => import_chunk_YDM7ULQH.resolveDistro
computeLibSSLSpecificPaths: () => import_chunk_7PMGXL6S.computeLibSSLSpecificPaths,
getArchFromUname: () => import_chunk_7PMGXL6S.getArchFromUname,
getBinaryTargetForCurrentPlatform: () => import_chunk_7PMGXL6S.getBinaryTargetForCurrentPlatform,
getBinaryTargetForCurrentPlatformInternal: () => import_chunk_7PMGXL6S.getBinaryTargetForCurrentPlatformInternal,
getPlatformInfo: () => import_chunk_7PMGXL6S.getPlatformInfo,
getPlatformInfoMemoized: () => import_chunk_7PMGXL6S.getPlatformInfoMemoized,
getSSLVersion: () => import_chunk_7PMGXL6S.getSSLVersion,
getos: () => import_chunk_7PMGXL6S.getos,
parseDistro: () => import_chunk_7PMGXL6S.parseDistro,
parseLibSSLVersion: () => import_chunk_7PMGXL6S.parseLibSSLVersion,
parseOpenSSLVersion: () => import_chunk_7PMGXL6S.parseOpenSSLVersion,
resolveDistro: () => import_chunk_7PMGXL6S.resolveDistro
});
module.exports = __toCommonJS(getPlatform_exports);
var import_chunk_YDM7ULQH = require("./chunk-YDM7ULQH.js");
var import_chunk_7PMGXL6S = require("./chunk-7PMGXL6S.js");
var import_chunk_FWMN4WME = require("./chunk-FWMN4WME.js");
var import_chunk_YVXCXD3A = require("./chunk-YVXCXD3A.js");
var import_chunk_2ESYSVXG = require("./chunk-2ESYSVXG.js");

View File

@@ -1,6 +1,4 @@
export { assertNodeAPISupported } from './assertNodeAPISupported';
export { type BinaryTarget, binaryTargets } from './binaryTargets';
export { getNodeAPIName } from './getNodeAPIName';
export type { PlatformInfo } from './getPlatform';
export { getBinaryTargetForCurrentPlatform, getos, getPlatformInfo } from './getPlatform';
export { link } from './link';

View File

@@ -16,28 +16,26 @@ var __copyProps = (to, from, except, desc) => {
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var dist_exports = {};
__export(dist_exports, {
assertNodeAPISupported: () => import_chunk_O5EOXX3N.assertNodeAPISupported,
var index_exports = {};
__export(index_exports, {
binaryTargets: () => import_chunk_7MLUNQIZ.binaryTargets,
getBinaryTargetForCurrentPlatform: () => import_chunk_YDM7ULQH.getBinaryTargetForCurrentPlatform,
getNodeAPIName: () => import_chunk_2U36ISZO.getNodeAPIName,
getPlatformInfo: () => import_chunk_YDM7ULQH.getPlatformInfo,
getos: () => import_chunk_YDM7ULQH.getos,
jestConsoleContext: () => import_chunk_M5NKJZ76.jestConsoleContext,
jestContext: () => import_chunk_M5NKJZ76.jestContext,
jestProcessContext: () => import_chunk_M5NKJZ76.jestProcessContext,
link: () => import_chunk_D7S5FGQN.link
getBinaryTargetForCurrentPlatform: () => import_chunk_7PMGXL6S.getBinaryTargetForCurrentPlatform,
getPlatformInfo: () => import_chunk_7PMGXL6S.getPlatformInfo,
getos: () => import_chunk_7PMGXL6S.getos,
jestConsoleContext: () => import_chunk_GGL63BNP.jestConsoleContext,
jestContext: () => import_chunk_GGL63BNP.jestContext,
jestStdoutContext: () => import_chunk_GGL63BNP.jestStdoutContext,
link: () => import_chunk_M5T7GI2R.link,
processExitContext: () => import_chunk_GGL63BNP.processExitContext
});
module.exports = __toCommonJS(dist_exports);
var import_chunk_6HZWON4S = require("./chunk-6HZWON4S.js");
var import_chunk_M5NKJZ76 = require("./chunk-M5NKJZ76.js");
var import_chunk_O5EOXX3N = require("./chunk-O5EOXX3N.js");
var import_chunk_2U36ISZO = require("./chunk-2U36ISZO.js");
var import_chunk_YDM7ULQH = require("./chunk-YDM7ULQH.js");
var import_chunk_D7S5FGQN = require("./chunk-D7S5FGQN.js");
module.exports = __toCommonJS(index_exports);
var import_chunk_7PMGXL6S = require("./chunk-7PMGXL6S.js");
var import_chunk_M5T7GI2R = require("./chunk-M5T7GI2R.js");
var import_chunk_FWMN4WME = require("./chunk-FWMN4WME.js");
var import_chunk_YVXCXD3A = require("./chunk-YVXCXD3A.js");
var import_chunk_7MLUNQIZ = require("./chunk-7MLUNQIZ.js");
var import_chunk_6HZWON4S = require("./chunk-6HZWON4S.js");
var import_chunk_GGL63BNP = require("./chunk-GGL63BNP.js");
var import_chunk_3UEKS5W6 = require("./chunk-3UEKS5W6.js");
var import_chunk_2ESYSVXG = require("./chunk-2ESYSVXG.js");
(0, import_chunk_7MLUNQIZ.init_binaryTargets)();

View File

@@ -18,9 +18,9 @@ var __copyProps = (to, from, except, desc) => {
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var link_exports = {};
__export(link_exports, {
link: () => import_chunk_D7S5FGQN.link
link: () => import_chunk_M5T7GI2R.link
});
module.exports = __toCommonJS(link_exports);
var import_chunk_D7S5FGQN = require("./chunk-D7S5FGQN.js");
var import_chunk_M5T7GI2R = require("./chunk-M5T7GI2R.js");
var import_chunk_YVXCXD3A = require("./chunk-YVXCXD3A.js");
var import_chunk_2ESYSVXG = require("./chunk-2ESYSVXG.js");

File diff suppressed because it is too large Load Diff

View File

@@ -18,10 +18,10 @@ var __copyProps = (to, from, except, desc) => {
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var binaryTargetRegex_exports = {};
__export(binaryTargetRegex_exports, {
binaryTargetRegex: () => import_chunk_B23KD6U3.binaryTargetRegex
binaryTargetRegex: () => import_chunk_IPLRRT6O.binaryTargetRegex
});
module.exports = __toCommonJS(binaryTargetRegex_exports);
var import_chunk_B23KD6U3 = require("../chunk-B23KD6U3.js");
var import_chunk_IPLRRT6O = require("../chunk-IPLRRT6O.js");
var import_chunk_7MLUNQIZ = require("../chunk-7MLUNQIZ.js");
var import_chunk_2ESYSVXG = require("../chunk-2ESYSVXG.js");
(0, import_chunk_B23KD6U3.init_binaryTargetRegex)();
(0, import_chunk_IPLRRT6O.init_binaryTargetRegex)();

View File

@@ -1 +1 @@
export { type BaseContext, jestConsoleContext, jestContext, jestProcessContext } from './jestContext';
export { type BaseContext, jestConsoleContext, jestContext, jestStdoutContext, type ProcessContextSettings, processExitContext, } from './jestContext';

View File

@@ -18,11 +18,13 @@ var __copyProps = (to, from, except, desc) => {
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var test_utils_exports = {};
__export(test_utils_exports, {
jestConsoleContext: () => import_chunk_M5NKJZ76.jestConsoleContext,
jestContext: () => import_chunk_M5NKJZ76.jestContext,
jestProcessContext: () => import_chunk_M5NKJZ76.jestProcessContext
jestConsoleContext: () => import_chunk_GGL63BNP.jestConsoleContext,
jestContext: () => import_chunk_GGL63BNP.jestContext,
jestStdoutContext: () => import_chunk_GGL63BNP.jestStdoutContext,
processExitContext: () => import_chunk_GGL63BNP.processExitContext
});
module.exports = __toCommonJS(test_utils_exports);
var import_chunk_6HZWON4S = require("../chunk-6HZWON4S.js");
var import_chunk_M5NKJZ76 = require("../chunk-M5NKJZ76.js");
var import_chunk_GGL63BNP = require("../chunk-GGL63BNP.js");
var import_chunk_3UEKS5W6 = require("../chunk-3UEKS5W6.js");
var import_chunk_2ESYSVXG = require("../chunk-2ESYSVXG.js");

View File

@@ -1,5 +1,5 @@
/// <reference types="jest" />
import type { ExecaChildProcess } from 'execa';
import { type ExecaChildProcess } from 'execa';
import type { FSJetpack } from 'fs-jetpack/types';
/**
* Base test context.
@@ -75,10 +75,6 @@ export declare const jestContext: {
assemble(): BaseContext;
};
};
/**
* Factory for creating a context contributor possibly configured in some special way.
*/
type ContextContributorFactory<Settings, Context, NewContext> = Settings extends {} ? () => ContextContributor<Context, NewContext> : (settings: Settings) => ContextContributor<Context, NewContext>;
/**
* A function that provides additional test context.
*/
@@ -94,7 +90,7 @@ type ConsoleContext = {
'console.warn': jest.SpyInstance;
};
};
export declare const jestConsoleContext: ContextContributorFactory<{}, BaseContext, ConsoleContext>;
export declare const jestConsoleContext: <Ctx extends BaseContext>() => (c: Ctx) => Ctx & ConsoleContext;
/**
* Test context contributor. Mocks process.std(out|err).write with a Jest spy before each test.
*/
@@ -103,6 +99,24 @@ type ProcessContext = {
'process.stderr.write': jest.SpyInstance;
'process.stdout.write': jest.SpyInstance;
};
normalizedCapturedStdout: () => string;
normalizedCapturedStderr: () => string;
clearCapturedStdout: () => void;
clearCapturedStderr: () => void;
};
export declare const jestProcessContext: ContextContributorFactory<{}, BaseContext, ProcessContext>;
type NormalizationRule = [RegExp | string, string];
export type ProcessContextSettings = {
normalizationRules: NormalizationRule[];
};
export declare const jestStdoutContext: <Ctx extends BaseContext>({ normalizationRules }?: ProcessContextSettings) => (c: Ctx) => Ctx & ProcessContext;
/**
* Test context contributor. Mocks process.exit with a spay and records the exit code.
*/
type ProcessExitContext = {
mocked: {
'process.exit': jest.SpyInstance;
};
recordedExitCode: () => number;
};
export declare const processExitContext: <C extends BaseContext>() => (c: C) => C & ProcessExitContext;
export {};

View File

@@ -18,10 +18,12 @@ var __copyProps = (to, from, except, desc) => {
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var jestContext_exports = {};
__export(jestContext_exports, {
jestConsoleContext: () => import_chunk_M5NKJZ76.jestConsoleContext,
jestContext: () => import_chunk_M5NKJZ76.jestContext,
jestProcessContext: () => import_chunk_M5NKJZ76.jestProcessContext
jestConsoleContext: () => import_chunk_GGL63BNP.jestConsoleContext,
jestContext: () => import_chunk_GGL63BNP.jestContext,
jestStdoutContext: () => import_chunk_GGL63BNP.jestStdoutContext,
processExitContext: () => import_chunk_GGL63BNP.processExitContext
});
module.exports = __toCommonJS(jestContext_exports);
var import_chunk_M5NKJZ76 = require("../chunk-M5NKJZ76.js");
var import_chunk_GGL63BNP = require("../chunk-GGL63BNP.js");
var import_chunk_3UEKS5W6 = require("../chunk-3UEKS5W6.js");
var import_chunk_2ESYSVXG = require("../chunk-2ESYSVXG.js");

View File

@@ -21,74 +21,14 @@ __export(jestSnapshotSerializer_exports, {
default: () => jestSnapshotSerializer_default
});
module.exports = __toCommonJS(jestSnapshotSerializer_exports);
var import_chunk_B23KD6U3 = require("../chunk-B23KD6U3.js");
var import_chunk_IPLRRT6O = require("../chunk-IPLRRT6O.js");
var import_chunk_7MLUNQIZ = require("../chunk-7MLUNQIZ.js");
var import_chunk_2ESYSVXG = require("../chunk-2ESYSVXG.js");
var require_replace_string = (0, import_chunk_2ESYSVXG.__commonJS)({
"../../node_modules/.pnpm/replace-string@3.1.0/node_modules/replace-string/index.js"(exports, module2) {
"use strict";
module2.exports = (string, needle, replacement, options = {}) => {
if (typeof string !== "string") {
throw new TypeError(`Expected input to be a string, got ${typeof string}`);
}
if (!(typeof needle === "string" && needle.length > 0) || !(typeof replacement === "string" || typeof replacement === "function")) {
return string;
}
let result = "";
let matchCount = 0;
let prevIndex = options.fromIndex > 0 ? options.fromIndex : 0;
if (prevIndex > string.length) {
return string;
}
while (true) {
const index = options.caseInsensitive ? string.toLowerCase().indexOf(needle.toLowerCase(), prevIndex) : string.indexOf(needle, prevIndex);
if (index === -1) {
break;
}
matchCount++;
const replaceStr = typeof replacement === "string" ? replacement : replacement(
// If `caseInsensitive`` is enabled, the matched substring may be different from the needle.
string.slice(index, index + needle.length),
matchCount,
string,
index
);
const beginSlice = matchCount === 1 ? 0 : prevIndex;
result += string.slice(beginSlice, index) + replaceStr;
prevIndex = index + needle.length;
}
if (matchCount === 0) {
return string;
}
return result + string.slice(prevIndex);
};
}
});
var require_ansi_regex = (0, import_chunk_2ESYSVXG.__commonJS)({
"../../node_modules/.pnpm/ansi-regex@5.0.1/node_modules/ansi-regex/index.js"(exports, module2) {
"use strict";
module2.exports = ({ onlyFirst = false } = {}) => {
const pattern = [
"[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)",
"(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))"
].join("|");
return new RegExp(pattern, onlyFirst ? void 0 : "g");
};
}
});
var require_strip_ansi = (0, import_chunk_2ESYSVXG.__commonJS)({
"../../node_modules/.pnpm/strip-ansi@6.0.1/node_modules/strip-ansi/index.js"(exports, module2) {
"use strict";
var ansiRegex = require_ansi_regex();
module2.exports = (string) => typeof string === "string" ? string.replace(ansiRegex(), "") : string;
}
});
var require_jestSnapshotSerializer = (0, import_chunk_2ESYSVXG.__commonJS)({
"src/test-utils/jestSnapshotSerializer.js"(exports, module2) {
var path = (0, import_chunk_2ESYSVXG.__require)("path");
var replaceAll = require_replace_string();
var stripAnsi = require_strip_ansi();
var { binaryTargetRegex } = ((0, import_chunk_B23KD6U3.init_binaryTargetRegex)(), (0, import_chunk_2ESYSVXG.__toCommonJS)(import_chunk_B23KD6U3.binaryTargetRegex_exports));
var path = (0, import_chunk_2ESYSVXG.__require)("node:path");
var { stripVTControlCharacters } = (0, import_chunk_2ESYSVXG.__require)("node:util");
var { binaryTargetRegex } = ((0, import_chunk_IPLRRT6O.init_binaryTargetRegex)(), (0, import_chunk_2ESYSVXG.__toCommonJS)(import_chunk_IPLRRT6O.binaryTargetRegex_exports));
var pipe = (...fns) => (x) => fns.reduce((v, f) => f(v), x);
function normalizePrismaPaths(str) {
return str.replace(/prisma\\([\w-]+)\.prisma/g, "prisma/$1.prisma").replace(/prisma\\seed\.ts/g, "prisma/seed.ts").replace(/custom-folder\\seed\.js/g, "custom-folder/seed.js");
@@ -100,14 +40,27 @@ var require_jestSnapshotSerializer = (0, import_chunk_2ESYSVXG.__commonJS)({
).replace(/Starting a postgresql pool with \d+ connections./g, "Starting a postgresql pool with XX connections.");
}
function normalizeTmpDir(str) {
return str.replace(/\/tmp\/([a-z0-9]+)\//g, "/tmp/dir/");
const tempDirRegexes = [
// Linux
/\/tmp\/([a-z0-9]+)/g,
// macOS
/\/private\/var\/folders\/[^/]+\/[^/]+\/T\/[a-z0-9]+/g
];
if (process.env.TEMP) {
const escapedPath = process.env.TEMP.replaceAll("\\", "\\\\");
tempDirRegexes.push(new RegExp(`${escapedPath}\\\\[a-z0-9]+`, "g"));
}
for (const regex of tempDirRegexes) {
str = str.replace(regex, "/tmp/dir");
}
return str;
}
function trimErrorPaths(str) {
const parentDir = path.dirname(path.dirname(path.dirname(__dirname)));
return replaceAll(str, parentDir, "");
return str.replaceAll(parentDir, "");
}
function normalizeToUnixPaths(str) {
return replaceAll(str, path.sep, "/");
return str.replaceAll(path.sep, "/");
}
function normalizeGitHubLinks(str) {
return str.replace(/https:\/\/github.com\/prisma\/prisma(-client-js)?\/issues\/new\S+/, "TEST_GITHUB_LINK");
@@ -118,12 +71,6 @@ var require_jestSnapshotSerializer = (0, import_chunk_2ESYSVXG.__commonJS)({
function removePlatforms(str) {
return str.replace(binaryTargetRegex, "TEST_PLATFORM");
}
function normalizeNodeApiLibFilePath(str) {
return str.replace(
/((lib)?query_engine-TEST_PLATFORM\.)(.*)(\.node)/g,
"libquery_engine-TEST_PLATFORM.LIBRARY_TYPE.node"
);
}
function normalizeBinaryFilePath(str) {
return str.replace(/\.exe(\s+)?(\W.*)/g, "$1$2").replace(/\.exe$/g, "");
}
@@ -172,7 +119,7 @@ var require_jestSnapshotSerializer = (0, import_chunk_2ESYSVXG.__commonJS)({
serialize(value) {
const message = typeof value === "string" ? value : value instanceof Error ? value.message : "";
return pipe(
stripAnsi,
stripVTControlCharacters,
// integration-tests pkg
prepareSchemaForSnapshot,
// Generic
@@ -181,7 +128,6 @@ var require_jestSnapshotSerializer = (0, import_chunk_2ESYSVXG.__commonJS)({
// From Client package
normalizeGitHubLinks,
removePlatforms,
normalizeNodeApiLibFilePath,
normalizeBinaryFilePath,
normalizeTsClientStackTrace,
trimErrorPaths,

View File

@@ -0,0 +1,123 @@
import { type ExecaChildProcess } from 'execa';
import type { FSJetpack } from 'fs-jetpack/types';
import { type MockInstance } from 'vitest';
/**
* Base test context.
*/
export type BaseContext = {
tmpDir: string;
fs: FSJetpack;
mocked: {
cwd: string;
};
/**
* Set up the temporary directory based on the contents of some fixture.
*/
fixture: (name: string) => void;
/**
* Spawn the Prisma cli using the temporary directory as the CWD.
*
* @remarks
*
* For this to work the source must be built
*/
cli: (...input: string[]) => ExecaChildProcess<string>;
printDir(dir: string, extensions: string[]): void;
/**
* JavaScript-friendly implementation of the `tree` command. It skips the `node_modules` directory.
* @param itemPath The path to start the tree from, defaults to the root of the temporary directory
* @param indent How much to indent each level of the tree, defaults to ''
* @returns String representation of the directory tree
*/
tree: (itemPath?: string, indent?: string) => void;
};
/**
* Create test context to use in tests. Provides the following:
*
* - A temporary directory
* - an fs-jetpack instance bound to the temporary directory
* - Mocked process.cwd via Node process.chdir
* - Fixture loader for bootstrapping the temporary directory with content
*/
export declare const vitestContext: {
new: (ctx?: BaseContext) => {
add<NewContext>(contextContributor: ContextContributor<BaseContext, NewContext>): {
add<NewContext_1>(contextContributor: ContextContributor<BaseContext & NewContext, NewContext_1>): {
add<NewContext_2>(contextContributor: ContextContributor<BaseContext & NewContext & NewContext_1, NewContext_2>): {
add<NewContext_3>(contextContributor: ContextContributor<BaseContext & NewContext & NewContext_1 & NewContext_2, NewContext_3>): {
add<NewContext_4>(contextContributor: ContextContributor<BaseContext & NewContext & NewContext_1 & NewContext_2 & NewContext_3, NewContext_4>): {
add<NewContext_5>(contextContributor: ContextContributor<BaseContext & NewContext & NewContext_1 & NewContext_2 & NewContext_3 & NewContext_4, NewContext_5>): {
add<NewContext_6>(contextContributor: ContextContributor<BaseContext & NewContext & NewContext_1 & NewContext_2 & NewContext_3 & NewContext_4 & NewContext_5, NewContext_6>): {
add<NewContext_7>(contextContributor: ContextContributor<BaseContext & NewContext & NewContext_1 & NewContext_2 & NewContext_3 & NewContext_4 & NewContext_5 & NewContext_6, NewContext_7>): {
add<NewContext_8>(contextContributor: ContextContributor<BaseContext & NewContext & NewContext_1 & NewContext_2 & NewContext_3 & NewContext_4 & NewContext_5 & NewContext_6 & NewContext_7, NewContext_8>): {
add<NewContext_9>(contextContributor: ContextContributor<BaseContext & NewContext & NewContext_1 & NewContext_2 & NewContext_3 & NewContext_4 & NewContext_5 & NewContext_6 & NewContext_7 & NewContext_8, NewContext_9>): {
add<NewContext_10>(contextContributor: ContextContributor<BaseContext & NewContext & NewContext_1 & NewContext_2 & NewContext_3 & NewContext_4 & NewContext_5 & NewContext_6 & NewContext_7 & NewContext_8 & NewContext_9, NewContext_10>): any;
assemble(): BaseContext & NewContext & NewContext_1 & NewContext_2 & NewContext_3 & NewContext_4 & NewContext_5 & NewContext_6 & NewContext_7 & NewContext_8 & NewContext_9;
};
assemble(): BaseContext & NewContext & NewContext_1 & NewContext_2 & NewContext_3 & NewContext_4 & NewContext_5 & NewContext_6 & NewContext_7 & NewContext_8;
};
assemble(): BaseContext & NewContext & NewContext_1 & NewContext_2 & NewContext_3 & NewContext_4 & NewContext_5 & NewContext_6 & NewContext_7;
};
assemble(): BaseContext & NewContext & NewContext_1 & NewContext_2 & NewContext_3 & NewContext_4 & NewContext_5 & NewContext_6;
};
assemble(): BaseContext & NewContext & NewContext_1 & NewContext_2 & NewContext_3 & NewContext_4 & NewContext_5;
};
assemble(): BaseContext & NewContext & NewContext_1 & NewContext_2 & NewContext_3 & NewContext_4;
};
assemble(): BaseContext & NewContext & NewContext_1 & NewContext_2 & NewContext_3;
};
assemble(): BaseContext & NewContext & NewContext_1 & NewContext_2;
};
assemble(): BaseContext & NewContext & NewContext_1;
};
assemble(): BaseContext & NewContext;
};
assemble(): BaseContext;
};
};
/**
* A function that provides additional test context.
*/
type ContextContributor<Context, NewContext> = (ctx: Context) => Context & NewContext;
/**
* Test context contributor. Mocks console.error with a Vitest spy before each test.
*/
type ConsoleContext = {
mocked: {
'console.error': MockInstance<typeof console.error>;
'console.log': MockInstance<typeof console.log>;
'console.info': MockInstance<typeof console.info>;
'console.warn': MockInstance<typeof console.warn>;
};
};
export declare const vitestConsoleContext: <Ctx extends BaseContext>() => (c: Ctx) => Ctx & ConsoleContext;
/**
* Test context contributor. Mocks process.std(out|err).write with a Vitest spy before each test.
*/
type ProcessContext = {
mocked: {
'process.stderr.write': MockInstance<typeof process.stderr.write>;
'process.stdout.write': MockInstance<typeof process.stdout.write>;
};
normalizedCapturedStdout: () => string;
normalizedCapturedStderr: () => string;
clearCapturedStdout: () => void;
clearCapturedStderr: () => void;
};
type NormalizationRule = [RegExp | string, string];
export type ProcessContextSettings = {
normalizationRules: NormalizationRule[];
};
export declare const vitestStdoutContext: <Ctx extends BaseContext>({ normalizationRules }?: ProcessContextSettings) => (c: Ctx) => Ctx & ProcessContext;
/**
* Test context contributor. Mocks process.exit with a spy and records the exit code.
*/
type ProcessExitContext = {
mocked: {
'process.exit': MockInstance<typeof process.exit>;
};
recordedExitCode: () => number;
};
export declare const vitestProcessExitContext: <C extends BaseContext>() => (c: C) => C & ProcessExitContext;
export declare const processExitContext: <C extends BaseContext>() => (c: C) => C & ProcessExitContext;
export {};

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,201 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

View File

@@ -0,0 +1,29 @@
# @prisma/debug
A cached [`debug`](https://github.com/visionmedia/debug/).
---
⚠️ **Warning**: This package is intended for Prisma's internal use.
Its release cycle does not follow SemVer, which means we might release breaking changes (change APIs, remove functionality) without any prior warning.
If you are using this package, it would be helpful if you could help us gain an understanding where, how and why you are using it. Your feedback will be valuable to us to define a better API. Please share this information at https://github.com/prisma/prisma/discussions/13877 - Thanks!
## Usage
```ts
import Debug, { getLogs } from '@prisma/debug'
const debug = Debug('my-namespace')
try {
debug('hello')
debug(process.env)
throw new Error('oops')
} catch (e) {
console.error(e)
console.error(`We just crashed. But no worries, here are the debug logs:`)
// get 10 last lines of debug logs
console.error(getLogs(10))
}
```

View File

@@ -0,0 +1,40 @@
export declare function clearLogs(): void;
declare const Debug: typeof debugCreate & {
enable(namespace: any): void;
disable(): any;
enabled(namespace: string): boolean;
log: (...args: string[]) => void;
formatters: {};
};
export { Debug }
export default Debug;
/**
* Create a new debug instance with the given namespace.
*
* @example
* ```ts
* import Debug from '@prisma/debug'
* const debug = Debug('prisma:client')
* debug('Hello World')
* ```
*/
declare function debugCreate(namespace: string): ((...args: any[]) => void) & {
color: string;
enabled: boolean;
namespace: string;
log: (...args: string[]) => void;
extend: () => void;
};
/**
* We can get the logs for all the last {@link MAX_ARGS_HISTORY} ${@link debugCall} that
* have happened in the different packages. Useful to generate error report links.
* @see https://stackoverflow.com/questions/417142/what-is-the-maximum-length-of-a-url-in-different-browsers
* @param numChars
* @returns
*/
export declare function getLogs(numChars?: number): string;
export { }

View File

@@ -0,0 +1,40 @@
export declare function clearLogs(): void;
declare const Debug: typeof debugCreate & {
enable(namespace: any): void;
disable(): any;
enabled(namespace: string): boolean;
log: (...args: string[]) => void;
formatters: {};
};
export { Debug }
export default Debug;
/**
* Create a new debug instance with the given namespace.
*
* @example
* ```ts
* import Debug from '@prisma/debug'
* const debug = Debug('prisma:client')
* debug('Hello World')
* ```
*/
declare function debugCreate(namespace: string): ((...args: any[]) => void) & {
color: string;
enabled: boolean;
namespace: string;
log: (...args: string[]) => void;
extend: () => void;
};
/**
* We can get the logs for all the last {@link MAX_ARGS_HISTORY} ${@link debugCall} that
* have happened in the different packages. Useful to generate error report links.
* @see https://stackoverflow.com/questions/417142/what-is-the-maximum-length-of-a-url-in-different-browsers
* @param numChars
* @returns
*/
export declare function getLogs(numChars?: number): string;
export { }

View File

@@ -0,0 +1,236 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// src/index.ts
var index_exports = {};
__export(index_exports, {
Debug: () => Debug,
clearLogs: () => clearLogs,
default: () => index_default,
getLogs: () => getLogs
});
module.exports = __toCommonJS(index_exports);
// ../../node_modules/.pnpm/kleur@4.1.5/node_modules/kleur/colors.mjs
var colors_exports = {};
__export(colors_exports, {
$: () => $,
bgBlack: () => bgBlack,
bgBlue: () => bgBlue,
bgCyan: () => bgCyan,
bgGreen: () => bgGreen,
bgMagenta: () => bgMagenta,
bgRed: () => bgRed,
bgWhite: () => bgWhite,
bgYellow: () => bgYellow,
black: () => black,
blue: () => blue,
bold: () => bold,
cyan: () => cyan,
dim: () => dim,
gray: () => gray,
green: () => green,
grey: () => grey,
hidden: () => hidden,
inverse: () => inverse,
italic: () => italic,
magenta: () => magenta,
red: () => red,
reset: () => reset,
strikethrough: () => strikethrough,
underline: () => underline,
white: () => white,
yellow: () => yellow
});
var FORCE_COLOR;
var NODE_DISABLE_COLORS;
var NO_COLOR;
var TERM;
var isTTY = true;
if (typeof process !== "undefined") {
({ FORCE_COLOR, NODE_DISABLE_COLORS, NO_COLOR, TERM } = process.env || {});
isTTY = process.stdout && process.stdout.isTTY;
}
var $ = {
enabled: !NODE_DISABLE_COLORS && NO_COLOR == null && TERM !== "dumb" && (FORCE_COLOR != null && FORCE_COLOR !== "0" || isTTY)
};
function init(x, y) {
let rgx = new RegExp(`\\x1b\\[${y}m`, "g");
let open = `\x1B[${x}m`, close = `\x1B[${y}m`;
return function(txt) {
if (!$.enabled || txt == null) return txt;
return open + (!!~("" + txt).indexOf(close) ? txt.replace(rgx, close + open) : txt) + close;
};
}
var reset = init(0, 0);
var bold = init(1, 22);
var dim = init(2, 22);
var italic = init(3, 23);
var underline = init(4, 24);
var inverse = init(7, 27);
var hidden = init(8, 28);
var strikethrough = init(9, 29);
var black = init(30, 39);
var red = init(31, 39);
var green = init(32, 39);
var yellow = init(33, 39);
var blue = init(34, 39);
var magenta = init(35, 39);
var cyan = init(36, 39);
var white = init(37, 39);
var gray = init(90, 39);
var grey = init(90, 39);
var bgBlack = init(40, 49);
var bgRed = init(41, 49);
var bgGreen = init(42, 49);
var bgYellow = init(43, 49);
var bgBlue = init(44, 49);
var bgMagenta = init(45, 49);
var bgCyan = init(46, 49);
var bgWhite = init(47, 49);
// src/index.ts
var MAX_ARGS_HISTORY = 100;
var COLORS = ["green", "yellow", "blue", "magenta", "cyan", "red"];
var argsHistory = [];
var lastTimestamp = Date.now();
var lastColor = 0;
var processEnv = typeof process !== "undefined" ? process.env : {};
globalThis.DEBUG ??= processEnv.DEBUG ?? "";
globalThis.DEBUG_COLORS ??= processEnv.DEBUG_COLORS ? processEnv.DEBUG_COLORS === "true" : true;
var topProps = {
enable(namespace) {
if (typeof namespace === "string") {
globalThis.DEBUG = namespace;
}
},
disable() {
const prev = globalThis.DEBUG;
globalThis.DEBUG = "";
return prev;
},
// this is the core logic to check if logging should happen or not
enabled(namespace) {
const listenedNamespaces = globalThis.DEBUG.split(",").map((s) => {
return s.replace(/[.+?^${}()|[\]\\]/g, "\\$&");
});
const isListened = listenedNamespaces.some((listenedNamespace) => {
if (listenedNamespace === "" || listenedNamespace[0] === "-") return false;
return namespace.match(RegExp(listenedNamespace.split("*").join(".*") + "$"));
});
const isExcluded = listenedNamespaces.some((listenedNamespace) => {
if (listenedNamespace === "" || listenedNamespace[0] !== "-") return false;
return namespace.match(RegExp(listenedNamespace.slice(1).split("*").join(".*") + "$"));
});
return isListened && !isExcluded;
},
log: (...args) => {
const [namespace, format, ...rest] = args;
const logWithFormatting = console.warn ?? console.log;
logWithFormatting(`${namespace} ${format}`, ...rest);
},
formatters: {}
// not implemented
};
function debugCreate(namespace) {
const instanceProps = {
color: COLORS[lastColor++ % COLORS.length],
enabled: topProps.enabled(namespace),
namespace,
log: topProps.log,
extend: () => {
}
// not implemented
};
const debugCall = (...args) => {
const { enabled, namespace: namespace2, color, log } = instanceProps;
if (args.length !== 0) {
argsHistory.push([namespace2, ...args]);
}
if (argsHistory.length > MAX_ARGS_HISTORY) {
argsHistory.shift();
}
if (topProps.enabled(namespace2) || enabled) {
const stringArgs = args.map((arg) => {
if (typeof arg === "string") {
return arg;
}
return safeStringify(arg);
});
const ms = `+${Date.now() - lastTimestamp}ms`;
lastTimestamp = Date.now();
if (globalThis.DEBUG_COLORS) {
log(colors_exports[color](bold(namespace2)), ...stringArgs, colors_exports[color](ms));
} else {
log(namespace2, ...stringArgs, ms);
}
}
};
return new Proxy(debugCall, {
get: (_, prop) => instanceProps[prop],
set: (_, prop, value) => instanceProps[prop] = value
});
}
var Debug = new Proxy(debugCreate, {
get: (_, prop) => topProps[prop],
set: (_, prop, value) => topProps[prop] = value
});
function safeStringify(value, indent = 2) {
const cache = /* @__PURE__ */ new Set();
return JSON.stringify(
value,
(key, value2) => {
if (typeof value2 === "object" && value2 !== null) {
if (cache.has(value2)) {
return `[Circular *]`;
}
cache.add(value2);
} else if (typeof value2 === "bigint") {
return value2.toString();
}
return value2;
},
indent
);
}
function getLogs(numChars = 7500) {
const logs = argsHistory.map(([namespace, ...args]) => {
return `${namespace} ${args.map((arg) => {
if (typeof arg === "string") {
return arg;
} else {
return JSON.stringify(arg);
}
}).join(" ")}`;
}).join("\n");
if (logs.length < numChars) {
return logs;
}
return logs.slice(-numChars);
}
function clearLogs() {
argsHistory.length = 0;
}
var index_default = Debug;
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
Debug,
clearLogs,
getLogs
});

View File

@@ -0,0 +1,213 @@
var __defProp = Object.defineProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
// ../../node_modules/.pnpm/kleur@4.1.5/node_modules/kleur/colors.mjs
var colors_exports = {};
__export(colors_exports, {
$: () => $,
bgBlack: () => bgBlack,
bgBlue: () => bgBlue,
bgCyan: () => bgCyan,
bgGreen: () => bgGreen,
bgMagenta: () => bgMagenta,
bgRed: () => bgRed,
bgWhite: () => bgWhite,
bgYellow: () => bgYellow,
black: () => black,
blue: () => blue,
bold: () => bold,
cyan: () => cyan,
dim: () => dim,
gray: () => gray,
green: () => green,
grey: () => grey,
hidden: () => hidden,
inverse: () => inverse,
italic: () => italic,
magenta: () => magenta,
red: () => red,
reset: () => reset,
strikethrough: () => strikethrough,
underline: () => underline,
white: () => white,
yellow: () => yellow
});
var FORCE_COLOR;
var NODE_DISABLE_COLORS;
var NO_COLOR;
var TERM;
var isTTY = true;
if (typeof process !== "undefined") {
({ FORCE_COLOR, NODE_DISABLE_COLORS, NO_COLOR, TERM } = process.env || {});
isTTY = process.stdout && process.stdout.isTTY;
}
var $ = {
enabled: !NODE_DISABLE_COLORS && NO_COLOR == null && TERM !== "dumb" && (FORCE_COLOR != null && FORCE_COLOR !== "0" || isTTY)
};
function init(x, y) {
let rgx = new RegExp(`\\x1b\\[${y}m`, "g");
let open = `\x1B[${x}m`, close = `\x1B[${y}m`;
return function(txt) {
if (!$.enabled || txt == null) return txt;
return open + (!!~("" + txt).indexOf(close) ? txt.replace(rgx, close + open) : txt) + close;
};
}
var reset = init(0, 0);
var bold = init(1, 22);
var dim = init(2, 22);
var italic = init(3, 23);
var underline = init(4, 24);
var inverse = init(7, 27);
var hidden = init(8, 28);
var strikethrough = init(9, 29);
var black = init(30, 39);
var red = init(31, 39);
var green = init(32, 39);
var yellow = init(33, 39);
var blue = init(34, 39);
var magenta = init(35, 39);
var cyan = init(36, 39);
var white = init(37, 39);
var gray = init(90, 39);
var grey = init(90, 39);
var bgBlack = init(40, 49);
var bgRed = init(41, 49);
var bgGreen = init(42, 49);
var bgYellow = init(43, 49);
var bgBlue = init(44, 49);
var bgMagenta = init(45, 49);
var bgCyan = init(46, 49);
var bgWhite = init(47, 49);
// src/index.ts
var MAX_ARGS_HISTORY = 100;
var COLORS = ["green", "yellow", "blue", "magenta", "cyan", "red"];
var argsHistory = [];
var lastTimestamp = Date.now();
var lastColor = 0;
var processEnv = typeof process !== "undefined" ? process.env : {};
globalThis.DEBUG ??= processEnv.DEBUG ?? "";
globalThis.DEBUG_COLORS ??= processEnv.DEBUG_COLORS ? processEnv.DEBUG_COLORS === "true" : true;
var topProps = {
enable(namespace) {
if (typeof namespace === "string") {
globalThis.DEBUG = namespace;
}
},
disable() {
const prev = globalThis.DEBUG;
globalThis.DEBUG = "";
return prev;
},
// this is the core logic to check if logging should happen or not
enabled(namespace) {
const listenedNamespaces = globalThis.DEBUG.split(",").map((s) => {
return s.replace(/[.+?^${}()|[\]\\]/g, "\\$&");
});
const isListened = listenedNamespaces.some((listenedNamespace) => {
if (listenedNamespace === "" || listenedNamespace[0] === "-") return false;
return namespace.match(RegExp(listenedNamespace.split("*").join(".*") + "$"));
});
const isExcluded = listenedNamespaces.some((listenedNamespace) => {
if (listenedNamespace === "" || listenedNamespace[0] !== "-") return false;
return namespace.match(RegExp(listenedNamespace.slice(1).split("*").join(".*") + "$"));
});
return isListened && !isExcluded;
},
log: (...args) => {
const [namespace, format, ...rest] = args;
const logWithFormatting = console.warn ?? console.log;
logWithFormatting(`${namespace} ${format}`, ...rest);
},
formatters: {}
// not implemented
};
function debugCreate(namespace) {
const instanceProps = {
color: COLORS[lastColor++ % COLORS.length],
enabled: topProps.enabled(namespace),
namespace,
log: topProps.log,
extend: () => {
}
// not implemented
};
const debugCall = (...args) => {
const { enabled, namespace: namespace2, color, log } = instanceProps;
if (args.length !== 0) {
argsHistory.push([namespace2, ...args]);
}
if (argsHistory.length > MAX_ARGS_HISTORY) {
argsHistory.shift();
}
if (topProps.enabled(namespace2) || enabled) {
const stringArgs = args.map((arg) => {
if (typeof arg === "string") {
return arg;
}
return safeStringify(arg);
});
const ms = `+${Date.now() - lastTimestamp}ms`;
lastTimestamp = Date.now();
if (globalThis.DEBUG_COLORS) {
log(colors_exports[color](bold(namespace2)), ...stringArgs, colors_exports[color](ms));
} else {
log(namespace2, ...stringArgs, ms);
}
}
};
return new Proxy(debugCall, {
get: (_, prop) => instanceProps[prop],
set: (_, prop, value) => instanceProps[prop] = value
});
}
var Debug = new Proxy(debugCreate, {
get: (_, prop) => topProps[prop],
set: (_, prop, value) => topProps[prop] = value
});
function safeStringify(value, indent = 2) {
const cache = /* @__PURE__ */ new Set();
return JSON.stringify(
value,
(key, value2) => {
if (typeof value2 === "object" && value2 !== null) {
if (cache.has(value2)) {
return `[Circular *]`;
}
cache.add(value2);
} else if (typeof value2 === "bigint") {
return value2.toString();
}
return value2;
},
indent
);
}
function getLogs(numChars = 7500) {
const logs = argsHistory.map(([namespace, ...args]) => {
return `${namespace} ${args.map((arg) => {
if (typeof arg === "string") {
return arg;
} else {
return JSON.stringify(arg);
}
}).join(" ")}`;
}).join("\n");
if (logs.length < numChars) {
return logs;
}
return logs.slice(-numChars);
}
function clearLogs() {
argsHistory.length = 0;
}
var index_default = Debug;
export {
Debug,
clearLogs,
index_default as default,
getLogs
};

View File

@@ -0,0 +1,2 @@
export declare function removeISODate(str: string): string;
export declare function sanitizeTestLogs(str: string): string;

View File

@@ -0,0 +1,47 @@
{
"name": "@prisma/debug",
"version": "7.2.0",
"description": "This package is intended for Prisma's internal use",
"main": "dist/index.js",
"module": "dist/index.mjs",
"types": "dist/index.d.ts",
"exports": {
".": {
"require": {
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
},
"import": {
"types": "./dist/index.d.mts",
"default": "./dist/index.mjs"
}
}
},
"license": "Apache-2.0",
"author": "Tim Suchanek <suchanek@prisma.io>",
"homepage": "https://www.prisma.io",
"repository": {
"type": "git",
"url": "https://github.com/prisma/prisma.git",
"directory": "packages/debug"
},
"bugs": "https://github.com/prisma/prisma/issues",
"devDependencies": {
"@types/jest": "29.5.14",
"@types/node": "~20.19.24",
"jest": "29.7.0",
"jest-junit": "16.0.0",
"kleur": "4.1.5",
"typescript": "5.4.5"
},
"files": [
"README.md",
"dist"
],
"sideEffects": false,
"scripts": {
"dev": "DEV=true tsx helpers/build.ts",
"build": "tsx helpers/build.ts",
"test": "jest"
}
}

View File

@@ -1,6 +1,6 @@
{
"name": "@prisma/get-platform",
"version": "5.22.0",
"version": "7.2.0",
"description": "This package is intended for Prisma's internal use",
"main": "dist/index.js",
"types": "dist/index.d.ts",
@@ -14,27 +14,26 @@
},
"bugs": "https://github.com/prisma/prisma/issues",
"devDependencies": {
"@codspeed/benchmark.js-plugin": "3.1.1",
"@swc/core": "1.6.13",
"@swc/jest": "0.2.36",
"@types/jest": "29.5.12",
"@types/node": "18.19.31",
"@codspeed/benchmark.js-plugin": "4.0.0",
"@swc/core": "1.11.5",
"@swc/jest": "0.2.37",
"@types/jest": "29.5.14",
"@types/node": "~20.19.24",
"benchmark": "2.1.4",
"escape-string-regexp": "5.0.0",
"execa": "8.0.1",
"fs-jetpack": "5.1.0",
"jest": "29.7.0",
"jest-junit": "16.0.0",
"typescript": "5.4.5",
"escape-string-regexp": "4.0.0",
"execa": "5.1.1",
"fs-jetpack": "5.1.0",
"kleur": "4.1.5",
"replace-string": "3.1.0",
"strip-ansi": "6.0.1",
"tempy": "1.0.1",
"terminal-link": "2.1.1",
"ts-pattern": "5.2.0"
"terminal-link": "4.0.0",
"ts-pattern": "5.6.2",
"typescript": "5.4.5",
"vitest": "3.2.4"
},
"dependencies": {
"@prisma/debug": "5.22.0"
"@prisma/debug": "7.2.0"
},
"files": [
"README.md",