@vesk/vesk-cli 0.2.50-canary.2 → 0.2.50-canary.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +392 -160
- package/package.json +5 -5
package/dist/cli.js
CHANGED
|
@@ -19480,6 +19480,10 @@ function resolveSsrModule(specifier, fromDir) {
|
|
|
19480
19480
|
} else {
|
|
19481
19481
|
const aliased = resolveAliasModule(specifier, fromDir);
|
|
19482
19482
|
if (aliased) return toRealPath(aliased);
|
|
19483
|
+
const viaExports = resolveViaPackageExports(specifier, fromDir);
|
|
19484
|
+
if (viaExports) return viaExports;
|
|
19485
|
+
const viaModuleField = resolveViaPackageModuleField(specifier, fromDir);
|
|
19486
|
+
if (viaModuleField) return viaModuleField;
|
|
19483
19487
|
const native = nativeResolve(specifier, fromDir);
|
|
19484
19488
|
if (native) return native;
|
|
19485
19489
|
let dir = fromDir;
|
|
@@ -19543,6 +19547,98 @@ function statOrNull(p) {
|
|
|
19543
19547
|
return null;
|
|
19544
19548
|
}
|
|
19545
19549
|
}
|
|
19550
|
+
function resolveExports(exportsField, subpath) {
|
|
19551
|
+
const conditions = ["import", "module", "node", "default"];
|
|
19552
|
+
const target = (value) => {
|
|
19553
|
+
if (typeof value === "string") return value;
|
|
19554
|
+
if (!value || typeof value !== "object") return null;
|
|
19555
|
+
for (const cond of conditions) {
|
|
19556
|
+
if (cond in value) {
|
|
19557
|
+
const got = target(value[cond]);
|
|
19558
|
+
if (got) return got;
|
|
19559
|
+
}
|
|
19560
|
+
}
|
|
19561
|
+
return null;
|
|
19562
|
+
};
|
|
19563
|
+
if (typeof exportsField === "string") return subpath === "." ? exportsField : null;
|
|
19564
|
+
if (!exportsField || typeof exportsField !== "object") return null;
|
|
19565
|
+
const map = exportsField;
|
|
19566
|
+
if (subpath in map) {
|
|
19567
|
+
const direct = target(map[subpath]);
|
|
19568
|
+
if (direct) return direct;
|
|
19569
|
+
return null;
|
|
19570
|
+
}
|
|
19571
|
+
let best = null;
|
|
19572
|
+
for (const key of Object.keys(map)) {
|
|
19573
|
+
const star = key.indexOf("*");
|
|
19574
|
+
if (star === -1) continue;
|
|
19575
|
+
const prefix = key.slice(0, star);
|
|
19576
|
+
const suffix = key.slice(star + 1);
|
|
19577
|
+
if (!subpath.startsWith(prefix) || !subpath.endsWith(suffix)) continue;
|
|
19578
|
+
if (subpath.length < prefix.length + suffix.length) continue;
|
|
19579
|
+
if (best === null || prefix.length > best.key.length) {
|
|
19580
|
+
best = { key: prefix, star: subpath.slice(prefix.length, subpath.length - suffix.length) };
|
|
19581
|
+
}
|
|
19582
|
+
}
|
|
19583
|
+
if (!best) return null;
|
|
19584
|
+
const pattern2 = target(map[Object.keys(map).find((k) => k.startsWith(best.key + "*") && k.endsWith(best.key.slice(0, -1)) + "*")] ?? map[`${best.key}*`]);
|
|
19585
|
+
if (pattern2 === null) return null;
|
|
19586
|
+
return pattern2.split("*").join(best.star);
|
|
19587
|
+
}
|
|
19588
|
+
function resolveViaPackageModuleField(specifier, fromDir) {
|
|
19589
|
+
const firstSlash = specifier.indexOf("/");
|
|
19590
|
+
const splitAt = specifier.startsWith("@") ? specifier.indexOf("/", firstSlash + 1) : firstSlash;
|
|
19591
|
+
const pkgName = splitAt > 0 ? specifier.slice(0, splitAt) : specifier;
|
|
19592
|
+
if (splitAt > 0) return null;
|
|
19593
|
+
let dir = fromDir;
|
|
19594
|
+
for (let depth = 0; depth < 64; depth++) {
|
|
19595
|
+
const pkgPath = join2(dir, "node_modules", pkgName, "package.json");
|
|
19596
|
+
if (statOrNull(pkgPath) !== null) {
|
|
19597
|
+
try {
|
|
19598
|
+
const pkg = JSON.parse(readFileSync2(pkgPath, "utf-8"));
|
|
19599
|
+
if (typeof pkg.module === "string" && pkg.module.length > 0) {
|
|
19600
|
+
const found = probeFile(resolve(join2(dir, "node_modules", pkgName), pkg.module));
|
|
19601
|
+
if (found) return toRealPath(found);
|
|
19602
|
+
}
|
|
19603
|
+
} catch {
|
|
19604
|
+
}
|
|
19605
|
+
return null;
|
|
19606
|
+
}
|
|
19607
|
+
const parent = dirname2(dir);
|
|
19608
|
+
if (parent === dir) break;
|
|
19609
|
+
dir = parent;
|
|
19610
|
+
}
|
|
19611
|
+
return null;
|
|
19612
|
+
}
|
|
19613
|
+
function resolveViaPackageExports(specifier, fromDir) {
|
|
19614
|
+
const firstSlash = specifier.indexOf("/");
|
|
19615
|
+
const splitAt = specifier.startsWith("@") ? specifier.indexOf("/", firstSlash + 1) : firstSlash;
|
|
19616
|
+
const pkgName = splitAt > 0 ? specifier.slice(0, splitAt) : specifier;
|
|
19617
|
+
const subpath = splitAt > 0 ? "." + specifier.slice(splitAt) : ".";
|
|
19618
|
+
let dir = fromDir;
|
|
19619
|
+
for (let depth = 0; depth < 64; depth++) {
|
|
19620
|
+
const pkgDir = join2(dir, "node_modules", pkgName);
|
|
19621
|
+
const pkgPath = join2(pkgDir, "package.json");
|
|
19622
|
+
if (statOrNull(pkgPath) !== null) {
|
|
19623
|
+
try {
|
|
19624
|
+
const pkg = JSON.parse(readFileSync2(pkgPath, "utf-8"));
|
|
19625
|
+
if (pkg.exports !== void 0) {
|
|
19626
|
+
const target = resolveExports(pkg.exports, subpath);
|
|
19627
|
+
if (target) {
|
|
19628
|
+
const found = probeFile(resolve(pkgDir, target));
|
|
19629
|
+
if (found) return toRealPath(found);
|
|
19630
|
+
}
|
|
19631
|
+
}
|
|
19632
|
+
} catch {
|
|
19633
|
+
}
|
|
19634
|
+
return null;
|
|
19635
|
+
}
|
|
19636
|
+
const parent = dirname2(dir);
|
|
19637
|
+
if (parent === dir) break;
|
|
19638
|
+
dir = parent;
|
|
19639
|
+
}
|
|
19640
|
+
return null;
|
|
19641
|
+
}
|
|
19546
19642
|
function probeFile(base) {
|
|
19547
19643
|
const st = statOrNull(base);
|
|
19548
19644
|
if (st && st.isFile()) return base;
|
|
@@ -19552,9 +19648,19 @@ function probeFile(base) {
|
|
|
19552
19648
|
if (pkgSt && pkgSt.isFile()) {
|
|
19553
19649
|
try {
|
|
19554
19650
|
const pkg = JSON.parse(readFileSync2(pkgPath, "utf-8"));
|
|
19555
|
-
if (
|
|
19556
|
-
const
|
|
19557
|
-
if (
|
|
19651
|
+
if (pkg.exports !== void 0) {
|
|
19652
|
+
const viaExports = resolveExports(pkg.exports, ".");
|
|
19653
|
+
if (viaExports) {
|
|
19654
|
+
const found = probeFile(resolve(base, viaExports));
|
|
19655
|
+
if (found) return found;
|
|
19656
|
+
}
|
|
19657
|
+
}
|
|
19658
|
+
for (const field of ["module", "main"]) {
|
|
19659
|
+
const value = pkg[field];
|
|
19660
|
+
if (typeof value === "string" && value.length > 0) {
|
|
19661
|
+
const found = probeFile(resolve(base, value));
|
|
19662
|
+
if (found) return found;
|
|
19663
|
+
}
|
|
19558
19664
|
}
|
|
19559
19665
|
} catch {
|
|
19560
19666
|
}
|
|
@@ -22635,18 +22741,18 @@ function getHooks() {
|
|
|
22635
22741
|
return globalThis.__vesk_hooks;
|
|
22636
22742
|
}
|
|
22637
22743
|
function defineHook(name, fn) {
|
|
22638
|
-
const
|
|
22639
|
-
if (!
|
|
22640
|
-
|
|
22744
|
+
const hooks2 = getHooks();
|
|
22745
|
+
if (!hooks2[name]) hooks2[name] = [];
|
|
22746
|
+
hooks2[name].push(fn);
|
|
22641
22747
|
}
|
|
22642
22748
|
function removeHook(name, fn) {
|
|
22643
|
-
const
|
|
22644
|
-
if (!
|
|
22645
|
-
|
|
22749
|
+
const hooks2 = getHooks();
|
|
22750
|
+
if (!hooks2[name]) return;
|
|
22751
|
+
hooks2[name] = hooks2[name].filter((h) => h !== fn);
|
|
22646
22752
|
}
|
|
22647
22753
|
async function runHooks(name, ...args2) {
|
|
22648
|
-
const
|
|
22649
|
-
for (const fn of
|
|
22754
|
+
const hooks2 = getHooks()[name] || [];
|
|
22755
|
+
for (const fn of hooks2) {
|
|
22650
22756
|
const result = await fn(...args2);
|
|
22651
22757
|
if (result instanceof Response) return result;
|
|
22652
22758
|
}
|
|
@@ -32504,7 +32610,7 @@ async function renderFullPage(source, componentName, props = {}, registry = /* @
|
|
|
32504
32610
|
const cssUrls = options.cssUrls || (options.cssUrl ? [options.cssUrl] : []);
|
|
32505
32611
|
const cssLink = cssUrls.map((u) => ` <link rel="stylesheet" href="${u}" />
|
|
32506
32612
|
`).join("");
|
|
32507
|
-
const clientScript = options.clientScriptUrl ? ` <script type="module" src="${options.clientScriptUrl}"></script>
|
|
32613
|
+
const clientScript = options.clientScriptUrl ? ` <script type="module" src="${options.clientScriptUrl}"${options.clientScriptIntegrity ? ` integrity="${options.clientScriptIntegrity}" crossorigin="anonymous"` : ""}></script>
|
|
32508
32614
|
` : "";
|
|
32509
32615
|
const dataScripts = buildDataScripts(ssrProps, ssrData, options.externalDataScript);
|
|
32510
32616
|
const dataScriptBlock = dataScripts.length > 0 ? "\n" + dataScripts.join("\n") + "\n" : "";
|
|
@@ -32640,7 +32746,7 @@ function renderPageStream(source, componentName, props = {}, registry = /* @__PU
|
|
|
32640
32746
|
pruneSsrDataSlots();
|
|
32641
32747
|
const dataScripts = buildDataScripts(ssrProps, ssrData, options.externalDataScript);
|
|
32642
32748
|
const dataScriptBlock = dataScripts.length > 0 ? "\n" + dataScripts.join("\n") : "";
|
|
32643
|
-
const clientScript = options.clientScriptUrl ? ` <script type="module" src="${options.clientScriptUrl}"></script>
|
|
32749
|
+
const clientScript = options.clientScriptUrl ? ` <script type="module" src="${options.clientScriptUrl}"${options.clientScriptIntegrity ? ` integrity="${options.clientScriptIntegrity}" crossorigin="anonymous"` : ""}></script>
|
|
32644
32750
|
` : "";
|
|
32645
32751
|
yield `
|
|
32646
32752
|
</div>${dataScriptBlock}${clientScript}</body>
|
|
@@ -32745,7 +32851,7 @@ import {
|
|
|
32745
32851
|
mkdirSync as mkdirSync6,
|
|
32746
32852
|
statSync as statSync7
|
|
32747
32853
|
} from "node:fs";
|
|
32748
|
-
import { resolve as resolve14, dirname as dirname11, join as join10, extname as extname4, basename } from "node:path";
|
|
32854
|
+
import { resolve as resolve14, dirname as dirname11, join as join10, extname as extname4, basename as basename2 } from "node:path";
|
|
32749
32855
|
import { createRequire as createRequire4 } from "node:module";
|
|
32750
32856
|
import { spawn } from "node:child_process";
|
|
32751
32857
|
function defaultState() {
|
|
@@ -32803,7 +32909,7 @@ function resolvePackage(appDir, pkg) {
|
|
|
32803
32909
|
break;
|
|
32804
32910
|
}
|
|
32805
32911
|
const parent = dirname11(cur);
|
|
32806
|
-
if (parent !== cur &&
|
|
32912
|
+
if (parent !== cur && basename2(cur) === "node_modules") break;
|
|
32807
32913
|
cur = parent;
|
|
32808
32914
|
}
|
|
32809
32915
|
} catch {
|
|
@@ -39227,7 +39333,7 @@ __export(typecheck_exports, {
|
|
|
39227
39333
|
typecheckProject: () => typecheckProject
|
|
39228
39334
|
});
|
|
39229
39335
|
import { readFileSync as readFileSync39, readdirSync as readdirSync14, statSync as statSync22 } from "node:fs";
|
|
39230
|
-
import { join as
|
|
39336
|
+
import { join as join27, dirname as dirname27, normalize, relative as relative8, resolve as resolve39, sep as sep7 } from "node:path";
|
|
39231
39337
|
import * as ts8 from "typescript";
|
|
39232
39338
|
function walkProjectFiles(projectRoot) {
|
|
39233
39339
|
const code = [];
|
|
@@ -39240,7 +39346,7 @@ function walkProjectFiles(projectRoot) {
|
|
|
39240
39346
|
return;
|
|
39241
39347
|
}
|
|
39242
39348
|
for (const e of entries) {
|
|
39243
|
-
const p =
|
|
39349
|
+
const p = join27(dir, e);
|
|
39244
39350
|
let st;
|
|
39245
39351
|
try {
|
|
39246
39352
|
st = statSync22(p);
|
|
@@ -39295,8 +39401,8 @@ function checkStructureFile(appDir, file) {
|
|
|
39295
39401
|
return null;
|
|
39296
39402
|
}
|
|
39297
39403
|
function createTypecheckHost(projectRoot, appDir, vskFiles) {
|
|
39298
|
-
const ambientPath =
|
|
39299
|
-
const overridePath =
|
|
39404
|
+
const ambientPath = join27(appDir, "__vesk_ambient.d.ts");
|
|
39405
|
+
const overridePath = join27(appDir, "__vesk_runtime_override.d.ts");
|
|
39300
39406
|
const cached = /* @__PURE__ */ new Map();
|
|
39301
39407
|
const scriptKindFor = (file) => file.endsWith(".vsk") ? ts8.ScriptKind.TSX : ts8.ScriptKind.TS;
|
|
39302
39408
|
const host = {
|
|
@@ -39366,7 +39472,7 @@ function createTypecheckHost(projectRoot, appDir, vskFiles) {
|
|
|
39366
39472
|
directoryExists: (dir) => ts8.sys.directoryExists(dir),
|
|
39367
39473
|
getDirectories: (dir) => {
|
|
39368
39474
|
try {
|
|
39369
|
-
return readdirSync14(dir, { withFileTypes: true }).filter((d) => d.isDirectory()).map((d) =>
|
|
39475
|
+
return readdirSync14(dir, { withFileTypes: true }).filter((d) => d.isDirectory()).map((d) => join27(dir, d.name));
|
|
39370
39476
|
} catch {
|
|
39371
39477
|
return [];
|
|
39372
39478
|
}
|
|
@@ -39378,7 +39484,7 @@ function createTypecheckHost(projectRoot, appDir, vskFiles) {
|
|
|
39378
39484
|
return moduleLiterals.map(({ text }) => {
|
|
39379
39485
|
if (text.endsWith(".vsk")) {
|
|
39380
39486
|
const aliased = text.startsWith(".") ? null : resolveAliasModule(text, dirname27(containingFile));
|
|
39381
|
-
const abs = normalize(aliased ??
|
|
39487
|
+
const abs = normalize(aliased ?? join27(dirname27(containingFile), text));
|
|
39382
39488
|
return {
|
|
39383
39489
|
resolvedModule: {
|
|
39384
39490
|
resolvedFileName: abs + ".d.ts",
|
|
@@ -39389,7 +39495,7 @@ function createTypecheckHost(projectRoot, appDir, vskFiles) {
|
|
|
39389
39495
|
};
|
|
39390
39496
|
}
|
|
39391
39497
|
if (text.endsWith(".css")) {
|
|
39392
|
-
const abs = normalize(
|
|
39498
|
+
const abs = normalize(join27(dirname27(containingFile), text));
|
|
39393
39499
|
return {
|
|
39394
39500
|
resolvedModule: {
|
|
39395
39501
|
resolvedFileName: abs + ".d.ts",
|
|
@@ -39436,7 +39542,7 @@ function sourcePosition(source, offset2) {
|
|
|
39436
39542
|
return { line, character: bounded - lineStart + 1 };
|
|
39437
39543
|
}
|
|
39438
39544
|
function typecheckProject(projectRoot, opts = {}) {
|
|
39439
|
-
const appDir = opts.appDir ??
|
|
39545
|
+
const appDir = opts.appDir ?? join27(projectRoot, "app");
|
|
39440
39546
|
const vskFiles = /* @__PURE__ */ new Map();
|
|
39441
39547
|
const parseErrors = [];
|
|
39442
39548
|
const warnings = [];
|
|
@@ -39475,8 +39581,8 @@ function typecheckProject(projectRoot, opts = {}) {
|
|
|
39475
39581
|
}
|
|
39476
39582
|
rootNames.push(f);
|
|
39477
39583
|
}
|
|
39478
|
-
const ambientPath =
|
|
39479
|
-
const overridePath =
|
|
39584
|
+
const ambientPath = join27(appDir, "__vesk_ambient.d.ts");
|
|
39585
|
+
const overridePath = join27(appDir, "__vesk_runtime_override.d.ts");
|
|
39480
39586
|
rootNames.push(ambientPath);
|
|
39481
39587
|
rootNames.push(overridePath);
|
|
39482
39588
|
const options = {
|
|
@@ -45422,7 +45528,7 @@ __export(codemods_exports, {
|
|
|
45422
45528
|
compareCore: () => compareCore
|
|
45423
45529
|
});
|
|
45424
45530
|
import { readFileSync as readFileSync40, existsSync as existsSync43 } from "node:fs";
|
|
45425
|
-
import { join as
|
|
45531
|
+
import { join as join28 } from "node:path";
|
|
45426
45532
|
import { walk as walk8 } from "zimmerframe";
|
|
45427
45533
|
function safeParse(source, filePath) {
|
|
45428
45534
|
try {
|
|
@@ -45442,7 +45548,7 @@ function isVskFile(filePath) {
|
|
|
45442
45548
|
}
|
|
45443
45549
|
function typesPackageExports(projectDir) {
|
|
45444
45550
|
const candidates = [
|
|
45445
|
-
projectDir ?
|
|
45551
|
+
projectDir ? join28(projectDir, "node_modules", "@vesk", "types", "dist", "index.d.ts") : null,
|
|
45446
45552
|
new URL("../../types/dist/index.d.ts", import.meta.url).pathname
|
|
45447
45553
|
].filter((p) => typeof p === "string" && existsSync43(p));
|
|
45448
45554
|
for (const path of candidates) {
|
|
@@ -45572,10 +45678,10 @@ __export(migrate_exports, {
|
|
|
45572
45678
|
runMigrate: () => runMigrate
|
|
45573
45679
|
});
|
|
45574
45680
|
import { readFileSync as readFileSync41, writeFileSync as writeFileSync21, existsSync as existsSync44, statSync as statSync23, readdirSync as readdirSync15 } from "node:fs";
|
|
45575
|
-
import { join as
|
|
45681
|
+
import { join as join29, relative as relative9, extname as extname9 } from "node:path";
|
|
45576
45682
|
function detectInstalledVersion(projectDir, cliVersion) {
|
|
45577
45683
|
for (const pkg of ["@vesk/vesk-cli", "@vesk/adapter", "@vesk/compiler"]) {
|
|
45578
|
-
const p =
|
|
45684
|
+
const p = join29(projectDir, "node_modules", pkg, "package.json");
|
|
45579
45685
|
if (!existsSync44(p)) continue;
|
|
45580
45686
|
try {
|
|
45581
45687
|
const version2 = JSON.parse(readFileSync41(p, "utf-8")).version;
|
|
@@ -45595,7 +45701,7 @@ function collectTargets(dir, root3 = dir) {
|
|
|
45595
45701
|
}
|
|
45596
45702
|
for (const entry of entries.sort()) {
|
|
45597
45703
|
if (SKIP_DIRS2.has(entry)) continue;
|
|
45598
|
-
const full =
|
|
45704
|
+
const full = join29(dir, entry);
|
|
45599
45705
|
let st;
|
|
45600
45706
|
try {
|
|
45601
45707
|
st = statSync23(full);
|
|
@@ -45630,7 +45736,7 @@ function runMigrate(options) {
|
|
|
45630
45736
|
return report;
|
|
45631
45737
|
}
|
|
45632
45738
|
for (const relPath of collectTargets(options.projectDir)) {
|
|
45633
|
-
const abs =
|
|
45739
|
+
const abs = join29(options.projectDir, relPath);
|
|
45634
45740
|
const ctx2 = { filePath: abs, displayPath: relPath, projectDir: options.projectDir };
|
|
45635
45741
|
if (!existsSync44(abs)) continue;
|
|
45636
45742
|
let source;
|
|
@@ -45676,7 +45782,7 @@ var init_migrate = __esm({
|
|
|
45676
45782
|
|
|
45677
45783
|
// src/index.ts
|
|
45678
45784
|
import { readFileSync as readFileSync42, writeFileSync as writeFileSync22, mkdirSync as mkdirSync20, existsSync as existsSync45 } from "fs";
|
|
45679
|
-
import { resolve as resolve40, join as
|
|
45785
|
+
import { resolve as resolve40, join as join30 } from "path";
|
|
45680
45786
|
import { fileURLToPath as fileURLToPath9 } from "url";
|
|
45681
45787
|
|
|
45682
45788
|
// ../adapter/dist/load-config.js
|
|
@@ -46255,7 +46361,7 @@ function setRuntimeModule2(mod) {
|
|
|
46255
46361
|
|
|
46256
46362
|
// ../adapter/dist/index.js
|
|
46257
46363
|
import { mkdirSync as mkdirSync11, writeFileSync as writeFileSync12, existsSync as existsSync22, readFileSync as readFileSync21 } from "node:fs";
|
|
46258
|
-
import { resolve as resolve21, dirname as dirname16, relative as relative4, basename as
|
|
46364
|
+
import { resolve as resolve21, dirname as dirname16, relative as relative4, basename as basename3, join as join15 } from "node:path";
|
|
46259
46365
|
import { fileURLToPath as fileURLToPath5 } from "node:url";
|
|
46260
46366
|
|
|
46261
46367
|
// ../adapter/src/runtime-bundle.ts
|
|
@@ -46738,7 +46844,7 @@ ${layoutDecls.map((d) => " " + d.compiled + ",").join("\n")}
|
|
|
46738
46844
|
return { ${paramExprs.join(", ")} };
|
|
46739
46845
|
}
|
|
46740
46846
|
`;
|
|
46741
|
-
const clientScriptOption =
|
|
46847
|
+
const clientScriptOption = `, clientScriptUrl: ${JSON.stringify(options?.clientScriptUrl || "/_vesk/static/client.js")}` + (options?.clientScriptIntegrity ? `, clientScriptIntegrity: ${JSON.stringify(options.clientScriptIntegrity)}` : "");
|
|
46742
46848
|
const dataScriptOption = ", externalDataScript: storeDataScriptGlobal";
|
|
46743
46849
|
let registryCode = "";
|
|
46744
46850
|
const compRegEntries = [];
|
|
@@ -47288,6 +47394,43 @@ function generateApiFunction(apiNode, _apiDir, outDir, options) {
|
|
|
47288
47394
|
return { funcPath, funcCode, name };
|
|
47289
47395
|
}
|
|
47290
47396
|
|
|
47397
|
+
// ../adapter/src/asset-hash.ts
|
|
47398
|
+
import { createHash } from "node:crypto";
|
|
47399
|
+
var EXT_RE = /\.([a-z0-9]+)$/i;
|
|
47400
|
+
function hashedName(fileName, content) {
|
|
47401
|
+
const m = EXT_RE.exec(fileName);
|
|
47402
|
+
if (!m) return fileName;
|
|
47403
|
+
const base = fileName.slice(0, m.index);
|
|
47404
|
+
return `${base}.${hashOf(content)}${m[0]}`;
|
|
47405
|
+
}
|
|
47406
|
+
function hashOf(content) {
|
|
47407
|
+
return createHash("sha256").update(content).digest("hex").slice(0, 10);
|
|
47408
|
+
}
|
|
47409
|
+
function integrityOf(content) {
|
|
47410
|
+
return `sha384-${createHash("sha384").update(content).digest("base64")}`;
|
|
47411
|
+
}
|
|
47412
|
+
function describeAsset(fileName, content) {
|
|
47413
|
+
return {
|
|
47414
|
+
fileName: hashedName(fileName, content),
|
|
47415
|
+
hash: hashOf(content),
|
|
47416
|
+
bytes: typeof content === "string" ? Buffer.byteLength(content) : content.length,
|
|
47417
|
+
integrity: integrityOf(content)
|
|
47418
|
+
};
|
|
47419
|
+
}
|
|
47420
|
+
function isHashedName(fileName) {
|
|
47421
|
+
const m = EXT_RE.exec(fileName);
|
|
47422
|
+
if (!m) return false;
|
|
47423
|
+
const base = fileName.slice(0, m.index);
|
|
47424
|
+
const dot = base.lastIndexOf(".");
|
|
47425
|
+
if (dot === -1) return false;
|
|
47426
|
+
const suffix = base.slice(dot + 1);
|
|
47427
|
+
return suffix.length === 10 && /^[0-9a-f]{10}$/.test(suffix);
|
|
47428
|
+
}
|
|
47429
|
+
function cacheControlFor(fileName, isDev) {
|
|
47430
|
+
if (isDev) return "no-cache";
|
|
47431
|
+
return isHashedName(fileName) ? "public, max-age=31536000, immutable" : "public, max-age=0, must-revalidate";
|
|
47432
|
+
}
|
|
47433
|
+
|
|
47291
47434
|
// ../adapter/src/middleware.ts
|
|
47292
47435
|
import { readFileSync as readFileSync10 } from "node:fs";
|
|
47293
47436
|
|
|
@@ -47504,14 +47647,17 @@ function collectEventsFile(appDir) {
|
|
|
47504
47647
|
|
|
47505
47648
|
// ../adapter/src/events.ts
|
|
47506
47649
|
var buildId2 = 0;
|
|
47507
|
-
function
|
|
47650
|
+
function buildEventsEntry(sourcePath2) {
|
|
47508
47651
|
return [
|
|
47509
47652
|
`import * as __events from ${JSON.stringify(sourcePath2)};`,
|
|
47510
47653
|
"",
|
|
47511
47654
|
"const __store = () => (globalThis.__vesk_server_ctx ||= {});",
|
|
47512
47655
|
"",
|
|
47513
47656
|
"const __handlers = {};",
|
|
47514
|
-
|
|
47657
|
+
// `onError` joins the server events: production has no plugin objects, so
|
|
47658
|
+
// this is the seam an error reporter actually uses there (plugins carry
|
|
47659
|
+
// their own `onError` in dev, where plugin objects do exist).
|
|
47660
|
+
"for (const __name of ['onStart', 'onRequest', 'onStop', 'onError']) {",
|
|
47515
47661
|
" const __fn = __events[__name];",
|
|
47516
47662
|
" if (typeof __fn === 'function') __handlers[__name] = __fn;",
|
|
47517
47663
|
"}",
|
|
@@ -47552,16 +47698,26 @@ function buildEntry(sourcePath2) {
|
|
|
47552
47698
|
"export const onStart = __handlers.onStart;",
|
|
47553
47699
|
"export const onRequest = __handlers.onRequest;",
|
|
47554
47700
|
"export const onStop = __handlers.onStop;",
|
|
47701
|
+
"export const onError = __handlers.onError;",
|
|
47555
47702
|
""
|
|
47556
47703
|
].join("\n");
|
|
47557
47704
|
}
|
|
47705
|
+
async function executeError(err, base, mod) {
|
|
47706
|
+
const fn = mod?.onError;
|
|
47707
|
+
if (typeof fn !== "function") return;
|
|
47708
|
+
try {
|
|
47709
|
+
await fn(err, base);
|
|
47710
|
+
} catch (e) {
|
|
47711
|
+
console.error("vesk: _events onError threw and was ignored:", e instanceof Error ? e.message : e);
|
|
47712
|
+
}
|
|
47713
|
+
}
|
|
47558
47714
|
async function compileEvents(appDir, outDir) {
|
|
47559
47715
|
const sourcePath2 = collectEventsFile(appDir);
|
|
47560
47716
|
if (!sourcePath2) return false;
|
|
47561
47717
|
const serverDir = resolve9(outDir, "server");
|
|
47562
47718
|
mkdirSync2(serverDir, { recursive: true });
|
|
47563
47719
|
const entryFile = resolve9(serverDir, `.events-entry-${buildId2++}.mjs`);
|
|
47564
|
-
writeFileSync3(entryFile,
|
|
47720
|
+
writeFileSync3(entryFile, buildEventsEntry(sourcePath2), "utf-8");
|
|
47565
47721
|
try {
|
|
47566
47722
|
const result = await build({
|
|
47567
47723
|
entryPoints: [entryFile],
|
|
@@ -47591,14 +47747,14 @@ async function compileEvents(appDir, outDir) {
|
|
|
47591
47747
|
|
|
47592
47748
|
// ../adapter/src/client-bundle.ts
|
|
47593
47749
|
init_esbuild_fallback();
|
|
47594
|
-
init_strip_ts();
|
|
47595
|
-
init_parser();
|
|
47596
|
-
init_client_codegen();
|
|
47597
|
-
init_vsk_collision();
|
|
47598
47750
|
import { readFileSync as readFileSync11, existsSync as existsSync11, writeFileSync as writeFileSync4, unlinkSync as unlinkSync3, statSync as statSync3, rmSync, mkdtempSync, mkdirSync as mkdirSync3 } from "node:fs";
|
|
47599
47751
|
import { resolve as resolve10, join as join7, dirname as dirname8, relative as relative2, sep } from "node:path";
|
|
47600
47752
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
47601
47753
|
import { tmpdir } from "node:os";
|
|
47754
|
+
init_strip_ts();
|
|
47755
|
+
init_parser();
|
|
47756
|
+
init_client_codegen();
|
|
47757
|
+
init_vsk_collision();
|
|
47602
47758
|
init_vsk_imports();
|
|
47603
47759
|
init_md_inline();
|
|
47604
47760
|
init_module_imports();
|
|
@@ -48184,8 +48340,11 @@ async function generateClientBundle(routeTree, appDir, componentMap, options) {
|
|
|
48184
48340
|
}, annotate2 = function(nodes) {
|
|
48185
48341
|
for (const node of nodes) {
|
|
48186
48342
|
const chunkName = `page-${buildChunkName(node)}.js`;
|
|
48187
|
-
const
|
|
48188
|
-
if (
|
|
48343
|
+
const emitted = chunks.find((c) => c.name === chunkName && c.code.trim());
|
|
48344
|
+
if (emitted) {
|
|
48345
|
+
const fileName = options?.hmr ? chunkName : hashedName(chunkName, emitted.code);
|
|
48346
|
+
node.chunk = `/_vesk/static/${fileName}`;
|
|
48347
|
+
}
|
|
48189
48348
|
annotate2(node.children || []);
|
|
48190
48349
|
}
|
|
48191
48350
|
};
|
|
@@ -48624,10 +48783,42 @@ function copyStaticAssets(publicDir, outDir) {
|
|
|
48624
48783
|
|
|
48625
48784
|
// ../adapter/src/prod-server.ts
|
|
48626
48785
|
import { readFileSync as readFileSync15, existsSync as existsSync15, statSync as statSync6 } from "node:fs";
|
|
48627
|
-
import { resolve as resolve13, extname as extname3, dirname as dirname10 } from "node:path";
|
|
48786
|
+
import { resolve as resolve13, extname as extname3, dirname as dirname10, basename } from "node:path";
|
|
48628
48787
|
import { createServer } from "node:http";
|
|
48629
48788
|
import { fileURLToPath as fileURLToPath3 } from "node:url";
|
|
48630
48789
|
init_server_utils();
|
|
48790
|
+
|
|
48791
|
+
// ../adapter/src/error-report.ts
|
|
48792
|
+
var hooks = [];
|
|
48793
|
+
var reported = /* @__PURE__ */ new WeakSet();
|
|
48794
|
+
async function reportServerError(err, options) {
|
|
48795
|
+
if (options.dedupe !== false && err && typeof err === "object") {
|
|
48796
|
+
if (reported.has(err)) return;
|
|
48797
|
+
reported.add(err);
|
|
48798
|
+
}
|
|
48799
|
+
const cfg = options.buildConfig || null;
|
|
48800
|
+
const ctx2 = {
|
|
48801
|
+
url: options.url,
|
|
48802
|
+
routePath: options.routePath,
|
|
48803
|
+
target: options.target,
|
|
48804
|
+
status: options.status ?? 500,
|
|
48805
|
+
durationMs: options.durationMs,
|
|
48806
|
+
version: typeof cfg?.veskVersion === "string" ? cfg.veskVersion : void 0,
|
|
48807
|
+
buildId: typeof cfg?.buildId === "string" ? cfg.buildId : void 0,
|
|
48808
|
+
errorName: err instanceof Error ? err.name : typeof err,
|
|
48809
|
+
message: err instanceof Error ? err.message : String(err),
|
|
48810
|
+
stack: err instanceof Error ? err.stack : void 0
|
|
48811
|
+
};
|
|
48812
|
+
for (const hook of hooks) {
|
|
48813
|
+
try {
|
|
48814
|
+
await hook(err, ctx2);
|
|
48815
|
+
} catch (e) {
|
|
48816
|
+
console.error("vesk: an onError hook threw and was ignored:", e?.message ?? e);
|
|
48817
|
+
}
|
|
48818
|
+
}
|
|
48819
|
+
}
|
|
48820
|
+
|
|
48821
|
+
// ../adapter/src/prod-server.ts
|
|
48631
48822
|
init_paths();
|
|
48632
48823
|
|
|
48633
48824
|
// ../adapter/src/load-config.ts
|
|
@@ -48935,9 +49126,13 @@ async function startProdServer(outDir, options) {
|
|
|
48935
49126
|
return;
|
|
48936
49127
|
}
|
|
48937
49128
|
if (url.pathname === "/_vesk/runtime.js") {
|
|
48938
|
-
const
|
|
49129
|
+
const clientFile = buildConfig?.assets?.client?.file || "client.js";
|
|
49130
|
+
const clientPath = resolve13(staticDir, clientFile);
|
|
48939
49131
|
if (existsSync15(clientPath)) {
|
|
48940
|
-
res.writeHead(200, {
|
|
49132
|
+
res.writeHead(200, {
|
|
49133
|
+
"Content-Type": "application/javascript",
|
|
49134
|
+
"Cache-Control": cacheControlFor(clientFile, false)
|
|
49135
|
+
});
|
|
48941
49136
|
res.end(readFileSync15(clientPath));
|
|
48942
49137
|
return;
|
|
48943
49138
|
}
|
|
@@ -48952,7 +49147,13 @@ async function startProdServer(outDir, options) {
|
|
|
48952
49147
|
}
|
|
48953
49148
|
if (existsSync15(staticPath) && statSync6(staticPath).isFile()) {
|
|
48954
49149
|
const ext = extname3(staticPath);
|
|
48955
|
-
res.writeHead(200, {
|
|
49150
|
+
res.writeHead(200, {
|
|
49151
|
+
"Content-Type": MIME[ext] || "application/octet-stream",
|
|
49152
|
+
// A content-hashed name can never change meaning, so it is immutable
|
|
49153
|
+
// for a year; anything unhashed must be revalidated or a deploy would
|
|
49154
|
+
// serve stale JS forever.
|
|
49155
|
+
"Cache-Control": cacheControlFor(basename(staticPath), false)
|
|
49156
|
+
});
|
|
48956
49157
|
res.end(readFileSync15(staticPath));
|
|
48957
49158
|
return;
|
|
48958
49159
|
}
|
|
@@ -49141,6 +49342,16 @@ async function startProdServer(outDir, options) {
|
|
|
49141
49342
|
return;
|
|
49142
49343
|
}
|
|
49143
49344
|
console.error("vesk ssr error:", err.message);
|
|
49345
|
+
await reportServerError(err, {
|
|
49346
|
+
url: url.pathname + url.search,
|
|
49347
|
+
routePath: route.path,
|
|
49348
|
+
target: "node",
|
|
49349
|
+
status: 500,
|
|
49350
|
+
buildConfig
|
|
49351
|
+
});
|
|
49352
|
+
if (eventsMod) {
|
|
49353
|
+
await executeError(err, { url: url.href, routePath: route.path, target: "node", status: 500 }, eventsMod);
|
|
49354
|
+
}
|
|
49144
49355
|
const errPath = resolve13(appDir, "error.vsk");
|
|
49145
49356
|
let errorHtml = null;
|
|
49146
49357
|
if (existsSync15(errPath)) {
|
|
@@ -49150,7 +49361,7 @@ async function startProdServer(outDir, options) {
|
|
|
49150
49361
|
const src2 = readFileSync15(errPath, "utf-8");
|
|
49151
49362
|
const compName = resolveComponentName(src2) || "Error";
|
|
49152
49363
|
const expose = process.env.NODE_ENV !== "production";
|
|
49153
|
-
errorHtml = await renderFullPage2(src2, compName, { error: expose ? err.message : "Internal Server Error", stack: expose ? err.stack : "", statusCode: 500, url: url.pathname }, /* @__PURE__ */ new Map(), { hydrate: true, cssUrls: pageCssUrls, clientScriptUrl: "/_vesk/static/client.js", security: securityConfig?.security || {}, externalDataScript: storeDataScriptGlobal, sourcePath: errPath, headExtra: bakedHeadExtra });
|
|
49364
|
+
errorHtml = await renderFullPage2(src2, compName, { error: expose ? err.message : "Internal Server Error", stack: expose ? err.stack : "", statusCode: 500, url: url.pathname }, /* @__PURE__ */ new Map(), { hydrate: true, cssUrls: pageCssUrls, clientScriptUrl: buildConfig?.assets?.client?.url || "/_vesk/static/client.js", clientScriptIntegrity: buildConfig?.assets?.client?.integrity, security: securityConfig?.security || {}, externalDataScript: storeDataScriptGlobal, sourcePath: errPath, headExtra: bakedHeadExtra });
|
|
49154
49365
|
} catch {
|
|
49155
49366
|
}
|
|
49156
49367
|
}
|
|
@@ -49205,6 +49416,9 @@ init_parser();
|
|
|
49205
49416
|
init_paths();
|
|
49206
49417
|
|
|
49207
49418
|
// ../adapter/dist/index.js
|
|
49419
|
+
function PACKAGES_DIR_SELF() {
|
|
49420
|
+
return resolve21(dirname16(fileURLToPath5(import.meta.url)), "..");
|
|
49421
|
+
}
|
|
49208
49422
|
var __dirname6 = dirname16(fileURLToPath5(import.meta.url));
|
|
49209
49423
|
async function resolveCompilerApi(name) {
|
|
49210
49424
|
const monorepoSrc = resolve21(__dirname6, "..", "..", "compiler", "src");
|
|
@@ -49231,7 +49445,7 @@ function filterPluginsForBuild(plugins, state) {
|
|
|
49231
49445
|
return filterActivePlugins2(plugins, state.plugins);
|
|
49232
49446
|
}
|
|
49233
49447
|
function veskDirFromOutDir(outDir) {
|
|
49234
|
-
const base =
|
|
49448
|
+
const base = basename3(outDir);
|
|
49235
49449
|
if (base === "dev" || base === "build")
|
|
49236
49450
|
return dirname16(outDir);
|
|
49237
49451
|
return outDir;
|
|
@@ -49360,6 +49574,34 @@ async function build2(appDir, options) {
|
|
|
49360
49574
|
const apiTree = existsSync22(apiDir) ? scanApiRoutes2(apiDir) : [];
|
|
49361
49575
|
console.error(`vesk build: ${routeTree.length} root routes, ${apiTree.length} API routes`);
|
|
49362
49576
|
markPhase("scan routes");
|
|
49577
|
+
console.error("vesk build: bundling client runtime...");
|
|
49578
|
+
const bundleOpts = {};
|
|
49579
|
+
if (options?.codeSplit)
|
|
49580
|
+
bundleOpts.codeSplit = true;
|
|
49581
|
+
if (options?.hmr)
|
|
49582
|
+
bundleOpts.hmr = true;
|
|
49583
|
+
if (options?.routeDataCache !== void 0)
|
|
49584
|
+
bundleOpts.routeDataCache = options.routeDataCache;
|
|
49585
|
+
if (pluginsPipelines.length > 0)
|
|
49586
|
+
bundleOpts.plugins = pluginsPipelines;
|
|
49587
|
+
const { main, chunks } = await generateClientBundle(routeTree, appDir, componentMap, bundleOpts);
|
|
49588
|
+
markPhase("client runtime + chunks");
|
|
49589
|
+
const staticDir = resolve21(outDir, "static");
|
|
49590
|
+
const hashed = !options?.hmr;
|
|
49591
|
+
const clientAsset = describeAsset("client.js", main);
|
|
49592
|
+
const clientFileName = hashed ? clientAsset.fileName : "client.js";
|
|
49593
|
+
writeFileSync12(resolve21(staticDir, clientFileName), main, "utf-8");
|
|
49594
|
+
const clientUrl = `/_vesk/static/${clientFileName}`;
|
|
49595
|
+
const mode = chunks.length > 0 ? "code-split" : "monolithic";
|
|
49596
|
+
console.error(`vesk build: client \u2192 static/${clientFileName} (${main.length} bytes, ${mode}${hashed ? `, ${clientAsset.hash}` : ""})`);
|
|
49597
|
+
const emittedAssets = [clientAsset];
|
|
49598
|
+
for (const chunk of chunks) {
|
|
49599
|
+
const asset = describeAsset(chunk.name, chunk.code);
|
|
49600
|
+
emittedAssets.push(asset);
|
|
49601
|
+
writeFileSync12(resolve21(staticDir, hashed ? asset.fileName : chunk.name), chunk.code, "utf-8");
|
|
49602
|
+
console.error(`vesk build: chunk \u2192 static/${hashed ? asset.fileName : chunk.name} (${chunk.code.length} bytes${hashed ? `, ${asset.hash}` : ""})`);
|
|
49603
|
+
}
|
|
49604
|
+
const clientIntegrity = hashed ? clientAsset.integrity : void 0;
|
|
49363
49605
|
console.error("vesk build: bundling server runtime...");
|
|
49364
49606
|
await bundleRuntime(appDir, outDir);
|
|
49365
49607
|
const ssrRoutes = [];
|
|
@@ -49379,7 +49621,7 @@ async function build2(appDir, options) {
|
|
|
49379
49621
|
mwCode = compileMiddlewareCode(mwSources);
|
|
49380
49622
|
}
|
|
49381
49623
|
const ssrAncestorLayouts = isStandalone ? [] : ancestorLayouts;
|
|
49382
|
-
const { funcPath, funcCode, name } = generateSsrFunction(node, appDir, outDir, componentMap, { ancestorLayouts: ssrAncestorLayouts, middlewareCode: mwCode, headExtra: pluginHeadExtra });
|
|
49624
|
+
const { funcPath, funcCode, name } = generateSsrFunction(node, appDir, outDir, componentMap, { ancestorLayouts: ssrAncestorLayouts, middlewareCode: mwCode, headExtra: pluginHeadExtra, clientScriptUrl: clientUrl, clientScriptIntegrity: clientIntegrity });
|
|
49383
49625
|
writeFileSync12(funcPath, funcCode, "utf-8");
|
|
49384
49626
|
const pagePath = resolve21(appDir, node.sourceDir, "page.vsk");
|
|
49385
49627
|
if (existsSync22(pagePath)) {
|
|
@@ -49439,28 +49681,6 @@ async function build2(appDir, options) {
|
|
|
49439
49681
|
const hasEvents = await compileEvents(appDir, outDir);
|
|
49440
49682
|
if (hasEvents)
|
|
49441
49683
|
console.error("vesk build: evt \u2192 server/events.js (onStart/onRequest/onStop)");
|
|
49442
|
-
markPhase("api functions");
|
|
49443
|
-
console.error("vesk build: bundling client runtime...");
|
|
49444
|
-
const bundleOpts = {};
|
|
49445
|
-
if (options?.codeSplit)
|
|
49446
|
-
bundleOpts.codeSplit = true;
|
|
49447
|
-
if (options?.hmr)
|
|
49448
|
-
bundleOpts.hmr = true;
|
|
49449
|
-
if (options?.routeDataCache !== void 0)
|
|
49450
|
-
bundleOpts.routeDataCache = options.routeDataCache;
|
|
49451
|
-
if (pluginsPipelines.length > 0)
|
|
49452
|
-
bundleOpts.plugins = pluginsPipelines;
|
|
49453
|
-
const { main, chunks } = await generateClientBundle(routeTree, appDir, componentMap, bundleOpts);
|
|
49454
|
-
writeFileSync12(resolve21(outDir, "static", "client.js"), main, "utf-8");
|
|
49455
|
-
const mode = chunks.length > 0 ? "code-split" : "monolithic";
|
|
49456
|
-
console.error(`vesk build: client \u2192 static/client.js (${main.length} bytes, ${mode})`);
|
|
49457
|
-
if (chunks.length > 0) {
|
|
49458
|
-
const staticDir = resolve21(outDir, "static");
|
|
49459
|
-
for (const chunk of chunks) {
|
|
49460
|
-
writeFileSync12(resolve21(staticDir, chunk.name), chunk.code, "utf-8");
|
|
49461
|
-
console.error(`vesk build: chunk \u2192 static/${chunk.name} (${chunk.code.length} bytes)`);
|
|
49462
|
-
}
|
|
49463
|
-
}
|
|
49464
49684
|
copyStaticAssets(publicDir, outDir);
|
|
49465
49685
|
markPhase("client runtime + chunks");
|
|
49466
49686
|
console.error("vesk build: static \u2192 static/public/");
|
|
@@ -49503,6 +49723,14 @@ async function build2(appDir, options) {
|
|
|
49503
49723
|
}
|
|
49504
49724
|
markPhase("ssg+images+seo");
|
|
49505
49725
|
const manifest = generateManifest(routeTree, ssrRoutes, apiRoutes, prerenderedRoutes, middlewareEnabled, actionMap, pluginHeadExtra, hasEvents);
|
|
49726
|
+
const buildId3 = emittedAssets.map((a) => a.hash).join("-");
|
|
49727
|
+
manifest.buildId = buildId3.slice(0, 32);
|
|
49728
|
+
manifest.veskVersion = JSON.parse(readFileSync21(join15(PACKAGES_DIR_SELF(), "package.json"), "utf-8")).version;
|
|
49729
|
+
manifest.assets = {
|
|
49730
|
+
hashed,
|
|
49731
|
+
client: { file: clientFileName, url: clientUrl, hash: clientAsset.hash, bytes: clientAsset.bytes, integrity: clientAsset.integrity },
|
|
49732
|
+
chunks: emittedAssets.slice(1).map((a) => ({ file: a.fileName, hash: a.hash, bytes: a.bytes, integrity: a.integrity }))
|
|
49733
|
+
};
|
|
49506
49734
|
writeFileSync12(resolve21(outDir, "config.json"), JSON.stringify(manifest, null, 2) + "\n", "utf-8");
|
|
49507
49735
|
console.error("vesk build: config \u2192 config.json");
|
|
49508
49736
|
{
|
|
@@ -49552,7 +49780,7 @@ init_seo_audit();
|
|
|
49552
49780
|
|
|
49553
49781
|
// src/dev-server.ts
|
|
49554
49782
|
import { readFileSync as readFileSync38, watch, statSync as statSync21, existsSync as existsSync42, readdirSync as readdirSync13 } from "node:fs";
|
|
49555
|
-
import { resolve as resolve38, extname as extname8, join as
|
|
49783
|
+
import { resolve as resolve38, extname as extname8, join as join26, dirname as dirname26 } from "node:path";
|
|
49556
49784
|
import { createServer as createServer2 } from "node:http";
|
|
49557
49785
|
import { WebSocketServer as WebSocketServer2 } from "ws";
|
|
49558
49786
|
|
|
@@ -52202,7 +52430,7 @@ init_tokens();
|
|
|
52202
52430
|
init_scan();
|
|
52203
52431
|
init_strip_ts();
|
|
52204
52432
|
import { readdirSync as readdirSync7, statSync as statSync12, existsSync as existsSync23, readFileSync as readFileSync22 } from "fs";
|
|
52205
|
-
import { join as
|
|
52433
|
+
import { join as join16, relative as relative5, basename as basename4 } from "path";
|
|
52206
52434
|
function collapseSlashes2(p) {
|
|
52207
52435
|
let out = "";
|
|
52208
52436
|
let prevSlash = false;
|
|
@@ -52305,7 +52533,7 @@ function scanComponents(componentsDir) {
|
|
|
52305
52533
|
return;
|
|
52306
52534
|
}
|
|
52307
52535
|
for (const entry of entries) {
|
|
52308
|
-
const full =
|
|
52536
|
+
const full = join16(dir, entry);
|
|
52309
52537
|
let stat;
|
|
52310
52538
|
try {
|
|
52311
52539
|
stat = statSync12(full);
|
|
@@ -52386,7 +52614,7 @@ function scanDirectory(rootDir, dir, parentPath, options) {
|
|
|
52386
52614
|
continue;
|
|
52387
52615
|
}
|
|
52388
52616
|
}
|
|
52389
|
-
let segName =
|
|
52617
|
+
let segName = basename4(dir);
|
|
52390
52618
|
let isGroup = segName.startsWith("(") && segName.endsWith(")");
|
|
52391
52619
|
let isDynamic = segName.startsWith("[") && segName.endsWith("]") && !segName.startsWith("[...");
|
|
52392
52620
|
let isCatchAll = segName.startsWith("[...") && segName.endsWith("]");
|
|
@@ -52406,7 +52634,7 @@ function scanDirectory(rootDir, dir, parentPath, options) {
|
|
|
52406
52634
|
seg = segName;
|
|
52407
52635
|
}
|
|
52408
52636
|
const fullPath = seg ? (parentPath === "/" ? "/" : parentPath + "/") + seg : parentPath || "/";
|
|
52409
|
-
const isStandalone = hasLayout ? isStandaloneLayoutFile(
|
|
52637
|
+
const isStandalone = hasLayout ? isStandaloneLayoutFile(join16(dir, "layout.vsk")) : false;
|
|
52410
52638
|
const node = {
|
|
52411
52639
|
path: seg,
|
|
52412
52640
|
fullPath: collapseSlashes2(fullPath) || "/",
|
|
@@ -52427,7 +52655,7 @@ function scanDirectory(rootDir, dir, parentPath, options) {
|
|
|
52427
52655
|
standalone: isStandalone ? true : void 0
|
|
52428
52656
|
};
|
|
52429
52657
|
for (const entry of entries) {
|
|
52430
|
-
const entryPath =
|
|
52658
|
+
const entryPath = join16(dir, entry);
|
|
52431
52659
|
let entryStat;
|
|
52432
52660
|
try {
|
|
52433
52661
|
entryStat = statSync12(entryPath);
|
|
@@ -52479,19 +52707,19 @@ function collectSources(tree) {
|
|
|
52479
52707
|
function walk9(nodes) {
|
|
52480
52708
|
for (const node of nodes) {
|
|
52481
52709
|
if (node.page)
|
|
52482
|
-
map.set(node.page,
|
|
52710
|
+
map.set(node.page, join16(node.sourceDir, "page.vsk"));
|
|
52483
52711
|
if (node.layout)
|
|
52484
|
-
map.set(node.layout,
|
|
52712
|
+
map.set(node.layout, join16(node.sourceDir, "layout.vsk"));
|
|
52485
52713
|
if (node.loading)
|
|
52486
|
-
map.set(node.loading,
|
|
52714
|
+
map.set(node.loading, join16(node.sourceDir, "loading.vsk"));
|
|
52487
52715
|
if (node.error)
|
|
52488
|
-
map.set(node.error,
|
|
52716
|
+
map.set(node.error, join16(node.sourceDir, "error.vsk"));
|
|
52489
52717
|
if (node.notFound)
|
|
52490
|
-
map.set(node.notFound,
|
|
52718
|
+
map.set(node.notFound, join16(node.sourceDir, "not-found.vsk"));
|
|
52491
52719
|
if (node.offline)
|
|
52492
|
-
map.set(node.offline,
|
|
52720
|
+
map.set(node.offline, join16(node.sourceDir, "offline.vsk"));
|
|
52493
52721
|
if (node.network)
|
|
52494
|
-
map.set(node.network,
|
|
52722
|
+
map.set(node.network, join16(node.sourceDir, "network.vsk"));
|
|
52495
52723
|
walk9(node.children);
|
|
52496
52724
|
}
|
|
52497
52725
|
}
|
|
@@ -52593,9 +52821,9 @@ function matchUrl(tree, pathname) {
|
|
|
52593
52821
|
|
|
52594
52822
|
// ../compiler/dist/api-routes.js
|
|
52595
52823
|
import { readdirSync as readdirSync8, statSync as statSync13, existsSync as existsSync24 } from "fs";
|
|
52596
|
-
import { join as
|
|
52824
|
+
import { join as join17 } from "path";
|
|
52597
52825
|
init_server_utils();
|
|
52598
|
-
function
|
|
52826
|
+
function basename5(p) {
|
|
52599
52827
|
const idx = p.lastIndexOf("/");
|
|
52600
52828
|
return idx === -1 ? p : p.slice(idx + 1);
|
|
52601
52829
|
}
|
|
@@ -52621,7 +52849,7 @@ function scanApiDir(rootDir, dir, parentPath) {
|
|
|
52621
52849
|
break;
|
|
52622
52850
|
}
|
|
52623
52851
|
}
|
|
52624
|
-
const segName =
|
|
52852
|
+
const segName = basename5(dir);
|
|
52625
52853
|
const isDynamic = segName.startsWith("[") && segName.endsWith("]") && !segName.startsWith("[...");
|
|
52626
52854
|
const isCatchAll = segName.startsWith("[...") && segName.endsWith("]");
|
|
52627
52855
|
const isPrivate = segName.startsWith("_");
|
|
@@ -52630,7 +52858,7 @@ function scanApiDir(rootDir, dir, parentPath) {
|
|
|
52630
52858
|
return nodes;
|
|
52631
52859
|
if (isRouteGroup) {
|
|
52632
52860
|
for (const entry of entries) {
|
|
52633
|
-
const entryPath =
|
|
52861
|
+
const entryPath = join17(dir, entry);
|
|
52634
52862
|
let entryStat;
|
|
52635
52863
|
try {
|
|
52636
52864
|
entryStat = statSync13(entryPath);
|
|
@@ -52660,11 +52888,11 @@ function scanApiDir(rootDir, dir, parentPath) {
|
|
|
52660
52888
|
fullPath: collapseSlashes(fullPath) || "/",
|
|
52661
52889
|
isDynamic,
|
|
52662
52890
|
isCatchAll,
|
|
52663
|
-
filePath: hasRoute && routeFileName ?
|
|
52891
|
+
filePath: hasRoute && routeFileName ? join17(dir, routeFileName) : null,
|
|
52664
52892
|
children: []
|
|
52665
52893
|
};
|
|
52666
52894
|
for (const entry of entries) {
|
|
52667
|
-
const entryPath =
|
|
52895
|
+
const entryPath = join17(dir, entry);
|
|
52668
52896
|
let entryStat;
|
|
52669
52897
|
try {
|
|
52670
52898
|
entryStat = statSync13(entryPath);
|
|
@@ -53194,11 +53422,11 @@ async function executeMiddlewareChain(chain, request, params, options = {}) {
|
|
|
53194
53422
|
|
|
53195
53423
|
// ../compiler/dist/events.js
|
|
53196
53424
|
import { existsSync as existsSync26 } from "fs";
|
|
53197
|
-
import { join as
|
|
53425
|
+
import { join as join18 } from "path";
|
|
53198
53426
|
var EVENTS_FILE_NAMES2 = ["_events.ts", "_events.js"];
|
|
53199
53427
|
function collectEventsFile2(appDir) {
|
|
53200
53428
|
for (const name of EVENTS_FILE_NAMES2) {
|
|
53201
|
-
const candidate =
|
|
53429
|
+
const candidate = join18(appDir, name);
|
|
53202
53430
|
if (existsSync26(candidate))
|
|
53203
53431
|
return candidate;
|
|
53204
53432
|
}
|
|
@@ -53230,7 +53458,7 @@ async function runEventHandlers(handlers, name, ctx2) {
|
|
|
53230
53458
|
|
|
53231
53459
|
// ../compiler/dist/md-inline.js
|
|
53232
53460
|
import { readFileSync as readFileSync23, existsSync as existsSync27 } from "node:fs";
|
|
53233
|
-
import { dirname as dirname17, join as
|
|
53461
|
+
import { dirname as dirname17, join as join19, resolve as resolve23 } from "node:path";
|
|
53234
53462
|
var MD_EXT_MARKER2 = ".md";
|
|
53235
53463
|
function looksLikeMarkdownPath2(value) {
|
|
53236
53464
|
const v = value.trim();
|
|
@@ -53307,10 +53535,10 @@ function resolveMdPath2(specifier, importerDir, roots) {
|
|
|
53307
53535
|
}
|
|
53308
53536
|
if (spec.startsWith("/")) {
|
|
53309
53537
|
for (const root3 of roots) {
|
|
53310
|
-
const pub =
|
|
53538
|
+
const pub = join19(root3, "public", spec);
|
|
53311
53539
|
if (existsSync27(pub))
|
|
53312
53540
|
return pub;
|
|
53313
|
-
const direct =
|
|
53541
|
+
const direct = join19(root3, spec);
|
|
53314
53542
|
if (existsSync27(direct))
|
|
53315
53543
|
return direct;
|
|
53316
53544
|
}
|
|
@@ -53324,7 +53552,7 @@ function guessProjectRoots2(dir) {
|
|
|
53324
53552
|
let cur = dir;
|
|
53325
53553
|
for (let i = 0; i < 6; i++) {
|
|
53326
53554
|
roots.push(cur);
|
|
53327
|
-
if (existsSync27(
|
|
53555
|
+
if (existsSync27(join19(cur, "package.json")))
|
|
53328
53556
|
break;
|
|
53329
53557
|
const parent = dirname17(cur);
|
|
53330
53558
|
if (parent === cur)
|
|
@@ -53336,7 +53564,7 @@ function guessProjectRoots2(dir) {
|
|
|
53336
53564
|
|
|
53337
53565
|
// ../adapter/dist/client-bundle.js
|
|
53338
53566
|
import { readFileSync as readFileSync24, existsSync as existsSync28, writeFileSync as writeFileSync13, unlinkSync as unlinkSync4, statSync as statSync14, rmSync as rmSync4, mkdtempSync as mkdtempSync2, mkdirSync as mkdirSync12 } from "node:fs";
|
|
53339
|
-
import { resolve as resolve24, join as
|
|
53567
|
+
import { resolve as resolve24, join as join20, dirname as dirname18, relative as relative6, sep as sep3 } from "node:path";
|
|
53340
53568
|
import { fileURLToPath as fileURLToPath6 } from "node:url";
|
|
53341
53569
|
import { tmpdir as tmpdir3 } from "node:os";
|
|
53342
53570
|
|
|
@@ -53419,8 +53647,8 @@ function findRuntimeSrc3(appDir) {
|
|
|
53419
53647
|
resolve24(appDir, "node_modules", "@vesk/runtime")
|
|
53420
53648
|
];
|
|
53421
53649
|
for (const base of candidates) {
|
|
53422
|
-
for (const dir of [base,
|
|
53423
|
-
if (existsSync28(
|
|
53650
|
+
for (const dir of [base, join20(base, "dist")]) {
|
|
53651
|
+
if (existsSync28(join20(dir, "index-client.js")))
|
|
53424
53652
|
return dir;
|
|
53425
53653
|
}
|
|
53426
53654
|
}
|
|
@@ -54036,9 +54264,11 @@ async function generateClientBundle2(routeTree, appDir, componentMap, options) {
|
|
|
54036
54264
|
}, annotate2 = function(nodes) {
|
|
54037
54265
|
for (const node of nodes) {
|
|
54038
54266
|
const chunkName = `page-${buildChunkName(node)}.js`;
|
|
54039
|
-
const
|
|
54040
|
-
if (
|
|
54041
|
-
|
|
54267
|
+
const emitted = chunks.find((c) => c.name === chunkName && c.code.trim());
|
|
54268
|
+
if (emitted) {
|
|
54269
|
+
const fileName = options?.hmr ? chunkName : hashedName(chunkName, emitted.code);
|
|
54270
|
+
node.chunk = `/_vesk/static/${fileName}`;
|
|
54271
|
+
}
|
|
54042
54272
|
annotate2(node.children || []);
|
|
54043
54273
|
}
|
|
54044
54274
|
};
|
|
@@ -54070,8 +54300,8 @@ ${body}
|
|
|
54070
54300
|
continue;
|
|
54071
54301
|
let finalCode;
|
|
54072
54302
|
if (entry.imports) {
|
|
54073
|
-
const tmpBase = mkdtempSync2(
|
|
54074
|
-
const tmpFile =
|
|
54303
|
+
const tmpBase = mkdtempSync2(join20(resolve24(appDir, ".."), "tmp-vesk-chunk-"));
|
|
54304
|
+
const tmpFile = join20(tmpBase, "entry.js");
|
|
54075
54305
|
const toBundle = `const __components = globalThis.__components || (globalThis.__components = {});
|
|
54076
54306
|
const __hydrators = globalThis.__hydrators || (globalThis.__hydrators = {});
|
|
54077
54307
|
${entry.code}
|
|
@@ -54223,7 +54453,7 @@ function buildRuntimeCode2(runtimeDir) {
|
|
|
54223
54453
|
];
|
|
54224
54454
|
let code = "";
|
|
54225
54455
|
for (const f of runtimeFiles) {
|
|
54226
|
-
const p =
|
|
54456
|
+
const p = join20(runtimeDir, f);
|
|
54227
54457
|
if (existsSync28(p)) {
|
|
54228
54458
|
let src2 = readFileSync24(p, "utf-8");
|
|
54229
54459
|
src2 = stripTypes2(src2);
|
|
@@ -54237,7 +54467,7 @@ ${src2}
|
|
|
54237
54467
|
`;
|
|
54238
54468
|
}
|
|
54239
54469
|
}
|
|
54240
|
-
const indexSrc = readFileSync24(
|
|
54470
|
+
const indexSrc = readFileSync24(join20(runtimeDir, "index-client.js"), "utf-8");
|
|
54241
54471
|
const exportNames = stripTypes2(indexSrc).match(/export\s*\{\s*([^}]+)\s*\}\s*from/g)?.flatMap((m) => m.replace(/export\s*\{\s*|\s*\}\s*from/g, "").split(",").map((s) => s.trim())) || [];
|
|
54242
54472
|
code += "// --- exports ---\n";
|
|
54243
54473
|
for (const name of [...new Set(exportNames)]) {
|
|
@@ -54248,7 +54478,7 @@ ${src2}
|
|
|
54248
54478
|
return code;
|
|
54249
54479
|
}
|
|
54250
54480
|
function runtimeExportNames2(runtimeDir) {
|
|
54251
|
-
const indexSrc = readFileSync24(
|
|
54481
|
+
const indexSrc = readFileSync24(join20(runtimeDir, "index-client.js"), "utf-8");
|
|
54252
54482
|
const names = /* @__PURE__ */ new Set();
|
|
54253
54483
|
for (const m of indexSrc.matchAll(/export\s*\{([^}]+)\}\s*from/g)) {
|
|
54254
54484
|
for (const raw2 of m[1].split(",")) {
|
|
@@ -54264,7 +54494,7 @@ function esbuildPath2(p) {
|
|
|
54264
54494
|
return sep3 === "/" ? p : p.split(sep3).join("/");
|
|
54265
54495
|
}
|
|
54266
54496
|
function runtimeTreeShakeEntry2() {
|
|
54267
|
-
return
|
|
54497
|
+
return join20(tmpdir3(), "vesk-runtime-tree-shake", RUNTIME_ENTRY2);
|
|
54268
54498
|
}
|
|
54269
54499
|
var treeShakeQueue2 = Promise.resolve();
|
|
54270
54500
|
function buildTreeShakenRuntime2(runtimeDir, usedNames) {
|
|
@@ -54281,7 +54511,7 @@ async function buildTreeShakenRuntimeNow2(runtimeDir, usedNames) {
|
|
|
54281
54511
|
return buildRuntimeCode2(runtimeDir);
|
|
54282
54512
|
}
|
|
54283
54513
|
const entry = runtimeTreeShakeEntry2();
|
|
54284
|
-
const indexClient = esbuildPath2(
|
|
54514
|
+
const indexClient = esbuildPath2(join20(runtimeDir, "index-client.js"));
|
|
54285
54515
|
try {
|
|
54286
54516
|
try {
|
|
54287
54517
|
mkdirSync12(dirname18(entry), { recursive: true });
|
|
@@ -54520,7 +54750,7 @@ import { resolve as resolve28 } from "node:path";
|
|
|
54520
54750
|
// ../adapter/dist/plugins.js
|
|
54521
54751
|
init_paths();
|
|
54522
54752
|
import { readFileSync as readFileSync26, writeFileSync as writeFileSync14, existsSync as existsSync30, mkdirSync as mkdirSync13, statSync as statSync16 } from "node:fs";
|
|
54523
|
-
import { resolve as resolve26, dirname as dirname19, join as
|
|
54753
|
+
import { resolve as resolve26, dirname as dirname19, join as join21, extname as extname7, basename as basename6 } from "node:path";
|
|
54524
54754
|
import { createRequire as createRequire6 } from "node:module";
|
|
54525
54755
|
import { spawn as spawn2 } from "node:child_process";
|
|
54526
54756
|
var PLUGIN_STATE_FILENAME2 = "plugins.json";
|
|
@@ -54580,13 +54810,13 @@ function resolvePackage2(appDir, pkg) {
|
|
|
54580
54810
|
const seen = /* @__PURE__ */ new Set();
|
|
54581
54811
|
while (cur && cur !== dirname19(cur) && !seen.has(cur)) {
|
|
54582
54812
|
seen.add(cur);
|
|
54583
|
-
const candidate =
|
|
54813
|
+
const candidate = join21(cur, "package.json");
|
|
54584
54814
|
if (existsSync30(candidate)) {
|
|
54585
54815
|
pkgJsonPath = candidate;
|
|
54586
54816
|
break;
|
|
54587
54817
|
}
|
|
54588
54818
|
const parent = dirname19(cur);
|
|
54589
|
-
if (parent !== cur &&
|
|
54819
|
+
if (parent !== cur && basename6(cur) === "node_modules")
|
|
54590
54820
|
break;
|
|
54591
54821
|
cur = parent;
|
|
54592
54822
|
}
|
|
@@ -54609,7 +54839,7 @@ function resolvePackage2(appDir, pkg) {
|
|
|
54609
54839
|
}
|
|
54610
54840
|
}
|
|
54611
54841
|
if (localPath) {
|
|
54612
|
-
const localJson =
|
|
54842
|
+
const localJson = join21(localPath, "package.json");
|
|
54613
54843
|
let json = null;
|
|
54614
54844
|
if (existsSync30(localJson)) {
|
|
54615
54845
|
json = readJsonFile2(localJson);
|
|
@@ -55497,7 +55727,7 @@ var __internals2 = {
|
|
|
55497
55727
|
// ../adapter/dist/dev-config.js
|
|
55498
55728
|
import { existsSync as existsSync31, readFileSync as readFileSync27, writeFileSync as writeFileSync15, mkdirSync as mkdirSync14, mkdtempSync as mkdtempSync3, rmSync as rmSync5 } from "node:fs";
|
|
55499
55729
|
import { tmpdir as tmpdir4 } from "node:os";
|
|
55500
|
-
import { resolve as resolve27, dirname as dirname20, join as
|
|
55730
|
+
import { resolve as resolve27, dirname as dirname20, join as join22 } from "node:path";
|
|
55501
55731
|
init_parser();
|
|
55502
55732
|
function findConfigFile2(projectDir) {
|
|
55503
55733
|
const ts9 = resolve27(projectDir, "vesk.config.ts");
|
|
@@ -55525,9 +55755,9 @@ async function parseConfigSource(source, isTs, projectDir) {
|
|
|
55525
55755
|
js = `const { defineConfig, definePlugin, preset } = globalThis.__vesk_inject;
|
|
55526
55756
|
` + js;
|
|
55527
55757
|
}
|
|
55528
|
-
const base = projectDir ? (mkdirSync14(
|
|
55529
|
-
const dir = base ? mkdtempSync3(
|
|
55530
|
-
const tmpFile =
|
|
55758
|
+
const base = projectDir ? (mkdirSync14(join22(projectDir, ".vesk"), { recursive: true }), join22(projectDir, ".vesk")) : void 0;
|
|
55759
|
+
const dir = base ? mkdtempSync3(join22(base, "cfg-")) : mkdtempSync3(join22(tmpdir4(), "vesk-cfg-"));
|
|
55760
|
+
const tmpFile = join22(dir, "config.mjs");
|
|
55531
55761
|
try {
|
|
55532
55762
|
writeFileSync15(tmpFile, js, "utf-8");
|
|
55533
55763
|
globalThis.__vesk_inject = {
|
|
@@ -56837,7 +57067,7 @@ function produceDiagnostics(input) {
|
|
|
56837
57067
|
|
|
56838
57068
|
// ../agentic/dist/checkpoints.js
|
|
56839
57069
|
import { existsSync as existsSync33, mkdirSync as mkdirSync15, readFileSync as readFileSync29, writeFileSync as writeFileSync16, statSync as statSync18, unlinkSync as unlinkSync5, rmSync as rmSync6, renameSync } from "node:fs";
|
|
56840
|
-
import { join as
|
|
57070
|
+
import { join as join23, resolve as resolve29, dirname as dirname21, sep as sep5 } from "node:path";
|
|
56841
57071
|
import { randomUUID as nodeRandomUUID } from "node:crypto";
|
|
56842
57072
|
function generateId() {
|
|
56843
57073
|
try {
|
|
@@ -56970,16 +57200,16 @@ var CheckpointManager = class {
|
|
|
56970
57200
|
}
|
|
56971
57201
|
};
|
|
56972
57202
|
function getAgenticDir(projectDir) {
|
|
56973
|
-
return
|
|
57203
|
+
return join23(resolve29(projectDir), ".vesk", "agentic");
|
|
56974
57204
|
}
|
|
56975
57205
|
function getHistoryPath(projectDir) {
|
|
56976
|
-
return
|
|
57206
|
+
return join23(getAgenticDir(projectDir), "history.json");
|
|
56977
57207
|
}
|
|
56978
57208
|
function getCheckpointDir(projectDir, id) {
|
|
56979
|
-
return
|
|
57209
|
+
return join23(getAgenticDir(projectDir), "checkpoints", id);
|
|
56980
57210
|
}
|
|
56981
57211
|
function getCheckpointPath(projectDir, id) {
|
|
56982
|
-
return
|
|
57212
|
+
return join23(getCheckpointDir(projectDir, id), "checkpoint.json");
|
|
56983
57213
|
}
|
|
56984
57214
|
function ensureDir(dir) {
|
|
56985
57215
|
mkdirSync15(dir, { recursive: true });
|
|
@@ -57059,7 +57289,7 @@ function createCheckpoint(projectDir, message, changes = {}, buildResult) {
|
|
|
57059
57289
|
};
|
|
57060
57290
|
const agenticDir = getAgenticDir(projectDir);
|
|
57061
57291
|
ensureDir(agenticDir);
|
|
57062
|
-
ensureDir(
|
|
57292
|
+
ensureDir(join23(agenticDir, "checkpoints"));
|
|
57063
57293
|
const cpDir = getCheckpointDir(projectDir, id);
|
|
57064
57294
|
ensureDir(cpDir);
|
|
57065
57295
|
writeJsonAtomic(getCheckpointPath(projectDir, id), checkpoint);
|
|
@@ -58564,7 +58794,7 @@ var Agent = class {
|
|
|
58564
58794
|
|
|
58565
58795
|
// ../agentic/dist/tools/vesk.js
|
|
58566
58796
|
import { existsSync as existsSync36, readFileSync as readFileSync32, writeFileSync as writeFileSync18, mkdirSync as mkdirSync17, readdirSync as readdirSync10, statSync as statSync19 } from "node:fs";
|
|
58567
|
-
import { resolve as resolve32, join as
|
|
58797
|
+
import { resolve as resolve32, join as join24, dirname as dirname23, sep as sep6 } from "node:path";
|
|
58568
58798
|
function resolveWithin3(baseDir, relPath) {
|
|
58569
58799
|
const base = resolve32(baseDir);
|
|
58570
58800
|
const target = resolve32(baseDir, relPath);
|
|
@@ -58626,7 +58856,7 @@ function findConfigFile3(projectDir) {
|
|
|
58626
58856
|
return { path: null, isTs: false };
|
|
58627
58857
|
}
|
|
58628
58858
|
function checkpointDir(veskDir) {
|
|
58629
|
-
return
|
|
58859
|
+
return join24(resolve32(veskDir), "checkpoints");
|
|
58630
58860
|
}
|
|
58631
58861
|
function findMatchingBrace2(src2, openIdx) {
|
|
58632
58862
|
let inStr = null;
|
|
@@ -59241,7 +59471,7 @@ function createVeskTools(deps) {
|
|
|
59241
59471
|
const dir = checkpointDir(veskDir);
|
|
59242
59472
|
mkdirSync17(dir, { recursive: true });
|
|
59243
59473
|
const id = `${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 8)}`;
|
|
59244
|
-
const file =
|
|
59474
|
+
const file = join24(dir, `${id}.json`);
|
|
59245
59475
|
const check = resolveWithin3(dir, `${id}.json`);
|
|
59246
59476
|
if (!check)
|
|
59247
59477
|
return jsonError("path escapes project root");
|
|
@@ -59290,7 +59520,7 @@ function createVeskTools(deps) {
|
|
|
59290
59520
|
} catch {
|
|
59291
59521
|
}
|
|
59292
59522
|
const dir = checkpointDir(veskDir);
|
|
59293
|
-
const file =
|
|
59523
|
+
const file = join24(dir, `${checkpointId}.json`);
|
|
59294
59524
|
const contained = resolveWithin3(dir, `${checkpointId}.json`);
|
|
59295
59525
|
if (!contained)
|
|
59296
59526
|
return jsonError("path escapes project root");
|
|
@@ -60013,7 +60243,7 @@ function renderDevErrorPage(payload, opts) {
|
|
|
60013
60243
|
import { spawnSync as spawnSync2 } from "node:child_process";
|
|
60014
60244
|
import { cpSync as cpSync2, existsSync as existsSync40, mkdirSync as mkdirSync18, readFileSync as readFileSync36, readdirSync as readdirSync11, statSync as statSync20, writeFileSync as writeFileSync20 } from "node:fs";
|
|
60015
60245
|
import { createRequire as createRequire7 } from "node:module";
|
|
60016
|
-
import { dirname as dirname25, join as
|
|
60246
|
+
import { dirname as dirname25, join as join25, resolve as resolve36 } from "node:path";
|
|
60017
60247
|
import { fileURLToPath as fileURLToPath8 } from "node:url";
|
|
60018
60248
|
var require2 = createRequire7(import.meta.url);
|
|
60019
60249
|
var __dirname9 = dirname25(fileURLToPath8(import.meta.url));
|
|
@@ -60037,12 +60267,14 @@ var PACKAGES = {
|
|
|
60037
60267
|
// vesk.config.ts imports them, so their dist must exist for e2e/dev
|
|
60038
60268
|
// servers on fresh checkouts (CI).
|
|
60039
60269
|
"plugin-pwa": { name: "@vesk/plugin-pwa", entry: "index" },
|
|
60040
|
-
"plugin-tailwind": { name: "@vesk/plugin-tailwind", entry: "index" }
|
|
60270
|
+
"plugin-tailwind": { name: "@vesk/plugin-tailwind", entry: "index" },
|
|
60271
|
+
// testing last — it depends on the compiler.
|
|
60272
|
+
testing: { name: "@vesk/testing", entry: "index" }
|
|
60041
60273
|
};
|
|
60042
60274
|
function newestSourceMtime(srcDir) {
|
|
60043
60275
|
let newest = 0;
|
|
60044
60276
|
for (const name of readdirSync11(srcDir)) {
|
|
60045
|
-
const p =
|
|
60277
|
+
const p = join25(srcDir, name);
|
|
60046
60278
|
const st = statSync20(p);
|
|
60047
60279
|
if (st.isDirectory()) {
|
|
60048
60280
|
newest = Math.max(newest, newestSourceMtime(p));
|
|
@@ -60053,11 +60285,11 @@ function newestSourceMtime(srcDir) {
|
|
|
60053
60285
|
return newest;
|
|
60054
60286
|
}
|
|
60055
60287
|
function distStale(pkgDir, entry) {
|
|
60056
|
-
const distIndex =
|
|
60288
|
+
const distIndex = join25(pkgDir, "dist", `${entry}.js`);
|
|
60057
60289
|
if (!existsSync40(distIndex)) return true;
|
|
60058
|
-
const distPkg =
|
|
60290
|
+
const distPkg = join25(pkgDir, "dist", "package.json");
|
|
60059
60291
|
const distStamp = Math.max(statSync20(distIndex).mtimeMs, existsSync40(distPkg) ? statSync20(distPkg).mtimeMs : 0);
|
|
60060
|
-
return newestSourceMtime(
|
|
60292
|
+
return newestSourceMtime(join25(pkgDir, "src")) > distStamp;
|
|
60061
60293
|
}
|
|
60062
60294
|
function distPackageJson(pkgName, entry, serverEntry, version2) {
|
|
60063
60295
|
const exports = {
|
|
@@ -60081,23 +60313,23 @@ function distPackageJson(pkgName, entry, serverEntry, version2) {
|
|
|
60081
60313
|
function buildPackages(force = false) {
|
|
60082
60314
|
for (const [pkg, cfg] of Object.entries(PACKAGES)) {
|
|
60083
60315
|
const pkgDir = resolve36(root2, "packages", pkg);
|
|
60084
|
-
if (!existsSync40(
|
|
60316
|
+
if (!existsSync40(join25(pkgDir, "src"))) continue;
|
|
60085
60317
|
if (!force && !distStale(pkgDir, cfg.entry)) continue;
|
|
60086
60318
|
console.log(`[build] ${cfg.name} -> tsc`);
|
|
60087
60319
|
const tscBin = require2.resolve("typescript/bin/tsc");
|
|
60088
|
-
const result = spawnSync2(process.execPath, [tscBin, "-p",
|
|
60320
|
+
const result = spawnSync2(process.execPath, [tscBin, "-p", join25(pkgDir, "tsconfig.build.json")], {
|
|
60089
60321
|
stdio: "inherit"
|
|
60090
60322
|
});
|
|
60091
60323
|
if (result.status !== 0) {
|
|
60092
60324
|
throw new Error(`tsc failed for ${cfg.name}`);
|
|
60093
60325
|
}
|
|
60094
|
-
const distDir =
|
|
60326
|
+
const distDir = join25(pkgDir, "dist");
|
|
60095
60327
|
for (const c of cfg.copy || []) {
|
|
60096
|
-
const to =
|
|
60328
|
+
const to = join25(distDir, c.to);
|
|
60097
60329
|
mkdirSync18(dirname25(to), { recursive: true });
|
|
60098
|
-
cpSync2(
|
|
60330
|
+
cpSync2(join25(pkgDir, c.from), to, { recursive: true });
|
|
60099
60331
|
}
|
|
60100
|
-
const srcPkg = JSON.parse(readFileSync36(
|
|
60332
|
+
const srcPkg = JSON.parse(readFileSync36(join25(pkgDir, "package.json"), "utf-8"));
|
|
60101
60333
|
if (pkg === "lucide-vesk") {
|
|
60102
60334
|
const lucideDistPkg = {
|
|
60103
60335
|
name: srcPkg.name,
|
|
@@ -60111,9 +60343,9 @@ function buildPackages(force = false) {
|
|
|
60111
60343
|
"./package.json": "./package.json"
|
|
60112
60344
|
}
|
|
60113
60345
|
};
|
|
60114
|
-
writeFileSync20(
|
|
60346
|
+
writeFileSync20(join25(distDir, "package.json"), JSON.stringify(lucideDistPkg, null, 2) + "\n");
|
|
60115
60347
|
} else {
|
|
60116
|
-
writeFileSync20(
|
|
60348
|
+
writeFileSync20(join25(distDir, "package.json"), distPackageJson(cfg.name, cfg.entry, cfg.serverEntry, srcPkg.version || "1.0.0"));
|
|
60117
60349
|
}
|
|
60118
60350
|
console.log(`[build] ${cfg.name} -> dist`);
|
|
60119
60351
|
}
|
|
@@ -60590,9 +60822,9 @@ function resolveRuntimeDir(projectDir) {
|
|
|
60590
60822
|
resolve38(import.meta.dirname ?? ".", "..", "..", "runtime", "dist")
|
|
60591
60823
|
];
|
|
60592
60824
|
for (const dir of candidates) {
|
|
60593
|
-
if (existsSync42(
|
|
60594
|
-
const distDir =
|
|
60595
|
-
if (existsSync42(
|
|
60825
|
+
if (existsSync42(join26(dir, "ripple-runtime.js"))) return dir;
|
|
60826
|
+
const distDir = join26(dir, "dist");
|
|
60827
|
+
if (existsSync42(join26(distDir, "ripple-runtime.js"))) return distDir;
|
|
60596
60828
|
}
|
|
60597
60829
|
return null;
|
|
60598
60830
|
}
|
|
@@ -60832,7 +61064,7 @@ function countFilesNamed(dir, name) {
|
|
|
60832
61064
|
if (!existsSync42(dir)) return 0;
|
|
60833
61065
|
let n = 0;
|
|
60834
61066
|
for (const entry of readdirSync13(dir, { withFileTypes: true })) {
|
|
60835
|
-
const p =
|
|
61067
|
+
const p = join26(dir, entry.name);
|
|
60836
61068
|
if (entry.isDirectory()) n += countFilesNamed(p, name);
|
|
60837
61069
|
else if (entry.name === name) n++;
|
|
60838
61070
|
}
|
|
@@ -60875,7 +61107,7 @@ async function startDevServer(port, projectDir, config, host) {
|
|
|
60875
61107
|
process.exit(1);
|
|
60876
61108
|
}
|
|
60877
61109
|
const runtimeDir = runtimeDirUnchecked;
|
|
60878
|
-
const veskStateDir =
|
|
61110
|
+
const veskStateDir = join26(projectDir, ".vesk");
|
|
60879
61111
|
const configPluginsRaw = config.plugins || [];
|
|
60880
61112
|
const configPluginNames = configPluginsRaw.map((p) => typeof p === "string" ? p : p?.name).filter((n) => !!n);
|
|
60881
61113
|
const rawDevPlugins = config.plugins || [];
|
|
@@ -60974,10 +61206,10 @@ async function startDevServer(port, projectDir, config, host) {
|
|
|
60974
61206
|
}
|
|
60975
61207
|
let devGlobalCssContent = "";
|
|
60976
61208
|
let lastServedCssGlobal = "";
|
|
60977
|
-
const appCssPath =
|
|
60978
|
-
const srcDir =
|
|
60979
|
-
const cssPath =
|
|
60980
|
-
const altCssPath =
|
|
61209
|
+
const appCssPath = join26(appDirPath, "global.css");
|
|
61210
|
+
const srcDir = join26(projectDir, "src");
|
|
61211
|
+
const cssPath = join26(srcDir, "global.css");
|
|
61212
|
+
const altCssPath = join26(srcDir, "app.css");
|
|
60981
61213
|
let rawCss = "";
|
|
60982
61214
|
let devCssSource = "";
|
|
60983
61215
|
if (existsSync42(appCssPath)) {
|
|
@@ -61264,7 +61496,7 @@ async function startDevServer(port, projectDir, config, host) {
|
|
|
61264
61496
|
if (!filename) return;
|
|
61265
61497
|
const kind = classifyHmrWatchPath(filename);
|
|
61266
61498
|
if (kind === "ignored") return;
|
|
61267
|
-
const fullPath = filename.startsWith("/") ? filename :
|
|
61499
|
+
const fullPath = filename.startsWith("/") ? filename : join26(watchDir, filename);
|
|
61268
61500
|
const fileExists = existsSync42(fullPath);
|
|
61269
61501
|
const bcast = (msg) => {
|
|
61270
61502
|
const f = globalThis.__vesk_broadcastHmr;
|
|
@@ -61479,8 +61711,8 @@ Object.defineProperty(__components, ${JSON.stringify(cname)}, { get: () => __com
|
|
|
61479
61711
|
".json": "application/json",
|
|
61480
61712
|
".webmanifest": "application/manifest+json"
|
|
61481
61713
|
};
|
|
61482
|
-
const hmrJsPath =
|
|
61483
|
-
const hmrTsPath =
|
|
61714
|
+
const hmrJsPath = join26(runtimeDir, "hmr-client.js");
|
|
61715
|
+
const hmrTsPath = join26(runtimeDir, "hmr-client.ts");
|
|
61484
61716
|
const hmrClientPath = existsSync42(hmrJsPath) ? hmrJsPath : existsSync42(hmrTsPath) ? hmrTsPath : null;
|
|
61485
61717
|
function extractCompName2(src2) {
|
|
61486
61718
|
return resolveComponentName(src2);
|
|
@@ -61652,7 +61884,7 @@ Object.defineProperty(__components, ${JSON.stringify(cname)}, { get: () => __com
|
|
|
61652
61884
|
return;
|
|
61653
61885
|
}
|
|
61654
61886
|
const mwChain = collectMiddlewareChain(routeTree, url.pathname, appDirPath);
|
|
61655
|
-
const apiDirPath =
|
|
61887
|
+
const apiDirPath = join26(appDirPath, "api");
|
|
61656
61888
|
if (url.pathname.startsWith("/api") && existsSync42(apiDirPath)) {
|
|
61657
61889
|
const apiRoutes = await scanApiRoutes(apiDirPath);
|
|
61658
61890
|
const apiMatch = matchApiUrl(apiRoutes, req.url || url.pathname);
|
|
@@ -62144,7 +62376,7 @@ ${prettifyHtml(body)}
|
|
|
62144
62376
|
LOG.ok(`dev server at http://localhost:${port} (listening on ${bindHost})`);
|
|
62145
62377
|
const routes = collectRoutePaths(routeTree);
|
|
62146
62378
|
const pageCount = countPages(routeTree);
|
|
62147
|
-
const apiCount = countFilesNamed(
|
|
62379
|
+
const apiCount = countFilesNamed(join26(appDirPath, "api"), "route.ts");
|
|
62148
62380
|
LOG.info(`${projectDir}`);
|
|
62149
62381
|
LOG.info(`${pageCount} page${pageCount === 1 ? "" : "s"}: ${routes.join(", ") || "(none)"}`);
|
|
62150
62382
|
if (apiCount > 0) LOG.info(`${apiCount} api route${apiCount === 1 ? "" : "s"} (app/api)`);
|
|
@@ -62458,8 +62690,8 @@ if (args.length === 0 || args.includes("--help") || args.includes("-h")) {
|
|
|
62458
62690
|
}
|
|
62459
62691
|
function loadEnvFiles(projectDir) {
|
|
62460
62692
|
const files = [
|
|
62461
|
-
|
|
62462
|
-
|
|
62693
|
+
join30(projectDir, ".env"),
|
|
62694
|
+
join30(projectDir, ".env.local")
|
|
62463
62695
|
];
|
|
62464
62696
|
for (const filePath of files) {
|
|
62465
62697
|
if (!existsSync45(filePath)) continue;
|
|
@@ -62630,7 +62862,7 @@ if (cmd === "start") {
|
|
|
62630
62862
|
if (cmd === "init") {
|
|
62631
62863
|
const projectDir = process.cwd();
|
|
62632
62864
|
const { appDir: appDirPath } = resolveProjectDirs(projectDir, await loadConfig(projectDir) || {});
|
|
62633
|
-
const target =
|
|
62865
|
+
const target = join30(appDirPath, "global.css");
|
|
62634
62866
|
if (existsSync45(target)) {
|
|
62635
62867
|
console.error(`vesk init: ${target} already exists \u2014 skipping`);
|
|
62636
62868
|
process.exit(0);
|
|
@@ -62651,7 +62883,7 @@ if (cmd === "migrate") {
|
|
|
62651
62883
|
const projectDir = process.cwd();
|
|
62652
62884
|
const { runMigrate: runMigrate2 } = await Promise.resolve().then(() => (init_migrate(), migrate_exports));
|
|
62653
62885
|
const { CODEMODS: CODEMODS2 } = await Promise.resolve().then(() => (init_codemods(), codemods_exports));
|
|
62654
|
-
const { version: cliVersion } = JSON.parse(readFileSync42(
|
|
62886
|
+
const { version: cliVersion } = JSON.parse(readFileSync42(join30(__dirname10, "..", "package.json"), "utf-8"));
|
|
62655
62887
|
if (args.includes("--list")) {
|
|
62656
62888
|
console.error("vesk migrate: available codemods");
|
|
62657
62889
|
for (const c of CODEMODS2) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vesk/vesk-cli",
|
|
3
|
-
"version": "0.2.50-canary.
|
|
3
|
+
"version": "0.2.50-canary.4",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Vesk — compiler-first framework for the post-VDOM web. vesk dev, vesk build.",
|
|
6
6
|
"bin": {
|
|
@@ -8,10 +8,10 @@
|
|
|
8
8
|
},
|
|
9
9
|
"main": "./dist/cli.js",
|
|
10
10
|
"dependencies": {
|
|
11
|
-
"@vesk/adapter": "^0.2.50-canary.
|
|
12
|
-
"@vesk/compiler": "^0.2.50-canary.
|
|
13
|
-
"@vesk/plugin-tailwind": "^0.2.50-canary.
|
|
14
|
-
"@vesk/runtime": "^0.2.50-canary.
|
|
11
|
+
"@vesk/adapter": "^0.2.50-canary.4",
|
|
12
|
+
"@vesk/compiler": "^0.2.50-canary.4",
|
|
13
|
+
"@vesk/plugin-tailwind": "^0.2.50-canary.4",
|
|
14
|
+
"@vesk/runtime": "^0.2.50-canary.4",
|
|
15
15
|
"esrap": "^2.3.0",
|
|
16
16
|
"typescript": "^5.8.0",
|
|
17
17
|
"ws": "^8.18.0",
|