@swagger-api/apidom-ast 0.92.0 → 0.94.0
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/CHANGELOG.md +10 -0
- package/cjs/Error.cjs +12 -13
- package/cjs/Literal.cjs +10 -11
- package/cjs/Node.cjs +26 -32
- package/cjs/ParseResult.cjs +5 -12
- package/cjs/Position.cjs +25 -32
- package/cjs/index.cjs +9 -1
- package/cjs/json/nodes/JsonArray.cjs +5 -11
- package/cjs/json/nodes/JsonDocument.cjs +5 -12
- package/cjs/json/nodes/JsonEscapeSequence.cjs +3 -6
- package/cjs/json/nodes/JsonFalse.cjs +3 -6
- package/cjs/json/nodes/JsonKey.cjs +3 -6
- package/cjs/json/nodes/JsonNode.cjs +1 -2
- package/cjs/json/nodes/JsonNull.cjs +3 -6
- package/cjs/json/nodes/JsonNumber.cjs +3 -6
- package/cjs/json/nodes/JsonObject.cjs +5 -11
- package/cjs/json/nodes/JsonProperty.cjs +8 -17
- package/cjs/json/nodes/JsonString.cjs +8 -16
- package/cjs/json/nodes/JsonStringContent.cjs +3 -6
- package/cjs/json/nodes/JsonTrue.cjs +3 -6
- package/cjs/json/nodes/JsonValue.cjs +11 -12
- package/cjs/json/nodes/predicates.cjs +24 -12
- package/cjs/predicates.cjs +9 -5
- package/cjs/yaml/anchors-aliases/ReferenceManager.cjs +28 -0
- package/cjs/yaml/errors/YamlError.cjs +7 -0
- package/cjs/yaml/errors/YamlReferenceError.cjs +8 -0
- package/cjs/yaml/errors/YamlSchemaError.cjs +3 -2
- package/cjs/yaml/errors/YamlTagError.cjs +6 -0
- package/cjs/yaml/nodes/YamlAlias.cjs +11 -12
- package/cjs/yaml/nodes/YamlAnchor.cjs +11 -12
- package/cjs/yaml/nodes/YamlCollection.cjs +1 -2
- package/cjs/yaml/nodes/YamlComment.cjs +11 -12
- package/cjs/yaml/nodes/YamlDirective.cjs +16 -17
- package/cjs/yaml/nodes/YamlDocument.cjs +3 -6
- package/cjs/yaml/nodes/YamlKeyValuePair.cjs +29 -27
- package/cjs/yaml/nodes/YamlMapping.cjs +7 -13
- package/cjs/yaml/nodes/YamlNode.cjs +16 -15
- package/cjs/yaml/nodes/YamlScalar.cjs +11 -12
- package/cjs/yaml/nodes/YamlSequence.cjs +10 -16
- package/cjs/yaml/nodes/YamlStream.cjs +7 -15
- package/cjs/yaml/nodes/YamlStyle.cjs +2 -11
- package/cjs/yaml/nodes/YamlTag.cjs +12 -13
- package/cjs/yaml/nodes/predicates.cjs +23 -11
- package/cjs/yaml/schemas/ScalarTag.cjs +23 -32
- package/cjs/yaml/schemas/Tag.cjs +16 -7
- package/cjs/yaml/schemas/failsafe/GenericMapping.cjs +7 -19
- package/cjs/yaml/schemas/failsafe/GenericSequence.cjs +7 -19
- package/cjs/yaml/schemas/failsafe/GenericString.cjs +3 -16
- package/cjs/yaml/schemas/failsafe/index.cjs +83 -87
- package/cjs/yaml/schemas/json/Boolean.cjs +13 -21
- package/cjs/yaml/schemas/json/FloatingPoint.cjs +13 -21
- package/cjs/yaml/schemas/json/Integer.cjs +13 -21
- package/cjs/yaml/schemas/json/Null.cjs +12 -20
- package/cjs/yaml/schemas/json/index.cjs +20 -26
- package/dist/apidom-ast.browser.js +1672 -1889
- package/dist/apidom-ast.browser.min.js +1 -1
- package/es/Error.mjs +12 -13
- package/es/Literal.mjs +10 -11
- package/es/Node.mjs +26 -31
- package/es/ParseResult.mjs +5 -12
- package/es/Position.mjs +24 -31
- package/es/index.mjs +4 -1
- package/es/json/nodes/JsonArray.mjs +5 -11
- package/es/json/nodes/JsonDocument.mjs +5 -12
- package/es/json/nodes/JsonEscapeSequence.mjs +3 -6
- package/es/json/nodes/JsonFalse.mjs +3 -6
- package/es/json/nodes/JsonKey.mjs +3 -6
- package/es/json/nodes/JsonNode.mjs +1 -2
- package/es/json/nodes/JsonNull.mjs +3 -6
- package/es/json/nodes/JsonNumber.mjs +3 -6
- package/es/json/nodes/JsonObject.mjs +5 -11
- package/es/json/nodes/JsonProperty.mjs +8 -17
- package/es/json/nodes/JsonString.mjs +8 -16
- package/es/json/nodes/JsonStringContent.mjs +3 -6
- package/es/json/nodes/JsonTrue.mjs +3 -6
- package/es/json/nodes/JsonValue.mjs +11 -12
- package/es/json/nodes/predicates.mjs +12 -12
- package/es/predicates.mjs +5 -5
- package/es/yaml/anchors-aliases/ReferenceManager.mjs +24 -0
- package/es/yaml/errors/YamlError.mjs +3 -0
- package/es/yaml/errors/YamlReferenceError.mjs +3 -0
- package/es/yaml/errors/YamlSchemaError.mjs +2 -2
- package/es/yaml/errors/YamlTagError.mjs +6 -0
- package/es/yaml/nodes/YamlAlias.mjs +11 -12
- package/es/yaml/nodes/YamlAnchor.mjs +11 -12
- package/es/yaml/nodes/YamlCollection.mjs +1 -2
- package/es/yaml/nodes/YamlComment.mjs +11 -12
- package/es/yaml/nodes/YamlDirective.mjs +16 -17
- package/es/yaml/nodes/YamlDocument.mjs +3 -6
- package/es/yaml/nodes/YamlKeyValuePair.mjs +29 -27
- package/es/yaml/nodes/YamlMapping.mjs +7 -13
- package/es/yaml/nodes/YamlNode.mjs +16 -15
- package/es/yaml/nodes/YamlScalar.mjs +11 -12
- package/es/yaml/nodes/YamlSequence.mjs +10 -16
- package/es/yaml/nodes/YamlStream.mjs +7 -15
- package/es/yaml/nodes/YamlStyle.mjs +1 -9
- package/es/yaml/nodes/YamlTag.mjs +12 -13
- package/es/yaml/nodes/predicates.mjs +11 -10
- package/es/yaml/schemas/ScalarTag.mjs +23 -31
- package/es/yaml/schemas/Tag.mjs +17 -6
- package/es/yaml/schemas/failsafe/GenericMapping.mjs +8 -19
- package/es/yaml/schemas/failsafe/GenericSequence.mjs +8 -19
- package/es/yaml/schemas/failsafe/GenericString.mjs +3 -16
- package/es/yaml/schemas/failsafe/index.mjs +86 -90
- package/es/yaml/schemas/json/Boolean.mjs +14 -21
- package/es/yaml/schemas/json/FloatingPoint.mjs +14 -21
- package/es/yaml/schemas/json/Integer.mjs +14 -21
- package/es/yaml/schemas/json/Null.mjs +13 -20
- package/es/yaml/schemas/json/index.mjs +24 -30
- package/package.json +3 -4
- package/types/dist.d.ts +236 -158
@@ -1,16 +1,9 @@
|
|
1
|
-
import stampit from 'stampit';
|
2
1
|
import { head } from 'ramda';
|
3
2
|
import JsonNode from "./JsonNode.mjs";
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
methods: {
|
9
|
-
// @ts-ignore
|
10
|
-
get child() {
|
11
|
-
// @ts-ignore
|
12
|
-
return head(this.children);
|
13
|
-
}
|
3
|
+
class JsonDocument extends JsonNode {
|
4
|
+
static type = 'document';
|
5
|
+
get child() {
|
6
|
+
return head(this.children);
|
14
7
|
}
|
15
|
-
}
|
8
|
+
}
|
16
9
|
export default JsonDocument;
|
@@ -1,8 +1,5 @@
|
|
1
|
-
import stampit from 'stampit';
|
2
1
|
import JsonValue from "./JsonValue.mjs";
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
}
|
7
|
-
});
|
2
|
+
class JsonEscapeSequence extends JsonValue {
|
3
|
+
static type = 'escapeSequence';
|
4
|
+
}
|
8
5
|
export default JsonEscapeSequence;
|
@@ -1,15 +1,9 @@
|
|
1
|
-
import stampit from 'stampit';
|
2
1
|
import JsonNode from "./JsonNode.mjs";
|
3
2
|
import { isProperty } from "./predicates.mjs";
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
methods: {
|
9
|
-
get properties() {
|
10
|
-
// @ts-ignore
|
11
|
-
return this.children.filter(isProperty);
|
12
|
-
}
|
3
|
+
class JsonObject extends JsonNode {
|
4
|
+
static type = 'object';
|
5
|
+
get properties() {
|
6
|
+
return this.children.filter(isProperty);
|
13
7
|
}
|
14
|
-
}
|
8
|
+
}
|
15
9
|
export default JsonObject;
|
@@ -1,21 +1,12 @@
|
|
1
|
-
import stampit from 'stampit';
|
2
1
|
import JsonNode from "./JsonNode.mjs";
|
3
2
|
import { isArray, isFalse, isKey, isNull, isNumber, isObject, isString, isTrue } from "./predicates.mjs";
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
methods: {
|
9
|
-
// @ts-ignore
|
10
|
-
get key() {
|
11
|
-
// @ts-ignore
|
12
|
-
return this.children.find(isKey);
|
13
|
-
},
|
14
|
-
// @ts-ignore
|
15
|
-
get value() {
|
16
|
-
// @ts-ignore
|
17
|
-
return this.children.find(node => isFalse(node) || isTrue(node) || isNull(node) || isNumber(node) || isString(node) || isArray(node) || isObject(node));
|
18
|
-
}
|
3
|
+
class JsonProperty extends JsonNode {
|
4
|
+
static type = 'property';
|
5
|
+
get key() {
|
6
|
+
return this.children.find(isKey);
|
19
7
|
}
|
20
|
-
|
8
|
+
get value() {
|
9
|
+
return this.children.find(node => isFalse(node) || isTrue(node) || isNull(node) || isNumber(node) || isString(node) || isArray(node) || isObject(node));
|
10
|
+
}
|
11
|
+
}
|
21
12
|
export default JsonProperty;
|
@@ -1,21 +1,13 @@
|
|
1
|
-
import stampit from 'stampit';
|
2
1
|
import JsonNode from "./JsonNode.mjs";
|
3
2
|
import { isEscapeSequence, isStringContent } from "./predicates.mjs";
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
// @ts-ignore
|
11
|
-
if (this.children.length === 1) {
|
12
|
-
// @ts-ignore
|
13
|
-
return this.children[0].value;
|
14
|
-
}
|
15
|
-
return this.children
|
16
|
-
// @ts-ignore
|
17
|
-
.filter(node => isStringContent(node) || isEscapeSequence(node)).reduce((acc, cur) => acc + cur.value, '');
|
3
|
+
class JsonString extends JsonNode {
|
4
|
+
static type = 'string';
|
5
|
+
get value() {
|
6
|
+
if (this.children.length === 1) {
|
7
|
+
const onlyChild = this.children[0];
|
8
|
+
return onlyChild.value;
|
18
9
|
}
|
10
|
+
return this.children.filter(node => isStringContent(node) || isEscapeSequence(node)).reduce((acc, cur) => acc + cur.value, '');
|
19
11
|
}
|
20
|
-
}
|
12
|
+
}
|
21
13
|
export default JsonString;
|
@@ -1,8 +1,5 @@
|
|
1
|
-
import stampit from 'stampit';
|
2
1
|
import JsonValue from "./JsonValue.mjs";
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
}
|
7
|
-
});
|
2
|
+
class JsonStringContent extends JsonValue {
|
3
|
+
static type = 'stringContent';
|
4
|
+
}
|
8
5
|
export default JsonStringContent;
|
@@ -1,16 +1,15 @@
|
|
1
|
-
import stampit from 'stampit';
|
2
1
|
import JsonNode from "./JsonNode.mjs";
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
}
|
10
|
-
|
11
|
-
|
12
|
-
|
2
|
+
class JsonValue extends JsonNode {
|
3
|
+
static type = 'value';
|
4
|
+
value;
|
5
|
+
constructor({
|
6
|
+
value,
|
7
|
+
...rest
|
8
|
+
}) {
|
9
|
+
super({
|
10
|
+
...rest
|
11
|
+
});
|
13
12
|
this.value = value;
|
14
13
|
}
|
15
|
-
}
|
14
|
+
}
|
16
15
|
export default JsonValue;
|
@@ -1,13 +1,13 @@
|
|
1
1
|
import { isNodeType } from "../../predicates.mjs";
|
2
|
-
export const isDocument = isNodeType
|
3
|
-
export const isString = isNodeType
|
4
|
-
export const isFalse = isNodeType
|
5
|
-
export const isTrue = isNodeType
|
6
|
-
export const isNull = isNodeType
|
7
|
-
export const isNumber = isNodeType
|
8
|
-
export const isArray = isNodeType
|
9
|
-
export const isObject = isNodeType
|
10
|
-
export const isStringContent = isNodeType
|
11
|
-
export const isEscapeSequence = isNodeType
|
12
|
-
export const isProperty = isNodeType
|
13
|
-
export const isKey = isNodeType
|
2
|
+
export const isDocument = node => isNodeType('document', node);
|
3
|
+
export const isString = node => isNodeType('string', node);
|
4
|
+
export const isFalse = node => isNodeType('false', node);
|
5
|
+
export const isTrue = node => isNodeType('true', node);
|
6
|
+
export const isNull = node => isNodeType('null', node);
|
7
|
+
export const isNumber = node => isNodeType('number', node);
|
8
|
+
export const isArray = node => isNodeType('array', node);
|
9
|
+
export const isObject = node => isNodeType('object', node);
|
10
|
+
export const isStringContent = node => isNodeType('stringContent', node);
|
11
|
+
export const isEscapeSequence = node => isNodeType('escapeSequence', node);
|
12
|
+
export const isProperty = node => isNodeType('property', node);
|
13
|
+
export const isKey = node => isNodeType('key', node);
|
package/es/predicates.mjs
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
export const isNodeType = (type, node) =>
|
2
|
-
export const isLiteral = isNodeType
|
3
|
-
export const isPosition = isNodeType
|
4
|
-
export const isPoint = isNodeType
|
5
|
-
export const isParseResult = isNodeType
|
1
|
+
export const isNodeType = (type, node) => node != null && typeof node === 'object' && 'type' in node && node.type === type;
|
2
|
+
export const isLiteral = node => isNodeType('literal', node);
|
3
|
+
export const isPosition = node => isNodeType('position', node);
|
4
|
+
export const isPoint = node => isNodeType('point', node);
|
5
|
+
export const isParseResult = node => isNodeType('parseResult', node);
|
@@ -0,0 +1,24 @@
|
|
1
|
+
import YamlScalar from "../nodes/YamlScalar.mjs";
|
2
|
+
import YamlReferenceError from "../errors/YamlReferenceError.mjs";
|
3
|
+
import { isAnchor } from "../nodes/predicates.mjs";
|
4
|
+
import { YamlStyle, YamlStyleGroup } from "../nodes/YamlStyle.mjs";
|
5
|
+
/* eslint-disable class-methods-use-this */
|
6
|
+
class ReferenceManager {
|
7
|
+
addAnchor(node) {
|
8
|
+
if (!isAnchor(node.anchor)) {
|
9
|
+
throw new YamlReferenceError('Expected YAML anchor to be attached the the YAML AST node.', {
|
10
|
+
node
|
11
|
+
});
|
12
|
+
}
|
13
|
+
}
|
14
|
+
resolveAlias(alias) {
|
15
|
+
return new YamlScalar({
|
16
|
+
content: alias.content,
|
17
|
+
style: YamlStyle.Plain,
|
18
|
+
styleGroup: YamlStyleGroup.Flow
|
19
|
+
});
|
20
|
+
}
|
21
|
+
}
|
22
|
+
/* eslint-enable class-methods-use-this */
|
23
|
+
|
24
|
+
export default ReferenceManager;
|
@@ -1,3 +1,3 @@
|
|
1
|
-
import
|
2
|
-
class YamlSchemaError extends
|
1
|
+
import YamlError from "./YamlError.mjs";
|
2
|
+
class YamlSchemaError extends YamlError {}
|
3
3
|
export default YamlSchemaError;
|
@@ -1,5 +1,11 @@
|
|
1
1
|
import YamlSchemaError from "./YamlSchemaError.mjs";
|
2
2
|
class YamlTagError extends YamlSchemaError {
|
3
|
+
specificTagName;
|
4
|
+
explicitTagName;
|
5
|
+
tagKind;
|
6
|
+
tagPosition;
|
7
|
+
nodeCanonicalContent;
|
8
|
+
node;
|
3
9
|
constructor(message, structuredOptions) {
|
4
10
|
super(message, structuredOptions);
|
5
11
|
if (typeof structuredOptions !== 'undefined') {
|
@@ -1,16 +1,15 @@
|
|
1
|
-
import stampit from 'stampit';
|
2
1
|
import Node from "../../Node.mjs";
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
}
|
10
|
-
|
11
|
-
|
12
|
-
|
2
|
+
class YamlAlias extends Node {
|
3
|
+
static type = 'alias';
|
4
|
+
content;
|
5
|
+
constructor({
|
6
|
+
content,
|
7
|
+
...rest
|
8
|
+
}) {
|
9
|
+
super({
|
10
|
+
...rest
|
11
|
+
});
|
13
12
|
this.content = content;
|
14
13
|
}
|
15
|
-
}
|
14
|
+
}
|
16
15
|
export default YamlAlias;
|
@@ -1,16 +1,15 @@
|
|
1
|
-
import stampit from 'stampit';
|
2
1
|
import Node from "../../Node.mjs";
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
}
|
10
|
-
|
11
|
-
|
12
|
-
|
2
|
+
class YamlAnchor extends Node {
|
3
|
+
static type = 'anchor';
|
4
|
+
name;
|
5
|
+
constructor({
|
6
|
+
name,
|
7
|
+
...rest
|
8
|
+
}) {
|
9
|
+
super({
|
10
|
+
...rest
|
11
|
+
});
|
13
12
|
this.name = name;
|
14
13
|
}
|
15
|
-
}
|
14
|
+
}
|
16
15
|
export default YamlAnchor;
|
@@ -1,16 +1,15 @@
|
|
1
|
-
import stampit from 'stampit';
|
2
1
|
import Node from "../../Node.mjs";
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
}
|
10
|
-
|
11
|
-
|
12
|
-
|
2
|
+
class YamlComment extends Node {
|
3
|
+
static type = 'comment';
|
4
|
+
content;
|
5
|
+
constructor({
|
6
|
+
content,
|
7
|
+
...rest
|
8
|
+
}) {
|
9
|
+
super({
|
10
|
+
...rest
|
11
|
+
});
|
13
12
|
this.content = content;
|
14
13
|
}
|
15
|
-
}
|
14
|
+
}
|
16
15
|
export default YamlComment;
|
@@ -1,24 +1,23 @@
|
|
1
|
-
import stampit from 'stampit';
|
2
1
|
import { mergeRight } from 'ramda';
|
3
2
|
import Node from "../../Node.mjs";
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
name
|
10
|
-
parameters
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
3
|
+
class YamlDirective extends Node {
|
4
|
+
static type = 'directive';
|
5
|
+
name;
|
6
|
+
parameters;
|
7
|
+
constructor({
|
8
|
+
name,
|
9
|
+
parameters,
|
10
|
+
...rest
|
11
|
+
}) {
|
12
|
+
super({
|
13
|
+
...rest
|
14
|
+
});
|
16
15
|
this.name = name;
|
17
16
|
this.parameters = mergeRight({
|
18
|
-
version:
|
19
|
-
handle:
|
20
|
-
prefix:
|
17
|
+
version: undefined,
|
18
|
+
handle: undefined,
|
19
|
+
prefix: undefined
|
21
20
|
}, parameters);
|
22
21
|
}
|
23
|
-
}
|
22
|
+
}
|
24
23
|
export default YamlDirective;
|
@@ -1,34 +1,36 @@
|
|
1
|
-
import stampit from 'stampit';
|
2
1
|
import Node from "../../Node.mjs";
|
3
|
-
import YamlStyleModel from "./YamlStyle.mjs";
|
4
2
|
import { isScalar, isMapping, isSequence, isAlias } from "./predicates.mjs";
|
5
|
-
|
6
|
-
|
7
|
-
|
3
|
+
class YamlKeyValuePair extends Node {
|
4
|
+
static type = 'keyValuePair';
|
5
|
+
styleGroup;
|
6
|
+
constructor({
|
7
|
+
styleGroup,
|
8
|
+
...rest
|
9
|
+
}) {
|
10
|
+
super({
|
11
|
+
...rest
|
12
|
+
});
|
13
|
+
this.styleGroup = styleGroup;
|
14
|
+
}
|
15
|
+
}
|
16
|
+
Object.defineProperties(YamlKeyValuePair.prototype, {
|
17
|
+
key: {
|
18
|
+
get() {
|
19
|
+
return this.children.filter(node => isScalar(node) || isMapping(node) || isSequence(node))[0];
|
20
|
+
},
|
21
|
+
enumerable: true
|
8
22
|
},
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
}
|
15
|
-
|
23
|
+
value: {
|
24
|
+
get() {
|
25
|
+
const {
|
26
|
+
key,
|
27
|
+
children
|
28
|
+
} = this;
|
29
|
+
const excludeKeyPredicate = node => node !== key;
|
30
|
+
const valuePredicate = node => isScalar(node) || isMapping(node) || isSequence(node) || isAlias(node);
|
31
|
+
return children.filter(node => excludeKeyPredicate(node) && valuePredicate(node))[0];
|
16
32
|
},
|
17
|
-
|
18
|
-
get() {
|
19
|
-
// @ts-ignore
|
20
|
-
const {
|
21
|
-
key,
|
22
|
-
children
|
23
|
-
} = this;
|
24
|
-
const excludeKeyPredicate = node => node !== key;
|
25
|
-
const valuePredicate = node => isScalar(node) || isMapping(node) || isSequence(node) || isAlias(node);
|
26
|
-
|
27
|
-
// @ts-ignore
|
28
|
-
return children.filter(node => excludeKeyPredicate(node) && valuePredicate(node))[0];
|
29
|
-
},
|
30
|
-
enumerable: true
|
31
|
-
}
|
33
|
+
enumerable: true
|
32
34
|
}
|
33
35
|
});
|
34
36
|
export default YamlKeyValuePair;
|
@@ -1,18 +1,12 @@
|
|
1
|
-
import stampit from 'stampit';
|
2
1
|
import YamlCollection from "./YamlCollection.mjs";
|
3
2
|
import { isKeyValuePair } from "./predicates.mjs";
|
4
|
-
|
5
|
-
|
6
|
-
|
3
|
+
class YamlMapping extends YamlCollection {
|
4
|
+
static type = 'mapping';
|
5
|
+
}
|
6
|
+
Object.defineProperty(YamlMapping.prototype, 'content', {
|
7
|
+
get() {
|
8
|
+
return Array.isArray(this.children) ? this.children.filter(isKeyValuePair) : [];
|
7
9
|
},
|
8
|
-
|
9
|
-
content: {
|
10
|
-
get() {
|
11
|
-
// @ts-ignore
|
12
|
-
return Array.isArray(this.children) ? this.children.filter(isKeyValuePair) : [];
|
13
|
-
},
|
14
|
-
enumerable: true
|
15
|
-
}
|
16
|
-
}
|
10
|
+
enumerable: true
|
17
11
|
});
|
18
12
|
export default YamlMapping;
|
@@ -1,22 +1,23 @@
|
|
1
|
-
import stampit from 'stampit';
|
2
1
|
import Node from "../../Node.mjs";
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
2
|
+
class YamlNode extends Node {
|
3
|
+
anchor;
|
4
|
+
tag;
|
5
|
+
style;
|
6
|
+
styleGroup;
|
7
|
+
constructor({
|
8
|
+
anchor,
|
9
|
+
tag,
|
10
|
+
style,
|
11
|
+
styleGroup,
|
12
|
+
...rest
|
13
|
+
}) {
|
14
|
+
super({
|
15
|
+
...rest
|
16
|
+
});
|
16
17
|
this.anchor = anchor;
|
17
18
|
this.tag = tag;
|
18
19
|
this.style = style;
|
19
20
|
this.styleGroup = styleGroup;
|
20
21
|
}
|
21
|
-
}
|
22
|
+
}
|
22
23
|
export default YamlNode;
|
@@ -1,16 +1,15 @@
|
|
1
|
-
import stampit from 'stampit';
|
2
1
|
import YamlNode from "./YamlNode.mjs";
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
}
|
10
|
-
|
11
|
-
|
12
|
-
|
2
|
+
class YamlScalar extends YamlNode {
|
3
|
+
static type = 'scalar';
|
4
|
+
content;
|
5
|
+
constructor({
|
6
|
+
content,
|
7
|
+
...rest
|
8
|
+
}) {
|
9
|
+
super({
|
10
|
+
...rest
|
11
|
+
});
|
13
12
|
this.content = content;
|
14
13
|
}
|
15
|
-
}
|
14
|
+
}
|
16
15
|
export default YamlScalar;
|