GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Avoid validating visitors produced by `traverse.visitors.merge` by nicolo-ribaudo · Pull Request #16699 · babel/babel

Conversation

@nicolo-ribaudo

@nicolo-ribaudo nicolo-ribaudo commented Jul 30, 2024

Copy link
Copy Markdown
Member
Q                       A
Fixed Issues? Fixes #16689 (comment)
Patch: Bug Fix?
Major: Breaking Change?
Minor: New Feature?
Tests Added + Pass? Yes
Documentation PR Link
Any Dependency Changes?
License MIT

This PR marks as "already validated" all visitors produced by traverse.visitor.merge, which internally does validation of all of its inputs. This means that passing those visitors to older versions of @babel/traverse will not throw anymore.

With this change I can get the example from #16689 (comment) to build, even if then fails with "regeneratorRuntime is not defined" (which is a completely separate problem, probably a bug in my setup)

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@nicolo-ribaudo
Avoid re-validating visitors produced by traverse.visitors.merge
44beed8
@nicolo-ribaudo nicolo-ribaudo added the PR: Bug Fix 🐛 A type of pull request used for our changelog categories label Jul 30, 2024
@babel-bot

babel-bot commented Jul 30, 2024 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Collaborator

Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/57541

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@nicolo-ribaudo
Update snapshots
5266a81
liuxingbaoyu
liuxingbaoyu approved these changes Jul 30, 2024
View reviewed changes
Comment thread packages/babel-traverse/src/visitors.ts
Comment on lines +249 to +255
if (!process.env.BABEL_8_BREAKING) {
// For compatibility with old Babel versions, we must hide _verified and _exploded.
// Otherwise, old versions of the validator will throw sayng that `true` is not
// a function, because it tries to validate it as a visitor.
Object.defineProperty(mergedVisitor, "_exploded", { enumerable: false });
Object.defineProperty(mergedVisitor, "_verified", { enumerable: false });
}

@liuxingbaoyu liuxingbaoyu Jul 30, 2024

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm surprised they would fail for enumerable _exploded but still work for non-enumerable _exploded.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@nicolo-ribaudo nicolo-ribaudo Jul 30, 2024

Copy link
Copy Markdown
Member Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They do Object.keys :)

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

liuxingbaoyu reacted with heart emoji
All reactions
  • ❤️ 1 reaction

@liuxingbaoyu liuxingbaoyu Jul 30, 2024

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have some concerns that visitors will still be revalidated on these versions. (I'm not sure how older versions did it)
Since they throw on _exploded, that means they probably don't follow _exploded and validate again.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@nicolo-ribaudo nicolo-ribaudo Jul 30, 2024

Copy link
Copy Markdown
Member Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They check visitor._verified, so it works even if it's non-enumerable.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

liuxingbaoyu reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
JLHwung
JLHwung approved these changes Jul 30, 2024
View reviewed changes
@nicolo-ribaudo nicolo-ribaudo changed the title Avoid re-validating visitors produced by traverse.visitors.merge Avoid validating visitors produced by traverse.visitors.merge Jul 30, 2024
@nicolo-ribaudo
nicolo-ribaudo merged commit 992c6e0 into babel:main Jul 30, 2024
@nicolo-ribaudo
nicolo-ribaudo deleted the no-explode-validate branch July 30, 2024 20:48
@nicolo-ribaudo

nicolo-ribaudo commented Jul 30, 2024

Copy link
Copy Markdown
Member Author

I'll release once we land #16700

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@nejidevelops nejidevelops mentioned this pull request Aug 21, 2024
[Snyk] Upgrade: , nejidevelops/phase-0-intro-to-js-2-looping-code-along#53
Open
@rawdaymohamed rawdaymohamed mentioned this pull request Aug 21, 2024
[Snyk] Upgrade: , , , rawdaymohamed/Hot-Todo#359
Open
This was referenced Aug 21, 2024
[Snyk] Upgrade: , nejidevelops/phase-1-destructuring-assignment#55
Open
[Snyk] Upgrade: , nejidevelops/phase-1-domcontentloaded#52
Open
@jlourenc jlourenc mentioned this pull request Aug 21, 2024
[Snyk] Upgrade: , , snyk/vscode-extension#518
Closed
This was referenced Aug 21, 2024
[Snyk] Upgrade @babel/preset-env from 7.10.4 to 7.25.3 tiff-es/tiffany-portfolio-responsive#485
Open
[Snyk] Upgrade: , tiff-es/fewpjs-class-extensions-super-lab-online-web-sp-000#211
Open
[Snyk] Upgrade: , tiff-es/fewpjs-document-onload-dc-web-091619#214
Open
[Snyk] Upgrade: , tiff-es/fewpjs-fns-as-first-class-data-array-o-functions-dc-web-091619#216
Open
[Snyk] Upgrade: , tiff-es/fewpjs-adding-behavior-with-methods-dc-web-091619#225
Open
[Snyk] Upgrade: , tiff-es/fewpjs-fns-as-first-class-data-do-behavior-dc-web-091619#207
Open
[Snyk] Upgrade: , tiff-es/fewpjs-getter-and-setter-methods-dc-web-091619#228
Open
@bee22193 bee22193 mentioned this pull request Aug 21, 2024
[Snyk] Upgrade: , bee22193/mnmlurl#1239
Open
@rish2497 rish2497 mentioned this pull request Aug 22, 2024
[Snyk] Upgrade: , i3-Market-V3-Public-Repository/Support---Deployment-Tools#43
Open
@richyhoopd richyhoopd mentioned this pull request Aug 22, 2024
[Snyk] Upgrade: , , richyhoopd/Video-App#1200
Open
This was referenced Aug 22, 2024
[Snyk] Upgrade: , nejidevelops/phase-0-intro-to-js-2-objects-lab#55
Open
[Snyk] Upgrade: , nejidevelops/phase-0-javascript-events-acting-on-events-lab#53
Open
[Snyk] Upgrade: , nejidevelops/phase-1-domcontentloaded#53
Open
[Snyk] Upgrade: , nejidevelops/phase-0-intro-to-js-2-looping-code-along#54
Open
@keyasuda keyasuda mentioned this pull request Aug 22, 2024
[Snyk] Upgrade: , keyasuda/bormashino#165
Merged
@YoYBaBy YoYBaBy mentioned this pull request Oct 25, 2024
[Snyk] Upgrade @babel/preset-env from 7.8.4 to 7.25.7 YoYBaBy/docs#870
Open
@nejidevelops nejidevelops mentioned this pull request Oct 26, 2024
[Snyk] Upgrade @babel/preset-env from 7.4.5 to 7.25.7 nejidevelops/phase-1-destructuring-assignment#100
Open
@richyhoopd richyhoopd mentioned this pull request Oct 26, 2024
[Snyk] Upgrade @babel/preset-env from 7.9.0 to 7.25.7 richyhoopd/Video-App#1237
Open
This was referenced Oct 26, 2024
[Snyk] Upgrade @babel/preset-env from 7.6.3 to 7.25.7 tiff-es/js-looping-and-iteration-looping-code-along-dc-web-091619#250
Open
[Snyk] Upgrade @babel/preset-env from 7.4.5 to 7.25.7 tiff-es/fewpjs-fns-as-first-class-data-do-behavior-dc-web-091619#244
Open
This was referenced Oct 26, 2024
[Snyk] Upgrade @babel/preset-env from 7.18.2 to 7.25.7 nejidevelops/phase-0-intro-to-js-2-looping-code-along#101
Open
[Snyk] Upgrade @babel/preset-env from 7.18.2 to 7.25.7 nejidevelops/phase-0-javascript-events-acting-on-events-lab#102
Open
This was referenced Oct 27, 2024
[Snyk] Upgrade @babel/traverse from 7.23.5 to 7.25.7 liuxin-James/package-analysis#1
Open
[Snyk] Upgrade @babel/parser from 7.23.5 to 7.25.7 liuxin-James/package-analysis#2
Open
This was referenced Oct 27, 2024
[Snyk] Upgrade @babel/preset-env from 7.4.5 to 7.25.7 tiff-es/fewpjs-getter-and-setter-methods-dc-web-091619#268
Open
[Snyk] Upgrade @babel/preset-env from 7.10.4 to 7.25.7 tiff-es/tiffany-portfolio-responsive#537
Open
This was referenced Oct 27, 2024
[Snyk] Upgrade @babel/parser from 7.9.4 to 7.25.7 Sonic269/App6#146
Open
[Snyk] Upgrade @babel/traverse from 7.8.6 to 7.25.7 Sonic269/App6#148
Open
@rish2497 rish2497 mentioned this pull request Oct 27, 2024
[Snyk] Upgrade @babel/preset-env from 7.14.4 to 7.25.7 i3-Market-V3-Public-Repository/Support---Deployment-Tools#72
Open
@ashly1111111 ashly1111111 mentioned this pull request Oct 27, 2024
[Snyk] Upgrade @babel/preset-env from 7.12.7 to 7.25.7 ashly1111111/docs#236
Open
This was referenced Oct 27, 2024
[Snyk] Upgrade @babel/preset-env from 7.4.5 to 7.25.7 nejidevelops/phase-1-destructuring-assignment#102
Open
[Snyk] Upgrade @babel/preset-env from 7.4.5 to 7.25.7 nejidevelops/phase-1-domcontentloaded#106
Open
[Snyk] Upgrade @babel/preset-env from 7.18.2 to 7.25.7 nejidevelops/phase-0-intro-to-js-2-objects-lab#102
Open
This was referenced Oct 28, 2024
[Snyk] Upgrade @babel/preset-env from 7.4.5 to 7.25.7 tiff-es/js-data-structures-objects-lab-dc-web-091619#244
Open
[Snyk] Upgrade @babel/preset-env from 7.4.5 to 7.25.7 tiff-es/fewpjs-acting-on-events-dc-web-091619#247
Open
@venkatarao-palaparthi venkatarao-palaparthi mentioned this pull request Oct 28, 2024
[Snyk] Upgrade @babel/preset-env from 7.12.13 to 7.25.7 venkatarao-palaparthi/docs#469
Open
@nejidevelops nejidevelops mentioned this pull request Oct 28, 2024
[Snyk] Upgrade @babel/preset-env from 7.4.5 to 7.25.7 nejidevelops/phase-1-domcontentloaded#108
Open
This was referenced Oct 29, 2024
[Snyk] Upgrade @babel/preset-env from 7.4.5 to 7.25.7 tiff-es/fewpjs-class-extensions-super-lab-online-web-sp-000#251
Open
[Snyk] Upgrade @babel/preset-env from 7.4.5 to 7.25.7 tiff-es/fewpjs-document-onload-dc-web-091619#255
Open
[Snyk] Upgrade @babel/preset-env from 7.4.5 to 7.25.7 tiff-es/fewpjs-fns-as-first-class-data-array-o-functions-dc-web-091619#253
Open
This was referenced Oct 29, 2024
[Snyk] Upgrade @babel/parser from 7.1.3 to 7.25.7 Mhmonicox/node#162
Open
[Snyk] Upgrade @babel/traverse from 7.1.4 to 7.25.7 Mhmonicox/node#163
Open
@nejidevelops nejidevelops mentioned this pull request Oct 29, 2024
[Snyk] Upgrade @babel/preset-env from 7.18.2 to 7.25.7 nejidevelops/phase-0-intro-to-js-2-objects-lab#104
Open
@github-actions github-actions Bot added the outdated A closed issue/PR that is archived due to age. Recommended to make a new issue label Oct 30, 2024
@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Oct 30, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Reviewers

@liuxingbaoyu liuxingbaoyu liuxingbaoyu approved these changes
@JLHwung JLHwung JLHwung approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

outdated A closed issue/PR that is archived due to age. Recommended to make a new issue PR: Bug Fix 🐛 A type of pull request used for our changelog categories

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

[Bug]: Something tricky with the latest babel/traverse

Uh oh!

There was an error while loading. Please reload this page.

4 participants

@nicolo-ribaudo @babel-bot @JLHwung @liuxingbaoyu
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.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.