@prisma/orm-toolchain 8.0.0-rc.24-dev.24 → 8.0.0-rc.24-dev.25

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
@@ -44,8 +44,8 @@ import stringWidth from "string-width";
44
44
  import { bold, createColors, cyan, cyanBright, dim, green, yellow } from "colorette";
45
45
  import { isCI } from "ci-info";
46
46
  import { build } from "esbuild";
47
- //#region ../../../1-framework/3-tooling/cli/dist/cli-CXMtfH46.mjs
48
- var version = "8.0.0-rc.24-dev.24";
47
+ //#region ../../../1-framework/3-tooling/cli/dist/cli-Djh1pbUK.mjs
48
+ var version = "8.0.0-rc.24-dev.25";
49
49
  const ESCAPES = {
50
50
  "\\": "\\\\",
51
51
  " ": "\\t",
@@ -5000,63 +5000,6 @@ function prisma6SideBySideSetup(inputs) {
5000
5000
  };
5001
5001
  }
5002
5002
  /**
5003
- * pnpm error codes that mean the published artifact itself is at fault (a leaked `workspace:`
5004
- * or `catalog:` specifier), not the user's environment. npm installs such an artifact, so init
5005
- * falls back to it. Pinned against pnpm 10.27: a leaked `workspace:` specifier reports
5006
- * `ERR_PNPM_WORKSPACE_PKG_NOT_FOUND`, a leaked `catalog:` one
5007
- * `ERR_PNPM_SPEC_NOT_SUPPORTED_BY_ANY_RESOLVER`. `ERR_PNPM_NO_MATCHING_VERSION` is left out: pnpm
5008
- * reports it for a version the registry does not have, which npm cannot install either.
5009
- */
5010
- const FALLBACK_PNPM_ERROR_CODES = /* @__PURE__ */ new Set(["ERR_PNPM_WORKSPACE_PKG_NOT_FOUND", "ERR_PNPM_SPEC_NOT_SUPPORTED_BY_ANY_RESOLVER"]);
5011
- const PNPM_ERROR_CODE = /\bERR_PNPM_[A-Z0-9_]+\b/g;
5012
- /**
5013
- * Whether pnpm's output names an error code that justifies the npm fallback. `init` reads it
5014
- * from the output the package-manager capability returns on a failed install.
5015
- */
5016
- function isRecognisedPnpmResolutionError(output) {
5017
- return Array.from(output.matchAll(PNPM_ERROR_CODE), ([code]) => code).some((code) => FALLBACK_PNPM_ERROR_CODES.has(code));
5018
- }
5019
- function metaString(failure, key) {
5020
- const value = failure.meta?.[key];
5021
- return typeof value === "string" ? value : "";
5022
- }
5023
- /**
5024
- * pnpm reported a specifier the published artifact leaked, which npm installs
5025
- * happily. The engine redacts credentials out of the stderr it returns but
5026
- * leaves error codes alone, which is what this reads. pnpm 10 prints its
5027
- * `ERR_PNPM_*` codes on stdout, though, and the engine returns only stderr, so
5028
- * this does not fire until the engine returns stdout as well.
5029
- */
5030
- function pnpmLeakedASpecifier(failure) {
5031
- return metaString(failure, "manager") === "pnpm" && isRecognisedPnpmResolutionError(metaString(failure, "stderrTail"));
5032
- }
5033
- /**
5034
- * The engine redacts the stderr it hands back, and this redacts it again
5035
- * before quoting it: what the engine strips is its own business, and registry
5036
- * auth material is not all URL-shaped.
5037
- */
5038
- function fallbackWarning(failure) {
5039
- const firstLine = redactSecrets(metaString(failure, "stderrTail")).trim().split("\n")[0] ?? "";
5040
- return [
5041
- "pnpm could not install: a published Prisma ORM dependency leaked a `workspace:*` or `catalog:` specifier.",
5042
- "Falling back to npm so init can complete.",
5043
- firstLine === "" ? "" : ` pnpm error: ${firstLine}`,
5044
- "Both installs ran under npm, which writes a package-lock.json beside the pnpm lockfile — delete whichever of the two you do not want to keep.",
5045
- "Once the offending package republishes a clean version, re-run `pnpm install` to switch back."
5046
- ].filter((line) => line !== "").join("\n");
5047
- }
5048
- /** The pnpm failure the npm retry was meant to recover from, kept alongside the npm one. */
5049
- function retriedWarning(failure) {
5050
- const firstLine = redactSecrets(metaString(failure, "stderrTail")).trim().split("\n")[0] ?? "";
5051
- return ["pnpm failed first with a leaked `workspace:*` or `catalog:` specifier, so init retried with npm.", firstLine === "" ? "" : ` pnpm error: ${firstLine}`].filter((line) => line !== "").join("\n");
5052
- }
5053
- /**
5054
- * Adds the runtime and development dependencies through the engine's package
5055
- * manager. The retry is `init`'s alone: the engine spells and runs the
5056
- * command, and this decides — from the stderr it returned — that another
5057
- * manager is worth a try.
5058
- */
5059
- /**
5060
5003
  * The engine dependency spec a fresh scaffold installs. The scaffolded
5061
5004
  * `prisma.config.ts` imports `definePrismaConfig` from `@prisma/cli-engine`, and the
5062
5005
  * installed `prisma` names the exact engine version it runs against — so
@@ -5078,41 +5021,20 @@ function engineDevDependencySpec(cwd) {
5078
5021
  } catch {}
5079
5022
  return "@prisma/cli-engine@latest";
5080
5023
  }
5024
+ /**
5025
+ * Adds the runtime and development dependencies through the engine's package manager. Returns the
5026
+ * first failure it reports, or `undefined` when both installs succeed.
5027
+ */
5081
5028
  async function installProjectDependencies(ctx) {
5082
- const pair = async (manager) => {
5083
- for (const [packages, dev] of [[ctx.deps, false], [ctx.devDeps, true]]) {
5084
- if (packages.length === 0) continue;
5085
- const installed = await ctx.packages.install({
5086
- packages,
5087
- cwd: ctx.cwd,
5088
- ...dev ? { dev } : {},
5089
- ...ifDefined("manager", manager)
5090
- });
5091
- if (!installed.ok) return installed.failure;
5092
- }
5093
- };
5094
- const failure = await pair();
5095
- if (failure === void 0) return {
5096
- failure: void 0,
5097
- manager: void 0,
5098
- warnings: ctx.catalogWarnings
5099
- };
5100
- if (!pnpmLeakedASpecifier(failure)) return {
5101
- failure,
5102
- manager: void 0,
5103
- warnings: []
5104
- };
5105
- const retryFailure = await pair("npm");
5106
- if (retryFailure !== void 0) return {
5107
- failure: retryFailure,
5108
- manager: void 0,
5109
- warnings: [retriedWarning(failure)]
5110
- };
5111
- return {
5112
- failure: void 0,
5113
- manager: "npm",
5114
- warnings: [fallbackWarning(failure)]
5115
- };
5029
+ for (const [packages, dev] of [[ctx.deps, false], [ctx.devDeps, true]]) {
5030
+ if (packages.length === 0) continue;
5031
+ const installed = await ctx.packages.install({
5032
+ packages,
5033
+ cwd: ctx.cwd,
5034
+ ...dev ? { dev } : {}
5035
+ });
5036
+ if (!installed.ok) return installed.failure;
5037
+ }
5116
5038
  }
5117
5039
  const importFromProject = async (cwd, specifier) => {
5118
5040
  let resolved;
@@ -5128,13 +5050,11 @@ var Prisma7CheckInstallFailed = class extends Error {
5128
5050
  failure;
5129
5051
  target;
5130
5052
  schemaPath;
5131
- warnings;
5132
- constructor(failure, target, schemaPath, warnings) {
5053
+ constructor(failure, target, schemaPath) {
5133
5054
  super(failure.message);
5134
5055
  this.failure = failure;
5135
5056
  this.target = target;
5136
5057
  this.schemaPath = schemaPath;
5137
- this.warnings = warnings;
5138
5058
  this.name = "Prisma7CheckInstallFailed";
5139
5059
  }
5140
5060
  };
@@ -5176,20 +5096,19 @@ function createPrisma7SourceCheck(ctx) {
5176
5096
  if (ctx.install) {
5177
5097
  const deps = [packageName, "dotenv"];
5178
5098
  const declaredBefore = declaredPackages(ctx.cwd);
5179
- const outcome = await installProjectDependencies({
5099
+ const installFailure = await installProjectDependencies({
5180
5100
  packages: ctx.packages,
5181
5101
  cwd: ctx.cwd,
5182
5102
  deps,
5183
- devDeps: [],
5184
- catalogWarnings: ctx.packageManager === "pnpm" ? buildCatalogWarnings(ctx.cwd, deps) : []
5103
+ devDeps: []
5185
5104
  });
5186
- if (outcome.failure !== void 0) throw new Prisma7CheckInstallFailed(outcome.failure, target, schemaPath, outcome.warnings);
5187
- warnings.push(...outcome.warnings);
5105
+ if (installFailure !== void 0) throw new Prisma7CheckInstallFailed(installFailure, target, schemaPath);
5106
+ if (ctx.packageManager === "pnpm") warnings.push(...buildCatalogWarnings(ctx.cwd, deps));
5188
5107
  installed = deps;
5189
5108
  const newlyDeclared = deps.filter((dep) => !declaredBefore.has(dep));
5190
5109
  added = newlyDeclared.length === 0 ? void 0 : {
5191
5110
  packages: newlyDeclared,
5192
- removeCommand: formatRemoveCommand(outcome.manager ?? ctx.packageManager, newlyDeclared)
5111
+ removeCommand: formatRemoveCommand(ctx.packageManager, newlyDeclared)
5193
5112
  };
5194
5113
  }
5195
5114
  const undoable = async (step) => {
@@ -7006,7 +6925,6 @@ const createInitCommand = (injected) => defineOrmCommand({
7006
6925
  });
7007
6926
  } catch (error) {
7008
6927
  if (!(error instanceof Prisma7CheckInstallFailed)) throw error;
7009
- for (const warning of error.warnings) warn(warning);
7010
6928
  const document = {
7011
6929
  ok: true,
7012
6930
  target: outputTarget(error.target),
@@ -7127,25 +7045,23 @@ const createInitCommand = (injected) => defineOrmCommand({
7127
7045
  })));
7128
7046
  };
7129
7047
  if (inputs.install) {
7130
- const outcome = await installProjectDependencies({
7048
+ const installFailure = await installProjectDependencies({
7131
7049
  packages: ctx.packages,
7132
7050
  cwd: ctx.cwd,
7133
7051
  deps: depsToInstall,
7134
- devDeps,
7135
- catalogWarnings: packageManager === "pnpm" ? buildCatalogWarnings(ctx.cwd, [...depsToInstall, ...devDeps]) : []
7052
+ devDeps
7136
7053
  });
7137
- for (const warning of outcome.warnings) warn(warning);
7138
- if (outcome.failure !== void 0) {
7054
+ if (installFailure !== void 0) {
7139
7055
  packagesInstalled = "failed";
7140
- findings.push(installFailedFinding(outcome.failure, scaffold.filesWritten));
7056
+ findings.push(installFailedFinding(installFailure, scaffold.filesWritten));
7141
7057
  return settle(4);
7142
7058
  }
7059
+ if (packageManager === "pnpm") for (const warning of buildCatalogWarnings(ctx.cwd, [...depsToInstall, ...devDeps])) warn(warning);
7143
7060
  const engineSpec = engineDevDependencySpec(ctx.cwd);
7144
7061
  const engineInstall = await ctx.packages.install({
7145
7062
  packages: [engineSpec],
7146
7063
  dev: true,
7147
- cwd: ctx.cwd,
7148
- ...ifDefined("manager", outcome.manager)
7064
+ cwd: ctx.cwd
7149
7065
  });
7150
7066
  if (!engineInstall.ok) {
7151
7067
  packagesInstalled = "failed";