Skip to content

Commit bf2e02e

Browse files
authored
build: update babel imports (#33488)
Updates the imports from Babel to account for upcoming breaking changes.
1 parent f4a0915 commit bf2e02e

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

integration/linker/link-packages-test.mjs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {createEs2015LinkerPlugin} from '@angular/compiler-cli/linker/babel';
77
import {NodeJSFileSystem, ConsoleLogger, LogLevel} from '@angular/compiler-cli';
88
import fs from 'fs';
99
import path from 'path';
10-
import babel from '@babel/core';
10+
import {transformSync, traverse} from '@babel/core';
1111
import {sync as globSync} from 'glob';
1212
import chalk from 'chalk';
1313

@@ -78,15 +78,15 @@ function testPackage(pkg) {
7878
// Babel throws errors if the transformation fails. We catch these so that we
7979
// can print incompatible entry points with their errors at the end.
8080
try {
81-
const {ast} = babel.transformSync(fileContent, {
81+
const {ast} = transformSync(fileContent, {
8282
ast: true,
8383
filename: diskFilePath,
8484
filenameRelative: debugFileName,
8585
plugins: [linkerPlugin],
8686
});
8787

8888
// Naively check if there are any Angular declarations left that haven't been linked.
89-
babel.traverse(ast, {
89+
traverse(ast, {
9090
Identifier: astPath => {
9191
if (astPath.node.name.startsWith('ɵɵngDeclare')) {
9292
throw astPath.buildCodeFrameError(

scripts/create-legacy-tests-bundle.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env node
22

3-
import babel from '@babel/core';
3+
import {transformAsync} from '@babel/core';
44
import child_process from 'child_process';
55
import esbuild from 'esbuild';
66
import fs from 'fs';
@@ -173,7 +173,7 @@ function createLinkerEsbuildPlugin() {
173173
build.onLoad({filter: /fesm2022/}, async args => {
174174
const filePath = args.path;
175175
const content = await fs.promises.readFile(filePath, 'utf8');
176-
const {code} = await babel.transformAsync(content, {
176+
const {code} = await transformAsync(content, {
177177
filename: filePath,
178178
compact: false,
179179
plugins: [['@angular/compiler-cli/linker/babel', {linkerJitMode: true}]],

0 commit comments

Comments
 (0)