@incajs/cli 0.0.21 → 0.0.22

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.js CHANGED
@@ -3,31 +3,31 @@ import { c as t, i as n, n as r, o as i, r as a, s as o, t as s } from "./chunks
3
3
  import { i as c, n as l, r as u, t as d } from "./chunks/defaults-Ct95BSBl.js";
4
4
  import f, { existsSync as p, lstatSync as m, readFileSync as h, realpathSync as g, statSync as _, watch as v } from "node:fs";
5
5
  import y, { resolve as b } from "node:path";
6
- import * as ee from "node:util";
7
- import { parseArgs as x, styleText as S } from "node:util";
8
- import { chmod as C, cp as w, link as te, mkdir as T, readFile as E, readdir as ne, rm as D, writeFile as O } from "node:fs/promises";
9
- import { fileURLToPath as re, pathToFileURL as ie } from "node:url";
10
- import { homedir as k } from "node:os";
11
- import { createRequire as ae } from "node:module";
12
- import { spawn as oe, spawnSync as se } from "node:child_process";
13
- import { once as A } from "node:events";
14
- import ce from "node:readline";
15
- import { setTimeout as le } from "node:timers/promises";
16
- import { DevEnvironment as ue, build as de, buildErrorMessage as fe, createServer as pe } from "vite";
17
- import me from "@vitejs/plugin-vue";
18
- import { randomUUID as he } from "node:crypto";
6
+ import * as x from "node:util";
7
+ import { parseArgs as S, styleText as C } from "node:util";
8
+ import { chmod as w, cp as T, link as E, mkdir as D, readFile as O, readdir as k, rm as A, writeFile as j } from "node:fs/promises";
9
+ import { fileURLToPath as ee, pathToFileURL as te } from "node:url";
10
+ import { homedir as M } from "node:os";
11
+ import { createRequire as ne } from "node:module";
12
+ import { spawn as re, spawnSync as ie } from "node:child_process";
13
+ import { once as N } from "node:events";
14
+ import P from "node:readline";
15
+ import { setTimeout as ae } from "node:timers/promises";
16
+ import { DevEnvironment as oe, build as se, buildErrorMessage as ce, createServer as le } from "vite";
17
+ import ue from "@vitejs/plugin-vue";
18
+ import { randomUUID as de } from "node:crypto";
19
19
  //#region ../../node_modules/.pnpm/citty@0.2.2/node_modules/citty/dist/_chunks/libs/scule.mjs
20
- var ge = /\d/, _e = [
20
+ var fe = /\d/, pe = [
21
21
  "-",
22
22
  "_",
23
23
  "/",
24
24
  "."
25
25
  ];
26
- function ve(e = "") {
27
- if (!ge.test(e)) return e !== e.toLowerCase();
26
+ function me(e = "") {
27
+ if (!fe.test(e)) return e !== e.toLowerCase();
28
28
  }
29
- function ye(e, t) {
30
- let n = t ?? _e, r = [];
29
+ function he(e, t) {
30
+ let n = t ?? pe, r = [];
31
31
  if (!e || typeof e != "string") return r;
32
32
  let i = "", a, o;
33
33
  for (let t of e) {
@@ -36,7 +36,7 @@ function ye(e, t) {
36
36
  r.push(i), i = "", a = void 0;
37
37
  continue;
38
38
  }
39
- let s = ve(t);
39
+ let s = me(t);
40
40
  if (o === !1) {
41
41
  if (a === !1 && s === !0) {
42
42
  r.push(i), i = t, a = s;
@@ -52,44 +52,44 @@ function ye(e, t) {
52
52
  }
53
53
  return r.push(i), r;
54
54
  }
55
- function be(e) {
55
+ function ge(e) {
56
56
  return e ? e[0].toUpperCase() + e.slice(1) : "";
57
57
  }
58
- function xe(e) {
58
+ function _e(e) {
59
59
  return e ? e[0].toLowerCase() + e.slice(1) : "";
60
60
  }
61
- function Se(e, t) {
62
- return e ? (Array.isArray(e) ? e : ye(e)).map((e) => be(t?.normalize ? e.toLowerCase() : e)).join("") : "";
61
+ function ve(e, t) {
62
+ return e ? (Array.isArray(e) ? e : he(e)).map((e) => ge(t?.normalize ? e.toLowerCase() : e)).join("") : "";
63
63
  }
64
- function j(e, t) {
65
- return xe(Se(e || "", t));
64
+ function F(e, t) {
65
+ return _e(ve(e || "", t));
66
66
  }
67
- function Ce(e, t) {
68
- return e ? (Array.isArray(e) ? e : ye(e)).map((e) => e.toLowerCase()).join(t ?? "-") : "";
67
+ function ye(e, t) {
68
+ return e ? (Array.isArray(e) ? e : he(e)).map((e) => e.toLowerCase()).join(t ?? "-") : "";
69
69
  }
70
- function we(e) {
71
- return Ce(e || "", "_");
70
+ function be(e) {
71
+ return ye(e || "", "_");
72
72
  }
73
73
  //#endregion
74
74
  //#region ../../node_modules/.pnpm/citty@0.2.2/node_modules/citty/dist/index.mjs
75
- function M(e) {
75
+ function I(e) {
76
76
  return Array.isArray(e) ? e : e === void 0 ? [] : [e];
77
77
  }
78
- function Te(e, t = "") {
78
+ function xe(e, t = "") {
79
79
  let n = [];
80
80
  for (let t of e) for (let [e, r] of t.entries()) n[e] = Math.max(n[e] || 0, r.length);
81
81
  return e.map((e) => e.map((e, r) => t + e[r === 0 ? "padStart" : "padEnd"](n[r])).join(" ")).join("\n");
82
82
  }
83
- function N(e) {
83
+ function L(e) {
84
84
  return typeof e == "function" ? e() : e;
85
85
  }
86
- var P = class extends Error {
86
+ var R = class extends Error {
87
87
  code;
88
88
  constructor(e, t) {
89
89
  super(e), this.name = "CLIError", this.code = t;
90
90
  }
91
91
  };
92
- function Ee(e = [], t = {}) {
92
+ function Se(e = [], t = {}) {
93
93
  let n = new Set(t.boolean || []), r = new Set(t.string || []), i = t.alias || {}, a = t.default || {}, o = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map();
94
94
  for (let [e, t] of Object.entries(i)) {
95
95
  let n = t;
@@ -134,7 +134,7 @@ function Ee(e = [], t = {}) {
134
134
  }
135
135
  let m;
136
136
  try {
137
- m = x({
137
+ m = S({
138
138
  args: f,
139
139
  options: Object.keys(c).length > 0 ? c : void 0,
140
140
  allowPositionals: !0,
@@ -162,80 +162,80 @@ function Ee(e = [], t = {}) {
162
162
  for (let [e, t] of o.entries()) h[e] !== void 0 && h[t] === void 0 && (h[t] = h[e]), h[t] !== void 0 && h[e] === void 0 && (h[e] = h[t]), h[e] !== h[t] && a[t] === h[t] && (h[t] = h[e]);
163
163
  return h;
164
164
  }
165
- var De = /* @__PURE__ */ (() => {
165
+ var Ce = /* @__PURE__ */ (() => {
166
166
  let e = globalThis.process?.env ?? {};
167
167
  return e.NO_COLOR === "1" || e.TERM === "dumb" || e.TEST || e.CI;
168
- })(), F = (e, t = 39) => (n) => De ? n : `\u001B[${e}m${n}\u001B[${t}m`, I = /* @__PURE__ */ F(1, 22), L = /* @__PURE__ */ F(36), R = /* @__PURE__ */ F(90), z = /* @__PURE__ */ F(4, 24);
169
- function Oe(e, t) {
168
+ })(), z = (e, t = 39) => (n) => Ce ? n : `\u001B[${e}m${n}\u001B[${t}m`, B = /* @__PURE__ */ z(1, 22), V = /* @__PURE__ */ z(36), H = /* @__PURE__ */ z(90), U = /* @__PURE__ */ z(4, 24);
169
+ function we(e, t) {
170
170
  let n = {
171
171
  boolean: [],
172
172
  string: [],
173
173
  alias: {},
174
174
  default: {}
175
- }, r = ke(t);
175
+ }, r = Te(t);
176
176
  for (let e of r) {
177
177
  if (e.type === "positional") continue;
178
178
  e.type === "string" || e.type === "enum" ? n.string.push(e.name) : e.type === "boolean" && n.boolean.push(e.name), e.default !== void 0 && (n.default[e.name] = e.default), e.alias && (n.alias[e.name] = e.alias);
179
- let t = j(e.name), r = Ce(e.name);
179
+ let t = F(e.name), r = ye(e.name);
180
180
  if (t !== e.name || r !== e.name) {
181
- let i = M(n.alias[e.name] || []);
181
+ let i = I(n.alias[e.name] || []);
182
182
  t !== e.name && !i.includes(t) && i.push(t), r !== e.name && !i.includes(r) && i.push(r), i.length > 0 && (n.alias[e.name] = i);
183
183
  }
184
184
  }
185
- let i = Ee(e, n), [ ...a] = i._, o = new Proxy(i, { get(e, t) {
186
- return e[t] ?? e[j(t)] ?? e[Ce(t)];
185
+ let i = Se(e, n), [ ...a] = i._, o = new Proxy(i, { get(e, t) {
186
+ return e[t] ?? e[F(t)] ?? e[ye(t)];
187
187
  } });
188
188
  for (let [, e] of r.entries()) if (e.type === "positional") {
189
189
  let t = a.shift();
190
190
  if (t !== void 0) o[e.name] = t;
191
- else if (e.default === void 0 && e.required !== !1) throw new P(`Missing required positional argument: ${e.name.toUpperCase()}`, "EARG");
191
+ else if (e.default === void 0 && e.required !== !1) throw new R(`Missing required positional argument: ${e.name.toUpperCase()}`, "EARG");
192
192
  else o[e.name] = e.default;
193
193
  } else if (e.type === "enum") {
194
194
  let t = o[e.name], n = e.options || [];
195
- if (t !== void 0 && n.length > 0 && !n.includes(t)) throw new P(`Invalid value for argument: ${L(`--${e.name}`)} (${L(t)}). Expected one of: ${n.map((e) => L(e)).join(", ")}.`, "EARG");
196
- } else if (e.required && o[e.name] === void 0) throw new P(`Missing required argument: --${e.name}`, "EARG");
195
+ if (t !== void 0 && n.length > 0 && !n.includes(t)) throw new R(`Invalid value for argument: ${V(`--${e.name}`)} (${V(t)}). Expected one of: ${n.map((e) => V(e)).join(", ")}.`, "EARG");
196
+ } else if (e.required && o[e.name] === void 0) throw new R(`Missing required argument: --${e.name}`, "EARG");
197
197
  return o;
198
198
  }
199
- function ke(e) {
199
+ function Te(e) {
200
200
  let t = [];
201
201
  for (let [n, r] of Object.entries(e || {})) t.push({
202
202
  ...r,
203
203
  name: n,
204
- alias: M(r.alias)
204
+ alias: I(r.alias)
205
205
  });
206
206
  return t;
207
207
  }
208
- async function Ae(e) {
209
- return Promise.all(e.map((e) => N(e)));
208
+ async function Ee(e) {
209
+ return Promise.all(e.map((e) => L(e)));
210
210
  }
211
- function B(e) {
211
+ function W(e) {
212
212
  return e;
213
213
  }
214
- async function V(e, t) {
215
- let n = await N(e.args || {}), r = Oe(t.rawArgs, n), i = {
214
+ async function De(e, t) {
215
+ let n = await L(e.args || {}), r = we(t.rawArgs, n), i = {
216
216
  rawArgs: t.rawArgs,
217
217
  args: r,
218
218
  data: t.data,
219
219
  cmd: e
220
- }, a = await Ae(e.plugins ?? []), o, s;
220
+ }, a = await Ee(e.plugins ?? []), o, s;
221
221
  try {
222
222
  for (let e of a) await e.setup?.(i);
223
223
  typeof e.setup == "function" && await e.setup(i);
224
- let r = await N(e.subCommands);
224
+ let r = await L(e.subCommands);
225
225
  if (r && Object.keys(r).length > 0) {
226
- let i = je(t.rawArgs, n), a = t.rawArgs[i];
226
+ let i = Ae(t.rawArgs, n), a = t.rawArgs[i];
227
227
  if (a) {
228
- let e = await U(r, a);
229
- if (!e) throw new P(`Unknown command ${L(a)}`, "E_UNKNOWN_COMMAND");
230
- await V(e, { rawArgs: t.rawArgs.slice(i + 1) });
228
+ let e = await ke(r, a);
229
+ if (!e) throw new R(`Unknown command ${V(a)}`, "E_UNKNOWN_COMMAND");
230
+ await De(e, { rawArgs: t.rawArgs.slice(i + 1) });
231
231
  } else {
232
- let n = await N(e.default);
232
+ let n = await L(e.default);
233
233
  if (n) {
234
- if (e.run) throw new P("Cannot specify both 'run' and 'default' on the same command.", "E_DEFAULT_CONFLICT");
235
- let i = await U(r, n);
236
- if (!i) throw new P(`Default sub command ${L(n)} not found in subCommands.`, "E_UNKNOWN_COMMAND");
237
- await V(i, { rawArgs: t.rawArgs });
238
- } else if (!e.run) throw new P("No command specified.", "E_NO_COMMAND");
234
+ if (e.run) throw new R("Cannot specify both 'run' and 'default' on the same command.", "E_DEFAULT_CONFLICT");
235
+ let i = await ke(r, n);
236
+ if (!i) throw new R(`Default sub command ${V(n)} not found in subCommands.`, "E_UNKNOWN_COMMAND");
237
+ await De(i, { rawArgs: t.rawArgs });
238
+ } else if (!e.run) throw new R("No command specified.", "E_NO_COMMAND");
239
239
  }
240
240
  }
241
241
  typeof e.run == "function" && (o = await e.run(i));
@@ -258,138 +258,138 @@ async function V(e, t) {
258
258
  if (c.length > 1) throw Error("Multiple cleanup errors", { cause: c });
259
259
  return { result: o };
260
260
  }
261
- async function H(e, t, n) {
262
- let r = await N(e.subCommands);
261
+ async function Oe(e, t, n) {
262
+ let r = await L(e.subCommands);
263
263
  if (r && Object.keys(r).length > 0) {
264
- let n = je(t, await N(e.args || {})), i = t[n], a = await U(r, i);
265
- if (a) return H(a, t.slice(n + 1), e);
264
+ let n = Ae(t, await L(e.args || {})), i = t[n], a = await ke(r, i);
265
+ if (a) return Oe(a, t.slice(n + 1), e);
266
266
  }
267
267
  return [e, n];
268
268
  }
269
- async function U(e, t) {
270
- if (t in e) return N(e[t]);
269
+ async function ke(e, t) {
270
+ if (t in e) return L(e[t]);
271
271
  for (let n of Object.values(e)) {
272
- let e = await N(n), r = await N(e?.meta);
273
- if (r?.alias && M(r.alias).includes(t)) return e;
272
+ let e = await L(n), r = await L(e?.meta);
273
+ if (r?.alias && I(r.alias).includes(t)) return e;
274
274
  }
275
275
  }
276
- function je(e, t) {
276
+ function Ae(e, t) {
277
277
  for (let n = 0; n < e.length; n++) {
278
278
  let r = e[n];
279
279
  if (r === "--") return -1;
280
- if (r.startsWith("-")) !r.includes("=") && Me(r, t) && n++;
280
+ if (r.startsWith("-")) !r.includes("=") && je(r, t) && n++;
281
281
  else return n;
282
282
  }
283
283
  return -1;
284
284
  }
285
- function Me(e, t) {
286
- let n = e.replace(/^-{1,2}/, ""), r = j(n);
287
- for (let [e, i] of Object.entries(t)) if ((i.type === "string" || i.type === "enum") && (r === j(e) || (Array.isArray(i.alias) ? i.alias : i.alias ? [i.alias] : []).includes(n))) return !0;
285
+ function je(e, t) {
286
+ let n = e.replace(/^-{1,2}/, ""), r = F(n);
287
+ for (let [e, i] of Object.entries(t)) if ((i.type === "string" || i.type === "enum") && (r === F(e) || (Array.isArray(i.alias) ? i.alias : i.alias ? [i.alias] : []).includes(n))) return !0;
288
288
  return !1;
289
289
  }
290
- async function Ne(e, t) {
290
+ async function Me(e, t) {
291
291
  try {
292
- console.log(await Fe(e, t) + "\n");
292
+ console.log(await Pe(e, t) + "\n");
293
293
  } catch (e) {
294
294
  console.error(e);
295
295
  }
296
296
  }
297
- var Pe = /^no[-A-Z]/;
298
- async function Fe(e, t) {
299
- let n = await N(e.meta || {}), r = ke(await N(e.args || {})), i = await N(t?.meta || {}), a = `${i.name ? `${i.name} ` : ""}` + (n.name || process.argv[1]), o = [], s = [], c = [], l = [];
297
+ var Ne = /^no[-A-Z]/;
298
+ async function Pe(e, t) {
299
+ let n = await L(e.meta || {}), r = Te(await L(e.args || {})), i = await L(t?.meta || {}), a = `${i.name ? `${i.name} ` : ""}` + (n.name || process.argv[1]), o = [], s = [], c = [], l = [];
300
300
  for (let e of r) if (e.type === "positional") {
301
301
  let t = e.name.toUpperCase(), n = e.required !== !1 && e.default === void 0;
302
- s.push([L(t + Ie(e)), Le(e, n)]), l.push(n ? `<${t}>` : `[${t}]`);
302
+ s.push([V(t + Fe(e)), Ie(e, n)]), l.push(n ? `<${t}>` : `[${t}]`);
303
303
  } else {
304
- let t = e.required === !0 && e.default === void 0, n = [...(e.alias || []).map((e) => `-${e}`), `--${e.name}`].join(", ") + Ie(e);
305
- if (o.push([L(n), Le(e, t)]), e.type === "boolean" && (e.default === !0 || e.negativeDescription) && !Pe.test(e.name)) {
304
+ let t = e.required === !0 && e.default === void 0, n = [...(e.alias || []).map((e) => `-${e}`), `--${e.name}`].join(", ") + Fe(e);
305
+ if (o.push([V(n), Ie(e, t)]), e.type === "boolean" && (e.default === !0 || e.negativeDescription) && !Ne.test(e.name)) {
306
306
  let n = [...(e.alias || []).map((e) => `--no-${e}`), `--no-${e.name}`].join(", ");
307
- o.push([L(n), [e.negativeDescription, t ? R("(Required)") : ""].filter(Boolean).join(" ")]);
307
+ o.push([V(n), [e.negativeDescription, t ? H("(Required)") : ""].filter(Boolean).join(" ")]);
308
308
  }
309
- t && l.push(`--${e.name}` + Ie(e));
309
+ t && l.push(`--${e.name}` + Fe(e));
310
310
  }
311
311
  if (e.subCommands) {
312
- let t = [], n = await N(e.subCommands);
312
+ let t = [], n = await L(e.subCommands);
313
313
  for (let [e, r] of Object.entries(n)) {
314
- let n = await N((await N(r))?.meta);
314
+ let n = await L((await L(r))?.meta);
315
315
  if (n?.hidden) continue;
316
- let i = M(n?.alias), a = [e, ...i].join(", ");
317
- c.push([L(a), n?.description || ""]), t.push(e, ...i);
316
+ let i = I(n?.alias), a = [e, ...i].join(", ");
317
+ c.push([V(a), n?.description || ""]), t.push(e, ...i);
318
318
  }
319
319
  l.push(t.join("|"));
320
320
  }
321
321
  let u = [], d = n.version || i.version;
322
- u.push(R(`${n.description} (${a + (d ? ` v${d}` : "")})`), "");
322
+ u.push(H(`${n.description} (${a + (d ? ` v${d}` : "")})`), "");
323
323
  let f = o.length > 0 || s.length > 0;
324
- return u.push(`${z(I("USAGE"))} ${L(`${a}${f ? " [OPTIONS]" : ""} ${l.join(" ")}`)}`, ""), s.length > 0 && (u.push(z(I("ARGUMENTS")), ""), u.push(Te(s, " ")), u.push("")), o.length > 0 && (u.push(z(I("OPTIONS")), ""), u.push(Te(o, " ")), u.push("")), c.length > 0 && (u.push(z(I("COMMANDS")), ""), u.push(Te(c, " ")), u.push("", `Use ${L(`${a} <command> --help`)} for more information about a command.`)), u.filter((e) => typeof e == "string").join("\n");
324
+ return u.push(`${U(B("USAGE"))} ${V(`${a}${f ? " [OPTIONS]" : ""} ${l.join(" ")}`)}`, ""), s.length > 0 && (u.push(U(B("ARGUMENTS")), ""), u.push(xe(s, " ")), u.push("")), o.length > 0 && (u.push(U(B("OPTIONS")), ""), u.push(xe(o, " ")), u.push("")), c.length > 0 && (u.push(U(B("COMMANDS")), ""), u.push(xe(c, " ")), u.push("", `Use ${V(`${a} <command> --help`)} for more information about a command.`)), u.filter((e) => typeof e == "string").join("\n");
325
325
  }
326
- function Ie(e) {
327
- let t = e.valueHint ? `=<${e.valueHint}>` : "", n = t || `=<${we(e.name)}>`;
326
+ function Fe(e) {
327
+ let t = e.valueHint ? `=<${e.valueHint}>` : "", n = t || `=<${be(e.name)}>`;
328
328
  return !e.type || e.type === "positional" || e.type === "boolean" ? t : e.type === "enum" && e.options?.length ? `=<${e.options.join("|")}>` : n;
329
329
  }
330
- function Le(e, t) {
331
- let n = t ? R("(Required)") : "", r = e.default === void 0 ? "" : R(`(Default: ${e.default})`);
330
+ function Ie(e, t) {
331
+ let n = t ? H("(Required)") : "", r = e.default === void 0 ? "" : H(`(Default: ${e.default})`);
332
332
  return [
333
333
  e.description,
334
334
  n,
335
335
  r
336
336
  ].filter(Boolean).join(" ");
337
337
  }
338
- async function Re(e, t = {}) {
339
- let n = t.rawArgs || process.argv.slice(2), r = t.showUsage || Ne;
338
+ async function Le(e, t = {}) {
339
+ let n = t.rawArgs || process.argv.slice(2), r = t.showUsage || Me;
340
340
  try {
341
- let t = await ze(e);
342
- if (t.help.length > 0 && n.some((e) => t.help.includes(e))) await r(...await H(e, n)), process.exit(0);
341
+ let t = await Re(e);
342
+ if (t.help.length > 0 && n.some((e) => t.help.includes(e))) await r(...await Oe(e, n)), process.exit(0);
343
343
  else if (n.length === 1 && t.version.includes(n[0])) {
344
344
  let t = typeof e.meta == "function" ? await e.meta() : await e.meta;
345
- if (!t?.version) throw new P("No version specified", "E_NO_VERSION");
345
+ if (!t?.version) throw new R("No version specified", "E_NO_VERSION");
346
346
  console.log(t.version);
347
- } else await V(e, { rawArgs: n });
347
+ } else await De(e, { rawArgs: n });
348
348
  } catch (t) {
349
- t instanceof P ? (await r(...await H(e, n)), console.error(t.message)) : console.error(t, "\n"), process.exit(1);
349
+ t instanceof R ? (await r(...await Oe(e, n)), console.error(t.message)) : console.error(t, "\n"), process.exit(1);
350
350
  }
351
351
  }
352
- async function ze(e) {
353
- let t = await N(e.args || {}), n = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set();
352
+ async function Re(e) {
353
+ let t = await L(e.args || {}), n = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set();
354
354
  for (let [e, i] of Object.entries(t)) {
355
355
  n.add(e);
356
- for (let e of M(i.alias)) r.add(e);
356
+ for (let e of I(i.alias)) r.add(e);
357
357
  }
358
358
  return {
359
- help: Be("help", "h", n, r),
360
- version: Be("version", "v", n, r)
359
+ help: ze("help", "h", n, r),
360
+ version: ze("version", "v", n, r)
361
361
  };
362
362
  }
363
- function Be(e, t, n, r) {
363
+ function ze(e, t, n, r) {
364
364
  return n.has(e) || r.has(e) ? [] : n.has(t) || r.has(t) ? [`--${e}`] : [`--${e}`, `-${t}`];
365
365
  }
366
366
  //#endregion
367
367
  //#region package.json
368
- var Ve = "0.0.21", He = "Commands to develop, bundle, and package Incarnative.js apps.";
368
+ var Be = "0.0.22", Ve = "Commands to develop, bundle, and package Incarnative.js apps.";
369
369
  //#endregion
370
370
  //#region ../../node_modules/.pnpm/rc9@3.1.0/node_modules/rc9/dist/_chunks/libs/flat.mjs
371
- function Ue(e) {
371
+ function He(e) {
372
372
  return e && e.constructor && typeof e.constructor.isBuffer == "function" && e.constructor.isBuffer(e);
373
373
  }
374
- function We(e) {
374
+ function Ue(e) {
375
375
  return e;
376
376
  }
377
- function Ge(e, t) {
377
+ function We(e, t) {
378
378
  t ||= {};
379
- let n = t.delimiter || ".", r = t.maxDepth, i = t.transformKey || We, a = {};
379
+ let n = t.delimiter || ".", r = t.maxDepth, i = t.transformKey || Ue, a = {};
380
380
  function o(e, s, c) {
381
381
  c ||= 1, Object.keys(e).forEach(function(l) {
382
- let u = e[l], d = t.safe && Array.isArray(u), f = Object.prototype.toString.call(u), p = Ue(u), m = f === "[object Object]" || f === "[object Array]", h = s ? s + n + i(l) : i(l);
382
+ let u = e[l], d = t.safe && Array.isArray(u), f = Object.prototype.toString.call(u), p = He(u), m = f === "[object Object]" || f === "[object Array]", h = s ? s + n + i(l) : i(l);
383
383
  if (!d && !p && m && Object.keys(u).length && (!t.maxDepth || c < r)) return o(u, h, c + 1);
384
384
  a[h] = u;
385
385
  });
386
386
  }
387
387
  return o(e), a;
388
388
  }
389
- function Ke(e, t) {
389
+ function Ge(e, t) {
390
390
  t ||= {};
391
- let n = t.delimiter || ".", r = t.overwrite || !1, i = t.transformKey || We, a = {};
392
- if (Ue(e) || Object.prototype.toString.call(e) !== "[object Object]") return e;
391
+ let n = t.delimiter || ".", r = t.overwrite || !1, i = t.transformKey || Ue, a = {};
392
+ if (He(e) || Object.prototype.toString.call(e) !== "[object Object]") return e;
393
393
  function o(e) {
394
394
  let n = Number(e);
395
395
  return isNaN(n) || e.indexOf(".") !== -1 || t.object ? e : n;
@@ -407,7 +407,7 @@ function Ke(e, t) {
407
407
  }
408
408
  return e = Object.keys(e).reduce(function(n, r) {
409
409
  let i = Object.prototype.toString.call(e[r]);
410
- return i !== "[object Object]" && i !== "[object Array]" || c(e[r]) ? (n[r] = e[r], n) : s(r, n, Ge(e[r], t));
410
+ return i !== "[object Object]" && i !== "[object Array]" || c(e[r]) ? (n[r] = e[r], n) : s(r, n, We(e[r], t));
411
411
  }, {}), Object.keys(e).forEach(function(s) {
412
412
  let c = s.split(n).map(i), l = o(c.shift()), u = o(c[0]), d = a;
413
413
  for (; u !== void 0;) {
@@ -416,20 +416,20 @@ function Ke(e, t) {
416
416
  if (!r && !n && d[l] !== void 0) return;
417
417
  (r && !n || !r && d[l] == null) && (d[l] = typeof u == "number" && !t.object ? [] : {}), d = d[l], c.length > 0 && (l = o(c.shift()), u = o(c[0]));
418
418
  }
419
- d[l] = Ke(e[s], t);
419
+ d[l] = Ge(e[s], t);
420
420
  }), a;
421
421
  }
422
422
  //#endregion
423
423
  //#region ../../node_modules/.pnpm/destr@2.0.5/node_modules/destr/dist/index.mjs
424
- var qe = /"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/, Je = /"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/, Ye = /^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/;
425
- function Xe(e, t) {
426
- if (e === "__proto__" || e === "constructor" && t && typeof t == "object" && "prototype" in t) Ze(e);
424
+ var Ke = /"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/, qe = /"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/, Je = /^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/;
425
+ function Ye(e, t) {
426
+ if (e === "__proto__" || e === "constructor" && t && typeof t == "object" && "prototype" in t) Xe(e);
427
427
  else return t;
428
428
  }
429
- function Ze(e) {
429
+ function Xe(e) {
430
430
  console.warn(`[destr] Dropping "${e}" key to prevent prototype pollution.`);
431
431
  }
432
- function Qe(e, t = {}) {
432
+ function Ze(e, t = {}) {
433
433
  if (typeof e != "string") return e;
434
434
  if (e[0] === "\"" && e[e.length - 1] === "\"" && e.indexOf("\\") === -1) return e.slice(1, -1);
435
435
  let n = e.trim();
@@ -442,14 +442,14 @@ function Qe(e, t = {}) {
442
442
  case "infinity": return Infinity;
443
443
  case "-infinity": return -Infinity;
444
444
  }
445
- if (!Ye.test(e)) {
445
+ if (!Je.test(e)) {
446
446
  if (t.strict) throw SyntaxError("[destr] Invalid JSON");
447
447
  return e;
448
448
  }
449
449
  try {
450
- if (qe.test(e) || Je.test(e)) {
450
+ if (Ke.test(e) || qe.test(e)) {
451
451
  if (t.strict) throw Error("[destr] Possible prototype pollution");
452
- return JSON.parse(e, Xe);
452
+ return JSON.parse(e, Ye);
453
453
  }
454
454
  return JSON.parse(e);
455
455
  } catch (n) {
@@ -459,83 +459,83 @@ function Qe(e, t = {}) {
459
459
  }
460
460
  //#endregion
461
461
  //#region ../../node_modules/.pnpm/defu@6.1.7/node_modules/defu/dist/defu.mjs
462
- function $e(e) {
462
+ function Qe(e) {
463
463
  if (typeof e != "object" || !e) return !1;
464
464
  let t = Object.getPrototypeOf(e);
465
465
  return t !== null && t !== Object.prototype && Object.getPrototypeOf(t) !== null || Symbol.iterator in e ? !1 : Symbol.toStringTag in e ? Object.prototype.toString.call(e) === "[object Module]" : !0;
466
466
  }
467
- function et(e, t, n = ".", r) {
468
- if (!$e(t)) return et(e, {}, n, r);
467
+ function $e(e, t, n = ".", r) {
468
+ if (!Qe(t)) return $e(e, {}, n, r);
469
469
  let i = { ...t };
470
470
  for (let t of Object.keys(e)) {
471
471
  if (t === "__proto__" || t === "constructor") continue;
472
472
  let a = e[t];
473
- a != null && (r && r(i, t, a, n) || (i[t] = Array.isArray(a) && Array.isArray(i[t]) ? [...a, ...i[t]] : $e(a) && $e(i[t]) ? et(a, i[t], (n ? `${n}.` : "") + t.toString(), r) : a));
473
+ a != null && (r && r(i, t, a, n) || (i[t] = Array.isArray(a) && Array.isArray(i[t]) ? [...a, ...i[t]] : Qe(a) && Qe(i[t]) ? $e(a, i[t], (n ? `${n}.` : "") + t.toString(), r) : a));
474
474
  }
475
475
  return i;
476
476
  }
477
- function tt(e) {
478
- return (...t) => t.reduce((t, n) => et(t, n, "", e), {});
477
+ function et(e) {
478
+ return (...t) => t.reduce((t, n) => $e(t, n, "", e), {});
479
479
  }
480
- var W = tt(), nt = /^\s*([^\s=]+)\s*=\s*(.*)?\s*$/, rt = /\n|\r|\r\n/, it = {
480
+ var G = et(), tt = /^\s*([^\s=]+)\s*=\s*(.*)?\s*$/, nt = /\n|\r|\r\n/, rt = {
481
481
  name: ".conf",
482
482
  dir: process.cwd(),
483
483
  flat: !1
484
484
  };
485
- function at(e) {
485
+ function it(e) {
486
486
  return typeof e == "string" && (e = { name: e }), {
487
- ...it,
487
+ ...rt,
488
488
  ...e
489
489
  };
490
490
  }
491
- function ot(e, t = {}) {
492
- let n = {}, r = e.split(rt);
491
+ function at(e, t = {}) {
492
+ let n = {}, r = e.split(nt);
493
493
  for (let e of r) {
494
- let t = e.match(nt);
494
+ let t = e.match(tt);
495
495
  if (!t) continue;
496
496
  let r = t[1];
497
497
  if (!r || r === "__proto__" || r === "constructor") continue;
498
- let i = Qe((t[2] || "").trim());
498
+ let i = Ze((t[2] || "").trim());
499
499
  if (r.endsWith("[]")) {
500
500
  let e = r.slice(0, Math.max(0, r.length - 2));
501
501
  n[e] = (n[e] || []).concat(i);
502
502
  } else n[r] = i;
503
503
  }
504
- return t.flat ? n : Ke(n, { overwrite: !0 });
504
+ return t.flat ? n : Ge(n, { overwrite: !0 });
505
505
  }
506
- function st(e, t) {
507
- return p(e) ? ot(h(e, "utf8"), t) : {};
506
+ function ot(e, t) {
507
+ return p(e) ? at(h(e, "utf8"), t) : {};
508
508
  }
509
- function G(e) {
510
- return e = at(e), st(b(e.dir, e.name), e);
509
+ function K(e) {
510
+ return e = it(e), ot(b(e.dir, e.name), e);
511
511
  }
512
- function ct() {
513
- return process.env.XDG_CONFIG_HOME || b(k(), ".config");
512
+ function st() {
513
+ return process.env.XDG_CONFIG_HOME || b(M(), ".config");
514
514
  }
515
- function lt(e) {
516
- return e = at(e), e.dir = ct(), G(e);
515
+ function ct(e) {
516
+ return e = it(e), e.dir = st(), K(e);
517
517
  }
518
518
  //#endregion
519
519
  //#region ../../node_modules/.pnpm/c12@4.0.0-rc.2_magicast@0.5.4/node_modules/c12/dist/index.mjs
520
- async function ut(e) {
521
- let t = e.env ?? process.env, n = await dt({
520
+ async function lt(e) {
521
+ let t = e.env ?? process.env, n = await ut({
522
522
  cwd: e.cwd,
523
523
  fileName: e.fileName ?? ".env",
524
524
  env: t,
525
525
  interpolate: e.interpolate ?? !0,
526
526
  expandFileReferences: e.expandFileReferences ?? !1,
527
527
  parse: e.parse
528
- }), r = yt(t);
528
+ }), r = vt(t);
529
529
  for (let e in n) e.startsWith("_") || (t[e] === void 0 || r.has(e)) && (t[e] = n[e]);
530
530
  return n;
531
531
  }
532
- async function dt(e) {
533
- let n = Object.create(null), r = t(e.cwd || "."), i = e.fileName || ".env", a = typeof i == "string" ? [i] : i, o = yt(e.env || {});
532
+ async function ut(e) {
533
+ let n = Object.create(null), r = t(e.cwd || "."), i = e.fileName || ".env", a = typeof i == "string" ? [i] : i, o = vt(e.env || {});
534
534
  Object.assign(n, e.env);
535
535
  for (let i of a) {
536
536
  let a = t(r, i);
537
537
  if (!_(a, { throwIfNoEntry: !1 })?.isFile()) continue;
538
- let s = await pt(a, e.parse);
538
+ let s = await ft(a, e.parse);
539
539
  for (let e in s) e in n && !o.has(e) || (n[e] = s[e], o.add(e));
540
540
  }
541
541
  if (e.expandFileReferences) {
@@ -547,21 +547,21 @@ async function dt(e) {
547
547
  }
548
548
  }
549
549
  }
550
- return e.interpolate && mt(n), n;
550
+ return e.interpolate && pt(n), n;
551
551
  }
552
- var ft = ee.parseEnv;
553
- async function pt(e, t) {
552
+ var dt = x.parseEnv;
553
+ async function ft(e, t) {
554
554
  let n = h(e, "utf8");
555
555
  if (t) return t(n);
556
- if (!ft) try {
556
+ if (!dt) try {
557
557
  let e = await import("./chunks/__vite-optional-peer-dep_dotenv_c12-CxKvRg9-.js");
558
- ft = (t) => e.parse(t);
558
+ dt = (t) => e.parse(t);
559
559
  } catch {
560
560
  throw Error("Failed to parse .env file: `node:util.parseEnv` is not available and `dotenv` package is not installed. Please upgrade your runtime, install `dotenv` as a dependency or provide a custom `parse` option.");
561
561
  }
562
- return ft(n);
562
+ return dt(n);
563
563
  }
564
- function mt(e, t = {}, n = (e) => e) {
564
+ function pt(e, t = {}, n = (e) => e) {
565
565
  function r(n) {
566
566
  return t[n] === void 0 ? e[n] : t[n];
567
567
  }
@@ -574,7 +574,7 @@ function mt(e, t = {}, n = (e) => e) {
574
574
  a += "$", o += 2;
575
575
  continue;
576
576
  }
577
- let s = n === "$" ? _t(e, o) : void 0;
577
+ let s = n === "$" ? gt(e, o) : void 0;
578
578
  if (!s) {
579
579
  a += n, o++;
580
580
  continue;
@@ -593,11 +593,11 @@ function mt(e, t = {}, n = (e) => e) {
593
593
  }
594
594
  for (let t in e) e[t] = i(r(t));
595
595
  }
596
- var ht = /\w+/y, gt = /[\w:]+/y;
597
- function _t(e, t) {
596
+ var mt = /\w+/y, ht = /[\w:]+/y;
597
+ function gt(e, t) {
598
598
  let n = t + 1, r = e[n] === "{";
599
599
  r && n++;
600
- let i = r ? gt : ht;
600
+ let i = r ? ht : mt;
601
601
  i.lastIndex = n;
602
602
  let a = i.exec(e);
603
603
  if (!a) return;
@@ -613,7 +613,7 @@ function _t(e, t) {
613
613
  if (e[n] === "-") {
614
614
  let t = "-";
615
615
  o.endsWith(":") && (o = o.slice(0, -1), t = ":-");
616
- let r = o ? vt(e, n + 1) : void 0;
616
+ let r = o ? _t(e, n + 1) : void 0;
617
617
  return r ? {
618
618
  key: o,
619
619
  operator: t,
@@ -626,7 +626,7 @@ function _t(e, t) {
626
626
  end: n
627
627
  };
628
628
  }
629
- function vt(e, t) {
629
+ function _t(e, t) {
630
630
  let n = "", r = 1;
631
631
  for (let i = t; i < e.length; i++) {
632
632
  let t = e[i];
@@ -643,18 +643,18 @@ function vt(e, t) {
643
643
  }
644
644
  }
645
645
  }
646
- function yt(e) {
646
+ function vt(e) {
647
647
  let t = globalThis.__c12_dotenv_vars__ ||= /* @__PURE__ */ new Map();
648
648
  return t.has(e) || t.set(e, /* @__PURE__ */ new Set()), t.get(e);
649
649
  }
650
- var bt = (e) => e?.replace(/\\/g, "/"), xt = 0, St = {
650
+ var yt = (e) => e?.replace(/\\/g, "/"), bt = 0, xt = {
651
651
  ".json": () => JSON.parse,
652
652
  ".yaml": () => import("./chunks/yaml-U_oPOIGK.js").then((e) => e.parseYAML),
653
653
  ".yml": () => import("./chunks/yaml-U_oPOIGK.js").then((e) => e.parseYAML),
654
654
  ".jsonc": () => import("./chunks/jsonc-BDHXk_1o.js").then((e) => e.n).then((e) => (t) => e.parseJSONC(t, { allowTrailingComma: !0 })),
655
655
  ".json5": () => import("./chunks/json5-RapVXICN.js").then((e) => e.parseJSON5),
656
656
  ".toml": () => import("./chunks/toml-CgS7wGvD.js").then((e) => e.parseTOML)
657
- }, Ct = Object.freeze([
657
+ }, St = Object.freeze([
658
658
  ".js",
659
659
  ".ts",
660
660
  ".mjs",
@@ -668,12 +668,12 @@ var bt = (e) => e?.replace(/\\/g, "/"), xt = 0, St = {
668
668
  ".yml",
669
669
  ".toml"
670
670
  ]);
671
- async function wt(e) {
671
+ async function Ct(e) {
672
672
  e.cwd = t(process.cwd(), e.cwd || "."), e.name = e.name || "config", e.envName = e.envName ?? process.env.NODE_ENV, e.configFile = e.configFile ?? (e.name === "config" ? "config" : `${e.name}.config`), e.rcFile = e.rcFile ?? `.${e.name}rc`, e.extend !== !1 && (e.extend = {
673
673
  extendKey: "extends",
674
674
  ...e.extend
675
675
  });
676
- let n = e.merger || W, r = {
676
+ let n = e.merger || G, r = {
677
677
  config: {},
678
678
  cwd: e.cwd,
679
679
  configFile: t(e.cwd, e.configFile),
@@ -686,24 +686,24 @@ async function wt(e) {
686
686
  packageJson: void 0,
687
687
  defaultConfig: e.defaultConfig
688
688
  };
689
- e.dotenv && await ut({
689
+ e.dotenv && await lt({
690
690
  cwd: e.cwd,
691
691
  ...e.dotenv === !0 ? {} : e.dotenv
692
692
  });
693
- let a = await Ot(".", e);
693
+ let a = await Dt(".", e);
694
694
  if (a.configFile && (i.main = a.config, r.configFile = a.configFile, r._configFile = a._configFile), a.meta && (r.meta = a.meta), e.rcFile) {
695
695
  let t = [];
696
- if (t.push(G({
696
+ if (t.push(K({
697
697
  name: e.rcFile,
698
698
  dir: e.cwd
699
699
  })), e.globalRc) {
700
700
  let { findWorkspaceDir: n } = await import("./chunks/dist-DrnNGO2a.js"), r = await n(e.cwd).catch(() => {});
701
- r && t.push(G({
701
+ r && t.push(K({
702
702
  name: e.rcFile,
703
703
  dir: r
704
- })), t.push(lt({ name: e.rcFile })), t.push(G({
704
+ })), t.push(ct({ name: e.rcFile })), t.push(K({
705
705
  name: e.rcFile,
706
- dir: k()
706
+ dir: M()
707
707
  }));
708
708
  }
709
709
  i.rc = n({}, ...t);
@@ -720,7 +720,7 @@ async function wt(e) {
720
720
  rawConfigs: i
721
721
  }) : t);
722
722
  }
723
- if (Array.isArray(o.main) ? r.config = o.main : (r.config = n(o.overrides, o.main, o.rc, o.packageJson, o.defaultConfig), e.extend && (await Tt(r.config, e), r.layers = r.config._layers, delete r.config._layers, r.config = n(r.config, ...r.layers.map((e) => e.config)))), r.layers = [...[
723
+ if (Array.isArray(o.main) ? r.config = o.main : (r.config = n(o.overrides, o.main, o.rc, o.packageJson, o.defaultConfig), e.extend && (await wt(r.config, e), r.layers = r.config._layers, delete r.config._layers, r.config = n(r.config, ...r.layers.map((e) => e.config)))), r.layers = [...[
724
724
  o.overrides && {
725
725
  config: o.overrides,
726
726
  configFile: void 0,
@@ -741,9 +741,9 @@ async function wt(e) {
741
741
  }
742
742
  ].filter((e) => e && e.config), ...r.layers], e.defaults && (r.config = n(r.config, e.defaults)), e.omit$Keys) for (let e in r.config) e.startsWith("$") && delete r.config[e];
743
743
  if (e.configFileRequired && !r._configFile) throw Error(`Required config (${r.configFile}) cannot be resolved.`);
744
- return e.schema != null && (r.config = await kt(r.config, e.schema)), r;
744
+ return e.schema != null && (r.config = await Ot(r.config, e.schema)), r;
745
745
  }
746
- async function Tt(e, t) {
746
+ async function wt(e, t) {
747
747
  if (e._layers = e._layers || [], !t.extend) return;
748
748
  let n = t.extend.extendKey;
749
749
  typeof n == "string" && (n = [n]);
@@ -755,34 +755,34 @@ async function Tt(e, t) {
755
755
  console.warn(`Cannot extend config from \`${JSON.stringify(r)}\` in ${t.cwd}`);
756
756
  continue;
757
757
  }
758
- let a = await Ot(n, t, i);
759
- a.config ? (await Tt(a.config, {
758
+ let a = await Dt(n, t, i);
759
+ a.config ? (await wt(a.config, {
760
760
  ...t,
761
761
  cwd: a.cwd
762
762
  }), e._layers.push(a), a.config._layers && (e._layers.push(...a.config._layers), delete a.config._layers)) : console.warn(`Cannot extend config from \`${n}\` in ${t.cwd}`);
763
763
  }
764
764
  }
765
- var Et = [
765
+ var Tt = [
766
766
  "gh:",
767
767
  "github:",
768
768
  "gitlab:",
769
769
  "bitbucket:",
770
770
  "https://",
771
771
  "http://"
772
- ], Dt = /^(@[\da-z~-][\d._a-z~-]*\/)?[\da-z~-][\d._a-z~-]*($|\/.*)/;
773
- async function Ot(e, o, s = {}) {
772
+ ], Et = /^(@[\da-z~-][\d._a-z~-]*\/)?[\da-z~-][\d._a-z~-]*($|\/.*)/;
773
+ async function Dt(e, o, s = {}) {
774
774
  if (o.resolve) {
775
775
  let t = await o.resolve(e, o);
776
776
  if (t) return t;
777
777
  }
778
- let c = o.merger || W, l = Object.keys(s.giget?.providers || {}).map((e) => `${e}:`), u = l.length > 0 ? [.../* @__PURE__ */ new Set([...l, ...Et])] : Et;
778
+ let c = o.merger || G, l = Object.keys(s.giget?.providers || {}).map((e) => `${e}:`), u = l.length > 0 ? [.../* @__PURE__ */ new Set([...l, ...Tt])] : Tt;
779
779
  if (o.giget !== !1 && u.some((t) => e.startsWith(t))) {
780
780
  let { downloadTemplate: n } = await import("./chunks/__vite-optional-peer-dep_giget_c12-BYcrHYBM.js").catch((t) => {
781
781
  throw Error(`Extending config from \`${e}\` requires \`giget\` peer dependency to be installed.\n\nInstall it with: \`npx nypm i giget\``, { cause: t });
782
782
  }), { digest: c } = await import("./chunks/ohash-Cc4pJh84.js").then((e) => e.dist_exports), l = e.replace(/\W+/g, "_").split("_").splice(0, 3).join("_") + "_" + c(e).slice(0, 10).replace(/[-_]/g, ""), u, d = t(o.cwd, "node_modules"), f = a(o.cwd);
783
- u = r(f) === ".c12" ? i(f, l) : p(d) ? i(d, ".c12", l) : process.env.XDG_CACHE_HOME ? t(process.env.XDG_CACHE_HOME, "c12", l) : t(k(), ".cache/c12", l);
784
- let m = s.install ? W(s.install === !0 ? {} : s.install, { ignoreWorkspace: !0 }) : !1;
785
- p(u) && !m && await D(u, { recursive: !0 }), e = (await n(e, {
783
+ u = r(f) === ".c12" ? i(f, l) : p(d) ? i(d, ".c12", l) : process.env.XDG_CACHE_HOME ? t(process.env.XDG_CACHE_HOME, "c12", l) : t(M(), ".cache/c12", l);
784
+ let m = s.install ? G(s.install === !0 ? {} : s.install, { ignoreWorkspace: !0 }) : !1;
785
+ p(u) && !m && await A(u, { recursive: !0 }), e = (await n(e, {
786
786
  dir: u,
787
787
  install: m,
788
788
  force: !!m,
@@ -791,8 +791,8 @@ async function Ot(e, o, s = {}) {
791
791
  ...s.giget
792
792
  })).dir;
793
793
  }
794
- Dt.test(e) && (e = K(e, o) || e);
795
- let d = n(e), f = At(t(o.cwd, e)) ?? (!d || d === r(e)), m = t(o.cwd, f ? e : a(e));
794
+ Et.test(e) && (e = q(e, o) || e);
795
+ let d = n(e), f = kt(t(o.cwd, e)) ?? (!d || d === r(e)), m = t(o.cwd, f ? e : a(e));
796
796
  f && (e = o.configFile);
797
797
  let h = {
798
798
  config: void 0,
@@ -801,22 +801,22 @@ async function Ot(e, o, s = {}) {
801
801
  source: e,
802
802
  sourceOptions: s
803
803
  };
804
- if (h.configFile = K(t(m, e), o) || K(t(m, ".config", e.replace(/\.config$/, "")), o) || K(t(m, ".config", e), o) || e, !p(h.configFile)) return h;
804
+ if (h.configFile = q(t(m, e), o) || q(t(m, ".config", e.replace(/\.config$/, "")), o) || q(t(m, ".config", e), o) || e, !p(h.configFile)) return h;
805
805
  h._configFile = h.configFile;
806
806
  let g = n(h.configFile) || "";
807
- if (g in St) h.config = (await St[g]())(await E(h.configFile, "utf8"));
807
+ if (g in xt) h.config = (await xt[g]())(await O(h.configFile, "utf8"));
808
808
  else {
809
809
  let e = o.resolveModule || ((e) => e.default || e);
810
810
  if (o.import) h.config = e(await o.import(h.configFile));
811
811
  else {
812
- let t = ie(h.configFile);
813
- t.search = `_${++xt}`, h.config = await import(t.href).then(e, async (t) => {
812
+ let t = te(h.configFile);
813
+ t.search = `_${++bt}`, h.config = await import(t.href).then(e, async (t) => {
814
814
  let { createJiti: n } = await import("./chunks/__vite-optional-peer-dep_jiti_c12-DZVJNj6v.js").catch(() => {
815
815
  throw Error(`Failed to load config file \`${h.configFile}\`: ${t?.message}. Hint install \`jiti\` for compatibility.`, { cause: t });
816
816
  }), r = n(i(o.cwd || ".", o.configFile || "/"), {
817
817
  interopDefault: !0,
818
818
  moduleCache: !1,
819
- extensions: [...Ct],
819
+ extensions: [...St],
820
820
  ...o.jitiOptions
821
821
  });
822
822
  return o.import = (e) => r.import(e), e(await o.import(h.configFile));
@@ -825,9 +825,9 @@ async function Ot(e, o, s = {}) {
825
825
  }
826
826
  typeof h.config == "function" && (h.config = await h.config(o.context)), h.config && typeof h.config == "object" && !Array.isArray(h.config) && !Object.isExtensible(h.config) && (h.config = { ...h.config });
827
827
  let _ = (Array.isArray(o.envName) ? o.envName : [o.envName]).filter(Boolean).reverse().flatMap((e) => [h.config.$env?.[e], h.config["$" + e]]).filter((e) => e && Object.keys(e).length > 0);
828
- return _.length > 0 && (h.config = (o.envMerger || c)({}, ..._, h.config)), h.meta = W(h.sourceOptions.meta, h.config.$meta), delete h.config.$meta, h.sourceOptions.overrides && (h.config = c(h.sourceOptions.overrides, h.config)), h.configFile = bt(h.configFile), h.source = bt(h.source), h;
828
+ return _.length > 0 && (h.config = (o.envMerger || c)({}, ..._, h.config)), h.meta = G(h.sourceOptions.meta, h.config.$meta), delete h.config.$meta, h.sourceOptions.overrides && (h.config = c(h.sourceOptions.overrides, h.config)), h.configFile = yt(h.configFile), h.source = yt(h.source), h;
829
829
  }
830
- async function kt(e, t) {
830
+ async function Ot(e, t) {
831
831
  if (typeof t?.["~standard"]?.validate != "function") throw TypeError("Invalid `schema` option: expected a Standard Schema (https://standardschema.dev).");
832
832
  let n = await t["~standard"].validate(e);
833
833
  if (n.issues) {
@@ -839,17 +839,17 @@ async function kt(e, t) {
839
839
  }
840
840
  return n.value;
841
841
  }
842
- function K(e, t) {
842
+ function q(e, t) {
843
843
  let n = s(e, {
844
844
  try: !0,
845
- from: ie(i(t.cwd || ".", t.configFile || "/")),
845
+ from: te(i(t.cwd || ".", t.configFile || "/")),
846
846
  suffixes: ["", "/index"],
847
- extensions: Ct,
847
+ extensions: St,
848
848
  cache: !1
849
849
  });
850
850
  return n ? o(n) : void 0;
851
851
  }
852
- function At(e) {
852
+ function kt(e) {
853
853
  try {
854
854
  return _(e).isDirectory();
855
855
  } catch {
@@ -858,94 +858,94 @@ function At(e) {
858
858
  }
859
859
  //#endregion
860
860
  //#region src/error.mts
861
- var q = class extends Error {
861
+ var J = class extends Error {
862
862
  code;
863
863
  path;
864
864
  name = "IncaError";
865
865
  constructor(e, t, n) {
866
866
  super(t), this.code = e, this.path = n;
867
867
  }
868
- }, jt = {
868
+ }, At = {
869
869
  name: "inca",
870
870
  packageJson: "inca",
871
871
  rcFile: !1,
872
872
  globalRc: !1,
873
873
  giget: !1,
874
874
  extend: !1
875
- }, Mt = /[/\\:*?"<>|\0]/;
876
- function Nt(e) {
877
- return e === e.trim() && e !== "" && e !== "." && e !== ".." && !Mt.test(e);
875
+ }, jt = /[/\\:*?"<>|\0]/;
876
+ function Mt(e) {
877
+ return e === e.trim() && e !== "" && e !== "." && e !== ".." && !jt.test(e);
878
878
  }
879
- function Pt(e) {
880
- if (!(typeof e == "string" && Nt(e))) throw new q("ERR_INCA_PRODUCT_NAME_INVALID", `${JSON.stringify(e)} can't name a directory. set a "productName" in inca.config.ts with no leading or trailing space, and none of \`/\\:*?"<>|\``);
879
+ function Nt(e) {
880
+ if (!(typeof e == "string" && Mt(e))) throw new J("ERR_INCA_PRODUCT_NAME_INVALID", `${JSON.stringify(e)} can't name a directory. set a "productName" in inca.config.ts with no leading or trailing space, and none of \`/\\:*?"<>|\``);
881
881
  }
882
- var Ft = process.platform === "darwin" || process.platform === "win32";
883
- function It(e, t) {
884
- let n = (e) => Ft ? e.toLowerCase() : e, r = y.relative(n(e), n(t));
882
+ var Pt = process.platform === "darwin" || process.platform === "win32";
883
+ function Ft(e, t) {
884
+ let n = (e) => Pt ? e.toLowerCase() : e, r = y.relative(n(e), n(t));
885
885
  return r === "" || r !== ".." && !r.startsWith(`..${y.sep}`) && !y.isAbsolute(r);
886
886
  }
887
- function Lt(e) {
887
+ function It(e) {
888
888
  let t = y.resolve(e), n = t;
889
889
  for (let e; !m(n, { throwIfNoEntry: !1 }) && (e = y.dirname(n)) !== n;) n = e;
890
890
  return y.join(g.native(n), y.relative(n, t));
891
891
  }
892
- function Rt(e, t, n) {
892
+ function Y(e, t, n) {
893
893
  let r = y.resolve(e, t), i;
894
894
  try {
895
- let t = Lt(r);
895
+ let t = It(r);
896
896
  i = [
897
897
  e,
898
898
  y.join(e, "src"),
899
899
  y.join(e, "node_modules"),
900
900
  ...n ? [n] : []
901
- ].some((e) => It(t, Lt(e)));
901
+ ].some((e) => Ft(t, It(e)));
902
902
  } catch {
903
903
  i = !0;
904
904
  }
905
- if (i) throw new q("ERR_INCA_OUT_DIR_INVALID", `"outDir" resolves to ${r}, which holds the app's own files. Set it to a directory the build can own, such as "dist"`);
905
+ if (i) throw new J("ERR_INCA_OUT_DIR_INVALID", `"outDir" resolves to ${r}, which holds the app's own files. Set it to a directory the build can own, such as "dist"`);
906
906
  }
907
- function zt(e, t, n) {
907
+ function Lt(e, t, n) {
908
908
  let r = y.resolve(e, t ?? d.outDir);
909
- return Rt(e, r, n), r;
909
+ return Y(e, r, n), r;
910
910
  }
911
- function Bt(e, t) {
911
+ function Rt(e, t) {
912
912
  try {
913
913
  return JSON.parse(e);
914
914
  } catch (e) {
915
- throw new q("ERR_INCA_PACKAGE_JSON_INVALID", `${t} holds malformed JSON: ${e.message}`, t);
915
+ throw new J("ERR_INCA_PACKAGE_JSON_INVALID", `${t} holds malformed JSON: ${e.message}`, t);
916
916
  }
917
917
  }
918
- async function Vt(e) {
919
- let { config: t, layers: n } = await wt({
918
+ async function zt(e) {
919
+ let { config: t, layers: n } = await Ct({
920
920
  cwd: e,
921
- ...jt
921
+ ...At
922
922
  }), r = n?.find((e) => e.configFile === "package.json");
923
923
  return {
924
924
  config: t,
925
925
  usedPackageJsonKey: Object.keys(r?.config ?? {}).length > 0
926
926
  };
927
927
  }
928
- async function Ht(e) {
929
- let { config: t } = await Vt(e), n = t.entry ? y.resolve(e, t.entry) : void 0;
928
+ async function Bt(e) {
929
+ let { config: t } = await zt(e), n = t.entry ? y.resolve(e, t.entry) : void 0;
930
930
  return {
931
931
  entry: n,
932
- outDir: zt(e, t.outDir, n),
932
+ outDir: Lt(e, t.outDir, n),
933
933
  sourcemap: t.sourcemap ?? d.sourcemap
934
934
  };
935
935
  }
936
- async function Ut(e) {
936
+ async function Vt(e) {
937
937
  let t = y.join(e, "package.json"), n;
938
938
  try {
939
- n = await E(t, "utf8");
939
+ n = await O(t, "utf8");
940
940
  } catch {
941
- throw new q("ERR_INCA_PACKAGE_JSON_NOT_FOUND", `no package.json found at ${t}`);
941
+ throw new J("ERR_INCA_PACKAGE_JSON_NOT_FOUND", `no package.json found at ${t}`);
942
942
  }
943
- let r = Bt(n, t), { config: i, usedPackageJsonKey: a } = await Vt(e), o = i.productName ?? u(r.name);
944
- if (!o) throw new q("ERR_INCA_PRODUCT_NAME_MISSING", `${t} needs a "name", or "productName" in inca.config.ts`);
945
- Pt(o);
943
+ let r = Rt(n, t), { config: i, usedPackageJsonKey: a } = await zt(e), o = i.productName ?? u(r.name);
944
+ if (!o) throw new J("ERR_INCA_PRODUCT_NAME_MISSING", `${t} needs a "name", or "productName" in inca.config.ts`);
945
+ Nt(o);
946
946
  let s = i.version ?? r.version ?? d.version, c = i.identifier ?? l(o), f;
947
- if (i.icon && (f = y.resolve(e, i.icon), !p(f))) throw new q("ERR_INCA_ICON_NOT_FOUND", `"icon" points to ${f}, which doesn't exist`, f);
948
- let m = i.entry ? y.resolve(e, i.entry) : void 0, h = zt(e, i.outDir, m);
947
+ if (i.icon && (f = y.resolve(e, i.icon), !p(f))) throw new J("ERR_INCA_ICON_NOT_FOUND", `"icon" points to ${f}, which doesn't exist`, f);
948
+ let m = i.entry ? y.resolve(e, i.entry) : void 0, h = Lt(e, i.outDir, m);
949
949
  return {
950
950
  productName: o,
951
951
  identifier: c,
@@ -959,16 +959,16 @@ async function Ut(e) {
959
959
  usedPackageJsonKey: a
960
960
  };
961
961
  }
962
- function Wt(e) {
962
+ function Ht(e) {
963
963
  return {
964
964
  name: e.productName,
965
965
  identifier: e.identifier,
966
966
  window: e.window
967
967
  };
968
968
  }
969
- async function Gt(e) {
970
- let { config: t } = await Vt(e), n = y.join(e, "package.json"), r = await E(n, "utf8").catch(() => void 0), i = r === void 0 ? {} : Bt(r, n), a = t.productName ?? u(i.name);
971
- a && Pt(a);
969
+ async function Ut(e) {
970
+ let { config: t } = await zt(e), n = y.join(e, "package.json"), r = await O(n, "utf8").catch(() => void 0), i = r === void 0 ? {} : Rt(r, n), a = t.productName ?? u(i.name);
971
+ a && Nt(a);
972
972
  let o = {
973
973
  name: a,
974
974
  identifier: t.identifier ?? (a ? l(a) : void 0),
@@ -978,29 +978,29 @@ async function Gt(e) {
978
978
  }
979
979
  //#endregion
980
980
  //#region src/dev-client/hostBin.mts
981
- var Kt = "INCA_HOST_BIN";
982
- function qt() {
981
+ var Wt = "INCA_HOST_BIN";
982
+ function Gt() {
983
983
  let e = process.platform === "darwin" || process.platform === "linux" ? process.platform : void 0, t = process.arch === "arm64" || process.arch === "x64" ? process.arch : void 0;
984
984
  return e && t ? `@incajs/host-${e}-${t}` : void 0;
985
985
  }
986
- function Jt() {
987
- let e = qt();
986
+ function Kt() {
987
+ let e = Gt();
988
988
  if (e) try {
989
- return ae(import.meta.url).resolve(`${e}/bin/inca-host`);
989
+ return ne(import.meta.url).resolve(`${e}/bin/inca-host`);
990
990
  } catch {
991
991
  return;
992
992
  }
993
993
  }
994
- function J() {
995
- let e = process.env[Kt];
994
+ function qt() {
995
+ let e = process.env[Wt];
996
996
  if (e) return e;
997
- let t = Jt();
997
+ let t = Kt();
998
998
  if (t) return t;
999
- let n = qt();
1000
- throw new q("ERR_INCA_HOST_BIN_UNRESOLVED", `no host binary found. ${n ? `no ${n} package is installed for it` : `this platform (${process.platform}/${process.arch}) has no published package`}, and ${Kt} isn't set to one`);
999
+ let n = Gt();
1000
+ throw new J("ERR_INCA_HOST_BIN_UNRESOLVED", `no host binary found. ${n ? `no ${n} package is installed for it` : `this platform (${process.platform}/${process.arch}) has no published package`}, and ${Wt} isn't set to one`);
1001
1001
  }
1002
- function Y(e) {
1003
- if (!_(e, { throwIfNoEntry: !1 })?.isFile()) throw new q("ERR_INCA_HOST_BIN_NOT_FOUND", `no host binary at ${e}. check that it was built`);
1002
+ function Jt(e) {
1003
+ if (!_(e, { throwIfNoEntry: !1 })?.isFile()) throw new J("ERR_INCA_HOST_BIN_NOT_FOUND", `no host binary at ${e}. check that it was built`);
1004
1004
  }
1005
1005
  //#endregion
1006
1006
  //#region src/dev-client/hostError.mts
@@ -1028,9 +1028,9 @@ var Zt = (e) => {
1028
1028
  this.#e = e;
1029
1029
  }
1030
1030
  async start() {
1031
- let e = this.#e.hostBin ?? J();
1032
- Y(e);
1033
- let t = oe(e, ["--dev", this.#e.entryFile], {
1031
+ let e = this.#e.hostBin ?? qt();
1032
+ Jt(e);
1033
+ let t = re(e, ["--dev", this.#e.entryFile], {
1034
1034
  stdio: [
1035
1035
  "pipe",
1036
1036
  "pipe",
@@ -1042,7 +1042,7 @@ var Zt = (e) => {
1042
1042
  let n = this.#e.onStderr ?? Zt;
1043
1043
  t.stderr.setEncoding("utf8"), t.stderr.on("data", (e) => n(e)), t.stdin.on("error", (e) => {
1044
1044
  e.code !== "EPIPE" && n(`host stdin: ${e.message}\n`);
1045
- }), ce.createInterface({ input: t.stdout }).on("line", (e) => {
1045
+ }), P.createInterface({ input: t.stdout }).on("line", (e) => {
1046
1046
  this.#a(e, n);
1047
1047
  }), t.on("exit", (e, t) => {
1048
1048
  let n = /* @__PURE__ */ Error(`the host exited (code=${String(e)}, signal=${String(t)}) before answering`);
@@ -1052,7 +1052,7 @@ var Zt = (e) => {
1052
1052
  let r = !1;
1053
1053
  t.on("error", (e) => {
1054
1054
  r && n(`host: ${e.message}\n`);
1055
- }), await A(t, "spawn"), r = !0;
1055
+ }), await N(t, "spawn"), r = !0;
1056
1056
  }
1057
1057
  #a(e, t) {
1058
1058
  let n;
@@ -1103,7 +1103,7 @@ var Zt = (e) => {
1103
1103
  }
1104
1104
  }
1105
1105
  async #s(e) {
1106
- let t = A(e, "exit");
1106
+ let t = N(e, "exit");
1107
1107
  e.kill(), await t;
1108
1108
  }
1109
1109
  async call(e, t, n) {
@@ -1144,8 +1144,8 @@ var Zt = (e) => {
1144
1144
  let t = this.#t;
1145
1145
  if (!t || t.exitCode !== null || t.signalCode !== null) return;
1146
1146
  this.#i = !0;
1147
- let n = A(t, "exit");
1148
- this.call("shutdown").catch(() => {}), await Promise.race([n.then(() => "exited"), le(e, void 0, { ref: !1 }).then(() => "timeout")]) === "timeout" && (t.kill(), await n);
1147
+ let n = N(t, "exit");
1148
+ this.call("shutdown").catch(() => {}), await Promise.race([n.then(() => "exited"), ae(e, void 0, { ref: !1 }).then(() => "timeout")]) === "timeout" && (t.kill(), await n);
1149
1149
  }
1150
1150
  }, en = "[inca]", tn = new Intl.DateTimeFormat(void 0, {
1151
1151
  hour: "numeric",
@@ -1153,8 +1153,8 @@ var Zt = (e) => {
1153
1153
  second: "numeric"
1154
1154
  }), X = { timestamp: !0 };
1155
1155
  function nn(e, t, n) {
1156
- let r = S(["bold", n], en, { stream: e });
1157
- return t.timestamp ? `${S("dim", tn.format(/* @__PURE__ */ new Date()), { stream: e })} ${r}` : r;
1156
+ let r = C(["bold", n], en, { stream: e });
1157
+ return t.timestamp ? `${C("dim", tn.format(/* @__PURE__ */ new Date()), { stream: e })} ${r}` : r;
1158
1158
  }
1159
1159
  function Z(e, t, n = {}) {
1160
1160
  e.write(`${nn(e, n, "cyan")} ${t}\n`);
@@ -1203,17 +1203,17 @@ function Q(e) {
1203
1203
  };
1204
1204
  }
1205
1205
  function ln(e, t) {
1206
- return e.split("\n").map((e) => /^\s*at\b/.test(e) ? S("dim", e, { stream: t }) : e).join("\n");
1206
+ return e.split("\n").map((e) => /^\s*at\b/.test(e) ? C("dim", e, { stream: t }) : e).join("\n");
1207
1207
  }
1208
1208
  function $(e, t, n, r = {}) {
1209
1209
  n.stack && e.write(`${ln(n.stack, e)}\n`);
1210
- let i = n.code ? ` (${S("bold", n.code, { stream: e })})` : "";
1210
+ let i = n.code ? ` (${C("bold", n.code, { stream: e })})` : "";
1211
1211
  e.write(`${nn(e, r, "red")} ${t}${i}: ${n.message}\n`);
1212
1212
  }
1213
1213
  //#endregion
1214
1214
  //#region src/adapterCore.mts
1215
1215
  var un = /* @__PURE__ */ e({
1216
- IncaError: () => q,
1216
+ IncaError: () => J,
1217
1217
  bundlerFault: () => cn
1218
1218
  });
1219
1219
  //#endregion
@@ -1325,7 +1325,7 @@ function Cn({ core: e, runtimeModuleName: t, entry: n, root: r = y.dirname(n), e
1325
1325
  customLogger: vn(d, f),
1326
1326
  define: { "process.env.NODE_ENV": JSON.stringify(s) },
1327
1327
  plugins: [
1328
- me({ template: { compilerOptions: {
1328
+ ue({ template: { compilerOptions: {
1329
1329
  runtimeModuleName: t,
1330
1330
  hoistStatic: !1
1331
1331
  } } }),
@@ -1356,7 +1356,7 @@ function Cn({ core: e, runtimeModuleName: t, entry: n, root: r = y.dirname(n), e
1356
1356
  //#region src/vite/build.mts
1357
1357
  async function wn(e, t, { entry: n, root: r, envDir: i, publicDir: a, outDir: o, sourcemap: s, runtimeConfig: c, stdout: l = process.stdout, stderr: u = process.stderr, quiet: d = !1 }) {
1358
1358
  let f;
1359
- if (await de(Cn({
1359
+ if (await se(Cn({
1360
1360
  core: e,
1361
1361
  runtimeModuleName: t,
1362
1362
  entry: n,
@@ -1407,7 +1407,7 @@ function Tn(e) {
1407
1407
  //#endregion
1408
1408
  //#region src/vite/hmr.mts
1409
1409
  function En(e, t) {
1410
- let n = fe(t, [], !1), r = [t.stack, n].filter((e) => e).join("\n");
1410
+ let n = ce(t, [], !1), r = [t.stack, n].filter((e) => e).join("\n");
1411
1411
  return {
1412
1412
  ...e.bundlerFault(t.message),
1413
1413
  stack: r || null
@@ -1417,7 +1417,7 @@ function Dn(e) {
1417
1417
  return y.join(e, "node_modules/.inca/hmr");
1418
1418
  }
1419
1419
  function On() {
1420
- let e = y.dirname(re(import.meta.url));
1420
+ let e = y.dirname(ee(import.meta.url));
1421
1421
  for (; !p(y.join(e, "package.json"));) {
1422
1422
  let t = y.dirname(e);
1423
1423
  if (t === e) throw Error("could not locate @incajs/cli's own package.json");
@@ -1439,7 +1439,7 @@ function jn(e) {
1439
1439
  }
1440
1440
  async function Mn(e, t, n, r) {
1441
1441
  let i = Dn(e), a = y.join(i, "entry.js"), o = kn(i, r ?? On()), s = t.split(y.sep).join("/");
1442
- return await O(a, Tn`
1442
+ return await j(a, Tn`
1443
1443
  import { start } from ${JSON.stringify(o)};
1444
1444
  await start(${JSON.stringify(s)}, ${JSON.stringify(n)});
1445
1445
  `), a;
@@ -1513,10 +1513,10 @@ function Ln(e) {
1513
1513
  };
1514
1514
  }
1515
1515
  async function Rn(e, t, { entry: n, root: r = y.dirname(n), envDir: i, publicDir: a, cwd: o, runtimeConfig: s, runtimePath: c, stdout: l = process.stdout, stderr: u = process.stderr, quiet: d = !1, notify: f, reload: p, onError: m, onUpdate: h = () => {} }) {
1516
- await T(Dn(o), { recursive: !0 });
1516
+ await D(Dn(o), { recursive: !0 });
1517
1517
  let g = mn(s), _ = y.join(Dn(o), pn);
1518
- g ? await O(_, g) : await D(_, { force: !0 });
1519
- let v = { current: void 0 }, { channel: b, dispatch: ee } = Fn(f, p, (t) => m(En(e, t)), h, v), x = await pe({
1518
+ g ? await j(_, g) : await A(_, { force: !0 });
1519
+ let v = { current: void 0 }, { channel: b, dispatch: x } = Fn(f, p, (t) => m(En(e, t)), h, v), S = await le({
1520
1520
  configFile: !1,
1521
1521
  root: r,
1522
1522
  envDir: i,
@@ -1539,14 +1539,14 @@ async function Rn(e, t, { entry: n, root: r = y.dirname(n), envDir: i, publicDir
1539
1539
  consumer: "client",
1540
1540
  dev: {
1541
1541
  moduleRunnerTransform: !0,
1542
- createEnvironment: (e, t) => new ue(e, t, {
1542
+ createEnvironment: (e, t) => new oe(e, t, {
1543
1543
  hot: !0,
1544
1544
  transport: b
1545
1545
  })
1546
1546
  }
1547
1547
  } },
1548
1548
  plugins: [
1549
- me({ template: { compilerOptions: {
1549
+ ue({ template: { compilerOptions: {
1550
1550
  runtimeModuleName: t,
1551
1551
  hoistStatic: !1
1552
1552
  } } }),
@@ -1554,22 +1554,22 @@ async function Rn(e, t, { entry: n, root: r = y.dirname(n), envDir: i, publicDir
1554
1554
  In(),
1555
1555
  Ln(v)
1556
1556
  ]
1557
- }), S;
1557
+ }), C;
1558
1558
  try {
1559
- S = await Mn(o, n, jn(x.environments.client.config.define), c);
1559
+ C = await Mn(o, n, jn(S.environments.client.config.define), c);
1560
1560
  } catch (e) {
1561
- throw await x.close(), e;
1561
+ throw await S.close(), e;
1562
1562
  }
1563
1563
  return {
1564
- entryFile: S,
1565
- dispatch: ee,
1566
- close: () => x.close()
1564
+ entryFile: C,
1565
+ dispatch: x,
1566
+ close: () => S.close()
1567
1567
  };
1568
1568
  }
1569
1569
  //#endregion
1570
1570
  //#region src/vite/watch.mts
1571
1571
  async function zn(e, t, { onBuild: n, onError: r, stdout: i = process.stdout, stderr: a = process.stderr, quiet: o = !1, ...s }) {
1572
- let { outDir: c } = s, l, u = await de(Cn({
1572
+ let { outDir: c } = s, l, u = await se(Cn({
1573
1573
  core: e,
1574
1574
  runtimeModuleName: t,
1575
1575
  ...s,
@@ -1615,18 +1615,20 @@ function Un(e) {
1615
1615
  function Wn(e, t) {
1616
1616
  return t === Un(e) ? y.join(e, "src") : y.dirname(t);
1617
1617
  }
1618
- async function Gn(e) {
1619
- let t = Hn.map((t) => y.join(e, "src", t)).find((e) => p(e));
1620
- if (t) return t;
1621
- let n = y.join(e, "src/App.vue");
1622
- if (p(n)) return Kn(n, e);
1623
- throw new q("ERR_INCA_ENTRY_NOT_FOUND", `no app entry found. check that ${y.join(e, "src/main.ts")} or ${n} exists`);
1618
+ function Gn(e) {
1619
+ return Hn.map((t) => y.join(e, "src", t)).find((e) => p(e)) || (p(y.join(e, "src/App.vue")) ? Un(e) : void 0);
1620
+ }
1621
+ async function Kn(e) {
1622
+ let t = y.join(e, "src/App.vue"), n = Gn(e);
1623
+ if (n === Un(e)) return qn(t, e);
1624
+ if (n) return n;
1625
+ throw new J("ERR_INCA_ENTRY_NOT_FOUND", `no app entry found. check that ${y.join(e, "src/main.ts")} or ${t} exists`);
1624
1626
  }
1625
- async function Kn(e, t) {
1627
+ async function qn(e, t) {
1626
1628
  let n = Un(t);
1627
- await T(y.dirname(n), { recursive: !0 });
1629
+ await D(y.dirname(n), { recursive: !0 });
1628
1630
  let r = JSON.stringify(e.split(y.sep).join("/"));
1629
- return await O(n, Tn`
1631
+ return await j(n, Tn`
1630
1632
  import { createIncaApp } from "incajs/vue";
1631
1633
  import App from ${r};
1632
1634
  createIncaApp(App).mount();
@@ -1634,10 +1636,10 @@ async function Kn(e, t) {
1634
1636
  }
1635
1637
  //#endregion
1636
1638
  //#region src/build.mts
1637
- async function qn(e = {}) {
1638
- let t = e.cwd ?? process.cwd(), n = e.config ?? await Ht(t), r = y.resolve(t, n.outDir), i = e.bundler ?? Vn, a = e.entry ?? n.entry ?? await Gn(t);
1639
- Rt(t, r, a);
1640
- let o = e.runtimeConfig ?? await Gt(t);
1639
+ async function Jn(e = {}) {
1640
+ let t = e.cwd ?? process.cwd(), n = e.config ?? await Bt(t), r = y.resolve(t, n.outDir), i = e.bundler ?? Vn, a = e.entry ?? n.entry ?? await Kn(t);
1641
+ Y(t, r, a);
1642
+ let o = e.runtimeConfig ?? await Ut(t);
1641
1643
  return i.build({
1642
1644
  entry: a,
1643
1645
  root: Wn(t, a),
@@ -1652,79 +1654,79 @@ async function qn(e = {}) {
1652
1654
  }
1653
1655
  //#endregion
1654
1656
  //#region src/devLock.mts
1655
- function Jn(e) {
1657
+ function Yn(e) {
1656
1658
  return y.join(e, "node_modules/.inca/dev.pid");
1657
1659
  }
1658
- function Yn(e) {
1660
+ function Xn(e) {
1659
1661
  try {
1660
1662
  return process.kill(e, 0), !0;
1661
1663
  } catch (e) {
1662
1664
  return e.code === "EPERM";
1663
1665
  }
1664
1666
  }
1665
- var Xn = he();
1666
- function Zn(e) {
1667
- return new q("ERR_INCA_DEV_RUNNING", `inca dev is already running for this app (pid ${String(e)})`);
1667
+ var Zn = de();
1668
+ function Qn(e) {
1669
+ return new J("ERR_INCA_DEV_RUNNING", `inca dev is already running for this app (pid ${String(e)})`);
1668
1670
  }
1669
- async function Qn(e) {
1670
- let t = Jn(e), n = `${String(process.pid)}:${Xn}`, r = `${t}.${he()}`;
1671
- await T(y.dirname(t), { recursive: !0 }), await O(r, n);
1671
+ async function $n(e) {
1672
+ let t = Yn(e), n = `${String(process.pid)}:${Zn}`, r = `${t}.${de()}`;
1673
+ await D(y.dirname(t), { recursive: !0 }), await j(r, n);
1672
1674
  let i = process.pid;
1673
1675
  try {
1674
1676
  for (let e = 0; e < 5; e++) {
1675
1677
  try {
1676
- return await te(r, t), $n(t, n);
1678
+ return await E(r, t), er(t, n);
1677
1679
  } catch (e) {
1678
1680
  if (e.code !== "EEXIST") throw e;
1679
1681
  }
1680
- let e = await E(t, "utf8").catch(() => ""), a = Number.parseInt(e, 10);
1682
+ let e = await O(t, "utf8").catch(() => ""), a = Number.parseInt(e, 10);
1681
1683
  if (a === process.pid) {
1682
- if (e === n) throw Zn(a);
1683
- } else if (Number.isSafeInteger(a) && a > 0 && Yn(a)) throw Zn(a);
1684
- i = Number.isSafeInteger(a) && a > 0 ? a : i, await D(t, { force: !0 });
1684
+ if (e === n) throw Qn(a);
1685
+ } else if (Number.isSafeInteger(a) && a > 0 && Xn(a)) throw Qn(a);
1686
+ i = Number.isSafeInteger(a) && a > 0 ? a : i, await A(t, { force: !0 });
1685
1687
  }
1686
- throw Zn(i);
1688
+ throw Qn(i);
1687
1689
  } finally {
1688
- await D(r, { force: !0 });
1690
+ await A(r, { force: !0 });
1689
1691
  }
1690
1692
  }
1691
- function $n(e, t) {
1693
+ function er(e, t) {
1692
1694
  let n = !1;
1693
1695
  return async () => {
1694
- n || (n = !0, await E(e, "utf8").catch(() => "") === t && await D(e, { force: !0 }));
1696
+ n || (n = !0, await O(e, "utf8").catch(() => "") === t && await A(e, { force: !0 }));
1695
1697
  };
1696
1698
  }
1697
1699
  //#endregion
1698
1700
  //#region src/plist.mts
1699
- function er(e) {
1700
- return e.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;");
1701
- }
1702
1701
  function tr(e) {
1703
- return typeof e == "boolean" ? e ? "<true/>" : "<false/>" : `<string>${er(e)}</string>`;
1702
+ return e.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;");
1704
1703
  }
1705
1704
  function nr(e) {
1705
+ return typeof e == "boolean" ? e ? "<true/>" : "<false/>" : `<string>${tr(e)}</string>`;
1706
+ }
1707
+ function rr(e) {
1706
1708
  return Tn`
1707
1709
  <?xml version="1.0" encoding="UTF-8"?>
1708
1710
  <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
1709
1711
  <plist version="1.0">
1710
1712
  <dict>
1711
- ${Object.entries(e).map(([e, t]) => `\t<key>${er(e)}</key>\n\t${tr(t)}`).join("\n")}
1713
+ ${Object.entries(e).map(([e, t]) => `\t<key>${tr(e)}</key>\n\t${nr(t)}`).join("\n")}
1712
1714
  </dict>
1713
1715
  </plist>
1714
1716
  `;
1715
1717
  }
1716
1718
  //#endregion
1717
1719
  //#region src/macosApp.mts
1718
- async function rr(e) {
1720
+ async function ir(e) {
1719
1721
  let { appPath: t, metadata: n, hostBin: r } = e;
1720
- await D(t, {
1722
+ await A(t, {
1721
1723
  recursive: !0,
1722
1724
  force: !0
1723
1725
  });
1724
1726
  let i = y.join(t, "Contents"), a = y.join(i, "MacOS"), o = y.join(i, "Resources");
1725
- await T(a, { recursive: !0 }), await T(o, { recursive: !0 });
1727
+ await D(a, { recursive: !0 }), await D(o, { recursive: !0 });
1726
1728
  let s = y.join(a, n.productName);
1727
- e.link ? await te(r, s).catch(() => w(r, s)) : await w(r, s), await C(s, 493);
1729
+ e.link ? await E(r, s).catch(() => T(r, s)) : await T(r, s), await w(s, 493);
1728
1730
  let c = {
1729
1731
  CFBundleName: n.productName,
1730
1732
  CFBundleDisplayName: n.productName,
@@ -1738,9 +1740,9 @@ async function rr(e) {
1738
1740
  };
1739
1741
  if (n.icon) {
1740
1742
  let e = y.basename(n.icon);
1741
- await w(n.icon, y.join(o, e)), c.CFBundleIconFile = e;
1743
+ await T(n.icon, y.join(o, e)), c.CFBundleIconFile = e;
1742
1744
  }
1743
- return await O(y.join(i, "Info.plist"), nr(c)), await O(y.join(i, "PkgInfo"), "APPL????"), {
1745
+ return await j(y.join(i, "Info.plist"), rr(c)), await j(y.join(i, "PkgInfo"), "APPL????"), {
1744
1746
  appPath: t,
1745
1747
  executablePath: s,
1746
1748
  resourcesDir: o
@@ -1748,8 +1750,8 @@ async function rr(e) {
1748
1750
  }
1749
1751
  //#endregion
1750
1752
  //#region src/watchForEdit.mts
1751
- var ir = /^(?:inca\.config\.[a-z0-9]+|package\.json)$/, ar = [...Hn, "App.vue"];
1752
- function or(e, t = {}) {
1753
+ var ar = /^(?:inca\.config\.[a-z0-9]+|package\.json)$/, or = [...Hn, "App.vue"];
1754
+ function sr(e, t = {}) {
1753
1755
  let n = t.debounceMs ?? 100, r = /* @__PURE__ */ new Set(), i, a = !1, o = () => {}, s = new Promise((e) => {
1754
1756
  o = e;
1755
1757
  }), c = () => {
@@ -1770,7 +1772,7 @@ function or(e, t = {}) {
1770
1772
  r.clear();
1771
1773
  };
1772
1774
  try {
1773
- l(e, (e) => e === "src" || ir.test(e)), l(y.join(e, "src"), (e) => ar.includes(e));
1775
+ l(e, (e) => e === "src" || ar.test(e)), l(y.join(e, "src"), (e) => or.includes(e));
1774
1776
  } catch (e) {
1775
1777
  throw u(), e;
1776
1778
  }
@@ -1786,7 +1788,7 @@ function or(e, t = {}) {
1786
1788
  }
1787
1789
  //#endregion
1788
1790
  //#region src/retryOnEdit.mts
1789
- function sr(e, t) {
1791
+ function cr(e, t) {
1790
1792
  return new Promise((n) => {
1791
1793
  let r = () => n(!1);
1792
1794
  t.addEventListener("abort", r, { once: !0 }), e.then(() => {
@@ -1794,14 +1796,14 @@ function sr(e, t) {
1794
1796
  });
1795
1797
  });
1796
1798
  }
1797
- async function cr(e) {
1799
+ async function lr(e) {
1798
1800
  let { cwd: t, signal: n, stdout: r, stderr: i, debounceMs: a } = e, o = !1;
1799
1801
  for (;;) {
1800
- let s = or(t, { debounceMs: a });
1802
+ let s = sr(t, { debounceMs: a });
1801
1803
  try {
1802
1804
  return await e.attempt(s);
1803
1805
  } catch (e) {
1804
- let t = e instanceof q ? e.path : void 0;
1806
+ let t = e instanceof J ? e.path : void 0;
1805
1807
  if (t) try {
1806
1808
  s.add(t);
1807
1809
  } catch (t) {
@@ -1811,7 +1813,7 @@ async function cr(e) {
1811
1813
  o = !0;
1812
1814
  continue;
1813
1815
  }
1814
- if (o = !1, $(i, "build failed", Q(e), X), n.aborted || (Z(r, "waiting for a change to retry", X), !await sr(s.edited, n))) return;
1816
+ if (o = !1, $(i, "build failed", Q(e), X), n.aborted || (Z(r, "waiting for a change to retry", X), !await cr(s.edited, n))) return;
1815
1817
  Z(r, "retrying", X);
1816
1818
  } finally {
1817
1819
  s.close();
@@ -1820,19 +1822,19 @@ async function cr(e) {
1820
1822
  }
1821
1823
  //#endregion
1822
1824
  //#region src/dev.mts
1823
- var lr = 1e4, ur = ["ERR_INCA_PACKAGE_JSON_NOT_FOUND", "ERR_INCA_PRODUCT_NAME_MISSING"];
1824
- async function dr(e, t) {
1825
+ var ur = 1e4, dr = ["ERR_INCA_PACKAGE_JSON_NOT_FOUND", "ERR_INCA_PRODUCT_NAME_MISSING"];
1826
+ async function fr(e, t) {
1825
1827
  try {
1826
- return await Ut(e);
1828
+ return await Vt(e);
1827
1829
  } catch (e) {
1828
- if (!(e instanceof q) || !ur.includes(e.code)) throw e;
1830
+ if (!(e instanceof J) || !dr.includes(e.code)) throw e;
1829
1831
  Z(t, `running unnamed. ${e.message}`, X);
1830
1832
  return;
1831
1833
  }
1832
1834
  }
1833
- async function fr(e, t, n, r) {
1835
+ async function pr(e, t, n, r) {
1834
1836
  if (process.platform === "darwin" && t) try {
1835
- return (await rr({
1837
+ return (await ir({
1836
1838
  appPath: y.join(e, "node_modules/.inca", `${t.productName}.app`),
1837
1839
  metadata: t,
1838
1840
  hostBin: n,
@@ -1843,205 +1845,251 @@ async function fr(e, t, n, r) {
1843
1845
  return;
1844
1846
  }
1845
1847
  }
1846
- async function pr(e, t) {
1848
+ async function mr(e, t) {
1847
1849
  let n = new Set(t), r;
1848
1850
  try {
1849
- r = await ne(e, {
1851
+ r = await k(e, {
1850
1852
  recursive: !0,
1851
1853
  withFileTypes: !0
1852
1854
  });
1853
1855
  } catch {
1854
1856
  return;
1855
1857
  }
1856
- await Promise.all(r.filter((e) => e.isFile()).map((t) => y.relative(e, y.join(t.parentPath, t.name))).filter((e) => !n.has(e)).map((t) => D(y.join(e, t), { force: !0 })));
1858
+ await Promise.all(r.filter((e) => e.isFile()).map((t) => y.relative(e, y.join(t.parentPath, t.name))).filter((e) => !n.has(e)).map((t) => A(y.join(e, t), { force: !0 })));
1857
1859
  }
1858
- function mr(e) {
1860
+ function hr(e) {
1859
1861
  let { NO_COLOR: t, FORCE_COLOR: n } = process.env;
1860
1862
  if (!(!e.isTTY || t || n)) return {
1861
1863
  ...process.env,
1862
1864
  FORCE_COLOR: "1"
1863
1865
  };
1864
1866
  }
1865
- async function hr(e) {
1866
- let t = e.cwd ?? process.cwd(), n = await Qn(t);
1867
+ async function gr(e) {
1868
+ let t = e.cwd ?? process.cwd(), n = await $n(t), r = () => {}, i = !1, a = new Promise((e) => {
1869
+ r = () => {
1870
+ i = !0, e();
1871
+ };
1872
+ }), o, s;
1867
1873
  try {
1868
- let n = e.hostBin ?? J();
1869
- Y(n);
1870
- let r = e.bundler ?? Vn, i = e.stdout ?? process.stdout, a = e.stderr ?? process.stderr, o = e.experimentalHmr ? r.hmr?.bind(r) : void 0;
1871
- if (e.experimentalHmr && !o) throw new q("ERR_INCA_HMR_UNSUPPORTED", "--experimental-hmr was set, but the configured bundler has no HMR support");
1872
- let s = await cr({
1874
+ let n = e.hostBin ?? qt();
1875
+ Jt(n);
1876
+ let c = e.bundler ?? Vn, l = e.stdout ?? process.stdout, u = e.stderr ?? process.stderr, d = e.experimentalHmr ? c.hmr?.bind(c) : void 0;
1877
+ if (e.experimentalHmr && !d) throw new J("ERR_INCA_HMR_UNSUPPORTED", "--experimental-hmr was set, but the configured bundler has no HMR support");
1878
+ let f = await lr({
1873
1879
  cwd: t,
1874
1880
  signal: e.signal,
1875
- stdout: i,
1876
- stderr: a,
1881
+ stdout: l,
1882
+ stderr: u,
1877
1883
  async attempt() {
1878
- let n = await Ht(t), r = y.resolve(t, n.outDir), a = e.entry ?? n.entry ?? await Gn(t);
1879
- Rt(t, r, a);
1880
- let o = await dr(t, i);
1884
+ let n = await Bt(t), r = y.resolve(t, n.outDir), i = e.entry === void 0 && n.entry === void 0, a = e.entry ?? n.entry ?? await Kn(t);
1885
+ Y(t, r, a);
1886
+ let o = await fr(t, l);
1881
1887
  return {
1882
1888
  outDir: r,
1883
1889
  entry: a,
1890
+ automaticEntry: i,
1884
1891
  metadata: o,
1885
- runtimeConfig: o ? Wt(o) : await Gt(t)
1892
+ runtimeConfig: o ? Ht(o) : await Ut(t)
1886
1893
  };
1887
1894
  }
1888
1895
  });
1889
- if (!s) return;
1890
- let { outDir: c, entry: l, metadata: u, runtimeConfig: d } = s, f = await fr(t, u, n, i) ?? n, p, m = !1, h = !1, g = !1, _, v = Promise.resolve(), b = () => {}, ee = new Promise((e) => {
1891
- b = e;
1892
- });
1893
- async function x() {
1896
+ if (!f) return;
1897
+ let { outDir: p, entry: m, automaticEntry: h, metadata: g, runtimeConfig: _ } = f, v = await pr(t, g, n, l) ?? n, b, x = !1, S = !1, w = !1, T, E = Promise.resolve(), D, O = 0, k = !1, A;
1898
+ async function j() {
1894
1899
  try {
1895
- return await p?.call("reload", void 0, lr), !0;
1900
+ return await b?.call("reload", void 0, ur), !0;
1896
1901
  } catch (e) {
1897
- return $(a, "reload failed", Q(e), X), !1;
1902
+ return $(u, "reload failed", Q(e), X), !1;
1898
1903
  }
1899
1904
  }
1900
- function C(e) {
1905
+ function ee(e) {
1901
1906
  if (!e) return;
1902
- let n = S("dim", y.relative(t, e.file), { stream: i }), r = Date.now() - e.at;
1903
- Z(i, `${S("green", "reload")} ${n} (${r}ms)`, X);
1907
+ let n = C("dim", y.relative(t, e.file), { stream: l }), r = Date.now() - e.at;
1908
+ Z(l, `${C("green", "reload")} ${n} (${r}ms)`, X);
1904
1909
  }
1905
- async function w(e, t) {
1910
+ async function te(e, t) {
1906
1911
  let n = new $t({
1907
1912
  entryFile: e,
1908
- hostBin: f,
1909
- env: mr(a),
1910
- onStderr: (e) => a.write(e),
1913
+ hostBin: v,
1914
+ env: hr(u),
1915
+ onStderr: (e) => u.write(e),
1911
1916
  onReady: () => {
1912
- m = !0, Z(i, "ready", X), h && (h = !1, x());
1917
+ x = !0, Z(l, "ready", X), S && (S = !1, j());
1913
1918
  },
1914
- onAppError: (e) => $(a, "app error", e, X),
1919
+ onAppError: (e) => $(u, "app error", e, X),
1915
1920
  onExit: (e, t) => {
1916
- g = !m, _ = {
1921
+ w = !x, T = {
1917
1922
  code: e,
1918
1923
  signal: t
1919
- }, Z(i, "host exited. stopping", X), b();
1924
+ }, Z(l, "host exited. stopping", X), r();
1920
1925
  },
1921
1926
  integrations: t
1922
1927
  });
1923
1928
  try {
1924
1929
  await n.start();
1925
1930
  } catch (e) {
1926
- $(a, "failed to start the host", Q(e), X);
1931
+ $(u, "failed to start the host", Q(e), X);
1927
1932
  return;
1928
1933
  }
1929
- p = n;
1934
+ b = n;
1930
1935
  }
1931
- async function te(e) {
1932
- await pr(e.outDir, e.files), p ? m ? await x() && C(e.changed) : h = !0 : await w(e.entryFile);
1936
+ async function M(e) {
1937
+ await mr(e.outDir, e.files), b ? x ? await j() && ee(e.changed) : S = !0 : await te(e.entryFile);
1933
1938
  }
1934
- let T;
1935
- if (o) {
1936
- let e = await o({
1937
- entry: l,
1938
- root: Wn(t, l),
1939
+ async function ne(e) {
1940
+ Y(t, p, e);
1941
+ let n = ++O, a = () => n === O && !i, o = (e) => (...t) => {
1942
+ a() && e(...t);
1943
+ }, s;
1944
+ if (d) {
1945
+ let n = await d({
1946
+ entry: e,
1947
+ root: Wn(t, e),
1948
+ envDir: t,
1949
+ publicDir: y.join(t, "public"),
1950
+ cwd: t,
1951
+ runtimeConfig: _,
1952
+ stdout: l,
1953
+ stderr: u,
1954
+ notify: o((e) => b?.notify("vite", e)),
1955
+ reload: o((e) => {
1956
+ x ? j().then((t) => {
1957
+ t && ee(e);
1958
+ }) : S = !0;
1959
+ }),
1960
+ onError: o((e) => $(u, "build failed", e, X)),
1961
+ onUpdate: o(({ file: e, took: n }) => {
1962
+ if (!x) return;
1963
+ let r = C("dim", y.relative(t, e), { stream: l });
1964
+ Z(l, `${C("green", "update")} ${r} (${n}ms)`, X);
1965
+ })
1966
+ });
1967
+ A = (e) => n.dispatch(e), s = { close: () => (A = void 0, n.close()) }, b ? x ? await j() : S = !0 : (await te(n.entryFile, { vite: (e) => A?.(e) }), b || r());
1968
+ } else s = await c.watch({
1969
+ entry: e,
1970
+ root: Wn(t, e),
1939
1971
  envDir: t,
1940
1972
  publicDir: y.join(t, "public"),
1941
- cwd: t,
1942
- runtimeConfig: d,
1943
- stdout: i,
1944
- stderr: a,
1945
- notify: (e) => p?.notify("vite", e),
1946
- reload: (e) => {
1947
- m ? x().then((t) => {
1948
- t && C(e);
1949
- }) : h = !0;
1973
+ outDir: p,
1974
+ runtimeConfig: _,
1975
+ mode: "development",
1976
+ stdout: l,
1977
+ stderr: u,
1978
+ onBuild: (e) => {
1979
+ E = E.then(() => a() ? M(e) : void 0);
1950
1980
  },
1951
- onError: (e) => $(a, "build failed", e, X),
1952
- onUpdate: ({ file: e, took: n }) => {
1953
- if (!m) return;
1954
- let r = S("dim", y.relative(t, e), { stream: i });
1955
- Z(i, `${S("green", "update")} ${r} (${n}ms)`, X);
1956
- }
1981
+ onError: o((e) => {
1982
+ $(u, "build failed", e, X);
1983
+ })
1957
1984
  });
1958
- await w(e.entryFile, { vite: (t) => e.dispatch(t) }), T = e, p || b();
1959
- } else T = await r.watch({
1960
- entry: l,
1961
- root: Wn(t, l),
1962
- envDir: t,
1963
- publicDir: y.join(t, "public"),
1964
- outDir: c,
1965
- runtimeConfig: d,
1966
- mode: "development",
1967
- stdout: i,
1968
- stderr: a,
1969
- onBuild: (e) => {
1970
- v = v.then(() => te(e));
1971
- },
1972
- onError: (e) => {
1973
- $(a, "build failed", e, X);
1985
+ return {
1986
+ entry: e,
1987
+ async close() {
1988
+ O++, await s.close();
1989
+ }
1990
+ };
1991
+ }
1992
+ async function re() {
1993
+ let e = D;
1994
+ D = void 0, await e?.close();
1995
+ }
1996
+ async function ie() {
1997
+ if (i) return;
1998
+ let e = Gn(t);
1999
+ if (e === void 0 || e !== D?.entry) try {
2000
+ e === void 0 && await re();
2001
+ let n = await Kn(t);
2002
+ if (k = !1, await re(), i) return;
2003
+ D = await ne(n);
2004
+ } catch (t) {
2005
+ k || $(u, "build failed", Q(t), X), k = e === void 0;
2006
+ }
2007
+ }
2008
+ async function N(e) {
2009
+ let n = e;
2010
+ for (; await Promise.race([a.then(() => !1), n.edited.then(() => !0)]);) n.close(), n = o = sr(t), E = E.then(ie), await E;
2011
+ }
2012
+ let P = m;
2013
+ if (h) {
2014
+ o = sr(t);
2015
+ try {
2016
+ P = await Kn(t);
2017
+ } catch (e) {
2018
+ P = void 0, k = !0, $(u, "build failed", Q(e), X);
1974
2019
  }
1975
- });
1976
- if (e.signal.aborted ? b() : e.signal.addEventListener("abort", () => b(), { once: !0 }), await ee, await v, await p?.stop(), await T.close(), g) throw new q("ERR_INCA_HOST_EXITED_EARLY", "the host exited before it was ready");
1977
- if (_ && _.code !== 0 && _.signal !== "SIGINT" && _.signal !== "SIGTERM") {
1978
- let { code: e, signal: t } = _;
1979
- throw new q("ERR_INCA_HOST_CRASHED", `the host exited with ${t ? `signal ${t}` : `code ${e}`}`);
2020
+ }
2021
+ P !== void 0 && (D = await ne(P)), o && (s = N(o).then(() => void 0, (e) => (r(), { error: e }))), e.signal.aborted ? r() : e.signal.addEventListener("abort", () => r(), { once: !0 }), await a;
2022
+ let ae = await s;
2023
+ if (await D?.close(), await E, await b?.stop(), ae) throw ae.error;
2024
+ if (w) throw new J("ERR_INCA_HOST_EXITED_EARLY", "the host exited before it was ready");
2025
+ if (T && T.code !== 0 && T.signal !== "SIGINT" && T.signal !== "SIGTERM") {
2026
+ let { code: e, signal: t } = T;
2027
+ throw new J("ERR_INCA_HOST_CRASHED", `the host exited with ${t ? `signal ${t}` : `code ${e}`}`);
1980
2028
  }
1981
2029
  } finally {
1982
- await n();
2030
+ r(), await s, o?.close(), await n();
1983
2031
  }
1984
2032
  }
1985
2033
  //#endregion
1986
2034
  //#region src/package.mts
1987
- function gr() {
2035
+ function _r() {
1988
2036
  if (process.platform === "darwin") return "macos";
1989
2037
  if (process.platform === "linux") return "linux";
1990
- throw new q("ERR_INCA_PLATFORM_UNSUPPORTED", `inca package doesn't support ${process.platform} yet`);
2038
+ throw new J("ERR_INCA_PLATFORM_UNSUPPORTED", `inca package doesn't support ${process.platform} yet`);
1991
2039
  }
1992
- async function _r(e, t) {
2040
+ async function vr(e, t) {
1993
2041
  await Promise.all(e.files.map(async (n) => {
1994
2042
  let r = y.join(t, n);
1995
- await T(y.dirname(r), { recursive: !0 }), await w(y.join(e.outDir, n), r);
2043
+ await D(y.dirname(r), { recursive: !0 }), await T(y.join(e.outDir, n), r);
1996
2044
  }));
1997
2045
  }
1998
- function vr(e, t) {
2046
+ function yr(e, t) {
1999
2047
  let n = e.files.map((e) => e.split("/")[0] ?? e).find((e) => e.toLowerCase() === t.toLowerCase());
2000
- if (n !== void 0) throw new q("ERR_INCA_PRODUCT_NAME_INVALID", `the packaged app's directory "${t}" collides with "${n}" in the build output. Set a different "productName" in inca.config.ts`);
2048
+ if (n !== void 0) throw new J("ERR_INCA_PRODUCT_NAME_INVALID", `the packaged app's directory "${t}" collides with "${n}" in the build output. Set a different "productName" in inca.config.ts`);
2001
2049
  }
2002
- async function yr({ metadata: e, output: t, hostBin: n }) {
2003
- let { appPath: r, resourcesDir: i } = await rr({
2050
+ async function br({ metadata: e, output: t, hostBin: n }) {
2051
+ let { appPath: r, resourcesDir: i } = await ir({
2004
2052
  appPath: y.join(t.outDir, `${e.productName}.app`),
2005
2053
  metadata: e,
2006
2054
  hostBin: n
2007
2055
  });
2008
- return await _r(t, i), r;
2056
+ return await vr(t, i), r;
2009
2057
  }
2010
- async function br({ metadata: e, output: t, hostBin: n }) {
2058
+ async function xr({ metadata: e, output: t, hostBin: n }) {
2011
2059
  let r = c(e.productName);
2012
- vr(t, r);
2060
+ yr(t, r);
2013
2061
  let i = y.join(t.outDir, r);
2014
- await D(i, {
2062
+ await A(i, {
2015
2063
  recursive: !0,
2016
2064
  force: !0
2017
- }), await T(i, { recursive: !0 });
2065
+ }), await D(i, { recursive: !0 });
2018
2066
  let a = y.join(i, r);
2019
- return await w(n, a), await C(a, 493), await _r(t, i), i;
2067
+ return await T(n, a), await w(a, 493), await vr(t, i), i;
2020
2068
  }
2021
- async function xr(e = {}) {
2022
- let t = e.cwd ?? process.cwd(), n = e.stdout ?? process.stdout, r = e.target ?? gr(), i = await Ut(t);
2069
+ async function Sr(e = {}) {
2070
+ let t = e.cwd ?? process.cwd(), n = e.stdout ?? process.stdout, r = e.target ?? _r(), i = await Vt(t);
2023
2071
  i.usedPackageJsonKey && Z(n, "the \"inca\" key in package.json is deprecated. move these settings to inca.config.ts"), i.identifierIsDefault && Z(n, `no "identifier" set in inca.config.ts. using generated identifier ${i.identifier}`);
2024
- let a = await qn({
2072
+ let a = await Jn({
2025
2073
  cwd: t,
2026
2074
  entry: e.entry,
2027
2075
  config: i,
2028
2076
  sourcemap: e.sourcemap,
2029
- runtimeConfig: Wt(i),
2077
+ runtimeConfig: Ht(i),
2030
2078
  bundler: e.bundler,
2031
2079
  stdout: n,
2032
2080
  stderr: e.stderr
2033
- }), o = e.hostBin ?? J();
2034
- Y(o);
2081
+ }), o = e.hostBin ?? qt();
2082
+ Jt(o);
2035
2083
  let s = {
2036
2084
  metadata: i,
2037
2085
  output: a,
2038
2086
  hostBin: o
2039
2087
  };
2040
- return { appPath: r === "macos" ? await yr(s) : await br(s) };
2088
+ return { appPath: r === "macos" ? await br(s) : await xr(s) };
2041
2089
  }
2042
2090
  //#endregion
2043
2091
  //#region src/printConfig.mts
2044
- var Sr = {
2092
+ var Cr = {
2045
2093
  productName: "a string",
2046
2094
  identifier: "a string",
2047
2095
  window: "an object",
@@ -2052,10 +2100,10 @@ var Sr = {
2052
2100
  "window.minWidth": "a number",
2053
2101
  "window.minHeight": "a number"
2054
2102
  };
2055
- function Cr(e) {
2103
+ function wr(e) {
2056
2104
  return typeof e == "number" ? "a number" : typeof e == "string" ? "a string" : typeof e == "boolean" ? "true or false" : "an object";
2057
2105
  }
2058
- function wr(e, t, n) {
2106
+ function Tr(e, t, n) {
2059
2107
  let r = `failed to read ${t}: `, i = e.split("\n")[0] ?? "";
2060
2108
  if (!i.startsWith(r)) return;
2061
2109
  let a = i.slice(r.length), o = a.indexOf("]: "), s;
@@ -2065,35 +2113,35 @@ function wr(e, t, n) {
2065
2113
  return;
2066
2114
  }
2067
2115
  if (!Array.isArray(s)) return;
2068
- let [c, ...l] = s, u = [c === "name" ? "productName" : c, ...l].join("."), d = Sr[u];
2116
+ let [c, ...l] = s, u = [c === "name" ? "productName" : c, ...l].join("."), d = Cr[u];
2069
2117
  if (!d) return;
2070
- let f = s.reduce((e, t) => e?.[t], n), p = Cr(f) === d ? "the host can't use it" : `it must be ${d}`;
2071
- return new q("ERR_INCA_CONFIG_INVALID", `${u} in inca.config.ts is ${JSON.stringify(f)}. ${p}`);
2072
- }
2073
- async function Tr(e = {}) {
2074
- let t = e.cwd ?? process.cwd(), n = e.hostBin ?? J();
2075
- Y(n);
2076
- let r = await Gt(t) ?? {}, i = y.join(t, "node_modules/.inca/config"), a = y.join(i, "bundle.js"), o = y.join(i, "inca.json");
2077
- await T(i, { recursive: !0 }), await O(a, ""), await O(o, JSON.stringify(r, void 0, 2));
2078
- let s = se(n, ["--print-config", a], { encoding: "utf8" });
2118
+ let f = s.reduce((e, t) => e?.[t], n), p = wr(f) === d ? "the host can't use it" : `it must be ${d}`;
2119
+ return new J("ERR_INCA_CONFIG_INVALID", `${u} in inca.config.ts is ${JSON.stringify(f)}. ${p}`);
2120
+ }
2121
+ async function Er(e = {}) {
2122
+ let t = e.cwd ?? process.cwd(), n = e.hostBin ?? qt();
2123
+ Jt(n);
2124
+ let r = await Ut(t) ?? {}, i = y.join(t, "node_modules/.inca/config"), a = y.join(i, "bundle.js"), o = y.join(i, "inca.json");
2125
+ await D(i, { recursive: !0 }), await j(a, ""), await j(o, JSON.stringify(r, void 0, 2));
2126
+ let s = ie(n, ["--print-config", a], { encoding: "utf8" });
2079
2127
  if (s.error) throw s.error;
2080
2128
  if (s.status !== 0) {
2081
- let e = wr(s.stderr, o, r);
2129
+ let e = Tr(s.stderr, o, r);
2082
2130
  if (e) throw e;
2083
2131
  }
2084
2132
  return (e.stdout ?? process.stdout).write(s.stdout), (e.stderr ?? process.stderr).write(s.stderr), s.status ?? 1;
2085
2133
  }
2086
2134
  //#endregion
2087
2135
  //#region src/cli.mts
2088
- function Er(e) {
2136
+ function Dr(e) {
2089
2137
  return y.relative(process.cwd(), e);
2090
2138
  }
2091
- var Dr = {
2139
+ var Or = {
2092
2140
  type: "boolean",
2093
2141
  description: "Write a source map",
2094
2142
  negativeDescription: "Skip the source map"
2095
2143
  };
2096
- function Or() {
2144
+ function kr() {
2097
2145
  for (let e of [
2098
2146
  0,
2099
2147
  1,
@@ -2102,47 +2150,47 @@ function Or() {
2102
2150
  f.closeSync(e);
2103
2151
  } catch {}
2104
2152
  }
2105
- var kr = B({
2153
+ var Ar = W({
2106
2154
  meta: {
2107
2155
  name: "build",
2108
2156
  description: "Bundle the app into dist"
2109
2157
  },
2110
- args: { sourcemap: Dr },
2158
+ args: { sourcemap: Or },
2111
2159
  async run({ args: e }) {
2112
2160
  try {
2113
- let t = await qn({ sourcemap: e.sourcemap });
2114
- Z(process.stdout, `built ${Er(t.entryFile)}`);
2161
+ let t = await Jn({ sourcemap: e.sourcemap });
2162
+ Z(process.stdout, `built ${Dr(t.entryFile)}`);
2115
2163
  } catch (e) {
2116
2164
  $(process.stderr, "build failed", Q(e)), process.exitCode = 1;
2117
2165
  }
2118
2166
  }
2119
- }), Ar = B({
2167
+ }), jr = W({
2120
2168
  meta: {
2121
2169
  name: "package",
2122
2170
  description: "Package the app as an application bundle"
2123
2171
  },
2124
- args: { sourcemap: Dr },
2172
+ args: { sourcemap: Or },
2125
2173
  async run({ args: e }) {
2126
2174
  try {
2127
- let { appPath: t } = await xr({ sourcemap: e.sourcemap });
2128
- Z(process.stdout, `packaged ${Er(t)}`);
2175
+ let { appPath: t } = await Sr({ sourcemap: e.sourcemap });
2176
+ Z(process.stdout, `packaged ${Dr(t)}`);
2129
2177
  } catch (e) {
2130
2178
  $(process.stderr, "package failed", Q(e)), process.exitCode = 1;
2131
2179
  }
2132
2180
  }
2133
- }), jr = B({
2181
+ }), Mr = W({
2134
2182
  meta: {
2135
2183
  name: "config",
2136
2184
  description: "Print the settings the host applies to the app"
2137
2185
  },
2138
2186
  async run() {
2139
2187
  try {
2140
- process.exitCode = await Tr();
2188
+ process.exitCode = await Er();
2141
2189
  } catch (e) {
2142
2190
  $(process.stderr, "config failed", Q(e)), process.exitCode = 1;
2143
2191
  }
2144
2192
  }
2145
- }), Mr = B({
2193
+ }), Nr = W({
2146
2194
  meta: {
2147
2195
  name: "dev",
2148
2196
  description: "Run the app in a development window"
@@ -2164,29 +2212,29 @@ var kr = B({
2164
2212
  ].includes(process.env.INCA_EXPERIMENTAL_HMR ?? "");
2165
2213
  r && Z(process.stdout, "experimental HMR active", { timestamp: !0 });
2166
2214
  try {
2167
- await hr({
2215
+ await gr({
2168
2216
  signal: t.signal,
2169
2217
  experimentalHmr: r
2170
- }), t.signal.aborted && Or();
2218
+ }), t.signal.aborted && kr();
2171
2219
  } catch (e) {
2172
2220
  $(process.stderr, "dev failed", Q(e), { timestamp: !0 }), process.exitCode = 1;
2173
2221
  }
2174
2222
  }
2175
- }), Nr = B({
2223
+ }), Pr = W({
2176
2224
  meta: {
2177
2225
  name: "inca",
2178
- version: Ve,
2179
- description: He
2226
+ version: Be,
2227
+ description: Ve
2180
2228
  },
2181
2229
  subCommands: {
2182
- dev: Mr,
2183
- build: kr,
2184
- package: Ar,
2185
- config: jr
2230
+ dev: Nr,
2231
+ build: Ar,
2232
+ package: jr,
2233
+ config: Mr
2186
2234
  }
2187
2235
  });
2188
- async function Pr(e = process.argv) {
2189
- await Re(Nr, { rawArgs: e.slice(2) });
2236
+ async function Fr(e = process.argv) {
2237
+ await Le(Pr, { rawArgs: e.slice(2) });
2190
2238
  }
2191
2239
  //#endregion
2192
- export { Pr as run };
2240
+ export { Fr as run };