mirror of
https://github.com/deployphp/action.git
synced 2025-04-20 19:16:47 +00:00
Add node_modules
This commit is contained in:
parent
e1f786311a
commit
554eb0b122
994 changed files with 195567 additions and 0 deletions
38
node_modules/yaml/browser/dist/schema/Schema.js
generated
vendored
Normal file
38
node_modules/yaml/browser/dist/schema/Schema.js
generated
vendored
Normal file
|
@ -0,0 +1,38 @@
|
|||
import { MAP, SCALAR, SEQ } from '../nodes/Node.js';
|
||||
import { map } from './common/map.js';
|
||||
import { seq } from './common/seq.js';
|
||||
import { string } from './common/string.js';
|
||||
import { getTags, coreKnownTags } from './tags.js';
|
||||
|
||||
const sortMapEntriesByKey = (a, b) => a.key < b.key ? -1 : a.key > b.key ? 1 : 0;
|
||||
class Schema {
|
||||
constructor({ compat, customTags, merge, resolveKnownTags, schema, sortMapEntries, toStringDefaults }) {
|
||||
this.compat = Array.isArray(compat)
|
||||
? getTags(compat, 'compat')
|
||||
: compat
|
||||
? getTags(null, compat)
|
||||
: null;
|
||||
this.merge = !!merge;
|
||||
this.name = (typeof schema === 'string' && schema) || 'core';
|
||||
this.knownTags = resolveKnownTags ? coreKnownTags : {};
|
||||
this.tags = getTags(customTags, this.name);
|
||||
this.toStringOptions = toStringDefaults ?? null;
|
||||
Object.defineProperty(this, MAP, { value: map });
|
||||
Object.defineProperty(this, SCALAR, { value: string });
|
||||
Object.defineProperty(this, SEQ, { value: seq });
|
||||
// Used by createMap()
|
||||
this.sortMapEntries =
|
||||
typeof sortMapEntries === 'function'
|
||||
? sortMapEntries
|
||||
: sortMapEntries === true
|
||||
? sortMapEntriesByKey
|
||||
: null;
|
||||
}
|
||||
clone() {
|
||||
const copy = Object.create(Schema.prototype, Object.getOwnPropertyDescriptors(this));
|
||||
copy.tags = this.tags.slice();
|
||||
return copy;
|
||||
}
|
||||
}
|
||||
|
||||
export { Schema };
|
42
node_modules/yaml/browser/dist/schema/common/map.js
generated
vendored
Normal file
42
node_modules/yaml/browser/dist/schema/common/map.js
generated
vendored
Normal file
|
@ -0,0 +1,42 @@
|
|||
import { isMap } from '../../nodes/Node.js';
|
||||
import { createPair } from '../../nodes/Pair.js';
|
||||
import { YAMLMap } from '../../nodes/YAMLMap.js';
|
||||
|
||||
function createMap(schema, obj, ctx) {
|
||||
const { keepUndefined, replacer } = ctx;
|
||||
const map = new YAMLMap(schema);
|
||||
const add = (key, value) => {
|
||||
if (typeof replacer === 'function')
|
||||
value = replacer.call(obj, key, value);
|
||||
else if (Array.isArray(replacer) && !replacer.includes(key))
|
||||
return;
|
||||
if (value !== undefined || keepUndefined)
|
||||
map.items.push(createPair(key, value, ctx));
|
||||
};
|
||||
if (obj instanceof Map) {
|
||||
for (const [key, value] of obj)
|
||||
add(key, value);
|
||||
}
|
||||
else if (obj && typeof obj === 'object') {
|
||||
for (const key of Object.keys(obj))
|
||||
add(key, obj[key]);
|
||||
}
|
||||
if (typeof schema.sortMapEntries === 'function') {
|
||||
map.items.sort(schema.sortMapEntries);
|
||||
}
|
||||
return map;
|
||||
}
|
||||
const map = {
|
||||
collection: 'map',
|
||||
createNode: createMap,
|
||||
default: true,
|
||||
nodeClass: YAMLMap,
|
||||
tag: 'tag:yaml.org,2002:map',
|
||||
resolve(map, onError) {
|
||||
if (!isMap(map))
|
||||
onError('Expected a mapping for this tag');
|
||||
return map;
|
||||
}
|
||||
};
|
||||
|
||||
export { map };
|
15
node_modules/yaml/browser/dist/schema/common/null.js
generated
vendored
Normal file
15
node_modules/yaml/browser/dist/schema/common/null.js
generated
vendored
Normal file
|
@ -0,0 +1,15 @@
|
|||
import { Scalar } from '../../nodes/Scalar.js';
|
||||
|
||||
const nullTag = {
|
||||
identify: value => value == null,
|
||||
createNode: () => new Scalar(null),
|
||||
default: true,
|
||||
tag: 'tag:yaml.org,2002:null',
|
||||
test: /^(?:~|[Nn]ull|NULL)?$/,
|
||||
resolve: () => new Scalar(null),
|
||||
stringify: ({ source }, ctx) => typeof source === 'string' && nullTag.test.test(source)
|
||||
? source
|
||||
: ctx.options.nullStr
|
||||
};
|
||||
|
||||
export { nullTag };
|
33
node_modules/yaml/browser/dist/schema/common/seq.js
generated
vendored
Normal file
33
node_modules/yaml/browser/dist/schema/common/seq.js
generated
vendored
Normal file
|
@ -0,0 +1,33 @@
|
|||
import { createNode } from '../../doc/createNode.js';
|
||||
import { isSeq } from '../../nodes/Node.js';
|
||||
import { YAMLSeq } from '../../nodes/YAMLSeq.js';
|
||||
|
||||
function createSeq(schema, obj, ctx) {
|
||||
const { replacer } = ctx;
|
||||
const seq = new YAMLSeq(schema);
|
||||
if (obj && Symbol.iterator in Object(obj)) {
|
||||
let i = 0;
|
||||
for (let it of obj) {
|
||||
if (typeof replacer === 'function') {
|
||||
const key = obj instanceof Set ? it : String(i++);
|
||||
it = replacer.call(obj, key, it);
|
||||
}
|
||||
seq.items.push(createNode(it, undefined, ctx));
|
||||
}
|
||||
}
|
||||
return seq;
|
||||
}
|
||||
const seq = {
|
||||
collection: 'seq',
|
||||
createNode: createSeq,
|
||||
default: true,
|
||||
nodeClass: YAMLSeq,
|
||||
tag: 'tag:yaml.org,2002:seq',
|
||||
resolve(seq, onError) {
|
||||
if (!isSeq(seq))
|
||||
onError('Expected a sequence for this tag');
|
||||
return seq;
|
||||
}
|
||||
};
|
||||
|
||||
export { seq };
|
14
node_modules/yaml/browser/dist/schema/common/string.js
generated
vendored
Normal file
14
node_modules/yaml/browser/dist/schema/common/string.js
generated
vendored
Normal file
|
@ -0,0 +1,14 @@
|
|||
import { stringifyString } from '../../stringify/stringifyString.js';
|
||||
|
||||
const string = {
|
||||
identify: value => typeof value === 'string',
|
||||
default: true,
|
||||
tag: 'tag:yaml.org,2002:str',
|
||||
resolve: str => str,
|
||||
stringify(item, ctx, onComment, onChompKeep) {
|
||||
ctx = Object.assign({ actualString: true }, ctx);
|
||||
return stringifyString(item, ctx, onComment, onChompKeep);
|
||||
}
|
||||
};
|
||||
|
||||
export { string };
|
19
node_modules/yaml/browser/dist/schema/core/bool.js
generated
vendored
Normal file
19
node_modules/yaml/browser/dist/schema/core/bool.js
generated
vendored
Normal file
|
@ -0,0 +1,19 @@
|
|||
import { Scalar } from '../../nodes/Scalar.js';
|
||||
|
||||
const boolTag = {
|
||||
identify: value => typeof value === 'boolean',
|
||||
default: true,
|
||||
tag: 'tag:yaml.org,2002:bool',
|
||||
test: /^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,
|
||||
resolve: str => new Scalar(str[0] === 't' || str[0] === 'T'),
|
||||
stringify({ source, value }, ctx) {
|
||||
if (source && boolTag.test.test(source)) {
|
||||
const sv = source[0] === 't' || source[0] === 'T';
|
||||
if (value === sv)
|
||||
return source;
|
||||
}
|
||||
return value ? ctx.options.trueStr : ctx.options.falseStr;
|
||||
}
|
||||
};
|
||||
|
||||
export { boolTag };
|
43
node_modules/yaml/browser/dist/schema/core/float.js
generated
vendored
Normal file
43
node_modules/yaml/browser/dist/schema/core/float.js
generated
vendored
Normal file
|
@ -0,0 +1,43 @@
|
|||
import { Scalar } from '../../nodes/Scalar.js';
|
||||
import { stringifyNumber } from '../../stringify/stringifyNumber.js';
|
||||
|
||||
const floatNaN = {
|
||||
identify: value => typeof value === 'number',
|
||||
default: true,
|
||||
tag: 'tag:yaml.org,2002:float',
|
||||
test: /^(?:[-+]?\.(?:inf|Inf|INF|nan|NaN|NAN))$/,
|
||||
resolve: str => str.slice(-3).toLowerCase() === 'nan'
|
||||
? NaN
|
||||
: str[0] === '-'
|
||||
? Number.NEGATIVE_INFINITY
|
||||
: Number.POSITIVE_INFINITY,
|
||||
stringify: stringifyNumber
|
||||
};
|
||||
const floatExp = {
|
||||
identify: value => typeof value === 'number',
|
||||
default: true,
|
||||
tag: 'tag:yaml.org,2002:float',
|
||||
format: 'EXP',
|
||||
test: /^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,
|
||||
resolve: str => parseFloat(str),
|
||||
stringify(node) {
|
||||
const num = Number(node.value);
|
||||
return isFinite(num) ? num.toExponential() : stringifyNumber(node);
|
||||
}
|
||||
};
|
||||
const float = {
|
||||
identify: value => typeof value === 'number',
|
||||
default: true,
|
||||
tag: 'tag:yaml.org,2002:float',
|
||||
test: /^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,
|
||||
resolve(str) {
|
||||
const node = new Scalar(parseFloat(str));
|
||||
const dot = str.indexOf('.');
|
||||
if (dot !== -1 && str[str.length - 1] === '0')
|
||||
node.minFractionDigits = str.length - dot - 1;
|
||||
return node;
|
||||
},
|
||||
stringify: stringifyNumber
|
||||
};
|
||||
|
||||
export { float, floatExp, floatNaN };
|
38
node_modules/yaml/browser/dist/schema/core/int.js
generated
vendored
Normal file
38
node_modules/yaml/browser/dist/schema/core/int.js
generated
vendored
Normal file
|
@ -0,0 +1,38 @@
|
|||
import { stringifyNumber } from '../../stringify/stringifyNumber.js';
|
||||
|
||||
const intIdentify = (value) => typeof value === 'bigint' || Number.isInteger(value);
|
||||
const intResolve = (str, offset, radix, { intAsBigInt }) => (intAsBigInt ? BigInt(str) : parseInt(str.substring(offset), radix));
|
||||
function intStringify(node, radix, prefix) {
|
||||
const { value } = node;
|
||||
if (intIdentify(value) && value >= 0)
|
||||
return prefix + value.toString(radix);
|
||||
return stringifyNumber(node);
|
||||
}
|
||||
const intOct = {
|
||||
identify: value => intIdentify(value) && value >= 0,
|
||||
default: true,
|
||||
tag: 'tag:yaml.org,2002:int',
|
||||
format: 'OCT',
|
||||
test: /^0o[0-7]+$/,
|
||||
resolve: (str, _onError, opt) => intResolve(str, 2, 8, opt),
|
||||
stringify: node => intStringify(node, 8, '0o')
|
||||
};
|
||||
const int = {
|
||||
identify: intIdentify,
|
||||
default: true,
|
||||
tag: 'tag:yaml.org,2002:int',
|
||||
test: /^[-+]?[0-9]+$/,
|
||||
resolve: (str, _onError, opt) => intResolve(str, 0, 10, opt),
|
||||
stringify: stringifyNumber
|
||||
};
|
||||
const intHex = {
|
||||
identify: value => intIdentify(value) && value >= 0,
|
||||
default: true,
|
||||
tag: 'tag:yaml.org,2002:int',
|
||||
format: 'HEX',
|
||||
test: /^0x[0-9a-fA-F]+$/,
|
||||
resolve: (str, _onError, opt) => intResolve(str, 2, 16, opt),
|
||||
stringify: node => intStringify(node, 16, '0x')
|
||||
};
|
||||
|
||||
export { int, intHex, intOct };
|
23
node_modules/yaml/browser/dist/schema/core/schema.js
generated
vendored
Normal file
23
node_modules/yaml/browser/dist/schema/core/schema.js
generated
vendored
Normal file
|
@ -0,0 +1,23 @@
|
|||
import { map } from '../common/map.js';
|
||||
import { nullTag } from '../common/null.js';
|
||||
import { seq } from '../common/seq.js';
|
||||
import { string } from '../common/string.js';
|
||||
import { boolTag } from './bool.js';
|
||||
import { floatNaN, floatExp, float } from './float.js';
|
||||
import { intOct, int, intHex } from './int.js';
|
||||
|
||||
const schema = [
|
||||
map,
|
||||
seq,
|
||||
string,
|
||||
nullTag,
|
||||
boolTag,
|
||||
intOct,
|
||||
int,
|
||||
intHex,
|
||||
floatNaN,
|
||||
floatExp,
|
||||
float
|
||||
];
|
||||
|
||||
export { schema };
|
62
node_modules/yaml/browser/dist/schema/json/schema.js
generated
vendored
Normal file
62
node_modules/yaml/browser/dist/schema/json/schema.js
generated
vendored
Normal file
|
@ -0,0 +1,62 @@
|
|||
import { Scalar } from '../../nodes/Scalar.js';
|
||||
import { map } from '../common/map.js';
|
||||
import { seq } from '../common/seq.js';
|
||||
|
||||
function intIdentify(value) {
|
||||
return typeof value === 'bigint' || Number.isInteger(value);
|
||||
}
|
||||
const stringifyJSON = ({ value }) => JSON.stringify(value);
|
||||
const jsonScalars = [
|
||||
{
|
||||
identify: value => typeof value === 'string',
|
||||
default: true,
|
||||
tag: 'tag:yaml.org,2002:str',
|
||||
resolve: str => str,
|
||||
stringify: stringifyJSON
|
||||
},
|
||||
{
|
||||
identify: value => value == null,
|
||||
createNode: () => new Scalar(null),
|
||||
default: true,
|
||||
tag: 'tag:yaml.org,2002:null',
|
||||
test: /^null$/,
|
||||
resolve: () => null,
|
||||
stringify: stringifyJSON
|
||||
},
|
||||
{
|
||||
identify: value => typeof value === 'boolean',
|
||||
default: true,
|
||||
tag: 'tag:yaml.org,2002:bool',
|
||||
test: /^true|false$/,
|
||||
resolve: str => str === 'true',
|
||||
stringify: stringifyJSON
|
||||
},
|
||||
{
|
||||
identify: intIdentify,
|
||||
default: true,
|
||||
tag: 'tag:yaml.org,2002:int',
|
||||
test: /^-?(?:0|[1-9][0-9]*)$/,
|
||||
resolve: (str, _onError, { intAsBigInt }) => intAsBigInt ? BigInt(str) : parseInt(str, 10),
|
||||
stringify: ({ value }) => intIdentify(value) ? value.toString() : JSON.stringify(value)
|
||||
},
|
||||
{
|
||||
identify: value => typeof value === 'number',
|
||||
default: true,
|
||||
tag: 'tag:yaml.org,2002:float',
|
||||
test: /^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,
|
||||
resolve: str => parseFloat(str),
|
||||
stringify: stringifyJSON
|
||||
}
|
||||
];
|
||||
const jsonError = {
|
||||
default: true,
|
||||
tag: '',
|
||||
test: /^/,
|
||||
resolve(str, onError) {
|
||||
onError(`Unresolved plain scalar ${JSON.stringify(str)}`);
|
||||
return str;
|
||||
}
|
||||
};
|
||||
const schema = [map, seq].concat(jsonScalars, jsonError);
|
||||
|
||||
export { schema };
|
83
node_modules/yaml/browser/dist/schema/tags.js
generated
vendored
Normal file
83
node_modules/yaml/browser/dist/schema/tags.js
generated
vendored
Normal file
|
@ -0,0 +1,83 @@
|
|||
import { map } from './common/map.js';
|
||||
import { nullTag } from './common/null.js';
|
||||
import { seq } from './common/seq.js';
|
||||
import { string } from './common/string.js';
|
||||
import { boolTag } from './core/bool.js';
|
||||
import { float, floatExp, floatNaN } from './core/float.js';
|
||||
import { int, intHex, intOct } from './core/int.js';
|
||||
import { schema } from './core/schema.js';
|
||||
import { schema as schema$1 } from './json/schema.js';
|
||||
import { binary } from './yaml-1.1/binary.js';
|
||||
import { omap } from './yaml-1.1/omap.js';
|
||||
import { pairs } from './yaml-1.1/pairs.js';
|
||||
import { schema as schema$2 } from './yaml-1.1/schema.js';
|
||||
import { set } from './yaml-1.1/set.js';
|
||||
import { floatTime, intTime, timestamp } from './yaml-1.1/timestamp.js';
|
||||
|
||||
const schemas = new Map([
|
||||
['core', schema],
|
||||
['failsafe', [map, seq, string]],
|
||||
['json', schema$1],
|
||||
['yaml11', schema$2],
|
||||
['yaml-1.1', schema$2]
|
||||
]);
|
||||
const tagsByName = {
|
||||
binary,
|
||||
bool: boolTag,
|
||||
float,
|
||||
floatExp,
|
||||
floatNaN,
|
||||
floatTime,
|
||||
int,
|
||||
intHex,
|
||||
intOct,
|
||||
intTime,
|
||||
map,
|
||||
null: nullTag,
|
||||
omap,
|
||||
pairs,
|
||||
seq,
|
||||
set,
|
||||
timestamp
|
||||
};
|
||||
const coreKnownTags = {
|
||||
'tag:yaml.org,2002:binary': binary,
|
||||
'tag:yaml.org,2002:omap': omap,
|
||||
'tag:yaml.org,2002:pairs': pairs,
|
||||
'tag:yaml.org,2002:set': set,
|
||||
'tag:yaml.org,2002:timestamp': timestamp
|
||||
};
|
||||
function getTags(customTags, schemaName) {
|
||||
let tags = schemas.get(schemaName);
|
||||
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());
|
||||
}
|
||||
return tags.map(tag => {
|
||||
if (typeof tag !== 'string')
|
||||
return tag;
|
||||
const tagObj = tagsByName[tag];
|
||||
if (tagObj)
|
||||
return tagObj;
|
||||
const keys = Object.keys(tagsByName)
|
||||
.map(key => JSON.stringify(key))
|
||||
.join(', ');
|
||||
throw new Error(`Unknown custom tag "${tag}"; use one of ${keys}`);
|
||||
});
|
||||
}
|
||||
|
||||
export { coreKnownTags, getTags };
|
66
node_modules/yaml/browser/dist/schema/yaml-1.1/binary.js
generated
vendored
Normal file
66
node_modules/yaml/browser/dist/schema/yaml-1.1/binary.js
generated
vendored
Normal file
|
@ -0,0 +1,66 @@
|
|||
import { Scalar } from '../../nodes/Scalar.js';
|
||||
import { stringifyString } from '../../stringify/stringifyString.js';
|
||||
|
||||
const binary = {
|
||||
identify: value => value instanceof Uint8Array,
|
||||
default: false,
|
||||
tag: 'tag:yaml.org,2002:binary',
|
||||
/**
|
||||
* Returns a Buffer in node and an Uint8Array in browsers
|
||||
*
|
||||
* To use the resulting buffer as an image, you'll want to do something like:
|
||||
*
|
||||
* const blob = new Blob([buffer], { type: 'image/jpeg' })
|
||||
* document.querySelector('#photo').src = URL.createObjectURL(blob)
|
||||
*/
|
||||
resolve(src, onError) {
|
||||
if (typeof Buffer === 'function') {
|
||||
return Buffer.from(src, 'base64');
|
||||
}
|
||||
else if (typeof atob === 'function') {
|
||||
// On IE 11, atob() can't handle newlines
|
||||
const str = atob(src.replace(/[\n\r]/g, ''));
|
||||
const buffer = new Uint8Array(str.length);
|
||||
for (let i = 0; i < str.length; ++i)
|
||||
buffer[i] = str.charCodeAt(i);
|
||||
return buffer;
|
||||
}
|
||||
else {
|
||||
onError('This environment does not support reading binary tags; either Buffer or atob is required');
|
||||
return src;
|
||||
}
|
||||
},
|
||||
stringify({ comment, type, value }, ctx, onComment, onChompKeep) {
|
||||
const buf = value; // checked earlier by binary.identify()
|
||||
let str;
|
||||
if (typeof Buffer === 'function') {
|
||||
str =
|
||||
buf instanceof Buffer
|
||||
? buf.toString('base64')
|
||||
: Buffer.from(buf.buffer).toString('base64');
|
||||
}
|
||||
else if (typeof btoa === 'function') {
|
||||
let s = '';
|
||||
for (let i = 0; i < buf.length; ++i)
|
||||
s += String.fromCharCode(buf[i]);
|
||||
str = btoa(s);
|
||||
}
|
||||
else {
|
||||
throw new Error('This environment does not support writing binary tags; either Buffer or btoa is required');
|
||||
}
|
||||
if (!type)
|
||||
type = Scalar.BLOCK_LITERAL;
|
||||
if (type !== Scalar.QUOTE_DOUBLE) {
|
||||
const lineWidth = Math.max(ctx.options.lineWidth - ctx.indent.length, ctx.options.minContentWidth);
|
||||
const n = Math.ceil(str.length / lineWidth);
|
||||
const lines = new Array(n);
|
||||
for (let i = 0, o = 0; i < n; ++i, o += lineWidth) {
|
||||
lines[i] = str.substr(o, lineWidth);
|
||||
}
|
||||
str = lines.join(type === Scalar.BLOCK_LITERAL ? '\n' : ' ');
|
||||
}
|
||||
return stringifyString({ comment, type, value: str }, ctx, onComment, onChompKeep);
|
||||
}
|
||||
};
|
||||
|
||||
export { binary };
|
26
node_modules/yaml/browser/dist/schema/yaml-1.1/bool.js
generated
vendored
Normal file
26
node_modules/yaml/browser/dist/schema/yaml-1.1/bool.js
generated
vendored
Normal file
|
@ -0,0 +1,26 @@
|
|||
import { Scalar } from '../../nodes/Scalar.js';
|
||||
|
||||
function boolStringify({ value, source }, ctx) {
|
||||
const boolObj = value ? trueTag : falseTag;
|
||||
if (source && boolObj.test.test(source))
|
||||
return source;
|
||||
return value ? ctx.options.trueStr : ctx.options.falseStr;
|
||||
}
|
||||
const trueTag = {
|
||||
identify: value => value === true,
|
||||
default: true,
|
||||
tag: 'tag:yaml.org,2002:bool',
|
||||
test: /^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,
|
||||
resolve: () => new Scalar(true),
|
||||
stringify: boolStringify
|
||||
};
|
||||
const falseTag = {
|
||||
identify: value => value === false,
|
||||
default: true,
|
||||
tag: 'tag:yaml.org,2002:bool',
|
||||
test: /^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/i,
|
||||
resolve: () => new Scalar(false),
|
||||
stringify: boolStringify
|
||||
};
|
||||
|
||||
export { falseTag, trueTag };
|
46
node_modules/yaml/browser/dist/schema/yaml-1.1/float.js
generated
vendored
Normal file
46
node_modules/yaml/browser/dist/schema/yaml-1.1/float.js
generated
vendored
Normal file
|
@ -0,0 +1,46 @@
|
|||
import { Scalar } from '../../nodes/Scalar.js';
|
||||
import { stringifyNumber } from '../../stringify/stringifyNumber.js';
|
||||
|
||||
const floatNaN = {
|
||||
identify: value => typeof value === 'number',
|
||||
default: true,
|
||||
tag: 'tag:yaml.org,2002:float',
|
||||
test: /^[-+]?\.(?:inf|Inf|INF|nan|NaN|NAN)$/,
|
||||
resolve: (str) => str.slice(-3).toLowerCase() === 'nan'
|
||||
? NaN
|
||||
: str[0] === '-'
|
||||
? Number.NEGATIVE_INFINITY
|
||||
: Number.POSITIVE_INFINITY,
|
||||
stringify: stringifyNumber
|
||||
};
|
||||
const floatExp = {
|
||||
identify: value => typeof value === 'number',
|
||||
default: true,
|
||||
tag: 'tag:yaml.org,2002:float',
|
||||
format: 'EXP',
|
||||
test: /^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,
|
||||
resolve: (str) => parseFloat(str.replace(/_/g, '')),
|
||||
stringify(node) {
|
||||
const num = Number(node.value);
|
||||
return isFinite(num) ? num.toExponential() : stringifyNumber(node);
|
||||
}
|
||||
};
|
||||
const float = {
|
||||
identify: value => typeof value === 'number',
|
||||
default: true,
|
||||
tag: 'tag:yaml.org,2002:float',
|
||||
test: /^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,
|
||||
resolve(str) {
|
||||
const node = new Scalar(parseFloat(str.replace(/_/g, '')));
|
||||
const dot = str.indexOf('.');
|
||||
if (dot !== -1) {
|
||||
const f = str.substring(dot + 1).replace(/_/g, '');
|
||||
if (f[f.length - 1] === '0')
|
||||
node.minFractionDigits = f.length;
|
||||
}
|
||||
return node;
|
||||
},
|
||||
stringify: stringifyNumber
|
||||
};
|
||||
|
||||
export { float, floatExp, floatNaN };
|
71
node_modules/yaml/browser/dist/schema/yaml-1.1/int.js
generated
vendored
Normal file
71
node_modules/yaml/browser/dist/schema/yaml-1.1/int.js
generated
vendored
Normal file
|
@ -0,0 +1,71 @@
|
|||
import { stringifyNumber } from '../../stringify/stringifyNumber.js';
|
||||
|
||||
const intIdentify = (value) => typeof value === 'bigint' || Number.isInteger(value);
|
||||
function intResolve(str, offset, radix, { intAsBigInt }) {
|
||||
const sign = str[0];
|
||||
if (sign === '-' || sign === '+')
|
||||
offset += 1;
|
||||
str = str.substring(offset).replace(/_/g, '');
|
||||
if (intAsBigInt) {
|
||||
switch (radix) {
|
||||
case 2:
|
||||
str = `0b${str}`;
|
||||
break;
|
||||
case 8:
|
||||
str = `0o${str}`;
|
||||
break;
|
||||
case 16:
|
||||
str = `0x${str}`;
|
||||
break;
|
||||
}
|
||||
const n = BigInt(str);
|
||||
return sign === '-' ? BigInt(-1) * n : n;
|
||||
}
|
||||
const n = parseInt(str, radix);
|
||||
return sign === '-' ? -1 * n : n;
|
||||
}
|
||||
function intStringify(node, radix, prefix) {
|
||||
const { value } = node;
|
||||
if (intIdentify(value)) {
|
||||
const str = value.toString(radix);
|
||||
return value < 0 ? '-' + prefix + str.substr(1) : prefix + str;
|
||||
}
|
||||
return stringifyNumber(node);
|
||||
}
|
||||
const intBin = {
|
||||
identify: intIdentify,
|
||||
default: true,
|
||||
tag: 'tag:yaml.org,2002:int',
|
||||
format: 'BIN',
|
||||
test: /^[-+]?0b[0-1_]+$/,
|
||||
resolve: (str, _onError, opt) => intResolve(str, 2, 2, opt),
|
||||
stringify: node => intStringify(node, 2, '0b')
|
||||
};
|
||||
const intOct = {
|
||||
identify: intIdentify,
|
||||
default: true,
|
||||
tag: 'tag:yaml.org,2002:int',
|
||||
format: 'OCT',
|
||||
test: /^[-+]?0[0-7_]+$/,
|
||||
resolve: (str, _onError, opt) => intResolve(str, 1, 8, opt),
|
||||
stringify: node => intStringify(node, 8, '0')
|
||||
};
|
||||
const int = {
|
||||
identify: intIdentify,
|
||||
default: true,
|
||||
tag: 'tag:yaml.org,2002:int',
|
||||
test: /^[-+]?[0-9][0-9_]*$/,
|
||||
resolve: (str, _onError, opt) => intResolve(str, 0, 10, opt),
|
||||
stringify: stringifyNumber
|
||||
};
|
||||
const intHex = {
|
||||
identify: intIdentify,
|
||||
default: true,
|
||||
tag: 'tag:yaml.org,2002:int',
|
||||
format: 'HEX',
|
||||
test: /^[-+]?0x[0-9a-fA-F_]+$/,
|
||||
resolve: (str, _onError, opt) => intResolve(str, 2, 16, opt),
|
||||
stringify: node => intStringify(node, 16, '0x')
|
||||
};
|
||||
|
||||
export { int, intBin, intHex, intOct };
|
73
node_modules/yaml/browser/dist/schema/yaml-1.1/omap.js
generated
vendored
Normal file
73
node_modules/yaml/browser/dist/schema/yaml-1.1/omap.js
generated
vendored
Normal file
|
@ -0,0 +1,73 @@
|
|||
import { YAMLSeq } from '../../nodes/YAMLSeq.js';
|
||||
import { toJS } from '../../nodes/toJS.js';
|
||||
import { isScalar, isPair } from '../../nodes/Node.js';
|
||||
import { YAMLMap } from '../../nodes/YAMLMap.js';
|
||||
import { resolvePairs, createPairs } from './pairs.js';
|
||||
|
||||
class YAMLOMap extends YAMLSeq {
|
||||
constructor() {
|
||||
super();
|
||||
this.add = YAMLMap.prototype.add.bind(this);
|
||||
this.delete = YAMLMap.prototype.delete.bind(this);
|
||||
this.get = YAMLMap.prototype.get.bind(this);
|
||||
this.has = YAMLMap.prototype.has.bind(this);
|
||||
this.set = YAMLMap.prototype.set.bind(this);
|
||||
this.tag = YAMLOMap.tag;
|
||||
}
|
||||
/**
|
||||
* If `ctx` is given, the return type is actually `Map<unknown, unknown>`,
|
||||
* but TypeScript won't allow widening the signature of a child method.
|
||||
*/
|
||||
toJSON(_, ctx) {
|
||||
if (!ctx)
|
||||
return super.toJSON(_);
|
||||
const map = new Map();
|
||||
if (ctx?.onCreate)
|
||||
ctx.onCreate(map);
|
||||
for (const pair of this.items) {
|
||||
let key, value;
|
||||
if (isPair(pair)) {
|
||||
key = toJS(pair.key, '', ctx);
|
||||
value = toJS(pair.value, key, ctx);
|
||||
}
|
||||
else {
|
||||
key = toJS(pair, '', ctx);
|
||||
}
|
||||
if (map.has(key))
|
||||
throw new Error('Ordered maps must not include duplicate keys');
|
||||
map.set(key, value);
|
||||
}
|
||||
return map;
|
||||
}
|
||||
}
|
||||
YAMLOMap.tag = 'tag:yaml.org,2002:omap';
|
||||
const omap = {
|
||||
collection: 'seq',
|
||||
identify: value => value instanceof Map,
|
||||
nodeClass: YAMLOMap,
|
||||
default: false,
|
||||
tag: 'tag:yaml.org,2002:omap',
|
||||
resolve(seq, onError) {
|
||||
const pairs = resolvePairs(seq, onError);
|
||||
const seenKeys = [];
|
||||
for (const { key } of pairs.items) {
|
||||
if (isScalar(key)) {
|
||||
if (seenKeys.includes(key.value)) {
|
||||
onError(`Ordered maps must not include duplicate keys: ${key.value}`);
|
||||
}
|
||||
else {
|
||||
seenKeys.push(key.value);
|
||||
}
|
||||
}
|
||||
}
|
||||
return Object.assign(new YAMLOMap(), pairs);
|
||||
},
|
||||
createNode(schema, iterable, ctx) {
|
||||
const pairs = createPairs(schema, iterable, ctx);
|
||||
const omap = new YAMLOMap();
|
||||
omap.items = pairs.items;
|
||||
return omap;
|
||||
}
|
||||
};
|
||||
|
||||
export { YAMLOMap, omap };
|
77
node_modules/yaml/browser/dist/schema/yaml-1.1/pairs.js
generated
vendored
Normal file
77
node_modules/yaml/browser/dist/schema/yaml-1.1/pairs.js
generated
vendored
Normal file
|
@ -0,0 +1,77 @@
|
|||
import { isSeq, isPair, isMap } from '../../nodes/Node.js';
|
||||
import { Pair, createPair } from '../../nodes/Pair.js';
|
||||
import { Scalar } from '../../nodes/Scalar.js';
|
||||
import { YAMLSeq } from '../../nodes/YAMLSeq.js';
|
||||
|
||||
function resolvePairs(seq, onError) {
|
||||
if (isSeq(seq)) {
|
||||
for (let i = 0; i < seq.items.length; ++i) {
|
||||
let item = seq.items[i];
|
||||
if (isPair(item))
|
||||
continue;
|
||||
else if (isMap(item)) {
|
||||
if (item.items.length > 1)
|
||||
onError('Each pair must have its own sequence indicator');
|
||||
const pair = item.items[0] || new Pair(new Scalar(null));
|
||||
if (item.commentBefore)
|
||||
pair.key.commentBefore = pair.key.commentBefore
|
||||
? `${item.commentBefore}\n${pair.key.commentBefore}`
|
||||
: item.commentBefore;
|
||||
if (item.comment) {
|
||||
const cn = pair.value ?? pair.key;
|
||||
cn.comment = cn.comment
|
||||
? `${item.comment}\n${cn.comment}`
|
||||
: item.comment;
|
||||
}
|
||||
item = pair;
|
||||
}
|
||||
seq.items[i] = isPair(item) ? item : new Pair(item);
|
||||
}
|
||||
}
|
||||
else
|
||||
onError('Expected a sequence for this tag');
|
||||
return seq;
|
||||
}
|
||||
function createPairs(schema, iterable, ctx) {
|
||||
const { replacer } = ctx;
|
||||
const pairs = new YAMLSeq(schema);
|
||||
pairs.tag = 'tag:yaml.org,2002:pairs';
|
||||
let i = 0;
|
||||
if (iterable && Symbol.iterator in Object(iterable))
|
||||
for (let it of iterable) {
|
||||
if (typeof replacer === 'function')
|
||||
it = replacer.call(iterable, String(i++), it);
|
||||
let key, value;
|
||||
if (Array.isArray(it)) {
|
||||
if (it.length === 2) {
|
||||
key = it[0];
|
||||
value = it[1];
|
||||
}
|
||||
else
|
||||
throw new TypeError(`Expected [key, value] tuple: ${it}`);
|
||||
}
|
||||
else if (it && it instanceof Object) {
|
||||
const keys = Object.keys(it);
|
||||
if (keys.length === 1) {
|
||||
key = keys[0];
|
||||
value = it[key];
|
||||
}
|
||||
else
|
||||
throw new TypeError(`Expected { key: value } tuple: ${it}`);
|
||||
}
|
||||
else {
|
||||
key = it;
|
||||
}
|
||||
pairs.items.push(createPair(key, value, ctx));
|
||||
}
|
||||
return pairs;
|
||||
}
|
||||
const pairs = {
|
||||
collection: 'seq',
|
||||
default: false,
|
||||
tag: 'tag:yaml.org,2002:pairs',
|
||||
resolve: resolvePairs,
|
||||
createNode: createPairs
|
||||
};
|
||||
|
||||
export { createPairs, pairs, resolvePairs };
|
37
node_modules/yaml/browser/dist/schema/yaml-1.1/schema.js
generated
vendored
Normal file
37
node_modules/yaml/browser/dist/schema/yaml-1.1/schema.js
generated
vendored
Normal file
|
@ -0,0 +1,37 @@
|
|||
import { map } from '../common/map.js';
|
||||
import { nullTag } from '../common/null.js';
|
||||
import { seq } from '../common/seq.js';
|
||||
import { string } from '../common/string.js';
|
||||
import { binary } from './binary.js';
|
||||
import { trueTag, falseTag } from './bool.js';
|
||||
import { floatNaN, floatExp, float } from './float.js';
|
||||
import { intBin, intOct, int, intHex } from './int.js';
|
||||
import { omap } from './omap.js';
|
||||
import { pairs } from './pairs.js';
|
||||
import { set } from './set.js';
|
||||
import { intTime, floatTime, timestamp } from './timestamp.js';
|
||||
|
||||
const schema = [
|
||||
map,
|
||||
seq,
|
||||
string,
|
||||
nullTag,
|
||||
trueTag,
|
||||
falseTag,
|
||||
intBin,
|
||||
intOct,
|
||||
int,
|
||||
intHex,
|
||||
floatNaN,
|
||||
floatExp,
|
||||
float,
|
||||
binary,
|
||||
omap,
|
||||
pairs,
|
||||
set,
|
||||
intTime,
|
||||
floatTime,
|
||||
timestamp
|
||||
];
|
||||
|
||||
export { schema };
|
92
node_modules/yaml/browser/dist/schema/yaml-1.1/set.js
generated
vendored
Normal file
92
node_modules/yaml/browser/dist/schema/yaml-1.1/set.js
generated
vendored
Normal file
|
@ -0,0 +1,92 @@
|
|||
import { isMap, isPair, isScalar } from '../../nodes/Node.js';
|
||||
import { createPair, Pair } from '../../nodes/Pair.js';
|
||||
import { YAMLMap, findPair } from '../../nodes/YAMLMap.js';
|
||||
|
||||
class YAMLSet extends YAMLMap {
|
||||
constructor(schema) {
|
||||
super(schema);
|
||||
this.tag = YAMLSet.tag;
|
||||
}
|
||||
add(key) {
|
||||
let pair;
|
||||
if (isPair(key))
|
||||
pair = key;
|
||||
else if (key &&
|
||||
typeof key === 'object' &&
|
||||
'key' in key &&
|
||||
'value' in key &&
|
||||
key.value === null)
|
||||
pair = new Pair(key.key, null);
|
||||
else
|
||||
pair = new Pair(key, null);
|
||||
const prev = findPair(this.items, pair.key);
|
||||
if (!prev)
|
||||
this.items.push(pair);
|
||||
}
|
||||
/**
|
||||
* If `keepPair` is `true`, returns the Pair matching `key`.
|
||||
* Otherwise, returns the value of that Pair's key.
|
||||
*/
|
||||
get(key, keepPair) {
|
||||
const pair = findPair(this.items, key);
|
||||
return !keepPair && isPair(pair)
|
||||
? isScalar(pair.key)
|
||||
? pair.key.value
|
||||
: pair.key
|
||||
: pair;
|
||||
}
|
||||
set(key, value) {
|
||||
if (typeof value !== 'boolean')
|
||||
throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof value}`);
|
||||
const prev = findPair(this.items, key);
|
||||
if (prev && !value) {
|
||||
this.items.splice(this.items.indexOf(prev), 1);
|
||||
}
|
||||
else if (!prev && value) {
|
||||
this.items.push(new Pair(key));
|
||||
}
|
||||
}
|
||||
toJSON(_, ctx) {
|
||||
return super.toJSON(_, ctx, Set);
|
||||
}
|
||||
toString(ctx, onComment, onChompKeep) {
|
||||
if (!ctx)
|
||||
return JSON.stringify(this);
|
||||
if (this.hasAllNullValues(true))
|
||||
return super.toString(Object.assign({}, ctx, { allNullValues: true }), onComment, onChompKeep);
|
||||
else
|
||||
throw new Error('Set items must all have null values');
|
||||
}
|
||||
}
|
||||
YAMLSet.tag = 'tag:yaml.org,2002:set';
|
||||
const set = {
|
||||
collection: 'map',
|
||||
identify: value => value instanceof Set,
|
||||
nodeClass: YAMLSet,
|
||||
default: false,
|
||||
tag: 'tag:yaml.org,2002:set',
|
||||
resolve(map, onError) {
|
||||
if (isMap(map)) {
|
||||
if (map.hasAllNullValues(true))
|
||||
return Object.assign(new YAMLSet(), map);
|
||||
else
|
||||
onError('Set items must all have null values');
|
||||
}
|
||||
else
|
||||
onError('Expected a mapping for this tag');
|
||||
return map;
|
||||
},
|
||||
createNode(schema, iterable, ctx) {
|
||||
const { replacer } = ctx;
|
||||
const set = new YAMLSet(schema);
|
||||
if (iterable && Symbol.iterator in Object(iterable))
|
||||
for (let value of iterable) {
|
||||
if (typeof replacer === 'function')
|
||||
value = replacer.call(iterable, value, value);
|
||||
set.items.push(createPair(value, null, ctx));
|
||||
}
|
||||
return set;
|
||||
}
|
||||
};
|
||||
|
||||
export { YAMLSet, set };
|
101
node_modules/yaml/browser/dist/schema/yaml-1.1/timestamp.js
generated
vendored
Normal file
101
node_modules/yaml/browser/dist/schema/yaml-1.1/timestamp.js
generated
vendored
Normal file
|
@ -0,0 +1,101 @@
|
|||
import { stringifyNumber } from '../../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(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 => (n < 10 ? '0' + String(n) : String(n)))
|
||||
.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$/, '')
|
||||
};
|
||||
|
||||
export { floatTime, intTime, timestamp };
|
Loading…
Add table
Add a link
Reference in a new issue