@specship/specship-win32-arm64 0.13.0 → 0.13.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/dist/server/cli.js +1 -1
- package/lib/dist/server/routes/sse.js +1 -1
- package/lib/dist/server/server.js +1 -1
- package/lib/node_modules/.package-lock.json +11 -20
- package/lib/node_modules/ajv/node_modules/fast-uri/index.js +1 -1
- package/lib/node_modules/ajv/node_modules/fast-uri/package.json +1 -1
- package/lib/node_modules/ajv/node_modules/fast-uri/test/security.test.js +28 -0
- package/lib/node_modules/toad-cache/README.md +10 -9
- package/lib/node_modules/toad-cache/dist/toad-cache.cjs +139 -139
- package/lib/node_modules/toad-cache/dist/toad-cache.mjs +136 -140
- package/lib/node_modules/toad-cache/package.json +8 -8
- package/lib/node_modules/toad-cache/toad-cache.d.cts +20 -14
- package/lib/node_modules/toad-cache/toad-cache.d.ts +18 -14
- package/lib/node_modules/yaml/README.md +14 -31
- package/lib/node_modules/yaml/browser/dist/compose/compose-collection.js +3 -3
- package/lib/node_modules/yaml/browser/dist/compose/compose-doc.js +0 -1
- package/lib/node_modules/yaml/browser/dist/compose/compose-node.js +4 -21
- package/lib/node_modules/yaml/browser/dist/compose/compose-scalar.js +8 -14
- package/lib/node_modules/yaml/browser/dist/compose/composer.js +2 -4
- package/lib/node_modules/yaml/browser/dist/compose/resolve-block-map.js +0 -2
- package/lib/node_modules/yaml/browser/dist/compose/resolve-block-seq.js +1 -3
- package/lib/node_modules/yaml/browser/dist/compose/resolve-flow-collection.js +2 -8
- package/lib/node_modules/yaml/browser/dist/compose/resolve-flow-scalar.js +4 -6
- package/lib/node_modules/yaml/browser/dist/compose/resolve-props.js +5 -3
- package/lib/node_modules/yaml/browser/dist/compose/util-empty-scalar-position.js +2 -1
- package/lib/node_modules/yaml/browser/dist/compose/util-map-includes.js +5 -1
- package/lib/node_modules/yaml/browser/dist/doc/Document.js +2 -3
- package/lib/node_modules/yaml/browser/dist/doc/anchors.js +2 -1
- package/lib/node_modules/yaml/browser/dist/doc/applyReviver.js +0 -1
- package/lib/node_modules/yaml/browser/dist/doc/createNode.js +2 -1
- package/lib/node_modules/yaml/browser/dist/errors.js +1 -1
- package/lib/node_modules/yaml/browser/dist/log.js +6 -1
- package/lib/node_modules/yaml/browser/dist/node_modules/tslib/tslib.es6.js +21 -0
- package/lib/node_modules/yaml/browser/dist/nodes/Alias.js +12 -27
- package/lib/node_modules/yaml/browser/dist/nodes/YAMLMap.js +1 -1
- package/lib/node_modules/yaml/browser/dist/nodes/addPairToJSMap.js +49 -8
- package/lib/node_modules/yaml/browser/dist/parse/lexer.js +24 -28
- package/lib/node_modules/yaml/browser/dist/parse/parser.js +8 -31
- package/lib/node_modules/yaml/browser/dist/public-api.js +0 -3
- package/lib/node_modules/yaml/browser/dist/schema/Schema.js +2 -1
- package/lib/node_modules/yaml/browser/dist/schema/json/schema.js +1 -1
- package/lib/node_modules/yaml/browser/dist/schema/tags.js +16 -29
- package/lib/node_modules/yaml/browser/dist/schema/yaml-1.1/binary.js +13 -5
- package/lib/node_modules/yaml/browser/dist/schema/yaml-1.1/pairs.js +1 -1
- package/lib/node_modules/yaml/browser/dist/schema/yaml-1.1/schema.js +0 -2
- package/lib/node_modules/yaml/browser/dist/schema/yaml-1.1/timestamp.js +1 -1
- package/lib/node_modules/yaml/browser/dist/stringify/stringify.js +5 -10
- package/lib/node_modules/yaml/browser/dist/stringify/stringifyCollection.js +3 -13
- package/lib/node_modules/yaml/browser/dist/stringify/stringifyNumber.js +2 -3
- package/lib/node_modules/yaml/browser/dist/stringify/stringifyPair.js +1 -1
- package/lib/node_modules/yaml/browser/dist/stringify/stringifyString.js +16 -24
- package/lib/node_modules/yaml/browser/dist/util.js +1 -1
- package/lib/node_modules/yaml/dist/cli.d.ts +1 -1
- package/lib/node_modules/yaml/dist/cli.mjs +3 -5
- package/lib/node_modules/yaml/dist/compose/compose-collection.d.ts +4 -4
- package/lib/node_modules/yaml/dist/compose/compose-collection.js +3 -3
- package/lib/node_modules/yaml/dist/compose/compose-doc.d.ts +6 -6
- package/lib/node_modules/yaml/dist/compose/compose-doc.js +0 -1
- package/lib/node_modules/yaml/dist/compose/compose-node.d.ts +7 -8
- package/lib/node_modules/yaml/dist/compose/compose-node.js +4 -21
- package/lib/node_modules/yaml/dist/compose/compose-scalar.d.ts +4 -4
- package/lib/node_modules/yaml/dist/compose/compose-scalar.js +7 -13
- package/lib/node_modules/yaml/dist/compose/composer.d.ts +6 -7
- package/lib/node_modules/yaml/dist/compose/composer.js +3 -6
- package/lib/node_modules/yaml/dist/compose/resolve-block-map.d.ts +5 -5
- package/lib/node_modules/yaml/dist/compose/resolve-block-map.js +0 -2
- package/lib/node_modules/yaml/dist/compose/resolve-block-scalar.d.ts +5 -5
- package/lib/node_modules/yaml/dist/compose/resolve-block-seq.d.ts +5 -5
- package/lib/node_modules/yaml/dist/compose/resolve-block-seq.js +1 -3
- package/lib/node_modules/yaml/dist/compose/resolve-end.d.ts +2 -2
- package/lib/node_modules/yaml/dist/compose/resolve-flow-collection.d.ts +7 -7
- package/lib/node_modules/yaml/dist/compose/resolve-flow-collection.js +2 -8
- package/lib/node_modules/yaml/dist/compose/resolve-flow-scalar.d.ts +4 -4
- package/lib/node_modules/yaml/dist/compose/resolve-flow-scalar.js +4 -6
- package/lib/node_modules/yaml/dist/compose/resolve-props.d.ts +2 -2
- package/lib/node_modules/yaml/dist/compose/resolve-props.js +5 -3
- package/lib/node_modules/yaml/dist/compose/util-contains-newline.d.ts +1 -1
- package/lib/node_modules/yaml/dist/compose/util-empty-scalar-position.d.ts +1 -1
- package/lib/node_modules/yaml/dist/compose/util-empty-scalar-position.js +2 -1
- package/lib/node_modules/yaml/dist/compose/util-flow-indent-check.d.ts +2 -2
- package/lib/node_modules/yaml/dist/compose/util-map-includes.d.ts +3 -3
- package/lib/node_modules/yaml/dist/compose/util-map-includes.js +5 -1
- package/lib/node_modules/yaml/dist/doc/Document.d.ts +11 -11
- package/lib/node_modules/yaml/dist/doc/Document.js +2 -3
- package/lib/node_modules/yaml/dist/doc/anchors.d.ts +2 -2
- package/lib/node_modules/yaml/dist/doc/anchors.js +2 -1
- package/lib/node_modules/yaml/dist/doc/applyReviver.js +0 -1
- package/lib/node_modules/yaml/dist/doc/createNode.d.ts +4 -4
- package/lib/node_modules/yaml/dist/doc/createNode.js +2 -1
- package/lib/node_modules/yaml/dist/doc/directives.d.ts +1 -1
- package/lib/node_modules/yaml/dist/errors.d.ts +1 -1
- package/lib/node_modules/yaml/dist/errors.js +1 -1
- package/lib/node_modules/yaml/dist/index.d.ts +18 -21
- package/lib/node_modules/yaml/dist/log.js +4 -4
- package/lib/node_modules/yaml/dist/nodes/Alias.d.ts +9 -10
- package/lib/node_modules/yaml/dist/nodes/Alias.js +11 -26
- package/lib/node_modules/yaml/dist/nodes/Collection.d.ts +4 -4
- package/lib/node_modules/yaml/dist/nodes/Node.d.ts +9 -16
- package/lib/node_modules/yaml/dist/nodes/Pair.d.ts +8 -9
- package/lib/node_modules/yaml/dist/nodes/Scalar.d.ts +4 -9
- package/lib/node_modules/yaml/dist/nodes/YAMLMap.d.ts +10 -10
- package/lib/node_modules/yaml/dist/nodes/YAMLSeq.d.ts +10 -10
- package/lib/node_modules/yaml/dist/nodes/addPairToJSMap.d.ts +3 -3
- package/lib/node_modules/yaml/dist/nodes/addPairToJSMap.js +48 -7
- package/lib/node_modules/yaml/dist/nodes/identity.d.ts +7 -7
- package/lib/node_modules/yaml/dist/nodes/toJS.d.ts +2 -4
- package/lib/node_modules/yaml/dist/options.d.ts +10 -22
- package/lib/node_modules/yaml/dist/parse/cst-scalar.d.ts +4 -4
- package/lib/node_modules/yaml/dist/parse/cst-stringify.d.ts +1 -1
- package/lib/node_modules/yaml/dist/parse/cst-visit.d.ts +2 -2
- package/lib/node_modules/yaml/dist/parse/cst.d.ts +3 -4
- package/lib/node_modules/yaml/dist/parse/lexer.d.ts +1 -1
- package/lib/node_modules/yaml/dist/parse/lexer.js +24 -28
- package/lib/node_modules/yaml/dist/parse/parser.d.ts +4 -4
- package/lib/node_modules/yaml/dist/parse/parser.js +9 -33
- package/lib/node_modules/yaml/dist/public-api.d.ts +5 -6
- package/lib/node_modules/yaml/dist/public-api.js +0 -3
- package/lib/node_modules/yaml/dist/schema/Schema.d.ts +5 -4
- package/lib/node_modules/yaml/dist/schema/Schema.js +2 -1
- package/lib/node_modules/yaml/dist/schema/common/map.d.ts +1 -1
- package/lib/node_modules/yaml/dist/schema/common/null.d.ts +1 -1
- package/lib/node_modules/yaml/dist/schema/common/seq.d.ts +1 -1
- package/lib/node_modules/yaml/dist/schema/common/string.d.ts +1 -1
- package/lib/node_modules/yaml/dist/schema/core/bool.d.ts +1 -1
- package/lib/node_modules/yaml/dist/schema/core/float.d.ts +1 -1
- package/lib/node_modules/yaml/dist/schema/core/int.d.ts +1 -1
- package/lib/node_modules/yaml/dist/schema/core/schema.d.ts +1 -1
- package/lib/node_modules/yaml/dist/schema/json/schema.d.ts +1 -1
- package/lib/node_modules/yaml/dist/schema/json/schema.js +1 -1
- package/lib/node_modules/yaml/dist/schema/tags.d.ts +3 -11
- package/lib/node_modules/yaml/dist/schema/tags.js +13 -26
- package/lib/node_modules/yaml/dist/schema/types.d.ts +12 -14
- package/lib/node_modules/yaml/dist/schema/yaml-1.1/binary.d.ts +1 -1
- package/lib/node_modules/yaml/dist/schema/yaml-1.1/binary.js +7 -9
- package/lib/node_modules/yaml/dist/schema/yaml-1.1/bool.d.ts +1 -1
- package/lib/node_modules/yaml/dist/schema/yaml-1.1/float.d.ts +1 -1
- package/lib/node_modules/yaml/dist/schema/yaml-1.1/int.d.ts +1 -1
- package/lib/node_modules/yaml/dist/schema/yaml-1.1/omap.d.ts +17 -11
- package/lib/node_modules/yaml/dist/schema/yaml-1.1/pairs.d.ts +7 -7
- package/lib/node_modules/yaml/dist/schema/yaml-1.1/schema.d.ts +1 -1
- package/lib/node_modules/yaml/dist/schema/yaml-1.1/schema.js +0 -2
- package/lib/node_modules/yaml/dist/schema/yaml-1.1/set.d.ts +9 -9
- package/lib/node_modules/yaml/dist/schema/yaml-1.1/timestamp.d.ts +1 -1
- package/lib/node_modules/yaml/dist/schema/yaml-1.1/timestamp.js +1 -1
- package/lib/node_modules/yaml/dist/stringify/stringify.d.ts +3 -3
- package/lib/node_modules/yaml/dist/stringify/stringify.js +5 -10
- package/lib/node_modules/yaml/dist/stringify/stringifyCollection.d.ts +2 -2
- package/lib/node_modules/yaml/dist/stringify/stringifyCollection.js +3 -13
- package/lib/node_modules/yaml/dist/stringify/stringifyDocument.d.ts +3 -3
- package/lib/node_modules/yaml/dist/stringify/stringifyNumber.d.ts +1 -1
- package/lib/node_modules/yaml/dist/stringify/stringifyNumber.js +2 -3
- package/lib/node_modules/yaml/dist/stringify/stringifyPair.d.ts +2 -2
- package/lib/node_modules/yaml/dist/stringify/stringifyPair.js +1 -1
- package/lib/node_modules/yaml/dist/stringify/stringifyString.d.ts +2 -2
- package/lib/node_modules/yaml/dist/stringify/stringifyString.js +15 -23
- package/lib/node_modules/yaml/dist/util.d.ts +12 -16
- package/lib/node_modules/yaml/dist/util.js +2 -2
- package/lib/node_modules/yaml/dist/visit.d.ts +7 -7
- package/lib/node_modules/yaml/package.json +14 -13
- package/lib/package.json +5 -6
- package/package.json +1 -1
- package/lib/node_modules/jsonc-parser/CHANGELOG.md +0 -76
- package/lib/node_modules/jsonc-parser/LICENSE.md +0 -21
- package/lib/node_modules/jsonc-parser/README.md +0 -364
- package/lib/node_modules/jsonc-parser/SECURITY.md +0 -41
- package/lib/node_modules/jsonc-parser/lib/esm/impl/edit.js +0 -185
- package/lib/node_modules/jsonc-parser/lib/esm/impl/format.js +0 -261
- package/lib/node_modules/jsonc-parser/lib/esm/impl/parser.js +0 -659
- package/lib/node_modules/jsonc-parser/lib/esm/impl/scanner.js +0 -443
- package/lib/node_modules/jsonc-parser/lib/esm/impl/string-intern.js +0 -29
- package/lib/node_modules/jsonc-parser/lib/esm/main.d.ts +0 -351
- package/lib/node_modules/jsonc-parser/lib/esm/main.js +0 -178
- package/lib/node_modules/jsonc-parser/lib/umd/impl/edit.js +0 -201
- package/lib/node_modules/jsonc-parser/lib/umd/impl/format.js +0 -275
- package/lib/node_modules/jsonc-parser/lib/umd/impl/parser.js +0 -682
- package/lib/node_modules/jsonc-parser/lib/umd/impl/scanner.js +0 -456
- package/lib/node_modules/jsonc-parser/lib/umd/impl/string-intern.js +0 -42
- package/lib/node_modules/jsonc-parser/lib/umd/main.d.ts +0 -351
- package/lib/node_modules/jsonc-parser/lib/umd/main.js +0 -194
- package/lib/node_modules/jsonc-parser/package.json +0 -37
- package/lib/node_modules/yaml/browser/dist/schema/yaml-1.1/merge.js +0 -67
- package/lib/node_modules/yaml/dist/schema/yaml-1.1/merge.d.ts +0 -9
- package/lib/node_modules/yaml/dist/schema/yaml-1.1/merge.js +0 -71
|
@@ -41,7 +41,8 @@ function createNodeAnchors(doc, prefix) {
|
|
|
41
41
|
return {
|
|
42
42
|
onAnchor: (source) => {
|
|
43
43
|
aliasObjects.push(source);
|
|
44
|
-
|
|
44
|
+
if (!prevAnchors)
|
|
45
|
+
prevAnchors = anchorNames(doc);
|
|
45
46
|
const anchor = findNewAnchor(prefix, prevAnchors);
|
|
46
47
|
prevAnchors.add(anchor);
|
|
47
48
|
return anchor;
|
|
@@ -13,7 +13,6 @@ function applyReviver(reviver, obj, key, val) {
|
|
|
13
13
|
for (let i = 0, len = val.length; i < len; ++i) {
|
|
14
14
|
const v0 = val[i];
|
|
15
15
|
const v1 = applyReviver(reviver, val, String(i), v0);
|
|
16
|
-
// eslint-disable-next-line @typescript-eslint/no-array-delete
|
|
17
16
|
if (v1 === undefined)
|
|
18
17
|
delete val[i];
|
|
19
18
|
else if (v1 !== v0)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { Node } from '../nodes/Node';
|
|
2
|
-
import type { Schema } from '../schema/Schema';
|
|
3
|
-
import type { CollectionTag, ScalarTag } from '../schema/types';
|
|
4
|
-
import type { Replacer } from './Document';
|
|
1
|
+
import type { Node } from '../nodes/Node.js';
|
|
2
|
+
import type { Schema } from '../schema/Schema.js';
|
|
3
|
+
import type { CollectionTag, ScalarTag } from '../schema/types.js';
|
|
4
|
+
import type { Replacer } from './Document.js';
|
|
5
5
|
export interface CreateNodeContext {
|
|
6
6
|
aliasDuplicateObjects: boolean;
|
|
7
7
|
keepUndefined: boolean;
|
|
@@ -40,7 +40,8 @@ function createNode(value, tagName, ctx) {
|
|
|
40
40
|
if (aliasDuplicateObjects && value && typeof value === 'object') {
|
|
41
41
|
ref = sourceObjects.get(value);
|
|
42
42
|
if (ref) {
|
|
43
|
-
|
|
43
|
+
if (!ref.anchor)
|
|
44
|
+
ref.anchor = onAnchor(value);
|
|
44
45
|
return new Alias.Alias(ref.anchor);
|
|
45
46
|
}
|
|
46
47
|
else {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { LineCounter } from './parse/line-counter';
|
|
2
|
-
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' | '
|
|
2
|
+
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' | 'BAD_COLLECTION_TYPE';
|
|
3
3
|
export type LinePos = {
|
|
4
4
|
line: number;
|
|
5
5
|
col: number;
|
|
@@ -48,7 +48,7 @@ const prettifyError = (src, lc) => (error) => {
|
|
|
48
48
|
if (/[^ ]/.test(lineStr)) {
|
|
49
49
|
let count = 1;
|
|
50
50
|
const end = error.linePos[1];
|
|
51
|
-
if (end
|
|
51
|
+
if (end && end.line === line && end.col > col) {
|
|
52
52
|
count = Math.max(1, Math.min(end.col - col, 80 - ci));
|
|
53
53
|
}
|
|
54
54
|
const pointer = ' '.repeat(ci) + '^'.repeat(count);
|
|
@@ -1,25 +1,22 @@
|
|
|
1
|
-
export { Composer } from './compose/composer';
|
|
2
|
-
export { Document } from './doc/Document';
|
|
3
|
-
export { Schema } from './schema/Schema';
|
|
4
|
-
export
|
|
5
|
-
export {
|
|
6
|
-
export {
|
|
7
|
-
export {
|
|
8
|
-
export
|
|
9
|
-
export {
|
|
10
|
-
export {
|
|
11
|
-
export {
|
|
12
|
-
export {
|
|
13
|
-
export
|
|
14
|
-
export
|
|
15
|
-
export {
|
|
16
|
-
export {
|
|
17
|
-
export {
|
|
18
|
-
export type { EmptyStream } from './public-api';
|
|
19
|
-
export { parse, parseAllDocuments, parseDocument, stringify } from './public-api';
|
|
1
|
+
export { Composer } from './compose/composer.js';
|
|
2
|
+
export { Document } from './doc/Document.js';
|
|
3
|
+
export { Schema } from './schema/Schema.js';
|
|
4
|
+
export { ErrorCode, YAMLError, YAMLParseError, YAMLWarning } from './errors.js';
|
|
5
|
+
export { Alias } from './nodes/Alias.js';
|
|
6
|
+
export { isAlias, isCollection, isDocument, isMap, isNode, isPair, isScalar, isSeq } from './nodes/identity.js';
|
|
7
|
+
export { Node, ParsedNode, Range } from './nodes/Node.js';
|
|
8
|
+
export { Pair } from './nodes/Pair.js';
|
|
9
|
+
export { Scalar } from './nodes/Scalar.js';
|
|
10
|
+
export { YAMLMap } from './nodes/YAMLMap.js';
|
|
11
|
+
export { YAMLSeq } from './nodes/YAMLSeq.js';
|
|
12
|
+
export type { CreateNodeOptions, DocumentOptions, ParseOptions, SchemaOptions, ToJSOptions, ToStringOptions } from './options.js';
|
|
13
|
+
export * as CST from './parse/cst.js';
|
|
14
|
+
export { Lexer } from './parse/lexer.js';
|
|
15
|
+
export { LineCounter } from './parse/line-counter.js';
|
|
16
|
+
export { Parser } from './parse/parser.js';
|
|
17
|
+
export { EmptyStream, parse, parseAllDocuments, parseDocument, stringify } from './public-api.js';
|
|
20
18
|
export type { TagId, Tags } from './schema/tags';
|
|
21
19
|
export type { CollectionTag, ScalarTag } from './schema/types';
|
|
22
20
|
export type { YAMLOMap } from './schema/yaml-1.1/omap';
|
|
23
21
|
export type { YAMLSet } from './schema/yaml-1.1/set';
|
|
24
|
-
export
|
|
25
|
-
export { visit, visitAsync } from './visit';
|
|
22
|
+
export { asyncVisitor, asyncVisitorFn, visit, visitAsync, visitor, visitorFn } from './visit.js';
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var node_process = require('process');
|
|
4
|
-
|
|
5
3
|
function debug(logLevel, ...messages) {
|
|
6
4
|
if (logLevel === 'debug')
|
|
7
5
|
console.log(...messages);
|
|
8
6
|
}
|
|
9
7
|
function warn(logLevel, warning) {
|
|
10
8
|
if (logLevel === 'debug' || logLevel === 'warn') {
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
// https://github.com/typescript-eslint/typescript-eslint/issues/7478
|
|
10
|
+
// eslint-disable-next-line @typescript-eslint/prefer-optional-chain
|
|
11
|
+
if (typeof process !== 'undefined' && process.emitWarning)
|
|
12
|
+
process.emitWarning(warning);
|
|
13
13
|
else
|
|
14
14
|
console.warn(warning);
|
|
15
15
|
}
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import type { Document } from '../doc/Document';
|
|
2
|
-
import type { FlowScalar } from '../parse/cst';
|
|
3
|
-
import type { StringifyContext } from '../stringify/stringify';
|
|
4
|
-
import
|
|
5
|
-
import { NodeBase } from './Node';
|
|
1
|
+
import type { Document } from '../doc/Document.js';
|
|
2
|
+
import type { FlowScalar } from '../parse/cst.js';
|
|
3
|
+
import type { StringifyContext } from '../stringify/stringify.js';
|
|
4
|
+
import { NodeBase, Range } from './Node.js';
|
|
6
5
|
import type { Scalar } from './Scalar';
|
|
7
|
-
import
|
|
8
|
-
import type { YAMLMap } from './YAMLMap';
|
|
9
|
-
import type { YAMLSeq } from './YAMLSeq';
|
|
6
|
+
import { ToJSContext } from './toJS.js';
|
|
7
|
+
import type { YAMLMap } from './YAMLMap.js';
|
|
8
|
+
import type { YAMLSeq } from './YAMLSeq.js';
|
|
10
9
|
export declare namespace Alias {
|
|
11
10
|
interface Parsed extends Alias {
|
|
12
11
|
range: Range;
|
|
@@ -23,7 +22,7 @@ export declare class Alias extends NodeBase {
|
|
|
23
22
|
* Resolve the value of this alias within `doc`, finding the last
|
|
24
23
|
* instance of the `source` anchor before this node.
|
|
25
24
|
*/
|
|
26
|
-
resolve(doc: Document
|
|
27
|
-
toJSON(_arg?: unknown, ctx?: ToJSContext):
|
|
25
|
+
resolve(doc: Document): Scalar | YAMLMap | YAMLSeq | undefined;
|
|
26
|
+
toJSON(_arg?: unknown, ctx?: ToJSContext): {} | null;
|
|
28
27
|
toString(ctx?: StringifyContext, _onComment?: () => void, _onChompKeep?: () => void): string;
|
|
29
28
|
}
|
|
@@ -20,38 +20,23 @@ class Alias extends Node.NodeBase {
|
|
|
20
20
|
* Resolve the value of this alias within `doc`, finding the last
|
|
21
21
|
* instance of the `source` anchor before this node.
|
|
22
22
|
*/
|
|
23
|
-
resolve(doc
|
|
24
|
-
if (ctx?.maxAliasCount === 0)
|
|
25
|
-
throw new ReferenceError('Alias resolution is disabled');
|
|
26
|
-
let nodes;
|
|
27
|
-
if (ctx?.aliasResolveCache) {
|
|
28
|
-
nodes = ctx.aliasResolveCache;
|
|
29
|
-
}
|
|
30
|
-
else {
|
|
31
|
-
nodes = [];
|
|
32
|
-
visit.visit(doc, {
|
|
33
|
-
Node: (_key, node) => {
|
|
34
|
-
if (identity.isAlias(node) || identity.hasAnchor(node))
|
|
35
|
-
nodes.push(node);
|
|
36
|
-
}
|
|
37
|
-
});
|
|
38
|
-
if (ctx)
|
|
39
|
-
ctx.aliasResolveCache = nodes;
|
|
40
|
-
}
|
|
23
|
+
resolve(doc) {
|
|
41
24
|
let found = undefined;
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
25
|
+
visit.visit(doc, {
|
|
26
|
+
Node: (_key, node) => {
|
|
27
|
+
if (node === this)
|
|
28
|
+
return visit.visit.BREAK;
|
|
29
|
+
if (node.anchor === this.source)
|
|
30
|
+
found = node;
|
|
31
|
+
}
|
|
32
|
+
});
|
|
48
33
|
return found;
|
|
49
34
|
}
|
|
50
35
|
toJSON(_arg, ctx) {
|
|
51
36
|
if (!ctx)
|
|
52
37
|
return { source: this.source };
|
|
53
38
|
const { anchors, doc, maxAliasCount } = ctx;
|
|
54
|
-
const source = this.resolve(doc
|
|
39
|
+
const source = this.resolve(doc);
|
|
55
40
|
if (!source) {
|
|
56
41
|
const msg = `Unresolved alias (the anchor must be set before the alias): ${this.source}`;
|
|
57
42
|
throw new ReferenceError(msg);
|
|
@@ -63,7 +48,7 @@ class Alias extends Node.NodeBase {
|
|
|
63
48
|
data = anchors.get(source);
|
|
64
49
|
}
|
|
65
50
|
/* istanbul ignore if */
|
|
66
|
-
if (data
|
|
51
|
+
if (!data || data.res === undefined) {
|
|
67
52
|
const msg = 'This should not happen: Alias anchor was not resolved?';
|
|
68
53
|
throw new ReferenceError(msg);
|
|
69
54
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { Schema } from '../schema/Schema';
|
|
2
|
-
import { NODE_TYPE } from './identity';
|
|
3
|
-
import { NodeBase } from './Node';
|
|
4
|
-
export declare function collectionFromPath(schema: Schema, path: unknown[], value: unknown): import(
|
|
1
|
+
import type { Schema } from '../schema/Schema.js';
|
|
2
|
+
import { NODE_TYPE } from './identity.js';
|
|
3
|
+
import { NodeBase } from './Node.js';
|
|
4
|
+
export declare function collectionFromPath(schema: Schema, path: unknown[], value: unknown): import("./Node.js").Node;
|
|
5
5
|
export declare const isEmptyPath: (path: Iterable<unknown> | null | undefined) => path is null | undefined;
|
|
6
6
|
export declare abstract class Collection extends NodeBase {
|
|
7
7
|
schema: Schema | undefined;
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import type { Document } from '../doc/Document';
|
|
2
|
-
import type { ToJSOptions } from '../options';
|
|
3
|
-
import
|
|
4
|
-
import type { StringifyContext } from '../stringify/stringify';
|
|
5
|
-
import type { Alias } from './Alias';
|
|
6
|
-
import { NODE_TYPE } from './identity';
|
|
7
|
-
import type { Scalar } from './Scalar';
|
|
8
|
-
import type {
|
|
9
|
-
import type {
|
|
10
|
-
import type { YAMLSeq } from './YAMLSeq';
|
|
1
|
+
import type { Document } from '../doc/Document.js';
|
|
2
|
+
import type { ToJSOptions } from '../options.js';
|
|
3
|
+
import { Token } from '../parse/cst.js';
|
|
4
|
+
import type { StringifyContext } from '../stringify/stringify.js';
|
|
5
|
+
import type { Alias } from './Alias.js';
|
|
6
|
+
import { NODE_TYPE } from './identity.js';
|
|
7
|
+
import type { Scalar } from './Scalar.js';
|
|
8
|
+
import type { YAMLMap } from './YAMLMap.js';
|
|
9
|
+
import type { YAMLSeq } from './YAMLSeq.js';
|
|
11
10
|
export type Node<T = unknown> = Alias | Scalar<T> | YAMLMap<unknown, T> | YAMLSeq<T>;
|
|
12
11
|
/** Utility type mapper */
|
|
13
12
|
export type NodeType<T> = T extends string | number | bigint | boolean | null | undefined ? Scalar<T> : T extends Date ? Scalar<string | Date> : T extends Array<any> ? YAMLSeq<NodeType<T[number]>> : T extends {
|
|
@@ -16,7 +15,6 @@ export type NodeType<T> = T extends string | number | bigint | boolean | null |
|
|
|
16
15
|
[key: number]: any;
|
|
17
16
|
} ? YAMLMap<NodeType<keyof T>, NodeType<T[keyof T]>> : Node;
|
|
18
17
|
export type ParsedNode = Alias.Parsed | Scalar.Parsed | YAMLMap.Parsed | YAMLSeq.Parsed;
|
|
19
|
-
/** `[start, value-end, node-end]` */
|
|
20
18
|
export type Range = [number, number, number];
|
|
21
19
|
export declare abstract class NodeBase {
|
|
22
20
|
readonly [NODE_TYPE]: symbol;
|
|
@@ -37,11 +35,6 @@ export declare abstract class NodeBase {
|
|
|
37
35
|
srcToken?: Token;
|
|
38
36
|
/** A fully qualified tag, if required */
|
|
39
37
|
tag?: string;
|
|
40
|
-
/**
|
|
41
|
-
* Customize the way that a key-value pair is resolved.
|
|
42
|
-
* Used for YAML 1.1 !!merge << handling.
|
|
43
|
-
*/
|
|
44
|
-
addToJSMap?: (ctx: ToJSContext | undefined, map: MapLike, value: unknown) => void;
|
|
45
38
|
/** A plain JS representation of this node */
|
|
46
39
|
abstract toJSON(): any;
|
|
47
40
|
abstract toString(ctx?: StringifyContext, onComment?: () => void, onChompKeep?: () => void): string;
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import
|
|
2
|
-
import type { CollectionItem } from '../parse/cst';
|
|
3
|
-
import type { Schema } from '../schema/Schema';
|
|
4
|
-
import type { StringifyContext } from '../stringify/stringify';
|
|
5
|
-
import { addPairToJSMap } from './addPairToJSMap';
|
|
6
|
-
import { NODE_TYPE } from './identity';
|
|
7
|
-
import type {
|
|
8
|
-
import
|
|
9
|
-
export declare function createPair(key: unknown, value: unknown, ctx: CreateNodeContext): Pair<Node, Node>;
|
|
1
|
+
import { CreateNodeContext } from '../doc/createNode.js';
|
|
2
|
+
import type { CollectionItem } from '../parse/cst.js';
|
|
3
|
+
import type { Schema } from '../schema/Schema.js';
|
|
4
|
+
import type { StringifyContext } from '../stringify/stringify.js';
|
|
5
|
+
import { addPairToJSMap } from './addPairToJSMap.js';
|
|
6
|
+
import { NODE_TYPE } from './identity.js';
|
|
7
|
+
import type { ToJSContext } from './toJS.js';
|
|
8
|
+
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>>;
|
|
10
9
|
export declare class Pair<K = unknown, V = unknown> {
|
|
11
10
|
readonly [NODE_TYPE]: symbol;
|
|
12
11
|
/** Always Node or null when parsed, but can be set to anything. */
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import type { BlockScalar, FlowScalar } from '../parse/cst';
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import type { ToJSContext } from './toJS';
|
|
1
|
+
import type { BlockScalar, FlowScalar } from '../parse/cst.js';
|
|
2
|
+
import { NodeBase, Range } from './Node.js';
|
|
3
|
+
import { ToJSContext } from './toJS.js';
|
|
5
4
|
export declare const isScalarValue: (value: unknown) => boolean;
|
|
6
5
|
export declare namespace Scalar {
|
|
7
6
|
interface Parsed extends Scalar {
|
|
@@ -31,11 +30,7 @@ export declare class Scalar<T = unknown> extends NodeBase {
|
|
|
31
30
|
* The YAML 1.1 schema also supports 'BIN' and 'TIME'
|
|
32
31
|
*/
|
|
33
32
|
format?: string;
|
|
34
|
-
/**
|
|
35
|
-
* If `value` is a number that is serialized as a decimal string
|
|
36
|
-
* (i.e. not using exponential notation),
|
|
37
|
-
* use this value when stringifying this node.
|
|
38
|
-
*/
|
|
33
|
+
/** If `value` is a number, use this value when stringifying this node. */
|
|
39
34
|
minFractionDigits?: number;
|
|
40
35
|
/** Set during parsing to the source string value */
|
|
41
36
|
source?: string;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import type { BlockMap, FlowCollection } from '../parse/cst';
|
|
2
|
-
import type { Schema } from '../schema/Schema';
|
|
3
|
-
import type { StringifyContext } from '../stringify/stringify';
|
|
4
|
-
import
|
|
5
|
-
import { Collection } from './Collection';
|
|
6
|
-
import type { ParsedNode, Range } from './Node';
|
|
7
|
-
import { Pair } from './Pair';
|
|
8
|
-
import
|
|
9
|
-
import type { ToJSContext } from './toJS';
|
|
1
|
+
import type { BlockMap, FlowCollection } from '../parse/cst.js';
|
|
2
|
+
import type { Schema } from '../schema/Schema.js';
|
|
3
|
+
import type { StringifyContext } from '../stringify/stringify.js';
|
|
4
|
+
import { CreateNodeContext } from '../util.js';
|
|
5
|
+
import { Collection } from './Collection.js';
|
|
6
|
+
import type { ParsedNode, Range } from './Node.js';
|
|
7
|
+
import { Pair } from './Pair.js';
|
|
8
|
+
import { Scalar } from './Scalar.js';
|
|
9
|
+
import type { ToJSContext } from './toJS.js';
|
|
10
10
|
export type MapLike = Map<unknown, unknown> | Set<unknown> | Record<string | number | symbol, unknown>;
|
|
11
11
|
export declare function findPair<K = unknown, V = unknown>(items: Iterable<Pair<K, V>>, key: unknown): Pair<K, V> | undefined;
|
|
12
12
|
export declare namespace YAMLMap {
|
|
@@ -24,7 +24,7 @@ export declare class YAMLMap<K = unknown, V = unknown> extends Collection {
|
|
|
24
24
|
* A generic collection parsing method that can be extended
|
|
25
25
|
* to other node classes that inherit from YAMLMap
|
|
26
26
|
*/
|
|
27
|
-
static from(schema: Schema, obj: unknown, ctx: CreateNodeContext): YAMLMap
|
|
27
|
+
static from(schema: Schema, obj: unknown, ctx: CreateNodeContext): YAMLMap<unknown, unknown>;
|
|
28
28
|
/**
|
|
29
29
|
* Adds a value to the collection.
|
|
30
30
|
*
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import
|
|
2
|
-
import type { BlockSequence, FlowCollection } from '../parse/cst';
|
|
3
|
-
import type { Schema } from '../schema/Schema';
|
|
4
|
-
import type { StringifyContext } from '../stringify/stringify';
|
|
5
|
-
import { Collection } from './Collection';
|
|
6
|
-
import type { ParsedNode, Range } from './Node';
|
|
7
|
-
import type { Pair } from './Pair';
|
|
8
|
-
import
|
|
9
|
-
import
|
|
1
|
+
import { CreateNodeContext } from '../doc/createNode.js';
|
|
2
|
+
import type { BlockSequence, FlowCollection } from '../parse/cst.js';
|
|
3
|
+
import type { Schema } from '../schema/Schema.js';
|
|
4
|
+
import type { StringifyContext } from '../stringify/stringify.js';
|
|
5
|
+
import { Collection } from './Collection.js';
|
|
6
|
+
import type { ParsedNode, Range } from './Node.js';
|
|
7
|
+
import type { Pair } from './Pair.js';
|
|
8
|
+
import { Scalar } from './Scalar.js';
|
|
9
|
+
import { ToJSContext } from './toJS.js';
|
|
10
10
|
export declare namespace YAMLSeq {
|
|
11
11
|
interface Parsed<T extends ParsedNode | Pair<ParsedNode, ParsedNode | null> = ParsedNode> extends YAMLSeq<T> {
|
|
12
12
|
items: T[];
|
|
@@ -56,5 +56,5 @@ export declare class YAMLSeq<T = unknown> extends Collection {
|
|
|
56
56
|
set(key: unknown, value: T): void;
|
|
57
57
|
toJSON(_?: unknown, ctx?: ToJSContext): unknown[];
|
|
58
58
|
toString(ctx?: StringifyContext, onComment?: () => void, onChompKeep?: () => void): string;
|
|
59
|
-
static from(schema: Schema, obj: unknown, ctx: CreateNodeContext): YAMLSeq
|
|
59
|
+
static from(schema: Schema, obj: unknown, ctx: CreateNodeContext): YAMLSeq<unknown>;
|
|
60
60
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Pair } from './Pair';
|
|
2
|
-
import
|
|
3
|
-
import type { MapLike } from './YAMLMap';
|
|
1
|
+
import type { Pair } from './Pair.js';
|
|
2
|
+
import { ToJSContext } from './toJS.js';
|
|
3
|
+
import type { MapLike } from './YAMLMap.js';
|
|
4
4
|
export declare function addPairToJSMap(ctx: ToJSContext | undefined, map: MapLike, { key, value }: Pair): MapLike;
|
|
@@ -1,17 +1,24 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var log = require('../log.js');
|
|
4
|
-
var merge = require('../schema/yaml-1.1/merge.js');
|
|
5
4
|
var stringify = require('../stringify/stringify.js');
|
|
6
5
|
var identity = require('./identity.js');
|
|
6
|
+
var Scalar = require('./Scalar.js');
|
|
7
7
|
var toJS = require('./toJS.js');
|
|
8
8
|
|
|
9
|
+
const MERGE_KEY = '<<';
|
|
9
10
|
function addPairToJSMap(ctx, map, { key, value }) {
|
|
10
|
-
if (
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
if (ctx?.doc.schema.merge && isMergeKey(key)) {
|
|
12
|
+
value = identity.isAlias(value) ? value.resolve(ctx.doc) : value;
|
|
13
|
+
if (identity.isSeq(value))
|
|
14
|
+
for (const it of value.items)
|
|
15
|
+
mergeToJSMap(ctx, map, it);
|
|
16
|
+
else if (Array.isArray(value))
|
|
17
|
+
for (const it of value)
|
|
18
|
+
mergeToJSMap(ctx, map, it);
|
|
19
|
+
else
|
|
20
|
+
mergeToJSMap(ctx, map, value);
|
|
21
|
+
}
|
|
15
22
|
else {
|
|
16
23
|
const jsKey = toJS.toJS(key, '', ctx);
|
|
17
24
|
if (map instanceof Map) {
|
|
@@ -36,10 +43,44 @@ function addPairToJSMap(ctx, map, { key, value }) {
|
|
|
36
43
|
}
|
|
37
44
|
return map;
|
|
38
45
|
}
|
|
46
|
+
const isMergeKey = (key) => key === MERGE_KEY ||
|
|
47
|
+
(identity.isScalar(key) &&
|
|
48
|
+
key.value === MERGE_KEY &&
|
|
49
|
+
(!key.type || key.type === Scalar.Scalar.PLAIN));
|
|
50
|
+
// If the value associated with a merge key is a single mapping node, each of
|
|
51
|
+
// its key/value pairs is inserted into the current mapping, unless the key
|
|
52
|
+
// already exists in it. If the value associated with the merge key is a
|
|
53
|
+
// sequence, then this sequence is expected to contain mapping nodes and each
|
|
54
|
+
// of these nodes is merged in turn according to its order in the sequence.
|
|
55
|
+
// Keys in mapping nodes earlier in the sequence override keys specified in
|
|
56
|
+
// later mapping nodes. -- http://yaml.org/type/merge.html
|
|
57
|
+
function mergeToJSMap(ctx, map, value) {
|
|
58
|
+
const source = ctx && identity.isAlias(value) ? value.resolve(ctx.doc) : value;
|
|
59
|
+
if (!identity.isMap(source))
|
|
60
|
+
throw new Error('Merge sources must be maps or map aliases');
|
|
61
|
+
const srcMap = source.toJSON(null, ctx, Map);
|
|
62
|
+
for (const [key, value] of srcMap) {
|
|
63
|
+
if (map instanceof Map) {
|
|
64
|
+
if (!map.has(key))
|
|
65
|
+
map.set(key, value);
|
|
66
|
+
}
|
|
67
|
+
else if (map instanceof Set) {
|
|
68
|
+
map.add(key);
|
|
69
|
+
}
|
|
70
|
+
else if (!Object.prototype.hasOwnProperty.call(map, key)) {
|
|
71
|
+
Object.defineProperty(map, key, {
|
|
72
|
+
value,
|
|
73
|
+
writable: true,
|
|
74
|
+
enumerable: true,
|
|
75
|
+
configurable: true
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
return map;
|
|
80
|
+
}
|
|
39
81
|
function stringifyKey(key, jsKey, ctx) {
|
|
40
82
|
if (jsKey === null)
|
|
41
83
|
return '';
|
|
42
|
-
// eslint-disable-next-line @typescript-eslint/no-base-to-string
|
|
43
84
|
if (typeof jsKey !== 'object')
|
|
44
85
|
return String(jsKey);
|
|
45
86
|
if (identity.isNode(key) && ctx?.doc) {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import type { Document } from '../doc/Document';
|
|
2
|
-
import type { Alias } from './Alias';
|
|
3
|
-
import type { Node } from './Node';
|
|
4
|
-
import type { Pair } from './Pair';
|
|
5
|
-
import type { Scalar } from './Scalar';
|
|
6
|
-
import type { YAMLMap } from './YAMLMap';
|
|
7
|
-
import type { YAMLSeq } from './YAMLSeq';
|
|
1
|
+
import type { Document } from '../doc/Document.js';
|
|
2
|
+
import type { Alias } from './Alias.js';
|
|
3
|
+
import type { Node } from './Node.js';
|
|
4
|
+
import type { Pair } from './Pair.js';
|
|
5
|
+
import type { Scalar } from './Scalar.js';
|
|
6
|
+
import type { YAMLMap } from './YAMLMap.js';
|
|
7
|
+
import type { YAMLSeq } from './YAMLSeq.js';
|
|
8
8
|
export declare const ALIAS: unique symbol;
|
|
9
9
|
export declare const DOC: unique symbol;
|
|
10
10
|
export declare const MAP: unique symbol;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Document } from '../doc/Document';
|
|
2
|
-
import type { Node } from './Node';
|
|
1
|
+
import type { Document } from '../doc/Document.js';
|
|
2
|
+
import type { Node } from './Node.js';
|
|
3
3
|
export interface AnchorData {
|
|
4
4
|
aliasCount: number;
|
|
5
5
|
count: number;
|
|
@@ -7,8 +7,6 @@ export interface AnchorData {
|
|
|
7
7
|
}
|
|
8
8
|
export interface ToJSContext {
|
|
9
9
|
anchors: Map<Node, AnchorData>;
|
|
10
|
-
/** Cached anchor and alias nodes in the order they occur in the document */
|
|
11
|
-
aliasResolveCache?: Node[];
|
|
12
10
|
doc: Document<Node, boolean>;
|
|
13
11
|
keep: boolean;
|
|
14
12
|
mapAsMap: boolean;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import type { Reviver } from './doc/applyReviver';
|
|
2
|
-
import type { Directives } from './doc/directives';
|
|
3
|
-
import type { LogLevelId } from './log';
|
|
4
|
-
import type { ParsedNode } from './nodes/Node';
|
|
5
|
-
import type { Pair } from './nodes/Pair';
|
|
6
|
-
import type { Scalar } from './nodes/Scalar';
|
|
7
|
-
import type { LineCounter } from './parse/line-counter';
|
|
8
|
-
import type { Schema } from './schema/Schema';
|
|
9
|
-
import type { Tags } from './schema/tags';
|
|
10
|
-
import type { CollectionTag, ScalarTag } from './schema/types';
|
|
1
|
+
import type { Reviver } from './doc/applyReviver.js';
|
|
2
|
+
import type { Directives } from './doc/directives.js';
|
|
3
|
+
import type { LogLevelId } from './log.js';
|
|
4
|
+
import type { ParsedNode } from './nodes/Node.js';
|
|
5
|
+
import type { Pair } from './nodes/Pair.js';
|
|
6
|
+
import type { Scalar } from './nodes/Scalar.js';
|
|
7
|
+
import type { LineCounter } from './parse/line-counter.js';
|
|
8
|
+
import type { Schema } from './schema/Schema.js';
|
|
9
|
+
import type { Tags } from './schema/tags.js';
|
|
10
|
+
import type { CollectionTag, ScalarTag } from './schema/types.js';
|
|
11
11
|
export type ParseOptions = {
|
|
12
12
|
/**
|
|
13
13
|
* Whether integers should be parsed into BigInt rather than number values.
|
|
@@ -42,12 +42,6 @@ export type ParseOptions = {
|
|
|
42
42
|
* Default: `true`
|
|
43
43
|
*/
|
|
44
44
|
strict?: boolean;
|
|
45
|
-
/**
|
|
46
|
-
* Parse all mapping keys as strings. Treat all non-scalar keys as errors.
|
|
47
|
-
*
|
|
48
|
-
* Default: `false`
|
|
49
|
-
*/
|
|
50
|
-
stringKeys?: boolean;
|
|
51
45
|
/**
|
|
52
46
|
* YAML requires map keys to be unique. By default, this is checked by
|
|
53
47
|
* comparing scalar values with `===`; deep equality is not checked for
|
|
@@ -326,12 +320,6 @@ export type ToStringOptions = {
|
|
|
326
320
|
* Default: `null`
|
|
327
321
|
*/
|
|
328
322
|
singleQuote?: boolean | null;
|
|
329
|
-
/**
|
|
330
|
-
* Add a trailing comma after the last entry in a flow map or flow sequence that's split across multiple lines.
|
|
331
|
-
*
|
|
332
|
-
* Default: `'false'`
|
|
333
|
-
*/
|
|
334
|
-
trailingComma?: boolean;
|
|
335
323
|
/**
|
|
336
324
|
* String representation for `true`.
|
|
337
325
|
* With the core schema, use `'true'`, `'True'`, or `'TRUE'`.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import type { Scalar } from '../nodes/Scalar';
|
|
4
|
-
import type { BlockScalar, FlowScalar, SourceToken, Token } from './cst';
|
|
1
|
+
import { ErrorCode } from '../errors.js';
|
|
2
|
+
import { Range } from '../nodes/Node.js';
|
|
3
|
+
import type { Scalar } from '../nodes/Scalar.js';
|
|
4
|
+
import type { BlockScalar, FlowScalar, SourceToken, Token } from './cst.js';
|
|
5
5
|
/**
|
|
6
6
|
* If `token` is a CST flow or block scalar, determine its string value and a few other attributes.
|
|
7
7
|
* Otherwise, return `null`.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { CollectionItem, Document } from './cst.js';
|
|
2
2
|
export type VisitPath = readonly ['key' | 'value', number][];
|
|
3
3
|
export type Visitor = (item: CollectionItem, path: VisitPath) => number | symbol | Visitor | void;
|
|
4
4
|
/**
|
|
@@ -35,5 +35,5 @@ export declare namespace visit {
|
|
|
35
35
|
var SKIP: symbol;
|
|
36
36
|
var REMOVE: symbol;
|
|
37
37
|
var itemAtPath: (cst: Document | CollectionItem, path: VisitPath) => CollectionItem | undefined;
|
|
38
|
-
var parentCollection: (cst: Document | CollectionItem, path: VisitPath) => BlockMap | BlockSequence | FlowCollection;
|
|
38
|
+
var parentCollection: (cst: Document | CollectionItem, path: VisitPath) => import("./cst.js").BlockMap | import("./cst.js").BlockSequence | import("./cst.js").FlowCollection;
|
|
39
39
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
export { createScalarToken, resolveAsScalar, setScalarValue } from './cst-scalar';
|
|
2
|
-
export { stringify } from './cst-stringify';
|
|
3
|
-
export
|
|
4
|
-
export { visit } from './cst-visit';
|
|
1
|
+
export { createScalarToken, resolveAsScalar, setScalarValue } from './cst-scalar.js';
|
|
2
|
+
export { stringify } from './cst-stringify.js';
|
|
3
|
+
export { visit, Visitor, VisitPath } from './cst-visit.js';
|
|
5
4
|
export interface SourceToken {
|
|
6
5
|
type: 'byte-order-mark' | 'doc-mode' | 'doc-start' | 'space' | 'comment' | 'newline' | 'directive-line' | 'anchor' | 'tag' | 'seq-item-ind' | 'explicit-key-ind' | 'map-value-ind' | 'flow-map-start' | 'flow-map-end' | 'flow-seq-start' | 'flow-seq-end' | 'flow-error-end' | 'comma' | 'block-scalar-header';
|
|
7
6
|
offset: number;
|
|
@@ -59,7 +59,7 @@ export declare class Lexer {
|
|
|
59
59
|
*
|
|
60
60
|
* @returns A generator of lexical tokens
|
|
61
61
|
*/
|
|
62
|
-
lex(source: string, incomplete?: boolean): Generator<string, void>;
|
|
62
|
+
lex(source: string, incomplete?: boolean): Generator<string, void, unknown>;
|
|
63
63
|
private atLineEnd;
|
|
64
64
|
private charAt;
|
|
65
65
|
private continueScalar;
|