@prisma/get-platform 6.12.0 → 6.13.0-dev.10
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-KH3ZZM2G.js +167 -0
- package/dist/{chunk-HE3NEP2U.js → chunk-QDGOOSXR.js} +774 -914
- package/dist/index.js +6 -5
- package/dist/magic-string.es-3WRPFX2A.js +1315 -0
- package/dist/test-utils/index.js +6 -5
- package/dist/test-utils/jestContext.js +6 -5
- package/dist/test-utils/vitestContext.d.ts +123 -0
- package/dist/test-utils/vitestContext.js +17621 -0
- package/package.json +7 -6
|
@@ -0,0 +1,167 @@
|
|
|
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 __toESM = (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_KH3ZZM2G_exports = {};
|
|
30
|
+
__export(chunk_KH3ZZM2G_exports, {
|
|
31
|
+
jestConsoleContext: () => jestConsoleContext,
|
|
32
|
+
jestContext: () => jestContext,
|
|
33
|
+
jestStdoutContext: () => jestStdoutContext,
|
|
34
|
+
processExitContext: () => processExitContext
|
|
35
|
+
});
|
|
36
|
+
module.exports = __toCommonJS(chunk_KH3ZZM2G_exports);
|
|
37
|
+
var import_chunk_QDGOOSXR = require("./chunk-QDGOOSXR.js");
|
|
38
|
+
var import_chunk_2ESYSVXG = require("./chunk-2ESYSVXG.js");
|
|
39
|
+
var import_path = __toESM(require("path"));
|
|
40
|
+
var import_execa = (0, import_chunk_2ESYSVXG.__toESM)((0, import_chunk_QDGOOSXR.require_execa)());
|
|
41
|
+
var import_fs_jetpack = (0, import_chunk_2ESYSVXG.__toESM)((0, import_chunk_QDGOOSXR.require_main)());
|
|
42
|
+
var import_tempy = (0, import_chunk_2ESYSVXG.__toESM)((0, import_chunk_QDGOOSXR.require_tempy)());
|
|
43
|
+
var jestContext = {
|
|
44
|
+
new: function(ctx = {}) {
|
|
45
|
+
const c = ctx;
|
|
46
|
+
beforeEach(() => {
|
|
47
|
+
const originalCwd = process.cwd();
|
|
48
|
+
c.mocked = c.mocked ?? {
|
|
49
|
+
cwd: process.cwd()
|
|
50
|
+
};
|
|
51
|
+
c.tmpDir = import_tempy.default.directory();
|
|
52
|
+
c.fs = import_fs_jetpack.default.cwd(c.tmpDir);
|
|
53
|
+
c.tree = (startFrom = c.tmpDir, indent = "") => {
|
|
54
|
+
function* generateDirectoryTree(children2, indent2 = "") {
|
|
55
|
+
for (const child of children2) {
|
|
56
|
+
if (child.name === "node_modules" || child.name === ".git") {
|
|
57
|
+
continue;
|
|
58
|
+
}
|
|
59
|
+
if (child.type === "dir") {
|
|
60
|
+
yield `${indent2}\u2514\u2500\u2500 ${child.name}/`;
|
|
61
|
+
yield* generateDirectoryTree(child.children, indent2 + " ");
|
|
62
|
+
} else if (child.type === "symlink") {
|
|
63
|
+
yield `${indent2} -> ${child.relativePath}`;
|
|
64
|
+
} else {
|
|
65
|
+
yield `${indent2}\u2514\u2500\u2500 ${child.name}`;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
const children = c.fs.inspectTree(startFrom, { relativePath: true, symlinks: "report" })?.children || [];
|
|
70
|
+
return `
|
|
71
|
+
${[...generateDirectoryTree(children, indent)].join("\n")}
|
|
72
|
+
`;
|
|
73
|
+
};
|
|
74
|
+
c.fixture = (name) => {
|
|
75
|
+
c.fs.copy(import_path.default.join(originalCwd, "src", "__tests__", "fixtures", name), ".", {
|
|
76
|
+
overwrite: true
|
|
77
|
+
});
|
|
78
|
+
c.fs.symlink(import_path.default.join(originalCwd, "..", "client"), import_path.default.join(c.fs.cwd(), "node_modules", "@prisma", "client"));
|
|
79
|
+
};
|
|
80
|
+
c.cli = (...input) => {
|
|
81
|
+
return import_execa.default.node(import_path.default.join(originalCwd, "../cli/build/index.js"), input, {
|
|
82
|
+
cwd: c.fs.cwd(),
|
|
83
|
+
stdio: "pipe",
|
|
84
|
+
all: true
|
|
85
|
+
});
|
|
86
|
+
};
|
|
87
|
+
c.printDir = (dir, extensions) => {
|
|
88
|
+
const content = c.fs.list(dir) ?? [];
|
|
89
|
+
content.sort((a, b) => a.localeCompare(b));
|
|
90
|
+
return content.filter((name) => extensions.includes(import_path.default.extname(name))).map((name) => `${name}:
|
|
91
|
+
|
|
92
|
+
${c.fs.read(import_path.default.join(dir, name))}`).join("\n\n");
|
|
93
|
+
};
|
|
94
|
+
process.chdir(c.tmpDir);
|
|
95
|
+
});
|
|
96
|
+
afterEach(() => {
|
|
97
|
+
process.chdir(c.mocked.cwd);
|
|
98
|
+
});
|
|
99
|
+
return factory(ctx);
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
function factory(ctx) {
|
|
103
|
+
return {
|
|
104
|
+
add(contextContributor) {
|
|
105
|
+
const newCtx = contextContributor(ctx);
|
|
106
|
+
return factory(newCtx);
|
|
107
|
+
},
|
|
108
|
+
assemble() {
|
|
109
|
+
return ctx;
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
var jestConsoleContext = () => (c) => {
|
|
114
|
+
const ctx = c;
|
|
115
|
+
beforeEach(() => {
|
|
116
|
+
ctx.mocked["console.error"] = jest.spyOn(console, "error").mockImplementation(() => {
|
|
117
|
+
});
|
|
118
|
+
ctx.mocked["console.log"] = jest.spyOn(console, "log").mockImplementation(() => {
|
|
119
|
+
});
|
|
120
|
+
ctx.mocked["console.info"] = jest.spyOn(console, "info").mockImplementation(() => {
|
|
121
|
+
});
|
|
122
|
+
ctx.mocked["console.warn"] = jest.spyOn(console, "warn").mockImplementation(() => {
|
|
123
|
+
});
|
|
124
|
+
});
|
|
125
|
+
afterEach(() => {
|
|
126
|
+
ctx.mocked["console.error"].mockRestore();
|
|
127
|
+
ctx.mocked["console.log"].mockRestore();
|
|
128
|
+
ctx.mocked["console.info"].mockRestore();
|
|
129
|
+
ctx.mocked["console.warn"].mockRestore();
|
|
130
|
+
});
|
|
131
|
+
return ctx;
|
|
132
|
+
};
|
|
133
|
+
var jestStdoutContext = ({ normalizationRules } = { normalizationRules: [] }) => (c) => {
|
|
134
|
+
const ctx = c;
|
|
135
|
+
const normalize = (text, rules) => {
|
|
136
|
+
for (const [pattern, replacement] of rules) {
|
|
137
|
+
text = text.replace(pattern, replacement);
|
|
138
|
+
}
|
|
139
|
+
return text;
|
|
140
|
+
};
|
|
141
|
+
beforeEach(() => {
|
|
142
|
+
ctx.mocked["process.stderr.write"] = jest.spyOn(process.stderr, "write").mockImplementation(() => true);
|
|
143
|
+
ctx.mocked["process.stdout.write"] = jest.spyOn(process.stdout, "write").mockImplementation(() => true);
|
|
144
|
+
ctx.normalizedCapturedStdout = () => normalize(ctx.mocked["process.stdout.write"].mock.calls.join(""), normalizationRules);
|
|
145
|
+
ctx.normalizedCapturedStderr = () => normalize(ctx.mocked["process.stderr.write"].mock.calls.join(""), normalizationRules);
|
|
146
|
+
ctx.clearCapturedStdout = () => ctx.mocked["process.stdout.write"].mockClear();
|
|
147
|
+
ctx.clearCapturedStderr = () => ctx.mocked["process.stderr.write"].mockClear();
|
|
148
|
+
});
|
|
149
|
+
afterEach(() => {
|
|
150
|
+
ctx.mocked["process.stderr.write"].mockRestore();
|
|
151
|
+
ctx.mocked["process.stdout.write"].mockRestore();
|
|
152
|
+
});
|
|
153
|
+
return ctx;
|
|
154
|
+
};
|
|
155
|
+
var processExitContext = () => (c) => {
|
|
156
|
+
const ctx = c;
|
|
157
|
+
beforeEach(() => {
|
|
158
|
+
ctx.mocked["process.exit"] = jest.spyOn(process, "exit").mockImplementation((number) => {
|
|
159
|
+
throw new Error("process.exit: " + number);
|
|
160
|
+
});
|
|
161
|
+
ctx.recordedExitCode = () => ctx.mocked["process.exit"].mock.calls[0]?.[0];
|
|
162
|
+
});
|
|
163
|
+
afterEach(() => {
|
|
164
|
+
ctx.mocked["process.exit"].mockRestore();
|
|
165
|
+
});
|
|
166
|
+
return ctx;
|
|
167
|
+
};
|