@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
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { resolve } from 'path';
|
|
2
|
-
import { parseArgs } from 'util';
|
|
1
|
+
import { resolve } from 'node:path';
|
|
2
|
+
import { parseArgs } from 'node:util';
|
|
3
3
|
import { prettyToken } from './parse/cst.js';
|
|
4
4
|
import { Lexer } from './parse/lexer.js';
|
|
5
5
|
import { Parser } from './parse/parser.js';
|
|
@@ -23,7 +23,6 @@ Options:
|
|
|
23
23
|
--help, -h Show this message.
|
|
24
24
|
--json, -j Output JSON.
|
|
25
25
|
--indent 2 Output pretty-printed data, indented by the given number of spaces.
|
|
26
|
-
--merge, -m Enable support for "<<" merge keys.
|
|
27
26
|
|
|
28
27
|
Additional options for bare "yaml" command:
|
|
29
28
|
--doc, -d Output pretty-printed JS Document objects.
|
|
@@ -49,7 +48,6 @@ async function cli(stdin, done, argv) {
|
|
|
49
48
|
doc: { type: 'boolean', short: 'd' },
|
|
50
49
|
help: { type: 'boolean', short: 'h' },
|
|
51
50
|
indent: { type: 'string', short: 'i' },
|
|
52
|
-
merge: { type: 'boolean', short: 'm' },
|
|
53
51
|
json: { type: 'boolean', short: 'j' },
|
|
54
52
|
single: { type: 'boolean', short: '1' },
|
|
55
53
|
strict: { type: 'boolean', short: 's' },
|
|
@@ -119,7 +117,7 @@ async function cli(stdin, done, argv) {
|
|
|
119
117
|
const lineCounter = new LineCounter();
|
|
120
118
|
const parser = new Parser(lineCounter.addNewLine);
|
|
121
119
|
// @ts-expect-error Version is validated at runtime
|
|
122
|
-
const composer = new Composer({ version: opt.yaml
|
|
120
|
+
const composer = new Composer({ version: opt.yaml });
|
|
123
121
|
const visitor = opt.visit
|
|
124
122
|
? (await import(resolve(opt.visit))).default
|
|
125
123
|
: null;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { ParsedNode } from '../nodes/Node';
|
|
2
|
-
import type { BlockMap, BlockSequence, FlowCollection, SourceToken } from '../parse/cst';
|
|
3
|
-
import type { ComposeContext, ComposeNode } from './compose-node';
|
|
4
|
-
import type { ComposeErrorHandler } from './composer';
|
|
1
|
+
import type { ParsedNode } from '../nodes/Node.js';
|
|
2
|
+
import type { BlockMap, BlockSequence, FlowCollection, SourceToken } from '../parse/cst.js';
|
|
3
|
+
import type { ComposeContext, ComposeNode } from './compose-node.js';
|
|
4
|
+
import type { ComposeErrorHandler } from './composer.js';
|
|
5
5
|
interface Props {
|
|
6
6
|
anchor: SourceToken | null;
|
|
7
7
|
tag: SourceToken | null;
|
|
@@ -61,13 +61,13 @@ function composeCollection(CN, ctx, token, props, onError) {
|
|
|
61
61
|
let tag = ctx.schema.tags.find(t => t.tag === tagName && t.collection === expType);
|
|
62
62
|
if (!tag) {
|
|
63
63
|
const kt = ctx.schema.knownTags[tagName];
|
|
64
|
-
if (kt
|
|
64
|
+
if (kt && kt.collection === expType) {
|
|
65
65
|
ctx.schema.tags.push(Object.assign({}, kt, { default: false }));
|
|
66
66
|
tag = kt;
|
|
67
67
|
}
|
|
68
68
|
else {
|
|
69
|
-
if (kt) {
|
|
70
|
-
onError(tagToken, 'BAD_COLLECTION_TYPE', `${kt.tag} used for ${expType} collection, but expects ${kt.collection
|
|
69
|
+
if (kt?.collection) {
|
|
70
|
+
onError(tagToken, 'BAD_COLLECTION_TYPE', `${kt.tag} used for ${expType} collection, but expects ${kt.collection}`, true);
|
|
71
71
|
}
|
|
72
72
|
else {
|
|
73
73
|
onError(tagToken, 'TAG_RESOLVE_FAILED', `Unresolved tag: ${tagName}`, true);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { Directives } from '../doc/directives';
|
|
2
|
-
import { Document } from '../doc/Document';
|
|
3
|
-
import type { ParsedNode } from '../nodes/Node';
|
|
4
|
-
import type { DocumentOptions, ParseOptions, SchemaOptions } from '../options';
|
|
5
|
-
import type * as CST from '../parse/cst';
|
|
6
|
-
import type { ComposeErrorHandler } from './composer';
|
|
1
|
+
import type { Directives } from '../doc/directives.js';
|
|
2
|
+
import { Document } from '../doc/Document.js';
|
|
3
|
+
import type { ParsedNode } from '../nodes/Node.js';
|
|
4
|
+
import type { DocumentOptions, ParseOptions, SchemaOptions } from '../options.js';
|
|
5
|
+
import type * as CST from '../parse/cst.js';
|
|
6
|
+
import type { ComposeErrorHandler } from './composer.js';
|
|
7
7
|
export declare function composeDoc<Contents extends ParsedNode = ParsedNode, Strict extends boolean = true>(options: ParseOptions & DocumentOptions & SchemaOptions, directives: Directives, { offset, start, value, end }: CST.Document, onError: ComposeErrorHandler): Document.Parsed<Contents, Strict>;
|
|
@@ -9,7 +9,6 @@ function composeDoc(options, directives, { offset, start, value, end }, onError)
|
|
|
9
9
|
const opts = Object.assign({ _directives: directives }, options);
|
|
10
10
|
const doc = new Document.Document(undefined, opts);
|
|
11
11
|
const ctx = {
|
|
12
|
-
atKey: false,
|
|
13
12
|
atRoot: true,
|
|
14
13
|
directives: doc.directives,
|
|
15
14
|
options: doc.options,
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import type { Directives } from '../doc/directives';
|
|
2
|
-
import type { ParsedNode } from '../nodes/Node';
|
|
3
|
-
import type { ParseOptions } from '../options';
|
|
4
|
-
import type { SourceToken, Token } from '../parse/cst';
|
|
5
|
-
import type { Schema } from '../schema/Schema';
|
|
6
|
-
import type { ComposeErrorHandler } from './composer';
|
|
1
|
+
import type { Directives } from '../doc/directives.js';
|
|
2
|
+
import type { ParsedNode } from '../nodes/Node.js';
|
|
3
|
+
import type { ParseOptions } from '../options.js';
|
|
4
|
+
import type { SourceToken, Token } from '../parse/cst.js';
|
|
5
|
+
import type { Schema } from '../schema/Schema.js';
|
|
6
|
+
import type { ComposeErrorHandler } from './composer.js';
|
|
7
7
|
export interface ComposeContext {
|
|
8
|
-
atKey: boolean;
|
|
9
8
|
atRoot: boolean;
|
|
10
9
|
directives: Directives;
|
|
11
10
|
options: Readonly<Required<Omit<ParseOptions, 'lineCounter'>>>;
|
|
@@ -25,5 +24,5 @@ declare const CN: {
|
|
|
25
24
|
};
|
|
26
25
|
export type ComposeNode = typeof CN;
|
|
27
26
|
export declare function composeNode(ctx: ComposeContext, token: Token, props: Props, onError: ComposeErrorHandler): ParsedNode;
|
|
28
|
-
export declare function composeEmptyNode(ctx: ComposeContext, offset: number, before: Token[] | undefined, pos: number | null, { spaceBefore, comment, anchor, tag, end }: Props, onError: ComposeErrorHandler): import(
|
|
27
|
+
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;
|
|
29
28
|
export {};
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var Alias = require('../nodes/Alias.js');
|
|
4
|
-
var identity = require('../nodes/identity.js');
|
|
5
4
|
var composeCollection = require('./compose-collection.js');
|
|
6
5
|
var composeScalar = require('./compose-scalar.js');
|
|
7
6
|
var resolveEnd = require('./resolve-end.js');
|
|
@@ -9,7 +8,6 @@ var utilEmptyScalarPosition = require('./util-empty-scalar-position.js');
|
|
|
9
8
|
|
|
10
9
|
const CN = { composeNode, composeEmptyNode };
|
|
11
10
|
function composeNode(ctx, token, props, onError) {
|
|
12
|
-
const atKey = ctx.atKey;
|
|
13
11
|
const { spaceBefore, comment, anchor, tag } = props;
|
|
14
12
|
let node;
|
|
15
13
|
let isSrcToken = true;
|
|
@@ -30,36 +28,21 @@ function composeNode(ctx, token, props, onError) {
|
|
|
30
28
|
case 'block-map':
|
|
31
29
|
case 'block-seq':
|
|
32
30
|
case 'flow-collection':
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
node.anchor = anchor.source.substring(1);
|
|
37
|
-
}
|
|
38
|
-
catch (error) {
|
|
39
|
-
// Almost certainly here due to a stack overflow
|
|
40
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
41
|
-
onError(token, 'RESOURCE_EXHAUSTION', message);
|
|
42
|
-
}
|
|
31
|
+
node = composeCollection.composeCollection(CN, ctx, token, props, onError);
|
|
32
|
+
if (anchor)
|
|
33
|
+
node.anchor = anchor.source.substring(1);
|
|
43
34
|
break;
|
|
44
35
|
default: {
|
|
45
36
|
const message = token.type === 'error'
|
|
46
37
|
? token.message
|
|
47
38
|
: `Unsupported token (type: ${token.type})`;
|
|
48
39
|
onError(token, 'UNEXPECTED_TOKEN', message);
|
|
40
|
+
node = composeEmptyNode(ctx, token.offset, undefined, null, props, onError);
|
|
49
41
|
isSrcToken = false;
|
|
50
42
|
}
|
|
51
43
|
}
|
|
52
|
-
node ?? (node = composeEmptyNode(ctx, token.offset, undefined, null, props, onError));
|
|
53
44
|
if (anchor && node.anchor === '')
|
|
54
45
|
onError(anchor, 'BAD_ALIAS', 'Anchor cannot be an empty string');
|
|
55
|
-
if (atKey &&
|
|
56
|
-
ctx.options.stringKeys &&
|
|
57
|
-
(!identity.isScalar(node) ||
|
|
58
|
-
typeof node.value !== 'string' ||
|
|
59
|
-
(node.tag && node.tag !== 'tag:yaml.org,2002:str'))) {
|
|
60
|
-
const msg = 'With stringKeys, all keys must be strings';
|
|
61
|
-
onError(tag ?? token, 'NON_STRING_KEY', msg);
|
|
62
|
-
}
|
|
63
46
|
if (spaceBefore)
|
|
64
47
|
node.spaceBefore = true;
|
|
65
48
|
if (comment) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Scalar } from '../nodes/Scalar';
|
|
2
|
-
import type { BlockScalar, FlowScalar, SourceToken } from '../parse/cst';
|
|
3
|
-
import type { ComposeContext } from './compose-node';
|
|
4
|
-
import type { ComposeErrorHandler } from './composer';
|
|
1
|
+
import { Scalar } from '../nodes/Scalar.js';
|
|
2
|
+
import type { BlockScalar, FlowScalar, SourceToken } from '../parse/cst.js';
|
|
3
|
+
import type { ComposeContext } from './compose-node.js';
|
|
4
|
+
import type { ComposeErrorHandler } from './composer.js';
|
|
5
5
|
export declare function composeScalar(ctx: ComposeContext, token: FlowScalar | BlockScalar, tagToken: SourceToken | null, onError: ComposeErrorHandler): Scalar.Parsed;
|
|
@@ -12,16 +12,11 @@ function composeScalar(ctx, token, tagToken, onError) {
|
|
|
12
12
|
const tagName = tagToken
|
|
13
13
|
? ctx.directives.tagName(tagToken.source, msg => onError(tagToken, 'TAG_RESOLVE_FAILED', msg))
|
|
14
14
|
: null;
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
tag = findScalarTagByName(ctx.schema, value, tagName, tagToken, onError);
|
|
21
|
-
else if (token.type === 'scalar')
|
|
22
|
-
tag = findScalarTagByTest(ctx, value, token, onError);
|
|
23
|
-
else
|
|
24
|
-
tag = ctx.schema[identity.SCALAR];
|
|
15
|
+
const tag = tagToken && tagName
|
|
16
|
+
? findScalarTagByName(ctx.schema, value, tagName, tagToken, onError)
|
|
17
|
+
: token.type === 'scalar'
|
|
18
|
+
? findScalarTagByTest(ctx, value, token, onError)
|
|
19
|
+
: ctx.schema[identity.SCALAR];
|
|
25
20
|
let scalar;
|
|
26
21
|
try {
|
|
27
22
|
const res = tag.resolve(value, msg => onError(tagToken ?? token, 'TAG_RESOLVE_FAILED', msg), ctx.options);
|
|
@@ -69,9 +64,8 @@ function findScalarTagByName(schema, value, tagName, tagToken, onError) {
|
|
|
69
64
|
onError(tagToken, 'TAG_RESOLVE_FAILED', `Unresolved tag: ${tagName}`, tagName !== 'tag:yaml.org,2002:str');
|
|
70
65
|
return schema[identity.SCALAR];
|
|
71
66
|
}
|
|
72
|
-
function findScalarTagByTest({
|
|
73
|
-
const tag = schema.tags.find(tag =>
|
|
74
|
-
tag.test?.test(value)) || schema[identity.SCALAR];
|
|
67
|
+
function findScalarTagByTest({ directives, schema }, value, token, onError) {
|
|
68
|
+
const tag = schema.tags.find(tag => tag.default && tag.test?.test(value)) || schema[identity.SCALAR];
|
|
75
69
|
if (schema.compat) {
|
|
76
70
|
const compat = schema.compat.find(tag => tag.default && tag.test?.test(value)) ??
|
|
77
71
|
schema[identity.SCALAR];
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { Directives } from '../doc/directives';
|
|
2
|
-
import { Document } from '../doc/Document';
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import type {
|
|
6
|
-
import type {
|
|
7
|
-
import type { Token } from '../parse/cst';
|
|
1
|
+
import { Directives } from '../doc/directives.js';
|
|
2
|
+
import { Document } from '../doc/Document.js';
|
|
3
|
+
import { ErrorCode, YAMLParseError, YAMLWarning } from '../errors.js';
|
|
4
|
+
import type { ParsedNode, Range } from '../nodes/Node.js';
|
|
5
|
+
import type { DocumentOptions, ParseOptions, SchemaOptions } from '../options.js';
|
|
6
|
+
import type { Token } from '../parse/cst.js';
|
|
8
7
|
type ErrorSource = number | [number, number] | Range | {
|
|
9
8
|
offset: number;
|
|
10
9
|
source?: string;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var node_process = require('process');
|
|
4
3
|
var directives = require('../doc/directives.js');
|
|
5
4
|
var Document = require('../doc/Document.js');
|
|
6
5
|
var errors = require('../errors.js');
|
|
@@ -97,10 +96,8 @@ class Composer {
|
|
|
97
96
|
}
|
|
98
97
|
}
|
|
99
98
|
if (afterDoc) {
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
for (let i = 0; i < this.warnings.length; ++i)
|
|
103
|
-
doc.warnings.push(this.warnings[i]);
|
|
99
|
+
Array.prototype.push.apply(doc.errors, this.errors);
|
|
100
|
+
Array.prototype.push.apply(doc.warnings, this.warnings);
|
|
104
101
|
}
|
|
105
102
|
else {
|
|
106
103
|
doc.errors = this.errors;
|
|
@@ -136,7 +133,7 @@ class Composer {
|
|
|
136
133
|
}
|
|
137
134
|
/** Advance the composer by one CST token. */
|
|
138
135
|
*next(token) {
|
|
139
|
-
if (
|
|
136
|
+
if (process.env.LOG_STREAM)
|
|
140
137
|
console.dir(token, { depth: null });
|
|
141
138
|
switch (token.type) {
|
|
142
139
|
case 'directive':
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { YAMLMap } from '../nodes/YAMLMap';
|
|
2
|
-
import type { BlockMap } from '../parse/cst';
|
|
3
|
-
import
|
|
4
|
-
import type { ComposeContext, ComposeNode } from './compose-node';
|
|
5
|
-
import type { ComposeErrorHandler } from './composer';
|
|
1
|
+
import { YAMLMap } from '../nodes/YAMLMap.js';
|
|
2
|
+
import type { BlockMap } from '../parse/cst.js';
|
|
3
|
+
import { CollectionTag } from '../schema/types.js';
|
|
4
|
+
import type { ComposeContext, ComposeNode } from './compose-node.js';
|
|
5
|
+
import type { ComposeErrorHandler } from './composer.js';
|
|
6
6
|
export declare function resolveBlockMap({ composeNode, composeEmptyNode }: ComposeNode, ctx: ComposeContext, bm: BlockMap, onError: ComposeErrorHandler, tag?: CollectionTag): YAMLMap.Parsed;
|
|
@@ -52,14 +52,12 @@ function resolveBlockMap({ composeNode, composeEmptyNode }, ctx, bm, onError, ta
|
|
|
52
52
|
onError(offset, 'BAD_INDENT', startColMsg);
|
|
53
53
|
}
|
|
54
54
|
// key value
|
|
55
|
-
ctx.atKey = true;
|
|
56
55
|
const keyStart = keyProps.end;
|
|
57
56
|
const keyNode = key
|
|
58
57
|
? composeNode(ctx, key, keyProps, onError)
|
|
59
58
|
: composeEmptyNode(ctx, keyStart, start, null, keyProps, onError);
|
|
60
59
|
if (ctx.schema.compat)
|
|
61
60
|
utilFlowIndentCheck.flowIndentCheck(bm.indent, key, onError);
|
|
62
|
-
ctx.atKey = false;
|
|
63
61
|
if (utilMapIncludes.mapIncludes(ctx, map.items, keyNode))
|
|
64
62
|
onError(keyStart, 'DUPLICATE_KEY', 'Map keys must be unique');
|
|
65
63
|
// value properties
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { Scalar } from '../nodes/Scalar';
|
|
3
|
-
import type { BlockScalar } from '../parse/cst';
|
|
4
|
-
import type { ComposeContext } from './compose-node';
|
|
5
|
-
import type { ComposeErrorHandler } from './composer';
|
|
1
|
+
import { Range } from '../nodes/Node.js';
|
|
2
|
+
import { Scalar } from '../nodes/Scalar.js';
|
|
3
|
+
import type { BlockScalar } from '../parse/cst.js';
|
|
4
|
+
import type { ComposeContext } from './compose-node.js';
|
|
5
|
+
import type { ComposeErrorHandler } from './composer.js';
|
|
6
6
|
export declare function resolveBlockScalar(ctx: ComposeContext, scalar: BlockScalar, onError: ComposeErrorHandler): {
|
|
7
7
|
value: string;
|
|
8
8
|
type: Scalar.BLOCK_FOLDED | Scalar.BLOCK_LITERAL | null;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { YAMLSeq } from '../nodes/YAMLSeq';
|
|
2
|
-
import type { BlockSequence } from '../parse/cst';
|
|
3
|
-
import
|
|
4
|
-
import type { ComposeContext, ComposeNode } from './compose-node';
|
|
5
|
-
import type { ComposeErrorHandler } from './composer';
|
|
1
|
+
import { YAMLSeq } from '../nodes/YAMLSeq.js';
|
|
2
|
+
import type { BlockSequence } from '../parse/cst.js';
|
|
3
|
+
import { CollectionTag } from '../schema/types.js';
|
|
4
|
+
import type { ComposeContext, ComposeNode } from './compose-node.js';
|
|
5
|
+
import type { ComposeErrorHandler } from './composer.js';
|
|
6
6
|
export declare function resolveBlockSeq({ composeNode, composeEmptyNode }: ComposeNode, ctx: ComposeContext, bs: BlockSequence, onError: ComposeErrorHandler, tag?: CollectionTag): YAMLSeq.Parsed;
|
|
@@ -9,8 +9,6 @@ function resolveBlockSeq({ composeNode, composeEmptyNode }, ctx, bs, onError, ta
|
|
|
9
9
|
const seq = new NodeClass(ctx.schema);
|
|
10
10
|
if (ctx.atRoot)
|
|
11
11
|
ctx.atRoot = false;
|
|
12
|
-
if (ctx.atKey)
|
|
13
|
-
ctx.atKey = false;
|
|
14
12
|
let offset = bs.offset;
|
|
15
13
|
let commentEnd = null;
|
|
16
14
|
for (const { start, value } of bs.items) {
|
|
@@ -24,7 +22,7 @@ function resolveBlockSeq({ composeNode, composeEmptyNode }, ctx, bs, onError, ta
|
|
|
24
22
|
});
|
|
25
23
|
if (!props.found) {
|
|
26
24
|
if (props.anchor || props.tag || value) {
|
|
27
|
-
if (value
|
|
25
|
+
if (value && value.type === 'block-seq')
|
|
28
26
|
onError(props.end, 'BAD_INDENT', 'All sequence items must start at the same column');
|
|
29
27
|
else
|
|
30
28
|
onError(offset, 'MISSING_CHAR', 'Sequence item without - indicator');
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { SourceToken } from '../parse/cst';
|
|
2
|
-
import type { ComposeErrorHandler } from './composer';
|
|
1
|
+
import type { SourceToken } from '../parse/cst.js';
|
|
2
|
+
import type { ComposeErrorHandler } from './composer.js';
|
|
3
3
|
export declare function resolveEnd(end: SourceToken[] | undefined, offset: number, reqSpace: boolean, onError: ComposeErrorHandler): {
|
|
4
4
|
comment: string;
|
|
5
5
|
offset: number;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { YAMLMap } from '../nodes/YAMLMap';
|
|
2
|
-
import { YAMLSeq } from '../nodes/YAMLSeq';
|
|
3
|
-
import type { FlowCollection } from '../parse/cst';
|
|
4
|
-
import
|
|
5
|
-
import type { ComposeContext, ComposeNode } from './compose-node';
|
|
6
|
-
import type { ComposeErrorHandler } from './composer';
|
|
7
|
-
export declare function resolveFlowCollection({ composeNode, composeEmptyNode }: ComposeNode, ctx: ComposeContext, fc: FlowCollection, onError: ComposeErrorHandler, tag?: CollectionTag): YAMLMap.Parsed<import(
|
|
1
|
+
import { YAMLMap } from '../nodes/YAMLMap.js';
|
|
2
|
+
import { YAMLSeq } from '../nodes/YAMLSeq.js';
|
|
3
|
+
import type { FlowCollection } from '../parse/cst.js';
|
|
4
|
+
import { CollectionTag } from '../schema/types.js';
|
|
5
|
+
import type { ComposeContext, ComposeNode } from './compose-node.js';
|
|
6
|
+
import type { ComposeErrorHandler } from './composer.js';
|
|
7
|
+
export declare function resolveFlowCollection({ composeNode, composeEmptyNode }: ComposeNode, ctx: ComposeContext, fc: FlowCollection, onError: ComposeErrorHandler, tag?: CollectionTag): YAMLMap.Parsed<import("../index.js").ParsedNode, import("../index.js").ParsedNode | null> | YAMLSeq.Parsed<import("../index.js").ParsedNode>;
|
|
@@ -20,8 +20,6 @@ function resolveFlowCollection({ composeNode, composeEmptyNode }, ctx, fc, onErr
|
|
|
20
20
|
const atRoot = ctx.atRoot;
|
|
21
21
|
if (atRoot)
|
|
22
22
|
ctx.atRoot = false;
|
|
23
|
-
if (ctx.atKey)
|
|
24
|
-
ctx.atKey = false;
|
|
25
23
|
let offset = fc.offset + fc.start.source.length;
|
|
26
24
|
for (let i = 0; i < fc.items.length; ++i) {
|
|
27
25
|
const collItem = fc.items[i];
|
|
@@ -101,14 +99,12 @@ function resolveFlowCollection({ composeNode, composeEmptyNode }, ctx, fc, onErr
|
|
|
101
99
|
else {
|
|
102
100
|
// item is a key+value pair
|
|
103
101
|
// key value
|
|
104
|
-
ctx.atKey = true;
|
|
105
102
|
const keyStart = props.end;
|
|
106
103
|
const keyNode = key
|
|
107
104
|
? composeNode(ctx, key, props, onError)
|
|
108
105
|
: composeEmptyNode(ctx, keyStart, start, null, props, onError);
|
|
109
106
|
if (isBlock(key))
|
|
110
107
|
onError(keyNode.range, 'BLOCK_IN_FLOW', blockMsg);
|
|
111
|
-
ctx.atKey = false;
|
|
112
108
|
// value properties
|
|
113
109
|
const valueProps = resolveProps.resolveProps(sep ?? [], {
|
|
114
110
|
flow: fcName,
|
|
@@ -135,7 +131,7 @@ function resolveFlowCollection({ composeNode, composeEmptyNode }, ctx, fc, onErr
|
|
|
135
131
|
}
|
|
136
132
|
}
|
|
137
133
|
else if (value) {
|
|
138
|
-
if ('source' in value && value.source
|
|
134
|
+
if ('source' in value && value.source && value.source[0] === ':')
|
|
139
135
|
onError(value, 'MISSING_CHAR', `Missing space after : in ${fcName}`);
|
|
140
136
|
else
|
|
141
137
|
onError(valueProps.start, 'MISSING_CHAR', `Missing , or : between ${fcName} items`);
|
|
@@ -169,8 +165,6 @@ function resolveFlowCollection({ composeNode, composeEmptyNode }, ctx, fc, onErr
|
|
|
169
165
|
const map = new YAMLMap.YAMLMap(ctx.schema);
|
|
170
166
|
map.flow = true;
|
|
171
167
|
map.items.push(pair);
|
|
172
|
-
const endRange = (valueNode ?? keyNode).range;
|
|
173
|
-
map.range = [keyNode.range[0], endRange[1], endRange[2]];
|
|
174
168
|
coll.items.push(map);
|
|
175
169
|
}
|
|
176
170
|
offset = valueNode ? valueNode.range[2] : valueProps.end;
|
|
@@ -179,7 +173,7 @@ function resolveFlowCollection({ composeNode, composeEmptyNode }, ctx, fc, onErr
|
|
|
179
173
|
const expectedEnd = isMap ? '}' : ']';
|
|
180
174
|
const [ce, ...ee] = fc.end;
|
|
181
175
|
let cePos = offset;
|
|
182
|
-
if (ce
|
|
176
|
+
if (ce && ce.source === expectedEnd)
|
|
183
177
|
cePos = ce.offset + ce.source.length;
|
|
184
178
|
else {
|
|
185
179
|
const name = fcName[0].toUpperCase() + fcName.substring(1);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { Scalar } from '../nodes/Scalar';
|
|
3
|
-
import type { FlowScalar } from '../parse/cst';
|
|
4
|
-
import type { ComposeErrorHandler } from './composer';
|
|
1
|
+
import { Range } from '../nodes/Node.js';
|
|
2
|
+
import { Scalar } from '../nodes/Scalar.js';
|
|
3
|
+
import type { FlowScalar } from '../parse/cst.js';
|
|
4
|
+
import type { ComposeErrorHandler } from './composer.js';
|
|
5
5
|
export declare function resolveFlowScalar(scalar: FlowScalar, strict: boolean, onError: ComposeErrorHandler): {
|
|
6
6
|
value: string;
|
|
7
7
|
type: Scalar.PLAIN | Scalar.QUOTE_DOUBLE | Scalar.QUOTE_SINGLE | null;
|
|
@@ -86,7 +86,7 @@ function foldLines(source) {
|
|
|
86
86
|
first = new RegExp('(.*?)(?<![ \t])[ \t]*\r?\n', 'sy');
|
|
87
87
|
line = new RegExp('[ \t]*(.*?)(?:(?<![ \t])[ \t]*)?\r?\n', 'sy');
|
|
88
88
|
}
|
|
89
|
-
catch {
|
|
89
|
+
catch (_) {
|
|
90
90
|
first = /(.*?)[ \t]*\r?\n/sy;
|
|
91
91
|
line = /[ \t]*(.*?)[ \t]*\r?\n/sy;
|
|
92
92
|
}
|
|
@@ -144,7 +144,7 @@ function doubleQuotedValue(source, onError) {
|
|
|
144
144
|
next = source[++i + 1];
|
|
145
145
|
}
|
|
146
146
|
else if (next === 'x' || next === 'u' || next === 'U') {
|
|
147
|
-
const length =
|
|
147
|
+
const length = { x: 2, u: 4, U: 8 }[next];
|
|
148
148
|
res += parseCharCode(source, i + 1, length, onError);
|
|
149
149
|
i += length;
|
|
150
150
|
}
|
|
@@ -214,14 +214,12 @@ function parseCharCode(source, offset, length, onError) {
|
|
|
214
214
|
const cc = source.substr(offset, length);
|
|
215
215
|
const ok = cc.length === length && /^[0-9a-fA-F]+$/.test(cc);
|
|
216
216
|
const code = ok ? parseInt(cc, 16) : NaN;
|
|
217
|
-
|
|
218
|
-
return String.fromCodePoint(code);
|
|
219
|
-
}
|
|
220
|
-
catch {
|
|
217
|
+
if (isNaN(code)) {
|
|
221
218
|
const raw = source.substr(offset - 2, length + 2);
|
|
222
219
|
onError(offset - 2, 'BAD_DQ_ESCAPE', `Invalid escape sequence ${raw}`);
|
|
223
220
|
return raw;
|
|
224
221
|
}
|
|
222
|
+
return String.fromCodePoint(code);
|
|
225
223
|
}
|
|
226
224
|
|
|
227
225
|
exports.resolveFlowScalar = resolveFlowScalar;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { SourceToken, Token } from '../parse/cst';
|
|
2
|
-
import type { ComposeErrorHandler } from './composer';
|
|
1
|
+
import type { SourceToken, Token } from '../parse/cst.js';
|
|
2
|
+
import type { ComposeErrorHandler } from './composer.js';
|
|
3
3
|
export interface ResolvePropsArg {
|
|
4
4
|
flow?: 'flow map' | 'flow sequence';
|
|
5
5
|
indicator: 'doc-start' | 'explicit-key-ind' | 'map-value-ind' | 'seq-item-ind';
|
|
@@ -57,7 +57,7 @@ function resolveProps(tokens, { flow, indicator, next, offset, onError, parentIn
|
|
|
57
57
|
if (atNewline) {
|
|
58
58
|
if (comment)
|
|
59
59
|
comment += token.source;
|
|
60
|
-
else
|
|
60
|
+
else
|
|
61
61
|
spaceBefore = true;
|
|
62
62
|
}
|
|
63
63
|
else
|
|
@@ -74,7 +74,8 @@ function resolveProps(tokens, { flow, indicator, next, offset, onError, parentIn
|
|
|
74
74
|
if (token.source.endsWith(':'))
|
|
75
75
|
onError(token.offset + token.source.length - 1, 'BAD_ALIAS', 'Anchor ending in : is ambiguous', true);
|
|
76
76
|
anchor = token;
|
|
77
|
-
|
|
77
|
+
if (start === null)
|
|
78
|
+
start = token.offset;
|
|
78
79
|
atNewline = false;
|
|
79
80
|
hasSpace = false;
|
|
80
81
|
reqSpace = true;
|
|
@@ -83,7 +84,8 @@ function resolveProps(tokens, { flow, indicator, next, offset, onError, parentIn
|
|
|
83
84
|
if (tag)
|
|
84
85
|
onError(token, 'MULTIPLE_TAGS', 'A node can have at most one tag');
|
|
85
86
|
tag = token;
|
|
86
|
-
|
|
87
|
+
if (start === null)
|
|
88
|
+
start = token.offset;
|
|
87
89
|
atNewline = false;
|
|
88
90
|
hasSpace = false;
|
|
89
91
|
reqSpace = true;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { Token } from '../parse/cst';
|
|
1
|
+
import type { Token } from '../parse/cst.js';
|
|
2
2
|
export declare function containsNewline(key: Token | null | undefined): boolean | null;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { Token } from '../parse/cst';
|
|
1
|
+
import type { Token } from '../parse/cst.js';
|
|
2
2
|
export declare function emptyScalarPosition(offset: number, before: Token[] | undefined, pos: number | null): number;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import { Token } from '../parse/cst';
|
|
2
|
+
import { ComposeErrorHandler } from './composer';
|
|
3
3
|
export declare function flowIndentCheck(indent: number, fc: Token | null | undefined, onError: ComposeErrorHandler): void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ParsedNode } from '../nodes/Node';
|
|
2
|
-
import type { Pair } from '../nodes/Pair';
|
|
3
|
-
import type { ComposeContext } from './compose-node';
|
|
1
|
+
import type { ParsedNode } from '../nodes/Node.js';
|
|
2
|
+
import type { Pair } from '../nodes/Pair.js';
|
|
3
|
+
import type { ComposeContext } from './compose-node.js';
|
|
4
4
|
export declare function mapIncludes(ctx: ComposeContext, items: Pair<ParsedNode>[], search: ParsedNode): boolean;
|
|
@@ -8,7 +8,11 @@ function mapIncludes(ctx, items, search) {
|
|
|
8
8
|
return false;
|
|
9
9
|
const isEqual = typeof uniqueKeys === 'function'
|
|
10
10
|
? uniqueKeys
|
|
11
|
-
: (a, b) => a === b ||
|
|
11
|
+
: (a, b) => a === b ||
|
|
12
|
+
(identity.isScalar(a) &&
|
|
13
|
+
identity.isScalar(b) &&
|
|
14
|
+
a.value === b.value &&
|
|
15
|
+
!(a.value === '<<' && ctx.schema.merge));
|
|
12
16
|
return items.some(pair => isEqual(pair.key, search));
|
|
13
17
|
}
|
|
14
18
|
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import type { YAMLError, YAMLWarning } from '../errors';
|
|
2
|
-
import { Alias } from '../nodes/Alias';
|
|
3
|
-
import { NODE_TYPE } from '../nodes/identity';
|
|
4
|
-
import type { Node, NodeType, ParsedNode, Range } from '../nodes/Node';
|
|
5
|
-
import { Pair } from '../nodes/Pair';
|
|
6
|
-
import type { Scalar } from '../nodes/Scalar';
|
|
7
|
-
import type { YAMLMap } from '../nodes/YAMLMap';
|
|
8
|
-
import type { YAMLSeq } from '../nodes/YAMLSeq';
|
|
9
|
-
import type { CreateNodeOptions, DocumentOptions, ParseOptions, SchemaOptions, ToJSOptions, ToStringOptions } from '../options';
|
|
10
|
-
import { Schema } from '../schema/Schema';
|
|
11
|
-
import { Directives } from './directives';
|
|
1
|
+
import type { YAMLError, YAMLWarning } from '../errors.js';
|
|
2
|
+
import { Alias } from '../nodes/Alias.js';
|
|
3
|
+
import { NODE_TYPE } from '../nodes/identity.js';
|
|
4
|
+
import type { Node, NodeType, ParsedNode, Range } from '../nodes/Node.js';
|
|
5
|
+
import { Pair } from '../nodes/Pair.js';
|
|
6
|
+
import type { Scalar } from '../nodes/Scalar.js';
|
|
7
|
+
import type { YAMLMap } from '../nodes/YAMLMap.js';
|
|
8
|
+
import type { YAMLSeq } from '../nodes/YAMLSeq.js';
|
|
9
|
+
import type { CreateNodeOptions, DocumentOptions, ParseOptions, SchemaOptions, ToJSOptions, ToStringOptions } from '../options.js';
|
|
10
|
+
import { Schema } from '../schema/Schema.js';
|
|
11
|
+
import { Directives } from './directives.js';
|
|
12
12
|
export type Replacer = any[] | ((key: any, value: any) => unknown);
|
|
13
13
|
export declare namespace Document {
|
|
14
14
|
/** @ts-ignore The typing of directives fails in TS <= 4.2 */
|
|
@@ -37,7 +37,6 @@ class Document {
|
|
|
37
37
|
logLevel: 'warn',
|
|
38
38
|
prettyErrors: true,
|
|
39
39
|
strict: true,
|
|
40
|
-
stringKeys: false,
|
|
41
40
|
uniqueKeys: true,
|
|
42
41
|
version: '1.2'
|
|
43
42
|
}, options);
|
|
@@ -261,7 +260,7 @@ class Document {
|
|
|
261
260
|
this.directives.yaml.version = '1.1';
|
|
262
261
|
else
|
|
263
262
|
this.directives = new directives.Directives({ version: '1.1' });
|
|
264
|
-
opt = { resolveKnownTags: false, schema: 'yaml-1.1' };
|
|
263
|
+
opt = { merge: true, resolveKnownTags: false, schema: 'yaml-1.1' };
|
|
265
264
|
break;
|
|
266
265
|
case '1.2':
|
|
267
266
|
case 'next':
|
|
@@ -269,7 +268,7 @@ class Document {
|
|
|
269
268
|
this.directives.yaml.version = version;
|
|
270
269
|
else
|
|
271
270
|
this.directives = new directives.Directives({ version });
|
|
272
|
-
opt = { resolveKnownTags: true, schema: 'core' };
|
|
271
|
+
opt = { merge: false, resolveKnownTags: true, schema: 'core' };
|
|
273
272
|
break;
|
|
274
273
|
case null:
|
|
275
274
|
if (this.directives)
|