- ✅ Ticket 1.1: Estructura Clean Architecture en backend - ✅ Ticket 1.2: Schemas Zod compartidos - ✅ Ticket 1.3: Refactorización drugs.ts (1362 → 8 archivos modulares) - ✅ Ticket 1.4: Refactorización procedures.ts (3583 → 6 archivos modulares) - ✅ Ticket 1.5: Eliminación de duplicidades (~50 líneas) Cambios principales: - Creada estructura Clean Architecture en backend/src/ - Schemas Zod compartidos en backend/src/shared/schemas/ - Refactorización modular de drugs y procedures - Utilidades genéricas en src/utils/ (filter, validation) - Eliminados scripts obsoletos y documentación antigua - Corregidos errores: QueryClient, import test-error-handling - Build verificado y funcionando correctamente
94 lines
2.4 KiB
TypeScript
94 lines
2.4 KiB
TypeScript
import Document from '../nodes/document/Document.js';
|
|
import Element from '../nodes/element/Element.js';
|
|
import DocumentFragment from '../nodes/document-fragment/DocumentFragment.js';
|
|
import BrowserWindow from '../window/BrowserWindow.js';
|
|
/**
|
|
* HTML parser.
|
|
*/
|
|
export default class HTMLParser {
|
|
private window;
|
|
private evaluateScripts;
|
|
private isTemplateDocumentFragment;
|
|
private rootNode;
|
|
private rootDocument;
|
|
private nodeStack;
|
|
private tagNameStack;
|
|
private documentStructure;
|
|
private startTagIndex;
|
|
private markupRegExp;
|
|
private nextElement;
|
|
private currentNode;
|
|
private readState;
|
|
/**
|
|
* Constructor.
|
|
*
|
|
* @param window Window.
|
|
* @param [options] Options.
|
|
* @param [options.evaluateScripts] Set to "true" to enable script execution
|
|
* @param [options.isTemplateDocumentFragment] Set to "true" if parsing a template content fragment.
|
|
*/
|
|
constructor(window: BrowserWindow, options?: {
|
|
evaluateScripts?: boolean;
|
|
isTemplateDocumentFragment?: boolean;
|
|
});
|
|
/**
|
|
* Parses HTML a root element containing nodes found.
|
|
*
|
|
* @param html HTML string.
|
|
* @param [rootNode] Root node.
|
|
* @returns Root node.
|
|
*/
|
|
parse(html: string, rootNode?: Element | DocumentFragment | Document): Element | DocumentFragment | Document;
|
|
/**
|
|
* Parses plain text.
|
|
*
|
|
* @param text Text.
|
|
*/
|
|
private parsePlainText;
|
|
/**
|
|
* Parses end of start tag.
|
|
*
|
|
* @param attributeString Attribute string.
|
|
* @param isSelfClosed Is self closed.
|
|
*/
|
|
private parseEndOfStartTag;
|
|
/**
|
|
* Parses end tag.
|
|
*
|
|
* @param tagName Tag name.
|
|
*/
|
|
private parseEndTag;
|
|
/**
|
|
* Parses comment.
|
|
*
|
|
* @param comment Comment.
|
|
*/
|
|
private parseComment;
|
|
/**
|
|
* Parses document type.
|
|
*
|
|
* @param text Text.
|
|
*/
|
|
private parseDocumentType;
|
|
/**
|
|
* Parses raw text content for elements such as <script> and <style>.
|
|
*
|
|
* @param tagName End tag name.
|
|
* @param text Text.
|
|
*/
|
|
private parseRawTextElementContent;
|
|
/**
|
|
* Creates an element or returns a reference to it.
|
|
*
|
|
* @param tagName Tag name.
|
|
*/
|
|
private getStartTagElement;
|
|
/**
|
|
* Returns document type.
|
|
*
|
|
* @param value Value.
|
|
* @returns Document type.
|
|
*/
|
|
private getDocumentType;
|
|
}
|
|
//# sourceMappingURL=HTMLParser.d.ts.map
|