Added missing changes and modified dist assets.
This commit is contained in:
parent
57a81a39f3
commit
2972fe4d6b
48
dist/index.js
generated
vendored
48
dist/index.js
generated
vendored
@ -63098,6 +63098,7 @@ function composeDoc(options, directives, { offset, start, value, end }, onError)
|
||||
next: value ?? end?.[0],
|
||||
offset,
|
||||
onError,
|
||||
parentIndent: 0,
|
||||
startOnNewline: true
|
||||
});
|
||||
if (props.found) {
|
||||
@ -63240,7 +63241,7 @@ var resolveFlowScalar = __nccwpck_require__(261);
|
||||
|
||||
function composeScalar(ctx, token, tagToken, onError) {
|
||||
const { value, type, comment, range } = token.type === 'block-scalar'
|
||||
? resolveBlockScalar.resolveBlockScalar(token, ctx.options.strict, onError)
|
||||
? resolveBlockScalar.resolveBlockScalar(ctx, token, onError)
|
||||
: resolveFlowScalar.resolveFlowScalar(token, ctx.options.strict, onError);
|
||||
const tagName = tagToken
|
||||
? ctx.directives.tagName(tagToken.source, msg => onError(tagToken, 'TAG_RESOLVE_FAILED', msg))
|
||||
@ -63575,6 +63576,7 @@ function resolveBlockMap({ composeNode, composeEmptyNode }, ctx, bm, onError, ta
|
||||
next: key ?? sep?.[0],
|
||||
offset,
|
||||
onError,
|
||||
parentIndent: bm.indent,
|
||||
startOnNewline: true
|
||||
});
|
||||
const implicitKey = !keyProps.found;
|
||||
@ -63617,6 +63619,7 @@ function resolveBlockMap({ composeNode, composeEmptyNode }, ctx, bm, onError, ta
|
||||
next: value,
|
||||
offset: keyNode.range[2],
|
||||
onError,
|
||||
parentIndent: bm.indent,
|
||||
startOnNewline: !key || key.type === 'block-scalar'
|
||||
});
|
||||
offset = valueProps.end;
|
||||
@ -63675,9 +63678,9 @@ exports.resolveBlockMap = resolveBlockMap;
|
||||
|
||||
var Scalar = __nccwpck_require__(9338);
|
||||
|
||||
function resolveBlockScalar(scalar, strict, onError) {
|
||||
function resolveBlockScalar(ctx, scalar, onError) {
|
||||
const start = scalar.offset;
|
||||
const header = parseBlockScalarHeader(scalar, strict, onError);
|
||||
const header = parseBlockScalarHeader(scalar, ctx.options.strict, onError);
|
||||
if (!header)
|
||||
return { value: '', type: null, comment: '', range: [start, start, start] };
|
||||
const type = header.mode === '>' ? Scalar.Scalar.BLOCK_FOLDED : Scalar.Scalar.BLOCK_LITERAL;
|
||||
@ -63719,6 +63722,10 @@ function resolveBlockScalar(scalar, strict, onError) {
|
||||
if (header.indent === 0)
|
||||
trimIndent = indent.length;
|
||||
contentStart = i;
|
||||
if (trimIndent === 0 && !ctx.atRoot) {
|
||||
const message = 'Block scalar values in collections must be indented';
|
||||
onError(offset, 'BAD_INDENT', message);
|
||||
}
|
||||
break;
|
||||
}
|
||||
offset += indent.length + content.length + 1;
|
||||
@ -63894,6 +63901,7 @@ function resolveBlockSeq({ composeNode, composeEmptyNode }, ctx, bs, onError, ta
|
||||
next: value,
|
||||
offset,
|
||||
onError,
|
||||
parentIndent: bs.indent,
|
||||
startOnNewline: true
|
||||
});
|
||||
if (!props.found) {
|
||||
@ -64010,6 +64018,7 @@ function resolveFlowCollection({ composeNode, composeEmptyNode }, ctx, fc, onErr
|
||||
next: key ?? sep?.[0],
|
||||
offset,
|
||||
onError,
|
||||
parentIndent: fc.indent,
|
||||
startOnNewline: false
|
||||
});
|
||||
if (!props.found) {
|
||||
@ -64091,6 +64100,7 @@ function resolveFlowCollection({ composeNode, composeEmptyNode }, ctx, fc, onErr
|
||||
next: value,
|
||||
offset: keyNode.range[2],
|
||||
onError,
|
||||
parentIndent: fc.indent,
|
||||
startOnNewline: false
|
||||
});
|
||||
if (valueProps.found) {
|
||||
@ -64422,7 +64432,7 @@ exports.resolveFlowScalar = resolveFlowScalar;
|
||||
"use strict";
|
||||
|
||||
|
||||
function resolveProps(tokens, { flow, indicator, next, offset, onError, startOnNewline }) {
|
||||
function resolveProps(tokens, { flow, indicator, next, offset, onError, parentIndent, startOnNewline }) {
|
||||
let spaceBefore = false;
|
||||
let atNewline = startOnNewline;
|
||||
let hasSpace = startOnNewline;
|
||||
@ -64446,7 +64456,7 @@ function resolveProps(tokens, { flow, indicator, next, offset, onError, startOnN
|
||||
reqSpace = false;
|
||||
}
|
||||
if (tab) {
|
||||
if (token.type !== 'comment') {
|
||||
if (atNewline && token.type !== 'comment' && token.type !== 'newline') {
|
||||
onError(tab, 'TAB_AS_INDENT', 'Tabs are not allowed as indentation');
|
||||
}
|
||||
tab = null;
|
||||
@ -64457,9 +64467,8 @@ function resolveProps(tokens, { flow, indicator, next, offset, onError, startOnN
|
||||
// as leading white space rather than indentation.
|
||||
// In a flow collection, only the parser handles indent.
|
||||
if (!flow &&
|
||||
atNewline &&
|
||||
(indicator !== 'doc-start' || next?.type !== 'flow-collection') &&
|
||||
token.source[0] === '\t') {
|
||||
token.source.includes('\t')) {
|
||||
tab = token;
|
||||
}
|
||||
hasSpace = true;
|
||||
@ -64521,7 +64530,8 @@ function resolveProps(tokens, { flow, indicator, next, offset, onError, startOnN
|
||||
if (found)
|
||||
onError(token, 'UNEXPECTED_TOKEN', `Unexpected ${token.source} in ${flow ?? 'collection'}`);
|
||||
found = token;
|
||||
atNewline = false;
|
||||
atNewline =
|
||||
indicator === 'seq-item-ind' || indicator === 'explicit-key-ind';
|
||||
hasSpace = false;
|
||||
break;
|
||||
case 'comma':
|
||||
@ -64550,7 +64560,10 @@ function resolveProps(tokens, { flow, indicator, next, offset, onError, startOnN
|
||||
(next.type !== 'scalar' || next.source !== '')) {
|
||||
onError(next.offset, 'MISSING_CHAR', 'Tags and anchors must be separated from the next token by white space');
|
||||
}
|
||||
if (tab)
|
||||
if (tab &&
|
||||
((atNewline && tab.indent <= parentIndent) ||
|
||||
next?.type === 'block-map' ||
|
||||
next?.type === 'block-seq'))
|
||||
onError(tab, 'TAB_AS_INDENT', 'Tabs are not allowed as indentation');
|
||||
return {
|
||||
comma,
|
||||
@ -66564,7 +66577,7 @@ function resolveAsScalar(token, strict = true, onError) {
|
||||
case 'double-quoted-scalar':
|
||||
return resolveFlowScalar.resolveFlowScalar(token, strict, _onError);
|
||||
case 'block-scalar':
|
||||
return resolveBlockScalar.resolveBlockScalar(token, strict, _onError);
|
||||
return resolveBlockScalar.resolveBlockScalar({ options: { strict } }, token, _onError);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
@ -67611,14 +67624,25 @@ class Lexer {
|
||||
nl = this.buffer.length;
|
||||
}
|
||||
}
|
||||
if (!this.blockScalarKeep) {
|
||||
// Trailing insufficiently indented tabs are invalid.
|
||||
// To catch that during parsing, we include them in the block scalar value.
|
||||
let i = nl + 1;
|
||||
ch = this.buffer[i];
|
||||
while (ch === ' ')
|
||||
ch = this.buffer[++i];
|
||||
if (ch === '\t') {
|
||||
while (ch === '\t' || ch === ' ' || ch === '\r' || ch === '\n')
|
||||
ch = this.buffer[++i];
|
||||
nl = i - 1;
|
||||
}
|
||||
else if (!this.blockScalarKeep) {
|
||||
do {
|
||||
let i = nl - 1;
|
||||
let ch = this.buffer[i];
|
||||
if (ch === '\r')
|
||||
ch = this.buffer[--i];
|
||||
const lastChar = i; // Drop the line if last char not more indented
|
||||
while (ch === ' ' || ch === '\t')
|
||||
while (ch === ' ')
|
||||
ch = this.buffer[--i];
|
||||
if (ch === '\n' && i >= this.pos && i + 1 + indent > lastChar)
|
||||
nl = i;
|
||||
|
2
dist/index.js.map
generated
vendored
2
dist/index.js.map
generated
vendored
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user