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],
|
next: value ?? end?.[0],
|
||||||
offset,
|
offset,
|
||||||
onError,
|
onError,
|
||||||
|
parentIndent: 0,
|
||||||
startOnNewline: true
|
startOnNewline: true
|
||||||
});
|
});
|
||||||
if (props.found) {
|
if (props.found) {
|
||||||
@ -63240,7 +63241,7 @@ var resolveFlowScalar = __nccwpck_require__(261);
|
|||||||
|
|
||||||
function composeScalar(ctx, token, tagToken, onError) {
|
function composeScalar(ctx, token, tagToken, onError) {
|
||||||
const { value, type, comment, range } = token.type === 'block-scalar'
|
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);
|
: resolveFlowScalar.resolveFlowScalar(token, ctx.options.strict, onError);
|
||||||
const tagName = tagToken
|
const tagName = tagToken
|
||||||
? ctx.directives.tagName(tagToken.source, msg => onError(tagToken, 'TAG_RESOLVE_FAILED', msg))
|
? 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],
|
next: key ?? sep?.[0],
|
||||||
offset,
|
offset,
|
||||||
onError,
|
onError,
|
||||||
|
parentIndent: bm.indent,
|
||||||
startOnNewline: true
|
startOnNewline: true
|
||||||
});
|
});
|
||||||
const implicitKey = !keyProps.found;
|
const implicitKey = !keyProps.found;
|
||||||
@ -63617,6 +63619,7 @@ function resolveBlockMap({ composeNode, composeEmptyNode }, ctx, bm, onError, ta
|
|||||||
next: value,
|
next: value,
|
||||||
offset: keyNode.range[2],
|
offset: keyNode.range[2],
|
||||||
onError,
|
onError,
|
||||||
|
parentIndent: bm.indent,
|
||||||
startOnNewline: !key || key.type === 'block-scalar'
|
startOnNewline: !key || key.type === 'block-scalar'
|
||||||
});
|
});
|
||||||
offset = valueProps.end;
|
offset = valueProps.end;
|
||||||
@ -63675,9 +63678,9 @@ exports.resolveBlockMap = resolveBlockMap;
|
|||||||
|
|
||||||
var Scalar = __nccwpck_require__(9338);
|
var Scalar = __nccwpck_require__(9338);
|
||||||
|
|
||||||
function resolveBlockScalar(scalar, strict, onError) {
|
function resolveBlockScalar(ctx, scalar, onError) {
|
||||||
const start = scalar.offset;
|
const start = scalar.offset;
|
||||||
const header = parseBlockScalarHeader(scalar, strict, onError);
|
const header = parseBlockScalarHeader(scalar, ctx.options.strict, onError);
|
||||||
if (!header)
|
if (!header)
|
||||||
return { value: '', type: null, comment: '', range: [start, start, start] };
|
return { value: '', type: null, comment: '', range: [start, start, start] };
|
||||||
const type = header.mode === '>' ? Scalar.Scalar.BLOCK_FOLDED : Scalar.Scalar.BLOCK_LITERAL;
|
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)
|
if (header.indent === 0)
|
||||||
trimIndent = indent.length;
|
trimIndent = indent.length;
|
||||||
contentStart = i;
|
contentStart = i;
|
||||||
|
if (trimIndent === 0 && !ctx.atRoot) {
|
||||||
|
const message = 'Block scalar values in collections must be indented';
|
||||||
|
onError(offset, 'BAD_INDENT', message);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
offset += indent.length + content.length + 1;
|
offset += indent.length + content.length + 1;
|
||||||
@ -63894,6 +63901,7 @@ function resolveBlockSeq({ composeNode, composeEmptyNode }, ctx, bs, onError, ta
|
|||||||
next: value,
|
next: value,
|
||||||
offset,
|
offset,
|
||||||
onError,
|
onError,
|
||||||
|
parentIndent: bs.indent,
|
||||||
startOnNewline: true
|
startOnNewline: true
|
||||||
});
|
});
|
||||||
if (!props.found) {
|
if (!props.found) {
|
||||||
@ -64010,6 +64018,7 @@ function resolveFlowCollection({ composeNode, composeEmptyNode }, ctx, fc, onErr
|
|||||||
next: key ?? sep?.[0],
|
next: key ?? sep?.[0],
|
||||||
offset,
|
offset,
|
||||||
onError,
|
onError,
|
||||||
|
parentIndent: fc.indent,
|
||||||
startOnNewline: false
|
startOnNewline: false
|
||||||
});
|
});
|
||||||
if (!props.found) {
|
if (!props.found) {
|
||||||
@ -64091,6 +64100,7 @@ function resolveFlowCollection({ composeNode, composeEmptyNode }, ctx, fc, onErr
|
|||||||
next: value,
|
next: value,
|
||||||
offset: keyNode.range[2],
|
offset: keyNode.range[2],
|
||||||
onError,
|
onError,
|
||||||
|
parentIndent: fc.indent,
|
||||||
startOnNewline: false
|
startOnNewline: false
|
||||||
});
|
});
|
||||||
if (valueProps.found) {
|
if (valueProps.found) {
|
||||||
@ -64422,7 +64432,7 @@ exports.resolveFlowScalar = resolveFlowScalar;
|
|||||||
"use strict";
|
"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 spaceBefore = false;
|
||||||
let atNewline = startOnNewline;
|
let atNewline = startOnNewline;
|
||||||
let hasSpace = startOnNewline;
|
let hasSpace = startOnNewline;
|
||||||
@ -64446,7 +64456,7 @@ function resolveProps(tokens, { flow, indicator, next, offset, onError, startOnN
|
|||||||
reqSpace = false;
|
reqSpace = false;
|
||||||
}
|
}
|
||||||
if (tab) {
|
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');
|
onError(tab, 'TAB_AS_INDENT', 'Tabs are not allowed as indentation');
|
||||||
}
|
}
|
||||||
tab = null;
|
tab = null;
|
||||||
@ -64457,9 +64467,8 @@ function resolveProps(tokens, { flow, indicator, next, offset, onError, startOnN
|
|||||||
// as leading white space rather than indentation.
|
// as leading white space rather than indentation.
|
||||||
// In a flow collection, only the parser handles indent.
|
// In a flow collection, only the parser handles indent.
|
||||||
if (!flow &&
|
if (!flow &&
|
||||||
atNewline &&
|
|
||||||
(indicator !== 'doc-start' || next?.type !== 'flow-collection') &&
|
(indicator !== 'doc-start' || next?.type !== 'flow-collection') &&
|
||||||
token.source[0] === '\t') {
|
token.source.includes('\t')) {
|
||||||
tab = token;
|
tab = token;
|
||||||
}
|
}
|
||||||
hasSpace = true;
|
hasSpace = true;
|
||||||
@ -64521,7 +64530,8 @@ function resolveProps(tokens, { flow, indicator, next, offset, onError, startOnN
|
|||||||
if (found)
|
if (found)
|
||||||
onError(token, 'UNEXPECTED_TOKEN', `Unexpected ${token.source} in ${flow ?? 'collection'}`);
|
onError(token, 'UNEXPECTED_TOKEN', `Unexpected ${token.source} in ${flow ?? 'collection'}`);
|
||||||
found = token;
|
found = token;
|
||||||
atNewline = false;
|
atNewline =
|
||||||
|
indicator === 'seq-item-ind' || indicator === 'explicit-key-ind';
|
||||||
hasSpace = false;
|
hasSpace = false;
|
||||||
break;
|
break;
|
||||||
case 'comma':
|
case 'comma':
|
||||||
@ -64550,7 +64560,10 @@ function resolveProps(tokens, { flow, indicator, next, offset, onError, startOnN
|
|||||||
(next.type !== 'scalar' || next.source !== '')) {
|
(next.type !== 'scalar' || next.source !== '')) {
|
||||||
onError(next.offset, 'MISSING_CHAR', 'Tags and anchors must be separated from the next token by white space');
|
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');
|
onError(tab, 'TAB_AS_INDENT', 'Tabs are not allowed as indentation');
|
||||||
return {
|
return {
|
||||||
comma,
|
comma,
|
||||||
@ -66564,7 +66577,7 @@ function resolveAsScalar(token, strict = true, onError) {
|
|||||||
case 'double-quoted-scalar':
|
case 'double-quoted-scalar':
|
||||||
return resolveFlowScalar.resolveFlowScalar(token, strict, _onError);
|
return resolveFlowScalar.resolveFlowScalar(token, strict, _onError);
|
||||||
case 'block-scalar':
|
case 'block-scalar':
|
||||||
return resolveBlockScalar.resolveBlockScalar(token, strict, _onError);
|
return resolveBlockScalar.resolveBlockScalar({ options: { strict } }, token, _onError);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
@ -67611,14 +67624,25 @@ class Lexer {
|
|||||||
nl = this.buffer.length;
|
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 {
|
do {
|
||||||
let i = nl - 1;
|
let i = nl - 1;
|
||||||
let ch = this.buffer[i];
|
let ch = this.buffer[i];
|
||||||
if (ch === '\r')
|
if (ch === '\r')
|
||||||
ch = this.buffer[--i];
|
ch = this.buffer[--i];
|
||||||
const lastChar = i; // Drop the line if last char not more indented
|
const lastChar = i; // Drop the line if last char not more indented
|
||||||
while (ch === ' ' || ch === '\t')
|
while (ch === ' ')
|
||||||
ch = this.buffer[--i];
|
ch = this.buffer[--i];
|
||||||
if (ch === '\n' && i >= this.pos && i + 1 + indent > lastChar)
|
if (ch === '\n' && i >= this.pos && i + 1 + indent > lastChar)
|
||||||
nl = i;
|
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