Repository navigation
fix: quote flow scalars where a colon precedes a flow indicator - #773
Merged
Merged
Conversation
abdulhafeezenayatallh-lang
approved these changes
Jul 16, 2026
2 of 10 tasks
robbevp
added a commit
to robbevp/website-robbevanpetegem
that referenced
this pull request
Nov 3, 2026
This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [js-yaml](https://github.com/nodeca/js-yaml) | dependencies | major | [`^4.1.0` -> `^5.0.0`](https://renovatebot.com/diffs/npm/js-yaml/4.3.2/5.5.0) | --- ### Release Notes <details> <summary>nodeca/js-yaml (js-yaml)</summary> ### [`v5.5.0`](https://github.com/nodeca/js-yaml/blob/HEAD/CHANGELOG.md#550---2026-10-16) [Compare Source](nodeca/js-yaml@5.4.3...5.5.0) ##### Changed - Updated `argparse` to v3. - Updated development dependencies. ##### Fixed - Correct percent-encoding of shorthand and verbatim tags. - Reject `,`, `]`, and `}` at the start of block plain scalars, [#​801](nodeca/js-yaml#801). - Report the exact position of non-printable characters in errors, [#​801](nodeca/js-yaml#801). ### [`v5.4.3`](https://github.com/nodeca/js-yaml/blob/HEAD/CHANGELOG.md#543---2026-10-06) [Compare Source](nodeca/js-yaml@5.4.2...5.4.3) ##### Fixed - Fixed loading a whitespace-only block scalar followed by a less indented line, [#​802](nodeca/js-yaml#802). ### [`v5.4.2`](https://github.com/nodeca/js-yaml/blob/HEAD/CHANGELOG.md#542---2026-09-13) [Compare Source](nodeca/js-yaml@5.4.1...5.4.2) ##### Fixed - `forceQuotes` no longer quotes non-string scalars, [#​798](nodeca/js-yaml#798). ### [`v5.4.1`](https://github.com/nodeca/js-yaml/blob/HEAD/CHANGELOG.md#541---2026-08-26) [Compare Source](nodeca/js-yaml@5.4.0...5.4.1) ##### Changed - Hard-limit merge sequence size to 100. ##### Security - Count empty mappings in merge sequences toward `maxTotalMergeKeys` to limit CPU usage, [#​797](nodeca/js-yaml#797). ### [`v5.4.0`](https://github.com/nodeca/js-yaml/blob/HEAD/CHANGELOG.md#540---2026-08-25) [Compare Source](nodeca/js-yaml@5.3.0...5.4.0) ##### Added - Added the `scalarStyleRules` dumper option to customize string formatting. See [Scalar styling](docs/scalar_styling.md) for details. ##### Changed - \[breaking] Flattened the low-level AST node style representation. Scalar and collection nodes now use `SCALAR_STYLE` and `COLLECTION_STYLE` values; explicit tags use the separate `tagged` property. Alias nodes now contain only `kind` and `anchor`. This only affects code that directly constructs or edits AST nodes. - \[breaking] The `sortKeys` option was rewritten using AST mutation to avoid side effects. - Reworked scalar style selection. This can change formatting without changing loaded values; in particular, whitespace-only strings are now double-quoted. ##### Fixed - Accept a byte order mark at the start of each document in a stream, [#​791](nodeca/js-yaml#791). - Produce valid flow mappings with `quoteFlowKeys` and `flowSkipColonSpace`, including alias and property-only keys, [#​786](nodeca/js-yaml#786). - Preserve empty scalar items when converting block sequences to flow style. - Do not apply the 1024-character simple-key limit to flow mapping keys. - Count Unicode code points, rather than UTF-16 code units, for the 1024-character simple-key limit. - Add an explicit document-end marker after keep-chomped block scalars when needed to preserve trailing newlines. ### [`v5.3.0`](https://github.com/nodeca/js-yaml/blob/HEAD/CHANGELOG.md#530---2026-08-14) [Compare Source](nodeca/js-yaml@5.2.3...5.3.0) This release focuses on reworking the documentation and making small architectural improvements before moving forward. ##### Added - Added completely new documentation. - Exported `DUMP_SCHEMA`, the default schema used by the dumper. - Added `YAMLException.throwAt()` for throwing an error at a source position. ##### Changed - Changed flat constant exports to grouped exports: `EVENT_ID`, `SCALAR_STYLE`, `COLLECTION_STYLE`, and `CHOMPING_MODE`, along with their value types. The old exports are still preserved, but deprecated. - Made `identify` mandatory for custom tag definitions. Use `identify: () => false` for load-only tags. ##### Deprecated - Deprecated flat constant exports. Use grouped ones instead. ##### Removed - Removed the `MERGE_KEY` export (not used anymore after last fixes). ##### Fixed - Validate `<<` sequence items at merge time, so aliased merge sources are checked too. - Resolve `<<` outside of a mapping key as the plain string `'<<'`, matching v4, instead of leaking an internal symbol into the result. ### [`v5.2.3`](https://github.com/nodeca/js-yaml/blob/HEAD/CHANGELOG.md#523---2026-08-01) [Compare Source](nodeca/js-yaml@5.2.2...5.2.3) ##### Fixed - Prevent prototype fallback when resolving tags and mapping entries, [#​782](nodeca/js-yaml#782). - Resolve `!!timestamp` years 0000-0099 correctly, [#​775](nodeca/js-yaml#775). - Preserve implicit null mapping values before document markers and reject unpaired mapping event streams, [#​784](nodeca/js-yaml#784). - Preserve folded scalar values with tab-indented lines when round-tripping a parsed AST through `present()`; `dump()` and loading are unaffected, [#​780](nodeca/js-yaml#780). ### [`v5.2.2`](https://github.com/nodeca/js-yaml/blob/HEAD/CHANGELOG.md#522---2026-07-24) [Compare Source](nodeca/js-yaml@5.2.1...5.2.2) ##### Fixed - Quote flow scalars where a colon precedes a flow indicator, [#​773](nodeca/js-yaml#773). ##### Security - Avoid exponential parsing time for nested flow sequence pairs. ### [`v5.2.1`](https://github.com/nodeca/js-yaml/blob/HEAD/CHANGELOG.md#521---2026-07-02) [Compare Source](nodeca/js-yaml@5.2.0...5.2.1) ##### Fixed - Add `Map` support to !!omap (should work when `realMapTag` used) ##### Security - Remove quadratic complexity from !!omap `addItem`. Regression from v5 (usually not critical, because YAML11\_SCHEMA is not default anymore). ### [`v5.2.0`](https://github.com/nodeca/js-yaml/blob/HEAD/CHANGELOG.md#520---2026-06-26) [Compare Source](nodeca/js-yaml@5.1.0...5.2.0) ##### Added - Added `maxTotalMergeKeys` (10000) loader option to limit the total number of keys processed by YAML merge (`<<`) across one `load()` / `loadAll()` call. - Added `maxAliases` (-1) loader option to limit the number of YAML aliases per document. ##### Removed - `maxMergeSeqLength` replaced with `maxTotalMergeKeys` for limiting YAML merge processing. ##### Fixed - Round-trip of integers with exponential form (>= `1e21`) ### [`v5.1.0`](https://github.com/nodeca/js-yaml/blob/HEAD/CHANGELOG.md#510---2026-06-23) [Compare Source](nodeca/js-yaml@5.0.0...5.1.0) ##### Added - Collection tags can finalize an incrementally populated carrier into a different result value. ##### Changed - \[breaking] `quoteStyle` now selects the preferred quote style; use the restored `forceQuotes` option to force quoting non-key strings. ### [`v5.0.0`](https://github.com/nodeca/js-yaml/blob/HEAD/CHANGELOG.md#500---2026-06-20) [Compare Source](nodeca/js-yaml@4.3.2...5.0.0) ##### Added - Added named exports for schemas, tags, parser events and AST utilities. - Reworked `JSON_SCHEMA` and `CORE_SCHEMA` with spec-compliant scalar resolution rules, and added `YAML11_SCHEMA`. - Added `realMapTag` for lossless mappings with non-string and complex keys. Object-based mappings now reject complex keys instead of stringifying them. - Added `dump()` `transform` option for changing the generated AST before rendering. - Added `dump()` options `seqInlineFirst`, `flowBracketPadding`, `flowSkipCommaSpace`, `flowSkipColonSpace`, `quoteFlowKeys`, `quoteStyle` and `tagBeforeAnchor`. - Added formal data layers (events and AST) for modular data pipelines. - Added low-level parser (to events), presenter and visitor APIs. - Added the [YAML Test Suite](https://github.com/yaml/yaml-test-suite) to the test set. ##### Changed - See the [migration guide](docs/migrate_v4_to_v5.md) for upgrade notes. - Rewritten in TypeScript and reorganized the public API around flat named exports. - Reduced the set of exported schemas: - YAML 1.2 schemas: `CORE_SCHEMA` (loader default), `JSON_SCHEMA`, `FAILSAFE_SCHEMA`. - `YAML11_SCHEMA`, a combination of all YAML 1.1 tags (YAML 1.1 does not specify a schema, only "types"). - `load`/`dump` default behaviour is now specified exactly via schemas: - `load` uses `CORE_SCHEMA`, without `!!merge` by default. - `dump` uses `YAML11_SCHEMA` + `CORE_SCHEMA` for the quoting check, to guarantee backward compatibility by default. - `!!set` is now loaded as a JavaScript `Set`. - Replaced the `Type` API with a tags API. Similar, but more precise and simpler. See examples for details. Tags can be defined via `defineScalarTag()`, `defineSequenceTag()` and `defineMappingTag()`, or as a spread + override of an existing tag. - Renamed `Schema.extend()` to `Schema.withTags()`. - Expanded YAML 1.2 conformance and improved handling of directives, document markers, block keys, multiline scalars, tag syntax and other things. - `load()` now throws on empty input instead of returning `undefined`. - Moved browser builds to the `js-yaml/browser` export. - Deprecated the `loadAll` signature with an iterator (still works, but is a candidate for removal). ##### Removed - Removed deprecated `safeLoad()`, `safeLoadAll()` and `safeDump()` exports. - Removed `DEFAULT_SCHEMA` and the nested `types` export. - Removed loader options `onWarning`, `legacy` and `listener`. - Removed dumper options `styles`, `replacer`, `noCompatMode`, `condenseFlow`, `quotingType` and `forceQuotes`. Renamed `noArrayIndent` to `seqNoIndent`. Formatting and representation are now configured through presenter options, schemas and tag definitions. See migration guide on how to replace. - Removed support for importing internal files from `lib/`. </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0MS42MS4wIiwidXBkYXRlZEluVmVyIjoiNDEuNjEuMCIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOltdfQ==--> Co-authored-by: Robbe Van Petegem <git@robbevp.be> Reviewed-on: https://git.robbevp.be/robbevp/website-robbevanpetegem/pulls/516
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Flow-style dump produces output the library cannot re-parse when a plain scalar contains a
:immediately followed by a flow indicator ({ } [ ] ,):This breaks
load(dump(x))for values such as':{',':[',':,',':}',':]', and'x:{', in both flow sequences and flow mappings. Block style is unaffected — there the scalar stays plain and round-trips fine, which is correct.Root cause
isPlainSafeinsrc/ast/presenter.tsdecides whether a character may appear unescaped in a plain scalar. Its last clause implements the spec'sns-plain-charrule for a:followed by content:The clause was
(prev === CHAR_COLON && cIsNsChar), i.e. it treated any ns-char after a colon as safe. Butns-plain-safe(c)is context-dependent:ns-plain-safe-out ::= ns-char(block context)ns-plain-safe-in ::= ns-char - c-flow-indicator(flow context)In flow context the following character must additionally not be a flow indicator. Because the clause skipped that exclusion,
{ } [ ] ,after a:were wrongly accepted, so the scalar was emitted plain and the{/[/,reopened or closed the surrounding flow collection.Fix
Add the
c-flow-indicatorexclusion to the colon clause when not in block context, matchingns-plain-safe-in. The#-after-colon case (:#) and normal:xstay plain; flow indicators after a colon now force quoting.Verification
Added
flowLevel — quotes a colon followed by a flow indicatortotest/core/units/dump-options.test.mjs, assertingload(dump(value, { flowLevel: 0 })) === valuefor the affected strings in flow sequences and mappings.missed comma between flow collection entries.npm test, 1599 passing, 0 failing). No over-quoting —:a,a:b,:#,http://xremain plain in flow.dist/is gitignored, so no build artifacts are committed.