@vesk/vesk-cli 0.2.72 → 0.2.74
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 +748 -380
- package/package.json +5 -5
package/dist/cli.js
CHANGED
|
@@ -1081,8 +1081,8 @@ function run_teardown(block2) {
|
|
|
1081
1081
|
}
|
|
1082
1082
|
function on_destroy(fn) {
|
|
1083
1083
|
const block2 = scope();
|
|
1084
|
-
if (block2
|
|
1085
|
-
if (block2.tc
|
|
1084
|
+
if (block2 == null) return;
|
|
1085
|
+
if (block2.tc == null) block2.tc = [];
|
|
1086
1086
|
block2.tc.push(fn);
|
|
1087
1087
|
}
|
|
1088
1088
|
function with_block(block2, fn) {
|
|
@@ -2094,7 +2094,7 @@ async function runFetcher(handle2, timeout) {
|
|
|
2094
2094
|
}
|
|
2095
2095
|
}
|
|
2096
2096
|
function sleep(ms) {
|
|
2097
|
-
return new Promise((
|
|
2097
|
+
return new Promise((resolve42) => setTimeout(resolve42, ms));
|
|
2098
2098
|
}
|
|
2099
2099
|
function streamText(res, into, onChunk) {
|
|
2100
2100
|
const decoder = new TextDecoder();
|
|
@@ -2896,12 +2896,12 @@ function hydrateViewport(container, componentFn, props, rootMargin = 500, option
|
|
|
2896
2896
|
let cancelled = false;
|
|
2897
2897
|
let cancelFn = () => {
|
|
2898
2898
|
};
|
|
2899
|
-
const promise = new Promise((
|
|
2899
|
+
const promise = new Promise((resolve42) => {
|
|
2900
2900
|
const finish = () => {
|
|
2901
2901
|
cancelled = true;
|
|
2902
2902
|
cancelFn = () => {
|
|
2903
2903
|
};
|
|
2904
|
-
|
|
2904
|
+
resolve42();
|
|
2905
2905
|
};
|
|
2906
2906
|
cancelFn = finish;
|
|
2907
2907
|
if (!batchAlive(container, epoch, isCurrent)) return finish();
|
|
@@ -4422,7 +4422,8 @@ function usePathname() {
|
|
|
4422
4422
|
return get(_state.path);
|
|
4423
4423
|
}
|
|
4424
4424
|
function useSearchParams() {
|
|
4425
|
-
const
|
|
4425
|
+
const routed = get(_state.search);
|
|
4426
|
+
const s = routed || (typeof window !== "undefined" && window.location?.search ? window.location.search.replace(/^\?/, "") : "");
|
|
4426
4427
|
const sp = new URLSearchParams(s || "");
|
|
4427
4428
|
const setter = (next) => {
|
|
4428
4429
|
const q = typeof next === "string" ? next : new URLSearchParams(next).toString();
|
|
@@ -4616,7 +4617,7 @@ function ensureChunk(chunkUrl) {
|
|
|
4616
4617
|
if (typeof document === "undefined" || typeof document.createElement !== "function") {
|
|
4617
4618
|
return Promise.resolve();
|
|
4618
4619
|
}
|
|
4619
|
-
const promise = new Promise((
|
|
4620
|
+
const promise = new Promise((resolve42, reject) => {
|
|
4620
4621
|
const s = document.createElement("script");
|
|
4621
4622
|
s.src = chunkUrl;
|
|
4622
4623
|
let settled = false;
|
|
@@ -4635,7 +4636,7 @@ function ensureChunk(chunkUrl) {
|
|
|
4635
4636
|
loadedChunks.add(chunkUrl);
|
|
4636
4637
|
inFlightChunks.delete(chunkUrl);
|
|
4637
4638
|
failedChunks.delete(chunkUrl);
|
|
4638
|
-
|
|
4639
|
+
resolve42();
|
|
4639
4640
|
};
|
|
4640
4641
|
s.onerror = () => {
|
|
4641
4642
|
fail(new Error(`Failed to load chunk: ${chunkUrl}`));
|
|
@@ -4839,6 +4840,7 @@ async function renderNotFound(router, match, container) {
|
|
|
4839
4840
|
} else if (typeof nfDom === "string") {
|
|
4840
4841
|
container.innerHTML = nfDom;
|
|
4841
4842
|
}
|
|
4843
|
+
router._currentMatch = match;
|
|
4842
4844
|
return;
|
|
4843
4845
|
}
|
|
4844
4846
|
if (container.replaceChildren) container.replaceChildren();
|
|
@@ -5323,12 +5325,14 @@ function clearOfflineFlag(router, container) {
|
|
|
5323
5325
|
router._showingOffline = false;
|
|
5324
5326
|
if (container) container.__veskNetworkUI = false;
|
|
5325
5327
|
}
|
|
5326
|
-
async function renderErrorPage(router, match, container, error) {
|
|
5328
|
+
async function renderErrorPage(router, match, container, error, navToken) {
|
|
5329
|
+
const stale = () => navToken !== void 0 && (router._navToken || 0) !== navToken;
|
|
5327
5330
|
clearOfflineFlag(router, container);
|
|
5328
5331
|
const chain = match.matchChain;
|
|
5329
5332
|
const paramValues = match.params;
|
|
5330
5333
|
const errorFn = findErrorComponent(chain);
|
|
5331
5334
|
if (!errorFn) {
|
|
5335
|
+
if (stale()) return;
|
|
5332
5336
|
if (container.replaceChildren) container.replaceChildren();
|
|
5333
5337
|
else container.innerHTML = "";
|
|
5334
5338
|
container.innerHTML = defaultErrorHtml(500, "Internal Server Error");
|
|
@@ -5371,6 +5375,7 @@ async function renderErrorPage(router, match, container, error) {
|
|
|
5371
5375
|
return result;
|
|
5372
5376
|
};
|
|
5373
5377
|
const dom = await runInBlockWindow(() => renderErrorChain(0));
|
|
5378
|
+
if (stale()) return;
|
|
5374
5379
|
if (dom && typeof dom === "object" && dom.nodeType) {
|
|
5375
5380
|
if (container.replaceChildren) container.replaceChildren(dom);
|
|
5376
5381
|
else {
|
|
@@ -5382,6 +5387,7 @@ async function renderErrorPage(router, match, container, error) {
|
|
|
5382
5387
|
}
|
|
5383
5388
|
}
|
|
5384
5389
|
async function hydrateInitial(router, match, container, strategy) {
|
|
5390
|
+
const hydrationNavToken = router._navToken || 0;
|
|
5385
5391
|
const chain = match.matchChain;
|
|
5386
5392
|
const paramValues = match.params;
|
|
5387
5393
|
let pageNode = findPageNodeOrFailed(match);
|
|
@@ -5422,7 +5428,7 @@ async function hydrateInitial(router, match, container, strategy) {
|
|
|
5422
5428
|
} catch {
|
|
5423
5429
|
}
|
|
5424
5430
|
}
|
|
5425
|
-
await renderErrorPage(router, match, container, makeSsrError(message));
|
|
5431
|
+
await renderErrorPage(router, match, container, makeSsrError(message), hydrationNavToken);
|
|
5426
5432
|
return;
|
|
5427
5433
|
}
|
|
5428
5434
|
const layoutNodes = chain.filter((n) => n.layout);
|
|
@@ -5446,7 +5452,8 @@ async function hydrateInitial(router, match, container, strategy) {
|
|
|
5446
5452
|
router,
|
|
5447
5453
|
match,
|
|
5448
5454
|
container,
|
|
5449
|
-
chunkErr || new Error(`Component "${pageNode._pageName}" is unavailable`)
|
|
5455
|
+
chunkErr || new Error(`Component "${pageNode._pageName}" is unavailable`),
|
|
5456
|
+
hydrationNavToken
|
|
5450
5457
|
);
|
|
5451
5458
|
return;
|
|
5452
5459
|
}
|
|
@@ -5541,7 +5548,7 @@ async function hydrateInitial(router, match, container, strategy) {
|
|
|
5541
5548
|
try {
|
|
5542
5549
|
await renderMatch(router, match, container);
|
|
5543
5550
|
} catch (err2) {
|
|
5544
|
-
await renderErrorPage(router, match, container, err2);
|
|
5551
|
+
await renderErrorPage(router, match, container, err2, hydrationNavToken);
|
|
5545
5552
|
}
|
|
5546
5553
|
}
|
|
5547
5554
|
}
|
|
@@ -6153,7 +6160,7 @@ function createFileRouter(routeTree, options = {}) {
|
|
|
6153
6160
|
looksOffline().then((offline) => {
|
|
6154
6161
|
navDebug("handleNavFailure verdict", offline ? "offline" : "online");
|
|
6155
6162
|
if (offline) return void renderOfflinePage(router, match, container);
|
|
6156
|
-
return void renderErrorPage(router, match, container, err);
|
|
6163
|
+
return void renderErrorPage(router, match, container, err, navToken);
|
|
6157
6164
|
}).catch(() => {
|
|
6158
6165
|
});
|
|
6159
6166
|
};
|
|
@@ -6370,7 +6377,7 @@ var init_router = __esm({
|
|
|
6370
6377
|
loadedChunks = /* @__PURE__ */ new Set();
|
|
6371
6378
|
failedChunks = /* @__PURE__ */ new Map();
|
|
6372
6379
|
inFlightChunks = /* @__PURE__ */ new Map();
|
|
6373
|
-
CHUNK_LOAD_TIMEOUT_MS = 1e4;
|
|
6380
|
+
CHUNK_LOAD_TIMEOUT_MS = typeof window !== "undefined" && Number(window.__vesk_chunk_timeout_ms) || 1e4;
|
|
6374
6381
|
_dataPromises = /* @__PURE__ */ new Map();
|
|
6375
6382
|
PAGE_START_MARKER = "vesk:page";
|
|
6376
6383
|
PAGE_END_MARKER = "/vesk:page";
|
|
@@ -20594,7 +20601,9 @@ function resolveVskTarget(target, sourcePath2) {
|
|
|
20594
20601
|
return existsSync3(full) ? full : null;
|
|
20595
20602
|
}
|
|
20596
20603
|
const aliased = resolveImportPath(target, dirname3(sourcePath2));
|
|
20597
|
-
|
|
20604
|
+
if (aliased !== target && existsSync3(aliased)) return aliased;
|
|
20605
|
+
const published = resolveSsrModule(target, dirname3(sourcePath2));
|
|
20606
|
+
return published !== null && published.endsWith(".vsk") && existsSync3(published) ? published : null;
|
|
20598
20607
|
}
|
|
20599
20608
|
function vskImportValueNames(imports) {
|
|
20600
20609
|
const names = [];
|
|
@@ -20670,6 +20679,30 @@ var init_vsk_imports = __esm({
|
|
|
20670
20679
|
});
|
|
20671
20680
|
|
|
20672
20681
|
// ../compiler/src/ir-generator.ts
|
|
20682
|
+
function resolveNamedTypeText(text) {
|
|
20683
|
+
if (!text || !__typeTexts || __typeTexts.size === 0) return text;
|
|
20684
|
+
let t = text.trim();
|
|
20685
|
+
for (let i = 0; i < 8; i++) {
|
|
20686
|
+
if (!/^[A-Za-z_$][\w$]*$/.test(t)) return t;
|
|
20687
|
+
const next = __typeTexts.get(t);
|
|
20688
|
+
if (!next || next === t) return t;
|
|
20689
|
+
t = next.trim();
|
|
20690
|
+
}
|
|
20691
|
+
return t;
|
|
20692
|
+
}
|
|
20693
|
+
function collectTypeTexts(ast, source) {
|
|
20694
|
+
const out = /* @__PURE__ */ new Map();
|
|
20695
|
+
for (const node of ast?.body || []) {
|
|
20696
|
+
const decl = (node.type === "ExportNamedDeclaration" || node.type === "ExportDefaultDeclaration") && node.declaration ? node.declaration : node;
|
|
20697
|
+
if (decl?.type !== "TSInterfaceDeclaration" && decl?.type !== "TSTypeAliasDeclaration") continue;
|
|
20698
|
+
const name = decl.id?.name;
|
|
20699
|
+
if (!name) continue;
|
|
20700
|
+
const typeNode = decl.type === "TSInterfaceDeclaration" ? decl.body : decl.typeAnnotation;
|
|
20701
|
+
if (!typeNode || typeof typeNode.start !== "number" || typeof typeNode.end !== "number") continue;
|
|
20702
|
+
out.set(name, source.slice(typeNode.start, typeNode.end).trim());
|
|
20703
|
+
}
|
|
20704
|
+
return out;
|
|
20705
|
+
}
|
|
20673
20706
|
function parseExprNode(text) {
|
|
20674
20707
|
try {
|
|
20675
20708
|
const ParserClass = createBaseParser();
|
|
@@ -21310,18 +21343,48 @@ function slotReadPropName(expr) {
|
|
|
21310
21343
|
}
|
|
21311
21344
|
return null;
|
|
21312
21345
|
}
|
|
21346
|
+
function splitTypeMembers(text) {
|
|
21347
|
+
const parts = [];
|
|
21348
|
+
let depth = 0;
|
|
21349
|
+
let last = 0;
|
|
21350
|
+
let i = 0;
|
|
21351
|
+
while (i < text.length) {
|
|
21352
|
+
const c = text[i];
|
|
21353
|
+
if (c === '"' || c === "'" || c === "`") {
|
|
21354
|
+
i = skipString(text, i);
|
|
21355
|
+
continue;
|
|
21356
|
+
}
|
|
21357
|
+
if (c === "/" && (text[i + 1] === "/" || text[i + 1] === "*")) {
|
|
21358
|
+
i = skipComment(text, i);
|
|
21359
|
+
continue;
|
|
21360
|
+
}
|
|
21361
|
+
if (c === "(" || c === "[" || c === "{" || c === "<") depth++;
|
|
21362
|
+
else if (c === ")" || c === "]" || c === "}" || c === ">") {
|
|
21363
|
+
if (depth > 0) depth--;
|
|
21364
|
+
} else if (depth === 0 && (c === ";" || c === "\n")) {
|
|
21365
|
+
parts.push(text.slice(last, i));
|
|
21366
|
+
last = i + 1;
|
|
21367
|
+
i++;
|
|
21368
|
+
continue;
|
|
21369
|
+
}
|
|
21370
|
+
i++;
|
|
21371
|
+
}
|
|
21372
|
+
parts.push(text.slice(last));
|
|
21373
|
+
return parts;
|
|
21374
|
+
}
|
|
21313
21375
|
function slotPropNamesFromType(propsType) {
|
|
21314
21376
|
const out = /* @__PURE__ */ new Set();
|
|
21315
21377
|
if (!propsType) return out;
|
|
21316
21378
|
const trimmed = propsType.trim();
|
|
21317
21379
|
if (trimmed.startsWith("{")) {
|
|
21318
21380
|
const inner = findBalancedEnd(trimmed, 0) === trimmed.length - 1 ? trimmed.slice(1, -1) : trimmed;
|
|
21319
|
-
|
|
21381
|
+
const members = splitTypeMembers(inner);
|
|
21382
|
+
for (const part of members) {
|
|
21320
21383
|
const colon = findTopLevelColon(part);
|
|
21321
21384
|
if (colon === -1) continue;
|
|
21322
|
-
const namePart = part.slice(0, colon).trim().replace(/^\$/, "").replace(/\?$/, "").trim();
|
|
21385
|
+
const namePart = part.slice(0, colon).trim().replace(/^readonly\s+/, "").replace(/^\$/, "").replace(/\?$/, "").trim();
|
|
21323
21386
|
const typePart = part.slice(colon + 1).trim();
|
|
21324
|
-
if (namePart && typePart.includes("Component")) out.add(namePart);
|
|
21387
|
+
if (namePart && /^[A-Za-z_$][\w$]*$/.test(namePart) && typePart.includes("Component")) out.add(namePart);
|
|
21325
21388
|
}
|
|
21326
21389
|
}
|
|
21327
21390
|
return out;
|
|
@@ -22199,6 +22262,7 @@ function collectIdentifiers(node, into) {
|
|
|
22199
22262
|
function generateIR(ast, source, filename) {
|
|
22200
22263
|
__vskAnnotations = ast.__vskAnnotations ?? [];
|
|
22201
22264
|
__slotProps = null;
|
|
22265
|
+
__typeTexts = collectTypeTexts(ast, source);
|
|
22202
22266
|
const file = filename || "";
|
|
22203
22267
|
const components = [];
|
|
22204
22268
|
const imports = [];
|
|
@@ -22341,7 +22405,7 @@ function generateIR(ast, source, filename) {
|
|
|
22341
22405
|
const bodyStmts = inner.body.body;
|
|
22342
22406
|
const isClientComp = !!inner.client;
|
|
22343
22407
|
const prevSlotProps = __slotProps;
|
|
22344
|
-
__slotProps = slotPropNamesFromType(propsType);
|
|
22408
|
+
__slotProps = slotPropNamesFromType(resolveNamedTypeText(propsType));
|
|
22345
22409
|
__propsParam = propsAlias || null;
|
|
22346
22410
|
if (isStatementMode(bodyStmts)) {
|
|
22347
22411
|
const raw2 = processStatementModeBody(source, bodyStmts, file);
|
|
@@ -22496,7 +22560,7 @@ function generateIR(ast, source, filename) {
|
|
|
22496
22560
|
currentComponentCallHelpers = null;
|
|
22497
22561
|
}
|
|
22498
22562
|
}
|
|
22499
|
-
var __vskAnnotations, __slotProps, __propsParam, currentVskNamespaceLocals, currentSourceFile, currentComponentValues, currentFileComponentNames, currentFileValueBindings, currentImportedNames, currentComponentCallHelpers;
|
|
22563
|
+
var __vskAnnotations, __slotProps, __typeTexts, __propsParam, currentVskNamespaceLocals, currentSourceFile, currentComponentValues, currentFileComponentNames, currentFileValueBindings, currentImportedNames, currentComponentCallHelpers;
|
|
22500
22564
|
var init_ir_generator = __esm({
|
|
22501
22565
|
"../compiler/src/ir-generator.ts"() {
|
|
22502
22566
|
"use strict";
|
|
@@ -22510,6 +22574,7 @@ var init_ir_generator = __esm({
|
|
|
22510
22574
|
init_tokens();
|
|
22511
22575
|
__vskAnnotations = [];
|
|
22512
22576
|
__slotProps = null;
|
|
22577
|
+
__typeTexts = null;
|
|
22513
22578
|
__propsParam = null;
|
|
22514
22579
|
currentVskNamespaceLocals = null;
|
|
22515
22580
|
currentComponentValues = null;
|
|
@@ -29947,7 +30012,7 @@ is not a problem with esbuild. You need to fix your environment instead.
|
|
|
29947
30012
|
let latestResultPromise;
|
|
29948
30013
|
let provideLatestResult;
|
|
29949
30014
|
if (isContext)
|
|
29950
|
-
requestCallbacks["on-end"] = (id, request2) => new Promise((
|
|
30015
|
+
requestCallbacks["on-end"] = (id, request2) => new Promise((resolve42) => {
|
|
29951
30016
|
buildResponseToResult(request2, (err, result, onEndErrors, onEndWarnings) => {
|
|
29952
30017
|
const response = {
|
|
29953
30018
|
errors: onEndErrors,
|
|
@@ -29957,7 +30022,7 @@ is not a problem with esbuild. You need to fix your environment instead.
|
|
|
29957
30022
|
latestResultPromise = void 0;
|
|
29958
30023
|
provideLatestResult = void 0;
|
|
29959
30024
|
sendResponse(id, response);
|
|
29960
|
-
|
|
30025
|
+
resolve42();
|
|
29961
30026
|
});
|
|
29962
30027
|
});
|
|
29963
30028
|
sendRequest(refs, request, (error, response) => {
|
|
@@ -29974,10 +30039,10 @@ is not a problem with esbuild. You need to fix your environment instead.
|
|
|
29974
30039
|
let didDispose = false;
|
|
29975
30040
|
const result = {
|
|
29976
30041
|
rebuild: () => {
|
|
29977
|
-
if (!latestResultPromise) latestResultPromise = new Promise((
|
|
30042
|
+
if (!latestResultPromise) latestResultPromise = new Promise((resolve42, reject) => {
|
|
29978
30043
|
let settlePromise;
|
|
29979
30044
|
provideLatestResult = (err, result2) => {
|
|
29980
|
-
if (!settlePromise) settlePromise = () => err ? reject(err) :
|
|
30045
|
+
if (!settlePromise) settlePromise = () => err ? reject(err) : resolve42(result2);
|
|
29981
30046
|
};
|
|
29982
30047
|
const triggerAnotherBuild = () => {
|
|
29983
30048
|
const request2 = {
|
|
@@ -29998,7 +30063,7 @@ is not a problem with esbuild. You need to fix your environment instead.
|
|
|
29998
30063
|
});
|
|
29999
30064
|
return latestResultPromise;
|
|
30000
30065
|
},
|
|
30001
|
-
watch: (options2 = {}) => new Promise((
|
|
30066
|
+
watch: (options2 = {}) => new Promise((resolve42, reject) => {
|
|
30002
30067
|
if (!streamIn.hasFS) throw new Error(`Cannot use the "watch" API in this environment`);
|
|
30003
30068
|
const keys = {};
|
|
30004
30069
|
const delay = getFlag(options2, keys, "delay", mustBeInteger);
|
|
@@ -30010,10 +30075,10 @@ is not a problem with esbuild. You need to fix your environment instead.
|
|
|
30010
30075
|
if (delay) request2.delay = delay;
|
|
30011
30076
|
sendRequest(refs, request2, (error2) => {
|
|
30012
30077
|
if (error2) reject(new Error(error2));
|
|
30013
|
-
else
|
|
30078
|
+
else resolve42(void 0);
|
|
30014
30079
|
});
|
|
30015
30080
|
}),
|
|
30016
|
-
serve: (options2 = {}) => new Promise((
|
|
30081
|
+
serve: (options2 = {}) => new Promise((resolve42, reject) => {
|
|
30017
30082
|
if (!streamIn.hasFS) throw new Error(`Cannot use the "serve" API in this environment`);
|
|
30018
30083
|
const keys = {};
|
|
30019
30084
|
const port = getFlag(options2, keys, "port", mustBeValidPortNumber);
|
|
@@ -30051,28 +30116,28 @@ is not a problem with esbuild. You need to fix your environment instead.
|
|
|
30051
30116
|
sendResponse(id, {});
|
|
30052
30117
|
};
|
|
30053
30118
|
}
|
|
30054
|
-
|
|
30119
|
+
resolve42(response2);
|
|
30055
30120
|
});
|
|
30056
30121
|
}),
|
|
30057
|
-
cancel: () => new Promise((
|
|
30058
|
-
if (didDispose) return
|
|
30122
|
+
cancel: () => new Promise((resolve42) => {
|
|
30123
|
+
if (didDispose) return resolve42();
|
|
30059
30124
|
const request2 = {
|
|
30060
30125
|
command: "cancel",
|
|
30061
30126
|
key: buildKey
|
|
30062
30127
|
};
|
|
30063
30128
|
sendRequest(refs, request2, () => {
|
|
30064
|
-
|
|
30129
|
+
resolve42();
|
|
30065
30130
|
});
|
|
30066
30131
|
}),
|
|
30067
|
-
dispose: () => new Promise((
|
|
30068
|
-
if (didDispose) return
|
|
30132
|
+
dispose: () => new Promise((resolve42) => {
|
|
30133
|
+
if (didDispose) return resolve42();
|
|
30069
30134
|
didDispose = true;
|
|
30070
30135
|
const request2 = {
|
|
30071
30136
|
command: "dispose",
|
|
30072
30137
|
key: buildKey
|
|
30073
30138
|
};
|
|
30074
30139
|
sendRequest(refs, request2, () => {
|
|
30075
|
-
|
|
30140
|
+
resolve42();
|
|
30076
30141
|
scheduleOnDisposeCallbacks();
|
|
30077
30142
|
refs.unref();
|
|
30078
30143
|
});
|
|
@@ -30111,7 +30176,7 @@ is not a problem with esbuild. You need to fix your environment instead.
|
|
|
30111
30176
|
onLoad: []
|
|
30112
30177
|
};
|
|
30113
30178
|
i++;
|
|
30114
|
-
let
|
|
30179
|
+
let resolve42 = (path3, options = {}) => {
|
|
30115
30180
|
if (!isSetupDone) throw new Error('Cannot call "resolve" before plugin setup has completed');
|
|
30116
30181
|
if (typeof path3 !== "string") throw new Error(`The path to resolve must be a string`);
|
|
30117
30182
|
let keys2 = /* @__PURE__ */ Object.create(null);
|
|
@@ -30155,7 +30220,7 @@ is not a problem with esbuild. You need to fix your environment instead.
|
|
|
30155
30220
|
};
|
|
30156
30221
|
let promise = setup({
|
|
30157
30222
|
initialOptions,
|
|
30158
|
-
resolve:
|
|
30223
|
+
resolve: resolve42,
|
|
30159
30224
|
onStart(callback) {
|
|
30160
30225
|
let registeredText = `This error came from the "onStart" callback registered here:`;
|
|
30161
30226
|
let registeredNote = extractCallerV8(new Error(registeredText), streamIn, "onStart");
|
|
@@ -30848,46 +30913,46 @@ More information: The file containing the code for esbuild's JavaScript API (${_
|
|
|
30848
30913
|
}
|
|
30849
30914
|
};
|
|
30850
30915
|
longLivedService = {
|
|
30851
|
-
build: (options) => new Promise((
|
|
30916
|
+
build: (options) => new Promise((resolve42, reject) => {
|
|
30852
30917
|
service.buildOrContext({
|
|
30853
30918
|
callName: "build",
|
|
30854
30919
|
refs,
|
|
30855
30920
|
options,
|
|
30856
30921
|
isTTY: isTTY(),
|
|
30857
30922
|
defaultWD,
|
|
30858
|
-
callback: (err, res) => err ? reject(err) :
|
|
30923
|
+
callback: (err, res) => err ? reject(err) : resolve42(res)
|
|
30859
30924
|
});
|
|
30860
30925
|
}),
|
|
30861
|
-
context: (options) => new Promise((
|
|
30926
|
+
context: (options) => new Promise((resolve42, reject) => service.buildOrContext({
|
|
30862
30927
|
callName: "context",
|
|
30863
30928
|
refs,
|
|
30864
30929
|
options,
|
|
30865
30930
|
isTTY: isTTY(),
|
|
30866
30931
|
defaultWD,
|
|
30867
|
-
callback: (err, res) => err ? reject(err) :
|
|
30932
|
+
callback: (err, res) => err ? reject(err) : resolve42(res)
|
|
30868
30933
|
})),
|
|
30869
|
-
transform: (input, options) => new Promise((
|
|
30934
|
+
transform: (input, options) => new Promise((resolve42, reject) => service.transform({
|
|
30870
30935
|
callName: "transform",
|
|
30871
30936
|
refs,
|
|
30872
30937
|
input,
|
|
30873
30938
|
options: options || {},
|
|
30874
30939
|
isTTY: isTTY(),
|
|
30875
30940
|
fs: fsAsync,
|
|
30876
|
-
callback: (err, res) => err ? reject(err) :
|
|
30941
|
+
callback: (err, res) => err ? reject(err) : resolve42(res)
|
|
30877
30942
|
})),
|
|
30878
|
-
formatMessages: (messages, options) => new Promise((
|
|
30943
|
+
formatMessages: (messages, options) => new Promise((resolve42, reject) => service.formatMessages({
|
|
30879
30944
|
callName: "formatMessages",
|
|
30880
30945
|
refs,
|
|
30881
30946
|
messages,
|
|
30882
30947
|
options,
|
|
30883
|
-
callback: (err, res) => err ? reject(err) :
|
|
30948
|
+
callback: (err, res) => err ? reject(err) : resolve42(res)
|
|
30884
30949
|
})),
|
|
30885
|
-
analyzeMetafile: (metafile, options) => new Promise((
|
|
30950
|
+
analyzeMetafile: (metafile, options) => new Promise((resolve42, reject) => service.analyzeMetafile({
|
|
30886
30951
|
callName: "analyzeMetafile",
|
|
30887
30952
|
refs,
|
|
30888
30953
|
metafile: typeof metafile === "string" ? metafile : JSON.stringify(metafile),
|
|
30889
30954
|
options,
|
|
30890
|
-
callback: (err, res) => err ? reject(err) :
|
|
30955
|
+
callback: (err, res) => err ? reject(err) : resolve42(res)
|
|
30891
30956
|
}))
|
|
30892
30957
|
};
|
|
30893
30958
|
return longLivedService;
|
|
@@ -30965,13 +31030,13 @@ error: ${text}`);
|
|
|
30965
31030
|
worker.postMessage(msg);
|
|
30966
31031
|
let status = Atomics.wait(sharedBufferView, 0, 0);
|
|
30967
31032
|
if (status !== "ok" && status !== "not-equal") throw new Error("Internal error: Atomics.wait() failed: " + status);
|
|
30968
|
-
let { message: { id: id2, resolve:
|
|
31033
|
+
let { message: { id: id2, resolve: resolve42, reject, properties } } = worker_threads2.receiveMessageOnPort(mainPort);
|
|
30969
31034
|
if (id !== id2) throw new Error(`Internal error: Expected id ${id} but got id ${id2}`);
|
|
30970
31035
|
if (reject) {
|
|
30971
31036
|
applyProperties(reject, properties);
|
|
30972
31037
|
throw reject;
|
|
30973
31038
|
}
|
|
30974
|
-
return
|
|
31039
|
+
return resolve42;
|
|
30975
31040
|
};
|
|
30976
31041
|
worker.unref();
|
|
30977
31042
|
return {
|
|
@@ -31856,8 +31921,19 @@ function emitStatic(ctx2, node, tracked2, effectsVar, skipK = 0, regionBudget) {
|
|
|
31856
31921
|
let childVar;
|
|
31857
31922
|
const isPureStaticChild = ctx2.hydrate && child instanceof StaticNode && isStaticIR(child.children);
|
|
31858
31923
|
if (isPureStaticChild) {
|
|
31859
|
-
const
|
|
31860
|
-
|
|
31924
|
+
const savedHydrate = ctx2.hydrate;
|
|
31925
|
+
ctx2.hydrate = false;
|
|
31926
|
+
const buildStart = ctx2.lines.length;
|
|
31927
|
+
const freshChild = emitStatic(ctx2, child, tracked2, effectsVar);
|
|
31928
|
+
const buildLines = ctx2.lines.splice(buildStart, ctx2.lines.length - buildStart);
|
|
31929
|
+
ctx2.hydrate = savedHydrate;
|
|
31930
|
+
const childSlot = ctx2.n();
|
|
31931
|
+
ctx2.push(`const ${childSlot} = ${el}.__vsk_ssrEls ? ${el}.__vsk_ssrEls[${residueBefore}] : (() => {`);
|
|
31932
|
+
for (const line of buildLines) ctx2.push(` ${line}`);
|
|
31933
|
+
ctx2.push(` return ${freshChild ?? "document.createElement('div')"};`);
|
|
31934
|
+
ctx2.push(`})();`);
|
|
31935
|
+
childVar = childSlot;
|
|
31936
|
+
const ssrEl = childSlot;
|
|
31861
31937
|
const dynAttrs2 = [];
|
|
31862
31938
|
const staticChildren = [];
|
|
31863
31939
|
for (const c of child.children) {
|
|
@@ -32080,12 +32156,12 @@ function emitDynamicBinding(ctx2, node, tracked2, effectsVar, ssrTextExpr = null
|
|
|
32080
32156
|
const expr = transformTracked(node.expression, tracked2);
|
|
32081
32157
|
const v = ctx2.n();
|
|
32082
32158
|
if (!isReactiveExpression(node.expression, tracked2)) {
|
|
32083
|
-
ctx2.push(`const ${v} = document.createTextNode(String(${expr}));`);
|
|
32159
|
+
ctx2.push(`const ${v} = document.createTextNode(String((${expr}) ?? ''));`);
|
|
32084
32160
|
return v;
|
|
32085
32161
|
}
|
|
32086
32162
|
const init = ssrTextExpr ? `String(${ssrTextExpr} ?? '')` : `''`;
|
|
32087
32163
|
ctx2.push(`const ${v} = document.createTextNode(${init});`);
|
|
32088
|
-
const eff = `effect(() => { ${v}.data = String(
|
|
32164
|
+
const eff = `effect(() => { const __v = ${expr}; ${v}.data = __v == null ? '' : String(__v); })`;
|
|
32089
32165
|
if (effectsVar) {
|
|
32090
32166
|
ctx2.push(`${effectsVar}.push(${eff});`);
|
|
32091
32167
|
} else {
|
|
@@ -33246,7 +33322,9 @@ function isStaticIR(body) {
|
|
|
33246
33322
|
function claimsWalkerNode(ctx2, node) {
|
|
33247
33323
|
if (node instanceof StaticNode) return ctx2.claimStatic || !isStaticIR(node.children);
|
|
33248
33324
|
if (node instanceof ComponentCall) return true;
|
|
33249
|
-
if (node instanceof OpaqueDynamicRegion)
|
|
33325
|
+
if (node instanceof OpaqueDynamicRegion) {
|
|
33326
|
+
return branchClaimsWalker(ctx2, node.consequentNodes) || branchClaimsWalker(ctx2, node.alternateNodes);
|
|
33327
|
+
}
|
|
33250
33328
|
if (node instanceof MapRegion) return true;
|
|
33251
33329
|
if (node instanceof ForLoop) return true;
|
|
33252
33330
|
if (node instanceof WhileLoop) return true;
|
|
@@ -33254,6 +33332,13 @@ function claimsWalkerNode(ctx2, node) {
|
|
|
33254
33332
|
if (node instanceof TryCatch) return true;
|
|
33255
33333
|
return false;
|
|
33256
33334
|
}
|
|
33335
|
+
function branchClaimsWalker(ctx2, nodes) {
|
|
33336
|
+
const previous = ctx2.claimStatic;
|
|
33337
|
+
ctx2.claimStatic = true;
|
|
33338
|
+
const claims = nodes.some((node) => claimsWalkerNode(ctx2, node));
|
|
33339
|
+
ctx2.claimStatic = previous;
|
|
33340
|
+
return claims;
|
|
33341
|
+
}
|
|
33257
33342
|
function isStaticComponent(comp) {
|
|
33258
33343
|
if (comp.style) return false;
|
|
33259
33344
|
return isStaticIR(comp.body);
|
|
@@ -35652,7 +35737,7 @@ import {
|
|
|
35652
35737
|
rmSync as rmSync2,
|
|
35653
35738
|
readFileSync as readFileSync17
|
|
35654
35739
|
} from "node:fs";
|
|
35655
|
-
import { resolve as resolve13, join as join11, extname as extname3, dirname as
|
|
35740
|
+
import { resolve as resolve13, join as join11, extname as extname3, dirname as dirname11 } from "node:path";
|
|
35656
35741
|
function ensureCleanDir(dir) {
|
|
35657
35742
|
rmSync2(dir, { recursive: true, force: true });
|
|
35658
35743
|
mkdirSync6(dir, { recursive: true });
|
|
@@ -35666,13 +35751,13 @@ function copyDirContents(srcDir, destDir) {
|
|
|
35666
35751
|
if (statSync7(srcPath).isDirectory()) {
|
|
35667
35752
|
copyDirContents(srcPath, destPath);
|
|
35668
35753
|
} else {
|
|
35669
|
-
mkdirSync6(
|
|
35754
|
+
mkdirSync6(dirname11(destPath), { recursive: true });
|
|
35670
35755
|
copyFileSync2(srcPath, destPath);
|
|
35671
35756
|
}
|
|
35672
35757
|
}
|
|
35673
35758
|
}
|
|
35674
35759
|
function writeFile(path, content) {
|
|
35675
|
-
mkdirSync6(
|
|
35760
|
+
mkdirSync6(dirname11(path), { recursive: true });
|
|
35676
35761
|
writeFileSync7(path, content, "utf-8");
|
|
35677
35762
|
}
|
|
35678
35763
|
function writePlatformStatic(buildStaticDir, platformStaticDir) {
|
|
@@ -35686,7 +35771,7 @@ function writePlatformStatic(buildStaticDir, platformStaticDir) {
|
|
|
35686
35771
|
const runtimeAlias = resolve13(platformStaticDir, "_vesk", "runtime.js");
|
|
35687
35772
|
const clientPath = resolve13(buildStaticDir, "client.js");
|
|
35688
35773
|
if (existsSync15(clientPath)) {
|
|
35689
|
-
mkdirSync6(
|
|
35774
|
+
mkdirSync6(dirname11(runtimeAlias), { recursive: true });
|
|
35690
35775
|
copyFileSync2(clientPath, runtimeAlias);
|
|
35691
35776
|
}
|
|
35692
35777
|
}
|
|
@@ -35781,7 +35866,7 @@ import {
|
|
|
35781
35866
|
mkdirSync as mkdirSync7,
|
|
35782
35867
|
statSync as statSync9
|
|
35783
35868
|
} from "node:fs";
|
|
35784
|
-
import { resolve as resolve15, dirname as
|
|
35869
|
+
import { resolve as resolve15, dirname as dirname13, join as join12, extname as extname4, basename as basename2 } from "node:path";
|
|
35785
35870
|
import { createRequire as createRequire4 } from "node:module";
|
|
35786
35871
|
import { spawn } from "node:child_process";
|
|
35787
35872
|
function defaultState() {
|
|
@@ -35815,7 +35900,7 @@ function readPluginState(veskDir) {
|
|
|
35815
35900
|
}
|
|
35816
35901
|
function writePluginState(veskDir, state) {
|
|
35817
35902
|
const file = stateFilePath(veskDir);
|
|
35818
|
-
const dir =
|
|
35903
|
+
const dir = dirname13(file);
|
|
35819
35904
|
if (!existsSync17(dir)) mkdirSync7(dir, { recursive: true });
|
|
35820
35905
|
writeFileSync8(file, JSON.stringify(state, null, 2) + "\n", "utf-8");
|
|
35821
35906
|
}
|
|
@@ -35829,16 +35914,16 @@ function resolvePackage(appDir, pkg) {
|
|
|
35829
35914
|
} catch {
|
|
35830
35915
|
try {
|
|
35831
35916
|
entryPath = require3.resolve(pkg);
|
|
35832
|
-
let cur =
|
|
35917
|
+
let cur = dirname13(entryPath);
|
|
35833
35918
|
const seen = /* @__PURE__ */ new Set();
|
|
35834
|
-
while (cur && cur !==
|
|
35919
|
+
while (cur && cur !== dirname13(cur) && !seen.has(cur)) {
|
|
35835
35920
|
seen.add(cur);
|
|
35836
35921
|
const candidate = join12(cur, "package.json");
|
|
35837
35922
|
if (existsSync17(candidate)) {
|
|
35838
35923
|
pkgJsonPath = candidate;
|
|
35839
35924
|
break;
|
|
35840
35925
|
}
|
|
35841
|
-
const parent =
|
|
35926
|
+
const parent = dirname13(cur);
|
|
35842
35927
|
if (parent !== cur && basename2(cur) === "node_modules") break;
|
|
35843
35928
|
cur = parent;
|
|
35844
35929
|
}
|
|
@@ -35848,7 +35933,7 @@ function resolvePackage(appDir, pkg) {
|
|
|
35848
35933
|
if (pkgJsonPath && existsSync17(pkgJsonPath)) {
|
|
35849
35934
|
pkgJson = readJsonFile(pkgJsonPath);
|
|
35850
35935
|
const main = pkgJson?.main || pkgJson?.module || "index.js";
|
|
35851
|
-
entryPath = resolve15(
|
|
35936
|
+
entryPath = resolve15(dirname13(pkgJsonPath), main);
|
|
35852
35937
|
}
|
|
35853
35938
|
let localPath = localDir(appDir, pkg);
|
|
35854
35939
|
if (!localPath) {
|
|
@@ -35869,7 +35954,7 @@ function resolvePackage(appDir, pkg) {
|
|
|
35869
35954
|
return { installed: true, path: localPath, dir: localPath, packageJson: json ?? pkgJson };
|
|
35870
35955
|
}
|
|
35871
35956
|
const installed2 = !!pkgJsonPath && existsSync17(pkgJsonPath);
|
|
35872
|
-
return { installed: installed2, path: entryPath, dir: installed2 ?
|
|
35957
|
+
return { installed: installed2, path: entryPath, dir: installed2 ? dirname13(pkgJsonPath) : null, packageJson: pkgJson };
|
|
35873
35958
|
}
|
|
35874
35959
|
function localDir(base, pkg) {
|
|
35875
35960
|
if (pkg.startsWith("@")) {
|
|
@@ -36844,7 +36929,7 @@ __export(image_pipeline_exports, {
|
|
|
36844
36929
|
});
|
|
36845
36930
|
import { mkdirSync as mkdirSync9, writeFileSync as writeFileSync10, readFileSync as readFileSync21, existsSync as existsSync19, readdirSync as readdirSync6, statSync as statSync11 } from "node:fs";
|
|
36846
36931
|
import { spawnSync } from "node:child_process";
|
|
36847
|
-
import { resolve as resolve17, extname as extname5, dirname as
|
|
36932
|
+
import { resolve as resolve17, extname as extname5, dirname as dirname14, join as join14 } from "node:path";
|
|
36848
36933
|
import { createRequire as createRequire5 } from "node:module";
|
|
36849
36934
|
import { tmpdir as tmpdir2 } from "node:os";
|
|
36850
36935
|
function probeMemoPath() {
|
|
@@ -36910,7 +36995,7 @@ async function processImage(srcPath, outDir, baseName) {
|
|
|
36910
36995
|
const written = [];
|
|
36911
36996
|
for (const w of OUTPUT_WIDTHS) {
|
|
36912
36997
|
const outputPath = resolve17(outDir, `${baseName}-${w}w${ext}`);
|
|
36913
|
-
mkdirSync9(
|
|
36998
|
+
mkdirSync9(dirname14(outputPath), { recursive: true });
|
|
36914
36999
|
writeFileSync10(outputPath, original);
|
|
36915
37000
|
written.push(outputPath);
|
|
36916
37001
|
}
|
|
@@ -36923,14 +37008,14 @@ async function processImage(srcPath, outDir, baseName) {
|
|
|
36923
37008
|
const base = `${baseName}-${w}w`;
|
|
36924
37009
|
if (w >= originalWidth) {
|
|
36925
37010
|
const copyPath = resolve17(outDir, `${base}${extname5(srcPath)}`);
|
|
36926
|
-
mkdirSync9(
|
|
37011
|
+
mkdirSync9(dirname14(copyPath), { recursive: true });
|
|
36927
37012
|
writeFileSync10(copyPath, readFileSync21(srcPath));
|
|
36928
37013
|
generated.push(copyPath);
|
|
36929
37014
|
continue;
|
|
36930
37015
|
}
|
|
36931
37016
|
const resized = image.clone().resize({ width: w, withoutEnlargement: true });
|
|
36932
37017
|
const jpgPath = resolve17(outDir, `${base}${extname5(srcPath)}`);
|
|
36933
|
-
mkdirSync9(
|
|
37018
|
+
mkdirSync9(dirname14(jpgPath), { recursive: true });
|
|
36934
37019
|
await resized.toFile(jpgPath);
|
|
36935
37020
|
generated.push(jpgPath);
|
|
36936
37021
|
for (const fmt of FORMATS) {
|
|
@@ -37259,7 +37344,7 @@ var init_platform = __esm({
|
|
|
37259
37344
|
|
|
37260
37345
|
// ../adapter/src/platform-handler.ts
|
|
37261
37346
|
import { existsSync as existsSync21 } from "node:fs";
|
|
37262
|
-
import { resolve as resolve19, dirname as
|
|
37347
|
+
import { resolve as resolve19, dirname as dirname15, join as join15 } from "node:path";
|
|
37263
37348
|
import { fileURLToPath as fileURLToPath4 } from "node:url";
|
|
37264
37349
|
function routeName2(segments) {
|
|
37265
37350
|
const parts = segments.filter(Boolean).map((s) => {
|
|
@@ -37573,7 +37658,7 @@ var init_platform_handler = __esm({
|
|
|
37573
37658
|
"../adapter/src/platform-handler.ts"() {
|
|
37574
37659
|
"use strict";
|
|
37575
37660
|
init_default_pages();
|
|
37576
|
-
__dirname5 =
|
|
37661
|
+
__dirname5 = dirname15(fileURLToPath4(import.meta.url));
|
|
37577
37662
|
}
|
|
37578
37663
|
});
|
|
37579
37664
|
|
|
@@ -42307,8 +42392,8 @@ __export(typecheck_exports, {
|
|
|
42307
42392
|
formatTypecheckWarnings: () => formatTypecheckWarnings,
|
|
42308
42393
|
typecheckProject: () => typecheckProject
|
|
42309
42394
|
});
|
|
42310
|
-
import { readFileSync as
|
|
42311
|
-
import { join as
|
|
42395
|
+
import { readFileSync as readFileSync42, readdirSync as readdirSync15, statSync as statSync23 } from "node:fs";
|
|
42396
|
+
import { join as join29, dirname as dirname28, normalize, relative as relative10, resolve as resolve40, sep as sep7 } from "node:path";
|
|
42312
42397
|
import * as ts8 from "typescript";
|
|
42313
42398
|
function walkProjectFiles(projectRoot) {
|
|
42314
42399
|
const code = [];
|
|
@@ -42321,7 +42406,7 @@ function walkProjectFiles(projectRoot) {
|
|
|
42321
42406
|
return;
|
|
42322
42407
|
}
|
|
42323
42408
|
for (const e of entries) {
|
|
42324
|
-
const p =
|
|
42409
|
+
const p = join29(dir, e);
|
|
42325
42410
|
let st;
|
|
42326
42411
|
try {
|
|
42327
42412
|
st = statSync23(p);
|
|
@@ -42349,15 +42434,15 @@ function walkProjectFiles(projectRoot) {
|
|
|
42349
42434
|
return { code, js };
|
|
42350
42435
|
}
|
|
42351
42436
|
function isUnder(dir, file) {
|
|
42352
|
-
const base =
|
|
42353
|
-
const abs =
|
|
42437
|
+
const base = resolve40(dir);
|
|
42438
|
+
const abs = resolve40(file);
|
|
42354
42439
|
return abs === base || abs.startsWith(base + sep7);
|
|
42355
42440
|
}
|
|
42356
42441
|
function structureWarning(rel, message) {
|
|
42357
42442
|
return { file: rel, line: 1, column: 1, code: "vesk-structure", message };
|
|
42358
42443
|
}
|
|
42359
42444
|
function checkStructureFile(appDir, file) {
|
|
42360
|
-
const rel =
|
|
42445
|
+
const rel = relative10(appDir, file);
|
|
42361
42446
|
const parts = rel.split("\\").join("/").split("/");
|
|
42362
42447
|
const name = parts[parts.length - 1] ?? "";
|
|
42363
42448
|
const isApi = parts.includes("api");
|
|
@@ -42376,8 +42461,8 @@ function checkStructureFile(appDir, file) {
|
|
|
42376
42461
|
return null;
|
|
42377
42462
|
}
|
|
42378
42463
|
function createTypecheckHost(projectRoot, appDir, vskFiles) {
|
|
42379
|
-
const ambientPath =
|
|
42380
|
-
const overridePath =
|
|
42464
|
+
const ambientPath = join29(appDir, "__vesk_ambient.d.ts");
|
|
42465
|
+
const overridePath = join29(appDir, "__vesk_runtime_override.d.ts");
|
|
42381
42466
|
const cached = /* @__PURE__ */ new Map();
|
|
42382
42467
|
const scriptKindFor = (file) => file.endsWith(".vsk") ? ts8.ScriptKind.TSX : ts8.ScriptKind.TS;
|
|
42383
42468
|
const host = {
|
|
@@ -42447,7 +42532,7 @@ function createTypecheckHost(projectRoot, appDir, vskFiles) {
|
|
|
42447
42532
|
directoryExists: (dir) => ts8.sys.directoryExists(dir),
|
|
42448
42533
|
getDirectories: (dir) => {
|
|
42449
42534
|
try {
|
|
42450
|
-
return readdirSync15(dir, { withFileTypes: true }).filter((d) => d.isDirectory()).map((d) =>
|
|
42535
|
+
return readdirSync15(dir, { withFileTypes: true }).filter((d) => d.isDirectory()).map((d) => join29(dir, d.name));
|
|
42451
42536
|
} catch {
|
|
42452
42537
|
return [];
|
|
42453
42538
|
}
|
|
@@ -42458,8 +42543,8 @@ function createTypecheckHost(projectRoot, appDir, vskFiles) {
|
|
|
42458
42543
|
resolveModuleNameLiterals(moduleLiterals, containingFile, redirectedReference, options) {
|
|
42459
42544
|
return moduleLiterals.map(({ text }) => {
|
|
42460
42545
|
if (text.endsWith(".vsk")) {
|
|
42461
|
-
const aliased = text.startsWith(".") ? null : resolveAliasModule(text,
|
|
42462
|
-
const abs = normalize(aliased ??
|
|
42546
|
+
const aliased = text.startsWith(".") ? null : resolveAliasModule(text, dirname28(containingFile));
|
|
42547
|
+
const abs = normalize(aliased ?? join29(dirname28(containingFile), text));
|
|
42463
42548
|
return {
|
|
42464
42549
|
resolvedModule: {
|
|
42465
42550
|
resolvedFileName: abs + ".d.ts",
|
|
@@ -42470,7 +42555,7 @@ function createTypecheckHost(projectRoot, appDir, vskFiles) {
|
|
|
42470
42555
|
};
|
|
42471
42556
|
}
|
|
42472
42557
|
if (text.endsWith(".css")) {
|
|
42473
|
-
const abs = normalize(
|
|
42558
|
+
const abs = normalize(join29(dirname28(containingFile), text));
|
|
42474
42559
|
return {
|
|
42475
42560
|
resolvedModule: {
|
|
42476
42561
|
resolvedFileName: abs + ".d.ts",
|
|
@@ -42517,7 +42602,7 @@ function sourcePosition(source, offset2) {
|
|
|
42517
42602
|
return { line, character: bounded - lineStart + 1 };
|
|
42518
42603
|
}
|
|
42519
42604
|
function typecheckProject(projectRoot, opts = {}) {
|
|
42520
|
-
const appDir = opts.appDir ??
|
|
42605
|
+
const appDir = opts.appDir ?? join29(projectRoot, "app");
|
|
42521
42606
|
const vskFiles = /* @__PURE__ */ new Map();
|
|
42522
42607
|
const parseErrors = [];
|
|
42523
42608
|
const warnings = [];
|
|
@@ -42539,12 +42624,12 @@ function typecheckProject(projectRoot, opts = {}) {
|
|
|
42539
42624
|
}
|
|
42540
42625
|
}
|
|
42541
42626
|
if (f.endsWith(".vsk")) {
|
|
42542
|
-
const src2 =
|
|
42627
|
+
const src2 = readFileSync42(f, "utf-8");
|
|
42543
42628
|
try {
|
|
42544
42629
|
parse4(src2);
|
|
42545
42630
|
} catch (e) {
|
|
42546
42631
|
parseErrors.push({
|
|
42547
|
-
file:
|
|
42632
|
+
file: relative10(projectRoot, f),
|
|
42548
42633
|
line: 1,
|
|
42549
42634
|
column: 1,
|
|
42550
42635
|
code: "vesk-parse",
|
|
@@ -42556,8 +42641,8 @@ function typecheckProject(projectRoot, opts = {}) {
|
|
|
42556
42641
|
}
|
|
42557
42642
|
rootNames.push(f);
|
|
42558
42643
|
}
|
|
42559
|
-
const ambientPath =
|
|
42560
|
-
const overridePath =
|
|
42644
|
+
const ambientPath = join29(appDir, "__vesk_ambient.d.ts");
|
|
42645
|
+
const overridePath = join29(appDir, "__vesk_runtime_override.d.ts");
|
|
42561
42646
|
rootNames.push(ambientPath);
|
|
42562
42647
|
rootNames.push(overridePath);
|
|
42563
42648
|
const options = {
|
|
@@ -42615,7 +42700,7 @@ function typecheckProject(projectRoot, opts = {}) {
|
|
|
42615
42700
|
}
|
|
42616
42701
|
const code = typeof diag.code === "number" ? `TS${diag.code}` : String(diag.code);
|
|
42617
42702
|
errors.push({
|
|
42618
|
-
file:
|
|
42703
|
+
file: relative10(projectRoot, filePath),
|
|
42619
42704
|
line,
|
|
42620
42705
|
column,
|
|
42621
42706
|
code,
|
|
@@ -48678,8 +48763,8 @@ __export(codemods_exports, {
|
|
|
48678
48763
|
applicableCodemods: () => applicableCodemods,
|
|
48679
48764
|
compareCore: () => compareCore
|
|
48680
48765
|
});
|
|
48681
|
-
import { readFileSync as
|
|
48682
|
-
import { join as
|
|
48766
|
+
import { readFileSync as readFileSync43, existsSync as existsSync44 } from "node:fs";
|
|
48767
|
+
import { join as join30 } from "node:path";
|
|
48683
48768
|
import { walk as walk8 } from "zimmerframe";
|
|
48684
48769
|
function safeParse(source, filePath) {
|
|
48685
48770
|
try {
|
|
@@ -48699,12 +48784,12 @@ function isVskFile(filePath) {
|
|
|
48699
48784
|
}
|
|
48700
48785
|
function typesPackageExports(projectDir) {
|
|
48701
48786
|
const candidates = [
|
|
48702
|
-
projectDir ?
|
|
48787
|
+
projectDir ? join30(projectDir, "node_modules", "@vesk", "types", "dist", "index.d.ts") : null,
|
|
48703
48788
|
new URL("../../types/dist/index.d.ts", import.meta.url).pathname
|
|
48704
|
-
].filter((p) => typeof p === "string" &&
|
|
48789
|
+
].filter((p) => typeof p === "string" && existsSync44(p));
|
|
48705
48790
|
for (const path of candidates) {
|
|
48706
48791
|
try {
|
|
48707
|
-
const src2 =
|
|
48792
|
+
const src2 = readFileSync43(path, "utf-8");
|
|
48708
48793
|
const names = /* @__PURE__ */ new Set();
|
|
48709
48794
|
for (const line of src2.split("\n")) {
|
|
48710
48795
|
const m = /^export\s+(?:declare\s+)?(?:abstract\s+)?(?:interface|class|type|enum|const|function|let|var|namespace)\s+([A-Za-z_$][\w$]*)/.exec(line);
|
|
@@ -48828,14 +48913,14 @@ __export(migrate_exports, {
|
|
|
48828
48913
|
detectInstalledVersion: () => detectInstalledVersion,
|
|
48829
48914
|
runMigrate: () => runMigrate
|
|
48830
48915
|
});
|
|
48831
|
-
import { readFileSync as
|
|
48832
|
-
import { join as
|
|
48916
|
+
import { readFileSync as readFileSync44, writeFileSync as writeFileSync22, existsSync as existsSync45, statSync as statSync24, readdirSync as readdirSync16 } from "node:fs";
|
|
48917
|
+
import { join as join31, relative as relative11, extname as extname8 } from "node:path";
|
|
48833
48918
|
function detectInstalledVersion(projectDir, cliVersion) {
|
|
48834
48919
|
for (const pkg of ["@vesk/vesk-cli", "@vesk/adapter", "@vesk/compiler"]) {
|
|
48835
|
-
const p =
|
|
48836
|
-
if (!
|
|
48920
|
+
const p = join31(projectDir, "node_modules", pkg, "package.json");
|
|
48921
|
+
if (!existsSync45(p)) continue;
|
|
48837
48922
|
try {
|
|
48838
|
-
const version2 = JSON.parse(
|
|
48923
|
+
const version2 = JSON.parse(readFileSync44(p, "utf-8")).version;
|
|
48839
48924
|
if (typeof version2 === "string" && version2) return { version: version2, source: pkg };
|
|
48840
48925
|
} catch {
|
|
48841
48926
|
}
|
|
@@ -48852,7 +48937,7 @@ function collectTargets(dir, root3 = dir) {
|
|
|
48852
48937
|
}
|
|
48853
48938
|
for (const entry of entries.sort()) {
|
|
48854
48939
|
if (SKIP_DIRS2.has(entry)) continue;
|
|
48855
|
-
const full =
|
|
48940
|
+
const full = join31(dir, entry);
|
|
48856
48941
|
let st;
|
|
48857
48942
|
try {
|
|
48858
48943
|
st = statSync24(full);
|
|
@@ -48862,7 +48947,7 @@ function collectTargets(dir, root3 = dir) {
|
|
|
48862
48947
|
if (st.isDirectory()) {
|
|
48863
48948
|
out.push(...collectTargets(full, root3));
|
|
48864
48949
|
} else if (SCAN_EXTENSIONS.has(extname8(entry))) {
|
|
48865
|
-
out.push(
|
|
48950
|
+
out.push(relative11(root3, full));
|
|
48866
48951
|
}
|
|
48867
48952
|
}
|
|
48868
48953
|
return out;
|
|
@@ -48887,12 +48972,12 @@ function runMigrate(options) {
|
|
|
48887
48972
|
return report;
|
|
48888
48973
|
}
|
|
48889
48974
|
for (const relPath of collectTargets(options.projectDir)) {
|
|
48890
|
-
const abs =
|
|
48975
|
+
const abs = join31(options.projectDir, relPath);
|
|
48891
48976
|
const ctx2 = { filePath: abs, displayPath: relPath, projectDir: options.projectDir };
|
|
48892
|
-
if (!
|
|
48977
|
+
if (!existsSync45(abs)) continue;
|
|
48893
48978
|
let source;
|
|
48894
48979
|
try {
|
|
48895
|
-
source =
|
|
48980
|
+
source = readFileSync44(abs, "utf-8");
|
|
48896
48981
|
} catch (e) {
|
|
48897
48982
|
report.skipped.push(`${relPath}: unreadable (${e.message})`);
|
|
48898
48983
|
continue;
|
|
@@ -48932,9 +49017,11 @@ var init_migrate = __esm({
|
|
|
48932
49017
|
});
|
|
48933
49018
|
|
|
48934
49019
|
// src/index.ts
|
|
48935
|
-
import { readFileSync as
|
|
48936
|
-
import { resolve as
|
|
49020
|
+
import { readFileSync as readFileSync45, writeFileSync as writeFileSync23, mkdirSync as mkdirSync20, existsSync as existsSync46 } from "fs";
|
|
49021
|
+
import { resolve as resolve41, join as join32 } from "path";
|
|
48937
49022
|
import { fileURLToPath as fileURLToPath9 } from "url";
|
|
49023
|
+
import { createRequire as createRequire8 } from "module";
|
|
49024
|
+
import { spawn as spawn3 } from "child_process";
|
|
48938
49025
|
|
|
48939
49026
|
// ../adapter/dist/load-config.js
|
|
48940
49027
|
import { existsSync, readFileSync, writeFileSync, mkdirSync } from "node:fs";
|
|
@@ -49512,7 +49599,7 @@ function setRuntimeModule2(mod) {
|
|
|
49512
49599
|
|
|
49513
49600
|
// ../adapter/dist/index.js
|
|
49514
49601
|
import { mkdirSync as mkdirSync11, writeFileSync as writeFileSync12, existsSync as existsSync22, readFileSync as readFileSync23 } from "node:fs";
|
|
49515
|
-
import { resolve as resolve21, dirname as
|
|
49602
|
+
import { resolve as resolve21, dirname as dirname17, relative as relative4, basename as basename3, join as join16 } from "node:path";
|
|
49516
49603
|
import { fileURLToPath as fileURLToPath5 } from "node:url";
|
|
49517
49604
|
|
|
49518
49605
|
// ../adapter/src/runtime-bundle.ts
|
|
@@ -50385,7 +50472,9 @@ ${layoutDecls.map((d) => " " + d.compiled + ",").join("\n")}
|
|
|
50385
50472
|
""
|
|
50386
50473
|
].join("\n");
|
|
50387
50474
|
const actionCode = [
|
|
50388
|
-
|
|
50475
|
+
// Underscored internal name (see api-function.ts): page source is inlined
|
|
50476
|
+
// into this module and may declare/import `handleAction` itself.
|
|
50477
|
+
"async function __vesk_handleAction(request, id) {",
|
|
50389
50478
|
" // CSRF defense: cross-site browser POSTs always carry an Origin header.",
|
|
50390
50479
|
" try {",
|
|
50391
50480
|
" assertSameOrigin(request);",
|
|
@@ -50462,6 +50551,8 @@ ${layoutDecls.map((d) => " " + d.compiled + ",").join("\n")}
|
|
|
50462
50551
|
" globalThis.__vesk_request = prevReq;",
|
|
50463
50552
|
" }",
|
|
50464
50553
|
"}",
|
|
50554
|
+
"",
|
|
50555
|
+
"export { __vesk_handleAction as handleAction };",
|
|
50465
50556
|
""
|
|
50466
50557
|
].join("\n");
|
|
50467
50558
|
const funcCode = [
|
|
@@ -50499,8 +50590,9 @@ init_actions();
|
|
|
50499
50590
|
|
|
50500
50591
|
// ../adapter/src/api-function.ts
|
|
50501
50592
|
init_strip_ts();
|
|
50593
|
+
init_module_imports();
|
|
50502
50594
|
import { readFileSync as readFileSync8 } from "node:fs";
|
|
50503
|
-
import { resolve as resolve8 } from "node:path";
|
|
50595
|
+
import { resolve as resolve8, dirname as dirname8 } from "node:path";
|
|
50504
50596
|
function apiRouteName(fullPath) {
|
|
50505
50597
|
const parts = fullPath.split("/").filter(Boolean);
|
|
50506
50598
|
return parts.map((s) => s.startsWith(":") ? s.slice(1) || "param" : s).join("_") || "index";
|
|
@@ -50512,6 +50604,17 @@ function generateApiFunction(apiNode, _apiDir, outDir, options) {
|
|
|
50512
50604
|
const routeFilePath = apiNode.filePath;
|
|
50513
50605
|
if (!routeFilePath) throw new Error(`api route ${apiNode.fullPath} has no filePath`);
|
|
50514
50606
|
let routeSrc = readFileSync8(routeFilePath, "utf-8");
|
|
50607
|
+
const routeDir = dirname8(routeFilePath);
|
|
50608
|
+
routeSrc = routeSrc.replace(
|
|
50609
|
+
/(from\s+['"]|import\s*\(\s*['"])(\.{1,2}\/[^'"]+)(['"])/g,
|
|
50610
|
+
(match, prefix, spec, suffix) => {
|
|
50611
|
+
try {
|
|
50612
|
+
return prefix + resolveImportPath(spec, routeDir) + suffix;
|
|
50613
|
+
} catch {
|
|
50614
|
+
return match;
|
|
50615
|
+
}
|
|
50616
|
+
}
|
|
50617
|
+
);
|
|
50515
50618
|
routeSrc = routeSrc.replace(/from\s+['"]@vesk\/runtime['"]\s*;?/g, "from '../runtime.js';").replace(/from\s+['"]@vesk\/runtime\/(\w+)['"]\s*;?/g, () => {
|
|
50516
50619
|
return "from '../runtime.js';";
|
|
50517
50620
|
});
|
|
@@ -50524,9 +50627,12 @@ function generateApiFunction(apiNode, _apiDir, outDir, options) {
|
|
|
50524
50627
|
const urlParts = apiNode.fullPath.split("/").filter(Boolean);
|
|
50525
50628
|
const extracts = [];
|
|
50526
50629
|
let partIdx = 0;
|
|
50527
|
-
for (
|
|
50528
|
-
|
|
50630
|
+
for (let i = 0; i < urlParts.length; i++) {
|
|
50631
|
+
const p = urlParts[i];
|
|
50632
|
+
const isCatchAll = apiNode.isCatchAll && i === urlParts.length - 1;
|
|
50633
|
+
if (p.startsWith(":") && (isCatchAll || p.includes("..."))) {
|
|
50529
50634
|
extracts.push(`${JSON.stringify(p.slice(1))}: urlParts.slice(${partIdx}).join('/')`);
|
|
50635
|
+
partIdx = urlParts.length;
|
|
50530
50636
|
} else if (p.startsWith(":")) {
|
|
50531
50637
|
extracts.push(`${JSON.stringify(p.slice(1))}: urlParts[${partIdx}]`);
|
|
50532
50638
|
partIdx++;
|
|
@@ -50709,9 +50815,14 @@ function generateApiFunction(apiNode, _apiDir, outDir, options) {
|
|
|
50709
50815
|
middlewareCode ? "import { parseCookies as __parseCookies } from '../runtime.js';" : "",
|
|
50710
50816
|
"",
|
|
50711
50817
|
middlewareCode || "",
|
|
50712
|
-
|
|
50818
|
+
// Underscored internal name: route source is inlined above and commonly
|
|
50819
|
+
// imports a user helper called `handle`, which would otherwise clash with
|
|
50820
|
+
// (and crash) this wrapper. The public export name is preserved.
|
|
50821
|
+
"async function __vesk_api_handle(request) {",
|
|
50713
50822
|
handleBody,
|
|
50714
50823
|
"}",
|
|
50824
|
+
"",
|
|
50825
|
+
"export { __vesk_api_handle as handle };",
|
|
50715
50826
|
""
|
|
50716
50827
|
].filter(Boolean).join("\n");
|
|
50717
50828
|
return { funcPath, funcCode, name };
|
|
@@ -51071,7 +51182,7 @@ async function compileEvents(appDir, outDir) {
|
|
|
51071
51182
|
// ../adapter/src/client-bundle.ts
|
|
51072
51183
|
init_esbuild_fallback();
|
|
51073
51184
|
import { readFileSync as readFileSync13, existsSync as existsSync11, writeFileSync as writeFileSync4, unlinkSync as unlinkSync3, statSync as statSync4, rmSync, mkdtempSync, mkdirSync as mkdirSync3 } from "node:fs";
|
|
51074
|
-
import { resolve as resolve10, join as join8, dirname as
|
|
51185
|
+
import { resolve as resolve10, join as join8, dirname as dirname9, relative as relative2, sep } from "node:path";
|
|
51075
51186
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
51076
51187
|
import { tmpdir } from "node:os";
|
|
51077
51188
|
init_strip_ts();
|
|
@@ -51366,7 +51477,7 @@ async function mapWithConcurrency(items, limit, fn) {
|
|
|
51366
51477
|
if (firstError !== null) throw firstError;
|
|
51367
51478
|
return out;
|
|
51368
51479
|
}
|
|
51369
|
-
var __dirname3 =
|
|
51480
|
+
var __dirname3 = dirname9(fileURLToPath2(import.meta.url));
|
|
51370
51481
|
function fileUnchanged(filePath, cached) {
|
|
51371
51482
|
try {
|
|
51372
51483
|
const st = statSync4(filePath);
|
|
@@ -51535,7 +51646,9 @@ function demoteExports(code) {
|
|
|
51535
51646
|
function chunkHasImports(headLen, mergeAborted) {
|
|
51536
51647
|
return headLen > 0 || mergeAborted;
|
|
51537
51648
|
}
|
|
51538
|
-
function runtimeImportsOf(filePath) {
|
|
51649
|
+
function runtimeImportsOf(filePath, seen = /* @__PURE__ */ new Set()) {
|
|
51650
|
+
if (seen.has(filePath)) return [];
|
|
51651
|
+
seen.add(filePath);
|
|
51539
51652
|
let text;
|
|
51540
51653
|
try {
|
|
51541
51654
|
text = readFileSync13(filePath, "utf8");
|
|
@@ -51553,6 +51666,29 @@ function runtimeImportsOf(filePath) {
|
|
|
51553
51666
|
if (name) names.push(name);
|
|
51554
51667
|
}
|
|
51555
51668
|
}
|
|
51669
|
+
const relativeImport = /import\s+(?:type\s+)?(?:[^'"]*?\sfrom\s*)?['"](\.[^'"]+)['"]/g;
|
|
51670
|
+
for (const match of text.matchAll(relativeImport)) {
|
|
51671
|
+
const base = resolve10(dirname9(filePath), match[1]);
|
|
51672
|
+
const candidates = [
|
|
51673
|
+
base,
|
|
51674
|
+
`${base}.ts`,
|
|
51675
|
+
`${base}.tsx`,
|
|
51676
|
+
`${base}.js`,
|
|
51677
|
+
`${base}.jsx`,
|
|
51678
|
+
join8(base, "index.ts"),
|
|
51679
|
+
join8(base, "index.tsx"),
|
|
51680
|
+
join8(base, "index.js")
|
|
51681
|
+
];
|
|
51682
|
+
for (const candidate of candidates) {
|
|
51683
|
+
try {
|
|
51684
|
+
if (!existsSync11(candidate) || !statSync4(candidate).isFile()) continue;
|
|
51685
|
+
} catch {
|
|
51686
|
+
continue;
|
|
51687
|
+
}
|
|
51688
|
+
names.push(...runtimeImportsOf(candidate, seen));
|
|
51689
|
+
break;
|
|
51690
|
+
}
|
|
51691
|
+
}
|
|
51556
51692
|
return names;
|
|
51557
51693
|
}
|
|
51558
51694
|
function sharedRuntimeResolver(shimPath) {
|
|
@@ -51590,7 +51726,7 @@ var ChunkImports = class {
|
|
|
51590
51726
|
if (node.type !== "ImportDeclaration" || typeof node.start !== "number" || typeof node.end !== "number") continue;
|
|
51591
51727
|
const src2 = node.source?.value;
|
|
51592
51728
|
if (typeof src2 !== "string") continue;
|
|
51593
|
-
const resolved = resolveImportPath(src2,
|
|
51729
|
+
const resolved = resolveImportPath(src2, dirname9(filePath));
|
|
51594
51730
|
for (const spec of node.specifiers ?? []) {
|
|
51595
51731
|
const s = spec;
|
|
51596
51732
|
const local = s.local?.name;
|
|
@@ -51895,7 +52031,7 @@ async function generateClientBundle(routeTree, appDir, componentMap, options) {
|
|
|
51895
52031
|
__stats.distinct.add(filePath);
|
|
51896
52032
|
let src2 = readFileSync13(filePath, "utf-8");
|
|
51897
52033
|
if (/content=["'][^"']*\.md["']/i.test(src2)) {
|
|
51898
|
-
src2 = inlineMdContentAttrs(src2,
|
|
52034
|
+
src2 = inlineMdContentAttrs(src2, dirname9(filePath), guessProjectRoots(appDir));
|
|
51899
52035
|
}
|
|
51900
52036
|
const namesBefore = cache2 ? new Set(runtimeImportNames) : null;
|
|
51901
52037
|
const importedPaths = resolveVskImports(filePath, (p, n) => compileFile2(p, n, output, imports));
|
|
@@ -51994,6 +52130,7 @@ async function generateClientBundle(routeTree, appDir, componentMap, options) {
|
|
|
51994
52130
|
}
|
|
51995
52131
|
if (chunkCode.length > 0) {
|
|
51996
52132
|
const chunkName = `page-${buildChunkName(appDir, node)}.js`;
|
|
52133
|
+
allRouteImportTables.push(chunkImports);
|
|
51997
52134
|
if (!onlyRoutes || onlyRoutes.has(node.fullPath)) {
|
|
51998
52135
|
if (!chunkImports.ok) console.error("[vesk] chunk import merge aborted for", chunkName + ":", chunkImports.reason);
|
|
51999
52136
|
const head = chunkImports.render();
|
|
@@ -52010,7 +52147,7 @@ async function generateClientBundle(routeTree, appDir, componentMap, options) {
|
|
|
52010
52147
|
if (emitted) {
|
|
52011
52148
|
const fileName = options?.hmr ? chunkName : hashedName(chunkName, emitted.code);
|
|
52012
52149
|
node.chunk = `/_vesk/static/${fileName}`;
|
|
52013
|
-
} else if (options?.skipRouteChunks) {
|
|
52150
|
+
} else if (options?.skipRouteChunks && (node.page || node.layout)) {
|
|
52014
52151
|
node.chunk = `/_vesk/static/${chunkName}`;
|
|
52015
52152
|
}
|
|
52016
52153
|
annotate2(node.children || []);
|
|
@@ -52018,6 +52155,7 @@ async function generateClientBundle(routeTree, appDir, componentMap, options) {
|
|
|
52018
52155
|
};
|
|
52019
52156
|
var walkSplit = walkSplit2, annotate = annotate2;
|
|
52020
52157
|
const chunkEntries = [];
|
|
52158
|
+
const allRouteImportTables = [];
|
|
52021
52159
|
walkSplit2(routeTree, []);
|
|
52022
52160
|
const sharedCode = [];
|
|
52023
52161
|
const sharedImports = new ChunkImports();
|
|
@@ -52039,16 +52177,37 @@ ${body}
|
|
|
52039
52177
|
})();
|
|
52040
52178
|
`;
|
|
52041
52179
|
const sharedUsage = /* @__PURE__ */ new Map();
|
|
52042
|
-
|
|
52043
|
-
|
|
52180
|
+
const sharedUsageTables = [...allRouteImportTables];
|
|
52181
|
+
if (sharedCode.length > 0) sharedUsageTables.push(sharedImports);
|
|
52182
|
+
for (const table of sharedUsageTables) {
|
|
52183
|
+
for (const source of new Set(table.sources())) {
|
|
52044
52184
|
sharedUsage.set(source, (sharedUsage.get(source) ?? 0) + 1);
|
|
52045
52185
|
}
|
|
52046
52186
|
}
|
|
52047
52187
|
const isAppLocal = (source) => !source.includes("node_modules") && source.startsWith(resolve10(appDir, ".."));
|
|
52048
|
-
const
|
|
52188
|
+
const sharedFilesFor = /* @__PURE__ */ new Map();
|
|
52189
|
+
for (const [source, uses] of sharedUsage) {
|
|
52190
|
+
let file = source;
|
|
52191
|
+
if (!source.startsWith("/")) {
|
|
52192
|
+
try {
|
|
52193
|
+
file = resolveSsrModule(source, appDir) ?? source;
|
|
52194
|
+
} catch {
|
|
52195
|
+
}
|
|
52196
|
+
}
|
|
52197
|
+
if (file.endsWith(".vsk") || !existsSync11(file)) continue;
|
|
52198
|
+
let needsRuntime = false;
|
|
52199
|
+
try {
|
|
52200
|
+
needsRuntime = runtimeImportsOf(file).length > 0;
|
|
52201
|
+
} catch {
|
|
52202
|
+
}
|
|
52203
|
+
if (needsRuntime || uses > 1 && isAppLocal(source)) {
|
|
52204
|
+
sharedFilesFor.set(source, file);
|
|
52205
|
+
}
|
|
52206
|
+
}
|
|
52207
|
+
const sharedSources = [...new Set(sharedFilesFor.values())];
|
|
52049
52208
|
if (process.env.VESK_DEBUG_SHARED) {
|
|
52050
52209
|
console.error("[shared] candidates:", [...sharedUsage.entries()].map(([s, n]) => `${n}x ${s}`).join("\n"));
|
|
52051
|
-
console.error("[shared] selected:",
|
|
52210
|
+
console.error("[shared] selected:", [...sharedFilesFor.entries()].map(([s, f]) => `${s} -> ${f}`).join("\n"));
|
|
52052
52211
|
}
|
|
52053
52212
|
const chunkAlias = {};
|
|
52054
52213
|
let sharedBundleCode = "";
|
|
@@ -52098,7 +52257,7 @@ ${body}
|
|
|
52098
52257
|
...appTsconfig ? { tsconfig: appTsconfig } : {}
|
|
52099
52258
|
});
|
|
52100
52259
|
sharedBundleCode = result.outputFiles[0].text;
|
|
52101
|
-
|
|
52260
|
+
[...sharedFilesFor.entries()].forEach(([source, file], i) => {
|
|
52102
52261
|
const named = /* @__PURE__ */ new Set();
|
|
52103
52262
|
let hasDefault = false;
|
|
52104
52263
|
for (const entry of chunkEntries) {
|
|
@@ -52107,7 +52266,7 @@ ${body}
|
|
|
52107
52266
|
hasDefault = hasDefault || bindings.hasDefault;
|
|
52108
52267
|
}
|
|
52109
52268
|
const shim = join8(tmpBase, `shim-${i}.js`);
|
|
52110
|
-
const shimLines = [`const m = globalThis.__veskShared[${JSON.stringify(
|
|
52269
|
+
const shimLines = [`const m = globalThis.__veskShared[${JSON.stringify(file)}];`];
|
|
52111
52270
|
if (hasDefault) shimLines.push(`export default m;`);
|
|
52112
52271
|
for (const name of [...named].sort()) {
|
|
52113
52272
|
shimLines.push(`export const ${name} = m[${JSON.stringify(name)}];`);
|
|
@@ -52394,7 +52553,7 @@ async function bundleRuntimeNames(runtimeDir, names, strict = false) {
|
|
|
52394
52553
|
const unique = [...new Set(names)];
|
|
52395
52554
|
try {
|
|
52396
52555
|
try {
|
|
52397
|
-
mkdirSync3(
|
|
52556
|
+
mkdirSync3(dirname9(entry), { recursive: true });
|
|
52398
52557
|
} catch {
|
|
52399
52558
|
}
|
|
52400
52559
|
try {
|
|
@@ -52630,7 +52789,7 @@ function copyStaticAssets(publicDir, outDir) {
|
|
|
52630
52789
|
|
|
52631
52790
|
// ../adapter/src/prod-server.ts
|
|
52632
52791
|
import { readFileSync as readFileSync18, existsSync as existsSync16, statSync as statSync8 } from "node:fs";
|
|
52633
|
-
import { resolve as resolve14, dirname as
|
|
52792
|
+
import { resolve as resolve14, dirname as dirname12, basename } from "node:path";
|
|
52634
52793
|
import { createServer } from "node:http";
|
|
52635
52794
|
import { fileURLToPath as fileURLToPath3 } from "node:url";
|
|
52636
52795
|
init_server_utils();
|
|
@@ -52670,7 +52829,7 @@ init_paths();
|
|
|
52670
52829
|
|
|
52671
52830
|
// ../adapter/src/load-config.ts
|
|
52672
52831
|
import { existsSync as existsSync14, readFileSync as readFileSync16, writeFileSync as writeFileSync6, mkdirSync as mkdirSync5 } from "node:fs";
|
|
52673
|
-
import { join as join10, dirname as
|
|
52832
|
+
import { join as join10, dirname as dirname10 } from "node:path";
|
|
52674
52833
|
import { pathToFileURL as pathToFileURL2 } from "node:url";
|
|
52675
52834
|
import { createRequire as createRequire3 } from "node:module";
|
|
52676
52835
|
async function loadVeskConfig2(projectDir) {
|
|
@@ -52714,7 +52873,7 @@ async function loadVeskConfig2(projectDir) {
|
|
|
52714
52873
|
js = `const {${injectKeys.join(",")}} = globalThis.__vesk_inject;
|
|
52715
52874
|
` + js;
|
|
52716
52875
|
const tmpFile = join10(projectDir, ".vesk", "config.loader.tmp.mjs");
|
|
52717
|
-
mkdirSync5(
|
|
52876
|
+
mkdirSync5(dirname10(tmpFile), { recursive: true });
|
|
52718
52877
|
writeFileSync6(tmpFile, js, "utf-8");
|
|
52719
52878
|
globalThis.__vesk_inject = inject;
|
|
52720
52879
|
try {
|
|
@@ -53027,7 +53186,7 @@ function makeWebRequest(nodeReq, url, maxBodyBytes = DEFAULT_MAX_BODY_BYTES) {
|
|
|
53027
53186
|
const settleEnd = (body) => {
|
|
53028
53187
|
if (body !== null) cachedBody = body;
|
|
53029
53188
|
streamEnded = true;
|
|
53030
|
-
for (const
|
|
53189
|
+
for (const resolve42 of endWaiters.splice(0)) resolve42();
|
|
53031
53190
|
};
|
|
53032
53191
|
function createBodyStream() {
|
|
53033
53192
|
streamTaken = true;
|
|
@@ -53148,11 +53307,17 @@ function makeWebRequest(nodeReq, url, maxBodyBytes = DEFAULT_MAX_BODY_BYTES) {
|
|
|
53148
53307
|
|
|
53149
53308
|
// ../adapter/src/prod-server.ts
|
|
53150
53309
|
init_platform_output();
|
|
53151
|
-
var __dirname4 =
|
|
53310
|
+
var __dirname4 = dirname12(fileURLToPath3(import.meta.url));
|
|
53152
53311
|
var STREAMING_TYPES = /* @__PURE__ */ new Set(["text/event-stream", "application/x-ndjson"]);
|
|
53153
53312
|
var DELIVER_BUFFER_LIMIT = 1024 * 1024;
|
|
53154
|
-
|
|
53313
|
+
function toNodeHeaders(response) {
|
|
53155
53314
|
const headers2 = Object.fromEntries(response.headers);
|
|
53315
|
+
const cookies2 = response.headers.getSetCookie?.() ?? [];
|
|
53316
|
+
if (cookies2.length > 0) headers2["set-cookie"] = cookies2;
|
|
53317
|
+
return headers2;
|
|
53318
|
+
}
|
|
53319
|
+
async function deliverResponse(res, response) {
|
|
53320
|
+
const headers2 = toNodeHeaders(response);
|
|
53156
53321
|
const body = response.body;
|
|
53157
53322
|
if (!body || typeof body.getReader !== "function") {
|
|
53158
53323
|
res.writeHead(response.status, headers2);
|
|
@@ -53207,6 +53372,22 @@ function errorStatus(e, fallback) {
|
|
|
53207
53372
|
const s = e?.status ?? e?.statusCode;
|
|
53208
53373
|
return typeof s === "number" && s >= 400 && s < 600 ? s : fallback;
|
|
53209
53374
|
}
|
|
53375
|
+
function firstHeaderValue(value) {
|
|
53376
|
+
const raw2 = Array.isArray(value) ? value[0] : value;
|
|
53377
|
+
const trimmed = raw2?.split(",")[0]?.trim();
|
|
53378
|
+
return trimmed || void 0;
|
|
53379
|
+
}
|
|
53380
|
+
function resolveRequestUrl(req, port, trustProxy) {
|
|
53381
|
+
const proto = req.socket.encrypted ? "https" : getClientProtocol({ headers: req.headers }, trustProxy);
|
|
53382
|
+
const forwardedHost = trustProxy ? firstHeaderValue(req.headers["x-forwarded-host"]) : void 0;
|
|
53383
|
+
const host = forwardedHost || req.headers.host || `localhost:${port}`;
|
|
53384
|
+
const path = req.url || "/";
|
|
53385
|
+
try {
|
|
53386
|
+
return new URL(path, `${proto}://${host}`);
|
|
53387
|
+
} catch {
|
|
53388
|
+
return new URL(path, `http://localhost:${port}`);
|
|
53389
|
+
}
|
|
53390
|
+
}
|
|
53210
53391
|
async function startProdServer(outDir, options) {
|
|
53211
53392
|
const port = options?.port || 3e3;
|
|
53212
53393
|
const host = options?.host || "127.0.0.1";
|
|
@@ -53333,10 +53514,8 @@ async function startProdServer(outDir, options) {
|
|
|
53333
53514
|
return req.headers["x-real-ip"] || req.socket?.remoteAddress || "unknown";
|
|
53334
53515
|
}
|
|
53335
53516
|
const server = createServer(async (req, res) => {
|
|
53336
|
-
const url =
|
|
53337
|
-
|
|
53338
|
-
const proto = req.socket.encrypted ? "https" : getClientProtocol({ headers: req.headers }, !!securityConfig?.trustProxy);
|
|
53339
|
-
globalThis.__vesk_ssr_base_url = `${proto}://${reqHost}`;
|
|
53517
|
+
const url = resolveRequestUrl(req, port, !!securityConfig?.trustProxy);
|
|
53518
|
+
globalThis.__vesk_ssr_base_url = url.origin;
|
|
53340
53519
|
if (healthCheckEnabled && (url.pathname === "/healthz" || url.pathname === "/_vesk/healthz")) {
|
|
53341
53520
|
const probe = JSON.stringify({ status: "ok", uptime: Math.floor(process.uptime()) });
|
|
53342
53521
|
res.writeHead(200, {
|
|
@@ -53739,9 +53918,9 @@ init_paths();
|
|
|
53739
53918
|
|
|
53740
53919
|
// ../adapter/dist/index.js
|
|
53741
53920
|
function PACKAGES_DIR_SELF() {
|
|
53742
|
-
return resolve21(
|
|
53921
|
+
return resolve21(dirname17(fileURLToPath5(import.meta.url)), "..");
|
|
53743
53922
|
}
|
|
53744
|
-
var __dirname6 =
|
|
53923
|
+
var __dirname6 = dirname17(fileURLToPath5(import.meta.url));
|
|
53745
53924
|
async function resolveCompilerApi(name) {
|
|
53746
53925
|
const monorepoSrc = resolve21(__dirname6, "..", "..", "compiler", "src");
|
|
53747
53926
|
if (existsSync22(monorepoSrc)) {
|
|
@@ -53792,7 +53971,7 @@ function filterPluginsForBuild(plugins, state) {
|
|
|
53792
53971
|
function veskDirFromOutDir(outDir) {
|
|
53793
53972
|
const base = basename3(outDir);
|
|
53794
53973
|
if (base === "dev" || base === "build")
|
|
53795
|
-
return
|
|
53974
|
+
return dirname17(outDir);
|
|
53796
53975
|
return outDir;
|
|
53797
53976
|
}
|
|
53798
53977
|
async function collectPluginHeadExtra(pluginsPipelines) {
|
|
@@ -54139,9 +54318,9 @@ vesk build: done (${outDir})`);
|
|
|
54139
54318
|
init_seo_audit();
|
|
54140
54319
|
|
|
54141
54320
|
// src/dev-server.ts
|
|
54142
|
-
import { readFileSync as
|
|
54321
|
+
import { readFileSync as readFileSync41, watch, statSync as statSync22, existsSync as existsSync43, mkdirSync as mkdirSync19, readdirSync as readdirSync14, writeFileSync as writeFileSync21, renameSync as renameSync2 } from "node:fs";
|
|
54143
54322
|
import { createHash as createHash3 } from "node:crypto";
|
|
54144
|
-
import { resolve as
|
|
54323
|
+
import { resolve as resolve39, extname as extname7, join as join28, dirname as dirname27, relative as relative9 } from "node:path";
|
|
54145
54324
|
import { createServer as createServer2 } from "node:http";
|
|
54146
54325
|
import { WebSocketServer as WebSocketServer2 } from "ws";
|
|
54147
54326
|
|
|
@@ -55183,8 +55362,20 @@ function emitStatic2(ctx2, node, tracked2, effectsVar, skipK = 0, regionBudget)
|
|
|
55183
55362
|
let childVar;
|
|
55184
55363
|
const isPureStaticChild = ctx2.hydrate && child instanceof StaticNode && isStaticIR2(child.children);
|
|
55185
55364
|
if (isPureStaticChild) {
|
|
55186
|
-
const
|
|
55187
|
-
|
|
55365
|
+
const savedHydrate = ctx2.hydrate;
|
|
55366
|
+
ctx2.hydrate = false;
|
|
55367
|
+
const buildStart = ctx2.lines.length;
|
|
55368
|
+
const freshChild = emitStatic2(ctx2, child, tracked2, effectsVar);
|
|
55369
|
+
const buildLines = ctx2.lines.splice(buildStart, ctx2.lines.length - buildStart);
|
|
55370
|
+
ctx2.hydrate = savedHydrate;
|
|
55371
|
+
const childSlot = ctx2.n();
|
|
55372
|
+
ctx2.push(`const ${childSlot} = ${el}.__vsk_ssrEls ? ${el}.__vsk_ssrEls[${residueBefore}] : (() => {`);
|
|
55373
|
+
for (const line of buildLines)
|
|
55374
|
+
ctx2.push(` ${line}`);
|
|
55375
|
+
ctx2.push(` return ${freshChild ?? "document.createElement('div')"};`);
|
|
55376
|
+
ctx2.push(`})();`);
|
|
55377
|
+
childVar = childSlot;
|
|
55378
|
+
const ssrEl = childSlot;
|
|
55188
55379
|
const dynAttrs2 = [];
|
|
55189
55380
|
const staticChildren = [];
|
|
55190
55381
|
for (const c of child.children) {
|
|
@@ -55428,12 +55619,12 @@ function emitDynamicBinding2(ctx2, node, tracked2, effectsVar, ssrTextExpr = nul
|
|
|
55428
55619
|
const expr = transformTracked2(node.expression, tracked2);
|
|
55429
55620
|
const v = ctx2.n();
|
|
55430
55621
|
if (!isReactiveExpression2(node.expression, tracked2)) {
|
|
55431
|
-
ctx2.push(`const ${v} = document.createTextNode(String(${expr}));`);
|
|
55622
|
+
ctx2.push(`const ${v} = document.createTextNode(String((${expr}) ?? ''));`);
|
|
55432
55623
|
return v;
|
|
55433
55624
|
}
|
|
55434
55625
|
const init = ssrTextExpr ? `String(${ssrTextExpr} ?? '')` : `''`;
|
|
55435
55626
|
ctx2.push(`const ${v} = document.createTextNode(${init});`);
|
|
55436
|
-
const eff = `effect(() => { ${v}.data = String(
|
|
55627
|
+
const eff = `effect(() => { const __v = ${expr}; ${v}.data = __v == null ? '' : String(__v); })`;
|
|
55437
55628
|
if (effectsVar) {
|
|
55438
55629
|
ctx2.push(`${effectsVar}.push(${eff});`);
|
|
55439
55630
|
} else {
|
|
@@ -56738,8 +56929,9 @@ function claimsWalkerNode2(ctx2, node) {
|
|
|
56738
56929
|
return ctx2.claimStatic || !isStaticIR2(node.children);
|
|
56739
56930
|
if (node instanceof ComponentCall)
|
|
56740
56931
|
return true;
|
|
56741
|
-
if (node instanceof OpaqueDynamicRegion)
|
|
56742
|
-
return
|
|
56932
|
+
if (node instanceof OpaqueDynamicRegion) {
|
|
56933
|
+
return branchClaimsWalker2(ctx2, node.consequentNodes) || branchClaimsWalker2(ctx2, node.alternateNodes);
|
|
56934
|
+
}
|
|
56743
56935
|
if (node instanceof MapRegion)
|
|
56744
56936
|
return true;
|
|
56745
56937
|
if (node instanceof ForLoop)
|
|
@@ -56752,6 +56944,13 @@ function claimsWalkerNode2(ctx2, node) {
|
|
|
56752
56944
|
return true;
|
|
56753
56945
|
return false;
|
|
56754
56946
|
}
|
|
56947
|
+
function branchClaimsWalker2(ctx2, nodes) {
|
|
56948
|
+
const previous = ctx2.claimStatic;
|
|
56949
|
+
ctx2.claimStatic = true;
|
|
56950
|
+
const claims = nodes.some((node) => claimsWalkerNode2(ctx2, node));
|
|
56951
|
+
ctx2.claimStatic = previous;
|
|
56952
|
+
return claims;
|
|
56953
|
+
}
|
|
56755
56954
|
function isStaticComponent2(comp) {
|
|
56756
56955
|
if (comp.style)
|
|
56757
56956
|
return false;
|
|
@@ -58105,7 +58304,7 @@ async function runEventHandlers(handlers, name, ctx2) {
|
|
|
58105
58304
|
|
|
58106
58305
|
// ../compiler/dist/md-inline.js
|
|
58107
58306
|
import { readFileSync as readFileSync25, existsSync as existsSync27 } from "node:fs";
|
|
58108
|
-
import { dirname as
|
|
58307
|
+
import { dirname as dirname18, join as join20, resolve as resolve23 } from "node:path";
|
|
58109
58308
|
var MD_EXT_MARKER2 = ".md";
|
|
58110
58309
|
function looksLikeMarkdownPath2(value) {
|
|
58111
58310
|
const v = value.trim();
|
|
@@ -58201,7 +58400,7 @@ function guessProjectRoots2(dir) {
|
|
|
58201
58400
|
roots.push(cur);
|
|
58202
58401
|
if (existsSync27(join20(cur, "package.json")))
|
|
58203
58402
|
break;
|
|
58204
|
-
const parent =
|
|
58403
|
+
const parent = dirname18(cur);
|
|
58205
58404
|
if (parent === cur)
|
|
58206
58405
|
break;
|
|
58207
58406
|
cur = parent;
|
|
@@ -58211,7 +58410,7 @@ function guessProjectRoots2(dir) {
|
|
|
58211
58410
|
|
|
58212
58411
|
// ../adapter/dist/client-bundle.js
|
|
58213
58412
|
import { readFileSync as readFileSync26, existsSync as existsSync28, writeFileSync as writeFileSync13, unlinkSync as unlinkSync4, statSync as statSync15, rmSync as rmSync4, mkdtempSync as mkdtempSync2, mkdirSync as mkdirSync12 } from "node:fs";
|
|
58214
|
-
import { resolve as resolve24, join as join21, dirname as
|
|
58413
|
+
import { resolve as resolve24, join as join21, dirname as dirname19, relative as relative6, sep as sep3 } from "node:path";
|
|
58215
58414
|
import { fileURLToPath as fileURLToPath6 } from "node:url";
|
|
58216
58415
|
import { tmpdir as tmpdir3 } from "node:os";
|
|
58217
58416
|
|
|
@@ -58299,7 +58498,7 @@ async function mapWithConcurrency2(items, limit, fn) {
|
|
|
58299
58498
|
throw firstError;
|
|
58300
58499
|
return out;
|
|
58301
58500
|
}
|
|
58302
|
-
var __dirname7 =
|
|
58501
|
+
var __dirname7 = dirname19(fileURLToPath6(import.meta.url));
|
|
58303
58502
|
function fileUnchanged2(filePath, cached) {
|
|
58304
58503
|
try {
|
|
58305
58504
|
const st = statSync15(filePath);
|
|
@@ -58481,7 +58680,10 @@ function demoteExports2(code) {
|
|
|
58481
58680
|
function chunkHasImports2(headLen, mergeAborted) {
|
|
58482
58681
|
return headLen > 0 || mergeAborted;
|
|
58483
58682
|
}
|
|
58484
|
-
function runtimeImportsOf2(filePath) {
|
|
58683
|
+
function runtimeImportsOf2(filePath, seen = /* @__PURE__ */ new Set()) {
|
|
58684
|
+
if (seen.has(filePath))
|
|
58685
|
+
return [];
|
|
58686
|
+
seen.add(filePath);
|
|
58485
58687
|
let text;
|
|
58486
58688
|
try {
|
|
58487
58689
|
text = readFileSync26(filePath, "utf8");
|
|
@@ -58502,6 +58704,30 @@ function runtimeImportsOf2(filePath) {
|
|
|
58502
58704
|
names.push(name);
|
|
58503
58705
|
}
|
|
58504
58706
|
}
|
|
58707
|
+
const relativeImport = /import\s+(?:type\s+)?(?:[^'"]*?\sfrom\s*)?['"](\.[^'"]+)['"]/g;
|
|
58708
|
+
for (const match of text.matchAll(relativeImport)) {
|
|
58709
|
+
const base = resolve24(dirname19(filePath), match[1]);
|
|
58710
|
+
const candidates = [
|
|
58711
|
+
base,
|
|
58712
|
+
`${base}.ts`,
|
|
58713
|
+
`${base}.tsx`,
|
|
58714
|
+
`${base}.js`,
|
|
58715
|
+
`${base}.jsx`,
|
|
58716
|
+
join21(base, "index.ts"),
|
|
58717
|
+
join21(base, "index.tsx"),
|
|
58718
|
+
join21(base, "index.js")
|
|
58719
|
+
];
|
|
58720
|
+
for (const candidate of candidates) {
|
|
58721
|
+
try {
|
|
58722
|
+
if (!existsSync28(candidate) || !statSync15(candidate).isFile())
|
|
58723
|
+
continue;
|
|
58724
|
+
} catch {
|
|
58725
|
+
continue;
|
|
58726
|
+
}
|
|
58727
|
+
names.push(...runtimeImportsOf2(candidate, seen));
|
|
58728
|
+
break;
|
|
58729
|
+
}
|
|
58730
|
+
}
|
|
58505
58731
|
return names;
|
|
58506
58732
|
}
|
|
58507
58733
|
function sharedRuntimeResolver2(shimPath) {
|
|
@@ -58542,7 +58768,7 @@ var ChunkImports2 = class {
|
|
|
58542
58768
|
const src2 = node.source?.value;
|
|
58543
58769
|
if (typeof src2 !== "string")
|
|
58544
58770
|
continue;
|
|
58545
|
-
const resolved = resolveImportPath(src2,
|
|
58771
|
+
const resolved = resolveImportPath(src2, dirname19(filePath));
|
|
58546
58772
|
for (const spec of node.specifiers ?? []) {
|
|
58547
58773
|
const s = spec;
|
|
58548
58774
|
const local = s.local?.name;
|
|
@@ -58879,7 +59105,7 @@ async function generateClientBundle2(routeTree, appDir, componentMap, options) {
|
|
|
58879
59105
|
__stats.distinct.add(filePath);
|
|
58880
59106
|
let src2 = readFileSync26(filePath, "utf-8");
|
|
58881
59107
|
if (/content=["'][^"']*\.md["']/i.test(src2)) {
|
|
58882
|
-
src2 = inlineMdContentAttrs(src2,
|
|
59108
|
+
src2 = inlineMdContentAttrs(src2, dirname19(filePath), guessProjectRoots(appDir));
|
|
58883
59109
|
}
|
|
58884
59110
|
const namesBefore = cache2 ? new Set(runtimeImportNames) : null;
|
|
58885
59111
|
const importedPaths = resolveVskImports(filePath, (p, n) => compileFile2(p, n, output, imports));
|
|
@@ -58985,6 +59211,7 @@ async function generateClientBundle2(routeTree, appDir, componentMap, options) {
|
|
|
58985
59211
|
}
|
|
58986
59212
|
if (chunkCode.length > 0) {
|
|
58987
59213
|
const chunkName = `page-${buildChunkName2(appDir, node)}.js`;
|
|
59214
|
+
allRouteImportTables.push(chunkImports);
|
|
58988
59215
|
if (!onlyRoutes || onlyRoutes.has(node.fullPath)) {
|
|
58989
59216
|
if (!chunkImports.ok)
|
|
58990
59217
|
console.error("[vesk] chunk import merge aborted for", chunkName + ":", chunkImports.reason);
|
|
@@ -59002,7 +59229,7 @@ async function generateClientBundle2(routeTree, appDir, componentMap, options) {
|
|
|
59002
59229
|
if (emitted) {
|
|
59003
59230
|
const fileName = options?.hmr ? chunkName : hashedName(chunkName, emitted.code);
|
|
59004
59231
|
node.chunk = `/_vesk/static/${fileName}`;
|
|
59005
|
-
} else if (options?.skipRouteChunks) {
|
|
59232
|
+
} else if (options?.skipRouteChunks && (node.page || node.layout)) {
|
|
59006
59233
|
node.chunk = `/_vesk/static/${chunkName}`;
|
|
59007
59234
|
}
|
|
59008
59235
|
annotate2(node.children || []);
|
|
@@ -59010,6 +59237,7 @@ async function generateClientBundle2(routeTree, appDir, componentMap, options) {
|
|
|
59010
59237
|
};
|
|
59011
59238
|
var walkSplit = walkSplit2, annotate = annotate2;
|
|
59012
59239
|
const chunkEntries = [];
|
|
59240
|
+
const allRouteImportTables = [];
|
|
59013
59241
|
walkSplit2(routeTree, []);
|
|
59014
59242
|
const sharedCode = [];
|
|
59015
59243
|
const sharedImports = new ChunkImports2();
|
|
@@ -59032,16 +59260,39 @@ ${body}
|
|
|
59032
59260
|
})();
|
|
59033
59261
|
`;
|
|
59034
59262
|
const sharedUsage = /* @__PURE__ */ new Map();
|
|
59035
|
-
|
|
59036
|
-
|
|
59263
|
+
const sharedUsageTables = [...allRouteImportTables];
|
|
59264
|
+
if (sharedCode.length > 0)
|
|
59265
|
+
sharedUsageTables.push(sharedImports);
|
|
59266
|
+
for (const table of sharedUsageTables) {
|
|
59267
|
+
for (const source of new Set(table.sources())) {
|
|
59037
59268
|
sharedUsage.set(source, (sharedUsage.get(source) ?? 0) + 1);
|
|
59038
59269
|
}
|
|
59039
59270
|
}
|
|
59040
59271
|
const isAppLocal = (source) => !source.includes("node_modules") && source.startsWith(resolve24(appDir, ".."));
|
|
59041
|
-
const
|
|
59272
|
+
const sharedFilesFor = /* @__PURE__ */ new Map();
|
|
59273
|
+
for (const [source, uses] of sharedUsage) {
|
|
59274
|
+
let file = source;
|
|
59275
|
+
if (!source.startsWith("/")) {
|
|
59276
|
+
try {
|
|
59277
|
+
file = resolveSsrModule(source, appDir) ?? source;
|
|
59278
|
+
} catch {
|
|
59279
|
+
}
|
|
59280
|
+
}
|
|
59281
|
+
if (file.endsWith(".vsk") || !existsSync28(file))
|
|
59282
|
+
continue;
|
|
59283
|
+
let needsRuntime = false;
|
|
59284
|
+
try {
|
|
59285
|
+
needsRuntime = runtimeImportsOf2(file).length > 0;
|
|
59286
|
+
} catch {
|
|
59287
|
+
}
|
|
59288
|
+
if (needsRuntime || uses > 1 && isAppLocal(source)) {
|
|
59289
|
+
sharedFilesFor.set(source, file);
|
|
59290
|
+
}
|
|
59291
|
+
}
|
|
59292
|
+
const sharedSources = [...new Set(sharedFilesFor.values())];
|
|
59042
59293
|
if (process.env.VESK_DEBUG_SHARED) {
|
|
59043
59294
|
console.error("[shared] candidates:", [...sharedUsage.entries()].map(([s, n]) => `${n}x ${s}`).join("\n"));
|
|
59044
|
-
console.error("[shared] selected:",
|
|
59295
|
+
console.error("[shared] selected:", [...sharedFilesFor.entries()].map(([s, f]) => `${s} -> ${f}`).join("\n"));
|
|
59045
59296
|
}
|
|
59046
59297
|
const chunkAlias = {};
|
|
59047
59298
|
let sharedBundleCode = "";
|
|
@@ -59092,7 +59343,7 @@ ${body}
|
|
|
59092
59343
|
...appTsconfig ? { tsconfig: appTsconfig } : {}
|
|
59093
59344
|
});
|
|
59094
59345
|
sharedBundleCode = result.outputFiles[0].text;
|
|
59095
|
-
|
|
59346
|
+
[...sharedFilesFor.entries()].forEach(([source, file], i) => {
|
|
59096
59347
|
const named = /* @__PURE__ */ new Set();
|
|
59097
59348
|
let hasDefault = false;
|
|
59098
59349
|
for (const entry of chunkEntries) {
|
|
@@ -59101,7 +59352,7 @@ ${body}
|
|
|
59101
59352
|
hasDefault = hasDefault || bindings.hasDefault;
|
|
59102
59353
|
}
|
|
59103
59354
|
const shim = join21(tmpBase, `shim-${i}.js`);
|
|
59104
|
-
const shimLines = [`const m = globalThis.__veskShared[${JSON.stringify(
|
|
59355
|
+
const shimLines = [`const m = globalThis.__veskShared[${JSON.stringify(file)}];`];
|
|
59105
59356
|
if (hasDefault)
|
|
59106
59357
|
shimLines.push(`export default m;`);
|
|
59107
59358
|
for (const name of [...named].sort()) {
|
|
@@ -59407,7 +59658,7 @@ async function bundleRuntimeNames2(runtimeDir, names, strict = false) {
|
|
|
59407
59658
|
const unique = [...new Set(names)];
|
|
59408
59659
|
try {
|
|
59409
59660
|
try {
|
|
59410
|
-
mkdirSync12(
|
|
59661
|
+
mkdirSync12(dirname19(entry), { recursive: true });
|
|
59411
59662
|
} catch {
|
|
59412
59663
|
}
|
|
59413
59664
|
try {
|
|
@@ -59648,7 +59899,7 @@ import { resolve as resolve28 } from "node:path";
|
|
|
59648
59899
|
// ../adapter/dist/plugins.js
|
|
59649
59900
|
init_paths();
|
|
59650
59901
|
import { readFileSync as readFileSync28, writeFileSync as writeFileSync14, existsSync as existsSync30, mkdirSync as mkdirSync13, statSync as statSync17 } from "node:fs";
|
|
59651
|
-
import { resolve as resolve26, dirname as
|
|
59902
|
+
import { resolve as resolve26, dirname as dirname20, join as join22, extname as extname6, basename as basename6 } from "node:path";
|
|
59652
59903
|
import { createRequire as createRequire6 } from "node:module";
|
|
59653
59904
|
import { spawn as spawn2 } from "node:child_process";
|
|
59654
59905
|
var PLUGIN_STATE_FILENAME2 = "plugins.json";
|
|
@@ -59689,7 +59940,7 @@ function readPluginState2(veskDir) {
|
|
|
59689
59940
|
}
|
|
59690
59941
|
function writePluginState2(veskDir, state) {
|
|
59691
59942
|
const file = stateFilePath2(veskDir);
|
|
59692
|
-
const dir =
|
|
59943
|
+
const dir = dirname20(file);
|
|
59693
59944
|
if (!existsSync30(dir))
|
|
59694
59945
|
mkdirSync13(dir, { recursive: true });
|
|
59695
59946
|
writeFileSync14(file, JSON.stringify(state, null, 2) + "\n", "utf-8");
|
|
@@ -59704,16 +59955,16 @@ function resolvePackage2(appDir, pkg) {
|
|
|
59704
59955
|
} catch {
|
|
59705
59956
|
try {
|
|
59706
59957
|
entryPath = require3.resolve(pkg);
|
|
59707
|
-
let cur =
|
|
59958
|
+
let cur = dirname20(entryPath);
|
|
59708
59959
|
const seen = /* @__PURE__ */ new Set();
|
|
59709
|
-
while (cur && cur !==
|
|
59960
|
+
while (cur && cur !== dirname20(cur) && !seen.has(cur)) {
|
|
59710
59961
|
seen.add(cur);
|
|
59711
59962
|
const candidate = join22(cur, "package.json");
|
|
59712
59963
|
if (existsSync30(candidate)) {
|
|
59713
59964
|
pkgJsonPath = candidate;
|
|
59714
59965
|
break;
|
|
59715
59966
|
}
|
|
59716
|
-
const parent =
|
|
59967
|
+
const parent = dirname20(cur);
|
|
59717
59968
|
if (parent !== cur && basename6(cur) === "node_modules")
|
|
59718
59969
|
break;
|
|
59719
59970
|
cur = parent;
|
|
@@ -59724,7 +59975,7 @@ function resolvePackage2(appDir, pkg) {
|
|
|
59724
59975
|
if (pkgJsonPath && existsSync30(pkgJsonPath)) {
|
|
59725
59976
|
pkgJson = readJsonFile2(pkgJsonPath);
|
|
59726
59977
|
const main = pkgJson?.main || pkgJson?.module || "index.js";
|
|
59727
|
-
entryPath = resolve26(
|
|
59978
|
+
entryPath = resolve26(dirname20(pkgJsonPath), main);
|
|
59728
59979
|
}
|
|
59729
59980
|
let localPath = localDir2(appDir, pkg);
|
|
59730
59981
|
if (!localPath) {
|
|
@@ -59745,7 +59996,7 @@ function resolvePackage2(appDir, pkg) {
|
|
|
59745
59996
|
return { installed: true, path: localPath, dir: localPath, packageJson: json ?? pkgJson };
|
|
59746
59997
|
}
|
|
59747
59998
|
const installed2 = !!pkgJsonPath && existsSync30(pkgJsonPath);
|
|
59748
|
-
return { installed: installed2, path: entryPath, dir: installed2 ?
|
|
59999
|
+
return { installed: installed2, path: entryPath, dir: installed2 ? dirname20(pkgJsonPath) : null, packageJson: pkgJson };
|
|
59749
60000
|
}
|
|
59750
60001
|
function localDir2(base, pkg) {
|
|
59751
60002
|
if (pkg.startsWith("@")) {
|
|
@@ -60625,7 +60876,7 @@ var __internals2 = {
|
|
|
60625
60876
|
// ../adapter/dist/dev-config.js
|
|
60626
60877
|
import { existsSync as existsSync31, readFileSync as readFileSync29, writeFileSync as writeFileSync15, mkdirSync as mkdirSync14, mkdtempSync as mkdtempSync3, rmSync as rmSync5 } from "node:fs";
|
|
60627
60878
|
import { tmpdir as tmpdir4 } from "node:os";
|
|
60628
|
-
import { resolve as resolve27, dirname as
|
|
60879
|
+
import { resolve as resolve27, dirname as dirname21, join as join23 } from "node:path";
|
|
60629
60880
|
init_parser();
|
|
60630
60881
|
function findConfigFile2(projectDir) {
|
|
60631
60882
|
const ts9 = resolve27(projectDir, "vesk.config.ts");
|
|
@@ -60690,7 +60941,7 @@ async function writeConfigSource2(projectDir, source) {
|
|
|
60690
60941
|
const { path, isTs } = findConfigFile2(projectDir);
|
|
60691
60942
|
const target = path || resolve27(projectDir, "vesk.config.ts");
|
|
60692
60943
|
await parseConfigSource(source, isTs, projectDir);
|
|
60693
|
-
mkdirSync14(
|
|
60944
|
+
mkdirSync14(dirname21(target), { recursive: true });
|
|
60694
60945
|
writeFileSync15(target, source, "utf-8");
|
|
60695
60946
|
const config = await parseConfigSource(source, isTs, projectDir);
|
|
60696
60947
|
return { path: target, exists: true, source, config };
|
|
@@ -61965,7 +62216,7 @@ function produceDiagnostics(input) {
|
|
|
61965
62216
|
|
|
61966
62217
|
// ../agentic/dist/checkpoints.js
|
|
61967
62218
|
import { existsSync as existsSync33, mkdirSync as mkdirSync15, readFileSync as readFileSync31, writeFileSync as writeFileSync16, statSync as statSync19, unlinkSync as unlinkSync5, rmSync as rmSync6, renameSync } from "node:fs";
|
|
61968
|
-
import { join as join24, resolve as resolve29, dirname as
|
|
62219
|
+
import { join as join24, resolve as resolve29, dirname as dirname22, sep as sep5 } from "node:path";
|
|
61969
62220
|
import { randomUUID as nodeRandomUUID } from "node:crypto";
|
|
61970
62221
|
function generateId() {
|
|
61971
62222
|
try {
|
|
@@ -62125,7 +62376,7 @@ function readJson(filePath, fallback) {
|
|
|
62125
62376
|
}
|
|
62126
62377
|
}
|
|
62127
62378
|
function writeJsonAtomic(filePath, data2) {
|
|
62128
|
-
ensureDir(
|
|
62379
|
+
ensureDir(dirname22(filePath));
|
|
62129
62380
|
const tmp = `${filePath}.tmp`;
|
|
62130
62381
|
writeFileSync16(tmp, JSON.stringify(data2, null, 2), "utf-8");
|
|
62131
62382
|
try {
|
|
@@ -62226,7 +62477,7 @@ function rollback(projectDir, id) {
|
|
|
62226
62477
|
}
|
|
62227
62478
|
} else {
|
|
62228
62479
|
try {
|
|
62229
|
-
ensureDir(
|
|
62480
|
+
ensureDir(dirname22(abs));
|
|
62230
62481
|
writeFileSync16(abs, f.before, "utf-8");
|
|
62231
62482
|
} catch {
|
|
62232
62483
|
}
|
|
@@ -62237,7 +62488,7 @@ function rollback(projectDir, id) {
|
|
|
62237
62488
|
|
|
62238
62489
|
// ../agentic/dist/config.js
|
|
62239
62490
|
import { readFileSync as readFileSync32, writeFileSync as writeFileSync17, existsSync as existsSync34, mkdirSync as mkdirSync16, chmodSync } from "node:fs";
|
|
62240
|
-
import { resolve as resolve30, dirname as
|
|
62491
|
+
import { resolve as resolve30, dirname as dirname23 } from "node:path";
|
|
62241
62492
|
var DEFAULT_CONFIG = {
|
|
62242
62493
|
provider: "openai",
|
|
62243
62494
|
model: "",
|
|
@@ -62366,7 +62617,7 @@ function saveAgenticConfig(projectDir, patch) {
|
|
|
62366
62617
|
if (next.baseUrl)
|
|
62367
62618
|
toWrite.baseUrl = next.baseUrl;
|
|
62368
62619
|
try {
|
|
62369
|
-
mkdirSync16(
|
|
62620
|
+
mkdirSync16(dirname23(p), { recursive: true });
|
|
62370
62621
|
writeFileSync17(p, JSON.stringify(toWrite, null, 2), "utf-8");
|
|
62371
62622
|
} catch {
|
|
62372
62623
|
}
|
|
@@ -63692,7 +63943,7 @@ var Agent = class {
|
|
|
63692
63943
|
|
|
63693
63944
|
// ../agentic/dist/tools/vesk.js
|
|
63694
63945
|
import { existsSync as existsSync36, readFileSync as readFileSync34, writeFileSync as writeFileSync18, mkdirSync as mkdirSync17, readdirSync as readdirSync11, statSync as statSync20 } from "node:fs";
|
|
63695
|
-
import { resolve as resolve32, join as join25, dirname as
|
|
63946
|
+
import { resolve as resolve32, join as join25, dirname as dirname24, sep as sep6 } from "node:path";
|
|
63696
63947
|
function resolveWithin3(baseDir, relPath) {
|
|
63697
63948
|
const base = resolve32(baseDir);
|
|
63698
63949
|
const target = resolve32(baseDir, relPath);
|
|
@@ -63725,7 +63976,7 @@ function readPluginState3(veskDir) {
|
|
|
63725
63976
|
}
|
|
63726
63977
|
function writePluginState3(veskDir, state) {
|
|
63727
63978
|
const file = stateFilePath3(veskDir);
|
|
63728
|
-
mkdirSync17(
|
|
63979
|
+
mkdirSync17(dirname24(file), { recursive: true });
|
|
63729
63980
|
writeFileSync18(file, JSON.stringify(state, null, 2) + "\n", "utf-8");
|
|
63730
63981
|
}
|
|
63731
63982
|
function eqIgnoreCase3(a, b) {
|
|
@@ -64085,7 +64336,7 @@ function createVeskTools(deps) {
|
|
|
64085
64336
|
if (!contained)
|
|
64086
64337
|
return jsonError("path escapes project root");
|
|
64087
64338
|
}
|
|
64088
|
-
mkdirSync17(
|
|
64339
|
+
mkdirSync17(dirname24(target), { recursive: true });
|
|
64089
64340
|
writeFileSync18(target, source, "utf-8");
|
|
64090
64341
|
return jsonOk({ ok: true, path: target, source });
|
|
64091
64342
|
}
|
|
@@ -64506,19 +64757,34 @@ function renderDefaultNotFoundPage2(opts = {}) {
|
|
|
64506
64757
|
});
|
|
64507
64758
|
}
|
|
64508
64759
|
|
|
64509
|
-
// ../adapter/dist/
|
|
64760
|
+
// ../adapter/dist/ssr-function.js
|
|
64510
64761
|
import { readFileSync as readFileSync35, existsSync as existsSync37 } from "node:fs";
|
|
64511
|
-
import { resolve as resolve33 } from "node:path";
|
|
64762
|
+
import { resolve as resolve33, relative as relative7, join as join26 } from "node:path";
|
|
64763
|
+
init_default_pages();
|
|
64764
|
+
function resolveBoundaryFileForUrl2(pathname, appDir, file) {
|
|
64765
|
+
const segments = pathname.split("/").filter(Boolean);
|
|
64766
|
+
for (let depth = segments.length; depth >= 0; depth--) {
|
|
64767
|
+
const dir = join26(appDir, ...segments.slice(0, depth));
|
|
64768
|
+
const p = join26(dir, file);
|
|
64769
|
+
if (existsSync37(p))
|
|
64770
|
+
return p;
|
|
64771
|
+
}
|
|
64772
|
+
return null;
|
|
64773
|
+
}
|
|
64774
|
+
|
|
64775
|
+
// ../adapter/dist/css.js
|
|
64776
|
+
import { readFileSync as readFileSync36, existsSync as existsSync38 } from "node:fs";
|
|
64777
|
+
import { resolve as resolve34 } from "node:path";
|
|
64512
64778
|
var GLOBAL_CSS_URL2 = "/_vesk/static/global.css";
|
|
64513
64779
|
function resolveUserCssPath2(appDir) {
|
|
64514
|
-
const appCssSrc =
|
|
64515
|
-
if (
|
|
64780
|
+
const appCssSrc = resolve34(appDir, "global.css");
|
|
64781
|
+
if (existsSync38(appCssSrc))
|
|
64516
64782
|
return appCssSrc;
|
|
64517
|
-
const cssSrc =
|
|
64518
|
-
if (
|
|
64783
|
+
const cssSrc = resolve34(appDir, "..", "src", "global.css");
|
|
64784
|
+
if (existsSync38(cssSrc))
|
|
64519
64785
|
return cssSrc;
|
|
64520
|
-
const altCssSrc =
|
|
64521
|
-
if (
|
|
64786
|
+
const altCssSrc = resolve34(appDir, "..", "src", "app.css");
|
|
64787
|
+
if (existsSync38(altCssSrc))
|
|
64522
64788
|
return altCssSrc;
|
|
64523
64789
|
return null;
|
|
64524
64790
|
}
|
|
@@ -64534,8 +64800,8 @@ function resolveCssUrls2(opts) {
|
|
|
64534
64800
|
// ../adapter/dist/hmr.js
|
|
64535
64801
|
init_client_codegen();
|
|
64536
64802
|
import { WebSocketServer } from "ws";
|
|
64537
|
-
import { readFileSync as
|
|
64538
|
-
import { resolve as
|
|
64803
|
+
import { readFileSync as readFileSync37, existsSync as existsSync39, writeFileSync as writeFileSync19 } from "node:fs";
|
|
64804
|
+
import { resolve as resolve35, dirname as dirname25 } from "node:path";
|
|
64539
64805
|
import { fileURLToPath as fileURLToPath7 } from "node:url";
|
|
64540
64806
|
init_default_pages();
|
|
64541
64807
|
init_paths();
|
|
@@ -64743,7 +65009,7 @@ function suggestFor(message) {
|
|
|
64743
65009
|
}
|
|
64744
65010
|
|
|
64745
65011
|
// ../adapter/dist/hmr.js
|
|
64746
|
-
var __dirname8 =
|
|
65012
|
+
var __dirname8 = dirname25(fileURLToPath7(import.meta.url));
|
|
64747
65013
|
function buildErrorPayload(error, filename, opts = {}) {
|
|
64748
65014
|
const file = typeof filename === "string" && filename ? filename : "unknown";
|
|
64749
65015
|
const parsed = parseCompilerError(error, file);
|
|
@@ -64766,19 +65032,19 @@ function buildErrorPayload(error, filename, opts = {}) {
|
|
|
64766
65032
|
if (file.startsWith("/")) {
|
|
64767
65033
|
candidates.push(file);
|
|
64768
65034
|
} else {
|
|
64769
|
-
candidates.push(
|
|
65035
|
+
candidates.push(resolve35(opts.appDir, file));
|
|
64770
65036
|
if (file.startsWith("app/")) {
|
|
64771
|
-
candidates.push(
|
|
64772
|
-
candidates.push(
|
|
65037
|
+
candidates.push(resolve35(opts.appDir, file.slice(4)));
|
|
65038
|
+
candidates.push(resolve35(opts.appDir, "..", file));
|
|
64773
65039
|
} else {
|
|
64774
|
-
candidates.push(
|
|
65040
|
+
candidates.push(resolve35(opts.appDir, "..", file));
|
|
64775
65041
|
}
|
|
64776
|
-
candidates.push(
|
|
65042
|
+
candidates.push(resolve35(file));
|
|
64777
65043
|
}
|
|
64778
65044
|
for (const absPath of candidates) {
|
|
64779
65045
|
try {
|
|
64780
|
-
if (
|
|
64781
|
-
src2 =
|
|
65046
|
+
if (existsSync39(absPath)) {
|
|
65047
|
+
src2 = readFileSync37(absPath, "utf-8");
|
|
64782
65048
|
resolvedAbsPath = absPath;
|
|
64783
65049
|
break;
|
|
64784
65050
|
}
|
|
@@ -64794,7 +65060,7 @@ function buildErrorPayload(error, filename, opts = {}) {
|
|
|
64794
65060
|
}
|
|
64795
65061
|
}
|
|
64796
65062
|
const tipsData = suggestFor(message);
|
|
64797
|
-
const filePath = resolvedAbsPath ?? (typeof opts.appDir === "string" ?
|
|
65063
|
+
const filePath = resolvedAbsPath ?? (typeof opts.appDir === "string" ? resolve35(opts.appDir, file) : void 0);
|
|
64798
65064
|
const errorCode = parsed && typeof parsed.code === "string" && parsed.code ? parsed.code : error?.code ? String(error.code) : void 0;
|
|
64799
65065
|
const cleanMessage = filePath && message.endsWith(` in ${filePath}`) ? message.slice(0, -` in ${filePath}`.length).trim() : message.endsWith(` in ${file}`) ? message.slice(0, -` in ${file}`.length).trim() : message;
|
|
64800
65066
|
const payload = {
|
|
@@ -64826,8 +65092,8 @@ function buildErrorPayload(error, filename, opts = {}) {
|
|
|
64826
65092
|
}
|
|
64827
65093
|
|
|
64828
65094
|
// ../adapter/dist/ssr-error.js
|
|
64829
|
-
import { existsSync as
|
|
64830
|
-
import { relative as
|
|
65095
|
+
import { existsSync as existsSync40, readFileSync as readFileSync38 } from "node:fs";
|
|
65096
|
+
import { relative as relative8, resolve as resolve36 } from "node:path";
|
|
64831
65097
|
|
|
64832
65098
|
// ../adapter/dist/error-codeframe.js
|
|
64833
65099
|
function buildCodeframe2(src2, line, column, context = 5) {
|
|
@@ -65011,7 +65277,7 @@ function firstSourceFileFrame(stack, projectRoot) {
|
|
|
65011
65277
|
if (!isInsideRoot(p, projectRoot))
|
|
65012
65278
|
continue;
|
|
65013
65279
|
try {
|
|
65014
|
-
if (!
|
|
65280
|
+
if (!existsSync40(p))
|
|
65015
65281
|
continue;
|
|
65016
65282
|
} catch {
|
|
65017
65283
|
continue;
|
|
@@ -65042,22 +65308,22 @@ function findIdentifierUsage(src2, name) {
|
|
|
65042
65308
|
return null;
|
|
65043
65309
|
}
|
|
65044
65310
|
function projectOf(ctx2) {
|
|
65045
|
-
return ctx2.projectDir ||
|
|
65311
|
+
return ctx2.projectDir || resolve36(ctx2.appDir, "..");
|
|
65046
65312
|
}
|
|
65047
65313
|
function displayPath(absPath, ctx2) {
|
|
65048
|
-
const appRel =
|
|
65314
|
+
const appRel = relative8(ctx2.appDir, absPath);
|
|
65049
65315
|
if (appRel && !appRel.startsWith(".."))
|
|
65050
65316
|
return appRel || absPath;
|
|
65051
|
-
const projRel =
|
|
65317
|
+
const projRel = relative8(projectOf(ctx2), absPath);
|
|
65052
65318
|
if (projRel && !projRel.startsWith(".."))
|
|
65053
65319
|
return projRel;
|
|
65054
65320
|
return absPath;
|
|
65055
65321
|
}
|
|
65056
65322
|
function readIfFile(absPath) {
|
|
65057
65323
|
try {
|
|
65058
|
-
if (!
|
|
65324
|
+
if (!existsSync40(absPath))
|
|
65059
65325
|
return null;
|
|
65060
|
-
return
|
|
65326
|
+
return readFileSync38(absPath, "utf-8");
|
|
65061
65327
|
} catch {
|
|
65062
65328
|
return null;
|
|
65063
65329
|
}
|
|
@@ -65065,13 +65331,13 @@ function readIfFile(absPath) {
|
|
|
65065
65331
|
function resolveComponentFile(name, ctx2) {
|
|
65066
65332
|
const fromRoutes = ctx2.routeSources?.get(name);
|
|
65067
65333
|
if (fromRoutes) {
|
|
65068
|
-
const abs =
|
|
65334
|
+
const abs = resolve36(ctx2.appDir, fromRoutes);
|
|
65069
65335
|
if (readIfFile(abs) !== null)
|
|
65070
65336
|
return abs;
|
|
65071
65337
|
}
|
|
65072
65338
|
const fromShared = ctx2.componentMap?.get(name);
|
|
65073
65339
|
if (fromShared) {
|
|
65074
|
-
const abs =
|
|
65340
|
+
const abs = resolve36(projectOf(ctx2), fromShared);
|
|
65075
65341
|
if (readIfFile(abs) !== null)
|
|
65076
65342
|
return abs;
|
|
65077
65343
|
if (readIfFile(fromShared) !== null)
|
|
@@ -65205,13 +65471,13 @@ function renderDevErrorPage(payload, opts) {
|
|
|
65205
65471
|
|
|
65206
65472
|
// src/build-packages.ts
|
|
65207
65473
|
import { spawnSync as spawnSync2 } from "node:child_process";
|
|
65208
|
-
import { cpSync as cpSync2, existsSync as
|
|
65474
|
+
import { cpSync as cpSync2, existsSync as existsSync41, mkdirSync as mkdirSync18, readFileSync as readFileSync39, readdirSync as readdirSync12, statSync as statSync21, writeFileSync as writeFileSync20 } from "node:fs";
|
|
65209
65475
|
import { createRequire as createRequire7 } from "node:module";
|
|
65210
|
-
import { dirname as
|
|
65476
|
+
import { dirname as dirname26, join as join27, resolve as resolve37 } from "node:path";
|
|
65211
65477
|
import { fileURLToPath as fileURLToPath8 } from "node:url";
|
|
65212
65478
|
var require2 = createRequire7(import.meta.url);
|
|
65213
|
-
var __dirname9 =
|
|
65214
|
-
var root2 =
|
|
65479
|
+
var __dirname9 = dirname26(fileURLToPath8(import.meta.url));
|
|
65480
|
+
var root2 = resolve37(__dirname9, "..", "..", "..");
|
|
65215
65481
|
var PACKAGES = {
|
|
65216
65482
|
// types first — it is a dependency-free leaf that compiler and adapter
|
|
65217
65483
|
// import for their shared type definitions.
|
|
@@ -65242,7 +65508,7 @@ var PACKAGES = {
|
|
|
65242
65508
|
function newestSourceMtime(srcDir) {
|
|
65243
65509
|
let newest = 0;
|
|
65244
65510
|
for (const name of readdirSync12(srcDir)) {
|
|
65245
|
-
const p =
|
|
65511
|
+
const p = join27(srcDir, name);
|
|
65246
65512
|
const st = statSync21(p);
|
|
65247
65513
|
if (st.isDirectory()) {
|
|
65248
65514
|
newest = Math.max(newest, newestSourceMtime(p));
|
|
@@ -65253,11 +65519,11 @@ function newestSourceMtime(srcDir) {
|
|
|
65253
65519
|
return newest;
|
|
65254
65520
|
}
|
|
65255
65521
|
function distStale(pkgDir, entry) {
|
|
65256
|
-
const distIndex =
|
|
65257
|
-
if (!
|
|
65258
|
-
const distPkg =
|
|
65259
|
-
const distStamp = Math.max(statSync21(distIndex).mtimeMs,
|
|
65260
|
-
return newestSourceMtime(
|
|
65522
|
+
const distIndex = join27(pkgDir, "dist", `${entry}.js`);
|
|
65523
|
+
if (!existsSync41(distIndex)) return true;
|
|
65524
|
+
const distPkg = join27(pkgDir, "dist", "package.json");
|
|
65525
|
+
const distStamp = Math.max(statSync21(distIndex).mtimeMs, existsSync41(distPkg) ? statSync21(distPkg).mtimeMs : 0);
|
|
65526
|
+
return newestSourceMtime(join27(pkgDir, "src")) > distStamp;
|
|
65261
65527
|
}
|
|
65262
65528
|
function distPackageJson(pkgName, entry, serverEntry, version2) {
|
|
65263
65529
|
const exports = {
|
|
@@ -65280,24 +65546,24 @@ function distPackageJson(pkgName, entry, serverEntry, version2) {
|
|
|
65280
65546
|
}
|
|
65281
65547
|
function buildPackages(force = false) {
|
|
65282
65548
|
for (const [pkg, cfg] of Object.entries(PACKAGES)) {
|
|
65283
|
-
const pkgDir =
|
|
65284
|
-
if (!
|
|
65549
|
+
const pkgDir = resolve37(root2, "packages", pkg);
|
|
65550
|
+
if (!existsSync41(join27(pkgDir, "src"))) continue;
|
|
65285
65551
|
if (!force && !distStale(pkgDir, cfg.entry)) continue;
|
|
65286
65552
|
console.log(`[build] ${cfg.name} -> tsc`);
|
|
65287
65553
|
const tscBin = require2.resolve("typescript/bin/tsc");
|
|
65288
|
-
const result = spawnSync2(process.execPath, [tscBin, "-p",
|
|
65554
|
+
const result = spawnSync2(process.execPath, [tscBin, "-p", join27(pkgDir, "tsconfig.build.json")], {
|
|
65289
65555
|
stdio: "inherit"
|
|
65290
65556
|
});
|
|
65291
65557
|
if (result.status !== 0) {
|
|
65292
65558
|
throw new Error(`tsc failed for ${cfg.name}`);
|
|
65293
65559
|
}
|
|
65294
|
-
const distDir =
|
|
65560
|
+
const distDir = join27(pkgDir, "dist");
|
|
65295
65561
|
for (const c of cfg.copy || []) {
|
|
65296
|
-
const to =
|
|
65297
|
-
mkdirSync18(
|
|
65298
|
-
cpSync2(
|
|
65562
|
+
const to = join27(distDir, c.to);
|
|
65563
|
+
mkdirSync18(dirname26(to), { recursive: true });
|
|
65564
|
+
cpSync2(join27(pkgDir, c.from), to, { recursive: true });
|
|
65299
65565
|
}
|
|
65300
|
-
const srcPkg = JSON.parse(
|
|
65566
|
+
const srcPkg = JSON.parse(readFileSync39(join27(pkgDir, "package.json"), "utf-8"));
|
|
65301
65567
|
if (pkg === "lucide-vesk") {
|
|
65302
65568
|
const lucideDistPkg = {
|
|
65303
65569
|
name: srcPkg.name,
|
|
@@ -65311,9 +65577,9 @@ function buildPackages(force = false) {
|
|
|
65311
65577
|
"./package.json": "./package.json"
|
|
65312
65578
|
}
|
|
65313
65579
|
};
|
|
65314
|
-
writeFileSync20(
|
|
65580
|
+
writeFileSync20(join27(distDir, "package.json"), JSON.stringify(lucideDistPkg, null, 2) + "\n");
|
|
65315
65581
|
} else {
|
|
65316
|
-
writeFileSync20(
|
|
65582
|
+
writeFileSync20(join27(distDir, "package.json"), distPackageJson(cfg.name, cfg.entry, cfg.serverEntry, srcPkg.version || "1.0.0"));
|
|
65317
65583
|
}
|
|
65318
65584
|
console.log(`[build] ${cfg.name} -> dist`);
|
|
65319
65585
|
}
|
|
@@ -65321,13 +65587,13 @@ function buildPackages(force = false) {
|
|
|
65321
65587
|
function ensurePackagesBuilt() {
|
|
65322
65588
|
buildPackages(false);
|
|
65323
65589
|
}
|
|
65324
|
-
if (process.argv[1] &&
|
|
65590
|
+
if (process.argv[1] && resolve37(process.argv[1]) === fileURLToPath8(import.meta.url)) {
|
|
65325
65591
|
buildPackages(process.argv.includes("--force"));
|
|
65326
65592
|
}
|
|
65327
65593
|
|
|
65328
65594
|
// src/action-handler.ts
|
|
65329
|
-
import { existsSync as
|
|
65330
|
-
import { resolve as
|
|
65595
|
+
import { existsSync as existsSync42, readFileSync as readFileSync40, readdirSync as readdirSync13 } from "node:fs";
|
|
65596
|
+
import { resolve as resolve38 } from "node:path";
|
|
65331
65597
|
|
|
65332
65598
|
// ../compiler/dist/server-cookies.js
|
|
65333
65599
|
function parseCookies3(str3) {
|
|
@@ -65410,8 +65676,8 @@ function pageSourcesFor(appDirPath, routeTree) {
|
|
|
65410
65676
|
const out = [];
|
|
65411
65677
|
function walk9(nodes) {
|
|
65412
65678
|
for (const node of nodes) {
|
|
65413
|
-
if (node.page) out.push(
|
|
65414
|
-
if (node.layout) out.push(
|
|
65679
|
+
if (node.page) out.push(resolve38(appDirPath, node.sourceDir, "page.vsk"));
|
|
65680
|
+
if (node.layout) out.push(resolve38(appDirPath, node.sourceDir, "layout.vsk"));
|
|
65415
65681
|
walk9(node.children);
|
|
65416
65682
|
}
|
|
65417
65683
|
}
|
|
@@ -65419,7 +65685,7 @@ function pageSourcesFor(appDirPath, routeTree) {
|
|
|
65419
65685
|
return out;
|
|
65420
65686
|
}
|
|
65421
65687
|
function walkVskFiles(dir, out, seen) {
|
|
65422
|
-
if (!
|
|
65688
|
+
if (!existsSync42(dir)) return;
|
|
65423
65689
|
let entries;
|
|
65424
65690
|
try {
|
|
65425
65691
|
entries = readdirSync13(dir, { withFileTypes: true });
|
|
@@ -65427,7 +65693,7 @@ function walkVskFiles(dir, out, seen) {
|
|
|
65427
65693
|
return;
|
|
65428
65694
|
}
|
|
65429
65695
|
for (const entry of entries) {
|
|
65430
|
-
const full =
|
|
65696
|
+
const full = resolve38(dir, entry.name);
|
|
65431
65697
|
if (seen.has(full)) continue;
|
|
65432
65698
|
seen.add(full);
|
|
65433
65699
|
if (entry.isDirectory()) {
|
|
@@ -65447,16 +65713,16 @@ function candidateSources(appDirPath, routeTree) {
|
|
|
65447
65713
|
seen.add(src2);
|
|
65448
65714
|
out.push(src2);
|
|
65449
65715
|
}
|
|
65450
|
-
const projectRoot =
|
|
65451
|
-
for (const dir of [
|
|
65716
|
+
const projectRoot = resolve38(appDirPath, "..");
|
|
65717
|
+
for (const dir of [resolve38(projectRoot, "components"), appDirPath, projectRoot]) {
|
|
65452
65718
|
walkVskFiles(dir, out, seen);
|
|
65453
65719
|
}
|
|
65454
65720
|
return out;
|
|
65455
65721
|
}
|
|
65456
65722
|
function registerSource(sourcePath2) {
|
|
65457
|
-
if (!
|
|
65723
|
+
if (!existsSync42(sourcePath2)) return;
|
|
65458
65724
|
try {
|
|
65459
|
-
compileFile(
|
|
65725
|
+
compileFile(readFileSync40(sourcePath2, "utf-8"), { sourcePath: sourcePath2 });
|
|
65460
65726
|
} catch {
|
|
65461
65727
|
}
|
|
65462
65728
|
}
|
|
@@ -65465,8 +65731,8 @@ function ensureActionRegistered(actionId, pagePathname, appDirPath, routeTree) {
|
|
|
65465
65731
|
const match = matchUrl(routeTree, pagePathname);
|
|
65466
65732
|
if (match) {
|
|
65467
65733
|
for (let i = match.nodes.length - 1; i >= 0; i--) {
|
|
65468
|
-
registerSource(
|
|
65469
|
-
registerSource(
|
|
65734
|
+
registerSource(resolve38(appDirPath, match.nodes[i].sourceDir, "page.vsk"));
|
|
65735
|
+
registerSource(resolve38(appDirPath, match.nodes[i].sourceDir, "layout.vsk"));
|
|
65470
65736
|
}
|
|
65471
65737
|
}
|
|
65472
65738
|
if (getAction2(actionId)) return;
|
|
@@ -65492,24 +65758,24 @@ async function renderPageHtml(pagePathname, params, ctx2) {
|
|
|
65492
65758
|
let head = "";
|
|
65493
65759
|
for (let i = chain.length - 1; i >= 0; i--) {
|
|
65494
65760
|
const node = chain[i];
|
|
65495
|
-
const pageFilePath =
|
|
65496
|
-
const layoutFilePath =
|
|
65497
|
-
if (i === chain.length - 1 && node.page &&
|
|
65498
|
-
const src3 =
|
|
65761
|
+
const pageFilePath = resolve38(ctx2.appDirPath, node.sourceDir, "page.vsk");
|
|
65762
|
+
const layoutFilePath = resolve38(ctx2.appDirPath, node.sourceDir, "layout.vsk");
|
|
65763
|
+
if (i === chain.length - 1 && node.page && existsSync42(pageFilePath)) {
|
|
65764
|
+
const src3 = readFileSync40(pageFilePath, "utf-8");
|
|
65499
65765
|
const compName2 = resolveComponentName(src3) || node.page;
|
|
65500
65766
|
const result = await renderPage(src3, compName2, { params }, /* @__PURE__ */ new Map(), { hydrate: true, sourcePath: pageFilePath });
|
|
65501
65767
|
body = result.body;
|
|
65502
65768
|
head = result.head || "";
|
|
65503
65769
|
}
|
|
65504
|
-
if (node.layout &&
|
|
65505
|
-
const src3 =
|
|
65770
|
+
if (node.layout && existsSync42(layoutFilePath)) {
|
|
65771
|
+
const src3 = readFileSync40(layoutFilePath, "utf-8");
|
|
65506
65772
|
const compName2 = resolveComponentName(src3) || node.layout;
|
|
65507
65773
|
const result = await renderPage(src3, compName2, { children: body }, /* @__PURE__ */ new Map(), { hydrate: true, sourcePath: layoutFilePath });
|
|
65508
65774
|
body = result.body;
|
|
65509
65775
|
head = (result.head || "") + head;
|
|
65510
65776
|
}
|
|
65511
65777
|
}
|
|
65512
|
-
const hasLayout = chain.some((n) => n.layout &&
|
|
65778
|
+
const hasLayout = chain.some((n) => n.layout && existsSync42(resolve38(ctx2.appDirPath, n.sourceDir, "layout.vsk")));
|
|
65513
65779
|
if (hasLayout) {
|
|
65514
65780
|
const secMeta = securityMeta(ctx2.security);
|
|
65515
65781
|
const headBlock = await applyHeadInjects(
|
|
@@ -65533,9 +65799,9 @@ ${prettifyHtml(body)}
|
|
|
65533
65799
|
}
|
|
65534
65800
|
const leaf2 = chain.find((n) => n.page);
|
|
65535
65801
|
if (!leaf2) return null;
|
|
65536
|
-
const src2 =
|
|
65802
|
+
const src2 = readFileSync40(resolve38(ctx2.appDirPath, leaf2.sourceDir, "page.vsk"), "utf-8");
|
|
65537
65803
|
const compName = resolveComponentName(src2) || leaf2.page;
|
|
65538
|
-
const html = await renderFullPage(src2, compName, { params }, /* @__PURE__ */ new Map(), { hydrate: true, clientScriptUrl: "/_vesk/client.js", cssUrls: actionCssUrls(ctx2.appDirPath), security: ctx2.security, sourcePath:
|
|
65804
|
+
const html = await renderFullPage(src2, compName, { params }, /* @__PURE__ */ new Map(), { hydrate: true, clientScriptUrl: "/_vesk/client.js", cssUrls: actionCssUrls(ctx2.appDirPath), security: ctx2.security, sourcePath: resolve38(ctx2.appDirPath, leaf2.sourceDir, "page.vsk"), plugins: ctx2.plugins });
|
|
65539
65805
|
return applyHtmlPlugins(html.replace("</body>", ' <script type="module" src="/_vesk/hmr.js"></script>\n</body>'), ctx2.plugins, { sourcePath: ctx2.url.pathname });
|
|
65540
65806
|
}
|
|
65541
65807
|
async function handleActionRequest(req, res, ctx2) {
|
|
@@ -65676,6 +65942,12 @@ async function handleActionRequest(req, res, ctx2) {
|
|
|
65676
65942
|
}
|
|
65677
65943
|
|
|
65678
65944
|
// src/dev-server.ts
|
|
65945
|
+
function toNodeHeaders2(response) {
|
|
65946
|
+
const headers2 = Object.fromEntries(response.headers);
|
|
65947
|
+
const cookies2 = response.headers.getSetCookie?.() ?? [];
|
|
65948
|
+
if (cookies2.length > 0) headers2["set-cookie"] = cookies2;
|
|
65949
|
+
return headers2;
|
|
65950
|
+
}
|
|
65679
65951
|
var agenticCheckpointManager = new CheckpointManager();
|
|
65680
65952
|
function buildDevErrorPayload(input) {
|
|
65681
65953
|
const { err, errorMessage, filename, fullPath, appDir, fileExists } = input;
|
|
@@ -65700,7 +65972,7 @@ function buildDevErrorPayload(input) {
|
|
|
65700
65972
|
payload.column = colMatch ? parseInt(colMatch[1], 10) : 1;
|
|
65701
65973
|
if (fileExists && payload.line > 0) {
|
|
65702
65974
|
try {
|
|
65703
|
-
const src2 =
|
|
65975
|
+
const src2 = readFileSync41(fullPath, "utf-8");
|
|
65704
65976
|
const cf = buildCodeframe2(src2, payload.line, payload.column);
|
|
65705
65977
|
if (cf) {
|
|
65706
65978
|
cf.file = payload.file || filename;
|
|
@@ -65718,14 +65990,14 @@ function resolveDevErrorReport(report, ctx2) {
|
|
|
65718
65990
|
let componentMap;
|
|
65719
65991
|
let routeSources;
|
|
65720
65992
|
try {
|
|
65721
|
-
componentMap = scanComponents(
|
|
65993
|
+
componentMap = scanComponents(resolve39(ctx2.projectDir, "components"));
|
|
65722
65994
|
} catch {
|
|
65723
65995
|
componentMap = void 0;
|
|
65724
65996
|
}
|
|
65725
65997
|
try {
|
|
65726
65998
|
routeSources = /* @__PURE__ */ new Map();
|
|
65727
65999
|
for (const [name, rel] of collectSources(ctx2.routeTree || [])) {
|
|
65728
|
-
routeSources.set(name,
|
|
66000
|
+
routeSources.set(name, resolve39(ctx2.appDir, rel));
|
|
65729
66001
|
}
|
|
65730
66002
|
} catch {
|
|
65731
66003
|
routeSources = void 0;
|
|
@@ -65756,9 +66028,9 @@ function devErrorContextForMatch(match, appDir, projectDir, routeTree) {
|
|
|
65756
66028
|
for (const kind of ["page.vsk", "layout.vsk", "error.vsk"]) {
|
|
65757
66029
|
for (const node of nodes) {
|
|
65758
66030
|
if (!node || typeof node.sourceDir !== "string") continue;
|
|
65759
|
-
const p =
|
|
66031
|
+
const p = resolve39(appDir, node.sourceDir, kind);
|
|
65760
66032
|
try {
|
|
65761
|
-
if (
|
|
66033
|
+
if (existsSync43(p) && !routeFiles.includes(p)) routeFiles.push(p);
|
|
65762
66034
|
} catch {
|
|
65763
66035
|
}
|
|
65764
66036
|
}
|
|
@@ -65768,14 +66040,14 @@ function devErrorContextForMatch(match, appDir, projectDir, routeTree) {
|
|
|
65768
66040
|
let componentMap;
|
|
65769
66041
|
let routeSources;
|
|
65770
66042
|
try {
|
|
65771
|
-
componentMap = scanComponents(
|
|
66043
|
+
componentMap = scanComponents(resolve39(projectDir, "components"));
|
|
65772
66044
|
} catch {
|
|
65773
66045
|
componentMap = void 0;
|
|
65774
66046
|
}
|
|
65775
66047
|
try {
|
|
65776
66048
|
routeSources = /* @__PURE__ */ new Map();
|
|
65777
66049
|
for (const [name, rel] of collectSources(routeTree || [])) {
|
|
65778
|
-
routeSources.set(name,
|
|
66050
|
+
routeSources.set(name, resolve39(appDir, rel));
|
|
65779
66051
|
}
|
|
65780
66052
|
} catch {
|
|
65781
66053
|
routeSources = void 0;
|
|
@@ -65785,14 +66057,14 @@ function devErrorContextForMatch(match, appDir, projectDir, routeTree) {
|
|
|
65785
66057
|
function resolveRuntimeDir(projectDir) {
|
|
65786
66058
|
const candidates = [
|
|
65787
66059
|
// installed app layout
|
|
65788
|
-
|
|
66060
|
+
resolve39(projectDir, "node_modules", "@vesk", "runtime"),
|
|
65789
66061
|
// monorepo checkout (tests/probes run from the repo root)
|
|
65790
|
-
|
|
66062
|
+
resolve39(import.meta.dirname ?? ".", "..", "..", "runtime", "dist")
|
|
65791
66063
|
];
|
|
65792
66064
|
for (const dir of candidates) {
|
|
65793
|
-
if (
|
|
65794
|
-
const distDir =
|
|
65795
|
-
if (
|
|
66065
|
+
if (existsSync43(join28(dir, "ripple-runtime.js"))) return dir;
|
|
66066
|
+
const distDir = join28(dir, "dist");
|
|
66067
|
+
if (existsSync43(join28(distDir, "ripple-runtime.js"))) return distDir;
|
|
65796
66068
|
}
|
|
65797
66069
|
return null;
|
|
65798
66070
|
}
|
|
@@ -65834,7 +66106,7 @@ var LOG = {
|
|
|
65834
66106
|
console.log(` ${m} ${pathname} ${s}${t}`);
|
|
65835
66107
|
}
|
|
65836
66108
|
};
|
|
65837
|
-
var DEV_SCRIPTS = ' <script type="module" src="/_vesk/client.js"></script>\n <script type="module" src="/_vesk/hmr.js"></script>';
|
|
66109
|
+
var DEV_SCRIPTS = ' <script src="/_vesk/dev-config.js"></script>\n <script type="module" src="/_vesk/client.js"></script>\n <script type="module" src="/_vesk/hmr.js"></script>';
|
|
65838
66110
|
function injectDevScripts(html) {
|
|
65839
66111
|
if (!html.includes("</body>")) return html;
|
|
65840
66112
|
return html.replace("</body>", DEV_SCRIPTS + "\n</body>");
|
|
@@ -65950,6 +66222,7 @@ var HMR_SKIP_MARKERS = [
|
|
|
65950
66222
|
"node_modules/",
|
|
65951
66223
|
".vesk/",
|
|
65952
66224
|
"tmp-vesk-chunk-",
|
|
66225
|
+
"tmp-vesk-shared-",
|
|
65953
66226
|
"/dist/",
|
|
65954
66227
|
"/build/",
|
|
65955
66228
|
"/coverage/",
|
|
@@ -66029,10 +66302,10 @@ function collectRoutePaths(nodes, out = []) {
|
|
|
66029
66302
|
return out;
|
|
66030
66303
|
}
|
|
66031
66304
|
function countFilesNamed(dir, name) {
|
|
66032
|
-
if (!
|
|
66305
|
+
if (!existsSync43(dir)) return 0;
|
|
66033
66306
|
let n = 0;
|
|
66034
66307
|
for (const entry of readdirSync14(dir, { withFileTypes: true })) {
|
|
66035
|
-
const p =
|
|
66308
|
+
const p = join28(dir, entry.name);
|
|
66036
66309
|
if (entry.isDirectory()) n += countFilesNamed(p, name);
|
|
66037
66310
|
else if (entry.name === name) n++;
|
|
66038
66311
|
}
|
|
@@ -66061,8 +66334,8 @@ async function startDevServer(port, projectDir, config, host) {
|
|
|
66061
66334
|
if (!process.env.NODE_ENV) process.env.NODE_ENV = "development";
|
|
66062
66335
|
const secCfg = config.security || {};
|
|
66063
66336
|
const maxBodyBytes = (typeof secCfg.maxBodyBytes === "number" ? secCfg.maxBodyBytes : void 0) || DEFAULT_MAX_BODY_BYTES;
|
|
66064
|
-
const appDirPath =
|
|
66065
|
-
const publicDir =
|
|
66337
|
+
const appDirPath = resolve39(projectDir, typeof config.appDir === "string" ? config.appDir : "./app");
|
|
66338
|
+
const publicDir = resolve39(projectDir, typeof config.publicDir === "string" ? config.publicDir : "./public");
|
|
66066
66339
|
installMdReadHook2([publicDir]);
|
|
66067
66340
|
try {
|
|
66068
66341
|
ensurePackagesBuilt();
|
|
@@ -66075,7 +66348,7 @@ async function startDevServer(port, projectDir, config, host) {
|
|
|
66075
66348
|
process.exit(1);
|
|
66076
66349
|
}
|
|
66077
66350
|
const runtimeDir = runtimeDirUnchecked;
|
|
66078
|
-
const veskStateDir =
|
|
66351
|
+
const veskStateDir = join28(projectDir, ".vesk");
|
|
66079
66352
|
const configPluginsRaw = config.plugins || [];
|
|
66080
66353
|
const configPluginNames = configPluginsRaw.map((p) => typeof p === "string" ? p : p?.name).filter((n) => !!n);
|
|
66081
66354
|
const rawDevPlugins = config.plugins || [];
|
|
@@ -66174,21 +66447,21 @@ async function startDevServer(port, projectDir, config, host) {
|
|
|
66174
66447
|
}
|
|
66175
66448
|
let devGlobalCssContent = "";
|
|
66176
66449
|
let lastServedCssGlobal = "";
|
|
66177
|
-
const appCssPath =
|
|
66178
|
-
const srcDir =
|
|
66179
|
-
const cssPath =
|
|
66180
|
-
const altCssPath =
|
|
66450
|
+
const appCssPath = join28(appDirPath, "global.css");
|
|
66451
|
+
const srcDir = join28(projectDir, "src");
|
|
66452
|
+
const cssPath = join28(srcDir, "global.css");
|
|
66453
|
+
const altCssPath = join28(srcDir, "app.css");
|
|
66181
66454
|
let rawCss = "";
|
|
66182
66455
|
let devCssSource = "";
|
|
66183
|
-
if (
|
|
66456
|
+
if (existsSync43(appCssPath)) {
|
|
66184
66457
|
devCssSource = appCssPath;
|
|
66185
|
-
rawCss =
|
|
66186
|
-
} else if (
|
|
66458
|
+
rawCss = readFileSync41(appCssPath, "utf-8");
|
|
66459
|
+
} else if (existsSync43(cssPath)) {
|
|
66187
66460
|
devCssSource = cssPath;
|
|
66188
|
-
rawCss =
|
|
66189
|
-
} else if (
|
|
66461
|
+
rawCss = readFileSync41(cssPath, "utf-8");
|
|
66462
|
+
} else if (existsSync43(altCssPath)) {
|
|
66190
66463
|
devCssSource = altCssPath;
|
|
66191
|
-
rawCss =
|
|
66464
|
+
rawCss = readFileSync41(altCssPath, "utf-8");
|
|
66192
66465
|
}
|
|
66193
66466
|
if (rawCss) {
|
|
66194
66467
|
const activeAtStart = getActiveDevPlugins();
|
|
@@ -66235,8 +66508,9 @@ async function startDevServer(port, projectDir, config, host) {
|
|
|
66235
66508
|
clientChunks = next;
|
|
66236
66509
|
}
|
|
66237
66510
|
const routeChunksBuilt = /* @__PURE__ */ new Set();
|
|
66511
|
+
const routeChunkBuilds = /* @__PURE__ */ new Map();
|
|
66238
66512
|
let clientGeneration = 0;
|
|
66239
|
-
const devCacheDir = () =>
|
|
66513
|
+
const devCacheDir = () => join28(projectDir, "node_modules", ".vesk", "dev-cache");
|
|
66240
66514
|
function devCacheKey() {
|
|
66241
66515
|
const parts = [`flags:${!!config.routeDataCache}`];
|
|
66242
66516
|
const walk9 = (dir) => {
|
|
@@ -66248,7 +66522,7 @@ async function startDevServer(port, projectDir, config, host) {
|
|
|
66248
66522
|
}
|
|
66249
66523
|
for (const name of entries.sort()) {
|
|
66250
66524
|
if (name === "node_modules" || name.startsWith(".")) continue;
|
|
66251
|
-
const p =
|
|
66525
|
+
const p = join28(dir, name);
|
|
66252
66526
|
let st;
|
|
66253
66527
|
try {
|
|
66254
66528
|
st = statSync22(p);
|
|
@@ -66265,27 +66539,42 @@ async function startDevServer(port, projectDir, config, host) {
|
|
|
66265
66539
|
};
|
|
66266
66540
|
walk9(appDirPath);
|
|
66267
66541
|
try {
|
|
66268
|
-
parts.push(`compiler:${
|
|
66542
|
+
parts.push(`compiler:${readFileSync41(join28(process.cwd(), "node_modules", "@vesk", "compiler", "package.json"), "utf8")}`);
|
|
66269
66543
|
} catch {
|
|
66270
66544
|
}
|
|
66271
66545
|
return createHash3("sha256").update(parts.join("\n")).digest("hex").slice(0, 32);
|
|
66272
66546
|
}
|
|
66273
66547
|
function readDevBundleCache() {
|
|
66274
66548
|
try {
|
|
66275
|
-
const file =
|
|
66276
|
-
const parsed = JSON.parse(
|
|
66549
|
+
const file = join28(devCacheDir(), "client-bundle.json");
|
|
66550
|
+
const parsed = JSON.parse(readFileSync41(file, "utf8"));
|
|
66277
66551
|
if (parsed.key !== devCacheKey() || typeof parsed.main !== "string" || !Array.isArray(parsed.chunks)) return null;
|
|
66278
66552
|
return { main: parsed.main, chunks: parsed.chunks };
|
|
66279
66553
|
} catch {
|
|
66280
66554
|
return null;
|
|
66281
66555
|
}
|
|
66282
66556
|
}
|
|
66557
|
+
let persistChunksTimer = null;
|
|
66558
|
+
function persistDevChunksSoon() {
|
|
66559
|
+
if (persistChunksTimer) return;
|
|
66560
|
+
persistChunksTimer = setTimeout(() => {
|
|
66561
|
+
persistChunksTimer = null;
|
|
66562
|
+
writeDevBundleCache(
|
|
66563
|
+
clientBundle,
|
|
66564
|
+
[...clientChunks].map(([url, code]) => ({
|
|
66565
|
+
name: url.slice(url.lastIndexOf("/") + 1),
|
|
66566
|
+
code
|
|
66567
|
+
}))
|
|
66568
|
+
);
|
|
66569
|
+
}, 2e3);
|
|
66570
|
+
persistChunksTimer.unref?.();
|
|
66571
|
+
}
|
|
66283
66572
|
function writeDevBundleCache(main, chunks) {
|
|
66284
66573
|
try {
|
|
66285
66574
|
const dir = devCacheDir();
|
|
66286
66575
|
mkdirSync19(dir, { recursive: true });
|
|
66287
|
-
const file =
|
|
66288
|
-
const tmp =
|
|
66576
|
+
const file = join28(dir, "client-bundle.json");
|
|
66577
|
+
const tmp = join28(dir, `client-bundle.${process.pid}.tmp`);
|
|
66289
66578
|
writeFileSync21(tmp, JSON.stringify({ key: devCacheKey(), main, chunks }), "utf8");
|
|
66290
66579
|
renameSync2(tmp, file);
|
|
66291
66580
|
} catch {
|
|
@@ -66293,23 +66582,36 @@ async function startDevServer(port, projectDir, config, host) {
|
|
|
66293
66582
|
}
|
|
66294
66583
|
async function ensureRouteChunk(fullPath) {
|
|
66295
66584
|
if (routeChunksBuilt.has(fullPath)) return;
|
|
66296
|
-
|
|
66297
|
-
|
|
66298
|
-
|
|
66299
|
-
importRuntime: true,
|
|
66300
|
-
hmr: true,
|
|
66301
|
-
codeSplit: true,
|
|
66302
|
-
cache: bundleCache,
|
|
66303
|
-
onlyRoutes: [fullPath],
|
|
66304
|
-
...config.routeDataCache !== void 0 ? { routeDataCache: config.routeDataCache } : {}
|
|
66305
|
-
});
|
|
66306
|
-
if (generation !== clientGeneration) {
|
|
66307
|
-
routeChunksBuilt.delete(fullPath);
|
|
66585
|
+
const inFlight = routeChunkBuilds.get(fullPath);
|
|
66586
|
+
if (inFlight) {
|
|
66587
|
+
await inFlight;
|
|
66308
66588
|
return;
|
|
66309
66589
|
}
|
|
66310
|
-
const
|
|
66311
|
-
|
|
66312
|
-
|
|
66590
|
+
const build4 = (async () => {
|
|
66591
|
+
const generation = clientGeneration;
|
|
66592
|
+
const { chunks } = await generateClientBundle2(routeTree, appDirPath, /* @__PURE__ */ new Map(), {
|
|
66593
|
+
importRuntime: true,
|
|
66594
|
+
hmr: true,
|
|
66595
|
+
codeSplit: true,
|
|
66596
|
+
cache: bundleCache,
|
|
66597
|
+
onlyRoutes: [fullPath],
|
|
66598
|
+
...config.routeDataCache !== void 0 ? { routeDataCache: config.routeDataCache } : {}
|
|
66599
|
+
});
|
|
66600
|
+
if (generation !== clientGeneration) return false;
|
|
66601
|
+
const next = new Map(clientChunks);
|
|
66602
|
+
for (const c of chunks) next.set(`/_vesk/static/${c.name}`, c.code);
|
|
66603
|
+
clientChunks = next;
|
|
66604
|
+
return true;
|
|
66605
|
+
})();
|
|
66606
|
+
routeChunkBuilds.set(fullPath, build4);
|
|
66607
|
+
try {
|
|
66608
|
+
if (await build4) {
|
|
66609
|
+
routeChunksBuilt.add(fullPath);
|
|
66610
|
+
persistDevChunksSoon();
|
|
66611
|
+
}
|
|
66612
|
+
} finally {
|
|
66613
|
+
routeChunkBuilds.delete(fullPath);
|
|
66614
|
+
}
|
|
66313
66615
|
}
|
|
66314
66616
|
function routeFullPathForChunk(chunkName) {
|
|
66315
66617
|
let found = null;
|
|
@@ -66355,6 +66657,12 @@ async function startDevServer(port, projectDir, config, host) {
|
|
|
66355
66657
|
clientBundle = main;
|
|
66356
66658
|
devBundleBytes = Buffer.byteLength(main, "utf8");
|
|
66357
66659
|
storeChunks(chunks);
|
|
66660
|
+
routeChunksBuilt.clear();
|
|
66661
|
+
for (const c of chunks) {
|
|
66662
|
+
const fullPath = c.name === SHARED_CHUNK_NAME2 ? null : routeFullPathForChunk(c.name);
|
|
66663
|
+
if (fullPath) routeChunksBuilt.add(fullPath);
|
|
66664
|
+
}
|
|
66665
|
+
clientGeneration++;
|
|
66358
66666
|
writeDevBundleCache(main, chunks);
|
|
66359
66667
|
} catch (e) {
|
|
66360
66668
|
LOG.err(`client build error:`, e.message);
|
|
@@ -66574,12 +66882,54 @@ async function startDevServer(port, projectDir, config, host) {
|
|
|
66574
66882
|
let debounceTimer = null;
|
|
66575
66883
|
let cssDebounceTimer = null;
|
|
66576
66884
|
const watchDir = projectDir;
|
|
66577
|
-
|
|
66578
|
-
|
|
66885
|
+
const dirWatchers = /* @__PURE__ */ new Map();
|
|
66886
|
+
const watchDirTree = (dir) => {
|
|
66887
|
+
if (dirWatchers.has(dir)) return;
|
|
66888
|
+
let entries;
|
|
66889
|
+
try {
|
|
66890
|
+
entries = readdirSync14(dir, { withFileTypes: true });
|
|
66891
|
+
} catch {
|
|
66892
|
+
return;
|
|
66893
|
+
}
|
|
66894
|
+
try {
|
|
66895
|
+
const watcher = watch(dir, (eventType, changed) => {
|
|
66896
|
+
if (!changed) return;
|
|
66897
|
+
const abs = join28(dir, String(changed));
|
|
66898
|
+
const rel = relative9(projectDir, abs);
|
|
66899
|
+
if (!rel || rel.startsWith("..")) return;
|
|
66900
|
+
if (eventType === "rename") {
|
|
66901
|
+
try {
|
|
66902
|
+
if (statSync22(abs).isDirectory()) {
|
|
66903
|
+
watchDirTree(abs);
|
|
66904
|
+
return;
|
|
66905
|
+
}
|
|
66906
|
+
} catch {
|
|
66907
|
+
}
|
|
66908
|
+
}
|
|
66909
|
+
onWatchEvent(eventType, normalizeWatchPath(rel));
|
|
66910
|
+
});
|
|
66911
|
+
watcher.on("error", () => {
|
|
66912
|
+
try {
|
|
66913
|
+
watcher.close();
|
|
66914
|
+
} catch {
|
|
66915
|
+
}
|
|
66916
|
+
dirWatchers.delete(dir);
|
|
66917
|
+
});
|
|
66918
|
+
dirWatchers.set(dir, watcher);
|
|
66919
|
+
} catch {
|
|
66920
|
+
return;
|
|
66921
|
+
}
|
|
66922
|
+
for (const entry of entries) {
|
|
66923
|
+
if (!entry.isDirectory()) continue;
|
|
66924
|
+
if (HMR_SKIP_DIRS.has(entry.name)) continue;
|
|
66925
|
+
watchDirTree(join28(dir, entry.name));
|
|
66926
|
+
}
|
|
66927
|
+
};
|
|
66928
|
+
const onWatchEvent = (eventType, filename) => {
|
|
66579
66929
|
const kind = classifyHmrWatchPath(filename);
|
|
66580
66930
|
if (kind === "ignored") return;
|
|
66581
|
-
const fullPath = filename.startsWith("/") ? filename :
|
|
66582
|
-
const fileExists =
|
|
66931
|
+
const fullPath = filename.startsWith("/") ? filename : join28(watchDir, filename);
|
|
66932
|
+
const fileExists = existsSync43(fullPath);
|
|
66583
66933
|
const bcast = (msg) => {
|
|
66584
66934
|
const f = globalThis.__vesk_broadcastHmr;
|
|
66585
66935
|
if (typeof f === "function") f(msg);
|
|
@@ -66603,7 +66953,7 @@ async function startDevServer(port, projectDir, config, host) {
|
|
|
66603
66953
|
debounceTimer = setTimeout(async () => {
|
|
66604
66954
|
const t0 = Date.now();
|
|
66605
66955
|
try {
|
|
66606
|
-
const current3 = fileExists ?
|
|
66956
|
+
const current3 = fileExists ? readFileSync41(fullPath, "utf-8") : null;
|
|
66607
66957
|
if (eventType !== "rename" && current3 !== null && lastSeenContent.get(fullPath) === current3) {
|
|
66608
66958
|
LOG.info(`skipped unchanged (${filename})`);
|
|
66609
66959
|
return;
|
|
@@ -66635,7 +66985,7 @@ async function startDevServer(port, projectDir, config, host) {
|
|
|
66635
66985
|
} else if (fileExists && current3 !== null) {
|
|
66636
66986
|
let source = current3;
|
|
66637
66987
|
if (/content=["'][^"']*\.md["']/i.test(source)) {
|
|
66638
|
-
source = inlineMdContentAttrs2(source,
|
|
66988
|
+
source = inlineMdContentAttrs2(source, dirname27(fullPath), guessProjectRoots2(appDirPath));
|
|
66639
66989
|
}
|
|
66640
66990
|
const { comp, name } = compileClientBoth2(source, null, fullPath, { skipHyd: true });
|
|
66641
66991
|
hotEditedSource = buildHmrEvalSnippet2(comp);
|
|
@@ -66662,7 +67012,7 @@ Object.defineProperty(__components, ${JSON.stringify(cname)}, { get: () => __com
|
|
|
66662
67012
|
if (compCode.trim()) fnSources = { _raw: compCode };
|
|
66663
67013
|
} else if (fileExists && !bundleError) {
|
|
66664
67014
|
try {
|
|
66665
|
-
const src2 =
|
|
67015
|
+
const src2 = readFileSync41(fullPath, "utf-8");
|
|
66666
67016
|
let compCode = buildHmrEvalSnippet2(
|
|
66667
67017
|
compileClient2(src2, null, { forceClient: true, sourcePath: fullPath, mdRoots: [projectDir] })
|
|
66668
67018
|
);
|
|
@@ -66746,7 +67096,7 @@ Object.defineProperty(__components, ${JSON.stringify(cname)}, { get: () => __com
|
|
|
66746
67096
|
cssDebounceTimer = setTimeout(async () => {
|
|
66747
67097
|
try {
|
|
66748
67098
|
if (fileExists) {
|
|
66749
|
-
rawCss =
|
|
67099
|
+
rawCss = readFileSync41(fullPath, "utf-8");
|
|
66750
67100
|
}
|
|
66751
67101
|
const cssChanged = await rebuildTailwindCss();
|
|
66752
67102
|
if (cssChanged && typeof globalThis.__vesk_broadcastHmr === "function") {
|
|
@@ -66776,7 +67126,8 @@ Object.defineProperty(__components, ${JSON.stringify(cname)}, { get: () => __com
|
|
|
66776
67126
|
}
|
|
66777
67127
|
}, HMR_DEBOUNCE_MS);
|
|
66778
67128
|
}
|
|
66779
|
-
}
|
|
67129
|
+
};
|
|
67130
|
+
watchDirTree(watchDir);
|
|
66780
67131
|
} catch (e) {
|
|
66781
67132
|
LOG.warn("file watching unavailable, serving without auto-rebuild");
|
|
66782
67133
|
}
|
|
@@ -66793,9 +67144,9 @@ Object.defineProperty(__components, ${JSON.stringify(cname)}, { get: () => __com
|
|
|
66793
67144
|
".json": "application/json",
|
|
66794
67145
|
".webmanifest": "application/manifest+json"
|
|
66795
67146
|
};
|
|
66796
|
-
const hmrJsPath =
|
|
66797
|
-
const hmrTsPath =
|
|
66798
|
-
const hmrClientPath =
|
|
67147
|
+
const hmrJsPath = join28(runtimeDir, "hmr-client.js");
|
|
67148
|
+
const hmrTsPath = join28(runtimeDir, "hmr-client.ts");
|
|
67149
|
+
const hmrClientPath = existsSync43(hmrJsPath) ? hmrJsPath : existsSync43(hmrTsPath) ? hmrTsPath : null;
|
|
66799
67150
|
function extractCompName2(src2) {
|
|
66800
67151
|
return resolveComponentName(src2);
|
|
66801
67152
|
}
|
|
@@ -66860,6 +67211,11 @@ Object.defineProperty(__components, ${JSON.stringify(cname)}, { get: () => __com
|
|
|
66860
67211
|
res.end(runtimeBundle);
|
|
66861
67212
|
return;
|
|
66862
67213
|
}
|
|
67214
|
+
if (url.pathname === "/_vesk/dev-config.js") {
|
|
67215
|
+
res.writeHead(200, { "Content-Type": "application/javascript", "Cache-Control": "no-store" });
|
|
67216
|
+
res.end("globalThis.__vesk_chunk_timeout_ms = 120000;");
|
|
67217
|
+
return;
|
|
67218
|
+
}
|
|
66863
67219
|
if (url.pathname === "/_vesk/client" || url.pathname === "/_vesk/client.js") {
|
|
66864
67220
|
res.writeHead(200, { "Content-Type": "application/javascript" });
|
|
66865
67221
|
res.end(clientBundle);
|
|
@@ -66903,7 +67259,7 @@ Object.defineProperty(__components, ${JSON.stringify(cname)}, { get: () => __com
|
|
|
66903
67259
|
}
|
|
66904
67260
|
if (url.pathname === "/_vesk/hmr" || url.pathname === "/_vesk/hmr.js") {
|
|
66905
67261
|
if (hmrClientPath) {
|
|
66906
|
-
let hmrContent =
|
|
67262
|
+
let hmrContent = readFileSync41(hmrClientPath, "utf-8");
|
|
66907
67263
|
if (hmrClientPath.endsWith(".ts")) {
|
|
66908
67264
|
hmrContent = stripCodeTypes2(hmrContent);
|
|
66909
67265
|
}
|
|
@@ -66951,10 +67307,10 @@ Object.defineProperty(__components, ${JSON.stringify(cname)}, { get: () => __com
|
|
|
66951
67307
|
}
|
|
66952
67308
|
if (url.pathname !== "/") {
|
|
66953
67309
|
const staticPath = url.pathname.length > 1 ? resolveWithin2(publicDir, url.pathname.slice(1)) : null;
|
|
66954
|
-
if (staticPath &&
|
|
67310
|
+
if (staticPath && existsSync43(staticPath) && statSync22(staticPath).isFile()) {
|
|
66955
67311
|
const ext = extname7(staticPath);
|
|
66956
67312
|
res.writeHead(200, { "Content-Type": MIME2[ext] || "application/octet-stream" });
|
|
66957
|
-
res.end(
|
|
67313
|
+
res.end(readFileSync41(staticPath));
|
|
66958
67314
|
return;
|
|
66959
67315
|
}
|
|
66960
67316
|
}
|
|
@@ -66978,8 +67334,8 @@ Object.defineProperty(__components, ${JSON.stringify(cname)}, { get: () => __com
|
|
|
66978
67334
|
return;
|
|
66979
67335
|
}
|
|
66980
67336
|
const mwChain = collectMiddlewareChain(routeTree, url.pathname, appDirPath);
|
|
66981
|
-
const apiDirPath =
|
|
66982
|
-
if (url.pathname.startsWith("/api") &&
|
|
67337
|
+
const apiDirPath = join28(appDirPath, "api");
|
|
67338
|
+
if (url.pathname.startsWith("/api") && existsSync43(apiDirPath)) {
|
|
66983
67339
|
const apiRoutes = await scanApiRoutes(apiDirPath);
|
|
66984
67340
|
const apiMatch = matchApiUrl(apiRoutes, req.url || url.pathname);
|
|
66985
67341
|
if (apiMatch) {
|
|
@@ -67016,7 +67372,7 @@ Object.defineProperty(__components, ${JSON.stringify(cname)}, { get: () => __com
|
|
|
67016
67372
|
});
|
|
67017
67373
|
if (mwResult.response) {
|
|
67018
67374
|
logRequest(mwResult.response.status);
|
|
67019
|
-
res.writeHead(mwResult.response.status,
|
|
67375
|
+
res.writeHead(mwResult.response.status, toNodeHeaders2(mwResult.response));
|
|
67020
67376
|
res.end(await mwResult.response.text());
|
|
67021
67377
|
return;
|
|
67022
67378
|
}
|
|
@@ -67043,7 +67399,7 @@ Object.defineProperty(__components, ${JSON.stringify(cname)}, { get: () => __com
|
|
|
67043
67399
|
}
|
|
67044
67400
|
logRequest(response.status);
|
|
67045
67401
|
const body = await response.text();
|
|
67046
|
-
res.writeHead(response.status,
|
|
67402
|
+
res.writeHead(response.status, toNodeHeaders2(response));
|
|
67047
67403
|
res.end(body);
|
|
67048
67404
|
return;
|
|
67049
67405
|
}
|
|
@@ -67051,22 +67407,19 @@ Object.defineProperty(__components, ${JSON.stringify(cname)}, { get: () => __com
|
|
|
67051
67407
|
const ctx2 = rawCtx;
|
|
67052
67408
|
const match = matchUrl(routeTree, url.pathname);
|
|
67053
67409
|
if (!match) {
|
|
67054
|
-
const rootNode = routeTree.find((n) => n.fullPath === "/");
|
|
67055
67410
|
let notFoundHtml = null;
|
|
67056
|
-
|
|
67057
|
-
|
|
67058
|
-
|
|
67059
|
-
|
|
67060
|
-
|
|
67061
|
-
|
|
67062
|
-
|
|
67063
|
-
} catch {
|
|
67064
|
-
}
|
|
67411
|
+
const nfPath = resolveBoundaryFileForUrl2(url.pathname, appDirPath, "not-found.vsk");
|
|
67412
|
+
if (nfPath) {
|
|
67413
|
+
try {
|
|
67414
|
+
const nfSrc = readFileSync41(nfPath, "utf-8");
|
|
67415
|
+
const nfCompName = extractCompName2(nfSrc) || "NotFound";
|
|
67416
|
+
notFoundHtml = await renderFullPage(nfSrc, nfCompName, { params: {}, url: url.pathname }, /* @__PURE__ */ new Map(), { hydrate: true, cssUrls: activeCssUrls(), security, externalDataScript: storeDataScript, sourcePath: nfPath, cached: cachedSsrCompile(ssrCompileCache, nfSrc, nfPath), plugins: getActiveDevPlugins() });
|
|
67417
|
+
} catch {
|
|
67065
67418
|
}
|
|
67066
67419
|
}
|
|
67067
67420
|
logRequest(404);
|
|
67068
67421
|
res.writeHead(404, { "Content-Type": "text/html" });
|
|
67069
|
-
res.end(notFoundHtml
|
|
67422
|
+
res.end(notFoundHtml ? injectDevScripts(notFoundHtml) : renderDefaultNotFoundPage2({ url: url.pathname }));
|
|
67070
67423
|
return;
|
|
67071
67424
|
}
|
|
67072
67425
|
const urlParts = url.pathname.split("/").filter(Boolean);
|
|
@@ -67086,16 +67439,6 @@ Object.defineProperty(__components, ${JSON.stringify(cname)}, { get: () => __com
|
|
|
67086
67439
|
}
|
|
67087
67440
|
const matched = match;
|
|
67088
67441
|
const forData = req.headers["x-vesk-data"] === "1";
|
|
67089
|
-
if (!forData && matched && Array.isArray(matched.nodes)) {
|
|
67090
|
-
const leaf2 = matched.nodes.find((n) => n.page);
|
|
67091
|
-
if (leaf2 && typeof leaf2.fullPath === "string") {
|
|
67092
|
-
try {
|
|
67093
|
-
await ensureRouteChunk(leaf2.fullPath);
|
|
67094
|
-
} catch (e) {
|
|
67095
|
-
LOG.err(`client chunk build failed for ${leaf2.fullPath}:`, e.message);
|
|
67096
|
-
}
|
|
67097
|
-
}
|
|
67098
|
-
}
|
|
67099
67442
|
async function renderSSR() {
|
|
67100
67443
|
const ssg2 = globalThis;
|
|
67101
67444
|
ssg2.__vsk_ssr_data = {};
|
|
@@ -67109,18 +67452,18 @@ Object.defineProperty(__components, ${JSON.stringify(cname)}, { get: () => __com
|
|
|
67109
67452
|
let props;
|
|
67110
67453
|
for (let i = chain.length - 1; i >= 0; i--) {
|
|
67111
67454
|
const node = chain[i];
|
|
67112
|
-
const pageFilePath =
|
|
67113
|
-
const layoutFilePath =
|
|
67114
|
-
if (i === chain.length - 1 && node.page &&
|
|
67115
|
-
const src2 =
|
|
67455
|
+
const pageFilePath = resolve39(appDirPath, node.sourceDir, "page.vsk");
|
|
67456
|
+
const layoutFilePath = resolve39(appDirPath, node.sourceDir, "layout.vsk");
|
|
67457
|
+
if (i === chain.length - 1 && node.page && existsSync43(pageFilePath)) {
|
|
67458
|
+
const src2 = readFileSync41(pageFilePath, "utf-8");
|
|
67116
67459
|
const compName = extractCompName2(src2) || node.page;
|
|
67117
67460
|
const result = await renderPage(src2, compName, { params: matched.params }, /* @__PURE__ */ new Map(), { hydrate: true, sourcePath: pageFilePath, cached: cachedSsrCompile(ssrCompileCache, src2, pageFilePath) });
|
|
67118
67461
|
body = result.body;
|
|
67119
67462
|
head = result.head || "";
|
|
67120
67463
|
props = result.props;
|
|
67121
67464
|
}
|
|
67122
|
-
if (node.layout &&
|
|
67123
|
-
const src2 =
|
|
67465
|
+
if (node.layout && existsSync43(layoutFilePath)) {
|
|
67466
|
+
const src2 = readFileSync41(layoutFilePath, "utf-8");
|
|
67124
67467
|
const compName = extractCompName2(src2) || node.layout;
|
|
67125
67468
|
const result = await renderPage(src2, compName, { children: body }, /* @__PURE__ */ new Map(), { hydrate: true, sourcePath: layoutFilePath, cached: cachedSsrCompile(ssrCompileCache, src2, layoutFilePath) });
|
|
67126
67469
|
body = result.body;
|
|
@@ -67130,7 +67473,7 @@ Object.defineProperty(__components, ${JSON.stringify(cname)}, { get: () => __com
|
|
|
67130
67473
|
if (forData) {
|
|
67131
67474
|
return { html: "", props: props || { params: matched.params }, head };
|
|
67132
67475
|
}
|
|
67133
|
-
const hasLayout = chain.some((n) => n.layout &&
|
|
67476
|
+
const hasLayout = chain.some((n) => n.layout && existsSync43(resolve39(appDirPath, n.sourceDir, "layout.vsk")));
|
|
67134
67477
|
let html;
|
|
67135
67478
|
if (hasLayout) {
|
|
67136
67479
|
const ssrData = currentSsrData();
|
|
@@ -67165,9 +67508,9 @@ ${prettifyHtml(body)}
|
|
|
67165
67508
|
} else {
|
|
67166
67509
|
const leaf2 = chain.find((n) => n.page);
|
|
67167
67510
|
if (leaf2) {
|
|
67168
|
-
const src2 =
|
|
67511
|
+
const src2 = readFileSync41(resolve39(appDirPath, leaf2.sourceDir, "page.vsk"), "utf-8");
|
|
67169
67512
|
const compName = extractCompName2(src2) || leaf2.page;
|
|
67170
|
-
html = await renderFullPage(src2, compName, { params: matched.params }, /* @__PURE__ */ new Map(), { hydrate: true, clientScriptUrl: "/_vesk/client.js", cssUrls: activeCssUrls(), security, externalDataScript: storeDataScript, sourcePath:
|
|
67513
|
+
html = await renderFullPage(src2, compName, { params: matched.params }, /* @__PURE__ */ new Map(), { hydrate: true, clientScriptUrl: "/_vesk/client.js", cssUrls: activeCssUrls(), security, externalDataScript: storeDataScript, sourcePath: resolve39(appDirPath, leaf2.sourceDir, "page.vsk"), cached: cachedSsrCompile(ssrCompileCache, src2, resolve39(appDirPath, leaf2.sourceDir, "page.vsk")), plugins: getActiveDevPlugins() });
|
|
67171
67514
|
html = html.replace("</body>", ' <script type="module" src="/_vesk/hmr.js"></script>\n</body>');
|
|
67172
67515
|
html = await applyHtmlPlugins(html, getActiveDevPlugins(), { sourcePath: url.pathname });
|
|
67173
67516
|
} else {
|
|
@@ -67190,13 +67533,13 @@ ${prettifyHtml(body)}
|
|
|
67190
67533
|
sst.__vsk_ssr_data = {};
|
|
67191
67534
|
async function* raw2() {
|
|
67192
67535
|
const chain = cleanChain;
|
|
67193
|
-
const hasLayout = chain.some((n) => n.layout &&
|
|
67536
|
+
const hasLayout = chain.some((n) => n.layout && existsSync43(resolve39(appDirPath, n.sourceDir, "layout.vsk")));
|
|
67194
67537
|
if (!hasLayout) {
|
|
67195
67538
|
const leaf2 = chain.find((n) => n.page);
|
|
67196
67539
|
if (leaf2) {
|
|
67197
|
-
const src2 =
|
|
67540
|
+
const src2 = readFileSync41(resolve39(appDirPath, leaf2.sourceDir, "page.vsk"), "utf-8");
|
|
67198
67541
|
const compName = extractCompName2(src2) || leaf2.page;
|
|
67199
|
-
yield* renderPageStream(src2, compName, { params: matched.params }, /* @__PURE__ */ new Map(), { hydrate: true, clientScriptUrl: "/_vesk/client.js", cssUrls: activeCssUrls(), security, externalDataScript: storeDataScript, sourcePath:
|
|
67542
|
+
yield* renderPageStream(src2, compName, { params: matched.params }, /* @__PURE__ */ new Map(), { hydrate: true, clientScriptUrl: "/_vesk/client.js", cssUrls: activeCssUrls(), security, externalDataScript: storeDataScript, sourcePath: resolve39(appDirPath, leaf2.sourceDir, "page.vsk"), cached: cachedSsrCompile(ssrCompileCache, src2, resolve39(appDirPath, leaf2.sourceDir, "page.vsk")), plugins: getActiveDevPlugins() });
|
|
67200
67543
|
} else {
|
|
67201
67544
|
throw new Error("No page or layout matched");
|
|
67202
67545
|
}
|
|
@@ -67207,18 +67550,18 @@ ${prettifyHtml(body)}
|
|
|
67207
67550
|
let props;
|
|
67208
67551
|
for (let i = chain.length - 1; i >= 0; i--) {
|
|
67209
67552
|
const node = chain[i];
|
|
67210
|
-
const pageFilePath =
|
|
67211
|
-
const layoutFilePath =
|
|
67212
|
-
if (i === chain.length - 1 && node.page &&
|
|
67213
|
-
const src2 =
|
|
67553
|
+
const pageFilePath = resolve39(appDirPath, node.sourceDir, "page.vsk");
|
|
67554
|
+
const layoutFilePath = resolve39(appDirPath, node.sourceDir, "layout.vsk");
|
|
67555
|
+
if (i === chain.length - 1 && node.page && existsSync43(pageFilePath)) {
|
|
67556
|
+
const src2 = readFileSync41(pageFilePath, "utf-8");
|
|
67214
67557
|
const compName = extractCompName2(src2) || node.page;
|
|
67215
67558
|
const result = await renderPage(src2, compName, { params: matched.params }, /* @__PURE__ */ new Map(), { hydrate: true, sourcePath: pageFilePath, cached: cachedSsrCompile(ssrCompileCache, src2, pageFilePath) });
|
|
67216
67559
|
body = result.body;
|
|
67217
67560
|
head = result.head || "";
|
|
67218
67561
|
props = result.props;
|
|
67219
67562
|
}
|
|
67220
|
-
if (node.layout &&
|
|
67221
|
-
const src2 =
|
|
67563
|
+
if (node.layout && existsSync43(layoutFilePath)) {
|
|
67564
|
+
const src2 = readFileSync41(layoutFilePath, "utf-8");
|
|
67222
67565
|
const compName = extractCompName2(src2) || node.layout;
|
|
67223
67566
|
const result = await renderPage(src2, compName, { children: body }, /* @__PURE__ */ new Map(), { hydrate: true, sourcePath: layoutFilePath, cached: cachedSsrCompile(ssrCompileCache, src2, layoutFilePath) });
|
|
67224
67567
|
body = result.body;
|
|
@@ -67312,7 +67655,7 @@ ${prettifyHtml(body)}
|
|
|
67312
67655
|
const respRecord = mwResult.response;
|
|
67313
67656
|
if (typeof respRecord.build === "function") respRecord.build();
|
|
67314
67657
|
logRequest(mwResult.response.status);
|
|
67315
|
-
res.writeHead(mwResult.response.status,
|
|
67658
|
+
res.writeHead(mwResult.response.status, toNodeHeaders2(mwResult.response));
|
|
67316
67659
|
res.end(await mwResult.response.text());
|
|
67317
67660
|
return;
|
|
67318
67661
|
}
|
|
@@ -67359,10 +67702,10 @@ ${prettifyHtml(body)}
|
|
|
67359
67702
|
for (let i = match.nodes.length - 1; i >= 0; i--) {
|
|
67360
67703
|
const node = match.nodes[i];
|
|
67361
67704
|
if (node.notFound) {
|
|
67362
|
-
const nfPath =
|
|
67363
|
-
if (
|
|
67705
|
+
const nfPath = resolve39(appDirPath, node.sourceDir, "not-found.vsk");
|
|
67706
|
+
if (existsSync43(nfPath)) {
|
|
67364
67707
|
try {
|
|
67365
|
-
const nfSrc =
|
|
67708
|
+
const nfSrc = readFileSync41(nfPath, "utf-8");
|
|
67366
67709
|
const nfCompName = extractCompName2(nfSrc) || node.notFound;
|
|
67367
67710
|
const html = await renderFullPage(nfSrc, nfCompName, { params: match.params, url: url.pathname }, /* @__PURE__ */ new Map(), { hydrate: true, cssUrls: activeCssUrls(), security, externalDataScript: storeDataScript, sourcePath: nfPath, cached: cachedSsrCompile(ssrCompileCache, nfSrc, nfPath), plugins: getActiveDevPlugins() });
|
|
67368
67711
|
notFoundHtml = injectDevScripts(html);
|
|
@@ -67405,10 +67748,10 @@ ${prettifyHtml(body)}
|
|
|
67405
67748
|
for (let i = match.nodes.length - 1; i >= 0; i--) {
|
|
67406
67749
|
const node = match.nodes[i];
|
|
67407
67750
|
if (node.error) {
|
|
67408
|
-
const errPath =
|
|
67409
|
-
if (
|
|
67751
|
+
const errPath = resolve39(appDirPath, node.sourceDir, "error.vsk");
|
|
67752
|
+
if (existsSync43(errPath)) {
|
|
67410
67753
|
try {
|
|
67411
|
-
const errSrc =
|
|
67754
|
+
const errSrc = readFileSync41(errPath, "utf-8");
|
|
67412
67755
|
const errCompName = extractCompName2(errSrc) || node.error;
|
|
67413
67756
|
const errProps = {
|
|
67414
67757
|
error: err.message,
|
|
@@ -67480,7 +67823,7 @@ ${prettifyHtml(body)}
|
|
|
67480
67823
|
LOG.ok(`dev server at http://localhost:${port} (listening on ${bindHost})`);
|
|
67481
67824
|
const routes = collectRoutePaths(routeTree);
|
|
67482
67825
|
const pageCount = countPages(routeTree);
|
|
67483
|
-
const apiCount = countFilesNamed(
|
|
67826
|
+
const apiCount = countFilesNamed(join28(appDirPath, "api"), "route.ts");
|
|
67484
67827
|
LOG.info(`${projectDir}`);
|
|
67485
67828
|
LOG.info(`${pageCount} page${pageCount === 1 ? "" : "s"}: ${routes.join(", ") || "(none)"}`);
|
|
67486
67829
|
if (apiCount > 0) LOG.info(`${apiCount} api route${apiCount === 1 ? "" : "s"} (app/api)`);
|
|
@@ -67762,7 +68105,8 @@ init_path_store();
|
|
|
67762
68105
|
|
|
67763
68106
|
// src/index.ts
|
|
67764
68107
|
var __filename2 = fileURLToPath9(import.meta.url);
|
|
67765
|
-
var __dirname10 =
|
|
68108
|
+
var __dirname10 = resolve41(__filename2, "..");
|
|
68109
|
+
var requireFromCli = createRequire8(import.meta.url);
|
|
67766
68110
|
var args = process.argv.slice(2);
|
|
67767
68111
|
var cmd = args[0];
|
|
67768
68112
|
function usage(code = 0) {
|
|
@@ -67807,12 +68151,12 @@ if (args.length === 0 || args.includes("--help") || args.includes("-h")) {
|
|
|
67807
68151
|
}
|
|
67808
68152
|
function loadEnvFiles(projectDir) {
|
|
67809
68153
|
const files = [
|
|
67810
|
-
|
|
67811
|
-
|
|
68154
|
+
join32(projectDir, ".env"),
|
|
68155
|
+
join32(projectDir, ".env.local")
|
|
67812
68156
|
];
|
|
67813
68157
|
for (const filePath of files) {
|
|
67814
|
-
if (!
|
|
67815
|
-
const content =
|
|
68158
|
+
if (!existsSync46(filePath)) continue;
|
|
68159
|
+
const content = readFileSync45(filePath, "utf-8");
|
|
67816
68160
|
for (const line of content.split("\n")) {
|
|
67817
68161
|
const trimmed = line.trim();
|
|
67818
68162
|
if (!trimmed || trimmed.startsWith("#")) continue;
|
|
@@ -67845,16 +68189,39 @@ async function loadConfig(projectDir) {
|
|
|
67845
68189
|
function resolveProjectDirs(projectDir, config) {
|
|
67846
68190
|
const cfg = config || {};
|
|
67847
68191
|
return {
|
|
67848
|
-
appDir:
|
|
67849
|
-
publicDir:
|
|
67850
|
-
outDir:
|
|
68192
|
+
appDir: resolve41(projectDir, typeof cfg.appDir === "string" ? cfg.appDir : "./app"),
|
|
68193
|
+
publicDir: resolve41(projectDir, typeof cfg.publicDir === "string" ? cfg.publicDir : "./public"),
|
|
68194
|
+
outDir: resolve41(projectDir, typeof cfg.outDir === "string" ? cfg.outDir : ".vesk")
|
|
67851
68195
|
};
|
|
67852
68196
|
}
|
|
68197
|
+
async function typecheckBeforeBuild(projectDir) {
|
|
68198
|
+
if (!existsSync46(join32(projectDir, "tsconfig.json"))) return;
|
|
68199
|
+
let tscPath;
|
|
68200
|
+
try {
|
|
68201
|
+
tscPath = requireFromCli.resolve("typescript/bin/tsc", { paths: [projectDir] });
|
|
68202
|
+
} catch {
|
|
68203
|
+
console.error("vesk build: typecheck skipped \u2014 TypeScript is not installed in this project.");
|
|
68204
|
+
return;
|
|
68205
|
+
}
|
|
68206
|
+
console.error("vesk build: typechecking...");
|
|
68207
|
+
const exitCode = await new Promise((resolveExit) => {
|
|
68208
|
+
const child = spawn3(process.execPath, [tscPath, "--noEmit", "-p", projectDir], {
|
|
68209
|
+
cwd: projectDir,
|
|
68210
|
+
stdio: "inherit"
|
|
68211
|
+
});
|
|
68212
|
+
child.on("error", () => resolveExit(1));
|
|
68213
|
+
child.on("close", (code) => resolveExit(code ?? 1));
|
|
68214
|
+
});
|
|
68215
|
+
if (exitCode !== 0) {
|
|
68216
|
+
console.error("vesk build: typecheck failed \u2014 fix the errors above and build again.");
|
|
68217
|
+
process.exit(1);
|
|
68218
|
+
}
|
|
68219
|
+
}
|
|
67853
68220
|
if (cmd === "build") {
|
|
67854
68221
|
const projectDir = process.cwd();
|
|
67855
68222
|
const rawConfig = await loadConfig(projectDir) || {};
|
|
67856
68223
|
const { appDir: appDirPath, publicDir, outDir } = resolveProjectDirs(projectDir, rawConfig);
|
|
67857
|
-
if (!
|
|
68224
|
+
if (!existsSync46(appDirPath)) {
|
|
67858
68225
|
console.error(`vesk build: no app directory found in ${projectDir} (config appDir: ${rawConfig.appDir ?? "./app"})`);
|
|
67859
68226
|
process.exit(1);
|
|
67860
68227
|
}
|
|
@@ -67874,6 +68241,7 @@ if (cmd === "build") {
|
|
|
67874
68241
|
if (platform) opts.platform = platform;
|
|
67875
68242
|
if (config.ssg !== void 0 && config.ssg !== false) opts.ssg = true;
|
|
67876
68243
|
try {
|
|
68244
|
+
await typecheckBeforeBuild(projectDir);
|
|
67877
68245
|
await build2(appDirPath, opts);
|
|
67878
68246
|
const { drainMdHtmlWarnings: drainMdHtmlWarnings3 } = await Promise.resolve().then(() => (init_md2(), md_exports2));
|
|
67879
68247
|
const drained = drainMdHtmlWarnings3();
|
|
@@ -67928,7 +68296,7 @@ ${frame}`;
|
|
|
67928
68296
|
if (cmd === "seo") {
|
|
67929
68297
|
const projectDir = process.cwd();
|
|
67930
68298
|
const { appDir: appDirPath } = resolveProjectDirs(projectDir, await loadConfig(projectDir) || {});
|
|
67931
|
-
if (!
|
|
68299
|
+
if (!existsSync46(appDirPath)) {
|
|
67932
68300
|
console.error(`vesk seo: no app directory found in ${projectDir}`);
|
|
67933
68301
|
process.exit(1);
|
|
67934
68302
|
}
|
|
@@ -67943,7 +68311,7 @@ if (cmd === "seo") {
|
|
|
67943
68311
|
if (cmd === "typecheck") {
|
|
67944
68312
|
const projectDir = process.cwd();
|
|
67945
68313
|
const { appDir: appDirPath } = resolveProjectDirs(projectDir, await loadConfig(projectDir) || {});
|
|
67946
|
-
if (!
|
|
68314
|
+
if (!existsSync46(appDirPath)) {
|
|
67947
68315
|
console.error(`vesk typecheck: no app directory found in ${projectDir}`);
|
|
67948
68316
|
process.exit(1);
|
|
67949
68317
|
}
|
|
@@ -67970,7 +68338,7 @@ if (cmd === "start") {
|
|
|
67970
68338
|
const { outDir } = resolveProjectDirs(projectDir, await loadConfig(projectDir) || {});
|
|
67971
68339
|
const port = parsePortArg(args);
|
|
67972
68340
|
const host = parseHostArg(args);
|
|
67973
|
-
if (!
|
|
68341
|
+
if (!existsSync46(outDir)) {
|
|
67974
68342
|
console.error(`vesk start: no build found at ${outDir} \u2014 run "vesk build" first.`);
|
|
67975
68343
|
process.exit(1);
|
|
67976
68344
|
}
|
|
@@ -67981,8 +68349,8 @@ if (cmd === "start") {
|
|
|
67981
68349
|
if (cmd === "init") {
|
|
67982
68350
|
const projectDir = process.cwd();
|
|
67983
68351
|
const { appDir: appDirPath } = resolveProjectDirs(projectDir, await loadConfig(projectDir) || {});
|
|
67984
|
-
const target =
|
|
67985
|
-
if (
|
|
68352
|
+
const target = join32(appDirPath, "global.css");
|
|
68353
|
+
if (existsSync46(target)) {
|
|
67986
68354
|
console.error(`vesk init: ${target} already exists \u2014 skipping`);
|
|
67987
68355
|
process.exit(0);
|
|
67988
68356
|
}
|
|
@@ -68002,7 +68370,7 @@ if (cmd === "migrate") {
|
|
|
68002
68370
|
const projectDir = process.cwd();
|
|
68003
68371
|
const { runMigrate: runMigrate2 } = await Promise.resolve().then(() => (init_migrate(), migrate_exports));
|
|
68004
68372
|
const { CODEMODS: CODEMODS2 } = await Promise.resolve().then(() => (init_codemods(), codemods_exports));
|
|
68005
|
-
const { version: cliVersion } = JSON.parse(
|
|
68373
|
+
const { version: cliVersion } = JSON.parse(readFileSync45(join32(__dirname10, "..", "package.json"), "utf-8"));
|
|
68006
68374
|
if (args.includes("--list")) {
|
|
68007
68375
|
console.error("vesk migrate: available codemods");
|
|
68008
68376
|
for (const c of CODEMODS2) {
|
|
@@ -68044,7 +68412,7 @@ if (cmd === "dev") {
|
|
|
68044
68412
|
const { appDir: appDirPath, publicDir } = resolveProjectDirs(projectDir, await loadConfig(projectDir) || {});
|
|
68045
68413
|
const port = parsePortArg(args);
|
|
68046
68414
|
const host = parseHostArg(args);
|
|
68047
|
-
if (!
|
|
68415
|
+
if (!existsSync46(appDirPath)) {
|
|
68048
68416
|
console.error(`vesk: no app/ directory found in ${projectDir}`);
|
|
68049
68417
|
console.error('Run "npx create-vesk@latest <project-name>" first');
|
|
68050
68418
|
process.exit(1);
|