yini-parser 1.4.3-beta → 1.5.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.
Files changed (32) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/README.md +68 -144
  3. package/dist/YINI.d.ts +9 -13
  4. package/dist/YINI.js +3 -3
  5. package/dist/YINI.js.map +1 -1
  6. package/dist/core/astBuilder.d.ts +3 -6
  7. package/dist/core/astBuilder.js +80 -49
  8. package/dist/core/astBuilder.js.map +1 -1
  9. package/dist/core/objectBuilder.d.ts +8 -4
  10. package/dist/core/objectBuilder.js +31 -61
  11. package/dist/core/objectBuilder.js.map +1 -1
  12. package/dist/core/options/defaultParserOptions.js +9 -1
  13. package/dist/core/options/defaultParserOptions.js.map +1 -1
  14. package/dist/core/options/optionsFunctions.js +1 -3
  15. package/dist/core/options/optionsFunctions.js.map +1 -1
  16. package/dist/core/parsingRules/modeFromRulesMatcher.d.ts +1 -1
  17. package/dist/core/parsingRules/modeFromRulesMatcher.js +22 -13
  18. package/dist/core/parsingRules/modeFromRulesMatcher.js.map +1 -1
  19. package/dist/core/pipeline/pipeline.js +4 -0
  20. package/dist/core/pipeline/pipeline.js.map +1 -1
  21. package/dist/dev/main.js +55 -84
  22. package/dist/dev/main.js.map +1 -1
  23. package/dist/grammar/generated/YiniLexer.d.ts +43 -49
  24. package/dist/grammar/generated/YiniLexer.js +320 -332
  25. package/dist/grammar/generated/YiniLexer.js.map +1 -1
  26. package/dist/grammar/generated/YiniParser.d.ts +60 -82
  27. package/dist/grammar/generated/YiniParser.js +461 -726
  28. package/dist/grammar/generated/YiniParser.js.map +1 -1
  29. package/dist/grammar/generated/YiniParserVisitor.d.ts +7 -7
  30. package/dist/grammar/generated/YiniParserVisitor.js +1 -1
  31. package/dist/types/index.d.ts +1 -1
  32. package/package.json +3 -4
package/CHANGELOG.md CHANGED
@@ -1,5 +1,27 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 1.5.0 - 2026 Apr
4
+ - **Updated:** Parser behavior aligned with YINI Specification `v1.0.0-RC.5`.
5
+ - **Changed:** In strict mode, YINI documents must now end with the document terminator `/END`.
6
+ - **Changed:** Strict mode now requires exactly one explicit top-level section.
7
+ - **Updated:** Section header parsing now reflects the latest horizontal whitespace (`HSPACE`) rules from the specification.
8
+ - **Improved:** Refined how members outside explicit sections are handled in lenient mode, and added stricter checks for top-level structure in strict mode.
9
+ - **Improved:** Clarified and tightened how empty values and explicit `null` are handled in lenient and strict mode.
10
+ - **Improved:** Fixed `throwOnError` option detection, clarified the related documentation, and cleaned up public parameter names.
11
+ - **Fixed:** Made `throwOnError` work consistently together with the selected fail level.
12
+ - **Updated:** Synced to the latest lexer and parser grammar files from the Specification Package `v1.0.0-RC.5`, with cleaned up and refined grammar files for better consistency and maintainability.
13
+ - **Added:** Expanded validation and tests for section headers, including shorthand markers, backticked names, and invalid dotted section names.
14
+ - **Expanded:** Improved integration and smoke test coverage for error recovery, throw behavior, null handling, fixture parsing, and section/header edge cases.
15
+ - **Updated:** Added and validated a new large smoke/golden fixture:
16
+ - `tests/fixtures/smoke-fixtures/c-industrial-monitoring-and-automation-platform.smoke.yini`
17
+ - **Improved:** Fixed and re-enabled previously skipped smoke tests:
18
+ - `tests/fixtures/smoke-fixtures/8-api-keys-integration.smoke.yini`
19
+ - `tests/fixtures/smoke-fixtures/9-app-preferences.smoke.yini`
20
+
21
+ ## 1.4.3 - 2026 Apr
22
+ - **Promoted:** YINI Parser TypeScript is now considered stable (non-beta) after iterative beta releases and refinements.
23
+ - **Fixed:** Rebuilt the project and reduced reported vulnerabilities from 4 to 0.
24
+
3
25
  ## 1.4.3-beta - 2026 Mar
4
26
  - **Fixed:** Error messages and thrown parse errors now include correct line and column information again.
5
27
  - **Improved:** Syntax and string-related parse errors are now clearer and more consistent.
package/README.md CHANGED
@@ -1,145 +1,68 @@
1
- # YINI Parser for Node.js
2
- > **Readable configuration without YAML foot-guns or JSON noise.**
1
+ # yini-parser
2
+ > **Readable configuration for Node.js and TypeScript/JavaScript — without YAML footguns or JSON noise.**
3
3
 
4
- The official TypeScript / Node.js parser for **YINI** (by the YINI-lang project) — an INI-inspired, human-readable text format for structured information.
4
+ The official TypeScript / Node.js parser for **YINI** (by the YINI-lang project) — a human-friendly configuration format with clear structure, nested sections, comments, and predictable parsing.
5
5
 
6
- [![npm version](https://img.shields.io/npm/v/yini-parser.svg)](https://www.npmjs.com/package/yini-parser) [![All Test Suites](https://github.com/YINI-lang/yini-parser-typescript/actions/workflows/run-all-tests.yml/badge.svg)](https://github.com/YINI-lang/yini-parser-typescript/actions/workflows/run-all-tests.yml) [![All Regression Tests](https://github.com/YINI-lang/yini-parser-typescript/actions/workflows/run-regression-tests.yml/badge.svg)](https://github.com/YINI-lang/yini-parser-typescript/actions/workflows/run-regression-tests.yml) [![Grammar Drift Check](https://github.com/YINI-lang/yini-parser-typescript/actions/workflows/run-grammar-drift-check.yml/badge.svg)](https://github.com/YINI-lang/yini-parser-typescript/actions/workflows/run-grammar-drift-check.yml) [![npm downloads](https://img.shields.io/npm/dm/yini-parser)](https://www.npmjs.com/package/yini-parser)
6
+ YINI is designed for applications, tools, and services that need configuration that stays readable for humans without becoming vague, fragile, or hard to maintain.
7
7
 
8
- Designed to bring structure, clarity, and predictable behavior to real-world configuration needs. Well suited for applications, tools, and services that need readable yet structured configuration.
8
+ [![npm version](https://img.shields.io/npm/v/yini-parser.svg)](https://www.npmjs.com/package/yini-parser) [![TypeScript](https://img.shields.io/badge/TypeScript-5.x-3178C6?logo=typescript&logoColor=white)](https://www.typescriptlang.org/) [![All Test Suites](https://github.com/YINI-lang/yini-parser-typescript/actions/workflows/run-all-tests.yml/badge.svg)](https://github.com/YINI-lang/yini-parser-typescript/actions/workflows/run-all-tests.yml) [![All Regression Tests](https://github.com/YINI-lang/yini-parser-typescript/actions/workflows/run-regression-tests.yml/badge.svg)](https://github.com/YINI-lang/yini-parser-typescript/actions/workflows/run-regression-tests.yml) [![Grammar Drift Check](https://github.com/YINI-lang/yini-parser-typescript/actions/workflows/run-grammar-drift-check.yml/badge.svg)](https://github.com/YINI-lang/yini-parser-typescript/actions/workflows/run-grammar-drift-check.yml) [![npm downloads](https://img.shields.io/npm/dm/yini-parser)](https://www.npmjs.com/package/yini-parser)
9
+
10
+ ## Quick Start
9
11
 
10
12
  ```sh
11
13
  npm install yini-parser
12
14
  ```
13
15
 
14
- ```ts
15
- import YINI from 'yini-parser'
16
- const config = YINI.parseFile('./config.yini')
17
- ```
18
-
19
- ```sh
20
- npm run test
21
- ```
22
-
23
- ➡️ See full [documentation or YINI format specification](https://github.com/YINI-lang/YINI-spec)
24
-
25
- ---
26
-
27
- ## Example of YINI code
28
- > A basic YINI configuration example, showing a section, nested section, comments:
29
- ![YINI Config Example](./samples/basic.yini.png)
30
- Source: [basic.yini](./samples/basic.yini)
31
-
32
- ## YINI Parser – (source code in TypeScript)
33
-
34
- A runtime parser for the official [YINI configuration file format](https://github.com/YINI-lang/YINI-spec).
35
-
36
- The parser follows the official YINI specification and is implemented in TypeScript.
37
-
38
- ---
39
-
40
- ## Quick Start
41
-
42
- A small example using YINI in TypeScript/JavaScript:
43
16
  ```ts
44
17
  import YINI from 'yini-parser'
45
18
 
46
19
  const config = YINI.parse(`
47
- // YINI is a simple, human-readable configuration file format.
48
-
49
- // Note: In YINI, spaces and tabs never change meaning.
50
- // Indentation is only for readability.
20
+ ^ App
21
+ name = 'My App'
22
+ darkMode = true
51
23
 
52
- ^ App // Definition of section (group) "App"
53
- name = 'My Title' // Keys and values are written as key = value
54
- items = 25
55
- darkMode = true // "ON" and "YES" works too
56
-
57
- // Sub-section of the "App" section
58
- ^^ Special
59
- primaryColor = #336699 // Hex number format
60
- isCaching = false // "OFF" and "NO" works too
24
+ ^^ Features
25
+ caching = on
61
26
  `)
62
27
 
63
- // To parse from a file instead:
64
- // const config = YINI.parseFile('./config.yini')
65
-
66
- console.log(config.App.name) // My Title
67
- console.log(config.App.Special.isCaching) // false
68
- console.log()
69
- console.log(config)
28
+ console.log(config.App.name) // My App
29
+ console.log(config.App.Features.caching) // true
70
30
  ```
71
31
 
72
- **Output:**
73
- ```js
74
- My Title
75
- false
76
-
77
- {
78
- App: {
79
- name: 'My Title',
80
- items: 25,
81
- darkMode: true,
82
- Special: {
83
- primaryColor: 3368601,
84
- isCaching: false
85
- }
86
- }
87
- }
88
- ```
89
-
90
- That's it!
91
-
92
- - ▶️ Link to [Demo Apps](https://github.com/YINI-lang/yini-demo-apps/tree/main) with complete basic usage.
93
-
94
- ---
95
-
96
- ## Example 2
97
- > A real-world YINI configuration example, showing sections, nesting, comments, and multiple data types:
98
- ![YINI Config Example](./samples/config.yini.png)
99
- Source: [config.yini](./samples/config.yini)
100
-
101
- ## 📂 More Examples
102
-
103
- - ▶️ Explore more [YINI examples](https://yini-lang.org/learn-yini/examples/?utm_source=yini-parser-ts&utm_medium=github&utm_campaign=repo-link&utm_content=readme).
104
-
105
- ---
106
-
107
- ### Who is this for?
108
-
109
- YINI is designed as an ideal option for application developers, platform teams, DevOps engineers, and anyone maintaining complex configuration at scale.
32
+ ➡️ Learn more in the [YINI specification and documentation](https://yini-lang.org/refs/specification).
110
33
 
111
34
  ---
112
35
 
113
- ## 🙋‍♀️ Why YINI?
114
- - **Indentation-independent structure:** The YINI config format is indentation-independent, meaning spaces and tabs never affect meaning.
115
- - **Explicit nesting for easy refactoring & large configs:** It uses clear header markers (`^`, `^^`, `^^^`) to define hierarchy (like in Markdown), without long dotted keys.
116
- - **Multiple data types:** Supports boolean literals (`true` / `false`, `Yes` / `No`, etc), numbers, arrays (lists), and JS-style objects natively, with explicit string syntax.
117
- - **Comments support:** YINI supports multiple comment styles (`#`, `//`, `/* ... */`, and `;`). Allows you to document configuration directly in the file.
118
- - **Predictable parsing rules:** Fewer production surprises, well-defined rules with optional strict and lenient modes, for different use cases.
36
+ ## 🙋‍♀️ Why try YINI?
119
37
 
38
+ - **Readable by humans** — Less noisy than JSON, less fragile than indentation-driven formats.
39
+ - **Structured for real-world configuration** — Sections, nested sections, lists, objects, booleans, and null.
40
+ - **Predictable parsing** — Explicit syntax with clear rules.
41
+ - **Easy to use from TypeScript/Node.js** — Parse from strings or files in a few lines.
42
+
120
43
  ---
121
44
 
122
- ## Features
123
- - Simple syntax (supports both strict and lenient modes).
124
- - Familiar config file style (inspired by INI, JSON, Python, and Markdown).
125
- - Easy programmatic usage.
126
- - Only the `YINI` class is exported; all internal details are private.
127
- - Arrays/Lists (bracketed): `list = [10, 20, 30]`
128
- - JavaScript-style objects (inline maps).
45
+ ## What YINI looks like in practice
46
+ > A basic YINI configuration example, showing a section, a nested section, and comments:
47
+ ![YINI Config Example](./samples/basic.yini.png)
48
+ Source: [basic.yini](./samples/basic.yini)
129
49
 
130
- If you find this useful, please consider starring the project on GitHub.
50
+ - ▶️ [Demo Apps](https://github.com/YINI-lang/yini-demo-apps/tree/main) with complete usage examples.
131
51
 
132
52
  ---
133
53
 
134
- ## 🧪 Stability & Guarantees
135
-
136
- This parser is continuously validated through comprehensive regression and smoke tests, ensuring deterministic parsing behavior across default, strict, and metadata-enabled modes.
54
+ ## Why YINI works well for configuration
55
+ - **Indentation-independent structure:** Spaces and tabs never change meaning, so files can be reformatted without changing structure.
56
+ - **Explicit nesting:** Hierarchy is defined with section markers like `^`, `^^`, and `^^^`, making large configurations easier to scan and refactor.
57
+ - **Multiple data types:** Supports booleans (`true` / `false`, `yes` / `no`, etc.), numbers, lists, and inline objects, with explicit string syntax.
58
+ - **Comment support:** YINI supports multiple comment styles (`#`, `//`, `/* ... */`, and `;`), making it easy to document configuration directly in the file.
59
+ - **Predictable parsing:** Clear rules with optional strict and lenient modes for different use cases.
137
60
 
138
61
  ---
139
62
 
140
63
  ## Usage
141
64
 
142
- ### Installation
65
+ ### Install with your package manager
143
66
 
144
67
  With **npm**:
145
68
  ```sh
@@ -160,8 +83,7 @@ pnpm add yini-parser
160
83
  **Note:** Only a default export (YINI) is provided. Named imports are not supported.
161
84
  ```js
162
85
  const YINI = require('yini-parser').default;
163
- // (!) If you get undefined, try:
164
- // (Some Node.js setups require the .default property, others don't, due to ESM/CommonJS interop quirks.)
86
+ // If your setup handles default interop differently, try:
165
87
  // const YINI = require('yini-parser');
166
88
 
167
89
  // Parse from string.
@@ -206,56 +128,58 @@ const configFromFile = YINI.parseFile('./config.yini');
206
128
 
207
129
  ---
208
130
 
209
- ## 🛠 Roadmap
210
-
211
- 1. **Improve existing functionality** — Ongoing improvements to core parsing, richer diagnostics, and expanded QA for areas not yet fully covered.
212
- 2. **Full spec compliance** — Complete support for all features in the YINI Specification v1.0.0 (and the latest RCs).
213
- - Progress and current status are tracked in [FEATURE-CHECKLIST.md](https://github.com/YINI-lang/yini-parser-typescript/blob/main/FEATURE-CHECKLIST.md).
214
- 3. **Schema validation (future)** — Possible future expansion to support schema/contract validation for stricter type-safe configs.
215
- 4. **Ecosystem integration** - Broader and additional support for tooling, and other ecosystem projects.
131
+ ## 📂 More Examples
216
132
 
217
- ### Planned & Upcoming Features
218
- Some advanced YINI features are still evolving and are tracked transparently.
133
+ - ▶️ Explore more [YINI examples](https://yini-lang.org/learn-yini/examples/?utm_source=yini-parser-ts&utm_medium=github&utm_campaign=repo-link&utm_content=readme).
219
134
 
220
- You can follow progress in the [YINI parser FEATURE-CHECKLIST](https://github.com/YINI-lang/yini-parser-typescript/blob/main/FEATURE-CHECKLIST.md). Contributions and feature requests are welcome!
135
+ ### Example 2
136
+ > A real-world YINI configuration example, showing sections, nesting, comments, and multiple data types:
137
+ ![YINI Config Example](./samples/config.yini.png)
138
+ Source: [config.yini](./samples/config.yini)
221
139
 
222
140
  ---
223
141
 
224
- ## 🤝 Contributing
225
- We welcome feedback, bug reports, feature requests, and code contributions!
226
- - [Open an Issue](https://github.com/YINI-lang/yini-parser-typescript/issues)
227
- - [Start a Discussion](https://github.com/YINI-lang/yini-parser-typescript/discussions)
228
-
229
-
230
- If this library is useful to you, a GitHub star helps guide future development.
142
+ ## 🧪 Testing and Stability
231
143
 
232
- ---
233
-
234
- ## 📚 Documentation
235
- - [Project Setup](https://github.com/YINI-lang/yini-parser-typescript/blob/main/docs/Project-Setup.md) — How to run, test, and build the project, etc.
236
- - [Conventions](https://github.com/YINI-lang/yini-parser-typescript/blob/main/docs/Conventions.md) — Project conventions, naming patterns, etc.
144
+ This parser is validated through regression and smoke tests to help ensure stable, predictable parsing across default, strict, and metadata-enabled modes.
237
145
 
238
146
  ---
239
147
 
240
148
  ## Links
241
- - ➡️ [Read the YINI Specification](https://github.com/YINI-lang/YINI-spec/tree/production/YINI-Specification.md#table-of-contents)
242
- *Full formal spec for the YINI format, including syntax and features.*
149
+ - ➡️ [YINI Homepage](https://yini-lang.org)
150
+ *Tutorials, guides, and examples.*
151
+
152
+ - ➡️ [Read the YINI Specification](https://yini-lang.org/refs/specification)
153
+ *Full syntax and format reference.*
243
154
 
244
155
  - ➡️ [YINI CLI on GitHub](https://github.com/YINI-lang/yini-cli)
245
- *TypeScript source code, issue tracker, and contributing guide.*
156
+ *CLI tooling for working with YINI files.*
246
157
 
247
- - ➡️ [YINI Project](https://github.com/YINI-lang)
248
- *YINI home on GitHub.*
158
+ - ➡️ [Demo Apps](https://github.com/YINI-lang/yini-demo-apps/tree/main)
159
+ *Complete basic usage examples.*
249
160
 
250
- - ➡️ [YINI Homepage](https://yini-lang.org)
251
- *Tutorials & Docs.*
161
+ - ➡️ [YINI-lang Project](https://github.com/YINI-lang)
162
+ *Repositories and related ecosystem projects.*
163
+
164
+ ---
165
+
166
+ ## 🤝 Contributing
167
+ Feedback, bug reports, feature requests, and code contributions are welcome.
168
+ - [Open an Issue](https://github.com/YINI-lang/yini-parser-typescript/issues)
169
+ - [Start a Discussion](https://github.com/YINI-lang/yini-parser-typescript/discussions)
170
+
171
+ If this library is useful to you, a GitHub star helps more people discover the project and supports future development.
172
+
173
+ ### Documentation
174
+ - [Project Setup](https://github.com/YINI-lang/yini-parser-typescript/blob/main/docs/Project-Setup.md) — How to run, test, and build the project, etc.
175
+ - [Conventions](https://github.com/YINI-lang/yini-parser-typescript/blob/main/docs/Conventions.md) — Project conventions, naming patterns, etc.
252
176
 
253
177
  ---
254
178
 
255
179
  ## License
256
- This project is licensed under the Apache-2.0 license - see the [LICENSE](<./LICENSE>) file for details.
180
+ This project is licensed under the Apache License 2.0 see the [LICENSE](./LICENSE) file for details.
257
181
 
258
- In this project on GitHub, the `libs` directory contains third party software and each is licensed under its own license which is described in its own license file under the respective directory under `libs`.
182
+ In this project on GitHub, the `libs` directory contains third-party software and each is licensed under its own license, described in its own license file under the respective directory under `libs`.
259
183
 
260
184
  ---
261
185
 
@@ -264,4 +188,4 @@ In this project on GitHub, the `libs` directory contains third party software an
264
188
  >
265
189
  > Predictable configuration with clear rules.
266
190
 
267
- [yini-lang.org](https://yini-lang.org/?utm_source=github&utm_medium=referral&utm_campaign=yini_parser_ts&utm_content=readme_footer) · [YINI on GitHub](https://github.com/YINI-lang)
191
+ [yini-lang.org](https://yini-lang.org/?utm_source=github&utm_medium=referral&utm_campaign=yini_parser_ts&utm_content=readme_footer) · [YINI-lang on GitHub](https://github.com/YINI-lang)
package/dist/YINI.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  import { ParsedObject, ParseOptions, PreferredFailLevel, YiniParseResult } from './types';
2
2
  /**
3
- * This class is the public API, which exposes only parse(..) and
4
- * parseFile(..), rest of the implementation details are hidden.
5
- * @note Only parse and parseFile are public.
3
+ * This class is the main public API. It exposes `parse(..)` and `parseFile(..)`
4
+ * as the primary entry points, while the implementation details remain internal.
5
+ * @note The public parsing API is exposed through `parse(..)` and `parseFile(..)`.
6
6
  */
7
7
  export default class YINI {
8
8
  private static g_tabSize;
@@ -73,16 +73,14 @@ export default class YINI {
73
73
  * Does not affect warnings included in returned metadata.
74
74
  * @param options.requireDocTerminator - Controls whether a document terminator is required.
75
75
  * Allowed values: `'optional'` | `'warn-if-missing'` | `'required'`.
76
- * @param options.silent - Suppress all output (even errors, exit code only).
76
+ * @param options.silent - Suppress all console output, including errors and warnings.
77
77
  * @param options.strictMode - Sets the baseline ruleset (true = strict, false = lenient).
78
78
  * This is only a starting point: rule-specific options (e.g., `treatEmptyValueAsNull`,
79
79
  * `onDuplicateKey`, etc.) can override parts of that ruleset. If any overrides are given,
80
80
  * the effective mode becomes **custom** rather than purely strict/lenient.
81
81
  * @param options.treatEmptyValueAsNull - How to treat an explicitly empty value on the
82
82
  * right-hand side of '='. Allowed values: `'allow'` | `'allow-with-warning'` | `'disallow'`.
83
- * @param options.throwOnError - Will throw on first parse error encountered.
84
- * NOTE: Current default is `true`. The default will change to `false` in the next
85
- * release. To avoid breaking changes, set this option explicitly.
83
+ * @param options.throwOnError - Throw when a parse issue reaches the active bail threshold (for example, on errors if `failLevel = 'errors'`).
86
84
  *
87
85
  * @returns {ParsedObject | YiniParseResult} The parsed YINI content.
88
86
  *
@@ -106,7 +104,7 @@ export default class YINI {
106
104
  /**
107
105
  * Parse a YINI file into a JavaScript object.
108
106
  *
109
- * @param yiniFile Path to the YINI file.
107
+ * @param filePath Path to the YINI file.
110
108
  * @param strictMode If `true`, enforce strict parsing rules (e.g. require `/END`, disallow trailing commas).
111
109
  * @param failLevel Preferred bail sensitivity level, controls if and when parsing should stop on problems:
112
110
  * - `'auto'` (default) : Auto‑select level (strict → `'errors'`, lenient → `'ignore-errors'`)
@@ -137,7 +135,7 @@ export default class YINI {
137
135
  /**
138
136
  * Parse a YINI file into a JavaScript object, using an options object for configuration.
139
137
  *
140
- * @param yiniFile Path to the YINI file.
138
+ * @param filePath Path to the YINI file.
141
139
  * @param options Optional settings to customize parsing and/or results, useful if you need more control.
142
140
  * For all options, see types/ParseOptions.
143
141
  *
@@ -161,16 +159,14 @@ export default class YINI {
161
159
  * Does not affect warnings included in returned metadata.
162
160
  * @param options.requireDocTerminator - Controls whether a document terminator is required.
163
161
  * Allowed values: `'optional'` | `'warn-if-missing'` | `'required'`.
164
- * @param options.silent - Suppress all output (even errors, exit code only).
162
+ * @param options.silent - Suppress all console output, including errors and warnings.
165
163
  * @param options.strictMode - Sets the baseline ruleset (true = strict, false = lenient).
166
164
  * This is only a starting point: rule-specific options (e.g., `treatEmptyValueAsNull`,
167
165
  * `onDuplicateKey`, etc.) can override parts of that ruleset. If any overrides are given,
168
166
  * the effective mode becomes **custom** rather than purely strict/lenient.
169
167
  * @param options.treatEmptyValueAsNull - How to treat an explicitly empty value on the
170
168
  * right-hand side of '='. Allowed values: `'allow'` | `'allow-with-warning'` | `'disallow'`.
171
- * @param options.throwOnError - Will throw on first parse error encountered.
172
- * NOTE: Current default is `true`. The default will change to `false` in the next
173
- * release. To avoid breaking changes, set this option explicitly.
169
+ * @param options.throwOnError - Throw when a parse issue reaches the active bail threshold (for example, on errors if `failLevel = 'errors'`).
174
170
  *
175
171
  * @returns {ParsedObject | YiniParseResult} The parsed YINI content.
176
172
  *
package/dist/YINI.js CHANGED
@@ -7,9 +7,9 @@ const runtime_1 = require("./core/runtime");
7
7
  const print_1 = require("./utils/print");
8
8
  const DEFAULT_TAB_SIZE = 4; // De facto "modern default" (even though traditionally/historically it's 8).
9
9
  /**
10
- * This class is the public API, which exposes only parse(..) and
11
- * parseFile(..), rest of the implementation details are hidden.
12
- * @note Only parse and parseFile are public.
10
+ * This class is the main public API. It exposes `parse(..)` and `parseFile(..)`
11
+ * as the primary entry points, while the implementation details remain internal.
12
+ * @note The public parsing API is exposed through `parse(..)` and `parseFile(..)`.
13
13
  */
14
14
  class YINI {
15
15
  /**
package/dist/YINI.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"YINI.js","sourceRoot":"","sources":["../src/YINI.ts"],"names":[],"mappings":";;AAAA,sCAA6C;AAC7C,8DAA0D;AAC1D,sEAAqE;AACrE,4CAA4C;AAO5C,yCAAiE;AAEjE,MAAM,gBAAgB,GAAG,CAAC,CAAA,CAAC,6EAA6E;AAExG;;;;GAIG;AACH,MAAqB,IAAI;IAIrB;;OAEG;IACI,MAAM,CAAC,UAAU;QACpB,OAAO,IAAI,CAAC,SAAS,CAAA;IACz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CAAA;YAC5B,IAAA,mBAAW,EAAC,MAAM,CAAC,CAAA;QACvB,CAAC;QAED,OAAO,MAAM,CAAA;IACjB,CAAC;IA2GD,yEAAyE;IACzE,gGAAgG;IAChG,6HAA6H;IACtH,MAAM,CAAC,SAAS,CACnB,QAAgB,EAChB,IAA6B,EAAE,uBAAuB;IACtD,YAAgC,MAAM,EACtC,eAAe,GAAG,KAAK;QAEvB,IAAA,kBAAU,EAAC,iDAAiD,CAAC,CAAA;QAC7D,IAAA,kBAAU,EAAC,sBAAsB,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,CAAA;QAElD,IAAA,kBAAU,GAAE,CAAA;QACZ,IAAA,kBAAU,EACN,iEAAiE,CACpE,CAAA;QACD,MAAM,OAAO,GAAG,IAAI,qBAAW,CAAC,MAAM,CAAC,CAAA;QAEvC,MAAM,MAAM,GAAG,IAAA,sCAAmB,EAAC,IAAI,CAAC;YACpC,CAAC,CAAC,OAAO,CAAC,WAAW,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC,kCAAkC;YACxE,CAAC,CAAC,OAAO,CAAC,WAAW;YACf,4DAA4D;YAC5D,QAAQ,EACR,IAA2B,EAC3B,SAAS,EACT,eAAe,CAClB,CAAA;QAEP,IAAA,kBAAU,EAAC,kDAAkD,CAAC,CAAA;QAC9D,OAAO,MAAM,CAAA;IACjB,CAAC;;AAnTD,2IAA2I;AAC5H,cAAS,GAAG,gBAAgB,CAAA,CAAC,0CAA0C;kBAFrE,IAAI"}
@@ -1,4 +1,4 @@
1
- import { AnnotationContext, AssignmentContext, Bad_memberContext, Bad_meta_textContext, Boolean_literalContext, Colon_list_declContext, DirectiveContext, ElementsContext, EolContext, List_literalContext, MemberContext, Meta_stmtContext, Null_literalContext, Number_literalContext, Object_literalContext, Object_memberContext, Object_membersContext, PrologContext, StmtContext, String_concatContext, String_literalContext, Terminal_stmtContext, ValueContext, YiniContext } from '../grammar/generated/YiniParser.js';
1
+ import { AnnotationContext, AssignmentContext, Bad_memberContext, Bad_meta_textContext, Boolean_literalContext, DirectiveContext, ElementsContext, EolContext, List_literalContext, MemberContext, Meta_stmtContext, Null_literalContext, Number_literalContext, Object_literalContext, Object_memberContext, Object_membersContext, PrologContext, StmtContext, String_concatContext, String_literalContext, Terminal_stmtContext, ValueContext, YiniContext } from '../grammar/generated/YiniParser.js';
2
2
  import YiniParserVisitor from '../grammar/generated/YiniParserVisitor';
3
3
  import { ErrorDataHandler } from './errorDataHandler';
4
4
  import { IParseCoreOptions, IYiniAST, TSourceType } from './internalTypes';
@@ -28,6 +28,7 @@ export default class ASTBuilder<Result> extends YiniParserVisitor<Result> {
28
28
  * @param metaLineCount Provide the line-count here so the meta information can be updated accordingly.
29
29
  */
30
30
  constructor(errorHandler: ErrorDataHandler, options: IParseCoreOptions, sourceType: TSourceType, metaFileName: string | null);
31
+ private validateStrictTopLevelStructure;
31
32
  private hasDefinedSectionTitle;
32
33
  private setDefineSectionTitle;
33
34
  private extractStringParts;
@@ -166,12 +167,8 @@ export default class ASTBuilder<Result> extends YiniParserVisitor<Result> {
166
167
  */
167
168
  visitObject_member: (ctx: Object_memberContext) => any;
168
169
  /**
169
- * Visit a parse tree produced by `YiniParser.colon_list_decl`.
170
- * @param ctx the parse tree
171
- * @grammarRule KEY WS? COLON (eol | WS+)* elements (eol | WS+)* eol
172
- * @return the visitor result
170
+ * @note Colon list not supported any more since YINI Spec Package v1.0.0.rc4
173
171
  */
174
- visitColon_list_decl: (ctx: Colon_list_declContext) => any;
175
172
  /**
176
173
  * Visit a parse tree produced by `YiniParser.string_concat`.
177
174
  * @param ctx the parse tree