Skip to content

Commit 8b62c18

Browse files
refactor(@angular/build): use t.buildUndefinedNode instead of Scope#buildUndefinedNode
Babel 8 is _likely_ going to remove the variant on `Scope#`, since this method has not needed scope-specific information in ages.
1 parent afb4ef2 commit 8b62c18

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

packages/angular/build/src/tools/babel/plugins/elide-angular-metadata.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* found in the LICENSE file at https://angular.dev/license
77
*/
88

9-
import type { NodePath, PluginObj } from '@babel/core';
9+
import type { types as BabelTypes, NodePath, PluginObj } from '@babel/core';
1010

1111
/**
1212
* The name of the Angular class metadata function created by the Angular compiler.
@@ -48,7 +48,7 @@ const angularMetadataFunctions: Record<string, (args: NodePath[]) => boolean> =
4848
*
4949
* @returns A babel plugin object instance.
5050
*/
51-
export default function (): PluginObj {
51+
export default function ({ types: t }: { types: typeof BabelTypes }): PluginObj {
5252
return {
5353
visitor: {
5454
CallExpression(path) {
@@ -79,7 +79,7 @@ export default function (): PluginObj {
7979
if (parent && (parent.isFunctionExpression() || parent.isArrowFunctionExpression())) {
8080
// Replace the metadata function with `void 0` which is the equivalent return value
8181
// of the metadata function.
82-
path.replaceWith(path.scope.buildUndefinedNode());
82+
path.replaceWith(t.buildUndefinedNode());
8383
}
8484
}
8585
},

0 commit comments

Comments
 (0)