@xingwangzhe/bfs-rs 0.1.0 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +180 -1
- package/README.md +44 -10
- package/bfs-rs.darwin-arm64.node +0 -0
- package/bfs-rs.darwin-x64.node +0 -0
- package/bfs-rs.linux-arm64-gnu.node +0 -0
- package/bfs-rs.linux-x64-gnu.node +0 -0
- package/bfs-rs.linux-x64-musl.node +0 -0
- package/bfs-rs.win32-x64-msvc.node +0 -0
- package/index.d.ts +42 -0
- package/index.js +56 -52
- package/package.json +15 -8
package/LICENSE
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c)
|
|
3
|
+
Copyright (c) 2026 xingwangzhe
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
|
@@ -19,3 +19,182 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
19
19
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
20
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
21
|
SOFTWARE.
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
Apache License
|
|
26
|
+
Version 2.0, January 2004
|
|
27
|
+
http://www.apache.org/licenses/
|
|
28
|
+
|
|
29
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
30
|
+
|
|
31
|
+
1. Definitions.
|
|
32
|
+
|
|
33
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
34
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
35
|
+
|
|
36
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
37
|
+
the copyright owner that is granting the License.
|
|
38
|
+
|
|
39
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
40
|
+
other entities that control, are controlled by, or are under common
|
|
41
|
+
control with that entity. For the purposes of this definition,
|
|
42
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
43
|
+
direction or management of such entity, whether by contract or
|
|
44
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
45
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
46
|
+
|
|
47
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
48
|
+
exercising permissions granted by this License.
|
|
49
|
+
|
|
50
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
51
|
+
including but not limited to software source code, documentation
|
|
52
|
+
source, and configuration files.
|
|
53
|
+
|
|
54
|
+
"Object" form shall mean any form resulting from mechanical
|
|
55
|
+
transformation or translation of a Source form, including but
|
|
56
|
+
not limited to compiled object code, generated documentation,
|
|
57
|
+
and conversions to other media types.
|
|
58
|
+
|
|
59
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
60
|
+
Object form, made available under the License, as indicated by a
|
|
61
|
+
copyright notice that is included in or attached to the work
|
|
62
|
+
(an example is provided in the Appendix below).
|
|
63
|
+
|
|
64
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
65
|
+
form, that is based on (or derived from) the Work and for which the
|
|
66
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
67
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
68
|
+
of this License, Derivative Works shall not include works that remain
|
|
69
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
70
|
+
the Work and Derivative Works thereof.
|
|
71
|
+
|
|
72
|
+
"Contribution" shall mean any work of authorship, including
|
|
73
|
+
the original version of the Work and any modifications or additions
|
|
74
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
75
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
76
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
77
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
78
|
+
means any form of electronic, verbal, or written communication sent
|
|
79
|
+
to the Licensor or its representatives, including but not limited to
|
|
80
|
+
communication on electronic mailing lists, source code control systems,
|
|
81
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
82
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
83
|
+
excluding communication that is conspicuously marked or otherwise
|
|
84
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
85
|
+
|
|
86
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
87
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
88
|
+
subsequently incorporated within the Work.
|
|
89
|
+
|
|
90
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
91
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
92
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
93
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
94
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
95
|
+
Work and such Derivative Works in Source or Object form.
|
|
96
|
+
|
|
97
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
98
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
99
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
100
|
+
(except as stated in this section) patent license to make, have made,
|
|
101
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
102
|
+
where such license applies only to those patent claims licensable
|
|
103
|
+
by such Contributor that are necessarily infringed by their
|
|
104
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
105
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
106
|
+
institute patent litigation against any entity (including a
|
|
107
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
108
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
109
|
+
or contributory patent infringement, then any patent licenses
|
|
110
|
+
granted to You under this License for that Work shall terminate
|
|
111
|
+
as of the date such litigation is filed.
|
|
112
|
+
|
|
113
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
114
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
115
|
+
modifications, and in Source or Object form, provided that You
|
|
116
|
+
meet the following conditions:
|
|
117
|
+
|
|
118
|
+
(a) You must give any other recipients of the Work or
|
|
119
|
+
Derivative Works a copy of this License; and
|
|
120
|
+
|
|
121
|
+
(b) You must cause any modified files to carry prominent notices
|
|
122
|
+
stating that You changed the files; and
|
|
123
|
+
|
|
124
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
125
|
+
that You distribute, all copyright, patent, trademark, and
|
|
126
|
+
attribution notices from the Source form of the Work,
|
|
127
|
+
excluding those notices that do not pertain to any part of
|
|
128
|
+
the Derivative Works; and
|
|
129
|
+
|
|
130
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
131
|
+
distribution, then any Derivative Works that You distribute must
|
|
132
|
+
include a readable copy of the attribution notices contained
|
|
133
|
+
within such NOTICE file, excluding those notices that do not
|
|
134
|
+
pertain to any part of the Derivative Works, in at least one
|
|
135
|
+
of the following places: within a NOTICE text file distributed
|
|
136
|
+
as part of the Derivative Works; within the Source form or
|
|
137
|
+
documentation, if provided along with the Derivative Works; or,
|
|
138
|
+
within a display generated by the Derivative Works, if and
|
|
139
|
+
wherever such third-party notices normally appear. The contents
|
|
140
|
+
of the NOTICE file are for informational purposes only and
|
|
141
|
+
do not modify the License. You may add Your own attribution
|
|
142
|
+
notices within Derivative Works that You distribute, alongside
|
|
143
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
144
|
+
that such additional attribution notices cannot be construed
|
|
145
|
+
as modifying the License.
|
|
146
|
+
|
|
147
|
+
You may add Your own copyright statement to Your modifications and
|
|
148
|
+
may provide additional or different license terms and conditions
|
|
149
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
150
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
151
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
152
|
+
the conditions stated in this License.
|
|
153
|
+
|
|
154
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
155
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
156
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
157
|
+
this License, without any additional terms or conditions.
|
|
158
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
159
|
+
the terms of any separate license agreement you may have executed
|
|
160
|
+
with Licensor regarding such Contributions.
|
|
161
|
+
|
|
162
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
163
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
164
|
+
except as required for reasonable and customary use in describing the
|
|
165
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
166
|
+
|
|
167
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
168
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
169
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
170
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
171
|
+
implied, including, without limitation, any warranties or conditions
|
|
172
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
173
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
174
|
+
appropriateness of using or redistributing the Work and assume any
|
|
175
|
+
risks associated with Your exercise of permissions under this License.
|
|
176
|
+
|
|
177
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
178
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
179
|
+
unless required by applicable law (such as deliberate and grossly
|
|
180
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
181
|
+
liable to You for damages, including any direct, indirect, special,
|
|
182
|
+
incidental, or consequential damages of any character arising as a
|
|
183
|
+
result of this License or out of the use or inability to use the
|
|
184
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
185
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
186
|
+
other commercial damages or losses), even if such Contributor
|
|
187
|
+
has been advised of the possibility of such damages.
|
|
188
|
+
|
|
189
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
190
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
191
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
192
|
+
or other liability obligations and/or rights consistent with this
|
|
193
|
+
License. However, in accepting such obligations, You may act only
|
|
194
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
195
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
196
|
+
defend, and hold each Contributor harmless for any liability
|
|
197
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
198
|
+
of your accepting any such warranty or additional liability.
|
|
199
|
+
|
|
200
|
+
END OF TERMS AND CONDITIONS
|
package/README.md
CHANGED
|
@@ -18,7 +18,7 @@ This library uses the **CSR (Compressed Sparse Row)** format to represent graphs
|
|
|
18
18
|
|
|
19
19
|
```
|
|
20
20
|
adj = [1, 2, 0, 2, 0, 1, 3, 2] // all neighbor node IDs flattened
|
|
21
|
-
offsets = [0, 2, 4,
|
|
21
|
+
offsets = [0, 2, 4, 7, 8] // start offset for each node (length = n + 1)
|
|
22
22
|
```
|
|
23
23
|
|
|
24
24
|
The data above represents:
|
|
@@ -42,12 +42,13 @@ Run BFS from a **single source node**.
|
|
|
42
42
|
import { bfsOne } from '@xingwangzhe/bfs-rs';
|
|
43
43
|
|
|
44
44
|
const adj = [1, 2, 0, 2, 0, 1, 3, 2];
|
|
45
|
-
const offsets = [0, 2, 4,
|
|
45
|
+
const offsets = [0, 2, 4, 7, 8];
|
|
46
46
|
const n = 4; // total nodes
|
|
47
47
|
|
|
48
48
|
const result = bfsOne(adj, offsets, n, 0);
|
|
49
49
|
// result.distances → [0, 1, 1, 2] // shortest distances from node 0
|
|
50
50
|
// result.maxDistance → 2 // maximum finite distance
|
|
51
|
+
// result.histogram → [2, 1] // 2 nodes at dist 1, 1 node at dist 2
|
|
51
52
|
```
|
|
52
53
|
|
|
53
54
|
**Parameters:**
|
|
@@ -63,6 +64,7 @@ const result = bfsOne(adj, offsets, n, 0);
|
|
|
63
64
|
|-------------|----------|------------------------------------------|
|
|
64
65
|
| distances | number[] | Shortest distance to each node, -1 = unreachable |
|
|
65
66
|
| maxDistance | number | Maximum distance among reachable nodes |
|
|
67
|
+
| histogram | number[] | histogram[d-1] = nodes at distance d |
|
|
66
68
|
|
|
67
69
|
---
|
|
68
70
|
|
|
@@ -111,10 +113,31 @@ const result = bfsAll(adj, offsets, n);
|
|
|
111
113
|
|
|
112
114
|
---
|
|
113
115
|
|
|
116
|
+
### bfsPath(adj, offsets, n, source, target)
|
|
117
|
+
|
|
118
|
+
Find the **shortest path** between two nodes using BFS + parent backtracking. Stops early when the target is found.
|
|
119
|
+
|
|
120
|
+
```ts
|
|
121
|
+
import { bfsPath } from '@xingwangzhe/bfs-rs';
|
|
122
|
+
|
|
123
|
+
const r = bfsPath(adj, offsets, n, 0, 3);
|
|
124
|
+
// r.path → [0, 2, 3] // node sequence from source to target
|
|
125
|
+
// r.distance → 2 // number of edges, -1 if unreachable
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
**Returns:** `BfsPathResult`
|
|
129
|
+
|
|
130
|
+
| Field | Type | Description |
|
|
131
|
+
|----------|----------|----------------------------------------------|
|
|
132
|
+
| path | number[] | Shortest path node sequence (empty if unreachable) |
|
|
133
|
+
| distance | number | Number of edges (-1 if unreachable) |
|
|
134
|
+
|
|
135
|
+
---
|
|
136
|
+
|
|
114
137
|
## Full Example
|
|
115
138
|
|
|
116
139
|
```ts
|
|
117
|
-
import { bfsOne, bfsBatch, bfsAll } from '@xingwangzhe/bfs-rs';
|
|
140
|
+
import { bfsOne, bfsBatch, bfsAll, bfsPath } from '@xingwangzhe/bfs-rs';
|
|
118
141
|
|
|
119
142
|
// Graph with 5 nodes (undirected)
|
|
120
143
|
// 0 -- 1 -- 2
|
|
@@ -128,27 +151,36 @@ const n = 5;
|
|
|
128
151
|
|
|
129
152
|
// 1. Single-source BFS
|
|
130
153
|
const r1 = bfsOne(adj, offsets, n, 0);
|
|
131
|
-
console.log
|
|
154
|
+
console.log.'From node 0:', r1.distances);
|
|
132
155
|
// [0, 1, 2, 1, 2]
|
|
133
156
|
|
|
134
157
|
// 2. Batch BFS
|
|
135
158
|
const r2 = bfsBatch(adj, offsets, n, [0, 4]);
|
|
136
|
-
console.log
|
|
159
|
+
console.log.'Batch count:', r2.processed); // 2
|
|
137
160
|
r2.results.forEach((res, i) => {
|
|
138
|
-
console.log
|
|
161
|
+
console.log.`Source ${[0, 4][i]}:`, res.distances);
|
|
139
162
|
});
|
|
140
163
|
|
|
141
|
-
// 3.
|
|
142
|
-
const
|
|
143
|
-
console.log
|
|
164
|
+
// 3. Shortest path
|
|
165
|
+
const r4 = bfsPath(adj, offsets, n, 0, 4);
|
|
166
|
+
console.log."Path 0→4:", r4.path); // [0, 1, 2, 4] or similar
|
|
167
|
+
|
|
168
|
+
// 4. All-pairs BFS
|
|
169
|
+
const r5 = bfsAll(adj, offsets, n);
|
|
170
|
+
console.log.'All-pairs count:', r3.processed); // 5
|
|
144
171
|
```
|
|
145
172
|
|
|
146
173
|
## Performance
|
|
147
174
|
|
|
148
175
|
- Written in **Rust**, compiled to native machine code
|
|
176
|
+
- BFS queue powered by [`parallel_frontier`](https://crates.io/crates/parallel_frontier) — lock-free, cache-line-padded frontier
|
|
149
177
|
- Batch/all-pairs BFS uses **Rayon** for parallel scheduling across CPU cores
|
|
150
178
|
- Memory-efficient CSR format optimized for large graphs
|
|
151
179
|
|
|
180
|
+
## Credits
|
|
181
|
+
|
|
182
|
+
This package is built on top of [`parallel_frontier`](https://crates.io/crates/parallel_frontier) (Apache-2.0 OR LGPL-2.1-or-later), a high-performance concurrent queue designed for parallel BFS traversals.
|
|
183
|
+
|
|
152
184
|
## Development
|
|
153
185
|
|
|
154
186
|
### Requirements
|
|
@@ -167,4 +199,6 @@ yarn test
|
|
|
167
199
|
|
|
168
200
|
## License
|
|
169
201
|
|
|
170
|
-
MIT
|
|
202
|
+
This project is dual-licensed under [MIT](https://opensource.org/licenses/MIT) OR [Apache-2.0](https://www.apache.org/licenses/LICENSE-2.0), at your option.
|
|
203
|
+
|
|
204
|
+
Dependency [`parallel_frontier`](https://crates.io/crates/parallel_frontier) is used under the Apache-2.0 option of its license.
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/index.d.ts
CHANGED
|
@@ -3,6 +3,9 @@
|
|
|
3
3
|
/** 从所有节点并行执行 BFS(全量) */
|
|
4
4
|
export declare function bfsAll(adj: Array<number>, offsets: Array<number>, n: number): BfsBatchResult
|
|
5
5
|
|
|
6
|
+
/** 从所有节点并行执行 BFS(全量),仅返回直方图 */
|
|
7
|
+
export declare function bfsAllHistogram(adj: Array<number>, offsets: Array<number>, n: number): BfsHistogramBatchResult
|
|
8
|
+
|
|
6
9
|
/**
|
|
7
10
|
* 从多个源节点并行执行 BFS
|
|
8
11
|
*
|
|
@@ -14,6 +17,9 @@ export declare function bfsAll(adj: Array<number>, offsets: Array<number>, n: nu
|
|
|
14
17
|
*/
|
|
15
18
|
export declare function bfsBatch(adj: Array<number>, offsets: Array<number>, n: number, sources: Array<number>): BfsBatchResult
|
|
16
19
|
|
|
20
|
+
/** 从多个源节点并行执行 BFS,仅返回距离直方图(节省内存) */
|
|
21
|
+
export declare function bfsBatchHistogram(adj: Array<number>, offsets: Array<number>, n: number, sources: Array<number>): BfsHistogramBatchResult
|
|
22
|
+
|
|
17
23
|
/** 批量 BFS 结果 */
|
|
18
24
|
export interface BfsBatchResult {
|
|
19
25
|
/** 每个源节点的 BFS 结果 */
|
|
@@ -22,13 +28,49 @@ export interface BfsBatchResult {
|
|
|
22
28
|
processed: number
|
|
23
29
|
}
|
|
24
30
|
|
|
31
|
+
/** 批量直方图结果 */
|
|
32
|
+
export interface BfsHistogramBatchResult {
|
|
33
|
+
/** 每个源节点的直方图结果 */
|
|
34
|
+
results: Array<BfsHistogramResult>
|
|
35
|
+
/** 成功处理的源节点数 */
|
|
36
|
+
processed: number
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/** 仅直方图结果(不含完整距离数组,节省内存) */
|
|
40
|
+
export interface BfsHistogramResult {
|
|
41
|
+
/** 距离直方图:histogram[d] = 距离为 d 的节点数(不含源节点自身) */
|
|
42
|
+
histogram: Array<number>
|
|
43
|
+
/** 最大有限距离 */
|
|
44
|
+
maxDistance: number
|
|
45
|
+
}
|
|
46
|
+
|
|
25
47
|
/** 从单个源节点执行 BFS,返回距离数组 */
|
|
26
48
|
export declare function bfsOne(adj: Array<number>, offsets: Array<number>, n: number, source: number): BfsOneResult
|
|
27
49
|
|
|
50
|
+
/** 从单个源节点执行 BFS,仅返回距离直方图(节省内存) */
|
|
51
|
+
export declare function bfsOneHistogram(adj: Array<number>, offsets: Array<number>, n: number, source: number): BfsHistogramResult
|
|
52
|
+
|
|
28
53
|
/** 单源 BFS 结果 */
|
|
29
54
|
export interface BfsOneResult {
|
|
30
55
|
/** 源节点到每个节点的最短距离(-1 表示不可达) */
|
|
31
56
|
distances: Array<number>
|
|
32
57
|
/** 最大有限距离 */
|
|
33
58
|
maxDistance: number
|
|
59
|
+
/** 距离直方图:histogram[d] = 距离为 d 的节点数(不含源节点自身) */
|
|
60
|
+
histogram: Array<number>
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* 计算从 source 到 target 的最短路径(BFS + 父节点回溯)
|
|
65
|
+
*
|
|
66
|
+
* 找到 target 时立即终止,不遍历全图。
|
|
67
|
+
* 不可达时 path 为空数组,distance 为 -1。
|
|
68
|
+
*/
|
|
69
|
+
export declare function bfsPath(adj: Array<number>, offsets: Array<number>, n: number, source: number, target: number): BfsPathResult
|
|
70
|
+
|
|
71
|
+
export interface BfsPathResult {
|
|
72
|
+
/** 从 source 到 target 的最短路径节点序列(含两端),不可达时为空数组 */
|
|
73
|
+
path: Array<number>
|
|
74
|
+
/** 路径长度(边数),不可达时为 -1 */
|
|
75
|
+
distance: number
|
|
34
76
|
}
|
package/index.js
CHANGED
|
@@ -77,8 +77,8 @@ function requireNative() {
|
|
|
77
77
|
try {
|
|
78
78
|
const binding = require('@xingwangzhe/bfs-rs-android-arm64')
|
|
79
79
|
const bindingPackageVersion = require('@xingwangzhe/bfs-rs-android-arm64/package.json').version
|
|
80
|
-
if (bindingPackageVersion !== '0.1.
|
|
81
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
80
|
+
if (bindingPackageVersion !== '0.1.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
81
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
82
82
|
}
|
|
83
83
|
return binding
|
|
84
84
|
} catch (e) {
|
|
@@ -93,8 +93,8 @@ function requireNative() {
|
|
|
93
93
|
try {
|
|
94
94
|
const binding = require('@xingwangzhe/bfs-rs-android-arm-eabi')
|
|
95
95
|
const bindingPackageVersion = require('@xingwangzhe/bfs-rs-android-arm-eabi/package.json').version
|
|
96
|
-
if (bindingPackageVersion !== '0.1.
|
|
97
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
96
|
+
if (bindingPackageVersion !== '0.1.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
97
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
98
98
|
}
|
|
99
99
|
return binding
|
|
100
100
|
} catch (e) {
|
|
@@ -114,8 +114,8 @@ function requireNative() {
|
|
|
114
114
|
try {
|
|
115
115
|
const binding = require('@xingwangzhe/bfs-rs-win32-x64-gnu')
|
|
116
116
|
const bindingPackageVersion = require('@xingwangzhe/bfs-rs-win32-x64-gnu/package.json').version
|
|
117
|
-
if (bindingPackageVersion !== '0.1.
|
|
118
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
117
|
+
if (bindingPackageVersion !== '0.1.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
118
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
119
119
|
}
|
|
120
120
|
return binding
|
|
121
121
|
} catch (e) {
|
|
@@ -130,8 +130,8 @@ function requireNative() {
|
|
|
130
130
|
try {
|
|
131
131
|
const binding = require('@xingwangzhe/bfs-rs-win32-x64-msvc')
|
|
132
132
|
const bindingPackageVersion = require('@xingwangzhe/bfs-rs-win32-x64-msvc/package.json').version
|
|
133
|
-
if (bindingPackageVersion !== '0.1.
|
|
134
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
133
|
+
if (bindingPackageVersion !== '0.1.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
134
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
135
135
|
}
|
|
136
136
|
return binding
|
|
137
137
|
} catch (e) {
|
|
@@ -147,8 +147,8 @@ function requireNative() {
|
|
|
147
147
|
try {
|
|
148
148
|
const binding = require('@xingwangzhe/bfs-rs-win32-ia32-msvc')
|
|
149
149
|
const bindingPackageVersion = require('@xingwangzhe/bfs-rs-win32-ia32-msvc/package.json').version
|
|
150
|
-
if (bindingPackageVersion !== '0.1.
|
|
151
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
150
|
+
if (bindingPackageVersion !== '0.1.4' && 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.1.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
152
152
|
}
|
|
153
153
|
return binding
|
|
154
154
|
} catch (e) {
|
|
@@ -163,8 +163,8 @@ function requireNative() {
|
|
|
163
163
|
try {
|
|
164
164
|
const binding = require('@xingwangzhe/bfs-rs-win32-arm64-msvc')
|
|
165
165
|
const bindingPackageVersion = require('@xingwangzhe/bfs-rs-win32-arm64-msvc/package.json').version
|
|
166
|
-
if (bindingPackageVersion !== '0.1.
|
|
167
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
166
|
+
if (bindingPackageVersion !== '0.1.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
167
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
168
168
|
}
|
|
169
169
|
return binding
|
|
170
170
|
} catch (e) {
|
|
@@ -182,8 +182,8 @@ function requireNative() {
|
|
|
182
182
|
try {
|
|
183
183
|
const binding = require('@xingwangzhe/bfs-rs-darwin-universal')
|
|
184
184
|
const bindingPackageVersion = require('@xingwangzhe/bfs-rs-darwin-universal/package.json').version
|
|
185
|
-
if (bindingPackageVersion !== '0.1.
|
|
186
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
185
|
+
if (bindingPackageVersion !== '0.1.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
186
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
187
187
|
}
|
|
188
188
|
return binding
|
|
189
189
|
} catch (e) {
|
|
@@ -198,8 +198,8 @@ function requireNative() {
|
|
|
198
198
|
try {
|
|
199
199
|
const binding = require('@xingwangzhe/bfs-rs-darwin-x64')
|
|
200
200
|
const bindingPackageVersion = require('@xingwangzhe/bfs-rs-darwin-x64/package.json').version
|
|
201
|
-
if (bindingPackageVersion !== '0.1.
|
|
202
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
201
|
+
if (bindingPackageVersion !== '0.1.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
202
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
203
203
|
}
|
|
204
204
|
return binding
|
|
205
205
|
} catch (e) {
|
|
@@ -214,8 +214,8 @@ function requireNative() {
|
|
|
214
214
|
try {
|
|
215
215
|
const binding = require('@xingwangzhe/bfs-rs-darwin-arm64')
|
|
216
216
|
const bindingPackageVersion = require('@xingwangzhe/bfs-rs-darwin-arm64/package.json').version
|
|
217
|
-
if (bindingPackageVersion !== '0.1.
|
|
218
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
217
|
+
if (bindingPackageVersion !== '0.1.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
218
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
219
219
|
}
|
|
220
220
|
return binding
|
|
221
221
|
} catch (e) {
|
|
@@ -234,8 +234,8 @@ function requireNative() {
|
|
|
234
234
|
try {
|
|
235
235
|
const binding = require('@xingwangzhe/bfs-rs-freebsd-x64')
|
|
236
236
|
const bindingPackageVersion = require('@xingwangzhe/bfs-rs-freebsd-x64/package.json').version
|
|
237
|
-
if (bindingPackageVersion !== '0.1.
|
|
238
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
237
|
+
if (bindingPackageVersion !== '0.1.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
238
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
239
239
|
}
|
|
240
240
|
return binding
|
|
241
241
|
} catch (e) {
|
|
@@ -250,8 +250,8 @@ function requireNative() {
|
|
|
250
250
|
try {
|
|
251
251
|
const binding = require('@xingwangzhe/bfs-rs-freebsd-arm64')
|
|
252
252
|
const bindingPackageVersion = require('@xingwangzhe/bfs-rs-freebsd-arm64/package.json').version
|
|
253
|
-
if (bindingPackageVersion !== '0.1.
|
|
254
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
253
|
+
if (bindingPackageVersion !== '0.1.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
254
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
255
255
|
}
|
|
256
256
|
return binding
|
|
257
257
|
} catch (e) {
|
|
@@ -271,8 +271,8 @@ function requireNative() {
|
|
|
271
271
|
try {
|
|
272
272
|
const binding = require('@xingwangzhe/bfs-rs-linux-x64-musl')
|
|
273
273
|
const bindingPackageVersion = require('@xingwangzhe/bfs-rs-linux-x64-musl/package.json').version
|
|
274
|
-
if (bindingPackageVersion !== '0.1.
|
|
275
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
274
|
+
if (bindingPackageVersion !== '0.1.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
275
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
276
276
|
}
|
|
277
277
|
return binding
|
|
278
278
|
} catch (e) {
|
|
@@ -287,8 +287,8 @@ function requireNative() {
|
|
|
287
287
|
try {
|
|
288
288
|
const binding = require('@xingwangzhe/bfs-rs-linux-x64-gnu')
|
|
289
289
|
const bindingPackageVersion = require('@xingwangzhe/bfs-rs-linux-x64-gnu/package.json').version
|
|
290
|
-
if (bindingPackageVersion !== '0.1.
|
|
291
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
290
|
+
if (bindingPackageVersion !== '0.1.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
291
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
292
292
|
}
|
|
293
293
|
return binding
|
|
294
294
|
} catch (e) {
|
|
@@ -305,8 +305,8 @@ function requireNative() {
|
|
|
305
305
|
try {
|
|
306
306
|
const binding = require('@xingwangzhe/bfs-rs-linux-arm64-musl')
|
|
307
307
|
const bindingPackageVersion = require('@xingwangzhe/bfs-rs-linux-arm64-musl/package.json').version
|
|
308
|
-
if (bindingPackageVersion !== '0.1.
|
|
309
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
308
|
+
if (bindingPackageVersion !== '0.1.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
309
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
310
310
|
}
|
|
311
311
|
return binding
|
|
312
312
|
} catch (e) {
|
|
@@ -321,8 +321,8 @@ function requireNative() {
|
|
|
321
321
|
try {
|
|
322
322
|
const binding = require('@xingwangzhe/bfs-rs-linux-arm64-gnu')
|
|
323
323
|
const bindingPackageVersion = require('@xingwangzhe/bfs-rs-linux-arm64-gnu/package.json').version
|
|
324
|
-
if (bindingPackageVersion !== '0.1.
|
|
325
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
324
|
+
if (bindingPackageVersion !== '0.1.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
325
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
326
326
|
}
|
|
327
327
|
return binding
|
|
328
328
|
} catch (e) {
|
|
@@ -339,8 +339,8 @@ function requireNative() {
|
|
|
339
339
|
try {
|
|
340
340
|
const binding = require('@xingwangzhe/bfs-rs-linux-arm-musleabihf')
|
|
341
341
|
const bindingPackageVersion = require('@xingwangzhe/bfs-rs-linux-arm-musleabihf/package.json').version
|
|
342
|
-
if (bindingPackageVersion !== '0.1.
|
|
343
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
342
|
+
if (bindingPackageVersion !== '0.1.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
343
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
344
344
|
}
|
|
345
345
|
return binding
|
|
346
346
|
} catch (e) {
|
|
@@ -355,8 +355,8 @@ function requireNative() {
|
|
|
355
355
|
try {
|
|
356
356
|
const binding = require('@xingwangzhe/bfs-rs-linux-arm-gnueabihf')
|
|
357
357
|
const bindingPackageVersion = require('@xingwangzhe/bfs-rs-linux-arm-gnueabihf/package.json').version
|
|
358
|
-
if (bindingPackageVersion !== '0.1.
|
|
359
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
358
|
+
if (bindingPackageVersion !== '0.1.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
359
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
360
360
|
}
|
|
361
361
|
return binding
|
|
362
362
|
} catch (e) {
|
|
@@ -373,8 +373,8 @@ function requireNative() {
|
|
|
373
373
|
try {
|
|
374
374
|
const binding = require('@xingwangzhe/bfs-rs-linux-loong64-musl')
|
|
375
375
|
const bindingPackageVersion = require('@xingwangzhe/bfs-rs-linux-loong64-musl/package.json').version
|
|
376
|
-
if (bindingPackageVersion !== '0.1.
|
|
377
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
376
|
+
if (bindingPackageVersion !== '0.1.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
377
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
378
378
|
}
|
|
379
379
|
return binding
|
|
380
380
|
} catch (e) {
|
|
@@ -389,8 +389,8 @@ function requireNative() {
|
|
|
389
389
|
try {
|
|
390
390
|
const binding = require('@xingwangzhe/bfs-rs-linux-loong64-gnu')
|
|
391
391
|
const bindingPackageVersion = require('@xingwangzhe/bfs-rs-linux-loong64-gnu/package.json').version
|
|
392
|
-
if (bindingPackageVersion !== '0.1.
|
|
393
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
392
|
+
if (bindingPackageVersion !== '0.1.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
393
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
394
394
|
}
|
|
395
395
|
return binding
|
|
396
396
|
} catch (e) {
|
|
@@ -407,8 +407,8 @@ function requireNative() {
|
|
|
407
407
|
try {
|
|
408
408
|
const binding = require('@xingwangzhe/bfs-rs-linux-riscv64-musl')
|
|
409
409
|
const bindingPackageVersion = require('@xingwangzhe/bfs-rs-linux-riscv64-musl/package.json').version
|
|
410
|
-
if (bindingPackageVersion !== '0.1.
|
|
411
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
410
|
+
if (bindingPackageVersion !== '0.1.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
411
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
412
412
|
}
|
|
413
413
|
return binding
|
|
414
414
|
} catch (e) {
|
|
@@ -423,8 +423,8 @@ function requireNative() {
|
|
|
423
423
|
try {
|
|
424
424
|
const binding = require('@xingwangzhe/bfs-rs-linux-riscv64-gnu')
|
|
425
425
|
const bindingPackageVersion = require('@xingwangzhe/bfs-rs-linux-riscv64-gnu/package.json').version
|
|
426
|
-
if (bindingPackageVersion !== '0.1.
|
|
427
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
426
|
+
if (bindingPackageVersion !== '0.1.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
427
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
428
428
|
}
|
|
429
429
|
return binding
|
|
430
430
|
} catch (e) {
|
|
@@ -440,8 +440,8 @@ function requireNative() {
|
|
|
440
440
|
try {
|
|
441
441
|
const binding = require('@xingwangzhe/bfs-rs-linux-ppc64-gnu')
|
|
442
442
|
const bindingPackageVersion = require('@xingwangzhe/bfs-rs-linux-ppc64-gnu/package.json').version
|
|
443
|
-
if (bindingPackageVersion !== '0.1.
|
|
444
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
443
|
+
if (bindingPackageVersion !== '0.1.4' && 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.1.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
445
445
|
}
|
|
446
446
|
return binding
|
|
447
447
|
} catch (e) {
|
|
@@ -456,8 +456,8 @@ function requireNative() {
|
|
|
456
456
|
try {
|
|
457
457
|
const binding = require('@xingwangzhe/bfs-rs-linux-s390x-gnu')
|
|
458
458
|
const bindingPackageVersion = require('@xingwangzhe/bfs-rs-linux-s390x-gnu/package.json').version
|
|
459
|
-
if (bindingPackageVersion !== '0.1.
|
|
460
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
459
|
+
if (bindingPackageVersion !== '0.1.4' && 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.1.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
461
461
|
}
|
|
462
462
|
return binding
|
|
463
463
|
} catch (e) {
|
|
@@ -476,8 +476,8 @@ function requireNative() {
|
|
|
476
476
|
try {
|
|
477
477
|
const binding = require('@xingwangzhe/bfs-rs-openharmony-arm64')
|
|
478
478
|
const bindingPackageVersion = require('@xingwangzhe/bfs-rs-openharmony-arm64/package.json').version
|
|
479
|
-
if (bindingPackageVersion !== '0.1.
|
|
480
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
479
|
+
if (bindingPackageVersion !== '0.1.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
480
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
481
481
|
}
|
|
482
482
|
return binding
|
|
483
483
|
} catch (e) {
|
|
@@ -492,8 +492,8 @@ function requireNative() {
|
|
|
492
492
|
try {
|
|
493
493
|
const binding = require('@xingwangzhe/bfs-rs-openharmony-x64')
|
|
494
494
|
const bindingPackageVersion = require('@xingwangzhe/bfs-rs-openharmony-x64/package.json').version
|
|
495
|
-
if (bindingPackageVersion !== '0.1.
|
|
496
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
495
|
+
if (bindingPackageVersion !== '0.1.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
496
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
497
497
|
}
|
|
498
498
|
return binding
|
|
499
499
|
} catch (e) {
|
|
@@ -508,8 +508,8 @@ function requireNative() {
|
|
|
508
508
|
try {
|
|
509
509
|
const binding = require('@xingwangzhe/bfs-rs-openharmony-arm')
|
|
510
510
|
const bindingPackageVersion = require('@xingwangzhe/bfs-rs-openharmony-arm/package.json').version
|
|
511
|
-
if (bindingPackageVersion !== '0.1.
|
|
512
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
511
|
+
if (bindingPackageVersion !== '0.1.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
512
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
513
513
|
}
|
|
514
514
|
return binding
|
|
515
515
|
} catch (e) {
|
|
@@ -588,5 +588,9 @@ if (!nativeBinding) {
|
|
|
588
588
|
|
|
589
589
|
module.exports = nativeBinding
|
|
590
590
|
module.exports.bfsAll = nativeBinding.bfsAll
|
|
591
|
+
module.exports.bfsAllHistogram = nativeBinding.bfsAllHistogram
|
|
591
592
|
module.exports.bfsBatch = nativeBinding.bfsBatch
|
|
593
|
+
module.exports.bfsBatchHistogram = nativeBinding.bfsBatchHistogram
|
|
592
594
|
module.exports.bfsOne = nativeBinding.bfsOne
|
|
595
|
+
module.exports.bfsOneHistogram = nativeBinding.bfsOneHistogram
|
|
596
|
+
module.exports.bfsPath = nativeBinding.bfsPath
|
package/package.json
CHANGED
|
@@ -1,39 +1,46 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xingwangzhe/bfs-rs",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.5",
|
|
4
4
|
"description": "Rust BFS on compressed adjacency list with Rayon parallelism",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
7
|
-
"
|
|
8
|
-
"license": "MIT",
|
|
7
|
+
"license": "(MIT OR Apache-2.0)",
|
|
9
8
|
"author": "xingwangzhe",
|
|
10
9
|
"repository": {
|
|
11
10
|
"type": "git",
|
|
12
|
-
"url": "git+https://github.com/xingwangzhe/
|
|
13
|
-
"directory": "native/bfs-rs"
|
|
11
|
+
"url": "git+https://github.com/xingwangzhe/bfs-rs.git"
|
|
14
12
|
},
|
|
15
13
|
"keywords": ["bfs", "graph", "rayon", "napi-rs", "rust"],
|
|
16
14
|
"files": [
|
|
17
15
|
"index.d.ts",
|
|
18
16
|
"index.js",
|
|
19
|
-
"bfs-rs
|
|
17
|
+
"bfs-rs.*.node"
|
|
20
18
|
],
|
|
21
19
|
"napi": {
|
|
22
20
|
"binaryName": "bfs-rs",
|
|
23
21
|
"targets": [
|
|
24
|
-
"x86_64-
|
|
22
|
+
"x86_64-apple-darwin",
|
|
23
|
+
"aarch64-apple-darwin",
|
|
24
|
+
"x86_64-pc-windows-msvc",
|
|
25
|
+
"x86_64-unknown-linux-gnu",
|
|
26
|
+
"x86_64-unknown-linux-musl",
|
|
27
|
+
"aarch64-unknown-linux-gnu"
|
|
25
28
|
]
|
|
26
29
|
},
|
|
27
30
|
"engines": {
|
|
28
31
|
"node": ">= 18"
|
|
29
32
|
},
|
|
30
33
|
"scripts": {
|
|
31
|
-
"build": "napi build --platform --release"
|
|
34
|
+
"build": "napi build --platform --release",
|
|
35
|
+
"test": "node --test bfs.test.mjs",
|
|
36
|
+
"lint": "oxlint",
|
|
37
|
+
"artifacts": "napi artifacts"
|
|
32
38
|
},
|
|
33
39
|
"devDependencies": {
|
|
34
40
|
"@napi-rs/cli": "^3.2.0",
|
|
35
41
|
"@oxc-node/core": "^0.1.0",
|
|
36
42
|
"ava": "^8.0.0",
|
|
43
|
+
"oxlint": "^1.72.0",
|
|
37
44
|
"typescript": "^6.0.0"
|
|
38
45
|
}
|
|
39
46
|
}
|