@prisma/cli-init 0.6.2 → 0.8.0

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/index.js CHANGED
@@ -21,7 +21,7 @@ import {
21
21
  url,
22
22
  withResolvers,
23
23
  y
24
- } from "./chunk-YTWW6A72.js";
24
+ } from "./chunk-7WBH7PZA.js";
25
25
  import {
26
26
  __commonJS,
27
27
  __require,
@@ -47,9 +47,9 @@ var require_polyfills = __commonJS({
47
47
  }
48
48
  if (typeof process.chdir === "function") {
49
49
  chdir = process.chdir;
50
- process.chdir = function(d2) {
50
+ process.chdir = function(d) {
51
51
  cwd = null;
52
- chdir.call(process, d2);
52
+ chdir.call(process, d);
53
53
  };
54
54
  if (Object.setPrototypeOf)
55
55
  Object.setPrototypeOf(process.chdir, chdir);
@@ -794,10 +794,10 @@ var require_graceful_fs = __commonJS({
794
794
  var retryTimer;
795
795
  function resetQueue() {
796
796
  var now = Date.now();
797
- for (var i = 0; i < fs5[gracefulQueue].length; ++i) {
798
- if (fs5[gracefulQueue][i].length > 2) {
799
- fs5[gracefulQueue][i][3] = now;
800
- fs5[gracefulQueue][i][4] = now;
797
+ for (var i3 = 0; i3 < fs5[gracefulQueue].length; ++i3) {
798
+ if (fs5[gracefulQueue][i3].length > 2) {
799
+ fs5[gracefulQueue][i3][3] = now;
800
+ fs5[gracefulQueue][i3][4] = now;
801
801
  }
802
802
  }
803
803
  retry();
@@ -956,8 +956,8 @@ var require_retry_operation = __commonJS({
956
956
  var counts = {};
957
957
  var mainError = null;
958
958
  var mainErrorCount = 0;
959
- for (var i = 0; i < this._errors.length; i++) {
960
- var error = this._errors[i];
959
+ for (var i3 = 0; i3 < this._errors.length; i3++) {
960
+ var error = this._errors[i3];
961
961
  var message = error.message;
962
962
  var count = (counts[message] || 0) + 1;
963
963
  counts[message] = count;
@@ -1002,14 +1002,14 @@ var require_retry = __commonJS({
1002
1002
  throw new Error("minTimeout is greater than maxTimeout");
1003
1003
  }
1004
1004
  var timeouts = [];
1005
- for (var i = 0; i < opts.retries; i++) {
1006
- timeouts.push(this.createTimeout(i, opts));
1005
+ for (var i3 = 0; i3 < opts.retries; i3++) {
1006
+ timeouts.push(this.createTimeout(i3, opts));
1007
1007
  }
1008
1008
  if (options && options.forever && !timeouts.length) {
1009
- timeouts.push(this.createTimeout(i, opts));
1009
+ timeouts.push(this.createTimeout(i3, opts));
1010
1010
  }
1011
- timeouts.sort(function(a2, b) {
1012
- return a2 - b;
1011
+ timeouts.sort(function(a, b) {
1012
+ return a - b;
1013
1013
  });
1014
1014
  return timeouts;
1015
1015
  };
@@ -1032,8 +1032,8 @@ var require_retry = __commonJS({
1032
1032
  }
1033
1033
  }
1034
1034
  }
1035
- for (var i = 0; i < methods.length; i++) {
1036
- var method = methods[i];
1035
+ for (var i3 = 0; i3 < methods.length; i3++) {
1036
+ var method = methods[i3];
1037
1037
  var original = obj[method];
1038
1038
  obj[method] = function retryWrapper(original2) {
1039
1039
  var op = exports.operation(options);
@@ -1532,7 +1532,7 @@ var require_lockfile = __commonJS({
1532
1532
  const options = locks[file].options;
1533
1533
  try {
1534
1534
  options.fs.rmdirSync(getLockFile(file, options));
1535
- } catch (e) {
1535
+ } catch (e2) {
1536
1536
  }
1537
1537
  }
1538
1538
  });
@@ -1653,7 +1653,7 @@ function normalizeWindowsPath(input2 = "") {
1653
1653
  if (!input2) {
1654
1654
  return input2;
1655
1655
  }
1656
- return input2.replace(/\\/g, "/").replace(_DRIVE_LETTER_START_RE, (r) => r.toUpperCase());
1656
+ return input2.replace(/\\/g, "/").replace(_DRIVE_LETTER_START_RE, (r4) => r4.toUpperCase());
1657
1657
  }
1658
1658
  var _UNC_REGEX = /^[/\\]{2}/;
1659
1659
  var _IS_ABSOLUTE_RE = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/;
@@ -1788,9 +1788,9 @@ function filename(path6) {
1788
1788
  return base.slice(0, separatorIndex);
1789
1789
  }
1790
1790
 
1791
- // ../../node_modules/.pnpm/get-port-please@3.1.2/node_modules/get-port-please/dist/index.mjs
1792
- import { createServer } from "net";
1793
- import { networkInterfaces } from "os";
1791
+ // ../../node_modules/.pnpm/get-port-please@3.2.0/node_modules/get-port-please/dist/index.mjs
1792
+ import { createServer, Server } from "net";
1793
+ import { networkInterfaces, tmpdir } from "os";
1794
1794
  var unsafePorts = /* @__PURE__ */ new Set([
1795
1795
  1,
1796
1796
  // tcpmux
@@ -1959,18 +1959,12 @@ function isUnsafePort(port) {
1959
1959
  function isSafePort(port) {
1960
1960
  return !isUnsafePort(port);
1961
1961
  }
1962
- var __defProp = Object.defineProperty;
1963
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1964
- var __publicField = (obj, key, value) => {
1965
- __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
1966
- return value;
1967
- };
1968
1962
  var GetPortError = class extends Error {
1969
1963
  constructor(message, opts) {
1970
1964
  super(message, opts);
1971
1965
  this.message = message;
1972
- __publicField(this, "name", "GetPortError");
1973
1966
  }
1967
+ name = "GetPortError";
1974
1968
  };
1975
1969
  function _log(verbose, message) {
1976
1970
  if (verbose) {
@@ -1981,11 +1975,11 @@ function _generateRange(from, to) {
1981
1975
  if (to < from) {
1982
1976
  return [];
1983
1977
  }
1984
- const r = [];
1978
+ const r4 = [];
1985
1979
  for (let index = from; index <= to; index++) {
1986
- r.push(index);
1980
+ r4.push(index);
1987
1981
  }
1988
- return r;
1982
+ return r4;
1989
1983
  }
1990
1984
  function _tryPort(port, host) {
1991
1985
  return new Promise((resolve2) => {
@@ -2006,7 +2000,8 @@ function _getLocalHosts(additional) {
2006
2000
  const hosts = new Set(additional);
2007
2001
  for (const _interface of Object.values(networkInterfaces())) {
2008
2002
  for (const config of _interface || []) {
2009
- if (config.address && !config.internal && !config.address.startsWith("fe80::")) {
2003
+ if (config.address && !config.internal && !config.address.startsWith("fe80::") && // Link-Local
2004
+ !config.address.startsWith("169.254")) {
2010
2005
  hosts.add(config.address);
2011
2006
  }
2012
2007
  }
@@ -2015,9 +2010,9 @@ function _getLocalHosts(additional) {
2015
2010
  }
2016
2011
  async function _findPort(ports, host) {
2017
2012
  for (const port of ports) {
2018
- const r = await _tryPort(port, host);
2019
- if (r) {
2020
- return r;
2013
+ const r4 = await _tryPort(port, host);
2014
+ if (r4) {
2015
+ return r4;
2021
2016
  }
2022
2017
  }
2023
2018
  }
@@ -2047,7 +2042,6 @@ async function getPort(_userOptions = {}) {
2047
2042
  _userOptions.port || _userOptions.ports?.length || _userOptions.portRange?.length
2048
2043
  );
2049
2044
  const options = {
2050
- name: "default",
2051
2045
  random: _port === 0,
2052
2046
  ports: [],
2053
2047
  portRange: [],
@@ -2151,118 +2145,118 @@ async function checkPort(port, host = process.env.HOST, verbose) {
2151
2145
  return port;
2152
2146
  }
2153
2147
 
2154
- // ../../node_modules/.pnpm/remeda@2.21.3/node_modules/remeda/dist/chunk-ANXBDSUI.js
2155
- var s = { done: false, hasNext: false };
2156
- var o = (t) => ({ hasNext: true, next: t, done: false });
2148
+ // ../../node_modules/.pnpm/remeda@2.32.0/node_modules/remeda/dist/lazyDataLastImpl-BDhrIOwR.js
2149
+ function e(e2, t6, n3) {
2150
+ let r4 = (n4) => e2(n4, ...t6);
2151
+ return n3 === void 0 ? r4 : Object.assign(r4, { lazy: n3, lazyArgs: t6 });
2152
+ }
2153
+
2154
+ // ../../node_modules/.pnpm/remeda@2.32.0/node_modules/remeda/dist/purry-DH9cw9sy.js
2155
+ function t(t6, n3, r4) {
2156
+ let i3 = t6.length - n3.length;
2157
+ if (i3 === 0)
2158
+ return t6(...n3);
2159
+ if (i3 === 1)
2160
+ return e(t6, n3, r4);
2161
+ throw Error(`Wrong number of arguments`);
2162
+ }
2163
+
2164
+ // ../../node_modules/.pnpm/remeda@2.32.0/node_modules/remeda/dist/utilityEvaluators-DORpnx39.js
2165
+ var t2 = { done: false, hasNext: false };
2166
+ var r = (e2) => ({ hasNext: true, next: e2, done: false });
2157
2167
 
2158
- // ../../node_modules/.pnpm/remeda@2.21.3/node_modules/remeda/dist/chunk-3GOCSNFN.js
2159
- function C(t, ...o3) {
2160
- let n = t, u3 = o3.map((e) => "lazy" in e ? y2(e) : void 0), p = 0;
2161
- for (; p < o3.length; ) {
2162
- if (u3[p] === void 0 || !B(n)) {
2163
- let i = o3[p];
2164
- n = i(n), p += 1;
2168
+ // ../../node_modules/.pnpm/remeda@2.32.0/node_modules/remeda/dist/pipe-jLehR9-P.js
2169
+ function t3(e2, ...t6) {
2170
+ let a = e2, o = t6.map((e3) => `lazy` in e3 ? r2(e3) : void 0), s = 0;
2171
+ for (; s < t6.length; ) {
2172
+ if (o[s] === void 0 || !i(a)) {
2173
+ let e4 = t6[s];
2174
+ a = e4(a), s += 1;
2165
2175
  continue;
2166
2176
  }
2167
- let r = [];
2168
- for (let i = p; i < o3.length; i++) {
2169
- let l = u3[i];
2170
- if (l === void 0 || (r.push(l), l.isSingle))
2177
+ let e3 = [];
2178
+ for (let n3 = s; n3 < t6.length; n3++) {
2179
+ let t7 = o[n3];
2180
+ if (t7 === void 0 || (e3.push(t7), t7.isSingle))
2171
2181
  break;
2172
2182
  }
2173
- let a2 = [];
2174
- for (let i of n)
2175
- if (f(i, a2, r))
2183
+ let r4 = [];
2184
+ for (let t7 of a)
2185
+ if (n(t7, r4, e3))
2176
2186
  break;
2177
- let { isSingle: s2 } = r.at(-1);
2178
- n = s2 ? a2[0] : a2, p += r.length;
2187
+ let { isSingle: c } = e3.at(-1);
2188
+ a = c ? r4[0] : r4, s += e3.length;
2179
2189
  }
2180
- return n;
2190
+ return a;
2181
2191
  }
2182
- function f(t, o3, n) {
2183
- if (n.length === 0)
2184
- return o3.push(t), false;
2185
- let u3 = t, p = s, e = false;
2186
- for (let [r, a2] of n.entries()) {
2187
- let { index: s2, items: i } = a2;
2188
- if (i.push(u3), p = a2(u3, s2, i), a2.index += 1, p.hasNext) {
2189
- if (p.hasMany ?? false) {
2190
- for (let l of p.next)
2191
- if (f(l, o3, n.slice(r + 1)))
2192
+ function n(t6, r4, i3) {
2193
+ if (i3.length === 0)
2194
+ return r4.push(t6), false;
2195
+ let a = t6, o = t2, s = false;
2196
+ for (let [e2, t7] of i3.entries()) {
2197
+ let { index: c, items: l } = t7;
2198
+ if (l.push(a), o = t7(a, c, l), t7.index += 1, o.hasNext) {
2199
+ if (o.hasMany ?? false) {
2200
+ for (let t8 of o.next)
2201
+ if (n(t8, r4, i3.slice(e2 + 1)))
2192
2202
  return true;
2193
- return e;
2203
+ return s;
2194
2204
  }
2195
- u3 = p.next;
2205
+ a = o.next;
2196
2206
  }
2197
- if (!p.hasNext)
2207
+ if (!o.hasNext)
2198
2208
  break;
2199
- p.done && (e = true);
2209
+ o.done && (s = true);
2200
2210
  }
2201
- return p.hasNext && o3.push(u3), e;
2211
+ return o.hasNext && r4.push(a), s;
2202
2212
  }
2203
- function y2(t) {
2204
- let { lazy: o3, lazyArgs: n } = t, u3 = o3(...n);
2205
- return Object.assign(u3, { isSingle: o3.single ?? false, index: 0, items: [] });
2213
+ function r2(e2) {
2214
+ let { lazy: t6, lazyArgs: n3 } = e2, r4 = t6(...n3);
2215
+ return Object.assign(r4, { isSingle: t6.single ?? false, index: 0, items: [] });
2206
2216
  }
2207
- function B(t) {
2208
- return typeof t == "string" || typeof t == "object" && t !== null && Symbol.iterator in t;
2217
+ function i(e2) {
2218
+ return typeof e2 == `string` || typeof e2 == `object` && !!e2 && Symbol.iterator in e2;
2209
2219
  }
2210
2220
 
2211
- // ../../node_modules/.pnpm/remeda@2.21.3/node_modules/remeda/dist/chunk-LFJW7BOT.js
2212
- function y3(t, i) {
2213
- let a2 = i.length - t.length;
2214
- if (a2 === 1) {
2215
- let [n, ...r] = i;
2216
- return C(n, { lazy: t, lazyArgs: r });
2217
- }
2218
- if (a2 === 0) {
2219
- let n = { lazy: t, lazyArgs: i };
2220
- return Object.assign((e) => C(e, n), n);
2221
- }
2222
- throw new Error("Wrong number of arguments");
2221
+ // ../../node_modules/.pnpm/remeda@2.32.0/node_modules/remeda/dist/purryFromLazy-3oywCNIb.js
2222
+ function t4(t6, n3) {
2223
+ let r4 = n3.length - t6.length;
2224
+ if (r4 === 1) {
2225
+ let [r5, ...i3] = n3;
2226
+ return t3(r5, { lazy: t6, lazyArgs: i3 });
2227
+ }
2228
+ if (r4 === 0) {
2229
+ let r5 = { lazy: t6, lazyArgs: n3 };
2230
+ return Object.assign((t7) => t3(t7, r5), r5);
2231
+ }
2232
+ throw Error(`Wrong number of arguments`);
2223
2233
  }
2224
2234
 
2225
- // ../../node_modules/.pnpm/remeda@2.21.3/node_modules/remeda/dist/chunk-D6FCK2GA.js
2226
- function u(o3, n, a2) {
2227
- let t = (r) => o3(r, ...n);
2228
- return a2 === void 0 ? t : Object.assign(t, { lazy: a2, lazyArgs: n });
2235
+ // ../../node_modules/.pnpm/remeda@2.32.0/node_modules/remeda/dist/difference-DxYg8_zs.js
2236
+ function r3(...e2) {
2237
+ return t4(i2, e2);
2229
2238
  }
2230
-
2231
- // ../../node_modules/.pnpm/remeda@2.21.3/node_modules/remeda/dist/chunk-WIMGWYZL.js
2232
- function u2(r, n, o3) {
2233
- let a2 = r.length - n.length;
2234
- if (a2 === 0)
2235
- return r(...n);
2236
- if (a2 === 1)
2237
- return u(r, n, o3);
2238
- throw new Error("Wrong number of arguments");
2239
- }
2240
-
2241
- // ../../node_modules/.pnpm/remeda@2.21.3/node_modules/remeda/dist/chunk-ENS7GPLZ.js
2242
- function a(...r) {
2243
- return u2(o2, r);
2244
- }
2245
- function o2(r, t) {
2246
- let e = [];
2247
- for (let n = r; n < t; n++)
2248
- e.push(n);
2249
- return e;
2239
+ function i2(n3) {
2240
+ if (n3.length === 0)
2241
+ return r;
2242
+ let r4 = /* @__PURE__ */ new Map();
2243
+ for (let e2 of n3)
2244
+ r4.set(e2, (r4.get(e2) ?? 0) + 1);
2245
+ return (t6) => {
2246
+ let n4 = r4.get(t6);
2247
+ return n4 === void 0 || n4 === 0 ? { done: false, hasNext: true, next: t6 } : (r4.set(t6, n4 - 1), t2);
2248
+ };
2250
2249
  }
2251
2250
 
2252
- // ../../node_modules/.pnpm/remeda@2.21.3/node_modules/remeda/dist/chunk-GKXRNLHM.js
2253
- function d(...e) {
2254
- return y3(f2, e);
2251
+ // ../../node_modules/.pnpm/remeda@2.32.0/node_modules/remeda/dist/range-amdmPz_6.js
2252
+ function t5(...t6) {
2253
+ return t(n2, t6);
2255
2254
  }
2256
- function f2(e) {
2257
- if (e.length === 0)
2258
- return o;
2259
- let n = /* @__PURE__ */ new Map();
2260
- for (let r of e)
2261
- n.set(r, (n.get(r) ?? 0) + 1);
2262
- return (r) => {
2263
- let t = n.get(r);
2264
- return t === void 0 || t === 0 ? { done: false, hasNext: true, next: r } : (n.set(r, t - 1), s);
2265
- };
2255
+ function n2(e2, t6) {
2256
+ let n3 = [];
2257
+ for (let r4 = e2; r4 < t6; r4++)
2258
+ n3.push(r4);
2259
+ return n3;
2266
2260
  }
2267
2261
 
2268
2262
  // ../../dev/server/src/port.ts
@@ -2343,7 +2337,7 @@ async function tryAnyPort(options) {
2343
2337
  ...Object.values(portsUsedByThisServerLastTime || {})
2344
2338
  ];
2345
2339
  const maximumSpecificPort = Math.min(Math.max(minimumPort, ...excludedPorts) + 100, MAX_PORT);
2346
- const ports = d(a(minimumPort, maximumSpecificPort), excludedPorts);
2340
+ const ports = r3(t5(minimumPort, maximumSpecificPort), excludedPorts);
2347
2341
  const defaultPort2 = {
2348
2342
  port: DEFAULT_SERVER_PORT,
2349
2343
  databasePort: DEFAULT_DATABASE_PORT,
@@ -2557,6 +2551,7 @@ async function getDB(dataDir, debug3) {
2557
2551
  database: BASE_PGLITE_OPTIONS.database,
2558
2552
  dataDir,
2559
2553
  debug: debug3 ? 5 : void 0,
2554
+ extensions: await getExtensions(),
2560
2555
  relaxedDurability: false,
2561
2556
  username: BASE_PGLITE_OPTIONS.username
2562
2557
  });
@@ -2567,10 +2562,63 @@ async function getShadowDB(_dataDir, debug3) {
2567
2562
  database: BASE_PGLITE_OPTIONS.database,
2568
2563
  dataDir: "memory://",
2569
2564
  debug: debug3 ? 5 : void 0,
2565
+ extensions: await getExtensions(),
2570
2566
  relaxedDurability: false,
2571
2567
  username: BASE_PGLITE_OPTIONS.username
2572
2568
  });
2573
2569
  }
2570
+ async function getExtensions() {
2571
+ const importedExtensions = await Promise.all([
2572
+ import("@electric-sql/pglite/contrib/amcheck"),
2573
+ // missing `autoinc` https://www.postgresql.org/docs/current/contrib-spi.html#CONTRIB-SPI-AUTOINC.
2574
+ import("@electric-sql/pglite/contrib/bloom"),
2575
+ import("@electric-sql/pglite/contrib/btree_gin"),
2576
+ import("@electric-sql/pglite/contrib/btree_gist"),
2577
+ import("@electric-sql/pglite/contrib/citext"),
2578
+ import("@electric-sql/pglite/contrib/cube"),
2579
+ // missing `dblink` https://www.postgresql.org/docs/current/dblink.html.
2580
+ import("@electric-sql/pglite/contrib/dict_int"),
2581
+ import("@electric-sql/pglite/contrib/dict_xsyn"),
2582
+ import("@electric-sql/pglite/contrib/earthdistance"),
2583
+ import("@electric-sql/pglite/contrib/file_fdw"),
2584
+ import("@electric-sql/pglite/contrib/fuzzystrmatch"),
2585
+ import("@electric-sql/pglite/contrib/hstore"),
2586
+ // missing `insert_username` https://www.postgresql.org/docs/current/contrib-spi.html#CONTRIB-SPI-INSERT-USERNAME.
2587
+ // missing `intagg` https://www.postgresql.org/docs/current/intagg.html.
2588
+ import("@electric-sql/pglite/contrib/intarray"),
2589
+ import("@electric-sql/pglite/contrib/isn"),
2590
+ import("@electric-sql/pglite/contrib/lo"),
2591
+ import("@electric-sql/pglite/contrib/ltree"),
2592
+ // missing `moddatetime` https://www.postgresql.org/docs/current/contrib-spi.html#CONTRIB-SPI-MODDATETIME.
2593
+ import("@electric-sql/pglite/contrib/pageinspect"),
2594
+ import("@electric-sql/pglite/contrib/pg_buffercache"),
2595
+ import("@electric-sql/pglite/contrib/pg_freespacemap"),
2596
+ // missing `pg_prewarm` https://www.postgresql.org/docs/current/pgprewarm.html.
2597
+ // missing `pg_search` https://pgxn.org/dist/pg_search.
2598
+ // missing `pg_stat_statements` https://www.postgresql.org/docs/current/pgstatstatements.html.
2599
+ import("@electric-sql/pglite/contrib/pg_surgery"),
2600
+ import("@electric-sql/pglite/contrib/pg_trgm"),
2601
+ import("@electric-sql/pglite/contrib/pg_visibility"),
2602
+ import("@electric-sql/pglite/contrib/pg_walinspect"),
2603
+ // `pgcrypto` is included by default in PGLite https://github.com/electric-sql/pglite/pull/129#issuecomment-2260439887.
2604
+ // missing `pgrowlocks` https://www.postgresql.org/docs/current/pgrowlocks.html.
2605
+ // missing `pgstattuple` https://www.postgresql.org/docs/current/pgstattuple.html.
2606
+ // `plpgsql` is included by default in PGLite https://github.com/electric-sql/pglite/blob/c00eaded4a14cdf94ab057b53c2a67674bb5f003/packages/pglite/examples/plpgsql.html#L25.
2607
+ // missing `postgres_fdw` https://www.postgresql.org/docs/current/postgres-fdw.html.
2608
+ // missing `refint` https://www.postgresql.org/docs/current/contrib-spi.html#CONTRIB-SPI-REFINT.
2609
+ import("@electric-sql/pglite/contrib/seg"),
2610
+ // missing `sslinfo` https://www.postgresql.org/docs/current/sslinfo.html.
2611
+ import("@electric-sql/pglite/contrib/tablefunc"),
2612
+ import("@electric-sql/pglite/contrib/tcn"),
2613
+ import("@electric-sql/pglite/contrib/tsm_system_rows"),
2614
+ import("@electric-sql/pglite/contrib/tsm_system_time"),
2615
+ import("@electric-sql/pglite/contrib/unaccent"),
2616
+ import("@electric-sql/pglite/contrib/uuid_ossp"),
2617
+ import("@electric-sql/pglite/vector")
2618
+ // `xml2` is included by default in PGlite https://github.com/electric-sql/pglite/pull/129#issuecomment-2260439887.
2619
+ ]);
2620
+ return Object.assign({}, ...importedExtensions);
2621
+ }
2574
2622
  async function dumpDB(options) {
2575
2623
  const { dataDir, db, debug: debug3, destinationPath } = options;
2576
2624
  const pg = db || await getDB(dataDir, debug3);
@@ -2638,7 +2686,7 @@ async function getApp(port, dbServer, serverState) {
2638
2686
  const { debug: debug3 } = serverState;
2639
2687
  const [{ Hono }, { accelerateRoute }, { utilityRoute }] = await Promise.all([
2640
2688
  import("hono/tiny"),
2641
- import("./accelerate-7HJZB2GE.js"),
2689
+ import("./accelerate-5VID4BSA.js"),
2642
2690
  import("./utility-QJR3G2JJ.js")
2643
2691
  ]);
2644
2692
  const app = new Hono();
@@ -2737,7 +2785,7 @@ var ServerState = class {
2737
2785
  this._shadowDatabasePort = options.shadowDatabasePort ?? NO_PORT;
2738
2786
  }
2739
2787
  static async createExclusively(options) {
2740
- const serverState = options?.dryRun !== true && options?.persistenceMode !== "stateless" ? new StatefulServerState(options) : new StatelessServerState(options);
2788
+ const serverState = options?.dryRun !== true && options?.persistenceMode === "stateful" ? new StatefulServerState(options) : new StatelessServerState(options);
2741
2789
  await serverState[PRIVATE_INITIALIZE_SYMBOL]();
2742
2790
  return serverState;
2743
2791
  }
@@ -2805,10 +2853,10 @@ var StatelessServerState = class extends ServerState {
2805
2853
  constructor(options) {
2806
2854
  super({
2807
2855
  ...options,
2808
- databasePort: options?.databasePort ?? DEFAULT_DATABASE_PORT,
2856
+ databasePort: options?.databasePort,
2809
2857
  persistenceMode: "stateless",
2810
- port: options?.port ?? DEFAULT_SERVER_PORT,
2811
- shadowDatabasePort: options?.shadowDatabasePort ?? DEFAULT_SHADOW_DATABASE_PORT
2858
+ port: options?.port,
2859
+ shadowDatabasePort: options?.shadowDatabasePort
2812
2860
  });
2813
2861
  }
2814
2862
  get databaseDumpPath() {
@@ -2818,6 +2866,31 @@ var StatelessServerState = class extends ServerState {
2818
2866
  return "memory://";
2819
2867
  }
2820
2868
  async [PRIVATE_INITIALIZE_SYMBOL]() {
2869
+ let servers;
2870
+ try {
2871
+ servers = await ServerState.scan({ debug: this.debug, onlyMetadata: true });
2872
+ } catch (error) {
2873
+ if (this.debug) {
2874
+ console.warn(
2875
+ `[State] failed to scan for existing servers, assuming filesystem does not exist or other reasons.`,
2876
+ error
2877
+ );
2878
+ }
2879
+ servers = [];
2880
+ }
2881
+ const ports = await pickPorts({
2882
+ debug: this.debug,
2883
+ name: this.dryRun ? this.name : "",
2884
+ requestedPorts: {
2885
+ databasePort: this.databasePort,
2886
+ port: this.port,
2887
+ shadowDatabasePort: this.shadowDatabasePort
2888
+ },
2889
+ servers
2890
+ });
2891
+ this._databasePort = ports.databasePort;
2892
+ this._port = ports.port;
2893
+ this._shadowDatabasePort = ports.shadowDatabasePort;
2821
2894
  }
2822
2895
  async close() {
2823
2896
  }
@@ -3450,8 +3523,8 @@ var GeneratedFiles = class _GeneratedFiles {
3450
3523
  yield entry;
3451
3524
  }
3452
3525
  }
3453
- format(f3) {
3454
- return new Formatter(this, f3).formatToString();
3526
+ format(f) {
3527
+ return new Formatter(this, f).formatToString();
3455
3528
  }
3456
3529
  };
3457
3530
  var Formatter = class _Formatter {
@@ -3494,8 +3567,8 @@ var FileWriter = class {
3494
3567
  fs3.writeFileSync(absPath, content, options);
3495
3568
  this.#files.add(absPath);
3496
3569
  }
3497
- format(f3) {
3498
- return this.#files.format(f3);
3570
+ format(f) {
3571
+ return this.#files.format(f);
3499
3572
  }
3500
3573
  };
3501
3574
 
@@ -3565,16 +3638,18 @@ model User {
3565
3638
  var defaultEnv = async (url2, debug3 = false, comments = true) => {
3566
3639
  if (url2 === void 0) {
3567
3640
  let created = false;
3568
- const state = await ServerState.fromServerDump({ debug: debug3 }) || (created = true, await ServerState.createExclusively({ persistenceMode: "stateful", debug: debug3 }));
3641
+ const state = await ServerState.fromServerDump({ debug: debug3 }) || (created = true, await ServerState.createExclusively({ debug: debug3, persistenceMode: "stateful" }));
3569
3642
  if (created) {
3570
3643
  await state.close();
3571
3644
  }
3572
3645
  const server = await startPrismaDevServer({
3573
3646
  databasePort: state.databasePort,
3647
+ debug: debug3,
3574
3648
  dryRun: true,
3649
+ name: state.name,
3650
+ persistenceMode: "stateful",
3575
3651
  port: state.port,
3576
- shadowDatabasePort: state.shadowDatabasePort,
3577
- debug: debug3
3652
+ shadowDatabasePort: state.shadowDatabasePort
3578
3653
  });
3579
3654
  url2 = server.ppg.url;
3580
3655
  }
@@ -3902,9 +3977,9 @@ var Init = class _Init {
3902
3977
  })
3903
3978
  })).json()
3904
3979
  ));
3905
- } catch (e) {
3980
+ } catch (e2) {
3906
3981
  spinner2.fail();
3907
- throw e;
3982
+ throw e2;
3908
3983
  }
3909
3984
  spinner2.succeed("Schema is ready");
3910
3985
  }
@@ -4033,15 +4108,15 @@ var Init = class _Init {
4033
4108
  const gitignorePath = path5.join(outputDir, ".gitignore");
4034
4109
  try {
4035
4110
  writer.write(gitignorePath, defaultGitIgnore(), { flag: "wx" });
4036
- } catch (e) {
4037
- if (e.code === "EEXIST") {
4111
+ } catch (e2) {
4112
+ if (e2.code === "EEXIST") {
4038
4113
  warnings.push(
4039
4114
  `${yellow(
4040
4115
  "warn"
4041
4116
  )} You already have a ${bold2(".gitignore file.")} Don't forget to add ${bold2(".env")} in it to not commit any private information.`
4042
4117
  );
4043
4118
  } else {
4044
- console.error("Failed to write .gitignore file, reason: ", e);
4119
+ console.error("Failed to write .gitignore file, reason: ", e2);
4045
4120
  }
4046
4121
  }
4047
4122
  const clientPathRelativeToOutputDir = path5.relative(outputDir, path5.resolve(prismaFolder, clientOutput));
@@ -4049,8 +4124,8 @@ var Init = class _Init {
4049
4124
  fs4.appendFileSync(gitignorePath, `
4050
4125
  /${clientPathRelativeToOutputDir.replaceAll(path5.sep, "/")}
4051
4126
  `);
4052
- } catch (e) {
4053
- console.error("Failed to append client path to .gitignore file, reason: ", e);
4127
+ } catch (e2) {
4128
+ console.error("Failed to append client path to .gitignore file, reason: ", e2);
4054
4129
  }
4055
4130
  const connectExistingDatabaseSteps = ` 1. Configure your DATABASE_URL in ${green2("prisma.config.ts")}
4056
4131
  2. Run ${green2(internals.getCommandWithExecutor("prisma db pull"))} to introspect your database.`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prisma/cli-init",
3
- "version": "0.6.2",
3
+ "version": "0.8.0",
4
4
  "description": "Init CLI for Prisma",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -36,7 +36,7 @@
36
36
  "tsup": "8.0.2",
37
37
  "typescript": "5.8.3",
38
38
  "vitest": "3.1.3",
39
- "@prisma/dev": "0.16.0"
39
+ "@prisma/dev": "0.17.0"
40
40
  },
41
41
  "dependencies": {
42
42
  "@inquirer/prompts": "7.3.3",