Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
"@angular/platform-server": "22.1.0-next.1",
"@angular/router": "22.1.0-next.1",
"@angular/service-worker": "22.1.0-next.1",
"@babel/core": "7.29.7",
"@babel/core": "8.0.1",
"@bazel/bazelisk": "1.28.1",
"@bazel/buildifier": "8.2.1",
"@bazel/ibazel": "^0.28.0",
Expand Down
4 changes: 2 additions & 2 deletions packages/angular/build/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
"dependencies": {
"@ampproject/remapping": "2.3.0",
"@angular-devkit/architect": "workspace:0.0.0-EXPERIMENTAL-PLACEHOLDER",
"@babel/core": "7.29.7",
"@babel/helper-annotate-as-pure": "7.29.7",
"@babel/core": "8.0.1",
"@babel/helper-annotate-as-pure": "8.0.0",
"@babel/helper-split-export-declaration": "7.24.7",
"@inquirer/confirm": "6.1.1",
"@vitejs/plugin-basic-ssl": "2.3.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* found in the LICENSE file at https://angular.dev/license
*/

import { NodePath, PluginObj, types } from '@babel/core';
import { NodePath, PluginObject, PluginPass, types } from '@babel/core';
import type { Visitor } from 'istanbul-lib-instrument';
import assert from 'node:assert';

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

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

visitor.enter(path);
},
exit(path) {
exit(path: NodePath<types.Program>) {
const visitor = visitors.get(path);
assert(visitor, 'Instrumentation visitor should always be present for program path.');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* found in the LICENSE file at https://angular.dev/license
*/

import { NodePath, PluginObj, PluginPass, types } from '@babel/core';
import { NodePath, PluginObject, PluginPass, types } from '@babel/core';
import annotateAsPure from '@babel/helper-annotate-as-pure';
import splitExportDeclaration from '@babel/helper-split-export-declaration';

Expand Down Expand Up @@ -206,7 +206,7 @@ const exportDefaultAnalysis = new WeakMap<types.Class, ReturnType<typeof analyze
* @returns A babel plugin object instance.
*/
// eslint-disable-next-line max-lines-per-function
export default function (): PluginObj {
export default function (): PluginObject {
return {
visitor: {
// When a class is converted to a variable declaration, the default export must be moved
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
* found in the LICENSE file at https://angular.dev/license
*/

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

Expand All @@ -26,7 +25,7 @@ function testCase({
const result = transformSync(input, {
configFile: false,
babelrc: false,
plugins: [[adjustStaticClassMembers, options]],
plugins: [[adjustStaticClassMembers, options] as unknown as PluginItem],
});
if (!result?.code) {
fail('Expected babel to return a transform result.');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* found in the LICENSE file at https://angular.dev/license
*/

import { NodePath, PluginObj, types } from '@babel/core';
import { NodePath, PluginObject, types } from '@babel/core';
import annotateAsPure from '@babel/helper-annotate-as-pure';

/**
Expand All @@ -24,7 +24,7 @@ export function getKeywords(): Iterable<string> {
*
* @returns A babel plugin object instance.
*/
export default function (): PluginObj {
export default function (): PluginObject {
return {
visitor: {
VariableDeclaration(path: NodePath<types.VariableDeclaration>) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* found in the LICENSE file at https://angular.dev/license
*/

import { transformSync } from '@babel/core';
import { PluginItem, transformSync } from '@babel/core';
// eslint-disable-next-line import/no-extraneous-dependencies
import { format } from 'prettier';
import adjustTypeScriptEnums from './adjust-typescript-enums';
Expand All @@ -24,7 +24,7 @@ function testCase({
const result = transformSync(input, {
configFile: false,
babelrc: false,
plugins: [[adjustTypeScriptEnums]],
plugins: [adjustTypeScriptEnums],
});
if (!result?.code) {
fail('Expected babel to return a transform result.');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* found in the LICENSE file at https://angular.dev/license
*/

import type { types as BabelTypes, NodePath, PluginObj } from '@babel/core';
import type { types as BabelTypes, NodePath, PluginObject } from '@babel/core';

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

// The function being called must be the metadata function name
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* found in the LICENSE file at https://angular.dev/license
*/

import type { NodePath, PluginObj, PluginPass, types } from '@babel/core';
import type { NodePath, PluginObject, PluginPass, types } from '@babel/core';
import annotateAsPure from '@babel/helper-annotate-as-pure';
import * as tslib from 'tslib';

Expand Down Expand Up @@ -57,7 +57,7 @@ interface ExtendedPluginPass extends PluginPass {
* A babel plugin factory function for adding the PURE annotation to top-level new and call expressions.
* @returns A babel plugin object instance.
*/
export default function (): PluginObj {
export default function (): PluginObject {
return {
visitor: {
CallExpression(path: NodePath<types.CallExpression>, state: ExtendedPluginPass) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* found in the LICENSE file at https://angular.dev/license
*/

import { transformSync } from '@babel/core';
import { PluginItem, transformSync } from '@babel/core';
import { format } from 'prettier';
import pureTopLevelPlugin from './pure-toplevel-functions';

Expand All @@ -24,7 +24,7 @@ function testCase({
configFile: false,
babelrc: false,
compact: true,
plugins: [[pureTopLevelPlugin, options]],
plugins: [[pureTopLevelPlugin, options] as unknown as PluginItem],
});
if (!result?.code) {
fail('Expected babel to return a transform result.');
Expand Down
15 changes: 7 additions & 8 deletions packages/angular/build/src/tools/esbuild/i18n-inliner-worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*/

import remapping, { SourceMapInput } from '@ampproject/remapping';
import { PluginObj, parseSync, transformFromAstAsync, types } from '@babel/core';
import { NodePath, PluginItem, parseSync, transformFromAstAsync, types } from '@babel/core';
import assert from 'node:assert';
import { workerData } from 'node:worker_threads';
import { assertIsError } from '../../utils/error';
Expand Down Expand Up @@ -144,26 +144,25 @@ async function loadLocalizeTools(): Promise<LocalizeUtilityModule> {
async function createI18nPlugins(locale: string, translation: Record<string, unknown> | undefined) {
const { Diagnostics, makeEs2015TranslatePlugin } = await loadLocalizeTools();

const plugins: PluginObj[] = [];
const plugins: PluginItem[] = [];
const diagnostics = new Diagnostics();

plugins.push(
// eslint-disable-next-line @typescript-eslint/no-explicit-any
makeEs2015TranslatePlugin(diagnostics, (translation || {}) as any, {
makeEs2015TranslatePlugin(diagnostics, translation || {}, {
missingTranslation: translation === undefined ? 'ignore' : missingTranslation,
}),
}) as unknown as PluginItem,
);
Comment thread
alan-agius4 marked this conversation as resolved.

// Create a plugin to replace the locale specifier constant inject by the build system with the actual specifier
plugins.push({
plugins.push(() => ({
visitor: {
StringLiteral(path) {
StringLiteral(path: NodePath<types.StringLiteral>) {
if (path.node.value === '___NG_LOCALE_INSERT___') {
path.replaceWith(types.stringLiteral(locale));
}
},
},
});
}));

return { diagnostics, plugins };
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ async function transformWithBabel(

const { default: coveragePluginFactory } =
await import('../babel/plugins/add-code-coverage.js');
plugins.push(coveragePluginFactory(programVisitor));
plugins.push(coveragePluginFactory(programVisitor) as unknown as PluginItem);
Comment thread
alan-agius4 marked this conversation as resolved.
} catch (error) {
throw new Error(
`The 'istanbul-lib-instrument' package is required for code coverage but was not found. Please install the package.`,
Expand All @@ -97,7 +97,7 @@ async function transformWithBabel(
if (shouldLink) {
// Lazy load the linker plugin only when linking is required
const linkerPlugin = await createLinkerPlugin(options);
plugins.push(linkerPlugin);
plugins.push(linkerPlugin as unknown as PluginItem);
}

if (options.advancedOptimizations) {
Expand Down
16 changes: 8 additions & 8 deletions packages/angular_devkit/build_angular/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@
"@angular-devkit/build-webpack": "workspace:0.0.0-EXPERIMENTAL-PLACEHOLDER",
"@angular-devkit/core": "workspace:0.0.0-PLACEHOLDER",
"@angular/build": "workspace:0.0.0-PLACEHOLDER",
"@babel/core": "7.29.7",
"@babel/generator": "7.29.7",
"@babel/helper-annotate-as-pure": "7.29.7",
"@babel/core": "8.0.1",
"@babel/generator": "8.0.0",
"@babel/helper-annotate-as-pure": "8.0.0",
"@babel/helper-split-export-declaration": "7.24.7",
"@babel/plugin-transform-async-generator-functions": "7.29.7",
"@babel/plugin-transform-async-to-generator": "7.29.7",
"@babel/plugin-transform-runtime": "7.29.7",
"@babel/preset-env": "7.29.7",
"@babel/runtime": "7.29.7",
"@babel/plugin-transform-async-generator-functions": "8.0.1",
"@babel/plugin-transform-async-to-generator": "8.0.1",
"@babel/plugin-transform-runtime": "8.0.1",
"@babel/preset-env": "8.0.1",
"@babel/runtime": "8.0.0",
"@discoveryjs/json-ext": "1.1.0",
"@ngtools/webpack": "workspace:0.0.0-PLACEHOLDER",
"ansi-colors": "4.1.3",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* found in the LICENSE file at https://angular.dev/license
*/

import { NodePath, PluginObj, types } from '@babel/core';
import { NodePath, PluginObject, PluginPass, types } from '@babel/core';
import { Visitor, programVisitor } from 'istanbul-lib-instrument';
import assert from 'node:assert';

Expand All @@ -15,13 +15,13 @@ import assert from 'node:assert';
*
* @returns A babel plugin object instance.
*/
export default function (): PluginObj {
export default function (): PluginObject {
const visitors = new WeakMap<NodePath, Visitor>();

return {
visitor: {
Program: {
enter(path, state) {
enter(path: NodePath<types.Program>, state: PluginPass) {
const visitor = programVisitor(types, state.filename, {
// Babel returns a Converter object from the `convert-source-map` package
inputSourceMap: (state.file.inputMap as undefined | { toObject(): object })?.toObject(),
Expand All @@ -30,7 +30,7 @@ export default function (): PluginObj {

visitor.enter(path);
},
exit(path) {
exit(path: NodePath<types.Program>) {
const visitor = visitors.get(path);
assert(visitor, 'Instrumentation visitor should always be present for program path.');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,6 @@ export default function (api: unknown, options: ApplicationPresetOptions) {
presets.push([
require('@babel/preset-env').default,
{
bugfixes: true,
modules: false,
targets: options.supportedBrowsers,
exclude: ['transform-typeof-symbol'],
Expand Down Expand Up @@ -236,7 +235,6 @@ export default function (api: unknown, options: ApplicationPresetOptions) {
plugins.push([
require('@babel/plugin-transform-runtime').default,
{
useESModules: true,
version: require('@babel/runtime/package.json').version,
absoluteRuntime: path.dirname(require.resolve('@babel/runtime/package.json')),
},
Expand Down
Loading
Loading