@prisma-lossless/engines 7.8.0-lossless.11
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/LICENSE +201 -0
- package/README.md +13 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.js +67 -0
- package/dist/scripts/localinstall.d.ts +1 -0
- package/dist/scripts/localinstall.js +2043 -0
- package/dist/scripts/postinstall.d.ts +1 -0
- package/dist/scripts/postinstall.js +79 -0
- package/package.json +40 -0
- package/scripts/postinstall.js +28 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,79 @@
|
|
|
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 __copyProps = (to, from, except, desc) => {
|
|
9
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
10
|
+
for (let key of __getOwnPropNames(from))
|
|
11
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
12
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
13
|
+
}
|
|
14
|
+
return to;
|
|
15
|
+
};
|
|
16
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
17
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
18
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
19
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
20
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
21
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
|
+
mod
|
|
23
|
+
));
|
|
24
|
+
|
|
25
|
+
// src/scripts/postinstall.ts
|
|
26
|
+
var import_engines_version = require("@prisma/engines-version");
|
|
27
|
+
var import_debug = __toESM(require("@prisma-lossless/debug"));
|
|
28
|
+
var import_fetch_engine = require("@prisma-lossless/fetch-engine");
|
|
29
|
+
var import_fs = __toESM(require("fs"));
|
|
30
|
+
var import_path = __toESM(require("path"));
|
|
31
|
+
var debug = (0, import_debug.default)("prisma:download");
|
|
32
|
+
var baseDir = import_path.default.join(__dirname, "../../");
|
|
33
|
+
var lockFile = import_path.default.join(baseDir, "download-lock");
|
|
34
|
+
var createdLockFile = false;
|
|
35
|
+
async function main() {
|
|
36
|
+
if (import_fs.default.existsSync(lockFile) && parseInt(import_fs.default.readFileSync(lockFile, "utf-8"), 10) > Date.now() - 2e4) {
|
|
37
|
+
debug(`Lock file already exists, so we're skipping the download of the prisma binaries`);
|
|
38
|
+
} else {
|
|
39
|
+
createLockFile();
|
|
40
|
+
let binaryTargets;
|
|
41
|
+
if (process.env.PRISMA_CLI_BINARY_TARGETS) {
|
|
42
|
+
binaryTargets = process.env.PRISMA_CLI_BINARY_TARGETS.split(",");
|
|
43
|
+
}
|
|
44
|
+
const binaries = {
|
|
45
|
+
[import_fetch_engine.BinaryType.SchemaEngineBinary]: baseDir
|
|
46
|
+
};
|
|
47
|
+
await (0, import_fetch_engine.download)({
|
|
48
|
+
binaries,
|
|
49
|
+
version: import_engines_version.enginesVersion,
|
|
50
|
+
showProgress: true,
|
|
51
|
+
failSilent: true,
|
|
52
|
+
binaryTargets
|
|
53
|
+
}).catch((e) => debug(e));
|
|
54
|
+
cleanupLockFile();
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
function createLockFile() {
|
|
58
|
+
createdLockFile = true;
|
|
59
|
+
import_fs.default.writeFileSync(lockFile, Date.now().toString());
|
|
60
|
+
}
|
|
61
|
+
function cleanupLockFile() {
|
|
62
|
+
if (createdLockFile) {
|
|
63
|
+
try {
|
|
64
|
+
if (import_fs.default.existsSync(lockFile)) {
|
|
65
|
+
import_fs.default.unlinkSync(lockFile);
|
|
66
|
+
}
|
|
67
|
+
} catch (e) {
|
|
68
|
+
debug(e);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
main().catch((e) => debug(e));
|
|
73
|
+
process.on("beforeExit", () => {
|
|
74
|
+
cleanupLockFile();
|
|
75
|
+
});
|
|
76
|
+
process.once("SIGINT", () => {
|
|
77
|
+
cleanupLockFile();
|
|
78
|
+
process.exit();
|
|
79
|
+
});
|
package/package.json
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@prisma-lossless/engines",
|
|
3
|
+
"version": "7.8.0-lossless.11",
|
|
4
|
+
"description": "This package is intended for Prisma's internal use",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "https://github.com/prisma/prisma.git",
|
|
10
|
+
"directory": "packages/engines"
|
|
11
|
+
},
|
|
12
|
+
"license": "Apache-2.0",
|
|
13
|
+
"author": "Tim Suchanek <suchanek@prisma.io>",
|
|
14
|
+
"devDependencies": {
|
|
15
|
+
"@swc/core": "1.11.5",
|
|
16
|
+
"@swc/jest": "0.2.37",
|
|
17
|
+
"@types/jest": "29.5.14",
|
|
18
|
+
"@types/node": "~20.19.24",
|
|
19
|
+
"execa": "5.1.1",
|
|
20
|
+
"typescript": "5.4.5"
|
|
21
|
+
},
|
|
22
|
+
"dependencies": {
|
|
23
|
+
"@prisma-lossless/debug": "7.8.0-lossless.11",
|
|
24
|
+
"@prisma/engines-version": "7.8.0-6.3c6e192761c0362d496ed980de936e2f3cebcd3a",
|
|
25
|
+
"@prisma-lossless/fetch-engine": "7.8.0-lossless.11",
|
|
26
|
+
"@prisma-lossless/get-platform": "7.8.0-lossless.11"
|
|
27
|
+
},
|
|
28
|
+
"files": [
|
|
29
|
+
"dist",
|
|
30
|
+
"download",
|
|
31
|
+
"scripts"
|
|
32
|
+
],
|
|
33
|
+
"sideEffects": false,
|
|
34
|
+
"scripts": {
|
|
35
|
+
"dev": "DEV=true tsx helpers/build.ts",
|
|
36
|
+
"build": "tsx helpers/build.ts",
|
|
37
|
+
"test": "vitest run",
|
|
38
|
+
"postinstall": "node scripts/postinstall.js"
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
const path = require('path')
|
|
2
|
+
|
|
3
|
+
const postInstallScriptPath = path.join(__dirname, '..', 'dist', 'scripts', 'postinstall.js')
|
|
4
|
+
const localInstallScriptPath = path.join(__dirname, '..', 'dist', 'scripts', 'localinstall.js')
|
|
5
|
+
|
|
6
|
+
try {
|
|
7
|
+
// that's when we develop in the monorepo, `dist` does not exist yet
|
|
8
|
+
// so we compile postinstall script and trigger it immediately after
|
|
9
|
+
if (require('../package.json').version === '0.0.0') {
|
|
10
|
+
const execa = require('execa')
|
|
11
|
+
const buildScriptPath = path.join(__dirname, '..', 'helpers', 'build.ts')
|
|
12
|
+
|
|
13
|
+
execa.sync('pnpm', ['tsx', buildScriptPath], {
|
|
14
|
+
// for the sake of simplicity, we IGNORE_EXTERNALS in our own setup
|
|
15
|
+
// ie. when the monorepo installs, the postinstall is self-contained
|
|
16
|
+
env: { DEV: true, IGNORE_EXTERNALS: true },
|
|
17
|
+
stdio: 'inherit',
|
|
18
|
+
})
|
|
19
|
+
|
|
20
|
+
// if enabled, it will install engine overrides into the cache dir
|
|
21
|
+
execa.sync('node', [localInstallScriptPath], {
|
|
22
|
+
stdio: 'inherit',
|
|
23
|
+
})
|
|
24
|
+
}
|
|
25
|
+
} catch {}
|
|
26
|
+
|
|
27
|
+
// that's the normal path, when users get this package ready/installed
|
|
28
|
+
require(postInstallScriptPath)
|