@bgub/fig-server 0.1.0-alpha.6 → 0.1.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/escaping-C2DNLoj9.js +34 -0
- package/dist/escaping-C2DNLoj9.js.map +1 -0
- package/dist/html-entry.js +1 -1
- package/dist/{image-preloads-BIFcrqm9.js → image-preloads-CWbCdmNa.js} +44 -46
- package/dist/image-preloads-CWbCdmNa.js.map +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +363 -448
- package/dist/index.js.map +1 -1
- package/dist/payload.d.ts +1 -1
- package/dist/payload.js +164 -186
- package/dist/payload.js.map +1 -1
- package/dist/{types-mrjoQDOc.d.ts → types-CZvaho7_.d.ts} +1 -1
- package/dist-development/escaping-C2DNLoj9.js +34 -0
- package/dist-development/escaping-C2DNLoj9.js.map +1 -0
- package/dist-development/html-entry.js +1 -1
- package/dist-development/{image-preloads-D3OBEaWp.js → image-preloads-C7OgNxdv.js} +44 -46
- package/dist-development/image-preloads-C7OgNxdv.js.map +1 -0
- package/dist-development/index.js +363 -448
- package/dist-development/index.js.map +1 -1
- package/dist-development/payload.js +163 -185
- package/dist-development/payload.js.map +1 -1
- package/package.json +4 -4
- package/dist/escaping-DAot8sFu.js +0 -26
- package/dist/escaping-DAot8sFu.js.map +0 -1
- package/dist/image-preloads-BIFcrqm9.js.map +0 -1
- package/dist-development/escaping-DAot8sFu.js +0 -26
- package/dist-development/escaping-DAot8sFu.js.map +0 -1
- package/dist-development/image-preloads-D3OBEaWp.js.map +0 -1
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
//#region src/escaping.ts
|
|
2
|
+
const attributeEscapePattern = /[&"<>]/;
|
|
3
|
+
const attributeEscapePatternGlobal = /[&"<>]/g;
|
|
4
|
+
const textEscapePattern = /[&<>]/;
|
|
5
|
+
const textEscapePatternGlobal = /[&<>]/g;
|
|
6
|
+
function escapeText(value) {
|
|
7
|
+
if (!textEscapePattern.test(value)) return value;
|
|
8
|
+
return value.replace(textEscapePatternGlobal, escapeTextCharacter);
|
|
9
|
+
}
|
|
10
|
+
function escapeAttribute(value) {
|
|
11
|
+
if (!attributeEscapePattern.test(value)) return value;
|
|
12
|
+
return value.replace(attributeEscapePatternGlobal, escapeAttributeCharacter);
|
|
13
|
+
}
|
|
14
|
+
function escapeAttributeCharacter(character) {
|
|
15
|
+
if (character === "&") return "&";
|
|
16
|
+
if (character === "\"") return """;
|
|
17
|
+
if (character === "<") return "<";
|
|
18
|
+
return ">";
|
|
19
|
+
}
|
|
20
|
+
function escapeTextCharacter(character) {
|
|
21
|
+
if (character === "&") return "&";
|
|
22
|
+
if (character === "<") return "<";
|
|
23
|
+
return ">";
|
|
24
|
+
}
|
|
25
|
+
function escapeScriptText(value) {
|
|
26
|
+
return value.replaceAll("<", "\\u003C").replaceAll("\u2028", "\\u2028").replaceAll("\u2029", "\\u2029");
|
|
27
|
+
}
|
|
28
|
+
function escapeScriptJson(value) {
|
|
29
|
+
return escapeScriptText(JSON.stringify(value));
|
|
30
|
+
}
|
|
31
|
+
//#endregion
|
|
32
|
+
export { escapeText as i, escapeScriptJson as n, escapeScriptText as r, escapeAttribute as t };
|
|
33
|
+
|
|
34
|
+
//# sourceMappingURL=escaping-C2DNLoj9.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"escaping-C2DNLoj9.js","names":[],"sources":["../src/escaping.ts"],"sourcesContent":["const attributeEscapePattern = /[&\"<>]/;\nconst attributeEscapePatternGlobal = /[&\"<>]/g;\nconst textEscapePattern = /[&<>]/;\nconst textEscapePatternGlobal = /[&<>]/g;\n\nexport function escapeText(value: string): string {\n if (!textEscapePattern.test(value)) return value;\n return value.replace(textEscapePatternGlobal, escapeTextCharacter);\n}\n\nexport function escapeAttribute(value: string): string {\n if (!attributeEscapePattern.test(value)) return value;\n return value.replace(attributeEscapePatternGlobal, escapeAttributeCharacter);\n}\n\nfunction escapeAttributeCharacter(character: string): string {\n if (character === \"&\") return \"&\";\n if (character === '\"') return \""\";\n if (character === \"<\") return \"<\";\n return \">\";\n}\n\nfunction escapeTextCharacter(character: string): string {\n if (character === \"&\") return \"&\";\n if (character === \"<\") return \"<\";\n return \">\";\n}\n\n// Script elements are raw-text elements: HTML entities are not decoded in\n// their contents, so escape only characters that can terminate the element\n// or executable source.\nexport function escapeScriptText(value: string): string {\n return value\n .replaceAll(\"<\", \"\\\\u003C\")\n .replaceAll(\"\\u2028\", \"\\\\u2028\")\n .replaceAll(\"\\u2029\", \"\\\\u2029\");\n}\n\nexport function escapeScriptJson(value: unknown): string {\n return escapeScriptText(JSON.stringify(value));\n}\n"],"mappings":";AAAA,MAAM,yBAAyB;AAC/B,MAAM,+BAA+B;AACrC,MAAM,oBAAoB;AAC1B,MAAM,0BAA0B;AAEhC,SAAgB,WAAW,OAAuB;CAChD,IAAI,CAAC,kBAAkB,KAAK,KAAK,GAAG,OAAO;CAC3C,OAAO,MAAM,QAAQ,yBAAyB,mBAAmB;AACnE;AAEA,SAAgB,gBAAgB,OAAuB;CACrD,IAAI,CAAC,uBAAuB,KAAK,KAAK,GAAG,OAAO;CAChD,OAAO,MAAM,QAAQ,8BAA8B,wBAAwB;AAC7E;AAEA,SAAS,yBAAyB,WAA2B;CAC3D,IAAI,cAAc,KAAK,OAAO;CAC9B,IAAI,cAAc,MAAK,OAAO;CAC9B,IAAI,cAAc,KAAK,OAAO;CAC9B,OAAO;AACT;AAEA,SAAS,oBAAoB,WAA2B;CACtD,IAAI,cAAc,KAAK,OAAO;CAC9B,IAAI,cAAc,KAAK,OAAO;CAC9B,OAAO;AACT;AAKA,SAAgB,iBAAiB,OAAuB;CACtD,OAAO,MACJ,WAAW,KAAK,SAAS,CAAC,CAC1B,WAAW,UAAU,SAAS,CAAC,CAC/B,WAAW,UAAU,SAAS;AACnC;AAEA,SAAgB,iBAAiB,OAAwB;CACvD,OAAO,iBAAiB,KAAK,UAAU,KAAK,CAAC;AAC/C"}
|
package/dist/html-entry.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { i as escapeText, n as escapeScriptJson, r as escapeScriptText, t as escapeAttribute } from "./escaping-
|
|
1
|
+
import { i as escapeText, n as escapeScriptJson, r as escapeScriptText, t as escapeAttribute } from "./escaping-C2DNLoj9.js";
|
|
2
2
|
export { escapeAttribute, escapeScriptJson, escapeScriptText, escapeText };
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { t as escapeAttribute } from "./escaping-
|
|
1
|
+
import { t as escapeAttribute } from "./escaping-C2DNLoj9.js";
|
|
2
2
|
//#region src/shared.ts
|
|
3
3
|
const STREAMED_METADATA_ATTRIBUTE = "data-fig-streamed-metadata";
|
|
4
|
-
function
|
|
4
|
+
function noLane() {
|
|
5
|
+
return null;
|
|
6
|
+
}
|
|
7
|
+
function noop() {}
|
|
8
|
+
function withContextValue(values, context, value, callback) {
|
|
5
9
|
let stack = values.get(context);
|
|
6
10
|
if (stack === void 0) {
|
|
7
11
|
stack = [];
|
|
8
12
|
values.set(context, stack);
|
|
9
13
|
}
|
|
10
|
-
return stack;
|
|
11
|
-
}
|
|
12
|
-
function withContextValue(values, context, value, callback) {
|
|
13
|
-
const stack = contextStack(values, context);
|
|
14
14
|
stack.push(value);
|
|
15
15
|
try {
|
|
16
16
|
return callback();
|
|
@@ -24,13 +24,15 @@ function readContextValue(values, context) {
|
|
|
24
24
|
return context.defaultValue;
|
|
25
25
|
}
|
|
26
26
|
function deferred() {
|
|
27
|
-
let resolve =
|
|
28
|
-
let reject =
|
|
27
|
+
let resolve = null;
|
|
28
|
+
let reject = null;
|
|
29
|
+
const promise = new Promise((innerResolve, innerReject) => {
|
|
30
|
+
resolve = innerResolve;
|
|
31
|
+
reject = innerReject;
|
|
32
|
+
});
|
|
33
|
+
if (resolve === null || reject === null) throw new Error("Promise executor did not initialize its deferred.");
|
|
29
34
|
return {
|
|
30
|
-
promise
|
|
31
|
-
resolve = innerResolve;
|
|
32
|
-
reject = innerReject;
|
|
33
|
-
}),
|
|
35
|
+
promise,
|
|
34
36
|
reject,
|
|
35
37
|
resolve
|
|
36
38
|
};
|
|
@@ -48,31 +50,22 @@ function streamFlowBlocked(controller) {
|
|
|
48
50
|
const desiredSize = controller?.desiredSize;
|
|
49
51
|
return typeof desiredSize === "number" && desiredSize <= 0;
|
|
50
52
|
}
|
|
51
|
-
function resolveInitialState(initialState) {
|
|
52
|
-
return typeof initialState === "function" ? initialState() : initialState;
|
|
53
|
-
}
|
|
54
53
|
function createStaticDispatcher(options) {
|
|
54
|
+
const rejectUpdate = (..._args) => {
|
|
55
|
+
throw new Error(options.updateError);
|
|
56
|
+
};
|
|
55
57
|
return {
|
|
56
58
|
useState(initialState) {
|
|
57
|
-
|
|
58
|
-
const setState = () => {
|
|
59
|
-
throw new Error(options.updateError);
|
|
60
|
-
};
|
|
61
|
-
return [value, setState];
|
|
59
|
+
return [typeof initialState === "function" ? initialState() : initialState, rejectUpdate];
|
|
62
60
|
},
|
|
63
61
|
useActionState(_action, initialState) {
|
|
64
|
-
const runner = () => {
|
|
65
|
-
throw new Error(options.updateError);
|
|
66
|
-
};
|
|
67
62
|
return [
|
|
68
63
|
initialState,
|
|
69
|
-
|
|
64
|
+
rejectUpdate,
|
|
70
65
|
false
|
|
71
66
|
];
|
|
72
67
|
},
|
|
73
|
-
useId
|
|
74
|
-
return options.useId();
|
|
75
|
-
},
|
|
68
|
+
useId: options.useId,
|
|
76
69
|
useDeferredValue(value, _initialValue, _hasInitialValue) {
|
|
77
70
|
return value;
|
|
78
71
|
},
|
|
@@ -80,40 +73,45 @@ function createStaticDispatcher(options) {
|
|
|
80
73
|
return calculate();
|
|
81
74
|
},
|
|
82
75
|
useTransition() {
|
|
83
|
-
|
|
84
|
-
return [false, startTransition];
|
|
76
|
+
return [false, startServerTransition];
|
|
85
77
|
},
|
|
86
|
-
useReactive
|
|
87
|
-
useBeforePaint
|
|
88
|
-
useBeforeLayout
|
|
78
|
+
useReactive: noop,
|
|
79
|
+
useBeforePaint: noop,
|
|
80
|
+
useBeforeLayout: noop,
|
|
89
81
|
useSyncExternalStore(_subscribe, _getSnapshot, getServerSnapshot) {
|
|
90
82
|
if (getServerSnapshot === void 0) throw new Error(options.externalStoreError);
|
|
91
83
|
return getServerSnapshot();
|
|
92
84
|
},
|
|
93
85
|
useStableEvent(_handler) {
|
|
94
|
-
return
|
|
95
|
-
throw new Error("Stable events cannot be called during server render.");
|
|
96
|
-
};
|
|
86
|
+
return rejectStableEventCall;
|
|
97
87
|
},
|
|
98
88
|
readContext(context) {
|
|
99
89
|
return readContextValue(options.contextValues, context);
|
|
100
90
|
},
|
|
101
|
-
readData
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
preloadData(resource, args) {
|
|
105
|
-
options.preloadData(resource, args);
|
|
106
|
-
},
|
|
107
|
-
readPromise(promise) {
|
|
108
|
-
return options.readPromise(promise);
|
|
109
|
-
}
|
|
91
|
+
readData: options.readData,
|
|
92
|
+
preloadData: options.preloadData,
|
|
93
|
+
readPromise: options.readPromise
|
|
110
94
|
};
|
|
111
95
|
}
|
|
96
|
+
function startServerTransition(callback) {
|
|
97
|
+
callback(new AbortController().signal);
|
|
98
|
+
}
|
|
99
|
+
function rejectStableEventCall(..._args) {
|
|
100
|
+
throw new Error("Stable events cannot be called during server render.");
|
|
101
|
+
}
|
|
112
102
|
function componentStack(stack) {
|
|
113
103
|
const frames = [];
|
|
114
104
|
for (let frame = stack; frame !== null; frame = frame.parent) frames.push(` at ${frame.name}`);
|
|
115
105
|
return frames.length === 0 ? "" : `\n${frames.join("\n")}`;
|
|
116
106
|
}
|
|
107
|
+
function serverErrorPayload(error, stack, onError) {
|
|
108
|
+
if (onError === void 0) return {};
|
|
109
|
+
try {
|
|
110
|
+
return onError(error, { componentStack: componentStack(stack) }) ?? {};
|
|
111
|
+
} catch {
|
|
112
|
+
return {};
|
|
113
|
+
}
|
|
114
|
+
}
|
|
117
115
|
function nonceAttribute(nonce) {
|
|
118
116
|
return nonce === void 0 ? "" : ` nonce="${escapeAttribute(nonce)}"`;
|
|
119
117
|
}
|
|
@@ -156,6 +154,6 @@ function imageFetchpriority(value) {
|
|
|
156
154
|
return value === "high" || value === "auto" ? value : void 0;
|
|
157
155
|
}
|
|
158
156
|
//#endregion
|
|
159
|
-
export {
|
|
157
|
+
export { createStaticDispatcher as a, nonceAttribute as c, streamFlowBlocked as d, streamHighWaterMark as f, cloneContextValues as i, noop as l, suppressesImagePreloads as n, deferred as o, withContextValue as p, STREAMED_METADATA_ATTRIBUTE as r, noLane as s, imagePreloadFromHostProps as t, serverErrorPayload as u };
|
|
160
158
|
|
|
161
|
-
//# sourceMappingURL=image-preloads-
|
|
159
|
+
//# sourceMappingURL=image-preloads-CWbCdmNa.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"image-preloads-CWbCdmNa.js","names":[],"sources":["../src/shared.ts","../src/image-preloads.ts"],"sourcesContent":["import type {\n ActionStateAction,\n ActionStateRunner,\n DependencyList,\n ExternalStoreSubscribe,\n FigContext,\n StateSetter,\n StartTransition,\n} from \"@bgub/fig\";\nimport type {\n DataResource,\n RenderDispatcher,\n StableEventCallerArgs,\n} from \"@bgub/fig/internal\";\nimport { escapeAttribute } from \"./escaping.ts\";\nimport type { ServerErrorPayload, ServerRenderOptions } from \"./types.ts\";\n\ndeclare const __FIG_DEV__: boolean | undefined;\n\nconst __DEV__ = typeof __FIG_DEV__ === \"boolean\" ? __FIG_DEV__ : false;\n\nexport type ContextValues = Map<FigContext<unknown>, unknown[]>;\n\nexport const STREAMED_METADATA_ATTRIBUTE = \"data-fig-streamed-metadata\";\n\nexport function noLane(): null {\n return null;\n}\n\nexport function noop(): void {}\n\nexport interface StackFrame {\n name: string;\n parent: StackFrame | null;\n}\n\ninterface StaticDispatcherOptions {\n contextValues: ContextValues;\n externalStoreError: string;\n preloadData<TArgs extends unknown[], TValue>(\n this: void,\n resource: DataResource<TArgs, TValue>,\n args: TArgs,\n ): void;\n readData<TArgs extends unknown[], TValue>(\n this: void,\n resource: DataResource<TArgs, TValue>,\n args: TArgs,\n ): TValue;\n readPromise<T>(this: void, promise: PromiseLike<T>): T;\n updateError: string;\n useId(this: void): string;\n}\n\nexport function withContextValue<T>(\n values: ContextValues,\n context: FigContext<unknown>,\n value: unknown,\n callback: () => T,\n): T {\n let stack = values.get(context);\n if (stack === undefined) {\n stack = [];\n values.set(context, stack);\n }\n stack.push(value);\n\n try {\n return callback();\n } finally {\n stack.pop();\n }\n}\n\nfunction readContextValue<T>(values: ContextValues, context: FigContext<T>): T {\n const stack = values.get(context as FigContext<unknown>);\n if (stack !== undefined && stack.length > 0) {\n return stack[stack.length - 1] as T;\n }\n\n return context.defaultValue;\n}\n\nexport interface Deferred<T> {\n promise: Promise<T>;\n reject: (reason: unknown) => void;\n resolve: (value: T) => void;\n}\n\nexport function deferred<T>(): Deferred<T> {\n let resolve: Deferred<T>[\"resolve\"] | null = null;\n let reject: Deferred<T>[\"reject\"] | null = null;\n const promise = new Promise<T>((innerResolve, innerReject) => {\n resolve = innerResolve;\n reject = innerReject;\n });\n if (resolve === null || reject === null) {\n throw new Error(\"Promise executor did not initialize its deferred.\");\n }\n return { promise, reject, resolve };\n}\n\nexport function cloneContextValues(values: ContextValues): ContextValues {\n const clone: ContextValues = new Map();\n for (const [context, stack] of values) clone.set(context, [...stack]);\n return clone;\n}\n\n// Encoded bytes a render result stream's internal queue holds before flushing\n// pauses (resumed by consumer pulls). Shared by the HTML and payload\n// renderers. Large enough that a healthy consumer never blocks a flush; small\n// enough to bound per-connection buffering when the consumer stalls.\n// Rendering itself never pauses — only writing to the stream does.\nconst DEFAULT_STREAM_HIGH_WATER_MARK = 65536;\n\n// 0 would deadlock: desiredSize never goes positive, and read requests alone\n// do not make it so. 1 byte is the honest pure-pull minimum.\nexport function streamHighWaterMark(option: number | undefined): number {\n return Math.max(1, option ?? DEFAULT_STREAM_HIGH_WATER_MARK);\n}\n\n// Blocked means the stream's internal queue is at or past its high-water\n// mark; completed work then waits un-enqueued until the consumer pulls.\n// desiredSize is null on an errored stream — never blocked, because fatal\n// paths close the request before any further writes.\nexport function streamFlowBlocked(\n controller: ReadableStreamDefaultController<Uint8Array> | null,\n): boolean {\n const desiredSize = controller?.desiredSize;\n return typeof desiredSize === \"number\" && desiredSize <= 0;\n}\n\nexport function createStaticDispatcher(\n options: StaticDispatcherOptions,\n): RenderDispatcher {\n const rejectUpdate = (..._args: unknown[]): never => {\n throw new Error(options.updateError);\n };\n\n return {\n useState<S>(initialState: S | (() => S)): [S, StateSetter<S>] {\n const value =\n typeof initialState === \"function\"\n ? (initialState as () => S)()\n : initialState;\n return [value, rejectUpdate];\n },\n useActionState<S, Args extends unknown[]>(\n _action: ActionStateAction<S, Args>,\n initialState: S,\n ): [S, ActionStateRunner<Args>, boolean] {\n return [initialState, rejectUpdate, false];\n },\n useId: options.useId,\n useDeferredValue<T>(\n value: T,\n _initialValue: T | undefined,\n _hasInitialValue: boolean,\n ): T {\n return value;\n },\n useMemo<T>(calculate: () => T, _deps: DependencyList): T {\n return calculate();\n },\n useTransition(): [boolean, StartTransition] {\n return [false, startServerTransition];\n },\n useReactive: noop,\n useBeforePaint: noop,\n useBeforeLayout: noop,\n useSyncExternalStore<T>(\n _subscribe: ExternalStoreSubscribe,\n _getSnapshot: () => T,\n getServerSnapshot?: () => T,\n ): T {\n if (getServerSnapshot === undefined) {\n throw new Error(options.externalStoreError);\n }\n\n return getServerSnapshot();\n },\n useStableEvent<Args extends unknown[], Result>(\n _handler: (...args: Args) => Result,\n ): (...args: StableEventCallerArgs<Args>) => Result {\n return rejectStableEventCall;\n },\n readContext<T>(context: FigContext<T>): T {\n return readContextValue(options.contextValues, context);\n },\n readData: options.readData,\n preloadData: options.preloadData,\n readPromise: options.readPromise,\n };\n}\n\n// Server transitions run synchronously to completion; the signal never\n// aborts because there is no supersede/unmount lifecycle during a request.\nfunction startServerTransition(\n callback: (signal: AbortSignal) => void | PromiseLike<void>,\n): void {\n void callback(new AbortController().signal);\n}\n\nfunction rejectStableEventCall<Args extends unknown[], Result>(\n ..._args: StableEventCallerArgs<Args>\n): Result {\n throw new Error(\"Stable events cannot be called during server render.\");\n}\n\nexport function errorMessage(error: unknown): string {\n return error instanceof Error ? error.message : String(error);\n}\n\nexport function componentStack(stack: StackFrame | null): string {\n const frames: string[] = [];\n for (let frame = stack; frame !== null; frame = frame.parent) {\n frames.push(` at ${frame.name}`);\n }\n return frames.length === 0 ? \"\" : `\\n${frames.join(\"\\n\")}`;\n}\n\nexport function serverErrorPayload(\n error: unknown,\n stack: StackFrame | null,\n onError: ServerRenderOptions[\"onError\"],\n): ServerErrorPayload {\n if (onError === undefined) {\n return __DEV__ ? { message: errorMessage(error) } : {};\n }\n try {\n return onError(error, { componentStack: componentStack(stack) }) ?? {};\n } catch {\n return {};\n }\n}\n\nexport function nonceAttribute(nonce: string | undefined): string {\n return nonce === undefined ? \"\" : ` nonce=\"${escapeAttribute(nonce)}\"`;\n}\n","import type { PreloadResource, Props } from \"@bgub/fig\";\n\nexport function imagePreloadFromHostProps(\n type: string,\n props: Props,\n suppressed: boolean,\n): PreloadResource | null {\n if (suppressed || type.toLowerCase() !== \"img\") return null;\n if (props.loading === \"lazy\" || props.fetchpriority === \"low\") return null;\n\n const src = stringProp(props.src);\n const srcset = stringProp(props.srcset);\n if (\n (props.src != null && typeof props.src !== \"string\") ||\n (props.srcset != null && typeof props.srcset !== \"string\") ||\n (!src && !srcset) ||\n isDataUrl(src) ||\n isDataUrl(srcset)\n ) {\n return null;\n }\n\n return {\n as: \"image\",\n crossorigin: imageCrossorigin(props.crossorigin),\n fetchpriority: imageFetchpriority(props.fetchpriority),\n href: src || undefined,\n imagesizes: srcset ? stringProp(props.sizes) : undefined,\n imagesrcset: srcset || undefined,\n kind: \"preload\",\n referrerpolicy: stringProp(props.referrerpolicy),\n type: stringProp(props.type),\n };\n}\n\nexport function suppressesImagePreloads(type: string): boolean {\n const normalizedType = type.toLowerCase();\n return normalizedType === \"picture\" || normalizedType === \"noscript\";\n}\n\nfunction stringProp(value: unknown): string | undefined {\n return typeof value === \"string\" ? value : undefined;\n}\n\nfunction isDataUrl(value: string | undefined): boolean {\n return value?.slice(0, 5).toLowerCase() === \"data:\";\n}\n\nfunction imageCrossorigin(value: unknown): PreloadResource[\"crossorigin\"] {\n if (typeof value !== \"string\") return undefined;\n if (value === \"anonymous\" || value === \"use-credentials\" || value === \"\") {\n return value;\n }\n return \"\";\n}\n\nfunction imageFetchpriority(value: unknown): PreloadResource[\"fetchpriority\"] {\n return value === \"high\" || value === \"auto\" ? value : undefined;\n}\n"],"mappings":";;AAuBA,MAAa,8BAA8B;AAE3C,SAAgB,SAAe;CAC7B,OAAO;AACT;AAEA,SAAgB,OAAa,CAAC;AAyB9B,SAAgB,iBACd,QACA,SACA,OACA,UACG;CACH,IAAI,QAAQ,OAAO,IAAI,OAAO;CAC9B,IAAI,UAAU,KAAA,GAAW;EACvB,QAAQ,CAAC;EACT,OAAO,IAAI,SAAS,KAAK;CAC3B;CACA,MAAM,KAAK,KAAK;CAEhB,IAAI;EACF,OAAO,SAAS;CAClB,UAAU;EACR,MAAM,IAAI;CACZ;AACF;AAEA,SAAS,iBAAoB,QAAuB,SAA2B;CAC7E,MAAM,QAAQ,OAAO,IAAI,OAA8B;CACvD,IAAI,UAAU,KAAA,KAAa,MAAM,SAAS,GACxC,OAAO,MAAM,MAAM,SAAS;CAG9B,OAAO,QAAQ;AACjB;AAQA,SAAgB,WAA2B;CACzC,IAAI,UAAyC;CAC7C,IAAI,SAAuC;CAC3C,MAAM,UAAU,IAAI,SAAY,cAAc,gBAAgB;EAC5D,UAAU;EACV,SAAS;CACX,CAAC;CACD,IAAI,YAAY,QAAQ,WAAW,MACjC,MAAM,IAAI,MAAM,mDAAmD;CAErE,OAAO;EAAE;EAAS;EAAQ;CAAQ;AACpC;AAEA,SAAgB,mBAAmB,QAAsC;CACvE,MAAM,wBAAuB,IAAI,IAAI;CACrC,KAAK,MAAM,CAAC,SAAS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,OAAO,OAAO,UAAU,WAAW,QAAQ,KAAA;AAC7C;AAEA,SAAS,UAAU,OAAoC;CACrD,OAAO,OAAO,MAAM,GAAG,CAAC,CAAC,CAAC,YAAY,MAAM;AAC9C;AAEA,SAAS,iBAAiB,OAAgD;CACxE,IAAI,OAAO,UAAU,UAAU,OAAO,KAAA;CACtC,IAAI,UAAU,eAAe,UAAU,qBAAqB,UAAU,IACpE,OAAO;CAET,OAAO;AACT;AAEA,SAAS,mBAAmB,OAAkD;CAC5E,OAAO,UAAU,UAAU,UAAU,SAAS,QAAQ,KAAA;AACxD"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as ServerPreloadHeaderOptions, c as ServerPrerenderResult, d as RenderTreeKind, f as RenderTreeNode, i as ServerFragmentRenderResult, l as ServerRenderOptions, n as ServerErrorInfo, o as ServerPreloadHeaderResource, p as createRenderTreeCollector, r as ServerErrorPayload, s as ServerPrerenderOptions, t as ServerDocumentRenderResult, u as RenderTreeCollector } from "./types-
|
|
1
|
+
import { a as ServerPreloadHeaderOptions, c as ServerPrerenderResult, d as RenderTreeKind, f as RenderTreeNode, i as ServerFragmentRenderResult, l as ServerRenderOptions, n as ServerErrorInfo, o as ServerPreloadHeaderResource, p as createRenderTreeCollector, r as ServerErrorPayload, s as ServerPrerenderOptions, t as ServerDocumentRenderResult, u as RenderTreeCollector } from "./types-CZvaho7_.js";
|
|
2
2
|
import { FigNode } from "@bgub/fig";
|
|
3
3
|
//#region src/index.d.ts
|
|
4
4
|
declare function renderToStream(node: FigNode, options?: ServerRenderOptions): ServerFragmentRenderResult;
|