Comparing version 2.3.4 to 2.4.0
@@ -192,15 +192,15 @@ import { Scalar } from '../nodes/Scalar.js'; | ||
const escapeCodes = { | ||
'0': '\0', | ||
a: '\x07', | ||
b: '\b', | ||
e: '\x1b', | ||
f: '\f', | ||
n: '\n', | ||
r: '\r', | ||
t: '\t', | ||
v: '\v', | ||
N: '\u0085', | ||
_: '\u00a0', | ||
L: '\u2028', | ||
P: '\u2029', | ||
'0': '\0', // null character | ||
a: '\x07', // bell character | ||
b: '\b', // backspace | ||
e: '\x1b', // escape character | ||
f: '\f', // form feed | ||
n: '\n', // line feed | ||
r: '\r', // carriage return | ||
t: '\t', // horizontal tab | ||
v: '\v', // vertical tab | ||
N: '\u0085', // Unicode next line | ||
_: '\u00a0', // Unicode non-breaking space | ||
L: '\u2028', // Unicode line separator | ||
P: '\u2029', // Unicode paragraph separator | ||
' ': ' ', | ||
@@ -207,0 +207,0 @@ '"': '"', |
@@ -5,3 +5,3 @@ import { Scalar } from '../../nodes/Scalar.js'; | ||
const binary = { | ||
identify: value => value instanceof Uint8Array, | ||
identify: value => value instanceof Uint8Array, // Buffer inherits from Uint8Array | ||
default: false, | ||
@@ -8,0 +8,0 @@ tag: 'tag:yaml.org,2002:binary', |
@@ -1,2 +0,1 @@ | ||
import { Collection } from '../nodes/Collection.js'; | ||
import { isNode, isPair } from '../nodes/identity.js'; | ||
@@ -123,3 +122,3 @@ import { stringify } from './stringify.js'; | ||
const len = lines.reduce((sum, line) => sum + line.length + 2, 2); | ||
reqNewline = len > Collection.maxFlowStringSingleLineLength; | ||
reqNewline = ctx.options.lineWidth > 0 && len > ctx.options.lineWidth; | ||
} | ||
@@ -126,0 +125,0 @@ if (reqNewline) { |
@@ -194,15 +194,15 @@ 'use strict'; | ||
const escapeCodes = { | ||
'0': '\0', | ||
a: '\x07', | ||
b: '\b', | ||
e: '\x1b', | ||
f: '\f', | ||
n: '\n', | ||
r: '\r', | ||
t: '\t', | ||
v: '\v', | ||
N: '\u0085', | ||
_: '\u00a0', | ||
L: '\u2028', | ||
P: '\u2029', | ||
'0': '\0', // null character | ||
a: '\x07', // bell character | ||
b: '\b', // backspace | ||
e: '\x1b', // escape character | ||
f: '\f', // form feed | ||
n: '\n', // line feed | ||
r: '\r', // carriage return | ||
t: '\t', // horizontal tab | ||
v: '\v', // vertical tab | ||
N: '\u0085', // Unicode next line | ||
_: '\u00a0', // Unicode non-breaking space | ||
L: '\u2028', // Unicode line separator | ||
P: '\u2029', // Unicode paragraph separator | ||
' ': ' ', | ||
@@ -209,0 +209,0 @@ '"': '"', |
@@ -8,3 +8,3 @@ import { CreateNodeContext } from '../doc/createNode.js'; | ||
import type { ToJSContext } from './toJS.js'; | ||
export declare function createPair(key: unknown, value: unknown, ctx: CreateNodeContext): Pair<import("./Node.js").Node, import("./YAMLMap.js").YAMLMap<unknown, unknown> | import("./Scalar.js").Scalar<unknown> | import("./Alias.js").Alias | import("./YAMLSeq.js").YAMLSeq<unknown>>; | ||
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> { | ||
@@ -11,0 +11,0 @@ readonly [NODE_TYPE]: symbol; |
@@ -102,3 +102,3 @@ export { createScalarToken, resolveAsScalar, setScalarValue } from './cst-scalar.js'; | ||
/** @returns `true` if `token` is a flow or block scalar; not an alias */ | ||
export declare const isScalar: (token: Token | null | undefined) => token is BlockScalar | FlowScalar; | ||
export declare const isScalar: (token: Token | null | undefined) => token is FlowScalar | BlockScalar; | ||
/** Get a printable representation of a lexer token */ | ||
@@ -105,0 +105,0 @@ export declare function prettyToken(token: string): string; |
@@ -7,3 +7,3 @@ 'use strict'; | ||
const binary = { | ||
identify: value => value instanceof Uint8Array, | ||
identify: value => value instanceof Uint8Array, // Buffer inherits from Uint8Array | ||
default: false, | ||
@@ -10,0 +10,0 @@ tag: 'tag:yaml.org,2002:binary', |
'use strict'; | ||
var Collection = require('../nodes/Collection.js'); | ||
var identity = require('../nodes/identity.js'); | ||
@@ -125,3 +124,3 @@ var stringify = require('./stringify.js'); | ||
const len = lines.reduce((sum, line) => sum + line.length + 2, 2); | ||
reqNewline = len > Collection.Collection.maxFlowStringSingleLineLength; | ||
reqNewline = ctx.options.lineWidth > 0 && len > ctx.options.lineWidth; | ||
} | ||
@@ -128,0 +127,0 @@ if (reqNewline) { |
{ | ||
"name": "yaml", | ||
"version": "2.3.4", | ||
"version": "2.4.0", | ||
"license": "ISC", | ||
@@ -21,2 +21,3 @@ "author": "Eemeli Aro <eemeli@gmail.com>", | ||
"main": "./dist/index.js", | ||
"bin": "./bin.mjs", | ||
"browser": { | ||
@@ -56,3 +57,5 @@ "./dist/index.js": "./browser/index.js", | ||
"docs:install": "cd docs-slate && bundle install", | ||
"predocs:deploy": "node docs/prepare-docs.mjs", | ||
"docs:deploy": "cd docs-slate && ./deploy.sh", | ||
"predocs": "node docs/prepare-docs.mjs", | ||
"docs": "cd docs-slate && bundle exec middleman server", | ||
@@ -71,4 +74,4 @@ "preversion": "npm test && npm run build", | ||
"@babel/core": "^7.12.10", | ||
"@babel/plugin-proposal-class-properties": "^7.12.1", | ||
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.12.1", | ||
"@babel/plugin-transform-class-properties": "^7.23.3", | ||
"@babel/plugin-transform-nullish-coalescing-operator": "^7.23.4", | ||
"@babel/plugin-transform-typescript": "^7.12.17", | ||
@@ -80,5 +83,5 @@ "@babel/preset-env": "^7.12.11", | ||
"@types/jest": "^29.2.4", | ||
"@types/node": "^14.18.35", | ||
"@typescript-eslint/eslint-plugin": "^6.4.1", | ||
"@typescript-eslint/parser": "^6.4.1", | ||
"@types/node": "^20.11.20", | ||
"@typescript-eslint/eslint-plugin": "^7.0.2", | ||
"@typescript-eslint/parser": "^7.0.2", | ||
"babel-jest": "^29.0.1", | ||
@@ -92,3 +95,3 @@ "cross-env": "^7.0.3", | ||
"prettier": "^3.0.2", | ||
"rollup": "^3.7.5", | ||
"rollup": "^4.12.0", | ||
"tslib": "^2.1.0", | ||
@@ -95,0 +98,0 @@ "typescript": "^5.0.3" |
@@ -36,2 +36,4 @@ # YAML <a href="https://www.npmjs.com/package/yaml"><img align="right" src="https://badge.fury.io/js/yaml.svg" title="npm package" /></a> | ||
A [command-line tool](https://eemeli.org/yaml/#command-line-tool) is also included. | ||
```js | ||
@@ -59,3 +61,3 @@ import { parse, stringify } from 'yaml' | ||
- [`#warnings`](https://eemeli.org/yaml/#errors) | ||
- [`isDocument(foo): boolean`](https://eemeli.org/yaml/#identifying-nodes) | ||
- [`isDocument(foo): boolean`](https://eemeli.org/yaml/#identifying-node-types) | ||
- [`parseAllDocuments(str, options?): Document[]`](https://eemeli.org/yaml/#parsing-documents) | ||
@@ -66,9 +68,9 @@ - [`parseDocument(str, options?): Document`](https://eemeli.org/yaml/#parsing-documents) | ||
- [`isAlias(foo): boolean`](https://eemeli.org/yaml/#identifying-nodes) | ||
- [`isCollection(foo): boolean`](https://eemeli.org/yaml/#identifying-nodes) | ||
- [`isMap(foo): boolean`](https://eemeli.org/yaml/#identifying-nodes) | ||
- [`isNode(foo): boolean`](https://eemeli.org/yaml/#identifying-nodes) | ||
- [`isPair(foo): boolean`](https://eemeli.org/yaml/#identifying-nodes) | ||
- [`isScalar(foo): boolean`](https://eemeli.org/yaml/#identifying-nodes) | ||
- [`isSeq(foo): boolean`](https://eemeli.org/yaml/#identifying-nodes) | ||
- [`isAlias(foo): boolean`](https://eemeli.org/yaml/#identifying-node-types) | ||
- [`isCollection(foo): boolean`](https://eemeli.org/yaml/#identifying-node-types) | ||
- [`isMap(foo): boolean`](https://eemeli.org/yaml/#identifying-node-types) | ||
- [`isNode(foo): boolean`](https://eemeli.org/yaml/#identifying-node-types) | ||
- [`isPair(foo): boolean`](https://eemeli.org/yaml/#identifying-node-types) | ||
- [`isScalar(foo): boolean`](https://eemeli.org/yaml/#identifying-node-types) | ||
- [`isSeq(foo): boolean`](https://eemeli.org/yaml/#identifying-node-types) | ||
- [`new Scalar(value)`](https://eemeli.org/yaml/#scalar-values) | ||
@@ -80,3 +82,3 @@ - [`new YAMLMap()`](https://eemeli.org/yaml/#collections) | ||
- [`doc.createPair(key, value): Pair`](https://eemeli.org/yaml/#creating-nodes) | ||
- [`visit(node, visitor)`](https://eemeli.org/yaml/#modifying-nodes) | ||
- [`visit(node, visitor)`](https://eemeli.org/yaml/#finding-and-modifying-nodes) | ||
@@ -83,0 +85,0 @@ ### Parsing YAML |
670405
231
17715
150