step-node-agent 3.29.0 → 3.29.2

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 (64) hide show
  1. package/node_modules/body-parser/HISTORY.md +8 -0
  2. package/node_modules/body-parser/lib/types/urlencoded.js +2 -9
  3. package/node_modules/body-parser/package.json +9 -10
  4. package/node_modules/cookie/index.js +2 -1
  5. package/node_modules/cookie/package.json +1 -1
  6. package/node_modules/cookie-signature/History.md +5 -1
  7. package/node_modules/cookie-signature/index.js +6 -6
  8. package/node_modules/cookie-signature/package.json +2 -2
  9. package/node_modules/express/History.md +11 -0
  10. package/node_modules/express/package.json +17 -17
  11. package/node_modules/finalhandler/HISTORY.md +6 -0
  12. package/node_modules/finalhandler/package.json +3 -3
  13. package/node_modules/http-errors/HISTORY.md +6 -0
  14. package/node_modules/http-errors/index.js +4 -3
  15. package/node_modules/http-errors/package.json +12 -8
  16. package/node_modules/qs/.github/SECURITY.md +11 -0
  17. package/node_modules/qs/.github/THREAT_MODEL.md +78 -0
  18. package/node_modules/qs/CHANGELOG.md +31 -0
  19. package/node_modules/qs/README.md +25 -1
  20. package/node_modules/qs/dist/qs.js +95 -44
  21. package/node_modules/qs/eslint.config.mjs +56 -0
  22. package/node_modules/qs/lib/parse.js +107 -43
  23. package/node_modules/qs/lib/stringify.js +11 -6
  24. package/node_modules/qs/lib/utils.js +61 -6
  25. package/node_modules/qs/package.json +15 -12
  26. package/node_modules/qs/test/parse.js +257 -31
  27. package/node_modules/qs/test/stringify.js +23 -11
  28. package/node_modules/qs/test/utils.js +245 -0
  29. package/node_modules/raw-body/package.json +5 -7
  30. package/node_modules/send/HISTORY.md +19 -7
  31. package/node_modules/send/package.json +6 -6
  32. package/node_modules/serve-static/HISTORY.md +6 -0
  33. package/node_modules/serve-static/package.json +2 -2
  34. package/node_modules/statuses/HISTORY.md +5 -0
  35. package/node_modules/statuses/README.md +3 -0
  36. package/node_modules/statuses/package.json +7 -7
  37. package/node_modules/yaml/browser/dist/compose/compose-collection.js +1 -1
  38. package/node_modules/yaml/browser/dist/compose/resolve-block-seq.js +1 -1
  39. package/node_modules/yaml/browser/dist/compose/resolve-flow-collection.js +2 -2
  40. package/node_modules/yaml/browser/dist/errors.js +1 -1
  41. package/node_modules/yaml/browser/dist/nodes/Alias.js +1 -1
  42. package/node_modules/yaml/browser/dist/parse/parser.js +2 -2
  43. package/node_modules/yaml/browser/dist/stringify/stringifyNumber.js +1 -1
  44. package/node_modules/yaml/browser/dist/stringify/stringifyPair.js +1 -1
  45. package/node_modules/yaml/dist/compose/compose-collection.js +1 -1
  46. package/node_modules/yaml/dist/compose/resolve-block-seq.js +1 -1
  47. package/node_modules/yaml/dist/compose/resolve-flow-collection.js +2 -2
  48. package/node_modules/yaml/dist/errors.js +1 -1
  49. package/node_modules/yaml/dist/nodes/Alias.js +1 -1
  50. package/node_modules/yaml/dist/parse/parser.js +2 -2
  51. package/node_modules/yaml/dist/stringify/stringifyNumber.js +1 -1
  52. package/node_modules/yaml/dist/stringify/stringifyPair.js +1 -1
  53. package/node_modules/yaml/package.json +4 -4
  54. package/package.json +1 -1
  55. package/node_modules/body-parser/SECURITY.md +0 -25
  56. package/node_modules/cookie-signature/.npmignore +0 -4
  57. package/node_modules/qs/.eslintrc +0 -38
  58. package/node_modules/raw-body/HISTORY.md +0 -308
  59. package/node_modules/raw-body/SECURITY.md +0 -24
  60. package/node_modules/send/node_modules/encodeurl/HISTORY.md +0 -14
  61. package/node_modules/send/node_modules/encodeurl/LICENSE +0 -22
  62. package/node_modules/send/node_modules/encodeurl/README.md +0 -128
  63. package/node_modules/send/node_modules/encodeurl/index.js +0 -60
  64. package/node_modules/send/node_modules/encodeurl/package.json +0 -40
@@ -4,6 +4,8 @@ var test = require('tape');
4
4
  var inspect = require('object-inspect');
5
5
  var SaferBuffer = require('safer-buffer').Buffer;
6
6
  var forEach = require('for-each');
7
+ var v = require('es-value-fixtures');
8
+
7
9
  var utils = require('../lib/utils');
8
10
 
9
11
  test('merge()', function (t) {
@@ -28,6 +30,20 @@ test('merge()', function (t) {
28
30
  var noOptionsNonObjectSource = utils.merge({ foo: 'baz' }, 'bar');
29
31
  t.deepEqual(noOptionsNonObjectSource, { foo: 'baz', bar: true });
30
32
 
33
+ var func = function f() {};
34
+ t.deepEqual(
35
+ utils.merge(func, { foo: 'bar' }),
36
+ [func, { foo: 'bar' }],
37
+ 'functions can not be merged into'
38
+ );
39
+
40
+ func.bar = 'baz';
41
+ t.deepEqual(
42
+ utils.merge({ foo: 'bar' }, func),
43
+ { foo: 'bar', bar: 'baz' },
44
+ 'functions can be merge sources'
45
+ );
46
+
31
47
  t.test(
32
48
  'avoids invoking array setters unnecessarily',
33
49
  { skip: typeof Object.defineProperty !== 'function' },
@@ -52,6 +68,60 @@ test('merge()', function (t) {
52
68
  }
53
69
  );
54
70
 
71
+ t.test('with overflow objects (from arrayLimit)', function (st) {
72
+ st.test('merges primitive into overflow object at next index', function (s2t) {
73
+ // Create an overflow object via combine
74
+ var overflow = utils.combine(['a'], 'b', 1, false);
75
+ s2t.ok(utils.isOverflow(overflow), 'overflow object is marked');
76
+ var merged = utils.merge(overflow, 'c');
77
+ s2t.deepEqual(merged, { 0: 'a', 1: 'b', 2: 'c' }, 'adds primitive at next numeric index');
78
+ s2t.end();
79
+ });
80
+
81
+ st.test('merges primitive into regular object with numeric keys normally', function (s2t) {
82
+ var obj = { 0: 'a', 1: 'b' };
83
+ s2t.notOk(utils.isOverflow(obj), 'plain object is not marked as overflow');
84
+ var merged = utils.merge(obj, 'c');
85
+ s2t.deepEqual(merged, { 0: 'a', 1: 'b', c: true }, 'adds primitive as key (not at next index)');
86
+ s2t.end();
87
+ });
88
+
89
+ st.test('merges primitive into object with non-numeric keys normally', function (s2t) {
90
+ var obj = { foo: 'bar' };
91
+ var merged = utils.merge(obj, 'baz');
92
+ s2t.deepEqual(merged, { foo: 'bar', baz: true }, 'adds primitive as key with value true');
93
+ s2t.end();
94
+ });
95
+
96
+ st.test('merges overflow object into primitive', function (s2t) {
97
+ // Create an overflow object via combine
98
+ var overflow = utils.combine([], 'b', 0, false);
99
+ s2t.ok(utils.isOverflow(overflow), 'overflow object is marked');
100
+ var merged = utils.merge('a', overflow);
101
+ s2t.ok(utils.isOverflow(merged), 'result is also marked as overflow');
102
+ s2t.deepEqual(merged, { 0: 'a', 1: 'b' }, 'creates object with primitive at 0, source values shifted');
103
+ s2t.end();
104
+ });
105
+
106
+ st.test('merges overflow object with multiple values into primitive', function (s2t) {
107
+ // Create an overflow object via combine
108
+ var overflow = utils.combine(['b'], 'c', 1, false);
109
+ s2t.ok(utils.isOverflow(overflow), 'overflow object is marked');
110
+ var merged = utils.merge('a', overflow);
111
+ s2t.deepEqual(merged, { 0: 'a', 1: 'b', 2: 'c' }, 'shifts all source indices by 1');
112
+ s2t.end();
113
+ });
114
+
115
+ st.test('merges regular object into primitive as array', function (s2t) {
116
+ var obj = { foo: 'bar' };
117
+ var merged = utils.merge('a', obj);
118
+ s2t.deepEqual(merged, ['a', { foo: 'bar' }], 'creates array with primitive and object');
119
+ s2t.end();
120
+ });
121
+
122
+ st.end();
123
+ });
124
+
55
125
  t.end();
56
126
  });
57
127
 
@@ -116,6 +186,169 @@ test('combine()', function (t) {
116
186
  st.end();
117
187
  });
118
188
 
189
+ t.test('with arrayLimit', function (st) {
190
+ st.test('under the limit', function (s2t) {
191
+ var combined = utils.combine(['a', 'b'], 'c', 10, false);
192
+ s2t.deepEqual(combined, ['a', 'b', 'c'], 'returns array when under limit');
193
+ s2t.ok(Array.isArray(combined), 'result is an array');
194
+ s2t.end();
195
+ });
196
+
197
+ st.test('exactly at the limit stays as array', function (s2t) {
198
+ var combined = utils.combine(['a', 'b'], 'c', 3, false);
199
+ s2t.deepEqual(combined, ['a', 'b', 'c'], 'stays as array when exactly at limit');
200
+ s2t.ok(Array.isArray(combined), 'result is an array');
201
+ s2t.end();
202
+ });
203
+
204
+ st.test('over the limit', function (s2t) {
205
+ var combined = utils.combine(['a', 'b', 'c'], 'd', 3, false);
206
+ s2t.deepEqual(combined, { 0: 'a', 1: 'b', 2: 'c', 3: 'd' }, 'converts to object when over limit');
207
+ s2t.notOk(Array.isArray(combined), 'result is not an array');
208
+ s2t.end();
209
+ });
210
+
211
+ st.test('with arrayLimit 0', function (s2t) {
212
+ var combined = utils.combine([], 'a', 0, false);
213
+ s2t.deepEqual(combined, { 0: 'a' }, 'converts single element to object with arrayLimit 0');
214
+ s2t.notOk(Array.isArray(combined), 'result is not an array');
215
+ s2t.end();
216
+ });
217
+
218
+ st.test('with plainObjects option', function (s2t) {
219
+ var combined = utils.combine(['a'], 'b', 1, true);
220
+ var expected = { __proto__: null, 0: 'a', 1: 'b' };
221
+ s2t.deepEqual(combined, expected, 'converts to object with null prototype');
222
+ s2t.equal(Object.getPrototypeOf(combined), null, 'result has null prototype when plainObjects is true');
223
+ s2t.end();
224
+ });
225
+
226
+ st.end();
227
+ });
228
+
229
+ t.test('with existing overflow object', function (st) {
230
+ st.test('adds to existing overflow object at next index', function (s2t) {
231
+ // Create overflow object first via combine
232
+ var overflow = utils.combine(['a'], 'b', 1, false);
233
+ s2t.ok(utils.isOverflow(overflow), 'initial object is marked as overflow');
234
+
235
+ var combined = utils.combine(overflow, 'c', 10, false);
236
+ s2t.equal(combined, overflow, 'returns the same object (mutated)');
237
+ s2t.deepEqual(combined, { 0: 'a', 1: 'b', 2: 'c' }, 'adds value at next numeric index');
238
+ s2t.end();
239
+ });
240
+
241
+ st.test('does not treat plain object with numeric keys as overflow', function (s2t) {
242
+ var plainObj = { 0: 'a', 1: 'b' };
243
+ s2t.notOk(utils.isOverflow(plainObj), 'plain object is not marked as overflow');
244
+
245
+ // combine treats this as a regular value, not an overflow object to append to
246
+ var combined = utils.combine(plainObj, 'c', 10, false);
247
+ s2t.deepEqual(combined, [{ 0: 'a', 1: 'b' }, 'c'], 'concatenates as regular values');
248
+ s2t.end();
249
+ });
250
+
251
+ st.end();
252
+ });
253
+
254
+ t.end();
255
+ });
256
+
257
+ test('decode', function (t) {
258
+ t.equal(
259
+ utils.decode('a+b'),
260
+ 'a b',
261
+ 'decodes + to space'
262
+ );
263
+
264
+ t.equal(
265
+ utils.decode('name%2Eobj'),
266
+ 'name.obj',
267
+ 'decodes a string'
268
+ );
269
+ t.equal(
270
+ utils.decode('name%2Eobj%2Efoo', null, 'iso-8859-1'),
271
+ 'name.obj.foo',
272
+ 'decodes a string in iso-8859-1'
273
+ );
274
+
275
+ t.end();
276
+ });
277
+
278
+ test('encode', function (t) {
279
+ forEach(v.nullPrimitives, function (nullish) {
280
+ t['throws'](
281
+ function () { utils.encode(nullish); },
282
+ TypeError,
283
+ inspect(nullish) + ' is not a string'
284
+ );
285
+ });
286
+
287
+ t.equal(utils.encode(''), '', 'empty string returns itself');
288
+ t.deepEqual(utils.encode([]), [], 'empty array returns itself');
289
+ t.deepEqual(utils.encode({ length: 0 }), { length: 0 }, 'empty arraylike returns itself');
290
+
291
+ t.test('symbols', { skip: !v.hasSymbols }, function (st) {
292
+ st.equal(utils.encode(Symbol('x')), 'Symbol%28x%29', 'symbol is encoded');
293
+
294
+ st.end();
295
+ });
296
+
297
+ t.equal(
298
+ utils.encode('(abc)'),
299
+ '%28abc%29',
300
+ 'encodes parentheses'
301
+ );
302
+ t.equal(
303
+ utils.encode({ toString: function () { return '(abc)'; } }),
304
+ '%28abc%29',
305
+ 'toStrings and encodes parentheses'
306
+ );
307
+
308
+ t.equal(
309
+ utils.encode('abc 123 💩', null, 'iso-8859-1'),
310
+ 'abc%20123%20%26%2355357%3B%26%2356489%3B',
311
+ 'encodes in iso-8859-1'
312
+ );
313
+
314
+ var longString = '';
315
+ var expectedString = '';
316
+ for (var i = 0; i < 1500; i++) {
317
+ longString += ' ';
318
+ expectedString += '%20';
319
+ }
320
+
321
+ t.equal(
322
+ utils.encode(longString),
323
+ expectedString,
324
+ 'encodes a long string'
325
+ );
326
+
327
+ t.equal(
328
+ utils.encode('\x28\x29'),
329
+ '%28%29',
330
+ 'encodes parens normally'
331
+ );
332
+ t.equal(
333
+ utils.encode('\x28\x29', null, null, null, 'RFC1738'),
334
+ '()',
335
+ 'does not encode parens in RFC1738'
336
+ );
337
+
338
+ // todo RFC1738 format
339
+
340
+ t.equal(
341
+ utils.encode('Āက豈'),
342
+ '%C4%80%E1%80%80%EF%A4%80',
343
+ 'encodes multibyte chars'
344
+ );
345
+
346
+ t.equal(
347
+ utils.encode('\uD83D \uDCA9'),
348
+ '%F0%9F%90%A0%F0%BA%90%80',
349
+ 'encodes lone surrogates'
350
+ );
351
+
119
352
  t.end();
120
353
  });
121
354
 
@@ -134,3 +367,15 @@ test('isBuffer()', function (t) {
134
367
  t.equal(utils.isBuffer(buffer), true, 'real Buffer instance is a buffer');
135
368
  t.end();
136
369
  });
370
+
371
+ test('isRegExp()', function (t) {
372
+ t.equal(utils.isRegExp(/a/g), true, 'RegExp is a RegExp');
373
+ t.equal(utils.isRegExp(new RegExp('a', 'g')), true, 'new RegExp is a RegExp');
374
+ t.equal(utils.isRegExp(new Date()), false, 'Date is not a RegExp');
375
+
376
+ forEach(v.primitives, function (primitive) {
377
+ t.equal(utils.isRegExp(primitive), false, inspect(primitive) + ' is not a RegExp');
378
+ });
379
+
380
+ t.end();
381
+ });
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "raw-body",
3
3
  "description": "Get and validate the raw body of a readable stream.",
4
- "version": "2.5.2",
4
+ "version": "2.5.3",
5
5
  "author": "Jonathan Ong <me@jongleberry.com> (http://jongleberry.com)",
6
6
  "contributors": [
7
7
  "Douglas Christopher Wilson <doug@somethingdoug.com>",
@@ -10,10 +10,10 @@
10
10
  "license": "MIT",
11
11
  "repository": "stream-utils/raw-body",
12
12
  "dependencies": {
13
- "bytes": "3.1.2",
14
- "http-errors": "2.0.0",
15
- "iconv-lite": "0.4.24",
16
- "unpipe": "1.0.0"
13
+ "bytes": "~3.1.2",
14
+ "http-errors": "~2.0.1",
15
+ "iconv-lite": "~0.4.24",
16
+ "unpipe": "~1.0.0"
17
17
  },
18
18
  "devDependencies": {
19
19
  "bluebird": "3.7.2",
@@ -33,10 +33,8 @@
33
33
  "node": ">= 0.8"
34
34
  },
35
35
  "files": [
36
- "HISTORY.md",
37
36
  "LICENSE",
38
37
  "README.md",
39
- "SECURITY.md",
40
38
  "index.d.ts",
41
39
  "index.js"
42
40
  ],
@@ -1,3 +1,15 @@
1
+ 0.19.2 / 2025-12-15
2
+ ===================
3
+
4
+ * deps: use tilde notation for dependencies
5
+ * deps: http-errors@~2.0.1
6
+ * deps: statuses@~2.0.2
7
+
8
+ 0.19.1 / 2024-10-09
9
+ ===================
10
+
11
+ * deps: encodeurl@~2.0.0
12
+
1
13
  0.19.0 / 2024-09-10
2
14
  ===================
3
15
 
@@ -485,37 +497,37 @@
485
497
 
486
498
  * update range-parser and fresh
487
499
 
488
- 0.1.4 / 2013-08-11
500
+ 0.1.4 / 2013-08-11
489
501
  ==================
490
502
 
491
503
  * update fresh
492
504
 
493
- 0.1.3 / 2013-07-08
505
+ 0.1.3 / 2013-07-08
494
506
  ==================
495
507
 
496
508
  * Revert "Fix fd leak"
497
509
 
498
- 0.1.2 / 2013-07-03
510
+ 0.1.2 / 2013-07-03
499
511
  ==================
500
512
 
501
513
  * Fix fd leak
502
514
 
503
- 0.1.0 / 2012-08-25
515
+ 0.1.0 / 2012-08-25
504
516
  ==================
505
517
 
506
518
  * add options parameter to send() that is passed to fs.createReadStream() [kanongil]
507
519
 
508
- 0.0.4 / 2012-08-16
520
+ 0.0.4 / 2012-08-16
509
521
  ==================
510
522
 
511
523
  * allow custom "Accept-Ranges" definition
512
524
 
513
- 0.0.3 / 2012-07-16
525
+ 0.0.3 / 2012-07-16
514
526
  ==================
515
527
 
516
528
  * fix normalization of the root directory. Closes #3
517
529
 
518
- 0.0.2 / 2012-07-09
530
+ 0.0.2 / 2012-07-09
519
531
  ==================
520
532
 
521
533
  * add passing of req explicitly for now (YUCK)
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "send",
3
3
  "description": "Better streaming static file server with Range and conditional-GET support",
4
- "version": "0.19.0",
4
+ "version": "0.19.2",
5
5
  "author": "TJ Holowaychuk <tj@vision-media.ca>",
6
6
  "contributors": [
7
7
  "Douglas Christopher Wilson <doug@somethingdoug.com>",
@@ -19,16 +19,16 @@
19
19
  "debug": "2.6.9",
20
20
  "depd": "2.0.0",
21
21
  "destroy": "1.2.0",
22
- "encodeurl": "~1.0.2",
22
+ "encodeurl": "~2.0.0",
23
23
  "escape-html": "~1.0.3",
24
24
  "etag": "~1.8.1",
25
- "fresh": "0.5.2",
26
- "http-errors": "2.0.0",
25
+ "fresh": "~0.5.2",
26
+ "http-errors": "~2.0.1",
27
27
  "mime": "1.6.0",
28
28
  "ms": "2.1.3",
29
- "on-finished": "2.4.1",
29
+ "on-finished": "~2.4.1",
30
30
  "range-parser": "~1.2.1",
31
- "statuses": "2.0.1"
31
+ "statuses": "~2.0.2"
32
32
  },
33
33
  "devDependencies": {
34
34
  "after": "0.8.2",
@@ -1,3 +1,9 @@
1
+ 1.16.3 / 2024-12-15
2
+ ===================
3
+
4
+ * deps: send@~0.19.1
5
+ - deps: encodeurl@~2.0.0
6
+
1
7
  1.16.2 / 2024-09-11
2
8
  ===================
3
9
 
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "serve-static",
3
3
  "description": "Serve static files",
4
- "version": "1.16.2",
4
+ "version": "1.16.3",
5
5
  "author": "Douglas Christopher Wilson <doug@somethingdoug.com>",
6
6
  "license": "MIT",
7
7
  "repository": "expressjs/serve-static",
@@ -9,7 +9,7 @@
9
9
  "encodeurl": "~2.0.0",
10
10
  "escape-html": "~1.0.3",
11
11
  "parseurl": "~1.3.3",
12
- "send": "0.19.0"
12
+ "send": "~0.19.1"
13
13
  },
14
14
  "devDependencies": {
15
15
  "eslint": "7.32.0",
@@ -1,3 +1,8 @@
1
+ 2.0.2 / 2025-06-06
2
+ ==================
3
+
4
+ * Migrate to `String.prototype.slice()`
5
+
1
6
  2.0.1 / 2021-01-03
2
7
  ==================
3
8
 
@@ -5,6 +5,7 @@
5
5
  [![Node.js Version][node-version-image]][node-version-url]
6
6
  [![Build Status][ci-image]][ci-url]
7
7
  [![Test Coverage][coveralls-image]][coveralls-url]
8
+ [![OpenSSF Scorecard Badge][ossf-scorecard-badge]][ossf-scorecard-visualizer]
8
9
 
9
10
  HTTP status utility for node.
10
11
 
@@ -134,3 +135,5 @@ status.retry[503] // => true
134
135
  [npm-downloads-image]: https://badgen.net/npm/dm/statuses
135
136
  [npm-url]: https://npmjs.org/package/statuses
136
137
  [npm-version-image]: https://badgen.net/npm/v/statuses
138
+ [ossf-scorecard-badge]: https://api.securityscorecards.dev/projects/github.com/jshttp/statuses/badge
139
+ [ossf-scorecard-visualizer]: https://kooltheba.github.io/openssf-scorecard-api-visualizer/#/projects/github.com/jshttp/statuses
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "statuses",
3
3
  "description": "HTTP status utility",
4
- "version": "2.0.1",
4
+ "version": "2.0.2",
5
5
  "contributors": [
6
6
  "Douglas Christopher Wilson <doug@somethingdoug.com>",
7
7
  "Jonathan Ong <me@jongleberry.com> (http://jongleberry.com)"
@@ -20,17 +20,17 @@
20
20
  "LICENSE"
21
21
  ],
22
22
  "devDependencies": {
23
- "csv-parse": "4.14.2",
24
- "eslint": "7.17.0",
23
+ "csv-parse": "4.16.3",
24
+ "eslint": "7.19.0",
25
25
  "eslint-config-standard": "14.1.1",
26
- "eslint-plugin-import": "2.22.1",
26
+ "eslint-plugin-import": "2.31.0",
27
27
  "eslint-plugin-markdown": "1.0.2",
28
28
  "eslint-plugin-node": "11.1.0",
29
- "eslint-plugin-promise": "4.2.1",
29
+ "eslint-plugin-promise": "4.3.1",
30
30
  "eslint-plugin-standard": "4.1.0",
31
- "mocha": "8.2.1",
31
+ "mocha": "8.4.0",
32
32
  "nyc": "15.1.0",
33
- "raw-body": "2.4.1",
33
+ "raw-body": "2.5.2",
34
34
  "stream-to-array": "2.3.0"
35
35
  },
36
36
  "engines": {
@@ -59,7 +59,7 @@ function composeCollection(CN, ctx, token, props, onError) {
59
59
  let tag = ctx.schema.tags.find(t => t.tag === tagName && t.collection === expType);
60
60
  if (!tag) {
61
61
  const kt = ctx.schema.knownTags[tagName];
62
- if (kt && kt.collection === expType) {
62
+ if (kt?.collection === expType) {
63
63
  ctx.schema.tags.push(Object.assign({}, kt, { default: false }));
64
64
  tag = kt;
65
65
  }
@@ -22,7 +22,7 @@ function resolveBlockSeq({ composeNode, composeEmptyNode }, ctx, bs, onError, ta
22
22
  });
23
23
  if (!props.found) {
24
24
  if (props.anchor || props.tag || value) {
25
- if (value && value.type === 'block-seq')
25
+ if (value?.type === 'block-seq')
26
26
  onError(props.end, 'BAD_INDENT', 'All sequence items must start at the same column');
27
27
  else
28
28
  onError(offset, 'MISSING_CHAR', 'Sequence item without - indicator');
@@ -133,7 +133,7 @@ function resolveFlowCollection({ composeNode, composeEmptyNode }, ctx, fc, onErr
133
133
  }
134
134
  }
135
135
  else if (value) {
136
- if ('source' in value && value.source && value.source[0] === ':')
136
+ if ('source' in value && value.source?.[0] === ':')
137
137
  onError(value, 'MISSING_CHAR', `Missing space after : in ${fcName}`);
138
138
  else
139
139
  onError(valueProps.start, 'MISSING_CHAR', `Missing , or : between ${fcName} items`);
@@ -177,7 +177,7 @@ function resolveFlowCollection({ composeNode, composeEmptyNode }, ctx, fc, onErr
177
177
  const expectedEnd = isMap ? '}' : ']';
178
178
  const [ce, ...ee] = fc.end;
179
179
  let cePos = offset;
180
- if (ce && ce.source === expectedEnd)
180
+ if (ce?.source === expectedEnd)
181
181
  cePos = ce.offset + ce.source.length;
182
182
  else {
183
183
  const name = fcName[0].toUpperCase() + fcName.substring(1);
@@ -46,7 +46,7 @@ const prettifyError = (src, lc) => (error) => {
46
46
  if (/[^ ]/.test(lineStr)) {
47
47
  let count = 1;
48
48
  const end = error.linePos[1];
49
- if (end && end.line === line && end.col > col) {
49
+ if (end?.line === line && end.col > col) {
50
50
  count = Math.max(1, Math.min(end.col - col, 80 - ci));
51
51
  }
52
52
  const pointer = ' '.repeat(ci) + '^'.repeat(count);
@@ -59,7 +59,7 @@ class Alias extends NodeBase {
59
59
  data = anchors.get(source);
60
60
  }
61
61
  /* istanbul ignore if */
62
- if (!data || data.res === undefined) {
62
+ if (data?.res === undefined) {
63
63
  const msg = 'This should not happen: Alias anchor was not resolved?';
64
64
  throw new ReferenceError(msg);
65
65
  }
@@ -226,7 +226,7 @@ class Parser {
226
226
  }
227
227
  *step() {
228
228
  const top = this.peek(1);
229
- if (this.type === 'doc-end' && (!top || top.type !== 'doc-end')) {
229
+ if (this.type === 'doc-end' && top?.type !== 'doc-end') {
230
230
  while (this.stack.length > 0)
231
231
  yield* this.pop();
232
232
  this.stack.push({
@@ -758,7 +758,7 @@ class Parser {
758
758
  do {
759
759
  yield* this.pop();
760
760
  top = this.peek(1);
761
- } while (top && top.type === 'flow-collection');
761
+ } while (top?.type === 'flow-collection');
762
762
  }
763
763
  else if (fc.end.length === 0) {
764
764
  switch (this.type) {
@@ -4,7 +4,7 @@ function stringifyNumber({ format, minFractionDigits, tag, value }) {
4
4
  const num = typeof value === 'number' ? value : Number(value);
5
5
  if (!isFinite(num))
6
6
  return isNaN(num) ? '.nan' : num < 0 ? '-.inf' : '.inf';
7
- let n = JSON.stringify(value);
7
+ let n = Object.is(value, -0) ? '-0' : JSON.stringify(value);
8
8
  if (!format &&
9
9
  minFractionDigits &&
10
10
  (!tag || tag === 'tag:yaml.org,2002:float') &&
@@ -101,7 +101,7 @@ function stringifyPair({ key, value }, ctx, onComment, onChompKeep) {
101
101
  ws += `\n${indentComment(cs, ctx.indent)}`;
102
102
  }
103
103
  if (valueStr === '' && !ctx.inFlow) {
104
- if (ws === '\n')
104
+ if (ws === '\n' && valueComment)
105
105
  ws = '\n\n';
106
106
  }
107
107
  else {
@@ -61,7 +61,7 @@ function composeCollection(CN, ctx, token, props, onError) {
61
61
  let tag = ctx.schema.tags.find(t => t.tag === tagName && t.collection === expType);
62
62
  if (!tag) {
63
63
  const kt = ctx.schema.knownTags[tagName];
64
- if (kt && kt.collection === expType) {
64
+ if (kt?.collection === expType) {
65
65
  ctx.schema.tags.push(Object.assign({}, kt, { default: false }));
66
66
  tag = kt;
67
67
  }
@@ -24,7 +24,7 @@ function resolveBlockSeq({ composeNode, composeEmptyNode }, ctx, bs, onError, ta
24
24
  });
25
25
  if (!props.found) {
26
26
  if (props.anchor || props.tag || value) {
27
- if (value && value.type === 'block-seq')
27
+ if (value?.type === 'block-seq')
28
28
  onError(props.end, 'BAD_INDENT', 'All sequence items must start at the same column');
29
29
  else
30
30
  onError(offset, 'MISSING_CHAR', 'Sequence item without - indicator');
@@ -135,7 +135,7 @@ function resolveFlowCollection({ composeNode, composeEmptyNode }, ctx, fc, onErr
135
135
  }
136
136
  }
137
137
  else if (value) {
138
- if ('source' in value && value.source && value.source[0] === ':')
138
+ if ('source' in value && value.source?.[0] === ':')
139
139
  onError(value, 'MISSING_CHAR', `Missing space after : in ${fcName}`);
140
140
  else
141
141
  onError(valueProps.start, 'MISSING_CHAR', `Missing , or : between ${fcName} items`);
@@ -179,7 +179,7 @@ function resolveFlowCollection({ composeNode, composeEmptyNode }, ctx, fc, onErr
179
179
  const expectedEnd = isMap ? '}' : ']';
180
180
  const [ce, ...ee] = fc.end;
181
181
  let cePos = offset;
182
- if (ce && ce.source === expectedEnd)
182
+ if (ce?.source === expectedEnd)
183
183
  cePos = ce.offset + ce.source.length;
184
184
  else {
185
185
  const name = fcName[0].toUpperCase() + fcName.substring(1);
@@ -48,7 +48,7 @@ const prettifyError = (src, lc) => (error) => {
48
48
  if (/[^ ]/.test(lineStr)) {
49
49
  let count = 1;
50
50
  const end = error.linePos[1];
51
- if (end && end.line === line && end.col > col) {
51
+ if (end?.line === line && end.col > col) {
52
52
  count = Math.max(1, Math.min(end.col - col, 80 - ci));
53
53
  }
54
54
  const pointer = ' '.repeat(ci) + '^'.repeat(count);
@@ -61,7 +61,7 @@ class Alias extends Node.NodeBase {
61
61
  data = anchors.get(source);
62
62
  }
63
63
  /* istanbul ignore if */
64
- if (!data || data.res === undefined) {
64
+ if (data?.res === undefined) {
65
65
  const msg = 'This should not happen: Alias anchor was not resolved?';
66
66
  throw new ReferenceError(msg);
67
67
  }
@@ -231,7 +231,7 @@ class Parser {
231
231
  }
232
232
  *step() {
233
233
  const top = this.peek(1);
234
- if (this.type === 'doc-end' && (!top || top.type !== 'doc-end')) {
234
+ if (this.type === 'doc-end' && top?.type !== 'doc-end') {
235
235
  while (this.stack.length > 0)
236
236
  yield* this.pop();
237
237
  this.stack.push({
@@ -763,7 +763,7 @@ class Parser {
763
763
  do {
764
764
  yield* this.pop();
765
765
  top = this.peek(1);
766
- } while (top && top.type === 'flow-collection');
766
+ } while (top?.type === 'flow-collection');
767
767
  }
768
768
  else if (fc.end.length === 0) {
769
769
  switch (this.type) {