fastyaml-rs 0.1.9 → 0.1.10

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 +17 -2
  2. package/index.d.ts +170 -4
  3. package/index.js +56 -56
  4. package/package.json +1 -1
package/README.md CHANGED
@@ -92,11 +92,26 @@ const multiDoc = safeDumpAll([{ a: 1 }, { b: 2 }]);
92
92
 
93
93
  ```typescript
94
94
  interface DumpOptions {
95
- sortKeys?: boolean; // Sort object keys alphabetically (default: false)
96
- allowUnicode?: boolean; // Allow unicode characters (default: true)
95
+ sortKeys?: boolean; // Sort object keys alphabetically (default: false)
96
+ allowUnicode?: boolean; // Allow unicode characters (default: true)
97
+ indent?: number; // Indentation width 1-9 (default: 2)
98
+ width?: number; // Line width 20-1000 (default: 80)
99
+ defaultFlowStyle?: boolean; // Force flow style [...], {...} (default: null/block)
100
+ explicitStart?: boolean; // Add '---' document marker (default: false)
97
101
  }
98
102
  ```
99
103
 
104
+ **Example with options:**
105
+
106
+ ```typescript
107
+ const yaml = safeDump(data, {
108
+ sortKeys: true,
109
+ indent: 4,
110
+ width: 120,
111
+ explicitStart: true,
112
+ });
113
+ ```
114
+
100
115
  ### Aliases
101
116
 
102
117
  For js-yaml compatibility, `load` and `dump` are provided as aliases:
package/index.d.ts CHANGED
@@ -1,5 +1,47 @@
1
1
  /* auto-generated by NAPI-RS */
2
2
  /* eslint-disable */
3
+ /**
4
+ * Represents a position in a YAML source file.
5
+ *
6
+ * Used to indicate where errors occur during parsing.
7
+ *
8
+ * # Example
9
+ *
10
+ * ```javascript
11
+ * const { Mark } = require('@fast-yaml/core');
12
+ *
13
+ * const mark = new Mark('<input>', 5, 10);
14
+ * console.log(mark.name); // '<input>'
15
+ * console.log(mark.line); // 5
16
+ * console.log(mark.column); // 10
17
+ * console.log(mark.toString()); // '<input>:5:10'
18
+ * ```
19
+ */
20
+ export declare class Mark {
21
+ /** The name of the source (e.g., filename or '<input>'). */
22
+ readonly name: string;
23
+ /** The line number (0-indexed). */
24
+ readonly line: number;
25
+ /** The column number (0-indexed). */
26
+ readonly column: number;
27
+ /**
28
+ * Create a new Mark instance.
29
+ *
30
+ * # Arguments
31
+ *
32
+ * * `name` - The source name (e.g., filename)
33
+ * * `line` - The line number (0-indexed)
34
+ * * `column` - The column number (0-indexed)
35
+ */
36
+ constructor(name: string, line: number, column: number);
37
+ /**
38
+ * Get a string representation of the mark.
39
+ *
40
+ * Returns format: "name:line:column"
41
+ */
42
+ toString(): string;
43
+ }
44
+
3
45
  /** Options for YAML serialization. */
4
46
  export interface DumpOptions {
5
47
  /** If true, sort object keys alphabetically (default: false) */
@@ -9,6 +51,114 @@ export interface DumpOptions {
9
51
  * Note: yaml-rust2 always outputs unicode; this is accepted for API compatibility.
10
52
  */
11
53
  allowUnicode?: boolean;
54
+ /**
55
+ * Indentation width in spaces (default: 2).
56
+ * Valid range: 1-9 (values outside this range will be clamped).
57
+ */
58
+ indent?: number;
59
+ /**
60
+ * Maximum line width for wrapping (default: 80).
61
+ * Valid range: 20-1000 (values outside this range will be clamped).
62
+ */
63
+ width?: number;
64
+ /**
65
+ * Default flow style for collections (default: null).
66
+ * - null: Use block style (multi-line)
67
+ * - true: Force flow style (inline: [...], {...})
68
+ * - false: Force block style (explicit)
69
+ */
70
+ defaultFlowStyle?: boolean;
71
+ /** Add explicit document start marker `---` (default: false). */
72
+ explicitStart?: boolean;
73
+ }
74
+
75
+ /**
76
+ * Parse a YAML string with options (js-yaml compatible).
77
+ *
78
+ * This is the js-yaml compatible `load()` function that accepts an options object.
79
+ * Currently all schemas behave as `SafeSchema` (safe by default).
80
+ *
81
+ * # Arguments
82
+ *
83
+ * * `yaml_str` - A YAML document as a string
84
+ * * `options` - Optional parsing options (schema, filename, etc.)
85
+ *
86
+ * # Returns
87
+ *
88
+ * The parsed YAML document as JavaScript objects
89
+ *
90
+ * # Errors
91
+ *
92
+ * Throws an error if:
93
+ * - The YAML is invalid
94
+ * - Input exceeds size limit (100MB)
95
+ *
96
+ * # Example
97
+ *
98
+ * ```javascript
99
+ * const { load, SAFE_SCHEMA } = require('@fast-yaml/core');
100
+ *
101
+ * const data = load('name: test', { schema: 'SafeSchema' });
102
+ * console.log(data); // { name: 'test' }
103
+ * ```
104
+ */
105
+ export declare function load(
106
+ yamlStr: string,
107
+ options?: LoadOptions | undefined | null
108
+ ): NapiResult<unknown>;
109
+
110
+ /**
111
+ * Parse a YAML string containing multiple documents with options (js-yaml compatible).
112
+ *
113
+ * This is the js-yaml compatible `loadAll()` function that accepts an options object.
114
+ * Currently all schemas behave as `SafeSchema` (safe by default).
115
+ *
116
+ * # Arguments
117
+ *
118
+ * * `yaml_str` - A YAML string potentially containing multiple documents
119
+ * * `options` - Optional parsing options (schema, filename, etc.)
120
+ *
121
+ * # Returns
122
+ *
123
+ * An array of parsed JavaScript objects
124
+ *
125
+ * # Errors
126
+ *
127
+ * Throws an error if:
128
+ * - The YAML is invalid
129
+ * - Input exceeds size limit (100MB)
130
+ *
131
+ * # Example
132
+ *
133
+ * ```javascript
134
+ * const { loadAll, SAFE_SCHEMA } = require('@fast-yaml/core');
135
+ *
136
+ * const docs = loadAll('---
137
+ foo: 1
138
+ ---
139
+ bar: 2', { schema: 'SafeSchema' });
140
+ * console.log(docs); // [{ foo: 1 }, { bar: 2 }]
141
+ * ```
142
+ */
143
+ export declare function loadAll(
144
+ yamlStr: string,
145
+ options?: LoadOptions | undefined | null
146
+ ): NapiResult<Array<unknown>>;
147
+
148
+ /** Options for YAML parsing (js-yaml compatible). */
149
+ export interface LoadOptions {
150
+ /**
151
+ * YAML schema to use for parsing (default: `SafeSchema`).
152
+ * Currently all schemas behave as `SafeSchema` (safe by default).
153
+ */
154
+ schema?: Schema;
155
+ /** Filename or source name for error messages (default: `<input>`). */
156
+ filename?: string;
157
+ /**
158
+ * Allow duplicate keys in mappings (default: true).
159
+ * Note: fast-yaml always allows duplicates; this is for API compatibility.
160
+ */
161
+ allowDuplicateKeys?: boolean;
12
162
  }
13
163
 
14
164
  /**
@@ -159,6 +309,26 @@ bar: 2');
159
309
  */
160
310
  export declare function safeLoadAll(yamlStr: string): NapiResult<Array<unknown>>;
161
311
 
312
+ /**
313
+ * YAML schema types for parsing behavior (js-yaml compatible).
314
+ *
315
+ * All schemas currently behave as `SAFE_SCHEMA` (safe by default).
316
+ * The schema parameter is accepted for API compatibility with js-yaml.
317
+ */
318
+ export declare const enum Schema {
319
+ /**
320
+ * Safe schema - only safe data types (default).
321
+ * Equivalent to `PyYAML`'s `SafeLoader`.
322
+ */
323
+ SafeSchema = 'SafeSchema',
324
+ /** JSON schema - strict JSON subset of YAML. */
325
+ JsonSchema = 'JsonSchema',
326
+ /** Core schema - YAML 1.2.2 Core Schema. */
327
+ CoreSchema = 'CoreSchema',
328
+ /** Failsafe schema - minimal safe subset. */
329
+ FailsafeSchema = 'FailsafeSchema',
330
+ }
331
+
162
332
  /**
163
333
  * Get the library version.
164
334
  *
@@ -172,7 +342,3 @@ export declare function safeLoadAll(yamlStr: string): NapiResult<Array<unknown>>
172
342
  * ```
173
343
  */
174
344
  export declare function version(): string;
175
-
176
- // Aliases for js-yaml compatibility
177
- export declare const load: typeof safeLoad;
178
- export declare const dump: typeof safeDump;
package/index.js CHANGED
@@ -80,12 +80,12 @@ function requireNative() {
80
80
  const binding = require('fastyaml-rs-android-arm64');
81
81
  const bindingPackageVersion = require('fastyaml-rs-android-arm64/package.json').version;
82
82
  if (
83
- bindingPackageVersion !== '0.1.6' &&
83
+ bindingPackageVersion !== '0.1.9' &&
84
84
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
85
85
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
86
86
  ) {
87
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.`
88
+ `Native binding package version mismatch, expected 0.1.9 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`
89
89
  );
90
90
  }
91
91
  return binding;
@@ -102,12 +102,12 @@ function requireNative() {
102
102
  const binding = require('fastyaml-rs-android-arm-eabi');
103
103
  const bindingPackageVersion = require('fastyaml-rs-android-arm-eabi/package.json').version;
104
104
  if (
105
- bindingPackageVersion !== '0.1.6' &&
105
+ bindingPackageVersion !== '0.1.9' &&
106
106
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
107
107
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
108
108
  ) {
109
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.`
110
+ `Native binding package version mismatch, expected 0.1.9 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`
111
111
  );
112
112
  }
113
113
  return binding;
@@ -132,12 +132,12 @@ function requireNative() {
132
132
  const binding = require('fastyaml-rs-win32-x64-gnu');
133
133
  const bindingPackageVersion = require('fastyaml-rs-win32-x64-gnu/package.json').version;
134
134
  if (
135
- bindingPackageVersion !== '0.1.6' &&
135
+ bindingPackageVersion !== '0.1.9' &&
136
136
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
137
137
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
138
138
  ) {
139
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.`
140
+ `Native binding package version mismatch, expected 0.1.9 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`
141
141
  );
142
142
  }
143
143
  return binding;
@@ -154,12 +154,12 @@ function requireNative() {
154
154
  const binding = require('fastyaml-rs-win32-x64-msvc');
155
155
  const bindingPackageVersion = require('fastyaml-rs-win32-x64-msvc/package.json').version;
156
156
  if (
157
- bindingPackageVersion !== '0.1.6' &&
157
+ bindingPackageVersion !== '0.1.9' &&
158
158
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
159
159
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
160
160
  ) {
161
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.`
162
+ `Native binding package version mismatch, expected 0.1.9 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`
163
163
  );
164
164
  }
165
165
  return binding;
@@ -177,12 +177,12 @@ function requireNative() {
177
177
  const binding = require('fastyaml-rs-win32-ia32-msvc');
178
178
  const bindingPackageVersion = require('fastyaml-rs-win32-ia32-msvc/package.json').version;
179
179
  if (
180
- bindingPackageVersion !== '0.1.6' &&
180
+ bindingPackageVersion !== '0.1.9' &&
181
181
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
182
182
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
183
183
  ) {
184
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.`
185
+ `Native binding package version mismatch, expected 0.1.9 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`
186
186
  );
187
187
  }
188
188
  return binding;
@@ -199,12 +199,12 @@ function requireNative() {
199
199
  const binding = require('fastyaml-rs-win32-arm64-msvc');
200
200
  const bindingPackageVersion = require('fastyaml-rs-win32-arm64-msvc/package.json').version;
201
201
  if (
202
- bindingPackageVersion !== '0.1.6' &&
202
+ bindingPackageVersion !== '0.1.9' &&
203
203
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
204
204
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
205
205
  ) {
206
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.`
207
+ `Native binding package version mismatch, expected 0.1.9 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`
208
208
  );
209
209
  }
210
210
  return binding;
@@ -224,12 +224,12 @@ function requireNative() {
224
224
  const binding = require('fastyaml-rs-darwin-universal');
225
225
  const bindingPackageVersion = require('fastyaml-rs-darwin-universal/package.json').version;
226
226
  if (
227
- bindingPackageVersion !== '0.1.6' &&
227
+ bindingPackageVersion !== '0.1.9' &&
228
228
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
229
229
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
230
230
  ) {
231
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.`
232
+ `Native binding package version mismatch, expected 0.1.9 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`
233
233
  );
234
234
  }
235
235
  return binding;
@@ -246,12 +246,12 @@ function requireNative() {
246
246
  const binding = require('fastyaml-rs-darwin-x64');
247
247
  const bindingPackageVersion = require('fastyaml-rs-darwin-x64/package.json').version;
248
248
  if (
249
- bindingPackageVersion !== '0.1.6' &&
249
+ bindingPackageVersion !== '0.1.9' &&
250
250
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
251
251
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
252
252
  ) {
253
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.`
254
+ `Native binding package version mismatch, expected 0.1.9 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`
255
255
  );
256
256
  }
257
257
  return binding;
@@ -268,12 +268,12 @@ function requireNative() {
268
268
  const binding = require('fastyaml-rs-darwin-arm64');
269
269
  const bindingPackageVersion = require('fastyaml-rs-darwin-arm64/package.json').version;
270
270
  if (
271
- bindingPackageVersion !== '0.1.6' &&
271
+ bindingPackageVersion !== '0.1.9' &&
272
272
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
273
273
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
274
274
  ) {
275
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.`
276
+ `Native binding package version mismatch, expected 0.1.9 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`
277
277
  );
278
278
  }
279
279
  return binding;
@@ -294,12 +294,12 @@ function requireNative() {
294
294
  const binding = require('fastyaml-rs-freebsd-x64');
295
295
  const bindingPackageVersion = require('fastyaml-rs-freebsd-x64/package.json').version;
296
296
  if (
297
- bindingPackageVersion !== '0.1.6' &&
297
+ bindingPackageVersion !== '0.1.9' &&
298
298
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
299
299
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
300
300
  ) {
301
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.`
302
+ `Native binding package version mismatch, expected 0.1.9 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`
303
303
  );
304
304
  }
305
305
  return binding;
@@ -316,12 +316,12 @@ function requireNative() {
316
316
  const binding = require('fastyaml-rs-freebsd-arm64');
317
317
  const bindingPackageVersion = require('fastyaml-rs-freebsd-arm64/package.json').version;
318
318
  if (
319
- bindingPackageVersion !== '0.1.6' &&
319
+ bindingPackageVersion !== '0.1.9' &&
320
320
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
321
321
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
322
322
  ) {
323
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.`
324
+ `Native binding package version mismatch, expected 0.1.9 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`
325
325
  );
326
326
  }
327
327
  return binding;
@@ -343,12 +343,12 @@ function requireNative() {
343
343
  const binding = require('fastyaml-rs-linux-x64-musl');
344
344
  const bindingPackageVersion = require('fastyaml-rs-linux-x64-musl/package.json').version;
345
345
  if (
346
- bindingPackageVersion !== '0.1.6' &&
346
+ bindingPackageVersion !== '0.1.9' &&
347
347
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
348
348
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
349
349
  ) {
350
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.`
351
+ `Native binding package version mismatch, expected 0.1.9 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`
352
352
  );
353
353
  }
354
354
  return binding;
@@ -365,12 +365,12 @@ function requireNative() {
365
365
  const binding = require('fastyaml-rs-linux-x64-gnu');
366
366
  const bindingPackageVersion = require('fastyaml-rs-linux-x64-gnu/package.json').version;
367
367
  if (
368
- bindingPackageVersion !== '0.1.6' &&
368
+ bindingPackageVersion !== '0.1.9' &&
369
369
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
370
370
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
371
371
  ) {
372
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.`
373
+ `Native binding package version mismatch, expected 0.1.9 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`
374
374
  );
375
375
  }
376
376
  return binding;
@@ -390,12 +390,12 @@ function requireNative() {
390
390
  const bindingPackageVersion =
391
391
  require('fastyaml-rs-linux-arm64-musl/package.json').version;
392
392
  if (
393
- bindingPackageVersion !== '0.1.6' &&
393
+ bindingPackageVersion !== '0.1.9' &&
394
394
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
395
395
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
396
396
  ) {
397
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.`
398
+ `Native binding package version mismatch, expected 0.1.9 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`
399
399
  );
400
400
  }
401
401
  return binding;
@@ -412,12 +412,12 @@ function requireNative() {
412
412
  const binding = require('fastyaml-rs-linux-arm64-gnu');
413
413
  const bindingPackageVersion = require('fastyaml-rs-linux-arm64-gnu/package.json').version;
414
414
  if (
415
- bindingPackageVersion !== '0.1.6' &&
415
+ bindingPackageVersion !== '0.1.9' &&
416
416
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
417
417
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
418
418
  ) {
419
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.`
420
+ `Native binding package version mismatch, expected 0.1.9 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`
421
421
  );
422
422
  }
423
423
  return binding;
@@ -437,12 +437,12 @@ function requireNative() {
437
437
  const bindingPackageVersion =
438
438
  require('fastyaml-rs-linux-arm-musleabihf/package.json').version;
439
439
  if (
440
- bindingPackageVersion !== '0.1.6' &&
440
+ bindingPackageVersion !== '0.1.9' &&
441
441
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
442
442
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
443
443
  ) {
444
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.`
445
+ `Native binding package version mismatch, expected 0.1.9 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`
446
446
  );
447
447
  }
448
448
  return binding;
@@ -460,12 +460,12 @@ function requireNative() {
460
460
  const bindingPackageVersion =
461
461
  require('fastyaml-rs-linux-arm-gnueabihf/package.json').version;
462
462
  if (
463
- bindingPackageVersion !== '0.1.6' &&
463
+ bindingPackageVersion !== '0.1.9' &&
464
464
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
465
465
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
466
466
  ) {
467
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.`
468
+ `Native binding package version mismatch, expected 0.1.9 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`
469
469
  );
470
470
  }
471
471
  return binding;
@@ -485,12 +485,12 @@ function requireNative() {
485
485
  const bindingPackageVersion =
486
486
  require('fastyaml-rs-linux-loong64-musl/package.json').version;
487
487
  if (
488
- bindingPackageVersion !== '0.1.6' &&
488
+ bindingPackageVersion !== '0.1.9' &&
489
489
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
490
490
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
491
491
  ) {
492
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.`
493
+ `Native binding package version mismatch, expected 0.1.9 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`
494
494
  );
495
495
  }
496
496
  return binding;
@@ -508,12 +508,12 @@ function requireNative() {
508
508
  const bindingPackageVersion =
509
509
  require('fastyaml-rs-linux-loong64-gnu/package.json').version;
510
510
  if (
511
- bindingPackageVersion !== '0.1.6' &&
511
+ bindingPackageVersion !== '0.1.9' &&
512
512
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
513
513
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
514
514
  ) {
515
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.`
516
+ `Native binding package version mismatch, expected 0.1.9 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`
517
517
  );
518
518
  }
519
519
  return binding;
@@ -533,12 +533,12 @@ function requireNative() {
533
533
  const bindingPackageVersion =
534
534
  require('fastyaml-rs-linux-riscv64-musl/package.json').version;
535
535
  if (
536
- bindingPackageVersion !== '0.1.6' &&
536
+ bindingPackageVersion !== '0.1.9' &&
537
537
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
538
538
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
539
539
  ) {
540
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.`
541
+ `Native binding package version mismatch, expected 0.1.9 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`
542
542
  );
543
543
  }
544
544
  return binding;
@@ -556,12 +556,12 @@ function requireNative() {
556
556
  const bindingPackageVersion =
557
557
  require('fastyaml-rs-linux-riscv64-gnu/package.json').version;
558
558
  if (
559
- bindingPackageVersion !== '0.1.6' &&
559
+ bindingPackageVersion !== '0.1.9' &&
560
560
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
561
561
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
562
562
  ) {
563
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.`
564
+ `Native binding package version mismatch, expected 0.1.9 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`
565
565
  );
566
566
  }
567
567
  return binding;
@@ -579,12 +579,12 @@ function requireNative() {
579
579
  const binding = require('fastyaml-rs-linux-ppc64-gnu');
580
580
  const bindingPackageVersion = require('fastyaml-rs-linux-ppc64-gnu/package.json').version;
581
581
  if (
582
- bindingPackageVersion !== '0.1.6' &&
582
+ bindingPackageVersion !== '0.1.9' &&
583
583
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
584
584
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
585
585
  ) {
586
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.`
587
+ `Native binding package version mismatch, expected 0.1.9 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`
588
588
  );
589
589
  }
590
590
  return binding;
@@ -601,12 +601,12 @@ function requireNative() {
601
601
  const binding = require('fastyaml-rs-linux-s390x-gnu');
602
602
  const bindingPackageVersion = require('fastyaml-rs-linux-s390x-gnu/package.json').version;
603
603
  if (
604
- bindingPackageVersion !== '0.1.6' &&
604
+ bindingPackageVersion !== '0.1.9' &&
605
605
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
606
606
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
607
607
  ) {
608
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.`
609
+ `Native binding package version mismatch, expected 0.1.9 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`
610
610
  );
611
611
  }
612
612
  return binding;
@@ -627,12 +627,12 @@ function requireNative() {
627
627
  const binding = require('fastyaml-rs-openharmony-arm64');
628
628
  const bindingPackageVersion = require('fastyaml-rs-openharmony-arm64/package.json').version;
629
629
  if (
630
- bindingPackageVersion !== '0.1.6' &&
630
+ bindingPackageVersion !== '0.1.9' &&
631
631
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
632
632
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
633
633
  ) {
634
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.`
635
+ `Native binding package version mismatch, expected 0.1.9 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`
636
636
  );
637
637
  }
638
638
  return binding;
@@ -649,12 +649,12 @@ function requireNative() {
649
649
  const binding = require('fastyaml-rs-openharmony-x64');
650
650
  const bindingPackageVersion = require('fastyaml-rs-openharmony-x64/package.json').version;
651
651
  if (
652
- bindingPackageVersion !== '0.1.6' &&
652
+ bindingPackageVersion !== '0.1.9' &&
653
653
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
654
654
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
655
655
  ) {
656
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.`
657
+ `Native binding package version mismatch, expected 0.1.9 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`
658
658
  );
659
659
  }
660
660
  return binding;
@@ -671,12 +671,12 @@ function requireNative() {
671
671
  const binding = require('fastyaml-rs-openharmony-arm');
672
672
  const bindingPackageVersion = require('fastyaml-rs-openharmony-arm/package.json').version;
673
673
  if (
674
- bindingPackageVersion !== '0.1.6' &&
674
+ bindingPackageVersion !== '0.1.9' &&
675
675
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
676
676
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
677
677
  ) {
678
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.`
679
+ `Native binding package version mismatch, expected 0.1.9 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`
680
680
  );
681
681
  }
682
682
  return binding;
@@ -742,12 +742,12 @@ if (!nativeBinding) {
742
742
  }
743
743
 
744
744
  module.exports = nativeBinding;
745
+ module.exports.Mark = nativeBinding.Mark;
746
+ module.exports.load = nativeBinding.load;
747
+ module.exports.loadAll = nativeBinding.loadAll;
745
748
  module.exports.safeDump = nativeBinding.safeDump;
746
749
  module.exports.safeDumpAll = nativeBinding.safeDumpAll;
747
750
  module.exports.safeLoad = nativeBinding.safeLoad;
748
751
  module.exports.safeLoadAll = nativeBinding.safeLoadAll;
752
+ module.exports.Schema = nativeBinding.Schema;
749
753
  module.exports.version = nativeBinding.version;
750
-
751
- // Aliases for js-yaml compatibility
752
- module.exports.load = nativeBinding.safeLoad;
753
- module.exports.dump = nativeBinding.safeDump;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fastyaml-rs",
3
- "version": "0.1.9",
3
+ "version": "0.1.10",
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",