Skip to content

Commit 2ede90f

Browse files
committed
build: update babel monorepo to v8
See associated pull request for more information. Closes #33416 as a pr takeover
1 parent e664314 commit 2ede90f

17 files changed

Lines changed: 963 additions & 892 deletions

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
"@angular/platform-server": "22.1.0-next.1",
6060
"@angular/router": "22.1.0-next.1",
6161
"@angular/service-worker": "22.1.0-next.1",
62-
"@babel/core": "7.29.7",
62+
"@babel/core": "8.0.1",
6363
"@bazel/bazelisk": "1.28.1",
6464
"@bazel/buildifier": "8.2.1",
6565
"@bazel/ibazel": "^0.28.0",

packages/angular/build/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020
"dependencies": {
2121
"@ampproject/remapping": "2.3.0",
2222
"@angular-devkit/architect": "workspace:0.0.0-EXPERIMENTAL-PLACEHOLDER",
23-
"@babel/core": "7.29.7",
24-
"@babel/helper-annotate-as-pure": "7.29.7",
23+
"@babel/core": "8.0.1",
24+
"@babel/helper-annotate-as-pure": "8.0.0",
2525
"@babel/helper-split-export-declaration": "7.24.7",
2626
"@inquirer/confirm": "6.1.1",
2727
"@vitejs/plugin-basic-ssl": "2.3.0",

packages/angular/build/src/tools/babel/plugins/add-code-coverage.ts

Lines changed: 4 additions & 4 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 { NodePath, PluginObj, types } from '@babel/core';
9+
import { NodePath, PluginObject, PluginPass, types } from '@babel/core';
1010
import type { Visitor } from 'istanbul-lib-instrument';
1111
import assert from 'node:assert';
1212

@@ -17,13 +17,13 @@ import assert from 'node:assert';
1717
*/
1818
export default function (
1919
programVisitor: typeof import('istanbul-lib-instrument').programVisitor,
20-
): PluginObj {
20+
): PluginObject {
2121
const visitors = new WeakMap<NodePath, Visitor>();
2222

2323
return {
2424
visitor: {
2525
Program: {
26-
enter(path, state) {
26+
enter(path: NodePath<types.Program>, state: PluginPass) {
2727
const visitor = programVisitor(types, state.filename, {
2828
// Babel returns a Converter object from the `convert-source-map` package
2929
inputSourceMap: (state.file.inputMap as undefined | { toObject(): object })?.toObject(),
@@ -32,7 +32,7 @@ export default function (
3232

3333
visitor.enter(path);
3434
},
35-
exit(path) {
35+
exit(path: NodePath<types.Program>) {
3636
const visitor = visitors.get(path);
3737
assert(visitor, 'Instrumentation visitor should always be present for program path.');
3838

packages/angular/build/src/tools/babel/plugins/adjust-static-class-members.ts

Lines changed: 2 additions & 2 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 { NodePath, PluginObj, PluginPass, types } from '@babel/core';
9+
import { NodePath, PluginObject, PluginPass, types } from '@babel/core';
1010
import annotateAsPure from '@babel/helper-annotate-as-pure';
1111
import splitExportDeclaration from '@babel/helper-split-export-declaration';
1212

@@ -206,7 +206,7 @@ const exportDefaultAnalysis = new WeakMap<types.Class, ReturnType<typeof analyze
206206
* @returns A babel plugin object instance.
207207
*/
208208
// eslint-disable-next-line max-lines-per-function
209-
export default function (): PluginObj {
209+
export default function (): PluginObject {
210210
return {
211211
visitor: {
212212
// When a class is converted to a variable declaration, the default export must be moved

packages/angular/build/src/tools/babel/plugins/adjust-static-class-members_spec.ts

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

9-
import { transformSync } from '@babel/core';
109
// eslint-disable-next-line import/no-extraneous-dependencies
1110
import { format } from 'prettier';
1211
import adjustStaticClassMembers from './adjust-static-class-members';
12+
import { PluginItem, transformSync } from '@babel/core';
1313

1414
const NO_CHANGE = Symbol('NO_CHANGE');
1515

@@ -26,7 +26,7 @@ function testCase({
2626
const result = transformSync(input, {
2727
configFile: false,
2828
babelrc: false,
29-
plugins: [[adjustStaticClassMembers, options]],
29+
plugins: [[adjustStaticClassMembers, options] as unknown as PluginItem],
3030
});
3131
if (!result?.code) {
3232
fail('Expected babel to return a transform result.');

packages/angular/build/src/tools/babel/plugins/adjust-typescript-enums.ts

Lines changed: 2 additions & 2 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 { NodePath, PluginObj, types } from '@babel/core';
9+
import { NodePath, PluginObject, types } from '@babel/core';
1010
import annotateAsPure from '@babel/helper-annotate-as-pure';
1111

1212
/**
@@ -24,7 +24,7 @@ export function getKeywords(): Iterable<string> {
2424
*
2525
* @returns A babel plugin object instance.
2626
*/
27-
export default function (): PluginObj {
27+
export default function (): PluginObject {
2828
return {
2929
visitor: {
3030
VariableDeclaration(path: NodePath<types.VariableDeclaration>) {

packages/angular/build/src/tools/babel/plugins/adjust-typescript-enums_spec.ts

Lines changed: 2 additions & 2 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 { transformSync } from '@babel/core';
9+
import { PluginItem, transformSync } from '@babel/core';
1010
// eslint-disable-next-line import/no-extraneous-dependencies
1111
import { format } from 'prettier';
1212
import adjustTypeScriptEnums from './adjust-typescript-enums';
@@ -24,7 +24,7 @@ function testCase({
2424
const result = transformSync(input, {
2525
configFile: false,
2626
babelrc: false,
27-
plugins: [[adjustTypeScriptEnums]],
27+
plugins: [adjustTypeScriptEnums],
2828
});
2929
if (!result?.code) {
3030
fail('Expected babel to return a transform result.');

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 { types as BabelTypes, NodePath, PluginObj } from '@babel/core';
9+
import type { types as BabelTypes, NodePath, PluginObject } from '@babel/core';
1010

1111
/**
1212
* The name of the Angular class metadata function created by the Angular compiler.
@@ -48,10 +48,10 @@ const angularMetadataFunctions: Record<string, (args: NodePath[]) => boolean> =
4848
*
4949
* @returns A babel plugin object instance.
5050
*/
51-
export default function ({ types: t }: { types: typeof BabelTypes }): PluginObj {
51+
export default function ({ types: t }: { types: typeof BabelTypes }): PluginObject {
5252
return {
5353
visitor: {
54-
CallExpression(path) {
54+
CallExpression(path: NodePath<BabelTypes.CallExpression>) {
5555
const callee = path.get('callee');
5656

5757
// The function being called must be the metadata function name

packages/angular/build/src/tools/babel/plugins/pure-toplevel-functions.ts

Lines changed: 2 additions & 2 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, PluginPass, types } from '@babel/core';
9+
import type { NodePath, PluginObject, PluginPass, types } from '@babel/core';
1010
import annotateAsPure from '@babel/helper-annotate-as-pure';
1111
import * as tslib from 'tslib';
1212

@@ -57,7 +57,7 @@ interface ExtendedPluginPass extends PluginPass {
5757
* A babel plugin factory function for adding the PURE annotation to top-level new and call expressions.
5858
* @returns A babel plugin object instance.
5959
*/
60-
export default function (): PluginObj {
60+
export default function (): PluginObject {
6161
return {
6262
visitor: {
6363
CallExpression(path: NodePath<types.CallExpression>, state: ExtendedPluginPass) {

packages/angular/build/src/tools/babel/plugins/pure-toplevel-functions_spec.ts

Lines changed: 2 additions & 2 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 { transformSync } from '@babel/core';
9+
import { PluginItem, transformSync } from '@babel/core';
1010
import { format } from 'prettier';
1111
import pureTopLevelPlugin from './pure-toplevel-functions';
1212

@@ -24,7 +24,7 @@ function testCase({
2424
configFile: false,
2525
babelrc: false,
2626
compact: true,
27-
plugins: [[pureTopLevelPlugin, options]],
27+
plugins: [[pureTopLevelPlugin, options] as unknown as PluginItem],
2828
});
2929
if (!result?.code) {
3030
fail('Expected babel to return a transform result.');

0 commit comments

Comments
 (0)