@prisma/internals 5.16.0 → 5.17.0-integration-es2021.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-ZOCBNOCC.js → chunk-3BQPLVGY.js} +5 -5
- package/dist/{chunk-TKRKGGID.js → chunk-3H62IOKX.js} +7 -7
- package/dist/chunk-5XRQ7ONW.js +122 -0
- package/dist/{chunk-2W5SRYSU.js → chunk-B4R5MGJU.js} +8 -8
- package/dist/chunk-DGQEXKUB.js +110 -0
- package/dist/{chunk-GJ3353AA.js → chunk-GJYU5LSN.js} +24 -795
- package/dist/{chunk-R4T44FN3.js → chunk-HQZBRMTO.js} +8 -8
- package/dist/chunk-KIC4MOJQ.js +166 -0
- package/dist/{chunk-GEBTVXQ6.js → chunk-O4OJPE6I.js} +5 -5
- package/dist/chunk-ONFZFD3I.js +177 -0
- package/dist/{chunk-HLFMAFRO.js → chunk-PJDEZXWV.js} +5 -5
- package/dist/chunk-QIVUAERL.js +2202 -0
- package/dist/chunk-QMNSOAXY.js +54 -0
- package/dist/{chunk-EYCPUVNF.js → chunk-RYHJYMR4.js} +8 -8
- package/dist/{chunk-YGAQN2OS.js → chunk-TE5WSCMG.js} +19 -19
- package/dist/{chunk-P72YOUAS.js → chunk-TVHGQWBG.js} +5 -5
- package/dist/{chunk-M2FQFXUO.js → chunk-YA7KEMAF.js} +4 -4
- package/dist/cli/checkUnsupportedDataProxy.js +12 -12
- package/dist/cli/getSchema.js +17 -17
- package/dist/cli/hashes.js +12 -12
- package/dist/engine-commands/errorHelpers.js +4 -4
- package/dist/engine-commands/formatSchema.js +11 -11
- package/dist/engine-commands/getConfig.js +10 -10
- package/dist/engine-commands/getDmmf.js +7 -7
- package/dist/engine-commands/index.js +20 -20
- package/dist/engine-commands/lintSchema.js +8 -8
- package/dist/engine-commands/mergeSchemas.js +7 -7
- package/dist/engine-commands/validate.js +7 -7
- package/dist/get-generators/generatorResolvers/generatorResolvers.js +11 -11
- package/dist/get-generators/generatorResolvers/prisma-client-js/check-dependencies/checkTypeScriptVersion.js +11 -11
- package/dist/get-generators/generatorResolvers/prisma-client-js/check-dependencies/checkYarnVersion.js +11 -11
- package/dist/get-generators/generatorResolvers/prisma-client-js/prismaClientResolver.js +12 -12
- package/dist/get-generators/getGenerators.js +14 -14
- package/dist/index.js +39 -39
- package/dist/sendPanic.js +11 -11
- package/dist/utils/getEnvPaths.js +11 -11
- package/dist/utils/getVersionFromPackageJson.js +3 -3
- package/dist/utils/handlePanic.js +11 -11
- package/dist/utils/loadEnvFile.js +11 -11
- package/dist/wasm.js +4 -4
- package/package.json +7 -7
|
@@ -16,11 +16,11 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
16
|
return to;
|
|
17
17
|
};
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var
|
|
20
|
-
__export(
|
|
19
|
+
var chunk_3BQPLVGY_exports = {};
|
|
20
|
+
__export(chunk_3BQPLVGY_exports, {
|
|
21
21
|
version: () => version
|
|
22
22
|
});
|
|
23
|
-
module.exports = __toCommonJS(
|
|
24
|
-
var
|
|
25
|
-
var packageJson = (0,
|
|
23
|
+
module.exports = __toCommonJS(chunk_3BQPLVGY_exports);
|
|
24
|
+
var import_chunk_YA7KEMAF = require("./chunk-YA7KEMAF.js");
|
|
25
|
+
var packageJson = (0, import_chunk_YA7KEMAF.require_package)();
|
|
26
26
|
var version = packageJson.version;
|
|
@@ -26,19 +26,19 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
26
26
|
mod
|
|
27
27
|
));
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var
|
|
30
|
-
__export(
|
|
29
|
+
var chunk_3H62IOKX_exports = {};
|
|
30
|
+
__export(chunk_3H62IOKX_exports, {
|
|
31
31
|
MergeSchemasError: () => MergeSchemasError,
|
|
32
32
|
mergeSchemas: () => mergeSchemas
|
|
33
33
|
});
|
|
34
|
-
module.exports = __toCommonJS(
|
|
34
|
+
module.exports = __toCommonJS(chunk_3H62IOKX_exports);
|
|
35
35
|
var import_chunk_YRBRUREX = require("./chunk-YRBRUREX.js");
|
|
36
36
|
var import_chunk_EKSAMZHR = require("./chunk-EKSAMZHR.js");
|
|
37
37
|
var import_chunk_WMIBAVWZ = require("./chunk-WMIBAVWZ.js");
|
|
38
|
-
var
|
|
38
|
+
var import_chunk_TVHGQWBG = require("./chunk-TVHGQWBG.js");
|
|
39
39
|
var import_chunk_SMHAELKS = require("./chunk-SMHAELKS.js");
|
|
40
40
|
var import_chunk_H3T4L34H = require("./chunk-H3T4L34H.js");
|
|
41
|
-
var
|
|
41
|
+
var import_chunk_O4OJPE6I = require("./chunk-O4OJPE6I.js");
|
|
42
42
|
var import_chunk_A4QWQE3W = require("./chunk-A4QWQE3W.js");
|
|
43
43
|
var import_chunk_JM6ICT4D = require("./chunk-JM6ICT4D.js");
|
|
44
44
|
var import_chunk_PG5FDKSF = require("./chunk-PG5FDKSF.js");
|
|
@@ -60,7 +60,7 @@ ${detailsHeader} ${message}`;
|
|
|
60
60
|
}).exhaustive();
|
|
61
61
|
const errorMessageWithContext = `${constructedErrorMessage}
|
|
62
62
|
[Context: mergeSchemas]`;
|
|
63
|
-
super((0,
|
|
63
|
+
super((0, import_chunk_TVHGQWBG.addVersionDetailsToErrorMessage)(errorMessageWithContext));
|
|
64
64
|
this.name = "MergeSchemasError";
|
|
65
65
|
}
|
|
66
66
|
};
|
|
@@ -73,7 +73,7 @@ function mergeSchemas(options) {
|
|
|
73
73
|
const params = JSON.stringify({
|
|
74
74
|
schema: options.schemas
|
|
75
75
|
});
|
|
76
|
-
return
|
|
76
|
+
return import_chunk_O4OJPE6I.prismaSchemaWasm.merge_schemas(params);
|
|
77
77
|
},
|
|
78
78
|
(e) => ({
|
|
79
79
|
type: "wasm-error",
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM2 = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var chunk_5XRQ7ONW_exports = {};
|
|
30
|
+
__export(chunk_5XRQ7ONW_exports, {
|
|
31
|
+
getBinaryPathsByVersion: () => getBinaryPathsByVersion
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(chunk_5XRQ7ONW_exports);
|
|
34
|
+
var import_chunk_RS2R7COT = require("./chunk-RS2R7COT.js");
|
|
35
|
+
var import_chunk_4CGPN5SR = require("./chunk-4CGPN5SR.js");
|
|
36
|
+
var import_chunk_2SDPW6AX = require("./chunk-2SDPW6AX.js");
|
|
37
|
+
var import_chunk_7B5PXS6N = require("./chunk-7B5PXS6N.js");
|
|
38
|
+
var import_chunk_QIVUAERL = require("./chunk-QIVUAERL.js");
|
|
39
|
+
var import_chunk_WWAWV7DQ = require("./chunk-WWAWV7DQ.js");
|
|
40
|
+
var import_engines = require("@prisma/engines");
|
|
41
|
+
var import_fetch_engine = require("@prisma/fetch-engine");
|
|
42
|
+
var import_path = __toESM2(require("path"));
|
|
43
|
+
var import_fs_extra = (0, import_chunk_WWAWV7DQ.__toESM)((0, import_chunk_QIVUAERL.require_lib)());
|
|
44
|
+
async function getBinaryPathsByVersion({
|
|
45
|
+
neededVersions,
|
|
46
|
+
binaryTarget,
|
|
47
|
+
version,
|
|
48
|
+
printDownloadProgress,
|
|
49
|
+
skipDownload,
|
|
50
|
+
binaryPathsOverride
|
|
51
|
+
}) {
|
|
52
|
+
const binaryPathsByVersion = /* @__PURE__ */ Object.create(null);
|
|
53
|
+
for (const currentVersion in neededVersions) {
|
|
54
|
+
binaryPathsByVersion[currentVersion] = {};
|
|
55
|
+
const neededVersion = neededVersions[currentVersion];
|
|
56
|
+
if (neededVersion.binaryTargets.length === 0) {
|
|
57
|
+
neededVersion.binaryTargets = [{ fromEnvVar: null, value: binaryTarget }];
|
|
58
|
+
}
|
|
59
|
+
if (process.env.NETLIFY) {
|
|
60
|
+
const isNodeMajor20OrUp = parseInt(process.versions.node.split(".")[0]) >= 20;
|
|
61
|
+
const awsRuntimeVersion = (0, import_chunk_2SDPW6AX.parseAWSNodejsRuntimeEnvVarVersion)();
|
|
62
|
+
const isRuntimeEnvVar20OrUp = awsRuntimeVersion && awsRuntimeVersion >= 20;
|
|
63
|
+
const isRuntimeEnvVar18OrDown = awsRuntimeVersion && awsRuntimeVersion <= 18;
|
|
64
|
+
const isRhelBinaryTarget1xInNeededVersions = neededVersion.binaryTargets.find(
|
|
65
|
+
(object) => object.value === "rhel-openssl-1.0.x"
|
|
66
|
+
);
|
|
67
|
+
const isRhelBinaryTarget3xInNeededVersions = neededVersion.binaryTargets.find(
|
|
68
|
+
(object) => object.value === "rhel-openssl-3.0.x"
|
|
69
|
+
);
|
|
70
|
+
if (!isRhelBinaryTarget3xInNeededVersions && (isNodeMajor20OrUp || isRuntimeEnvVar20OrUp) && !isRuntimeEnvVar18OrDown) {
|
|
71
|
+
neededVersion.binaryTargets.push({
|
|
72
|
+
fromEnvVar: null,
|
|
73
|
+
value: "rhel-openssl-3.0.x"
|
|
74
|
+
});
|
|
75
|
+
} else if (!isRhelBinaryTarget1xInNeededVersions) {
|
|
76
|
+
neededVersion.binaryTargets.push({
|
|
77
|
+
fromEnvVar: null,
|
|
78
|
+
value: "rhel-openssl-1.0.x"
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
let binaryTargetBaseDir = eval(`require('path').join(__dirname, '..')`);
|
|
83
|
+
if (version !== currentVersion) {
|
|
84
|
+
binaryTargetBaseDir = import_path.default.join(binaryTargetBaseDir, `./engines/${currentVersion}/`);
|
|
85
|
+
await (0, import_fs_extra.ensureDir)(binaryTargetBaseDir).catch((e) => console.error(e));
|
|
86
|
+
}
|
|
87
|
+
const binariesConfig = neededVersion.engines.reduce((acc, curr) => {
|
|
88
|
+
if (!binaryPathsOverride?.[curr]) {
|
|
89
|
+
acc[(0, import_chunk_4CGPN5SR.engineTypeToBinaryType)(curr)] = binaryTargetBaseDir;
|
|
90
|
+
}
|
|
91
|
+
return acc;
|
|
92
|
+
}, /* @__PURE__ */ Object.create(null));
|
|
93
|
+
if (Object.values(binariesConfig).length > 0) {
|
|
94
|
+
const binaryTargets = neededVersion.binaryTargets.map(
|
|
95
|
+
(binaryTarget2) => binaryTarget2.value
|
|
96
|
+
);
|
|
97
|
+
const downloadParams = {
|
|
98
|
+
binaries: binariesConfig,
|
|
99
|
+
binaryTargets,
|
|
100
|
+
showProgress: typeof printDownloadProgress === "boolean" ? printDownloadProgress : true,
|
|
101
|
+
version: currentVersion && currentVersion !== "latest" ? currentVersion : import_engines.enginesVersion,
|
|
102
|
+
skipDownload
|
|
103
|
+
};
|
|
104
|
+
const binaryPathsWithEngineType = await (0, import_fetch_engine.download)(downloadParams);
|
|
105
|
+
const binaryPaths = (0, import_chunk_7B5PXS6N.mapKeys)(binaryPathsWithEngineType, import_chunk_RS2R7COT.binaryTypeToEngineType);
|
|
106
|
+
binaryPathsByVersion[currentVersion] = binaryPaths;
|
|
107
|
+
}
|
|
108
|
+
if (binaryPathsOverride) {
|
|
109
|
+
const overrideEngines = Object.keys(binaryPathsOverride);
|
|
110
|
+
const enginesCoveredByOverride = neededVersion.engines.filter((engine) => overrideEngines.includes(engine));
|
|
111
|
+
if (enginesCoveredByOverride.length > 0) {
|
|
112
|
+
for (const engine of enginesCoveredByOverride) {
|
|
113
|
+
const enginePath = binaryPathsOverride[engine];
|
|
114
|
+
binaryPathsByVersion[currentVersion][engine] = {
|
|
115
|
+
[binaryTarget]: enginePath
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
return binaryPathsByVersion;
|
|
122
|
+
}
|
|
@@ -26,19 +26,19 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
26
26
|
mod
|
|
27
27
|
));
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var
|
|
30
|
-
__export(
|
|
29
|
+
var chunk_B4R5MGJU_exports = {};
|
|
30
|
+
__export(chunk_B4R5MGJU_exports, {
|
|
31
31
|
ValidateError: () => ValidateError,
|
|
32
32
|
validate: () => validate
|
|
33
33
|
});
|
|
34
|
-
module.exports = __toCommonJS(
|
|
34
|
+
module.exports = __toCommonJS(chunk_B4R5MGJU_exports);
|
|
35
35
|
var import_chunk_YRBRUREX = require("./chunk-YRBRUREX.js");
|
|
36
36
|
var import_chunk_EKSAMZHR = require("./chunk-EKSAMZHR.js");
|
|
37
37
|
var import_chunk_WMIBAVWZ = require("./chunk-WMIBAVWZ.js");
|
|
38
|
-
var
|
|
38
|
+
var import_chunk_TVHGQWBG = require("./chunk-TVHGQWBG.js");
|
|
39
39
|
var import_chunk_SMHAELKS = require("./chunk-SMHAELKS.js");
|
|
40
40
|
var import_chunk_H3T4L34H = require("./chunk-H3T4L34H.js");
|
|
41
|
-
var
|
|
41
|
+
var import_chunk_O4OJPE6I = require("./chunk-O4OJPE6I.js");
|
|
42
42
|
var import_chunk_A4QWQE3W = require("./chunk-A4QWQE3W.js");
|
|
43
43
|
var import_chunk_JM6ICT4D = require("./chunk-JM6ICT4D.js");
|
|
44
44
|
var import_chunk_PG5FDKSF = require("./chunk-PG5FDKSF.js");
|
|
@@ -60,7 +60,7 @@ ${detailsHeader} ${message}`;
|
|
|
60
60
|
}).exhaustive();
|
|
61
61
|
const errorMessageWithContext = `${constructedErrorMessage}
|
|
62
62
|
[Context: validate]`;
|
|
63
|
-
super((0,
|
|
63
|
+
super((0, import_chunk_TVHGQWBG.addVersionDetailsToErrorMessage)(errorMessageWithContext));
|
|
64
64
|
this.name = "ValidateError";
|
|
65
65
|
}
|
|
66
66
|
};
|
|
@@ -72,13 +72,13 @@ function validate(options) {
|
|
|
72
72
|
() => {
|
|
73
73
|
if (process.env.FORCE_PANIC_QUERY_ENGINE_GET_DMMF) {
|
|
74
74
|
debug("Triggering a Rust panic...");
|
|
75
|
-
|
|
75
|
+
import_chunk_O4OJPE6I.prismaSchemaWasm.debug_panic();
|
|
76
76
|
}
|
|
77
77
|
const params = JSON.stringify({
|
|
78
78
|
prismaSchema: options.schemas,
|
|
79
79
|
noColor: Boolean(process.env.NO_COLOR)
|
|
80
80
|
});
|
|
81
|
-
|
|
81
|
+
import_chunk_O4OJPE6I.prismaSchemaWasm.validate(params);
|
|
82
82
|
},
|
|
83
83
|
(e) => ({
|
|
84
84
|
type: "wasm-error",
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM2 = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var chunk_DGQEXKUB_exports = {};
|
|
30
|
+
__export(chunk_DGQEXKUB_exports, {
|
|
31
|
+
BinaryType: () => import_fetch_engine.BinaryType,
|
|
32
|
+
engineEnvVarMap: () => import_fetch_engine.engineEnvVarMap,
|
|
33
|
+
maybeCopyToTmp: () => maybeCopyToTmp,
|
|
34
|
+
resolveBinary: () => resolveBinary,
|
|
35
|
+
safeResolveBinary: () => safeResolveBinary
|
|
36
|
+
});
|
|
37
|
+
module.exports = __toCommonJS(chunk_DGQEXKUB_exports);
|
|
38
|
+
var import_chunk_QIVUAERL = require("./chunk-QIVUAERL.js");
|
|
39
|
+
var import_chunk_M3GBKLGE = require("./chunk-M3GBKLGE.js");
|
|
40
|
+
var import_chunk_TWSLDIFL = require("./chunk-TWSLDIFL.js");
|
|
41
|
+
var import_chunk_JM6ICT4D = require("./chunk-JM6ICT4D.js");
|
|
42
|
+
var import_chunk_TZCE3PWZ = require("./chunk-TZCE3PWZ.js");
|
|
43
|
+
var import_chunk_WWAWV7DQ = require("./chunk-WWAWV7DQ.js");
|
|
44
|
+
var import_engines = require("@prisma/engines");
|
|
45
|
+
var import_fetch_engine = require("@prisma/fetch-engine");
|
|
46
|
+
var import_get_platform = require("@prisma/get-platform");
|
|
47
|
+
var import_fs = __toESM2(require("fs"));
|
|
48
|
+
var import_path = __toESM2(require("path"));
|
|
49
|
+
var import_fs_extra = (0, import_chunk_WWAWV7DQ.__toESM)((0, import_chunk_QIVUAERL.require_lib)());
|
|
50
|
+
var import_temp_dir = (0, import_chunk_WWAWV7DQ.__toESM)((0, import_chunk_TZCE3PWZ.require_temp_dir)());
|
|
51
|
+
async function getBinaryName(name) {
|
|
52
|
+
const binaryTarget = await (0, import_get_platform.getBinaryTargetForCurrentPlatform)();
|
|
53
|
+
const extension = binaryTarget === "windows" ? ".exe" : "";
|
|
54
|
+
if (name === import_fetch_engine.BinaryType.QueryEngineLibrary) {
|
|
55
|
+
return (0, import_get_platform.getNodeAPIName)(binaryTarget, "fs");
|
|
56
|
+
}
|
|
57
|
+
return `${name}-${binaryTarget}${extension}`;
|
|
58
|
+
}
|
|
59
|
+
async function resolveBinary(name, proposedPath) {
|
|
60
|
+
if (proposedPath && !proposedPath.match(import_chunk_M3GBKLGE.vercelPkgPathRegex) && import_fs.default.existsSync(proposedPath)) {
|
|
61
|
+
return proposedPath;
|
|
62
|
+
}
|
|
63
|
+
const pathFromEnvVar = (0, import_fetch_engine.getBinaryEnvVarPath)(name);
|
|
64
|
+
if (pathFromEnvVar !== null) {
|
|
65
|
+
return pathFromEnvVar.path;
|
|
66
|
+
}
|
|
67
|
+
const binaryName = await getBinaryName(name);
|
|
68
|
+
const prismaPath = import_path.default.join((0, import_engines.getEnginesPath)(), binaryName);
|
|
69
|
+
if (import_fs.default.existsSync(prismaPath)) {
|
|
70
|
+
return maybeCopyToTmp(prismaPath);
|
|
71
|
+
}
|
|
72
|
+
const prismaPath2 = import_path.default.join(__dirname, "..", binaryName);
|
|
73
|
+
if (import_fs.default.existsSync(prismaPath2)) {
|
|
74
|
+
return maybeCopyToTmp(prismaPath2);
|
|
75
|
+
}
|
|
76
|
+
const prismaPath3 = import_path.default.join(__dirname, "../..", binaryName);
|
|
77
|
+
if (import_fs.default.existsSync(prismaPath3)) {
|
|
78
|
+
return maybeCopyToTmp(prismaPath3);
|
|
79
|
+
}
|
|
80
|
+
const prismaPath4 = import_path.default.join(__dirname, "../runtime", binaryName);
|
|
81
|
+
if (import_fs.default.existsSync(prismaPath4)) {
|
|
82
|
+
return maybeCopyToTmp(prismaPath4);
|
|
83
|
+
}
|
|
84
|
+
throw new Error(
|
|
85
|
+
`Could not find ${name} binary. Searched in:
|
|
86
|
+
- ${prismaPath}
|
|
87
|
+
- ${prismaPath2}
|
|
88
|
+
- ${prismaPath3}
|
|
89
|
+
- ${prismaPath4}`
|
|
90
|
+
);
|
|
91
|
+
}
|
|
92
|
+
function safeResolveBinary(name, proposedPath) {
|
|
93
|
+
return (0, import_chunk_JM6ICT4D.tryCatch2)(
|
|
94
|
+
() => resolveBinary(name, proposedPath),
|
|
95
|
+
(error) => error
|
|
96
|
+
);
|
|
97
|
+
}
|
|
98
|
+
async function maybeCopyToTmp(file) {
|
|
99
|
+
const dir = eval("__dirname");
|
|
100
|
+
if (dir.match(import_chunk_M3GBKLGE.vercelPkgPathRegex)) {
|
|
101
|
+
const targetDir = import_path.default.join(import_temp_dir.default, "prisma-binaries");
|
|
102
|
+
await (0, import_fs_extra.ensureDir)(targetDir);
|
|
103
|
+
const target = import_path.default.join(targetDir, import_path.default.basename(file));
|
|
104
|
+
const data = await import_fs.default.promises.readFile(file);
|
|
105
|
+
await import_fs.default.promises.writeFile(target, data);
|
|
106
|
+
(0, import_chunk_TWSLDIFL.chmodPlusX)(target);
|
|
107
|
+
return target;
|
|
108
|
+
}
|
|
109
|
+
return file;
|
|
110
|
+
}
|