Skip to content

Commit a69dc95

Browse files
committed
refactor(@angular-devkit/build-angular): maintain experimental public API for karma builder
Adds an `executeKarmaBuilder` wrapper function in the package entry point that returns an RxJS `Observable`. This maintains backward compatibility for the experimental public API while the internal implementation has been migrated to use `AsyncIterable`.
1 parent 9ee6986 commit a69dc95

File tree

1 file changed

+24
-5
lines changed
  • packages/angular_devkit/build_angular/src

1 file changed

+24
-5
lines changed

packages/angular_devkit/build_angular/src/index.ts

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

9+
import type { BuilderContext, BuilderOutput } from '@angular-devkit/architect';
10+
import { type Observable, from } from 'rxjs';
11+
import {
12+
type KarmaBuilderOptions,
13+
type KarmaConfigOptions,
14+
execute as executeKarmaBuilderInternal,
15+
} from './builders/karma';
16+
import type { ExecutionTransformer } from './transforms';
17+
918
export * from './transforms';
1019

1120
export { CrossOrigin, OutputHashing, Type } from './builders/browser/schema';
@@ -40,11 +49,21 @@ export {
4049
type ExtractI18nBuilderOptions,
4150
} from './builders/extract-i18n';
4251

43-
export {
44-
execute as executeKarmaBuilder,
45-
type KarmaBuilderOptions,
46-
type KarmaConfigOptions,
47-
} from './builders/karma';
52+
/**
53+
* @experimental Direct usage of this function is considered experimental.
54+
*/
55+
export function executeKarmaBuilder(
56+
options: KarmaBuilderOptions,
57+
context: BuilderContext,
58+
transforms?: {
59+
webpackConfiguration?: ExecutionTransformer<import('webpack').Configuration>;
60+
karmaOptions?: (options: KarmaConfigOptions) => KarmaConfigOptions;
61+
},
62+
): Observable<BuilderOutput> {
63+
return from(executeKarmaBuilderInternal(options, context, transforms));
64+
}
65+
66+
export { type KarmaBuilderOptions, type KarmaConfigOptions };
4867

4968
export {
5069
execute as executeProtractorBuilder,

0 commit comments

Comments
 (0)