From a35a40e6398bdd93b8c3c4a07394fe75624d516f Mon Sep 17 00:00:00 2001 From: liuxingbaoyu <30521560+liuxingbaoyu@users.noreply.github.com> Date: Mon, 5 Aug 2024 19:17:08 +0800 Subject: [PATCH 1/3] doc --- docs/v8-migration-api.md | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/docs/v8-migration-api.md b/docs/v8-migration-api.md index 7b1944c8fa..b12bbfe4b4 100644 --- a/docs/v8-migration-api.md +++ b/docs/v8-migration-api.md @@ -307,7 +307,7 @@ Check out the [v8-migration guide](v8-migration.md) for other user-level changes --- functionExpressionPath.is("id") --- functionExpressionPath.has("id") +++ functionExpressionPath.node.id - + --- functionExpressionPath.has("arguments") +++ !!functionExpressionPath.node.arguments.length @@ -315,6 +315,22 @@ Check out the [v8-migration guide](v8-migration.md) for other user-level changes +++ !functionExpressionPath.node.async ``` +- Remove some `Scope` methods ([#16705](https://github.com/babel/babel/pull/16705)) + + __Migration__: + `_generateUid`, `_renameFromMap`, `getAllBindingsOfKind`, `traverse`, `toArray` + These methods are meant to be private so there is no real migration approach. But if your plugin / build is broken by this change, feel free to open an issue and tell us how you use these methods and we can see what we can do after Babel 8 is released. + + `parentBlock`, `hub` + Access `scope.path` instead. + ```diff + --- scope.hub + +++ scope.path.hub + + --- scope.parentBlock + +++ scope.path.parent + ``` + ![low](https://img.shields.io/badge/risk%20of%20breakage%3F-low-yellowgreen.svg) - Remove `block` argument from `Scope#rename` ([#15288](https://github.com/babel/babel/pull/15288)) From cf3b197ada7387a2f8077afb53d5a18f5703621b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Ribaudo?= Date: Sat, 7 Sep 2024 11:15:58 +0200 Subject: [PATCH 2/3] Update v8-migration-api.md --- docs/v8-migration-api.md | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/docs/v8-migration-api.md b/docs/v8-migration-api.md index b12bbfe4b4..83448fec44 100644 --- a/docs/v8-migration-api.md +++ b/docs/v8-migration-api.md @@ -315,22 +315,26 @@ Check out the [v8-migration guide](v8-migration.md) for other user-level changes +++ !functionExpressionPath.node.async ``` -- Remove some `Scope` methods ([#16705](https://github.com/babel/babel/pull/16705)) +- Remove `Scope.prototype.traverse`, `Scope#parentBlock` and `Scope#hub` ([#16705](https://github.com/babel/babel/pull/16705)) - __Migration__: - `_generateUid`, `_renameFromMap`, `getAllBindingsOfKind`, `traverse`, `toArray` - These methods are meant to be private so there is no real migration approach. But if your plugin / build is broken by this change, feel free to open an issue and tell us how you use these methods and we can see what we can do after Babel 8 is released. - - `parentBlock`, `hub` - Access `scope.path` instead. + __Migration__: Use `scope.path` methods and properties instead: ```diff - --- scope.hub - +++ scope.path.hub + --- scope.traverse(scopeRootNode, visitor, state) + +++ scope.path.traverse(visitor, state) --- scope.parentBlock +++ scope.path.parent + + --- scope.hub + +++ scope.path.hub ``` +- Remove `Scope.prototype.getAllBindingsOfKind` and `Scope.prototype.toArray` + + These methods have been removed as they are not used anymore in our code base. + + __Migration__: You can copy&paste them from Babel 7's source to your plugin. + ![low](https://img.shields.io/badge/risk%20of%20breakage%3F-low-yellowgreen.svg) - Remove `block` argument from `Scope#rename` ([#15288](https://github.com/babel/babel/pull/15288)) @@ -348,9 +352,12 @@ Check out the [v8-migration guide](v8-migration.md) for other user-level changes __Migration__: Adapt to the new behaviour. You can use `NodePath#shouldSkip` to check whether a NodePath has been skipped before calling `NodePath#requeue()`. -- Remove methods starting with `_` ([#16504](https://github.com/babel/babel/pull/16504)) +- Remove methods starting with `_` from `Scope` and `NodePath` ([#16504](https://github.com/babel/babel/pull/16504), [#16705](https://github.com/babel/babel/pull/16705)) - ``` + These methods were meant to be private. + + ```js + // NodePath.prototype _assertUnremoved _call _callRemovalHooks @@ -371,6 +378,8 @@ Check out the [v8-migration guide](v8-migration.md) for other user-level changes _resyncParent _resyncRemoved _verifyNodeList + + // Scope.prototype ``` __Migration__: These methods are meant to be private so there is no real migration approach. But if your plugin / build is broken by this change, feel free to open an issue and tell us how you use these methods and we can see what we can do after Babel 8 is released. From 740235048e404155b22563436b97b8e6eadf5c3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Ribaudo?= Date: Sat, 7 Sep 2024 11:17:10 +0200 Subject: [PATCH 3/3] Update docs/v8-migration-api.md --- docs/v8-migration-api.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/v8-migration-api.md b/docs/v8-migration-api.md index 83448fec44..2653753770 100644 --- a/docs/v8-migration-api.md +++ b/docs/v8-migration-api.md @@ -380,6 +380,8 @@ Check out the [v8-migration guide](v8-migration.md) for other user-level changes _verifyNodeList // Scope.prototype + _renameFromMap + _generateUid ``` __Migration__: These methods are meant to be private so there is no real migration approach. But if your plugin / build is broken by this change, feel free to open an issue and tell us how you use these methods and we can see what we can do after Babel 8 is released.