index.d.ts 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. import { Parser, ParserOptions } from "./Parser.js";
  2. export { Parser, type ParserOptions };
  3. import { DomHandler, DomHandlerOptions, ChildNode, Element, Document } from "domhandler";
  4. export { DomHandler, type DomHandlerOptions };
  5. declare type Options = ParserOptions & DomHandlerOptions;
  6. /**
  7. * Parses the data, returns the resulting document.
  8. *
  9. * @param data The data that should be parsed.
  10. * @param options Optional options for the parser and DOM builder.
  11. */
  12. export declare function parseDocument(data: string, options?: Options): Document;
  13. /**
  14. * Parses data, returns an array of the root nodes.
  15. *
  16. * Note that the root nodes still have a `Document` node as their parent.
  17. * Use `parseDocument` to get the `Document` node instead.
  18. *
  19. * @param data The data that should be parsed.
  20. * @param options Optional options for the parser and DOM builder.
  21. * @deprecated Use `parseDocument` instead.
  22. */
  23. export declare function parseDOM(data: string, options?: Options): ChildNode[];
  24. /**
  25. * Creates a parser instance, with an attached DOM handler.
  26. *
  27. * @param cb A callback that will be called once parsing has been completed.
  28. * @param options Optional options for the parser and DOM builder.
  29. * @param elementCb An optional callback that will be called every time a tag has been completed inside of the DOM.
  30. */
  31. export declare function createDomStream(cb: (error: Error | null, dom: ChildNode[]) => void, options?: Options, elementCb?: (element: Element) => void): Parser;
  32. export { default as Tokenizer, type Callbacks as TokenizerCallbacks, } from "./Tokenizer.js";
  33. import * as ElementType from "domelementtype";
  34. export { ElementType };
  35. import { getFeed, Feed } from "domutils";
  36. export { getFeed };
  37. /**
  38. * Parse a feed.
  39. *
  40. * @param feed The feed that should be parsed, as a string.
  41. * @param options Optionally, options for parsing. When using this, you should set `xmlMode` to `true`.
  42. */
  43. export declare function parseFeed(feed: string, options?: ParserOptions & DomHandlerOptions): Feed | null;
  44. export * as DomUtils from "domutils";
  45. export { DomHandler as DefaultHandler };
  46. //# sourceMappingURL=index.d.ts.map