@ternkit/tern 1.7.0 → 1.8.0

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/index.d.ts CHANGED
@@ -30,4 +30,4 @@ export type { MessageKey } from './runtime/i18n.svelte.js';
30
30
  export interface Messages {
31
31
  }
32
32
  /** The version of the Tern client runtime. */
33
- export declare const VERSION = "1.7.0";
33
+ export declare const VERSION = "1.8.0";
package/dist/index.js CHANGED
@@ -18,4 +18,4 @@ export { default as Image } from './image/Image.svelte';
18
18
  export { t, i18n, setLocale } from './runtime/i18n.svelte.js';
19
19
  export { passkeysSupported, registerPasskey, signInWithPasskey, PasskeyError } from './runtime/passkeys.js';
20
20
  /** The version of the Tern client runtime. */
21
- export const VERSION = '1.7.0';
21
+ export const VERSION = '1.8.0';
@@ -1,5 +1,6 @@
1
1
  import type { Component } from 'svelte';
2
2
  import { type I18nConfig } from '../runtime/i18n.svelte.js';
3
+ import type { Payload } from '../runtime/types.js';
3
4
  /** The server manifest generated by `tern gen` in .tern/generated/server.js. */
4
5
  export interface ServerManifest {
5
6
  layouts: {
@@ -36,7 +37,7 @@ export interface RenderResult {
36
37
  * exactly the same tree and hydration matches.
37
38
  */
38
39
  export declare function createRenderer(manifest: ServerManifest): ((payload: string, href: string) => string) & {
39
- raw: (payload: string, href: string) => RenderResult;
40
+ raw: (payload: string | Payload, href: string) => RenderResult;
40
41
  };
41
42
  export { createEmailRenderer } from './email.js';
42
43
  export type { EmailModule, EmailResult } from './email.js';
@@ -17,9 +17,10 @@ export function createRenderer(manifest) {
17
17
  configureI18n(manifest.i18n ?? null);
18
18
  setBase(manifest.base ?? '');
19
19
  // raw returns the result as an object, for a native renderer to read
20
- // without encoding it as JSON first.
21
- const raw = (payloadJSON, href) => {
22
- const p = JSON.parse(payloadJSON);
20
+ // without encoding it as JSON first. Native rendering also passes the
21
+ // payload as an object, made from Go values without the JSON.
22
+ const raw = (payload, href) => {
23
+ const p = typeof payload === 'string' ? JSON.parse(payload) : payload;
23
24
  // Deferred values are still loading: render their pending state.
24
25
  if (p.deferred)
25
26
  p.nodes = revive(p.nodes, () => new Promise(() => { }));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ternkit/tern",
3
- "version": "1.7.0",
3
+ "version": "1.8.0",
4
4
  "description": "Client runtime and Vite plugin for Tern: Svelte on the client, Go on the server",
5
5
  "license": "MIT",
6
6
  "type": "module",