@reckona/mreact-dom 0.0.66 → 0.0.68

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.
@@ -1 +1 @@
1
- {"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAGjE,MAAM,CAAC,MAAM,OAAO,GAAG,QAAQ,CAAC"}
1
+ {"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAGjE,MAAM,CAAC,MAAM,OAAO,GAAG,QAAQ,CAAC","sourcesContent":["export { createRoot, hydrateRoot } from \"@reckona/mreact-compat\";\nexport type { HydrateRootOptions, Root, RootOptions } from \"@reckona/mreact-compat\";\n\nexport const version = \"19.2.6\";\n"]}
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,SAAS,EACT,MAAM,EACN,sBAAsB,EACtB,cAAc,IAAI,YAAY,GAC/B,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,oBAAoB,EAAE,MAAM,uCAAuC,CAAC;AAC7E,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAGtD,MAAM,CAAC,MAAM,OAAO,GAAG,QAAQ,CAAC;AA0EhC,MAAM,oBAAoB,GAAyB;IACjD,OAAO,EAAE,KAAK;IACd,IAAI,EAAE,IAAI;IACV,MAAM,EAAE,IAAI;IACZ,MAAM,EAAE,IAAI;CACb,CAAC;AAEF,MAAM,UAAU,aAAa;IAC3B,OAAO,oBAAoB,CAAC;AAC9B,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,IAAqB;IACpD,IAAI,CAAC,KA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C,CAAC;AACH,CAAC;AAED,SAAS,mBAAmB,CAAC,KAAa;IACxC,OAAO,KAAK,CAAC,UAAU,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,UAAU,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;AAC/D,CAAC","sourcesContent":["export {\n createPortal,\n flushSync,\n render,\n unmountComponentAtNode,\n useActionState as useFormState,\n} from \"@reckona/mreact-compat\";\nimport { runWithEventPriority } from \"@reckona/mreact-compat/event-priority\";\nexport { createRoot, hydrateRoot } from \"./client.js\";\nexport type { HydrateRootOptions, Root, RootOptions } from \"./client.js\";\n\nexport const version = \"19.2.6\";\n\nexport interface FormStatusNotPending {\n pending: false;\n data: null;\n method: null;\n action: null;\n}\n\nexport interface FormStatusPending {\n pending: true;\n data: FormData;\n method: string;\n action: string | ((formData: FormData) => void | Promise<void>);\n}\n\nexport type FormStatus = FormStatusPending | FormStatusNotPending;\n\nexport interface PreconnectOptions {\n crossOrigin?: \"anonymous\" | \"use-credentials\" | \"\";\n}\n\nexport type PreloadAs =\n | \"audio\"\n | \"document\"\n | \"embed\"\n | \"fetch\"\n | \"font\"\n | \"image\"\n | \"object\"\n | \"track\"\n | \"script\"\n | \"style\"\n | \"video\"\n | \"worker\";\n\nexport interface PreloadOptions {\n as: PreloadAs;\n crossOrigin?: \"anonymous\" | \"use-credentials\" | \"\";\n fetchPriority?: \"high\" | \"low\" | \"auto\";\n imageSizes?: string;\n imageSrcSet?: string;\n integrity?: string;\n type?: string;\n nonce?: string;\n referrerPolicy?: ReferrerPolicy;\n media?: string;\n}\n\nexport interface PreloadModuleOptions {\n as?: RequestDestination;\n crossOrigin?: \"anonymous\" | \"use-credentials\" | \"\";\n integrity?: string;\n nonce?: string;\n}\n\nexport interface PreinitOptions {\n as: \"script\" | \"style\";\n crossOrigin?: \"anonymous\" | \"use-credentials\" | \"\";\n fetchPriority?: \"high\" | \"low\" | \"auto\";\n precedence?: string;\n integrity?: string;\n nonce?: string;\n}\n\nexport interface PreinitModuleOptions {\n as?: \"script\";\n crossOrigin?: \"anonymous\" | \"use-credentials\" | \"\";\n integrity?: string;\n nonce?: string;\n}\n\ntype LinkAttributes = Record<string, string | undefined>;\n\nconst notPendingFormStatus: FormStatusNotPending = {\n pending: false,\n data: null,\n method: null,\n action: null,\n};\n\nexport function useFormStatus(): FormStatus {\n return notPendingFormStatus;\n}\n\nexport function requestFormReset(form: HTMLFormElement): void {\n form.reset();\n}\n\nexport function unstable_batchedUpdates<T>(callback: () => T): T;\nexport function unstable_batchedUpdates<TArgument, TResult>(\n callback: (argument: TArgument) => TResult,\n argument: TArgument,\n): TResult;\nexport function unstable_batchedUpdates<TArgument, TResult>(\n callback: ((argument: TArgument) => TResult) | (() => TResult),\n argument?: TArgument,\n): TResult {\n return runWithEventPriority(\"discrete\", () =>\n argument === undefined\n ? (callback as () => TResult)()\n : (callback as (argument: TArgument) => TResult)(argument)\n );\n}\n\nexport function prefetchDNS(href: string): void {\n upsertHeadLink(\"dns-prefetch\", href, {});\n}\n\nexport function preconnect(href: string, options: PreconnectOptions = {}): void {\n upsertHeadLink(\"preconnect\", href, {\n crossorigin: options.crossOrigin,\n });\n}\n\nexport function preload(href: string, options: PreloadOptions): void {\n upsertHeadLink(\"preload\", href, {\n as: options.as,\n crossorigin: options.crossOrigin,\n fetchpriority: options.fetchPriority,\n imagesrcset: options.imageSrcSet,\n imagesizes: options.imageSizes,\n integrity: options.integrity,\n media: options.media,\n nonce: options.nonce,\n referrerpolicy: options.referrerPolicy,\n type: options.type,\n });\n}\n\nexport function preloadModule(href: string, options: PreloadModuleOptions = {}): void {\n upsertHeadLink(\"modulepreload\", href, {\n as: options.as,\n crossorigin: options.crossOrigin,\n integrity: options.integrity,\n nonce: options.nonce,\n });\n}\n\nexport function preinit(href: string, options: PreinitOptions): void {\n if (options.as === \"style\") {\n upsertHeadLink(\"stylesheet\", href, {\n \"data-precedence\": options.precedence,\n crossorigin: options.crossOrigin,\n fetchpriority: options.fetchPriority,\n integrity: options.integrity,\n nonce: options.nonce,\n });\n return;\n }\n\n upsertHeadScript(href, {\n async: \"\",\n crossorigin: options.crossOrigin,\n fetchpriority: options.fetchPriority,\n integrity: options.integrity,\n nonce: options.nonce,\n });\n}\n\nexport function preinitModule(href: string, options: PreinitModuleOptions = {}): void {\n upsertHeadScript(href, {\n type: \"module\",\n async: \"\",\n crossorigin: options.crossOrigin,\n integrity: options.integrity,\n nonce: options.nonce,\n });\n}\n\nfunction upsertHeadLink(\n rel: string,\n href: string,\n attributes: LinkAttributes,\n): void {\n if (typeof document === \"undefined\") {\n return;\n }\n\n const selector = `link[rel=\"${escapeSelectorValue(rel)}\"][href=\"${escapeSelectorValue(href)}\"]`;\n if (document.head.querySelector(selector) !== null) {\n return;\n }\n\n const link = document.createElement(\"link\");\n link.setAttribute(\"rel\", rel);\n link.setAttribute(\"href\", href);\n applyAttributes(link, attributes);\n document.head.append(link);\n}\n\nfunction upsertHeadScript(\n src: string,\n attributes: LinkAttributes,\n): void {\n if (typeof document === \"undefined\") {\n return;\n }\n\n const selector = `script[src=\"${escapeSelectorValue(src)}\"]`;\n if (document.head.querySelector(selector) !== null) {\n return;\n }\n\n const script = document.createElement(\"script\");\n if (attributes.type === \"module\") {\n script.setAttribute(\"type\", \"module\");\n script.setAttribute(\"src\", src);\n applyAttributes(script, { ...attributes, type: undefined });\n } else {\n script.setAttribute(\"src\", src);\n applyAttributes(script, attributes);\n }\n\n document.head.append(script);\n}\n\nfunction applyAttributes(element: Element, attributes: LinkAttributes): void {\n for (const [name, value] of Object.entries(attributes)) {\n if (value === undefined) {\n continue;\n }\n element.setAttribute(name, value);\n }\n}\n\nfunction escapeSelectorValue(value: string): string {\n return value.replaceAll(\"\\\\\", \"\\\\\\\\\").replaceAll('\"', '\\\\\"');\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,IAAI,oBAAoB,GAEvC,MAAM,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AG,CAAC,GAAG,CAAC;IACxD,MAAM,SAAS,GACb,UAAU,CAAC,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,eAAe,eAAe,CAAC,UAAU,CAAC,SAAS,CAAC,GAAG,CAAC;IACpG,MAAM,WAAW,GACf,UAAU,CAAC,WAAW,KAAK,SAAS;QAClC,CAAC,CAAC,EAAE;QACJ,CAAC,CAAC,iBAAiB,eAAe,CAAC,UAAU,CAAC,WAAW,CAAC,GAAG,CAAC;IAElE,OAAO,UAAU,aAAa,GAAG,GAAG,GAAG,KAAK,GAAG,SAAS,GAAG,WAAW,YAAY,CAAC;AACrF,CAAC;AAED,SAAS,eAAe,CAAC,KAAa;IACpC,OAAO,KAAK;SACT,UAAU,CAAC,GAAG,EAAE,OAAO,CAAC;SACxB,UAAU,CAAC,GAAG,EAAE,QAAQ,CAAC;SACzB,UAAU,CAAC,GAAG,EAAE,MAAM,CAAC;SACvB,UAAU,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;AAC7B,CAAC;AAED,SAAS,mBAAmB,CAAC,KAAa;IACxC,OAAO,KAAK;SACT,UAAU,CAAC,GAAG,EAAE,SAAS,CAAC;SAC1B,UAAU,CAAC,QAAQ,EAAE,SAAS,CAAC;SAC/B,UAAU,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC;AACrC,CAAC;AAED,SAAS,aAAa,CAAC,OAA+C;IACpE,IAAI,OAAO,CAAC,SAAS,KAAK,SAAS,EAAE,CAAC;QACpC,OAAO;IACT,CAAC;IAED,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE,CAAC;IAC9B,OAAO,CAAC,GAAG,CAAC,cAAc,EAAE,0BAA0B,CAAC,CAAC;IACxD,OAAO,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;AAC7B,CAAC","sourcesContent":["import {\n renderToString as renderCompatToString,\n type ReactCompatNode,\n} from \"@reckona/mreact-compat\";\n\nexport const version = \"19.2.6\";\n\nexport interface PipeableStreamDestination {\n write(chunk: string | Uint8Array): unknown;\n end?(): unknown;\n destroy?(error?: unknown): unknown;\n}\n\nexport interface PipeableStream {\n pipe<TDestination extends PipeableStreamDestination>(destination: TDestination): TDestination;\n abort(reason?: unknown): void;\n}\n\nexport interface BootstrapScriptDescriptor {\n src: string;\n integrity?: string;\n crossOrigin?: string;\n}\n\nexport interface ReactImportMap {\n imports?: Record<string, string>;\n integrity?: Record<string, string>;\n scopes?: Record<string, Record<string, string>>;\n}\n\nexport interface RenderBootstrapOptions {\n nonce?: string;\n importMap?: ReactImportMap;\n bootstrapScriptContent?: string;\n bootstrapScripts?: Array<string | BootstrapScriptDescriptor>;\n bootstrapModules?: Array<string | BootstrapScriptDescriptor>;\n}\n\nexport interface ServerOptions {\n identifierPrefix?: string;\n}\n\nexport interface RenderToPipeableStreamOptions {\n identifierPrefix?: string;\n namespaceURI?: string;\n nonce?: string;\n importMap?: ReactImportMap;\n bootstrapScriptContent?: string;\n bootstrapScripts?: Array<string | BootstrapScriptDescriptor>;\n bootstrapModules?: Array<string | BootstrapScriptDescriptor>;\n headersLengthHint?: number;\n progressiveChunkSize?: number;\n onHeaders?(headers: Headers): void;\n onShellReady?(): void;\n onAllReady?(): void;\n onShellError?(error: unknown): void;\n onError?(error: unknown, errorInfo?: { componentStack: string }): string | void;\n formState?: unknown;\n}\n\nexport interface RenderToReadableStreamOptions {\n identifierPrefix?: string;\n namespaceURI?: string;\n nonce?: string;\n importMap?: ReactImportMap;\n bootstrapScriptContent?: string;\n bootstrapScripts?: Array<string | BootstrapScriptDescriptor>;\n bootstrapModules?: Array<string | BootstrapScriptDescriptor>;\n headersLengthHint?: number;\n progressiveChunkSize?: number;\n signal?: AbortSignal;\n onHeaders?(headers: Headers): void;\n onError?(error: unknown, errorInfo?: { componentStack: string }): string | void;\n formState?: unknown;\n}\n\nexport interface ReactDOMServerReadableStream extends ReadableStream<Uint8Array> {\n allReady: Promise<void>;\n}\n\nexport type ResumeOptions = RenderToReadableStreamOptions & RenderToPipeableStreamOptions;\nexport type PostponedState = unknown;\n\nexport function renderToString(element: ReactCompatNode, _options?: ServerOptions): string {\n return renderCompatToString(() => element);\n}\n\nexport function renderToStaticMarkup(element: ReactCompatNode, options?: ServerOptions): string {\n void options;\n return renderToString(element);\n}\n\nexport async function renderToReadableStream(\n element: ReactCompatNode,\n options: RenderToReadableStreamOptions = {},\n): Promise<ReactDOMServerReadableStream> {\n const encoder = new TextEncoder();\n const html = renderServerHtml(element, options);\n notifyHeaders(options);\n let resolveAllReady: () => void;\n let rejectAllReady: (error: unknown) => void;\n const allReady = new Promise<void>((resolve, reject) => {\n resolveAllReady = resolve;\n rejectAllReady = reject;\n });\n\n const stream = new ReadableStream<Uint8Array>({\n start(controller) {\n if (options.signal?.aborted === true) {\n const reason = options.signal.reason;\n rejectAllReady(reason);\n controller.error(reason);\n return;\n }\n\n const abort = () => {\n const reason = options.signal?.reason;\n rejectAllReady(reason);\n controller.error(reason);\n };\n options.signal?.addEventListener(\"abort\", abort, { once: true });\n\n try {\n controller.enqueue(encoder.encode(html));\n controller.close();\n resolveAllReady();\n } catch (error) {\n options.onError?.(error, { componentStack: \"\" });\n rejectAllReady(error);\n controller.error(error);\n } finally {\n options.signal?.removeEventListener(\"abort\", abort);\n }\n },\n });\n\n return Object.assign(stream, { allReady });\n}\n\nexport function renderToPipeableStream(\n element: ReactCompatNode,\n options: RenderToPipeableStreamOptions = {},\n): PipeableStream {\n let aborted = false;\n\n return {\n pipe(destination) {\n queueMicrotask(() => {\n if (aborted) {\n return;\n }\n\n try {\n notifyHeaders(options);\n options.onShellReady?.();\n const html = renderServerHtml(element, options);\n options.onAllReady?.();\n destination.write(html);\n destination.end?.();\n } catch (error) {\n options.onError?.(error, { componentStack: \"\" });\n options.onShellError?.(error);\n destination.destroy?.(error);\n }\n });\n\n return destination;\n },\n abort(reason) {\n aborted = true;\n options.onError?.(reason ?? new Error(\"renderToPipeableStream was aborted.\"), {\n componentStack: \"\",\n });\n },\n };\n}\n\nexport async function resume(\n element: ReactCompatNode,\n _postponedState: PostponedState,\n options: ResumeOptions = {},\n): Promise<ReactDOMServerReadableStream> {\n return renderToReadableStream(element, options);\n}\n\nexport async function resumeToPipeableStream(\n element: ReactCompatNode,\n _postponedState: PostponedState,\n options: ResumeOptions = {},\n): Promise<PipeableStream> {\n return renderToPipeableStream(element, options);\n}\n\nfunction renderServerHtml(element: ReactCompatNode, options: RenderBootstrapOptions): string {\n return `${renderToString(element)}${renderBootstrapResources(options)}`;\n}\n\nfunction renderBootstrapResources(options: RenderBootstrapOptions): string {\n const nonce = options.nonce === undefined ? \"\" : ` nonce=\"${escapeAttribute(options.nonce)}\"`;\n const importMap =\n options.importMap === undefined\n ? \"\"\n : `<script type=\"importmap\"${nonce}>${escapeScriptContent(JSON.stringify(options.importMap))}</script>`;\n const inlineScript =\n options.bootstrapScriptContent === undefined\n ? \"\"\n : `<script${nonce}>${escapeScriptContent(options.bootstrapScriptContent)}</script>`;\n const scripts = (options.bootstrapScripts ?? [])\n .map((script) => renderExternalScript(script, nonce, undefined))\n .join(\"\");\n const modules = (options.bootstrapModules ?? [])\n .map((script) => renderExternalScript(script, nonce, \"module\"))\n .join(\"\");\n\n return `${importMap}${inlineScript}${scripts}${modules}`;\n}\n\nfunction renderExternalScript(\n script: string | BootstrapScriptDescriptor,\n nonce: string,\n type: \"module\" | undefined,\n): string {\n const descriptor = typeof script === \"string\" ? { src: script } : script;\n const typeAttribute = type === undefined ? \"\" : ` type=\"${type}\"`;\n const src = ` src=\"${escapeAttribute(descriptor.src)}\"`;\n const integrity =\n descriptor.integrity === undefined ? \"\" : ` integrity=\"${escapeAttribute(descriptor.integrity)}\"`;\n const crossOrigin =\n descriptor.crossOrigin === undefined\n ? \"\"\n : ` crossorigin=\"${escapeAttribute(descriptor.crossOrigin)}\"`;\n\n return `<script${typeAttribute}${src}${nonce}${integrity}${crossOrigin}></script>`;\n}\n\nfunction escapeAttribute(value: string): string {\n return value\n .replaceAll(\"&\", \"&amp;\")\n .replaceAll('\"', \"&quot;\")\n .replaceAll(\"<\", \"&lt;\")\n .replaceAll(\">\", \"&gt;\");\n}\n\nfunction escapeScriptContent(value: string): string {\n return value\n .replaceAll(\"<\", \"\\\\u003c\")\n .replaceAll(\"\\u2028\", \"\\\\u2028\")\n .replaceAll(\"\\u2029\", \"\\\\u2029\");\n}\n\nfunction notifyHeaders(options: { onHeaders?(headers: Headers): void }): void {\n if (options.onHeaders === undefined) {\n return;\n }\n\n const headers = new Headers();\n headers.set(\"content-type\", \"text/html; charset=utf-8\");\n options.onHeaders(headers);\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reckona/mreact-dom",
3
- "version": "0.0.66",
3
+ "version": "0.0.68",
4
4
  "description": "React DOM-compatible entrypoints for mreact.",
5
5
  "keywords": [
6
6
  "dom",
@@ -24,7 +24,8 @@
24
24
  "dist/**/*.js",
25
25
  "dist/**/*.js.map",
26
26
  "dist/**/*.d.ts",
27
- "dist/**/*.d.ts.map"
27
+ "dist/**/*.d.ts.map",
28
+ "src/**/*"
28
29
  ],
29
30
  "type": "module",
30
31
  "sideEffects": false,
@@ -47,6 +48,6 @@
47
48
  "access": "public"
48
49
  },
49
50
  "dependencies": {
50
- "@reckona/mreact-compat": "0.0.66"
51
+ "@reckona/mreact-compat": "0.0.68"
51
52
  }
52
53
  }
package/src/client.ts ADDED
@@ -0,0 +1,4 @@
1
+ export { createRoot, hydrateRoot } from "@reckona/mreact-compat";
2
+ export type { HydrateRootOptions, Root, RootOptions } from "@reckona/mreact-compat";
3
+
4
+ export const version = "19.2.6";
package/src/index.ts ADDED
@@ -0,0 +1,240 @@
1
+ export {
2
+ createPortal,
3
+ flushSync,
4
+ render,
5
+ unmountComponentAtNode,
6
+ useActionState as useFormState,
7
+ } from "@reckona/mreact-compat";
8
+ import { runWithEventPriority } from "@reckona/mreact-compat/event-priority";
9
+ export { createRoot, hydrateRoot } from "./client.js";
10
+ export type { HydrateRootOptions, Root, RootOptions } from "./client.js";
11
+
12
+ export const version = "19.2.6";
13
+
14
+ export interface FormStatusNotPending {
15
+ pending: false;
16
+ data: null;
17
+ method: null;
18
+ action: null;
19
+ }
20
+
21
+ export interface FormStatusPending {
22
+ pending: true;
23
+ data: FormData;
24
+ method: string;
25
+ action: string | ((formData: FormData) => void | Promise<void>);
26
+ }
27
+
28
+ export type FormStatus = FormStatusPending | FormStatusNotPending;
29
+
30
+ export interface PreconnectOptions {
31
+ crossOrigin?: "anonymous" | "use-credentials" | "";
32
+ }
33
+
34
+ export type PreloadAs =
35
+ | "audio"
36
+ | "document"
37
+ | "embed"
38
+ | "fetch"
39
+ | "font"
40
+ | "image"
41
+ | "object"
42
+ | "track"
43
+ | "script"
44
+ | "style"
45
+ | "video"
46
+ | "worker";
47
+
48
+ export interface PreloadOptions {
49
+ as: PreloadAs;
50
+ crossOrigin?: "anonymous" | "use-credentials" | "";
51
+ fetchPriority?: "high" | "low" | "auto";
52
+ imageSizes?: string;
53
+ imageSrcSet?: string;
54
+ integrity?: string;
55
+ type?: string;
56
+ nonce?: string;
57
+ referrerPolicy?: ReferrerPolicy;
58
+ media?: string;
59
+ }
60
+
61
+ export interface PreloadModuleOptions {
62
+ as?: RequestDestination;
63
+ crossOrigin?: "anonymous" | "use-credentials" | "";
64
+ integrity?: string;
65
+ nonce?: string;
66
+ }
67
+
68
+ export interface PreinitOptions {
69
+ as: "script" | "style";
70
+ crossOrigin?: "anonymous" | "use-credentials" | "";
71
+ fetchPriority?: "high" | "low" | "auto";
72
+ precedence?: string;
73
+ integrity?: string;
74
+ nonce?: string;
75
+ }
76
+
77
+ export interface PreinitModuleOptions {
78
+ as?: "script";
79
+ crossOrigin?: "anonymous" | "use-credentials" | "";
80
+ integrity?: string;
81
+ nonce?: string;
82
+ }
83
+
84
+ type LinkAttributes = Record<string, string | undefined>;
85
+
86
+ const notPendingFormStatus: FormStatusNotPending = {
87
+ pending: false,
88
+ data: null,
89
+ method: null,
90
+ action: null,
91
+ };
92
+
93
+ export function useFormStatus(): FormStatus {
94
+ return notPendingFormStatus;
95
+ }
96
+
97
+ export function requestFormReset(form: HTMLFormElement): void {
98
+ form.reset();
99
+ }
100
+
101
+ export function unstable_batchedUpdates<T>(callback: () => T): T;
102
+ export function unstable_batchedUpdates<TArgument, TResult>(
103
+ callback: (argument: TArgument) => TResult,
104
+ argument: TArgument,
105
+ ): TResult;
106
+ export function unstable_batchedUpdates<TArgument, TResult>(
107
+ callback: ((argument: TArgument) => TResult) | (() => TResult),
108
+ argument?: TArgument,
109
+ ): TResult {
110
+ return runWithEventPriority("discrete", () =>
111
+ argument === undefined
112
+ ? (callback as () => TResult)()
113
+ : (callback as (argument: TArgument) => TResult)(argument)
114
+ );
115
+ }
116
+
117
+ export function prefetchDNS(href: string): void {
118
+ upsertHeadLink("dns-prefetch", href, {});
119
+ }
120
+
121
+ export function preconnect(href: string, options: PreconnectOptions = {}): void {
122
+ upsertHeadLink("preconnect", href, {
123
+ crossorigin: options.crossOrigin,
124
+ });
125
+ }
126
+
127
+ export function preload(href: string, options: PreloadOptions): void {
128
+ upsertHeadLink("preload", href, {
129
+ as: options.as,
130
+ crossorigin: options.crossOrigin,
131
+ fetchpriority: options.fetchPriority,
132
+ imagesrcset: options.imageSrcSet,
133
+ imagesizes: options.imageSizes,
134
+ integrity: options.integrity,
135
+ media: options.media,
136
+ nonce: options.nonce,
137
+ referrerpolicy: options.referrerPolicy,
138
+ type: options.type,
139
+ });
140
+ }
141
+
142
+ export function preloadModule(href: string, options: PreloadModuleOptions = {}): void {
143
+ upsertHeadLink("modulepreload", href, {
144
+ as: options.as,
145
+ crossorigin: options.crossOrigin,
146
+ integrity: options.integrity,
147
+ nonce: options.nonce,
148
+ });
149
+ }
150
+
151
+ export function preinit(href: string, options: PreinitOptions): void {
152
+ if (options.as === "style") {
153
+ upsertHeadLink("stylesheet", href, {
154
+ "data-precedence": options.precedence,
155
+ crossorigin: options.crossOrigin,
156
+ fetchpriority: options.fetchPriority,
157
+ integrity: options.integrity,
158
+ nonce: options.nonce,
159
+ });
160
+ return;
161
+ }
162
+
163
+ upsertHeadScript(href, {
164
+ async: "",
165
+ crossorigin: options.crossOrigin,
166
+ fetchpriority: options.fetchPriority,
167
+ integrity: options.integrity,
168
+ nonce: options.nonce,
169
+ });
170
+ }
171
+
172
+ export function preinitModule(href: string, options: PreinitModuleOptions = {}): void {
173
+ upsertHeadScript(href, {
174
+ type: "module",
175
+ async: "",
176
+ crossorigin: options.crossOrigin,
177
+ integrity: options.integrity,
178
+ nonce: options.nonce,
179
+ });
180
+ }
181
+
182
+ function upsertHeadLink(
183
+ rel: string,
184
+ href: string,
185
+ attributes: LinkAttributes,
186
+ ): void {
187
+ if (typeof document === "undefined") {
188
+ return;
189
+ }
190
+
191
+ const selector = `link[rel="${escapeSelectorValue(rel)}"][href="${escapeSelectorValue(href)}"]`;
192
+ if (document.head.querySelector(selector) !== null) {
193
+ return;
194
+ }
195
+
196
+ const link = document.createElement("link");
197
+ link.setAttribute("rel", rel);
198
+ link.setAttribute("href", href);
199
+ applyAttributes(link, attributes);
200
+ document.head.append(link);
201
+ }
202
+
203
+ function upsertHeadScript(
204
+ src: string,
205
+ attributes: LinkAttributes,
206
+ ): void {
207
+ if (typeof document === "undefined") {
208
+ return;
209
+ }
210
+
211
+ const selector = `script[src="${escapeSelectorValue(src)}"]`;
212
+ if (document.head.querySelector(selector) !== null) {
213
+ return;
214
+ }
215
+
216
+ const script = document.createElement("script");
217
+ if (attributes.type === "module") {
218
+ script.setAttribute("type", "module");
219
+ script.setAttribute("src", src);
220
+ applyAttributes(script, { ...attributes, type: undefined });
221
+ } else {
222
+ script.setAttribute("src", src);
223
+ applyAttributes(script, attributes);
224
+ }
225
+
226
+ document.head.append(script);
227
+ }
228
+
229
+ function applyAttributes(element: Element, attributes: LinkAttributes): void {
230
+ for (const [name, value] of Object.entries(attributes)) {
231
+ if (value === undefined) {
232
+ continue;
233
+ }
234
+ element.setAttribute(name, value);
235
+ }
236
+ }
237
+
238
+ function escapeSelectorValue(value: string): string {
239
+ return value.replaceAll("\\", "\\\\").replaceAll('"', '\\"');
240
+ }
package/src/server.ts ADDED
@@ -0,0 +1,259 @@
1
+ import {
2
+ renderToString as renderCompatToString,
3
+ type ReactCompatNode,
4
+ } from "@reckona/mreact-compat";
5
+
6
+ export const version = "19.2.6";
7
+
8
+ export interface PipeableStreamDestination {
9
+ write(chunk: string | Uint8Array): unknown;
10
+ end?(): unknown;
11
+ destroy?(error?: unknown): unknown;
12
+ }
13
+
14
+ export interface PipeableStream {
15
+ pipe<TDestination extends PipeableStreamDestination>(destination: TDestination): TDestination;
16
+ abort(reason?: unknown): void;
17
+ }
18
+
19
+ export interface BootstrapScriptDescriptor {
20
+ src: string;
21
+ integrity?: string;
22
+ crossOrigin?: string;
23
+ }
24
+
25
+ export interface ReactImportMap {
26
+ imports?: Record<string, string>;
27
+ integrity?: Record<string, string>;
28
+ scopes?: Record<string, Record<string, string>>;
29
+ }
30
+
31
+ export interface RenderBootstrapOptions {
32
+ nonce?: string;
33
+ importMap?: ReactImportMap;
34
+ bootstrapScriptContent?: string;
35
+ bootstrapScripts?: Array<string | BootstrapScriptDescriptor>;
36
+ bootstrapModules?: Array<string | BootstrapScriptDescriptor>;
37
+ }
38
+
39
+ export interface ServerOptions {
40
+ identifierPrefix?: string;
41
+ }
42
+
43
+ export interface RenderToPipeableStreamOptions {
44
+ identifierPrefix?: string;
45
+ namespaceURI?: string;
46
+ nonce?: string;
47
+ importMap?: ReactImportMap;
48
+ bootstrapScriptContent?: string;
49
+ bootstrapScripts?: Array<string | BootstrapScriptDescriptor>;
50
+ bootstrapModules?: Array<string | BootstrapScriptDescriptor>;
51
+ headersLengthHint?: number;
52
+ progressiveChunkSize?: number;
53
+ onHeaders?(headers: Headers): void;
54
+ onShellReady?(): void;
55
+ onAllReady?(): void;
56
+ onShellError?(error: unknown): void;
57
+ onError?(error: unknown, errorInfo?: { componentStack: string }): string | void;
58
+ formState?: unknown;
59
+ }
60
+
61
+ export interface RenderToReadableStreamOptions {
62
+ identifierPrefix?: string;
63
+ namespaceURI?: string;
64
+ nonce?: string;
65
+ importMap?: ReactImportMap;
66
+ bootstrapScriptContent?: string;
67
+ bootstrapScripts?: Array<string | BootstrapScriptDescriptor>;
68
+ bootstrapModules?: Array<string | BootstrapScriptDescriptor>;
69
+ headersLengthHint?: number;
70
+ progressiveChunkSize?: number;
71
+ signal?: AbortSignal;
72
+ onHeaders?(headers: Headers): void;
73
+ onError?(error: unknown, errorInfo?: { componentStack: string }): string | void;
74
+ formState?: unknown;
75
+ }
76
+
77
+ export interface ReactDOMServerReadableStream extends ReadableStream<Uint8Array> {
78
+ allReady: Promise<void>;
79
+ }
80
+
81
+ export type ResumeOptions = RenderToReadableStreamOptions & RenderToPipeableStreamOptions;
82
+ export type PostponedState = unknown;
83
+
84
+ export function renderToString(element: ReactCompatNode, _options?: ServerOptions): string {
85
+ return renderCompatToString(() => element);
86
+ }
87
+
88
+ export function renderToStaticMarkup(element: ReactCompatNode, options?: ServerOptions): string {
89
+ void options;
90
+ return renderToString(element);
91
+ }
92
+
93
+ export async function renderToReadableStream(
94
+ element: ReactCompatNode,
95
+ options: RenderToReadableStreamOptions = {},
96
+ ): Promise<ReactDOMServerReadableStream> {
97
+ const encoder = new TextEncoder();
98
+ const html = renderServerHtml(element, options);
99
+ notifyHeaders(options);
100
+ let resolveAllReady: () => void;
101
+ let rejectAllReady: (error: unknown) => void;
102
+ const allReady = new Promise<void>((resolve, reject) => {
103
+ resolveAllReady = resolve;
104
+ rejectAllReady = reject;
105
+ });
106
+
107
+ const stream = new ReadableStream<Uint8Array>({
108
+ start(controller) {
109
+ if (options.signal?.aborted === true) {
110
+ const reason = options.signal.reason;
111
+ rejectAllReady(reason);
112
+ controller.error(reason);
113
+ return;
114
+ }
115
+
116
+ const abort = () => {
117
+ const reason = options.signal?.reason;
118
+ rejectAllReady(reason);
119
+ controller.error(reason);
120
+ };
121
+ options.signal?.addEventListener("abort", abort, { once: true });
122
+
123
+ try {
124
+ controller.enqueue(encoder.encode(html));
125
+ controller.close();
126
+ resolveAllReady();
127
+ } catch (error) {
128
+ options.onError?.(error, { componentStack: "" });
129
+ rejectAllReady(error);
130
+ controller.error(error);
131
+ } finally {
132
+ options.signal?.removeEventListener("abort", abort);
133
+ }
134
+ },
135
+ });
136
+
137
+ return Object.assign(stream, { allReady });
138
+ }
139
+
140
+ export function renderToPipeableStream(
141
+ element: ReactCompatNode,
142
+ options: RenderToPipeableStreamOptions = {},
143
+ ): PipeableStream {
144
+ let aborted = false;
145
+
146
+ return {
147
+ pipe(destination) {
148
+ queueMicrotask(() => {
149
+ if (aborted) {
150
+ return;
151
+ }
152
+
153
+ try {
154
+ notifyHeaders(options);
155
+ options.onShellReady?.();
156
+ const html = renderServerHtml(element, options);
157
+ options.onAllReady?.();
158
+ destination.write(html);
159
+ destination.end?.();
160
+ } catch (error) {
161
+ options.onError?.(error, { componentStack: "" });
162
+ options.onShellError?.(error);
163
+ destination.destroy?.(error);
164
+ }
165
+ });
166
+
167
+ return destination;
168
+ },
169
+ abort(reason) {
170
+ aborted = true;
171
+ options.onError?.(reason ?? new Error("renderToPipeableStream was aborted."), {
172
+ componentStack: "",
173
+ });
174
+ },
175
+ };
176
+ }
177
+
178
+ export async function resume(
179
+ element: ReactCompatNode,
180
+ _postponedState: PostponedState,
181
+ options: ResumeOptions = {},
182
+ ): Promise<ReactDOMServerReadableStream> {
183
+ return renderToReadableStream(element, options);
184
+ }
185
+
186
+ export async function resumeToPipeableStream(
187
+ element: ReactCompatNode,
188
+ _postponedState: PostponedState,
189
+ options: ResumeOptions = {},
190
+ ): Promise<PipeableStream> {
191
+ return renderToPipeableStream(element, options);
192
+ }
193
+
194
+ function renderServerHtml(element: ReactCompatNode, options: RenderBootstrapOptions): string {
195
+ return `${renderToString(element)}${renderBootstrapResources(options)}`;
196
+ }
197
+
198
+ function renderBootstrapResources(options: RenderBootstrapOptions): string {
199
+ const nonce = options.nonce === undefined ? "" : ` nonce="${escapeAttribute(options.nonce)}"`;
200
+ const importMap =
201
+ options.importMap === undefined
202
+ ? ""
203
+ : `<script type="importmap"${nonce}>${escapeScriptContent(JSON.stringify(options.importMap))}</script>`;
204
+ const inlineScript =
205
+ options.bootstrapScriptContent === undefined
206
+ ? ""
207
+ : `<script${nonce}>${escapeScriptContent(options.bootstrapScriptContent)}</script>`;
208
+ const scripts = (options.bootstrapScripts ?? [])
209
+ .map((script) => renderExternalScript(script, nonce, undefined))
210
+ .join("");
211
+ const modules = (options.bootstrapModules ?? [])
212
+ .map((script) => renderExternalScript(script, nonce, "module"))
213
+ .join("");
214
+
215
+ return `${importMap}${inlineScript}${scripts}${modules}`;
216
+ }
217
+
218
+ function renderExternalScript(
219
+ script: string | BootstrapScriptDescriptor,
220
+ nonce: string,
221
+ type: "module" | undefined,
222
+ ): string {
223
+ const descriptor = typeof script === "string" ? { src: script } : script;
224
+ const typeAttribute = type === undefined ? "" : ` type="${type}"`;
225
+ const src = ` src="${escapeAttribute(descriptor.src)}"`;
226
+ const integrity =
227
+ descriptor.integrity === undefined ? "" : ` integrity="${escapeAttribute(descriptor.integrity)}"`;
228
+ const crossOrigin =
229
+ descriptor.crossOrigin === undefined
230
+ ? ""
231
+ : ` crossorigin="${escapeAttribute(descriptor.crossOrigin)}"`;
232
+
233
+ return `<script${typeAttribute}${src}${nonce}${integrity}${crossOrigin}></script>`;
234
+ }
235
+
236
+ function escapeAttribute(value: string): string {
237
+ return value
238
+ .replaceAll("&", "&amp;")
239
+ .replaceAll('"', "&quot;")
240
+ .replaceAll("<", "&lt;")
241
+ .replaceAll(">", "&gt;");
242
+ }
243
+
244
+ function escapeScriptContent(value: string): string {
245
+ return value
246
+ .replaceAll("<", "\\u003c")
247
+ .replaceAll("\u2028", "\\u2028")
248
+ .replaceAll("\u2029", "\\u2029");
249
+ }
250
+
251
+ function notifyHeaders(options: { onHeaders?(headers: Headers): void }): void {
252
+ if (options.onHeaders === undefined) {
253
+ return;
254
+ }
255
+
256
+ const headers = new Headers();
257
+ headers.set("content-type", "text/html; charset=utf-8");
258
+ options.onHeaders(headers);
259
+ }