node_modules: upgrade

This commit is contained in:
Dawid Dziurla
2025-06-14 23:18:18 +02:00
parent 948e4a4fb8
commit de40b1f21f
268 changed files with 2150 additions and 3858 deletions

View File

@@ -1,11 +1,10 @@
import { MAP, SCALAR, SEQ } from '../nodes/identity.js';
import type { Pair } from '../nodes/Pair.js';
import type { SchemaOptions, ToStringOptions } from '../options.js';
import type { CollectionTag, ScalarTag } from './types.js';
import { MAP, SCALAR, SEQ } from '../nodes/identity';
import type { Pair } from '../nodes/Pair';
import type { SchemaOptions, ToStringOptions } from '../options';
import type { CollectionTag, ScalarTag } from './types';
export declare class Schema {
compat: Array<CollectionTag | ScalarTag> | null;
knownTags: Record<string, CollectionTag | ScalarTag>;
merge: boolean;
name: string;
sortMapEntries: ((a: Pair, b: Pair) => number) | null;
tags: Array<CollectionTag | ScalarTag>;

View File

@@ -14,10 +14,9 @@ class Schema {
: compat
? tags.getTags(null, compat)
: null;
this.merge = !!merge;
this.name = (typeof schema === 'string' && schema) || 'core';
this.knownTags = resolveKnownTags ? tags.coreKnownTags : {};
this.tags = tags.getTags(customTags, this.name);
this.tags = tags.getTags(customTags, this.name, merge);
this.toStringOptions = toStringDefaults ?? null;
Object.defineProperty(this, identity.MAP, { value: map.map });
Object.defineProperty(this, identity.SCALAR, { value: string.string });

View File

@@ -1,2 +1,2 @@
import type { CollectionTag } from '../types.js';
import type { CollectionTag } from '../types';
export declare const map: CollectionTag;

View File

@@ -1,4 +1,4 @@
import type { ScalarTag } from '../types.js';
import type { ScalarTag } from '../types';
export declare const nullTag: ScalarTag & {
test: RegExp;
};

View File

@@ -1,2 +1,2 @@
import type { CollectionTag } from '../types.js';
import type { CollectionTag } from '../types';
export declare const seq: CollectionTag;

View File

@@ -1,2 +1,2 @@
import type { ScalarTag } from '../types.js';
import type { ScalarTag } from '../types';
export declare const string: ScalarTag;

View File

@@ -1,4 +1,4 @@
import type { ScalarTag } from '../types.js';
import type { ScalarTag } from '../types';
export declare const boolTag: ScalarTag & {
test: RegExp;
};

View File

@@ -1,4 +1,4 @@
import type { ScalarTag } from '../types.js';
import type { ScalarTag } from '../types';
export declare const floatNaN: ScalarTag;
export declare const floatExp: ScalarTag;
export declare const float: ScalarTag;

View File

@@ -7,7 +7,7 @@ const floatNaN = {
identify: value => typeof value === 'number',
default: true,
tag: 'tag:yaml.org,2002:float',
test: /^(?:[-+]?\.(?:inf|Inf|INF|nan|NaN|NAN))$/,
test: /^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,
resolve: str => str.slice(-3).toLowerCase() === 'nan'
? NaN
: str[0] === '-'

View File

@@ -1,4 +1,4 @@
import type { ScalarTag } from '../types.js';
import type { ScalarTag } from '../types';
export declare const intOct: ScalarTag;
export declare const int: ScalarTag;
export declare const intHex: ScalarTag;

View File

@@ -1 +1 @@
export declare const schema: (import("../types.js").CollectionTag | import("../types.js").ScalarTag)[];
export declare const schema: (import('../types').CollectionTag | import('../types').ScalarTag)[];

View File

@@ -1,2 +1,2 @@
import { CollectionTag, ScalarTag } from '../types.js';
import type { CollectionTag, ScalarTag } from '../types';
export declare const schema: (CollectionTag | ScalarTag)[];

View File

@@ -29,7 +29,7 @@ const jsonScalars = [
identify: value => typeof value === 'boolean',
default: true,
tag: 'tag:yaml.org,2002:bool',
test: /^true|false$/,
test: /^true$|^false$/,
resolve: str => str === 'true',
stringify: stringifyJSON
},

View File

@@ -1,5 +1,5 @@
import { SchemaOptions } from '../options.js';
import type { CollectionTag, ScalarTag } from './types.js';
import type { SchemaOptions } from '../options';
import type { CollectionTag, ScalarTag } from './types';
declare const tagsByName: {
binary: ScalarTag;
bool: ScalarTag & {
@@ -14,6 +14,10 @@ declare const tagsByName: {
intOct: ScalarTag;
intTime: ScalarTag;
map: CollectionTag;
merge: ScalarTag & {
identify(value: unknown): boolean;
test: RegExp;
};
null: ScalarTag & {
test: RegExp;
};
@@ -29,6 +33,10 @@ export type TagId = keyof typeof tagsByName;
export type Tags = Array<ScalarTag | CollectionTag | TagId>;
export declare const coreKnownTags: {
'tag:yaml.org,2002:binary': ScalarTag;
'tag:yaml.org,2002:merge': ScalarTag & {
identify(value: unknown): boolean;
test: RegExp;
};
'tag:yaml.org,2002:omap': CollectionTag;
'tag:yaml.org,2002:pairs': CollectionTag;
'tag:yaml.org,2002:set': CollectionTag;
@@ -36,5 +44,5 @@ export declare const coreKnownTags: {
test: RegExp;
};
};
export declare function getTags(customTags: SchemaOptions['customTags'] | undefined, schemaName: string): (CollectionTag | ScalarTag)[];
export declare function getTags(customTags: SchemaOptions['customTags'] | undefined, schemaName: string, addMergeTag?: boolean): (CollectionTag | ScalarTag)[];
export {};

View File

@@ -10,6 +10,7 @@ var int = require('./core/int.js');
var schema = require('./core/schema.js');
var schema$1 = require('./json/schema.js');
var binary = require('./yaml-1.1/binary.js');
var merge = require('./yaml-1.1/merge.js');
var omap = require('./yaml-1.1/omap.js');
var pairs = require('./yaml-1.1/pairs.js');
var schema$2 = require('./yaml-1.1/schema.js');
@@ -35,6 +36,7 @@ const tagsByName = {
intOct: int.intOct,
intTime: timestamp.intTime,
map: map.map,
merge: merge.merge,
null: _null.nullTag,
omap: omap.omap,
pairs: pairs.pairs,
@@ -44,13 +46,20 @@ const tagsByName = {
};
const coreKnownTags = {
'tag:yaml.org,2002:binary': binary.binary,
'tag:yaml.org,2002:merge': merge.merge,
'tag:yaml.org,2002:omap': omap.omap,
'tag:yaml.org,2002:pairs': pairs.pairs,
'tag:yaml.org,2002:set': set.set,
'tag:yaml.org,2002:timestamp': timestamp.timestamp
};
function getTags(customTags, schemaName) {
let tags = schemas.get(schemaName);
function getTags(customTags, schemaName, addMergeTag) {
const schemaTags = schemas.get(schemaName);
if (schemaTags && !customTags) {
return addMergeTag && !schemaTags.includes(merge.merge)
? schemaTags.concat(merge.merge)
: schemaTags.slice();
}
let tags = schemaTags;
if (!tags) {
if (Array.isArray(customTags))
tags = [];
@@ -69,17 +78,21 @@ function getTags(customTags, schemaName) {
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}`);
});
if (addMergeTag)
tags = tags.concat(merge.merge);
return tags.reduce((tags, tag) => {
const tagObj = typeof tag === 'string' ? tagsByName[tag] : tag;
if (!tagObj) {
const tagName = JSON.stringify(tag);
const keys = Object.keys(tagsByName)
.map(key => JSON.stringify(key))
.join(', ');
throw new Error(`Unknown custom tag ${tagName}; use one of ${keys}`);
}
if (!tags.includes(tagObj))
tags.push(tagObj);
return tags;
}, []);
}
exports.coreKnownTags = coreKnownTags;

View File

@@ -1,22 +1,24 @@
import type { CreateNodeContext } from '../doc/createNode.js';
import type { Node } from '../nodes/Node.js';
import type { Scalar } from '../nodes/Scalar.js';
import type { YAMLMap } from '../nodes/YAMLMap.js';
import type { YAMLSeq } from '../nodes/YAMLSeq.js';
import type { ParseOptions } from '../options.js';
import type { StringifyContext } from '../stringify/stringify.js';
import type { Schema } from './Schema.js';
import type { CreateNodeContext } from '../doc/createNode';
import type { Node } from '../nodes/Node';
import type { Scalar } from '../nodes/Scalar';
import type { YAMLMap } from '../nodes/YAMLMap';
import type { YAMLSeq } from '../nodes/YAMLSeq';
import type { ParseOptions } from '../options';
import type { StringifyContext } from '../stringify/stringify';
import type { Schema } from './Schema';
interface TagBase {
/**
* An optional factory function, used e.g. by collections when wrapping JS objects as AST nodes.
*/
createNode?: (schema: Schema, value: unknown, ctx: CreateNodeContext) => Node;
/**
* If `true`, together with `test` allows for values to be stringified without
* an explicit tag. For most cases, it's unlikely that you'll actually want to
* use this, even if you first think you do.
* If `true`, allows for values to be stringified without
* an explicit tag together with `test`.
* If `'key'`, this only applies if the value is used as a mapping key.
* For most cases, it's unlikely that you'll actually want to use this,
* even if you first think you do.
*/
default?: boolean;
default?: boolean | 'key';
/**
* If a tag has multiple forms that should be parsed and/or stringified
* differently, use `format` to identify them.

View File

@@ -1,2 +1,2 @@
import type { ScalarTag } from '../types.js';
import type { ScalarTag } from '../types';
export declare const binary: ScalarTag;

View File

@@ -1,10 +1,11 @@
'use strict';
var node_buffer = require('buffer');
var Scalar = require('../../nodes/Scalar.js');
var stringifyString = require('../../stringify/stringifyString.js');
const binary = {
identify: value => value instanceof Uint8Array,
identify: value => value instanceof Uint8Array, // Buffer inherits from Uint8Array
default: false,
tag: 'tag:yaml.org,2002:binary',
/**
@@ -16,8 +17,8 @@ const binary = {
* document.querySelector('#photo').src = URL.createObjectURL(blob)
*/
resolve(src, onError) {
if (typeof Buffer === 'function') {
return Buffer.from(src, 'base64');
if (typeof node_buffer.Buffer === 'function') {
return node_buffer.Buffer.from(src, 'base64');
}
else if (typeof atob === 'function') {
// On IE 11, atob() can't handle newlines
@@ -33,13 +34,15 @@ const binary = {
}
},
stringify({ comment, type, value }, ctx, onComment, onChompKeep) {
if (!value)
return '';
const buf = value; // checked earlier by binary.identify()
let str;
if (typeof Buffer === 'function') {
if (typeof node_buffer.Buffer === 'function') {
str =
buf instanceof Buffer
buf instanceof node_buffer.Buffer
? buf.toString('base64')
: Buffer.from(buf.buffer).toString('base64');
: node_buffer.Buffer.from(buf.buffer).toString('base64');
}
else if (typeof btoa === 'function') {
let s = '';
@@ -50,8 +53,7 @@ const binary = {
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;
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);

View File

@@ -1,4 +1,4 @@
import type { ScalarTag } from '../types.js';
import type { ScalarTag } from '../types';
export declare const trueTag: ScalarTag & {
test: RegExp;
};

View File

@@ -20,7 +20,7 @@ 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,
test: /^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,
resolve: () => new Scalar.Scalar(false),
stringify: boolStringify
};

View File

@@ -1,4 +1,4 @@
import type { ScalarTag } from '../types.js';
import type { ScalarTag } from '../types';
export declare const floatNaN: ScalarTag;
export declare const floatExp: ScalarTag;
export declare const float: ScalarTag;

View File

@@ -7,7 +7,7 @@ const floatNaN = {
identify: value => typeof value === 'number',
default: true,
tag: 'tag:yaml.org,2002:float',
test: /^[-+]?\.(?:inf|Inf|INF|nan|NaN|NAN)$/,
test: /^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,
resolve: (str) => str.slice(-3).toLowerCase() === 'nan'
? NaN
: str[0] === '-'

View File

@@ -1,4 +1,4 @@
import type { ScalarTag } from '../types.js';
import type { ScalarTag } from '../types';
export declare const intBin: ScalarTag;
export declare const intOct: ScalarTag;
export declare const int: ScalarTag;

9
node_modules/yaml/dist/schema/yaml-1.1/merge.d.ts generated vendored Normal file
View File

@@ -0,0 +1,9 @@
import type { ToJSContext } from '../../nodes/toJS';
import type { MapLike } from '../../nodes/YAMLMap';
import type { ScalarTag } from '../types';
export declare const merge: ScalarTag & {
identify(value: unknown): boolean;
test: RegExp;
};
export declare const isMergeKey: (ctx: ToJSContext | undefined, key: unknown) => boolean | undefined;
export declare function addMergeToJSMap(ctx: ToJSContext | undefined, map: MapLike, value: unknown): void;

68
node_modules/yaml/dist/schema/yaml-1.1/merge.js generated vendored Normal file
View File

@@ -0,0 +1,68 @@
'use strict';
var identity = require('../../nodes/identity.js');
var Scalar = require('../../nodes/Scalar.js');
// 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
const MERGE_KEY = '<<';
const merge = {
identify: value => value === MERGE_KEY ||
(typeof value === 'symbol' && value.description === MERGE_KEY),
default: 'key',
tag: 'tag:yaml.org,2002:merge',
test: /^<<$/,
resolve: () => Object.assign(new Scalar.Scalar(Symbol(MERGE_KEY)), {
addToJSMap: addMergeToJSMap
}),
stringify: () => MERGE_KEY
};
const isMergeKey = (ctx, key) => (merge.identify(key) ||
(identity.isScalar(key) &&
(!key.type || key.type === Scalar.Scalar.PLAIN) &&
merge.identify(key.value))) &&
ctx?.doc.schema.tags.some(tag => tag.tag === merge.tag && tag.default);
function addMergeToJSMap(ctx, map, value) {
value = ctx && identity.isAlias(value) ? value.resolve(ctx.doc) : value;
if (identity.isSeq(value))
for (const it of value.items)
mergeValue(ctx, map, it);
else if (Array.isArray(value))
for (const it of value)
mergeValue(ctx, map, it);
else
mergeValue(ctx, map, value);
}
function mergeValue(ctx, map, value) {
const source = ctx && identity.isAlias(value) ? value.resolve(ctx.doc) : value;
if (!identity.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;
}
exports.addMergeToJSMap = addMergeToJSMap;
exports.isMergeKey = isMergeKey;
exports.merge = merge;

View File

@@ -1,23 +1,17 @@
import { ToJSContext } from '../../nodes/toJS.js';
import { YAMLSeq } from '../../nodes/YAMLSeq.js';
import { CreateNodeContext } from '../../util.js';
import type { Schema } from '../Schema.js';
import { CollectionTag } from '../types.js';
import type { ToJSContext } from '../../nodes/toJS';
import { YAMLMap } from '../../nodes/YAMLMap';
import { YAMLSeq } from '../../nodes/YAMLSeq';
import type { CreateNodeContext } from '../../util';
import type { Schema } from '../Schema';
import type { CollectionTag } from '../types';
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: unknown) => boolean;
get: {
(key: unknown, keepScalar: true): import("../../index.js").Scalar<any> | undefined;
(key: unknown, keepScalar?: false | undefined): any;
(key: unknown, keepScalar?: boolean | undefined): any;
};
has: (key: unknown) => boolean;
set: (key: any, value: any) => void;
add: typeof YAMLMap.prototype.add;
delete: typeof YAMLMap.prototype.delete;
get: typeof YAMLMap.prototype.get;
has: typeof YAMLMap.prototype.has;
set: typeof YAMLMap.prototype.set;
/**
* If `ctx` is given, the return type is actually `Map<unknown, unknown>`,
* but TypeScript won't allow widening the signature of a child method.

View File

@@ -1,10 +1,10 @@
import type { CreateNodeContext } from '../../doc/createNode.js';
import type { 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';
import type { CreateNodeContext } from '../../doc/createNode';
import type { ParsedNode } from '../../nodes/Node';
import { Pair } from '../../nodes/Pair';
import type { YAMLMap } from '../../nodes/YAMLMap';
import { YAMLSeq } from '../../nodes/YAMLSeq';
import type { Schema } from '../../schema/Schema';
import type { CollectionTag } from '../types';
export declare function resolvePairs(seq: YAMLSeq.Parsed<ParsedNode | Pair<ParsedNode, ParsedNode | null>> | YAMLMap.Parsed, onError: (message: string) => void): YAMLSeq.Parsed<Pair<ParsedNode, ParsedNode | null>>;
export declare function createPairs(schema: Schema, iterable: unknown, ctx: CreateNodeContext): YAMLSeq<unknown>;
export declare const pairs: CollectionTag;

View File

@@ -1 +1 @@
export declare const schema: (import("../types.js").CollectionTag | import("../types.js").ScalarTag)[];
export declare const schema: (import('../types').CollectionTag | import('../types').ScalarTag)[];

View File

@@ -8,6 +8,7 @@ var binary = require('./binary.js');
var bool = require('./bool.js');
var float = require('./float.js');
var int = require('./int.js');
var merge = require('./merge.js');
var omap = require('./omap.js');
var pairs = require('./pairs.js');
var set = require('./set.js');
@@ -28,6 +29,7 @@ const schema = [
float.floatExp,
float.float,
binary.binary,
merge.merge,
omap.omap,
pairs.pairs,
set.set,

View File

@@ -1,11 +1,11 @@
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 { Schema } from '../../schema/Schema.js';
import type { StringifyContext } from '../../stringify/stringify.js';
import { CreateNodeContext } from '../../util.js';
import type { CollectionTag } from '../types.js';
import { Pair } from '../../nodes/Pair';
import type { Scalar } from '../../nodes/Scalar';
import type { ToJSContext } from '../../nodes/toJS';
import { YAMLMap } from '../../nodes/YAMLMap';
import type { Schema } from '../../schema/Schema';
import type { StringifyContext } from '../../stringify/stringify';
import type { CreateNodeContext } from '../../util';
import type { CollectionTag } from '../types';
export declare class YAMLSet<T = unknown> extends YAMLMap<T, Scalar<null> | null> {
static tag: string;
constructor(schema?: Schema);
@@ -23,6 +23,6 @@ export declare class YAMLSet<T = unknown> extends YAMLMap<T, Scalar<null> | null
set(key: T, value: null): void;
toJSON(_?: unknown, ctx?: ToJSContext): any;
toString(ctx?: StringifyContext, onComment?: () => void, onChompKeep?: () => void): string;
static from(schema: Schema, iterable: unknown, ctx: CreateNodeContext): YAMLSet<unknown>;
static from(schema: Schema, iterable: unknown, ctx: CreateNodeContext): YAMLSet;
}
export declare const set: CollectionTag;

View File

@@ -1,4 +1,4 @@
import type { ScalarTag } from '../types.js';
import type { ScalarTag } from '../types';
export declare const intTime: ScalarTag;
export declare const floatTime: ScalarTag;
export declare const timestamp: ScalarTag & {

View File

@@ -97,7 +97,7 @@ const timestamp = {
}
return new Date(date);
},
stringify: ({ value }) => value.toISOString().replace(/((T00:00)?:00)?\.000Z$/, '')
stringify: ({ value }) => value?.toISOString().replace(/(T00:00:00)?\.000Z$/, '') ?? ''
};
exports.floatTime = floatTime;