diff --git a/dist/index.js b/dist/index.js index 4e269d7..ba5d534 100644 --- a/dist/index.js +++ b/dist/index.js @@ -10762,8 +10762,8 @@ function composeCollection(CN, ctx, token, props, onError) { tag = kt; } else { - if (kt?.collection) { - onError(tagToken, 'BAD_COLLECTION_TYPE', `${kt.tag} used for ${expType} collection, but expects ${kt.collection}`, true); + if (kt) { + onError(tagToken, 'BAD_COLLECTION_TYPE', `${kt.tag} used for ${expType} collection, but expects ${kt.collection ?? 'scalar'}`, true); } else { onError(tagToken, 'TAG_RESOLVE_FAILED', `Unresolved tag: ${tagName}`, true); @@ -16228,7 +16228,20 @@ class Parser { default: { const bv = this.startBlockValue(map); if (bv) { - if (atMapIndent && bv.type !== 'block-seq') { + if (bv.type === 'block-seq') { + if (!it.explicitKey && + it.sep && + !includesToken(it.sep, 'newline')) { + yield* this.pop({ + type: 'error', + offset: this.offset, + message: 'Unexpected block-seq-ind on same line with key', + source: this.source + }); + return; + } + } + else if (atMapIndent) { map.items.push({ start }); } this.stack.push(bv); @@ -17167,6 +17180,8 @@ const binary = { } }, stringify({ comment, type, value }, ctx, onComment, onChompKeep) { + if (!value) + return ''; const buf = value; // checked earlier by binary.identify() let str; if (typeof node_buffer.Buffer === 'function') { @@ -17890,7 +17905,7 @@ const timestamp = { } return new Date(date); }, - stringify: ({ value }) => value.toISOString().replace(/(T00:00:00)?\.000Z$/, '') + stringify: ({ value }) => value?.toISOString().replace(/(T00:00:00)?\.000Z$/, '') ?? '' }; exports.floatTime = floatTime;