elit 3.5.8 → 3.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/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 +109 -22
- package/dist/cli.mjs +109 -22
- 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.d.ts +1 -1
- package/dist/render-context.d.ts +1 -1
- package/dist/{server-FCdUqabc.d.ts → server-CcBFc2F5.d.ts} +1 -1
- package/dist/server.cjs +3 -4
- package/dist/server.d.ts +1 -1
- package/dist/server.js +3 -4
- package/dist/server.mjs +3 -4
- package/package.json +1 -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.
|
|
958
|
+
Highlights in `v3.6.0`:
|
|
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,
|
|
@@ -61322,14 +61325,13 @@ var sendError = (res, code, msg) => {
|
|
|
61322
61325
|
var send404 = (res, msg = "Not Found") => sendError(res, 404, msg);
|
|
61323
61326
|
var send403 = (res, msg = "Forbidden") => sendError(res, 403, msg);
|
|
61324
61327
|
var send500 = (res, msg = "Internal Server Error") => sendError(res, 500, msg);
|
|
61325
|
-
async function resolveWorkspaceElitImportBasePath(rootDir, basePath,
|
|
61328
|
+
async function resolveWorkspaceElitImportBasePath(rootDir, basePath, _mode) {
|
|
61326
61329
|
const resolvedRootDir = await realpath(resolve(rootDir));
|
|
61327
61330
|
try {
|
|
61328
61331
|
const packageJsonBuffer = await readFile(join(resolvedRootDir, "package.json"));
|
|
61329
61332
|
const packageJson = JSON.parse(packageJsonBuffer.toString());
|
|
61330
61333
|
if (packageJson.name === "elit") {
|
|
61331
|
-
|
|
61332
|
-
return basePath ? `${basePath}/${workspaceDir}` : `/${workspaceDir}`;
|
|
61334
|
+
return basePath ? `${basePath}/dist` : "/dist";
|
|
61333
61335
|
}
|
|
61334
61336
|
} catch {
|
|
61335
61337
|
}
|
|
@@ -61337,7 +61339,7 @@ async function resolveWorkspaceElitImportBasePath(rootDir, basePath, mode) {
|
|
|
61337
61339
|
}
|
|
61338
61340
|
var createElitImportMap = async (rootDir, basePath = "", mode = "dev") => {
|
|
61339
61341
|
const workspaceImportBasePath = await resolveWorkspaceElitImportBasePath(rootDir, basePath, mode);
|
|
61340
|
-
const fileExt =
|
|
61342
|
+
const fileExt = ".js";
|
|
61341
61343
|
const elitImports = workspaceImportBasePath ? {
|
|
61342
61344
|
"elit": `${workspaceImportBasePath}/index${fileExt}`,
|
|
61343
61345
|
"elit/": `${workspaceImportBasePath}/`,
|
|
@@ -76741,6 +76743,9 @@ function toDesktopBootstrapImportPath(fromPath, toPath) {
|
|
|
76741
76743
|
const importPath = (0, import_node_path3.relative)((0, import_node_path3.dirname)(fromPath), toPath).replace(/\\/g, "/");
|
|
76742
76744
|
return importPath.startsWith("./") || importPath.startsWith("../") ? importPath : `./${importPath}`;
|
|
76743
76745
|
}
|
|
76746
|
+
function isNodeModulesPackagePath(path) {
|
|
76747
|
+
return path.split(/[\\/]+/).some((segment) => segment.toLowerCase() === "node_modules");
|
|
76748
|
+
}
|
|
76744
76749
|
function formatDesktopDisplayName(value) {
|
|
76745
76750
|
if (!value) {
|
|
76746
76751
|
return "Elit";
|
|
@@ -76783,6 +76788,27 @@ function resolveDesktopBootstrapSupportModulePath(moduleName, packageRoot = PACK
|
|
|
76783
76788
|
`Desktop support module "${moduleName}" was not found in ${packageRoot}. Expected one of: ${candidates.join(", ")}`
|
|
76784
76789
|
);
|
|
76785
76790
|
}
|
|
76791
|
+
function resolveDesktopCargoTargetBaseDir(packageRoot = PACKAGE_ROOT, cwd = process.cwd(), env = process.env, platform = process.platform) {
|
|
76792
|
+
const explicitTargetDir = env.ELIT_DESKTOP_CARGO_TARGET_DIR?.trim();
|
|
76793
|
+
if (explicitTargetDir) {
|
|
76794
|
+
return (0, import_node_path3.resolve)(explicitTargetDir);
|
|
76795
|
+
}
|
|
76796
|
+
const localAppData = env.LOCALAPPDATA?.trim();
|
|
76797
|
+
if (platform === "win32" && localAppData) {
|
|
76798
|
+
return (0, import_node_path3.resolve)(localAppData, "elit", "target", "desktop");
|
|
76799
|
+
}
|
|
76800
|
+
if (isNodeModulesPackagePath(packageRoot)) {
|
|
76801
|
+
return (0, import_node_path3.resolve)(cwd, ".elit", "target", "desktop");
|
|
76802
|
+
}
|
|
76803
|
+
return (0, import_node_path3.resolve)(packageRoot, "target", "desktop");
|
|
76804
|
+
}
|
|
76805
|
+
function resolveDesktopBinaryOverridePath(configuredPath, envName, cwd = process.cwd(), env = process.env) {
|
|
76806
|
+
const explicitPath = env[envName]?.trim() || configuredPath?.trim();
|
|
76807
|
+
if (!explicitPath) {
|
|
76808
|
+
return void 0;
|
|
76809
|
+
}
|
|
76810
|
+
return (0, import_node_path3.resolve)(cwd, explicitPath);
|
|
76811
|
+
}
|
|
76786
76812
|
function createDesktopBootstrapEntry(entryPath, appName) {
|
|
76787
76813
|
const bootstrapId = (0, import_node_crypto3.randomUUID)();
|
|
76788
76814
|
const bootstrapPath = (0, import_node_path3.join)((0, import_node_path3.dirname)(entryPath), `.elit-desktop-bootstrap-${appName}-${bootstrapId}.ts`);
|
|
@@ -76877,6 +76903,9 @@ function parseDesktopRunArgs(args, config) {
|
|
|
76877
76903
|
mode: getDefaultDesktopMode(config),
|
|
76878
76904
|
entry: void 0,
|
|
76879
76905
|
exportName: config?.native?.exportName,
|
|
76906
|
+
binaryPath: config?.binaryPath,
|
|
76907
|
+
nativeBinaryPath: config?.nativeBinaryPath,
|
|
76908
|
+
cargoTargetDir: config?.cargoTargetDir,
|
|
76880
76909
|
runtime: config?.runtime ?? "quickjs",
|
|
76881
76910
|
compiler: config?.compiler ?? "auto",
|
|
76882
76911
|
release: config?.release ?? false
|
|
@@ -76942,6 +76971,9 @@ function parseDesktopBuildArgs(args, config) {
|
|
|
76942
76971
|
mode: getDefaultDesktopMode(config),
|
|
76943
76972
|
entry: void 0,
|
|
76944
76973
|
exportName: config?.native?.exportName,
|
|
76974
|
+
binaryPath: config?.binaryPath,
|
|
76975
|
+
nativeBinaryPath: config?.nativeBinaryPath,
|
|
76976
|
+
cargoTargetDir: config?.cargoTargetDir,
|
|
76945
76977
|
runtime: config?.runtime ?? "quickjs",
|
|
76946
76978
|
compiler: config?.compiler ?? "auto",
|
|
76947
76979
|
release: config?.release ?? false,
|
|
@@ -77088,6 +77120,8 @@ function printDesktopHelp() {
|
|
|
77088
77120
|
" - TypeScript and module-style QuickJS entries are transpiled automatically.",
|
|
77089
77121
|
" - The tsx compiler is Node-only and keeps loading the original source tree.",
|
|
77090
77122
|
" - The tsx and tsup compilers require those packages to be installed.",
|
|
77123
|
+
" - Use desktop.binaryPath / desktop.nativeBinaryPath or ELIT_DESKTOP_BINARY_PATH / ELIT_DESKTOP_NATIVE_BINARY_PATH to reuse prebuilt runtimes when Cargo builds are blocked.",
|
|
77124
|
+
" - Use desktop.cargoTargetDir or ELIT_DESKTOP_CARGO_TARGET_DIR to move the desktop Cargo cache to a policy-approved location.",
|
|
77091
77125
|
' - desktop.mode defaults to "native" when desktop.native.entry exists, otherwise "hybrid".',
|
|
77092
77126
|
" - desktop.entry is used for hybrid mode. desktop.native.entry is used for native mode.",
|
|
77093
77127
|
" - Native mode falls back to desktop.entry when only the legacy desktop.entry is configured.",
|
|
@@ -77348,6 +77382,8 @@ async function runDesktopRuntime(options) {
|
|
|
77348
77382
|
try {
|
|
77349
77383
|
const binary = ensureDesktopBinary({
|
|
77350
77384
|
runtime: options.runtime,
|
|
77385
|
+
binaryPath: options.binaryPath,
|
|
77386
|
+
cargoTargetDir: options.cargoTargetDir,
|
|
77351
77387
|
release: options.release,
|
|
77352
77388
|
entryPath: options.entry
|
|
77353
77389
|
});
|
|
@@ -77363,6 +77399,8 @@ async function runDesktopNativeRuntime(options) {
|
|
|
77363
77399
|
const preparedPayload = await prepareDesktopNativePayload(options);
|
|
77364
77400
|
try {
|
|
77365
77401
|
const binary = ensureDesktopNativeBinary({
|
|
77402
|
+
binaryPath: options.nativeBinaryPath,
|
|
77403
|
+
cargoTargetDir: options.cargoTargetDir,
|
|
77366
77404
|
release: options.release,
|
|
77367
77405
|
entryPath: options.entry
|
|
77368
77406
|
});
|
|
@@ -77380,13 +77418,14 @@ async function buildDesktopBundle(options) {
|
|
|
77380
77418
|
return;
|
|
77381
77419
|
}
|
|
77382
77420
|
const triple = options.platform ? PLATFORMS[options.platform] : void 0;
|
|
77383
|
-
|
|
77421
|
+
const binary = ensureDesktopBinary({
|
|
77384
77422
|
runtime: options.runtime,
|
|
77423
|
+
binaryPath: options.binaryPath,
|
|
77424
|
+
cargoTargetDir: options.cargoTargetDir,
|
|
77385
77425
|
release: options.release,
|
|
77386
77426
|
triple,
|
|
77387
77427
|
entryPath: options.entry
|
|
77388
77428
|
});
|
|
77389
|
-
const binary = findDesktopBinary(options.runtime, options.release, triple);
|
|
77390
77429
|
if (!binary) {
|
|
77391
77430
|
throw new Error("Desktop runtime binary was not found after cargo build completed.");
|
|
77392
77431
|
}
|
|
@@ -77416,12 +77455,13 @@ async function buildDesktopBundle(options) {
|
|
|
77416
77455
|
}
|
|
77417
77456
|
async function buildDesktopNativeBundle(options) {
|
|
77418
77457
|
const triple = options.platform ? PLATFORMS[options.platform] : void 0;
|
|
77419
|
-
|
|
77458
|
+
const binary = ensureDesktopNativeBinary({
|
|
77459
|
+
binaryPath: options.nativeBinaryPath,
|
|
77460
|
+
cargoTargetDir: options.cargoTargetDir,
|
|
77420
77461
|
release: options.release,
|
|
77421
77462
|
triple,
|
|
77422
77463
|
entryPath: options.entry
|
|
77423
77464
|
});
|
|
77424
|
-
const binary = findDesktopNativeBinary(options.release, triple);
|
|
77425
77465
|
if (!binary) {
|
|
77426
77466
|
throw new Error("Desktop native runtime binary was not found after cargo build completed.");
|
|
77427
77467
|
}
|
|
@@ -77449,10 +77489,17 @@ async function buildDesktopNativeBundle(options) {
|
|
|
77449
77489
|
}
|
|
77450
77490
|
}
|
|
77451
77491
|
function ensureDesktopBinary(options) {
|
|
77452
|
-
|
|
77492
|
+
const overriddenBinary = resolveDesktopBinaryOverridePath(options.binaryPath, "ELIT_DESKTOP_BINARY_PATH");
|
|
77493
|
+
if (overriddenBinary) {
|
|
77494
|
+
if (!(0, import_node_fs3.existsSync)(overriddenBinary)) {
|
|
77495
|
+
throw new Error(`Configured desktop runtime binary was not found: ${overriddenBinary}`);
|
|
77496
|
+
}
|
|
77497
|
+
return overriddenBinary;
|
|
77498
|
+
}
|
|
77499
|
+
let binary = findDesktopBinary(options.runtime, options.release, options.triple, options.cargoTargetDir);
|
|
77453
77500
|
if (!binary || isDesktopRustBuildStale(binary)) {
|
|
77454
77501
|
buildDesktopRuntime(options);
|
|
77455
|
-
binary = findDesktopBinary(options.runtime, options.release, options.triple);
|
|
77502
|
+
binary = findDesktopBinary(options.runtime, options.release, options.triple, options.cargoTargetDir);
|
|
77456
77503
|
}
|
|
77457
77504
|
if (!binary) {
|
|
77458
77505
|
throw new Error("Desktop runtime binary was not found after cargo build completed.");
|
|
@@ -77460,10 +77507,17 @@ function ensureDesktopBinary(options) {
|
|
|
77460
77507
|
return binary;
|
|
77461
77508
|
}
|
|
77462
77509
|
function ensureDesktopNativeBinary(options) {
|
|
77463
|
-
|
|
77510
|
+
const overriddenBinary = resolveDesktopBinaryOverridePath(options.binaryPath, "ELIT_DESKTOP_NATIVE_BINARY_PATH");
|
|
77511
|
+
if (overriddenBinary) {
|
|
77512
|
+
if (!(0, import_node_fs3.existsSync)(overriddenBinary)) {
|
|
77513
|
+
throw new Error(`Configured desktop native runtime binary was not found: ${overriddenBinary}`);
|
|
77514
|
+
}
|
|
77515
|
+
return overriddenBinary;
|
|
77516
|
+
}
|
|
77517
|
+
let binary = findDesktopNativeBinary(options.release, options.triple, options.cargoTargetDir);
|
|
77464
77518
|
if (!binary || isDesktopRustBuildStale(binary)) {
|
|
77465
77519
|
buildDesktopNativeRuntime(options);
|
|
77466
|
-
binary = findDesktopNativeBinary(options.release, options.triple);
|
|
77520
|
+
binary = findDesktopNativeBinary(options.release, options.triple, options.cargoTargetDir);
|
|
77467
77521
|
}
|
|
77468
77522
|
if (!binary) {
|
|
77469
77523
|
throw new Error("Desktop native runtime binary was not found after cargo build completed.");
|
|
@@ -77489,7 +77543,7 @@ function buildDesktopRuntime(options) {
|
|
|
77489
77543
|
}
|
|
77490
77544
|
const env = {
|
|
77491
77545
|
...process.env,
|
|
77492
|
-
CARGO_TARGET_DIR: desktopCargoTargetDir(options.runtime)
|
|
77546
|
+
CARGO_TARGET_DIR: desktopCargoTargetDir(options.runtime, options.cargoTargetDir)
|
|
77493
77547
|
};
|
|
77494
77548
|
const iconPath = resolveDesktopIcon(options.entryPath);
|
|
77495
77549
|
if (iconPath) {
|
|
@@ -77509,6 +77563,7 @@ function buildDesktopRuntime(options) {
|
|
|
77509
77563
|
throw result2.error;
|
|
77510
77564
|
}
|
|
77511
77565
|
if (result2.status !== 0) {
|
|
77566
|
+
printDesktopCargoFailureHint("hybrid");
|
|
77512
77567
|
process.exit(result2.status ?? 1);
|
|
77513
77568
|
}
|
|
77514
77569
|
}
|
|
@@ -77528,7 +77583,7 @@ function buildDesktopNativeRuntime(options) {
|
|
|
77528
77583
|
}
|
|
77529
77584
|
const env = {
|
|
77530
77585
|
...process.env,
|
|
77531
|
-
CARGO_TARGET_DIR: desktopNativeCargoTargetDir()
|
|
77586
|
+
CARGO_TARGET_DIR: desktopNativeCargoTargetDir(options.cargoTargetDir)
|
|
77532
77587
|
};
|
|
77533
77588
|
const iconPath = resolveDesktopIcon(options.entryPath);
|
|
77534
77589
|
if (iconPath) {
|
|
@@ -77548,11 +77603,16 @@ function buildDesktopNativeRuntime(options) {
|
|
|
77548
77603
|
throw result2.error;
|
|
77549
77604
|
}
|
|
77550
77605
|
if (result2.status !== 0) {
|
|
77606
|
+
printDesktopCargoFailureHint("native");
|
|
77551
77607
|
process.exit(result2.status ?? 1);
|
|
77552
77608
|
}
|
|
77553
77609
|
}
|
|
77554
|
-
function findDesktopBinary(runtime2, release, triple) {
|
|
77555
|
-
const
|
|
77610
|
+
function findDesktopBinary(runtime2, release, triple, configuredTargetDir, configuredBinaryPath) {
|
|
77611
|
+
const overriddenBinary = resolveDesktopBinaryOverridePath(configuredBinaryPath, "ELIT_DESKTOP_BINARY_PATH");
|
|
77612
|
+
if (overriddenBinary) {
|
|
77613
|
+
return (0, import_node_fs3.existsSync)(overriddenBinary) ? overriddenBinary : null;
|
|
77614
|
+
}
|
|
77615
|
+
const targetDir = desktopCargoTargetDir(runtime2, configuredTargetDir);
|
|
77556
77616
|
const profile = release ? "release" : "debug";
|
|
77557
77617
|
const binaryName = isWindowsTarget(triple) ? "elit-desktop.exe" : "elit-desktop";
|
|
77558
77618
|
const candidates = triple ? [(0, import_node_path3.join)(targetDir, triple, profile, binaryName)] : [(0, import_node_path3.join)(targetDir, profile, binaryName)];
|
|
@@ -77563,8 +77623,12 @@ function findDesktopBinary(runtime2, release, triple) {
|
|
|
77563
77623
|
}
|
|
77564
77624
|
return null;
|
|
77565
77625
|
}
|
|
77566
|
-
function findDesktopNativeBinary(release, triple) {
|
|
77567
|
-
const
|
|
77626
|
+
function findDesktopNativeBinary(release, triple, configuredTargetDir, configuredBinaryPath) {
|
|
77627
|
+
const overriddenBinary = resolveDesktopBinaryOverridePath(configuredBinaryPath, "ELIT_DESKTOP_NATIVE_BINARY_PATH");
|
|
77628
|
+
if (overriddenBinary) {
|
|
77629
|
+
return (0, import_node_fs3.existsSync)(overriddenBinary) ? overriddenBinary : null;
|
|
77630
|
+
}
|
|
77631
|
+
const targetDir = desktopNativeCargoTargetDir(configuredTargetDir);
|
|
77568
77632
|
const profile = release ? "release" : "debug";
|
|
77569
77633
|
const binaryName = isWindowsTarget(triple) ? "elit-desktop-native.exe" : "elit-desktop-native";
|
|
77570
77634
|
const candidates = triple ? [(0, import_node_path3.join)(targetDir, triple, profile, binaryName)] : [(0, import_node_path3.join)(targetDir, profile, binaryName)];
|
|
@@ -77575,11 +77639,34 @@ function findDesktopNativeBinary(release, triple) {
|
|
|
77575
77639
|
}
|
|
77576
77640
|
return null;
|
|
77577
77641
|
}
|
|
77578
|
-
function desktopCargoTargetDir(runtime2) {
|
|
77579
|
-
return (0, import_node_path3.resolve)(
|
|
77642
|
+
function desktopCargoTargetDir(runtime2, configuredTargetDir) {
|
|
77643
|
+
return (0, import_node_path3.resolve)(resolveDesktopCargoTargetBaseDir(
|
|
77644
|
+
PACKAGE_ROOT,
|
|
77645
|
+
process.cwd(),
|
|
77646
|
+
{
|
|
77647
|
+
...process.env,
|
|
77648
|
+
...configuredTargetDir ? { ELIT_DESKTOP_CARGO_TARGET_DIR: configuredTargetDir } : {}
|
|
77649
|
+
}
|
|
77650
|
+
), runtime2);
|
|
77651
|
+
}
|
|
77652
|
+
function desktopNativeCargoTargetDir(configuredTargetDir) {
|
|
77653
|
+
return (0, import_node_path3.resolve)(resolveDesktopCargoTargetBaseDir(
|
|
77654
|
+
PACKAGE_ROOT,
|
|
77655
|
+
process.cwd(),
|
|
77656
|
+
{
|
|
77657
|
+
...process.env,
|
|
77658
|
+
...configuredTargetDir ? { ELIT_DESKTOP_CARGO_TARGET_DIR: configuredTargetDir } : {}
|
|
77659
|
+
}
|
|
77660
|
+
), "native");
|
|
77580
77661
|
}
|
|
77581
|
-
function
|
|
77582
|
-
|
|
77662
|
+
function printDesktopCargoFailureHint(mode) {
|
|
77663
|
+
if (process.platform !== "win32") {
|
|
77664
|
+
return;
|
|
77665
|
+
}
|
|
77666
|
+
const binaryConfigLabel = mode === "native" ? "desktop.nativeBinaryPath or ELIT_DESKTOP_NATIVE_BINARY_PATH" : "desktop.binaryPath or ELIT_DESKTOP_BINARY_PATH";
|
|
77667
|
+
console.error("[desktop] Cargo build failed. If Windows Application Control blocks Rust build scripts on this machine, configure a prebuilt runtime binary.");
|
|
77668
|
+
console.error(`[desktop] Use ${binaryConfigLabel} to bypass Cargo for desktop runs/builds.`);
|
|
77669
|
+
console.error("[desktop] Use desktop.cargoTargetDir or ELIT_DESKTOP_CARGO_TARGET_DIR if your environment only allows specific cache locations.");
|
|
77583
77670
|
}
|
|
77584
77671
|
function isDesktopRustBuildStale(binaryPath) {
|
|
77585
77672
|
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,
|
|
@@ -61307,14 +61310,13 @@ var sendError = (res, code, msg) => {
|
|
|
61307
61310
|
var send404 = (res, msg = "Not Found") => sendError(res, 404, msg);
|
|
61308
61311
|
var send403 = (res, msg = "Forbidden") => sendError(res, 403, msg);
|
|
61309
61312
|
var send500 = (res, msg = "Internal Server Error") => sendError(res, 500, msg);
|
|
61310
|
-
async function resolveWorkspaceElitImportBasePath(rootDir, basePath,
|
|
61313
|
+
async function resolveWorkspaceElitImportBasePath(rootDir, basePath, _mode) {
|
|
61311
61314
|
const resolvedRootDir = await realpath(resolve(rootDir));
|
|
61312
61315
|
try {
|
|
61313
61316
|
const packageJsonBuffer = await readFile(join(resolvedRootDir, "package.json"));
|
|
61314
61317
|
const packageJson = JSON.parse(packageJsonBuffer.toString());
|
|
61315
61318
|
if (packageJson.name === "elit") {
|
|
61316
|
-
|
|
61317
|
-
return basePath ? `${basePath}/${workspaceDir}` : `/${workspaceDir}`;
|
|
61319
|
+
return basePath ? `${basePath}/dist` : "/dist";
|
|
61318
61320
|
}
|
|
61319
61321
|
} catch {
|
|
61320
61322
|
}
|
|
@@ -61322,7 +61324,7 @@ async function resolveWorkspaceElitImportBasePath(rootDir, basePath, mode) {
|
|
|
61322
61324
|
}
|
|
61323
61325
|
var createElitImportMap = async (rootDir, basePath = "", mode = "dev") => {
|
|
61324
61326
|
const workspaceImportBasePath = await resolveWorkspaceElitImportBasePath(rootDir, basePath, mode);
|
|
61325
|
-
const fileExt =
|
|
61327
|
+
const fileExt = ".js";
|
|
61326
61328
|
const elitImports = workspaceImportBasePath ? {
|
|
61327
61329
|
"elit": `${workspaceImportBasePath}/index${fileExt}`,
|
|
61328
61330
|
"elit/": `${workspaceImportBasePath}/`,
|
|
@@ -76726,6 +76728,9 @@ function toDesktopBootstrapImportPath(fromPath, toPath) {
|
|
|
76726
76728
|
const importPath = relative3(dirname4(fromPath), toPath).replace(/\\/g, "/");
|
|
76727
76729
|
return importPath.startsWith("./") || importPath.startsWith("../") ? importPath : `./${importPath}`;
|
|
76728
76730
|
}
|
|
76731
|
+
function isNodeModulesPackagePath(path) {
|
|
76732
|
+
return path.split(/[\\/]+/).some((segment) => segment.toLowerCase() === "node_modules");
|
|
76733
|
+
}
|
|
76729
76734
|
function formatDesktopDisplayName(value) {
|
|
76730
76735
|
if (!value) {
|
|
76731
76736
|
return "Elit";
|
|
@@ -76768,6 +76773,27 @@ function resolveDesktopBootstrapSupportModulePath(moduleName, packageRoot = PACK
|
|
|
76768
76773
|
`Desktop support module "${moduleName}" was not found in ${packageRoot}. Expected one of: ${candidates.join(", ")}`
|
|
76769
76774
|
);
|
|
76770
76775
|
}
|
|
76776
|
+
function resolveDesktopCargoTargetBaseDir(packageRoot = PACKAGE_ROOT, cwd = process.cwd(), env = process.env, platform = process.platform) {
|
|
76777
|
+
const explicitTargetDir = env.ELIT_DESKTOP_CARGO_TARGET_DIR?.trim();
|
|
76778
|
+
if (explicitTargetDir) {
|
|
76779
|
+
return resolve4(explicitTargetDir);
|
|
76780
|
+
}
|
|
76781
|
+
const localAppData = env.LOCALAPPDATA?.trim();
|
|
76782
|
+
if (platform === "win32" && localAppData) {
|
|
76783
|
+
return resolve4(localAppData, "elit", "target", "desktop");
|
|
76784
|
+
}
|
|
76785
|
+
if (isNodeModulesPackagePath(packageRoot)) {
|
|
76786
|
+
return resolve4(cwd, ".elit", "target", "desktop");
|
|
76787
|
+
}
|
|
76788
|
+
return resolve4(packageRoot, "target", "desktop");
|
|
76789
|
+
}
|
|
76790
|
+
function resolveDesktopBinaryOverridePath(configuredPath, envName, cwd = process.cwd(), env = process.env) {
|
|
76791
|
+
const explicitPath = env[envName]?.trim() || configuredPath?.trim();
|
|
76792
|
+
if (!explicitPath) {
|
|
76793
|
+
return void 0;
|
|
76794
|
+
}
|
|
76795
|
+
return resolve4(cwd, explicitPath);
|
|
76796
|
+
}
|
|
76771
76797
|
function createDesktopBootstrapEntry(entryPath, appName) {
|
|
76772
76798
|
const bootstrapId = randomUUID2();
|
|
76773
76799
|
const bootstrapPath = join3(dirname4(entryPath), `.elit-desktop-bootstrap-${appName}-${bootstrapId}.ts`);
|
|
@@ -76862,6 +76888,9 @@ function parseDesktopRunArgs(args, config) {
|
|
|
76862
76888
|
mode: getDefaultDesktopMode(config),
|
|
76863
76889
|
entry: void 0,
|
|
76864
76890
|
exportName: config?.native?.exportName,
|
|
76891
|
+
binaryPath: config?.binaryPath,
|
|
76892
|
+
nativeBinaryPath: config?.nativeBinaryPath,
|
|
76893
|
+
cargoTargetDir: config?.cargoTargetDir,
|
|
76865
76894
|
runtime: config?.runtime ?? "quickjs",
|
|
76866
76895
|
compiler: config?.compiler ?? "auto",
|
|
76867
76896
|
release: config?.release ?? false
|
|
@@ -76927,6 +76956,9 @@ function parseDesktopBuildArgs(args, config) {
|
|
|
76927
76956
|
mode: getDefaultDesktopMode(config),
|
|
76928
76957
|
entry: void 0,
|
|
76929
76958
|
exportName: config?.native?.exportName,
|
|
76959
|
+
binaryPath: config?.binaryPath,
|
|
76960
|
+
nativeBinaryPath: config?.nativeBinaryPath,
|
|
76961
|
+
cargoTargetDir: config?.cargoTargetDir,
|
|
76930
76962
|
runtime: config?.runtime ?? "quickjs",
|
|
76931
76963
|
compiler: config?.compiler ?? "auto",
|
|
76932
76964
|
release: config?.release ?? false,
|
|
@@ -77073,6 +77105,8 @@ function printDesktopHelp() {
|
|
|
77073
77105
|
" - TypeScript and module-style QuickJS entries are transpiled automatically.",
|
|
77074
77106
|
" - The tsx compiler is Node-only and keeps loading the original source tree.",
|
|
77075
77107
|
" - The tsx and tsup compilers require those packages to be installed.",
|
|
77108
|
+
" - Use desktop.binaryPath / desktop.nativeBinaryPath or ELIT_DESKTOP_BINARY_PATH / ELIT_DESKTOP_NATIVE_BINARY_PATH to reuse prebuilt runtimes when Cargo builds are blocked.",
|
|
77109
|
+
" - Use desktop.cargoTargetDir or ELIT_DESKTOP_CARGO_TARGET_DIR to move the desktop Cargo cache to a policy-approved location.",
|
|
77076
77110
|
' - desktop.mode defaults to "native" when desktop.native.entry exists, otherwise "hybrid".',
|
|
77077
77111
|
" - desktop.entry is used for hybrid mode. desktop.native.entry is used for native mode.",
|
|
77078
77112
|
" - Native mode falls back to desktop.entry when only the legacy desktop.entry is configured.",
|
|
@@ -77333,6 +77367,8 @@ async function runDesktopRuntime(options) {
|
|
|
77333
77367
|
try {
|
|
77334
77368
|
const binary = ensureDesktopBinary({
|
|
77335
77369
|
runtime: options.runtime,
|
|
77370
|
+
binaryPath: options.binaryPath,
|
|
77371
|
+
cargoTargetDir: options.cargoTargetDir,
|
|
77336
77372
|
release: options.release,
|
|
77337
77373
|
entryPath: options.entry
|
|
77338
77374
|
});
|
|
@@ -77348,6 +77384,8 @@ async function runDesktopNativeRuntime(options) {
|
|
|
77348
77384
|
const preparedPayload = await prepareDesktopNativePayload(options);
|
|
77349
77385
|
try {
|
|
77350
77386
|
const binary = ensureDesktopNativeBinary({
|
|
77387
|
+
binaryPath: options.nativeBinaryPath,
|
|
77388
|
+
cargoTargetDir: options.cargoTargetDir,
|
|
77351
77389
|
release: options.release,
|
|
77352
77390
|
entryPath: options.entry
|
|
77353
77391
|
});
|
|
@@ -77365,13 +77403,14 @@ async function buildDesktopBundle(options) {
|
|
|
77365
77403
|
return;
|
|
77366
77404
|
}
|
|
77367
77405
|
const triple = options.platform ? PLATFORMS[options.platform] : void 0;
|
|
77368
|
-
|
|
77406
|
+
const binary = ensureDesktopBinary({
|
|
77369
77407
|
runtime: options.runtime,
|
|
77408
|
+
binaryPath: options.binaryPath,
|
|
77409
|
+
cargoTargetDir: options.cargoTargetDir,
|
|
77370
77410
|
release: options.release,
|
|
77371
77411
|
triple,
|
|
77372
77412
|
entryPath: options.entry
|
|
77373
77413
|
});
|
|
77374
|
-
const binary = findDesktopBinary(options.runtime, options.release, triple);
|
|
77375
77414
|
if (!binary) {
|
|
77376
77415
|
throw new Error("Desktop runtime binary was not found after cargo build completed.");
|
|
77377
77416
|
}
|
|
@@ -77401,12 +77440,13 @@ async function buildDesktopBundle(options) {
|
|
|
77401
77440
|
}
|
|
77402
77441
|
async function buildDesktopNativeBundle(options) {
|
|
77403
77442
|
const triple = options.platform ? PLATFORMS[options.platform] : void 0;
|
|
77404
|
-
|
|
77443
|
+
const binary = ensureDesktopNativeBinary({
|
|
77444
|
+
binaryPath: options.nativeBinaryPath,
|
|
77445
|
+
cargoTargetDir: options.cargoTargetDir,
|
|
77405
77446
|
release: options.release,
|
|
77406
77447
|
triple,
|
|
77407
77448
|
entryPath: options.entry
|
|
77408
77449
|
});
|
|
77409
|
-
const binary = findDesktopNativeBinary(options.release, triple);
|
|
77410
77450
|
if (!binary) {
|
|
77411
77451
|
throw new Error("Desktop native runtime binary was not found after cargo build completed.");
|
|
77412
77452
|
}
|
|
@@ -77434,10 +77474,17 @@ async function buildDesktopNativeBundle(options) {
|
|
|
77434
77474
|
}
|
|
77435
77475
|
}
|
|
77436
77476
|
function ensureDesktopBinary(options) {
|
|
77437
|
-
|
|
77477
|
+
const overriddenBinary = resolveDesktopBinaryOverridePath(options.binaryPath, "ELIT_DESKTOP_BINARY_PATH");
|
|
77478
|
+
if (overriddenBinary) {
|
|
77479
|
+
if (!existsSync3(overriddenBinary)) {
|
|
77480
|
+
throw new Error(`Configured desktop runtime binary was not found: ${overriddenBinary}`);
|
|
77481
|
+
}
|
|
77482
|
+
return overriddenBinary;
|
|
77483
|
+
}
|
|
77484
|
+
let binary = findDesktopBinary(options.runtime, options.release, options.triple, options.cargoTargetDir);
|
|
77438
77485
|
if (!binary || isDesktopRustBuildStale(binary)) {
|
|
77439
77486
|
buildDesktopRuntime(options);
|
|
77440
|
-
binary = findDesktopBinary(options.runtime, options.release, options.triple);
|
|
77487
|
+
binary = findDesktopBinary(options.runtime, options.release, options.triple, options.cargoTargetDir);
|
|
77441
77488
|
}
|
|
77442
77489
|
if (!binary) {
|
|
77443
77490
|
throw new Error("Desktop runtime binary was not found after cargo build completed.");
|
|
@@ -77445,10 +77492,17 @@ function ensureDesktopBinary(options) {
|
|
|
77445
77492
|
return binary;
|
|
77446
77493
|
}
|
|
77447
77494
|
function ensureDesktopNativeBinary(options) {
|
|
77448
|
-
|
|
77495
|
+
const overriddenBinary = resolveDesktopBinaryOverridePath(options.binaryPath, "ELIT_DESKTOP_NATIVE_BINARY_PATH");
|
|
77496
|
+
if (overriddenBinary) {
|
|
77497
|
+
if (!existsSync3(overriddenBinary)) {
|
|
77498
|
+
throw new Error(`Configured desktop native runtime binary was not found: ${overriddenBinary}`);
|
|
77499
|
+
}
|
|
77500
|
+
return overriddenBinary;
|
|
77501
|
+
}
|
|
77502
|
+
let binary = findDesktopNativeBinary(options.release, options.triple, options.cargoTargetDir);
|
|
77449
77503
|
if (!binary || isDesktopRustBuildStale(binary)) {
|
|
77450
77504
|
buildDesktopNativeRuntime(options);
|
|
77451
|
-
binary = findDesktopNativeBinary(options.release, options.triple);
|
|
77505
|
+
binary = findDesktopNativeBinary(options.release, options.triple, options.cargoTargetDir);
|
|
77452
77506
|
}
|
|
77453
77507
|
if (!binary) {
|
|
77454
77508
|
throw new Error("Desktop native runtime binary was not found after cargo build completed.");
|
|
@@ -77474,7 +77528,7 @@ function buildDesktopRuntime(options) {
|
|
|
77474
77528
|
}
|
|
77475
77529
|
const env = {
|
|
77476
77530
|
...process.env,
|
|
77477
|
-
CARGO_TARGET_DIR: desktopCargoTargetDir(options.runtime)
|
|
77531
|
+
CARGO_TARGET_DIR: desktopCargoTargetDir(options.runtime, options.cargoTargetDir)
|
|
77478
77532
|
};
|
|
77479
77533
|
const iconPath = resolveDesktopIcon(options.entryPath);
|
|
77480
77534
|
if (iconPath) {
|
|
@@ -77494,6 +77548,7 @@ function buildDesktopRuntime(options) {
|
|
|
77494
77548
|
throw result2.error;
|
|
77495
77549
|
}
|
|
77496
77550
|
if (result2.status !== 0) {
|
|
77551
|
+
printDesktopCargoFailureHint("hybrid");
|
|
77497
77552
|
process.exit(result2.status ?? 1);
|
|
77498
77553
|
}
|
|
77499
77554
|
}
|
|
@@ -77513,7 +77568,7 @@ function buildDesktopNativeRuntime(options) {
|
|
|
77513
77568
|
}
|
|
77514
77569
|
const env = {
|
|
77515
77570
|
...process.env,
|
|
77516
|
-
CARGO_TARGET_DIR: desktopNativeCargoTargetDir()
|
|
77571
|
+
CARGO_TARGET_DIR: desktopNativeCargoTargetDir(options.cargoTargetDir)
|
|
77517
77572
|
};
|
|
77518
77573
|
const iconPath = resolveDesktopIcon(options.entryPath);
|
|
77519
77574
|
if (iconPath) {
|
|
@@ -77533,11 +77588,16 @@ function buildDesktopNativeRuntime(options) {
|
|
|
77533
77588
|
throw result2.error;
|
|
77534
77589
|
}
|
|
77535
77590
|
if (result2.status !== 0) {
|
|
77591
|
+
printDesktopCargoFailureHint("native");
|
|
77536
77592
|
process.exit(result2.status ?? 1);
|
|
77537
77593
|
}
|
|
77538
77594
|
}
|
|
77539
|
-
function findDesktopBinary(runtime2, release, triple) {
|
|
77540
|
-
const
|
|
77595
|
+
function findDesktopBinary(runtime2, release, triple, configuredTargetDir, configuredBinaryPath) {
|
|
77596
|
+
const overriddenBinary = resolveDesktopBinaryOverridePath(configuredBinaryPath, "ELIT_DESKTOP_BINARY_PATH");
|
|
77597
|
+
if (overriddenBinary) {
|
|
77598
|
+
return existsSync3(overriddenBinary) ? overriddenBinary : null;
|
|
77599
|
+
}
|
|
77600
|
+
const targetDir = desktopCargoTargetDir(runtime2, configuredTargetDir);
|
|
77541
77601
|
const profile = release ? "release" : "debug";
|
|
77542
77602
|
const binaryName = isWindowsTarget(triple) ? "elit-desktop.exe" : "elit-desktop";
|
|
77543
77603
|
const candidates = triple ? [join3(targetDir, triple, profile, binaryName)] : [join3(targetDir, profile, binaryName)];
|
|
@@ -77548,8 +77608,12 @@ function findDesktopBinary(runtime2, release, triple) {
|
|
|
77548
77608
|
}
|
|
77549
77609
|
return null;
|
|
77550
77610
|
}
|
|
77551
|
-
function findDesktopNativeBinary(release, triple) {
|
|
77552
|
-
const
|
|
77611
|
+
function findDesktopNativeBinary(release, triple, configuredTargetDir, configuredBinaryPath) {
|
|
77612
|
+
const overriddenBinary = resolveDesktopBinaryOverridePath(configuredBinaryPath, "ELIT_DESKTOP_NATIVE_BINARY_PATH");
|
|
77613
|
+
if (overriddenBinary) {
|
|
77614
|
+
return existsSync3(overriddenBinary) ? overriddenBinary : null;
|
|
77615
|
+
}
|
|
77616
|
+
const targetDir = desktopNativeCargoTargetDir(configuredTargetDir);
|
|
77553
77617
|
const profile = release ? "release" : "debug";
|
|
77554
77618
|
const binaryName = isWindowsTarget(triple) ? "elit-desktop-native.exe" : "elit-desktop-native";
|
|
77555
77619
|
const candidates = triple ? [join3(targetDir, triple, profile, binaryName)] : [join3(targetDir, profile, binaryName)];
|
|
@@ -77560,11 +77624,34 @@ function findDesktopNativeBinary(release, triple) {
|
|
|
77560
77624
|
}
|
|
77561
77625
|
return null;
|
|
77562
77626
|
}
|
|
77563
|
-
function desktopCargoTargetDir(runtime2) {
|
|
77564
|
-
return resolve4(
|
|
77627
|
+
function desktopCargoTargetDir(runtime2, configuredTargetDir) {
|
|
77628
|
+
return resolve4(resolveDesktopCargoTargetBaseDir(
|
|
77629
|
+
PACKAGE_ROOT,
|
|
77630
|
+
process.cwd(),
|
|
77631
|
+
{
|
|
77632
|
+
...process.env,
|
|
77633
|
+
...configuredTargetDir ? { ELIT_DESKTOP_CARGO_TARGET_DIR: configuredTargetDir } : {}
|
|
77634
|
+
}
|
|
77635
|
+
), runtime2);
|
|
77636
|
+
}
|
|
77637
|
+
function desktopNativeCargoTargetDir(configuredTargetDir) {
|
|
77638
|
+
return resolve4(resolveDesktopCargoTargetBaseDir(
|
|
77639
|
+
PACKAGE_ROOT,
|
|
77640
|
+
process.cwd(),
|
|
77641
|
+
{
|
|
77642
|
+
...process.env,
|
|
77643
|
+
...configuredTargetDir ? { ELIT_DESKTOP_CARGO_TARGET_DIR: configuredTargetDir } : {}
|
|
77644
|
+
}
|
|
77645
|
+
), "native");
|
|
77565
77646
|
}
|
|
77566
|
-
function
|
|
77567
|
-
|
|
77647
|
+
function printDesktopCargoFailureHint(mode) {
|
|
77648
|
+
if (process.platform !== "win32") {
|
|
77649
|
+
return;
|
|
77650
|
+
}
|
|
77651
|
+
const binaryConfigLabel = mode === "native" ? "desktop.nativeBinaryPath or ELIT_DESKTOP_NATIVE_BINARY_PATH" : "desktop.binaryPath or ELIT_DESKTOP_BINARY_PATH";
|
|
77652
|
+
console.error("[desktop] Cargo build failed. If Windows Application Control blocks Rust build scripts on this machine, configure a prebuilt runtime binary.");
|
|
77653
|
+
console.error(`[desktop] Use ${binaryConfigLabel} to bypass Cargo for desktop runs/builds.`);
|
|
77654
|
+
console.error("[desktop] Use desktop.cargoTargetDir or ELIT_DESKTOP_CARGO_TARGET_DIR if your environment only allows specific cache locations.");
|
|
77568
77655
|
}
|
|
77569
77656
|
function isDesktopRustBuildStale(binaryPath) {
|
|
77570
77657
|
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-CcBFc2F5.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
package/dist/render-context.d.ts
CHANGED
|
@@ -376,7 +376,7 @@ declare const json: (res: ServerResponse, data: any, status?: number) => ServerR
|
|
|
376
376
|
declare const text: (res: ServerResponse, data: string, status?: number) => ServerResponse;
|
|
377
377
|
declare const html: (res: ServerResponse, data: string, status?: number) => ServerResponse;
|
|
378
378
|
declare const status: (res: ServerResponse, code: number, message?: string) => ServerResponse;
|
|
379
|
-
declare function resolveWorkspaceElitImportBasePath(rootDir: string, basePath: string,
|
|
379
|
+
declare function resolveWorkspaceElitImportBasePath(rootDir: string, basePath: string, _mode: 'dev' | 'preview'): Promise<string | undefined>;
|
|
380
380
|
declare const createElitImportMap: (rootDir: string, basePath?: string, mode?: "dev" | "preview") => Promise<string>;
|
|
381
381
|
/**
|
|
382
382
|
* Clear import map cache (useful when packages are added/removed)
|
package/dist/server.cjs
CHANGED
|
@@ -56706,14 +56706,13 @@ var sendError = (res, code, msg) => {
|
|
|
56706
56706
|
var send404 = (res, msg = "Not Found") => sendError(res, 404, msg);
|
|
56707
56707
|
var send403 = (res, msg = "Forbidden") => sendError(res, 403, msg);
|
|
56708
56708
|
var send500 = (res, msg = "Internal Server Error") => sendError(res, 500, msg);
|
|
56709
|
-
async function resolveWorkspaceElitImportBasePath(rootDir, basePath,
|
|
56709
|
+
async function resolveWorkspaceElitImportBasePath(rootDir, basePath, _mode) {
|
|
56710
56710
|
const resolvedRootDir = await realpath(resolve(rootDir));
|
|
56711
56711
|
try {
|
|
56712
56712
|
const packageJsonBuffer = await readFile(join(resolvedRootDir, "package.json"));
|
|
56713
56713
|
const packageJson = JSON.parse(packageJsonBuffer.toString());
|
|
56714
56714
|
if (packageJson.name === "elit") {
|
|
56715
|
-
|
|
56716
|
-
return basePath ? `${basePath}/${workspaceDir}` : `/${workspaceDir}`;
|
|
56715
|
+
return basePath ? `${basePath}/dist` : "/dist";
|
|
56717
56716
|
}
|
|
56718
56717
|
} catch {
|
|
56719
56718
|
}
|
|
@@ -56721,7 +56720,7 @@ async function resolveWorkspaceElitImportBasePath(rootDir, basePath, mode) {
|
|
|
56721
56720
|
}
|
|
56722
56721
|
var createElitImportMap = async (rootDir, basePath = "", mode = "dev") => {
|
|
56723
56722
|
const workspaceImportBasePath = await resolveWorkspaceElitImportBasePath(rootDir, basePath, mode);
|
|
56724
|
-
const fileExt =
|
|
56723
|
+
const fileExt = ".js";
|
|
56725
56724
|
const elitImports = workspaceImportBasePath ? {
|
|
56726
56725
|
"elit": `${workspaceImportBasePath}/index${fileExt}`,
|
|
56727
56726
|
"elit/": `${workspaceImportBasePath}/`,
|
package/dist/server.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import './http.js';
|
|
2
2
|
import './ws.js';
|
|
3
|
-
export { E as ElitRequest, c as ElitResponse, H as HttpMethod, M as Middleware, S as ServerRouteContext, d as ServerRouteHandler, e as ServerRouter, f as SharedState, g as SharedStateOptions, h as StateChangeHandler, i as StateManager, j as bodyLimit, k as cacheControl, l as clearImportMapCache, m as compress, n as cors, o as createDevServer, p as createElitImportMap, q as createProxyHandler, r as errorHandler, s as html, t as json, u as logger, v as rateLimit, w as resolveWorkspaceElitImportBasePath, x as security, y as status, z as text } from './server-
|
|
3
|
+
export { E as ElitRequest, c as ElitResponse, H as HttpMethod, M as Middleware, S as ServerRouteContext, d as ServerRouteHandler, e as ServerRouter, f as SharedState, g as SharedStateOptions, h as StateChangeHandler, i as StateManager, j as bodyLimit, k as cacheControl, l as clearImportMapCache, m as compress, n as cors, o as createDevServer, p as createElitImportMap, q as createProxyHandler, r as errorHandler, s as html, t as json, u as logger, v as rateLimit, w as resolveWorkspaceElitImportBasePath, x as security, y as status, z as text } from './server-CcBFc2F5.js';
|
|
4
4
|
import 'node:events';
|
|
5
5
|
import 'events';
|
|
6
6
|
import 'http';
|
package/dist/server.js
CHANGED
|
@@ -63433,14 +63433,13 @@ tell application "System Events" to get value of property list item "CFBundleNam
|
|
|
63433
63433
|
var send404 = (res, msg = "Not Found") => sendError(res, 404, msg);
|
|
63434
63434
|
var send403 = (res, msg = "Forbidden") => sendError(res, 403, msg);
|
|
63435
63435
|
var send500 = (res, msg = "Internal Server Error") => sendError(res, 500, msg);
|
|
63436
|
-
async function resolveWorkspaceElitImportBasePath(rootDir, basePath,
|
|
63436
|
+
async function resolveWorkspaceElitImportBasePath(rootDir, basePath, _mode) {
|
|
63437
63437
|
const resolvedRootDir = await realpath(resolve(rootDir));
|
|
63438
63438
|
try {
|
|
63439
63439
|
const packageJsonBuffer = await readFile(join(resolvedRootDir, "package.json"));
|
|
63440
63440
|
const packageJson = JSON.parse(packageJsonBuffer.toString());
|
|
63441
63441
|
if (packageJson.name === "elit") {
|
|
63442
|
-
|
|
63443
|
-
return basePath ? `${basePath}/${workspaceDir}` : `/${workspaceDir}`;
|
|
63442
|
+
return basePath ? `${basePath}/dist` : "/dist";
|
|
63444
63443
|
}
|
|
63445
63444
|
} catch {
|
|
63446
63445
|
}
|
|
@@ -63448,7 +63447,7 @@ tell application "System Events" to get value of property list item "CFBundleNam
|
|
|
63448
63447
|
}
|
|
63449
63448
|
var createElitImportMap = async (rootDir, basePath = "", mode = "dev") => {
|
|
63450
63449
|
const workspaceImportBasePath = await resolveWorkspaceElitImportBasePath(rootDir, basePath, mode);
|
|
63451
|
-
const fileExt =
|
|
63450
|
+
const fileExt = ".js";
|
|
63452
63451
|
const elitImports = workspaceImportBasePath ? {
|
|
63453
63452
|
"elit": `${workspaceImportBasePath}/index${fileExt}`,
|
|
63454
63453
|
"elit/": `${workspaceImportBasePath}/`,
|
package/dist/server.mjs
CHANGED
|
@@ -56688,14 +56688,13 @@ var sendError = (res, code, msg) => {
|
|
|
56688
56688
|
var send404 = (res, msg = "Not Found") => sendError(res, 404, msg);
|
|
56689
56689
|
var send403 = (res, msg = "Forbidden") => sendError(res, 403, msg);
|
|
56690
56690
|
var send500 = (res, msg = "Internal Server Error") => sendError(res, 500, msg);
|
|
56691
|
-
async function resolveWorkspaceElitImportBasePath(rootDir, basePath,
|
|
56691
|
+
async function resolveWorkspaceElitImportBasePath(rootDir, basePath, _mode) {
|
|
56692
56692
|
const resolvedRootDir = await realpath(resolve(rootDir));
|
|
56693
56693
|
try {
|
|
56694
56694
|
const packageJsonBuffer = await readFile(join(resolvedRootDir, "package.json"));
|
|
56695
56695
|
const packageJson = JSON.parse(packageJsonBuffer.toString());
|
|
56696
56696
|
if (packageJson.name === "elit") {
|
|
56697
|
-
|
|
56698
|
-
return basePath ? `${basePath}/${workspaceDir}` : `/${workspaceDir}`;
|
|
56697
|
+
return basePath ? `${basePath}/dist` : "/dist";
|
|
56699
56698
|
}
|
|
56700
56699
|
} catch {
|
|
56701
56700
|
}
|
|
@@ -56703,7 +56702,7 @@ async function resolveWorkspaceElitImportBasePath(rootDir, basePath, mode) {
|
|
|
56703
56702
|
}
|
|
56704
56703
|
var createElitImportMap = async (rootDir, basePath = "", mode = "dev") => {
|
|
56705
56704
|
const workspaceImportBasePath = await resolveWorkspaceElitImportBasePath(rootDir, basePath, mode);
|
|
56706
|
-
const fileExt =
|
|
56705
|
+
const fileExt = ".js";
|
|
56707
56706
|
const elitImports = workspaceImportBasePath ? {
|
|
56708
56707
|
"elit": `${workspaceImportBasePath}/index${fileExt}`,
|
|
56709
56708
|
"elit/": `${workspaceImportBasePath}/`,
|