summaryrefslogtreecommitdiff
path: root/node_modules/yaml/dist/compose/compose-collection.js
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/yaml/dist/compose/compose-collection.js')
-rw-r--r--node_modules/yaml/dist/compose/compose-collection.js18
1 files changed, 15 insertions, 3 deletions
diff --git a/node_modules/yaml/dist/compose/compose-collection.js b/node_modules/yaml/dist/compose/compose-collection.js
index e4b19715..3f91468c 100644
--- a/node_modules/yaml/dist/compose/compose-collection.js
+++ b/node_modules/yaml/dist/compose/compose-collection.js
@@ -25,10 +25,23 @@ function resolveCollection(CN, ctx, token, onError, tagName, tag) {
coll.tag = tagName;
return coll;
}
-function composeCollection(CN, ctx, token, tagToken, onError) {
+function composeCollection(CN, ctx, token, props, onError) {
+ const tagToken = props.tag;
const tagName = !tagToken
? null
: ctx.directives.tagName(tagToken.source, msg => onError(tagToken, 'TAG_RESOLVE_FAILED', msg));
+ if (token.type === 'block-seq') {
+ const { anchor, newlineAfterProp: nl } = props;
+ const lastProp = anchor && tagToken
+ ? anchor.offset > tagToken.offset
+ ? anchor
+ : tagToken
+ : (anchor ?? tagToken);
+ if (lastProp && (!nl || nl.offset < lastProp.offset)) {
+ const message = 'Missing newline after block sequence props';
+ onError(lastProp, 'MISSING_CHAR', message);
+ }
+ }
const expType = token.type === 'block-map'
? 'map'
: token.type === 'block-seq'
@@ -42,8 +55,7 @@ function composeCollection(CN, ctx, token, tagToken, onError) {
!tagName ||
tagName === '!' ||
(tagName === YAMLMap.YAMLMap.tagName && expType === 'map') ||
- (tagName === YAMLSeq.YAMLSeq.tagName && expType === 'seq') ||
- !expType) {
+ (tagName === YAMLSeq.YAMLSeq.tagName && expType === 'seq')) {
return resolveCollection(CN, ctx, token, onError, tagName);
}
let tag = ctx.schema.tags.find(t => t.tag === tagName && t.collection === expType);