what-server 0.11.6 → 0.11.8

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/src/node.js ADDED
@@ -0,0 +1,18 @@
1
+ // What Framework - Node server runtime.
2
+ //
3
+ // Keep Node async context and Node-only deployment adapters behind the
4
+ // package's `node` export condition. The default entry remains safe to resolve
5
+ // in browser and non-Node edge bundles, including client server-action builds.
6
+
7
+ import { AsyncLocalStorage } from 'node:async_hooks';
8
+ import { __installServerContextStorage } from 'what-core';
9
+
10
+ // Async components may access loader/resource/island state after an `await`.
11
+ // One process-local provider keeps those reads bound to the request that
12
+ // invoked the component even when multiple streams interleave.
13
+ __installServerContextStorage(new AsyncLocalStorage());
14
+
15
+ export * from './index.js';
16
+ export { createServer, toNodeListener, whatMiddleware } from './adapter/node.js';
17
+ export { exportStatic } from './adapter/static.js';
18
+ export { createVercelHandler, buildVercelOutput } from './adapter/vercel.js';
package/src/serialize.js CHANGED
@@ -2,7 +2,7 @@
2
2
  //
3
3
  // Stateless on purpose: this module holds no shared state, so it is safe for
4
4
  // the bundler to inline into multiple server entry points without creating
5
- // divergent instances (unlike islands.js's sharedStores).
5
+ // divergent instances. Island state itself is scoped by the render context.
6
6
  //
7
7
  // JSON.stringify alone is NOT safe to drop inside <script>...</script>: a value
8
8
  // containing "</script>" (or "<!--", "<script") breaks out of the element and