@blinkk/root 3.1.5 → 3.1.6
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/{chunk-AJR6VAT7.js → chunk-45M5ANS7.js} +15 -2
- package/dist/chunk-45M5ANS7.js.map +7 -0
- package/dist/core/types.d.ts +20 -0
- package/dist/jsx/jsx.d.ts +1 -1
- package/dist/jsx/types.d.ts +21 -3
- package/dist/jsx.js +1 -1
- package/dist/render.js +8 -5
- package/dist/render.js.map +2 -2
- package/package.json +1 -1
- package/dist/chunk-AJR6VAT7.js.map +0 -7
|
@@ -116,6 +116,7 @@ var BOOLEAN_ATTRS = /* @__PURE__ */ new Set([
|
|
|
116
116
|
"default",
|
|
117
117
|
"defer",
|
|
118
118
|
"disabled",
|
|
119
|
+
"disablepictureinpicture",
|
|
119
120
|
"disableremoteplayback",
|
|
120
121
|
"download",
|
|
121
122
|
"draggable",
|
|
@@ -137,6 +138,12 @@ var BOOLEAN_ATTRS = /* @__PURE__ */ new Set([
|
|
|
137
138
|
"reversed",
|
|
138
139
|
"selected"
|
|
139
140
|
]);
|
|
141
|
+
var ENUMERATED_ATTR_TRUE_DEFAULTS = Object.assign(
|
|
142
|
+
/* @__PURE__ */ Object.create(null),
|
|
143
|
+
{
|
|
144
|
+
crossorigin: "anonymous"
|
|
145
|
+
}
|
|
146
|
+
);
|
|
140
147
|
var PROP_TO_ATTR = Object.assign(
|
|
141
148
|
/* @__PURE__ */ Object.create(null),
|
|
142
149
|
{
|
|
@@ -151,6 +158,7 @@ var PROP_TO_ATTR = Object.assign(
|
|
|
151
158
|
contentEditable: "contenteditable",
|
|
152
159
|
crossOrigin: "crossorigin",
|
|
153
160
|
dateTime: "datetime",
|
|
161
|
+
disablePictureInPicture: "disablepictureinpicture",
|
|
154
162
|
disableRemotePlayback: "disableremoteplayback",
|
|
155
163
|
encType: "enctype",
|
|
156
164
|
formAction: "formaction",
|
|
@@ -535,7 +543,12 @@ function renderJsxToString(vnode, options) {
|
|
|
535
543
|
} else if (valueType === "number") {
|
|
536
544
|
result += " " + attrName + '="' + value + '"';
|
|
537
545
|
} else if (value === true) {
|
|
538
|
-
|
|
546
|
+
if (BOOLEAN_ATTRS.has(attrName)) {
|
|
547
|
+
result += " " + attrName;
|
|
548
|
+
} else {
|
|
549
|
+
const enumDefault = ENUMERATED_ATTR_TRUE_DEFAULTS[attrName];
|
|
550
|
+
result += enumDefault !== void 0 ? " " + attrName + '="' + enumDefault + '"' : " " + attrName + '="true"';
|
|
551
|
+
}
|
|
539
552
|
} else if (value === false) {
|
|
540
553
|
if (!BOOLEAN_ATTRS.has(attrName)) {
|
|
541
554
|
result += " " + attrName + '="false"';
|
|
@@ -691,4 +704,4 @@ function noop() {
|
|
|
691
704
|
export {
|
|
692
705
|
renderJsxToString
|
|
693
706
|
};
|
|
694
|
-
//# sourceMappingURL=chunk-
|
|
707
|
+
//# sourceMappingURL=chunk-45M5ANS7.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/jsx/jsx-render.ts"],
|
|
4
|
+
"sourcesContent": ["/* eslint-disable n/no-extraneous-import */\nimport {options as preactOptions} from 'preact';\nimport {VNode, Fragment} from './jsx-runtime.js';\n\n/** HTML void elements (self-closing, no end tag). */\nconst VOID_ELEMENTS = new Set([\n 'area',\n 'base',\n 'br',\n 'col',\n 'embed',\n 'hr',\n 'img',\n 'input',\n 'link',\n 'meta',\n 'param',\n 'source',\n 'track',\n 'wbr',\n]);\n\n/** Tags whose text content may contain literal newlines that should not be treated as block-child indicators. */\nconst RAW_CONTENT_ELEMENTS = new Set(['pre', 'textarea', 'script', 'style']);\n\n/**\n * Standard HTML block-level elements. Also includes the `<select>` content\n * model (`select`/`optgroup`/`option`) so that each `<option>` renders on its\n * own line in pretty mode, even though those tags aren't block-level per CSS.\n */\nconst DEFAULT_BLOCK_ELEMENTS = new Set([\n 'address',\n 'article',\n 'aside',\n 'base',\n 'blockquote',\n 'body',\n 'dd',\n 'details',\n 'dialog',\n 'div',\n 'dl',\n 'dt',\n 'fieldset',\n 'figcaption',\n 'figure',\n 'footer',\n 'form',\n 'h1',\n 'h2',\n 'h3',\n 'h4',\n 'h5',\n 'h6',\n 'head',\n 'header',\n 'hgroup',\n 'hr',\n 'html',\n 'li',\n 'link',\n 'main',\n 'meta',\n 'nav',\n 'noscript',\n 'ol',\n 'optgroup',\n 'option',\n 'p',\n 'pre',\n 'script',\n 'search',\n 'section',\n 'select',\n 'style',\n 'summary',\n 'table',\n 'tbody',\n 'td',\n 'tfoot',\n 'th',\n 'thead',\n 'title',\n 'tr',\n 'ul',\n]);\n\n/**\n * Non-visual metadata and resource elements. These produce no inline rendered\n * content, so in pretty mode they always start on their own line \u2014 even inside\n * a parent with mixed text/element children, where the inline heuristic would\n * otherwise keep all siblings on a single line. (`base`/`link`/`meta` are void;\n * `script`/`style`/`title` render no visible text.)\n */\nconst ALWAYS_BLOCK_ELEMENTS = new Set([\n 'base',\n 'link',\n 'meta',\n 'script',\n 'style',\n 'title',\n]);\n\n// Combined per-tag classification flags for the pretty-mode renderer. Each\n// element in `renderElement` needs to know whether a tag is void, an\n// always-block element, a raw-content element, and a default block-level\n// element. These classifications are static (they never depend on render\n// options), so they are precomputed into a single `Map<tag, bitmask>` lookup \u2014\n// one hash probe per element instead of four separate `Set.has` probes. Tags\n// absent from the map (the common inline elements like `span`/`a`/`em`) return\n// `undefined`, treated as flags 0. Runtime-configured block elements\n// (`options.blockElements`) are handled by a separate, usually-absent set so\n// the common path stays a single lookup.\nconst TAG_FLAG_VOID = 1;\nconst TAG_FLAG_ALWAYS_BLOCK = 2;\nconst TAG_FLAG_RAW = 4;\nconst TAG_FLAG_BLOCK = 8;\nconst TAG_STATIC_FLAGS = new Map<string, number>();\nfor (const t of VOID_ELEMENTS) {\n TAG_STATIC_FLAGS.set(t, (TAG_STATIC_FLAGS.get(t) || 0) | TAG_FLAG_VOID);\n}\nfor (const t of ALWAYS_BLOCK_ELEMENTS) {\n TAG_STATIC_FLAGS.set(\n t,\n (TAG_STATIC_FLAGS.get(t) || 0) | TAG_FLAG_ALWAYS_BLOCK\n );\n}\nfor (const t of RAW_CONTENT_ELEMENTS) {\n TAG_STATIC_FLAGS.set(t, (TAG_STATIC_FLAGS.get(t) || 0) | TAG_FLAG_RAW);\n}\nfor (const t of DEFAULT_BLOCK_ELEMENTS) {\n TAG_STATIC_FLAGS.set(t, (TAG_STATIC_FLAGS.get(t) || 0) | TAG_FLAG_BLOCK);\n}\n\n/**\n * HTML/SVG boolean attributes.\n * When present with a truthy value, render as a minimized attribute.\n */\nconst BOOLEAN_ATTRS = new Set([\n 'allowfullscreen',\n 'async',\n 'autofocus',\n 'autoplay',\n 'capture',\n 'checked',\n 'controls',\n 'default',\n 'defer',\n 'disabled',\n 'disablepictureinpicture',\n 'disableremoteplayback',\n 'download',\n 'draggable',\n 'formnovalidate',\n 'hidden',\n 'inert',\n 'ismap',\n 'itemscope',\n 'loop',\n 'multiple',\n 'muted',\n 'nomodule',\n 'novalidate',\n 'open',\n 'playsinline',\n 'popover',\n 'readonly',\n 'required',\n 'reversed',\n 'selected',\n]);\n\n/**\n * Enumerated attributes that have no boolean form. When written as a bare JSX\n * prop (e.g. `<link crossorigin />`, which Preact passes as `true`), rendering\n * `=\"true\"` would be an invalid value, so emit the attribute's spec-defined\n * default instead. For `crossorigin` the missing/invalid-value default is\n * `anonymous`.\n *\n * Keyed by HTML attribute name (post-`PROP_TO_ATTR` remapping). A\n * null-prototype object so the common \"not enumerated\" lookup misses without\n * walking `Object.prototype`.\n */\nconst ENUMERATED_ATTR_TRUE_DEFAULTS: Record<string, string> = Object.assign(\n Object.create(null),\n {\n crossorigin: 'anonymous',\n }\n);\n\n/**\n * JSX prop name -> HTML attribute name.\n *\n * A null-prototype object so that the very common \"no remapping needed\" lookup\n * (`class`, `href`, `id`, `data-*`, `aria-*`, etc., none of which are keys here)\n * misses without walking the `Object.prototype` chain. `renderAttrs` performs\n * one lookup per attribute, so for attribute-heavy trees this is a hot path.\n */\nconst PROP_TO_ATTR: Record<string, string> = Object.assign(\n Object.create(null),\n {\n acceptCharset: 'accept-charset',\n autoCapitalize: 'autocapitalize',\n autoComplete: 'autocomplete',\n autoFocus: 'autofocus',\n autoPlay: 'autoplay',\n charSet: 'charset',\n className: 'class',\n colSpan: 'colspan',\n contentEditable: 'contenteditable',\n crossOrigin: 'crossorigin',\n dateTime: 'datetime',\n disablePictureInPicture: 'disablepictureinpicture',\n disableRemotePlayback: 'disableremoteplayback',\n encType: 'enctype',\n formAction: 'formaction',\n formEncType: 'formenctype',\n formMethod: 'formmethod',\n formNoValidate: 'formnovalidate',\n formTarget: 'formtarget',\n frameBorder: 'frameborder',\n hrefLang: 'hreflang',\n htmlFor: 'for',\n httpEquiv: 'http-equiv',\n inputMode: 'inputmode',\n itemProp: 'itemprop',\n itemRef: 'itemref',\n itemScope: 'itemscope',\n itemType: 'itemtype',\n maxLength: 'maxlength',\n mediaGroup: 'mediagroup',\n minLength: 'minlength',\n noModule: 'nomodule',\n noValidate: 'novalidate',\n playsInline: 'playsinline',\n readOnly: 'readonly',\n referrerPolicy: 'referrerpolicy',\n rowSpan: 'rowspan',\n spellCheck: 'spellcheck',\n srcDoc: 'srcdoc',\n srcLang: 'srclang',\n srcSet: 'srcset',\n tabIndex: 'tabindex',\n useMap: 'usemap',\n\n // SVG presentation attributes (camelCase -> kebab-case).\n clipPath: 'clip-path',\n clipRule: 'clip-rule',\n colorInterpolation: 'color-interpolation',\n colorInterpolationFilters: 'color-interpolation-filters',\n dominantBaseline: 'dominant-baseline',\n fillOpacity: 'fill-opacity',\n fillRule: 'fill-rule',\n floodColor: 'flood-color',\n floodOpacity: 'flood-opacity',\n imageRendering: 'image-rendering',\n letterSpacing: 'letter-spacing',\n lightingColor: 'lighting-color',\n markerEnd: 'marker-end',\n markerMid: 'marker-mid',\n markerStart: 'marker-start',\n paintOrder: 'paint-order',\n pointerEvents: 'pointer-events',\n shapeRendering: 'shape-rendering',\n stopColor: 'stop-color',\n stopOpacity: 'stop-opacity',\n strokeDasharray: 'stroke-dasharray',\n strokeDashoffset: 'stroke-dashoffset',\n strokeLinecap: 'stroke-linecap',\n strokeLinejoin: 'stroke-linejoin',\n strokeMiterlimit: 'stroke-miterlimit',\n strokeOpacity: 'stroke-opacity',\n strokeWidth: 'stroke-width',\n textAnchor: 'text-anchor',\n textDecoration: 'text-decoration',\n textRendering: 'text-rendering',\n transformOrigin: 'transform-origin',\n vectorEffect: 'vector-effect',\n wordSpacing: 'word-spacing',\n writingMode: 'writing-mode',\n }\n);\n\nconst AMP = '&';\nconst LT = '<';\nconst GT = '>';\nconst QUOT = '"';\n\n// Single-pass native prechecks for the common case where a string needs no\n// escaping (most class names, URLs, and text). `RegExp.test` scans in native\n// code, which is substantially faster than the JS `charCodeAt` loop below, so\n// strings that don't match return immediately without entering the loop.\nconst HTML_ESCAPE_RE = /[&<>]/;\nconst ATTR_ESCAPE_RE = /[&<>\"]/;\n\n// Shared empty object reused as the per-component context map when no contexts\n// have ever been pushed. Components only ever read from this map, so sharing is\n// safe and avoids a per-render allocation in the common case.\nconst EMPTY_GLOBAL_CTX: Record<string, any> = {};\n\n/** Returns `true` when `value` is neither `null` nor `undefined`. */\nfunction isDef<T>(value: T | null | undefined): value is T {\n return value !== null && value !== undefined;\n}\n\nfunction escapeHtml(str: string): string {\n if (!HTML_ESCAPE_RE.test(str)) return str;\n let result = '';\n let last = 0;\n for (let i = 0; i < str.length; i++) {\n const ch = str.charCodeAt(i);\n let escaped: string | undefined;\n if (ch === 38) escaped = AMP;\n else if (ch === 60) escaped = LT;\n else if (ch === 62) escaped = GT;\n if (escaped) {\n result += str.slice(last, i) + escaped;\n last = i + 1;\n }\n }\n return result + str.slice(last);\n}\n\nfunction escapeAttr(str: string): string {\n if (!ATTR_ESCAPE_RE.test(str)) return str;\n let result = '';\n let last = 0;\n for (let i = 0; i < str.length; i++) {\n const ch = str.charCodeAt(i);\n let escaped: string | undefined;\n if (ch === 38) escaped = AMP;\n else if (ch === 34) escaped = QUOT;\n else if (ch === 60) escaped = LT;\n else if (ch === 62) escaped = GT;\n if (escaped) {\n result += str.slice(last, i) + escaped;\n last = i + 1;\n }\n }\n return result + str.slice(last);\n}\n\nconst STYLE_KEY_CACHE = new Map<string, string>();\nconst UPPERCASE_RE = /[A-Z]/g;\n\nfunction toKebabCase(key: string): string {\n let cached = STYLE_KEY_CACHE.get(key);\n if (cached === undefined) {\n cached = key.replace(UPPERCASE_RE, (m) => '-' + m.toLowerCase());\n STYLE_KEY_CACHE.set(key, cached);\n }\n return cached;\n}\n\nfunction styleToString(style: Record<string, any>): string {\n let result = '';\n let first = true;\n for (const key in style) {\n const value = style[key];\n if (!isDef(value) || value === '') continue;\n if (first) {\n first = false;\n } else {\n result += ';';\n }\n result += `${toKebabCase(key)}:${value}`;\n }\n return result;\n}\n\n/**\n * JSX render mode. `'pretty'` adds newlines around block elements; `'minimal'`\n * outputs compact HTML.\n */\nexport type JsxRenderMode = 'pretty' | 'minimal';\n\nexport interface JsxRenderOptions {\n /** Render mode. `'pretty'` adds newlines around block elements; `'minimal'` outputs compact HTML. Default: `'pretty'`. */\n mode?: JsxRenderMode;\n /** Additional tag names to treat as block-level elements in pretty mode. */\n blockElements?: string[];\n}\n\n/**\n * Renders a Preact VNode tree to an HTML string.\n */\nexport function renderJsxToString(\n vnode: VNode,\n options?: JsxRenderOptions\n): string {\n const mode = options?.mode ?? 'pretty';\n const isPretty = mode === 'pretty';\n // Default block-level elements are baked into the module-level\n // `TAG_STATIC_FLAGS` map (the `TAG_FLAG_BLOCK` bit), so the common case needs\n // no per-render set. Only when the caller supplies extra `blockElements` do we\n // build a small `customBlockSet` of just those additions; `renderElement`\n // consults it via a cheap \"is it defined?\" guard that is `undefined` (and so\n // skipped) in the common case.\n let customBlockSet: Set<string> | undefined;\n if (isPretty && options?.blockElements && options.blockElements.length > 0) {\n customBlockSet = new Set<string>();\n for (const el of options.blockElements) {\n // Only track elements that aren't already default block elements, so the\n // set stays empty (and the guard stays cheap) for redundant config.\n if (!DEFAULT_BLOCK_ELEMENTS.has(el)) {\n customBlockSet.add(el);\n }\n }\n if (customBlockSet.size === 0) {\n customBlockSet = undefined;\n }\n }\n\n // Context stacks: context.__c (id) -> value[]\n let contextStacks: Map<string, any[]> | undefined;\n\n // Version counter that bumps whenever a context value is pushed or popped.\n // `buildGlobalContext` uses it to skip rebuilding when nothing changed\n // between sibling component renders (the common case).\n let ctxVersion = 0;\n let cachedGlobalCtx: Record<string, any> = EMPTY_GLOBAL_CTX;\n let cachedGlobalCtxVersion = 0;\n\n // Side-channel reporting whether the most recently returned render string\n // contains a newline. Pretty mode uses this to decide whether a block\n // element's children start on their own line, instead of re-scanning the\n // element's concatenated inner HTML via `inner.includes('\\n')`. Because block\n // elements nest, that rescan walked the same characters once per enclosing\n // block level (O(html_size * block_depth)); threading the flag up makes it a\n // single pass. This is safe because rendering is fully synchronous and\n // single-pass: every code path assigns `nlFlag` before returning, and each\n // caller reads it immediately after the call, before the next call can\n // overwrite it. It is only meaningful in pretty mode; in minimal mode the\n // leaf scans are skipped and the value is never read.\n let nlFlag = false;\n\n function pushCtx(contextId: string, value: any) {\n if (!contextStacks) {\n contextStacks = new Map<string, any[]>();\n }\n let stack = contextStacks.get(contextId);\n if (!stack) {\n stack = [];\n contextStacks.set(contextId, stack);\n }\n stack.push(value);\n ctxVersion++;\n }\n\n function popCtx(contextId: string) {\n const stack = contextStacks?.get(contextId);\n if (stack) {\n stack.pop();\n if (stack.length === 0) {\n contextStacks?.delete(contextId);\n }\n }\n ctxVersion++;\n }\n\n /** Builds the __n (global context) map for hooks. */\n function buildGlobalContext(): Record<string, any> {\n if (ctxVersion === cachedGlobalCtxVersion) return cachedGlobalCtx;\n if (!contextStacks || contextStacks.size === 0) {\n cachedGlobalCtx = EMPTY_GLOBAL_CTX;\n cachedGlobalCtxVersion = ctxVersion;\n return cachedGlobalCtx;\n }\n const globalCtx: Record<string, any> = {};\n for (const [contextId, stack] of contextStacks) {\n if (stack.length > 0) {\n // useContext expects provider.props.value and provider.sub().\n globalCtx[contextId] = {\n props: {value: stack[stack.length - 1]},\n sub: noop,\n };\n }\n }\n cachedGlobalCtx = globalCtx;\n cachedGlobalCtxVersion = ctxVersion;\n return globalCtx;\n }\n\n function render(node: any, inline?: boolean): string {\n const t = typeof node;\n if (t === 'string') {\n // escapeHtml only replaces &<>, so it never adds or removes newlines; the\n // raw text's newline status is preserved. Each text node is scanned once\n // here, never re-walked by ancestors. (`render` is only reached in pretty\n // mode \u2014 minimal mode uses `mRender` \u2014 so the scan always applies.)\n nlFlag = node.indexOf('\\n') >= 0;\n return escapeHtml(node);\n }\n if (t === 'object') {\n if (node === null) {\n nlFlag = false;\n return '';\n }\n if (Array.isArray(node)) {\n let out = '';\n let anyNewline = false;\n for (let i = 0; i < node.length; i++) {\n const child = node[i];\n // Inline the string leaf (the most common array entry) to skip a\n // recursive `render` dispatch. This mirrors the string branch above\n // exactly: escape the text and record whether it contains a newline.\n if (typeof child === 'string') {\n out += escapeHtml(child);\n anyNewline = anyNewline || child.indexOf('\\n') >= 0;\n } else {\n out += render(child, inline);\n anyNewline = anyNewline || nlFlag;\n }\n }\n nlFlag = anyNewline;\n return out;\n }\n // Must be a VNode-like object.\n if (!('type' in node)) {\n nlFlag = false;\n return '';\n }\n const type = node.type;\n // HTML element (the most common VNode shape).\n if (typeof type === 'string') {\n return renderElement(type, node.props, inline);\n }\n // Fragment.\n if (type === Fragment) {\n return renderChildren(node.props ? node.props.children : undefined);\n }\n // Component (function or class).\n if (typeof type === 'function') {\n return renderComponent(node);\n }\n return '';\n }\n if (t === 'number' || t === 'bigint') {\n nlFlag = false;\n return String(node);\n }\n // boolean, undefined, function, symbol: render to nothing.\n nlFlag = false;\n return '';\n }\n\n function renderComponent(vnode: VNode): string {\n const {type, props} = vnode;\n const fn = type as Function;\n\n // Detect context Provider.\n // Root.js local JSX runtime: Provider._isProvider === true, Provider._context\n // is the Context object with a _stack array.\n // Preact >=10.27: Provider === Context (same function). `fn.__c` is the\n // context id string (e.g. \"__cC0\").\n // Preact <10.27: Provider._contextRef (mangled `fn.__`) points to the\n // context object which has `__c` (id) and `__` (default value).\n const fnAny = fn as any;\n if (fnAny._isProvider && fnAny._context) {\n const ctx = fnAny._context;\n ctx._stack.push((props as any).value);\n const result = activeChildren(props.children);\n ctx._stack.pop();\n return result;\n }\n let contextId: string | undefined;\n if (typeof fnAny.__c === 'string' && fnAny.__c.startsWith('__cC')) {\n contextId = fnAny.__c;\n } else if (fnAny.__ && typeof fnAny.__ === 'object' && fnAny.__.__c) {\n contextId = fnAny.__.__c;\n }\n if (contextId) {\n pushCtx(contextId, (props as any).value);\n const result = activeChildren(props.children);\n popCtx(contextId);\n return result;\n }\n\n // Detect context Consumer.\n if ((fn as any).contextType) {\n const ctx = (fn as any).contextType;\n const ctxId: string = ctx.__c;\n const stack = contextStacks?.get(ctxId);\n const value =\n stack && stack.length > 0 ? stack[stack.length - 1] : ctx.__;\n if (typeof props.children === 'function') {\n return activeRender(props.children(value));\n }\n return activeChildren(props.children);\n }\n\n // Regular component \u2014 set up a fake component instance so Preact hooks\n // (useContext, useState, useMemo, etc.) work during SSR.\n // Preact's useContext reads from `component.context[context.__c]`.\n const component: any = {\n props,\n context: buildGlobalContext(),\n state: {},\n __v: vnode, // _vnode\n __d: false, // _dirty\n __h: [], // _renderCallbacks\n __s: {}, // _nextState\n __H: null, // _hooks (initialised by hooks addon)\n };\n (vnode as any).__c = component;\n\n // Trigger Preact option hooks so the hooks addon can set currentComponent.\n (preactOptions as any).__b?.(vnode);\n (preactOptions as any).__r?.(vnode);\n\n try {\n // Class component.\n if (fn.prototype && fn.prototype.render) {\n const instance = new (fn as any)(props, component.context);\n instance.__n = component.__n;\n instance.__H = component.__H;\n (vnode as any).__c = instance;\n (preactOptions as any).__r?.(vnode);\n return activeRender(instance.render(instance.props, instance.state));\n }\n\n // Functional component.\n const rendered = fn(props, component.context);\n return activeRender(rendered);\n } finally {\n preactOptions.diffed?.(vnode as any);\n }\n }\n\n function renderElement(\n tag: string,\n props: Record<string, any>,\n inline?: boolean\n ): string {\n // One combined lookup for the static (void / always-block / raw-content /\n // default-block) classifications, instead of separate `Set.has` probes.\n // Inline elements (span/a/em/strong/\u2026) miss the map entirely and resolve\n // to 0.\n const flags = TAG_STATIC_FLAGS.get(tag) || 0;\n // Metadata/resource elements always break onto their own line, even within\n // mixed (text + element) content where the inline heuristic applies, since\n // they render no inline visual output. (`renderElement` is only reached in\n // pretty mode \u2014 minimal mode uses `mElement` \u2014 so the block logic always\n // applies; no `isPretty` guard needed.) `customBlockSet` is consulted only\n // for runtime-configured block elements and is `undefined` (skipped) in the\n // common case.\n const isBlock =\n (flags & TAG_FLAG_ALWAYS_BLOCK) !== 0 ||\n (!inline &&\n ((flags & TAG_FLAG_BLOCK) !== 0 ||\n (customBlockSet !== undefined && customBlockSet.has(tag))));\n const attrs = renderAttrs(tag, props);\n const openTag = '<' + tag + attrs + '>';\n\n if ((flags & TAG_FLAG_VOID) !== 0) {\n if (isBlock) {\n nlFlag = true;\n return openTag + '\\n';\n }\n nlFlag = false;\n return openTag;\n }\n\n let inner = '';\n // Whether `inner` contains a newline. For the children path this is read\n // from `nlFlag` (threaded up from the recursive render, no rescan). For the\n // raw-HTML and textarea leaf paths the string is scanned once here.\n let innerHasNewline = false;\n if (props) {\n const dsih = props.dangerouslySetInnerHTML;\n if (dsih && dsih.__html != null) {\n inner = dsih.__html;\n innerHasNewline = inner.includes('\\n');\n } else if (props.children != null) {\n const children = props.children;\n // Inline the single string child (e.g. `<h3>Title</h3>`) \u2014 the most\n // common element body \u2014 to skip a `renderChildren`/`render` dispatch.\n // Mirrors the string branch of `render`.\n if (typeof children === 'string') {\n inner = escapeHtml(children);\n innerHasNewline = children.indexOf('\\n') >= 0;\n } else {\n inner = renderChildren(children);\n innerHasNewline = nlFlag;\n }\n } else if (tag === 'textarea') {\n // For <textarea>, render value/defaultValue as text content since\n // browsers ignore the value attribute on textarea elements.\n const textVal = props.value ?? props.defaultValue;\n if (textVal != null) {\n inner = escapeHtml(String(textVal));\n innerHasNewline = inner.includes('\\n');\n }\n }\n }\n\n if (isBlock) {\n // Block elements always end with a trailing newline.\n nlFlag = true;\n // When inner content contains block children (indicated by newlines),\n // add a newline after the opening tag so content starts on its own line.\n // Exempt raw-content elements (pre, textarea, script, style) where\n // newlines are literal text, not block-child indicators.\n const hasBlockChildren = (flags & TAG_FLAG_RAW) === 0 && innerHasNewline;\n if (hasBlockChildren) {\n return openTag + '\\n' + inner + '</' + tag + '>\\n';\n }\n return openTag + inner + '</' + tag + '>\\n';\n }\n // Opening/closing tags add no newlines, so the element's newline status is\n // exactly that of its inner content.\n nlFlag = innerHasNewline;\n return openTag + inner + '</' + tag + '>';\n }\n\n function renderAttrs(tag: string, props: Record<string, any>): string {\n if (!props) return '';\n const isTextarea = tag === 'textarea';\n let result = '';\n for (const key in props) {\n const value = props[key];\n // `null`/`undefined` props produce no attribute. Checking this first\n // short-circuits absent optional attributes immediately, before the\n // reserved-key string comparisons.\n if (value == null) continue;\n if (\n key === 'children' ||\n key === 'dangerouslySetInnerHTML' ||\n key === 'key' ||\n key === 'ref' ||\n key === '__self' ||\n key === '__source'\n ) {\n continue;\n }\n // Skip value/defaultValue on textarea \u2014 rendered as text content.\n if (isTextarea && (key === 'value' || key === 'defaultValue')) {\n continue;\n }\n\n const attrName = PROP_TO_ATTR[key] || key;\n const valueType = typeof value;\n\n // Dispatch ordered by frequency: string and numeric attribute values are\n // by far the most common, so they are matched first.\n if (valueType === 'string') {\n result += ' ' + attrName + '=\"' + escapeAttr(value) + '\"';\n } else if (valueType === 'number') {\n // A stringified number never contains characters that require HTML\n // escaping, so skip `escapeAttr` entirely.\n result += ' ' + attrName + '=\"' + value + '\"';\n } else if (value === true) {\n // Boolean HTML attributes minimize to a bare attribute when `true`.\n // Enumerated attributes with no boolean form (e.g. crossorigin) render\n // their spec default rather than the invalid `=\"true\"`. Everything else\n // is stringified (e.g. id=\"true\").\n if (BOOLEAN_ATTRS.has(attrName)) {\n result += ' ' + attrName;\n } else {\n const enumDefault = ENUMERATED_ATTR_TRUE_DEFAULTS[attrName];\n result +=\n enumDefault !== undefined\n ? ' ' + attrName + '=\"' + enumDefault + '\"'\n : ' ' + attrName + '=\"true\"';\n }\n } else if (value === false) {\n // Boolean HTML attributes are removed when `false`; other attributes\n // are stringified (e.g. data-foo=\"false\").\n if (!BOOLEAN_ATTRS.has(attrName)) {\n result += ' ' + attrName + '=\"false\"';\n }\n } else if (valueType === 'function') {\n // Skip function-valued props such as event handlers (e.g.\n // onClick={fn}): client-side handler functions can't be serialized to\n // HTML. String-valued inline handlers (e.g. <select onChange=\"...\">)\n // are preserved by the string branch above.\n continue;\n } else if (key === 'style' && valueType === 'object') {\n // Style objects serialize to a CSS string; an empty result is omitted.\n const styleStr = styleToString(value);\n if (styleStr) {\n result += ' ' + attrName + '=\"' + escapeAttr(styleStr) + '\"';\n }\n } else {\n result += ' ' + attrName + '=\"' + escapeAttr(String(value)) + '\"';\n }\n }\n return result;\n }\n\n /**\n * Checks if an array of children contains a mix of text nodes and elements.\n * When mixed, block elements should render inline to avoid breaking text flow.\n * The per-child type checks are inlined (rather than calling `isTextNode`)\n * because this scans every child of every element in pretty mode.\n */\n function hasMixedContent(children: any[]): boolean {\n let hasText = false;\n let hasElement = false;\n for (let i = 0; i < children.length; i++) {\n const child = children[i];\n const t = typeof child;\n if (t === 'string' || t === 'number' || t === 'bigint') {\n hasText = true;\n } else if (t === 'object' && child !== null && 'type' in child) {\n hasElement = true;\n }\n if (hasText && hasElement) return true;\n }\n return false;\n }\n\n function renderChildren(children: any): string {\n if (children == null) {\n nlFlag = false;\n return '';\n }\n if (Array.isArray(children)) {\n // `renderChildren` is only reached in pretty mode (minimal uses\n // `mChildren`), so the mixed-content scan always applies.\n const inline = hasMixedContent(children);\n let out = '';\n let anyNewline = false;\n for (let i = 0; i < children.length; i++) {\n const child = children[i];\n // Inline the string leaf to skip a recursive `render` dispatch (mirrors\n // the string branch of `render`).\n if (typeof child === 'string') {\n out += escapeHtml(child);\n anyNewline = anyNewline || child.indexOf('\\n') >= 0;\n } else {\n out += render(child, inline);\n anyNewline = anyNewline || nlFlag;\n }\n }\n nlFlag = anyNewline;\n return out;\n }\n return render(children);\n }\n\n // ---------------------------------------------------------------------------\n // Minimal-mode fast path.\n //\n // Minimal mode emits compact HTML with no formatting, so it needs none of the\n // pretty-mode bookkeeping that `render`/`renderChildren`/`renderElement`\n // carry: the `nlFlag` newline side-channel, the `inline` parameter,\n // block-element detection, and the mixed-content scan. These dedicated\n // functions drop all of it, which removes those closure reads/writes and\n // branches from the hottest traversal loop. Each accumulates into a local\n // string and returns it (locals beat a shared closure-level buffer, and V8\n // represents the `+` concatenations as cheap rope/cons strings that flatten\n // once at the end). Output is byte-identical to the unified path in minimal\n // mode; the test suite asserts this across all element/attribute shapes.\n //\n // `renderComponent` is shared between modes via the `activeRender` /\n // `activeChildren` indirection assigned below: in minimal mode a component's\n // rendered subtree continues down `mRender`/`mChildren`, in pretty mode down\n // `render`/`renderChildren`.\n // ---------------------------------------------------------------------------\n\n function mRender(node: any): string {\n const t = typeof node;\n if (t === 'string') {\n return escapeHtml(node);\n }\n if (t === 'object') {\n if (node === null) {\n return '';\n }\n if (Array.isArray(node)) {\n let out = '';\n for (let i = 0; i < node.length; i++) {\n const child = node[i];\n // Inline the string leaf (the most common array entry) to skip a\n // recursive `mRender` dispatch; `mRender('...')` is exactly\n // `escapeHtml('...')`.\n out += typeof child === 'string' ? escapeHtml(child) : mRender(child);\n }\n return out;\n }\n if (!('type' in node)) {\n return '';\n }\n const type = node.type;\n if (typeof type === 'string') {\n return mElement(type, node.props);\n }\n if (type === Fragment) {\n return mChildren(node.props ? node.props.children : undefined);\n }\n if (typeof type === 'function') {\n return renderComponent(node);\n }\n return '';\n }\n if (t === 'number' || t === 'bigint') {\n return String(node);\n }\n return '';\n }\n\n function mElement(tag: string, props: Record<string, any>): string {\n const attrs = renderAttrs(tag, props);\n if (VOID_ELEMENTS.has(tag)) {\n return '<' + tag + attrs + '>';\n }\n let inner = '';\n if (props) {\n const dsih = props.dangerouslySetInnerHTML;\n if (dsih && dsih.__html != null) {\n inner = dsih.__html;\n } else {\n const children = props.children;\n if (children != null) {\n // Inline the single string child (e.g. `<h3>Title</h3>`,\n // `<li>Tag</li>`) \u2014 the most common element body \u2014 so it skips a\n // `mChildren` call; `mChildren('...')` is exactly `escapeHtml('...')`.\n inner =\n typeof children === 'string'\n ? escapeHtml(children)\n : mChildren(children);\n } else if (tag === 'textarea') {\n // For <textarea>, render value/defaultValue as text content since\n // browsers ignore the value attribute on textarea elements.\n const textVal = props.value ?? props.defaultValue;\n if (textVal != null) {\n inner = escapeHtml(String(textVal));\n }\n }\n }\n }\n // Single multi-operand concatenation: V8 sizes and fills one flat string\n // rather than allocating a separate `open` intermediate first.\n return '<' + tag + attrs + '>' + inner + '</' + tag + '>';\n }\n\n function mChildren(children: any): string {\n if (children == null) {\n return '';\n }\n if (Array.isArray(children)) {\n let out = '';\n for (let i = 0; i < children.length; i++) {\n const child = children[i];\n const t = typeof child;\n // Inline the two most common child shapes (text leaf and host element)\n // so they skip the general `mRender` type-dispatch. These mirror\n // `mRender` exactly: a string renders as `escapeHtml`, and an object\n // whose `type` is a string is a host element rendered via `mElement`.\n if (t === 'string') {\n out += escapeHtml(child);\n } else if (\n t === 'object' &&\n child !== null &&\n typeof child.type === 'string'\n ) {\n out += mElement(child.type, child.props);\n } else {\n out += mRender(child);\n }\n }\n return out;\n }\n // Single (non-array) child. Inline the same two common shapes so a\n // single-child chain (e.g. deeply nested `<div><div>\u2026`) skips a `mRender`\n // dispatch at every level.\n const t = typeof children;\n if (t === 'string') {\n return escapeHtml(children);\n }\n if (\n t === 'object' &&\n children !== null &&\n typeof children.type === 'string'\n ) {\n return mElement(children.type, children.props);\n }\n return mRender(children);\n }\n\n // Select the active recursion functions once per render. Minimal mode uses\n // the lean `mRender`/`mChildren` fast path above; pretty mode uses the\n // newline-tracking `render`/`renderChildren`. `renderComponent` and the\n // context Consumer path call through these so component subtrees stay on the\n // correct path.\n const activeRender = isPretty ? render : mRender;\n const activeChildren = isPretty ? renderChildren : mChildren;\n return activeRender(vnode);\n}\n\nfunction noop() {}\n"],
|
|
5
|
+
"mappings": ";;;;;AACA,SAAQ,WAAW,qBAAoB;AAIvC,IAAM,gBAAgB,oBAAI,IAAI;AAAA,EAC5B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAGD,IAAM,uBAAuB,oBAAI,IAAI,CAAC,OAAO,YAAY,UAAU,OAAO,CAAC;AAO3E,IAAM,yBAAyB,oBAAI,IAAI;AAAA,EACrC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AASD,IAAM,wBAAwB,oBAAI,IAAI;AAAA,EACpC;AAAA,EACA;AAAA,EACA;AA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AAA,QACzC,OAAO;AACL,iBAAO,QAAQ,KAAK;AAAA,QACtB;AAAA,MACF;AACA,aAAO;AAAA,IACT;AAIA,UAAM,IAAI,OAAO;AACjB,QAAI,MAAM,UAAU;AAClB,aAAO,WAAW,QAAQ;AAAA,IAC5B;AACA,QACE,MAAM,YACN,aAAa,QACb,OAAO,SAAS,SAAS,UACzB;AACA,aAAO,SAAS,SAAS,MAAM,SAAS,KAAK;AAAA,IAC/C;AACA,WAAO,QAAQ,QAAQ;AAAA,EACzB;AAOA,QAAM,eAAe,WAAW,SAAS;AACzC,QAAM,iBAAiB,WAAW,iBAAiB;AACnD,SAAO,aAAa,KAAK;AAC3B;AAEA,SAAS,OAAO;AAAC;",
|
|
6
|
+
"names": ["vnode", "t"]
|
|
7
|
+
}
|
package/dist/core/types.d.ts
CHANGED
|
@@ -72,6 +72,12 @@ export type Request = ExpressRequest & {
|
|
|
72
72
|
/** Logged in user for the request. */
|
|
73
73
|
user?: {
|
|
74
74
|
email: string;
|
|
75
|
+
/**
|
|
76
|
+
* The user's role, when provided by an auth plugin (e.g. Root CMS sets
|
|
77
|
+
* this to `'ADMIN' | 'EDITOR' | 'CONTRIBUTOR' | 'VIEWER'`, or `null` when
|
|
78
|
+
* the user has no assigned role).
|
|
79
|
+
*/
|
|
80
|
+
role?: string | null;
|
|
75
81
|
};
|
|
76
82
|
/**
|
|
77
83
|
* Handler context, provided to route files that export a custom `handler()`
|
|
@@ -150,12 +156,26 @@ export interface StaticContentResult {
|
|
|
150
156
|
* value is passed which includes the `rootConfig` and route param values.
|
|
151
157
|
*/
|
|
152
158
|
export type GetStaticContent = (props: any) => Promise<StaticContentResult | string> | StaticContentResult | string;
|
|
159
|
+
/**
|
|
160
|
+
* Route-level config that a route module can export to override the site-wide
|
|
161
|
+
* serving behavior on a per-route basis.
|
|
162
|
+
*/
|
|
163
|
+
export interface RouteConfig {
|
|
164
|
+
/**
|
|
165
|
+
* Overrides the site-wide `i18n.locales` for this route. When set, the SSG
|
|
166
|
+
* build only generates localized paths for the locales listed here instead of
|
|
167
|
+
* the locales defined in `root.config.ts`. The default-locale path is always
|
|
168
|
+
* generated. Defaults to the site-wide `i18n.locales`.
|
|
169
|
+
*/
|
|
170
|
+
locales?: string[];
|
|
171
|
+
}
|
|
153
172
|
export interface RouteModule {
|
|
154
173
|
default?: ComponentType<unknown>;
|
|
155
174
|
getStaticPaths?: GetStaticPaths;
|
|
156
175
|
getStaticProps?: GetStaticProps;
|
|
157
176
|
handle?: Handler;
|
|
158
177
|
getStaticContent?: GetStaticContent;
|
|
178
|
+
config?: RouteConfig;
|
|
159
179
|
}
|
|
160
180
|
export interface Route {
|
|
161
181
|
/** The relative path to the route file, e.g. `routes/index.tsx`. */
|
package/dist/jsx/jsx.d.ts
CHANGED
|
@@ -33,5 +33,5 @@
|
|
|
33
33
|
export { jsx, jsxs, Fragment, createElement, h, options, createContext, useContext, } from './jsx-runtime.js';
|
|
34
34
|
export type { VNode, ComponentChildren, ComponentChild, ComponentType, FunctionalComponent, Context, Key, } from './jsx-runtime.js';
|
|
35
35
|
export { renderJsxToString } from './jsx-render.js';
|
|
36
|
-
export type { HTMLAttributes, SVGAttributes, ScriptHTMLAttributes, DOMAttributes, AriaAttributes, } from './types.js';
|
|
36
|
+
export type { HTMLAttributes, SVGAttributes, ScriptHTMLAttributes, DOMAttributes, AriaAttributes, CSSProperties, } from './types.js';
|
|
37
37
|
export type { JSX } from './types.js';
|
package/dist/jsx/types.d.ts
CHANGED
|
@@ -54,6 +54,24 @@ export interface DOMAttributes {
|
|
|
54
54
|
onError?: EventHandler;
|
|
55
55
|
}
|
|
56
56
|
type EventHandler = string | ((...args: any[]) => void);
|
|
57
|
+
/**
|
|
58
|
+
* The camelCase CSS property names recognized by the DOM, derived from the
|
|
59
|
+
* string-valued members of lib.dom's `CSSStyleDeclaration` (e.g.
|
|
60
|
+
* `backgroundColor`, `alignItems`, `cssFloat`). The numeric index signature,
|
|
61
|
+
* `length`, `parentRule`, and method members are filtered out.
|
|
62
|
+
*/
|
|
63
|
+
type CSSPropertyName = {
|
|
64
|
+
[K in keyof CSSStyleDeclaration]: K extends string ? CSSStyleDeclaration[K] extends string ? K : never : never;
|
|
65
|
+
}[keyof CSSStyleDeclaration];
|
|
66
|
+
/**
|
|
67
|
+
* Typed CSS style object accepted by the `style` prop. Each known CSS property
|
|
68
|
+
* maps to a `string` or `number` (a number is emitted verbatim, matching the
|
|
69
|
+
* renderer's `styleToString`), and CSS custom properties (`--my-var`) are also
|
|
70
|
+
* permitted.
|
|
71
|
+
*/
|
|
72
|
+
export interface CSSProperties extends Partial<Record<CSSPropertyName, string | number>> {
|
|
73
|
+
[key: `--${string}`]: string | number | undefined;
|
|
74
|
+
}
|
|
57
75
|
export interface AriaAttributes {
|
|
58
76
|
role?: string;
|
|
59
77
|
'aria-activedescendant'?: string;
|
|
@@ -143,7 +161,7 @@ export interface HTMLAttributes<T = HTMLElement> extends DOMAttributes, AriaAttr
|
|
|
143
161
|
controls?: boolean;
|
|
144
162
|
controlsList?: string;
|
|
145
163
|
coords?: string;
|
|
146
|
-
crossOrigin?: string;
|
|
164
|
+
crossOrigin?: boolean | 'anonymous' | 'use-credentials' | (string & {});
|
|
147
165
|
data?: string;
|
|
148
166
|
dateTime?: string;
|
|
149
167
|
default?: boolean;
|
|
@@ -236,7 +254,7 @@ export interface HTMLAttributes<T = HTMLElement> extends DOMAttributes, AriaAttr
|
|
|
236
254
|
srcSet?: string;
|
|
237
255
|
start?: number;
|
|
238
256
|
step?: number | string;
|
|
239
|
-
style?: string |
|
|
257
|
+
style?: string | CSSProperties;
|
|
240
258
|
summary?: string;
|
|
241
259
|
tabIndex?: number;
|
|
242
260
|
target?: string;
|
|
@@ -369,7 +387,7 @@ export interface SVGAttributes<T = SVGElement> extends HTMLAttributes<T> {
|
|
|
369
387
|
*/
|
|
370
388
|
export interface ScriptHTMLAttributes<T = HTMLScriptElement> extends HTMLAttributes<T> {
|
|
371
389
|
async?: boolean;
|
|
372
|
-
crossOrigin?: string;
|
|
390
|
+
crossOrigin?: boolean | 'anonymous' | 'use-credentials' | (string & {});
|
|
373
391
|
defer?: boolean;
|
|
374
392
|
integrity?: string;
|
|
375
393
|
noModule?: boolean;
|
package/dist/jsx.js
CHANGED
package/dist/render.js
CHANGED
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
} from "./chunk-3PWR4F2R.js";
|
|
16
16
|
import {
|
|
17
17
|
renderJsxToString
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-45M5ANS7.js";
|
|
19
19
|
import "./chunk-3Z5TNZEP.js";
|
|
20
20
|
import {
|
|
21
21
|
getSecurityConfig,
|
|
@@ -12934,21 +12934,23 @@ var Router = class {
|
|
|
12934
12934
|
};
|
|
12935
12935
|
const routePath = formatUrl(urlFormat);
|
|
12936
12936
|
const localeRoutePath = formatUrl(i18nUrlFormat);
|
|
12937
|
+
const routeModule = ROUTES_FILES[modulePath];
|
|
12937
12938
|
trie.add(routePath, {
|
|
12938
12939
|
src,
|
|
12939
|
-
module:
|
|
12940
|
+
module: routeModule,
|
|
12940
12941
|
locale: defaultLocale,
|
|
12941
12942
|
isDefaultLocale: true,
|
|
12942
12943
|
routePath,
|
|
12943
12944
|
localeRoutePath
|
|
12944
12945
|
});
|
|
12946
|
+
const routeLocales = routeModule.config?.locales || locales;
|
|
12945
12947
|
if (i18nUrlFormat.includes("[locale]")) {
|
|
12946
|
-
|
|
12948
|
+
routeLocales.forEach((locale) => {
|
|
12947
12949
|
const localePath = localeRoutePath.replace("[locale]", locale);
|
|
12948
12950
|
if (localePath !== relativeRoutePath) {
|
|
12949
12951
|
trie.add(localePath, {
|
|
12950
12952
|
src,
|
|
12951
|
-
module:
|
|
12953
|
+
module: routeModule,
|
|
12952
12954
|
locale,
|
|
12953
12955
|
isDefaultLocale: false,
|
|
12954
12956
|
routePath,
|
|
@@ -12974,8 +12976,9 @@ var Router = class {
|
|
|
12974
12976
|
localeRoutePath: normalizedLocaleRoutePath,
|
|
12975
12977
|
podName: entry.podName
|
|
12976
12978
|
});
|
|
12979
|
+
const podRouteLocales = entry.module.config?.locales || locales;
|
|
12977
12980
|
if (i18nUrlFormat.includes("[locale]")) {
|
|
12978
|
-
|
|
12981
|
+
podRouteLocales.forEach((locale) => {
|
|
12979
12982
|
const localePath = normalizedLocaleRoutePath.replace(
|
|
12980
12983
|
"[locale]",
|
|
12981
12984
|
locale
|