yaml 2.0.1 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/browser/dist/compose/compose-collection.js +1 -1
- package/browser/dist/compose/compose-doc.js +2 -2
- package/browser/dist/compose/compose-scalar.js +6 -7
- package/browser/dist/compose/composer.js +2 -3
- package/browser/dist/compose/resolve-block-map.js +5 -6
- package/browser/dist/compose/resolve-block-scalar.js +1 -1
- package/browser/dist/compose/resolve-flow-collection.js +3 -4
- package/browser/dist/compose/resolve-flow-scalar.js +1 -2
- package/browser/dist/compose/resolve-props.js +2 -2
- package/browser/dist/compose/util-empty-scalar-position.js +1 -1
- package/browser/dist/compose/util-flow-indent-check.js +1 -1
- package/browser/dist/doc/Document.js +6 -6
- package/browser/dist/doc/createNode.js +5 -7
- package/browser/dist/nodes/Collection.js +2 -1
- package/browser/dist/nodes/Pair.js +2 -2
- package/browser/dist/nodes/Scalar.js +1 -1
- package/browser/dist/nodes/YAMLMap.js +6 -7
- package/browser/dist/nodes/YAMLSeq.js +1 -9
- package/browser/dist/nodes/addPairToJSMap.js +1 -1
- package/browser/dist/nodes/toJS.js +1 -1
- package/browser/dist/parse/cst-scalar.js +1 -2
- package/browser/dist/parse/cst-visit.js +2 -2
- package/browser/dist/parse/lexer.js +1 -2
- package/browser/dist/parse/parser.js +10 -14
- package/browser/dist/public-api.js +3 -4
- package/browser/dist/schema/Schema.js +1 -1
- package/browser/dist/schema/yaml-1.1/omap.js +1 -1
- package/browser/dist/schema/yaml-1.1/pairs.js +1 -2
- package/browser/dist/schema/yaml-1.1/set.js +4 -0
- package/browser/dist/stringify/stringify.js +6 -8
- package/browser/dist/stringify/stringifyCollection.js +1 -2
- package/browser/dist/stringify/stringifyDocument.js +1 -2
- package/browser/dist/stringify/stringifyString.js +2 -2
- package/browser/dist/visit.js +5 -6
- package/dist/compose/compose-collection.js +1 -1
- package/dist/compose/compose-doc.js +2 -2
- package/dist/compose/compose-scalar.js +6 -7
- package/dist/compose/composer.js +2 -3
- package/dist/compose/resolve-block-map.js +5 -6
- package/dist/compose/resolve-block-scalar.js +1 -1
- package/dist/compose/resolve-flow-collection.js +3 -4
- package/dist/compose/resolve-flow-scalar.js +1 -2
- package/dist/compose/resolve-props.js +2 -2
- package/dist/compose/util-empty-scalar-position.js +1 -1
- package/dist/compose/util-flow-indent-check.js +1 -1
- package/dist/doc/Document.d.ts +10 -10
- package/dist/doc/Document.js +6 -6
- package/dist/doc/anchors.d.ts +1 -1
- package/dist/doc/createNode.js +5 -7
- package/dist/index.d.ts +2 -0
- package/dist/nodes/Collection.d.ts +2 -2
- package/dist/nodes/Collection.js +2 -1
- package/dist/nodes/Node.d.ts +14 -10
- package/dist/nodes/Pair.d.ts +1 -1
- package/dist/nodes/Pair.js +2 -2
- package/dist/nodes/Scalar.js +1 -1
- package/dist/nodes/YAMLMap.d.ts +6 -3
- package/dist/nodes/YAMLMap.js +6 -7
- package/dist/nodes/YAMLSeq.d.ts +4 -1
- package/dist/nodes/YAMLSeq.js +1 -9
- package/dist/nodes/addPairToJSMap.js +1 -1
- package/dist/nodes/toJS.js +1 -1
- package/dist/options.d.ts +2 -1
- package/dist/parse/cst-scalar.js +1 -2
- package/dist/parse/cst-visit.js +2 -2
- package/dist/parse/lexer.js +1 -2
- package/dist/parse/parser.js +10 -14
- package/dist/public-api.js +3 -4
- package/dist/schema/Schema.js +1 -1
- package/dist/schema/json-schema.d.ts +69 -0
- package/dist/schema/yaml-1.1/omap.d.ts +7 -3
- package/dist/schema/yaml-1.1/omap.js +1 -1
- package/dist/schema/yaml-1.1/pairs.js +1 -2
- package/dist/schema/yaml-1.1/set.d.ts +6 -2
- package/dist/schema/yaml-1.1/set.js +4 -0
- package/dist/stringify/stringify.js +6 -8
- package/dist/stringify/stringifyCollection.js +1 -2
- package/dist/stringify/stringifyDocument.js +1 -2
- package/dist/stringify/stringifyString.js +2 -2
- package/dist/test-events.js +2 -3
- package/dist/visit.js +5 -6
- package/package.json +3 -3
- package/dist/node_modules/tslib/tslib.es6.js +0 -76
|
@@ -265,9 +265,9 @@ function plainString(item, ctx, onComment, onChompKeep) {
|
|
|
265
265
|
// booleans get parsed with those types in v1.2 (e.g. '42', 'true' & '0.9e-3'),
|
|
266
266
|
// and others in v1.1.
|
|
267
267
|
if (actualString) {
|
|
268
|
-
const test = (tag) =>
|
|
268
|
+
const test = (tag) => tag.default && tag.tag !== 'tag:yaml.org,2002:str' && tag.test?.test(str);
|
|
269
269
|
const { compat, tags } = ctx.doc.schema;
|
|
270
|
-
if (tags.some(test) ||
|
|
270
|
+
if (tags.some(test) || compat?.some(test))
|
|
271
271
|
return quotedString(value, ctx);
|
|
272
272
|
}
|
|
273
273
|
return implicitKey
|
package/dist/test-events.js
CHANGED
|
@@ -25,7 +25,6 @@ function anchorExists(doc, anchor) {
|
|
|
25
25
|
}
|
|
26
26
|
// test harness for yaml-test-suite event tests
|
|
27
27
|
function testEvents(src) {
|
|
28
|
-
var _a;
|
|
29
28
|
const docs = publicApi.parseAllDocuments(src);
|
|
30
29
|
const errDoc = docs.find(doc => doc.errors.length > 0);
|
|
31
30
|
const error = errDoc ? errDoc.errors[0].message : null;
|
|
@@ -49,7 +48,7 @@ function testEvents(src) {
|
|
|
49
48
|
!doc.contents.tag)
|
|
50
49
|
continue;
|
|
51
50
|
events.push(docStart);
|
|
52
|
-
addEvents(events, doc,
|
|
51
|
+
addEvents(events, doc, error?.pos[0] ?? -1, root);
|
|
53
52
|
let docEnd = '-DOC';
|
|
54
53
|
if (doc.directives.docEnd)
|
|
55
54
|
docEnd += ' ...';
|
|
@@ -57,7 +56,7 @@ function testEvents(src) {
|
|
|
57
56
|
}
|
|
58
57
|
}
|
|
59
58
|
catch (e) {
|
|
60
|
-
return { events, error: error
|
|
59
|
+
return { events, error: error ?? e };
|
|
61
60
|
}
|
|
62
61
|
events.push('-STR');
|
|
63
62
|
return { events, error };
|
package/dist/visit.js
CHANGED
|
@@ -198,19 +198,18 @@ function initVisitor(visitor) {
|
|
|
198
198
|
return visitor;
|
|
199
199
|
}
|
|
200
200
|
function callVisitor(key, node, visitor, path) {
|
|
201
|
-
var _a, _b, _c, _d, _e;
|
|
202
201
|
if (typeof visitor === 'function')
|
|
203
202
|
return visitor(key, node, path);
|
|
204
203
|
if (Node.isMap(node))
|
|
205
|
-
return
|
|
204
|
+
return visitor.Map?.(key, node, path);
|
|
206
205
|
if (Node.isSeq(node))
|
|
207
|
-
return
|
|
206
|
+
return visitor.Seq?.(key, node, path);
|
|
208
207
|
if (Node.isPair(node))
|
|
209
|
-
return
|
|
208
|
+
return visitor.Pair?.(key, node, path);
|
|
210
209
|
if (Node.isScalar(node))
|
|
211
|
-
return
|
|
210
|
+
return visitor.Scalar?.(key, node, path);
|
|
212
211
|
if (Node.isAlias(node))
|
|
213
|
-
return
|
|
212
|
+
return visitor.Alias?.(key, node, path);
|
|
214
213
|
return undefined;
|
|
215
214
|
}
|
|
216
215
|
function replaceNode(key, path, node) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "yaml",
|
|
3
|
-
"version": "2.0
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"license": "ISC",
|
|
5
5
|
"author": "Eemeli Aro <eemeli@gmail.com>",
|
|
6
6
|
"repository": "github:eemeli/yaml",
|
|
@@ -76,12 +76,12 @@
|
|
|
76
76
|
"@types/node": "^12.20.47",
|
|
77
77
|
"@typescript-eslint/eslint-plugin": "^5.3.1",
|
|
78
78
|
"@typescript-eslint/parser": "^5.3.1",
|
|
79
|
-
"babel-jest": "^
|
|
79
|
+
"babel-jest": "^28.1.0",
|
|
80
80
|
"cross-env": "^7.0.3",
|
|
81
81
|
"eslint": "^8.2.0",
|
|
82
82
|
"eslint-config-prettier": "^8.1.0",
|
|
83
83
|
"fast-check": "^2.12.0",
|
|
84
|
-
"jest": "^
|
|
84
|
+
"jest": "^28.1.0",
|
|
85
85
|
"jest-ts-webcompat-resolver": "^1.0.0",
|
|
86
86
|
"prettier": "^2.2.1",
|
|
87
87
|
"rollup": "^2.38.2",
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
/*! *****************************************************************************
|
|
4
|
-
Copyright (c) Microsoft Corporation.
|
|
5
|
-
|
|
6
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
7
|
-
purpose with or without fee is hereby granted.
|
|
8
|
-
|
|
9
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
10
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
11
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
12
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
13
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
14
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
15
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
16
|
-
***************************************************************************** */
|
|
17
|
-
/* global Reflect, Promise */
|
|
18
|
-
|
|
19
|
-
var extendStatics = function(d, b) {
|
|
20
|
-
extendStatics = Object.setPrototypeOf ||
|
|
21
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
22
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
23
|
-
return extendStatics(d, b);
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
function __extends(d, b) {
|
|
27
|
-
if (typeof b !== "function" && b !== null)
|
|
28
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
29
|
-
extendStatics(d, b);
|
|
30
|
-
function __() { this.constructor = d; }
|
|
31
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
function __generator(thisArg, body) {
|
|
35
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
36
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
37
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
38
|
-
function step(op) {
|
|
39
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
40
|
-
while (_) try {
|
|
41
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
42
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
43
|
-
switch (op[0]) {
|
|
44
|
-
case 0: case 1: t = op; break;
|
|
45
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
46
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
47
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
48
|
-
default:
|
|
49
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
50
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
51
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
52
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
53
|
-
if (t[2]) _.ops.pop();
|
|
54
|
-
_.trys.pop(); continue;
|
|
55
|
-
}
|
|
56
|
-
op = body.call(thisArg, _);
|
|
57
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
58
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
function __values(o) {
|
|
63
|
-
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
64
|
-
if (m) return m.call(o);
|
|
65
|
-
if (o && typeof o.length === "number") return {
|
|
66
|
-
next: function () {
|
|
67
|
-
if (o && i >= o.length) o = void 0;
|
|
68
|
-
return { value: o && o[i++], done: !o };
|
|
69
|
-
}
|
|
70
|
-
};
|
|
71
|
-
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
exports.__extends = __extends;
|
|
75
|
-
exports.__generator = __generator;
|
|
76
|
-
exports.__values = __values;
|