mirror of
https://github.com/dawidd6/action-ansible-playbook.git
synced 2026-08-11 02:46:21 -06:00
node_modules: update (#146)
Co-authored-by: dawidd6 <9713907+dawidd6@users.noreply.github.com>
This commit is contained in:
+11
-4
@@ -30,19 +30,26 @@ function composeNode(ctx, token, props, onError) {
|
||||
case 'block-map':
|
||||
case 'block-seq':
|
||||
case 'flow-collection':
|
||||
node = composeCollection.composeCollection(CN, ctx, token, props, onError);
|
||||
if (anchor)
|
||||
node.anchor = anchor.source.substring(1);
|
||||
try {
|
||||
node = composeCollection.composeCollection(CN, ctx, token, props, onError);
|
||||
if (anchor)
|
||||
node.anchor = anchor.source.substring(1);
|
||||
}
|
||||
catch (error) {
|
||||
// Almost certainly here due to a stack overflow
|
||||
const message = error instanceof Error ? error.message : String(error);
|
||||
onError(token, 'RESOURCE_EXHAUSTION', message);
|
||||
}
|
||||
break;
|
||||
default: {
|
||||
const message = token.type === 'error'
|
||||
? token.message
|
||||
: `Unsupported token (type: ${token.type})`;
|
||||
onError(token, 'UNEXPECTED_TOKEN', message);
|
||||
node = composeEmptyNode(ctx, token.offset, undefined, null, props, onError);
|
||||
isSrcToken = false;
|
||||
}
|
||||
}
|
||||
node ?? (node = composeEmptyNode(ctx, token.offset, undefined, null, props, onError));
|
||||
if (anchor && node.anchor === '')
|
||||
onError(anchor, 'BAD_ALIAS', 'Anchor cannot be an empty string');
|
||||
if (atKey &&
|
||||
|
||||
+4
-2
@@ -97,8 +97,10 @@ class Composer {
|
||||
}
|
||||
}
|
||||
if (afterDoc) {
|
||||
Array.prototype.push.apply(doc.errors, this.errors);
|
||||
Array.prototype.push.apply(doc.warnings, this.warnings);
|
||||
for (let i = 0; i < this.errors.length; ++i)
|
||||
doc.errors.push(this.errors[i]);
|
||||
for (let i = 0; i < this.warnings.length; ++i)
|
||||
doc.warnings.push(this.warnings[i]);
|
||||
}
|
||||
else {
|
||||
doc.errors = this.errors;
|
||||
|
||||
+5
-3
@@ -144,7 +144,7 @@ function doubleQuotedValue(source, onError) {
|
||||
next = source[++i + 1];
|
||||
}
|
||||
else if (next === 'x' || next === 'u' || next === 'U') {
|
||||
const length = { x: 2, u: 4, U: 8 }[next];
|
||||
const length = next === 'x' ? 2 : next === 'u' ? 4 : 8;
|
||||
res += parseCharCode(source, i + 1, length, onError);
|
||||
i += length;
|
||||
}
|
||||
@@ -214,12 +214,14 @@ function parseCharCode(source, offset, length, onError) {
|
||||
const cc = source.substr(offset, length);
|
||||
const ok = cc.length === length && /^[0-9a-fA-F]+$/.test(cc);
|
||||
const code = ok ? parseInt(cc, 16) : NaN;
|
||||
if (isNaN(code)) {
|
||||
try {
|
||||
return String.fromCodePoint(code);
|
||||
}
|
||||
catch {
|
||||
const raw = source.substr(offset - 2, length + 2);
|
||||
onError(offset - 2, 'BAD_DQ_ESCAPE', `Invalid escape sequence ${raw}`);
|
||||
return raw;
|
||||
}
|
||||
return String.fromCodePoint(code);
|
||||
}
|
||||
|
||||
exports.resolveFlowScalar = resolveFlowScalar;
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
import type { LineCounter } from './parse/line-counter';
|
||||
export type ErrorCode = 'ALIAS_PROPS' | 'BAD_ALIAS' | 'BAD_DIRECTIVE' | 'BAD_DQ_ESCAPE' | 'BAD_INDENT' | 'BAD_PROP_ORDER' | 'BAD_SCALAR_START' | 'BLOCK_AS_IMPLICIT_KEY' | 'BLOCK_IN_FLOW' | 'DUPLICATE_KEY' | 'IMPOSSIBLE' | 'KEY_OVER_1024_CHARS' | 'MISSING_CHAR' | 'MULTILINE_IMPLICIT_KEY' | 'MULTIPLE_ANCHORS' | 'MULTIPLE_DOCS' | 'MULTIPLE_TAGS' | 'NON_STRING_KEY' | 'TAB_AS_INDENT' | 'TAG_RESOLVE_FAILED' | 'UNEXPECTED_TOKEN' | 'BAD_COLLECTION_TYPE';
|
||||
export type ErrorCode = 'ALIAS_PROPS' | 'BAD_ALIAS' | 'BAD_DIRECTIVE' | 'BAD_DQ_ESCAPE' | 'BAD_INDENT' | 'BAD_PROP_ORDER' | 'BAD_SCALAR_START' | 'BLOCK_AS_IMPLICIT_KEY' | 'BLOCK_IN_FLOW' | 'DUPLICATE_KEY' | 'IMPOSSIBLE' | 'KEY_OVER_1024_CHARS' | 'MISSING_CHAR' | 'MULTILINE_IMPLICIT_KEY' | 'MULTIPLE_ANCHORS' | 'MULTIPLE_DOCS' | 'MULTIPLE_TAGS' | 'NON_STRING_KEY' | 'RESOURCE_EXHAUSTION' | 'TAB_AS_INDENT' | 'TAG_RESOLVE_FAILED' | 'UNEXPECTED_TOKEN' | 'BAD_COLLECTION_TYPE';
|
||||
export type LinePos = {
|
||||
line: number;
|
||||
col: number;
|
||||
|
||||
+2
@@ -21,6 +21,8 @@ class Alias extends Node.NodeBase {
|
||||
* instance of the `source` anchor before this node.
|
||||
*/
|
||||
resolve(doc, ctx) {
|
||||
if (ctx?.maxAliasCount === 0)
|
||||
throw new ReferenceError('Alias resolution is disabled');
|
||||
let nodes;
|
||||
if (ctx?.aliasResolveCache) {
|
||||
nodes = ctx.aliasResolveCache;
|
||||
|
||||
+5
-1
@@ -31,7 +31,11 @@ export declare class Scalar<T = unknown> extends NodeBase {
|
||||
* The YAML 1.1 schema also supports 'BIN' and 'TIME'
|
||||
*/
|
||||
format?: string;
|
||||
/** If `value` is a number, use this value when stringifying this node. */
|
||||
/**
|
||||
* If `value` is a number that is serialized as a decimal string
|
||||
* (i.e. not using exponential notation),
|
||||
* use this value when stringifying this node.
|
||||
*/
|
||||
minFractionDigits?: number;
|
||||
/** Set during parsing to the source string value */
|
||||
source?: string;
|
||||
|
||||
+6
@@ -326,6 +326,12 @@ export type ToStringOptions = {
|
||||
* Default: `null`
|
||||
*/
|
||||
singleQuote?: boolean | null;
|
||||
/**
|
||||
* Add a trailing comma after the last entry in a flow map or flow sequence that's split across multiple lines.
|
||||
*
|
||||
* Default: `'false'`
|
||||
*/
|
||||
trailingComma?: boolean;
|
||||
/**
|
||||
* String representation for `true`.
|
||||
* With the core schema, use `'true'`, `'True'`, or `'TRUE'`.
|
||||
|
||||
+28
-24
@@ -312,7 +312,7 @@ class Lexer {
|
||||
const n = (yield* this.pushCount(1)) + (yield* this.pushSpaces(true));
|
||||
this.indentNext = this.indentValue + 1;
|
||||
this.indentValue += n;
|
||||
return yield* this.parseBlockStart();
|
||||
return 'block-start';
|
||||
}
|
||||
return 'doc';
|
||||
}
|
||||
@@ -633,32 +633,36 @@ class Lexer {
|
||||
return 0;
|
||||
}
|
||||
*pushIndicators() {
|
||||
switch (this.charAt(0)) {
|
||||
case '!':
|
||||
return ((yield* this.pushTag()) +
|
||||
(yield* this.pushSpaces(true)) +
|
||||
(yield* this.pushIndicators()));
|
||||
case '&':
|
||||
return ((yield* this.pushUntil(isNotAnchorChar)) +
|
||||
(yield* this.pushSpaces(true)) +
|
||||
(yield* this.pushIndicators()));
|
||||
case '-': // this is an error
|
||||
case '?': // this is an error outside flow collections
|
||||
case ':': {
|
||||
const inFlow = this.flowLevel > 0;
|
||||
const ch1 = this.charAt(1);
|
||||
if (isEmpty(ch1) || (inFlow && flowIndicatorChars.has(ch1))) {
|
||||
if (!inFlow)
|
||||
this.indentNext = this.indentValue + 1;
|
||||
else if (this.flowKey)
|
||||
this.flowKey = false;
|
||||
return ((yield* this.pushCount(1)) +
|
||||
(yield* this.pushSpaces(true)) +
|
||||
(yield* this.pushIndicators()));
|
||||
let n = 0;
|
||||
loop: while (true) {
|
||||
switch (this.charAt(0)) {
|
||||
case '!':
|
||||
n += yield* this.pushTag();
|
||||
n += yield* this.pushSpaces(true);
|
||||
continue loop;
|
||||
case '&':
|
||||
n += yield* this.pushUntil(isNotAnchorChar);
|
||||
n += yield* this.pushSpaces(true);
|
||||
continue loop;
|
||||
case '-': // this is an error
|
||||
case '?': // this is an error outside flow collections
|
||||
case ':': {
|
||||
const inFlow = this.flowLevel > 0;
|
||||
const ch1 = this.charAt(1);
|
||||
if (isEmpty(ch1) || (inFlow && flowIndicatorChars.has(ch1))) {
|
||||
if (!inFlow)
|
||||
this.indentNext = this.indentValue + 1;
|
||||
else if (this.flowKey)
|
||||
this.flowKey = false;
|
||||
n += yield* this.pushCount(1);
|
||||
n += yield* this.pushSpaces(true);
|
||||
continue loop;
|
||||
}
|
||||
}
|
||||
}
|
||||
break loop;
|
||||
}
|
||||
return 0;
|
||||
return n;
|
||||
}
|
||||
*pushTag() {
|
||||
if (this.charAt(1) === '<') {
|
||||
|
||||
+12
-4
@@ -70,6 +70,14 @@ function getFirstKeyStartProps(prev) {
|
||||
}
|
||||
return prev.splice(i, prev.length);
|
||||
}
|
||||
function arrayPushArray(target, source) {
|
||||
// May exhaust call stack with large `source` array
|
||||
if (source.length < 1e5)
|
||||
Array.prototype.push.apply(target, source);
|
||||
else
|
||||
for (let i = 0; i < source.length; ++i)
|
||||
target.push(source[i]);
|
||||
}
|
||||
function fixFlowSeqItems(fc) {
|
||||
if (fc.start.type === 'flow-seq-start') {
|
||||
for (const it of fc.items) {
|
||||
@@ -82,12 +90,12 @@ function fixFlowSeqItems(fc) {
|
||||
delete it.key;
|
||||
if (isFlowToken(it.value)) {
|
||||
if (it.value.end)
|
||||
Array.prototype.push.apply(it.value.end, it.sep);
|
||||
arrayPushArray(it.value.end, it.sep);
|
||||
else
|
||||
it.value.end = it.sep;
|
||||
}
|
||||
else
|
||||
Array.prototype.push.apply(it.start, it.sep);
|
||||
arrayPushArray(it.start, it.sep);
|
||||
delete it.sep;
|
||||
}
|
||||
}
|
||||
@@ -507,7 +515,7 @@ class Parser {
|
||||
const prev = map.items[map.items.length - 2];
|
||||
const end = prev?.value?.end;
|
||||
if (Array.isArray(end)) {
|
||||
Array.prototype.push.apply(end, it.start);
|
||||
arrayPushArray(end, it.start);
|
||||
end.push(this.sourceToken);
|
||||
map.items.pop();
|
||||
return;
|
||||
@@ -722,7 +730,7 @@ class Parser {
|
||||
const prev = seq.items[seq.items.length - 2];
|
||||
const end = prev?.value?.end;
|
||||
if (Array.isArray(end)) {
|
||||
Array.prototype.push.apply(end, it.start);
|
||||
arrayPushArray(end, it.start);
|
||||
end.push(this.sourceToken);
|
||||
seq.items.pop();
|
||||
return;
|
||||
|
||||
+10
-7
@@ -28,18 +28,18 @@ const isMergeKey = (ctx, key) => (merge.identify(key) ||
|
||||
merge.identify(key.value))) &&
|
||||
ctx?.doc.schema.tags.some(tag => tag.tag === merge.tag && tag.default);
|
||||
function addMergeToJSMap(ctx, map, value) {
|
||||
value = ctx && identity.isAlias(value) ? value.resolve(ctx.doc) : value;
|
||||
if (identity.isSeq(value))
|
||||
for (const it of value.items)
|
||||
const source = resolveAliasValue(ctx, value);
|
||||
if (identity.isSeq(source))
|
||||
for (const it of source.items)
|
||||
mergeValue(ctx, map, it);
|
||||
else if (Array.isArray(value))
|
||||
for (const it of value)
|
||||
else if (Array.isArray(source))
|
||||
for (const it of source)
|
||||
mergeValue(ctx, map, it);
|
||||
else
|
||||
mergeValue(ctx, map, value);
|
||||
mergeValue(ctx, map, source);
|
||||
}
|
||||
function mergeValue(ctx, map, value) {
|
||||
const source = ctx && identity.isAlias(value) ? value.resolve(ctx.doc) : value;
|
||||
const source = resolveAliasValue(ctx, value);
|
||||
if (!identity.isMap(source))
|
||||
throw new Error('Merge sources must be maps or map aliases');
|
||||
const srcMap = source.toJSON(null, ctx, Map);
|
||||
@@ -62,6 +62,9 @@ function mergeValue(ctx, map, value) {
|
||||
}
|
||||
return map;
|
||||
}
|
||||
function resolveAliasValue(ctx, value) {
|
||||
return ctx && identity.isAlias(value) ? value.resolve(ctx.doc, ctx) : value;
|
||||
}
|
||||
|
||||
exports.addMergeToJSMap = addMergeToJSMap;
|
||||
exports.isMergeKey = isMergeKey;
|
||||
|
||||
+1
@@ -22,6 +22,7 @@ function createStringifyContext(doc, options) {
|
||||
nullStr: 'null',
|
||||
simpleKeys: false,
|
||||
singleQuote: null,
|
||||
trailingComma: false,
|
||||
trueStr: 'true',
|
||||
verifyAliasOrder: true
|
||||
}, doc.schema.toStringOptions, options);
|
||||
|
||||
+13
-3
@@ -104,12 +104,22 @@ function stringifyFlowCollection({ items }, ctx, { flowChars, itemIndent }) {
|
||||
if (comment)
|
||||
reqNewline = true;
|
||||
let str = stringify.stringify(item, itemCtx, () => (comment = null));
|
||||
if (i < items.length - 1)
|
||||
reqNewline || (reqNewline = lines.length > linesAtValue || str.includes('\n'));
|
||||
if (i < items.length - 1) {
|
||||
str += ',';
|
||||
}
|
||||
else if (ctx.options.trailingComma) {
|
||||
if (ctx.options.lineWidth > 0) {
|
||||
reqNewline || (reqNewline = lines.reduce((sum, line) => sum + line.length + 2, 2) +
|
||||
(str.length + 2) >
|
||||
ctx.options.lineWidth);
|
||||
}
|
||||
if (reqNewline) {
|
||||
str += ',';
|
||||
}
|
||||
}
|
||||
if (comment)
|
||||
str += stringifyComment.lineComment(str, itemIndent, commentString(comment));
|
||||
if (!reqNewline && (lines.length > linesAtValue || str.includes('\n')))
|
||||
reqNewline = true;
|
||||
lines.push(str);
|
||||
linesAtValue = lines.length;
|
||||
}
|
||||
|
||||
+2
-1
@@ -10,7 +10,8 @@ function stringifyNumber({ format, minFractionDigits, tag, value }) {
|
||||
if (!format &&
|
||||
minFractionDigits &&
|
||||
(!tag || tag === 'tag:yaml.org,2002:float') &&
|
||||
/^\d/.test(n)) {
|
||||
/^-?\d/.test(n) &&
|
||||
!n.includes('e')) {
|
||||
let i = n.indexOf('.');
|
||||
if (i < 0) {
|
||||
i = n.length;
|
||||
|
||||
Reference in New Issue
Block a user