@prisma/orm-toolchain 8.0.0-rc.20-dev.1 → 8.0.0-rc.20-dev.3

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/cli.mjs CHANGED
@@ -40,7 +40,7 @@ import { applyEdits, modify, parse, printParseErrorCode } from "jsonc-parser";
40
40
  import stringWidth from "string-width";
41
41
  import { bold, createColors, cyan, cyanBright, dim, green, yellow } from "colorette";
42
42
  import { build } from "esbuild";
43
- //#region ../../../1-framework/3-tooling/cli/dist/load-config-DjVZj4AV.mjs
43
+ //#region ../../../1-framework/3-tooling/cli/dist/load-config-mbv6iQNe.mjs
44
44
  const ESCAPES = {
45
45
  "\\": "\\\\",
46
46
  " ": "\\t",
@@ -1342,104 +1342,21 @@ function createDbInitCommand(createClient) {
1342
1342
  }
1343
1343
  const dbInitCommand = createDbInitCommand(createControlClient);
1344
1344
  const SUMMARY = "Schema read successfully";
1345
- /**
1346
- * A leading keyword and the name it introduces: `<keyword> <name>`, or
1347
- * `<keyword>: <name>`. The keyword recedes and the name is the identifier.
1348
- */
1349
- function keywordThenName(label) {
1350
- const colon = label.match(/^(.+?):\s*(\S.*)$/);
1351
- if (colon?.[1] !== void 0 && colon[2] !== void 0) return [
1352
- {
1353
- text: colon[1],
1354
- tone: "muted"
1355
- },
1356
- { text: ": " },
1357
- {
1358
- text: colon[2],
1359
- tone: "identifier"
1360
- }
1361
- ];
1362
- const spaced = label.match(/^(\S.*\S|\S+)\s+(\S+)$/);
1363
- if (spaced?.[1] !== void 0 && spaced[2] !== void 0) return [
1364
- {
1365
- text: spaced[1],
1366
- tone: "muted"
1367
- },
1368
- { text: " " },
1369
- {
1370
- text: spaced[2],
1371
- tone: "identifier"
1372
- }
1373
- ];
1374
- }
1375
- /** `<name>: <detail> (<qualifier>)` — the name leads and the qualifier recedes. */
1376
- function namedDetail(label) {
1377
- const parts = label.match(/^([^:]+):\s*(.+)$/);
1378
- if (parts?.[1] === void 0 || parts[2] === void 0) return;
1379
- const [, name, rest] = parts;
1380
- const qualified = rest.match(/^([^\s(]+)\s*(\([^)]+\))$/);
1381
- if (qualified?.[1] !== void 0 && qualified[2] !== void 0) return [
1382
- {
1383
- text: name,
1384
- tone: "identifier"
1385
- },
1386
- { text: `: ${qualified[1]} ` },
1387
- {
1388
- text: qualified[2],
1389
- tone: "muted"
1390
- }
1391
- ];
1392
- return [{
1393
- text: name,
1394
- tone: "identifier"
1395
- }, { text: `: ${rest}` }];
1396
- }
1397
- /** `<name> <rest>` — the name leads and the prose behind it recedes. */
1398
- function nameThenProse(label) {
1399
- const parts = label.match(/^(\S+)\s+(\S.*)$/);
1400
- if (parts?.[1] === void 0 || parts[2] === void 0) return;
1401
- return [
1402
- {
1403
- text: parts[1],
1404
- tone: "identifier"
1405
- },
1406
- { text: " " },
1407
- {
1408
- text: parts[2],
1409
- tone: "muted"
1410
- }
1411
- ];
1345
+ const PART_TONES = {
1346
+ title: "emphasis",
1347
+ keyword: "muted",
1348
+ name: "identifier",
1349
+ detail: "muted"
1350
+ };
1351
+ function partSpan(part) {
1352
+ return part.role === void 0 ? { text: part.text } : {
1353
+ text: part.text,
1354
+ tone: PART_TONES[part.role]
1355
+ };
1412
1356
  }
1413
- /**
1414
- * What a schema node's label means, said in tones.
1415
- *
1416
- * The families phrase these labels themselves, so the shapes recognised here
1417
- * are positional (`<keyword> <name>`, `<name>: <detail>`) rather than a list of
1418
- * words: a family that renames a keyword keeps its colouring, and no family's
1419
- * vocabulary is written down in the framework layer.
1420
- */
1357
+ /** A node's label in tones, taken from the parts its family marked. */
1421
1358
  function labelSpans(node) {
1422
- switch (node.kind) {
1423
- case "root": return [{
1424
- text: node.label,
1425
- tone: "emphasis"
1426
- }];
1427
- case "collection": return [{
1428
- text: node.label,
1429
- tone: "muted"
1430
- }];
1431
- case "entity":
1432
- case "index": return keywordThenName(node.label) ?? [{
1433
- text: node.label,
1434
- tone: "identifier"
1435
- }];
1436
- case "field": return namedDetail(node.label) ?? [{ text: node.label }];
1437
- case "dependency": return nameThenProse(node.label) ?? [{
1438
- text: node.label,
1439
- tone: "identifier"
1440
- }];
1441
- default: return [{ text: node.label }];
1442
- }
1359
+ return node.labelParts.map(partSpan);
1443
1360
  }
1444
1361
  function treeNode(node) {
1445
1362
  return {
@@ -4956,22 +4873,21 @@ function prisma6SideBySideSetup(inputs) {
4956
4873
  };
4957
4874
  }
4958
4875
  /**
4959
- * Recognised pnpm error signatures that justify a fallback to npm.
4960
- *
4961
- * These patterns indicate the published artifact itself is at fault
4962
- * (a leaked `workspace:*` or `catalog:` specifier), not the user's
4963
- * environment — pnpm is faithfully reporting "I cannot resolve this
4964
- * registry version", and npm is willing to install it because npm
4965
- * doesn't care about the protocol prefix when there's a fallback range.
4966
- *
4967
- * The predicate lives on its own so both shells' `init` share one list:
4968
- * the commander command matches it against captured child stderr, the
4969
- * engine command against the stderr the package-manager capability
4970
- * returns on a failed install.
4876
+ * pnpm error codes that mean the published artifact itself is at fault (a leaked `workspace:`
4877
+ * or `catalog:` specifier), not the user's environment. npm installs such an artifact, so init
4878
+ * falls back to it. Pinned against pnpm 10.27: a leaked `workspace:` specifier reports
4879
+ * `ERR_PNPM_WORKSPACE_PKG_NOT_FOUND`, a leaked `catalog:` one
4880
+ * `ERR_PNPM_SPEC_NOT_SUPPORTED_BY_ANY_RESOLVER`. `ERR_PNPM_NO_MATCHING_VERSION` is left out: pnpm
4881
+ * reports it for a version the registry does not have, which npm cannot install either.
4882
+ */
4883
+ const FALLBACK_PNPM_ERROR_CODES = /* @__PURE__ */ new Set(["ERR_PNPM_WORKSPACE_PKG_NOT_FOUND", "ERR_PNPM_SPEC_NOT_SUPPORTED_BY_ANY_RESOLVER"]);
4884
+ const PNPM_ERROR_CODE = /\bERR_PNPM_[A-Z0-9_]+\b/g;
4885
+ /**
4886
+ * Whether pnpm's output names an error code that justifies the npm fallback. `init` reads it
4887
+ * from the output the package-manager capability returns on a failed install.
4971
4888
  */
4972
- function isRecognisedPnpmResolutionError(stderr) {
4973
- if (!stderr) return false;
4974
- return stderr.includes("ERR_PNPM_WORKSPACE_PKG_NOT_FOUND") || stderr.includes("ERR_PNPM_NO_MATCHING_VERSION") || /No matching version found for .* in the catalog/i.test(stderr) || /workspace:[^\s]+ is not a valid (version|spec)/i.test(stderr) || /catalog:[^\s]* is not a valid (version|spec)/i.test(stderr);
4889
+ function isRecognisedPnpmResolutionError(output) {
4890
+ return Array.from(output.matchAll(PNPM_ERROR_CODE), ([code]) => code).some((code) => FALLBACK_PNPM_ERROR_CODES.has(code));
4975
4891
  }
4976
4892
  function metaString(failure, key) {
4977
4893
  const value = failure.meta?.[key];
@@ -4980,7 +4896,9 @@ function metaString(failure, key) {
4980
4896
  /**
4981
4897
  * pnpm reported a specifier the published artifact leaked, which npm installs
4982
4898
  * happily. The engine redacts credentials out of the stderr it returns but
4983
- * leaves error codes alone, which is what this reads.
4899
+ * leaves error codes alone, which is what this reads. pnpm 10 prints its
4900
+ * `ERR_PNPM_*` codes on stdout, though, and the engine returns only stderr, so
4901
+ * this does not fire until the engine returns stdout as well.
4984
4902
  */
4985
4903
  function pnpmLeakedASpecifier(failure) {
4986
4904
  return metaString(failure, "manager") === "pnpm" && isRecognisedPnpmResolutionError(metaString(failure, "stderrTail"));
@@ -7122,7 +7040,7 @@ const lspCommand = defineServerCommand({
7122
7040
  } },
7123
7041
  handler: async (args, io) => {
7124
7042
  const exitCode = await withoutClientProcessIdInArgv(async () => {
7125
- const { startServer } = await import("./exports-CKgwcXbp.mjs");
7043
+ const { startServer } = await import("./exports-Dc7BjdfY.mjs");
7126
7044
  return startServer({
7127
7045
  stdin: io.stdin,
7128
7046
  stdout: io.stdout,