@vesk/vesk-cli 0.2.45 → 0.2.47
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 +341 -188
- package/package.json +5 -5
package/dist/cli.js
CHANGED
|
@@ -18608,6 +18608,13 @@ function preprocessForClauses(source) {
|
|
|
18608
18608
|
function createBaseParser() {
|
|
18609
18609
|
return Parser.extend(tsPlugin({}), VeskParserPlugin());
|
|
18610
18610
|
}
|
|
18611
|
+
function parseGeneratedJs(source) {
|
|
18612
|
+
try {
|
|
18613
|
+
return parse3(source, { ecmaVersion: "latest", sourceType: "module" });
|
|
18614
|
+
} catch {
|
|
18615
|
+
return null;
|
|
18616
|
+
}
|
|
18617
|
+
}
|
|
18611
18618
|
function parse4(source, options = {}) {
|
|
18612
18619
|
const ParserClass = createBaseParser();
|
|
18613
18620
|
const { code, annotations } = preprocessForClauses(blankComments(source));
|
|
@@ -19038,14 +19045,40 @@ function depsFresh(cachedVal) {
|
|
|
19038
19045
|
}
|
|
19039
19046
|
return true;
|
|
19040
19047
|
}
|
|
19041
|
-
function
|
|
19048
|
+
function evict(cache2) {
|
|
19049
|
+
if (cache2.size <= BUILD_CACHE_MAX) return;
|
|
19050
|
+
let dropped = 0;
|
|
19051
|
+
for (const key of cache2.keys()) {
|
|
19052
|
+
cache2.delete(key);
|
|
19053
|
+
if (++dropped >= BUILD_CACHE_EVICT) break;
|
|
19054
|
+
}
|
|
19055
|
+
}
|
|
19056
|
+
function readSourceCached(absPath) {
|
|
19057
|
+
let mtimeMs;
|
|
19058
|
+
try {
|
|
19059
|
+
mtimeMs = statSync(absPath).mtimeMs;
|
|
19060
|
+
} catch {
|
|
19061
|
+
return null;
|
|
19062
|
+
}
|
|
19063
|
+
const hit = rawSourceCache.get(absPath);
|
|
19064
|
+
if (hit && hit.mtimeMs === mtimeMs) return hit.raw;
|
|
19042
19065
|
let raw2;
|
|
19043
19066
|
try {
|
|
19044
19067
|
raw2 = readFileSync2(absPath, "utf-8");
|
|
19045
|
-
} catch
|
|
19046
|
-
|
|
19068
|
+
} catch {
|
|
19069
|
+
return null;
|
|
19070
|
+
}
|
|
19071
|
+
rawSourceCache.set(absPath, { mtimeMs, raw: raw2 });
|
|
19072
|
+
evict(rawSourceCache);
|
|
19073
|
+
return raw2;
|
|
19074
|
+
}
|
|
19075
|
+
function readSsrSource(absPath) {
|
|
19076
|
+
const cachedRaw = readSourceCached(absPath);
|
|
19077
|
+
if (cachedRaw === null) {
|
|
19078
|
+
console.warn(`[vesk] SSR: failed to read ${absPath}`);
|
|
19047
19079
|
return null;
|
|
19048
19080
|
}
|
|
19081
|
+
const raw2 = cachedRaw;
|
|
19049
19082
|
let ast = null;
|
|
19050
19083
|
try {
|
|
19051
19084
|
ast = parse4(raw2, { filename: absPath });
|
|
@@ -19705,23 +19738,40 @@ function collectModuleBundled(absPath, collector) {
|
|
|
19705
19738
|
collector.modules.push({ key, code: `module.exports = ${raw2};`, dir, deps: {} });
|
|
19706
19739
|
return key;
|
|
19707
19740
|
}
|
|
19708
|
-
|
|
19709
|
-
|
|
19710
|
-
|
|
19711
|
-
|
|
19712
|
-
|
|
19741
|
+
let mtimeMs = -1;
|
|
19742
|
+
try {
|
|
19743
|
+
mtimeMs = statSync(absPath).mtimeMs;
|
|
19744
|
+
} catch {
|
|
19745
|
+
}
|
|
19746
|
+
const cached = mtimeMs >= 0 ? bundledCodeCache.get(absPath) : void 0;
|
|
19747
|
+
let code;
|
|
19748
|
+
let specifiers;
|
|
19749
|
+
if (cached && cached.mtimeMs === mtimeMs) {
|
|
19750
|
+
code = cached.code;
|
|
19751
|
+
specifiers = cached.specifiers;
|
|
19752
|
+
} else {
|
|
19753
|
+
const src2 = readSsrSource(absPath);
|
|
19754
|
+
if (!src2 || !src2.ast) {
|
|
19755
|
+
const raw2 = src2 ? src2.raw : "// unreadable during build\nmodule.exports = {};";
|
|
19756
|
+
collector.modules.push({ key, code: raw2, dir, deps: {} });
|
|
19757
|
+
return key;
|
|
19758
|
+
}
|
|
19759
|
+
let stripped = src2.ast;
|
|
19760
|
+
if (hasTsSyntax(src2.ast)) stripped = stripTsTypes(src2.ast);
|
|
19761
|
+
stripped.body = (stripped.body || []).filter((n) => n ? !isTypeOnlyStatement(n) : false);
|
|
19762
|
+
specifiers = [...collectModuleSpecifiers(src2.ast)];
|
|
19763
|
+
code = esmToCjs(stripped.body);
|
|
19764
|
+
bundledCodeCache.set(absPath, { mtimeMs, code, specifiers });
|
|
19765
|
+
evict(bundledCodeCache);
|
|
19713
19766
|
}
|
|
19714
|
-
let stripped = src2.ast;
|
|
19715
|
-
if (hasTsSyntax(src2.ast)) stripped = stripTsTypes(src2.ast);
|
|
19716
|
-
stripped.body = (stripped.body || []).filter((n) => n ? !isTypeOnlyStatement(n) : false);
|
|
19717
19767
|
const deps = {};
|
|
19718
|
-
for (const spec of
|
|
19768
|
+
for (const spec of specifiers) {
|
|
19719
19769
|
if (!isRelativeSpec(spec)) continue;
|
|
19720
19770
|
const depPath = resolveSsrModule(spec, dir);
|
|
19721
19771
|
if (!depPath) continue;
|
|
19722
19772
|
deps[spec] = collectModuleBundled(depPath, collector);
|
|
19723
19773
|
}
|
|
19724
|
-
collector.modules.push({ key, code
|
|
19774
|
+
collector.modules.push({ key, code, dir, deps });
|
|
19725
19775
|
return key;
|
|
19726
19776
|
}
|
|
19727
19777
|
function collectModuleBundle(importStrs, fromDir, collector) {
|
|
@@ -19741,7 +19791,7 @@ function collectModuleBundle(importStrs, fromDir, collector) {
|
|
|
19741
19791
|
}
|
|
19742
19792
|
return bindings;
|
|
19743
19793
|
}
|
|
19744
|
-
var RUNTIME_PREFIXES, EXTENSIONS, BUILTIN_PREFIX, BUILTIN_CACHE, MODULE_CACHE, MAX_CACHE_ENTRIES, depStack, EVALUATING, EMPTY_ALIASES, ALIAS_CACHE, exportCounter;
|
|
19794
|
+
var RUNTIME_PREFIXES, EXTENSIONS, BUILTIN_PREFIX, BUILTIN_CACHE, MODULE_CACHE, MAX_CACHE_ENTRIES, depStack, rawSourceCache, BUILD_CACHE_MAX, BUILD_CACHE_EVICT, EVALUATING, EMPTY_ALIASES, ALIAS_CACHE, exportCounter, bundledCodeCache;
|
|
19745
19795
|
var init_module_imports = __esm({
|
|
19746
19796
|
"../compiler/src/module-imports.ts"() {
|
|
19747
19797
|
"use strict";
|
|
@@ -19755,10 +19805,14 @@ var init_module_imports = __esm({
|
|
|
19755
19805
|
MODULE_CACHE = /* @__PURE__ */ new Map();
|
|
19756
19806
|
MAX_CACHE_ENTRIES = 256;
|
|
19757
19807
|
depStack = [];
|
|
19808
|
+
rawSourceCache = /* @__PURE__ */ new Map();
|
|
19809
|
+
BUILD_CACHE_MAX = 8192;
|
|
19810
|
+
BUILD_CACHE_EVICT = 2048;
|
|
19758
19811
|
EVALUATING = /* @__PURE__ */ new Map();
|
|
19759
19812
|
EMPTY_ALIASES = { exact: /* @__PURE__ */ new Map(), wildcard: [] };
|
|
19760
19813
|
ALIAS_CACHE = /* @__PURE__ */ new Map();
|
|
19761
19814
|
exportCounter = 0;
|
|
19815
|
+
bundledCodeCache = /* @__PURE__ */ new Map();
|
|
19762
19816
|
}
|
|
19763
19817
|
});
|
|
19764
19818
|
|
|
@@ -33590,7 +33644,64 @@ __export(image_pipeline_exports, {
|
|
|
33590
33644
|
});
|
|
33591
33645
|
import { mkdirSync as mkdirSync8, writeFileSync as writeFileSync9, readFileSync as readFileSync18, existsSync as existsSync18, readdirSync as readdirSync4, statSync as statSync9 } from "node:fs";
|
|
33592
33646
|
import { spawnSync } from "node:child_process";
|
|
33593
|
-
import { resolve as resolve16, extname as extname5, dirname as dirname12 } from "node:path";
|
|
33647
|
+
import { resolve as resolve16, extname as extname5, dirname as dirname12, join as join12 } from "node:path";
|
|
33648
|
+
import { createRequire as createRequire5 } from "node:module";
|
|
33649
|
+
import { tmpdir as tmpdir2 } from "node:os";
|
|
33650
|
+
function probeMemoPath() {
|
|
33651
|
+
try {
|
|
33652
|
+
const req = createRequire5(import.meta.url);
|
|
33653
|
+
const entry = req.resolve("sharp");
|
|
33654
|
+
const stamp = Math.round(statSync9(entry).mtimeMs);
|
|
33655
|
+
return join12(tmpdir2(), `vesk-sharp-probe-${process.platform}-${process.arch}-${stamp}.json`);
|
|
33656
|
+
} catch {
|
|
33657
|
+
return null;
|
|
33658
|
+
}
|
|
33659
|
+
}
|
|
33660
|
+
function readProbeMemo() {
|
|
33661
|
+
const path = probeMemoPath();
|
|
33662
|
+
if (path === null)
|
|
33663
|
+
return null;
|
|
33664
|
+
try {
|
|
33665
|
+
return JSON.parse(readFileSync18(path, "utf-8"))?.usable === true;
|
|
33666
|
+
} catch {
|
|
33667
|
+
return null;
|
|
33668
|
+
}
|
|
33669
|
+
}
|
|
33670
|
+
function writeProbeMemo(usable) {
|
|
33671
|
+
const path = probeMemoPath();
|
|
33672
|
+
if (path === null)
|
|
33673
|
+
return;
|
|
33674
|
+
try {
|
|
33675
|
+
writeFileSync9(path, JSON.stringify({ usable, at: Date.now() }), "utf-8");
|
|
33676
|
+
} catch {
|
|
33677
|
+
}
|
|
33678
|
+
}
|
|
33679
|
+
async function ensureSharp() {
|
|
33680
|
+
if (sharpProbed)
|
|
33681
|
+
return;
|
|
33682
|
+
sharpProbed = true;
|
|
33683
|
+
const memo = readProbeMemo();
|
|
33684
|
+
if (memo === false) {
|
|
33685
|
+
console.warn("vesk images: sharp unusable on this machine (cached); using copy-only image pipeline");
|
|
33686
|
+
return;
|
|
33687
|
+
}
|
|
33688
|
+
try {
|
|
33689
|
+
const probe = spawnSync(process.execPath, [
|
|
33690
|
+
"--input-type=module",
|
|
33691
|
+
"-e",
|
|
33692
|
+
"import sharp from 'sharp'; await sharp({ create: { width: 2, height: 2, channels: 3, background: 'red' } }).png().toBuffer();"
|
|
33693
|
+
], { stdio: "ignore" });
|
|
33694
|
+
if (probe.status === 0) {
|
|
33695
|
+
const mod = await import("sharp");
|
|
33696
|
+
sharpFn = mod.default;
|
|
33697
|
+
writeProbeMemo(true);
|
|
33698
|
+
} else {
|
|
33699
|
+
console.warn("vesk images: sharp native probe failed; using copy-only image pipeline");
|
|
33700
|
+
writeProbeMemo(false);
|
|
33701
|
+
}
|
|
33702
|
+
} catch {
|
|
33703
|
+
}
|
|
33704
|
+
}
|
|
33594
33705
|
async function processImage(srcPath, outDir, baseName) {
|
|
33595
33706
|
const image = sharpFn ? sharpFn(srcPath) : null;
|
|
33596
33707
|
if (!image) {
|
|
@@ -33659,13 +33770,15 @@ async function optimizeImages(appDir, outDir) {
|
|
|
33659
33770
|
console.error("vesk images: no <Image> refs found");
|
|
33660
33771
|
return [];
|
|
33661
33772
|
}
|
|
33773
|
+
await ensureSharp();
|
|
33662
33774
|
const results = [];
|
|
33663
33775
|
for (const ref2 of refs) {
|
|
33776
|
+
const rel = ref2.src.replace(/^\//, "");
|
|
33664
33777
|
const possiblePaths = [
|
|
33665
|
-
resolve16(appDir,
|
|
33666
|
-
resolve16(appDir, "..", "public",
|
|
33667
|
-
resolve16(appDir, "..", "src",
|
|
33668
|
-
resolve16(outDir, "static", "public",
|
|
33778
|
+
resolve16(appDir, rel),
|
|
33779
|
+
resolve16(appDir, "..", "public", rel),
|
|
33780
|
+
resolve16(appDir, "..", "src", rel),
|
|
33781
|
+
resolve16(outDir, "static", "public", rel)
|
|
33669
33782
|
];
|
|
33670
33783
|
let srcPath = null;
|
|
33671
33784
|
for (const p of possiblePaths) {
|
|
@@ -33695,28 +33808,15 @@ async function optimizeImages(appDir, outDir) {
|
|
|
33695
33808
|
}
|
|
33696
33809
|
return results;
|
|
33697
33810
|
}
|
|
33698
|
-
var SUPPORTED, OUTPUT_WIDTHS, FORMATS, sharpFn;
|
|
33811
|
+
var SUPPORTED, OUTPUT_WIDTHS, FORMATS, sharpFn, sharpProbed;
|
|
33699
33812
|
var init_image_pipeline = __esm({
|
|
33700
|
-
|
|
33813
|
+
"../adapter/dist/image-pipeline.js"() {
|
|
33701
33814
|
"use strict";
|
|
33702
33815
|
SUPPORTED = /* @__PURE__ */ new Set([".jpg", ".jpeg", ".png", ".webp", ".avif", ".tiff"]);
|
|
33703
33816
|
OUTPUT_WIDTHS = [640, 768, 1024, 1280, 1536];
|
|
33704
33817
|
FORMATS = ["webp", "avif"];
|
|
33705
33818
|
sharpFn = null;
|
|
33706
|
-
|
|
33707
|
-
const probe = spawnSync(process.execPath, [
|
|
33708
|
-
"--input-type=module",
|
|
33709
|
-
"-e",
|
|
33710
|
-
"import sharp from 'sharp'; await sharp({ create: { width: 2, height: 2, channels: 3, background: 'red' } }).png().toBuffer();"
|
|
33711
|
-
], { stdio: "ignore" });
|
|
33712
|
-
if (probe.status === 0) {
|
|
33713
|
-
const mod = await import("sharp");
|
|
33714
|
-
sharpFn = mod.default;
|
|
33715
|
-
} else {
|
|
33716
|
-
console.warn("vesk images: sharp native probe failed; using copy-only image pipeline");
|
|
33717
|
-
}
|
|
33718
|
-
} catch {
|
|
33719
|
-
}
|
|
33819
|
+
sharpProbed = false;
|
|
33720
33820
|
}
|
|
33721
33821
|
});
|
|
33722
33822
|
|
|
@@ -33930,7 +34030,7 @@ var init_platform = __esm({
|
|
|
33930
34030
|
|
|
33931
34031
|
// ../adapter/src/platform-handler.ts
|
|
33932
34032
|
import { existsSync as existsSync20 } from "node:fs";
|
|
33933
|
-
import { resolve as resolve18, dirname as dirname13, join as
|
|
34033
|
+
import { resolve as resolve18, dirname as dirname13, join as join13 } from "node:path";
|
|
33934
34034
|
import { fileURLToPath as fileURLToPath4 } from "node:url";
|
|
33935
34035
|
function routeName2(segments) {
|
|
33936
34036
|
const parts = segments.filter(Boolean).map((s) => {
|
|
@@ -33953,8 +34053,8 @@ function findCompilerSrc2(appDir) {
|
|
|
33953
34053
|
resolve18(appDir, "node_modules", "@vesk/compiler")
|
|
33954
34054
|
];
|
|
33955
34055
|
for (const base of candidates) {
|
|
33956
|
-
for (const dir of [base,
|
|
33957
|
-
if (existsSync20(
|
|
34056
|
+
for (const dir of [base, join13(base, "dist")]) {
|
|
34057
|
+
if (existsSync20(join13(dir, "server-cookies.js"))) return dir;
|
|
33958
34058
|
}
|
|
33959
34059
|
}
|
|
33960
34060
|
throw new Error('@vesk/compiler/dist not found \u2014 run "npm run build" first');
|
|
@@ -34237,7 +34337,7 @@ import {
|
|
|
34237
34337
|
rmSync as rmSync2,
|
|
34238
34338
|
readFileSync as readFileSync20
|
|
34239
34339
|
} from "node:fs";
|
|
34240
|
-
import { resolve as resolve19, join as
|
|
34340
|
+
import { resolve as resolve19, join as join14, extname as extname6, dirname as dirname14 } from "node:path";
|
|
34241
34341
|
function ensureCleanDir(dir) {
|
|
34242
34342
|
rmSync2(dir, { recursive: true, force: true });
|
|
34243
34343
|
mkdirSync9(dir, { recursive: true });
|
|
@@ -34246,8 +34346,8 @@ function copyDirContents(srcDir, destDir) {
|
|
|
34246
34346
|
if (!existsSync21(srcDir)) return;
|
|
34247
34347
|
mkdirSync9(destDir, { recursive: true });
|
|
34248
34348
|
for (const entry of readdirSync6(srcDir)) {
|
|
34249
|
-
const srcPath =
|
|
34250
|
-
const destPath =
|
|
34349
|
+
const srcPath = join14(srcDir, entry);
|
|
34350
|
+
const destPath = join14(destDir, entry);
|
|
34251
34351
|
if (statSync11(srcPath).isDirectory()) {
|
|
34252
34352
|
copyDirContents(srcPath, destPath);
|
|
34253
34353
|
} else {
|
|
@@ -34293,7 +34393,7 @@ function listStaticDir(dir) {
|
|
|
34293
34393
|
if (!existsSync21(dir)) return out;
|
|
34294
34394
|
function walk7(d, prefix) {
|
|
34295
34395
|
for (const entry of readdirSync6(d)) {
|
|
34296
|
-
const full =
|
|
34396
|
+
const full = join14(d, entry);
|
|
34297
34397
|
const rel = prefix ? `${prefix}/${entry}` : entry;
|
|
34298
34398
|
if (statSync11(full).isDirectory()) {
|
|
34299
34399
|
walk7(full, rel);
|
|
@@ -38964,7 +39064,7 @@ __export(typecheck_exports, {
|
|
|
38964
39064
|
typecheckProject: () => typecheckProject
|
|
38965
39065
|
});
|
|
38966
39066
|
import { readFileSync as readFileSync39, readdirSync as readdirSync14, statSync as statSync22 } from "node:fs";
|
|
38967
|
-
import { join as
|
|
39067
|
+
import { join as join26, dirname as dirname27, normalize, relative as relative8, resolve as resolve39, sep as sep7 } from "node:path";
|
|
38968
39068
|
import * as ts8 from "typescript";
|
|
38969
39069
|
function walkProjectFiles(projectRoot) {
|
|
38970
39070
|
const code = [];
|
|
@@ -38977,7 +39077,7 @@ function walkProjectFiles(projectRoot) {
|
|
|
38977
39077
|
return;
|
|
38978
39078
|
}
|
|
38979
39079
|
for (const e of entries) {
|
|
38980
|
-
const p =
|
|
39080
|
+
const p = join26(dir, e);
|
|
38981
39081
|
let st;
|
|
38982
39082
|
try {
|
|
38983
39083
|
st = statSync22(p);
|
|
@@ -39032,8 +39132,8 @@ function checkStructureFile(appDir, file) {
|
|
|
39032
39132
|
return null;
|
|
39033
39133
|
}
|
|
39034
39134
|
function createTypecheckHost(projectRoot, appDir, vskFiles) {
|
|
39035
|
-
const ambientPath =
|
|
39036
|
-
const overridePath =
|
|
39135
|
+
const ambientPath = join26(appDir, "__vesk_ambient.d.ts");
|
|
39136
|
+
const overridePath = join26(appDir, "__vesk_runtime_override.d.ts");
|
|
39037
39137
|
const cached = /* @__PURE__ */ new Map();
|
|
39038
39138
|
const scriptKindFor = (file) => file.endsWith(".vsk") ? ts8.ScriptKind.TSX : ts8.ScriptKind.TS;
|
|
39039
39139
|
const host = {
|
|
@@ -39103,7 +39203,7 @@ function createTypecheckHost(projectRoot, appDir, vskFiles) {
|
|
|
39103
39203
|
directoryExists: (dir) => ts8.sys.directoryExists(dir),
|
|
39104
39204
|
getDirectories: (dir) => {
|
|
39105
39205
|
try {
|
|
39106
|
-
return readdirSync14(dir, { withFileTypes: true }).filter((d) => d.isDirectory()).map((d) =>
|
|
39206
|
+
return readdirSync14(dir, { withFileTypes: true }).filter((d) => d.isDirectory()).map((d) => join26(dir, d.name));
|
|
39107
39207
|
} catch {
|
|
39108
39208
|
return [];
|
|
39109
39209
|
}
|
|
@@ -39115,7 +39215,7 @@ function createTypecheckHost(projectRoot, appDir, vskFiles) {
|
|
|
39115
39215
|
return moduleLiterals.map(({ text }) => {
|
|
39116
39216
|
if (text.endsWith(".vsk")) {
|
|
39117
39217
|
const aliased = text.startsWith(".") ? null : resolveAliasModule(text, dirname27(containingFile));
|
|
39118
|
-
const abs = normalize(aliased ??
|
|
39218
|
+
const abs = normalize(aliased ?? join26(dirname27(containingFile), text));
|
|
39119
39219
|
return {
|
|
39120
39220
|
resolvedModule: {
|
|
39121
39221
|
resolvedFileName: abs + ".d.ts",
|
|
@@ -39126,7 +39226,7 @@ function createTypecheckHost(projectRoot, appDir, vskFiles) {
|
|
|
39126
39226
|
};
|
|
39127
39227
|
}
|
|
39128
39228
|
if (text.endsWith(".css")) {
|
|
39129
|
-
const abs = normalize(
|
|
39229
|
+
const abs = normalize(join26(dirname27(containingFile), text));
|
|
39130
39230
|
return {
|
|
39131
39231
|
resolvedModule: {
|
|
39132
39232
|
resolvedFileName: abs + ".d.ts",
|
|
@@ -39173,7 +39273,7 @@ function sourcePosition(source, offset2) {
|
|
|
39173
39273
|
return { line, character: bounded - lineStart + 1 };
|
|
39174
39274
|
}
|
|
39175
39275
|
function typecheckProject(projectRoot, opts = {}) {
|
|
39176
|
-
const appDir = opts.appDir ??
|
|
39276
|
+
const appDir = opts.appDir ?? join26(projectRoot, "app");
|
|
39177
39277
|
const vskFiles = /* @__PURE__ */ new Map();
|
|
39178
39278
|
const parseErrors = [];
|
|
39179
39279
|
const warnings = [];
|
|
@@ -39212,8 +39312,8 @@ function typecheckProject(projectRoot, opts = {}) {
|
|
|
39212
39312
|
}
|
|
39213
39313
|
rootNames.push(f);
|
|
39214
39314
|
}
|
|
39215
|
-
const ambientPath =
|
|
39216
|
-
const overridePath =
|
|
39315
|
+
const ambientPath = join26(appDir, "__vesk_ambient.d.ts");
|
|
39316
|
+
const overridePath = join26(appDir, "__vesk_runtime_override.d.ts");
|
|
39217
39317
|
rootNames.push(ambientPath);
|
|
39218
39318
|
rootNames.push(overridePath);
|
|
39219
39319
|
const options = {
|
|
@@ -39841,7 +39941,7 @@ declare module '@vesk/runtime' {
|
|
|
39841
39941
|
|
|
39842
39942
|
// src/index.ts
|
|
39843
39943
|
import { readFileSync as readFileSync40, writeFileSync as writeFileSync21, mkdirSync as mkdirSync20, existsSync as existsSync43 } from "fs";
|
|
39844
|
-
import { resolve as resolve40, join as
|
|
39944
|
+
import { resolve as resolve40, join as join27 } from "path";
|
|
39845
39945
|
import { fileURLToPath as fileURLToPath9 } from "url";
|
|
39846
39946
|
|
|
39847
39947
|
// ../adapter/dist/load-config.js
|
|
@@ -40688,8 +40788,15 @@ init_module_imports();
|
|
|
40688
40788
|
import { readFileSync as readFileSync4 } from "node:fs";
|
|
40689
40789
|
import { dirname as dirname6 } from "node:path";
|
|
40690
40790
|
function precompileFile(source, sourcePath2) {
|
|
40691
|
-
return precompileFileInternal(source, sourcePath2, /* @__PURE__ */ new Set());
|
|
40692
|
-
|
|
40791
|
+
if (sourcePath2 === void 0) return precompileFileInternal(source, sourcePath2, /* @__PURE__ */ new Set());
|
|
40792
|
+
const hit = precompileCache.get(sourcePath2);
|
|
40793
|
+
if (hit !== void 0 && hit.source === source) return hit.plan;
|
|
40794
|
+
const plan = precompileFileInternal(source, sourcePath2, /* @__PURE__ */ new Set());
|
|
40795
|
+
if (precompileCache.size >= 512) precompileCache.clear();
|
|
40796
|
+
precompileCache.set(sourcePath2, { source, plan });
|
|
40797
|
+
return plan;
|
|
40798
|
+
}
|
|
40799
|
+
var precompileCache = /* @__PURE__ */ new Map();
|
|
40693
40800
|
function precompileFileInternal(source, sourcePath2, seenImportFiles) {
|
|
40694
40801
|
if (sourcePath2) {
|
|
40695
40802
|
const dir = dirname6(sourcePath2);
|
|
@@ -41792,12 +41899,8 @@ function findRuntimeSrc2(appDir) {
|
|
|
41792
41899
|
}
|
|
41793
41900
|
function extractRuntimeImportNames(code) {
|
|
41794
41901
|
const names = [];
|
|
41795
|
-
|
|
41796
|
-
|
|
41797
|
-
ast = parse4(code);
|
|
41798
|
-
} catch {
|
|
41799
|
-
return names;
|
|
41800
|
-
}
|
|
41902
|
+
const ast = parseForStrip(code);
|
|
41903
|
+
if (!ast) return names;
|
|
41801
41904
|
const body = ast.body ?? [];
|
|
41802
41905
|
for (const raw2 of body) {
|
|
41803
41906
|
const node = raw2;
|
|
@@ -42065,12 +42168,8 @@ function scopeFileContribution(code) {
|
|
|
42065
42168
|
}
|
|
42066
42169
|
}
|
|
42067
42170
|
function stripAndDemoteInOnePass(code) {
|
|
42068
|
-
|
|
42069
|
-
|
|
42070
|
-
ast = parse4(code);
|
|
42071
|
-
} catch {
|
|
42072
|
-
return code;
|
|
42073
|
-
}
|
|
42171
|
+
const ast = parseForStrip(code);
|
|
42172
|
+
if (!ast) return code;
|
|
42074
42173
|
const body = ast.body ?? [];
|
|
42075
42174
|
const edits = [];
|
|
42076
42175
|
for (const raw2 of body) {
|
|
@@ -42104,20 +42203,28 @@ function buildHmrEvalSnippet(code) {
|
|
|
42104
42203
|
const scoped = `{
|
|
42105
42204
|
${body}
|
|
42106
42205
|
}`;
|
|
42107
|
-
|
|
42108
|
-
|
|
42109
|
-
|
|
42110
|
-
|
|
42111
|
-
|
|
42206
|
+
return parseGeneratedJs(scoped) !== null ? scoped : body;
|
|
42207
|
+
}
|
|
42208
|
+
var stripAstCache = /* @__PURE__ */ new Map();
|
|
42209
|
+
var STRIP_AST_CACHE_MAX = 512;
|
|
42210
|
+
function parseForStrip(code) {
|
|
42211
|
+
const hit = stripAstCache.get(code);
|
|
42212
|
+
if (hit !== void 0) return hit;
|
|
42213
|
+
let ast = parseGeneratedJs(code);
|
|
42214
|
+
if (!ast) {
|
|
42215
|
+
try {
|
|
42216
|
+
ast = parse4(code);
|
|
42217
|
+
} catch {
|
|
42218
|
+
ast = null;
|
|
42219
|
+
}
|
|
42112
42220
|
}
|
|
42221
|
+
if (stripAstCache.size >= STRIP_AST_CACHE_MAX) stripAstCache.clear();
|
|
42222
|
+
stripAstCache.set(code, ast);
|
|
42223
|
+
return ast;
|
|
42113
42224
|
}
|
|
42114
42225
|
function removeCompiledNodes(code, isTarget) {
|
|
42115
|
-
|
|
42116
|
-
|
|
42117
|
-
ast = parse4(code);
|
|
42118
|
-
} catch {
|
|
42119
|
-
return code;
|
|
42120
|
-
}
|
|
42226
|
+
const ast = parseForStrip(code);
|
|
42227
|
+
if (!ast) return code;
|
|
42121
42228
|
const ranges = [];
|
|
42122
42229
|
for (const raw2 of ast.body ?? []) {
|
|
42123
42230
|
const node = raw2;
|
|
@@ -42139,6 +42246,7 @@ function removeCompiledNodes(code, isTarget) {
|
|
|
42139
42246
|
async function generateClientBundle(routeTree, appDir, componentMap, options) {
|
|
42140
42247
|
const runtimeDir = findRuntimeSrc2(appDir);
|
|
42141
42248
|
let seen = /* @__PURE__ */ new Set();
|
|
42249
|
+
const __stats = { chunks: 0, compiled: 0, distinct: /* @__PURE__ */ new Set(), parseMs: 0 };
|
|
42142
42250
|
const chunks = [];
|
|
42143
42251
|
const runtimeImportNames = /* @__PURE__ */ new Set();
|
|
42144
42252
|
const cache2 = options?.cache;
|
|
@@ -42222,13 +42330,17 @@ async function generateClientBundle(routeTree, appDir, componentMap, options) {
|
|
|
42222
42330
|
return;
|
|
42223
42331
|
}
|
|
42224
42332
|
compiledFiles++;
|
|
42333
|
+
__stats.compiled++;
|
|
42334
|
+
__stats.distinct.add(filePath);
|
|
42225
42335
|
let src2 = readFileSync11(filePath, "utf-8");
|
|
42226
42336
|
if (/content=["'][^"']*\.md["']/i.test(src2)) {
|
|
42227
42337
|
src2 = inlineMdContentAttrs(src2, dirname8(filePath), guessProjectRoots(appDir));
|
|
42228
42338
|
}
|
|
42229
42339
|
const namesBefore = cache2 ? new Set(runtimeImportNames) : null;
|
|
42230
42340
|
const importedPaths = resolveVskImports(filePath, (p, n) => compileFile2(p, n, output, imports));
|
|
42341
|
+
const __p0 = performance.now();
|
|
42231
42342
|
const { comp: rawComp, hyd: rawHyd, name: actualName, aliases, reexportPaths, componentNames } = compileClientBoth(src2, null, filePath);
|
|
42343
|
+
__stats.parseMs += performance.now() - __p0;
|
|
42232
42344
|
for (const cn of componentNames || []) componentOwners.claim(cn, filePath);
|
|
42233
42345
|
const compWithImports = rawComp ? stripExports(stripVskImports(stripRuntimeImport(rawComp))) : "";
|
|
42234
42346
|
const hydWithImports = rawHyd ? stripExports(stripVskImports(stripRuntimeImport(rawHyd))) : "";
|
|
@@ -42419,6 +42531,7 @@ ${entry.code}
|
|
|
42419
42531
|
transformedChunks.push({ ...chunk, code: await applyTransformPlugins(chunk.code, chunk.name) });
|
|
42420
42532
|
}
|
|
42421
42533
|
componentOwners.report("client bundle");
|
|
42534
|
+
if (process.env.VESK_BUILD_PROFILE) console.error(` [client] chunks=${chunks.length} compiled=${__stats.compiled} distinct=${__stats.distinct.size} parseMs=${__stats.parseMs.toFixed(0)}`);
|
|
42422
42535
|
return { main: await applyTransformPlugins(main, "client.js"), chunks: transformedChunks, cachedFileHits, compiledFiles, mainFromCache, editedSources, editedNames };
|
|
42423
42536
|
} else {
|
|
42424
42537
|
let compileFileMono2 = function(filePath, resolvedName) {
|
|
@@ -43402,7 +43515,24 @@ async function collectPluginHeadExtra(pluginsPipelines) {
|
|
|
43402
43515
|
}
|
|
43403
43516
|
return parts.join("\n");
|
|
43404
43517
|
}
|
|
43518
|
+
var profileEnabled = () => process.env.VESK_BUILD_PROFILE === "1";
|
|
43519
|
+
var phaseMarks = [];
|
|
43520
|
+
var phaseStarted = 0;
|
|
43521
|
+
var buildStarted = 0;
|
|
43522
|
+
function markPhase(name) {
|
|
43523
|
+
if (!profileEnabled())
|
|
43524
|
+
return;
|
|
43525
|
+
const now2 = performance.now();
|
|
43526
|
+
if (phaseStarted > 0)
|
|
43527
|
+
phaseMarks.push([name, now2 - phaseStarted]);
|
|
43528
|
+
phaseStarted = now2;
|
|
43529
|
+
}
|
|
43405
43530
|
async function build2(appDir, options) {
|
|
43531
|
+
if (profileEnabled()) {
|
|
43532
|
+
buildStarted = Date.now();
|
|
43533
|
+
phaseMarks = [];
|
|
43534
|
+
phaseStarted = performance.now();
|
|
43535
|
+
}
|
|
43406
43536
|
appDir = resolve21(appDir);
|
|
43407
43537
|
const outDir = resolve21(options?.outDir || resolve21(appDir, "..", ".vesk"));
|
|
43408
43538
|
const publicDir = options?.publicDir || resolve21(appDir, "..", "public");
|
|
@@ -43452,6 +43582,7 @@ async function build2(appDir, options) {
|
|
|
43452
43582
|
];
|
|
43453
43583
|
for (const d of dirs)
|
|
43454
43584
|
mkdirSync11(d, { recursive: true });
|
|
43585
|
+
markPhase("config+dirs");
|
|
43455
43586
|
const cssSourcePath = resolveUserCssPath(appDir);
|
|
43456
43587
|
if (cssSourcePath !== null) {
|
|
43457
43588
|
const cssContent = readFileSync21(cssSourcePath, "utf-8");
|
|
@@ -43475,6 +43606,7 @@ async function build2(appDir, options) {
|
|
|
43475
43606
|
console.error(`vesk build: css \u2192 static/global.css (${finalCss.length} bytes, tailwind plugin inactive)`);
|
|
43476
43607
|
}
|
|
43477
43608
|
}
|
|
43609
|
+
markPhase("css/tailwind");
|
|
43478
43610
|
const { scanRoutes: scanRoutes2, scanComponents: scanComponents2 } = await resolveCompilerApi("router.js");
|
|
43479
43611
|
const { scanApiRoutes: scanApiRoutes2 } = await resolveCompilerApi("api-routes.js");
|
|
43480
43612
|
const { collectMiddlewareChain: collectMiddlewareChain2 } = await resolveCompilerApi("middleware.js");
|
|
@@ -43492,6 +43624,7 @@ async function build2(appDir, options) {
|
|
|
43492
43624
|
const apiDir = resolve21(appDir, "api");
|
|
43493
43625
|
const apiTree = existsSync22(apiDir) ? scanApiRoutes2(apiDir) : [];
|
|
43494
43626
|
console.error(`vesk build: ${routeTree.length} root routes, ${apiTree.length} API routes`);
|
|
43627
|
+
markPhase("scan routes");
|
|
43495
43628
|
console.error("vesk build: bundling server runtime...");
|
|
43496
43629
|
await bundleRuntime(appDir, outDir);
|
|
43497
43630
|
const ssrRoutes = [];
|
|
@@ -43544,6 +43677,7 @@ async function build2(appDir, options) {
|
|
|
43544
43677
|
}
|
|
43545
43678
|
}
|
|
43546
43679
|
walk7(routeTree);
|
|
43680
|
+
markPhase("server runtime + ssr functions");
|
|
43547
43681
|
const apiRoutes = [];
|
|
43548
43682
|
function walkApi(nodes) {
|
|
43549
43683
|
for (const node of nodes) {
|
|
@@ -43570,6 +43704,7 @@ async function build2(appDir, options) {
|
|
|
43570
43704
|
const hasEvents = await compileEvents(appDir, outDir);
|
|
43571
43705
|
if (hasEvents)
|
|
43572
43706
|
console.error("vesk build: evt \u2192 server/events.js (onStart/onRequest/onStop)");
|
|
43707
|
+
markPhase("api functions");
|
|
43573
43708
|
console.error("vesk build: bundling client runtime...");
|
|
43574
43709
|
const bundleOpts = {};
|
|
43575
43710
|
if (options?.codeSplit)
|
|
@@ -43592,6 +43727,7 @@ async function build2(appDir, options) {
|
|
|
43592
43727
|
}
|
|
43593
43728
|
}
|
|
43594
43729
|
copyStaticAssets(publicDir, outDir);
|
|
43730
|
+
markPhase("client runtime + chunks");
|
|
43595
43731
|
console.error("vesk build: static \u2192 static/public/");
|
|
43596
43732
|
let prerenderedRoutes = [];
|
|
43597
43733
|
if (options?.ssg) {
|
|
@@ -43603,7 +43739,7 @@ async function build2(appDir, options) {
|
|
|
43603
43739
|
console.error(`vesk build: ssg \u2192 prerendered/ (${prerenderedRoutes.length} pages)`);
|
|
43604
43740
|
}
|
|
43605
43741
|
{
|
|
43606
|
-
const { optimizeImages: optimizeImages2 } = await
|
|
43742
|
+
const { optimizeImages: optimizeImages2 } = await Promise.resolve().then(() => (init_image_pipeline(), image_pipeline_exports));
|
|
43607
43743
|
await optimizeImages2(appDir, outDir);
|
|
43608
43744
|
}
|
|
43609
43745
|
if (options?.seo) {
|
|
@@ -43613,10 +43749,6 @@ async function build2(appDir, options) {
|
|
|
43613
43749
|
throw new Error(`SEO audit failed with ${audit.errors} error(s) \u2014 fix them before deploying`);
|
|
43614
43750
|
}
|
|
43615
43751
|
}
|
|
43616
|
-
{
|
|
43617
|
-
const { optimizeImages: optimizeImages2 } = await init_image_pipeline().then(() => image_pipeline_exports);
|
|
43618
|
-
await optimizeImages2(appDir, outDir);
|
|
43619
|
-
}
|
|
43620
43752
|
{
|
|
43621
43753
|
const { generateSitemap: generateSitemap2, generateRobotsTxt: generateRobotsTxt2 } = await Promise.resolve().then(() => (init_static(), static_exports));
|
|
43622
43754
|
const publicDirResolved = resolve21(outDir, "static", "public");
|
|
@@ -43634,6 +43766,7 @@ async function build2(appDir, options) {
|
|
|
43634
43766
|
console.error(`vesk build: seo \u2192 static/public/robots.txt (${robots.length} bytes)`);
|
|
43635
43767
|
}
|
|
43636
43768
|
}
|
|
43769
|
+
markPhase("ssg+images+seo");
|
|
43637
43770
|
const manifest = generateManifest(routeTree, ssrRoutes, apiRoutes, prerenderedRoutes, middlewareEnabled, actionMap, pluginHeadExtra, hasEvents);
|
|
43638
43771
|
writeFileSync12(resolve21(outDir, "config.json"), JSON.stringify(manifest, null, 2) + "\n", "utf-8");
|
|
43639
43772
|
console.error("vesk build: config \u2192 config.json");
|
|
@@ -43666,6 +43799,14 @@ async function build2(appDir, options) {
|
|
|
43666
43799
|
await plugin.onBuildEnd();
|
|
43667
43800
|
}
|
|
43668
43801
|
}
|
|
43802
|
+
markPhase("manifest+platform");
|
|
43803
|
+
markPhase("tail");
|
|
43804
|
+
if (profileEnabled()) {
|
|
43805
|
+
for (const [name, ms] of phaseMarks) {
|
|
43806
|
+
console.error(` phase ${name.padEnd(30)} ${ms.toFixed(0).padStart(6)}ms`);
|
|
43807
|
+
}
|
|
43808
|
+
console.error(` TOTAL ${(Date.now() - buildStarted).toFixed(0)}ms`);
|
|
43809
|
+
}
|
|
43669
43810
|
console.error(`
|
|
43670
43811
|
vesk build: done (${outDir})`);
|
|
43671
43812
|
return { routeTree, apiTree, ssrRoutes, apiRoutes, manifest };
|
|
@@ -43676,7 +43817,7 @@ init_seo_audit();
|
|
|
43676
43817
|
|
|
43677
43818
|
// src/dev-server.ts
|
|
43678
43819
|
import { readFileSync as readFileSync38, watch, statSync as statSync21, existsSync as existsSync42, readdirSync as readdirSync13 } from "node:fs";
|
|
43679
|
-
import { resolve as resolve38, extname as extname8, join as
|
|
43820
|
+
import { resolve as resolve38, extname as extname8, join as join25, dirname as dirname26 } from "node:path";
|
|
43680
43821
|
import { createServer as createServer2 } from "node:http";
|
|
43681
43822
|
import { WebSocketServer as WebSocketServer2 } from "ws";
|
|
43682
43823
|
|
|
@@ -46326,7 +46467,7 @@ init_tokens();
|
|
|
46326
46467
|
init_scan();
|
|
46327
46468
|
init_strip_ts();
|
|
46328
46469
|
import { readdirSync as readdirSync7, statSync as statSync12, existsSync as existsSync23, readFileSync as readFileSync22 } from "fs";
|
|
46329
|
-
import { join as
|
|
46470
|
+
import { join as join15, relative as relative5, basename as basename3 } from "path";
|
|
46330
46471
|
function collapseSlashes2(p) {
|
|
46331
46472
|
let out = "";
|
|
46332
46473
|
let prevSlash = false;
|
|
@@ -46429,7 +46570,7 @@ function scanComponents(componentsDir) {
|
|
|
46429
46570
|
return;
|
|
46430
46571
|
}
|
|
46431
46572
|
for (const entry of entries) {
|
|
46432
|
-
const full =
|
|
46573
|
+
const full = join15(dir, entry);
|
|
46433
46574
|
let stat;
|
|
46434
46575
|
try {
|
|
46435
46576
|
stat = statSync12(full);
|
|
@@ -46530,7 +46671,7 @@ function scanDirectory(rootDir, dir, parentPath, options) {
|
|
|
46530
46671
|
seg = segName;
|
|
46531
46672
|
}
|
|
46532
46673
|
const fullPath = seg ? (parentPath === "/" ? "/" : parentPath + "/") + seg : parentPath || "/";
|
|
46533
|
-
const isStandalone = hasLayout ? isStandaloneLayoutFile(
|
|
46674
|
+
const isStandalone = hasLayout ? isStandaloneLayoutFile(join15(dir, "layout.vsk")) : false;
|
|
46534
46675
|
const node = {
|
|
46535
46676
|
path: seg,
|
|
46536
46677
|
fullPath: collapseSlashes2(fullPath) || "/",
|
|
@@ -46551,7 +46692,7 @@ function scanDirectory(rootDir, dir, parentPath, options) {
|
|
|
46551
46692
|
standalone: isStandalone ? true : void 0
|
|
46552
46693
|
};
|
|
46553
46694
|
for (const entry of entries) {
|
|
46554
|
-
const entryPath =
|
|
46695
|
+
const entryPath = join15(dir, entry);
|
|
46555
46696
|
let entryStat;
|
|
46556
46697
|
try {
|
|
46557
46698
|
entryStat = statSync12(entryPath);
|
|
@@ -46603,19 +46744,19 @@ function collectSources(tree) {
|
|
|
46603
46744
|
function walk7(nodes) {
|
|
46604
46745
|
for (const node of nodes) {
|
|
46605
46746
|
if (node.page)
|
|
46606
|
-
map.set(node.page,
|
|
46747
|
+
map.set(node.page, join15(node.sourceDir, "page.vsk"));
|
|
46607
46748
|
if (node.layout)
|
|
46608
|
-
map.set(node.layout,
|
|
46749
|
+
map.set(node.layout, join15(node.sourceDir, "layout.vsk"));
|
|
46609
46750
|
if (node.loading)
|
|
46610
|
-
map.set(node.loading,
|
|
46751
|
+
map.set(node.loading, join15(node.sourceDir, "loading.vsk"));
|
|
46611
46752
|
if (node.error)
|
|
46612
|
-
map.set(node.error,
|
|
46753
|
+
map.set(node.error, join15(node.sourceDir, "error.vsk"));
|
|
46613
46754
|
if (node.notFound)
|
|
46614
|
-
map.set(node.notFound,
|
|
46755
|
+
map.set(node.notFound, join15(node.sourceDir, "not-found.vsk"));
|
|
46615
46756
|
if (node.offline)
|
|
46616
|
-
map.set(node.offline,
|
|
46757
|
+
map.set(node.offline, join15(node.sourceDir, "offline.vsk"));
|
|
46617
46758
|
if (node.network)
|
|
46618
|
-
map.set(node.network,
|
|
46759
|
+
map.set(node.network, join15(node.sourceDir, "network.vsk"));
|
|
46619
46760
|
walk7(node.children);
|
|
46620
46761
|
}
|
|
46621
46762
|
}
|
|
@@ -46717,7 +46858,7 @@ function matchUrl(tree, pathname) {
|
|
|
46717
46858
|
|
|
46718
46859
|
// ../compiler/dist/api-routes.js
|
|
46719
46860
|
import { readdirSync as readdirSync8, statSync as statSync13, existsSync as existsSync24 } from "fs";
|
|
46720
|
-
import { join as
|
|
46861
|
+
import { join as join16 } from "path";
|
|
46721
46862
|
init_server_utils();
|
|
46722
46863
|
function basename4(p) {
|
|
46723
46864
|
const idx = p.lastIndexOf("/");
|
|
@@ -46754,7 +46895,7 @@ function scanApiDir(rootDir, dir, parentPath) {
|
|
|
46754
46895
|
return nodes;
|
|
46755
46896
|
if (isRouteGroup) {
|
|
46756
46897
|
for (const entry of entries) {
|
|
46757
|
-
const entryPath =
|
|
46898
|
+
const entryPath = join16(dir, entry);
|
|
46758
46899
|
let entryStat;
|
|
46759
46900
|
try {
|
|
46760
46901
|
entryStat = statSync13(entryPath);
|
|
@@ -46784,11 +46925,11 @@ function scanApiDir(rootDir, dir, parentPath) {
|
|
|
46784
46925
|
fullPath: collapseSlashes(fullPath) || "/",
|
|
46785
46926
|
isDynamic,
|
|
46786
46927
|
isCatchAll,
|
|
46787
|
-
filePath: hasRoute && routeFileName ?
|
|
46928
|
+
filePath: hasRoute && routeFileName ? join16(dir, routeFileName) : null,
|
|
46788
46929
|
children: []
|
|
46789
46930
|
};
|
|
46790
46931
|
for (const entry of entries) {
|
|
46791
|
-
const entryPath =
|
|
46932
|
+
const entryPath = join16(dir, entry);
|
|
46792
46933
|
let entryStat;
|
|
46793
46934
|
try {
|
|
46794
46935
|
entryStat = statSync13(entryPath);
|
|
@@ -47318,11 +47459,11 @@ async function executeMiddlewareChain(chain, request, params, options = {}) {
|
|
|
47318
47459
|
|
|
47319
47460
|
// ../compiler/dist/events.js
|
|
47320
47461
|
import { existsSync as existsSync26 } from "fs";
|
|
47321
|
-
import { join as
|
|
47462
|
+
import { join as join17 } from "path";
|
|
47322
47463
|
var EVENTS_FILE_NAMES2 = ["_events.ts", "_events.js"];
|
|
47323
47464
|
function collectEventsFile2(appDir) {
|
|
47324
47465
|
for (const name of EVENTS_FILE_NAMES2) {
|
|
47325
|
-
const candidate =
|
|
47466
|
+
const candidate = join17(appDir, name);
|
|
47326
47467
|
if (existsSync26(candidate))
|
|
47327
47468
|
return candidate;
|
|
47328
47469
|
}
|
|
@@ -47354,7 +47495,7 @@ async function runEventHandlers(handlers, name, ctx2) {
|
|
|
47354
47495
|
|
|
47355
47496
|
// ../compiler/dist/md-inline.js
|
|
47356
47497
|
import { readFileSync as readFileSync23, existsSync as existsSync27 } from "node:fs";
|
|
47357
|
-
import { dirname as dirname17, join as
|
|
47498
|
+
import { dirname as dirname17, join as join18, resolve as resolve23 } from "node:path";
|
|
47358
47499
|
var MD_EXT_MARKER2 = ".md";
|
|
47359
47500
|
function looksLikeMarkdownPath2(value) {
|
|
47360
47501
|
const v = value.trim();
|
|
@@ -47431,10 +47572,10 @@ function resolveMdPath2(specifier, importerDir, roots) {
|
|
|
47431
47572
|
}
|
|
47432
47573
|
if (spec.startsWith("/")) {
|
|
47433
47574
|
for (const root3 of roots) {
|
|
47434
|
-
const pub =
|
|
47575
|
+
const pub = join18(root3, "public", spec);
|
|
47435
47576
|
if (existsSync27(pub))
|
|
47436
47577
|
return pub;
|
|
47437
|
-
const direct =
|
|
47578
|
+
const direct = join18(root3, spec);
|
|
47438
47579
|
if (existsSync27(direct))
|
|
47439
47580
|
return direct;
|
|
47440
47581
|
}
|
|
@@ -47448,7 +47589,7 @@ function guessProjectRoots2(dir) {
|
|
|
47448
47589
|
let cur = dir;
|
|
47449
47590
|
for (let i = 0; i < 6; i++) {
|
|
47450
47591
|
roots.push(cur);
|
|
47451
|
-
if (existsSync27(
|
|
47592
|
+
if (existsSync27(join18(cur, "package.json")))
|
|
47452
47593
|
break;
|
|
47453
47594
|
const parent = dirname17(cur);
|
|
47454
47595
|
if (parent === cur)
|
|
@@ -47460,9 +47601,9 @@ function guessProjectRoots2(dir) {
|
|
|
47460
47601
|
|
|
47461
47602
|
// ../adapter/dist/client-bundle.js
|
|
47462
47603
|
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";
|
|
47463
|
-
import { resolve as resolve24, join as
|
|
47604
|
+
import { resolve as resolve24, join as join19, dirname as dirname18, relative as relative6, sep as sep3 } from "node:path";
|
|
47464
47605
|
import { fileURLToPath as fileURLToPath6 } from "node:url";
|
|
47465
|
-
import { tmpdir as
|
|
47606
|
+
import { tmpdir as tmpdir3 } from "node:os";
|
|
47466
47607
|
|
|
47467
47608
|
// ../adapter/dist/esbuild-fallback.js
|
|
47468
47609
|
var _nativeBuild2 = null;
|
|
@@ -47543,8 +47684,8 @@ function findRuntimeSrc3(appDir) {
|
|
|
47543
47684
|
resolve24(appDir, "node_modules", "@vesk/runtime")
|
|
47544
47685
|
];
|
|
47545
47686
|
for (const base of candidates) {
|
|
47546
|
-
for (const dir of [base,
|
|
47547
|
-
if (existsSync28(
|
|
47687
|
+
for (const dir of [base, join19(base, "dist")]) {
|
|
47688
|
+
if (existsSync28(join19(dir, "index-client.js")))
|
|
47548
47689
|
return dir;
|
|
47549
47690
|
}
|
|
47550
47691
|
}
|
|
@@ -47552,12 +47693,9 @@ function findRuntimeSrc3(appDir) {
|
|
|
47552
47693
|
}
|
|
47553
47694
|
function extractRuntimeImportNames2(code) {
|
|
47554
47695
|
const names = [];
|
|
47555
|
-
|
|
47556
|
-
|
|
47557
|
-
ast = parse4(code);
|
|
47558
|
-
} catch {
|
|
47696
|
+
const ast = parseForStrip2(code);
|
|
47697
|
+
if (!ast)
|
|
47559
47698
|
return names;
|
|
47560
|
-
}
|
|
47561
47699
|
const body = ast.body ?? [];
|
|
47562
47700
|
for (const raw2 of body) {
|
|
47563
47701
|
const node = raw2;
|
|
@@ -47854,12 +47992,9 @@ function scopeFileContribution2(code) {
|
|
|
47854
47992
|
}
|
|
47855
47993
|
}
|
|
47856
47994
|
function stripAndDemoteInOnePass2(code) {
|
|
47857
|
-
|
|
47858
|
-
|
|
47859
|
-
ast = parse4(code);
|
|
47860
|
-
} catch {
|
|
47995
|
+
const ast = parseForStrip2(code);
|
|
47996
|
+
if (!ast)
|
|
47861
47997
|
return code;
|
|
47862
|
-
}
|
|
47863
47998
|
const body = ast.body ?? [];
|
|
47864
47999
|
const edits = [];
|
|
47865
48000
|
for (const raw2 of body) {
|
|
@@ -47900,20 +48035,31 @@ function buildHmrEvalSnippet2(code) {
|
|
|
47900
48035
|
const scoped = `{
|
|
47901
48036
|
${body}
|
|
47902
48037
|
}`;
|
|
47903
|
-
|
|
47904
|
-
|
|
47905
|
-
|
|
47906
|
-
|
|
47907
|
-
|
|
48038
|
+
return parseGeneratedJs(scoped) !== null ? scoped : body;
|
|
48039
|
+
}
|
|
48040
|
+
var stripAstCache2 = /* @__PURE__ */ new Map();
|
|
48041
|
+
var STRIP_AST_CACHE_MAX2 = 512;
|
|
48042
|
+
function parseForStrip2(code) {
|
|
48043
|
+
const hit = stripAstCache2.get(code);
|
|
48044
|
+
if (hit !== void 0)
|
|
48045
|
+
return hit;
|
|
48046
|
+
let ast = parseGeneratedJs(code);
|
|
48047
|
+
if (!ast) {
|
|
48048
|
+
try {
|
|
48049
|
+
ast = parse4(code);
|
|
48050
|
+
} catch {
|
|
48051
|
+
ast = null;
|
|
48052
|
+
}
|
|
47908
48053
|
}
|
|
48054
|
+
if (stripAstCache2.size >= STRIP_AST_CACHE_MAX2)
|
|
48055
|
+
stripAstCache2.clear();
|
|
48056
|
+
stripAstCache2.set(code, ast);
|
|
48057
|
+
return ast;
|
|
47909
48058
|
}
|
|
47910
48059
|
function removeCompiledNodes2(code, isTarget) {
|
|
47911
|
-
|
|
47912
|
-
|
|
47913
|
-
ast = parse4(code);
|
|
47914
|
-
} catch {
|
|
48060
|
+
const ast = parseForStrip2(code);
|
|
48061
|
+
if (!ast)
|
|
47915
48062
|
return code;
|
|
47916
|
-
}
|
|
47917
48063
|
const ranges = [];
|
|
47918
48064
|
for (const raw2 of ast.body ?? []) {
|
|
47919
48065
|
const node = raw2;
|
|
@@ -47939,6 +48085,7 @@ function removeCompiledNodes2(code, isTarget) {
|
|
|
47939
48085
|
async function generateClientBundle2(routeTree, appDir, componentMap, options) {
|
|
47940
48086
|
const runtimeDir = findRuntimeSrc3(appDir);
|
|
47941
48087
|
let seen = /* @__PURE__ */ new Set();
|
|
48088
|
+
const __stats = { chunks: 0, compiled: 0, distinct: /* @__PURE__ */ new Set(), parseMs: 0 };
|
|
47942
48089
|
const chunks = [];
|
|
47943
48090
|
const runtimeImportNames = /* @__PURE__ */ new Set();
|
|
47944
48091
|
const cache2 = options?.cache;
|
|
@@ -48027,13 +48174,17 @@ async function generateClientBundle2(routeTree, appDir, componentMap, options) {
|
|
|
48027
48174
|
return;
|
|
48028
48175
|
}
|
|
48029
48176
|
compiledFiles++;
|
|
48177
|
+
__stats.compiled++;
|
|
48178
|
+
__stats.distinct.add(filePath);
|
|
48030
48179
|
let src2 = readFileSync24(filePath, "utf-8");
|
|
48031
48180
|
if (/content=["'][^"']*\.md["']/i.test(src2)) {
|
|
48032
48181
|
src2 = inlineMdContentAttrs(src2, dirname18(filePath), guessProjectRoots(appDir));
|
|
48033
48182
|
}
|
|
48034
48183
|
const namesBefore = cache2 ? new Set(runtimeImportNames) : null;
|
|
48035
48184
|
const importedPaths = resolveVskImports(filePath, (p, n) => compileFile2(p, n, output, imports));
|
|
48185
|
+
const __p0 = performance.now();
|
|
48036
48186
|
const { comp: rawComp, hyd: rawHyd, name: actualName, aliases, reexportPaths, componentNames } = compileClientBoth(src2, null, filePath);
|
|
48187
|
+
__stats.parseMs += performance.now() - __p0;
|
|
48037
48188
|
for (const cn of componentNames || [])
|
|
48038
48189
|
componentOwners.claim(cn, filePath);
|
|
48039
48190
|
const compWithImports = rawComp ? stripExports(stripVskImports(stripRuntimeImport(rawComp))) : "";
|
|
@@ -48184,8 +48335,8 @@ ${body}
|
|
|
48184
48335
|
continue;
|
|
48185
48336
|
let finalCode;
|
|
48186
48337
|
if (entry.imports) {
|
|
48187
|
-
const tmpBase = mkdtempSync2(
|
|
48188
|
-
const tmpFile =
|
|
48338
|
+
const tmpBase = mkdtempSync2(join19(resolve24(appDir, ".."), "tmp-vesk-chunk-"));
|
|
48339
|
+
const tmpFile = join19(tmpBase, "entry.js");
|
|
48189
48340
|
const toBundle = `const __components = globalThis.__components || (globalThis.__components = {});
|
|
48190
48341
|
const __hydrators = globalThis.__hydrators || (globalThis.__hydrators = {});
|
|
48191
48342
|
${entry.code}
|
|
@@ -48236,6 +48387,8 @@ ${entry.code}
|
|
|
48236
48387
|
transformedChunks.push({ ...chunk, code: await applyTransformPlugins(chunk.code, chunk.name) });
|
|
48237
48388
|
}
|
|
48238
48389
|
componentOwners.report("client bundle");
|
|
48390
|
+
if (process.env.VESK_BUILD_PROFILE)
|
|
48391
|
+
console.error(` [client] chunks=${chunks.length} compiled=${__stats.compiled} distinct=${__stats.distinct.size} parseMs=${__stats.parseMs.toFixed(0)}`);
|
|
48239
48392
|
return { main: await applyTransformPlugins(main, "client.js"), chunks: transformedChunks, cachedFileHits, compiledFiles, mainFromCache, editedSources, editedNames };
|
|
48240
48393
|
} else {
|
|
48241
48394
|
let compileFileMono2 = function(filePath, resolvedName) {
|
|
@@ -48335,7 +48488,7 @@ function buildRuntimeCode2(runtimeDir) {
|
|
|
48335
48488
|
];
|
|
48336
48489
|
let code = "";
|
|
48337
48490
|
for (const f of runtimeFiles) {
|
|
48338
|
-
const p =
|
|
48491
|
+
const p = join19(runtimeDir, f);
|
|
48339
48492
|
if (existsSync28(p)) {
|
|
48340
48493
|
let src2 = readFileSync24(p, "utf-8");
|
|
48341
48494
|
src2 = stripTypes2(src2);
|
|
@@ -48349,7 +48502,7 @@ ${src2}
|
|
|
48349
48502
|
`;
|
|
48350
48503
|
}
|
|
48351
48504
|
}
|
|
48352
|
-
const indexSrc = readFileSync24(
|
|
48505
|
+
const indexSrc = readFileSync24(join19(runtimeDir, "index-client.js"), "utf-8");
|
|
48353
48506
|
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())) || [];
|
|
48354
48507
|
code += "// --- exports ---\n";
|
|
48355
48508
|
for (const name of [...new Set(exportNames)]) {
|
|
@@ -48360,7 +48513,7 @@ ${src2}
|
|
|
48360
48513
|
return code;
|
|
48361
48514
|
}
|
|
48362
48515
|
function runtimeExportNames2(runtimeDir) {
|
|
48363
|
-
const indexSrc = readFileSync24(
|
|
48516
|
+
const indexSrc = readFileSync24(join19(runtimeDir, "index-client.js"), "utf-8");
|
|
48364
48517
|
const names = /* @__PURE__ */ new Set();
|
|
48365
48518
|
for (const m of indexSrc.matchAll(/export\s*\{([^}]+)\}\s*from/g)) {
|
|
48366
48519
|
for (const raw2 of m[1].split(",")) {
|
|
@@ -48376,7 +48529,7 @@ function esbuildPath2(p) {
|
|
|
48376
48529
|
return sep3 === "/" ? p : p.split(sep3).join("/");
|
|
48377
48530
|
}
|
|
48378
48531
|
function runtimeTreeShakeEntry2() {
|
|
48379
|
-
return
|
|
48532
|
+
return join19(tmpdir3(), "vesk-runtime-tree-shake", RUNTIME_ENTRY2);
|
|
48380
48533
|
}
|
|
48381
48534
|
var treeShakeQueue2 = Promise.resolve();
|
|
48382
48535
|
function buildTreeShakenRuntime2(runtimeDir, usedNames) {
|
|
@@ -48393,7 +48546,7 @@ async function buildTreeShakenRuntimeNow2(runtimeDir, usedNames) {
|
|
|
48393
48546
|
return buildRuntimeCode2(runtimeDir);
|
|
48394
48547
|
}
|
|
48395
48548
|
const entry = runtimeTreeShakeEntry2();
|
|
48396
|
-
const indexClient = esbuildPath2(
|
|
48549
|
+
const indexClient = esbuildPath2(join19(runtimeDir, "index-client.js"));
|
|
48397
48550
|
try {
|
|
48398
48551
|
try {
|
|
48399
48552
|
mkdirSync12(dirname18(entry), { recursive: true });
|
|
@@ -48632,8 +48785,8 @@ import { resolve as resolve28 } from "node:path";
|
|
|
48632
48785
|
// ../adapter/dist/plugins.js
|
|
48633
48786
|
init_paths();
|
|
48634
48787
|
import { readFileSync as readFileSync26, writeFileSync as writeFileSync14, existsSync as existsSync30, mkdirSync as mkdirSync13, statSync as statSync16 } from "node:fs";
|
|
48635
|
-
import { resolve as resolve26, dirname as dirname19, join as
|
|
48636
|
-
import { createRequire as
|
|
48788
|
+
import { resolve as resolve26, dirname as dirname19, join as join20, extname as extname7, basename as basename5 } from "node:path";
|
|
48789
|
+
import { createRequire as createRequire6 } from "node:module";
|
|
48637
48790
|
import { spawn as spawn2 } from "node:child_process";
|
|
48638
48791
|
var PLUGIN_STATE_FILENAME2 = "plugins.json";
|
|
48639
48792
|
var STATE_VERSION2 = 1;
|
|
@@ -48679,7 +48832,7 @@ function writePluginState2(veskDir, state) {
|
|
|
48679
48832
|
writeFileSync14(file, JSON.stringify(state, null, 2) + "\n", "utf-8");
|
|
48680
48833
|
}
|
|
48681
48834
|
function resolvePackage2(appDir, pkg) {
|
|
48682
|
-
const require3 =
|
|
48835
|
+
const require3 = createRequire6(resolve26(appDir, "package.json"));
|
|
48683
48836
|
let entryPath = null;
|
|
48684
48837
|
let pkgJsonPath = null;
|
|
48685
48838
|
let pkgJson = null;
|
|
@@ -48692,7 +48845,7 @@ function resolvePackage2(appDir, pkg) {
|
|
|
48692
48845
|
const seen = /* @__PURE__ */ new Set();
|
|
48693
48846
|
while (cur && cur !== dirname19(cur) && !seen.has(cur)) {
|
|
48694
48847
|
seen.add(cur);
|
|
48695
|
-
const candidate =
|
|
48848
|
+
const candidate = join20(cur, "package.json");
|
|
48696
48849
|
if (existsSync30(candidate)) {
|
|
48697
48850
|
pkgJsonPath = candidate;
|
|
48698
48851
|
break;
|
|
@@ -48721,7 +48874,7 @@ function resolvePackage2(appDir, pkg) {
|
|
|
48721
48874
|
}
|
|
48722
48875
|
}
|
|
48723
48876
|
if (localPath) {
|
|
48724
|
-
const localJson =
|
|
48877
|
+
const localJson = join20(localPath, "package.json");
|
|
48725
48878
|
let json = null;
|
|
48726
48879
|
if (existsSync30(localJson)) {
|
|
48727
48880
|
json = readJsonFile2(localJson);
|
|
@@ -49608,8 +49761,8 @@ var __internals2 = {
|
|
|
49608
49761
|
|
|
49609
49762
|
// ../adapter/dist/dev-config.js
|
|
49610
49763
|
import { existsSync as existsSync31, readFileSync as readFileSync27, writeFileSync as writeFileSync15, mkdirSync as mkdirSync14, mkdtempSync as mkdtempSync3, rmSync as rmSync5 } from "node:fs";
|
|
49611
|
-
import { tmpdir as
|
|
49612
|
-
import { resolve as resolve27, dirname as dirname20, join as
|
|
49764
|
+
import { tmpdir as tmpdir4 } from "node:os";
|
|
49765
|
+
import { resolve as resolve27, dirname as dirname20, join as join21 } from "node:path";
|
|
49613
49766
|
init_parser();
|
|
49614
49767
|
function findConfigFile2(projectDir) {
|
|
49615
49768
|
const ts9 = resolve27(projectDir, "vesk.config.ts");
|
|
@@ -49637,9 +49790,9 @@ async function parseConfigSource(source, isTs, projectDir) {
|
|
|
49637
49790
|
js = `const { defineConfig, definePlugin, preset } = globalThis.__vesk_inject;
|
|
49638
49791
|
` + js;
|
|
49639
49792
|
}
|
|
49640
|
-
const base = projectDir ? (mkdirSync14(
|
|
49641
|
-
const dir = base ? mkdtempSync3(
|
|
49642
|
-
const tmpFile =
|
|
49793
|
+
const base = projectDir ? (mkdirSync14(join21(projectDir, ".vesk"), { recursive: true }), join21(projectDir, ".vesk")) : void 0;
|
|
49794
|
+
const dir = base ? mkdtempSync3(join21(base, "cfg-")) : mkdtempSync3(join21(tmpdir4(), "vesk-cfg-"));
|
|
49795
|
+
const tmpFile = join21(dir, "config.mjs");
|
|
49643
49796
|
try {
|
|
49644
49797
|
writeFileSync15(tmpFile, js, "utf-8");
|
|
49645
49798
|
globalThis.__vesk_inject = {
|
|
@@ -50949,7 +51102,7 @@ function produceDiagnostics(input) {
|
|
|
50949
51102
|
|
|
50950
51103
|
// ../agentic/dist/checkpoints.js
|
|
50951
51104
|
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";
|
|
50952
|
-
import { join as
|
|
51105
|
+
import { join as join22, resolve as resolve29, dirname as dirname21, sep as sep5 } from "node:path";
|
|
50953
51106
|
import { randomUUID as nodeRandomUUID } from "node:crypto";
|
|
50954
51107
|
function generateId() {
|
|
50955
51108
|
try {
|
|
@@ -51082,16 +51235,16 @@ var CheckpointManager = class {
|
|
|
51082
51235
|
}
|
|
51083
51236
|
};
|
|
51084
51237
|
function getAgenticDir(projectDir) {
|
|
51085
|
-
return
|
|
51238
|
+
return join22(resolve29(projectDir), ".vesk", "agentic");
|
|
51086
51239
|
}
|
|
51087
51240
|
function getHistoryPath(projectDir) {
|
|
51088
|
-
return
|
|
51241
|
+
return join22(getAgenticDir(projectDir), "history.json");
|
|
51089
51242
|
}
|
|
51090
51243
|
function getCheckpointDir(projectDir, id) {
|
|
51091
|
-
return
|
|
51244
|
+
return join22(getAgenticDir(projectDir), "checkpoints", id);
|
|
51092
51245
|
}
|
|
51093
51246
|
function getCheckpointPath(projectDir, id) {
|
|
51094
|
-
return
|
|
51247
|
+
return join22(getCheckpointDir(projectDir, id), "checkpoint.json");
|
|
51095
51248
|
}
|
|
51096
51249
|
function ensureDir(dir) {
|
|
51097
51250
|
mkdirSync15(dir, { recursive: true });
|
|
@@ -51171,7 +51324,7 @@ function createCheckpoint(projectDir, message, changes = {}, buildResult) {
|
|
|
51171
51324
|
};
|
|
51172
51325
|
const agenticDir = getAgenticDir(projectDir);
|
|
51173
51326
|
ensureDir(agenticDir);
|
|
51174
|
-
ensureDir(
|
|
51327
|
+
ensureDir(join22(agenticDir, "checkpoints"));
|
|
51175
51328
|
const cpDir = getCheckpointDir(projectDir, id);
|
|
51176
51329
|
ensureDir(cpDir);
|
|
51177
51330
|
writeJsonAtomic(getCheckpointPath(projectDir, id), checkpoint);
|
|
@@ -52676,7 +52829,7 @@ var Agent = class {
|
|
|
52676
52829
|
|
|
52677
52830
|
// ../agentic/dist/tools/vesk.js
|
|
52678
52831
|
import { existsSync as existsSync36, readFileSync as readFileSync32, writeFileSync as writeFileSync18, mkdirSync as mkdirSync17, readdirSync as readdirSync10, statSync as statSync19 } from "node:fs";
|
|
52679
|
-
import { resolve as resolve32, join as
|
|
52832
|
+
import { resolve as resolve32, join as join23, dirname as dirname23, sep as sep6 } from "node:path";
|
|
52680
52833
|
function resolveWithin3(baseDir, relPath) {
|
|
52681
52834
|
const base = resolve32(baseDir);
|
|
52682
52835
|
const target = resolve32(baseDir, relPath);
|
|
@@ -52738,7 +52891,7 @@ function findConfigFile3(projectDir) {
|
|
|
52738
52891
|
return { path: null, isTs: false };
|
|
52739
52892
|
}
|
|
52740
52893
|
function checkpointDir(veskDir) {
|
|
52741
|
-
return
|
|
52894
|
+
return join23(resolve32(veskDir), "checkpoints");
|
|
52742
52895
|
}
|
|
52743
52896
|
function findMatchingBrace2(src2, openIdx) {
|
|
52744
52897
|
let inStr = null;
|
|
@@ -53353,7 +53506,7 @@ function createVeskTools(deps) {
|
|
|
53353
53506
|
const dir = checkpointDir(veskDir);
|
|
53354
53507
|
mkdirSync17(dir, { recursive: true });
|
|
53355
53508
|
const id = `${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 8)}`;
|
|
53356
|
-
const file =
|
|
53509
|
+
const file = join23(dir, `${id}.json`);
|
|
53357
53510
|
const check = resolveWithin3(dir, `${id}.json`);
|
|
53358
53511
|
if (!check)
|
|
53359
53512
|
return jsonError("path escapes project root");
|
|
@@ -53402,7 +53555,7 @@ function createVeskTools(deps) {
|
|
|
53402
53555
|
} catch {
|
|
53403
53556
|
}
|
|
53404
53557
|
const dir = checkpointDir(veskDir);
|
|
53405
|
-
const file =
|
|
53558
|
+
const file = join23(dir, `${checkpointId}.json`);
|
|
53406
53559
|
const contained = resolveWithin3(dir, `${checkpointId}.json`);
|
|
53407
53560
|
if (!contained)
|
|
53408
53561
|
return jsonError("path escapes project root");
|
|
@@ -54124,10 +54277,10 @@ function renderDevErrorPage(payload, opts) {
|
|
|
54124
54277
|
// src/build-packages.ts
|
|
54125
54278
|
import { spawnSync as spawnSync2 } from "node:child_process";
|
|
54126
54279
|
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";
|
|
54127
|
-
import { createRequire as
|
|
54128
|
-
import { dirname as dirname25, join as
|
|
54280
|
+
import { createRequire as createRequire7 } from "node:module";
|
|
54281
|
+
import { dirname as dirname25, join as join24, resolve as resolve36 } from "node:path";
|
|
54129
54282
|
import { fileURLToPath as fileURLToPath8 } from "node:url";
|
|
54130
|
-
var require2 =
|
|
54283
|
+
var require2 = createRequire7(import.meta.url);
|
|
54131
54284
|
var __dirname9 = dirname25(fileURLToPath8(import.meta.url));
|
|
54132
54285
|
var root2 = resolve36(__dirname9, "..", "..", "..");
|
|
54133
54286
|
var PACKAGES = {
|
|
@@ -54154,7 +54307,7 @@ var PACKAGES = {
|
|
|
54154
54307
|
function newestSourceMtime(srcDir) {
|
|
54155
54308
|
let newest = 0;
|
|
54156
54309
|
for (const name of readdirSync11(srcDir)) {
|
|
54157
|
-
const p =
|
|
54310
|
+
const p = join24(srcDir, name);
|
|
54158
54311
|
const st = statSync20(p);
|
|
54159
54312
|
if (st.isDirectory()) {
|
|
54160
54313
|
newest = Math.max(newest, newestSourceMtime(p));
|
|
@@ -54165,11 +54318,11 @@ function newestSourceMtime(srcDir) {
|
|
|
54165
54318
|
return newest;
|
|
54166
54319
|
}
|
|
54167
54320
|
function distStale(pkgDir, entry) {
|
|
54168
|
-
const distIndex =
|
|
54321
|
+
const distIndex = join24(pkgDir, "dist", `${entry}.js`);
|
|
54169
54322
|
if (!existsSync40(distIndex)) return true;
|
|
54170
|
-
const distPkg =
|
|
54323
|
+
const distPkg = join24(pkgDir, "dist", "package.json");
|
|
54171
54324
|
const distStamp = Math.max(statSync20(distIndex).mtimeMs, existsSync40(distPkg) ? statSync20(distPkg).mtimeMs : 0);
|
|
54172
|
-
return newestSourceMtime(
|
|
54325
|
+
return newestSourceMtime(join24(pkgDir, "src")) > distStamp;
|
|
54173
54326
|
}
|
|
54174
54327
|
function distPackageJson(pkgName, entry, serverEntry, version2) {
|
|
54175
54328
|
const exports = {
|
|
@@ -54193,23 +54346,23 @@ function distPackageJson(pkgName, entry, serverEntry, version2) {
|
|
|
54193
54346
|
function buildPackages(force = false) {
|
|
54194
54347
|
for (const [pkg, cfg] of Object.entries(PACKAGES)) {
|
|
54195
54348
|
const pkgDir = resolve36(root2, "packages", pkg);
|
|
54196
|
-
if (!existsSync40(
|
|
54349
|
+
if (!existsSync40(join24(pkgDir, "src"))) continue;
|
|
54197
54350
|
if (!force && !distStale(pkgDir, cfg.entry)) continue;
|
|
54198
54351
|
console.log(`[build] ${cfg.name} -> tsc`);
|
|
54199
54352
|
const tscBin = require2.resolve("typescript/bin/tsc");
|
|
54200
|
-
const result = spawnSync2(process.execPath, [tscBin, "-p",
|
|
54353
|
+
const result = spawnSync2(process.execPath, [tscBin, "-p", join24(pkgDir, "tsconfig.build.json")], {
|
|
54201
54354
|
stdio: "inherit"
|
|
54202
54355
|
});
|
|
54203
54356
|
if (result.status !== 0) {
|
|
54204
54357
|
throw new Error(`tsc failed for ${cfg.name}`);
|
|
54205
54358
|
}
|
|
54206
|
-
const distDir =
|
|
54359
|
+
const distDir = join24(pkgDir, "dist");
|
|
54207
54360
|
for (const c of cfg.copy || []) {
|
|
54208
|
-
const to =
|
|
54361
|
+
const to = join24(distDir, c.to);
|
|
54209
54362
|
mkdirSync18(dirname25(to), { recursive: true });
|
|
54210
|
-
cpSync2(
|
|
54363
|
+
cpSync2(join24(pkgDir, c.from), to, { recursive: true });
|
|
54211
54364
|
}
|
|
54212
|
-
const srcPkg = JSON.parse(readFileSync36(
|
|
54365
|
+
const srcPkg = JSON.parse(readFileSync36(join24(pkgDir, "package.json"), "utf-8"));
|
|
54213
54366
|
if (pkg === "lucide-vesk") {
|
|
54214
54367
|
const lucideDistPkg = {
|
|
54215
54368
|
name: srcPkg.name,
|
|
@@ -54223,9 +54376,9 @@ function buildPackages(force = false) {
|
|
|
54223
54376
|
"./package.json": "./package.json"
|
|
54224
54377
|
}
|
|
54225
54378
|
};
|
|
54226
|
-
writeFileSync20(
|
|
54379
|
+
writeFileSync20(join24(distDir, "package.json"), JSON.stringify(lucideDistPkg, null, 2) + "\n");
|
|
54227
54380
|
} else {
|
|
54228
|
-
writeFileSync20(
|
|
54381
|
+
writeFileSync20(join24(distDir, "package.json"), distPackageJson(cfg.name, cfg.entry, cfg.serverEntry, srcPkg.version || "1.0.0"));
|
|
54229
54382
|
}
|
|
54230
54383
|
console.log(`[build] ${cfg.name} -> dist`);
|
|
54231
54384
|
}
|
|
@@ -54702,9 +54855,9 @@ function resolveRuntimeDir(projectDir) {
|
|
|
54702
54855
|
resolve38(import.meta.dirname ?? ".", "..", "..", "runtime", "dist")
|
|
54703
54856
|
];
|
|
54704
54857
|
for (const dir of candidates) {
|
|
54705
|
-
if (existsSync42(
|
|
54706
|
-
const distDir =
|
|
54707
|
-
if (existsSync42(
|
|
54858
|
+
if (existsSync42(join25(dir, "ripple-runtime.js"))) return dir;
|
|
54859
|
+
const distDir = join25(dir, "dist");
|
|
54860
|
+
if (existsSync42(join25(distDir, "ripple-runtime.js"))) return distDir;
|
|
54708
54861
|
}
|
|
54709
54862
|
return null;
|
|
54710
54863
|
}
|
|
@@ -54944,7 +55097,7 @@ function countFilesNamed(dir, name) {
|
|
|
54944
55097
|
if (!existsSync42(dir)) return 0;
|
|
54945
55098
|
let n = 0;
|
|
54946
55099
|
for (const entry of readdirSync13(dir, { withFileTypes: true })) {
|
|
54947
|
-
const p =
|
|
55100
|
+
const p = join25(dir, entry.name);
|
|
54948
55101
|
if (entry.isDirectory()) n += countFilesNamed(p, name);
|
|
54949
55102
|
else if (entry.name === name) n++;
|
|
54950
55103
|
}
|
|
@@ -54987,7 +55140,7 @@ async function startDevServer(port, projectDir, config, host) {
|
|
|
54987
55140
|
process.exit(1);
|
|
54988
55141
|
}
|
|
54989
55142
|
const runtimeDir = runtimeDirUnchecked;
|
|
54990
|
-
const veskStateDir =
|
|
55143
|
+
const veskStateDir = join25(projectDir, ".vesk");
|
|
54991
55144
|
const configPluginsRaw = config.plugins || [];
|
|
54992
55145
|
const configPluginNames = configPluginsRaw.map((p) => typeof p === "string" ? p : p?.name).filter((n) => !!n);
|
|
54993
55146
|
const rawDevPlugins = config.plugins || [];
|
|
@@ -55086,10 +55239,10 @@ async function startDevServer(port, projectDir, config, host) {
|
|
|
55086
55239
|
}
|
|
55087
55240
|
let devGlobalCssContent = "";
|
|
55088
55241
|
let lastServedCssGlobal = "";
|
|
55089
|
-
const appCssPath =
|
|
55090
|
-
const srcDir =
|
|
55091
|
-
const cssPath =
|
|
55092
|
-
const altCssPath =
|
|
55242
|
+
const appCssPath = join25(appDirPath, "global.css");
|
|
55243
|
+
const srcDir = join25(projectDir, "src");
|
|
55244
|
+
const cssPath = join25(srcDir, "global.css");
|
|
55245
|
+
const altCssPath = join25(srcDir, "app.css");
|
|
55093
55246
|
let rawCss = "";
|
|
55094
55247
|
let devCssSource = "";
|
|
55095
55248
|
if (existsSync42(appCssPath)) {
|
|
@@ -55376,7 +55529,7 @@ async function startDevServer(port, projectDir, config, host) {
|
|
|
55376
55529
|
if (!filename) return;
|
|
55377
55530
|
const kind = classifyHmrWatchPath(filename);
|
|
55378
55531
|
if (kind === "ignored") return;
|
|
55379
|
-
const fullPath = filename.startsWith("/") ? filename :
|
|
55532
|
+
const fullPath = filename.startsWith("/") ? filename : join25(watchDir, filename);
|
|
55380
55533
|
const fileExists = existsSync42(fullPath);
|
|
55381
55534
|
const bcast = (msg) => {
|
|
55382
55535
|
const f = globalThis.__vesk_broadcastHmr;
|
|
@@ -55591,8 +55744,8 @@ Object.defineProperty(__components, ${JSON.stringify(cname)}, { get: () => __com
|
|
|
55591
55744
|
".json": "application/json",
|
|
55592
55745
|
".webmanifest": "application/manifest+json"
|
|
55593
55746
|
};
|
|
55594
|
-
const hmrJsPath =
|
|
55595
|
-
const hmrTsPath =
|
|
55747
|
+
const hmrJsPath = join25(runtimeDir, "hmr-client.js");
|
|
55748
|
+
const hmrTsPath = join25(runtimeDir, "hmr-client.ts");
|
|
55596
55749
|
const hmrClientPath = existsSync42(hmrJsPath) ? hmrJsPath : existsSync42(hmrTsPath) ? hmrTsPath : null;
|
|
55597
55750
|
function extractCompName2(src2) {
|
|
55598
55751
|
return resolveComponentName(src2);
|
|
@@ -55764,7 +55917,7 @@ Object.defineProperty(__components, ${JSON.stringify(cname)}, { get: () => __com
|
|
|
55764
55917
|
return;
|
|
55765
55918
|
}
|
|
55766
55919
|
const mwChain = collectMiddlewareChain(routeTree, url.pathname, appDirPath);
|
|
55767
|
-
const apiDirPath =
|
|
55920
|
+
const apiDirPath = join25(appDirPath, "api");
|
|
55768
55921
|
if (url.pathname.startsWith("/api") && existsSync42(apiDirPath)) {
|
|
55769
55922
|
const apiRoutes = await scanApiRoutes(apiDirPath);
|
|
55770
55923
|
const apiMatch = matchApiUrl(apiRoutes, req.url || url.pathname);
|
|
@@ -56256,7 +56409,7 @@ ${prettifyHtml(body)}
|
|
|
56256
56409
|
LOG.ok(`dev server at http://localhost:${port} (listening on ${bindHost})`);
|
|
56257
56410
|
const routes = collectRoutePaths(routeTree);
|
|
56258
56411
|
const pageCount = countPages(routeTree);
|
|
56259
|
-
const apiCount = countFilesNamed(
|
|
56412
|
+
const apiCount = countFilesNamed(join25(appDirPath, "api"), "route.ts");
|
|
56260
56413
|
LOG.info(`${projectDir}`);
|
|
56261
56414
|
LOG.info(`${pageCount} page${pageCount === 1 ? "" : "s"}: ${routes.join(", ") || "(none)"}`);
|
|
56262
56415
|
if (apiCount > 0) LOG.info(`${apiCount} api route${apiCount === 1 ? "" : "s"} (app/api)`);
|
|
@@ -56568,8 +56721,8 @@ if (args.length === 0 || args.includes("--help") || args.includes("-h")) {
|
|
|
56568
56721
|
}
|
|
56569
56722
|
function loadEnvFiles(projectDir) {
|
|
56570
56723
|
const files = [
|
|
56571
|
-
|
|
56572
|
-
|
|
56724
|
+
join27(projectDir, ".env"),
|
|
56725
|
+
join27(projectDir, ".env.local")
|
|
56573
56726
|
];
|
|
56574
56727
|
for (const filePath of files) {
|
|
56575
56728
|
if (!existsSync43(filePath)) continue;
|
|
@@ -56740,7 +56893,7 @@ if (cmd === "start") {
|
|
|
56740
56893
|
if (cmd === "init") {
|
|
56741
56894
|
const projectDir = process.cwd();
|
|
56742
56895
|
const { appDir: appDirPath } = resolveProjectDirs(projectDir, await loadConfig(projectDir) || {});
|
|
56743
|
-
const target =
|
|
56896
|
+
const target = join27(appDirPath, "global.css");
|
|
56744
56897
|
if (existsSync43(target)) {
|
|
56745
56898
|
console.error(`vesk init: ${target} already exists \u2014 skipping`);
|
|
56746
56899
|
process.exit(0);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vesk/vesk-cli",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.47",
|
|
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.
|
|
12
|
-
"@vesk/compiler": "^0.2.
|
|
13
|
-
"@vesk/plugin-tailwind": "^0.2.
|
|
14
|
-
"@vesk/runtime": "^0.2.
|
|
11
|
+
"@vesk/adapter": "^0.2.47",
|
|
12
|
+
"@vesk/compiler": "^0.2.47",
|
|
13
|
+
"@vesk/plugin-tailwind": "^0.2.47",
|
|
14
|
+
"@vesk/runtime": "^0.2.47",
|
|
15
15
|
"esrap": "^2.3.0",
|
|
16
16
|
"typescript": "^5.8.0",
|
|
17
17
|
"ws": "^8.18.0",
|