@verajs/ssr 0.2.1 → 0.3.1

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 (63) hide show
  1. package/README.md +522 -390
  2. package/dist/vera/diagnostics.d.ts +20 -0
  3. package/dist/vera/diagnostics.js +102 -0
  4. package/dist/vera/escaping.d.ts +155 -0
  5. package/dist/vera/escaping.js +293 -0
  6. package/dist/vera/events.d.ts +41 -0
  7. package/dist/vera/events.js +162 -0
  8. package/dist/vera/frames.d.ts +38 -0
  9. package/dist/vera/frames.js +195 -0
  10. package/dist/vera/index.d.ts +48 -0
  11. package/dist/vera/index.js +480 -0
  12. package/{types → dist/vera}/nodes.d.ts +389 -302
  13. package/dist/vera/nodes.js +2339 -0
  14. package/dist/vera/parse.d.ts +53 -0
  15. package/dist/vera/parse.js +485 -0
  16. package/dist/vera/reflections.d.ts +566 -0
  17. package/dist/vera/reflections.js +820 -0
  18. package/dist/vera/registry.d.ts +14 -0
  19. package/{src → dist}/vera/registry.js +5 -1
  20. package/dist/vera/report.d.ts +27 -0
  21. package/dist/vera/report.js +56 -0
  22. package/dist/vera/scan.d.ts +37 -0
  23. package/dist/vera/scan.js +143 -0
  24. package/dist/vera/select.d.ts +40 -0
  25. package/dist/vera/select.js +261 -0
  26. package/dist/vera/serializer.d.ts +39 -0
  27. package/dist/vera/serializer.js +1521 -0
  28. package/dist/vera/shim.d.ts +42 -0
  29. package/dist/vera/shim.js +853 -0
  30. package/dist/vera/slots.d.ts +5 -0
  31. package/dist/vera/slots.js +104 -0
  32. package/dist/vera/stylesheets.d.ts +62 -0
  33. package/dist/vera/stylesheets.js +180 -0
  34. package/dist/vera/tokenizer.d.ts +32 -0
  35. package/dist/vera/tokenizer.js +553 -0
  36. package/dist/vera/types.d.ts +121 -0
  37. package/dist/vera/views.d.ts +63 -0
  38. package/dist/vera/views.js +245 -0
  39. package/package.json +12 -13
  40. package/src/vera/escaping.js +0 -135
  41. package/src/vera/events.js +0 -164
  42. package/src/vera/frames.js +0 -102
  43. package/src/vera/index.js +0 -1187
  44. package/src/vera/nodes.js +0 -2294
  45. package/src/vera/parse.js +0 -381
  46. package/src/vera/reflections.js +0 -811
  47. package/src/vera/select.js +0 -234
  48. package/src/vera/serializer.js +0 -1080
  49. package/src/vera/shim.js +0 -761
  50. package/src/vera/stylesheets.js +0 -155
  51. package/src/vera/views.js +0 -240
  52. package/types/escaping.d.ts +0 -27
  53. package/types/events.d.ts +0 -4
  54. package/types/frames.d.ts +0 -12
  55. package/types/index.d.ts +0 -13
  56. package/types/parse.d.ts +0 -19
  57. package/types/reflections.d.ts +0 -657
  58. package/types/registry.d.ts +0 -8
  59. package/types/select.d.ts +0 -5
  60. package/types/serializer.d.ts +0 -26
  61. package/types/shim.d.ts +0 -23
  62. package/types/stylesheets.d.ts +0 -53
  63. package/types/views.d.ts +0 -26
@@ -0,0 +1,42 @@
1
+ /**
2
+ * Installs the server environment: the globals a component finds when it runs outside a browser.
3
+ *
4
+ * Import this **before anything that imports `@verajs/core`** — core evaluates against these, and
5
+ * `@verajs/ssr` does it for you. What each global is, and why it answers the way it does, lives
6
+ * with the thing it is made of: the nodes in `./nodes.js`, escaping in `./escaping.js`, the frame
7
+ * queue in `./frames.js`, stylesheets in `./stylesheets.js`, the registry in `./registry.js`.
8
+ *
9
+ * The rule every one of them follows: **answer honestly or do not exist** — and its corollary,
10
+ * **where the platform throws, this throws.** A server that is lenient about an error does not make
11
+ * anything work: it moves the failure to the client, strips the context that would have explained
12
+ * it, and in the meantime writes markup no browser would have produced from the same call. That
13
+ * corollary has found more defects here than asking whether a member is present, because a member
14
+ * that is present and too permissive looks exactly like one that is correct. A detached element has no
15
+ * parent, no siblings and no box, and a browser returns exactly what these do. Where a server cannot
16
+ * answer at all — `localStorage` is one browser's state — the global stays undefined, because
17
+ * `typeof localStorage === 'undefined'` is the guard the ecosystem already writes and it only works
18
+ * if this does not lie. `tests/ssr-dom-surface.test.mjs` enforces both halves.
19
+ */
20
+ import { escapeHtml, escapeStyleText, escapeRawText, RAW_TEXT_ELEMENTS } from './escaping.js';
21
+ import { hoistedStyles, setRenderingTag, beginHoisting } from './stylesheets.js';
22
+ import { beginBudget, bounded, endBudget, flushFrames, flushFramesAsync, setCoreFlush } from './frames.js';
23
+ import { registry } from './registry.js';
24
+ import { pendingInstances, INSTANCE_ATTRIBUTE } from './nodes.js';
25
+ /** What `index.ts` needs of it: the names still awaited — named when a render runs out of time — and the per-render reset. */
26
+ export declare const pendingDefinitionNames: () => string[];
27
+ export declare const resetPendingDefinitions: () => void;
28
+ /**
29
+ * Re-exported so a consumer of the server environment has one import, not seven. The homes above are
30
+ * where the code lives; this is the door.
31
+ */
32
+ export { escapeHtml, escapeStyleText, escapeRawText, RAW_TEXT_ELEMENTS, hoistedStyles, beginHoisting, setRenderingTag, flushFrames, flushFramesAsync, setCoreFlush, beginBudget, bounded, endBudget, registry, pendingInstances, INSTANCE_ATTRIBUTE, };
33
+ /**
34
+ * Which parts of a URL `location` carries — the one place that knows.
35
+ *
36
+ * `index.js` kept its own copy for `applyLocation`/`restoreLocation` to walk. They agreed, and
37
+ * nothing made them: a part added to one list would be installed and never restored, or restored
38
+ * from a property the install never wrote. Same single fact, same reasoning as `RAW_TEXT_ELEMENTS`
39
+ * below it — CODE-PRINCIPLES #5.
40
+ */
41
+ export declare const LOCATION_PARTS: readonly ["href", "protocol", "host", "hostname", "port", "pathname", "search", "hash", "origin"];
42
+ export declare const installShims: () => import("./types.js").SsrRegistry;