Skip to content

Commit ddfb3d0

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 ddfb3d0

File tree

3 files changed

+32
-14
lines changed

3 files changed

+32
-14
lines changed

goldens/public-api/angular_devkit/build_angular/index.api.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ export type BrowserBuilderOptions = {
4949
i18nDuplicateTranslation?: I18NTranslation;
5050
i18nMissingTranslation?: I18NTranslation;
5151
index: IndexUnion;
52-
inlineStyleLanguage?: InlineStyleLanguage;
52+
inlineStyleLanguage?: InlineStyleLanguage_2;
5353
localize?: Localize;
5454
main: string;
5555
namedChunks?: boolean;
@@ -58,16 +58,16 @@ export type BrowserBuilderOptions = {
5858
outputHashing?: OutputHashing;
5959
outputPath: string;
6060
poll?: number;
61-
polyfills?: Polyfills;
61+
polyfills?: Polyfills_2;
6262
preserveSymlinks?: boolean;
6363
progress?: boolean;
6464
resourcesOutputPath?: string;
65-
scripts?: ScriptElement[];
65+
scripts?: ScriptElement_2[];
6666
serviceWorker?: boolean;
6767
sourceMap?: SourceMapUnion;
6868
statsJson?: boolean;
6969
stylePreprocessorOptions?: StylePreprocessorOptions;
70-
styles?: StyleElement[];
70+
styles?: StyleElement_2[];
7171
subresourceIntegrity?: boolean;
7272
tsConfig: string;
7373
vendorChunk?: boolean;
@@ -216,18 +216,18 @@ export type KarmaBuilderOptions = {
216216
exclude?: string[];
217217
fileReplacements?: FileReplacement_2[];
218218
include?: string[];
219-
inlineStyleLanguage?: InlineStyleLanguage_2;
219+
inlineStyleLanguage?: InlineStyleLanguage;
220220
karmaConfig?: string;
221221
main?: string;
222222
poll?: number;
223-
polyfills?: Polyfills_2;
223+
polyfills?: Polyfills;
224224
preserveSymlinks?: boolean;
225225
progress?: boolean;
226226
reporters?: string[];
227-
scripts?: ScriptElement_2[];
227+
scripts?: ScriptElement[];
228228
sourceMap?: SourceMapUnion_2;
229229
stylePreprocessorOptions?: StylePreprocessorOptions_2;
230-
styles?: StyleElement_2[];
230+
styles?: StyleElement[];
231231
tsConfig: string;
232232
watch?: boolean;
233233
webWorkerTsConfig?: string;

packages/angular_devkit/build_angular/src/builders/karma/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,6 @@ function getBuiltInKarmaConfig(
171171
export type { KarmaBuilderOptions };
172172
export default createBuilder<KarmaBuilderOptions>(execute);
173173

174-
175174
async function checkForEsbuild(
176175
options: KarmaBuilderOptions,
177176
context: BuilderContext,

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)