summaryrefslogtreecommitdiff
path: root/node_modules/yaml/browser/dist/compose/compose-collection.js
diff options
context:
space:
mode:
authorlittleblack111 <littleblack11111@gmail.com>2024-08-30 17:21:18 +0800
committerlittleblack111 <littleblack11111@gmail.com>2024-08-30 17:21:18 +0800
commitefbc2ffe6a1ee5ec38a4396305561d6515d0943e (patch)
tree2b4c94f18f2c792dfda813050755d5c0273fae22 /node_modules/yaml/browser/dist/compose/compose-collection.js
parent43acceb75957c880a5ba5a31aae221394a36d5f6 (diff)
node fixes, updates
Diffstat (limited to 'node_modules/yaml/browser/dist/compose/compose-collection.js')
-rw-r--r--node_modules/yaml/browser/dist/compose/compose-collection.js18
1 files changed, 15 insertions, 3 deletions
diff --git a/node_modules/yaml/browser/dist/compose/compose-collection.js b/node_modules/yaml/browser/dist/compose/compose-collection.js
index 8d4507f3..b80fba27 100644
--- a/node_modules/yaml/browser/dist/compose/compose-collection.js
+++ b/node_modules/yaml/browser/dist/compose/compose-collection.js
@@ -23,10 +23,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'
@@ -40,8 +53,7 @@ function composeCollection(CN, ctx, token, tagToken, onError) {
!tagName ||
tagName === '!' ||
(tagName === YAMLMap.tagName && expType === 'map') ||
- (tagName === YAMLSeq.tagName && expType === 'seq') ||
- !expType) {
+ (tagName === YAMLSeq.tagName && expType === 'seq')) {
return resolveCollection(CN, ctx, token, onError, tagName);
}
let tag = ctx.schema.tags.find(t => t.tag === tagName && t.collection === expType);