Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
059d721
feat!: Drop addIn(), deleteIn(), getIn(), hasIn(), and setIn() doc & …
eemeli Feb 14, 2026
a2fe9cc
feat!: Turn Collection into an interface, add isCollection()
eemeli Feb 14, 2026
c7de1b1
feat!: Require createNode() for collection tags, rename static .from(…
eemeli Feb 14, 2026
b60f14a
feat!: Have YAMLMap & YAMLSeq extend Array, rather than containing an…
eemeli Feb 15, 2026
d9c1921
feat!: Drop the map & seq .add() methods, override .push() instead
eemeli Feb 15, 2026
f2a338f
feat!: Drop delete(), get(), and has() methods from seq
eemeli Feb 15, 2026
4b4a6e2
fix: Clean up collection tag definitions
eemeli Mar 22, 2026
b0978b1
feat: Promote YAMLSet to be a top-level collection type
eemeli Mar 22, 2026
78563b5
Merge branch 'main' into dev
eemeli Mar 22, 2026
3bcbf2c
feat!: Refactor YAMLSet around a .values Map
eemeli Mar 28, 2026
53b3804
feat!: Refactor YAMLMap around a .values Map
eemeli Apr 4, 2026
a14118c
fix: Update docs, fill out missing Array methods for YAMLSeq
eemeli Apr 4, 2026
be377fb
test: Add utility shorthands _map, _pair, _seq, _set
eemeli Apr 4, 2026
43fe536
fix: Use object itself rather than unique symbol as key for object keys
eemeli Apr 4, 2026
2631421
ci: Specify @vitest/browser-playwright version exactly
eemeli Apr 18, 2026
f446f50
test: Fix object key type when used as mapping key
eemeli Apr 18, 2026
31ff575
chore: Refresh lockfile
eemeli Apr 18, 2026
6708a3e
chore: Drop deprecated resolve.alias customResolvers from vitest configs
eemeli Apr 18, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 6 additions & 9 deletions .github/vitest.browserstack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,11 @@ const instances = env.BROWSERS.split(' ').map(name => {

export default defineConfig({
test: {
alias: [
{
find: /^yaml/,
customResolver(path) {
const name = path.split('/')[1] ?? 'index'
return resolve(import.meta.dirname, '..', 'dist', `${name}.js`)
}
}
],
alias: {
'yaml/cli': resolve(import.meta.dirname, '..', 'dist', 'cli.js'),
'yaml/util': resolve(import.meta.dirname, '..', 'dist', 'util.js'),
yaml: resolve(import.meta.dirname, '..', 'dist', 'index.js')
},
api: { host: '0.0.0.0' },
browser: {
enabled: true,
Expand All @@ -42,6 +38,7 @@ export default defineConfig({
instances
},
globals: true,
setupFiles: ['tests/_setup.ts'],
include: ['tests/**/*.{js,ts}'],
exclude: [
'tests/_*',
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/browsers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:

- run: npm ci
- run: npm run build
- run: npm install --no-save @vitest/browser-playwright@4
- run: npm install --no-save @vitest/browser-playwright@4.1.4
- run: npx vitest run --config=.github/vitest.browserstack.config.js
env:
BROWSERS: chrome:93 chrome:latest firefox:latest
Expand Down Expand Up @@ -55,7 +55,7 @@ jobs:

- run: npm ci
- run: npm run build
- run: npm install --no-save @vitest/browser-playwright@4
- run: npm install --no-save @vitest/browser-playwright@4.1.4
- run: npx vitest run --config=.github/vitest.browserstack.config.js
env:
BROWSERS: firefox:94
Expand Down
36 changes: 18 additions & 18 deletions docs/03_options.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,14 @@ Parse options affect the parsing and composition of a YAML Document from it sour

Used by: `parse()`, `parseDocument()`, `parseAllDocuments()`, `new Composer()`, and `new Document()`

| Name | Type | Default | Description |
| ---------------- | ----------------------------- | ------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| intAsBigInt | `boolean` | `false` | Whether integers should be parsed into [BigInt] rather than `number` values. |
| keepSourceTokens | `boolean` | `false` | Include a `srcToken` value on each parsed `Node`, containing the [CST token](#working-with-cst-tokens) that was composed into this node. |
| lineCounter | `LineCounter` | | If set, newlines will be tracked, to allow for `lineCounter.linePos(offset)` to provide the `{ line, col }` positions within the input. |
| prettyErrors | `boolean` | `true` | Include line/col position in errors, along with an extract of the source string. |
| strict | `boolean` | `true` | When parsing, do not ignore errors [required](#silencing-errors-and-warnings) by the YAML 1.2 spec, but caused by unambiguous content. |
| stringKeys | `boolean` | `false` | Parse all mapping keys as strings. Treat all non-scalar keys as errors. |
| uniqueKeys | `boolean ⎮ (a, b) => boolean` | `true` | Whether key uniqueness is checked, or customised. If set to be a function, it will be passed two parsed nodes and should return a boolean value indicating their equality. |
| Name | Type | Default | Description |
| ---------------- | ------------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------- |
| intAsBigInt | `boolean` | `false` | Whether integers should be parsed into [BigInt] rather than `number` values. |
| keepSourceTokens | `boolean` | `false` | Include a `srcToken` value on each parsed `Node`, containing the [CST token](#working-with-cst-tokens) that was composed into this node. |
| lineCounter | `LineCounter` | | If set, newlines will be tracked, to allow for `lineCounter.linePos(offset)` to provide the `{ line, col }` positions within the input. |
| prettyErrors | `boolean` | `true` | Include line/col position in errors, along with an extract of the source string. |
| strict | `boolean` | `true` | When parsing, do not ignore errors [required](#silencing-errors-and-warnings) by the YAML 1.2 spec, but caused by unambiguous content. |
| stringKeys | `boolean` | `false` | Parse all mapping keys as strings. Treat all non-scalar keys as errors. |

[bigint]: https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/BigInt

Expand Down Expand Up @@ -72,15 +71,15 @@ The `!!value` and `!!yaml` types are not supported.

Used by: `parse()`, `parseDocument()`, `parseAllDocuments()`, `stringify()`, `new Composer()`, `new Document()`, and `doc.setSchema()`

| Name | Type | Default | Description |
| ---------------- | ------------------------------------ | ----------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| compat | `string ⎮ Tag[] ⎮ null` | `null` | When parsing, warn about compatibility issues with the given schema. When stringifying, use scalar styles that are parsed correctly by the `compat` schema as well as the actual schema. |
| customTags | `Tag[] ⎮ function` | | Array of [additional tags](#custom-data-types) to include in the schema |
| merge | `boolean` | 1.1:&nbsp;`true` 1.2:&nbsp;`false` | Enable support for `<<` merge keys. Default value depends on YAML version. |
| resolveKnownTags | `boolean` | `true` | When using the `'core'` schema, support parsing values with these explicit [YAML 1.1 tags]: `!!binary`, `!!omap`, `!!pairs`, `!!set`, `!!timestamp`. By default `true`. |
| schema | `string ⎮ Schema` | 1.1:&nbsp;`'yaml-1.1'` 1.2:&nbsp;`'core'` | The base schema to use. Default value depends on YAML version. Built-in support is provided for `'core'`, `'failsafe'`, `'json'`, and `'yaml-1.1'`. If using another string value, `customTags` must be an array of tags. |
| sortMapEntries | `boolean ⎮` `(a, b: Pair) => number` | `false` | When stringifying, sort map entries. If `true`, sort by comparing key values using the native less-than `<` operator. |
| toStringDefaults | `ToStringOptions` | | Override default values for `toString()` options. |
| Name | Type | Default | Description |
| ---------------- | ----------------------- | ----------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| compat | `string ⎮ Tag[] ⎮ null` | `null` | When parsing, warn about compatibility issues with the given schema. When stringifying, use scalar styles that are parsed correctly by the `compat` schema as well as the actual schema. |
| customTags | `Tag[] ⎮ function` | | Array of [additional tags](#custom-data-types) to include in the schema |
| mapKey | `(key: any) => any` | | Determine an internal key representation for map and set values, which is used for detecting duplicates and to identify values. |
| merge | `boolean` | 1.1:&nbsp;`true` 1.2:&nbsp;`false` | Enable support for `<<` merge keys. Default value depends on YAML version. |
| resolveKnownTags | `boolean` | `true` | When using the `'core'` schema, support parsing values with these explicit [YAML 1.1 tags]: `!!binary`, `!!omap`, `!!pairs`, `!!set`, `!!timestamp`. By default `true`. |
| schema | `string ⎮ Schema` | 1.1:&nbsp;`'yaml-1.1'` 1.2:&nbsp;`'core'` | The base schema to use. Default value depends on YAML version. Built-in support is provided for `'core'`, `'failsafe'`, `'json'`, and `'yaml-1.1'`. If using another string value, `customTags` must be an array of tags. |
| toStringDefaults | `ToStringOptions` | | Override default values for `toString()` options. |

[yaml 1.1 tags]: https://yaml.org/type/

Expand Down Expand Up @@ -166,5 +165,6 @@ Used by: `stringify()` and `doc.toString()`
| nullStr | `string` | `'null'` | String representation for `null` values. |
| simpleKeys | `boolean` | `false` | Require keys to be scalars and always use implicit rather than explicit notation. |
| singleQuote | `boolean ⎮ null` | `null` | Use 'single quote' rather than "double quote" where applicable. Set to `false` to disable single quotes completely. |
| sortMapEntries | `boolean ⎮` `(a, b: Pair) => number` | `false` | Sort map and set entries. If `true`, sort by comparing key values using the native less-than `<` operator. |
| trailingComma | `boolean` | `false` | Add a trailing comma after the last entry in a flow collection that's split across multiple lines. |
| trueStr | `string` | `'true'` | String representation for `true` values. |
Loading
Loading