@vesk/compiler 0.1.14 → 0.2.9

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.
Files changed (50) hide show
  1. package/dist/api-routes.d.ts +6 -1
  2. package/dist/api-routes.d.ts.map +1 -1
  3. package/dist/api-routes.js +52 -7
  4. package/dist/client-codegen.d.ts +15 -0
  5. package/dist/client-codegen.d.ts.map +1 -1
  6. package/dist/client-codegen.js +84 -11
  7. package/dist/config.d.ts +2 -0
  8. package/dist/config.d.ts.map +1 -1
  9. package/dist/config.js +25 -0
  10. package/dist/errors.d.ts.map +1 -1
  11. package/dist/errors.js +33 -4
  12. package/dist/ir-generator.d.ts.map +1 -1
  13. package/dist/ir-generator.js +208 -9
  14. package/dist/md-inline.d.ts +17 -0
  15. package/dist/md-inline.d.ts.map +1 -0
  16. package/dist/md-inline.js +149 -0
  17. package/dist/middleware.d.ts.map +1 -1
  18. package/dist/middleware.js +42 -7
  19. package/dist/module-imports.d.ts +51 -0
  20. package/dist/module-imports.d.ts.map +1 -0
  21. package/dist/module-imports.js +715 -0
  22. package/dist/router.d.ts +2 -0
  23. package/dist/router.d.ts.map +1 -1
  24. package/dist/router.js +48 -3
  25. package/dist/server-codegen.d.ts +1 -1
  26. package/dist/server-codegen.d.ts.map +1 -1
  27. package/dist/server-codegen.js +1 -1
  28. package/dist/server-jsgen.d.ts.map +1 -1
  29. package/dist/server-jsgen.js +9 -4
  30. package/dist/server-render.d.ts.map +1 -1
  31. package/dist/server-render.js +30 -10
  32. package/dist/server-utils.d.ts +31 -0
  33. package/dist/server-utils.d.ts.map +1 -1
  34. package/dist/server-utils.js +478 -52
  35. package/dist/tokens.d.ts.map +1 -1
  36. package/dist/tokens.js +24 -1
  37. package/dist/typecheck.d.ts +2 -2
  38. package/dist/typecheck.d.ts.map +1 -1
  39. package/dist/typecheck.js +71 -27
  40. package/dist/types.d.ts +4 -129
  41. package/dist/types.d.ts.map +1 -1
  42. package/dist/types.js +1 -0
  43. package/dist/vesk-plugin.d.ts +3 -0
  44. package/dist/vesk-plugin.d.ts.map +1 -1
  45. package/dist/vesk-plugin.js +518 -1
  46. package/dist/vsk-imports.d.ts.map +1 -1
  47. package/dist/vsk-imports.js +3 -1
  48. package/dist/vsk-tsx.d.ts.map +1 -1
  49. package/dist/vsk-tsx.js +27 -5
  50. package/package.json +2 -1
package/dist/router.d.ts CHANGED
@@ -15,6 +15,8 @@ export interface MatchResult {
15
15
  * handled correctly; falls back to the old regex + brace balance when the
16
16
  * source does not parse.
17
17
  */
18
+ /** Collapses runs of `/` into single slashes (no regex). */
19
+ export declare function collapseSlashes(p: string): string;
18
20
  export declare function extractMiddlewareParts(src: string): {
19
21
  params: string;
20
22
  body: string;
@@ -1 +1 @@
1
- {"version":3,"file":"router.d.ts","sourceRoot":"","sources":["../src/router.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAM1D,MAAM,WAAW,WAAW;IAC1B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,SAAS,EAAE,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAChC;AAED;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,MAAM,GAAG;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAsB3F;AAkDD,wBAAgB,iBAAiB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAUnE;AAED,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,GAAE,WAAgB,GAAG,SAAS,EAAE,CAKjF;AAMD,wBAAgB,cAAc,CAAC,aAAa,EAAE,M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AMD,wBAAgB,cAAc,CAAC,aAAa,EAAE,MAAM,GAAG,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CA2BzE;AA2HD,wBAAgB,cAAc,CAAC,IAAI,EAAE,SAAS,EAAE,GAAG,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAgBrE;AAED,MAAM,WAAW,oBAAoB;IACnC,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,SAAS,EAAE,EAAE,OAAO,GAAE,oBAAyB,GAAG,MAAM,CAkCnG;AAoBD,wBAAgB,QAAQ,CAAC,IAAI,EAAE,SAAS,EAAE,EAAE,QAAQ,EAAE,MAAM,GAAG,WAAW,GAAG,IAAI,CAiFhF"}
package/dist/router.js CHANGED
@@ -11,6 +11,23 @@ import { hasTsSyntax, stripCodeTypes } from '@vesk/compiler/src/strip-ts';
11
11
  * handled correctly; falls back to the old regex + brace balance when the
12
12
  * source does not parse.
13
13
  */
14
+ /** Collapses runs of `/` into single slashes (no regex). */
15
+ export function collapseSlashes(p) {
16
+ let out = '';
17
+ let prevSlash = false;
18
+ for (const c of p) {
19
+ if (c === '/') {
20
+ if (!prevSlash)
21
+ out += '/';
22
+ prevSlash = true;
23
+ }
24
+ else {
25
+ out += c;
26
+ prevSlash = false;
27
+ }
28
+ }
29
+ return out;
30
+ }
14
31
  export function extractMiddlewareParts(src) {
15
32
  try {
16
33
  let ast = parse(src, { filename: 'middleware.ts' });
@@ -180,6 +197,8 @@ function scanDirectory(rootDir, dir, parentPath, options) {
180
197
  let hasLoading = false;
181
198
  let hasError = false;
182
199
  let hasNotFound = false;
200
+ let hasOffline = false;
201
+ let hasNetwork = false;
183
202
  let hasMiddleware = false;
184
203
  for (const entry of entries) {
185
204
  if (entry === 'layout.vsk') {
@@ -202,6 +221,14 @@ function scanDirectory(rootDir, dir, parentPath, options) {
202
221
  hasNotFound = true;
203
222
  continue;
204
223
  }
224
+ if (entry === 'offline.vsk') {
225
+ hasOffline = true;
226
+ continue;
227
+ }
228
+ if (entry === 'network.vsk') {
229
+ hasNetwork = true;
230
+ continue;
231
+ }
205
232
  if (entry === 'middleware.ts') {
206
233
  hasMiddleware = true;
207
234
  continue;
@@ -235,7 +262,7 @@ function scanDirectory(rootDir, dir, parentPath, options) {
235
262
  : (parentPath || '/');
236
263
  const node = {
237
264
  path: seg,
238
- fullPath: fullPath.replace(/\/+/g, '/') || '/',
265
+ fullPath: collapseSlashes(fullPath) || '/',
239
266
  isGroup,
240
267
  isDynamic,
241
268
  isCatchAll,
@@ -244,6 +271,8 @@ function scanDirectory(rootDir, dir, parentPath, options) {
244
271
  loading: hasLoading ? extractComponentName(dir, 'loading', rootDir) : null,
245
272
  error: hasError ? extractComponentName(dir, 'error', rootDir) : null,
246
273
  notFound: hasNotFound ? extractComponentName(dir, 'not-found', rootDir) : null,
274
+ offline: hasOffline ? extractComponentName(dir, 'offline', rootDir) : null,
275
+ network: hasNetwork ? extractComponentName(dir, 'network', rootDir) : null,
247
276
  hasMiddleware,
248
277
  children: [],
249
278
  sourceDir: dir,
@@ -292,6 +321,10 @@ function extractComponentName(dir, type, rootDir) {
292
321
  return 'Error_' + capitalized;
293
322
  if (type === 'not-found')
294
323
  return 'NotFound_' + capitalized;
324
+ if (type === 'offline')
325
+ return 'Offline_' + capitalized;
326
+ if (type === 'network')
327
+ return 'Network_' + capitalized;
295
328
  return type + '_' + capitalized;
296
329
  }
297
330
  export function collectSources(tree) {
@@ -308,6 +341,10 @@ export function collectSources(tree) {
308
341
  map.set(node.error, join(node.sourceDir, 'error.vsk'));
309
342
  if (node.notFound)
310
343
  map.set(node.notFound, join(node.sourceDir, 'not-found.vsk'));
344
+ if (node.offline)
345
+ map.set(node.offline, join(node.sourceDir, 'offline.vsk'));
346
+ if (node.network)
347
+ map.set(node.network, join(node.sourceDir, 'network.vsk'));
311
348
  walk(node.children);
312
349
  }
313
350
  }
@@ -328,9 +365,13 @@ export function generateRouteManifest(tree, options = {}) {
328
365
  parts.push(`error: ${node.error}`);
329
366
  if (node.notFound)
330
367
  parts.push(`notFound: ${node.notFound}`);
368
+ if (node.offline)
369
+ parts.push(`offline: ${node.offline}`);
370
+ if (node.network)
371
+ parts.push(`network: ${node.network}`);
331
372
  if (node.children.length > 0) {
332
- const childCodes = node.children.map(c => genNode(c));
333
- parts.push(`children: [\n${childCodes.map(c => '\t\t' + c).join(',\n')}\n\t]`);
373
+ const childCodes = node.children.map((c) => genNode(c));
374
+ parts.push(`children: [\n${childCodes.map((c) => '\t\t' + c).join(',\n')}\n\t]`);
334
375
  }
335
376
  const pathStr = JSON.stringify(node.fullPath);
336
377
  const groupStr = node.isGroup ? `, isGroup: true` : '';
@@ -363,6 +404,10 @@ function flattenSources(tree) {
363
404
  map.set(node.error, node.sourceDir + '/error.vsk');
364
405
  if (node.notFound)
365
406
  map.set(node.notFound, node.sourceDir + '/not-found.vsk');
407
+ if (node.offline)
408
+ map.set(node.offline, node.sourceDir + '/offline.vsk');
409
+ if (node.network)
410
+ map.set(node.network, node.sourceDir + '/network.vsk');
366
411
  walk(node.children);
367
412
  }
368
413
  }
@@ -1,4 +1,4 @@
1
- export { setRuntimeModule, prettifyHtml, isStatic, escapeHtml, raw, exprJS, tryEvalExpr, childrenToHTML, extractTopLevelNames, extractRuntimeNames, buildParamInit, resolveComponentName, loadRuntimeImports, evalTopLevelCode, callStaticProps, callLoadFunction, __vskHydrate, __vskId, __vskImportedNames, resetVskState, setVskHydrate, setVskImportedNames, securityHeaders, corsHeaders, corsPreflight, csrfToken, verifyCsrfToken, csrfGuard, signCookie, unsignCookie, setSignedCookie, readSignedCookie, securityComment, redactLog, setRedactLogging, createRateLimiter, getClientIp, getClientProtocol, applyTrustProxy, } from '@vesk/compiler/src/server-utils';
1
+ export { setRuntimeModule, prettifyHtml, isStatic, escapeHtml, quoteAttr, safeJsonForScript, randomToken, DEFAULT_MAX_BODY_BYTES, raw, exprJS, tryEvalExpr, childrenToHTML, extractTopLevelNames, extractRuntimeNames, buildParamInit, resolveComponentName, loadRuntimeImports, evalTopLevelCode, callStaticProps, callLoadFunction, __vskHydrate, __vskId, __vskImportedNames, resetVskState, setVskHydrate, setVskImportedNames, securityHeaders, corsHeaders, corsPreflight, csrfToken, verifyCsrfToken, csrfGuard, csrfHmac, assertSameOrigin, signCookie, unsignCookie, setSignedCookie, readSignedCookie, securityComment, redactLog, setRedactLogging, createRateLimiter, getClientIp, getClientProtocol, applyTrustProxy, } from '@vesk/compiler/src/server-utils';
2
2
  export { renderHeadHtml, mergeHeadHtml, } from '@vesk/compiler/src/server-head';
3
3
  export { irNodeToJS, generateFunctionBody, buildComponentMap, } from '@vesk/compiler/src/server-jsgen';
4
4
  export { compileFile, render, renderPage, ssg, renderFullPage, renderPageStream, buildDataScripts, } from '@vesk/compiler/src/server-render';
@@ -1 +1 @@
1
- {"version":3,"file":"server-codegen.d.ts","sourceRoot":"","sources":["../src/server-codegen.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,YAAY,EACZ,QAAQ,EACR,UAAU,EACV,GAAG,EACH,MAAM,EACN,WAAW,EACX,cAAc,EACd,oBAAoB,EACpB,mBAAmB,EACnB,cAAc,EACd,oBAAoB,EACpB,kBAAkB,EAClB,gBAAgB,EAChB,eAAe,EACf,gBAAgB,EAChB,YAAY,EACZ,OAAO,EACP,kBAAkB,EAClB,aAAa,EACb,aAAa,EACb,mBAAmB,EACnB,eAAe,EACf,WAAW,EACX,aAAa,EACb,SAAS,EACT,eAAe,EACf,SAAS,EACT,UAAU,EACV,YAAY,EACZ,eAAe,EACf,gBAAgB,EAChB,eAAe,EACf,SAAS,EACT,gBAAgB,EAChB,iBAAiB,EACjB,WAAW,EACX,iBAAiB,EACjB,eAAe,GAChB,MAAM,iCAAiC,CAAC;AAEzC,OAAO,EACL,cAAc,EACd,aAAa,GACd,MAAM,gCAAgC,CAAC;AAExC,OAAO,EACL,UAAU,EACV,oBAAoB,EACpB,iBAAiB,GAClB,MAAM,iCAAiC,CAAC;AAEzC,OAAO,EACL,WAAW,EACX,MAAM,EACN,UAAU,EACV,GAAG,EACH,cAAc,EACd,gBAAgB,EAChB,gBAAgB,GACjB,MAAM,kCAAkC,CAAC"}
1
+ {"version":3,"file":"server-codegen.d.ts","sourceRoot":"","sources":["../src/server-codegen.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,YAAY,EACZ,QAAQ,EACR,UAAU,EACV,SAAS,EACT,iBAAiB,EACjB,WAAW,EACX,sBAAsB,EACtB,GAAG,EACH,MAAM,EACN,WAAW,EACX,cAAc,EACd,oBAAoB,EACpB,mBAAmB,EACnB,cAAc,EACd,oBAAoB,EACpB,kBAAkB,EAClB,gBAAgB,EAChB,eAAe,EACf,gBAAgB,EAChB,YAAY,EACZ,OAAO,EACP,kBAAkB,EAClB,aAAa,EACb,aAAa,EACb,mBAAmB,EACnB,eAAe,EACf,WAAW,EACX,aAAa,EACb,SAAS,EACT,eAAe,EACf,SAAS,EACT,QAAQ,EACR,gBAAgB,EAChB,UAAU,EACV,YAAY,EACZ,eAAe,EACf,gBAAgB,EAChB,eAAe,EACf,SAAS,EACT,gBAAgB,EAChB,iBAAiB,EACjB,WAAW,EACX,iBAAiB,EACjB,eAAe,GAChB,MAAM,iCAAiC,CAAC;AAEzC,OAAO,EACL,cAAc,EACd,aAAa,GACd,MAAM,gCAAgC,CAAC;AAExC,OAAO,EACL,UAAU,EACV,oBAAoB,EACpB,iBAAiB,GAClB,MAAM,iCAAiC,CAAC;AAEzC,OAAO,EACL,WAAW,EACX,MAAM,EACN,UAAU,EACV,GAAG,EACH,cAAc,EACd,gBAAgB,EAChB,gBAAgB,GACjB,MAAM,kCAAkC,CAAC"}
@@ -1,4 +1,4 @@
1
- export { setRuntimeModule, prettifyHtml, isStatic, escapeHtml, raw, exprJS, tryEvalExpr, childrenToHTML, extractTopLevelNames, extractRuntimeNames, buildParamInit, resolveComponentName, loadRuntimeImports, evalTopLevelCode, callStaticProps, callLoadFunction, __vskHydrate, __vskId, __vskImportedNames, resetVskState, setVskHydrate, setVskImportedNames, securityHeaders, corsHeaders, corsPreflight, csrfToken, verifyCsrfToken, csrfGuard, signCookie, unsignCookie, setSignedCookie, readSignedCookie, securityComment, redactLog, setRedactLogging, createRateLimiter, getClientIp, getClientProtocol, applyTrustProxy, } from '@vesk/compiler/src/server-utils';
1
+ export { setRuntimeModule, prettifyHtml, isStatic, escapeHtml, quoteAttr, safeJsonForScript, randomToken, DEFAULT_MAX_BODY_BYTES, raw, exprJS, tryEvalExpr, childrenToHTML, extractTopLevelNames, extractRuntimeNames, buildParamInit, resolveComponentName, loadRuntimeImports, evalTopLevelCode, callStaticProps, callLoadFunction, __vskHydrate, __vskId, __vskImportedNames, resetVskState, setVskHydrate, setVskImportedNames, securityHeaders, corsHeaders, corsPreflight, csrfToken, verifyCsrfToken, csrfGuard, csrfHmac, assertSameOrigin, signCookie, unsignCookie, setSignedCookie, readSignedCookie, securityComment, redactLog, setRedactLogging, createRateLimiter, getClientIp, getClientProtocol, applyTrustProxy, } from '@vesk/compiler/src/server-utils';
2
2
  export { renderHeadHtml, mergeHeadHtml, } from '@vesk/compiler/src/server-head';
3
3
  export { irNodeToJS, generateFunctionBody, buildComponentMap, } from '@vesk/compiler/src/server-jsgen';
4
4
  export { compileFile, render, renderPage, ssg, renderFullPage, renderPageStream, buildDataScripts, } from '@vesk/compiler/src/server-render';
@@ -1 +1 @@
1
- {"version":3,"file":"server-jsgen.d.ts","sourceRoot":"","sources":["../src/server-jsgen.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAOzE,OAAO,EAA4E,KAAK,WAAW,EAAE,MAAM,mCAAmC,CAAC;AAU/I,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,aAAa,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,GAAG,IAAI,EAAE,OAAO,GAAE,OAAe,EAAE,OAAO,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,WAAW,CAAC,GAAG,MAAM,CA8CjJ;AA4SD,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,WAAW,EAAE,aAAa,EAAE,GAAG,CAAC,MAAM,CAAC,GAAG,MAAM,CAmD1F;AAED,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,EAAE,cAAc,EAAE,OAAO,GAAG,GAAG,CAAC,MAAM,EAAE,QAAQ,CAAC,CAwBhG"}
1
+ {"version":3,"file":"server-jsgen.d.ts","sourceRoot":"","sources":["../src/server-jsgen.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAOzE,OAAO,EAA4E,KAAK,WAAW,EAAE,MAAM,mCAAmC,CAAC;AAW/I,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,aAAa,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,GAAG,IAAI,EAAE,OAAO,GAAE,OAAe,EAAE,OAAO,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,WAAW,CAAC,GAAG,MAAM,CA8CjJ;AA4SD,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,WAAW,EAAE,aAAa,EAAE,GAAG,CAAC,MAAM,CAAC,GAAG,MAAM,CAmD1F;AAED,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,EAAE,cAAc,EAAE,OAAO,GAAG,GAAG,CAAC,MAAM,EAAE,QAAQ,CAAC,CA4BhG"}
@@ -2,6 +2,7 @@ import { StaticNode, TextNode, DynamicBinding, OpaqueDynamicRegion, MapRegion, W
2
2
  import { isStaticIR, collectTrackedNames, transformTracked, semicolonizeStatement } from '@vesk/compiler/src/client-codegen';
3
3
  import { unwrapTrackCall, stripTrackGeneric, hasTopLevelComma, skipWhitespace, findBalancedEnd, startsWithIdentifier } from '@vesk/compiler/src/scan';
4
4
  import { escapeHtml, indent, exprJS, extractTopLevelNames, extractRuntimeNames, buildParamInit, __vskHydrate, __vskImportedNames, setVskImportedNames, setVskForceClaim, takeVskForceClaim, nextVskId, } from '@vesk/compiler/src/server-utils';
5
+ import { localValueImportNames } from '@vesk/compiler/src/module-imports';
5
6
  export function irNodeToJS(node, importedNames, isAsync = false, tracked) {
6
7
  importedNames = importedNames || __vskImportedNames;
7
8
  if (node instanceof StaticNode)
@@ -378,7 +379,7 @@ export function generateFunctionBody(comp, importedNames) {
378
379
  lines.push(`const __prev = __ga();`);
379
380
  lines.push(`__sa({ c: null, p: __prev });`);
380
381
  lines.push(`try {`);
381
- lines.push(`const __escape = (s) => String(s).replace(/&/g,'&amp;').replace(/</g,'&lt;').replace(/>/g,'&gt;').replace(/\x22/g,'&quot;');`);
382
+ lines.push(`const __escape = (s) => { s = String(s); return s.split('&').join('&amp;').split('<').join('&lt;').split('>').join('&gt;').split(${JSON.stringify('"')}).join('&quot;'); };`);
382
383
  lines.push(`const raw = (s) => s == null ? '' : String(s);`);
383
384
  lines.push(`const __tk = globalThis.__vsk_ssr_token || '';`);
384
385
  if (asyncMode) {
@@ -422,17 +423,21 @@ export function generateFunctionBody(comp, importedNames) {
422
423
  export function buildComponentMap(irRoot, useSharedScope) {
423
424
  const map = new Map();
424
425
  const runtimeNames = extractRuntimeNames(irRoot.imports);
425
- const importedNames = new Set(runtimeNames);
426
+ const localValueNames = localValueImportNames(irRoot.imports);
427
+ const importedNames = new Set([...runtimeNames, ...localValueNames]);
426
428
  const topNames = extractTopLevelNames(irRoot.topLevelCode);
427
429
  const hasTracked = irRoot.components.some((c) => c.body.some((n) => n instanceof TrackDecl));
428
430
  const extraNames = hasTracked ? ['get', 'set', 'track'] : [];
429
- const allNames = [...new Set([...runtimeNames, ...topNames, ...extraNames])];
431
+ const allNames = [...new Set([...runtimeNames, ...topNames, ...extraNames, ...localValueNames])];
430
432
  const scopeDecl = allNames.length > 0 ? `const { ${allNames.join(', ')} } = __vesk;\n` : '';
431
433
  setVskImportedNames(importedNames);
432
434
  for (const comp of irRoot.components) {
433
435
  const bodyCode = generateFunctionBody(comp, importedNames);
434
436
  const paramInit = buildParamInit(comp.paramNames);
435
- const code = `${scopeDecl}${paramInit}\n${bodyCode}`;
437
+ const diag = process.env.VESK_SSR_LOG
438
+ ? `console.error('[SSR-CALL]', ${JSON.stringify(comp.name)}, props ? JSON.stringify(props) : String(props));\n`
439
+ : '';
440
+ const code = `${scopeDecl}${paramInit}${diag}\n${bodyCode}`;
436
441
  let fn;
437
442
  if (comp.isAsync || comp.ssrAwait) {
438
443
  fn = new Function('props', '__registry', '__vesk', `return (async () => {\n${code}\n})()`);
@@ -1 +1 @@
1
- {"version":3,"file":"server-render.d.ts","sourceRoot":"","sources":["../src/server-render.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,SAAS,EAAE,eAAe,EAAqB,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAcvJ,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;IAAE,UAAU,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,iBAAiB,CAEhG;AA0BD,wBAAgB,MAAM,CACpB,MAAM,EAAE,MAAM,EACd,aAAa,EAAE,MAAM,EACrB,KAAK,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,EACnC,QAAQ,GAAE,GAAG,CAAC,MAAM,EAAE,QAAQ,CAAa,EAC3C,OAAO,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,GACpC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAkC1B;AAED,wBAAgB,UAAU,CACxB,MAAM,EAAE,MAAM,EACd,aAAa,EAAE,MAAM,EACrB,KAAK,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,EACnC,QAAQ,GAAE,GAAG,CAAC,MAAM,EAAE,QAAQ,CAAa,EAC3C,OAAO,GAAE,MAAM,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S,CAAC,CA8DpB;AAED,wBAAgB,gBAAgB,CAC9B,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,GAAG,SAAS,EACpD,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAChC,QAAQ,CAAC,EAAE,kBAAkB,GAAG,IAAI,GACnC,MAAM,EAAE,CAuBV;AAED,wBAAsB,cAAc,CAClC,MAAM,EAAE,MAAM,EACd,aAAa,EAAE,MAAM,EACrB,KAAK,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,EACnC,QAAQ,GAAE,GAAG,CAAC,MAAM,EAAE,QAAQ,CAAa,EAC3C,OAAO,GAAE,eAAoB,GAC5B,OAAO,CAAC,MAAM,CAAC,CAoEjB;AAED,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,MAAM,EACd,aAAa,EAAE,MAAM,EACrB,KAAK,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,EACnC,QAAQ,GAAE,GAAG,CAAC,MAAM,EAAE,QAAQ,CAAa,EAC3C,OAAO,GAAE,eAAoB,GAC5B,cAAc,CAAC,MAAM,CAAC,CAsFxB"}
@@ -1,21 +1,30 @@
1
1
  import { readFileSync } from 'node:fs';
2
+ import { dirname } from 'node:path';
2
3
  import { MapRegion } from '@vesk/compiler/src/ir';
3
4
  import { parse } from '@vesk/compiler/src/parser';
4
5
  import { generateIR } from '@vesk/compiler/src/ir-generator';
5
6
  import { compileClient, isStaticIR } from '@vesk/compiler/src/client-codegen';
6
- import { isStatic, prettifyHtml, resetVskState, loadRuntimeImports, evalTopLevelCode, callStaticProps, callLoadFunction, } from '@vesk/compiler/src/server-utils';
7
+ import { isStatic, prettifyHtml, resetVskState, loadRuntimeImports, evalTopLevelCode, callStaticProps, callLoadFunction, safeJsonForScript, quoteAttr, } from '@vesk/compiler/src/server-utils';
7
8
  import { renderHeadHtml, mergeHeadHtml } from '@vesk/compiler/src/server-head';
8
9
  import { buildComponentMap } from '@vesk/compiler/src/server-jsgen';
9
10
  import { transformTopLevelForActions } from '@vesk/compiler/src/actions';
10
11
  import { collectVskImportPaths } from '@vesk/compiler/src/vsk-imports';
12
+ import { inlineMdImportsFrom, guessProjectRoots } from '@vesk/compiler/src/md-inline';
11
13
  import { withSsrStore, ssrSink } from '@vesk/compiler/src/ssr-store';
14
+ import { applyLocalModuleImports } from '@vesk/compiler/src/module-imports';
12
15
  export function compileFile(source, options) {
13
16
  return compileFileInternal(source, options?.sourcePath, new Set());
14
17
  }
15
18
  function compileFileInternal(source, sourcePath, seenImportFiles) {
19
+ if (sourcePath) {
20
+ const dir = dirname(sourcePath);
21
+ source = inlineMdImportsFrom(source, sourcePath, guessProjectRoots(dir));
22
+ }
16
23
  const ast = parse(source);
17
24
  const ir = generateIR(ast, source);
18
25
  const componentMap = buildComponentMap(ir, true);
26
+ const __vesk = loadRuntimeImports(ir.imports);
27
+ applyLocalModuleImports(__vesk, ir.imports, sourcePath);
19
28
  if (sourcePath) {
20
29
  for (const importPath of collectVskImportPaths(ir.imports, sourcePath)) {
21
30
  if (seenImportFiles.has(importPath))
@@ -28,13 +37,20 @@ function compileFileInternal(source, sourcePath, seenImportFiles) {
28
37
  if (!componentMap.has(name))
29
38
  componentMap.set(name, fn);
30
39
  }
40
+ // Hoist the sub-`.vsk`'s scope into this file's so that
41
+ // registry-hoisted sub components (called with this `__vesk`) can
42
+ // destructure runtime imports, module values and top-level helpers.
43
+ for (const key of Object.keys(sub.__vesk)) {
44
+ if (key in __vesk)
45
+ continue;
46
+ __vesk[key] = sub.__vesk[key];
47
+ }
31
48
  }
32
49
  catch {
33
50
  // skip unresolvable imports
34
51
  }
35
52
  }
36
53
  }
37
- const __vesk = loadRuntimeImports(ir.imports);
38
54
  evalTopLevelCode(transformTopLevelForActions(ir.topLevelCode, 'server'), __vesk);
39
55
  return { ir, componentMap, __vesk };
40
56
  }
@@ -190,7 +206,7 @@ export async function ssg(source, componentName, customProps, options = {}) {
190
206
  const clientCode = needsClient
191
207
  ? compileClient(source, null, { hydrate: true })
192
208
  : '';
193
- const serializedProps = JSON.stringify(props);
209
+ const serializedProps = safeJsonForScript(JSON.stringify(props));
194
210
  const hasClient = clientCode.length > 0;
195
211
  const scriptBlock = hasClient
196
212
  ? `\n<script>const __vesk_props = ${serializedProps};\n<\/script>\n<script>${clientCode}</script>\n`
@@ -240,9 +256,9 @@ export function buildDataScripts(ssrProps, ssrData, external) {
240
256
  }
241
257
  const scripts = [];
242
258
  if (hasProps)
243
- scripts.push(`\t<script>const __vesk_props = ${JSON.stringify(payload.props)};</script>`);
259
+ scripts.push(`\t<script>const __vesk_props = ${safeJsonForScript(JSON.stringify(payload.props))};</script>`);
244
260
  if (hasData)
245
- scripts.push(`\t<script>globalThis.__vsk_ssr_data = ${JSON.stringify(ssrData)};</script>`);
261
+ scripts.push(`\t<script>globalThis.__vsk_ssr_data = ${safeJsonForScript(JSON.stringify(ssrData))};</script>`);
246
262
  return scripts;
247
263
  }
248
264
  export async function renderFullPage(source, componentName, props = {}, registry = new Map(), options = {}) {
@@ -293,9 +309,9 @@ export async function renderFullPage(source, componentName, props = {}, registry
293
309
  if (options.security) {
294
310
  const sec = options.security;
295
311
  if (sec.referrerPolicy !== false)
296
- headLines.push(`\t<meta name="referrer" content="${sec.referrerPolicy || 'strict-origin-when-cross-origin'}" />`);
312
+ headLines.push(`\t<meta name="referrer" content="${quoteAttr(sec.referrerPolicy || 'strict-origin-when-cross-origin')}" />`);
297
313
  if (sec.contentSecurityPolicy !== false)
298
- headLines.push(`\t<meta http-equiv="Content-Security-Policy" content="${(sec.contentSecurityPolicy || "default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' data:; font-src 'self'; frame-src 'self'; connect-src 'self'; object-src 'none'; base-uri 'self'; form-action 'self'").replace(/"/g, '&quot;')}" />`);
314
+ headLines.push(`\t<meta http-equiv="Content-Security-Policy" content="${quoteAttr(sec.contentSecurityPolicy || "default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' data:; font-src 'self'; frame-src 'self'; connect-src 'self'; object-src 'none'; base-uri 'self'; form-action 'self'")}" />`);
299
315
  if (sec.autoEscape !== false)
300
316
  headLines.push(`\t<!-- vesk: auto-escape enabled -->`);
301
317
  }
@@ -321,7 +337,11 @@ export function renderPageStream(source, componentName, props = {}, registry = n
321
337
  const ir = cached ? cached.ir : generateIR(parse(source), source);
322
338
  let ssrProps = { ...props };
323
339
  let serializedProps = null;
324
- let __vesk = options.__vesk || cached?.__vesk || loadRuntimeImports(ir.imports);
340
+ let __vesk = options.__vesk || cached?.__vesk || null;
341
+ if (!__vesk) {
342
+ __vesk = loadRuntimeImports(ir.imports);
343
+ applyLocalModuleImports(__vesk, ir.imports, options.sourcePath || undefined);
344
+ }
325
345
  if (ir.loadFn) {
326
346
  const loadResult = await callLoadFunction(ir.loadFn, props, __vesk);
327
347
  if (loadResult && typeof loadResult === 'object') {
@@ -348,9 +368,9 @@ export function renderPageStream(source, componentName, props = {}, registry = n
348
368
  if (options.security) {
349
369
  const sec = options.security;
350
370
  if (sec.referrerPolicy !== false)
351
- yield `\t<meta name="referrer" content="${sec.referrerPolicy || 'strict-origin-when-cross-origin'}" />\n`;
371
+ yield `\t<meta name="referrer" content="${quoteAttr(sec.referrerPolicy || 'strict-origin-when-cross-origin')}" />\n`;
352
372
  if (sec.contentSecurityPolicy !== false)
353
- yield `\t<meta http-equiv="Content-Security-Policy" content="${(sec.contentSecurityPolicy || "default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' data:; font-src 'self'; frame-src 'self'; connect-src 'self'; object-src 'none'; base-uri 'self'; form-action 'self'").replace(/"/g, '&quot;')}" />\n`;
373
+ yield `\t<meta http-equiv="Content-Security-Policy" content="${quoteAttr(sec.contentSecurityPolicy || "default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' data:; font-src 'self'; frame-src 'self'; connect-src 'self'; object-src 'none'; base-uri 'self'; form-action 'self'")}" />\n`;
354
374
  if (sec.autoEscape !== false)
355
375
  yield `\t<!-- vesk: auto-escape enabled -->\n`;
356
376
  }
@@ -12,12 +12,36 @@ export declare function nextVskId(): number;
12
12
  export declare function prettifyHtml(html: string): string;
13
13
  export declare function isStatic(body: IRNode[]): boolean;
14
14
  export declare function escapeHtml(str: string): string;
15
+ /** Escapes double quotes for embedding text inside a double-quoted attribute. */
16
+ export declare function quoteAttr(str: string): string;
17
+ /**
18
+ * Makes JSON output safe to embed inside an inline <script> block.
19
+ * Escapes `<` (breaks out of script context via `</script>`), line
20
+ * separators U+2028/U+2029 (valid JSON but invalid JS string literals).
21
+ */
22
+ export declare function safeJsonForScript(json: string): string;
23
+ /** Cryptographically strong random hex token (WebCrypto CSPRNG). */
24
+ export declare function randomToken(bytes?: number): string;
25
+ /** Default request-body cap (bytes) for servers and action/API handlers. */
26
+ export declare const DEFAULT_MAX_BODY_BYTES: number;
15
27
  export declare function redactLog(str: string): string;
16
28
  export declare function setRedactLogging(enabled: boolean): void;
17
29
  export declare function raw(value: unknown): string;
30
+ /** HMAC-SHA256 over `value` keyed by `secret`, hex-encoded. */
31
+ export declare function csrfHmac(value: string, secret: string): string;
18
32
  export declare function csrfToken(sessionId?: string, host?: string): string;
19
33
  export declare function verifyCsrfToken(token: string, host?: string): boolean;
20
34
  export declare function csrfGuard(request: Record<string, unknown>, host?: string): void;
35
+ /** Extracts the authority (host[:port]) part of an absolute URL. */
36
+ export declare function urlAuthority(url: string): string;
37
+ /**
38
+ * Default CSRF defense: unsafe methods must present an Origin or Referer
39
+ * whose authority matches the request Host. Browsers always attach Origin
40
+ * to cross-site POSTs, so mismatches are blocked; non-browser clients that
41
+ * send no Origin/Referer are allowed (they cannot be CSRF'd).
42
+ * Throws a 403-status error on mismatch.
43
+ */
44
+ export declare function assertSameOrigin(request: Record<string, unknown>): void;
21
45
  export declare function signCookie(name: string, value: string, host?: string): Promise<string>;
22
46
  export declare function unsignCookie(name: string, signedValue: string, host?: string): Promise<string | null>;
23
47
  export interface CookieOptions {
@@ -63,6 +87,8 @@ export interface RateLimitOptions {
63
87
  windowMs?: number;
64
88
  max?: number;
65
89
  cleanupIntervalMs?: number;
90
+ /** Only honor proxy headers (x-forwarded-for etc.) when explicitly trusted. */
91
+ trustProxy?: boolean;
66
92
  }
67
93
  export declare function createRateLimiter(options?: RateLimitOptions): {
68
94
  check: (key: string) => boolean;
@@ -74,6 +100,11 @@ export declare function createRateLimiter(options?: RateLimitOptions): {
74
100
  };
75
101
  middleware: (request: Record<string, unknown>, response?: Record<string, unknown>) => boolean;
76
102
  };
103
+ /**
104
+ * Resolves the client IP. Proxy headers (`x-forwarded-for`, `x-real-ip`) are
105
+ * only honored when `trustProxy` is explicitly enabled — otherwise any
106
+ * client could spoof its identity (and defeat rate limiting) with a header.
107
+ */
77
108
  export declare function getClientIp(request: Record<string, unknown> | undefined, trustProxy?: boolean | string): string;
78
109
  export declare function getClientProtocol(request: Record<string, unknown> | undefined, trustProxy?: boolean | string): string;
79
110
  export declare function applyTrustProxy(ctx: Record<string, unknown>, trustProxy: boolean | string): void;
@@ -1 +1 @@
1
- {"version":3,"file":"server-utils.d.ts","sourceRoot":"","sources":["../src/server-utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAapD,eAAO,IAAI,YAAY,SAAQ,CAAC;AAChC,eAAO,IAAI,OAAO,QAAI,CAAC;AACvB,eAAO,IAAI,eAAe,SAAQ,CAAC;AACnC,eAAO,IAAI,kBAAkB,EAAE,GAAG,CAAC,MAAM,CAAC,GAAG,IAAW,CAAC;AAEzD,wBAAgB,aAAa,CAAC,OAAO,UAAQ,GAAG,IAAI,CAInD;AAED,wBAAgB,aAAa,CAAC,CAAC,EAAE,OAAO,GAAG,IAAI,CAE9C;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,GAAG,CAAC,MAAM,CAAC,GAAG,IAAI,GAAG,IAAI,CAEn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