elit 3.5.8 → 3.5.9

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/Cargo.lock CHANGED
@@ -1211,7 +1211,7 @@ dependencies = [
1211
1211
 
1212
1212
  [[package]]
1213
1213
  name = "elit-desktop"
1214
- version = "0.1.0"
1214
+ version = "3.5.9"
1215
1215
  dependencies = [
1216
1216
  "eframe",
1217
1217
  "http",
package/Cargo.toml CHANGED
@@ -1,6 +1,6 @@
1
1
  [package]
2
2
  name = "elit-desktop"
3
- version = "3.5.8"
3
+ version = "3.5.9"
4
4
  edition = "2021"
5
5
  build = "desktop/build.rs"
6
6
 
package/README.md CHANGED
@@ -955,7 +955,7 @@ The package also exports `elit/test`, `elit/test-runtime`, and `elit/test-report
955
955
 
956
956
  Latest release notes live in [CHANGELOG.md](CHANGELOG.md).
957
957
 
958
- Highlights in `v3.5.8`:
958
+ Highlights in `v3.5.9`:
959
959
 
960
960
  - Added `elit pm` for detached background process management of shell commands, file targets, and WAPK apps.
961
961
  - Added `pm.apps[]` and `pm.dataDir` in `elit.config.*` for config-first process manager workflows.
package/dist/cli.cjs CHANGED
@@ -59622,6 +59622,9 @@ async function loadConfigFile(configPath) {
59622
59622
  await build2({
59623
59623
  entryPoints: [configPath],
59624
59624
  bundle: true,
59625
+ banner: {
59626
+ js: `import { createRequire as __createRequire } from 'module'; const require = __createRequire(import.meta.url);`
59627
+ },
59625
59628
  format: "esm",
59626
59629
  platform: "node",
59627
59630
  outfile: tempFile,
@@ -76741,6 +76744,9 @@ function toDesktopBootstrapImportPath(fromPath, toPath) {
76741
76744
  const importPath = (0, import_node_path3.relative)((0, import_node_path3.dirname)(fromPath), toPath).replace(/\\/g, "/");
76742
76745
  return importPath.startsWith("./") || importPath.startsWith("../") ? importPath : `./${importPath}`;
76743
76746
  }
76747
+ function isNodeModulesPackagePath(path) {
76748
+ return path.split(/[\\/]+/).some((segment) => segment.toLowerCase() === "node_modules");
76749
+ }
76744
76750
  function formatDesktopDisplayName(value) {
76745
76751
  if (!value) {
76746
76752
  return "Elit";
@@ -76783,6 +76789,27 @@ function resolveDesktopBootstrapSupportModulePath(moduleName, packageRoot = PACK
76783
76789
  `Desktop support module "${moduleName}" was not found in ${packageRoot}. Expected one of: ${candidates.join(", ")}`
76784
76790
  );
76785
76791
  }
76792
+ function resolveDesktopCargoTargetBaseDir(packageRoot = PACKAGE_ROOT, cwd = process.cwd(), env = process.env, platform = process.platform) {
76793
+ const explicitTargetDir = env.ELIT_DESKTOP_CARGO_TARGET_DIR?.trim();
76794
+ if (explicitTargetDir) {
76795
+ return (0, import_node_path3.resolve)(explicitTargetDir);
76796
+ }
76797
+ const localAppData = env.LOCALAPPDATA?.trim();
76798
+ if (platform === "win32" && localAppData) {
76799
+ return (0, import_node_path3.resolve)(localAppData, "elit", "target", "desktop");
76800
+ }
76801
+ if (isNodeModulesPackagePath(packageRoot)) {
76802
+ return (0, import_node_path3.resolve)(cwd, ".elit", "target", "desktop");
76803
+ }
76804
+ return (0, import_node_path3.resolve)(packageRoot, "target", "desktop");
76805
+ }
76806
+ function resolveDesktopBinaryOverridePath(configuredPath, envName, cwd = process.cwd(), env = process.env) {
76807
+ const explicitPath = env[envName]?.trim() || configuredPath?.trim();
76808
+ if (!explicitPath) {
76809
+ return void 0;
76810
+ }
76811
+ return (0, import_node_path3.resolve)(cwd, explicitPath);
76812
+ }
76786
76813
  function createDesktopBootstrapEntry(entryPath, appName) {
76787
76814
  const bootstrapId = (0, import_node_crypto3.randomUUID)();
76788
76815
  const bootstrapPath = (0, import_node_path3.join)((0, import_node_path3.dirname)(entryPath), `.elit-desktop-bootstrap-${appName}-${bootstrapId}.ts`);
@@ -76877,6 +76904,9 @@ function parseDesktopRunArgs(args, config) {
76877
76904
  mode: getDefaultDesktopMode(config),
76878
76905
  entry: void 0,
76879
76906
  exportName: config?.native?.exportName,
76907
+ binaryPath: config?.binaryPath,
76908
+ nativeBinaryPath: config?.nativeBinaryPath,
76909
+ cargoTargetDir: config?.cargoTargetDir,
76880
76910
  runtime: config?.runtime ?? "quickjs",
76881
76911
  compiler: config?.compiler ?? "auto",
76882
76912
  release: config?.release ?? false
@@ -76942,6 +76972,9 @@ function parseDesktopBuildArgs(args, config) {
76942
76972
  mode: getDefaultDesktopMode(config),
76943
76973
  entry: void 0,
76944
76974
  exportName: config?.native?.exportName,
76975
+ binaryPath: config?.binaryPath,
76976
+ nativeBinaryPath: config?.nativeBinaryPath,
76977
+ cargoTargetDir: config?.cargoTargetDir,
76945
76978
  runtime: config?.runtime ?? "quickjs",
76946
76979
  compiler: config?.compiler ?? "auto",
76947
76980
  release: config?.release ?? false,
@@ -77088,6 +77121,8 @@ function printDesktopHelp() {
77088
77121
  " - TypeScript and module-style QuickJS entries are transpiled automatically.",
77089
77122
  " - The tsx compiler is Node-only and keeps loading the original source tree.",
77090
77123
  " - The tsx and tsup compilers require those packages to be installed.",
77124
+ " - Use desktop.binaryPath / desktop.nativeBinaryPath or ELIT_DESKTOP_BINARY_PATH / ELIT_DESKTOP_NATIVE_BINARY_PATH to reuse prebuilt runtimes when Cargo builds are blocked.",
77125
+ " - Use desktop.cargoTargetDir or ELIT_DESKTOP_CARGO_TARGET_DIR to move the desktop Cargo cache to a policy-approved location.",
77091
77126
  ' - desktop.mode defaults to "native" when desktop.native.entry exists, otherwise "hybrid".',
77092
77127
  " - desktop.entry is used for hybrid mode. desktop.native.entry is used for native mode.",
77093
77128
  " - Native mode falls back to desktop.entry when only the legacy desktop.entry is configured.",
@@ -77348,6 +77383,8 @@ async function runDesktopRuntime(options) {
77348
77383
  try {
77349
77384
  const binary = ensureDesktopBinary({
77350
77385
  runtime: options.runtime,
77386
+ binaryPath: options.binaryPath,
77387
+ cargoTargetDir: options.cargoTargetDir,
77351
77388
  release: options.release,
77352
77389
  entryPath: options.entry
77353
77390
  });
@@ -77363,6 +77400,8 @@ async function runDesktopNativeRuntime(options) {
77363
77400
  const preparedPayload = await prepareDesktopNativePayload(options);
77364
77401
  try {
77365
77402
  const binary = ensureDesktopNativeBinary({
77403
+ binaryPath: options.nativeBinaryPath,
77404
+ cargoTargetDir: options.cargoTargetDir,
77366
77405
  release: options.release,
77367
77406
  entryPath: options.entry
77368
77407
  });
@@ -77380,13 +77419,14 @@ async function buildDesktopBundle(options) {
77380
77419
  return;
77381
77420
  }
77382
77421
  const triple = options.platform ? PLATFORMS[options.platform] : void 0;
77383
- buildDesktopRuntime({
77422
+ const binary = ensureDesktopBinary({
77384
77423
  runtime: options.runtime,
77424
+ binaryPath: options.binaryPath,
77425
+ cargoTargetDir: options.cargoTargetDir,
77385
77426
  release: options.release,
77386
77427
  triple,
77387
77428
  entryPath: options.entry
77388
77429
  });
77389
- const binary = findDesktopBinary(options.runtime, options.release, triple);
77390
77430
  if (!binary) {
77391
77431
  throw new Error("Desktop runtime binary was not found after cargo build completed.");
77392
77432
  }
@@ -77416,12 +77456,13 @@ async function buildDesktopBundle(options) {
77416
77456
  }
77417
77457
  async function buildDesktopNativeBundle(options) {
77418
77458
  const triple = options.platform ? PLATFORMS[options.platform] : void 0;
77419
- buildDesktopNativeRuntime({
77459
+ const binary = ensureDesktopNativeBinary({
77460
+ binaryPath: options.nativeBinaryPath,
77461
+ cargoTargetDir: options.cargoTargetDir,
77420
77462
  release: options.release,
77421
77463
  triple,
77422
77464
  entryPath: options.entry
77423
77465
  });
77424
- const binary = findDesktopNativeBinary(options.release, triple);
77425
77466
  if (!binary) {
77426
77467
  throw new Error("Desktop native runtime binary was not found after cargo build completed.");
77427
77468
  }
@@ -77449,10 +77490,17 @@ async function buildDesktopNativeBundle(options) {
77449
77490
  }
77450
77491
  }
77451
77492
  function ensureDesktopBinary(options) {
77452
- let binary = findDesktopBinary(options.runtime, options.release, options.triple);
77493
+ const overriddenBinary = resolveDesktopBinaryOverridePath(options.binaryPath, "ELIT_DESKTOP_BINARY_PATH");
77494
+ if (overriddenBinary) {
77495
+ if (!(0, import_node_fs3.existsSync)(overriddenBinary)) {
77496
+ throw new Error(`Configured desktop runtime binary was not found: ${overriddenBinary}`);
77497
+ }
77498
+ return overriddenBinary;
77499
+ }
77500
+ let binary = findDesktopBinary(options.runtime, options.release, options.triple, options.cargoTargetDir);
77453
77501
  if (!binary || isDesktopRustBuildStale(binary)) {
77454
77502
  buildDesktopRuntime(options);
77455
- binary = findDesktopBinary(options.runtime, options.release, options.triple);
77503
+ binary = findDesktopBinary(options.runtime, options.release, options.triple, options.cargoTargetDir);
77456
77504
  }
77457
77505
  if (!binary) {
77458
77506
  throw new Error("Desktop runtime binary was not found after cargo build completed.");
@@ -77460,10 +77508,17 @@ function ensureDesktopBinary(options) {
77460
77508
  return binary;
77461
77509
  }
77462
77510
  function ensureDesktopNativeBinary(options) {
77463
- let binary = findDesktopNativeBinary(options.release, options.triple);
77511
+ const overriddenBinary = resolveDesktopBinaryOverridePath(options.binaryPath, "ELIT_DESKTOP_NATIVE_BINARY_PATH");
77512
+ if (overriddenBinary) {
77513
+ if (!(0, import_node_fs3.existsSync)(overriddenBinary)) {
77514
+ throw new Error(`Configured desktop native runtime binary was not found: ${overriddenBinary}`);
77515
+ }
77516
+ return overriddenBinary;
77517
+ }
77518
+ let binary = findDesktopNativeBinary(options.release, options.triple, options.cargoTargetDir);
77464
77519
  if (!binary || isDesktopRustBuildStale(binary)) {
77465
77520
  buildDesktopNativeRuntime(options);
77466
- binary = findDesktopNativeBinary(options.release, options.triple);
77521
+ binary = findDesktopNativeBinary(options.release, options.triple, options.cargoTargetDir);
77467
77522
  }
77468
77523
  if (!binary) {
77469
77524
  throw new Error("Desktop native runtime binary was not found after cargo build completed.");
@@ -77489,7 +77544,7 @@ function buildDesktopRuntime(options) {
77489
77544
  }
77490
77545
  const env = {
77491
77546
  ...process.env,
77492
- CARGO_TARGET_DIR: desktopCargoTargetDir(options.runtime)
77547
+ CARGO_TARGET_DIR: desktopCargoTargetDir(options.runtime, options.cargoTargetDir)
77493
77548
  };
77494
77549
  const iconPath = resolveDesktopIcon(options.entryPath);
77495
77550
  if (iconPath) {
@@ -77509,6 +77564,7 @@ function buildDesktopRuntime(options) {
77509
77564
  throw result2.error;
77510
77565
  }
77511
77566
  if (result2.status !== 0) {
77567
+ printDesktopCargoFailureHint("hybrid");
77512
77568
  process.exit(result2.status ?? 1);
77513
77569
  }
77514
77570
  }
@@ -77528,7 +77584,7 @@ function buildDesktopNativeRuntime(options) {
77528
77584
  }
77529
77585
  const env = {
77530
77586
  ...process.env,
77531
- CARGO_TARGET_DIR: desktopNativeCargoTargetDir()
77587
+ CARGO_TARGET_DIR: desktopNativeCargoTargetDir(options.cargoTargetDir)
77532
77588
  };
77533
77589
  const iconPath = resolveDesktopIcon(options.entryPath);
77534
77590
  if (iconPath) {
@@ -77548,11 +77604,16 @@ function buildDesktopNativeRuntime(options) {
77548
77604
  throw result2.error;
77549
77605
  }
77550
77606
  if (result2.status !== 0) {
77607
+ printDesktopCargoFailureHint("native");
77551
77608
  process.exit(result2.status ?? 1);
77552
77609
  }
77553
77610
  }
77554
- function findDesktopBinary(runtime2, release, triple) {
77555
- const targetDir = desktopCargoTargetDir(runtime2);
77611
+ function findDesktopBinary(runtime2, release, triple, configuredTargetDir, configuredBinaryPath) {
77612
+ const overriddenBinary = resolveDesktopBinaryOverridePath(configuredBinaryPath, "ELIT_DESKTOP_BINARY_PATH");
77613
+ if (overriddenBinary) {
77614
+ return (0, import_node_fs3.existsSync)(overriddenBinary) ? overriddenBinary : null;
77615
+ }
77616
+ const targetDir = desktopCargoTargetDir(runtime2, configuredTargetDir);
77556
77617
  const profile = release ? "release" : "debug";
77557
77618
  const binaryName = isWindowsTarget(triple) ? "elit-desktop.exe" : "elit-desktop";
77558
77619
  const candidates = triple ? [(0, import_node_path3.join)(targetDir, triple, profile, binaryName)] : [(0, import_node_path3.join)(targetDir, profile, binaryName)];
@@ -77563,8 +77624,12 @@ function findDesktopBinary(runtime2, release, triple) {
77563
77624
  }
77564
77625
  return null;
77565
77626
  }
77566
- function findDesktopNativeBinary(release, triple) {
77567
- const targetDir = desktopNativeCargoTargetDir();
77627
+ function findDesktopNativeBinary(release, triple, configuredTargetDir, configuredBinaryPath) {
77628
+ const overriddenBinary = resolveDesktopBinaryOverridePath(configuredBinaryPath, "ELIT_DESKTOP_NATIVE_BINARY_PATH");
77629
+ if (overriddenBinary) {
77630
+ return (0, import_node_fs3.existsSync)(overriddenBinary) ? overriddenBinary : null;
77631
+ }
77632
+ const targetDir = desktopNativeCargoTargetDir(configuredTargetDir);
77568
77633
  const profile = release ? "release" : "debug";
77569
77634
  const binaryName = isWindowsTarget(triple) ? "elit-desktop-native.exe" : "elit-desktop-native";
77570
77635
  const candidates = triple ? [(0, import_node_path3.join)(targetDir, triple, profile, binaryName)] : [(0, import_node_path3.join)(targetDir, profile, binaryName)];
@@ -77575,11 +77640,34 @@ function findDesktopNativeBinary(release, triple) {
77575
77640
  }
77576
77641
  return null;
77577
77642
  }
77578
- function desktopCargoTargetDir(runtime2) {
77579
- return (0, import_node_path3.resolve)(PACKAGE_ROOT, "target", "desktop", runtime2);
77643
+ function desktopCargoTargetDir(runtime2, configuredTargetDir) {
77644
+ return (0, import_node_path3.resolve)(resolveDesktopCargoTargetBaseDir(
77645
+ PACKAGE_ROOT,
77646
+ process.cwd(),
77647
+ {
77648
+ ...process.env,
77649
+ ...configuredTargetDir ? { ELIT_DESKTOP_CARGO_TARGET_DIR: configuredTargetDir } : {}
77650
+ }
77651
+ ), runtime2);
77652
+ }
77653
+ function desktopNativeCargoTargetDir(configuredTargetDir) {
77654
+ return (0, import_node_path3.resolve)(resolveDesktopCargoTargetBaseDir(
77655
+ PACKAGE_ROOT,
77656
+ process.cwd(),
77657
+ {
77658
+ ...process.env,
77659
+ ...configuredTargetDir ? { ELIT_DESKTOP_CARGO_TARGET_DIR: configuredTargetDir } : {}
77660
+ }
77661
+ ), "native");
77580
77662
  }
77581
- function desktopNativeCargoTargetDir() {
77582
- return (0, import_node_path3.resolve)(PACKAGE_ROOT, "target", "desktop", "native");
77663
+ function printDesktopCargoFailureHint(mode) {
77664
+ if (process.platform !== "win32") {
77665
+ return;
77666
+ }
77667
+ const binaryConfigLabel = mode === "native" ? "desktop.nativeBinaryPath or ELIT_DESKTOP_NATIVE_BINARY_PATH" : "desktop.binaryPath or ELIT_DESKTOP_BINARY_PATH";
77668
+ console.error("[desktop] Cargo build failed. If Windows Application Control blocks Rust build scripts on this machine, configure a prebuilt runtime binary.");
77669
+ console.error(`[desktop] Use ${binaryConfigLabel} to bypass Cargo for desktop runs/builds.`);
77670
+ console.error("[desktop] Use desktop.cargoTargetDir or ELIT_DESKTOP_CARGO_TARGET_DIR if your environment only allows specific cache locations.");
77583
77671
  }
77584
77672
  function isDesktopRustBuildStale(binaryPath) {
77585
77673
  if (!(0, import_node_fs3.existsSync)(binaryPath)) {
package/dist/cli.mjs CHANGED
@@ -59607,6 +59607,9 @@ async function loadConfigFile(configPath) {
59607
59607
  await build2({
59608
59608
  entryPoints: [configPath],
59609
59609
  bundle: true,
59610
+ banner: {
59611
+ js: `import { createRequire as __createRequire } from 'module'; const require = __createRequire(import.meta.url);`
59612
+ },
59610
59613
  format: "esm",
59611
59614
  platform: "node",
59612
59615
  outfile: tempFile,
@@ -76726,6 +76729,9 @@ function toDesktopBootstrapImportPath(fromPath, toPath) {
76726
76729
  const importPath = relative3(dirname4(fromPath), toPath).replace(/\\/g, "/");
76727
76730
  return importPath.startsWith("./") || importPath.startsWith("../") ? importPath : `./${importPath}`;
76728
76731
  }
76732
+ function isNodeModulesPackagePath(path) {
76733
+ return path.split(/[\\/]+/).some((segment) => segment.toLowerCase() === "node_modules");
76734
+ }
76729
76735
  function formatDesktopDisplayName(value) {
76730
76736
  if (!value) {
76731
76737
  return "Elit";
@@ -76768,6 +76774,27 @@ function resolveDesktopBootstrapSupportModulePath(moduleName, packageRoot = PACK
76768
76774
  `Desktop support module "${moduleName}" was not found in ${packageRoot}. Expected one of: ${candidates.join(", ")}`
76769
76775
  );
76770
76776
  }
76777
+ function resolveDesktopCargoTargetBaseDir(packageRoot = PACKAGE_ROOT, cwd = process.cwd(), env = process.env, platform = process.platform) {
76778
+ const explicitTargetDir = env.ELIT_DESKTOP_CARGO_TARGET_DIR?.trim();
76779
+ if (explicitTargetDir) {
76780
+ return resolve4(explicitTargetDir);
76781
+ }
76782
+ const localAppData = env.LOCALAPPDATA?.trim();
76783
+ if (platform === "win32" && localAppData) {
76784
+ return resolve4(localAppData, "elit", "target", "desktop");
76785
+ }
76786
+ if (isNodeModulesPackagePath(packageRoot)) {
76787
+ return resolve4(cwd, ".elit", "target", "desktop");
76788
+ }
76789
+ return resolve4(packageRoot, "target", "desktop");
76790
+ }
76791
+ function resolveDesktopBinaryOverridePath(configuredPath, envName, cwd = process.cwd(), env = process.env) {
76792
+ const explicitPath = env[envName]?.trim() || configuredPath?.trim();
76793
+ if (!explicitPath) {
76794
+ return void 0;
76795
+ }
76796
+ return resolve4(cwd, explicitPath);
76797
+ }
76771
76798
  function createDesktopBootstrapEntry(entryPath, appName) {
76772
76799
  const bootstrapId = randomUUID2();
76773
76800
  const bootstrapPath = join3(dirname4(entryPath), `.elit-desktop-bootstrap-${appName}-${bootstrapId}.ts`);
@@ -76862,6 +76889,9 @@ function parseDesktopRunArgs(args, config) {
76862
76889
  mode: getDefaultDesktopMode(config),
76863
76890
  entry: void 0,
76864
76891
  exportName: config?.native?.exportName,
76892
+ binaryPath: config?.binaryPath,
76893
+ nativeBinaryPath: config?.nativeBinaryPath,
76894
+ cargoTargetDir: config?.cargoTargetDir,
76865
76895
  runtime: config?.runtime ?? "quickjs",
76866
76896
  compiler: config?.compiler ?? "auto",
76867
76897
  release: config?.release ?? false
@@ -76927,6 +76957,9 @@ function parseDesktopBuildArgs(args, config) {
76927
76957
  mode: getDefaultDesktopMode(config),
76928
76958
  entry: void 0,
76929
76959
  exportName: config?.native?.exportName,
76960
+ binaryPath: config?.binaryPath,
76961
+ nativeBinaryPath: config?.nativeBinaryPath,
76962
+ cargoTargetDir: config?.cargoTargetDir,
76930
76963
  runtime: config?.runtime ?? "quickjs",
76931
76964
  compiler: config?.compiler ?? "auto",
76932
76965
  release: config?.release ?? false,
@@ -77073,6 +77106,8 @@ function printDesktopHelp() {
77073
77106
  " - TypeScript and module-style QuickJS entries are transpiled automatically.",
77074
77107
  " - The tsx compiler is Node-only and keeps loading the original source tree.",
77075
77108
  " - The tsx and tsup compilers require those packages to be installed.",
77109
+ " - Use desktop.binaryPath / desktop.nativeBinaryPath or ELIT_DESKTOP_BINARY_PATH / ELIT_DESKTOP_NATIVE_BINARY_PATH to reuse prebuilt runtimes when Cargo builds are blocked.",
77110
+ " - Use desktop.cargoTargetDir or ELIT_DESKTOP_CARGO_TARGET_DIR to move the desktop Cargo cache to a policy-approved location.",
77076
77111
  ' - desktop.mode defaults to "native" when desktop.native.entry exists, otherwise "hybrid".',
77077
77112
  " - desktop.entry is used for hybrid mode. desktop.native.entry is used for native mode.",
77078
77113
  " - Native mode falls back to desktop.entry when only the legacy desktop.entry is configured.",
@@ -77333,6 +77368,8 @@ async function runDesktopRuntime(options) {
77333
77368
  try {
77334
77369
  const binary = ensureDesktopBinary({
77335
77370
  runtime: options.runtime,
77371
+ binaryPath: options.binaryPath,
77372
+ cargoTargetDir: options.cargoTargetDir,
77336
77373
  release: options.release,
77337
77374
  entryPath: options.entry
77338
77375
  });
@@ -77348,6 +77385,8 @@ async function runDesktopNativeRuntime(options) {
77348
77385
  const preparedPayload = await prepareDesktopNativePayload(options);
77349
77386
  try {
77350
77387
  const binary = ensureDesktopNativeBinary({
77388
+ binaryPath: options.nativeBinaryPath,
77389
+ cargoTargetDir: options.cargoTargetDir,
77351
77390
  release: options.release,
77352
77391
  entryPath: options.entry
77353
77392
  });
@@ -77365,13 +77404,14 @@ async function buildDesktopBundle(options) {
77365
77404
  return;
77366
77405
  }
77367
77406
  const triple = options.platform ? PLATFORMS[options.platform] : void 0;
77368
- buildDesktopRuntime({
77407
+ const binary = ensureDesktopBinary({
77369
77408
  runtime: options.runtime,
77409
+ binaryPath: options.binaryPath,
77410
+ cargoTargetDir: options.cargoTargetDir,
77370
77411
  release: options.release,
77371
77412
  triple,
77372
77413
  entryPath: options.entry
77373
77414
  });
77374
- const binary = findDesktopBinary(options.runtime, options.release, triple);
77375
77415
  if (!binary) {
77376
77416
  throw new Error("Desktop runtime binary was not found after cargo build completed.");
77377
77417
  }
@@ -77401,12 +77441,13 @@ async function buildDesktopBundle(options) {
77401
77441
  }
77402
77442
  async function buildDesktopNativeBundle(options) {
77403
77443
  const triple = options.platform ? PLATFORMS[options.platform] : void 0;
77404
- buildDesktopNativeRuntime({
77444
+ const binary = ensureDesktopNativeBinary({
77445
+ binaryPath: options.nativeBinaryPath,
77446
+ cargoTargetDir: options.cargoTargetDir,
77405
77447
  release: options.release,
77406
77448
  triple,
77407
77449
  entryPath: options.entry
77408
77450
  });
77409
- const binary = findDesktopNativeBinary(options.release, triple);
77410
77451
  if (!binary) {
77411
77452
  throw new Error("Desktop native runtime binary was not found after cargo build completed.");
77412
77453
  }
@@ -77434,10 +77475,17 @@ async function buildDesktopNativeBundle(options) {
77434
77475
  }
77435
77476
  }
77436
77477
  function ensureDesktopBinary(options) {
77437
- let binary = findDesktopBinary(options.runtime, options.release, options.triple);
77478
+ const overriddenBinary = resolveDesktopBinaryOverridePath(options.binaryPath, "ELIT_DESKTOP_BINARY_PATH");
77479
+ if (overriddenBinary) {
77480
+ if (!existsSync3(overriddenBinary)) {
77481
+ throw new Error(`Configured desktop runtime binary was not found: ${overriddenBinary}`);
77482
+ }
77483
+ return overriddenBinary;
77484
+ }
77485
+ let binary = findDesktopBinary(options.runtime, options.release, options.triple, options.cargoTargetDir);
77438
77486
  if (!binary || isDesktopRustBuildStale(binary)) {
77439
77487
  buildDesktopRuntime(options);
77440
- binary = findDesktopBinary(options.runtime, options.release, options.triple);
77488
+ binary = findDesktopBinary(options.runtime, options.release, options.triple, options.cargoTargetDir);
77441
77489
  }
77442
77490
  if (!binary) {
77443
77491
  throw new Error("Desktop runtime binary was not found after cargo build completed.");
@@ -77445,10 +77493,17 @@ function ensureDesktopBinary(options) {
77445
77493
  return binary;
77446
77494
  }
77447
77495
  function ensureDesktopNativeBinary(options) {
77448
- let binary = findDesktopNativeBinary(options.release, options.triple);
77496
+ const overriddenBinary = resolveDesktopBinaryOverridePath(options.binaryPath, "ELIT_DESKTOP_NATIVE_BINARY_PATH");
77497
+ if (overriddenBinary) {
77498
+ if (!existsSync3(overriddenBinary)) {
77499
+ throw new Error(`Configured desktop native runtime binary was not found: ${overriddenBinary}`);
77500
+ }
77501
+ return overriddenBinary;
77502
+ }
77503
+ let binary = findDesktopNativeBinary(options.release, options.triple, options.cargoTargetDir);
77449
77504
  if (!binary || isDesktopRustBuildStale(binary)) {
77450
77505
  buildDesktopNativeRuntime(options);
77451
- binary = findDesktopNativeBinary(options.release, options.triple);
77506
+ binary = findDesktopNativeBinary(options.release, options.triple, options.cargoTargetDir);
77452
77507
  }
77453
77508
  if (!binary) {
77454
77509
  throw new Error("Desktop native runtime binary was not found after cargo build completed.");
@@ -77474,7 +77529,7 @@ function buildDesktopRuntime(options) {
77474
77529
  }
77475
77530
  const env = {
77476
77531
  ...process.env,
77477
- CARGO_TARGET_DIR: desktopCargoTargetDir(options.runtime)
77532
+ CARGO_TARGET_DIR: desktopCargoTargetDir(options.runtime, options.cargoTargetDir)
77478
77533
  };
77479
77534
  const iconPath = resolveDesktopIcon(options.entryPath);
77480
77535
  if (iconPath) {
@@ -77494,6 +77549,7 @@ function buildDesktopRuntime(options) {
77494
77549
  throw result2.error;
77495
77550
  }
77496
77551
  if (result2.status !== 0) {
77552
+ printDesktopCargoFailureHint("hybrid");
77497
77553
  process.exit(result2.status ?? 1);
77498
77554
  }
77499
77555
  }
@@ -77513,7 +77569,7 @@ function buildDesktopNativeRuntime(options) {
77513
77569
  }
77514
77570
  const env = {
77515
77571
  ...process.env,
77516
- CARGO_TARGET_DIR: desktopNativeCargoTargetDir()
77572
+ CARGO_TARGET_DIR: desktopNativeCargoTargetDir(options.cargoTargetDir)
77517
77573
  };
77518
77574
  const iconPath = resolveDesktopIcon(options.entryPath);
77519
77575
  if (iconPath) {
@@ -77533,11 +77589,16 @@ function buildDesktopNativeRuntime(options) {
77533
77589
  throw result2.error;
77534
77590
  }
77535
77591
  if (result2.status !== 0) {
77592
+ printDesktopCargoFailureHint("native");
77536
77593
  process.exit(result2.status ?? 1);
77537
77594
  }
77538
77595
  }
77539
- function findDesktopBinary(runtime2, release, triple) {
77540
- const targetDir = desktopCargoTargetDir(runtime2);
77596
+ function findDesktopBinary(runtime2, release, triple, configuredTargetDir, configuredBinaryPath) {
77597
+ const overriddenBinary = resolveDesktopBinaryOverridePath(configuredBinaryPath, "ELIT_DESKTOP_BINARY_PATH");
77598
+ if (overriddenBinary) {
77599
+ return existsSync3(overriddenBinary) ? overriddenBinary : null;
77600
+ }
77601
+ const targetDir = desktopCargoTargetDir(runtime2, configuredTargetDir);
77541
77602
  const profile = release ? "release" : "debug";
77542
77603
  const binaryName = isWindowsTarget(triple) ? "elit-desktop.exe" : "elit-desktop";
77543
77604
  const candidates = triple ? [join3(targetDir, triple, profile, binaryName)] : [join3(targetDir, profile, binaryName)];
@@ -77548,8 +77609,12 @@ function findDesktopBinary(runtime2, release, triple) {
77548
77609
  }
77549
77610
  return null;
77550
77611
  }
77551
- function findDesktopNativeBinary(release, triple) {
77552
- const targetDir = desktopNativeCargoTargetDir();
77612
+ function findDesktopNativeBinary(release, triple, configuredTargetDir, configuredBinaryPath) {
77613
+ const overriddenBinary = resolveDesktopBinaryOverridePath(configuredBinaryPath, "ELIT_DESKTOP_NATIVE_BINARY_PATH");
77614
+ if (overriddenBinary) {
77615
+ return existsSync3(overriddenBinary) ? overriddenBinary : null;
77616
+ }
77617
+ const targetDir = desktopNativeCargoTargetDir(configuredTargetDir);
77553
77618
  const profile = release ? "release" : "debug";
77554
77619
  const binaryName = isWindowsTarget(triple) ? "elit-desktop-native.exe" : "elit-desktop-native";
77555
77620
  const candidates = triple ? [join3(targetDir, triple, profile, binaryName)] : [join3(targetDir, profile, binaryName)];
@@ -77560,11 +77625,34 @@ function findDesktopNativeBinary(release, triple) {
77560
77625
  }
77561
77626
  return null;
77562
77627
  }
77563
- function desktopCargoTargetDir(runtime2) {
77564
- return resolve4(PACKAGE_ROOT, "target", "desktop", runtime2);
77628
+ function desktopCargoTargetDir(runtime2, configuredTargetDir) {
77629
+ return resolve4(resolveDesktopCargoTargetBaseDir(
77630
+ PACKAGE_ROOT,
77631
+ process.cwd(),
77632
+ {
77633
+ ...process.env,
77634
+ ...configuredTargetDir ? { ELIT_DESKTOP_CARGO_TARGET_DIR: configuredTargetDir } : {}
77635
+ }
77636
+ ), runtime2);
77637
+ }
77638
+ function desktopNativeCargoTargetDir(configuredTargetDir) {
77639
+ return resolve4(resolveDesktopCargoTargetBaseDir(
77640
+ PACKAGE_ROOT,
77641
+ process.cwd(),
77642
+ {
77643
+ ...process.env,
77644
+ ...configuredTargetDir ? { ELIT_DESKTOP_CARGO_TARGET_DIR: configuredTargetDir } : {}
77645
+ }
77646
+ ), "native");
77565
77647
  }
77566
- function desktopNativeCargoTargetDir() {
77567
- return resolve4(PACKAGE_ROOT, "target", "desktop", "native");
77648
+ function printDesktopCargoFailureHint(mode) {
77649
+ if (process.platform !== "win32") {
77650
+ return;
77651
+ }
77652
+ const binaryConfigLabel = mode === "native" ? "desktop.nativeBinaryPath or ELIT_DESKTOP_NATIVE_BINARY_PATH" : "desktop.binaryPath or ELIT_DESKTOP_BINARY_PATH";
77653
+ console.error("[desktop] Cargo build failed. If Windows Application Control blocks Rust build scripts on this machine, configure a prebuilt runtime binary.");
77654
+ console.error(`[desktop] Use ${binaryConfigLabel} to bypass Cargo for desktop runs/builds.`);
77655
+ console.error("[desktop] Use desktop.cargoTargetDir or ELIT_DESKTOP_CARGO_TARGET_DIR if your environment only allows specific cache locations.");
77568
77656
  }
77569
77657
  function isDesktopRustBuildStale(binaryPath) {
77570
77658
  if (!existsSync3(binaryPath)) {
package/dist/config.cjs CHANGED
@@ -945,6 +945,9 @@ async function loadConfigFile(configPath) {
945
945
  await build({
946
946
  entryPoints: [configPath],
947
947
  bundle: true,
948
+ banner: {
949
+ js: `import { createRequire as __createRequire } from 'module'; const require = __createRequire(import.meta.url);`
950
+ },
948
951
  format: "esm",
949
952
  platform: "node",
950
953
  outfile: tempFile,
package/dist/config.d.ts CHANGED
@@ -151,8 +151,14 @@ interface DesktopConfig {
151
151
  mode?: DesktopMode;
152
152
  /** Desktop entry file used when the CLI command omits <entry> in hybrid mode */
153
153
  entry?: string;
154
+ /** Optional prebuilt hybrid desktop runtime binary path, relative to the current project when not absolute */
155
+ binaryPath?: string;
156
+ /** Optional Cargo target directory override for desktop runtime builds */
157
+ cargoTargetDir?: string;
154
158
  /** Optional native desktop entry defaults */
155
159
  native?: DesktopNativeConfig;
160
+ /** Optional prebuilt native desktop runtime binary path, relative to the current project when not absolute */
161
+ nativeBinaryPath?: string;
156
162
  /** Native desktop runtime: quickjs, bun, node, deno */
157
163
  runtime?: 'quickjs' | 'bun' | 'node' | 'deno';
158
164
  /** Desktop entry compiler: auto, none, esbuild, tsx, tsup */
package/dist/config.js CHANGED
@@ -3445,6 +3445,9 @@ error: ${text}`);
3445
3445
  await build({
3446
3446
  entryPoints: [configPath],
3447
3447
  bundle: true,
3448
+ banner: {
3449
+ js: `import { createRequire as __createRequire } from 'module'; const require = __createRequire(import.meta.url);`
3450
+ },
3448
3451
  format: "esm",
3449
3452
  platform: "node",
3450
3453
  outfile: tempFile,
package/dist/config.mjs CHANGED
@@ -920,6 +920,9 @@ async function loadConfigFile(configPath) {
920
920
  await build({
921
921
  entryPoints: [configPath],
922
922
  bundle: true,
923
+ banner: {
924
+ js: `import { createRequire as __createRequire } from 'module'; const require = __createRequire(import.meta.url);`
925
+ },
923
926
  format: "esm",
924
927
  platform: "node",
925
928
  outfile: tempFile,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "elit",
3
- "version": "3.5.8",
3
+ "version": "3.5.9",
4
4
  "description": "Optimized lightweight library for creating DOM elements with reactive state",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",