Conversation
|
commit: |
|
This is ready as soon as we merge sveltejs/esrap#79 and update the referenced package here away from pkg.pr.new |
|
sveltejs/esrap#90 was merged in lieu of sveltejs/esrap#79 and released as esrap@2.2.0 But I'm guessing it's not a simple package change anymore. |
There was a problem hiding this comment.
Pull request overview
This PR updates the esrap library from ^1.4.9 to ^2.2.0 and adapts the codebase to handle the breaking changes in how comments are managed during AST processing. The new version requires explicit comment state management instead of automatically attaching comments to AST nodes.
Key Changes:
- Introduces
CommentStateandCommentsclasses to manage comment associations with AST nodes - Updates
parseScriptto return bothastandcommentStateinstead of pre-attaching comments to nodes - Modifies
serializeScriptto acceptcommentStateparameter for proper comment serialization - Removes
guessQuoteStylefunction as esrap 2.x handles quote styles internally
Reviewed changes
Copilot reviewed 19 out of 20 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| pnpm-lock.yaml | Updates esrap dependency from 1.4.9 to 2.2.0 and adjusts snapshots |
| packages/core/package.json | Updates esrap version specification to ^2.2.0 |
| packages/core/tooling/index.ts | Implements new comment handling system with CommentState and Comments classes; removes guessQuoteStyle; updates parseScript and serializeScript signatures |
| packages/core/tooling/parsers.ts | Updates parseScript wrapper to expose comments and handle new API |
| packages/core/tooling/js/index.ts | Exports Comments type for external use |
| packages/core/tooling/js/common.ts | Updates comment manipulation functions to use Comments class methods instead of direct node property manipulation |
| packages/core/tests/utils.ts | Updates test utilities to use new API; removes guessQuoteStyle tests |
| packages/core/tests/js/index.ts | Updates test runner to pass comments parameter to test run functions |
| packages/core/tests/js/common/jsdoc-type-comment/run.ts | Updates to use new Comments API |
| packages/core/tests/js/common/jsdoc-comment/run.ts | Updates to use new Comments API |
| packages/core/tests/js/object/create/run.ts | Removes direct leadingComments manipulation |
| packages/core/tests/js/vite/with-satisfies/output.ts | Test snapshot update reflecting formatting changes from esrap 2.x |
| packages/core/tests/js/vite/add-plugin-mode/output.ts | Test snapshot update reflecting formatting changes from esrap 2.x |
| packages/core/tests/js/object/property-node/output.ts | Test snapshot update reflecting formatting changes from esrap 2.x |
| packages/core/tests/js/object/override-property/output.ts | Test snapshot update reflecting formatting changes from esrap 2.x |
| packages/core/tests/js/object/ensure-nested-property/output.ts | Test snapshot update reflecting formatting changes from esrap 2.x |
| packages/core/tests/js/object/create/output.ts | Test snapshot update reflecting formatting and removed prettier-ignore comment |
| packages/core/tests/js/common/jsdoc-type-comment/output.ts | Test snapshot update showing comment formatting change |
| packages/addons/sveltekit-adapter/index.ts | Updates to use new Comments API; implements comment filtering by modifying original array |
| packages/addons/eslint/index.ts | Updates to use new Comments API with addLeading method |
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
jycouet
left a comment
There was a problem hiding this comment.
I think I need to pull it locally to see a bit more :)
Will do in coming days.
Thx 🎉
|
Thanks! That's really an elegant change to the snapshots, expect maybe for |
|
This got way bigger than I initially expected. Glad we got it done. |
Figure out how to handle adding new comments during ast processing.