@pactflow/openapi-pact-comparator 2.2.0 → 2.3.0
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/dist/cli.cjs +2239 -2311
- package/dist/cli.cjs.map +1 -1
- package/dist/index.cjs +124 -38
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +124 -38
- package/dist/index.mjs.map +1 -1
- package/dist/src/compare/asyncapi/matchMessages.d.ts +1 -1
- package/dist/src/documents/pact.d.ts +2 -2
- package/dist/src/utils/schema.d.ts +4 -1
- package/package.json +11 -11
package/dist/cli.cjs
CHANGED
|
@@ -4177,2388 +4177,2230 @@ function useColor() {
|
|
|
4177
4177
|
|
|
4178
4178
|
const program = new Command();
|
|
4179
4179
|
|
|
4180
|
-
var version = "2.
|
|
4180
|
+
var version = "2.3.0";
|
|
4181
4181
|
var packageJson = {
|
|
4182
4182
|
version: version};
|
|
4183
4183
|
|
|
4184
|
-
/*! js-yaml
|
|
4185
|
-
//#region
|
|
4186
|
-
var
|
|
4187
|
-
var
|
|
4188
|
-
|
|
4189
|
-
|
|
4190
|
-
|
|
4191
|
-
|
|
4192
|
-
|
|
4193
|
-
|
|
4194
|
-
|
|
4195
|
-
|
|
4196
|
-
|
|
4197
|
-
|
|
4198
|
-
|
|
4199
|
-
});
|
|
4200
|
-
}
|
|
4201
|
-
return to;
|
|
4202
|
-
};
|
|
4203
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(__defProp(target, "default", {
|
|
4204
|
-
value: mod,
|
|
4205
|
-
enumerable: true
|
|
4206
|
-
}) , mod));
|
|
4207
|
-
//#endregion
|
|
4208
|
-
//#region lib/common.js
|
|
4209
|
-
var require_common = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
4210
|
-
function isNothing(subject) {
|
|
4211
|
-
return typeof subject === "undefined" || subject === null;
|
|
4212
|
-
}
|
|
4213
|
-
function isObject(subject) {
|
|
4214
|
-
return typeof subject === "object" && subject !== null;
|
|
4215
|
-
}
|
|
4216
|
-
function toArray(sequence) {
|
|
4217
|
-
if (Array.isArray(sequence)) return sequence;
|
|
4218
|
-
else if (isNothing(sequence)) return [];
|
|
4219
|
-
return [sequence];
|
|
4220
|
-
}
|
|
4221
|
-
function extend(target, source) {
|
|
4222
|
-
if (source) {
|
|
4223
|
-
const sourceKeys = Object.keys(source);
|
|
4224
|
-
for (let index = 0, length = sourceKeys.length; index < length; index += 1) {
|
|
4225
|
-
const key = sourceKeys[index];
|
|
4226
|
-
target[key] = source[key];
|
|
4227
|
-
}
|
|
4228
|
-
}
|
|
4229
|
-
return target;
|
|
4230
|
-
}
|
|
4231
|
-
function repeat(string, count) {
|
|
4232
|
-
let result = "";
|
|
4233
|
-
for (let cycle = 0; cycle < count; cycle += 1) result += string;
|
|
4234
|
-
return result;
|
|
4235
|
-
}
|
|
4236
|
-
function isNegativeZero(number) {
|
|
4237
|
-
return number === 0 && Number.NEGATIVE_INFINITY === 1 / number;
|
|
4238
|
-
}
|
|
4239
|
-
module.exports.isNothing = isNothing;
|
|
4240
|
-
module.exports.isObject = isObject;
|
|
4241
|
-
module.exports.toArray = toArray;
|
|
4242
|
-
module.exports.repeat = repeat;
|
|
4243
|
-
module.exports.isNegativeZero = isNegativeZero;
|
|
4244
|
-
module.exports.extend = extend;
|
|
4245
|
-
}));
|
|
4246
|
-
//#endregion
|
|
4247
|
-
//#region lib/exception.js
|
|
4248
|
-
var require_exception = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
4249
|
-
function formatError(exception, compact) {
|
|
4250
|
-
let where = "";
|
|
4251
|
-
const message = exception.reason || "(unknown reason)";
|
|
4252
|
-
if (!exception.mark) return message;
|
|
4253
|
-
if (exception.mark.name) where += "in \"" + exception.mark.name + "\" ";
|
|
4254
|
-
where += "(" + (exception.mark.line + 1) + ":" + (exception.mark.column + 1) + ")";
|
|
4255
|
-
if (!compact && exception.mark.snippet) where += "\n\n" + exception.mark.snippet;
|
|
4256
|
-
return message + " " + where;
|
|
4257
|
-
}
|
|
4258
|
-
function YAMLException(reason, mark) {
|
|
4259
|
-
Error.call(this);
|
|
4260
|
-
this.name = "YAMLException";
|
|
4261
|
-
this.reason = reason;
|
|
4262
|
-
this.mark = mark;
|
|
4263
|
-
this.message = formatError(this, false);
|
|
4264
|
-
if (Error.captureStackTrace) Error.captureStackTrace(this, this.constructor);
|
|
4265
|
-
else this.stack = (/* @__PURE__ */ new Error()).stack || "";
|
|
4266
|
-
}
|
|
4267
|
-
YAMLException.prototype = Object.create(Error.prototype);
|
|
4268
|
-
YAMLException.prototype.constructor = YAMLException;
|
|
4269
|
-
YAMLException.prototype.toString = function toString(compact) {
|
|
4270
|
-
return this.name + ": " + formatError(this, compact);
|
|
4184
|
+
/*! js-yaml 5.2.1 https://github.com/nodeca/js-yaml @license MIT */
|
|
4185
|
+
//#region src/tag.ts
|
|
4186
|
+
var NOT_RESOLVED = Symbol("NOT_RESOLVED");
|
|
4187
|
+
var MERGE_KEY = Symbol("MERGE_KEY");
|
|
4188
|
+
function defineScalarTag(tagName, options) {
|
|
4189
|
+
return {
|
|
4190
|
+
tagName,
|
|
4191
|
+
nodeKind: "scalar",
|
|
4192
|
+
implicit: options.implicit ?? false,
|
|
4193
|
+
matchByTagPrefix: options.matchByTagPrefix ?? false,
|
|
4194
|
+
implicitFirstChars: options.implicitFirstChars ?? null,
|
|
4195
|
+
resolve: options.resolve,
|
|
4196
|
+
identify: options.identify ?? null,
|
|
4197
|
+
represent: options.represent ?? ((data) => String(data)),
|
|
4198
|
+
representTagName: options.representTagName ?? null
|
|
4271
4199
|
};
|
|
4272
|
-
|
|
4273
|
-
|
|
4200
|
+
}
|
|
4201
|
+
function defineSequenceTag(tagName, options) {
|
|
4202
|
+
const carrierIsResult = options.finalize === void 0;
|
|
4203
|
+
return {
|
|
4204
|
+
tagName,
|
|
4205
|
+
nodeKind: "sequence",
|
|
4206
|
+
implicit: false,
|
|
4207
|
+
matchByTagPrefix: options.matchByTagPrefix ?? false,
|
|
4208
|
+
create: options.create,
|
|
4209
|
+
addItem: options.addItem,
|
|
4210
|
+
finalize: options.finalize ?? ((carrier) => carrier),
|
|
4211
|
+
carrierIsResult,
|
|
4212
|
+
identify: options.identify ?? null,
|
|
4213
|
+
represent: options.represent ?? ((data) => data),
|
|
4214
|
+
representTagName: options.representTagName ?? null
|
|
4215
|
+
};
|
|
4216
|
+
}
|
|
4217
|
+
function defineMappingTag(tagName, options) {
|
|
4218
|
+
const carrierIsResult = options.finalize === void 0;
|
|
4219
|
+
return {
|
|
4220
|
+
tagName,
|
|
4221
|
+
nodeKind: "mapping",
|
|
4222
|
+
implicit: false,
|
|
4223
|
+
matchByTagPrefix: options.matchByTagPrefix ?? false,
|
|
4224
|
+
create: options.create,
|
|
4225
|
+
addPair: options.addPair,
|
|
4226
|
+
has: options.has,
|
|
4227
|
+
keys: options.keys,
|
|
4228
|
+
get: options.get,
|
|
4229
|
+
finalize: options.finalize ?? ((carrier) => carrier),
|
|
4230
|
+
carrierIsResult,
|
|
4231
|
+
identify: options.identify ?? null,
|
|
4232
|
+
represent: options.represent ?? ((data) => data),
|
|
4233
|
+
representTagName: options.representTagName ?? null
|
|
4234
|
+
};
|
|
4235
|
+
}
|
|
4274
4236
|
//#endregion
|
|
4275
|
-
//#region
|
|
4276
|
-
var
|
|
4277
|
-
|
|
4278
|
-
|
|
4279
|
-
|
|
4280
|
-
let tail = "";
|
|
4281
|
-
const maxHalfLength = Math.floor(maxLineLength / 2) - 1;
|
|
4282
|
-
if (position - lineStart > maxHalfLength) {
|
|
4283
|
-
head = " ... ";
|
|
4284
|
-
lineStart = position - maxHalfLength + head.length;
|
|
4285
|
-
}
|
|
4286
|
-
if (lineEnd - position > maxHalfLength) {
|
|
4287
|
-
tail = " ...";
|
|
4288
|
-
lineEnd = position + maxHalfLength - tail.length;
|
|
4289
|
-
}
|
|
4290
|
-
return {
|
|
4291
|
-
str: head + buffer.slice(lineStart, lineEnd).replace(/\t/g, "→") + tail,
|
|
4292
|
-
pos: position - lineStart + head.length
|
|
4293
|
-
};
|
|
4294
|
-
}
|
|
4295
|
-
function padStart(string, max) {
|
|
4296
|
-
return common.repeat(" ", max - string.length) + string;
|
|
4297
|
-
}
|
|
4298
|
-
function makeSnippet(mark, options) {
|
|
4299
|
-
options = Object.create(options || null);
|
|
4300
|
-
if (!mark.buffer) return null;
|
|
4301
|
-
if (!options.maxLength) options.maxLength = 79;
|
|
4302
|
-
if (typeof options.indent !== "number") options.indent = 1;
|
|
4303
|
-
if (typeof options.linesBefore !== "number") options.linesBefore = 3;
|
|
4304
|
-
if (typeof options.linesAfter !== "number") options.linesAfter = 2;
|
|
4305
|
-
const re = /\r?\n|\r|\0/g;
|
|
4306
|
-
const lineStarts = [0];
|
|
4307
|
-
const lineEnds = [];
|
|
4308
|
-
let match;
|
|
4309
|
-
let foundLineNo = -1;
|
|
4310
|
-
while (match = re.exec(mark.buffer)) {
|
|
4311
|
-
lineEnds.push(match.index);
|
|
4312
|
-
lineStarts.push(match.index + match[0].length);
|
|
4313
|
-
if (mark.position <= match.index && foundLineNo < 0) foundLineNo = lineStarts.length - 2;
|
|
4314
|
-
}
|
|
4315
|
-
if (foundLineNo < 0) foundLineNo = lineStarts.length - 1;
|
|
4316
|
-
let result = "";
|
|
4317
|
-
const lineNoLength = Math.min(mark.line + options.linesAfter, lineEnds.length).toString().length;
|
|
4318
|
-
const maxLineLength = options.maxLength - (options.indent + lineNoLength + 3);
|
|
4319
|
-
for (let i = 1; i <= options.linesBefore; i++) {
|
|
4320
|
-
if (foundLineNo - i < 0) break;
|
|
4321
|
-
const line = getLine(mark.buffer, lineStarts[foundLineNo - i], lineEnds[foundLineNo - i], mark.position - (lineStarts[foundLineNo] - lineStarts[foundLineNo - i]), maxLineLength);
|
|
4322
|
-
result = common.repeat(" ", options.indent) + padStart((mark.line - i + 1).toString(), lineNoLength) + " | " + line.str + "\n" + result;
|
|
4323
|
-
}
|
|
4324
|
-
const line = getLine(mark.buffer, lineStarts[foundLineNo], lineEnds[foundLineNo], mark.position, maxLineLength);
|
|
4325
|
-
result += common.repeat(" ", options.indent) + padStart((mark.line + 1).toString(), lineNoLength) + " | " + line.str + "\n";
|
|
4326
|
-
result += common.repeat("-", options.indent + lineNoLength + 3 + line.pos) + "^\n";
|
|
4327
|
-
for (let i = 1; i <= options.linesAfter; i++) {
|
|
4328
|
-
if (foundLineNo + i >= lineEnds.length) break;
|
|
4329
|
-
const line = getLine(mark.buffer, lineStarts[foundLineNo + i], lineEnds[foundLineNo + i], mark.position - (lineStarts[foundLineNo] - lineStarts[foundLineNo + i]), maxLineLength);
|
|
4330
|
-
result += common.repeat(" ", options.indent) + padStart((mark.line + i + 1).toString(), lineNoLength) + " | " + line.str + "\n";
|
|
4331
|
-
}
|
|
4332
|
-
return result.replace(/\n$/, "");
|
|
4333
|
-
}
|
|
4334
|
-
module.exports = makeSnippet;
|
|
4335
|
-
}));
|
|
4237
|
+
//#region src/tag/scalar/str.ts
|
|
4238
|
+
var strTag = defineScalarTag("tag:yaml.org,2002:str", {
|
|
4239
|
+
resolve: (source) => source,
|
|
4240
|
+
identify: (data) => typeof data === "string"
|
|
4241
|
+
});
|
|
4336
4242
|
//#endregion
|
|
4337
|
-
//#region
|
|
4338
|
-
var
|
|
4339
|
-
|
|
4340
|
-
|
|
4341
|
-
|
|
4342
|
-
|
|
4343
|
-
|
|
4344
|
-
|
|
4345
|
-
|
|
4346
|
-
|
|
4347
|
-
|
|
4348
|
-
"
|
|
4349
|
-
"
|
|
4350
|
-
"
|
|
4351
|
-
|
|
4352
|
-
|
|
4353
|
-
|
|
4354
|
-
|
|
4355
|
-
|
|
4356
|
-
|
|
4357
|
-
|
|
4358
|
-
|
|
4359
|
-
|
|
4360
|
-
map[style].forEach(function(alias) {
|
|
4361
|
-
result[String(alias)] = style;
|
|
4362
|
-
});
|
|
4363
|
-
});
|
|
4364
|
-
return result;
|
|
4365
|
-
}
|
|
4366
|
-
function Type(tag, options) {
|
|
4367
|
-
options = options || {};
|
|
4368
|
-
Object.keys(options).forEach(function(name) {
|
|
4369
|
-
if (TYPE_CONSTRUCTOR_OPTIONS.indexOf(name) === -1) throw new YAMLException("Unknown option \"" + name + "\" is met in definition of \"" + tag + "\" YAML type.");
|
|
4370
|
-
});
|
|
4371
|
-
this.options = options;
|
|
4372
|
-
this.tag = tag;
|
|
4373
|
-
this.kind = options["kind"] || null;
|
|
4374
|
-
this.resolve = options["resolve"] || function() {
|
|
4375
|
-
return true;
|
|
4376
|
-
};
|
|
4377
|
-
this.construct = options["construct"] || function(data) {
|
|
4378
|
-
return data;
|
|
4379
|
-
};
|
|
4380
|
-
this.instanceOf = options["instanceOf"] || null;
|
|
4381
|
-
this.predicate = options["predicate"] || null;
|
|
4382
|
-
this.represent = options["represent"] || null;
|
|
4383
|
-
this.representName = options["representName"] || null;
|
|
4384
|
-
this.defaultStyle = options["defaultStyle"] || null;
|
|
4385
|
-
this.multi = options["multi"] || false;
|
|
4386
|
-
this.styleAliases = compileStyleAliases(options["styleAliases"] || null);
|
|
4387
|
-
if (YAML_NODE_KINDS.indexOf(this.kind) === -1) throw new YAMLException("Unknown kind \"" + this.kind + "\" is specified for \"" + tag + "\" YAML type.");
|
|
4388
|
-
}
|
|
4389
|
-
module.exports = Type;
|
|
4390
|
-
}));
|
|
4243
|
+
//#region src/tag/scalar/null_core.ts
|
|
4244
|
+
var NULL_VALUES$1 = [
|
|
4245
|
+
"",
|
|
4246
|
+
"~",
|
|
4247
|
+
"null",
|
|
4248
|
+
"Null",
|
|
4249
|
+
"NULL"
|
|
4250
|
+
];
|
|
4251
|
+
var nullCoreTag = defineScalarTag("tag:yaml.org,2002:null", {
|
|
4252
|
+
implicit: true,
|
|
4253
|
+
implicitFirstChars: [
|
|
4254
|
+
"",
|
|
4255
|
+
"~",
|
|
4256
|
+
"n",
|
|
4257
|
+
"N"
|
|
4258
|
+
],
|
|
4259
|
+
resolve: (source) => {
|
|
4260
|
+
if (NULL_VALUES$1.indexOf(source) !== -1) return null;
|
|
4261
|
+
return NOT_RESOLVED;
|
|
4262
|
+
},
|
|
4263
|
+
identify: (object) => object === null,
|
|
4264
|
+
represent: () => "null"
|
|
4265
|
+
});
|
|
4391
4266
|
//#endregion
|
|
4392
|
-
//#region
|
|
4393
|
-
var
|
|
4394
|
-
|
|
4395
|
-
|
|
4396
|
-
|
|
4397
|
-
|
|
4398
|
-
|
|
4399
|
-
|
|
4400
|
-
|
|
4401
|
-
|
|
4402
|
-
|
|
4403
|
-
result[newIndex] = currentType;
|
|
4404
|
-
});
|
|
4405
|
-
return result;
|
|
4406
|
-
}
|
|
4407
|
-
function compileMap() {
|
|
4408
|
-
const result = {
|
|
4409
|
-
scalar: {},
|
|
4410
|
-
sequence: {},
|
|
4411
|
-
mapping: {},
|
|
4412
|
-
fallback: {},
|
|
4413
|
-
multi: {
|
|
4414
|
-
scalar: [],
|
|
4415
|
-
sequence: [],
|
|
4416
|
-
mapping: [],
|
|
4417
|
-
fallback: []
|
|
4418
|
-
}
|
|
4419
|
-
};
|
|
4420
|
-
function collectType(type) {
|
|
4421
|
-
if (type.multi) {
|
|
4422
|
-
result.multi[type.kind].push(type);
|
|
4423
|
-
result.multi["fallback"].push(type);
|
|
4424
|
-
} else result[type.kind][type.tag] = result["fallback"][type.tag] = type;
|
|
4425
|
-
}
|
|
4426
|
-
for (let index = 0, length = arguments.length; index < length; index += 1) arguments[index].forEach(collectType);
|
|
4427
|
-
return result;
|
|
4428
|
-
}
|
|
4429
|
-
function Schema(definition) {
|
|
4430
|
-
return this.extend(definition);
|
|
4431
|
-
}
|
|
4432
|
-
Schema.prototype.extend = function extend(definition) {
|
|
4433
|
-
let implicit = [];
|
|
4434
|
-
let explicit = [];
|
|
4435
|
-
if (definition instanceof Type) explicit.push(definition);
|
|
4436
|
-
else if (Array.isArray(definition)) explicit = explicit.concat(definition);
|
|
4437
|
-
else if (definition && (Array.isArray(definition.implicit) || Array.isArray(definition.explicit))) {
|
|
4438
|
-
if (definition.implicit) implicit = implicit.concat(definition.implicit);
|
|
4439
|
-
if (definition.explicit) explicit = explicit.concat(definition.explicit);
|
|
4440
|
-
} else throw new YAMLException("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");
|
|
4441
|
-
implicit.forEach(function(type) {
|
|
4442
|
-
if (!(type instanceof Type)) throw new YAMLException("Specified list of YAML types (or a single Type object) contains a non-Type object.");
|
|
4443
|
-
if (type.loadKind && type.loadKind !== "scalar") throw new YAMLException("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");
|
|
4444
|
-
if (type.multi) throw new YAMLException("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.");
|
|
4445
|
-
});
|
|
4446
|
-
explicit.forEach(function(type) {
|
|
4447
|
-
if (!(type instanceof Type)) throw new YAMLException("Specified list of YAML types (or a single Type object) contains a non-Type object.");
|
|
4448
|
-
});
|
|
4449
|
-
const result = Object.create(Schema.prototype);
|
|
4450
|
-
result.implicit = (this.implicit || []).concat(implicit);
|
|
4451
|
-
result.explicit = (this.explicit || []).concat(explicit);
|
|
4452
|
-
result.compiledImplicit = compileList(result, "implicit");
|
|
4453
|
-
result.compiledExplicit = compileList(result, "explicit");
|
|
4454
|
-
result.compiledTypeMap = compileMap(result.compiledImplicit, result.compiledExplicit);
|
|
4455
|
-
return result;
|
|
4456
|
-
};
|
|
4457
|
-
module.exports = Schema;
|
|
4458
|
-
}));
|
|
4267
|
+
//#region src/tag/scalar/null_json.ts
|
|
4268
|
+
var nullJsonTag = defineScalarTag("tag:yaml.org,2002:null", {
|
|
4269
|
+
implicit: true,
|
|
4270
|
+
implicitFirstChars: ["n"],
|
|
4271
|
+
resolve: (source, isExplicit) => {
|
|
4272
|
+
if (source === "null" || isExplicit && source === "") return null;
|
|
4273
|
+
return NOT_RESOLVED;
|
|
4274
|
+
},
|
|
4275
|
+
identify: (object) => object === null,
|
|
4276
|
+
represent: () => "null"
|
|
4277
|
+
});
|
|
4459
4278
|
//#endregion
|
|
4460
|
-
//#region
|
|
4461
|
-
var
|
|
4462
|
-
|
|
4463
|
-
|
|
4464
|
-
|
|
4465
|
-
|
|
4466
|
-
|
|
4467
|
-
|
|
4468
|
-
|
|
4279
|
+
//#region src/tag/scalar/null_yaml11.ts
|
|
4280
|
+
var NULL_VALUES = [
|
|
4281
|
+
"",
|
|
4282
|
+
"~",
|
|
4283
|
+
"null",
|
|
4284
|
+
"Null",
|
|
4285
|
+
"NULL"
|
|
4286
|
+
];
|
|
4287
|
+
var nullYaml11Tag = defineScalarTag("tag:yaml.org,2002:null", {
|
|
4288
|
+
implicit: true,
|
|
4289
|
+
implicitFirstChars: [
|
|
4290
|
+
"",
|
|
4291
|
+
"~",
|
|
4292
|
+
"n",
|
|
4293
|
+
"N"
|
|
4294
|
+
],
|
|
4295
|
+
resolve: (source) => {
|
|
4296
|
+
if (NULL_VALUES.indexOf(source) !== -1) return null;
|
|
4297
|
+
return NOT_RESOLVED;
|
|
4298
|
+
},
|
|
4299
|
+
identify: (object) => object === null,
|
|
4300
|
+
represent: () => "null"
|
|
4301
|
+
});
|
|
4469
4302
|
//#endregion
|
|
4470
|
-
//#region
|
|
4471
|
-
var
|
|
4472
|
-
|
|
4473
|
-
|
|
4474
|
-
|
|
4475
|
-
|
|
4476
|
-
|
|
4477
|
-
|
|
4478
|
-
|
|
4303
|
+
//#region src/tag/scalar/bool_core.ts
|
|
4304
|
+
var TRUE_VALUES$2 = [
|
|
4305
|
+
"true",
|
|
4306
|
+
"True",
|
|
4307
|
+
"TRUE"
|
|
4308
|
+
];
|
|
4309
|
+
var FALSE_VALUES$2 = [
|
|
4310
|
+
"false",
|
|
4311
|
+
"False",
|
|
4312
|
+
"FALSE"
|
|
4313
|
+
];
|
|
4314
|
+
var boolCoreTag = defineScalarTag("tag:yaml.org,2002:bool", {
|
|
4315
|
+
implicit: true,
|
|
4316
|
+
implicitFirstChars: [
|
|
4317
|
+
"t",
|
|
4318
|
+
"T",
|
|
4319
|
+
"f",
|
|
4320
|
+
"F"
|
|
4321
|
+
],
|
|
4322
|
+
resolve: (source) => {
|
|
4323
|
+
if (TRUE_VALUES$2.indexOf(source) !== -1) return true;
|
|
4324
|
+
if (FALSE_VALUES$2.indexOf(source) !== -1) return false;
|
|
4325
|
+
return NOT_RESOLVED;
|
|
4326
|
+
},
|
|
4327
|
+
identify: (object) => Object.prototype.toString.call(object) === "[object Boolean]",
|
|
4328
|
+
represent: (object) => object ? "true" : "false"
|
|
4329
|
+
});
|
|
4479
4330
|
//#endregion
|
|
4480
|
-
//#region
|
|
4481
|
-
var
|
|
4482
|
-
|
|
4483
|
-
|
|
4484
|
-
|
|
4485
|
-
|
|
4486
|
-
|
|
4487
|
-
|
|
4488
|
-
|
|
4331
|
+
//#region src/tag/scalar/bool_json.ts
|
|
4332
|
+
var TRUE_VALUES$1 = ["true"];
|
|
4333
|
+
var FALSE_VALUES$1 = ["false"];
|
|
4334
|
+
var boolJsonTag = defineScalarTag("tag:yaml.org,2002:bool", {
|
|
4335
|
+
implicit: true,
|
|
4336
|
+
implicitFirstChars: ["t", "f"],
|
|
4337
|
+
resolve: (source) => {
|
|
4338
|
+
if (TRUE_VALUES$1.indexOf(source) !== -1) return true;
|
|
4339
|
+
if (FALSE_VALUES$1.indexOf(source) !== -1) return false;
|
|
4340
|
+
return NOT_RESOLVED;
|
|
4341
|
+
},
|
|
4342
|
+
identify: (object) => Object.prototype.toString.call(object) === "[object Boolean]",
|
|
4343
|
+
represent: (object) => object ? "true" : "false"
|
|
4344
|
+
});
|
|
4489
4345
|
//#endregion
|
|
4490
|
-
//#region
|
|
4491
|
-
var
|
|
4492
|
-
|
|
4493
|
-
|
|
4494
|
-
|
|
4495
|
-
|
|
4496
|
-
|
|
4497
|
-
|
|
4346
|
+
//#region src/tag/scalar/bool_yaml11.ts
|
|
4347
|
+
var TRUE_VALUES = [
|
|
4348
|
+
"true",
|
|
4349
|
+
"True",
|
|
4350
|
+
"TRUE",
|
|
4351
|
+
"y",
|
|
4352
|
+
"Y",
|
|
4353
|
+
"yes",
|
|
4354
|
+
"Yes",
|
|
4355
|
+
"YES",
|
|
4356
|
+
"on",
|
|
4357
|
+
"On",
|
|
4358
|
+
"ON"
|
|
4359
|
+
];
|
|
4360
|
+
var FALSE_VALUES = [
|
|
4361
|
+
"false",
|
|
4362
|
+
"False",
|
|
4363
|
+
"FALSE",
|
|
4364
|
+
"n",
|
|
4365
|
+
"N",
|
|
4366
|
+
"no",
|
|
4367
|
+
"No",
|
|
4368
|
+
"NO",
|
|
4369
|
+
"off",
|
|
4370
|
+
"Off",
|
|
4371
|
+
"OFF"
|
|
4372
|
+
];
|
|
4373
|
+
var boolYaml11Tag = defineScalarTag("tag:yaml.org,2002:bool", {
|
|
4374
|
+
implicit: true,
|
|
4375
|
+
implicitFirstChars: [
|
|
4376
|
+
"y",
|
|
4377
|
+
"Y",
|
|
4378
|
+
"n",
|
|
4379
|
+
"N",
|
|
4380
|
+
"t",
|
|
4381
|
+
"T",
|
|
4382
|
+
"f",
|
|
4383
|
+
"F",
|
|
4384
|
+
"o",
|
|
4385
|
+
"O"
|
|
4386
|
+
],
|
|
4387
|
+
resolve: (source) => {
|
|
4388
|
+
if (TRUE_VALUES.indexOf(source) !== -1) return true;
|
|
4389
|
+
if (FALSE_VALUES.indexOf(source) !== -1) return false;
|
|
4390
|
+
return NOT_RESOLVED;
|
|
4391
|
+
},
|
|
4392
|
+
identify: (object) => Object.prototype.toString.call(object) === "[object Boolean]",
|
|
4393
|
+
represent: (object) => object ? "true" : "false"
|
|
4394
|
+
});
|
|
4498
4395
|
//#endregion
|
|
4499
|
-
//#region
|
|
4500
|
-
var
|
|
4501
|
-
|
|
4502
|
-
|
|
4503
|
-
|
|
4504
|
-
|
|
4505
|
-
|
|
4506
|
-
|
|
4507
|
-
|
|
4508
|
-
|
|
4509
|
-
|
|
4510
|
-
|
|
4511
|
-
|
|
4512
|
-
|
|
4513
|
-
|
|
4514
|
-
|
|
4515
|
-
|
|
4516
|
-
|
|
4517
|
-
|
|
4518
|
-
|
|
4519
|
-
|
|
4520
|
-
|
|
4521
|
-
|
|
4522
|
-
|
|
4523
|
-
|
|
4524
|
-
|
|
4525
|
-
|
|
4526
|
-
|
|
4527
|
-
|
|
4528
|
-
|
|
4529
|
-
|
|
4530
|
-
|
|
4531
|
-
|
|
4532
|
-
return "";
|
|
4533
|
-
}
|
|
4534
|
-
},
|
|
4535
|
-
defaultStyle: "lowercase"
|
|
4536
|
-
});
|
|
4537
|
-
}));
|
|
4396
|
+
//#region src/tag/scalar/int_core.ts
|
|
4397
|
+
var YAML_INTEGER_IMPLICIT_PATTERN$1 = /* @__PURE__ */ new RegExp("^(?:0o[0-7]+|0x[0-9a-fA-F]+|[-+]?[0-9]+)$");
|
|
4398
|
+
var YAML_INTEGER_EXPLICIT_PATTERN$1 = /* @__PURE__ */ new RegExp("^(?:[-+]?0b[0-1]+|[-+]?0o[0-7]+|[-+]?0x[0-9a-fA-F]+|[-+]?[0-9]+)$");
|
|
4399
|
+
function parseYamlInteger$2(source) {
|
|
4400
|
+
let value = source;
|
|
4401
|
+
let sign = 1;
|
|
4402
|
+
if (value[0] === "-" || value[0] === "+") {
|
|
4403
|
+
if (value[0] === "-") sign = -1;
|
|
4404
|
+
value = value.slice(1);
|
|
4405
|
+
}
|
|
4406
|
+
if (value.startsWith("0b")) return sign * parseInt(value.slice(2), 2);
|
|
4407
|
+
if (value.startsWith("0o")) return sign * parseInt(value.slice(2), 8);
|
|
4408
|
+
if (value.startsWith("0x")) return sign * parseInt(value.slice(2), 16);
|
|
4409
|
+
return sign * parseInt(value, 10);
|
|
4410
|
+
}
|
|
4411
|
+
function resolveYamlInteger$2(source, isExplicit) {
|
|
4412
|
+
if (isExplicit) {
|
|
4413
|
+
if (!YAML_INTEGER_EXPLICIT_PATTERN$1.test(source)) return NOT_RESOLVED;
|
|
4414
|
+
} else if (!YAML_INTEGER_IMPLICIT_PATTERN$1.test(source)) return NOT_RESOLVED;
|
|
4415
|
+
const result = parseYamlInteger$2(source);
|
|
4416
|
+
return Number.isFinite(result) ? result : NOT_RESOLVED;
|
|
4417
|
+
}
|
|
4418
|
+
var intCoreTag = defineScalarTag("tag:yaml.org,2002:int", {
|
|
4419
|
+
implicit: true,
|
|
4420
|
+
implicitFirstChars: [
|
|
4421
|
+
"-",
|
|
4422
|
+
"+",
|
|
4423
|
+
..."0123456789"
|
|
4424
|
+
],
|
|
4425
|
+
resolve: resolveYamlInteger$2,
|
|
4426
|
+
identify: (object) => Number.isInteger(object) && !Object.is(object, -0) && object.toString(10).indexOf("e") < 0,
|
|
4427
|
+
represent: (object) => object.toString(10)
|
|
4428
|
+
});
|
|
4538
4429
|
//#endregion
|
|
4539
|
-
//#region
|
|
4540
|
-
var
|
|
4541
|
-
|
|
4542
|
-
|
|
4543
|
-
|
|
4544
|
-
|
|
4545
|
-
|
|
4546
|
-
|
|
4547
|
-
|
|
4548
|
-
|
|
4549
|
-
|
|
4550
|
-
|
|
4551
|
-
|
|
4552
|
-
|
|
4553
|
-
|
|
4554
|
-
|
|
4555
|
-
|
|
4556
|
-
|
|
4557
|
-
|
|
4558
|
-
|
|
4559
|
-
|
|
4560
|
-
|
|
4561
|
-
|
|
4562
|
-
|
|
4563
|
-
|
|
4564
|
-
|
|
4565
|
-
|
|
4566
|
-
|
|
4567
|
-
|
|
4568
|
-
},
|
|
4569
|
-
defaultStyle: "lowercase"
|
|
4570
|
-
});
|
|
4571
|
-
}));
|
|
4430
|
+
//#region src/tag/scalar/int_json.ts
|
|
4431
|
+
var YAML_INTEGER_IMPLICIT_PATTERN = /* @__PURE__ */ new RegExp("^-?(?:0|[1-9][0-9]*)$");
|
|
4432
|
+
var YAML_INTEGER_EXPLICIT_PATTERN = /* @__PURE__ */ new RegExp("^(?:[-+]?0b[0-1]+|[-+]?0o[0-7]+|[-+]?0x[0-9a-fA-F]+|[-+]?[0-9]+)$");
|
|
4433
|
+
function parseYamlInteger$1(source) {
|
|
4434
|
+
let value = source;
|
|
4435
|
+
let sign = 1;
|
|
4436
|
+
if (value[0] === "-" || value[0] === "+") {
|
|
4437
|
+
if (value[0] === "-") sign = -1;
|
|
4438
|
+
value = value.slice(1);
|
|
4439
|
+
}
|
|
4440
|
+
if (value.startsWith("0b")) return sign * parseInt(value.slice(2), 2);
|
|
4441
|
+
if (value.startsWith("0o")) return sign * parseInt(value.slice(2), 8);
|
|
4442
|
+
if (value.startsWith("0x")) return sign * parseInt(value.slice(2), 16);
|
|
4443
|
+
return sign * parseInt(value, 10);
|
|
4444
|
+
}
|
|
4445
|
+
function resolveYamlInteger$1(source, isExplicit) {
|
|
4446
|
+
if (isExplicit) {
|
|
4447
|
+
if (!YAML_INTEGER_EXPLICIT_PATTERN.test(source)) return NOT_RESOLVED;
|
|
4448
|
+
} else if (!YAML_INTEGER_IMPLICIT_PATTERN.test(source)) return NOT_RESOLVED;
|
|
4449
|
+
const result = parseYamlInteger$1(source);
|
|
4450
|
+
return Number.isFinite(result) ? result : NOT_RESOLVED;
|
|
4451
|
+
}
|
|
4452
|
+
var intJsonTag = defineScalarTag("tag:yaml.org,2002:int", {
|
|
4453
|
+
implicit: true,
|
|
4454
|
+
implicitFirstChars: ["-", ..."0123456789"],
|
|
4455
|
+
resolve: resolveYamlInteger$1,
|
|
4456
|
+
identify: (object) => Number.isInteger(object) && !Object.is(object, -0) && object.toString(10).indexOf("e") < 0,
|
|
4457
|
+
represent: (object) => object.toString(10)
|
|
4458
|
+
});
|
|
4572
4459
|
//#endregion
|
|
4573
|
-
//#region
|
|
4574
|
-
var
|
|
4575
|
-
|
|
4576
|
-
|
|
4577
|
-
|
|
4578
|
-
|
|
4579
|
-
|
|
4580
|
-
|
|
4581
|
-
|
|
4582
|
-
|
|
4583
|
-
|
|
4584
|
-
|
|
4585
|
-
|
|
4586
|
-
|
|
4587
|
-
|
|
4588
|
-
|
|
4589
|
-
|
|
4590
|
-
|
|
4591
|
-
|
|
4592
|
-
|
|
4593
|
-
|
|
4594
|
-
|
|
4595
|
-
|
|
4596
|
-
|
|
4597
|
-
|
|
4598
|
-
|
|
4599
|
-
|
|
4600
|
-
|
|
4601
|
-
|
|
4602
|
-
|
|
4603
|
-
|
|
4604
|
-
|
|
4605
|
-
|
|
4606
|
-
|
|
4607
|
-
|
|
4608
|
-
for (; index < max; index++) {
|
|
4609
|
-
if (!isHexCode(data.charCodeAt(index))) return false;
|
|
4610
|
-
hasDigits = true;
|
|
4611
|
-
}
|
|
4612
|
-
return hasDigits && Number.isFinite(parseYamlInteger(data));
|
|
4613
|
-
}
|
|
4614
|
-
if (ch === "o") {
|
|
4615
|
-
index++;
|
|
4616
|
-
for (; index < max; index++) {
|
|
4617
|
-
if (!isOctCode(data.charCodeAt(index))) return false;
|
|
4618
|
-
hasDigits = true;
|
|
4619
|
-
}
|
|
4620
|
-
return hasDigits && Number.isFinite(parseYamlInteger(data));
|
|
4621
|
-
}
|
|
4622
|
-
}
|
|
4623
|
-
for (; index < max; index++) {
|
|
4624
|
-
if (!isDecCode(data.charCodeAt(index))) return false;
|
|
4625
|
-
hasDigits = true;
|
|
4626
|
-
}
|
|
4627
|
-
if (!hasDigits) return false;
|
|
4628
|
-
return Number.isFinite(parseYamlInteger(data));
|
|
4629
|
-
}
|
|
4630
|
-
function parseYamlInteger(data) {
|
|
4631
|
-
let value = data;
|
|
4632
|
-
let sign = 1;
|
|
4633
|
-
let ch = value[0];
|
|
4634
|
-
if (ch === "-" || ch === "+") {
|
|
4635
|
-
if (ch === "-") sign = -1;
|
|
4636
|
-
value = value.slice(1);
|
|
4637
|
-
ch = value[0];
|
|
4638
|
-
}
|
|
4639
|
-
if (value === "0") return 0;
|
|
4640
|
-
if (ch === "0") {
|
|
4641
|
-
if (value[1] === "b") return sign * parseInt(value.slice(2), 2);
|
|
4642
|
-
if (value[1] === "x") return sign * parseInt(value.slice(2), 16);
|
|
4643
|
-
if (value[1] === "o") return sign * parseInt(value.slice(2), 8);
|
|
4644
|
-
}
|
|
4645
|
-
return sign * parseInt(value, 10);
|
|
4646
|
-
}
|
|
4647
|
-
function constructYamlInteger(data) {
|
|
4648
|
-
return parseYamlInteger(data);
|
|
4649
|
-
}
|
|
4650
|
-
function isInteger(object) {
|
|
4651
|
-
return Object.prototype.toString.call(object) === "[object Number]" && object % 1 === 0 && !common.isNegativeZero(object);
|
|
4652
|
-
}
|
|
4653
|
-
module.exports = new Type("tag:yaml.org,2002:int", {
|
|
4654
|
-
kind: "scalar",
|
|
4655
|
-
resolve: resolveYamlInteger,
|
|
4656
|
-
construct: constructYamlInteger,
|
|
4657
|
-
predicate: isInteger,
|
|
4658
|
-
represent: {
|
|
4659
|
-
binary: function(obj) {
|
|
4660
|
-
return obj >= 0 ? "0b" + obj.toString(2) : "-0b" + obj.toString(2).slice(1);
|
|
4661
|
-
},
|
|
4662
|
-
octal: function(obj) {
|
|
4663
|
-
return obj >= 0 ? "0o" + obj.toString(8) : "-0o" + obj.toString(8).slice(1);
|
|
4664
|
-
},
|
|
4665
|
-
decimal: function(obj) {
|
|
4666
|
-
return obj.toString(10);
|
|
4667
|
-
},
|
|
4668
|
-
hexadecimal: function(obj) {
|
|
4669
|
-
return obj >= 0 ? "0x" + obj.toString(16).toUpperCase() : "-0x" + obj.toString(16).toUpperCase().slice(1);
|
|
4670
|
-
}
|
|
4671
|
-
},
|
|
4672
|
-
defaultStyle: "decimal",
|
|
4673
|
-
styleAliases: {
|
|
4674
|
-
binary: [2, "bin"],
|
|
4675
|
-
octal: [8, "oct"],
|
|
4676
|
-
decimal: [10, "dec"],
|
|
4677
|
-
hexadecimal: [16, "hex"]
|
|
4678
|
-
}
|
|
4679
|
-
});
|
|
4680
|
-
}));
|
|
4460
|
+
//#region src/tag/scalar/int_yaml11.ts
|
|
4461
|
+
var YAML_INTEGER_PATTERN = /* @__PURE__ */ new RegExp("^(?:[-+]?0b[0-1_]+|[-+]?0[0-7_]+|[-+]?0x[0-9a-fA-F_]+|[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+|[-+]?(?:0|[1-9][0-9_]*))$");
|
|
4462
|
+
function parseYamlInteger(source) {
|
|
4463
|
+
let value = source.replace(/_/g, "");
|
|
4464
|
+
let sign = 1;
|
|
4465
|
+
if (value[0] === "-" || value[0] === "+") {
|
|
4466
|
+
if (value[0] === "-") sign = -1;
|
|
4467
|
+
value = value.slice(1);
|
|
4468
|
+
}
|
|
4469
|
+
if (value.startsWith("0b")) return sign * parseInt(value.slice(2), 2);
|
|
4470
|
+
if (value.startsWith("0x")) return sign * parseInt(value.slice(2), 16);
|
|
4471
|
+
if (value.includes(":")) {
|
|
4472
|
+
let result = 0;
|
|
4473
|
+
for (const part of value.split(":")) result = result * 60 + Number(part);
|
|
4474
|
+
return sign * result;
|
|
4475
|
+
}
|
|
4476
|
+
if (value !== "0" && value[0] === "0") return sign * parseInt(value, 8);
|
|
4477
|
+
return sign * parseInt(value, 10);
|
|
4478
|
+
}
|
|
4479
|
+
function resolveYamlInteger(source) {
|
|
4480
|
+
if (!YAML_INTEGER_PATTERN.test(source)) return NOT_RESOLVED;
|
|
4481
|
+
const result = parseYamlInteger(source);
|
|
4482
|
+
return Number.isFinite(result) ? result : NOT_RESOLVED;
|
|
4483
|
+
}
|
|
4484
|
+
var intYaml11Tag = defineScalarTag("tag:yaml.org,2002:int", {
|
|
4485
|
+
implicit: true,
|
|
4486
|
+
implicitFirstChars: [
|
|
4487
|
+
"-",
|
|
4488
|
+
"+",
|
|
4489
|
+
..."0123456789"
|
|
4490
|
+
],
|
|
4491
|
+
resolve: resolveYamlInteger,
|
|
4492
|
+
identify: (object) => Number.isInteger(object) && !Object.is(object, -0) && object.toString(10).indexOf("e") < 0,
|
|
4493
|
+
represent: (object) => object.toString(10)
|
|
4494
|
+
});
|
|
4681
4495
|
//#endregion
|
|
4682
|
-
//#region
|
|
4683
|
-
var
|
|
4684
|
-
|
|
4685
|
-
|
|
4686
|
-
|
|
4687
|
-
|
|
4688
|
-
|
|
4689
|
-
|
|
4690
|
-
|
|
4691
|
-
|
|
4692
|
-
|
|
4693
|
-
|
|
4694
|
-
|
|
4695
|
-
|
|
4496
|
+
//#region src/tag/scalar/float_core.ts
|
|
4497
|
+
var YAML_FLOAT_PATTERN$1 = /* @__PURE__ */ new RegExp("^(?:[-+]?[0-9]+(?:\\.[0-9]*)?(?:[eE][-+]?[0-9]+)?|[-+]?\\.[0-9]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");
|
|
4498
|
+
var YAML_FLOAT_SPECIAL_PATTERN$1 = /* @__PURE__ */ new RegExp("^(?:[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");
|
|
4499
|
+
function resolveYamlFloat$2(source) {
|
|
4500
|
+
if (!YAML_FLOAT_PATTERN$1.test(source)) return NOT_RESOLVED;
|
|
4501
|
+
let value = source.toLowerCase();
|
|
4502
|
+
const sign = value[0] === "-" ? -1 : 1;
|
|
4503
|
+
if ("+-".includes(value[0])) value = value.slice(1);
|
|
4504
|
+
if (value === ".inf") return sign === 1 ? Number.POSITIVE_INFINITY : Number.NEGATIVE_INFINITY;
|
|
4505
|
+
if (value === ".nan") return NaN;
|
|
4506
|
+
const result = sign * parseFloat(value);
|
|
4507
|
+
if (Number.isFinite(result) || YAML_FLOAT_SPECIAL_PATTERN$1.test(source)) return result;
|
|
4508
|
+
return NOT_RESOLVED;
|
|
4509
|
+
}
|
|
4510
|
+
function representYamlFloat$2(object) {
|
|
4511
|
+
if (isNaN(object)) return ".nan";
|
|
4512
|
+
if (object === Number.POSITIVE_INFINITY) return ".inf";
|
|
4513
|
+
if (object === Number.NEGATIVE_INFINITY) return "-.inf";
|
|
4514
|
+
if (Object.is(object, -0)) return "-0.0";
|
|
4515
|
+
const result = object.toString(10);
|
|
4516
|
+
return /^[-+]?[0-9]+e/.test(result) ? result.replace("e", ".e") : result;
|
|
4517
|
+
}
|
|
4518
|
+
var floatCoreTag = defineScalarTag("tag:yaml.org,2002:float", {
|
|
4519
|
+
implicit: true,
|
|
4520
|
+
implicitFirstChars: [
|
|
4521
|
+
"-",
|
|
4522
|
+
"+",
|
|
4523
|
+
".",
|
|
4524
|
+
..."0123456789"
|
|
4525
|
+
],
|
|
4526
|
+
resolve: resolveYamlFloat$2,
|
|
4527
|
+
identify: (object) => typeof object === "number" && (!Number.isInteger(object) || Object.is(object, -0) || object.toString(10).indexOf("e") >= 0),
|
|
4528
|
+
represent: representYamlFloat$2
|
|
4529
|
+
});
|
|
4530
|
+
//#endregion
|
|
4531
|
+
//#region src/tag/scalar/float_json.ts
|
|
4532
|
+
var YAML_FLOAT_IMPLICIT_PATTERN = /* @__PURE__ */ new RegExp("^-?(?:0|[1-9][0-9]*)(?:\\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$");
|
|
4533
|
+
var YAML_FLOAT_EXPLICIT_PATTERN = /* @__PURE__ */ new RegExp("^(?:[-+]?[0-9]+(?:\\.[0-9]*)?(?:[eE][-+]?[0-9]+)?|[-+]?\\.[0-9]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");
|
|
4534
|
+
function resolveYamlFloat$1(source, isExplicit) {
|
|
4535
|
+
if (isExplicit) {
|
|
4536
|
+
if (!YAML_FLOAT_EXPLICIT_PATTERN.test(source)) return NOT_RESOLVED;
|
|
4537
|
+
let value = source.toLowerCase();
|
|
4696
4538
|
const sign = value[0] === "-" ? -1 : 1;
|
|
4697
|
-
if ("+-".
|
|
4539
|
+
if ("+-".includes(value[0])) value = value.slice(1);
|
|
4698
4540
|
if (value === ".inf") return sign === 1 ? Number.POSITIVE_INFINITY : Number.NEGATIVE_INFINITY;
|
|
4699
|
-
|
|
4700
|
-
|
|
4701
|
-
|
|
4702
|
-
|
|
4703
|
-
|
|
4704
|
-
|
|
4705
|
-
|
|
4706
|
-
|
|
4707
|
-
|
|
4708
|
-
|
|
4709
|
-
|
|
4710
|
-
|
|
4711
|
-
|
|
4712
|
-
|
|
4713
|
-
|
|
4714
|
-
|
|
4715
|
-
|
|
4716
|
-
|
|
4717
|
-
|
|
4718
|
-
|
|
4719
|
-
|
|
4720
|
-
|
|
4721
|
-
|
|
4722
|
-
|
|
4723
|
-
function isFloat(object) {
|
|
4724
|
-
return Object.prototype.toString.call(object) === "[object Number]" && (object % 1 !== 0 || common.isNegativeZero(object));
|
|
4725
|
-
}
|
|
4726
|
-
module.exports = new Type("tag:yaml.org,2002:float", {
|
|
4727
|
-
kind: "scalar",
|
|
4728
|
-
resolve: resolveYamlFloat,
|
|
4729
|
-
construct: constructYamlFloat,
|
|
4730
|
-
predicate: isFloat,
|
|
4731
|
-
represent: representYamlFloat,
|
|
4732
|
-
defaultStyle: "lowercase"
|
|
4733
|
-
});
|
|
4734
|
-
}));
|
|
4735
|
-
//#endregion
|
|
4736
|
-
//#region lib/schema/json.js
|
|
4737
|
-
var require_json = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
4738
|
-
module.exports = require_failsafe().extend({ implicit: [
|
|
4739
|
-
require_null(),
|
|
4740
|
-
require_bool(),
|
|
4741
|
-
require_int(),
|
|
4742
|
-
require_float()
|
|
4743
|
-
] });
|
|
4744
|
-
}));
|
|
4541
|
+
if (value === ".nan") return NaN;
|
|
4542
|
+
const result = sign * parseFloat(value);
|
|
4543
|
+
return Number.isFinite(result) ? result : NOT_RESOLVED;
|
|
4544
|
+
}
|
|
4545
|
+
if (!YAML_FLOAT_IMPLICIT_PATTERN.test(source)) return NOT_RESOLVED;
|
|
4546
|
+
const result = Number(source);
|
|
4547
|
+
if (Number.isFinite(result)) return result;
|
|
4548
|
+
return NOT_RESOLVED;
|
|
4549
|
+
}
|
|
4550
|
+
function representYamlFloat$1(object) {
|
|
4551
|
+
if (isNaN(object)) return ".nan";
|
|
4552
|
+
if (object === Number.POSITIVE_INFINITY) return ".inf";
|
|
4553
|
+
if (object === Number.NEGATIVE_INFINITY) return "-.inf";
|
|
4554
|
+
if (Object.is(object, -0)) return "-0.0";
|
|
4555
|
+
const result = object.toString(10);
|
|
4556
|
+
return /^[-+]?[0-9]+e/.test(result) ? result.replace("e", ".e") : result;
|
|
4557
|
+
}
|
|
4558
|
+
var floatJsonTag = defineScalarTag("tag:yaml.org,2002:float", {
|
|
4559
|
+
implicit: true,
|
|
4560
|
+
implicitFirstChars: ["-", ..."0123456789"],
|
|
4561
|
+
resolve: resolveYamlFloat$1,
|
|
4562
|
+
identify: (object) => typeof object === "number" && (!Number.isInteger(object) || Object.is(object, -0) || object.toString(10).indexOf("e") >= 0),
|
|
4563
|
+
represent: representYamlFloat$1
|
|
4564
|
+
});
|
|
4745
4565
|
//#endregion
|
|
4746
|
-
//#region
|
|
4747
|
-
var
|
|
4748
|
-
|
|
4749
|
-
|
|
4566
|
+
//#region src/tag/scalar/float_yaml11.ts
|
|
4567
|
+
var YAML_FLOAT_PATTERN = /* @__PURE__ */ new RegExp("^(?:[-+]?(?:(?:[0-9][0-9_]*)?\\.[0-9_]*)(?:[eE][-+][0-9]+)?|[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");
|
|
4568
|
+
var YAML_FLOAT_SPECIAL_PATTERN = /* @__PURE__ */ new RegExp("^(?:[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");
|
|
4569
|
+
function resolveYamlFloat(source) {
|
|
4570
|
+
if (!YAML_FLOAT_PATTERN.test(source)) return NOT_RESOLVED;
|
|
4571
|
+
let value = source.toLowerCase().replace(/_/g, "");
|
|
4572
|
+
const sign = value[0] === "-" ? -1 : 1;
|
|
4573
|
+
if ("+-".includes(value[0])) value = value.slice(1);
|
|
4574
|
+
if (value === ".inf") return sign === 1 ? Number.POSITIVE_INFINITY : Number.NEGATIVE_INFINITY;
|
|
4575
|
+
if (value === ".nan") return NaN;
|
|
4576
|
+
let result = 0;
|
|
4577
|
+
if (value.includes(":")) {
|
|
4578
|
+
for (const part of value.split(":")) result = result * 60 + Number(part);
|
|
4579
|
+
result *= sign;
|
|
4580
|
+
} else result = sign * parseFloat(value);
|
|
4581
|
+
if (Number.isFinite(result) || YAML_FLOAT_SPECIAL_PATTERN.test(source)) return result;
|
|
4582
|
+
return NOT_RESOLVED;
|
|
4583
|
+
}
|
|
4584
|
+
function representYamlFloat(object) {
|
|
4585
|
+
if (isNaN(object)) return ".nan";
|
|
4586
|
+
if (object === Number.POSITIVE_INFINITY) return ".inf";
|
|
4587
|
+
if (object === Number.NEGATIVE_INFINITY) return "-.inf";
|
|
4588
|
+
if (Object.is(object, -0)) return "-0.0";
|
|
4589
|
+
const result = object.toString(10);
|
|
4590
|
+
return /^[-+]?[0-9]+e/.test(result) ? result.replace("e", ".e") : result;
|
|
4591
|
+
}
|
|
4592
|
+
var floatYaml11Tag = defineScalarTag("tag:yaml.org,2002:float", {
|
|
4593
|
+
implicit: true,
|
|
4594
|
+
implicitFirstChars: [
|
|
4595
|
+
"-",
|
|
4596
|
+
"+",
|
|
4597
|
+
".",
|
|
4598
|
+
..."0123456789"
|
|
4599
|
+
],
|
|
4600
|
+
resolve: resolveYamlFloat,
|
|
4601
|
+
identify: (object) => typeof object === "number" && (!Number.isInteger(object) || Object.is(object, -0) || object.toString(10).indexOf("e") >= 0),
|
|
4602
|
+
represent: representYamlFloat
|
|
4603
|
+
});
|
|
4750
4604
|
//#endregion
|
|
4751
|
-
//#region
|
|
4752
|
-
var
|
|
4753
|
-
|
|
4754
|
-
|
|
4755
|
-
|
|
4756
|
-
|
|
4757
|
-
|
|
4758
|
-
if (YAML_DATE_REGEXP.exec(data) !== null) return true;
|
|
4759
|
-
if (YAML_TIMESTAMP_REGEXP.exec(data) !== null) return true;
|
|
4760
|
-
return false;
|
|
4605
|
+
//#region src/tag/scalar/merge.ts
|
|
4606
|
+
var mergeTag = defineScalarTag("tag:yaml.org,2002:merge", {
|
|
4607
|
+
implicit: true,
|
|
4608
|
+
implicitFirstChars: ["<"],
|
|
4609
|
+
resolve: (source, isExplicit) => {
|
|
4610
|
+
if (source === "<<" || isExplicit && source === "") return MERGE_KEY;
|
|
4611
|
+
return NOT_RESOLVED;
|
|
4761
4612
|
}
|
|
4762
|
-
|
|
4763
|
-
|
|
4764
|
-
|
|
4765
|
-
|
|
4766
|
-
|
|
4767
|
-
|
|
4768
|
-
|
|
4769
|
-
|
|
4770
|
-
|
|
4771
|
-
|
|
4772
|
-
|
|
4773
|
-
|
|
4774
|
-
|
|
4775
|
-
|
|
4776
|
-
|
|
4777
|
-
|
|
4778
|
-
|
|
4779
|
-
|
|
4780
|
-
|
|
4781
|
-
|
|
4782
|
-
|
|
4783
|
-
|
|
4784
|
-
|
|
4785
|
-
|
|
4786
|
-
|
|
4787
|
-
|
|
4613
|
+
});
|
|
4614
|
+
//#endregion
|
|
4615
|
+
//#region src/tag/scalar/binary.ts
|
|
4616
|
+
var BASE64_PATTERN = /^[A-Za-z0-9+/]*={0,2}$/;
|
|
4617
|
+
function resolveYamlBinary(source) {
|
|
4618
|
+
const input = source.replace(/\s/g, "");
|
|
4619
|
+
if (input.length % 4 !== 0 || !BASE64_PATTERN.test(input)) return NOT_RESOLVED;
|
|
4620
|
+
const binary = atob(input);
|
|
4621
|
+
const result = new Uint8Array(binary.length);
|
|
4622
|
+
for (let index = 0; index < binary.length; index++) result[index] = binary.charCodeAt(index);
|
|
4623
|
+
return result;
|
|
4624
|
+
}
|
|
4625
|
+
function representYamlBinary(object) {
|
|
4626
|
+
let binary = "";
|
|
4627
|
+
for (let index = 0; index < object.length; index++) binary += String.fromCharCode(object[index]);
|
|
4628
|
+
return btoa(binary);
|
|
4629
|
+
}
|
|
4630
|
+
var binaryTag = defineScalarTag("tag:yaml.org,2002:binary", {
|
|
4631
|
+
resolve: resolveYamlBinary,
|
|
4632
|
+
identify: (object) => Object.prototype.toString.call(object) === "[object Uint8Array]",
|
|
4633
|
+
represent: representYamlBinary
|
|
4634
|
+
});
|
|
4635
|
+
//#endregion
|
|
4636
|
+
//#region src/tag/scalar/timestamp.ts
|
|
4637
|
+
var YAML_DATE_REGEXP = /* @__PURE__ */ new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$");
|
|
4638
|
+
var YAML_TIMESTAMP_REGEXP = /* @__PURE__ */ new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");
|
|
4639
|
+
function resolveYamlTimestamp(source) {
|
|
4640
|
+
let match = YAML_DATE_REGEXP.exec(source);
|
|
4641
|
+
if (match === null) match = YAML_TIMESTAMP_REGEXP.exec(source);
|
|
4642
|
+
if (match === null) return NOT_RESOLVED;
|
|
4643
|
+
const year = +match[1];
|
|
4644
|
+
const month = +match[2] - 1;
|
|
4645
|
+
const day = +match[3];
|
|
4646
|
+
if (!match[4]) {
|
|
4647
|
+
const date = new Date(Date.UTC(year, month, day));
|
|
4648
|
+
if (date.getUTCFullYear() !== year || date.getUTCMonth() !== month || date.getUTCDate() !== day) return NOT_RESOLVED;
|
|
4788
4649
|
return date;
|
|
4789
4650
|
}
|
|
4790
|
-
|
|
4791
|
-
|
|
4792
|
-
|
|
4793
|
-
|
|
4794
|
-
|
|
4795
|
-
|
|
4796
|
-
|
|
4797
|
-
|
|
4798
|
-
|
|
4799
|
-
}
|
|
4800
|
-
|
|
4651
|
+
const hour = +match[4];
|
|
4652
|
+
const minute = +match[5];
|
|
4653
|
+
const second = +match[6];
|
|
4654
|
+
let fraction = 0;
|
|
4655
|
+
if (hour > 23 || minute > 59 || second > 59) return NOT_RESOLVED;
|
|
4656
|
+
if (match[7]) {
|
|
4657
|
+
let value = match[7].slice(0, 3);
|
|
4658
|
+
while (value.length < 3) value += "0";
|
|
4659
|
+
fraction = +value;
|
|
4660
|
+
}
|
|
4661
|
+
const date = new Date(Date.UTC(year, month, day, hour, minute, second, fraction));
|
|
4662
|
+
if (date.getUTCFullYear() !== year || date.getUTCMonth() !== month || date.getUTCDate() !== day) return NOT_RESOLVED;
|
|
4663
|
+
if (match[9]) {
|
|
4664
|
+
const offsetHour = +match[10];
|
|
4665
|
+
const offsetMinute = +(match[11] || 0);
|
|
4666
|
+
if (offsetHour > 23 || offsetMinute > 59) return NOT_RESOLVED;
|
|
4667
|
+
const offset = (offsetHour * 60 + offsetMinute) * 6e4;
|
|
4668
|
+
date.setTime(date.getTime() - (match[9] === "-" ? -offset : offset));
|
|
4669
|
+
}
|
|
4670
|
+
return date;
|
|
4671
|
+
}
|
|
4672
|
+
var timestampTag = defineScalarTag("tag:yaml.org,2002:timestamp", {
|
|
4673
|
+
implicit: true,
|
|
4674
|
+
implicitFirstChars: [..."0123456789"],
|
|
4675
|
+
resolve: resolveYamlTimestamp,
|
|
4676
|
+
identify: (object) => object instanceof Date,
|
|
4677
|
+
represent: (object) => object.toISOString()
|
|
4678
|
+
});
|
|
4801
4679
|
//#endregion
|
|
4802
|
-
//#region
|
|
4803
|
-
var
|
|
4804
|
-
|
|
4805
|
-
|
|
4806
|
-
|
|
4807
|
-
}
|
|
4808
|
-
|
|
4809
|
-
|
|
4810
|
-
resolve: resolveYamlMerge
|
|
4811
|
-
});
|
|
4812
|
-
}));
|
|
4680
|
+
//#region src/tag/sequence/seq.ts
|
|
4681
|
+
var seqTag = defineSequenceTag("tag:yaml.org,2002:seq", {
|
|
4682
|
+
create: () => [],
|
|
4683
|
+
addItem: (container, item) => {
|
|
4684
|
+
container.push(item);
|
|
4685
|
+
},
|
|
4686
|
+
identify: Array.isArray
|
|
4687
|
+
});
|
|
4813
4688
|
//#endregion
|
|
4814
|
-
//#region
|
|
4815
|
-
|
|
4816
|
-
|
|
4817
|
-
|
|
4818
|
-
|
|
4819
|
-
|
|
4820
|
-
|
|
4821
|
-
|
|
4822
|
-
|
|
4823
|
-
|
|
4824
|
-
|
|
4825
|
-
if (code > 64) continue;
|
|
4826
|
-
if (code < 0) return false;
|
|
4827
|
-
bitlen += 6;
|
|
4828
|
-
}
|
|
4829
|
-
return bitlen % 8 === 0;
|
|
4830
|
-
}
|
|
4831
|
-
function constructYamlBinary(data) {
|
|
4832
|
-
const input = data.replace(/[\r\n=]/g, "");
|
|
4833
|
-
const max = input.length;
|
|
4834
|
-
const map = BASE64_MAP;
|
|
4835
|
-
let bits = 0;
|
|
4836
|
-
const result = [];
|
|
4837
|
-
for (let idx = 0; idx < max; idx++) {
|
|
4838
|
-
if (idx % 4 === 0 && idx) {
|
|
4839
|
-
result.push(bits >> 16 & 255);
|
|
4840
|
-
result.push(bits >> 8 & 255);
|
|
4841
|
-
result.push(bits & 255);
|
|
4842
|
-
}
|
|
4843
|
-
bits = bits << 6 | map.indexOf(input.charAt(idx));
|
|
4844
|
-
}
|
|
4845
|
-
const tailbits = max % 4 * 6;
|
|
4846
|
-
if (tailbits === 0) {
|
|
4847
|
-
result.push(bits >> 16 & 255);
|
|
4848
|
-
result.push(bits >> 8 & 255);
|
|
4849
|
-
result.push(bits & 255);
|
|
4850
|
-
} else if (tailbits === 18) {
|
|
4851
|
-
result.push(bits >> 10 & 255);
|
|
4852
|
-
result.push(bits >> 2 & 255);
|
|
4853
|
-
} else if (tailbits === 12) result.push(bits >> 4 & 255);
|
|
4854
|
-
return new Uint8Array(result);
|
|
4855
|
-
}
|
|
4856
|
-
function representYamlBinary(object) {
|
|
4857
|
-
let result = "";
|
|
4858
|
-
let bits = 0;
|
|
4859
|
-
const max = object.length;
|
|
4860
|
-
const map = BASE64_MAP;
|
|
4861
|
-
for (let idx = 0; idx < max; idx++) {
|
|
4862
|
-
if (idx % 3 === 0 && idx) {
|
|
4863
|
-
result += map[bits >> 18 & 63];
|
|
4864
|
-
result += map[bits >> 12 & 63];
|
|
4865
|
-
result += map[bits >> 6 & 63];
|
|
4866
|
-
result += map[bits & 63];
|
|
4867
|
-
}
|
|
4868
|
-
bits = (bits << 8) + object[idx];
|
|
4869
|
-
}
|
|
4870
|
-
const tail = max % 3;
|
|
4871
|
-
if (tail === 0) {
|
|
4872
|
-
result += map[bits >> 18 & 63];
|
|
4873
|
-
result += map[bits >> 12 & 63];
|
|
4874
|
-
result += map[bits >> 6 & 63];
|
|
4875
|
-
result += map[bits & 63];
|
|
4876
|
-
} else if (tail === 2) {
|
|
4877
|
-
result += map[bits >> 10 & 63];
|
|
4878
|
-
result += map[bits >> 4 & 63];
|
|
4879
|
-
result += map[bits << 2 & 63];
|
|
4880
|
-
result += map[64];
|
|
4881
|
-
} else if (tail === 1) {
|
|
4882
|
-
result += map[bits >> 2 & 63];
|
|
4883
|
-
result += map[bits << 4 & 63];
|
|
4884
|
-
result += map[64];
|
|
4885
|
-
result += map[64];
|
|
4886
|
-
}
|
|
4887
|
-
return result;
|
|
4888
|
-
}
|
|
4889
|
-
function isBinary(obj) {
|
|
4890
|
-
return Object.prototype.toString.call(obj) === "[object Uint8Array]";
|
|
4891
|
-
}
|
|
4892
|
-
module.exports = new Type("tag:yaml.org,2002:binary", {
|
|
4893
|
-
kind: "scalar",
|
|
4894
|
-
resolve: resolveYamlBinary,
|
|
4895
|
-
construct: constructYamlBinary,
|
|
4896
|
-
predicate: isBinary,
|
|
4897
|
-
represent: representYamlBinary
|
|
4898
|
-
});
|
|
4899
|
-
}));
|
|
4689
|
+
//#region src/common/object.ts
|
|
4690
|
+
function isPlainObject$1(data) {
|
|
4691
|
+
if (data === null || typeof data !== "object" || Array.isArray(data)) return false;
|
|
4692
|
+
const prototype = Object.getPrototypeOf(data);
|
|
4693
|
+
return prototype === null || prototype === Object.prototype;
|
|
4694
|
+
}
|
|
4695
|
+
function pick(object, keys) {
|
|
4696
|
+
const result = {};
|
|
4697
|
+
for (const key of keys) if (object[key] !== void 0) result[key] = object[key];
|
|
4698
|
+
return result;
|
|
4699
|
+
}
|
|
4900
4700
|
//#endregion
|
|
4901
|
-
//#region
|
|
4902
|
-
var
|
|
4903
|
-
|
|
4904
|
-
|
|
4905
|
-
|
|
4906
|
-
|
|
4907
|
-
|
|
4908
|
-
|
|
4909
|
-
|
|
4910
|
-
|
|
4911
|
-
|
|
4912
|
-
|
|
4913
|
-
|
|
4914
|
-
|
|
4915
|
-
|
|
4916
|
-
|
|
4917
|
-
|
|
4918
|
-
|
|
4919
|
-
|
|
4701
|
+
//#region src/tag/sequence/omap.ts
|
|
4702
|
+
var omapTag = defineSequenceTag("tag:yaml.org,2002:omap", {
|
|
4703
|
+
create: () => ({
|
|
4704
|
+
list: [],
|
|
4705
|
+
seen: /* @__PURE__ */ new Set()
|
|
4706
|
+
}),
|
|
4707
|
+
addItem: (carrier, item) => {
|
|
4708
|
+
let key;
|
|
4709
|
+
if (item instanceof Map) {
|
|
4710
|
+
if (item.size !== 1) return "cannot resolve an ordered map item";
|
|
4711
|
+
key = item.keys().next().value;
|
|
4712
|
+
} else if (isPlainObject$1(item)) {
|
|
4713
|
+
const itemKeys = Object.keys(item);
|
|
4714
|
+
if (itemKeys.length !== 1) return "cannot resolve an ordered map item";
|
|
4715
|
+
key = itemKeys[0];
|
|
4716
|
+
} else return "cannot resolve an ordered map item";
|
|
4717
|
+
if (carrier.seen.has(key)) return "duplicate key in ordered map";
|
|
4718
|
+
carrier.seen.add(key);
|
|
4719
|
+
carrier.list.push(item);
|
|
4720
|
+
return "";
|
|
4721
|
+
},
|
|
4722
|
+
finalize: (carrier) => carrier.list
|
|
4723
|
+
});
|
|
4724
|
+
//#endregion
|
|
4725
|
+
//#region src/tag/sequence/pairs.ts
|
|
4726
|
+
var pairsTag = defineSequenceTag("tag:yaml.org,2002:pairs", {
|
|
4727
|
+
create: () => [],
|
|
4728
|
+
addItem: (container, item) => {
|
|
4729
|
+
if (item instanceof Map) {
|
|
4730
|
+
if (item.size !== 1) return "cannot resolve a pairs item";
|
|
4731
|
+
container.push(item.entries().next().value);
|
|
4732
|
+
return "";
|
|
4920
4733
|
}
|
|
4921
|
-
return
|
|
4922
|
-
|
|
4923
|
-
|
|
4924
|
-
|
|
4734
|
+
if (Object.prototype.toString.call(item) !== "[object Object]") return "cannot resolve a pairs item";
|
|
4735
|
+
const object = item;
|
|
4736
|
+
const keys = Object.keys(object);
|
|
4737
|
+
if (keys.length !== 1) return "cannot resolve a pairs item";
|
|
4738
|
+
container.push([keys[0], object[keys[0]]]);
|
|
4739
|
+
return "";
|
|
4925
4740
|
}
|
|
4926
|
-
|
|
4927
|
-
|
|
4928
|
-
|
|
4929
|
-
|
|
4930
|
-
})
|
|
4931
|
-
|
|
4741
|
+
});
|
|
4742
|
+
//#endregion
|
|
4743
|
+
//#region src/tag/mapping/map.ts
|
|
4744
|
+
var mapTag$5 = defineMappingTag("tag:yaml.org,2002:map", {
|
|
4745
|
+
create: () => ({}),
|
|
4746
|
+
identify: isPlainObject$1,
|
|
4747
|
+
represent: (o) => {
|
|
4748
|
+
const map = /* @__PURE__ */ new Map();
|
|
4749
|
+
for (const key of Object.keys(o)) map.set(key, o[key]);
|
|
4750
|
+
return map;
|
|
4751
|
+
},
|
|
4752
|
+
addPair: (container, key, value) => {
|
|
4753
|
+
if (key !== null && typeof key === "object") return "object-based map does not support complex keys";
|
|
4754
|
+
const normalizedKey = String(key);
|
|
4755
|
+
if (normalizedKey === "__proto__") Object.defineProperty(container, normalizedKey, {
|
|
4756
|
+
value,
|
|
4757
|
+
enumerable: true,
|
|
4758
|
+
configurable: true,
|
|
4759
|
+
writable: true
|
|
4760
|
+
});
|
|
4761
|
+
else container[normalizedKey] = value;
|
|
4762
|
+
return "";
|
|
4763
|
+
},
|
|
4764
|
+
has: (container, key) => {
|
|
4765
|
+
if (key !== null && typeof key === "object") return false;
|
|
4766
|
+
return Object.prototype.hasOwnProperty.call(container, String(key));
|
|
4767
|
+
},
|
|
4768
|
+
keys: (container) => Object.keys(container),
|
|
4769
|
+
get: (container, key) => container[String(key)]
|
|
4770
|
+
});
|
|
4932
4771
|
//#endregion
|
|
4933
|
-
//#region
|
|
4934
|
-
var
|
|
4935
|
-
|
|
4936
|
-
|
|
4937
|
-
|
|
4938
|
-
|
|
4939
|
-
const
|
|
4940
|
-
|
|
4941
|
-
|
|
4942
|
-
|
|
4943
|
-
|
|
4944
|
-
|
|
4945
|
-
|
|
4946
|
-
|
|
4772
|
+
//#region src/tag/mapping/set.ts
|
|
4773
|
+
var setTag$5 = defineMappingTag("tag:yaml.org,2002:set", {
|
|
4774
|
+
create: () => /* @__PURE__ */ new Set(),
|
|
4775
|
+
identify: (data) => data instanceof Set,
|
|
4776
|
+
represent: (data) => {
|
|
4777
|
+
const map = /* @__PURE__ */ new Map();
|
|
4778
|
+
for (const key of data) map.set(key, null);
|
|
4779
|
+
return map;
|
|
4780
|
+
},
|
|
4781
|
+
addPair: (container, key, value) => {
|
|
4782
|
+
if (value !== null) return "cannot resolve a set item";
|
|
4783
|
+
container.add(key);
|
|
4784
|
+
return "";
|
|
4785
|
+
},
|
|
4786
|
+
has: (container, key) => container.has(key),
|
|
4787
|
+
keys: (container) => container.keys(),
|
|
4788
|
+
get: () => null
|
|
4789
|
+
});
|
|
4790
|
+
//#endregion
|
|
4791
|
+
//#region src/schema.ts
|
|
4792
|
+
function createTagDefinitionMap() {
|
|
4793
|
+
return {
|
|
4794
|
+
scalar: {},
|
|
4795
|
+
sequence: {},
|
|
4796
|
+
mapping: {}
|
|
4797
|
+
};
|
|
4798
|
+
}
|
|
4799
|
+
function createTagDefinitionListMap() {
|
|
4800
|
+
return {
|
|
4801
|
+
scalar: [],
|
|
4802
|
+
sequence: [],
|
|
4803
|
+
mapping: []
|
|
4804
|
+
};
|
|
4805
|
+
}
|
|
4806
|
+
function compileTags(tags) {
|
|
4807
|
+
const result = [];
|
|
4808
|
+
for (const tag of tags) {
|
|
4809
|
+
let index = result.length;
|
|
4810
|
+
for (let previousIndex = 0; previousIndex < result.length; previousIndex++) {
|
|
4811
|
+
const previous = result[previousIndex];
|
|
4812
|
+
if (previous.nodeKind === tag.nodeKind && previous.tagName === tag.tagName && previous.matchByTagPrefix === tag.matchByTagPrefix) {
|
|
4813
|
+
index = previousIndex;
|
|
4814
|
+
break;
|
|
4815
|
+
}
|
|
4947
4816
|
}
|
|
4948
|
-
|
|
4949
|
-
}
|
|
4950
|
-
|
|
4951
|
-
|
|
4952
|
-
|
|
4953
|
-
|
|
4954
|
-
|
|
4955
|
-
|
|
4956
|
-
|
|
4957
|
-
|
|
4817
|
+
result[index] = tag;
|
|
4818
|
+
}
|
|
4819
|
+
return result;
|
|
4820
|
+
}
|
|
4821
|
+
var Schema = class Schema {
|
|
4822
|
+
tags;
|
|
4823
|
+
implicitScalarTags;
|
|
4824
|
+
implicitScalarByFirstChar;
|
|
4825
|
+
implicitScalarAnyFirstChar;
|
|
4826
|
+
defaultScalarTag;
|
|
4827
|
+
defaultSequenceTag;
|
|
4828
|
+
defaultMappingTag;
|
|
4829
|
+
exact;
|
|
4830
|
+
prefix;
|
|
4831
|
+
constructor(tags) {
|
|
4832
|
+
const compiledTags = compileTags(tags);
|
|
4833
|
+
const implicitScalarTags = [];
|
|
4834
|
+
const exact = createTagDefinitionMap();
|
|
4835
|
+
const prefix = createTagDefinitionListMap();
|
|
4836
|
+
for (const tag of compiledTags) {
|
|
4837
|
+
if (tag.nodeKind === "scalar" && tag.implicit) {
|
|
4838
|
+
if (tag.matchByTagPrefix) throw new Error("Implicit scalar tags cannot match by tag prefix");
|
|
4839
|
+
implicitScalarTags.push(tag);
|
|
4840
|
+
}
|
|
4841
|
+
switch (tag.nodeKind) {
|
|
4842
|
+
case "scalar":
|
|
4843
|
+
if (tag.matchByTagPrefix) prefix.scalar.push(tag);
|
|
4844
|
+
else exact.scalar[tag.tagName] = tag;
|
|
4845
|
+
break;
|
|
4846
|
+
case "sequence":
|
|
4847
|
+
if (tag.matchByTagPrefix) prefix.sequence.push(tag);
|
|
4848
|
+
else exact.sequence[tag.tagName] = tag;
|
|
4849
|
+
break;
|
|
4850
|
+
case "mapping":
|
|
4851
|
+
if (tag.matchByTagPrefix) prefix.mapping.push(tag);
|
|
4852
|
+
else exact.mapping[tag.tagName] = tag;
|
|
4853
|
+
break;
|
|
4854
|
+
}
|
|
4958
4855
|
}
|
|
4959
|
-
|
|
4856
|
+
const implicitScalarAnyFirstChar = implicitScalarTags.filter((tag) => tag.implicitFirstChars === null);
|
|
4857
|
+
const keys = /* @__PURE__ */ new Set();
|
|
4858
|
+
for (const tag of implicitScalarTags) if (tag.implicitFirstChars !== null) for (const key of tag.implicitFirstChars) keys.add(key);
|
|
4859
|
+
const implicitScalarByFirstChar = /* @__PURE__ */ new Map();
|
|
4860
|
+
for (const key of keys) implicitScalarByFirstChar.set(key, implicitScalarTags.filter((tag) => tag.implicitFirstChars === null || tag.implicitFirstChars.indexOf(key) !== -1));
|
|
4861
|
+
const defaultScalarTag = exact.scalar["tag:yaml.org,2002:str"];
|
|
4862
|
+
if (!defaultScalarTag) throw new Error("schema does not define the default scalar tag (tag:yaml.org,2002:str)");
|
|
4863
|
+
this.tags = compiledTags;
|
|
4864
|
+
this.implicitScalarTags = implicitScalarTags;
|
|
4865
|
+
this.implicitScalarByFirstChar = implicitScalarByFirstChar;
|
|
4866
|
+
this.implicitScalarAnyFirstChar = implicitScalarAnyFirstChar;
|
|
4867
|
+
this.defaultScalarTag = defaultScalarTag;
|
|
4868
|
+
this.defaultSequenceTag = exact.sequence["tag:yaml.org,2002:seq"];
|
|
4869
|
+
this.defaultMappingTag = exact.mapping["tag:yaml.org,2002:map"];
|
|
4870
|
+
this.exact = exact;
|
|
4871
|
+
this.prefix = prefix;
|
|
4872
|
+
}
|
|
4873
|
+
withTags(...tags) {
|
|
4874
|
+
let flatTags = [];
|
|
4875
|
+
for (const tag of tags) flatTags = flatTags.concat(tag);
|
|
4876
|
+
return new Schema([...this.tags, ...flatTags]);
|
|
4960
4877
|
}
|
|
4961
|
-
|
|
4962
|
-
|
|
4963
|
-
|
|
4964
|
-
|
|
4965
|
-
|
|
4966
|
-
|
|
4878
|
+
};
|
|
4879
|
+
var FAILSAFE_SCHEMA = new Schema([
|
|
4880
|
+
strTag,
|
|
4881
|
+
seqTag,
|
|
4882
|
+
mapTag$5
|
|
4883
|
+
]);
|
|
4884
|
+
new Schema([
|
|
4885
|
+
...FAILSAFE_SCHEMA.tags,
|
|
4886
|
+
nullJsonTag,
|
|
4887
|
+
boolJsonTag,
|
|
4888
|
+
intJsonTag,
|
|
4889
|
+
floatJsonTag
|
|
4890
|
+
]);
|
|
4891
|
+
var CORE_SCHEMA = new Schema([
|
|
4892
|
+
...FAILSAFE_SCHEMA.tags,
|
|
4893
|
+
nullCoreTag,
|
|
4894
|
+
boolCoreTag,
|
|
4895
|
+
intCoreTag,
|
|
4896
|
+
floatCoreTag
|
|
4897
|
+
]);
|
|
4898
|
+
var YAML11_SCHEMA = new Schema([
|
|
4899
|
+
...FAILSAFE_SCHEMA.tags,
|
|
4900
|
+
nullYaml11Tag,
|
|
4901
|
+
boolYaml11Tag,
|
|
4902
|
+
intYaml11Tag,
|
|
4903
|
+
floatYaml11Tag,
|
|
4904
|
+
timestampTag,
|
|
4905
|
+
mergeTag,
|
|
4906
|
+
binaryTag,
|
|
4907
|
+
omapTag,
|
|
4908
|
+
pairsTag,
|
|
4909
|
+
setTag$5
|
|
4910
|
+
]);
|
|
4967
4911
|
//#endregion
|
|
4968
|
-
//#region
|
|
4969
|
-
|
|
4970
|
-
|
|
4971
|
-
|
|
4972
|
-
|
|
4973
|
-
|
|
4974
|
-
|
|
4975
|
-
|
|
4976
|
-
|
|
4977
|
-
|
|
4978
|
-
|
|
4979
|
-
|
|
4980
|
-
|
|
4981
|
-
|
|
4912
|
+
//#region src/tag/mapping/real_map.ts
|
|
4913
|
+
defineMappingTag("tag:yaml.org,2002:map", {
|
|
4914
|
+
create: () => /* @__PURE__ */ new Map(),
|
|
4915
|
+
addPair: (container, key, value) => {
|
|
4916
|
+
container.set(key, value);
|
|
4917
|
+
return "";
|
|
4918
|
+
},
|
|
4919
|
+
has: (container, key) => container.has(key),
|
|
4920
|
+
keys: (container) => container.keys(),
|
|
4921
|
+
get: (container, key) => container.get(key),
|
|
4922
|
+
identify: (data) => data instanceof Map || isPlainObject$1(data),
|
|
4923
|
+
represent: (data) => {
|
|
4924
|
+
if (data instanceof Map) return data;
|
|
4925
|
+
const map = /* @__PURE__ */ new Map();
|
|
4926
|
+
const obj = data;
|
|
4927
|
+
for (const key of Object.keys(obj)) map.set(key, obj[key]);
|
|
4928
|
+
return map;
|
|
4982
4929
|
}
|
|
4983
|
-
|
|
4984
|
-
kind: "mapping",
|
|
4985
|
-
resolve: resolveYamlSet,
|
|
4986
|
-
construct: constructYamlSet
|
|
4987
|
-
});
|
|
4988
|
-
}));
|
|
4989
|
-
//#endregion
|
|
4990
|
-
//#region lib/schema/default.js
|
|
4991
|
-
var require_default = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
4992
|
-
module.exports = require_core().extend({
|
|
4993
|
-
implicit: [require_timestamp(), require_merge()],
|
|
4994
|
-
explicit: [
|
|
4995
|
-
require_binary(),
|
|
4996
|
-
require_omap(),
|
|
4997
|
-
require_pairs(),
|
|
4998
|
-
require_set()
|
|
4999
|
-
]
|
|
5000
|
-
});
|
|
5001
|
-
}));
|
|
4930
|
+
});
|
|
5002
4931
|
//#endregion
|
|
5003
|
-
//#region
|
|
5004
|
-
|
|
5005
|
-
|
|
5006
|
-
|
|
5007
|
-
|
|
5008
|
-
|
|
5009
|
-
|
|
5010
|
-
var CONTEXT_FLOW_IN = 1;
|
|
5011
|
-
var CONTEXT_FLOW_OUT = 2;
|
|
5012
|
-
var CONTEXT_BLOCK_IN = 3;
|
|
5013
|
-
var CONTEXT_BLOCK_OUT = 4;
|
|
5014
|
-
var CHOMPING_CLIP = 1;
|
|
5015
|
-
var CHOMPING_STRIP = 2;
|
|
5016
|
-
var CHOMPING_KEEP = 3;
|
|
5017
|
-
var PATTERN_NON_PRINTABLE = /[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/;
|
|
5018
|
-
var PATTERN_NON_ASCII_LINE_BREAKS = /[\x85\u2028\u2029]/;
|
|
5019
|
-
var PATTERN_FLOW_INDICATORS = /[,\[\]{}]/;
|
|
5020
|
-
var PATTERN_TAG_HANDLE = /^(?:!|!!|![0-9A-Za-z-]+!)$/;
|
|
5021
|
-
var PATTERN_TAG_URI = /^(?:!|[^,\[\]{}])(?:%[0-9a-f]{2}|[0-9a-z\-#;/?:@&=+$,_.!~*'()\[\]])*$/i;
|
|
5022
|
-
function _class(obj) {
|
|
5023
|
-
return Object.prototype.toString.call(obj);
|
|
5024
|
-
}
|
|
5025
|
-
function isEol(c) {
|
|
5026
|
-
return c === 10 || c === 13;
|
|
5027
|
-
}
|
|
5028
|
-
function isWhiteSpace(c) {
|
|
5029
|
-
return c === 9 || c === 32;
|
|
5030
|
-
}
|
|
5031
|
-
function isWsOrEol(c) {
|
|
5032
|
-
return c === 9 || c === 32 || c === 10 || c === 13;
|
|
5033
|
-
}
|
|
5034
|
-
function isFlowIndicator(c) {
|
|
5035
|
-
return c === 44 || c === 91 || c === 93 || c === 123 || c === 125;
|
|
5036
|
-
}
|
|
5037
|
-
function fromHexCode(c) {
|
|
5038
|
-
if (c >= 48 && c <= 57) return c - 48;
|
|
5039
|
-
const lc = c | 32;
|
|
5040
|
-
if (lc >= 97 && lc <= 102) return lc - 97 + 10;
|
|
5041
|
-
return -1;
|
|
5042
|
-
}
|
|
5043
|
-
function escapedHexLen(c) {
|
|
5044
|
-
if (c === 120) return 2;
|
|
5045
|
-
if (c === 117) return 4;
|
|
5046
|
-
if (c === 85) return 8;
|
|
5047
|
-
return 0;
|
|
5048
|
-
}
|
|
5049
|
-
function fromDecimalCode(c) {
|
|
5050
|
-
if (c >= 48 && c <= 57) return c - 48;
|
|
5051
|
-
return -1;
|
|
5052
|
-
}
|
|
5053
|
-
function simpleEscapeSequence(c) {
|
|
5054
|
-
switch (c) {
|
|
5055
|
-
case 48: return "\0";
|
|
5056
|
-
case 97: return "\x07";
|
|
5057
|
-
case 98: return "\b";
|
|
5058
|
-
case 116: return " ";
|
|
5059
|
-
case 9: return " ";
|
|
5060
|
-
case 110: return "\n";
|
|
5061
|
-
case 118: return "\v";
|
|
5062
|
-
case 102: return "\f";
|
|
5063
|
-
case 114: return "\r";
|
|
5064
|
-
case 101: return "\x1B";
|
|
5065
|
-
case 32: return " ";
|
|
5066
|
-
case 34: return "\"";
|
|
5067
|
-
case 47: return "/";
|
|
5068
|
-
case 92: return "\\";
|
|
5069
|
-
case 78: return "
";
|
|
5070
|
-
case 95: return "\xA0";
|
|
5071
|
-
case 76: return "\u2028";
|
|
5072
|
-
case 80: return "\u2029";
|
|
5073
|
-
default: return "";
|
|
4932
|
+
//#region src/tag/mapping/legacy_map.ts
|
|
4933
|
+
function normalizeKey(key) {
|
|
4934
|
+
if (Array.isArray(key)) {
|
|
4935
|
+
const array = Array.prototype.slice.call(key);
|
|
4936
|
+
for (let index = 0; index < array.length; index++) {
|
|
4937
|
+
if (Array.isArray(array[index])) return null;
|
|
4938
|
+
if (typeof array[index] === "object" && Object.prototype.toString.call(array[index]) === "[object Object]") array[index] = "[object Object]";
|
|
5074
4939
|
}
|
|
5075
|
-
|
|
5076
|
-
|
|
5077
|
-
|
|
5078
|
-
|
|
5079
|
-
|
|
5080
|
-
|
|
5081
|
-
|
|
5082
|
-
|
|
4940
|
+
return String(array);
|
|
4941
|
+
}
|
|
4942
|
+
if (typeof key === "object" && Object.prototype.toString.call(key) === "[object Object]") return "[object Object]";
|
|
4943
|
+
return String(key);
|
|
4944
|
+
}
|
|
4945
|
+
defineMappingTag("tag:yaml.org,2002:map", {
|
|
4946
|
+
create: () => ({}),
|
|
4947
|
+
identify: isPlainObject$1,
|
|
4948
|
+
represent: (o) => {
|
|
4949
|
+
const map = /* @__PURE__ */ new Map();
|
|
4950
|
+
for (const key of Object.keys(o)) map.set(key, o[key]);
|
|
4951
|
+
return map;
|
|
4952
|
+
},
|
|
4953
|
+
addPair: (container, key, value) => {
|
|
4954
|
+
const normalizedKey = normalizeKey(key);
|
|
4955
|
+
if (normalizedKey === null) return "nested arrays are not supported inside keys";
|
|
4956
|
+
if (normalizedKey === "__proto__") Object.defineProperty(container, normalizedKey, {
|
|
4957
|
+
value,
|
|
5083
4958
|
enumerable: true,
|
|
5084
|
-
|
|
5085
|
-
|
|
4959
|
+
configurable: true,
|
|
4960
|
+
writable: true
|
|
5086
4961
|
});
|
|
5087
|
-
else
|
|
5088
|
-
|
|
5089
|
-
|
|
5090
|
-
|
|
5091
|
-
|
|
5092
|
-
|
|
5093
|
-
|
|
5094
|
-
|
|
5095
|
-
|
|
5096
|
-
|
|
5097
|
-
|
|
5098
|
-
|
|
5099
|
-
|
|
5100
|
-
|
|
5101
|
-
|
|
5102
|
-
|
|
5103
|
-
|
|
5104
|
-
|
|
5105
|
-
|
|
5106
|
-
|
|
5107
|
-
|
|
5108
|
-
|
|
5109
|
-
|
|
5110
|
-
|
|
5111
|
-
|
|
5112
|
-
|
|
5113
|
-
|
|
5114
|
-
|
|
5115
|
-
|
|
5116
|
-
}
|
|
5117
|
-
|
|
5118
|
-
|
|
5119
|
-
|
|
5120
|
-
buffer: state.input.slice(0, -1),
|
|
5121
|
-
position: state.position,
|
|
5122
|
-
line: state.line,
|
|
5123
|
-
column: state.position - state.lineStart
|
|
5124
|
-
};
|
|
5125
|
-
mark.snippet = makeSnippet(mark);
|
|
5126
|
-
return new YAMLException(message, mark);
|
|
5127
|
-
}
|
|
5128
|
-
function throwError(state, message) {
|
|
5129
|
-
throw generateError(state, message);
|
|
5130
|
-
}
|
|
5131
|
-
function throwWarning(state, message) {
|
|
5132
|
-
if (state.onWarning) state.onWarning.call(null, generateError(state, message));
|
|
5133
|
-
}
|
|
5134
|
-
function storeAnchor(state, name, value) {
|
|
5135
|
-
const transactions = state.anchorMapTransactions;
|
|
5136
|
-
if (transactions.length !== 0) {
|
|
5137
|
-
const transaction = transactions[transactions.length - 1];
|
|
5138
|
-
if (!_hasOwnProperty.call(transaction, name)) transaction[name] = {
|
|
5139
|
-
existed: _hasOwnProperty.call(state.anchorMap, name),
|
|
5140
|
-
value: state.anchorMap[name]
|
|
5141
|
-
};
|
|
5142
|
-
}
|
|
5143
|
-
state.anchorMap[name] = value;
|
|
5144
|
-
}
|
|
5145
|
-
function beginAnchorTransaction(state) {
|
|
5146
|
-
state.anchorMapTransactions.push(Object.create(null));
|
|
5147
|
-
}
|
|
5148
|
-
function commitAnchorTransaction(state) {
|
|
5149
|
-
const transaction = state.anchorMapTransactions.pop();
|
|
5150
|
-
const transactions = state.anchorMapTransactions;
|
|
5151
|
-
if (transactions.length === 0) return;
|
|
5152
|
-
const parent = transactions[transactions.length - 1];
|
|
5153
|
-
const names = Object.keys(transaction);
|
|
5154
|
-
for (let index = 0, length = names.length; index < length; index += 1) {
|
|
5155
|
-
const name = names[index];
|
|
5156
|
-
if (!_hasOwnProperty.call(parent, name)) parent[name] = transaction[name];
|
|
5157
|
-
}
|
|
5158
|
-
}
|
|
5159
|
-
function rollbackAnchorTransaction(state) {
|
|
5160
|
-
const transaction = state.anchorMapTransactions.pop();
|
|
5161
|
-
const names = Object.keys(transaction);
|
|
5162
|
-
for (let index = names.length - 1; index >= 0; index -= 1) {
|
|
5163
|
-
const entry = transaction[names[index]];
|
|
5164
|
-
if (entry.existed) state.anchorMap[names[index]] = entry.value;
|
|
5165
|
-
else delete state.anchorMap[names[index]];
|
|
5166
|
-
}
|
|
5167
|
-
}
|
|
5168
|
-
function snapshotState(state) {
|
|
5169
|
-
return {
|
|
5170
|
-
position: state.position,
|
|
5171
|
-
line: state.line,
|
|
5172
|
-
lineStart: state.lineStart,
|
|
5173
|
-
lineIndent: state.lineIndent,
|
|
5174
|
-
firstTabInLine: state.firstTabInLine,
|
|
5175
|
-
tag: state.tag,
|
|
5176
|
-
anchor: state.anchor,
|
|
5177
|
-
kind: state.kind,
|
|
5178
|
-
result: state.result
|
|
5179
|
-
};
|
|
5180
|
-
}
|
|
5181
|
-
function restoreState(state, snapshot) {
|
|
5182
|
-
state.position = snapshot.position;
|
|
5183
|
-
state.line = snapshot.line;
|
|
5184
|
-
state.lineStart = snapshot.lineStart;
|
|
5185
|
-
state.lineIndent = snapshot.lineIndent;
|
|
5186
|
-
state.firstTabInLine = snapshot.firstTabInLine;
|
|
5187
|
-
state.tag = snapshot.tag;
|
|
5188
|
-
state.anchor = snapshot.anchor;
|
|
5189
|
-
state.kind = snapshot.kind;
|
|
5190
|
-
state.result = snapshot.result;
|
|
5191
|
-
}
|
|
5192
|
-
var directiveHandlers = {
|
|
5193
|
-
YAML: function handleYamlDirective(state, name, args) {
|
|
5194
|
-
if (state.version !== null) throwError(state, "duplication of %YAML directive");
|
|
5195
|
-
if (args.length !== 1) throwError(state, "YAML directive accepts exactly one argument");
|
|
5196
|
-
const match = /^([0-9]+)\.([0-9]+)$/.exec(args[0]);
|
|
5197
|
-
if (match === null) throwError(state, "ill-formed argument of the YAML directive");
|
|
5198
|
-
const major = parseInt(match[1], 10);
|
|
5199
|
-
const minor = parseInt(match[2], 10);
|
|
5200
|
-
if (major !== 1) throwError(state, "unacceptable YAML version of the document");
|
|
5201
|
-
state.version = args[0];
|
|
5202
|
-
state.checkLineBreaks = minor < 2;
|
|
5203
|
-
if (minor !== 1 && minor !== 2) throwWarning(state, "unsupported YAML version of the document");
|
|
5204
|
-
},
|
|
5205
|
-
TAG: function handleTagDirective(state, name, args) {
|
|
5206
|
-
let prefix;
|
|
5207
|
-
if (args.length !== 2) throwError(state, "TAG directive accepts exactly two arguments");
|
|
5208
|
-
const handle = args[0];
|
|
5209
|
-
prefix = args[1];
|
|
5210
|
-
if (!PATTERN_TAG_HANDLE.test(handle)) throwError(state, "ill-formed tag handle (first argument) of the TAG directive");
|
|
5211
|
-
if (_hasOwnProperty.call(state.tagMap, handle)) throwError(state, "there is a previously declared suffix for \"" + handle + "\" tag handle");
|
|
5212
|
-
if (!PATTERN_TAG_URI.test(prefix)) throwError(state, "ill-formed tag prefix (second argument) of the TAG directive");
|
|
5213
|
-
try {
|
|
5214
|
-
prefix = decodeURIComponent(prefix);
|
|
5215
|
-
} catch (err) {
|
|
5216
|
-
throwError(state, "tag prefix is malformed: " + prefix);
|
|
5217
|
-
}
|
|
5218
|
-
state.tagMap[handle] = prefix;
|
|
5219
|
-
}
|
|
4962
|
+
else container[normalizedKey] = value;
|
|
4963
|
+
return "";
|
|
4964
|
+
},
|
|
4965
|
+
has: (container, key) => {
|
|
4966
|
+
const normalizedKey = normalizeKey(key);
|
|
4967
|
+
return normalizedKey !== null && Object.prototype.hasOwnProperty.call(container, normalizedKey);
|
|
4968
|
+
},
|
|
4969
|
+
keys: (container) => Object.keys(container),
|
|
4970
|
+
get: (container, key) => container[String(key)]
|
|
4971
|
+
});
|
|
4972
|
+
//#endregion
|
|
4973
|
+
//#region src/common/snippet.ts
|
|
4974
|
+
var DEFAULT_SNIPPET_OPTIONS = {
|
|
4975
|
+
maxLength: 79,
|
|
4976
|
+
indent: 1,
|
|
4977
|
+
linesBefore: 3,
|
|
4978
|
+
linesAfter: 2
|
|
4979
|
+
};
|
|
4980
|
+
function getLine(buffer, lineStart, lineEnd, position, maxLineLength) {
|
|
4981
|
+
let head = "";
|
|
4982
|
+
let tail = "";
|
|
4983
|
+
const maxHalfLength = Math.floor(maxLineLength / 2) - 1;
|
|
4984
|
+
if (position - lineStart > maxHalfLength) {
|
|
4985
|
+
head = " ... ";
|
|
4986
|
+
lineStart = position - maxHalfLength + head.length;
|
|
4987
|
+
}
|
|
4988
|
+
if (lineEnd - position > maxHalfLength) {
|
|
4989
|
+
tail = " ...";
|
|
4990
|
+
lineEnd = position + maxHalfLength - tail.length;
|
|
4991
|
+
}
|
|
4992
|
+
return {
|
|
4993
|
+
str: head + buffer.slice(lineStart, lineEnd).replace(/\t/g, "→") + tail,
|
|
4994
|
+
pos: position - lineStart + head.length
|
|
5220
4995
|
};
|
|
5221
|
-
|
|
5222
|
-
|
|
5223
|
-
|
|
5224
|
-
|
|
5225
|
-
|
|
5226
|
-
|
|
5227
|
-
|
|
5228
|
-
|
|
5229
|
-
|
|
5230
|
-
|
|
5231
|
-
|
|
5232
|
-
|
|
5233
|
-
|
|
5234
|
-
|
|
5235
|
-
|
|
5236
|
-
|
|
5237
|
-
|
|
5238
|
-
|
|
5239
|
-
|
|
5240
|
-
|
|
5241
|
-
|
|
4996
|
+
}
|
|
4997
|
+
function padStart(string, max) {
|
|
4998
|
+
return " ".repeat(Math.max(max - string.length, 0)) + string;
|
|
4999
|
+
}
|
|
5000
|
+
function makeSnippet(mark, options) {
|
|
5001
|
+
if (!mark.buffer) return null;
|
|
5002
|
+
const opts = {
|
|
5003
|
+
...DEFAULT_SNIPPET_OPTIONS,
|
|
5004
|
+
...options
|
|
5005
|
+
};
|
|
5006
|
+
const re = /\r?\n|\r|\0/g;
|
|
5007
|
+
const lineStarts = [0];
|
|
5008
|
+
const lineEnds = [];
|
|
5009
|
+
let match;
|
|
5010
|
+
let foundLineNo = -1;
|
|
5011
|
+
while (match = re.exec(mark.buffer)) {
|
|
5012
|
+
lineEnds.push(match.index);
|
|
5013
|
+
lineStarts.push(match.index + match[0].length);
|
|
5014
|
+
if (mark.position <= match.index && foundLineNo < 0) foundLineNo = lineStarts.length - 2;
|
|
5015
|
+
}
|
|
5016
|
+
if (foundLineNo < 0) foundLineNo = lineStarts.length - 1;
|
|
5017
|
+
let result = "";
|
|
5018
|
+
const lineNoLength = Math.min(mark.line + opts.linesAfter, lineEnds.length).toString().length;
|
|
5019
|
+
const maxLineLength = opts.maxLength - (opts.indent + lineNoLength + 3);
|
|
5020
|
+
for (let i = 1; i <= opts.linesBefore; i++) {
|
|
5021
|
+
if (foundLineNo - i < 0) break;
|
|
5022
|
+
const line = getLine(mark.buffer, lineStarts[foundLineNo - i], lineEnds[foundLineNo - i], mark.position - (lineStarts[foundLineNo] - lineStarts[foundLineNo - i]), maxLineLength);
|
|
5023
|
+
result = `${" ".repeat(opts.indent)}${padStart((mark.line - i + 1).toString(), lineNoLength)} | ${line.str}\n${result}`;
|
|
5024
|
+
}
|
|
5025
|
+
const line = getLine(mark.buffer, lineStarts[foundLineNo], lineEnds[foundLineNo], mark.position, maxLineLength);
|
|
5026
|
+
result += `${" ".repeat(opts.indent)}${padStart((mark.line + 1).toString(), lineNoLength)} | ${line.str}\n`;
|
|
5027
|
+
result += `${"-".repeat(opts.indent + lineNoLength + 3 + line.pos)}^\n`;
|
|
5028
|
+
for (let i = 1; i <= opts.linesAfter; i++) {
|
|
5029
|
+
if (foundLineNo + i >= lineEnds.length) break;
|
|
5030
|
+
const line = getLine(mark.buffer, lineStarts[foundLineNo + i], lineEnds[foundLineNo + i], mark.position - (lineStarts[foundLineNo] - lineStarts[foundLineNo + i]), maxLineLength);
|
|
5031
|
+
result += `${" ".repeat(opts.indent)}${padStart((mark.line + i + 1).toString(), lineNoLength)} | ${line.str}\n`;
|
|
5032
|
+
}
|
|
5033
|
+
return result.replace(/\n$/, "");
|
|
5034
|
+
}
|
|
5035
|
+
//#endregion
|
|
5036
|
+
//#region src/common/exception.ts
|
|
5037
|
+
function formatError(exception, compact) {
|
|
5038
|
+
let where = "";
|
|
5039
|
+
if (!exception.mark) return exception.reason;
|
|
5040
|
+
if (exception.mark.name) where += `in "${exception.mark.name}" `;
|
|
5041
|
+
where += `(${exception.mark.line + 1}:${exception.mark.column + 1})`;
|
|
5042
|
+
if (!compact && exception.mark.snippet) where += `\n\n${exception.mark.snippet}`;
|
|
5043
|
+
return `${exception.reason} ${where}`;
|
|
5044
|
+
}
|
|
5045
|
+
var YAMLException = class extends Error {
|
|
5046
|
+
reason;
|
|
5047
|
+
mark;
|
|
5048
|
+
constructor(reason, mark) {
|
|
5049
|
+
super();
|
|
5050
|
+
this.name = "YAMLException";
|
|
5051
|
+
this.reason = reason;
|
|
5052
|
+
this.mark = mark;
|
|
5053
|
+
this.message = formatError(this, false);
|
|
5054
|
+
if (Error.captureStackTrace) Error.captureStackTrace(this, this.constructor);
|
|
5242
5055
|
}
|
|
5243
|
-
|
|
5244
|
-
|
|
5245
|
-
keyNode = Array.prototype.slice.call(keyNode);
|
|
5246
|
-
for (let index = 0, quantity = keyNode.length; index < quantity; index += 1) {
|
|
5247
|
-
if (Array.isArray(keyNode[index])) throwError(state, "nested arrays are not supported inside keys");
|
|
5248
|
-
if (typeof keyNode === "object" && _class(keyNode[index]) === "[object Object]") keyNode[index] = "[object Object]";
|
|
5249
|
-
}
|
|
5250
|
-
}
|
|
5251
|
-
if (typeof keyNode === "object" && _class(keyNode) === "[object Object]") keyNode = "[object Object]";
|
|
5252
|
-
keyNode = String(keyNode);
|
|
5253
|
-
if (_result === null) _result = {};
|
|
5254
|
-
if (keyTag === "tag:yaml.org,2002:merge") if (Array.isArray(valueNode)) {
|
|
5255
|
-
if (valueNode.length > state.maxMergeSeqLength) throwError(state, "merge sequence length exceeded maxMergeSeqLength (" + state.maxMergeSeqLength + ")");
|
|
5256
|
-
const seen = /* @__PURE__ */ new Set();
|
|
5257
|
-
for (let index = 0, quantity = valueNode.length; index < quantity; index += 1) {
|
|
5258
|
-
const src = valueNode[index];
|
|
5259
|
-
if (seen.has(src)) continue;
|
|
5260
|
-
seen.add(src);
|
|
5261
|
-
mergeMappings(state, _result, src, overridableKeys);
|
|
5262
|
-
}
|
|
5263
|
-
} else mergeMappings(state, _result, valueNode, overridableKeys);
|
|
5264
|
-
else {
|
|
5265
|
-
if (!state.json && !_hasOwnProperty.call(overridableKeys, keyNode) && _hasOwnProperty.call(_result, keyNode)) {
|
|
5266
|
-
state.line = startLine || state.line;
|
|
5267
|
-
state.lineStart = startLineStart || state.lineStart;
|
|
5268
|
-
state.position = startPos || state.position;
|
|
5269
|
-
throwError(state, "duplicated mapping key");
|
|
5270
|
-
}
|
|
5271
|
-
setProperty(_result, keyNode, valueNode);
|
|
5272
|
-
delete overridableKeys[keyNode];
|
|
5273
|
-
}
|
|
5274
|
-
return _result;
|
|
5056
|
+
toString(compact) {
|
|
5057
|
+
return `${this.name}: ${formatError(this, compact)}`;
|
|
5275
5058
|
}
|
|
5276
|
-
|
|
5277
|
-
|
|
5278
|
-
|
|
5279
|
-
|
|
5280
|
-
|
|
5281
|
-
|
|
5282
|
-
|
|
5283
|
-
|
|
5284
|
-
|
|
5285
|
-
|
|
5286
|
-
|
|
5287
|
-
|
|
5288
|
-
|
|
5289
|
-
let ch = state.input.charCodeAt(state.position);
|
|
5290
|
-
while (ch !== 0) {
|
|
5291
|
-
while (isWhiteSpace(ch)) {
|
|
5292
|
-
if (ch === 9 && state.firstTabInLine === -1) state.firstTabInLine = state.position;
|
|
5293
|
-
ch = state.input.charCodeAt(++state.position);
|
|
5294
|
-
}
|
|
5295
|
-
if (allowComments && ch === 35) do
|
|
5296
|
-
ch = state.input.charCodeAt(++state.position);
|
|
5297
|
-
while (ch !== 10 && ch !== 13 && ch !== 0);
|
|
5298
|
-
if (isEol(ch)) {
|
|
5299
|
-
readLineBreak(state);
|
|
5300
|
-
ch = state.input.charCodeAt(state.position);
|
|
5301
|
-
lineBreaks++;
|
|
5302
|
-
state.lineIndent = 0;
|
|
5303
|
-
while (ch === 32) {
|
|
5304
|
-
state.lineIndent++;
|
|
5305
|
-
ch = state.input.charCodeAt(++state.position);
|
|
5306
|
-
}
|
|
5307
|
-
} else break;
|
|
5308
|
-
}
|
|
5309
|
-
if (checkIndent !== -1 && lineBreaks !== 0 && state.lineIndent < checkIndent) throwWarning(state, "deficient indentation");
|
|
5310
|
-
return lineBreaks;
|
|
5311
|
-
}
|
|
5312
|
-
function testDocumentSeparator(state) {
|
|
5313
|
-
let _position = state.position;
|
|
5314
|
-
let ch = state.input.charCodeAt(_position);
|
|
5315
|
-
if ((ch === 45 || ch === 46) && ch === state.input.charCodeAt(_position + 1) && ch === state.input.charCodeAt(_position + 2)) {
|
|
5316
|
-
_position += 3;
|
|
5317
|
-
ch = state.input.charCodeAt(_position);
|
|
5318
|
-
if (ch === 0 || isWsOrEol(ch)) return true;
|
|
5059
|
+
};
|
|
5060
|
+
function throwErrorAt(source, position, message, filename = "") {
|
|
5061
|
+
let line = 0;
|
|
5062
|
+
let lineStart = 0;
|
|
5063
|
+
for (let index = 0; index < position; index++) {
|
|
5064
|
+
const ch = source.charCodeAt(index);
|
|
5065
|
+
if (ch === 10) {
|
|
5066
|
+
line++;
|
|
5067
|
+
lineStart = index + 1;
|
|
5068
|
+
} else if (ch === 13) {
|
|
5069
|
+
line++;
|
|
5070
|
+
if (source.charCodeAt(index + 1) === 10) index++;
|
|
5071
|
+
lineStart = index + 1;
|
|
5319
5072
|
}
|
|
5320
|
-
return false;
|
|
5321
5073
|
}
|
|
5322
|
-
|
|
5323
|
-
|
|
5324
|
-
|
|
5325
|
-
|
|
5326
|
-
|
|
5327
|
-
|
|
5328
|
-
|
|
5329
|
-
|
|
5330
|
-
|
|
5331
|
-
|
|
5332
|
-
|
|
5333
|
-
|
|
5334
|
-
|
|
5335
|
-
|
|
5336
|
-
|
|
5337
|
-
|
|
5338
|
-
|
|
5339
|
-
|
|
5340
|
-
|
|
5341
|
-
|
|
5342
|
-
|
|
5343
|
-
|
|
5344
|
-
|
|
5345
|
-
|
|
5346
|
-
|
|
5347
|
-
|
|
5348
|
-
|
|
5349
|
-
|
|
5350
|
-
|
|
5351
|
-
|
|
5352
|
-
|
|
5353
|
-
|
|
5354
|
-
|
|
5355
|
-
|
|
5356
|
-
|
|
5357
|
-
|
|
5358
|
-
|
|
5359
|
-
|
|
5360
|
-
|
|
5361
|
-
|
|
5362
|
-
|
|
5363
|
-
|
|
5364
|
-
|
|
5365
|
-
|
|
5366
|
-
|
|
5367
|
-
|
|
5368
|
-
|
|
5369
|
-
|
|
5370
|
-
|
|
5371
|
-
|
|
5372
|
-
|
|
5373
|
-
|
|
5374
|
-
|
|
5375
|
-
|
|
5376
|
-
|
|
5074
|
+
const mark = {
|
|
5075
|
+
name: filename,
|
|
5076
|
+
buffer: source,
|
|
5077
|
+
position,
|
|
5078
|
+
line,
|
|
5079
|
+
column: position - lineStart
|
|
5080
|
+
};
|
|
5081
|
+
mark.snippet = makeSnippet(mark);
|
|
5082
|
+
throw new YAMLException(message, mark);
|
|
5083
|
+
}
|
|
5084
|
+
//#endregion
|
|
5085
|
+
//#region src/parser/parser_scalar.ts
|
|
5086
|
+
var NO_RANGE$3 = -1;
|
|
5087
|
+
function simpleEscapeSequence(c) {
|
|
5088
|
+
switch (c) {
|
|
5089
|
+
case 48: return "\0";
|
|
5090
|
+
case 97: return "\x07";
|
|
5091
|
+
case 98: return "\b";
|
|
5092
|
+
case 116: return " ";
|
|
5093
|
+
case 9: return " ";
|
|
5094
|
+
case 110: return "\n";
|
|
5095
|
+
case 118: return "\v";
|
|
5096
|
+
case 102: return "\f";
|
|
5097
|
+
case 114: return "\r";
|
|
5098
|
+
case 101: return "\x1B";
|
|
5099
|
+
case 32: return " ";
|
|
5100
|
+
case 34: return "\"";
|
|
5101
|
+
case 47: return "/";
|
|
5102
|
+
case 92: return "\\";
|
|
5103
|
+
case 78: return "
";
|
|
5104
|
+
case 95: return "\xA0";
|
|
5105
|
+
case 76: return "\u2028";
|
|
5106
|
+
case 80: return "\u2029";
|
|
5107
|
+
default: return "";
|
|
5108
|
+
}
|
|
5109
|
+
}
|
|
5110
|
+
var simpleEscapeCheck = new Array(256);
|
|
5111
|
+
var simpleEscapeMap = new Array(256);
|
|
5112
|
+
for (let i = 0; i < 256; i++) {
|
|
5113
|
+
simpleEscapeCheck[i] = simpleEscapeSequence(i) ? 1 : 0;
|
|
5114
|
+
simpleEscapeMap[i] = simpleEscapeSequence(i);
|
|
5115
|
+
}
|
|
5116
|
+
function charFromCodepoint(c) {
|
|
5117
|
+
if (c <= 65535) return String.fromCharCode(c);
|
|
5118
|
+
return String.fromCharCode((c - 65536 >> 10) + 55296, (c - 65536 & 1023) + 56320);
|
|
5119
|
+
}
|
|
5120
|
+
function fromHexCode$1(c) {
|
|
5121
|
+
if (c >= 48 && c <= 57) return c - 48;
|
|
5122
|
+
return (c | 32) - 97 + 10;
|
|
5123
|
+
}
|
|
5124
|
+
function escapedHexLen$1(c) {
|
|
5125
|
+
if (c === 120) return 2;
|
|
5126
|
+
if (c === 117) return 4;
|
|
5127
|
+
return 8;
|
|
5128
|
+
}
|
|
5129
|
+
function skipFoldedBreaks(input, position, end) {
|
|
5130
|
+
let breaks = 0;
|
|
5131
|
+
while (position < end) {
|
|
5132
|
+
const ch = input.charCodeAt(position);
|
|
5133
|
+
if (ch === 10) {
|
|
5134
|
+
breaks++;
|
|
5135
|
+
position++;
|
|
5136
|
+
} else if (ch === 13) {
|
|
5137
|
+
breaks++;
|
|
5138
|
+
position++;
|
|
5139
|
+
if (input.charCodeAt(position) === 10) position++;
|
|
5140
|
+
} else if (ch === 32 || ch === 9) position++;
|
|
5141
|
+
else break;
|
|
5142
|
+
}
|
|
5143
|
+
return {
|
|
5144
|
+
position,
|
|
5145
|
+
breaks
|
|
5146
|
+
};
|
|
5147
|
+
}
|
|
5148
|
+
function foldedBreaks(count) {
|
|
5149
|
+
if (count === 1) return " ";
|
|
5150
|
+
return "\n".repeat(count - 1);
|
|
5151
|
+
}
|
|
5152
|
+
function getPlainValue(input, start, end) {
|
|
5153
|
+
let result = "";
|
|
5154
|
+
let position = start;
|
|
5155
|
+
let captureStart = start;
|
|
5156
|
+
let captureEnd = start;
|
|
5157
|
+
while (position < end) {
|
|
5158
|
+
const ch = input.charCodeAt(position);
|
|
5159
|
+
if (ch === 10 || ch === 13) {
|
|
5160
|
+
result += input.slice(captureStart, captureEnd);
|
|
5161
|
+
const fold = skipFoldedBreaks(input, position, end);
|
|
5162
|
+
result += foldedBreaks(fold.breaks);
|
|
5163
|
+
position = captureStart = captureEnd = fold.position;
|
|
5164
|
+
} else {
|
|
5165
|
+
position++;
|
|
5166
|
+
if (ch !== 32 && ch !== 9) captureEnd = position;
|
|
5377
5167
|
}
|
|
5378
|
-
captureSegment(state, captureStart, captureEnd, false);
|
|
5379
|
-
if (state.result) return true;
|
|
5380
|
-
state.kind = _kind;
|
|
5381
|
-
state.result = _result;
|
|
5382
|
-
return false;
|
|
5383
5168
|
}
|
|
5384
|
-
|
|
5385
|
-
|
|
5386
|
-
|
|
5387
|
-
|
|
5388
|
-
|
|
5389
|
-
|
|
5390
|
-
|
|
5391
|
-
|
|
5392
|
-
|
|
5393
|
-
|
|
5394
|
-
|
|
5395
|
-
|
|
5396
|
-
|
|
5397
|
-
|
|
5398
|
-
|
|
5399
|
-
|
|
5400
|
-
|
|
5401
|
-
|
|
5402
|
-
|
|
5403
|
-
|
|
5404
|
-
|
|
5405
|
-
} else if (state.position === state.lineStart && testDocumentSeparator(state)) throwError(state, "unexpected end of the document within a single quoted scalar");
|
|
5406
|
-
else {
|
|
5407
|
-
state.position++;
|
|
5408
|
-
if (!isWhiteSpace(ch)) captureEnd = state.position;
|
|
5169
|
+
return result + input.slice(captureStart, captureEnd);
|
|
5170
|
+
}
|
|
5171
|
+
function getSingleQuotedValue(input, start, end) {
|
|
5172
|
+
let result = "";
|
|
5173
|
+
let position = start;
|
|
5174
|
+
let captureStart = start;
|
|
5175
|
+
let captureEnd = start;
|
|
5176
|
+
while (position < end) {
|
|
5177
|
+
const ch = input.charCodeAt(position);
|
|
5178
|
+
if (ch === 39) {
|
|
5179
|
+
result += input.slice(captureStart, position) + "'";
|
|
5180
|
+
position += 2;
|
|
5181
|
+
captureStart = captureEnd = position;
|
|
5182
|
+
} else if (ch === 10 || ch === 13) {
|
|
5183
|
+
result += input.slice(captureStart, captureEnd);
|
|
5184
|
+
const fold = skipFoldedBreaks(input, position, end);
|
|
5185
|
+
result += foldedBreaks(fold.breaks);
|
|
5186
|
+
position = captureStart = captureEnd = fold.position;
|
|
5187
|
+
} else {
|
|
5188
|
+
position++;
|
|
5189
|
+
if (ch !== 32 && ch !== 9) captureEnd = position;
|
|
5409
5190
|
}
|
|
5410
|
-
throwError(state, "unexpected end of the stream within a single quoted scalar");
|
|
5411
5191
|
}
|
|
5412
|
-
|
|
5413
|
-
|
|
5414
|
-
|
|
5415
|
-
|
|
5416
|
-
|
|
5417
|
-
|
|
5418
|
-
|
|
5419
|
-
|
|
5420
|
-
|
|
5421
|
-
|
|
5422
|
-
|
|
5423
|
-
|
|
5424
|
-
|
|
5425
|
-
|
|
5426
|
-
|
|
5427
|
-
|
|
5428
|
-
|
|
5429
|
-
|
|
5430
|
-
|
|
5431
|
-
state.result += simpleEscapeMap[ch];
|
|
5432
|
-
state.position++;
|
|
5433
|
-
} else if ((tmp = escapedHexLen(ch)) > 0) {
|
|
5434
|
-
let hexLength = tmp;
|
|
5192
|
+
return result + input.slice(captureStart, end);
|
|
5193
|
+
}
|
|
5194
|
+
function getDoubleQuotedValue(input, start, end) {
|
|
5195
|
+
let result = "";
|
|
5196
|
+
let position = start;
|
|
5197
|
+
let captureStart = start;
|
|
5198
|
+
let captureEnd = start;
|
|
5199
|
+
while (position < end) {
|
|
5200
|
+
const ch = input.charCodeAt(position);
|
|
5201
|
+
if (ch === 92) {
|
|
5202
|
+
result += input.slice(captureStart, position);
|
|
5203
|
+
position++;
|
|
5204
|
+
const escaped = input.charCodeAt(position);
|
|
5205
|
+
if (escaped === 10 || escaped === 13) position = skipFoldedBreaks(input, position, end).position;
|
|
5206
|
+
else if (escaped < 256 && simpleEscapeCheck[escaped]) {
|
|
5207
|
+
result += simpleEscapeMap[escaped];
|
|
5208
|
+
position++;
|
|
5209
|
+
} else {
|
|
5210
|
+
let hexLength = escapedHexLen$1(escaped);
|
|
5435
5211
|
let hexResult = 0;
|
|
5436
5212
|
for (; hexLength > 0; hexLength--) {
|
|
5437
|
-
|
|
5438
|
-
|
|
5439
|
-
|
|
5440
|
-
}
|
|
5441
|
-
state.result += charFromCodepoint(hexResult);
|
|
5442
|
-
state.position++;
|
|
5443
|
-
} else throwError(state, "unknown escape sequence");
|
|
5444
|
-
captureStart = captureEnd = state.position;
|
|
5445
|
-
} else if (isEol(ch)) {
|
|
5446
|
-
captureSegment(state, captureStart, captureEnd, true);
|
|
5447
|
-
writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent));
|
|
5448
|
-
captureStart = captureEnd = state.position;
|
|
5449
|
-
} else if (state.position === state.lineStart && testDocumentSeparator(state)) throwError(state, "unexpected end of the document within a double quoted scalar");
|
|
5450
|
-
else {
|
|
5451
|
-
state.position++;
|
|
5452
|
-
if (!isWhiteSpace(ch)) captureEnd = state.position;
|
|
5453
|
-
}
|
|
5454
|
-
throwError(state, "unexpected end of the stream within a double quoted scalar");
|
|
5455
|
-
}
|
|
5456
|
-
function readFlowCollection(state, nodeIndent) {
|
|
5457
|
-
let readNext = true;
|
|
5458
|
-
let _line;
|
|
5459
|
-
let _lineStart;
|
|
5460
|
-
let _pos;
|
|
5461
|
-
const _tag = state.tag;
|
|
5462
|
-
let _result;
|
|
5463
|
-
const _anchor = state.anchor;
|
|
5464
|
-
let terminator;
|
|
5465
|
-
let isPair;
|
|
5466
|
-
let isExplicitPair;
|
|
5467
|
-
let isMapping;
|
|
5468
|
-
const overridableKeys = Object.create(null);
|
|
5469
|
-
let keyNode;
|
|
5470
|
-
let keyTag;
|
|
5471
|
-
let valueNode;
|
|
5472
|
-
let ch = state.input.charCodeAt(state.position);
|
|
5473
|
-
if (ch === 91) {
|
|
5474
|
-
terminator = 93;
|
|
5475
|
-
isMapping = false;
|
|
5476
|
-
_result = [];
|
|
5477
|
-
} else if (ch === 123) {
|
|
5478
|
-
terminator = 125;
|
|
5479
|
-
isMapping = true;
|
|
5480
|
-
_result = {};
|
|
5481
|
-
} else return false;
|
|
5482
|
-
if (state.anchor !== null) storeAnchor(state, state.anchor, _result);
|
|
5483
|
-
ch = state.input.charCodeAt(++state.position);
|
|
5484
|
-
while (ch !== 0) {
|
|
5485
|
-
skipSeparationSpace(state, true, nodeIndent);
|
|
5486
|
-
ch = state.input.charCodeAt(state.position);
|
|
5487
|
-
if (ch === terminator) {
|
|
5488
|
-
state.position++;
|
|
5489
|
-
state.tag = _tag;
|
|
5490
|
-
state.anchor = _anchor;
|
|
5491
|
-
state.kind = isMapping ? "mapping" : "sequence";
|
|
5492
|
-
state.result = _result;
|
|
5493
|
-
return true;
|
|
5494
|
-
} else if (!readNext) throwError(state, "missed comma between flow collection entries");
|
|
5495
|
-
else if (ch === 44) throwError(state, "expected the node content, but found ','");
|
|
5496
|
-
keyTag = keyNode = valueNode = null;
|
|
5497
|
-
isPair = isExplicitPair = false;
|
|
5498
|
-
if (ch === 63) {
|
|
5499
|
-
if (isWsOrEol(state.input.charCodeAt(state.position + 1))) {
|
|
5500
|
-
isPair = isExplicitPair = true;
|
|
5501
|
-
state.position++;
|
|
5502
|
-
skipSeparationSpace(state, true, nodeIndent);
|
|
5213
|
+
position++;
|
|
5214
|
+
const digit = fromHexCode$1(input.charCodeAt(position));
|
|
5215
|
+
hexResult = (hexResult << 4) + digit;
|
|
5503
5216
|
}
|
|
5217
|
+
result += charFromCodepoint(hexResult);
|
|
5218
|
+
position++;
|
|
5504
5219
|
}
|
|
5505
|
-
|
|
5506
|
-
|
|
5507
|
-
|
|
5508
|
-
|
|
5509
|
-
|
|
5510
|
-
|
|
5511
|
-
|
|
5512
|
-
|
|
5513
|
-
if (
|
|
5514
|
-
isPair = true;
|
|
5515
|
-
ch = state.input.charCodeAt(++state.position);
|
|
5516
|
-
skipSeparationSpace(state, true, nodeIndent);
|
|
5517
|
-
composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true);
|
|
5518
|
-
valueNode = state.result;
|
|
5519
|
-
}
|
|
5520
|
-
if (isMapping) storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, _line, _lineStart, _pos);
|
|
5521
|
-
else if (isPair) _result.push(storeMappingPair(state, null, overridableKeys, keyTag, keyNode, valueNode, _line, _lineStart, _pos));
|
|
5522
|
-
else _result.push(keyNode);
|
|
5523
|
-
skipSeparationSpace(state, true, nodeIndent);
|
|
5524
|
-
ch = state.input.charCodeAt(state.position);
|
|
5525
|
-
if (ch === 44) {
|
|
5526
|
-
readNext = true;
|
|
5527
|
-
ch = state.input.charCodeAt(++state.position);
|
|
5528
|
-
} else readNext = false;
|
|
5529
|
-
}
|
|
5530
|
-
throwError(state, "unexpected end of the stream within a flow collection");
|
|
5531
|
-
}
|
|
5532
|
-
function readBlockScalar(state, nodeIndent) {
|
|
5533
|
-
let folding;
|
|
5534
|
-
let chomping = CHOMPING_CLIP;
|
|
5535
|
-
let didReadContent = false;
|
|
5536
|
-
let detectedIndent = false;
|
|
5537
|
-
let textIndent = nodeIndent;
|
|
5538
|
-
let emptyLines = 0;
|
|
5539
|
-
let atMoreIndented = false;
|
|
5540
|
-
let tmp;
|
|
5541
|
-
let ch = state.input.charCodeAt(state.position);
|
|
5542
|
-
if (ch === 124) folding = false;
|
|
5543
|
-
else if (ch === 62) folding = true;
|
|
5544
|
-
else return false;
|
|
5545
|
-
state.kind = "scalar";
|
|
5546
|
-
state.result = "";
|
|
5547
|
-
while (ch !== 0) {
|
|
5548
|
-
ch = state.input.charCodeAt(++state.position);
|
|
5549
|
-
if (ch === 43 || ch === 45) if (CHOMPING_CLIP === chomping) chomping = ch === 43 ? CHOMPING_KEEP : CHOMPING_STRIP;
|
|
5550
|
-
else throwError(state, "repeat of a chomping mode identifier");
|
|
5551
|
-
else if ((tmp = fromDecimalCode(ch)) >= 0) if (tmp === 0) throwError(state, "bad explicit indentation width of a block scalar; it cannot be less than one");
|
|
5552
|
-
else if (!detectedIndent) {
|
|
5553
|
-
textIndent = nodeIndent + tmp - 1;
|
|
5554
|
-
detectedIndent = true;
|
|
5555
|
-
} else throwError(state, "repeat of an indentation width identifier");
|
|
5556
|
-
else break;
|
|
5557
|
-
}
|
|
5558
|
-
if (isWhiteSpace(ch)) {
|
|
5559
|
-
do
|
|
5560
|
-
ch = state.input.charCodeAt(++state.position);
|
|
5561
|
-
while (isWhiteSpace(ch));
|
|
5562
|
-
if (ch === 35) do
|
|
5563
|
-
ch = state.input.charCodeAt(++state.position);
|
|
5564
|
-
while (!isEol(ch) && ch !== 0);
|
|
5220
|
+
captureStart = captureEnd = position;
|
|
5221
|
+
} else if (ch === 10 || ch === 13) {
|
|
5222
|
+
result += input.slice(captureStart, captureEnd);
|
|
5223
|
+
const fold = skipFoldedBreaks(input, position, end);
|
|
5224
|
+
result += foldedBreaks(fold.breaks);
|
|
5225
|
+
position = captureStart = captureEnd = fold.position;
|
|
5226
|
+
} else {
|
|
5227
|
+
position++;
|
|
5228
|
+
if (ch !== 32 && ch !== 9) captureEnd = position;
|
|
5565
5229
|
}
|
|
5566
|
-
|
|
5567
|
-
|
|
5568
|
-
|
|
5569
|
-
|
|
5570
|
-
|
|
5571
|
-
|
|
5572
|
-
|
|
5573
|
-
|
|
5574
|
-
|
|
5575
|
-
|
|
5576
|
-
|
|
5577
|
-
|
|
5578
|
-
|
|
5579
|
-
|
|
5580
|
-
|
|
5581
|
-
|
|
5582
|
-
|
|
5583
|
-
if (didReadContent) state.result += "\n";
|
|
5584
|
-
}
|
|
5585
|
-
break;
|
|
5586
|
-
}
|
|
5587
|
-
if (folding) if (isWhiteSpace(ch)) {
|
|
5588
|
-
atMoreIndented = true;
|
|
5589
|
-
state.result += common.repeat("\n", didReadContent ? 1 + emptyLines : emptyLines);
|
|
5590
|
-
} else if (atMoreIndented) {
|
|
5591
|
-
atMoreIndented = false;
|
|
5592
|
-
state.result += common.repeat("\n", emptyLines + 1);
|
|
5593
|
-
} else if (emptyLines === 0) {
|
|
5594
|
-
if (didReadContent) state.result += " ";
|
|
5595
|
-
} else state.result += common.repeat("\n", emptyLines);
|
|
5596
|
-
else state.result += common.repeat("\n", didReadContent ? 1 + emptyLines : emptyLines);
|
|
5597
|
-
didReadContent = true;
|
|
5598
|
-
detectedIndent = true;
|
|
5599
|
-
emptyLines = 0;
|
|
5600
|
-
const captureStart = state.position;
|
|
5601
|
-
while (!isEol(ch) && ch !== 0) ch = state.input.charCodeAt(++state.position);
|
|
5602
|
-
captureSegment(state, captureStart, state.position, false);
|
|
5230
|
+
}
|
|
5231
|
+
return result + input.slice(captureStart, end);
|
|
5232
|
+
}
|
|
5233
|
+
function getBlockValue(input, start, end, indent, chomping, folded) {
|
|
5234
|
+
const textIndent = indent < 0 ? 0 : indent;
|
|
5235
|
+
const region = input.slice(start, end).replace(/\r\n?/g, "\n");
|
|
5236
|
+
const lines = region === "" ? [] : (region.endsWith("\n") ? region.slice(0, -1) : region).split("\n");
|
|
5237
|
+
let result = "";
|
|
5238
|
+
let didReadContent = false;
|
|
5239
|
+
let emptyLines = 0;
|
|
5240
|
+
let atMoreIndented = false;
|
|
5241
|
+
for (const line of lines) {
|
|
5242
|
+
let column = 0;
|
|
5243
|
+
while (column < textIndent && line.charCodeAt(column) === 32) column++;
|
|
5244
|
+
if (indent < 0 || column >= line.length) {
|
|
5245
|
+
emptyLines++;
|
|
5246
|
+
continue;
|
|
5603
5247
|
}
|
|
5604
|
-
|
|
5248
|
+
const content = line.slice(textIndent);
|
|
5249
|
+
const first = content.charCodeAt(0);
|
|
5250
|
+
if (folded) if (first === 32 || first === 9) {
|
|
5251
|
+
atMoreIndented = true;
|
|
5252
|
+
result += "\n".repeat(didReadContent ? 1 + emptyLines : emptyLines);
|
|
5253
|
+
} else if (atMoreIndented) {
|
|
5254
|
+
atMoreIndented = false;
|
|
5255
|
+
result += "\n".repeat(emptyLines + 1);
|
|
5256
|
+
} else if (emptyLines === 0) {
|
|
5257
|
+
if (didReadContent) result += " ";
|
|
5258
|
+
} else result += "\n".repeat(emptyLines);
|
|
5259
|
+
else result += "\n".repeat(didReadContent ? 1 + emptyLines : emptyLines);
|
|
5260
|
+
result += content;
|
|
5261
|
+
didReadContent = true;
|
|
5262
|
+
emptyLines = 0;
|
|
5263
|
+
}
|
|
5264
|
+
if (chomping === 3) result += "\n".repeat(didReadContent ? 1 + emptyLines : emptyLines);
|
|
5265
|
+
else if (chomping !== 2) {
|
|
5266
|
+
if (didReadContent) result += "\n";
|
|
5267
|
+
}
|
|
5268
|
+
return result;
|
|
5269
|
+
}
|
|
5270
|
+
function getScalarValue(input, scalar) {
|
|
5271
|
+
if (scalar.valueStart === NO_RANGE$3) return "";
|
|
5272
|
+
const { valueStart, valueEnd } = scalar;
|
|
5273
|
+
if (scalar.fast) return input.slice(valueStart, valueEnd);
|
|
5274
|
+
switch (scalar.style) {
|
|
5275
|
+
case 2: return getSingleQuotedValue(input, valueStart, valueEnd);
|
|
5276
|
+
case 3: return getDoubleQuotedValue(input, valueStart, valueEnd);
|
|
5277
|
+
case 4: return getBlockValue(input, valueStart, valueEnd, scalar.indent, scalar.chomping, false);
|
|
5278
|
+
case 5: return getBlockValue(input, valueStart, valueEnd, scalar.indent, scalar.chomping, true);
|
|
5279
|
+
default: return getPlainValue(input, valueStart, valueEnd);
|
|
5605
5280
|
}
|
|
5606
|
-
|
|
5607
|
-
|
|
5608
|
-
|
|
5609
|
-
|
|
5610
|
-
|
|
5611
|
-
|
|
5612
|
-
|
|
5613
|
-
|
|
5614
|
-
|
|
5615
|
-
|
|
5616
|
-
|
|
5617
|
-
|
|
5618
|
-
|
|
5619
|
-
|
|
5620
|
-
|
|
5621
|
-
|
|
5622
|
-
|
|
5623
|
-
|
|
5624
|
-
|
|
5625
|
-
|
|
5626
|
-
|
|
5627
|
-
|
|
5628
|
-
|
|
5629
|
-
|
|
5630
|
-
|
|
5631
|
-
|
|
5632
|
-
|
|
5633
|
-
|
|
5634
|
-
|
|
5635
|
-
|
|
5636
|
-
|
|
5281
|
+
}
|
|
5282
|
+
//#endregion
|
|
5283
|
+
//#region src/common/tagname.ts
|
|
5284
|
+
var DEFAULT_TAG_HANDLERS = {
|
|
5285
|
+
"!": "!",
|
|
5286
|
+
"!!": "tag:yaml.org,2002:"
|
|
5287
|
+
};
|
|
5288
|
+
function tagNameFull(rawTag, tagHandlers) {
|
|
5289
|
+
if (rawTag.startsWith("!<") && rawTag.endsWith(">")) return decodeURIComponent(rawTag.slice(2, -1));
|
|
5290
|
+
const handleEnd = rawTag.indexOf("!", 1);
|
|
5291
|
+
const handle = handleEnd === -1 ? "!" : rawTag.slice(0, handleEnd + 1);
|
|
5292
|
+
const prefix = tagHandlers?.[handle] ?? DEFAULT_TAG_HANDLERS[handle] ?? handle;
|
|
5293
|
+
return decodeURIComponent(prefix) + decodeURIComponent(rawTag.slice(handle.length));
|
|
5294
|
+
}
|
|
5295
|
+
//#endregion
|
|
5296
|
+
//#region src/parser/constructor.ts
|
|
5297
|
+
var NO_RANGE$2 = -1;
|
|
5298
|
+
var DEFAULT_CONSTRUCTOR_OPTIONS = {
|
|
5299
|
+
filename: "",
|
|
5300
|
+
schema: CORE_SCHEMA,
|
|
5301
|
+
json: false,
|
|
5302
|
+
maxTotalMergeKeys: 1e4,
|
|
5303
|
+
maxAliases: -1
|
|
5304
|
+
};
|
|
5305
|
+
function eventPosition$1(event) {
|
|
5306
|
+
if ("tagStart" in event && event.tagStart !== NO_RANGE$2) return event.tagStart;
|
|
5307
|
+
if ("anchorStart" in event && event.anchorStart !== NO_RANGE$2) return event.anchorStart;
|
|
5308
|
+
if ("valueStart" in event && event.valueStart !== NO_RANGE$2) return event.valueStart;
|
|
5309
|
+
if ("start" in event) return event.start;
|
|
5310
|
+
return 0;
|
|
5311
|
+
}
|
|
5312
|
+
function throwError$1(state, message) {
|
|
5313
|
+
throwErrorAt(state.source, state.position, message, state.filename);
|
|
5314
|
+
}
|
|
5315
|
+
function finalizeCollection(state, position, tag, carrier) {
|
|
5316
|
+
try {
|
|
5317
|
+
return tag.finalize(carrier);
|
|
5318
|
+
} catch (error) {
|
|
5319
|
+
if (error instanceof YAMLException) throw error;
|
|
5320
|
+
throwErrorAt(state.source, position, error instanceof Error ? error.message : String(error), state.filename);
|
|
5321
|
+
}
|
|
5322
|
+
}
|
|
5323
|
+
function lookupTag(exact, prefix, tagName) {
|
|
5324
|
+
const exactTag = exact[tagName];
|
|
5325
|
+
if (exactTag) return exactTag;
|
|
5326
|
+
for (const tag of prefix) if (tagName.startsWith(tag.tagName)) return tag;
|
|
5327
|
+
}
|
|
5328
|
+
function findExplicitTag(state, exact, prefix, tagName, nodeKind) {
|
|
5329
|
+
const tag = lookupTag(exact, prefix, tagName);
|
|
5330
|
+
if (tag) return tag;
|
|
5331
|
+
throwError$1(state, `unknown ${nodeKind} tag !<${tagName}>`);
|
|
5332
|
+
}
|
|
5333
|
+
function constructScalar(state, event) {
|
|
5334
|
+
const source = getScalarValue(state.source, event);
|
|
5335
|
+
const rawTag = event.tagStart === NO_RANGE$2 ? "" : state.source.slice(event.tagStart, event.tagEnd);
|
|
5336
|
+
const strTag = state.schema.defaultScalarTag;
|
|
5337
|
+
if (rawTag !== "") {
|
|
5338
|
+
if (rawTag === "!") return {
|
|
5339
|
+
value: source,
|
|
5340
|
+
tag: strTag
|
|
5341
|
+
};
|
|
5342
|
+
const tagName = tagNameFull(rawTag, state.tagHandlers);
|
|
5343
|
+
const scalarTag = lookupTag(state.schema.exact.scalar, state.schema.prefix.scalar, tagName);
|
|
5344
|
+
if (scalarTag) {
|
|
5345
|
+
const result = scalarTag.resolve(source, true, tagName);
|
|
5346
|
+
if (result === NOT_RESOLVED) throwError$1(state, `cannot resolve a node with !<${tagName}> explicit tag`);
|
|
5347
|
+
return {
|
|
5348
|
+
value: result,
|
|
5349
|
+
tag: scalarTag
|
|
5350
|
+
};
|
|
5637
5351
|
}
|
|
5638
|
-
|
|
5639
|
-
|
|
5640
|
-
state
|
|
5641
|
-
|
|
5642
|
-
|
|
5643
|
-
|
|
5352
|
+
const collectionTagDef = lookupTag(state.schema.exact.mapping, state.schema.prefix.mapping, tagName) ?? lookupTag(state.schema.exact.sequence, state.schema.prefix.sequence, tagName);
|
|
5353
|
+
if (collectionTagDef) {
|
|
5354
|
+
if (source !== "") throwError$1(state, `cannot resolve a node with !<${tagName}> explicit tag`);
|
|
5355
|
+
const carrier = collectionTagDef.create(tagName);
|
|
5356
|
+
return {
|
|
5357
|
+
value: collectionTagDef.carrierIsResult ? carrier : finalizeCollection(state, state.position, collectionTagDef, carrier),
|
|
5358
|
+
tag: collectionTagDef
|
|
5359
|
+
};
|
|
5360
|
+
}
|
|
5361
|
+
throwError$1(state, `unknown scalar tag !<${tagName}>`);
|
|
5362
|
+
}
|
|
5363
|
+
if (event.style === 1) {
|
|
5364
|
+
const candidates = state.schema.implicitScalarByFirstChar.get(source.charAt(0)) ?? state.schema.implicitScalarAnyFirstChar;
|
|
5365
|
+
for (const tag of candidates) {
|
|
5366
|
+
const result = tag.resolve(source, false, tag.tagName);
|
|
5367
|
+
if (result !== NOT_RESOLVED) return {
|
|
5368
|
+
value: result,
|
|
5369
|
+
tag
|
|
5370
|
+
};
|
|
5644
5371
|
}
|
|
5645
|
-
return false;
|
|
5646
5372
|
}
|
|
5647
|
-
|
|
5648
|
-
|
|
5649
|
-
|
|
5650
|
-
|
|
5651
|
-
|
|
5652
|
-
|
|
5653
|
-
|
|
5654
|
-
|
|
5655
|
-
|
|
5656
|
-
|
|
5657
|
-
|
|
5658
|
-
|
|
5659
|
-
|
|
5660
|
-
|
|
5661
|
-
|
|
5662
|
-
|
|
5663
|
-
|
|
5664
|
-
|
|
5665
|
-
|
|
5666
|
-
|
|
5667
|
-
|
|
5373
|
+
return {
|
|
5374
|
+
value: strTag.resolve(source, false, strTag.tagName),
|
|
5375
|
+
tag: strTag
|
|
5376
|
+
};
|
|
5377
|
+
}
|
|
5378
|
+
function collectionTag(state, event, exact, prefix, defaultTagName, nodeKind) {
|
|
5379
|
+
const rawTag = event.tagStart === NO_RANGE$2 ? "" : state.source.slice(event.tagStart, event.tagEnd);
|
|
5380
|
+
const tagName = rawTag === "" || rawTag === "!" ? defaultTagName : tagNameFull(rawTag, state.tagHandlers);
|
|
5381
|
+
return {
|
|
5382
|
+
tagName,
|
|
5383
|
+
tag: findExplicitTag(state, exact, prefix, tagName, nodeKind)
|
|
5384
|
+
};
|
|
5385
|
+
}
|
|
5386
|
+
function isMappingTag(tag) {
|
|
5387
|
+
return tag.nodeKind === "mapping";
|
|
5388
|
+
}
|
|
5389
|
+
function mergeKeys(state, frame, source, sourceTag) {
|
|
5390
|
+
for (const sourceKey of sourceTag.keys(source)) {
|
|
5391
|
+
if (state.maxTotalMergeKeys !== -1 && ++state.totalMergeKeys > state.maxTotalMergeKeys) throwError$1(state, `merge keys exceeded maxTotalMergeKeys (${state.maxTotalMergeKeys})`);
|
|
5392
|
+
if (frame.tag.has(frame.value, sourceKey)) continue;
|
|
5393
|
+
const err = frame.tag.addPair(frame.value, sourceKey, sourceTag.get(source, sourceKey));
|
|
5394
|
+
if (err) throwError$1(state, err);
|
|
5395
|
+
(frame.overridable ??= /* @__PURE__ */ new Set()).add(sourceKey);
|
|
5396
|
+
}
|
|
5397
|
+
}
|
|
5398
|
+
function mergeSource(state, frame, source, sourceTag) {
|
|
5399
|
+
state.position = frame.keyPosition;
|
|
5400
|
+
if (isMappingTag(sourceTag)) mergeKeys(state, frame, source, sourceTag);
|
|
5401
|
+
else if (sourceTag.nodeKind === "sequence" && Array.isArray(source)) for (const element of source) mergeKeys(state, frame, element, frame.tag);
|
|
5402
|
+
else throwError$1(state, "cannot merge mappings; the provided source object is unacceptable");
|
|
5403
|
+
}
|
|
5404
|
+
function addMappingValue(state, frame, key, value, tag) {
|
|
5405
|
+
state.position = frame.keyPosition;
|
|
5406
|
+
if (key === MERGE_KEY) {
|
|
5407
|
+
mergeSource(state, frame, value, tag);
|
|
5408
|
+
return;
|
|
5409
|
+
}
|
|
5410
|
+
if (!state.json && frame.tag.has(frame.value, key) && !frame.overridable?.has(key)) throwError$1(state, "duplicated mapping key");
|
|
5411
|
+
const err = frame.tag.addPair(frame.value, key, value);
|
|
5412
|
+
if (err) throwError$1(state, err);
|
|
5413
|
+
frame.overridable?.delete(key);
|
|
5414
|
+
}
|
|
5415
|
+
function addValue(state, value, tag) {
|
|
5416
|
+
const frame = state.frames[state.frames.length - 1];
|
|
5417
|
+
if (frame.kind === "document") {
|
|
5418
|
+
frame.value = value;
|
|
5419
|
+
frame.hasValue = true;
|
|
5420
|
+
} else if (frame.kind === "sequence") {
|
|
5421
|
+
if (frame.merge) {
|
|
5422
|
+
if (!isMappingTag(tag)) throwError$1(state, "cannot merge mappings; the provided source object is unacceptable");
|
|
5423
|
+
}
|
|
5424
|
+
const err = frame.tag.addItem(frame.value, value, frame.index++);
|
|
5425
|
+
if (err) throwError$1(state, err);
|
|
5426
|
+
} else if (frame.hasKey) {
|
|
5427
|
+
const key = frame.key;
|
|
5428
|
+
frame.key = void 0;
|
|
5429
|
+
frame.hasKey = false;
|
|
5430
|
+
addMappingValue(state, frame, key, value, tag);
|
|
5431
|
+
} else {
|
|
5432
|
+
frame.key = value;
|
|
5433
|
+
frame.keyPosition = state.position;
|
|
5434
|
+
frame.hasKey = true;
|
|
5435
|
+
}
|
|
5436
|
+
}
|
|
5437
|
+
function storeAnchor(state, event, value, tag, isValueFinal) {
|
|
5438
|
+
if (event.anchorStart !== NO_RANGE$2) {
|
|
5439
|
+
const anchor = {
|
|
5440
|
+
value,
|
|
5441
|
+
tag,
|
|
5442
|
+
isValueFinal
|
|
5443
|
+
};
|
|
5444
|
+
state.anchors.set(state.source.slice(event.anchorStart, event.anchorEnd), anchor);
|
|
5445
|
+
return anchor;
|
|
5446
|
+
}
|
|
5447
|
+
return null;
|
|
5448
|
+
}
|
|
5449
|
+
function constructFromEvents(events, options) {
|
|
5450
|
+
const state = {
|
|
5451
|
+
...DEFAULT_CONSTRUCTOR_OPTIONS,
|
|
5452
|
+
...options,
|
|
5453
|
+
events,
|
|
5454
|
+
documents: [],
|
|
5455
|
+
eventIndex: 0,
|
|
5456
|
+
position: 0,
|
|
5457
|
+
frames: [],
|
|
5458
|
+
anchors: /* @__PURE__ */ new Map(),
|
|
5459
|
+
tagHandlers: Object.create(null),
|
|
5460
|
+
totalMergeKeys: 0,
|
|
5461
|
+
aliasCount: 0
|
|
5462
|
+
};
|
|
5463
|
+
while (state.eventIndex < state.events.length) {
|
|
5464
|
+
const event = state.events[state.eventIndex++];
|
|
5465
|
+
state.position = eventPosition$1(event);
|
|
5466
|
+
switch (event.type) {
|
|
5467
|
+
case 1:
|
|
5468
|
+
state.anchors = /* @__PURE__ */ new Map();
|
|
5469
|
+
state.aliasCount = 0;
|
|
5470
|
+
state.tagHandlers = Object.create(null);
|
|
5471
|
+
for (const directive of event.directives) if (directive.kind === "tag") state.tagHandlers[directive.handle] = directive.prefix;
|
|
5472
|
+
state.frames.push({
|
|
5473
|
+
kind: "document",
|
|
5474
|
+
position: state.position,
|
|
5475
|
+
value: void 0,
|
|
5476
|
+
hasValue: false
|
|
5477
|
+
});
|
|
5478
|
+
break;
|
|
5479
|
+
case 4: {
|
|
5480
|
+
const { value, tag } = constructScalar(state, event);
|
|
5481
|
+
storeAnchor(state, event, value, tag, true);
|
|
5482
|
+
addValue(state, value, tag);
|
|
5483
|
+
break;
|
|
5668
5484
|
}
|
|
5669
|
-
|
|
5670
|
-
|
|
5671
|
-
|
|
5672
|
-
|
|
5673
|
-
|
|
5674
|
-
|
|
5675
|
-
|
|
5676
|
-
|
|
5677
|
-
|
|
5678
|
-
|
|
5679
|
-
|
|
5680
|
-
|
|
5681
|
-
|
|
5682
|
-
|
|
5683
|
-
}
|
|
5684
|
-
|
|
5685
|
-
ch = following;
|
|
5686
|
-
} else {
|
|
5687
|
-
_keyLine = state.line;
|
|
5688
|
-
_keyLineStart = state.lineStart;
|
|
5689
|
-
_keyPos = state.position;
|
|
5690
|
-
if (!composeNode(state, flowIndent, CONTEXT_FLOW_OUT, false, true)) break;
|
|
5691
|
-
if (state.line === _line) {
|
|
5692
|
-
ch = state.input.charCodeAt(state.position);
|
|
5693
|
-
while (isWhiteSpace(ch)) ch = state.input.charCodeAt(++state.position);
|
|
5694
|
-
if (ch === 58) {
|
|
5695
|
-
ch = state.input.charCodeAt(++state.position);
|
|
5696
|
-
if (!isWsOrEol(ch)) throwError(state, "a whitespace character is expected after the key-value separator within a block mapping");
|
|
5697
|
-
if (atExplicitKey) {
|
|
5698
|
-
storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos);
|
|
5699
|
-
keyTag = keyNode = valueNode = null;
|
|
5700
|
-
}
|
|
5701
|
-
detected = true;
|
|
5702
|
-
atExplicitKey = false;
|
|
5703
|
-
allowCompact = false;
|
|
5704
|
-
keyTag = state.tag;
|
|
5705
|
-
keyNode = state.result;
|
|
5706
|
-
} else if (detected) throwError(state, "can not read an implicit mapping pair; a colon is missed");
|
|
5707
|
-
else {
|
|
5708
|
-
state.tag = _tag;
|
|
5709
|
-
state.anchor = _anchor;
|
|
5710
|
-
return true;
|
|
5711
|
-
}
|
|
5712
|
-
} else if (detected) throwError(state, "can not read a block mapping entry; a multiline key may not be an implicit key");
|
|
5713
|
-
else {
|
|
5714
|
-
state.tag = _tag;
|
|
5715
|
-
state.anchor = _anchor;
|
|
5716
|
-
return true;
|
|
5717
|
-
}
|
|
5485
|
+
case 2: {
|
|
5486
|
+
const definition = collectionTag(state, event, state.schema.exact.sequence, state.schema.prefix.sequence, "tag:yaml.org,2002:seq", "sequence");
|
|
5487
|
+
const value = definition.tag.create(definition.tagName);
|
|
5488
|
+
const anchor = storeAnchor(state, event, value, definition.tag, definition.tag.carrierIsResult);
|
|
5489
|
+
const parent = state.frames[state.frames.length - 1];
|
|
5490
|
+
const merge = parent !== void 0 && parent.kind === "mapping" && parent.hasKey && parent.key === MERGE_KEY;
|
|
5491
|
+
state.frames.push({
|
|
5492
|
+
kind: "sequence",
|
|
5493
|
+
position: state.position,
|
|
5494
|
+
value,
|
|
5495
|
+
tag: definition.tag,
|
|
5496
|
+
anchor,
|
|
5497
|
+
index: 0,
|
|
5498
|
+
merge
|
|
5499
|
+
});
|
|
5500
|
+
break;
|
|
5718
5501
|
}
|
|
5719
|
-
|
|
5720
|
-
|
|
5721
|
-
|
|
5722
|
-
|
|
5723
|
-
|
|
5724
|
-
|
|
5725
|
-
|
|
5726
|
-
|
|
5727
|
-
|
|
5728
|
-
|
|
5729
|
-
|
|
5502
|
+
case 3: {
|
|
5503
|
+
const definition = collectionTag(state, event, state.schema.exact.mapping, state.schema.prefix.mapping, "tag:yaml.org,2002:map", "mapping");
|
|
5504
|
+
const value = definition.tag.create(definition.tagName);
|
|
5505
|
+
const anchor = storeAnchor(state, event, value, definition.tag, definition.tag.carrierIsResult);
|
|
5506
|
+
state.frames.push({
|
|
5507
|
+
kind: "mapping",
|
|
5508
|
+
position: state.position,
|
|
5509
|
+
value,
|
|
5510
|
+
tag: definition.tag,
|
|
5511
|
+
anchor,
|
|
5512
|
+
key: void 0,
|
|
5513
|
+
keyPosition: state.position,
|
|
5514
|
+
hasKey: false,
|
|
5515
|
+
overridable: null
|
|
5516
|
+
});
|
|
5517
|
+
break;
|
|
5518
|
+
}
|
|
5519
|
+
case 5: {
|
|
5520
|
+
if (state.maxAliases !== -1 && ++state.aliasCount > state.maxAliases) throwError$1(state, `aliases exceeded maxAliases (${state.maxAliases})`);
|
|
5521
|
+
const name = state.source.slice(event.anchorStart, event.anchorEnd);
|
|
5522
|
+
const anchor = state.anchors.get(name);
|
|
5523
|
+
if (!anchor) throwError$1(state, `unidentified alias "${name}"`);
|
|
5524
|
+
if (!anchor.isValueFinal) throwError$1(state, `recursive alias "${name}" is not supported for tag ${anchor.tag.tagName} because it uses finalize()`);
|
|
5525
|
+
addValue(state, anchor.value, anchor.tag);
|
|
5526
|
+
break;
|
|
5527
|
+
}
|
|
5528
|
+
case 6: {
|
|
5529
|
+
const frame = state.frames.pop();
|
|
5530
|
+
if (frame.kind === "document") state.documents.push(frame.value);
|
|
5531
|
+
else {
|
|
5532
|
+
const value = frame.tag.carrierIsResult ? frame.value : finalizeCollection(state, frame.position, frame.tag, frame.value);
|
|
5533
|
+
if (frame.anchor) {
|
|
5534
|
+
frame.anchor.value = value;
|
|
5535
|
+
frame.anchor.isValueFinal = true;
|
|
5536
|
+
}
|
|
5537
|
+
addValue(state, value, frame.tag);
|
|
5730
5538
|
}
|
|
5731
|
-
|
|
5732
|
-
ch = state.input.charCodeAt(state.position);
|
|
5539
|
+
break;
|
|
5733
5540
|
}
|
|
5734
|
-
if ((state.line === _line || state.lineIndent > nodeIndent) && ch !== 0) throwError(state, "bad indentation of a mapping entry");
|
|
5735
|
-
else if (state.lineIndent < nodeIndent) break;
|
|
5736
|
-
}
|
|
5737
|
-
if (atExplicitKey) storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos);
|
|
5738
|
-
if (detected) {
|
|
5739
|
-
state.tag = _tag;
|
|
5740
|
-
state.anchor = _anchor;
|
|
5741
|
-
state.kind = "mapping";
|
|
5742
|
-
state.result = _result;
|
|
5743
5541
|
}
|
|
5744
|
-
return detected;
|
|
5745
5542
|
}
|
|
5746
|
-
|
|
5747
|
-
|
|
5748
|
-
|
|
5749
|
-
|
|
5750
|
-
|
|
5751
|
-
|
|
5752
|
-
|
|
5753
|
-
|
|
5754
|
-
|
|
5755
|
-
|
|
5756
|
-
|
|
5757
|
-
|
|
5758
|
-
|
|
5759
|
-
|
|
5760
|
-
|
|
5543
|
+
return state.documents;
|
|
5544
|
+
}
|
|
5545
|
+
//#endregion
|
|
5546
|
+
//#region src/parser/parser.ts
|
|
5547
|
+
var NO_RANGE$1 = -1;
|
|
5548
|
+
var HAS_OWN = Object.prototype.hasOwnProperty;
|
|
5549
|
+
var CONTEXT_FLOW_IN = 1;
|
|
5550
|
+
var CONTEXT_FLOW_OUT = 2;
|
|
5551
|
+
var CONTEXT_BLOCK_IN = 3;
|
|
5552
|
+
var CONTEXT_BLOCK_OUT = 4;
|
|
5553
|
+
var PATTERN_NON_PRINTABLE = /[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/;
|
|
5554
|
+
var PATTERN_FLOW_INDICATORS = /[,\[\]{}]/;
|
|
5555
|
+
var PATTERN_TAG_HANDLE = /^(?:!|!!|![0-9A-Za-z-]+!)$/;
|
|
5556
|
+
var NS_URI_CHAR = String.raw`(?:%[0-9A-Fa-f]{2}|[0-9A-Za-z\-#;/?:@&=+$,_.!~*'()\[\]])`;
|
|
5557
|
+
var NS_TAG_CHAR = String.raw`(?:%[0-9A-Fa-f]{2}|[0-9A-Za-z\-#;/?:@&=+$.~*'()_])`;
|
|
5558
|
+
var PATTERN_TAG_URI = new RegExp(`^(?:${NS_URI_CHAR})*$`);
|
|
5559
|
+
var PATTERN_TAG_SUFFIX = new RegExp(`^(?:${NS_TAG_CHAR})+$`);
|
|
5560
|
+
var PATTERN_TAG_PREFIX = new RegExp(`^(?:!(?:${NS_URI_CHAR})*|${NS_TAG_CHAR}(?:${NS_URI_CHAR})*)$`);
|
|
5561
|
+
var DEFAULT_PARSER_OPTIONS = {
|
|
5562
|
+
filename: "",
|
|
5563
|
+
maxDepth: 100
|
|
5564
|
+
};
|
|
5565
|
+
function addDocumentEvent(state, explicitStart, explicitEnd) {
|
|
5566
|
+
state.events.push({
|
|
5567
|
+
type: 1,
|
|
5568
|
+
explicitStart,
|
|
5569
|
+
explicitEnd,
|
|
5570
|
+
directives: state.directives
|
|
5571
|
+
});
|
|
5572
|
+
}
|
|
5573
|
+
function addSequenceEvent(state, start, anchorStart, anchorEnd, tagStart, tagEnd, style) {
|
|
5574
|
+
state.events.push({
|
|
5575
|
+
type: 2,
|
|
5576
|
+
start,
|
|
5577
|
+
anchorStart,
|
|
5578
|
+
anchorEnd,
|
|
5579
|
+
tagStart,
|
|
5580
|
+
tagEnd,
|
|
5581
|
+
style
|
|
5582
|
+
});
|
|
5583
|
+
}
|
|
5584
|
+
function addMappingEvent(state, start, anchorStart, anchorEnd, tagStart, tagEnd, style) {
|
|
5585
|
+
state.events.push({
|
|
5586
|
+
type: 3,
|
|
5587
|
+
start,
|
|
5588
|
+
anchorStart,
|
|
5589
|
+
anchorEnd,
|
|
5590
|
+
tagStart,
|
|
5591
|
+
tagEnd,
|
|
5592
|
+
style
|
|
5593
|
+
});
|
|
5594
|
+
}
|
|
5595
|
+
function addScalarEvent(state, valueStart, valueEnd, anchorStart, anchorEnd, tagStart, tagEnd, style, chomping = 1, indent = -1, fast = false) {
|
|
5596
|
+
state.events.push({
|
|
5597
|
+
type: 4,
|
|
5598
|
+
valueStart,
|
|
5599
|
+
valueEnd,
|
|
5600
|
+
anchorStart,
|
|
5601
|
+
anchorEnd,
|
|
5602
|
+
tagStart,
|
|
5603
|
+
tagEnd,
|
|
5604
|
+
style,
|
|
5605
|
+
chomping,
|
|
5606
|
+
indent,
|
|
5607
|
+
fast
|
|
5608
|
+
});
|
|
5609
|
+
}
|
|
5610
|
+
function addAliasEvent(state, anchorStart, anchorEnd) {
|
|
5611
|
+
state.events.push({
|
|
5612
|
+
type: 5,
|
|
5613
|
+
anchorStart,
|
|
5614
|
+
anchorEnd
|
|
5615
|
+
});
|
|
5616
|
+
}
|
|
5617
|
+
function addPopEvent(state) {
|
|
5618
|
+
state.events.push({ type: 6 });
|
|
5619
|
+
}
|
|
5620
|
+
function addEmptyScalarEvent(state) {
|
|
5621
|
+
addScalarEvent(state, NO_RANGE$1, NO_RANGE$1, NO_RANGE$1, NO_RANGE$1, NO_RANGE$1, NO_RANGE$1, 1);
|
|
5622
|
+
}
|
|
5623
|
+
function emptyProperties() {
|
|
5624
|
+
return {
|
|
5625
|
+
anchorStart: NO_RANGE$1,
|
|
5626
|
+
anchorEnd: NO_RANGE$1,
|
|
5627
|
+
tagStart: NO_RANGE$1,
|
|
5628
|
+
tagEnd: NO_RANGE$1
|
|
5629
|
+
};
|
|
5630
|
+
}
|
|
5631
|
+
function snapshotState(state) {
|
|
5632
|
+
return {
|
|
5633
|
+
position: state.position,
|
|
5634
|
+
line: state.line,
|
|
5635
|
+
lineStart: state.lineStart,
|
|
5636
|
+
lineIndent: state.lineIndent,
|
|
5637
|
+
firstTabInLine: state.firstTabInLine,
|
|
5638
|
+
eventsLength: state.events.length
|
|
5639
|
+
};
|
|
5640
|
+
}
|
|
5641
|
+
function restoreState(state, snapshot) {
|
|
5642
|
+
state.position = snapshot.position;
|
|
5643
|
+
state.line = snapshot.line;
|
|
5644
|
+
state.lineStart = snapshot.lineStart;
|
|
5645
|
+
state.lineIndent = snapshot.lineIndent;
|
|
5646
|
+
state.firstTabInLine = snapshot.firstTabInLine;
|
|
5647
|
+
state.events.length = snapshot.eventsLength;
|
|
5648
|
+
}
|
|
5649
|
+
function throwError(state, message) {
|
|
5650
|
+
throwErrorAt(state.input.slice(0, state.length), state.position, message, state.filename);
|
|
5651
|
+
}
|
|
5652
|
+
function isEol(c) {
|
|
5653
|
+
return c === 10 || c === 13;
|
|
5654
|
+
}
|
|
5655
|
+
function isWhiteSpace(c) {
|
|
5656
|
+
return c === 9 || c === 32;
|
|
5657
|
+
}
|
|
5658
|
+
function isWsOrEol(c) {
|
|
5659
|
+
return isWhiteSpace(c) || isEol(c);
|
|
5660
|
+
}
|
|
5661
|
+
function isWsOrEolOrEnd(c) {
|
|
5662
|
+
return c === 0 || isWsOrEol(c);
|
|
5663
|
+
}
|
|
5664
|
+
function isFlowIndicator(c) {
|
|
5665
|
+
return c === 44 || c === 91 || c === 93 || c === 123 || c === 125;
|
|
5666
|
+
}
|
|
5667
|
+
function fromDecimalCode(c) {
|
|
5668
|
+
return c >= 48 && c <= 57 ? c - 48 : -1;
|
|
5669
|
+
}
|
|
5670
|
+
function fromHexCode(c) {
|
|
5671
|
+
if (c >= 48 && c <= 57) return c - 48;
|
|
5672
|
+
const lc = c | 32;
|
|
5673
|
+
if (lc >= 97 && lc <= 102) return lc - 97 + 10;
|
|
5674
|
+
return -1;
|
|
5675
|
+
}
|
|
5676
|
+
function escapedHexLen(c) {
|
|
5677
|
+
if (c === 120) return 2;
|
|
5678
|
+
if (c === 117) return 4;
|
|
5679
|
+
if (c === 85) return 8;
|
|
5680
|
+
return 0;
|
|
5681
|
+
}
|
|
5682
|
+
function isSimpleEscape(c) {
|
|
5683
|
+
return c === 48 || c === 97 || c === 98 || c === 116 || c === 9 || c === 110 || c === 118 || c === 102 || c === 114 || c === 101 || c === 32 || c === 34 || c === 47 || c === 92 || c === 78 || c === 95 || c === 76 || c === 80;
|
|
5684
|
+
}
|
|
5685
|
+
function consumeLineBreak(state) {
|
|
5686
|
+
if (state.input.charCodeAt(state.position) === 10) state.position++;
|
|
5687
|
+
else {
|
|
5688
|
+
state.position++;
|
|
5689
|
+
if (state.input.charCodeAt(state.position) === 10) state.position++;
|
|
5690
|
+
}
|
|
5691
|
+
state.line++;
|
|
5692
|
+
state.lineStart = state.position;
|
|
5693
|
+
state.lineIndent = 0;
|
|
5694
|
+
state.firstTabInLine = -1;
|
|
5695
|
+
}
|
|
5696
|
+
function skipSeparationSpace(state, allowComments) {
|
|
5697
|
+
let lineBreaks = 0;
|
|
5698
|
+
let ch = state.input.charCodeAt(state.position);
|
|
5699
|
+
let hasSeparation = state.position === state.lineStart || isWsOrEol(state.input.charCodeAt(state.position - 1));
|
|
5700
|
+
while (ch !== 0) {
|
|
5701
|
+
while (isWhiteSpace(ch)) {
|
|
5702
|
+
hasSeparation = true;
|
|
5703
|
+
if (ch === 9 && state.firstTabInLine === -1) state.firstTabInLine = state.position;
|
|
5761
5704
|
ch = state.input.charCodeAt(++state.position);
|
|
5762
|
-
} else tagHandle = "!";
|
|
5763
|
-
let _position = state.position;
|
|
5764
|
-
if (isVerbatim) {
|
|
5765
|
-
do
|
|
5766
|
-
ch = state.input.charCodeAt(++state.position);
|
|
5767
|
-
while (ch !== 0 && ch !== 62);
|
|
5768
|
-
if (state.position < state.length) {
|
|
5769
|
-
tagName = state.input.slice(_position, state.position);
|
|
5770
|
-
ch = state.input.charCodeAt(++state.position);
|
|
5771
|
-
} else throwError(state, "unexpected end of the stream within a verbatim tag");
|
|
5772
|
-
} else {
|
|
5773
|
-
while (ch !== 0 && !isWsOrEol(ch)) {
|
|
5774
|
-
if (ch === 33) if (!isNamed) {
|
|
5775
|
-
tagHandle = state.input.slice(_position - 1, state.position + 1);
|
|
5776
|
-
if (!PATTERN_TAG_HANDLE.test(tagHandle)) throwError(state, "named tag handle cannot contain such characters");
|
|
5777
|
-
isNamed = true;
|
|
5778
|
-
_position = state.position + 1;
|
|
5779
|
-
} else throwError(state, "tag suffix cannot contain exclamation marks");
|
|
5780
|
-
ch = state.input.charCodeAt(++state.position);
|
|
5781
|
-
}
|
|
5782
|
-
tagName = state.input.slice(_position, state.position);
|
|
5783
|
-
if (PATTERN_FLOW_INDICATORS.test(tagName)) throwError(state, "tag suffix cannot contain flow indicator characters");
|
|
5784
5705
|
}
|
|
5785
|
-
if (
|
|
5786
|
-
|
|
5787
|
-
|
|
5788
|
-
|
|
5789
|
-
|
|
5706
|
+
if (allowComments && hasSeparation && ch === 35) do
|
|
5707
|
+
ch = state.input.charCodeAt(++state.position);
|
|
5708
|
+
while (!isEol(ch) && ch !== 0);
|
|
5709
|
+
if (!isEol(ch)) break;
|
|
5710
|
+
consumeLineBreak(state);
|
|
5711
|
+
lineBreaks++;
|
|
5712
|
+
hasSeparation = true;
|
|
5713
|
+
ch = state.input.charCodeAt(state.position);
|
|
5714
|
+
while (ch === 32) {
|
|
5715
|
+
state.lineIndent++;
|
|
5716
|
+
ch = state.input.charCodeAt(++state.position);
|
|
5790
5717
|
}
|
|
5791
|
-
if (isVerbatim) state.tag = tagName;
|
|
5792
|
-
else if (_hasOwnProperty.call(state.tagMap, tagHandle)) state.tag = state.tagMap[tagHandle] + tagName;
|
|
5793
|
-
else if (tagHandle === "!") state.tag = "!" + tagName;
|
|
5794
|
-
else if (tagHandle === "!!") state.tag = "tag:yaml.org,2002:" + tagName;
|
|
5795
|
-
else throwError(state, "undeclared tag handle \"" + tagHandle + "\"");
|
|
5796
|
-
return true;
|
|
5797
5718
|
}
|
|
5798
|
-
|
|
5799
|
-
|
|
5800
|
-
|
|
5801
|
-
|
|
5719
|
+
return lineBreaks;
|
|
5720
|
+
}
|
|
5721
|
+
function testDocumentSeparator(state, position = state.position) {
|
|
5722
|
+
const ch = state.input.charCodeAt(position);
|
|
5723
|
+
if ((ch === 45 || ch === 46) && ch === state.input.charCodeAt(position + 1) && ch === state.input.charCodeAt(position + 2)) {
|
|
5724
|
+
const following = state.input.charCodeAt(position + 3);
|
|
5725
|
+
return following === 0 || isWsOrEol(following);
|
|
5726
|
+
}
|
|
5727
|
+
return false;
|
|
5728
|
+
}
|
|
5729
|
+
function skipUntilLineEnd(state) {
|
|
5730
|
+
let ch = state.input.charCodeAt(state.position);
|
|
5731
|
+
while (ch !== 0 && !isEol(ch)) ch = state.input.charCodeAt(++state.position);
|
|
5732
|
+
}
|
|
5733
|
+
function checkPrintable(state, start, end) {
|
|
5734
|
+
if (PATTERN_NON_PRINTABLE.test(state.input.slice(start, end))) throwError(state, "the stream contains non-printable characters");
|
|
5735
|
+
}
|
|
5736
|
+
function readTagProperty(state, props, inFlow) {
|
|
5737
|
+
if (state.input.charCodeAt(state.position) !== 33) return false;
|
|
5738
|
+
if (props.tagStart !== NO_RANGE$1) throwError(state, "duplication of a tag property");
|
|
5739
|
+
const start = state.position;
|
|
5740
|
+
let isVerbatim = false;
|
|
5741
|
+
let isNamed = false;
|
|
5742
|
+
let tagHandle = "!";
|
|
5743
|
+
let ch = state.input.charCodeAt(++state.position);
|
|
5744
|
+
if (ch === 60) {
|
|
5745
|
+
isVerbatim = true;
|
|
5802
5746
|
ch = state.input.charCodeAt(++state.position);
|
|
5803
|
-
|
|
5804
|
-
|
|
5805
|
-
|
|
5806
|
-
state.anchor = state.input.slice(_position, state.position);
|
|
5807
|
-
return true;
|
|
5808
|
-
}
|
|
5809
|
-
function readAlias(state) {
|
|
5810
|
-
let ch = state.input.charCodeAt(state.position);
|
|
5811
|
-
if (ch !== 42) return false;
|
|
5747
|
+
} else if (ch === 33) {
|
|
5748
|
+
isNamed = true;
|
|
5749
|
+
tagHandle = "!!";
|
|
5812
5750
|
ch = state.input.charCodeAt(++state.position);
|
|
5813
|
-
const _position = state.position;
|
|
5814
|
-
while (ch !== 0 && !isWsOrEol(ch) && !isFlowIndicator(ch)) ch = state.input.charCodeAt(++state.position);
|
|
5815
|
-
if (state.position === _position) throwError(state, "name of an alias node must contain at least one character");
|
|
5816
|
-
const alias = state.input.slice(_position, state.position);
|
|
5817
|
-
if (!_hasOwnProperty.call(state.anchorMap, alias)) throwError(state, "unidentified alias \"" + alias + "\"");
|
|
5818
|
-
state.result = state.anchorMap[alias];
|
|
5819
|
-
skipSeparationSpace(state, true, -1);
|
|
5820
|
-
return true;
|
|
5821
5751
|
}
|
|
5822
|
-
|
|
5823
|
-
|
|
5824
|
-
|
|
5825
|
-
|
|
5826
|
-
state
|
|
5827
|
-
state.
|
|
5828
|
-
state.
|
|
5829
|
-
|
|
5830
|
-
|
|
5831
|
-
|
|
5832
|
-
|
|
5752
|
+
let suffixStart = state.position;
|
|
5753
|
+
let tagName;
|
|
5754
|
+
if (isVerbatim) {
|
|
5755
|
+
while (ch !== 0 && ch !== 62) ch = state.input.charCodeAt(++state.position);
|
|
5756
|
+
if (ch !== 62) throwError(state, "unexpected end of the stream within a verbatim tag");
|
|
5757
|
+
tagName = state.input.slice(suffixStart, state.position);
|
|
5758
|
+
state.position++;
|
|
5759
|
+
} else {
|
|
5760
|
+
while (ch !== 0 && !isWsOrEol(ch) && !(inFlow && isFlowIndicator(ch))) {
|
|
5761
|
+
if (ch === 33) if (!isNamed) {
|
|
5762
|
+
tagHandle = state.input.slice(suffixStart - 1, state.position + 1);
|
|
5763
|
+
if (!PATTERN_TAG_HANDLE.test(tagHandle)) throwError(state, "named tag handle cannot contain such characters");
|
|
5764
|
+
isNamed = true;
|
|
5765
|
+
suffixStart = state.position + 1;
|
|
5766
|
+
} else throwError(state, "tag suffix cannot contain exclamation marks");
|
|
5767
|
+
ch = state.input.charCodeAt(++state.position);
|
|
5833
5768
|
}
|
|
5834
|
-
|
|
5835
|
-
|
|
5836
|
-
|
|
5837
|
-
}
|
|
5838
|
-
|
|
5839
|
-
|
|
5840
|
-
|
|
5841
|
-
|
|
5842
|
-
|
|
5843
|
-
|
|
5844
|
-
|
|
5845
|
-
|
|
5846
|
-
|
|
5847
|
-
|
|
5848
|
-
|
|
5849
|
-
|
|
5850
|
-
|
|
5851
|
-
|
|
5852
|
-
|
|
5853
|
-
|
|
5854
|
-
|
|
5855
|
-
|
|
5856
|
-
|
|
5857
|
-
|
|
5858
|
-
|
|
5859
|
-
|
|
5860
|
-
|
|
5861
|
-
|
|
5769
|
+
tagName = state.input.slice(suffixStart, state.position);
|
|
5770
|
+
if (PATTERN_FLOW_INDICATORS.test(tagName)) throwError(state, "tag suffix cannot contain flow indicator characters");
|
|
5771
|
+
}
|
|
5772
|
+
if (tagName && !(isVerbatim ? PATTERN_TAG_URI.test(tagName) : PATTERN_TAG_SUFFIX.test(tagName))) throwError(state, `tag name cannot contain such characters: ${tagName}`);
|
|
5773
|
+
if (!isVerbatim && tagHandle !== "!" && tagHandle !== "!!" && !HAS_OWN.call(state.tagHandlers, tagHandle)) throwError(state, `undeclared tag handle "${tagHandle}"`);
|
|
5774
|
+
props.tagStart = start;
|
|
5775
|
+
props.tagEnd = state.position;
|
|
5776
|
+
return true;
|
|
5777
|
+
}
|
|
5778
|
+
function readAnchorProperty(state, props) {
|
|
5779
|
+
if (state.input.charCodeAt(state.position) !== 38) return false;
|
|
5780
|
+
if (props.anchorStart !== NO_RANGE$1) throwError(state, "duplication of an anchor property");
|
|
5781
|
+
state.position++;
|
|
5782
|
+
const start = state.position;
|
|
5783
|
+
while (state.input.charCodeAt(state.position) !== 0 && !isWsOrEol(state.input.charCodeAt(state.position)) && !isFlowIndicator(state.input.charCodeAt(state.position))) state.position++;
|
|
5784
|
+
if (state.position === start) throwError(state, "name of an anchor node must contain at least one character");
|
|
5785
|
+
props.anchorStart = start;
|
|
5786
|
+
props.anchorEnd = state.position;
|
|
5787
|
+
return true;
|
|
5788
|
+
}
|
|
5789
|
+
function readAlias(state, props) {
|
|
5790
|
+
if (state.input.charCodeAt(state.position) !== 42) return false;
|
|
5791
|
+
if (props.anchorStart !== NO_RANGE$1 || props.tagStart !== NO_RANGE$1) throwError(state, "alias node should not have any properties");
|
|
5792
|
+
state.position++;
|
|
5793
|
+
const start = state.position;
|
|
5794
|
+
while (state.input.charCodeAt(state.position) !== 0 && !isWsOrEol(state.input.charCodeAt(state.position)) && !isFlowIndicator(state.input.charCodeAt(state.position))) state.position++;
|
|
5795
|
+
if (state.position === start) throwError(state, "name of an alias node must contain at least one character");
|
|
5796
|
+
addAliasEvent(state, start, state.position);
|
|
5797
|
+
return true;
|
|
5798
|
+
}
|
|
5799
|
+
function readFlowScalarBreak(state, nodeIndent) {
|
|
5800
|
+
skipSeparationSpace(state, false);
|
|
5801
|
+
if (state.lineIndent < nodeIndent) throwError(state, "deficient indentation");
|
|
5802
|
+
}
|
|
5803
|
+
function readSingleQuotedScalar(state, nodeIndent, props) {
|
|
5804
|
+
if (state.input.charCodeAt(state.position) !== 39) return false;
|
|
5805
|
+
state.position++;
|
|
5806
|
+
const start = state.position;
|
|
5807
|
+
let simple = true;
|
|
5808
|
+
while (state.input.charCodeAt(state.position) !== 0) {
|
|
5809
|
+
const ch = state.input.charCodeAt(state.position);
|
|
5810
|
+
if (ch === 39) {
|
|
5811
|
+
if (state.input.charCodeAt(state.position + 1) === 39) {
|
|
5812
|
+
simple = false;
|
|
5813
|
+
state.position += 2;
|
|
5814
|
+
continue;
|
|
5862
5815
|
}
|
|
5816
|
+
const end = state.position;
|
|
5817
|
+
state.position++;
|
|
5818
|
+
addScalarEvent(state, start, end, props.anchorStart, props.anchorEnd, props.tagStart, props.tagEnd, 2, 1, -1, simple);
|
|
5819
|
+
return true;
|
|
5863
5820
|
}
|
|
5864
|
-
if (
|
|
5865
|
-
|
|
5866
|
-
|
|
5867
|
-
|
|
5868
|
-
|
|
5869
|
-
|
|
5870
|
-
|
|
5871
|
-
|
|
5872
|
-
|
|
5873
|
-
|
|
5874
|
-
|
|
5875
|
-
|
|
5876
|
-
|
|
5877
|
-
|
|
5878
|
-
|
|
5879
|
-
|
|
5880
|
-
|
|
5881
|
-
|
|
5882
|
-
|
|
5883
|
-
|
|
5884
|
-
|
|
5885
|
-
const ch = state.input.charCodeAt(state.position);
|
|
5886
|
-
if (propertyStart !== null && allowBlockStyles && !allowBlockCollections && ch !== 124 && ch !== 62 && tryReadBlockMappingFromProperty(state, propertyStart, propertyStart.position - propertyStart.lineStart, flowIndent)) hasContent = true;
|
|
5887
|
-
else if (allowBlockScalars && readBlockScalar(state, flowIndent) || readSingleQuotedScalar(state, flowIndent) || readDoubleQuotedScalar(state, flowIndent)) hasContent = true;
|
|
5888
|
-
else if (readAlias(state)) {
|
|
5889
|
-
hasContent = true;
|
|
5890
|
-
if (state.tag !== null || state.anchor !== null) throwError(state, "alias node should not have any properties");
|
|
5891
|
-
} else if (readPlainScalar(state, flowIndent, CONTEXT_FLOW_IN === nodeContext)) {
|
|
5892
|
-
hasContent = true;
|
|
5893
|
-
if (state.tag === null) state.tag = "?";
|
|
5894
|
-
}
|
|
5895
|
-
if (state.anchor !== null) storeAnchor(state, state.anchor, state.result);
|
|
5896
|
-
}
|
|
5897
|
-
else if (indentStatus === 0) hasContent = allowBlockCollections && readBlockSequence(state, blockIndent);
|
|
5821
|
+
if (isEol(ch)) {
|
|
5822
|
+
simple = false;
|
|
5823
|
+
readFlowScalarBreak(state, nodeIndent);
|
|
5824
|
+
} else if (state.position === state.lineStart && testDocumentSeparator(state)) throwError(state, "unexpected end of the document within a single quoted scalar");
|
|
5825
|
+
else if (ch !== 9 && ch < 32) throwError(state, "expected valid JSON character");
|
|
5826
|
+
else state.position++;
|
|
5827
|
+
}
|
|
5828
|
+
throwError(state, "unexpected end of the stream within a single quoted scalar");
|
|
5829
|
+
}
|
|
5830
|
+
function readDoubleQuotedScalar(state, nodeIndent, props) {
|
|
5831
|
+
if (state.input.charCodeAt(state.position) !== 34) return false;
|
|
5832
|
+
state.position++;
|
|
5833
|
+
const start = state.position;
|
|
5834
|
+
let simple = true;
|
|
5835
|
+
while (state.input.charCodeAt(state.position) !== 0) {
|
|
5836
|
+
const ch = state.input.charCodeAt(state.position);
|
|
5837
|
+
if (ch === 34) {
|
|
5838
|
+
const end = state.position;
|
|
5839
|
+
state.position++;
|
|
5840
|
+
addScalarEvent(state, start, end, props.anchorStart, props.anchorEnd, props.tagStart, props.tagEnd, 3, 1, -1, simple);
|
|
5841
|
+
return true;
|
|
5898
5842
|
}
|
|
5899
|
-
if (
|
|
5900
|
-
|
|
5901
|
-
|
|
5902
|
-
if (
|
|
5903
|
-
|
|
5904
|
-
type = state.implicitTypes[typeIndex];
|
|
5905
|
-
if (type.resolve(state.result)) {
|
|
5906
|
-
state.result = type.construct(state.result);
|
|
5907
|
-
state.tag = type.tag;
|
|
5908
|
-
if (state.anchor !== null) storeAnchor(state, state.anchor, state.result);
|
|
5909
|
-
break;
|
|
5910
|
-
}
|
|
5911
|
-
}
|
|
5912
|
-
} else if (state.tag !== "!") {
|
|
5913
|
-
if (_hasOwnProperty.call(state.typeMap[state.kind || "fallback"], state.tag)) type = state.typeMap[state.kind || "fallback"][state.tag];
|
|
5843
|
+
if (ch === 92) {
|
|
5844
|
+
simple = false;
|
|
5845
|
+
const escaped = state.input.charCodeAt(++state.position);
|
|
5846
|
+
if (isEol(escaped)) readFlowScalarBreak(state, nodeIndent);
|
|
5847
|
+
else if (isSimpleEscape(escaped)) state.position++;
|
|
5914
5848
|
else {
|
|
5915
|
-
|
|
5916
|
-
|
|
5917
|
-
|
|
5918
|
-
|
|
5919
|
-
|
|
5849
|
+
let hexLength = escapedHexLen(escaped);
|
|
5850
|
+
if (hexLength === 0) throwError(state, "unknown escape sequence");
|
|
5851
|
+
while (hexLength-- > 0) {
|
|
5852
|
+
state.position++;
|
|
5853
|
+
if (fromHexCode(state.input.charCodeAt(state.position)) < 0) throwError(state, "expected hexadecimal character");
|
|
5920
5854
|
}
|
|
5855
|
+
state.position++;
|
|
5921
5856
|
}
|
|
5922
|
-
|
|
5923
|
-
|
|
5924
|
-
|
|
5925
|
-
|
|
5926
|
-
|
|
5927
|
-
|
|
5928
|
-
|
|
5929
|
-
|
|
5930
|
-
|
|
5931
|
-
|
|
5932
|
-
|
|
5857
|
+
} else if (isEol(ch)) {
|
|
5858
|
+
simple = false;
|
|
5859
|
+
readFlowScalarBreak(state, nodeIndent);
|
|
5860
|
+
} else if (state.position === state.lineStart && testDocumentSeparator(state)) throwError(state, "unexpected end of the document within a double quoted scalar");
|
|
5861
|
+
else if (ch !== 9 && ch < 32) throwError(state, "expected valid JSON character");
|
|
5862
|
+
else state.position++;
|
|
5863
|
+
}
|
|
5864
|
+
throwError(state, "unexpected end of the stream within a double quoted scalar");
|
|
5865
|
+
}
|
|
5866
|
+
function readBlockScalar(state, parentIndent, props) {
|
|
5867
|
+
const ch = state.input.charCodeAt(state.position);
|
|
5868
|
+
let chomping = 1;
|
|
5869
|
+
let indent = -1;
|
|
5870
|
+
let detectedIndent = false;
|
|
5871
|
+
if (ch !== 124 && ch !== 62) return false;
|
|
5872
|
+
const style = ch === 124 ? 4 : 5;
|
|
5873
|
+
state.position++;
|
|
5874
|
+
while (state.input.charCodeAt(state.position) !== 0) {
|
|
5875
|
+
const current = state.input.charCodeAt(state.position);
|
|
5876
|
+
const digit = fromDecimalCode(current);
|
|
5877
|
+
if (current === 43 || current === 45) {
|
|
5878
|
+
if (chomping !== 1) throwError(state, "repeat of a chomping mode identifier");
|
|
5879
|
+
chomping = current === 43 ? 3 : 2;
|
|
5880
|
+
state.position++;
|
|
5881
|
+
} else if (digit >= 0) {
|
|
5882
|
+
if (digit === 0) throwError(state, "bad explicit indentation width of a block scalar; it cannot be less than one");
|
|
5883
|
+
if (detectedIndent) throwError(state, "repeat of an indentation width identifier");
|
|
5884
|
+
indent = parentIndent + digit - 1;
|
|
5885
|
+
detectedIndent = true;
|
|
5886
|
+
state.position++;
|
|
5887
|
+
} else break;
|
|
5933
5888
|
}
|
|
5934
|
-
|
|
5935
|
-
|
|
5936
|
-
|
|
5937
|
-
|
|
5938
|
-
|
|
5939
|
-
|
|
5940
|
-
|
|
5941
|
-
|
|
5942
|
-
|
|
5943
|
-
|
|
5944
|
-
|
|
5945
|
-
|
|
5946
|
-
|
|
5947
|
-
|
|
5948
|
-
|
|
5949
|
-
|
|
5950
|
-
|
|
5951
|
-
|
|
5952
|
-
if (
|
|
5953
|
-
|
|
5954
|
-
|
|
5955
|
-
|
|
5956
|
-
do
|
|
5957
|
-
ch = state.input.charCodeAt(++state.position);
|
|
5958
|
-
while (ch !== 0 && !isEol(ch));
|
|
5959
|
-
break;
|
|
5960
|
-
}
|
|
5961
|
-
if (isEol(ch)) break;
|
|
5962
|
-
_position = state.position;
|
|
5963
|
-
while (ch !== 0 && !isWsOrEol(ch)) ch = state.input.charCodeAt(++state.position);
|
|
5964
|
-
directiveArgs.push(state.input.slice(_position, state.position));
|
|
5965
|
-
}
|
|
5966
|
-
if (ch !== 0) readLineBreak(state);
|
|
5967
|
-
if (_hasOwnProperty.call(directiveHandlers, directiveName)) directiveHandlers[directiveName](state, directiveName, directiveArgs);
|
|
5968
|
-
else throwWarning(state, "unknown document directive \"" + directiveName + "\"");
|
|
5889
|
+
let hadWhitespace = false;
|
|
5890
|
+
while (isWhiteSpace(state.input.charCodeAt(state.position))) {
|
|
5891
|
+
hadWhitespace = true;
|
|
5892
|
+
state.position++;
|
|
5893
|
+
}
|
|
5894
|
+
if (hadWhitespace && state.input.charCodeAt(state.position) === 35) skipUntilLineEnd(state);
|
|
5895
|
+
if (isEol(state.input.charCodeAt(state.position))) consumeLineBreak(state);
|
|
5896
|
+
else if (state.input.charCodeAt(state.position) !== 0) throwError(state, "a line break is expected");
|
|
5897
|
+
let contentIndent = detectedIndent ? indent : -1;
|
|
5898
|
+
let maxLeadingIndent = 0;
|
|
5899
|
+
const valueStart = state.position;
|
|
5900
|
+
let valueEnd = state.position;
|
|
5901
|
+
while (state.input.charCodeAt(state.position) !== 0) {
|
|
5902
|
+
const linePosition = state.position;
|
|
5903
|
+
let column = 0;
|
|
5904
|
+
while (state.input.charCodeAt(linePosition + column) === 32) column++;
|
|
5905
|
+
const first = state.input.charCodeAt(linePosition + column);
|
|
5906
|
+
if (first === 0) {
|
|
5907
|
+
if (contentIndent >= 0) {
|
|
5908
|
+
if (column > contentIndent) valueEnd = linePosition + column;
|
|
5909
|
+
} else if (column > 0) valueEnd = linePosition + column;
|
|
5910
|
+
break;
|
|
5969
5911
|
}
|
|
5970
|
-
|
|
5971
|
-
if (
|
|
5972
|
-
|
|
5973
|
-
|
|
5974
|
-
|
|
5975
|
-
|
|
5976
|
-
|
|
5977
|
-
|
|
5978
|
-
|
|
5979
|
-
|
|
5980
|
-
if (state.input.charCodeAt(state.position) === 46) {
|
|
5981
|
-
state.position += 3;
|
|
5982
|
-
skipSeparationSpace(state, true, -1);
|
|
5912
|
+
if (linePosition === state.lineStart && testDocumentSeparator(state, linePosition)) break;
|
|
5913
|
+
if (!detectedIndent && contentIndent === -1 && isEol(first)) maxLeadingIndent = Math.max(maxLeadingIndent, column);
|
|
5914
|
+
if (!detectedIndent && contentIndent === -1 && !isEol(first)) {
|
|
5915
|
+
if (first === 9 && column < parentIndent) {
|
|
5916
|
+
state.position = linePosition + column;
|
|
5917
|
+
throwError(state, "tab characters must not be used in indentation");
|
|
5918
|
+
}
|
|
5919
|
+
if (column < maxLeadingIndent) {
|
|
5920
|
+
state.position = linePosition + column;
|
|
5921
|
+
throwError(state, "bad indentation of a mapping entry");
|
|
5983
5922
|
}
|
|
5984
|
-
return;
|
|
5985
|
-
}
|
|
5986
|
-
if (state.position < state.length - 1) throwError(state, "end of the stream or a document separator is expected");
|
|
5987
|
-
}
|
|
5988
|
-
function loadDocuments(input, options) {
|
|
5989
|
-
input = String(input);
|
|
5990
|
-
options = options || {};
|
|
5991
|
-
if (input.length !== 0) {
|
|
5992
|
-
if (input.charCodeAt(input.length - 1) !== 10 && input.charCodeAt(input.length - 1) !== 13) input += "\n";
|
|
5993
|
-
if (input.charCodeAt(0) === 65279) input = input.slice(1);
|
|
5994
|
-
}
|
|
5995
|
-
const state = new State(input, options);
|
|
5996
|
-
const nullpos = input.indexOf("\0");
|
|
5997
|
-
if (nullpos !== -1) {
|
|
5998
|
-
state.position = nullpos;
|
|
5999
|
-
throwError(state, "null byte is not allowed in input");
|
|
6000
5923
|
}
|
|
6001
|
-
|
|
6002
|
-
|
|
6003
|
-
state.
|
|
6004
|
-
|
|
5924
|
+
if (contentIndent === -1 && first !== 0 && !isEol(first) && column < parentIndent) {
|
|
5925
|
+
state.lineIndent = column;
|
|
5926
|
+
state.position = linePosition + column;
|
|
5927
|
+
break;
|
|
6005
5928
|
}
|
|
6006
|
-
|
|
6007
|
-
|
|
6008
|
-
|
|
6009
|
-
|
|
6010
|
-
|
|
6011
|
-
|
|
6012
|
-
iterator = null;
|
|
5929
|
+
if (!detectedIndent && first !== 0 && !isEol(first) && contentIndent === -1) contentIndent = column;
|
|
5930
|
+
const requiredIndent = contentIndent === -1 ? parentIndent + 1 : contentIndent;
|
|
5931
|
+
if (first !== 0 && !isEol(first) && column < requiredIndent) {
|
|
5932
|
+
state.lineIndent = column;
|
|
5933
|
+
state.position = linePosition + column;
|
|
5934
|
+
break;
|
|
6013
5935
|
}
|
|
6014
|
-
|
|
6015
|
-
|
|
6016
|
-
|
|
6017
|
-
|
|
6018
|
-
|
|
6019
|
-
const documents = loadDocuments(input, options);
|
|
6020
|
-
if (documents.length === 0) return;
|
|
6021
|
-
else if (documents.length === 1) return documents[0];
|
|
6022
|
-
throw new YAMLException("expected a single document in the stream, but found more");
|
|
6023
|
-
}
|
|
6024
|
-
module.exports.loadAll = loadAll;
|
|
6025
|
-
module.exports.load = load;
|
|
6026
|
-
}));
|
|
6027
|
-
//#endregion
|
|
6028
|
-
//#region lib/dumper.js
|
|
6029
|
-
var require_dumper = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
6030
|
-
var common = require_common();
|
|
6031
|
-
var YAMLException = require_exception();
|
|
6032
|
-
var DEFAULT_SCHEMA = require_default();
|
|
6033
|
-
var _toString = Object.prototype.toString;
|
|
6034
|
-
var _hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
6035
|
-
var CHAR_BOM = 65279;
|
|
6036
|
-
var CHAR_TAB = 9;
|
|
6037
|
-
var CHAR_LINE_FEED = 10;
|
|
6038
|
-
var CHAR_CARRIAGE_RETURN = 13;
|
|
6039
|
-
var CHAR_SPACE = 32;
|
|
6040
|
-
var CHAR_EXCLAMATION = 33;
|
|
6041
|
-
var CHAR_DOUBLE_QUOTE = 34;
|
|
6042
|
-
var CHAR_SHARP = 35;
|
|
6043
|
-
var CHAR_PERCENT = 37;
|
|
6044
|
-
var CHAR_AMPERSAND = 38;
|
|
6045
|
-
var CHAR_SINGLE_QUOTE = 39;
|
|
6046
|
-
var CHAR_ASTERISK = 42;
|
|
6047
|
-
var CHAR_COMMA = 44;
|
|
6048
|
-
var CHAR_MINUS = 45;
|
|
6049
|
-
var CHAR_COLON = 58;
|
|
6050
|
-
var CHAR_EQUALS = 61;
|
|
6051
|
-
var CHAR_GREATER_THAN = 62;
|
|
6052
|
-
var CHAR_QUESTION = 63;
|
|
6053
|
-
var CHAR_COMMERCIAL_AT = 64;
|
|
6054
|
-
var CHAR_LEFT_SQUARE_BRACKET = 91;
|
|
6055
|
-
var CHAR_RIGHT_SQUARE_BRACKET = 93;
|
|
6056
|
-
var CHAR_GRAVE_ACCENT = 96;
|
|
6057
|
-
var CHAR_LEFT_CURLY_BRACKET = 123;
|
|
6058
|
-
var CHAR_VERTICAL_LINE = 124;
|
|
6059
|
-
var CHAR_RIGHT_CURLY_BRACKET = 125;
|
|
6060
|
-
var ESCAPE_SEQUENCES = {};
|
|
6061
|
-
ESCAPE_SEQUENCES[0] = "\\0";
|
|
6062
|
-
ESCAPE_SEQUENCES[7] = "\\a";
|
|
6063
|
-
ESCAPE_SEQUENCES[8] = "\\b";
|
|
6064
|
-
ESCAPE_SEQUENCES[9] = "\\t";
|
|
6065
|
-
ESCAPE_SEQUENCES[10] = "\\n";
|
|
6066
|
-
ESCAPE_SEQUENCES[11] = "\\v";
|
|
6067
|
-
ESCAPE_SEQUENCES[12] = "\\f";
|
|
6068
|
-
ESCAPE_SEQUENCES[13] = "\\r";
|
|
6069
|
-
ESCAPE_SEQUENCES[27] = "\\e";
|
|
6070
|
-
ESCAPE_SEQUENCES[34] = "\\\"";
|
|
6071
|
-
ESCAPE_SEQUENCES[92] = "\\\\";
|
|
6072
|
-
ESCAPE_SEQUENCES[133] = "\\N";
|
|
6073
|
-
ESCAPE_SEQUENCES[160] = "\\_";
|
|
6074
|
-
ESCAPE_SEQUENCES[8232] = "\\L";
|
|
6075
|
-
ESCAPE_SEQUENCES[8233] = "\\P";
|
|
6076
|
-
var DEPRECATED_BOOLEANS_SYNTAX = [
|
|
6077
|
-
"y",
|
|
6078
|
-
"Y",
|
|
6079
|
-
"yes",
|
|
6080
|
-
"Yes",
|
|
6081
|
-
"YES",
|
|
6082
|
-
"on",
|
|
6083
|
-
"On",
|
|
6084
|
-
"ON",
|
|
6085
|
-
"n",
|
|
6086
|
-
"N",
|
|
6087
|
-
"no",
|
|
6088
|
-
"No",
|
|
6089
|
-
"NO",
|
|
6090
|
-
"off",
|
|
6091
|
-
"Off",
|
|
6092
|
-
"OFF"
|
|
6093
|
-
];
|
|
6094
|
-
var DEPRECATED_BASE60_SYNTAX = /^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;
|
|
6095
|
-
function compileStyleMap(schema, map) {
|
|
6096
|
-
if (map === null) return {};
|
|
6097
|
-
const result = {};
|
|
6098
|
-
const keys = Object.keys(map);
|
|
6099
|
-
for (let index = 0, length = keys.length; index < length; index += 1) {
|
|
6100
|
-
let tag = keys[index];
|
|
6101
|
-
let style = String(map[tag]);
|
|
6102
|
-
if (tag.slice(0, 2) === "!!") tag = "tag:yaml.org,2002:" + tag.slice(2);
|
|
6103
|
-
const type = schema.compiledTypeMap["fallback"][tag];
|
|
6104
|
-
if (type && _hasOwnProperty.call(type.styleAliases, style)) style = type.styleAliases[style];
|
|
6105
|
-
result[tag] = style;
|
|
5936
|
+
skipUntilLineEnd(state);
|
|
5937
|
+
valueEnd = state.position;
|
|
5938
|
+
if (isEol(state.input.charCodeAt(state.position))) {
|
|
5939
|
+
consumeLineBreak(state);
|
|
5940
|
+
valueEnd = state.position;
|
|
6106
5941
|
}
|
|
6107
|
-
return result;
|
|
6108
5942
|
}
|
|
6109
|
-
|
|
6110
|
-
|
|
6111
|
-
|
|
6112
|
-
|
|
6113
|
-
|
|
6114
|
-
|
|
6115
|
-
|
|
6116
|
-
|
|
6117
|
-
|
|
6118
|
-
|
|
6119
|
-
|
|
6120
|
-
|
|
6121
|
-
|
|
6122
|
-
|
|
6123
|
-
|
|
6124
|
-
|
|
6125
|
-
|
|
6126
|
-
|
|
6127
|
-
|
|
6128
|
-
|
|
6129
|
-
|
|
6130
|
-
|
|
6131
|
-
|
|
6132
|
-
|
|
6133
|
-
|
|
6134
|
-
|
|
6135
|
-
|
|
6136
|
-
|
|
6137
|
-
|
|
6138
|
-
|
|
6139
|
-
|
|
6140
|
-
|
|
6141
|
-
|
|
6142
|
-
|
|
6143
|
-
|
|
6144
|
-
|
|
6145
|
-
|
|
6146
|
-
|
|
6147
|
-
|
|
6148
|
-
}
|
|
6149
|
-
function indentString(string, spaces) {
|
|
6150
|
-
const ind = common.repeat(" ", spaces);
|
|
6151
|
-
let position = 0;
|
|
6152
|
-
let result = "";
|
|
6153
|
-
const length = string.length;
|
|
6154
|
-
while (position < length) {
|
|
6155
|
-
let line;
|
|
6156
|
-
const next = string.indexOf("\n", position);
|
|
6157
|
-
if (next === -1) {
|
|
6158
|
-
line = string.slice(position);
|
|
6159
|
-
position = length;
|
|
6160
|
-
} else {
|
|
6161
|
-
line = string.slice(position, next + 1);
|
|
6162
|
-
position = next + 1;
|
|
5943
|
+
checkPrintable(state, valueStart, valueEnd);
|
|
5944
|
+
addScalarEvent(state, valueStart, valueEnd, props.anchorStart, props.anchorEnd, props.tagStart, props.tagEnd, style, chomping, contentIndent);
|
|
5945
|
+
return true;
|
|
5946
|
+
}
|
|
5947
|
+
function canStartPlainScalar(state, nodeContext) {
|
|
5948
|
+
const ch = state.input.charCodeAt(state.position);
|
|
5949
|
+
const inFlow = nodeContext === CONTEXT_FLOW_IN;
|
|
5950
|
+
if (ch === 0 || isWsOrEol(ch) || ch === 35 || ch === 38 || ch === 42 || ch === 33 || ch === 124 || ch === 62 || ch === 39 || ch === 34 || ch === 37 || ch === 64 || ch === 96 || inFlow && isFlowIndicator(ch)) return false;
|
|
5951
|
+
if (ch === 63 || ch === 45) {
|
|
5952
|
+
const following = state.input.charCodeAt(state.position + 1);
|
|
5953
|
+
if (isWsOrEolOrEnd(following) || inFlow && isFlowIndicator(following)) return false;
|
|
5954
|
+
}
|
|
5955
|
+
return true;
|
|
5956
|
+
}
|
|
5957
|
+
function readPlainScalar(state, nodeIndent, nodeContext, props) {
|
|
5958
|
+
if (!canStartPlainScalar(state, nodeContext)) return false;
|
|
5959
|
+
const start = state.position;
|
|
5960
|
+
let end = state.position;
|
|
5961
|
+
let ch = state.input.charCodeAt(state.position);
|
|
5962
|
+
const inFlow = nodeContext === CONTEXT_FLOW_IN;
|
|
5963
|
+
let multiline = false;
|
|
5964
|
+
while (ch !== 0) {
|
|
5965
|
+
if (state.position === state.lineStart && testDocumentSeparator(state)) break;
|
|
5966
|
+
if (ch === 58) {
|
|
5967
|
+
const following = state.input.charCodeAt(state.position + 1);
|
|
5968
|
+
if (isWsOrEolOrEnd(following) || inFlow && isFlowIndicator(following)) break;
|
|
5969
|
+
} else if (ch === 35) {
|
|
5970
|
+
if (isWsOrEol(state.input.charCodeAt(state.position - 1))) break;
|
|
5971
|
+
} else if (inFlow && isFlowIndicator(ch)) break;
|
|
5972
|
+
else if (isEol(ch)) {
|
|
5973
|
+
const savedPosition = state.position;
|
|
5974
|
+
const savedLine = state.line;
|
|
5975
|
+
const savedLineStart = state.lineStart;
|
|
5976
|
+
const savedLineIndent = state.lineIndent;
|
|
5977
|
+
skipSeparationSpace(state, false);
|
|
5978
|
+
if (state.lineIndent >= nodeIndent) {
|
|
5979
|
+
multiline = true;
|
|
5980
|
+
ch = state.input.charCodeAt(state.position);
|
|
5981
|
+
continue;
|
|
6163
5982
|
}
|
|
6164
|
-
|
|
6165
|
-
|
|
5983
|
+
state.position = savedPosition;
|
|
5984
|
+
state.line = savedLine;
|
|
5985
|
+
state.lineStart = savedLineStart;
|
|
5986
|
+
state.lineIndent = savedLineIndent;
|
|
5987
|
+
break;
|
|
6166
5988
|
}
|
|
6167
|
-
|
|
6168
|
-
|
|
6169
|
-
function generateNextLine(state, level) {
|
|
6170
|
-
return "\n" + common.repeat(" ", state.indent * level);
|
|
6171
|
-
}
|
|
6172
|
-
function testImplicitResolving(state, str) {
|
|
6173
|
-
for (let index = 0, length = state.implicitTypes.length; index < length; index += 1) if (state.implicitTypes[index].resolve(str)) return true;
|
|
6174
|
-
return false;
|
|
6175
|
-
}
|
|
6176
|
-
function isWhitespace(c) {
|
|
6177
|
-
return c === CHAR_SPACE || c === CHAR_TAB;
|
|
6178
|
-
}
|
|
6179
|
-
function isPrintable(c) {
|
|
6180
|
-
return c >= 32 && c <= 126 || c >= 161 && c <= 55295 && c !== 8232 && c !== 8233 || c >= 57344 && c <= 65533 && c !== CHAR_BOM || c >= 65536 && c <= 1114111;
|
|
6181
|
-
}
|
|
6182
|
-
function isNsCharOrWhitespace(c) {
|
|
6183
|
-
return isPrintable(c) && c !== CHAR_BOM && c !== CHAR_CARRIAGE_RETURN && c !== CHAR_LINE_FEED;
|
|
6184
|
-
}
|
|
6185
|
-
function isPlainSafe(c, prev, inblock) {
|
|
6186
|
-
const cIsNsCharOrWhitespace = isNsCharOrWhitespace(c);
|
|
6187
|
-
const cIsNsChar = cIsNsCharOrWhitespace && !isWhitespace(c);
|
|
6188
|
-
return (inblock ? cIsNsCharOrWhitespace : cIsNsCharOrWhitespace && c !== CHAR_COMMA && c !== CHAR_LEFT_SQUARE_BRACKET && c !== CHAR_RIGHT_SQUARE_BRACKET && c !== CHAR_LEFT_CURLY_BRACKET && c !== CHAR_RIGHT_CURLY_BRACKET) && c !== CHAR_SHARP && !(prev === CHAR_COLON && !cIsNsChar) || isNsCharOrWhitespace(prev) && !isWhitespace(prev) && c === CHAR_SHARP || prev === CHAR_COLON && cIsNsChar;
|
|
6189
|
-
}
|
|
6190
|
-
function isPlainSafeFirst(c) {
|
|
6191
|
-
return isPrintable(c) && c !== CHAR_BOM && !isWhitespace(c) && c !== CHAR_MINUS && c !== CHAR_QUESTION && c !== CHAR_COLON && c !== CHAR_COMMA && c !== CHAR_LEFT_SQUARE_BRACKET && c !== CHAR_RIGHT_SQUARE_BRACKET && c !== CHAR_LEFT_CURLY_BRACKET && c !== CHAR_RIGHT_CURLY_BRACKET && c !== CHAR_SHARP && c !== CHAR_AMPERSAND && c !== CHAR_ASTERISK && c !== CHAR_EXCLAMATION && c !== CHAR_VERTICAL_LINE && c !== CHAR_EQUALS && c !== CHAR_GREATER_THAN && c !== CHAR_SINGLE_QUOTE && c !== CHAR_DOUBLE_QUOTE && c !== CHAR_PERCENT && c !== CHAR_COMMERCIAL_AT && c !== CHAR_GRAVE_ACCENT;
|
|
6192
|
-
}
|
|
6193
|
-
function isPlainSafeLast(c) {
|
|
6194
|
-
return !isWhitespace(c) && c !== CHAR_COLON;
|
|
5989
|
+
if (!isWhiteSpace(ch)) end = state.position + 1;
|
|
5990
|
+
ch = state.input.charCodeAt(++state.position);
|
|
6195
5991
|
}
|
|
6196
|
-
|
|
6197
|
-
|
|
6198
|
-
|
|
6199
|
-
|
|
6200
|
-
|
|
6201
|
-
|
|
6202
|
-
|
|
6203
|
-
|
|
6204
|
-
|
|
6205
|
-
|
|
6206
|
-
|
|
6207
|
-
|
|
6208
|
-
|
|
6209
|
-
|
|
6210
|
-
|
|
6211
|
-
|
|
6212
|
-
|
|
6213
|
-
|
|
6214
|
-
|
|
6215
|
-
|
|
6216
|
-
|
|
6217
|
-
|
|
6218
|
-
let
|
|
6219
|
-
|
|
6220
|
-
|
|
6221
|
-
|
|
6222
|
-
|
|
6223
|
-
|
|
6224
|
-
|
|
6225
|
-
|
|
6226
|
-
|
|
6227
|
-
|
|
6228
|
-
|
|
6229
|
-
|
|
6230
|
-
|
|
6231
|
-
if (char === CHAR_LINE_FEED) {
|
|
6232
|
-
hasLineBreak = true;
|
|
6233
|
-
if (shouldTrackWidth) {
|
|
6234
|
-
hasFoldableLine = hasFoldableLine || i - previousLineBreak - 1 > lineWidth && string[previousLineBreak + 1] !== " ";
|
|
6235
|
-
previousLineBreak = i;
|
|
6236
|
-
}
|
|
6237
|
-
} else if (!isPrintable(char)) return STYLE_DOUBLE;
|
|
6238
|
-
plain = plain && isPlainSafe(char, prevChar, inblock);
|
|
6239
|
-
prevChar = char;
|
|
6240
|
-
}
|
|
6241
|
-
hasFoldableLine = hasFoldableLine || shouldTrackWidth && i - previousLineBreak - 1 > lineWidth && string[previousLineBreak + 1] !== " ";
|
|
6242
|
-
}
|
|
6243
|
-
if (!hasLineBreak && !hasFoldableLine) {
|
|
6244
|
-
if (plain && !forceQuotes && !testAmbiguousType(string)) return STYLE_PLAIN;
|
|
6245
|
-
return quotingType === QUOTING_TYPE_DOUBLE ? STYLE_DOUBLE : STYLE_SINGLE;
|
|
5992
|
+
if (end === start) return false;
|
|
5993
|
+
checkPrintable(state, start, end);
|
|
5994
|
+
addScalarEvent(state, start, end, props.anchorStart, props.anchorEnd, props.tagStart, props.tagEnd, 1, 1, -1, !multiline);
|
|
5995
|
+
return true;
|
|
5996
|
+
}
|
|
5997
|
+
function skipFlowSeparationSpace(state, nodeIndent) {
|
|
5998
|
+
const startLine = state.line;
|
|
5999
|
+
skipSeparationSpace(state, true);
|
|
6000
|
+
if (state.line > startLine && state.lineIndent < nodeIndent || state.firstTabInLine !== -1 && state.lineIndent < nodeIndent) throwError(state, "deficient indentation");
|
|
6001
|
+
}
|
|
6002
|
+
function readFlowCollection(state, nodeIndent, props) {
|
|
6003
|
+
const ch = state.input.charCodeAt(state.position);
|
|
6004
|
+
const isMapping = ch === 123;
|
|
6005
|
+
const start = state.position;
|
|
6006
|
+
let readNext = true;
|
|
6007
|
+
if (ch !== 91 && ch !== 123) return false;
|
|
6008
|
+
const terminator = isMapping ? 125 : 93;
|
|
6009
|
+
if (isMapping) addMappingEvent(state, start, props.anchorStart, props.anchorEnd, props.tagStart, props.tagEnd, 2);
|
|
6010
|
+
else addSequenceEvent(state, start, props.anchorStart, props.anchorEnd, props.tagStart, props.tagEnd, 2);
|
|
6011
|
+
state.position++;
|
|
6012
|
+
while (state.input.charCodeAt(state.position) !== 0) {
|
|
6013
|
+
skipFlowSeparationSpace(state, nodeIndent);
|
|
6014
|
+
let ch = state.input.charCodeAt(state.position);
|
|
6015
|
+
if (ch === terminator) {
|
|
6016
|
+
state.position++;
|
|
6017
|
+
addPopEvent(state);
|
|
6018
|
+
return true;
|
|
6019
|
+
} else if (!readNext) throwError(state, "missed comma between flow collection entries");
|
|
6020
|
+
else if (ch === 44) throwError(state, "expected the node content, but found ','");
|
|
6021
|
+
let isPair = false;
|
|
6022
|
+
let isExplicitPair = false;
|
|
6023
|
+
if (ch === 63 && isWsOrEol(state.input.charCodeAt(state.position + 1))) {
|
|
6024
|
+
isPair = isExplicitPair = true;
|
|
6025
|
+
state.position += 1;
|
|
6026
|
+
skipFlowSeparationSpace(state, nodeIndent);
|
|
6246
6027
|
}
|
|
6247
|
-
|
|
6248
|
-
|
|
6249
|
-
|
|
6250
|
-
|
|
6251
|
-
|
|
6252
|
-
state.
|
|
6253
|
-
|
|
6254
|
-
|
|
6255
|
-
|
|
6256
|
-
|
|
6257
|
-
|
|
6258
|
-
|
|
6259
|
-
|
|
6260
|
-
|
|
6261
|
-
|
|
6262
|
-
|
|
6263
|
-
|
|
6264
|
-
|
|
6265
|
-
|
|
6266
|
-
|
|
6267
|
-
|
|
6268
|
-
|
|
6269
|
-
|
|
6270
|
-
|
|
6271
|
-
|
|
6272
|
-
|
|
6273
|
-
|
|
6274
|
-
|
|
6275
|
-
|
|
6276
|
-
|
|
6277
|
-
}
|
|
6278
|
-
function dropEndingNewline(string) {
|
|
6279
|
-
return string[string.length - 1] === "\n" ? string.slice(0, -1) : string;
|
|
6280
|
-
}
|
|
6281
|
-
function foldString(string, width) {
|
|
6282
|
-
const lineRe = /(\n+)([^\n]*)/g;
|
|
6283
|
-
let result = function() {
|
|
6284
|
-
let nextLF = string.indexOf("\n");
|
|
6285
|
-
nextLF = nextLF !== -1 ? nextLF : string.length;
|
|
6286
|
-
lineRe.lastIndex = nextLF;
|
|
6287
|
-
return foldLine(string.slice(0, nextLF), width);
|
|
6288
|
-
}();
|
|
6289
|
-
let prevMoreIndented = string[0] === "\n" || string[0] === " ";
|
|
6290
|
-
let moreIndented;
|
|
6291
|
-
let match;
|
|
6292
|
-
while (match = lineRe.exec(string)) {
|
|
6293
|
-
const prefix = match[1];
|
|
6294
|
-
const line = match[2];
|
|
6295
|
-
moreIndented = line[0] === " ";
|
|
6296
|
-
result += prefix + (!prevMoreIndented && !moreIndented && line !== "" ? "\n" : "") + foldLine(line, width);
|
|
6297
|
-
prevMoreIndented = moreIndented;
|
|
6028
|
+
const entryLine = state.line;
|
|
6029
|
+
const entryStart = snapshotState(state);
|
|
6030
|
+
const keyWasRead = parseNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true);
|
|
6031
|
+
skipFlowSeparationSpace(state, nodeIndent);
|
|
6032
|
+
ch = state.input.charCodeAt(state.position);
|
|
6033
|
+
if ((isMapping || isExplicitPair || state.line === entryLine) && ch === 58) {
|
|
6034
|
+
isPair = true;
|
|
6035
|
+
state.position++;
|
|
6036
|
+
skipFlowSeparationSpace(state, nodeIndent);
|
|
6037
|
+
if (!isMapping) {
|
|
6038
|
+
restoreState(state, entryStart);
|
|
6039
|
+
addMappingEvent(state, entryStart.position, NO_RANGE$1, NO_RANGE$1, NO_RANGE$1, NO_RANGE$1, 2);
|
|
6040
|
+
if (!parseNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true)) addEmptyScalarEvent(state);
|
|
6041
|
+
skipFlowSeparationSpace(state, nodeIndent);
|
|
6042
|
+
state.position++;
|
|
6043
|
+
skipFlowSeparationSpace(state, nodeIndent);
|
|
6044
|
+
} else if (!keyWasRead) addEmptyScalarEvent(state);
|
|
6045
|
+
if (!parseNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true)) addEmptyScalarEvent(state);
|
|
6046
|
+
skipFlowSeparationSpace(state, nodeIndent);
|
|
6047
|
+
if (!isMapping) addPopEvent(state);
|
|
6048
|
+
} else if (isMapping && isPair) {
|
|
6049
|
+
if (!keyWasRead) addEmptyScalarEvent(state);
|
|
6050
|
+
addEmptyScalarEvent(state);
|
|
6051
|
+
} else if (isMapping) addEmptyScalarEvent(state);
|
|
6052
|
+
else if (isPair) {
|
|
6053
|
+
restoreState(state, entryStart);
|
|
6054
|
+
addMappingEvent(state, entryStart.position, NO_RANGE$1, NO_RANGE$1, NO_RANGE$1, NO_RANGE$1, 2);
|
|
6055
|
+
parseNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true);
|
|
6056
|
+
addEmptyScalarEvent(state);
|
|
6057
|
+
addPopEvent(state);
|
|
6298
6058
|
}
|
|
6299
|
-
|
|
6059
|
+
ch = state.input.charCodeAt(state.position);
|
|
6060
|
+
if (ch === 44) {
|
|
6061
|
+
readNext = true;
|
|
6062
|
+
state.position++;
|
|
6063
|
+
} else readNext = false;
|
|
6300
6064
|
}
|
|
6301
|
-
|
|
6302
|
-
|
|
6303
|
-
|
|
6304
|
-
|
|
6305
|
-
|
|
6306
|
-
|
|
6307
|
-
|
|
6308
|
-
|
|
6309
|
-
|
|
6310
|
-
while (match = breakRe.exec(line)) {
|
|
6311
|
-
next = match.index;
|
|
6312
|
-
if (next - start > width) {
|
|
6313
|
-
end = curr > start ? curr : next;
|
|
6314
|
-
result += "\n" + line.slice(start, end);
|
|
6315
|
-
start = end + 1;
|
|
6316
|
-
}
|
|
6317
|
-
curr = next;
|
|
6065
|
+
throwError(state, "unexpected end of the stream within a flow collection");
|
|
6066
|
+
}
|
|
6067
|
+
function readBlockSequence(state, nodeIndent, props) {
|
|
6068
|
+
if (state.firstTabInLine !== -1 || state.input.charCodeAt(state.position) !== 45 || !isWsOrEolOrEnd(state.input.charCodeAt(state.position + 1))) return false;
|
|
6069
|
+
addSequenceEvent(state, state.position, props.anchorStart, props.anchorEnd, props.tagStart, props.tagEnd, 1);
|
|
6070
|
+
while (state.input.charCodeAt(state.position) === 45 && isWsOrEolOrEnd(state.input.charCodeAt(state.position + 1))) {
|
|
6071
|
+
if (state.firstTabInLine !== -1) {
|
|
6072
|
+
state.position = state.firstTabInLine;
|
|
6073
|
+
throwError(state, "tab characters must not be used in indentation");
|
|
6318
6074
|
}
|
|
6319
|
-
|
|
6320
|
-
|
|
6321
|
-
|
|
6322
|
-
|
|
6323
|
-
|
|
6324
|
-
|
|
6325
|
-
|
|
6326
|
-
|
|
6327
|
-
|
|
6328
|
-
|
|
6329
|
-
|
|
6330
|
-
|
|
6331
|
-
|
|
6332
|
-
|
|
6333
|
-
|
|
6075
|
+
const entryLine = state.line;
|
|
6076
|
+
state.position++;
|
|
6077
|
+
const hadBreak = skipSeparationSpace(state, true) > 0;
|
|
6078
|
+
if (state.firstTabInLine !== -1 && state.input.charCodeAt(state.position) === 45 && isWsOrEolOrEnd(state.input.charCodeAt(state.position + 1))) throwError(state, "bad indentation of a sequence entry");
|
|
6079
|
+
if (hadBreak && state.lineIndent <= nodeIndent) addEmptyScalarEvent(state);
|
|
6080
|
+
else parseNode(state, nodeIndent, CONTEXT_BLOCK_IN, false, true);
|
|
6081
|
+
skipSeparationSpace(state, true);
|
|
6082
|
+
if (state.lineIndent < nodeIndent || state.position >= state.length) break;
|
|
6083
|
+
if (state.lineIndent > nodeIndent) throwError(state, "bad indentation of a sequence entry");
|
|
6084
|
+
if (state.line === entryLine && state.input.charCodeAt(state.position) === 45 && isWsOrEolOrEnd(state.input.charCodeAt(state.position + 1))) throwError(state, "bad indentation of a sequence entry");
|
|
6085
|
+
}
|
|
6086
|
+
addPopEvent(state);
|
|
6087
|
+
return true;
|
|
6088
|
+
}
|
|
6089
|
+
function readBlockMapping(state, nodeIndent, flowIndent, props) {
|
|
6090
|
+
let atExplicitKey = false;
|
|
6091
|
+
let detected = false;
|
|
6092
|
+
let mappingOpened = false;
|
|
6093
|
+
let pendingExplicitKey = false;
|
|
6094
|
+
if (state.firstTabInLine !== -1) return false;
|
|
6095
|
+
let ch = state.input.charCodeAt(state.position);
|
|
6096
|
+
while (ch !== 0) {
|
|
6097
|
+
if (!atExplicitKey && state.firstTabInLine !== -1) {
|
|
6098
|
+
state.position = state.firstTabInLine;
|
|
6099
|
+
throwError(state, "tab characters must not be used in indentation");
|
|
6334
6100
|
}
|
|
6335
|
-
|
|
6336
|
-
|
|
6337
|
-
|
|
6338
|
-
|
|
6339
|
-
|
|
6340
|
-
|
|
6341
|
-
let value = object[index];
|
|
6342
|
-
if (state.replacer) value = state.replacer.call(object, String(index), value);
|
|
6343
|
-
if (writeNode(state, level, value, false, false) || typeof value === "undefined" && writeNode(state, level, null, false, false)) {
|
|
6344
|
-
if (_result !== "") _result += "," + (!state.condenseFlow ? " " : "");
|
|
6345
|
-
_result += state.dump;
|
|
6101
|
+
const following = state.input.charCodeAt(state.position + 1);
|
|
6102
|
+
const entryLine = state.line;
|
|
6103
|
+
if ((ch === 63 || ch === 58) && isWsOrEolOrEnd(following)) {
|
|
6104
|
+
if (!mappingOpened) {
|
|
6105
|
+
addMappingEvent(state, state.position, props.anchorStart, props.anchorEnd, props.tagStart, props.tagEnd, 1);
|
|
6106
|
+
mappingOpened = true;
|
|
6346
6107
|
}
|
|
6347
|
-
|
|
6348
|
-
|
|
6349
|
-
|
|
6350
|
-
|
|
6351
|
-
|
|
6352
|
-
|
|
6353
|
-
|
|
6354
|
-
|
|
6355
|
-
|
|
6356
|
-
if (state.replacer) value = state.replacer.call(object, String(index), value);
|
|
6357
|
-
if (writeNode(state, level + 1, value, true, true, false, true) || typeof value === "undefined" && writeNode(state, level + 1, null, true, true, false, true)) {
|
|
6358
|
-
if (!compact || _result !== "") _result += generateNextLine(state, level);
|
|
6359
|
-
if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) _result += "-";
|
|
6360
|
-
else _result += "- ";
|
|
6361
|
-
_result += state.dump;
|
|
6108
|
+
if (ch === 63) {
|
|
6109
|
+
if (atExplicitKey) addEmptyScalarEvent(state);
|
|
6110
|
+
detected = true;
|
|
6111
|
+
atExplicitKey = true;
|
|
6112
|
+
} else if (atExplicitKey) atExplicitKey = false;
|
|
6113
|
+
else {
|
|
6114
|
+
addEmptyScalarEvent(state);
|
|
6115
|
+
detected = true;
|
|
6116
|
+
atExplicitKey = false;
|
|
6362
6117
|
}
|
|
6363
|
-
|
|
6364
|
-
|
|
6365
|
-
|
|
6366
|
-
|
|
6367
|
-
|
|
6368
|
-
|
|
6369
|
-
|
|
6370
|
-
|
|
6371
|
-
|
|
6372
|
-
|
|
6373
|
-
|
|
6374
|
-
|
|
6375
|
-
|
|
6376
|
-
|
|
6377
|
-
|
|
6378
|
-
|
|
6379
|
-
|
|
6380
|
-
|
|
6381
|
-
|
|
6382
|
-
|
|
6383
|
-
|
|
6384
|
-
|
|
6385
|
-
|
|
6386
|
-
|
|
6387
|
-
|
|
6388
|
-
|
|
6389
|
-
|
|
6390
|
-
|
|
6391
|
-
|
|
6392
|
-
|
|
6393
|
-
|
|
6394
|
-
|
|
6395
|
-
|
|
6396
|
-
|
|
6397
|
-
|
|
6398
|
-
|
|
6399
|
-
|
|
6400
|
-
|
|
6401
|
-
|
|
6402
|
-
|
|
6403
|
-
if (explicitPair) if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) pairBuffer += "?";
|
|
6404
|
-
else pairBuffer += "? ";
|
|
6405
|
-
pairBuffer += state.dump;
|
|
6406
|
-
if (explicitPair) pairBuffer += generateNextLine(state, level);
|
|
6407
|
-
if (!writeNode(state, level + 1, objectValue, true, explicitPair)) continue;
|
|
6408
|
-
if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) pairBuffer += ":";
|
|
6409
|
-
else pairBuffer += ": ";
|
|
6410
|
-
pairBuffer += state.dump;
|
|
6411
|
-
_result += pairBuffer;
|
|
6412
|
-
}
|
|
6413
|
-
state.tag = _tag;
|
|
6414
|
-
state.dump = _result || "{}";
|
|
6415
|
-
}
|
|
6416
|
-
function detectType(state, object, explicit) {
|
|
6417
|
-
const typeList = explicit ? state.explicitTypes : state.implicitTypes;
|
|
6418
|
-
for (let index = 0, length = typeList.length; index < length; index += 1) {
|
|
6419
|
-
const type = typeList[index];
|
|
6420
|
-
if ((type.instanceOf || type.predicate) && (!type.instanceOf || typeof object === "object" && object instanceof type.instanceOf) && (!type.predicate || type.predicate(object))) {
|
|
6421
|
-
if (explicit) if (type.multi && type.representName) state.tag = type.representName(object);
|
|
6422
|
-
else state.tag = type.tag;
|
|
6423
|
-
else state.tag = "?";
|
|
6424
|
-
if (type.represent) {
|
|
6425
|
-
const style = state.styleMap[type.tag] || type.defaultStyle;
|
|
6426
|
-
let _result;
|
|
6427
|
-
if (_toString.call(type.represent) === "[object Function]") _result = type.represent(object, style);
|
|
6428
|
-
else if (_hasOwnProperty.call(type.represent, style)) _result = type.represent[style](object, style);
|
|
6429
|
-
else throw new YAMLException("!<" + type.tag + "> tag resolver accepts not \"" + style + "\" style");
|
|
6430
|
-
state.dump = _result;
|
|
6118
|
+
state.position += 1;
|
|
6119
|
+
pendingExplicitKey = true;
|
|
6120
|
+
} else {
|
|
6121
|
+
if (atExplicitKey) {
|
|
6122
|
+
addEmptyScalarEvent(state);
|
|
6123
|
+
atExplicitKey = false;
|
|
6124
|
+
}
|
|
6125
|
+
const beforeKey = snapshotState(state);
|
|
6126
|
+
if (!parseNode(state, flowIndent, CONTEXT_FLOW_OUT, false, true)) break;
|
|
6127
|
+
if (state.line === entryLine) {
|
|
6128
|
+
ch = state.input.charCodeAt(state.position);
|
|
6129
|
+
while (isWhiteSpace(ch)) ch = state.input.charCodeAt(++state.position);
|
|
6130
|
+
if (ch === 58) {
|
|
6131
|
+
ch = state.input.charCodeAt(++state.position);
|
|
6132
|
+
if (!isWsOrEolOrEnd(ch)) throwError(state, "a whitespace character is expected after the key-value separator within a block mapping");
|
|
6133
|
+
if (!mappingOpened) {
|
|
6134
|
+
restoreState(state, beforeKey);
|
|
6135
|
+
addMappingEvent(state, beforeKey.position, props.anchorStart, props.anchorEnd, props.tagStart, props.tagEnd, 1);
|
|
6136
|
+
mappingOpened = true;
|
|
6137
|
+
parseNode(state, flowIndent, CONTEXT_FLOW_OUT, false, true);
|
|
6138
|
+
ch = state.input.charCodeAt(state.position);
|
|
6139
|
+
while (isWhiteSpace(ch)) ch = state.input.charCodeAt(++state.position);
|
|
6140
|
+
state.position++;
|
|
6141
|
+
}
|
|
6142
|
+
detected = true;
|
|
6143
|
+
atExplicitKey = false;
|
|
6144
|
+
pendingExplicitKey = false;
|
|
6145
|
+
} else if (detected) throwError(state, "expected ':' after a mapping key");
|
|
6146
|
+
else {
|
|
6147
|
+
if (props.anchorStart !== NO_RANGE$1 || props.tagStart !== NO_RANGE$1) {
|
|
6148
|
+
restoreState(state, beforeKey);
|
|
6149
|
+
return false;
|
|
6150
|
+
}
|
|
6151
|
+
return true;
|
|
6152
|
+
}
|
|
6153
|
+
} else if (detected) throwError(state, "can not read a block mapping entry; a multiline key may not be an implicit key");
|
|
6154
|
+
else {
|
|
6155
|
+
if (props.anchorStart !== NO_RANGE$1 || props.tagStart !== NO_RANGE$1) {
|
|
6156
|
+
restoreState(state, beforeKey);
|
|
6157
|
+
return false;
|
|
6431
6158
|
}
|
|
6432
6159
|
return true;
|
|
6433
6160
|
}
|
|
6434
6161
|
}
|
|
6162
|
+
if (parseNode(state, nodeIndent, CONTEXT_BLOCK_OUT, true, pendingExplicitKey)) pendingExplicitKey = false;
|
|
6163
|
+
if (!atExplicitKey) {
|
|
6164
|
+
if (pendingExplicitKey) {
|
|
6165
|
+
addEmptyScalarEvent(state);
|
|
6166
|
+
pendingExplicitKey = false;
|
|
6167
|
+
}
|
|
6168
|
+
}
|
|
6169
|
+
skipSeparationSpace(state, true);
|
|
6170
|
+
ch = state.input.charCodeAt(state.position);
|
|
6171
|
+
if ((state.line === entryLine || state.lineIndent > nodeIndent) && ch !== 0) throwError(state, "bad indentation of a mapping entry");
|
|
6172
|
+
else if (state.lineIndent < nodeIndent) break;
|
|
6173
|
+
}
|
|
6174
|
+
if (!detected) return false;
|
|
6175
|
+
if (atExplicitKey) addEmptyScalarEvent(state);
|
|
6176
|
+
if (mappingOpened) addPopEvent(state);
|
|
6177
|
+
return true;
|
|
6178
|
+
}
|
|
6179
|
+
function parseNode(state, parentIndent, nodeContext, allowToSeek, allowCompact, allowPropertyMapping = true) {
|
|
6180
|
+
if (state.depth >= state.maxDepth) throwError(state, `nesting exceeded maxDepth (${state.maxDepth})`);
|
|
6181
|
+
state.depth++;
|
|
6182
|
+
let indentStatus = 1;
|
|
6183
|
+
let atNewLine = false;
|
|
6184
|
+
let hasContent = false;
|
|
6185
|
+
let propertyStart = null;
|
|
6186
|
+
const props = emptyProperties();
|
|
6187
|
+
let allowBlockScalars = nodeContext === CONTEXT_BLOCK_OUT || nodeContext === CONTEXT_BLOCK_IN;
|
|
6188
|
+
let allowBlockCollections = allowBlockScalars;
|
|
6189
|
+
const allowBlockStyles = allowBlockScalars;
|
|
6190
|
+
if (allowToSeek && skipSeparationSpace(state, true)) {
|
|
6191
|
+
atNewLine = true;
|
|
6192
|
+
if (state.lineIndent > parentIndent) indentStatus = 1;
|
|
6193
|
+
else if (state.lineIndent === parentIndent) indentStatus = 0;
|
|
6194
|
+
else indentStatus = -1;
|
|
6195
|
+
}
|
|
6196
|
+
if (state.position === state.lineStart && testDocumentSeparator(state)) {
|
|
6197
|
+
state.depth--;
|
|
6435
6198
|
return false;
|
|
6436
6199
|
}
|
|
6437
|
-
|
|
6438
|
-
|
|
6439
|
-
|
|
6440
|
-
if (
|
|
6441
|
-
|
|
6442
|
-
|
|
6443
|
-
|
|
6444
|
-
|
|
6445
|
-
|
|
6446
|
-
|
|
6447
|
-
|
|
6448
|
-
|
|
6449
|
-
duplicate = duplicateIndex !== -1;
|
|
6200
|
+
if (indentStatus === 1) while (true) {
|
|
6201
|
+
const ch = state.input.charCodeAt(state.position);
|
|
6202
|
+
const propertyState = snapshotState(state);
|
|
6203
|
+
if (atNewLine && indentStatus !== 1 && (ch === 33 || ch === 38)) break;
|
|
6204
|
+
if (atNewLine && allowBlockStyles && (props.tagStart !== NO_RANGE$1 || props.anchorStart !== NO_RANGE$1) && (ch === 33 || ch === 38)) {
|
|
6205
|
+
const fallbackState = snapshotState(state);
|
|
6206
|
+
const flowIndent = parentIndent + 1;
|
|
6207
|
+
if (readBlockMapping(state, state.position - state.lineStart, flowIndent, props) && state.events[fallbackState.eventsLength]?.type === 3) {
|
|
6208
|
+
state.depth--;
|
|
6209
|
+
return true;
|
|
6210
|
+
}
|
|
6211
|
+
restoreState(state, fallbackState);
|
|
6450
6212
|
}
|
|
6451
|
-
if (
|
|
6452
|
-
if (
|
|
6213
|
+
if (atNewLine && (ch === 33 && props.tagStart !== NO_RANGE$1 || ch === 38 && props.anchorStart !== NO_RANGE$1)) break;
|
|
6214
|
+
if (!readTagProperty(state, props, nodeContext === CONTEXT_FLOW_IN) && !readAnchorProperty(state, props)) break;
|
|
6215
|
+
if (propertyStart === null) propertyStart = propertyState;
|
|
6216
|
+
if (skipSeparationSpace(state, true)) {
|
|
6217
|
+
atNewLine = true;
|
|
6218
|
+
allowBlockCollections = allowBlockStyles;
|
|
6219
|
+
if (state.lineIndent > parentIndent) indentStatus = 1;
|
|
6220
|
+
else if (state.lineIndent === parentIndent) indentStatus = 0;
|
|
6221
|
+
else indentStatus = -1;
|
|
6222
|
+
} else allowBlockCollections = false;
|
|
6223
|
+
}
|
|
6224
|
+
if (allowBlockCollections) allowBlockCollections = atNewLine || allowCompact;
|
|
6225
|
+
if (indentStatus === 1 || nodeContext === CONTEXT_BLOCK_OUT) {
|
|
6226
|
+
const flowIndent = nodeContext === CONTEXT_FLOW_IN || nodeContext === CONTEXT_FLOW_OUT ? parentIndent : parentIndent + 1;
|
|
6227
|
+
const blockIndent = state.position - state.lineStart;
|
|
6228
|
+
if (indentStatus === 1) if (allowBlockCollections && (readBlockSequence(state, blockIndent, props) || readBlockMapping(state, blockIndent, flowIndent, props)) || readFlowCollection(state, flowIndent, props)) hasContent = true;
|
|
6453
6229
|
else {
|
|
6454
|
-
|
|
6455
|
-
if (
|
|
6456
|
-
|
|
6457
|
-
|
|
6458
|
-
|
|
6459
|
-
|
|
6460
|
-
|
|
6461
|
-
}
|
|
6462
|
-
else if (type === "[object Array]") if (block && state.dump.length !== 0) {
|
|
6463
|
-
if (state.noArrayIndent && !isblockseq && level > 0) writeBlockSequence(state, level - 1, state.dump, compact);
|
|
6464
|
-
else writeBlockSequence(state, level, state.dump, compact);
|
|
6465
|
-
if (duplicate) state.dump = "&ref_" + duplicateIndex + state.dump;
|
|
6466
|
-
} else {
|
|
6467
|
-
writeFlowSequence(state, level, state.dump);
|
|
6468
|
-
if (duplicate) state.dump = "&ref_" + duplicateIndex + " " + state.dump;
|
|
6469
|
-
}
|
|
6470
|
-
else if (type === "[object String]") {
|
|
6471
|
-
if (state.tag !== "?") writeScalar(state, state.dump, level, iskey, inblock);
|
|
6472
|
-
} else if (type === "[object Undefined]") return false;
|
|
6473
|
-
else {
|
|
6474
|
-
if (state.skipInvalid) return false;
|
|
6475
|
-
throw new YAMLException("unacceptable kind of an object to dump " + type);
|
|
6476
|
-
}
|
|
6477
|
-
if (state.tag !== null && state.tag !== "?") {
|
|
6478
|
-
let tagStr = encodeURI(state.tag[0] === "!" ? state.tag.slice(1) : state.tag).replace(/!/g, "%21");
|
|
6479
|
-
if (state.tag[0] === "!") tagStr = "!" + tagStr;
|
|
6480
|
-
else if (tagStr.slice(0, 18) === "tag:yaml.org,2002:") tagStr = "!!" + tagStr.slice(18);
|
|
6481
|
-
else tagStr = "!<" + tagStr + ">";
|
|
6482
|
-
state.dump = tagStr + " " + state.dump;
|
|
6230
|
+
const ch = state.input.charCodeAt(state.position);
|
|
6231
|
+
if (propertyStart !== null && allowPropertyMapping && allowBlockStyles && !allowBlockCollections && ch !== 124 && ch !== 62) {
|
|
6232
|
+
const fallbackState = snapshotState(state);
|
|
6233
|
+
const propertyIndent = propertyStart.position - propertyStart.lineStart;
|
|
6234
|
+
restoreState(state, propertyStart);
|
|
6235
|
+
if (readBlockMapping(state, propertyIndent, flowIndent, emptyProperties()) && state.events[fallbackState.eventsLength]?.type === 3) hasContent = true;
|
|
6236
|
+
else restoreState(state, fallbackState);
|
|
6483
6237
|
}
|
|
6238
|
+
if (!hasContent && (allowBlockScalars && readBlockScalar(state, flowIndent, props) || readSingleQuotedScalar(state, flowIndent, props) || readDoubleQuotedScalar(state, flowIndent, props) || readAlias(state, props) || readPlainScalar(state, flowIndent, nodeContext, props))) hasContent = true;
|
|
6484
6239
|
}
|
|
6485
|
-
|
|
6240
|
+
else if (indentStatus === 0) hasContent = allowBlockCollections && readBlockSequence(state, blockIndent, props);
|
|
6241
|
+
}
|
|
6242
|
+
allowBlockScalars = allowBlockScalars && !hasContent;
|
|
6243
|
+
if (!hasContent && (props.anchorStart !== NO_RANGE$1 || props.tagStart !== NO_RANGE$1 || allowBlockScalars)) {
|
|
6244
|
+
addScalarEvent(state, NO_RANGE$1, NO_RANGE$1, props.anchorStart, props.anchorEnd, props.tagStart, props.tagEnd, 1);
|
|
6245
|
+
hasContent = true;
|
|
6246
|
+
}
|
|
6247
|
+
state.depth--;
|
|
6248
|
+
return hasContent || props.anchorStart !== NO_RANGE$1 || props.tagStart !== NO_RANGE$1;
|
|
6249
|
+
}
|
|
6250
|
+
function readDirective(state) {
|
|
6251
|
+
if (state.lineIndent > 0 || state.input.charCodeAt(state.position) !== 37) return false;
|
|
6252
|
+
state.position++;
|
|
6253
|
+
const nameStart = state.position;
|
|
6254
|
+
while (state.input.charCodeAt(state.position) !== 0 && !isWsOrEol(state.input.charCodeAt(state.position))) state.position++;
|
|
6255
|
+
const name = state.input.slice(nameStart, state.position);
|
|
6256
|
+
const args = [];
|
|
6257
|
+
if (name.length === 0) throwError(state, "directive name must not be less than one character in length");
|
|
6258
|
+
while (state.input.charCodeAt(state.position) !== 0 && !isEol(state.input.charCodeAt(state.position))) {
|
|
6259
|
+
while (isWhiteSpace(state.input.charCodeAt(state.position))) state.position++;
|
|
6260
|
+
if (state.input.charCodeAt(state.position) === 35 || isEol(state.input.charCodeAt(state.position)) || state.input.charCodeAt(state.position) === 0) break;
|
|
6261
|
+
const start = state.position;
|
|
6262
|
+
while (state.input.charCodeAt(state.position) !== 0 && !isWsOrEol(state.input.charCodeAt(state.position))) state.position++;
|
|
6263
|
+
args.push(state.input.slice(start, state.position));
|
|
6264
|
+
}
|
|
6265
|
+
if (isEol(state.input.charCodeAt(state.position))) consumeLineBreak(state);
|
|
6266
|
+
if (name === "YAML") {
|
|
6267
|
+
if (state.directives.some((directive) => directive.kind === "yaml")) throwError(state, "duplication of %YAML directive");
|
|
6268
|
+
if (args.length !== 1) throwError(state, "YAML directive accepts exactly one argument");
|
|
6269
|
+
const match = /^([0-9]+)\.([0-9]+)$/.exec(args[0]);
|
|
6270
|
+
if (match === null) throwError(state, "ill-formed argument of the YAML directive");
|
|
6271
|
+
if (parseInt(match[1], 10) !== 1) throwError(state, "unacceptable YAML version of the document");
|
|
6272
|
+
state.directives.push({
|
|
6273
|
+
kind: "yaml",
|
|
6274
|
+
version: args[0]
|
|
6275
|
+
});
|
|
6276
|
+
} else if (name === "TAG") {
|
|
6277
|
+
if (args.length !== 2) throwError(state, "TAG directive accepts exactly two arguments");
|
|
6278
|
+
const [handle, prefix] = args;
|
|
6279
|
+
if (!PATTERN_TAG_HANDLE.test(handle)) throwError(state, "ill-formed tag handle (first argument) of the TAG directive");
|
|
6280
|
+
if (HAS_OWN.call(state.tagHandlers, handle)) throwError(state, `there is a previously declared suffix for "${handle}" tag handle`);
|
|
6281
|
+
if (!PATTERN_TAG_PREFIX.test(prefix)) throwError(state, "ill-formed tag prefix (second argument) of the TAG directive");
|
|
6282
|
+
state.tagHandlers[handle] = prefix;
|
|
6283
|
+
state.directives.push({
|
|
6284
|
+
kind: "tag",
|
|
6285
|
+
handle,
|
|
6286
|
+
prefix
|
|
6287
|
+
});
|
|
6486
6288
|
}
|
|
6487
|
-
|
|
6488
|
-
|
|
6489
|
-
|
|
6490
|
-
|
|
6491
|
-
|
|
6492
|
-
|
|
6493
|
-
|
|
6494
|
-
|
|
6495
|
-
|
|
6496
|
-
|
|
6497
|
-
|
|
6498
|
-
|
|
6499
|
-
|
|
6500
|
-
|
|
6501
|
-
|
|
6502
|
-
|
|
6503
|
-
|
|
6504
|
-
|
|
6505
|
-
|
|
6506
|
-
|
|
6507
|
-
|
|
6289
|
+
return true;
|
|
6290
|
+
}
|
|
6291
|
+
function readDocument(state) {
|
|
6292
|
+
state.directives = [];
|
|
6293
|
+
state.tagHandlers = Object.create(null);
|
|
6294
|
+
let hasDirectives = false;
|
|
6295
|
+
skipSeparationSpace(state, true);
|
|
6296
|
+
while (readDirective(state)) {
|
|
6297
|
+
hasDirectives = true;
|
|
6298
|
+
skipSeparationSpace(state, true);
|
|
6299
|
+
}
|
|
6300
|
+
let explicitStart = false;
|
|
6301
|
+
let explicitEnd = false;
|
|
6302
|
+
let allowCompact = true;
|
|
6303
|
+
if (state.lineIndent === 0 && state.input.charCodeAt(state.position) === 45 && state.input.charCodeAt(state.position + 1) === 45 && state.input.charCodeAt(state.position + 2) === 45 && isWsOrEolOrEnd(state.input.charCodeAt(state.position + 3))) {
|
|
6304
|
+
explicitStart = true;
|
|
6305
|
+
const markerLine = state.line;
|
|
6306
|
+
state.position += 3;
|
|
6307
|
+
skipSeparationSpace(state, true);
|
|
6308
|
+
allowCompact = state.line > markerLine;
|
|
6309
|
+
} else if (hasDirectives) throwError(state, "directives end mark is expected");
|
|
6310
|
+
const documentEventIndex = state.events.length;
|
|
6311
|
+
if (!explicitStart && state.position === state.lineStart && state.input.charCodeAt(state.position) === 46 && testDocumentSeparator(state)) {
|
|
6312
|
+
state.position += 3;
|
|
6313
|
+
skipSeparationSpace(state, true);
|
|
6314
|
+
return;
|
|
6315
|
+
}
|
|
6316
|
+
addDocumentEvent(state, explicitStart, false);
|
|
6317
|
+
if (!parseNode(state, state.lineIndent - 1, CONTEXT_BLOCK_OUT, false, allowCompact, allowCompact)) addEmptyScalarEvent(state);
|
|
6318
|
+
skipSeparationSpace(state, true);
|
|
6319
|
+
if (state.position === state.lineStart && testDocumentSeparator(state)) {
|
|
6320
|
+
explicitEnd = state.input.charCodeAt(state.position) === 46;
|
|
6321
|
+
if (explicitEnd) {
|
|
6322
|
+
const markerLine = state.line;
|
|
6323
|
+
state.position += 3;
|
|
6324
|
+
skipSeparationSpace(state, true);
|
|
6325
|
+
if (state.line === markerLine && state.position < state.length) throwError(state, "end of the stream or a document separator is expected");
|
|
6508
6326
|
}
|
|
6509
6327
|
}
|
|
6510
|
-
|
|
6511
|
-
|
|
6512
|
-
|
|
6513
|
-
|
|
6514
|
-
|
|
6515
|
-
|
|
6516
|
-
|
|
6517
|
-
|
|
6328
|
+
const documentEvent = state.events[documentEventIndex];
|
|
6329
|
+
if (documentEvent?.type === 1) documentEvent.explicitEnd = explicitEnd;
|
|
6330
|
+
addPopEvent(state);
|
|
6331
|
+
if (!explicitEnd && state.position < state.length && !(state.position === state.lineStart && testDocumentSeparator(state))) throwError(state, "end of the stream or a document separator is expected");
|
|
6332
|
+
}
|
|
6333
|
+
function parseEvents(input, options) {
|
|
6334
|
+
const length = input.length;
|
|
6335
|
+
const state = {
|
|
6336
|
+
...DEFAULT_PARSER_OPTIONS,
|
|
6337
|
+
...options,
|
|
6338
|
+
input: `${input}\0`,
|
|
6339
|
+
length,
|
|
6340
|
+
position: 0,
|
|
6341
|
+
line: 0,
|
|
6342
|
+
lineStart: 0,
|
|
6343
|
+
lineIndent: 0,
|
|
6344
|
+
firstTabInLine: -1,
|
|
6345
|
+
depth: 0,
|
|
6346
|
+
directives: [],
|
|
6347
|
+
tagHandlers: Object.create(null),
|
|
6348
|
+
events: []
|
|
6349
|
+
};
|
|
6350
|
+
const nullpos = input.indexOf("\0");
|
|
6351
|
+
if (nullpos !== -1) throwErrorAt(input, nullpos, "null byte is not allowed in input", state.filename);
|
|
6352
|
+
if (state.input.charCodeAt(state.position) === 65279) state.position++;
|
|
6353
|
+
while (state.position < state.length) {
|
|
6354
|
+
skipSeparationSpace(state, true);
|
|
6355
|
+
if (state.position >= state.length) break;
|
|
6356
|
+
const documentStart = state.position;
|
|
6357
|
+
readDocument(state);
|
|
6358
|
+
if (state.position === documentStart)
|
|
6359
|
+
/* c8 ignore next */
|
|
6360
|
+
throwError(state, "can not read a document");
|
|
6518
6361
|
}
|
|
6519
|
-
|
|
6520
|
-
}
|
|
6362
|
+
return state.events;
|
|
6363
|
+
}
|
|
6521
6364
|
//#endregion
|
|
6522
|
-
//#region
|
|
6523
|
-
var
|
|
6524
|
-
|
|
6525
|
-
|
|
6526
|
-
|
|
6527
|
-
|
|
6528
|
-
|
|
6529
|
-
|
|
6530
|
-
|
|
6531
|
-
module.exports.Type = require_type();
|
|
6532
|
-
module.exports.Schema = require_schema();
|
|
6533
|
-
module.exports.FAILSAFE_SCHEMA = require_failsafe();
|
|
6534
|
-
module.exports.JSON_SCHEMA = require_json();
|
|
6535
|
-
module.exports.CORE_SCHEMA = require_core();
|
|
6536
|
-
module.exports.DEFAULT_SCHEMA = require_default();
|
|
6537
|
-
module.exports.load = loader.load;
|
|
6538
|
-
module.exports.loadAll = loader.loadAll;
|
|
6539
|
-
module.exports.dump = dumper.dump;
|
|
6540
|
-
module.exports.YAMLException = require_exception();
|
|
6541
|
-
module.exports.types = {
|
|
6542
|
-
binary: require_binary(),
|
|
6543
|
-
float: require_float(),
|
|
6544
|
-
map: require_map(),
|
|
6545
|
-
null: require_null(),
|
|
6546
|
-
pairs: require_pairs(),
|
|
6547
|
-
set: require_set(),
|
|
6548
|
-
timestamp: require_timestamp(),
|
|
6549
|
-
bool: require_bool(),
|
|
6550
|
-
int: require_int(),
|
|
6551
|
-
merge: require_merge(),
|
|
6552
|
-
omap: require_omap(),
|
|
6553
|
-
seq: require_seq(),
|
|
6554
|
-
str: require_str()
|
|
6365
|
+
//#region src/load.ts
|
|
6366
|
+
var DEFAULT_LOAD_OPTIONS = {
|
|
6367
|
+
...DEFAULT_PARSER_OPTIONS,
|
|
6368
|
+
...DEFAULT_CONSTRUCTOR_OPTIONS
|
|
6369
|
+
};
|
|
6370
|
+
function loadDocuments(input, options = {}) {
|
|
6371
|
+
const opts = {
|
|
6372
|
+
...DEFAULT_LOAD_OPTIONS,
|
|
6373
|
+
...options
|
|
6555
6374
|
};
|
|
6556
|
-
|
|
6557
|
-
|
|
6558
|
-
|
|
6559
|
-
|
|
6560
|
-
|
|
6561
|
-
|
|
6375
|
+
const source = String(input);
|
|
6376
|
+
const PARSER_OPT_KEYS = Object.keys(DEFAULT_PARSER_OPTIONS);
|
|
6377
|
+
const CONSTRUCTOR_OPT_KEYS = Object.keys(DEFAULT_CONSTRUCTOR_OPTIONS);
|
|
6378
|
+
return constructFromEvents(parseEvents(source, pick(opts, PARSER_OPT_KEYS)), {
|
|
6379
|
+
...pick(opts, CONSTRUCTOR_OPT_KEYS),
|
|
6380
|
+
source
|
|
6381
|
+
});
|
|
6382
|
+
}
|
|
6383
|
+
function load(input, options) {
|
|
6384
|
+
const documents = loadDocuments(input, options);
|
|
6385
|
+
if (documents.length === 0) throw new YAMLException("expected a document, but the input is empty");
|
|
6386
|
+
if (documents.length === 1) return documents[0];
|
|
6387
|
+
throw new YAMLException("expected a single document in the stream, but found more");
|
|
6388
|
+
}
|
|
6389
|
+
//#endregion
|
|
6390
|
+
//#region src/dump.ts
|
|
6391
|
+
YAML11_SCHEMA.withTags({
|
|
6392
|
+
...intYaml11Tag,
|
|
6393
|
+
resolve: (source, isExplicit, tagName) => {
|
|
6394
|
+
const result = intYaml11Tag.resolve(source, isExplicit, tagName);
|
|
6395
|
+
return result === NOT_RESOLVED ? intCoreTag.resolve(source, isExplicit, tagName) : result;
|
|
6396
|
+
}
|
|
6397
|
+
}, {
|
|
6398
|
+
...floatYaml11Tag,
|
|
6399
|
+
resolve: (source, isExplicit, tagName) => {
|
|
6400
|
+
const result = floatYaml11Tag.resolve(source, isExplicit, tagName);
|
|
6401
|
+
return result === NOT_RESOLVED ? floatCoreTag.resolve(source, isExplicit, tagName) : result;
|
|
6402
|
+
}
|
|
6403
|
+
});
|
|
6562
6404
|
|
|
6563
6405
|
/** Detect free variable `global` from Node.js. */
|
|
6564
6406
|
var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
|
|
@@ -10470,8 +10312,23 @@ const splitPath = (path) => {
|
|
|
10470
10312
|
}
|
|
10471
10313
|
return path;
|
|
10472
10314
|
};
|
|
10473
|
-
const
|
|
10474
|
-
|
|
10315
|
+
const followRefChain = (schema, doc, seen = new Set()) => {
|
|
10316
|
+
if (!schema.$ref)
|
|
10317
|
+
return { value: schema, ref: undefined };
|
|
10318
|
+
if (seen.has(schema.$ref))
|
|
10319
|
+
return { value: undefined, ref: undefined };
|
|
10320
|
+
const resolved = get$1(doc, splitPath(schema.$ref));
|
|
10321
|
+
if (resolved !== null && typeof resolved === "object" && "$ref" in resolved) {
|
|
10322
|
+
const next = followRefChain(resolved, doc, new Set([...seen, schema.$ref]));
|
|
10323
|
+
return next.value !== undefined
|
|
10324
|
+
? { value: next.value, ref: next.ref ?? schema.$ref }
|
|
10325
|
+
: next;
|
|
10326
|
+
}
|
|
10327
|
+
return { value: resolved, ref: schema.$ref };
|
|
10328
|
+
};
|
|
10329
|
+
const dereferenceOas = (schema, oas) => (followRefChain(schema, oas).value ?? schema);
|
|
10330
|
+
const dereferenceDoc = (schema, doc) => followRefChain(schema, doc).value;
|
|
10331
|
+
const lastRefInChain = (schema, doc) => followRefChain(schema, doc).ref;
|
|
10475
10332
|
const traverse = (schema, visitor) => {
|
|
10476
10333
|
if (typeof schema === "boolean" || schema === undefined) {
|
|
10477
10334
|
return;
|
|
@@ -10555,7 +10412,8 @@ function* iterateMessageList(messages, inlinePathBase, cache, doc) {
|
|
|
10555
10412
|
const message = dereferenceDoc(ref, doc);
|
|
10556
10413
|
if (!message)
|
|
10557
10414
|
continue;
|
|
10558
|
-
const
|
|
10415
|
+
const finalRef = lastRefInChain(ref, doc) ?? ref.$ref;
|
|
10416
|
+
const path = "[root]." + finalRef.replace(/^#\//, "").replace(/\//g, ".");
|
|
10559
10417
|
const result = { message, path };
|
|
10560
10418
|
cache.set(ref.$ref, result);
|
|
10561
10419
|
yield result;
|
|
@@ -11068,12 +10926,13 @@ function checkAsyncapiPreamble(asyncapi, interaction, index, interactionKind) {
|
|
|
11068
10926
|
},
|
|
11069
10927
|
};
|
|
11070
10928
|
}
|
|
10929
|
+
const interactionKindTitleCase = `${interactionKind.charAt(0).toUpperCase()}${interactionKind.slice(1)}`;
|
|
11071
10930
|
if (!interaction.asyncapiReferences) {
|
|
11072
10931
|
return {
|
|
11073
10932
|
ok: false,
|
|
11074
10933
|
result: {
|
|
11075
10934
|
code: "message.references.missing",
|
|
11076
|
-
message: `${
|
|
10935
|
+
message: `${interactionKindTitleCase} interaction has no AsyncAPI references in comments.references.AsyncAPI`,
|
|
11077
10936
|
mockDetails: {
|
|
11078
10937
|
...baseMockDetails(interaction),
|
|
11079
10938
|
location: `[root].interactions[${index}].comments.references.AsyncAPI`,
|
|
@@ -11085,6 +10944,22 @@ function checkAsyncapiPreamble(asyncapi, interaction, index, interactionKind) {
|
|
|
11085
10944
|
};
|
|
11086
10945
|
}
|
|
11087
10946
|
const { operationId } = interaction.asyncapiReferences;
|
|
10947
|
+
if (!operationId) {
|
|
10948
|
+
return {
|
|
10949
|
+
ok: false,
|
|
10950
|
+
result: {
|
|
10951
|
+
code: "message.references.missing",
|
|
10952
|
+
message: `${interactionKindTitleCase} interaction has a malformed AsyncAPI reference in comments.references.AsyncAPI: expected an "operationId" property`,
|
|
10953
|
+
mockDetails: {
|
|
10954
|
+
...baseMockDetails(interaction),
|
|
10955
|
+
location: `[root].interactions[${index}].comments.references.AsyncAPI`,
|
|
10956
|
+
value: interaction.asyncapiReferences,
|
|
10957
|
+
},
|
|
10958
|
+
specDetails: { location: "[root]", value: undefined },
|
|
10959
|
+
type: "error",
|
|
10960
|
+
},
|
|
10961
|
+
};
|
|
10962
|
+
}
|
|
11088
10963
|
if (!asyncapi.operations?.[operationId]) {
|
|
11089
10964
|
return {
|
|
11090
10965
|
ok: false,
|
|
@@ -13381,7 +13256,10 @@ function requireSideChannel () {
|
|
|
13381
13256
|
var channel = {
|
|
13382
13257
|
assert: function (key) {
|
|
13383
13258
|
if (!channel.has(key)) {
|
|
13384
|
-
|
|
13259
|
+
var keyDesc = key && Object(key) === key
|
|
13260
|
+
? 'the given object key'
|
|
13261
|
+
: inspect(key);
|
|
13262
|
+
throw new $TypeError('Side channel does not contain ' + keyDesc);
|
|
13385
13263
|
}
|
|
13386
13264
|
},
|
|
13387
13265
|
'delete': function (key) {
|
|
@@ -13401,7 +13279,7 @@ function requireSideChannel () {
|
|
|
13401
13279
|
$channelData.set(key, value);
|
|
13402
13280
|
}
|
|
13403
13281
|
};
|
|
13404
|
-
|
|
13282
|
+
|
|
13405
13283
|
return channel;
|
|
13406
13284
|
};
|
|
13407
13285
|
return sideChannel;
|
|
@@ -13447,6 +13325,7 @@ function requireUtils$1 () {
|
|
|
13447
13325
|
|
|
13448
13326
|
var formats = /*@__PURE__*/ requireFormats$1();
|
|
13449
13327
|
var getSideChannel = requireSideChannel();
|
|
13328
|
+
var defineProperty = /*@__PURE__*/ requireEsDefineProperty();
|
|
13450
13329
|
|
|
13451
13330
|
var has = Object.prototype.hasOwnProperty;
|
|
13452
13331
|
var isArray = Array.isArray;
|
|
@@ -13511,6 +13390,19 @@ function requireUtils$1 () {
|
|
|
13511
13390
|
return obj;
|
|
13512
13391
|
};
|
|
13513
13392
|
|
|
13393
|
+
var setProperty = function setProperty(obj, key, value) {
|
|
13394
|
+
if (key === '__proto__' && defineProperty) {
|
|
13395
|
+
defineProperty(obj, key, {
|
|
13396
|
+
configurable: true,
|
|
13397
|
+
enumerable: true,
|
|
13398
|
+
value: value,
|
|
13399
|
+
writable: true
|
|
13400
|
+
});
|
|
13401
|
+
} else {
|
|
13402
|
+
obj[key] = value;
|
|
13403
|
+
}
|
|
13404
|
+
};
|
|
13405
|
+
|
|
13514
13406
|
var merge = function merge(target, source, options) {
|
|
13515
13407
|
/* eslint no-param-reassign: 0 */
|
|
13516
13408
|
if (!source) {
|
|
@@ -13520,7 +13412,10 @@ function requireUtils$1 () {
|
|
|
13520
13412
|
if (typeof source !== 'object' && typeof source !== 'function') {
|
|
13521
13413
|
if (isArray(target)) {
|
|
13522
13414
|
var nextIndex = target.length;
|
|
13523
|
-
if (options && typeof options.arrayLimit === 'number' && nextIndex
|
|
13415
|
+
if (options && typeof options.arrayLimit === 'number' && nextIndex >= options.arrayLimit) {
|
|
13416
|
+
if (options.throwOnLimitExceeded) {
|
|
13417
|
+
throw new RangeError('Array limit exceeded. Only ' + options.arrayLimit + ' element' + (options.arrayLimit === 1 ? '' : 's') + ' allowed in an array.');
|
|
13418
|
+
}
|
|
13524
13419
|
return markOverflow(arrayToObject(target.concat(source), options), nextIndex);
|
|
13525
13420
|
}
|
|
13526
13421
|
target[nextIndex] = source;
|
|
@@ -13560,6 +13455,9 @@ function requireUtils$1 () {
|
|
|
13560
13455
|
}
|
|
13561
13456
|
var combined = [target].concat(source);
|
|
13562
13457
|
if (options && typeof options.arrayLimit === 'number' && combined.length > options.arrayLimit) {
|
|
13458
|
+
if (options.throwOnLimitExceeded) {
|
|
13459
|
+
throw new RangeError('Array limit exceeded. Only ' + options.arrayLimit + ' element' + (options.arrayLimit === 1 ? '' : 's') + ' allowed in an array.');
|
|
13460
|
+
}
|
|
13563
13461
|
return markOverflow(arrayToObject(combined, options), combined.length - 1);
|
|
13564
13462
|
}
|
|
13565
13463
|
return combined;
|
|
@@ -13583,6 +13481,12 @@ function requireUtils$1 () {
|
|
|
13583
13481
|
target[i] = item;
|
|
13584
13482
|
}
|
|
13585
13483
|
});
|
|
13484
|
+
if (options && typeof options.arrayLimit === 'number' && target.length > options.arrayLimit) {
|
|
13485
|
+
if (options.throwOnLimitExceeded) {
|
|
13486
|
+
throw new RangeError('Array limit exceeded. Only ' + options.arrayLimit + ' element' + (options.arrayLimit === 1 ? '' : 's') + ' allowed in an array.');
|
|
13487
|
+
}
|
|
13488
|
+
return markOverflow(arrayToObject(target, options), target.length - 1);
|
|
13489
|
+
}
|
|
13586
13490
|
return target;
|
|
13587
13491
|
}
|
|
13588
13492
|
|
|
@@ -13590,9 +13494,9 @@ function requireUtils$1 () {
|
|
|
13590
13494
|
var value = source[key];
|
|
13591
13495
|
|
|
13592
13496
|
if (has.call(acc, key)) {
|
|
13593
|
-
acc
|
|
13497
|
+
setProperty(acc, key, merge(acc[key], value, options));
|
|
13594
13498
|
} else {
|
|
13595
|
-
acc
|
|
13499
|
+
setProperty(acc, key, value);
|
|
13596
13500
|
}
|
|
13597
13501
|
|
|
13598
13502
|
if (isOverflow(source) && !isOverflow(acc)) {
|
|
@@ -13611,7 +13515,7 @@ function requireUtils$1 () {
|
|
|
13611
13515
|
|
|
13612
13516
|
var assign = function assignSingleSource(target, source) {
|
|
13613
13517
|
return Object.keys(source).reduce(function (acc, key) {
|
|
13614
|
-
acc
|
|
13518
|
+
setProperty(acc, key, source[key]);
|
|
13615
13519
|
return acc;
|
|
13616
13520
|
}, target);
|
|
13617
13521
|
};
|
|
@@ -13657,6 +13561,13 @@ function requireUtils$1 () {
|
|
|
13657
13561
|
var out = '';
|
|
13658
13562
|
for (var j = 0; j < string.length; j += limit) {
|
|
13659
13563
|
var segment = string.length >= limit ? string.slice(j, j + limit) : string;
|
|
13564
|
+
if (j + limit < string.length) {
|
|
13565
|
+
var last = segment.charCodeAt(segment.length - 1);
|
|
13566
|
+
if (last >= 0xD800 && last <= 0xDBFF) {
|
|
13567
|
+
segment = segment.slice(0, -1);
|
|
13568
|
+
j -= 1;
|
|
13569
|
+
}
|
|
13570
|
+
}
|
|
13660
13571
|
var arr = [];
|
|
13661
13572
|
|
|
13662
13573
|
for (var i = 0; i < segment.length; ++i) {
|
|
@@ -13710,7 +13621,7 @@ function requireUtils$1 () {
|
|
|
13710
13621
|
|
|
13711
13622
|
var compact = function compact(value) {
|
|
13712
13623
|
var queue = [{ obj: { o: value }, prop: 'o' }];
|
|
13713
|
-
var refs =
|
|
13624
|
+
var refs = getSideChannel();
|
|
13714
13625
|
|
|
13715
13626
|
for (var i = 0; i < queue.length; ++i) {
|
|
13716
13627
|
var item = queue[i];
|
|
@@ -13720,9 +13631,9 @@ function requireUtils$1 () {
|
|
|
13720
13631
|
for (var j = 0; j < keys.length; ++j) {
|
|
13721
13632
|
var key = keys[j];
|
|
13722
13633
|
var val = obj[key];
|
|
13723
|
-
if (typeof val === 'object' && val !== null && refs.
|
|
13634
|
+
if (typeof val === 'object' && val !== null && !refs.has(val)) {
|
|
13724
13635
|
queue[queue.length] = { obj: obj, prop: key };
|
|
13725
|
-
refs
|
|
13636
|
+
refs.set(val, true);
|
|
13726
13637
|
}
|
|
13727
13638
|
}
|
|
13728
13639
|
}
|
|
@@ -13744,9 +13655,12 @@ function requireUtils$1 () {
|
|
|
13744
13655
|
return !!(obj.constructor && obj.constructor.isBuffer && obj.constructor.isBuffer(obj));
|
|
13745
13656
|
};
|
|
13746
13657
|
|
|
13747
|
-
var combine = function combine(a, b, arrayLimit, plainObjects) {
|
|
13658
|
+
var combine = function combine(a, b, arrayLimit, plainObjects, throwOnLimitExceeded) {
|
|
13748
13659
|
// If 'a' is already an overflow object, add to it
|
|
13749
13660
|
if (isOverflow(a)) {
|
|
13661
|
+
if (throwOnLimitExceeded) {
|
|
13662
|
+
throw new RangeError('Array limit exceeded. Only ' + arrayLimit + ' element' + (arrayLimit === 1 ? '' : 's') + ' allowed in an array.');
|
|
13663
|
+
}
|
|
13750
13664
|
var newIndex = getMaxIndex(a) + 1;
|
|
13751
13665
|
a[newIndex] = b;
|
|
13752
13666
|
setMaxIndex(a, newIndex);
|
|
@@ -13755,6 +13669,9 @@ function requireUtils$1 () {
|
|
|
13755
13669
|
|
|
13756
13670
|
var result = [].concat(a, b);
|
|
13757
13671
|
if (result.length > arrayLimit) {
|
|
13672
|
+
if (throwOnLimitExceeded) {
|
|
13673
|
+
throw new RangeError('Array limit exceeded. Only ' + arrayLimit + ' element' + (arrayLimit === 1 ? '' : 's') + ' allowed in an array.');
|
|
13674
|
+
}
|
|
13758
13675
|
return markOverflow(arrayToObject(result, { plainObjects: plainObjects }), result.length - 1);
|
|
13759
13676
|
}
|
|
13760
13677
|
return result;
|
|
@@ -14202,8 +14119,19 @@ function requireParse$1 () {
|
|
|
14202
14119
|
});
|
|
14203
14120
|
};
|
|
14204
14121
|
|
|
14205
|
-
var parseArrayValue = function (val, options, currentArrayLength) {
|
|
14122
|
+
var parseArrayValue = function (val, options, currentArrayLength, isFlatArrayValue) {
|
|
14206
14123
|
if (val && typeof val === 'string' && options.comma && val.indexOf(',') > -1) {
|
|
14124
|
+
if (isFlatArrayValue && options.throwOnLimitExceeded) {
|
|
14125
|
+
var commaCount = 0;
|
|
14126
|
+
var commaIndex = val.indexOf(',');
|
|
14127
|
+
while (commaIndex > -1) {
|
|
14128
|
+
commaCount += 1;
|
|
14129
|
+
if (commaCount >= options.arrayLimit) {
|
|
14130
|
+
throw new RangeError('Array limit exceeded. Only ' + options.arrayLimit + ' element' + (options.arrayLimit === 1 ? '' : 's') + ' allowed in an array.');
|
|
14131
|
+
}
|
|
14132
|
+
commaIndex = val.indexOf(',', commaIndex + 1);
|
|
14133
|
+
}
|
|
14134
|
+
}
|
|
14207
14135
|
return val.split(',');
|
|
14208
14136
|
}
|
|
14209
14137
|
|
|
@@ -14280,7 +14208,8 @@ function requireParse$1 () {
|
|
|
14280
14208
|
parseArrayValue(
|
|
14281
14209
|
part.slice(pos + 1),
|
|
14282
14210
|
options,
|
|
14283
|
-
isArray(obj[key]) ? obj[key].length : 0
|
|
14211
|
+
isArray(obj[key]) ? obj[key].length : 0,
|
|
14212
|
+
part.indexOf('[]=') === -1
|
|
14284
14213
|
),
|
|
14285
14214
|
function (encodedVal) {
|
|
14286
14215
|
return options.decoder(encodedVal, defaults.decoder, charset, 'value');
|
|
@@ -14298,10 +14227,7 @@ function requireParse$1 () {
|
|
|
14298
14227
|
}
|
|
14299
14228
|
|
|
14300
14229
|
if (options.comma && isArray(val) && val.length > options.arrayLimit) {
|
|
14301
|
-
|
|
14302
|
-
throw new RangeError('Array limit exceeded. Only ' + options.arrayLimit + ' element' + (options.arrayLimit === 1 ? '' : 's') + ' allowed in an array.');
|
|
14303
|
-
}
|
|
14304
|
-
val = utils.combine([], val, options.arrayLimit, options.plainObjects);
|
|
14230
|
+
val = utils.combine([], val, options.arrayLimit, options.plainObjects, options.throwOnLimitExceeded);
|
|
14305
14231
|
}
|
|
14306
14232
|
|
|
14307
14233
|
if (key !== null) {
|
|
@@ -14311,7 +14237,8 @@ function requireParse$1 () {
|
|
|
14311
14237
|
obj[key],
|
|
14312
14238
|
val,
|
|
14313
14239
|
options.arrayLimit,
|
|
14314
|
-
options.plainObjects
|
|
14240
|
+
options.plainObjects,
|
|
14241
|
+
options.throwOnLimitExceeded
|
|
14315
14242
|
);
|
|
14316
14243
|
} else if (!existing || options.duplicates === 'last') {
|
|
14317
14244
|
obj[key] = val;
|
|
@@ -14346,7 +14273,8 @@ function requireParse$1 () {
|
|
|
14346
14273
|
[],
|
|
14347
14274
|
leaf,
|
|
14348
14275
|
options.arrayLimit,
|
|
14349
|
-
options.plainObjects
|
|
14276
|
+
options.plainObjects,
|
|
14277
|
+
options.throwOnLimitExceeded
|
|
14350
14278
|
);
|
|
14351
14279
|
}
|
|
14352
14280
|
} else {
|
|
@@ -14751,7 +14679,8 @@ function* compareReqHeader(ajv, route, interaction, index, config) {
|
|
|
14751
14679
|
Object.entries(operation.responses).reduce((acc, [_status, response]) => {
|
|
14752
14680
|
return [
|
|
14753
14681
|
...acc,
|
|
14754
|
-
...Object.keys(dereferenceOas(response || {}, oas)
|
|
14682
|
+
...Object.keys(dereferenceOas(response || {}, oas)
|
|
14683
|
+
?.content || {}),
|
|
14755
14684
|
];
|
|
14756
14685
|
}, []);
|
|
14757
14686
|
const availableResponseContentType = operation.produces ||
|
|
@@ -23810,7 +23739,7 @@ function requireFastUri () {
|
|
|
23810
23739
|
if (parsed.host && (options.domainHost || (schemeHandler && schemeHandler.domainHost)) && isIP === false && nonSimpleDomain(parsed.host)) {
|
|
23811
23740
|
// convert Unicode IDN -> ASCII IDN
|
|
23812
23741
|
try {
|
|
23813
|
-
parsed.host = URL
|
|
23742
|
+
parsed.host = new URL('http://' + parsed.host).hostname;
|
|
23814
23743
|
} catch (e) {
|
|
23815
23744
|
parsed.error = parsed.error || "Host's domain name can not be converted to ASCII: " + e;
|
|
23816
23745
|
}
|
|
@@ -26970,9 +26899,7 @@ const AsyncMessage = Type.Object({
|
|
|
26970
26899
|
metadata: Type.Optional(Type.Record(Type.String(), Type.String())),
|
|
26971
26900
|
comments: Type.Optional(Type.Object({
|
|
26972
26901
|
references: Type.Optional(Type.Object({
|
|
26973
|
-
AsyncAPI: Type.Optional(Type.
|
|
26974
|
-
operationId: Type.String(),
|
|
26975
|
-
})),
|
|
26902
|
+
AsyncAPI: Type.Optional(Type.Unknown()),
|
|
26976
26903
|
})),
|
|
26977
26904
|
})),
|
|
26978
26905
|
});
|
|
@@ -26992,9 +26919,7 @@ const SyncMessage = Type.Object({
|
|
|
26992
26919
|
response: Type.Array(SyncMessageSide),
|
|
26993
26920
|
comments: Type.Optional(Type.Object({
|
|
26994
26921
|
references: Type.Optional(Type.Object({
|
|
26995
|
-
AsyncAPI: Type.Optional(Type.
|
|
26996
|
-
operationId: Type.String(),
|
|
26997
|
-
})),
|
|
26922
|
+
AsyncAPI: Type.Optional(Type.Unknown()),
|
|
26998
26923
|
})),
|
|
26999
26924
|
})),
|
|
27000
26925
|
});
|
|
@@ -27084,29 +27009,32 @@ const interactionV4 = (i) => ({
|
|
|
27084
27009
|
headers: flattenValues(i.response?.headers),
|
|
27085
27010
|
},
|
|
27086
27011
|
});
|
|
27012
|
+
const asAsyncapiReferences = (asyncapiRef) => {
|
|
27013
|
+
if (!asyncapiRef)
|
|
27014
|
+
return undefined;
|
|
27015
|
+
if (typeof asyncapiRef !== "object")
|
|
27016
|
+
return {};
|
|
27017
|
+
return { ...asyncapiRef };
|
|
27018
|
+
};
|
|
27087
27019
|
const parseAsyncInteraction = (i) => {
|
|
27088
|
-
const asyncapiRef = i.comments?.references?.AsyncAPI;
|
|
27020
|
+
const asyncapiRef = asAsyncapiReferences(i.comments?.references?.AsyncAPI);
|
|
27089
27021
|
return {
|
|
27090
27022
|
_kind: "async",
|
|
27091
27023
|
description: i.description,
|
|
27092
27024
|
providerState: i.providerState,
|
|
27093
|
-
asyncapiReferences: asyncapiRef
|
|
27094
|
-
? { operationId: asyncapiRef.operationId }
|
|
27095
|
-
: undefined,
|
|
27025
|
+
asyncapiReferences: asyncapiRef,
|
|
27096
27026
|
payload: parseAsPactV4Body(i.contents),
|
|
27097
27027
|
contentType: i.contents?.contentType,
|
|
27098
27028
|
metadata: i.metadata,
|
|
27099
27029
|
};
|
|
27100
27030
|
};
|
|
27101
27031
|
const parseSyncInteraction = (i) => {
|
|
27102
|
-
const asyncapiRef = i.comments?.references?.AsyncAPI;
|
|
27032
|
+
const asyncapiRef = asAsyncapiReferences(i.comments?.references?.AsyncAPI);
|
|
27103
27033
|
return {
|
|
27104
27034
|
_kind: "sync",
|
|
27105
27035
|
description: i.description,
|
|
27106
27036
|
providerState: i.providerState,
|
|
27107
|
-
asyncapiReferences: asyncapiRef
|
|
27108
|
-
? { operationId: asyncapiRef.operationId }
|
|
27109
|
-
: undefined,
|
|
27037
|
+
asyncapiReferences: asyncapiRef,
|
|
27110
27038
|
request: {
|
|
27111
27039
|
payload: parseAsPactV4Body(i.request.contents),
|
|
27112
27040
|
contentType: i.request.contents?.contentType,
|
|
@@ -32083,7 +32011,7 @@ class Runner {
|
|
|
32083
32011
|
}
|
|
32084
32012
|
catch (error) {
|
|
32085
32013
|
try {
|
|
32086
|
-
return
|
|
32014
|
+
return load(content);
|
|
32087
32015
|
}
|
|
32088
32016
|
catch (_err) {
|
|
32089
32017
|
throw error;
|