Erster Docker-Stand

This commit is contained in:
Ali
2026-02-20 16:06:40 +09:00
commit f31e2e8ed3
8818 changed files with 1605323 additions and 0 deletions

201
_node_modules/@prisma/get-platform/LICENSE generated Normal file
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,16 @@
# @prisma/get-platform
Platform detection.
⚠️ **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 { getBinaryTargetForCurrentPlatform } from '@prisma/get-platform'
const binaryTarget = await getBinaryTargetForCurrentPlatform()
```

View File

@@ -0,0 +1,2 @@
export type BinaryTarget = 'native' | 'darwin' | 'darwin-arm64' | 'debian-openssl-1.0.x' | 'debian-openssl-1.1.x' | 'debian-openssl-3.0.x' | 'rhel-openssl-1.0.x' | 'rhel-openssl-1.1.x' | 'rhel-openssl-3.0.x' | 'linux-arm64-openssl-1.1.x' | 'linux-arm64-openssl-1.0.x' | 'linux-arm64-openssl-3.0.x' | 'linux-arm-openssl-1.1.x' | 'linux-arm-openssl-1.0.x' | 'linux-arm-openssl-3.0.x' | 'linux-musl' | 'linux-musl-openssl-3.0.x' | 'linux-musl-arm64-openssl-1.1.x' | 'linux-musl-arm64-openssl-3.0.x' | 'linux-nixos' | 'linux-static-x64' | 'linux-static-arm64' | 'windows' | 'freebsd11' | 'freebsd12' | 'freebsd13' | 'freebsd14' | 'freebsd15' | 'openbsd' | 'netbsd' | 'arm';
export declare const binaryTargets: BinaryTarget[];

View File

@@ -0,0 +1,26 @@
"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 binaryTargets_exports = {};
__export(binaryTargets_exports, {
binaryTargets: () => import_chunk_7MLUNQIZ.binaryTargets
});
module.exports = __toCommonJS(binaryTargets_exports);
var import_chunk_7MLUNQIZ = require("./chunk-7MLUNQIZ.js");
var import_chunk_2ESYSVXG = require("./chunk-2ESYSVXG.js");
(0, import_chunk_7MLUNQIZ.init_binaryTargets)();

View File

@@ -0,0 +1,67 @@
"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_2ESYSVXG_exports = {};
__export(chunk_2ESYSVXG_exports, {
__commonJS: () => __commonJS,
__esm: () => __esm,
__export: () => __export2,
__require: () => __require,
__toCommonJS: () => __toCommonJS2,
__toESM: () => __toESM
});
module.exports = __toCommonJS(chunk_2ESYSVXG_exports);
var __create = Object.create;
var __defProp2 = Object.defineProperty;
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
var __getOwnPropNames2 = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
}) : x)(function(x) {
if (typeof require !== "undefined") return require.apply(this, arguments);
throw Error('Dynamic require of "' + x + '" is not supported');
});
var __esm = (fn, res) => function __init() {
return fn && (res = (0, fn[__getOwnPropNames2(fn)[0]])(fn = 0)), res;
};
var __commonJS = (cb, mod) => function __require2() {
return mod || (0, cb[__getOwnPropNames2(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
};
var __export2 = (target, all) => {
for (var name in all)
__defProp2(target, name, { get: all[name], enumerable: true });
};
var __copyProps2 = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames2(from))
if (!__hasOwnProp2.call(to, key) && key !== except)
__defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps2(
// 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 ? __defProp2(target, "default", { value: mod, enumerable: true }) : target,
mod
));
var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);

15104
_node_modules/@prisma/get-platform/dist/chunk-3UEKS5W6.js generated vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1 @@
"use strict";

View File

@@ -0,0 +1,62 @@
"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_7MLUNQIZ_exports = {};
__export(chunk_7MLUNQIZ_exports, {
binaryTargets: () => binaryTargets,
init_binaryTargets: () => init_binaryTargets
});
module.exports = __toCommonJS(chunk_7MLUNQIZ_exports);
var import_chunk_2ESYSVXG = require("./chunk-2ESYSVXG.js");
var binaryTargets;
var init_binaryTargets = (0, import_chunk_2ESYSVXG.__esm)({
"src/binaryTargets.ts"() {
binaryTargets = [
"darwin",
"darwin-arm64",
"debian-openssl-1.0.x",
"debian-openssl-1.1.x",
"debian-openssl-3.0.x",
"rhel-openssl-1.0.x",
"rhel-openssl-1.1.x",
"rhel-openssl-3.0.x",
"linux-arm64-openssl-1.1.x",
"linux-arm64-openssl-1.0.x",
"linux-arm64-openssl-3.0.x",
"linux-arm-openssl-1.1.x",
"linux-arm-openssl-1.0.x",
"linux-arm-openssl-3.0.x",
"linux-musl",
"linux-musl-openssl-3.0.x",
"linux-musl-arm64-openssl-1.1.x",
"linux-musl-arm64-openssl-3.0.x",
"linux-nixos",
"linux-static-x64",
"linux-static-arm64",
"windows",
"freebsd11",
"freebsd12",
"freebsd13",
"freebsd14",
"freebsd15",
"openbsd",
"netbsd",
"arm"
];
}
});

View File

@@ -0,0 +1,585 @@
"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_7PMGXL6S_exports = {};
__export(chunk_7PMGXL6S_exports, {
computeLibSSLSpecificPaths: () => computeLibSSLSpecificPaths,
getArchFromUname: () => getArchFromUname,
getBinaryTargetForCurrentPlatform: () => getBinaryTargetForCurrentPlatform,
getBinaryTargetForCurrentPlatformInternal: () => getBinaryTargetForCurrentPlatformInternal,
getPlatformInfo: () => getPlatformInfo,
getPlatformInfoMemoized: () => getPlatformInfoMemoized,
getSSLVersion: () => getSSLVersion,
getos: () => getos,
parseDistro: () => parseDistro,
parseLibSSLVersion: () => parseLibSSLVersion,
parseOpenSSLVersion: () => parseOpenSSLVersion,
resolveDistro: () => resolveDistro
});
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"));
var import_promises = __toESM(require("fs/promises"));
var import_os = __toESM(require("os"));
var import_util = require("util");
var t = Symbol.for("@ts-pattern/matcher");
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 s = (n2, o2, c2) => {
if (i(n2)) {
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(o2)) return false;
if (Array.isArray(n2)) {
if (!Array.isArray(o2)) return false;
let t2 = [], r2 = [], a = [];
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 (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 === o2.length && n2.every((t3, e2) => s(t3, o2[e2], c2));
}
return Reflect.ownKeys(n2).every((e2) => {
const r2 = n2[e2];
return (e2 in o2 || i(a = r2) && "optional" === a[t]().matcherType) && s(r2, o2[e2], c2);
var a;
});
}
return Object.is(o2, n2);
};
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: () => h(t2), and: (e2) => m(t2, e2), or: (e2) => d(t2, e2), select: (e2) => void 0 === e2 ? y(t2) : y(e2, t2) });
}
function h(e2) {
return u({ [t]: () => ({ match: (t2) => {
let n2 = {};
const r2 = (t3, e3) => {
n2[t3] = e3;
};
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) => {
let n2 = {};
const r2 = (t3, e3) => {
n2[t3] = e3;
};
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) => {
let n2 = {};
const r2 = (t3, e3) => {
n2[t3] = e3;
};
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 p(e2) {
return { [t]: () => ({ match: (t2) => ({ matched: Boolean(e2(t2)) }) }) };
}
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 || s(i2, t2, (t3, n2) => {
e3[t3] = n2;
}), selections: e3 };
}, getSelectionKeys: () => [null != r2 ? r2 : n].concat(void 0 === i2 ? [] : o(i2)) }) });
}
function v(t2) {
return "number" == typeof t2;
}
function b(t2) {
return "string" == typeof t2;
}
function w(t2) {
return "bigint" == typeof t2;
}
var S = u(p(function(t2) {
return true;
}));
var j = (t2) => Object.assign(u(t2), { startsWith: (e2) => {
return j(m(t2, (n2 = e2, p((t3) => b(t3) && t3.startsWith(n2)))));
var n2;
}, endsWith: (e2) => {
return j(m(t2, (n2 = e2, p((t3) => b(t3) && t3.endsWith(n2)))));
var 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, p((t3) => b(t3) && Boolean(t3.match(n2))))));
var n2;
} });
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 B = u(p(function(t2) {
return "symbol" == typeof t2;
}));
var _ = u(p(function(t2) {
return null == t2;
}));
var k = u(p(function(t2) {
return null != t2;
}));
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 I = class _I {
constructor(t2, e2) {
this.input = void 0, this.state = void 0, this.input = t2, this.state = e2;
}
with(...t2) {
if (this.state.matched) return this;
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 o2 = false, c2 = {};
const a = (t3, e3) => {
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 _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;
throw new W(this.input);
}
run() {
return this.exhaustive();
}
returnType() {
return this;
}
};
var exec = (0, import_util.promisify)(import_child_process.default.exec);
var debug = (0, import_debug.default)("prisma:get-platform");
var supportedLibSSLVersions = ["1.0.x", "1.1.x", "3.0.x"];
async function getos() {
const platform = import_os.default.platform();
const arch = process.arch;
if (platform === "freebsd") {
const version = await getCommandOutput(`freebsd-version`);
if (version && version.trim().length > 0) {
const regex = /^(\d+)\.?/;
const match = regex.exec(version);
if (match) {
return {
platform: "freebsd",
targetDistro: `freebsd${match[1]}`,
arch
};
}
}
}
if (platform !== "linux") {
return {
platform,
arch
};
}
const distroInfo = await resolveDistro();
const archFromUname = await getArchFromUname();
const libsslSpecificPaths = computeLibSSLSpecificPaths({ arch, archFromUname, familyDistro: distroInfo.familyDistro });
const { libssl } = await getSSLVersion(libsslSpecificPaths);
return {
platform: "linux",
libssl,
arch,
archFromUname,
...distroInfo
};
}
function parseDistro(osReleaseInput) {
const idRegex = /^ID="?([^"\n]*)"?$/im;
const idLikeRegex = /^ID_LIKE="?([^"\n]*)"?$/im;
const idMatch = idRegex.exec(osReleaseInput);
const id = idMatch && idMatch[1] && idMatch[1].toLowerCase() || "";
const idLikeMatch = idLikeRegex.exec(osReleaseInput);
const idLike = idLikeMatch && idLikeMatch[1] && idLikeMatch[1].toLowerCase() || "";
const distroInfo = z({ id, idLike }).with(
{ id: "alpine" },
({ id: originalDistro }) => ({
targetDistro: "musl",
familyDistro: originalDistro,
originalDistro
})
).with(
{ id: "raspbian" },
({ id: originalDistro }) => ({
targetDistro: "arm",
familyDistro: "debian",
originalDistro
})
).with(
{ id: "nixos" },
({ id: originalDistro }) => ({
targetDistro: "nixos",
originalDistro,
familyDistro: "nixos"
})
).with(
{ id: "debian" },
{ id: "ubuntu" },
({ id: originalDistro }) => ({
targetDistro: "debian",
familyDistro: "debian",
originalDistro
})
).with(
{ id: "rhel" },
{ id: "centos" },
{ id: "fedora" },
({ id: originalDistro }) => ({
targetDistro: "rhel",
familyDistro: "rhel",
originalDistro
})
).when(
({ idLike: idLike2 }) => idLike2.includes("debian") || idLike2.includes("ubuntu"),
({ id: originalDistro }) => ({
targetDistro: "debian",
familyDistro: "debian",
originalDistro
})
).when(
({ idLike: idLike2 }) => id === "arch" || idLike2.includes("arch"),
({ id: originalDistro }) => ({
targetDistro: "debian",
familyDistro: "arch",
originalDistro
})
).when(
({ idLike: idLike2 }) => idLike2.includes("centos") || idLike2.includes("fedora") || idLike2.includes("rhel") || idLike2.includes("suse"),
({ id: originalDistro }) => ({
targetDistro: "rhel",
familyDistro: "rhel",
originalDistro
})
).otherwise(({ id: originalDistro }) => {
return {
targetDistro: void 0,
familyDistro: void 0,
originalDistro
};
});
debug(`Found distro info:
${JSON.stringify(distroInfo, null, 2)}`);
return distroInfo;
}
async function resolveDistro() {
const osReleaseFile = "/etc/os-release";
try {
const osReleaseInput = await import_promises.default.readFile(osReleaseFile, { encoding: "utf-8" });
return parseDistro(osReleaseInput);
} catch (_2) {
return {
targetDistro: void 0,
familyDistro: void 0,
originalDistro: void 0
};
}
}
function parseOpenSSLVersion(input) {
const match = /^OpenSSL\s(\d+\.\d+)\.\d+/.exec(input);
if (match) {
const partialVersion = `${match[1]}.x`;
return sanitiseSSLVersion(partialVersion);
}
return void 0;
}
function parseLibSSLVersion(input) {
const match = /libssl\.so\.(\d)(\.\d)?/.exec(input);
if (match) {
const partialVersion = `${match[1]}${match[2] ?? ".0"}.x`;
return sanitiseSSLVersion(partialVersion);
}
return void 0;
}
function sanitiseSSLVersion(version) {
const sanitisedVersion = (() => {
if (isLibssl1x(version)) {
return version;
}
const versionSplit = version.split(".");
versionSplit[1] = "0";
return versionSplit.join(".");
})();
if (supportedLibSSLVersions.includes(sanitisedVersion)) {
return sanitisedVersion;
}
return void 0;
}
function computeLibSSLSpecificPaths(args) {
return z(args).with({ familyDistro: "musl" }, () => {
debug('Trying platform-specific paths for "alpine"');
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`];
}).with({ familyDistro: "rhel" }, () => {
debug('Trying platform-specific paths for "rhel"');
return ["/lib64", "/usr/lib64"];
}).otherwise(({ familyDistro, arch, archFromUname }) => {
debug(`Don't know any platform-specific paths for "${familyDistro}" on ${arch} (${archFromUname})`);
return [];
});
}
async function getSSLVersion(libsslSpecificPaths) {
const excludeLibssl0x = 'grep -v "libssl.so.0"';
const libsslFilenameFromSpecificPath = await findLibSSLInLocations(libsslSpecificPaths);
if (libsslFilenameFromSpecificPath) {
debug(`Found libssl.so file using platform-specific paths: ${libsslFilenameFromSpecificPath}`);
const libsslVersion = parseLibSSLVersion(libsslFilenameFromSpecificPath);
debug(`The parsed libssl version is: ${libsslVersion}`);
if (libsslVersion) {
return { libssl: libsslVersion, strategy: "libssl-specific-path" };
}
}
debug('Falling back to "ldconfig" and other generic paths');
let libsslFilename = await getCommandOutput(
/**
* The `ldconfig -p` returns the dynamic linker cache paths, where libssl.so files are likely to be included.
* Each line looks like this:
* libssl.so (libc6,hard-float) => /usr/lib/arm-linux-gnueabihf/libssl.so.1.1
* But we're only interested in the filename, so we use sed to remove everything before the `=>` separator,
* and then we remove the path and keep only the filename.
* The second sed commands uses `|` as a separator because the paths may contain `/`, which would result in the
* `unknown option to 's'` error (see https://stackoverflow.com/a/9366940/6174476) - which would silently
* fail with error code 0.
*/
`ldconfig -p | sed "s/.*=>s*//" | sed "s|.*/||" | grep libssl | sort | ${excludeLibssl0x}`
);
if (!libsslFilename) {
libsslFilename = await findLibSSLInLocations(["/lib64", "/usr/lib64", "/lib", "/usr/lib"]);
}
if (libsslFilename) {
debug(`Found libssl.so file using "ldconfig" or other generic paths: ${libsslFilename}`);
const libsslVersion = parseLibSSLVersion(libsslFilename);
debug(`The parsed libssl version is: ${libsslVersion}`);
if (libsslVersion) {
return { libssl: libsslVersion, strategy: "ldconfig" };
}
}
const openSSLVersionLine = await getCommandOutput("openssl version -v");
if (openSSLVersionLine) {
debug(`Found openssl binary with version: ${openSSLVersionLine}`);
const openSSLVersion = parseOpenSSLVersion(openSSLVersionLine);
debug(`The parsed openssl version is: ${openSSLVersion}`);
if (openSSLVersion) {
return { libssl: openSSLVersion, strategy: "openssl-binary" };
}
}
debug(`Couldn't find any version of libssl or OpenSSL in the system`);
return {};
}
async function findLibSSLInLocations(directories) {
for (const dir of directories) {
const libssl = await findLibSSL(dir);
if (libssl) {
return libssl;
}
}
return void 0;
}
async function findLibSSL(directory) {
try {
const dirContents = await import_promises.default.readdir(directory);
return dirContents.find((value) => value.startsWith("libssl.so.") && !value.startsWith("libssl.so.0"));
} catch (e2) {
if (e2.code === "ENOENT") {
return void 0;
}
throw e2;
}
}
async function getBinaryTargetForCurrentPlatform() {
const { binaryTarget } = await getPlatformInfoMemoized();
return binaryTarget;
}
function isPlatformInfoDefined(args) {
return args.binaryTarget !== void 0;
}
async function getPlatformInfo() {
const { memoized: _2, ...rest } = await getPlatformInfoMemoized();
return rest;
}
var memoizedPlatformWithInfo = {};
async function getPlatformInfoMemoized() {
if (isPlatformInfoDefined(memoizedPlatformWithInfo)) {
return Promise.resolve({ ...memoizedPlatformWithInfo, memoized: true });
}
const args = await getos();
const binaryTarget = getBinaryTargetForCurrentPlatformInternal(args);
memoizedPlatformWithInfo = { ...args, binaryTarget };
return { ...memoizedPlatformWithInfo, memoized: false };
}
function getBinaryTargetForCurrentPlatformInternal(args) {
const { platform, arch, archFromUname, libssl, targetDistro, familyDistro, originalDistro } = args;
if (platform === "linux" && !["x64", "arm64"].includes(arch)) {
(0, import_chunk_FWMN4WME.warn)(
`Prisma only officially supports Linux on amd64 (x86_64) and arm64 (aarch64) system architectures (detected "${arch}" instead). If you are using your own custom Prisma engines, you can ignore this warning, as long as you've compiled the engines for your system architecture "${archFromUname}".`
);
}
const defaultLibssl = "1.1.x";
if (platform === "linux" && libssl === void 0) {
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.";
});
(0, import_chunk_FWMN4WME.warn)(
`Prisma failed to detect the libssl/openssl version to use, and may not work as expected. Defaulting to "openssl-${defaultLibssl}".
${additionalMessage}`
);
}
const defaultDistro = "debian";
if (platform === "linux" && targetDistro === void 0) {
debug(`Distro is "${originalDistro}". Falling back to Prisma engines built for "${defaultDistro}".`);
}
if (platform === "darwin" && arch === "arm64") {
return "darwin-arm64";
}
if (platform === "darwin") {
return "darwin";
}
if (platform === "win32") {
return "windows";
}
if (platform === "freebsd") {
return targetDistro;
}
if (platform === "openbsd") {
return "openbsd";
}
if (platform === "netbsd") {
return "netbsd";
}
if (platform === "linux" && targetDistro === "nixos") {
return "linux-nixos";
}
if (platform === "linux" && arch === "arm64") {
const baseName = targetDistro === "musl" ? "linux-musl-arm64" : "linux-arm64";
return `${baseName}-openssl-${libssl || defaultLibssl}`;
}
if (platform === "linux" && arch === "arm") {
return `linux-arm-openssl-${libssl || defaultLibssl}`;
}
if (platform === "linux" && targetDistro === "musl") {
const base = "linux-musl";
if (!libssl) {
return base;
}
if (isLibssl1x(libssl)) {
return base;
} else {
return `${base}-openssl-${libssl}`;
}
}
if (platform === "linux" && targetDistro && libssl) {
return `${targetDistro}-openssl-${libssl}`;
}
if (platform !== "linux") {
(0, import_chunk_FWMN4WME.warn)(`Prisma detected unknown OS "${platform}" and may not work as expected. Defaulting to "linux".`);
}
if (libssl) {
return `${defaultDistro}-openssl-${libssl}`;
}
if (targetDistro) {
return `${targetDistro}-openssl-${defaultLibssl}`;
}
return `${defaultDistro}-openssl-${defaultLibssl}`;
}
async function discardError(runPromise) {
try {
return await runPromise();
} catch (e2) {
return void 0;
}
}
function getCommandOutput(command) {
return discardError(async () => {
const result = await exec(command);
debug(`Command "${command}" successfully returned "${result.stdout}"`);
return result.stdout;
});
}
async function getArchFromUname() {
if (typeof import_os.default["machine"] === "function") {
return import_os.default["machine"]();
}
const arch = await getCommandOutput("uname -m");
return arch?.trim();
}
function isLibssl1x(libssl) {
return libssl.startsWith("1.");
}

View File

@@ -0,0 +1,41 @@
"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_FWMN4WME_exports = {};
__export(chunk_FWMN4WME_exports, {
log: () => log,
should: () => should,
tags: () => tags,
warn: () => warn
});
module.exports = __toCommonJS(chunk_FWMN4WME_exports);
var import_chunk_YVXCXD3A = require("./chunk-YVXCXD3A.js");
var tags = {
warn: (0, import_chunk_YVXCXD3A.yellow)("prisma:warn")
};
var should = {
warn: () => !process.env.PRISMA_DISABLE_WARNINGS
};
function log(...data) {
console.log(...data);
}
function warn(message, ...optionalParams) {
if (should.warn()) {
console.warn(`${tags.warn} ${message}`, ...optionalParams);
}
}

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

@@ -0,0 +1,53 @@
"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_IPLRRT6O_exports = {};
__export(chunk_IPLRRT6O_exports, {
binaryTargetRegex: () => binaryTargetRegex,
binaryTargetRegex_exports: () => binaryTargetRegex_exports,
init_binaryTargetRegex: () => init_binaryTargetRegex
});
module.exports = __toCommonJS(chunk_IPLRRT6O_exports);
var import_chunk_7MLUNQIZ = require("./chunk-7MLUNQIZ.js");
var import_chunk_2ESYSVXG = require("./chunk-2ESYSVXG.js");
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";
}
});
var binaryTargetRegex_exports = {};
(0, import_chunk_2ESYSVXG.__export)(binaryTargetRegex_exports, {
binaryTargetRegex: () => binaryTargetRegex
});
var binaryTargetRegex;
var init_binaryTargetRegex = (0, import_chunk_2ESYSVXG.__esm)({
"src/test-utils/binaryTargetRegex.ts"() {
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) => 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

@@ -0,0 +1,70 @@
"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_YVXCXD3A_exports = {};
__export(chunk_YVXCXD3A_exports, {
underline: () => underline,
yellow: () => yellow
});
module.exports = __toCommonJS(chunk_YVXCXD3A_exports);
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);

View File

@@ -0,0 +1,105 @@
/// <reference types="node" />
import { BinaryTarget } from './binaryTargets';
declare const supportedLibSSLVersions: readonly ["1.0.x", "1.1.x", "3.0.x"];
export type Arch = 'x32' | 'x64' | 'arm' | 'arm64' | 's390' | 's390x' | 'mipsel' | 'ia32' | 'mips' | 'ppc' | 'ppc64';
export type DistroInfo = {
/**
* The original distro is the Linux distro name detected via its release file.
* E.g., on Arch Linux, the original distro is `arch`. On Linux Alpine, the original distro is `alpine`.
*/
originalDistro?: string;
/**
* The family distro is the Linux distro name that is used to determine Linux families based on the same base distro, and likely using the same package manager.
* E.g., both Ubuntu and Debian belong to the `debian` family of distros, and thus rely on the same package manager (`apt`).
*/
familyDistro?: string;
/**
* The target distro is the Linux distro associated with the Prisma Engines.
* E.g., on Arch Linux, Debian, and Ubuntu, the target distro is `debian`. On Linux Alpine, the target distro is `musl`.
*/
targetDistro?: 'rhel' | 'debian' | 'musl' | 'arm' | 'nixos' | 'freebsd11' | 'freebsd12' | 'freebsd13' | 'freebsd14' | 'freebsd15';
};
type GetOsResultLinux = {
platform: 'linux';
arch: Arch;
archFromUname: string | undefined;
/**
* Starting from version 3.0, OpenSSL is basically adopting semver, and will be API and ABI compatible within a major version.
*/
libssl?: (typeof supportedLibSSLVersions)[number];
} & DistroInfo;
export type GetOSResult = {
platform: Omit<NodeJS.Platform, 'linux'>;
arch: Arch;
targetDistro?: DistroInfo['targetDistro'];
familyDistro?: never;
originalDistro?: never;
archFromUname?: never;
libssl?: never;
} | GetOsResultLinux;
/**
* For internal use only. This public export will be eventually removed in favor of `getPlatformWithOSResult`.
*/
export declare function getos(): Promise<GetOSResult>;
export declare function parseDistro(osReleaseInput: string): DistroInfo;
export declare function resolveDistro(): Promise<DistroInfo>;
/**
* Parse the OpenSSL version from the output of the openssl binary, e.g.
* "OpenSSL 3.0.2 15 Mar 2022 (Library: OpenSSL 3.0.2 15 Mar 2022)" -> "3.0.x"
*/
export declare function parseOpenSSLVersion(input: string): GetOsResultLinux['libssl'] | undefined;
/**
* Parse the OpenSSL version from the output of the libssl.so file, e.g.
* "libssl.so.3" -> "3.0.x"
*/
export declare function parseLibSSLVersion(input: string): GetOsResultLinux['libssl'];
type ComputeLibSSLSpecificPathsParams = {
arch: Arch;
archFromUname: Awaited<ReturnType<typeof getArchFromUname>>;
familyDistro: DistroInfo['familyDistro'];
};
export declare function computeLibSSLSpecificPaths(args: ComputeLibSSLSpecificPathsParams): string[];
type GetOpenSSLVersionResult = {
libssl: GetOsResultLinux['libssl'];
strategy: 'libssl-specific-path' | 'ldconfig' | 'openssl-binary';
} | {
libssl?: never;
strategy?: never;
};
/**
* On Linux, returns the libssl version excluding the patch version, e.g. "1.1.x".
* Reading the version from the libssl.so file is more reliable than reading it from the openssl binary.
* Older versions of libssl are preferred, e.g. "1.0.x" over "1.1.x", because of Vercel serverless
* having different build and runtime environments, with the runtime environment having an old version
* of libssl, and the build environment having both that old version and a newer version of libssl installed.
* Because of https://github.com/prisma/prisma/issues/17499, we explicitly filter out libssl 0.x.
*
* This function never throws.
*/
export declare function getSSLVersion(libsslSpecificPaths: string[]): Promise<GetOpenSSLVersionResult>;
/**
* Get the binary target for the current platform, e.g. `linux-musl-arm64-openssl-3.0.x` for Linux Alpine on arm64.
*/
export declare function getBinaryTargetForCurrentPlatform(): Promise<BinaryTarget>;
export type PlatformInfo = GetOSResult & {
binaryTarget: BinaryTarget;
};
/**
* Get the binary target and other system information (e.g., the libssl version to look for) for the current platform.
*/
export declare function getPlatformInfo(): Promise<PlatformInfo>;
export declare function getPlatformInfoMemoized(): Promise<PlatformInfo & {
memoized: boolean;
}>;
/**
* This function is only exported for testing purposes.
*/
export declare function getBinaryTargetForCurrentPlatformInternal(args: GetOSResult): BinaryTarget;
/**
* Returns the architecture of a system from the output of `uname -m` (whose format is different than `process.arch`).
* This function never throws.
* TODO: deprecate this function in favor of `os.machine()` once either Node v16.18.0 or v18.9.0 becomes the minimum
* supported Node.js version for Prisma.
*/
export declare function getArchFromUname(): Promise<string | undefined>;
export {};

38
_node_modules/@prisma/get-platform/dist/getPlatform.js generated vendored Normal file
View File

@@ -0,0 +1,38 @@
"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 getPlatform_exports = {};
__export(getPlatform_exports, {
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_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");

5
_node_modules/@prisma/get-platform/dist/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,5 @@
export { type BinaryTarget, binaryTargets } from './binaryTargets';
export type { PlatformInfo } from './getPlatform';
export { getBinaryTargetForCurrentPlatform, getos, getPlatformInfo } from './getPlatform';
export { link } from './link';
export * from './test-utils';

41
_node_modules/@prisma/get-platform/dist/index.js generated vendored Normal file
View File

@@ -0,0 +1,41 @@
"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 index_exports = {};
__export(index_exports, {
binaryTargets: () => import_chunk_7MLUNQIZ.binaryTargets,
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(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)();

1
_node_modules/@prisma/get-platform/dist/link.d.ts generated vendored Normal file
View File

@@ -0,0 +1 @@
export declare function link(url: any): string;

26
_node_modules/@prisma/get-platform/dist/link.js generated vendored Normal file
View File

@@ -0,0 +1,26 @@
"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 link_exports = {};
__export(link_exports, {
link: () => import_chunk_M5T7GI2R.link
});
module.exports = __toCommonJS(link_exports);
var import_chunk_M5T7GI2R = require("./chunk-M5T7GI2R.js");
var import_chunk_YVXCXD3A = require("./chunk-YVXCXD3A.js");
var import_chunk_2ESYSVXG = require("./chunk-2ESYSVXG.js");

8
_node_modules/@prisma/get-platform/dist/logger.d.ts generated vendored Normal file
View File

@@ -0,0 +1,8 @@
export declare const tags: {
warn: string;
};
export declare const should: {
warn: () => boolean;
};
export declare function log(...data: any[]): void;
export declare function warn(message: any, ...optionalParams: any[]): void;

29
_node_modules/@prisma/get-platform/dist/logger.js generated vendored Normal file
View File

@@ -0,0 +1,29 @@
"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 logger_exports = {};
__export(logger_exports, {
log: () => import_chunk_FWMN4WME.log,
should: () => import_chunk_FWMN4WME.should,
tags: () => import_chunk_FWMN4WME.tags,
warn: () => import_chunk_FWMN4WME.warn
});
module.exports = __toCommonJS(logger_exports);
var import_chunk_FWMN4WME = require("./chunk-FWMN4WME.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

@@ -0,0 +1,8 @@
/**
* This regex matches all supported binary target names in a given string.
*
* Platform names are sorted by their lengths in descending order to ensure that
* the longest substring is always matched (e.g., "darwin-arm64" is matched as a
* whole instead of "darwin" and "arm" separately)
*/
export declare const binaryTargetRegex: RegExp;

View File

@@ -0,0 +1,27 @@
"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 binaryTargetRegex_exports = {};
__export(binaryTargetRegex_exports, {
binaryTargetRegex: () => import_chunk_IPLRRT6O.binaryTargetRegex
});
module.exports = __toCommonJS(binaryTargetRegex_exports);
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_IPLRRT6O.init_binaryTargetRegex)();

View File

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

View File

@@ -0,0 +1,30 @@
"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 test_utils_exports = {};
__export(test_utils_exports, {
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_GGL63BNP = require("../chunk-GGL63BNP.js");
var import_chunk_3UEKS5W6 = require("../chunk-3UEKS5W6.js");
var import_chunk_2ESYSVXG = require("../chunk-2ESYSVXG.js");

View File

@@ -0,0 +1,122 @@
/// <reference types="jest" />
import { type ExecaChildProcess } from 'execa';
import type { FSJetpack } from 'fs-jetpack/types';
/**
* 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 jestContext: {
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 Jest spy before each test.
*/
type ConsoleContext = {
mocked: {
'console.error': jest.SpyInstance;
'console.log': jest.SpyInstance;
'console.info': jest.SpyInstance;
'console.warn': jest.SpyInstance;
};
};
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.
*/
type ProcessContext = {
mocked: {
'process.stderr.write': jest.SpyInstance;
'process.stdout.write': jest.SpyInstance;
};
normalizedCapturedStdout: () => string;
normalizedCapturedStderr: () => string;
clearCapturedStdout: () => void;
clearCapturedStderr: () => void;
};
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

@@ -0,0 +1,29 @@
"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 jestContext_exports = {};
__export(jestContext_exports, {
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_GGL63BNP = require("../chunk-GGL63BNP.js");
var import_chunk_3UEKS5W6 = require("../chunk-3UEKS5W6.js");
var import_chunk_2ESYSVXG = require("../chunk-2ESYSVXG.js");

View File

@@ -0,0 +1,151 @@
"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 jestSnapshotSerializer_exports = {};
__export(jestSnapshotSerializer_exports, {
default: () => jestSnapshotSerializer_default
});
module.exports = __toCommonJS(jestSnapshotSerializer_exports);
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_jestSnapshotSerializer = (0, import_chunk_2ESYSVXG.__commonJS)({
"src/test-utils/jestSnapshotSerializer.js"(exports, module2) {
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");
}
function normalizeLogs(str) {
return str.replace(
/Started query engine http server on http:\/\/127\.0\.0\.1:\d{1,5}/g,
"Started query engine http server on http://127.0.0.1:00000"
).replace(/Starting a postgresql pool with \d+ connections./g, "Starting a postgresql pool with XX connections.");
}
function normalizeTmpDir(str) {
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 str.replaceAll(parentDir, "");
}
function normalizeToUnixPaths(str) {
return str.replaceAll(path.sep, "/");
}
function normalizeGitHubLinks(str) {
return str.replace(/https:\/\/github.com\/prisma\/prisma(-client-js)?\/issues\/new\S+/, "TEST_GITHUB_LINK");
}
function normalizeTsClientStackTrace(str) {
return str.replace(/([/\\]client[/\\]src[/\\]__tests__[/\\].*test\.ts)(:\d*:\d*)/, "$1:0:0").replace(/([/\\]client[/\\]tests[/\\]functional[/\\].*\.ts)(:\d*:\d*)/, "$1:0:0");
}
function removePlatforms(str) {
return str.replace(binaryTargetRegex, "TEST_PLATFORM");
}
function normalizeBinaryFilePath(str) {
return str.replace(/\.exe(\s+)?(\W.*)/g, "$1$2").replace(/\.exe$/g, "");
}
function normalizeMigrateTimestamps(str) {
return str.replace(/(?<!\d)\d{14}(?!\d)/g, "20201231000000");
}
function normalizeDbUrl(str) {
return str.replace(/(localhost|postgres|mysql|mssql|mongodb_migrate|cockroachdb):(\d+)/g, "localhost:$2");
}
function normalizeRustError(str) {
return str.replace(/\/rustc\/(.+)\//g, "/rustc/hash/").replace(/(\[.*)(:\d*:\d*)(\])/g, "[/some/rust/path:0:0$3");
}
function normalizeRustCodeLocation(str) {
return str.replace(/(\w+\.rs):(\d+):(\d+)/g, "$1:0:0");
}
function normalizeArtificialPanic(str) {
return str.replace(/(Command failed with exit code 101:) (.+) /g, "$1 prisma-engines-path ");
}
function normalizeTime(str) {
return str.replace(/ \d+ms/g, " XXXms").replace(/ \d+(\.\d+)?s/g, " XXXms");
}
function prepareSchemaForSnapshot(str) {
if (!str.includes("tmp/prisma-tests/integration-test")) return str;
const urlRegex = /url\s*=\s*.+/;
const outputRegex = /output\s*=\s*.+/;
return str.split("\n").map((line) => {
const urlMatch = urlRegex.exec(line);
if (urlMatch) {
return `${line.slice(0, urlMatch.index)}url = "***"`;
}
const outputMatch = outputRegex.exec(line);
if (outputMatch) {
return `${line.slice(0, outputMatch.index)}output = "***"`;
}
return line;
}).join("\n");
}
function wrapWithQuotes(str) {
return `"${str}"`;
}
module2.exports = {
// Expected by Jest
test(value) {
return typeof value === "string" || value instanceof Error;
},
serialize(value) {
const message = typeof value === "string" ? value : value instanceof Error ? value.message : "";
return pipe(
stripVTControlCharacters,
// integration-tests pkg
prepareSchemaForSnapshot,
// Generic
normalizeTmpDir,
normalizeTime,
// From Client package
normalizeGitHubLinks,
removePlatforms,
normalizeBinaryFilePath,
normalizeTsClientStackTrace,
trimErrorPaths,
normalizePrismaPaths,
normalizeLogs,
// remove windows \\
normalizeToUnixPaths,
// From Migrate/CLI package
normalizeDbUrl,
normalizeRustError,
normalizeRustCodeLocation,
normalizeMigrateTimestamps,
// artificial panic
normalizeArtificialPanic,
wrapWithQuotes
)(message);
}
};
}
});
var jestSnapshotSerializer_default = require_jestSnapshotSerializer();

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,48 @@
{
"name": "@prisma/get-platform",
"version": "7.2.0",
"description": "This package is intended for Prisma's internal use",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"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/get-platform"
},
"bugs": "https://github.com/prisma/prisma/issues",
"devDependencies": {
"@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",
"kleur": "4.1.5",
"tempy": "1.0.1",
"terminal-link": "4.0.0",
"ts-pattern": "5.6.2",
"typescript": "5.4.5",
"vitest": "3.2.4"
},
"dependencies": {
"@prisma/debug": "7.2.0"
},
"files": [
"README.md",
"dist"
],
"sideEffects": false,
"scripts": {
"dev": "DEV=true tsx helpers/build.ts",
"build": "tsx helpers/build.ts",
"test": "jest"
}
}