@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 +1 -1
- package/dist/index.js +1 -1
- package/dist/server/index.d.ts +2 -1
- package/dist/server/index.js +4 -3
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
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.
|
|
21
|
+
export const VERSION = '1.8.0';
|
package/dist/server/index.d.ts
CHANGED
|
@@ -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';
|
package/dist/server/index.js
CHANGED
|
@@ -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
|
-
|
|
22
|
-
|
|
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(() => { }));
|