@depup/js-yaml 5.2.2-depup.9 → 5.2.3-depup.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/README.md +2 -2
- package/changes.json +1 -1
- package/dist/browser/js-yaml.esm.min.mjs +373 -360
- package/dist/browser/js-yaml.esm.min.mjs.map +1 -1
- package/dist/browser/js-yaml.umd.min.js +18 -18
- package/dist/browser/js-yaml.umd.min.js.map +1 -1
- package/dist/js-yaml.cjs.js +37 -20
- package/dist/js-yaml.cjs.js.map +1 -1
- package/dist/js-yaml.mjs +37 -20
- package/dist/js-yaml.mjs.map +1 -1
- package/package.json +3 -3
package/dist/js-yaml.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! js-yaml 5.2.
|
|
1
|
+
/*! js-yaml 5.2.3 https://github.com/nodeca/js-yaml @license MIT */
|
|
2
2
|
//#region src/tag.ts
|
|
3
3
|
var NOT_RESOLVED = Symbol("NOT_RESOLVED");
|
|
4
4
|
var MERGE_KEY = Symbol("MERGE_KEY");
|
|
@@ -453,6 +453,11 @@ var binaryTag = defineScalarTag("tag:yaml.org,2002:binary", {
|
|
|
453
453
|
//#region src/tag/scalar/timestamp.ts
|
|
454
454
|
var YAML_DATE_REGEXP = /* @__PURE__ */ new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$");
|
|
455
455
|
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]))?))?$");
|
|
456
|
+
function makeUtcDate(year, month, day, hour = 0, minute = 0, second = 0, fraction = 0) {
|
|
457
|
+
const date = new Date(Date.UTC(year, month, day, hour, minute, second, fraction));
|
|
458
|
+
date.setUTCFullYear(year, month, day);
|
|
459
|
+
return date;
|
|
460
|
+
}
|
|
456
461
|
function resolveYamlTimestamp(source) {
|
|
457
462
|
let match = YAML_DATE_REGEXP.exec(source);
|
|
458
463
|
if (match === null) match = YAML_TIMESTAMP_REGEXP.exec(source);
|
|
@@ -461,7 +466,7 @@ function resolveYamlTimestamp(source) {
|
|
|
461
466
|
const month = +match[2] - 1;
|
|
462
467
|
const day = +match[3];
|
|
463
468
|
if (!match[4]) {
|
|
464
|
-
const date =
|
|
469
|
+
const date = makeUtcDate(year, month, day);
|
|
465
470
|
if (date.getUTCFullYear() !== year || date.getUTCMonth() !== month || date.getUTCDate() !== day) return NOT_RESOLVED;
|
|
466
471
|
return date;
|
|
467
472
|
}
|
|
@@ -475,7 +480,7 @@ function resolveYamlTimestamp(source) {
|
|
|
475
480
|
while (value.length < 3) value += "0";
|
|
476
481
|
fraction = +value;
|
|
477
482
|
}
|
|
478
|
-
const date =
|
|
483
|
+
const date = makeUtcDate(year, month, day, hour, minute, second, fraction);
|
|
479
484
|
if (date.getUTCFullYear() !== year || date.getUTCMonth() !== month || date.getUTCDate() !== day) return NOT_RESOLVED;
|
|
480
485
|
if (match[9]) {
|
|
481
486
|
const offsetHour = +match[10];
|
|
@@ -583,7 +588,11 @@ var mapTag = defineMappingTag("tag:yaml.org,2002:map", {
|
|
|
583
588
|
return Object.prototype.hasOwnProperty.call(container, String(key));
|
|
584
589
|
},
|
|
585
590
|
keys: (container) => Object.keys(container),
|
|
586
|
-
get: (container, key) =>
|
|
591
|
+
get: (container, key) => {
|
|
592
|
+
const normalizedKey = String(key);
|
|
593
|
+
if (!Object.prototype.hasOwnProperty.call(container, normalizedKey)) return null;
|
|
594
|
+
return container[normalizedKey];
|
|
595
|
+
}
|
|
587
596
|
});
|
|
588
597
|
//#endregion
|
|
589
598
|
//#region src/tag/mapping/set.ts
|
|
@@ -608,9 +617,9 @@ var setTag = defineMappingTag("tag:yaml.org,2002:set", {
|
|
|
608
617
|
//#region src/schema.ts
|
|
609
618
|
function createTagDefinitionMap() {
|
|
610
619
|
return {
|
|
611
|
-
scalar:
|
|
612
|
-
sequence:
|
|
613
|
-
mapping:
|
|
620
|
+
scalar: Object.create(null),
|
|
621
|
+
sequence: Object.create(null),
|
|
622
|
+
mapping: Object.create(null)
|
|
614
623
|
};
|
|
615
624
|
}
|
|
616
625
|
function createTagDefinitionListMap() {
|
|
@@ -784,7 +793,11 @@ var legacyMapTag = defineMappingTag("tag:yaml.org,2002:map", {
|
|
|
784
793
|
return normalizedKey !== null && Object.prototype.hasOwnProperty.call(container, normalizedKey);
|
|
785
794
|
},
|
|
786
795
|
keys: (container) => Object.keys(container),
|
|
787
|
-
get: (container, key) =>
|
|
796
|
+
get: (container, key) => {
|
|
797
|
+
const normalizedKey = String(key);
|
|
798
|
+
if (!Object.prototype.hasOwnProperty.call(container, normalizedKey)) return null;
|
|
799
|
+
return container[normalizedKey];
|
|
800
|
+
}
|
|
788
801
|
});
|
|
789
802
|
//#endregion
|
|
790
803
|
//#region src/common/snippet.ts
|
|
@@ -1116,10 +1129,10 @@ function getScalarValue(input, scalar) {
|
|
|
1116
1129
|
}
|
|
1117
1130
|
//#endregion
|
|
1118
1131
|
//#region src/common/tagname.ts
|
|
1119
|
-
var DEFAULT_TAG_HANDLERS = {
|
|
1132
|
+
var DEFAULT_TAG_HANDLERS = Object.assign(Object.create(null), {
|
|
1120
1133
|
"!": "!",
|
|
1121
1134
|
"!!": "tag:yaml.org,2002:"
|
|
1122
|
-
};
|
|
1135
|
+
});
|
|
1123
1136
|
function tagPercentEncode(source) {
|
|
1124
1137
|
return encodeURI(source).replace(/!/g, "%21");
|
|
1125
1138
|
}
|
|
@@ -1374,6 +1387,10 @@ function constructFromEvents(events, options) {
|
|
|
1374
1387
|
}
|
|
1375
1388
|
case 6: {
|
|
1376
1389
|
const frame = state.frames.pop();
|
|
1390
|
+
if (frame.kind === "mapping" && frame.hasKey) {
|
|
1391
|
+
state.position = frame.keyPosition;
|
|
1392
|
+
throwError$1(state, "incomplete mapping pair in event stream");
|
|
1393
|
+
}
|
|
1377
1394
|
if (frame.kind === "document") state.documents.push(frame.value);
|
|
1378
1395
|
else {
|
|
1379
1396
|
const value = frame.tag.carrierIsResult ? frame.value : finalizeCollection(state, frame.position, frame.tag, frame.value);
|
|
@@ -2046,10 +2063,6 @@ function parseNode(state, parentIndent, nodeContext, allowToSeek, allowCompact,
|
|
|
2046
2063
|
else if (state.lineIndent === parentIndent) indentStatus = 0;
|
|
2047
2064
|
else indentStatus = -1;
|
|
2048
2065
|
}
|
|
2049
|
-
if (state.position === state.lineStart && testDocumentSeparator(state)) {
|
|
2050
|
-
state.depth--;
|
|
2051
|
-
return false;
|
|
2052
|
-
}
|
|
2053
2066
|
if (indentStatus === 1) while (true) {
|
|
2054
2067
|
const ch = state.input.charCodeAt(state.position);
|
|
2055
2068
|
const propertyState = snapshotState(state);
|
|
@@ -2616,14 +2629,14 @@ function chooseScalarStyle(state, string, layout, singleLineOnly, forceQuote, in
|
|
|
2616
2629
|
if (char === CHAR_LINE_FEED) {
|
|
2617
2630
|
hasLineBreak = true;
|
|
2618
2631
|
if (shouldTrackWidth) {
|
|
2619
|
-
hasFoldableLine = hasFoldableLine || i - previousLineBreak - 1 > lineWidth && string[previousLineBreak + 1]
|
|
2632
|
+
hasFoldableLine = hasFoldableLine || i - previousLineBreak - 1 > lineWidth && !isMoreIndented(string[previousLineBreak + 1]);
|
|
2620
2633
|
previousLineBreak = i;
|
|
2621
2634
|
}
|
|
2622
2635
|
} else if (!isPrintable(char)) return STYLE_DOUBLE;
|
|
2623
2636
|
plain = plain && isPlainSafe(char, prevChar, inblock);
|
|
2624
2637
|
prevChar = char;
|
|
2625
2638
|
}
|
|
2626
|
-
hasFoldableLine = hasFoldableLine || shouldTrackWidth && i - previousLineBreak - 1 > lineWidth && string[previousLineBreak + 1]
|
|
2639
|
+
hasFoldableLine = hasFoldableLine || shouldTrackWidth && i - previousLineBreak - 1 > lineWidth && !isMoreIndented(string[previousLineBreak + 1]);
|
|
2627
2640
|
}
|
|
2628
2641
|
if (!hasLineBreak && !hasFoldableLine) {
|
|
2629
2642
|
if (plain && !forceQuote) return STYLE_PLAIN;
|
|
@@ -2682,27 +2695,30 @@ function encodeFlowBreaks(string, indent) {
|
|
|
2682
2695
|
function dropEndingNewline(string) {
|
|
2683
2696
|
return string[string.length - 1] === "\n" ? string.slice(0, -1) : string;
|
|
2684
2697
|
}
|
|
2698
|
+
function isMoreIndented(char) {
|
|
2699
|
+
return char === " " || char === " ";
|
|
2700
|
+
}
|
|
2685
2701
|
function foldBlockScalar(string, width) {
|
|
2686
2702
|
const lineRe = /(\n+)([^\n]*)/g;
|
|
2687
2703
|
let nextLF = string.indexOf("\n");
|
|
2688
2704
|
if (nextLF === -1) nextLF = string.length;
|
|
2689
2705
|
lineRe.lastIndex = nextLF;
|
|
2690
2706
|
let result = foldLine(string.slice(0, nextLF), width);
|
|
2691
|
-
let prevMoreIndented = string[0] === "\n" || string[0]
|
|
2707
|
+
let prevMoreIndented = string[0] === "\n" || isMoreIndented(string[0]);
|
|
2692
2708
|
let moreIndented;
|
|
2693
2709
|
let match;
|
|
2694
2710
|
while (match = lineRe.exec(string)) {
|
|
2695
2711
|
const prefix = match[1];
|
|
2696
2712
|
const line = match[2];
|
|
2697
|
-
moreIndented = line
|
|
2713
|
+
moreIndented = line !== "" && isMoreIndented(line[0]);
|
|
2698
2714
|
result += prefix + (!prevMoreIndented && !moreIndented && line !== "" ? "\n" : "") + foldLine(line, width);
|
|
2699
2715
|
prevMoreIndented = moreIndented;
|
|
2700
2716
|
}
|
|
2701
2717
|
return result;
|
|
2702
2718
|
}
|
|
2703
2719
|
function foldLine(line, width) {
|
|
2704
|
-
if (line === "" || line[0]
|
|
2705
|
-
const breakRe = / [^ ]/g;
|
|
2720
|
+
if (line === "" || isMoreIndented(line[0])) return line;
|
|
2721
|
+
const breakRe = / [^ \t]/g;
|
|
2706
2722
|
let match;
|
|
2707
2723
|
let start = 0;
|
|
2708
2724
|
let end;
|
|
@@ -3128,6 +3144,7 @@ function eventsToAst(events, options) {
|
|
|
3128
3144
|
}
|
|
3129
3145
|
case 6: {
|
|
3130
3146
|
const frame = state.frames.pop();
|
|
3147
|
+
if (frame.kind === "mapping" && frame.key) throw new Error("incomplete mapping pair in event stream");
|
|
3131
3148
|
if (frame.kind === "document") state.documents.push(frame.doc);
|
|
3132
3149
|
else addNode(state, frame.node);
|
|
3133
3150
|
break;
|