@kreuzberg/html-to-markdown-wasm 3.6.0-rc.9 → 3.6.0
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.
- package/package.json +1 -1
- package/pkg/bundler/html_to_markdown_wasm.d.ts +36 -4
- package/pkg/bundler/html_to_markdown_wasm_bg.js +244 -27
- package/pkg/bundler/html_to_markdown_wasm_bg.wasm +0 -0
- package/pkg/bundler/html_to_markdown_wasm_bg.wasm.d.ts +10 -9
- package/pkg/bundler/package.json +1 -1
- package/pkg/deno/html_to_markdown_wasm.d.ts +36 -4
- package/pkg/deno/html_to_markdown_wasm.js +244 -27
- package/pkg/deno/html_to_markdown_wasm_bg.wasm +0 -0
- package/pkg/deno/html_to_markdown_wasm_bg.wasm.d.ts +10 -9
- package/pkg/nodejs/html_to_markdown_wasm.d.ts +36 -4
- package/pkg/nodejs/html_to_markdown_wasm.js +244 -27
- package/pkg/nodejs/html_to_markdown_wasm_bg.wasm +0 -0
- package/pkg/nodejs/html_to_markdown_wasm_bg.wasm.d.ts +10 -9
- package/pkg/nodejs/package.json +1 -1
- package/pkg/web/html_to_markdown_wasm.d.ts +46 -13
- package/pkg/web/html_to_markdown_wasm.js +244 -27
- package/pkg/web/html_to_markdown_wasm_bg.wasm +0 -0
- package/pkg/web/html_to_markdown_wasm_bg.wasm.d.ts +10 -9
- package/pkg/web/package.json +1 -1
|
@@ -4399,7 +4399,21 @@ exports.WasmNodeContent = WasmNodeContent;
|
|
|
4399
4399
|
* Context information passed to all visitor methods.
|
|
4400
4400
|
*
|
|
4401
4401
|
* Provides comprehensive metadata about the current node being visited,
|
|
4402
|
-
* including its type,
|
|
4402
|
+
* including its type, tag name, position in the DOM tree, and parent context.
|
|
4403
|
+
*
|
|
4404
|
+
* ## Attributes
|
|
4405
|
+
*
|
|
4406
|
+
* Access attributes via `NodeContext.attributes`, which returns
|
|
4407
|
+
* `&BTreeMap<String, String>`. When the context was built with
|
|
4408
|
+
* `NodeContext.with_lazy_attributes` (the hot path inside the converter),
|
|
4409
|
+
* the map is only materialized on the first call — if the visitor never reads
|
|
4410
|
+
* attributes, the allocation is skipped.
|
|
4411
|
+
*
|
|
4412
|
+
* ## Lifetimes
|
|
4413
|
+
*
|
|
4414
|
+
* String fields use `Cow<'_, str>` so the converter can pass slices directly
|
|
4415
|
+
* out of the parsed DOM without allocating. Visitor implementations that need
|
|
4416
|
+
* to outlive the callback should call `NodeContext.into_owned`.
|
|
4403
4417
|
*/
|
|
4404
4418
|
class WasmNodeContext {
|
|
4405
4419
|
static __wrap(ptr) {
|
|
@@ -4419,9 +4433,14 @@ class WasmNodeContext {
|
|
|
4419
4433
|
wasm.__wbg_wasmnodecontext_free(ptr, 0);
|
|
4420
4434
|
}
|
|
4421
4435
|
/**
|
|
4436
|
+
* Return a reference to the attribute map.
|
|
4437
|
+
*
|
|
4438
|
+
* If the context was built with `NodeContext.with_lazy_attributes`, the
|
|
4439
|
+
* map is materialized on the first call and cached for subsequent calls.
|
|
4440
|
+
* If this method is never called, no allocation occurs for attributes.
|
|
4422
4441
|
* @returns {any}
|
|
4423
4442
|
*/
|
|
4424
|
-
|
|
4443
|
+
attributes() {
|
|
4425
4444
|
const ret = wasm.wasmnodecontext_attributes(this.__wbg_ptr);
|
|
4426
4445
|
return takeObject(ret);
|
|
4427
4446
|
}
|
|
@@ -4446,6 +4465,14 @@ class WasmNodeContext {
|
|
|
4446
4465
|
const ret = wasm.wasmnodecontext_indexInParent(this.__wbg_ptr);
|
|
4447
4466
|
return ret >>> 0;
|
|
4448
4467
|
}
|
|
4468
|
+
/**
|
|
4469
|
+
* Promote any borrowed fields into owned storage so the context can outlive `'a`.
|
|
4470
|
+
* @returns {WasmNodeContext}
|
|
4471
|
+
*/
|
|
4472
|
+
intoOwned() {
|
|
4473
|
+
const ret = wasm.wasmnodecontext_intoOwned(this.__wbg_ptr);
|
|
4474
|
+
return WasmNodeContext.__wrap(ret);
|
|
4475
|
+
}
|
|
4449
4476
|
/**
|
|
4450
4477
|
* @returns {boolean}
|
|
4451
4478
|
*/
|
|
@@ -4456,18 +4483,17 @@ class WasmNodeContext {
|
|
|
4456
4483
|
/**
|
|
4457
4484
|
* @param {WasmNodeType} nodeType
|
|
4458
4485
|
* @param {string} tagName
|
|
4459
|
-
* @param {any} attributes
|
|
4460
4486
|
* @param {number} depth
|
|
4461
4487
|
* @param {number} indexInParent
|
|
4462
4488
|
* @param {boolean} isInline
|
|
4463
4489
|
* @param {string | null} [parentTag]
|
|
4464
4490
|
*/
|
|
4465
|
-
constructor(nodeType, tagName,
|
|
4491
|
+
constructor(nodeType, tagName, depth, indexInParent, isInline, parentTag) {
|
|
4466
4492
|
const ptr0 = passStringToWasm0(tagName, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
4467
4493
|
const len0 = WASM_VECTOR_LEN;
|
|
4468
4494
|
var ptr1 = isLikeNone(parentTag) ? 0 : passStringToWasm0(parentTag, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
4469
4495
|
var len1 = WASM_VECTOR_LEN;
|
|
4470
|
-
const ret = wasm.wasmnodecontext_new(nodeType, ptr0, len0,
|
|
4496
|
+
const ret = wasm.wasmnodecontext_new(nodeType, ptr0, len0, depth, indexInParent, isInline, ptr1, len1);
|
|
4471
4497
|
this.__wbg_ptr = ret;
|
|
4472
4498
|
WasmNodeContextFinalization.register(this, this.__wbg_ptr, this);
|
|
4473
4499
|
return this;
|
|
@@ -4510,12 +4536,6 @@ class WasmNodeContext {
|
|
|
4510
4536
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
4511
4537
|
}
|
|
4512
4538
|
}
|
|
4513
|
-
/**
|
|
4514
|
-
* @param {any} value
|
|
4515
|
-
*/
|
|
4516
|
-
set attributes(value) {
|
|
4517
|
-
wasm.wasmnodecontext_set_attributes(this.__wbg_ptr, addHeapObject(value));
|
|
4518
|
-
}
|
|
4519
4539
|
/**
|
|
4520
4540
|
* @param {number} value
|
|
4521
4541
|
*/
|
|
@@ -4575,6 +4595,28 @@ class WasmNodeContext {
|
|
|
4575
4595
|
wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
|
|
4576
4596
|
}
|
|
4577
4597
|
}
|
|
4598
|
+
/**
|
|
4599
|
+
* Construct a `NodeContext` with an owned attribute map.
|
|
4600
|
+
*
|
|
4601
|
+
* Prefer `NodeContext.with_lazy_attributes` (pub(crate)) inside the
|
|
4602
|
+
* converter to avoid the eager `collect_tag_attributes` allocation.
|
|
4603
|
+
* @param {WasmNodeType} node_type
|
|
4604
|
+
* @param {string} tag_name
|
|
4605
|
+
* @param {any} attributes
|
|
4606
|
+
* @param {number} depth
|
|
4607
|
+
* @param {number} index_in_parent
|
|
4608
|
+
* @param {string | null | undefined} parent_tag
|
|
4609
|
+
* @param {boolean} is_inline
|
|
4610
|
+
* @returns {WasmNodeContext}
|
|
4611
|
+
*/
|
|
4612
|
+
static withOwnedAttributes(node_type, tag_name, attributes, depth, index_in_parent, parent_tag, is_inline) {
|
|
4613
|
+
const ptr0 = passStringToWasm0(tag_name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
4614
|
+
const len0 = WASM_VECTOR_LEN;
|
|
4615
|
+
var ptr1 = isLikeNone(parent_tag) ? 0 : passStringToWasm0(parent_tag, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
4616
|
+
var len1 = WASM_VECTOR_LEN;
|
|
4617
|
+
const ret = wasm.wasmnodecontext_withOwnedAttributes(node_type, ptr0, len0, addHeapObject(attributes), depth, index_in_parent, ptr1, len1, is_inline);
|
|
4618
|
+
return WasmNodeContext.__wrap(ret);
|
|
4619
|
+
}
|
|
4578
4620
|
}
|
|
4579
4621
|
if (Symbol.dispose) WasmNodeContext.prototype[Symbol.dispose] = WasmNodeContext.prototype.free;
|
|
4580
4622
|
exports.WasmNodeContext = WasmNodeContext;
|
|
@@ -5038,7 +5080,7 @@ if (Symbol.dispose) WasmProcessingWarning.prototype[Symbol.dispose] = WasmProces
|
|
|
5038
5080
|
exports.WasmProcessingWarning = WasmProcessingWarning;
|
|
5039
5081
|
|
|
5040
5082
|
/**
|
|
5041
|
-
* Structured data block (JSON-LD, Microdata, or RDFa).
|
|
5083
|
+
* Structured data block (JSON-LD, Microdata, or `RDFa`).
|
|
5042
5084
|
*
|
|
5043
5085
|
* Represents machine-readable structured data found in the document.
|
|
5044
5086
|
* JSON-LD blocks are collected as raw JSON strings for flexibility.
|
|
@@ -5649,20 +5691,46 @@ exports.convert = convert;
|
|
|
5649
5691
|
function __wbg_get_imports() {
|
|
5650
5692
|
const import0 = {
|
|
5651
5693
|
__proto__: null,
|
|
5652
|
-
|
|
5694
|
+
__wbg_Error_9dc85fe1bc224456: function(arg0, arg1) {
|
|
5695
|
+
const ret = Error(getStringFromWasm0(arg0, arg1));
|
|
5696
|
+
return addHeapObject(ret);
|
|
5697
|
+
},
|
|
5698
|
+
__wbg___wbindgen_boolean_get_b131b2f36d6b2f55: function(arg0) {
|
|
5699
|
+
const v = getObject(arg0);
|
|
5700
|
+
const ret = typeof(v) === 'boolean' ? v : undefined;
|
|
5701
|
+
return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
|
|
5702
|
+
},
|
|
5703
|
+
__wbg___wbindgen_debug_string_56c147eb1a51f0c4: function(arg0, arg1) {
|
|
5704
|
+
const ret = debugString(getObject(arg1));
|
|
5705
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
5706
|
+
const len1 = WASM_VECTOR_LEN;
|
|
5707
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
5708
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
5709
|
+
},
|
|
5710
|
+
__wbg___wbindgen_is_function_147961669f068cd4: function(arg0) {
|
|
5653
5711
|
const ret = typeof(getObject(arg0)) === 'function';
|
|
5654
5712
|
return ret;
|
|
5655
5713
|
},
|
|
5656
|
-
|
|
5714
|
+
__wbg___wbindgen_is_object_3a2c414391dbf751: function(arg0) {
|
|
5657
5715
|
const val = getObject(arg0);
|
|
5658
5716
|
const ret = typeof(val) === 'object' && val !== null;
|
|
5659
5717
|
return ret;
|
|
5660
5718
|
},
|
|
5661
|
-
|
|
5719
|
+
__wbg___wbindgen_is_undefined_4410e3c20a99fa97: function(arg0) {
|
|
5662
5720
|
const ret = getObject(arg0) === undefined;
|
|
5663
5721
|
return ret;
|
|
5664
5722
|
},
|
|
5665
|
-
|
|
5723
|
+
__wbg___wbindgen_jsval_loose_eq_e07e3b1f5db6da6c: function(arg0, arg1) {
|
|
5724
|
+
const ret = getObject(arg0) == getObject(arg1);
|
|
5725
|
+
return ret;
|
|
5726
|
+
},
|
|
5727
|
+
__wbg___wbindgen_number_get_588ed6b97f0d7e14: function(arg0, arg1) {
|
|
5728
|
+
const obj = getObject(arg1);
|
|
5729
|
+
const ret = typeof(obj) === 'number' ? obj : undefined;
|
|
5730
|
+
getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
|
|
5731
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
|
|
5732
|
+
},
|
|
5733
|
+
__wbg___wbindgen_string_get_fa2687d531ed17a5: function(arg0, arg1) {
|
|
5666
5734
|
const obj = getObject(arg1);
|
|
5667
5735
|
const ret = typeof(obj) === 'string' ? obj : undefined;
|
|
5668
5736
|
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
@@ -5670,47 +5738,126 @@ function __wbg_get_imports() {
|
|
|
5670
5738
|
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
5671
5739
|
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
5672
5740
|
},
|
|
5673
|
-
|
|
5741
|
+
__wbg___wbindgen_throw_bbadd78c1bac3a77: function(arg0, arg1) {
|
|
5674
5742
|
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
5675
5743
|
},
|
|
5676
|
-
|
|
5744
|
+
__wbg_apply_5d99f956e2dda74d: function() { return handleError(function (arg0, arg1, arg2) {
|
|
5677
5745
|
const ret = getObject(arg0).apply(getObject(arg1), getObject(arg2));
|
|
5678
5746
|
return addHeapObject(ret);
|
|
5679
5747
|
}, arguments); },
|
|
5680
|
-
|
|
5748
|
+
__wbg_call_91f00ddc43e01490: function() { return handleError(function (arg0, arg1) {
|
|
5749
|
+
const ret = getObject(arg0).call(getObject(arg1));
|
|
5750
|
+
return addHeapObject(ret);
|
|
5751
|
+
}, arguments); },
|
|
5752
|
+
__wbg_done_6a8439e544ec6206: function(arg0) {
|
|
5753
|
+
const ret = getObject(arg0).done;
|
|
5754
|
+
return ret;
|
|
5755
|
+
},
|
|
5756
|
+
__wbg_entries_5a6a7e7e0df09fe5: function(arg0) {
|
|
5757
|
+
const ret = Object.entries(getObject(arg0));
|
|
5758
|
+
return addHeapObject(ret);
|
|
5759
|
+
},
|
|
5760
|
+
__wbg_get_44e98e27bda25b5b: function() { return handleError(function (arg0, arg1) {
|
|
5761
|
+
const ret = Reflect.get(getObject(arg0), getObject(arg1));
|
|
5762
|
+
return addHeapObject(ret);
|
|
5763
|
+
}, arguments); },
|
|
5764
|
+
__wbg_get_4b90d6d8c5deb5d5: function(arg0, arg1) {
|
|
5765
|
+
const ret = getObject(arg0)[arg1 >>> 0];
|
|
5766
|
+
return addHeapObject(ret);
|
|
5767
|
+
},
|
|
5768
|
+
__wbg_get_52a8a619f7b88df6: function() { return handleError(function (arg0, arg1) {
|
|
5681
5769
|
const ret = Reflect.get(getObject(arg0), getObject(arg1));
|
|
5682
5770
|
return addHeapObject(ret);
|
|
5683
5771
|
}, arguments); },
|
|
5684
|
-
|
|
5772
|
+
__wbg_get_unchecked_46e778e3cec74b5e: function(arg0, arg1) {
|
|
5773
|
+
const ret = getObject(arg0)[arg1 >>> 0];
|
|
5774
|
+
return addHeapObject(ret);
|
|
5775
|
+
},
|
|
5776
|
+
__wbg_has_14676d88c1340d2c: function() { return handleError(function (arg0, arg1) {
|
|
5685
5777
|
const ret = Reflect.has(getObject(arg0), getObject(arg1));
|
|
5686
5778
|
return ret;
|
|
5687
5779
|
}, arguments); },
|
|
5688
|
-
|
|
5689
|
-
|
|
5780
|
+
__wbg_instanceof_ArrayBuffer_a581da923203f29f: function(arg0) {
|
|
5781
|
+
let result;
|
|
5782
|
+
try {
|
|
5783
|
+
result = getObject(arg0) instanceof ArrayBuffer;
|
|
5784
|
+
} catch (_) {
|
|
5785
|
+
result = false;
|
|
5786
|
+
}
|
|
5787
|
+
const ret = result;
|
|
5788
|
+
return ret;
|
|
5789
|
+
},
|
|
5790
|
+
__wbg_instanceof_Uint8Array_b6fe1ac89eba107e: function(arg0) {
|
|
5791
|
+
let result;
|
|
5792
|
+
try {
|
|
5793
|
+
result = getObject(arg0) instanceof Uint8Array;
|
|
5794
|
+
} catch (_) {
|
|
5795
|
+
result = false;
|
|
5796
|
+
}
|
|
5797
|
+
const ret = result;
|
|
5798
|
+
return ret;
|
|
5799
|
+
},
|
|
5800
|
+
__wbg_iterator_9b36cebf3be7b7cd: function() {
|
|
5801
|
+
const ret = Symbol.iterator;
|
|
5690
5802
|
return addHeapObject(ret);
|
|
5691
5803
|
},
|
|
5692
|
-
|
|
5804
|
+
__wbg_length_68a9d5278d084f4f: function(arg0) {
|
|
5805
|
+
const ret = getObject(arg0).length;
|
|
5806
|
+
return ret;
|
|
5807
|
+
},
|
|
5808
|
+
__wbg_length_fb04d16d7bdf6d4c: function(arg0) {
|
|
5809
|
+
const ret = getObject(arg0).length;
|
|
5810
|
+
return ret;
|
|
5811
|
+
},
|
|
5812
|
+
__wbg_new_0b303268aa395a38: function() {
|
|
5693
5813
|
const ret = new Array();
|
|
5694
5814
|
return addHeapObject(ret);
|
|
5695
5815
|
},
|
|
5696
|
-
|
|
5816
|
+
__wbg_new_20b778a4c5c691c3: function() {
|
|
5817
|
+
const ret = new Object();
|
|
5818
|
+
return addHeapObject(ret);
|
|
5819
|
+
},
|
|
5820
|
+
__wbg_new_883c0db065f06efd: function() {
|
|
5821
|
+
const ret = new Map();
|
|
5822
|
+
return addHeapObject(ret);
|
|
5823
|
+
},
|
|
5824
|
+
__wbg_new_b06772b280cc6e52: function(arg0) {
|
|
5825
|
+
const ret = new Uint8Array(getObject(arg0));
|
|
5826
|
+
return addHeapObject(ret);
|
|
5827
|
+
},
|
|
5828
|
+
__wbg_next_8cb028b6ba50743f: function() { return handleError(function (arg0) {
|
|
5829
|
+
const ret = getObject(arg0).next();
|
|
5830
|
+
return addHeapObject(ret);
|
|
5831
|
+
}, arguments); },
|
|
5832
|
+
__wbg_next_cfd0b146c9538df8: function(arg0) {
|
|
5833
|
+
const ret = getObject(arg0).next;
|
|
5834
|
+
return addHeapObject(ret);
|
|
5835
|
+
},
|
|
5836
|
+
__wbg_parse_246201845d0eb98c: function() { return handleError(function (arg0, arg1) {
|
|
5697
5837
|
const ret = JSON.parse(getStringFromWasm0(arg0, arg1));
|
|
5698
5838
|
return addHeapObject(ret);
|
|
5699
5839
|
}, arguments); },
|
|
5700
|
-
|
|
5840
|
+
__wbg_prototypesetcall_956c7493c68e29b4: function(arg0, arg1, arg2) {
|
|
5841
|
+
Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), getObject(arg2));
|
|
5842
|
+
},
|
|
5843
|
+
__wbg_push_ceb8ef046afb2041: function(arg0, arg1) {
|
|
5701
5844
|
const ret = getObject(arg0).push(getObject(arg1));
|
|
5702
5845
|
return ret;
|
|
5703
5846
|
},
|
|
5704
5847
|
__wbg_set_6be42768c690e380: function(arg0, arg1, arg2) {
|
|
5705
5848
|
getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
|
|
5706
5849
|
},
|
|
5707
|
-
|
|
5850
|
+
__wbg_set_a6ba3ac0e634b822: function() { return handleError(function (arg0, arg1, arg2) {
|
|
5708
5851
|
const ret = Reflect.set(getObject(arg0), getObject(arg1), getObject(arg2));
|
|
5709
5852
|
return ret;
|
|
5710
5853
|
}, arguments); },
|
|
5711
|
-
|
|
5854
|
+
__wbg_set_da33c120a6584674: function(arg0, arg1, arg2) {
|
|
5712
5855
|
getObject(arg0)[arg1 >>> 0] = takeObject(arg2);
|
|
5713
5856
|
},
|
|
5857
|
+
__wbg_value_3d3defe09fb1ffca: function(arg0) {
|
|
5858
|
+
const ret = getObject(arg0).value;
|
|
5859
|
+
return addHeapObject(ret);
|
|
5860
|
+
},
|
|
5714
5861
|
__wbg_wasmdocumentnode_new: function(arg0) {
|
|
5715
5862
|
const ret = WasmDocumentNode.__wrap(arg0);
|
|
5716
5863
|
return addHeapObject(ret);
|
|
@@ -5903,6 +6050,71 @@ function _assertClass(instance, klass) {
|
|
|
5903
6050
|
}
|
|
5904
6051
|
}
|
|
5905
6052
|
|
|
6053
|
+
function debugString(val) {
|
|
6054
|
+
// primitive types
|
|
6055
|
+
const type = typeof val;
|
|
6056
|
+
if (type == 'number' || type == 'boolean' || val == null) {
|
|
6057
|
+
return `${val}`;
|
|
6058
|
+
}
|
|
6059
|
+
if (type == 'string') {
|
|
6060
|
+
return `"${val}"`;
|
|
6061
|
+
}
|
|
6062
|
+
if (type == 'symbol') {
|
|
6063
|
+
const description = val.description;
|
|
6064
|
+
if (description == null) {
|
|
6065
|
+
return 'Symbol';
|
|
6066
|
+
} else {
|
|
6067
|
+
return `Symbol(${description})`;
|
|
6068
|
+
}
|
|
6069
|
+
}
|
|
6070
|
+
if (type == 'function') {
|
|
6071
|
+
const name = val.name;
|
|
6072
|
+
if (typeof name == 'string' && name.length > 0) {
|
|
6073
|
+
return `Function(${name})`;
|
|
6074
|
+
} else {
|
|
6075
|
+
return 'Function';
|
|
6076
|
+
}
|
|
6077
|
+
}
|
|
6078
|
+
// objects
|
|
6079
|
+
if (Array.isArray(val)) {
|
|
6080
|
+
const length = val.length;
|
|
6081
|
+
let debug = '[';
|
|
6082
|
+
if (length > 0) {
|
|
6083
|
+
debug += debugString(val[0]);
|
|
6084
|
+
}
|
|
6085
|
+
for(let i = 1; i < length; i++) {
|
|
6086
|
+
debug += ', ' + debugString(val[i]);
|
|
6087
|
+
}
|
|
6088
|
+
debug += ']';
|
|
6089
|
+
return debug;
|
|
6090
|
+
}
|
|
6091
|
+
// Test for built-in
|
|
6092
|
+
const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
|
|
6093
|
+
let className;
|
|
6094
|
+
if (builtInMatches && builtInMatches.length > 1) {
|
|
6095
|
+
className = builtInMatches[1];
|
|
6096
|
+
} else {
|
|
6097
|
+
// Failed to match the standard '[object ClassName]'
|
|
6098
|
+
return toString.call(val);
|
|
6099
|
+
}
|
|
6100
|
+
if (className == 'Object') {
|
|
6101
|
+
// we're a user defined class or Object
|
|
6102
|
+
// JSON.stringify avoids problems with cycles, and is generally much
|
|
6103
|
+
// easier than looping through ownProperties of `val`.
|
|
6104
|
+
try {
|
|
6105
|
+
return 'Object(' + JSON.stringify(val) + ')';
|
|
6106
|
+
} catch (_) {
|
|
6107
|
+
return 'Object';
|
|
6108
|
+
}
|
|
6109
|
+
}
|
|
6110
|
+
// errors
|
|
6111
|
+
if (val instanceof Error) {
|
|
6112
|
+
return `${val.name}: ${val.message}\n${val.stack}`;
|
|
6113
|
+
}
|
|
6114
|
+
// TODO we could test for more things here, like `Set`s and `Map`s.
|
|
6115
|
+
return className;
|
|
6116
|
+
}
|
|
6117
|
+
|
|
5906
6118
|
function dropObject(idx) {
|
|
5907
6119
|
if (idx < 1028) return;
|
|
5908
6120
|
heap[idx] = heap_next;
|
|
@@ -5924,6 +6136,11 @@ function getArrayU32FromWasm0(ptr, len) {
|
|
|
5924
6136
|
return getUint32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
|
|
5925
6137
|
}
|
|
5926
6138
|
|
|
6139
|
+
function getArrayU8FromWasm0(ptr, len) {
|
|
6140
|
+
ptr = ptr >>> 0;
|
|
6141
|
+
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
6142
|
+
}
|
|
6143
|
+
|
|
5927
6144
|
let cachedDataViewMemory0 = null;
|
|
5928
6145
|
function getDataViewMemory0() {
|
|
5929
6146
|
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
|
|
Binary file
|
|
@@ -16,7 +16,6 @@ export const __wbg_wasmimagemetadata_free: (a: number, b: number) => void;
|
|
|
16
16
|
export const __wbg_wasmlinkmetadata_free: (a: number, b: number) => void;
|
|
17
17
|
export const __wbg_wasmmetadataentry_free: (a: number, b: number) => void;
|
|
18
18
|
export const __wbg_wasmnodecontent_free: (a: number, b: number) => void;
|
|
19
|
-
export const __wbg_wasmnodecontext_free: (a: number, b: number) => void;
|
|
20
19
|
export const __wbg_wasmpreprocessingoptions_free: (a: number, b: number) => void;
|
|
21
20
|
export const __wbg_wasmprocessingwarning_free: (a: number, b: number) => void;
|
|
22
21
|
export const __wbg_wasmstructureddata_free: (a: number, b: number) => void;
|
|
@@ -378,18 +377,13 @@ export const wasmnodecontent_term: (a: number, b: number) => void;
|
|
|
378
377
|
export const wasmnodecontent_text: (a: number, b: number) => void;
|
|
379
378
|
export const wasmnodecontext_attributes: (a: number) => number;
|
|
380
379
|
export const wasmnodecontext_default: () => number;
|
|
381
|
-
export const
|
|
380
|
+
export const wasmnodecontext_intoOwned: (a: number) => number;
|
|
382
381
|
export const wasmnodecontext_isInline: (a: number) => number;
|
|
383
|
-
export const wasmnodecontext_new: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number
|
|
382
|
+
export const wasmnodecontext_new: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
|
|
384
383
|
export const wasmnodecontext_nodeType: (a: number, b: number) => void;
|
|
385
|
-
export const wasmnodecontext_parentTag: (a: number, b: number) => void;
|
|
386
|
-
export const wasmnodecontext_set_attributes: (a: number, b: number) => void;
|
|
387
|
-
export const wasmnodecontext_set_indexInParent: (a: number, b: number) => void;
|
|
388
384
|
export const wasmnodecontext_set_isInline: (a: number, b: number) => void;
|
|
389
385
|
export const wasmnodecontext_set_nodeType: (a: number, b: number) => void;
|
|
390
|
-
export const
|
|
391
|
-
export const wasmnodecontext_set_tagName: (a: number, b: number, c: number) => void;
|
|
392
|
-
export const wasmnodecontext_tagName: (a: number, b: number) => void;
|
|
386
|
+
export const wasmnodecontext_withOwnedAttributes: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => number;
|
|
393
387
|
export const wasmpreprocessingoptions_default: () => number;
|
|
394
388
|
export const wasmpreprocessingoptions_enabled: (a: number) => number;
|
|
395
389
|
export const wasmpreprocessingoptions_new: (a: number, b: number, c: number, d: number) => number;
|
|
@@ -443,6 +437,7 @@ export const wasmnodecontent_ordered: (a: number) => number;
|
|
|
443
437
|
export const wasmnodecontent_new: () => number;
|
|
444
438
|
export const wasmheadermetadata_set_depth: (a: number, b: number) => void;
|
|
445
439
|
export const wasmnodecontext_set_depth: (a: number, b: number) => void;
|
|
440
|
+
export const wasmnodecontext_set_indexInParent: (a: number, b: number) => void;
|
|
446
441
|
export const wasmtablegrid_set_cols: (a: number, b: number) => void;
|
|
447
442
|
export const wasmtablegrid_set_rows: (a: number, b: number) => void;
|
|
448
443
|
export const wasmtextannotation_set_end: (a: number, b: number) => void;
|
|
@@ -450,13 +445,19 @@ export const wasmtextannotation_set_start: (a: number, b: number) => void;
|
|
|
450
445
|
export const wasmnodecontent_set_imageIndex: (a: number, b: number) => void;
|
|
451
446
|
export const wasmheadermetadata_depth: (a: number) => number;
|
|
452
447
|
export const wasmnodecontext_depth: (a: number) => number;
|
|
448
|
+
export const wasmnodecontext_indexInParent: (a: number) => number;
|
|
453
449
|
export const wasmtablegrid_cols: (a: number) => number;
|
|
454
450
|
export const wasmtablegrid_rows: (a: number) => number;
|
|
455
451
|
export const wasmtextannotation_end: (a: number) => number;
|
|
456
452
|
export const wasmtextannotation_start: (a: number) => number;
|
|
457
453
|
export const wasmannotationkind_new: () => number;
|
|
454
|
+
export const wasmnodecontext_parentTag: (a: number, b: number) => void;
|
|
458
455
|
export const wasmnodecontent_set_ordered: (a: number, b: number) => void;
|
|
456
|
+
export const wasmnodecontext_set_tagName: (a: number, b: number, c: number) => void;
|
|
457
|
+
export const wasmnodecontext_set_parentTag: (a: number, b: number, c: number) => void;
|
|
458
|
+
export const wasmnodecontext_tagName: (a: number, b: number) => void;
|
|
459
459
|
export const wasmnodecontent_imageIndex: (a: number) => number;
|
|
460
|
+
export const __wbg_wasmnodecontext_free: (a: number, b: number) => void;
|
|
460
461
|
export const __wbg_wasmpreprocessingoptionsupdate_free: (a: number, b: number) => void;
|
|
461
462
|
export const __wbindgen_export: (a: number, b: number) => number;
|
|
462
463
|
export const __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
|
package/pkg/nodejs/package.json
CHANGED
|
@@ -572,14 +572,46 @@ export class WasmNodeContent {
|
|
|
572
572
|
* Context information passed to all visitor methods.
|
|
573
573
|
*
|
|
574
574
|
* Provides comprehensive metadata about the current node being visited,
|
|
575
|
-
* including its type,
|
|
575
|
+
* including its type, tag name, position in the DOM tree, and parent context.
|
|
576
|
+
*
|
|
577
|
+
* ## Attributes
|
|
578
|
+
*
|
|
579
|
+
* Access attributes via `NodeContext.attributes`, which returns
|
|
580
|
+
* `&BTreeMap<String, String>`. When the context was built with
|
|
581
|
+
* `NodeContext.with_lazy_attributes` (the hot path inside the converter),
|
|
582
|
+
* the map is only materialized on the first call — if the visitor never reads
|
|
583
|
+
* attributes, the allocation is skipped.
|
|
584
|
+
*
|
|
585
|
+
* ## Lifetimes
|
|
586
|
+
*
|
|
587
|
+
* String fields use `Cow<'_, str>` so the converter can pass slices directly
|
|
588
|
+
* out of the parsed DOM without allocating. Visitor implementations that need
|
|
589
|
+
* to outlive the callback should call `NodeContext.into_owned`.
|
|
576
590
|
*/
|
|
577
591
|
export class WasmNodeContext {
|
|
578
592
|
free(): void;
|
|
579
593
|
[Symbol.dispose](): void;
|
|
594
|
+
/**
|
|
595
|
+
* Return a reference to the attribute map.
|
|
596
|
+
*
|
|
597
|
+
* If the context was built with `NodeContext.with_lazy_attributes`, the
|
|
598
|
+
* map is materialized on the first call and cached for subsequent calls.
|
|
599
|
+
* If this method is never called, no allocation occurs for attributes.
|
|
600
|
+
*/
|
|
601
|
+
attributes(): any;
|
|
580
602
|
static default(): WasmNodeContext;
|
|
581
|
-
|
|
582
|
-
|
|
603
|
+
/**
|
|
604
|
+
* Promote any borrowed fields into owned storage so the context can outlive `'a`.
|
|
605
|
+
*/
|
|
606
|
+
intoOwned(): WasmNodeContext;
|
|
607
|
+
constructor(nodeType: WasmNodeType, tagName: string, depth: number, indexInParent: number, isInline: boolean, parentTag?: string | null);
|
|
608
|
+
/**
|
|
609
|
+
* Construct a `NodeContext` with an owned attribute map.
|
|
610
|
+
*
|
|
611
|
+
* Prefer `NodeContext.with_lazy_attributes` (pub(crate)) inside the
|
|
612
|
+
* converter to avoid the eager `collect_tag_attributes` allocation.
|
|
613
|
+
*/
|
|
614
|
+
static withOwnedAttributes(node_type: WasmNodeType, tag_name: string, attributes: any, depth: number, index_in_parent: number, parent_tag: string | null | undefined, is_inline: boolean): WasmNodeContext;
|
|
583
615
|
depth: number;
|
|
584
616
|
indexInParent: number;
|
|
585
617
|
isInline: boolean;
|
|
@@ -774,7 +806,7 @@ export class WasmProcessingWarning {
|
|
|
774
806
|
}
|
|
775
807
|
|
|
776
808
|
/**
|
|
777
|
-
* Structured data block (JSON-LD, Microdata, or RDFa).
|
|
809
|
+
* Structured data block (JSON-LD, Microdata, or `RDFa`).
|
|
778
810
|
*
|
|
779
811
|
* Represents machine-readable structured data found in the document.
|
|
780
812
|
* JSON-LD blocks are collected as raw JSON strings for flexibility.
|
|
@@ -987,7 +1019,6 @@ export interface InitOutput {
|
|
|
987
1019
|
readonly __wbg_wasmlinkmetadata_free: (a: number, b: number) => void;
|
|
988
1020
|
readonly __wbg_wasmmetadataentry_free: (a: number, b: number) => void;
|
|
989
1021
|
readonly __wbg_wasmnodecontent_free: (a: number, b: number) => void;
|
|
990
|
-
readonly __wbg_wasmnodecontext_free: (a: number, b: number) => void;
|
|
991
1022
|
readonly __wbg_wasmpreprocessingoptions_free: (a: number, b: number) => void;
|
|
992
1023
|
readonly __wbg_wasmprocessingwarning_free: (a: number, b: number) => void;
|
|
993
1024
|
readonly __wbg_wasmstructureddata_free: (a: number, b: number) => void;
|
|
@@ -1349,18 +1380,13 @@ export interface InitOutput {
|
|
|
1349
1380
|
readonly wasmnodecontent_text: (a: number, b: number) => void;
|
|
1350
1381
|
readonly wasmnodecontext_attributes: (a: number) => number;
|
|
1351
1382
|
readonly wasmnodecontext_default: () => number;
|
|
1352
|
-
readonly
|
|
1383
|
+
readonly wasmnodecontext_intoOwned: (a: number) => number;
|
|
1353
1384
|
readonly wasmnodecontext_isInline: (a: number) => number;
|
|
1354
|
-
readonly wasmnodecontext_new: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number
|
|
1385
|
+
readonly wasmnodecontext_new: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
|
|
1355
1386
|
readonly wasmnodecontext_nodeType: (a: number, b: number) => void;
|
|
1356
|
-
readonly wasmnodecontext_parentTag: (a: number, b: number) => void;
|
|
1357
|
-
readonly wasmnodecontext_set_attributes: (a: number, b: number) => void;
|
|
1358
|
-
readonly wasmnodecontext_set_indexInParent: (a: number, b: number) => void;
|
|
1359
1387
|
readonly wasmnodecontext_set_isInline: (a: number, b: number) => void;
|
|
1360
1388
|
readonly wasmnodecontext_set_nodeType: (a: number, b: number) => void;
|
|
1361
|
-
readonly
|
|
1362
|
-
readonly wasmnodecontext_set_tagName: (a: number, b: number, c: number) => void;
|
|
1363
|
-
readonly wasmnodecontext_tagName: (a: number, b: number) => void;
|
|
1389
|
+
readonly wasmnodecontext_withOwnedAttributes: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => number;
|
|
1364
1390
|
readonly wasmpreprocessingoptions_default: () => number;
|
|
1365
1391
|
readonly wasmpreprocessingoptions_enabled: (a: number) => number;
|
|
1366
1392
|
readonly wasmpreprocessingoptions_new: (a: number, b: number, c: number, d: number) => number;
|
|
@@ -1414,6 +1440,7 @@ export interface InitOutput {
|
|
|
1414
1440
|
readonly wasmnodecontent_new: () => number;
|
|
1415
1441
|
readonly wasmheadermetadata_set_depth: (a: number, b: number) => void;
|
|
1416
1442
|
readonly wasmnodecontext_set_depth: (a: number, b: number) => void;
|
|
1443
|
+
readonly wasmnodecontext_set_indexInParent: (a: number, b: number) => void;
|
|
1417
1444
|
readonly wasmtablegrid_set_cols: (a: number, b: number) => void;
|
|
1418
1445
|
readonly wasmtablegrid_set_rows: (a: number, b: number) => void;
|
|
1419
1446
|
readonly wasmtextannotation_set_end: (a: number, b: number) => void;
|
|
@@ -1421,13 +1448,19 @@ export interface InitOutput {
|
|
|
1421
1448
|
readonly wasmnodecontent_set_imageIndex: (a: number, b: number) => void;
|
|
1422
1449
|
readonly wasmheadermetadata_depth: (a: number) => number;
|
|
1423
1450
|
readonly wasmnodecontext_depth: (a: number) => number;
|
|
1451
|
+
readonly wasmnodecontext_indexInParent: (a: number) => number;
|
|
1424
1452
|
readonly wasmtablegrid_cols: (a: number) => number;
|
|
1425
1453
|
readonly wasmtablegrid_rows: (a: number) => number;
|
|
1426
1454
|
readonly wasmtextannotation_end: (a: number) => number;
|
|
1427
1455
|
readonly wasmtextannotation_start: (a: number) => number;
|
|
1428
1456
|
readonly wasmannotationkind_new: () => number;
|
|
1457
|
+
readonly wasmnodecontext_parentTag: (a: number, b: number) => void;
|
|
1429
1458
|
readonly wasmnodecontent_set_ordered: (a: number, b: number) => void;
|
|
1459
|
+
readonly wasmnodecontext_set_tagName: (a: number, b: number, c: number) => void;
|
|
1460
|
+
readonly wasmnodecontext_set_parentTag: (a: number, b: number, c: number) => void;
|
|
1461
|
+
readonly wasmnodecontext_tagName: (a: number, b: number) => void;
|
|
1430
1462
|
readonly wasmnodecontent_imageIndex: (a: number) => number;
|
|
1463
|
+
readonly __wbg_wasmnodecontext_free: (a: number, b: number) => void;
|
|
1431
1464
|
readonly __wbg_wasmpreprocessingoptionsupdate_free: (a: number, b: number) => void;
|
|
1432
1465
|
readonly __wbindgen_export: (a: number, b: number) => number;
|
|
1433
1466
|
readonly __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
|