@vesk/vesk-cli 0.2.65 → 0.2.66
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 +662 -574
- package/package.json +5 -5
package/dist/cli.js
CHANGED
|
@@ -1177,10 +1177,10 @@ function run_block(block2) {
|
|
|
1177
1177
|
const res = block2.fn(block2.s);
|
|
1178
1178
|
if (typeof res === "function") {
|
|
1179
1179
|
block2.t = res;
|
|
1180
|
-
let
|
|
1181
|
-
while (
|
|
1182
|
-
|
|
1183
|
-
|
|
1180
|
+
let current3 = block2;
|
|
1181
|
+
while (current3 !== null && (current3.f & CONTAINS_TEARDOWN) === 0) {
|
|
1182
|
+
current3.f ^= CONTAINS_TEARDOWN;
|
|
1183
|
+
current3 = current3.p;
|
|
1184
1184
|
}
|
|
1185
1185
|
}
|
|
1186
1186
|
block2.d = active_dependency;
|
|
@@ -1227,13 +1227,13 @@ function create_dependency(tracked2) {
|
|
|
1227
1227
|
if (is_orphan(tracked2.b)) {
|
|
1228
1228
|
(tracked2.r ??= /* @__PURE__ */ new Set()).add(reaction);
|
|
1229
1229
|
}
|
|
1230
|
-
const
|
|
1231
|
-
if (
|
|
1232
|
-
reaction.d =
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
return
|
|
1230
|
+
const existing2 = reaction.d;
|
|
1231
|
+
if (existing2 !== null) {
|
|
1232
|
+
reaction.d = existing2.n;
|
|
1233
|
+
existing2.c = tracked2.c;
|
|
1234
|
+
existing2.t = tracked2;
|
|
1235
|
+
existing2.n = null;
|
|
1236
|
+
return existing2;
|
|
1237
1237
|
}
|
|
1238
1238
|
return {
|
|
1239
1239
|
c: tracked2.c,
|
|
@@ -1276,44 +1276,44 @@ function is_block_dirty(block2) {
|
|
|
1276
1276
|
return is_tracking_dirty(block2.d);
|
|
1277
1277
|
}
|
|
1278
1278
|
function flush_updates(root_block) {
|
|
1279
|
-
let
|
|
1279
|
+
let current3 = root_block;
|
|
1280
1280
|
const pre_effects = [];
|
|
1281
1281
|
const other_blocks = [];
|
|
1282
1282
|
const effects = [];
|
|
1283
1283
|
let scope_root = disable_scoped_flush ? root_block : null;
|
|
1284
|
-
while (
|
|
1285
|
-
const flags =
|
|
1284
|
+
while (current3 !== null) {
|
|
1285
|
+
const flags = current3.f;
|
|
1286
1286
|
const on_path = (flags & CONTAINS_UPDATE) !== 0;
|
|
1287
1287
|
if (on_path) {
|
|
1288
|
-
|
|
1288
|
+
current3.f ^= CONTAINS_UPDATE;
|
|
1289
1289
|
}
|
|
1290
1290
|
if ((flags & UPDATE_SOURCE) !== 0) {
|
|
1291
|
-
|
|
1291
|
+
current3.f ^= UPDATE_SOURCE;
|
|
1292
1292
|
if (scope_root === null) {
|
|
1293
|
-
scope_root =
|
|
1293
|
+
scope_root = current3;
|
|
1294
1294
|
}
|
|
1295
1295
|
}
|
|
1296
1296
|
if ((flags & PAUSED) === 0 && (on_path || scope_root !== null)) {
|
|
1297
1297
|
if ((flags & PRE_EFFECT_BLOCK) !== 0) {
|
|
1298
|
-
pre_effects.push(
|
|
1298
|
+
pre_effects.push(current3);
|
|
1299
1299
|
} else if ((flags & EFFECT_BLOCK) !== 0) {
|
|
1300
|
-
effects.push(
|
|
1300
|
+
effects.push(current3);
|
|
1301
1301
|
} else {
|
|
1302
|
-
other_blocks.push(
|
|
1302
|
+
other_blocks.push(current3);
|
|
1303
1303
|
}
|
|
1304
|
-
const child =
|
|
1304
|
+
const child = current3.first;
|
|
1305
1305
|
if (child !== null) {
|
|
1306
|
-
|
|
1306
|
+
current3 = child;
|
|
1307
1307
|
continue;
|
|
1308
1308
|
}
|
|
1309
1309
|
}
|
|
1310
|
-
let parent =
|
|
1311
|
-
|
|
1312
|
-
while (
|
|
1310
|
+
let parent = current3.p;
|
|
1311
|
+
current3 = current3.next;
|
|
1312
|
+
while (current3 === null && parent !== null) {
|
|
1313
1313
|
if (parent === scope_root) {
|
|
1314
1314
|
scope_root = null;
|
|
1315
1315
|
}
|
|
1316
|
-
|
|
1316
|
+
current3 = parent.next;
|
|
1317
1317
|
parent = parent.p;
|
|
1318
1318
|
}
|
|
1319
1319
|
}
|
|
@@ -1406,17 +1406,17 @@ function schedule_update(block2) {
|
|
|
1406
1406
|
queue_microtask();
|
|
1407
1407
|
}
|
|
1408
1408
|
block2.f |= UPDATE_SOURCE;
|
|
1409
|
-
let
|
|
1410
|
-
while (
|
|
1411
|
-
const flags =
|
|
1409
|
+
let current3 = block2;
|
|
1410
|
+
while (current3 !== null) {
|
|
1411
|
+
const flags = current3.f;
|
|
1412
1412
|
if ((flags & CONTAINS_UPDATE) !== 0) return;
|
|
1413
|
-
|
|
1413
|
+
current3.f ^= CONTAINS_UPDATE;
|
|
1414
1414
|
if ((flags & ROOT_BLOCK) !== 0) {
|
|
1415
1415
|
break;
|
|
1416
1416
|
}
|
|
1417
|
-
|
|
1417
|
+
current3 = current3.p;
|
|
1418
1418
|
}
|
|
1419
|
-
queued_root_blocks.push(
|
|
1419
|
+
queued_root_blocks.push(current3);
|
|
1420
1420
|
}
|
|
1421
1421
|
function register_dependency(tracked2) {
|
|
1422
1422
|
if (!disable_scoped_flush && active_block !== null && active_block !== tracked2.b) {
|
|
@@ -1445,20 +1445,20 @@ function register_dependency(tracked2) {
|
|
|
1445
1445
|
dependency = create_dependency(tracked2);
|
|
1446
1446
|
active_dependency = dependency;
|
|
1447
1447
|
} else {
|
|
1448
|
-
let
|
|
1449
|
-
while (
|
|
1450
|
-
if (
|
|
1451
|
-
|
|
1448
|
+
let current3 = dependency;
|
|
1449
|
+
while (current3 !== null) {
|
|
1450
|
+
if (current3.t === tracked2) {
|
|
1451
|
+
current3.c = tracked2.c;
|
|
1452
1452
|
return;
|
|
1453
1453
|
}
|
|
1454
|
-
const next =
|
|
1454
|
+
const next = current3.n;
|
|
1455
1455
|
if (next === null) {
|
|
1456
1456
|
break;
|
|
1457
1457
|
}
|
|
1458
|
-
|
|
1458
|
+
current3 = next;
|
|
1459
1459
|
}
|
|
1460
1460
|
dependency = create_dependency(tracked2);
|
|
1461
|
-
|
|
1461
|
+
current3.n = dependency;
|
|
1462
1462
|
}
|
|
1463
1463
|
}
|
|
1464
1464
|
function unsubscribe_reaction(reaction) {
|
|
@@ -1837,10 +1837,10 @@ var init_context = __esm({
|
|
|
1837
1837
|
* way to every reader.
|
|
1838
1838
|
*/
|
|
1839
1839
|
get() {
|
|
1840
|
-
let
|
|
1841
|
-
while (
|
|
1842
|
-
if (
|
|
1843
|
-
|
|
1840
|
+
let current3 = getActiveComponent();
|
|
1841
|
+
while (current3) {
|
|
1842
|
+
if (current3.c?.has(this)) return current3.c.get(this);
|
|
1843
|
+
current3 = current3.p;
|
|
1844
1844
|
}
|
|
1845
1845
|
return this._v;
|
|
1846
1846
|
}
|
|
@@ -1858,11 +1858,11 @@ var init_context = __esm({
|
|
|
1858
1858
|
|
|
1859
1859
|
// ../runtime/src/server-events.ts
|
|
1860
1860
|
function getStore() {
|
|
1861
|
-
const
|
|
1862
|
-
if (!
|
|
1863
|
-
|
|
1861
|
+
const g5 = globalThis;
|
|
1862
|
+
if (!g5.__vesk_server_ctx || typeof g5.__vesk_server_ctx !== "object") {
|
|
1863
|
+
g5.__vesk_server_ctx = {};
|
|
1864
1864
|
}
|
|
1865
|
-
return
|
|
1865
|
+
return g5.__vesk_server_ctx;
|
|
1866
1866
|
}
|
|
1867
1867
|
function server_locals() {
|
|
1868
1868
|
return getStore();
|
|
@@ -2126,8 +2126,8 @@ function streamText(res, into, onChunk) {
|
|
|
2126
2126
|
function settle(handle2, data2) {
|
|
2127
2127
|
if (handle2.block !== null && is_destroyed(handle2.block)) return;
|
|
2128
2128
|
if (handle2.into) setInto(handle2.into, data2);
|
|
2129
|
-
const
|
|
2130
|
-
if (!(
|
|
2129
|
+
const current3 = get(handle2.state);
|
|
2130
|
+
if (!(current3.data === data2 && !current3.loading && current3.error === null)) {
|
|
2131
2131
|
set(handle2.state, { loading: false, error: null, data: data2 });
|
|
2132
2132
|
}
|
|
2133
2133
|
handle2.settleNotify();
|
|
@@ -2136,22 +2136,22 @@ function settleError(handle2, error) {
|
|
|
2136
2136
|
if (handle2.block !== null && is_destroyed(handle2.block)) return;
|
|
2137
2137
|
if (isAbortError(error)) {
|
|
2138
2138
|
if (handle2.controller !== null) return;
|
|
2139
|
-
const
|
|
2140
|
-
if (
|
|
2139
|
+
const current4 = get(handle2.state);
|
|
2140
|
+
if (current4.loading) set(handle2.state, { loading: false, error: null, data: current4.data });
|
|
2141
2141
|
handle2.settleNotify();
|
|
2142
2142
|
return;
|
|
2143
2143
|
}
|
|
2144
|
-
const
|
|
2145
|
-
set(handle2.state, { loading: false, error, data:
|
|
2144
|
+
const current3 = get(handle2.state);
|
|
2145
|
+
set(handle2.state, { loading: false, error, data: current3.data });
|
|
2146
2146
|
handle2.settleNotify();
|
|
2147
2147
|
}
|
|
2148
2148
|
function markRefetching(handle2) {
|
|
2149
|
-
const
|
|
2150
|
-
if (
|
|
2149
|
+
const current3 = get(handle2.state);
|
|
2150
|
+
if (current3.loading) return;
|
|
2151
2151
|
set(handle2.state, {
|
|
2152
2152
|
loading: true,
|
|
2153
2153
|
error: null,
|
|
2154
|
-
data: handle2.options.keepPreviousData ?
|
|
2154
|
+
data: handle2.options.keepPreviousData ? current3.data : void 0
|
|
2155
2155
|
});
|
|
2156
2156
|
}
|
|
2157
2157
|
function attachSettle(handle2, promise) {
|
|
@@ -2217,10 +2217,10 @@ function startRequest(handle2, skipCache) {
|
|
|
2217
2217
|
});
|
|
2218
2218
|
return settled;
|
|
2219
2219
|
}
|
|
2220
|
-
const
|
|
2220
|
+
const existing2 = getInflight().get(key);
|
|
2221
2221
|
const startToken = g().__vsk_ssr_token || void 0;
|
|
2222
|
-
const prom2 =
|
|
2223
|
-
if (!
|
|
2222
|
+
const prom2 = existing2 ?? runFetcher(handle2, options.timeout || 0);
|
|
2223
|
+
if (!existing2) {
|
|
2224
2224
|
getInflight().set(key, prom2);
|
|
2225
2225
|
prom2.then(
|
|
2226
2226
|
(data2) => {
|
|
@@ -2252,10 +2252,10 @@ function startRequest(handle2, skipCache) {
|
|
|
2252
2252
|
}
|
|
2253
2253
|
}
|
|
2254
2254
|
if (options.dedupe !== false) {
|
|
2255
|
-
const
|
|
2256
|
-
if (
|
|
2257
|
-
attachSettle(handle2,
|
|
2258
|
-
return
|
|
2255
|
+
const existing2 = getInflight().get(key);
|
|
2256
|
+
if (existing2) {
|
|
2257
|
+
attachSettle(handle2, existing2);
|
|
2258
|
+
return existing2;
|
|
2259
2259
|
}
|
|
2260
2260
|
}
|
|
2261
2261
|
markRefetching(handle2);
|
|
@@ -2398,8 +2398,8 @@ function createResource(fn, key, into, options = {}) {
|
|
|
2398
2398
|
on_destroy(() => {
|
|
2399
2399
|
if (is_destroyed(handle2.block)) {
|
|
2400
2400
|
handle2.controller?.abort();
|
|
2401
|
-
const
|
|
2402
|
-
if (
|
|
2401
|
+
const current3 = getRegistry().get(resourceKey);
|
|
2402
|
+
if (current3) current3.delete(handle2);
|
|
2403
2403
|
}
|
|
2404
2404
|
});
|
|
2405
2405
|
}
|
|
@@ -2860,9 +2860,9 @@ function createHydrateWalker(container, markerList) {
|
|
|
2860
2860
|
}
|
|
2861
2861
|
function bumpNavEpoch() {
|
|
2862
2862
|
try {
|
|
2863
|
-
const
|
|
2864
|
-
const next = (
|
|
2865
|
-
|
|
2863
|
+
const g5 = globalThis;
|
|
2864
|
+
const next = (g5.__vesk_nav_epoch || 0) + 1;
|
|
2865
|
+
g5.__vesk_nav_epoch = next;
|
|
2866
2866
|
return next;
|
|
2867
2867
|
} catch {
|
|
2868
2868
|
return 0;
|
|
@@ -4009,8 +4009,8 @@ function LoadingIndicator(props = {}, _registry, hydrate) {
|
|
|
4009
4009
|
if (hydrate && typeof hydrate.nextElement === "function") {
|
|
4010
4010
|
el = hydrate.nextElement("div");
|
|
4011
4011
|
if (el && !el.parentNode && hydrate.root) {
|
|
4012
|
-
const
|
|
4013
|
-
if (
|
|
4012
|
+
const existing2 = hydrate.root.querySelector(`[${INDICATOR_ATTR}]`);
|
|
4013
|
+
if (existing2) el = existing2;
|
|
4014
4014
|
}
|
|
4015
4015
|
} else {
|
|
4016
4016
|
el = document.createElement("div");
|
|
@@ -4330,8 +4330,8 @@ function NavLink(props, registry, hydrate) {
|
|
|
4330
4330
|
if (hydrate && hydrate.nextElement) {
|
|
4331
4331
|
let a2 = hydrate.nextElement("a");
|
|
4332
4332
|
if (a2 && !a2.parentNode && hydrate.root) {
|
|
4333
|
-
const
|
|
4334
|
-
if (
|
|
4333
|
+
const existing2 = hydrate.root.querySelector("a");
|
|
4334
|
+
if (existing2) a2 = existing2;
|
|
4335
4335
|
}
|
|
4336
4336
|
const claimed = a2 ? a2.parentNode !== null : false;
|
|
4337
4337
|
if (!a2) a2 = document.createElement("a");
|
|
@@ -4779,8 +4779,8 @@ async function fetchRouteData(path) {
|
|
|
4779
4779
|
}
|
|
4780
4780
|
function getRouteData(path, scope2) {
|
|
4781
4781
|
const key = scope2 === void 0 ? path : path + "\0" + scope2;
|
|
4782
|
-
const
|
|
4783
|
-
if (
|
|
4782
|
+
const existing2 = _dataPromises.get(key);
|
|
4783
|
+
if (existing2) return existing2;
|
|
4784
4784
|
const p = fetchRouteData(path).finally(() => {
|
|
4785
4785
|
_dataPromises.delete(key);
|
|
4786
4786
|
});
|
|
@@ -5604,8 +5604,8 @@ function createRouter(routes, options = {}) {
|
|
|
5604
5604
|
},
|
|
5605
5605
|
_runGuards(to) {
|
|
5606
5606
|
const from = get(_state.path) || window.location.pathname;
|
|
5607
|
-
for (const
|
|
5608
|
-
const d =
|
|
5607
|
+
for (const g5 of this._beforeGuards ?? []) {
|
|
5608
|
+
const d = g5(to, from);
|
|
5609
5609
|
if (d instanceof Promise) {
|
|
5610
5610
|
return d.then((r) => {
|
|
5611
5611
|
if (r === false || typeof r === "string") return r;
|
|
@@ -5931,8 +5931,8 @@ function createFileRouter(routeTree, options = {}) {
|
|
|
5931
5931
|
},
|
|
5932
5932
|
_runGuards(to) {
|
|
5933
5933
|
const from = get(_state.path) || window.location.pathname;
|
|
5934
|
-
for (const
|
|
5935
|
-
const d =
|
|
5934
|
+
for (const g5 of this._beforeGuards ?? []) {
|
|
5935
|
+
const d = g5(to, from);
|
|
5936
5936
|
if (d instanceof Promise) {
|
|
5937
5937
|
return d.then((r) => {
|
|
5938
5938
|
if (r === false || typeof r === "string") return r;
|
|
@@ -6377,6 +6377,58 @@ var init_router = __esm({
|
|
|
6377
6377
|
}
|
|
6378
6378
|
});
|
|
6379
6379
|
|
|
6380
|
+
// ../runtime/src/security-overrides.ts
|
|
6381
|
+
function resolveAls() {
|
|
6382
|
+
try {
|
|
6383
|
+
const proc = g2.process;
|
|
6384
|
+
const mod = proc?.getBuiltinModule?.("async_hooks");
|
|
6385
|
+
const ctor = mod?.AsyncLocalStorage;
|
|
6386
|
+
return ctor ? new ctor() : null;
|
|
6387
|
+
} catch {
|
|
6388
|
+
return null;
|
|
6389
|
+
}
|
|
6390
|
+
}
|
|
6391
|
+
function current() {
|
|
6392
|
+
if (als) return als.getStore() ?? null;
|
|
6393
|
+
return fallbackStore;
|
|
6394
|
+
}
|
|
6395
|
+
function runWithSecurityOverrides(fn) {
|
|
6396
|
+
const bag = {};
|
|
6397
|
+
if (als) return als.run(bag, fn);
|
|
6398
|
+
const prev = fallbackStore;
|
|
6399
|
+
fallbackStore = bag;
|
|
6400
|
+
try {
|
|
6401
|
+
return fn();
|
|
6402
|
+
} finally {
|
|
6403
|
+
fallbackStore = prev;
|
|
6404
|
+
}
|
|
6405
|
+
}
|
|
6406
|
+
function setSecurityOverride(key, value) {
|
|
6407
|
+
const bag = current();
|
|
6408
|
+
if (bag) bag[key] = value;
|
|
6409
|
+
}
|
|
6410
|
+
function getSecurityOverrides() {
|
|
6411
|
+
const bag = current();
|
|
6412
|
+
if (!bag) return null;
|
|
6413
|
+
return Object.keys(bag).length > 0 ? bag : null;
|
|
6414
|
+
}
|
|
6415
|
+
var g2, als, fallbackStore, bridge, existing;
|
|
6416
|
+
var init_security_overrides = __esm({
|
|
6417
|
+
"../runtime/src/security-overrides.ts"() {
|
|
6418
|
+
"use strict";
|
|
6419
|
+
g2 = globalThis;
|
|
6420
|
+
als = resolveAls();
|
|
6421
|
+
fallbackStore = null;
|
|
6422
|
+
bridge = {
|
|
6423
|
+
run: runWithSecurityOverrides,
|
|
6424
|
+
get: getSecurityOverrides,
|
|
6425
|
+
set: setSecurityOverride
|
|
6426
|
+
};
|
|
6427
|
+
existing = g2.__vesk_security || {};
|
|
6428
|
+
g2.__vesk_security = { ...existing, ...bridge };
|
|
6429
|
+
}
|
|
6430
|
+
});
|
|
6431
|
+
|
|
6380
6432
|
// ../../node_modules/acorn/dist/acorn.mjs
|
|
6381
6433
|
var acorn_exports = {};
|
|
6382
6434
|
__export(acorn_exports, {
|
|
@@ -10098,7 +10150,7 @@ var init_acorn = __esm({
|
|
|
10098
10150
|
}
|
|
10099
10151
|
return i + 2;
|
|
10100
10152
|
};
|
|
10101
|
-
RegExpValidationState.prototype.current = function
|
|
10153
|
+
RegExpValidationState.prototype.current = function current2(forceU) {
|
|
10102
10154
|
if (forceU === void 0) forceU = false;
|
|
10103
10155
|
return this.at(this.pos, forceU);
|
|
10104
10156
|
};
|
|
@@ -10123,8 +10175,8 @@ var init_acorn = __esm({
|
|
|
10123
10175
|
var pos = this.pos;
|
|
10124
10176
|
for (var i = 0, list = chs; i < list.length; i += 1) {
|
|
10125
10177
|
var ch = list[i];
|
|
10126
|
-
var
|
|
10127
|
-
if (
|
|
10178
|
+
var current3 = this.at(pos, forceU);
|
|
10179
|
+
if (current3 === -1 || current3 !== ch) {
|
|
10128
10180
|
return false;
|
|
10129
10181
|
}
|
|
10130
10182
|
pos = this.nextIndex(pos, forceU);
|
|
@@ -20367,8 +20419,8 @@ function collectModuleSpecifiers(ast) {
|
|
|
20367
20419
|
return specs;
|
|
20368
20420
|
}
|
|
20369
20421
|
function collectModuleBundled(absPath, collector) {
|
|
20370
|
-
const
|
|
20371
|
-
if (
|
|
20422
|
+
const existing2 = collector.keysByAbs.get(absPath);
|
|
20423
|
+
if (existing2) return existing2;
|
|
20372
20424
|
const key = `__veskMod${collector.keysByAbs.size}`;
|
|
20373
20425
|
collector.keysByAbs.set(absPath, key);
|
|
20374
20426
|
const dir = dirname2(absPath);
|
|
@@ -22417,16 +22469,16 @@ function generateIR(ast, source, filename) {
|
|
|
22417
22469
|
if (called.has(fn)) usedFunctions.add(fn);
|
|
22418
22470
|
}
|
|
22419
22471
|
if (usedFunctions.size > 0) {
|
|
22420
|
-
const
|
|
22472
|
+
const existing2 = /* @__PURE__ */ new Set();
|
|
22421
22473
|
for (const imp of imports) {
|
|
22422
22474
|
if (importModuleTarget(imp) !== "@vesk/runtime") continue;
|
|
22423
|
-
for (const n of extractImportNames(imp))
|
|
22475
|
+
for (const n of extractImportNames(imp)) existing2.add(n);
|
|
22424
22476
|
}
|
|
22425
22477
|
const boundLocally = /* @__PURE__ */ new Set();
|
|
22426
22478
|
for (const imp of imports) {
|
|
22427
22479
|
for (const pair of importBindingPairs(imp)) boundLocally.add(pair.local);
|
|
22428
22480
|
}
|
|
22429
|
-
const missing = [...usedFunctions].filter((f) => !
|
|
22481
|
+
const missing = [...usedFunctions].filter((f) => !existing2.has(f) && !boundLocally.has(f));
|
|
22430
22482
|
if (missing.length > 0) {
|
|
22431
22483
|
imports.push(`import { ${missing.join(", ")} } from '@vesk/runtime';`);
|
|
22432
22484
|
}
|
|
@@ -22836,16 +22888,16 @@ function sha256Bytes(msg) {
|
|
|
22836
22888
|
const s1 = rr(w[j - 2], 17) ^ rr(w[j - 2], 19) ^ w[j - 2] >>> 10;
|
|
22837
22889
|
w[j] = w[j - 16] + s0 + w[j - 7] + s1 >>> 0;
|
|
22838
22890
|
}
|
|
22839
|
-
let a = h0, b = h1, c = h2, d = h3, e = h4, f = h5,
|
|
22891
|
+
let a = h0, b = h1, c = h2, d = h3, e = h4, f = h5, g5 = h6, h = h7;
|
|
22840
22892
|
for (let j = 0; j < 64; j++) {
|
|
22841
22893
|
const S1 = rr(e, 6) ^ rr(e, 11) ^ rr(e, 25);
|
|
22842
|
-
const ch = e & f ^ ~e &
|
|
22894
|
+
const ch = e & f ^ ~e & g5;
|
|
22843
22895
|
const t1 = h + S1 + ch + SHA_K[j] + w[j] >>> 0;
|
|
22844
22896
|
const S0 = rr(a, 2) ^ rr(a, 13) ^ rr(a, 22);
|
|
22845
22897
|
const maj = a & b ^ a & c ^ b & c;
|
|
22846
22898
|
const t2 = S0 + maj >>> 0;
|
|
22847
|
-
h =
|
|
22848
|
-
|
|
22899
|
+
h = g5;
|
|
22900
|
+
g5 = f;
|
|
22849
22901
|
f = e;
|
|
22850
22902
|
e = d + t1 >>> 0;
|
|
22851
22903
|
d = c;
|
|
@@ -22859,7 +22911,7 @@ function sha256Bytes(msg) {
|
|
|
22859
22911
|
h3 = h3 + d >>> 0;
|
|
22860
22912
|
h4 = h4 + e >>> 0;
|
|
22861
22913
|
h5 = h5 + f >>> 0;
|
|
22862
|
-
h6 = h6 +
|
|
22914
|
+
h6 = h6 + g5 >>> 0;
|
|
22863
22915
|
h7 = h7 + h >>> 0;
|
|
22864
22916
|
}
|
|
22865
22917
|
const out = new Uint8Array(32);
|
|
@@ -23882,7 +23934,7 @@ function headers() {
|
|
|
23882
23934
|
}
|
|
23883
23935
|
function applyRequestSecurity(request, response) {
|
|
23884
23936
|
if (!request || !response) return;
|
|
23885
|
-
const overrides = request.getSecurityOverrides?.() || {};
|
|
23937
|
+
const overrides = getSecurityOverrides() || request.getSecurityOverrides?.() || {};
|
|
23886
23938
|
if (overrides.contentSecurityPolicy !== void 0) {
|
|
23887
23939
|
response.setCsp(overrides.contentSecurityPolicy);
|
|
23888
23940
|
}
|
|
@@ -23962,6 +24014,7 @@ var ServerRequest, ServerResponse, DEFAULT_MAX_BODY_BYTES2, PayloadTooLargeError
|
|
|
23962
24014
|
var init_request = __esm({
|
|
23963
24015
|
"../runtime/src/request.ts"() {
|
|
23964
24016
|
"use strict";
|
|
24017
|
+
init_security_overrides();
|
|
23965
24018
|
ServerRequest = class extends Request {
|
|
23966
24019
|
_cookies;
|
|
23967
24020
|
_params;
|
|
@@ -24203,19 +24256,25 @@ var init_request = __esm({
|
|
|
24203
24256
|
}
|
|
24204
24257
|
setCsp(policy) {
|
|
24205
24258
|
this._security.contentSecurityPolicy = policy;
|
|
24259
|
+
setSecurityOverride("contentSecurityPolicy", policy);
|
|
24206
24260
|
}
|
|
24207
24261
|
setRateLimit(options) {
|
|
24208
24262
|
this._security.rateLimit = options;
|
|
24263
|
+
setSecurityOverride("rateLimit", options);
|
|
24209
24264
|
}
|
|
24210
24265
|
setCsrf(enable) {
|
|
24211
24266
|
this._security.csrf = enable;
|
|
24267
|
+
setSecurityOverride("csrf", enable);
|
|
24212
24268
|
}
|
|
24213
24269
|
setSecurityHeader(name, value) {
|
|
24214
24270
|
if (!this._security.customHeaders) this._security.customHeaders = {};
|
|
24215
24271
|
this._security.customHeaders[name] = value;
|
|
24272
|
+
const existing2 = this._security.customHeaders;
|
|
24273
|
+
setSecurityOverride("customHeaders", { ...existing2 });
|
|
24216
24274
|
}
|
|
24217
24275
|
setTrustProxy(enable) {
|
|
24218
24276
|
this._security.trustProxy = enable;
|
|
24277
|
+
setSecurityOverride("trustProxy", enable);
|
|
24219
24278
|
}
|
|
24220
24279
|
getSecurityOverrides() {
|
|
24221
24280
|
return this._security;
|
|
@@ -24313,14 +24372,14 @@ var init_request = __esm({
|
|
|
24313
24372
|
_flushSecurityHeaders() {
|
|
24314
24373
|
for (const [name, value] of Object.entries(this._secHeaders)) {
|
|
24315
24374
|
if (value === null) continue;
|
|
24316
|
-
const
|
|
24317
|
-
if (!
|
|
24375
|
+
const existing2 = this.headers?.get(name);
|
|
24376
|
+
if (!existing2) this.headers?.set(name, value);
|
|
24318
24377
|
}
|
|
24319
24378
|
this._secHeaders = {};
|
|
24320
24379
|
if (this._cookieHeaders.length > 0) {
|
|
24321
|
-
const
|
|
24322
|
-
if (
|
|
24323
|
-
this.headers?.set("Set-Cookie",
|
|
24380
|
+
const existing2 = this.headers?.get("Set-Cookie");
|
|
24381
|
+
if (existing2) {
|
|
24382
|
+
this.headers?.set("Set-Cookie", existing2 + ", " + this._cookieHeaders.join(", "));
|
|
24324
24383
|
} else {
|
|
24325
24384
|
this.headers?.set("Set-Cookie", this._cookieHeaders.join(", "));
|
|
24326
24385
|
}
|
|
@@ -24780,8 +24839,8 @@ function Experiment(props) {
|
|
|
24780
24839
|
}
|
|
24781
24840
|
if (track3 && assignedVariant && typeof window !== "undefined") {
|
|
24782
24841
|
const w = window;
|
|
24783
|
-
const
|
|
24784
|
-
|
|
24842
|
+
const existing2 = w.__vsk_experiments || (w.__vsk_experiments = []);
|
|
24843
|
+
existing2.push({ experiment: name, variant: assignedVariant.name || "default" });
|
|
24785
24844
|
}
|
|
24786
24845
|
return assignedVariant ? assignedVariant.children || assignedVariant.content || null : defaultContent;
|
|
24787
24846
|
}
|
|
@@ -24855,8 +24914,8 @@ function Field(props, registry, hydrate) {
|
|
|
24855
24914
|
if (hydrate && hydrate.nextElement) {
|
|
24856
24915
|
let wrapper2 = hydrate.nextElement("div");
|
|
24857
24916
|
if (wrapper2 && !wrapper2.parentNode && hydrate.root) {
|
|
24858
|
-
const
|
|
24859
|
-
if (
|
|
24917
|
+
const existing2 = hydrate.root.querySelector(`[data-vsk-field="${name}"]`);
|
|
24918
|
+
if (existing2) wrapper2 = existing2;
|
|
24860
24919
|
}
|
|
24861
24920
|
const inner = wrapper2 ? wrapper2.querySelector(`[data-vsk-field="${name}"]`) : null;
|
|
24862
24921
|
const fieldEl = inner || wrapper2;
|
|
@@ -24998,8 +25057,8 @@ function Form(props, registry, hydrate) {
|
|
|
24998
25057
|
const skipK = typeof hydrate.takeSkipK === "function" ? hydrate.takeSkipK() : 0;
|
|
24999
25058
|
let form2 = hydrate.nextElement("form", skipK);
|
|
25000
25059
|
if (form2 && !form2.parentNode && hydrate.root) {
|
|
25001
|
-
const
|
|
25002
|
-
if (
|
|
25060
|
+
const existing2 = hydrate.root.querySelector("form");
|
|
25061
|
+
if (existing2) form2 = existing2;
|
|
25003
25062
|
}
|
|
25004
25063
|
if (form2) {
|
|
25005
25064
|
form2.noValidate = true;
|
|
@@ -26857,8 +26916,8 @@ function Md(props, _registry, hydrate) {
|
|
|
26857
26916
|
if (hydrate && typeof hydrate.nextElement === "function") {
|
|
26858
26917
|
let el = hydrate.nextElement("div");
|
|
26859
26918
|
if (el && !el.parentNode && hydrate.root) {
|
|
26860
|
-
const
|
|
26861
|
-
if (
|
|
26919
|
+
const existing2 = hydrate.root.querySelector("div");
|
|
26920
|
+
if (existing2) el = existing2;
|
|
26862
26921
|
}
|
|
26863
26922
|
const claimed = !!el.parentNode;
|
|
26864
26923
|
if (pathMode && claimed) {
|
|
@@ -27428,18 +27487,18 @@ function rerenderNode(node, deps, call) {
|
|
|
27428
27487
|
if (typeof document === "undefined") return node;
|
|
27429
27488
|
if (deps.length === 0) return node;
|
|
27430
27489
|
let owned = null;
|
|
27431
|
-
let
|
|
27490
|
+
let current3 = null;
|
|
27432
27491
|
if (Array.isArray(node)) {
|
|
27433
27492
|
const roots = node.filter((n) => n && typeof n.nodeType === "number");
|
|
27434
27493
|
owned = roots.length ? roots : null;
|
|
27435
|
-
|
|
27494
|
+
current3 = owned ? owned[0] : null;
|
|
27436
27495
|
} else if (node && typeof node.nodeType === "number") {
|
|
27437
|
-
|
|
27496
|
+
current3 = node;
|
|
27438
27497
|
}
|
|
27439
|
-
if (!
|
|
27498
|
+
if (!current3) return node;
|
|
27440
27499
|
const liveRange = () => {
|
|
27441
27500
|
if (owned) return owned;
|
|
27442
|
-
return
|
|
27501
|
+
return current3 && current3.parentNode ? [current3] : null;
|
|
27443
27502
|
};
|
|
27444
27503
|
let seen = deps.map(readDep);
|
|
27445
27504
|
effect(() => {
|
|
@@ -27455,7 +27514,7 @@ function rerenderNode(node, deps, call) {
|
|
|
27455
27514
|
for (const freshNode of fresh) parent.insertBefore(freshNode, old[0]);
|
|
27456
27515
|
for (const oldNode of old) if (oldNode.parentNode) oldNode.parentNode.removeChild(oldNode);
|
|
27457
27516
|
owned = next.nodeType === 11 ? fresh : null;
|
|
27458
|
-
|
|
27517
|
+
current3 = fresh[0] ?? current3;
|
|
27459
27518
|
});
|
|
27460
27519
|
return node;
|
|
27461
27520
|
}
|
|
@@ -27471,9 +27530,9 @@ var init_primitive = __esm({
|
|
|
27471
27530
|
|
|
27472
27531
|
// ../runtime/src/action.ts
|
|
27473
27532
|
function getActionRegistry() {
|
|
27474
|
-
const
|
|
27475
|
-
if (!
|
|
27476
|
-
return
|
|
27533
|
+
const g5 = globalThis;
|
|
27534
|
+
if (!g5[registryKey]) g5[registryKey] = {};
|
|
27535
|
+
return g5[registryKey];
|
|
27477
27536
|
}
|
|
27478
27537
|
function hashString(str3) {
|
|
27479
27538
|
let h1 = 2166136261;
|
|
@@ -27511,8 +27570,8 @@ function getAction(id) {
|
|
|
27511
27570
|
return getActionRegistry()[id] || null;
|
|
27512
27571
|
}
|
|
27513
27572
|
function clearActions() {
|
|
27514
|
-
const
|
|
27515
|
-
|
|
27573
|
+
const g5 = globalThis;
|
|
27574
|
+
g5[registryKey] = {};
|
|
27516
27575
|
}
|
|
27517
27576
|
function isFormAction(action) {
|
|
27518
27577
|
return typeof action === "object" && action !== null && (action.__veskAction === true || typeof action.id === "string" && typeof action.url === "string");
|
|
@@ -27725,8 +27784,8 @@ function setIn(value, path, next) {
|
|
|
27725
27784
|
const [key, ...rest] = path;
|
|
27726
27785
|
const container = Array.isArray(value) ? value : isObject(value) ? value : null;
|
|
27727
27786
|
if (container === null) return value;
|
|
27728
|
-
const
|
|
27729
|
-
if (rest.length > 0 &&
|
|
27787
|
+
const current3 = Array.isArray(container) ? container[typeof key === "number" ? key : Number(key)] : container[String(key)];
|
|
27788
|
+
if (rest.length > 0 && current3 === void 0) return value;
|
|
27730
27789
|
if (Array.isArray(value)) {
|
|
27731
27790
|
const index = typeof key === "number" ? key : Number(key);
|
|
27732
27791
|
if (!Number.isInteger(index) || index < 0) return value;
|
|
@@ -27747,18 +27806,18 @@ function updateIn(value, path, fn) {
|
|
|
27747
27806
|
return setIn(value, [key], next);
|
|
27748
27807
|
}
|
|
27749
27808
|
function getIn(value, path) {
|
|
27750
|
-
let
|
|
27809
|
+
let current3 = value;
|
|
27751
27810
|
for (const key of path) {
|
|
27752
|
-
if (Array.isArray(
|
|
27811
|
+
if (Array.isArray(current3)) {
|
|
27753
27812
|
const index = typeof key === "number" ? key : Number(key);
|
|
27754
27813
|
if (!Number.isInteger(index)) return void 0;
|
|
27755
|
-
|
|
27814
|
+
current3 = current3[index];
|
|
27756
27815
|
continue;
|
|
27757
27816
|
}
|
|
27758
|
-
if (!isObject(
|
|
27759
|
-
|
|
27817
|
+
if (!isObject(current3)) return void 0;
|
|
27818
|
+
current3 = current3[String(key)];
|
|
27760
27819
|
}
|
|
27761
|
-
return
|
|
27820
|
+
return current3;
|
|
27762
27821
|
}
|
|
27763
27822
|
var init_nested_update = __esm({
|
|
27764
27823
|
"../runtime/src/nested-update.ts"() {
|
|
@@ -27768,8 +27827,8 @@ var init_nested_update = __esm({
|
|
|
27768
27827
|
|
|
27769
27828
|
// ../runtime/src/store-persistence.ts
|
|
27770
27829
|
function currentSsrToken() {
|
|
27771
|
-
const
|
|
27772
|
-
return typeof
|
|
27830
|
+
const g5 = globalThis;
|
|
27831
|
+
return typeof g5.__vsk_ssr_token === "string" ? g5.__vsk_ssr_token : "";
|
|
27773
27832
|
}
|
|
27774
27833
|
function persistedStoreCookieName(storageKey) {
|
|
27775
27834
|
return "vsk_store_" + encodeURIComponent(storageKey);
|
|
@@ -27866,23 +27925,23 @@ function createStore(initial, options = {}) {
|
|
|
27866
27925
|
let batchDepth = 0;
|
|
27867
27926
|
let dirty = false;
|
|
27868
27927
|
function notifyNow(action, payload) {
|
|
27869
|
-
const
|
|
27870
|
-
if (
|
|
27871
|
-
subs.forEach((fn) => fn(
|
|
27928
|
+
const current3 = stateCell.get();
|
|
27929
|
+
if (current3 === prevValue) return;
|
|
27930
|
+
subs.forEach((fn) => fn(current3));
|
|
27872
27931
|
watchers.forEach(({ selector, cb, equals }) => {
|
|
27873
27932
|
const eq = equals ?? Object.is;
|
|
27874
|
-
const newVal = selector(
|
|
27933
|
+
const newVal = selector(current3);
|
|
27875
27934
|
const oldVal = selector(prevValue);
|
|
27876
27935
|
if (!eq(newVal, oldVal)) cb(newVal, oldVal);
|
|
27877
27936
|
});
|
|
27878
|
-
middlewares.forEach((fn) => fn(
|
|
27937
|
+
middlewares.forEach((fn) => fn(current3, action, payload));
|
|
27879
27938
|
if (devtools && typeof window !== "undefined") {
|
|
27880
27939
|
const dt = window.__VESK_STORE_DEVTOOLS__;
|
|
27881
27940
|
if (dt && typeof dt.send === "function") {
|
|
27882
|
-
dt.send({ type: action, payload, state: structuredClone(
|
|
27941
|
+
dt.send({ type: action, payload, state: structuredClone(current3) });
|
|
27883
27942
|
}
|
|
27884
27943
|
}
|
|
27885
|
-
prevValue = cloneState(
|
|
27944
|
+
prevValue = cloneState(current3);
|
|
27886
27945
|
}
|
|
27887
27946
|
function notifyDirty(action, payload) {
|
|
27888
27947
|
if (batchDepth > 0) {
|
|
@@ -27909,17 +27968,17 @@ function createStore(initial, options = {}) {
|
|
|
27909
27968
|
notifyDirty(action, next);
|
|
27910
27969
|
}
|
|
27911
27970
|
function update(partialOrFn, action = "update") {
|
|
27912
|
-
const
|
|
27913
|
-
const patch = typeof partialOrFn === "function" ? partialOrFn(
|
|
27914
|
-
const next = Object.assign(cloneState(
|
|
27971
|
+
const current3 = stateCell.get();
|
|
27972
|
+
const patch = typeof partialOrFn === "function" ? partialOrFn(current3) : partialOrFn;
|
|
27973
|
+
const next = Object.assign(cloneState(current3), patch);
|
|
27915
27974
|
stateCell.set(next);
|
|
27916
27975
|
persistToStorage();
|
|
27917
27976
|
notifyDirty(action, patch);
|
|
27918
27977
|
}
|
|
27919
27978
|
function deleteKeys(keys, action = "delete") {
|
|
27920
|
-
const
|
|
27979
|
+
const current3 = stateCell.get();
|
|
27921
27980
|
const kArray = Array.isArray(keys) ? keys : [keys];
|
|
27922
|
-
const next = cloneState(
|
|
27981
|
+
const next = cloneState(current3);
|
|
27923
27982
|
kArray.forEach((k) => {
|
|
27924
27983
|
delete next[k];
|
|
27925
27984
|
});
|
|
@@ -28085,8 +28144,8 @@ function isStrictPrefix(prefix, full) {
|
|
|
28085
28144
|
function cloneValue(value, seen) {
|
|
28086
28145
|
if (value === null || typeof value !== "object") return value;
|
|
28087
28146
|
seen = seen ?? /* @__PURE__ */ new Map();
|
|
28088
|
-
const
|
|
28089
|
-
if (
|
|
28147
|
+
const existing2 = seen.get(value);
|
|
28148
|
+
if (existing2 !== void 0) return existing2;
|
|
28090
28149
|
if (value instanceof Date) {
|
|
28091
28150
|
const d = new Date(value.getTime());
|
|
28092
28151
|
seen.set(value, d);
|
|
@@ -28520,8 +28579,8 @@ function createPathStore(initial, options = {}) {
|
|
|
28520
28579
|
const subscribers = /* @__PURE__ */ new Set();
|
|
28521
28580
|
const watchers = /* @__PURE__ */ new Set();
|
|
28522
28581
|
function dispatchAll() {
|
|
28523
|
-
const
|
|
28524
|
-
for (const wrapper of subscribers) wrapper(
|
|
28582
|
+
const current3 = buildMerged();
|
|
28583
|
+
for (const wrapper of subscribers) wrapper(current3);
|
|
28525
28584
|
for (const wrapper of watchers) wrapper();
|
|
28526
28585
|
}
|
|
28527
28586
|
function whyAt(tokens, depth = 0, versionNow = version2) {
|
|
@@ -28706,7 +28765,7 @@ function createPathStore(initial, options = {}) {
|
|
|
28706
28765
|
prev = selected;
|
|
28707
28766
|
fn(selected);
|
|
28708
28767
|
}
|
|
28709
|
-
} : (
|
|
28768
|
+
} : (current3) => fn(current3);
|
|
28710
28769
|
subscribers.add(wrapper);
|
|
28711
28770
|
wrapper(buildMerged());
|
|
28712
28771
|
return () => {
|
|
@@ -34735,8 +34794,8 @@ function isThenable(value) {
|
|
|
34735
34794
|
return typeof value?.then === "function";
|
|
34736
34795
|
}
|
|
34737
34796
|
function withSsrStore(fn) {
|
|
34738
|
-
const
|
|
34739
|
-
if (
|
|
34797
|
+
const existing2 = storage.getStore();
|
|
34798
|
+
if (existing2) return fn();
|
|
34740
34799
|
const store = createSsrStore();
|
|
34741
34800
|
keepSsrSlot(store.token);
|
|
34742
34801
|
let result;
|
|
@@ -34778,15 +34837,15 @@ function dropSsrSlot(token) {
|
|
|
34778
34837
|
function isSsrSlotLive(token) {
|
|
34779
34838
|
return liveSlots.has(token);
|
|
34780
34839
|
}
|
|
34781
|
-
var TOKEN_KEY, IMPL_KEY,
|
|
34840
|
+
var TOKEN_KEY, IMPL_KEY, g3, impl, storage, liveSlots, ssrSink2;
|
|
34782
34841
|
var init_ssr_store = __esm({
|
|
34783
34842
|
"../compiler/src/ssr-store.ts"() {
|
|
34784
34843
|
"use strict";
|
|
34785
34844
|
init_index_server();
|
|
34786
34845
|
TOKEN_KEY = "__vsk_ssr_token";
|
|
34787
34846
|
IMPL_KEY = "__vsk_ssr_store_impl";
|
|
34788
|
-
|
|
34789
|
-
impl =
|
|
34847
|
+
g3 = globalThis;
|
|
34848
|
+
impl = g3[IMPL_KEY] ?? (g3[IMPL_KEY] = {
|
|
34790
34849
|
storage: new AsyncLocalStorage(),
|
|
34791
34850
|
liveSlots: /* @__PURE__ */ new Map(),
|
|
34792
34851
|
// Only the copy that created the implementation installs the token
|
|
@@ -35093,17 +35152,17 @@ async function settleSsrPromises(token) {
|
|
|
35093
35152
|
}
|
|
35094
35153
|
}
|
|
35095
35154
|
function pruneSsrDataSlots() {
|
|
35096
|
-
const
|
|
35155
|
+
const g5 = globalThis;
|
|
35097
35156
|
const prefix = "__vsk_ssr_data_";
|
|
35098
35157
|
const stale = [];
|
|
35099
|
-
for (const k of Object.keys(
|
|
35158
|
+
for (const k of Object.keys(g5)) {
|
|
35100
35159
|
if (typeof k !== "string" || !k.startsWith(prefix)) continue;
|
|
35101
35160
|
if (isSsrSlotLive(k.slice(prefix.length))) continue;
|
|
35102
35161
|
stale.push(k);
|
|
35103
35162
|
}
|
|
35104
35163
|
if (stale.length <= 40) return;
|
|
35105
35164
|
stale.sort().slice(0, stale.length - 40).forEach((k) => {
|
|
35106
|
-
delete
|
|
35165
|
+
delete g5[k];
|
|
35107
35166
|
});
|
|
35108
35167
|
}
|
|
35109
35168
|
async function applyHeadPlugins(headHtml, plugins, ctx2) {
|
|
@@ -35832,9 +35891,9 @@ function getPluginRecords(appDir, veskDir, configPluginNames) {
|
|
|
35832
35891
|
}
|
|
35833
35892
|
function setPluginActive(veskDir, name, active) {
|
|
35834
35893
|
const state = readPluginState(veskDir);
|
|
35835
|
-
const
|
|
35836
|
-
if (
|
|
35837
|
-
|
|
35894
|
+
const existing2 = state.plugins.find((p) => eqIgnoreCase(p.name, name));
|
|
35895
|
+
if (existing2) {
|
|
35896
|
+
existing2.active = active;
|
|
35838
35897
|
} else {
|
|
35839
35898
|
state.plugins.push({ name, package: name, active });
|
|
35840
35899
|
}
|
|
@@ -35914,13 +35973,13 @@ async function installPlugin(appDir, veskDir, pkg) {
|
|
|
35914
35973
|
}
|
|
35915
35974
|
const state = readPluginState(veskDir);
|
|
35916
35975
|
const name = probe.packageJson?.name || pkg;
|
|
35917
|
-
const
|
|
35976
|
+
const existing2 = state.plugins.find(
|
|
35918
35977
|
(p) => eqIgnoreCase(p.package, pkg) || eqIgnoreCase(p.name, name)
|
|
35919
35978
|
);
|
|
35920
|
-
if (
|
|
35921
|
-
|
|
35922
|
-
|
|
35923
|
-
|
|
35979
|
+
if (existing2) {
|
|
35980
|
+
existing2.package = pkg;
|
|
35981
|
+
existing2.name = name;
|
|
35982
|
+
existing2.active = true;
|
|
35924
35983
|
} else {
|
|
35925
35984
|
state.plugins.push({ name, package: pkg, active: true });
|
|
35926
35985
|
}
|
|
@@ -35958,12 +36017,12 @@ async function updatePlugin(appDir, veskDir, pkg) {
|
|
|
35958
36017
|
const probe = resolvePackage(appDir, pkg);
|
|
35959
36018
|
const state = readPluginState(veskDir);
|
|
35960
36019
|
const name = probe.packageJson?.name || pkg;
|
|
35961
|
-
const
|
|
36020
|
+
const existing2 = state.plugins.find(
|
|
35962
36021
|
(p) => eqIgnoreCase(p.package, pkg) || eqIgnoreCase(p.name, name)
|
|
35963
36022
|
);
|
|
35964
|
-
if (
|
|
35965
|
-
|
|
35966
|
-
|
|
36023
|
+
if (existing2) {
|
|
36024
|
+
existing2.package = pkg;
|
|
36025
|
+
existing2.name = name;
|
|
35967
36026
|
} else {
|
|
35968
36027
|
state.plugins.push({ name, package: pkg, active: true });
|
|
35969
36028
|
}
|
|
@@ -35972,7 +36031,7 @@ async function updatePlugin(appDir, veskDir, pkg) {
|
|
|
35972
36031
|
name,
|
|
35973
36032
|
pkg,
|
|
35974
36033
|
source: "state",
|
|
35975
|
-
activeRaw:
|
|
36034
|
+
activeRaw: existing2 ? existing2.active : true,
|
|
35976
36035
|
error: null
|
|
35977
36036
|
}, appDir);
|
|
35978
36037
|
}
|
|
@@ -40145,9 +40204,9 @@ function Md2(props, _registry, hydrate) {
|
|
|
40145
40204
|
if (hydrate && typeof hydrate.nextElement === "function") {
|
|
40146
40205
|
let el = hydrate.nextElement("div");
|
|
40147
40206
|
if (el && !el.parentNode && hydrate.root) {
|
|
40148
|
-
const
|
|
40149
|
-
if (
|
|
40150
|
-
el =
|
|
40207
|
+
const existing2 = hydrate.root.querySelector("div");
|
|
40208
|
+
if (existing2)
|
|
40209
|
+
el = existing2;
|
|
40151
40210
|
}
|
|
40152
40211
|
const claimed = !!el.parentNode;
|
|
40153
40212
|
if (pathMode && claimed) {
|
|
@@ -41122,9 +41181,9 @@ function getJSXTagName2(el) {
|
|
|
41122
41181
|
if (name.type === "JSXNamespacedName") return name.namespace.name + ":" + name.name.name;
|
|
41123
41182
|
return null;
|
|
41124
41183
|
}
|
|
41125
|
-
function emitJSXText(
|
|
41184
|
+
function emitJSXText(g5, text, start, end) {
|
|
41126
41185
|
if (text.indexOf("<") === -1 && text.indexOf(">") === -1 && text.indexOf("&") === -1 && text.indexOf("{") === -1 && text.indexOf("}") === -1) {
|
|
41127
|
-
|
|
41186
|
+
g5.add(text, start, end);
|
|
41128
41187
|
return;
|
|
41129
41188
|
}
|
|
41130
41189
|
let out = "";
|
|
@@ -41137,7 +41196,7 @@ function emitJSXText(g4, text, start, end) {
|
|
|
41137
41196
|
else if (c === "}") out += "}";
|
|
41138
41197
|
else out += c;
|
|
41139
41198
|
}
|
|
41140
|
-
|
|
41199
|
+
g5.add(out, start, end);
|
|
41141
41200
|
}
|
|
41142
41201
|
function collapseWithMap(value) {
|
|
41143
41202
|
let out = "";
|
|
@@ -41294,31 +41353,31 @@ function stripCallTypeArgs(text) {
|
|
|
41294
41353
|
}
|
|
41295
41354
|
return text;
|
|
41296
41355
|
}
|
|
41297
|
-
function emitTrackDeclStatement(
|
|
41356
|
+
function emitTrackDeclStatement(g5, source, stmt, indent4, isLast, opts) {
|
|
41298
41357
|
const fullText = stripTrailingSemicolons(source.slice(stmt.start, stmt.end).trimEnd());
|
|
41299
41358
|
const text = fullText + (!fullText.endsWith("}") && !isLast ? ";" : "");
|
|
41300
41359
|
const decls = stmt.declarations || [];
|
|
41301
|
-
|
|
41360
|
+
g5.add(indent4);
|
|
41302
41361
|
let prevEnd = stmt.start;
|
|
41303
41362
|
for (let di = 0; di < decls.length; di++) {
|
|
41304
41363
|
const decl = decls[di];
|
|
41305
41364
|
const id = decl.id;
|
|
41306
41365
|
const isLazy = id && id.type === "ArrayPattern" && id.lazy === true && decl.init;
|
|
41307
41366
|
if (!isLazy) {
|
|
41308
|
-
|
|
41309
|
-
|
|
41367
|
+
g5.addRaw(source.slice(prevEnd, decl.start));
|
|
41368
|
+
g5.add(source.slice(decl.start, decl.end), decl.start, decl.end);
|
|
41310
41369
|
prevEnd = decl.end;
|
|
41311
41370
|
continue;
|
|
41312
41371
|
}
|
|
41313
|
-
if (di > 0)
|
|
41372
|
+
if (di > 0) g5.addRaw(source.slice(prevEnd, decl.start));
|
|
41314
41373
|
const ch = text[decl.end - stmt.start] ?? " ";
|
|
41315
41374
|
const elements = id.elements || [];
|
|
41316
41375
|
const names = elements.map((el) => el ? el.name : null).filter((n) => typeof n === "string");
|
|
41317
41376
|
const initText = source.slice(decl.init.start, decl.init.end);
|
|
41318
41377
|
if (names.length === 0) {
|
|
41319
|
-
|
|
41320
|
-
|
|
41321
|
-
if (ch !== ";")
|
|
41378
|
+
g5.add("let _ = ");
|
|
41379
|
+
g5.add(initText, decl.init.start, decl.init.end);
|
|
41380
|
+
if (ch !== ";") g5.addRaw(";");
|
|
41322
41381
|
prevEnd = decl.end;
|
|
41323
41382
|
continue;
|
|
41324
41383
|
}
|
|
@@ -41329,133 +41388,133 @@ function emitTrackDeclStatement(g4, source, stmt, indent4, isLast, opts) {
|
|
|
41329
41388
|
const firstRange = [elements[0].start, elements[0].end];
|
|
41330
41389
|
const dropLastSemi = ch === ";";
|
|
41331
41390
|
if (opts.typedCells) {
|
|
41332
|
-
const cellName =
|
|
41333
|
-
|
|
41391
|
+
const cellName = g5.cellCount === 0 ? "__cell" : `__cell${g5.cellCount}`;
|
|
41392
|
+
g5.cellCount++;
|
|
41334
41393
|
if (annotation) {
|
|
41335
|
-
|
|
41336
|
-
|
|
41337
|
-
|
|
41394
|
+
g5.add(`const ${cellName}: Tracked<`);
|
|
41395
|
+
g5.add(annotation, annStart, annEnd);
|
|
41396
|
+
g5.add("> = ");
|
|
41338
41397
|
} else {
|
|
41339
|
-
|
|
41398
|
+
g5.add(`const ${cellName} = `);
|
|
41340
41399
|
}
|
|
41341
41400
|
const cellInit = annotation ? stripCallTypeArgs(initText) : initText;
|
|
41342
|
-
|
|
41343
|
-
|
|
41344
|
-
|
|
41345
|
-
|
|
41401
|
+
g5.add(cellInit, decl.init.start, decl.init.end);
|
|
41402
|
+
g5.add(";");
|
|
41403
|
+
g5.add(" let ");
|
|
41404
|
+
g5.add(first, firstRange[0], firstRange[1], REACTIVE_DATA);
|
|
41346
41405
|
if (annotation) {
|
|
41347
|
-
|
|
41348
|
-
|
|
41406
|
+
g5.add(": ");
|
|
41407
|
+
g5.add(annotation, annStart, annEnd);
|
|
41349
41408
|
}
|
|
41350
|
-
|
|
41409
|
+
g5.add(` = ${cellName}.get();`);
|
|
41351
41410
|
for (let n = 1; n < names.length; n++) {
|
|
41352
|
-
|
|
41353
|
-
|
|
41354
|
-
|
|
41411
|
+
g5.add(" let ");
|
|
41412
|
+
g5.add(names[n], elements[n].start, elements[n].end, REACTIVE_DATA);
|
|
41413
|
+
g5.add(` = ${cellName};`);
|
|
41355
41414
|
}
|
|
41356
|
-
if (dropLastSemi)
|
|
41415
|
+
if (dropLastSemi) g5.code = g5.code.slice(0, -1);
|
|
41357
41416
|
} else {
|
|
41358
41417
|
if (annotation) {
|
|
41359
|
-
|
|
41360
|
-
|
|
41361
|
-
|
|
41362
|
-
|
|
41363
|
-
|
|
41364
|
-
|
|
41365
|
-
|
|
41366
|
-
|
|
41367
|
-
|
|
41418
|
+
g5.add("let ");
|
|
41419
|
+
g5.add(first, firstRange[0], firstRange[1], REACTIVE_DATA);
|
|
41420
|
+
g5.add(": ");
|
|
41421
|
+
g5.add(annotation, annStart, annEnd);
|
|
41422
|
+
g5.add(" = (");
|
|
41423
|
+
g5.add(stripCallTypeArgs(initText), decl.init.start, decl.init.end);
|
|
41424
|
+
g5.add(" as unknown as ");
|
|
41425
|
+
g5.add(annotation, annStart, annEnd);
|
|
41426
|
+
g5.add(");");
|
|
41368
41427
|
} else {
|
|
41369
|
-
const cellName =
|
|
41370
|
-
|
|
41371
|
-
|
|
41372
|
-
|
|
41373
|
-
|
|
41374
|
-
|
|
41375
|
-
|
|
41428
|
+
const cellName = g5.cellCount === 0 ? "__cell" : `__cell${g5.cellCount}`;
|
|
41429
|
+
g5.cellCount++;
|
|
41430
|
+
g5.add(`const ${cellName} = `);
|
|
41431
|
+
g5.add(initText, decl.init.start, decl.init.end);
|
|
41432
|
+
g5.add("; let ");
|
|
41433
|
+
g5.add(first, firstRange[0], firstRange[1], REACTIVE_DATA);
|
|
41434
|
+
g5.add(` = ${cellName}.get();`);
|
|
41376
41435
|
}
|
|
41377
41436
|
for (let n = 1; n < names.length; n++) {
|
|
41378
|
-
|
|
41379
|
-
|
|
41380
|
-
|
|
41381
|
-
|
|
41382
|
-
|
|
41383
|
-
if (n === names.length - 1 && dropLastSemi)
|
|
41437
|
+
g5.add(" let ");
|
|
41438
|
+
g5.add(names[n], elements[n].start, elements[n].end, REACTIVE_DATA);
|
|
41439
|
+
g5.add(": any = ");
|
|
41440
|
+
g5.add(first, firstRange[0], firstRange[1]);
|
|
41441
|
+
g5.add(";");
|
|
41442
|
+
if (n === names.length - 1 && dropLastSemi) g5.code = g5.code.slice(0, -1);
|
|
41384
41443
|
}
|
|
41385
|
-
if (names.length === 1 && dropLastSemi)
|
|
41444
|
+
if (names.length === 1 && dropLastSemi) g5.code = g5.code.slice(0, -1);
|
|
41386
41445
|
}
|
|
41387
41446
|
prevEnd = decl.end;
|
|
41388
41447
|
}
|
|
41389
|
-
if (!isLast)
|
|
41448
|
+
if (!isLast) g5.addRaw(";");
|
|
41390
41449
|
}
|
|
41391
|
-
function emitBlock(
|
|
41450
|
+
function emitBlock(g5, source, body, indent4, opts) {
|
|
41392
41451
|
const stmts = body && body.type === "BlockStatement" ? body.body : body ? Array.isArray(body) ? body : [body] : [];
|
|
41393
|
-
|
|
41394
|
-
emitBody(
|
|
41395
|
-
|
|
41396
|
-
|
|
41397
|
-
|
|
41452
|
+
g5.addRaw("{\n");
|
|
41453
|
+
emitBody(g5, source, stmts, indent4 + " ", opts);
|
|
41454
|
+
g5.addRaw("\n");
|
|
41455
|
+
g5.add(indent4);
|
|
41456
|
+
g5.addRaw("}");
|
|
41398
41457
|
}
|
|
41399
|
-
function emitJSXAttr(
|
|
41458
|
+
function emitJSXAttr(g5, source, attr) {
|
|
41400
41459
|
if (attr.type === "JSXSpreadAttribute") {
|
|
41401
|
-
|
|
41460
|
+
g5.add(source.slice(attr.start, attr.end), attr.start, attr.end);
|
|
41402
41461
|
return;
|
|
41403
41462
|
}
|
|
41404
41463
|
const name = attr.name;
|
|
41405
|
-
|
|
41464
|
+
g5.add(source.slice(name.start, name.end), name.start, name.end);
|
|
41406
41465
|
const v = attr.value;
|
|
41407
41466
|
if (!v) return;
|
|
41408
|
-
|
|
41467
|
+
g5.add(source.slice(name.end, v.start), name.end, v.start);
|
|
41409
41468
|
if (v.type === "JSXExpressionContainer") {
|
|
41410
|
-
|
|
41411
|
-
|
|
41412
|
-
|
|
41469
|
+
g5.add(source.slice(v.start, v.expression.start), v.start, v.expression.start);
|
|
41470
|
+
g5.add(source.slice(v.expression.start, v.expression.end), v.expression.start, v.expression.end);
|
|
41471
|
+
g5.add(source.slice(v.expression.end, v.end), v.expression.end, v.end);
|
|
41413
41472
|
} else {
|
|
41414
|
-
|
|
41473
|
+
g5.add(source.slice(v.start, v.end), v.start, v.end);
|
|
41415
41474
|
}
|
|
41416
41475
|
}
|
|
41417
|
-
function emitJSXElement(
|
|
41476
|
+
function emitJSXElement(g5, source, el, opts, hoist) {
|
|
41418
41477
|
const op = el.openingElement;
|
|
41419
41478
|
const name = op.name;
|
|
41420
41479
|
let prev;
|
|
41421
41480
|
if (name) {
|
|
41422
|
-
|
|
41423
|
-
|
|
41481
|
+
g5.add(source.slice(op.start, name.start), op.start, name.start);
|
|
41482
|
+
g5.add(source.slice(name.start, name.end), name.start, name.end);
|
|
41424
41483
|
prev = name.end;
|
|
41425
41484
|
} else {
|
|
41426
41485
|
prev = op.start + 1;
|
|
41427
41486
|
}
|
|
41428
41487
|
for (const attr of op.attributes ?? []) {
|
|
41429
|
-
|
|
41430
|
-
emitJSXAttr(
|
|
41488
|
+
g5.add(source.slice(prev, attr.start), prev, attr.start);
|
|
41489
|
+
emitJSXAttr(g5, source, attr);
|
|
41431
41490
|
prev = attr.end;
|
|
41432
41491
|
}
|
|
41433
41492
|
const tail = source.slice(prev, op.end);
|
|
41434
41493
|
if (op.selfClosing && !tail.includes("/")) {
|
|
41435
41494
|
const gt = tail.lastIndexOf(">");
|
|
41436
41495
|
const head = gt === -1 ? tail : tail.slice(0, gt);
|
|
41437
|
-
if (head)
|
|
41438
|
-
|
|
41496
|
+
if (head) g5.add(head, prev, prev + head.length);
|
|
41497
|
+
g5.addRaw("/>");
|
|
41439
41498
|
} else {
|
|
41440
|
-
|
|
41499
|
+
g5.add(tail, prev, op.end);
|
|
41441
41500
|
}
|
|
41442
41501
|
if (op.selfClosing) return;
|
|
41443
|
-
emitJSXChildren(
|
|
41502
|
+
emitJSXChildren(g5, source, el.children ?? [], opts, hoist);
|
|
41444
41503
|
if (el.closingElement) {
|
|
41445
|
-
|
|
41504
|
+
g5.add(source.slice(el.closingElement.start, el.closingElement.end), el.closingElement.start, el.closingElement.end);
|
|
41446
41505
|
}
|
|
41447
41506
|
}
|
|
41448
|
-
function emitJSXExprBody(
|
|
41449
|
-
if (expr.type === "JSXElement") return emitJSXElement(
|
|
41450
|
-
if (expr.type === "JSXFragment") return emitJSXFragment(
|
|
41451
|
-
|
|
41507
|
+
function emitJSXExprBody(g5, source, expr, opts) {
|
|
41508
|
+
if (expr.type === "JSXElement") return emitJSXElement(g5, source, expr, opts);
|
|
41509
|
+
if (expr.type === "JSXFragment") return emitJSXFragment(g5, source, expr, opts);
|
|
41510
|
+
g5.add(source.slice(expr.start, expr.end), expr.start, expr.end);
|
|
41452
41511
|
}
|
|
41453
|
-
function emitJSXFragment(
|
|
41454
|
-
|
|
41455
|
-
emitJSXChildren(
|
|
41456
|
-
|
|
41512
|
+
function emitJSXFragment(g5, source, frag, opts, hoist) {
|
|
41513
|
+
g5.addRaw("<>");
|
|
41514
|
+
emitJSXChildren(g5, source, frag.children ?? [], opts, hoist);
|
|
41515
|
+
g5.addRaw("</>");
|
|
41457
41516
|
}
|
|
41458
|
-
function emitForClauseMap(
|
|
41517
|
+
function emitForClauseMap(g5, source, child, text, map, clauseStart, bodyEmit, emptyEmit) {
|
|
41459
41518
|
const clauseEnd = findBalancedEnd(text, clauseStart - 1);
|
|
41460
41519
|
const clause = text.slice(clauseStart, clauseEnd);
|
|
41461
41520
|
const ofIdx = findTopLevelSep(clause, "of");
|
|
@@ -41472,38 +41531,38 @@ function emitForClauseMap(g4, source, child, text, map, clauseStart, bodyEmit, e
|
|
|
41472
41531
|
const itemVar = stripDeclKeyword(lhs).trim();
|
|
41473
41532
|
if (ofIdx !== -1) {
|
|
41474
41533
|
if (emptyEmit) {
|
|
41475
|
-
|
|
41476
|
-
|
|
41477
|
-
|
|
41534
|
+
g5.addRaw("{ (() => { const _v = ");
|
|
41535
|
+
g5.add(arrExpr, arrStart, arrEnd);
|
|
41536
|
+
g5.addRaw("; return _v.length === 0 ? (");
|
|
41478
41537
|
emptyEmit();
|
|
41479
|
-
|
|
41480
|
-
|
|
41481
|
-
|
|
41538
|
+
g5.addRaw(") : _v.map((");
|
|
41539
|
+
g5.addRaw(itemVar);
|
|
41540
|
+
g5.addRaw(": (typeof _v)[number]) => (");
|
|
41482
41541
|
bodyEmit();
|
|
41483
|
-
|
|
41542
|
+
g5.addRaw(")); })() }");
|
|
41484
41543
|
} else {
|
|
41485
|
-
|
|
41486
|
-
|
|
41487
|
-
|
|
41488
|
-
|
|
41489
|
-
|
|
41490
|
-
|
|
41491
|
-
|
|
41544
|
+
g5.addRaw("{ ");
|
|
41545
|
+
g5.add(arrExpr, arrStart, arrEnd);
|
|
41546
|
+
g5.addRaw(".map((");
|
|
41547
|
+
g5.addRaw(itemVar);
|
|
41548
|
+
g5.addRaw(": (typeof ");
|
|
41549
|
+
g5.add(arrExpr, arrStart, arrEnd);
|
|
41550
|
+
g5.addRaw(")[number]) => (");
|
|
41492
41551
|
bodyEmit();
|
|
41493
|
-
|
|
41552
|
+
g5.addRaw(")) }");
|
|
41494
41553
|
}
|
|
41495
41554
|
} else {
|
|
41496
|
-
|
|
41497
|
-
|
|
41498
|
-
|
|
41499
|
-
|
|
41500
|
-
|
|
41555
|
+
g5.addRaw("{ Object.keys(");
|
|
41556
|
+
g5.add(arrExpr, arrStart, arrEnd);
|
|
41557
|
+
g5.addRaw(").map((");
|
|
41558
|
+
g5.addRaw(itemVar);
|
|
41559
|
+
g5.addRaw(") => (");
|
|
41501
41560
|
bodyEmit();
|
|
41502
|
-
|
|
41561
|
+
g5.addRaw(")) }");
|
|
41503
41562
|
}
|
|
41504
41563
|
return true;
|
|
41505
41564
|
}
|
|
41506
|
-
function emitJSXChildren(
|
|
41565
|
+
function emitJSXChildren(g5, source, children, opts, hoist) {
|
|
41507
41566
|
let i = 0;
|
|
41508
41567
|
let forPending = false;
|
|
41509
41568
|
while (i < children.length) {
|
|
@@ -41529,46 +41588,46 @@ function emitJSXChildren(g4, source, children, opts, hoist) {
|
|
|
41529
41588
|
const emptyContainer = children[i + 3];
|
|
41530
41589
|
if (emptyTextNode && emptyTextNode.type === "JSXText" && ["#empty", "empty"].includes(emptyTextNode.value.trim()) && emptyContainer && emptyContainer.type === "JSXExpressionContainer" && emptyContainer.expression.type !== "JSXEmptyExpression") {
|
|
41531
41590
|
consumed = 4;
|
|
41532
|
-
emptyEmit = () => emitJSXExprBody(
|
|
41591
|
+
emptyEmit = () => emitJSXExprBody(g5, source, emptyContainer.expression, opts);
|
|
41533
41592
|
}
|
|
41534
41593
|
let matched = false;
|
|
41535
41594
|
if (nextChild.type === "JSXExpressionContainer") {
|
|
41536
41595
|
const exprNode = nextChild.expression;
|
|
41537
41596
|
if (exprNode.type === "JSXEmptyExpression") {
|
|
41538
|
-
|
|
41597
|
+
g5.add(text, child.start, child.end);
|
|
41539
41598
|
i++;
|
|
41540
41599
|
continue;
|
|
41541
41600
|
}
|
|
41542
41601
|
matched = emitForClauseMap(
|
|
41543
|
-
|
|
41602
|
+
g5,
|
|
41544
41603
|
source,
|
|
41545
41604
|
child,
|
|
41546
41605
|
text,
|
|
41547
41606
|
map,
|
|
41548
41607
|
clauseStartCollapsed,
|
|
41549
|
-
() => emitJSXExprBody(
|
|
41608
|
+
() => emitJSXExprBody(g5, source, exprNode, opts),
|
|
41550
41609
|
emptyEmit
|
|
41551
41610
|
);
|
|
41552
41611
|
} else if (nextChild.type === "JSXFragment") {
|
|
41553
41612
|
matched = emitForClauseMap(
|
|
41554
|
-
|
|
41613
|
+
g5,
|
|
41555
41614
|
source,
|
|
41556
41615
|
child,
|
|
41557
41616
|
text,
|
|
41558
41617
|
map,
|
|
41559
41618
|
clauseStartCollapsed,
|
|
41560
|
-
() => emitJSXFragment(
|
|
41619
|
+
() => emitJSXFragment(g5, source, nextChild, opts),
|
|
41561
41620
|
emptyEmit
|
|
41562
41621
|
);
|
|
41563
41622
|
} else {
|
|
41564
41623
|
matched = emitForClauseMap(
|
|
41565
|
-
|
|
41624
|
+
g5,
|
|
41566
41625
|
source,
|
|
41567
41626
|
child,
|
|
41568
41627
|
text,
|
|
41569
41628
|
map,
|
|
41570
41629
|
clauseStartCollapsed,
|
|
41571
|
-
() => emitJSXElement(
|
|
41630
|
+
() => emitJSXElement(g5, source, nextChild, opts),
|
|
41572
41631
|
emptyEmit
|
|
41573
41632
|
);
|
|
41574
41633
|
}
|
|
@@ -41585,184 +41644,184 @@ function emitJSXChildren(g4, source, children, opts, hoist) {
|
|
|
41585
41644
|
continue;
|
|
41586
41645
|
}
|
|
41587
41646
|
forPending = false;
|
|
41588
|
-
emitJSXText(
|
|
41647
|
+
emitJSXText(g5, text, child.start, child.end);
|
|
41589
41648
|
i++;
|
|
41590
41649
|
} else if (child.type === "JSXExpressionContainer") {
|
|
41591
41650
|
if (child.expression.type === "JSXEmptyExpression") {
|
|
41592
41651
|
i++;
|
|
41593
41652
|
continue;
|
|
41594
41653
|
}
|
|
41595
|
-
|
|
41596
|
-
|
|
41597
|
-
|
|
41654
|
+
g5.addRaw("{");
|
|
41655
|
+
g5.add(source.slice(child.expression.start, child.expression.end), child.expression.start, child.expression.end);
|
|
41656
|
+
g5.addRaw("}");
|
|
41598
41657
|
i++;
|
|
41599
41658
|
} else if (child.type === "JSXElement") {
|
|
41600
41659
|
if (getJSXTagName2(child) === "style") {
|
|
41601
41660
|
const openEnd = child.openingElement?.end ?? child.start;
|
|
41602
41661
|
const closeStart = child.closingElement?.start ?? child.end;
|
|
41603
|
-
|
|
41662
|
+
g5.recordStyle(child.start, child.end, source.slice(openEnd, closeStart));
|
|
41604
41663
|
i++;
|
|
41605
41664
|
continue;
|
|
41606
41665
|
}
|
|
41607
|
-
emitJSXElement(
|
|
41666
|
+
emitJSXElement(g5, source, child, opts, hoist);
|
|
41608
41667
|
i++;
|
|
41609
41668
|
} else if (child.type === "JSXFragment") {
|
|
41610
|
-
emitJSXFragment(
|
|
41669
|
+
emitJSXFragment(g5, source, child, opts, hoist);
|
|
41611
41670
|
i++;
|
|
41612
41671
|
} else if (child.type === "IfStatement" || child.type === "ForOfStatement" || child.type === "ForStatement" || child.type === "ForInStatement" || child.type === "WhileStatement" || child.type === "DoWhileStatement" || child.type === "SwitchStatement" || child.type === "TryStatement" || child.type === "VariableDeclaration" || child.type === "ExpressionStatement") {
|
|
41613
41672
|
if (hoist && hoist.set.has(child)) {
|
|
41614
41673
|
i++;
|
|
41615
41674
|
continue;
|
|
41616
41675
|
}
|
|
41617
|
-
|
|
41618
|
-
emitBody(
|
|
41619
|
-
|
|
41676
|
+
g5.addRaw("{(() => { ");
|
|
41677
|
+
emitBody(g5, source, [child], "", opts);
|
|
41678
|
+
g5.addRaw(" })()}");
|
|
41620
41679
|
i++;
|
|
41621
41680
|
} else {
|
|
41622
41681
|
i++;
|
|
41623
41682
|
}
|
|
41624
41683
|
}
|
|
41625
41684
|
}
|
|
41626
|
-
function emitIf(
|
|
41627
|
-
|
|
41628
|
-
|
|
41629
|
-
|
|
41630
|
-
|
|
41631
|
-
emitBlock(
|
|
41685
|
+
function emitIf(g5, source, stmt, indent4, opts) {
|
|
41686
|
+
g5.add(indent4);
|
|
41687
|
+
g5.addRaw("if (");
|
|
41688
|
+
g5.add(source.slice(stmt.test.start, stmt.test.end), stmt.test.start, stmt.test.end);
|
|
41689
|
+
g5.addRaw(") ");
|
|
41690
|
+
emitBlock(g5, source, stmt.consequent, indent4, opts);
|
|
41632
41691
|
if (stmt.alternate) {
|
|
41633
|
-
|
|
41634
|
-
emitBlock(
|
|
41692
|
+
g5.addRaw(" else ");
|
|
41693
|
+
emitBlock(g5, source, stmt.alternate, indent4, opts);
|
|
41635
41694
|
}
|
|
41636
41695
|
}
|
|
41637
|
-
function emitLoopVariable(
|
|
41696
|
+
function emitLoopVariable(g5, source, left) {
|
|
41638
41697
|
if (left && left.type === "Identifier") {
|
|
41639
|
-
|
|
41640
|
-
|
|
41698
|
+
g5.addRaw("const ");
|
|
41699
|
+
g5.add(source.slice(left.start, left.end), left.start, left.end);
|
|
41641
41700
|
return;
|
|
41642
41701
|
}
|
|
41643
|
-
|
|
41644
|
-
}
|
|
41645
|
-
function emitForOf(
|
|
41646
|
-
|
|
41647
|
-
|
|
41648
|
-
emitLoopVariable(
|
|
41649
|
-
|
|
41650
|
-
|
|
41651
|
-
|
|
41652
|
-
emitBlock(
|
|
41653
|
-
}
|
|
41654
|
-
function emitForIn(
|
|
41655
|
-
|
|
41656
|
-
|
|
41657
|
-
emitLoopVariable(
|
|
41658
|
-
|
|
41659
|
-
|
|
41660
|
-
|
|
41661
|
-
emitBlock(
|
|
41662
|
-
}
|
|
41663
|
-
function emitFor(
|
|
41664
|
-
|
|
41665
|
-
|
|
41666
|
-
if (stmt.init)
|
|
41667
|
-
|
|
41668
|
-
if (stmt.test)
|
|
41669
|
-
|
|
41670
|
-
if (stmt.update)
|
|
41671
|
-
|
|
41672
|
-
emitBlock(
|
|
41673
|
-
}
|
|
41674
|
-
function emitWhile(
|
|
41675
|
-
|
|
41676
|
-
|
|
41677
|
-
|
|
41678
|
-
|
|
41679
|
-
emitBlock(
|
|
41680
|
-
}
|
|
41681
|
-
function emitDoWhile(
|
|
41682
|
-
|
|
41683
|
-
|
|
41684
|
-
emitBlock(
|
|
41685
|
-
|
|
41686
|
-
|
|
41687
|
-
|
|
41688
|
-
}
|
|
41689
|
-
function emitSwitch(
|
|
41690
|
-
|
|
41691
|
-
|
|
41692
|
-
|
|
41693
|
-
|
|
41702
|
+
g5.add(source.slice(left.start, left.end), left.start, left.end);
|
|
41703
|
+
}
|
|
41704
|
+
function emitForOf(g5, source, stmt, indent4, opts) {
|
|
41705
|
+
g5.add(indent4);
|
|
41706
|
+
g5.addRaw("for (");
|
|
41707
|
+
emitLoopVariable(g5, source, stmt.left);
|
|
41708
|
+
g5.addRaw(" of ");
|
|
41709
|
+
g5.add(source.slice(stmt.right.start, stmt.right.end), stmt.right.start, stmt.right.end);
|
|
41710
|
+
g5.addRaw(") ");
|
|
41711
|
+
emitBlock(g5, source, stmt.body, indent4, opts);
|
|
41712
|
+
}
|
|
41713
|
+
function emitForIn(g5, source, stmt, indent4, opts) {
|
|
41714
|
+
g5.add(indent4);
|
|
41715
|
+
g5.addRaw("for (");
|
|
41716
|
+
emitLoopVariable(g5, source, stmt.left);
|
|
41717
|
+
g5.addRaw(" in ");
|
|
41718
|
+
g5.add(source.slice(stmt.right.start, stmt.right.end), stmt.right.start, stmt.right.end);
|
|
41719
|
+
g5.addRaw(") ");
|
|
41720
|
+
emitBlock(g5, source, stmt.body, indent4, opts);
|
|
41721
|
+
}
|
|
41722
|
+
function emitFor(g5, source, stmt, indent4, opts) {
|
|
41723
|
+
g5.add(indent4);
|
|
41724
|
+
g5.addRaw("for (");
|
|
41725
|
+
if (stmt.init) g5.add(source.slice(stmt.init.start, stmt.init.end), stmt.init.start, stmt.init.end);
|
|
41726
|
+
g5.addRaw("; ");
|
|
41727
|
+
if (stmt.test) g5.add(source.slice(stmt.test.start, stmt.test.end), stmt.test.start, stmt.test.end);
|
|
41728
|
+
g5.addRaw("; ");
|
|
41729
|
+
if (stmt.update) g5.add(source.slice(stmt.update.start, stmt.update.end), stmt.update.start, stmt.update.end);
|
|
41730
|
+
g5.addRaw(") ");
|
|
41731
|
+
emitBlock(g5, source, stmt.body, indent4, opts);
|
|
41732
|
+
}
|
|
41733
|
+
function emitWhile(g5, source, stmt, indent4, opts) {
|
|
41734
|
+
g5.add(indent4);
|
|
41735
|
+
g5.addRaw("while (");
|
|
41736
|
+
g5.add(source.slice(stmt.test.start, stmt.test.end), stmt.test.start, stmt.test.end);
|
|
41737
|
+
g5.addRaw(") ");
|
|
41738
|
+
emitBlock(g5, source, stmt.body, indent4, opts);
|
|
41739
|
+
}
|
|
41740
|
+
function emitDoWhile(g5, source, stmt, indent4, opts) {
|
|
41741
|
+
g5.add(indent4);
|
|
41742
|
+
g5.addRaw("do ");
|
|
41743
|
+
emitBlock(g5, source, stmt.body, indent4, opts);
|
|
41744
|
+
g5.addRaw(" while (");
|
|
41745
|
+
g5.add(source.slice(stmt.test.start, stmt.test.end), stmt.test.start, stmt.test.end);
|
|
41746
|
+
g5.addRaw(");");
|
|
41747
|
+
}
|
|
41748
|
+
function emitSwitch(g5, source, stmt, indent4, opts) {
|
|
41749
|
+
g5.add(indent4);
|
|
41750
|
+
g5.addRaw("switch (");
|
|
41751
|
+
g5.add(source.slice(stmt.discriminant.start, stmt.discriminant.end), stmt.discriminant.start, stmt.discriminant.end);
|
|
41752
|
+
g5.addRaw(") {");
|
|
41694
41753
|
let firstCase = true;
|
|
41695
41754
|
for (const c of stmt.cases ?? []) {
|
|
41696
|
-
|
|
41755
|
+
g5.addRaw(firstCase ? "\n" : "\n");
|
|
41697
41756
|
firstCase = false;
|
|
41698
|
-
|
|
41699
|
-
|
|
41757
|
+
g5.add(indent4);
|
|
41758
|
+
g5.addRaw(" ");
|
|
41700
41759
|
if (c.test) {
|
|
41701
|
-
|
|
41702
|
-
|
|
41703
|
-
|
|
41760
|
+
g5.addRaw("case ");
|
|
41761
|
+
g5.add(source.slice(c.test.start, c.test.end), c.test.start, c.test.end);
|
|
41762
|
+
g5.addRaw(":");
|
|
41704
41763
|
} else {
|
|
41705
|
-
|
|
41764
|
+
g5.addRaw("default:");
|
|
41706
41765
|
}
|
|
41707
|
-
const before =
|
|
41708
|
-
emitBody(
|
|
41709
|
-
if (
|
|
41766
|
+
const before = g5.code.length;
|
|
41767
|
+
emitBody(g5, source, c.consequent, indent4 + " ", opts);
|
|
41768
|
+
if (g5.code.length > before) g5.addRaw("\n");
|
|
41710
41769
|
}
|
|
41711
|
-
|
|
41712
|
-
|
|
41713
|
-
|
|
41770
|
+
g5.addRaw("\n");
|
|
41771
|
+
g5.add(indent4);
|
|
41772
|
+
g5.addRaw("}");
|
|
41714
41773
|
}
|
|
41715
|
-
function emitTry(
|
|
41716
|
-
|
|
41717
|
-
|
|
41718
|
-
emitBlock(
|
|
41774
|
+
function emitTry(g5, source, stmt, indent4, opts) {
|
|
41775
|
+
g5.add(indent4);
|
|
41776
|
+
g5.addRaw("try ");
|
|
41777
|
+
emitBlock(g5, source, stmt.block, indent4, opts);
|
|
41719
41778
|
if (stmt.handler) {
|
|
41720
|
-
|
|
41779
|
+
g5.addRaw(" catch");
|
|
41721
41780
|
if (stmt.handler.param) {
|
|
41722
|
-
|
|
41723
|
-
|
|
41724
|
-
|
|
41781
|
+
g5.addRaw(" (");
|
|
41782
|
+
g5.add(source.slice(stmt.handler.param.start, stmt.handler.param.end), stmt.handler.param.start, stmt.handler.param.end);
|
|
41783
|
+
g5.addRaw(")");
|
|
41725
41784
|
}
|
|
41726
|
-
|
|
41727
|
-
emitBlock(
|
|
41785
|
+
g5.addRaw(" ");
|
|
41786
|
+
emitBlock(g5, source, stmt.handler.body, indent4, opts);
|
|
41728
41787
|
}
|
|
41729
41788
|
if (stmt.finalizer) {
|
|
41730
|
-
|
|
41731
|
-
emitBlock(
|
|
41789
|
+
g5.addRaw(" finally ");
|
|
41790
|
+
emitBlock(g5, source, stmt.finalizer, indent4, opts);
|
|
41732
41791
|
}
|
|
41733
41792
|
}
|
|
41734
|
-
function emitPlainStatement(
|
|
41793
|
+
function emitPlainStatement(g5, source, stmt, indent4, isLast) {
|
|
41735
41794
|
let text = stripTrailingSemicolons(source.slice(stmt.start, stmt.end).trimEnd());
|
|
41736
41795
|
if (text === "") return;
|
|
41737
|
-
|
|
41738
|
-
|
|
41739
|
-
if (!text.endsWith("}") && !isLast)
|
|
41796
|
+
g5.add(indent4);
|
|
41797
|
+
g5.add(text, stmt.start, stmt.end);
|
|
41798
|
+
if (!text.endsWith("}") && !isLast) g5.addRaw(";");
|
|
41740
41799
|
}
|
|
41741
|
-
function emitStatement(
|
|
41800
|
+
function emitStatement(g5, source, stmt, indent4, isLast, opts, hoist) {
|
|
41742
41801
|
switch (stmt.type) {
|
|
41743
41802
|
case "JSXElement":
|
|
41744
41803
|
if (getJSXTagName2(stmt) === "style") {
|
|
41745
41804
|
const openEnd = stmt.openingElement?.end ?? stmt.start;
|
|
41746
41805
|
const closeStart = stmt.closingElement?.start ?? stmt.end;
|
|
41747
|
-
|
|
41806
|
+
g5.recordStyle(stmt.start, stmt.end, source.slice(openEnd, closeStart));
|
|
41748
41807
|
return;
|
|
41749
41808
|
}
|
|
41750
|
-
|
|
41751
|
-
emitJSXElement(
|
|
41752
|
-
if (!isLast)
|
|
41809
|
+
g5.add(indent4);
|
|
41810
|
+
emitJSXElement(g5, source, stmt, opts, hoist);
|
|
41811
|
+
if (!isLast) g5.addRaw(";");
|
|
41753
41812
|
return;
|
|
41754
41813
|
case "JSXFragment":
|
|
41755
|
-
|
|
41756
|
-
emitJSXFragment(
|
|
41757
|
-
if (!isLast)
|
|
41814
|
+
g5.add(indent4);
|
|
41815
|
+
emitJSXFragment(g5, source, stmt, opts, hoist);
|
|
41816
|
+
if (!isLast) g5.addRaw(";");
|
|
41758
41817
|
return;
|
|
41759
41818
|
case "JSXExpressionContainer": {
|
|
41760
41819
|
if (stmt.expression.type === "JSXEmptyExpression") return;
|
|
41761
|
-
|
|
41762
|
-
|
|
41763
|
-
|
|
41764
|
-
|
|
41765
|
-
if (!isLast)
|
|
41820
|
+
g5.add(indent4);
|
|
41821
|
+
g5.addRaw("{");
|
|
41822
|
+
g5.add(source.slice(stmt.expression.start, stmt.expression.end), stmt.expression.start, stmt.expression.end);
|
|
41823
|
+
g5.addRaw("}");
|
|
41824
|
+
if (!isLast) g5.addRaw(";");
|
|
41766
41825
|
return;
|
|
41767
41826
|
}
|
|
41768
41827
|
case "VeskBlock": {
|
|
@@ -41770,10 +41829,10 @@ function emitStatement(g4, source, stmt, indent4, isLast, opts, hoist) {
|
|
|
41770
41829
|
const innerStmts = stmt.body ?? [];
|
|
41771
41830
|
let firstLine = true;
|
|
41772
41831
|
for (let i = 0; i < innerStmts.length; i++) {
|
|
41773
|
-
const before =
|
|
41774
|
-
emitStatement(
|
|
41775
|
-
if (
|
|
41776
|
-
if (!firstLine)
|
|
41832
|
+
const before = g5.code.length;
|
|
41833
|
+
emitStatement(g5, source, innerStmts[i], indent4, isLast && i === innerStmts.length - 1, opts, hoist);
|
|
41834
|
+
if (g5.code.length > before) {
|
|
41835
|
+
if (!firstLine) g5.addRaw("\n");
|
|
41777
41836
|
firstLine = false;
|
|
41778
41837
|
}
|
|
41779
41838
|
}
|
|
@@ -41781,38 +41840,38 @@ function emitStatement(g4, source, stmt, indent4, isLast, opts, hoist) {
|
|
|
41781
41840
|
}
|
|
41782
41841
|
case "VariableDeclaration":
|
|
41783
41842
|
if (isTrackDeclStatement(stmt)) {
|
|
41784
|
-
emitTrackDeclStatement(
|
|
41843
|
+
emitTrackDeclStatement(g5, source, stmt, indent4, isLast, opts);
|
|
41785
41844
|
return;
|
|
41786
41845
|
}
|
|
41787
|
-
return emitPlainStatement(
|
|
41846
|
+
return emitPlainStatement(g5, source, stmt, indent4, isLast);
|
|
41788
41847
|
case "IfStatement":
|
|
41789
|
-
return emitIf(
|
|
41848
|
+
return emitIf(g5, source, stmt, indent4, opts);
|
|
41790
41849
|
case "ForOfStatement":
|
|
41791
|
-
return emitForOf(
|
|
41850
|
+
return emitForOf(g5, source, stmt, indent4, opts);
|
|
41792
41851
|
case "ForInStatement":
|
|
41793
|
-
return emitForIn(
|
|
41852
|
+
return emitForIn(g5, source, stmt, indent4, opts);
|
|
41794
41853
|
case "ForStatement":
|
|
41795
|
-
return emitFor(
|
|
41854
|
+
return emitFor(g5, source, stmt, indent4, opts);
|
|
41796
41855
|
case "WhileStatement":
|
|
41797
|
-
return emitWhile(
|
|
41856
|
+
return emitWhile(g5, source, stmt, indent4, opts);
|
|
41798
41857
|
case "DoWhileStatement":
|
|
41799
|
-
return emitDoWhile(
|
|
41858
|
+
return emitDoWhile(g5, source, stmt, indent4, opts);
|
|
41800
41859
|
case "SwitchStatement":
|
|
41801
|
-
return emitSwitch(
|
|
41860
|
+
return emitSwitch(g5, source, stmt, indent4, opts);
|
|
41802
41861
|
case "TryStatement":
|
|
41803
|
-
return emitTry(
|
|
41862
|
+
return emitTry(g5, source, stmt, indent4, opts);
|
|
41804
41863
|
case "LabeledStatement": {
|
|
41805
|
-
|
|
41806
|
-
|
|
41807
|
-
|
|
41808
|
-
emitStatement(
|
|
41864
|
+
g5.add(indent4);
|
|
41865
|
+
g5.add(stmt.label.name, stmt.label.start, stmt.label.end);
|
|
41866
|
+
g5.addRaw(":\n");
|
|
41867
|
+
emitStatement(g5, source, stmt.body, indent4, isLast, opts);
|
|
41809
41868
|
return;
|
|
41810
41869
|
}
|
|
41811
41870
|
default:
|
|
41812
|
-
return emitPlainStatement(
|
|
41871
|
+
return emitPlainStatement(g5, source, stmt, indent4, isLast);
|
|
41813
41872
|
}
|
|
41814
41873
|
}
|
|
41815
|
-
function emitBody(
|
|
41874
|
+
function emitBody(g5, source, stmts, indent4, opts, hoist) {
|
|
41816
41875
|
let firstLine = true;
|
|
41817
41876
|
let i = 0;
|
|
41818
41877
|
while (i < stmts.length) {
|
|
@@ -41820,34 +41879,34 @@ function emitBody(g4, source, stmts, indent4, opts, hoist) {
|
|
|
41820
41879
|
const isLast = i === stmts.length - 1;
|
|
41821
41880
|
if (stmt.type === "ForOfStatement" && stmts[i + 1] && stmts[i + 1].type === "VeskBlock" && stmts[i + 1].tag === "empty") {
|
|
41822
41881
|
const empty2 = stmts[i + 1];
|
|
41823
|
-
if (!firstLine)
|
|
41882
|
+
if (!firstLine) g5.addRaw("\n");
|
|
41824
41883
|
firstLine = false;
|
|
41825
|
-
emitForOf(
|
|
41884
|
+
emitForOf(g5, source, stmt, indent4, opts);
|
|
41826
41885
|
const inner = empty2.body ?? [];
|
|
41827
41886
|
if (inner.length > 0) {
|
|
41828
|
-
|
|
41829
|
-
|
|
41830
|
-
|
|
41831
|
-
|
|
41832
|
-
|
|
41833
|
-
emitBody(
|
|
41834
|
-
|
|
41835
|
-
|
|
41836
|
-
|
|
41887
|
+
g5.addRaw("\n");
|
|
41888
|
+
g5.add(indent4);
|
|
41889
|
+
g5.add(source.slice(stmt.right.start, stmt.right.end), stmt.right.start, stmt.right.end);
|
|
41890
|
+
g5.addRaw(".length === 0 && (() => {");
|
|
41891
|
+
g5.addRaw("\n");
|
|
41892
|
+
emitBody(g5, source, inner, indent4 + " ", opts);
|
|
41893
|
+
g5.addRaw("\n");
|
|
41894
|
+
g5.add(indent4);
|
|
41895
|
+
g5.addRaw("})();");
|
|
41837
41896
|
}
|
|
41838
41897
|
i += 2;
|
|
41839
41898
|
continue;
|
|
41840
41899
|
}
|
|
41841
|
-
const before =
|
|
41842
|
-
emitStatement(
|
|
41843
|
-
if (
|
|
41844
|
-
if (!firstLine)
|
|
41900
|
+
const before = g5.code.length;
|
|
41901
|
+
emitStatement(g5, source, stmt, indent4, isLast, opts, hoist);
|
|
41902
|
+
if (g5.code.length > before) {
|
|
41903
|
+
if (!firstLine) g5.addRaw("\n");
|
|
41845
41904
|
firstLine = false;
|
|
41846
41905
|
}
|
|
41847
41906
|
i++;
|
|
41848
41907
|
}
|
|
41849
41908
|
}
|
|
41850
|
-
function emitChunkMapped(
|
|
41909
|
+
function emitChunkMapped(g5, source, start, end) {
|
|
41851
41910
|
if (end <= start) return;
|
|
41852
41911
|
let pos = start;
|
|
41853
41912
|
let i = start;
|
|
@@ -41859,8 +41918,8 @@ function emitChunkMapped(g4, source, start, end) {
|
|
|
41859
41918
|
if (openEnd !== -1 && openEnd <= end) {
|
|
41860
41919
|
const closeIdx = source.indexOf("</style>", openEnd);
|
|
41861
41920
|
if (closeIdx !== -1 && closeIdx + 8 <= end) {
|
|
41862
|
-
|
|
41863
|
-
|
|
41921
|
+
g5.add(source.slice(pos, i), pos, i);
|
|
41922
|
+
g5.recordStyle(i, closeIdx + 8, source.slice(openEnd, closeIdx));
|
|
41864
41923
|
pos = closeIdx + 8;
|
|
41865
41924
|
i = closeIdx + 8;
|
|
41866
41925
|
continue;
|
|
@@ -41870,20 +41929,20 @@ function emitChunkMapped(g4, source, start, end) {
|
|
|
41870
41929
|
}
|
|
41871
41930
|
i++;
|
|
41872
41931
|
}
|
|
41873
|
-
|
|
41932
|
+
g5.add(source.slice(pos, end), pos, end);
|
|
41874
41933
|
}
|
|
41875
|
-
function emitReturn(
|
|
41876
|
-
|
|
41934
|
+
function emitReturn(g5, source, stmt, opts) {
|
|
41935
|
+
g5.add(source.slice(stmt.start, stmt.start + 6), stmt.start, stmt.start + 6);
|
|
41877
41936
|
const arg = stmt.argument;
|
|
41878
41937
|
if (!arg) {
|
|
41879
|
-
emitChunkMapped(
|
|
41938
|
+
emitChunkMapped(g5, source, stmt.start + 6, stmt.end);
|
|
41880
41939
|
return;
|
|
41881
41940
|
}
|
|
41882
|
-
emitChunkMapped(
|
|
41883
|
-
if (arg.type === "JSXElement") emitJSXElement(
|
|
41884
|
-
else if (arg.type === "JSXFragment") emitJSXFragment(
|
|
41885
|
-
else emitChunkMapped(
|
|
41886
|
-
emitChunkMapped(
|
|
41941
|
+
emitChunkMapped(g5, source, stmt.start + 6, arg.start);
|
|
41942
|
+
if (arg.type === "JSXElement") emitJSXElement(g5, source, arg, opts);
|
|
41943
|
+
else if (arg.type === "JSXFragment") emitJSXFragment(g5, source, arg, opts);
|
|
41944
|
+
else emitChunkMapped(g5, source, arg.start, arg.end);
|
|
41945
|
+
emitChunkMapped(g5, source, arg.end, stmt.end);
|
|
41887
41946
|
}
|
|
41888
41947
|
function collectHoistEligible(children, set2, list) {
|
|
41889
41948
|
for (const child of children ?? []) {
|
|
@@ -41903,7 +41962,7 @@ function collectHoistEligible(children, set2, list) {
|
|
|
41903
41962
|
}
|
|
41904
41963
|
}
|
|
41905
41964
|
}
|
|
41906
|
-
function emitBodyCore(
|
|
41965
|
+
function emitBodyCore(g5, source, stmts, opts) {
|
|
41907
41966
|
const hoistSet = /* @__PURE__ */ new Set();
|
|
41908
41967
|
const byRoot = /* @__PURE__ */ new Map();
|
|
41909
41968
|
const collectRoot = (root3) => {
|
|
@@ -41954,107 +42013,107 @@ function emitBodyCore(g4, source, stmts, opts) {
|
|
|
41954
42013
|
byRoot.delete(u.node);
|
|
41955
42014
|
const n = list.length;
|
|
41956
42015
|
for (let k = 0; k < n; k++) {
|
|
41957
|
-
const before2 =
|
|
41958
|
-
emitStatement(
|
|
41959
|
-
if (
|
|
42016
|
+
const before2 = g5.code.length;
|
|
42017
|
+
emitStatement(g5, source, list[k], "", false, opts, ctx2);
|
|
42018
|
+
if (g5.code.length > before2) g5.addRaw("\n");
|
|
41960
42019
|
}
|
|
41961
42020
|
}
|
|
41962
42021
|
}
|
|
41963
42022
|
if (u.empty !== void 0) {
|
|
41964
|
-
emitForOf(
|
|
42023
|
+
emitForOf(g5, source, u.node, "", opts);
|
|
41965
42024
|
const inner = u.empty.body ?? [];
|
|
41966
42025
|
if (inner.length > 0) {
|
|
41967
|
-
|
|
41968
|
-
|
|
41969
|
-
|
|
42026
|
+
g5.addRaw("\n");
|
|
42027
|
+
g5.add("");
|
|
42028
|
+
g5.add(
|
|
41970
42029
|
source.slice(u.node.right.start, u.node.right.end),
|
|
41971
42030
|
u.node.right.start,
|
|
41972
42031
|
u.node.right.end
|
|
41973
42032
|
);
|
|
41974
|
-
|
|
41975
|
-
|
|
41976
|
-
emitBody(
|
|
41977
|
-
|
|
41978
|
-
|
|
41979
|
-
|
|
42033
|
+
g5.addRaw(".length === 0 && (() => {");
|
|
42034
|
+
g5.addRaw("\n");
|
|
42035
|
+
emitBody(g5, source, inner, " ", opts);
|
|
42036
|
+
g5.addRaw("\n");
|
|
42037
|
+
g5.add("");
|
|
42038
|
+
g5.addRaw("})();");
|
|
41980
42039
|
}
|
|
41981
42040
|
return;
|
|
41982
42041
|
}
|
|
41983
|
-
const before =
|
|
41984
|
-
emitStatement(
|
|
41985
|
-
if (
|
|
42042
|
+
const before = g5.code.length;
|
|
42043
|
+
emitStatement(g5, source, u.node, "", isLast, opts, ctx2);
|
|
42044
|
+
if (g5.code.length > before && !isLast) g5.addRaw("\n");
|
|
41986
42045
|
};
|
|
41987
42046
|
for (let i = 0; i < units.length; i++) {
|
|
41988
42047
|
emitUnit(units[i], i === units.length - 1);
|
|
41989
42048
|
}
|
|
41990
42049
|
}
|
|
41991
|
-
function emitExpressionBody(
|
|
42050
|
+
function emitExpressionBody(g5, source, coreStart, coreEnd, stmts, opts) {
|
|
41992
42051
|
let pos = coreStart;
|
|
41993
42052
|
for (const stmt of stmts) {
|
|
41994
42053
|
if (!stmt) continue;
|
|
41995
|
-
emitChunkMapped(
|
|
42054
|
+
emitChunkMapped(g5, source, pos, stmt.start);
|
|
41996
42055
|
pos = stmt.start;
|
|
41997
42056
|
if (isTrackDeclStatement(stmt)) {
|
|
41998
|
-
emitTrackDeclStatement(
|
|
42057
|
+
emitTrackDeclStatement(g5, source, stmt, "", true, opts);
|
|
41999
42058
|
} else if (stmt.type === "ReturnStatement") {
|
|
42000
|
-
emitReturn(
|
|
42059
|
+
emitReturn(g5, source, stmt, opts);
|
|
42001
42060
|
} else {
|
|
42002
|
-
emitChunkMapped(
|
|
42061
|
+
emitChunkMapped(g5, source, stmt.start, stmt.end);
|
|
42003
42062
|
}
|
|
42004
42063
|
pos = stmt.end;
|
|
42005
42064
|
}
|
|
42006
|
-
emitChunkMapped(
|
|
42065
|
+
emitChunkMapped(g5, source, pos, coreEnd);
|
|
42007
42066
|
}
|
|
42008
|
-
function emitRestMapped(
|
|
42067
|
+
function emitRestMapped(g5, text, base, end) {
|
|
42009
42068
|
let i = 0;
|
|
42010
42069
|
while (i < text.length && !isIdentStart(text[i])) i++;
|
|
42011
42070
|
if (i >= text.length) {
|
|
42012
|
-
|
|
42071
|
+
g5.add(text, base, end);
|
|
42013
42072
|
return;
|
|
42014
42073
|
}
|
|
42015
42074
|
let j = i + 1;
|
|
42016
42075
|
while (j < text.length && isIdentChar(text[j])) j++;
|
|
42017
|
-
|
|
42018
|
-
|
|
42019
|
-
|
|
42076
|
+
g5.add(text.slice(0, i), base, base + i);
|
|
42077
|
+
g5.add(text.slice(i, j), base + i, base + j);
|
|
42078
|
+
g5.add(text.slice(j), base + j, end);
|
|
42020
42079
|
}
|
|
42021
|
-
function emitComponentHeader(
|
|
42080
|
+
function emitComponentHeader(g5, source, start, bodyStart) {
|
|
42022
42081
|
const h = source.slice(start, bodyStart);
|
|
42023
42082
|
const k = findFirstKeyword(h, "component");
|
|
42024
42083
|
if (k === -1) {
|
|
42025
42084
|
const { text, end: end2 } = stripTrailingClientRange(h);
|
|
42026
42085
|
if (!text.includes("(")) {
|
|
42027
42086
|
const trimmed = text.trimEnd();
|
|
42028
|
-
|
|
42029
|
-
|
|
42087
|
+
g5.add(trimmed, start, start + end2 - (text.length - trimmed.length));
|
|
42088
|
+
g5.addRaw("() ");
|
|
42030
42089
|
} else {
|
|
42031
|
-
|
|
42090
|
+
g5.add(text, start, start + end2);
|
|
42032
42091
|
}
|
|
42033
42092
|
return;
|
|
42034
42093
|
}
|
|
42035
|
-
|
|
42036
|
-
|
|
42094
|
+
g5.add(h.slice(0, k), start, start + k);
|
|
42095
|
+
g5.add("function", start + k, start + k + "component".length);
|
|
42037
42096
|
const restBase = start + k + "component".length;
|
|
42038
42097
|
const { text: rest, end } = stripTrailingClientRange(h.slice(k + "component".length));
|
|
42039
42098
|
const transformed = h.slice(0, k) + "function" + rest;
|
|
42040
42099
|
if (!transformed.includes("(")) {
|
|
42041
42100
|
const trimmed = rest.trimEnd();
|
|
42042
|
-
emitRestMapped(
|
|
42043
|
-
|
|
42101
|
+
emitRestMapped(g5, trimmed, restBase, restBase + end - (rest.length - trimmed.length));
|
|
42102
|
+
g5.addRaw("() ");
|
|
42044
42103
|
} else {
|
|
42045
|
-
emitRestMapped(
|
|
42104
|
+
emitRestMapped(g5, rest, restBase, restBase + end);
|
|
42046
42105
|
}
|
|
42047
42106
|
}
|
|
42048
|
-
function emitComponent(
|
|
42107
|
+
function emitComponent(g5, source, node, start, opts) {
|
|
42049
42108
|
const body = node.body;
|
|
42050
42109
|
if (!body || body.start == null || body.end == null) return;
|
|
42051
|
-
emitComponentHeader(
|
|
42110
|
+
emitComponentHeader(g5, source, start, body.start);
|
|
42052
42111
|
const statementMode = isStatementMode2(node);
|
|
42053
42112
|
const stmts = body.body ?? [];
|
|
42054
42113
|
if (statementMode) {
|
|
42055
|
-
|
|
42056
|
-
emitBodyCore(
|
|
42057
|
-
|
|
42114
|
+
g5.addRaw("{ ");
|
|
42115
|
+
emitBodyCore(g5, source, stmts, opts);
|
|
42116
|
+
g5.addRaw(" }");
|
|
42058
42117
|
} else {
|
|
42059
42118
|
const raw2 = source.slice(body.start, body.end);
|
|
42060
42119
|
const rawLen = raw2.length;
|
|
@@ -42074,9 +42133,9 @@ function emitComponent(g4, source, node, start, opts) {
|
|
|
42074
42133
|
}
|
|
42075
42134
|
while (coreStart < coreEnd && isWhitespaceChar(source[coreStart])) coreStart++;
|
|
42076
42135
|
while (coreEnd > coreStart && isWhitespaceChar(source[coreEnd - 1])) coreEnd--;
|
|
42077
|
-
if (hasBraces)
|
|
42078
|
-
emitExpressionBody(
|
|
42079
|
-
if (hasBraces)
|
|
42136
|
+
if (hasBraces) g5.addRaw("{ ");
|
|
42137
|
+
emitExpressionBody(g5, source, coreStart, coreEnd, stmts, opts);
|
|
42138
|
+
if (hasBraces) g5.addRaw(" }");
|
|
42080
42139
|
}
|
|
42081
42140
|
}
|
|
42082
42141
|
function isModuleAst(ast) {
|
|
@@ -42106,26 +42165,26 @@ function compileVskCodegen(source, opts = {}) {
|
|
|
42106
42165
|
};
|
|
42107
42166
|
}
|
|
42108
42167
|
const clean = blankForClauses(source, ast);
|
|
42109
|
-
const
|
|
42168
|
+
const g5 = new VskGen();
|
|
42110
42169
|
const components = getComponents(ast).sort((a, b) => a.start - b.start);
|
|
42111
42170
|
let pos = 0;
|
|
42112
42171
|
for (const { node, start } of components) {
|
|
42113
42172
|
const body = node.body;
|
|
42114
42173
|
if (!body || body.start == null || body.end == null) continue;
|
|
42115
|
-
|
|
42116
|
-
emitComponent(
|
|
42174
|
+
g5.add(clean.slice(pos, start), pos, start);
|
|
42175
|
+
emitComponent(g5, clean, node, start, opts);
|
|
42117
42176
|
pos = body.end;
|
|
42118
42177
|
}
|
|
42119
|
-
|
|
42120
|
-
let code =
|
|
42178
|
+
g5.add(clean.slice(pos), pos, source.length);
|
|
42179
|
+
let code = g5.code;
|
|
42121
42180
|
if (isModuleAst(ast) && containsIdentifier(code, "Head") && !isIdentifierImported(code, "Head")) {
|
|
42122
|
-
|
|
42123
|
-
code =
|
|
42181
|
+
g5.prepend("declare const Head: (props: { children?: Component }) => Component;\n");
|
|
42182
|
+
code = g5.code;
|
|
42124
42183
|
}
|
|
42125
42184
|
if (!isModuleAst(ast)) {
|
|
42126
42185
|
code += "\nexport {};\n";
|
|
42127
42186
|
}
|
|
42128
|
-
return { code, mappings:
|
|
42187
|
+
return { code, mappings: g5.mappings, styleRegions: g5.styleRegions, errors: [] };
|
|
42129
42188
|
}
|
|
42130
42189
|
function isTypeDecl(stmt) {
|
|
42131
42190
|
return stmt.type === "TSInterfaceDeclaration" || stmt.type === "TSTypeAliasDeclaration" || stmt.type === "ExportNamedDeclaration" && (stmt.declaration?.type === "TSInterfaceDeclaration" || stmt.declaration?.type === "TSTypeAliasDeclaration");
|
|
@@ -48830,25 +48889,25 @@ function runMigrate(options) {
|
|
|
48830
48889
|
}
|
|
48831
48890
|
const applicable = codemods.filter((c) => c.appliesTo(abs));
|
|
48832
48891
|
if (applicable.length === 0) continue;
|
|
48833
|
-
let
|
|
48892
|
+
let current3 = source;
|
|
48834
48893
|
let changed = false;
|
|
48835
48894
|
for (const codemod of applicable) {
|
|
48836
48895
|
let result;
|
|
48837
48896
|
try {
|
|
48838
|
-
result = codemod.run(
|
|
48897
|
+
result = codemod.run(current3, ctx2);
|
|
48839
48898
|
} catch (e) {
|
|
48840
48899
|
report.skipped.push(`${relPath}: ${codemod.id} failed (${e.message})`);
|
|
48841
48900
|
continue;
|
|
48842
48901
|
}
|
|
48843
48902
|
report.notes.push(...result.notes);
|
|
48844
|
-
if (result.code !== null && result.code !==
|
|
48845
|
-
|
|
48903
|
+
if (result.code !== null && result.code !== current3) {
|
|
48904
|
+
current3 = result.code;
|
|
48846
48905
|
changed = true;
|
|
48847
48906
|
}
|
|
48848
48907
|
}
|
|
48849
48908
|
if (!changed) continue;
|
|
48850
48909
|
report.filesChanged.push(relPath);
|
|
48851
|
-
if (!options.dryRun) writeFileSync22(abs,
|
|
48910
|
+
if (!options.dryRun) writeFileSync22(abs, current3, "utf-8");
|
|
48852
48911
|
}
|
|
48853
48912
|
return report;
|
|
48854
48913
|
}
|
|
@@ -51245,9 +51304,9 @@ var ChunkImports = class {
|
|
|
51245
51304
|
this.fail(`nameless named-import from '${source}' in ${filePath}`, code);
|
|
51246
51305
|
return false;
|
|
51247
51306
|
}
|
|
51248
|
-
const
|
|
51249
|
-
if (
|
|
51250
|
-
this.fail(`'${imported}' from '${source}' bound to both '${
|
|
51307
|
+
const existing2 = group.named.get(imported);
|
|
51308
|
+
if (existing2 && existing2.local !== local) {
|
|
51309
|
+
this.fail(`'${imported}' from '${source}' bound to both '${existing2.local}' and '${local}' in ${filePath}`, code);
|
|
51251
51310
|
return false;
|
|
51252
51311
|
}
|
|
51253
51312
|
group.named.set(imported, { kind: "named", local, imported });
|
|
@@ -51282,11 +51341,11 @@ var ChunkImports = class {
|
|
|
51282
51341
|
const lines = [];
|
|
51283
51342
|
const sources = [...this.bySource.keys()].sort();
|
|
51284
51343
|
for (const src2 of sources) {
|
|
51285
|
-
const
|
|
51344
|
+
const g5 = this.bySource.get(src2);
|
|
51286
51345
|
const parts = [];
|
|
51287
|
-
if (
|
|
51288
|
-
if (
|
|
51289
|
-
const named = [...
|
|
51346
|
+
if (g5.default) parts.push(`import ${g5.default.local} from ${JSON.stringify(src2)}`);
|
|
51347
|
+
if (g5.namespace) parts.push(`import * as ${g5.namespace.local} from ${JSON.stringify(src2)}`);
|
|
51348
|
+
const named = [...g5.named.values()].sort((a, b) => a.imported < b.imported ? -1 : 1);
|
|
51290
51349
|
if (named.length > 0) {
|
|
51291
51350
|
const specs = named.map((sp) => sp.imported === sp.local ? sp.local : `${sp.imported} as ${sp.local}`).join(", ");
|
|
51292
51351
|
parts.push(`import { ${specs} } from ${JSON.stringify(src2)}`);
|
|
@@ -52537,6 +52596,34 @@ async function startProdServer(outDir, options) {
|
|
|
52537
52596
|
}
|
|
52538
52597
|
return origWriteHead(statusCode, headers2);
|
|
52539
52598
|
});
|
|
52599
|
+
const securityBridge = globalThis.__vesk_security;
|
|
52600
|
+
const securityRun = securityBridge?.run;
|
|
52601
|
+
const withSecurityScope = securityRun ? (fn) => securityRun(fn) : (fn) => fn();
|
|
52602
|
+
const applyOverrideHeaders = (headers2) => {
|
|
52603
|
+
const overrides = securityBridge?.get?.();
|
|
52604
|
+
if (!overrides) return headers2;
|
|
52605
|
+
const next = { ...headers2 };
|
|
52606
|
+
if (typeof overrides.contentSecurityPolicy === "string") {
|
|
52607
|
+
next["Content-Security-Policy"] = overrides.contentSecurityPolicy;
|
|
52608
|
+
}
|
|
52609
|
+
const custom2 = overrides.customHeaders;
|
|
52610
|
+
if (custom2) {
|
|
52611
|
+
for (const [name, value] of Object.entries(custom2)) {
|
|
52612
|
+
if (value === false) delete next[name];
|
|
52613
|
+
else next[name] = value;
|
|
52614
|
+
}
|
|
52615
|
+
}
|
|
52616
|
+
return next;
|
|
52617
|
+
};
|
|
52618
|
+
const origWriteHead2 = res.writeHead.bind(res);
|
|
52619
|
+
let overridesApplied = false;
|
|
52620
|
+
res.writeHead = ((statusCode, headers2) => {
|
|
52621
|
+
if (!overridesApplied) {
|
|
52622
|
+
overridesApplied = true;
|
|
52623
|
+
headers2 = applyOverrideHeaders(headers2 || {});
|
|
52624
|
+
}
|
|
52625
|
+
return origWriteHead2(statusCode, headers2);
|
|
52626
|
+
});
|
|
52540
52627
|
const publicDir = resolve13(staticDir, "public");
|
|
52541
52628
|
const rootFile = url.pathname.length > 1 ? resolveWithin(publicDir, url.pathname.slice(1)) : null;
|
|
52542
52629
|
if (rootFile && existsSync15(rootFile) && statSync6(rootFile).isFile()) {
|
|
@@ -52676,7 +52763,8 @@ async function startProdServer(outDir, options) {
|
|
|
52676
52763
|
}
|
|
52677
52764
|
try {
|
|
52678
52765
|
const webRequest = makeWebRequest(req, url.href, maxBodyBytes);
|
|
52679
|
-
const
|
|
52766
|
+
const handleAction = mod.handleAction.bind(mod);
|
|
52767
|
+
const response = await withSecurityScope(() => handleAction(webRequest, actionId));
|
|
52680
52768
|
await deliverResponse(res, response);
|
|
52681
52769
|
} catch (e) {
|
|
52682
52770
|
const status = errorStatus(e, 500);
|
|
@@ -52695,7 +52783,7 @@ async function startProdServer(outDir, options) {
|
|
|
52695
52783
|
if (mod) {
|
|
52696
52784
|
try {
|
|
52697
52785
|
const webRequest = makeWebRequest(req, url.href, maxBodyBytes);
|
|
52698
|
-
const response = await mod.handle(webRequest);
|
|
52786
|
+
const response = await withSecurityScope(() => mod.handle(webRequest));
|
|
52699
52787
|
await deliverResponse(res, response);
|
|
52700
52788
|
return;
|
|
52701
52789
|
} catch (e) {
|
|
@@ -52737,7 +52825,7 @@ async function startProdServer(outDir, options) {
|
|
|
52737
52825
|
if (route.revalidate && route.revalidate > 0) {
|
|
52738
52826
|
const { pageIsr: pageIsr2 } = await Promise.resolve().then(() => (init_index_server(), index_server_exports));
|
|
52739
52827
|
cachedResult = await pageIsr2(url.pathname, async () => {
|
|
52740
|
-
const response2 = await mod.handle(webRequest);
|
|
52828
|
+
const response2 = await withSecurityScope(() => mod.handle(webRequest));
|
|
52741
52829
|
return { html: await response2.text(), headers: Object.fromEntries(response2.headers) };
|
|
52742
52830
|
}, { revalidate: route.revalidate, tags: route.tags || [] });
|
|
52743
52831
|
}
|
|
@@ -52746,7 +52834,7 @@ async function startProdServer(outDir, options) {
|
|
|
52746
52834
|
res.end(cachedResult.html);
|
|
52747
52835
|
return;
|
|
52748
52836
|
}
|
|
52749
|
-
const response = await mod.handle(webRequest);
|
|
52837
|
+
const response = await withSecurityScope(() => mod.handle(webRequest));
|
|
52750
52838
|
const headers2 = Object.fromEntries(response.headers);
|
|
52751
52839
|
if (!headers2["content-type"] && !headers2["Content-Type"]) headers2["Content-Type"] = "text/html";
|
|
52752
52840
|
if (response.body && typeof response.body.getReader === "function") {
|
|
@@ -53501,8 +53589,8 @@ init_index_server();
|
|
|
53501
53589
|
import { AsyncLocalStorage as AsyncLocalStorage2 } from "node:async_hooks";
|
|
53502
53590
|
var TOKEN_KEY2 = "__vsk_ssr_token";
|
|
53503
53591
|
var IMPL_KEY2 = "__vsk_ssr_store_impl";
|
|
53504
|
-
var
|
|
53505
|
-
var impl2 =
|
|
53592
|
+
var g4 = globalThis;
|
|
53593
|
+
var impl2 = g4[IMPL_KEY2] ?? (g4[IMPL_KEY2] = {
|
|
53506
53594
|
storage: new AsyncLocalStorage2(),
|
|
53507
53595
|
liveSlots: /* @__PURE__ */ new Map(),
|
|
53508
53596
|
// Only the copy that created the implementation installs the token
|
|
@@ -53521,8 +53609,8 @@ function isThenable2(value) {
|
|
|
53521
53609
|
return typeof value?.then === "function";
|
|
53522
53610
|
}
|
|
53523
53611
|
function withSsrStore2(fn) {
|
|
53524
|
-
const
|
|
53525
|
-
if (
|
|
53612
|
+
const existing2 = storage2.getStore();
|
|
53613
|
+
if (existing2)
|
|
53526
53614
|
return fn();
|
|
53527
53615
|
const store = createSsrStore3();
|
|
53528
53616
|
keepSsrSlot2(store.token);
|
|
@@ -57709,9 +57797,9 @@ var ChunkImports2 = class {
|
|
|
57709
57797
|
this.fail(`nameless named-import from '${source}' in ${filePath}`, code);
|
|
57710
57798
|
return false;
|
|
57711
57799
|
}
|
|
57712
|
-
const
|
|
57713
|
-
if (
|
|
57714
|
-
this.fail(`'${imported}' from '${source}' bound to both '${
|
|
57800
|
+
const existing2 = group.named.get(imported);
|
|
57801
|
+
if (existing2 && existing2.local !== local) {
|
|
57802
|
+
this.fail(`'${imported}' from '${source}' bound to both '${existing2.local}' and '${local}' in ${filePath}`, code);
|
|
57715
57803
|
return false;
|
|
57716
57804
|
}
|
|
57717
57805
|
group.named.set(imported, { kind: "named", local, imported });
|
|
@@ -57748,13 +57836,13 @@ var ChunkImports2 = class {
|
|
|
57748
57836
|
const lines = [];
|
|
57749
57837
|
const sources = [...this.bySource.keys()].sort();
|
|
57750
57838
|
for (const src2 of sources) {
|
|
57751
|
-
const
|
|
57839
|
+
const g5 = this.bySource.get(src2);
|
|
57752
57840
|
const parts = [];
|
|
57753
|
-
if (
|
|
57754
|
-
parts.push(`import ${
|
|
57755
|
-
if (
|
|
57756
|
-
parts.push(`import * as ${
|
|
57757
|
-
const named = [...
|
|
57841
|
+
if (g5.default)
|
|
57842
|
+
parts.push(`import ${g5.default.local} from ${JSON.stringify(src2)}`);
|
|
57843
|
+
if (g5.namespace)
|
|
57844
|
+
parts.push(`import * as ${g5.namespace.local} from ${JSON.stringify(src2)}`);
|
|
57845
|
+
const named = [...g5.named.values()].sort((a, b) => a.imported < b.imported ? -1 : 1);
|
|
57758
57846
|
if (named.length > 0) {
|
|
57759
57847
|
const specs = named.map((sp) => sp.imported === sp.local ? sp.local : `${sp.imported} as ${sp.local}`).join(", ");
|
|
57760
57848
|
parts.push(`import { ${specs} } from ${JSON.stringify(src2)}`);
|
|
@@ -58973,9 +59061,9 @@ function getPluginRecords2(appDir, veskDir, configPluginNames) {
|
|
|
58973
59061
|
}
|
|
58974
59062
|
function setPluginActive2(veskDir, name, active) {
|
|
58975
59063
|
const state = readPluginState2(veskDir);
|
|
58976
|
-
const
|
|
58977
|
-
if (
|
|
58978
|
-
|
|
59064
|
+
const existing2 = state.plugins.find((p) => eqIgnoreCase2(p.name, name));
|
|
59065
|
+
if (existing2) {
|
|
59066
|
+
existing2.active = active;
|
|
58979
59067
|
} else {
|
|
58980
59068
|
state.plugins.push({ name, package: name, active });
|
|
58981
59069
|
}
|
|
@@ -59062,11 +59150,11 @@ async function installPlugin2(appDir, veskDir, pkg) {
|
|
|
59062
59150
|
}
|
|
59063
59151
|
const state = readPluginState2(veskDir);
|
|
59064
59152
|
const name = probe.packageJson?.name || pkg;
|
|
59065
|
-
const
|
|
59066
|
-
if (
|
|
59067
|
-
|
|
59068
|
-
|
|
59069
|
-
|
|
59153
|
+
const existing2 = state.plugins.find((p) => eqIgnoreCase2(p.package, pkg) || eqIgnoreCase2(p.name, name));
|
|
59154
|
+
if (existing2) {
|
|
59155
|
+
existing2.package = pkg;
|
|
59156
|
+
existing2.name = name;
|
|
59157
|
+
existing2.active = true;
|
|
59070
59158
|
} else {
|
|
59071
59159
|
state.plugins.push({ name, package: pkg, active: true });
|
|
59072
59160
|
}
|
|
@@ -59098,10 +59186,10 @@ async function updatePlugin2(appDir, veskDir, pkg) {
|
|
|
59098
59186
|
const probe = resolvePackage2(appDir, pkg);
|
|
59099
59187
|
const state = readPluginState2(veskDir);
|
|
59100
59188
|
const name = probe.packageJson?.name || pkg;
|
|
59101
|
-
const
|
|
59102
|
-
if (
|
|
59103
|
-
|
|
59104
|
-
|
|
59189
|
+
const existing2 = state.plugins.find((p) => eqIgnoreCase2(p.package, pkg) || eqIgnoreCase2(p.name, name));
|
|
59190
|
+
if (existing2) {
|
|
59191
|
+
existing2.package = pkg;
|
|
59192
|
+
existing2.name = name;
|
|
59105
59193
|
} else {
|
|
59106
59194
|
state.plugins.push({ name, package: pkg, active: true });
|
|
59107
59195
|
}
|
|
@@ -59110,7 +59198,7 @@ async function updatePlugin2(appDir, veskDir, pkg) {
|
|
|
59110
59198
|
name,
|
|
59111
59199
|
pkg,
|
|
59112
59200
|
source: "state",
|
|
59113
|
-
activeRaw:
|
|
59201
|
+
activeRaw: existing2 ? existing2.active : true,
|
|
59114
59202
|
error: null
|
|
59115
59203
|
}, appDir);
|
|
59116
59204
|
}
|
|
@@ -61445,8 +61533,8 @@ function loadAgenticConfig(projectDir) {
|
|
|
61445
61533
|
}
|
|
61446
61534
|
function saveAgenticConfig(projectDir, patch) {
|
|
61447
61535
|
const p = configPath(projectDir);
|
|
61448
|
-
const
|
|
61449
|
-
const next = { ...DEFAULT_CONFIG, ...
|
|
61536
|
+
const current3 = loadAgenticConfig(projectDir);
|
|
61537
|
+
const next = { ...DEFAULT_CONFIG, ...current3, ...patch };
|
|
61450
61538
|
const toWrite = { provider: next.provider, model: next.model, mode: next.mode, maxSteps: next.maxSteps };
|
|
61451
61539
|
if (next.baseUrl)
|
|
61452
61540
|
toWrite.baseUrl = next.baseUrl;
|
|
@@ -63186,11 +63274,11 @@ function createVeskTools(deps) {
|
|
|
63186
63274
|
const contained = resolveWithin3(projectDir, info.path.slice(projectDir.length + 1));
|
|
63187
63275
|
if (!contained)
|
|
63188
63276
|
return jsonError("path escapes project root");
|
|
63189
|
-
const
|
|
63190
|
-
const patched = applySimpleConfigToggle(
|
|
63277
|
+
const current3 = readFileSync32(info.path, "utf-8");
|
|
63278
|
+
const patched = applySimpleConfigToggle(current3, key, a.value);
|
|
63191
63279
|
if (patched === null)
|
|
63192
63280
|
return jsonError("could not safely edit the config object; use the source editor");
|
|
63193
|
-
if (patched ===
|
|
63281
|
+
if (patched === current3)
|
|
63194
63282
|
return jsonOk({ ok: true, path: info.path, source: patched, unchanged: true });
|
|
63195
63283
|
writeFileSync18(info.path, patched, "utf-8");
|
|
63196
63284
|
return jsonOk({ ok: true, path: info.path, source: patched });
|
|
@@ -63320,11 +63408,11 @@ function createVeskTools(deps) {
|
|
|
63320
63408
|
const at2 = pkg.lastIndexOf("@");
|
|
63321
63409
|
if (at2 > 0)
|
|
63322
63410
|
name = pkg.slice(0, at2);
|
|
63323
|
-
const
|
|
63324
|
-
if (
|
|
63325
|
-
|
|
63326
|
-
|
|
63327
|
-
|
|
63411
|
+
const existing2 = state.plugins.find((p) => eqIgnoreCase3(p.package, pkg) || eqIgnoreCase3(p.package, name) || eqIgnoreCase3(p.name, name));
|
|
63412
|
+
if (existing2) {
|
|
63413
|
+
existing2.package = pkg;
|
|
63414
|
+
existing2.name = name;
|
|
63415
|
+
existing2.active = true;
|
|
63328
63416
|
} else {
|
|
63329
63417
|
state.plugins.push({ name, package: pkg, active: true });
|
|
63330
63418
|
}
|
|
@@ -63385,9 +63473,9 @@ function createVeskTools(deps) {
|
|
|
63385
63473
|
if (!name)
|
|
63386
63474
|
return jsonError('missing "name" in body');
|
|
63387
63475
|
const state = readPluginState3(veskDir);
|
|
63388
|
-
const
|
|
63389
|
-
if (
|
|
63390
|
-
|
|
63476
|
+
const existing2 = state.plugins.find((p) => eqIgnoreCase3(p.name, name) || eqIgnoreCase3(p.package, name));
|
|
63477
|
+
if (existing2) {
|
|
63478
|
+
existing2.active = true;
|
|
63391
63479
|
} else {
|
|
63392
63480
|
state.plugins.push({ name, package: name, active: true });
|
|
63393
63481
|
}
|
|
@@ -63417,9 +63505,9 @@ function createVeskTools(deps) {
|
|
|
63417
63505
|
if (!name)
|
|
63418
63506
|
return jsonError('missing "name" in body');
|
|
63419
63507
|
const state = readPluginState3(veskDir);
|
|
63420
|
-
const
|
|
63421
|
-
if (
|
|
63422
|
-
|
|
63508
|
+
const existing2 = state.plugins.find((p) => eqIgnoreCase3(p.name, name) || eqIgnoreCase3(p.package, name));
|
|
63509
|
+
if (existing2) {
|
|
63510
|
+
existing2.active = false;
|
|
63423
63511
|
} else {
|
|
63424
63512
|
state.plugins.push({ name, package: name, active: false });
|
|
63425
63513
|
}
|
|
@@ -63494,8 +63582,8 @@ function createVeskTools(deps) {
|
|
|
63494
63582
|
return jsonError("invalid checkpointId");
|
|
63495
63583
|
}
|
|
63496
63584
|
try {
|
|
63497
|
-
const
|
|
63498
|
-
if (
|
|
63585
|
+
const existing2 = getCheckpoint(projectDir, checkpointId);
|
|
63586
|
+
if (existing2) {
|
|
63499
63587
|
const rolled = rollback(projectDir, checkpointId);
|
|
63500
63588
|
if (rolled)
|
|
63501
63589
|
return jsonOk({ ok: true, checkpointId, checkpoint: rolled, rolledBack: true });
|
|
@@ -64430,10 +64518,10 @@ function parseCookies3(str3) {
|
|
|
64430
64518
|
// ../runtime/dist/action.js
|
|
64431
64519
|
var registryKey2 = "__vesk_actions";
|
|
64432
64520
|
function getActionRegistry2() {
|
|
64433
|
-
const
|
|
64434
|
-
if (!
|
|
64435
|
-
|
|
64436
|
-
return
|
|
64521
|
+
const g5 = globalThis;
|
|
64522
|
+
if (!g5[registryKey2])
|
|
64523
|
+
g5[registryKey2] = {};
|
|
64524
|
+
return g5[registryKey2];
|
|
64437
64525
|
}
|
|
64438
64526
|
function getAction2(id) {
|
|
64439
64527
|
return getActionRegistry2()[id] || null;
|
|
@@ -65089,9 +65177,9 @@ function storeDataScript(payload) {
|
|
|
65089
65177
|
return "/_vesk/ssr-data.js?t=" + token;
|
|
65090
65178
|
}
|
|
65091
65179
|
function currentSsrData() {
|
|
65092
|
-
const
|
|
65093
|
-
const token =
|
|
65094
|
-
const slot = (token ?
|
|
65180
|
+
const g5 = globalThis;
|
|
65181
|
+
const token = g5.__vsk_ssr_token;
|
|
65182
|
+
const slot = (token ? g5[`__vsk_ssr_data_${token}`] : void 0) || {};
|
|
65095
65183
|
return { ...ssrSink3.snapshot() || {}, ...slot };
|
|
65096
65184
|
}
|
|
65097
65185
|
function countPages(nodes) {
|
|
@@ -65184,9 +65272,9 @@ async function startDevServer(port, projectDir, config, host) {
|
|
|
65184
65272
|
}
|
|
65185
65273
|
}
|
|
65186
65274
|
function eventsStore() {
|
|
65187
|
-
const
|
|
65188
|
-
if (!
|
|
65189
|
-
return
|
|
65275
|
+
const g5 = globalThis;
|
|
65276
|
+
if (!g5.__vesk_server_ctx) g5.__vesk_server_ctx = {};
|
|
65277
|
+
return g5.__vesk_server_ctx;
|
|
65190
65278
|
}
|
|
65191
65279
|
function makeEventCtx(overrides) {
|
|
65192
65280
|
const store = eventsStore();
|
|
@@ -65482,9 +65570,9 @@ async function startDevServer(port, projectDir, config, host) {
|
|
|
65482
65570
|
function updateSourceMapping() {
|
|
65483
65571
|
sourceToComponents.clear();
|
|
65484
65572
|
for (const [compName, sourcePath2] of collectSources(routeTree)) {
|
|
65485
|
-
const
|
|
65486
|
-
|
|
65487
|
-
sourceToComponents.set(sourcePath2,
|
|
65573
|
+
const existing2 = sourceToComponents.get(sourcePath2) || [];
|
|
65574
|
+
existing2.push(compName);
|
|
65575
|
+
sourceToComponents.set(sourcePath2, existing2);
|
|
65488
65576
|
}
|
|
65489
65577
|
}
|
|
65490
65578
|
updateSourceMapping();
|
|
@@ -65684,12 +65772,12 @@ async function startDevServer(port, projectDir, config, host) {
|
|
|
65684
65772
|
debounceTimer = setTimeout(async () => {
|
|
65685
65773
|
const t0 = Date.now();
|
|
65686
65774
|
try {
|
|
65687
|
-
const
|
|
65688
|
-
if (eventType !== "rename" &&
|
|
65775
|
+
const current3 = fileExists ? readFileSync38(fullPath, "utf-8") : null;
|
|
65776
|
+
if (eventType !== "rename" && current3 !== null && lastSeenContent.get(fullPath) === current3) {
|
|
65689
65777
|
LOG.info(`skipped unchanged (${filename})`);
|
|
65690
65778
|
return;
|
|
65691
65779
|
}
|
|
65692
|
-
lastSeenContent.set(fullPath,
|
|
65780
|
+
lastSeenContent.set(fullPath, current3);
|
|
65693
65781
|
if (typeof globalThis.__vesk_broadcastHmr === "function") {
|
|
65694
65782
|
globalThis.__vesk_broadcastHmr({ type: "compiling" });
|
|
65695
65783
|
}
|
|
@@ -65713,8 +65801,8 @@ async function startDevServer(port, projectDir, config, host) {
|
|
|
65713
65801
|
if (treeChanged || isOutsideApp || fileDeleted) {
|
|
65714
65802
|
await buildClientBundle();
|
|
65715
65803
|
await bundleRuntime2();
|
|
65716
|
-
} else if (fileExists &&
|
|
65717
|
-
let source =
|
|
65804
|
+
} else if (fileExists && current3 !== null) {
|
|
65805
|
+
let source = current3;
|
|
65718
65806
|
if (/content=["'][^"']*\.md["']/i.test(source)) {
|
|
65719
65807
|
source = inlineMdContentAttrs2(source, dirname26(fullPath), guessProjectRoots2(appDirPath));
|
|
65720
65808
|
}
|