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
package/browser/dist/Anchors.js
CHANGED
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
2
2
|
import _createClass from "@babel/runtime/helpers/createClass";
|
|
3
3
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
4
|
-
import Alias from './schema/Alias';
|
|
5
|
-
import
|
|
6
|
-
import Merge from './schema/Merge';
|
|
7
|
-
import Scalar from './schema/Scalar';
|
|
8
|
-
import
|
|
9
|
-
|
|
10
|
-
var Anchors = /*#__PURE__*/function () {
|
|
4
|
+
import { Alias } from './schema/Alias';
|
|
5
|
+
import { YAMLMap } from './schema/Map';
|
|
6
|
+
import { Merge } from './schema/Merge';
|
|
7
|
+
import { Scalar } from './schema/Scalar';
|
|
8
|
+
import { YAMLSeq } from './schema/Seq';
|
|
9
|
+
export var Anchors = /*#__PURE__*/function () {
|
|
11
10
|
_createClass(Anchors, null, [{
|
|
12
11
|
key: "validAnchorNode",
|
|
13
12
|
value: function validAnchorNode(node) {
|
|
14
|
-
return node instanceof Scalar || node instanceof
|
|
13
|
+
return node instanceof Scalar || node instanceof YAMLSeq || node instanceof YAMLMap;
|
|
15
14
|
}
|
|
16
15
|
}]);
|
|
17
16
|
|
|
@@ -42,8 +41,8 @@ var Anchors = /*#__PURE__*/function () {
|
|
|
42
41
|
|
|
43
42
|
merge.value.items = sources.map(function (s) {
|
|
44
43
|
if (s instanceof Alias) {
|
|
45
|
-
if (s.source instanceof
|
|
46
|
-
} else if (s instanceof
|
|
44
|
+
if (s.source instanceof YAMLMap) return s;
|
|
45
|
+
} else if (s instanceof YAMLMap) {
|
|
47
46
|
return _this.createAlias(s);
|
|
48
47
|
}
|
|
49
48
|
|
|
@@ -128,6 +127,4 @@ var Anchors = /*#__PURE__*/function () {
|
|
|
128
127
|
}]);
|
|
129
128
|
|
|
130
129
|
return Anchors;
|
|
131
|
-
}();
|
|
132
|
-
|
|
133
|
-
export { Anchors as default };
|
|
130
|
+
}();
|
package/browser/dist/Document.js
CHANGED
|
@@ -2,23 +2,30 @@ 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
4
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
|
|
6
|
+
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; } } }; }
|
|
7
|
+
|
|
8
|
+
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); }
|
|
9
|
+
|
|
10
|
+
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; }
|
|
11
|
+
|
|
12
|
+
import { addComment } from './addComment';
|
|
13
|
+
import { Anchors } from './Anchors';
|
|
7
14
|
import { Char, Type } from './constants';
|
|
8
15
|
import { YAMLError, YAMLReferenceError, YAMLSemanticError, YAMLSyntaxError, YAMLWarning } from './errors';
|
|
9
|
-
import listTagNames from './listTagNames';
|
|
10
|
-
import Schema from './schema';
|
|
11
|
-
import Alias from './schema/Alias';
|
|
12
|
-
import Collection,
|
|
13
|
-
import Node from './schema/Node';
|
|
14
|
-
import Scalar from './schema/Scalar';
|
|
15
|
-
import _toJSON from './toJSON';
|
|
16
|
+
import { listTagNames } from './listTagNames';
|
|
17
|
+
import { Schema } from './schema';
|
|
18
|
+
import { Alias } from './schema/Alias';
|
|
19
|
+
import { Collection, isEmptyPath } from './schema/Collection';
|
|
20
|
+
import { Node } from './schema/Node';
|
|
21
|
+
import { Scalar } from './schema/Scalar';
|
|
22
|
+
import { toJSON as _toJSON } from './toJSON';
|
|
16
23
|
|
|
17
24
|
var isCollectionItem = function isCollectionItem(node) {
|
|
18
25
|
return node && [Type.MAP_KEY, Type.MAP_VALUE, Type.SEQ_ITEM].includes(node.type);
|
|
19
26
|
};
|
|
20
27
|
|
|
21
|
-
var Document = /*#__PURE__*/function () {
|
|
28
|
+
export var Document = /*#__PURE__*/function () {
|
|
22
29
|
function Document(options) {
|
|
23
30
|
_classCallCheck(this, Document);
|
|
24
31
|
|
|
@@ -156,52 +163,32 @@ var Document = /*#__PURE__*/function () {
|
|
|
156
163
|
this.anchors.resolveNodes();
|
|
157
164
|
|
|
158
165
|
if (this.options.prettyErrors) {
|
|
159
|
-
var
|
|
160
|
-
|
|
161
|
-
var _iteratorError = undefined;
|
|
166
|
+
var _iterator = _createForOfIteratorHelper(this.errors),
|
|
167
|
+
_step;
|
|
162
168
|
|
|
163
169
|
try {
|
|
164
|
-
for (
|
|
170
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
165
171
|
var _error = _step.value;
|
|
166
172
|
if (_error instanceof YAMLError) _error.makePretty();
|
|
167
173
|
}
|
|
168
174
|
} catch (err) {
|
|
169
|
-
|
|
170
|
-
_iteratorError = err;
|
|
175
|
+
_iterator.e(err);
|
|
171
176
|
} finally {
|
|
172
|
-
|
|
173
|
-
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
174
|
-
_iterator.return();
|
|
175
|
-
}
|
|
176
|
-
} finally {
|
|
177
|
-
if (_didIteratorError) {
|
|
178
|
-
throw _iteratorError;
|
|
179
|
-
}
|
|
180
|
-
}
|
|
177
|
+
_iterator.f();
|
|
181
178
|
}
|
|
182
179
|
|
|
183
|
-
var
|
|
184
|
-
|
|
185
|
-
var _iteratorError2 = undefined;
|
|
180
|
+
var _iterator2 = _createForOfIteratorHelper(this.warnings),
|
|
181
|
+
_step2;
|
|
186
182
|
|
|
187
183
|
try {
|
|
188
|
-
for (
|
|
184
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
189
185
|
var warn = _step2.value;
|
|
190
186
|
if (warn instanceof YAMLError) warn.makePretty();
|
|
191
187
|
}
|
|
192
188
|
} catch (err) {
|
|
193
|
-
|
|
194
|
-
_iteratorError2 = err;
|
|
189
|
+
_iterator2.e(err);
|
|
195
190
|
} finally {
|
|
196
|
-
|
|
197
|
-
if (!_iteratorNormalCompletion2 && _iterator2.return != null) {
|
|
198
|
-
_iterator2.return();
|
|
199
|
-
}
|
|
200
|
-
} finally {
|
|
201
|
-
if (_didIteratorError2) {
|
|
202
|
-
throw _iteratorError2;
|
|
203
|
-
}
|
|
204
|
-
}
|
|
191
|
+
_iterator2.f();
|
|
205
192
|
}
|
|
206
193
|
}
|
|
207
194
|
|
|
@@ -478,12 +465,12 @@ var Document = /*#__PURE__*/function () {
|
|
|
478
465
|
after: []
|
|
479
466
|
};
|
|
480
467
|
var props = isCollectionItem(node.context.parent) ? node.context.parent.props.concat(node.props) : node.props;
|
|
481
|
-
|
|
482
|
-
var
|
|
483
|
-
|
|
468
|
+
|
|
469
|
+
var _iterator3 = _createForOfIteratorHelper(props),
|
|
470
|
+
_step3;
|
|
484
471
|
|
|
485
472
|
try {
|
|
486
|
-
for (
|
|
473
|
+
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
487
474
|
var _step3$value = _step3.value,
|
|
488
475
|
start = _step3$value.start,
|
|
489
476
|
end = _step3$value.end;
|
|
@@ -528,18 +515,9 @@ var Document = /*#__PURE__*/function () {
|
|
|
528
515
|
}
|
|
529
516
|
}
|
|
530
517
|
} catch (err) {
|
|
531
|
-
|
|
532
|
-
_iteratorError3 = err;
|
|
518
|
+
_iterator3.e(err);
|
|
533
519
|
} finally {
|
|
534
|
-
|
|
535
|
-
if (!_iteratorNormalCompletion3 && _iterator3.return != null) {
|
|
536
|
-
_iterator3.return();
|
|
537
|
-
}
|
|
538
|
-
} finally {
|
|
539
|
-
if (_didIteratorError3) {
|
|
540
|
-
throw _iteratorError3;
|
|
541
|
-
}
|
|
542
|
-
}
|
|
520
|
+
_iterator3.f();
|
|
543
521
|
}
|
|
544
522
|
|
|
545
523
|
if (hasAnchor) {
|
|
@@ -677,7 +655,7 @@ var Document = /*#__PURE__*/function () {
|
|
|
677
655
|
}
|
|
678
656
|
}, {
|
|
679
657
|
key: "toJSON",
|
|
680
|
-
value: function toJSON(arg) {
|
|
658
|
+
value: function toJSON(arg, onAnchor) {
|
|
681
659
|
var _this3 = this;
|
|
682
660
|
|
|
683
661
|
var _this$options = this.options,
|
|
@@ -687,25 +665,53 @@ var Document = /*#__PURE__*/function () {
|
|
|
687
665
|
var keep = keepBlobsInJSON && (typeof arg !== 'string' || !(this.contents instanceof Scalar));
|
|
688
666
|
var ctx = {
|
|
689
667
|
doc: this,
|
|
668
|
+
indentStep: ' ',
|
|
690
669
|
keep: keep,
|
|
691
670
|
mapAsMap: keep && !!mapAsMap,
|
|
692
671
|
maxAliasCount: maxAliasCount
|
|
693
672
|
};
|
|
694
673
|
var anchorNames = Object.keys(this.anchors.map);
|
|
695
|
-
if (anchorNames.length > 0) ctx.anchors = anchorNames.map(function (name) {
|
|
696
|
-
return {
|
|
674
|
+
if (anchorNames.length > 0) ctx.anchors = new Map(anchorNames.map(function (name) {
|
|
675
|
+
return [_this3.anchors.map[name], {
|
|
697
676
|
alias: [],
|
|
698
677
|
aliasCount: 0,
|
|
699
|
-
count: 1
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
678
|
+
count: 1
|
|
679
|
+
}];
|
|
680
|
+
}));
|
|
681
|
+
|
|
682
|
+
var res = _toJSON(this.contents, arg, ctx);
|
|
683
|
+
|
|
684
|
+
if (typeof onAnchor === 'function' && ctx.anchors) {
|
|
685
|
+
var _iterator4 = _createForOfIteratorHelper(ctx.anchors.values()),
|
|
686
|
+
_step4;
|
|
687
|
+
|
|
688
|
+
try {
|
|
689
|
+
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
|
|
690
|
+
var _step4$value = _step4.value,
|
|
691
|
+
count = _step4$value.count,
|
|
692
|
+
_res = _step4$value.res;
|
|
693
|
+
onAnchor(_res, count);
|
|
694
|
+
}
|
|
695
|
+
} catch (err) {
|
|
696
|
+
_iterator4.e(err);
|
|
697
|
+
} finally {
|
|
698
|
+
_iterator4.f();
|
|
699
|
+
}
|
|
700
|
+
}
|
|
701
|
+
|
|
702
|
+
return res;
|
|
704
703
|
}
|
|
705
704
|
}, {
|
|
706
705
|
key: "toString",
|
|
707
706
|
value: function toString() {
|
|
708
707
|
if (this.errors.length > 0) throw new Error('Document with errors cannot be stringified');
|
|
708
|
+
var indentSize = this.options.indent;
|
|
709
|
+
|
|
710
|
+
if (!Number.isInteger(indentSize) || indentSize <= 0) {
|
|
711
|
+
var s = JSON.stringify(indentSize);
|
|
712
|
+
throw new Error("\"indent\" option must be a positive integer, not ".concat(s));
|
|
713
|
+
}
|
|
714
|
+
|
|
709
715
|
this.setSchema();
|
|
710
716
|
var lines = [];
|
|
711
717
|
var hasDirectives = false;
|
|
@@ -743,7 +749,8 @@ var Document = /*#__PURE__*/function () {
|
|
|
743
749
|
var ctx = {
|
|
744
750
|
anchors: {},
|
|
745
751
|
doc: this,
|
|
746
|
-
indent: ''
|
|
752
|
+
indent: '',
|
|
753
|
+
indentStep: ' '.repeat(indentSize)
|
|
747
754
|
};
|
|
748
755
|
var chompKeep = false;
|
|
749
756
|
var contentComment = null;
|
|
@@ -814,6 +821,4 @@ _defineProperty(Document, "defaults", {
|
|
|
814
821
|
prefix: Schema.defaultPrefix
|
|
815
822
|
}]
|
|
816
823
|
}
|
|
817
|
-
});
|
|
818
|
-
|
|
819
|
-
export { Document as default };
|
|
824
|
+
});
|
|
@@ -3,6 +3,6 @@ export function addCommentBefore(str, indent, comment) {
|
|
|
3
3
|
var cc = comment.replace(/[\s\S]^/gm, "$&".concat(indent, "#"));
|
|
4
4
|
return "#".concat(cc, "\n").concat(indent).concat(str);
|
|
5
5
|
}
|
|
6
|
-
export
|
|
6
|
+
export function addComment(str, indent, comment) {
|
|
7
7
|
return !comment ? str : comment.indexOf('\n') === -1 ? "".concat(str, " #").concat(comment) : "".concat(str, "\n") + comment.replace(/^/gm, "".concat(indent || '', "#"));
|
|
8
8
|
}
|
|
@@ -1,18 +1,24 @@
|
|
|
1
1
|
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
2
2
|
import _createClass from "@babel/runtime/helpers/createClass";
|
|
3
|
+
import _inherits from "@babel/runtime/helpers/inherits";
|
|
3
4
|
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
4
5
|
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
5
|
-
import _inherits from "@babel/runtime/helpers/inherits";
|
|
6
|
-
import Node from './Node';
|
|
7
|
-
import Range from './Range';
|
|
8
6
|
|
|
9
|
-
var
|
|
7
|
+
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); }; }
|
|
8
|
+
|
|
9
|
+
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; } }
|
|
10
|
+
|
|
11
|
+
import { Node } from './Node';
|
|
12
|
+
import { Range } from './Range';
|
|
13
|
+
export var Alias = /*#__PURE__*/function (_Node) {
|
|
10
14
|
_inherits(Alias, _Node);
|
|
11
15
|
|
|
16
|
+
var _super = _createSuper(Alias);
|
|
17
|
+
|
|
12
18
|
function Alias() {
|
|
13
19
|
_classCallCheck(this, Alias);
|
|
14
20
|
|
|
15
|
-
return
|
|
21
|
+
return _super.apply(this, arguments);
|
|
16
22
|
}
|
|
17
23
|
|
|
18
24
|
_createClass(Alias, [{
|
|
@@ -37,6 +43,4 @@ var Alias = /*#__PURE__*/function (_Node) {
|
|
|
37
43
|
}]);
|
|
38
44
|
|
|
39
45
|
return Alias;
|
|
40
|
-
}(Node);
|
|
41
|
-
|
|
42
|
-
export { Alias as default };
|
|
46
|
+
}(Node);
|
|
@@ -1,19 +1,25 @@
|
|
|
1
1
|
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
2
2
|
import _createClass from "@babel/runtime/helpers/createClass";
|
|
3
|
+
import _inherits from "@babel/runtime/helpers/inherits";
|
|
3
4
|
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
4
5
|
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
5
|
-
import _inherits from "@babel/runtime/helpers/inherits";
|
|
6
|
-
import { Type } from '../constants';
|
|
7
|
-
import Node from './Node';
|
|
8
|
-
import Range from './Range';
|
|
9
6
|
|
|
10
|
-
var
|
|
7
|
+
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); }; }
|
|
8
|
+
|
|
9
|
+
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; } }
|
|
10
|
+
|
|
11
|
+
import { Type } from '../constants';
|
|
12
|
+
import { Node } from './Node';
|
|
13
|
+
import { Range } from './Range';
|
|
14
|
+
export var BlankLine = /*#__PURE__*/function (_Node) {
|
|
11
15
|
_inherits(BlankLine, _Node);
|
|
12
16
|
|
|
17
|
+
var _super = _createSuper(BlankLine);
|
|
18
|
+
|
|
13
19
|
function BlankLine() {
|
|
14
20
|
_classCallCheck(this, BlankLine);
|
|
15
21
|
|
|
16
|
-
return
|
|
22
|
+
return _super.call(this, Type.BLANK_LINE);
|
|
17
23
|
}
|
|
18
24
|
/* istanbul ignore next */
|
|
19
25
|
|
|
@@ -22,7 +28,7 @@ var BlankLine = /*#__PURE__*/function (_Node) {
|
|
|
22
28
|
key: "parse",
|
|
23
29
|
|
|
24
30
|
/**
|
|
25
|
-
* Parses blank
|
|
31
|
+
* Parses a blank line from the source
|
|
26
32
|
*
|
|
27
33
|
* @param {ParseContext} context
|
|
28
34
|
* @param {number} start - Index of first \n character
|
|
@@ -30,16 +36,8 @@ var BlankLine = /*#__PURE__*/function (_Node) {
|
|
|
30
36
|
*/
|
|
31
37
|
value: function parse(context, start) {
|
|
32
38
|
this.context = context;
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
while (Node.atBlank(src, offset)) {
|
|
37
|
-
var lineEnd = Node.endOfWhiteSpace(src, offset);
|
|
38
|
-
if (lineEnd === '\n') offset = lineEnd + 1;else break;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
this.range = new Range(start, offset);
|
|
42
|
-
return offset;
|
|
39
|
+
this.range = new Range(start, start + 1);
|
|
40
|
+
return start + 1;
|
|
43
41
|
}
|
|
44
42
|
}, {
|
|
45
43
|
key: "includesTrailingLines",
|
|
@@ -51,6 +49,4 @@ var BlankLine = /*#__PURE__*/function (_Node) {
|
|
|
51
49
|
}]);
|
|
52
50
|
|
|
53
51
|
return BlankLine;
|
|
54
|
-
}(Node);
|
|
55
|
-
|
|
56
|
-
export { BlankLine as default };
|
|
52
|
+
}(Node);
|
|
@@ -1,27 +1,33 @@
|
|
|
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";
|
|
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
|
+
|
|
7
12
|
import { Type } from '../constants';
|
|
8
|
-
import Node from './Node';
|
|
9
|
-
import Range from './Range';
|
|
13
|
+
import { Node } from './Node';
|
|
14
|
+
import { Range } from './Range';
|
|
10
15
|
export var Chomp = {
|
|
11
16
|
CLIP: 'CLIP',
|
|
12
17
|
KEEP: 'KEEP',
|
|
13
18
|
STRIP: 'STRIP'
|
|
14
19
|
};
|
|
15
|
-
|
|
16
|
-
var BlockValue = /*#__PURE__*/function (_Node) {
|
|
20
|
+
export var BlockValue = /*#__PURE__*/function (_Node) {
|
|
17
21
|
_inherits(BlockValue, _Node);
|
|
18
22
|
|
|
23
|
+
var _super = _createSuper(BlockValue);
|
|
24
|
+
|
|
19
25
|
function BlockValue(type, props) {
|
|
20
26
|
var _this;
|
|
21
27
|
|
|
22
28
|
_classCallCheck(this, BlockValue);
|
|
23
29
|
|
|
24
|
-
_this =
|
|
30
|
+
_this = _super.call(this, type, props);
|
|
25
31
|
_this.blockIndent = null;
|
|
26
32
|
_this.chomping = Chomp.CLIP;
|
|
27
33
|
_this.header = null;
|
|
@@ -242,6 +248,4 @@ var BlockValue = /*#__PURE__*/function (_Node) {
|
|
|
242
248
|
}]);
|
|
243
249
|
|
|
244
250
|
return BlockValue;
|
|
245
|
-
}(Node);
|
|
246
|
-
|
|
247
|
-
export { BlockValue as default };
|
|
251
|
+
}(Node);
|
|
@@ -1,15 +1,20 @@
|
|
|
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 _get from "@babel/runtime/helpers/get";
|
|
5
3
|
import _createClass from "@babel/runtime/helpers/createClass";
|
|
6
4
|
import _inherits from "@babel/runtime/helpers/inherits";
|
|
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
|
+
|
|
7
12
|
import { Type } from '../constants';
|
|
8
|
-
import BlankLine from './BlankLine';
|
|
9
|
-
import CollectionItem from './CollectionItem';
|
|
10
|
-
import Comment from './Comment';
|
|
11
|
-
import Node from './Node';
|
|
12
|
-
import Range from './Range';
|
|
13
|
+
import { BlankLine } from './BlankLine';
|
|
14
|
+
import { CollectionItem } from './CollectionItem';
|
|
15
|
+
import { Comment } from './Comment';
|
|
16
|
+
import { Node } from './Node';
|
|
17
|
+
import { Range } from './Range';
|
|
13
18
|
export function grabCollectionEndComments(node) {
|
|
14
19
|
var cnode = node;
|
|
15
20
|
|
|
@@ -47,10 +52,11 @@ export function grabCollectionEndComments(node) {
|
|
|
47
52
|
|
|
48
53
|
return ca;
|
|
49
54
|
}
|
|
50
|
-
|
|
51
|
-
var Collection = /*#__PURE__*/function (_Node) {
|
|
55
|
+
export var Collection = /*#__PURE__*/function (_Node) {
|
|
52
56
|
_inherits(Collection, _Node);
|
|
53
57
|
|
|
58
|
+
var _super = _createSuper(Collection);
|
|
59
|
+
|
|
54
60
|
_createClass(Collection, null, [{
|
|
55
61
|
key: "nextContentHasIndent",
|
|
56
62
|
value: function nextContentHasIndent(src, offset, indent) {
|
|
@@ -69,7 +75,7 @@ var Collection = /*#__PURE__*/function (_Node) {
|
|
|
69
75
|
|
|
70
76
|
_classCallCheck(this, Collection);
|
|
71
77
|
|
|
72
|
-
_this =
|
|
78
|
+
_this = _super.call(this, firstItem.type === Type.SEQ_ITEM ? Type.SEQ : Type.MAP);
|
|
73
79
|
|
|
74
80
|
for (var i = firstItem.props.length - 1; i >= 0; --i) {
|
|
75
81
|
if (firstItem.props[i].start < firstItem.context.lineStart) {
|
|
@@ -269,6 +275,4 @@ var Collection = /*#__PURE__*/function (_Node) {
|
|
|
269
275
|
}]);
|
|
270
276
|
|
|
271
277
|
return Collection;
|
|
272
|
-
}(Node);
|
|
273
|
-
|
|
274
|
-
export { Collection as default };
|
|
278
|
+
}(Node);
|
|
@@ -1,24 +1,30 @@
|
|
|
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";
|
|
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
|
+
|
|
7
12
|
import { Type } from '../constants';
|
|
8
13
|
import { YAMLSemanticError } from '../errors';
|
|
9
|
-
import BlankLine from './BlankLine';
|
|
10
|
-
import Node from './Node';
|
|
11
|
-
import Range from './Range';
|
|
12
|
-
|
|
13
|
-
var CollectionItem = /*#__PURE__*/function (_Node) {
|
|
14
|
+
import { BlankLine } from './BlankLine';
|
|
15
|
+
import { Node } from './Node';
|
|
16
|
+
import { Range } from './Range';
|
|
17
|
+
export var CollectionItem = /*#__PURE__*/function (_Node) {
|
|
14
18
|
_inherits(CollectionItem, _Node);
|
|
15
19
|
|
|
20
|
+
var _super = _createSuper(CollectionItem);
|
|
21
|
+
|
|
16
22
|
function CollectionItem(type, props) {
|
|
17
23
|
var _this;
|
|
18
24
|
|
|
19
25
|
_classCallCheck(this, CollectionItem);
|
|
20
26
|
|
|
21
|
-
_this =
|
|
27
|
+
_this = _super.call(this, type, props);
|
|
22
28
|
_this.node = null;
|
|
23
29
|
return _this;
|
|
24
30
|
}
|
|
@@ -131,6 +137,4 @@ var CollectionItem = /*#__PURE__*/function (_Node) {
|
|
|
131
137
|
}]);
|
|
132
138
|
|
|
133
139
|
return CollectionItem;
|
|
134
|
-
}(Node);
|
|
135
|
-
|
|
136
|
-
export { CollectionItem as default };
|
|
140
|
+
}(Node);
|
|
@@ -1,19 +1,25 @@
|
|
|
1
1
|
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
2
2
|
import _createClass from "@babel/runtime/helpers/createClass";
|
|
3
|
+
import _inherits from "@babel/runtime/helpers/inherits";
|
|
3
4
|
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
4
5
|
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
5
|
-
import _inherits from "@babel/runtime/helpers/inherits";
|
|
6
|
-
import { Type } from '../constants';
|
|
7
|
-
import Node from './Node';
|
|
8
|
-
import Range from './Range';
|
|
9
6
|
|
|
10
|
-
var
|
|
7
|
+
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); }; }
|
|
8
|
+
|
|
9
|
+
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; } }
|
|
10
|
+
|
|
11
|
+
import { Type } from '../constants';
|
|
12
|
+
import { Node } from './Node';
|
|
13
|
+
import { Range } from './Range';
|
|
14
|
+
export var Comment = /*#__PURE__*/function (_Node) {
|
|
11
15
|
_inherits(Comment, _Node);
|
|
12
16
|
|
|
17
|
+
var _super = _createSuper(Comment);
|
|
18
|
+
|
|
13
19
|
function Comment() {
|
|
14
20
|
_classCallCheck(this, Comment);
|
|
15
21
|
|
|
16
|
-
return
|
|
22
|
+
return _super.call(this, Type.COMMENT);
|
|
17
23
|
}
|
|
18
24
|
/**
|
|
19
25
|
* Parses a comment line from the source
|
|
@@ -35,6 +41,4 @@ var Comment = /*#__PURE__*/function (_Node) {
|
|
|
35
41
|
}]);
|
|
36
42
|
|
|
37
43
|
return Comment;
|
|
38
|
-
}(Node);
|
|
39
|
-
|
|
40
|
-
export { Comment as default };
|
|
44
|
+
}(Node);
|
|
@@ -1,21 +1,27 @@
|
|
|
1
1
|
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
2
2
|
import _createClass from "@babel/runtime/helpers/createClass";
|
|
3
|
+
import _inherits from "@babel/runtime/helpers/inherits";
|
|
3
4
|
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
4
5
|
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
5
|
-
import _inherits from "@babel/runtime/helpers/inherits";
|
|
6
|
-
import { Type } from '../constants';
|
|
7
|
-
import Node from './Node';
|
|
8
|
-
import Range from './Range';
|
|
9
6
|
|
|
10
|
-
var
|
|
7
|
+
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); }; }
|
|
8
|
+
|
|
9
|
+
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; } }
|
|
10
|
+
|
|
11
|
+
import { Type } from '../constants';
|
|
12
|
+
import { Node } from './Node';
|
|
13
|
+
import { Range } from './Range';
|
|
14
|
+
export var Directive = /*#__PURE__*/function (_Node) {
|
|
11
15
|
_inherits(Directive, _Node);
|
|
12
16
|
|
|
17
|
+
var _super = _createSuper(Directive);
|
|
18
|
+
|
|
13
19
|
function Directive() {
|
|
14
20
|
var _this;
|
|
15
21
|
|
|
16
22
|
_classCallCheck(this, Directive);
|
|
17
23
|
|
|
18
|
-
_this =
|
|
24
|
+
_this = _super.call(this, Type.DIRECTIVE);
|
|
19
25
|
_this.name = null;
|
|
20
26
|
return _this;
|
|
21
27
|
}
|
|
@@ -67,6 +73,4 @@ var Directive = /*#__PURE__*/function (_Node) {
|
|
|
67
73
|
}]);
|
|
68
74
|
|
|
69
75
|
return Directive;
|
|
70
|
-
}(Node);
|
|
71
|
-
|
|
72
|
-
export { Directive as default };
|
|
76
|
+
}(Node);
|