From afa87af01c79a9baa539f2992d32154d2a4739bd Mon Sep 17 00:00:00 2001 From: Adam Mathes Date: Sat, 14 Feb 2026 14:46:37 -0800 Subject: task: delete vanilla js prototype\n\n- Removed vanilla/ directory and web/dist/vanilla directory\n- Updated Makefile, Dockerfile, and CI workflow to remove vanilla references\n- Cleaned up web/web.go to remove vanilla embed and routes\n- Verified build and tests pass\n\nCloses NK-2tcnmq --- .../dist/parser/formatting-element-list.d.ts | 36 - .../parse5/dist/parser/formatting-element-list.js | 110 - vanilla/node_modules/parse5/dist/parser/index.d.ts | 221 -- vanilla/node_modules/parse5/dist/parser/index.js | 3245 -------------------- .../parse5/dist/parser/open-element-stack.d.ts | 53 - .../parse5/dist/parser/open-element-stack.js | 324 -- 6 files changed, 3989 deletions(-) delete mode 100644 vanilla/node_modules/parse5/dist/parser/formatting-element-list.d.ts delete mode 100644 vanilla/node_modules/parse5/dist/parser/formatting-element-list.js delete mode 100644 vanilla/node_modules/parse5/dist/parser/index.d.ts delete mode 100644 vanilla/node_modules/parse5/dist/parser/index.js delete mode 100644 vanilla/node_modules/parse5/dist/parser/open-element-stack.d.ts delete mode 100644 vanilla/node_modules/parse5/dist/parser/open-element-stack.js (limited to 'vanilla/node_modules/parse5/dist/parser') diff --git a/vanilla/node_modules/parse5/dist/parser/formatting-element-list.d.ts b/vanilla/node_modules/parse5/dist/parser/formatting-element-list.d.ts deleted file mode 100644 index 1d421b6..0000000 --- a/vanilla/node_modules/parse5/dist/parser/formatting-element-list.d.ts +++ /dev/null @@ -1,36 +0,0 @@ -import type { TagToken } from '../common/token.js'; -import type { TreeAdapter, TreeAdapterTypeMap } from '../tree-adapters/interface.js'; -export declare enum EntryType { - Marker = 0, - Element = 1 -} -interface MarkerEntry { - type: EntryType.Marker; -} -export interface ElementEntry { - type: EntryType.Element; - element: T['element']; - token: TagToken; -} -export type Entry = MarkerEntry | ElementEntry; -export declare class FormattingElementList { - private treeAdapter; - entries: Entry[]; - bookmark: Entry | null; - constructor(treeAdapter: TreeAdapter); - private _getNoahArkConditionCandidates; - private _ensureNoahArkCondition; - insertMarker(): void; - pushElement(element: T['element'], token: TagToken): void; - insertElementAfterBookmark(element: T['element'], token: TagToken): void; - removeEntry(entry: Entry): void; - /** - * Clears the list of formatting elements up to the last marker. - * - * @see https://html.spec.whatwg.org/multipage/parsing.html#clear-the-list-of-active-formatting-elements-up-to-the-last-marker - */ - clearToLastMarker(): void; - getElementEntryInScopeWithTagName(tagName: string): ElementEntry | null; - getElementEntry(element: T['element']): ElementEntry | undefined; -} -export {}; diff --git a/vanilla/node_modules/parse5/dist/parser/formatting-element-list.js b/vanilla/node_modules/parse5/dist/parser/formatting-element-list.js deleted file mode 100644 index b9ce95b..0000000 --- a/vanilla/node_modules/parse5/dist/parser/formatting-element-list.js +++ /dev/null @@ -1,110 +0,0 @@ -//Const -const NOAH_ARK_CAPACITY = 3; -export var EntryType; -(function (EntryType) { - EntryType[EntryType["Marker"] = 0] = "Marker"; - EntryType[EntryType["Element"] = 1] = "Element"; -})(EntryType || (EntryType = {})); -const MARKER = { type: EntryType.Marker }; -//List of formatting elements -export class FormattingElementList { - constructor(treeAdapter) { - this.treeAdapter = treeAdapter; - this.entries = []; - this.bookmark = null; - } - //Noah Ark's condition - //OPTIMIZATION: at first we try to find possible candidates for exclusion using - //lightweight heuristics without thorough attributes check. - _getNoahArkConditionCandidates(newElement, neAttrs) { - const candidates = []; - const neAttrsLength = neAttrs.length; - const neTagName = this.treeAdapter.getTagName(newElement); - const neNamespaceURI = this.treeAdapter.getNamespaceURI(newElement); - for (let i = 0; i < this.entries.length; i++) { - const entry = this.entries[i]; - if (entry.type === EntryType.Marker) { - break; - } - const { element } = entry; - if (this.treeAdapter.getTagName(element) === neTagName && - this.treeAdapter.getNamespaceURI(element) === neNamespaceURI) { - const elementAttrs = this.treeAdapter.getAttrList(element); - if (elementAttrs.length === neAttrsLength) { - candidates.push({ idx: i, attrs: elementAttrs }); - } - } - } - return candidates; - } - _ensureNoahArkCondition(newElement) { - if (this.entries.length < NOAH_ARK_CAPACITY) - return; - const neAttrs = this.treeAdapter.getAttrList(newElement); - const candidates = this._getNoahArkConditionCandidates(newElement, neAttrs); - if (candidates.length < NOAH_ARK_CAPACITY) - return; - //NOTE: build attrs map for the new element, so we can perform fast lookups - const neAttrsMap = new Map(neAttrs.map((neAttr) => [neAttr.name, neAttr.value])); - let validCandidates = 0; - //NOTE: remove bottommost candidates, until Noah's Ark condition will not be met - for (let i = 0; i < candidates.length; i++) { - const candidate = candidates[i]; - // We know that `candidate.attrs.length === neAttrs.length` - if (candidate.attrs.every((cAttr) => neAttrsMap.get(cAttr.name) === cAttr.value)) { - validCandidates += 1; - if (validCandidates >= NOAH_ARK_CAPACITY) { - this.entries.splice(candidate.idx, 1); - } - } - } - } - //Mutations - insertMarker() { - this.entries.unshift(MARKER); - } - pushElement(element, token) { - this._ensureNoahArkCondition(element); - this.entries.unshift({ - type: EntryType.Element, - element, - token, - }); - } - insertElementAfterBookmark(element, token) { - const bookmarkIdx = this.entries.indexOf(this.bookmark); - this.entries.splice(bookmarkIdx, 0, { - type: EntryType.Element, - element, - token, - }); - } - removeEntry(entry) { - const entryIndex = this.entries.indexOf(entry); - if (entryIndex !== -1) { - this.entries.splice(entryIndex, 1); - } - } - /** - * Clears the list of formatting elements up to the last marker. - * - * @see https://html.spec.whatwg.org/multipage/parsing.html#clear-the-list-of-active-formatting-elements-up-to-the-last-marker - */ - clearToLastMarker() { - const markerIdx = this.entries.indexOf(MARKER); - if (markerIdx === -1) { - this.entries.length = 0; - } - else { - this.entries.splice(0, markerIdx + 1); - } - } - //Search - getElementEntryInScopeWithTagName(tagName) { - const entry = this.entries.find((entry) => entry.type === EntryType.Marker || this.treeAdapter.getTagName(entry.element) === tagName); - return entry && entry.type === EntryType.Element ? entry : null; - } - getElementEntry(element) { - return this.entries.find((entry) => entry.type === EntryType.Element && entry.element === element); - } -} diff --git a/vanilla/node_modules/parse5/dist/parser/index.d.ts b/vanilla/node_modules/parse5/dist/parser/index.d.ts deleted file mode 100644 index 04c6a59..0000000 --- a/vanilla/node_modules/parse5/dist/parser/index.d.ts +++ /dev/null @@ -1,221 +0,0 @@ -import { Tokenizer, TokenizerMode, type TokenHandler } from '../tokenizer/index.js'; -import { OpenElementStack, type StackHandler } from './open-element-stack.js'; -import { FormattingElementList } from './formatting-element-list.js'; -import { ERR, type ParserErrorHandler } from '../common/error-codes.js'; -import { TAG_ID as $, NS } from '../common/html.js'; -import type { TreeAdapter, TreeAdapterTypeMap } from '../tree-adapters/interface.js'; -import { type Token, type CommentToken, type CharacterToken, type TagToken, type DoctypeToken, type EOFToken, type LocationWithAttributes } from '../common/token.js'; -declare enum InsertionMode { - INITIAL = 0, - BEFORE_HTML = 1, - BEFORE_HEAD = 2, - IN_HEAD = 3, - IN_HEAD_NO_SCRIPT = 4, - AFTER_HEAD = 5, - IN_BODY = 6, - TEXT = 7, - IN_TABLE = 8, - IN_TABLE_TEXT = 9, - IN_CAPTION = 10, - IN_COLUMN_GROUP = 11, - IN_TABLE_BODY = 12, - IN_ROW = 13, - IN_CELL = 14, - IN_SELECT = 15, - IN_SELECT_IN_TABLE = 16, - IN_TEMPLATE = 17, - AFTER_BODY = 18, - IN_FRAMESET = 19, - AFTER_FRAMESET = 20, - AFTER_AFTER_BODY = 21, - AFTER_AFTER_FRAMESET = 22 -} -export interface ParserOptions { - /** - * The [scripting flag](https://html.spec.whatwg.org/multipage/parsing.html#scripting-flag). If set - * to `true`, `noscript` element content will be parsed as text. - * - * @default `true` - */ - scriptingEnabled?: boolean; - /** - * Enables source code location information. When enabled, each node (except the root node) - * will have a `sourceCodeLocation` property. If the node is not an empty element, `sourceCodeLocation` will - * be a {@link ElementLocation} object, otherwise it will be {@link Location}. - * If the element was implicitly created by the parser (as part of - * [tree correction](https://html.spec.whatwg.org/multipage/syntax.html#an-introduction-to-error-handling-and-strange-cases-in-the-parser)), - * its `sourceCodeLocation` property will be `undefined`. - * - * @default `false` - */ - sourceCodeLocationInfo?: boolean; - /** - * Specifies the resulting tree format. - * - * @default `treeAdapters.default` - */ - treeAdapter?: TreeAdapter; - /** - * Callback for parse errors. - * - * @default `null` - */ - onParseError?: ParserErrorHandler | null; -} -export declare class Parser implements TokenHandler, StackHandler { - /** @internal */ - fragmentContext: T['element'] | null; - /** @internal */ - scriptHandler: null | ((pendingScript: T['element']) => void); - treeAdapter: TreeAdapter; - /** @internal */ - onParseError: ParserErrorHandler | null; - protected currentToken: Token | null; - options: Required>; - document: T['document']; - constructor(options?: ParserOptions, document?: T['document'], - /** @internal */ - fragmentContext?: T['element'] | null, - /** @internal */ - scriptHandler?: null | ((pendingScript: T['element']) => void)); - static parse(html: string, options?: ParserOptions): T['document']; - static getFragmentParser(fragmentContext?: T['parentNode'] | null, options?: ParserOptions): Parser; - getFragment(): T['documentFragment']; - tokenizer: Tokenizer; - stopped: boolean; - /** @internal */ - insertionMode: InsertionMode; - /** @internal */ - originalInsertionMode: InsertionMode; - /** @internal */ - fragmentContextID: $; - /** @internal */ - headElement: null | T['element']; - /** @internal */ - formElement: null | T['element']; - /** @internal */ - openElements: OpenElementStack; - /** @internal */ - activeFormattingElements: FormattingElementList; - /** Indicates that the current node is not an element in the HTML namespace */ - protected currentNotInHTML: boolean; - /** - * The template insertion mode stack is maintained from the left. - * Ie. the topmost element will always have index 0. - * - * @internal - */ - tmplInsertionModeStack: InsertionMode[]; - /** @internal */ - pendingCharacterTokens: CharacterToken[]; - /** @internal */ - hasNonWhitespacePendingCharacterToken: boolean; - /** @internal */ - framesetOk: boolean; - /** @internal */ - skipNextNewLine: boolean; - /** @internal */ - fosterParentingEnabled: boolean; - /** @internal */ - _err(token: Token, code: ERR, beforeToken?: boolean): void; - /** @internal */ - onItemPush(node: T['parentNode'], tid: number, isTop: boolean): void; - /** @internal */ - onItemPop(node: T['parentNode'], isTop: boolean): void; - protected _setContextModes(current: T['parentNode'] | undefined, tid: number | undefined): void; - /** @protected */ - _switchToTextParsing(currentToken: TagToken, nextTokenizerState: (typeof TokenizerMode)[keyof typeof TokenizerMode]): void; - switchToPlaintextParsing(): void; - /** @protected */ - _getAdjustedCurrentElement(): T['element']; - /** @protected */ - _findFormInFragmentContext(): void; - protected _initTokenizerForFragmentParsing(): void; - /** @protected */ - _setDocumentType(token: DoctypeToken): void; - /** @protected */ - _attachElementToTree(element: T['element'], location: LocationWithAttributes | null): void; - /** - * For self-closing tags. Add an element to the tree, but skip adding it - * to the stack. - */ - /** @protected */ - _appendElement(token: TagToken, namespaceURI: NS): void; - /** @protected */ - _insertElement(token: TagToken, namespaceURI: NS): void; - /** @protected */ - _insertFakeElement(tagName: string, tagID: $): void; - /** @protected */ - _insertTemplate(token: TagToken): void; - /** @protected */ - _insertFakeRootElement(): void; - /** @protected */ - _appendCommentNode(token: CommentToken, parent: T['parentNode']): void; - /** @protected */ - _insertCharacters(token: CharacterToken): void; - /** @protected */ - _adoptNodes(donor: T['parentNode'], recipient: T['parentNode']): void; - /** @protected */ - _setEndLocation(element: T['element'], closingToken: Token): void; - protected shouldProcessStartTagTokenInForeignContent(token: TagToken): boolean; - /** @protected */ - _processToken(token: Token): void; - /** @protected */ - _isIntegrationPoint(tid: $, element: T['element'], foreignNS?: NS): boolean; - /** @protected */ - _reconstructActiveFormattingElements(): void; - /** @protected */ - _closeTableCell(): void; - /** @protected */ - _closePElement(): void; - /** @protected */ - _resetInsertionMode(): void; - /** @protected */ - _resetInsertionModeForSelect(selectIdx: number): void; - /** @protected */ - _isElementCausesFosterParenting(tn: $): boolean; - /** @protected */ - _shouldFosterParentOnInsertion(): boolean; - /** @protected */ - _findFosterParentingLocation(): { - parent: T['parentNode']; - beforeElement: T['element'] | null; - }; - /** @protected */ - _fosterParentElement(element: T['element']): void; - /** @protected */ - _isSpecialElement(element: T['element'], id: $): boolean; - /** @internal */ - onCharacter(token: CharacterToken): void; - /** @internal */ - onNullCharacter(token: CharacterToken): void; - /** @internal */ - onComment(token: CommentToken): void; - /** @internal */ - onDoctype(token: DoctypeToken): void; - /** @internal */ - onStartTag(token: TagToken): void; - /** - * Processes a given start tag. - * - * `onStartTag` checks if a self-closing tag was recognized. When a token - * is moved inbetween multiple insertion modes, this check for self-closing - * could lead to false positives. To avoid this, `_processStartTag` is used - * for nested calls. - * - * @param token The token to process. - * @protected - */ - _processStartTag(token: TagToken): void; - /** @protected */ - _startTagOutsideForeignContent(token: TagToken): void; - /** @internal */ - onEndTag(token: TagToken): void; - /** @protected */ - _endTagOutsideForeignContent(token: TagToken): void; - /** @internal */ - onEof(token: EOFToken): void; - /** @internal */ - onWhitespaceCharacter(token: CharacterToken): void; -} -export {}; diff --git a/vanilla/node_modules/parse5/dist/parser/index.js b/vanilla/node_modules/parse5/dist/parser/index.js deleted file mode 100644 index fdd2562..0000000 --- a/vanilla/node_modules/parse5/dist/parser/index.js +++ /dev/null @@ -1,3245 +0,0 @@ -import { Tokenizer, TokenizerMode } from '../tokenizer/index.js'; -import { OpenElementStack } from './open-element-stack.js'; -import { FormattingElementList, EntryType } from './formatting-element-list.js'; -import { defaultTreeAdapter } from '../tree-adapters/default.js'; -import * as doctype from '../common/doctype.js'; -import * as foreignContent from '../common/foreign-content.js'; -import { ERR } from '../common/error-codes.js'; -import * as unicode from '../common/unicode.js'; -import { TAG_ID as $, TAG_NAMES as TN, NS, ATTRS, SPECIAL_ELEMENTS, DOCUMENT_MODE, NUMBERED_HEADERS, getTagID, } from '../common/html.js'; -import { TokenType, getTokenAttr, } from '../common/token.js'; -//Misc constants -const HIDDEN_INPUT_TYPE = 'hidden'; -//Adoption agency loops iteration count -const AA_OUTER_LOOP_ITER = 8; -const AA_INNER_LOOP_ITER = 3; -//Insertion modes -var InsertionMode; -(function (InsertionMode) { - InsertionMode[InsertionMode["INITIAL"] = 0] = "INITIAL"; - InsertionMode[InsertionMode["BEFORE_HTML"] = 1] = "BEFORE_HTML"; - InsertionMode[InsertionMode["BEFORE_HEAD"] = 2] = "BEFORE_HEAD"; - InsertionMode[InsertionMode["IN_HEAD"] = 3] = "IN_HEAD"; - InsertionMode[InsertionMode["IN_HEAD_NO_SCRIPT"] = 4] = "IN_HEAD_NO_SCRIPT"; - InsertionMode[InsertionMode["AFTER_HEAD"] = 5] = "AFTER_HEAD"; - InsertionMode[InsertionMode["IN_BODY"] = 6] = "IN_BODY"; - InsertionMode[InsertionMode["TEXT"] = 7] = "TEXT"; - InsertionMode[InsertionMode["IN_TABLE"] = 8] = "IN_TABLE"; - InsertionMode[InsertionMode["IN_TABLE_TEXT"] = 9] = "IN_TABLE_TEXT"; - InsertionMode[InsertionMode["IN_CAPTION"] = 10] = "IN_CAPTION"; - InsertionMode[InsertionMode["IN_COLUMN_GROUP"] = 11] = "IN_COLUMN_GROUP"; - InsertionMode[InsertionMode["IN_TABLE_BODY"] = 12] = "IN_TABLE_BODY"; - InsertionMode[InsertionMode["IN_ROW"] = 13] = "IN_ROW"; - InsertionMode[InsertionMode["IN_CELL"] = 14] = "IN_CELL"; - InsertionMode[InsertionMode["IN_SELECT"] = 15] = "IN_SELECT"; - InsertionMode[InsertionMode["IN_SELECT_IN_TABLE"] = 16] = "IN_SELECT_IN_TABLE"; - InsertionMode[InsertionMode["IN_TEMPLATE"] = 17] = "IN_TEMPLATE"; - InsertionMode[InsertionMode["AFTER_BODY"] = 18] = "AFTER_BODY"; - InsertionMode[InsertionMode["IN_FRAMESET"] = 19] = "IN_FRAMESET"; - InsertionMode[InsertionMode["AFTER_FRAMESET"] = 20] = "AFTER_FRAMESET"; - InsertionMode[InsertionMode["AFTER_AFTER_BODY"] = 21] = "AFTER_AFTER_BODY"; - InsertionMode[InsertionMode["AFTER_AFTER_FRAMESET"] = 22] = "AFTER_AFTER_FRAMESET"; -})(InsertionMode || (InsertionMode = {})); -const BASE_LOC = { - startLine: -1, - startCol: -1, - startOffset: -1, - endLine: -1, - endCol: -1, - endOffset: -1, -}; -const TABLE_STRUCTURE_TAGS = new Set([$.TABLE, $.TBODY, $.TFOOT, $.THEAD, $.TR]); -const defaultParserOptions = { - scriptingEnabled: true, - sourceCodeLocationInfo: false, - treeAdapter: defaultTreeAdapter, - onParseError: null, -}; -//Parser -export class Parser { - constructor(options, document, - /** @internal */ - fragmentContext = null, - /** @internal */ - scriptHandler = null) { - this.fragmentContext = fragmentContext; - this.scriptHandler = scriptHandler; - this.currentToken = null; - this.stopped = false; - /** @internal */ - this.insertionMode = InsertionMode.INITIAL; - /** @internal */ - this.originalInsertionMode = InsertionMode.INITIAL; - /** @internal */ - this.headElement = null; - /** @internal */ - this.formElement = null; - /** Indicates that the current node is not an element in the HTML namespace */ - this.currentNotInHTML = false; - /** - * The template insertion mode stack is maintained from the left. - * Ie. the topmost element will always have index 0. - * - * @internal - */ - this.tmplInsertionModeStack = []; - /** @internal */ - this.pendingCharacterTokens = []; - /** @internal */ - this.hasNonWhitespacePendingCharacterToken = false; - /** @internal */ - this.framesetOk = true; - /** @internal */ - this.skipNextNewLine = false; - /** @internal */ - this.fosterParentingEnabled = false; - this.options = { - ...defaultParserOptions, - ...options, - }; - this.treeAdapter = this.options.treeAdapter; - this.onParseError = this.options.onParseError; - // Always enable location info if we report parse errors. - if (this.onParseError) { - this.options.sourceCodeLocationInfo = true; - } - this.document = document !== null && document !== void 0 ? document : this.treeAdapter.createDocument(); - this.tokenizer = new Tokenizer(this.options, this); - this.activeFormattingElements = new FormattingElementList(this.treeAdapter); - this.fragmentContextID = fragmentContext ? getTagID(this.treeAdapter.getTagName(fragmentContext)) : $.UNKNOWN; - this._setContextModes(fragmentContext !== null && fragmentContext !== void 0 ? fragmentContext : this.document, this.fragmentContextID); - this.openElements = new OpenElementStack(this.document, this.treeAdapter, this); - } - // API - static parse(html, options) { - const parser = new this(options); - parser.tokenizer.write(html, true); - return parser.document; - } - static getFragmentParser(fragmentContext, options) { - const opts = { - ...defaultParserOptions, - ...options, - }; - //NOTE: use a