yaml 2.0.0-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.
- package/README.md +8 -9
- package/browser/dist/{Schema-d14032c2.js → Schema-ea978338.js} +291 -127
- package/browser/dist/{PlainValue-6b68dc0e.js → errors-2634d01a.js} +1 -181
- package/browser/dist/index.js +1085 -73
- package/browser/dist/parse-cst.js +2 -2
- package/browser/dist/{parse-6e806192.js → parse-d1ba890f.js} +182 -2
- package/browser/dist/{resolveSeq-3477c430.js → stringifyNumber-d8af95b1.js} +89 -1069
- package/browser/dist/types.js +3 -3
- package/browser/dist/util.js +2 -2
- package/browser/index.js +1 -1
- package/dist/Document-f89a2614.js +1783 -0
- package/dist/{Schema-fe1471c4.js → Schema-807430ba.js} +289 -163
- package/dist/{PlainValue-ec8e588e.js → _rollupPluginBabelHelpers-eed30217.js} +0 -167
- package/dist/index.js +43 -33
- package/dist/{parse-ab8de154.js → parse-3997f544.js} +313 -146
- package/dist/parse-cst.js +2 -2
- package/dist/{resolveSeq-6b2dc4ac.js → stringifyNumber-dea1120c.js} +107 -1038
- package/dist/test-events.js +5 -5
- package/dist/types.js +16 -16
- package/dist/util.js +12 -14
- package/index.d.ts +67 -23
- package/index.js +1 -1
- package/package.json +12 -12
- package/types.d.ts +9 -9
- package/util.d.ts +2 -12
- package/util.js +0 -2
- package/util.mjs +0 -3
- package/dist/Document-59bd9290.js +0 -803
|
@@ -1096,184 +1096,4 @@ var YAMLWarning = /*#__PURE__*/function (_YAMLError4) {
|
|
|
1096
1096
|
return YAMLWarning;
|
|
1097
1097
|
}(YAMLError);
|
|
1098
1098
|
|
|
1099
|
-
|
|
1100
|
-
_inherits(PlainValue, _Node);
|
|
1101
|
-
|
|
1102
|
-
var _super = _createSuper(PlainValue);
|
|
1103
|
-
|
|
1104
|
-
function PlainValue() {
|
|
1105
|
-
_classCallCheck(this, PlainValue);
|
|
1106
|
-
|
|
1107
|
-
return _super.apply(this, arguments);
|
|
1108
|
-
}
|
|
1109
|
-
|
|
1110
|
-
_createClass(PlainValue, [{
|
|
1111
|
-
key: "parseBlockValue",
|
|
1112
|
-
value: function parseBlockValue(start) {
|
|
1113
|
-
var _this$context = this.context,
|
|
1114
|
-
indent = _this$context.indent,
|
|
1115
|
-
inFlow = _this$context.inFlow,
|
|
1116
|
-
src = _this$context.src;
|
|
1117
|
-
var offset = start;
|
|
1118
|
-
var valueEnd = start;
|
|
1119
|
-
|
|
1120
|
-
for (var ch = src[offset]; ch === '\n'; ch = src[offset]) {
|
|
1121
|
-
if (Node.atDocumentBoundary(src, offset + 1)) break;
|
|
1122
|
-
var end = Node.endOfBlockIndent(src, indent, offset + 1);
|
|
1123
|
-
if (end === null || src[end] === '#') break;
|
|
1124
|
-
|
|
1125
|
-
if (src[end] === '\n') {
|
|
1126
|
-
offset = end;
|
|
1127
|
-
} else {
|
|
1128
|
-
valueEnd = PlainValue.endOfLine(src, end, inFlow);
|
|
1129
|
-
offset = valueEnd;
|
|
1130
|
-
}
|
|
1131
|
-
}
|
|
1132
|
-
|
|
1133
|
-
if (this.valueRange.isEmpty()) this.valueRange.start = start;
|
|
1134
|
-
this.valueRange.end = valueEnd;
|
|
1135
|
-
return valueEnd;
|
|
1136
|
-
}
|
|
1137
|
-
/**
|
|
1138
|
-
* Parses a plain value from the source
|
|
1139
|
-
*
|
|
1140
|
-
* Accepted forms are:
|
|
1141
|
-
* ```
|
|
1142
|
-
* #comment
|
|
1143
|
-
*
|
|
1144
|
-
* first line
|
|
1145
|
-
*
|
|
1146
|
-
* first line #comment
|
|
1147
|
-
*
|
|
1148
|
-
* first line
|
|
1149
|
-
* block
|
|
1150
|
-
* lines
|
|
1151
|
-
*
|
|
1152
|
-
* #comment
|
|
1153
|
-
* block
|
|
1154
|
-
* lines
|
|
1155
|
-
* ```
|
|
1156
|
-
* where block lines are empty or have an indent level greater than `indent`.
|
|
1157
|
-
*
|
|
1158
|
-
* @param {ParseContext} context
|
|
1159
|
-
* @param {number} start - Index of first character
|
|
1160
|
-
* @returns {number} - Index of the character after this scalar, may be `\n`
|
|
1161
|
-
*/
|
|
1162
|
-
|
|
1163
|
-
}, {
|
|
1164
|
-
key: "parse",
|
|
1165
|
-
value: function parse(context, start) {
|
|
1166
|
-
this.context = context;
|
|
1167
|
-
var inFlow = context.inFlow,
|
|
1168
|
-
src = context.src;
|
|
1169
|
-
var offset = start;
|
|
1170
|
-
var ch = src[offset];
|
|
1171
|
-
|
|
1172
|
-
if (ch && ch !== '#' && ch !== '\n') {
|
|
1173
|
-
offset = PlainValue.endOfLine(src, start, inFlow);
|
|
1174
|
-
}
|
|
1175
|
-
|
|
1176
|
-
this.valueRange = new Range(start, offset);
|
|
1177
|
-
offset = Node.endOfWhiteSpace(src, offset);
|
|
1178
|
-
offset = this.parseComment(offset);
|
|
1179
|
-
|
|
1180
|
-
if (!this.hasComment || this.valueRange.isEmpty()) {
|
|
1181
|
-
offset = this.parseBlockValue(offset);
|
|
1182
|
-
}
|
|
1183
|
-
|
|
1184
|
-
return offset;
|
|
1185
|
-
}
|
|
1186
|
-
}, {
|
|
1187
|
-
key: "strValue",
|
|
1188
|
-
get: function get() {
|
|
1189
|
-
if (!this.valueRange || !this.context) return null;
|
|
1190
|
-
var _this$valueRange = this.valueRange,
|
|
1191
|
-
start = _this$valueRange.start,
|
|
1192
|
-
end = _this$valueRange.end;
|
|
1193
|
-
var src = this.context.src;
|
|
1194
|
-
var ch = src[end - 1];
|
|
1195
|
-
|
|
1196
|
-
while (start < end && (ch === '\n' || ch === '\t' || ch === ' ')) {
|
|
1197
|
-
ch = src[--end - 1];
|
|
1198
|
-
}
|
|
1199
|
-
|
|
1200
|
-
var str = '';
|
|
1201
|
-
|
|
1202
|
-
for (var i = start; i < end; ++i) {
|
|
1203
|
-
var _ch = src[i];
|
|
1204
|
-
|
|
1205
|
-
if (_ch === '\n') {
|
|
1206
|
-
var _Node$foldNewline = Node.foldNewline(src, i, -1),
|
|
1207
|
-
fold = _Node$foldNewline.fold,
|
|
1208
|
-
offset = _Node$foldNewline.offset;
|
|
1209
|
-
|
|
1210
|
-
str += fold;
|
|
1211
|
-
i = offset;
|
|
1212
|
-
} else if (_ch === ' ' || _ch === '\t') {
|
|
1213
|
-
// trim trailing whitespace
|
|
1214
|
-
var wsStart = i;
|
|
1215
|
-
var next = src[i + 1];
|
|
1216
|
-
|
|
1217
|
-
while (i < end && (next === ' ' || next === '\t')) {
|
|
1218
|
-
i += 1;
|
|
1219
|
-
next = src[i + 1];
|
|
1220
|
-
}
|
|
1221
|
-
|
|
1222
|
-
if (next !== '\n') str += i > wsStart ? src.slice(wsStart, i + 1) : _ch;
|
|
1223
|
-
} else {
|
|
1224
|
-
str += _ch;
|
|
1225
|
-
}
|
|
1226
|
-
}
|
|
1227
|
-
|
|
1228
|
-
var ch0 = src[start];
|
|
1229
|
-
|
|
1230
|
-
switch (ch0) {
|
|
1231
|
-
case '\t':
|
|
1232
|
-
{
|
|
1233
|
-
var msg = 'Plain value cannot start with a tab character';
|
|
1234
|
-
var errors = [new YAMLSemanticError(this, msg)];
|
|
1235
|
-
return {
|
|
1236
|
-
errors: errors,
|
|
1237
|
-
str: str
|
|
1238
|
-
};
|
|
1239
|
-
}
|
|
1240
|
-
|
|
1241
|
-
case '@':
|
|
1242
|
-
case '`':
|
|
1243
|
-
{
|
|
1244
|
-
var _msg = "Plain value cannot start with reserved character ".concat(ch0);
|
|
1245
|
-
|
|
1246
|
-
var _errors = [new YAMLSemanticError(this, _msg)];
|
|
1247
|
-
return {
|
|
1248
|
-
errors: _errors,
|
|
1249
|
-
str: str
|
|
1250
|
-
};
|
|
1251
|
-
}
|
|
1252
|
-
|
|
1253
|
-
default:
|
|
1254
|
-
return str;
|
|
1255
|
-
}
|
|
1256
|
-
}
|
|
1257
|
-
}], [{
|
|
1258
|
-
key: "endOfLine",
|
|
1259
|
-
value: function endOfLine(src, start, inFlow) {
|
|
1260
|
-
var ch = src[start];
|
|
1261
|
-
var offset = start;
|
|
1262
|
-
|
|
1263
|
-
while (ch && ch !== '\n') {
|
|
1264
|
-
if (inFlow && (ch === '[' || ch === ']' || ch === '{' || ch === '}' || ch === ',')) break;
|
|
1265
|
-
var next = src[offset + 1];
|
|
1266
|
-
if (ch === ':' && (!next || next === '\n' || next === '\t' || next === ' ' || inFlow && next === ',')) break;
|
|
1267
|
-
if ((ch === ' ' || ch === '\t') && next === '#') break;
|
|
1268
|
-
offset += 1;
|
|
1269
|
-
ch = next;
|
|
1270
|
-
}
|
|
1271
|
-
|
|
1272
|
-
return offset;
|
|
1273
|
-
}
|
|
1274
|
-
}]);
|
|
1275
|
-
|
|
1276
|
-
return PlainValue;
|
|
1277
|
-
}(Node);
|
|
1278
|
-
|
|
1279
|
-
export { Char as C, Node as N, PlainValue as P, Range as R, Type as T, YAMLSyntaxError as Y, _typeof as _, _createClass as a, _classCallCheck as b, _defineProperty as c, defaultTagPrefix as d, _createForOfIteratorHelper 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, _assertThisInitialized as n, _toArray as o, YAMLReferenceError as p, _possibleConstructorReturn as q, defaultTags 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 };
|