@vesk/vesk-cli 0.2.28 → 0.2.29
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 +970 -437
- package/package.json +5 -5
package/dist/cli.js
CHANGED
|
@@ -1796,7 +1796,7 @@ async function runFetcher(handle2, timeout) {
|
|
|
1796
1796
|
}
|
|
1797
1797
|
}
|
|
1798
1798
|
function sleep(ms) {
|
|
1799
|
-
return new Promise((
|
|
1799
|
+
return new Promise((resolve41) => setTimeout(resolve41, ms));
|
|
1800
1800
|
}
|
|
1801
1801
|
function streamText(res, into, onChunk) {
|
|
1802
1802
|
const decoder = new TextDecoder();
|
|
@@ -2174,6 +2174,13 @@ function runInHydrateBlock(fn) {
|
|
|
2174
2174
|
throw error;
|
|
2175
2175
|
}
|
|
2176
2176
|
}
|
|
2177
|
+
function reportHydrationIssue(issue) {
|
|
2178
|
+
if (!__mismatchHandler) return;
|
|
2179
|
+
try {
|
|
2180
|
+
__mismatchHandler(issue);
|
|
2181
|
+
} catch {
|
|
2182
|
+
}
|
|
2183
|
+
}
|
|
2177
2184
|
function devWarn(message) {
|
|
2178
2185
|
if (__hydrateDevMode && typeof console !== "undefined") {
|
|
2179
2186
|
console.warn("[vesk-hydrate] " + message);
|
|
@@ -2476,12 +2483,12 @@ function hydrateViewport(container, componentFn, props, rootMargin = 500, option
|
|
|
2476
2483
|
let cancelled = false;
|
|
2477
2484
|
let cancelFn = () => {
|
|
2478
2485
|
};
|
|
2479
|
-
const promise = new Promise((
|
|
2486
|
+
const promise = new Promise((resolve41) => {
|
|
2480
2487
|
const finish = () => {
|
|
2481
2488
|
cancelled = true;
|
|
2482
2489
|
cancelFn = () => {
|
|
2483
2490
|
};
|
|
2484
|
-
|
|
2491
|
+
resolve41();
|
|
2485
2492
|
};
|
|
2486
2493
|
cancelFn = finish;
|
|
2487
2494
|
if (!batchAlive(container, epoch, isCurrent)) return finish();
|
|
@@ -2818,6 +2825,22 @@ ${String(this.root.outerHTML).slice(0, 800)}` : ""),
|
|
|
2818
2825
|
if (this.idx > this.markers.length) this.idx = this.markers.length;
|
|
2819
2826
|
return new _WalkerEngine(rootEl, owned.map((m) => m.comment));
|
|
2820
2827
|
}
|
|
2828
|
+
// Ownership transfer for an explicit marker subset (layout slot contract).
|
|
2829
|
+
// The listed markers are marked claimed here without advancing the cursor:
|
|
2830
|
+
// positional claims skip them, and a scoped walker built over the same
|
|
2831
|
+
// comments owns them exclusively. Exactly one engine owns each marker.
|
|
2832
|
+
takeMarkers(comments) {
|
|
2833
|
+
let owned;
|
|
2834
|
+
try {
|
|
2835
|
+
owned = new Set(comments);
|
|
2836
|
+
} catch {
|
|
2837
|
+
return;
|
|
2838
|
+
}
|
|
2839
|
+
if (owned.size === 0) return;
|
|
2840
|
+
for (const tm of this.markers) {
|
|
2841
|
+
if (tm.state !== "claimed" && owned.has(tm.comment)) tm.state = "claimed";
|
|
2842
|
+
}
|
|
2843
|
+
}
|
|
2821
2844
|
// Retire every unclaimed marker in the whole walk that points at `el`.
|
|
2822
2845
|
// Used after a cross-position adopt (relocate): the adopted node moves to
|
|
2823
2846
|
// the cursor, so alias markers stacked at its old station would otherwise
|
|
@@ -2912,6 +2935,92 @@ ${String(this.root.outerHTML).slice(0, 800)}` : ""),
|
|
|
2912
2935
|
}
|
|
2913
2936
|
});
|
|
2914
2937
|
|
|
2938
|
+
// ../runtime/src/layout.ts
|
|
2939
|
+
function slotIdentity(text, prefix) {
|
|
2940
|
+
if (text === prefix) return { id: "" };
|
|
2941
|
+
if (typeof text !== "string") return null;
|
|
2942
|
+
const want = prefix + ":";
|
|
2943
|
+
if (text.length > want.length && text.startsWith(want)) return { id: text.slice(want.length) };
|
|
2944
|
+
return null;
|
|
2945
|
+
}
|
|
2946
|
+
function slotOpenId(text) {
|
|
2947
|
+
return slotIdentity(text, LAYOUT_SLOT_OPEN);
|
|
2948
|
+
}
|
|
2949
|
+
function slotCloseId(text) {
|
|
2950
|
+
return slotIdentity(text, LAYOUT_SLOT_CLOSE);
|
|
2951
|
+
}
|
|
2952
|
+
function auditLayoutSlots(container) {
|
|
2953
|
+
let unbalanced = 0;
|
|
2954
|
+
let leftoverInSlot = 0;
|
|
2955
|
+
try {
|
|
2956
|
+
const walker = document.createTreeWalker(container, _SHOW_COMMENT2, {
|
|
2957
|
+
acceptNode: (node) => {
|
|
2958
|
+
const t = node.textContent;
|
|
2959
|
+
if (slotOpenId(t) !== null || slotCloseId(t) !== null || isVskMarkerText(t)) return _FILTER_ACCEPT2;
|
|
2960
|
+
return _FILTER_SKIP2;
|
|
2961
|
+
}
|
|
2962
|
+
});
|
|
2963
|
+
const stack = [];
|
|
2964
|
+
while (walker.nextNode()) {
|
|
2965
|
+
const c = walker.currentNode;
|
|
2966
|
+
const t = c.textContent;
|
|
2967
|
+
const open = slotOpenId(t);
|
|
2968
|
+
if (open !== null) {
|
|
2969
|
+
stack.push(open.id);
|
|
2970
|
+
continue;
|
|
2971
|
+
}
|
|
2972
|
+
const close = slotCloseId(t);
|
|
2973
|
+
if (close !== null) {
|
|
2974
|
+
if (stack.length === 0) {
|
|
2975
|
+
unbalanced++;
|
|
2976
|
+
reportHydrationIssue({
|
|
2977
|
+
kind: "marker-skew",
|
|
2978
|
+
detail: "layout slot close without a matching open \u2014 SSR/client slot structure diverges; slot content may misorder."
|
|
2979
|
+
});
|
|
2980
|
+
continue;
|
|
2981
|
+
}
|
|
2982
|
+
const top = stack.pop();
|
|
2983
|
+
if (top !== "" && close.id !== "" && top !== close.id) {
|
|
2984
|
+
unbalanced++;
|
|
2985
|
+
reportHydrationIssue({
|
|
2986
|
+
kind: "marker-skew",
|
|
2987
|
+
detail: `layout slot id mismatch: open "${top}" closed by "${close.id}" \u2014 SSR/client slot structure diverges; slot content may misorder.`
|
|
2988
|
+
});
|
|
2989
|
+
}
|
|
2990
|
+
continue;
|
|
2991
|
+
}
|
|
2992
|
+
if (stack.length > 0 && isVskMarkerText(t)) leftoverInSlot++;
|
|
2993
|
+
}
|
|
2994
|
+
if (stack.length > 0) {
|
|
2995
|
+
unbalanced++;
|
|
2996
|
+
reportHydrationIssue({
|
|
2997
|
+
kind: "marker-skew",
|
|
2998
|
+
detail: "layout slot open without a matching close \u2014 SSR/client slot structure diverges; slot content may misorder."
|
|
2999
|
+
});
|
|
3000
|
+
}
|
|
3001
|
+
if (leftoverInSlot > 0) {
|
|
3002
|
+
reportHydrationIssue({
|
|
3003
|
+
kind: "leftover-marker",
|
|
3004
|
+
detail: `${leftoverInSlot} hydration marker(s) survived inside a layout slot region; the page rendered differently than SSR \u2014 duplication risk.`
|
|
3005
|
+
});
|
|
3006
|
+
}
|
|
3007
|
+
} catch {
|
|
3008
|
+
}
|
|
3009
|
+
return { ok: unbalanced === 0 && leftoverInSlot === 0, unbalanced, leftoverInSlot };
|
|
3010
|
+
}
|
|
3011
|
+
var LAYOUT_SLOT_OPEN, LAYOUT_SLOT_CLOSE, _SHOW_COMMENT2, _FILTER_ACCEPT2, _FILTER_SKIP2;
|
|
3012
|
+
var init_layout = __esm({
|
|
3013
|
+
"../runtime/src/layout.ts"() {
|
|
3014
|
+
"use strict";
|
|
3015
|
+
init_hydrate();
|
|
3016
|
+
LAYOUT_SLOT_OPEN = "vsk-slot";
|
|
3017
|
+
LAYOUT_SLOT_CLOSE = "vsk-slot-end";
|
|
3018
|
+
_SHOW_COMMENT2 = 128;
|
|
3019
|
+
_FILTER_ACCEPT2 = 1;
|
|
3020
|
+
_FILTER_SKIP2 = 2;
|
|
3021
|
+
}
|
|
3022
|
+
});
|
|
3023
|
+
|
|
2915
3024
|
// ../runtime/src/router-match.ts
|
|
2916
3025
|
function flattenLayoutChain(tree, pathParts, result = []) {
|
|
2917
3026
|
for (let i = 0; i < tree.length; i++) {
|
|
@@ -3769,7 +3878,7 @@ function ensureChunk(chunkUrl) {
|
|
|
3769
3878
|
if (typeof document === "undefined" || typeof document.createElement !== "function") {
|
|
3770
3879
|
return Promise.resolve();
|
|
3771
3880
|
}
|
|
3772
|
-
const promise = new Promise((
|
|
3881
|
+
const promise = new Promise((resolve41, reject) => {
|
|
3773
3882
|
const s = document.createElement("script");
|
|
3774
3883
|
s.src = chunkUrl;
|
|
3775
3884
|
let settled = false;
|
|
@@ -3788,7 +3897,7 @@ function ensureChunk(chunkUrl) {
|
|
|
3788
3897
|
loadedChunks.add(chunkUrl);
|
|
3789
3898
|
inFlightChunks.delete(chunkUrl);
|
|
3790
3899
|
failedChunks.delete(chunkUrl);
|
|
3791
|
-
|
|
3900
|
+
resolve41();
|
|
3792
3901
|
};
|
|
3793
3902
|
s.onerror = () => {
|
|
3794
3903
|
fail(new Error(`Failed to load chunk: ${chunkUrl}`));
|
|
@@ -4656,6 +4765,12 @@ async function hydrateInitial(router, match, container, strategy) {
|
|
|
4656
4765
|
setIsHydrating(true);
|
|
4657
4766
|
const walker = createHydrateWalker(container);
|
|
4658
4767
|
await runInBlockWindow(() => renderLayoutChain2(0)(walker));
|
|
4768
|
+
if (!strategy || strategy === "full") {
|
|
4769
|
+
try {
|
|
4770
|
+
auditLayoutSlots(container);
|
|
4771
|
+
} catch {
|
|
4772
|
+
}
|
|
4773
|
+
}
|
|
4659
4774
|
setIsHydrating(false);
|
|
4660
4775
|
} catch (error) {
|
|
4661
4776
|
setIsHydrating(false);
|
|
@@ -5473,6 +5588,7 @@ var init_router = __esm({
|
|
|
5473
5588
|
init_ripple_runtime();
|
|
5474
5589
|
init_ripple_blocks();
|
|
5475
5590
|
init_hydrate();
|
|
5591
|
+
init_layout();
|
|
5476
5592
|
init_router_match();
|
|
5477
5593
|
init_router_components();
|
|
5478
5594
|
init_network();
|
|
@@ -26282,7 +26398,7 @@ is not a problem with esbuild. You need to fix your environment instead.
|
|
|
26282
26398
|
let latestResultPromise;
|
|
26283
26399
|
let provideLatestResult;
|
|
26284
26400
|
if (isContext)
|
|
26285
|
-
requestCallbacks["on-end"] = (id, request2) => new Promise((
|
|
26401
|
+
requestCallbacks["on-end"] = (id, request2) => new Promise((resolve41) => {
|
|
26286
26402
|
buildResponseToResult(request2, (err, result, onEndErrors, onEndWarnings) => {
|
|
26287
26403
|
const response = {
|
|
26288
26404
|
errors: onEndErrors,
|
|
@@ -26292,7 +26408,7 @@ is not a problem with esbuild. You need to fix your environment instead.
|
|
|
26292
26408
|
latestResultPromise = void 0;
|
|
26293
26409
|
provideLatestResult = void 0;
|
|
26294
26410
|
sendResponse(id, response);
|
|
26295
|
-
|
|
26411
|
+
resolve41();
|
|
26296
26412
|
});
|
|
26297
26413
|
});
|
|
26298
26414
|
sendRequest(refs, request, (error, response) => {
|
|
@@ -26309,10 +26425,10 @@ is not a problem with esbuild. You need to fix your environment instead.
|
|
|
26309
26425
|
let didDispose = false;
|
|
26310
26426
|
const result = {
|
|
26311
26427
|
rebuild: () => {
|
|
26312
|
-
if (!latestResultPromise) latestResultPromise = new Promise((
|
|
26428
|
+
if (!latestResultPromise) latestResultPromise = new Promise((resolve41, reject) => {
|
|
26313
26429
|
let settlePromise;
|
|
26314
26430
|
provideLatestResult = (err, result2) => {
|
|
26315
|
-
if (!settlePromise) settlePromise = () => err ? reject(err) :
|
|
26431
|
+
if (!settlePromise) settlePromise = () => err ? reject(err) : resolve41(result2);
|
|
26316
26432
|
};
|
|
26317
26433
|
const triggerAnotherBuild = () => {
|
|
26318
26434
|
const request2 = {
|
|
@@ -26333,7 +26449,7 @@ is not a problem with esbuild. You need to fix your environment instead.
|
|
|
26333
26449
|
});
|
|
26334
26450
|
return latestResultPromise;
|
|
26335
26451
|
},
|
|
26336
|
-
watch: (options2 = {}) => new Promise((
|
|
26452
|
+
watch: (options2 = {}) => new Promise((resolve41, reject) => {
|
|
26337
26453
|
if (!streamIn.hasFS) throw new Error(`Cannot use the "watch" API in this environment`);
|
|
26338
26454
|
const keys = {};
|
|
26339
26455
|
const delay = getFlag(options2, keys, "delay", mustBeInteger);
|
|
@@ -26345,10 +26461,10 @@ is not a problem with esbuild. You need to fix your environment instead.
|
|
|
26345
26461
|
if (delay) request2.delay = delay;
|
|
26346
26462
|
sendRequest(refs, request2, (error2) => {
|
|
26347
26463
|
if (error2) reject(new Error(error2));
|
|
26348
|
-
else
|
|
26464
|
+
else resolve41(void 0);
|
|
26349
26465
|
});
|
|
26350
26466
|
}),
|
|
26351
|
-
serve: (options2 = {}) => new Promise((
|
|
26467
|
+
serve: (options2 = {}) => new Promise((resolve41, reject) => {
|
|
26352
26468
|
if (!streamIn.hasFS) throw new Error(`Cannot use the "serve" API in this environment`);
|
|
26353
26469
|
const keys = {};
|
|
26354
26470
|
const port = getFlag(options2, keys, "port", mustBeValidPortNumber);
|
|
@@ -26386,28 +26502,28 @@ is not a problem with esbuild. You need to fix your environment instead.
|
|
|
26386
26502
|
sendResponse(id, {});
|
|
26387
26503
|
};
|
|
26388
26504
|
}
|
|
26389
|
-
|
|
26505
|
+
resolve41(response2);
|
|
26390
26506
|
});
|
|
26391
26507
|
}),
|
|
26392
|
-
cancel: () => new Promise((
|
|
26393
|
-
if (didDispose) return
|
|
26508
|
+
cancel: () => new Promise((resolve41) => {
|
|
26509
|
+
if (didDispose) return resolve41();
|
|
26394
26510
|
const request2 = {
|
|
26395
26511
|
command: "cancel",
|
|
26396
26512
|
key: buildKey
|
|
26397
26513
|
};
|
|
26398
26514
|
sendRequest(refs, request2, () => {
|
|
26399
|
-
|
|
26515
|
+
resolve41();
|
|
26400
26516
|
});
|
|
26401
26517
|
}),
|
|
26402
|
-
dispose: () => new Promise((
|
|
26403
|
-
if (didDispose) return
|
|
26518
|
+
dispose: () => new Promise((resolve41) => {
|
|
26519
|
+
if (didDispose) return resolve41();
|
|
26404
26520
|
didDispose = true;
|
|
26405
26521
|
const request2 = {
|
|
26406
26522
|
command: "dispose",
|
|
26407
26523
|
key: buildKey
|
|
26408
26524
|
};
|
|
26409
26525
|
sendRequest(refs, request2, () => {
|
|
26410
|
-
|
|
26526
|
+
resolve41();
|
|
26411
26527
|
scheduleOnDisposeCallbacks();
|
|
26412
26528
|
refs.unref();
|
|
26413
26529
|
});
|
|
@@ -26446,7 +26562,7 @@ is not a problem with esbuild. You need to fix your environment instead.
|
|
|
26446
26562
|
onLoad: []
|
|
26447
26563
|
};
|
|
26448
26564
|
i++;
|
|
26449
|
-
let
|
|
26565
|
+
let resolve41 = (path3, options = {}) => {
|
|
26450
26566
|
if (!isSetupDone) throw new Error('Cannot call "resolve" before plugin setup has completed');
|
|
26451
26567
|
if (typeof path3 !== "string") throw new Error(`The path to resolve must be a string`);
|
|
26452
26568
|
let keys2 = /* @__PURE__ */ Object.create(null);
|
|
@@ -26490,7 +26606,7 @@ is not a problem with esbuild. You need to fix your environment instead.
|
|
|
26490
26606
|
};
|
|
26491
26607
|
let promise = setup({
|
|
26492
26608
|
initialOptions,
|
|
26493
|
-
resolve:
|
|
26609
|
+
resolve: resolve41,
|
|
26494
26610
|
onStart(callback) {
|
|
26495
26611
|
let registeredText = `This error came from the "onStart" callback registered here:`;
|
|
26496
26612
|
let registeredNote = extractCallerV8(new Error(registeredText), streamIn, "onStart");
|
|
@@ -27183,46 +27299,46 @@ More information: The file containing the code for esbuild's JavaScript API (${_
|
|
|
27183
27299
|
}
|
|
27184
27300
|
};
|
|
27185
27301
|
longLivedService = {
|
|
27186
|
-
build: (options) => new Promise((
|
|
27302
|
+
build: (options) => new Promise((resolve41, reject) => {
|
|
27187
27303
|
service.buildOrContext({
|
|
27188
27304
|
callName: "build",
|
|
27189
27305
|
refs,
|
|
27190
27306
|
options,
|
|
27191
27307
|
isTTY: isTTY(),
|
|
27192
27308
|
defaultWD,
|
|
27193
|
-
callback: (err, res) => err ? reject(err) :
|
|
27309
|
+
callback: (err, res) => err ? reject(err) : resolve41(res)
|
|
27194
27310
|
});
|
|
27195
27311
|
}),
|
|
27196
|
-
context: (options) => new Promise((
|
|
27312
|
+
context: (options) => new Promise((resolve41, reject) => service.buildOrContext({
|
|
27197
27313
|
callName: "context",
|
|
27198
27314
|
refs,
|
|
27199
27315
|
options,
|
|
27200
27316
|
isTTY: isTTY(),
|
|
27201
27317
|
defaultWD,
|
|
27202
|
-
callback: (err, res) => err ? reject(err) :
|
|
27318
|
+
callback: (err, res) => err ? reject(err) : resolve41(res)
|
|
27203
27319
|
})),
|
|
27204
|
-
transform: (input, options) => new Promise((
|
|
27320
|
+
transform: (input, options) => new Promise((resolve41, reject) => service.transform({
|
|
27205
27321
|
callName: "transform",
|
|
27206
27322
|
refs,
|
|
27207
27323
|
input,
|
|
27208
27324
|
options: options || {},
|
|
27209
27325
|
isTTY: isTTY(),
|
|
27210
27326
|
fs: fsAsync,
|
|
27211
|
-
callback: (err, res) => err ? reject(err) :
|
|
27327
|
+
callback: (err, res) => err ? reject(err) : resolve41(res)
|
|
27212
27328
|
})),
|
|
27213
|
-
formatMessages: (messages, options) => new Promise((
|
|
27329
|
+
formatMessages: (messages, options) => new Promise((resolve41, reject) => service.formatMessages({
|
|
27214
27330
|
callName: "formatMessages",
|
|
27215
27331
|
refs,
|
|
27216
27332
|
messages,
|
|
27217
27333
|
options,
|
|
27218
|
-
callback: (err, res) => err ? reject(err) :
|
|
27334
|
+
callback: (err, res) => err ? reject(err) : resolve41(res)
|
|
27219
27335
|
})),
|
|
27220
|
-
analyzeMetafile: (metafile, options) => new Promise((
|
|
27336
|
+
analyzeMetafile: (metafile, options) => new Promise((resolve41, reject) => service.analyzeMetafile({
|
|
27221
27337
|
callName: "analyzeMetafile",
|
|
27222
27338
|
refs,
|
|
27223
27339
|
metafile: typeof metafile === "string" ? metafile : JSON.stringify(metafile),
|
|
27224
27340
|
options,
|
|
27225
|
-
callback: (err, res) => err ? reject(err) :
|
|
27341
|
+
callback: (err, res) => err ? reject(err) : resolve41(res)
|
|
27226
27342
|
}))
|
|
27227
27343
|
};
|
|
27228
27344
|
return longLivedService;
|
|
@@ -27300,13 +27416,13 @@ error: ${text}`);
|
|
|
27300
27416
|
worker.postMessage(msg);
|
|
27301
27417
|
let status = Atomics.wait(sharedBufferView, 0, 0);
|
|
27302
27418
|
if (status !== "ok" && status !== "not-equal") throw new Error("Internal error: Atomics.wait() failed: " + status);
|
|
27303
|
-
let { message: { id: id2, resolve:
|
|
27419
|
+
let { message: { id: id2, resolve: resolve41, reject, properties } } = worker_threads2.receiveMessageOnPort(mainPort);
|
|
27304
27420
|
if (id !== id2) throw new Error(`Internal error: Expected id ${id} but got id ${id2}`);
|
|
27305
27421
|
if (reject) {
|
|
27306
27422
|
applyProperties(reject, properties);
|
|
27307
27423
|
throw reject;
|
|
27308
27424
|
}
|
|
27309
|
-
return
|
|
27425
|
+
return resolve41;
|
|
27310
27426
|
};
|
|
27311
27427
|
worker.unref();
|
|
27312
27428
|
return {
|
|
@@ -28163,8 +28279,9 @@ function emitNode(ctx2, node, tracked2, effectsVar, parentVar, compPrefix = "__c
|
|
|
28163
28279
|
if (ctx2.hydrate) {
|
|
28164
28280
|
ctx2.push(`if (props.children !== undefined && props.children !== null) {`);
|
|
28165
28281
|
ctx2.push(` if (typeof props.children === 'function') {`);
|
|
28166
|
-
ctx2.push(` const
|
|
28167
|
-
ctx2.push(`
|
|
28282
|
+
ctx2.push(` const __slot = createLayoutSlot(${ctx2.walker}, ${parentVar});`);
|
|
28283
|
+
ctx2.push(` const __child = props.children(__slot.walker);`);
|
|
28284
|
+
ctx2.push(` if (__child && typeof __child.then === 'function') __pendingChild = __slot.track(__child);`);
|
|
28168
28285
|
ctx2.push(` } else {`);
|
|
28169
28286
|
ctx2.push(` ${parentVar}.appendChild(props.children);`);
|
|
28170
28287
|
ctx2.push(` }`);
|
|
@@ -28244,7 +28361,58 @@ function emitStatic(ctx2, node, tracked2, effectsVar) {
|
|
|
28244
28361
|
let residueBefore = 0;
|
|
28245
28362
|
for (const child of children) {
|
|
28246
28363
|
let childVar;
|
|
28247
|
-
|
|
28364
|
+
const isPureStaticChild = ctx2.hydrate && child instanceof StaticNode && isStaticIR(child.children);
|
|
28365
|
+
if (isPureStaticChild) {
|
|
28366
|
+
const ssrEl = `${el}.__vsk_ssrEls[${residueBefore}]`;
|
|
28367
|
+
childVar = ssrEl;
|
|
28368
|
+
const dynAttrs2 = [];
|
|
28369
|
+
const staticChildren = [];
|
|
28370
|
+
for (const c of child.children) {
|
|
28371
|
+
if (c instanceof DynamicBinding && c.kind === "attribute") {
|
|
28372
|
+
dynAttrs2.push(c);
|
|
28373
|
+
} else {
|
|
28374
|
+
staticChildren.push(c);
|
|
28375
|
+
}
|
|
28376
|
+
}
|
|
28377
|
+
for (const attr of dynAttrs2) {
|
|
28378
|
+
const target = attr.target || "";
|
|
28379
|
+
const isEvent2 = target.startsWith("on") && target.length > 2;
|
|
28380
|
+
if (target === "ref") {
|
|
28381
|
+
const expr = transformTracked(attr.expression, tracked2);
|
|
28382
|
+
ctx2.push(`(${expr})(${ssrEl});`);
|
|
28383
|
+
} else if (isEvent2) {
|
|
28384
|
+
const eventName = target.slice(2).toLowerCase();
|
|
28385
|
+
const handler = transformTracked(attr.expression, tracked2);
|
|
28386
|
+
if (NON_BUBBLING_EVENTS.has(eventName)) {
|
|
28387
|
+
ctx2.directEvents.add(eventName);
|
|
28388
|
+
ctx2.push(`${ssrEl}.addEventListener(${JSON.stringify(eventName)}, ${handler});`);
|
|
28389
|
+
} else {
|
|
28390
|
+
const prop = `__evh_${eventName}`;
|
|
28391
|
+
ctx2.delegatedEvents.add(eventName);
|
|
28392
|
+
ctx2.push(`${ssrEl}.${prop} = ${handler};`);
|
|
28393
|
+
}
|
|
28394
|
+
ctx2.push(`${ssrEl}.setAttribute('data-vsk-ev', '');`);
|
|
28395
|
+
} else if (target === "style") {
|
|
28396
|
+
const expr = transformTracked(attr.expression, tracked2);
|
|
28397
|
+
const eff = `effect(() => { applyStyle(${ssrEl}, ${expr}); })`;
|
|
28398
|
+
if (effectsVar) {
|
|
28399
|
+
ctx2.push(`${effectsVar}.push(${eff});`);
|
|
28400
|
+
} else {
|
|
28401
|
+
ctx2.effects.push(`${eff};`);
|
|
28402
|
+
}
|
|
28403
|
+
} else {
|
|
28404
|
+
const expr = transformTracked(attr.expression, tracked2);
|
|
28405
|
+
const useProp = PROPERTY_ATTRS[node.tag]?.has(target);
|
|
28406
|
+
const eff = useProp ? `effect(() => { ${ssrEl}.${target} = ${expr}; })` : `effect(() => { const __v = ${expr}; if (__v != null && __v !== false) ${ssrEl}.setAttribute(${JSON.stringify(target)}, __v === true ? 'true' : String(__v)); })`;
|
|
28407
|
+
if (effectsVar) {
|
|
28408
|
+
ctx2.push(`${effectsVar}.push(${eff});`);
|
|
28409
|
+
} else {
|
|
28410
|
+
ctx2.effects.push(`${eff};`);
|
|
28411
|
+
}
|
|
28412
|
+
}
|
|
28413
|
+
}
|
|
28414
|
+
childVar = ssrEl;
|
|
28415
|
+
} else if (singleReactiveText && child instanceof DynamicBinding && child.kind === "text") {
|
|
28248
28416
|
childVar = emitDynamicBinding(ctx2, child, tracked2, effectsVar, `${el}.__vsk_ssrText`);
|
|
28249
28417
|
} else {
|
|
28250
28418
|
childVar = emitNode(ctx2, child, tracked2, effectsVar, el);
|
|
@@ -29547,7 +29715,7 @@ function emitClientFromIR(ir, options) {
|
|
|
29547
29715
|
if (ir.components.some((c) => hasKeyedMap(c.body))) runtimeNames.push("reconcile");
|
|
29548
29716
|
if (options.hydrate && ir.components.some((c) => hasKeyedMap(c.body))) runtimeNames.push("reconcileHydrated");
|
|
29549
29717
|
if (options.hydrate) {
|
|
29550
|
-
const hydrateNames = ["hydrate", "hydrateViewport", "hydrateIdle", "hydrateOnInteraction", "needsHydration", "createHydrateWalker", "collectVskMarkers", "reactiveProps"];
|
|
29718
|
+
const hydrateNames = ["hydrate", "hydrateViewport", "hydrateIdle", "hydrateOnInteraction", "needsHydration", "createHydrateWalker", "collectVskMarkers", "reactiveProps", "createLayoutSlot"];
|
|
29551
29719
|
for (const name of hydrateNames) {
|
|
29552
29720
|
if (!runtimeNames.includes(name)) runtimeNames.push(name);
|
|
29553
29721
|
}
|
|
@@ -29581,11 +29749,11 @@ function compileClient(source, _componentName, options = {}) {
|
|
|
29581
29749
|
const ir = generateIR(ast, source, options.sourcePath);
|
|
29582
29750
|
return emitClientFromIR(ir, { ...options, nameAllocator: options.nameAllocator ?? nameAllocFor(options.sourcePath) });
|
|
29583
29751
|
}
|
|
29584
|
-
function compileClientBoth(source, _componentName, sourcePath2) {
|
|
29752
|
+
function compileClientBoth(source, _componentName, sourcePath2, opts) {
|
|
29585
29753
|
const ast = parse4(source, sourcePath2 ? { filename: sourcePath2 } : {});
|
|
29586
|
-
const hydAst = structuredClone(ast);
|
|
29754
|
+
const hydAst = opts?.skipHyd ? null : structuredClone(ast);
|
|
29587
29755
|
const ir = generateIR(ast, source, sourcePath2);
|
|
29588
|
-
const irHyd = generateIR(hydAst, source, sourcePath2);
|
|
29756
|
+
const irHyd = opts?.skipHyd ? null : generateIR(hydAst, source, sourcePath2);
|
|
29589
29757
|
const defaultComp = ir.components.find((c) => c.defaultExport);
|
|
29590
29758
|
let name = null;
|
|
29591
29759
|
if (defaultComp) name = defaultComp.name;
|
|
@@ -29595,8 +29763,10 @@ function compileClientBoth(source, _componentName, sourcePath2) {
|
|
|
29595
29763
|
if (exportedComp) name = exportedComp.name;
|
|
29596
29764
|
}
|
|
29597
29765
|
const alloc = nameAllocFor(sourcePath2);
|
|
29766
|
+
const comp = emitClientFromIR(ir, { forceClient: true, nameAllocator: alloc });
|
|
29767
|
+
if (opts?.skipHyd) return { comp, hyd: "", name };
|
|
29598
29768
|
return {
|
|
29599
|
-
comp
|
|
29769
|
+
comp,
|
|
29600
29770
|
hyd: emitClientFromIR(irHyd, { forceClient: true, hydrate: true, includeTopLevel: false, nameAllocator: alloc }),
|
|
29601
29771
|
name
|
|
29602
29772
|
};
|
|
@@ -29729,7 +29899,7 @@ function irNodeToJS(node, importedNames, isAsync = false, tracked2) {
|
|
|
29729
29899
|
if (node instanceof StaticNode) return staticNodeToJS(node, isAsync, tracked2);
|
|
29730
29900
|
if (node instanceof TextNode) {
|
|
29731
29901
|
if (!node.value) return "";
|
|
29732
|
-
return `__out.push(${JSON.stringify(node.value)});`;
|
|
29902
|
+
return `__out.push(${JSON.stringify(escapeHtml(node.value))});`;
|
|
29733
29903
|
}
|
|
29734
29904
|
if (node instanceof DynamicBinding) return dynamicBindingToJS(node, tracked2);
|
|
29735
29905
|
if (node instanceof OpaqueDynamicRegion) return opaqueRegionToJS(node, isAsync, tracked2);
|
|
@@ -29769,7 +29939,10 @@ function irNodeToJS(node, importedNames, isAsync = false, tracked2) {
|
|
|
29769
29939
|
].join("\n");
|
|
29770
29940
|
}
|
|
29771
29941
|
if (node instanceof RuntimeStatement) return semicolonizeStatement(transformTracked(node, tracked2 || /* @__PURE__ */ new Map()));
|
|
29772
|
-
if (node instanceof SlotNode)
|
|
29942
|
+
if (node instanceof SlotNode) {
|
|
29943
|
+
const sid = `s${nextVskId()}`;
|
|
29944
|
+
return `__out.push('<!--vsk-slot:${sid}-->');__out.push(props.children || '');__out.push('<!--vsk-slot-end:${sid}-->');`;
|
|
29945
|
+
}
|
|
29773
29946
|
if (node instanceof PropSlotRender) return `__out.push(props.${node.propName} || '');`;
|
|
29774
29947
|
if (node instanceof PropSlot) return "";
|
|
29775
29948
|
return "";
|
|
@@ -36972,8 +37145,8 @@ __export(typecheck_exports, {
|
|
|
36972
37145
|
formatTypecheckWarnings: () => formatTypecheckWarnings,
|
|
36973
37146
|
typecheckProject: () => typecheckProject
|
|
36974
37147
|
});
|
|
36975
|
-
import { readFileSync as
|
|
36976
|
-
import { join as
|
|
37148
|
+
import { readFileSync as readFileSync39, readdirSync as readdirSync14, statSync as statSync22 } from "node:fs";
|
|
37149
|
+
import { join as join25, dirname as dirname27, normalize, relative as relative8, resolve as resolve39, sep as sep7 } from "node:path";
|
|
36977
37150
|
import * as ts8 from "typescript";
|
|
36978
37151
|
function walkProjectFiles(projectRoot) {
|
|
36979
37152
|
const code = [];
|
|
@@ -36986,7 +37159,7 @@ function walkProjectFiles(projectRoot) {
|
|
|
36986
37159
|
return;
|
|
36987
37160
|
}
|
|
36988
37161
|
for (const e of entries) {
|
|
36989
|
-
const p =
|
|
37162
|
+
const p = join25(dir, e);
|
|
36990
37163
|
let st;
|
|
36991
37164
|
try {
|
|
36992
37165
|
st = statSync22(p);
|
|
@@ -37014,8 +37187,8 @@ function walkProjectFiles(projectRoot) {
|
|
|
37014
37187
|
return { code, js };
|
|
37015
37188
|
}
|
|
37016
37189
|
function isUnder(dir, file) {
|
|
37017
|
-
const base =
|
|
37018
|
-
const abs =
|
|
37190
|
+
const base = resolve39(dir);
|
|
37191
|
+
const abs = resolve39(file);
|
|
37019
37192
|
return abs === base || abs.startsWith(base + sep7);
|
|
37020
37193
|
}
|
|
37021
37194
|
function structureWarning(rel, message) {
|
|
@@ -37041,8 +37214,8 @@ function checkStructureFile(appDir, file) {
|
|
|
37041
37214
|
return null;
|
|
37042
37215
|
}
|
|
37043
37216
|
function createTypecheckHost(projectRoot, appDir, vskFiles) {
|
|
37044
|
-
const ambientPath =
|
|
37045
|
-
const overridePath =
|
|
37217
|
+
const ambientPath = join25(appDir, "__vesk_ambient.d.ts");
|
|
37218
|
+
const overridePath = join25(appDir, "__vesk_runtime_override.d.ts");
|
|
37046
37219
|
const cached = /* @__PURE__ */ new Map();
|
|
37047
37220
|
const scriptKindFor = (file) => file.endsWith(".vsk") ? ts8.ScriptKind.TSX : ts8.ScriptKind.TS;
|
|
37048
37221
|
const host = {
|
|
@@ -37112,7 +37285,7 @@ function createTypecheckHost(projectRoot, appDir, vskFiles) {
|
|
|
37112
37285
|
directoryExists: (dir) => ts8.sys.directoryExists(dir),
|
|
37113
37286
|
getDirectories: (dir) => {
|
|
37114
37287
|
try {
|
|
37115
|
-
return readdirSync14(dir, { withFileTypes: true }).filter((d) => d.isDirectory()).map((d) =>
|
|
37288
|
+
return readdirSync14(dir, { withFileTypes: true }).filter((d) => d.isDirectory()).map((d) => join25(dir, d.name));
|
|
37116
37289
|
} catch {
|
|
37117
37290
|
return [];
|
|
37118
37291
|
}
|
|
@@ -37123,7 +37296,7 @@ function createTypecheckHost(projectRoot, appDir, vskFiles) {
|
|
|
37123
37296
|
resolveModuleNameLiterals(moduleLiterals, containingFile, redirectedReference, options) {
|
|
37124
37297
|
return moduleLiterals.map(({ text }) => {
|
|
37125
37298
|
if (text.endsWith(".vsk")) {
|
|
37126
|
-
const abs = normalize(
|
|
37299
|
+
const abs = normalize(join25(dirname27(containingFile), text));
|
|
37127
37300
|
return {
|
|
37128
37301
|
resolvedModule: {
|
|
37129
37302
|
resolvedFileName: abs + ".d.ts",
|
|
@@ -37134,7 +37307,7 @@ function createTypecheckHost(projectRoot, appDir, vskFiles) {
|
|
|
37134
37307
|
};
|
|
37135
37308
|
}
|
|
37136
37309
|
if (text.endsWith(".css")) {
|
|
37137
|
-
const abs = normalize(
|
|
37310
|
+
const abs = normalize(join25(dirname27(containingFile), text));
|
|
37138
37311
|
return {
|
|
37139
37312
|
resolvedModule: {
|
|
37140
37313
|
resolvedFileName: abs + ".d.ts",
|
|
@@ -37152,7 +37325,7 @@ function createTypecheckHost(projectRoot, appDir, vskFiles) {
|
|
|
37152
37325
|
return host;
|
|
37153
37326
|
}
|
|
37154
37327
|
function typecheckProject(projectRoot, opts = {}) {
|
|
37155
|
-
const appDir = opts.appDir ??
|
|
37328
|
+
const appDir = opts.appDir ?? join25(projectRoot, "app");
|
|
37156
37329
|
const vskFiles = /* @__PURE__ */ new Map();
|
|
37157
37330
|
const parseErrors = [];
|
|
37158
37331
|
const warnings = [];
|
|
@@ -37174,7 +37347,7 @@ function typecheckProject(projectRoot, opts = {}) {
|
|
|
37174
37347
|
}
|
|
37175
37348
|
}
|
|
37176
37349
|
if (f.endsWith(".vsk")) {
|
|
37177
|
-
const src2 =
|
|
37350
|
+
const src2 = readFileSync39(f, "utf-8");
|
|
37178
37351
|
try {
|
|
37179
37352
|
parse4(src2);
|
|
37180
37353
|
} catch (e) {
|
|
@@ -37191,8 +37364,8 @@ function typecheckProject(projectRoot, opts = {}) {
|
|
|
37191
37364
|
}
|
|
37192
37365
|
rootNames.push(f);
|
|
37193
37366
|
}
|
|
37194
|
-
const ambientPath =
|
|
37195
|
-
const overridePath =
|
|
37367
|
+
const ambientPath = join25(appDir, "__vesk_ambient.d.ts");
|
|
37368
|
+
const overridePath = join25(appDir, "__vesk_runtime_override.d.ts");
|
|
37196
37369
|
rootNames.push(ambientPath);
|
|
37197
37370
|
rootNames.push(overridePath);
|
|
37198
37371
|
const options = {
|
|
@@ -37756,8 +37929,8 @@ declare module '@vesk/runtime' {
|
|
|
37756
37929
|
});
|
|
37757
37930
|
|
|
37758
37931
|
// src/index.ts
|
|
37759
|
-
import { readFileSync as
|
|
37760
|
-
import { resolve as
|
|
37932
|
+
import { readFileSync as readFileSync40, writeFileSync as writeFileSync21, mkdirSync as mkdirSync18, existsSync as existsSync43 } from "fs";
|
|
37933
|
+
import { resolve as resolve40, join as join26 } from "path";
|
|
37761
37934
|
import { fileURLToPath as fileURLToPath9 } from "url";
|
|
37762
37935
|
|
|
37763
37936
|
// ../adapter/dist/load-config.js
|
|
@@ -39651,6 +39824,10 @@ function isComponentExport(node) {
|
|
|
39651
39824
|
}
|
|
39652
39825
|
return false;
|
|
39653
39826
|
}
|
|
39827
|
+
function isSnippetDrop(node) {
|
|
39828
|
+
if (isAnyImport(node) || isComponentExport(node) || isRuntimePreamble(node)) return true;
|
|
39829
|
+
return node.type === "VariableDeclaration" && (node.declarations?.[0]?.id?.name === "__components" || node.declarations?.[0]?.id?.name === "__hydrators");
|
|
39830
|
+
}
|
|
39654
39831
|
function extractCompiledNodes(code, isTarget) {
|
|
39655
39832
|
let ast;
|
|
39656
39833
|
try {
|
|
@@ -39841,12 +40018,42 @@ function scopeFileContribution(code) {
|
|
|
39841
40018
|
return code;
|
|
39842
40019
|
}
|
|
39843
40020
|
}
|
|
40021
|
+
function stripAndDemoteInOnePass(code) {
|
|
40022
|
+
let ast;
|
|
40023
|
+
try {
|
|
40024
|
+
ast = parse4(code);
|
|
40025
|
+
} catch {
|
|
40026
|
+
return code;
|
|
40027
|
+
}
|
|
40028
|
+
const body = ast.body ?? [];
|
|
40029
|
+
const edits = [];
|
|
40030
|
+
for (const raw2 of body) {
|
|
40031
|
+
const node = raw2;
|
|
40032
|
+
if (typeof node.start !== "number" || typeof node.end !== "number") continue;
|
|
40033
|
+
const isExport = node.type === "ExportNamedDeclaration" || node.type === "ExportDefaultDeclaration";
|
|
40034
|
+
if (isSnippetDrop(node)) {
|
|
40035
|
+
let cut = node.end;
|
|
40036
|
+
if (code[cut] === ";") cut++;
|
|
40037
|
+
if (code.startsWith("\r\n", cut)) cut += 2;
|
|
40038
|
+
else if (code[cut] === "\n" || code[cut] === "\r") cut++;
|
|
40039
|
+
edits.push({ start: node.start, end: cut });
|
|
40040
|
+
} else if (isExport && node.type === "ExportNamedDeclaration" && node.declaration && typeof node.declaration.start === "number" && typeof node.declaration.end === "number") {
|
|
40041
|
+
edits.push({ start: node.start, end: node.end, text: code.slice(node.declaration.start, node.declaration.end) });
|
|
40042
|
+
} else if (isExport) {
|
|
40043
|
+
let cut = node.end;
|
|
40044
|
+
if (code[cut] === ";") cut++;
|
|
40045
|
+
edits.push({ start: node.start, end: cut });
|
|
40046
|
+
}
|
|
40047
|
+
}
|
|
40048
|
+
if (edits.length === 0) return code;
|
|
40049
|
+
edits.sort((a, b) => b.start - a.start);
|
|
40050
|
+
for (const e of edits) {
|
|
40051
|
+
code = code.slice(0, e.start) + (e.text ?? "") + code.slice(e.end);
|
|
40052
|
+
}
|
|
40053
|
+
return code;
|
|
40054
|
+
}
|
|
39844
40055
|
function buildHmrEvalSnippet(code) {
|
|
39845
|
-
const
|
|
39846
|
-
if (isAnyImport(node) || isComponentExport(node) || isRuntimePreamble(node)) return true;
|
|
39847
|
-
return node.type === "VariableDeclaration" && (node.declarations?.[0]?.id?.name === "__components" || node.declarations?.[0]?.id?.name === "__hydrators");
|
|
39848
|
-
};
|
|
39849
|
-
const body = demoteExports(removeCompiledNodes(code, isSnippetDrop)).trim();
|
|
40056
|
+
const body = stripAndDemoteInOnePass(code).trim();
|
|
39850
40057
|
if (!body) return "";
|
|
39851
40058
|
const scoped = `{
|
|
39852
40059
|
${body}
|
|
@@ -41389,8 +41596,8 @@ vesk build: done (${outDir})`);
|
|
|
41389
41596
|
init_seo_audit();
|
|
41390
41597
|
|
|
41391
41598
|
// src/dev-server.ts
|
|
41392
|
-
import { readFileSync as
|
|
41393
|
-
import { resolve as
|
|
41599
|
+
import { readFileSync as readFileSync38, watch, statSync as statSync21, existsSync as existsSync42, readdirSync as readdirSync13 } from "node:fs";
|
|
41600
|
+
import { resolve as resolve38, extname as extname8, join as join24, dirname as dirname26 } from "node:path";
|
|
41394
41601
|
import { createServer as createServer2 } from "node:http";
|
|
41395
41602
|
import { WebSocketServer as WebSocketServer2 } from "ws";
|
|
41396
41603
|
|
|
@@ -41986,8 +42193,9 @@ function emitNode2(ctx2, node, tracked2, effectsVar, parentVar, compPrefix = "__
|
|
|
41986
42193
|
if (ctx2.hydrate) {
|
|
41987
42194
|
ctx2.push(`if (props.children !== undefined && props.children !== null) {`);
|
|
41988
42195
|
ctx2.push(` if (typeof props.children === 'function') {`);
|
|
41989
|
-
ctx2.push(` const
|
|
41990
|
-
ctx2.push(`
|
|
42196
|
+
ctx2.push(` const __slot = createLayoutSlot(${ctx2.walker}, ${parentVar});`);
|
|
42197
|
+
ctx2.push(` const __child = props.children(__slot.walker);`);
|
|
42198
|
+
ctx2.push(` if (__child && typeof __child.then === 'function') __pendingChild = __slot.track(__child);`);
|
|
41991
42199
|
ctx2.push(` } else {`);
|
|
41992
42200
|
ctx2.push(` ${parentVar}.appendChild(props.children);`);
|
|
41993
42201
|
ctx2.push(` }`);
|
|
@@ -42085,7 +42293,58 @@ function emitStatic2(ctx2, node, tracked2, effectsVar) {
|
|
|
42085
42293
|
let residueBefore = 0;
|
|
42086
42294
|
for (const child of children) {
|
|
42087
42295
|
let childVar;
|
|
42088
|
-
|
|
42296
|
+
const isPureStaticChild = ctx2.hydrate && child instanceof StaticNode && isStaticIR2(child.children);
|
|
42297
|
+
if (isPureStaticChild) {
|
|
42298
|
+
const ssrEl = `${el}.__vsk_ssrEls[${residueBefore}]`;
|
|
42299
|
+
childVar = ssrEl;
|
|
42300
|
+
const dynAttrs2 = [];
|
|
42301
|
+
const staticChildren = [];
|
|
42302
|
+
for (const c of child.children) {
|
|
42303
|
+
if (c instanceof DynamicBinding && c.kind === "attribute") {
|
|
42304
|
+
dynAttrs2.push(c);
|
|
42305
|
+
} else {
|
|
42306
|
+
staticChildren.push(c);
|
|
42307
|
+
}
|
|
42308
|
+
}
|
|
42309
|
+
for (const attr of dynAttrs2) {
|
|
42310
|
+
const target = attr.target || "";
|
|
42311
|
+
const isEvent2 = target.startsWith("on") && target.length > 2;
|
|
42312
|
+
if (target === "ref") {
|
|
42313
|
+
const expr = transformTracked2(attr.expression, tracked2);
|
|
42314
|
+
ctx2.push(`(${expr})(${ssrEl});`);
|
|
42315
|
+
} else if (isEvent2) {
|
|
42316
|
+
const eventName = target.slice(2).toLowerCase();
|
|
42317
|
+
const handler = transformTracked2(attr.expression, tracked2);
|
|
42318
|
+
if (NON_BUBBLING_EVENTS2.has(eventName)) {
|
|
42319
|
+
ctx2.directEvents.add(eventName);
|
|
42320
|
+
ctx2.push(`${ssrEl}.addEventListener(${JSON.stringify(eventName)}, ${handler});`);
|
|
42321
|
+
} else {
|
|
42322
|
+
const prop = `__evh_${eventName}`;
|
|
42323
|
+
ctx2.delegatedEvents.add(eventName);
|
|
42324
|
+
ctx2.push(`${ssrEl}.${prop} = ${handler};`);
|
|
42325
|
+
}
|
|
42326
|
+
ctx2.push(`${ssrEl}.setAttribute('data-vsk-ev', '');`);
|
|
42327
|
+
} else if (target === "style") {
|
|
42328
|
+
const expr = transformTracked2(attr.expression, tracked2);
|
|
42329
|
+
const eff = `effect(() => { applyStyle(${ssrEl}, ${expr}); })`;
|
|
42330
|
+
if (effectsVar) {
|
|
42331
|
+
ctx2.push(`${effectsVar}.push(${eff});`);
|
|
42332
|
+
} else {
|
|
42333
|
+
ctx2.effects.push(`${eff};`);
|
|
42334
|
+
}
|
|
42335
|
+
} else {
|
|
42336
|
+
const expr = transformTracked2(attr.expression, tracked2);
|
|
42337
|
+
const useProp = PROPERTY_ATTRS2[node.tag]?.has(target);
|
|
42338
|
+
const eff = useProp ? `effect(() => { ${ssrEl}.${target} = ${expr}; })` : `effect(() => { const __v = ${expr}; if (__v != null && __v !== false) ${ssrEl}.setAttribute(${JSON.stringify(target)}, __v === true ? 'true' : String(__v)); })`;
|
|
42339
|
+
if (effectsVar) {
|
|
42340
|
+
ctx2.push(`${effectsVar}.push(${eff});`);
|
|
42341
|
+
} else {
|
|
42342
|
+
ctx2.effects.push(`${eff};`);
|
|
42343
|
+
}
|
|
42344
|
+
}
|
|
42345
|
+
}
|
|
42346
|
+
childVar = ssrEl;
|
|
42347
|
+
} else if (singleReactiveText && child instanceof DynamicBinding && child.kind === "text") {
|
|
42089
42348
|
childVar = emitDynamicBinding2(ctx2, child, tracked2, effectsVar, `${el}.__vsk_ssrText`);
|
|
42090
42349
|
} else {
|
|
42091
42350
|
childVar = emitNode2(ctx2, child, tracked2, effectsVar, el);
|
|
@@ -43564,7 +43823,7 @@ function emitClientFromIR2(ir, options) {
|
|
|
43564
43823
|
if (options.hydrate && ir.components.some((c) => hasKeyedMap2(c.body)))
|
|
43565
43824
|
runtimeNames.push("reconcileHydrated");
|
|
43566
43825
|
if (options.hydrate) {
|
|
43567
|
-
const hydrateNames = ["hydrate", "hydrateViewport", "hydrateIdle", "hydrateOnInteraction", "needsHydration", "createHydrateWalker", "collectVskMarkers", "reactiveProps"];
|
|
43826
|
+
const hydrateNames = ["hydrate", "hydrateViewport", "hydrateIdle", "hydrateOnInteraction", "needsHydration", "createHydrateWalker", "collectVskMarkers", "reactiveProps", "createLayoutSlot"];
|
|
43568
43827
|
for (const name of hydrateNames) {
|
|
43569
43828
|
if (!runtimeNames.includes(name))
|
|
43570
43829
|
runtimeNames.push(name);
|
|
@@ -43600,6 +43859,32 @@ function compileClient2(source, _componentName, options = {}) {
|
|
|
43600
43859
|
const ir = generateIR(ast, source, options.sourcePath);
|
|
43601
43860
|
return emitClientFromIR2(ir, { ...options, nameAllocator: options.nameAllocator ?? nameAllocFor2(options.sourcePath) });
|
|
43602
43861
|
}
|
|
43862
|
+
function compileClientBoth2(source, _componentName, sourcePath2, opts) {
|
|
43863
|
+
const ast = parse4(source, sourcePath2 ? { filename: sourcePath2 } : {});
|
|
43864
|
+
const hydAst = opts?.skipHyd ? null : structuredClone(ast);
|
|
43865
|
+
const ir = generateIR(ast, source, sourcePath2);
|
|
43866
|
+
const irHyd = opts?.skipHyd ? null : generateIR(hydAst, source, sourcePath2);
|
|
43867
|
+
const defaultComp = ir.components.find((c) => c.defaultExport);
|
|
43868
|
+
let name = null;
|
|
43869
|
+
if (defaultComp)
|
|
43870
|
+
name = defaultComp.name;
|
|
43871
|
+
else if (ir.components.length > 0)
|
|
43872
|
+
name = ir.components[0].name;
|
|
43873
|
+
else {
|
|
43874
|
+
const exportedComp = ir.components.find((c) => c.exported);
|
|
43875
|
+
if (exportedComp)
|
|
43876
|
+
name = exportedComp.name;
|
|
43877
|
+
}
|
|
43878
|
+
const alloc = nameAllocFor2(sourcePath2);
|
|
43879
|
+
const comp = emitClientFromIR2(ir, { forceClient: true, nameAllocator: alloc });
|
|
43880
|
+
if (opts?.skipHyd)
|
|
43881
|
+
return { comp, hyd: "", name };
|
|
43882
|
+
return {
|
|
43883
|
+
comp,
|
|
43884
|
+
hyd: emitClientFromIR2(irHyd, { forceClient: true, hydrate: true, includeTopLevel: false, nameAllocator: alloc }),
|
|
43885
|
+
name
|
|
43886
|
+
};
|
|
43887
|
+
}
|
|
43603
43888
|
|
|
43604
43889
|
// ../compiler/dist/router.js
|
|
43605
43890
|
init_parser();
|
|
@@ -44630,9 +44915,115 @@ async function runEventHandlers(handlers, name, ctx2) {
|
|
|
44630
44915
|
await fn(ctx2);
|
|
44631
44916
|
}
|
|
44632
44917
|
|
|
44918
|
+
// ../compiler/dist/md-inline.js
|
|
44919
|
+
import { readFileSync as readFileSync23, existsSync as existsSync27 } from "node:fs";
|
|
44920
|
+
import { dirname as dirname17, join as join17, resolve as resolve23 } from "node:path";
|
|
44921
|
+
var MD_EXT_MARKER2 = ".md";
|
|
44922
|
+
function looksLikeMarkdownPath2(value) {
|
|
44923
|
+
const v = value.trim();
|
|
44924
|
+
if (v.length === 0 || v.length > 4096)
|
|
44925
|
+
return false;
|
|
44926
|
+
if (v.includes("\n") || v.includes("\r"))
|
|
44927
|
+
return false;
|
|
44928
|
+
const lower = v.toLowerCase();
|
|
44929
|
+
return lower.endsWith(MD_EXT_MARKER2) || lower.endsWith(".markdown");
|
|
44930
|
+
}
|
|
44931
|
+
function isRelativeSpecifier2(v) {
|
|
44932
|
+
return v.startsWith("./") || v.startsWith("../");
|
|
44933
|
+
}
|
|
44934
|
+
function inlineMdContentAttrs2(source, importerDir, mdRoots = []) {
|
|
44935
|
+
if (!source.includes("content=") && !source.includes("content ="))
|
|
44936
|
+
return source;
|
|
44937
|
+
if (!importerDir && mdRoots.length === 0)
|
|
44938
|
+
return source;
|
|
44939
|
+
let out = "";
|
|
44940
|
+
let i = 0;
|
|
44941
|
+
const n = source.length;
|
|
44942
|
+
let counter = 0;
|
|
44943
|
+
const decls = [];
|
|
44944
|
+
const prefix = "content=";
|
|
44945
|
+
while (i < n) {
|
|
44946
|
+
if (source.startsWith(prefix, i)) {
|
|
44947
|
+
const prev = i > 0 ? source[i - 1] : " ";
|
|
44948
|
+
if (prev === " " || prev === " " || prev === "\n" || prev === "\r") {
|
|
44949
|
+
let j = i + prefix.length;
|
|
44950
|
+
const quote = source[j];
|
|
44951
|
+
if (quote === '"' || quote === "'") {
|
|
44952
|
+
j++;
|
|
44953
|
+
const valStart = j;
|
|
44954
|
+
while (j < n && source[j] !== quote)
|
|
44955
|
+
j++;
|
|
44956
|
+
if (j < n) {
|
|
44957
|
+
const value = source.slice(valStart, j);
|
|
44958
|
+
if (looksLikeMarkdownPath2(value)) {
|
|
44959
|
+
const abs = resolveMdPath2(value, importerDir, mdRoots);
|
|
44960
|
+
if (abs !== null) {
|
|
44961
|
+
let contents;
|
|
44962
|
+
try {
|
|
44963
|
+
contents = readFileSync23(abs, "utf-8");
|
|
44964
|
+
} catch {
|
|
44965
|
+
out += source[i];
|
|
44966
|
+
i++;
|
|
44967
|
+
continue;
|
|
44968
|
+
}
|
|
44969
|
+
const varName = `__vesk_md_${counter++}`;
|
|
44970
|
+
decls.push(`const ${varName} = ${JSON.stringify(contents)};`);
|
|
44971
|
+
out += `${prefix}{${varName}}`;
|
|
44972
|
+
i = j + 1;
|
|
44973
|
+
continue;
|
|
44974
|
+
}
|
|
44975
|
+
}
|
|
44976
|
+
}
|
|
44977
|
+
}
|
|
44978
|
+
}
|
|
44979
|
+
}
|
|
44980
|
+
out += source[i];
|
|
44981
|
+
i++;
|
|
44982
|
+
}
|
|
44983
|
+
if (decls.length === 0)
|
|
44984
|
+
return source;
|
|
44985
|
+
return decls.join("\n") + "\n" + out;
|
|
44986
|
+
}
|
|
44987
|
+
function resolveMdPath2(specifier, importerDir, roots) {
|
|
44988
|
+
const spec = specifier.trim();
|
|
44989
|
+
if (isRelativeSpecifier2(spec)) {
|
|
44990
|
+
if (!importerDir)
|
|
44991
|
+
return null;
|
|
44992
|
+
const abs = resolve23(importerDir, spec);
|
|
44993
|
+
return existsSync27(abs) ? abs : null;
|
|
44994
|
+
}
|
|
44995
|
+
if (spec.startsWith("/")) {
|
|
44996
|
+
for (const root3 of roots) {
|
|
44997
|
+
const pub = join17(root3, "public", spec);
|
|
44998
|
+
if (existsSync27(pub))
|
|
44999
|
+
return pub;
|
|
45000
|
+
const direct = join17(root3, spec);
|
|
45001
|
+
if (existsSync27(direct))
|
|
45002
|
+
return direct;
|
|
45003
|
+
}
|
|
45004
|
+
}
|
|
45005
|
+
return null;
|
|
45006
|
+
}
|
|
45007
|
+
function guessProjectRoots2(dir) {
|
|
45008
|
+
if (!dir)
|
|
45009
|
+
return [];
|
|
45010
|
+
const roots = [];
|
|
45011
|
+
let cur = dir;
|
|
45012
|
+
for (let i = 0; i < 6; i++) {
|
|
45013
|
+
roots.push(cur);
|
|
45014
|
+
if (existsSync27(join17(cur, "package.json")))
|
|
45015
|
+
break;
|
|
45016
|
+
const parent = dirname17(cur);
|
|
45017
|
+
if (parent === cur)
|
|
45018
|
+
break;
|
|
45019
|
+
cur = parent;
|
|
45020
|
+
}
|
|
45021
|
+
return roots;
|
|
45022
|
+
}
|
|
45023
|
+
|
|
44633
45024
|
// ../adapter/dist/client-bundle.js
|
|
44634
|
-
import { readFileSync as
|
|
44635
|
-
import { resolve as
|
|
45025
|
+
import { readFileSync as readFileSync24, existsSync as existsSync28, writeFileSync as writeFileSync13, unlinkSync as unlinkSync4, statSync as statSync14, rmSync as rmSync4, mkdtempSync as mkdtempSync2 } from "node:fs";
|
|
45026
|
+
import { resolve as resolve24, join as join18, dirname as dirname18, relative as relative6, sep as sep3 } from "node:path";
|
|
44636
45027
|
import { fileURLToPath as fileURLToPath6 } from "node:url";
|
|
44637
45028
|
|
|
44638
45029
|
// ../adapter/dist/esbuild-fallback.js
|
|
@@ -44689,7 +45080,7 @@ init_client_codegen();
|
|
|
44689
45080
|
init_vsk_imports();
|
|
44690
45081
|
init_md_inline();
|
|
44691
45082
|
init_module_imports();
|
|
44692
|
-
var __dirname7 =
|
|
45083
|
+
var __dirname7 = dirname18(fileURLToPath6(import.meta.url));
|
|
44693
45084
|
function fileUnchanged2(filePath, cached) {
|
|
44694
45085
|
try {
|
|
44695
45086
|
const st = statSync14(filePath);
|
|
@@ -44706,15 +45097,15 @@ function buildRouterOpts2(options) {
|
|
|
44706
45097
|
return "";
|
|
44707
45098
|
}
|
|
44708
45099
|
function findRuntimeSrc3(appDir) {
|
|
44709
|
-
const monorepoRoot =
|
|
45100
|
+
const monorepoRoot = resolve24(__dirname7, "..", "..", "..");
|
|
44710
45101
|
const candidates = [
|
|
44711
|
-
|
|
44712
|
-
|
|
44713
|
-
|
|
45102
|
+
resolve24(monorepoRoot, "packages", "runtime", "dist"),
|
|
45103
|
+
resolve24(appDir, "..", "node_modules", "@vesk/runtime"),
|
|
45104
|
+
resolve24(appDir, "node_modules", "@vesk/runtime")
|
|
44714
45105
|
];
|
|
44715
45106
|
for (const base of candidates) {
|
|
44716
|
-
for (const dir of [base,
|
|
44717
|
-
if (
|
|
45107
|
+
for (const dir of [base, join18(base, "dist")]) {
|
|
45108
|
+
if (existsSync28(join18(dir, "index-client.js")))
|
|
44718
45109
|
return dir;
|
|
44719
45110
|
}
|
|
44720
45111
|
}
|
|
@@ -44781,6 +45172,11 @@ function isComponentExport2(node) {
|
|
|
44781
45172
|
}
|
|
44782
45173
|
return false;
|
|
44783
45174
|
}
|
|
45175
|
+
function isSnippetDrop2(node) {
|
|
45176
|
+
if (isAnyImport2(node) || isComponentExport2(node) || isRuntimePreamble2(node))
|
|
45177
|
+
return true;
|
|
45178
|
+
return node.type === "VariableDeclaration" && (node.declarations?.[0]?.id?.name === "__components" || node.declarations?.[0]?.id?.name === "__hydrators");
|
|
45179
|
+
}
|
|
44784
45180
|
function extractCompiledNodes2(code, isTarget) {
|
|
44785
45181
|
let ast;
|
|
44786
45182
|
try {
|
|
@@ -44863,7 +45259,7 @@ var ChunkImports2 = class {
|
|
|
44863
45259
|
const src2 = node.source?.value;
|
|
44864
45260
|
if (typeof src2 !== "string")
|
|
44865
45261
|
continue;
|
|
44866
|
-
const resolved = resolveImportPath(src2,
|
|
45262
|
+
const resolved = resolveImportPath(src2, dirname18(filePath));
|
|
44867
45263
|
for (const spec of node.specifiers ?? []) {
|
|
44868
45264
|
const s = spec;
|
|
44869
45265
|
const local = s.local?.name;
|
|
@@ -44989,13 +45385,48 @@ function scopeFileContribution2(code) {
|
|
|
44989
45385
|
return code;
|
|
44990
45386
|
}
|
|
44991
45387
|
}
|
|
45388
|
+
function stripAndDemoteInOnePass2(code) {
|
|
45389
|
+
let ast;
|
|
45390
|
+
try {
|
|
45391
|
+
ast = parse4(code);
|
|
45392
|
+
} catch {
|
|
45393
|
+
return code;
|
|
45394
|
+
}
|
|
45395
|
+
const body = ast.body ?? [];
|
|
45396
|
+
const edits = [];
|
|
45397
|
+
for (const raw2 of body) {
|
|
45398
|
+
const node = raw2;
|
|
45399
|
+
if (typeof node.start !== "number" || typeof node.end !== "number")
|
|
45400
|
+
continue;
|
|
45401
|
+
const isExport = node.type === "ExportNamedDeclaration" || node.type === "ExportDefaultDeclaration";
|
|
45402
|
+
if (isSnippetDrop2(node)) {
|
|
45403
|
+
let cut = node.end;
|
|
45404
|
+
if (code[cut] === ";")
|
|
45405
|
+
cut++;
|
|
45406
|
+
if (code.startsWith("\r\n", cut))
|
|
45407
|
+
cut += 2;
|
|
45408
|
+
else if (code[cut] === "\n" || code[cut] === "\r")
|
|
45409
|
+
cut++;
|
|
45410
|
+
edits.push({ start: node.start, end: cut });
|
|
45411
|
+
} else if (isExport && node.type === "ExportNamedDeclaration" && node.declaration && typeof node.declaration.start === "number" && typeof node.declaration.end === "number") {
|
|
45412
|
+
edits.push({ start: node.start, end: node.end, text: code.slice(node.declaration.start, node.declaration.end) });
|
|
45413
|
+
} else if (isExport) {
|
|
45414
|
+
let cut = node.end;
|
|
45415
|
+
if (code[cut] === ";")
|
|
45416
|
+
cut++;
|
|
45417
|
+
edits.push({ start: node.start, end: cut });
|
|
45418
|
+
}
|
|
45419
|
+
}
|
|
45420
|
+
if (edits.length === 0)
|
|
45421
|
+
return code;
|
|
45422
|
+
edits.sort((a, b) => b.start - a.start);
|
|
45423
|
+
for (const e of edits) {
|
|
45424
|
+
code = code.slice(0, e.start) + (e.text ?? "") + code.slice(e.end);
|
|
45425
|
+
}
|
|
45426
|
+
return code;
|
|
45427
|
+
}
|
|
44992
45428
|
function buildHmrEvalSnippet2(code) {
|
|
44993
|
-
const
|
|
44994
|
-
if (isAnyImport2(node) || isComponentExport2(node) || isRuntimePreamble2(node))
|
|
44995
|
-
return true;
|
|
44996
|
-
return node.type === "VariableDeclaration" && (node.declarations?.[0]?.id?.name === "__components" || node.declarations?.[0]?.id?.name === "__hydrators");
|
|
44997
|
-
};
|
|
44998
|
-
const body = demoteExports2(removeCompiledNodes2(code, isSnippetDrop)).trim();
|
|
45429
|
+
const body = stripAndDemoteInOnePass2(code).trim();
|
|
44999
45430
|
if (!body)
|
|
45000
45431
|
return "";
|
|
45001
45432
|
const scoped = `{
|
|
@@ -45064,11 +45495,11 @@ async function generateClientBundle2(routeTree, appDir, componentMap, options) {
|
|
|
45064
45495
|
return removeCompiledNodes2(code, isVskImport2);
|
|
45065
45496
|
}
|
|
45066
45497
|
function resolveVskImports(filePath, compile) {
|
|
45067
|
-
const src2 =
|
|
45498
|
+
const src2 = readFileSync24(filePath, "utf-8");
|
|
45068
45499
|
const resolved = [];
|
|
45069
45500
|
for (const importPath of collectVskImportPaths(vskImportLines(src2), filePath)) {
|
|
45070
45501
|
try {
|
|
45071
|
-
|
|
45502
|
+
readFileSync24(importPath);
|
|
45072
45503
|
} catch {
|
|
45073
45504
|
continue;
|
|
45074
45505
|
}
|
|
@@ -45128,9 +45559,9 @@ async function generateClientBundle2(routeTree, appDir, componentMap, options) {
|
|
|
45128
45559
|
return;
|
|
45129
45560
|
}
|
|
45130
45561
|
compiledFiles++;
|
|
45131
|
-
let src2 =
|
|
45562
|
+
let src2 = readFileSync24(filePath, "utf-8");
|
|
45132
45563
|
if (/content=["'][^"']*\.md["']/i.test(src2)) {
|
|
45133
|
-
src2 = inlineMdContentAttrs(src2,
|
|
45564
|
+
src2 = inlineMdContentAttrs(src2, dirname18(filePath), guessProjectRoots(appDir));
|
|
45134
45565
|
}
|
|
45135
45566
|
const namesBefore = cache2 ? new Set(runtimeImportNames) : null;
|
|
45136
45567
|
const importedPaths = resolveVskImports(filePath, (p, n) => compileFile2(p, n, output, imports));
|
|
@@ -45201,32 +45632,32 @@ async function generateClientBundle2(routeTree, appDir, componentMap, options) {
|
|
|
45201
45632
|
seen = /* @__PURE__ */ new Set();
|
|
45202
45633
|
const chunkCode = [];
|
|
45203
45634
|
const chunkImports = new ChunkImports2();
|
|
45204
|
-
const pagePath =
|
|
45205
|
-
if (node.page &&
|
|
45635
|
+
const pagePath = resolve24(appDir, node.sourceDir, "page.vsk");
|
|
45636
|
+
if (node.page && existsSync28(pagePath)) {
|
|
45206
45637
|
compileFile2(pagePath, node.page, chunkCode, chunkImports);
|
|
45207
45638
|
}
|
|
45208
|
-
const layoutPath =
|
|
45209
|
-
if (node.layout &&
|
|
45639
|
+
const layoutPath = resolve24(appDir, node.sourceDir, "layout.vsk");
|
|
45640
|
+
if (node.layout && existsSync28(layoutPath)) {
|
|
45210
45641
|
compileFile2(layoutPath, node.layout, chunkCode, chunkImports);
|
|
45211
45642
|
}
|
|
45212
|
-
const errorPath =
|
|
45213
|
-
if (node.error &&
|
|
45643
|
+
const errorPath = resolve24(appDir, node.sourceDir, "error.vsk");
|
|
45644
|
+
if (node.error && existsSync28(errorPath)) {
|
|
45214
45645
|
compileFile2(errorPath, node.error, chunkCode, chunkImports);
|
|
45215
45646
|
}
|
|
45216
|
-
const notFoundPath =
|
|
45217
|
-
if (node.notFound &&
|
|
45647
|
+
const notFoundPath = resolve24(appDir, node.sourceDir, "not-found.vsk");
|
|
45648
|
+
if (node.notFound && existsSync28(notFoundPath)) {
|
|
45218
45649
|
compileFile2(notFoundPath, node.notFound, chunkCode, chunkImports);
|
|
45219
45650
|
}
|
|
45220
|
-
const offlinePath =
|
|
45221
|
-
if (node.offline &&
|
|
45651
|
+
const offlinePath = resolve24(appDir, node.sourceDir, "offline.vsk");
|
|
45652
|
+
if (node.offline && existsSync28(offlinePath)) {
|
|
45222
45653
|
compileFile2(offlinePath, node.offline, chunkCode, chunkImports);
|
|
45223
45654
|
}
|
|
45224
|
-
const networkPath =
|
|
45225
|
-
if (node.network &&
|
|
45655
|
+
const networkPath = resolve24(appDir, node.sourceDir, "network.vsk");
|
|
45656
|
+
if (node.network && existsSync28(networkPath)) {
|
|
45226
45657
|
compileFile2(networkPath, node.network, chunkCode, chunkImports);
|
|
45227
45658
|
}
|
|
45228
|
-
const loadingPath =
|
|
45229
|
-
if (node.loading &&
|
|
45659
|
+
const loadingPath = resolve24(appDir, node.sourceDir, "loading.vsk");
|
|
45660
|
+
if (node.loading && existsSync28(loadingPath)) {
|
|
45230
45661
|
compileFile2(loadingPath, node.loading, chunkCode, chunkImports);
|
|
45231
45662
|
}
|
|
45232
45663
|
if (chunkCode.length > 0) {
|
|
@@ -45276,8 +45707,8 @@ ${body}
|
|
|
45276
45707
|
continue;
|
|
45277
45708
|
let finalCode;
|
|
45278
45709
|
if (entry.imports) {
|
|
45279
|
-
const tmpBase = mkdtempSync2(
|
|
45280
|
-
const tmpFile =
|
|
45710
|
+
const tmpBase = mkdtempSync2(join18(resolve24(appDir, ".."), "tmp-vesk-chunk-"));
|
|
45711
|
+
const tmpFile = join18(tmpBase, "entry.js");
|
|
45281
45712
|
const toBundle = `const __components = globalThis.__components || (globalThis.__components = {});
|
|
45282
45713
|
const __hydrators = globalThis.__hydrators || (globalThis.__hydrators = {});
|
|
45283
45714
|
${entry.code}
|
|
@@ -45333,7 +45764,7 @@ ${entry.code}
|
|
|
45333
45764
|
if (seen.has(filePath))
|
|
45334
45765
|
return;
|
|
45335
45766
|
seen.add(filePath);
|
|
45336
|
-
const src2 =
|
|
45767
|
+
const src2 = readFileSync24(filePath, "utf-8");
|
|
45337
45768
|
resolveVskImports(filePath, (p, n) => compileFileMono2(p, n || ""));
|
|
45338
45769
|
const monoAlloc = nameAllocFor(filePath);
|
|
45339
45770
|
const compCode = compileClient(src2, null, { forceClient: true, sourcePath: filePath, nameAllocator: monoAlloc });
|
|
@@ -45354,26 +45785,26 @@ ${entry.code}
|
|
|
45354
45785
|
}
|
|
45355
45786
|
}, walkMono2 = function(nodes) {
|
|
45356
45787
|
for (const node of nodes) {
|
|
45357
|
-
const pagePath =
|
|
45358
|
-
if (node.page &&
|
|
45788
|
+
const pagePath = resolve24(appDir, node.sourceDir, "page.vsk");
|
|
45789
|
+
if (node.page && existsSync28(pagePath))
|
|
45359
45790
|
compileFileMono2(pagePath, node.page);
|
|
45360
|
-
const layoutPath =
|
|
45361
|
-
if (node.layout &&
|
|
45791
|
+
const layoutPath = resolve24(appDir, node.sourceDir, "layout.vsk");
|
|
45792
|
+
if (node.layout && existsSync28(layoutPath))
|
|
45362
45793
|
compileFileMono2(layoutPath, node.layout);
|
|
45363
|
-
const errorPath =
|
|
45364
|
-
if (node.error &&
|
|
45794
|
+
const errorPath = resolve24(appDir, node.sourceDir, "error.vsk");
|
|
45795
|
+
if (node.error && existsSync28(errorPath))
|
|
45365
45796
|
compileFileMono2(errorPath, node.error);
|
|
45366
|
-
const notFoundPath =
|
|
45367
|
-
if (node.notFound &&
|
|
45797
|
+
const notFoundPath = resolve24(appDir, node.sourceDir, "not-found.vsk");
|
|
45798
|
+
if (node.notFound && existsSync28(notFoundPath))
|
|
45368
45799
|
compileFileMono2(notFoundPath, node.notFound);
|
|
45369
|
-
const offlinePath =
|
|
45370
|
-
if (node.offline &&
|
|
45800
|
+
const offlinePath = resolve24(appDir, node.sourceDir, "offline.vsk");
|
|
45801
|
+
if (node.offline && existsSync28(offlinePath))
|
|
45371
45802
|
compileFileMono2(offlinePath, node.offline);
|
|
45372
|
-
const networkPath =
|
|
45373
|
-
if (node.network &&
|
|
45803
|
+
const networkPath = resolve24(appDir, node.sourceDir, "network.vsk");
|
|
45804
|
+
if (node.network && existsSync28(networkPath))
|
|
45374
45805
|
compileFileMono2(networkPath, node.network);
|
|
45375
|
-
const loadingPath =
|
|
45376
|
-
if (node.loading &&
|
|
45806
|
+
const loadingPath = resolve24(appDir, node.sourceDir, "loading.vsk");
|
|
45807
|
+
if (node.loading && existsSync28(loadingPath))
|
|
45377
45808
|
compileFileMono2(loadingPath, node.loading);
|
|
45378
45809
|
walkMono2(node.children || []);
|
|
45379
45810
|
}
|
|
@@ -45423,9 +45854,9 @@ function buildRuntimeCode2(runtimeDir) {
|
|
|
45423
45854
|
];
|
|
45424
45855
|
let code = "";
|
|
45425
45856
|
for (const f of runtimeFiles) {
|
|
45426
|
-
const p =
|
|
45427
|
-
if (
|
|
45428
|
-
let src2 =
|
|
45857
|
+
const p = join18(runtimeDir, f);
|
|
45858
|
+
if (existsSync28(p)) {
|
|
45859
|
+
let src2 = readFileSync24(p, "utf-8");
|
|
45429
45860
|
src2 = stripTypes2(src2);
|
|
45430
45861
|
src2 = src2.replace(/^import\s+[\s\S]*?from\s+['"](?:\.\/.*?|@vesk\/runtime\/src\/.*?)['"];?\n?/gm, "");
|
|
45431
45862
|
src2 = src2.replace(/^import\s+['"](?:\.\/.*?|@vesk\/runtime\/src\/.*?)['"];?\n?/gm, "");
|
|
@@ -45437,7 +45868,7 @@ ${src2}
|
|
|
45437
45868
|
`;
|
|
45438
45869
|
}
|
|
45439
45870
|
}
|
|
45440
|
-
const indexSrc =
|
|
45871
|
+
const indexSrc = readFileSync24(join18(runtimeDir, "index-client.js"), "utf-8");
|
|
45441
45872
|
const exportNames = stripTypes2(indexSrc).match(/export\s*\{\s*([^}]+)\s*\}\s*from/g)?.flatMap((m) => m.replace(/export\s*\{\s*|\s*\}\s*from/g, "").split(",").map((s) => s.trim())) || [];
|
|
45442
45873
|
code += "// --- exports ---\n";
|
|
45443
45874
|
for (const name of [...new Set(exportNames)]) {
|
|
@@ -45448,7 +45879,7 @@ ${src2}
|
|
|
45448
45879
|
return code;
|
|
45449
45880
|
}
|
|
45450
45881
|
function runtimeExportNames2(runtimeDir) {
|
|
45451
|
-
const indexSrc =
|
|
45882
|
+
const indexSrc = readFileSync24(join18(runtimeDir, "index-client.js"), "utf-8");
|
|
45452
45883
|
const names = /* @__PURE__ */ new Set();
|
|
45453
45884
|
for (const m of indexSrc.matchAll(/export\s*\{([^}]+)\}\s*from/g)) {
|
|
45454
45885
|
for (const raw2 of m[1].split(",")) {
|
|
@@ -45468,7 +45899,7 @@ async function buildTreeShakenRuntime2(runtimeDir, usedNames) {
|
|
|
45468
45899
|
console.error(`vesk: runtime names not exported \u2014 ${missing.join(", ")}; falling back to full runtime`);
|
|
45469
45900
|
return buildRuntimeCode2(runtimeDir);
|
|
45470
45901
|
}
|
|
45471
|
-
const entry =
|
|
45902
|
+
const entry = join18(runtimeDir, RUNTIME_ENTRY2);
|
|
45472
45903
|
try {
|
|
45473
45904
|
try {
|
|
45474
45905
|
rmSync4(entry);
|
|
@@ -45605,18 +46036,18 @@ if (typeof document !== 'undefined') __router.start();
|
|
|
45605
46036
|
}
|
|
45606
46037
|
|
|
45607
46038
|
// ../adapter/dist/paths.js
|
|
45608
|
-
import { resolve as
|
|
45609
|
-
import { existsSync as
|
|
46039
|
+
import { resolve as resolve25, sep as sep4 } from "node:path";
|
|
46040
|
+
import { existsSync as existsSync29, statSync as statSync15, readFileSync as readFileSync25 } from "node:fs";
|
|
45610
46041
|
function resolveWithin2(baseDir, relPath) {
|
|
45611
|
-
const base =
|
|
45612
|
-
const target =
|
|
46042
|
+
const base = resolve25(baseDir);
|
|
46043
|
+
const target = resolve25(baseDir, relPath);
|
|
45613
46044
|
const prefix = base + sep4;
|
|
45614
46045
|
if (!target.startsWith(prefix))
|
|
45615
46046
|
return null;
|
|
45616
46047
|
return target;
|
|
45617
46048
|
}
|
|
45618
46049
|
function installMdReadHook2(publicDirs) {
|
|
45619
|
-
const dirs = publicDirs.map((d) =>
|
|
46050
|
+
const dirs = publicDirs.map((d) => resolve25(d));
|
|
45620
46051
|
globalThis.__vsk_md_read_file = (p) => {
|
|
45621
46052
|
for (const dir of dirs) {
|
|
45622
46053
|
try {
|
|
@@ -45629,8 +46060,8 @@ function installMdReadHook2(publicDirs) {
|
|
|
45629
46060
|
const lower = abs.toLowerCase();
|
|
45630
46061
|
if (!lower.endsWith(".md") && !lower.endsWith(".markdown"))
|
|
45631
46062
|
continue;
|
|
45632
|
-
if (
|
|
45633
|
-
return
|
|
46063
|
+
if (existsSync29(abs) && statSync15(abs).isFile())
|
|
46064
|
+
return readFileSync25(abs, "utf8");
|
|
45634
46065
|
} catch {
|
|
45635
46066
|
}
|
|
45636
46067
|
}
|
|
@@ -45697,13 +46128,13 @@ function urlAuthority3(url) {
|
|
|
45697
46128
|
}
|
|
45698
46129
|
|
|
45699
46130
|
// ../adapter/dist/dev-api.js
|
|
45700
|
-
import { readFileSync as
|
|
45701
|
-
import { resolve as
|
|
46131
|
+
import { readFileSync as readFileSync28, statSync as statSync17, existsSync as existsSync32, readdirSync as readdirSync9 } from "node:fs";
|
|
46132
|
+
import { resolve as resolve28 } from "node:path";
|
|
45702
46133
|
|
|
45703
46134
|
// ../adapter/dist/plugins.js
|
|
45704
46135
|
init_paths();
|
|
45705
|
-
import { readFileSync as
|
|
45706
|
-
import { resolve as
|
|
46136
|
+
import { readFileSync as readFileSync26, writeFileSync as writeFileSync14, existsSync as existsSync30, mkdirSync as mkdirSync11, statSync as statSync16 } from "node:fs";
|
|
46137
|
+
import { resolve as resolve26, dirname as dirname19, join as join19, extname as extname7, basename as basename5 } from "node:path";
|
|
45707
46138
|
import { createRequire as createRequire5 } from "node:module";
|
|
45708
46139
|
import { spawn as spawn2 } from "node:child_process";
|
|
45709
46140
|
var PLUGIN_STATE_FILENAME2 = "plugins.json";
|
|
@@ -45718,15 +46149,15 @@ function eqIgnoreCase2(a, b) {
|
|
|
45718
46149
|
return String(a || "").toLowerCase() === String(b || "").toLowerCase();
|
|
45719
46150
|
}
|
|
45720
46151
|
function stateFilePath2(veskDir) {
|
|
45721
|
-
return
|
|
46152
|
+
return resolve26(veskDir, PLUGIN_STATE_FILENAME2);
|
|
45722
46153
|
}
|
|
45723
46154
|
function readPluginState2(veskDir) {
|
|
45724
46155
|
const file = stateFilePath2(veskDir);
|
|
45725
|
-
if (!
|
|
46156
|
+
if (!existsSync30(file))
|
|
45726
46157
|
return defaultState2();
|
|
45727
46158
|
let raw2;
|
|
45728
46159
|
try {
|
|
45729
|
-
raw2 = JSON.parse(
|
|
46160
|
+
raw2 = JSON.parse(readFileSync26(file, "utf-8"));
|
|
45730
46161
|
} catch {
|
|
45731
46162
|
return defaultState2();
|
|
45732
46163
|
}
|
|
@@ -45744,13 +46175,13 @@ function readPluginState2(veskDir) {
|
|
|
45744
46175
|
}
|
|
45745
46176
|
function writePluginState2(veskDir, state) {
|
|
45746
46177
|
const file = stateFilePath2(veskDir);
|
|
45747
|
-
const dir =
|
|
45748
|
-
if (!
|
|
46178
|
+
const dir = dirname19(file);
|
|
46179
|
+
if (!existsSync30(dir))
|
|
45749
46180
|
mkdirSync11(dir, { recursive: true });
|
|
45750
46181
|
writeFileSync14(file, JSON.stringify(state, null, 2) + "\n", "utf-8");
|
|
45751
46182
|
}
|
|
45752
46183
|
function resolvePackage2(appDir, pkg) {
|
|
45753
|
-
const require3 = createRequire5(
|
|
46184
|
+
const require3 = createRequire5(resolve26(appDir, "package.json"));
|
|
45754
46185
|
let entryPath = null;
|
|
45755
46186
|
let pkgJsonPath = null;
|
|
45756
46187
|
let pkgJson = null;
|
|
@@ -45759,16 +46190,16 @@ function resolvePackage2(appDir, pkg) {
|
|
|
45759
46190
|
} catch {
|
|
45760
46191
|
try {
|
|
45761
46192
|
entryPath = require3.resolve(pkg);
|
|
45762
|
-
let cur =
|
|
46193
|
+
let cur = dirname19(entryPath);
|
|
45763
46194
|
const seen = /* @__PURE__ */ new Set();
|
|
45764
|
-
while (cur && cur !==
|
|
46195
|
+
while (cur && cur !== dirname19(cur) && !seen.has(cur)) {
|
|
45765
46196
|
seen.add(cur);
|
|
45766
|
-
const candidate =
|
|
45767
|
-
if (
|
|
46197
|
+
const candidate = join19(cur, "package.json");
|
|
46198
|
+
if (existsSync30(candidate)) {
|
|
45768
46199
|
pkgJsonPath = candidate;
|
|
45769
46200
|
break;
|
|
45770
46201
|
}
|
|
45771
|
-
const parent =
|
|
46202
|
+
const parent = dirname19(cur);
|
|
45772
46203
|
if (parent !== cur && basename5(cur) === "node_modules")
|
|
45773
46204
|
break;
|
|
45774
46205
|
cur = parent;
|
|
@@ -45776,15 +46207,15 @@ function resolvePackage2(appDir, pkg) {
|
|
|
45776
46207
|
} catch {
|
|
45777
46208
|
}
|
|
45778
46209
|
}
|
|
45779
|
-
if (pkgJsonPath &&
|
|
46210
|
+
if (pkgJsonPath && existsSync30(pkgJsonPath)) {
|
|
45780
46211
|
pkgJson = readJsonFile2(pkgJsonPath);
|
|
45781
46212
|
const main = pkgJson?.main || pkgJson?.module || "index.js";
|
|
45782
|
-
entryPath =
|
|
46213
|
+
entryPath = resolve26(dirname19(pkgJsonPath), main);
|
|
45783
46214
|
}
|
|
45784
46215
|
let localPath = localDir2(appDir, pkg);
|
|
45785
46216
|
if (!localPath) {
|
|
45786
46217
|
for (const sub of ["src/plugins", "plugins", "lib/plugins"]) {
|
|
45787
|
-
const candidate = localDir2(
|
|
46218
|
+
const candidate = localDir2(resolve26(appDir, sub), pkg);
|
|
45788
46219
|
if (candidate) {
|
|
45789
46220
|
localPath = candidate;
|
|
45790
46221
|
break;
|
|
@@ -45792,33 +46223,33 @@ function resolvePackage2(appDir, pkg) {
|
|
|
45792
46223
|
}
|
|
45793
46224
|
}
|
|
45794
46225
|
if (localPath) {
|
|
45795
|
-
const localJson =
|
|
46226
|
+
const localJson = join19(localPath, "package.json");
|
|
45796
46227
|
let json = null;
|
|
45797
|
-
if (
|
|
46228
|
+
if (existsSync30(localJson)) {
|
|
45798
46229
|
json = readJsonFile2(localJson);
|
|
45799
46230
|
}
|
|
45800
46231
|
return { installed: true, path: localPath, dir: localPath, packageJson: json ?? pkgJson };
|
|
45801
46232
|
}
|
|
45802
|
-
const installed2 = !!pkgJsonPath &&
|
|
45803
|
-
return { installed: installed2, path: entryPath, dir: installed2 ?
|
|
46233
|
+
const installed2 = !!pkgJsonPath && existsSync30(pkgJsonPath);
|
|
46234
|
+
return { installed: installed2, path: entryPath, dir: installed2 ? dirname19(pkgJsonPath) : null, packageJson: pkgJson };
|
|
45804
46235
|
}
|
|
45805
46236
|
function localDir2(base, pkg) {
|
|
45806
46237
|
if (pkg.startsWith("@")) {
|
|
45807
46238
|
const parts = pkg.split("/");
|
|
45808
|
-
const p2 =
|
|
45809
|
-
if (
|
|
46239
|
+
const p2 = resolve26(base, parts[0], parts[1] ?? "");
|
|
46240
|
+
if (existsSync30(p2))
|
|
45810
46241
|
return p2;
|
|
45811
46242
|
return null;
|
|
45812
46243
|
}
|
|
45813
|
-
const p =
|
|
45814
|
-
if (
|
|
46244
|
+
const p = resolve26(base, pkg);
|
|
46245
|
+
if (existsSync30(p))
|
|
45815
46246
|
return p;
|
|
45816
46247
|
return null;
|
|
45817
46248
|
}
|
|
45818
46249
|
function readJsonFile2(file) {
|
|
45819
46250
|
try {
|
|
45820
|
-
if (
|
|
45821
|
-
return JSON.parse(
|
|
46251
|
+
if (existsSync30(file))
|
|
46252
|
+
return JSON.parse(readFileSync26(file, "utf-8"));
|
|
45822
46253
|
} catch {
|
|
45823
46254
|
}
|
|
45824
46255
|
return null;
|
|
@@ -45864,7 +46295,7 @@ function repositoryToString2(r) {
|
|
|
45864
46295
|
function assemblePluginMeta2(probe) {
|
|
45865
46296
|
const pkgJson = probe.packageJson || {};
|
|
45866
46297
|
const dir = probe.dir;
|
|
45867
|
-
const meta = dir ? readJsonFile2(
|
|
46298
|
+
const meta = dir ? readJsonFile2(resolve26(dir, "vesk.meta.json")) : null;
|
|
45868
46299
|
const hasMeta = !!meta && Object.keys(meta).length > 0;
|
|
45869
46300
|
const m = meta || {};
|
|
45870
46301
|
const metaSource = hasMeta ? "vesk.meta.json" : probe.packageJson ? "package.json" : "none";
|
|
@@ -46101,12 +46532,12 @@ function findIconFile2(dir, meta) {
|
|
|
46101
46532
|
const explicit = str2(meta?.icon);
|
|
46102
46533
|
if (explicit) {
|
|
46103
46534
|
const p = resolveWithin(dir, explicit);
|
|
46104
|
-
if (p &&
|
|
46535
|
+
if (p && existsSync30(p) && statSync16(p).isFile())
|
|
46105
46536
|
return p;
|
|
46106
46537
|
}
|
|
46107
46538
|
for (const name of ["icon.png", "icon.ico"]) {
|
|
46108
|
-
const p =
|
|
46109
|
-
if (
|
|
46539
|
+
const p = resolve26(dir, name);
|
|
46540
|
+
if (existsSync30(p) && statSync16(p).isFile())
|
|
46110
46541
|
return p;
|
|
46111
46542
|
}
|
|
46112
46543
|
return null;
|
|
@@ -46116,7 +46547,7 @@ function findPluginIcon2(appDir, name) {
|
|
|
46116
46547
|
const dir = probe.dir;
|
|
46117
46548
|
if (!dir)
|
|
46118
46549
|
return null;
|
|
46119
|
-
const meta = readJsonFile2(
|
|
46550
|
+
const meta = readJsonFile2(resolve26(dir, "vesk.meta.json"));
|
|
46120
46551
|
const iconPath = findIconFile2(dir, meta);
|
|
46121
46552
|
if (!iconPath)
|
|
46122
46553
|
return null;
|
|
@@ -46191,7 +46622,7 @@ function resolveDtsPath2(probe, pkgJson) {
|
|
|
46191
46622
|
if (!rel)
|
|
46192
46623
|
continue;
|
|
46193
46624
|
const abs = resolveWithin(dir, rel);
|
|
46194
|
-
if (abs &&
|
|
46625
|
+
if (abs && existsSync30(abs) && statSync16(abs).isFile())
|
|
46195
46626
|
return abs;
|
|
46196
46627
|
}
|
|
46197
46628
|
return null;
|
|
@@ -46540,7 +46971,7 @@ function introspectPlugin2(appDir, name) {
|
|
|
46540
46971
|
const pkgName = str2(pkgJson.name) ?? name;
|
|
46541
46972
|
const exportsMap = flattenPackageExports2(pkgJson.exports);
|
|
46542
46973
|
const dtsPath = resolveDtsPath2(probe, pkgJson);
|
|
46543
|
-
const dtsExports = dtsPath ? parseDtsExports2(
|
|
46974
|
+
const dtsExports = dtsPath ? parseDtsExports2(readFileSync26(dtsPath, "utf-8")) : [];
|
|
46544
46975
|
return {
|
|
46545
46976
|
ok: true,
|
|
46546
46977
|
name: pkgName,
|
|
@@ -46678,16 +47109,16 @@ var __internals2 = {
|
|
|
46678
47109
|
};
|
|
46679
47110
|
|
|
46680
47111
|
// ../adapter/dist/dev-config.js
|
|
46681
|
-
import { existsSync as
|
|
47112
|
+
import { existsSync as existsSync31, readFileSync as readFileSync27, writeFileSync as writeFileSync15, mkdirSync as mkdirSync12, mkdtempSync as mkdtempSync3, rmSync as rmSync5 } from "node:fs";
|
|
46682
47113
|
import { tmpdir } from "node:os";
|
|
46683
|
-
import { resolve as
|
|
47114
|
+
import { resolve as resolve27, dirname as dirname20, join as join20 } from "node:path";
|
|
46684
47115
|
init_parser();
|
|
46685
47116
|
function findConfigFile2(projectDir) {
|
|
46686
|
-
const ts9 =
|
|
46687
|
-
if (
|
|
47117
|
+
const ts9 = resolve27(projectDir, "vesk.config.ts");
|
|
47118
|
+
if (existsSync31(ts9))
|
|
46688
47119
|
return { path: ts9, isTs: true };
|
|
46689
|
-
const js =
|
|
46690
|
-
if (
|
|
47120
|
+
const js = resolve27(projectDir, "vesk.config.js");
|
|
47121
|
+
if (existsSync31(js))
|
|
46691
47122
|
return { path: js, isTs: false };
|
|
46692
47123
|
return { path: null, isTs: false };
|
|
46693
47124
|
}
|
|
@@ -46708,9 +47139,9 @@ async function parseConfigSource(source, isTs, projectDir) {
|
|
|
46708
47139
|
js = `const { defineConfig, definePlugin, preset } = globalThis.__vesk_inject;
|
|
46709
47140
|
` + js;
|
|
46710
47141
|
}
|
|
46711
|
-
const base = projectDir ? (mkdirSync12(
|
|
46712
|
-
const dir = base ? mkdtempSync3(
|
|
46713
|
-
const tmpFile =
|
|
47142
|
+
const base = projectDir ? (mkdirSync12(join20(projectDir, ".vesk"), { recursive: true }), join20(projectDir, ".vesk")) : void 0;
|
|
47143
|
+
const dir = base ? mkdtempSync3(join20(base, "cfg-")) : mkdtempSync3(join20(tmpdir(), "vesk-cfg-"));
|
|
47144
|
+
const tmpFile = join20(dir, "config.mjs");
|
|
46714
47145
|
try {
|
|
46715
47146
|
writeFileSync15(tmpFile, js, "utf-8");
|
|
46716
47147
|
globalThis.__vesk_inject = {
|
|
@@ -46737,15 +47168,15 @@ async function readConfig2(projectDir) {
|
|
|
46737
47168
|
const { path, isTs } = findConfigFile2(projectDir);
|
|
46738
47169
|
if (!path)
|
|
46739
47170
|
return { path: null, exists: false, source: "", config: {} };
|
|
46740
|
-
const source =
|
|
47171
|
+
const source = readFileSync27(path, "utf-8");
|
|
46741
47172
|
const config = await parseConfigSource(source, isTs, projectDir);
|
|
46742
47173
|
return { path, exists: true, source, config };
|
|
46743
47174
|
}
|
|
46744
47175
|
async function writeConfigSource2(projectDir, source) {
|
|
46745
47176
|
const { path, isTs } = findConfigFile2(projectDir);
|
|
46746
|
-
const target = path ||
|
|
47177
|
+
const target = path || resolve27(projectDir, "vesk.config.ts");
|
|
46747
47178
|
await parseConfigSource(source, isTs, projectDir);
|
|
46748
|
-
mkdirSync12(
|
|
47179
|
+
mkdirSync12(dirname20(target), { recursive: true });
|
|
46749
47180
|
writeFileSync15(target, source, "utf-8");
|
|
46750
47181
|
const config = await parseConfigSource(source, isTs, projectDir);
|
|
46751
47182
|
return { path: target, exists: true, source, config };
|
|
@@ -47575,11 +48006,11 @@ export default defineConfig({
|
|
|
47575
48006
|
]
|
|
47576
48007
|
})
|
|
47577
48008
|
`;
|
|
47578
|
-
target =
|
|
48009
|
+
target = resolve27(projectDir, "vesk.config.ts");
|
|
47579
48010
|
await writeConfigSource2(projectDir, source);
|
|
47580
48011
|
return;
|
|
47581
48012
|
}
|
|
47582
|
-
source =
|
|
48013
|
+
source = readFileSync27(path, "utf-8");
|
|
47583
48014
|
const existingImport = findPluginImportAst(source, pkg);
|
|
47584
48015
|
let importName;
|
|
47585
48016
|
if (existingImport) {
|
|
@@ -47659,7 +48090,7 @@ async function removePluginFromConfig2(projectDir, pkg) {
|
|
|
47659
48090
|
const { path } = findConfigFile2(projectDir);
|
|
47660
48091
|
if (!path)
|
|
47661
48092
|
return false;
|
|
47662
|
-
let source =
|
|
48093
|
+
let source = readFileSync27(path, "utf-8");
|
|
47663
48094
|
const original = source;
|
|
47664
48095
|
const existingImport = findPluginImportAst(source, pkg);
|
|
47665
48096
|
let importName = existingImport ? existingImport.name : null;
|
|
@@ -47737,7 +48168,7 @@ function jsonStatus(status, data2) {
|
|
|
47737
48168
|
function createDevApiRouter2(opts) {
|
|
47738
48169
|
const veskDir = opts.veskDir;
|
|
47739
48170
|
const caps = new CapabilityTable2(opts.caps, opts.commandAllowlist);
|
|
47740
|
-
const projectDir = opts.projectDir ||
|
|
48171
|
+
const projectDir = opts.projectDir || resolve28(opts.appDir, "..");
|
|
47741
48172
|
const getState = opts.getHmrState || (() => ({ status: "up", lastCompileMs: null, error: null, hasError: false, componentCount: 0 }));
|
|
47742
48173
|
function denied2(cap) {
|
|
47743
48174
|
return jsonStatus(403, { error: `capability denied: ${cap}` });
|
|
@@ -47780,7 +48211,7 @@ function createDevApiRouter2(opts) {
|
|
|
47780
48211
|
return badRequest2("no vesk.config file to edit");
|
|
47781
48212
|
if (!isTs)
|
|
47782
48213
|
return badRequest2("single-key toggle edits only apply to vesk.config.ts (use the source editor for .js)");
|
|
47783
|
-
const patched = applyConfigToggle2(
|
|
48214
|
+
const patched = applyConfigToggle2(readFileSync28(path, "utf-8"), b.key, b.value);
|
|
47784
48215
|
if (patched === null)
|
|
47785
48216
|
return badRequest2("could not safely edit the config object; use the source editor");
|
|
47786
48217
|
const cfg = await writeConfigSource2(projectDir, patched);
|
|
@@ -47819,14 +48250,14 @@ function createDevApiRouter2(opts) {
|
|
|
47819
48250
|
const resolved = resolveWithin2(projectDir, target);
|
|
47820
48251
|
if (!resolved)
|
|
47821
48252
|
return jsonStatus(403, { error: "path escapes project root" });
|
|
47822
|
-
if (!
|
|
48253
|
+
if (!existsSync32(resolved))
|
|
47823
48254
|
return jsonStatus(404, { error: "not found" });
|
|
47824
48255
|
if (statSync17(resolved).isDirectory()) {
|
|
47825
48256
|
const entries = readdirSync9(resolved, { withFileTypes: true }).map((e) => e.name);
|
|
47826
48257
|
return jsonStatus(200, { ok: true, path: target, directory: true, entries });
|
|
47827
48258
|
}
|
|
47828
48259
|
if (statSync17(resolved).isFile()) {
|
|
47829
|
-
return jsonStatus(200, { ok: true, path: target, directory: false, content:
|
|
48260
|
+
return jsonStatus(200, { ok: true, path: target, directory: false, content: readFileSync28(resolved, "utf-8") });
|
|
47830
48261
|
}
|
|
47831
48262
|
return badRequest2("unsupported file type");
|
|
47832
48263
|
} catch (e) {
|
|
@@ -47962,7 +48393,7 @@ function createDevApiRouter2(opts) {
|
|
|
47962
48393
|
return {
|
|
47963
48394
|
status: 200,
|
|
47964
48395
|
headers: { "Content-Type": icon.mime, "Cache-Control": "private, max-age=60" },
|
|
47965
|
-
body:
|
|
48396
|
+
body: readFileSync28(icon.file).toString("base64"),
|
|
47966
48397
|
encoding: "base64"
|
|
47967
48398
|
};
|
|
47968
48399
|
}
|
|
@@ -48019,8 +48450,8 @@ function produceDiagnostics(input) {
|
|
|
48019
48450
|
}
|
|
48020
48451
|
|
|
48021
48452
|
// ../agentic/dist/checkpoints.js
|
|
48022
|
-
import { existsSync as
|
|
48023
|
-
import { join as
|
|
48453
|
+
import { existsSync as existsSync33, mkdirSync as mkdirSync13, readFileSync as readFileSync29, writeFileSync as writeFileSync16, statSync as statSync18, unlinkSync as unlinkSync5, rmSync as rmSync6, renameSync } from "node:fs";
|
|
48454
|
+
import { join as join21, resolve as resolve29, dirname as dirname21, sep as sep5 } from "node:path";
|
|
48024
48455
|
import { randomUUID as nodeRandomUUID } from "node:crypto";
|
|
48025
48456
|
function generateId() {
|
|
48026
48457
|
try {
|
|
@@ -48153,25 +48584,25 @@ var CheckpointManager = class {
|
|
|
48153
48584
|
}
|
|
48154
48585
|
};
|
|
48155
48586
|
function getAgenticDir(projectDir) {
|
|
48156
|
-
return
|
|
48587
|
+
return join21(resolve29(projectDir), ".vesk", "agentic");
|
|
48157
48588
|
}
|
|
48158
48589
|
function getHistoryPath(projectDir) {
|
|
48159
|
-
return
|
|
48590
|
+
return join21(getAgenticDir(projectDir), "history.json");
|
|
48160
48591
|
}
|
|
48161
48592
|
function getCheckpointDir(projectDir, id) {
|
|
48162
|
-
return
|
|
48593
|
+
return join21(getAgenticDir(projectDir), "checkpoints", id);
|
|
48163
48594
|
}
|
|
48164
48595
|
function getCheckpointPath(projectDir, id) {
|
|
48165
|
-
return
|
|
48596
|
+
return join21(getCheckpointDir(projectDir, id), "checkpoint.json");
|
|
48166
48597
|
}
|
|
48167
48598
|
function ensureDir(dir) {
|
|
48168
48599
|
mkdirSync13(dir, { recursive: true });
|
|
48169
48600
|
}
|
|
48170
48601
|
function readJson(filePath, fallback) {
|
|
48171
48602
|
try {
|
|
48172
|
-
if (!
|
|
48603
|
+
if (!existsSync33(filePath))
|
|
48173
48604
|
return fallback;
|
|
48174
|
-
const raw2 =
|
|
48605
|
+
const raw2 = readFileSync29(filePath, "utf-8");
|
|
48175
48606
|
if (raw2.trim() === "")
|
|
48176
48607
|
return fallback;
|
|
48177
48608
|
return JSON.parse(raw2);
|
|
@@ -48180,7 +48611,7 @@ function readJson(filePath, fallback) {
|
|
|
48180
48611
|
}
|
|
48181
48612
|
}
|
|
48182
48613
|
function writeJsonAtomic(filePath, data2) {
|
|
48183
|
-
ensureDir(
|
|
48614
|
+
ensureDir(dirname21(filePath));
|
|
48184
48615
|
const tmp = `${filePath}.tmp`;
|
|
48185
48616
|
writeFileSync16(tmp, JSON.stringify(data2, null, 2), "utf-8");
|
|
48186
48617
|
try {
|
|
@@ -48242,7 +48673,7 @@ function createCheckpoint(projectDir, message, changes = {}, buildResult) {
|
|
|
48242
48673
|
};
|
|
48243
48674
|
const agenticDir = getAgenticDir(projectDir);
|
|
48244
48675
|
ensureDir(agenticDir);
|
|
48245
|
-
ensureDir(
|
|
48676
|
+
ensureDir(join21(agenticDir, "checkpoints"));
|
|
48246
48677
|
const cpDir = getCheckpointDir(projectDir, id);
|
|
48247
48678
|
ensureDir(cpDir);
|
|
48248
48679
|
writeJsonAtomic(getCheckpointPath(projectDir, id), checkpoint);
|
|
@@ -48263,14 +48694,14 @@ function rollback(projectDir, id) {
|
|
|
48263
48694
|
const cp = getCheckpoint(projectDir, id);
|
|
48264
48695
|
if (!cp)
|
|
48265
48696
|
return null;
|
|
48266
|
-
const projectRoot =
|
|
48697
|
+
const projectRoot = resolve29(projectDir);
|
|
48267
48698
|
for (const f of cp.files) {
|
|
48268
48699
|
if (!f.path || !f.path.trim())
|
|
48269
48700
|
continue;
|
|
48270
|
-
const abs =
|
|
48701
|
+
const abs = resolve29(projectRoot, f.path);
|
|
48271
48702
|
if (f.before === null) {
|
|
48272
48703
|
try {
|
|
48273
|
-
if (
|
|
48704
|
+
if (existsSync33(abs)) {
|
|
48274
48705
|
const s = statSync18(abs);
|
|
48275
48706
|
if (s.isDirectory())
|
|
48276
48707
|
rmSync6(abs, { recursive: true, force: true });
|
|
@@ -48281,7 +48712,7 @@ function rollback(projectDir, id) {
|
|
|
48281
48712
|
}
|
|
48282
48713
|
} else {
|
|
48283
48714
|
try {
|
|
48284
|
-
ensureDir(
|
|
48715
|
+
ensureDir(dirname21(abs));
|
|
48285
48716
|
writeFileSync16(abs, f.before, "utf-8");
|
|
48286
48717
|
} catch {
|
|
48287
48718
|
}
|
|
@@ -48291,8 +48722,8 @@ function rollback(projectDir, id) {
|
|
|
48291
48722
|
}
|
|
48292
48723
|
|
|
48293
48724
|
// ../agentic/dist/config.js
|
|
48294
|
-
import { readFileSync as
|
|
48295
|
-
import { resolve as
|
|
48725
|
+
import { readFileSync as readFileSync30, writeFileSync as writeFileSync17, existsSync as existsSync34, mkdirSync as mkdirSync14, chmodSync } from "node:fs";
|
|
48726
|
+
import { resolve as resolve30, dirname as dirname22 } from "node:path";
|
|
48296
48727
|
var DEFAULT_CONFIG = {
|
|
48297
48728
|
provider: "openai",
|
|
48298
48729
|
model: "",
|
|
@@ -48311,10 +48742,10 @@ var SUPPORTED_PROVIDERS = [
|
|
|
48311
48742
|
"custom"
|
|
48312
48743
|
];
|
|
48313
48744
|
function configPath(projectDir) {
|
|
48314
|
-
return
|
|
48745
|
+
return resolve30(projectDir, ".vesk", "agentic", "config.json");
|
|
48315
48746
|
}
|
|
48316
48747
|
function keysDir(projectDir) {
|
|
48317
|
-
return
|
|
48748
|
+
return resolve30(projectDir, ".vesk", "agentic", "keys");
|
|
48318
48749
|
}
|
|
48319
48750
|
function sanitizeProvider(provider) {
|
|
48320
48751
|
const p = provider.trim().toLowerCase();
|
|
@@ -48326,21 +48757,21 @@ function normalizeProvider(provider) {
|
|
|
48326
48757
|
return provider.trim().toLowerCase();
|
|
48327
48758
|
}
|
|
48328
48759
|
function providerKeyPath(projectDir, provider) {
|
|
48329
|
-
return
|
|
48760
|
+
return resolve30(keysDir(projectDir), `${sanitizeProvider(provider)}.key`);
|
|
48330
48761
|
}
|
|
48331
48762
|
function providerDotenvVar(provider) {
|
|
48332
48763
|
const prov = sanitizeProvider(provider);
|
|
48333
48764
|
return `VK_${prov.toUpperCase().replace(/[^A-Z0-9]/g, "_")}_KEY`;
|
|
48334
48765
|
}
|
|
48335
48766
|
function dotenvPath(projectDir) {
|
|
48336
|
-
return
|
|
48767
|
+
return resolve30(projectDir, ".env.local");
|
|
48337
48768
|
}
|
|
48338
48769
|
function readDotenvValue(projectDir, key, def = null) {
|
|
48339
48770
|
try {
|
|
48340
48771
|
const p = dotenvPath(projectDir);
|
|
48341
|
-
if (!
|
|
48772
|
+
if (!existsSync34(p))
|
|
48342
48773
|
return def;
|
|
48343
|
-
const content =
|
|
48774
|
+
const content = readFileSync30(p, "utf-8");
|
|
48344
48775
|
for (const rawLine of content.split("\n")) {
|
|
48345
48776
|
const line = rawLine.trim();
|
|
48346
48777
|
if (!line || line.startsWith("#"))
|
|
@@ -48367,8 +48798,8 @@ function writeDotenvValue(projectDir, key, value) {
|
|
|
48367
48798
|
try {
|
|
48368
48799
|
let out = "";
|
|
48369
48800
|
let replaced = false;
|
|
48370
|
-
if (
|
|
48371
|
-
const lines =
|
|
48801
|
+
if (existsSync34(p)) {
|
|
48802
|
+
const lines = readFileSync30(p, "utf-8").split("\n");
|
|
48372
48803
|
for (const rawLine of lines) {
|
|
48373
48804
|
const trimmed = rawLine.trim();
|
|
48374
48805
|
const eq = trimmed.indexOf("=");
|
|
@@ -48397,8 +48828,8 @@ function loadAgenticConfig(projectDir) {
|
|
|
48397
48828
|
const p = configPath(projectDir);
|
|
48398
48829
|
let cfg = { ...DEFAULT_CONFIG };
|
|
48399
48830
|
try {
|
|
48400
|
-
if (
|
|
48401
|
-
cfg = { ...cfg, ...JSON.parse(
|
|
48831
|
+
if (existsSync34(p))
|
|
48832
|
+
cfg = { ...cfg, ...JSON.parse(readFileSync30(p, "utf-8")) };
|
|
48402
48833
|
} catch {
|
|
48403
48834
|
}
|
|
48404
48835
|
let hasKey = false;
|
|
@@ -48421,7 +48852,7 @@ function saveAgenticConfig(projectDir, patch) {
|
|
|
48421
48852
|
if (next.baseUrl)
|
|
48422
48853
|
toWrite.baseUrl = next.baseUrl;
|
|
48423
48854
|
try {
|
|
48424
|
-
mkdirSync14(
|
|
48855
|
+
mkdirSync14(dirname22(p), { recursive: true });
|
|
48425
48856
|
writeFileSync17(p, JSON.stringify(toWrite, null, 2), "utf-8");
|
|
48426
48857
|
} catch {
|
|
48427
48858
|
}
|
|
@@ -48440,8 +48871,8 @@ function getProviderSpecificKey(projectDir, provider) {
|
|
|
48440
48871
|
return dotenvFile.trim();
|
|
48441
48872
|
try {
|
|
48442
48873
|
const pp2 = providerKeyPath(projectDir, prov);
|
|
48443
|
-
if (
|
|
48444
|
-
const v =
|
|
48874
|
+
if (existsSync34(pp2)) {
|
|
48875
|
+
const v = readFileSync30(pp2, "utf-8").trim();
|
|
48445
48876
|
if (v)
|
|
48446
48877
|
return v;
|
|
48447
48878
|
}
|
|
@@ -48488,8 +48919,8 @@ function getApiKey(projectDir, provider) {
|
|
|
48488
48919
|
}
|
|
48489
48920
|
try {
|
|
48490
48921
|
const pp2 = providerKeyPath(projectDir, prov);
|
|
48491
|
-
if (
|
|
48492
|
-
const v =
|
|
48922
|
+
if (existsSync34(pp2)) {
|
|
48923
|
+
const v = readFileSync30(pp2, "utf-8").trim();
|
|
48493
48924
|
if (v)
|
|
48494
48925
|
return v;
|
|
48495
48926
|
}
|
|
@@ -48512,8 +48943,8 @@ function getApiKey(projectDir, provider) {
|
|
|
48512
48943
|
}
|
|
48513
48944
|
|
|
48514
48945
|
// ../agentic/dist/dev-api.js
|
|
48515
|
-
import { existsSync as
|
|
48516
|
-
import { resolve as
|
|
48946
|
+
import { existsSync as existsSync35, readFileSync as readFileSync31 } from "node:fs";
|
|
48947
|
+
import { resolve as resolve31 } from "node:path";
|
|
48517
48948
|
|
|
48518
48949
|
// ../agentic/dist/providers/openai.js
|
|
48519
48950
|
var OPENAI_FALLBACK_MODELS = ["gpt-4o-mini", "gpt-4o", "gpt-3.5-turbo"];
|
|
@@ -48883,9 +49314,9 @@ function getPerProviderKeyRaw(projectDir, provider) {
|
|
|
48883
49314
|
} catch {
|
|
48884
49315
|
}
|
|
48885
49316
|
try {
|
|
48886
|
-
const p =
|
|
48887
|
-
if (
|
|
48888
|
-
const v =
|
|
49317
|
+
const p = resolve31(projectDir, ".vesk", "agentic", "keys", `${sanitizeProviderName(prov)}.key`);
|
|
49318
|
+
if (existsSync35(p)) {
|
|
49319
|
+
const v = readFileSync31(p, "utf-8").trim();
|
|
48889
49320
|
if (v)
|
|
48890
49321
|
return v;
|
|
48891
49322
|
}
|
|
@@ -49746,11 +50177,11 @@ var Agent = class {
|
|
|
49746
50177
|
};
|
|
49747
50178
|
|
|
49748
50179
|
// ../agentic/dist/tools/vesk.js
|
|
49749
|
-
import { existsSync as
|
|
49750
|
-
import { resolve as
|
|
50180
|
+
import { existsSync as existsSync36, readFileSync as readFileSync32, writeFileSync as writeFileSync18, mkdirSync as mkdirSync15, readdirSync as readdirSync10, statSync as statSync19 } from "node:fs";
|
|
50181
|
+
import { resolve as resolve32, join as join22, dirname as dirname23, sep as sep6 } from "node:path";
|
|
49751
50182
|
function resolveWithin3(baseDir, relPath) {
|
|
49752
|
-
const base =
|
|
49753
|
-
const target =
|
|
50183
|
+
const base = resolve32(baseDir);
|
|
50184
|
+
const target = resolve32(baseDir, relPath);
|
|
49754
50185
|
const prefix = base + sep6;
|
|
49755
50186
|
if (target === base || !target.startsWith(prefix))
|
|
49756
50187
|
return null;
|
|
@@ -49758,14 +50189,14 @@ function resolveWithin3(baseDir, relPath) {
|
|
|
49758
50189
|
}
|
|
49759
50190
|
var PLUGIN_STATE_FILENAME3 = "plugins.json";
|
|
49760
50191
|
function stateFilePath3(veskDir) {
|
|
49761
|
-
return
|
|
50192
|
+
return resolve32(veskDir, PLUGIN_STATE_FILENAME3);
|
|
49762
50193
|
}
|
|
49763
50194
|
function readPluginState3(veskDir) {
|
|
49764
50195
|
const file = stateFilePath3(veskDir);
|
|
49765
|
-
if (!
|
|
50196
|
+
if (!existsSync36(file))
|
|
49766
50197
|
return { version: 1, plugins: [] };
|
|
49767
50198
|
try {
|
|
49768
|
-
const raw2 = JSON.parse(
|
|
50199
|
+
const raw2 = JSON.parse(readFileSync32(file, "utf-8"));
|
|
49769
50200
|
if (!raw2 || typeof raw2 !== "object")
|
|
49770
50201
|
return { version: 1, plugins: [] };
|
|
49771
50202
|
if (raw2.version !== 1)
|
|
@@ -49780,7 +50211,7 @@ function readPluginState3(veskDir) {
|
|
|
49780
50211
|
}
|
|
49781
50212
|
function writePluginState3(veskDir, state) {
|
|
49782
50213
|
const file = stateFilePath3(veskDir);
|
|
49783
|
-
mkdirSync15(
|
|
50214
|
+
mkdirSync15(dirname23(file), { recursive: true });
|
|
49784
50215
|
writeFileSync18(file, JSON.stringify(state, null, 2) + "\n", "utf-8");
|
|
49785
50216
|
}
|
|
49786
50217
|
function eqIgnoreCase3(a, b) {
|
|
@@ -49800,16 +50231,16 @@ function validatePackageSpec3(pkg) {
|
|
|
49800
50231
|
return null;
|
|
49801
50232
|
}
|
|
49802
50233
|
function findConfigFile3(projectDir) {
|
|
49803
|
-
const ts9 =
|
|
49804
|
-
if (
|
|
50234
|
+
const ts9 = resolve32(projectDir, "vesk.config.ts");
|
|
50235
|
+
if (existsSync36(ts9))
|
|
49805
50236
|
return { path: ts9, isTs: true };
|
|
49806
|
-
const js =
|
|
49807
|
-
if (
|
|
50237
|
+
const js = resolve32(projectDir, "vesk.config.js");
|
|
50238
|
+
if (existsSync36(js))
|
|
49808
50239
|
return { path: js, isTs: false };
|
|
49809
50240
|
return { path: null, isTs: false };
|
|
49810
50241
|
}
|
|
49811
50242
|
function checkpointDir(veskDir) {
|
|
49812
|
-
return
|
|
50243
|
+
return join22(resolve32(veskDir), "checkpoints");
|
|
49813
50244
|
}
|
|
49814
50245
|
function findMatchingBrace2(src2, openIdx) {
|
|
49815
50246
|
let inStr = null;
|
|
@@ -49938,9 +50369,9 @@ function jsonError(message, extra) {
|
|
|
49938
50369
|
return JSON.stringify({ ok: false, error: message, ...extra || {} });
|
|
49939
50370
|
}
|
|
49940
50371
|
function createVeskTools(deps) {
|
|
49941
|
-
const projectDir =
|
|
49942
|
-
const appDir =
|
|
49943
|
-
const veskDir =
|
|
50372
|
+
const projectDir = resolve32(deps.projectDir);
|
|
50373
|
+
const appDir = resolve32(deps.appDir);
|
|
50374
|
+
const veskDir = resolve32(deps.veskDir);
|
|
49944
50375
|
const tools = [
|
|
49945
50376
|
// 1. vesk.inspectProject
|
|
49946
50377
|
{
|
|
@@ -49953,28 +50384,28 @@ function createVeskTools(deps) {
|
|
|
49953
50384
|
},
|
|
49954
50385
|
async execute(_args) {
|
|
49955
50386
|
try {
|
|
49956
|
-
const projExists =
|
|
50387
|
+
const projExists = existsSync36(projectDir);
|
|
49957
50388
|
const projEntries = projExists ? readdirSync10(projectDir, { withFileTypes: true }).map((e) => e.isDirectory() ? e.name + "/" : e.name) : [];
|
|
49958
|
-
const appExists =
|
|
50389
|
+
const appExists = existsSync36(appDir);
|
|
49959
50390
|
const appEntries = appExists ? readdirSync10(appDir, { withFileTypes: true }).map((e) => e.isDirectory() ? e.name + "/" : e.name) : [];
|
|
49960
|
-
const veskExists =
|
|
50391
|
+
const veskExists = existsSync36(veskDir);
|
|
49961
50392
|
const veskEntries = veskExists ? readdirSync10(veskDir, { withFileTypes: true }).map((e) => e.isDirectory() ? e.name + "/" : e.name) : [];
|
|
49962
50393
|
const cfgInfo = findConfigFile3(projectDir);
|
|
49963
50394
|
let configSource = null;
|
|
49964
50395
|
let configExists = false;
|
|
49965
|
-
if (cfgInfo.path &&
|
|
50396
|
+
if (cfgInfo.path && existsSync36(cfgInfo.path)) {
|
|
49966
50397
|
configExists = true;
|
|
49967
50398
|
try {
|
|
49968
|
-
configSource =
|
|
50399
|
+
configSource = readFileSync32(cfgInfo.path, "utf-8").slice(0, 8e3);
|
|
49969
50400
|
} catch {
|
|
49970
50401
|
configSource = null;
|
|
49971
50402
|
}
|
|
49972
50403
|
}
|
|
49973
50404
|
let packageJson = null;
|
|
49974
|
-
const pkgPath =
|
|
49975
|
-
if (
|
|
50405
|
+
const pkgPath = resolve32(projectDir, "package.json");
|
|
50406
|
+
if (existsSync36(pkgPath)) {
|
|
49976
50407
|
try {
|
|
49977
|
-
packageJson = JSON.parse(
|
|
50408
|
+
packageJson = JSON.parse(readFileSync32(pkgPath, "utf-8"));
|
|
49978
50409
|
} catch {
|
|
49979
50410
|
packageJson = null;
|
|
49980
50411
|
}
|
|
@@ -50054,7 +50485,7 @@ function createVeskTools(deps) {
|
|
|
50054
50485
|
resolved = resolveWithin3(appDir, rel);
|
|
50055
50486
|
if (!resolved)
|
|
50056
50487
|
return jsonError("path escapes project root", { path: rel });
|
|
50057
|
-
if (!
|
|
50488
|
+
if (!existsSync36(resolved))
|
|
50058
50489
|
return jsonError("not found", { path: rel });
|
|
50059
50490
|
const st = statSync19(resolved);
|
|
50060
50491
|
if (st.isDirectory()) {
|
|
@@ -50062,7 +50493,7 @@ function createVeskTools(deps) {
|
|
|
50062
50493
|
return jsonOk({ ok: true, path: rel, directory: true, entries: entries.slice(0, 200) });
|
|
50063
50494
|
}
|
|
50064
50495
|
if (st.isFile()) {
|
|
50065
|
-
const content =
|
|
50496
|
+
const content = readFileSync32(resolved, "utf-8");
|
|
50066
50497
|
const capped = content.length > 2e4 ? content.slice(0, 2e4) + "\n/* truncated */" : content;
|
|
50067
50498
|
return jsonOk({ ok: true, path: rel, directory: false, content: capped, size: content.length });
|
|
50068
50499
|
}
|
|
@@ -50095,10 +50526,10 @@ function createVeskTools(deps) {
|
|
|
50095
50526
|
}
|
|
50096
50527
|
}
|
|
50097
50528
|
const info = findConfigFile3(projectDir);
|
|
50098
|
-
if (!info.path || !
|
|
50529
|
+
if (!info.path || !existsSync36(info.path)) {
|
|
50099
50530
|
return jsonOk({ ok: true, path: null, exists: false, source: "", config: {} });
|
|
50100
50531
|
}
|
|
50101
|
-
const source =
|
|
50532
|
+
const source = readFileSync32(info.path, "utf-8");
|
|
50102
50533
|
return jsonOk({ ok: true, path: info.path, exists: true, source, config: null });
|
|
50103
50534
|
} catch (e) {
|
|
50104
50535
|
return jsonError(e instanceof Error ? e.message : String(e));
|
|
@@ -50131,16 +50562,16 @@ function createVeskTools(deps) {
|
|
|
50131
50562
|
target = info.path;
|
|
50132
50563
|
const rel = target.startsWith(projectDir + sep6) ? target.slice(projectDir.length + 1) : "vesk.config.ts";
|
|
50133
50564
|
const contained = resolveWithin3(projectDir, rel);
|
|
50134
|
-
if (!contained && target !==
|
|
50565
|
+
if (!contained && target !== resolve32(projectDir, "vesk.config.ts") && target !== resolve32(projectDir, "vesk.config.js")) {
|
|
50135
50566
|
return jsonError("path escapes project root");
|
|
50136
50567
|
}
|
|
50137
50568
|
} else {
|
|
50138
|
-
target =
|
|
50569
|
+
target = resolve32(projectDir, "vesk.config.ts");
|
|
50139
50570
|
const contained = resolveWithin3(projectDir, "vesk.config.ts");
|
|
50140
50571
|
if (!contained)
|
|
50141
50572
|
return jsonError("path escapes project root");
|
|
50142
50573
|
}
|
|
50143
|
-
mkdirSync15(
|
|
50574
|
+
mkdirSync15(dirname23(target), { recursive: true });
|
|
50144
50575
|
writeFileSync18(target, source, "utf-8");
|
|
50145
50576
|
return jsonOk({ ok: true, path: target, source });
|
|
50146
50577
|
}
|
|
@@ -50156,7 +50587,7 @@ function createVeskTools(deps) {
|
|
|
50156
50587
|
const contained = resolveWithin3(projectDir, info.path.slice(projectDir.length + 1));
|
|
50157
50588
|
if (!contained)
|
|
50158
50589
|
return jsonError("path escapes project root");
|
|
50159
|
-
const current2 =
|
|
50590
|
+
const current2 = readFileSync32(info.path, "utf-8");
|
|
50160
50591
|
const patched = applySimpleConfigToggle(current2, key, a.value);
|
|
50161
50592
|
if (patched === null)
|
|
50162
50593
|
return jsonError("could not safely edit the config object; use the source editor");
|
|
@@ -50424,7 +50855,7 @@ function createVeskTools(deps) {
|
|
|
50424
50855
|
const dir = checkpointDir(veskDir);
|
|
50425
50856
|
mkdirSync15(dir, { recursive: true });
|
|
50426
50857
|
const id = `${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 8)}`;
|
|
50427
|
-
const file =
|
|
50858
|
+
const file = join22(dir, `${id}.json`);
|
|
50428
50859
|
const check = resolveWithin3(dir, `${id}.json`);
|
|
50429
50860
|
if (!check)
|
|
50430
50861
|
return jsonError("path escapes project root");
|
|
@@ -50473,13 +50904,13 @@ function createVeskTools(deps) {
|
|
|
50473
50904
|
} catch {
|
|
50474
50905
|
}
|
|
50475
50906
|
const dir = checkpointDir(veskDir);
|
|
50476
|
-
const file =
|
|
50907
|
+
const file = join22(dir, `${checkpointId}.json`);
|
|
50477
50908
|
const contained = resolveWithin3(dir, `${checkpointId}.json`);
|
|
50478
50909
|
if (!contained)
|
|
50479
50910
|
return jsonError("path escapes project root");
|
|
50480
|
-
if (!
|
|
50911
|
+
if (!existsSync36(file))
|
|
50481
50912
|
return jsonError(`checkpoint not found: ${checkpointId}`, { checkpointId });
|
|
50482
|
-
const raw2 =
|
|
50913
|
+
const raw2 = readFileSync32(file, "utf-8");
|
|
50483
50914
|
let data2;
|
|
50484
50915
|
try {
|
|
50485
50916
|
data2 = JSON.parse(raw2);
|
|
@@ -50497,15 +50928,15 @@ function createVeskTools(deps) {
|
|
|
50497
50928
|
}
|
|
50498
50929
|
|
|
50499
50930
|
// ../adapter/dist/css.js
|
|
50500
|
-
import { readFileSync as
|
|
50501
|
-
import { resolve as
|
|
50931
|
+
import { readFileSync as readFileSync33, existsSync as existsSync37 } from "node:fs";
|
|
50932
|
+
import { resolve as resolve33 } from "node:path";
|
|
50502
50933
|
var GLOBAL_CSS_URL2 = "/_vesk/static/global.css";
|
|
50503
50934
|
function resolveUserCssPath2(appDir) {
|
|
50504
|
-
const cssSrc =
|
|
50505
|
-
if (
|
|
50935
|
+
const cssSrc = resolve33(appDir, "..", "src", "global.css");
|
|
50936
|
+
if (existsSync37(cssSrc))
|
|
50506
50937
|
return cssSrc;
|
|
50507
|
-
const altCssSrc =
|
|
50508
|
-
if (
|
|
50938
|
+
const altCssSrc = resolve33(appDir, "..", "src", "app.css");
|
|
50939
|
+
if (existsSync37(altCssSrc))
|
|
50509
50940
|
return altCssSrc;
|
|
50510
50941
|
return null;
|
|
50511
50942
|
}
|
|
@@ -50521,8 +50952,8 @@ function resolveCssUrls2(opts) {
|
|
|
50521
50952
|
// ../adapter/dist/hmr.js
|
|
50522
50953
|
init_client_codegen();
|
|
50523
50954
|
import { WebSocketServer } from "ws";
|
|
50524
|
-
import { readFileSync as
|
|
50525
|
-
import { resolve as
|
|
50955
|
+
import { readFileSync as readFileSync34, existsSync as existsSync38, writeFileSync as writeFileSync19 } from "node:fs";
|
|
50956
|
+
import { resolve as resolve34, dirname as dirname24 } from "node:path";
|
|
50526
50957
|
import { fileURLToPath as fileURLToPath7 } from "node:url";
|
|
50527
50958
|
init_paths();
|
|
50528
50959
|
|
|
@@ -50729,7 +51160,7 @@ function suggestFor(message) {
|
|
|
50729
51160
|
}
|
|
50730
51161
|
|
|
50731
51162
|
// ../adapter/dist/hmr.js
|
|
50732
|
-
var __dirname8 =
|
|
51163
|
+
var __dirname8 = dirname24(fileURLToPath7(import.meta.url));
|
|
50733
51164
|
function buildErrorPayload(error, filename, opts = {}) {
|
|
50734
51165
|
const file = typeof filename === "string" && filename ? filename : "unknown";
|
|
50735
51166
|
const parsed = parseCompilerError(error, file);
|
|
@@ -50752,19 +51183,19 @@ function buildErrorPayload(error, filename, opts = {}) {
|
|
|
50752
51183
|
if (file.startsWith("/")) {
|
|
50753
51184
|
candidates.push(file);
|
|
50754
51185
|
} else {
|
|
50755
|
-
candidates.push(
|
|
51186
|
+
candidates.push(resolve34(opts.appDir, file));
|
|
50756
51187
|
if (file.startsWith("app/")) {
|
|
50757
|
-
candidates.push(
|
|
50758
|
-
candidates.push(
|
|
51188
|
+
candidates.push(resolve34(opts.appDir, file.slice(4)));
|
|
51189
|
+
candidates.push(resolve34(opts.appDir, "..", file));
|
|
50759
51190
|
} else {
|
|
50760
|
-
candidates.push(
|
|
51191
|
+
candidates.push(resolve34(opts.appDir, "..", file));
|
|
50761
51192
|
}
|
|
50762
|
-
candidates.push(
|
|
51193
|
+
candidates.push(resolve34(file));
|
|
50763
51194
|
}
|
|
50764
51195
|
for (const absPath of candidates) {
|
|
50765
51196
|
try {
|
|
50766
|
-
if (
|
|
50767
|
-
src2 =
|
|
51197
|
+
if (existsSync38(absPath)) {
|
|
51198
|
+
src2 = readFileSync34(absPath, "utf-8");
|
|
50768
51199
|
resolvedAbsPath = absPath;
|
|
50769
51200
|
break;
|
|
50770
51201
|
}
|
|
@@ -50780,7 +51211,7 @@ function buildErrorPayload(error, filename, opts = {}) {
|
|
|
50780
51211
|
}
|
|
50781
51212
|
}
|
|
50782
51213
|
const tipsData = suggestFor(message);
|
|
50783
|
-
const filePath = resolvedAbsPath ?? (typeof opts.appDir === "string" ?
|
|
51214
|
+
const filePath = resolvedAbsPath ?? (typeof opts.appDir === "string" ? resolve34(opts.appDir, file) : void 0);
|
|
50784
51215
|
const errorCode = parsed && typeof parsed.code === "string" && parsed.code ? parsed.code : error?.code ? String(error.code) : void 0;
|
|
50785
51216
|
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;
|
|
50786
51217
|
const payload = {
|
|
@@ -50812,8 +51243,8 @@ function buildErrorPayload(error, filename, opts = {}) {
|
|
|
50812
51243
|
}
|
|
50813
51244
|
|
|
50814
51245
|
// ../adapter/dist/ssr-error.js
|
|
50815
|
-
import { existsSync as
|
|
50816
|
-
import { relative as relative7, resolve as
|
|
51246
|
+
import { existsSync as existsSync39, readFileSync as readFileSync35 } from "node:fs";
|
|
51247
|
+
import { relative as relative7, resolve as resolve35 } from "node:path";
|
|
50817
51248
|
|
|
50818
51249
|
// ../adapter/dist/error-codeframe.js
|
|
50819
51250
|
function buildCodeframe2(src2, line, column, context = 5) {
|
|
@@ -50997,7 +51428,7 @@ function firstSourceFileFrame(stack, projectRoot) {
|
|
|
50997
51428
|
if (!isInsideRoot(p, projectRoot))
|
|
50998
51429
|
continue;
|
|
50999
51430
|
try {
|
|
51000
|
-
if (!
|
|
51431
|
+
if (!existsSync39(p))
|
|
51001
51432
|
continue;
|
|
51002
51433
|
} catch {
|
|
51003
51434
|
continue;
|
|
@@ -51028,7 +51459,7 @@ function findIdentifierUsage(src2, name) {
|
|
|
51028
51459
|
return null;
|
|
51029
51460
|
}
|
|
51030
51461
|
function projectOf(ctx2) {
|
|
51031
|
-
return ctx2.projectDir ||
|
|
51462
|
+
return ctx2.projectDir || resolve35(ctx2.appDir, "..");
|
|
51032
51463
|
}
|
|
51033
51464
|
function displayPath(absPath, ctx2) {
|
|
51034
51465
|
const appRel = relative7(ctx2.appDir, absPath);
|
|
@@ -51041,9 +51472,9 @@ function displayPath(absPath, ctx2) {
|
|
|
51041
51472
|
}
|
|
51042
51473
|
function readIfFile(absPath) {
|
|
51043
51474
|
try {
|
|
51044
|
-
if (!
|
|
51475
|
+
if (!existsSync39(absPath))
|
|
51045
51476
|
return null;
|
|
51046
|
-
return
|
|
51477
|
+
return readFileSync35(absPath, "utf-8");
|
|
51047
51478
|
} catch {
|
|
51048
51479
|
return null;
|
|
51049
51480
|
}
|
|
@@ -51051,13 +51482,13 @@ function readIfFile(absPath) {
|
|
|
51051
51482
|
function resolveComponentFile(name, ctx2) {
|
|
51052
51483
|
const fromRoutes = ctx2.routeSources?.get(name);
|
|
51053
51484
|
if (fromRoutes) {
|
|
51054
|
-
const abs =
|
|
51485
|
+
const abs = resolve35(ctx2.appDir, fromRoutes);
|
|
51055
51486
|
if (readIfFile(abs) !== null)
|
|
51056
51487
|
return abs;
|
|
51057
51488
|
}
|
|
51058
51489
|
const fromShared = ctx2.componentMap?.get(name);
|
|
51059
51490
|
if (fromShared) {
|
|
51060
|
-
const abs =
|
|
51491
|
+
const abs = resolve35(projectOf(ctx2), fromShared);
|
|
51061
51492
|
if (readIfFile(abs) !== null)
|
|
51062
51493
|
return abs;
|
|
51063
51494
|
if (readIfFile(fromShared) !== null)
|
|
@@ -51191,13 +51622,13 @@ function renderDevErrorPage(payload, opts) {
|
|
|
51191
51622
|
|
|
51192
51623
|
// src/build-packages.ts
|
|
51193
51624
|
import { spawnSync } from "node:child_process";
|
|
51194
|
-
import { cpSync as cpSync2, existsSync as
|
|
51625
|
+
import { cpSync as cpSync2, existsSync as existsSync40, mkdirSync as mkdirSync16, readFileSync as readFileSync36, readdirSync as readdirSync11, statSync as statSync20, writeFileSync as writeFileSync20 } from "node:fs";
|
|
51195
51626
|
import { createRequire as createRequire6 } from "node:module";
|
|
51196
|
-
import { dirname as
|
|
51627
|
+
import { dirname as dirname25, join as join23, resolve as resolve36 } from "node:path";
|
|
51197
51628
|
import { fileURLToPath as fileURLToPath8 } from "node:url";
|
|
51198
51629
|
var require2 = createRequire6(import.meta.url);
|
|
51199
|
-
var __dirname9 =
|
|
51200
|
-
var root2 =
|
|
51630
|
+
var __dirname9 = dirname25(fileURLToPath8(import.meta.url));
|
|
51631
|
+
var root2 = resolve36(__dirname9, "..", "..", "..");
|
|
51201
51632
|
var PACKAGES = {
|
|
51202
51633
|
// types first — it is a dependency-free leaf that compiler and adapter
|
|
51203
51634
|
// import for their shared type definitions.
|
|
@@ -51222,7 +51653,7 @@ var PACKAGES = {
|
|
|
51222
51653
|
function newestSourceMtime(srcDir) {
|
|
51223
51654
|
let newest = 0;
|
|
51224
51655
|
for (const name of readdirSync11(srcDir)) {
|
|
51225
|
-
const p =
|
|
51656
|
+
const p = join23(srcDir, name);
|
|
51226
51657
|
const st = statSync20(p);
|
|
51227
51658
|
if (st.isDirectory()) {
|
|
51228
51659
|
newest = Math.max(newest, newestSourceMtime(p));
|
|
@@ -51233,11 +51664,11 @@ function newestSourceMtime(srcDir) {
|
|
|
51233
51664
|
return newest;
|
|
51234
51665
|
}
|
|
51235
51666
|
function distStale(pkgDir, entry) {
|
|
51236
|
-
const distIndex =
|
|
51237
|
-
if (!
|
|
51238
|
-
const distPkg =
|
|
51239
|
-
const distStamp = Math.max(statSync20(distIndex).mtimeMs,
|
|
51240
|
-
return newestSourceMtime(
|
|
51667
|
+
const distIndex = join23(pkgDir, "dist", `${entry}.js`);
|
|
51668
|
+
if (!existsSync40(distIndex)) return true;
|
|
51669
|
+
const distPkg = join23(pkgDir, "dist", "package.json");
|
|
51670
|
+
const distStamp = Math.max(statSync20(distIndex).mtimeMs, existsSync40(distPkg) ? statSync20(distPkg).mtimeMs : 0);
|
|
51671
|
+
return newestSourceMtime(join23(pkgDir, "src")) > distStamp;
|
|
51241
51672
|
}
|
|
51242
51673
|
function distPackageJson(pkgName, entry, serverEntry, version2) {
|
|
51243
51674
|
const exports = {
|
|
@@ -51260,24 +51691,24 @@ function distPackageJson(pkgName, entry, serverEntry, version2) {
|
|
|
51260
51691
|
}
|
|
51261
51692
|
function buildPackages(force = false) {
|
|
51262
51693
|
for (const [pkg, cfg] of Object.entries(PACKAGES)) {
|
|
51263
|
-
const pkgDir =
|
|
51264
|
-
if (!
|
|
51694
|
+
const pkgDir = resolve36(root2, "packages", pkg);
|
|
51695
|
+
if (!existsSync40(join23(pkgDir, "src"))) continue;
|
|
51265
51696
|
if (!force && !distStale(pkgDir, cfg.entry)) continue;
|
|
51266
51697
|
console.log(`[build] ${cfg.name} -> tsc`);
|
|
51267
51698
|
const tscBin = require2.resolve("typescript/bin/tsc");
|
|
51268
|
-
const result = spawnSync(process.execPath, [tscBin, "-p",
|
|
51699
|
+
const result = spawnSync(process.execPath, [tscBin, "-p", join23(pkgDir, "tsconfig.build.json")], {
|
|
51269
51700
|
stdio: "inherit"
|
|
51270
51701
|
});
|
|
51271
51702
|
if (result.status !== 0) {
|
|
51272
51703
|
throw new Error(`tsc failed for ${cfg.name}`);
|
|
51273
51704
|
}
|
|
51274
|
-
const distDir =
|
|
51705
|
+
const distDir = join23(pkgDir, "dist");
|
|
51275
51706
|
for (const c of cfg.copy || []) {
|
|
51276
|
-
const to =
|
|
51277
|
-
mkdirSync16(
|
|
51278
|
-
cpSync2(
|
|
51707
|
+
const to = join23(distDir, c.to);
|
|
51708
|
+
mkdirSync16(dirname25(to), { recursive: true });
|
|
51709
|
+
cpSync2(join23(pkgDir, c.from), to, { recursive: true });
|
|
51279
51710
|
}
|
|
51280
|
-
const srcPkg = JSON.parse(
|
|
51711
|
+
const srcPkg = JSON.parse(readFileSync36(join23(pkgDir, "package.json"), "utf-8"));
|
|
51281
51712
|
if (pkg === "lucide-vesk") {
|
|
51282
51713
|
const lucideDistPkg = {
|
|
51283
51714
|
name: srcPkg.name,
|
|
@@ -51291,9 +51722,9 @@ function buildPackages(force = false) {
|
|
|
51291
51722
|
"./package.json": "./package.json"
|
|
51292
51723
|
}
|
|
51293
51724
|
};
|
|
51294
|
-
writeFileSync20(
|
|
51725
|
+
writeFileSync20(join23(distDir, "package.json"), JSON.stringify(lucideDistPkg, null, 2) + "\n");
|
|
51295
51726
|
} else {
|
|
51296
|
-
writeFileSync20(
|
|
51727
|
+
writeFileSync20(join23(distDir, "package.json"), distPackageJson(cfg.name, cfg.entry, cfg.serverEntry, srcPkg.version || "1.0.0"));
|
|
51297
51728
|
}
|
|
51298
51729
|
console.log(`[build] ${cfg.name} -> dist`);
|
|
51299
51730
|
}
|
|
@@ -51301,13 +51732,13 @@ function buildPackages(force = false) {
|
|
|
51301
51732
|
function ensurePackagesBuilt() {
|
|
51302
51733
|
buildPackages(false);
|
|
51303
51734
|
}
|
|
51304
|
-
if (process.argv[1] &&
|
|
51735
|
+
if (process.argv[1] && resolve36(process.argv[1]) === fileURLToPath8(import.meta.url)) {
|
|
51305
51736
|
buildPackages(process.argv.includes("--force"));
|
|
51306
51737
|
}
|
|
51307
51738
|
|
|
51308
51739
|
// src/action-handler.ts
|
|
51309
|
-
import { existsSync as
|
|
51310
|
-
import { resolve as
|
|
51740
|
+
import { existsSync as existsSync41, readFileSync as readFileSync37, readdirSync as readdirSync12 } from "node:fs";
|
|
51741
|
+
import { resolve as resolve37 } from "node:path";
|
|
51311
51742
|
|
|
51312
51743
|
// ../compiler/dist/server-cookies.js
|
|
51313
51744
|
function parseCookies3(str3) {
|
|
@@ -51390,8 +51821,8 @@ function pageSourcesFor(appDirPath, routeTree) {
|
|
|
51390
51821
|
const out = [];
|
|
51391
51822
|
function walk7(nodes) {
|
|
51392
51823
|
for (const node of nodes) {
|
|
51393
|
-
if (node.page) out.push(
|
|
51394
|
-
if (node.layout) out.push(
|
|
51824
|
+
if (node.page) out.push(resolve37(appDirPath, node.sourceDir, "page.vsk"));
|
|
51825
|
+
if (node.layout) out.push(resolve37(appDirPath, node.sourceDir, "layout.vsk"));
|
|
51395
51826
|
walk7(node.children);
|
|
51396
51827
|
}
|
|
51397
51828
|
}
|
|
@@ -51399,7 +51830,7 @@ function pageSourcesFor(appDirPath, routeTree) {
|
|
|
51399
51830
|
return out;
|
|
51400
51831
|
}
|
|
51401
51832
|
function walkVskFiles(dir, out, seen) {
|
|
51402
|
-
if (!
|
|
51833
|
+
if (!existsSync41(dir)) return;
|
|
51403
51834
|
let entries;
|
|
51404
51835
|
try {
|
|
51405
51836
|
entries = readdirSync12(dir, { withFileTypes: true });
|
|
@@ -51407,7 +51838,7 @@ function walkVskFiles(dir, out, seen) {
|
|
|
51407
51838
|
return;
|
|
51408
51839
|
}
|
|
51409
51840
|
for (const entry of entries) {
|
|
51410
|
-
const full =
|
|
51841
|
+
const full = resolve37(dir, entry.name);
|
|
51411
51842
|
if (seen.has(full)) continue;
|
|
51412
51843
|
seen.add(full);
|
|
51413
51844
|
if (entry.isDirectory()) {
|
|
@@ -51427,16 +51858,16 @@ function candidateSources(appDirPath, routeTree) {
|
|
|
51427
51858
|
seen.add(src2);
|
|
51428
51859
|
out.push(src2);
|
|
51429
51860
|
}
|
|
51430
|
-
const projectRoot =
|
|
51431
|
-
for (const dir of [
|
|
51861
|
+
const projectRoot = resolve37(appDirPath, "..");
|
|
51862
|
+
for (const dir of [resolve37(projectRoot, "components"), appDirPath, projectRoot]) {
|
|
51432
51863
|
walkVskFiles(dir, out, seen);
|
|
51433
51864
|
}
|
|
51434
51865
|
return out;
|
|
51435
51866
|
}
|
|
51436
51867
|
function registerSource(sourcePath2) {
|
|
51437
|
-
if (!
|
|
51868
|
+
if (!existsSync41(sourcePath2)) return;
|
|
51438
51869
|
try {
|
|
51439
|
-
compileFile(
|
|
51870
|
+
compileFile(readFileSync37(sourcePath2, "utf-8"), { sourcePath: sourcePath2 });
|
|
51440
51871
|
} catch {
|
|
51441
51872
|
}
|
|
51442
51873
|
}
|
|
@@ -51445,8 +51876,8 @@ function ensureActionRegistered(actionId, pagePathname, appDirPath, routeTree) {
|
|
|
51445
51876
|
const match = matchUrl(routeTree, pagePathname);
|
|
51446
51877
|
if (match) {
|
|
51447
51878
|
for (let i = match.nodes.length - 1; i >= 0; i--) {
|
|
51448
|
-
registerSource(
|
|
51449
|
-
registerSource(
|
|
51879
|
+
registerSource(resolve37(appDirPath, match.nodes[i].sourceDir, "page.vsk"));
|
|
51880
|
+
registerSource(resolve37(appDirPath, match.nodes[i].sourceDir, "layout.vsk"));
|
|
51450
51881
|
}
|
|
51451
51882
|
}
|
|
51452
51883
|
if (getAction2(actionId)) return;
|
|
@@ -51472,24 +51903,24 @@ async function renderPageHtml(pagePathname, params, ctx2) {
|
|
|
51472
51903
|
let head = "";
|
|
51473
51904
|
for (let i = chain.length - 1; i >= 0; i--) {
|
|
51474
51905
|
const node = chain[i];
|
|
51475
|
-
const pageFilePath =
|
|
51476
|
-
const layoutFilePath =
|
|
51477
|
-
if (i === chain.length - 1 && node.page &&
|
|
51478
|
-
const src3 =
|
|
51906
|
+
const pageFilePath = resolve37(ctx2.appDirPath, node.sourceDir, "page.vsk");
|
|
51907
|
+
const layoutFilePath = resolve37(ctx2.appDirPath, node.sourceDir, "layout.vsk");
|
|
51908
|
+
if (i === chain.length - 1 && node.page && existsSync41(pageFilePath)) {
|
|
51909
|
+
const src3 = readFileSync37(pageFilePath, "utf-8");
|
|
51479
51910
|
const compName2 = resolveComponentName(src3) || node.page;
|
|
51480
51911
|
const result = await renderPage(src3, compName2, { params }, /* @__PURE__ */ new Map(), { hydrate: true, sourcePath: pageFilePath });
|
|
51481
51912
|
body = result.body;
|
|
51482
51913
|
head = result.head || "";
|
|
51483
51914
|
}
|
|
51484
|
-
if (node.layout &&
|
|
51485
|
-
const src3 =
|
|
51915
|
+
if (node.layout && existsSync41(layoutFilePath)) {
|
|
51916
|
+
const src3 = readFileSync37(layoutFilePath, "utf-8");
|
|
51486
51917
|
const compName2 = resolveComponentName(src3) || node.layout;
|
|
51487
51918
|
const result = await renderPage(src3, compName2, { children: body }, /* @__PURE__ */ new Map(), { hydrate: true, sourcePath: layoutFilePath });
|
|
51488
51919
|
body = result.body;
|
|
51489
51920
|
head = (result.head || "") + head;
|
|
51490
51921
|
}
|
|
51491
51922
|
}
|
|
51492
|
-
const hasLayout = chain.some((n) => n.layout &&
|
|
51923
|
+
const hasLayout = chain.some((n) => n.layout && existsSync41(resolve37(ctx2.appDirPath, n.sourceDir, "layout.vsk")));
|
|
51493
51924
|
if (hasLayout) {
|
|
51494
51925
|
const secMeta = securityMeta(ctx2.security);
|
|
51495
51926
|
const headBlock = await applyHeadInjects(
|
|
@@ -51513,9 +51944,9 @@ ${prettifyHtml(body)}
|
|
|
51513
51944
|
}
|
|
51514
51945
|
const leaf = chain.find((n) => n.page);
|
|
51515
51946
|
if (!leaf) return null;
|
|
51516
|
-
const src2 =
|
|
51947
|
+
const src2 = readFileSync37(resolve37(ctx2.appDirPath, leaf.sourceDir, "page.vsk"), "utf-8");
|
|
51517
51948
|
const compName = resolveComponentName(src2) || leaf.page;
|
|
51518
|
-
const html = await renderFullPage(src2, compName, { params }, /* @__PURE__ */ new Map(), { hydrate: true, clientScriptUrl: "/_vesk/client.js", cssUrls: actionCssUrls(ctx2.appDirPath), security: ctx2.security, sourcePath:
|
|
51949
|
+
const html = await renderFullPage(src2, compName, { params }, /* @__PURE__ */ new Map(), { hydrate: true, clientScriptUrl: "/_vesk/client.js", cssUrls: actionCssUrls(ctx2.appDirPath), security: ctx2.security, sourcePath: resolve37(ctx2.appDirPath, leaf.sourceDir, "page.vsk"), plugins: ctx2.plugins });
|
|
51519
51950
|
return applyHtmlPlugins(html.replace("</body>", ' <script type="module" src="/_vesk/hmr.js"></script>\n</body>'), ctx2.plugins, { sourcePath: ctx2.url.pathname });
|
|
51520
51951
|
}
|
|
51521
51952
|
async function handleActionRequest(req, res, ctx2) {
|
|
@@ -51680,7 +52111,7 @@ function buildDevErrorPayload(input) {
|
|
|
51680
52111
|
payload.column = colMatch ? parseInt(colMatch[1], 10) : 1;
|
|
51681
52112
|
if (fileExists && payload.line > 0) {
|
|
51682
52113
|
try {
|
|
51683
|
-
const src2 =
|
|
52114
|
+
const src2 = readFileSync38(fullPath, "utf-8");
|
|
51684
52115
|
const cf = buildCodeframe2(src2, payload.line, payload.column);
|
|
51685
52116
|
if (cf) {
|
|
51686
52117
|
cf.file = payload.file || filename;
|
|
@@ -51698,14 +52129,14 @@ function resolveDevErrorReport(report, ctx2) {
|
|
|
51698
52129
|
let componentMap;
|
|
51699
52130
|
let routeSources;
|
|
51700
52131
|
try {
|
|
51701
|
-
componentMap = scanComponents(
|
|
52132
|
+
componentMap = scanComponents(resolve38(ctx2.projectDir, "components"));
|
|
51702
52133
|
} catch {
|
|
51703
52134
|
componentMap = void 0;
|
|
51704
52135
|
}
|
|
51705
52136
|
try {
|
|
51706
52137
|
routeSources = /* @__PURE__ */ new Map();
|
|
51707
52138
|
for (const [name, rel] of collectSources(ctx2.routeTree || [])) {
|
|
51708
|
-
routeSources.set(name,
|
|
52139
|
+
routeSources.set(name, resolve38(ctx2.appDir, rel));
|
|
51709
52140
|
}
|
|
51710
52141
|
} catch {
|
|
51711
52142
|
routeSources = void 0;
|
|
@@ -51736,9 +52167,9 @@ function devErrorContextForMatch(match, appDir, projectDir, routeTree) {
|
|
|
51736
52167
|
for (const kind of ["page.vsk", "layout.vsk", "error.vsk"]) {
|
|
51737
52168
|
for (const node of nodes) {
|
|
51738
52169
|
if (!node || typeof node.sourceDir !== "string") continue;
|
|
51739
|
-
const p =
|
|
52170
|
+
const p = resolve38(appDir, node.sourceDir, kind);
|
|
51740
52171
|
try {
|
|
51741
|
-
if (
|
|
52172
|
+
if (existsSync42(p) && !routeFiles.includes(p)) routeFiles.push(p);
|
|
51742
52173
|
} catch {
|
|
51743
52174
|
}
|
|
51744
52175
|
}
|
|
@@ -51748,14 +52179,14 @@ function devErrorContextForMatch(match, appDir, projectDir, routeTree) {
|
|
|
51748
52179
|
let componentMap;
|
|
51749
52180
|
let routeSources;
|
|
51750
52181
|
try {
|
|
51751
|
-
componentMap = scanComponents(
|
|
52182
|
+
componentMap = scanComponents(resolve38(projectDir, "components"));
|
|
51752
52183
|
} catch {
|
|
51753
52184
|
componentMap = void 0;
|
|
51754
52185
|
}
|
|
51755
52186
|
try {
|
|
51756
52187
|
routeSources = /* @__PURE__ */ new Map();
|
|
51757
52188
|
for (const [name, rel] of collectSources(routeTree || [])) {
|
|
51758
|
-
routeSources.set(name,
|
|
52189
|
+
routeSources.set(name, resolve38(appDir, rel));
|
|
51759
52190
|
}
|
|
51760
52191
|
} catch {
|
|
51761
52192
|
routeSources = void 0;
|
|
@@ -51765,14 +52196,14 @@ function devErrorContextForMatch(match, appDir, projectDir, routeTree) {
|
|
|
51765
52196
|
function resolveRuntimeDir(projectDir) {
|
|
51766
52197
|
const candidates = [
|
|
51767
52198
|
// installed app layout
|
|
51768
|
-
|
|
52199
|
+
resolve38(projectDir, "node_modules", "@vesk", "runtime"),
|
|
51769
52200
|
// monorepo checkout (tests/probes run from the repo root)
|
|
51770
|
-
|
|
52201
|
+
resolve38(import.meta.dirname ?? ".", "..", "..", "runtime", "dist")
|
|
51771
52202
|
];
|
|
51772
52203
|
for (const dir of candidates) {
|
|
51773
|
-
if (
|
|
51774
|
-
const distDir =
|
|
51775
|
-
if (
|
|
52204
|
+
if (existsSync42(join24(dir, "ripple-runtime.js"))) return dir;
|
|
52205
|
+
const distDir = join24(dir, "dist");
|
|
52206
|
+
if (existsSync42(join24(distDir, "ripple-runtime.js"))) return distDir;
|
|
51776
52207
|
}
|
|
51777
52208
|
return null;
|
|
51778
52209
|
}
|
|
@@ -51899,6 +52330,46 @@ function writeDevPanelResponse(res, response) {
|
|
|
51899
52330
|
}
|
|
51900
52331
|
var ssrDataStore = /* @__PURE__ */ new Map();
|
|
51901
52332
|
var HMR_DEBOUNCE_MS = 12;
|
|
52333
|
+
var ROUTE_STRUCTURAL_VSK = /* @__PURE__ */ new Set([
|
|
52334
|
+
"page.vsk",
|
|
52335
|
+
"layout.vsk",
|
|
52336
|
+
"loading.vsk",
|
|
52337
|
+
"error.vsk",
|
|
52338
|
+
"not-found.vsk",
|
|
52339
|
+
"offline.vsk",
|
|
52340
|
+
"network.vsk"
|
|
52341
|
+
]);
|
|
52342
|
+
var HMR_SKIP_DIRS = /* @__PURE__ */ new Set(["node_modules", ".vesk", "tarballs", ".git"]);
|
|
52343
|
+
var HMR_SKIP_MARKERS = ["node_modules/", ".vesk/", "tmp-vesk-chunk-"];
|
|
52344
|
+
var HMR_SCRIPT_EXTS = [".mts", ".ts", ".tsx", ".mjs", ".js", ".cjs"];
|
|
52345
|
+
var HMR_CONFIG_NAMES = /* @__PURE__ */ new Set([
|
|
52346
|
+
"vesk.config.ts",
|
|
52347
|
+
"vesk.config.js",
|
|
52348
|
+
"vesk.config.mjs",
|
|
52349
|
+
"vesk.config.mts",
|
|
52350
|
+
"postcss.config.js",
|
|
52351
|
+
"postcss.config.ts",
|
|
52352
|
+
"tailwind.config.js",
|
|
52353
|
+
"tailwind.config.ts",
|
|
52354
|
+
"tsconfig.json",
|
|
52355
|
+
"package.json"
|
|
52356
|
+
]);
|
|
52357
|
+
function classifyHmrWatchPath(relPath) {
|
|
52358
|
+
const first = relPath.split("/")[0];
|
|
52359
|
+
if (HMR_SKIP_DIRS.has(first) || HMR_SKIP_MARKERS.some((m) => relPath.includes(m))) return "ignored";
|
|
52360
|
+
const name = relPath.slice(relPath.lastIndexOf("/") + 1);
|
|
52361
|
+
if (relPath.endsWith(".vsk") || relPath.endsWith(".md") || relPath.endsWith(".markdown")) return "vsk";
|
|
52362
|
+
if (relPath.endsWith(".css")) return "css";
|
|
52363
|
+
if (name === "_events.ts" || name === "_events.js") return "events";
|
|
52364
|
+
if (HMR_CONFIG_NAMES.has(name)) return "config";
|
|
52365
|
+
if (HMR_SCRIPT_EXTS.some((ext) => relPath.endsWith(ext))) return "script";
|
|
52366
|
+
return "ignored";
|
|
52367
|
+
}
|
|
52368
|
+
function shouldRescanRoutes(relPath, eventType) {
|
|
52369
|
+
if (eventType === "rename") return true;
|
|
52370
|
+
const name = relPath.slice(relPath.lastIndexOf("/") + 1);
|
|
52371
|
+
return relPath.endsWith(".vsk") && ROUTE_STRUCTURAL_VSK.has(name);
|
|
52372
|
+
}
|
|
51902
52373
|
function storeDataScript(payload) {
|
|
51903
52374
|
if (!payload.props && !payload.ssrData) return null;
|
|
51904
52375
|
if (ssrDataStore.size >= 100) {
|
|
@@ -51931,10 +52402,10 @@ function collectRoutePaths(nodes, out = []) {
|
|
|
51931
52402
|
return out;
|
|
51932
52403
|
}
|
|
51933
52404
|
function countFilesNamed(dir, name) {
|
|
51934
|
-
if (!
|
|
52405
|
+
if (!existsSync42(dir)) return 0;
|
|
51935
52406
|
let n = 0;
|
|
51936
52407
|
for (const entry of readdirSync13(dir, { withFileTypes: true })) {
|
|
51937
|
-
const p =
|
|
52408
|
+
const p = join24(dir, entry.name);
|
|
51938
52409
|
if (entry.isDirectory()) n += countFilesNamed(p, name);
|
|
51939
52410
|
else if (entry.name === name) n++;
|
|
51940
52411
|
}
|
|
@@ -51945,8 +52416,8 @@ async function startDevServer(port, projectDir, config, host) {
|
|
|
51945
52416
|
if (!process.env.NODE_ENV) process.env.NODE_ENV = "development";
|
|
51946
52417
|
const secCfg = config.security || {};
|
|
51947
52418
|
const maxBodyBytes = (typeof secCfg.maxBodyBytes === "number" ? secCfg.maxBodyBytes : void 0) || DEFAULT_MAX_BODY_BYTES;
|
|
51948
|
-
const appDirPath =
|
|
51949
|
-
const publicDir =
|
|
52419
|
+
const appDirPath = join24(projectDir, "app");
|
|
52420
|
+
const publicDir = join24(projectDir, "public");
|
|
51950
52421
|
installMdReadHook2([publicDir]);
|
|
51951
52422
|
try {
|
|
51952
52423
|
ensurePackagesBuilt();
|
|
@@ -51959,7 +52430,7 @@ async function startDevServer(port, projectDir, config, host) {
|
|
|
51959
52430
|
process.exit(1);
|
|
51960
52431
|
}
|
|
51961
52432
|
const runtimeDir = runtimeDirUnchecked;
|
|
51962
|
-
const veskStateDir =
|
|
52433
|
+
const veskStateDir = join24(projectDir, ".vesk");
|
|
51963
52434
|
const configPluginsRaw = config.plugins || [];
|
|
51964
52435
|
const configPluginNames = configPluginsRaw.map((p) => typeof p === "string" ? p : p?.name).filter((n) => !!n);
|
|
51965
52436
|
const rawDevPlugins = config.plugins || [];
|
|
@@ -52058,14 +52529,14 @@ async function startDevServer(port, projectDir, config, host) {
|
|
|
52058
52529
|
}
|
|
52059
52530
|
let devGlobalCssContent = "";
|
|
52060
52531
|
let lastServedCssGlobal = "";
|
|
52061
|
-
const srcDir =
|
|
52062
|
-
const cssPath =
|
|
52063
|
-
const altCssPath =
|
|
52532
|
+
const srcDir = join24(projectDir, "src");
|
|
52533
|
+
const cssPath = join24(srcDir, "global.css");
|
|
52534
|
+
const altCssPath = join24(srcDir, "app.css");
|
|
52064
52535
|
let rawCss = "";
|
|
52065
|
-
if (
|
|
52066
|
-
rawCss =
|
|
52067
|
-
} else if (
|
|
52068
|
-
rawCss =
|
|
52536
|
+
if (existsSync42(cssPath)) {
|
|
52537
|
+
rawCss = readFileSync38(cssPath, "utf-8");
|
|
52538
|
+
} else if (existsSync42(altCssPath)) {
|
|
52539
|
+
rawCss = readFileSync38(altCssPath, "utf-8");
|
|
52069
52540
|
}
|
|
52070
52541
|
if (rawCss) {
|
|
52071
52542
|
const activeAtStart = getActiveDevPlugins();
|
|
@@ -52296,63 +52767,110 @@ async function startDevServer(port, projectDir, config, host) {
|
|
|
52296
52767
|
}
|
|
52297
52768
|
}
|
|
52298
52769
|
const apiWatchCache = /* @__PURE__ */ new Map();
|
|
52770
|
+
const lastSeenContent = /* @__PURE__ */ new Map();
|
|
52771
|
+
let chunkRefresh = Promise.resolve();
|
|
52772
|
+
const queueClientChunksRefresh = (fullPath, filename, fileExists) => {
|
|
52773
|
+
chunkRefresh = chunkRefresh.then(async () => {
|
|
52774
|
+
try {
|
|
52775
|
+
const hot = await buildClientChunks(fullPath);
|
|
52776
|
+
if (hot.err) {
|
|
52777
|
+
const payload = buildDevErrorPayload({
|
|
52778
|
+
err: hot.err,
|
|
52779
|
+
errorMessage: hot.err.message,
|
|
52780
|
+
filename,
|
|
52781
|
+
fullPath,
|
|
52782
|
+
appDir: appDirPath,
|
|
52783
|
+
fileExists
|
|
52784
|
+
});
|
|
52785
|
+
const displayFile = payload.file || filename || "";
|
|
52786
|
+
LOG.err(`[vsk:error] ${displayFile}${payload.line ? `:${payload.line}:${payload.column || 1}` : ""} \u2014 ${payload.message}`);
|
|
52787
|
+
devLastError = payload;
|
|
52788
|
+
recordDiagnostic({
|
|
52789
|
+
severity: "error",
|
|
52790
|
+
code: "HMR_CHUNK",
|
|
52791
|
+
file: displayFile || null,
|
|
52792
|
+
line: payload.line,
|
|
52793
|
+
column: payload.column,
|
|
52794
|
+
message: payload.message,
|
|
52795
|
+
hint: payload.tips && payload.tips[0] || null
|
|
52796
|
+
});
|
|
52797
|
+
const broadcast = globalThis.__vesk_broadcastHmr;
|
|
52798
|
+
if (typeof broadcast === "function") broadcast({ type: "error", ...payload });
|
|
52799
|
+
}
|
|
52800
|
+
} catch (e) {
|
|
52801
|
+
LOG.err(`chunk refresh error:`, e.message);
|
|
52802
|
+
}
|
|
52803
|
+
});
|
|
52804
|
+
};
|
|
52299
52805
|
try {
|
|
52300
52806
|
let debounceTimer = null;
|
|
52301
52807
|
let cssDebounceTimer = null;
|
|
52302
|
-
const skipDirs = /* @__PURE__ */ new Set(["node_modules", ".vesk", "tarballs"]);
|
|
52303
52808
|
const watchDir = projectDir;
|
|
52304
52809
|
watch(watchDir, { recursive: true }, (eventType, filename) => {
|
|
52305
52810
|
if (!filename) return;
|
|
52306
|
-
|
|
52307
|
-
|
|
52308
|
-
const
|
|
52309
|
-
const
|
|
52310
|
-
const
|
|
52311
|
-
|
|
52312
|
-
|
|
52313
|
-
|
|
52314
|
-
if (
|
|
52811
|
+
const kind = classifyHmrWatchPath(filename);
|
|
52812
|
+
if (kind === "ignored") return;
|
|
52813
|
+
const fullPath = filename.startsWith("/") ? filename : join24(watchDir, filename);
|
|
52814
|
+
const fileExists = existsSync42(fullPath);
|
|
52815
|
+
const bcast = (msg) => {
|
|
52816
|
+
const f = globalThis.__vesk_broadcastHmr;
|
|
52817
|
+
if (typeof f === "function") f(msg);
|
|
52818
|
+
};
|
|
52819
|
+
if (kind === "events") {
|
|
52315
52820
|
if (debounceTimer) clearTimeout(debounceTimer);
|
|
52316
52821
|
debounceTimer = setTimeout(async () => {
|
|
52317
52822
|
try {
|
|
52318
52823
|
await runAppStop(false);
|
|
52319
52824
|
await reloadAppEvents();
|
|
52320
52825
|
await runAppStart(false);
|
|
52321
|
-
const
|
|
52322
|
-
if (typeof
|
|
52826
|
+
const bcastLocal = globalThis.__vesk_broadcastHmr;
|
|
52827
|
+
if (typeof bcastLocal === "function") bcastLocal({ type: "reload" });
|
|
52323
52828
|
LOG.info(`events reloaded (${filename})`);
|
|
52324
52829
|
} catch (e) {
|
|
52325
52830
|
LOG.err(`events reload error: ${e.message}`);
|
|
52326
52831
|
}
|
|
52327
52832
|
}, HMR_DEBOUNCE_MS);
|
|
52328
|
-
} else if (
|
|
52833
|
+
} else if (kind === "vsk") {
|
|
52329
52834
|
if (debounceTimer) clearTimeout(debounceTimer);
|
|
52330
52835
|
debounceTimer = setTimeout(async () => {
|
|
52331
52836
|
const t0 = Date.now();
|
|
52332
52837
|
try {
|
|
52838
|
+
const current2 = fileExists ? readFileSync38(fullPath, "utf-8") : null;
|
|
52839
|
+
if (eventType !== "rename" && current2 !== null && lastSeenContent.get(fullPath) === current2) {
|
|
52840
|
+
LOG.info(`skipped unchanged (${filename})`);
|
|
52841
|
+
return;
|
|
52842
|
+
}
|
|
52843
|
+
lastSeenContent.set(fullPath, current2);
|
|
52333
52844
|
if (typeof globalThis.__vesk_broadcastHmr === "function") {
|
|
52334
52845
|
globalThis.__vesk_broadcastHmr({ type: "compiling" });
|
|
52335
52846
|
}
|
|
52336
52847
|
const stripAnnots = (t) => JSON.stringify(t, (k, v) => k === "chunk" || k === "chunkError" ? void 0 : v);
|
|
52848
|
+
const needsRescan = shouldRescanRoutes(filename, eventType);
|
|
52337
52849
|
const prevTree = stripAnnots(routeTree);
|
|
52338
|
-
|
|
52339
|
-
|
|
52850
|
+
if (needsRescan) {
|
|
52851
|
+
routeTree = scanRoutes(appDirPath);
|
|
52852
|
+
updateSourceMapping();
|
|
52853
|
+
}
|
|
52340
52854
|
const changedComponents = sourceToComponents.get(fullPath) || [];
|
|
52341
|
-
const treeChanged = prevTree !== stripAnnots(routeTree);
|
|
52855
|
+
const treeChanged = needsRescan && prevTree !== stripAnnots(routeTree);
|
|
52342
52856
|
const isOutsideApp = !fullPath.startsWith(appDirPath + "/") && fullPath !== appDirPath;
|
|
52857
|
+
const fileDeleted = eventType === "rename" && !fileExists;
|
|
52343
52858
|
const cssPromise = rebuildTailwindCss();
|
|
52344
52859
|
let bundleError = null;
|
|
52345
52860
|
let hotEditedSource = null;
|
|
52346
52861
|
let hotActualName = null;
|
|
52347
52862
|
try {
|
|
52348
|
-
if (treeChanged || isOutsideApp) {
|
|
52863
|
+
if (treeChanged || isOutsideApp || fileDeleted) {
|
|
52349
52864
|
await buildClientBundle();
|
|
52350
52865
|
await bundleRuntime2();
|
|
52351
|
-
} else {
|
|
52352
|
-
|
|
52353
|
-
|
|
52354
|
-
|
|
52355
|
-
|
|
52866
|
+
} else if (fileExists && current2 !== null) {
|
|
52867
|
+
let source = current2;
|
|
52868
|
+
if (/content=["'][^"']*\.md["']/i.test(source)) {
|
|
52869
|
+
source = inlineMdContentAttrs2(source, dirname26(fullPath), guessProjectRoots2(appDirPath));
|
|
52870
|
+
}
|
|
52871
|
+
const { comp, name } = compileClientBoth2(source, null, fullPath, { skipHyd: true });
|
|
52872
|
+
hotEditedSource = buildHmrEvalSnippet2(comp);
|
|
52873
|
+
hotActualName = name;
|
|
52356
52874
|
}
|
|
52357
52875
|
} catch (e) {
|
|
52358
52876
|
bundleError = e;
|
|
@@ -52375,7 +52893,7 @@ Object.defineProperty(__components, ${JSON.stringify(cname)}, { get: () => __com
|
|
|
52375
52893
|
if (compCode.trim()) fnSources = { _raw: compCode };
|
|
52376
52894
|
} else if (fileExists && !bundleError) {
|
|
52377
52895
|
try {
|
|
52378
|
-
const src2 =
|
|
52896
|
+
const src2 = readFileSync38(fullPath, "utf-8");
|
|
52379
52897
|
let compCode = buildHmrEvalSnippet2(
|
|
52380
52898
|
compileClient2(src2, null, { forceClient: true, sourcePath: fullPath, mdRoots: [projectDir] })
|
|
52381
52899
|
);
|
|
@@ -52397,11 +52915,11 @@ Object.defineProperty(__components, ${JSON.stringify(cname)}, { get: () => __com
|
|
|
52397
52915
|
}
|
|
52398
52916
|
if (fnSources) {
|
|
52399
52917
|
devLastError = null;
|
|
52400
|
-
const
|
|
52918
|
+
const bcast2 = globalThis.__vesk_broadcastHmr;
|
|
52401
52919
|
if (hadErrorState) {
|
|
52402
|
-
|
|
52920
|
+
bcast2({ type: "reload" });
|
|
52403
52921
|
} else {
|
|
52404
|
-
|
|
52922
|
+
bcast2({
|
|
52405
52923
|
type: "update",
|
|
52406
52924
|
time: Date.now() - t0,
|
|
52407
52925
|
components: Object.fromEntries(changedComponents.map((name) => [name, true])),
|
|
@@ -52442,6 +52960,9 @@ Object.defineProperty(__components, ${JSON.stringify(cname)}, { get: () => __com
|
|
|
52442
52960
|
globalThis.__vesk_broadcastHmr({ type: "reload" });
|
|
52443
52961
|
}
|
|
52444
52962
|
}
|
|
52963
|
+
if (!treeChanged && !isOutsideApp && !fileDeleted && fileExists && !bundleError) {
|
|
52964
|
+
queueClientChunksRefresh(fullPath, filename, fileExists);
|
|
52965
|
+
}
|
|
52445
52966
|
const cssChanged = await cssPromise;
|
|
52446
52967
|
if (cssChanged && typeof globalThis.__vesk_broadcastHmr === "function") {
|
|
52447
52968
|
globalThis.__vesk_broadcastHmr({ type: "css-update" });
|
|
@@ -52451,12 +52972,12 @@ Object.defineProperty(__components, ${JSON.stringify(cname)}, { get: () => __com
|
|
|
52451
52972
|
LOG.err(`rebuild error:`, e.message);
|
|
52452
52973
|
}
|
|
52453
52974
|
}, HMR_DEBOUNCE_MS);
|
|
52454
|
-
} else if (
|
|
52975
|
+
} else if (kind === "css") {
|
|
52455
52976
|
if (cssDebounceTimer) clearTimeout(cssDebounceTimer);
|
|
52456
52977
|
cssDebounceTimer = setTimeout(async () => {
|
|
52457
52978
|
try {
|
|
52458
52979
|
if (fileExists) {
|
|
52459
|
-
rawCss =
|
|
52980
|
+
rawCss = readFileSync38(fullPath, "utf-8");
|
|
52460
52981
|
}
|
|
52461
52982
|
const cssChanged = await rebuildTailwindCss();
|
|
52462
52983
|
if (cssChanged && typeof globalThis.__vesk_broadcastHmr === "function") {
|
|
@@ -52467,11 +52988,23 @@ Object.defineProperty(__components, ${JSON.stringify(cname)}, { get: () => __com
|
|
|
52467
52988
|
LOG.err(`CSS rebuild error:`, e.message);
|
|
52468
52989
|
}
|
|
52469
52990
|
}, HMR_DEBOUNCE_MS);
|
|
52470
|
-
} else if (
|
|
52991
|
+
} else if (kind === "config" || kind === "script") {
|
|
52471
52992
|
const isInApi = fullPath.includes("/api/");
|
|
52472
|
-
if (isInApi
|
|
52473
|
-
apiWatchCache.set(fullPath, Date.now());
|
|
52993
|
+
if (isInApi) {
|
|
52994
|
+
if (fileExists) apiWatchCache.set(fullPath, Date.now());
|
|
52995
|
+
return;
|
|
52474
52996
|
}
|
|
52997
|
+
if (debounceTimer) clearTimeout(debounceTimer);
|
|
52998
|
+
debounceTimer = setTimeout(async () => {
|
|
52999
|
+
const t0 = Date.now();
|
|
53000
|
+
try {
|
|
53001
|
+
bcast({ type: "compiling" });
|
|
53002
|
+
await fullRebuild();
|
|
53003
|
+
LOG.info(`${kind === "config" ? "config" : "script"} changed, full rebuild + reload (${filename}) \u2014 ${Date.now() - t0}ms`);
|
|
53004
|
+
} catch (e) {
|
|
53005
|
+
LOG.err(`rebuild error:`, e.message);
|
|
53006
|
+
}
|
|
53007
|
+
}, HMR_DEBOUNCE_MS);
|
|
52475
53008
|
}
|
|
52476
53009
|
});
|
|
52477
53010
|
} catch (e) {
|
|
@@ -52490,9 +53023,9 @@ Object.defineProperty(__components, ${JSON.stringify(cname)}, { get: () => __com
|
|
|
52490
53023
|
".json": "application/json",
|
|
52491
53024
|
".webmanifest": "application/manifest+json"
|
|
52492
53025
|
};
|
|
52493
|
-
const hmrJsPath =
|
|
52494
|
-
const hmrTsPath =
|
|
52495
|
-
const hmrClientPath =
|
|
53026
|
+
const hmrJsPath = join24(runtimeDir, "hmr-client.js");
|
|
53027
|
+
const hmrTsPath = join24(runtimeDir, "hmr-client.ts");
|
|
53028
|
+
const hmrClientPath = existsSync42(hmrJsPath) ? hmrJsPath : existsSync42(hmrTsPath) ? hmrTsPath : null;
|
|
52496
53029
|
function extractCompName2(src2) {
|
|
52497
53030
|
return resolveComponentName(src2);
|
|
52498
53031
|
}
|
|
@@ -52588,7 +53121,7 @@ Object.defineProperty(__components, ${JSON.stringify(cname)}, { get: () => __com
|
|
|
52588
53121
|
}
|
|
52589
53122
|
if (url.pathname === "/_vesk/hmr" || url.pathname === "/_vesk/hmr.js") {
|
|
52590
53123
|
if (hmrClientPath) {
|
|
52591
|
-
let hmrContent =
|
|
53124
|
+
let hmrContent = readFileSync38(hmrClientPath, "utf-8");
|
|
52592
53125
|
if (hmrClientPath.endsWith(".ts")) {
|
|
52593
53126
|
hmrContent = stripCodeTypes2(hmrContent);
|
|
52594
53127
|
}
|
|
@@ -52636,10 +53169,10 @@ Object.defineProperty(__components, ${JSON.stringify(cname)}, { get: () => __com
|
|
|
52636
53169
|
}
|
|
52637
53170
|
if (url.pathname !== "/") {
|
|
52638
53171
|
const staticPath = url.pathname.length > 1 ? resolveWithin2(publicDir, url.pathname.slice(1)) : null;
|
|
52639
|
-
if (staticPath &&
|
|
53172
|
+
if (staticPath && existsSync42(staticPath) && statSync21(staticPath).isFile()) {
|
|
52640
53173
|
const ext = extname8(staticPath);
|
|
52641
53174
|
res.writeHead(200, { "Content-Type": MIME3[ext] || "application/octet-stream" });
|
|
52642
|
-
res.end(
|
|
53175
|
+
res.end(readFileSync38(staticPath));
|
|
52643
53176
|
return;
|
|
52644
53177
|
}
|
|
52645
53178
|
}
|
|
@@ -52663,8 +53196,8 @@ Object.defineProperty(__components, ${JSON.stringify(cname)}, { get: () => __com
|
|
|
52663
53196
|
return;
|
|
52664
53197
|
}
|
|
52665
53198
|
const mwChain = collectMiddlewareChain(routeTree, url.pathname, appDirPath);
|
|
52666
|
-
const apiDirPath =
|
|
52667
|
-
if (url.pathname.startsWith("/api") &&
|
|
53199
|
+
const apiDirPath = join24(appDirPath, "api");
|
|
53200
|
+
if (url.pathname.startsWith("/api") && existsSync42(apiDirPath)) {
|
|
52668
53201
|
const apiRoutes = await scanApiRoutes(apiDirPath);
|
|
52669
53202
|
const apiMatch = matchApiUrl(apiRoutes, req.url || url.pathname);
|
|
52670
53203
|
if (apiMatch) {
|
|
@@ -52739,10 +53272,10 @@ Object.defineProperty(__components, ${JSON.stringify(cname)}, { get: () => __com
|
|
|
52739
53272
|
const rootNode = routeTree.find((n) => n.fullPath === "/");
|
|
52740
53273
|
let notFoundHtml = null;
|
|
52741
53274
|
if (rootNode && rootNode.notFound) {
|
|
52742
|
-
const nfPath =
|
|
52743
|
-
if (
|
|
53275
|
+
const nfPath = resolve38(appDirPath, rootNode.sourceDir, "not-found.vsk");
|
|
53276
|
+
if (existsSync42(nfPath)) {
|
|
52744
53277
|
try {
|
|
52745
|
-
const nfSrc =
|
|
53278
|
+
const nfSrc = readFileSync38(nfPath, "utf-8");
|
|
52746
53279
|
const nfCompName = extractCompName2(nfSrc) || rootNode.notFound;
|
|
52747
53280
|
notFoundHtml = await renderFullPage(nfSrc, nfCompName, { params: {}, url: url.pathname }, /* @__PURE__ */ new Map(), { hydrate: true, cssUrls: activeCssUrls(), security, externalDataScript: storeDataScript, sourcePath: nfPath, plugins: getActiveDevPlugins() });
|
|
52748
53281
|
} catch {
|
|
@@ -52784,18 +53317,18 @@ Object.defineProperty(__components, ${JSON.stringify(cname)}, { get: () => __com
|
|
|
52784
53317
|
let props;
|
|
52785
53318
|
for (let i = chain.length - 1; i >= 0; i--) {
|
|
52786
53319
|
const node = chain[i];
|
|
52787
|
-
const pageFilePath =
|
|
52788
|
-
const layoutFilePath =
|
|
52789
|
-
if (i === chain.length - 1 && node.page &&
|
|
52790
|
-
const src2 =
|
|
53320
|
+
const pageFilePath = resolve38(appDirPath, node.sourceDir, "page.vsk");
|
|
53321
|
+
const layoutFilePath = resolve38(appDirPath, node.sourceDir, "layout.vsk");
|
|
53322
|
+
if (i === chain.length - 1 && node.page && existsSync42(pageFilePath)) {
|
|
53323
|
+
const src2 = readFileSync38(pageFilePath, "utf-8");
|
|
52791
53324
|
const compName = extractCompName2(src2) || node.page;
|
|
52792
53325
|
const result = await renderPage(src2, compName, { params: matched.params }, /* @__PURE__ */ new Map(), { hydrate: true, sourcePath: pageFilePath });
|
|
52793
53326
|
body = result.body;
|
|
52794
53327
|
head = result.head || "";
|
|
52795
53328
|
props = result.props;
|
|
52796
53329
|
}
|
|
52797
|
-
if (node.layout &&
|
|
52798
|
-
const src2 =
|
|
53330
|
+
if (node.layout && existsSync42(layoutFilePath)) {
|
|
53331
|
+
const src2 = readFileSync38(layoutFilePath, "utf-8");
|
|
52799
53332
|
const compName = extractCompName2(src2) || node.layout;
|
|
52800
53333
|
const result = await renderPage(src2, compName, { children: body }, /* @__PURE__ */ new Map(), { hydrate: true, sourcePath: layoutFilePath });
|
|
52801
53334
|
body = result.body;
|
|
@@ -52805,7 +53338,7 @@ Object.defineProperty(__components, ${JSON.stringify(cname)}, { get: () => __com
|
|
|
52805
53338
|
if (forData) {
|
|
52806
53339
|
return { html: "", props: props || { params: matched.params }, head };
|
|
52807
53340
|
}
|
|
52808
|
-
const hasLayout = chain.some((n) => n.layout &&
|
|
53341
|
+
const hasLayout = chain.some((n) => n.layout && existsSync42(resolve38(appDirPath, n.sourceDir, "layout.vsk")));
|
|
52809
53342
|
let html;
|
|
52810
53343
|
if (hasLayout) {
|
|
52811
53344
|
const ssrData = currentSsrData();
|
|
@@ -52840,9 +53373,9 @@ ${prettifyHtml(body)}
|
|
|
52840
53373
|
} else {
|
|
52841
53374
|
const leaf = chain.find((n) => n.page);
|
|
52842
53375
|
if (leaf) {
|
|
52843
|
-
const src2 =
|
|
53376
|
+
const src2 = readFileSync38(resolve38(appDirPath, leaf.sourceDir, "page.vsk"), "utf-8");
|
|
52844
53377
|
const compName = extractCompName2(src2) || leaf.page;
|
|
52845
|
-
html = await renderFullPage(src2, compName, { params: matched.params }, /* @__PURE__ */ new Map(), { hydrate: true, clientScriptUrl: "/_vesk/client.js", cssUrls: activeCssUrls(), security, externalDataScript: storeDataScript, sourcePath:
|
|
53378
|
+
html = await renderFullPage(src2, compName, { params: matched.params }, /* @__PURE__ */ new Map(), { hydrate: true, clientScriptUrl: "/_vesk/client.js", cssUrls: activeCssUrls(), security, externalDataScript: storeDataScript, sourcePath: resolve38(appDirPath, leaf.sourceDir, "page.vsk"), plugins: getActiveDevPlugins() });
|
|
52846
53379
|
html = html.replace("</body>", ' <script type="module" src="/_vesk/hmr.js"></script>\n</body>');
|
|
52847
53380
|
html = await applyHtmlPlugins(html, getActiveDevPlugins(), { sourcePath: url.pathname });
|
|
52848
53381
|
} else {
|
|
@@ -52866,13 +53399,13 @@ ${prettifyHtml(body)}
|
|
|
52866
53399
|
sst.__vsk_ssr_data = {};
|
|
52867
53400
|
async function* raw2() {
|
|
52868
53401
|
const chain = cleanChain;
|
|
52869
|
-
const hasLayout = chain.some((n) => n.layout &&
|
|
53402
|
+
const hasLayout = chain.some((n) => n.layout && existsSync42(resolve38(appDirPath, n.sourceDir, "layout.vsk")));
|
|
52870
53403
|
if (!hasLayout) {
|
|
52871
53404
|
const leaf = chain.find((n) => n.page);
|
|
52872
53405
|
if (leaf) {
|
|
52873
|
-
const src2 =
|
|
53406
|
+
const src2 = readFileSync38(resolve38(appDirPath, leaf.sourceDir, "page.vsk"), "utf-8");
|
|
52874
53407
|
const compName = extractCompName2(src2) || leaf.page;
|
|
52875
|
-
yield* renderPageStream(src2, compName, { params: matched.params }, /* @__PURE__ */ new Map(), { hydrate: true, clientScriptUrl: "/_vesk/client.js", cssUrls: activeCssUrls(), security, externalDataScript: storeDataScript, sourcePath:
|
|
53408
|
+
yield* renderPageStream(src2, compName, { params: matched.params }, /* @__PURE__ */ new Map(), { hydrate: true, clientScriptUrl: "/_vesk/client.js", cssUrls: activeCssUrls(), security, externalDataScript: storeDataScript, sourcePath: resolve38(appDirPath, leaf.sourceDir, "page.vsk"), plugins: getActiveDevPlugins() });
|
|
52876
53409
|
} else {
|
|
52877
53410
|
throw new Error("No page or layout matched");
|
|
52878
53411
|
}
|
|
@@ -52883,18 +53416,18 @@ ${prettifyHtml(body)}
|
|
|
52883
53416
|
let props;
|
|
52884
53417
|
for (let i = chain.length - 1; i >= 0; i--) {
|
|
52885
53418
|
const node = chain[i];
|
|
52886
|
-
const pageFilePath =
|
|
52887
|
-
const layoutFilePath =
|
|
52888
|
-
if (i === chain.length - 1 && node.page &&
|
|
52889
|
-
const src2 =
|
|
53419
|
+
const pageFilePath = resolve38(appDirPath, node.sourceDir, "page.vsk");
|
|
53420
|
+
const layoutFilePath = resolve38(appDirPath, node.sourceDir, "layout.vsk");
|
|
53421
|
+
if (i === chain.length - 1 && node.page && existsSync42(pageFilePath)) {
|
|
53422
|
+
const src2 = readFileSync38(pageFilePath, "utf-8");
|
|
52890
53423
|
const compName = extractCompName2(src2) || node.page;
|
|
52891
53424
|
const result = await renderPage(src2, compName, { params: matched.params }, /* @__PURE__ */ new Map(), { hydrate: true, sourcePath: pageFilePath });
|
|
52892
53425
|
body = result.body;
|
|
52893
53426
|
head = result.head || "";
|
|
52894
53427
|
props = result.props;
|
|
52895
53428
|
}
|
|
52896
|
-
if (node.layout &&
|
|
52897
|
-
const src2 =
|
|
53429
|
+
if (node.layout && existsSync42(layoutFilePath)) {
|
|
53430
|
+
const src2 = readFileSync38(layoutFilePath, "utf-8");
|
|
52898
53431
|
const compName = extractCompName2(src2) || node.layout;
|
|
52899
53432
|
const result = await renderPage(src2, compName, { children: body }, /* @__PURE__ */ new Map(), { hydrate: true, sourcePath: layoutFilePath });
|
|
52900
53433
|
body = result.body;
|
|
@@ -53031,10 +53564,10 @@ ${prettifyHtml(body)}
|
|
|
53031
53564
|
for (let i = match.nodes.length - 1; i >= 0; i--) {
|
|
53032
53565
|
const node = match.nodes[i];
|
|
53033
53566
|
if (node.notFound) {
|
|
53034
|
-
const nfPath =
|
|
53035
|
-
if (
|
|
53567
|
+
const nfPath = resolve38(appDirPath, node.sourceDir, "not-found.vsk");
|
|
53568
|
+
if (existsSync42(nfPath)) {
|
|
53036
53569
|
try {
|
|
53037
|
-
const nfSrc =
|
|
53570
|
+
const nfSrc = readFileSync38(nfPath, "utf-8");
|
|
53038
53571
|
const nfCompName = extractCompName2(nfSrc) || node.notFound;
|
|
53039
53572
|
const html = await renderFullPage(nfSrc, nfCompName, { params: match.params, url: url.pathname }, /* @__PURE__ */ new Map(), { hydrate: true, cssUrls: activeCssUrls(), security, externalDataScript: storeDataScript, sourcePath: nfPath, plugins: getActiveDevPlugins() });
|
|
53040
53573
|
notFoundHtml = injectDevScripts(html);
|
|
@@ -53077,10 +53610,10 @@ ${prettifyHtml(body)}
|
|
|
53077
53610
|
for (let i = match.nodes.length - 1; i >= 0; i--) {
|
|
53078
53611
|
const node = match.nodes[i];
|
|
53079
53612
|
if (node.error) {
|
|
53080
|
-
const errPath =
|
|
53081
|
-
if (
|
|
53613
|
+
const errPath = resolve38(appDirPath, node.sourceDir, "error.vsk");
|
|
53614
|
+
if (existsSync42(errPath)) {
|
|
53082
53615
|
try {
|
|
53083
|
-
const errSrc =
|
|
53616
|
+
const errSrc = readFileSync38(errPath, "utf-8");
|
|
53084
53617
|
const errCompName = extractCompName2(errSrc) || node.error;
|
|
53085
53618
|
const errProps = {
|
|
53086
53619
|
error: err.message,
|
|
@@ -53152,7 +53685,7 @@ ${prettifyHtml(body)}
|
|
|
53152
53685
|
LOG.ok(`dev server at http://localhost:${port} (listening on ${bindHost})`);
|
|
53153
53686
|
const routes = collectRoutePaths(routeTree);
|
|
53154
53687
|
const pageCount = countPages(routeTree);
|
|
53155
|
-
const apiCount = countFilesNamed(
|
|
53688
|
+
const apiCount = countFilesNamed(join24(appDirPath, "api"), "route.ts");
|
|
53156
53689
|
LOG.info(`${projectDir}`);
|
|
53157
53690
|
LOG.info(`${pageCount} page${pageCount === 1 ? "" : "s"}: ${routes.join(", ") || "(none)"}`);
|
|
53158
53691
|
if (apiCount > 0) LOG.info(`${apiCount} api route${apiCount === 1 ? "" : "s"} (app/api)`);
|
|
@@ -53408,7 +53941,7 @@ init_action();
|
|
|
53408
53941
|
|
|
53409
53942
|
// src/index.ts
|
|
53410
53943
|
var __filename2 = fileURLToPath9(import.meta.url);
|
|
53411
|
-
var __dirname10 =
|
|
53944
|
+
var __dirname10 = resolve40(__filename2, "..");
|
|
53412
53945
|
var args = process.argv.slice(2);
|
|
53413
53946
|
var cmd = args[0];
|
|
53414
53947
|
function usage(code = 0) {
|
|
@@ -53451,12 +53984,12 @@ if (args.length === 0 || args.includes("--help") || args.includes("-h")) {
|
|
|
53451
53984
|
}
|
|
53452
53985
|
function loadEnvFiles(projectDir) {
|
|
53453
53986
|
const files = [
|
|
53454
|
-
|
|
53455
|
-
|
|
53987
|
+
join26(projectDir, ".env"),
|
|
53988
|
+
join26(projectDir, ".env.local")
|
|
53456
53989
|
];
|
|
53457
53990
|
for (const filePath of files) {
|
|
53458
|
-
if (!
|
|
53459
|
-
const content =
|
|
53991
|
+
if (!existsSync43(filePath)) continue;
|
|
53992
|
+
const content = readFileSync40(filePath, "utf-8");
|
|
53460
53993
|
for (const line of content.split("\n")) {
|
|
53461
53994
|
const trimmed = line.trim();
|
|
53462
53995
|
if (!trimmed || trimmed.startsWith("#")) continue;
|
|
@@ -53488,9 +54021,9 @@ async function loadConfig(projectDir) {
|
|
|
53488
54021
|
}
|
|
53489
54022
|
if (cmd === "build") {
|
|
53490
54023
|
const projectDir = process.cwd();
|
|
53491
|
-
const appDirPath =
|
|
53492
|
-
const publicDir =
|
|
53493
|
-
if (!
|
|
54024
|
+
const appDirPath = join26(projectDir, "app");
|
|
54025
|
+
const publicDir = join26(projectDir, "public");
|
|
54026
|
+
if (!existsSync43(appDirPath)) {
|
|
53494
54027
|
console.error(`vesk build: no app/ directory found in ${projectDir}`);
|
|
53495
54028
|
process.exit(1);
|
|
53496
54029
|
}
|
|
@@ -53560,8 +54093,8 @@ ${code}`;
|
|
|
53560
54093
|
}
|
|
53561
54094
|
if (cmd === "seo") {
|
|
53562
54095
|
const projectDir = process.cwd();
|
|
53563
|
-
const appDirPath =
|
|
53564
|
-
if (!
|
|
54096
|
+
const appDirPath = join26(projectDir, "app");
|
|
54097
|
+
if (!existsSync43(appDirPath)) {
|
|
53565
54098
|
console.error(`vesk seo: no app/ directory found in ${projectDir}`);
|
|
53566
54099
|
process.exit(1);
|
|
53567
54100
|
}
|
|
@@ -53575,8 +54108,8 @@ if (cmd === "seo") {
|
|
|
53575
54108
|
}
|
|
53576
54109
|
if (cmd === "typecheck") {
|
|
53577
54110
|
const projectDir = process.cwd();
|
|
53578
|
-
const appDirPath =
|
|
53579
|
-
if (!
|
|
54111
|
+
const appDirPath = join26(projectDir, "app");
|
|
54112
|
+
if (!existsSync43(appDirPath)) {
|
|
53580
54113
|
console.error(`vesk typecheck: no app/ directory found in ${projectDir}`);
|
|
53581
54114
|
process.exit(1);
|
|
53582
54115
|
}
|
|
@@ -53600,7 +54133,7 @@ if (cmd === "typecheck") {
|
|
|
53600
54133
|
}
|
|
53601
54134
|
if (cmd === "start") {
|
|
53602
54135
|
const projectDir = process.cwd();
|
|
53603
|
-
const outDir =
|
|
54136
|
+
const outDir = join26(projectDir, ".vesk");
|
|
53604
54137
|
const port = parsePortArg(args);
|
|
53605
54138
|
const host = parseHostArg(args);
|
|
53606
54139
|
startProdServer(outDir, { port, host });
|
|
@@ -53609,9 +54142,9 @@ if (cmd === "start") {
|
|
|
53609
54142
|
}
|
|
53610
54143
|
if (cmd === "init") {
|
|
53611
54144
|
const projectDir = process.cwd();
|
|
53612
|
-
const srcDir =
|
|
53613
|
-
const target =
|
|
53614
|
-
if (
|
|
54145
|
+
const srcDir = join26(projectDir, "src");
|
|
54146
|
+
const target = join26(srcDir, "global.css");
|
|
54147
|
+
if (existsSync43(target)) {
|
|
53615
54148
|
console.error(`vesk init: ${target} already exists \u2014 skipping`);
|
|
53616
54149
|
process.exit(0);
|
|
53617
54150
|
}
|
|
@@ -53629,10 +54162,10 @@ if (cmd === "init") {
|
|
|
53629
54162
|
}
|
|
53630
54163
|
if (cmd === "dev") {
|
|
53631
54164
|
const projectDir = process.cwd();
|
|
53632
|
-
const appDirPath =
|
|
54165
|
+
const appDirPath = join26(projectDir, "app");
|
|
53633
54166
|
const port = parsePortArg(args);
|
|
53634
54167
|
const host = parseHostArg(args);
|
|
53635
|
-
if (!
|
|
54168
|
+
if (!existsSync43(appDirPath)) {
|
|
53636
54169
|
console.error(`vesk: no app/ directory found in ${projectDir}`);
|
|
53637
54170
|
console.error('Run "npx create-vesk@latest <project-name>" first');
|
|
53638
54171
|
process.exit(1);
|