fastyaml-rs 0.3.0 → 0.3.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 (4) hide show
  1. package/README.md +6 -3
  2. package/index.d.ts +22 -34
  3. package/index.js +292 -462
  4. package/package.json +6 -5
package/README.md CHANGED
@@ -33,7 +33,7 @@ import { safeLoad, safeDump } from 'fastyaml-rs';
33
33
  // Parse YAML
34
34
  const data = safeLoad(`
35
35
  name: fast-yaml
36
- version: 0.3.0
36
+ version: 0.3.1
37
37
  features:
38
38
  - fast
39
39
  - safe
@@ -41,7 +41,7 @@ features:
41
41
  `);
42
42
 
43
43
  console.log(data);
44
- // { name: 'fast-yaml', version: '0.1.0', features: ['fast', 'safe', 'yaml-1.2.2'] }
44
+ // { name: 'fast-yaml', version: '0.3.1', features: ['fast', 'safe', 'yaml-1.2.2'] }
45
45
 
46
46
  // Serialize to YAML
47
47
  const yamlStr = safeDump(data);
@@ -245,7 +245,9 @@ npm run bench
245
245
  | `npm run build:debug` | Build debug native module |
246
246
  | `npm test` | Run test suite |
247
247
  | `npm run bench` | Run benchmarks |
248
- | `npm run format` | Format code with Prettier |
248
+ | `npm run format` | Format code with Biome |
249
+ | `npm run lint` | Lint code with Biome |
250
+ | `npm run check` | Format and lint with Biome |
249
251
  | `npm run typecheck` | Run TypeScript type checking |
250
252
 
251
253
  ## Technology Stack
@@ -253,6 +255,7 @@ npm run bench
253
255
  - **YAML Parser**: [saphyr](https://github.com/saphyr-rs/saphyr) — Rust YAML 1.2.2 parser
254
256
  - **Node.js Bindings**: [NAPI-RS](https://napi.rs/) — Zero-cost Node.js bindings
255
257
  - **Test Framework**: [Vitest](https://vitest.dev/) — Fast test runner
258
+ - **Linter/Formatter**: [Biome](https://biomejs.dev/) — Fast all-in-one toolchain
256
259
 
257
260
  ## Related Packages
258
261
 
package/index.d.ts CHANGED
@@ -19,11 +19,11 @@
19
19
  */
20
20
  export declare class Mark {
21
21
  /** The name of the source (e.g., filename or '<input>'). */
22
- readonly name: string;
22
+ readonly name: string
23
23
  /** The line number (0-indexed). */
24
- readonly line: number;
24
+ readonly line: number
25
25
  /** The column number (0-indexed). */
26
- readonly column: number;
26
+ readonly column: number
27
27
  /**
28
28
  * Create a new Mark instance.
29
29
  *
@@ -33,43 +33,43 @@ export declare class Mark {
33
33
  * * `line` - The line number (0-indexed)
34
34
  * * `column` - The column number (0-indexed)
35
35
  */
36
- constructor(name: string, line: number, column: number);
36
+ constructor(name: string, line: number, column: number)
37
37
  /**
38
38
  * Get a string representation of the mark.
39
39
  *
40
40
  * Returns format: "name:line:column"
41
41
  */
42
- toString(): string;
42
+ toString(): string
43
43
  }
44
44
 
45
45
  /** Options for YAML serialization. */
46
46
  export interface DumpOptions {
47
47
  /** If true, sort object keys alphabetically (default: false) */
48
- sortKeys?: boolean;
48
+ sortKeys?: boolean
49
49
  /**
50
50
  * Allow unicode characters (default: true).
51
51
  * Note: yaml-rust2 always outputs unicode; this is accepted for API compatibility.
52
52
  */
53
- allowUnicode?: boolean;
53
+ allowUnicode?: boolean
54
54
  /**
55
55
  * Indentation width in spaces (default: 2).
56
56
  * Valid range: 1-9 (values outside this range will be clamped).
57
57
  */
58
- indent?: number;
58
+ indent?: number
59
59
  /**
60
60
  * Maximum line width for wrapping (default: 80).
61
61
  * Valid range: 20-1000 (values outside this range will be clamped).
62
62
  */
63
- width?: number;
63
+ width?: number
64
64
  /**
65
65
  * Default flow style for collections (default: null).
66
66
  * - null: Use block style (multi-line)
67
67
  * - true: Force flow style (inline: [...], {...})
68
68
  * - false: Force block style (explicit)
69
69
  */
70
- defaultFlowStyle?: boolean;
70
+ defaultFlowStyle?: boolean
71
71
  /** Add explicit document start marker `---` (default: false). */
72
- explicitStart?: boolean;
72
+ explicitStart?: boolean
73
73
  }
74
74
 
75
75
  /**
@@ -102,10 +102,7 @@ export interface DumpOptions {
102
102
  * console.log(data); // { name: 'test' }
103
103
  * ```
104
104
  */
105
- export declare function load(
106
- yamlStr: string,
107
- options?: LoadOptions | undefined | null
108
- ): NapiResult<unknown>;
105
+ export declare function load(yamlStr: string, options?: LoadOptions | undefined | null): NapiResult<unknown>
109
106
 
110
107
  /**
111
108
  * Parse a YAML string containing multiple documents with options (js-yaml compatible).
@@ -140,10 +137,7 @@ bar: 2', { schema: 'SafeSchema' });
140
137
  * console.log(docs); // [{ foo: 1 }, { bar: 2 }]
141
138
  * ```
142
139
  */
143
- export declare function loadAll(
144
- yamlStr: string,
145
- options?: LoadOptions | undefined | null
146
- ): NapiResult<Array<unknown>>;
140
+ export declare function loadAll(yamlStr: string, options?: LoadOptions | undefined | null): NapiResult<Array<unknown>>
147
141
 
148
142
  /** Options for YAML parsing (js-yaml compatible). */
149
143
  export interface LoadOptions {
@@ -151,14 +145,14 @@ export interface LoadOptions {
151
145
  * YAML schema to use for parsing (default: `SafeSchema`).
152
146
  * Currently all schemas behave as `SafeSchema` (safe by default).
153
147
  */
154
- schema?: Schema;
148
+ schema?: Schema
155
149
  /** Filename or source name for error messages (default: `<input>`). */
156
- filename?: string;
150
+ filename?: string
157
151
  /**
158
152
  * Allow duplicate keys in mappings (default: true).
159
153
  * Note: fast-yaml always allows duplicates; this is for API compatibility.
160
154
  */
161
- allowDuplicateKeys?: boolean;
155
+ allowDuplicateKeys?: boolean
162
156
  }
163
157
 
164
158
  /**
@@ -190,10 +184,7 @@ value: 123
190
184
  '
191
185
  * ```
192
186
  */
193
- export declare function safeDump(
194
- data: unknown,
195
- options?: DumpOptions | undefined | null
196
- ): NapiResult<string>;
187
+ export declare function safeDump(data: unknown, options?: DumpOptions | undefined | null): NapiResult<string>
197
188
 
198
189
  /**
199
190
  * Serialize multiple JavaScript objects to a YAML string with document separators.
@@ -232,10 +223,7 @@ b: 2
232
223
  '
233
224
  * ```
234
225
  */
235
- export declare function safeDumpAll(
236
- documents: Array<unknown>,
237
- options?: DumpOptions | undefined | null
238
- ): NapiResult<string>;
226
+ export declare function safeDumpAll(documents: Array<unknown>, options?: DumpOptions | undefined | null): NapiResult<string>
239
227
 
240
228
  /**
241
229
  * Parse a YAML string and return a JavaScript object.
@@ -270,7 +258,7 @@ value: 123');
270
258
  * console.log(data); // { name: 'test', value: 123 }
271
259
  * ```
272
260
  */
273
- export declare function safeLoad(yamlStr: string): NapiResult<unknown>;
261
+ export declare function safeLoad(yamlStr: string): NapiResult<unknown>
274
262
 
275
263
  /**
276
264
  * Parse a YAML string containing multiple documents.
@@ -307,7 +295,7 @@ bar: 2');
307
295
  * console.log(docs); // [{ foo: 1 }, { bar: 2 }]
308
296
  * ```
309
297
  */
310
- export declare function safeLoadAll(yamlStr: string): NapiResult<Array<unknown>>;
298
+ export declare function safeLoadAll(yamlStr: string): NapiResult<Array<unknown>>
311
299
 
312
300
  /**
313
301
  * YAML schema types for parsing behavior (js-yaml compatible).
@@ -326,7 +314,7 @@ export declare const enum Schema {
326
314
  /** Core schema - YAML 1.2.2 Core Schema. */
327
315
  CoreSchema = 'CoreSchema',
328
316
  /** Failsafe schema - minimal safe subset. */
329
- FailsafeSchema = 'FailsafeSchema',
317
+ FailsafeSchema = 'FailsafeSchema'
330
318
  }
331
319
 
332
320
  /**
@@ -341,4 +329,4 @@ export declare const enum Schema {
341
329
  * console.log(version()); // "0.1.0"
342
330
  * ```
343
331
  */
344
- export declare function version(): string;
332
+ export declare function version(): string
package/index.js CHANGED
@@ -4,723 +4,553 @@
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')
57
- .execSync('ldd --version', { encoding: 'utf8' })
58
- .includes('musl');
56
+ return require('child_process').execSync('ldd --version', { encoding: 'utf8' }).includes('musl')
59
57
  } catch (e) {
60
58
  // If we reach this case, we don't know if the system is musl or not, so is better to just fallback to false
61
- return false;
59
+ return false
62
60
  }
63
- };
61
+ }
64
62
 
65
63
  function requireNative() {
66
64
  if (process.env.NAPI_RS_NATIVE_LIBRARY_PATH) {
67
65
  try {
68
66
  return require(process.env.NAPI_RS_NATIVE_LIBRARY_PATH);
69
67
  } catch (err) {
70
- loadErrors.push(err);
68
+ loadErrors.push(err)
71
69
  }
72
70
  } else if (process.platform === 'android') {
73
71
  if (process.arch === 'arm64') {
74
72
  try {
75
- return require('./fastyaml-rs.android-arm64.node');
73
+ return require('./fastyaml-rs.android-arm64.node')
76
74
  } catch (e) {
77
- loadErrors.push(e);
75
+ loadErrors.push(e)
78
76
  }
79
77
  try {
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.9' &&
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.9 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`
89
- );
90
- }
91
- return binding;
78
+ const binding = require('fastyaml-rs-android-arm64')
79
+ const bindingPackageVersion = require('fastyaml-rs-android-arm64/package.json').version
80
+ if (bindingPackageVersion !== '0.3.0' && 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.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
82
+ }
83
+ return binding
92
84
  } catch (e) {
93
- loadErrors.push(e);
85
+ loadErrors.push(e)
94
86
  }
95
87
  } else if (process.arch === 'arm') {
96
88
  try {
97
- return require('./fastyaml-rs.android-arm-eabi.node');
89
+ return require('./fastyaml-rs.android-arm-eabi.node')
98
90
  } catch (e) {
99
- loadErrors.push(e);
91
+ loadErrors.push(e)
100
92
  }
101
93
  try {
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.9' &&
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.9 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`
111
- );
112
- }
113
- return binding;
94
+ const binding = require('fastyaml-rs-android-arm-eabi')
95
+ const bindingPackageVersion = require('fastyaml-rs-android-arm-eabi/package.json').version
96
+ if (bindingPackageVersion !== '0.3.0' && 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.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
98
+ }
99
+ return binding
114
100
  } catch (e) {
115
- loadErrors.push(e);
101
+ loadErrors.push(e)
116
102
  }
117
103
  } else {
118
- loadErrors.push(new Error(`Unsupported architecture on Android ${process.arch}`));
104
+ loadErrors.push(new Error(`Unsupported architecture on Android ${process.arch}`))
119
105
  }
120
106
  } else if (process.platform === 'win32') {
121
107
  if (process.arch === 'x64') {
122
- if (
123
- process.config?.variables?.shlib_suffix === 'dll.a' ||
124
- process.config?.variables?.node_target_type === 'shared_library'
125
- ) {
108
+ if (process.config?.variables?.shlib_suffix === 'dll.a' || process.config?.variables?.node_target_type === 'shared_library') {
126
109
  try {
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.9' &&
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.9 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`
141
- );
142
- }
143
- return binding;
144
- } catch (e) {
145
- loadErrors.push(e);
110
+ return require('./fastyaml-rs.win32-x64-gnu.node')
111
+ } catch (e) {
112
+ loadErrors.push(e)
113
+ }
114
+ try {
115
+ const binding = require('fastyaml-rs-win32-x64-gnu')
116
+ const bindingPackageVersion = require('fastyaml-rs-win32-x64-gnu/package.json').version
117
+ if (bindingPackageVersion !== '0.3.0' && 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.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
146
119
  }
120
+ return binding
121
+ } catch (e) {
122
+ loadErrors.push(e)
123
+ }
147
124
  } else {
148
125
  try {
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.9' &&
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.9 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`
163
- );
164
- }
165
- return binding;
166
- } catch (e) {
167
- loadErrors.push(e);
126
+ return require('./fastyaml-rs.win32-x64-msvc.node')
127
+ } catch (e) {
128
+ loadErrors.push(e)
129
+ }
130
+ try {
131
+ const binding = require('fastyaml-rs-win32-x64-msvc')
132
+ const bindingPackageVersion = require('fastyaml-rs-win32-x64-msvc/package.json').version
133
+ if (bindingPackageVersion !== '0.3.0' && 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.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
168
135
  }
136
+ return binding
137
+ } catch (e) {
138
+ loadErrors.push(e)
139
+ }
169
140
  }
170
141
  } else if (process.arch === 'ia32') {
171
142
  try {
172
- return require('./fastyaml-rs.win32-ia32-msvc.node');
143
+ return require('./fastyaml-rs.win32-ia32-msvc.node')
173
144
  } catch (e) {
174
- loadErrors.push(e);
145
+ loadErrors.push(e)
175
146
  }
176
147
  try {
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.9' &&
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.9 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`
186
- );
187
- }
188
- return binding;
148
+ const binding = require('fastyaml-rs-win32-ia32-msvc')
149
+ const bindingPackageVersion = require('fastyaml-rs-win32-ia32-msvc/package.json').version
150
+ if (bindingPackageVersion !== '0.3.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
151
+ throw new Error(`Native binding package version mismatch, expected 0.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
152
+ }
153
+ return binding
189
154
  } catch (e) {
190
- loadErrors.push(e);
155
+ loadErrors.push(e)
191
156
  }
192
157
  } else if (process.arch === 'arm64') {
193
158
  try {
194
- return require('./fastyaml-rs.win32-arm64-msvc.node');
159
+ return require('./fastyaml-rs.win32-arm64-msvc.node')
195
160
  } catch (e) {
196
- loadErrors.push(e);
161
+ loadErrors.push(e)
197
162
  }
198
163
  try {
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.9' &&
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.9 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`
208
- );
209
- }
210
- return binding;
164
+ const binding = require('fastyaml-rs-win32-arm64-msvc')
165
+ const bindingPackageVersion = require('fastyaml-rs-win32-arm64-msvc/package.json').version
166
+ if (bindingPackageVersion !== '0.3.0' && 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.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
168
+ }
169
+ return binding
211
170
  } catch (e) {
212
- loadErrors.push(e);
171
+ loadErrors.push(e)
213
172
  }
214
173
  } else {
215
- loadErrors.push(new Error(`Unsupported architecture on Windows: ${process.arch}`));
174
+ loadErrors.push(new Error(`Unsupported architecture on Windows: ${process.arch}`))
216
175
  }
217
176
  } else if (process.platform === 'darwin') {
218
177
  try {
219
- return require('./fastyaml-rs.darwin-universal.node');
178
+ return require('./fastyaml-rs.darwin-universal.node')
220
179
  } catch (e) {
221
- loadErrors.push(e);
180
+ loadErrors.push(e)
222
181
  }
223
182
  try {
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.9' &&
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.9 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`
233
- );
234
- }
235
- return binding;
183
+ const binding = require('fastyaml-rs-darwin-universal')
184
+ const bindingPackageVersion = require('fastyaml-rs-darwin-universal/package.json').version
185
+ if (bindingPackageVersion !== '0.3.0' && 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.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
187
+ }
188
+ return binding
236
189
  } catch (e) {
237
- loadErrors.push(e);
190
+ loadErrors.push(e)
238
191
  }
239
192
  if (process.arch === 'x64') {
240
193
  try {
241
- return require('./fastyaml-rs.darwin-x64.node');
194
+ return require('./fastyaml-rs.darwin-x64.node')
242
195
  } catch (e) {
243
- loadErrors.push(e);
196
+ loadErrors.push(e)
244
197
  }
245
198
  try {
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.9' &&
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.9 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`
255
- );
256
- }
257
- return binding;
199
+ const binding = require('fastyaml-rs-darwin-x64')
200
+ const bindingPackageVersion = require('fastyaml-rs-darwin-x64/package.json').version
201
+ if (bindingPackageVersion !== '0.3.0' && 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.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
203
+ }
204
+ return binding
258
205
  } catch (e) {
259
- loadErrors.push(e);
206
+ loadErrors.push(e)
260
207
  }
261
208
  } else if (process.arch === 'arm64') {
262
209
  try {
263
- return require('./fastyaml-rs.darwin-arm64.node');
210
+ return require('./fastyaml-rs.darwin-arm64.node')
264
211
  } catch (e) {
265
- loadErrors.push(e);
212
+ loadErrors.push(e)
266
213
  }
267
214
  try {
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.9' &&
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.9 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`
277
- );
278
- }
279
- return binding;
215
+ const binding = require('fastyaml-rs-darwin-arm64')
216
+ const bindingPackageVersion = require('fastyaml-rs-darwin-arm64/package.json').version
217
+ if (bindingPackageVersion !== '0.3.0' && 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.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
219
+ }
220
+ return binding
280
221
  } catch (e) {
281
- loadErrors.push(e);
222
+ loadErrors.push(e)
282
223
  }
283
224
  } else {
284
- loadErrors.push(new Error(`Unsupported architecture on macOS: ${process.arch}`));
225
+ loadErrors.push(new Error(`Unsupported architecture on macOS: ${process.arch}`))
285
226
  }
286
227
  } else if (process.platform === 'freebsd') {
287
228
  if (process.arch === 'x64') {
288
229
  try {
289
- return require('./fastyaml-rs.freebsd-x64.node');
230
+ return require('./fastyaml-rs.freebsd-x64.node')
290
231
  } catch (e) {
291
- loadErrors.push(e);
232
+ loadErrors.push(e)
292
233
  }
293
234
  try {
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.9' &&
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.9 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`
303
- );
304
- }
305
- return binding;
235
+ const binding = require('fastyaml-rs-freebsd-x64')
236
+ const bindingPackageVersion = require('fastyaml-rs-freebsd-x64/package.json').version
237
+ if (bindingPackageVersion !== '0.3.0' && 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.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
239
+ }
240
+ return binding
306
241
  } catch (e) {
307
- loadErrors.push(e);
242
+ loadErrors.push(e)
308
243
  }
309
244
  } else if (process.arch === 'arm64') {
310
245
  try {
311
- return require('./fastyaml-rs.freebsd-arm64.node');
246
+ return require('./fastyaml-rs.freebsd-arm64.node')
312
247
  } catch (e) {
313
- loadErrors.push(e);
248
+ loadErrors.push(e)
314
249
  }
315
250
  try {
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.9' &&
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.9 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`
325
- );
326
- }
327
- return binding;
251
+ const binding = require('fastyaml-rs-freebsd-arm64')
252
+ const bindingPackageVersion = require('fastyaml-rs-freebsd-arm64/package.json').version
253
+ if (bindingPackageVersion !== '0.3.0' && 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.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
255
+ }
256
+ return binding
328
257
  } catch (e) {
329
- loadErrors.push(e);
258
+ loadErrors.push(e)
330
259
  }
331
260
  } else {
332
- loadErrors.push(new Error(`Unsupported architecture on FreeBSD: ${process.arch}`));
261
+ loadErrors.push(new Error(`Unsupported architecture on FreeBSD: ${process.arch}`))
333
262
  }
334
263
  } else if (process.platform === 'linux') {
335
264
  if (process.arch === 'x64') {
336
265
  if (isMusl()) {
337
266
  try {
338
- return require('./fastyaml-rs.linux-x64-musl.node');
267
+ return require('./fastyaml-rs.linux-x64-musl.node')
339
268
  } catch (e) {
340
- loadErrors.push(e);
269
+ loadErrors.push(e)
341
270
  }
342
271
  try {
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.9' &&
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.9 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`
352
- );
272
+ const binding = require('fastyaml-rs-linux-x64-musl')
273
+ const bindingPackageVersion = require('fastyaml-rs-linux-x64-musl/package.json').version
274
+ if (bindingPackageVersion !== '0.3.0' && 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.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
353
276
  }
354
- return binding;
277
+ return binding
355
278
  } catch (e) {
356
- loadErrors.push(e);
279
+ loadErrors.push(e)
357
280
  }
358
281
  } else {
359
282
  try {
360
- return require('./fastyaml-rs.linux-x64-gnu.node');
283
+ return require('./fastyaml-rs.linux-x64-gnu.node')
361
284
  } catch (e) {
362
- loadErrors.push(e);
285
+ loadErrors.push(e)
363
286
  }
364
287
  try {
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.9' &&
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.9 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`
374
- );
288
+ const binding = require('fastyaml-rs-linux-x64-gnu')
289
+ const bindingPackageVersion = require('fastyaml-rs-linux-x64-gnu/package.json').version
290
+ if (bindingPackageVersion !== '0.3.0' && 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.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
375
292
  }
376
- return binding;
293
+ return binding
377
294
  } catch (e) {
378
- loadErrors.push(e);
295
+ loadErrors.push(e)
379
296
  }
380
297
  }
381
298
  } else if (process.arch === 'arm64') {
382
299
  if (isMusl()) {
383
300
  try {
384
- return require('./fastyaml-rs.linux-arm64-musl.node');
301
+ return require('./fastyaml-rs.linux-arm64-musl.node')
385
302
  } catch (e) {
386
- loadErrors.push(e);
303
+ loadErrors.push(e)
387
304
  }
388
305
  try {
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.9' &&
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.9 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`
399
- );
306
+ const binding = require('fastyaml-rs-linux-arm64-musl')
307
+ const bindingPackageVersion = require('fastyaml-rs-linux-arm64-musl/package.json').version
308
+ if (bindingPackageVersion !== '0.3.0' && 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.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
400
310
  }
401
- return binding;
311
+ return binding
402
312
  } catch (e) {
403
- loadErrors.push(e);
313
+ loadErrors.push(e)
404
314
  }
405
315
  } else {
406
316
  try {
407
- return require('./fastyaml-rs.linux-arm64-gnu.node');
317
+ return require('./fastyaml-rs.linux-arm64-gnu.node')
408
318
  } catch (e) {
409
- loadErrors.push(e);
319
+ loadErrors.push(e)
410
320
  }
411
321
  try {
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.9' &&
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.9 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`
421
- );
322
+ const binding = require('fastyaml-rs-linux-arm64-gnu')
323
+ const bindingPackageVersion = require('fastyaml-rs-linux-arm64-gnu/package.json').version
324
+ if (bindingPackageVersion !== '0.3.0' && 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.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
422
326
  }
423
- return binding;
327
+ return binding
424
328
  } catch (e) {
425
- loadErrors.push(e);
329
+ loadErrors.push(e)
426
330
  }
427
331
  }
428
332
  } else if (process.arch === 'arm') {
429
333
  if (isMusl()) {
430
334
  try {
431
- return require('./fastyaml-rs.linux-arm-musleabihf.node');
335
+ return require('./fastyaml-rs.linux-arm-musleabihf.node')
432
336
  } catch (e) {
433
- loadErrors.push(e);
337
+ loadErrors.push(e)
434
338
  }
435
339
  try {
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.9' &&
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.9 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`
446
- );
340
+ const binding = require('fastyaml-rs-linux-arm-musleabihf')
341
+ const bindingPackageVersion = require('fastyaml-rs-linux-arm-musleabihf/package.json').version
342
+ if (bindingPackageVersion !== '0.3.0' && 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.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
447
344
  }
448
- return binding;
345
+ return binding
449
346
  } catch (e) {
450
- loadErrors.push(e);
347
+ loadErrors.push(e)
451
348
  }
452
349
  } else {
453
350
  try {
454
- return require('./fastyaml-rs.linux-arm-gnueabihf.node');
351
+ return require('./fastyaml-rs.linux-arm-gnueabihf.node')
455
352
  } catch (e) {
456
- loadErrors.push(e);
353
+ loadErrors.push(e)
457
354
  }
458
355
  try {
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.9' &&
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.9 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`
469
- );
356
+ const binding = require('fastyaml-rs-linux-arm-gnueabihf')
357
+ const bindingPackageVersion = require('fastyaml-rs-linux-arm-gnueabihf/package.json').version
358
+ if (bindingPackageVersion !== '0.3.0' && 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.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
470
360
  }
471
- return binding;
361
+ return binding
472
362
  } catch (e) {
473
- loadErrors.push(e);
363
+ loadErrors.push(e)
474
364
  }
475
365
  }
476
366
  } else if (process.arch === 'loong64') {
477
367
  if (isMusl()) {
478
368
  try {
479
- return require('./fastyaml-rs.linux-loong64-musl.node');
369
+ return require('./fastyaml-rs.linux-loong64-musl.node')
480
370
  } catch (e) {
481
- loadErrors.push(e);
371
+ loadErrors.push(e)
482
372
  }
483
373
  try {
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.9' &&
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.9 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`
494
- );
374
+ const binding = require('fastyaml-rs-linux-loong64-musl')
375
+ const bindingPackageVersion = require('fastyaml-rs-linux-loong64-musl/package.json').version
376
+ if (bindingPackageVersion !== '0.3.0' && 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.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
495
378
  }
496
- return binding;
379
+ return binding
497
380
  } catch (e) {
498
- loadErrors.push(e);
381
+ loadErrors.push(e)
499
382
  }
500
383
  } else {
501
384
  try {
502
- return require('./fastyaml-rs.linux-loong64-gnu.node');
385
+ return require('./fastyaml-rs.linux-loong64-gnu.node')
503
386
  } catch (e) {
504
- loadErrors.push(e);
387
+ loadErrors.push(e)
505
388
  }
506
389
  try {
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.9' &&
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.9 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`
517
- );
390
+ const binding = require('fastyaml-rs-linux-loong64-gnu')
391
+ const bindingPackageVersion = require('fastyaml-rs-linux-loong64-gnu/package.json').version
392
+ if (bindingPackageVersion !== '0.3.0' && 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.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
518
394
  }
519
- return binding;
395
+ return binding
520
396
  } catch (e) {
521
- loadErrors.push(e);
397
+ loadErrors.push(e)
522
398
  }
523
399
  }
524
400
  } else if (process.arch === 'riscv64') {
525
401
  if (isMusl()) {
526
402
  try {
527
- return require('./fastyaml-rs.linux-riscv64-musl.node');
403
+ return require('./fastyaml-rs.linux-riscv64-musl.node')
528
404
  } catch (e) {
529
- loadErrors.push(e);
405
+ loadErrors.push(e)
530
406
  }
531
407
  try {
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.9' &&
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.9 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`
542
- );
408
+ const binding = require('fastyaml-rs-linux-riscv64-musl')
409
+ const bindingPackageVersion = require('fastyaml-rs-linux-riscv64-musl/package.json').version
410
+ if (bindingPackageVersion !== '0.3.0' && 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.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
543
412
  }
544
- return binding;
413
+ return binding
545
414
  } catch (e) {
546
- loadErrors.push(e);
415
+ loadErrors.push(e)
547
416
  }
548
417
  } else {
549
418
  try {
550
- return require('./fastyaml-rs.linux-riscv64-gnu.node');
419
+ return require('./fastyaml-rs.linux-riscv64-gnu.node')
551
420
  } catch (e) {
552
- loadErrors.push(e);
421
+ loadErrors.push(e)
553
422
  }
554
423
  try {
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.9' &&
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.9 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`
565
- );
424
+ const binding = require('fastyaml-rs-linux-riscv64-gnu')
425
+ const bindingPackageVersion = require('fastyaml-rs-linux-riscv64-gnu/package.json').version
426
+ if (bindingPackageVersion !== '0.3.0' && 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.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
566
428
  }
567
- return binding;
429
+ return binding
568
430
  } catch (e) {
569
- loadErrors.push(e);
431
+ loadErrors.push(e)
570
432
  }
571
433
  }
572
434
  } else if (process.arch === 'ppc64') {
573
435
  try {
574
- return require('./fastyaml-rs.linux-ppc64-gnu.node');
436
+ return require('./fastyaml-rs.linux-ppc64-gnu.node')
575
437
  } catch (e) {
576
- loadErrors.push(e);
438
+ loadErrors.push(e)
577
439
  }
578
440
  try {
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.9' &&
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.9 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`
588
- );
589
- }
590
- return binding;
441
+ const binding = require('fastyaml-rs-linux-ppc64-gnu')
442
+ const bindingPackageVersion = require('fastyaml-rs-linux-ppc64-gnu/package.json').version
443
+ if (bindingPackageVersion !== '0.3.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
444
+ throw new Error(`Native binding package version mismatch, expected 0.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
445
+ }
446
+ return binding
591
447
  } catch (e) {
592
- loadErrors.push(e);
448
+ loadErrors.push(e)
593
449
  }
594
450
  } else if (process.arch === 's390x') {
595
451
  try {
596
- return require('./fastyaml-rs.linux-s390x-gnu.node');
452
+ return require('./fastyaml-rs.linux-s390x-gnu.node')
597
453
  } catch (e) {
598
- loadErrors.push(e);
454
+ loadErrors.push(e)
599
455
  }
600
456
  try {
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.9' &&
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.9 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`
610
- );
611
- }
612
- return binding;
457
+ const binding = require('fastyaml-rs-linux-s390x-gnu')
458
+ const bindingPackageVersion = require('fastyaml-rs-linux-s390x-gnu/package.json').version
459
+ if (bindingPackageVersion !== '0.3.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
460
+ throw new Error(`Native binding package version mismatch, expected 0.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
461
+ }
462
+ return binding
613
463
  } catch (e) {
614
- loadErrors.push(e);
464
+ loadErrors.push(e)
615
465
  }
616
466
  } else {
617
- loadErrors.push(new Error(`Unsupported architecture on Linux: ${process.arch}`));
467
+ loadErrors.push(new Error(`Unsupported architecture on Linux: ${process.arch}`))
618
468
  }
619
469
  } else if (process.platform === 'openharmony') {
620
470
  if (process.arch === 'arm64') {
621
471
  try {
622
- return require('./fastyaml-rs.openharmony-arm64.node');
472
+ return require('./fastyaml-rs.openharmony-arm64.node')
623
473
  } catch (e) {
624
- loadErrors.push(e);
474
+ loadErrors.push(e)
625
475
  }
626
476
  try {
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.9' &&
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.9 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`
636
- );
637
- }
638
- return binding;
477
+ const binding = require('fastyaml-rs-openharmony-arm64')
478
+ const bindingPackageVersion = require('fastyaml-rs-openharmony-arm64/package.json').version
479
+ if (bindingPackageVersion !== '0.3.0' && 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.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
481
+ }
482
+ return binding
639
483
  } catch (e) {
640
- loadErrors.push(e);
484
+ loadErrors.push(e)
641
485
  }
642
486
  } else if (process.arch === 'x64') {
643
487
  try {
644
- return require('./fastyaml-rs.openharmony-x64.node');
488
+ return require('./fastyaml-rs.openharmony-x64.node')
645
489
  } catch (e) {
646
- loadErrors.push(e);
490
+ loadErrors.push(e)
647
491
  }
648
492
  try {
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.9' &&
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.9 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`
658
- );
659
- }
660
- return binding;
493
+ const binding = require('fastyaml-rs-openharmony-x64')
494
+ const bindingPackageVersion = require('fastyaml-rs-openharmony-x64/package.json').version
495
+ if (bindingPackageVersion !== '0.3.0' && 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.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
497
+ }
498
+ return binding
661
499
  } catch (e) {
662
- loadErrors.push(e);
500
+ loadErrors.push(e)
663
501
  }
664
502
  } else if (process.arch === 'arm') {
665
503
  try {
666
- return require('./fastyaml-rs.openharmony-arm.node');
504
+ return require('./fastyaml-rs.openharmony-arm.node')
667
505
  } catch (e) {
668
- loadErrors.push(e);
506
+ loadErrors.push(e)
669
507
  }
670
508
  try {
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.9' &&
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.9 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`
680
- );
681
- }
682
- return binding;
509
+ const binding = require('fastyaml-rs-openharmony-arm')
510
+ const bindingPackageVersion = require('fastyaml-rs-openharmony-arm/package.json').version
511
+ if (bindingPackageVersion !== '0.3.0' && 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.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
513
+ }
514
+ return binding
683
515
  } catch (e) {
684
- loadErrors.push(e);
516
+ loadErrors.push(e)
685
517
  }
686
518
  } else {
687
- loadErrors.push(new Error(`Unsupported architecture on OpenHarmony: ${process.arch}`));
519
+ loadErrors.push(new Error(`Unsupported architecture on OpenHarmony: ${process.arch}`))
688
520
  }
689
521
  } else {
690
- loadErrors.push(
691
- new Error(`Unsupported OS: ${process.platform}, architecture: ${process.arch}`)
692
- );
522
+ loadErrors.push(new Error(`Unsupported OS: ${process.platform}, architecture: ${process.arch}`))
693
523
  }
694
524
  }
695
525
 
696
- nativeBinding = requireNative();
526
+ nativeBinding = requireNative()
697
527
 
698
528
  if (!nativeBinding || process.env.NAPI_RS_FORCE_WASI) {
699
- let wasiBinding = null;
700
- let wasiBindingError = null;
529
+ let wasiBinding = null
530
+ let wasiBindingError = null
701
531
  try {
702
- wasiBinding = require('./fastyaml-rs.wasi.cjs');
703
- nativeBinding = wasiBinding;
532
+ wasiBinding = require('./fastyaml-rs.wasi.cjs')
533
+ nativeBinding = wasiBinding
704
534
  } catch (err) {
705
535
  if (process.env.NAPI_RS_FORCE_WASI) {
706
- wasiBindingError = err;
536
+ wasiBindingError = err
707
537
  }
708
538
  }
709
539
  if (!nativeBinding) {
710
540
  try {
711
- wasiBinding = require('fastyaml-rs-wasm32-wasi');
712
- nativeBinding = wasiBinding;
541
+ wasiBinding = require('fastyaml-rs-wasm32-wasi')
542
+ nativeBinding = wasiBinding
713
543
  } catch (err) {
714
544
  if (process.env.NAPI_RS_FORCE_WASI) {
715
- wasiBindingError.cause = err;
716
- loadErrors.push(err);
545
+ wasiBindingError.cause = err
546
+ loadErrors.push(err)
717
547
  }
718
548
  }
719
549
  }
720
550
  if (process.env.NAPI_RS_FORCE_WASI === 'error' && !wasiBinding) {
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;
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
724
554
  }
725
555
  }
726
556
 
@@ -732,22 +562,22 @@ if (!nativeBinding) {
732
562
  'Please try `npm i` again after removing both package-lock.json and node_modules directory.',
733
563
  {
734
564
  cause: loadErrors.reduce((err, cur) => {
735
- cur.cause = err;
736
- return cur;
565
+ cur.cause = err
566
+ return cur
737
567
  }),
738
- }
739
- );
568
+ },
569
+ )
740
570
  }
741
- throw new Error(`Failed to load native binding`);
571
+ throw new Error(`Failed to load native binding`)
742
572
  }
743
573
 
744
- module.exports = nativeBinding;
745
- module.exports.Mark = nativeBinding.Mark;
746
- module.exports.load = nativeBinding.load;
747
- module.exports.loadAll = nativeBinding.loadAll;
748
- module.exports.safeDump = nativeBinding.safeDump;
749
- module.exports.safeDumpAll = nativeBinding.safeDumpAll;
750
- module.exports.safeLoad = nativeBinding.safeLoad;
751
- module.exports.safeLoadAll = nativeBinding.safeLoadAll;
752
- module.exports.Schema = nativeBinding.Schema;
753
- module.exports.version = nativeBinding.version;
574
+ module.exports = nativeBinding
575
+ module.exports.Mark = nativeBinding.Mark
576
+ module.exports.load = nativeBinding.load
577
+ module.exports.loadAll = nativeBinding.loadAll
578
+ module.exports.safeDump = nativeBinding.safeDump
579
+ module.exports.safeDumpAll = nativeBinding.safeDumpAll
580
+ module.exports.safeLoad = nativeBinding.safeLoad
581
+ module.exports.safeLoadAll = nativeBinding.safeLoadAll
582
+ module.exports.Schema = nativeBinding.Schema
583
+ module.exports.version = nativeBinding.version
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fastyaml-rs",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "Fast YAML 1.2.2 parser, linter, and parallel processor for Node.js",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -47,20 +47,21 @@
47
47
  "test:verbose": "vitest run --reporter=verbose",
48
48
  "test:coverage": "vitest run --coverage",
49
49
  "bench": "vitest bench",
50
- "format": "prettier --write \"**/*.{ts,js,json,md}\"",
51
- "format:check": "prettier --check \"**/*.{ts,js,json,md}\"",
52
- "lint": "echo 'ESLint not configured yet. Run: npm install --save-dev eslint @typescript-eslint/parser @typescript-eslint/eslint-plugin' && exit 0",
50
+ "format": "biome format --write .",
51
+ "format:check": "biome check",
52
+ "lint": "biome lint .",
53
+ "check": "biome check --write .",
53
54
  "typecheck": "tsc --noEmit",
54
55
  "prepublishOnly": "napi prepublish -t npm",
55
56
  "artifacts": "napi artifacts",
56
57
  "version": "napi version"
57
58
  },
58
59
  "devDependencies": {
60
+ "@biomejs/biome": "^2.3.10",
59
61
  "@napi-rs/cli": "~3.5.0",
60
62
  "@types/node": "^25.0.3",
61
63
  "@vitest/coverage-v8": "^4.0.16",
62
64
  "fastyaml-rs": "0.1.11",
63
- "prettier": "^3.7.4",
64
65
  "typescript": "^5.9.3",
65
66
  "vitest": "^4.0.16"
66
67
  }