@senlinz/import-export-wasm 0.1.1 → 0.1.2

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/README.md CHANGED
@@ -75,6 +75,7 @@ The browser example is covered by Playwright tests in [`./tests/wasm.test.js`](.
75
75
  ## Runtime notes
76
76
 
77
77
  - Browser usage requires the generated JS/WASM assets from `wasm-pack build`.
78
+ - The generated `pkg/` directory is a build artifact and is not tracked in git.
78
79
  - Image export requires `.withImageFetcher(...)`.
79
80
  - Invalid schemas and invalid exported number/date values now fail with explicit errors.
80
81
 
@@ -82,6 +83,7 @@ The browser example is covered by Playwright tests in [`./tests/wasm.test.js`](.
82
83
 
83
84
  ```bash
84
85
  cargo test --lib
86
+ cargo bench --features benchmarks
85
87
  wasm-pack build --release --target web
86
88
  corepack pnpm install
87
89
  corepack pnpm exec playwright install chromium
package/README.zh.md CHANGED
@@ -75,6 +75,7 @@ const imported = importData(info, workbook);
75
75
  ## 运行时说明
76
76
 
77
77
  - 浏览器使用前需要通过 `wasm-pack build` 生成 JS / WASM 产物。
78
+ - 生成的 `pkg/` 目录属于构建产物,不会提交到 git。
78
79
  - 图片导出需要 `.withImageFetcher(...)`。
79
80
  - 非法 schema、非法数字值、非法日期值都会返回明确错误。
80
81
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@senlinz/import-export-wasm",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "Rust WebAssembly for import/export excel files",
5
5
  "main": "pkg/imexport_wasm.js",
6
6
  "types": "pkg/imexport_wasm.d.ts",
@@ -39,7 +39,8 @@
39
39
  "build": "wasm-pack build --release --target web",
40
40
  "publish-dry-run": "pnpm publish --dry-run --no-git-checks",
41
41
  "cargo-test": "cargo test --lib",
42
- "e2e-serve": "wasm-pack build --release --target web -d tests/dist && serve -l 8080 .",
42
+ "cargo-bench": "cargo bench --features benchmarks",
43
+ "e2e-serve": "serve -l 8080 .",
43
44
  "e2e-test": "playwright test -c playwright.config.js"
44
45
  }
45
46
  }
@@ -248,7 +248,7 @@ export interface InitOutput {
248
248
  readonly excelcolumninfo_withParent: (a: number, b: number, c: number) => number;
249
249
  readonly excelcolumninfo_withValueFormat: (a: number, b: number, c: number) => number;
250
250
  readonly excelcolumninfo_withWidth: (a: number, b: number) => number;
251
- readonly excelinfo_bind_new: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => number;
251
+ readonly excelinfo_bind_new: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => [number, number, number];
252
252
  readonly excelinfo_withDefaultRowHeight: (a: number, b: number) => number;
253
253
  readonly excelinfo_withHeaderRowHeight: (a: number, b: number) => number;
254
254
  readonly excelinfo_withImageFetcher: (a: number, b: any) => number;
@@ -285,8 +285,8 @@ export interface InitOutput {
285
285
  readonly __wbg_get_exceldata_rows: (a: number) => [number, number];
286
286
  readonly __wbg_set_exceldata_rows: (a: number, b: number, c: number) => void;
287
287
  readonly exceldata_new: (a: number, b: number) => number;
288
- readonly wasm_bindgen__convert__closures_____invoke__ha7d74a6bd6ac009d: (a: number, b: number, c: any) => [number, number];
289
- readonly wasm_bindgen__convert__closures_____invoke__h1f6390709e7a2f81: (a: number, b: number, c: any, d: any) => void;
288
+ readonly wasm_bindgen__convert__closures_____invoke__hb3e5d356ee2e5466: (a: number, b: number, c: any) => [number, number];
289
+ readonly wasm_bindgen__convert__closures_____invoke__h98029d2eb04d9334: (a: number, b: number, c: any, d: any) => void;
290
290
  readonly __wbindgen_malloc: (a: number, b: number) => number;
291
291
  readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
292
292
  readonly __wbindgen_exn_store: (a: number) => void;
@@ -1095,7 +1095,10 @@ export class ExcelInfo {
1095
1095
  const ptr4 = passStringToWasm0(create_time, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1096
1096
  const len4 = WASM_VECTOR_LEN;
1097
1097
  const ret = wasm.excelinfo_bind_new(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, ptr4, len4);
1098
- this.__wbg_ptr = ret >>> 0;
1098
+ if (ret[2]) {
1099
+ throw takeFromExternrefTable0(ret[1]);
1100
+ }
1101
+ this.__wbg_ptr = ret[0] >>> 0;
1099
1102
  ExcelInfoFinalization.register(this, this.__wbg_ptr, this);
1100
1103
  return this;
1101
1104
  }
@@ -1532,35 +1535,34 @@ export function importDynamicData(sheet_name, header_row, excel_bytes) {
1532
1535
  }
1533
1536
  return DynamicExcelData.__wrap(ret[0]);
1534
1537
  }
1535
-
1536
1538
  function __wbg_get_imports() {
1537
1539
  const import0 = {
1538
1540
  __proto__: null,
1539
- __wbg_Error_7c536b7a8123d334: function(arg0, arg1) {
1541
+ __wbg_Error_960c155d3d49e4c2: function(arg0, arg1) {
1540
1542
  const ret = Error(getStringFromWasm0(arg0, arg1));
1541
1543
  return ret;
1542
1544
  },
1543
- __wbg___wbindgen_debug_string_8baecc377ad92880: function(arg0, arg1) {
1545
+ __wbg___wbindgen_debug_string_ab4b34d23d6778bd: function(arg0, arg1) {
1544
1546
  const ret = debugString(arg1);
1545
1547
  const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1546
1548
  const len1 = WASM_VECTOR_LEN;
1547
1549
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1548
1550
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1549
1551
  },
1550
- __wbg___wbindgen_is_function_d4c2480b46f29e33: function(arg0) {
1552
+ __wbg___wbindgen_is_function_3baa9db1a987f47d: function(arg0) {
1551
1553
  const ret = typeof(arg0) === 'function';
1552
1554
  return ret;
1553
1555
  },
1554
- __wbg___wbindgen_is_object_e04e3a51a90cde43: function(arg0) {
1556
+ __wbg___wbindgen_is_object_63322ec0cd6ea4ef: function(arg0) {
1555
1557
  const val = arg0;
1556
1558
  const ret = typeof(val) === 'object' && val !== null;
1557
1559
  return ret;
1558
1560
  },
1559
- __wbg___wbindgen_is_undefined_5957b329897cc39c: function(arg0) {
1561
+ __wbg___wbindgen_is_undefined_29a43b4d42920abd: function(arg0) {
1560
1562
  const ret = arg0 === undefined;
1561
1563
  return ret;
1562
1564
  },
1563
- __wbg___wbindgen_string_get_ae6081df8158aa73: function(arg0, arg1) {
1565
+ __wbg___wbindgen_string_get_7ed5322991caaec5: function(arg0, arg1) {
1564
1566
  const obj = arg1;
1565
1567
  const ret = typeof(obj) === 'string' ? obj : undefined;
1566
1568
  var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
@@ -1568,13 +1570,13 @@ function __wbg_get_imports() {
1568
1570
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1569
1571
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1570
1572
  },
1571
- __wbg___wbindgen_throw_bd5a70920abf0236: function(arg0, arg1) {
1573
+ __wbg___wbindgen_throw_6b64449b9b9ed33c: function(arg0, arg1) {
1572
1574
  throw new Error(getStringFromWasm0(arg0, arg1));
1573
1575
  },
1574
- __wbg__wbg_cb_unref_207c541c2d58dfb3: function(arg0) {
1576
+ __wbg__wbg_cb_unref_b46c9b5a9f08ec37: function(arg0) {
1575
1577
  arg0._wbg_cb_unref();
1576
1578
  },
1577
- __wbg_call_1aea13500fe8ff6c: function() { return handleError(function (arg0, arg1, arg2) {
1579
+ __wbg_call_a24592a6f349a97e: function() { return handleError(function (arg0, arg1, arg2) {
1578
1580
  const ret = arg0.call(arg1, arg2);
1579
1581
  return ret;
1580
1582
  }, arguments); },
@@ -1610,26 +1612,26 @@ function __wbg_get_imports() {
1610
1612
  const ret = ExcelRowData.__unwrap(arg0);
1611
1613
  return ret;
1612
1614
  },
1613
- __wbg_length_090b6aa6235450ba: function(arg0) {
1615
+ __wbg_length_9f1775224cf1d815: function(arg0) {
1614
1616
  const ret = arg0.length;
1615
1617
  return ret;
1616
1618
  },
1617
- __wbg_new_4774b8d4db1224e4: function(arg0) {
1619
+ __wbg_new_0c7403db6e782f19: function(arg0) {
1618
1620
  const ret = new Uint8Array(arg0);
1619
1621
  return ret;
1620
1622
  },
1621
- __wbg_new_from_slice_2733a138cec5cdcf: function(arg0, arg1) {
1623
+ __wbg_new_from_slice_b5ea43e23f6008c0: function(arg0, arg1) {
1622
1624
  const ret = new Uint8Array(getArrayU8FromWasm0(arg0, arg1));
1623
1625
  return ret;
1624
1626
  },
1625
- __wbg_new_typed_5101eada2c6754de: function(arg0, arg1) {
1627
+ __wbg_new_typed_323f37fd55ab048d: function(arg0, arg1) {
1626
1628
  try {
1627
1629
  var state0 = {a: arg0, b: arg1};
1628
1630
  var cb0 = (arg0, arg1) => {
1629
1631
  const a = state0.a;
1630
1632
  state0.a = 0;
1631
1633
  try {
1632
- return wasm_bindgen__convert__closures_____invoke__h1f6390709e7a2f81(a, state0.b, arg0, arg1);
1634
+ return wasm_bindgen__convert__closures_____invoke__h98029d2eb04d9334(a, state0.b, arg0, arg1);
1633
1635
  } finally {
1634
1636
  state0.a = a;
1635
1637
  }
@@ -1640,51 +1642,51 @@ function __wbg_get_imports() {
1640
1642
  state0.a = 0;
1641
1643
  }
1642
1644
  },
1643
- __wbg_now_cd850b0a28a6e656: function() {
1645
+ __wbg_now_a9b7df1cbee90986: function() {
1644
1646
  const ret = Date.now();
1645
1647
  return ret;
1646
1648
  },
1647
- __wbg_prototypesetcall_7dca54d31cb9d2dc: function(arg0, arg1, arg2) {
1649
+ __wbg_prototypesetcall_a6b02eb00b0f4ce2: function(arg0, arg1, arg2) {
1648
1650
  Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
1649
1651
  },
1650
- __wbg_queueMicrotask_1f50b4bdf2c98605: function(arg0) {
1652
+ __wbg_queueMicrotask_5d15a957e6aa920e: function(arg0) {
1651
1653
  queueMicrotask(arg0);
1652
1654
  },
1653
- __wbg_queueMicrotask_805204511f79bee8: function(arg0) {
1655
+ __wbg_queueMicrotask_f8819e5ffc402f36: function(arg0) {
1654
1656
  const ret = arg0.queueMicrotask;
1655
1657
  return ret;
1656
1658
  },
1657
- __wbg_resolve_bb4df27803d377b2: function(arg0) {
1659
+ __wbg_resolve_e6c466bc1052f16c: function(arg0) {
1658
1660
  const ret = Promise.resolve(arg0);
1659
1661
  return ret;
1660
1662
  },
1661
- __wbg_static_accessor_GLOBAL_44bef9fa6011e260: function() {
1663
+ __wbg_static_accessor_GLOBAL_8cfadc87a297ca02: function() {
1662
1664
  const ret = typeof global === 'undefined' ? null : global;
1663
1665
  return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
1664
1666
  },
1665
- __wbg_static_accessor_GLOBAL_THIS_13002645baf43d84: function() {
1667
+ __wbg_static_accessor_GLOBAL_THIS_602256ae5c8f42cf: function() {
1666
1668
  const ret = typeof globalThis === 'undefined' ? null : globalThis;
1667
1669
  return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
1668
1670
  },
1669
- __wbg_static_accessor_SELF_91d0abd4d035416c: function() {
1671
+ __wbg_static_accessor_SELF_e445c1c7484aecc3: function() {
1670
1672
  const ret = typeof self === 'undefined' ? null : self;
1671
1673
  return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
1672
1674
  },
1673
- __wbg_static_accessor_WINDOW_513f857c65724fc7: function() {
1675
+ __wbg_static_accessor_WINDOW_f20e8576ef1e0f17: function() {
1674
1676
  const ret = typeof window === 'undefined' ? null : window;
1675
1677
  return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
1676
1678
  },
1677
- __wbg_then_d9ebfadd74ddfbb2: function(arg0, arg1) {
1678
- const ret = arg0.then(arg1);
1679
+ __wbg_then_792e0c862b060889: function(arg0, arg1, arg2) {
1680
+ const ret = arg0.then(arg1, arg2);
1679
1681
  return ret;
1680
1682
  },
1681
- __wbg_then_f6dedb0d880db23a: function(arg0, arg1, arg2) {
1682
- const ret = arg0.then(arg1, arg2);
1683
+ __wbg_then_8e16ee11f05e4827: function(arg0, arg1) {
1684
+ const ret = arg0.then(arg1);
1683
1685
  return ret;
1684
1686
  },
1685
1687
  __wbindgen_cast_0000000000000001: function(arg0, arg1) {
1686
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 366, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
1687
- const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__ha7d74a6bd6ac009d);
1688
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 368, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
1689
+ const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__hb3e5d356ee2e5466);
1688
1690
  return ret;
1689
1691
  },
1690
1692
  __wbindgen_cast_0000000000000002: function(arg0) {
@@ -1713,15 +1715,15 @@ function __wbg_get_imports() {
1713
1715
  };
1714
1716
  }
1715
1717
 
1716
- function wasm_bindgen__convert__closures_____invoke__ha7d74a6bd6ac009d(arg0, arg1, arg2) {
1717
- const ret = wasm.wasm_bindgen__convert__closures_____invoke__ha7d74a6bd6ac009d(arg0, arg1, arg2);
1718
+ function wasm_bindgen__convert__closures_____invoke__hb3e5d356ee2e5466(arg0, arg1, arg2) {
1719
+ const ret = wasm.wasm_bindgen__convert__closures_____invoke__hb3e5d356ee2e5466(arg0, arg1, arg2);
1718
1720
  if (ret[1]) {
1719
1721
  throw takeFromExternrefTable0(ret[0]);
1720
1722
  }
1721
1723
  }
1722
1724
 
1723
- function wasm_bindgen__convert__closures_____invoke__h1f6390709e7a2f81(arg0, arg1, arg2, arg3) {
1724
- wasm.wasm_bindgen__convert__closures_____invoke__h1f6390709e7a2f81(arg0, arg1, arg2, arg3);
1725
+ function wasm_bindgen__convert__closures_____invoke__h98029d2eb04d9334(arg0, arg1, arg2, arg3) {
1726
+ wasm.wasm_bindgen__convert__closures_____invoke__h98029d2eb04d9334(arg0, arg1, arg2, arg3);
1725
1727
  }
1726
1728
 
1727
1729
  const DynamicExcelDataFinalization = (typeof FinalizationRegistry === 'undefined')
Binary file