@kreuzberg/html-to-markdown-wasm 3.6.0-rc.12 → 3.6.0-rc.13
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 +35 -3
- package/pkg/bundler/html_to_markdown_wasm_bg.js +228 -11
- 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 +35 -3
- package/pkg/deno/html_to_markdown_wasm.js +228 -11
- 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 +35 -3
- package/pkg/nodejs/html_to_markdown_wasm.js +228 -11
- 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 +45 -12
- package/pkg/web/html_to_markdown_wasm.js +228 -11
- 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
package/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;
|
|
@@ -4374,7 +4374,21 @@ if (Symbol.dispose) WasmNodeContent.prototype[Symbol.dispose] = WasmNodeContent.
|
|
|
4374
4374
|
* Context information passed to all visitor methods.
|
|
4375
4375
|
*
|
|
4376
4376
|
* Provides comprehensive metadata about the current node being visited,
|
|
4377
|
-
* including its type,
|
|
4377
|
+
* including its type, tag name, position in the DOM tree, and parent context.
|
|
4378
|
+
*
|
|
4379
|
+
* ## Attributes
|
|
4380
|
+
*
|
|
4381
|
+
* Access attributes via `NodeContext.attributes`, which returns
|
|
4382
|
+
* `&BTreeMap<String, String>`. When the context was built with
|
|
4383
|
+
* `NodeContext.with_lazy_attributes` (the hot path inside the converter),
|
|
4384
|
+
* the map is only materialized on the first call — if the visitor never reads
|
|
4385
|
+
* attributes, the allocation is skipped.
|
|
4386
|
+
*
|
|
4387
|
+
* ## Lifetimes
|
|
4388
|
+
*
|
|
4389
|
+
* String fields use `Cow<'_, str>` so the converter can pass slices directly
|
|
4390
|
+
* out of the parsed DOM without allocating. Visitor implementations that need
|
|
4391
|
+
* to outlive the callback should call `NodeContext.into_owned`.
|
|
4378
4392
|
*/
|
|
4379
4393
|
export class WasmNodeContext {
|
|
4380
4394
|
static __wrap(ptr) {
|
|
@@ -4394,9 +4408,14 @@ export class WasmNodeContext {
|
|
|
4394
4408
|
wasm.__wbg_wasmnodecontext_free(ptr, 0);
|
|
4395
4409
|
}
|
|
4396
4410
|
/**
|
|
4411
|
+
* Return a reference to the attribute map.
|
|
4412
|
+
*
|
|
4413
|
+
* If the context was built with `NodeContext.with_lazy_attributes`, the
|
|
4414
|
+
* map is materialized on the first call and cached for subsequent calls.
|
|
4415
|
+
* If this method is never called, no allocation occurs for attributes.
|
|
4397
4416
|
* @returns {any}
|
|
4398
4417
|
*/
|
|
4399
|
-
|
|
4418
|
+
attributes() {
|
|
4400
4419
|
const ret = wasm.wasmnodecontext_attributes(this.__wbg_ptr);
|
|
4401
4420
|
return takeObject(ret);
|
|
4402
4421
|
}
|
|
@@ -4421,6 +4440,14 @@ export class WasmNodeContext {
|
|
|
4421
4440
|
const ret = wasm.wasmnodecontext_indexInParent(this.__wbg_ptr);
|
|
4422
4441
|
return ret >>> 0;
|
|
4423
4442
|
}
|
|
4443
|
+
/**
|
|
4444
|
+
* Promote any borrowed fields into owned storage so the context can outlive `'a`.
|
|
4445
|
+
* @returns {WasmNodeContext}
|
|
4446
|
+
*/
|
|
4447
|
+
intoOwned() {
|
|
4448
|
+
const ret = wasm.wasmnodecontext_intoOwned(this.__wbg_ptr);
|
|
4449
|
+
return WasmNodeContext.__wrap(ret);
|
|
4450
|
+
}
|
|
4424
4451
|
/**
|
|
4425
4452
|
* @returns {boolean}
|
|
4426
4453
|
*/
|
|
@@ -4431,18 +4458,17 @@ export class WasmNodeContext {
|
|
|
4431
4458
|
/**
|
|
4432
4459
|
* @param {WasmNodeType} nodeType
|
|
4433
4460
|
* @param {string} tagName
|
|
4434
|
-
* @param {any} attributes
|
|
4435
4461
|
* @param {number} depth
|
|
4436
4462
|
* @param {number} indexInParent
|
|
4437
4463
|
* @param {boolean} isInline
|
|
4438
4464
|
* @param {string | null} [parentTag]
|
|
4439
4465
|
*/
|
|
4440
|
-
constructor(nodeType, tagName,
|
|
4466
|
+
constructor(nodeType, tagName, depth, indexInParent, isInline, parentTag) {
|
|
4441
4467
|
const ptr0 = passStringToWasm0(tagName, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
4442
4468
|
const len0 = WASM_VECTOR_LEN;
|
|
4443
4469
|
var ptr1 = isLikeNone(parentTag) ? 0 : passStringToWasm0(parentTag, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
4444
4470
|
var len1 = WASM_VECTOR_LEN;
|
|
4445
|
-
const ret = wasm.wasmnodecontext_new(nodeType, ptr0, len0,
|
|
4471
|
+
const ret = wasm.wasmnodecontext_new(nodeType, ptr0, len0, depth, indexInParent, isInline, ptr1, len1);
|
|
4446
4472
|
this.__wbg_ptr = ret;
|
|
4447
4473
|
WasmNodeContextFinalization.register(this, this.__wbg_ptr, this);
|
|
4448
4474
|
return this;
|
|
@@ -4485,12 +4511,6 @@ export class WasmNodeContext {
|
|
|
4485
4511
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
4486
4512
|
}
|
|
4487
4513
|
}
|
|
4488
|
-
/**
|
|
4489
|
-
* @param {any} value
|
|
4490
|
-
*/
|
|
4491
|
-
set attributes(value) {
|
|
4492
|
-
wasm.wasmnodecontext_set_attributes(this.__wbg_ptr, addHeapObject(value));
|
|
4493
|
-
}
|
|
4494
4514
|
/**
|
|
4495
4515
|
* @param {number} value
|
|
4496
4516
|
*/
|
|
@@ -4550,6 +4570,28 @@ export class WasmNodeContext {
|
|
|
4550
4570
|
wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
|
|
4551
4571
|
}
|
|
4552
4572
|
}
|
|
4573
|
+
/**
|
|
4574
|
+
* Construct a `NodeContext` with an owned attribute map.
|
|
4575
|
+
*
|
|
4576
|
+
* Prefer `NodeContext.with_lazy_attributes` (pub(crate)) inside the
|
|
4577
|
+
* converter to avoid the eager `collect_tag_attributes` allocation.
|
|
4578
|
+
* @param {WasmNodeType} node_type
|
|
4579
|
+
* @param {string} tag_name
|
|
4580
|
+
* @param {any} attributes
|
|
4581
|
+
* @param {number} depth
|
|
4582
|
+
* @param {number} index_in_parent
|
|
4583
|
+
* @param {string | null | undefined} parent_tag
|
|
4584
|
+
* @param {boolean} is_inline
|
|
4585
|
+
* @returns {WasmNodeContext}
|
|
4586
|
+
*/
|
|
4587
|
+
static withOwnedAttributes(node_type, tag_name, attributes, depth, index_in_parent, parent_tag, is_inline) {
|
|
4588
|
+
const ptr0 = passStringToWasm0(tag_name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
4589
|
+
const len0 = WASM_VECTOR_LEN;
|
|
4590
|
+
var ptr1 = isLikeNone(parent_tag) ? 0 : passStringToWasm0(parent_tag, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
4591
|
+
var len1 = WASM_VECTOR_LEN;
|
|
4592
|
+
const ret = wasm.wasmnodecontext_withOwnedAttributes(node_type, ptr0, len0, addHeapObject(attributes), depth, index_in_parent, ptr1, len1, is_inline);
|
|
4593
|
+
return WasmNodeContext.__wrap(ret);
|
|
4594
|
+
}
|
|
4553
4595
|
}
|
|
4554
4596
|
if (Symbol.dispose) WasmNodeContext.prototype[Symbol.dispose] = WasmNodeContext.prototype.free;
|
|
4555
4597
|
|
|
@@ -5601,6 +5643,22 @@ export function convert(html, options) {
|
|
|
5601
5643
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
5602
5644
|
}
|
|
5603
5645
|
}
|
|
5646
|
+
export function __wbg_Error_ef53bc310eb298a0(arg0, arg1) {
|
|
5647
|
+
const ret = Error(getStringFromWasm0(arg0, arg1));
|
|
5648
|
+
return addHeapObject(ret);
|
|
5649
|
+
}
|
|
5650
|
+
export function __wbg___wbindgen_boolean_get_1a45e2c38d4d41b9(arg0) {
|
|
5651
|
+
const v = getObject(arg0);
|
|
5652
|
+
const ret = typeof(v) === 'boolean' ? v : undefined;
|
|
5653
|
+
return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
|
|
5654
|
+
}
|
|
5655
|
+
export function __wbg___wbindgen_debug_string_0accd80f45e5faa2(arg0, arg1) {
|
|
5656
|
+
const ret = debugString(getObject(arg1));
|
|
5657
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
5658
|
+
const len1 = WASM_VECTOR_LEN;
|
|
5659
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
5660
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
5661
|
+
}
|
|
5604
5662
|
export function __wbg___wbindgen_is_function_754e9f305ff6029e(arg0) {
|
|
5605
5663
|
const ret = typeof(getObject(arg0)) === 'function';
|
|
5606
5664
|
return ret;
|
|
@@ -5614,6 +5672,16 @@ export function __wbg___wbindgen_is_undefined_67b456be8673d3d7(arg0) {
|
|
|
5614
5672
|
const ret = getObject(arg0) === undefined;
|
|
5615
5673
|
return ret;
|
|
5616
5674
|
}
|
|
5675
|
+
export function __wbg___wbindgen_jsval_loose_eq_2c56564c75129511(arg0, arg1) {
|
|
5676
|
+
const ret = getObject(arg0) == getObject(arg1);
|
|
5677
|
+
return ret;
|
|
5678
|
+
}
|
|
5679
|
+
export function __wbg___wbindgen_number_get_9bb1761122181af2(arg0, arg1) {
|
|
5680
|
+
const obj = getObject(arg1);
|
|
5681
|
+
const ret = typeof(obj) === 'number' ? obj : undefined;
|
|
5682
|
+
getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
|
|
5683
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
|
|
5684
|
+
}
|
|
5617
5685
|
export function __wbg___wbindgen_string_get_72bdf95d3ae505b1(arg0, arg1) {
|
|
5618
5686
|
const obj = getObject(arg1);
|
|
5619
5687
|
const ret = typeof(obj) === 'string' ? obj : undefined;
|
|
@@ -5629,14 +5697,78 @@ export function __wbg_apply_292b6d94e4f92b15() { return handleError(function (ar
|
|
|
5629
5697
|
const ret = getObject(arg0).apply(getObject(arg1), getObject(arg2));
|
|
5630
5698
|
return addHeapObject(ret);
|
|
5631
5699
|
}, arguments); }
|
|
5700
|
+
export function __wbg_call_8a89609d89f6608a() { return handleError(function (arg0, arg1) {
|
|
5701
|
+
const ret = getObject(arg0).call(getObject(arg1));
|
|
5702
|
+
return addHeapObject(ret);
|
|
5703
|
+
}, arguments); }
|
|
5704
|
+
export function __wbg_done_60cf307fcc680536(arg0) {
|
|
5705
|
+
const ret = getObject(arg0).done;
|
|
5706
|
+
return ret;
|
|
5707
|
+
}
|
|
5708
|
+
export function __wbg_entries_04b37a02507f1713(arg0) {
|
|
5709
|
+
const ret = Object.entries(getObject(arg0));
|
|
5710
|
+
return addHeapObject(ret);
|
|
5711
|
+
}
|
|
5712
|
+
export function __wbg_get_1f8f054ddbaa7db2() { return handleError(function (arg0, arg1) {
|
|
5713
|
+
const ret = Reflect.get(getObject(arg0), getObject(arg1));
|
|
5714
|
+
return addHeapObject(ret);
|
|
5715
|
+
}, arguments); }
|
|
5716
|
+
export function __wbg_get_2b48c7d0d006a781(arg0, arg1) {
|
|
5717
|
+
const ret = getObject(arg0)[arg1 >>> 0];
|
|
5718
|
+
return addHeapObject(ret);
|
|
5719
|
+
}
|
|
5632
5720
|
export function __wbg_get_de6a0f7d4d18a304() { return handleError(function (arg0, arg1) {
|
|
5633
5721
|
const ret = Reflect.get(getObject(arg0), getObject(arg1));
|
|
5634
5722
|
return addHeapObject(ret);
|
|
5635
5723
|
}, arguments); }
|
|
5724
|
+
export function __wbg_get_unchecked_33f6e5c9e2f2d6b2(arg0, arg1) {
|
|
5725
|
+
const ret = getObject(arg0)[arg1 >>> 0];
|
|
5726
|
+
return addHeapObject(ret);
|
|
5727
|
+
}
|
|
5636
5728
|
export function __wbg_has_73740b27f436fed3() { return handleError(function (arg0, arg1) {
|
|
5637
5729
|
const ret = Reflect.has(getObject(arg0), getObject(arg1));
|
|
5638
5730
|
return ret;
|
|
5639
5731
|
}, arguments); }
|
|
5732
|
+
export function __wbg_instanceof_ArrayBuffer_8f49811467741499(arg0) {
|
|
5733
|
+
let result;
|
|
5734
|
+
try {
|
|
5735
|
+
result = getObject(arg0) instanceof ArrayBuffer;
|
|
5736
|
+
} catch (_) {
|
|
5737
|
+
result = false;
|
|
5738
|
+
}
|
|
5739
|
+
const ret = result;
|
|
5740
|
+
return ret;
|
|
5741
|
+
}
|
|
5742
|
+
export function __wbg_instanceof_Uint8Array_86f30649f63ef9c2(arg0) {
|
|
5743
|
+
let result;
|
|
5744
|
+
try {
|
|
5745
|
+
result = getObject(arg0) instanceof Uint8Array;
|
|
5746
|
+
} catch (_) {
|
|
5747
|
+
result = false;
|
|
5748
|
+
}
|
|
5749
|
+
const ret = result;
|
|
5750
|
+
return ret;
|
|
5751
|
+
}
|
|
5752
|
+
export function __wbg_iterator_8732428d309e270e() {
|
|
5753
|
+
const ret = Symbol.iterator;
|
|
5754
|
+
return addHeapObject(ret);
|
|
5755
|
+
}
|
|
5756
|
+
export function __wbg_length_4a591ecaa01354d9(arg0) {
|
|
5757
|
+
const ret = getObject(arg0).length;
|
|
5758
|
+
return ret;
|
|
5759
|
+
}
|
|
5760
|
+
export function __wbg_length_66f1a4b2e9026940(arg0) {
|
|
5761
|
+
const ret = getObject(arg0).length;
|
|
5762
|
+
return ret;
|
|
5763
|
+
}
|
|
5764
|
+
export function __wbg_new_578aeef4b6b94378(arg0) {
|
|
5765
|
+
const ret = new Uint8Array(getObject(arg0));
|
|
5766
|
+
return addHeapObject(ret);
|
|
5767
|
+
}
|
|
5768
|
+
export function __wbg_new_622fc80556be2e26() {
|
|
5769
|
+
const ret = new Map();
|
|
5770
|
+
return addHeapObject(ret);
|
|
5771
|
+
}
|
|
5640
5772
|
export function __wbg_new_ce1ab61c1c2b300d() {
|
|
5641
5773
|
const ret = new Object();
|
|
5642
5774
|
return addHeapObject(ret);
|
|
@@ -5645,10 +5777,21 @@ export function __wbg_new_d90091b82fdf5b91() {
|
|
|
5645
5777
|
const ret = new Array();
|
|
5646
5778
|
return addHeapObject(ret);
|
|
5647
5779
|
}
|
|
5780
|
+
export function __wbg_next_9e03acdf51c4960d(arg0) {
|
|
5781
|
+
const ret = getObject(arg0).next;
|
|
5782
|
+
return addHeapObject(ret);
|
|
5783
|
+
}
|
|
5784
|
+
export function __wbg_next_eb8ca7351fa27906() { return handleError(function (arg0) {
|
|
5785
|
+
const ret = getObject(arg0).next();
|
|
5786
|
+
return addHeapObject(ret);
|
|
5787
|
+
}, arguments); }
|
|
5648
5788
|
export function __wbg_parse_03863847d06c4e89() { return handleError(function (arg0, arg1) {
|
|
5649
5789
|
const ret = JSON.parse(getStringFromWasm0(arg0, arg1));
|
|
5650
5790
|
return addHeapObject(ret);
|
|
5651
5791
|
}, arguments); }
|
|
5792
|
+
export function __wbg_prototypesetcall_3249fc62a0fafa30(arg0, arg1, arg2) {
|
|
5793
|
+
Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), getObject(arg2));
|
|
5794
|
+
}
|
|
5652
5795
|
export function __wbg_push_a6822215aa43e71c(arg0, arg1) {
|
|
5653
5796
|
const ret = getObject(arg0).push(getObject(arg1));
|
|
5654
5797
|
return ret;
|
|
@@ -5663,6 +5806,10 @@ export function __wbg_set_6e30c9374c26414c() { return handleError(function (arg0
|
|
|
5663
5806
|
export function __wbg_set_dca99999bba88a9a(arg0, arg1, arg2) {
|
|
5664
5807
|
getObject(arg0)[arg1 >>> 0] = takeObject(arg2);
|
|
5665
5808
|
}
|
|
5809
|
+
export function __wbg_value_f3625092ee4b37f4(arg0) {
|
|
5810
|
+
const ret = getObject(arg0).value;
|
|
5811
|
+
return addHeapObject(ret);
|
|
5812
|
+
}
|
|
5666
5813
|
export function __wbg_wasmdocumentnode_new(arg0) {
|
|
5667
5814
|
const ret = WasmDocumentNode.__wrap(arg0);
|
|
5668
5815
|
return addHeapObject(ret);
|
|
@@ -5848,6 +5995,71 @@ function _assertClass(instance, klass) {
|
|
|
5848
5995
|
}
|
|
5849
5996
|
}
|
|
5850
5997
|
|
|
5998
|
+
function debugString(val) {
|
|
5999
|
+
// primitive types
|
|
6000
|
+
const type = typeof val;
|
|
6001
|
+
if (type == 'number' || type == 'boolean' || val == null) {
|
|
6002
|
+
return `${val}`;
|
|
6003
|
+
}
|
|
6004
|
+
if (type == 'string') {
|
|
6005
|
+
return `"${val}"`;
|
|
6006
|
+
}
|
|
6007
|
+
if (type == 'symbol') {
|
|
6008
|
+
const description = val.description;
|
|
6009
|
+
if (description == null) {
|
|
6010
|
+
return 'Symbol';
|
|
6011
|
+
} else {
|
|
6012
|
+
return `Symbol(${description})`;
|
|
6013
|
+
}
|
|
6014
|
+
}
|
|
6015
|
+
if (type == 'function') {
|
|
6016
|
+
const name = val.name;
|
|
6017
|
+
if (typeof name == 'string' && name.length > 0) {
|
|
6018
|
+
return `Function(${name})`;
|
|
6019
|
+
} else {
|
|
6020
|
+
return 'Function';
|
|
6021
|
+
}
|
|
6022
|
+
}
|
|
6023
|
+
// objects
|
|
6024
|
+
if (Array.isArray(val)) {
|
|
6025
|
+
const length = val.length;
|
|
6026
|
+
let debug = '[';
|
|
6027
|
+
if (length > 0) {
|
|
6028
|
+
debug += debugString(val[0]);
|
|
6029
|
+
}
|
|
6030
|
+
for(let i = 1; i < length; i++) {
|
|
6031
|
+
debug += ', ' + debugString(val[i]);
|
|
6032
|
+
}
|
|
6033
|
+
debug += ']';
|
|
6034
|
+
return debug;
|
|
6035
|
+
}
|
|
6036
|
+
// Test for built-in
|
|
6037
|
+
const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
|
|
6038
|
+
let className;
|
|
6039
|
+
if (builtInMatches && builtInMatches.length > 1) {
|
|
6040
|
+
className = builtInMatches[1];
|
|
6041
|
+
} else {
|
|
6042
|
+
// Failed to match the standard '[object ClassName]'
|
|
6043
|
+
return toString.call(val);
|
|
6044
|
+
}
|
|
6045
|
+
if (className == 'Object') {
|
|
6046
|
+
// we're a user defined class or Object
|
|
6047
|
+
// JSON.stringify avoids problems with cycles, and is generally much
|
|
6048
|
+
// easier than looping through ownProperties of `val`.
|
|
6049
|
+
try {
|
|
6050
|
+
return 'Object(' + JSON.stringify(val) + ')';
|
|
6051
|
+
} catch (_) {
|
|
6052
|
+
return 'Object';
|
|
6053
|
+
}
|
|
6054
|
+
}
|
|
6055
|
+
// errors
|
|
6056
|
+
if (val instanceof Error) {
|
|
6057
|
+
return `${val.name}: ${val.message}\n${val.stack}`;
|
|
6058
|
+
}
|
|
6059
|
+
// TODO we could test for more things here, like `Set`s and `Map`s.
|
|
6060
|
+
return className;
|
|
6061
|
+
}
|
|
6062
|
+
|
|
5851
6063
|
function dropObject(idx) {
|
|
5852
6064
|
if (idx < 1028) return;
|
|
5853
6065
|
heap[idx] = heap_next;
|
|
@@ -5869,6 +6081,11 @@ function getArrayU32FromWasm0(ptr, len) {
|
|
|
5869
6081
|
return getUint32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
|
|
5870
6082
|
}
|
|
5871
6083
|
|
|
6084
|
+
function getArrayU8FromWasm0(ptr, len) {
|
|
6085
|
+
ptr = ptr >>> 0;
|
|
6086
|
+
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
6087
|
+
}
|
|
6088
|
+
|
|
5872
6089
|
let cachedDataViewMemory0 = null;
|
|
5873
6090
|
function getDataViewMemory0() {
|
|
5874
6091
|
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/bundler/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;
|