fastyaml-rs 0.1.7 → 0.1.9
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/index.d.ts +15 -9
- package/index.js +460 -290
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -3,12 +3,12 @@
|
|
|
3
3
|
/** Options for YAML serialization. */
|
|
4
4
|
export interface DumpOptions {
|
|
5
5
|
/** If true, sort object keys alphabetically (default: false) */
|
|
6
|
-
sortKeys?: boolean
|
|
6
|
+
sortKeys?: boolean;
|
|
7
7
|
/**
|
|
8
8
|
* Allow unicode characters (default: true).
|
|
9
9
|
* Note: yaml-rust2 always outputs unicode; this is accepted for API compatibility.
|
|
10
10
|
*/
|
|
11
|
-
allowUnicode?: boolean
|
|
11
|
+
allowUnicode?: boolean;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
/**
|
|
@@ -40,7 +40,10 @@ value: 123
|
|
|
40
40
|
'
|
|
41
41
|
* ```
|
|
42
42
|
*/
|
|
43
|
-
export declare function safeDump(
|
|
43
|
+
export declare function safeDump(
|
|
44
|
+
data: unknown,
|
|
45
|
+
options?: DumpOptions | undefined | null
|
|
46
|
+
): NapiResult<string>;
|
|
44
47
|
|
|
45
48
|
/**
|
|
46
49
|
* Serialize multiple JavaScript objects to a YAML string with document separators.
|
|
@@ -79,7 +82,10 @@ b: 2
|
|
|
79
82
|
'
|
|
80
83
|
* ```
|
|
81
84
|
*/
|
|
82
|
-
export declare function safeDumpAll(
|
|
85
|
+
export declare function safeDumpAll(
|
|
86
|
+
documents: Array<unknown>,
|
|
87
|
+
options?: DumpOptions | undefined | null
|
|
88
|
+
): NapiResult<string>;
|
|
83
89
|
|
|
84
90
|
/**
|
|
85
91
|
* Parse a YAML string and return a JavaScript object.
|
|
@@ -114,7 +120,7 @@ value: 123');
|
|
|
114
120
|
* console.log(data); // { name: 'test', value: 123 }
|
|
115
121
|
* ```
|
|
116
122
|
*/
|
|
117
|
-
export declare function safeLoad(yamlStr: string): NapiResult<unknown
|
|
123
|
+
export declare function safeLoad(yamlStr: string): NapiResult<unknown>;
|
|
118
124
|
|
|
119
125
|
/**
|
|
120
126
|
* Parse a YAML string containing multiple documents.
|
|
@@ -151,7 +157,7 @@ bar: 2');
|
|
|
151
157
|
* console.log(docs); // [{ foo: 1 }, { bar: 2 }]
|
|
152
158
|
* ```
|
|
153
159
|
*/
|
|
154
|
-
export declare function safeLoadAll(yamlStr: string): NapiResult<Array<unknown
|
|
160
|
+
export declare function safeLoadAll(yamlStr: string): NapiResult<Array<unknown>>;
|
|
155
161
|
|
|
156
162
|
/**
|
|
157
163
|
* Get the library version.
|
|
@@ -165,8 +171,8 @@ export declare function safeLoadAll(yamlStr: string): NapiResult<Array<unknown>>
|
|
|
165
171
|
* console.log(version()); // "0.1.0"
|
|
166
172
|
* ```
|
|
167
173
|
*/
|
|
168
|
-
export declare function version(): string
|
|
174
|
+
export declare function version(): string;
|
|
169
175
|
|
|
170
176
|
// Aliases for js-yaml compatibility
|
|
171
|
-
export declare const load: typeof safeLoad
|
|
172
|
-
export declare const dump: typeof safeDump
|
|
177
|
+
export declare const load: typeof safeLoad;
|
|
178
|
+
export declare const dump: typeof safeDump;
|
package/index.js
CHANGED
|
@@ -4,553 +4,723 @@
|
|
|
4
4
|
/* auto-generated by NAPI-RS */
|
|
5
5
|
|
|
6
6
|
const { readFileSync } = require('node:fs')
|
|
7
|
-
let nativeBinding = null
|
|
8
|
-
const loadErrors = []
|
|
7
|
+
let nativeBinding = null;
|
|
8
|
+
const loadErrors = [];
|
|
9
9
|
|
|
10
10
|
const isMusl = () => {
|
|
11
|
-
let musl = false
|
|
11
|
+
let musl = false;
|
|
12
12
|
if (process.platform === 'linux') {
|
|
13
|
-
musl = isMuslFromFilesystem()
|
|
13
|
+
musl = isMuslFromFilesystem();
|
|
14
14
|
if (musl === null) {
|
|
15
|
-
musl = isMuslFromReport()
|
|
15
|
+
musl = isMuslFromReport();
|
|
16
16
|
}
|
|
17
17
|
if (musl === null) {
|
|
18
|
-
musl = isMuslFromChildProcess()
|
|
18
|
+
musl = isMuslFromChildProcess();
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
|
-
return musl
|
|
22
|
-
}
|
|
21
|
+
return musl;
|
|
22
|
+
};
|
|
23
23
|
|
|
24
|
-
const isFileMusl = (f) => f.includes('libc.musl-') || f.includes('ld-musl-')
|
|
24
|
+
const isFileMusl = (f) => f.includes('libc.musl-') || f.includes('ld-musl-');
|
|
25
25
|
|
|
26
26
|
const isMuslFromFilesystem = () => {
|
|
27
27
|
try {
|
|
28
|
-
return readFileSync('/usr/bin/ldd', 'utf-8').includes('musl')
|
|
28
|
+
return readFileSync('/usr/bin/ldd', 'utf-8').includes('musl');
|
|
29
29
|
} catch {
|
|
30
|
-
return null
|
|
30
|
+
return null;
|
|
31
31
|
}
|
|
32
|
-
}
|
|
32
|
+
};
|
|
33
33
|
|
|
34
34
|
const isMuslFromReport = () => {
|
|
35
|
-
let report = null
|
|
35
|
+
let report = null;
|
|
36
36
|
if (typeof process.report?.getReport === 'function') {
|
|
37
|
-
process.report.excludeNetwork = true
|
|
38
|
-
report = process.report.getReport()
|
|
37
|
+
process.report.excludeNetwork = true;
|
|
38
|
+
report = process.report.getReport();
|
|
39
39
|
}
|
|
40
40
|
if (!report) {
|
|
41
|
-
return null
|
|
41
|
+
return null;
|
|
42
42
|
}
|
|
43
43
|
if (report.header && report.header.glibcVersionRuntime) {
|
|
44
|
-
return false
|
|
44
|
+
return false;
|
|
45
45
|
}
|
|
46
46
|
if (Array.isArray(report.sharedObjects)) {
|
|
47
47
|
if (report.sharedObjects.some(isFileMusl)) {
|
|
48
|
-
return true
|
|
48
|
+
return true;
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
|
-
return false
|
|
52
|
-
}
|
|
51
|
+
return false;
|
|
52
|
+
};
|
|
53
53
|
|
|
54
54
|
const isMuslFromChildProcess = () => {
|
|
55
55
|
try {
|
|
56
|
-
return require('child_process')
|
|
56
|
+
return require('child_process')
|
|
57
|
+
.execSync('ldd --version', { encoding: 'utf8' })
|
|
58
|
+
.includes('musl');
|
|
57
59
|
} catch (e) {
|
|
58
60
|
// If we reach this case, we don't know if the system is musl or not, so is better to just fallback to false
|
|
59
|
-
return false
|
|
61
|
+
return false;
|
|
60
62
|
}
|
|
61
|
-
}
|
|
63
|
+
};
|
|
62
64
|
|
|
63
65
|
function requireNative() {
|
|
64
66
|
if (process.env.NAPI_RS_NATIVE_LIBRARY_PATH) {
|
|
65
67
|
try {
|
|
66
68
|
return require(process.env.NAPI_RS_NATIVE_LIBRARY_PATH);
|
|
67
69
|
} catch (err) {
|
|
68
|
-
loadErrors.push(err)
|
|
70
|
+
loadErrors.push(err);
|
|
69
71
|
}
|
|
70
72
|
} else if (process.platform === 'android') {
|
|
71
73
|
if (process.arch === 'arm64') {
|
|
72
74
|
try {
|
|
73
|
-
return require('./fastyaml-rs.android-arm64.node')
|
|
75
|
+
return require('./fastyaml-rs.android-arm64.node');
|
|
74
76
|
} catch (e) {
|
|
75
|
-
loadErrors.push(e)
|
|
77
|
+
loadErrors.push(e);
|
|
76
78
|
}
|
|
77
79
|
try {
|
|
78
|
-
const binding = require('fastyaml-rs-android-arm64')
|
|
79
|
-
const bindingPackageVersion = require('fastyaml-rs-android-arm64/package.json').version
|
|
80
|
-
if (
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
80
|
+
const binding = require('fastyaml-rs-android-arm64');
|
|
81
|
+
const bindingPackageVersion = require('fastyaml-rs-android-arm64/package.json').version;
|
|
82
|
+
if (
|
|
83
|
+
bindingPackageVersion !== '0.1.6' &&
|
|
84
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
85
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
|
86
|
+
) {
|
|
87
|
+
throw new Error(
|
|
88
|
+
`Native binding package version mismatch, expected 0.1.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
return binding;
|
|
84
92
|
} catch (e) {
|
|
85
|
-
loadErrors.push(e)
|
|
93
|
+
loadErrors.push(e);
|
|
86
94
|
}
|
|
87
95
|
} else if (process.arch === 'arm') {
|
|
88
96
|
try {
|
|
89
|
-
return require('./fastyaml-rs.android-arm-eabi.node')
|
|
97
|
+
return require('./fastyaml-rs.android-arm-eabi.node');
|
|
90
98
|
} catch (e) {
|
|
91
|
-
loadErrors.push(e)
|
|
99
|
+
loadErrors.push(e);
|
|
92
100
|
}
|
|
93
101
|
try {
|
|
94
|
-
const binding = require('fastyaml-rs-android-arm-eabi')
|
|
95
|
-
const bindingPackageVersion = require('fastyaml-rs-android-arm-eabi/package.json').version
|
|
96
|
-
if (
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
102
|
+
const binding = require('fastyaml-rs-android-arm-eabi');
|
|
103
|
+
const bindingPackageVersion = require('fastyaml-rs-android-arm-eabi/package.json').version;
|
|
104
|
+
if (
|
|
105
|
+
bindingPackageVersion !== '0.1.6' &&
|
|
106
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
107
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
|
108
|
+
) {
|
|
109
|
+
throw new Error(
|
|
110
|
+
`Native binding package version mismatch, expected 0.1.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`
|
|
111
|
+
);
|
|
112
|
+
}
|
|
113
|
+
return binding;
|
|
100
114
|
} catch (e) {
|
|
101
|
-
loadErrors.push(e)
|
|
115
|
+
loadErrors.push(e);
|
|
102
116
|
}
|
|
103
117
|
} else {
|
|
104
|
-
loadErrors.push(new Error(`Unsupported architecture on Android ${process.arch}`))
|
|
118
|
+
loadErrors.push(new Error(`Unsupported architecture on Android ${process.arch}`));
|
|
105
119
|
}
|
|
106
120
|
} else if (process.platform === 'win32') {
|
|
107
121
|
if (process.arch === 'x64') {
|
|
108
|
-
if (
|
|
122
|
+
if (
|
|
123
|
+
process.config?.variables?.shlib_suffix === 'dll.a' ||
|
|
124
|
+
process.config?.variables?.node_target_type === 'shared_library'
|
|
125
|
+
) {
|
|
109
126
|
try {
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
127
|
+
return require('./fastyaml-rs.win32-x64-gnu.node');
|
|
128
|
+
} catch (e) {
|
|
129
|
+
loadErrors.push(e);
|
|
130
|
+
}
|
|
131
|
+
try {
|
|
132
|
+
const binding = require('fastyaml-rs-win32-x64-gnu');
|
|
133
|
+
const bindingPackageVersion = require('fastyaml-rs-win32-x64-gnu/package.json').version;
|
|
134
|
+
if (
|
|
135
|
+
bindingPackageVersion !== '0.1.6' &&
|
|
136
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
137
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
|
138
|
+
) {
|
|
139
|
+
throw new Error(
|
|
140
|
+
`Native binding package version mismatch, expected 0.1.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`
|
|
141
|
+
);
|
|
142
|
+
}
|
|
143
|
+
return binding;
|
|
144
|
+
} catch (e) {
|
|
145
|
+
loadErrors.push(e);
|
|
119
146
|
}
|
|
120
|
-
return binding
|
|
121
|
-
} catch (e) {
|
|
122
|
-
loadErrors.push(e)
|
|
123
|
-
}
|
|
124
147
|
} else {
|
|
125
148
|
try {
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
149
|
+
return require('./fastyaml-rs.win32-x64-msvc.node');
|
|
150
|
+
} catch (e) {
|
|
151
|
+
loadErrors.push(e);
|
|
152
|
+
}
|
|
153
|
+
try {
|
|
154
|
+
const binding = require('fastyaml-rs-win32-x64-msvc');
|
|
155
|
+
const bindingPackageVersion = require('fastyaml-rs-win32-x64-msvc/package.json').version;
|
|
156
|
+
if (
|
|
157
|
+
bindingPackageVersion !== '0.1.6' &&
|
|
158
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
159
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
|
160
|
+
) {
|
|
161
|
+
throw new Error(
|
|
162
|
+
`Native binding package version mismatch, expected 0.1.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`
|
|
163
|
+
);
|
|
164
|
+
}
|
|
165
|
+
return binding;
|
|
166
|
+
} catch (e) {
|
|
167
|
+
loadErrors.push(e);
|
|
135
168
|
}
|
|
136
|
-
return binding
|
|
137
|
-
} catch (e) {
|
|
138
|
-
loadErrors.push(e)
|
|
139
|
-
}
|
|
140
169
|
}
|
|
141
170
|
} else if (process.arch === 'ia32') {
|
|
142
171
|
try {
|
|
143
|
-
return require('./fastyaml-rs.win32-ia32-msvc.node')
|
|
172
|
+
return require('./fastyaml-rs.win32-ia32-msvc.node');
|
|
144
173
|
} catch (e) {
|
|
145
|
-
loadErrors.push(e)
|
|
174
|
+
loadErrors.push(e);
|
|
146
175
|
}
|
|
147
176
|
try {
|
|
148
|
-
const binding = require('fastyaml-rs-win32-ia32-msvc')
|
|
149
|
-
const bindingPackageVersion = require('fastyaml-rs-win32-ia32-msvc/package.json').version
|
|
150
|
-
if (
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
177
|
+
const binding = require('fastyaml-rs-win32-ia32-msvc');
|
|
178
|
+
const bindingPackageVersion = require('fastyaml-rs-win32-ia32-msvc/package.json').version;
|
|
179
|
+
if (
|
|
180
|
+
bindingPackageVersion !== '0.1.6' &&
|
|
181
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
182
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
|
183
|
+
) {
|
|
184
|
+
throw new Error(
|
|
185
|
+
`Native binding package version mismatch, expected 0.1.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`
|
|
186
|
+
);
|
|
187
|
+
}
|
|
188
|
+
return binding;
|
|
154
189
|
} catch (e) {
|
|
155
|
-
loadErrors.push(e)
|
|
190
|
+
loadErrors.push(e);
|
|
156
191
|
}
|
|
157
192
|
} else if (process.arch === 'arm64') {
|
|
158
193
|
try {
|
|
159
|
-
return require('./fastyaml-rs.win32-arm64-msvc.node')
|
|
194
|
+
return require('./fastyaml-rs.win32-arm64-msvc.node');
|
|
160
195
|
} catch (e) {
|
|
161
|
-
loadErrors.push(e)
|
|
196
|
+
loadErrors.push(e);
|
|
162
197
|
}
|
|
163
198
|
try {
|
|
164
|
-
const binding = require('fastyaml-rs-win32-arm64-msvc')
|
|
165
|
-
const bindingPackageVersion = require('fastyaml-rs-win32-arm64-msvc/package.json').version
|
|
166
|
-
if (
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
199
|
+
const binding = require('fastyaml-rs-win32-arm64-msvc');
|
|
200
|
+
const bindingPackageVersion = require('fastyaml-rs-win32-arm64-msvc/package.json').version;
|
|
201
|
+
if (
|
|
202
|
+
bindingPackageVersion !== '0.1.6' &&
|
|
203
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
204
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
|
205
|
+
) {
|
|
206
|
+
throw new Error(
|
|
207
|
+
`Native binding package version mismatch, expected 0.1.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`
|
|
208
|
+
);
|
|
209
|
+
}
|
|
210
|
+
return binding;
|
|
170
211
|
} catch (e) {
|
|
171
|
-
loadErrors.push(e)
|
|
212
|
+
loadErrors.push(e);
|
|
172
213
|
}
|
|
173
214
|
} else {
|
|
174
|
-
loadErrors.push(new Error(`Unsupported architecture on Windows: ${process.arch}`))
|
|
215
|
+
loadErrors.push(new Error(`Unsupported architecture on Windows: ${process.arch}`));
|
|
175
216
|
}
|
|
176
217
|
} else if (process.platform === 'darwin') {
|
|
177
218
|
try {
|
|
178
|
-
return require('./fastyaml-rs.darwin-universal.node')
|
|
219
|
+
return require('./fastyaml-rs.darwin-universal.node');
|
|
179
220
|
} catch (e) {
|
|
180
|
-
loadErrors.push(e)
|
|
221
|
+
loadErrors.push(e);
|
|
181
222
|
}
|
|
182
223
|
try {
|
|
183
|
-
const binding = require('fastyaml-rs-darwin-universal')
|
|
184
|
-
const bindingPackageVersion = require('fastyaml-rs-darwin-universal/package.json').version
|
|
185
|
-
if (
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
224
|
+
const binding = require('fastyaml-rs-darwin-universal');
|
|
225
|
+
const bindingPackageVersion = require('fastyaml-rs-darwin-universal/package.json').version;
|
|
226
|
+
if (
|
|
227
|
+
bindingPackageVersion !== '0.1.6' &&
|
|
228
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
229
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
|
230
|
+
) {
|
|
231
|
+
throw new Error(
|
|
232
|
+
`Native binding package version mismatch, expected 0.1.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`
|
|
233
|
+
);
|
|
234
|
+
}
|
|
235
|
+
return binding;
|
|
189
236
|
} catch (e) {
|
|
190
|
-
loadErrors.push(e)
|
|
237
|
+
loadErrors.push(e);
|
|
191
238
|
}
|
|
192
239
|
if (process.arch === 'x64') {
|
|
193
240
|
try {
|
|
194
|
-
return require('./fastyaml-rs.darwin-x64.node')
|
|
241
|
+
return require('./fastyaml-rs.darwin-x64.node');
|
|
195
242
|
} catch (e) {
|
|
196
|
-
loadErrors.push(e)
|
|
243
|
+
loadErrors.push(e);
|
|
197
244
|
}
|
|
198
245
|
try {
|
|
199
|
-
const binding = require('fastyaml-rs-darwin-x64')
|
|
200
|
-
const bindingPackageVersion = require('fastyaml-rs-darwin-x64/package.json').version
|
|
201
|
-
if (
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
246
|
+
const binding = require('fastyaml-rs-darwin-x64');
|
|
247
|
+
const bindingPackageVersion = require('fastyaml-rs-darwin-x64/package.json').version;
|
|
248
|
+
if (
|
|
249
|
+
bindingPackageVersion !== '0.1.6' &&
|
|
250
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
251
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
|
252
|
+
) {
|
|
253
|
+
throw new Error(
|
|
254
|
+
`Native binding package version mismatch, expected 0.1.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`
|
|
255
|
+
);
|
|
256
|
+
}
|
|
257
|
+
return binding;
|
|
205
258
|
} catch (e) {
|
|
206
|
-
loadErrors.push(e)
|
|
259
|
+
loadErrors.push(e);
|
|
207
260
|
}
|
|
208
261
|
} else if (process.arch === 'arm64') {
|
|
209
262
|
try {
|
|
210
|
-
return require('./fastyaml-rs.darwin-arm64.node')
|
|
263
|
+
return require('./fastyaml-rs.darwin-arm64.node');
|
|
211
264
|
} catch (e) {
|
|
212
|
-
loadErrors.push(e)
|
|
265
|
+
loadErrors.push(e);
|
|
213
266
|
}
|
|
214
267
|
try {
|
|
215
|
-
const binding = require('fastyaml-rs-darwin-arm64')
|
|
216
|
-
const bindingPackageVersion = require('fastyaml-rs-darwin-arm64/package.json').version
|
|
217
|
-
if (
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
268
|
+
const binding = require('fastyaml-rs-darwin-arm64');
|
|
269
|
+
const bindingPackageVersion = require('fastyaml-rs-darwin-arm64/package.json').version;
|
|
270
|
+
if (
|
|
271
|
+
bindingPackageVersion !== '0.1.6' &&
|
|
272
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
273
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
|
274
|
+
) {
|
|
275
|
+
throw new Error(
|
|
276
|
+
`Native binding package version mismatch, expected 0.1.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`
|
|
277
|
+
);
|
|
278
|
+
}
|
|
279
|
+
return binding;
|
|
221
280
|
} catch (e) {
|
|
222
|
-
loadErrors.push(e)
|
|
281
|
+
loadErrors.push(e);
|
|
223
282
|
}
|
|
224
283
|
} else {
|
|
225
|
-
loadErrors.push(new Error(`Unsupported architecture on macOS: ${process.arch}`))
|
|
284
|
+
loadErrors.push(new Error(`Unsupported architecture on macOS: ${process.arch}`));
|
|
226
285
|
}
|
|
227
286
|
} else if (process.platform === 'freebsd') {
|
|
228
287
|
if (process.arch === 'x64') {
|
|
229
288
|
try {
|
|
230
|
-
return require('./fastyaml-rs.freebsd-x64.node')
|
|
289
|
+
return require('./fastyaml-rs.freebsd-x64.node');
|
|
231
290
|
} catch (e) {
|
|
232
|
-
loadErrors.push(e)
|
|
291
|
+
loadErrors.push(e);
|
|
233
292
|
}
|
|
234
293
|
try {
|
|
235
|
-
const binding = require('fastyaml-rs-freebsd-x64')
|
|
236
|
-
const bindingPackageVersion = require('fastyaml-rs-freebsd-x64/package.json').version
|
|
237
|
-
if (
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
294
|
+
const binding = require('fastyaml-rs-freebsd-x64');
|
|
295
|
+
const bindingPackageVersion = require('fastyaml-rs-freebsd-x64/package.json').version;
|
|
296
|
+
if (
|
|
297
|
+
bindingPackageVersion !== '0.1.6' &&
|
|
298
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
299
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
|
300
|
+
) {
|
|
301
|
+
throw new Error(
|
|
302
|
+
`Native binding package version mismatch, expected 0.1.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`
|
|
303
|
+
);
|
|
304
|
+
}
|
|
305
|
+
return binding;
|
|
241
306
|
} catch (e) {
|
|
242
|
-
loadErrors.push(e)
|
|
307
|
+
loadErrors.push(e);
|
|
243
308
|
}
|
|
244
309
|
} else if (process.arch === 'arm64') {
|
|
245
310
|
try {
|
|
246
|
-
return require('./fastyaml-rs.freebsd-arm64.node')
|
|
311
|
+
return require('./fastyaml-rs.freebsd-arm64.node');
|
|
247
312
|
} catch (e) {
|
|
248
|
-
loadErrors.push(e)
|
|
313
|
+
loadErrors.push(e);
|
|
249
314
|
}
|
|
250
315
|
try {
|
|
251
|
-
const binding = require('fastyaml-rs-freebsd-arm64')
|
|
252
|
-
const bindingPackageVersion = require('fastyaml-rs-freebsd-arm64/package.json').version
|
|
253
|
-
if (
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
316
|
+
const binding = require('fastyaml-rs-freebsd-arm64');
|
|
317
|
+
const bindingPackageVersion = require('fastyaml-rs-freebsd-arm64/package.json').version;
|
|
318
|
+
if (
|
|
319
|
+
bindingPackageVersion !== '0.1.6' &&
|
|
320
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
321
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
|
322
|
+
) {
|
|
323
|
+
throw new Error(
|
|
324
|
+
`Native binding package version mismatch, expected 0.1.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`
|
|
325
|
+
);
|
|
326
|
+
}
|
|
327
|
+
return binding;
|
|
257
328
|
} catch (e) {
|
|
258
|
-
loadErrors.push(e)
|
|
329
|
+
loadErrors.push(e);
|
|
259
330
|
}
|
|
260
331
|
} else {
|
|
261
|
-
loadErrors.push(new Error(`Unsupported architecture on FreeBSD: ${process.arch}`))
|
|
332
|
+
loadErrors.push(new Error(`Unsupported architecture on FreeBSD: ${process.arch}`));
|
|
262
333
|
}
|
|
263
334
|
} else if (process.platform === 'linux') {
|
|
264
335
|
if (process.arch === 'x64') {
|
|
265
336
|
if (isMusl()) {
|
|
266
337
|
try {
|
|
267
|
-
return require('./fastyaml-rs.linux-x64-musl.node')
|
|
338
|
+
return require('./fastyaml-rs.linux-x64-musl.node');
|
|
268
339
|
} catch (e) {
|
|
269
|
-
loadErrors.push(e)
|
|
340
|
+
loadErrors.push(e);
|
|
270
341
|
}
|
|
271
342
|
try {
|
|
272
|
-
const binding = require('fastyaml-rs-linux-x64-musl')
|
|
273
|
-
const bindingPackageVersion = require('fastyaml-rs-linux-x64-musl/package.json').version
|
|
274
|
-
if (
|
|
275
|
-
|
|
343
|
+
const binding = require('fastyaml-rs-linux-x64-musl');
|
|
344
|
+
const bindingPackageVersion = require('fastyaml-rs-linux-x64-musl/package.json').version;
|
|
345
|
+
if (
|
|
346
|
+
bindingPackageVersion !== '0.1.6' &&
|
|
347
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
348
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
|
349
|
+
) {
|
|
350
|
+
throw new Error(
|
|
351
|
+
`Native binding package version mismatch, expected 0.1.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`
|
|
352
|
+
);
|
|
276
353
|
}
|
|
277
|
-
return binding
|
|
354
|
+
return binding;
|
|
278
355
|
} catch (e) {
|
|
279
|
-
loadErrors.push(e)
|
|
356
|
+
loadErrors.push(e);
|
|
280
357
|
}
|
|
281
358
|
} else {
|
|
282
359
|
try {
|
|
283
|
-
return require('./fastyaml-rs.linux-x64-gnu.node')
|
|
360
|
+
return require('./fastyaml-rs.linux-x64-gnu.node');
|
|
284
361
|
} catch (e) {
|
|
285
|
-
loadErrors.push(e)
|
|
362
|
+
loadErrors.push(e);
|
|
286
363
|
}
|
|
287
364
|
try {
|
|
288
|
-
const binding = require('fastyaml-rs-linux-x64-gnu')
|
|
289
|
-
const bindingPackageVersion = require('fastyaml-rs-linux-x64-gnu/package.json').version
|
|
290
|
-
if (
|
|
291
|
-
|
|
365
|
+
const binding = require('fastyaml-rs-linux-x64-gnu');
|
|
366
|
+
const bindingPackageVersion = require('fastyaml-rs-linux-x64-gnu/package.json').version;
|
|
367
|
+
if (
|
|
368
|
+
bindingPackageVersion !== '0.1.6' &&
|
|
369
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
370
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
|
371
|
+
) {
|
|
372
|
+
throw new Error(
|
|
373
|
+
`Native binding package version mismatch, expected 0.1.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`
|
|
374
|
+
);
|
|
292
375
|
}
|
|
293
|
-
return binding
|
|
376
|
+
return binding;
|
|
294
377
|
} catch (e) {
|
|
295
|
-
loadErrors.push(e)
|
|
378
|
+
loadErrors.push(e);
|
|
296
379
|
}
|
|
297
380
|
}
|
|
298
381
|
} else if (process.arch === 'arm64') {
|
|
299
382
|
if (isMusl()) {
|
|
300
383
|
try {
|
|
301
|
-
return require('./fastyaml-rs.linux-arm64-musl.node')
|
|
384
|
+
return require('./fastyaml-rs.linux-arm64-musl.node');
|
|
302
385
|
} catch (e) {
|
|
303
|
-
loadErrors.push(e)
|
|
386
|
+
loadErrors.push(e);
|
|
304
387
|
}
|
|
305
388
|
try {
|
|
306
|
-
const binding = require('fastyaml-rs-linux-arm64-musl')
|
|
307
|
-
const bindingPackageVersion =
|
|
308
|
-
|
|
309
|
-
|
|
389
|
+
const binding = require('fastyaml-rs-linux-arm64-musl');
|
|
390
|
+
const bindingPackageVersion =
|
|
391
|
+
require('fastyaml-rs-linux-arm64-musl/package.json').version;
|
|
392
|
+
if (
|
|
393
|
+
bindingPackageVersion !== '0.1.6' &&
|
|
394
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
395
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
|
396
|
+
) {
|
|
397
|
+
throw new Error(
|
|
398
|
+
`Native binding package version mismatch, expected 0.1.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`
|
|
399
|
+
);
|
|
310
400
|
}
|
|
311
|
-
return binding
|
|
401
|
+
return binding;
|
|
312
402
|
} catch (e) {
|
|
313
|
-
loadErrors.push(e)
|
|
403
|
+
loadErrors.push(e);
|
|
314
404
|
}
|
|
315
405
|
} else {
|
|
316
406
|
try {
|
|
317
|
-
return require('./fastyaml-rs.linux-arm64-gnu.node')
|
|
407
|
+
return require('./fastyaml-rs.linux-arm64-gnu.node');
|
|
318
408
|
} catch (e) {
|
|
319
|
-
loadErrors.push(e)
|
|
409
|
+
loadErrors.push(e);
|
|
320
410
|
}
|
|
321
411
|
try {
|
|
322
|
-
const binding = require('fastyaml-rs-linux-arm64-gnu')
|
|
323
|
-
const bindingPackageVersion = require('fastyaml-rs-linux-arm64-gnu/package.json').version
|
|
324
|
-
if (
|
|
325
|
-
|
|
412
|
+
const binding = require('fastyaml-rs-linux-arm64-gnu');
|
|
413
|
+
const bindingPackageVersion = require('fastyaml-rs-linux-arm64-gnu/package.json').version;
|
|
414
|
+
if (
|
|
415
|
+
bindingPackageVersion !== '0.1.6' &&
|
|
416
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
417
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
|
418
|
+
) {
|
|
419
|
+
throw new Error(
|
|
420
|
+
`Native binding package version mismatch, expected 0.1.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`
|
|
421
|
+
);
|
|
326
422
|
}
|
|
327
|
-
return binding
|
|
423
|
+
return binding;
|
|
328
424
|
} catch (e) {
|
|
329
|
-
loadErrors.push(e)
|
|
425
|
+
loadErrors.push(e);
|
|
330
426
|
}
|
|
331
427
|
}
|
|
332
428
|
} else if (process.arch === 'arm') {
|
|
333
429
|
if (isMusl()) {
|
|
334
430
|
try {
|
|
335
|
-
return require('./fastyaml-rs.linux-arm-musleabihf.node')
|
|
431
|
+
return require('./fastyaml-rs.linux-arm-musleabihf.node');
|
|
336
432
|
} catch (e) {
|
|
337
|
-
loadErrors.push(e)
|
|
433
|
+
loadErrors.push(e);
|
|
338
434
|
}
|
|
339
435
|
try {
|
|
340
|
-
const binding = require('fastyaml-rs-linux-arm-musleabihf')
|
|
341
|
-
const bindingPackageVersion =
|
|
342
|
-
|
|
343
|
-
|
|
436
|
+
const binding = require('fastyaml-rs-linux-arm-musleabihf');
|
|
437
|
+
const bindingPackageVersion =
|
|
438
|
+
require('fastyaml-rs-linux-arm-musleabihf/package.json').version;
|
|
439
|
+
if (
|
|
440
|
+
bindingPackageVersion !== '0.1.6' &&
|
|
441
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
442
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
|
443
|
+
) {
|
|
444
|
+
throw new Error(
|
|
445
|
+
`Native binding package version mismatch, expected 0.1.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`
|
|
446
|
+
);
|
|
344
447
|
}
|
|
345
|
-
return binding
|
|
448
|
+
return binding;
|
|
346
449
|
} catch (e) {
|
|
347
|
-
loadErrors.push(e)
|
|
450
|
+
loadErrors.push(e);
|
|
348
451
|
}
|
|
349
452
|
} else {
|
|
350
453
|
try {
|
|
351
|
-
return require('./fastyaml-rs.linux-arm-gnueabihf.node')
|
|
454
|
+
return require('./fastyaml-rs.linux-arm-gnueabihf.node');
|
|
352
455
|
} catch (e) {
|
|
353
|
-
loadErrors.push(e)
|
|
456
|
+
loadErrors.push(e);
|
|
354
457
|
}
|
|
355
458
|
try {
|
|
356
|
-
const binding = require('fastyaml-rs-linux-arm-gnueabihf')
|
|
357
|
-
const bindingPackageVersion =
|
|
358
|
-
|
|
359
|
-
|
|
459
|
+
const binding = require('fastyaml-rs-linux-arm-gnueabihf');
|
|
460
|
+
const bindingPackageVersion =
|
|
461
|
+
require('fastyaml-rs-linux-arm-gnueabihf/package.json').version;
|
|
462
|
+
if (
|
|
463
|
+
bindingPackageVersion !== '0.1.6' &&
|
|
464
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
465
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
|
466
|
+
) {
|
|
467
|
+
throw new Error(
|
|
468
|
+
`Native binding package version mismatch, expected 0.1.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`
|
|
469
|
+
);
|
|
360
470
|
}
|
|
361
|
-
return binding
|
|
471
|
+
return binding;
|
|
362
472
|
} catch (e) {
|
|
363
|
-
loadErrors.push(e)
|
|
473
|
+
loadErrors.push(e);
|
|
364
474
|
}
|
|
365
475
|
}
|
|
366
476
|
} else if (process.arch === 'loong64') {
|
|
367
477
|
if (isMusl()) {
|
|
368
478
|
try {
|
|
369
|
-
return require('./fastyaml-rs.linux-loong64-musl.node')
|
|
479
|
+
return require('./fastyaml-rs.linux-loong64-musl.node');
|
|
370
480
|
} catch (e) {
|
|
371
|
-
loadErrors.push(e)
|
|
481
|
+
loadErrors.push(e);
|
|
372
482
|
}
|
|
373
483
|
try {
|
|
374
|
-
const binding = require('fastyaml-rs-linux-loong64-musl')
|
|
375
|
-
const bindingPackageVersion =
|
|
376
|
-
|
|
377
|
-
|
|
484
|
+
const binding = require('fastyaml-rs-linux-loong64-musl');
|
|
485
|
+
const bindingPackageVersion =
|
|
486
|
+
require('fastyaml-rs-linux-loong64-musl/package.json').version;
|
|
487
|
+
if (
|
|
488
|
+
bindingPackageVersion !== '0.1.6' &&
|
|
489
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
490
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
|
491
|
+
) {
|
|
492
|
+
throw new Error(
|
|
493
|
+
`Native binding package version mismatch, expected 0.1.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`
|
|
494
|
+
);
|
|
378
495
|
}
|
|
379
|
-
return binding
|
|
496
|
+
return binding;
|
|
380
497
|
} catch (e) {
|
|
381
|
-
loadErrors.push(e)
|
|
498
|
+
loadErrors.push(e);
|
|
382
499
|
}
|
|
383
500
|
} else {
|
|
384
501
|
try {
|
|
385
|
-
return require('./fastyaml-rs.linux-loong64-gnu.node')
|
|
502
|
+
return require('./fastyaml-rs.linux-loong64-gnu.node');
|
|
386
503
|
} catch (e) {
|
|
387
|
-
loadErrors.push(e)
|
|
504
|
+
loadErrors.push(e);
|
|
388
505
|
}
|
|
389
506
|
try {
|
|
390
|
-
const binding = require('fastyaml-rs-linux-loong64-gnu')
|
|
391
|
-
const bindingPackageVersion =
|
|
392
|
-
|
|
393
|
-
|
|
507
|
+
const binding = require('fastyaml-rs-linux-loong64-gnu');
|
|
508
|
+
const bindingPackageVersion =
|
|
509
|
+
require('fastyaml-rs-linux-loong64-gnu/package.json').version;
|
|
510
|
+
if (
|
|
511
|
+
bindingPackageVersion !== '0.1.6' &&
|
|
512
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
513
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
|
514
|
+
) {
|
|
515
|
+
throw new Error(
|
|
516
|
+
`Native binding package version mismatch, expected 0.1.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`
|
|
517
|
+
);
|
|
394
518
|
}
|
|
395
|
-
return binding
|
|
519
|
+
return binding;
|
|
396
520
|
} catch (e) {
|
|
397
|
-
loadErrors.push(e)
|
|
521
|
+
loadErrors.push(e);
|
|
398
522
|
}
|
|
399
523
|
}
|
|
400
524
|
} else if (process.arch === 'riscv64') {
|
|
401
525
|
if (isMusl()) {
|
|
402
526
|
try {
|
|
403
|
-
return require('./fastyaml-rs.linux-riscv64-musl.node')
|
|
527
|
+
return require('./fastyaml-rs.linux-riscv64-musl.node');
|
|
404
528
|
} catch (e) {
|
|
405
|
-
loadErrors.push(e)
|
|
529
|
+
loadErrors.push(e);
|
|
406
530
|
}
|
|
407
531
|
try {
|
|
408
|
-
const binding = require('fastyaml-rs-linux-riscv64-musl')
|
|
409
|
-
const bindingPackageVersion =
|
|
410
|
-
|
|
411
|
-
|
|
532
|
+
const binding = require('fastyaml-rs-linux-riscv64-musl');
|
|
533
|
+
const bindingPackageVersion =
|
|
534
|
+
require('fastyaml-rs-linux-riscv64-musl/package.json').version;
|
|
535
|
+
if (
|
|
536
|
+
bindingPackageVersion !== '0.1.6' &&
|
|
537
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
538
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
|
539
|
+
) {
|
|
540
|
+
throw new Error(
|
|
541
|
+
`Native binding package version mismatch, expected 0.1.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`
|
|
542
|
+
);
|
|
412
543
|
}
|
|
413
|
-
return binding
|
|
544
|
+
return binding;
|
|
414
545
|
} catch (e) {
|
|
415
|
-
loadErrors.push(e)
|
|
546
|
+
loadErrors.push(e);
|
|
416
547
|
}
|
|
417
548
|
} else {
|
|
418
549
|
try {
|
|
419
|
-
return require('./fastyaml-rs.linux-riscv64-gnu.node')
|
|
550
|
+
return require('./fastyaml-rs.linux-riscv64-gnu.node');
|
|
420
551
|
} catch (e) {
|
|
421
|
-
loadErrors.push(e)
|
|
552
|
+
loadErrors.push(e);
|
|
422
553
|
}
|
|
423
554
|
try {
|
|
424
|
-
const binding = require('fastyaml-rs-linux-riscv64-gnu')
|
|
425
|
-
const bindingPackageVersion =
|
|
426
|
-
|
|
427
|
-
|
|
555
|
+
const binding = require('fastyaml-rs-linux-riscv64-gnu');
|
|
556
|
+
const bindingPackageVersion =
|
|
557
|
+
require('fastyaml-rs-linux-riscv64-gnu/package.json').version;
|
|
558
|
+
if (
|
|
559
|
+
bindingPackageVersion !== '0.1.6' &&
|
|
560
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
561
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
|
562
|
+
) {
|
|
563
|
+
throw new Error(
|
|
564
|
+
`Native binding package version mismatch, expected 0.1.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`
|
|
565
|
+
);
|
|
428
566
|
}
|
|
429
|
-
return binding
|
|
567
|
+
return binding;
|
|
430
568
|
} catch (e) {
|
|
431
|
-
loadErrors.push(e)
|
|
569
|
+
loadErrors.push(e);
|
|
432
570
|
}
|
|
433
571
|
}
|
|
434
572
|
} else if (process.arch === 'ppc64') {
|
|
435
573
|
try {
|
|
436
|
-
return require('./fastyaml-rs.linux-ppc64-gnu.node')
|
|
574
|
+
return require('./fastyaml-rs.linux-ppc64-gnu.node');
|
|
437
575
|
} catch (e) {
|
|
438
|
-
loadErrors.push(e)
|
|
576
|
+
loadErrors.push(e);
|
|
439
577
|
}
|
|
440
578
|
try {
|
|
441
|
-
const binding = require('fastyaml-rs-linux-ppc64-gnu')
|
|
442
|
-
const bindingPackageVersion = require('fastyaml-rs-linux-ppc64-gnu/package.json').version
|
|
443
|
-
if (
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
579
|
+
const binding = require('fastyaml-rs-linux-ppc64-gnu');
|
|
580
|
+
const bindingPackageVersion = require('fastyaml-rs-linux-ppc64-gnu/package.json').version;
|
|
581
|
+
if (
|
|
582
|
+
bindingPackageVersion !== '0.1.6' &&
|
|
583
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
584
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
|
585
|
+
) {
|
|
586
|
+
throw new Error(
|
|
587
|
+
`Native binding package version mismatch, expected 0.1.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`
|
|
588
|
+
);
|
|
589
|
+
}
|
|
590
|
+
return binding;
|
|
447
591
|
} catch (e) {
|
|
448
|
-
loadErrors.push(e)
|
|
592
|
+
loadErrors.push(e);
|
|
449
593
|
}
|
|
450
594
|
} else if (process.arch === 's390x') {
|
|
451
595
|
try {
|
|
452
|
-
return require('./fastyaml-rs.linux-s390x-gnu.node')
|
|
596
|
+
return require('./fastyaml-rs.linux-s390x-gnu.node');
|
|
453
597
|
} catch (e) {
|
|
454
|
-
loadErrors.push(e)
|
|
598
|
+
loadErrors.push(e);
|
|
455
599
|
}
|
|
456
600
|
try {
|
|
457
|
-
const binding = require('fastyaml-rs-linux-s390x-gnu')
|
|
458
|
-
const bindingPackageVersion = require('fastyaml-rs-linux-s390x-gnu/package.json').version
|
|
459
|
-
if (
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
601
|
+
const binding = require('fastyaml-rs-linux-s390x-gnu');
|
|
602
|
+
const bindingPackageVersion = require('fastyaml-rs-linux-s390x-gnu/package.json').version;
|
|
603
|
+
if (
|
|
604
|
+
bindingPackageVersion !== '0.1.6' &&
|
|
605
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
606
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
|
607
|
+
) {
|
|
608
|
+
throw new Error(
|
|
609
|
+
`Native binding package version mismatch, expected 0.1.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`
|
|
610
|
+
);
|
|
611
|
+
}
|
|
612
|
+
return binding;
|
|
463
613
|
} catch (e) {
|
|
464
|
-
loadErrors.push(e)
|
|
614
|
+
loadErrors.push(e);
|
|
465
615
|
}
|
|
466
616
|
} else {
|
|
467
|
-
loadErrors.push(new Error(`Unsupported architecture on Linux: ${process.arch}`))
|
|
617
|
+
loadErrors.push(new Error(`Unsupported architecture on Linux: ${process.arch}`));
|
|
468
618
|
}
|
|
469
619
|
} else if (process.platform === 'openharmony') {
|
|
470
620
|
if (process.arch === 'arm64') {
|
|
471
621
|
try {
|
|
472
|
-
return require('./fastyaml-rs.openharmony-arm64.node')
|
|
622
|
+
return require('./fastyaml-rs.openharmony-arm64.node');
|
|
473
623
|
} catch (e) {
|
|
474
|
-
loadErrors.push(e)
|
|
624
|
+
loadErrors.push(e);
|
|
475
625
|
}
|
|
476
626
|
try {
|
|
477
|
-
const binding = require('fastyaml-rs-openharmony-arm64')
|
|
478
|
-
const bindingPackageVersion = require('fastyaml-rs-openharmony-arm64/package.json').version
|
|
479
|
-
if (
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
627
|
+
const binding = require('fastyaml-rs-openharmony-arm64');
|
|
628
|
+
const bindingPackageVersion = require('fastyaml-rs-openharmony-arm64/package.json').version;
|
|
629
|
+
if (
|
|
630
|
+
bindingPackageVersion !== '0.1.6' &&
|
|
631
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
632
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
|
633
|
+
) {
|
|
634
|
+
throw new Error(
|
|
635
|
+
`Native binding package version mismatch, expected 0.1.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`
|
|
636
|
+
);
|
|
637
|
+
}
|
|
638
|
+
return binding;
|
|
483
639
|
} catch (e) {
|
|
484
|
-
loadErrors.push(e)
|
|
640
|
+
loadErrors.push(e);
|
|
485
641
|
}
|
|
486
642
|
} else if (process.arch === 'x64') {
|
|
487
643
|
try {
|
|
488
|
-
return require('./fastyaml-rs.openharmony-x64.node')
|
|
644
|
+
return require('./fastyaml-rs.openharmony-x64.node');
|
|
489
645
|
} catch (e) {
|
|
490
|
-
loadErrors.push(e)
|
|
646
|
+
loadErrors.push(e);
|
|
491
647
|
}
|
|
492
648
|
try {
|
|
493
|
-
const binding = require('fastyaml-rs-openharmony-x64')
|
|
494
|
-
const bindingPackageVersion = require('fastyaml-rs-openharmony-x64/package.json').version
|
|
495
|
-
if (
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
649
|
+
const binding = require('fastyaml-rs-openharmony-x64');
|
|
650
|
+
const bindingPackageVersion = require('fastyaml-rs-openharmony-x64/package.json').version;
|
|
651
|
+
if (
|
|
652
|
+
bindingPackageVersion !== '0.1.6' &&
|
|
653
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
654
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
|
655
|
+
) {
|
|
656
|
+
throw new Error(
|
|
657
|
+
`Native binding package version mismatch, expected 0.1.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`
|
|
658
|
+
);
|
|
659
|
+
}
|
|
660
|
+
return binding;
|
|
499
661
|
} catch (e) {
|
|
500
|
-
loadErrors.push(e)
|
|
662
|
+
loadErrors.push(e);
|
|
501
663
|
}
|
|
502
664
|
} else if (process.arch === 'arm') {
|
|
503
665
|
try {
|
|
504
|
-
return require('./fastyaml-rs.openharmony-arm.node')
|
|
666
|
+
return require('./fastyaml-rs.openharmony-arm.node');
|
|
505
667
|
} catch (e) {
|
|
506
|
-
loadErrors.push(e)
|
|
668
|
+
loadErrors.push(e);
|
|
507
669
|
}
|
|
508
670
|
try {
|
|
509
|
-
const binding = require('fastyaml-rs-openharmony-arm')
|
|
510
|
-
const bindingPackageVersion = require('fastyaml-rs-openharmony-arm/package.json').version
|
|
511
|
-
if (
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
671
|
+
const binding = require('fastyaml-rs-openharmony-arm');
|
|
672
|
+
const bindingPackageVersion = require('fastyaml-rs-openharmony-arm/package.json').version;
|
|
673
|
+
if (
|
|
674
|
+
bindingPackageVersion !== '0.1.6' &&
|
|
675
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
676
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
|
677
|
+
) {
|
|
678
|
+
throw new Error(
|
|
679
|
+
`Native binding package version mismatch, expected 0.1.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`
|
|
680
|
+
);
|
|
681
|
+
}
|
|
682
|
+
return binding;
|
|
515
683
|
} catch (e) {
|
|
516
|
-
loadErrors.push(e)
|
|
684
|
+
loadErrors.push(e);
|
|
517
685
|
}
|
|
518
686
|
} else {
|
|
519
|
-
loadErrors.push(new Error(`Unsupported architecture on OpenHarmony: ${process.arch}`))
|
|
687
|
+
loadErrors.push(new Error(`Unsupported architecture on OpenHarmony: ${process.arch}`));
|
|
520
688
|
}
|
|
521
689
|
} else {
|
|
522
|
-
loadErrors.push(
|
|
690
|
+
loadErrors.push(
|
|
691
|
+
new Error(`Unsupported OS: ${process.platform}, architecture: ${process.arch}`)
|
|
692
|
+
);
|
|
523
693
|
}
|
|
524
694
|
}
|
|
525
695
|
|
|
526
|
-
nativeBinding = requireNative()
|
|
696
|
+
nativeBinding = requireNative();
|
|
527
697
|
|
|
528
698
|
if (!nativeBinding || process.env.NAPI_RS_FORCE_WASI) {
|
|
529
|
-
let wasiBinding = null
|
|
530
|
-
let wasiBindingError = null
|
|
699
|
+
let wasiBinding = null;
|
|
700
|
+
let wasiBindingError = null;
|
|
531
701
|
try {
|
|
532
|
-
wasiBinding = require('./fastyaml-rs.wasi.cjs')
|
|
533
|
-
nativeBinding = wasiBinding
|
|
702
|
+
wasiBinding = require('./fastyaml-rs.wasi.cjs');
|
|
703
|
+
nativeBinding = wasiBinding;
|
|
534
704
|
} catch (err) {
|
|
535
705
|
if (process.env.NAPI_RS_FORCE_WASI) {
|
|
536
|
-
wasiBindingError = err
|
|
706
|
+
wasiBindingError = err;
|
|
537
707
|
}
|
|
538
708
|
}
|
|
539
709
|
if (!nativeBinding) {
|
|
540
710
|
try {
|
|
541
|
-
wasiBinding = require('fastyaml-rs-wasm32-wasi')
|
|
542
|
-
nativeBinding = wasiBinding
|
|
711
|
+
wasiBinding = require('fastyaml-rs-wasm32-wasi');
|
|
712
|
+
nativeBinding = wasiBinding;
|
|
543
713
|
} catch (err) {
|
|
544
714
|
if (process.env.NAPI_RS_FORCE_WASI) {
|
|
545
|
-
wasiBindingError.cause = err
|
|
546
|
-
loadErrors.push(err)
|
|
715
|
+
wasiBindingError.cause = err;
|
|
716
|
+
loadErrors.push(err);
|
|
547
717
|
}
|
|
548
718
|
}
|
|
549
719
|
}
|
|
550
720
|
if (process.env.NAPI_RS_FORCE_WASI === 'error' && !wasiBinding) {
|
|
551
|
-
const error = new Error('WASI binding not found and NAPI_RS_FORCE_WASI is set to error')
|
|
552
|
-
error.cause = wasiBindingError
|
|
553
|
-
throw error
|
|
721
|
+
const error = new Error('WASI binding not found and NAPI_RS_FORCE_WASI is set to error');
|
|
722
|
+
error.cause = wasiBindingError;
|
|
723
|
+
throw error;
|
|
554
724
|
}
|
|
555
725
|
}
|
|
556
726
|
|
|
@@ -562,22 +732,22 @@ if (!nativeBinding) {
|
|
|
562
732
|
'Please try `npm i` again after removing both package-lock.json and node_modules directory.',
|
|
563
733
|
{
|
|
564
734
|
cause: loadErrors.reduce((err, cur) => {
|
|
565
|
-
cur.cause = err
|
|
566
|
-
return cur
|
|
735
|
+
cur.cause = err;
|
|
736
|
+
return cur;
|
|
567
737
|
}),
|
|
568
|
-
}
|
|
569
|
-
)
|
|
738
|
+
}
|
|
739
|
+
);
|
|
570
740
|
}
|
|
571
|
-
throw new Error(`Failed to load native binding`)
|
|
741
|
+
throw new Error(`Failed to load native binding`);
|
|
572
742
|
}
|
|
573
743
|
|
|
574
|
-
module.exports = nativeBinding
|
|
575
|
-
module.exports.safeDump = nativeBinding.safeDump
|
|
576
|
-
module.exports.safeDumpAll = nativeBinding.safeDumpAll
|
|
577
|
-
module.exports.safeLoad = nativeBinding.safeLoad
|
|
578
|
-
module.exports.safeLoadAll = nativeBinding.safeLoadAll
|
|
579
|
-
module.exports.version = nativeBinding.version
|
|
744
|
+
module.exports = nativeBinding;
|
|
745
|
+
module.exports.safeDump = nativeBinding.safeDump;
|
|
746
|
+
module.exports.safeDumpAll = nativeBinding.safeDumpAll;
|
|
747
|
+
module.exports.safeLoad = nativeBinding.safeLoad;
|
|
748
|
+
module.exports.safeLoadAll = nativeBinding.safeLoadAll;
|
|
749
|
+
module.exports.version = nativeBinding.version;
|
|
580
750
|
|
|
581
751
|
// Aliases for js-yaml compatibility
|
|
582
|
-
module.exports.load = nativeBinding.safeLoad
|
|
583
|
-
module.exports.dump = nativeBinding.safeDump
|
|
752
|
+
module.exports.load = nativeBinding.safeLoad;
|
|
753
|
+
module.exports.dump = nativeBinding.safeDump;
|