@mintlify/package-builder 0.0.0-stage → 0.0.3

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.
Files changed (46) hide show
  1. package/LICENSE +93 -0
  2. package/README.md +66 -2
  3. package/dist/build.d.ts +4 -0
  4. package/dist/build.js +338 -0
  5. package/dist/bundle.d.ts +44 -0
  6. package/dist/bundle.js +681 -0
  7. package/dist/cli.d.ts +13 -0
  8. package/dist/cli.js +112 -0
  9. package/dist/diagnostics.d.ts +11 -0
  10. package/dist/diagnostics.js +32 -0
  11. package/dist/hashing.d.ts +28 -0
  12. package/dist/hashing.js +98 -0
  13. package/dist/index.d.ts +12 -0
  14. package/dist/index.js +11 -0
  15. package/dist/install.d.ts +34 -0
  16. package/dist/install.js +325 -0
  17. package/dist/local-files.d.ts +11 -0
  18. package/dist/local-files.js +120 -0
  19. package/dist/lockfile.d.ts +40 -0
  20. package/dist/lockfile.js +498 -0
  21. package/dist/package-json.d.ts +14 -0
  22. package/dist/package-json.js +170 -0
  23. package/dist/package-manager.d.ts +17 -0
  24. package/dist/package-manager.js +87 -0
  25. package/dist/react.d.ts +37 -0
  26. package/dist/react.js +264 -0
  27. package/dist/render.d.ts +37 -0
  28. package/dist/render.js +292 -0
  29. package/dist/runtime/client.d.ts +11 -0
  30. package/dist/runtime/client.js +54 -0
  31. package/dist/runtime/server.d.ts +6 -0
  32. package/dist/runtime/server.js +11 -0
  33. package/dist/runtime/shell.d.ts +21 -0
  34. package/dist/runtime/shell.js +68 -0
  35. package/dist/runtime/theme.d.ts +1 -0
  36. package/dist/runtime/theme.js +1 -0
  37. package/dist/sanitize.d.ts +9 -0
  38. package/dist/sanitize.js +650 -0
  39. package/dist/semver.d.ts +2 -0
  40. package/dist/semver.js +10 -0
  41. package/dist/tsconfig.build.tsbuildinfo +1 -0
  42. package/dist/types.d.ts +98 -0
  43. package/dist/types.js +1 -0
  44. package/dist/version.d.ts +1 -0
  45. package/dist/version.js +11 -0
  46. package/package.json +74 -4
package/dist/render.js ADDED
@@ -0,0 +1,292 @@
1
+ import { spawn } from 'node:child_process';
2
+ import { realpathSync } from 'node:fs';
3
+ import { mkdir, mkdtemp, readFile, rm, writeFile } from 'node:fs/promises';
4
+ import { tmpdir } from 'node:os';
5
+ import { dirname, join } from 'node:path';
6
+ export const ISLAND_RENDER_TIMEOUT_MS = 3000;
7
+ const MAX_MESSAGE_CHARS = 1024 * 1024;
8
+ const MAX_HTML_CHARS = 16 * 1024 * 1024;
9
+ const MAX_LOG_ENTRIES = 20;
10
+ const MAX_LOG_CHARS = 2000;
11
+ const MAX_DURATION_MS = 60 * 60 * 1000;
12
+ const PASSTHROUGH_ENV = ['PATH', 'SystemRoot', 'TEMP', 'TMP', 'TMPDIR'];
13
+ export function permissionArgs(readable, flags = process.allowedNodeEnvironmentFlags) {
14
+ const flag = ['--permission', '--experimental-permission'].find((f) => flags.has(f));
15
+ return flag ? [flag, ...readable.map((path) => `--allow-fs-read=${path}`)] : [];
16
+ }
17
+ export function disabledModuleArgs(flags = process.allowedNodeEnvironmentFlags) {
18
+ return flags.has('--experimental-sqlite') ? ['--no-experimental-sqlite'] : [];
19
+ }
20
+ export function sandboxAvailable(flags = process.allowedNodeEnvironmentFlags) {
21
+ return permissionArgs([], flags).length > 0;
22
+ }
23
+ export const ISLAND_RENDER_MEMORY_LIMIT_BYTES = 2 * 1024 * 1024 * 1024;
24
+ const MEMORY_POLL_MS = 100;
25
+ async function residentBytes(pid) {
26
+ try {
27
+ const status = await readFile(`/proc/${pid}/status`, 'utf8');
28
+ const kb = /^VmRSS:\s+(\d+)\s+kB$/m.exec(status)?.[1];
29
+ return kb === undefined ? undefined : Number(kb) * 1024;
30
+ }
31
+ catch {
32
+ return undefined;
33
+ }
34
+ }
35
+ export async function sandboxArgs(args, probe, platform = process.platform) {
36
+ return args.length === 0 || platform !== 'win32' || (await probe()) ? args : [];
37
+ }
38
+ function childEnv() {
39
+ const env = { NODE_ENV: 'production', TZ: 'UTC', NODE_NO_WARNINGS: '1' };
40
+ for (const key of PASSTHROUGH_ENV)
41
+ if (process.env[key] !== undefined)
42
+ env[key] = process.env[key];
43
+ return env;
44
+ }
45
+ function realOr(path) {
46
+ try {
47
+ return realpathSync.native(path);
48
+ }
49
+ catch {
50
+ return path;
51
+ }
52
+ }
53
+ const CHILD_SOURCE = `
54
+ import { writeSync } from 'node:fs';
55
+ import { join } from 'node:path';
56
+ import { performance } from 'node:perf_hooks';
57
+ import { pathToFileURL } from 'node:url';
58
+
59
+ const [serverDir, id, prefix] = process.argv.slice(2);
60
+ const fmt = (args) => args.map((a) => (a instanceof Error ? a.stack || a.message : typeof a === 'string' ? a : (() => { try { return JSON.stringify(a); } catch { return String(a); } })())).join(' ').slice(0, ${MAX_LOG_CHARS});
61
+ const errors = [];
62
+ const warnings = [];
63
+ const log = (list, args) => { if (list.length < ${MAX_LOG_ENTRIES}) list.push(fmt(args)); };
64
+ console.error = (...args) => log(errors, args);
65
+ console.warn = (...args) => log(warnings, args);
66
+ console.log = () => {};
67
+ console.info = () => {};
68
+ console.debug = () => {};
69
+ process.on('uncaughtException', (e) => log(errors, ['Uncaught:', e]));
70
+ process.on('unhandledRejection', (e) => log(errors, ['Unhandled rejection:', e]));
71
+ process.stdin.on('end', () => process.exit(0)).resume();
72
+ const send = (...values) => {
73
+ const data = Buffer.from(values.map((v) => JSON.stringify(v) + '\\n').join(''));
74
+ for (let at = 0; at < data.length; ) at += writeSync(3, data, at);
75
+ };
76
+
77
+ send({ type: 'start', id });
78
+ try {
79
+ const t0 = performance.now();
80
+ const mod = await import(pathToFileURL(join(serverDir, 'islands', id + '.mjs')).href);
81
+ const t1 = performance.now();
82
+ const html = String(mod.render({ identifierPrefix: prefix }));
83
+ const t2 = performance.now();
84
+ send({ type: 'done', id, importMs: t1 - t0, ssrMs: t2 - t1, errors, warnings }, html);
85
+ let again = null;
86
+ if (/id\\s*=/i.test(html)) {
87
+ try {
88
+ again = String(mod.render({ identifierPrefix: prefix }));
89
+ } catch {}
90
+ }
91
+ send(again);
92
+ } catch (e) {
93
+ send({ type: 'error', id, error: fmt([e]), errors, warnings });
94
+ }
95
+ `;
96
+ function decode(line) {
97
+ try {
98
+ return JSON.parse(line);
99
+ }
100
+ catch {
101
+ return undefined;
102
+ }
103
+ }
104
+ function clip(text) {
105
+ return text.length > MAX_LOG_CHARS ? `${text.slice(0, MAX_LOG_CHARS)}...` : text;
106
+ }
107
+ function strings(value) {
108
+ if (!Array.isArray(value) || !value.every((v) => typeof v === 'string'))
109
+ return undefined;
110
+ return value.slice(0, MAX_LOG_ENTRIES).map(clip);
111
+ }
112
+ function duration(value) {
113
+ return typeof value === 'number' && value >= 0 && value <= MAX_DURATION_MS;
114
+ }
115
+ function parseResult(msg, id) {
116
+ if (typeof msg !== 'object' || msg === null)
117
+ return undefined;
118
+ const m = msg;
119
+ const errors = strings(m.errors);
120
+ const warnings = strings(m.warnings);
121
+ if (m.id !== id || !errors || !warnings)
122
+ return undefined;
123
+ if (m.type === 'done' && duration(m.ssrMs) && duration(m.importMs)) {
124
+ return { id, ok: true, ssrMs: m.ssrMs, importMs: m.importMs, errors, warnings };
125
+ }
126
+ if (m.type === 'error' && typeof m.error === 'string') {
127
+ return { id, ok: false, error: clip(m.error), errors, warnings };
128
+ }
129
+ return undefined;
130
+ }
131
+ function preview(line) {
132
+ return line.length > 200 ? `${line.slice(0, 200)}...` : line;
133
+ }
134
+ function renderOne(script, serverDir, island, timeoutMs, extraArgs, memoryLimitBytes) {
135
+ return new Promise((resolvePromise) => {
136
+ const fail = (error) => ({
137
+ id: island.id,
138
+ ok: false,
139
+ error,
140
+ errors: [],
141
+ warnings: [],
142
+ });
143
+ let outcome;
144
+ let started = false;
145
+ let rendered;
146
+ let first;
147
+ let pending = '';
148
+ let stderr = '';
149
+ let timer;
150
+ const child = spawn(process.execPath, ['--max-old-space-size=1024', ...extraArgs, script, serverDir, island.id, island.prefix], {
151
+ stdio: ['pipe', 'ignore', 'pipe', 'pipe'],
152
+ env: childEnv(),
153
+ });
154
+ const finish = (result) => {
155
+ outcome ??= result;
156
+ child.kill('SIGKILL');
157
+ };
158
+ const tail = () => stderr.trim().split('\n').slice(-3).join(' ');
159
+ const deadline = setTimeout(() => child.kill('SIGKILL'), timeoutMs * 3);
160
+ const memoryPoll = process.platform === 'linux' && child.pid !== undefined
161
+ ? setInterval(() => {
162
+ const pid = child.pid;
163
+ if (pid === undefined)
164
+ return;
165
+ void residentBytes(pid).then((bytes) => {
166
+ if (bytes !== undefined && bytes > memoryLimitBytes) {
167
+ finish(fail(`Rendering used more than ${Math.round(memoryLimitBytes / 1024 / 1024)} MB of memory`));
168
+ }
169
+ });
170
+ }, MEMORY_POLL_MS)
171
+ : undefined;
172
+ child.stderr?.on('data', (chunk) => {
173
+ stderr = (stderr + chunk.toString()).slice(-4000);
174
+ });
175
+ const unexpected = (line) => fail(`The render process sent an unexpected message: ${preview(line)}`);
176
+ const limit = () => (rendered ? MAX_HTML_CHARS : MAX_MESSAGE_CHARS);
177
+ const tooLong = () => first ?? fail(`The render process sent a message over ${limit()} characters`);
178
+ const receive = (line) => {
179
+ if (line.length > limit()) {
180
+ finish(tooLong());
181
+ return;
182
+ }
183
+ if (first) {
184
+ const second = line.startsWith('"') ? decode(line) : undefined;
185
+ finish(typeof second === 'string' ? { ...first, second } : first);
186
+ return;
187
+ }
188
+ if (rendered) {
189
+ const html = line.startsWith('"') ? decode(line) : undefined;
190
+ if (typeof html === 'string')
191
+ first = { ...rendered, html };
192
+ else
193
+ finish(unexpected(line));
194
+ return;
195
+ }
196
+ const msg = decode(line);
197
+ const m = msg;
198
+ if (!started && m?.type === 'start' && m.id === island.id) {
199
+ started = true;
200
+ timer = setTimeout(() => finish(first ?? fail(`Rendering took longer than ${timeoutMs} ms`)), timeoutMs);
201
+ return;
202
+ }
203
+ const result = started ? parseResult(msg, island.id) : undefined;
204
+ if (result?.ok)
205
+ rendered = result;
206
+ else
207
+ finish(result ?? unexpected(line));
208
+ };
209
+ const channel = child.stdio[3];
210
+ channel?.setEncoding('utf8');
211
+ channel?.on('error', () => { });
212
+ channel?.on('data', (chunk) => {
213
+ try {
214
+ let rest = chunk;
215
+ for (let end = rest.indexOf('\n'); end !== -1 && !outcome; end = rest.indexOf('\n')) {
216
+ receive(pending + rest.slice(0, end));
217
+ pending = '';
218
+ rest = rest.slice(end + 1);
219
+ }
220
+ if (outcome)
221
+ return;
222
+ pending += rest;
223
+ if (pending.length > limit())
224
+ finish(tooLong());
225
+ }
226
+ catch {
227
+ finish(fail('The render process sent a message that could not be read'));
228
+ }
229
+ });
230
+ const settle = (result) => {
231
+ clearTimeout(deadline);
232
+ if (memoryPoll)
233
+ clearInterval(memoryPoll);
234
+ if (timer)
235
+ clearTimeout(timer);
236
+ finish(result);
237
+ resolvePromise(outcome);
238
+ };
239
+ child.on('error', (err) => settle(fail(`Could not start the render process: ${err.message}`)));
240
+ child.on('exit', (code) => settle(first ??
241
+ fail(started
242
+ ? `The render process exited with code ${String(code)}: ${tail()}`
243
+ : `The render process exited before rendering: ${tail()}`)));
244
+ });
245
+ }
246
+ async function sandboxWorks(script, serverDir, island, timeoutMs) {
247
+ const probeDir = join(dirname(script), 'probe');
248
+ const file = join(serverDir, 'islands', `${island.id}.mjs`);
249
+ await mkdir(join(probeDir, 'islands'), { recursive: true });
250
+ await writeFile(join(probeDir, 'islands', 'probe.mjs'), `import { readFileSync } from 'node:fs';\nreadFileSync(${JSON.stringify(file)});\nexport const render = () => 'ok';\n`);
251
+ const outcome = await renderOne(script, probeDir, { id: 'probe', prefix: '' }, timeoutMs, permissionArgs([serverDir, script, probeDir]), ISLAND_RENDER_MEMORY_LIMIT_BYTES);
252
+ return outcome.ok && outcome.html === 'ok';
253
+ }
254
+ export async function* renderEach(opts) {
255
+ const [first] = opts.islands;
256
+ if (!first)
257
+ return;
258
+ const timeoutMs = opts.timeoutMs ?? ISLAND_RENDER_TIMEOUT_MS;
259
+ const work = realOr(await mkdtemp(join(tmpdir(), 'mint-pkg-render-')));
260
+ const script = join(work, 'render-child.mjs');
261
+ await writeFile(script, CHILD_SOURCE);
262
+ const serverDir = realOr(opts.serverDir);
263
+ try {
264
+ const sandbox = await sandboxArgs(permissionArgs([serverDir, script]), () => sandboxWorks(script, serverDir, first, timeoutMs), opts.platform);
265
+ if (opts.requireSandbox && sandbox.length === 0) {
266
+ for (const island of opts.islands) {
267
+ yield {
268
+ id: island.id,
269
+ ok: false,
270
+ error: "Node's permission model is not available, so islands are not rendered on the server",
271
+ errors: [],
272
+ warnings: [],
273
+ };
274
+ }
275
+ return;
276
+ }
277
+ const extraArgs = [...sandbox, ...disabledModuleArgs()];
278
+ const memoryLimitBytes = opts.memoryLimitBytes ?? ISLAND_RENDER_MEMORY_LIMIT_BYTES;
279
+ for (const island of opts.islands) {
280
+ yield await renderOne(script, serverDir, island, timeoutMs, extraArgs, memoryLimitBytes);
281
+ }
282
+ }
283
+ finally {
284
+ await rm(work, { recursive: true, force: true });
285
+ }
286
+ }
287
+ export async function renderIslands(opts) {
288
+ const outcomes = [];
289
+ for await (const outcome of renderEach(opts))
290
+ outcomes.push(outcome);
291
+ return outcomes;
292
+ }
@@ -0,0 +1,11 @@
1
+ import { type ComponentType } from 'react';
2
+ export type HydrateOptions = {
3
+ props?: unknown;
4
+ identifierPrefix: string;
5
+ theme?: 'light' | 'dark';
6
+ };
7
+ export type IslandHandle = {
8
+ unmount(): void;
9
+ };
10
+ export declare function createHydrate(Island: ComponentType<Record<string, unknown>>, providerModule?: Record<string, unknown>): (el: HTMLElement, opts: HydrateOptions) => IslandHandle;
11
+ export { useMintTheme, useIslandContainer } from './shell.js';
@@ -0,0 +1,54 @@
1
+ import { createElement } from 'react';
2
+ import { createRoot, hydrateRoot } from 'react-dom/client';
3
+ import { IslandShell, resolveProvider } from './shell.js';
4
+ function hasServerHtml(el) {
5
+ for (let node = el.firstChild; node; node = node.nextSibling) {
6
+ if (node.nodeType === 1)
7
+ return true;
8
+ if (node.nodeType === 3 && (node.textContent ?? '').trim() !== '')
9
+ return true;
10
+ }
11
+ return false;
12
+ }
13
+ function reporter(el) {
14
+ return (error, phase) => {
15
+ el.dispatchEvent(new CustomEvent('mint-island-error', { bubbles: true, detail: { error, phase } }));
16
+ if (phase === 'recoverable')
17
+ console.warn('[mintlify] island recovered from an error', error);
18
+ };
19
+ }
20
+ export function createHydrate(Island, providerModule) {
21
+ const Provider = resolveProvider(providerModule);
22
+ return function hydrate(el, opts) {
23
+ if (opts.theme && !el.hasAttribute('data-mint-theme')) {
24
+ el.setAttribute('data-mint-theme', opts.theme);
25
+ }
26
+ const serverHtml = el.innerHTML;
27
+ const onError = reporter(el);
28
+ const props = (opts.props ?? {});
29
+ const tree = createElement(IslandShell, { container: el, serverHtml, Provider, onError }, createElement(Island, props));
30
+ let root;
31
+ if (hasServerHtml(el)) {
32
+ root = hydrateRoot(el, tree, {
33
+ identifierPrefix: opts.identifierPrefix,
34
+ onRecoverableError: (error) => onError(error, 'recoverable'),
35
+ });
36
+ }
37
+ else {
38
+ root = createRoot(el, { identifierPrefix: opts.identifierPrefix });
39
+ root.render(tree);
40
+ }
41
+ el.setAttribute('data-mint-island-hydrated', '');
42
+ let unmounted = false;
43
+ return {
44
+ unmount() {
45
+ if (unmounted)
46
+ return;
47
+ unmounted = true;
48
+ root.unmount();
49
+ el.removeAttribute('data-mint-island-hydrated');
50
+ },
51
+ };
52
+ };
53
+ }
54
+ export { useMintTheme, useIslandContainer } from './shell.js';
@@ -0,0 +1,6 @@
1
+ import { type ComponentType } from 'react';
2
+ export type RenderOptions = {
3
+ props?: unknown;
4
+ identifierPrefix: string;
5
+ };
6
+ export declare function createRender(Island: ComponentType<Record<string, unknown>>, providerModule?: Record<string, unknown>): (opts: RenderOptions) => string;
@@ -0,0 +1,11 @@
1
+ import { createElement } from 'react';
2
+ import { renderToString } from 'react-dom/server';
3
+ import { IslandShell, resolveProvider } from './shell.js';
4
+ export function createRender(Island, providerModule) {
5
+ const Provider = resolveProvider(providerModule);
6
+ return function render(opts) {
7
+ const props = (opts.props ?? {});
8
+ const tree = createElement(IslandShell, { container: null, serverHtml: '', Provider }, createElement(Island, props));
9
+ return renderToString(tree, { identifierPrefix: opts.identifierPrefix });
10
+ };
11
+ }
@@ -0,0 +1,21 @@
1
+ import { type ComponentType, type ReactNode } from 'react';
2
+ export type MintTheme = 'light' | 'dark';
3
+ type IslandContextValue = {
4
+ container: HTMLElement | null;
5
+ };
6
+ export declare function useMintTheme(): MintTheme;
7
+ export declare function useIslandContainer(): HTMLElement | null;
8
+ export type IslandErrorReporter = (error: unknown, phase: 'render' | 'recoverable') => void;
9
+ export type ProviderComponent = ComponentType<{
10
+ children?: ReactNode;
11
+ }>;
12
+ export type IslandShellProps = {
13
+ container: HTMLElement | null;
14
+ serverHtml: string;
15
+ Provider?: ProviderComponent;
16
+ onError?: IslandErrorReporter;
17
+ children?: ReactNode;
18
+ };
19
+ export declare function IslandShell({ container, serverHtml, Provider, onError, children, }: IslandShellProps): import("react").FunctionComponentElement<import("react").ProviderProps<IslandContextValue>>;
20
+ export declare function resolveProvider(mod: Record<string, unknown> | undefined): ProviderComponent | undefined;
21
+ export {};
@@ -0,0 +1,68 @@
1
+ import { Component, createContext, createElement, useCallback, useContext, useMemo, useSyncExternalStore, } from 'react';
2
+ const IslandContext = createContext({ container: null });
3
+ const SERVER_THEME = 'light';
4
+ function readTheme(container) {
5
+ if (typeof document === 'undefined')
6
+ return SERVER_THEME;
7
+ const island = container ? (container.closest('[data-mint-island]') ?? container) : null;
8
+ const attr = island?.getAttribute('data-mint-theme') ??
9
+ document.documentElement.getAttribute('data-mint-theme');
10
+ if (attr === 'dark' || attr === 'light')
11
+ return attr;
12
+ return document.documentElement.classList.contains('dark') ? 'dark' : 'light';
13
+ }
14
+ export function useMintTheme() {
15
+ const { container } = useContext(IslandContext);
16
+ const subscribe = useCallback((onChange) => {
17
+ if (typeof MutationObserver === 'undefined' || typeof document === 'undefined') {
18
+ return () => { };
19
+ }
20
+ const observer = new MutationObserver(onChange);
21
+ const options = { attributes: true, attributeFilter: ['data-mint-theme', 'class'] };
22
+ observer.observe(document.documentElement, options);
23
+ const island = container ? (container.closest('[data-mint-island]') ?? container) : null;
24
+ if (island && island !== document.documentElement)
25
+ observer.observe(island, options);
26
+ return () => observer.disconnect();
27
+ }, [container]);
28
+ const getSnapshot = useCallback(() => readTheme(container), [container]);
29
+ return useSyncExternalStore(subscribe, getSnapshot, () => SERVER_THEME);
30
+ }
31
+ export function useIslandContainer() {
32
+ return useContext(IslandContext).container;
33
+ }
34
+ class IslandErrorBoundary extends Component {
35
+ constructor() {
36
+ super(...arguments);
37
+ this.state = { failed: false };
38
+ }
39
+ static getDerivedStateFromError() {
40
+ return { failed: true };
41
+ }
42
+ componentDidCatch(error, _info) {
43
+ this.props.onError?.(error, 'render');
44
+ }
45
+ render() {
46
+ if (this.state.failed) {
47
+ return createElement('div', {
48
+ 'data-mint-island-fallback': '',
49
+ style: { display: 'contents' },
50
+ dangerouslySetInnerHTML: { __html: this.props.serverHtml },
51
+ });
52
+ }
53
+ return this.props.children;
54
+ }
55
+ }
56
+ export function IslandShell({ container, serverHtml, Provider, onError, children, }) {
57
+ const value = useMemo(() => ({ container }), [container]);
58
+ const content = Provider ? createElement(Provider, null, children) : children;
59
+ return createElement(IslandContext.Provider, { value }, createElement(IslandErrorBoundary, { serverHtml, onError }, content));
60
+ }
61
+ export function resolveProvider(mod) {
62
+ if (!mod)
63
+ return undefined;
64
+ const candidate = mod.Provider ?? mod.default;
65
+ return typeof candidate === 'function' || (typeof candidate === 'object' && candidate !== null)
66
+ ? candidate
67
+ : undefined;
68
+ }
@@ -0,0 +1 @@
1
+ export { useMintTheme, useIslandContainer, type MintTheme } from './shell.js';
@@ -0,0 +1 @@
1
+ export { useMintTheme, useIslandContainer } from './shell.js';
@@ -0,0 +1,9 @@
1
+ export declare const MAX_ISLAND_HTML_BYTES: number;
2
+ export declare function decodeEntities(value: string): string;
3
+ export declare function sanitizeHtml(input: string, prefix?: string, renames?: ReadonlyMap<string, string>): string;
4
+ export declare function stateIdRenames(first: string, second: string | undefined, prefix: string): Map<string, string>;
5
+ export declare function sanitizeIslandHtml(input: string, prefix?: string, renames?: ReadonlyMap<string, string>): {
6
+ html?: string;
7
+ tooLarge: boolean;
8
+ bytes: number;
9
+ };