@@ -63614,10 +63614,23 @@ function resolveCollection(CN, ctx, token, onError, tagName, tag) {
63614
63614
coll.tag = tagName;
63615
63615
return coll;
63616
63616
}
63617
- function composeCollection(CN, ctx, token, tagToken, onError) {
63617
+ function composeCollection(CN, ctx, token, props, onError) {
63618
+ const tagToken = props.tag;
63618
63619
const tagName = !tagToken
63619
63620
? null
63620
63621
: ctx.directives.tagName(tagToken.source, msg => onError(tagToken, 'TAG_RESOLVE_FAILED', msg));
63622
+ if (token.type === 'block-seq') {
63623
+ const { anchor, newlineAfterProp: nl } = props;
63624
+ const lastProp = anchor && tagToken
63625
+ ? anchor.offset > tagToken.offset
63626
+ ? anchor
63627
+ : tagToken
63628
+ : (anchor ?? tagToken);
63629
+ if (lastProp && (!nl || nl.offset < lastProp.offset)) {
63630
+ const message = 'Missing newline after block sequence props';
63631
+ onError(lastProp, 'MISSING_CHAR', message);
63632
+ }
63633
+ }
63621
63634
const expType = token.type === 'block-map'
63622
63635
? 'map'
63623
63636
: token.type === 'block-seq'
@@ -63631,8 +63644,7 @@ function composeCollection(CN, ctx, token, tagToken, onError) {
63631
63644
!tagName ||
63632
63645
tagName === '!' ||
63633
63646
(tagName === YAMLMap.YAMLMap.tagName && expType === 'map') ||
63634
- (tagName === YAMLSeq.YAMLSeq.tagName && expType === 'seq') ||
63635
- !expType) {
63647
+ (tagName === YAMLSeq.YAMLSeq.tagName && expType === 'seq')) {
63636
63648
return resolveCollection(CN, ctx, token, onError, tagName);
63637
63649
}
63638
63650
let tag = ctx.schema.tags.find(t => t.tag === tagName && t.collection === expType);
@@ -63755,7 +63767,7 @@ function composeNode(ctx, token, props, onError) {
63755
63767
case 'block-map':
63756
63768
case 'block-seq':
63757
63769
case 'flow-collection':
63758
- node = composeCollection.composeCollection(CN, ctx, token, tag , onError);
63770
+ node = composeCollection.composeCollection(CN, ctx, token, props , onError);
63759
63771
if (anchor)
63760
63772
node.anchor = anchor.source.substring(1);
63761
63773
break;
@@ -64193,7 +64205,7 @@ function resolveBlockMap({ composeNode, composeEmptyNode }, ctx, bm, onError, ta
64193
64205
}
64194
64206
continue;
64195
64207
}
64196
- if (keyProps.hasNewlineAfterProp || utilContainsNewline.containsNewline(key)) {
64208
+ if (keyProps.newlineAfterProp || utilContainsNewline.containsNewline(key)) {
64197
64209
onError(key ?? start[start.length - 1], 'MULTILINE_IMPLICIT_KEY', 'Implicit keys need to be on a single line');
64198
64210
}
64199
64211
}
@@ -65035,11 +65047,11 @@ function resolveProps(tokens, { flow, indicator, next, offset, onError, parentIn
65035
65047
let comment = '';
65036
65048
let commentSep = '';
65037
65049
let hasNewline = false;
65038
- let hasNewlineAfterProp = false;
65039
65050
let reqSpace = false;
65040
65051
let tab = null;
65041
65052
let anchor = null;
65042
65053
let tag = null;
65054
+ let newlineAfterProp = null;
65043
65055
let comma = null;
65044
65056
let found = null;
65045
65057
let start = null;
@@ -65093,7 +65105,7 @@ function resolveProps(tokens, { flow, indicator, next, offset, onError, parentIn
65093
65105
atNewline = true;
65094
65106
hasNewline = true;
65095
65107
if (anchor || tag)
65096
- hasNewlineAfterProp = true ;
65108
+ newlineAfterProp = token ;
65097
65109
hasSpace = true;
65098
65110
break;
65099
65111
case 'anchor':
@@ -65167,9 +65179,9 @@ function resolveProps(tokens, { flow, indicator, next, offset, onError, parentIn
65167
65179
spaceBefore,
65168
65180
comment,
65169
65181
hasNewline,
65170
- hasNewlineAfterProp,
65171
65182
anchor,
65172
65183
tag,
65184
+ newlineAfterProp,
65173
65185
end,
65174
65186
start: start ?? end
65175
65187
};
@@ -66508,7 +66520,6 @@ class Collection extends Node.NodeBase {
66508
66520
}
66509
66521
}
66510
66522
}
66511
- Collection.maxFlowStringSingleLineLength = 60;
66512
66523
66513
66524
exports.Collection = Collection;
66514
66525
exports.collectionFromPath = collectionFromPath;
@@ -67969,15 +67980,11 @@ class Lexer {
67969
67980
if (!this.atEnd && !this.hasChars(4))
67970
67981
return this.setNext('line-start');
67971
67982
const s = this.peek(3);
67972
- if (s === '---' && isEmpty(this.charAt(3))) {
67983
+ if (( s === '---' || s === '...') && isEmpty(this.charAt(3))) {
67973
67984
yield* this.pushCount(3);
67974
67985
this.indentValue = 0;
67975
67986
this.indentNext = 0;
67976
- return 'doc';
67977
- }
67978
- else if (s === '...' && isEmpty(this.charAt(3))) {
67979
- yield* this.pushCount(3);
67980
- return 'stream';
67987
+ return s === '---' ? 'doc' : 'stream';
67981
67988
}
67982
67989
}
67983
67990
this.indentValue = yield* this.pushSpaces(false);
@@ -70722,6 +70729,8 @@ const FOLD_QUOTED = 'quoted';
70722
70729
function foldFlowLines(text, indent, mode = 'flow', { indentAtStart, lineWidth = 80, minContentWidth = 20, onFold, onOverflow } = {}) {
70723
70730
if (!lineWidth || lineWidth < 0)
70724
70731
return text;
70732
+ if (lineWidth < minContentWidth)
70733
+ minContentWidth = 0;
70725
70734
const endStep = Math.max(1 + minContentWidth, 1 + lineWidth - indent.length);
70726
70735
if (text.length <= endStep)
70727
70736
return text;
0 commit comments