@contentful/experiences-svelte 0.5.11 → 0.6.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/CHANGELOG.md +20 -0
- package/README.md +2 -2
- package/dist/ClientExperienceRenderer.svelte +55 -9
- package/dist/ClientExperienceRenderer.svelte.d.ts.map +1 -1
- package/dist/ComponentError.svelte +35 -0
- package/dist/ComponentError.svelte.d.ts +5 -0
- package/dist/ComponentError.svelte.d.ts.map +1 -0
- package/dist/DebugExperience.svelte +22 -3
- package/dist/DebugExperience.svelte.d.ts.map +1 -1
- package/dist/DebugExperience.test.js +76 -2
- package/dist/NodeRenderer.svelte +62 -6
- package/dist/NodeRenderer.svelte.d.ts +3 -1
- package/dist/NodeRenderer.svelte.d.ts.map +1 -1
- package/dist/NodeRenderer.test.d.ts +2 -0
- package/dist/NodeRenderer.test.d.ts.map +1 -0
- package/dist/NodeRenderer.test.js +124 -0
- package/dist/NodesRenderer.svelte +48 -5
- package/dist/NodesRenderer.svelte.d.ts +3 -1
- package/dist/NodesRenderer.svelte.d.ts.map +1 -1
- package/dist/ServerExperienceRenderer.svelte +37 -7
- package/dist/ServerExperienceRenderer.svelte.d.ts.map +1 -1
- package/dist/component-props.d.ts +30 -5
- package/dist/component-props.d.ts.map +1 -1
- package/dist/debug-panel-coverage.ssr.test.d.ts +2 -0
- package/dist/debug-panel-coverage.ssr.test.d.ts.map +1 -0
- package/dist/debug-panel-coverage.ssr.test.js +61 -0
- package/dist/debug-panel-coverage.test.d.ts +2 -0
- package/dist/debug-panel-coverage.test.d.ts.map +1 -0
- package/dist/debug-panel-coverage.test.js +229 -0
- package/dist/index.d.ts +5 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/nodes-renderer.ssr.test.js +49 -0
- package/dist/server-renderer.test.js +57 -3
- package/dist/test-fixtures/BrokenFixture.svelte +4 -0
- package/dist/test-fixtures/BrokenFixture.svelte.d.ts +19 -0
- package/dist/test-fixtures/BrokenFixture.svelte.d.ts.map +1 -0
- package/dist/types.d.ts +3 -17
- package/dist/types.d.ts.map +1 -1
- package/package.json +4 -4
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
import type { PortableRenderNode } from '@contentful/experiences-sdk-core';
|
|
27
27
|
|
|
28
28
|
import NodeRenderer from './NodeRenderer.svelte';
|
|
29
|
-
import type { RenderUnknown } from './component-props.js';
|
|
29
|
+
import type { DiagnosticReporter, RenderError, RenderUnknown } from './component-props.js';
|
|
30
30
|
import type { Config, RenderContext } from './types.js';
|
|
31
31
|
|
|
32
32
|
interface NodesRendererProps {
|
|
@@ -34,9 +34,24 @@
|
|
|
34
34
|
config: Config;
|
|
35
35
|
experience: RenderContext;
|
|
36
36
|
renderUnknown: RenderUnknown;
|
|
37
|
+
renderError: RenderError;
|
|
38
|
+
onDiagnostic: DiagnosticReporter;
|
|
37
39
|
}
|
|
38
40
|
|
|
39
|
-
let { nodes, config, experience, renderUnknown }: NodesRendererProps =
|
|
41
|
+
let { nodes, config, experience, renderUnknown, renderError, onDiagnostic }: NodesRendererProps =
|
|
42
|
+
$props();
|
|
43
|
+
|
|
44
|
+
// Same re-run-doesn't-mean-new-occurrence problem as NodeRenderer.svelte's
|
|
45
|
+
// `reportOnce` — `renderNode`'s `{@const}`s re-run per node on every
|
|
46
|
+
// reactive re-render of the `{#each}` block. One Set covers every node in
|
|
47
|
+
// this list since the diagnostic's own context (nodeId/slotName) already
|
|
48
|
+
// makes the signature unique per node+slot.
|
|
49
|
+
const reportedSlots = new Set<string>();
|
|
50
|
+
function reportSlotDiagnosticOnce(error: Error): void {
|
|
51
|
+
if (reportedSlots.has(error.message)) return;
|
|
52
|
+
reportedSlots.add(error.message);
|
|
53
|
+
onDiagnostic(error);
|
|
54
|
+
}
|
|
40
55
|
|
|
41
56
|
// Curry the parameterized `renderNode` snippet into a zero-arg Snippet bound
|
|
42
57
|
// to one node: forward the anchor (the renderer, under SSR) and supply the
|
|
@@ -62,9 +77,29 @@
|
|
|
62
77
|
// themselves are compile-time entities, but the merged props object is
|
|
63
78
|
// plain runtime data — so an unbounded set of payload-driven slot names is
|
|
64
79
|
// fine as long as each snippet comes from `toChildSnippet`.
|
|
65
|
-
|
|
80
|
+
//
|
|
81
|
+
// Defensive: `node.slots[x]` is typed as an array, but a hand-built
|
|
82
|
+
// PortableRenderPlan (a supported path — customers can construct one
|
|
83
|
+
// directly instead of going through `resolveExperience`) is not
|
|
84
|
+
// type-checked at runtime. Warn + drop rather than letting `.map` throw.
|
|
85
|
+
function toSlotSnippets(
|
|
86
|
+
node: PortableRenderNode,
|
|
87
|
+
onDiagnosticFn: DiagnosticReporter
|
|
88
|
+
): Record<string, Snippet[]> {
|
|
66
89
|
const slotSnippets: Record<string, Snippet[]> = {};
|
|
67
90
|
for (const [slotName, children] of Object.entries(node.slots)) {
|
|
91
|
+
if (!Array.isArray(children)) {
|
|
92
|
+
const { kind, id } = node.registration;
|
|
93
|
+
const message =
|
|
94
|
+
`Slot "${slotName}" on ${kind} "${id}"${node.nodeId ? ` (node "${node.nodeId}")` : ''} ` +
|
|
95
|
+
`is not an array of nodes; rendering it as empty instead of throwing.`;
|
|
96
|
+
if (typeof console !== 'undefined') {
|
|
97
|
+
console.warn(`[@contentful/experiences-svelte] ${message}`);
|
|
98
|
+
}
|
|
99
|
+
onDiagnosticFn(new Error(message));
|
|
100
|
+
slotSnippets[slotName] = [];
|
|
101
|
+
continue;
|
|
102
|
+
}
|
|
68
103
|
slotSnippets[slotName] = children.map(toChildSnippet);
|
|
69
104
|
}
|
|
70
105
|
return slotSnippets;
|
|
@@ -73,8 +108,16 @@
|
|
|
73
108
|
|
|
74
109
|
{#snippet renderNode(nodeArg: NodeArg)}
|
|
75
110
|
{@const node = unwrapNode(nodeArg)}
|
|
76
|
-
{@const slotSnippets = toSlotSnippets(node)}
|
|
77
|
-
<NodeRenderer
|
|
111
|
+
{@const slotSnippets = toSlotSnippets(node, reportSlotDiagnosticOnce)}
|
|
112
|
+
<NodeRenderer
|
|
113
|
+
{node}
|
|
114
|
+
{config}
|
|
115
|
+
{experience}
|
|
116
|
+
{renderUnknown}
|
|
117
|
+
{renderError}
|
|
118
|
+
{onDiagnostic}
|
|
119
|
+
{slotSnippets}
|
|
120
|
+
/>
|
|
78
121
|
{/snippet}
|
|
79
122
|
|
|
80
123
|
{#each nodes as node, index (node.nodeId ?? index)}
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import type { PortableRenderNode } from '@contentful/experiences-sdk-core';
|
|
2
|
-
import type { RenderUnknown } from './component-props.js';
|
|
2
|
+
import type { DiagnosticReporter, RenderError, RenderUnknown } from './component-props.js';
|
|
3
3
|
import type { Config, RenderContext } from './types.js';
|
|
4
4
|
interface NodesRendererProps {
|
|
5
5
|
nodes: PortableRenderNode[];
|
|
6
6
|
config: Config;
|
|
7
7
|
experience: RenderContext;
|
|
8
8
|
renderUnknown: RenderUnknown;
|
|
9
|
+
renderError: RenderError;
|
|
10
|
+
onDiagnostic: DiagnosticReporter;
|
|
9
11
|
}
|
|
10
12
|
declare const NodesRenderer: import("svelte").Component<NodesRendererProps, {}, "">;
|
|
11
13
|
type NodesRenderer = ReturnType<typeof NodesRenderer>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NodesRenderer.svelte.d.ts","sourceRoot":"","sources":["../src/NodesRenderer.svelte.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AAG3E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"NodesRenderer.svelte.d.ts","sourceRoot":"","sources":["../src/NodesRenderer.svelte.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AAG3E,OAAO,KAAK,EAAE,kBAAkB,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAC3F,OAAO,KAAK,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAGtD,UAAU,kBAAkB;IAC1B,KAAK,EAAE,kBAAkB,EAAE,CAAC;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,aAAa,CAAC;IAC1B,aAAa,EAAE,aAAa,CAAC;IAC7B,WAAW,EAAE,WAAW,CAAC;IACzB,YAAY,EAAE,kBAAkB,CAAC;CAClC;AA6FH,QAAA,MAAM,aAAa,wDAAwC,CAAC;AAC5D,KAAK,aAAa,GAAG,UAAU,CAAC,OAAO,aAAa,CAAC,CAAC;AACtD,eAAe,aAAa,CAAC"}
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
import type { ExperienceContext, ViewportDef } from '@contentful/experiences-sdk-core';
|
|
12
12
|
import { getViewportIndex } from '@contentful/experiences-design';
|
|
13
13
|
|
|
14
|
+
import ComponentError from './ComponentError.svelte';
|
|
14
15
|
import DebugExperience from './DebugExperience.svelte';
|
|
15
16
|
import MissingComponent from './MissingComponent.svelte';
|
|
16
17
|
import NodesRenderer from './NodesRenderer.svelte';
|
|
@@ -36,17 +37,30 @@
|
|
|
36
37
|
config,
|
|
37
38
|
initialViewportId,
|
|
38
39
|
metadata,
|
|
39
|
-
debug
|
|
40
|
+
debug,
|
|
40
41
|
renderUnknown = MissingComponent,
|
|
42
|
+
renderError = ComponentError,
|
|
41
43
|
}: ServerExperienceRendererProps = $props();
|
|
42
44
|
|
|
45
|
+
// `??`, not `||`, so an explicit `debug={false}` overrides a debug-on plan.
|
|
46
|
+
const resolvedDebug = $derived(debug ?? experience?.debug ?? false);
|
|
47
|
+
|
|
43
48
|
function buildContext(): RenderContext {
|
|
44
49
|
const viewports = experience?.viewports ?? [];
|
|
45
|
-
|
|
50
|
+
// Default to the pre-resolved viewport so first paint needs no recompute.
|
|
51
|
+
const idx = !experience
|
|
52
|
+
? 0
|
|
53
|
+
: initialViewportId === undefined
|
|
54
|
+
? experience.fallbackViewportIndex
|
|
55
|
+
: getViewportIndex(experience.viewports, initialViewportId);
|
|
46
56
|
return {
|
|
47
57
|
...DEFAULT_CONTEXT,
|
|
48
|
-
debug,
|
|
49
|
-
metadata: {
|
|
58
|
+
debug: resolvedDebug,
|
|
59
|
+
metadata: {
|
|
60
|
+
...DEFAULT_CONTEXT.metadata,
|
|
61
|
+
...(experience?.metadata ?? {}),
|
|
62
|
+
...(metadata ?? {}),
|
|
63
|
+
},
|
|
50
64
|
viewports,
|
|
51
65
|
activeViewport: experience?.viewports[idx] ?? FALLBACK_VIEWPORT,
|
|
52
66
|
activeViewportIndex: idx,
|
|
@@ -56,16 +70,32 @@
|
|
|
56
70
|
|
|
57
71
|
const renderContext = buildContext();
|
|
58
72
|
setExperience(renderContext);
|
|
73
|
+
|
|
74
|
+
// Render-time diagnostics (unregistered id, a component that threw),
|
|
75
|
+
// collected into a plain array rather than `$state`: Svelte SSR is
|
|
76
|
+
// synchronous top-down, so by the time `<DebugExperience>` renders — after
|
|
77
|
+
// the tree, matching the React adapter's element-order fix for
|
|
78
|
+
// consistency, even though Svelte's own reactivity wouldn't strictly
|
|
79
|
+
// require it — this array is already fully populated.
|
|
80
|
+
const renderDiagnostics: Error[] = [];
|
|
81
|
+
function onDiagnostic(error: Error): void {
|
|
82
|
+
renderDiagnostics.push(error);
|
|
83
|
+
}
|
|
59
84
|
</script>
|
|
60
85
|
|
|
61
86
|
{#if experience}
|
|
62
|
-
{#if debug}
|
|
63
|
-
<DebugExperience {experience} />
|
|
64
|
-
{/if}
|
|
65
87
|
<NodesRenderer
|
|
66
88
|
nodes={experience.nodes}
|
|
67
89
|
{config}
|
|
68
90
|
experience={renderContext}
|
|
69
91
|
{renderUnknown}
|
|
92
|
+
{renderError}
|
|
93
|
+
{onDiagnostic}
|
|
70
94
|
/>
|
|
95
|
+
{#if resolvedDebug}
|
|
96
|
+
<DebugExperience
|
|
97
|
+
{experience}
|
|
98
|
+
errors={[...(experience.diagnostics ?? []), ...renderDiagnostics]}
|
|
99
|
+
/>
|
|
100
|
+
{/if}
|
|
71
101
|
{/if}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ServerExperienceRenderer.svelte.d.ts","sourceRoot":"","sources":["../src/ServerExperienceRenderer.svelte.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ServerExperienceRenderer.svelte.d.ts","sourceRoot":"","sources":["../src/ServerExperienceRenderer.svelte.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,sBAAsB,CAAC;AA0F1E,QAAA,MAAM,wBAAwB,mEAAwC,CAAC;AACvE,KAAK,wBAAwB,GAAG,UAAU,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAC5E,eAAe,wBAAwB,CAAC"}
|
|
@@ -5,18 +5,17 @@ export interface ServerExperienceRendererProps {
|
|
|
5
5
|
experience: PortableRenderPlan | null | undefined;
|
|
6
6
|
config: Config;
|
|
7
7
|
initialViewportId?: string;
|
|
8
|
-
/**
|
|
9
|
-
* Arbitrary per-render metadata, readable by descendants via
|
|
10
|
-
* `getExperience()` and by resolvers via `ctx.experience.metadata`.
|
|
11
|
-
*/
|
|
8
|
+
/** Shallow-merges over the plan's `metadata`. Only needed to override it. */
|
|
12
9
|
metadata?: Record<string, unknown>;
|
|
13
10
|
/**
|
|
14
11
|
* Observability switch. When on: renders the visible missing-component box,
|
|
15
12
|
* turns the default `renderUnknown` fallback into the debug component, and
|
|
16
|
-
* auto-mounts `<DebugExperience>` after the tree.
|
|
13
|
+
* auto-mounts `<DebugExperience>` after the tree. Defaults to the plan's `debug`.
|
|
17
14
|
*/
|
|
18
15
|
debug?: boolean;
|
|
19
16
|
renderUnknown?: RenderUnknown;
|
|
17
|
+
/** Override the fallback rendered when a registered component throws. */
|
|
18
|
+
renderError?: RenderError;
|
|
20
19
|
}
|
|
21
20
|
export type ClientExperienceRendererProps = ServerExperienceRendererProps;
|
|
22
21
|
export interface MissingComponentProps {
|
|
@@ -25,10 +24,36 @@ export interface MissingComponentProps {
|
|
|
25
24
|
nodeId?: string;
|
|
26
25
|
}
|
|
27
26
|
export type RenderUnknown = Component<MissingComponentProps>;
|
|
27
|
+
export interface ComponentErrorProps {
|
|
28
|
+
componentId: string;
|
|
29
|
+
/** Optional — only present when the payload supplied an id for this node. */
|
|
30
|
+
nodeId?: string;
|
|
31
|
+
/** The caught error's message, when available. */
|
|
32
|
+
message?: string;
|
|
33
|
+
}
|
|
34
|
+
export type RenderError = Component<ComponentErrorProps>;
|
|
35
|
+
/**
|
|
36
|
+
* Reports one render-time diagnostic (unregistered id, a component that
|
|
37
|
+
* threw). `ServerExperienceRenderer` passes a closure that pushes onto a
|
|
38
|
+
* plain array (Svelte SSR is synchronous top-down, so the array is fully
|
|
39
|
+
* populated by the time `<DebugExperience>` reads it). `ClientExperienceRenderer`
|
|
40
|
+
* passes a closure that mutates a `$state` array instead, so `<DebugExperience>`
|
|
41
|
+
* re-renders reactively when a later interaction throws.
|
|
42
|
+
*/
|
|
43
|
+
export type DiagnosticReporter = (error: Error) => void;
|
|
28
44
|
export interface DebugExperienceProps {
|
|
29
45
|
/** The resolved plan to inspect (what a renderer receives as `experience`). */
|
|
30
46
|
experience: PortableRenderPlan;
|
|
31
47
|
/** Start expanded. Defaults to collapsed to stay out of the way. */
|
|
32
48
|
defaultOpen?: boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Resolve-time + render-time diagnostics for this render, merged by the
|
|
51
|
+
* caller (`ServerExperienceRenderer` / `ClientExperienceRenderer`). Plain
|
|
52
|
+
* `Error`s — the two cases that wrap a real caught exception
|
|
53
|
+
* (`component-render-error`, `resolve-data-failed`) set `.cause` to the
|
|
54
|
+
* original error, inspectable via `console.error` or `error.cause.stack`.
|
|
55
|
+
* Defaults to `[]` for a manually-mounted `<DebugExperience>`.
|
|
56
|
+
*/
|
|
57
|
+
errors?: Error[];
|
|
33
58
|
}
|
|
34
59
|
//# sourceMappingURL=component-props.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component-props.d.ts","sourceRoot":"","sources":["../src/component-props.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAExC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AAE3E,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAEzC,MAAM,WAAW,6BAA6B;IAC5C,UAAU,EAAE,kBAAkB,GAAG,IAAI,GAAG,SAAS,CAAC;IAClD,MAAM,EAAE,MAAM,CAAC;IACf,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B
|
|
1
|
+
{"version":3,"file":"component-props.d.ts","sourceRoot":"","sources":["../src/component-props.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAExC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AAE3E,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAEzC,MAAM,WAAW,6BAA6B;IAC5C,UAAU,EAAE,kBAAkB,GAAG,IAAI,GAAG,SAAS,CAAC;IAClD,MAAM,EAAE,MAAM,CAAC;IACf,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,6EAA6E;IAC7E,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACnC;;;;OAIG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,yEAAyE;IACzE,WAAW,CAAC,EAAE,WAAW,CAAC;CAC3B;AAED,MAAM,MAAM,6BAA6B,GAAG,6BAA6B,CAAC;AAE1E,MAAM,WAAW,qBAAqB;IACpC,WAAW,EAAE,MAAM,CAAC;IACpB,6EAA6E;IAC7E,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,MAAM,aAAa,GAAG,SAAS,CAAC,qBAAqB,CAAC,CAAC;AAE7D,MAAM,WAAW,mBAAmB;IAClC,WAAW,EAAE,MAAM,CAAC;IACpB,6EAA6E;IAC7E,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,kDAAkD;IAClD,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,MAAM,WAAW,GAAG,SAAS,CAAC,mBAAmB,CAAC,CAAC;AAEzD;;;;;;;GAOG;AACH,MAAM,MAAM,kBAAkB,GAAG,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;AAExD,MAAM,WAAW,oBAAoB;IACnC,+EAA+E;IAC/E,UAAU,EAAE,kBAAkB,CAAC;IAC/B,oEAAoE;IACpE,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;;;;;;OAOG;IACH,MAAM,CAAC,EAAE,KAAK,EAAE,CAAC;CAClB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"debug-panel-coverage.ssr.test.d.ts","sourceRoot":"","sources":["../src/debug-panel-coverage.ssr.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* True SSR coverage of a resolve-time diagnostic reaching the debug panel —
|
|
3
|
+
* renders through `svelte/server` (Svelte's *server*-compiled output), not
|
|
4
|
+
* `@testing-library/svelte` (the client build every other coverage test in
|
|
5
|
+
* this package uses). `token-unresolved` is the trigger: it's produced by
|
|
6
|
+
* `resolveExperience` itself, so it's already baked into `plan.diagnostics`
|
|
7
|
+
* before any renderer sees it — proving the panel surfaces a resolve-time
|
|
8
|
+
* diagnostic under a real, synchronous server render, not just under a
|
|
9
|
+
* client-mounted test harness.
|
|
10
|
+
*
|
|
11
|
+
* Runs under vitest.ssr.config.ts (environment: node) — the `.ssr.test.ts`
|
|
12
|
+
* suffix is load-bearing, see nodes-renderer.ssr.test.ts for why.
|
|
13
|
+
*/
|
|
14
|
+
import { describe, expect, it, vi } from 'vitest';
|
|
15
|
+
import { render } from 'svelte/server';
|
|
16
|
+
import { resolveExperience } from '@contentful/experiences-sdk-core';
|
|
17
|
+
import ServerExperienceRenderer from './ServerExperienceRenderer.svelte';
|
|
18
|
+
import ButtonFixture from './test-fixtures/ButtonFixture.svelte';
|
|
19
|
+
const VIEWPORTS = [{ id: 'desktop', query: '*', displayName: 'Desktop', previewSize: '100%' }];
|
|
20
|
+
function componentNode(typeId, rest = {}) {
|
|
21
|
+
return {
|
|
22
|
+
component: {
|
|
23
|
+
sys: {
|
|
24
|
+
type: 'ResourceLink',
|
|
25
|
+
linkType: 'Contentful:Component',
|
|
26
|
+
urn: `crn:contentful:::experience:spaces/$self/environments/$self/components/${typeId}`,
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
...rest,
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
describe('debug panel — true SSR coverage of a resolve-time diagnostic', () => {
|
|
33
|
+
it('token-unresolved reaches the debug panel under svelte/server', async () => {
|
|
34
|
+
const warn = vi.spyOn(console, 'warn').mockImplementation(() => { });
|
|
35
|
+
try {
|
|
36
|
+
const payload = {
|
|
37
|
+
viewports: VIEWPORTS,
|
|
38
|
+
nodes: [
|
|
39
|
+
componentNode('button', {
|
|
40
|
+
id: 'b',
|
|
41
|
+
designProperties: { cfColor: { type: 'DesignToken', value: 'color.brand' } },
|
|
42
|
+
}),
|
|
43
|
+
],
|
|
44
|
+
};
|
|
45
|
+
const config = {
|
|
46
|
+
components: { button: ButtonFixture },
|
|
47
|
+
resolveToken: () => undefined,
|
|
48
|
+
};
|
|
49
|
+
const plan = await resolveExperience(payload, config);
|
|
50
|
+
const html = render(ServerExperienceRenderer, {
|
|
51
|
+
props: { experience: plan, config, debug: true },
|
|
52
|
+
}).body;
|
|
53
|
+
expect(html).toContain('data-experiences-debug-errors');
|
|
54
|
+
expect(html).toContain('color.brand');
|
|
55
|
+
expect(html).toContain('resolveToken');
|
|
56
|
+
}
|
|
57
|
+
finally {
|
|
58
|
+
warn.mockRestore();
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"debug-panel-coverage.test.d.ts","sourceRoot":"","sources":["../src/debug-panel-coverage.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* End-to-end proof that every one of the 8 non-happy-path failure modes
|
|
3
|
+
* reaches `<DebugExperience>`'s rendered output — through a real
|
|
4
|
+
* `resolveExperience` + renderer pipeline, not a hand-built diagnostic
|
|
5
|
+
* fixture (see DebugExperience.test.ts for the fixture-level tests of the
|
|
6
|
+
* panel's own rendering logic). Each test asserts a distinguishing substring
|
|
7
|
+
* of the real message, not the whole string, so wording tweaks don't make
|
|
8
|
+
* these overly brittle.
|
|
9
|
+
*
|
|
10
|
+
* True SSR coverage of a resolve-time diagnostic (`token-unresolved`) lives
|
|
11
|
+
* in debug-panel-coverage.ssr.test.ts, using `svelte/server`'s `render` — this
|
|
12
|
+
* file's `ServerExperienceRenderer` tests mount client-side via
|
|
13
|
+
* `@testing-library/svelte`, same as the rest of this package's suite.
|
|
14
|
+
*/
|
|
15
|
+
import { render } from '@testing-library/svelte';
|
|
16
|
+
import { describe, expect, it, vi } from 'vitest';
|
|
17
|
+
import { resolveExperience } from '@contentful/experiences-sdk-core';
|
|
18
|
+
import ClientExperienceRenderer from './ClientExperienceRenderer.svelte';
|
|
19
|
+
import ServerExperienceRenderer from './ServerExperienceRenderer.svelte';
|
|
20
|
+
import BrokenFixture from './test-fixtures/BrokenFixture.svelte';
|
|
21
|
+
import ButtonFixture from './test-fixtures/ButtonFixture.svelte';
|
|
22
|
+
// `ClientExperienceRenderer`'s onDiagnostic defers via `queueMicrotask` (see
|
|
23
|
+
// its own comment for why); a test asserting against the debug panel needs to
|
|
24
|
+
// let that microtask settle first.
|
|
25
|
+
async function flushMicrotasks() {
|
|
26
|
+
await new Promise((resolve) => queueMicrotask(resolve));
|
|
27
|
+
}
|
|
28
|
+
const VIEWPORTS = [{ id: 'desktop', query: '*', displayName: 'Desktop', previewSize: '100%' }];
|
|
29
|
+
function componentNode(typeId, rest = {}) {
|
|
30
|
+
return {
|
|
31
|
+
component: {
|
|
32
|
+
sys: {
|
|
33
|
+
type: 'ResourceLink',
|
|
34
|
+
linkType: 'Contentful:Component',
|
|
35
|
+
urn: `crn:contentful:::experience:spaces/$self/environments/$self/components/${typeId}`,
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
...rest,
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
describe('debug panel — end-to-end coverage of every non-happy-path failure mode', () => {
|
|
42
|
+
it('malformed-payload: a non-array nodes field', async () => {
|
|
43
|
+
const warn = vi.spyOn(console, 'warn').mockImplementation(() => { });
|
|
44
|
+
try {
|
|
45
|
+
const plan = await resolveExperience({ viewports: VIEWPORTS, nodes: 'not-an-array' }, { components: {} });
|
|
46
|
+
const { container } = render(ServerExperienceRenderer, {
|
|
47
|
+
props: { experience: plan, config: { components: {} }, debug: true },
|
|
48
|
+
});
|
|
49
|
+
expect(container.innerHTML).toContain('data-experiences-debug-errors');
|
|
50
|
+
expect(container.innerHTML).toContain('"nodes" is not an array');
|
|
51
|
+
}
|
|
52
|
+
finally {
|
|
53
|
+
warn.mockRestore();
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
it('malformed-slot: a slot value that is not an array', async () => {
|
|
57
|
+
const warn = vi.spyOn(console, 'warn').mockImplementation(() => { });
|
|
58
|
+
try {
|
|
59
|
+
const payload = {
|
|
60
|
+
viewports: VIEWPORTS,
|
|
61
|
+
nodes: [
|
|
62
|
+
componentNode('contentful-container', {
|
|
63
|
+
id: 'page',
|
|
64
|
+
slots: { children: 'oops' },
|
|
65
|
+
}),
|
|
66
|
+
],
|
|
67
|
+
};
|
|
68
|
+
const config = { components: { 'contentful-container': ButtonFixture } };
|
|
69
|
+
const plan = await resolveExperience(payload, config);
|
|
70
|
+
const { container } = render(ServerExperienceRenderer, {
|
|
71
|
+
props: { experience: plan, config, debug: true },
|
|
72
|
+
});
|
|
73
|
+
expect(container.innerHTML).toContain('data-experiences-debug-errors');
|
|
74
|
+
expect(container.innerHTML).toContain('Slot "children"');
|
|
75
|
+
}
|
|
76
|
+
finally {
|
|
77
|
+
warn.mockRestore();
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
it('unidentifiable-node: a node with no readable component/experienceTemplate ref', async () => {
|
|
81
|
+
const warn = vi.spyOn(console, 'warn').mockImplementation(() => { });
|
|
82
|
+
try {
|
|
83
|
+
const payload = {
|
|
84
|
+
viewports: VIEWPORTS,
|
|
85
|
+
nodes: [{ pattern: {} }, componentNode('button', { id: 'b' })],
|
|
86
|
+
};
|
|
87
|
+
const config = { components: { button: ButtonFixture } };
|
|
88
|
+
const plan = await resolveExperience(payload, config);
|
|
89
|
+
const { container } = render(ServerExperienceRenderer, {
|
|
90
|
+
props: { experience: plan, config, debug: true },
|
|
91
|
+
});
|
|
92
|
+
expect(container.innerHTML).toContain('data-experiences-debug-errors');
|
|
93
|
+
expect(container.innerHTML).toContain('Skipping unidentifiable node');
|
|
94
|
+
}
|
|
95
|
+
finally {
|
|
96
|
+
warn.mockRestore();
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
it('resolve-data-failed: resolveData throws for a registered component', async () => {
|
|
100
|
+
const warn = vi.spyOn(console, 'warn').mockImplementation(() => { });
|
|
101
|
+
try {
|
|
102
|
+
const payload = {
|
|
103
|
+
viewports: VIEWPORTS,
|
|
104
|
+
nodes: [componentNode('button', { id: 'b' })],
|
|
105
|
+
};
|
|
106
|
+
const config = {
|
|
107
|
+
components: {
|
|
108
|
+
button: {
|
|
109
|
+
resolveData: () => {
|
|
110
|
+
throw new Error('enrichment service down');
|
|
111
|
+
},
|
|
112
|
+
component: ButtonFixture,
|
|
113
|
+
},
|
|
114
|
+
},
|
|
115
|
+
};
|
|
116
|
+
const plan = await resolveExperience(payload, config);
|
|
117
|
+
expect(plan.diagnostics[0]).toBeInstanceOf(Error);
|
|
118
|
+
expect(plan.diagnostics[0].cause?.message).toBe('enrichment service down');
|
|
119
|
+
const { container } = render(ServerExperienceRenderer, {
|
|
120
|
+
props: { experience: plan, config, debug: true },
|
|
121
|
+
});
|
|
122
|
+
expect(container.innerHTML).toContain('data-experiences-debug-errors');
|
|
123
|
+
expect(container.innerHTML).toContain('component:button');
|
|
124
|
+
expect(container.innerHTML).toContain('enrichment service down');
|
|
125
|
+
}
|
|
126
|
+
finally {
|
|
127
|
+
warn.mockRestore();
|
|
128
|
+
}
|
|
129
|
+
});
|
|
130
|
+
it('token-unresolved: a DesignToken with no resolveToken mapping', async () => {
|
|
131
|
+
const warn = vi.spyOn(console, 'warn').mockImplementation(() => { });
|
|
132
|
+
try {
|
|
133
|
+
const payload = {
|
|
134
|
+
viewports: VIEWPORTS,
|
|
135
|
+
nodes: [
|
|
136
|
+
componentNode('button', {
|
|
137
|
+
id: 'b',
|
|
138
|
+
designProperties: { cfColor: { type: 'DesignToken', value: 'color.brand' } },
|
|
139
|
+
}),
|
|
140
|
+
],
|
|
141
|
+
};
|
|
142
|
+
const config = {
|
|
143
|
+
components: { button: ButtonFixture },
|
|
144
|
+
resolveToken: () => undefined,
|
|
145
|
+
};
|
|
146
|
+
const plan = await resolveExperience(payload, config);
|
|
147
|
+
const { container } = render(ServerExperienceRenderer, {
|
|
148
|
+
props: { experience: plan, config, debug: true },
|
|
149
|
+
});
|
|
150
|
+
expect(container.innerHTML).toContain('data-experiences-debug-errors');
|
|
151
|
+
expect(container.innerHTML).toContain('color.brand');
|
|
152
|
+
expect(container.innerHTML).toContain('resolveToken');
|
|
153
|
+
}
|
|
154
|
+
finally {
|
|
155
|
+
warn.mockRestore();
|
|
156
|
+
}
|
|
157
|
+
});
|
|
158
|
+
it('component-not-registered: an id with no matching entry in config.components', async () => {
|
|
159
|
+
const warn = vi.spyOn(console, 'warn').mockImplementation(() => { });
|
|
160
|
+
try {
|
|
161
|
+
const payload = {
|
|
162
|
+
viewports: VIEWPORTS,
|
|
163
|
+
nodes: [componentNode('missing', { id: 'm' })],
|
|
164
|
+
};
|
|
165
|
+
const config = { components: {} };
|
|
166
|
+
const plan = await resolveExperience(payload, config);
|
|
167
|
+
const { container } = render(ServerExperienceRenderer, {
|
|
168
|
+
props: { experience: plan, config, debug: true },
|
|
169
|
+
});
|
|
170
|
+
expect(container.innerHTML).toContain('data-experiences-debug-errors');
|
|
171
|
+
expect(container.innerHTML).toContain('No component registered for id "missing"');
|
|
172
|
+
}
|
|
173
|
+
finally {
|
|
174
|
+
warn.mockRestore();
|
|
175
|
+
}
|
|
176
|
+
});
|
|
177
|
+
it('experience-template-not-registered: a template id with no matching entry in config.experienceTemplates', async () => {
|
|
178
|
+
const warn = vi.spyOn(console, 'warn').mockImplementation(() => { });
|
|
179
|
+
try {
|
|
180
|
+
const payload = {
|
|
181
|
+
viewports: VIEWPORTS,
|
|
182
|
+
nodes: [
|
|
183
|
+
{
|
|
184
|
+
experienceTemplate: {
|
|
185
|
+
sys: {
|
|
186
|
+
type: 'ResourceLink',
|
|
187
|
+
linkType: 'Contentful:ExperienceTemplate',
|
|
188
|
+
urn: 'crn:contentful:::experience:spaces/$self/environments/$self/experienceTemplates/missing-template',
|
|
189
|
+
},
|
|
190
|
+
},
|
|
191
|
+
id: 'tpl',
|
|
192
|
+
},
|
|
193
|
+
],
|
|
194
|
+
};
|
|
195
|
+
const config = { components: {} };
|
|
196
|
+
const plan = await resolveExperience(payload, config);
|
|
197
|
+
const { container } = render(ServerExperienceRenderer, {
|
|
198
|
+
props: { experience: plan, config, debug: true },
|
|
199
|
+
});
|
|
200
|
+
expect(container.innerHTML).toContain('data-experiences-debug-errors');
|
|
201
|
+
expect(container.innerHTML).toContain('No experience template registered for id "missing-template"');
|
|
202
|
+
}
|
|
203
|
+
finally {
|
|
204
|
+
warn.mockRestore();
|
|
205
|
+
}
|
|
206
|
+
});
|
|
207
|
+
it('component-render-error: a registered component that throws while rendering', async () => {
|
|
208
|
+
const warn = vi.spyOn(console, 'warn').mockImplementation(() => { });
|
|
209
|
+
try {
|
|
210
|
+
const payload = {
|
|
211
|
+
viewports: VIEWPORTS,
|
|
212
|
+
nodes: [componentNode('broken', { id: 'b' })],
|
|
213
|
+
};
|
|
214
|
+
const config = { components: { broken: BrokenFixture } };
|
|
215
|
+
const plan = await resolveExperience(payload, config);
|
|
216
|
+
const { container } = render(ClientExperienceRenderer, {
|
|
217
|
+
props: { experience: plan, config, debug: true },
|
|
218
|
+
});
|
|
219
|
+
await flushMicrotasks();
|
|
220
|
+
const errorList = container.querySelector('[data-experiences-debug-errors]');
|
|
221
|
+
expect(errorList).not.toBeNull();
|
|
222
|
+
expect(errorList.textContent).toContain('Component "broken"');
|
|
223
|
+
expect(errorList.textContent).toContain('boom');
|
|
224
|
+
}
|
|
225
|
+
finally {
|
|
226
|
+
warn.mockRestore();
|
|
227
|
+
}
|
|
228
|
+
});
|
|
229
|
+
});
|
package/dist/index.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ export { default as ClientExperienceRenderer } from './ClientExperienceRenderer.
|
|
|
2
2
|
export { default as ExperienceRenderer } from './ClientExperienceRenderer.svelte';
|
|
3
3
|
export { default as ServerExperienceRenderer } from './ServerExperienceRenderer.svelte';
|
|
4
4
|
export { default as MissingComponent } from './MissingComponent.svelte';
|
|
5
|
+
export { default as ComponentError } from './ComponentError.svelte';
|
|
5
6
|
export { default as DebugExperience } from './DebugExperience.svelte';
|
|
6
7
|
export { default as NodesRenderer } from './NodesRenderer.svelte';
|
|
7
8
|
export { useActiveViewport } from './use-active-viewport.svelte.js';
|
|
@@ -10,13 +11,13 @@ export { getExperience, getContentfulComponent, getContentfulExperienceTemplate,
|
|
|
10
11
|
export { getDesignValues } from './get-design-values.js';
|
|
11
12
|
export { toCss } from './design-utils.js';
|
|
12
13
|
export type { ToCssOptions } from './design-utils.js';
|
|
13
|
-
export type { ClientExperienceRendererProps, ClientExperienceRendererProps as ExperienceRendererProps, DebugExperienceProps, MissingComponentProps, RenderUnknown, ServerExperienceRendererProps, } from './component-props.js';
|
|
14
|
+
export type { ClientExperienceRendererProps, ClientExperienceRendererProps as ExperienceRendererProps, ComponentErrorProps, DebugExperienceProps, DiagnosticReporter, MissingComponentProps, RenderError, RenderUnknown, ServerExperienceRendererProps, } from './component-props.js';
|
|
14
15
|
export { defineComponent, defineExperienceTemplate, normalizeComponentRegistration, normalizeExperienceTemplateRegistration, } from './types.js';
|
|
15
16
|
export type { ComponentConfig, Components, Config, ContentfulComponent, ContentfulExperienceTemplate, ExperienceTemplateConfig, ExperienceTemplateRegistration, ExperienceTemplates, Registration, RenderContext, ResolveToken, } from './types.js';
|
|
16
17
|
export { resolveExperience } from '@contentful/experiences-sdk-core';
|
|
17
18
|
export type { ResolverConfig, ResolveExperienceOptions } from '@contentful/experiences-sdk-core';
|
|
18
|
-
export type { ComponentNode, ComponentRef, DesignPropValue, DesignToken, ExperienceContext, ExperienceNode, ExperiencePayload, ExperienceSys, ExperienceTemplateNode, ExperienceTemplateRef, ManualDesignValue, PortableRegistration, PortableRenderNode, PortableRenderPlan, ResolveContext, ValuesByViewport, ViewportDef, } from '@contentful/experiences-sdk-core';
|
|
19
|
+
export type { ComponentNode, ComponentRef, DesignPropValue, DesignToken, ExperienceContext, ExperienceNode, ExperiencePayload, ExperienceSourceMap, ExperienceSys, ExperienceTemplateNode, ExperienceTemplateRef, ManualDesignValue, PortableRegistration, PortableRenderNode, PortableRenderPlan, ResolveContext, ValuesByViewport, ViewportDef, } from '@contentful/experiences-sdk-core';
|
|
19
20
|
export { CSS_PROPERTIES, getValueForViewport, getViewportIndex, isCssProperty, resolveDesignProperties, toCssKey, toCssMediaQuery, } from '@contentful/experiences-design';
|
|
20
|
-
export { ContentfulViewDelivery, ContentfulViewDeliveryClient, DELIVERY_HOST, NotFoundError, PREVIEW_HOST, createClient, fetchExperience, } from '@contentful/experiences-client';
|
|
21
|
-
export type { ClientOptions, CreateClientOptions, ExperienceOptions, ResolveOptions, } from '@contentful/experiences-client';
|
|
21
|
+
export { ContentfulViewDelivery, ContentfulViewDeliveryClient, DELIVERY_HOST, ExperienceFetchError, NotFoundError, PREVIEW_HOST, createClient, fetchExperience, readSourceMap, toExperiencePayload, } from '@contentful/experiences-client';
|
|
22
|
+
export type { ClientOptions, CreateClientOptions, ExperienceOptions, ExperienceResponse, ResolveOptions, } from '@contentful/experiences-client';
|
|
22
23
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,OAAO,IAAI,wBAAwB,EAAE,MAAM,mCAAmC,CAAC;AACxF,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AAClF,OAAO,EAAE,OAAO,IAAI,wBAAwB,EAAE,MAAM,mCAAmC,CAAC;AACxF,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AACxE,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAKtE,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAElE,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AACpE,YAAY,EAAE,uBAAuB,EAAE,MAAM,iCAAiC,CAAC;AAG/E,OAAO,EACL,aAAa,EACb,sBAAsB,EACtB,+BAA+B,GAChC,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1C,YAAY,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAItD,YAAY,EACV,6BAA6B,EAC7B,6BAA6B,IAAI,uBAAuB,EACxD,oBAAoB,EACpB,qBAAqB,EACrB,aAAa,EACb,6BAA6B,GAC9B,MAAM,sBAAsB,CAAC;AAG9B,OAAO,EACL,eAAe,EACf,wBAAwB,EACxB,8BAA8B,EAC9B,uCAAuC,GACxC,MAAM,YAAY,CAAC;AACpB,YAAY,EACV,eAAe,EACf,UAAU,EACV,MAAM,EACN,mBAAmB,EACnB,4BAA4B,EAC5B,wBAAwB,EACxB,8BAA8B,EAC9B,mBAAmB,EACnB,YAAY,EACZ,aAAa,EACb,YAAY,GACb,MAAM,YAAY,CAAC;AAGpB,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AACrE,YAAY,EAAE,cAAc,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AAGjG,YAAY,EACV,aAAa,EACb,YAAY,EACZ,eAAe,EACf,WAAW,EACX,iBAAiB,EACjB,cAAc,EACd,iBAAiB,EACjB,aAAa,EACb,sBAAsB,EACtB,qBAAqB,EACrB,iBAAiB,EACjB,oBAAoB,EACpB,kBAAkB,EAClB,kBAAkB,EAClB,cAAc,EACd,gBAAgB,EAChB,WAAW,GACZ,MAAM,kCAAkC,CAAC;AAG1C,OAAO,EACL,cAAc,EACd,mBAAmB,EACnB,gBAAgB,EAChB,aAAa,EACb,uBAAuB,EACvB,QAAQ,EACR,eAAe,GAChB,MAAM,gCAAgC,CAAC;AAGxC,OAAO,EACL,sBAAsB,EACtB,4BAA4B,EAC5B,aAAa,EACb,aAAa,EACb,YAAY,EACZ,YAAY,EACZ,eAAe,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,OAAO,IAAI,wBAAwB,EAAE,MAAM,mCAAmC,CAAC;AACxF,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AAClF,OAAO,EAAE,OAAO,IAAI,wBAAwB,EAAE,MAAM,mCAAmC,CAAC;AACxF,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AACxE,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACpE,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAKtE,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAElE,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AACpE,YAAY,EAAE,uBAAuB,EAAE,MAAM,iCAAiC,CAAC;AAG/E,OAAO,EACL,aAAa,EACb,sBAAsB,EACtB,+BAA+B,GAChC,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1C,YAAY,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAItD,YAAY,EACV,6BAA6B,EAC7B,6BAA6B,IAAI,uBAAuB,EACxD,mBAAmB,EACnB,oBAAoB,EACpB,kBAAkB,EAClB,qBAAqB,EACrB,WAAW,EACX,aAAa,EACb,6BAA6B,GAC9B,MAAM,sBAAsB,CAAC;AAG9B,OAAO,EACL,eAAe,EACf,wBAAwB,EACxB,8BAA8B,EAC9B,uCAAuC,GACxC,MAAM,YAAY,CAAC;AACpB,YAAY,EACV,eAAe,EACf,UAAU,EACV,MAAM,EACN,mBAAmB,EACnB,4BAA4B,EAC5B,wBAAwB,EACxB,8BAA8B,EAC9B,mBAAmB,EACnB,YAAY,EACZ,aAAa,EACb,YAAY,GACb,MAAM,YAAY,CAAC;AAGpB,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AACrE,YAAY,EAAE,cAAc,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AAGjG,YAAY,EACV,aAAa,EACb,YAAY,EACZ,eAAe,EACf,WAAW,EACX,iBAAiB,EACjB,cAAc,EACd,iBAAiB,EACjB,mBAAmB,EACnB,aAAa,EACb,sBAAsB,EACtB,qBAAqB,EACrB,iBAAiB,EACjB,oBAAoB,EACpB,kBAAkB,EAClB,kBAAkB,EAClB,cAAc,EACd,gBAAgB,EAChB,WAAW,GACZ,MAAM,kCAAkC,CAAC;AAG1C,OAAO,EACL,cAAc,EACd,mBAAmB,EACnB,gBAAgB,EAChB,aAAa,EACb,uBAAuB,EACvB,QAAQ,EACR,eAAe,GAChB,MAAM,gCAAgC,CAAC;AAGxC,OAAO,EACL,sBAAsB,EACtB,4BAA4B,EAC5B,aAAa,EACb,oBAAoB,EACpB,aAAa,EACb,YAAY,EACZ,YAAY,EACZ,eAAe,EACf,aAAa,EACb,mBAAmB,GACpB,MAAM,gCAAgC,CAAC;AACxC,YAAY,EACV,aAAa,EACb,mBAAmB,EACnB,iBAAiB,EACjB,kBAAkB,EAClB,cAAc,GACf,MAAM,gCAAgC,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -16,6 +16,7 @@ export { default as ClientExperienceRenderer } from './ClientExperienceRenderer.
|
|
|
16
16
|
export { default as ExperienceRenderer } from './ClientExperienceRenderer.svelte';
|
|
17
17
|
export { default as ServerExperienceRenderer } from './ServerExperienceRenderer.svelte';
|
|
18
18
|
export { default as MissingComponent } from './MissingComponent.svelte';
|
|
19
|
+
export { default as ComponentError } from './ComponentError.svelte';
|
|
19
20
|
export { default as DebugExperience } from './DebugExperience.svelte';
|
|
20
21
|
// Every slot already arrives as a same-named `Snippet[]` prop; this is exposed so
|
|
21
22
|
// advanced customers can render a slot's raw nodes themselves instead:
|
|
@@ -33,4 +34,4 @@ export { resolveExperience } from '@contentful/experiences-sdk-core';
|
|
|
33
34
|
// ─── Design utilities (re-exported from design) ───────────────────────────
|
|
34
35
|
export { CSS_PROPERTIES, getValueForViewport, getViewportIndex, isCssProperty, resolveDesignProperties, toCssKey, toCssMediaQuery, } from '@contentful/experiences-design';
|
|
35
36
|
// ─── Delivery client + fetchExperience ────────────────────────────────────
|
|
36
|
-
export { ContentfulViewDelivery, ContentfulViewDeliveryClient, DELIVERY_HOST, NotFoundError, PREVIEW_HOST, createClient, fetchExperience, } from '@contentful/experiences-client';
|
|
37
|
+
export { ContentfulViewDelivery, ContentfulViewDeliveryClient, DELIVERY_HOST, ExperienceFetchError, NotFoundError, PREVIEW_HOST, createClient, fetchExperience, readSourceMap, toExperiencePayload, } from '@contentful/experiences-client';
|