diff options
Diffstat (limited to 'node_modules/yaml/dist/nodes')
-rw-r--r-- | node_modules/yaml/dist/nodes/Alias.d.ts | 28 | ||||
-rw-r--r-- | node_modules/yaml/dist/nodes/Alias.js | 96 | ||||
-rw-r--r-- | node_modules/yaml/dist/nodes/Collection.d.ts | 73 | ||||
-rw-r--r-- | node_modules/yaml/dist/nodes/Collection.js | 150 | ||||
-rw-r--r-- | node_modules/yaml/dist/nodes/Node.d.ts | 53 | ||||
-rw-r--r-- | node_modules/yaml/dist/nodes/Node.js | 66 | ||||
-rw-r--r-- | node_modules/yaml/dist/nodes/Pair.d.ts | 21 | ||||
-rw-r--r-- | node_modules/yaml/dist/nodes/Pair.js | 39 | ||||
-rw-r--r-- | node_modules/yaml/dist/nodes/Scalar.d.ts | 42 | ||||
-rw-r--r-- | node_modules/yaml/dist/nodes/Scalar.js | 26 | ||||
-rw-r--r-- | node_modules/yaml/dist/nodes/YAMLMap.d.ts | 43 | ||||
-rw-r--r-- | node_modules/yaml/dist/nodes/YAMLMap.js | 120 | ||||
-rw-r--r-- | node_modules/yaml/dist/nodes/YAMLSeq.d.ts | 55 | ||||
-rw-r--r-- | node_modules/yaml/dist/nodes/YAMLSeq.js | 107 | ||||
-rw-r--r-- | node_modules/yaml/dist/nodes/addPairToJSMap.d.ts | 3 | ||||
-rw-r--r-- | node_modules/yaml/dist/nodes/addPairToJSMap.js | 106 | ||||
-rw-r--r-- | node_modules/yaml/dist/nodes/toJS.d.ts | 30 | ||||
-rw-r--r-- | node_modules/yaml/dist/nodes/toJS.js | 39 |
18 files changed, 0 insertions, 1097 deletions
diff --git a/node_modules/yaml/dist/nodes/Alias.d.ts b/node_modules/yaml/dist/nodes/Alias.d.ts deleted file mode 100644 index cdb0f42..0000000 --- a/node_modules/yaml/dist/nodes/Alias.d.ts +++ /dev/null @@ -1,28 +0,0 @@ -import type { Document } from '../doc/Document.js'; -import type { FlowScalar } from '../parse/cst.js'; -import type { StringifyContext } from '../stringify/stringify.js'; -import { NodeBase, Range } from './Node.js'; -import type { Scalar } from './Scalar'; -import type { ToJSContext } from './toJS.js'; -import type { YAMLMap } from './YAMLMap.js'; -import type { YAMLSeq } from './YAMLSeq.js'; -export declare namespace Alias { - interface Parsed extends Alias { - range: Range; - srcToken?: FlowScalar & { - type: 'alias'; - }; - } -} -export declare class Alias extends NodeBase { - source: string; - anchor?: never; - constructor(source: string); - /** - * Resolve the value of this alias within `doc`, finding the last - * instance of the `source` anchor before this node. - */ - resolve(doc: Document): Scalar | YAMLMap | YAMLSeq | undefined; - toJSON(_arg?: unknown, ctx?: ToJSContext): unknown; - toString(ctx?: StringifyContext, _onComment?: () => void, _onChompKeep?: () => void): string; -} diff --git a/node_modules/yaml/dist/nodes/Alias.js b/node_modules/yaml/dist/nodes/Alias.js deleted file mode 100644 index 75853cf..0000000 --- a/node_modules/yaml/dist/nodes/Alias.js +++ /dev/null @@ -1,96 +0,0 @@ -'use strict'; - -var anchors = require('../doc/anchors.js'); -var visit = require('../visit.js'); -var Node = require('./Node.js'); - -class Alias extends Node.NodeBase { - constructor(source) { - super(Node.ALIAS); - this.source = source; - Object.defineProperty(this, 'tag', { - set() { - throw new Error('Alias nodes cannot have tags'); - } - }); - } - /** - * Resolve the value of this alias within `doc`, finding the last - * instance of the `source` anchor before this node. - */ - resolve(doc) { - let found = undefined; - visit.visit(doc, { - Node: (_key, node) => { - if (node === this) - return visit.visit.BREAK; - if (node.anchor === this.source) - found = node; - } - }); - return found; - } - toJSON(_arg, ctx) { - if (!ctx) - return { source: this.source }; - const { anchors, doc, maxAliasCount } = ctx; - const source = this.resolve(doc); - if (!source) { - const msg = `Unresolved alias (the anchor must be set before the alias): ${this.source}`; - throw new ReferenceError(msg); - } - const data = anchors.get(source); - /* istanbul ignore if */ - if (!data || data.res === undefined) { - const msg = 'This should not happen: Alias anchor was not resolved?'; - throw new ReferenceError(msg); - } - if (maxAliasCount >= 0) { - data.count += 1; - if (data.aliasCount === 0) - data.aliasCount = getAliasCount(doc, source, anchors); - if (data.count * data.aliasCount > maxAliasCount) { - const msg = 'Excessive alias count indicates a resource exhaustion attack'; - throw new ReferenceError(msg); - } - } - return data.res; - } - toString(ctx, _onComment, _onChompKeep) { - const src = `*${this.source}`; - if (ctx) { - anchors.anchorIsValid(this.source); - if (ctx.options.verifyAliasOrder && !ctx.anchors.has(this.source)) { - const msg = `Unresolved alias (the anchor must be set before the alias): ${this.source}`; - throw new Error(msg); - } - if (ctx.implicitKey) - return `${src} `; - } - return src; - } -} -function getAliasCount(doc, node, anchors) { - if (Node.isAlias(node)) { - const source = node.resolve(doc); - const anchor = anchors && source && anchors.get(source); - return anchor ? anchor.count * anchor.aliasCount : 0; - } - else if (Node.isCollection(node)) { - let count = 0; - for (const item of node.items) { - const c = getAliasCount(doc, item, anchors); - if (c > count) - count = c; - } - return count; - } - else if (Node.isPair(node)) { - const kc = getAliasCount(doc, node.key, anchors); - const vc = getAliasCount(doc, node.value, anchors); - return Math.max(kc, vc); - } - return 1; -} - -exports.Alias = Alias; diff --git a/node_modules/yaml/dist/nodes/Collection.d.ts b/node_modules/yaml/dist/nodes/Collection.d.ts deleted file mode 100644 index 3515c8f..0000000 --- a/node_modules/yaml/dist/nodes/Collection.d.ts +++ /dev/null @@ -1,73 +0,0 @@ -import type { Schema } from '../schema/Schema.js'; -import { NodeBase, NODE_TYPE } from './Node.js'; -export declare function collectionFromPath(schema: Schema, path: unknown[], value: unknown): import("./Node.js").Node; -export declare const isEmptyPath: (path: Iterable<unknown> | null | undefined) => boolean; -export declare abstract class Collection extends NodeBase { - static maxFlowStringSingleLineLength: number; - schema: Schema | undefined; - [NODE_TYPE]: symbol; - items: unknown[]; - /** An optional anchor on this node. Used by alias nodes. */ - anchor?: string; - /** - * If true, stringify this and all child nodes using flow rather than - * block styles. - */ - flow?: boolean; - constructor(type: symbol, schema?: Schema); - /** - * Create a copy of this collection. - * - * @param schema - If defined, overwrites the original's schema - */ - clone(schema?: Schema): Collection; - /** Adds a value to the collection. */ - abstract add(value: unknown): void; - /** - * Removes a value from the collection. - * @returns `true` if the item was found and removed. - */ - abstract delete(key: unknown): boolean; - /** - * Returns item at `key`, or `undefined` if not found. By default unwraps - * scalar values from their surrounding node; to disable set `keepScalar` to - * `true` (collections are always returned intact). - */ - abstract get(key: unknown, keepScalar?: boolean): unknown; - /** - * Checks if the collection includes a value with the key `key`. - */ - abstract has(key: unknown): boolean; - /** - * Sets a value in this collection. For `!!set`, `value` needs to be a - * boolean to add/remove the item from the set. - */ - abstract set(key: unknown, value: unknown): void; - /** - * Adds a value to the collection. For `!!map` and `!!omap` the value must - * be a Pair instance or a `{ key, value }` object, which may not have a key - * that already exists in the map. - */ - addIn(path: Iterable<unknown>, value: unknown): void; - /** - * Removes a value from the collection. - * @returns `true` if the item was found and removed. - */ - deleteIn(path: Iterable<unknown>): boolean; - /** - * Returns item at `key`, or `undefined` if not found. By default unwraps - * scalar values from their surrounding node; to disable set `keepScalar` to - * `true` (collections are always returned intact). - */ - getIn(path: Iterable<unknown>, keepScalar?: boolean): unknown; - hasAllNullValues(allowScalar?: boolean): boolean; - /** - * Checks if the collection includes a value with the key `key`. - */ - hasIn(path: Iterable<unknown>): boolean; - /** - * Sets a value in this collection. For `!!set`, `value` needs to be a - * boolean to add/remove the item from the set. - */ - setIn(path: Iterable<unknown>, value: unknown): void; -} diff --git a/node_modules/yaml/dist/nodes/Collection.js b/node_modules/yaml/dist/nodes/Collection.js deleted file mode 100644 index 3c56597..0000000 --- a/node_modules/yaml/dist/nodes/Collection.js +++ /dev/null @@ -1,150 +0,0 @@ -'use strict'; - -var createNode = require('../doc/createNode.js'); -var Node = require('./Node.js'); - -function collectionFromPath(schema, path, value) { - let v = value; - for (let i = path.length - 1; i >= 0; --i) { - const k = path[i]; - if (typeof k === 'number' && Number.isInteger(k) && k >= 0) { - const a = []; - a[k] = v; - v = a; - } - else { - v = new Map([[k, v]]); - } - } - return createNode.createNode(v, undefined, { - aliasDuplicateObjects: false, - keepUndefined: false, - onAnchor: () => { - throw new Error('This should not happen, please report a bug.'); - }, - schema, - sourceObjects: new Map() - }); -} -// null, undefined, or an empty non-string iterable (e.g. []) -const isEmptyPath = (path) => path == null || - (typeof path === 'object' && !!path[Symbol.iterator]().next().done); -class Collection extends Node.NodeBase { - constructor(type, schema) { - super(type); - Object.defineProperty(this, 'schema', { - value: schema, - configurable: true, - enumerable: false, - writable: true - }); - } - /** - * Create a copy of this collection. - * - * @param schema - If defined, overwrites the original's schema - */ - clone(schema) { - const copy = Object.create(Object.getPrototypeOf(this), Object.getOwnPropertyDescriptors(this)); - if (schema) - copy.schema = schema; - copy.items = copy.items.map(it => Node.isNode(it) || Node.isPair(it) ? it.clone(schema) : it); - if (this.range) - copy.range = this.range.slice(); - return copy; - } - /** - * Adds a value to the collection. For `!!map` and `!!omap` the value must - * be a Pair instance or a `{ key, value }` object, which may not have a key - * that already exists in the map. - */ - addIn(path, value) { - if (isEmptyPath(path)) - this.add(value); - else { - const [key, ...rest] = path; - const node = this.get(key, true); - if (Node.isCollection(node)) - node.addIn(rest, value); - else if (node === undefined && this.schema) - this.set(key, collectionFromPath(this.schema, rest, value)); - else - throw new Error(`Expected YAML collection at ${key}. Remaining path: ${rest}`); - } - } - /** - * Removes a value from the collection. - * @returns `true` if the item was found and removed. - */ - deleteIn(path) { - const [key, ...rest] = path; - if (rest.length === 0) - return this.delete(key); - const node = this.get(key, true); - if (Node.isCollection(node)) - return node.deleteIn(rest); - else - throw new Error(`Expected YAML collection at ${key}. Remaining path: ${rest}`); - } - /** - * Returns item at `key`, or `undefined` if not found. By default unwraps - * scalar values from their surrounding node; to disable set `keepScalar` to - * `true` (collections are always returned intact). - */ - getIn(path, keepScalar) { - const [key, ...rest] = path; - const node = this.get(key, true); - if (rest.length === 0) - return !keepScalar && Node.isScalar(node) ? node.value : node; - else - return Node.isCollection(node) ? node.getIn(rest, keepScalar) : undefined; - } - hasAllNullValues(allowScalar) { - return this.items.every(node => { - if (!Node.isPair(node)) - return false; - const n = node.value; - return (n == null || - (allowScalar && - Node.isScalar(n) && - n.value == null && - !n.commentBefore && - !n.comment && - !n.tag)); - }); - } - /** - * Checks if the collection includes a value with the key `key`. - */ - hasIn(path) { - const [key, ...rest] = path; - if (rest.length === 0) - return this.has(key); - const node = this.get(key, true); - return Node.isCollection(node) ? node.hasIn(rest) : false; - } - /** - * Sets a value in this collection. For `!!set`, `value` needs to be a - * boolean to add/remove the item from the set. - */ - setIn(path, value) { - const [key, ...rest] = path; - if (rest.length === 0) { - this.set(key, value); - } - else { - const node = this.get(key, true); - if (Node.isCollection(node)) - node.setIn(rest, value); - else if (node === undefined && this.schema) - this.set(key, collectionFromPath(this.schema, rest, value)); - else - throw new Error(`Expected YAML collection at ${key}. Remaining path: ${rest}`); - } - } -} -Collection.maxFlowStringSingleLineLength = 60; - -exports.Collection = Collection; -exports.collectionFromPath = collectionFromPath; -exports.isEmptyPath = isEmptyPath; diff --git a/node_modules/yaml/dist/nodes/Node.d.ts b/node_modules/yaml/dist/nodes/Node.d.ts deleted file mode 100644 index 719c65b..0000000 --- a/node_modules/yaml/dist/nodes/Node.d.ts +++ /dev/null @@ -1,53 +0,0 @@ -import type { Document } from '../doc/Document.js'; -import { Token } from '../parse/cst.js'; -import type { StringifyContext } from '../stringify/stringify.js'; -import type { Alias } from './Alias.js'; -import type { Pair } from './Pair.js'; -import type { Scalar } from './Scalar.js'; -import type { YAMLMap } from './YAMLMap.js'; -import type { YAMLSeq } from './YAMLSeq.js'; -export declare type Node = Alias | Scalar | YAMLMap | YAMLSeq; -export declare type ParsedNode = Alias.Parsed | Scalar.Parsed | YAMLMap.Parsed | YAMLSeq.Parsed; -export declare type Range = [number, number, number]; -export declare const ALIAS: unique symbol; -export declare const DOC: unique symbol; -export declare const MAP: unique symbol; -export declare const PAIR: unique symbol; -export declare const SCALAR: unique symbol; -export declare const SEQ: unique symbol; -export declare const NODE_TYPE: unique symbol; -export declare const isAlias: (node: any) => node is Alias; -export declare const isDocument: (node: any) => node is Document<unknown>; -export declare const isMap: (node: any) => node is YAMLMap<unknown, unknown>; -export declare const isPair: (node: any) => node is Pair<unknown, unknown>; -export declare const isScalar: (node: any) => node is Scalar<unknown>; -export declare const isSeq: (node: any) => node is YAMLSeq<unknown>; -export declare function isCollection(node: any): node is YAMLMap | YAMLSeq; -export declare function isNode(node: any): node is Node; -export declare const hasAnchor: (node: unknown) => node is Scalar<unknown> | YAMLMap<unknown, unknown> | YAMLSeq<unknown>; -export declare abstract class NodeBase { - readonly [NODE_TYPE]: symbol; - /** A comment on or immediately after this */ - comment?: string | null; - /** A comment before this */ - commentBefore?: string | null; - /** - * The `[start, value-end, node-end]` character offsets for the part of the - * source parsed into this node (undefined if not parsed). The `value-end` - * and `node-end` positions are themselves not included in their respective - * ranges. - */ - range?: Range | null; - /** A blank line before this node and its commentBefore */ - spaceBefore?: boolean; - /** The CST token that was composed into this node. */ - srcToken?: Token; - /** A fully qualified tag, if required */ - tag?: string; - /** A plain JS representation of this node */ - abstract toJSON(): any; - abstract toString(ctx?: StringifyContext, onComment?: () => void, onChompKeep?: () => void): string; - constructor(type: symbol); - /** Create a copy of this node. */ - clone(): NodeBase; -} diff --git a/node_modules/yaml/dist/nodes/Node.js b/node_modules/yaml/dist/nodes/Node.js deleted file mode 100644 index 4ddff6a..0000000 --- a/node_modules/yaml/dist/nodes/Node.js +++ /dev/null @@ -1,66 +0,0 @@ -'use strict'; - -const ALIAS = Symbol.for('yaml.alias'); -const DOC = Symbol.for('yaml.document'); -const MAP = Symbol.for('yaml.map'); -const PAIR = Symbol.for('yaml.pair'); -const SCALAR = Symbol.for('yaml.scalar'); -const SEQ = Symbol.for('yaml.seq'); -const NODE_TYPE = Symbol.for('yaml.node.type'); -const isAlias = (node) => !!node && typeof node === 'object' && node[NODE_TYPE] === ALIAS; -const isDocument = (node) => !!node && typeof node === 'object' && node[NODE_TYPE] === DOC; -const isMap = (node) => !!node && typeof node === 'object' && node[NODE_TYPE] === MAP; -const isPair = (node) => !!node && typeof node === 'object' && node[NODE_TYPE] === PAIR; -const isScalar = (node) => !!node && typeof node === 'object' && node[NODE_TYPE] === SCALAR; -const isSeq = (node) => !!node && typeof node === 'object' && node[NODE_TYPE] === SEQ; -function isCollection(node) { - if (node && typeof node === 'object') - switch (node[NODE_TYPE]) { - case MAP: - case SEQ: - return true; - } - return false; -} -function isNode(node) { - if (node && typeof node === 'object') - switch (node[NODE_TYPE]) { - case ALIAS: - case MAP: - case SCALAR: - case SEQ: - return true; - } - return false; -} -const hasAnchor = (node) => (isScalar(node) || isCollection(node)) && !!node.anchor; -class NodeBase { - constructor(type) { - Object.defineProperty(this, NODE_TYPE, { value: type }); - } - /** Create a copy of this node. */ - clone() { - const copy = Object.create(Object.getPrototypeOf(this), Object.getOwnPropertyDescriptors(this)); - if (this.range) - copy.range = this.range.slice(); - return copy; - } -} - -exports.ALIAS = ALIAS; -exports.DOC = DOC; -exports.MAP = MAP; -exports.NODE_TYPE = NODE_TYPE; -exports.NodeBase = NodeBase; -exports.PAIR = PAIR; -exports.SCALAR = SCALAR; -exports.SEQ = SEQ; -exports.hasAnchor = hasAnchor; -exports.isAlias = isAlias; -exports.isCollection = isCollection; -exports.isDocument = isDocument; -exports.isMap = isMap; -exports.isNode = isNode; -exports.isPair = isPair; -exports.isScalar = isScalar; -exports.isSeq = isSeq; diff --git a/node_modules/yaml/dist/nodes/Pair.d.ts b/node_modules/yaml/dist/nodes/Pair.d.ts deleted file mode 100644 index da3d968..0000000 --- a/node_modules/yaml/dist/nodes/Pair.d.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { CreateNodeContext } from '../doc/createNode.js'; -import type { CollectionItem } from '../parse/cst.js'; -import type { Schema } from '../schema/Schema.js'; -import type { StringifyContext } from '../stringify/stringify.js'; -import { addPairToJSMap } from './addPairToJSMap.js'; -import { NODE_TYPE } from './Node.js'; -import type { ToJSContext } from './toJS.js'; -export declare function createPair(key: unknown, value: unknown, ctx: CreateNodeContext): Pair<import("./Node.js").Node, import("./Alias.js").Alias | import("./Scalar.js").Scalar<unknown> | import("./YAMLMap.js").YAMLMap<unknown, unknown> | import("./YAMLSeq.js").YAMLSeq<unknown>>; -export declare class Pair<K = unknown, V = unknown> { - readonly [NODE_TYPE]: symbol; - /** Always Node or null when parsed, but can be set to anything. */ - key: K; - /** Always Node or null when parsed, but can be set to anything. */ - value: V | null; - /** The CST token that was composed into this pair. */ - srcToken?: CollectionItem; - constructor(key: K, value?: V | null); - clone(schema?: Schema): Pair<K, V>; - toJSON(_?: unknown, ctx?: ToJSContext): ReturnType<typeof addPairToJSMap>; - toString(ctx?: StringifyContext, onComment?: () => void, onChompKeep?: () => void): string; -} diff --git a/node_modules/yaml/dist/nodes/Pair.js b/node_modules/yaml/dist/nodes/Pair.js deleted file mode 100644 index c0c22e9..0000000 --- a/node_modules/yaml/dist/nodes/Pair.js +++ /dev/null @@ -1,39 +0,0 @@ -'use strict'; - -var createNode = require('../doc/createNode.js'); -var stringifyPair = require('../stringify/stringifyPair.js'); -var addPairToJSMap = require('./addPairToJSMap.js'); -var Node = require('./Node.js'); - -function createPair(key, value, ctx) { - const k = createNode.createNode(key, undefined, ctx); - const v = createNode.createNode(value, undefined, ctx); - return new Pair(k, v); -} -class Pair { - constructor(key, value = null) { - Object.defineProperty(this, Node.NODE_TYPE, { value: Node.PAIR }); - this.key = key; - this.value = value; - } - clone(schema) { - let { key, value } = this; - if (Node.isNode(key)) - key = key.clone(schema); - if (Node.isNode(value)) - value = value.clone(schema); - return new Pair(key, value); - } - toJSON(_, ctx) { - const pair = (ctx === null || ctx === void 0 ? void 0 : ctx.mapAsMap) ? new Map() : {}; - return addPairToJSMap.addPairToJSMap(ctx, pair, this); - } - toString(ctx, onComment, onChompKeep) { - return (ctx === null || ctx === void 0 ? void 0 : ctx.doc) - ? stringifyPair.stringifyPair(this, ctx, onComment, onChompKeep) - : JSON.stringify(this); - } -} - -exports.Pair = Pair; -exports.createPair = createPair; diff --git a/node_modules/yaml/dist/nodes/Scalar.d.ts b/node_modules/yaml/dist/nodes/Scalar.d.ts deleted file mode 100644 index dd330b2..0000000 --- a/node_modules/yaml/dist/nodes/Scalar.d.ts +++ /dev/null @@ -1,42 +0,0 @@ -import type { BlockScalar, FlowScalar } from '../parse/cst.js'; -import { NodeBase, Range } from './Node.js'; -import { ToJSContext } from './toJS.js'; -export declare const isScalarValue: (value: unknown) => boolean; -export declare namespace Scalar { - interface Parsed extends Scalar { - range: Range; - source: string; - srcToken?: FlowScalar | BlockScalar; - } - type BLOCK_FOLDED = 'BLOCK_FOLDED'; - type BLOCK_LITERAL = 'BLOCK_LITERAL'; - type PLAIN = 'PLAIN'; - type QUOTE_DOUBLE = 'QUOTE_DOUBLE'; - type QUOTE_SINGLE = 'QUOTE_SINGLE'; - type Type = BLOCK_FOLDED | BLOCK_LITERAL | PLAIN | QUOTE_DOUBLE | QUOTE_SINGLE; -} -export declare class Scalar<T = unknown> extends NodeBase { - static readonly BLOCK_FOLDED = "BLOCK_FOLDED"; - static readonly BLOCK_LITERAL = "BLOCK_LITERAL"; - static readonly PLAIN = "PLAIN"; - static readonly QUOTE_DOUBLE = "QUOTE_DOUBLE"; - static readonly QUOTE_SINGLE = "QUOTE_SINGLE"; - value: T; - /** An optional anchor on this node. Used by alias nodes. */ - anchor?: string; - /** - * By default (undefined), numbers use decimal notation. - * The YAML 1.2 core schema only supports 'HEX' and 'OCT'. - * The YAML 1.1 schema also supports 'BIN' and 'TIME' - */ - format?: string; - /** If `value` is a number, use this value when stringifying this node. */ - minFractionDigits?: number; - /** Set during parsing to the source string value */ - source?: string; - /** The scalar style used for the node's string representation */ - type?: Scalar.Type; - constructor(value: T); - toJSON(arg?: any, ctx?: ToJSContext): any; - toString(): string; -} diff --git a/node_modules/yaml/dist/nodes/Scalar.js b/node_modules/yaml/dist/nodes/Scalar.js deleted file mode 100644 index 2d46471..0000000 --- a/node_modules/yaml/dist/nodes/Scalar.js +++ /dev/null @@ -1,26 +0,0 @@ -'use strict'; - -var Node = require('./Node.js'); -var toJS = require('./toJS.js'); - -const isScalarValue = (value) => !value || (typeof value !== 'function' && typeof value !== 'object'); -class Scalar extends Node.NodeBase { - constructor(value) { - super(Node.SCALAR); - this.value = value; - } - toJSON(arg, ctx) { - return (ctx === null || ctx === void 0 ? void 0 : ctx.keep) ? this.value : toJS.toJS(this.value, arg, ctx); - } - toString() { - return String(this.value); - } -} -Scalar.BLOCK_FOLDED = 'BLOCK_FOLDED'; -Scalar.BLOCK_LITERAL = 'BLOCK_LITERAL'; -Scalar.PLAIN = 'PLAIN'; -Scalar.QUOTE_DOUBLE = 'QUOTE_DOUBLE'; -Scalar.QUOTE_SINGLE = 'QUOTE_SINGLE'; - -exports.Scalar = Scalar; -exports.isScalarValue = isScalarValue; diff --git a/node_modules/yaml/dist/nodes/YAMLMap.d.ts b/node_modules/yaml/dist/nodes/YAMLMap.d.ts deleted file mode 100644 index f13d7e5..0000000 --- a/node_modules/yaml/dist/nodes/YAMLMap.d.ts +++ /dev/null @@ -1,43 +0,0 @@ -import type { BlockMap, FlowCollection } from '../parse/cst.js'; -import type { Schema } from '../schema/Schema.js'; -import type { StringifyContext } from '../stringify/stringify.js'; -import { Collection } from './Collection.js'; -import { ParsedNode, Range } from './Node.js'; -import { Pair } from './Pair.js'; -import type { ToJSContext } from './toJS.js'; -export declare function findPair<K = unknown, V = unknown>(items: Iterable<Pair<K, V>>, key: unknown): Pair<K, V> | undefined; -export declare namespace YAMLMap { - interface Parsed<K extends ParsedNode = ParsedNode, V extends ParsedNode | null = ParsedNode | null> extends YAMLMap<K, V> { - items: Pair<K, V>[]; - range: Range; - srcToken?: BlockMap | FlowCollection; - } -} -export declare class YAMLMap<K = unknown, V = unknown> extends Collection { - static get tagName(): 'tag:yaml.org,2002:map'; - items: Pair<K, V>[]; - constructor(schema?: Schema); - /** - * Adds a value to the collection. - * - * @param overwrite - If not set `true`, using a key that is already in the - * collection will throw. Otherwise, overwrites the previous value. - */ - add(pair: Pair<K, V> | { - key: K; - value: V; - }, overwrite?: boolean): void; - delete(key: K): boolean; - get(key: K, keepScalar?: boolean): unknown; - has(key: K): boolean; - set(key: K, value: V): void; - /** - * @param ctx - Conversion context, originally set in Document#toJS() - * @param {Class} Type - If set, forces the returned collection type - * @returns Instance of Type, Map, or Object - */ - toJSON<T = unknown>(_?: unknown, ctx?: ToJSContext, Type?: { - new (): T; - }): any; - toString(ctx?: StringifyContext, onComment?: () => void, onChompKeep?: () => void): string; -} diff --git a/node_modules/yaml/dist/nodes/YAMLMap.js b/node_modules/yaml/dist/nodes/YAMLMap.js deleted file mode 100644 index 9b4a990..0000000 --- a/node_modules/yaml/dist/nodes/YAMLMap.js +++ /dev/null @@ -1,120 +0,0 @@ -'use strict'; - -var stringifyCollection = require('../stringify/stringifyCollection.js'); -var addPairToJSMap = require('./addPairToJSMap.js'); -var Collection = require('./Collection.js'); -var Node = require('./Node.js'); -var Pair = require('./Pair.js'); -var Scalar = require('./Scalar.js'); - -function findPair(items, key) { - const k = Node.isScalar(key) ? key.value : key; - for (const it of items) { - if (Node.isPair(it)) { - if (it.key === key || it.key === k) - return it; - if (Node.isScalar(it.key) && it.key.value === k) - return it; - } - } - return undefined; -} -class YAMLMap extends Collection.Collection { - constructor(schema) { - super(Node.MAP, schema); - this.items = []; - } - static get tagName() { - return 'tag:yaml.org,2002:map'; - } - /** - * Adds a value to the collection. - * - * @param overwrite - If not set `true`, using a key that is already in the - * collection will throw. Otherwise, overwrites the previous value. - */ - add(pair, overwrite) { - var _a; - let _pair; - if (Node.isPair(pair)) - _pair = pair; - else if (!pair || typeof pair !== 'object' || !('key' in pair)) { - // In TypeScript, this never happens. - _pair = new Pair.Pair(pair, pair.value); - } - else - _pair = new Pair.Pair(pair.key, pair.value); - const prev = findPair(this.items, _pair.key); - const sortEntries = (_a = this.schema) === null || _a === void 0 ? void 0 : _a.sortMapEntries; - if (prev) { - if (!overwrite) - throw new Error(`Key ${_pair.key} already set`); - // For scalars, keep the old node & its comments and anchors - if (Node.isScalar(prev.value) && Scalar.isScalarValue(_pair.value)) - prev.value.value = _pair.value; - else - prev.value = _pair.value; - } - else if (sortEntries) { - const i = this.items.findIndex(item => sortEntries(_pair, item) < 0); - if (i === -1) - this.items.push(_pair); - else - this.items.splice(i, 0, _pair); - } - else { - this.items.push(_pair); - } - } - delete(key) { - const it = findPair(this.items, key); - if (!it) - return false; - const del = this.items.splice(this.items.indexOf(it), 1); - return del.length > 0; - } - get(key, keepScalar) { - const it = findPair(this.items, key); - const node = it === null || it === void 0 ? void 0 : it.value; - return !keepScalar && Node.isScalar(node) ? node.value : node; - } - has(key) { - return !!findPair(this.items, key); - } - set(key, value) { - this.add(new Pair.Pair(key, value), true); - } - /** - * @param ctx - Conversion context, originally set in Document#toJS() - * @param {Class} Type - If set, forces the returned collection type - * @returns Instance of Type, Map, or Object - */ - toJSON(_, ctx, Type) { - const map = Type ? new Type() : (ctx === null || ctx === void 0 ? void 0 : ctx.mapAsMap) ? new Map() : {}; - if (ctx === null || ctx === void 0 ? void 0 : ctx.onCreate) - ctx.onCreate(map); - for (const item of this.items) - addPairToJSMap.addPairToJSMap(ctx, map, item); - return map; - } - toString(ctx, onComment, onChompKeep) { - if (!ctx) - return JSON.stringify(this); - for (const item of this.items) { - if (!Node.isPair(item)) - throw new Error(`Map items must all be pairs; found ${JSON.stringify(item)} instead`); - } - if (!ctx.allNullValues && this.hasAllNullValues(false)) - ctx = Object.assign({}, ctx, { allNullValues: true }); - return stringifyCollection.stringifyCollection(this, ctx, { - blockItemPrefix: '', - flowChars: { start: '{', end: '}' }, - itemIndent: ctx.indent || '', - onChompKeep, - onComment - }); - } -} - -exports.YAMLMap = YAMLMap; -exports.findPair = findPair; diff --git a/node_modules/yaml/dist/nodes/YAMLSeq.d.ts b/node_modules/yaml/dist/nodes/YAMLSeq.d.ts deleted file mode 100644 index f892a97..0000000 --- a/node_modules/yaml/dist/nodes/YAMLSeq.d.ts +++ /dev/null @@ -1,55 +0,0 @@ -import type { BlockSequence, FlowCollection } from '../parse/cst.js'; -import type { Schema } from '../schema/Schema.js'; -import type { StringifyContext } from '../stringify/stringify.js'; -import { Collection } from './Collection.js'; -import { ParsedNode, Range } from './Node.js'; -import type { Pair } from './Pair.js'; -import { ToJSContext } from './toJS.js'; -export declare namespace YAMLSeq { - interface Parsed<T extends ParsedNode | Pair<ParsedNode, ParsedNode | null> = ParsedNode> extends YAMLSeq<T> { - items: T[]; - range: Range; - srcToken?: BlockSequence | FlowCollection; - } -} -export declare class YAMLSeq<T = unknown> extends Collection { - static get tagName(): 'tag:yaml.org,2002:seq'; - items: T[]; - constructor(schema?: Schema); - add(value: T): void; - /** - * Removes a value from the collection. - * - * `key` must contain a representation of an integer for this to succeed. - * It may be wrapped in a `Scalar`. - * - * @returns `true` if the item was found and removed. - */ - delete(key: unknown): boolean; - /** - * Returns item at `key`, or `undefined` if not found. By default unwraps - * scalar values from their surrounding node; to disable set `keepScalar` to - * `true` (collections are always returned intact). - * - * `key` must contain a representation of an integer for this to succeed. - * It may be wrapped in a `Scalar`. - */ - get(key: unknown, keepScalar?: boolean): unknown; - /** - * Checks if the collection includes a value with the key `key`. - * - * `key` must contain a representation of an integer for this to succeed. - * It may be wrapped in a `Scalar`. - */ - has(key: unknown): boolean; - /** - * Sets a value in this collection. For `!!set`, `value` needs to be a - * boolean to add/remove the item from the set. - * - * If `key` does not contain a representation of an integer, this will throw. - * It may be wrapped in a `Scalar`. - */ - set(key: unknown, value: T): void; - toJSON(_?: unknown, ctx?: ToJSContext): unknown[]; - toString(ctx?: StringifyContext, onComment?: () => void, onChompKeep?: () => void): string; -} diff --git a/node_modules/yaml/dist/nodes/YAMLSeq.js b/node_modules/yaml/dist/nodes/YAMLSeq.js deleted file mode 100644 index fe5451a..0000000 --- a/node_modules/yaml/dist/nodes/YAMLSeq.js +++ /dev/null @@ -1,107 +0,0 @@ -'use strict'; - -var stringifyCollection = require('../stringify/stringifyCollection.js'); -var Collection = require('./Collection.js'); -var Node = require('./Node.js'); -var Scalar = require('./Scalar.js'); -var toJS = require('./toJS.js'); - -class YAMLSeq extends Collection.Collection { - constructor(schema) { - super(Node.SEQ, schema); - this.items = []; - } - static get tagName() { - return 'tag:yaml.org,2002:seq'; - } - add(value) { - this.items.push(value); - } - /** - * Removes a value from the collection. - * - * `key` must contain a representation of an integer for this to succeed. - * It may be wrapped in a `Scalar`. - * - * @returns `true` if the item was found and removed. - */ - delete(key) { - const idx = asItemIndex(key); - if (typeof idx !== 'number') - return false; - const del = this.items.splice(idx, 1); - return del.length > 0; - } - /** - * Returns item at `key`, or `undefined` if not found. By default unwraps - * scalar values from their surrounding node; to disable set `keepScalar` to - * `true` (collections are always returned intact). - * - * `key` must contain a representation of an integer for this to succeed. - * It may be wrapped in a `Scalar`. - */ - get(key, keepScalar) { - const idx = asItemIndex(key); - if (typeof idx !== 'number') - return undefined; - const it = this.items[idx]; - return !keepScalar && Node.isScalar(it) ? it.value : it; - } - /** - * Checks if the collection includes a value with the key `key`. - * - * `key` must contain a representation of an integer for this to succeed. - * It may be wrapped in a `Scalar`. - */ - has(key) { - const idx = asItemIndex(key); - return typeof idx === 'number' && idx < this.items.length; - } - /** - * Sets a value in this collection. For `!!set`, `value` needs to be a - * boolean to add/remove the item from the set. - * - * If `key` does not contain a representation of an integer, this will throw. - * It may be wrapped in a `Scalar`. - */ - set(key, value) { - const idx = asItemIndex(key); - if (typeof idx !== 'number') - throw new Error(`Expected a valid index, not ${key}.`); - const prev = this.items[idx]; - if (Node.isScalar(prev) && Scalar.isScalarValue(value)) - prev.value = value; - else - this.items[idx] = value; - } - toJSON(_, ctx) { - const seq = []; - if (ctx === null || ctx === void 0 ? void 0 : ctx.onCreate) - ctx.onCreate(seq); - let i = 0; - for (const item of this.items) - seq.push(toJS.toJS(item, String(i++), ctx)); - return seq; - } - toString(ctx, onComment, onChompKeep) { - if (!ctx) - return JSON.stringify(this); - return stringifyCollection.stringifyCollection(this, ctx, { - blockItemPrefix: '- ', - flowChars: { start: '[', end: ']' }, - itemIndent: (ctx.indent || '') + ' ', - onChompKeep, - onComment - }); - } -} -function asItemIndex(key) { - let idx = Node.isScalar(key) ? key.value : key; - if (idx && typeof idx === 'string') - idx = Number(idx); - return typeof idx === 'number' && Number.isInteger(idx) && idx >= 0 - ? idx - : null; -} - -exports.YAMLSeq = YAMLSeq; diff --git a/node_modules/yaml/dist/nodes/addPairToJSMap.d.ts b/node_modules/yaml/dist/nodes/addPairToJSMap.d.ts deleted file mode 100644 index 5b0bb11..0000000 --- a/node_modules/yaml/dist/nodes/addPairToJSMap.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -import type { Pair } from './Pair.js'; -import { ToJSContext } from './toJS.js'; -export declare function addPairToJSMap(ctx: ToJSContext | undefined, map: Map<unknown, unknown> | Set<unknown> | Record<string | number | symbol, unknown>, { key, value }: Pair): Map<unknown, unknown> | Set<unknown> | Record<string | number | symbol, unknown>; diff --git a/node_modules/yaml/dist/nodes/addPairToJSMap.js b/node_modules/yaml/dist/nodes/addPairToJSMap.js deleted file mode 100644 index 5c0f755..0000000 --- a/node_modules/yaml/dist/nodes/addPairToJSMap.js +++ /dev/null @@ -1,106 +0,0 @@ -'use strict'; - -var log = require('../log.js'); -var stringify = require('../stringify/stringify.js'); -var Node = require('./Node.js'); -var Scalar = require('./Scalar.js'); -var toJS = require('./toJS.js'); - -const MERGE_KEY = '<<'; -function addPairToJSMap(ctx, map, { key, value }) { - if ((ctx === null || ctx === void 0 ? void 0 : ctx.doc.schema.merge) && isMergeKey(key)) { - value = Node.isAlias(value) ? value.resolve(ctx.doc) : value; - if (Node.isSeq(value)) - for (const it of value.items) - mergeToJSMap(ctx, map, it); - else if (Array.isArray(value)) - for (const it of value) - mergeToJSMap(ctx, map, it); - else - mergeToJSMap(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; -} -const isMergeKey = (key) => key === MERGE_KEY || - (Node.isScalar(key) && - key.value === MERGE_KEY && - (!key.type || key.type === Scalar.Scalar.PLAIN)); -// If the value associated with a merge key is a single mapping node, each of -// its key/value pairs is inserted into the current mapping, unless the key -// already exists in it. If the value associated with the merge key is a -// sequence, then this sequence is expected to contain mapping nodes and each -// of these nodes is merged in turn according to its order in the sequence. -// Keys in mapping nodes earlier in the sequence override keys specified in -// later mapping nodes. -- http://yaml.org/type/merge.html -function mergeToJSMap(ctx, map, value) { - const source = ctx && Node.isAlias(value) ? value.resolve(ctx.doc) : value; - if (!Node.isMap(source)) - throw new Error('Merge sources must be maps or map aliases'); - const srcMap = source.toJSON(null, ctx, Map); - for (const [key, value] of srcMap) { - if (map instanceof Map) { - if (!map.has(key)) - map.set(key, value); - } - else if (map instanceof Set) { - map.add(key); - } - else if (!Object.prototype.hasOwnProperty.call(map, key)) { - Object.defineProperty(map, key, { - value, - writable: true, - enumerable: true, - configurable: true - }); - } - } - return map; -} -function stringifyKey(key, jsKey, ctx) { - if (jsKey === null) - return ''; - if (typeof jsKey !== 'object') - return String(jsKey); - if (Node.isNode(key) && ctx && 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; diff --git a/node_modules/yaml/dist/nodes/toJS.d.ts b/node_modules/yaml/dist/nodes/toJS.d.ts deleted file mode 100644 index 85d794d..0000000 --- a/node_modules/yaml/dist/nodes/toJS.d.ts +++ /dev/null @@ -1,30 +0,0 @@ -import type { Document } from '../doc/Document.js'; -import type { stringify } from '../stringify/stringify.js'; -import { Node } from './Node.js'; -export interface AnchorData { - aliasCount: number; - count: number; - res: unknown; -} -export interface ToJSContext { - anchors: Map<Node, AnchorData>; - doc: Document; - keep: boolean; - mapAsMap: boolean; - mapKeyWarned: boolean; - maxAliasCount: number; - onCreate?: (res: unknown) => void; - /** Requiring this directly in Pair would create circular dependencies */ - stringify: typeof stringify; -} -/** - * Recursively convert any node or its contents to native JavaScript - * - * @param value - The input value - * @param arg - If `value` defines a `toJSON()` method, use this - * as its first argument - * @param ctx - Conversion context, originally set in Document#toJS(). If - * `{ keep: true }` is not set, output should be suitable for JSON - * stringification. - */ -export declare function toJS(value: any, arg: string | null, ctx?: ToJSContext): any; diff --git a/node_modules/yaml/dist/nodes/toJS.js b/node_modules/yaml/dist/nodes/toJS.js deleted file mode 100644 index b155e6c..0000000 --- a/node_modules/yaml/dist/nodes/toJS.js +++ /dev/null @@ -1,39 +0,0 @@ -'use strict'; - -var Node = require('./Node.js'); - -/** - * Recursively convert any node or its contents to native JavaScript - * - * @param value - The input value - * @param arg - If `value` defines a `toJSON()` method, use this - * as its first argument - * @param ctx - Conversion context, originally set in Document#toJS(). If - * `{ keep: true }` is not set, output should be suitable for JSON - * stringification. - */ -function toJS(value, arg, ctx) { - // eslint-disable-next-line @typescript-eslint/no-unsafe-return - if (Array.isArray(value)) - return value.map((v, i) => toJS(v, String(i), ctx)); - if (value && typeof value.toJSON === 'function') { - // eslint-disable-next-line @typescript-eslint/no-unsafe-call - if (!ctx || !Node.hasAnchor(value)) - return value.toJSON(arg, ctx); - const data = { aliasCount: 0, count: 1, res: undefined }; - ctx.anchors.set(value, data); - ctx.onCreate = res => { - data.res = res; - delete ctx.onCreate; - }; - const res = value.toJSON(arg, ctx); - if (ctx.onCreate) - ctx.onCreate(res); - return res; - } - if (typeof value === 'bigint' && !(ctx === null || ctx === void 0 ? void 0 : ctx.keep)) - return Number(value); - return value; -} - -exports.toJS = toJS; |