elit 3.5.7 → 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 +1 -1
- package/Cargo.toml +1 -1
- package/README.md +1 -1
- package/dist/build.d.ts +1 -1
- package/dist/cli.cjs +122 -20
- package/dist/cli.mjs +122 -20
- package/dist/config.cjs +3 -0
- package/dist/config.d.ts +7 -1
- package/dist/config.js +3 -0
- package/dist/config.mjs +3 -0
- package/dist/coverage.d.ts +1 -1
- package/dist/desktop-auto-render.cjs +2370 -0
- package/dist/desktop-auto-render.d.ts +13 -0
- package/dist/desktop-auto-render.js +2341 -0
- package/dist/desktop-auto-render.mjs +2344 -0
- package/dist/render-context.cjs +118 -0
- package/dist/render-context.d.ts +39 -0
- package/dist/render-context.js +77 -0
- package/dist/render-context.mjs +87 -0
- package/dist/{server-CNgDUgSZ.d.ts → server-FCdUqabc.d.ts} +1 -1
- package/dist/server.d.ts +1 -1
- package/package.json +21 -1
package/Cargo.lock
CHANGED
package/Cargo.toml
CHANGED
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.
|
|
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/build.d.ts
CHANGED
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";
|
|
@@ -76769,12 +76775,47 @@ function resolveDesktopEntryDisplayName(entryPath, fallbackName) {
|
|
|
76769
76775
|
}
|
|
76770
76776
|
return formatDesktopDisplayName(fallbackName);
|
|
76771
76777
|
}
|
|
76778
|
+
function resolveDesktopBootstrapSupportModulePath(moduleName, packageRoot = PACKAGE_ROOT) {
|
|
76779
|
+
const candidates = [
|
|
76780
|
+
(0, import_node_path3.resolve)(packageRoot, "src", `${moduleName}.ts`),
|
|
76781
|
+
(0, import_node_path3.resolve)(packageRoot, "dist", `${moduleName}.mjs`)
|
|
76782
|
+
];
|
|
76783
|
+
for (const candidate of candidates) {
|
|
76784
|
+
if ((0, import_node_fs3.existsSync)(candidate)) {
|
|
76785
|
+
return candidate;
|
|
76786
|
+
}
|
|
76787
|
+
}
|
|
76788
|
+
throw new Error(
|
|
76789
|
+
`Desktop support module "${moduleName}" was not found in ${packageRoot}. Expected one of: ${candidates.join(", ")}`
|
|
76790
|
+
);
|
|
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
|
+
}
|
|
76772
76813
|
function createDesktopBootstrapEntry(entryPath, appName) {
|
|
76773
76814
|
const bootstrapId = (0, import_node_crypto3.randomUUID)();
|
|
76774
76815
|
const bootstrapPath = (0, import_node_path3.join)((0, import_node_path3.dirname)(entryPath), `.elit-desktop-bootstrap-${appName}-${bootstrapId}.ts`);
|
|
76775
76816
|
const preludePath = (0, import_node_path3.join)((0, import_node_path3.dirname)(entryPath), `.elit-desktop-prelude-${appName}-${bootstrapId}.ts`);
|
|
76776
|
-
const desktopAutoRenderPath = (
|
|
76777
|
-
const renderContextPath = (
|
|
76817
|
+
const desktopAutoRenderPath = resolveDesktopBootstrapSupportModulePath("desktop-auto-render");
|
|
76818
|
+
const renderContextPath = resolveDesktopBootstrapSupportModulePath("render-context");
|
|
76778
76819
|
const defaultTitle = `${resolveDesktopEntryDisplayName(entryPath, appName)} Desktop`;
|
|
76779
76820
|
(0, import_node_fs3.writeFileSync)(
|
|
76780
76821
|
preludePath,
|
|
@@ -76863,6 +76904,9 @@ function parseDesktopRunArgs(args, config) {
|
|
|
76863
76904
|
mode: getDefaultDesktopMode(config),
|
|
76864
76905
|
entry: void 0,
|
|
76865
76906
|
exportName: config?.native?.exportName,
|
|
76907
|
+
binaryPath: config?.binaryPath,
|
|
76908
|
+
nativeBinaryPath: config?.nativeBinaryPath,
|
|
76909
|
+
cargoTargetDir: config?.cargoTargetDir,
|
|
76866
76910
|
runtime: config?.runtime ?? "quickjs",
|
|
76867
76911
|
compiler: config?.compiler ?? "auto",
|
|
76868
76912
|
release: config?.release ?? false
|
|
@@ -76928,6 +76972,9 @@ function parseDesktopBuildArgs(args, config) {
|
|
|
76928
76972
|
mode: getDefaultDesktopMode(config),
|
|
76929
76973
|
entry: void 0,
|
|
76930
76974
|
exportName: config?.native?.exportName,
|
|
76975
|
+
binaryPath: config?.binaryPath,
|
|
76976
|
+
nativeBinaryPath: config?.nativeBinaryPath,
|
|
76977
|
+
cargoTargetDir: config?.cargoTargetDir,
|
|
76931
76978
|
runtime: config?.runtime ?? "quickjs",
|
|
76932
76979
|
compiler: config?.compiler ?? "auto",
|
|
76933
76980
|
release: config?.release ?? false,
|
|
@@ -77074,6 +77121,8 @@ function printDesktopHelp() {
|
|
|
77074
77121
|
" - TypeScript and module-style QuickJS entries are transpiled automatically.",
|
|
77075
77122
|
" - The tsx compiler is Node-only and keeps loading the original source tree.",
|
|
77076
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.",
|
|
77077
77126
|
' - desktop.mode defaults to "native" when desktop.native.entry exists, otherwise "hybrid".',
|
|
77078
77127
|
" - desktop.entry is used for hybrid mode. desktop.native.entry is used for native mode.",
|
|
77079
77128
|
" - Native mode falls back to desktop.entry when only the legacy desktop.entry is configured.",
|
|
@@ -77334,6 +77383,8 @@ async function runDesktopRuntime(options) {
|
|
|
77334
77383
|
try {
|
|
77335
77384
|
const binary = ensureDesktopBinary({
|
|
77336
77385
|
runtime: options.runtime,
|
|
77386
|
+
binaryPath: options.binaryPath,
|
|
77387
|
+
cargoTargetDir: options.cargoTargetDir,
|
|
77337
77388
|
release: options.release,
|
|
77338
77389
|
entryPath: options.entry
|
|
77339
77390
|
});
|
|
@@ -77349,6 +77400,8 @@ async function runDesktopNativeRuntime(options) {
|
|
|
77349
77400
|
const preparedPayload = await prepareDesktopNativePayload(options);
|
|
77350
77401
|
try {
|
|
77351
77402
|
const binary = ensureDesktopNativeBinary({
|
|
77403
|
+
binaryPath: options.nativeBinaryPath,
|
|
77404
|
+
cargoTargetDir: options.cargoTargetDir,
|
|
77352
77405
|
release: options.release,
|
|
77353
77406
|
entryPath: options.entry
|
|
77354
77407
|
});
|
|
@@ -77366,13 +77419,14 @@ async function buildDesktopBundle(options) {
|
|
|
77366
77419
|
return;
|
|
77367
77420
|
}
|
|
77368
77421
|
const triple = options.platform ? PLATFORMS[options.platform] : void 0;
|
|
77369
|
-
|
|
77422
|
+
const binary = ensureDesktopBinary({
|
|
77370
77423
|
runtime: options.runtime,
|
|
77424
|
+
binaryPath: options.binaryPath,
|
|
77425
|
+
cargoTargetDir: options.cargoTargetDir,
|
|
77371
77426
|
release: options.release,
|
|
77372
77427
|
triple,
|
|
77373
77428
|
entryPath: options.entry
|
|
77374
77429
|
});
|
|
77375
|
-
const binary = findDesktopBinary(options.runtime, options.release, triple);
|
|
77376
77430
|
if (!binary) {
|
|
77377
77431
|
throw new Error("Desktop runtime binary was not found after cargo build completed.");
|
|
77378
77432
|
}
|
|
@@ -77402,12 +77456,13 @@ async function buildDesktopBundle(options) {
|
|
|
77402
77456
|
}
|
|
77403
77457
|
async function buildDesktopNativeBundle(options) {
|
|
77404
77458
|
const triple = options.platform ? PLATFORMS[options.platform] : void 0;
|
|
77405
|
-
|
|
77459
|
+
const binary = ensureDesktopNativeBinary({
|
|
77460
|
+
binaryPath: options.nativeBinaryPath,
|
|
77461
|
+
cargoTargetDir: options.cargoTargetDir,
|
|
77406
77462
|
release: options.release,
|
|
77407
77463
|
triple,
|
|
77408
77464
|
entryPath: options.entry
|
|
77409
77465
|
});
|
|
77410
|
-
const binary = findDesktopNativeBinary(options.release, triple);
|
|
77411
77466
|
if (!binary) {
|
|
77412
77467
|
throw new Error("Desktop native runtime binary was not found after cargo build completed.");
|
|
77413
77468
|
}
|
|
@@ -77435,10 +77490,17 @@ async function buildDesktopNativeBundle(options) {
|
|
|
77435
77490
|
}
|
|
77436
77491
|
}
|
|
77437
77492
|
function ensureDesktopBinary(options) {
|
|
77438
|
-
|
|
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);
|
|
77439
77501
|
if (!binary || isDesktopRustBuildStale(binary)) {
|
|
77440
77502
|
buildDesktopRuntime(options);
|
|
77441
|
-
binary = findDesktopBinary(options.runtime, options.release, options.triple);
|
|
77503
|
+
binary = findDesktopBinary(options.runtime, options.release, options.triple, options.cargoTargetDir);
|
|
77442
77504
|
}
|
|
77443
77505
|
if (!binary) {
|
|
77444
77506
|
throw new Error("Desktop runtime binary was not found after cargo build completed.");
|
|
@@ -77446,10 +77508,17 @@ function ensureDesktopBinary(options) {
|
|
|
77446
77508
|
return binary;
|
|
77447
77509
|
}
|
|
77448
77510
|
function ensureDesktopNativeBinary(options) {
|
|
77449
|
-
|
|
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);
|
|
77450
77519
|
if (!binary || isDesktopRustBuildStale(binary)) {
|
|
77451
77520
|
buildDesktopNativeRuntime(options);
|
|
77452
|
-
binary = findDesktopNativeBinary(options.release, options.triple);
|
|
77521
|
+
binary = findDesktopNativeBinary(options.release, options.triple, options.cargoTargetDir);
|
|
77453
77522
|
}
|
|
77454
77523
|
if (!binary) {
|
|
77455
77524
|
throw new Error("Desktop native runtime binary was not found after cargo build completed.");
|
|
@@ -77475,7 +77544,7 @@ function buildDesktopRuntime(options) {
|
|
|
77475
77544
|
}
|
|
77476
77545
|
const env = {
|
|
77477
77546
|
...process.env,
|
|
77478
|
-
CARGO_TARGET_DIR: desktopCargoTargetDir(options.runtime)
|
|
77547
|
+
CARGO_TARGET_DIR: desktopCargoTargetDir(options.runtime, options.cargoTargetDir)
|
|
77479
77548
|
};
|
|
77480
77549
|
const iconPath = resolveDesktopIcon(options.entryPath);
|
|
77481
77550
|
if (iconPath) {
|
|
@@ -77495,6 +77564,7 @@ function buildDesktopRuntime(options) {
|
|
|
77495
77564
|
throw result2.error;
|
|
77496
77565
|
}
|
|
77497
77566
|
if (result2.status !== 0) {
|
|
77567
|
+
printDesktopCargoFailureHint("hybrid");
|
|
77498
77568
|
process.exit(result2.status ?? 1);
|
|
77499
77569
|
}
|
|
77500
77570
|
}
|
|
@@ -77514,7 +77584,7 @@ function buildDesktopNativeRuntime(options) {
|
|
|
77514
77584
|
}
|
|
77515
77585
|
const env = {
|
|
77516
77586
|
...process.env,
|
|
77517
|
-
CARGO_TARGET_DIR: desktopNativeCargoTargetDir()
|
|
77587
|
+
CARGO_TARGET_DIR: desktopNativeCargoTargetDir(options.cargoTargetDir)
|
|
77518
77588
|
};
|
|
77519
77589
|
const iconPath = resolveDesktopIcon(options.entryPath);
|
|
77520
77590
|
if (iconPath) {
|
|
@@ -77534,11 +77604,16 @@ function buildDesktopNativeRuntime(options) {
|
|
|
77534
77604
|
throw result2.error;
|
|
77535
77605
|
}
|
|
77536
77606
|
if (result2.status !== 0) {
|
|
77607
|
+
printDesktopCargoFailureHint("native");
|
|
77537
77608
|
process.exit(result2.status ?? 1);
|
|
77538
77609
|
}
|
|
77539
77610
|
}
|
|
77540
|
-
function findDesktopBinary(runtime2, release, triple) {
|
|
77541
|
-
const
|
|
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);
|
|
77542
77617
|
const profile = release ? "release" : "debug";
|
|
77543
77618
|
const binaryName = isWindowsTarget(triple) ? "elit-desktop.exe" : "elit-desktop";
|
|
77544
77619
|
const candidates = triple ? [(0, import_node_path3.join)(targetDir, triple, profile, binaryName)] : [(0, import_node_path3.join)(targetDir, profile, binaryName)];
|
|
@@ -77549,8 +77624,12 @@ function findDesktopBinary(runtime2, release, triple) {
|
|
|
77549
77624
|
}
|
|
77550
77625
|
return null;
|
|
77551
77626
|
}
|
|
77552
|
-
function findDesktopNativeBinary(release, triple) {
|
|
77553
|
-
const
|
|
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);
|
|
77554
77633
|
const profile = release ? "release" : "debug";
|
|
77555
77634
|
const binaryName = isWindowsTarget(triple) ? "elit-desktop-native.exe" : "elit-desktop-native";
|
|
77556
77635
|
const candidates = triple ? [(0, import_node_path3.join)(targetDir, triple, profile, binaryName)] : [(0, import_node_path3.join)(targetDir, profile, binaryName)];
|
|
@@ -77561,11 +77640,34 @@ function findDesktopNativeBinary(release, triple) {
|
|
|
77561
77640
|
}
|
|
77562
77641
|
return null;
|
|
77563
77642
|
}
|
|
77564
|
-
function desktopCargoTargetDir(runtime2) {
|
|
77565
|
-
return (0, import_node_path3.resolve)(
|
|
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");
|
|
77566
77662
|
}
|
|
77567
|
-
function
|
|
77568
|
-
|
|
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.");
|
|
77569
77671
|
}
|
|
77570
77672
|
function isDesktopRustBuildStale(binaryPath) {
|
|
77571
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";
|
|
@@ -76754,12 +76760,47 @@ function resolveDesktopEntryDisplayName(entryPath, fallbackName) {
|
|
|
76754
76760
|
}
|
|
76755
76761
|
return formatDesktopDisplayName(fallbackName);
|
|
76756
76762
|
}
|
|
76763
|
+
function resolveDesktopBootstrapSupportModulePath(moduleName, packageRoot = PACKAGE_ROOT) {
|
|
76764
|
+
const candidates = [
|
|
76765
|
+
resolve4(packageRoot, "src", `${moduleName}.ts`),
|
|
76766
|
+
resolve4(packageRoot, "dist", `${moduleName}.mjs`)
|
|
76767
|
+
];
|
|
76768
|
+
for (const candidate of candidates) {
|
|
76769
|
+
if (existsSync3(candidate)) {
|
|
76770
|
+
return candidate;
|
|
76771
|
+
}
|
|
76772
|
+
}
|
|
76773
|
+
throw new Error(
|
|
76774
|
+
`Desktop support module "${moduleName}" was not found in ${packageRoot}. Expected one of: ${candidates.join(", ")}`
|
|
76775
|
+
);
|
|
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
|
+
}
|
|
76757
76798
|
function createDesktopBootstrapEntry(entryPath, appName) {
|
|
76758
76799
|
const bootstrapId = randomUUID2();
|
|
76759
76800
|
const bootstrapPath = join3(dirname4(entryPath), `.elit-desktop-bootstrap-${appName}-${bootstrapId}.ts`);
|
|
76760
76801
|
const preludePath = join3(dirname4(entryPath), `.elit-desktop-prelude-${appName}-${bootstrapId}.ts`);
|
|
76761
|
-
const desktopAutoRenderPath =
|
|
76762
|
-
const renderContextPath =
|
|
76802
|
+
const desktopAutoRenderPath = resolveDesktopBootstrapSupportModulePath("desktop-auto-render");
|
|
76803
|
+
const renderContextPath = resolveDesktopBootstrapSupportModulePath("render-context");
|
|
76763
76804
|
const defaultTitle = `${resolveDesktopEntryDisplayName(entryPath, appName)} Desktop`;
|
|
76764
76805
|
writeFileSync4(
|
|
76765
76806
|
preludePath,
|
|
@@ -76848,6 +76889,9 @@ function parseDesktopRunArgs(args, config) {
|
|
|
76848
76889
|
mode: getDefaultDesktopMode(config),
|
|
76849
76890
|
entry: void 0,
|
|
76850
76891
|
exportName: config?.native?.exportName,
|
|
76892
|
+
binaryPath: config?.binaryPath,
|
|
76893
|
+
nativeBinaryPath: config?.nativeBinaryPath,
|
|
76894
|
+
cargoTargetDir: config?.cargoTargetDir,
|
|
76851
76895
|
runtime: config?.runtime ?? "quickjs",
|
|
76852
76896
|
compiler: config?.compiler ?? "auto",
|
|
76853
76897
|
release: config?.release ?? false
|
|
@@ -76913,6 +76957,9 @@ function parseDesktopBuildArgs(args, config) {
|
|
|
76913
76957
|
mode: getDefaultDesktopMode(config),
|
|
76914
76958
|
entry: void 0,
|
|
76915
76959
|
exportName: config?.native?.exportName,
|
|
76960
|
+
binaryPath: config?.binaryPath,
|
|
76961
|
+
nativeBinaryPath: config?.nativeBinaryPath,
|
|
76962
|
+
cargoTargetDir: config?.cargoTargetDir,
|
|
76916
76963
|
runtime: config?.runtime ?? "quickjs",
|
|
76917
76964
|
compiler: config?.compiler ?? "auto",
|
|
76918
76965
|
release: config?.release ?? false,
|
|
@@ -77059,6 +77106,8 @@ function printDesktopHelp() {
|
|
|
77059
77106
|
" - TypeScript and module-style QuickJS entries are transpiled automatically.",
|
|
77060
77107
|
" - The tsx compiler is Node-only and keeps loading the original source tree.",
|
|
77061
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.",
|
|
77062
77111
|
' - desktop.mode defaults to "native" when desktop.native.entry exists, otherwise "hybrid".',
|
|
77063
77112
|
" - desktop.entry is used for hybrid mode. desktop.native.entry is used for native mode.",
|
|
77064
77113
|
" - Native mode falls back to desktop.entry when only the legacy desktop.entry is configured.",
|
|
@@ -77319,6 +77368,8 @@ async function runDesktopRuntime(options) {
|
|
|
77319
77368
|
try {
|
|
77320
77369
|
const binary = ensureDesktopBinary({
|
|
77321
77370
|
runtime: options.runtime,
|
|
77371
|
+
binaryPath: options.binaryPath,
|
|
77372
|
+
cargoTargetDir: options.cargoTargetDir,
|
|
77322
77373
|
release: options.release,
|
|
77323
77374
|
entryPath: options.entry
|
|
77324
77375
|
});
|
|
@@ -77334,6 +77385,8 @@ async function runDesktopNativeRuntime(options) {
|
|
|
77334
77385
|
const preparedPayload = await prepareDesktopNativePayload(options);
|
|
77335
77386
|
try {
|
|
77336
77387
|
const binary = ensureDesktopNativeBinary({
|
|
77388
|
+
binaryPath: options.nativeBinaryPath,
|
|
77389
|
+
cargoTargetDir: options.cargoTargetDir,
|
|
77337
77390
|
release: options.release,
|
|
77338
77391
|
entryPath: options.entry
|
|
77339
77392
|
});
|
|
@@ -77351,13 +77404,14 @@ async function buildDesktopBundle(options) {
|
|
|
77351
77404
|
return;
|
|
77352
77405
|
}
|
|
77353
77406
|
const triple = options.platform ? PLATFORMS[options.platform] : void 0;
|
|
77354
|
-
|
|
77407
|
+
const binary = ensureDesktopBinary({
|
|
77355
77408
|
runtime: options.runtime,
|
|
77409
|
+
binaryPath: options.binaryPath,
|
|
77410
|
+
cargoTargetDir: options.cargoTargetDir,
|
|
77356
77411
|
release: options.release,
|
|
77357
77412
|
triple,
|
|
77358
77413
|
entryPath: options.entry
|
|
77359
77414
|
});
|
|
77360
|
-
const binary = findDesktopBinary(options.runtime, options.release, triple);
|
|
77361
77415
|
if (!binary) {
|
|
77362
77416
|
throw new Error("Desktop runtime binary was not found after cargo build completed.");
|
|
77363
77417
|
}
|
|
@@ -77387,12 +77441,13 @@ async function buildDesktopBundle(options) {
|
|
|
77387
77441
|
}
|
|
77388
77442
|
async function buildDesktopNativeBundle(options) {
|
|
77389
77443
|
const triple = options.platform ? PLATFORMS[options.platform] : void 0;
|
|
77390
|
-
|
|
77444
|
+
const binary = ensureDesktopNativeBinary({
|
|
77445
|
+
binaryPath: options.nativeBinaryPath,
|
|
77446
|
+
cargoTargetDir: options.cargoTargetDir,
|
|
77391
77447
|
release: options.release,
|
|
77392
77448
|
triple,
|
|
77393
77449
|
entryPath: options.entry
|
|
77394
77450
|
});
|
|
77395
|
-
const binary = findDesktopNativeBinary(options.release, triple);
|
|
77396
77451
|
if (!binary) {
|
|
77397
77452
|
throw new Error("Desktop native runtime binary was not found after cargo build completed.");
|
|
77398
77453
|
}
|
|
@@ -77420,10 +77475,17 @@ async function buildDesktopNativeBundle(options) {
|
|
|
77420
77475
|
}
|
|
77421
77476
|
}
|
|
77422
77477
|
function ensureDesktopBinary(options) {
|
|
77423
|
-
|
|
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);
|
|
77424
77486
|
if (!binary || isDesktopRustBuildStale(binary)) {
|
|
77425
77487
|
buildDesktopRuntime(options);
|
|
77426
|
-
binary = findDesktopBinary(options.runtime, options.release, options.triple);
|
|
77488
|
+
binary = findDesktopBinary(options.runtime, options.release, options.triple, options.cargoTargetDir);
|
|
77427
77489
|
}
|
|
77428
77490
|
if (!binary) {
|
|
77429
77491
|
throw new Error("Desktop runtime binary was not found after cargo build completed.");
|
|
@@ -77431,10 +77493,17 @@ function ensureDesktopBinary(options) {
|
|
|
77431
77493
|
return binary;
|
|
77432
77494
|
}
|
|
77433
77495
|
function ensureDesktopNativeBinary(options) {
|
|
77434
|
-
|
|
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);
|
|
77435
77504
|
if (!binary || isDesktopRustBuildStale(binary)) {
|
|
77436
77505
|
buildDesktopNativeRuntime(options);
|
|
77437
|
-
binary = findDesktopNativeBinary(options.release, options.triple);
|
|
77506
|
+
binary = findDesktopNativeBinary(options.release, options.triple, options.cargoTargetDir);
|
|
77438
77507
|
}
|
|
77439
77508
|
if (!binary) {
|
|
77440
77509
|
throw new Error("Desktop native runtime binary was not found after cargo build completed.");
|
|
@@ -77460,7 +77529,7 @@ function buildDesktopRuntime(options) {
|
|
|
77460
77529
|
}
|
|
77461
77530
|
const env = {
|
|
77462
77531
|
...process.env,
|
|
77463
|
-
CARGO_TARGET_DIR: desktopCargoTargetDir(options.runtime)
|
|
77532
|
+
CARGO_TARGET_DIR: desktopCargoTargetDir(options.runtime, options.cargoTargetDir)
|
|
77464
77533
|
};
|
|
77465
77534
|
const iconPath = resolveDesktopIcon(options.entryPath);
|
|
77466
77535
|
if (iconPath) {
|
|
@@ -77480,6 +77549,7 @@ function buildDesktopRuntime(options) {
|
|
|
77480
77549
|
throw result2.error;
|
|
77481
77550
|
}
|
|
77482
77551
|
if (result2.status !== 0) {
|
|
77552
|
+
printDesktopCargoFailureHint("hybrid");
|
|
77483
77553
|
process.exit(result2.status ?? 1);
|
|
77484
77554
|
}
|
|
77485
77555
|
}
|
|
@@ -77499,7 +77569,7 @@ function buildDesktopNativeRuntime(options) {
|
|
|
77499
77569
|
}
|
|
77500
77570
|
const env = {
|
|
77501
77571
|
...process.env,
|
|
77502
|
-
CARGO_TARGET_DIR: desktopNativeCargoTargetDir()
|
|
77572
|
+
CARGO_TARGET_DIR: desktopNativeCargoTargetDir(options.cargoTargetDir)
|
|
77503
77573
|
};
|
|
77504
77574
|
const iconPath = resolveDesktopIcon(options.entryPath);
|
|
77505
77575
|
if (iconPath) {
|
|
@@ -77519,11 +77589,16 @@ function buildDesktopNativeRuntime(options) {
|
|
|
77519
77589
|
throw result2.error;
|
|
77520
77590
|
}
|
|
77521
77591
|
if (result2.status !== 0) {
|
|
77592
|
+
printDesktopCargoFailureHint("native");
|
|
77522
77593
|
process.exit(result2.status ?? 1);
|
|
77523
77594
|
}
|
|
77524
77595
|
}
|
|
77525
|
-
function findDesktopBinary(runtime2, release, triple) {
|
|
77526
|
-
const
|
|
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);
|
|
77527
77602
|
const profile = release ? "release" : "debug";
|
|
77528
77603
|
const binaryName = isWindowsTarget(triple) ? "elit-desktop.exe" : "elit-desktop";
|
|
77529
77604
|
const candidates = triple ? [join3(targetDir, triple, profile, binaryName)] : [join3(targetDir, profile, binaryName)];
|
|
@@ -77534,8 +77609,12 @@ function findDesktopBinary(runtime2, release, triple) {
|
|
|
77534
77609
|
}
|
|
77535
77610
|
return null;
|
|
77536
77611
|
}
|
|
77537
|
-
function findDesktopNativeBinary(release, triple) {
|
|
77538
|
-
const
|
|
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);
|
|
77539
77618
|
const profile = release ? "release" : "debug";
|
|
77540
77619
|
const binaryName = isWindowsTarget(triple) ? "elit-desktop-native.exe" : "elit-desktop-native";
|
|
77541
77620
|
const candidates = triple ? [join3(targetDir, triple, profile, binaryName)] : [join3(targetDir, profile, binaryName)];
|
|
@@ -77546,11 +77625,34 @@ function findDesktopNativeBinary(release, triple) {
|
|
|
77546
77625
|
}
|
|
77547
77626
|
return null;
|
|
77548
77627
|
}
|
|
77549
|
-
function desktopCargoTargetDir(runtime2) {
|
|
77550
|
-
return resolve4(
|
|
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");
|
|
77551
77647
|
}
|
|
77552
|
-
function
|
|
77553
|
-
|
|
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.");
|
|
77554
77656
|
}
|
|
77555
77657
|
function isDesktopRustBuildStale(binaryPath) {
|
|
77556
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
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { D as DevServerOptions, B as BuildOptions, P as PreviewOptions, T as TestOptions } from './server-
|
|
1
|
+
import { D as DevServerOptions, B as BuildOptions, P as PreviewOptions, T as TestOptions } from './server-FCdUqabc.js';
|
|
2
2
|
import './http.js';
|
|
3
3
|
import 'node:events';
|
|
4
4
|
import './ws.js';
|
|
@@ -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/dist/coverage.d.ts
CHANGED