Aktueller Stand

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

View File

@@ -1,17 +1,14 @@
import { BinaryType as BinaryType_2 } from '@prisma/fetch-engine';
import type { BinaryPaths } from '@prisma/fetch-engine';
import type { DownloadOptions } from '@prisma/fetch-engine';
import { enginesVersion } from '@prisma/engines-version';
export declare const DEFAULT_CLI_QUERY_ENGINE_BINARY_TYPE = BinaryType.QueryEngineLibrary;
export { enginesVersion }
export declare function ensureBinariesExist(): Promise<void>;
export declare function ensureNeededBinariesExist({ download }: EnsureSomeBinariesExistInput): Promise<void>;
/**
* Checks if the env override `PRISMA_CLI_QUERY_ENGINE_TYPE` is set to `library` or `binary`
* Otherwise returns the default
*/
export declare function getCliQueryEngineBinaryType(): BinaryType_2;
declare type EnsureSomeBinariesExistInput = {
download: (options: DownloadOptions) => Promise<BinaryPaths>;
};
export declare function getEnginesPath(): string;

View File

@@ -28,50 +28,30 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// src/index.ts
var src_exports = {};
__export(src_exports, {
DEFAULT_CLI_QUERY_ENGINE_BINARY_TYPE: () => DEFAULT_CLI_QUERY_ENGINE_BINARY_TYPE,
var index_exports = {};
__export(index_exports, {
enginesVersion: () => import_engines_version2.enginesVersion,
ensureBinariesExist: () => ensureBinariesExist,
getCliQueryEngineBinaryType: () => getCliQueryEngineBinaryType,
ensureNeededBinariesExist: () => ensureNeededBinariesExist,
getEnginesPath: () => getEnginesPath
});
module.exports = __toCommonJS(src_exports);
var import_debug = __toESM(require("@prisma/debug"));
module.exports = __toCommonJS(index_exports);
var import_debug = require("@prisma/debug");
var import_engines_version = require("@prisma/engines-version");
var import_fetch_engine = require("@prisma/fetch-engine");
var import_path = __toESM(require("path"));
var import_engines_version2 = require("@prisma/engines-version");
var debug = (0, import_debug.default)("prisma:engines");
var debug = (0, import_debug.Debug)("prisma:engines");
function getEnginesPath() {
return import_path.default.join(__dirname, "../");
}
var DEFAULT_CLI_QUERY_ENGINE_BINARY_TYPE = import_fetch_engine.BinaryType.QueryEngineLibrary;
function getCliQueryEngineBinaryType() {
const envCliQueryEngineType = process.env.PRISMA_CLI_QUERY_ENGINE_TYPE;
if (envCliQueryEngineType) {
if (envCliQueryEngineType === "binary") {
return import_fetch_engine.BinaryType.QueryEngineBinary;
}
if (envCliQueryEngineType === "library") {
return import_fetch_engine.BinaryType.QueryEngineLibrary;
}
}
return DEFAULT_CLI_QUERY_ENGINE_BINARY_TYPE;
}
async function ensureBinariesExist() {
async function ensureNeededBinariesExist({ download }) {
const binaryDir = import_path.default.join(__dirname, "../");
let binaryTargets;
if (process.env.PRISMA_CLI_BINARY_TARGETS) {
binaryTargets = process.env.PRISMA_CLI_BINARY_TARGETS.split(",");
}
const cliQueryEngineBinaryType = getCliQueryEngineBinaryType();
const binaries = {
[cliQueryEngineBinaryType]: binaryDir,
[import_fetch_engine.BinaryType.SchemaEngineBinary]: binaryDir
};
debug(`binaries to download ${Object.keys(binaries).join(", ")}`);
await (0, import_fetch_engine.download)({
const binaryTargets = process.env.PRISMA_CLI_BINARY_TARGETS ? process.env.PRISMA_CLI_BINARY_TARGETS.split(",") : void 0;
await download({
binaries,
showProgress: true,
version: import_engines_version.enginesVersion,
@@ -79,35 +59,9 @@ async function ensureBinariesExist() {
binaryTargets
});
}
import_path.default.join(__dirname, "../query-engine-darwin");
import_path.default.join(__dirname, "../query-engine-darwin-arm64");
import_path.default.join(__dirname, "../query-engine-debian-openssl-1.0.x");
import_path.default.join(__dirname, "../query-engine-debian-openssl-1.1.x");
import_path.default.join(__dirname, "../query-engine-debian-openssl-3.0.x");
import_path.default.join(__dirname, "../query-engine-linux-static-x64");
import_path.default.join(__dirname, "../query-engine-linux-static-arm64");
import_path.default.join(__dirname, "../query-engine-rhel-openssl-1.0.x");
import_path.default.join(__dirname, "../query-engine-rhel-openssl-1.1.x");
import_path.default.join(__dirname, "../query-engine-rhel-openssl-3.0.x");
import_path.default.join(__dirname, "../libquery_engine-darwin.dylib.node");
import_path.default.join(__dirname, "../libquery_engine-darwin-arm64.dylib.node");
import_path.default.join(__dirname, "../libquery_engine-debian-openssl-1.0.x.so.node");
import_path.default.join(__dirname, "../libquery_engine-debian-openssl-1.1.x.so.node");
import_path.default.join(__dirname, "../libquery_engine-debian-openssl-3.0.x.so.node");
import_path.default.join(__dirname, "../libquery_engine-linux-arm64-openssl-1.0.x.so.node");
import_path.default.join(__dirname, "../libquery_engine-linux-arm64-openssl-1.1.x.so.node");
import_path.default.join(__dirname, "../libquery_engine-linux-arm64-openssl-3.0.x.so.node");
import_path.default.join(__dirname, "../libquery_engine-linux-musl.so.node");
import_path.default.join(__dirname, "../libquery_engine-linux-musl-openssl-3.0.x.so.node");
import_path.default.join(__dirname, "../libquery_engine-rhel-openssl-1.0.x.so.node");
import_path.default.join(__dirname, "../libquery_engine-rhel-openssl-1.1.x.so.node");
import_path.default.join(__dirname, "../libquery_engine-rhel-openssl-3.0.x.so.node");
import_path.default.join(__dirname, "../query_engine-windows.dll.node");
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
DEFAULT_CLI_QUERY_ENGINE_BINARY_TYPE,
enginesVersion,
ensureBinariesExist,
getCliQueryEngineBinaryType,
ensureNeededBinariesExist,
getEnginesPath
});

View File

@@ -270,9 +270,9 @@ var require_path_key = __commonJS({
}
});
// ../../node_modules/.pnpm/cross-spawn@7.0.3/node_modules/cross-spawn/lib/util/resolveCommand.js
// ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/resolveCommand.js
var require_resolveCommand = __commonJS({
"../../node_modules/.pnpm/cross-spawn@7.0.3/node_modules/cross-spawn/lib/util/resolveCommand.js"(exports2, module2) {
"../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/resolveCommand.js"(exports2, module2) {
"use strict";
var path2 = require("path");
var which = require_which();
@@ -312,9 +312,9 @@ var require_resolveCommand = __commonJS({
}
});
// ../../node_modules/.pnpm/cross-spawn@7.0.3/node_modules/cross-spawn/lib/util/escape.js
// ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/escape.js
var require_escape = __commonJS({
"../../node_modules/.pnpm/cross-spawn@7.0.3/node_modules/cross-spawn/lib/util/escape.js"(exports2, module2) {
"../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/escape.js"(exports2, module2) {
"use strict";
var metaCharsRegExp = /([()\][%!^"`<>&|;, *?])/g;
function escapeCommand(arg) {
@@ -323,8 +323,8 @@ var require_escape = __commonJS({
}
function escapeArgument(arg, doubleEscapeMetaChars) {
arg = `${arg}`;
arg = arg.replace(/(\\*)"/g, '$1$1\\"');
arg = arg.replace(/(\\*)$/, "$1$1");
arg = arg.replace(/(?=(\\+?)?)\1"/g, '$1$1\\"');
arg = arg.replace(/(?=(\\+?)?)\1$/, "$1$1");
arg = `"${arg}"`;
arg = arg.replace(metaCharsRegExp, "^$1");
if (doubleEscapeMetaChars) {
@@ -365,9 +365,9 @@ var require_shebang_command = __commonJS({
}
});
// ../../node_modules/.pnpm/cross-spawn@7.0.3/node_modules/cross-spawn/lib/util/readShebang.js
// ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/readShebang.js
var require_readShebang = __commonJS({
"../../node_modules/.pnpm/cross-spawn@7.0.3/node_modules/cross-spawn/lib/util/readShebang.js"(exports2, module2) {
"../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/readShebang.js"(exports2, module2) {
"use strict";
var fs2 = require("fs");
var shebangCommand = require_shebang_command();
@@ -387,9 +387,9 @@ var require_readShebang = __commonJS({
}
});
// ../../node_modules/.pnpm/cross-spawn@7.0.3/node_modules/cross-spawn/lib/parse.js
// ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/parse.js
var require_parse = __commonJS({
"../../node_modules/.pnpm/cross-spawn@7.0.3/node_modules/cross-spawn/lib/parse.js"(exports2, module2) {
"../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/parse.js"(exports2, module2) {
"use strict";
var path2 = require("path");
var resolveCommand = require_resolveCommand();
@@ -449,9 +449,9 @@ var require_parse = __commonJS({
}
});
// ../../node_modules/.pnpm/cross-spawn@7.0.3/node_modules/cross-spawn/lib/enoent.js
// ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/enoent.js
var require_enoent = __commonJS({
"../../node_modules/.pnpm/cross-spawn@7.0.3/node_modules/cross-spawn/lib/enoent.js"(exports2, module2) {
"../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/enoent.js"(exports2, module2) {
"use strict";
var isWin = process.platform === "win32";
function notFoundError(original, syscall) {
@@ -470,7 +470,7 @@ var require_enoent = __commonJS({
const originalEmit = cp.emit;
cp.emit = function(name, arg1) {
if (name === "exit") {
const err = verifyENOENT(arg1, parsed, "spawn");
const err = verifyENOENT(arg1, parsed);
if (err) {
return originalEmit.call(cp, "error", err);
}
@@ -499,9 +499,9 @@ var require_enoent = __commonJS({
}
});
// ../../node_modules/.pnpm/cross-spawn@7.0.3/node_modules/cross-spawn/index.js
// ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/index.js
var require_cross_spawn = __commonJS({
"../../node_modules/.pnpm/cross-spawn@7.0.3/node_modules/cross-spawn/index.js"(exports2, module2) {
"../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/index.js"(exports2, module2) {
"use strict";
var cp = require("child_process");
var parse = require_parse();
@@ -2001,8 +2001,6 @@ async function main() {
const branch = import_package.enginesOverride?.["branch"];
let folder = import_package.enginesOverride?.["folder"];
const engineCachePaths = {
[import_fetch_engine.BinaryType.QueryEngineBinary]: import_path.default.join(cacheDir, import_fetch_engine.BinaryType.QueryEngineBinary),
[import_fetch_engine.BinaryType.QueryEngineLibrary]: import_path.default.join(cacheDir, import_fetch_engine.BinaryType.QueryEngineLibrary),
[import_fetch_engine.BinaryType.SchemaEngineBinary]: import_path.default.join(cacheDir, import_fetch_engine.BinaryType.SchemaEngineBinary)
};
if (branch !== void 0) {
@@ -2030,11 +2028,8 @@ async function main() {
}
if (folder !== void 0) {
folder = import_path.default.isAbsolute(folder) ? folder : import_path.default.join(baseDir, folder);
const libExt = binaryTarget.includes("windows") ? ".dll" : binaryTarget.includes("darwin") ? ".dylib" : ".so";
const binExt = binaryTarget.includes("windows") ? ".exe" : "";
const engineOutputPaths = {
[import_fetch_engine.BinaryType.QueryEngineLibrary]: import_path.default.join(folder, "libquery_engine".concat(libExt)),
[import_fetch_engine.BinaryType.QueryEngineBinary]: import_path.default.join(folder, import_fetch_engine.BinaryType.QueryEngineBinary.concat(binExt)),
[import_fetch_engine.BinaryType.SchemaEngineBinary]: import_path.default.join(folder, import_fetch_engine.BinaryType.SchemaEngineBinary.concat(binExt))
};
for (const [binaryType, outputPath] of Object.entries(engineOutputPaths)) {

View File

@@ -23,83 +23,34 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
));
// src/scripts/postinstall.ts
var import_debug2 = __toESM(require("@prisma/debug"));
var import_engines_version3 = require("@prisma/engines-version");
var import_fetch_engine2 = require("@prisma/fetch-engine");
var import_fs = __toESM(require("fs"));
var import_path2 = __toESM(require("path"));
// src/index.ts
var import_debug = __toESM(require("@prisma/debug"));
var import_engines_version = require("@prisma/engines-version");
var import_fetch_engine = require("@prisma/fetch-engine");
var import_fs = __toESM(require("fs"));
var import_path = __toESM(require("path"));
var import_engines_version2 = require("@prisma/engines-version");
var debug = (0, import_debug.default)("prisma:engines");
var DEFAULT_CLI_QUERY_ENGINE_BINARY_TYPE = import_fetch_engine.BinaryType.QueryEngineLibrary;
function getCliQueryEngineBinaryType() {
const envCliQueryEngineType = process.env.PRISMA_CLI_QUERY_ENGINE_TYPE;
if (envCliQueryEngineType) {
if (envCliQueryEngineType === "binary") {
return import_fetch_engine.BinaryType.QueryEngineBinary;
}
if (envCliQueryEngineType === "library") {
return import_fetch_engine.BinaryType.QueryEngineLibrary;
}
}
return DEFAULT_CLI_QUERY_ENGINE_BINARY_TYPE;
}
import_path.default.join(__dirname, "../query-engine-darwin");
import_path.default.join(__dirname, "../query-engine-darwin-arm64");
import_path.default.join(__dirname, "../query-engine-debian-openssl-1.0.x");
import_path.default.join(__dirname, "../query-engine-debian-openssl-1.1.x");
import_path.default.join(__dirname, "../query-engine-debian-openssl-3.0.x");
import_path.default.join(__dirname, "../query-engine-linux-static-x64");
import_path.default.join(__dirname, "../query-engine-linux-static-arm64");
import_path.default.join(__dirname, "../query-engine-rhel-openssl-1.0.x");
import_path.default.join(__dirname, "../query-engine-rhel-openssl-1.1.x");
import_path.default.join(__dirname, "../query-engine-rhel-openssl-3.0.x");
import_path.default.join(__dirname, "../libquery_engine-darwin.dylib.node");
import_path.default.join(__dirname, "../libquery_engine-darwin-arm64.dylib.node");
import_path.default.join(__dirname, "../libquery_engine-debian-openssl-1.0.x.so.node");
import_path.default.join(__dirname, "../libquery_engine-debian-openssl-1.1.x.so.node");
import_path.default.join(__dirname, "../libquery_engine-debian-openssl-3.0.x.so.node");
import_path.default.join(__dirname, "../libquery_engine-linux-arm64-openssl-1.0.x.so.node");
import_path.default.join(__dirname, "../libquery_engine-linux-arm64-openssl-1.1.x.so.node");
import_path.default.join(__dirname, "../libquery_engine-linux-arm64-openssl-3.0.x.so.node");
import_path.default.join(__dirname, "../libquery_engine-linux-musl.so.node");
import_path.default.join(__dirname, "../libquery_engine-linux-musl-openssl-3.0.x.so.node");
import_path.default.join(__dirname, "../libquery_engine-rhel-openssl-1.0.x.so.node");
import_path.default.join(__dirname, "../libquery_engine-rhel-openssl-1.1.x.so.node");
import_path.default.join(__dirname, "../libquery_engine-rhel-openssl-3.0.x.so.node");
import_path.default.join(__dirname, "../query_engine-windows.dll.node");
// src/scripts/postinstall.ts
var debug2 = (0, import_debug2.default)("prisma:download");
var baseDir = import_path2.default.join(__dirname, "../../");
var lockFile = import_path2.default.join(baseDir, "download-lock");
var debug = (0, import_debug.default)("prisma:download");
var baseDir = import_path.default.join(__dirname, "../../");
var lockFile = import_path.default.join(baseDir, "download-lock");
var createdLockFile = false;
async function main() {
if (import_fs.default.existsSync(lockFile) && parseInt(import_fs.default.readFileSync(lockFile, "utf-8"), 10) > Date.now() - 2e4) {
debug2(`Lock file already exists, so we're skipping the download of the prisma binaries`);
debug(`Lock file already exists, so we're skipping the download of the prisma binaries`);
} else {
createLockFile();
let binaryTargets;
if (process.env.PRISMA_CLI_BINARY_TARGETS) {
binaryTargets = process.env.PRISMA_CLI_BINARY_TARGETS.split(",");
}
const cliQueryEngineBinaryType = getCliQueryEngineBinaryType();
const binaries = {
[cliQueryEngineBinaryType]: baseDir,
[import_fetch_engine2.BinaryType.SchemaEngineBinary]: baseDir
[import_fetch_engine.BinaryType.SchemaEngineBinary]: baseDir
};
await (0, import_fetch_engine2.download)({
await (0, import_fetch_engine.download)({
binaries,
version: import_engines_version3.enginesVersion,
version: import_engines_version.enginesVersion,
showProgress: true,
failSilent: true,
binaryTargets
}).catch((e) => debug2(e));
}).catch((e) => debug(e));
cleanupLockFile();
}
}
@@ -114,11 +65,11 @@ function cleanupLockFile() {
import_fs.default.unlinkSync(lockFile);
}
} catch (e) {
debug2(e);
debug(e);
}
}
}
main().catch((e) => debug2(e));
main().catch((e) => debug(e));
process.on("beforeExit", () => {
cleanupLockFile();
});