yaml 1.9.1 → 1.10.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/README.md +25 -25
- package/browser/dist/PlainValue-b8036b75.js +1275 -0
- package/browser/dist/Schema-e94716c8.js +682 -0
- package/browser/dist/index.js +860 -27
- package/browser/dist/legacy-exports.js +3 -0
- package/browser/dist/package.json +1 -0
- package/browser/dist/parse-cst.js +1904 -0
- package/browser/dist/resolveSeq-492ab440.js +2419 -0
- package/browser/dist/types.js +4 -0
- package/browser/dist/util.js +2 -0
- package/browser/dist/warnings-df54cb69.js +499 -0
- package/browser/index.js +1 -1
- package/browser/map.js +2 -4
- package/browser/pair.js +2 -4
- package/browser/parse-cst.js +1 -1
- package/browser/scalar.js +2 -4
- package/browser/schema.js +7 -10
- package/browser/seq.js +2 -4
- package/browser/types/binary.js +7 -5
- package/browser/types/omap.js +3 -4
- package/browser/types/pairs.js +3 -4
- package/browser/types/set.js +3 -4
- package/browser/types/timestamp.js +9 -5
- package/browser/types.js +1 -13
- package/browser/util.js +1 -18
- package/dist/Document-9b4560a1.js +757 -0
- package/dist/PlainValue-ec8e588e.js +876 -0
- package/dist/Schema-88e323a7.js +525 -0
- package/dist/index.js +20 -84
- package/dist/legacy-exports.js +16 -0
- package/dist/parse-cst.js +1753 -0
- package/dist/resolveSeq-d03cb037.js +2161 -0
- package/dist/test-events.js +11 -9
- package/dist/types.js +23 -0
- package/dist/util.js +19 -0
- package/dist/warnings-1000a372.js +416 -0
- package/index.d.ts +23 -9
- package/map.js +2 -2
- package/package.json +27 -42
- package/pair.js +2 -2
- package/parse-cst.d.ts +4 -0
- package/parse-cst.js +1 -1
- package/scalar.js +2 -2
- package/schema.js +8 -6
- package/seq.js +2 -2
- package/types/binary.js +3 -2
- package/types/omap.js +3 -2
- package/types/pairs.js +3 -2
- package/types/set.js +3 -2
- package/types/timestamp.js +6 -6
- package/types.d.ts +113 -98
- package/types.js +16 -11
- package/types.mjs +15 -19
- package/util.js +14 -14
- package/util.mjs +13 -20
- package/browser/dist/Anchors.js +0 -130
- package/browser/dist/Document.js +0 -824
- package/browser/dist/addComment.js +0 -8
- package/browser/dist/constants.js +0 -26
- package/browser/dist/cst/Alias.js +0 -46
- package/browser/dist/cst/BlankLine.js +0 -52
- package/browser/dist/cst/BlockValue.js +0 -251
- package/browser/dist/cst/Collection.js +0 -278
- package/browser/dist/cst/CollectionItem.js +0 -140
- package/browser/dist/cst/Comment.js +0 -44
- package/browser/dist/cst/Directive.js +0 -76
- package/browser/dist/cst/Document.js +0 -286
- package/browser/dist/cst/FlowCollection.js +0 -220
- package/browser/dist/cst/Node.js +0 -386
- package/browser/dist/cst/ParseContext.js +0 -246
- package/browser/dist/cst/PlainValue.js +0 -170
- package/browser/dist/cst/QuoteDouble.js +0 -245
- package/browser/dist/cst/QuoteSingle.js +0 -120
- package/browser/dist/cst/Range.js +0 -64
- package/browser/dist/cst/parse.js +0 -48
- package/browser/dist/cst/source-utils.js +0 -168
- package/browser/dist/errors.js +0 -127
- package/browser/dist/foldFlowLines.js +0 -138
- package/browser/dist/listTagNames.js +0 -28
- package/browser/dist/schema/Alias.js +0 -135
- package/browser/dist/schema/Collection.js +0 -260
- package/browser/dist/schema/Map.js +0 -161
- package/browser/dist/schema/Merge.js +0 -118
- package/browser/dist/schema/Node.js +0 -4
- package/browser/dist/schema/Pair.js +0 -194
- package/browser/dist/schema/Scalar.js +0 -42
- package/browser/dist/schema/Seq.js +0 -116
- package/browser/dist/schema/index.js +0 -368
- package/browser/dist/schema/parseMap.js +0 -312
- package/browser/dist/schema/parseSeq.js +0 -168
- package/browser/dist/schema/parseUtils.js +0 -106
- package/browser/dist/stringify.js +0 -332
- package/browser/dist/tags/core.js +0 -141
- package/browser/dist/tags/failsafe/index.js +0 -4
- package/browser/dist/tags/failsafe/map.js +0 -53
- package/browser/dist/tags/failsafe/seq.js +0 -39
- package/browser/dist/tags/failsafe/string.js +0 -28
- package/browser/dist/tags/index.js +0 -36
- package/browser/dist/tags/json.js +0 -77
- package/browser/dist/tags/options.js +0 -26
- package/browser/dist/tags/yaml-1.1/binary.js +0 -87
- package/browser/dist/tags/yaml-1.1/index.js +0 -189
- package/browser/dist/tags/yaml-1.1/omap.js +0 -137
- package/browser/dist/tags/yaml-1.1/pairs.js +0 -78
- package/browser/dist/tags/yaml-1.1/set.js +0 -118
- package/browser/dist/tags/yaml-1.1/timestamp.js +0 -97
- package/browser/dist/test-events.js +0 -163
- package/browser/dist/toJSON.js +0 -19
- package/browser/dist/warnings.js +0 -39
- package/dist/Anchors.js +0 -120
- package/dist/Document.js +0 -714
- package/dist/addComment.js +0 -14
- package/dist/constants.js +0 -31
- package/dist/cst/Alias.js +0 -33
- package/dist/cst/BlankLine.js +0 -40
- package/dist/cst/BlockValue.js +0 -243
- package/dist/cst/Collection.js +0 -266
- package/dist/cst/CollectionItem.js +0 -135
- package/dist/cst/Comment.js +0 -33
- package/dist/cst/Directive.js +0 -59
- package/dist/cst/Document.js +0 -276
- package/dist/cst/FlowCollection.js +0 -213
- package/dist/cst/Node.js +0 -360
- package/dist/cst/ParseContext.js +0 -253
- package/dist/cst/PlainValue.js +0 -156
- package/dist/cst/QuoteDouble.js +0 -232
- package/dist/cst/QuoteSingle.js +0 -108
- package/dist/cst/Range.js +0 -60
- package/dist/cst/parse.js +0 -50
- package/dist/cst/source-utils.js +0 -175
- package/dist/errors.js +0 -97
- package/dist/foldFlowLines.js +0 -143
- package/dist/listTagNames.js +0 -33
- package/dist/schema/Alias.js +0 -105
- package/dist/schema/Collection.js +0 -184
- package/dist/schema/Map.js +0 -98
- package/dist/schema/Merge.js +0 -75
- package/dist/schema/Node.js +0 -7
- package/dist/schema/Pair.js +0 -174
- package/dist/schema/Scalar.js +0 -26
- package/dist/schema/Seq.js +0 -73
- package/dist/schema/index.js +0 -310
- package/dist/schema/parseMap.js +0 -334
- package/dist/schema/parseSeq.js +0 -175
- package/dist/schema/parseUtils.js +0 -101
- package/dist/stringify.js +0 -352
- package/dist/tags/core.js +0 -121
- package/dist/tags/failsafe/index.js +0 -12
- package/dist/tags/failsafe/map.js +0 -32
- package/dist/tags/failsafe/seq.js +0 -29
- package/dist/tags/failsafe/string.js +0 -37
- package/dist/tags/index.js +0 -53
- package/dist/tags/json.js +0 -64
- package/dist/tags/options.js +0 -36
- package/dist/tags/yaml-1.1/binary.js +0 -94
- package/dist/tags/yaml-1.1/index.js +0 -162
- package/dist/tags/yaml-1.1/omap.js +0 -100
- package/dist/tags/yaml-1.1/pairs.js +0 -75
- package/dist/tags/yaml-1.1/set.js +0 -82
- package/dist/tags/yaml-1.1/timestamp.js +0 -90
- package/dist/toJSON.js +0 -21
- package/dist/warnings.js +0 -48
package/util.mjs
CHANGED
|
@@ -1,25 +1,18 @@
|
|
|
1
|
-
import
|
|
2
|
-
export const findPair = map.findPair
|
|
1
|
+
import util from './dist/util.js'
|
|
3
2
|
|
|
4
|
-
|
|
5
|
-
export const
|
|
3
|
+
export const findPair = util.findPair
|
|
4
|
+
export const toJSON = util.toJSON
|
|
6
5
|
|
|
7
|
-
|
|
8
|
-
export const parseSeq =
|
|
6
|
+
export const parseMap = util.parseMap
|
|
7
|
+
export const parseSeq = util.parseSeq
|
|
9
8
|
|
|
10
|
-
|
|
11
|
-
export const
|
|
12
|
-
export const stringifyString = str.stringifyString
|
|
9
|
+
export const stringifyNumber = util.stringifyNumber
|
|
10
|
+
export const stringifyString = util.stringifyString
|
|
13
11
|
|
|
14
|
-
|
|
15
|
-
export const toJSON = toJsonPkg.toJSON
|
|
12
|
+
export const Type = util.Type
|
|
16
13
|
|
|
17
|
-
|
|
18
|
-
export const
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
export const
|
|
22
|
-
export const YAMLReferenceError = err.YAMLReferenceError
|
|
23
|
-
export const YAMLSemanticError = err.YAMLSemanticError
|
|
24
|
-
export const YAMLSyntaxError = err.YAMLSyntaxError
|
|
25
|
-
export const YAMLWarning = err.YAMLWarning
|
|
14
|
+
export const YAMLError = util.YAMLError
|
|
15
|
+
export const YAMLReferenceError = util.YAMLReferenceError
|
|
16
|
+
export const YAMLSemanticError = util.YAMLSemanticError
|
|
17
|
+
export const YAMLSyntaxError = util.YAMLSyntaxError
|
|
18
|
+
export const YAMLWarning = util.YAMLWarning
|
package/browser/dist/Anchors.js
DELETED
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
2
|
-
import _createClass from "@babel/runtime/helpers/createClass";
|
|
3
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
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 () {
|
|
10
|
-
_createClass(Anchors, null, [{
|
|
11
|
-
key: "validAnchorNode",
|
|
12
|
-
value: function validAnchorNode(node) {
|
|
13
|
-
return node instanceof Scalar || node instanceof YAMLSeq || node instanceof YAMLMap;
|
|
14
|
-
}
|
|
15
|
-
}]);
|
|
16
|
-
|
|
17
|
-
function Anchors(prefix) {
|
|
18
|
-
_classCallCheck(this, Anchors);
|
|
19
|
-
|
|
20
|
-
_defineProperty(this, "map", {});
|
|
21
|
-
|
|
22
|
-
this.prefix = prefix;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
_createClass(Anchors, [{
|
|
26
|
-
key: "createAlias",
|
|
27
|
-
value: function createAlias(node, name) {
|
|
28
|
-
this.setAnchor(node, name);
|
|
29
|
-
return new Alias(node);
|
|
30
|
-
}
|
|
31
|
-
}, {
|
|
32
|
-
key: "createMergePair",
|
|
33
|
-
value: function createMergePair() {
|
|
34
|
-
var _this = this;
|
|
35
|
-
|
|
36
|
-
var merge = new Merge();
|
|
37
|
-
|
|
38
|
-
for (var _len = arguments.length, sources = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
39
|
-
sources[_key] = arguments[_key];
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
merge.value.items = sources.map(function (s) {
|
|
43
|
-
if (s instanceof Alias) {
|
|
44
|
-
if (s.source instanceof YAMLMap) return s;
|
|
45
|
-
} else if (s instanceof YAMLMap) {
|
|
46
|
-
return _this.createAlias(s);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
throw new Error('Merge sources must be Map nodes or their Aliases');
|
|
50
|
-
});
|
|
51
|
-
return merge;
|
|
52
|
-
}
|
|
53
|
-
}, {
|
|
54
|
-
key: "getName",
|
|
55
|
-
value: function getName(node) {
|
|
56
|
-
var map = this.map;
|
|
57
|
-
return Object.keys(map).find(function (a) {
|
|
58
|
-
return map[a] === node;
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
}, {
|
|
62
|
-
key: "getNode",
|
|
63
|
-
value: function getNode(name) {
|
|
64
|
-
return this.map[name];
|
|
65
|
-
}
|
|
66
|
-
}, {
|
|
67
|
-
key: "newName",
|
|
68
|
-
value: function newName(prefix) {
|
|
69
|
-
if (!prefix) prefix = this.prefix;
|
|
70
|
-
var names = Object.keys(this.map);
|
|
71
|
-
|
|
72
|
-
for (var i = 1; true; ++i) {
|
|
73
|
-
var name = "".concat(prefix).concat(i);
|
|
74
|
-
if (!names.includes(name)) return name;
|
|
75
|
-
}
|
|
76
|
-
} // During parsing, map & aliases contain CST nodes
|
|
77
|
-
|
|
78
|
-
}, {
|
|
79
|
-
key: "resolveNodes",
|
|
80
|
-
value: function resolveNodes() {
|
|
81
|
-
var map = this.map,
|
|
82
|
-
_cstAliases = this._cstAliases;
|
|
83
|
-
Object.keys(map).forEach(function (a) {
|
|
84
|
-
map[a] = map[a].resolved;
|
|
85
|
-
});
|
|
86
|
-
|
|
87
|
-
_cstAliases.forEach(function (a) {
|
|
88
|
-
a.source = a.source.resolved;
|
|
89
|
-
});
|
|
90
|
-
|
|
91
|
-
delete this._cstAliases;
|
|
92
|
-
}
|
|
93
|
-
}, {
|
|
94
|
-
key: "setAnchor",
|
|
95
|
-
value: function setAnchor(node, name) {
|
|
96
|
-
if (node != null && !Anchors.validAnchorNode(node)) {
|
|
97
|
-
throw new Error('Anchors may only be set for Scalar, Seq and Map nodes');
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
if (name && /[\x00-\x19\s,[\]{}]/.test(name)) {
|
|
101
|
-
throw new Error('Anchor names must not contain whitespace or control characters');
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
var map = this.map;
|
|
105
|
-
var prev = node && Object.keys(map).find(function (a) {
|
|
106
|
-
return map[a] === node;
|
|
107
|
-
});
|
|
108
|
-
|
|
109
|
-
if (prev) {
|
|
110
|
-
if (!name) {
|
|
111
|
-
return prev;
|
|
112
|
-
} else if (prev !== name) {
|
|
113
|
-
delete map[prev];
|
|
114
|
-
map[name] = node;
|
|
115
|
-
}
|
|
116
|
-
} else {
|
|
117
|
-
if (!name) {
|
|
118
|
-
if (!node) return null;
|
|
119
|
-
name = this.newName();
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
map[name] = node;
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
return name;
|
|
126
|
-
}
|
|
127
|
-
}]);
|
|
128
|
-
|
|
129
|
-
return Anchors;
|
|
130
|
-
}();
|