@speclynx/apidom-parser-adapter-yaml-1-2 2.11.0 → 2.12.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 +10 -0
- package/README.md +8 -2
- package/dist/apidom-parser-adapter-yaml-1-2.browser.js +498 -101
- package/dist/apidom-parser-adapter-yaml-1-2.browser.min.js +1 -1
- package/package.json +5 -5
- package/src/adapter.cjs +6 -1
- package/src/adapter.mjs +6 -1
- package/src/tree-sitter/index.cjs +4 -2
- package/src/tree-sitter/index.mjs +4 -2
- package/src/tree-sitter/syntactic-analysis/CstTransformer.cjs +76 -4
- package/src/tree-sitter/syntactic-analysis/CstTransformer.mjs +76 -4
- package/src/tree-sitter/syntactic-analysis/YamlAstTransformer.cjs +220 -8
- package/src/tree-sitter/syntactic-analysis/YamlAstTransformer.mjs +221 -9
- package/src/tree-sitter/syntactic-analysis/ast/nodes/YamlNode.cjs +2 -0
- package/src/tree-sitter/syntactic-analysis/ast/nodes/YamlNode.mjs +2 -0
- package/src/tree-sitter/syntactic-analysis/ast/nodes/YamlScalar.cjs +1 -0
- package/src/tree-sitter/syntactic-analysis/ast/nodes/YamlScalar.mjs +1 -0
- package/src/tree-sitter/syntactic-analysis/index.cjs +4 -2
- package/src/tree-sitter/syntactic-analysis/index.mjs +4 -2
- package/types/apidom-parser-adapter-yaml-1-2.d.ts +4 -2
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,16 @@
|
|
|
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.12.1](https://github.com/speclynx/apidom/compare/v2.12.0...v2.12.1) (2026-02-18)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @speclynx/apidom-parser-adapter-yaml-1-2
|
|
9
|
+
|
|
10
|
+
# [2.12.0](https://github.com/speclynx/apidom/compare/v2.11.0...v2.12.0) (2026-02-18)
|
|
11
|
+
|
|
12
|
+
### Features
|
|
13
|
+
|
|
14
|
+
- add support for lossless JSON/YAML roundtrips ([#97](https://github.com/speclynx/apidom/issues/97)) ([dc17c9a](https://github.com/speclynx/apidom/commit/dc17c9a78fbc7df07a91e8f35b12be6409117d91))
|
|
15
|
+
|
|
6
16
|
# [2.11.0](https://github.com/speclynx/apidom/compare/v2.10.3...v2.11.0) (2026-02-12)
|
|
7
17
|
|
|
8
18
|
**Note:** Version bump only for package @speclynx/apidom-parser-adapter-yaml-1-2
|
package/README.md
CHANGED
|
@@ -64,7 +64,8 @@ This adapter exposes an instance of [base ApiDOM namespace](https://github.com/s
|
|
|
64
64
|
Option | Type | Default | Description
|
|
65
65
|
--- | --- | --- | ---
|
|
66
66
|
<a name="sourceMap"></a>`sourceMap` | `Boolean` | `false` | Indicate whether to generate source maps.
|
|
67
|
-
<a name="
|
|
67
|
+
<a name="style"></a>`style` | `Boolean` | `false` | Indicate whether to capture format-specific style information for round-trip preservation.
|
|
68
|
+
<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 or style preservation.
|
|
68
69
|
|
|
69
70
|
All unrecognized arbitrary options will be ignored.
|
|
70
71
|
|
|
@@ -76,12 +77,14 @@ This adapter supports two parsing modes:
|
|
|
76
77
|
- Uses [web-tree-sitter](https://www.npmjs.com/package/web-tree-sitter) for parsing
|
|
77
78
|
- Provides error recovery for malformed YAML
|
|
78
79
|
- Supports source map generation
|
|
80
|
+
- Supports style preservation (quoting styles, flow/block, comments, indentation)
|
|
79
81
|
- Full YAML 1.2 spec compliance with custom AST
|
|
80
82
|
|
|
81
83
|
**Strict mode** (`strict: true`):
|
|
82
84
|
- Uses [yaml](https://www.npmjs.com/package/yaml) library for parsing
|
|
83
85
|
- Faster performance
|
|
84
86
|
- Does not support source maps (throws error if both `strict` and `sourceMap` are `true`)
|
|
87
|
+
- Does not support style preservation (throws error if both `strict` and `style` are `true`)
|
|
85
88
|
|
|
86
89
|
## Usage
|
|
87
90
|
|
|
@@ -105,7 +108,10 @@ await detect('prop: value', { strict: true }); // => true
|
|
|
105
108
|
// parsing (tree-sitter mode - default, with source maps)
|
|
106
109
|
const parseResult = await parse('prop: value', { sourceMap: true });
|
|
107
110
|
|
|
108
|
-
// parsing (
|
|
111
|
+
// parsing (tree-sitter mode, with style preservation)
|
|
112
|
+
const parseResultStyled = await parse('prop: value', { style: true });
|
|
113
|
+
|
|
114
|
+
// parsing (strict mode - faster, no source maps or style)
|
|
109
115
|
const parseResultStrict = await parse('prop: value', { strict: true });
|
|
110
116
|
```
|
|
111
117
|
|