@vesk/adapter 0.2.44 → 0.2.45

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.
@@ -1 +1 @@
1
- {"version":3,"file":"dev-server.d.ts","sourceRoot":"","sources":["../src/dev-server.ts"],"names":[],"mappings":"AAEA,OAAO,EAAgB,KAAK,MAAM,EAA6C,MAAM,WAAW,CAAC;AAOjG,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,OAAO,CAAC;AAK7C,OAAO,KAAK,EAAa,gBAAgB,EAAwB,MAAM,yBAAyB,CAAC;AAgBjG;;;;;GAKG;AACH,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,IAAI,GAAG,WAAW,GAAG,OAAO,GAAG,MAAM,CAAC;IAC9C,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,KAAK,EAAE,eAAe,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IACxD,QAAQ,EAAE,OAAO,CAAC;IAClB,cAAc,EAAE,MAAM,CAAC;IACvB;+EAC2E;IAC3E,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED,mEAAmE;AACnE,wBAAgB,kBAAkB,IAAI,WAAW,CAEhD;AAuCD,wBAAgB,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,KAAK,GAAG;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE,CAIzE;AAkBD,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,mHAAmH;IACnH,QAAQ,CAAC,EAAE,MAAM,GAAG,QAAQ,CAAC;IAC7B;;8BAE0B;IAC1B,MAAM,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;CAChC;AAED,MAAM,WAAW,uBAAuB;IACtC,IAAI,EAAE,UAAU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GAkBG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,wBAAwB,GAAG;IACvE,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,EAAE,MAAM,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC,gBAAgB,GAAG,IAAI,CAAC,CAAC;CAChH,CAUA;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,kBAAkB,IAAI,MAAM,CAa3C;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAIrD;AA8CD,wBAAsB,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,gBAAgB,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAkqBvG"}
@@ -548,7 +548,7 @@ export async function startDevServer(appDir, options) {
548
548
  // the tag was never emitted and this was unreachable. Mirrors prod-server.
549
549
  if (url.pathname === '/ssr-data.js') {
550
550
  const token = url.searchParams.get('t') || '';
551
- const store = globalThis.__vsk_ssr_data_store;
551
+ const store = globalThis.__vsk_ssr_payload_store;
552
552
  const payload = store?.[token];
553
553
  if (payload)
554
554
  delete store[token];
@@ -664,7 +664,7 @@ export async function startDevServer(appDir, options) {
664
664
  catch (e) {
665
665
  const message = e instanceof Error ? e.message : String(e);
666
666
  res.writeHead(500, { 'Content-Type': 'application/json' });
667
- res.end(JSON.stringify({ error: message }));
667
+ res.end(JSON.stringify({ ok: false, error: message }));
668
668
  }
669
669
  return;
670
670
  }
@@ -679,8 +679,6 @@ export async function startDevServer(appDir, options) {
679
679
  const t0 = process.hrtime.bigint();
680
680
  const tImport0 = process.hrtime.bigint();
681
681
  const mod = await import(`${handlerPath}?t=${ssrVersion}`);
682
- const _origFetch = globalThis.fetch;
683
- globalThis.fetch = function _fetchDebug(u, init) { console.error('FETCH-DEBUG', typeof u === 'string' ? u : String(u), (new Error()).stack); return _origFetch(u, init); };
684
682
  const tImport1 = process.hrtime.bigint();
685
683
  const webRequest = makeWebRequest(req, url.href, maxBodyBytes);
686
684
  const response = await mod.handle(webRequest);
@@ -698,7 +696,7 @@ export async function startDevServer(appDir, options) {
698
696
  console.error(`[vdtime] ${url.pathname} ssrVersion=${ssrVersion} total=${Number(tHandle1 - t0) / 1e6 | 0}ms import=${Number(tImport1 - tImport0) / 1e6 | 0}ms handle=${Number(tHandle1 - tImport1) / 1e6 | 0}ms text=${Number(tText1 - tHandle1) / 1e6 | 0}ms`);
699
697
  }
700
698
  catch (e) {
701
- console.error('[nbsp-debug] DEV-SSR-ERROR', e instanceof Error ? (e.stack || e.message) : String(e));
699
+ console.error('[vesk dev] SSR render failed:', e instanceof Error ? (e.stack || e.message) : String(e));
702
700
  res.writeHead(500, { 'Content-Type': 'text/html' });
703
701
  res.end(renderSsrErrorPage(e, url.pathname));
704
702
  }
@@ -142,7 +142,7 @@ ${serverStoreLine}
142
142
  // SSR already resolved. Entry is consumed on read (bound store).
143
143
  if (pathname === '/ssr-data.js') {
144
144
  const dataToken = url.searchParams.get('t') || '';
145
- const dataStore = (globalThis.__vsk_ssr_data_store || {});
145
+ const dataStore = (globalThis.__vsk_ssr_payload_store || {});
146
146
  const payload = dataStore[dataToken];
147
147
  if (payload) delete dataStore[dataToken];
148
148
  const dataLines = [];
@@ -273,7 +273,7 @@ export async function startProdServer(outDir, options) {
273
273
  }
274
274
  if (url.pathname === '/ssr-data.js') {
275
275
  const token = url.searchParams.get('t') || '';
276
- const store = globalThis.__vsk_ssr_data_store;
276
+ const store = globalThis.__vsk_ssr_payload_store;
277
277
  const payload = store?.[token];
278
278
  if (payload)
279
279
  delete store[token];
@@ -1 +1 @@
1
- {"version":3,"file":"runtime-bundle.d.ts","sourceRoot":"","sources":["../src/runtime-bundle.ts"],"names":[],"mappings":"AAuCA,wBAAsB,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAwJnF"}
1
+ {"version":3,"file":"runtime-bundle.d.ts","sourceRoot":"","sources":["../src/runtime-bundle.ts"],"names":[],"mappings":"AAuCA,wBAAsB,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CA4JnF"}
@@ -39,7 +39,7 @@ export async function bundleRuntime(appDir, outDir) {
39
39
  const runtimeRoot = findRuntimeSrc(appDir);
40
40
  const entryFile = resolve(outDir, 'server', `.runtime-entry-${buildId++}.mjs`);
41
41
  const entryContent = [
42
- `import { renderPage, renderFullPage, renderPageStream, compileFile, setRuntimeModule, setVskHydrate, hydratePrecompile, assertSameOrigin } from ${JSON.stringify(resolve(compilerRoot, 'server-codegen.js'))};`,
42
+ `import { renderPage, renderFullPage, renderPageStream, compileFile, setRuntimeModule, setVskHydrate, hydratePrecompile, assertSameOrigin, withSsrStore } from ${JSON.stringify(resolve(compilerRoot, 'server-codegen.js'))};`,
43
43
  `import { parseCookies } from ${JSON.stringify(resolve(compilerRoot, 'server-cookies.js'))};`,
44
44
  `import * as __veskRuntime from ${JSON.stringify(resolve(runtimeRoot, 'index-server.js'))};`,
45
45
  '',
@@ -78,7 +78,7 @@ export async function bundleRuntime(appDir, outDir) {
78
78
  '}',
79
79
  '',
80
80
  'export { renderPage, renderFullPage, renderPageStream, compileFile, setVskHydrate, hydratePrecompile, parseCookies, assertSameOrigin };',
81
- 'export { withSsrStore } from "@vesk/compiler/src/ssr-store";',
81
+ 'export { withSsrStore };',
82
82
  '',
83
83
  '// Deliver hydration data as an origin-served script so strict CSP (no unsafe-inline)',
84
84
  '// does not block it. The prod server serves /ssr-data.js from the global store.',
@@ -90,7 +90,11 @@ export async function bundleRuntime(appDir, outDir) {
90
90
  " let tk = '';",
91
91
  " for (const b of bytes) tk += b.toString(16).padStart(2, '0');",
92
92
  ' const token = tk;',
93
- " const store = (globalThis.__vsk_ssr_data_store ||= {});",
93
+ ' // Named __vsk_ssr_payload_store, NOT __vsk_ssr_data_*: the compiler keys',
94
+ ' // per-request slots `__vsk_ssr_data_<token>` and pruneSsrDataSlots()',
95
+ ' // reaps that prefix. Sharing it let the reaper wipe every pending',
96
+ ' // /ssr-data.js payload, so a served page\'s hydration script 404\'d.',
97
+ " const store = (globalThis.__vsk_ssr_payload_store ||= {});",
94
98
  " store[token] = payload;",
95
99
  ' // Bound the store: if the browser never fetches /ssr-data.js the entry',
96
100
  ' // would otherwise linger forever. Evict the oldest entry past 100.',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vesk/adapter",
3
- "version": "0.2.44",
3
+ "version": "0.2.45",
4
4
  "type": "module",
5
5
  "description": "Vesk adapter — builds deployable .vesk/ output for Deno and Node serverless",
6
6
  "main": "./dist/index.js",
@@ -23,9 +23,9 @@
23
23
  "sharp": "^0.35.3"
24
24
  },
25
25
  "dependencies": {
26
- "@vesk/compiler": "^0.2.44",
27
- "@vesk/runtime": "^0.2.44",
28
- "@vesk/types": "^0.2.44"
26
+ "@vesk/compiler": "^0.2.45",
27
+ "@vesk/runtime": "^0.2.45",
28
+ "@vesk/types": "^0.2.45"
29
29
  },
30
30
  "devDependencies": {
31
31
  "@types/ws": "^8.18.1",