diff options
Diffstat (limited to 'node_modules/yaml/dist/schema/yaml-1.1')
18 files changed, 0 insertions, 693 deletions
diff --git a/node_modules/yaml/dist/schema/yaml-1.1/binary.d.ts b/node_modules/yaml/dist/schema/yaml-1.1/binary.d.ts deleted file mode 100644 index 2054970..0000000 --- a/node_modules/yaml/dist/schema/yaml-1.1/binary.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -import type { ScalarTag } from '../types.js'; -export declare const binary: ScalarTag; diff --git a/node_modules/yaml/dist/schema/yaml-1.1/binary.js b/node_modules/yaml/dist/schema/yaml-1.1/binary.js deleted file mode 100644 index df93e05..0000000 --- a/node_modules/yaml/dist/schema/yaml-1.1/binary.js +++ /dev/null @@ -1,68 +0,0 @@ -'use strict'; - -var Scalar = require('../../nodes/Scalar.js'); -var stringifyString = require('../../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.Scalar.BLOCK_LITERAL; - if (type !== Scalar.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.Scalar.BLOCK_LITERAL ? '\n' : ' '); - } - return stringifyString.stringifyString({ comment, type, value: str }, ctx, onComment, onChompKeep); - } -}; - -exports.binary = binary; diff --git a/node_modules/yaml/dist/schema/yaml-1.1/bool.d.ts b/node_modules/yaml/dist/schema/yaml-1.1/bool.d.ts deleted file mode 100644 index 587b55b..0000000 --- a/node_modules/yaml/dist/schema/yaml-1.1/bool.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -import type { ScalarTag } from '../types.js'; -export declare const trueTag: ScalarTag & { - test: RegExp; -}; -export declare const falseTag: ScalarTag & { - test: RegExp; -}; diff --git a/node_modules/yaml/dist/schema/yaml-1.1/bool.js b/node_modules/yaml/dist/schema/yaml-1.1/bool.js deleted file mode 100644 index fdb3b46..0000000 --- a/node_modules/yaml/dist/schema/yaml-1.1/bool.js +++ /dev/null @@ -1,29 +0,0 @@ -'use strict'; - -var Scalar = require('../../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.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.Scalar(false), - stringify: boolStringify -}; - -exports.falseTag = falseTag; -exports.trueTag = trueTag; diff --git a/node_modules/yaml/dist/schema/yaml-1.1/float.d.ts b/node_modules/yaml/dist/schema/yaml-1.1/float.d.ts deleted file mode 100644 index 22f0249..0000000 --- a/node_modules/yaml/dist/schema/yaml-1.1/float.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -import type { ScalarTag } from '../types.js'; -export declare const floatNaN: ScalarTag; -export declare const floatExp: ScalarTag; -export declare const float: ScalarTag; diff --git a/node_modules/yaml/dist/schema/yaml-1.1/float.js b/node_modules/yaml/dist/schema/yaml-1.1/float.js deleted file mode 100644 index 4aea19a..0000000 --- a/node_modules/yaml/dist/schema/yaml-1.1/float.js +++ /dev/null @@ -1,50 +0,0 @@ -'use strict'; - -var Scalar = require('../../nodes/Scalar.js'); -var stringifyNumber = require('../../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.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.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.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.stringifyNumber -}; - -exports.float = float; -exports.floatExp = floatExp; -exports.floatNaN = floatNaN; diff --git a/node_modules/yaml/dist/schema/yaml-1.1/int.d.ts b/node_modules/yaml/dist/schema/yaml-1.1/int.d.ts deleted file mode 100644 index 3d92f37..0000000 --- a/node_modules/yaml/dist/schema/yaml-1.1/int.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -import type { ScalarTag } from '../types.js'; -export declare const intBin: ScalarTag; -export declare const intOct: ScalarTag; -export declare const int: ScalarTag; -export declare const intHex: ScalarTag; diff --git a/node_modules/yaml/dist/schema/yaml-1.1/int.js b/node_modules/yaml/dist/schema/yaml-1.1/int.js deleted file mode 100644 index fdf47ca..0000000 --- a/node_modules/yaml/dist/schema/yaml-1.1/int.js +++ /dev/null @@ -1,76 +0,0 @@ -'use strict'; - -var stringifyNumber = require('../../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.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.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') -}; - -exports.int = int; -exports.intBin = intBin; -exports.intHex = intHex; -exports.intOct = intOct; diff --git a/node_modules/yaml/dist/schema/yaml-1.1/omap.d.ts b/node_modules/yaml/dist/schema/yaml-1.1/omap.d.ts deleted file mode 100644 index 4d71bc4..0000000 --- a/node_modules/yaml/dist/schema/yaml-1.1/omap.d.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { YAMLSeq } from '../../nodes/YAMLSeq.js'; -import { ToJSContext } from '../../nodes/toJS.js'; -import { CollectionTag } from '../types.js'; -export declare class YAMLOMap extends YAMLSeq { - static tag: string; - constructor(); - add: (pair: import("../../index.js").Pair<any, any> | { - key: any; - value: any; - }, overwrite?: boolean | undefined) => void; - delete: (key: any) => boolean; - get: (key: any, keepScalar?: boolean | undefined) => unknown; - has: (key: any) => boolean; - set: (key: any, value: any) => void; - /** - * 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(_?: unknown, ctx?: ToJSContext): unknown[]; -} -export declare const omap: CollectionTag; diff --git a/node_modules/yaml/dist/schema/yaml-1.1/omap.js b/node_modules/yaml/dist/schema/yaml-1.1/omap.js deleted file mode 100644 index 006a65d..0000000 --- a/node_modules/yaml/dist/schema/yaml-1.1/omap.js +++ /dev/null @@ -1,76 +0,0 @@ -'use strict'; - -var YAMLSeq = require('../../nodes/YAMLSeq.js'); -var toJS = require('../../nodes/toJS.js'); -var Node = require('../../nodes/Node.js'); -var YAMLMap = require('../../nodes/YAMLMap.js'); -var pairs = require('./pairs.js'); - -class YAMLOMap extends YAMLSeq.YAMLSeq { - constructor() { - super(); - this.add = YAMLMap.YAMLMap.prototype.add.bind(this); - this.delete = YAMLMap.YAMLMap.prototype.delete.bind(this); - this.get = YAMLMap.YAMLMap.prototype.get.bind(this); - this.has = YAMLMap.YAMLMap.prototype.has.bind(this); - this.set = YAMLMap.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 === null || ctx === void 0 ? void 0 : ctx.onCreate) - ctx.onCreate(map); - for (const pair of this.items) { - let key, value; - if (Node.isPair(pair)) { - key = toJS.toJS(pair.key, '', ctx); - value = toJS.toJS(pair.value, key, ctx); - } - else { - key = toJS.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$1 = pairs.resolvePairs(seq, onError); - const seenKeys = []; - for (const { key } of pairs$1.items) { - if (Node.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$1); - }, - createNode(schema, iterable, ctx) { - const pairs$1 = pairs.createPairs(schema, iterable, ctx); - const omap = new YAMLOMap(); - omap.items = pairs$1.items; - return omap; - } -}; - -exports.YAMLOMap = YAMLOMap; -exports.omap = omap; diff --git a/node_modules/yaml/dist/schema/yaml-1.1/pairs.d.ts b/node_modules/yaml/dist/schema/yaml-1.1/pairs.d.ts deleted file mode 100644 index 8090ac2..0000000 --- a/node_modules/yaml/dist/schema/yaml-1.1/pairs.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -import type { CreateNodeContext } from '../../doc/createNode.js'; -import { ParsedNode } from '../../nodes/Node.js'; -import { Pair } from '../../nodes/Pair.js'; -import { YAMLMap } from '../../nodes/YAMLMap.js'; -import { YAMLSeq } from '../../nodes/YAMLSeq.js'; -import type { Schema } from '../../schema/Schema.js'; -import type { CollectionTag } from '../types.js'; -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; diff --git a/node_modules/yaml/dist/schema/yaml-1.1/pairs.js b/node_modules/yaml/dist/schema/yaml-1.1/pairs.js deleted file mode 100644 index 12858ab..0000000 --- a/node_modules/yaml/dist/schema/yaml-1.1/pairs.js +++ /dev/null @@ -1,82 +0,0 @@ -'use strict'; - -var Node = require('../../nodes/Node.js'); -var Pair = require('../../nodes/Pair.js'); -var Scalar = require('../../nodes/Scalar.js'); -var YAMLSeq = require('../../nodes/YAMLSeq.js'); - -function resolvePairs(seq, onError) { - var _a; - if (Node.isSeq(seq)) { - for (let i = 0; i < seq.items.length; ++i) { - let item = seq.items[i]; - if (Node.isPair(item)) - continue; - else if (Node.isMap(item)) { - if (item.items.length > 1) - onError('Each pair must have its own sequence indicator'); - const pair = item.items[0] || new Pair.Pair(new Scalar.Scalar(null)); - if (item.commentBefore) - pair.key.commentBefore = pair.key.commentBefore - ? `${item.commentBefore}\n${pair.key.commentBefore}` - : item.commentBefore; - if (item.comment) { - const cn = (_a = pair.value) !== null && _a !== void 0 ? _a : pair.key; - cn.comment = cn.comment - ? `${item.comment}\n${cn.comment}` - : item.comment; - } - item = pair; - } - seq.items[i] = Node.isPair(item) ? item : new Pair.Pair(item); - } - } - else - onError('Expected a sequence for this tag'); - return seq; -} -function createPairs(schema, iterable, ctx) { - const { replacer } = ctx; - const pairs = new YAMLSeq.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(Pair.createPair(key, value, ctx)); - } - return pairs; -} -const pairs = { - collection: 'seq', - default: false, - tag: 'tag:yaml.org,2002:pairs', - resolve: resolvePairs, - createNode: createPairs -}; - -exports.createPairs = createPairs; -exports.pairs = pairs; -exports.resolvePairs = resolvePairs; diff --git a/node_modules/yaml/dist/schema/yaml-1.1/schema.d.ts b/node_modules/yaml/dist/schema/yaml-1.1/schema.d.ts deleted file mode 100644 index 7663949..0000000 --- a/node_modules/yaml/dist/schema/yaml-1.1/schema.d.ts +++ /dev/null @@ -1 +0,0 @@ -export declare const schema: (import("../types.js").ScalarTag | import("../types.js").CollectionTag)[]; diff --git a/node_modules/yaml/dist/schema/yaml-1.1/schema.js b/node_modules/yaml/dist/schema/yaml-1.1/schema.js deleted file mode 100644 index c04270a..0000000 --- a/node_modules/yaml/dist/schema/yaml-1.1/schema.js +++ /dev/null @@ -1,39 +0,0 @@ -'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 binary = require('./binary.js'); -var bool = require('./bool.js'); -var float = require('./float.js'); -var int = require('./int.js'); -var omap = require('./omap.js'); -var pairs = require('./pairs.js'); -var set = require('./set.js'); -var timestamp = require('./timestamp.js'); - -const schema = [ - map.map, - seq.seq, - string.string, - _null.nullTag, - bool.trueTag, - bool.falseTag, - int.intBin, - int.intOct, - int.int, - int.intHex, - float.floatNaN, - float.floatExp, - float.float, - binary.binary, - omap.omap, - pairs.pairs, - set.set, - timestamp.intTime, - timestamp.floatTime, - timestamp.timestamp -]; - -exports.schema = schema; diff --git a/node_modules/yaml/dist/schema/yaml-1.1/set.d.ts b/node_modules/yaml/dist/schema/yaml-1.1/set.d.ts deleted file mode 100644 index fa7cdac..0000000 --- a/node_modules/yaml/dist/schema/yaml-1.1/set.d.ts +++ /dev/null @@ -1,22 +0,0 @@ -import type { Schema } from '../../schema/Schema.js'; -import { Pair } from '../../nodes/Pair.js'; -import { Scalar } from '../../nodes/Scalar.js'; -import { ToJSContext } from '../../nodes/toJS.js'; -import { YAMLMap } from '../../nodes/YAMLMap.js'; -import type { StringifyContext } from '../../stringify/stringify.js'; -import type { CollectionTag } from '../types.js'; -export declare class YAMLSet<T = unknown> extends YAMLMap<T, Scalar<null> | null> { - static tag: string; - constructor(schema?: Schema); - add(key: T | Pair<T, Scalar<null> | null> | { - key: T; - value: Scalar<null> | null; - }): void; - get(key?: T, keepPair?: boolean): unknown; - set(key: T, value: boolean): void; - /** Will throw; `value` must be boolean */ - set(key: T, value: null): void; - toJSON(_?: unknown, ctx?: ToJSContext): any; - toString(ctx?: StringifyContext, onComment?: () => void, onChompKeep?: () => void): string; -} -export declare const set: CollectionTag; diff --git a/node_modules/yaml/dist/schema/yaml-1.1/set.js b/node_modules/yaml/dist/schema/yaml-1.1/set.js deleted file mode 100644 index 2270695..0000000 --- a/node_modules/yaml/dist/schema/yaml-1.1/set.js +++ /dev/null @@ -1,90 +0,0 @@ -'use strict'; - -var Node = require('../../nodes/Node.js'); -var Pair = require('../../nodes/Pair.js'); -var YAMLMap = require('../../nodes/YAMLMap.js'); - -class YAMLSet extends YAMLMap.YAMLMap { - constructor(schema) { - super(schema); - this.tag = YAMLSet.tag; - } - add(key) { - let pair; - if (Node.isPair(key)) - pair = key; - else if (typeof key === 'object' && - 'key' in key && - 'value' in key && - key.value === null) - pair = new Pair.Pair(key.key, null); - else - pair = new Pair.Pair(key, null); - const prev = YAMLMap.findPair(this.items, pair.key); - if (!prev) - this.items.push(pair); - } - get(key, keepPair) { - const pair = YAMLMap.findPair(this.items, key); - return !keepPair && Node.isPair(pair) - ? Node.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 = YAMLMap.findPair(this.items, key); - if (prev && !value) { - this.items.splice(this.items.indexOf(prev), 1); - } - else if (!prev && value) { - this.items.push(new Pair.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 (Node.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(Pair.createPair(value, null, ctx)); - } - return set; - } -}; - -exports.YAMLSet = YAMLSet; -exports.set = set; diff --git a/node_modules/yaml/dist/schema/yaml-1.1/timestamp.d.ts b/node_modules/yaml/dist/schema/yaml-1.1/timestamp.d.ts deleted file mode 100644 index 0c1d2d4..0000000 --- a/node_modules/yaml/dist/schema/yaml-1.1/timestamp.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -import type { ScalarTag } from '../types.js'; -export declare const intTime: ScalarTag; -export declare const floatTime: ScalarTag; -export declare const timestamp: ScalarTag & { - test: RegExp; -}; diff --git a/node_modules/yaml/dist/schema/yaml-1.1/timestamp.js b/node_modules/yaml/dist/schema/yaml-1.1/timestamp.js deleted file mode 100644 index 2d78ae8..0000000 --- a/node_modules/yaml/dist/schema/yaml-1.1/timestamp.js +++ /dev/null @@ -1,105 +0,0 @@ -'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 => (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$/, '') -}; - -exports.floatTime = floatTime; -exports.intTime = intTime; -exports.timestamp = timestamp; |