init 3
This commit is contained in:
28
node_modules/yaml/dist/compose/util-empty-scalar-position.js
generated
vendored
Normal file
28
node_modules/yaml/dist/compose/util-empty-scalar-position.js
generated
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
'use strict';
|
||||
|
||||
function emptyScalarPosition(offset, before, pos) {
|
||||
if (before) {
|
||||
pos ?? (pos = before.length);
|
||||
for (let i = pos - 1; i >= 0; --i) {
|
||||
let st = before[i];
|
||||
switch (st.type) {
|
||||
case 'space':
|
||||
case 'comment':
|
||||
case 'newline':
|
||||
offset -= st.source.length;
|
||||
continue;
|
||||
}
|
||||
// Technically, an empty scalar is immediately after the last non-empty
|
||||
// node, but it's more useful to place it after any whitespace.
|
||||
st = before[++i];
|
||||
while (st?.type === 'space') {
|
||||
offset += st.source.length;
|
||||
st = before[++i];
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return offset;
|
||||
}
|
||||
|
||||
exports.emptyScalarPosition = emptyScalarPosition;
|
||||
50
node_modules/yaml/dist/index.js
generated
vendored
Normal file
50
node_modules/yaml/dist/index.js
generated
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
'use strict';
|
||||
|
||||
var composer = require('./compose/composer.js');
|
||||
var Document = require('./doc/Document.js');
|
||||
var Schema = require('./schema/Schema.js');
|
||||
var errors = require('./errors.js');
|
||||
var Alias = require('./nodes/Alias.js');
|
||||
var identity = require('./nodes/identity.js');
|
||||
var Pair = require('./nodes/Pair.js');
|
||||
var Scalar = require('./nodes/Scalar.js');
|
||||
var YAMLMap = require('./nodes/YAMLMap.js');
|
||||
var YAMLSeq = require('./nodes/YAMLSeq.js');
|
||||
var cst = require('./parse/cst.js');
|
||||
var lexer = require('./parse/lexer.js');
|
||||
var lineCounter = require('./parse/line-counter.js');
|
||||
var parser = require('./parse/parser.js');
|
||||
var publicApi = require('./public-api.js');
|
||||
var visit = require('./visit.js');
|
||||
|
||||
|
||||
|
||||
exports.Composer = composer.Composer;
|
||||
exports.Document = Document.Document;
|
||||
exports.Schema = Schema.Schema;
|
||||
exports.YAMLError = errors.YAMLError;
|
||||
exports.YAMLParseError = errors.YAMLParseError;
|
||||
exports.YAMLWarning = errors.YAMLWarning;
|
||||
exports.Alias = Alias.Alias;
|
||||
exports.isAlias = identity.isAlias;
|
||||
exports.isCollection = identity.isCollection;
|
||||
exports.isDocument = identity.isDocument;
|
||||
exports.isMap = identity.isMap;
|
||||
exports.isNode = identity.isNode;
|
||||
exports.isPair = identity.isPair;
|
||||
exports.isScalar = identity.isScalar;
|
||||
exports.isSeq = identity.isSeq;
|
||||
exports.Pair = Pair.Pair;
|
||||
exports.Scalar = Scalar.Scalar;
|
||||
exports.YAMLMap = YAMLMap.YAMLMap;
|
||||
exports.YAMLSeq = YAMLSeq.YAMLSeq;
|
||||
exports.CST = cst;
|
||||
exports.Lexer = lexer.Lexer;
|
||||
exports.LineCounter = lineCounter.LineCounter;
|
||||
exports.Parser = parser.Parser;
|
||||
exports.parse = publicApi.parse;
|
||||
exports.parseAllDocuments = publicApi.parseAllDocuments;
|
||||
exports.parseDocument = publicApi.parseDocument;
|
||||
exports.stringify = publicApi.stringify;
|
||||
exports.visit = visit.visit;
|
||||
exports.visitAsync = visit.visitAsync;
|
||||
65
node_modules/yaml/dist/nodes/addPairToJSMap.js
generated
vendored
Normal file
65
node_modules/yaml/dist/nodes/addPairToJSMap.js
generated
vendored
Normal file
@@ -0,0 +1,65 @@
|
||||
'use strict';
|
||||
|
||||
var log = require('../log.js');
|
||||
var merge = require('../schema/yaml-1.1/merge.js');
|
||||
var stringify = require('../stringify/stringify.js');
|
||||
var identity = require('./identity.js');
|
||||
var toJS = require('./toJS.js');
|
||||
|
||||
function addPairToJSMap(ctx, map, { key, value }) {
|
||||
if (identity.isNode(key) && key.addToJSMap)
|
||||
key.addToJSMap(ctx, map, value);
|
||||
// TODO: Should drop this special case for bare << handling
|
||||
else if (merge.isMergeKey(ctx, key))
|
||||
merge.addMergeToJSMap(ctx, map, value);
|
||||
else {
|
||||
const jsKey = toJS.toJS(key, '', ctx);
|
||||
if (map instanceof Map) {
|
||||
map.set(jsKey, toJS.toJS(value, jsKey, ctx));
|
||||
}
|
||||
else if (map instanceof Set) {
|
||||
map.add(jsKey);
|
||||
}
|
||||
else {
|
||||
const stringKey = stringifyKey(key, jsKey, ctx);
|
||||
const jsValue = toJS.toJS(value, stringKey, ctx);
|
||||
if (stringKey in map)
|
||||
Object.defineProperty(map, stringKey, {
|
||||
value: jsValue,
|
||||
writable: true,
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
else
|
||||
map[stringKey] = jsValue;
|
||||
}
|
||||
}
|
||||
return map;
|
||||
}
|
||||
function stringifyKey(key, jsKey, ctx) {
|
||||
if (jsKey === null)
|
||||
return '';
|
||||
// eslint-disable-next-line @typescript-eslint/no-base-to-string
|
||||
if (typeof jsKey !== 'object')
|
||||
return String(jsKey);
|
||||
if (identity.isNode(key) && ctx?.doc) {
|
||||
const strCtx = stringify.createStringifyContext(ctx.doc, {});
|
||||
strCtx.anchors = new Set();
|
||||
for (const node of ctx.anchors.keys())
|
||||
strCtx.anchors.add(node.anchor);
|
||||
strCtx.inFlow = true;
|
||||
strCtx.inStringifyKey = true;
|
||||
const strKey = key.toString(strCtx);
|
||||
if (!ctx.mapKeyWarned) {
|
||||
let jsonStr = JSON.stringify(strKey);
|
||||
if (jsonStr.length > 40)
|
||||
jsonStr = jsonStr.substring(0, 36) + '..."';
|
||||
log.warn(ctx.doc.options.logLevel, `Keys with collection values will be stringified due to JS Object restrictions: ${jsonStr}. Set mapAsMap: true to use object keys.`);
|
||||
ctx.mapKeyWarned = true;
|
||||
}
|
||||
return strKey;
|
||||
}
|
||||
return JSON.stringify(jsKey);
|
||||
}
|
||||
|
||||
exports.addPairToJSMap = addPairToJSMap;
|
||||
99
node_modules/yaml/dist/schema/tags.js
generated
vendored
Normal file
99
node_modules/yaml/dist/schema/tags.js
generated
vendored
Normal file
@@ -0,0 +1,99 @@
|
||||
'use strict';
|
||||
|
||||
var map = require('./common/map.js');
|
||||
var _null = require('./common/null.js');
|
||||
var seq = require('./common/seq.js');
|
||||
var string = require('./common/string.js');
|
||||
var bool = require('./core/bool.js');
|
||||
var float = require('./core/float.js');
|
||||
var int = require('./core/int.js');
|
||||
var schema = require('./core/schema.js');
|
||||
var schema$1 = require('./json/schema.js');
|
||||
var binary = require('./yaml-1.1/binary.js');
|
||||
var merge = require('./yaml-1.1/merge.js');
|
||||
var omap = require('./yaml-1.1/omap.js');
|
||||
var pairs = require('./yaml-1.1/pairs.js');
|
||||
var schema$2 = require('./yaml-1.1/schema.js');
|
||||
var set = require('./yaml-1.1/set.js');
|
||||
var timestamp = require('./yaml-1.1/timestamp.js');
|
||||
|
||||
const schemas = new Map([
|
||||
['core', schema.schema],
|
||||
['failsafe', [map.map, seq.seq, string.string]],
|
||||
['json', schema$1.schema],
|
||||
['yaml11', schema$2.schema],
|
||||
['yaml-1.1', schema$2.schema]
|
||||
]);
|
||||
const tagsByName = {
|
||||
binary: binary.binary,
|
||||
bool: bool.boolTag,
|
||||
float: float.float,
|
||||
floatExp: float.floatExp,
|
||||
floatNaN: float.floatNaN,
|
||||
floatTime: timestamp.floatTime,
|
||||
int: int.int,
|
||||
intHex: int.intHex,
|
||||
intOct: int.intOct,
|
||||
intTime: timestamp.intTime,
|
||||
map: map.map,
|
||||
merge: merge.merge,
|
||||
null: _null.nullTag,
|
||||
omap: omap.omap,
|
||||
pairs: pairs.pairs,
|
||||
seq: seq.seq,
|
||||
set: set.set,
|
||||
timestamp: timestamp.timestamp
|
||||
};
|
||||
const coreKnownTags = {
|
||||
'tag:yaml.org,2002:binary': binary.binary,
|
||||
'tag:yaml.org,2002:merge': merge.merge,
|
||||
'tag:yaml.org,2002:omap': omap.omap,
|
||||
'tag:yaml.org,2002:pairs': pairs.pairs,
|
||||
'tag:yaml.org,2002:set': set.set,
|
||||
'tag:yaml.org,2002:timestamp': timestamp.timestamp
|
||||
};
|
||||
function getTags(customTags, schemaName, addMergeTag) {
|
||||
const schemaTags = schemas.get(schemaName);
|
||||
if (schemaTags && !customTags) {
|
||||
return addMergeTag && !schemaTags.includes(merge.merge)
|
||||
? schemaTags.concat(merge.merge)
|
||||
: schemaTags.slice();
|
||||
}
|
||||
let tags = schemaTags;
|
||||
if (!tags) {
|
||||
if (Array.isArray(customTags))
|
||||
tags = [];
|
||||
else {
|
||||
const keys = Array.from(schemas.keys())
|
||||
.filter(key => key !== 'yaml11')
|
||||
.map(key => JSON.stringify(key))
|
||||
.join(', ');
|
||||
throw new Error(`Unknown schema "${schemaName}"; use one of ${keys} or define customTags array`);
|
||||
}
|
||||
}
|
||||
if (Array.isArray(customTags)) {
|
||||
for (const tag of customTags)
|
||||
tags = tags.concat(tag);
|
||||
}
|
||||
else if (typeof customTags === 'function') {
|
||||
tags = customTags(tags.slice());
|
||||
}
|
||||
if (addMergeTag)
|
||||
tags = tags.concat(merge.merge);
|
||||
return tags.reduce((tags, tag) => {
|
||||
const tagObj = typeof tag === 'string' ? tagsByName[tag] : tag;
|
||||
if (!tagObj) {
|
||||
const tagName = JSON.stringify(tag);
|
||||
const keys = Object.keys(tagsByName)
|
||||
.map(key => JSON.stringify(key))
|
||||
.join(', ');
|
||||
throw new Error(`Unknown custom tag ${tagName}; use one of ${keys}`);
|
||||
}
|
||||
if (!tags.includes(tagObj))
|
||||
tags.push(tagObj);
|
||||
return tags;
|
||||
}, []);
|
||||
}
|
||||
|
||||
exports.coreKnownTags = coreKnownTags;
|
||||
exports.getTags = getTags;
|
||||
10
node_modules/yaml/dist/schema/yaml-1.1/pairs.d.ts
generated
vendored
Normal file
10
node_modules/yaml/dist/schema/yaml-1.1/pairs.d.ts
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
import type { CreateNodeContext } from '../../doc/createNode';
|
||||
import type { ParsedNode } from '../../nodes/Node';
|
||||
import { Pair } from '../../nodes/Pair';
|
||||
import type { YAMLMap } from '../../nodes/YAMLMap';
|
||||
import { YAMLSeq } from '../../nodes/YAMLSeq';
|
||||
import type { Schema } from '../../schema/Schema';
|
||||
import type { CollectionTag } from '../types';
|
||||
export declare function resolvePairs(seq: YAMLSeq.Parsed<ParsedNode | Pair<ParsedNode, ParsedNode | null>> | YAMLMap.Parsed, onError: (message: string) => void): YAMLSeq.Parsed<Pair<ParsedNode, ParsedNode | null>>;
|
||||
export declare function createPairs(schema: Schema, iterable: unknown, ctx: CreateNodeContext): YAMLSeq<unknown>;
|
||||
export declare const pairs: CollectionTag;
|
||||
1
node_modules/yaml/dist/schema/yaml-1.1/schema.d.ts
generated
vendored
Normal file
1
node_modules/yaml/dist/schema/yaml-1.1/schema.d.ts
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export declare const schema: (import('../types').CollectionTag | import('../types').ScalarTag)[];
|
||||
105
node_modules/yaml/dist/schema/yaml-1.1/timestamp.js
generated
vendored
Normal file
105
node_modules/yaml/dist/schema/yaml-1.1/timestamp.js
generated
vendored
Normal file
@@ -0,0 +1,105 @@
|
||||
'use strict';
|
||||
|
||||
var stringifyNumber = require('../../stringify/stringifyNumber.js');
|
||||
|
||||
/** Internal types handle bigint as number, because TS can't figure it out. */
|
||||
function parseSexagesimal(str, asBigInt) {
|
||||
const sign = str[0];
|
||||
const parts = sign === '-' || sign === '+' ? str.substring(1) : str;
|
||||
const num = (n) => asBigInt ? BigInt(n) : Number(n);
|
||||
const res = parts
|
||||
.replace(/_/g, '')
|
||||
.split(':')
|
||||
.reduce((res, p) => res * num(60) + num(p), num(0));
|
||||
return (sign === '-' ? num(-1) * res : res);
|
||||
}
|
||||
/**
|
||||
* hhhh:mm:ss.sss
|
||||
*
|
||||
* Internal types handle bigint as number, because TS can't figure it out.
|
||||
*/
|
||||
function stringifySexagesimal(node) {
|
||||
let { value } = node;
|
||||
let num = (n) => n;
|
||||
if (typeof value === 'bigint')
|
||||
num = n => BigInt(n);
|
||||
else if (isNaN(value) || !isFinite(value))
|
||||
return stringifyNumber.stringifyNumber(node);
|
||||
let sign = '';
|
||||
if (value < 0) {
|
||||
sign = '-';
|
||||
value *= num(-1);
|
||||
}
|
||||
const _60 = num(60);
|
||||
const parts = [value % _60]; // seconds, including ms
|
||||
if (value < 60) {
|
||||
parts.unshift(0); // at least one : is required
|
||||
}
|
||||
else {
|
||||
value = (value - parts[0]) / _60;
|
||||
parts.unshift(value % _60); // minutes
|
||||
if (value >= 60) {
|
||||
value = (value - parts[0]) / _60;
|
||||
parts.unshift(value); // hours
|
||||
}
|
||||
}
|
||||
return (sign +
|
||||
parts
|
||||
.map(n => String(n).padStart(2, '0'))
|
||||
.join(':')
|
||||
.replace(/000000\d*$/, '') // % 60 may introduce error
|
||||
);
|
||||
}
|
||||
const intTime = {
|
||||
identify: value => typeof value === 'bigint' || Number.isInteger(value),
|
||||
default: true,
|
||||
tag: 'tag:yaml.org,2002:int',
|
||||
format: 'TIME',
|
||||
test: /^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,
|
||||
resolve: (str, _onError, { intAsBigInt }) => parseSexagesimal(str, intAsBigInt),
|
||||
stringify: stringifySexagesimal
|
||||
};
|
||||
const floatTime = {
|
||||
identify: value => typeof value === 'number',
|
||||
default: true,
|
||||
tag: 'tag:yaml.org,2002:float',
|
||||
format: 'TIME',
|
||||
test: /^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,
|
||||
resolve: str => parseSexagesimal(str, false),
|
||||
stringify: stringifySexagesimal
|
||||
};
|
||||
const timestamp = {
|
||||
identify: value => value instanceof Date,
|
||||
default: true,
|
||||
tag: 'tag:yaml.org,2002:timestamp',
|
||||
// If the time zone is omitted, the timestamp is assumed to be specified in UTC. The time part
|
||||
// may be omitted altogether, resulting in a date format. In such a case, the time part is
|
||||
// assumed to be 00:00:00Z (start of day, UTC).
|
||||
test: RegExp('^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})' + // YYYY-Mm-Dd
|
||||
'(?:' + // time is optional
|
||||
'(?:t|T|[ \\t]+)' + // t | T | whitespace
|
||||
'([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)' + // Hh:Mm:Ss(.ss)?
|
||||
'(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?' + // Z | +5 | -03:30
|
||||
')?$'),
|
||||
resolve(str) {
|
||||
const match = str.match(timestamp.test);
|
||||
if (!match)
|
||||
throw new Error('!!timestamp expects a date, starting with yyyy-mm-dd');
|
||||
const [, year, month, day, hour, minute, second] = match.map(Number);
|
||||
const millisec = match[7] ? Number((match[7] + '00').substr(1, 3)) : 0;
|
||||
let date = Date.UTC(year, month - 1, day, hour || 0, minute || 0, second || 0, millisec);
|
||||
const tz = match[8];
|
||||
if (tz && tz !== 'Z') {
|
||||
let d = parseSexagesimal(tz, false);
|
||||
if (Math.abs(d) < 30)
|
||||
d *= 60;
|
||||
date -= 60000 * d;
|
||||
}
|
||||
return new Date(date);
|
||||
},
|
||||
stringify: ({ value }) => value?.toISOString().replace(/(T00:00:00)?\.000Z$/, '') ?? ''
|
||||
};
|
||||
|
||||
exports.floatTime = floatTime;
|
||||
exports.intTime = intTime;
|
||||
exports.timestamp = timestamp;
|
||||
26
node_modules/yaml/dist/stringify/stringifyNumber.js
generated
vendored
Normal file
26
node_modules/yaml/dist/stringify/stringifyNumber.js
generated
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
'use strict';
|
||||
|
||||
function stringifyNumber({ format, minFractionDigits, tag, value }) {
|
||||
if (typeof value === 'bigint')
|
||||
return String(value);
|
||||
const num = typeof value === 'number' ? value : Number(value);
|
||||
if (!isFinite(num))
|
||||
return isNaN(num) ? '.nan' : num < 0 ? '-.inf' : '.inf';
|
||||
let n = Object.is(value, -0) ? '-0' : JSON.stringify(value);
|
||||
if (!format &&
|
||||
minFractionDigits &&
|
||||
(!tag || tag === 'tag:yaml.org,2002:float') &&
|
||||
/^\d/.test(n)) {
|
||||
let i = n.indexOf('.');
|
||||
if (i < 0) {
|
||||
i = n.length;
|
||||
n += '.';
|
||||
}
|
||||
let d = minFractionDigits - (n.length - i - 1);
|
||||
while (d-- > 0)
|
||||
n += '0';
|
||||
}
|
||||
return n;
|
||||
}
|
||||
|
||||
exports.stringifyNumber = stringifyNumber;
|
||||
Reference in New Issue
Block a user