yaml 1.10.0 → 2.0.0-1

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 (55) hide show
  1. package/README.md +10 -11
  2. package/browser/dist/Schema-ea978338.js +1211 -0
  3. package/browser/dist/{PlainValue-ff5147c6.js → errors-2634d01a.js} +8 -186
  4. package/browser/dist/index.js +1174 -121
  5. package/browser/dist/parse-cst.js +2 -1904
  6. package/browser/dist/parse-d1ba890f.js +2084 -0
  7. package/browser/dist/{resolveSeq-04825f30.js → stringifyNumber-d8af95b1.js} +197 -1072
  8. package/browser/dist/types.js +3 -4
  9. package/browser/dist/util.js +2 -2
  10. package/browser/index.js +1 -1
  11. package/dist/Document-f89a2614.js +1783 -0
  12. package/dist/Schema-807430ba.js +934 -0
  13. package/dist/{PlainValue-ec8e588e.js → _rollupPluginBabelHelpers-eed30217.js} +0 -167
  14. package/dist/index.js +58 -44
  15. package/dist/parse-3997f544.js +1915 -0
  16. package/dist/parse-cst.js +3 -1742
  17. package/dist/stringifyNumber-dea1120c.js +1286 -0
  18. package/dist/test-events.js +6 -7
  19. package/dist/types.js +16 -17
  20. package/dist/util.js +12 -14
  21. package/index.d.ts +103 -20
  22. package/index.js +1 -1
  23. package/package.json +16 -26
  24. package/types.d.ts +19 -47
  25. package/util.d.ts +2 -12
  26. package/util.js +0 -2
  27. package/util.mjs +0 -3
  28. package/browser/dist/Schema-2bf2c74e.js +0 -679
  29. package/browser/dist/legacy-exports.js +0 -3
  30. package/browser/dist/warnings-0e4b70d3.js +0 -499
  31. package/browser/map.js +0 -2
  32. package/browser/pair.js +0 -2
  33. package/browser/scalar.js +0 -2
  34. package/browser/schema.js +0 -9
  35. package/browser/seq.js +0 -2
  36. package/browser/types/binary.js +0 -8
  37. package/browser/types/omap.js +0 -3
  38. package/browser/types/pairs.js +0 -3
  39. package/browser/types/set.js +0 -3
  40. package/browser/types/timestamp.js +0 -10
  41. package/dist/Document-2cf6b08c.js +0 -757
  42. package/dist/Schema-42e9705c.js +0 -522
  43. package/dist/legacy-exports.js +0 -16
  44. package/dist/resolveSeq-4a68b39b.js +0 -2115
  45. package/dist/warnings-39684f17.js +0 -416
  46. package/map.js +0 -2
  47. package/pair.js +0 -2
  48. package/scalar.js +0 -2
  49. package/schema.js +0 -9
  50. package/seq.js +0 -2
  51. package/types/binary.js +0 -8
  52. package/types/omap.js +0 -3
  53. package/types/pairs.js +0 -3
  54. package/types/set.js +0 -3
  55. package/types/timestamp.js +0 -10
@@ -169,7 +169,7 @@ function _possibleConstructorReturn(self, call) {
169
169
  function _createSuper(Derived) {
170
170
  var hasNativeReflectConstruct = _isNativeReflectConstruct();
171
171
 
172
- return function () {
172
+ return function _createSuperInternal() {
173
173
  var Super = _getPrototypeOf(Derived),
174
174
  result;
175
175
 
@@ -279,9 +279,12 @@ function _nonIterableRest() {
279
279
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
280
280
  }
281
281
 
282
- function _createForOfIteratorHelper(o) {
282
+ function _createForOfIteratorHelper(o, allowArrayLike) {
283
+ var it;
284
+
283
285
  if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) {
284
- if (Array.isArray(o) || (o = _unsupportedIterableToArray(o))) {
286
+ if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
287
+ if (it) o = it;
285
288
  var i = 0;
286
289
 
287
290
  var F = function () {};
@@ -307,8 +310,7 @@ function _createForOfIteratorHelper(o) {
307
310
  throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
308
311
  }
309
312
 
310
- var it,
311
- normalCompletion = true,
313
+ var normalCompletion = true,
312
314
  didErr = false,
313
315
  err;
314
316
  return {
@@ -1094,184 +1096,4 @@ var YAMLWarning = /*#__PURE__*/function (_YAMLError4) {
1094
1096
  return YAMLWarning;
1095
1097
  }(YAMLError);
1096
1098
 
1097
- var PlainValue = /*#__PURE__*/function (_Node) {
1098
- _inherits(PlainValue, _Node);
1099
-
1100
- var _super = _createSuper(PlainValue);
1101
-
1102
- function PlainValue() {
1103
- _classCallCheck(this, PlainValue);
1104
-
1105
- return _super.apply(this, arguments);
1106
- }
1107
-
1108
- _createClass(PlainValue, [{
1109
- key: "parseBlockValue",
1110
- value: function parseBlockValue(start) {
1111
- var _this$context = this.context,
1112
- indent = _this$context.indent,
1113
- inFlow = _this$context.inFlow,
1114
- src = _this$context.src;
1115
- var offset = start;
1116
- var valueEnd = start;
1117
-
1118
- for (var ch = src[offset]; ch === '\n'; ch = src[offset]) {
1119
- if (Node.atDocumentBoundary(src, offset + 1)) break;
1120
- var end = Node.endOfBlockIndent(src, indent, offset + 1);
1121
- if (end === null || src[end] === '#') break;
1122
-
1123
- if (src[end] === '\n') {
1124
- offset = end;
1125
- } else {
1126
- valueEnd = PlainValue.endOfLine(src, end, inFlow);
1127
- offset = valueEnd;
1128
- }
1129
- }
1130
-
1131
- if (this.valueRange.isEmpty()) this.valueRange.start = start;
1132
- this.valueRange.end = valueEnd;
1133
- return valueEnd;
1134
- }
1135
- /**
1136
- * Parses a plain value from the source
1137
- *
1138
- * Accepted forms are:
1139
- * ```
1140
- * #comment
1141
- *
1142
- * first line
1143
- *
1144
- * first line #comment
1145
- *
1146
- * first line
1147
- * block
1148
- * lines
1149
- *
1150
- * #comment
1151
- * block
1152
- * lines
1153
- * ```
1154
- * where block lines are empty or have an indent level greater than `indent`.
1155
- *
1156
- * @param {ParseContext} context
1157
- * @param {number} start - Index of first character
1158
- * @returns {number} - Index of the character after this scalar, may be `\n`
1159
- */
1160
-
1161
- }, {
1162
- key: "parse",
1163
- value: function parse(context, start) {
1164
- this.context = context;
1165
- var inFlow = context.inFlow,
1166
- src = context.src;
1167
- var offset = start;
1168
- var ch = src[offset];
1169
-
1170
- if (ch && ch !== '#' && ch !== '\n') {
1171
- offset = PlainValue.endOfLine(src, start, inFlow);
1172
- }
1173
-
1174
- this.valueRange = new Range(start, offset);
1175
- offset = Node.endOfWhiteSpace(src, offset);
1176
- offset = this.parseComment(offset);
1177
-
1178
- if (!this.hasComment || this.valueRange.isEmpty()) {
1179
- offset = this.parseBlockValue(offset);
1180
- }
1181
-
1182
- return offset;
1183
- }
1184
- }, {
1185
- key: "strValue",
1186
- get: function get() {
1187
- if (!this.valueRange || !this.context) return null;
1188
- var _this$valueRange = this.valueRange,
1189
- start = _this$valueRange.start,
1190
- end = _this$valueRange.end;
1191
- var src = this.context.src;
1192
- var ch = src[end - 1];
1193
-
1194
- while (start < end && (ch === '\n' || ch === '\t' || ch === ' ')) {
1195
- ch = src[--end - 1];
1196
- }
1197
-
1198
- var str = '';
1199
-
1200
- for (var i = start; i < end; ++i) {
1201
- var _ch = src[i];
1202
-
1203
- if (_ch === '\n') {
1204
- var _Node$foldNewline = Node.foldNewline(src, i, -1),
1205
- fold = _Node$foldNewline.fold,
1206
- offset = _Node$foldNewline.offset;
1207
-
1208
- str += fold;
1209
- i = offset;
1210
- } else if (_ch === ' ' || _ch === '\t') {
1211
- // trim trailing whitespace
1212
- var wsStart = i;
1213
- var next = src[i + 1];
1214
-
1215
- while (i < end && (next === ' ' || next === '\t')) {
1216
- i += 1;
1217
- next = src[i + 1];
1218
- }
1219
-
1220
- if (next !== '\n') str += i > wsStart ? src.slice(wsStart, i + 1) : _ch;
1221
- } else {
1222
- str += _ch;
1223
- }
1224
- }
1225
-
1226
- var ch0 = src[start];
1227
-
1228
- switch (ch0) {
1229
- case '\t':
1230
- {
1231
- var msg = 'Plain value cannot start with a tab character';
1232
- var errors = [new YAMLSemanticError(this, msg)];
1233
- return {
1234
- errors: errors,
1235
- str: str
1236
- };
1237
- }
1238
-
1239
- case '@':
1240
- case '`':
1241
- {
1242
- var _msg = "Plain value cannot start with reserved character ".concat(ch0);
1243
-
1244
- var _errors = [new YAMLSemanticError(this, _msg)];
1245
- return {
1246
- errors: _errors,
1247
- str: str
1248
- };
1249
- }
1250
-
1251
- default:
1252
- return str;
1253
- }
1254
- }
1255
- }], [{
1256
- key: "endOfLine",
1257
- value: function endOfLine(src, start, inFlow) {
1258
- var ch = src[start];
1259
- var offset = start;
1260
-
1261
- while (ch && ch !== '\n') {
1262
- if (inFlow && (ch === '[' || ch === ']' || ch === '{' || ch === '}' || ch === ',')) break;
1263
- var next = src[offset + 1];
1264
- if (ch === ':' && (!next || next === '\n' || next === '\t' || next === ' ' || inFlow && next === ',')) break;
1265
- if ((ch === ' ' || ch === '\t') && next === '#') break;
1266
- offset += 1;
1267
- ch = next;
1268
- }
1269
-
1270
- return offset;
1271
- }
1272
- }]);
1273
-
1274
- return PlainValue;
1275
- }(Node);
1276
-
1277
- export { Char as C, Node as N, PlainValue as P, Range as R, Type as T, YAMLSyntaxError as Y, _createForOfIteratorHelper as _, _typeof as a, _createClass as b, _classCallCheck as c, defaultTagPrefix as d, _defineProperty as e, YAMLWarning as f, YAMLSemanticError as g, _slicedToArray as h, YAMLError as i, _inherits as j, _createSuper as k, _get as l, _getPrototypeOf as m, defaultTags as n, YAMLReferenceError as o, _assertThisInitialized as p, _toArray as q, _possibleConstructorReturn as r };
1099
+ export { Char as C, Node as N, Range as R, Type as T, YAMLSemanticError as Y, _typeof as _, _createClass as a, _classCallCheck as b, _defineProperty as c, defaultTagPrefix as d, _slicedToArray as e, defaultTags as f, YAMLWarning as g, _createForOfIteratorHelper as h, YAMLSyntaxError as i, YAMLReferenceError as j, YAMLError as k, _inherits as l, _createSuper as m, _get as n, _getPrototypeOf as o, _assertThisInitialized as p, _toArray as q, _possibleConstructorReturn as r };