@visulima/vis 1.0.0-alpha.9 → 1.0.1

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.
Files changed (278) hide show
  1. package/CHANGELOG.md +1854 -3
  2. package/LICENSE.md +13515 -10
  3. package/README.md +215 -39
  4. package/bin/resolve-binary.mjs +85 -0
  5. package/bin/vis.mjs +76 -0
  6. package/dashboard/dist/index.html +152 -0
  7. package/dist/bin.d.ts +1 -0
  8. package/dist/bin.js +1 -2
  9. package/dist/binx.js +3 -0
  10. package/dist/config/index.d.ts +3276 -0
  11. package/dist/config/index.js +1 -0
  12. package/dist/generate/index.d.ts +1 -1
  13. package/dist/generate/index.js +1 -1
  14. package/dist/packem_chunks/CONFIG_FILES.js +8 -0
  15. package/dist/packem_chunks/DEFAULT_CLEAN_KEEP.js +1 -0
  16. package/dist/packem_chunks/agent-instructions.js +11 -0
  17. package/dist/packem_chunks/bloom-status.js +2 -0
  18. package/dist/packem_chunks/bloom-sync.js +2 -0
  19. package/dist/packem_chunks/cache-attestation.js +1 -0
  20. package/dist/packem_chunks/catalog-detector.js +1 -0
  21. package/dist/packem_chunks/catalog.js +114 -0
  22. package/dist/packem_chunks/cli-exec.js +1 -0
  23. package/dist/packem_chunks/cli-main.js +268 -0
  24. package/dist/packem_chunks/defineReleasePlugin.js +3 -0
  25. package/dist/packem_chunks/detect.js +3 -0
  26. package/dist/packem_chunks/detect2.js +8 -0
  27. package/dist/packem_chunks/devtools.js +4 -0
  28. package/dist/packem_chunks/discord.js +4 -0
  29. package/dist/packem_chunks/dispatch.js +4 -0
  30. package/dist/packem_chunks/doctor-probe.js +2 -0
  31. package/dist/packem_chunks/dynamic-import.js +1 -0
  32. package/dist/packem_chunks/extra-files.js +3 -0
  33. package/dist/packem_chunks/fix.js +11 -0
  34. package/dist/packem_chunks/git.js +3 -0
  35. package/dist/packem_chunks/group-tags.js +1 -0
  36. package/dist/packem_chunks/handler.js +1 -1
  37. package/dist/packem_chunks/handler10.js +5 -1
  38. package/dist/packem_chunks/handler11.js +1 -1
  39. package/dist/packem_chunks/handler12.js +26 -152
  40. package/dist/packem_chunks/handler13.js +5 -1
  41. package/dist/packem_chunks/handler14.js +1 -3
  42. package/dist/packem_chunks/handler15.js +1 -1
  43. package/dist/packem_chunks/handler16.js +1 -2
  44. package/dist/packem_chunks/handler17.js +1 -7
  45. package/dist/packem_chunks/handler18.js +1 -1
  46. package/dist/packem_chunks/handler19.js +5 -19
  47. package/dist/packem_chunks/handler2.js +1 -1
  48. package/dist/packem_chunks/handler20.js +2 -428
  49. package/dist/packem_chunks/handler21.js +2 -22
  50. package/dist/packem_chunks/handler22.js +14 -3
  51. package/dist/packem_chunks/handler23.js +1 -5
  52. package/dist/packem_chunks/handler24.js +1 -1
  53. package/dist/packem_chunks/handler25.js +1 -20
  54. package/dist/packem_chunks/handler26.js +5 -1
  55. package/dist/packem_chunks/handler27.js +1 -1
  56. package/dist/packem_chunks/handler28.js +3 -1
  57. package/dist/packem_chunks/handler29.js +1 -2
  58. package/dist/packem_chunks/handler3.js +4 -2
  59. package/dist/packem_chunks/handler30.js +1 -22
  60. package/dist/packem_chunks/handler31.js +2 -1
  61. package/dist/packem_chunks/handler32.js +2 -1
  62. package/dist/packem_chunks/handler33.js +2 -37
  63. package/dist/packem_chunks/handler34.js +3 -3
  64. package/dist/packem_chunks/handler35.js +6 -23
  65. package/dist/packem_chunks/handler36.js +1 -5
  66. package/dist/packem_chunks/handler37.js +36 -21
  67. package/dist/packem_chunks/handler38.js +8 -1
  68. package/dist/packem_chunks/handler39.js +9 -2
  69. package/dist/packem_chunks/handler4.js +4 -5
  70. package/dist/packem_chunks/handler40.js +75 -1
  71. package/dist/packem_chunks/handler41.js +5 -5
  72. package/dist/packem_chunks/handler42.js +4 -1
  73. package/dist/packem_chunks/handler43.js +3 -24
  74. package/dist/packem_chunks/handler44.js +2 -3
  75. package/dist/packem_chunks/handler45.js +1 -1
  76. package/dist/packem_chunks/handler46.js +1 -0
  77. package/dist/packem_chunks/handler47.js +1 -0
  78. package/dist/packem_chunks/handler48.js +3 -0
  79. package/dist/packem_chunks/handler49.js +1 -0
  80. package/dist/packem_chunks/handler5.js +6 -4
  81. package/dist/packem_chunks/handler50.js +7 -0
  82. package/dist/packem_chunks/handler51.js +33 -0
  83. package/dist/packem_chunks/handler52.js +3 -0
  84. package/dist/packem_chunks/handler53.js +8 -0
  85. package/dist/packem_chunks/handler54.js +4 -0
  86. package/dist/packem_chunks/handler55.js +1 -0
  87. package/dist/packem_chunks/handler56.js +12 -0
  88. package/dist/packem_chunks/handler57.js +11 -0
  89. package/dist/packem_chunks/handler58.js +5 -0
  90. package/dist/packem_chunks/handler59.js +11 -0
  91. package/dist/packem_chunks/handler6.js +8 -2
  92. package/dist/packem_chunks/handler60.js +3 -0
  93. package/dist/packem_chunks/handler61.js +22 -0
  94. package/dist/packem_chunks/handler62.js +61 -0
  95. package/dist/packem_chunks/handler63.js +3 -0
  96. package/dist/packem_chunks/handler64.js +6 -0
  97. package/dist/packem_chunks/handler65.js +9 -0
  98. package/dist/packem_chunks/handler66.js +2 -0
  99. package/dist/packem_chunks/handler67.js +24 -0
  100. package/dist/packem_chunks/handler68.js +25 -0
  101. package/dist/packem_chunks/handler69.js +153 -0
  102. package/dist/packem_chunks/handler7.js +1 -24
  103. package/dist/packem_chunks/handler70.js +10 -0
  104. package/dist/packem_chunks/handler71.js +23 -0
  105. package/dist/packem_chunks/handler72.js +322 -0
  106. package/dist/packem_chunks/handler73.js +708 -0
  107. package/dist/packem_chunks/handler74.js +48 -0
  108. package/dist/packem_chunks/handler75.js +27 -0
  109. package/dist/packem_chunks/handler76.js +3 -0
  110. package/dist/packem_chunks/handler77.js +190 -0
  111. package/dist/packem_chunks/handler78.js +38 -0
  112. package/dist/packem_chunks/handler8.js +1 -6
  113. package/dist/packem_chunks/handler9.js +1 -8
  114. package/dist/packem_chunks/heal-accept.js +10 -0
  115. package/dist/packem_chunks/heal.js +14 -0
  116. package/dist/packem_chunks/help-command.js +31 -0
  117. package/dist/packem_chunks/index.js +1 -7
  118. package/dist/packem_chunks/index2.js +802 -0
  119. package/dist/packem_chunks/index3.js +7 -0
  120. package/dist/packem_chunks/index4.js +135 -0
  121. package/dist/packem_chunks/index5.js +73 -0
  122. package/dist/packem_chunks/interface.js +2 -0
  123. package/dist/packem_chunks/keys-refresh.js +4 -0
  124. package/dist/packem_chunks/lean.js +4 -0
  125. package/dist/packem_chunks/list.js +3 -0
  126. package/dist/packem_chunks/loader.js +4 -1
  127. package/dist/packem_chunks/loader2.js +1 -0
  128. package/dist/packem_chunks/orchestrator.js +42 -0
  129. package/dist/packem_chunks/pre-mode.js +2 -0
  130. package/dist/packem_chunks/print-config.js +2 -0
  131. package/dist/packem_chunks/prompts.js +7 -0
  132. package/dist/packem_chunks/prune.js +3 -0
  133. package/dist/packem_chunks/publish-guards.js +1 -0
  134. package/dist/packem_chunks/registry.js +48 -0
  135. package/dist/packem_chunks/resolveFormatter.js +9 -0
  136. package/dist/packem_chunks/run.js +1 -0
  137. package/dist/packem_chunks/security.js +1 -0
  138. package/dist/packem_chunks/shell-runner.js +1 -0
  139. package/dist/packem_chunks/slack.js +2 -0
  140. package/dist/packem_chunks/snapshot.js +2 -0
  141. package/dist/packem_chunks/stage-publisher.js +1 -0
  142. package/dist/packem_chunks/staged-registry.js +2 -0
  143. package/dist/packem_chunks/state.js +3 -0
  144. package/dist/packem_chunks/status.js +2 -0
  145. package/dist/packem_chunks/success-walk.js +8 -0
  146. package/dist/packem_chunks/sync.js +2 -0
  147. package/dist/packem_chunks/sync2.js +2 -0
  148. package/dist/packem_chunks/tar.js +3 -0
  149. package/dist/packem_chunks/tripwire.js +2 -0
  150. package/dist/packem_chunks/ts-loader.js +22 -0
  151. package/dist/packem_chunks/verify-lockfile.js +2 -0
  152. package/dist/packem_chunks/version-resolver.js +2 -0
  153. package/dist/packem_chunks/webhook.js +1 -0
  154. package/dist/packem_chunks/workflow-templates.js +167 -0
  155. package/dist/packem_chunks/workspace.js +2 -0
  156. package/dist/packem_shared/AfterAllProjectsVersioned-CAKI2nWf.js +1 -0
  157. package/dist/packem_shared/MultiSpinner-B9U0-aE3-B-gIXhFk.js +3 -0
  158. package/dist/packem_shared/ReleaseClient-BY4OZNCK.js +1 -0
  159. package/dist/packem_shared/Table-BGIHvenQ-D2oJtNQj.js +34 -0
  160. package/dist/packem_shared/VisReleaseError-DMGRBTNO.js +1 -0
  161. package/dist/packem_shared/_commonjsHelpers-B5Y90VFO.js +1 -0
  162. package/dist/packem_shared/advisories-CaP4uNhD.js +1 -0
  163. package/dist/packem_shared/affected-shas-BfO3PDJq.js +1 -0
  164. package/dist/packem_shared/ai-analysis-CO7No4rt.js +68 -0
  165. package/dist/packem_shared/ai-fix-B4u2zlVG.js +43 -0
  166. package/dist/packem_shared/anolilab-text-CAM_E6uK.js +13 -0
  167. package/dist/packem_shared/api.d-BPftyU9r.d.ts +27 -0
  168. package/dist/packem_shared/augment-8z86AwtF.js +4 -0
  169. package/dist/packem_shared/bin-Cv8vsMEo.js +1 -0
  170. package/dist/packem_shared/build-scripts-D477Ou-x.js +1 -0
  171. package/dist/packem_shared/command-runtime-EWjmSxPj.js +1 -0
  172. package/dist/packem_shared/compile-cache-B_Vf_WxT.js +3 -0
  173. package/dist/packem_shared/createAdapter-bU4DIP3F.js +1 -0
  174. package/dist/packem_shared/createVersionActions-BK43SNDH.js +1 -0
  175. package/dist/packem_shared/cyclonedx-CDWHbD9s.js +4 -0
  176. package/dist/packem_shared/defineFormatter-D5dCp6Kv.js +1 -0
  177. package/dist/packem_shared/definePlugin-DoUcoYSy.js +1 -0
  178. package/dist/packem_shared/dependency-scan-P52jY0pU.js +1 -0
  179. package/dist/packem_shared/docker-CD7o1D1o.js +59 -0
  180. package/dist/packem_shared/env-Cpxa_7UE.js +27 -0
  181. package/dist/packem_shared/failure-log-MOhz-TBv.js +2 -0
  182. package/dist/packem_shared/giget-DVTFJlbR.js +2 -0
  183. package/dist/packem_shared/glob-DMbPwGSj-uzODoE-1.js +1 -0
  184. package/dist/packem_shared/index-B0EsgdzO.js +1 -0
  185. package/dist/packem_shared/index-BAUIIRZJ.js +1 -0
  186. package/dist/packem_shared/index-BVuCxe14.js +22 -0
  187. package/dist/packem_shared/index-CdTXvj-V.js +1 -0
  188. package/dist/packem_shared/index-CgXLAAVI.js +28 -0
  189. package/dist/packem_shared/index-DjTWo3sH.js +1 -0
  190. package/dist/packem_shared/index.server-J83sowC4.js +2 -0
  191. package/dist/packem_shared/interface.d-B7VK2rcH.d.ts +148 -0
  192. package/dist/packem_shared/interface.d-Cezzifoh.d.ts +106 -0
  193. package/dist/packem_shared/license-t5KnNX6v.js +1 -0
  194. package/dist/packem_shared/lifecycle-hzwghh5a.js +2 -0
  195. package/dist/packem_shared/lockfile-CWcVTdRc.js +1 -0
  196. package/dist/packem_shared/main-B3juSU5z.js +1 -0
  197. package/dist/packem_shared/manifests-CaPqgQxW.js +1 -0
  198. package/dist/packem_shared/min-release-age-skpcnlpk.js +34 -0
  199. package/dist/packem_shared/missing-package-json-_hOp4AW5.js +1 -0
  200. package/dist/packem_shared/native-config-sync-CFi1iQNG.js +21 -0
  201. package/dist/packem_shared/osv-bloom-BAyJUnRx.js +2 -0
  202. package/dist/packem_shared/otelPlugin-DmKDBaPo.js +1 -0
  203. package/dist/packem_shared/packument-CYxvm590.js +1 -0
  204. package/dist/packem_shared/peer-warnings-BXAzXqY3.js +1 -0
  205. package/dist/packem_shared/plugins.d-ND23R9I3.d.ts +4 -0
  206. package/dist/packem_shared/pm-runner-mVFjedM6.js +1 -0
  207. package/dist/packem_shared/prompt-DjXHVgYU.js +1 -0
  208. package/dist/packem_shared/provenance-CI_WQx7G.js +1 -0
  209. package/dist/packem_shared/public-api-WqUCiyIe.js +131 -0
  210. package/dist/packem_shared/readJsonSync-DuMMeB3s-Cx08VBQg.js +1 -0
  211. package/dist/packem_shared/registry-keys-AGlSEY6R.js +1 -0
  212. package/dist/packem_shared/resolve-explicit-DVE9cfkm.js +5 -0
  213. package/dist/packem_shared/resolve-runtime-CGHf-wHz.js +1 -0
  214. package/dist/packem_shared/run-file-Bs_E9O6O.js +1 -0
  215. package/dist/packem_shared/runtime-check-pS2XH4BO.js +1 -0
  216. package/dist/packem_shared/runtime-process-Dmz0vCJy-DUwTvH1J.js +1 -0
  217. package/dist/packem_shared/s1ngularity-xmrq5T5r.js +1 -0
  218. package/dist/packem_shared/scan-progress-DQ4TMXcb.js +2 -0
  219. package/dist/packem_shared/selectors-CRgS4bU9.js +3 -0
  220. package/dist/packem_shared/signatures-Dp3th1DB.js +2 -0
  221. package/dist/packem_shared/slug-DoueYuLo.js +1 -0
  222. package/dist/packem_shared/spinner-DuJJvFTl.js +1 -0
  223. package/dist/packem_shared/sticky-comment-D6_7-w8T.js +1 -0
  224. package/dist/packem_shared/subtree-C7bZuiSQ.js +2 -0
  225. package/dist/packem_shared/symbols-DPTlrJ3B.js +1 -0
  226. package/dist/packem_shared/tabs-CgxCvjCY.js +1 -0
  227. package/dist/packem_shared/target-merge-D2eTghgd.js +11 -0
  228. package/dist/packem_shared/target-options-TM6ETDAS.js +1 -0
  229. package/dist/packem_shared/toolchain-B5KwUZfq.js +5 -0
  230. package/dist/packem_shared/typosquats-C0layQsP.js +1 -0
  231. package/dist/packem_shared/use-measured-height-Drobr4fe.js +1 -0
  232. package/dist/packem_shared/utils-CRueU43T.js +1 -0
  233. package/dist/packem_shared/verify-Cjo4EBFZ.js +1 -0
  234. package/dist/packem_shared/vis-update-app-qIkyvrd1.js +1 -0
  235. package/dist/packem_shared/watch-BnE1TzYn.js +1 -0
  236. package/dist/packem_shared/watch-loop-Irf3Pm-1.js +11 -0
  237. package/dist/release/core/changelog/index.d.ts +5 -0
  238. package/dist/release/core/changelog/index.js +1 -0
  239. package/dist/release/core/package-managers/index.d.ts +6 -0
  240. package/dist/release/core/package-managers/index.js +1 -0
  241. package/dist/release/core/version-actions/index.d.ts +14 -0
  242. package/dist/release/core/version-actions/index.js +1 -0
  243. package/dist/release/index.d.ts +233 -0
  244. package/dist/release/index.js +1 -0
  245. package/dist/release/plugin-sdk.d.ts +128 -0
  246. package/dist/release/plugin-sdk.js +1 -0
  247. package/dist/release/presets.d.ts +225 -0
  248. package/dist/release/presets.js +1 -0
  249. package/dist/release/types.d.ts +1493 -0
  250. package/dist/release/types.js +1 -0
  251. package/dist/runtime/preload.d.ts +1 -0
  252. package/dist/runtime/preload.js +1 -0
  253. package/index.d.ts +450 -0
  254. package/index.js +663 -556
  255. package/package.json +105 -62
  256. package/schemas/project.schema.json +872 -225
  257. package/schemas/vis-config.schema.json +6309 -264
  258. package/schemas/vis-release-config.schema.json +1423 -0
  259. package/skills/vis/SKILL.md +96 -0
  260. package/templates/buildkite-ci/.buildkite/pipeline.yml.tera +85 -0
  261. package/templates/buildkite-ci/template.yml +20 -0
  262. package/dist/config.d.ts +0 -1087
  263. package/dist/config.js +0 -1
  264. package/dist/packem_shared/VisUpdateApp-BBx3idMI.js +0 -1
  265. package/dist/packem_shared/ai-analysis-DDqXRFxY.js +0 -67
  266. package/dist/packem_shared/bin-BaZZ32BK.js +0 -93
  267. package/dist/packem_shared/cache-directory-DL8hfXeG.js +0 -1
  268. package/dist/packem_shared/catalog-CuSpuB_R.js +0 -12
  269. package/dist/packem_shared/dependency-scan-BoLG2Fez.js +0 -1
  270. package/dist/packem_shared/docker-BcfqH4Av.js +0 -2
  271. package/dist/packem_shared/flakiness-DSIHZGBT.js +0 -1
  272. package/dist/packem_shared/otelPlugin-DxyvBcXO.js +0 -1
  273. package/dist/packem_shared/runtime-check-CGHal8SO.js +0 -1
  274. package/dist/packem_shared/selectors-CfH9ZY08.js +0 -3
  275. package/dist/packem_shared/symbols-CIMw60-G.js +0 -1
  276. package/dist/packem_shared/toolchain-C3ZG0o_X.js +0 -5
  277. package/dist/packem_shared/typosquats-Bpq4zcWL.js +0 -1
  278. package/dist/packem_shared/utils-DrNg0XTR.js +0 -1
package/index.js CHANGED
@@ -4,598 +4,705 @@
4
4
  /* auto-generated by NAPI-RS */
5
5
 
6
6
  import { createRequire } from 'node:module'
7
- const require = createRequire(import.meta.url)
8
- const __dirname = new URL('.', import.meta.url).pathname
7
+ const require = createRequire(import.meta.url);
8
+ const __dirname = new URL(".", import.meta.url).pathname;
9
9
 
10
- const { readFileSync } = require('node:fs')
11
- let nativeBinding = null
12
- const loadErrors = []
10
+ const { readFileSync } = require("node:fs");
11
+ let nativeBinding = null;
12
+ const loadErrors = [];
13
13
 
14
14
  const isMusl = () => {
15
- let musl = false
16
- if (process.platform === 'linux') {
17
- musl = isMuslFromFilesystem()
18
- if (musl === null) {
19
- musl = isMuslFromReport()
20
- }
21
- if (musl === null) {
22
- musl = isMuslFromChildProcess()
15
+ let musl = false;
16
+ if (process.platform === "linux") {
17
+ musl = isMuslFromFilesystem();
18
+ if (musl === null) {
19
+ musl = isMuslFromReport();
20
+ }
21
+ if (musl === null) {
22
+ musl = isMuslFromChildProcess();
23
+ }
23
24
  }
24
- }
25
- return musl
26
- }
25
+ return musl;
26
+ };
27
27
 
28
- const isFileMusl = (f) => f.includes('libc.musl-') || f.includes('ld-musl-')
28
+ const isFileMusl = (f) => f.includes("libc.musl-") || f.includes("ld-musl-");
29
29
 
30
30
  const isMuslFromFilesystem = () => {
31
- try {
32
- return readFileSync('/usr/bin/ldd', 'utf-8').includes('musl')
33
- } catch {
34
- return null
35
- }
36
- }
31
+ try {
32
+ return readFileSync("/usr/bin/ldd", "utf-8").includes("musl");
33
+ } catch {
34
+ return null;
35
+ }
36
+ };
37
37
 
38
38
  const isMuslFromReport = () => {
39
- let report = null
40
- if (typeof process.report?.getReport === 'function') {
41
- process.report.excludeNetwork = true
42
- report = process.report.getReport()
43
- }
44
- if (!report) {
45
- return null
46
- }
47
- if (report.header && report.header.glibcVersionRuntime) {
48
- return false
49
- }
50
- if (Array.isArray(report.sharedObjects)) {
51
- if (report.sharedObjects.some(isFileMusl)) {
52
- return true
39
+ let report = null;
40
+ if (typeof process.report?.getReport === "function") {
41
+ process.report.excludeNetwork = true;
42
+ report = process.report.getReport();
53
43
  }
54
- }
55
- return false
56
- }
57
-
58
- const isMuslFromChildProcess = () => {
59
- try {
60
- return require('child_process').execSync('ldd --version', { encoding: 'utf8' }).includes('musl')
61
- } catch (e) {
62
- // If we reach this case, we don't know if the system is musl or not, so is better to just fallback to false
63
- return false
64
- }
65
- }
66
-
67
- function requireNative() {
68
- if (process.env.NAPI_RS_NATIVE_LIBRARY_PATH) {
69
- try {
70
- return require(process.env.NAPI_RS_NATIVE_LIBRARY_PATH);
71
- } catch (err) {
72
- loadErrors.push(err)
44
+ if (!report) {
45
+ return null;
73
46
  }
74
- } else if (process.platform === 'android') {
75
- if (process.arch === 'arm64') {
76
- try {
77
- return require('./vis-native.android-arm64.node')
78
- } catch (e) {
79
- loadErrors.push(e)
80
- }
81
- try {
82
- const binding = require('@visulima/vis-binding-android-arm64')
83
- const bindingPackageVersion = require('@visulima/vis-binding-android-arm64/package.json').version
84
- if (bindingPackageVersion !== '1.0.0-alpha.8' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
85
- throw new Error(`Native binding package version mismatch, expected 1.0.0-alpha.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
86
- }
87
- return binding
88
- } catch (e) {
89
- loadErrors.push(e)
90
- }
91
- } else if (process.arch === 'arm') {
92
- try {
93
- return require('./vis-native.android-arm-eabi.node')
94
- } catch (e) {
95
- loadErrors.push(e)
96
- }
97
- try {
98
- const binding = require('@visulima/vis-binding-android-arm-eabi')
99
- const bindingPackageVersion = require('@visulima/vis-binding-android-arm-eabi/package.json').version
100
- if (bindingPackageVersion !== '1.0.0-alpha.8' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
101
- throw new Error(`Native binding package version mismatch, expected 1.0.0-alpha.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
102
- }
103
- return binding
104
- } catch (e) {
105
- loadErrors.push(e)
106
- }
107
- } else {
108
- loadErrors.push(new Error(`Unsupported architecture on Android ${process.arch}`))
47
+ if (report.header && report.header.glibcVersionRuntime) {
48
+ return false;
109
49
  }
110
- } else if (process.platform === 'win32') {
111
- if (process.arch === 'x64') {
112
- if (process.config?.variables?.shlib_suffix === 'dll.a' || process.config?.variables?.node_target_type === 'shared_library') {
113
- try {
114
- return require('./vis-native.win32-x64-gnu.node')
115
- } catch (e) {
116
- loadErrors.push(e)
117
- }
118
- try {
119
- const binding = require('@visulima/vis-binding-win32-x64-gnu')
120
- const bindingPackageVersion = require('@visulima/vis-binding-win32-x64-gnu/package.json').version
121
- if (bindingPackageVersion !== '1.0.0-alpha.8' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
122
- throw new Error(`Native binding package version mismatch, expected 1.0.0-alpha.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
123
- }
124
- return binding
125
- } catch (e) {
126
- loadErrors.push(e)
127
- }
128
- } else {
129
- try {
130
- return require('./vis-native.win32-x64-msvc.node')
131
- } catch (e) {
132
- loadErrors.push(e)
133
- }
134
- try {
135
- const binding = require('@visulima/vis-binding-win32-x64-msvc')
136
- const bindingPackageVersion = require('@visulima/vis-binding-win32-x64-msvc/package.json').version
137
- if (bindingPackageVersion !== '1.0.0-alpha.8' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
138
- throw new Error(`Native binding package version mismatch, expected 1.0.0-alpha.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
50
+ if (Array.isArray(report.sharedObjects)) {
51
+ if (report.sharedObjects.some(isFileMusl)) {
52
+ return true;
139
53
  }
140
- return binding
141
- } catch (e) {
142
- loadErrors.push(e)
143
- }
144
- }
145
- } else if (process.arch === 'ia32') {
146
- try {
147
- return require('./vis-native.win32-ia32-msvc.node')
148
- } catch (e) {
149
- loadErrors.push(e)
150
- }
151
- try {
152
- const binding = require('@visulima/vis-binding-win32-ia32-msvc')
153
- const bindingPackageVersion = require('@visulima/vis-binding-win32-ia32-msvc/package.json').version
154
- if (bindingPackageVersion !== '1.0.0-alpha.8' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
155
- throw new Error(`Native binding package version mismatch, expected 1.0.0-alpha.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
156
- }
157
- return binding
158
- } catch (e) {
159
- loadErrors.push(e)
160
- }
161
- } else if (process.arch === 'arm64') {
162
- try {
163
- return require('./vis-native.win32-arm64-msvc.node')
164
- } catch (e) {
165
- loadErrors.push(e)
166
- }
167
- try {
168
- const binding = require('@visulima/vis-binding-win32-arm64-msvc')
169
- const bindingPackageVersion = require('@visulima/vis-binding-win32-arm64-msvc/package.json').version
170
- if (bindingPackageVersion !== '1.0.0-alpha.8' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
171
- throw new Error(`Native binding package version mismatch, expected 1.0.0-alpha.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
172
- }
173
- return binding
174
- } catch (e) {
175
- loadErrors.push(e)
176
- }
177
- } else {
178
- loadErrors.push(new Error(`Unsupported architecture on Windows: ${process.arch}`))
179
- }
180
- } else if (process.platform === 'darwin') {
181
- try {
182
- return require('./vis-native.darwin-universal.node')
183
- } catch (e) {
184
- loadErrors.push(e)
185
54
  }
55
+ return false;
56
+ };
57
+
58
+ const isMuslFromChildProcess = () => {
186
59
  try {
187
- const binding = require('@visulima/vis-binding-darwin-universal')
188
- const bindingPackageVersion = require('@visulima/vis-binding-darwin-universal/package.json').version
189
- if (bindingPackageVersion !== '1.0.0-alpha.8' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
190
- throw new Error(`Native binding package version mismatch, expected 1.0.0-alpha.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
191
- }
192
- return binding
60
+ return require("child_process").execSync("ldd --version", { encoding: "utf8" }).includes("musl");
193
61
  } catch (e) {
194
- loadErrors.push(e)
195
- }
196
- if (process.arch === 'x64') {
197
- try {
198
- return require('./vis-native.darwin-x64.node')
199
- } catch (e) {
200
- loadErrors.push(e)
201
- }
202
- try {
203
- const binding = require('@visulima/vis-binding-darwin-x64')
204
- const bindingPackageVersion = require('@visulima/vis-binding-darwin-x64/package.json').version
205
- if (bindingPackageVersion !== '1.0.0-alpha.8' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
206
- throw new Error(`Native binding package version mismatch, expected 1.0.0-alpha.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
207
- }
208
- return binding
209
- } catch (e) {
210
- loadErrors.push(e)
211
- }
212
- } else if (process.arch === 'arm64') {
213
- try {
214
- return require('./vis-native.darwin-arm64.node')
215
- } catch (e) {
216
- loadErrors.push(e)
217
- }
218
- try {
219
- const binding = require('@visulima/vis-binding-darwin-arm64')
220
- const bindingPackageVersion = require('@visulima/vis-binding-darwin-arm64/package.json').version
221
- if (bindingPackageVersion !== '1.0.0-alpha.8' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
222
- throw new Error(`Native binding package version mismatch, expected 1.0.0-alpha.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
223
- }
224
- return binding
225
- } catch (e) {
226
- loadErrors.push(e)
227
- }
228
- } else {
229
- loadErrors.push(new Error(`Unsupported architecture on macOS: ${process.arch}`))
230
- }
231
- } else if (process.platform === 'freebsd') {
232
- if (process.arch === 'x64') {
233
- try {
234
- return require('./vis-native.freebsd-x64.node')
235
- } catch (e) {
236
- loadErrors.push(e)
237
- }
238
- try {
239
- const binding = require('@visulima/vis-binding-freebsd-x64')
240
- const bindingPackageVersion = require('@visulima/vis-binding-freebsd-x64/package.json').version
241
- if (bindingPackageVersion !== '1.0.0-alpha.8' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
242
- throw new Error(`Native binding package version mismatch, expected 1.0.0-alpha.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
243
- }
244
- return binding
245
- } catch (e) {
246
- loadErrors.push(e)
247
- }
248
- } else if (process.arch === 'arm64') {
249
- try {
250
- return require('./vis-native.freebsd-arm64.node')
251
- } catch (e) {
252
- loadErrors.push(e)
253
- }
254
- try {
255
- const binding = require('@visulima/vis-binding-freebsd-arm64')
256
- const bindingPackageVersion = require('@visulima/vis-binding-freebsd-arm64/package.json').version
257
- if (bindingPackageVersion !== '1.0.0-alpha.8' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
258
- throw new Error(`Native binding package version mismatch, expected 1.0.0-alpha.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
259
- }
260
- return binding
261
- } catch (e) {
262
- loadErrors.push(e)
263
- }
264
- } else {
265
- loadErrors.push(new Error(`Unsupported architecture on FreeBSD: ${process.arch}`))
62
+ // If we reach this case, we don't know if the system is musl or not, so is better to just fallback to false
63
+ return false;
266
64
  }
267
- } else if (process.platform === 'linux') {
268
- if (process.arch === 'x64') {
269
- if (isMusl()) {
270
- try {
271
- return require('./vis-native.linux-x64-musl.node')
272
- } catch (e) {
273
- loadErrors.push(e)
274
- }
275
- try {
276
- const binding = require('@visulima/vis-binding-linux-x64-musl')
277
- const bindingPackageVersion = require('@visulima/vis-binding-linux-x64-musl/package.json').version
278
- if (bindingPackageVersion !== '1.0.0-alpha.8' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
279
- throw new Error(`Native binding package version mismatch, expected 1.0.0-alpha.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
280
- }
281
- return binding
282
- } catch (e) {
283
- loadErrors.push(e)
284
- }
285
- } else {
286
- try {
287
- return require('./vis-native.linux-x64-gnu.node')
288
- } catch (e) {
289
- loadErrors.push(e)
290
- }
291
- try {
292
- const binding = require('@visulima/vis-binding-linux-x64-gnu')
293
- const bindingPackageVersion = require('@visulima/vis-binding-linux-x64-gnu/package.json').version
294
- if (bindingPackageVersion !== '1.0.0-alpha.8' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
295
- throw new Error(`Native binding package version mismatch, expected 1.0.0-alpha.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
296
- }
297
- return binding
298
- } catch (e) {
299
- loadErrors.push(e)
300
- }
301
- }
302
- } else if (process.arch === 'arm64') {
303
- if (isMusl()) {
304
- try {
305
- return require('./vis-native.linux-arm64-musl.node')
306
- } catch (e) {
307
- loadErrors.push(e)
308
- }
309
- try {
310
- const binding = require('@visulima/vis-binding-linux-arm64-musl')
311
- const bindingPackageVersion = require('@visulima/vis-binding-linux-arm64-musl/package.json').version
312
- if (bindingPackageVersion !== '1.0.0-alpha.8' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
313
- throw new Error(`Native binding package version mismatch, expected 1.0.0-alpha.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
314
- }
315
- return binding
316
- } catch (e) {
317
- loadErrors.push(e)
318
- }
319
- } else {
320
- try {
321
- return require('./vis-native.linux-arm64-gnu.node')
322
- } catch (e) {
323
- loadErrors.push(e)
324
- }
325
- try {
326
- const binding = require('@visulima/vis-binding-linux-arm64-gnu')
327
- const bindingPackageVersion = require('@visulima/vis-binding-linux-arm64-gnu/package.json').version
328
- if (bindingPackageVersion !== '1.0.0-alpha.8' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
329
- throw new Error(`Native binding package version mismatch, expected 1.0.0-alpha.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
330
- }
331
- return binding
332
- } catch (e) {
333
- loadErrors.push(e)
334
- }
335
- }
336
- } else if (process.arch === 'arm') {
337
- if (isMusl()) {
338
- try {
339
- return require('./vis-native.linux-arm-musleabihf.node')
340
- } catch (e) {
341
- loadErrors.push(e)
342
- }
343
- try {
344
- const binding = require('@visulima/vis-binding-linux-arm-musleabihf')
345
- const bindingPackageVersion = require('@visulima/vis-binding-linux-arm-musleabihf/package.json').version
346
- if (bindingPackageVersion !== '1.0.0-alpha.8' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
347
- throw new Error(`Native binding package version mismatch, expected 1.0.0-alpha.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
348
- }
349
- return binding
350
- } catch (e) {
351
- loadErrors.push(e)
352
- }
353
- } else {
354
- try {
355
- return require('./vis-native.linux-arm-gnueabihf.node')
356
- } catch (e) {
357
- loadErrors.push(e)
358
- }
359
- try {
360
- const binding = require('@visulima/vis-binding-linux-arm-gnueabihf')
361
- const bindingPackageVersion = require('@visulima/vis-binding-linux-arm-gnueabihf/package.json').version
362
- if (bindingPackageVersion !== '1.0.0-alpha.8' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
363
- throw new Error(`Native binding package version mismatch, expected 1.0.0-alpha.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
364
- }
365
- return binding
366
- } catch (e) {
367
- loadErrors.push(e)
368
- }
369
- }
370
- } else if (process.arch === 'loong64') {
371
- if (isMusl()) {
372
- try {
373
- return require('./vis-native.linux-loong64-musl.node')
374
- } catch (e) {
375
- loadErrors.push(e)
376
- }
377
- try {
378
- const binding = require('@visulima/vis-binding-linux-loong64-musl')
379
- const bindingPackageVersion = require('@visulima/vis-binding-linux-loong64-musl/package.json').version
380
- if (bindingPackageVersion !== '1.0.0-alpha.8' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
381
- throw new Error(`Native binding package version mismatch, expected 1.0.0-alpha.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
382
- }
383
- return binding
384
- } catch (e) {
385
- loadErrors.push(e)
386
- }
387
- } else {
388
- try {
389
- return require('./vis-native.linux-loong64-gnu.node')
390
- } catch (e) {
391
- loadErrors.push(e)
392
- }
393
- try {
394
- const binding = require('@visulima/vis-binding-linux-loong64-gnu')
395
- const bindingPackageVersion = require('@visulima/vis-binding-linux-loong64-gnu/package.json').version
396
- if (bindingPackageVersion !== '1.0.0-alpha.8' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
397
- throw new Error(`Native binding package version mismatch, expected 1.0.0-alpha.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
398
- }
399
- return binding
400
- } catch (e) {
401
- loadErrors.push(e)
402
- }
403
- }
404
- } else if (process.arch === 'riscv64') {
405
- if (isMusl()) {
406
- try {
407
- return require('./vis-native.linux-riscv64-musl.node')
408
- } catch (e) {
409
- loadErrors.push(e)
410
- }
65
+ };
66
+
67
+ function requireNative() {
68
+ if (process.env.NAPI_RS_NATIVE_LIBRARY_PATH) {
411
69
  try {
412
- const binding = require('@visulima/vis-binding-linux-riscv64-musl')
413
- const bindingPackageVersion = require('@visulima/vis-binding-linux-riscv64-musl/package.json').version
414
- if (bindingPackageVersion !== '1.0.0-alpha.8' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
415
- throw new Error(`Native binding package version mismatch, expected 1.0.0-alpha.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
416
- }
417
- return binding
418
- } catch (e) {
419
- loadErrors.push(e)
70
+ return require(process.env.NAPI_RS_NATIVE_LIBRARY_PATH);
71
+ } catch (err) {
72
+ loadErrors.push(err);
73
+ }
74
+ } else if (process.platform === "android") {
75
+ if (process.arch === "arm64") {
76
+ try {
77
+ return require("./vis-native.android-arm64.node");
78
+ } catch (e) {
79
+ loadErrors.push(e);
80
+ }
81
+ try {
82
+ const binding = require("@visulima/vis-binding-android-arm64");
83
+ const bindingPackageVersion = require("@visulima/vis-binding-android-arm64/package.json").version;
84
+ if (bindingPackageVersion !== "1.0.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
85
+ throw new Error(
86
+ `Native binding package version mismatch, expected 1.0.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
87
+ );
88
+ }
89
+ return binding;
90
+ } catch (e) {
91
+ loadErrors.push(e);
92
+ }
93
+ } else if (process.arch === "arm") {
94
+ try {
95
+ return require("./vis-native.android-arm-eabi.node");
96
+ } catch (e) {
97
+ loadErrors.push(e);
98
+ }
99
+ try {
100
+ const binding = require("@visulima/vis-binding-android-arm-eabi");
101
+ const bindingPackageVersion = require("@visulima/vis-binding-android-arm-eabi/package.json").version;
102
+ if (bindingPackageVersion !== "1.0.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
103
+ throw new Error(
104
+ `Native binding package version mismatch, expected 1.0.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
105
+ );
106
+ }
107
+ return binding;
108
+ } catch (e) {
109
+ loadErrors.push(e);
110
+ }
111
+ } else {
112
+ loadErrors.push(new Error(`Unsupported architecture on Android ${process.arch}`));
113
+ }
114
+ } else if (process.platform === "win32") {
115
+ if (process.arch === "x64") {
116
+ if (process.config?.variables?.shlib_suffix === "dll.a" || process.config?.variables?.node_target_type === "shared_library") {
117
+ try {
118
+ return require("./vis-native.win32-x64-gnu.node");
119
+ } catch (e) {
120
+ loadErrors.push(e);
121
+ }
122
+ try {
123
+ const binding = require("@visulima/vis-binding-win32-x64-gnu");
124
+ const bindingPackageVersion = require("@visulima/vis-binding-win32-x64-gnu/package.json").version;
125
+ if (bindingPackageVersion !== "1.0.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
126
+ throw new Error(
127
+ `Native binding package version mismatch, expected 1.0.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
128
+ );
129
+ }
130
+ return binding;
131
+ } catch (e) {
132
+ loadErrors.push(e);
133
+ }
134
+ } else {
135
+ try {
136
+ return require("./vis-native.win32-x64-msvc.node");
137
+ } catch (e) {
138
+ loadErrors.push(e);
139
+ }
140
+ try {
141
+ const binding = require("@visulima/vis-binding-win32-x64-msvc");
142
+ const bindingPackageVersion = require("@visulima/vis-binding-win32-x64-msvc/package.json").version;
143
+ if (bindingPackageVersion !== "1.0.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
144
+ throw new Error(
145
+ `Native binding package version mismatch, expected 1.0.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
146
+ );
147
+ }
148
+ return binding;
149
+ } catch (e) {
150
+ loadErrors.push(e);
151
+ }
152
+ }
153
+ } else if (process.arch === "ia32") {
154
+ try {
155
+ return require("./vis-native.win32-ia32-msvc.node");
156
+ } catch (e) {
157
+ loadErrors.push(e);
158
+ }
159
+ try {
160
+ const binding = require("@visulima/vis-binding-win32-ia32-msvc");
161
+ const bindingPackageVersion = require("@visulima/vis-binding-win32-ia32-msvc/package.json").version;
162
+ if (bindingPackageVersion !== "1.0.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
163
+ throw new Error(
164
+ `Native binding package version mismatch, expected 1.0.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
165
+ );
166
+ }
167
+ return binding;
168
+ } catch (e) {
169
+ loadErrors.push(e);
170
+ }
171
+ } else if (process.arch === "arm64") {
172
+ try {
173
+ return require("./vis-native.win32-arm64-msvc.node");
174
+ } catch (e) {
175
+ loadErrors.push(e);
176
+ }
177
+ try {
178
+ const binding = require("@visulima/vis-binding-win32-arm64-msvc");
179
+ const bindingPackageVersion = require("@visulima/vis-binding-win32-arm64-msvc/package.json").version;
180
+ if (bindingPackageVersion !== "1.0.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
181
+ throw new Error(
182
+ `Native binding package version mismatch, expected 1.0.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
183
+ );
184
+ }
185
+ return binding;
186
+ } catch (e) {
187
+ loadErrors.push(e);
188
+ }
189
+ } else {
190
+ loadErrors.push(new Error(`Unsupported architecture on Windows: ${process.arch}`));
420
191
  }
421
- } else {
192
+ } else if (process.platform === "darwin") {
422
193
  try {
423
- return require('./vis-native.linux-riscv64-gnu.node')
194
+ return require("./vis-native.darwin-universal.node");
424
195
  } catch (e) {
425
- loadErrors.push(e)
196
+ loadErrors.push(e);
426
197
  }
427
198
  try {
428
- const binding = require('@visulima/vis-binding-linux-riscv64-gnu')
429
- const bindingPackageVersion = require('@visulima/vis-binding-linux-riscv64-gnu/package.json').version
430
- if (bindingPackageVersion !== '1.0.0-alpha.8' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
431
- throw new Error(`Native binding package version mismatch, expected 1.0.0-alpha.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
432
- }
433
- return binding
199
+ const binding = require("@visulima/vis-binding-darwin-universal");
200
+ const bindingPackageVersion = require("@visulima/vis-binding-darwin-universal/package.json").version;
201
+ if (bindingPackageVersion !== "1.0.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
202
+ throw new Error(
203
+ `Native binding package version mismatch, expected 1.0.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
204
+ );
205
+ }
206
+ return binding;
434
207
  } catch (e) {
435
- loadErrors.push(e)
436
- }
437
- }
438
- } else if (process.arch === 'ppc64') {
439
- try {
440
- return require('./vis-native.linux-ppc64-gnu.node')
441
- } catch (e) {
442
- loadErrors.push(e)
443
- }
444
- try {
445
- const binding = require('@visulima/vis-binding-linux-ppc64-gnu')
446
- const bindingPackageVersion = require('@visulima/vis-binding-linux-ppc64-gnu/package.json').version
447
- if (bindingPackageVersion !== '1.0.0-alpha.8' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
448
- throw new Error(`Native binding package version mismatch, expected 1.0.0-alpha.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
449
- }
450
- return binding
451
- } catch (e) {
452
- loadErrors.push(e)
453
- }
454
- } else if (process.arch === 's390x') {
455
- try {
456
- return require('./vis-native.linux-s390x-gnu.node')
457
- } catch (e) {
458
- loadErrors.push(e)
459
- }
460
- try {
461
- const binding = require('@visulima/vis-binding-linux-s390x-gnu')
462
- const bindingPackageVersion = require('@visulima/vis-binding-linux-s390x-gnu/package.json').version
463
- if (bindingPackageVersion !== '1.0.0-alpha.8' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
464
- throw new Error(`Native binding package version mismatch, expected 1.0.0-alpha.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
465
- }
466
- return binding
467
- } catch (e) {
468
- loadErrors.push(e)
469
- }
470
- } else {
471
- loadErrors.push(new Error(`Unsupported architecture on Linux: ${process.arch}`))
472
- }
473
- } else if (process.platform === 'openharmony') {
474
- if (process.arch === 'arm64') {
475
- try {
476
- return require('./vis-native.openharmony-arm64.node')
477
- } catch (e) {
478
- loadErrors.push(e)
479
- }
480
- try {
481
- const binding = require('@visulima/vis-binding-openharmony-arm64')
482
- const bindingPackageVersion = require('@visulima/vis-binding-openharmony-arm64/package.json').version
483
- if (bindingPackageVersion !== '1.0.0-alpha.8' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
484
- throw new Error(`Native binding package version mismatch, expected 1.0.0-alpha.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
485
- }
486
- return binding
487
- } catch (e) {
488
- loadErrors.push(e)
489
- }
490
- } else if (process.arch === 'x64') {
491
- try {
492
- return require('./vis-native.openharmony-x64.node')
493
- } catch (e) {
494
- loadErrors.push(e)
495
- }
496
- try {
497
- const binding = require('@visulima/vis-binding-openharmony-x64')
498
- const bindingPackageVersion = require('@visulima/vis-binding-openharmony-x64/package.json').version
499
- if (bindingPackageVersion !== '1.0.0-alpha.8' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
500
- throw new Error(`Native binding package version mismatch, expected 1.0.0-alpha.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
501
- }
502
- return binding
503
- } catch (e) {
504
- loadErrors.push(e)
505
- }
506
- } else if (process.arch === 'arm') {
507
- try {
508
- return require('./vis-native.openharmony-arm.node')
509
- } catch (e) {
510
- loadErrors.push(e)
511
- }
512
- try {
513
- const binding = require('@visulima/vis-binding-openharmony-arm')
514
- const bindingPackageVersion = require('@visulima/vis-binding-openharmony-arm/package.json').version
515
- if (bindingPackageVersion !== '1.0.0-alpha.8' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
516
- throw new Error(`Native binding package version mismatch, expected 1.0.0-alpha.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
208
+ loadErrors.push(e);
209
+ }
210
+ if (process.arch === "x64") {
211
+ try {
212
+ return require("./vis-native.darwin-x64.node");
213
+ } catch (e) {
214
+ loadErrors.push(e);
215
+ }
216
+ try {
217
+ const binding = require("@visulima/vis-binding-darwin-x64");
218
+ const bindingPackageVersion = require("@visulima/vis-binding-darwin-x64/package.json").version;
219
+ if (bindingPackageVersion !== "1.0.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
220
+ throw new Error(
221
+ `Native binding package version mismatch, expected 1.0.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
222
+ );
223
+ }
224
+ return binding;
225
+ } catch (e) {
226
+ loadErrors.push(e);
227
+ }
228
+ } else if (process.arch === "arm64") {
229
+ try {
230
+ return require("./vis-native.darwin-arm64.node");
231
+ } catch (e) {
232
+ loadErrors.push(e);
233
+ }
234
+ try {
235
+ const binding = require("@visulima/vis-binding-darwin-arm64");
236
+ const bindingPackageVersion = require("@visulima/vis-binding-darwin-arm64/package.json").version;
237
+ if (bindingPackageVersion !== "1.0.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
238
+ throw new Error(
239
+ `Native binding package version mismatch, expected 1.0.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
240
+ );
241
+ }
242
+ return binding;
243
+ } catch (e) {
244
+ loadErrors.push(e);
245
+ }
246
+ } else {
247
+ loadErrors.push(new Error(`Unsupported architecture on macOS: ${process.arch}`));
248
+ }
249
+ } else if (process.platform === "freebsd") {
250
+ if (process.arch === "x64") {
251
+ try {
252
+ return require("./vis-native.freebsd-x64.node");
253
+ } catch (e) {
254
+ loadErrors.push(e);
255
+ }
256
+ try {
257
+ const binding = require("@visulima/vis-binding-freebsd-x64");
258
+ const bindingPackageVersion = require("@visulima/vis-binding-freebsd-x64/package.json").version;
259
+ if (bindingPackageVersion !== "1.0.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
260
+ throw new Error(
261
+ `Native binding package version mismatch, expected 1.0.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
262
+ );
263
+ }
264
+ return binding;
265
+ } catch (e) {
266
+ loadErrors.push(e);
267
+ }
268
+ } else if (process.arch === "arm64") {
269
+ try {
270
+ return require("./vis-native.freebsd-arm64.node");
271
+ } catch (e) {
272
+ loadErrors.push(e);
273
+ }
274
+ try {
275
+ const binding = require("@visulima/vis-binding-freebsd-arm64");
276
+ const bindingPackageVersion = require("@visulima/vis-binding-freebsd-arm64/package.json").version;
277
+ if (bindingPackageVersion !== "1.0.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
278
+ throw new Error(
279
+ `Native binding package version mismatch, expected 1.0.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
280
+ );
281
+ }
282
+ return binding;
283
+ } catch (e) {
284
+ loadErrors.push(e);
285
+ }
286
+ } else {
287
+ loadErrors.push(new Error(`Unsupported architecture on FreeBSD: ${process.arch}`));
288
+ }
289
+ } else if (process.platform === "linux") {
290
+ if (process.arch === "x64") {
291
+ if (isMusl()) {
292
+ try {
293
+ return require("./vis-native.linux-x64-musl.node");
294
+ } catch (e) {
295
+ loadErrors.push(e);
296
+ }
297
+ try {
298
+ const binding = require("@visulima/vis-binding-linux-x64-musl");
299
+ const bindingPackageVersion = require("@visulima/vis-binding-linux-x64-musl/package.json").version;
300
+ if (bindingPackageVersion !== "1.0.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
301
+ throw new Error(
302
+ `Native binding package version mismatch, expected 1.0.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
303
+ );
304
+ }
305
+ return binding;
306
+ } catch (e) {
307
+ loadErrors.push(e);
308
+ }
309
+ } else {
310
+ try {
311
+ return require("./vis-native.linux-x64-gnu.node");
312
+ } catch (e) {
313
+ loadErrors.push(e);
314
+ }
315
+ try {
316
+ const binding = require("@visulima/vis-binding-linux-x64-gnu");
317
+ const bindingPackageVersion = require("@visulima/vis-binding-linux-x64-gnu/package.json").version;
318
+ if (bindingPackageVersion !== "1.0.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
319
+ throw new Error(
320
+ `Native binding package version mismatch, expected 1.0.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
321
+ );
322
+ }
323
+ return binding;
324
+ } catch (e) {
325
+ loadErrors.push(e);
326
+ }
327
+ }
328
+ } else if (process.arch === "arm64") {
329
+ if (isMusl()) {
330
+ try {
331
+ return require("./vis-native.linux-arm64-musl.node");
332
+ } catch (e) {
333
+ loadErrors.push(e);
334
+ }
335
+ try {
336
+ const binding = require("@visulima/vis-binding-linux-arm64-musl");
337
+ const bindingPackageVersion = require("@visulima/vis-binding-linux-arm64-musl/package.json").version;
338
+ if (bindingPackageVersion !== "1.0.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
339
+ throw new Error(
340
+ `Native binding package version mismatch, expected 1.0.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
341
+ );
342
+ }
343
+ return binding;
344
+ } catch (e) {
345
+ loadErrors.push(e);
346
+ }
347
+ } else {
348
+ try {
349
+ return require("./vis-native.linux-arm64-gnu.node");
350
+ } catch (e) {
351
+ loadErrors.push(e);
352
+ }
353
+ try {
354
+ const binding = require("@visulima/vis-binding-linux-arm64-gnu");
355
+ const bindingPackageVersion = require("@visulima/vis-binding-linux-arm64-gnu/package.json").version;
356
+ if (bindingPackageVersion !== "1.0.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
357
+ throw new Error(
358
+ `Native binding package version mismatch, expected 1.0.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
359
+ );
360
+ }
361
+ return binding;
362
+ } catch (e) {
363
+ loadErrors.push(e);
364
+ }
365
+ }
366
+ } else if (process.arch === "arm") {
367
+ if (isMusl()) {
368
+ try {
369
+ return require("./vis-native.linux-arm-musleabihf.node");
370
+ } catch (e) {
371
+ loadErrors.push(e);
372
+ }
373
+ try {
374
+ const binding = require("@visulima/vis-binding-linux-arm-musleabihf");
375
+ const bindingPackageVersion = require("@visulima/vis-binding-linux-arm-musleabihf/package.json").version;
376
+ if (bindingPackageVersion !== "1.0.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
377
+ throw new Error(
378
+ `Native binding package version mismatch, expected 1.0.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
379
+ );
380
+ }
381
+ return binding;
382
+ } catch (e) {
383
+ loadErrors.push(e);
384
+ }
385
+ } else {
386
+ try {
387
+ return require("./vis-native.linux-arm-gnueabihf.node");
388
+ } catch (e) {
389
+ loadErrors.push(e);
390
+ }
391
+ try {
392
+ const binding = require("@visulima/vis-binding-linux-arm-gnueabihf");
393
+ const bindingPackageVersion = require("@visulima/vis-binding-linux-arm-gnueabihf/package.json").version;
394
+ if (bindingPackageVersion !== "1.0.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
395
+ throw new Error(
396
+ `Native binding package version mismatch, expected 1.0.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
397
+ );
398
+ }
399
+ return binding;
400
+ } catch (e) {
401
+ loadErrors.push(e);
402
+ }
403
+ }
404
+ } else if (process.arch === "loong64") {
405
+ if (isMusl()) {
406
+ try {
407
+ return require("./vis-native.linux-loong64-musl.node");
408
+ } catch (e) {
409
+ loadErrors.push(e);
410
+ }
411
+ try {
412
+ const binding = require("@visulima/vis-binding-linux-loong64-musl");
413
+ const bindingPackageVersion = require("@visulima/vis-binding-linux-loong64-musl/package.json").version;
414
+ if (bindingPackageVersion !== "1.0.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
415
+ throw new Error(
416
+ `Native binding package version mismatch, expected 1.0.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
417
+ );
418
+ }
419
+ return binding;
420
+ } catch (e) {
421
+ loadErrors.push(e);
422
+ }
423
+ } else {
424
+ try {
425
+ return require("./vis-native.linux-loong64-gnu.node");
426
+ } catch (e) {
427
+ loadErrors.push(e);
428
+ }
429
+ try {
430
+ const binding = require("@visulima/vis-binding-linux-loong64-gnu");
431
+ const bindingPackageVersion = require("@visulima/vis-binding-linux-loong64-gnu/package.json").version;
432
+ if (bindingPackageVersion !== "1.0.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
433
+ throw new Error(
434
+ `Native binding package version mismatch, expected 1.0.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
435
+ );
436
+ }
437
+ return binding;
438
+ } catch (e) {
439
+ loadErrors.push(e);
440
+ }
441
+ }
442
+ } else if (process.arch === "riscv64") {
443
+ if (isMusl()) {
444
+ try {
445
+ return require("./vis-native.linux-riscv64-musl.node");
446
+ } catch (e) {
447
+ loadErrors.push(e);
448
+ }
449
+ try {
450
+ const binding = require("@visulima/vis-binding-linux-riscv64-musl");
451
+ const bindingPackageVersion = require("@visulima/vis-binding-linux-riscv64-musl/package.json").version;
452
+ if (bindingPackageVersion !== "1.0.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
453
+ throw new Error(
454
+ `Native binding package version mismatch, expected 1.0.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
455
+ );
456
+ }
457
+ return binding;
458
+ } catch (e) {
459
+ loadErrors.push(e);
460
+ }
461
+ } else {
462
+ try {
463
+ return require("./vis-native.linux-riscv64-gnu.node");
464
+ } catch (e) {
465
+ loadErrors.push(e);
466
+ }
467
+ try {
468
+ const binding = require("@visulima/vis-binding-linux-riscv64-gnu");
469
+ const bindingPackageVersion = require("@visulima/vis-binding-linux-riscv64-gnu/package.json").version;
470
+ if (bindingPackageVersion !== "1.0.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
471
+ throw new Error(
472
+ `Native binding package version mismatch, expected 1.0.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
473
+ );
474
+ }
475
+ return binding;
476
+ } catch (e) {
477
+ loadErrors.push(e);
478
+ }
479
+ }
480
+ } else if (process.arch === "ppc64") {
481
+ try {
482
+ return require("./vis-native.linux-ppc64-gnu.node");
483
+ } catch (e) {
484
+ loadErrors.push(e);
485
+ }
486
+ try {
487
+ const binding = require("@visulima/vis-binding-linux-ppc64-gnu");
488
+ const bindingPackageVersion = require("@visulima/vis-binding-linux-ppc64-gnu/package.json").version;
489
+ if (bindingPackageVersion !== "1.0.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
490
+ throw new Error(
491
+ `Native binding package version mismatch, expected 1.0.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
492
+ );
493
+ }
494
+ return binding;
495
+ } catch (e) {
496
+ loadErrors.push(e);
497
+ }
498
+ } else if (process.arch === "s390x") {
499
+ try {
500
+ return require("./vis-native.linux-s390x-gnu.node");
501
+ } catch (e) {
502
+ loadErrors.push(e);
503
+ }
504
+ try {
505
+ const binding = require("@visulima/vis-binding-linux-s390x-gnu");
506
+ const bindingPackageVersion = require("@visulima/vis-binding-linux-s390x-gnu/package.json").version;
507
+ if (bindingPackageVersion !== "1.0.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
508
+ throw new Error(
509
+ `Native binding package version mismatch, expected 1.0.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
510
+ );
511
+ }
512
+ return binding;
513
+ } catch (e) {
514
+ loadErrors.push(e);
515
+ }
516
+ } else {
517
+ loadErrors.push(new Error(`Unsupported architecture on Linux: ${process.arch}`));
518
+ }
519
+ } else if (process.platform === "openharmony") {
520
+ if (process.arch === "arm64") {
521
+ try {
522
+ return require("./vis-native.openharmony-arm64.node");
523
+ } catch (e) {
524
+ loadErrors.push(e);
525
+ }
526
+ try {
527
+ const binding = require("@visulima/vis-binding-openharmony-arm64");
528
+ const bindingPackageVersion = require("@visulima/vis-binding-openharmony-arm64/package.json").version;
529
+ if (bindingPackageVersion !== "1.0.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
530
+ throw new Error(
531
+ `Native binding package version mismatch, expected 1.0.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
532
+ );
533
+ }
534
+ return binding;
535
+ } catch (e) {
536
+ loadErrors.push(e);
537
+ }
538
+ } else if (process.arch === "x64") {
539
+ try {
540
+ return require("./vis-native.openharmony-x64.node");
541
+ } catch (e) {
542
+ loadErrors.push(e);
543
+ }
544
+ try {
545
+ const binding = require("@visulima/vis-binding-openharmony-x64");
546
+ const bindingPackageVersion = require("@visulima/vis-binding-openharmony-x64/package.json").version;
547
+ if (bindingPackageVersion !== "1.0.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
548
+ throw new Error(
549
+ `Native binding package version mismatch, expected 1.0.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
550
+ );
551
+ }
552
+ return binding;
553
+ } catch (e) {
554
+ loadErrors.push(e);
555
+ }
556
+ } else if (process.arch === "arm") {
557
+ try {
558
+ return require("./vis-native.openharmony-arm.node");
559
+ } catch (e) {
560
+ loadErrors.push(e);
561
+ }
562
+ try {
563
+ const binding = require("@visulima/vis-binding-openharmony-arm");
564
+ const bindingPackageVersion = require("@visulima/vis-binding-openharmony-arm/package.json").version;
565
+ if (bindingPackageVersion !== "1.0.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
566
+ throw new Error(
567
+ `Native binding package version mismatch, expected 1.0.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
568
+ );
569
+ }
570
+ return binding;
571
+ } catch (e) {
572
+ loadErrors.push(e);
573
+ }
574
+ } else {
575
+ loadErrors.push(new Error(`Unsupported architecture on OpenHarmony: ${process.arch}`));
517
576
  }
518
- return binding
519
- } catch (e) {
520
- loadErrors.push(e)
521
- }
522
577
  } else {
523
- loadErrors.push(new Error(`Unsupported architecture on OpenHarmony: ${process.arch}`))
578
+ loadErrors.push(new Error(`Unsupported OS: ${process.platform}, architecture: ${process.arch}`));
524
579
  }
525
- } else {
526
- loadErrors.push(new Error(`Unsupported OS: ${process.platform}, architecture: ${process.arch}`))
527
- }
528
580
  }
529
581
 
530
- nativeBinding = requireNative()
582
+ nativeBinding = requireNative();
531
583
 
532
- if (!nativeBinding || process.env.NAPI_RS_FORCE_WASI) {
533
- let wasiBinding = null
534
- let wasiBindingError = null
535
- try {
536
- wasiBinding = require('./vis-native.wasi.cjs')
537
- nativeBinding = wasiBinding
538
- } catch (err) {
539
- if (process.env.NAPI_RS_FORCE_WASI) {
540
- wasiBindingError = err
541
- }
542
- }
543
- if (!nativeBinding || process.env.NAPI_RS_FORCE_WASI) {
584
+ // NAPI_RS_FORCE_WASI is a tri-state flag:
585
+ // unset / any other value → native binding preferred, WASI is only a fallback
586
+ // 'true' → force WASI fallback even if native loaded
587
+ // 'error' → force WASI and throw if no WASI binding is found
588
+ // Treating any non-empty string as truthy (the historical behavior) meant
589
+ // NAPI_RS_FORCE_WASI=false, NAPI_RS_FORCE_WASI=0, etc. inadvertently triggered
590
+ // the WASI path, causing ENOENT for packages shipped without a .wasi.cjs file.
591
+ const forceWasi = process.env.NAPI_RS_FORCE_WASI === "true" || process.env.NAPI_RS_FORCE_WASI === "error";
592
+
593
+ if (!nativeBinding || forceWasi) {
594
+ let wasiBinding = null;
595
+ let wasiBindingError = null;
544
596
  try {
545
- wasiBinding = require('@visulima/vis-binding-wasm32-wasi')
546
- nativeBinding = wasiBinding
597
+ wasiBinding = require("./vis-native.wasi.cjs");
598
+ nativeBinding = wasiBinding;
547
599
  } catch (err) {
548
- if (process.env.NAPI_RS_FORCE_WASI) {
549
- if (!wasiBindingError) {
550
- wasiBindingError = err
551
- } else {
552
- wasiBindingError.cause = err
600
+ if (forceWasi) {
601
+ wasiBindingError = err;
553
602
  }
554
- loadErrors.push(err)
555
- }
556
603
  }
557
- }
558
- if (process.env.NAPI_RS_FORCE_WASI === 'error' && !wasiBinding) {
559
- const error = new Error('WASI binding not found and NAPI_RS_FORCE_WASI is set to error')
560
- error.cause = wasiBindingError
561
- throw error
562
- }
604
+ if (!nativeBinding || forceWasi) {
605
+ try {
606
+ wasiBinding = require("@visulima/vis-binding-wasm32-wasi");
607
+ nativeBinding = wasiBinding;
608
+ } catch (err) {
609
+ if (forceWasi) {
610
+ if (!wasiBindingError) {
611
+ wasiBindingError = err;
612
+ } else {
613
+ wasiBindingError.cause = err;
614
+ }
615
+ loadErrors.push(err);
616
+ }
617
+ }
618
+ }
619
+ if (process.env.NAPI_RS_FORCE_WASI === "error" && !wasiBinding) {
620
+ const error = new Error("WASI binding not found and NAPI_RS_FORCE_WASI is set to error");
621
+ error.cause = wasiBindingError;
622
+ throw error;
623
+ }
563
624
  }
564
625
 
565
626
  if (!nativeBinding) {
566
- if (loadErrors.length > 0) {
567
- throw new Error(
568
- `Cannot find native binding. ` +
569
- `npm has a bug related to optional dependencies (https://github.com/npm/cli/issues/4828). ` +
570
- 'Please try `npm i` again after removing both package-lock.json and node_modules directory.',
571
- {
572
- cause: loadErrors.reduce((err, cur) => {
573
- cur.cause = err
574
- return cur
575
- }),
576
- },
577
- )
578
- }
579
- throw new Error(`Failed to load native binding`)
627
+ if (loadErrors.length > 0) {
628
+ throw new Error(
629
+ `Cannot find native binding. ` +
630
+ `npm has a bug related to optional dependencies (https://github.com/npm/cli/issues/4828). ` +
631
+ "Please try `npm i` again after removing both package-lock.json and node_modules directory.",
632
+ {
633
+ cause: loadErrors.reduce((err, cur) => {
634
+ cur.cause = err;
635
+ return cur;
636
+ }),
637
+ },
638
+ );
639
+ }
640
+ throw new Error(`Failed to load native binding`);
580
641
  }
581
642
 
582
- const { cleanWorkspace, detectPackageManager, execPmCommand, execPmCommandInteractive, NATIVE_BINDING_VERSION, resolveAdd, resolveDedupe, resolveDlx, resolveExec, resolveInstall, resolveLink, resolveOutdated, resolvePmCommand, resolveRemove, resolveUnlink, resolveWhy, sortPackageJsonString, sortPackageJsonStringWithOptions, whichBin } = nativeBinding
583
- export { cleanWorkspace }
584
- export { detectPackageManager }
585
- export { execPmCommand }
586
- export { execPmCommandInteractive }
587
- export { NATIVE_BINDING_VERSION }
588
- export { resolveAdd }
589
- export { resolveDedupe }
590
- export { resolveDlx }
591
- export { resolveExec }
592
- export { resolveInstall }
593
- export { resolveLink }
594
- export { resolveOutdated }
595
- export { resolvePmCommand }
596
- export { resolveRemove }
597
- export { resolveUnlink }
598
- export { resolveWhy }
599
- export { sortPackageJsonString }
600
- export { sortPackageJsonStringWithOptions }
601
- export { whichBin }
643
+ const {
644
+ OsvBloomHandle,
645
+ advisoriesIngest,
646
+ advisoriesQuery,
647
+ advisoriesStatus,
648
+ allKnownTags,
649
+ cleanWorkspace,
650
+ detectPackageManager,
651
+ execPmCommand,
652
+ execPmCommandInteractive,
653
+ NATIVE_BINDING_VERSION,
654
+ osvBloomDecode,
655
+ osvBloomProbe,
656
+ osvBloomProbeBatch,
657
+ parseShebang,
658
+ resolveAdd,
659
+ resolveDedupe,
660
+ resolveDlx,
661
+ resolveEditorconfigDefaults,
662
+ resolveExec,
663
+ resolveInstall,
664
+ resolveLink,
665
+ resolveOutdated,
666
+ resolvePmCommand,
667
+ resolveRemove,
668
+ resolveUnlink,
669
+ resolveWhy,
670
+ sortPackageJsonString,
671
+ sortPackageJsonStringWithOptions,
672
+ tagsFromPath,
673
+ tagsFromPaths,
674
+ transformTs,
675
+ whichBin,
676
+ } = nativeBinding;
677
+ export { OsvBloomHandle };
678
+ export { advisoriesIngest };
679
+ export { advisoriesQuery };
680
+ export { advisoriesStatus };
681
+ export { allKnownTags };
682
+ export { cleanWorkspace };
683
+ export { detectPackageManager };
684
+ export { execPmCommand };
685
+ export { execPmCommandInteractive };
686
+ export { NATIVE_BINDING_VERSION };
687
+ export { osvBloomDecode };
688
+ export { osvBloomProbe };
689
+ export { osvBloomProbeBatch };
690
+ export { parseShebang };
691
+ export { resolveAdd };
692
+ export { resolveDedupe };
693
+ export { resolveDlx };
694
+ export { resolveEditorconfigDefaults };
695
+ export { resolveExec };
696
+ export { resolveInstall };
697
+ export { resolveLink };
698
+ export { resolveOutdated };
699
+ export { resolvePmCommand };
700
+ export { resolveRemove };
701
+ export { resolveUnlink };
702
+ export { resolveWhy };
703
+ export { sortPackageJsonString };
704
+ export { sortPackageJsonStringWithOptions };
705
+ export { tagsFromPath };
706
+ export { tagsFromPaths };
707
+ export { transformTs };
708
+ export { whichBin };