@kent-tokyo/chematic 1.0.14 → 1.0.16
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 +39 -3
- package/chematic_wasm.d.ts +11 -0
- package/chematic_wasm.js +14 -0
- package/chematic_wasm_bg.wasm +0 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@ WebAssembly bindings for [chematic](https://github.com/kent-tokyo/chematic), a p
|
|
|
4
4
|
|
|
5
5
|
Published to npm as [`@kent-tokyo/chematic`](https://www.npmjs.com/package/@kent-tokyo/chematic).
|
|
6
6
|
|
|
7
|
-
The current workspace line is 1.0.
|
|
7
|
+
The current workspace line is 1.0.15. The binding keeps bounded parsing,
|
|
8
8
|
typed failures, and opt-in `embed_pipeline_v2_json`; 3D/MMFF94 behavior remains
|
|
9
9
|
Experimental and is not a claim of full RDKit parity.
|
|
10
10
|
|
|
@@ -51,6 +51,19 @@ npm install @kent-tokyo/chematic
|
|
|
51
51
|
|
|
52
52
|
## Usage
|
|
53
53
|
|
|
54
|
+
The generated handle declarations include `Symbol.dispose` for explicit
|
|
55
|
+
resource release. TypeScript consumers should include `ESNext.Disposable` in
|
|
56
|
+
their `tsconfig.json` `lib` list (in addition to their normal browser or Node
|
|
57
|
+
libraries):
|
|
58
|
+
|
|
59
|
+
```json
|
|
60
|
+
{
|
|
61
|
+
"compilerOptions": {
|
|
62
|
+
"lib": ["ES2022", "DOM", "ESNext.Disposable"]
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
```
|
|
66
|
+
|
|
54
67
|
```js
|
|
55
68
|
import init, {
|
|
56
69
|
parse_smiles,
|
|
@@ -95,6 +108,26 @@ console.log(tanimoto_atom_pair(mol, caffeine)); // AtomPair Tanimoto
|
|
|
95
108
|
console.log(tanimoto_torsion(mol, caffeine)); // Torsion Tanimoto
|
|
96
109
|
```
|
|
97
110
|
|
|
111
|
+
### Node.js
|
|
112
|
+
|
|
113
|
+
The published package is built with wasm-pack's `web` target. In a browser,
|
|
114
|
+
`await init()` locates the adjacent WASM asset. Node does not fetch `file:`
|
|
115
|
+
URLs, so pass the asset bytes explicitly:
|
|
116
|
+
|
|
117
|
+
```js
|
|
118
|
+
import { readFile } from 'node:fs/promises';
|
|
119
|
+
import init, { parse_smiles } from '@kent-tokyo/chematic';
|
|
120
|
+
|
|
121
|
+
const wasm = await readFile(new URL(
|
|
122
|
+
'./node_modules/@kent-tokyo/chematic/chematic_wasm_bg.wasm',
|
|
123
|
+
import.meta.url,
|
|
124
|
+
));
|
|
125
|
+
await init({ module_or_path: wasm });
|
|
126
|
+
const mol = parse_smiles('c1ccccc1');
|
|
127
|
+
console.log(mol.formula()); // C6H6
|
|
128
|
+
mol.free();
|
|
129
|
+
```
|
|
130
|
+
|
|
98
131
|
```js
|
|
99
132
|
// Sprint Q: New descriptors (v0.1.15)
|
|
100
133
|
console.log(mol.sa_score()); // synthetic accessibility [1,10]
|
|
@@ -204,9 +237,12 @@ const groups = JSON.parse(v3000_sgroups_json(v3000Block));
|
|
|
204
237
|
This is a syntax-level API; it does not claim polymer expansion, Markush
|
|
205
238
|
interpretation, or cross-engine semantic compatibility.
|
|
206
239
|
|
|
207
|
-
## Bundle
|
|
240
|
+
## Bundle size
|
|
208
241
|
|
|
209
|
-
The
|
|
242
|
+
The published v1.0.15 npm WASM asset is **4,005,280 bytes raw / 1,460,499
|
|
243
|
+
bytes gzip**. Bundle size depends on features and toolchain; see the
|
|
244
|
+
[published-package scorecard](../../benchmarks/2026-09-16-official-rdkit-js-isolated-browser-v1.0.15.md)
|
|
245
|
+
for package versions, digests, tools, and reproduction steps.
|
|
210
246
|
|
|
211
247
|
PNG rasterization (`tiny_skia`) is excluded from the WASM build — use SVG output instead. All SVG depiction APIs remain fully available.
|
|
212
248
|
|
package/chematic_wasm.d.ts
CHANGED
|
@@ -2797,6 +2797,16 @@ export function validate_nmr_spectrum_json(json: string): string;
|
|
|
2797
2797
|
*/
|
|
2798
2798
|
export function virtual_screen_ecfp4_json(query_smi: string, db_smiles_json: string, k: number): string;
|
|
2799
2799
|
|
|
2800
|
+
/**
|
|
2801
|
+
* Current WebAssembly linear-memory allocation in bytes.
|
|
2802
|
+
*
|
|
2803
|
+
* This is an allocation boundary, not a resident-set or live-object estimate:
|
|
2804
|
+
* freed Rust allocations may remain in the linear-memory reservation. It exists
|
|
2805
|
+
* so browser benchmark harnesses can report that dimension explicitly instead
|
|
2806
|
+
* of inferring it from JavaScript heap snapshots.
|
|
2807
|
+
*/
|
|
2808
|
+
export function wasm_linear_memory_bytes(): number;
|
|
2809
|
+
|
|
2800
2810
|
/**
|
|
2801
2811
|
* Compute WHIM descriptors (Weighted Holistic Invariant Molecular) from 3D coordinates.
|
|
2802
2812
|
* Returns JSON array of 22 values: 11 unit-weight descriptors followed by 11 mass-weight
|
|
@@ -3275,6 +3285,7 @@ export interface InitOutput {
|
|
|
3275
3285
|
readonly v3000_sgroups_json: (a: number, b: number) => [number, number, number, number];
|
|
3276
3286
|
readonly validate_nmr_spectrum_json: (a: number, b: number) => [number, number];
|
|
3277
3287
|
readonly virtual_screen_ecfp4_json: (a: number, b: number, c: number, d: number, e: number) => [number, number];
|
|
3288
|
+
readonly wasm_linear_memory_bytes: () => number;
|
|
3278
3289
|
readonly whim_descriptors_json: (a: number) => [number, number];
|
|
3279
3290
|
readonly whim_getaway_combined_json: (a: number) => [number, number];
|
|
3280
3291
|
readonly write_cube_json: (a: number, b: number) => [number, number, number, number];
|
package/chematic_wasm.js
CHANGED
|
@@ -7397,6 +7397,20 @@ export function virtual_screen_ecfp4_json(query_smi, db_smiles_json, k) {
|
|
|
7397
7397
|
}
|
|
7398
7398
|
}
|
|
7399
7399
|
|
|
7400
|
+
/**
|
|
7401
|
+
* Current WebAssembly linear-memory allocation in bytes.
|
|
7402
|
+
*
|
|
7403
|
+
* This is an allocation boundary, not a resident-set or live-object estimate:
|
|
7404
|
+
* freed Rust allocations may remain in the linear-memory reservation. It exists
|
|
7405
|
+
* so browser benchmark harnesses can report that dimension explicitly instead
|
|
7406
|
+
* of inferring it from JavaScript heap snapshots.
|
|
7407
|
+
* @returns {number}
|
|
7408
|
+
*/
|
|
7409
|
+
export function wasm_linear_memory_bytes() {
|
|
7410
|
+
const ret = wasm.wasm_linear_memory_bytes();
|
|
7411
|
+
return ret >>> 0;
|
|
7412
|
+
}
|
|
7413
|
+
|
|
7400
7414
|
/**
|
|
7401
7415
|
* Compute WHIM descriptors (Weighted Holistic Invariant Molecular) from 3D coordinates.
|
|
7402
7416
|
* Returns JSON array of 22 values: 11 unit-weight descriptors followed by 11 mass-weight
|
package/chematic_wasm_bg.wasm
CHANGED
|
Binary file
|
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"Kentaro Tanabe (kent-tokyo) <kent-tokyo@users.noreply.github.com>"
|
|
6
6
|
],
|
|
7
7
|
"description": "WebAssembly bindings for chematic — use chematic from JavaScript/TypeScript",
|
|
8
|
-
"version": "1.0.
|
|
8
|
+
"version": "1.0.16",
|
|
9
9
|
"license": "MIT OR Apache-2.0",
|
|
10
10
|
"repository": {
|
|
11
11
|
"type": "git",
|