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.
Files changed (162) hide show
  1. package/README.md +25 -25
  2. package/browser/dist/PlainValue-b8036b75.js +1275 -0
  3. package/browser/dist/Schema-e94716c8.js +682 -0
  4. package/browser/dist/index.js +860 -27
  5. package/browser/dist/legacy-exports.js +3 -0
  6. package/browser/dist/package.json +1 -0
  7. package/browser/dist/parse-cst.js +1904 -0
  8. package/browser/dist/resolveSeq-492ab440.js +2419 -0
  9. package/browser/dist/types.js +4 -0
  10. package/browser/dist/util.js +2 -0
  11. package/browser/dist/warnings-df54cb69.js +499 -0
  12. package/browser/index.js +1 -1
  13. package/browser/map.js +2 -4
  14. package/browser/pair.js +2 -4
  15. package/browser/parse-cst.js +1 -1
  16. package/browser/scalar.js +2 -4
  17. package/browser/schema.js +7 -10
  18. package/browser/seq.js +2 -4
  19. package/browser/types/binary.js +7 -5
  20. package/browser/types/omap.js +3 -4
  21. package/browser/types/pairs.js +3 -4
  22. package/browser/types/set.js +3 -4
  23. package/browser/types/timestamp.js +9 -5
  24. package/browser/types.js +1 -13
  25. package/browser/util.js +1 -18
  26. package/dist/Document-9b4560a1.js +757 -0
  27. package/dist/PlainValue-ec8e588e.js +876 -0
  28. package/dist/Schema-88e323a7.js +525 -0
  29. package/dist/index.js +20 -84
  30. package/dist/legacy-exports.js +16 -0
  31. package/dist/parse-cst.js +1753 -0
  32. package/dist/resolveSeq-d03cb037.js +2161 -0
  33. package/dist/test-events.js +11 -9
  34. package/dist/types.js +23 -0
  35. package/dist/util.js +19 -0
  36. package/dist/warnings-1000a372.js +416 -0
  37. package/index.d.ts +23 -9
  38. package/map.js +2 -2
  39. package/package.json +27 -42
  40. package/pair.js +2 -2
  41. package/parse-cst.d.ts +4 -0
  42. package/parse-cst.js +1 -1
  43. package/scalar.js +2 -2
  44. package/schema.js +8 -6
  45. package/seq.js +2 -2
  46. package/types/binary.js +3 -2
  47. package/types/omap.js +3 -2
  48. package/types/pairs.js +3 -2
  49. package/types/set.js +3 -2
  50. package/types/timestamp.js +6 -6
  51. package/types.d.ts +113 -98
  52. package/types.js +16 -11
  53. package/types.mjs +15 -19
  54. package/util.js +14 -14
  55. package/util.mjs +13 -20
  56. package/browser/dist/Anchors.js +0 -130
  57. package/browser/dist/Document.js +0 -824
  58. package/browser/dist/addComment.js +0 -8
  59. package/browser/dist/constants.js +0 -26
  60. package/browser/dist/cst/Alias.js +0 -46
  61. package/browser/dist/cst/BlankLine.js +0 -52
  62. package/browser/dist/cst/BlockValue.js +0 -251
  63. package/browser/dist/cst/Collection.js +0 -278
  64. package/browser/dist/cst/CollectionItem.js +0 -140
  65. package/browser/dist/cst/Comment.js +0 -44
  66. package/browser/dist/cst/Directive.js +0 -76
  67. package/browser/dist/cst/Document.js +0 -286
  68. package/browser/dist/cst/FlowCollection.js +0 -220
  69. package/browser/dist/cst/Node.js +0 -386
  70. package/browser/dist/cst/ParseContext.js +0 -246
  71. package/browser/dist/cst/PlainValue.js +0 -170
  72. package/browser/dist/cst/QuoteDouble.js +0 -245
  73. package/browser/dist/cst/QuoteSingle.js +0 -120
  74. package/browser/dist/cst/Range.js +0 -64
  75. package/browser/dist/cst/parse.js +0 -48
  76. package/browser/dist/cst/source-utils.js +0 -168
  77. package/browser/dist/errors.js +0 -127
  78. package/browser/dist/foldFlowLines.js +0 -138
  79. package/browser/dist/listTagNames.js +0 -28
  80. package/browser/dist/schema/Alias.js +0 -135
  81. package/browser/dist/schema/Collection.js +0 -260
  82. package/browser/dist/schema/Map.js +0 -161
  83. package/browser/dist/schema/Merge.js +0 -118
  84. package/browser/dist/schema/Node.js +0 -4
  85. package/browser/dist/schema/Pair.js +0 -194
  86. package/browser/dist/schema/Scalar.js +0 -42
  87. package/browser/dist/schema/Seq.js +0 -116
  88. package/browser/dist/schema/index.js +0 -368
  89. package/browser/dist/schema/parseMap.js +0 -312
  90. package/browser/dist/schema/parseSeq.js +0 -168
  91. package/browser/dist/schema/parseUtils.js +0 -106
  92. package/browser/dist/stringify.js +0 -332
  93. package/browser/dist/tags/core.js +0 -141
  94. package/browser/dist/tags/failsafe/index.js +0 -4
  95. package/browser/dist/tags/failsafe/map.js +0 -53
  96. package/browser/dist/tags/failsafe/seq.js +0 -39
  97. package/browser/dist/tags/failsafe/string.js +0 -28
  98. package/browser/dist/tags/index.js +0 -36
  99. package/browser/dist/tags/json.js +0 -77
  100. package/browser/dist/tags/options.js +0 -26
  101. package/browser/dist/tags/yaml-1.1/binary.js +0 -87
  102. package/browser/dist/tags/yaml-1.1/index.js +0 -189
  103. package/browser/dist/tags/yaml-1.1/omap.js +0 -137
  104. package/browser/dist/tags/yaml-1.1/pairs.js +0 -78
  105. package/browser/dist/tags/yaml-1.1/set.js +0 -118
  106. package/browser/dist/tags/yaml-1.1/timestamp.js +0 -97
  107. package/browser/dist/test-events.js +0 -163
  108. package/browser/dist/toJSON.js +0 -19
  109. package/browser/dist/warnings.js +0 -39
  110. package/dist/Anchors.js +0 -120
  111. package/dist/Document.js +0 -714
  112. package/dist/addComment.js +0 -14
  113. package/dist/constants.js +0 -31
  114. package/dist/cst/Alias.js +0 -33
  115. package/dist/cst/BlankLine.js +0 -40
  116. package/dist/cst/BlockValue.js +0 -243
  117. package/dist/cst/Collection.js +0 -266
  118. package/dist/cst/CollectionItem.js +0 -135
  119. package/dist/cst/Comment.js +0 -33
  120. package/dist/cst/Directive.js +0 -59
  121. package/dist/cst/Document.js +0 -276
  122. package/dist/cst/FlowCollection.js +0 -213
  123. package/dist/cst/Node.js +0 -360
  124. package/dist/cst/ParseContext.js +0 -253
  125. package/dist/cst/PlainValue.js +0 -156
  126. package/dist/cst/QuoteDouble.js +0 -232
  127. package/dist/cst/QuoteSingle.js +0 -108
  128. package/dist/cst/Range.js +0 -60
  129. package/dist/cst/parse.js +0 -50
  130. package/dist/cst/source-utils.js +0 -175
  131. package/dist/errors.js +0 -97
  132. package/dist/foldFlowLines.js +0 -143
  133. package/dist/listTagNames.js +0 -33
  134. package/dist/schema/Alias.js +0 -105
  135. package/dist/schema/Collection.js +0 -184
  136. package/dist/schema/Map.js +0 -98
  137. package/dist/schema/Merge.js +0 -75
  138. package/dist/schema/Node.js +0 -7
  139. package/dist/schema/Pair.js +0 -174
  140. package/dist/schema/Scalar.js +0 -26
  141. package/dist/schema/Seq.js +0 -73
  142. package/dist/schema/index.js +0 -310
  143. package/dist/schema/parseMap.js +0 -334
  144. package/dist/schema/parseSeq.js +0 -175
  145. package/dist/schema/parseUtils.js +0 -101
  146. package/dist/stringify.js +0 -352
  147. package/dist/tags/core.js +0 -121
  148. package/dist/tags/failsafe/index.js +0 -12
  149. package/dist/tags/failsafe/map.js +0 -32
  150. package/dist/tags/failsafe/seq.js +0 -29
  151. package/dist/tags/failsafe/string.js +0 -37
  152. package/dist/tags/index.js +0 -53
  153. package/dist/tags/json.js +0 -64
  154. package/dist/tags/options.js +0 -36
  155. package/dist/tags/yaml-1.1/binary.js +0 -94
  156. package/dist/tags/yaml-1.1/index.js +0 -162
  157. package/dist/tags/yaml-1.1/omap.js +0 -100
  158. package/dist/tags/yaml-1.1/pairs.js +0 -75
  159. package/dist/tags/yaml-1.1/set.js +0 -82
  160. package/dist/tags/yaml-1.1/timestamp.js +0 -90
  161. package/dist/toJSON.js +0 -21
  162. package/dist/warnings.js +0 -48
@@ -0,0 +1,4 @@
1
+ export { A as Alias, C as Collection, M as Merge, N as Node, P as Pair, S as Scalar, d as YAMLMap, Y as YAMLSeq, b as binaryOptions, a as boolOptions, i as intOptions, n as nullOptions, s as strOptions } from './resolveSeq-492ab440.js';
2
+ export { S as Schema } from './Schema-e94716c8.js';
3
+ import './PlainValue-b8036b75.js';
4
+ import './warnings-df54cb69.js';
@@ -0,0 +1,2 @@
1
+ export { l as findPair, g as parseMap, h as parseSeq, k as stringifyNumber, c as stringifyString, t as toJSON } from './resolveSeq-492ab440.js';
2
+ export { T as Type, i as YAMLError, o as YAMLReferenceError, g as YAMLSemanticError, Y as YAMLSyntaxError, f as YAMLWarning } from './PlainValue-b8036b75.js';
@@ -0,0 +1,499 @@
1
+ import { o as YAMLReferenceError, T as Type, g as YAMLSemanticError, _ as _createForOfIteratorHelper, e as _defineProperty, j as _inherits, k as _createSuper, c as _classCallCheck, p as _assertThisInitialized, b as _createClass, a as _typeof, l as _get, m as _getPrototypeOf } from './PlainValue-b8036b75.js';
2
+ import { j as resolveString, b as binaryOptions, c as stringifyString, h as resolveSeq, P as Pair, d as YAMLMap, Y as YAMLSeq, t as toJSON, S as Scalar, l as findPair, g as resolveMap, k as stringifyNumber } from './resolveSeq-492ab440.js';
3
+
4
+ /* global atob, btoa, Buffer */
5
+ var binary = {
6
+ identify: function identify(value) {
7
+ return value instanceof Uint8Array;
8
+ },
9
+ // Buffer inherits from Uint8Array
10
+ default: false,
11
+ tag: 'tag:yaml.org,2002:binary',
12
+
13
+ /**
14
+ * Returns a Buffer in node and an Uint8Array in browsers
15
+ *
16
+ * To use the resulting buffer as an image, you'll want to do something like:
17
+ *
18
+ * const blob = new Blob([buffer], { type: 'image/jpeg' })
19
+ * document.querySelector('#photo').src = URL.createObjectURL(blob)
20
+ */
21
+ resolve: function resolve(doc, node) {
22
+ var src = resolveString(doc, node);
23
+
24
+ if (typeof Buffer === 'function') {
25
+ return Buffer.from(src, 'base64');
26
+ } else if (typeof atob === 'function') {
27
+ // On IE 11, atob() can't handle newlines
28
+ var str = atob(src.replace(/[\n\r]/g, ''));
29
+ var buffer = new Uint8Array(str.length);
30
+
31
+ for (var i = 0; i < str.length; ++i) {
32
+ buffer[i] = str.charCodeAt(i);
33
+ }
34
+
35
+ return buffer;
36
+ } else {
37
+ var msg = 'This environment does not support reading binary tags; either Buffer or atob is required';
38
+ doc.errors.push(new YAMLReferenceError(node, msg));
39
+ return null;
40
+ }
41
+ },
42
+ options: binaryOptions,
43
+ stringify: function stringify(_ref, ctx, onComment, onChompKeep) {
44
+ var comment = _ref.comment,
45
+ type = _ref.type,
46
+ value = _ref.value;
47
+ var src;
48
+
49
+ if (typeof Buffer === 'function') {
50
+ src = value instanceof Buffer ? value.toString('base64') : Buffer.from(value.buffer).toString('base64');
51
+ } else if (typeof btoa === 'function') {
52
+ var s = '';
53
+
54
+ for (var i = 0; i < value.length; ++i) {
55
+ s += String.fromCharCode(value[i]);
56
+ }
57
+
58
+ src = btoa(s);
59
+ } else {
60
+ throw new Error('This environment does not support writing binary tags; either Buffer or btoa is required');
61
+ }
62
+
63
+ if (!type) type = binaryOptions.defaultType;
64
+
65
+ if (type === Type.QUOTE_DOUBLE) {
66
+ value = src;
67
+ } else {
68
+ var lineWidth = binaryOptions.lineWidth;
69
+ var n = Math.ceil(src.length / lineWidth);
70
+ var lines = new Array(n);
71
+
72
+ for (var _i = 0, o = 0; _i < n; ++_i, o += lineWidth) {
73
+ lines[_i] = src.substr(o, lineWidth);
74
+ }
75
+
76
+ value = lines.join(type === Type.BLOCK_LITERAL ? '\n' : ' ');
77
+ }
78
+
79
+ return stringifyString({
80
+ comment: comment,
81
+ type: type,
82
+ value: value
83
+ }, ctx, onComment, onChompKeep);
84
+ }
85
+ };
86
+
87
+ function parsePairs(doc, cst) {
88
+ var seq = resolveSeq(doc, cst);
89
+
90
+ for (var i = 0; i < seq.items.length; ++i) {
91
+ var item = seq.items[i];
92
+ if (item instanceof Pair) continue;else if (item instanceof YAMLMap) {
93
+ if (item.items.length > 1) {
94
+ var msg = 'Each pair must have its own sequence indicator';
95
+ throw new YAMLSemanticError(cst, msg);
96
+ }
97
+
98
+ var pair = item.items[0] || new Pair();
99
+ if (item.commentBefore) pair.commentBefore = pair.commentBefore ? "".concat(item.commentBefore, "\n").concat(pair.commentBefore) : item.commentBefore;
100
+ if (item.comment) pair.comment = pair.comment ? "".concat(item.comment, "\n").concat(pair.comment) : item.comment;
101
+ item = pair;
102
+ }
103
+ seq.items[i] = item instanceof Pair ? item : new Pair(item);
104
+ }
105
+
106
+ return seq;
107
+ }
108
+ function createPairs(schema, iterable, ctx) {
109
+ var pairs = new YAMLSeq(schema);
110
+ pairs.tag = 'tag:yaml.org,2002:pairs';
111
+
112
+ var _iterator = _createForOfIteratorHelper(iterable),
113
+ _step;
114
+
115
+ try {
116
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
117
+ var it = _step.value;
118
+ var key = void 0,
119
+ value = void 0;
120
+
121
+ if (Array.isArray(it)) {
122
+ if (it.length === 2) {
123
+ key = it[0];
124
+ value = it[1];
125
+ } else throw new TypeError("Expected [key, value] tuple: ".concat(it));
126
+ } else if (it && it instanceof Object) {
127
+ var keys = Object.keys(it);
128
+
129
+ if (keys.length === 1) {
130
+ key = keys[0];
131
+ value = it[key];
132
+ } else throw new TypeError("Expected { key: value } tuple: ".concat(it));
133
+ } else {
134
+ key = it;
135
+ }
136
+
137
+ var pair = schema.createPair(key, value, ctx);
138
+ pairs.items.push(pair);
139
+ }
140
+ } catch (err) {
141
+ _iterator.e(err);
142
+ } finally {
143
+ _iterator.f();
144
+ }
145
+
146
+ return pairs;
147
+ }
148
+ var pairs = {
149
+ default: false,
150
+ tag: 'tag:yaml.org,2002:pairs',
151
+ resolve: parsePairs,
152
+ createNode: createPairs
153
+ };
154
+
155
+ var YAMLOMap = /*#__PURE__*/function (_YAMLSeq) {
156
+ _inherits(YAMLOMap, _YAMLSeq);
157
+
158
+ var _super = _createSuper(YAMLOMap);
159
+
160
+ function YAMLOMap() {
161
+ var _this;
162
+
163
+ _classCallCheck(this, YAMLOMap);
164
+
165
+ _this = _super.call(this);
166
+
167
+ _defineProperty(_assertThisInitialized(_this), "add", YAMLMap.prototype.add.bind(_assertThisInitialized(_this)));
168
+
169
+ _defineProperty(_assertThisInitialized(_this), "delete", YAMLMap.prototype.delete.bind(_assertThisInitialized(_this)));
170
+
171
+ _defineProperty(_assertThisInitialized(_this), "get", YAMLMap.prototype.get.bind(_assertThisInitialized(_this)));
172
+
173
+ _defineProperty(_assertThisInitialized(_this), "has", YAMLMap.prototype.has.bind(_assertThisInitialized(_this)));
174
+
175
+ _defineProperty(_assertThisInitialized(_this), "set", YAMLMap.prototype.set.bind(_assertThisInitialized(_this)));
176
+
177
+ _this.tag = YAMLOMap.tag;
178
+ return _this;
179
+ }
180
+
181
+ _createClass(YAMLOMap, [{
182
+ key: "toJSON",
183
+ value: function toJSON$1(_, ctx) {
184
+ var map = new Map();
185
+ if (ctx && ctx.onCreate) ctx.onCreate(map);
186
+
187
+ var _iterator = _createForOfIteratorHelper(this.items),
188
+ _step;
189
+
190
+ try {
191
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
192
+ var pair = _step.value;
193
+ var key = void 0,
194
+ value = void 0;
195
+
196
+ if (pair instanceof Pair) {
197
+ key = toJSON(pair.key, '', ctx);
198
+ value = toJSON(pair.value, key, ctx);
199
+ } else {
200
+ key = toJSON(pair, '', ctx);
201
+ }
202
+
203
+ if (map.has(key)) throw new Error('Ordered maps must not include duplicate keys');
204
+ map.set(key, value);
205
+ }
206
+ } catch (err) {
207
+ _iterator.e(err);
208
+ } finally {
209
+ _iterator.f();
210
+ }
211
+
212
+ return map;
213
+ }
214
+ }]);
215
+
216
+ return YAMLOMap;
217
+ }(YAMLSeq);
218
+
219
+ _defineProperty(YAMLOMap, "tag", 'tag:yaml.org,2002:omap');
220
+
221
+ function parseOMap(doc, cst) {
222
+ var pairs = parsePairs(doc, cst);
223
+ var seenKeys = [];
224
+
225
+ var _iterator2 = _createForOfIteratorHelper(pairs.items),
226
+ _step2;
227
+
228
+ try {
229
+ for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
230
+ var key = _step2.value.key;
231
+
232
+ if (key instanceof Scalar) {
233
+ if (seenKeys.includes(key.value)) {
234
+ var msg = 'Ordered maps must not include duplicate keys';
235
+ throw new YAMLSemanticError(cst, msg);
236
+ } else {
237
+ seenKeys.push(key.value);
238
+ }
239
+ }
240
+ }
241
+ } catch (err) {
242
+ _iterator2.e(err);
243
+ } finally {
244
+ _iterator2.f();
245
+ }
246
+
247
+ return Object.assign(new YAMLOMap(), pairs);
248
+ }
249
+
250
+ function createOMap(schema, iterable, ctx) {
251
+ var pairs = createPairs(schema, iterable, ctx);
252
+ var omap = new YAMLOMap();
253
+ omap.items = pairs.items;
254
+ return omap;
255
+ }
256
+
257
+ var omap = {
258
+ identify: function identify(value) {
259
+ return value instanceof Map;
260
+ },
261
+ nodeClass: YAMLOMap,
262
+ default: false,
263
+ tag: 'tag:yaml.org,2002:omap',
264
+ resolve: parseOMap,
265
+ createNode: createOMap
266
+ };
267
+
268
+ var YAMLSet = /*#__PURE__*/function (_YAMLMap) {
269
+ _inherits(YAMLSet, _YAMLMap);
270
+
271
+ var _super = _createSuper(YAMLSet);
272
+
273
+ function YAMLSet() {
274
+ var _this;
275
+
276
+ _classCallCheck(this, YAMLSet);
277
+
278
+ _this = _super.call(this);
279
+ _this.tag = YAMLSet.tag;
280
+ return _this;
281
+ }
282
+
283
+ _createClass(YAMLSet, [{
284
+ key: "add",
285
+ value: function add(key) {
286
+ var pair = key instanceof Pair ? key : new Pair(key);
287
+ var prev = findPair(this.items, pair.key);
288
+ if (!prev) this.items.push(pair);
289
+ }
290
+ }, {
291
+ key: "get",
292
+ value: function get(key, keepPair) {
293
+ var pair = findPair(this.items, key);
294
+ return !keepPair && pair instanceof Pair ? pair.key instanceof Scalar ? pair.key.value : pair.key : pair;
295
+ }
296
+ }, {
297
+ key: "set",
298
+ value: function set(key, value) {
299
+ if (typeof value !== 'boolean') throw new Error("Expected boolean value for set(key, value) in a YAML set, not ".concat(_typeof(value)));
300
+ var prev = findPair(this.items, key);
301
+
302
+ if (prev && !value) {
303
+ this.items.splice(this.items.indexOf(prev), 1);
304
+ } else if (!prev && value) {
305
+ this.items.push(new Pair(key));
306
+ }
307
+ }
308
+ }, {
309
+ key: "toJSON",
310
+ value: function toJSON(_, ctx) {
311
+ return _get(_getPrototypeOf(YAMLSet.prototype), "toJSON", this).call(this, _, ctx, Set);
312
+ }
313
+ }, {
314
+ key: "toString",
315
+ value: function toString(ctx, onComment, onChompKeep) {
316
+ if (!ctx) return JSON.stringify(this);
317
+ if (this.hasAllNullValues()) return _get(_getPrototypeOf(YAMLSet.prototype), "toString", this).call(this, ctx, onComment, onChompKeep);else throw new Error('Set items must all have null values');
318
+ }
319
+ }]);
320
+
321
+ return YAMLSet;
322
+ }(YAMLMap);
323
+
324
+ _defineProperty(YAMLSet, "tag", 'tag:yaml.org,2002:set');
325
+
326
+ function parseSet(doc, cst) {
327
+ var map = resolveMap(doc, cst);
328
+ if (!map.hasAllNullValues()) throw new YAMLSemanticError(cst, 'Set items must all have null values');
329
+ return Object.assign(new YAMLSet(), map);
330
+ }
331
+
332
+ function createSet(schema, iterable, ctx) {
333
+ var set = new YAMLSet();
334
+
335
+ var _iterator = _createForOfIteratorHelper(iterable),
336
+ _step;
337
+
338
+ try {
339
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
340
+ var value = _step.value;
341
+ set.items.push(schema.createPair(value, null, ctx));
342
+ }
343
+ } catch (err) {
344
+ _iterator.e(err);
345
+ } finally {
346
+ _iterator.f();
347
+ }
348
+
349
+ return set;
350
+ }
351
+
352
+ var set = {
353
+ identify: function identify(value) {
354
+ return value instanceof Set;
355
+ },
356
+ nodeClass: YAMLSet,
357
+ default: false,
358
+ tag: 'tag:yaml.org,2002:set',
359
+ resolve: parseSet,
360
+ createNode: createSet
361
+ };
362
+
363
+ var parseSexagesimal = function parseSexagesimal(sign, parts) {
364
+ var n = parts.split(':').reduce(function (n, p) {
365
+ return n * 60 + Number(p);
366
+ }, 0);
367
+ return sign === '-' ? -n : n;
368
+ }; // hhhh:mm:ss.sss
369
+
370
+
371
+ var stringifySexagesimal = function stringifySexagesimal(_ref) {
372
+ var value = _ref.value;
373
+ if (isNaN(value) || !isFinite(value)) return stringifyNumber(value);
374
+ var sign = '';
375
+
376
+ if (value < 0) {
377
+ sign = '-';
378
+ value = Math.abs(value);
379
+ }
380
+
381
+ var parts = [value % 60]; // seconds, including ms
382
+
383
+ if (value < 60) {
384
+ parts.unshift(0); // at least one : is required
385
+ } else {
386
+ value = Math.round((value - parts[0]) / 60);
387
+ parts.unshift(value % 60); // minutes
388
+
389
+ if (value >= 60) {
390
+ value = Math.round((value - parts[0]) / 60);
391
+ parts.unshift(value); // hours
392
+ }
393
+ }
394
+
395
+ return sign + parts.map(function (n) {
396
+ return n < 10 ? '0' + String(n) : String(n);
397
+ }).join(':').replace(/000000\d*$/, '') // % 60 may introduce error
398
+ ;
399
+ };
400
+
401
+ var intTime = {
402
+ identify: function identify(value) {
403
+ return typeof value === 'number';
404
+ },
405
+ default: true,
406
+ tag: 'tag:yaml.org,2002:int',
407
+ format: 'TIME',
408
+ test: /^([-+]?)([0-9][0-9_]*(?::[0-5]?[0-9])+)$/,
409
+ resolve: function resolve(str, sign, parts) {
410
+ return parseSexagesimal(sign, parts.replace(/_/g, ''));
411
+ },
412
+ stringify: stringifySexagesimal
413
+ };
414
+ var floatTime = {
415
+ identify: function identify(value) {
416
+ return typeof value === 'number';
417
+ },
418
+ default: true,
419
+ tag: 'tag:yaml.org,2002:float',
420
+ format: 'TIME',
421
+ test: /^([-+]?)([0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*)$/,
422
+ resolve: function resolve(str, sign, parts) {
423
+ return parseSexagesimal(sign, parts.replace(/_/g, ''));
424
+ },
425
+ stringify: stringifySexagesimal
426
+ };
427
+ var timestamp = {
428
+ identify: function identify(value) {
429
+ return value instanceof Date;
430
+ },
431
+ default: true,
432
+ tag: 'tag:yaml.org,2002:timestamp',
433
+ // If the time zone is omitted, the timestamp is assumed to be specified in UTC. The time part
434
+ // may be omitted altogether, resulting in a date format. In such a case, the time part is
435
+ // assumed to be 00:00:00Z (start of day, UTC).
436
+ test: RegExp('^(?:' + '([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})' + // YYYY-Mm-Dd
437
+ '(?:(?:t|T|[ \\t]+)' + // t | T | whitespace
438
+ '([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)' + // Hh:Mm:Ss(.ss)?
439
+ '(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?' + // Z | +5 | -03:30
440
+ ')?' + ')$'),
441
+ resolve: function resolve(str, year, month, day, hour, minute, second, millisec, tz) {
442
+ if (millisec) millisec = (millisec + '00').substr(1, 3);
443
+ var date = Date.UTC(year, month - 1, day, hour || 0, minute || 0, second || 0, millisec || 0);
444
+
445
+ if (tz && tz !== 'Z') {
446
+ var d = parseSexagesimal(tz[0], tz.slice(1));
447
+ if (Math.abs(d) < 30) d *= 60;
448
+ date -= 60000 * d;
449
+ }
450
+
451
+ return new Date(date);
452
+ },
453
+ stringify: function stringify(_ref2) {
454
+ var value = _ref2.value;
455
+ return value.toISOString().replace(/((T00:00)?:00)?\.000Z$/, '');
456
+ }
457
+ };
458
+
459
+ /* global console, process, YAML_SILENCE_DEPRECATION_WARNINGS, YAML_SILENCE_WARNINGS */
460
+ function shouldWarn(deprecation) {
461
+ var env = typeof process !== 'undefined' && process.env || {};
462
+
463
+ if (deprecation) {
464
+ if (typeof YAML_SILENCE_DEPRECATION_WARNINGS !== 'undefined') return !YAML_SILENCE_DEPRECATION_WARNINGS;
465
+ return !env.YAML_SILENCE_DEPRECATION_WARNINGS;
466
+ }
467
+
468
+ if (typeof YAML_SILENCE_WARNINGS !== 'undefined') return !YAML_SILENCE_WARNINGS;
469
+ return !env.YAML_SILENCE_WARNINGS;
470
+ }
471
+
472
+ function warn(warning, type) {
473
+ if (shouldWarn(false)) {
474
+ var emit = typeof process !== 'undefined' && process.emitWarning; // This will throw in Jest if `warning` is an Error instance due to
475
+ // https://github.com/facebook/jest/issues/2549
476
+
477
+ if (emit) emit(warning, type);else {
478
+ // eslint-disable-next-line no-console
479
+ console.warn(type ? "".concat(type, ": ").concat(warning) : warning);
480
+ }
481
+ }
482
+ }
483
+ function warnFileDeprecation(filename) {
484
+ if (shouldWarn(true)) {
485
+ var path = filename.replace(/.*yaml[/\\]/i, '').replace(/\.js$/, '').replace(/\\/g, '/');
486
+ warn("The endpoint 'yaml/".concat(path, "' will be removed in a future release."), 'DeprecationWarning');
487
+ }
488
+ }
489
+ var warned = {};
490
+ function warnOptionDeprecation(name, alternative) {
491
+ if (!warned[name] && shouldWarn(true)) {
492
+ warned[name] = true;
493
+ var msg = "The option '".concat(name, "' will be removed in a future release");
494
+ msg += alternative ? ", use '".concat(alternative, "' instead.") : '.';
495
+ warn(msg, 'DeprecationWarning');
496
+ }
497
+ }
498
+
499
+ export { warnOptionDeprecation as a, binary as b, warnFileDeprecation as c, floatTime as f, intTime as i, omap as o, pairs as p, set as s, timestamp as t, warn as w };
package/browser/index.js CHANGED
@@ -1 +1 @@
1
- export { YAML as default } from './dist'
1
+ module.exports = require('./dist').YAML
package/browser/map.js CHANGED
@@ -1,4 +1,2 @@
1
- export { YAMLMap as default } from './dist/schema/Map'
2
-
3
- import { warnFileDeprecation } from './dist/warnings'
4
- warnFileDeprecation(__filename)
1
+ module.exports = require('./dist/types').YAMLMap
2
+ require('./dist/legacy-exports').warnFileDeprecation(__filename)
package/browser/pair.js CHANGED
@@ -1,4 +1,2 @@
1
- export { Pair as default } from './dist/schema/Pair'
2
-
3
- import { warnFileDeprecation } from './dist/warnings'
4
- warnFileDeprecation(__filename)
1
+ module.exports = require('./dist/types').Pair
2
+ require('./dist/legacy-exports').warnFileDeprecation(__filename)
@@ -1 +1 @@
1
- export { parse as default } from './dist/cst/parse'
1
+ module.exports = require('./dist/parse-cst').parse
package/browser/scalar.js CHANGED
@@ -1,4 +1,2 @@
1
- export { Scalar as default } from './dist/schema/Scalar'
2
-
3
- import { warnFileDeprecation } from './dist/warnings'
4
- warnFileDeprecation(__filename)
1
+ module.exports = require('./dist/types').Scalar
2
+ require('./dist/legacy-exports').warnFileDeprecation(__filename)
package/browser/schema.js CHANGED
@@ -1,12 +1,9 @@
1
- import { Schema } from './dist/schema'
2
- import { nullOptions, strOptions } from './dist/tags/options'
3
- import { stringifyString } from './dist/stringify'
1
+ const types = require('./dist/types')
2
+ const util = require('./dist/util')
4
3
 
5
- Schema.nullOptions = nullOptions
6
- Schema.strOptions = strOptions
7
- Schema.stringify = stringifyString
8
- export { Schema as default }
9
- export { nullOptions, strOptions, stringifyString as stringify }
4
+ module.exports = types.Schema
5
+ module.exports.nullOptions = types.nullOptions
6
+ module.exports.strOptions = types.strOptions
7
+ module.exports.stringify = util.stringifyString
10
8
 
11
- import { warnFileDeprecation } from './dist/warnings'
12
- warnFileDeprecation(__filename)
9
+ require('./dist/legacy-exports').warnFileDeprecation(__filename)
package/browser/seq.js CHANGED
@@ -1,4 +1,2 @@
1
- export { YAMLSeq as default } from './dist/schema/Seq'
2
-
3
- import { warnFileDeprecation } from './dist/warnings'
4
- warnFileDeprecation(__filename)
1
+ module.exports = require('./dist/types').YAMLSeq
2
+ require('./dist/legacy-exports').warnFileDeprecation(__filename)
@@ -1,6 +1,8 @@
1
- import { binary } from '../dist/tags/yaml-1.1/binary'
2
- export { binary }
3
- export default [binary]
1
+ 'use strict'
2
+ Object.defineProperty(exports, '__esModule', { value: true })
4
3
 
5
- import { warnFileDeprecation } from './dist/warnings'
6
- warnFileDeprecation(__filename)
4
+ const legacy = require('../dist/legacy-exports')
5
+ exports.binary = legacy.binary
6
+ exports.default = [exports.binary]
7
+
8
+ legacy.warnFileDeprecation(__filename)
@@ -1,4 +1,3 @@
1
- export { omap as default } from '../dist/tags/yaml-1.1/omap'
2
-
3
- import { warnFileDeprecation } from './dist/warnings'
4
- warnFileDeprecation(__filename)
1
+ const legacy = require('../dist/legacy-exports')
2
+ module.exports = legacy.omap
3
+ legacy.warnFileDeprecation(__filename)
@@ -1,4 +1,3 @@
1
- export { pairs as default } from '../dist/tags/yaml-1.1/pairs'
2
-
3
- import { warnFileDeprecation } from './dist/warnings'
4
- warnFileDeprecation(__filename)
1
+ const legacy = require('../dist/legacy-exports')
2
+ module.exports = legacy.pairs
3
+ legacy.warnFileDeprecation(__filename)
@@ -1,4 +1,3 @@
1
- export { set as default } from '../dist/tags/yaml-1.1/set'
2
-
3
- import { warnFileDeprecation } from './dist/warnings'
4
- warnFileDeprecation(__filename)
1
+ const legacy = require('../dist/legacy-exports')
2
+ module.exports = legacy.set
3
+ legacy.warnFileDeprecation(__filename)
@@ -1,6 +1,10 @@
1
- import { floatTime, intTime, timestamp } from '../dist/tags/yaml-1.1/timestamp'
2
- export { floatTime, intTime, timestamp }
3
- export default [intTime, floatTime, timestamp]
1
+ 'use strict'
2
+ Object.defineProperty(exports, '__esModule', { value: true })
4
3
 
5
- import { warnFileDeprecation } from './dist/warnings'
6
- warnFileDeprecation(__filename)
4
+ const legacy = require('../dist/legacy-exports')
5
+ exports.default = [legacy.intTime, legacy.floatTime, legacy.timestamp]
6
+ exports.floatTime = legacy.floatTime
7
+ exports.intTime = legacy.intTime
8
+ exports.timestamp = legacy.timestamp
9
+
10
+ legacy.warnFileDeprecation(__filename)
package/browser/types.js CHANGED
@@ -1,13 +1 @@
1
- export {
2
- binaryOptions,
3
- boolOptions,
4
- intOptions,
5
- nullOptions,
6
- strOptions
7
- } from './dist/tags/options'
8
-
9
- export { Schema } from './dist/schema'
10
- export { YAMLMap } from './dist/schema/Map'
11
- export { YAMLSeq } from './dist/schema/Seq'
12
- export { Pair } from './dist/schema/Pair'
13
- export { Scalar } from './dist/schema/Scalar'
1
+ module.exports = require('./dist/types')
package/browser/util.js CHANGED
@@ -1,18 +1 @@
1
- export { findPair } from './dist/schema/Map'
2
- export { parseMap } from './dist/schema/parseMap'
3
- export { parseSeq } from './dist/schema/parseSeq'
4
-
5
- export {
6
- stringifyNumber,
7
- stringifyString,
8
- toJSON,
9
- Type
10
- } from './dist/stringify'
11
-
12
- export {
13
- YAMLError,
14
- YAMLReferenceError,
15
- YAMLSemanticError,
16
- YAMLSyntaxError,
17
- YAMLWarning
18
- } from './dist/errors'
1
+ module.exports = require('./dist/util')