lecodes-cli 2.5.0 → 2.6.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
@@ -64,7 +64,7 @@ var package_default;
64
64
  var init_package = __esm(() => {
65
65
  package_default = {
66
66
  name: "lecodes-cli",
67
- version: "2.5.0",
67
+ version: "2.6.0",
68
68
  dependencies: {
69
69
  "@letary/chisel": "^0.15.0",
70
70
  jimp: "^1.6.1",
@@ -89,9 +89,9 @@ var init_package = __esm(() => {
89
89
  },
90
90
  peerDependencies: {
91
91
  "lecodes-design": "^0.11.0",
92
- "lecodes-headless": "^2.5.0",
92
+ "lecodes-headless": "^2.6.0",
93
93
  "lecodes-3d-editor": "^0.9.0",
94
- "lecodes-assets": "^2.5.0",
94
+ "lecodes-assets": "^2.6.0",
95
95
  "heic-decode": "^2.1.0",
96
96
  "marcidb-embedded": "^0.15.0",
97
97
  sharp: "^0.35.2",
@@ -159,7 +159,7 @@ var init_package = __esm(() => {
159
159
  });
160
160
 
161
161
  // ../../sdk/src/version.ts
162
- var SDK_VERSION = "2.5.0";
162
+ var SDK_VERSION = "2.6.0";
163
163
 
164
164
  // src/cli/args.ts
165
165
  var isNegativeNumber = (s) => /^-(\d|\.\d)/.test(s), isValue = (s) => !s.startsWith("-") || isNegativeNumber(s), parseArgv = (argv, booleans = new Set) => {
@@ -2008,6 +2008,8 @@ var init_chisel = __esm(() => {
2008
2008
  "onBlur",
2009
2009
  "onOverlayTap",
2010
2010
  "onDetent",
2011
+ "onDismiss",
2012
+ "bindShow",
2011
2013
  "onEndReached",
2012
2014
  "onStartReached",
2013
2015
  "append",
@@ -171962,14 +171964,14 @@ var localAssetBase = (path) => path.split(/[\\/]/).pop() ?? path, localAssetName
171962
171964
  const seen = new Map;
171963
171965
  for (const e of entries)
171964
171966
  if (e.type === "resource") {
171965
- const b = localAssetBase(e.path);
171967
+ const b = localAssetBase(e.path).toLowerCase();
171966
171968
  seen.set(b, (seen.get(b) ?? 0) + 1);
171967
171969
  }
171968
171970
  const names = new Map;
171969
171971
  for (const e of entries)
171970
171972
  if (e.type === "resource") {
171971
171973
  const b = localAssetBase(e.path);
171972
- names.set(e.path, (seen.get(b) ?? 0) > 1 ? e.path.replace(/^[./]+/, "").replace(/[\\/]/g, "__") : b);
171974
+ names.set(e.path, (seen.get(b.toLowerCase()) ?? 0) > 1 ? e.path.replace(/^[./]+/, "").replace(/[\\/]/g, "__") : b);
171973
171975
  }
171974
171976
  return names;
171975
171977
  }, entriesToFiles = (entries, opts) => {
@@ -209228,6 +209230,14 @@ var init_env3 = __esm(() => {
209228
209230
  env = makeEnv(currentEnv);
209229
209231
  });
209230
209232
 
209233
+ // ../../sdk/src/server/trustedCa.ts
209234
+ import { dirname as dirname19, join as join35 } from "node:path";
209235
+ import { fileURLToPath as fileURLToPath4 } from "node:url";
209236
+ var TRUSTED_CA_FILE, trustedCaEnv = (env = process.env) => env.NODE_EXTRA_CA_CERTS ? {} : { NODE_EXTRA_CA_CERTS: TRUSTED_CA_FILE };
209237
+ var init_trustedCa = __esm(() => {
209238
+ TRUSTED_CA_FILE = join35(dirname19(fileURLToPath4(import.meta.url)), "certs", "russian-trusted-ca.pem");
209239
+ });
209240
+
209231
209241
  // ../../sdk/src/server/channelHub.ts
209232
209242
  var keyOf = (scope, ch, group) => `${scope}|${ch}|${JSON.stringify(group)}`, setFanout = (send) => {
209233
209243
  const sockets = new Map;
@@ -209747,7 +209757,7 @@ var init_host2 = __esm(() => {
209747
209757
  // ../../sdk/src/server/files/host.ts
209748
209758
  import { createReadStream } from "node:fs";
209749
209759
  import { mkdir, readFile as readFile3, readdir, rename, rm, stat, writeFile as writeFile3 } from "node:fs/promises";
209750
- import { basename as basename12, join as join35 } from "node:path";
209760
+ import { basename as basename12, join as join36 } from "node:path";
209751
209761
  import { Readable } from "node:stream";
209752
209762
  var UploadError, UUID, JOURNAL = "lecodes-files", MB, TMP_MAX_AGE_MS, MAX_IMAGE_PIXELS = 50000000, WEBP_QUALITY = 80, ascii = (b, at, text) => {
209753
209763
  for (let i = 0;i < text.length; i++)
@@ -209905,7 +209915,7 @@ var UploadError, UUID, JOURNAL = "lecodes-files", MB, TMP_MAX_AGE_MS, MAX_IMAGE_
209905
209915
  throw tooBig();
209906
209916
  blobs.push(part);
209907
209917
  }
209908
- const tmp = join35(dir, "tmp");
209918
+ const tmp = join36(dir, "tmp");
209909
209919
  await mkdir(tmp, { recursive: true });
209910
209920
  const uploads = [];
209911
209921
  try {
@@ -209920,7 +209930,7 @@ var UploadError, UUID, JOURNAL = "lecodes-files", MB, TMP_MAX_AGE_MS, MAX_IMAGE_
209920
209930
  size: bytes.length,
209921
209931
  ...size ?? {}
209922
209932
  };
209923
- await writeFile3(join35(tmp, upload.id), bytes);
209933
+ await writeFile3(join36(tmp, upload.id), bytes);
209924
209934
  uploads.push(upload);
209925
209935
  }
209926
209936
  } catch (e) {
@@ -209930,10 +209940,10 @@ var UploadError, UUID, JOURNAL = "lecodes-files", MB, TMP_MAX_AGE_MS, MAX_IMAGE_
209930
209940
  return { args, uploads };
209931
209941
  }, dropUploads = async (dir, uploads) => {
209932
209942
  for (const u of uploads)
209933
- await rm(join35(dir, "tmp", u.id), { force: true });
209943
+ await rm(join36(dir, "tmp", u.id), { force: true });
209934
209944
  }, fileResponse = async (dir, rest, req, headers = {}) => {
209935
209945
  const id = rest.split("/")[0];
209936
- const path = join35(dir, id);
209946
+ const path = join36(dir, id);
209937
209947
  const info = UUID.test(id) ? await stat(path).catch(() => null) : null;
209938
209948
  if (!info?.isFile())
209939
209949
  return new Response("Not found", { status: 404, headers });
@@ -209994,7 +210004,7 @@ var UploadError, UUID, JOURNAL = "lecodes-files", MB, TMP_MAX_AGE_MS, MAX_IMAGE_
209994
210004
  const codec = await (sharp ??= cfg.sharp?.() ?? Promise.resolve(null));
209995
210005
  if (!codec)
209996
210006
  throw new Error("files: a t.image() field needs sharp, and this host has none");
209997
- const path = join35(cfg.dir, id);
210007
+ const path = join36(cfg.dir, id);
209998
210008
  const bytes = new Uint8Array(await readFile3(path));
209999
210009
  const fit = await fitImage(codec, bytes, rule, sniffType(bytes) === "image/heic" ? await (heic ??= cfg.heic?.().catch(() => null) ?? Promise.resolve(null)) : null);
210000
210010
  if (!fit) {
@@ -210003,8 +210013,8 @@ var UploadError, UUID, JOURNAL = "lecodes-files", MB, TMP_MAX_AGE_MS, MAX_IMAGE_
210003
210013
  throw new UploadError(400, "the picture cannot be read");
210004
210014
  return { name: cleanName(names.get(id) ?? "", "image/gif"), type: "image/gif", size: bytes.length, ...size };
210005
210015
  }
210006
- await writeFile3(join35(cfg.dir, "tmp", id), fit.data);
210007
- await rename(join35(cfg.dir, "tmp", id), path);
210016
+ await writeFile3(join36(cfg.dir, "tmp", id), fit.data);
210017
+ await rename(join36(cfg.dir, "tmp", id), path);
210008
210018
  return { name: cleanName(names.get(id) ?? "", "image/webp"), type: "image/webp", size: fit.data.length, width: fit.width, height: fit.height };
210009
210019
  };
210010
210020
  const seam = {
@@ -210021,14 +210031,14 @@ var UploadError, UUID, JOURNAL = "lecodes-files", MB, TMP_MAX_AGE_MS, MAX_IMAGE_
210021
210031
  if (!entries.length)
210022
210032
  return;
210023
210033
  for (const entry of entries) {
210024
- await rm(join35(cfg.dir, entry.row.id), { force: true });
210034
+ await rm(join36(cfg.dir, entry.row.id), { force: true });
210025
210035
  after = entry.seq;
210026
210036
  }
210027
210037
  }
210028
210038
  });
210029
210039
  let ready = null;
210030
210040
  const start = () => ready ??= (async () => {
210031
- await mkdir(join35(cfg.dir, "tmp"), { recursive: true });
210041
+ await mkdir(join36(cfg.dir, "tmp"), { recursive: true });
210032
210042
  await exec({ action: "$journalOpen", journal: { name: JOURNAL, on: ["delete"] } });
210033
210043
  await exec({ action: "deleteMany", query: { $where: { ...ownerless, createdAt: { $lt: Date.now() - TMP_MAX_AGE_MS } } } });
210034
210044
  await settle();
@@ -210036,10 +210046,10 @@ var UploadError, UUID, JOURNAL = "lecodes-files", MB, TMP_MAX_AGE_MS, MAX_IMAGE_
210036
210046
  const known = new Set(rows.map((r) => r.id));
210037
210047
  for (const name of await readdir(cfg.dir)) {
210038
210048
  if (UUID.test(name) && !known.has(name))
210039
- await rm(join35(cfg.dir, name), { force: true });
210049
+ await rm(join36(cfg.dir, name), { force: true });
210040
210050
  }
210041
- for (const name of await readdir(join35(cfg.dir, "tmp"))) {
210042
- const path = join35(cfg.dir, "tmp", name);
210051
+ for (const name of await readdir(join36(cfg.dir, "tmp"))) {
210052
+ const path = join36(cfg.dir, "tmp", name);
210043
210053
  const info = await stat(path).catch(() => null);
210044
210054
  if (info && Date.now() - info.mtimeMs > TMP_MAX_AGE_MS)
210045
210055
  await rm(path, { force: true });
@@ -210058,7 +210068,7 @@ var UploadError, UUID, JOURNAL = "lecodes-files", MB, TMP_MAX_AGE_MS, MAX_IMAGE_
210058
210068
  for (const u of uploads)
210059
210069
  names.set(u.id, u.name);
210060
210070
  for (const u of uploads)
210061
- await rename(join35(cfg.dir, "tmp", u.id), join35(cfg.dir, u.id));
210071
+ await rename(join36(cfg.dir, "tmp", u.id), join36(cfg.dir, u.id));
210062
210072
  return uploads.map((u) => {
210063
210073
  const file = Object.freeze({ name: u.name, size: u.size, type: u.type });
210064
210074
  uploaded.set(file, u.id);
@@ -210078,7 +210088,7 @@ var UploadError, UUID, JOURNAL = "lecodes-files", MB, TMP_MAX_AGE_MS, MAX_IMAGE_
210078
210088
  await start();
210079
210089
  const id = crypto.randomUUID();
210080
210090
  const type = sniffType(bytes) ?? "application/octet-stream";
210081
- await writeFile3(join35(cfg.dir, "tmp", id), bytes);
210091
+ await writeFile3(join36(cfg.dir, "tmp", id), bytes);
210082
210092
  const size = imageSize(bytes, type);
210083
210093
  const [file] = await admit([{ id, name: basename12(path), type, size: bytes.length, ...size ?? {} }], rc);
210084
210094
  return uploaded.get(file);
@@ -210222,6 +210232,7 @@ var describeField = (f) => {
210222
210232
  var init_host4 = __esm(() => {
210223
210233
  init_runtime();
210224
210234
  init_env3();
210235
+ init_trustedCa();
210225
210236
  init_defineDb();
210226
210237
  init_host();
210227
210238
  init_host2();
@@ -227854,7 +227865,7 @@ var require_selfsigned = __commonJS(function(exports) {
227854
227865
  import { existsSync as existsSync62, mkdirSync as mkdirSync38, mkdtempSync as mkdtempSync9, renameSync as renameSync3, rmSync as rmSync20 } from "node:fs";
227855
227866
  import { readFile as readFile4 } from "node:fs/promises";
227856
227867
  import { tmpdir as tmpdir9 } from "node:os";
227857
- import { join as join67 } from "node:path";
227868
+ import { join as join68 } from "node:path";
227858
227869
  import { format } from "node:util";
227859
227870
  var post = (m) => {
227860
227871
  process.send?.(m);
@@ -227882,7 +227893,7 @@ var post = (m) => {
227882
227893
  if (e.kind !== "bad_request")
227883
227894
  throw e;
227884
227895
  const reason = e.message;
227885
- const probeDir = mkdtempSync9(join67(tmpdir9(), "lecodes-db-"));
227896
+ const probeDir = mkdtempSync9(join68(tmpdir9(), "lecodes-db-"));
227886
227897
  const probe = openDatabase(probeDir, { disableFsync: true });
227887
227898
  try {
227888
227899
  await probe.$sync(schema);
@@ -227950,7 +227961,7 @@ var post = (m) => {
227950
227961
  });
227951
227962
  files.install();
227952
227963
  try {
227953
- const seeded = await runSeed(server2, { files, read: async (path) => readFile4(join67(m.root, path)).catch(() => null) });
227964
+ const seeded = await runSeed(server2, { files, read: async (path) => readFile4(join68(m.root, path)).catch(() => null) });
227954
227965
  if (seeded.status === "seeded")
227955
227966
  notes.push(`seeded: ${Object.entries(seeded.rows).map(([name, n]) => `${name} ${n}`).join(", ")}`);
227956
227967
  } catch (e) {
@@ -228009,7 +228020,7 @@ var init_backendWorker = __esm(() => {
228009
228020
  init_package();
228010
228021
  init_cli();
228011
228022
  import { existsSync as existsSync63, realpathSync as realpathSync5 } from "node:fs";
228012
- import { delimiter as delimiter4, dirname as dirname32, join as join68 } from "node:path";
228023
+ import { delimiter as delimiter4, dirname as dirname33, join as join69 } from "node:path";
228013
228024
 
228014
228025
  // src/commands/app/index.ts
228015
228026
  init_manifest();
@@ -233069,7 +233080,7 @@ import { basename as basename9, dirname as dirname16, join as join26, resolve as
233069
233080
  init_releases();
233070
233081
  init_cli();
233071
233082
  import { execFileSync as execFileSync3, spawn as spawn2, spawnSync as spawnSync6 } from "node:child_process";
233072
- import { copyFileSync, existsSync as existsSync22, mkdirSync as mkdirSync13, mkdtempSync as mkdtempSync2, readdirSync as readdirSync7, readFileSync as readFileSync23, rmSync as rmSync5, statSync as statSync6, writeFileSync as writeFileSync16, linkSync } from "node:fs";
233083
+ import { constants as fsConstants, copyFileSync, existsSync as existsSync22, mkdirSync as mkdirSync13, mkdtempSync as mkdtempSync2, readdirSync as readdirSync7, readFileSync as readFileSync23, rmSync as rmSync5, statSync as statSync6, writeFileSync as writeFileSync16, linkSync } from "node:fs";
233073
233084
  import { homedir as homedir9, tmpdir as tmpdir2 } from "node:os";
233074
233085
  import { delimiter, join as join24, resolve as resolve11 } from "node:path";
233075
233086
 
@@ -233520,8 +233531,10 @@ var stageBundle = (js, resources) => {
233520
233531
  const dst = join24(runDir, r.name);
233521
233532
  try {
233522
233533
  linkSync(r.absPath, dst);
233523
- } catch {
233524
- copyFileSync(r.absPath, dst);
233534
+ } catch (e) {
233535
+ if (e.code === "EEXIST")
233536
+ throw new Error(`two resources stage as ${r.name} (names that differ only in case?): ${r.absPath}`);
233537
+ copyFileSync(r.absPath, dst, fsConstants.COPYFILE_EXCL);
233525
233538
  copied++;
233526
233539
  }
233527
233540
  files++;
@@ -235570,27 +235583,28 @@ init_manifest();
235570
235583
  init_env2();
235571
235584
  init_shared();
235572
235585
  import { rmSync as rmSync10 } from "node:fs";
235573
- import { join as join37, relative as relative6 } from "node:path";
235586
+ import { join as join38, relative as relative6 } from "node:path";
235574
235587
 
235575
235588
  // src/dev/localBackend.ts
235589
+ init_host4();
235576
235590
  init_manifest();
235577
235591
  import { spawn as spawn6 } from "node:child_process";
235578
- import { basename as basename13, dirname as dirname19, join as join36 } from "node:path";
235579
- import { fileURLToPath as fileURLToPath4 } from "node:url";
235592
+ import { basename as basename13, dirname as dirname20, join as join37 } from "node:path";
235593
+ import { fileURLToPath as fileURLToPath5 } from "node:url";
235580
235594
  var BACKEND_WORKER_ARG = "__backend-worker";
235581
235595
  var selfCommand = () => {
235582
- const here = fileURLToPath4(import.meta.url);
235596
+ const here = fileURLToPath5(import.meta.url);
235583
235597
  if (/[\\/](\$bunfs|~BUN)[\\/]/.test(here))
235584
235598
  return [process.execPath];
235585
- const entry = /^localBackend\.[cm]?[jt]s$/.test(basename13(here)) ? join36(dirname19(here), "..", "index.ts") : here;
235599
+ const entry = /^localBackend\.[cm]?[jt]s$/.test(basename13(here)) ? join37(dirname20(here), "..", "index.ts") : here;
235586
235600
  return [process.execPath, ...process.execArgv, entry];
235587
235601
  };
235588
- var filesDirOf = (dbDir) => join36(dirname19(dbDir), basename13(dbDir).replace(/db$/, "") + "files");
235602
+ var filesDirOf = (dbDir) => join37(dirname20(dbDir), basename13(dbDir).replace(/db$/, "") + "files");
235589
235603
  var startLocalBackend = (options) => {
235590
235604
  const { log } = options;
235591
235605
  const invokeTimeoutMs = options.invokeTimeoutMs ?? 30000;
235592
235606
  const loadTimeoutMs = options.loadTimeoutMs ?? 15000;
235593
- const dbDir = options.dbDir ?? join36(options.root, LECODES_DIR, "db");
235607
+ const dbDir = options.dbDir ?? join37(options.root, LECODES_DIR, "db");
235594
235608
  const filesDir = options.filesDir ?? filesDirOf(dbDir);
235595
235609
  let live = null;
235596
235610
  let code = null;
@@ -235615,7 +235629,7 @@ var startLocalBackend = (options) => {
235615
235629
  };
235616
235630
  const start = (bundle, keys) => new Promise((resolve, reject) => {
235617
235631
  const [exe, ...args] = selfCommand();
235618
- const child = spawn6(exe, [...args, BACKEND_WORKER_ARG], { cwd: options.root, stdio: ["ignore", "inherit", "inherit", "ipc"] });
235632
+ const child = spawn6(exe, [...args, BACKEND_WORKER_ARG], { cwd: options.root, stdio: ["ignore", "inherit", "inherit", "ipc"], env: { ...process.env, ...trustedCaEnv() } });
235619
235633
  let exited;
235620
235634
  const l = { child, describe: null, pending: new Map, gone: new Promise((r) => {
235621
235635
  exited = r;
@@ -236023,7 +236037,7 @@ var bearerOf = (req) => /^Bearer\s+(.+)$/i.exec(req.headers.get("authorization")
236023
236037
  var BODY_LIMIT = 8 * 1024 * 1024;
236024
236038
  var createProjectBackend = (options) => {
236025
236039
  const { root, log } = options;
236026
- const dbDir = options.dbDir ?? join37(root, LECODES_DIR, "db");
236040
+ const dbDir = options.dbDir ?? join38(root, LECODES_DIR, "db");
236027
236041
  const filesDir = filesDirOf(dbDir);
236028
236042
  let backend = null;
236029
236043
  let running = null;
@@ -236147,7 +236161,7 @@ var stablePort = (root) => {
236147
236161
  };
236148
236162
  var runBackend = (options) => {
236149
236163
  const { root } = options;
236150
- const dbDir = join37(root, LECODES_DIR, options.test ? "test-db" : "db");
236164
+ const dbDir = join38(root, LECODES_DIR, options.test ? "test-db" : "db");
236151
236165
  if (options.test) {
236152
236166
  rmSync10(dbDir, { recursive: true, force: true });
236153
236167
  rmSync10(filesDirOf(dbDir), { recursive: true, force: true });
@@ -236299,14 +236313,14 @@ init_manifest();
236299
236313
  import { existsSync as existsSync38, mkdirSync as mkdirSync22, readFileSync as readFileSync33, writeFileSync as writeFileSync25 } from "node:fs";
236300
236314
  import { randomBytes as randomBytes5 } from "node:crypto";
236301
236315
  import { networkInterfaces } from "node:os";
236302
- import { basename as basename15, join as join43 } from "node:path";
236316
+ import { basename as basename15, join as join44 } from "node:path";
236303
236317
 
236304
236318
  // src/dev/devServer.ts
236305
236319
  init_env2();
236306
236320
  init_localFiles();
236307
236321
  import { createHash as createHash8 } from "node:crypto";
236308
236322
  import { createReadStream as createReadStream2, readFileSync as readFileSync31, statSync as statSync11 } from "node:fs";
236309
- import { join as join39 } from "node:path";
236323
+ import { join as join40 } from "node:path";
236310
236324
  import { Readable as Readable3 } from "node:stream";
236311
236325
  init_projectCompile();
236312
236326
  init_fonts();
@@ -236441,7 +236455,7 @@ init_paths();
236441
236455
  init_compile();
236442
236456
  init_cli();
236443
236457
  import { cpSync as cpSync5, existsSync as existsSync34, readFileSync as readFileSync30 } from "node:fs";
236444
- import { join as join38, sep as sep4 } from "node:path";
236458
+ import { join as join39, sep as sep4 } from "node:path";
236445
236459
  var halfModule = (half) => `plugins/${half.folder}/index.js`;
236446
236460
  var asCliError = (e) => new CliError(e instanceof Error ? e.message : String(e));
236447
236461
  var projectHalves = (root) => {
@@ -236451,17 +236465,17 @@ var projectHalves = (root) => {
236451
236465
  const folder = dir.split(sep4).pop();
236452
236466
  let web;
236453
236467
  try {
236454
- web = webHalfManifestOf(readFileSync30(join38(dir, MANIFEST_FILE), "utf8"), folder, id);
236468
+ web = webHalfManifestOf(readFileSync30(join39(dir, MANIFEST_FILE), "utf8"), folder, id);
236455
236469
  } catch (e) {
236456
236470
  throw asCliError(e);
236457
236471
  }
236458
236472
  const genId = web.implements ?? id;
236459
- if (!existsSync34(join38(dir, "web", `${genId}.gen.ts`))) {
236473
+ if (!existsSync34(join39(dir, "web", `${genId}.gen.ts`))) {
236460
236474
  throw new CliError(`Plugin "${id}": ${spec}/web/${genId}.gen.ts is not there — run \`lecodes plugin gen ${spec}\`.`);
236461
236475
  }
236462
236476
  if (halves.some((h) => h.folder === folder))
236463
236477
  throw new CliError(`Plugin "${id}": ${spec} is the half of another plugin already`);
236464
- halves.push({ id, folder, dir, manifest, entry: join38(dir, web.register), static: web.static });
236478
+ halves.push({ id, folder, dir, manifest, entry: join39(dir, web.register), static: web.static });
236465
236479
  }
236466
236480
  return halves;
236467
236481
  };
@@ -236470,7 +236484,7 @@ var buildHalf = (half, opts = {}) => bundleWebHalf({ id: half.id, dir: half.dir,
236470
236484
  });
236471
236485
  var copyStatic = (half, pluginsDir) => {
236472
236486
  if (half.static)
236473
- cpSync5(join38(half.dir, half.static), join38(pluginsDir, half.folder, half.static), { recursive: true });
236487
+ cpSync5(join39(half.dir, half.static), join39(pluginsDir, half.folder, half.static), { recursive: true });
236474
236488
  };
236475
236489
 
236476
236490
  // src/dev/devServer.ts
@@ -236592,7 +236606,7 @@ var startDevServer = async (options) => {
236592
236606
  const liteTable = () => {
236593
236607
  let plugins = {};
236594
236608
  try {
236595
- plugins = JSON.parse(readFileSync31(join39(lite, "plugins.json"), "utf8")).plugins ?? {};
236609
+ plugins = JSON.parse(readFileSync31(join40(lite, "plugins.json"), "utf8")).plugins ?? {};
236596
236610
  } catch {}
236597
236611
  const table = { ...plugins };
236598
236612
  for (const { half, hash } of halves) {
@@ -236656,7 +236670,7 @@ var startDevServer = async (options) => {
236656
236670
  const built = (dir, rel) => {
236657
236671
  if (rel.split("/").some((seg) => seg === ".." || seg === "" || seg === "."))
236658
236672
  return text(400, "text/plain", "Bad path");
236659
- const abs = join39(dir, ...rel.split("/"));
236673
+ const abs = join40(dir, ...rel.split("/"));
236660
236674
  try {
236661
236675
  if (!statSync11(abs).isFile())
236662
236676
  throw new Error("not a file");
@@ -236739,7 +236753,7 @@ var startDevServer = async (options) => {
236739
236753
  const name = route.slice("/shaders/".length);
236740
236754
  if (!isShaderArtifactName(name))
236741
236755
  return text(400, "text/plain", "Bad path");
236742
- const abs = join39(shadersCacheDir(root), name);
236756
+ const abs = join40(shadersCacheDir(root), name);
236743
236757
  try {
236744
236758
  if (!statSync11(abs).isFile())
236745
236759
  throw new Error("not a file");
@@ -236817,7 +236831,7 @@ init_distRoot();
236817
236831
  import { spawnSync as spawnSync8 } from "node:child_process";
236818
236832
  import { existsSync as existsSync35, readdirSync as readdirSync16, statSync as statSync12 } from "node:fs";
236819
236833
  import { createRequire as createRequire6 } from "node:module";
236820
- import { dirname as dirname20, join as join40 } from "node:path";
236834
+ import { dirname as dirname21, join as join41 } from "node:path";
236821
236835
  var PLAYER = {
236822
236836
  pkg: "lecodes-web-player",
236823
236837
  dist: "dist",
@@ -236849,12 +236863,12 @@ var resolveWebRunner = (log = () => {}) => {
236849
236863
  return player ? { player, page: resolve19(PAGE, log) } : null;
236850
236864
  };
236851
236865
  var resolve19 = (built, log) => {
236852
- const has = (dir) => existsSync35(join40(dir, "index.html")) && existsSync35(join40(dir, built.entry));
236866
+ const has = (dir) => existsSync35(join41(dir, "index.html")) && existsSync35(join41(dir, built.entry));
236853
236867
  const checkout = checkoutOf(built.pkg);
236854
236868
  if (checkout) {
236855
- const dist = join40(checkout, built.dist);
236856
- const repo = join40(checkout, "..", "..");
236857
- if (!has(dist) || newest(built.sources.map((s) => join40(repo, s))) > statSync12(join40(dist, built.entry)).mtimeMs) {
236869
+ const dist = join41(checkout, built.dist);
236870
+ const repo = join41(checkout, "..", "..");
236871
+ if (!has(dist) || newest(built.sources.map((s) => join41(repo, s))) > statSync12(join41(dist, built.entry)).mtimeMs) {
236858
236872
  log(`Building ${built.pkg} (its sources are newer than its build)…`);
236859
236873
  const done = spawnSync8("bunx", ["vite", "build", ...built.build], { cwd: checkout, stdio: "pipe", encoding: "utf8", shell: process.platform === "win32" });
236860
236874
  if (done.status !== 0)
@@ -236871,13 +236885,13 @@ ${step.stderr || step.stdout}`);
236871
236885
  if (has(dist))
236872
236886
  return dist;
236873
236887
  }
236874
- const vendored = join40(distRoot, "runtime", built.vendored);
236888
+ const vendored = join41(distRoot, "runtime", built.vendored);
236875
236889
  return has(vendored) ? vendored : null;
236876
236890
  };
236877
236891
  var checkoutOf = (pkg) => {
236878
236892
  try {
236879
- const dir = dirname20(createRequire6(import.meta.url).resolve(`${pkg}/package.json`));
236880
- return existsSync35(join40(dir, "vite.config.ts")) && existsSync35(join40(dir, "src")) ? dir : null;
236893
+ const dir = dirname21(createRequire6(import.meta.url).resolve(`${pkg}/package.json`));
236894
+ return existsSync35(join41(dir, "vite.config.ts")) && existsSync35(join41(dir, "src")) ? dir : null;
236881
236895
  } catch {
236882
236896
  return null;
236883
236897
  }
@@ -236897,7 +236911,7 @@ var newest = (paths) => {
236897
236911
  }
236898
236912
  for (const name of readdirSync16(path))
236899
236913
  if (name !== "node_modules" && name !== "ios" && name !== "android")
236900
- walk(join40(path, name));
236914
+ walk(join41(path, name));
236901
236915
  };
236902
236916
  for (const path of paths)
236903
236917
  walk(path);
@@ -236965,7 +236979,7 @@ init_browserAuth();
236965
236979
  // src/dev/androidDev.ts
236966
236980
  init_cli();
236967
236981
  import { existsSync as existsSync36, writeFileSync as writeFileSync24 } from "node:fs";
236968
- import { join as join41 } from "node:path";
236982
+ import { join as join42 } from "node:path";
236969
236983
  import { spawnSync as spawnSync9 } from "node:child_process";
236970
236984
  var DEFAULT_ANDROID_PACKAGE = "com.letary.lecodes";
236971
236985
  var adbCandidates = () => {
@@ -236976,12 +236990,12 @@ var adbCandidates = () => {
236976
236990
  const exe = process.platform === "win32" ? "adb.exe" : "adb";
236977
236991
  for (const home of [process.env.ANDROID_HOME, process.env.ANDROID_SDK_ROOT]) {
236978
236992
  if (home)
236979
- out.push(join41(home, "platform-tools", exe));
236993
+ out.push(join42(home, "platform-tools", exe));
236980
236994
  }
236981
236995
  if (process.platform === "win32" && process.env.LOCALAPPDATA)
236982
- out.push(join41(process.env.LOCALAPPDATA, "Android", "Sdk", "platform-tools", exe));
236996
+ out.push(join42(process.env.LOCALAPPDATA, "Android", "Sdk", "platform-tools", exe));
236983
236997
  if (process.env.HOME)
236984
- out.push(join41(process.env.HOME, "Android", "Sdk", "platform-tools", exe), join41(process.env.HOME, "Library", "Android", "sdk", "platform-tools", exe));
236998
+ out.push(join42(process.env.HOME, "Android", "Sdk", "platform-tools", exe), join42(process.env.HOME, "Library", "Android", "sdk", "platform-tools", exe));
236985
236999
  return out;
236986
237000
  };
236987
237001
  var run2 = (adb, args, input) => {
@@ -237087,7 +237101,7 @@ var androidCrashLines = (session) => {
237087
237101
  init_cli();
237088
237102
  import { existsSync as existsSync37, readdirSync as readdirSync17, readFileSync as readFileSync32, statSync as statSync13, unlinkSync } from "node:fs";
237089
237103
  import { homedir as homedir12 } from "node:os";
237090
- import { join as join42 } from "node:path";
237104
+ import { join as join43 } from "node:path";
237091
237105
  import { spawnSync as spawnSync10 } from "node:child_process";
237092
237106
  var DEFAULT_IOS_BUNDLE = "com.letary.lecodes";
237093
237107
  var run3 = (args) => {
@@ -237113,7 +237127,7 @@ var listSimulators = () => {
237113
237127
  }
237114
237128
  };
237115
237129
  var listDevices2 = () => {
237116
- const tmp = join42(process.env.TMPDIR ?? "/tmp", `lecodes-devicectl-${process.pid}.json`);
237130
+ const tmp = join43(process.env.TMPDIR ?? "/tmp", `lecodes-devicectl-${process.pid}.json`);
237117
237131
  const { ok } = run3(["devicectl", "list", "devices", "--json-output", tmp]);
237118
237132
  if (!ok || !existsSync37(tmp))
237119
237133
  return [];
@@ -237160,7 +237174,7 @@ var pickTarget = (udid) => {
237160
237174
  };
237161
237175
  var simulatorHasApp = (udid, bundleId) => run3(["simctl", "get_app_container", udid, bundleId]).ok;
237162
237176
  var deviceHasApp = (udid, bundleId) => {
237163
- const tmp = join42(process.env.TMPDIR ?? "/tmp", `lecodes-devicectl-apps-${process.pid}.json`);
237177
+ const tmp = join43(process.env.TMPDIR ?? "/tmp", `lecodes-devicectl-apps-${process.pid}.json`);
237164
237178
  const { ok } = run3(["devicectl", "device", "info", "apps", "--device", udid, "--json-output", tmp]);
237165
237179
  if (!ok || !existsSync37(tmp))
237166
237180
  return false;
@@ -237200,7 +237214,7 @@ var launchOnIos = (opts) => {
237200
237214
  throw new CliError(`Could not launch ${bundleId} on ${target.name}: ${start.out}`);
237201
237215
  pid = /:\s*(\d+)\s*$/.exec(start.out)?.[1] ?? null;
237202
237216
  } else {
237203
- const tmp = join42(process.env.TMPDIR ?? "/tmp", `lecodes-devicectl-launch-${process.pid}.json`);
237217
+ const tmp = join43(process.env.TMPDIR ?? "/tmp", `lecodes-devicectl-launch-${process.pid}.json`);
237204
237218
  const start = run3(["devicectl", "device", "process", "launch", "--device", target.udid, "--terminate-existing", "--json-output", tmp, bundleId, "--lecodes-url", url]);
237205
237219
  if (!start.ok)
237206
237220
  throw new CliError(`Could not launch ${bundleId} on ${target.name}: ${start.out}`);
@@ -237240,11 +237254,11 @@ var launchOnIos = (opts) => {
237240
237254
  crashLines: () => {
237241
237255
  if (target.kind !== "simulator")
237242
237256
  return [];
237243
- const dir = join42(homedir12(), "Library", "Logs", "DiagnosticReports");
237257
+ const dir = join43(homedir12(), "Library", "Logs", "DiagnosticReports");
237244
237258
  if (!existsSync37(dir))
237245
237259
  return [];
237246
237260
  const appName = bundleId.split(".").pop() ?? "";
237247
- return readdirSync17(dir).filter((f) => f.endsWith(".ips") && (f.startsWith("LeCodes") || appName && f.toLowerCase().startsWith(appName.toLowerCase()))).filter((f) => statSync13(join42(dir, f)).mtimeMs >= launchedAt).map((f) => join42(dir, f));
237261
+ return readdirSync17(dir).filter((f) => f.endsWith(".ips") && (f.startsWith("LeCodes") || appName && f.toLowerCase().startsWith(appName.toLowerCase()))).filter((f) => statSync13(join43(dir, f)).mtimeMs >= launchedAt).map((f) => join43(dir, f));
237248
237262
  }
237249
237263
  };
237250
237264
  };
@@ -237275,14 +237289,14 @@ var lanCandidates = () => {
237275
237289
  return out.sort((x, y) => x.rank - y.rank).map(({ address, iface }) => ({ address, iface }));
237276
237290
  };
237277
237291
  var loadDevToken = (root) => {
237278
- const path = join43(root, LECODES_DIR, "dev.json");
237292
+ const path = join44(root, LECODES_DIR, "dev.json");
237279
237293
  try {
237280
237294
  const token = JSON.parse(readFileSync33(path, "utf8")).token;
237281
237295
  if (token && /^[a-z0-9]{8,}$/.test(token))
237282
237296
  return token;
237283
237297
  } catch {}
237284
237298
  const token = randomBytes5(6).toString("hex");
237285
- mkdirSync22(join43(root, LECODES_DIR), { recursive: true });
237299
+ mkdirSync22(join44(root, LECODES_DIR), { recursive: true });
237286
237300
  writeFileSync25(path, JSON.stringify({ token }, null, 2) + `
237287
237301
  `);
237288
237302
  return token;
@@ -237394,7 +237408,7 @@ ${result.error}`);
237394
237408
  if (alternatives.length > 0) {
237395
237409
  note(`Device can't reach it? This machine also has ${alternatives.map((a) => `${a.address} (${a.iface})`).join(", ")} — retry with --host <ip>.`);
237396
237410
  }
237397
- if (existsSync38(join43(root, LECODES_DIR, "manifest.json")))
237411
+ if (existsSync38(join44(root, LECODES_DIR, "manifest.json")))
237398
237412
  note(`Token stored in ${LECODES_DIR}/dev.json (delete it to rotate the URL).`);
237399
237413
  log("");
237400
237414
  log(`Watching ${root} — save a file to hot-reload. Ctrl+C to stop.`);
@@ -237512,7 +237526,7 @@ init_cli();
237512
237526
  // src/commands/hub/create.ts
237513
237527
  init_cli();
237514
237528
  import { existsSync as existsSync40, realpathSync as realpathSync3 } from "node:fs";
237515
- import { join as join46, resolve as resolve20 } from "node:path";
237529
+ import { join as join47, resolve as resolve20 } from "node:path";
237516
237530
 
237517
237531
  // src/hub/api.ts
237518
237532
  init_cli();
@@ -237669,9 +237683,9 @@ var followDeployLog = async (base, token, ns, name, number, onText) => {
237669
237683
  init_cli();
237670
237684
  import { chmodSync as chmodSync2, mkdirSync as mkdirSync23, readFileSync as readFileSync34, writeFileSync as writeFileSync26 } from "node:fs";
237671
237685
  import { homedir as homedir13 } from "node:os";
237672
- import { join as join44 } from "node:path";
237686
+ import { join as join45 } from "node:path";
237673
237687
  var DEFAULT_HUB = "https://hub.le.codes";
237674
- var hubConfigPath = () => join44(homedir13(), ".lecodes", "hub.json");
237688
+ var hubConfigPath = () => join45(homedir13(), ".lecodes", "hub.json");
237675
237689
  var normalizeHubUrl = (url) => {
237676
237690
  const trimmed = url.trim().replace(/\/+$/, "");
237677
237691
  let parsed;
@@ -237700,7 +237714,7 @@ var requireHubConfig = () => {
237700
237714
  };
237701
237715
  var saveHubConfig = (config) => {
237702
237716
  const file = hubConfigPath();
237703
- mkdirSync23(join44(file, ".."), { recursive: true });
237717
+ mkdirSync23(join45(file, ".."), { recursive: true });
237704
237718
  writeFileSync26(file, JSON.stringify(config, null, 2) + `
237705
237719
  `, { mode: 384 });
237706
237720
  chmodSync2(file, 384);
@@ -237711,7 +237725,7 @@ var saveHubConfig = (config) => {
237711
237725
  init_cli();
237712
237726
  import { spawnSync as spawnSync11 } from "node:child_process";
237713
237727
  import { existsSync as existsSync39, realpathSync as realpathSync2 } from "node:fs";
237714
- import { basename as basename16, delimiter as delimiter2, join as join45 } from "node:path";
237728
+ import { basename as basename16, delimiter as delimiter2, join as join46 } from "node:path";
237715
237729
  var git2 = (args, cwd = process.cwd()) => {
237716
237730
  const r = spawnSync11("git", args, { cwd, encoding: "utf8", windowsHide: true });
237717
237731
  if (r.error)
@@ -237781,7 +237795,7 @@ var onPathAs = (target) => {
237781
237795
  return (process.env.PATH ?? "").split(delimiter2).some((d) => {
237782
237796
  if (!d)
237783
237797
  return false;
237784
- const cand = join45(d, exe);
237798
+ const cand = join46(d, exe);
237785
237799
  return existsSync39(cand) && real(cand) === want;
237786
237800
  });
237787
237801
  };
@@ -237867,7 +237881,7 @@ var create_default2 = defineCommand({
237867
237881
  examples: ["lecodes hub create demo", "lecodes hub create den/demo --private"],
237868
237882
  run: async ({ args, flags }) => {
237869
237883
  const cwd = process.cwd();
237870
- if (!existsSync40(join46(cwd, "app.json"))) {
237884
+ if (!existsSync40(join47(cwd, "app.json"))) {
237871
237885
  throw new CliError("No app.json in this folder — a hub project is a folder with app.json. Run `lecodes init` first (or cd into the project).");
237872
237886
  }
237873
237887
  if (!args[0])
@@ -238314,7 +238328,7 @@ init_manifest();
238314
238328
  init_types4();
238315
238329
  init_ignore();
238316
238330
  import { existsSync as existsSync41, mkdirSync as mkdirSync24, writeFileSync as writeFileSync27 } from "node:fs";
238317
- import { basename as basename17, dirname as dirname21, join as join47, resolve as resolve21 } from "node:path";
238331
+ import { basename as basename17, dirname as dirname22, join as join48, resolve as resolve21 } from "node:path";
238318
238332
  init_cli();
238319
238333
  var STARTER2 = `// Welcome to LeCodes — the whole SDK is available as globals, no imports needed.
238320
238334
  // Run it live on a device with \`lecodes dev\`, or bundle it with \`lecodes compile -o app.js\`.
@@ -238432,12 +238446,12 @@ var init3 = (dir, forDesktop) => {
238432
238446
  mkdirSync24(root, { recursive: true });
238433
238447
  let created = 0;
238434
238448
  const write = (rel, content) => {
238435
- const abs = join47(root, rel);
238449
+ const abs = join48(root, rel);
238436
238450
  if (existsSync41(abs)) {
238437
238451
  note(`kept ${rel}`);
238438
238452
  return;
238439
238453
  }
238440
- mkdirSync24(dirname21(abs), { recursive: true });
238454
+ mkdirSync24(dirname22(abs), { recursive: true });
238441
238455
  writeFileSync27(abs, content);
238442
238456
  log(`${c.green("created")} ${rel}`);
238443
238457
  created++;
@@ -238483,7 +238497,7 @@ init_cli();
238483
238497
  import { execFileSync as execFileSync7 } from "node:child_process";
238484
238498
  import { appendFileSync as appendFileSync3, chmodSync as chmodSync3, cpSync as cpSync6, existsSync as existsSync42, mkdirSync as mkdirSync25, readFileSync as readFileSync36, realpathSync as realpathSync4, rmSync as rmSync11, symlinkSync as symlinkSync2 } from "node:fs";
238485
238499
  import { homedir as homedir14 } from "node:os";
238486
- import { basename as basename18, delimiter as delimiter3, dirname as dirname22, join as join48, resolve as resolve22 } from "node:path";
238500
+ import { basename as basename18, delimiter as delimiter3, dirname as dirname23, join as join49, resolve as resolve22 } from "node:path";
238487
238501
  var isWin = process.platform === "win32";
238488
238502
  var HOME = homedir14();
238489
238503
  var safeRealpath = (p) => {
@@ -238510,9 +238524,9 @@ var copyBundle = (bundle, target, companions) => {
238510
238524
  if (safeRealpath(target) === safeRealpath(bundle))
238511
238525
  return;
238512
238526
  for (const f of companions) {
238513
- const dest = join48(target, f);
238527
+ const dest = join49(target, f);
238514
238528
  rmSync11(dest, { recursive: true, force: true });
238515
- cpSync6(join48(bundle, f), dest, { recursive: true });
238529
+ cpSync6(join49(bundle, f), dest, { recursive: true });
238516
238530
  }
238517
238531
  };
238518
238532
  var permError = (e, dir, system) => {
@@ -238525,10 +238539,10 @@ var permError = (e, dir, system) => {
238525
238539
  var shellRc = () => {
238526
238540
  const shell = basename18(process.env.SHELL ?? "");
238527
238541
  if (shell === "zsh")
238528
- return { file: join48(HOME, ".zshrc"), name: "~/.zshrc" };
238542
+ return { file: join49(HOME, ".zshrc"), name: "~/.zshrc" };
238529
238543
  if (shell === "bash")
238530
- return { file: join48(HOME, ".bashrc"), name: "~/.bashrc" };
238531
- return { file: join48(HOME, ".profile"), name: "~/.profile" };
238544
+ return { file: join49(HOME, ".bashrc"), name: "~/.bashrc" };
238545
+ return { file: join49(HOME, ".profile"), name: "~/.profile" };
238532
238546
  };
238533
238547
  var PATH_MARKER = "# Added by `lecodes install`";
238534
238548
  var appendPathToShellRc = (binDir) => {
@@ -238574,25 +238588,25 @@ var finishPathUnix = (modifyPath, binDir) => {
238574
238588
  };
238575
238589
  var installUnix = (opts, bundle, companions) => {
238576
238590
  const { system } = opts;
238577
- const libDir = resolve22(opts.dir ?? (system ? "/usr/local/lib/lecodes-cli" : join48(HOME, ".local", "lib", "lecodes-cli")));
238578
- const binDir = resolve22(opts.bin ?? (system ? "/usr/local/bin" : join48(HOME, ".local", "bin")));
238579
- const link = join48(binDir, "lecodes");
238591
+ const libDir = resolve22(opts.dir ?? (system ? "/usr/local/lib/lecodes-cli" : join49(HOME, ".local", "lib", "lecodes-cli")));
238592
+ const binDir = resolve22(opts.bin ?? (system ? "/usr/local/bin" : join49(HOME, ".local", "bin")));
238593
+ const link = join49(binDir, "lecodes");
238580
238594
  try {
238581
238595
  copyBundle(bundle, libDir, companions);
238582
- chmodSync3(join48(libDir, "lecodes"), 493);
238583
- chmodSync3(join48(libDir, "chisel"), 493);
238596
+ chmodSync3(join49(libDir, "lecodes"), 493);
238597
+ chmodSync3(join49(libDir, "chisel"), 493);
238584
238598
  } catch (e) {
238585
238599
  throw permError(e, libDir, system);
238586
238600
  }
238587
238601
  try {
238588
238602
  mkdirSync25(binDir, { recursive: true });
238589
238603
  rmSync11(link, { force: true });
238590
- symlinkSync2(join48(libDir, "lecodes"), link);
238604
+ symlinkSync2(join49(libDir, "lecodes"), link);
238591
238605
  } catch (e) {
238592
238606
  throw permError(e, binDir, system);
238593
238607
  }
238594
238608
  success(`Installed to ${c.bold(libDir)}`);
238595
- log(` ${c.dim(link + " → " + join48(libDir, "lecodes"))}`);
238609
+ log(` ${c.dim(link + " → " + join49(libDir, "lecodes"))}`);
238596
238610
  finishPathUnix(opts.modifyPath, binDir);
238597
238611
  };
238598
238612
  var addToUserPathWindows = (dir) => {
@@ -238605,7 +238619,7 @@ var addToUserPathWindows = (dir) => {
238605
238619
  }
238606
238620
  };
238607
238621
  var installWindows = (opts, bundle, companions) => {
238608
- const target = resolve22(opts.dir ?? join48(process.env.LOCALAPPDATA ?? join48(HOME, "AppData", "Local"), "Programs", "lecodes-cli"));
238622
+ const target = resolve22(opts.dir ?? join49(process.env.LOCALAPPDATA ?? join49(HOME, "AppData", "Local"), "Programs", "lecodes-cli"));
238609
238623
  try {
238610
238624
  copyBundle(bundle, target, companions);
238611
238625
  } catch (e) {
@@ -238642,13 +238656,13 @@ var install_default = defineCommand({
238642
238656
  },
238643
238657
  examples: ["lecodes install --modify-path", "sudo lecodes install --system"],
238644
238658
  run: ({ flags }) => {
238645
- const bundle = dirname22(process.execPath);
238659
+ const bundle = dirname23(process.execPath);
238646
238660
  const exeName = basename18(process.execPath);
238647
238661
  const chiselName = isWin ? "chisel.exe" : "chisel";
238648
- if (!existsSync42(join48(bundle, "runtime")) || !existsSync42(join48(bundle, chiselName))) {
238662
+ if (!existsSync42(join49(bundle, "runtime")) || !existsSync42(join49(bundle, chiselName))) {
238649
238663
  throw new CliError("`lecodes install` only works from the packaged release build (the archive containing lecodes + " + "chisel + runtime/). You appear to be running from source or an npm install — install globally " + "with your package manager there instead.");
238650
238664
  }
238651
- const companions = [exeName, chiselName, "runtime", "README.txt"].filter((f) => existsSync42(join48(bundle, f)));
238665
+ const companions = [exeName, chiselName, "runtime", "README.txt"].filter((f) => existsSync42(join49(bundle, f)));
238652
238666
  const opts = { modifyPath: flags["modify-path"], system: flags.system, dir: flags.dir, bin: flags.bin };
238653
238667
  if (isWin)
238654
238668
  return installWindows(opts, bundle, companions);
@@ -238659,7 +238673,7 @@ var install_default = defineCommand({
238659
238673
  // src/commands/lightmap.ts
238660
238674
  import { existsSync as existsSync43, mkdirSync as mkdirSync26, mkdtempSync as mkdtempSync4, readdirSync as readdirSync18, readFileSync as readFileSync37, rmSync as rmSync12, writeFileSync as writeFileSync28 } from "node:fs";
238661
238675
  import { tmpdir as tmpdir4 } from "node:os";
238662
- import { basename as basename19, dirname as dirname23, join as join49, relative as relative7, resolve as resolve23, sep as sep5 } from "node:path";
238676
+ import { basename as basename19, dirname as dirname24, join as join50, relative as relative7, resolve as resolve23, sep as sep5 } from "node:path";
238663
238677
  import { deflateSync } from "node:zlib";
238664
238678
  init_cli();
238665
238679
  init_shared();
@@ -238745,9 +238759,9 @@ var findBakes = (root) => {
238745
238759
  for (const e of readdirSync18(dir, { withFileTypes: true })) {
238746
238760
  if (e.isDirectory()) {
238747
238761
  if (!SKIP.has(e.name))
238748
- walk(join49(dir, e.name));
238762
+ walk(join50(dir, e.name));
238749
238763
  } else if (/\.bake$/i.test(e.name))
238750
- out.push(relative7(root, join49(dir, e.name)).replace(/\\/g, "/"));
238764
+ out.push(relative7(root, join50(dir, e.name)).replace(/\\/g, "/"));
238751
238765
  }
238752
238766
  };
238753
238767
  walk(root);
@@ -238893,13 +238907,13 @@ import ${JSON.stringify(importPath)}
238893
238907
  });
238894
238908
  const target = pickTarget2(bakes, flags.name, entryFile);
238895
238909
  const stem = stemOf(target.path);
238896
- const outDir = flags.out ? resolve23(root, flags.out) : dirname23(target.absPath);
238910
+ const outDir = flags.out ? resolve23(root, flags.out) : dirname24(target.absPath);
238897
238911
  mkdirSync26(outDir, { recursive: true });
238898
238912
  if (debugDir)
238899
238913
  mkdirSync26(debugDir, { recursive: true });
238900
- note(`Target: ${relative7(root, join49(outDir, `${stem}.bake`)).replace(/\\/g, "/")}${target.exists ? "" : " (the first bake: nothing there yet)"}${flags.out ? " (--out)" : ""}`);
238901
- const scratch = mkdtempSync4(join49(tmpdir4(), "lecodes-lightmap-"));
238902
- const outPng = join49(scratch, "frame.png");
238914
+ note(`Target: ${relative7(root, join50(outDir, `${stem}.bake`)).replace(/\\/g, "/")}${target.exists ? "" : " (the first bake: nothing there yet)"}${flags.out ? " (--out)" : ""}`);
238915
+ const scratch = mkdtempSync4(join50(tmpdir4(), "lecodes-lightmap-"));
238916
+ const outPng = join50(scratch, "frame.png");
238903
238917
  const bounce = cfg.bounceRays > 0 && cfg.bounces > 0 ? `, ${cfg.bounceRays} bounce paths of ${cfg.bounces}${cfg.patchSamples > 0 ? ` + ${cfg.patchSamples} patch samples` : ""}${cfg.denoise !== "none" ? `, denoised (${cfg.denoise})` : ", raw"}` : ", no bounce";
238904
238918
  note(`Baking up to ${cfg.pages} × ${cfg.size}² at ${(cfg.texel * 100).toFixed(1)} cm texels (${cfg.sunRays} sun + ${cfg.skyRays} sky + ${cfg.lightRays} lamp rays${bounce}) → ${relative7(root, outDir).split(sep5).join("/") || "."}/${stem}.*…`);
238905
238919
  let output = "";
@@ -238968,7 +238982,7 @@ import ${JSON.stringify(importPath)}
238968
238982
  return;
238969
238983
  }
238970
238984
  if (/\[lightmap\] done/.test(output)) {
238971
- const data = readBake(join49(outDir, `${stem}.bake`));
238985
+ const data = readBake(join50(outDir, `${stem}.bake`));
238972
238986
  const splitFiles = data.direct && data.indirect ? ` + ${data.direct.join(", ")} + ${data.indirect.join(", ")}` : "";
238973
238987
  const probeFiles = data.probes ? ` + ${data.probes.file} (${data.probes.count} probe(s) of ${data.probes.size}² at ${data.probes.spacing} m)` : "";
238974
238988
  const gridFile = data.volume ? ` + ${data.volume.file} (light grid ${data.volume.n.join(" x ")}, ${data.volume.valid} cell(s) in free space)` : "";
@@ -238976,8 +238990,8 @@ import ${JSON.stringify(importPath)}
238976
238990
  logErr(c.green(`✓ baked → ${relative7(root, outDir).replace(/\\/g, "/") || "."}/${stem}.bake + ${data.light.join(", ")} + ${data.aux.join(", ")}${splitFiles}${probeFiles}${gridFile}${uv1File}`));
238977
238991
  logErr(c.dim(flags.out ? ` written to --out: the level's bake() still reads ${target.path}` : ` the manifest names them: the next compile of ${entryFile} stages them (bake('…') in the scene reads it)`));
238978
238992
  if (debugDir)
238979
- logErr(c.dim(` debug layers: ${relative7(root, debugDir)} (lecodes lightmap inspect --bake ${relative7(root, join49(outDir, `${stem}.bake`)).replace(/\\/g, "/")} --debug-dir ${relative7(root, debugDir).replace(/\\/g, "/")})`));
238980
- stitchLevelCache(root, join49(outDir, `${stem}.static`), data);
238993
+ logErr(c.dim(` debug layers: ${relative7(root, debugDir)} (lecodes lightmap inspect --bake ${relative7(root, join50(outDir, `${stem}.bake`)).replace(/\\/g, "/")} --debug-dir ${relative7(root, debugDir).replace(/\\/g, "/")})`));
238994
+ stitchLevelCache(root, join50(outDir, `${stem}.static`), data);
238981
238995
  return;
238982
238996
  }
238983
238997
  if (/\[lightmap\] error: this host has no bake module/.test(output)) {
@@ -239070,7 +239084,7 @@ var diff = defineCommand({
239070
239084
  throw new CliError(`--layer: expected irradiance, bounce, sun, sky or lamps, got ${JSON.stringify(layer)}`);
239071
239085
  const n = a.instances.length;
239072
239086
  const texels = new Float64Array(n), sumMean = new Float64Array(n), sumVar = new Float64Array(n), off = new Float64Array(n);
239073
- const pageFile = (dir, stem, kind, page) => join49(dir, `${stem}-${kind}${page > 0 ? `_${page}` : ""}.pfm`);
239087
+ const pageFile = (dir, stem, kind, page) => join50(dir, `${stem}-${kind}${page > 0 ? `_${page}` : ""}.pfm`);
239074
239088
  for (let pg = 0;pg < a.pages; pg++) {
239075
239089
  const fa = pageFile(dirA, stemA, layer, pg), fb = pageFile(dirB, stemB, layer, pg), fi = pageFile(dirA, stemA, "ids", pg), fn = pageFile(dirA, stemA, "normal", pg);
239076
239090
  for (const f of [fa, fb, fi, fn])
@@ -239243,7 +239257,7 @@ var inspect = defineCommand({
239243
239257
  const [lo, hi] = flags["lux-range"].split(",").map(Number);
239244
239258
  const white = flags.white;
239245
239259
  const toneOf = (layer) => layer === "irradiance" || layer === "sun" || layer === "sky" || layer === "lamps" || layer === "bounce" || layer === "bounce-raw" || layer === "probes" ? white > 0 ? "linear" : "log" : layer === "direction" || layer === "normal" ? "normal" : layer === "position" ? "raw" : layer === "ids" ? "raw" : "raw";
239246
- const pageFile = (layer, page) => join49(dbg, `${stem}-${layer}${page > 0 ? `_${page}` : ""}.pfm`);
239260
+ const pageFile = (layer, page) => join50(dbg, `${stem}-${layer}${page > 0 ? `_${page}` : ""}.pfm`);
239247
239261
  const receivers = data.instances.filter((i) => i.receiver && i.rect);
239248
239262
  const re = flags.key ? new RegExp(flags.key) : null;
239249
239263
  const size = data.size;
@@ -239281,7 +239295,7 @@ var inspect = defineCommand({
239281
239295
  return [toneMap(L.data[i], tone, lo, hi, white), toneMap(L.data[i + 1], tone, lo, hi, white), toneMap(L.data[i + 2], tone, lo, hi, white)];
239282
239296
  };
239283
239297
  if (!re && layers.includes("probes")) {
239284
- const f = join49(dbg, `${stem}-probes.pfm`);
239298
+ const f = join50(dbg, `${stem}-probes.pfm`);
239285
239299
  if (!existsSync43(f))
239286
239300
  throw new CliError(`No ${relative7(root, f)} — bake with --probe-spacing > 0 and --debug-dir ${relative7(root, dbg) || "."} first.`);
239287
239301
  const L = readPfm(f);
@@ -239294,7 +239308,7 @@ var inspect = defineCommand({
239294
239308
  rgb[o + 1] = p[1];
239295
239309
  rgb[o + 2] = p[2];
239296
239310
  }
239297
- const file = join49(outDir, `${stem}-probes.png`);
239311
+ const file = join50(outDir, `${stem}-probes.png`);
239298
239312
  writePng(file, L.w, L.h, rgb);
239299
239313
  written++;
239300
239314
  logErr(c.dim(` ${relative7(root, file)} (${data.probes?.count ?? L.h / (L.w / 6)} probe(s), faces +X -X +Y -Y +Z -Z per row)`));
@@ -239334,7 +239348,7 @@ var inspect = defineCommand({
239334
239348
  rgb[o + 2] = 255;
239335
239349
  }
239336
239350
  }
239337
- const file = join49(outDir, `${stem}-${layer}${page > 0 ? `_${page}` : ""}.png`);
239351
+ const file = join50(outDir, `${stem}-${layer}${page > 0 ? `_${page}` : ""}.png`);
239338
239352
  writePng(file, size, size, rgb);
239339
239353
  written++;
239340
239354
  logErr(c.dim(` ${relative7(root, file)}`));
@@ -239370,7 +239384,7 @@ var inspect = defineCommand({
239370
239384
  }
239371
239385
  }
239372
239386
  const safe = r.key.replace(/[^A-Za-z0-9_.-]+/g, "_");
239373
- const file = join49(outDir, `${safe}-${layer}.png`);
239387
+ const file = join50(outDir, `${safe}-${layer}.png`);
239374
239388
  writePng(file, cw, chh, rgb);
239375
239389
  written++;
239376
239390
  }
@@ -239392,7 +239406,7 @@ var lightmap_default = defineCommand({
239392
239406
  init_cli();
239393
239407
  init_api();
239394
239408
  import { existsSync as existsSync45 } from "node:fs";
239395
- import { basename as basename21, join as join50, resolve as resolve25 } from "node:path";
239409
+ import { basename as basename21, join as join51, resolve as resolve25 } from "node:path";
239396
239410
  init_ignore();
239397
239411
  init_localFiles();
239398
239412
  init_manifest();
@@ -239723,7 +239737,7 @@ var link_default = defineCommand({
239723
239737
  const root = dirArg ? resolve25(dirArg) : process.cwd();
239724
239738
  if (!existsSync45(root))
239725
239739
  throw new CliError(`No such directory: ${root}`);
239726
- if (existsSync45(join50(root, LECODES_DIR, "manifest.json")) && !flags.force) {
239740
+ if (existsSync45(join51(root, LECODES_DIR, "manifest.json")) && !flags.force) {
239727
239741
  throw new CliError("This folder is already linked (.lecodes/manifest.json exists) — use `lecodes push`, or `lecodes link --force` to re-link it to another project.");
239728
239742
  }
239729
239743
  let enclosing = null;
@@ -239811,7 +239825,7 @@ var login_default2 = defineCommand({
239811
239825
  // src/commands/navmesh.ts
239812
239826
  import { existsSync as existsSync46, mkdirSync as mkdirSync27, mkdtempSync as mkdtempSync5, readdirSync as readdirSync19, readFileSync as readFileSync40, rmSync as rmSync13, statSync as statSync14, unlinkSync as unlinkSync2, writeFileSync as writeFileSync29 } from "node:fs";
239813
239827
  import { tmpdir as tmpdir5 } from "node:os";
239814
- import { basename as basename22, join as join51, relative as relative8, resolve as resolve26 } from "node:path";
239828
+ import { basename as basename22, join as join52, relative as relative8, resolve as resolve26 } from "node:path";
239815
239829
  init_cli();
239816
239830
  init_shared();
239817
239831
 
@@ -240606,7 +240620,7 @@ var range2 = (name, value, fallback, min, max) => {
240606
240620
  return n;
240607
240621
  };
240608
240622
  var guessNavmeshName = (root) => {
240609
- const dirs = [join51(root, "src"), root];
240623
+ const dirs = [join52(root, "src"), root];
240610
240624
  for (const dir of dirs) {
240611
240625
  if (!existsSync46(dir))
240612
240626
  continue;
@@ -240620,7 +240634,7 @@ var guessNavmeshName = (root) => {
240620
240634
  if (!f.endsWith(".scene.ts"))
240621
240635
  continue;
240622
240636
  try {
240623
- if (/\bnavmesh\s*:/.test(readFileSync40(join51(dir, f), "utf8")))
240637
+ if (/\bnavmesh\s*:/.test(readFileSync40(join52(dir, f), "utf8")))
240624
240638
  return f.slice(0, -".scene.ts".length);
240625
240639
  } catch {}
240626
240640
  }
@@ -240671,7 +240685,7 @@ var NAVMESH_FLAGS = {
240671
240685
  "keep-geometry": bool("keep the host's <name>.navgeo dump")
240672
240686
  };
240673
240687
  var finishNavmesh = async (root, outDir, name, output, flags) => {
240674
- const navmeshPath = join51(outDir, `${name}.navmesh`);
240688
+ const navmeshPath = join52(outDir, `${name}.navmesh`);
240675
240689
  const lines = output.split(/\r?\n/).filter((l) => l.includes("[navmesh]")).map((l) => l.slice(l.indexOf("[navmesh]")));
240676
240690
  let config = null;
240677
240691
  let triangles = 0;
@@ -240701,7 +240715,7 @@ var finishNavmesh = async (root, outDir, name, output, flags) => {
240701
240715
  }
240702
240716
  if (!config)
240703
240717
  throw new CliError("The host reported a dump but no `[navmesh] config` line — SDK/host mismatch?");
240704
- const geoPath = join51(outDir, `${name}.navgeo`);
240718
+ const geoPath = join52(outDir, `${name}.navgeo`);
240705
240719
  if (!existsSync46(geoPath))
240706
240720
  throw new CliError(`The host reported a dump but ${geoPath} is missing.`);
240707
240721
  const geo = readNgeo(new Uint8Array(readFileSync40(geoPath)));
@@ -240752,7 +240766,7 @@ var finishNavmesh = async (root, outDir, name, output, flags) => {
240752
240766
  }
240753
240767
  writeFileSync29(navmeshPath, result.data);
240754
240768
  if (flags.obj) {
240755
- const objPath = join51(outDir, `${name}.navmesh.obj`);
240769
+ const objPath = join52(outDir, `${name}.navmesh.obj`);
240756
240770
  writeObj(objPath, navMeshTriangles(mod, result.data));
240757
240771
  logErr(c.dim(` wrote ${relative8(root, objPath)} (the polygon mesh, for inspection)`));
240758
240772
  }
@@ -240797,7 +240811,7 @@ var bake2 = defineCommand({
240797
240811
  const height = win?.height || 720;
240798
240812
  const logs = flags.logs;
240799
240813
  mkdirSync27(outDir, { recursive: true });
240800
- const navmeshPath = join51(outDir, `${name}.navmesh`);
240814
+ const navmeshPath = join52(outDir, `${name}.navmesh`);
240801
240815
  if (!existsSync46(navmeshPath))
240802
240816
  writeFileSync29(navmeshPath, placeholderLnav());
240803
240817
  const importPath = "./" + entryFile.replace(/\\/g, "/").replace(/\.tsx?$/, "");
@@ -240813,8 +240827,8 @@ import ${JSON.stringify(importPath)}
240813
240827
  extraEntries: [{ path: entryPath, type: "text", text: entryText }],
240814
240828
  entryOverride: entryPath
240815
240829
  });
240816
- const scratch = mkdtempSync5(join51(tmpdir5(), "lecodes-navmesh-"));
240817
- const outPng = join51(scratch, "frame.png");
240830
+ const scratch = mkdtempSync5(join52(tmpdir5(), "lecodes-navmesh-"));
240831
+ const outPng = join52(scratch, "frame.png");
240818
240832
  note(`Dumping the level's static collision geometry through the desktop host → ${relative8(root, outDir) || "."}/${name}.navgeo…`);
240819
240833
  let output = "";
240820
240834
  try {
@@ -240853,7 +240867,7 @@ init_cli();
240853
240867
  init_cli();
240854
240868
  import { existsSync as existsSync47, mkdirSync as mkdirSync28, readFileSync as readFileSync41, readdirSync as readdirSync20, statSync as statSync15, writeFileSync as writeFileSync30 } from "node:fs";
240855
240869
  import { createRequire as createRequire7 } from "node:module";
240856
- import { basename as basename23, join as join52, relative as relative9, resolve as resolve27, sep as sep6 } from "node:path";
240870
+ import { basename as basename23, join as join53, relative as relative9, resolve as resolve27, sep as sep6 } from "node:path";
240857
240871
 
240858
240872
  // src/plugin/permissions.ts
240859
240873
  var PERMISSION_KINDS = ["camera", "microphone", "location", "speech"];
@@ -243725,24 +243739,24 @@ const wire = {
243725
243739
  var shown = (from, to) => relative9(from, to).split(sep6).join("/");
243726
243740
  var implementsOf = (dir) => {
243727
243741
  try {
243728
- const raw = JSON.parse(readFileSync41(join52(dir, MANIFEST_FILE), "utf8").replace(/^/, ""));
243742
+ const raw = JSON.parse(readFileSync41(join53(dir, MANIFEST_FILE), "utf8").replace(/^/, ""));
243729
243743
  return typeof raw.implements === "string" ? raw.implements : null;
243730
243744
  } catch {
243731
243745
  return null;
243732
243746
  }
243733
243747
  };
243734
- var isPluginDir = (dir) => existsSync47(join52(dir, CONTRACT_FILE)) || implementsOf(dir) !== null;
243748
+ var isPluginDir = (dir) => existsSync47(join53(dir, CONTRACT_FILE)) || implementsOf(dir) !== null;
243735
243749
  var findPlugins = (path) => {
243736
243750
  const root = resolve27(path);
243737
243751
  if (isPluginDir(root))
243738
243752
  return [{ id: basename23(root), dir: root }];
243739
- const holder = join52(root, "plugins");
243753
+ const holder = join53(root, "plugins");
243740
243754
  if (!existsSync47(holder))
243741
243755
  return [];
243742
- return readdirSync20(holder).sort().map((id) => ({ id, dir: join52(holder, id) })).filter((p) => statSync15(p.dir).isDirectory() && isPluginDir(p.dir));
243756
+ return readdirSync20(holder).sort().map((id) => ({ id, dir: join53(holder, id) })).filter((p) => statSync15(p.dir).isDirectory() && isPluginDir(p.dir));
243743
243757
  };
243744
243758
  var loadTypescript = (dir) => {
243745
- for (const from of [join52(dir, "package.json"), import.meta.url]) {
243759
+ for (const from of [join53(dir, "package.json"), import.meta.url]) {
243746
243760
  try {
243747
243761
  const mod = createRequire7(from)("typescript");
243748
243762
  const ts = mod?.createSourceFile ? mod : mod?.default;
@@ -243755,28 +243769,28 @@ var loadTypescript = (dir) => {
243755
243769
  var generatePlugin = (ts, plugin) => {
243756
243770
  const manifest = readManifestIfAny(plugin.dir, plugin.id);
243757
243771
  const implemented = manifest?.implements;
243758
- const file = implemented ? firstPartyContractFile(implemented) : join52(plugin.dir, CONTRACT_FILE);
243772
+ const file = implemented ? firstPartyContractFile(implemented) : join53(plugin.dir, CONTRACT_FILE);
243759
243773
  const contract = readContract(ts, file, implemented ? firstPartyContractText(file) : readFileSync41(file, "utf8"));
243760
243774
  checkPermissions(plugin, contract, manifest);
243761
243775
  const id = implemented ?? plugin.id;
243762
- const handWritten = existsSync47(join52(plugin.dir, "sdk", `${id}.ts`));
243776
+ const handWritten = existsSync47(join53(plugin.dir, "sdk", `${id}.ts`));
243763
243777
  const single = contract.channels.length === 1;
243764
243778
  const files = implemented ? [] : contract.channels.map((channel) => ({
243765
- file: join52(plugin.dir, "sdk", single ? `${id}.gen.ts` : `${id}.${channel.iface}.gen.ts`),
243779
+ file: join53(plugin.dir, "sdk", single ? `${id}.gen.ts` : `${id}.${channel.iface}.gen.ts`),
243766
243780
  text: emitSdk(contract, channel, { id, handWritten })
243767
243781
  }));
243768
- if (existsSync47(join52(plugin.dir, "ios"))) {
243782
+ if (existsSync47(join53(plugin.dir, "ios"))) {
243769
243783
  const name = single ? contract.channels[0].iface : contract.channels[0].iface + "Plugin";
243770
- files.push({ file: join52(plugin.dir, "ios", `${name}.gen.swift`), text: emitSwift(lower3(contract), { id }) });
243784
+ files.push({ file: join53(plugin.dir, "ios", `${name}.gen.swift`), text: emitSwift(lower3(contract), { id }) });
243771
243785
  }
243772
- if (existsSync47(join52(plugin.dir, "android"))) {
243786
+ if (existsSync47(join53(plugin.dir, "android"))) {
243773
243787
  const name = single ? contract.channels[0].iface : contract.channels[0].iface + "Plugin";
243774
- const pkg = kotlinPackage(join52(plugin.dir, "android"), manifest?.android?.register);
243775
- files.push({ file: join52(pkg.dir, `${name}.gen.kt`), text: emitKotlin(lower3(contract), { id, package: pkg.name }) });
243788
+ const pkg = kotlinPackage(join53(plugin.dir, "android"), manifest?.android?.register);
243789
+ files.push({ file: join53(pkg.dir, `${name}.gen.kt`), text: emitKotlin(lower3(contract), { id, package: pkg.name }) });
243776
243790
  }
243777
- if (existsSync47(join52(plugin.dir, "web"))) {
243778
- files.push({ file: join52(plugin.dir, "web", `${id}.gen.ts`), text: emitWeb(lower3(contract), { id }) });
243779
- const foreign = hostImports(join52(plugin.dir, "web"));
243791
+ if (existsSync47(join53(plugin.dir, "web"))) {
243792
+ files.push({ file: join53(plugin.dir, "web", `${id}.gen.ts`), text: emitWeb(lower3(contract), { id }) });
243793
+ const foreign = hostImports(join53(plugin.dir, "web"));
243780
243794
  if (foreign.length)
243781
243795
  throw new EmitError(`web/ imports the host — a web half depends on its generated file, the document it is handed and the browser:
243782
243796
  ${foreign.map((f) => ` ${f}`).join(`
@@ -243795,7 +243809,7 @@ var checkPermissions = (plugin, contract, manifest) => {
243795
243809
  kinds.push(k);
243796
243810
  if (kinds.length === 0)
243797
243811
  return;
243798
- const androidManifest = join52(plugin.dir, "android", "src", "main", "AndroidManifest.xml");
243812
+ const androidManifest = join53(plugin.dir, "android", "src", "main", "AndroidManifest.xml");
243799
243813
  const androidXml = manifest.android ? existsSync47(androidManifest) ? readFileSync41(androidManifest, "utf8") : "" : null;
243800
243814
  const missing = missingDeclarations(kinds, manifest.ios ? manifest.ios.infoPlist ?? {} : null, androidXml === null ? null : usesPermissions(androidXml), androidXml === null ? null : usesFeatures(androidXml));
243801
243815
  const problems = [];
@@ -243806,13 +243820,13 @@ var checkPermissions = (plugin, contract, manifest) => {
243806
243820
  if (missing.androidFeatures.length)
243807
243821
  problems.push(`android/src/main/AndroidManifest.xml: the contract's @permission implies <uses-feature android:name="…" android:required="false"/> for ${missing.androidFeatures.join(", ")} — without it Play requires the hardware`);
243808
243822
  if (problems.length)
243809
- throw new ManifestError(join52(plugin.dir, MANIFEST_FILE), problems);
243823
+ throw new ManifestError(join53(plugin.dir, MANIFEST_FILE), problems);
243810
243824
  };
243811
243825
  var hostImports = (web) => {
243812
243826
  const found = [];
243813
243827
  const walk = (dir) => {
243814
243828
  for (const entry of readdirSync20(dir).sort()) {
243815
- const path = join52(dir, entry);
243829
+ const path = join53(dir, entry);
243816
243830
  if (statSync15(path).isDirectory()) {
243817
243831
  if (entry !== "node_modules" && entry !== "dist")
243818
243832
  walk(path);
@@ -243824,7 +243838,7 @@ var hostImports = (web) => {
243824
243838
  `).forEach((line, i) => {
243825
243839
  const m = /(?:from\s+|import\s*\(\s*|import\s+)["'](lecodes-[^"']*)["']/.exec(line);
243826
243840
  if (m && !/^\s*\/\//.test(line))
243827
- found.push(`${shown(join52(web, ".."), path)}:${i + 1}: ${m[1]}`);
243841
+ found.push(`${shown(join53(web, ".."), path)}:${i + 1}: ${m[1]}`);
243828
243842
  });
243829
243843
  }
243830
243844
  };
@@ -243832,20 +243846,20 @@ var hostImports = (web) => {
243832
243846
  return found;
243833
243847
  };
243834
243848
  var kotlinPackage = (android, register) => {
243835
- const root = join52(android, "src", "main", "java");
243849
+ const root = join53(android, "src", "main", "java");
243836
243850
  if (register) {
243837
243851
  const name = register.split(".").slice(0, -1).join(".");
243838
- const dir = join52(root, ...name.split("."));
243852
+ const dir = join53(root, ...name.split("."));
243839
243853
  if (name && existsSync47(dir))
243840
243854
  return { dir, name };
243841
243855
  }
243842
243856
  let dir = root;
243843
243857
  while (existsSync47(dir)) {
243844
243858
  const entries = readdirSync20(dir).filter((e) => !e.startsWith("."));
243845
- const dirs = entries.filter((e) => statSync15(join52(dir, e)).isDirectory());
243859
+ const dirs = entries.filter((e) => statSync15(join53(dir, e)).isDirectory());
243846
243860
  if (dirs.length !== 1 || entries.length !== 1)
243847
243861
  break;
243848
- dir = join52(dir, dirs[0]);
243862
+ dir = join53(dir, dirs[0]);
243849
243863
  }
243850
243864
  if (dir === root) {
243851
243865
  throw new EmitError(`android/ has no package yet — make the folder of the plugin's Kotlin package (android/src/main/java/com/example/plugin), the generated file is written into it`);
@@ -243853,7 +243867,7 @@ var kotlinPackage = (android, register) => {
243853
243867
  return { dir, name: relative9(root, dir).split(/[\\/]/).join(".") };
243854
243868
  };
243855
243869
  var repoSdkPath = (root) => {
243856
- const file = join52(root, "package.json");
243870
+ const file = join53(root, "package.json");
243857
243871
  if (!existsSync47(file))
243858
243872
  return DEFAULT_SDK_PATH;
243859
243873
  try {
@@ -243886,7 +243900,7 @@ var generate = (path, opts = {}) => {
243886
243900
  entry.stale.push(name);
243887
243901
  return;
243888
243902
  }
243889
- mkdirSync28(join52(f.file, ".."), { recursive: true });
243903
+ mkdirSync28(join53(f.file, ".."), { recursive: true });
243890
243904
  writeFileSync30(f.file, f.text);
243891
243905
  entry.written.push(name);
243892
243906
  };
@@ -243905,7 +243919,7 @@ var generate = (path, opts = {}) => {
243905
243919
  report.failures.push(e.problems.map((p) => `${shown(root, e.file) || e.file}:${p.line}: ${p.message}`).join(`
243906
243920
  `));
243907
243921
  else if (e instanceof EmitError)
243908
- report.failures.push(`${shown(root, join52(plugin.dir, CONTRACT_FILE))}: ${e.message}`);
243922
+ report.failures.push(`${shown(root, join53(plugin.dir, CONTRACT_FILE))}: ${e.message}`);
243909
243923
  else if (e instanceof ManifestError)
243910
243924
  report.failures.push(`${shown(root, e.file) || e.file}:
243911
243925
  ${e.problems.map((p) => ` ${p}`).join(`
@@ -243917,7 +243931,7 @@ ${e.problems.map((p) => ` ${p}`).join(`
243917
243931
  const isRepo = !(plugins.length === 1 && plugins[0].dir === root);
243918
243932
  if (isRepo && report.failures.length === 0 && manifests.some((m) => m.manifest.ios !== null)) {
243919
243933
  try {
243920
- place({ file: join52(root, PACKAGE_FILE), text: emitPackageSwift(manifests, repoSdkPath(root)) }, report.repo);
243934
+ place({ file: join53(root, PACKAGE_FILE), text: emitPackageSwift(manifests, repoSdkPath(root)) }, report.repo);
243921
243935
  } catch (e) {
243922
243936
  if (e instanceof PackageError)
243923
243937
  report.failures.push(`${PACKAGE_FILE}: ${e.message}`);
@@ -244224,7 +244238,7 @@ init_api();
244224
244238
  init_localFiles();
244225
244239
  init_manifest();
244226
244240
  import { existsSync as existsSync48, mkdirSync as mkdirSync29, rmSync as rmSync14, writeFileSync as writeFileSync31 } from "node:fs";
244227
- import { dirname as dirname24, join as join53 } from "node:path";
244241
+ import { dirname as dirname25, join as join54 } from "node:path";
244228
244242
  init_paths();
244229
244243
  init_types4();
244230
244244
  init_shared();
@@ -244253,7 +244267,7 @@ var pull_default = defineCommand({
244253
244267
  for (const path of Object.keys(manifest.files)) {
244254
244268
  if (remotePaths.has(path))
244255
244269
  continue;
244256
- const abs = join53(root, ...path.replace(/^\//, "").split("/"));
244270
+ const abs = join54(root, ...path.replace(/^\//, "").split("/"));
244257
244271
  if (existsSync48(abs))
244258
244272
  rmSync14(abs);
244259
244273
  }
@@ -244292,8 +244306,8 @@ var pullPaths = async (root, manifest, project, paths, apiUrl, token) => {
244292
244306
  const files = { ...manifest.files };
244293
244307
  for (const asset of targets) {
244294
244308
  const key = pathById.get(asset.id);
244295
- const abs = join53(root, ...key.replace(/^\//, "").split("/"));
244296
- mkdirSync29(dirname24(abs), { recursive: true });
244309
+ const abs = join54(root, ...key.replace(/^\//, "").split("/"));
244310
+ mkdirSync29(dirname25(abs), { recursive: true });
244297
244311
  let sha;
244298
244312
  if (asset.type === "file") {
244299
244313
  if (!asset.file?.src)
@@ -244321,7 +244335,7 @@ init_api();
244321
244335
  init_env2();
244322
244336
  init_shared();
244323
244337
  import { readdirSync as readdirSync21, readFileSync as readFileSync42, statSync as statSync16 } from "node:fs";
244324
- import { join as join54, relative as relative10 } from "node:path";
244338
+ import { join as join55, relative as relative10 } from "node:path";
244325
244339
  var SKIP_DIRS3 = new Set(["node_modules", ".lecodes", ".git", "dist", "design"]);
244326
244340
  var readsOf = (root) => {
244327
244341
  const out = new Map;
@@ -244329,7 +244343,7 @@ var readsOf = (root) => {
244329
244343
  for (const entry of readdirSync21(dir)) {
244330
244344
  if (entry.startsWith("_") || entry.startsWith(".") || SKIP_DIRS3.has(entry))
244331
244345
  continue;
244332
- const path = join54(dir, entry);
244346
+ const path = join55(dir, entry);
244333
244347
  let isDir = false;
244334
244348
  try {
244335
244349
  isDir = statSync16(path).isDirectory();
@@ -244407,7 +244421,7 @@ var set = defineCommand({
244407
244421
  if (flags["from-env"]) {
244408
244422
  const local = readAppEnv(root);
244409
244423
  if (!(name in local))
244410
- throw new CliError(`${name} is not in ${relative10(process.cwd(), join54(root, ".env")) || ".env"} — add a line \`${name}=value\` first`);
244424
+ throw new CliError(`${name} is not in ${relative10(process.cwd(), join55(root, ".env")) || ".env"} — add a line \`${name}=value\` first`);
244411
244425
  value = local[name];
244412
244426
  }
244413
244427
  if (value === undefined) {
@@ -244473,7 +244487,7 @@ var secrets_default = defineCommand({
244473
244487
 
244474
244488
  // src/commands/render.ts
244475
244489
  import { mkdirSync as mkdirSync31, readFileSync as readFileSync44, writeFileSync as writeFileSync33 } from "node:fs";
244476
- import { dirname as dirname25, resolve as resolve31 } from "node:path";
244490
+ import { dirname as dirname26, resolve as resolve31 } from "node:path";
244477
244491
 
244478
244492
  // src/compile/headlessBundle.ts
244479
244493
  init_env2();
@@ -244563,7 +244577,7 @@ init_designMeta();
244563
244577
  init_cli();
244564
244578
  init_paths();
244565
244579
  import { existsSync as existsSync49, readFileSync as readFileSync43, statSync as statSync17 } from "node:fs";
244566
- import { isAbsolute as isAbsolute3, join as join55, relative as relative11, resolve as resolve28 } from "node:path";
244580
+ import { isAbsolute as isAbsolute3, join as join56, relative as relative11, resolve as resolve28 } from "node:path";
244567
244581
  var SCREEN_EXTS = [".ts", ".tsx", ".js", ".jsx", ".mjs"];
244568
244582
  var SCREEN_ENTRY_PATH = "/.screen-entry.ts";
244569
244583
  var DEFAULT_DESIGN_DIR = "design";
@@ -244571,7 +244585,7 @@ var hasSeparator = (file) => file.includes("/") || file.includes("\\");
244571
244585
  var findScreenFile = (root, file, dirFlag) => {
244572
244586
  const candidates = [resolve28(process.cwd(), file)];
244573
244587
  if (!hasSeparator(file)) {
244574
- candidates.push(join55(root, (dirFlag ?? DEFAULT_DESIGN_DIR).replace(/[/\\]+$/, ""), "screens", file));
244588
+ candidates.push(join56(root, (dirFlag ?? DEFAULT_DESIGN_DIR).replace(/[/\\]+$/, ""), "screens", file));
244575
244589
  }
244576
244590
  for (const base of candidates) {
244577
244591
  if (existsSync49(base) && statSync17(base).isFile())
@@ -244586,8 +244600,8 @@ var designDirOf = (root, key) => {
244586
244600
  const m = /^\/(.*)screens\/([^/]+)\.[^./]+$/.exec(key);
244587
244601
  if (!m)
244588
244602
  return null;
244589
- const dir = join55(root, m[1]);
244590
- return existsSync49(join55(dir, "meta.json")) ? { dir, id: m[2] } : null;
244603
+ const dir = join56(root, m[1]);
244604
+ return existsSync49(join56(dir, "meta.json")) ? { dir, id: m[2] } : null;
244591
244605
  };
244592
244606
  var resolveScreenTarget = (root, file, opts = {}) => {
244593
244607
  const abs = findScreenFile(root, file, opts.dir);
@@ -244634,7 +244648,7 @@ init_manifest();
244634
244648
  init_cli();
244635
244649
  import { existsSync as existsSync50, mkdirSync as mkdirSync30, mkdtempSync as mkdtempSync6, rmSync as rmSync15, writeFileSync as writeFileSync32 } from "node:fs";
244636
244650
  import { tmpdir as tmpdir6 } from "node:os";
244637
- import { join as join56, resolve as resolve29 } from "node:path";
244651
+ import { join as join57, resolve as resolve29 } from "node:path";
244638
244652
  import { deflateSync as deflateSync2 } from "node:zlib";
244639
244653
  var MAX_SIDE = 4096;
244640
244654
  var crcTable = (() => {
@@ -244687,7 +244701,7 @@ var madeDir = null;
244687
244701
  var made = 0;
244688
244702
  var write = (name, bytes) => {
244689
244703
  if (!madeDir) {
244690
- madeDir = mkdtempSync6(join56(tmpdir6(), "lecodes-pick-"));
244704
+ madeDir = mkdtempSync6(join57(tmpdir6(), "lecodes-pick-"));
244691
244705
  const dir = madeDir;
244692
244706
  process.on("exit", () => {
244693
244707
  try {
@@ -244695,9 +244709,9 @@ var write = (name, bytes) => {
244695
244709
  } catch {}
244696
244710
  });
244697
244711
  }
244698
- const dir = join56(madeDir, String(made++));
244712
+ const dir = join57(madeDir, String(made++));
244699
244713
  mkdirSync30(dir);
244700
- const path = join56(dir, name);
244714
+ const path = join57(dir, name);
244701
244715
  writeFileSync32(path, bytes);
244702
244716
  return path;
244703
244717
  };
@@ -245382,7 +245396,7 @@ var requireRenderer = async () => loadPeer("lecodes-headless", "headless", { for
245382
245396
  var fileScenarioIO = (dir) => ({
245383
245397
  write: (relPath, data) => {
245384
245398
  const abs = resolve31(dir, relPath);
245385
- mkdirSync31(dirname25(abs), { recursive: true });
245399
+ mkdirSync31(dirname26(abs), { recursive: true });
245386
245400
  writeFileSync33(abs, data);
245387
245401
  }
245388
245402
  });
@@ -245411,13 +245425,13 @@ var readScenarioFile = (path) => {
245411
245425
  throw new CliError(`Can't read scenario "${path}": ${e instanceof Error ? e.message : String(e)}`);
245412
245426
  }
245413
245427
  if (Array.isArray(raw))
245414
- return { steps: resolvePicks(raw, dirname25(resolve31(path))) };
245428
+ return { steps: resolvePicks(raw, dirname26(resolve31(path))) };
245415
245429
  if (typeof raw !== "object" || raw === null)
245416
245430
  throw new CliError(`Scenario "${path}" must be a JSON object with "steps" (or a bare step array).`);
245417
245431
  const file = raw;
245418
245432
  if (file.steps === undefined)
245419
245433
  throw new CliError(`Scenario "${path}" has no "steps".`);
245420
- return { ...file, steps: resolvePicks(file.steps, dirname25(resolve31(path))) };
245434
+ return { ...file, steps: resolvePicks(file.steps, dirname26(resolve31(path))) };
245421
245435
  };
245422
245436
  var parseClip = (raw) => {
245423
245437
  if (raw === undefined)
@@ -245542,13 +245556,13 @@ var renderDesktop = async (flags, file) => {
245542
245556
  entryOverride: screen?.entryPath
245543
245557
  });
245544
245558
  if (!sim)
245545
- mkdirSync31(dirname25(resolve31(pngFlag)), { recursive: true });
245559
+ mkdirSync31(dirname26(resolve31(pngFlag)), { recursive: true });
245546
245560
  if (scenario) {
245547
245561
  const outDir = flags["out-dir"];
245548
245562
  const plan = translateScenario(scenario.steps, { outDir, headroomFrames: frames, sim });
245549
245563
  for (const st of plan.steps)
245550
245564
  if (st.screenshot)
245551
- mkdirSync31(dirname25(st.screenshot), { recursive: true });
245565
+ mkdirSync31(dirname26(st.screenshot), { recursive: true });
245552
245566
  const timeoutMs = flags.timeout || 60000 + plan.steps.length * 5000;
245553
245567
  const label = sim ? "sim" : "native";
245554
245568
  note(`Running ${plan.steps.length} step${plan.steps.length === 1 ? "" : "s"} (${label})…`);
@@ -245638,7 +245652,7 @@ var renderHeadless = async (flags, file) => {
245638
245652
  const width = flags.width || scenario?.width || screen?.frame?.[0] || projectViewport?.width || 390;
245639
245653
  const height = flags.height || scenario?.height || screen?.frame?.[1] || projectViewport?.height || 844;
245640
245654
  const onConsole = flags.logs ? (level, text) => logErr(`${c.dim(`[${level}]`)} ${text}`) : undefined;
245641
- const envelopeFixtures = resolveFixtures(scenario?.fixtures, flags.script !== undefined ? dirname25(resolve31(flags.script)) : ".");
245655
+ const envelopeFixtures = resolveFixtures(scenario?.fixtures, flags.script !== undefined ? dirname26(resolve31(flags.script)) : ".");
245642
245656
  const flagFixtures = resolveFixtures(flags.fixtures, ".");
245643
245657
  const fixtures = envelopeFixtures || flagFixtures ? { ...envelopeFixtures, ...flagFixtures } : undefined;
245644
245658
  if (fixtures) {
@@ -245700,7 +245714,7 @@ var renderHeadless = async (flags, file) => {
245700
245714
  for (const w of [...warnings, ...mapWarnings])
245701
245715
  warnErr(w);
245702
245716
  const pngPath = mapFlag.endsWith(".png") ? mapFlag : mapFlag + ".png";
245703
- mkdirSync31(dirname25(resolve31(pngPath)), { recursive: true });
245717
+ mkdirSync31(dirname26(resolve31(pngPath)), { recursive: true });
245704
245718
  writeFileSync33(resolve31(pngPath), png);
245705
245719
  const jsonPath = pngPath.slice(0, -4) + ".json";
245706
245720
  writeFileSync33(resolve31(jsonPath), JSON.stringify(data, null, 2));
@@ -245723,7 +245737,7 @@ var renderHeadless = async (flags, file) => {
245723
245737
  if (isNullSink(pngFlag)) {
245724
245738
  note(`Discarded PNG (${pngFlag})`);
245725
245739
  } else {
245726
- mkdirSync31(dirname25(resolve31(pngFlag)), { recursive: true });
245740
+ mkdirSync31(dirname26(resolve31(pngFlag)), { recursive: true });
245727
245741
  writeFileSync33(resolve31(pngFlag), png);
245728
245742
  note(`Wrote ${pngFlag} (${png.length} bytes, ${outW}x${outH}${clip !== undefined ? ", clipped" : ""})`);
245729
245743
  }
@@ -245752,7 +245766,7 @@ var renderHeadless = async (flags, file) => {
245752
245766
  // src/commands/scene.ts
245753
245767
  init_cli();
245754
245768
  import { existsSync as existsSync52, readFileSync as readFileSync46, readdirSync as readdirSync22, statSync as statSync18, writeFileSync as writeFileSync35 } from "node:fs";
245755
- import { basename as basename24, dirname as dirname26, join as join58, relative as relative12, resolve as resolve32 } from "node:path";
245769
+ import { basename as basename24, dirname as dirname27, join as join59, relative as relative12, resolve as resolve32 } from "node:path";
245756
245770
 
245757
245771
  // src/compile/sceneCompile.ts
245758
245772
  init_env2();
@@ -245762,7 +245776,7 @@ init_cli();
245762
245776
  init_projectCompile();
245763
245777
  import { createHash as createHash9 } from "node:crypto";
245764
245778
  import { existsSync as existsSync51, mkdirSync as mkdirSync32, readFileSync as readFileSync45, writeFileSync as writeFileSync34 } from "node:fs";
245765
- import { join as join57 } from "node:path";
245779
+ import { join as join58 } from "node:path";
245766
245780
  var TEXT_EXT = /\.(ts|js|json|svg|txt|md)$/i;
245767
245781
  var rel = (key) => key.replace(/^\//, "");
245768
245782
  var compileSceneEditor = async (opts) => {
@@ -245793,8 +245807,8 @@ var compileSceneEditor = async (opts) => {
245793
245807
  const dir = shadersCacheDir(root);
245794
245808
  mkdirSync32(dir, { recursive: true });
245795
245809
  const liteName = `${hash}_webgl-lite.filamat`;
245796
- if (!existsSync51(join57(dir, liteName)))
245797
- writeFileSync34(join57(dir, liteName), JSON.stringify(buildLiteMaterialArtifact(e.text ?? "")));
245810
+ if (!existsSync51(join58(dir, liteName)))
245811
+ writeFileSync34(join58(dir, liteName), JSON.stringify(buildLiteMaterialArtifact(e.text ?? "")));
245798
245812
  const src = `/project/.lecodes/shaders/${hash}_opengl.filamat`;
245799
245813
  e.shaders = ["opengl", "webgl-lite"].map((platform) => ({ platform, src }));
245800
245814
  }
@@ -245832,9 +245846,9 @@ var DEFAULT_PORT3 = 4488;
245832
245846
  var findAppRoot = (start) => {
245833
245847
  let dir = start;
245834
245848
  while (true) {
245835
- if (existsSync52(join58(dir, "app.json")))
245849
+ if (existsSync52(join59(dir, "app.json")))
245836
245850
  return dir;
245837
- const parent = dirname26(dir);
245851
+ const parent = dirname27(dir);
245838
245852
  if (parent === dir)
245839
245853
  return null;
245840
245854
  dir = parent;
@@ -245861,7 +245875,7 @@ var getContext2 = (pathArg) => {
245861
245875
  if (existsSync52(abs) && statSync18(abs).isDirectory())
245862
245876
  root = abs;
245863
245877
  else if (abs.endsWith(".scene.ts") && existsSync52(abs))
245864
- root = findAppRoot(dirname26(abs)) ?? dirname26(abs);
245878
+ root = findAppRoot(dirname27(abs)) ?? dirname27(abs);
245865
245879
  else
245866
245880
  throw new CliError(`No such folder or .scene.ts: ${pathArg}`);
245867
245881
  } else {
@@ -245878,7 +245892,7 @@ var getContext2 = (pathArg) => {
245878
245892
  return { root, manifest, name: manifest?.name ?? basename24(root), scene };
245879
245893
  };
245880
245894
  var writeMcpConfig2 = (root, port) => {
245881
- const path = join58(root, ".mcp.json");
245895
+ const path = join59(root, ".mcp.json");
245882
245896
  const entry = { type: "http", url: `http://localhost:${port}/mcp` };
245883
245897
  let config = {};
245884
245898
  if (existsSync52(path)) {
@@ -245905,7 +245919,7 @@ var countScenes = (dir) => {
245905
245919
  for (const name of readdirSync22(dir)) {
245906
245920
  if (name === "node_modules" || name.startsWith("."))
245907
245921
  continue;
245908
- const full = join58(dir, name);
245922
+ const full = join59(dir, name);
245909
245923
  if (statSync18(full).isDirectory())
245910
245924
  n += countScenes(full);
245911
245925
  else if (name.endsWith(".scene.ts"))
@@ -246009,14 +246023,14 @@ init_compile();
246009
246023
  init_distRoot();
246010
246024
  init_cli();
246011
246025
  import { existsSync as existsSync53, mkdirSync as mkdirSync33, readdirSync as readdirSync23, readFileSync as readFileSync47, writeFileSync as writeFileSync36 } from "node:fs";
246012
- import { basename as basename26, join as join59, relative as relative13, resolve as resolve33 } from "node:path";
246026
+ import { basename as basename26, join as join60, relative as relative13, resolve as resolve33 } from "node:path";
246013
246027
  var engineMaterialsDir = () => {
246014
246028
  const candidates = [
246015
- join59(distRoot, "runtime", "materials"),
246016
- join59(distRoot, "..", "..", "engines", "gl", "materials", "src")
246029
+ join60(distRoot, "runtime", "materials"),
246030
+ join60(distRoot, "..", "..", "engines", "gl", "materials", "src")
246017
246031
  ];
246018
246032
  for (const c of candidates)
246019
- if (existsSync53(join59(c, "unlit.mat")))
246033
+ if (existsSync53(join60(c, "unlit.mat")))
246020
246034
  return c;
246021
246035
  return null;
246022
246036
  };
@@ -246099,7 +246113,7 @@ var writeNewShader = (o) => {
246099
246113
  if (!NAME_RE.test(name))
246100
246114
  throw new CliError(`"${o.name}" is not a shader name — letters, digits, - and _ (starting with a letter), e.g. hologram or rim-light`);
246101
246115
  const dir = resolve33(o.cwd ?? process.cwd(), o.dir ?? ".");
246102
- const matPath = join59(dir, `${name}.mat`), assetPath = join59(dir, `${name}.material.ts`);
246116
+ const matPath = join60(dir, `${name}.mat`), assetPath = join60(dir, `${name}.material.ts`);
246103
246117
  if (!o.force) {
246104
246118
  for (const p of [matPath, assetPath])
246105
246119
  if (existsSync53(p))
@@ -246115,7 +246129,7 @@ var writeNewShader = (o) => {
246115
246129
  const known = engineMaterialNames();
246116
246130
  if (!known.includes(ref))
246117
246131
  throw new CliError(`no engine material "${ref}". Known: ${known.join(", ")}`);
246118
- mat = refMat(name, ref, readFileSync47(join59(srcDir, `${ref}.mat`), "utf8"));
246132
+ mat = refMat(name, ref, readFileSync47(join60(srcDir, `${ref}.mat`), "utf8"));
246119
246133
  } else
246120
246134
  mat = starterMat(name);
246121
246135
  mkdirSync33(dir, { recursive: true });
@@ -246268,7 +246282,7 @@ var shaders_default = defineCommand({
246268
246282
  // src/commands/level.ts
246269
246283
  import { existsSync as existsSync54, mkdtempSync as mkdtempSync7, rmSync as rmSync16 } from "node:fs";
246270
246284
  import { tmpdir as tmpdir7 } from "node:os";
246271
- import { basename as basename27, dirname as dirname27, join as join60, resolve as resolve34 } from "node:path";
246285
+ import { basename as basename27, dirname as dirname28, join as join61, resolve as resolve34 } from "node:path";
246272
246286
  init_cli();
246273
246287
  init_shared();
246274
246288
  var build2 = defineCommand({
@@ -246317,14 +246331,14 @@ import ${JSON.stringify(importPath)}
246317
246331
  const navFiles = resources.filter((r) => !r.remote && r.absPath && named.has(r.name)).map((r) => r.absPath);
246318
246332
  let navOut = null, navName = null;
246319
246333
  if (navFiles.length === 1) {
246320
- navOut = dirname27(navFiles[0]);
246334
+ navOut = dirname28(navFiles[0]);
246321
246335
  navName = basename27(navFiles[0]).replace(/\.navmesh$/, "");
246322
246336
  ({ js, resources } = await compile(navOut, navName));
246323
246337
  } else if (navFiles.length > 1) {
246324
246338
  throw new CliError(`${entryFile} reaches ${navFiles.length} navmesh files (${navFiles.map((f) => basename27(f)).join(", ")}) — build one level per entry.`);
246325
246339
  }
246326
- const scratch = mkdtempSync7(join60(tmpdir7(), "lecodes-level-"));
246327
- const outPng = join60(scratch, "frame.png");
246340
+ const scratch = mkdtempSync7(join61(tmpdir7(), "lecodes-level-"));
246341
+ const outPng = join61(scratch, "frame.png");
246328
246342
  note(`Loading the level through the ${host} host: the static cache${navName ? `, the collision geometry for ${navName}.navmesh` : ""}…`);
246329
246343
  let output = "";
246330
246344
  try {
@@ -246418,7 +246432,7 @@ var status_default2 = defineCommand({
246418
246432
 
246419
246433
  // src/commands/test.ts
246420
246434
  import { existsSync as existsSync56, mkdirSync as mkdirSync35, readFileSync as readFileSync49, readdirSync as readdirSync24 } from "node:fs";
246421
- import { dirname as dirname29, resolve as resolve35 } from "node:path";
246435
+ import { dirname as dirname30, resolve as resolve35 } from "node:path";
246422
246436
  init_manifest();
246423
246437
 
246424
246438
  // src/hosts/liteRunner.ts
@@ -246426,7 +246440,7 @@ init_cli();
246426
246440
  import { spawn as spawn7 } from "node:child_process";
246427
246441
  import { existsSync as existsSync55, mkdirSync as mkdirSync34, rmSync as rmSync17, writeFileSync as writeFileSync37 } from "node:fs";
246428
246442
  import { createServer as createServer3 } from "node:net";
246429
- import { dirname as dirname28, join as join61 } from "node:path";
246443
+ import { dirname as dirname29, join as join62 } from "node:path";
246430
246444
  import { createInterface as createInterface2 } from "node:readline";
246431
246445
  init_manifest();
246432
246446
  init_distRoot();
@@ -246436,7 +246450,7 @@ var LOG_SLACK_MS = 3000;
246436
246450
  var NO_NODE = "--lite needs Node on the PATH: the browser is driven from a Node process.";
246437
246451
  var NO_PLAYWRIGHT = "--lite runs the flows in a browser and needs Playwright: `npm install -D playwright` in the project, then `npx playwright install chromium` once.";
246438
246452
  var startDriver = async () => {
246439
- const script = join61(distRoot, "src", "hosts", "liteBrowser.mjs");
246453
+ const script = join62(distRoot, "src", "hosts", "liteBrowser.mjs");
246440
246454
  if (!existsSync55(script))
246441
246455
  throw new CliError("--lite is not available in this build of the CLI (its browser driver ships with the npm package).");
246442
246456
  const child = spawn7("node", [script], { stdio: ["pipe", "pipe", "inherit"] });
@@ -246483,10 +246497,10 @@ var startDriver = async () => {
246483
246497
  `);
246484
246498
  });
246485
246499
  const from = [
246486
- join61(process.cwd(), "package.json"),
246487
- join61(distRoot, "package.json"),
246488
- join61(peersDir(), "package.json"),
246489
- join61(distRoot, "..", "..", "engines", "gl-lite", "package.json")
246500
+ join62(process.cwd(), "package.json"),
246501
+ join62(distRoot, "package.json"),
246502
+ join62(peersDir(), "package.json"),
246503
+ join62(distRoot, "..", "..", "engines", "gl-lite", "package.json")
246490
246504
  ];
246491
246505
  try {
246492
246506
  await call("launch", { from });
@@ -246527,7 +246541,7 @@ var freePort = () => new Promise((resolve, reject) => {
246527
246541
  });
246528
246542
  var startLiteSession = async (options) => {
246529
246543
  const port = await freePort();
246530
- const dbDir = join61(options.root, LECODES_DIR, "test-db");
246544
+ const dbDir = join62(options.root, LECODES_DIR, "test-db");
246531
246545
  rmSync17(dbDir, { recursive: true, force: true });
246532
246546
  rmSync17(filesDirOf(dbDir), { recursive: true, force: true });
246533
246547
  let ran = 0;
@@ -246808,7 +246822,7 @@ var runPlan = async (driver, url, plan, options, page) => {
246808
246822
  return;
246809
246823
  case "dump": {
246810
246824
  const file = rest.trim();
246811
- mkdirSync34(dirname28(file), { recursive: true });
246825
+ mkdirSync34(dirname29(file), { recursive: true });
246812
246826
  writeFileSync37(file, await dump());
246813
246827
  return;
246814
246828
  }
@@ -246829,7 +246843,7 @@ var runPlan = async (driver, url, plan, options, page) => {
246829
246843
  }
246830
246844
  case "shot": {
246831
246845
  const file = rest.trim();
246832
- mkdirSync34(dirname28(file), { recursive: true });
246846
+ mkdirSync34(dirname29(file), { recursive: true });
246833
246847
  await driver.screenshot(file, clip);
246834
246848
  return;
246835
246849
  }
@@ -246939,7 +246953,7 @@ var readFlowFile = (abs, displayName) => {
246939
246953
  throw new CliError(`Can't read "${displayName}": ${e instanceof Error ? e.message : String(e)}`);
246940
246954
  }
246941
246955
  if (Array.isArray(raw))
246942
- return { name: displayName, kind: "file", steps: resolvePicks(raw, dirname29(abs)) };
246956
+ return { name: displayName, kind: "file", steps: resolvePicks(raw, dirname30(abs)) };
246943
246957
  if (typeof raw !== "object" || raw === null || raw.steps === undefined) {
246944
246958
  throw new CliError(`"${displayName}" must be a JSON object with "steps" (or a bare step array).`);
246945
246959
  }
@@ -246947,8 +246961,8 @@ var readFlowFile = (abs, displayName) => {
246947
246961
  return {
246948
246962
  name: file.name ?? displayName,
246949
246963
  kind: "file",
246950
- steps: resolvePicks(file.steps, dirname29(abs)),
246951
- fixtures: resolveFixtures(file.fixtures, dirname29(abs)),
246964
+ steps: resolvePicks(file.steps, dirname30(abs)),
246965
+ fixtures: resolveFixtures(file.fixtures, dirname30(abs)),
246952
246966
  width: file.width,
246953
246967
  height: file.height,
246954
246968
  settle: file.settle,
@@ -247117,7 +247131,7 @@ var runTests = async (args, flags) => {
247117
247131
  const plan = translateScenario(kase.steps, { outDir: caseDir, headroomFrames: nativeFrames, sim });
247118
247132
  for (const st of plan.steps)
247119
247133
  if (st.screenshot)
247120
- mkdirSync35(dirname29(st.screenshot), { recursive: true });
247134
+ mkdirSync35(dirname30(st.screenshot), { recursive: true });
247121
247135
  mkdirSync35(caseDir, { recursive: true });
247122
247136
  const finalPng = resolve35(caseDir, "final.png");
247123
247137
  const { output } = await runDesktopRender(native.js, native.resources, {
@@ -247283,7 +247297,7 @@ import { createRequire as createRequire8 } from "node:module";
247283
247297
  import { execFileSync as execFileSync8 } from "node:child_process";
247284
247298
  import { existsSync as existsSync57, mkdtempSync as mkdtempSync8, readdirSync as readdirSync25, rmSync as rmSync18, statSync as statSync19 } from "node:fs";
247285
247299
  import { tmpdir as tmpdir8 } from "node:os";
247286
- import { extname, join as join62, relative as relative15, resolve as resolve36 } from "node:path";
247300
+ import { extname, join as join63, relative as relative15, resolve as resolve36 } from "node:path";
247287
247301
  init_cli();
247288
247302
  init_paths();
247289
247303
  var DEFAULT_SIZE = 256;
@@ -247295,8 +247309,8 @@ var findKtx = () => {
247295
247309
  process.env.LECODES_KTX,
247296
247310
  process.env.KTX_CLI,
247297
247311
  process.env.KTX_TOKTX?.replace(/toktx(\.exe)?$/i, exe),
247298
- process.platform === "win32" ? join62(process.env.LOCALAPPDATA ?? "", "Programs", "KTX-Software", "bin", exe) : null,
247299
- process.platform === "win32" ? join62(process.env.ProgramFiles ?? "", "KTX-Software", "bin", exe) : null,
247312
+ process.platform === "win32" ? join63(process.env.LOCALAPPDATA ?? "", "Programs", "KTX-Software", "bin", exe) : null,
247313
+ process.platform === "win32" ? join63(process.env.ProgramFiles ?? "", "KTX-Software", "bin", exe) : null,
247300
247314
  "/usr/local/bin/ktx",
247301
247315
  "/opt/homebrew/bin/ktx"
247302
247316
  ].filter((p) => !!p);
@@ -247342,7 +247356,7 @@ var collect = (dir) => {
247342
247356
  for (const name of readdirSync25(dir)) {
247343
247357
  if (name === "node_modules" || name.startsWith("."))
247344
247358
  continue;
247345
- const full = join62(dir, name);
247359
+ const full = join63(dir, name);
247346
247360
  if (statSync19(full).isDirectory())
247347
247361
  out.push(...collect(full));
247348
247362
  else if (IMAGE_EXT.test(name))
@@ -247391,7 +247405,7 @@ var thumbs = async (targets, size, force) => {
247391
247405
  const ktx = files.some((f) => f.toLowerCase().endsWith(".ktx2")) ? findKtx() : null;
247392
247406
  const sharp = sharpResizer();
247393
247407
  const resize = sharp ?? jimpResizer();
247394
- const tmp = mkdtempSync8(join62(tmpdir8(), "lecodes-thumbs-"));
247408
+ const tmp = mkdtempSync8(join63(tmpdir8(), "lecodes-thumbs-"));
247395
247409
  let made = 0, fresh = 0;
247396
247410
  const skipped = [];
247397
247411
  try {
@@ -247417,7 +247431,7 @@ var thumbs = async (targets, size, force) => {
247417
247431
  skipped.push(`${asset} (KTX2 needs KTX-Software's \`ktx\` — set LECODES_KTX or put it on PATH)`);
247418
247432
  continue;
247419
247433
  }
247420
- source = join62(tmp, `${i}.png`);
247434
+ source = join63(tmp, `${i}.png`);
247421
247435
  ktxToPng(ktx, file, source);
247422
247436
  }
247423
247437
  sceneServer.writePreviewFile(root, asset, await resize(source, size));
@@ -247437,7 +247451,7 @@ var thumbs = async (targets, size, force) => {
247437
247451
  if (rendered.length > 0) {
247438
247452
  warnErr(`Models, materials and prefabs are RENDERED, not decoded — the scene editor does those: ${rendered.join(", ")}`);
247439
247453
  }
247440
- note(`Cache: ${join62(root, ".lecodes", "preview")} (re-runs skip everything unchanged)`);
247454
+ note(`Cache: ${join63(root, ".lecodes", "preview")} (re-runs skip everything unchanged)`);
247441
247455
  };
247442
247456
 
247443
247457
  // src/commands/update/index.ts
@@ -247450,7 +247464,7 @@ init_packageManager();
247450
247464
  import { spawnSync as spawnSync12 } from "node:child_process";
247451
247465
  import { existsSync as existsSync58, readdirSync as readdirSync26, readFileSync as readFileSync50 } from "node:fs";
247452
247466
  import { homedir as homedir15 } from "node:os";
247453
- import { dirname as dirname30, join as join63, resolve as resolve38 } from "node:path";
247467
+ import { dirname as dirname31, join as join64, resolve as resolve38 } from "node:path";
247454
247468
 
247455
247469
  // src/commands/update/types.ts
247456
247470
  init_api();
@@ -247522,9 +247536,9 @@ var findProjectDir = (start) => {
247522
247536
  const home = resolve38(homedir15());
247523
247537
  let dir = resolve38(start);
247524
247538
  while (true) {
247525
- if (dir !== home && (existsSync58(join63(dir, "app.json")) || existsSync58(join63(dir, ".lecodes", "manifest.json")) || existsSync58(join63(dir, ".lecodes", "types"))))
247539
+ if (dir !== home && (existsSync58(join64(dir, "app.json")) || existsSync58(join64(dir, ".lecodes", "manifest.json")) || existsSync58(join64(dir, ".lecodes", "types"))))
247526
247540
  return dir;
247527
- const parent = dirname30(dir);
247541
+ const parent = dirname31(dir);
247528
247542
  if (parent === dir)
247529
247543
  return null;
247530
247544
  dir = parent;
@@ -247590,13 +247604,13 @@ var npmNewestIn = async (name, range) => {
247590
247604
  };
247591
247605
  var cliVersionAt = (entry) => {
247592
247606
  try {
247593
- return JSON.parse(readFileSync50(join63(dirname30(entry), "..", "package.json"), "utf8")).version ?? null;
247607
+ return JSON.parse(readFileSync50(join64(dirname31(entry), "..", "package.json"), "utf8")).version ?? null;
247594
247608
  } catch {
247595
247609
  return null;
247596
247610
  }
247597
247611
  };
247598
247612
  var FROM_SOURCE = /[\\/]src[\\/]commands[\\/]/.test(import.meta.url);
247599
- var STANDALONE = existsSync58(join63(dirname30(process.execPath), "runtime")) && existsSync58(join63(dirname30(process.execPath), process.platform === "win32" ? "chisel.exe" : "chisel"));
247613
+ var STANDALONE = existsSync58(join64(dirname31(process.execPath), "runtime")) && existsSync58(join64(dirname31(process.execPath), process.platform === "win32" ? "chisel.exe" : "chisel"));
247600
247614
  var update_default = defineCommand({
247601
247615
  name: "update",
247602
247616
  summary: "Move everything the project depends on to its newest published state",
@@ -247708,7 +247722,7 @@ ${c.bold(name)} ${c.dim(what)}`);
247708
247722
  return ["skipped", "not inside a project"];
247709
247723
  if (flags["no-shells"])
247710
247724
  return ["skipped", "--no-shells"];
247711
- const present = ["ios", "android"].filter((d) => existsSync58(join63(root, d)) && readdirSync26(join63(root, d)).length > 0);
247725
+ const present = ["ios", "android"].filter((d) => existsSync58(join64(root, d)) && readdirSync26(join64(root, d)).length > 0);
247712
247726
  if (present.length === 0)
247713
247727
  return ["skipped", "no ios/ or android/ shell in this project (`lecodes app init ios|android`)"];
247714
247728
  await runSubcommand(app_default, "update");
@@ -247795,7 +247809,7 @@ init_env2();
247795
247809
  init_compile();
247796
247810
  import { createHash as createHash10 } from "node:crypto";
247797
247811
  import { copyFileSync as copyFileSync2, cpSync as cpSync7, existsSync as existsSync59, mkdirSync as mkdirSync36, readFileSync as readFileSync51, readdirSync as readdirSync27, rmSync as rmSync19, statSync as statSync20, writeFileSync as writeFileSync38 } from "node:fs";
247798
- import { dirname as dirname31, extname as extname2, join as join64, resolve as resolve39 } from "node:path";
247812
+ import { dirname as dirname32, extname as extname2, join as join65, resolve as resolve39 } from "node:path";
247799
247813
  init_fonts();
247800
247814
  init_assetIcons();
247801
247815
  init_projectCompile();
@@ -247808,7 +247822,7 @@ var normalBase = (base) => {
247808
247822
  var walk = (dir, prefix = "") => {
247809
247823
  const out = [];
247810
247824
  for (const name of readdirSync27(dir)) {
247811
- const abs = join64(dir, name);
247825
+ const abs = join65(dir, name);
247812
247826
  const stat = statSync20(abs);
247813
247827
  if (stat.isDirectory())
247814
247828
  out.push(...walk(abs, `${prefix}${name}/`));
@@ -247837,21 +247851,21 @@ var assembleLitePage = (dist, out, opts) => {
247837
247851
  }
247838
247852
  const listed = listedPlugins(js);
247839
247853
  cpSync7(dist, out, { recursive: true });
247840
- const table = join64(out, "features.json");
247854
+ const table = join65(out, "features.json");
247841
247855
  if (existsSync59(table)) {
247842
247856
  const { features, fonts } = JSON.parse(readFileSync51(table, "utf8"));
247843
247857
  if (config.font === "system")
247844
247858
  for (const file of fonts ?? [])
247845
- rmSync19(join64(out, file), { force: true });
247859
+ rmSync19(join65(out, file), { force: true });
247846
247860
  for (const feature of features) {
247847
247861
  if (feature.uses.some((name) => js.includes(name)))
247848
247862
  continue;
247849
247863
  for (const file of feature.files)
247850
- rmSync19(join64(out, file), { force: true });
247864
+ rmSync19(join65(out, file), { force: true });
247851
247865
  }
247852
247866
  rmSync19(table);
247853
247867
  }
247854
- const pluginsTable = join64(out, "plugins.json");
247868
+ const pluginsTable = join65(out, "plugins.json");
247855
247869
  if (existsSync59(pluginsTable) || halves.length > 0) {
247856
247870
  const { plugins } = existsSync59(pluginsTable) ? JSON.parse(readFileSync51(pluginsTable, "utf8")) : { plugins: {} };
247857
247871
  const kept = {};
@@ -247859,15 +247873,15 @@ var assembleLitePage = (dist, out, opts) => {
247859
247873
  if (listed.has(id))
247860
247874
  kept[id] = plugins[id];
247861
247875
  else
247862
- rmSync19(join64(out, "plugins", id), { recursive: true, force: true });
247876
+ rmSync19(join65(out, "plugins", id), { recursive: true, force: true });
247863
247877
  }
247864
247878
  for (const { half, js } of halves) {
247865
247879
  if (half.folder in plugins && half.folder in kept)
247866
247880
  throw new CliError(`Plugin "${half.id}": its half's folder is named like the "${half.folder}" plugin the page carries — rename ${half.dir}.`);
247867
- const dir = join64(out, "plugins", half.folder);
247881
+ const dir = join65(out, "plugins", half.folder);
247868
247882
  mkdirSync36(dir, { recursive: true });
247869
- writeFileSync38(join64(dir, "index.js"), js);
247870
- copyStatic(half, join64(out, "plugins"));
247883
+ writeFileSync38(join65(dir, "index.js"), js);
247884
+ copyStatic(half, join65(out, "plugins"));
247871
247885
  const firstParty = plugins[half.id];
247872
247886
  kept[half.id] = firstParty !== undefined && listed.has(half.id) ? [halfModule(half), firstParty] : halfModule(half);
247873
247887
  }
@@ -247878,16 +247892,16 @@ var assembleLitePage = (dist, out, opts) => {
247878
247892
  writeFileSync38(pluginsTable, JSON.stringify({ plugins: kept }, null, 2));
247879
247893
  else {
247880
247894
  rmSync19(pluginsTable, { force: true });
247881
- rmSync19(join64(out, "plugins"), { recursive: true, force: true });
247895
+ rmSync19(join65(out, "plugins"), { recursive: true, force: true });
247882
247896
  }
247883
247897
  }
247884
- let html = readFileSync51(join64(dist, "index.html"), "utf8");
247898
+ let html = readFileSync51(join65(dist, "index.html"), "utf8");
247885
247899
  const head = [];
247886
247900
  head.push(`<meta name="theme-color" content="${escapeHtml(config.themeColor ?? "#000000")}" />`);
247887
247901
  if (opts.icon) {
247888
247902
  if (existsSync59(opts.icon.file)) {
247889
247903
  const file = `icon${extname2(opts.icon.file).toLowerCase() || ".png"}`;
247890
- copyFileSync2(opts.icon.file, join64(out, file));
247904
+ copyFileSync2(opts.icon.file, join65(out, file));
247891
247905
  head.push(`<link rel="icon" href="${file}" />`, `<link rel="apple-touch-icon" href="${file}" />`);
247892
247906
  } else {
247893
247907
  warnings.push(`app.json icon "${opts.icon.declared}" is not there — the page has no icon`);
@@ -247913,9 +247927,9 @@ var assembleLitePage = (dist, out, opts) => {
247913
247927
  </head>`);
247914
247928
  if (config.lang)
247915
247929
  replace(/<html lang="[^"]*">/, `<html lang="${escapeHtml(config.lang)}">`);
247916
- writeFileSync38(join64(out, "index.html"), html);
247930
+ writeFileSync38(join65(out, "index.html"), html);
247917
247931
  if (mode === "path")
247918
- writeFileSync38(join64(out, "404.html"), html);
247932
+ writeFileSync38(join65(out, "404.html"), html);
247919
247933
  return warnings;
247920
247934
  };
247921
247935
  var copyNamedAssets = (entries, js, out) => {
@@ -247925,12 +247939,12 @@ var copyNamedAssets = (entries, js, out) => {
247925
247939
  continue;
247926
247940
  if (!js.includes(entry.fileSrc))
247927
247941
  continue;
247928
- const to = join64(out, "assets", ...entry.path.split("/").filter(Boolean));
247942
+ const to = join65(out, "assets", ...entry.path.split("/").filter(Boolean));
247929
247943
  if (existsSync59(to)) {
247930
247944
  warnings.push(`${entry.path}: a file of the page has this name in the built folder — the project's file was not copied`);
247931
247945
  continue;
247932
247946
  }
247933
- mkdirSync36(dirname31(to), { recursive: true });
247947
+ mkdirSync36(dirname32(to), { recursive: true });
247934
247948
  copyFileSync2(entry.absPath, to);
247935
247949
  }
247936
247950
  return warnings;
@@ -248001,13 +248015,13 @@ var buildWeb = async (options) => {
248001
248015
  halves,
248002
248016
  icon: app?.icon ? { file: resolve39(root, app.icon), declared: app.icon } : null
248003
248017
  }));
248004
- writeFileSync38(join64(out, bundle), js);
248018
+ writeFileSync38(join65(out, bundle), js);
248005
248019
  warnings.push(...copyNamedAssets(entries, js, out));
248006
248020
  for (const [hash, artifact] of shaders) {
248007
248021
  if (!js.includes(`shaders/${hash}_`))
248008
248022
  continue;
248009
- mkdirSync36(join64(out, "shaders"), { recursive: true });
248010
- writeFileSync38(join64(out, "shaders", `${hash}_webgl-lite.filamat`), artifact);
248023
+ mkdirSync36(join65(out, "shaders"), { recursive: true });
248024
+ writeFileSync38(join65(out, "shaders", `${hash}_webgl-lite.filamat`), artifact);
248011
248025
  }
248012
248026
  return { out, bundle, files: walk(out), warnings };
248013
248027
  };
@@ -248015,10 +248029,10 @@ var buildWeb = async (options) => {
248015
248029
  // src/web/preview.ts
248016
248030
  import { createReadStream as createReadStream3, existsSync as existsSync60, statSync as statSync21 } from "node:fs";
248017
248031
  import { createServer as createServer4 } from "node:http";
248018
- import { join as join65, resolve as resolve40 } from "node:path";
248032
+ import { join as join66, resolve as resolve40 } from "node:path";
248019
248033
  var startPreview = async (dir, port) => {
248020
248034
  const root = resolve40(dir);
248021
- const fallback = existsSync60(join65(root, "404.html")) ? join65(root, "index.html") : null;
248035
+ const fallback = existsSync60(join66(root, "404.html")) ? join66(root, "index.html") : null;
248022
248036
  const server2 = createServer4((req, res) => {
248023
248037
  let path;
248024
248038
  try {
@@ -248034,9 +248048,9 @@ var startPreview = async (dir, port) => {
248034
248048
  res.end();
248035
248049
  return;
248036
248050
  }
248037
- let file = join65(root, ...parts);
248051
+ let file = join66(root, ...parts);
248038
248052
  if (existsSync60(file) && statSync21(file).isDirectory())
248039
- file = join65(file, "index.html");
248053
+ file = join66(file, "index.html");
248040
248054
  let status = 200;
248041
248055
  if (!existsSync60(file) || !statSync21(file).isFile()) {
248042
248056
  if (!fallback || /\.[a-z0-9]+$/i.test(parts[parts.length - 1] ?? "")) {
@@ -248070,12 +248084,12 @@ init_shared();
248070
248084
  // src/dev/https.ts
248071
248085
  import { existsSync as existsSync61, mkdirSync as mkdirSync37, readFileSync as readFileSync52, writeFileSync as writeFileSync39 } from "node:fs";
248072
248086
  import { homedir as homedir16 } from "node:os";
248073
- import { join as join66 } from "node:path";
248074
- var DIR = () => join66(homedir16(), ".lecodes", "dev-https");
248087
+ import { join as join67 } from "node:path";
248088
+ var DIR = () => join67(homedir16(), ".lecodes", "dev-https");
248075
248089
  var DAYS = 397;
248076
248090
  var RENEW_DAYS = 300;
248077
248091
  var devCertificate = async (names, dir = DIR()) => {
248078
- const files = { cert: join66(dir, "cert.pem"), key: join66(dir, "key.pem"), meta: join66(dir, "names.json") };
248092
+ const files = { cert: join67(dir, "cert.pem"), key: join67(dir, "key.pem"), meta: join67(dir, "names.json") };
248079
248093
  let kept = null;
248080
248094
  try {
248081
248095
  kept = JSON.parse(readFileSync52(files.meta, "utf8"));
@@ -248315,9 +248329,9 @@ var commandGroups = (opts) => [
248315
248329
  init_peers();
248316
248330
  init_env2();
248317
248331
  var STANDALONE2 = (() => {
248318
- const dir = dirname32(process.execPath);
248332
+ const dir = dirname33(process.execPath);
248319
248333
  const chisel = process.platform === "win32" ? "chisel.exe" : "chisel";
248320
- return existsSync63(join68(dir, "runtime")) && existsSync63(join68(dir, chisel));
248334
+ return existsSync63(join69(dir, "runtime")) && existsSync63(join69(dir, chisel));
248321
248335
  })();
248322
248336
  var INSTALLED = STANDALONE2 && (() => {
248323
248337
  const exe = process.platform === "win32" ? "lecodes.exe" : "lecodes";
@@ -248332,7 +248346,7 @@ var INSTALLED = STANDALONE2 && (() => {
248332
248346
  if (!d)
248333
248347
  return false;
248334
248348
  try {
248335
- const cand = join68(d, exe);
248349
+ const cand = join69(d, exe);
248336
248350
  return existsSync63(cand) && realpathSync5(cand) === self2;
248337
248351
  } catch {
248338
248352
  return false;