@dvaji/cheerox 0.0.0-stage → 0.1.1

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.
Files changed (253) hide show
  1. package/CONTRIBUTING.md +74 -0
  2. package/Cargo.lock +1094 -0
  3. package/Cargo.toml +46 -0
  4. package/LICENSE +21 -0
  5. package/README.md +121 -2
  6. package/RELEASING.md +114 -0
  7. package/THIRD_PARTY_NOTICES.md +7579 -0
  8. package/build.rs +3 -0
  9. package/cheerox.darwin-arm64.node +0 -0
  10. package/cheerox.darwin-x64.node +0 -0
  11. package/cheerox.linux-arm64-gnu.node +0 -0
  12. package/cheerox.linux-arm64-musl.node +0 -0
  13. package/cheerox.linux-x64-gnu.node +0 -0
  14. package/cheerox.linux-x64-musl.node +0 -0
  15. package/cheerox.win32-arm64-msvc.node +0 -0
  16. package/cheerox.win32-x64-msvc.node +0 -0
  17. package/dist/cheerio-compat-BS--qPzw.mjs +1648 -0
  18. package/dist/cheerio-compat-BS--qPzw.mjs.map +1 -0
  19. package/dist/cheerio-compat-DRLPzBdX.d.mts +88 -0
  20. package/dist/cheerio-compat-DRsINTwV.d.cts +88 -0
  21. package/dist/cheerio-compat-DRsINTwV.d.ts +88 -0
  22. package/dist/cheerio-compat-DSwBAJ1s.cjs +1719 -0
  23. package/dist/cheerio-compat-DSwBAJ1s.cjs.map +1 -0
  24. package/dist/cheerio-compat.cjs +18 -0
  25. package/dist/cheerio-compat.d.cts +2 -0
  26. package/dist/cheerio-compat.d.mts +2 -0
  27. package/dist/cheerio-compat.d.ts +2 -0
  28. package/dist/cheerio-compat.mjs +1 -0
  29. package/dist/index.cjs +13 -0
  30. package/dist/index.cjs.map +1 -0
  31. package/dist/index.d.cts +28 -0
  32. package/dist/index.d.mts +6 -0
  33. package/dist/index.d.ts +28 -0
  34. package/dist/index.mjs +53 -0
  35. package/dist/index.mjs.map +1 -0
  36. package/dist/legacy-parse.cjs +5 -0
  37. package/dist/legacy-parse.d.mts +8 -0
  38. package/dist/legacy-parse.d.ts +7 -0
  39. package/dist/legacy-parse.mjs +1 -0
  40. package/dist/modern-B7hyW4cI.d.cts +102 -0
  41. package/dist/modern-B7hyW4cI.d.ts +102 -0
  42. package/dist/modern-CHQGP0Yt.cjs +2858 -0
  43. package/dist/modern-CHQGP0Yt.cjs.map +1 -0
  44. package/dist/modern-CJvSD_y5.d.mts +102 -0
  45. package/dist/modern-CvXcTn82.mjs +2769 -0
  46. package/dist/modern-CvXcTn82.mjs.map +1 -0
  47. package/dist/modern.cjs +19 -0
  48. package/dist/modern.d.cts +3 -0
  49. package/dist/modern.d.mts +3 -0
  50. package/dist/modern.d.ts +3 -0
  51. package/dist/modern.mjs +3 -0
  52. package/dist/nodes-jbWWhssj.cjs +4210 -0
  53. package/dist/nodes-jbWWhssj.cjs.map +1 -0
  54. package/dist/nodes-sYxb5qyZ.mjs +3803 -0
  55. package/dist/nodes-sYxb5qyZ.mjs.map +1 -0
  56. package/dist/slim.cjs +16 -0
  57. package/dist/slim.cjs.map +1 -0
  58. package/dist/slim.d.cts +6 -0
  59. package/dist/slim.d.mts +6 -0
  60. package/dist/slim.d.ts +6 -0
  61. package/dist/slim.mjs +12 -0
  62. package/dist/slim.mjs.map +1 -0
  63. package/dist/types-CA01Zg3r.d.cts +526 -0
  64. package/dist/types-CA01Zg3r.d.mts +526 -0
  65. package/dist/types-CA01Zg3r.d.ts +526 -0
  66. package/dist/utils.cjs +31 -0
  67. package/dist/utils.cjs.map +1 -0
  68. package/dist/utils.d.cts +8 -0
  69. package/dist/utils.d.mts +8 -0
  70. package/dist/utils.d.ts +8 -0
  71. package/dist/utils.mjs +25 -0
  72. package/dist/utils.mjs.map +1 -0
  73. package/native/src/arena.rs +2109 -0
  74. package/native/src/attributes.rs +946 -0
  75. package/native/src/codec.rs +298 -0
  76. package/native/src/diagnostics.rs +1249 -0
  77. package/native/src/document_order.rs +711 -0
  78. package/native/src/extraction.rs +321 -0
  79. package/native/src/gc.rs +175 -0
  80. package/native/src/hook_sink.rs +801 -0
  81. package/native/src/hook_stream.rs +513 -0
  82. package/native/src/id_hash.rs +42 -0
  83. package/native/src/immutable.rs +333 -0
  84. package/native/src/lib.rs +4119 -0
  85. package/native/src/location.rs +392 -0
  86. package/native/src/markup_tokenizer.rs +668 -0
  87. package/native/src/runtime.rs +368 -0
  88. package/native/src/selector.rs +1596 -0
  89. package/native/src/sink.rs +274 -0
  90. package/native/src/snapshot.rs +672 -0
  91. package/native/src/stream.rs +334 -0
  92. package/native/src/tokenizer.rs +581 -0
  93. package/native/src/tracker.rs +232 -0
  94. package/native/vendor/README.md +26 -0
  95. package/native/vendor/html5ever-0.35.0/.cargo_vcs_info.json +6 -0
  96. package/native/vendor/html5ever-0.35.0/Cargo.lock +828 -0
  97. package/native/vendor/html5ever-0.35.0/Cargo.toml +85 -0
  98. package/native/vendor/html5ever-0.35.0/LICENSE-APACHE +201 -0
  99. package/native/vendor/html5ever-0.35.0/LICENSE-MIT +25 -0
  100. package/native/vendor/html5ever-0.35.0/README.md +60 -0
  101. package/native/vendor/html5ever-0.35.0/benches/html5ever.rs +86 -0
  102. package/native/vendor/html5ever-0.35.0/data/bench/lipsum-zh.html +19 -0
  103. package/native/vendor/html5ever-0.35.0/data/bench/lipsum.html +40 -0
  104. package/native/vendor/html5ever-0.35.0/data/bench/medium-fragment.html +24 -0
  105. package/native/vendor/html5ever-0.35.0/data/bench/small-fragment.html +7 -0
  106. package/native/vendor/html5ever-0.35.0/data/bench/strong.html +1 -0
  107. package/native/vendor/html5ever-0.35.0/data/bench/tiny-fragment.html +1 -0
  108. package/native/vendor/html5ever-0.35.0/examples/arena.rs +356 -0
  109. package/native/vendor/html5ever-0.35.0/examples/capi/tokenize.c +74 -0
  110. package/native/vendor/html5ever-0.35.0/examples/noop-tokenize.rs +47 -0
  111. package/native/vendor/html5ever-0.35.0/examples/noop-tree-builder.rs +132 -0
  112. package/native/vendor/html5ever-0.35.0/examples/print-tree-actions.rs +185 -0
  113. package/native/vendor/html5ever-0.35.0/examples/tokenize.rs +111 -0
  114. package/native/vendor/html5ever-0.35.0/src/driver.rs +148 -0
  115. package/native/vendor/html5ever-0.35.0/src/lib.rs +30 -0
  116. package/native/vendor/html5ever-0.35.0/src/macros.rs +34 -0
  117. package/native/vendor/html5ever-0.35.0/src/serialize/mod.rs +255 -0
  118. package/native/vendor/html5ever-0.35.0/src/tokenizer/char_ref/mod.rs +530 -0
  119. package/native/vendor/html5ever-0.35.0/src/tokenizer/interface.rs +99 -0
  120. package/native/vendor/html5ever-0.35.0/src/tokenizer/mod.rs +2628 -0
  121. package/native/vendor/html5ever-0.35.0/src/tokenizer/states.rs +97 -0
  122. package/native/vendor/html5ever-0.35.0/src/tree_builder/data.rs +170 -0
  123. package/native/vendor/html5ever-0.35.0/src/tree_builder/mod.rs +1848 -0
  124. package/native/vendor/html5ever-0.35.0/src/tree_builder/rules.rs +1494 -0
  125. package/native/vendor/html5ever-0.35.0/src/tree_builder/tag_sets.rs +114 -0
  126. package/native/vendor/html5ever-0.35.0/src/tree_builder/types.rs +91 -0
  127. package/native/vendor/html5ever-0.35.0/src/util/str.rs +52 -0
  128. package/native/vendor/html5gum-0.8.4/Cargo.lock +1006 -0
  129. package/native/vendor/html5gum-0.8.4/Cargo.toml +109 -0
  130. package/native/vendor/html5gum-0.8.4/LICENSE +19 -0
  131. package/native/vendor/html5gum-0.8.4/README.md +110 -0
  132. package/native/vendor/html5gum-0.8.4/benches/files/0050.html +2131 -0
  133. package/native/vendor/html5gum-0.8.4/benches/files/6D30.html +1004 -0
  134. package/native/vendor/html5gum-0.8.4/benches/files.rs +32 -0
  135. package/native/vendor/html5gum-0.8.4/benches/patterns.rs +31 -0
  136. package/native/vendor/html5gum-0.8.4/src/arrayvec.rs +29 -0
  137. package/native/vendor/html5gum-0.8.4/src/char_validator.rs +134 -0
  138. package/native/vendor/html5gum-0.8.4/src/emitters/callback.rs +676 -0
  139. package/native/vendor/html5gum-0.8.4/src/emitters/default.rs +207 -0
  140. package/native/vendor/html5gum-0.8.4/src/emitters/emitter.rs +344 -0
  141. package/native/vendor/html5gum-0.8.4/src/emitters/html5ever.rs +306 -0
  142. package/native/vendor/html5gum-0.8.4/src/emitters/mod.rs +25 -0
  143. package/native/vendor/html5gum-0.8.4/src/entities.rs +3342 -0
  144. package/native/vendor/html5gum-0.8.4/src/error.rs +96 -0
  145. package/native/vendor/html5gum-0.8.4/src/htmlstring.rs +130 -0
  146. package/native/vendor/html5gum-0.8.4/src/lib.rs +66 -0
  147. package/native/vendor/html5gum-0.8.4/src/machine.rs +2136 -0
  148. package/native/vendor/html5gum-0.8.4/src/machine_helper.rs +277 -0
  149. package/native/vendor/html5gum-0.8.4/src/read_helper.rs +244 -0
  150. package/native/vendor/html5gum-0.8.4/src/reader.rs +440 -0
  151. package/native/vendor/html5gum-0.8.4/src/span.rs +98 -0
  152. package/native/vendor/html5gum-0.8.4/src/state.rs +16 -0
  153. package/native/vendor/html5gum-0.8.4/src/testutils.rs +71 -0
  154. package/native/vendor/html5gum-0.8.4/src/tokenizer.rs +189 -0
  155. package/native/vendor/html5gum-0.8.4/src/utils.rs +88 -0
  156. package/native/vendor/markup5ever-0.35.0/.cargo_vcs_info.json +6 -0
  157. package/native/vendor/markup5ever-0.35.0/Cargo.toml +45 -0
  158. package/native/vendor/markup5ever-0.35.0/LICENSE-APACHE +201 -0
  159. package/native/vendor/markup5ever-0.35.0/LICENSE-MIT +25 -0
  160. package/native/vendor/markup5ever-0.35.0/interface/mod.rs +422 -0
  161. package/native/vendor/markup5ever-0.35.0/interface/tree_builder.rs +280 -0
  162. package/native/vendor/markup5ever-0.35.0/lib.rs +59 -0
  163. package/native/vendor/markup5ever-0.35.0/serialize.rs +77 -0
  164. package/native/vendor/markup5ever-0.35.0/util/buffer_queue.rs +333 -0
  165. package/native/vendor/markup5ever-0.35.0/util/smallcharset.rs +88 -0
  166. package/package.json +167 -4
  167. package/scripts/check-native.mjs +15 -0
  168. package/scripts/check-release.mjs +234 -0
  169. package/scripts/fix-declarations.mjs +39 -0
  170. package/scripts/generate-notices.mjs +188 -0
  171. package/scripts/notices/README.md +13 -0
  172. package/scripts/notices/cheerio-MIT.txt +21 -0
  173. package/scripts/notices/html5ever-AUTHORS.txt +20 -0
  174. package/scripts/notices/html5ever-COPYRIGHT.txt +8 -0
  175. package/scripts/notices/html5ever-LICENSE-APACHE.txt +201 -0
  176. package/scripts/notices/html5ever-LICENSE-MIT.txt +25 -0
  177. package/scripts/notices/htmlparser2-MIT.txt +18 -0
  178. package/scripts/notices/napi-rs-MIT.txt +43 -0
  179. package/scripts/notices/neon-MIT.txt +19 -0
  180. package/scripts/notices/runtime-01c266bced4a434da005.txt +3 -0
  181. package/scripts/notices/runtime-0a54e647fe54104658b5.txt +14 -0
  182. package/scripts/notices/runtime-0b74dfa0bcee5c420c6b.txt +25 -0
  183. package/scripts/notices/runtime-0d542e0c8804e39aa7f3.txt +177 -0
  184. package/scripts/notices/runtime-0f96a83840e146e43c0e.txt +21 -0
  185. package/scripts/notices/runtime-123a331b5dbf04c30097.txt +25 -0
  186. package/scripts/notices/runtime-172020dbfd5b53a226df.txt +34 -0
  187. package/scripts/notices/runtime-209fbbe0ad52d9235e37.txt +26 -0
  188. package/scripts/notices/runtime-23f18e03dc49df91622f.txt +23 -0
  189. package/scripts/notices/runtime-268872b9816f90fd8e85.txt +220 -0
  190. package/scripts/notices/runtime-35242e7a83f69875e6ed.txt +176 -0
  191. package/scripts/notices/runtime-378f5840b258e2779c39.txt +25 -0
  192. package/scripts/notices/runtime-4108245a1f2df9d4e94d.txt +25 -0
  193. package/scripts/notices/runtime-4455bf75a91154108304.txt +21 -0
  194. package/scripts/notices/runtime-553fffcd9b1cb158bc3e.txt +13 -0
  195. package/scripts/notices/runtime-62c7a1e35f56406896d7.txt +176 -0
  196. package/scripts/notices/runtime-6485b8ed310d3f0340bf.txt +25 -0
  197. package/scripts/notices/runtime-69fef7b0f322a6555415.txt +201 -0
  198. package/scripts/notices/runtime-6df43f6f4b5d4587f3d8.txt +187 -0
  199. package/scripts/notices/runtime-799e9ca9d179295ef372.txt +24 -0
  200. package/scripts/notices/runtime-7b63ecd5f1902af1b637.txt +25 -0
  201. package/scripts/notices/runtime-7bc7d5de2a0b793d4e1a.txt +21 -0
  202. package/scripts/notices/runtime-7e12e5df4bae12cb2158.txt +24 -0
  203. package/scripts/notices/runtime-861399f8c21c042b1105.txt +12 -0
  204. package/scripts/notices/runtime-8ada45cd9f843acf64e4.txt +201 -0
  205. package/scripts/notices/runtime-90eb64f0279b0d9432ac.txt +12 -0
  206. package/scripts/notices/runtime-a60eea817514531668d7.txt +201 -0
  207. package/scripts/notices/runtime-a7c936ff1ed8fa340172.txt +25 -0
  208. package/scripts/notices/runtime-ab6eec6caf0fa5775e41.txt +275 -0
  209. package/scripts/notices/runtime-b1181a40b2a7b25cf66f.txt +19 -0
  210. package/scripts/notices/runtime-b71bd43a069ca0641a9e.txt +25 -0
  211. package/scripts/notices/runtime-c16f8dcf1a368b83be78.txt +201 -0
  212. package/scripts/notices/runtime-c2cfccb812fe482101a8.txt +21 -0
  213. package/scripts/notices/runtime-e99d88d232bf57d70f0f.txt +25 -0
  214. package/scripts/notices/runtime-f32fb3b417a194167cfa.txt +9 -0
  215. package/scripts/notices/runtime-f5062c9a188d81dfe66b.txt +39 -0
  216. package/scripts/notices/runtime-f9070a832833fa7488fd.txt +4 -0
  217. package/scripts/notices/runtime-fab3dd6bdab226f1c086.txt +373 -0
  218. package/scripts/notices/runtime-fba3318d0c600380177e.txt +62 -0
  219. package/scripts/notices/runtime-ff8f68cb076caf8cefe7.txt +25 -0
  220. package/scripts/notices/runtime-ff92bed461f50338dd70.txt +74 -0
  221. package/scripts/notices/runtime.json +1632 -0
  222. package/scripts/notices/sources.json +561 -0
  223. package/scripts/notices/xray-MIT.txt +21 -0
  224. package/src/attribute-object.ts +71 -0
  225. package/src/attributes.ts +308 -0
  226. package/src/cheerio-compat/css.ts +58 -0
  227. package/src/cheerio-compat/render.ts +106 -0
  228. package/src/cheerio-compat/selectors.ts +51 -0
  229. package/src/cheerio-compat/types.ts +52 -0
  230. package/src/cheerio-compat.ts +2055 -0
  231. package/src/codec.ts +96 -0
  232. package/src/dom.ts +87 -0
  233. package/src/extract-plan.ts +97 -0
  234. package/src/extract.ts +322 -0
  235. package/src/hooks.ts +369 -0
  236. package/src/index.ts +48 -0
  237. package/src/io.ts +491 -0
  238. package/src/match.ts +207 -0
  239. package/src/modern.ts +259 -0
  240. package/src/native.ts +149 -0
  241. package/src/nodes.ts +831 -0
  242. package/src/parse.ts +53 -0
  243. package/src/parser-types.ts +157 -0
  244. package/src/router.ts +1129 -0
  245. package/src/selection.ts +682 -0
  246. package/src/slim.ts +12 -0
  247. package/src/snapshot.ts +291 -0
  248. package/src/transport.ts +113 -0
  249. package/src/types.ts +186 -0
  250. package/src/utils.ts +29 -0
  251. package/src/workers.ts +21 -0
  252. package/tsconfig.json +15 -0
  253. package/tsdown.config.mjs +17 -0
package/dist/slim.cjs ADDED
@@ -0,0 +1,16 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_modern = require("./modern-CHQGP0Yt.cjs");
3
+ // src/slim.ts
4
+ /** Parser-compatible slim entry point, backed by the native fragment parser. */
5
+ function load(content, options, _isDocument) {
6
+ return require_modern.load(content, {
7
+ ...options,
8
+ _useHtmlParser2: true
9
+ }, false);
10
+ }
11
+ exports.contains = require_modern.contains;
12
+ exports.dom = require_modern.dom;
13
+ exports.load = load;
14
+ exports.merge = require_modern.merge;
15
+
16
+ //# sourceMappingURL=slim.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"slim.cjs","names":["loadNative"],"sources":["../src/slim.ts"],"sourcesContent":["import { load as loadNative, contains, merge } from './modern.js';\nimport type { CheerioAPI, CheerioOptions, LoadContent } from './types.js';\n\nexport { contains, merge };\nexport { dom } from './modern.js';\nexport type * from './types.js';\nexport type { Cheerio } from './selection.js';\n\n/** Parser-compatible slim entry point, backed by the native fragment parser. */\nexport function load(content: LoadContent, options?: CheerioOptions | null, _isDocument?: boolean): CheerioAPI {\n return loadNative(content, { ...options, _useHtmlParser2: true }, false);\n}\n"],"mappings":";;;;AASA,SAAgB,KAAK,SAAsB,SAAiC,aAAmC;CAC7G,OAAOA,eAAAA,KAAW,SAAS;EAAE,GAAG;EAAS,iBAAiB;CAAK,GAAG,KAAK;AACzE"}
@@ -0,0 +1,6 @@
1
+ import { l as merge, r as dom, t as contains } from "./modern-B7hyW4cI.cjs";
2
+ import { A as NodeWithChildren, B as NamespaceURI, C as ExtractionResult, D as InternalOptions, E as HTMLParser2Options, F as SerializedField, G as TokenizerCallbacks, H as ParserErrorCode, I as SourceCodeLocation, J as TreeAdapter, K as TokenizerConstructor, L as TagSourceCodeLocation, M as ParentNode, N as ProcessingInstruction, O as LoadContent, P as SelectorType, R as Text, S as ExtractionMap, T as FormDataLike, U as ParserErrorHandler, V as ParserError, W as Tokenizer, X as Cheerio, Y as TreeAdapterAttribute, _ as ExtractDescriptor, a as CDATA, b as ExtractedValue, c as CheerioRequestOptions, d as DataNode, f as DecodeStreamOptions, g as EncodingOptions, h as ElementType, i as BasicAcceptedElems, j as ParallelOptions, k as Node, l as ChildNode, m as Element, n as AcceptedFilters, o as CheerioAPI, p as Document, q as TokenizerOptions, r as AnyNode, s as CheerioOptions, t as AcceptedElems, u as Comment, v as ExtractMap, w as FilterFunction, x as ExtractionDescriptor, y as ExtractedMap, z as DocumentMode } from "./types-CA01Zg3r.cjs";
3
+ /** Parser-compatible slim entry point, backed by the native fragment parser. */
4
+ export declare function load(content: LoadContent, options?: CheerioOptions | null, _isDocument?: boolean): CheerioAPI;
5
+ export {type AcceptedElems, type AcceptedFilters, type AnyNode, type BasicAcceptedElems, type CDATA, type Cheerio, type CheerioAPI, type CheerioOptions, type CheerioRequestOptions, type ChildNode, type Comment, type DataNode, type DecodeStreamOptions, type Document, type DocumentMode, type Element, type ElementType, type EncodingOptions, type ExtractDescriptor, type ExtractMap, type ExtractedMap, type ExtractedValue, type ExtractionDescriptor, type ExtractionMap, type ExtractionResult, type FilterFunction, type FormDataLike, type HTMLParser2Options, type InternalOptions, type LoadContent, type NamespaceURI, type Node, type NodeWithChildren, type ParallelOptions, type ParentNode, type ParserError, type ParserErrorCode, type ParserErrorHandler, type ProcessingInstruction, type SelectorType, type SerializedField, type SourceCodeLocation, type TagSourceCodeLocation, type Text, type Tokenizer, type TokenizerCallbacks, type TokenizerConstructor, type TokenizerOptions, type TreeAdapter, type TreeAdapterAttribute, contains, dom, merge};
6
+ //# sourceMappingURL=slim.d.cts.map
@@ -0,0 +1,6 @@
1
+ import { l as merge, r as dom, t as contains } from "./modern-CJvSD_y5.mjs";
2
+ import { A as NodeWithChildren, B as NamespaceURI, C as ExtractionResult, D as InternalOptions, E as HTMLParser2Options, F as SerializedField, G as TokenizerCallbacks, H as ParserErrorCode, I as SourceCodeLocation, J as TreeAdapter, K as TokenizerConstructor, L as TagSourceCodeLocation, M as ParentNode, N as ProcessingInstruction, O as LoadContent, P as SelectorType, R as Text, S as ExtractionMap, T as FormDataLike, U as ParserErrorHandler, V as ParserError, W as Tokenizer, X as Cheerio, Y as TreeAdapterAttribute, _ as ExtractDescriptor, a as CDATA, b as ExtractedValue, c as CheerioRequestOptions, d as DataNode, f as DecodeStreamOptions, g as EncodingOptions, h as ElementType, i as BasicAcceptedElems, j as ParallelOptions, k as Node, l as ChildNode, m as Element, n as AcceptedFilters, o as CheerioAPI, p as Document, q as TokenizerOptions, r as AnyNode, s as CheerioOptions, t as AcceptedElems, u as Comment, v as ExtractMap, w as FilterFunction, x as ExtractionDescriptor, y as ExtractedMap, z as DocumentMode } from "./types-CA01Zg3r.mjs";
3
+ /** Parser-compatible slim entry point, backed by the native fragment parser. */
4
+ export declare function load(content: LoadContent, options?: CheerioOptions | null, _isDocument?: boolean): CheerioAPI;
5
+ export {type AcceptedElems, type AcceptedFilters, type AnyNode, type BasicAcceptedElems, type CDATA, type Cheerio, type CheerioAPI, type CheerioOptions, type CheerioRequestOptions, type ChildNode, type Comment, type DataNode, type DecodeStreamOptions, type Document, type DocumentMode, type Element, type ElementType, type EncodingOptions, type ExtractDescriptor, type ExtractMap, type ExtractedMap, type ExtractedValue, type ExtractionDescriptor, type ExtractionMap, type ExtractionResult, type FilterFunction, type FormDataLike, type HTMLParser2Options, type InternalOptions, type LoadContent, type NamespaceURI, type Node, type NodeWithChildren, type ParallelOptions, type ParentNode, type ParserError, type ParserErrorCode, type ParserErrorHandler, type ProcessingInstruction, type SelectorType, type SerializedField, type SourceCodeLocation, type TagSourceCodeLocation, type Text, type Tokenizer, type TokenizerCallbacks, type TokenizerConstructor, type TokenizerOptions, type TreeAdapter, type TreeAdapterAttribute, contains, dom, merge};
6
+ //# sourceMappingURL=slim.d.mts.map
package/dist/slim.d.ts ADDED
@@ -0,0 +1,6 @@
1
+ import { l as merge, r as dom, t as contains } from "./modern-B7hyW4cI.cjs";
2
+ import { A as NodeWithChildren, B as NamespaceURI, C as ExtractionResult, D as InternalOptions, E as HTMLParser2Options, F as SerializedField, G as TokenizerCallbacks, H as ParserErrorCode, I as SourceCodeLocation, J as TreeAdapter, K as TokenizerConstructor, L as TagSourceCodeLocation, M as ParentNode, N as ProcessingInstruction, O as LoadContent, P as SelectorType, R as Text, S as ExtractionMap, T as FormDataLike, U as ParserErrorHandler, V as ParserError, W as Tokenizer, X as Cheerio, Y as TreeAdapterAttribute, _ as ExtractDescriptor, a as CDATA, b as ExtractedValue, c as CheerioRequestOptions, d as DataNode, f as DecodeStreamOptions, g as EncodingOptions, h as ElementType, i as BasicAcceptedElems, j as ParallelOptions, k as Node, l as ChildNode, m as Element, n as AcceptedFilters, o as CheerioAPI, p as Document, q as TokenizerOptions, r as AnyNode, s as CheerioOptions, t as AcceptedElems, u as Comment, v as ExtractMap, w as FilterFunction, x as ExtractionDescriptor, y as ExtractedMap, z as DocumentMode } from "./types-CA01Zg3r.cjs";
3
+ /** Parser-compatible slim entry point, backed by the native fragment parser. */
4
+ export declare function load(content: LoadContent, options?: CheerioOptions | null, _isDocument?: boolean): CheerioAPI;
5
+ export {type AcceptedElems, type AcceptedFilters, type AnyNode, type BasicAcceptedElems, type CDATA, type Cheerio, type CheerioAPI, type CheerioOptions, type CheerioRequestOptions, type ChildNode, type Comment, type DataNode, type DecodeStreamOptions, type Document, type DocumentMode, type Element, type ElementType, type EncodingOptions, type ExtractDescriptor, type ExtractMap, type ExtractedMap, type ExtractedValue, type ExtractionDescriptor, type ExtractionMap, type ExtractionResult, type FilterFunction, type FormDataLike, type HTMLParser2Options, type InternalOptions, type LoadContent, type NamespaceURI, type Node, type NodeWithChildren, type ParallelOptions, type ParentNode, type ParserError, type ParserErrorCode, type ParserErrorHandler, type ProcessingInstruction, type SelectorType, type SerializedField, type SourceCodeLocation, type TagSourceCodeLocation, type Text, type Tokenizer, type TokenizerCallbacks, type TokenizerConstructor, type TokenizerOptions, type TreeAdapter, type TreeAdapterAttribute, contains, dom, merge};
6
+ //# sourceMappingURL=slim.d.cts.map
package/dist/slim.mjs ADDED
@@ -0,0 +1,12 @@
1
+ import { l as merge, o as load$1, r as dom, t as contains } from "./modern-CvXcTn82.mjs";
2
+ // src/slim.ts
3
+ /** Parser-compatible slim entry point, backed by the native fragment parser. */
4
+ function load(content, options, _isDocument) {
5
+ return load$1(content, {
6
+ ...options,
7
+ _useHtmlParser2: true
8
+ }, false);
9
+ }
10
+ export { contains, dom, load, merge };
11
+
12
+ //# sourceMappingURL=slim.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"slim.mjs","names":["loadNative"],"sources":["../src/slim.ts"],"sourcesContent":["import { load as loadNative, contains, merge } from './modern.js';\nimport type { CheerioAPI, CheerioOptions, LoadContent } from './types.js';\n\nexport { contains, merge };\nexport { dom } from './modern.js';\nexport type * from './types.js';\nexport type { Cheerio } from './selection.js';\n\n/** Parser-compatible slim entry point, backed by the native fragment parser. */\nexport function load(content: LoadContent, options?: CheerioOptions | null, _isDocument?: boolean): CheerioAPI {\n return loadNative(content, { ...options, _useHtmlParser2: true }, false);\n}\n"],"mappings":";;;AASA,SAAgB,KAAK,SAAsB,SAAiC,aAAmC;CAC7G,OAAOA,OAAW,SAAS;EAAE,GAAG;EAAS,iBAAiB;CAAK,GAAG,KAAK;AACzE"}
@@ -0,0 +1,526 @@
1
+ /**
2
+ * The compact record copy returned by `NativeDocument.snapshot()`: the
3
+ * lengths of the node, child, attribute and string lists, whether any string
4
+ * holds codec escapes, then the lists.
5
+ */
6
+ interface NativeSnapshot {
7
+ data: Uint32Array;
8
+ text: string;
9
+ }
10
+ interface NativeDocument {
11
+ readonly nodeSpace?: object;
12
+ retainNode?(id: number): void;
13
+ retainNodeData?(id: number, data: object): void;
14
+ adopt?(source: NativeDocument, ids: number[], detach?: boolean): string;
15
+ op(command: string, argsJson: string): string;
16
+ create?(html: string, contextId?: number, optionsJson?: string): number[];
17
+ select(selector: string, contexts?: number[]): number[];
18
+ text(ids: number[]): string;
19
+ innerHtml(id: number): string;
20
+ outerHtml(ids: number[]): string;
21
+ attr(id: number, name: string): string | undefined | null;
22
+ tagName(id: number): string | undefined | null;
23
+ exportTree(): string;
24
+ exportTreeWithOffset?(base: number): string;
25
+ forestRoots?(): number[];
26
+ rootId(): number;
27
+ takePreparedPlans?(): (string | null)[] | null;
28
+ takePreparedSnapshot?(isWanted: boolean): NativeSnapshot | null;
29
+ parserDiagnostics?(): string;
30
+ }
31
+ interface NativeWorkerPoolInfo {
32
+ threads: number;
33
+ activeBatches: number;
34
+ activeWorkers: number;
35
+ peakActiveWorkers: number;
36
+ }
37
+ /** Useful for installation diagnostics and benchmarks that require native code. */
38
+ declare function nativeStatus(): {
39
+ available: boolean;
40
+ error?: string;
41
+ };
42
+ interface StyleProp {
43
+ length: number;
44
+ [key: string]: string | number;
45
+ [index: number]: string;
46
+ }
47
+ interface AttributeMethods<T = AnyNode> {
48
+ attr<U extends AnyNode>(this: Cheerio<U>, name: string): string | undefined;
49
+ attr<U extends AnyNode>(this: Cheerio<U>): Record<string, string> | undefined;
50
+ attr<U extends AnyNode>(this: Cheerio<U>, name: string, value?: string | null | ((this: Element, index: number, value: string) => string | null)): Cheerio<U>;
51
+ attr<U extends AnyNode>(this: Cheerio<U>, values: Record<string, string | null>): Cheerio<U>;
52
+ prop<U extends AnyNode>(this: Cheerio<U>, name: 'tagName' | 'nodeName'): string | undefined;
53
+ prop<U extends AnyNode>(this: Cheerio<U>, name: 'innerHTML' | 'outerHTML' | 'innerText' | 'textContent'): string | null;
54
+ prop<U extends AnyNode>(this: Cheerio<U>, name: 'style'): StyleProp | undefined;
55
+ prop<U extends AnyNode>(this: Cheerio<U>, name: 'href' | 'src'): string | undefined;
56
+ prop<U extends AnyNode, K extends keyof Element>(this: Cheerio<U>, name: K): Element[K];
57
+ prop<U extends AnyNode, K extends keyof Element>(this: Cheerio<U>, name: K, value: Element[K] | ((this: Element, index: number, property: K) => Element[keyof Element])): Cheerio<U>;
58
+ prop<U extends AnyNode>(this: Cheerio<U>, values: Record<string, string | Element[keyof Element] | boolean>): Cheerio<U>;
59
+ prop<U extends AnyNode>(this: Cheerio<U>, name: string, value: string | boolean | null | ((this: Element, index: number, property: string) => string | boolean)): Cheerio<U>;
60
+ prop<U extends AnyNode>(this: Cheerio<U>, name: string): string;
61
+ data<U extends AnyNode>(this: Cheerio<U>, name: string): unknown;
62
+ data<U extends AnyNode>(this: Cheerio<U>): Record<string, unknown>;
63
+ data<U extends AnyNode>(this: Cheerio<U>, name: string, value: unknown): Cheerio<U>;
64
+ data<U extends AnyNode>(this: Cheerio<U>, values: Record<string, unknown>): Cheerio<U>;
65
+ val<U extends AnyNode>(this: Cheerio<U>): string | string[] | undefined;
66
+ val<U extends AnyNode>(this: Cheerio<U>, value: string | string[]): Cheerio<U>;
67
+ removeAttr<U extends AnyNode>(this: Cheerio<U>, name: string): Cheerio<U>;
68
+ hasClass<U extends AnyNode>(this: Cheerio<U>, name: string): boolean;
69
+ addClass<U extends AnyNode, R extends ArrayLike<U>>(this: R, name?: string | ((this: Element, index: number, current: string) => string | undefined)): R;
70
+ removeClass<U extends AnyNode, R extends ArrayLike<U>>(this: R, name?: string | ((this: Element, index: number, current: string) => string | undefined)): R;
71
+ toggleClass<U extends AnyNode, R extends ArrayLike<U>>(this: R, name?: string | ((this: Element, index: number, current: string, state?: boolean) => string), state?: boolean): R;
72
+ css<U extends AnyNode>(this: Cheerio<U>, names?: string[]): Record<string, string> | undefined;
73
+ css<U extends AnyNode>(this: Cheerio<U>, name: string): string | undefined;
74
+ css<U extends AnyNode>(this: Cheerio<U>, name: string, value: string | ((this: Element, index: number, current: string) => string | undefined)): Cheerio<U>;
75
+ css<U extends AnyNode>(this: Cheerio<U>, values: Record<string, string>): Cheerio<U>;
76
+ serializeArray<U extends AnyNode>(this: Cheerio<U>): SerializedField[];
77
+ serialize<U extends AnyNode>(this: Cheerio<U>): string;
78
+ }
79
+ /** An array-like selection of native nodes. */
80
+ declare class Cheerio<T = AnyNode> implements ArrayLike<T>, Iterable<T> {
81
+ [index: number]: T;
82
+ length: number;
83
+ options: CheerioOptions;
84
+ _root: Cheerio<Document> | null;
85
+ prevObject: Cheerio<any> | undefined;
86
+ cheerio: '[cheerio object]';
87
+ constructor(api: CheerioAPI, document: NativeDocument, ids?: number[], root?: Cheerio<Document> | null, options?: CheerioOptions, values?: T[]);
88
+ _make<R>(value: ArrayLike<R> | R | string, context?: BasicAcceptedElems<AnyNode>): Cheerio<R>;
89
+ _parse(content: any, options: CheerioOptions, isDocument: boolean, context: ParentNode | null): Document;
90
+ _render(content: any): string;
91
+ _makeDomArray<T extends AnyNode>(this: Cheerio<T>, elem?: BasicAcceptedElems<AnyNode> | BasicAcceptedElems<AnyNode>[], clone?: boolean): AnyNode[];
92
+ find<T extends AnyNode>(this: Cheerio<T>, selectorOrHaystack?: string | Cheerio<Element> | Element): Cheerio<Element>;
93
+ _findBySelector<T extends AnyNode>(this: Cheerio<T>, selector: string, limit: number): Cheerio<Element>;
94
+ parent<T extends AnyNode>(this: Cheerio<T>, selector?: AcceptedFilters<Element>): Cheerio<Element>;
95
+ parents<T extends AnyNode>(this: Cheerio<T>, selector?: AcceptedFilters<Element>): Cheerio<Element>;
96
+ next<T extends AnyNode>(this: Cheerio<T>, selector?: AcceptedFilters<Element>): Cheerio<Element>;
97
+ prev<T extends AnyNode>(this: Cheerio<T>, selector?: AcceptedFilters<Element>): Cheerio<Element>;
98
+ nextAll<T extends AnyNode>(this: Cheerio<T>, selector?: AcceptedFilters<Element>): Cheerio<Element>;
99
+ prevAll<T extends AnyNode>(this: Cheerio<T>, selector?: AcceptedFilters<Element>): Cheerio<Element>;
100
+ siblings<T extends AnyNode>(this: Cheerio<T>, selector?: AcceptedFilters<Element>): Cheerio<Element>;
101
+ children<T extends AnyNode>(this: Cheerio<T>, selector?: AcceptedFilters<Element>): Cheerio<Element>;
102
+ contents<T extends AnyNode>(this: Cheerio<T>): Cheerio<AnyNode>;
103
+ parentsUntil<T extends AnyNode>(this: Cheerio<T>, selector?: AcceptedFilters<Element> | null, filterSelector?: AcceptedFilters<Element>): Cheerio<Element>;
104
+ nextUntil<T extends AnyNode>(this: Cheerio<T>, selector?: AcceptedFilters<Element> | null, filterSelector?: AcceptedFilters<Element>): Cheerio<Element>;
105
+ prevUntil<T extends AnyNode>(this: Cheerio<T>, selector?: AcceptedFilters<Element> | null, filterSelector?: AcceptedFilters<Element>): Cheerio<Element>;
106
+ closest<T extends AnyNode>(this: Cheerio<T>, selector?: AcceptedFilters<Element>): Cheerio<AnyNode>;
107
+ each<T>(this: Cheerio<T>, fn: (this: T, i: number, el: T) => void | boolean): Cheerio<T>;
108
+ map<T, M>(this: Cheerio<T>, fn: (this: T, i: number, el: T) => M[] | M | null | undefined): Cheerio<M>;
109
+ filter<T, S extends T>(this: Cheerio<T>, match: (this: T, index: number, value: T) => value is S): Cheerio<S>;
110
+ filter<T, S extends AcceptedFilters<T>>(this: Cheerio<T>, match: S): Cheerio<S extends string ? Element : T>;
111
+ filterArray<T>(nodes: T[], match: AcceptedFilters<T>, xmlMode?: boolean, root?: Document): Element[] | T[];
112
+ not<T extends AnyNode>(this: Cheerio<T>, match: AcceptedFilters<T>): Cheerio<T>;
113
+ is<T>(this: Cheerio<T>, selector?: AcceptedFilters<T>): boolean;
114
+ has(this: Cheerio<AnyNode | Element>, selectorOrHaystack: string | Cheerio<Element> | Element): Cheerio<AnyNode | Element>;
115
+ first<T extends AnyNode>(this: Cheerio<T>): Cheerio<T>;
116
+ last<T>(this: Cheerio<T>): Cheerio<T>;
117
+ eq<T>(this: Cheerio<T>, i: number): Cheerio<T>;
118
+ get<T>(this: Cheerio<T>, i: number): T | undefined;
119
+ get<T>(this: Cheerio<T>): T[];
120
+ toArray<T>(this: Cheerio<T>): T[];
121
+ slice<T>(this: Cheerio<T>, start?: number, end?: number): Cheerio<T>;
122
+ end<T>(this: Cheerio<T>): Cheerio<AnyNode>;
123
+ add<S extends AnyNode, T extends AnyNode>(this: Cheerio<T>, other: string | Cheerio<S> | S | S[], context?: Cheerio<S> | string): Cheerio<S | T>;
124
+ addBack<T extends AnyNode>(this: Cheerio<T>, selector?: string): Cheerio<AnyNode>;
125
+ index<T extends AnyNode>(this: Cheerio<T>, selectorOrNeedle?: string | Cheerio<AnyNode> | AnyNode): number;
126
+ splice(start: number, deleteCount?: number): any[];
127
+ splice(start: number, deleteCount: number, ...items: any[]): any[];
128
+ [Symbol.iterator](): Iterator<T>;
129
+ append<T extends AnyNode>(this: Cheerio<T>, ...elems: [(this: AnyNode, i: number, html: string) => BasicAcceptedElems<AnyNode>] | BasicAcceptedElems<AnyNode>[]): Cheerio<T>;
130
+ prepend<T extends AnyNode>(this: Cheerio<T>, ...elems: [(this: AnyNode, i: number, html: string) => BasicAcceptedElems<AnyNode>] | BasicAcceptedElems<AnyNode>[]): Cheerio<T>;
131
+ before<T extends AnyNode>(this: Cheerio<T>, ...elems: [(this: AnyNode, i: number, html: string) => BasicAcceptedElems<AnyNode>] | BasicAcceptedElems<AnyNode>[]): Cheerio<T>;
132
+ after<T extends AnyNode>(this: Cheerio<T>, ...elems: [(this: AnyNode, i: number, html: string) => BasicAcceptedElems<AnyNode>] | BasicAcceptedElems<AnyNode>[]): Cheerio<T>;
133
+ appendTo<T extends AnyNode>(this: Cheerio<T>, target: BasicAcceptedElems<AnyNode>): Cheerio<T>;
134
+ prependTo<T extends AnyNode>(this: Cheerio<T>, target: BasicAcceptedElems<AnyNode>): Cheerio<T>;
135
+ insertBefore<T extends AnyNode>(this: Cheerio<T>, target: BasicAcceptedElems<AnyNode>): Cheerio<T>;
136
+ insertAfter<T extends AnyNode>(this: Cheerio<T>, target: BasicAcceptedElems<AnyNode>): Cheerio<T>;
137
+ remove<T extends AnyNode>(this: Cheerio<T>, selector?: string): Cheerio<T>;
138
+ replaceWith<T extends AnyNode>(this: Cheerio<T>, content: AcceptedElems<AnyNode>): Cheerio<T>;
139
+ empty<T extends AnyNode>(this: Cheerio<T>): Cheerio<T>;
140
+ html<T extends AnyNode>(this: Cheerio<T>): string | null;
141
+ html<T extends AnyNode>(this: Cheerio<T>, str: string | Cheerio<T>): Cheerio<T>;
142
+ text<T extends AnyNode>(this: Cheerio<T>): string;
143
+ text<T extends AnyNode>(this: Cheerio<T>, str: string | ((this: AnyNode, i: number, text: string) => string)): Cheerio<T>;
144
+ toString<T extends AnyNode>(this: Cheerio<T>): string;
145
+ clone<T extends AnyNode>(this: Cheerio<T>): Cheerio<T>;
146
+ wrap<T extends AnyNode>(this: Cheerio<T>, wrapper: AcceptedElems<AnyNode>): Cheerio<T>;
147
+ wrapInner<T extends AnyNode>(this: Cheerio<T>, wrapper: AcceptedElems<AnyNode>): Cheerio<T>;
148
+ unwrap<T extends AnyNode>(this: Cheerio<T>, selector?: string): Cheerio<T>;
149
+ wrapAll<T extends AnyNode>(this: Cheerio<T>, wrapper: AcceptedElems<T>): Cheerio<T>;
150
+ extract<M extends ExtractMap, T extends AnyNode>(this: Cheerio<T>, map: M): ExtractedMap<M>;
151
+ extract<M extends ExtractMap, T extends AnyNode>(this: Cheerio<T>, map: M): Record<string, unknown>;
152
+ }
153
+ interface Cheerio<T = AnyNode> extends AttributeMethods<T> {}
154
+ /** Parse5-compatible diagnostics, declared locally without a parser dependency. */
155
+ declare enum ERR {
156
+ controlCharacterInInputStream = "control-character-in-input-stream",
157
+ noncharacterInInputStream = "noncharacter-in-input-stream",
158
+ surrogateInInputStream = "surrogate-in-input-stream",
159
+ nonVoidHtmlElementStartTagWithTrailingSolidus = "non-void-html-element-start-tag-with-trailing-solidus",
160
+ endTagWithAttributes = "end-tag-with-attributes",
161
+ endTagWithTrailingSolidus = "end-tag-with-trailing-solidus",
162
+ unexpectedSolidusInTag = "unexpected-solidus-in-tag",
163
+ unexpectedNullCharacter = "unexpected-null-character",
164
+ unexpectedQuestionMarkInsteadOfTagName = "unexpected-question-mark-instead-of-tag-name",
165
+ invalidFirstCharacterOfTagName = "invalid-first-character-of-tag-name",
166
+ unexpectedEqualsSignBeforeAttributeName = "unexpected-equals-sign-before-attribute-name",
167
+ missingEndTagName = "missing-end-tag-name",
168
+ unexpectedCharacterInAttributeName = "unexpected-character-in-attribute-name",
169
+ unknownNamedCharacterReference = "unknown-named-character-reference",
170
+ missingSemicolonAfterCharacterReference = "missing-semicolon-after-character-reference",
171
+ unexpectedCharacterAfterDoctypeSystemIdentifier = "unexpected-character-after-doctype-system-identifier",
172
+ unexpectedCharacterInUnquotedAttributeValue = "unexpected-character-in-unquoted-attribute-value",
173
+ eofBeforeTagName = "eof-before-tag-name",
174
+ eofInTag = "eof-in-tag",
175
+ missingAttributeValue = "missing-attribute-value",
176
+ missingWhitespaceBetweenAttributes = "missing-whitespace-between-attributes",
177
+ missingWhitespaceAfterDoctypePublicKeyword = "missing-whitespace-after-doctype-public-keyword",
178
+ missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers = "missing-whitespace-between-doctype-public-and-system-identifiers",
179
+ missingWhitespaceAfterDoctypeSystemKeyword = "missing-whitespace-after-doctype-system-keyword",
180
+ missingQuoteBeforeDoctypePublicIdentifier = "missing-quote-before-doctype-public-identifier",
181
+ missingQuoteBeforeDoctypeSystemIdentifier = "missing-quote-before-doctype-system-identifier",
182
+ missingDoctypePublicIdentifier = "missing-doctype-public-identifier",
183
+ missingDoctypeSystemIdentifier = "missing-doctype-system-identifier",
184
+ abruptDoctypePublicIdentifier = "abrupt-doctype-public-identifier",
185
+ abruptDoctypeSystemIdentifier = "abrupt-doctype-system-identifier",
186
+ cdataInHtmlContent = "cdata-in-html-content",
187
+ incorrectlyOpenedComment = "incorrectly-opened-comment",
188
+ eofInScriptHtmlCommentLikeText = "eof-in-script-html-comment-like-text",
189
+ eofInDoctype = "eof-in-doctype",
190
+ nestedComment = "nested-comment",
191
+ abruptClosingOfEmptyComment = "abrupt-closing-of-empty-comment",
192
+ eofInComment = "eof-in-comment",
193
+ incorrectlyClosedComment = "incorrectly-closed-comment",
194
+ eofInCdata = "eof-in-cdata",
195
+ absenceOfDigitsInNumericCharacterReference = "absence-of-digits-in-numeric-character-reference",
196
+ nullCharacterReference = "null-character-reference",
197
+ surrogateCharacterReference = "surrogate-character-reference",
198
+ characterReferenceOutsideUnicodeRange = "character-reference-outside-unicode-range",
199
+ controlCharacterReference = "control-character-reference",
200
+ noncharacterCharacterReference = "noncharacter-character-reference",
201
+ missingWhitespaceBeforeDoctypeName = "missing-whitespace-before-doctype-name",
202
+ missingDoctypeName = "missing-doctype-name",
203
+ invalidCharacterSequenceAfterDoctypeName = "invalid-character-sequence-after-doctype-name",
204
+ duplicateAttribute = "duplicate-attribute",
205
+ nonConformingDoctype = "non-conforming-doctype",
206
+ missingDoctype = "missing-doctype",
207
+ misplacedDoctype = "misplaced-doctype",
208
+ endTagWithoutMatchingOpenElement = "end-tag-without-matching-open-element",
209
+ closingOfElementWithOpenChildElements = "closing-of-element-with-open-child-elements",
210
+ disallowedContentInNoscriptInHead = "disallowed-content-in-noscript-in-head",
211
+ openElementsLeftAfterEof = "open-elements-left-after-eof",
212
+ abandonedHeadElementChild = "abandoned-head-element-child",
213
+ misplacedStartTagForHeadElement = "misplaced-start-tag-for-head-element",
214
+ nestedNoscriptInHead = "nested-noscript-in-head",
215
+ eofInElementThatCanContainOnlyText = "eof-in-element-that-can-contain-only-text"
216
+ }
217
+ type ParserErrorCode = ERR;
218
+ interface ParserError extends SourceCodeLocation {
219
+ code: ParserErrorCode;
220
+ }
221
+ type ParserErrorHandler = (error: ParserError) => void;
222
+ declare enum NS {
223
+ HTML = "http://www.w3.org/1999/xhtml",
224
+ MATHML = "http://www.w3.org/1998/Math/MathML",
225
+ SVG = "http://www.w3.org/2000/svg",
226
+ XLINK = "http://www.w3.org/1999/xlink",
227
+ XML = "http://www.w3.org/XML/1998/namespace",
228
+ XMLNS = "http://www.w3.org/2000/xmlns/"
229
+ }
230
+ declare enum DOCUMENT_MODE {
231
+ NO_QUIRKS = "no-quirks",
232
+ QUIRKS = "quirks",
233
+ LIMITED_QUIRKS = "limited-quirks"
234
+ }
235
+ type NamespaceURI = NS;
236
+ type DocumentMode = DOCUMENT_MODE;
237
+ interface TreeAdapterAttribute {
238
+ name: string;
239
+ value: string;
240
+ namespace?: string;
241
+ prefix?: string;
242
+ }
243
+ /** The HTML5 adapter shape used by Cheerio's DOM representation. */
244
+ interface TreeAdapter {
245
+ adoptAttributes(recipient: Element, attrs: TreeAdapterAttribute[]): void;
246
+ appendChild(parentNode: ParentNode, newNode: ChildNode): void;
247
+ createCommentNode(data: string): Comment;
248
+ createTextNode(value: string): Text;
249
+ createDocument(): Document;
250
+ createDocumentFragment(): Document;
251
+ createElement(tagName: string, namespaceURI: NamespaceURI, attrs: TreeAdapterAttribute[]): Element;
252
+ detachNode(node: ChildNode): void;
253
+ getAttrList(element: Element): TreeAdapterAttribute[];
254
+ getChildNodes(node: ParentNode): ChildNode[];
255
+ getCommentNodeContent(node: Comment): string;
256
+ getDocumentMode(document: Document): DocumentMode;
257
+ getDocumentTypeNodeName(node: ProcessingInstruction): string;
258
+ getDocumentTypeNodePublicId(node: ProcessingInstruction): string;
259
+ getDocumentTypeNodeSystemId(node: ProcessingInstruction): string;
260
+ getFirstChild(node: ParentNode): ChildNode | null;
261
+ getNamespaceURI(element: Element): NamespaceURI;
262
+ getNodeSourceCodeLocation(node: AnyNode): TagSourceCodeLocation | undefined | null;
263
+ getParentNode(node: AnyNode): ParentNode | null;
264
+ getTagName(element: Element): string;
265
+ getTextNodeContent(node: Text): string;
266
+ getTemplateContent(element: Element): Document;
267
+ insertBefore(parent: ParentNode, child: ChildNode, reference: ChildNode): void;
268
+ insertText(parent: ParentNode, text: string): void;
269
+ insertTextBefore(parent: ParentNode, text: string, reference: ChildNode): void;
270
+ isCommentNode(node: AnyNode): node is Comment;
271
+ isDocumentTypeNode(node: AnyNode): node is ProcessingInstruction;
272
+ isElementNode(node: AnyNode): node is Element;
273
+ isTextNode(node: AnyNode): node is Text;
274
+ setDocumentMode(document: Document, mode: DocumentMode): void;
275
+ setDocumentType(document: Document, name: string, publicId: string, systemId: string): void;
276
+ setNodeSourceCodeLocation(node: AnyNode, location: TagSourceCodeLocation | null): void;
277
+ updateNodeSourceCodeLocation(node: AnyNode, location: Partial<TagSourceCodeLocation>): void;
278
+ setTemplateContent(element: Element, content: Document): void;
279
+ onItemPush?: (item: Element) => void;
280
+ onItemPop?: (item: Element, newTop: ParentNode) => void;
281
+ }
282
+ declare enum QuoteType {
283
+ NoValue = 0,
284
+ Unquoted = 1,
285
+ Single = 2,
286
+ Double = 3
287
+ }
288
+ interface TokenizerCallbacks {
289
+ onattribdata(start: number, endIndex: number): void;
290
+ onattribentity(codepoint: number): void;
291
+ onattribend(quote: QuoteType, endIndex: number): void;
292
+ onattribname(start: number, endIndex: number): void;
293
+ oncdata(start: number, endIndex: number, endOffset: number): void;
294
+ onclosetag(start: number, endIndex: number): void;
295
+ oncomment(start: number, endIndex: number, endOffset: number): void;
296
+ ondeclaration(start: number, endIndex: number): void;
297
+ onend(): void;
298
+ onopentagend(endIndex: number): void;
299
+ onopentagname(start: number, endIndex: number): void;
300
+ onprocessinginstruction(start: number, endIndex: number): void;
301
+ onselfclosingtag(endIndex: number): void;
302
+ ontext(start: number, endIndex: number): void;
303
+ ontextentity(codepoint: number, endIndex: number): void;
304
+ }
305
+ interface Tokenizer {
306
+ running: boolean;
307
+ reset(): void;
308
+ write(chunk: string): void;
309
+ end(): void;
310
+ pause(): void;
311
+ resume(): void;
312
+ }
313
+ interface TokenizerOptions {
314
+ xmlMode?: boolean;
315
+ decodeEntities?: boolean;
316
+ }
317
+ interface TokenizerConstructor {
318
+ new (options: TokenizerOptions, callbacks: TokenizerCallbacks): Tokenizer;
319
+ new (options: TokenizerOptions, callbacks: TokenizerCallbacks): any;
320
+ }
321
+ /** DOM-compatible views over stable nodes owned by the native document. */
322
+ declare enum ElementType {
323
+ Root = "root",
324
+ Text = "text",
325
+ Directive = "directive",
326
+ Comment = "comment",
327
+ Script = "script",
328
+ Style = "style",
329
+ Tag = "tag",
330
+ CDATA = "cdata",
331
+ Doctype = "doctype"
332
+ }
333
+ interface SourceCodeLocation {
334
+ startLine: number;
335
+ startCol: number;
336
+ startOffset: number;
337
+ endLine: number;
338
+ endCol: number;
339
+ endOffset: number;
340
+ }
341
+ interface TagSourceCodeLocation extends SourceCodeLocation {
342
+ startTag?: SourceCodeLocation;
343
+ endTag?: SourceCodeLocation;
344
+ attrs?: Record<string, SourceCodeLocation>;
345
+ }
346
+ interface Node {
347
+ readonly type: ElementType;
348
+ parent: ParentNode | null;
349
+ prev: ChildNode | null;
350
+ next: ChildNode | null;
351
+ startIndex: number | null;
352
+ endIndex: number | null;
353
+ readonly nodeType: number;
354
+ parentNode: ParentNode | null;
355
+ previousSibling: ChildNode | null;
356
+ nextSibling: ChildNode | null;
357
+ sourceCodeLocation?: SourceCodeLocation | null;
358
+ cloneNode<T extends Node>(this: T, recursive?: boolean): T;
359
+ }
360
+ interface DataNode extends Node {
361
+ data: string;
362
+ nodeValue: string;
363
+ }
364
+ interface Text extends DataNode {
365
+ type: ElementType.Text;
366
+ readonly nodeType: 3;
367
+ }
368
+ interface Comment extends DataNode {
369
+ type: ElementType.Comment;
370
+ readonly nodeType: 8;
371
+ }
372
+ interface ProcessingInstruction extends DataNode {
373
+ type: ElementType.Directive;
374
+ name: string;
375
+ readonly nodeType: 1;
376
+ 'x-name'?: string;
377
+ 'x-publicId'?: string;
378
+ 'x-systemId'?: string;
379
+ }
380
+ interface NodeWithChildren extends Node {
381
+ children: ChildNode[];
382
+ childNodes: ChildNode[];
383
+ readonly firstChild: ChildNode | null;
384
+ readonly lastChild: ChildNode | null;
385
+ }
386
+ interface Document extends NodeWithChildren {
387
+ type: ElementType.Root;
388
+ readonly nodeType: 9;
389
+ 'x-mode'?: 'quirks' | 'limited-quirks' | 'no-quirks';
390
+ }
391
+ interface CDATA extends NodeWithChildren {
392
+ type: ElementType.CDATA;
393
+ readonly nodeType: 4;
394
+ }
395
+ interface Element extends NodeWithChildren {
396
+ type: ElementType.Tag | ElementType.Script | ElementType.Style;
397
+ readonly nodeType: 1;
398
+ name: string;
399
+ tagName: string;
400
+ attribs: Record<string, string>;
401
+ namespace?: string;
402
+ sourceCodeLocation?: TagSourceCodeLocation | null;
403
+ readonly attributes: {
404
+ name: string;
405
+ value: string;
406
+ namespace?: string;
407
+ prefix?: string;
408
+ }[];
409
+ 'x-attribsNamespace'?: Record<string, string>;
410
+ 'x-attribsPrefix'?: Record<string, string>;
411
+ }
412
+ type ParentNode = Document | Element | CDATA;
413
+ type ChildNode = Text | Comment | ProcessingInstruction | Element | CDATA | Document;
414
+ type AnyNode = ParentNode | ChildNode;
415
+ interface HTMLParser2Options {
416
+ xmlMode?: boolean;
417
+ decodeEntities?: boolean;
418
+ encodeEntities?: boolean | 'utf8';
419
+ lowerCaseTags?: boolean;
420
+ lowerCaseAttributeNames?: boolean;
421
+ recognizeCDATA?: boolean;
422
+ recognizeSelfClosing?: boolean;
423
+ withStartIndices?: boolean;
424
+ withEndIndices?: boolean;
425
+ emptyAttrs?: boolean;
426
+ selfClosingTags?: boolean;
427
+ Tokenizer?: TokenizerConstructor;
428
+ [key: string]: any;
429
+ }
430
+ interface CheerioOptions extends HTMLParser2Options {
431
+ xml?: boolean | HTMLParser2Options;
432
+ baseURI?: string | URL;
433
+ quirksMode?: boolean;
434
+ scriptingEnabled?: boolean;
435
+ sourceCodeLocationInfo?: boolean;
436
+ treeAdapter?: TreeAdapter;
437
+ onParseError?: ParserErrorHandler | null;
438
+ pseudos?: Record<string, string | ((element: Element, value?: string | null) => boolean)>;
439
+ _useHtmlParser2?: boolean;
440
+ }
441
+ type InternalOptions = CheerioOptions;
442
+ type LowercaseLetters = 'a' | 'b' | 'c' | 'd' | 'e' | 'f' | 'g' | 'h' | 'i' | 'j' | 'k' | 'l' | 'm' | 'n' | 'o' | 'p' | 'q' | 'r' | 's' | 't' | 'u' | 'v' | 'w' | 'x' | 'y' | 'z';
443
+ type AlphaNumeric = LowercaseLetters | Uppercase<LowercaseLetters> | `${number}`;
444
+ type SelectorType = `${'.' | '#' | ':' | '|' | '>' | '+' | '~' | '['}${AlphaNumeric}${string}` | `${AlphaNumeric}${string}`;
445
+ type BasicAcceptedElems<T extends AnyNode = AnyNode> = ArrayLike<T> | T | string;
446
+ type AcceptedElems<T extends AnyNode = AnyNode> = BasicAcceptedElems<T> | ((this: T, index: number, element: T) => BasicAcceptedElems<T>);
447
+ type FilterFunction<T> = (this: T, index: number, element: T) => boolean;
448
+ type AcceptedFilters<T> = string | FilterFunction<T> | T | Cheerio<T>;
449
+ type LoadContent = string | Buffer | AnyNode | ArrayLike<AnyNode>;
450
+ interface CheerioAPI {
451
+ <T extends AnyNode, S extends string>(selector?: S | BasicAcceptedElems<T>, context?: BasicAcceptedElems<AnyNode> | null, root?: BasicAcceptedElems<Document>, options?: CheerioOptions): Cheerio<S extends SelectorType ? Element : T>;
452
+ <T extends AnyNode, S extends string>(selector?: S | BasicAcceptedElems<T>, context?: BasicAcceptedElems<AnyNode> | null, root?: BasicAcceptedElems<Document>, options?: CheerioOptions): Cheerio<AnyNode>;
453
+ html(options?: CheerioOptions): string;
454
+ html(dom?: BasicAcceptedElems<AnyNode> | Cheerio<AnyNode>, options?: CheerioOptions): string;
455
+ xml(dom?: BasicAcceptedElems<AnyNode> | Cheerio<AnyNode>): string;
456
+ text(elements?: ArrayLike<AnyNode>): string;
457
+ root(): Cheerio<Document>;
458
+ contains(container: AnyNode, contained: AnyNode): boolean;
459
+ merge<T>(first: ArrayLike<T>, second: ArrayLike<T>): ArrayLike<T> | undefined;
460
+ parseHTML(data: string, context?: unknown, keepScripts?: boolean): AnyNode[];
461
+ parseHTML(data?: '' | null): null;
462
+ load(content: LoadContent, options?: CheerioOptions | null, isDocument?: boolean): CheerioAPI;
463
+ extract<M extends ExtractMap>(this: CheerioAPI, map: M): ExtractedMap<M>;
464
+ extract<M extends ExtractMap>(this: CheerioAPI, map: M): Record<string, unknown>;
465
+ fn: typeof Cheerio.prototype;
466
+ _root: Document;
467
+ _options: InternalOptions;
468
+ [key: string]: any;
469
+ }
470
+ type ExtractDescriptorFn = (element: Element, key: string, result: Record<string, unknown>) => unknown;
471
+ interface ExtractDescriptor {
472
+ selector: string;
473
+ value?: string | ExtractDescriptorFn | ExtractMap;
474
+ }
475
+ type ExtractValue = string | ExtractDescriptor | [string | ExtractDescriptor];
476
+ type ExtractMap = Record<string, ExtractValue>;
477
+ type ExtractedValue<V extends ExtractValue> = V extends [string | ExtractDescriptor] ? NonNullable<ExtractedValue<V[0]>>[] : V extends string ? string | undefined : V extends ExtractDescriptor ? V['value'] extends (infer U) ? U extends ExtractMap ? ExtractedMap<U> | undefined : U extends ExtractDescriptorFn ? ReturnType<U> | undefined : string | undefined : never : never;
478
+ type ExtractedMap<M extends ExtractMap> = { [key in keyof M]: ExtractedValue<M[key]>; };
479
+ type ExtractionDescriptor = ExtractDescriptor;
480
+ type ExtractionMap = ExtractMap;
481
+ type ExtractionResult<M extends ExtractMap> = ExtractedMap<M>;
482
+ interface EncodingOptions {
483
+ defaultEncoding?: string;
484
+ transportLayerEncodingLabel?: string | null;
485
+ userEncoding?: string;
486
+ maxBytes?: number;
487
+ }
488
+ interface DecodeStreamOptions extends CheerioOptions {
489
+ encoding?: EncodingOptions;
490
+ }
491
+ /** Structural Node/Undici FormData compatibility without importing its package. */
492
+ interface FormDataLike extends Iterable<[string, string | import('node:buffer').Blob]> {
493
+ append(name: string, value: unknown, filename?: string): void;
494
+ get(name: string): string | import('node:buffer').Blob | null;
495
+ }
496
+ interface CheerioRequestOptions extends DecodeStreamOptions {
497
+ requestOptions?: {
498
+ method?: string;
499
+ headers?: Record<string, string | string[] | undefined> | string[] | Iterable<[string, string | string[] | undefined]> | Headers | null;
500
+ body?: string | Buffer | Uint8Array | import('node:stream').Readable | FormData | FormDataLike | null;
501
+ query?: import('node:querystring').ParsedUrlQueryInput;
502
+ onInfo?: (info: {
503
+ statusCode: number;
504
+ headers: Record<string, string | string[]>;
505
+ }) => void;
506
+ reset?: boolean;
507
+ typeOfService?: number | null;
508
+ highWaterMark?: number;
509
+ maxRedirections?: number;
510
+ throwOnError?: boolean;
511
+ signal?: unknown;
512
+ headersTimeout?: number | null;
513
+ bodyTimeout?: number | null;
514
+ dispatcher?: unknown;
515
+ [key: string]: unknown;
516
+ };
517
+ }
518
+ interface ParallelOptions extends CheerioOptions {
519
+ threads?: number;
520
+ }
521
+ type SerializedField = {
522
+ name: string;
523
+ value: string;
524
+ };
525
+ export { nativeStatus as $, NodeWithChildren as A, NamespaceURI as B, ExtractionResult as C, InternalOptions as D, HTMLParser2Options as E, SerializedField as F, TokenizerCallbacks as G, ParserErrorCode as H, SourceCodeLocation as I, TreeAdapter as J, TokenizerConstructor as K, TagSourceCodeLocation as L, ParentNode as M, ProcessingInstruction as N, LoadContent as O, SelectorType as P, NativeWorkerPoolInfo as Q, Text as R, ExtractionMap as S, FormDataLike as T, ParserErrorHandler as U, ParserError as V, Tokenizer as W, Cheerio as X, TreeAdapterAttribute as Y, NativeDocument as Z, ExtractDescriptor as _, CDATA as a, ExtractedValue as b, CheerioRequestOptions as c, DataNode as d, DecodeStreamOptions as f, EncodingOptions as g, ElementType as h, BasicAcceptedElems as i, ParallelOptions as j, Node as k, ChildNode as l, Element as m, AcceptedFilters as n, CheerioAPI as o, Document as p, TokenizerOptions as q, AnyNode as r, CheerioOptions as s, AcceptedElems as t, Comment as u, ExtractMap as v, FilterFunction as w, ExtractionDescriptor as x, ExtractedMap as y, DocumentMode as z };
526
+ //# sourceMappingURL=types-CA01Zg3r.d.cts.map