@viveeditor/sanitize 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +24 -2
- package/dist/index.d.mts +73 -0
- package/dist/index.mjs +996 -0
- package/dist/index.mjs.map +1 -0
- package/dist/profile.json +352 -0
- package/package.json +63 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["profileJson","limits","tree","tree"],"sources":["../src/profile.json","../src/profile.ts","../src/values.ts","../src/embed.ts","../src/guard.ts","../src/sanitize.ts"],"sourcesContent":["","import profileJson from './profile.json' with { type: 'json' }\n\nexport interface ElementRule {\n readonly attributes?: readonly string[]\n readonly styles?: readonly string[]\n}\n\nexport interface EmbedProviderRule {\n readonly label: string\n readonly host: string\n readonly width: number\n readonly height: number\n readonly compactHeight?: number\n readonly compactTypes?: readonly string[]\n readonly fluid: boolean\n readonly sandbox: string\n readonly allow: string\n}\n\nexport interface SanitizeProfile {\n readonly version: number\n readonly limits: {\n readonly maxBytes: number\n readonly maxDepth: number\n readonly maxAttributeLength: number\n readonly maxImageSrcLength: number\n readonly maxUrlLength: number\n readonly maxTextAttributeLength: number\n readonly maxStyleValueLength: number\n readonly maxSpan: number\n readonly maxImageSize: number\n readonly maxListStart: number\n readonly maxTableWidth: number\n readonly maxEmbedStart: number\n readonly maxEmbedTitle: number\n readonly maxMentionId: number\n readonly maxMentionLabel: number\n readonly maxMathLength: number\n readonly maxMathDepth: number\n readonly maxFootnoteLength: number\n readonly maxAttributes: number\n readonly maxNesting: number\n readonly maxExtraElements: number\n }\n readonly dropWithContent: readonly string[]\n readonly elements: Readonly<Record<string, ElementRule>>\n readonly mentionClass: string\n readonly footnoteElements: readonly string[]\n readonly textAlign: readonly string[]\n readonly linkProtocols: readonly string[]\n readonly linkRel: string\n readonly image: {\n readonly loading: string\n readonly decoding: string\n readonly referrerpolicy: string\n readonly base64Types: readonly string[]\n }\n readonly embedProviders: Readonly<Record<string, EmbedProviderRule>>\n readonly spotifyTypes: readonly string[]\n readonly colorKeywordsRejected: readonly string[]\n readonly namedColors: readonly string[]\n}\n\nexport const VIVE_PROFILE: SanitizeProfile = profileJson\n","import { VIVE_PROFILE } from './profile.js'\n\nconst { limits } = VIVE_PROFILE\nconst SCHEME = /^([a-z][a-z0-9+.-]*):/i\nconst HEX = /^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/i\nconst RGB =\n /^rgba?\\([\\t\\n\\f\\r ]*([0-9]{1,3})[\\t\\n\\f\\r ]*,[\\t\\n\\f\\r ]*([0-9]{1,3})[\\t\\n\\f\\r ]*,[\\t\\n\\f\\r ]*([0-9]{1,3})[\\t\\n\\f\\r ]*(?:,[\\t\\n\\f\\r ]*([0-9.]+%?)[\\t\\n\\f\\r ]*)?\\)$/i\nconst HSL =\n /^hsla?\\([\\t\\n\\f\\r ]*[0-9]{1,3}(?:\\.[0-9]+)?(?:deg)?[\\t\\n\\f\\r ]*,?[\\t\\n\\f\\r ]*[0-9]{1,3}(?:\\.[0-9]+)?%[\\t\\n\\f\\r ]*,?[\\t\\n\\f\\r ]*[0-9]{1,3}(?:\\.[0-9]+)?%[\\t\\n\\f\\r ]*(?:[,/][\\t\\n\\f\\r ]*[0-9.]+%?[\\t\\n\\f\\r ]*)?\\)$/i\nconst PIXELS = /^([0-9]{1,5})px$/\nconst DIGITS = /^[0-9]{1,5}$/\nconst LANGUAGE = /^[a-z0-9][a-z0-9+#.-]{0,31}$/i\nconst HTTPS_URL =\n /^https:\\/\\/[a-z0-9](?:[a-z0-9.-]{0,251}[a-z0-9])?(?::[0-9]{1,5})?(?:[/?#][\\x21-\\x7e]*)?$/i\nconst BASE64_IMAGE = /^data:image\\/([a-z]+);base64,[A-Za-z0-9+/]+={0,2}$/\nconst URL_FORBIDDEN = /[\"'<>\\\\`]/\nconst BANNED_STYLE = ['\\\\', '/*', 'url(', 'expression', '@', '!important']\nconst NAMED_COLORS = new Set(VIVE_PROFILE.namedColors)\nconst REJECTED_COLORS = new Set(VIVE_PROFILE.colorKeywordsRejected)\n\nconst SPACE = /[\\t\\n\\f\\r ]+/g\nconst MENTION_ID = new RegExp(\n `^(?!.*\\\\.\\\\.)[A-Za-z0-9_][A-Za-z0-9_.:@-]{0,${limits.maxMentionId - 1}}$`,\n)\n\nexport const byteLength = (value: string): number => Buffer.byteLength(value, 'utf8')\n\nexport const lowerAscii = (value: string): string =>\n value.replace(/[A-Z]/g, (letter) => letter.toLowerCase())\n\nexport const trimAscii = (value: string): string =>\n value.replace(/^[\\t\\n\\f\\r ]+|[\\t\\n\\f\\r ]+$/g, '')\n\nexport function cleanText(value: string, max: number = limits.maxTextAttributeLength): string {\n const result: string[] = []\n for (const character of value) {\n if (result.length >= max) break\n const code = character.codePointAt(0) ?? 0\n result.push(code < 0x20 || (code >= 0x7f && code <= 0x9f) ? ' ' : character)\n }\n return result.join('')\n}\n\nconst isHidden = (code: number): boolean =>\n code <= 0x1f ||\n (code >= 0x7f && code <= 0x9f) ||\n (code >= 0x200b && code <= 0x200f) ||\n (code >= 0x202a && code <= 0x202e) ||\n (code >= 0x2066 && code <= 0x2069) ||\n code === 0xfeff\n\nexport const isMentionId = (value: string): boolean => MENTION_ID.test(value)\n\nexport function cleanMentionLabel(value: string): string {\n let result = ''\n for (const character of value) {\n const code = character.codePointAt(0) ?? 0\n if (code === 0x09 || code === 0x0a || code === 0x0d) result += ' '\n else if (!isHidden(code)) result += character\n }\n const label = trimAscii(trimAscii(result.replace(SPACE, ' ')).replace(/^@+/, ''))\n return trimAscii(Array.from(label).slice(0, limits.maxMentionLabel).join(''))\n}\n\nexport function cleanLatex(value: string): string | null {\n let result = ''\n for (const character of value) {\n const code = character.codePointAt(0) ?? 0\n if (code === 0x09 || code === 0x0a || !isHidden(code)) result += character\n }\n const latex = trimAscii(result)\n if (latex === '' || Array.from(latex).length > limits.maxMathLength) return null\n let depth = 0\n for (const character of latex) {\n if (character === '{') depth++\n else if (character === '}') depth = Math.max(0, depth - 1)\n if (depth > limits.maxMathDepth) return null\n }\n return latex\n}\n\nexport function takeCodePoints(value: string, budget: { left: number }): string {\n if (budget.left <= 0) return ''\n const characters = Array.from(value)\n const kept = characters.slice(0, budget.left)\n budget.left -= kept.length\n return kept.join('')\n}\n\nexport function cleanInteger(value: string | undefined, min: number, max: number): number | null {\n if (value === undefined || !DIGITS.test(value)) return null\n const number = Number(value)\n return number >= min && number <= max ? number : null\n}\n\nexport function cleanLanguage(value: string | undefined): string | null {\n return value !== undefined && LANGUAGE.test(value) ? lowerAscii(value) : null\n}\n\nexport function cleanColWidth(value: string | undefined): string | null {\n if (value === undefined) return null\n const parts = value.split(',')\n if (parts.length > limits.maxSpan) return null\n return parts.every((part) => cleanInteger(part, 1, 9999) !== null) ? value : null\n}\n\nconst hexPair = (value: number): string => Math.min(255, value).toString(16).padStart(2, '0')\n\nfunction expandHex(hex: string): string {\n const digits = lowerAscii(hex.slice(1))\n if (digits.length > 4) return `#${digits}`\n return `#${[...digits].map((digit) => digit + digit).join('')}`\n}\n\nfunction alphaOf(raw: string | undefined): number {\n if (raw === undefined) return 1\n const value = Number.parseFloat(raw)\n return raw.endsWith('%') ? value / 100 : value\n}\n\nexport function cleanColor(input: string): string | null {\n const value = trimAscii(input)\n const lower = lowerAscii(value)\n if (value === '' || REJECTED_COLORS.has(lower)) return null\n if (HEX.test(value)) {\n const hex = expandHex(value)\n return hex.length === 9 && hex.endsWith('00') ? null : hex\n }\n const rgb = RGB.exec(value)\n if (rgb) {\n const alpha = alphaOf(rgb[4])\n if (!(alpha > 0)) return null\n const [red, green, blue] = [rgb[1], rgb[2], rgb[3]].map((part) => Number(part))\n const hex = `#${hexPair(red ?? 0)}${hexPair(green ?? 0)}${hexPair(blue ?? 0)}`\n return alpha >= 1 ? hex : `${hex}${hexPair(Math.round(alpha * 255))}`\n }\n if (HSL.test(value)) return lower.replace(SPACE, ' ')\n return NAMED_COLORS.has(lower) ? lower : null\n}\n\nfunction styleValue(property: string, value: string): string | null {\n if (property === 'text-align') {\n const align = lowerAscii(value)\n return VIVE_PROFILE.textAlign.includes(align) ? align : null\n }\n if (property === 'color' || property === 'background-color') return cleanColor(value)\n const pixels = PIXELS.exec(value)\n const number = pixels ? Number(pixels[1]) : 0\n return number > 0 && number <= limits.maxTableWidth ? `${number}px` : null\n}\n\nexport function cleanStyle(value: string, allowed: readonly string[]): string | null {\n if (byteLength(value) > allowed.length * (limits.maxStyleValueLength + 32)) return null\n const lower = lowerAscii(value)\n if (BANNED_STYLE.some((banned) => lower.includes(banned))) return null\n const result = new Map<string, string>()\n for (const declaration of value.split(';')) {\n const colon = declaration.indexOf(':')\n if (colon < 0) continue\n const property = lowerAscii(trimAscii(declaration.slice(0, colon)))\n const raw = trimAscii(declaration.slice(colon + 1))\n if (!allowed.includes(property) || result.has(property)) continue\n if (byteLength(raw) > limits.maxStyleValueLength) continue\n const clean = styleValue(property, raw)\n if (clean !== null) result.set(property, clean)\n }\n return result.size > 0\n ? [...result].map(([property, clean]) => `${property}: ${clean}`).join('; ')\n : null\n}\n\nfunction trimEdges(value: string): string {\n let start = 0\n let end = value.length\n while (start < end && value.charCodeAt(start) <= 0x20) start++\n while (end > start && value.charCodeAt(end - 1) <= 0x20) end--\n return value.slice(start, end)\n}\n\nconst hasControl = (value: string): boolean => {\n for (let index = 0; index < value.length; index++) {\n const code = value.charCodeAt(index)\n if (code < 0x20 || (code >= 0x7f && code <= 0x9f)) return true\n }\n return false\n}\n\nexport function cleanHref(input: string): string | null {\n if (byteLength(input) > limits.maxAttributeLength) return null\n const value = trimEdges(input.replace(/[\\t\\n\\r]/g, ''))\n if (value === '' || hasControl(value) || value.includes('\\\\') || value.startsWith('//')) {\n return null\n }\n const found = SCHEME.exec(value)?.[1]\n if (found === undefined) return value\n const scheme = lowerAscii(found)\n if (!VIVE_PROFILE.linkProtocols.includes(scheme)) return null\n if ((scheme === 'http' || scheme === 'https') && !/^https?:\\/\\/[^/]/i.test(value)) return null\n return value\n}\n\nexport interface ImagePolicy {\n allowBase64: boolean\n allowRelative: boolean\n}\n\nexport function cleanImageSrc(input: string, policy: ImagePolicy): string | null {\n const value = trimEdges(input.replace(/[\\t\\n\\r]/g, ''))\n if (value === '' || hasControl(value)) return null\n const base64 = BASE64_IMAGE.exec(value)\n if (base64) {\n return policy.allowBase64 &&\n byteLength(value) <= limits.maxImageSrcLength &&\n VIVE_PROFILE.image.base64Types.includes(base64[1] ?? '')\n ? value\n : null\n }\n if (byteLength(value) > limits.maxUrlLength || URL_FORBIDDEN.test(value)) return null\n const candidate = value.startsWith('//')\n ? `https:${value}`\n : /^http:\\/\\//i.test(value)\n ? `https://${value.slice(7)}`\n : value\n if (HTTPS_URL.test(candidate)) return candidate\n const scheme = SCHEME.exec(value)\n if (scheme || value.startsWith('//') || !policy.allowRelative) return null\n return /^[\\x21-\\x7e ]+$/.test(value) ? value.replaceAll(' ', '%20') : null\n}\n","import { type EmbedProviderRule, VIVE_PROFILE } from './profile.js'\nimport { cleanInteger, cleanText, trimAscii } from './values.js'\n\nexport interface EmbedData {\n provider: string\n rule: EmbedProviderRule\n id: string\n hash: string | null\n start: number | null\n title: string | null\n}\n\nconst IDS: Readonly<Record<string, RegExp>> = {\n youtube: /^[A-Za-z0-9_-]{11}$/,\n vimeo: /^[1-9][0-9]{0,11}$/,\n spotify: new RegExp(`^(?:${VIVE_PROFILE.spotifyTypes.join('|')}):[A-Za-z0-9]{22}$`),\n}\nconst VIMEO_HASH = /^[0-9a-f]{8,20}$/\n\nexport function cleanEmbed(attributes: ReadonlyMap<string, string>): EmbedData | null {\n const provider = attributes.get('data-embed') ?? ''\n const rule = Object.hasOwn(VIVE_PROFILE.embedProviders, provider)\n ? VIVE_PROFILE.embedProviders[provider]\n : undefined\n const pattern = IDS[provider]\n const id = attributes.get('data-id') ?? ''\n if (!rule || !pattern?.test(id)) return null\n const hash = attributes.get('data-hash')\n const title = attributes.get('data-title')\n const cleanTitle =\n title === undefined\n ? null\n : cleanText(\n trimAscii(cleanText(title, Number.POSITIVE_INFINITY)),\n VIVE_PROFILE.limits.maxEmbedTitle,\n ) || null\n return {\n provider,\n rule,\n id,\n hash: provider === 'vimeo' && hash !== undefined && VIMEO_HASH.test(hash) ? hash : null,\n start:\n provider === 'spotify'\n ? null\n : cleanInteger(attributes.get('data-start'), 1, VIVE_PROFILE.limits.maxEmbedStart),\n title: cleanTitle,\n }\n}\n\nexport function embedSrc(embed: EmbedData): string {\n const base = `https://${embed.rule.host}`\n if (embed.provider === 'youtube') {\n return `${base}/embed/${embed.id}${embed.start ? `?start=${embed.start}` : ''}`\n }\n if (embed.provider === 'vimeo') {\n const hash = embed.hash ? `&h=${embed.hash}` : ''\n const start = embed.start ? `#t=${embed.start}s` : ''\n return `${base}/video/${embed.id}?dnt=1${hash}${start}`\n }\n return `${base}/embed/${embed.id.replace(':', '/')}`\n}\n\nexport function embedWatchUrl(embed: EmbedData): string {\n if (embed.provider === 'youtube') {\n return `https://www.youtube.com/watch?v=${embed.id}${embed.start ? `&t=${embed.start}s` : ''}`\n }\n if (embed.provider === 'vimeo') {\n const hash = embed.hash ? `/${embed.hash}` : ''\n return `https://vimeo.com/${embed.id}${hash}${embed.start ? `#t=${embed.start}s` : ''}`\n }\n return `https://open.spotify.com/${embed.id.replace(':', '/')}`\n}\n\nexport function wrapperAttributes(embed: EmbedData): [string, string][] {\n const result: [string, string][] = [\n ['class', 'vive-embed'],\n ['data-embed', embed.provider],\n ['data-id', embed.id],\n ]\n if (embed.hash) result.push(['data-hash', embed.hash])\n if (embed.start) result.push(['data-start', String(embed.start)])\n if (embed.title) result.push(['data-title', embed.title])\n return result\n}\n\nexport function iframeAttributes(embed: EmbedData): [string, string][] {\n const { rule } = embed\n const compact = rule.compactTypes?.some((type) => embed.id.startsWith(`${type}:`)) ?? false\n const height = compact && rule.compactHeight ? rule.compactHeight : rule.height\n return [\n ['src', embedSrc(embed)],\n ['title', embed.title ?? rule.label],\n ['width', String(rule.width)],\n ['height', String(height)],\n [\n 'style',\n rule.fluid\n ? `width: 100%; height: auto; aspect-ratio: ${rule.width} / ${height}; border: 0`\n : `width: 100%; height: ${height}px; border: 0`,\n ],\n ['loading', 'lazy'],\n ['referrerpolicy', 'strict-origin-when-cross-origin'],\n ['sandbox', rule.sandbox],\n ['allow', rule.allow],\n ['allowfullscreen', ''],\n ]\n}\n","import { type DefaultTreeAdapterMap, type TreeAdapter, defaultTreeAdapter as tree } from 'parse5'\n\ntype ChildNode = DefaultTreeAdapterMap['childNode']\ntype ParentNode = DefaultTreeAdapterMap['parentNode']\ntype Template = DefaultTreeAdapterMap['template']\n\nenum State {\n TagName,\n BeforeName,\n Name,\n AfterName,\n BeforeValue,\n DoubleQuoted,\n SingleQuoted,\n Unquoted,\n AfterQuoted,\n SelfClosing,\n}\n\nconst STATES = 10\nconst END = -1\n\nfunction isSpace(code: number): boolean {\n return code === 0x20 || code === 0x09 || code === 0x0a || code === 0x0c || code === 0x0d\n}\n\nfunction isAsciiLetter(code: number): boolean {\n return (code >= 0x41 && code <= 0x5a) || (code >= 0x61 && code <= 0x7a)\n}\n\nconst move = (state: State, added = 0): number => state * 2 + added\n\nfunction transition(state: State, code: number): number {\n switch (state) {\n case State.TagName:\n if (isSpace(code)) return move(State.BeforeName)\n if (code === 0x2f) return move(State.SelfClosing)\n return code === 0x3e ? END : move(State.TagName)\n case State.BeforeName:\n if (isSpace(code)) return move(State.BeforeName)\n if (code === 0x2f || code === 0x3e) return transition(State.AfterName, code)\n return move(State.Name, 1)\n case State.Name:\n if (isSpace(code) || code === 0x2f || code === 0x3e) return transition(State.AfterName, code)\n return code === 0x3d ? move(State.BeforeValue) : move(State.Name)\n case State.AfterName:\n if (isSpace(code)) return move(State.AfterName)\n if (code === 0x2f) return move(State.SelfClosing)\n if (code === 0x3d) return move(State.BeforeValue)\n return code === 0x3e ? END : move(State.Name, 1)\n case State.BeforeValue:\n if (isSpace(code)) return move(State.BeforeValue)\n if (code === 0x22) return move(State.DoubleQuoted)\n if (code === 0x27) return move(State.SingleQuoted)\n return code === 0x3e ? END : move(State.Unquoted)\n case State.DoubleQuoted:\n return move(code === 0x22 ? State.AfterQuoted : State.DoubleQuoted)\n case State.SingleQuoted:\n return move(code === 0x27 ? State.AfterQuoted : State.SingleQuoted)\n case State.Unquoted:\n if (isSpace(code)) return move(State.BeforeName)\n return code === 0x3e ? END : move(State.Unquoted)\n case State.AfterQuoted:\n if (isSpace(code)) return move(State.BeforeName)\n if (code === 0x2f) return move(State.SelfClosing)\n return code === 0x3e ? END : transition(State.BeforeName, code)\n case State.SelfClosing:\n return code === 0x3e ? END : transition(State.BeforeName, code)\n }\n}\n\nfunction opensTag(input: string, index: number): boolean {\n if (!isAsciiLetter(input.charCodeAt(index))) return false\n const previous = input.charCodeAt(index - 1)\n return previous === 0x3c || (previous === 0x2f && input.charCodeAt(index - 2) === 0x3c)\n}\n\nexport function hasCrowdedTag(input: string, maxAttributes: number): boolean {\n let counts = new Int32Array(STATES).fill(END)\n let next = new Int32Array(STATES)\n let active = false\n for (let index = 0; index < input.length; index++) {\n if (!active) {\n const open = input.indexOf('<', index)\n if (open === -1) return false\n index = open\n }\n const code = input.charCodeAt(index)\n if (opensTag(input, index)) counts[State.TagName] = Math.max(counts[State.TagName] ?? END, 0)\n next.fill(END)\n for (let state = 0; state < STATES; state++) {\n const count = counts[state] ?? END\n if (count === END) continue\n const target = transition(state, code)\n if (target === END) continue\n const total = count + (target & 1)\n if (total > maxAttributes) return true\n const reached = target >> 1\n if (total > (next[reached] ?? END)) next[reached] = total\n }\n ;[counts, next] = [next, counts]\n active =\n counts.some((count) => count !== END) ||\n code === 0x3c ||\n (code === 0x2f && input.charCodeAt(index - 1) === 0x3c)\n }\n return false\n}\n\nexport function guardedTreeAdapter(\n maxElements: number,\n maxNesting: number,\n onLimit: () => never,\n): TreeAdapter<DefaultTreeAdapterMap> {\n let created = 0\n const owners = new WeakMap<ParentNode, Template>()\n const checkDepth = (node: ChildNode): void => {\n if (!tree.isElementNode(node)) return\n let depth = 0\n let current: ParentNode | null | undefined = node\n while (current) {\n depth++\n if (depth > maxNesting) onLimit()\n current = ('parentNode' in current ? current.parentNode : null) ?? owners.get(current) ?? null\n }\n }\n return {\n ...tree,\n createElement(tagName, namespaceURI, attrs) {\n created++\n if (created > maxElements) onLimit()\n return tree.createElement(tagName, namespaceURI, attrs)\n },\n appendChild(parentNode, newNode) {\n tree.appendChild(parentNode, newNode)\n checkDepth(newNode)\n },\n insertBefore(parentNode, newNode, referenceNode) {\n tree.insertBefore(parentNode, newNode, referenceNode)\n checkDepth(newNode)\n },\n setTemplateContent(templateElement, contentElement) {\n tree.setTemplateContent(templateElement, contentElement)\n owners.set(contentElement, templateElement)\n },\n }\n}\n","import {\n type DefaultTreeAdapterMap,\n html,\n Parser,\n serialize,\n defaultTreeAdapter as tree,\n} from 'parse5'\nimport { cleanEmbed, embedWatchUrl, iframeAttributes, wrapperAttributes } from './embed.js'\nimport { guardedTreeAdapter, hasCrowdedTag } from './guard.js'\nimport { VIVE_PROFILE } from './profile.js'\nimport {\n byteLength,\n cleanColWidth,\n cleanHref,\n cleanImageSrc,\n cleanInteger,\n cleanLanguage,\n cleanLatex,\n cleanMentionLabel,\n cleanStyle,\n cleanText,\n type ImagePolicy,\n isMentionId,\n takeCodePoints,\n} from './values.js'\n\ntype Element = DefaultTreeAdapterMap['element']\ntype ParentNode = DefaultTreeAdapterMap['parentNode']\n\nexport interface SanitizeOptions {\n embeds?: boolean\n allowBase64?: boolean\n allowRelativeImages?: boolean\n maxBytes?: number\n}\n\nexport type SanitizeErrorCode = 'TOO_LARGE' | 'TOO_COMPLEX'\n\nexport class SanitizeError extends Error {\n readonly code: SanitizeErrorCode\n\n constructor(code: SanitizeErrorCode, message: string) {\n super(message)\n this.name = 'SanitizeError'\n this.code = code\n }\n}\n\ninterface Context {\n parent: string\n taskList: boolean\n taskItem: boolean\n inLink: boolean\n footnote: { left: number } | null\n}\n\ninterface Settings {\n embeds: boolean\n image: ImagePolicy\n}\n\nconst { limits } = VIVE_PROFILE\nconst DROP = new Set(VIVE_PROFILE.dropWithContent)\nconst FOOTNOTE_ELEMENTS = new Set(VIVE_PROFILE.footnoteElements)\nconst ROOT: Context = {\n parent: '',\n taskList: false,\n taskItem: false,\n inLink: false,\n footnote: null,\n}\nconst BODY = tree.createElement('body', html.NS.HTML, [])\n\nfunction attributesOf(element: Element): Map<string, string> {\n const result = new Map<string, string>()\n for (const attribute of element.attrs) {\n const max =\n element.tagName === 'img' && attribute.name === 'src'\n ? limits.maxImageSrcLength\n : limits.maxAttributeLength\n if (attribute.namespace || byteLength(attribute.value) > max) continue\n if (!result.has(attribute.name)) result.set(attribute.name, attribute.value)\n }\n return result\n}\n\nfunction append(target: ParentNode, tag: string, attributes: [string, string][]): Element {\n const element = tree.createElement(\n tag,\n html.NS.HTML,\n attributes.map(([name, value]) => ({ name, value })),\n )\n tree.appendChild(target, element)\n return element\n}\n\nfunction styleOf(tag: string, source: Map<string, string>): [string, string][] {\n const allowed = VIVE_PROFILE.elements[tag]?.styles\n const style = source.get('style')\n if (!allowed || style === undefined) return []\n const clean = cleanStyle(style, allowed)\n return clean === null ? [] : [['style', clean]]\n}\n\nfunction textAttribute(source: Map<string, string>, name: string): [string, string][] {\n const value = source.get(name)\n return value === undefined ? [] : [[name, cleanText(value)]]\n}\n\nfunction linkAttributes(source: Map<string, string>): [string, string][] {\n const result: [string, string][] = [['rel', VIVE_PROFILE.linkRel]]\n const href = source.get('href')\n const clean = href === undefined ? null : cleanHref(href)\n if (clean !== null) result.push(['href', clean])\n result.push(...textAttribute(source, 'title'))\n if (source.get('target') === '_blank') result.push(['target', '_blank'])\n return result\n}\n\nfunction imageAttributes(\n source: Map<string, string>,\n policy: ImagePolicy,\n): [string, string][] | null {\n const raw = source.get('src')\n const src = raw === undefined ? null : cleanImageSrc(raw, policy)\n if (src === null) return null\n const result: [string, string][] = [['src', src]]\n result.push(...textAttribute(source, 'alt'), ...textAttribute(source, 'title'))\n for (const name of ['width', 'height']) {\n const size = cleanInteger(source.get(name), 1, limits.maxImageSize)\n if (size !== null) result.push([name, String(size)])\n }\n const { loading, decoding, referrerpolicy } = VIVE_PROFILE.image\n result.push(['loading', loading], ['decoding', decoding], ['referrerpolicy', referrerpolicy])\n return result\n}\n\nfunction cellAttributes(source: Map<string, string>): [string, string][] {\n const result: [string, string][] = []\n for (const name of ['colspan', 'rowspan']) {\n const span = cleanInteger(source.get(name), 2, limits.maxSpan)\n if (span !== null) result.push([name, String(span)])\n }\n const widths = cleanColWidth(source.get('data-colwidth'))\n if (widths !== null) result.push(['data-colwidth', widths])\n return result\n}\n\nfunction embed(source: Map<string, string>, node: Element, target: ParentNode): void {\n const data = cleanEmbed(source)\n if (!data) return\n const wrapper = append(target, 'div', wrapperAttributes(data))\n const facade = node.childNodes.some((child) => tree.isElementNode(child) && child.tagName === 'a')\n if (facade) {\n const link = append(wrapper, 'a', [\n ['href', embedWatchUrl(data)],\n ['rel', 'noopener noreferrer'],\n ])\n tree.insertText(link, data.title ?? data.rule.label)\n } else {\n append(wrapper, 'iframe', iframeAttributes(data))\n }\n}\n\nfunction insertText(target: ParentNode, value: string, context: Context): void {\n const text = context.footnote ? takeCodePoints(value, context.footnote) : value\n if (text) tree.insertText(target, text)\n}\n\nfunction textOf(node: ParentNode, depth: number): string {\n let text = ''\n for (const child of node.childNodes) {\n if (tree.isTextNode(child)) text += child.value\n else if (\n tree.isElementNode(child) &&\n depth < limits.maxDepth &&\n child.namespaceURI === html.NS.HTML &&\n !DROP.has(child.tagName)\n ) {\n text += textOf(child, depth + 1)\n }\n }\n return text\n}\n\nfunction mention(\n id: string,\n node: Element,\n target: ParentNode,\n depth: number,\n context: Context,\n): void {\n const text = textOf(node, depth)\n if (context.inLink || context.footnote || !isMentionId(id)) {\n insertText(target, text, context)\n return\n }\n const created = append(target, 'span', [\n ['class', VIVE_PROFILE.mentionClass],\n ['data-mention', id],\n ])\n tree.insertText(created, `@${cleanMentionLabel(text) || id}`)\n}\n\nfunction math(\n tag: 'span' | 'div',\n node: Element,\n target: ParentNode,\n depth: number,\n context: Context,\n): void {\n const text = textOf(node, depth)\n const latex = context.inLink || context.footnote ? null : cleanLatex(text)\n if (latex === null) {\n insertText(target, text, context)\n return\n }\n const created = append(target, tag, [['data-math', tag === 'span' ? 'inline' : 'block']])\n tree.insertText(created, latex)\n}\n\nfunction footnote(\n node: Element,\n target: ParentNode,\n depth: number,\n context: Context,\n settings: Settings,\n): void {\n if (context.inLink || context.footnote) {\n walk(node, target, depth, context, settings)\n return\n }\n const created = append(target, 'sup', [['data-footnote', '']])\n const inner: Context = {\n ...ROOT,\n parent: 'sup',\n footnote: { left: limits.maxFootnoteLength },\n }\n walk(node, created, depth, inner, settings)\n}\n\nfunction walk(\n source: ParentNode,\n target: ParentNode,\n depth: number,\n context: Context,\n settings: Settings,\n): void {\n for (const child of source.childNodes) {\n if (tree.isTextNode(child)) insertText(target, child.value, context)\n else if (tree.isElementNode(child)) element(child, target, depth + 1, context, settings)\n }\n}\n\nfunction element(\n node: Element,\n target: ParentNode,\n depth: number,\n context: Context,\n settings: Settings,\n): void {\n if (depth > limits.maxDepth || node.namespaceURI !== html.NS.HTML) return\n const tag = node.tagName\n if (DROP.has(tag)) return\n const source = attributesOf(node)\n if (context.footnote && !FOOTNOTE_ELEMENTS.has(tag)) {\n walk(node, target, depth, context, settings)\n return\n }\n const mentionId = source.get('data-mention')\n if (\n tag === 'span' &&\n mentionId !== undefined &&\n source.get('class') === VIVE_PROFILE.mentionClass\n ) {\n mention(mentionId, node, target, depth, context)\n return\n }\n const mathType = source.get('data-math')\n if ((tag === 'span' && mathType === 'inline') || (tag === 'div' && mathType === 'block')) {\n math(tag, node, target, depth, context)\n return\n }\n if (tag === 'sup' && source.has('data-footnote')) {\n footnote(node, target, depth, context, settings)\n return\n }\n const next: Context = {\n parent: tag,\n taskList: false,\n taskItem: false,\n inLink: context.inLink || tag === 'a',\n footnote: context.footnote,\n }\n let attributes: [string, string][] | null = null\n\n switch (tag) {\n case 'div':\n if (source.get('class') === 'vive-embed' && source.has('data-embed')) {\n if (settings.embeds) embed(source, node, target)\n return\n }\n if (source.has('data-embed-invalid')) return\n attributes = context.taskItem ? [] : null\n break\n case 'input':\n if (!context.taskItem || source.get('type') !== 'checkbox') return\n append(target, 'input', [\n ['type', 'checkbox'],\n ['disabled', ''],\n ...(source.has('checked') ? ([['checked', '']] as [string, string][]) : []),\n ])\n return\n case 'ul':\n next.taskList = source.get('data-type') === 'taskList'\n attributes = next.taskList ? [['data-type', 'taskList']] : []\n break\n case 'li':\n next.taskItem = context.taskList && source.get('data-type') === 'taskItem'\n attributes = next.taskItem\n ? [\n ['data-type', 'taskItem'],\n ['data-checked', source.get('data-checked') === 'true' ? 'true' : 'false'],\n ]\n : []\n break\n case 'ol': {\n const start = cleanInteger(source.get('start'), 0, limits.maxListStart)\n attributes = start !== null && start !== 1 ? [['start', String(start)]] : []\n break\n }\n case 'pre': {\n const language = cleanLanguage(source.get('data-language'))\n attributes = language ? [['data-language', language]] : []\n break\n }\n case 'code': {\n const match = /^language-(.+)$/.exec(source.get('class') ?? '')\n const language = context.parent === 'pre' ? cleanLanguage(match?.[1]) : null\n attributes = language ? [['class', `language-${language}`]] : []\n break\n }\n case 'a':\n attributes = context.inLink ? null : linkAttributes(source)\n break\n case 'sup':\n attributes = null\n break\n case 'img': {\n const image = imageAttributes(source, settings.image)\n if (image) append(target, 'img', image)\n return\n }\n case 'td':\n case 'th':\n attributes = cellAttributes(source)\n break\n default:\n attributes = Object.hasOwn(VIVE_PROFILE.elements, tag) ? styleOf(tag, source) : null\n }\n\n if (attributes === null) {\n walk(node, target, depth, context, settings)\n return\n }\n const created = append(target, tag, attributes)\n walk(node, created, depth, next, settings)\n}\n\nconst MAX_ROUNDS = 3\n\nfunction scrub(input: string): string {\n return input.toWellFormed().replaceAll('\\0', '')\n}\n\nfunction tooComplex(): never {\n throw new SanitizeError(\n 'TOO_COMPLEX',\n 'HTML has too many attributes, elements or nesting levels.',\n )\n}\n\nfunction tagCount(input: string): number {\n let count = 0\n for (let index = input.indexOf('<'); index !== -1; index = input.indexOf('<', index + 1)) count++\n return count\n}\n\nfunction cleanOnce(input: string, settings: Settings): string {\n if (hasCrowdedTag(input, limits.maxAttributes)) tooComplex()\n const treeAdapter = guardedTreeAdapter(\n tagCount(input) + limits.maxExtraElements,\n limits.maxNesting,\n tooComplex,\n )\n const parser = Parser.getFragmentParser(BODY, { scriptingEnabled: false, treeAdapter })\n parser.tokenizer.write(input, true)\n const root = treeAdapter.getFirstChild(parser.document)\n const output = tree.createDocumentFragment()\n if (root && tree.isElementNode(root)) walk(root, output, 0, ROOT, settings)\n return serialize(output)\n}\n\nexport function sanitizeHtml(input: string, options: SanitizeOptions = {}): string {\n if (typeof input !== 'string') return ''\n const maxBytes = options.maxBytes ?? limits.maxBytes\n if (byteLength(input) > maxBytes) {\n throw new SanitizeError('TOO_LARGE', `HTML is larger than ${maxBytes} bytes.`)\n }\n const settings: Settings = {\n embeds: options.embeds === true,\n image: {\n allowBase64: options.allowBase64 === true,\n allowRelative: options.allowRelativeImages === true,\n },\n }\n let clean = cleanOnce(scrub(input), settings)\n for (let round = 1; round < MAX_ROUNDS; round++) {\n const again = cleanOnce(clean, settings)\n if (again === clean) break\n clean = again\n }\n return clean\n}\n"],"mappings":";;AC+DA,MAAa,eAAgCA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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maxSpan": 100,
|
|
10
|
+
"maxImageSize": 10000,
|
|
11
|
+
"maxListStart": 99999,
|
|
12
|
+
"maxTableWidth": 99999,
|
|
13
|
+
"maxEmbedStart": 86400,
|
|
14
|
+
"maxEmbedTitle": 200,
|
|
15
|
+
"maxImageSrcLength": 1500000,
|
|
16
|
+
"maxUrlLength": 4096,
|
|
17
|
+
"maxMentionId": 128,
|
|
18
|
+
"maxMentionLabel": 100,
|
|
19
|
+
"maxMathLength": 2000,
|
|
20
|
+
"maxMathDepth": 64,
|
|
21
|
+
"maxFootnoteLength": 5000,
|
|
22
|
+
"maxAttributes": 64,
|
|
23
|
+
"maxNesting": 512,
|
|
24
|
+
"maxExtraElements": 2048
|
|
25
|
+
},
|
|
26
|
+
"dropWithContent": [
|
|
27
|
+
"script",
|
|
28
|
+
"style",
|
|
29
|
+
"textarea",
|
|
30
|
+
"title",
|
|
31
|
+
"xmp",
|
|
32
|
+
"noscript",
|
|
33
|
+
"noembed",
|
|
34
|
+
"noframes",
|
|
35
|
+
"plaintext",
|
|
36
|
+
"template",
|
|
37
|
+
"iframe",
|
|
38
|
+
"svg",
|
|
39
|
+
"math",
|
|
40
|
+
"object",
|
|
41
|
+
"embed",
|
|
42
|
+
"select",
|
|
43
|
+
"option",
|
|
44
|
+
"button",
|
|
45
|
+
"head",
|
|
46
|
+
"frameset",
|
|
47
|
+
"frame"
|
|
48
|
+
],
|
|
49
|
+
"elements": {
|
|
50
|
+
"p": {
|
|
51
|
+
"styles": ["text-align"]
|
|
52
|
+
},
|
|
53
|
+
"h1": {
|
|
54
|
+
"styles": ["text-align"]
|
|
55
|
+
},
|
|
56
|
+
"h2": {
|
|
57
|
+
"styles": ["text-align"]
|
|
58
|
+
},
|
|
59
|
+
"h3": {
|
|
60
|
+
"styles": ["text-align"]
|
|
61
|
+
},
|
|
62
|
+
"h4": {
|
|
63
|
+
"styles": ["text-align"]
|
|
64
|
+
},
|
|
65
|
+
"h5": {
|
|
66
|
+
"styles": ["text-align"]
|
|
67
|
+
},
|
|
68
|
+
"h6": {
|
|
69
|
+
"styles": ["text-align"]
|
|
70
|
+
},
|
|
71
|
+
"blockquote": {},
|
|
72
|
+
"hr": {},
|
|
73
|
+
"br": {},
|
|
74
|
+
"strong": {},
|
|
75
|
+
"em": {},
|
|
76
|
+
"u": {},
|
|
77
|
+
"s": {},
|
|
78
|
+
"code": {
|
|
79
|
+
"attributes": ["class"]
|
|
80
|
+
},
|
|
81
|
+
"a": {
|
|
82
|
+
"attributes": ["href", "title", "target"]
|
|
83
|
+
},
|
|
84
|
+
"ul": {
|
|
85
|
+
"attributes": ["data-type"]
|
|
86
|
+
},
|
|
87
|
+
"ol": {
|
|
88
|
+
"attributes": ["start"]
|
|
89
|
+
},
|
|
90
|
+
"li": {
|
|
91
|
+
"attributes": ["data-type", "data-checked"]
|
|
92
|
+
},
|
|
93
|
+
"input": {
|
|
94
|
+
"attributes": ["type", "checked", "disabled"]
|
|
95
|
+
},
|
|
96
|
+
"div": {
|
|
97
|
+
"attributes": [
|
|
98
|
+
"class",
|
|
99
|
+
"data-embed",
|
|
100
|
+
"data-id",
|
|
101
|
+
"data-hash",
|
|
102
|
+
"data-start",
|
|
103
|
+
"data-title",
|
|
104
|
+
"data-math"
|
|
105
|
+
]
|
|
106
|
+
},
|
|
107
|
+
"pre": {
|
|
108
|
+
"attributes": ["data-language"]
|
|
109
|
+
},
|
|
110
|
+
"table": {
|
|
111
|
+
"styles": ["width", "min-width"]
|
|
112
|
+
},
|
|
113
|
+
"colgroup": {},
|
|
114
|
+
"col": {
|
|
115
|
+
"styles": ["width"]
|
|
116
|
+
},
|
|
117
|
+
"tbody": {},
|
|
118
|
+
"tr": {},
|
|
119
|
+
"td": {
|
|
120
|
+
"attributes": ["colspan", "rowspan", "data-colwidth"]
|
|
121
|
+
},
|
|
122
|
+
"th": {
|
|
123
|
+
"attributes": ["colspan", "rowspan", "data-colwidth"]
|
|
124
|
+
},
|
|
125
|
+
"span": {
|
|
126
|
+
"styles": ["color"],
|
|
127
|
+
"attributes": ["class", "data-mention", "data-math"]
|
|
128
|
+
},
|
|
129
|
+
"mark": {
|
|
130
|
+
"styles": ["background-color"]
|
|
131
|
+
},
|
|
132
|
+
"img": {
|
|
133
|
+
"attributes": [
|
|
134
|
+
"src",
|
|
135
|
+
"alt",
|
|
136
|
+
"title",
|
|
137
|
+
"width",
|
|
138
|
+
"height",
|
|
139
|
+
"loading",
|
|
140
|
+
"decoding",
|
|
141
|
+
"referrerpolicy"
|
|
142
|
+
]
|
|
143
|
+
},
|
|
144
|
+
"sup": {
|
|
145
|
+
"attributes": ["data-footnote"]
|
|
146
|
+
}
|
|
147
|
+
},
|
|
148
|
+
"mentionClass": "vive-mention",
|
|
149
|
+
"footnoteElements": ["strong", "em", "a"],
|
|
150
|
+
"textAlign": ["left", "center", "right", "justify"],
|
|
151
|
+
"linkProtocols": ["http", "https", "mailto", "tel"],
|
|
152
|
+
"linkRel": "noopener noreferrer nofollow",
|
|
153
|
+
"image": {
|
|
154
|
+
"loading": "lazy",
|
|
155
|
+
"decoding": "async",
|
|
156
|
+
"referrerpolicy": "no-referrer",
|
|
157
|
+
"base64Types": ["png", "jpeg", "gif", "webp", "avif"]
|
|
158
|
+
},
|
|
159
|
+
"embedProviders": {
|
|
160
|
+
"youtube": {
|
|
161
|
+
"label": "YouTube",
|
|
162
|
+
"host": "www.youtube-nocookie.com",
|
|
163
|
+
"width": 560,
|
|
164
|
+
"sandbox": "allow-scripts allow-same-origin allow-presentation allow-popups allow-popups-to-escape-sandbox",
|
|
165
|
+
"allow": "fullscreen; picture-in-picture; encrypted-media",
|
|
166
|
+
"height": 315,
|
|
167
|
+
"fluid": true
|
|
168
|
+
},
|
|
169
|
+
"vimeo": {
|
|
170
|
+
"label": "Vimeo",
|
|
171
|
+
"host": "player.vimeo.com",
|
|
172
|
+
"width": 640,
|
|
173
|
+
"sandbox": "allow-scripts allow-same-origin allow-presentation allow-popups allow-popups-to-escape-sandbox",
|
|
174
|
+
"allow": "fullscreen; picture-in-picture; encrypted-media",
|
|
175
|
+
"height": 360,
|
|
176
|
+
"fluid": true
|
|
177
|
+
},
|
|
178
|
+
"spotify": {
|
|
179
|
+
"label": "Spotify",
|
|
180
|
+
"host": "open.spotify.com",
|
|
181
|
+
"width": 560,
|
|
182
|
+
"sandbox": "allow-scripts allow-same-origin allow-popups allow-popups-to-escape-sandbox",
|
|
183
|
+
"allow": "fullscreen; encrypted-media",
|
|
184
|
+
"height": 352,
|
|
185
|
+
"compactHeight": 152,
|
|
186
|
+
"compactTypes": ["track", "episode"],
|
|
187
|
+
"fluid": false
|
|
188
|
+
}
|
|
189
|
+
},
|
|
190
|
+
"colorKeywordsRejected": [
|
|
191
|
+
"inherit",
|
|
192
|
+
"initial",
|
|
193
|
+
"unset",
|
|
194
|
+
"revert",
|
|
195
|
+
"currentcolor",
|
|
196
|
+
"transparent",
|
|
197
|
+
"auto",
|
|
198
|
+
"none",
|
|
199
|
+
"windowtext"
|
|
200
|
+
],
|
|
201
|
+
"namedColors": [
|
|
202
|
+
"aliceblue",
|
|
203
|
+
"antiquewhite",
|
|
204
|
+
"aqua",
|
|
205
|
+
"aquamarine",
|
|
206
|
+
"azure",
|
|
207
|
+
"beige",
|
|
208
|
+
"bisque",
|
|
209
|
+
"black",
|
|
210
|
+
"blanchedalmond",
|
|
211
|
+
"blue",
|
|
212
|
+
"blueviolet",
|
|
213
|
+
"brown",
|
|
214
|
+
"burlywood",
|
|
215
|
+
"cadetblue",
|
|
216
|
+
"chartreuse",
|
|
217
|
+
"chocolate",
|
|
218
|
+
"coral",
|
|
219
|
+
"cornflowerblue",
|
|
220
|
+
"cornsilk",
|
|
221
|
+
"crimson",
|
|
222
|
+
"cyan",
|
|
223
|
+
"darkblue",
|
|
224
|
+
"darkcyan",
|
|
225
|
+
"darkgoldenrod",
|
|
226
|
+
"darkgray",
|
|
227
|
+
"darkgreen",
|
|
228
|
+
"darkgrey",
|
|
229
|
+
"darkkhaki",
|
|
230
|
+
"darkmagenta",
|
|
231
|
+
"darkolivegreen",
|
|
232
|
+
"darkorange",
|
|
233
|
+
"darkorchid",
|
|
234
|
+
"darkred",
|
|
235
|
+
"darksalmon",
|
|
236
|
+
"darkseagreen",
|
|
237
|
+
"darkslateblue",
|
|
238
|
+
"darkslategray",
|
|
239
|
+
"darkslategrey",
|
|
240
|
+
"darkturquoise",
|
|
241
|
+
"darkviolet",
|
|
242
|
+
"deeppink",
|
|
243
|
+
"deepskyblue",
|
|
244
|
+
"dimgray",
|
|
245
|
+
"dimgrey",
|
|
246
|
+
"dodgerblue",
|
|
247
|
+
"firebrick",
|
|
248
|
+
"floralwhite",
|
|
249
|
+
"forestgreen",
|
|
250
|
+
"fuchsia",
|
|
251
|
+
"gainsboro",
|
|
252
|
+
"ghostwhite",
|
|
253
|
+
"gold",
|
|
254
|
+
"goldenrod",
|
|
255
|
+
"gray",
|
|
256
|
+
"green",
|
|
257
|
+
"greenyellow",
|
|
258
|
+
"grey",
|
|
259
|
+
"honeydew",
|
|
260
|
+
"hotpink",
|
|
261
|
+
"indianred",
|
|
262
|
+
"indigo",
|
|
263
|
+
"ivory",
|
|
264
|
+
"khaki",
|
|
265
|
+
"lavender",
|
|
266
|
+
"lavenderblush",
|
|
267
|
+
"lawngreen",
|
|
268
|
+
"lemonchiffon",
|
|
269
|
+
"lightblue",
|
|
270
|
+
"lightcoral",
|
|
271
|
+
"lightcyan",
|
|
272
|
+
"lightgoldenrodyellow",
|
|
273
|
+
"lightgray",
|
|
274
|
+
"lightgreen",
|
|
275
|
+
"lightgrey",
|
|
276
|
+
"lightpink",
|
|
277
|
+
"lightsalmon",
|
|
278
|
+
"lightseagreen",
|
|
279
|
+
"lightskyblue",
|
|
280
|
+
"lightslategray",
|
|
281
|
+
"lightslategrey",
|
|
282
|
+
"lightsteelblue",
|
|
283
|
+
"lightyellow",
|
|
284
|
+
"lime",
|
|
285
|
+
"limegreen",
|
|
286
|
+
"linen",
|
|
287
|
+
"magenta",
|
|
288
|
+
"maroon",
|
|
289
|
+
"mediumaquamarine",
|
|
290
|
+
"mediumblue",
|
|
291
|
+
"mediumorchid",
|
|
292
|
+
"mediumpurple",
|
|
293
|
+
"mediumseagreen",
|
|
294
|
+
"mediumslateblue",
|
|
295
|
+
"mediumspringgreen",
|
|
296
|
+
"mediumturquoise",
|
|
297
|
+
"mediumvioletred",
|
|
298
|
+
"midnightblue",
|
|
299
|
+
"mintcream",
|
|
300
|
+
"mistyrose",
|
|
301
|
+
"moccasin",
|
|
302
|
+
"navajowhite",
|
|
303
|
+
"navy",
|
|
304
|
+
"oldlace",
|
|
305
|
+
"olive",
|
|
306
|
+
"olivedrab",
|
|
307
|
+
"orange",
|
|
308
|
+
"orangered",
|
|
309
|
+
"orchid",
|
|
310
|
+
"palegoldenrod",
|
|
311
|
+
"palegreen",
|
|
312
|
+
"paleturquoise",
|
|
313
|
+
"palevioletred",
|
|
314
|
+
"papayawhip",
|
|
315
|
+
"peachpuff",
|
|
316
|
+
"peru",
|
|
317
|
+
"pink",
|
|
318
|
+
"plum",
|
|
319
|
+
"powderblue",
|
|
320
|
+
"purple",
|
|
321
|
+
"rebeccapurple",
|
|
322
|
+
"red",
|
|
323
|
+
"rosybrown",
|
|
324
|
+
"royalblue",
|
|
325
|
+
"saddlebrown",
|
|
326
|
+
"salmon",
|
|
327
|
+
"sandybrown",
|
|
328
|
+
"seagreen",
|
|
329
|
+
"seashell",
|
|
330
|
+
"sienna",
|
|
331
|
+
"silver",
|
|
332
|
+
"skyblue",
|
|
333
|
+
"slateblue",
|
|
334
|
+
"slategray",
|
|
335
|
+
"slategrey",
|
|
336
|
+
"snow",
|
|
337
|
+
"springgreen",
|
|
338
|
+
"steelblue",
|
|
339
|
+
"tan",
|
|
340
|
+
"teal",
|
|
341
|
+
"thistle",
|
|
342
|
+
"tomato",
|
|
343
|
+
"turquoise",
|
|
344
|
+
"violet",
|
|
345
|
+
"wheat",
|
|
346
|
+
"white",
|
|
347
|
+
"whitesmoke",
|
|
348
|
+
"yellow",
|
|
349
|
+
"yellowgreen"
|
|
350
|
+
],
|
|
351
|
+
"spotifyTypes": ["track", "album", "playlist", "episode", "show", "artist"]
|
|
352
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,66 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@viveeditor/sanitize",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Server-side sanitizer that keeps exactly the HTML viveEditor produces and removes everything else.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"keywords": [
|
|
7
|
+
"viveeditor",
|
|
8
|
+
"rich-text-editor",
|
|
9
|
+
"wysiwyg",
|
|
10
|
+
"editor",
|
|
11
|
+
"prosemirror",
|
|
12
|
+
"sanitizer",
|
|
13
|
+
"html-sanitizer",
|
|
14
|
+
"xss",
|
|
15
|
+
"server"
|
|
16
|
+
],
|
|
17
|
+
"homepage": "https://github.com/mtvrkan/viveeditor/tree/main/packages/sanitize#readme",
|
|
18
|
+
"bugs": {
|
|
19
|
+
"url": "https://github.com/mtvrkan/viveeditor/issues"
|
|
20
|
+
},
|
|
21
|
+
"repository": {
|
|
22
|
+
"type": "git",
|
|
23
|
+
"url": "git+https://github.com/mtvrkan/viveeditor.git",
|
|
24
|
+
"directory": "packages/sanitize"
|
|
25
|
+
},
|
|
26
|
+
"type": "module",
|
|
27
|
+
"engines": {
|
|
28
|
+
"node": ">=22.12"
|
|
29
|
+
},
|
|
30
|
+
"exports": {
|
|
31
|
+
".": {
|
|
32
|
+
"types": "./dist/index.d.mts",
|
|
33
|
+
"import": "./dist/index.mjs"
|
|
34
|
+
},
|
|
35
|
+
"./profile.json": "./dist/profile.json"
|
|
36
|
+
},
|
|
37
|
+
"files": [
|
|
38
|
+
"dist"
|
|
39
|
+
],
|
|
40
|
+
"sideEffects": false,
|
|
41
|
+
"dependencies": {
|
|
42
|
+
"parse5": "8.0.1"
|
|
43
|
+
},
|
|
44
|
+
"devDependencies": {
|
|
45
|
+
"@types/node": "^22.20.5",
|
|
46
|
+
"fast-check": "^4.10.2",
|
|
47
|
+
"jsdom": "^30.1.3",
|
|
48
|
+
"tsdown": "0.23.1",
|
|
49
|
+
"vitest": "^5.0.5",
|
|
50
|
+
"@viveeditor/core": "0.1.0",
|
|
51
|
+
"@viveeditor/ext-basic": "0.1.0",
|
|
52
|
+
"@viveeditor/ext-math": "0.1.0",
|
|
53
|
+
"@viveeditor/ext-mention": "0.1.0",
|
|
54
|
+
"viveeditor": "0.1.0",
|
|
55
|
+
"@viveeditor/ext-footnote": "0.1.0"
|
|
56
|
+
},
|
|
57
|
+
"publishConfig": {
|
|
58
|
+
"access": "public",
|
|
59
|
+
"provenance": true
|
|
60
|
+
},
|
|
61
|
+
"scripts": {
|
|
62
|
+
"build": "tsdown && cp src/profile.json dist/profile.json",
|
|
63
|
+
"typecheck": "tsc -p tsconfig.json",
|
|
64
|
+
"test": "vitest run"
|
|
65
|
+
}
|
|
6
66
|
}
|