@speclynx/apidom-parser-adapter-yaml-1-2 1.12.2 → 2.0.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/CHANGELOG.md +20 -0
- package/NOTICE +16 -7
- package/README.md +34 -7
- package/dist/167.apidom-parser-adapter-yaml-1-2.browser.min.js +1 -1
- package/dist/451.apidom-parser-adapter-yaml-1-2.browser.min.js +1 -1
- package/dist/apidom-parser-adapter-yaml-1-2.browser.js +19340 -16731
- package/dist/apidom-parser-adapter-yaml-1-2.browser.min.js +1 -1
- package/package.json +10 -9
- package/src/adapter.cjs +28 -16
- package/src/adapter.mjs +25 -15
- package/src/tree-sitter/index.cjs +44 -0
- package/src/tree-sitter/index.mjs +38 -0
- package/src/{lexical-analysis → tree-sitter/lexical-analysis}/index.cjs +1 -1
- package/src/{lexical-analysis → tree-sitter/lexical-analysis}/index.mjs +1 -1
- package/src/tree-sitter/syntactic-analysis/CstTransformer.cjs +625 -0
- package/src/tree-sitter/syntactic-analysis/CstTransformer.mjs +618 -0
- package/src/tree-sitter/syntactic-analysis/YamlAstTransformer.cjs +271 -0
- package/src/tree-sitter/syntactic-analysis/YamlAstTransformer.mjs +263 -0
- package/src/tree-sitter/syntactic-analysis/ast/Error.cjs +30 -0
- package/src/tree-sitter/syntactic-analysis/ast/Error.mjs +24 -0
- package/src/tree-sitter/syntactic-analysis/ast/Literal.cjs +27 -0
- package/src/tree-sitter/syntactic-analysis/ast/Literal.mjs +21 -0
- package/src/tree-sitter/syntactic-analysis/ast/Node.cjs +60 -0
- package/src/tree-sitter/syntactic-analysis/ast/Node.mjs +56 -0
- package/src/tree-sitter/syntactic-analysis/ast/ParseResult.cjs +17 -0
- package/src/tree-sitter/syntactic-analysis/ast/ParseResult.mjs +12 -0
- package/src/tree-sitter/syntactic-analysis/ast/anchors-aliases/ReferenceManager.cjs +23 -0
- package/src/tree-sitter/syntactic-analysis/ast/anchors-aliases/ReferenceManager.mjs +18 -0
- package/src/tree-sitter/syntactic-analysis/ast/errors/YamlError.cjs +10 -0
- package/src/tree-sitter/syntactic-analysis/ast/errors/YamlError.mjs +7 -0
- package/src/tree-sitter/syntactic-analysis/ast/errors/YamlSchemaError.cjs +11 -0
- package/src/tree-sitter/syntactic-analysis/ast/errors/YamlSchemaError.mjs +6 -0
- package/src/tree-sitter/syntactic-analysis/ast/errors/YamlTagError.cjs +43 -0
- package/src/tree-sitter/syntactic-analysis/ast/errors/YamlTagError.mjs +37 -0
- package/src/tree-sitter/syntactic-analysis/ast/nodes/YamlAlias.cjs +27 -0
- package/src/tree-sitter/syntactic-analysis/ast/nodes/YamlAlias.mjs +21 -0
- package/src/tree-sitter/syntactic-analysis/ast/nodes/YamlAnchor.cjs +27 -0
- package/src/tree-sitter/syntactic-analysis/ast/nodes/YamlAnchor.mjs +21 -0
- package/src/tree-sitter/syntactic-analysis/ast/nodes/YamlCollection.cjs +11 -0
- package/src/tree-sitter/syntactic-analysis/ast/nodes/YamlCollection.mjs +6 -0
- package/src/tree-sitter/syntactic-analysis/ast/nodes/YamlComment.cjs +27 -0
- package/src/tree-sitter/syntactic-analysis/ast/nodes/YamlComment.mjs +21 -0
- package/src/tree-sitter/syntactic-analysis/ast/nodes/YamlDirective.cjs +39 -0
- package/src/tree-sitter/syntactic-analysis/ast/nodes/YamlDirective.mjs +32 -0
- package/src/tree-sitter/syntactic-analysis/ast/nodes/YamlDocument.cjs +13 -0
- package/src/tree-sitter/syntactic-analysis/ast/nodes/YamlDocument.mjs +8 -0
- package/src/tree-sitter/syntactic-analysis/ast/nodes/YamlKeyValuePair.cjs +48 -0
- package/src/tree-sitter/syntactic-analysis/ast/nodes/YamlKeyValuePair.mjs +42 -0
- package/src/tree-sitter/syntactic-analysis/ast/nodes/YamlMapping.cjs +20 -0
- package/src/tree-sitter/syntactic-analysis/ast/nodes/YamlMapping.mjs +15 -0
- package/src/tree-sitter/syntactic-analysis/ast/nodes/YamlNode.cjs +35 -0
- package/src/tree-sitter/syntactic-analysis/ast/nodes/YamlNode.mjs +29 -0
- package/src/tree-sitter/syntactic-analysis/ast/nodes/YamlScalar.cjs +27 -0
- package/src/tree-sitter/syntactic-analysis/ast/nodes/YamlScalar.mjs +21 -0
- package/src/tree-sitter/syntactic-analysis/ast/nodes/YamlSequence.cjs +23 -0
- package/src/tree-sitter/syntactic-analysis/ast/nodes/YamlSequence.mjs +18 -0
- package/src/tree-sitter/syntactic-analysis/ast/nodes/YamlStream.cjs +20 -0
- package/src/tree-sitter/syntactic-analysis/ast/nodes/YamlStream.mjs +15 -0
- package/src/tree-sitter/syntactic-analysis/ast/nodes/YamlStyle.cjs +27 -0
- package/src/tree-sitter/syntactic-analysis/ast/nodes/YamlStyle.mjs +24 -0
- package/src/tree-sitter/syntactic-analysis/ast/nodes/YamlTag.cjs +38 -0
- package/src/tree-sitter/syntactic-analysis/ast/nodes/YamlTag.mjs +35 -0
- package/src/tree-sitter/syntactic-analysis/ast/nodes/predicates.cjs +26 -0
- package/src/tree-sitter/syntactic-analysis/ast/nodes/predicates.mjs +14 -0
- package/src/tree-sitter/syntactic-analysis/ast/schemas/ScalarTag.cjs +33 -0
- package/src/tree-sitter/syntactic-analysis/ast/schemas/ScalarTag.mjs +29 -0
- package/src/tree-sitter/syntactic-analysis/ast/schemas/Tag.cjs +20 -0
- package/src/tree-sitter/syntactic-analysis/ast/schemas/Tag.mjs +16 -0
- package/src/tree-sitter/syntactic-analysis/ast/schemas/canonical-format.cjs +127 -0
- package/src/tree-sitter/syntactic-analysis/ast/schemas/canonical-format.mjs +122 -0
- package/src/tree-sitter/syntactic-analysis/ast/schemas/failsafe/GenericMapping.cjs +14 -0
- package/src/tree-sitter/syntactic-analysis/ast/schemas/failsafe/GenericMapping.mjs +9 -0
- package/src/tree-sitter/syntactic-analysis/ast/schemas/failsafe/GenericSequence.cjs +14 -0
- package/src/tree-sitter/syntactic-analysis/ast/schemas/failsafe/GenericSequence.mjs +9 -0
- package/src/tree-sitter/syntactic-analysis/ast/schemas/failsafe/GenericString.cjs +10 -0
- package/src/tree-sitter/syntactic-analysis/ast/schemas/failsafe/GenericString.mjs +5 -0
- package/src/tree-sitter/syntactic-analysis/ast/schemas/failsafe/index.cjs +116 -0
- package/src/tree-sitter/syntactic-analysis/ast/schemas/failsafe/index.mjs +111 -0
- package/src/tree-sitter/syntactic-analysis/ast/schemas/json/Boolean.cjs +19 -0
- package/src/tree-sitter/syntactic-analysis/ast/schemas/json/Boolean.mjs +14 -0
- package/src/tree-sitter/syntactic-analysis/ast/schemas/json/FloatingPoint.cjs +19 -0
- package/src/tree-sitter/syntactic-analysis/ast/schemas/json/FloatingPoint.mjs +14 -0
- package/src/tree-sitter/syntactic-analysis/ast/schemas/json/Integer.cjs +19 -0
- package/src/tree-sitter/syntactic-analysis/ast/schemas/json/Integer.mjs +14 -0
- package/src/tree-sitter/syntactic-analysis/ast/schemas/json/Null.cjs +18 -0
- package/src/tree-sitter/syntactic-analysis/ast/schemas/json/Null.mjs +13 -0
- package/src/tree-sitter/syntactic-analysis/ast/schemas/json/index.cjs +43 -0
- package/src/tree-sitter/syntactic-analysis/ast/schemas/json/index.mjs +38 -0
- package/src/tree-sitter/syntactic-analysis/index.cjs +39 -0
- package/src/tree-sitter/syntactic-analysis/index.mjs +33 -0
- package/src/yaml/index.cjs +31 -0
- package/src/yaml/index.mjs +26 -0
- package/types/apidom-parser-adapter-yaml-1-2.d.ts +11 -3
- package/src/syntactic-analysis/TreeCursorIterator.cjs +0 -93
- package/src/syntactic-analysis/TreeCursorIterator.mjs +0 -88
- package/src/syntactic-analysis/TreeCursorSyntaxNode.cjs +0 -80
- package/src/syntactic-analysis/TreeCursorSyntaxNode.mjs +0 -76
- package/src/syntactic-analysis/indirect/index.cjs +0 -51
- package/src/syntactic-analysis/indirect/index.mjs +0 -44
- package/src/syntactic-analysis/indirect/visitors/CstVisitor.cjs +0 -553
- package/src/syntactic-analysis/indirect/visitors/CstVisitor.mjs +0 -547
- package/src/syntactic-analysis/indirect/visitors/YamlAstVisitor.cjs +0 -164
- package/src/syntactic-analysis/indirect/visitors/YamlAstVisitor.mjs +0 -158
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,26 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [2.0.1](https://github.com/speclynx/apidom/compare/v2.0.0...v2.0.1) (2026-01-14)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @speclynx/apidom-parser-adapter-yaml-1-2
|
|
9
|
+
|
|
10
|
+
# [2.0.0](https://github.com/speclynx/apidom/compare/v1.12.2...v2.0.0) (2026-01-14)
|
|
11
|
+
|
|
12
|
+
### Bug Fixes
|
|
13
|
+
|
|
14
|
+
- limit source maps memory consuption ([#20](https://github.com/speclynx/apidom/issues/20)) ([4a0574f](https://github.com/speclynx/apidom/commit/4a0574fd6d466be7c33c8a5871baacd384918d22))
|
|
15
|
+
|
|
16
|
+
### Features
|
|
17
|
+
|
|
18
|
+
- add support for strict mode in JSON/YAML parser adapters ([#22](https://github.com/speclynx/apidom/issues/22)) ([a9c5f11](https://github.com/speclynx/apidom/commit/a9c5f11e8748135e7ba578b61d2f1807e11d34aa))
|
|
19
|
+
- apply innovations learned during last 3 years ([#11](https://github.com/speclynx/apidom/issues/11)) ([cfdbbfc](https://github.com/speclynx/apidom/commit/cfdbbfc2721b0dadc77eeba31dd4e8768c078d22))
|
|
20
|
+
|
|
21
|
+
### BREAKING CHANGES
|
|
22
|
+
|
|
23
|
+
- source maps have been completely rewritten
|
|
24
|
+
- breaking changes introduced to every package public API
|
|
25
|
+
|
|
6
26
|
## [1.12.2](https://github.com/speclynx/apidom/compare/v1.12.1...v1.12.2) (2025-12-23)
|
|
7
27
|
|
|
8
28
|
**Note:** Version bump only for package @speclynx/apidom-parser-adapter-yaml-1-2
|
package/NOTICE
CHANGED
|
@@ -5,11 +5,6 @@ This distribution includes modifications by SpecLynx.
|
|
|
5
5
|
All such modifications are licensed under the Apache License, Version 2.0.
|
|
6
6
|
A copy of the Apache 2.0 license can be found in `LICENSES/Apache-2.0.txt`.
|
|
7
7
|
|
|
8
|
-
ApiDOM
|
|
9
|
-
Copyright 2020 SmartBear Software Inc.
|
|
10
|
-
ApiDOM is licensed under Apache 2.0 license.
|
|
11
|
-
Copy of the Apache 2.0 license can be found in `LICENSES/Apache-2.0.txt` file.
|
|
12
|
-
|
|
13
8
|
json-schema-ref-parser
|
|
14
9
|
Copyright (c) 2015 James Messinger
|
|
15
10
|
File packages/apidom-reference/src/util/url.ts (the file) was originally created under MIT license in https://github.com/APIDevTools/json-schema-ref-parser repository.
|
|
@@ -18,8 +13,8 @@ Copy of the MIT license can be found in `LICENSES/MIT.txt` file.
|
|
|
18
13
|
|
|
19
14
|
graphql-js
|
|
20
15
|
Copyright (c) GraphQL Contributors
|
|
21
|
-
File packages/apidom-
|
|
22
|
-
|
|
16
|
+
File packages/apidom-traverse/src/traversal.ts (the file) was originally inspired by https://github.com/graphql/graphql-js repository.
|
|
17
|
+
All modifications are licensed under Apache 2.0 License.
|
|
23
18
|
Copy of the MIT license can be found in `LICENSES/MIT.txt` file.
|
|
24
19
|
|
|
25
20
|
babel-plugin-add-import-extension
|
|
@@ -54,6 +49,20 @@ Copyright (c) 2012 James Halliday, Josh Duff, and other contributors
|
|
|
54
49
|
Copy of the MIT license can be found in `LICENSES/MIT.txt` file.
|
|
55
50
|
All modifications are licensed under Apache 2.0 License.
|
|
56
51
|
|
|
52
|
+
ApiDOM
|
|
53
|
+
Copyright 2020 SmartBear Software Inc.
|
|
54
|
+
ApiDOM is licensed under Apache 2.0 license.
|
|
55
|
+
Copy of the Apache 2.0 license can be found in `LICENSES/Apache-2.0.txt` file.
|
|
56
|
+
|
|
57
|
+
minim
|
|
58
|
+
Copyright (c) 2014 Stephen Mizell
|
|
59
|
+
The apidom-datamodel package contains code originally created under the MIT
|
|
60
|
+
License as part of the Minim project (https://github.com/refractproject/minim).
|
|
61
|
+
This code has been copied into this project and modified.
|
|
62
|
+
The original portions remain licensed under the MIT License. Our modifications
|
|
63
|
+
to that code are licensed under the Apache License 2.0.
|
|
64
|
+
Copy of the MIT license can be found in `LICENSES/MIT.txt` file.
|
|
65
|
+
|
|
57
66
|
---
|
|
58
67
|
|
|
59
68
|
If the SPDX-FileCopyrightText and SPDX-License-Identifier tags are not present in the file,
|
package/README.md
CHANGED
|
@@ -44,9 +44,14 @@ Defines list of media types that this parser adapter recognizes.
|
|
|
44
44
|
|
|
45
45
|
### detect
|
|
46
46
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
47
|
+
Detection indicates whether the provided source string is valid YAML.
|
|
48
|
+
|
|
49
|
+
Option | Type | Default | Description
|
|
50
|
+
--- | --- | --- | ---
|
|
51
|
+
<a name="detect-strict"></a>`strict` | `Boolean` | `false` | Use strict detection mode ([yaml](https://www.npmjs.com/package/yaml) library).
|
|
52
|
+
|
|
53
|
+
In default mode, detection uses tree-sitter for parsing with error recovery.
|
|
54
|
+
In strict mode, detection uses the [yaml](https://www.npmjs.com/package/yaml) library which is faster.
|
|
50
55
|
|
|
51
56
|
### namespace
|
|
52
57
|
|
|
@@ -59,9 +64,25 @@ This adapter exposes an instance of [base ApiDOM namespace](https://github.com/s
|
|
|
59
64
|
Option | Type | Default | Description
|
|
60
65
|
--- | --- | --- | ---
|
|
61
66
|
<a name="sourceMap"></a>`sourceMap` | `Boolean` | `false` | Indicate whether to generate source maps.
|
|
67
|
+
<a name="strict"></a>`strict` | `Boolean` | `false` | Use strict parsing mode ([yaml](https://www.npmjs.com/package/yaml) library). When `true`, parsing is faster but doesn't support source maps.
|
|
62
68
|
|
|
63
69
|
All unrecognized arbitrary options will be ignored.
|
|
64
70
|
|
|
71
|
+
#### Parsing modes
|
|
72
|
+
|
|
73
|
+
This adapter supports two parsing modes:
|
|
74
|
+
|
|
75
|
+
**Tree-sitter mode** (default, `strict: false`):
|
|
76
|
+
- Uses [web-tree-sitter](https://www.npmjs.com/package/web-tree-sitter) for parsing
|
|
77
|
+
- Provides error recovery for malformed YAML
|
|
78
|
+
- Supports source map generation
|
|
79
|
+
- Full YAML 1.2 spec compliance with custom AST
|
|
80
|
+
|
|
81
|
+
**Strict mode** (`strict: true`):
|
|
82
|
+
- Uses [yaml](https://www.npmjs.com/package/yaml) library for parsing
|
|
83
|
+
- Faster performance
|
|
84
|
+
- Does not support source maps (throws error if both `strict` and `sourceMap` are `true`)
|
|
85
|
+
|
|
65
86
|
## Usage
|
|
66
87
|
|
|
67
88
|
This parser adapter can be used directly or indirectly via [@speclynx/apidom-parser](https://github.com/speclynx/apidom/tree/main/packages/apidom-parser).
|
|
@@ -74,12 +95,18 @@ with [supported media types](#mediatypes).
|
|
|
74
95
|
```js
|
|
75
96
|
import { parse, detect } from '@speclynx/apidom-parser-adapter-yaml-1-2';
|
|
76
97
|
|
|
77
|
-
//
|
|
78
|
-
await detect('prop: value'); // =>
|
|
79
|
-
await detect('
|
|
98
|
+
// detecting (tree-sitter mode - default)
|
|
99
|
+
await detect('prop: value'); // => true
|
|
100
|
+
await detect('{invalid:'); // => false
|
|
80
101
|
|
|
81
|
-
//
|
|
102
|
+
// detecting (strict mode)
|
|
103
|
+
await detect('prop: value', { strict: true }); // => true
|
|
104
|
+
|
|
105
|
+
// parsing (tree-sitter mode - default, with source maps)
|
|
82
106
|
const parseResult = await parse('prop: value', { sourceMap: true });
|
|
107
|
+
|
|
108
|
+
// parsing (strict mode - faster, no source maps)
|
|
109
|
+
const parseResultStrict = await parse('prop: value', { strict: true });
|
|
83
110
|
```
|
|
84
111
|
|
|
85
112
|
### Indirect usage
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(self.webpackChunkapidomParserAdapterYaml1_2=self.webpackChunkapidomParserAdapterYaml1_2||[]).push([[167],{
|
|
1
|
+
(self.webpackChunkapidomParserAdapterYaml1_2=self.webpackChunkapidomParserAdapterYaml1_2||[]).push([[167],{167:()=>{}}]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(self.webpackChunkapidomParserAdapterYaml1_2=self.webpackChunkapidomParserAdapterYaml1_2||[]).push([[451],{
|
|
1
|
+
(self.webpackChunkapidomParserAdapterYaml1_2=self.webpackChunkapidomParserAdapterYaml1_2||[]).push([[451],{451:()=>{}}]);
|