Comparing version 2.1.3 to 2.2.0
@@ -21,2 +21,5 @@ import { stringifyCollection } from '../stringify/stringifyCollection.js'; | ||
class YAMLMap extends Collection { | ||
static get tagName() { | ||
return 'tag:yaml.org,2002:map'; | ||
} | ||
constructor(schema) { | ||
@@ -26,5 +29,2 @@ super(MAP, schema); | ||
} | ||
static get tagName() { | ||
return 'tag:yaml.org,2002:map'; | ||
} | ||
/** | ||
@@ -31,0 +31,0 @@ * Adds a value to the collection. |
@@ -8,2 +8,5 @@ import { stringifyCollection } from '../stringify/stringifyCollection.js'; | ||
class YAMLSeq extends Collection { | ||
static get tagName() { | ||
return 'tag:yaml.org,2002:seq'; | ||
} | ||
constructor(schema) { | ||
@@ -13,5 +16,2 @@ super(SEQ, schema); | ||
} | ||
static get tagName() { | ||
return 'tag:yaml.org,2002:seq'; | ||
} | ||
add(value) { | ||
@@ -18,0 +18,0 @@ this.items.push(value); |
@@ -16,2 +16,3 @@ import { anchorIsValid } from '../doc/anchors.js'; | ||
falseStr: 'false', | ||
flowCollectionPadding: true, | ||
indentSeq: true, | ||
@@ -40,2 +41,3 @@ lineWidth: 80, | ||
doc, | ||
flowCollectionPadding: opt.flowCollectionPadding ? ' ' : '', | ||
indent: '', | ||
@@ -42,0 +44,0 @@ indentStep: typeof opt.indent === 'number' ? ' '.repeat(opt.indent) : ' ', |
@@ -63,3 +63,3 @@ import { Collection } from '../nodes/Collection.js'; | ||
function stringifyFlowCollection({ comment, items }, ctx, { flowChars, itemIndent, onComment }) { | ||
const { indent, indentStep, options: { commentString } } = ctx; | ||
const { indent, indentStep, flowCollectionPadding: fcPadding, options: { commentString } } = ctx; | ||
itemIndent += indentStep; | ||
@@ -133,3 +133,3 @@ const itemCtx = Object.assign({}, ctx, { | ||
else { | ||
str = `${start} ${lines.join(' ')} ${end}`; | ||
str = `${start}${fcPadding}${lines.join(' ')}${fcPadding}${end}`; | ||
} | ||
@@ -136,0 +136,0 @@ } |
@@ -66,15 +66,14 @@ import { isCollection, isNode, isScalar, isSeq } from '../nodes/Node.js'; | ||
} | ||
let vcb = ''; | ||
let valueComment = null; | ||
let vsb, vcb, valueComment; | ||
if (isNode(value)) { | ||
if (value.spaceBefore) | ||
vcb = '\n'; | ||
if (value.commentBefore) { | ||
const cs = commentString(value.commentBefore); | ||
vcb += `\n${indentComment(cs, ctx.indent)}`; | ||
} | ||
vsb = !!value.spaceBefore; | ||
vcb = value.commentBefore; | ||
valueComment = value.comment; | ||
} | ||
else if (value && typeof value === 'object') { | ||
value = doc.createNode(value); | ||
else { | ||
vsb = false; | ||
vcb = null; | ||
valueComment = null; | ||
if (value && typeof value === 'object') | ||
value = doc.createNode(value); | ||
} | ||
@@ -94,3 +93,3 @@ ctx.implicitKey = false; | ||
// If indentSeq === false, consider '- ' as part of indentation where possible | ||
ctx.indent = ctx.indent.substr(2); | ||
ctx.indent = ctx.indent.substring(2); | ||
} | ||
@@ -100,15 +99,41 @@ let valueCommentDone = false; | ||
let ws = ' '; | ||
if (vcb || keyComment) { | ||
if (valueStr === '' && !ctx.inFlow) | ||
ws = vcb === '\n' ? '\n\n' : vcb; | ||
else | ||
ws = `${vcb}\n${ctx.indent}`; | ||
if (keyComment || vsb || vcb) { | ||
ws = vsb ? '\n' : ''; | ||
if (vcb) { | ||
const cs = commentString(vcb); | ||
ws += `\n${indentComment(cs, ctx.indent)}`; | ||
} | ||
if (valueStr === '' && !ctx.inFlow) { | ||
if (ws === '\n') | ||
ws = '\n\n'; | ||
} | ||
else { | ||
ws += `\n${ctx.indent}`; | ||
} | ||
} | ||
else if (!explicitKey && isCollection(value)) { | ||
const flow = valueStr[0] === '[' || valueStr[0] === '{'; | ||
if (!flow || valueStr.includes('\n')) | ||
ws = `\n${ctx.indent}`; | ||
const vs0 = valueStr[0]; | ||
const nl0 = valueStr.indexOf('\n'); | ||
const hasNewline = nl0 !== -1; | ||
const flow = ctx.inFlow ?? value.flow ?? value.items.length === 0; | ||
if (hasNewline || !flow) { | ||
let hasPropsLine = false; | ||
if (hasNewline && (vs0 === '&' || vs0 === '!')) { | ||
let sp0 = valueStr.indexOf(' '); | ||
if (vs0 === '&' && | ||
sp0 !== -1 && | ||
sp0 < nl0 && | ||
valueStr[sp0 + 1] === '!') { | ||
sp0 = valueStr.indexOf(' ', sp0 + 1); | ||
} | ||
if (sp0 === -1 || nl0 < sp0) | ||
hasPropsLine = true; | ||
} | ||
if (!hasPropsLine) | ||
ws = `\n${ctx.indent}`; | ||
} | ||
} | ||
else if (valueStr === '' || valueStr[0] === '\n') | ||
else if (valueStr === '' || valueStr[0] === '\n') { | ||
ws = ''; | ||
} | ||
str += ws + valueStr; | ||
@@ -115,0 +140,0 @@ if (ctx.inFlow) { |
@@ -24,5 +24,5 @@ import type { Directives } from '../doc/directives.js'; | ||
}; | ||
export declare type ComposeNode = typeof CN; | ||
export type ComposeNode = typeof CN; | ||
export declare function composeNode(ctx: ComposeContext, token: Token, props: Props, onError: ComposeErrorHandler): ParsedNode; | ||
export declare function composeEmptyNode(ctx: ComposeContext, offset: number, before: Token[] | undefined, pos: number | null, { spaceBefore, comment, anchor, tag, end }: Props, onError: ComposeErrorHandler): import("../index.js").Scalar.Parsed; | ||
export {}; |
@@ -7,7 +7,7 @@ import { Directives } from '../doc/directives.js'; | ||
import type { Token } from '../parse/cst.js'; | ||
declare type ErrorSource = number | [number, number] | Range | { | ||
type ErrorSource = number | [number, number] | Range | { | ||
offset: number; | ||
source?: string; | ||
}; | ||
export declare type ComposeErrorHandler = (source: ErrorSource, code: ErrorCode, message: string, warning?: boolean) => void; | ||
export type ComposeErrorHandler = (source: ErrorSource, code: ErrorCode, message: string, warning?: boolean) => void; | ||
/** | ||
@@ -14,0 +14,0 @@ * Compose a stream of CST nodes into a stream of YAML Documents. |
@@ -1,2 +0,2 @@ | ||
export declare type Reviver = (key: unknown, value: unknown) => unknown; | ||
export type Reviver = (key: unknown, value: unknown) => unknown; | ||
/** | ||
@@ -3,0 +3,0 @@ * Applies the JSON.parse reviver algorithm as defined in the ECMA-262 spec, |
@@ -11,3 +11,3 @@ import type { YAMLError, YAMLWarning } from '../errors.js'; | ||
import { Directives } from './directives.js'; | ||
export declare type Replacer = any[] | ((key: any, value: any) => unknown); | ||
export type Replacer = any[] | ((key: any, value: any) => unknown); | ||
export declare namespace Document { | ||
@@ -14,0 +14,0 @@ interface Parsed<T extends ParsedNode = ParsedNode> extends Document<T> { |
import type { LineCounter } from './parse/line-counter'; | ||
export declare type ErrorCode = 'ALIAS_PROPS' | 'BAD_ALIAS' | 'BAD_DIRECTIVE' | 'BAD_DQ_ESCAPE' | 'BAD_INDENT' | 'BAD_PROP_ORDER' | 'BAD_SCALAR_START' | 'BLOCK_AS_IMPLICIT_KEY' | 'BLOCK_IN_FLOW' | 'DUPLICATE_KEY' | 'IMPOSSIBLE' | 'KEY_OVER_1024_CHARS' | 'MISSING_CHAR' | 'MULTILINE_IMPLICIT_KEY' | 'MULTIPLE_ANCHORS' | 'MULTIPLE_DOCS' | 'MULTIPLE_TAGS' | 'TAB_AS_INDENT' | 'TAG_RESOLVE_FAILED' | 'UNEXPECTED_TOKEN'; | ||
export declare type LinePos = { | ||
export type ErrorCode = 'ALIAS_PROPS' | 'BAD_ALIAS' | 'BAD_DIRECTIVE' | 'BAD_DQ_ESCAPE' | 'BAD_INDENT' | 'BAD_PROP_ORDER' | 'BAD_SCALAR_START' | 'BLOCK_AS_IMPLICIT_KEY' | 'BLOCK_IN_FLOW' | 'DUPLICATE_KEY' | 'IMPOSSIBLE' | 'KEY_OVER_1024_CHARS' | 'MISSING_CHAR' | 'MULTILINE_IMPLICIT_KEY' | 'MULTIPLE_ANCHORS' | 'MULTIPLE_DOCS' | 'MULTIPLE_TAGS' | 'TAB_AS_INDENT' | 'TAG_RESOLVE_FAILED' | 'UNEXPECTED_TOKEN'; | ||
export type LinePos = { | ||
line: number; | ||
@@ -5,0 +5,0 @@ col: number; |
@@ -1,3 +0,3 @@ | ||
export declare type LogLevelId = 'silent' | 'error' | 'warn' | 'debug'; | ||
export type LogLevelId = 'silent' | 'error' | 'warn' | 'debug'; | ||
export declare function debug(logLevel: LogLevelId, ...messages: any[]): void; | ||
export declare function warn(logLevel: LogLevelId, warning: string | Error): void; |
@@ -9,5 +9,5 @@ import type { Document } from '../doc/Document.js'; | ||
import type { YAMLSeq } from './YAMLSeq.js'; | ||
export declare type Node<T = unknown> = Alias | Scalar<T> | YAMLMap<unknown, T> | YAMLSeq<T>; | ||
export type Node<T = unknown> = Alias | Scalar<T> | YAMLMap<unknown, T> | YAMLSeq<T>; | ||
/** Utility type mapper */ | ||
export declare type NodeType<T> = T extends string | number | bigint | boolean | null ? Scalar<T> : T extends Array<any> ? YAMLSeq<NodeType<T[number]>> : T extends { | ||
export type NodeType<T> = T extends string | number | bigint | boolean | null ? Scalar<T> : T extends Array<any> ? YAMLSeq<NodeType<T[number]>> : T extends { | ||
[key: string]: any; | ||
@@ -17,4 +17,4 @@ } ? YAMLMap<NodeType<keyof T>, NodeType<T[keyof T]>> : T extends { | ||
} ? YAMLMap<NodeType<keyof T>, NodeType<T[keyof T]>> : Node; | ||
export declare type ParsedNode = Alias.Parsed | Scalar.Parsed | YAMLMap.Parsed | YAMLSeq.Parsed; | ||
export declare type Range = [number, number, number]; | ||
export type ParsedNode = Alias.Parsed | Scalar.Parsed | YAMLMap.Parsed | YAMLSeq.Parsed; | ||
export type Range = [number, number, number]; | ||
export declare const ALIAS: unique symbol; | ||
@@ -21,0 +21,0 @@ export declare const DOC: unique symbol; |
@@ -9,3 +9,3 @@ import type { BlockMap, FlowCollection } from '../parse/cst.js'; | ||
import type { ToJSContext } from './toJS.js'; | ||
export declare type MapLike = Map<unknown, unknown> | Set<unknown> | Record<string | number | symbol, unknown>; | ||
export type MapLike = Map<unknown, unknown> | Set<unknown> | Record<string | number | symbol, unknown>; | ||
export declare function findPair<K = unknown, V = unknown>(items: Iterable<Pair<K, V>>, key: unknown): Pair<K, V> | undefined; | ||
@@ -12,0 +12,0 @@ export declare namespace YAMLMap { |
@@ -23,2 +23,5 @@ 'use strict'; | ||
class YAMLMap extends Collection.Collection { | ||
static get tagName() { | ||
return 'tag:yaml.org,2002:map'; | ||
} | ||
constructor(schema) { | ||
@@ -28,5 +31,2 @@ super(Node.MAP, schema); | ||
} | ||
static get tagName() { | ||
return 'tag:yaml.org,2002:map'; | ||
} | ||
/** | ||
@@ -33,0 +33,0 @@ * Adds a value to the collection. |
@@ -10,2 +10,5 @@ 'use strict'; | ||
class YAMLSeq extends Collection.Collection { | ||
static get tagName() { | ||
return 'tag:yaml.org,2002:seq'; | ||
} | ||
constructor(schema) { | ||
@@ -15,5 +18,2 @@ super(Node.SEQ, schema); | ||
} | ||
static get tagName() { | ||
return 'tag:yaml.org,2002:seq'; | ||
} | ||
add(value) { | ||
@@ -20,0 +20,0 @@ this.items.push(value); |
@@ -11,3 +11,3 @@ import type { Reviver } from './doc/applyReviver.js'; | ||
import type { CollectionTag, ScalarTag } from './schema/types.js'; | ||
export declare type ParseOptions = { | ||
export type ParseOptions = { | ||
/** | ||
@@ -60,3 +60,3 @@ * Whether integers should be parsed into BigInt rather than number values. | ||
}; | ||
export declare type DocumentOptions = { | ||
export type DocumentOptions = { | ||
/** | ||
@@ -81,3 +81,3 @@ * @internal | ||
}; | ||
export declare type SchemaOptions = { | ||
export type SchemaOptions = { | ||
/** | ||
@@ -139,3 +139,3 @@ * When parsing, warn about compatibility issues with the given schema. | ||
}; | ||
export declare type CreateNodeOptions = { | ||
export type CreateNodeOptions = { | ||
/** | ||
@@ -170,3 +170,3 @@ * During node construction, use anchors and aliases to keep strictly equal | ||
}; | ||
export declare type ToJSOptions = { | ||
export type ToJSOptions = { | ||
/** | ||
@@ -197,3 +197,3 @@ * Use Map rather than Object to represent mappings. | ||
}; | ||
export declare type ToStringOptions = { | ||
export type ToStringOptions = { | ||
/** | ||
@@ -274,2 +274,9 @@ * Use block quote styles for scalar values where applicable. | ||
/** | ||
* When true, a single space of padding will be added inside the delimiters | ||
* of non-empty single-line flow collections. | ||
* | ||
* Default: `true` | ||
*/ | ||
flowCollectionPadding?: boolean; | ||
/** | ||
* The number of spaces to use when indenting code. | ||
@@ -276,0 +283,0 @@ * |
import type { CollectionItem, Document } from './cst.js'; | ||
export declare type VisitPath = readonly ['key' | 'value', number][]; | ||
export declare type Visitor = (item: CollectionItem, path: VisitPath) => number | symbol | Visitor | void; | ||
export type VisitPath = readonly ['key' | 'value', number][]; | ||
export type Visitor = (item: CollectionItem, path: VisitPath) => number | symbol | Visitor | void; | ||
/** | ||
@@ -5,0 +5,0 @@ * Apply a visitor to a CST document or item. |
@@ -75,3 +75,3 @@ export { createScalarToken, resolveAsScalar, setScalarValue } from './cst-scalar.js'; | ||
} | ||
export declare type CollectionItem = { | ||
export type CollectionItem = { | ||
start: SourceToken[]; | ||
@@ -90,4 +90,4 @@ key?: Token | null; | ||
} | ||
export declare type Token = SourceToken | ErrorToken | Directive | Document | DocumentEnd | FlowScalar | BlockScalar | BlockMap | BlockSequence | FlowCollection; | ||
export declare type TokenType = SourceToken['type'] | DocumentEnd['type'] | FlowScalar['type']; | ||
export type Token = SourceToken | ErrorToken | Directive | Document | DocumentEnd | FlowScalar | BlockScalar | BlockMap | BlockSequence | FlowCollection; | ||
export type TokenType = SourceToken['type'] | DocumentEnd['type'] | FlowScalar['type']; | ||
/** The byte order mark */ | ||
@@ -94,0 +94,0 @@ export declare const BOM = "\uFEFF"; |
@@ -1,3 +0,3 @@ | ||
declare type JsonSchema = boolean | ArraySchema | ObjectSchema | NumberSchema | StringSchema; | ||
declare type JsonType = 'array' | 'object' | 'string' | 'number' | 'integer' | 'boolean' | 'null'; | ||
type JsonSchema = boolean | ArraySchema | ObjectSchema | NumberSchema | StringSchema; | ||
type JsonType = 'array' | 'object' | 'string' | 'number' | 'integer' | 'boolean' | 'null'; | ||
interface CommonSchema { | ||
@@ -4,0 +4,0 @@ type?: JsonType | JsonType[]; |
@@ -28,4 +28,4 @@ import { SchemaOptions } from '../options.js'; | ||
}; | ||
export declare type TagId = keyof typeof tagsByName; | ||
export declare type Tags = Array<ScalarTag | CollectionTag | TagId>; | ||
export type TagId = keyof typeof tagsByName; | ||
export type Tags = Array<ScalarTag | CollectionTag | TagId>; | ||
export declare const coreKnownTags: { | ||
@@ -32,0 +32,0 @@ 'tag:yaml.org,2002:binary': ScalarTag; |
@@ -19,3 +19,3 @@ import type { CreateNodeContext } from '../doc/createNode.js'; | ||
*/ | ||
default: boolean; | ||
default?: boolean; | ||
/** | ||
@@ -22,0 +22,0 @@ * If a tag has multiple forms that should be parsed and/or stringified |
@@ -8,3 +8,3 @@ export declare const FOLD_FLOW = "flow"; | ||
*/ | ||
export declare type FoldMode = 'flow' | 'block' | 'quoted'; | ||
export type FoldMode = 'flow' | 'block' | 'quoted'; | ||
export interface FoldOptions { | ||
@@ -11,0 +11,0 @@ /** |
import type { Document } from '../doc/Document.js'; | ||
import type { Alias } from '../nodes/Alias.js'; | ||
import type { ToStringOptions } from '../options.js'; | ||
export declare type StringifyContext = { | ||
export type StringifyContext = { | ||
actualString?: boolean; | ||
@@ -16,2 +16,3 @@ allNullValues?: boolean; | ||
inStringifyKey?: boolean; | ||
flowCollectionPadding: string; | ||
options: Readonly<Required<Omit<ToStringOptions, 'collectionStyle' | 'indent'>>>; | ||
@@ -18,0 +19,0 @@ resolvedAliases?: Set<Alias>; |
@@ -18,2 +18,3 @@ 'use strict'; | ||
falseStr: 'false', | ||
flowCollectionPadding: true, | ||
indentSeq: true, | ||
@@ -42,2 +43,3 @@ lineWidth: 80, | ||
doc, | ||
flowCollectionPadding: opt.flowCollectionPadding ? ' ' : '', | ||
indent: '', | ||
@@ -44,0 +46,0 @@ indentStep: typeof opt.indent === 'number' ? ' '.repeat(opt.indent) : ' ', |
@@ -65,3 +65,3 @@ 'use strict'; | ||
function stringifyFlowCollection({ comment, items }, ctx, { flowChars, itemIndent, onComment }) { | ||
const { indent, indentStep, options: { commentString } } = ctx; | ||
const { indent, indentStep, flowCollectionPadding: fcPadding, options: { commentString } } = ctx; | ||
itemIndent += indentStep; | ||
@@ -135,3 +135,3 @@ const itemCtx = Object.assign({}, ctx, { | ||
else { | ||
str = `${start} ${lines.join(' ')} ${end}`; | ||
str = `${start}${fcPadding}${lines.join(' ')}${fcPadding}${end}`; | ||
} | ||
@@ -138,0 +138,0 @@ } |
@@ -68,15 +68,14 @@ 'use strict'; | ||
} | ||
let vcb = ''; | ||
let valueComment = null; | ||
let vsb, vcb, valueComment; | ||
if (Node.isNode(value)) { | ||
if (value.spaceBefore) | ||
vcb = '\n'; | ||
if (value.commentBefore) { | ||
const cs = commentString(value.commentBefore); | ||
vcb += `\n${stringifyComment.indentComment(cs, ctx.indent)}`; | ||
} | ||
vsb = !!value.spaceBefore; | ||
vcb = value.commentBefore; | ||
valueComment = value.comment; | ||
} | ||
else if (value && typeof value === 'object') { | ||
value = doc.createNode(value); | ||
else { | ||
vsb = false; | ||
vcb = null; | ||
valueComment = null; | ||
if (value && typeof value === 'object') | ||
value = doc.createNode(value); | ||
} | ||
@@ -96,3 +95,3 @@ ctx.implicitKey = false; | ||
// If indentSeq === false, consider '- ' as part of indentation where possible | ||
ctx.indent = ctx.indent.substr(2); | ||
ctx.indent = ctx.indent.substring(2); | ||
} | ||
@@ -102,15 +101,41 @@ let valueCommentDone = false; | ||
let ws = ' '; | ||
if (vcb || keyComment) { | ||
if (valueStr === '' && !ctx.inFlow) | ||
ws = vcb === '\n' ? '\n\n' : vcb; | ||
else | ||
ws = `${vcb}\n${ctx.indent}`; | ||
if (keyComment || vsb || vcb) { | ||
ws = vsb ? '\n' : ''; | ||
if (vcb) { | ||
const cs = commentString(vcb); | ||
ws += `\n${stringifyComment.indentComment(cs, ctx.indent)}`; | ||
} | ||
if (valueStr === '' && !ctx.inFlow) { | ||
if (ws === '\n') | ||
ws = '\n\n'; | ||
} | ||
else { | ||
ws += `\n${ctx.indent}`; | ||
} | ||
} | ||
else if (!explicitKey && Node.isCollection(value)) { | ||
const flow = valueStr[0] === '[' || valueStr[0] === '{'; | ||
if (!flow || valueStr.includes('\n')) | ||
ws = `\n${ctx.indent}`; | ||
const vs0 = valueStr[0]; | ||
const nl0 = valueStr.indexOf('\n'); | ||
const hasNewline = nl0 !== -1; | ||
const flow = ctx.inFlow ?? value.flow ?? value.items.length === 0; | ||
if (hasNewline || !flow) { | ||
let hasPropsLine = false; | ||
if (hasNewline && (vs0 === '&' || vs0 === '!')) { | ||
let sp0 = valueStr.indexOf(' '); | ||
if (vs0 === '&' && | ||
sp0 !== -1 && | ||
sp0 < nl0 && | ||
valueStr[sp0 + 1] === '!') { | ||
sp0 = valueStr.indexOf(' ', sp0 + 1); | ||
} | ||
if (sp0 === -1 || nl0 < sp0) | ||
hasPropsLine = true; | ||
} | ||
if (!hasPropsLine) | ||
ws = `\n${ctx.indent}`; | ||
} | ||
} | ||
else if (valueStr === '' || valueStr[0] === '\n') | ||
else if (valueStr === '' || valueStr[0] === '\n') { | ||
ws = ''; | ||
} | ||
str += ws + valueStr; | ||
@@ -117,0 +142,0 @@ if (ctx.inFlow) { |
import { Scalar } from '../nodes/Scalar.js'; | ||
import type { StringifyContext } from './stringify.js'; | ||
export declare function stringifyString(item: Scalar, ctx: StringifyContext, onComment?: () => void, onChompKeep?: () => void): string; | ||
interface StringifyScalar { | ||
value: string; | ||
comment?: string | null; | ||
type?: string; | ||
} | ||
export declare function stringifyString(item: Scalar | StringifyScalar, ctx: StringifyContext, onComment?: () => void, onChompKeep?: () => void): string; | ||
export {}; |
@@ -8,4 +8,4 @@ import type { Document } from './doc/Document.js'; | ||
import type { YAMLSeq } from './nodes/YAMLSeq.js'; | ||
export declare type visitorFn<T> = (key: number | 'key' | 'value' | null, node: T, path: readonly (Document | Node | Pair)[]) => void | symbol | number | Node | Pair; | ||
export declare type visitor = visitorFn<unknown> | { | ||
export type visitorFn<T> = (key: number | 'key' | 'value' | null, node: T, path: readonly (Document | Node | Pair)[]) => void | symbol | number | Node | Pair; | ||
export type visitor = visitorFn<unknown> | { | ||
Alias?: visitorFn<Alias>; | ||
@@ -20,4 +20,4 @@ Collection?: visitorFn<YAMLMap | YAMLSeq>; | ||
}; | ||
export declare type asyncVisitorFn<T> = (key: number | 'key' | 'value' | null, node: T, path: readonly (Document | Node | Pair)[]) => void | symbol | number | Node | Pair | Promise<void | symbol | number | Node | Pair>; | ||
export declare type asyncVisitor = asyncVisitorFn<unknown> | { | ||
export type asyncVisitorFn<T> = (key: number | 'key' | 'value' | null, node: T, path: readonly (Document | Node | Pair)[]) => void | symbol | number | Node | Pair | Promise<void | symbol | number | Node | Pair>; | ||
export type asyncVisitor = asyncVisitorFn<unknown> | { | ||
Alias?: asyncVisitorFn<Alias>; | ||
@@ -24,0 +24,0 @@ Collection?: asyncVisitorFn<YAMLMap | YAMLSeq>; |
{ | ||
"name": "yaml", | ||
"version": "2.1.3", | ||
"version": "2.2.0", | ||
"license": "ISC", | ||
@@ -40,4 +40,4 @@ "author": "Eemeli Aro <eemeli@gmail.com>", | ||
"build": "npm run build:node && npm run build:browser", | ||
"build:browser": "rollup -c config/rollup.browser-config.js", | ||
"build:node": "rollup -c config/rollup.node-config.js", | ||
"build:browser": "rollup -c config/rollup.browser-config.mjs", | ||
"build:node": "rollup -c config/rollup.node-config.mjs", | ||
"clean": "git clean -fdxe node_modules", | ||
@@ -73,7 +73,7 @@ "lint": "eslint src/", | ||
"@babel/preset-env": "^7.12.11", | ||
"@rollup/plugin-babel": "^5.2.3", | ||
"@rollup/plugin-replace": "^4.0.0", | ||
"@rollup/plugin-typescript": "^8.1.1", | ||
"@types/jest": "^28.1.8", | ||
"@types/node": "^12.20.47", | ||
"@rollup/plugin-babel": "^6.0.3", | ||
"@rollup/plugin-replace": "^5.0.2", | ||
"@rollup/plugin-typescript": "^10.0.1", | ||
"@types/jest": "^29.2.4", | ||
"@types/node": "^14.18.35", | ||
"@typescript-eslint/eslint-plugin": "^5.3.1", | ||
@@ -89,3 +89,3 @@ "@typescript-eslint/parser": "^5.3.1", | ||
"prettier": "^2.2.1", | ||
"rollup": "^2.38.2", | ||
"rollup": "^3.7.5", | ||
"tslib": "^2.1.0", | ||
@@ -92,0 +92,0 @@ "typescript": "^4.3.5" |
651110
17407