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 — `await using` normative updates by JLHwung · Pull Request #16537 · babel/babel

Conversation

@JLHwung

@JLHwung JLHwung commented May 30, 2024 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Contributor
Q                       A
Fixed Issues? Implements tc39/proposal-explicit-resource-management#218, tc39/proposal-explicit-resource-management#219, closes #16409
Patch: Bug Fix?
Major: Breaking Change?
Minor: New Feature?
Tests Added + Pass? Yes
Documentation PR Link
Any Dependency Changes?
License MIT

This PR implements the following normative changes:

  • The promise returned by a Symbol.dispose method in an await using declaration is ignored
  • Synchronous errors thrown by a Symbol.dispose method in an await using declaration are turned into promise rejections.

Both of them are supported via a wrapper around the Symbol.dispose method.

This PR also fixes a compliance issue: When searching a dispose method, Babel will not fallback to Symbol.dispose if Symbol.asyncDispose method is null or document.all.

Sorry, something went wrong.

Uh oh!

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

All reactions
@JLHwung JLHwung added PR: Spec Compliance 👓 A type of pull request used for our changelog categories Spec: Explicit Resource Management labels May 30, 2024
@babel-bot

babel-bot commented May 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/57425

All reactions

Sorry, something went wrong.

Uh oh!

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

@JLHwung
JLHwung force-pushed the await-using-normative-updates branch from e60eacb to 2aa75eb Compare May 30, 2024 05:42
@JLHwung JLHwung mentioned this pull request May 30, 2024
Improve async dispose fallback #16409
Closed
liuxingbaoyu
liuxingbaoyu reviewed May 30, 2024
View reviewed changes
Comment thread packages/babel-helpers/src/helpers/usingCtx.ts
Comment on lines +36 to +76
if (isAwait) {
var inner = dispose;
}

@liuxingbaoyu liuxingbaoyu May 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.

var inner = isAwait && dispose;
Will this be smaller?

Sorry, something went wrong.

Uh oh!

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

All reactions

@JLHwung JLHwung May 30, 2024

Copy link
Copy Markdown
Contributor 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.

- // size: 972, gzip size: 498
+ // size: 971, gzip size: 500

It will save one byte for plaintext but the compressed size is increased by 2.

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
liuxingbaoyu
liuxingbaoyu approved these changes May 31, 2024
View reviewed changes
@nicolo-ribaudo

nicolo-ribaudo commented Jun 20, 2024

Copy link
Copy Markdown
Member

Could you include tc39/proposal-explicit-resource-management#219 too?

JLHwung reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

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

@JLHwung
JLHwung force-pushed the await-using-normative-updates branch 2 times, most recently from 898b27d to 631f722 Compare June 24, 2024 14:33
@JLHwung

JLHwung commented Jun 24, 2024

Copy link
Copy Markdown
Contributor Author

It seems that the CI failure on Node.js 8 is due to a platform-specific bug. I will skip the new test for Node < 10.

All reactions

Sorry, something went wrong.

Uh oh!

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

@JLHwung
JLHwung requested a review from nicolo-ribaudo July 2, 2024 18:31
nicolo-ribaudo
nicolo-ribaudo approved these changes Jul 3, 2024
View reviewed changes

@nicolo-ribaudo nicolo-ribaudo left a comment

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 think this looks correct to me, I'll make sure that we are running test262 tests though

Sorry, something went wrong.

Uh oh!

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

All reactions
JLHwung
JLHwung commented Jul 3, 2024
View reviewed changes
Comment thread packages/babel-helpers/src/helpers/usingCtx.ts
if (resource.a) {
return Promise.resolve(disposalResult).then(next, err);
if (!resource.a && state === StateFlag.NEEDS_AWAIT) {
state = StateFlag.NONE;

@JLHwung JLHwung Jul 3, 2024 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Contributor 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.

Note: If tc39/proposal-explicit-resource-management#219 (comment) gets consensus, we can simply change this line to state = StateFlag.HAS_AWAITED. Before that happens we implement the 2024-06 version as-is.

Sorry, something went wrong.

Uh oh!

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

nicolo-ribaudo and liuxingbaoyu reacted with thumbs up emoji
All reactions
  • 👍 2 reactions
@nicolo-ribaudo nicolo-ribaudo mentioned this pull request Jul 3, 2024
Run explicit resource management tests babel/babel-test262-runner#60
Merged
JLHwung added 10 commits July 22, 2024 09:13
@JLHwung
fallback to sync dispose on undefined asyncDispose
1295d8c
@JLHwung
simplify error message
afcb80b
@JLHwung
wrap syncDispose within wrapper in await using
ecbbe52
@JLHwung
add test case
1dfb078
@JLHwung
update artifacts
b85fce8
@JLHwung
make linter happy
5fb5d94
@JLHwung
Implement erm PR 219
7c77d4f
@JLHwung
add test cases
2713a89
@JLHwung
update artifacts
d6f0db6
@JLHwung
run test on Node.js >= 10 only
b9602b1
@JLHwung
JLHwung force-pushed the await-using-normative-updates branch from 7a63e72 to b9602b1 Compare July 22, 2024 13:14
@JLHwung
JLHwung merged commit 2def809 into babel:main Jul 22, 2024
@JLHwung
JLHwung deleted the await-using-normative-updates branch July 22, 2024 21:11
This was referenced Aug 16, 2024
[Snyk] Upgrade: , nejidevelops/phase-0-javascript-events-acting-on-events-lab#50
Open
[Snyk] Upgrade: , nejidevelops/phase-0-intro-to-js-2-looping-code-along#50
Open
@mdfkbtc mdfkbtc mentioned this pull request Oct 4, 2024
[Snyk] Upgrade @babel/preset-env from 7.5.0 to 7.25.4 mdfkbtc/veles-mobile-wallet-mdfkbtc#1865
Open
@richyhoopd richyhoopd mentioned this pull request Oct 4, 2024
[Snyk] Upgrade @babel/preset-env from 7.9.0 to 7.25.4 richyhoopd/Video-App#1231
Open
@nejidevelops nejidevelops mentioned this pull request Oct 4, 2024
[Snyk] Upgrade @babel/preset-env from 7.18.2 to 7.25.4 nejidevelops/phase-0-intro-to-js-2-looping-code-along#95
Open
@jetboard jetboard mentioned this pull request Oct 4, 2024
[Snyk] Upgrade @babel/preset-env from 7.24.7 to 7.25.4 jetboard/swagger-editor#4
Open
This was referenced Oct 4, 2024
[Snyk] Upgrade @babel/preset-env from 7.18.2 to 7.25.4 nejidevelops/phase-0-javascript-events-acting-on-events-lab#96
Open
[Snyk] Upgrade @babel/preset-env from 7.18.2 to 7.25.4 nejidevelops/phase-0-intro-to-js-2-objects-lab#92
Open
[Snyk] Upgrade @babel/preset-env from 7.4.5 to 7.25.4 nejidevelops/phase-1-domcontentloaded#96
Open
[Snyk] Upgrade @babel/preset-env from 7.4.5 to 7.25.4 nejidevelops/phase-1-destructuring-assignment#94
Open
This was referenced Oct 5, 2024
[Snyk] Upgrade @babel/preset-env from 7.4.5 to 7.25.4 tiff-es/fewpjs-class-extensions-super-lab-online-web-sp-000#243
Open
[Snyk] Upgrade @babel/preset-env from 7.4.5 to 7.25.4 tiff-es/js-data-structures-objects-lab-dc-web-091619#238
Open
[Snyk] Upgrade @babel/preset-env from 7.4.5 to 7.25.4 tiff-es/fewpjs-adding-behavior-with-methods-dc-web-091619#246
Open
[Snyk] Upgrade @babel/preset-env from 7.4.5 to 7.25.4 tiff-es/fewpjs-acting-on-events-dc-web-091619#241
Open
[Snyk] Upgrade @babel/preset-env from 7.10.4 to 7.25.4 tiff-es/tiffany-portfolio-responsive#534
Open
@rawdaymohamed rawdaymohamed mentioned this pull request Oct 5, 2024
[Snyk] Upgrade @babel/preset-env from 7.18.10 to 7.25.4 rawdaymohamed/Hot-Todo#402
Closed
This was referenced Oct 5, 2024
[Snyk] Upgrade @babel/parser from 7.1.3 to 7.25.6 NOUIY/node#488
Open
[Snyk] Upgrade @babel/traverse from 7.1.4 to 7.25.6 NOUIY/node#489
Open
[Snyk] Upgrade @babel/generator from 7.1.3 to 7.25.6 NOUIY/node#490
Open
[Snyk] Upgrade @babel/types from 7.1.3 to 7.25.6 NOUIY/node#491
Open
[Snyk] Upgrade @babel/template from 7.1.2 to 7.25.0 NOUIY/node#492
Open
@richyhoopd richyhoopd mentioned this pull request Oct 6, 2024
[Snyk] Upgrade @babel/preset-env from 7.4.5 to 7.25.4 richyhoopd/RichyFlix#937
Open
This was referenced Oct 6, 2024
[Snyk] Upgrade @babel/preset-env from 7.4.5 to 7.25.4 tiff-es/fewpjs-getter-and-setter-methods-dc-web-091619#262
Open
[Snyk] Upgrade @babel/preset-env from 7.10.4 to 7.25.4 tiff-es/tiffany-portfolio-responsive#536
Open
@mdfkbtc mdfkbtc mentioned this pull request Oct 6, 2024
[Snyk] Upgrade @babel/preset-env from 7.5.0 to 7.25.4 mdfkbtc/veles-mobile-wallet-mdfkbtc#1868
Open
@nejidevelops nejidevelops mentioned this pull request Oct 8, 2024
[Snyk] Upgrade @babel/preset-env from 7.4.5 to 7.25.4 nejidevelops/phase-1-domcontentloaded#98
Open
This was referenced Oct 8, 2024
[Snyk] Upgrade @babel/preset-env from 7.4.5 to 7.25.4 tiff-es/fewpjs-class-extensions-super-lab-online-web-sp-000#245
Open
[Snyk] Upgrade @babel/preset-env from 7.4.5 to 7.25.4 tiff-es/fewpjs-fns-as-first-class-data-array-o-functions-dc-web-091619#247
Open
[Snyk] Upgrade @babel/preset-env from 7.4.5 to 7.25.4 tiff-es/fewpjs-document-onload-dc-web-091619#249
Open
@paulineribeyre paulineribeyre mentioned this pull request Oct 17, 2024
[Snyk] Upgrade @babel/preset-env from 7.20.2 to 7.25.4 uc-cdis/Atlas#65
Closed
@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 22, 2024
@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Oct 22, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Reviewers

@nicolo-ribaudo nicolo-ribaudo nicolo-ribaudo approved these changes
@liuxingbaoyu liuxingbaoyu liuxingbaoyu 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: Spec Compliance 👓 A type of pull request used for our changelog categories Spec: Explicit Resource Management

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

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

4 participants

@JLHwung @babel-bot @nicolo-ribaudo @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.