@dvaji/cheerox 0.1.1 → 0.1.3

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 (62) hide show
  1. package/Cargo.lock +1 -4
  2. package/Cargo.toml +3 -2
  3. package/THIRD_PARTY_NOTICES.md +5 -3
  4. package/cheerox.darwin-arm64.node +0 -0
  5. package/cheerox.darwin-x64.node +0 -0
  6. package/cheerox.linux-arm64-gnu.node +0 -0
  7. package/cheerox.linux-arm64-musl.node +0 -0
  8. package/cheerox.linux-x64-gnu.node +0 -0
  9. package/cheerox.linux-x64-musl.node +0 -0
  10. package/cheerox.win32-arm64-msvc.node +0 -0
  11. package/cheerox.win32-x64-msvc.node +0 -0
  12. package/dist/{cheerio-compat-DSwBAJ1s.cjs → cheerio-compat-8HucV2qE.cjs} +9 -7
  13. package/dist/cheerio-compat-8HucV2qE.cjs.map +1 -0
  14. package/dist/{cheerio-compat-DRLPzBdX.d.mts → cheerio-compat-BM4_lqVU.d.mts} +3 -3
  15. package/dist/{cheerio-compat-DRsINTwV.d.ts → cheerio-compat-BnFvIIuE.d.cts} +3 -3
  16. package/dist/{cheerio-compat-DRsINTwV.d.cts → cheerio-compat-BnFvIIuE.d.ts} +3 -3
  17. package/dist/{cheerio-compat-BS--qPzw.mjs → cheerio-compat-Dwarm-h8.mjs} +9 -7
  18. package/dist/cheerio-compat-Dwarm-h8.mjs.map +1 -0
  19. package/dist/cheerio-compat.cjs +1 -1
  20. package/dist/cheerio-compat.d.cts +1 -1
  21. package/dist/cheerio-compat.d.mts +1 -1
  22. package/dist/cheerio-compat.d.ts +1 -1
  23. package/dist/cheerio-compat.mjs +1 -1
  24. package/dist/index.d.mts +1 -1
  25. package/dist/{modern-CvXcTn82.mjs → modern-BwcwZX6l.mjs} +2 -2
  26. package/dist/{modern-CvXcTn82.mjs.map → modern-BwcwZX6l.mjs.map} +1 -1
  27. package/dist/{modern-CHQGP0Yt.cjs → modern-DMcsyA4b.cjs} +2 -2
  28. package/dist/{modern-CHQGP0Yt.cjs.map → modern-DMcsyA4b.cjs.map} +1 -1
  29. package/dist/modern.cjs +2 -2
  30. package/dist/modern.mjs +2 -2
  31. package/dist/{nodes-jbWWhssj.cjs → nodes-Be5sB8rQ.cjs} +23 -15
  32. package/dist/nodes-Be5sB8rQ.cjs.map +1 -0
  33. package/dist/{nodes-sYxb5qyZ.mjs → nodes-C95i5k2P.mjs} +23 -15
  34. package/dist/nodes-C95i5k2P.mjs.map +1 -0
  35. package/dist/slim.cjs +1 -1
  36. package/dist/slim.mjs +1 -1
  37. package/native/src/lib.rs +509 -1
  38. package/native/vendor/README.md +12 -3
  39. package/native/vendor/scraper-0.24.0/Cargo.toml +52 -0
  40. package/native/vendor/scraper-0.24.0/LICENSE +15 -0
  41. package/native/vendor/scraper-0.24.0/src/element_ref/element.rs +212 -0
  42. package/native/vendor/scraper-0.24.0/src/element_ref/mod.rs +236 -0
  43. package/native/vendor/scraper-0.24.0/src/element_ref/serializable.rs +15 -0
  44. package/native/vendor/scraper-0.24.0/src/error/utils.rs +91 -0
  45. package/native/vendor/scraper-0.24.0/src/error.rs +118 -0
  46. package/native/vendor/scraper-0.24.0/src/html/mod.rs +270 -0
  47. package/native/vendor/scraper-0.24.0/src/html/serializable.rs +27 -0
  48. package/native/vendor/scraper-0.24.0/src/html/tree_sink.rs +285 -0
  49. package/native/vendor/scraper-0.24.0/src/lib.rs +180 -0
  50. package/native/vendor/scraper-0.24.0/src/node/serializable.rs +52 -0
  51. package/native/vendor/scraper-0.24.0/src/node.rs +465 -0
  52. package/native/vendor/scraper-0.24.0/src/selectable.rs +70 -0
  53. package/native/vendor/scraper-0.24.0/src/selector.rs +290 -0
  54. package/package.json +1 -1
  55. package/scripts/check-release.mjs +2 -2
  56. package/scripts/generate-notices.mjs +10 -4
  57. package/src/cheerio-compat.ts +14 -4
  58. package/src/native.ts +23 -9
  59. package/dist/cheerio-compat-BS--qPzw.mjs.map +0 -1
  60. package/dist/cheerio-compat-DSwBAJ1s.cjs.map +0 -1
  61. package/dist/nodes-jbWWhssj.cjs.map +0 -1
  62. package/dist/nodes-sYxb5qyZ.mjs.map +0 -1
package/dist/modern.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_nodes = require("./nodes-jbWWhssj.cjs");
3
- const require_modern = require("./modern-CHQGP0Yt.cjs");
2
+ const require_nodes = require("./nodes-Be5sB8rQ.cjs");
3
+ const require_modern = require("./modern-DMcsyA4b.cjs");
4
4
  exports.configureWorkers = require_modern.configureWorkers;
5
5
  exports.contains = require_modern.contains;
6
6
  exports.createAPI = require_modern.createAPI;
package/dist/modern.mjs CHANGED
@@ -1,3 +1,3 @@
1
- import { ft as nativeStatus } from "./nodes-sYxb5qyZ.mjs";
2
- import { a as flattenOptions, c as loadAsync, d as fromURL, f as loadBuffer, h as workerPoolInfo, i as extractAll, l as merge, m as configureWorkers, n as createAPI, o as load, p as stringStream, r as dom, s as loadAll, t as contains, u as decodeStream } from "./modern-CvXcTn82.mjs";
1
+ import { ft as nativeStatus } from "./nodes-C95i5k2P.mjs";
2
+ import { a as flattenOptions, c as loadAsync, d as fromURL, f as loadBuffer, h as workerPoolInfo, i as extractAll, l as merge, m as configureWorkers, n as createAPI, o as load, p as stringStream, r as dom, s as loadAll, t as contains, u as decodeStream } from "./modern-BwcwZX6l.mjs";
3
3
  export { configureWorkers, contains, createAPI, decodeStream, dom, extractAll, flattenOptions, fromURL, load, loadAll, loadAsync, loadBuffer, merge, nativeStatus, stringStream, workerPoolInfo };
@@ -1,5 +1,4 @@
1
1
  let node_module = require("node:module");
2
- let node_fs = require("node:fs");
3
2
  let node_path = require("node:path");
4
3
  let node_url = require("node:url");
5
4
  // src/codec.ts
@@ -262,6 +261,21 @@ let bindingError;
262
261
  function packageDirectory() {
263
262
  return typeof __dirname === "string" ? __dirname : (0, node_path.dirname)((0, node_url.fileURLToPath)(require("url").pathToFileURL(__filename).href));
264
263
  }
264
+ /** The platform directory component used by binary names and companion packages. */
265
+ function platformComponent() {
266
+ const libc = process.platform === "linux" ? (process.report?.getReport())?.header?.glibcVersionRuntime ? "gnu" : "musl" : void 0;
267
+ return `${process.platform}-${process.arch}${libc ? `-${libc}` : process.platform === "win32" ? "-msvc" : ""}`;
268
+ }
269
+ /**
270
+ * Where the native addon may be found, most preferred first: the
271
+ * platform-specific companion package published alongside the main package
272
+ * (`@dvaji/cheerox-<platform>`), then the binaries bundled with the package
273
+ * (or present in a parent directory for source checkouts).
274
+ */
275
+ function nativeBindingCandidates(platform, directories) {
276
+ const names = [`cheerox.${platform}.node`, "cheerox.node"];
277
+ return [`@dvaji/cheerox-${platform}`, ...new Set(directories.flatMap((directory) => names.map((name) => (0, node_path.join)(directory, name))))];
278
+ }
265
279
  /** Resolve the native addon bundled with the npm package. */
266
280
  function nativeBinding() {
267
281
  if (attempted) return cached;
@@ -269,20 +283,14 @@ function nativeBinding() {
269
283
  const moduleDirectory = packageDirectory();
270
284
  const require$1 = (0, node_module.createRequire)((0, node_path.join)(moduleDirectory, "cheerox-loader.cjs"));
271
285
  const directories = [moduleDirectory, (0, node_path.dirname)(moduleDirectory)];
272
- const libc = process.platform === "linux" ? (process.report?.getReport())?.header?.glibcVersionRuntime ? "gnu" : "musl" : void 0;
273
- const names = [`cheerox.${`${process.platform}-${process.arch}${libc ? `-${libc}` : process.platform === "win32" ? "-msvc" : ""}`}.node`, "cheerox.node"];
274
- const candidates = [...new Set(directories.flatMap((directory) => names.map((name) => (0, node_path.join)(directory, name))))];
275
- for (const candidate of candidates) {
276
- if (!(0, node_fs.existsSync)(candidate)) continue;
277
- try {
278
- const loaded = require$1(candidate);
279
- if (typeof loaded.NativeDocument === "function") {
280
- cached = wrapNativeBinding(loaded);
281
- return cached;
282
- }
283
- } catch (error) {
284
- bindingError ??= error;
286
+ for (const candidate of nativeBindingCandidates(platformComponent(), directories)) try {
287
+ const loaded = require$1(candidate);
288
+ if (typeof loaded.NativeDocument === "function") {
289
+ cached = wrapNativeBinding(loaded);
290
+ return cached;
285
291
  }
292
+ } catch (error) {
293
+ bindingError ??= error;
286
294
  }
287
295
  }
288
296
  function requireNative() {
@@ -4207,4 +4215,4 @@ Object.defineProperty(exports, "writeCount", {
4207
4215
  }
4208
4216
  });
4209
4217
 
4210
- //# sourceMappingURL=nodes-jbWWhssj.cjs.map
4218
+ //# sourceMappingURL=nodes-Be5sB8rQ.cjs.map