yaml 1.8.2 → 1.9.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.
- package/browser/dist/Anchors.js +10 -13
- package/browser/dist/Document.js +72 -67
- package/browser/dist/addComment.js +1 -1
- package/browser/dist/cst/Alias.js +12 -8
- package/browser/dist/cst/BlankLine.js +16 -20
- package/browser/dist/cst/BlockValue.js +14 -10
- package/browser/dist/cst/Collection.js +17 -13
- package/browser/dist/cst/CollectionItem.js +15 -11
- package/browser/dist/cst/Comment.js +13 -9
- package/browser/dist/cst/Directive.js +13 -9
- package/browser/dist/cst/Document.js +17 -13
- package/browser/dist/cst/FlowCollection.js +17 -13
- package/browser/dist/cst/Node.js +3 -5
- package/browser/dist/cst/ParseContext.js +12 -14
- package/browser/dist/cst/PlainValue.js +12 -8
- package/browser/dist/cst/QuoteDouble.js +13 -9
- package/browser/dist/cst/QuoteSingle.js +13 -9
- package/browser/dist/cst/Range.js +2 -5
- package/browser/dist/cst/parse.js +3 -3
- package/browser/dist/errors.js +23 -8
- package/browser/dist/foldFlowLines.js +1 -1
- package/browser/dist/index.js +71 -21
- package/browser/dist/listTagNames.js +5 -5
- package/browser/dist/schema/Alias.js +30 -34
- package/browser/dist/schema/Collection.js +40 -47
- package/browser/dist/schema/Map.js +39 -56
- package/browser/dist/schema/Merge.js +37 -46
- package/browser/dist/schema/Node.js +2 -5
- package/browser/dist/schema/Pair.js +36 -13
- package/browser/dist/schema/Scalar.js +13 -9
- package/browser/dist/schema/Seq.js +27 -25
- package/browser/dist/schema/index.js +25 -39
- package/browser/dist/schema/parseMap.js +8 -8
- package/browser/dist/schema/parseSeq.js +5 -5
- package/browser/dist/schema/parseUtils.js +11 -15
- package/browser/dist/stringify.js +2 -1
- package/browser/dist/tags/core.js +39 -23
- package/browser/dist/tags/failsafe/index.js +4 -4
- package/browser/dist/tags/failsafe/map.js +15 -18
- package/browser/dist/tags/failsafe/seq.js +14 -18
- package/browser/dist/tags/failsafe/string.js +1 -1
- package/browser/dist/tags/index.js +10 -10
- package/browser/dist/tags/json.js +27 -26
- package/browser/dist/tags/options.js +3 -0
- package/browser/dist/tags/yaml-1.1/binary.js +10 -8
- package/browser/dist/tags/yaml-1.1/index.js +75 -43
- package/browser/dist/tags/yaml-1.1/omap.js +34 -39
- package/browser/dist/tags/yaml-1.1/pairs.js +17 -20
- package/browser/dist/tags/yaml-1.1/set.js +27 -23
- package/browser/dist/test-events.js +4 -4
- package/browser/dist/toJSON.js +3 -4
- package/browser/dist/warnings.js +29 -18
- package/browser/index.js +1 -1
- package/browser/map.js +4 -2
- package/browser/pair.js +4 -2
- package/browser/parse-cst.js +1 -1
- package/browser/scalar.js +4 -2
- package/browser/schema.js +11 -6
- package/browser/seq.js +4 -2
- package/browser/types/binary.js +5 -6
- package/browser/types/omap.js +4 -2
- package/browser/types/pairs.js +4 -2
- package/browser/types/set.js +4 -2
- package/browser/types/timestamp.js +5 -9
- package/browser/types.js +12 -10
- package/browser/util.js +16 -13
- package/dist/Anchors.js +13 -18
- package/dist/Document.js +52 -48
- package/dist/addComment.js +1 -4
- package/dist/constants.js +0 -3
- package/dist/cst/Alias.js +8 -13
- package/dist/cst/BlankLine.js +8 -24
- package/dist/cst/BlockValue.js +12 -17
- package/dist/cst/Collection.js +22 -27
- package/dist/cst/CollectionItem.js +16 -21
- package/dist/cst/Comment.js +6 -11
- package/dist/cst/Directive.js +7 -12
- package/dist/cst/Document.js +23 -28
- package/dist/cst/FlowCollection.js +21 -26
- package/dist/cst/Node.js +4 -9
- package/dist/cst/ParseContext.js +38 -43
- package/dist/cst/PlainValue.js +10 -15
- package/dist/cst/QuoteDouble.js +9 -14
- package/dist/cst/QuoteSingle.js +9 -14
- package/dist/cst/Range.js +2 -5
- package/dist/cst/parse.js +5 -10
- package/dist/cst/source-utils.js +0 -3
- package/dist/errors.js +4 -9
- package/dist/foldFlowLines.js +1 -4
- package/dist/index.js +59 -17
- package/dist/listTagNames.js +9 -14
- package/dist/schema/Alias.js +12 -17
- package/dist/schema/Collection.js +16 -20
- package/dist/schema/Map.js +12 -17
- package/dist/schema/Merge.js +13 -18
- package/dist/schema/Node.js +2 -5
- package/dist/schema/Pair.js +44 -31
- package/dist/schema/Scalar.js +6 -11
- package/dist/schema/Seq.js +9 -14
- package/dist/schema/index.js +22 -27
- package/dist/schema/parseMap.js +19 -28
- package/dist/schema/parseSeq.js +10 -15
- package/dist/schema/parseUtils.js +0 -3
- package/dist/stringify.js +6 -12
- package/dist/tags/core.js +34 -26
- package/dist/tags/failsafe/index.js +6 -11
- package/dist/tags/failsafe/map.js +8 -13
- package/dist/tags/failsafe/seq.js +8 -13
- package/dist/tags/failsafe/string.js +3 -6
- package/dist/tags/index.js +20 -29
- package/dist/tags/json.js +26 -22
- package/dist/tags/options.js +5 -4
- package/dist/tags/yaml-1.1/binary.js +11 -11
- package/dist/tags/yaml-1.1/index.js +69 -38
- package/dist/tags/yaml-1.1/omap.js +19 -24
- package/dist/tags/yaml-1.1/pairs.js +12 -17
- package/dist/tags/yaml-1.1/set.js +12 -21
- package/dist/tags/yaml-1.1/timestamp.js +0 -3
- package/dist/test-events.js +4 -9
- package/dist/toJSON.js +3 -5
- package/dist/warnings.js +31 -22
- package/index.d.ts +358 -0
- package/index.js +1 -1
- package/map.js +1 -1
- package/package.json +29 -23
- package/pair.js +1 -1
- package/parse-cst.d.ts +187 -0
- package/parse-cst.js +1 -1
- package/scalar.js +1 -1
- package/schema.js +2 -2
- package/seq.js +1 -1
- package/types/binary.js +1 -1
- package/types/omap.js +1 -1
- package/types/pairs.js +1 -1
- package/types/set.js +1 -1
- package/types/timestamp.js +1 -1
- package/types.d.ts +393 -0
- package/types.js +7 -6
- package/types.mjs +6 -5
- package/util.d.ts +86 -0
- package/util.js +6 -5
- package/util.mjs +4 -3
|
@@ -1,47 +1,47 @@
|
|
|
1
1
|
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
2
|
-
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
3
|
-
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
4
2
|
import _createClass from "@babel/runtime/helpers/createClass";
|
|
5
3
|
import _inherits from "@babel/runtime/helpers/inherits";
|
|
4
|
+
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
5
|
+
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
6
6
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
7
|
+
|
|
8
|
+
function _createSuper(Derived) { return function () { var Super = _getPrototypeOf(Derived), result; if (_isNativeReflectConstruct()) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
9
|
+
|
|
10
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
|
|
11
|
+
|
|
12
|
+
function _createForOfIteratorHelper(o) { if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (o = _unsupportedIterableToArray(o))) { var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var it, normalCompletion = true, didErr = false, err; return { s: function s() { it = o[Symbol.iterator](); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
13
|
+
|
|
14
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(n); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
15
|
+
|
|
16
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
17
|
+
|
|
7
18
|
import { Type } from '../constants';
|
|
8
19
|
import { YAMLReferenceError } from '../errors';
|
|
9
|
-
import _toJSON from '../toJSON';
|
|
10
|
-
import Collection from './Collection';
|
|
11
|
-
import Node from './Node';
|
|
12
|
-
import Pair from './Pair';
|
|
20
|
+
import { toJSON as _toJSON } from '../toJSON';
|
|
21
|
+
import { Collection } from './Collection';
|
|
22
|
+
import { Node } from './Node';
|
|
23
|
+
import { Pair } from './Pair';
|
|
13
24
|
|
|
14
25
|
var getAliasCount = function getAliasCount(node, anchors) {
|
|
15
26
|
if (node instanceof Alias) {
|
|
16
|
-
var anchor = anchors.
|
|
17
|
-
return a.node === node.source;
|
|
18
|
-
});
|
|
27
|
+
var anchor = anchors.get(node.source);
|
|
19
28
|
return anchor.count * anchor.aliasCount;
|
|
20
29
|
} else if (node instanceof Collection) {
|
|
21
30
|
var count = 0;
|
|
22
|
-
|
|
23
|
-
var
|
|
24
|
-
|
|
31
|
+
|
|
32
|
+
var _iterator = _createForOfIteratorHelper(node.items),
|
|
33
|
+
_step;
|
|
25
34
|
|
|
26
35
|
try {
|
|
27
|
-
for (
|
|
36
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
28
37
|
var item = _step.value;
|
|
29
38
|
var c = getAliasCount(item, anchors);
|
|
30
39
|
if (c > count) count = c;
|
|
31
40
|
}
|
|
32
41
|
} catch (err) {
|
|
33
|
-
|
|
34
|
-
_iteratorError = err;
|
|
42
|
+
_iterator.e(err);
|
|
35
43
|
} finally {
|
|
36
|
-
|
|
37
|
-
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
38
|
-
_iterator.return();
|
|
39
|
-
}
|
|
40
|
-
} finally {
|
|
41
|
-
if (_didIteratorError) {
|
|
42
|
-
throw _iteratorError;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
44
|
+
_iterator.f();
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
return count;
|
|
@@ -54,9 +54,11 @@ var getAliasCount = function getAliasCount(node, anchors) {
|
|
|
54
54
|
return 1;
|
|
55
55
|
};
|
|
56
56
|
|
|
57
|
-
var Alias = /*#__PURE__*/function (_Node) {
|
|
57
|
+
export var Alias = /*#__PURE__*/function (_Node) {
|
|
58
58
|
_inherits(Alias, _Node);
|
|
59
59
|
|
|
60
|
+
var _super = _createSuper(Alias);
|
|
61
|
+
|
|
60
62
|
_createClass(Alias, null, [{
|
|
61
63
|
key: "stringify",
|
|
62
64
|
value: function stringify(_ref, _ref2) {
|
|
@@ -81,7 +83,7 @@ var Alias = /*#__PURE__*/function (_Node) {
|
|
|
81
83
|
|
|
82
84
|
_classCallCheck(this, Alias);
|
|
83
85
|
|
|
84
|
-
_this =
|
|
86
|
+
_this = _super.call(this);
|
|
85
87
|
_this.source = source;
|
|
86
88
|
_this.type = Type.ALIAS;
|
|
87
89
|
return _this;
|
|
@@ -90,14 +92,10 @@ var Alias = /*#__PURE__*/function (_Node) {
|
|
|
90
92
|
_createClass(Alias, [{
|
|
91
93
|
key: "toJSON",
|
|
92
94
|
value: function toJSON(arg, ctx) {
|
|
93
|
-
var _this2 = this;
|
|
94
|
-
|
|
95
95
|
if (!ctx) return _toJSON(this.source, arg, ctx);
|
|
96
96
|
var anchors = ctx.anchors,
|
|
97
97
|
maxAliasCount = ctx.maxAliasCount;
|
|
98
|
-
var anchor = anchors.
|
|
99
|
-
return a.node === _this2.source;
|
|
100
|
-
});
|
|
98
|
+
var anchor = anchors.get(this.source);
|
|
101
99
|
/* istanbul ignore if */
|
|
102
100
|
|
|
103
101
|
if (!anchor || anchor.res === undefined) {
|
|
@@ -134,6 +132,4 @@ var Alias = /*#__PURE__*/function (_Node) {
|
|
|
134
132
|
return Alias;
|
|
135
133
|
}(Node);
|
|
136
134
|
|
|
137
|
-
_defineProperty(Alias, "default", true);
|
|
138
|
-
|
|
139
|
-
export { Alias as default };
|
|
135
|
+
_defineProperty(Alias, "default", true);
|
|
@@ -1,16 +1,27 @@
|
|
|
1
1
|
import _toArray from "@babel/runtime/helpers/toArray";
|
|
2
2
|
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
3
3
|
import _createClass from "@babel/runtime/helpers/createClass";
|
|
4
|
-
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
5
|
-
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
6
4
|
import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
|
|
7
5
|
import _inherits from "@babel/runtime/helpers/inherits";
|
|
6
|
+
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
7
|
+
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
8
8
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
9
9
|
import _typeof from "@babel/runtime/helpers/typeof";
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
|
|
11
|
+
function _createForOfIteratorHelper(o) { if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (o = _unsupportedIterableToArray(o))) { var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var it, normalCompletion = true, didErr = false, err; return { s: function s() { it = o[Symbol.iterator](); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
12
|
+
|
|
13
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(n); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
14
|
+
|
|
15
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
16
|
+
|
|
17
|
+
function _createSuper(Derived) { return function () { var Super = _getPrototypeOf(Derived), result; if (_isNativeReflectConstruct()) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
18
|
+
|
|
19
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
|
|
20
|
+
|
|
21
|
+
import { addComment } from '../addComment';
|
|
22
|
+
import { Type } from '../constants';
|
|
23
|
+
import { Node } from './Node';
|
|
24
|
+
import { Scalar } from './Scalar';
|
|
14
25
|
|
|
15
26
|
function collectionFromPath(schema, path, value) {
|
|
16
27
|
var v = value;
|
|
@@ -29,16 +40,17 @@ function collectionFromPath(schema, path, value) {
|
|
|
29
40
|
export var isEmptyPath = function isEmptyPath(path) {
|
|
30
41
|
return path == null || _typeof(path) === 'object' && path[Symbol.iterator]().next().done;
|
|
31
42
|
};
|
|
32
|
-
|
|
33
|
-
var Collection = /*#__PURE__*/function (_Node) {
|
|
43
|
+
export var Collection = /*#__PURE__*/function (_Node) {
|
|
34
44
|
_inherits(Collection, _Node);
|
|
35
45
|
|
|
46
|
+
var _super = _createSuper(Collection);
|
|
47
|
+
|
|
36
48
|
function Collection(schema) {
|
|
37
49
|
var _this;
|
|
38
50
|
|
|
39
51
|
_classCallCheck(this, Collection);
|
|
40
52
|
|
|
41
|
-
_this =
|
|
53
|
+
_this = _super.call(this);
|
|
42
54
|
|
|
43
55
|
_defineProperty(_assertThisInitialized(_this), "items", []);
|
|
44
56
|
|
|
@@ -83,7 +95,7 @@ var Collection = /*#__PURE__*/function (_Node) {
|
|
|
83
95
|
key: "hasAllNullValues",
|
|
84
96
|
value: function hasAllNullValues() {
|
|
85
97
|
return this.items.every(function (node) {
|
|
86
|
-
if (!
|
|
98
|
+
if (!node || node.type !== 'PAIR') return false;
|
|
87
99
|
var n = node.value;
|
|
88
100
|
return n == null || n instanceof Scalar && n.value == null && !n.commentBefore && !n.comment && !n.tag;
|
|
89
101
|
});
|
|
@@ -132,9 +144,10 @@ var Collection = /*#__PURE__*/function (_Node) {
|
|
|
132
144
|
itemIndent = _ref9.itemIndent;
|
|
133
145
|
var _ctx = ctx,
|
|
134
146
|
doc = _ctx.doc,
|
|
135
|
-
indent = _ctx.indent
|
|
136
|
-
|
|
137
|
-
|
|
147
|
+
indent = _ctx.indent,
|
|
148
|
+
indentStep = _ctx.indentStep;
|
|
149
|
+
var inFlow = this.type === Type.FLOW_MAP || this.type === Type.FLOW_SEQ || ctx.inFlow;
|
|
150
|
+
if (inFlow) itemIndent += indentStep;
|
|
138
151
|
var allNullValues = isMap && this.hasAllNullValues();
|
|
139
152
|
ctx = Object.assign({}, ctx, {
|
|
140
153
|
allNullValues: allNullValues,
|
|
@@ -193,28 +206,19 @@ var Collection = /*#__PURE__*/function (_Node) {
|
|
|
193
206
|
return sum + str.length + 2;
|
|
194
207
|
}, 2) > Collection.maxFlowStringSingleLineLength) {
|
|
195
208
|
str = start;
|
|
196
|
-
|
|
197
|
-
var
|
|
198
|
-
|
|
209
|
+
|
|
210
|
+
var _iterator = _createForOfIteratorHelper(strings),
|
|
211
|
+
_step;
|
|
199
212
|
|
|
200
213
|
try {
|
|
201
|
-
for (
|
|
214
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
202
215
|
var s = _step.value;
|
|
203
|
-
str += s ? "\n
|
|
216
|
+
str += s ? "\n".concat(indentStep).concat(indent).concat(s) : '\n';
|
|
204
217
|
}
|
|
205
218
|
} catch (err) {
|
|
206
|
-
|
|
207
|
-
_iteratorError = err;
|
|
219
|
+
_iterator.e(err);
|
|
208
220
|
} finally {
|
|
209
|
-
|
|
210
|
-
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
211
|
-
_iterator.return();
|
|
212
|
-
}
|
|
213
|
-
} finally {
|
|
214
|
-
if (_didIteratorError) {
|
|
215
|
-
throw _iteratorError;
|
|
216
|
-
}
|
|
217
|
-
}
|
|
221
|
+
_iterator.f();
|
|
218
222
|
}
|
|
219
223
|
|
|
220
224
|
str += "\n".concat(indent).concat(end);
|
|
@@ -225,28 +229,19 @@ var Collection = /*#__PURE__*/function (_Node) {
|
|
|
225
229
|
var _strings = nodes.map(blockItem);
|
|
226
230
|
|
|
227
231
|
str = _strings.shift();
|
|
228
|
-
|
|
229
|
-
var
|
|
230
|
-
|
|
232
|
+
|
|
233
|
+
var _iterator2 = _createForOfIteratorHelper(_strings),
|
|
234
|
+
_step2;
|
|
231
235
|
|
|
232
236
|
try {
|
|
233
|
-
for (
|
|
237
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
234
238
|
var _s = _step2.value;
|
|
235
239
|
str += _s ? "\n".concat(indent).concat(_s) : '\n';
|
|
236
240
|
}
|
|
237
241
|
} catch (err) {
|
|
238
|
-
|
|
239
|
-
_iteratorError2 = err;
|
|
242
|
+
_iterator2.e(err);
|
|
240
243
|
} finally {
|
|
241
|
-
|
|
242
|
-
if (!_iteratorNormalCompletion2 && _iterator2.return != null) {
|
|
243
|
-
_iterator2.return();
|
|
244
|
-
}
|
|
245
|
-
} finally {
|
|
246
|
-
if (_didIteratorError2) {
|
|
247
|
-
throw _iteratorError2;
|
|
248
|
-
}
|
|
249
|
-
}
|
|
244
|
+
_iterator2.f();
|
|
250
245
|
}
|
|
251
246
|
}
|
|
252
247
|
|
|
@@ -262,6 +257,4 @@ var Collection = /*#__PURE__*/function (_Node) {
|
|
|
262
257
|
return Collection;
|
|
263
258
|
}(Node);
|
|
264
259
|
|
|
265
|
-
_defineProperty(Collection, "maxFlowStringSingleLineLength", 60);
|
|
266
|
-
|
|
267
|
-
export { Collection as default };
|
|
260
|
+
_defineProperty(Collection, "maxFlowStringSingleLineLength", 60);
|
|
@@ -1,20 +1,31 @@
|
|
|
1
1
|
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
2
2
|
import _createClass from "@babel/runtime/helpers/createClass";
|
|
3
|
-
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
4
|
-
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
5
3
|
import _get from "@babel/runtime/helpers/get";
|
|
6
4
|
import _inherits from "@babel/runtime/helpers/inherits";
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
|
|
5
|
+
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
6
|
+
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
7
|
+
|
|
8
|
+
function _createSuper(Derived) { return function () { var Super = _getPrototypeOf(Derived), result; if (_isNativeReflectConstruct()) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
9
|
+
|
|
10
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
|
|
11
|
+
|
|
12
|
+
function _createForOfIteratorHelper(o) { if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (o = _unsupportedIterableToArray(o))) { var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var it, normalCompletion = true, didErr = false, err; return { s: function s() { it = o[Symbol.iterator](); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
13
|
+
|
|
14
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(n); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
15
|
+
|
|
16
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
17
|
+
|
|
18
|
+
import { Collection } from './Collection';
|
|
19
|
+
import { Pair } from './Pair';
|
|
20
|
+
import { Scalar } from './Scalar';
|
|
10
21
|
export function findPair(items, key) {
|
|
11
22
|
var k = key instanceof Scalar ? key.value : key;
|
|
12
|
-
|
|
13
|
-
var
|
|
14
|
-
|
|
23
|
+
|
|
24
|
+
var _iterator = _createForOfIteratorHelper(items),
|
|
25
|
+
_step;
|
|
15
26
|
|
|
16
27
|
try {
|
|
17
|
-
for (
|
|
28
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
18
29
|
var it = _step.value;
|
|
19
30
|
|
|
20
31
|
if (it instanceof Pair) {
|
|
@@ -23,30 +34,22 @@ export function findPair(items, key) {
|
|
|
23
34
|
}
|
|
24
35
|
}
|
|
25
36
|
} catch (err) {
|
|
26
|
-
|
|
27
|
-
_iteratorError = err;
|
|
37
|
+
_iterator.e(err);
|
|
28
38
|
} finally {
|
|
29
|
-
|
|
30
|
-
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
31
|
-
_iterator.return();
|
|
32
|
-
}
|
|
33
|
-
} finally {
|
|
34
|
-
if (_didIteratorError) {
|
|
35
|
-
throw _iteratorError;
|
|
36
|
-
}
|
|
37
|
-
}
|
|
39
|
+
_iterator.f();
|
|
38
40
|
}
|
|
39
41
|
|
|
40
42
|
return undefined;
|
|
41
43
|
}
|
|
42
|
-
|
|
43
|
-
var YAMLMap = /*#__PURE__*/function (_Collection) {
|
|
44
|
+
export var YAMLMap = /*#__PURE__*/function (_Collection) {
|
|
44
45
|
_inherits(YAMLMap, _Collection);
|
|
45
46
|
|
|
47
|
+
var _super = _createSuper(YAMLMap);
|
|
48
|
+
|
|
46
49
|
function YAMLMap() {
|
|
47
50
|
_classCallCheck(this, YAMLMap);
|
|
48
51
|
|
|
49
|
-
return
|
|
52
|
+
return _super.apply(this, arguments);
|
|
50
53
|
}
|
|
51
54
|
|
|
52
55
|
_createClass(YAMLMap, [{
|
|
@@ -104,28 +107,19 @@ var YAMLMap = /*#__PURE__*/function (_Collection) {
|
|
|
104
107
|
value: function toJSON(_, ctx, Type) {
|
|
105
108
|
var map = Type ? new Type() : ctx && ctx.mapAsMap ? new Map() : {};
|
|
106
109
|
if (ctx && ctx.onCreate) ctx.onCreate(map);
|
|
107
|
-
|
|
108
|
-
var
|
|
109
|
-
|
|
110
|
+
|
|
111
|
+
var _iterator2 = _createForOfIteratorHelper(this.items),
|
|
112
|
+
_step2;
|
|
110
113
|
|
|
111
114
|
try {
|
|
112
|
-
for (
|
|
115
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
113
116
|
var item = _step2.value;
|
|
114
117
|
item.addToJSMap(ctx, map);
|
|
115
118
|
}
|
|
116
119
|
} catch (err) {
|
|
117
|
-
|
|
118
|
-
_iteratorError2 = err;
|
|
120
|
+
_iterator2.e(err);
|
|
119
121
|
} finally {
|
|
120
|
-
|
|
121
|
-
if (!_iteratorNormalCompletion2 && _iterator2.return != null) {
|
|
122
|
-
_iterator2.return();
|
|
123
|
-
}
|
|
124
|
-
} finally {
|
|
125
|
-
if (_didIteratorError2) {
|
|
126
|
-
throw _iteratorError2;
|
|
127
|
-
}
|
|
128
|
-
}
|
|
122
|
+
_iterator2.f();
|
|
129
123
|
}
|
|
130
124
|
|
|
131
125
|
return map;
|
|
@@ -134,28 +128,19 @@ var YAMLMap = /*#__PURE__*/function (_Collection) {
|
|
|
134
128
|
key: "toString",
|
|
135
129
|
value: function toString(ctx, onComment, onChompKeep) {
|
|
136
130
|
if (!ctx) return JSON.stringify(this);
|
|
137
|
-
|
|
138
|
-
var
|
|
139
|
-
|
|
131
|
+
|
|
132
|
+
var _iterator3 = _createForOfIteratorHelper(this.items),
|
|
133
|
+
_step3;
|
|
140
134
|
|
|
141
135
|
try {
|
|
142
|
-
for (
|
|
136
|
+
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
143
137
|
var item = _step3.value;
|
|
144
138
|
if (!(item instanceof Pair)) throw new Error("Map items must all be pairs; found ".concat(JSON.stringify(item), " instead"));
|
|
145
139
|
}
|
|
146
140
|
} catch (err) {
|
|
147
|
-
|
|
148
|
-
_iteratorError3 = err;
|
|
141
|
+
_iterator3.e(err);
|
|
149
142
|
} finally {
|
|
150
|
-
|
|
151
|
-
if (!_iteratorNormalCompletion3 && _iterator3.return != null) {
|
|
152
|
-
_iterator3.return();
|
|
153
|
-
}
|
|
154
|
-
} finally {
|
|
155
|
-
if (_didIteratorError3) {
|
|
156
|
-
throw _iteratorError3;
|
|
157
|
-
}
|
|
158
|
-
}
|
|
143
|
+
_iterator3.f();
|
|
159
144
|
}
|
|
160
145
|
|
|
161
146
|
return _get(_getPrototypeOf(YAMLMap.prototype), "toString", this).call(this, ctx, {
|
|
@@ -173,6 +158,4 @@ var YAMLMap = /*#__PURE__*/function (_Collection) {
|
|
|
173
158
|
}]);
|
|
174
159
|
|
|
175
160
|
return YAMLMap;
|
|
176
|
-
}(Collection);
|
|
177
|
-
|
|
178
|
-
export { YAMLMap as default };
|
|
161
|
+
}(Collection);
|
|
@@ -1,19 +1,31 @@
|
|
|
1
1
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
2
|
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
3
3
|
import _createClass from "@babel/runtime/helpers/createClass";
|
|
4
|
-
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
5
|
-
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
6
4
|
import _get from "@babel/runtime/helpers/get";
|
|
7
5
|
import _inherits from "@babel/runtime/helpers/inherits";
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
6
|
+
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
7
|
+
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
8
|
+
|
|
9
|
+
function _createForOfIteratorHelper(o) { if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (o = _unsupportedIterableToArray(o))) { var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var it, normalCompletion = true, didErr = false, err; return { s: function s() { it = o[Symbol.iterator](); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
10
|
+
|
|
11
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(n); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
12
|
+
|
|
13
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
14
|
+
|
|
15
|
+
function _createSuper(Derived) { return function () { var Super = _getPrototypeOf(Derived), result; if (_isNativeReflectConstruct()) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
16
|
+
|
|
17
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
|
|
13
18
|
|
|
14
|
-
|
|
19
|
+
import { YAMLMap } from './Map';
|
|
20
|
+
import { Pair } from './Pair';
|
|
21
|
+
import { Scalar } from './Scalar';
|
|
22
|
+
import { YAMLSeq } from './Seq';
|
|
23
|
+
export var MERGE_KEY = '<<';
|
|
24
|
+
export var Merge = /*#__PURE__*/function (_Pair) {
|
|
15
25
|
_inherits(Merge, _Pair);
|
|
16
26
|
|
|
27
|
+
var _super = _createSuper(Merge);
|
|
28
|
+
|
|
17
29
|
function Merge(pair) {
|
|
18
30
|
var _this;
|
|
19
31
|
|
|
@@ -22,19 +34,19 @@ var Merge = /*#__PURE__*/function (_Pair) {
|
|
|
22
34
|
if (pair instanceof Pair) {
|
|
23
35
|
var seq = pair.value;
|
|
24
36
|
|
|
25
|
-
if (!(seq instanceof
|
|
26
|
-
seq = new
|
|
37
|
+
if (!(seq instanceof YAMLSeq)) {
|
|
38
|
+
seq = new YAMLSeq();
|
|
27
39
|
seq.items.push(pair.value);
|
|
28
40
|
seq.range = pair.value.range;
|
|
29
41
|
}
|
|
30
42
|
|
|
31
|
-
_this =
|
|
43
|
+
_this = _super.call(this, pair.key, seq);
|
|
32
44
|
_this.range = pair.range;
|
|
33
45
|
} else {
|
|
34
|
-
_this =
|
|
46
|
+
_this = _super.call(this, new Scalar(MERGE_KEY), new YAMLSeq());
|
|
35
47
|
}
|
|
36
48
|
|
|
37
|
-
_this.type =
|
|
49
|
+
_this.type = Pair.Type.MERGE_PAIR;
|
|
38
50
|
return _possibleConstructorReturn(_this);
|
|
39
51
|
} // If the value associated with a merge key is a single mapping node, each of
|
|
40
52
|
// its key/value pairs is inserted into the current mapping, unless the key
|
|
@@ -48,21 +60,20 @@ var Merge = /*#__PURE__*/function (_Pair) {
|
|
|
48
60
|
_createClass(Merge, [{
|
|
49
61
|
key: "addToJSMap",
|
|
50
62
|
value: function addToJSMap(ctx, map) {
|
|
51
|
-
var
|
|
52
|
-
|
|
53
|
-
var _iteratorError = undefined;
|
|
63
|
+
var _iterator = _createForOfIteratorHelper(this.value.items),
|
|
64
|
+
_step;
|
|
54
65
|
|
|
55
66
|
try {
|
|
56
|
-
for (
|
|
67
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
57
68
|
var source = _step.value.source;
|
|
58
69
|
if (!(source instanceof YAMLMap)) throw new Error('Merge sources must be maps');
|
|
59
70
|
var srcMap = source.toJSON(null, ctx, Map);
|
|
60
|
-
|
|
61
|
-
var
|
|
62
|
-
|
|
71
|
+
|
|
72
|
+
var _iterator2 = _createForOfIteratorHelper(srcMap),
|
|
73
|
+
_step2;
|
|
63
74
|
|
|
64
75
|
try {
|
|
65
|
-
for (
|
|
76
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
66
77
|
var _step2$value = _slicedToArray(_step2.value, 2),
|
|
67
78
|
key = _step2$value[0],
|
|
68
79
|
value = _step2$value[1];
|
|
@@ -76,33 +87,15 @@ var Merge = /*#__PURE__*/function (_Pair) {
|
|
|
76
87
|
}
|
|
77
88
|
}
|
|
78
89
|
} catch (err) {
|
|
79
|
-
|
|
80
|
-
_iteratorError2 = err;
|
|
90
|
+
_iterator2.e(err);
|
|
81
91
|
} finally {
|
|
82
|
-
|
|
83
|
-
if (!_iteratorNormalCompletion2 && _iterator2.return != null) {
|
|
84
|
-
_iterator2.return();
|
|
85
|
-
}
|
|
86
|
-
} finally {
|
|
87
|
-
if (_didIteratorError2) {
|
|
88
|
-
throw _iteratorError2;
|
|
89
|
-
}
|
|
90
|
-
}
|
|
92
|
+
_iterator2.f();
|
|
91
93
|
}
|
|
92
94
|
}
|
|
93
95
|
} catch (err) {
|
|
94
|
-
|
|
95
|
-
_iteratorError = err;
|
|
96
|
+
_iterator.e(err);
|
|
96
97
|
} finally {
|
|
97
|
-
|
|
98
|
-
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
99
|
-
_iterator.return();
|
|
100
|
-
}
|
|
101
|
-
} finally {
|
|
102
|
-
if (_didIteratorError) {
|
|
103
|
-
throw _iteratorError;
|
|
104
|
-
}
|
|
105
|
-
}
|
|
98
|
+
_iterator.f();
|
|
106
99
|
}
|
|
107
100
|
|
|
108
101
|
return map;
|
|
@@ -122,6 +115,4 @@ var Merge = /*#__PURE__*/function (_Pair) {
|
|
|
122
115
|
}]);
|
|
123
116
|
|
|
124
117
|
return Merge;
|
|
125
|
-
}(Pair);
|
|
126
|
-
|
|
127
|
-
export { Merge as default };
|
|
118
|
+
}(Pair);
|