Skip to content

fix(yaml): preserve numeric mapping keys - #2030

Open
sricharanreddycheruku wants to merge 3 commits into
rollup:masterfrom
sricharanreddycheruku:new/yaml-quote-numeric-mapping-keys
Open

sricharanreddycheruku wants to merge 3 commits into
rollup:masterfrom
sricharanreddycheruku:new/yaml-quote-numeric-mapping-keys

Conversation

@sricharanreddycheruku

@sricharanreddycheruku sricharanreddycheruku commented Oct 11, 2026 •

Copy link
Copy Markdown

Rollup Plugin Name: @rollup/plugin-yaml

This PR contains:

  • bugfix
  • feature
  • refactor
  • documentation
  • other

Are tests included?

  • yes (bugfixes and features will not be merged without tests)
  • no

Breaking Changes?

  • yes (breaking changes will not be merged unless absolutely necessary)
  • no

If yes, then include "BREAKING CHANGES:" in the first commit message body, followed by a description of what is breaking.

List any relevant issue numbers:

Resolves #1992

Description

Quoted YAML mapping keys such as '01' currently become unquoted JavaScript numeric keys, causing Rollup to reject the generated ES module in strict mode. Large numeric strings can also round to a different property name.

Serialize mappings and arrays with quoted property names while retaining the existing serializer for special values. Tests build the YAML through Rollup and check nested numeric keys, large numeric keys, timestamps, non-finite numbers, aliases, named export identity and special values returned by a transform. Compatibility coverage also checks boxed objects, sparse arrays and circular containers.

Arrays with trailing holes retain the existing tosource behavior, which drops one trailing hole. The compatibility test checks array lengths and missing indexes and also passes with unchanged master.

Validation: pnpm test in packages/yaml passed all 111 tests. Root pnpm lint and pnpm prettier:check passed. The numeric-key regression failed on unchanged master with the reported strict-mode error.

@greptile-apps

greptile-apps Bot commented Oct 11, 2026 •

Copy link
Copy Markdown

RetriggerConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; the previous coverage gap is addressed and no new blocking issue was found.

Reviews (2) 路 Last reviewed commit: "test(yaml): cover existing trailing-hole..." 路 Reviewed by Greptile

Comment thread packages/yaml/test/test.js
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

import YAML file, RollupError: 'Legacy octal escape is not permitted in strict mode'

1 participant