@vinary-tree/liblevenshtein 0.0.0 → 4.0.0-rc.5

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
@@ -1,5 +1,213 @@
1
- # Vinary Tree npm bootstrap
1
+ # `@vinary-tree/liblevenshtein`
2
2
 
3
- This inert `0.0.0` artifact reserves an npm coordinate so its GitHub Actions
4
- OIDC trusted publisher can be configured before the first release candidate.
5
- Install the package's `next` or `latest` dist-tag instead.
3
+ This package is the project-local JavaScript, TypeScript, and ClojureScript
4
+ facade for liblevenshtein. It does not contain a second copy of the runtime.
5
+ Every entry point re-exports the liblevenshtein namespace from the exact same
6
+ version of `@vinary-tree/javascript-runtime`, so objects created by
7
+ `@vinary-tree/libdictenstein` can be passed directly to `transducer()`.
8
+
9
+ ```ts
10
+ import { dynamicDawg } from "@vinary-tree/libdictenstein";
11
+ import { transducer } from "@vinary-tree/liblevenshtein";
12
+
13
+ using dictionary = dynamicDawg(["cat", "cot", "cut"]);
14
+ using automaton = transducer(dictionary, "standard");
15
+ using cursor = automaton.query("cat", 1);
16
+ for (const match of cursor) console.log(match);
17
+ ```
18
+
19
+ Node selects the native N-API runtime by default. Use
20
+ `@vinary-tree/liblevenshtein/wasm` for the browser/static WebAssembly runtime or
21
+ `@vinary-tree/liblevenshtein/wasi` for the Node/WASI runtime. The WASI facade is
22
+ where preopened-directory persistent dictionaries are exposed as portable
23
+ support lands; browser persistence remains unsupported.
24
+
25
+ The ClojureScript facade mirrors the Clojure names: `transducer`, `query`,
26
+ `reduce-batches`, `phonetic-pattern`, `phonetic-rules`, `rewrite`, and `close!`.
27
+
28
+ <!-- BEGIN GENERATED BINDING OPERATIONS; DO NOT EDIT -->
29
+
30
+ ## Support and package contract
31
+
32
+ | Property | Contract |
33
+ |---|---|
34
+ | Binding | JavaScript family |
35
+ | Languages/runtime | JavaScript, TypeScript, and ClojureScript on Node.js, browsers, or WASI |
36
+ | Support tier | Tier 1 |
37
+ | Distribution | npm package `@vinary-tree/liblevenshtein` |
38
+ | Native boundary | The facade delegates to the singleton `@vinary-tree/javascript-runtime` runtime: native N-API by default, WebAssembly or WASI through explicit exports. |
39
+ | Canonical facade source | [`bindings/javascript`](../../bindings/javascript) |
40
+
41
+ The support tier controls release gating, not semantic quality: every tier has
42
+ the same snapshot, ownership, status, and ABI compatibility laws. Consult the
43
+ [binding architecture](../../docs/language-bindings.md) before implementing a custom provider
44
+ and the [family hub](../../docs/bindings/README.md) when combining independently packaged projects.
45
+
46
+ ![The host-language facade crosses one project ABI and retains a versioned family resource rather than sharing Rust object layouts.](../../docs/diagrams/bindings/three-layer-architecture.svg)
47
+
48
+ ## Executable example and verification
49
+
50
+ The repository's canonical executable example is
51
+ [`bindings/javascript/test/facades.test.mjs`](../../bindings/javascript/test/facades.test.mjs). It exercises the same public package a user
52
+ installs and is run by the binding CI with:
53
+
54
+ ```sh
55
+ npm test --prefix bindings/javascript
56
+ ```
57
+
58
+ Examples deliberately construct or receive resources through public project
59
+ packages. They never import private Rust modules, depend on object layout, or
60
+ reach behind the stable C/resource ABIs.
61
+
62
+ ## Public API and data model
63
+
64
+ The idiomatic facade groups the stable surface into these concepts:
65
+
66
+ | Concept | Semantics |
67
+ |---|---|
68
+ | Dictionary resource | A retained `vt.dictionary.v1` capability. Construction and mutation belong to a producer such as libdictenstein. |
69
+ | Transducer | Immutable query configuration plus a retained dictionary provider; construction is constant-time with respect to dictionary size. |
70
+ | Query cursor | A one-shot traversal over the immutable dictionary revision captured at query start. |
71
+ | Match/batch | Owned matches are stable host values; a borrowed batch is valid only inside its documented callback or lease interval. |
72
+
73
+ Strings are Unicode; `Uint8Array` and `BigUint64Array` select byte and packed-token queries. IDs are `bigint`, never lossy JavaScript numbers. Empty terms, embedded zero bytes, non-ASCII text, and the full
74
+ unsigned 64-bit identifier range are represented explicitly; no facade may use
75
+ a sentinel value that removes a valid input from the domain.
76
+
77
+ ### Facade symbol index
78
+
79
+ This table is generated from the same exhaustive model as the binding
80
+ conformance gate. A public symbol may implement several ABI operations when
81
+ the host language expresses domain or lifecycle choices with overloads,
82
+ variants, protocols, or methods.
83
+
84
+ | Public symbol | Backing native operation(s) | Capability |
85
+ |---|---|---|
86
+ | `llrePattern` | `llev_phonetic_pattern_compile_llre` | compiled phonetic-pattern lifecycle and matching |
87
+ | `phoneticPattern` | `llev_phonetic_pattern_compile_regex` | compiled phonetic-pattern lifecycle and matching |
88
+ | `PhoneticPattern.close` | `llev_phonetic_pattern_free` | compiled phonetic-pattern lifecycle and matching |
89
+ | `PhoneticPattern.matches` | `llev_phonetic_pattern_matches` | compiled phonetic-pattern lifecycle and matching |
90
+ | `PhoneticPattern.size` | `llev_phonetic_pattern_size` | compiled phonetic-pattern lifecycle and matching |
91
+ | `phoneticRules` | `llev_phonetic_rules_parse`, `llev_phonetic_rules_builtin` | phonetic rule-set lifecycle and rewriting |
92
+ | `PhoneticRuleSet.apply` | `llev_owned_string_free`, `llev_phonetic_rules_apply` | owned result-string release; phonetic rule-set lifecycle and rewriting |
93
+ | `PhoneticRuleSet.close` | `llev_phonetic_rules_free` | phonetic rule-set lifecycle and rewriting |
94
+ | `PhoneticRuleSet.size` | `llev_phonetic_rules_len` | phonetic rule-set lifecycle and rewriting |
95
+ | `QueryCursor.close` | `llev_query_cursor_free` | streaming result traversal and batch leases |
96
+ | `QueryCursor.nextBatch` | `llev_query_cursor_next_batch`, `llev_query_cursor_release_batch` | streaming result traversal and batch leases |
97
+ | `transducer` | `llev_transducer_new` | transducer lifecycle, snapshot, or domain metadata |
98
+ | `Transducer.close` | `llev_transducer_free` | transducer lifecycle, snapshot, or domain metadata |
99
+ | `Transducer.query` | `llev_transducer_query_utf8`, `llev_transducer_query_bytes`, `llev_transducer_query_u64`, `llev_transducer_query_pattern` | domain-preserving dictionary query; phonetic-pattern dictionary query |
100
+
101
+ ### Public types and traversal protocols
102
+
103
+ | Facade type or protocol | Purpose | Exposure note |
104
+ |---|---|---|
105
+ | `Algorithm` | Edit-distance algorithm selection | string-literal union |
106
+ | `QueryOrder` | Result traversal ordering | string-literal union |
107
+ | `phoneticRules` | Built-in phonetic rule-set selection | string selectors "english-orthography"/"english-phonetic" |
108
+ | `QueryCursor` | One-shot owned-result iteration | Public facade protocol |
109
+ | `QueryCursor.reduceBatches` | Bounded batch/reducer traversal | Public facade protocol |
110
+
111
+ ### Facade-encapsulated model values
112
+
113
+ | Model value | Idiomatic treatment |
114
+ |---|---|
115
+ | `status` | thrown runtime Error values carry the native message; the numeric status is not re-exposed |
116
+
117
+ Native operations omitted from the public-symbol table are deliberately
118
+ encapsulated by the facade. The generated completeness matrix records every
119
+ such operation with its reviewed rationale; an unreasoned absence fails CI.
120
+
121
+ ### Intended usage paths
122
+
123
+ | Need | Use | Rationale |
124
+ |---|---|---|
125
+ | Repeated fuzzy queries | Reuse one transducer and create a fresh cursor per query | Construction retains a provider in constant time; each cursor captures its own immutable revision. |
126
+ | Ordinary streaming | The facade iterator protocol | It materializes bounded owned values and supports early termination with deterministic close. |
127
+ | Maximum result throughput | The facade batch/reducer protocol | It amortizes the foreign boundary and keeps borrowed views inside one lexical lease. |
128
+ | Repeated phonetic matching | Compile a phonetic pattern once, then query or match repeatedly | Compilation is separated from traversal and the compiled handle is immutable. |
129
+ | Repeated phonetic rewriting | Parse or select a rule set once, then apply it repeatedly | Rule validation and allocation are amortized while each returned string remains independently owned. |
130
+ | Cross-project dictionaries | Pass the retained dictionary resource directly | The versioned resource preserves snapshot identity without serialization or shared Rust layout. |
131
+
132
+ For the exhaustive native function contract—including exact preconditions,
133
+ returnable statuses, complexity, and thread-safety—use the
134
+ [`llev_*` C ABI reference](../../docs/bindings/c-abi-reference.md). The facade
135
+ source linked above is the authoritative idiomatic symbol inventory; its
136
+ exhaustive coverage is governed by [`bindings/api-surface-map.json`](../../bindings/api-surface-map.json) and the [generated completeness matrix](../../bindings/conformance/completeness-matrix.tsv).
137
+
138
+ ## Ownership, snapshots, and resource handoff
139
+
140
+ Use explicit resource management (`using`) where available or call `close()`/`close!` in `finally`. GC finalizers are fallback containment.
141
+
142
+ A transducer retains the provider resource, and a query retains the revision
143
+ visible at query start. Closing the original dictionary or publishing later
144
+ mutations cannot invalidate that query. Acquisition either completes with one
145
+ owned retain or fails with no ownership transfer. Teardown order is therefore
146
+ free across dictionary, transducer, and completed query handles.
147
+
148
+ Borrowed results are intentionally lexical. Copy data that must outlive the
149
+ callback; retaining a raw address, slice, memory segment, or foreign pointer is
150
+ an API violation even when the next operation happens to reuse the same arena.
151
+
152
+ ## Errors and failure containment
153
+
154
+ Status codes become `VinaryTreeError` values carrying project, operation, status, and native diagnostic fields.
155
+
156
+ Malformed utf-8, unsupported unit domains, incompatible resource versions, closed handles, invalid bounds, allocation failures, provider faults, and contained rust panics are distinct failures. Never parse diagnostic prose to
157
+ branch on an error: inspect the typed status/exception first and treat the
158
+ message as human context. Diagnostics must be copied before another native
159
+ call on the same thread.
160
+
161
+ ## Concurrency and reentrancy
162
+
163
+ Independent handles may be used concurrently. A cursor is single-consumer, callbacks are synchronous, and borrowed batches expire on callback return.
164
+
165
+ Snapshot capture is a linearization point, not a dictionary-wide query lock.
166
+ First-party immutable snapshots can be walked concurrently. A foreign provider
167
+ that does not advertise parallel callbacks is serialized at its callback gate;
168
+ the host language must not add a weaker promise.
169
+
170
+ ## Performance and marshalling
171
+
172
+ - Reuse transducers for repeated queries against the same resource.
173
+ - Prefer streaming cursors to whole-result materialization.
174
+ - Prefer batch/reducer APIs when per-match boundary crossings dominate.
175
+ - Keep Unicode, byte, and token domains explicit to avoid transcoding.
176
+ - Measure native, WASM, and WASI paths independently; they have different
177
+ startup and marshalling costs but identical query semantics.
178
+
179
+ No host wrapper should cache unbounded query results. Applications that add a
180
+ memo use a revision key and a hard entry/weight bound; eviction may be
181
+ approximate because all values remain derivable from the retained snapshot.
182
+
183
+ ## Security model
184
+
185
+ Treat a foreign resource provider and all user-controlled queries as untrusted
186
+ inputs. Validate lengths before allocation, preserve paging bounds, reject
187
+ unknown enum values, contain callbacks/panics at the boundary, and never trust
188
+ capability flags until interface negotiation succeeds. The normative duties
189
+ are in the [binding trust model](../../docs/security/binding-trust-model.md).
190
+
191
+ ## Compatibility and troubleshooting
192
+
193
+ The project ABI revision, family ABI version, interface identity/version,
194
+ package version, and umbrella-runtime version are independent counters. Follow
195
+ the [ABI evolution policy](https://github.com/vinary-tree/vinary-tree-interop/blob/master/docs/abi-evolution.md); never infer compatibility from a
196
+ package version alone.
197
+
198
+ When loading fails, check—in order—the documented runtime/toolchain version,
199
+ CPU/OS artifact, native-access permission, loader search path, dependent
200
+ interop package pin, and process-wide JavaScript runtime identity. When a query
201
+ fails after construction, report the typed status and copied diagnostic before
202
+ reducing the case to the smallest dictionary/query pair.
203
+
204
+ ## Maintainer checklist
205
+
206
+ 1. Update the machine-readable binding model before changing a public symbol.
207
+ 2. Regenerate headers/constants and the API coverage matrix.
208
+ 3. Extend the canonical executable example and negative-path tests.
209
+ 4. Run the language package, snapshot, leak, property, and cross-project suites.
210
+ 5. Verify package staging contains this guide and uses coherent sibling pins.
211
+ 6. Render diagrams headlessly and run the documentation/link/math gates.
212
+
213
+ <!-- END GENERATED BINDING OPERATIONS -->
package/abi.d.ts ADDED
@@ -0,0 +1,33 @@
1
+ /** Generated from bindings/api.json; do not edit numeric values manually. */
2
+ export const ABI_VERSION: 1;
3
+ export const API_REVISION: 2;
4
+ export const DEFAULT_MATCH_BATCH: 256;
5
+ export enum Status {
6
+ Ok = 0,
7
+ End = 1,
8
+ InvalidArgument = 2,
9
+ InvalidUtf8 = 3,
10
+ NullPointer = 4,
11
+ Panic = 5,
12
+ Unsupported = 6,
13
+ IoError = 7,
14
+ Closed = 8,
15
+ LimitExceeded = 9,
16
+ ProviderError = 10,
17
+ BatchInUse = 11,
18
+ DomainMismatch = 12,
19
+ }
20
+ export enum Algorithm {
21
+ Standard = 0,
22
+ Transposition = 1,
23
+ MergeAndSplit = 2,
24
+ DamerauLevenshtein = 3,
25
+ }
26
+ export enum Queryorder {
27
+ Traversal = 0,
28
+ DistanceThenTerm = 1,
29
+ }
30
+ export enum Phoneticrulesetkind {
31
+ EnglishOrthography = 0,
32
+ EnglishPhonetic = 1,
33
+ }
@@ -0,0 +1,38 @@
1
+ (ns vinary-tree.liblevenshtein
2
+ "ClojureScript facade mirroring the Clojure resource/transducer API."
3
+ (:require ["@vinary-tree/liblevenshtein" :as native]))
4
+
5
+ (defn transducer
6
+ ([dictionary] (native/transducer dictionary "standard"))
7
+ ([dictionary {:keys [algorithm] :or {algorithm :standard}}]
8
+ (native/transducer dictionary (name algorithm))))
9
+
10
+ (defn close! [resource] (.close resource))
11
+
12
+ (defn query
13
+ ([automaton term max-distance]
14
+ (.query automaton term max-distance "traversal"))
15
+ ([automaton term max-distance {:keys [order] :or {order :traversal}}]
16
+ (.query automaton term max-distance (name order))))
17
+
18
+ (defn reduce-batches
19
+ "Allocation-minimizing batch reduction; borrowed views must not escape f."
20
+ [f initial cursor]
21
+ (try
22
+ (.reduceBatches cursor f initial)
23
+ (finally (close! cursor))))
24
+
25
+ (defn cursor-seq [cursor]
26
+ (let [iterator (.call (aget cursor (.-iterator js/Symbol)) cursor)]
27
+ (letfn [(step []
28
+ (lazy-seq
29
+ (let [result (.next iterator)]
30
+ (if (.-done result)
31
+ (do (close! cursor) nil)
32
+ (cons (.-value result) (step))))))]
33
+ (step))))
34
+
35
+ (defn phonetic-pattern [source] (native/phoneticPattern source))
36
+ (defn llre-pattern [source] (native/llrePattern source))
37
+ (defn phonetic-rules [source] (native/phoneticRules (if (keyword? source) (name source) source)))
38
+ (defn rewrite [rules input] (.apply rules input))
package/deps.cljs ADDED
@@ -0,0 +1 @@
1
+ {:npm-deps {"@vinary-tree/liblevenshtein" "4.0.0-rc.5"}}
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ module.exports = require("./native.cjs");
@@ -0,0 +1,2 @@
1
+ export * from "../index.js";
2
+ export { default } from "../index.js";
@@ -0,0 +1,2 @@
1
+ export * from "./native.mjs";
2
+ export { default } from "./native.mjs";
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ const namespace = require("@vinary-tree/javascript-runtime").liblevenshtein;
3
+ const { assertDictionaryResource, assertSameRuntime } = require("@vinary-tree/vinary-tree-interop");
4
+ if (!namespace || !namespace.runtimeIdentity) {
5
+ throw new Error("@vinary-tree/javascript-runtime does not expose a runtime identity");
6
+ }
7
+ function transducer(dictionary, algorithm) {
8
+ assertDictionaryResource(dictionary);
9
+ assertSameRuntime(dictionary, namespace.runtimeIdentity);
10
+ return namespace.transducer(dictionary, algorithm);
11
+ }
12
+ const facade = Object.assign({}, namespace, { transducer });
13
+ module.exports = Object.assign(facade, { default: facade });
@@ -0,0 +1,24 @@
1
+ import { liblevenshtein } from "@vinary-tree/javascript-runtime";
2
+ import { assertDictionaryResource, assertSameRuntime } from "@vinary-tree/vinary-tree-interop";
3
+
4
+ if (!liblevenshtein?.runtimeIdentity) {
5
+ throw new Error("@vinary-tree/javascript-runtime does not expose a runtime identity");
6
+ }
7
+
8
+ export const runtimeIdentity = liblevenshtein.runtimeIdentity;
9
+ export function transducer(dictionary, algorithm) {
10
+ assertDictionaryResource(dictionary);
11
+ assertSameRuntime(dictionary, runtimeIdentity);
12
+ return liblevenshtein.transducer(dictionary, algorithm);
13
+ }
14
+ export const phoneticPattern = liblevenshtein.phoneticPattern.bind(liblevenshtein);
15
+ export const llrePattern = liblevenshtein.llrePattern.bind(liblevenshtein);
16
+ export const phoneticRules = liblevenshtein.phoneticRules.bind(liblevenshtein);
17
+ export default {
18
+ ...liblevenshtein,
19
+ runtimeIdentity,
20
+ transducer,
21
+ phoneticPattern,
22
+ llrePattern,
23
+ phoneticRules,
24
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ module.exports = require("./native.cjs");
@@ -0,0 +1,2 @@
1
+ export * from "../index.js";
2
+ export { default } from "../index.js";
@@ -0,0 +1,2 @@
1
+ export * from "./native.mjs";
2
+ export { default } from "./native.mjs";
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ const namespace = require("@vinary-tree/javascript-runtime/wasi").liblevenshtein;
3
+ const { assertDictionaryResource, assertSameRuntime } = require("@vinary-tree/vinary-tree-interop");
4
+ function transducer(dictionary, algorithm) {
5
+ assertDictionaryResource(dictionary);
6
+ assertSameRuntime(dictionary, namespace.runtimeIdentity);
7
+ return namespace.transducer(dictionary, algorithm);
8
+ }
9
+ const facade = Object.assign({}, namespace, { transducer });
10
+ module.exports = Object.assign(facade, { default: facade });
@@ -0,0 +1,17 @@
1
+ import { liblevenshtein } from "@vinary-tree/javascript-runtime/wasi";
2
+ import { assertDictionaryResource, assertSameRuntime } from "@vinary-tree/vinary-tree-interop";
3
+ export const runtimeIdentity = liblevenshtein.runtimeIdentity;
4
+ export function transducer(dictionary, algorithm) {
5
+ assertDictionaryResource(dictionary);
6
+ assertSameRuntime(dictionary, runtimeIdentity);
7
+ return liblevenshtein.transducer(dictionary, algorithm);
8
+ }
9
+ // The wasi build profile (--no-default-features --features wasi) has no
10
+ // phonetic capability, so these namespace members may be absent; binding
11
+ // them unconditionally crashed this module at import time (defect found by
12
+ // the cross-language benchmark harness, 2026-08-13). Capability-gated
13
+ // members stay undefined when the runtime does not provide them.
14
+ export const phoneticPattern = liblevenshtein.phoneticPattern?.bind(liblevenshtein);
15
+ export const llrePattern = liblevenshtein.llrePattern?.bind(liblevenshtein);
16
+ export const phoneticRules = liblevenshtein.phoneticRules?.bind(liblevenshtein);
17
+ export default { ...liblevenshtein, runtimeIdentity, transducer, phoneticPattern, llrePattern, phoneticRules };
@@ -0,0 +1,12 @@
1
+ import { liblevenshtein } from "@vinary-tree/javascript-runtime/wasm";
2
+ import { assertDictionaryResource, assertSameRuntime } from "@vinary-tree/vinary-tree-interop";
3
+ export const runtimeIdentity = liblevenshtein.runtimeIdentity;
4
+ export function transducer(dictionary, algorithm) {
5
+ assertDictionaryResource(dictionary);
6
+ assertSameRuntime(dictionary, runtimeIdentity);
7
+ return liblevenshtein.transducer(dictionary, algorithm);
8
+ }
9
+ export const phoneticPattern = liblevenshtein.phoneticPattern.bind(liblevenshtein);
10
+ export const llrePattern = liblevenshtein.llrePattern.bind(liblevenshtein);
11
+ export const phoneticRules = liblevenshtein.phoneticRules.bind(liblevenshtein);
12
+ export default { ...liblevenshtein, runtimeIdentity, transducer, phoneticPattern, llrePattern, phoneticRules };
package/index.d.ts ADDED
@@ -0,0 +1,82 @@
1
+ import type { DictionaryResource } from "@vinary-tree/vinary-tree-interop";
2
+
3
+ export type Algorithm =
4
+ | "standard"
5
+ | "transposition"
6
+ | "merge-and-split"
7
+ | "damerau-levenshtein";
8
+ export type QueryOrder = "traversal" | "distance-then-term";
9
+
10
+ export type Term =
11
+ | { readonly domain: "unicode"; readonly value: string }
12
+ | { readonly domain: "byte"; readonly value: Uint8Array }
13
+ | { readonly domain: "u64"; readonly value: BigUint64Array };
14
+
15
+ export interface Match {
16
+ readonly term: Term;
17
+ readonly distance: number;
18
+ readonly id: bigint | null;
19
+ }
20
+
21
+ export interface BorrowedMatch {
22
+ readonly distance: number;
23
+ readonly id: bigint | null;
24
+ readonly unitDomain: "byte" | "unicode" | "u64";
25
+ bytes(): Uint8Array;
26
+ utf8(): string;
27
+ u64(): BigUint64Array;
28
+ }
29
+
30
+ export interface BorrowedBatch extends Iterable<BorrowedMatch> {
31
+ readonly length: number;
32
+ }
33
+
34
+ export interface QueryCursor extends IterableIterator<Match> {
35
+ nextBatch(maximum: number): Match[];
36
+ reduceBatches<Accumulator>(
37
+ reducer: (accumulator: Accumulator, batch: readonly Match[]) => Accumulator,
38
+ initial: Accumulator,
39
+ ): Accumulator;
40
+ close(): void;
41
+ }
42
+
43
+ export interface AutomatonSize {
44
+ readonly states: number;
45
+ readonly transitions: number;
46
+ }
47
+
48
+ export interface PhoneticPattern {
49
+ readonly size: AutomatonSize;
50
+ matches(input: string): boolean;
51
+ close(): void;
52
+ }
53
+
54
+ export interface PhoneticRuleSet {
55
+ readonly size: number;
56
+ apply(input: string): string;
57
+ close(): void;
58
+ }
59
+
60
+ export interface Transducer {
61
+ query(query: string, maximumDistance: number, order?: QueryOrder): QueryCursor;
62
+ query(query: Uint8Array, maximumDistance: number): QueryCursor;
63
+ query(query: BigUint64Array, maximumDistance: number): QueryCursor;
64
+ query(pattern: PhoneticPattern, maximumDistance: number): QueryCursor;
65
+ close(): void;
66
+ }
67
+
68
+ export interface LiblevenshteinNamespace {
69
+ readonly runtimeIdentity: symbol | object;
70
+ transducer(dictionary: DictionaryResource, algorithm?: Algorithm): Transducer;
71
+ phoneticPattern(source: string): PhoneticPattern;
72
+ llrePattern(source: string): PhoneticPattern;
73
+ phoneticRules(source: string | "english-orthography" | "english-phonetic"): PhoneticRuleSet;
74
+ }
75
+
76
+ export const runtimeIdentity: symbol | object;
77
+ export function transducer(dictionary: DictionaryResource, algorithm?: Algorithm): Transducer;
78
+ export function phoneticPattern(source: string): PhoneticPattern;
79
+ export function llrePattern(source: string): PhoneticPattern;
80
+ export function phoneticRules(source: string | "english-orthography" | "english-phonetic"): PhoneticRuleSet;
81
+ declare const liblevenshtein: LiblevenshteinNamespace;
82
+ export default liblevenshtein;
package/package.json CHANGED
@@ -1,20 +1,79 @@
1
1
  {
2
2
  "name": "@vinary-tree/liblevenshtein",
3
- "version": "0.0.0",
4
- "description": "Bootstrap reservation for the Vinary Tree liblevenshtein package",
3
+ "version": "4.0.0-rc.5",
4
+ "description": "Modular liblevenshtein facade over the shared vinary-tree runtime",
5
+ "author": {
6
+ "name": "Dylon Edwards",
7
+ "email": "dylon.devo@gmail.com"
8
+ },
5
9
  "type": "module",
10
+ "sideEffects": false,
6
11
  "license": "Apache-2.0",
7
12
  "repository": {
8
13
  "type": "git",
9
- "url": "git+https://github.com/vinary-tree/liblevenshtein-rust.git"
14
+ "url": "git+https://github.com/vinary-tree/liblevenshtein-rust.git",
15
+ "directory": "bindings/javascript"
16
+ },
17
+ "engines": {
18
+ "node": ">=22.14"
19
+ },
20
+ "dependencies": {
21
+ "@vinary-tree/vinary-tree-interop": "4.0.0-rc.5",
22
+ "@vinary-tree/javascript-runtime": "4.0.0-rc.5"
23
+ },
24
+ "devDependencies": {
25
+ "@vinary-tree/libdictenstein": "file:../../../libdictenstein/bindings/javascript"
26
+ },
27
+ "types": "./index.d.ts",
28
+ "exports": {
29
+ ".": {
30
+ "types": "./index.d.ts",
31
+ "import": "./facades/native.mjs",
32
+ "require": "./facades/native.cjs"
33
+ },
34
+ "./typescript": {
35
+ "types": "./facades/typescript.d.ts",
36
+ "import": "./facades/typescript.mjs",
37
+ "require": "./facades/typescript.cjs"
38
+ },
39
+ "./clojurescript": {
40
+ "types": "./facades/clojurescript.d.ts",
41
+ "import": "./facades/clojurescript.mjs",
42
+ "require": "./facades/clojurescript.cjs"
43
+ },
44
+ "./wasm": {
45
+ "types": "./index.d.ts",
46
+ "default": "./facades/wasm.mjs"
47
+ },
48
+ "./wasi": {
49
+ "types": "./index.d.ts",
50
+ "import": "./facades/wasi.mjs"
51
+ },
52
+ "./cljs/vinary_tree/liblevenshtein.cljs": "./cljs/vinary_tree/liblevenshtein.cljs"
53
+ },
54
+ "cljs": {
55
+ "namespaces": {
56
+ "vinary-tree.liblevenshtein": "./cljs/vinary_tree/liblevenshtein.cljs"
57
+ }
10
58
  },
11
- "exports": "./index.js",
12
59
  "files": [
13
- "index.js",
60
+ "abi.d.ts",
61
+ "index.d.ts",
62
+ "facades/",
63
+ "cljs/",
64
+ "deps.cljs",
14
65
  "README.md"
15
66
  ],
16
67
  "publishConfig": {
17
68
  "access": "public",
18
- "tag": "bootstrap"
69
+ "provenance": true,
70
+ "tag": "next"
71
+ },
72
+ "scripts": {
73
+ "build": "node build.mjs",
74
+ "test:contract": "node --test test/facades.test.mjs && tsc -p tsconfig.test.json",
75
+ "test:clojurescript": "node test/clojurescript-test.mjs",
76
+ "test": "npm run test:contract && npm run test:clojurescript",
77
+ "prepack": "npm run build && npm test"
19
78
  }
20
79
  }
package/index.js DELETED
@@ -1,2 +0,0 @@
1
- /** Bootstrap reservation only. Install the `next` or `latest` release. */
2
- export const bootstrap = true;