@purescraps/purehtml 0.7.0 → 0.7.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.
@@ -6461,7 +6461,7 @@ var PureHTMLCheerioNode = class _PureHTMLCheerioNode extends PureHTMLNode {
6461
6461
  if (name) {
6462
6462
  return this.#el.attr(name) ?? null;
6463
6463
  }
6464
- return this.#el.attr();
6464
+ return this.#el.attr() ?? {};
6465
6465
  }
6466
6466
  find(selector) {
6467
6467
  return this.#el.find(selector).toArray().map((el) => new _PureHTMLCheerioNode(this.#$, this.#$(el)));
@@ -6513,6 +6513,9 @@ var ConfigWithSelector = class extends Config {
6513
6513
  }
6514
6514
  return matches;
6515
6515
  }
6516
+ toString() {
6517
+ return `ConfigWithSelector(${this.selector})`;
6518
+ }
6516
6519
  };
6517
6520
 
6518
6521
  // src/config/types/primitive.ts
@@ -6578,6 +6581,7 @@ var ArrayConfig = class _ArrayConfig extends ConfigWithSelector {
6578
6581
  alreadyMatched: params.elementAlreadyMatched ?? false,
6579
6582
  includeRoot: false
6580
6583
  });
6584
+ if (!$el) return null;
6581
6585
  const matches = Array.isArray($el) ? $el : [$el];
6582
6586
  const conf = this.items || PrimitiveValueConfig.generate(null, this.transform);
6583
6587
  const extractOpts = { ...params };
@@ -6986,15 +6990,18 @@ var ObjectConfig = class _ObjectConfig extends ConfigWithSelector {
6986
6990
  }
6987
6991
  const props = this.properties;
6988
6992
  const keys = Object.keys(props);
6989
- return keys.reduce((acc, key) => {
6990
- const config2 = props[key];
6991
- acc[key] = config2.extract({
6992
- ...params,
6993
- $el,
6994
- property: this.makeProperty(params.property, key)
6995
- });
6996
- return acc;
6997
- }, {});
6993
+ return keys.reduce(
6994
+ (acc, key) => {
6995
+ const config2 = props[key];
6996
+ acc[key] = config2.extract({
6997
+ ...params,
6998
+ $el,
6999
+ property: this.makeProperty(params.property, key)
7000
+ });
7001
+ return acc;
7002
+ },
7003
+ {}
7004
+ );
6998
7005
  }
6999
7006
  makeProperty(property, prop) {
7000
7007
  if (property === rootProp) {
@@ -7213,7 +7220,7 @@ var ConfigValidator = class {
7213
7220
  var ConfigFactory = class _ConfigFactory {
7214
7221
  static fromYAML(yaml) {
7215
7222
  const plain = (0, import_yaml.parse)(yaml);
7216
- return this.generate(plain);
7223
+ return _ConfigFactory.generate(plain);
7217
7224
  }
7218
7225
  static generate(plain) {
7219
7226
  const validator = new ConfigValidator(plain);
@@ -7240,24 +7247,28 @@ var ConfigFactory = class _ConfigFactory {
7240
7247
  case "constant":
7241
7248
  return ConstantConfig.generate(constant, selector);
7242
7249
  case "object": {
7243
- let propConfigs = void 0;
7250
+ let propConfigs;
7244
7251
  if (properties) {
7245
- propConfigs = Object.keys(properties).reduce((acc, key) => {
7246
- acc[key] = this.generate(properties[key]);
7247
- return acc;
7248
- }, {});
7252
+ propConfigs = Object.keys(properties).reduce(
7253
+ (acc, key) => {
7254
+ acc[key] = _ConfigFactory.generate(properties[key]);
7255
+ return acc;
7256
+ },
7257
+ {}
7258
+ );
7249
7259
  }
7250
7260
  return ObjectConfig.generate(selector, propConfigs);
7251
7261
  }
7252
7262
  case "array":
7253
7263
  return ArrayConfig.generate(
7254
7264
  selector,
7255
- items && this.generate(items),
7265
+ items && _ConfigFactory.generate(items),
7256
7266
  transform
7257
7267
  );
7258
7268
  case "union":
7259
7269
  return UnionConfig.generate(
7260
- union.map((cfg) => this.generate(cfg))
7270
+ // biome-ignore lint/style/noNonNullAssertion: union will be present here. because our schema already validated the input
7271
+ union.map((cfg) => _ConfigFactory.generate(cfg))
7261
7272
  );
7262
7273
  default:
7263
7274
  return PrimitiveValueConfig.generate(selector, transform);