node_modules: upgrade

This commit is contained in:
Dawid Dziurla
2024-01-17 10:08:10 +01:00
parent 9ff0bc8d99
commit 00765f79cf
320 changed files with 31840 additions and 1039 deletions

View File

@@ -1,5 +1,7 @@
import { YAMLSeq } from '../../nodes/YAMLSeq.js';
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';
export declare class YAMLOMap extends YAMLSeq {
static tag: string;
@@ -21,5 +23,6 @@ export declare class YAMLOMap extends YAMLSeq {
* but TypeScript won't allow widening the signature of a child method.
*/
toJSON(_?: unknown, ctx?: ToJSContext): unknown[];
static from(schema: Schema, iterable: unknown, ctx: CreateNodeContext): YAMLOMap;
}
export declare const omap: CollectionTag;

View File

@@ -1,9 +1,9 @@
'use strict';
var YAMLSeq = require('../../nodes/YAMLSeq.js');
var identity = require('../../nodes/identity.js');
var toJS = require('../../nodes/toJS.js');
var Node = require('../../nodes/Node.js');
var YAMLMap = require('../../nodes/YAMLMap.js');
var YAMLSeq = require('../../nodes/YAMLSeq.js');
var pairs = require('./pairs.js');
class YAMLOMap extends YAMLSeq.YAMLSeq {
@@ -28,7 +28,7 @@ class YAMLOMap extends YAMLSeq.YAMLSeq {
ctx.onCreate(map);
for (const pair of this.items) {
let key, value;
if (Node.isPair(pair)) {
if (identity.isPair(pair)) {
key = toJS.toJS(pair.key, '', ctx);
value = toJS.toJS(pair.value, key, ctx);
}
@@ -41,6 +41,12 @@ class YAMLOMap extends YAMLSeq.YAMLSeq {
}
return map;
}
static from(schema, iterable, ctx) {
const pairs$1 = pairs.createPairs(schema, iterable, ctx);
const omap = new this();
omap.items = pairs$1.items;
return omap;
}
}
YAMLOMap.tag = 'tag:yaml.org,2002:omap';
const omap = {
@@ -53,7 +59,7 @@ const omap = {
const pairs$1 = pairs.resolvePairs(seq, onError);
const seenKeys = [];
for (const { key } of pairs$1.items) {
if (Node.isScalar(key)) {
if (identity.isScalar(key)) {
if (seenKeys.includes(key.value)) {
onError(`Ordered maps must not include duplicate keys: ${key.value}`);
}
@@ -64,12 +70,7 @@ const omap = {
}
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;
}
createNode: (schema, iterable, ctx) => YAMLOMap.from(schema, iterable, ctx)
};
exports.YAMLOMap = YAMLOMap;

View File

@@ -1,5 +1,5 @@
import type { CreateNodeContext } from '../../doc/createNode.js';
import { ParsedNode } from '../../nodes/Node.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';

View File

@@ -1,17 +1,17 @@
'use strict';
var Node = require('../../nodes/Node.js');
var identity = require('../../nodes/identity.js');
var Pair = require('../../nodes/Pair.js');
var Scalar = require('../../nodes/Scalar.js');
var YAMLSeq = require('../../nodes/YAMLSeq.js');
function resolvePairs(seq, onError) {
if (Node.isSeq(seq)) {
if (identity.isSeq(seq)) {
for (let i = 0; i < seq.items.length; ++i) {
let item = seq.items[i];
if (Node.isPair(item))
if (identity.isPair(item))
continue;
else if (Node.isMap(item)) {
else if (identity.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));
@@ -27,7 +27,7 @@ function resolvePairs(seq, onError) {
}
item = pair;
}
seq.items[i] = Node.isPair(item) ? item : new Pair.Pair(item);
seq.items[i] = identity.isPair(item) ? item : new Pair.Pair(item);
}
}
else
@@ -58,8 +58,9 @@ function createPairs(schema, iterable, ctx) {
key = keys[0];
value = it[key];
}
else
throw new TypeError(`Expected { key: value } tuple: ${it}`);
else {
throw new TypeError(`Expected tuple with one key, not ${keys.length} keys`);
}
}
else {
key = it;

View File

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

View File

@@ -1,9 +1,10 @@
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 { Schema } from '../../schema/Schema.js';
import type { StringifyContext } from '../../stringify/stringify.js';
import { CreateNodeContext } from '../../util.js';
import type { CollectionTag } from '../types.js';
export declare class YAMLSet<T = unknown> extends YAMLMap<T, Scalar<null> | null> {
static tag: string;
@@ -22,5 +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>;
}
export declare const set: CollectionTag;

View File

@@ -1,6 +1,6 @@
'use strict';
var Node = require('../../nodes/Node.js');
var identity = require('../../nodes/identity.js');
var Pair = require('../../nodes/Pair.js');
var YAMLMap = require('../../nodes/YAMLMap.js');
@@ -11,7 +11,7 @@ class YAMLSet extends YAMLMap.YAMLMap {
}
add(key) {
let pair;
if (Node.isPair(key))
if (identity.isPair(key))
pair = key;
else if (key &&
typeof key === 'object' &&
@@ -31,8 +31,8 @@ class YAMLSet extends YAMLMap.YAMLMap {
*/
get(key, keepPair) {
const pair = YAMLMap.findPair(this.items, key);
return !keepPair && Node.isPair(pair)
? Node.isScalar(pair.key)
return !keepPair && identity.isPair(pair)
? identity.isScalar(pair.key)
? pair.key.value
: pair.key
: pair;
@@ -59,28 +59,9 @@ class YAMLSet extends YAMLMap.YAMLMap {
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) {
static from(schema, iterable, ctx) {
const { replacer } = ctx;
const set = new YAMLSet(schema);
const set = new this(schema);
if (iterable && Symbol.iterator in Object(iterable))
for (let value of iterable) {
if (typeof replacer === 'function')
@@ -89,6 +70,26 @@ const set = {
}
return set;
}
}
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',
createNode: (schema, iterable, ctx) => YAMLSet.from(schema, iterable, ctx),
resolve(map, onError) {
if (identity.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;
}
};
exports.YAMLSet = YAMLSet;

View File

@@ -45,7 +45,7 @@ function stringifySexagesimal(node) {
}
return (sign +
parts
.map(n => (n < 10 ? '0' + String(n) : String(n)))
.map(n => String(n).padStart(2, '0'))
.join(':')
.replace(/000000\d*$/, '') // % 60 may introduce error
);