disarm 0.17.1 → 0.18.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/NOTICE +88 -0
- package/binding.js +112 -55
- package/disarm.darwin-arm64.node +0 -0
- package/disarm.darwin-x64.node +0 -0
- package/disarm.linux-arm64-gnu.node +0 -0
- package/disarm.linux-x64-gnu.node +0 -0
- package/disarm.win32-x64-msvc.node +0 -0
- package/package.json +3 -2
package/NOTICE
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
disarm
|
|
2
|
+
Copyright (c) 2026 Richard Quinn
|
|
3
|
+
Licensed under the MIT License; see LICENSE.
|
|
4
|
+
|
|
5
|
+
disarm includes data adapted from the following works, which remain under
|
|
6
|
+
their own licences.
|
|
7
|
+
|
|
8
|
+
confusable-vision
|
|
9
|
+
(c) 2026 Paul Wood FRSA (@paultendo)
|
|
10
|
+
https://github.com/paultendo/confusable-vision
|
|
11
|
+
Data licensed under the Creative Commons Attribution 4.0 International
|
|
12
|
+
License (CC-BY-4.0): https://creativecommons.org/licenses/by/4.0/
|
|
13
|
+
The data is provided as-is; see the licence for its disclaimer of warranties.
|
|
14
|
+
|
|
15
|
+
Used:
|
|
16
|
+
data/output/confusable-weights-v2.json (v2026-03-02)
|
|
17
|
+
data/output/candidate-discoveries.json (2026-02-27 revision)
|
|
18
|
+
data/output/m2b-verification-report.json (2026-02-27 revision)
|
|
19
|
+
|
|
20
|
+
Changed: disarm selects confusable pairs from those files by the admission
|
|
21
|
+
rules stated in data/confusables_supplement.tsv and
|
|
22
|
+
data/confusables_vision.tsv, and folds the selected pairs into its confusable
|
|
23
|
+
tables (src/tables/data/confusables_to_latin.tsv and
|
|
24
|
+
src/tables/data/confusables_to_cyrillic.tsv). Those tables are compiled into
|
|
25
|
+
every disarm package. The measurements themselves are not redistributed.
|
|
26
|
+
The author does not endorse disarm by this credit.
|
|
27
|
+
|
|
28
|
+
Unicode data
|
|
29
|
+
Copyright © 1991-2025 Unicode, Inc.
|
|
30
|
+
https://www.unicode.org/
|
|
31
|
+
Licensed under the Unicode License v3 (SPDX: Unicode-3.0), reproduced below.
|
|
32
|
+
|
|
33
|
+
Used:
|
|
34
|
+
the Unicode Character Database (UCD): Scripts.txt (vendored as
|
|
35
|
+
data/Scripts.txt), CaseFolding.txt, DerivedCoreProperties.txt and
|
|
36
|
+
emoji/emoji-data.txt, and the character properties (General_Category,
|
|
37
|
+
East_Asian_Width, Bidi_Class, Numeric_Type and others) read through
|
|
38
|
+
Python's unicodedata module
|
|
39
|
+
Unicode Security Mechanisms (UTS #39): confusables.txt (vendored as
|
|
40
|
+
data/confusables.txt)
|
|
41
|
+
Unicode CLDR emoji annotations: common/annotations/en.xml and
|
|
42
|
+
common/annotationsDerived/en.xml (vendored as data/cldr/en.xml and
|
|
43
|
+
data/cldr/en_derived.xml)
|
|
44
|
+
The version of each, per table, is listed in docs/provenance.md.
|
|
45
|
+
|
|
46
|
+
Changed: disarm's generators (scripts/gen_*.py) read these files and write
|
|
47
|
+
the lookup tables under src/tables/, folding, filtering and re-keying them;
|
|
48
|
+
the tables are compiled into every disarm package.
|
|
49
|
+
|
|
50
|
+
UNICODE LICENSE V3
|
|
51
|
+
|
|
52
|
+
COPYRIGHT AND PERMISSION NOTICE
|
|
53
|
+
|
|
54
|
+
Copyright © 1991-2025 Unicode, Inc.
|
|
55
|
+
|
|
56
|
+
NOTICE TO USER: Carefully read the following legal agreement. BY
|
|
57
|
+
DOWNLOADING, INSTALLING, COPYING OR OTHERWISE USING DATA FILES, AND/OR
|
|
58
|
+
SOFTWARE, YOU UNEQUIVOCALLY ACCEPT, AND AGREE TO BE BOUND BY, ALL OF THE
|
|
59
|
+
TERMS AND CONDITIONS OF THIS AGREEMENT. IF YOU DO NOT AGREE, DO NOT
|
|
60
|
+
DOWNLOAD, INSTALL, COPY, DISTRIBUTE OR USE THE DATA FILES OR SOFTWARE.
|
|
61
|
+
|
|
62
|
+
Permission is hereby granted, free of charge, to any person obtaining a
|
|
63
|
+
copy of data files and any associated documentation (the "Data Files") or
|
|
64
|
+
software and any associated documentation (the "Software") to deal in the
|
|
65
|
+
Data Files or Software without restriction, including without limitation
|
|
66
|
+
the rights to use, copy, modify, merge, publish, distribute, and/or sell
|
|
67
|
+
copies of the Data Files or Software, and to permit persons to whom the
|
|
68
|
+
Data Files or Software are furnished to do so, provided that either (a)
|
|
69
|
+
this copyright and permission notice appear with all copies of the Data
|
|
70
|
+
Files or Software, or (b) this copyright and permission notice appear in
|
|
71
|
+
associated Documentation.
|
|
72
|
+
|
|
73
|
+
THE DATA FILES AND SOFTWARE ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
|
|
74
|
+
KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
75
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
|
|
76
|
+
THIRD PARTY RIGHTS.
|
|
77
|
+
|
|
78
|
+
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS NOTICE
|
|
79
|
+
BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES,
|
|
80
|
+
OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
|
81
|
+
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
|
|
82
|
+
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THE DATA
|
|
83
|
+
FILES OR SOFTWARE.
|
|
84
|
+
|
|
85
|
+
Except as contained in this notice, the name of a copyright holder shall
|
|
86
|
+
not be used in advertising or otherwise to promote the sale, use or other
|
|
87
|
+
dealings in these Data Files or Software without prior written
|
|
88
|
+
authorization of the copyright holder.
|
package/binding.js
CHANGED
|
@@ -6,8 +6,13 @@ const { readFileSync } = require('fs')
|
|
|
6
6
|
let nativeBinding = null
|
|
7
7
|
// Which artifact actually loaded. The WASI fallback chain overwrites it with
|
|
8
8
|
// the flavor it resolved; the late native retry below leaves it alone because
|
|
9
|
-
// it only runs while no WASI candidate has been loaded.
|
|
9
|
+
// it only runs while no WASI candidate has been loaded. The take-over check
|
|
10
|
+
// after the load-failure block can also set it.
|
|
10
11
|
let __napiLoadedBindingTarget = 'native'
|
|
12
|
+
// What this loader's own `requireNative()` calls returned. The check after
|
|
13
|
+
// the load-failure block compares it with `nativeBinding` to tell a binding
|
|
14
|
+
// this loader loaded from one that code outside it put in its place.
|
|
15
|
+
let __napiRequiredNativeBinding = null
|
|
11
16
|
const loadErrors = []
|
|
12
17
|
|
|
13
18
|
const isMusl = () => {
|
|
@@ -89,8 +94,8 @@ function requireNative() {
|
|
|
89
94
|
try {
|
|
90
95
|
const binding = require('disarm-android-arm64')
|
|
91
96
|
const bindingPackageVersion = require('disarm-android-arm64/package.json').version
|
|
92
|
-
if (bindingPackageVersion !== '0.
|
|
93
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
97
|
+
if (bindingPackageVersion !== '0.18.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
98
|
+
throw new Error(`Native binding package version mismatch, expected 0.18.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
94
99
|
}
|
|
95
100
|
return binding
|
|
96
101
|
} catch (e) {
|
|
@@ -105,8 +110,8 @@ function requireNative() {
|
|
|
105
110
|
try {
|
|
106
111
|
const binding = require('disarm-android-arm-eabi')
|
|
107
112
|
const bindingPackageVersion = require('disarm-android-arm-eabi/package.json').version
|
|
108
|
-
if (bindingPackageVersion !== '0.
|
|
109
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
113
|
+
if (bindingPackageVersion !== '0.18.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
114
|
+
throw new Error(`Native binding package version mismatch, expected 0.18.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
110
115
|
}
|
|
111
116
|
return binding
|
|
112
117
|
} catch (e) {
|
|
@@ -126,8 +131,8 @@ function requireNative() {
|
|
|
126
131
|
try {
|
|
127
132
|
const binding = require('disarm-win32-x64-gnu')
|
|
128
133
|
const bindingPackageVersion = require('disarm-win32-x64-gnu/package.json').version
|
|
129
|
-
if (bindingPackageVersion !== '0.
|
|
130
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
134
|
+
if (bindingPackageVersion !== '0.18.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
135
|
+
throw new Error(`Native binding package version mismatch, expected 0.18.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
131
136
|
}
|
|
132
137
|
return binding
|
|
133
138
|
} catch (e) {
|
|
@@ -142,8 +147,8 @@ function requireNative() {
|
|
|
142
147
|
try {
|
|
143
148
|
const binding = require('disarm-win32-x64-msvc')
|
|
144
149
|
const bindingPackageVersion = require('disarm-win32-x64-msvc/package.json').version
|
|
145
|
-
if (bindingPackageVersion !== '0.
|
|
146
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
150
|
+
if (bindingPackageVersion !== '0.18.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
151
|
+
throw new Error(`Native binding package version mismatch, expected 0.18.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
147
152
|
}
|
|
148
153
|
return binding
|
|
149
154
|
} catch (e) {
|
|
@@ -159,8 +164,8 @@ function requireNative() {
|
|
|
159
164
|
try {
|
|
160
165
|
const binding = require('disarm-win32-ia32-msvc')
|
|
161
166
|
const bindingPackageVersion = require('disarm-win32-ia32-msvc/package.json').version
|
|
162
|
-
if (bindingPackageVersion !== '0.
|
|
163
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
167
|
+
if (bindingPackageVersion !== '0.18.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
168
|
+
throw new Error(`Native binding package version mismatch, expected 0.18.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
164
169
|
}
|
|
165
170
|
return binding
|
|
166
171
|
} catch (e) {
|
|
@@ -175,8 +180,8 @@ function requireNative() {
|
|
|
175
180
|
try {
|
|
176
181
|
const binding = require('disarm-win32-arm64-msvc')
|
|
177
182
|
const bindingPackageVersion = require('disarm-win32-arm64-msvc/package.json').version
|
|
178
|
-
if (bindingPackageVersion !== '0.
|
|
179
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
183
|
+
if (bindingPackageVersion !== '0.18.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
184
|
+
throw new Error(`Native binding package version mismatch, expected 0.18.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
180
185
|
}
|
|
181
186
|
return binding
|
|
182
187
|
} catch (e) {
|
|
@@ -194,8 +199,8 @@ function requireNative() {
|
|
|
194
199
|
try {
|
|
195
200
|
const binding = require('disarm-darwin-universal')
|
|
196
201
|
const bindingPackageVersion = require('disarm-darwin-universal/package.json').version
|
|
197
|
-
if (bindingPackageVersion !== '0.
|
|
198
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
202
|
+
if (bindingPackageVersion !== '0.18.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
203
|
+
throw new Error(`Native binding package version mismatch, expected 0.18.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
199
204
|
}
|
|
200
205
|
return binding
|
|
201
206
|
} catch (e) {
|
|
@@ -210,8 +215,8 @@ function requireNative() {
|
|
|
210
215
|
try {
|
|
211
216
|
const binding = require('disarm-darwin-x64')
|
|
212
217
|
const bindingPackageVersion = require('disarm-darwin-x64/package.json').version
|
|
213
|
-
if (bindingPackageVersion !== '0.
|
|
214
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
218
|
+
if (bindingPackageVersion !== '0.18.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
219
|
+
throw new Error(`Native binding package version mismatch, expected 0.18.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
215
220
|
}
|
|
216
221
|
return binding
|
|
217
222
|
} catch (e) {
|
|
@@ -226,8 +231,8 @@ function requireNative() {
|
|
|
226
231
|
try {
|
|
227
232
|
const binding = require('disarm-darwin-arm64')
|
|
228
233
|
const bindingPackageVersion = require('disarm-darwin-arm64/package.json').version
|
|
229
|
-
if (bindingPackageVersion !== '0.
|
|
230
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
234
|
+
if (bindingPackageVersion !== '0.18.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
235
|
+
throw new Error(`Native binding package version mismatch, expected 0.18.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
231
236
|
}
|
|
232
237
|
return binding
|
|
233
238
|
} catch (e) {
|
|
@@ -246,8 +251,8 @@ function requireNative() {
|
|
|
246
251
|
try {
|
|
247
252
|
const binding = require('disarm-freebsd-x64')
|
|
248
253
|
const bindingPackageVersion = require('disarm-freebsd-x64/package.json').version
|
|
249
|
-
if (bindingPackageVersion !== '0.
|
|
250
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
254
|
+
if (bindingPackageVersion !== '0.18.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
255
|
+
throw new Error(`Native binding package version mismatch, expected 0.18.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
251
256
|
}
|
|
252
257
|
return binding
|
|
253
258
|
} catch (e) {
|
|
@@ -262,8 +267,24 @@ function requireNative() {
|
|
|
262
267
|
try {
|
|
263
268
|
const binding = require('disarm-freebsd-arm64')
|
|
264
269
|
const bindingPackageVersion = require('disarm-freebsd-arm64/package.json').version
|
|
265
|
-
if (bindingPackageVersion !== '0.
|
|
266
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
270
|
+
if (bindingPackageVersion !== '0.18.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
271
|
+
throw new Error(`Native binding package version mismatch, expected 0.18.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
272
|
+
}
|
|
273
|
+
return binding
|
|
274
|
+
} catch (e) {
|
|
275
|
+
loadErrors.push(e)
|
|
276
|
+
}
|
|
277
|
+
} else if (process.arch === 'ppc64') {
|
|
278
|
+
try {
|
|
279
|
+
return require('./disarm.freebsd-ppc64.node')
|
|
280
|
+
} catch (e) {
|
|
281
|
+
loadErrors.push(e)
|
|
282
|
+
}
|
|
283
|
+
try {
|
|
284
|
+
const binding = require('disarm-freebsd-ppc64')
|
|
285
|
+
const bindingPackageVersion = require('disarm-freebsd-ppc64/package.json').version
|
|
286
|
+
if (bindingPackageVersion !== '0.18.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
287
|
+
throw new Error(`Native binding package version mismatch, expected 0.18.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
267
288
|
}
|
|
268
289
|
return binding
|
|
269
290
|
} catch (e) {
|
|
@@ -283,8 +304,8 @@ function requireNative() {
|
|
|
283
304
|
try {
|
|
284
305
|
const binding = require('disarm-linux-x64-musl')
|
|
285
306
|
const bindingPackageVersion = require('disarm-linux-x64-musl/package.json').version
|
|
286
|
-
if (bindingPackageVersion !== '0.
|
|
287
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
307
|
+
if (bindingPackageVersion !== '0.18.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
308
|
+
throw new Error(`Native binding package version mismatch, expected 0.18.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
288
309
|
}
|
|
289
310
|
return binding
|
|
290
311
|
} catch (e) {
|
|
@@ -299,8 +320,8 @@ function requireNative() {
|
|
|
299
320
|
try {
|
|
300
321
|
const binding = require('disarm-linux-x64-gnu')
|
|
301
322
|
const bindingPackageVersion = require('disarm-linux-x64-gnu/package.json').version
|
|
302
|
-
if (bindingPackageVersion !== '0.
|
|
303
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
323
|
+
if (bindingPackageVersion !== '0.18.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
324
|
+
throw new Error(`Native binding package version mismatch, expected 0.18.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
304
325
|
}
|
|
305
326
|
return binding
|
|
306
327
|
} catch (e) {
|
|
@@ -317,8 +338,8 @@ function requireNative() {
|
|
|
317
338
|
try {
|
|
318
339
|
const binding = require('disarm-linux-arm64-musl')
|
|
319
340
|
const bindingPackageVersion = require('disarm-linux-arm64-musl/package.json').version
|
|
320
|
-
if (bindingPackageVersion !== '0.
|
|
321
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
341
|
+
if (bindingPackageVersion !== '0.18.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
342
|
+
throw new Error(`Native binding package version mismatch, expected 0.18.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
322
343
|
}
|
|
323
344
|
return binding
|
|
324
345
|
} catch (e) {
|
|
@@ -333,8 +354,8 @@ function requireNative() {
|
|
|
333
354
|
try {
|
|
334
355
|
const binding = require('disarm-linux-arm64-gnu')
|
|
335
356
|
const bindingPackageVersion = require('disarm-linux-arm64-gnu/package.json').version
|
|
336
|
-
if (bindingPackageVersion !== '0.
|
|
337
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
357
|
+
if (bindingPackageVersion !== '0.18.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
358
|
+
throw new Error(`Native binding package version mismatch, expected 0.18.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
338
359
|
}
|
|
339
360
|
return binding
|
|
340
361
|
} catch (e) {
|
|
@@ -351,8 +372,8 @@ function requireNative() {
|
|
|
351
372
|
try {
|
|
352
373
|
const binding = require('disarm-linux-arm-musleabihf')
|
|
353
374
|
const bindingPackageVersion = require('disarm-linux-arm-musleabihf/package.json').version
|
|
354
|
-
if (bindingPackageVersion !== '0.
|
|
355
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
375
|
+
if (bindingPackageVersion !== '0.18.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
376
|
+
throw new Error(`Native binding package version mismatch, expected 0.18.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
356
377
|
}
|
|
357
378
|
return binding
|
|
358
379
|
} catch (e) {
|
|
@@ -367,8 +388,8 @@ function requireNative() {
|
|
|
367
388
|
try {
|
|
368
389
|
const binding = require('disarm-linux-arm-gnueabihf')
|
|
369
390
|
const bindingPackageVersion = require('disarm-linux-arm-gnueabihf/package.json').version
|
|
370
|
-
if (bindingPackageVersion !== '0.
|
|
371
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
391
|
+
if (bindingPackageVersion !== '0.18.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
392
|
+
throw new Error(`Native binding package version mismatch, expected 0.18.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
372
393
|
}
|
|
373
394
|
return binding
|
|
374
395
|
} catch (e) {
|
|
@@ -385,8 +406,8 @@ function requireNative() {
|
|
|
385
406
|
try {
|
|
386
407
|
const binding = require('disarm-linux-loong64-musl')
|
|
387
408
|
const bindingPackageVersion = require('disarm-linux-loong64-musl/package.json').version
|
|
388
|
-
if (bindingPackageVersion !== '0.
|
|
389
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
409
|
+
if (bindingPackageVersion !== '0.18.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
410
|
+
throw new Error(`Native binding package version mismatch, expected 0.18.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
390
411
|
}
|
|
391
412
|
return binding
|
|
392
413
|
} catch (e) {
|
|
@@ -401,8 +422,8 @@ function requireNative() {
|
|
|
401
422
|
try {
|
|
402
423
|
const binding = require('disarm-linux-loong64-gnu')
|
|
403
424
|
const bindingPackageVersion = require('disarm-linux-loong64-gnu/package.json').version
|
|
404
|
-
if (bindingPackageVersion !== '0.
|
|
405
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
425
|
+
if (bindingPackageVersion !== '0.18.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
426
|
+
throw new Error(`Native binding package version mismatch, expected 0.18.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
406
427
|
}
|
|
407
428
|
return binding
|
|
408
429
|
} catch (e) {
|
|
@@ -419,8 +440,8 @@ function requireNative() {
|
|
|
419
440
|
try {
|
|
420
441
|
const binding = require('disarm-linux-riscv64-musl')
|
|
421
442
|
const bindingPackageVersion = require('disarm-linux-riscv64-musl/package.json').version
|
|
422
|
-
if (bindingPackageVersion !== '0.
|
|
423
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
443
|
+
if (bindingPackageVersion !== '0.18.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
444
|
+
throw new Error(`Native binding package version mismatch, expected 0.18.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
424
445
|
}
|
|
425
446
|
return binding
|
|
426
447
|
} catch (e) {
|
|
@@ -435,8 +456,8 @@ function requireNative() {
|
|
|
435
456
|
try {
|
|
436
457
|
const binding = require('disarm-linux-riscv64-gnu')
|
|
437
458
|
const bindingPackageVersion = require('disarm-linux-riscv64-gnu/package.json').version
|
|
438
|
-
if (bindingPackageVersion !== '0.
|
|
439
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
459
|
+
if (bindingPackageVersion !== '0.18.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
460
|
+
throw new Error(`Native binding package version mismatch, expected 0.18.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
440
461
|
}
|
|
441
462
|
return binding
|
|
442
463
|
} catch (e) {
|
|
@@ -452,8 +473,8 @@ function requireNative() {
|
|
|
452
473
|
try {
|
|
453
474
|
const binding = require('disarm-linux-ppc64-gnu')
|
|
454
475
|
const bindingPackageVersion = require('disarm-linux-ppc64-gnu/package.json').version
|
|
455
|
-
if (bindingPackageVersion !== '0.
|
|
456
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
476
|
+
if (bindingPackageVersion !== '0.18.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
477
|
+
throw new Error(`Native binding package version mismatch, expected 0.18.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
457
478
|
}
|
|
458
479
|
return binding
|
|
459
480
|
} catch (e) {
|
|
@@ -468,8 +489,8 @@ function requireNative() {
|
|
|
468
489
|
try {
|
|
469
490
|
const binding = require('disarm-linux-s390x-gnu')
|
|
470
491
|
const bindingPackageVersion = require('disarm-linux-s390x-gnu/package.json').version
|
|
471
|
-
if (bindingPackageVersion !== '0.
|
|
472
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
492
|
+
if (bindingPackageVersion !== '0.18.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
493
|
+
throw new Error(`Native binding package version mismatch, expected 0.18.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
473
494
|
}
|
|
474
495
|
return binding
|
|
475
496
|
} catch (e) {
|
|
@@ -488,8 +509,8 @@ function requireNative() {
|
|
|
488
509
|
try {
|
|
489
510
|
const binding = require('disarm-openharmony-arm64')
|
|
490
511
|
const bindingPackageVersion = require('disarm-openharmony-arm64/package.json').version
|
|
491
|
-
if (bindingPackageVersion !== '0.
|
|
492
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
512
|
+
if (bindingPackageVersion !== '0.18.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
513
|
+
throw new Error(`Native binding package version mismatch, expected 0.18.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
493
514
|
}
|
|
494
515
|
return binding
|
|
495
516
|
} catch (e) {
|
|
@@ -504,8 +525,8 @@ function requireNative() {
|
|
|
504
525
|
try {
|
|
505
526
|
const binding = require('disarm-openharmony-x64')
|
|
506
527
|
const bindingPackageVersion = require('disarm-openharmony-x64/package.json').version
|
|
507
|
-
if (bindingPackageVersion !== '0.
|
|
508
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
528
|
+
if (bindingPackageVersion !== '0.18.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
529
|
+
throw new Error(`Native binding package version mismatch, expected 0.18.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
509
530
|
}
|
|
510
531
|
return binding
|
|
511
532
|
} catch (e) {
|
|
@@ -520,8 +541,8 @@ function requireNative() {
|
|
|
520
541
|
try {
|
|
521
542
|
const binding = require('disarm-openharmony-arm')
|
|
522
543
|
const bindingPackageVersion = require('disarm-openharmony-arm/package.json').version
|
|
523
|
-
if (bindingPackageVersion !== '0.
|
|
524
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
544
|
+
if (bindingPackageVersion !== '0.18.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
545
|
+
throw new Error(`Native binding package version mismatch, expected 0.18.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
525
546
|
}
|
|
526
547
|
return binding
|
|
527
548
|
} catch (e) {
|
|
@@ -585,6 +606,7 @@ const forceWasi =
|
|
|
585
606
|
|
|
586
607
|
if (!forceWasi) {
|
|
587
608
|
nativeBinding = requireNative()
|
|
609
|
+
__napiRequiredNativeBinding = nativeBinding
|
|
588
610
|
}
|
|
589
611
|
|
|
590
612
|
if (!nativeBinding || forceWasi) {
|
|
@@ -661,8 +683,8 @@ if (!nativeBinding || forceWasi) {
|
|
|
661
683
|
if (!candidateFailed) {
|
|
662
684
|
if (process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
663
685
|
const bindingPackageVersion = require('disarm-wasm32-wasi/package.json').version
|
|
664
|
-
if (bindingPackageVersion !== '0.
|
|
665
|
-
throw new Error(`WASI binding package version mismatch, expected 0.
|
|
686
|
+
if (bindingPackageVersion !== '0.18.0') {
|
|
687
|
+
throw new Error(`WASI binding package version mismatch, expected 0.18.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
666
688
|
}
|
|
667
689
|
}
|
|
668
690
|
wasiBinding = require('disarm-wasm32-wasi')
|
|
@@ -686,6 +708,7 @@ if (!nativeBinding || forceWasi) {
|
|
|
686
708
|
!__napiWasiFlavorRequested
|
|
687
709
|
) {
|
|
688
710
|
nativeBinding = requireNative()
|
|
711
|
+
__napiRequiredNativeBinding = nativeBinding
|
|
689
712
|
}
|
|
690
713
|
if ((forceWasiError || __napiWasiFlavorRequested) && !wasiBindingLoaded) {
|
|
691
714
|
const error = new Error(
|
|
@@ -713,6 +736,40 @@ if (!nativeBinding) {
|
|
|
713
736
|
throw new Error(`Failed to load native binding`)
|
|
714
737
|
}
|
|
715
738
|
|
|
739
|
+
// A package can patch its own fallback in front of the load-failure check
|
|
740
|
+
// above, e.g. a WebContainer download through `napi-postinstall/fallback`.
|
|
741
|
+
// That fallback swaps `nativeBinding` for a generated WASI loader, which has
|
|
742
|
+
// already stamped its own flavor, while the target above still says 'native'.
|
|
743
|
+
// Take that flavor over, or the CommonJS stamp throws a conflict and the ESM
|
|
744
|
+
// export reports the wrong artifact. Three limits keep the conflict check:
|
|
745
|
+
// - only a binding this loader did not load itself, so a native addon whose
|
|
746
|
+
// `#[napi(module_exports)]` hook claims the name is still rejected;
|
|
747
|
+
// - only an own data property, read through its descriptor, so no addon
|
|
748
|
+
// getter runs here, and it must read back the same, as the stamp reads it;
|
|
749
|
+
// - only a flavor in `__napiWasiFlavors`, the ones this loader's own WASI
|
|
750
|
+
// chain can report ('wasm32-wasi' for a package without a WASI target).
|
|
751
|
+
// This is metadata and never fails a load: a throwing Proxy trap keeps 'native'.
|
|
752
|
+
if (
|
|
753
|
+
__napiLoadedBindingTarget === 'native' &&
|
|
754
|
+
nativeBinding !== __napiRequiredNativeBinding
|
|
755
|
+
) {
|
|
756
|
+
try {
|
|
757
|
+
const __napiBindingTargetDescriptor = Object.getOwnPropertyDescriptor(
|
|
758
|
+
nativeBinding,
|
|
759
|
+
'__napiBindingTarget',
|
|
760
|
+
)
|
|
761
|
+
if (
|
|
762
|
+
__napiBindingTargetDescriptor &&
|
|
763
|
+
__napiWasiFlavors.indexOf(__napiBindingTargetDescriptor.value) !== -1 &&
|
|
764
|
+
nativeBinding.__napiBindingTarget === __napiBindingTargetDescriptor.value
|
|
765
|
+
) {
|
|
766
|
+
__napiLoadedBindingTarget = __napiBindingTargetDescriptor.value
|
|
767
|
+
}
|
|
768
|
+
} catch {
|
|
769
|
+
// keep 'native'
|
|
770
|
+
}
|
|
771
|
+
}
|
|
772
|
+
|
|
716
773
|
function __napiStampBindingTarget(exportsObject, target) {
|
|
717
774
|
if (
|
|
718
775
|
Object.prototype.hasOwnProperty.call(exportsObject, '__napiBindingTarget')
|
package/disarm.darwin-arm64.node
CHANGED
|
Binary file
|
package/disarm.darwin-x64.node
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "disarm",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.18.0",
|
|
4
4
|
"description": "Unicode confusable/text-security building blocks, powered by Rust",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -39,7 +39,8 @@
|
|
|
39
39
|
"index.d.ts",
|
|
40
40
|
"binding.js",
|
|
41
41
|
"binding.d.ts",
|
|
42
|
-
"disarm.*.node"
|
|
42
|
+
"disarm.*.node",
|
|
43
|
+
"NOTICE"
|
|
43
44
|
],
|
|
44
45
|
"scripts": {
|
|
45
46
|
"build": "napi build --platform --release --js binding.js --dts binding.d.ts && tsc",
|