Skip to content

Commit 926327e

Browse files
author
Angular Builds
committed
c0c1670 fix(@angular-devkit/build-angular): pass missing options to Karma esbuild builder
1 parent 3eeaad8 commit 926327e

File tree

4 files changed

+32
-15
lines changed

4 files changed

+32
-15
lines changed

package.json

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
{
22
"name": "@angular-devkit/build-angular",
3-
"version": "19.2.0-next.2+sha-486d477",
3+
"version": "19.2.0-next.2+sha-c0c1670",
44
"description": "Angular Webpack Build Facade",
55
"main": "src/index.js",
66
"typings": "src/index.d.ts",
77
"builders": "builders.json",
88
"dependencies": {
99
"@ampproject/remapping": "2.3.0",
10-
"@angular-devkit/architect": "github:angular/angular-devkit-architect-builds#486d477",
11-
"@angular-devkit/build-webpack": "github:angular/angular-devkit-build-webpack-builds#486d477",
12-
"@angular-devkit/core": "github:angular/angular-devkit-core-builds#486d477",
13-
"@angular/build": "github:angular/angular-build-builds#486d477",
10+
"@angular-devkit/architect": "github:angular/angular-devkit-architect-builds#c0c1670",
11+
"@angular-devkit/build-webpack": "github:angular/angular-devkit-build-webpack-builds#c0c1670",
12+
"@angular-devkit/core": "github:angular/angular-devkit-core-builds#c0c1670",
13+
"@angular/build": "github:angular/angular-build-builds#c0c1670",
1414
"@babel/core": "7.26.9",
1515
"@babel/generator": "7.26.9",
1616
"@babel/helper-annotate-as-pure": "7.25.9",
@@ -21,7 +21,7 @@
2121
"@babel/preset-env": "7.26.9",
2222
"@babel/runtime": "7.26.9",
2323
"@discoveryjs/json-ext": "0.6.3",
24-
"@ngtools/webpack": "github:angular/ngtools-webpack-builds#486d477",
24+
"@ngtools/webpack": "github:angular/ngtools-webpack-builds#c0c1670",
2525
"@vitejs/plugin-basic-ssl": "1.2.0",
2626
"ansi-colors": "4.1.3",
2727
"autoprefixer": "10.4.20",
@@ -70,7 +70,7 @@
7070
"@angular/localize": "^19.0.0 || ^19.2.0-next.0",
7171
"@angular/platform-server": "^19.0.0 || ^19.2.0-next.0",
7272
"@angular/service-worker": "^19.0.0 || ^19.2.0-next.0",
73-
"@angular/ssr": "github:angular/angular-ssr-builds#486d477",
73+
"@angular/ssr": "github:angular/angular-ssr-builds#c0c1670",
7474
"@web/test-runner": "^0.20.0",
7575
"browser-sync": "^3.0.2",
7676
"jest": "^29.5.0",
@@ -91,7 +91,7 @@
9191
"@angular/service-worker": {
9292
"optional": true
9393
},
94-
"@angular/ssr": "github:angular/angular-ssr-builds#486d477",
94+
"@angular/ssr": "github:angular/angular-ssr-builds#c0c1670",
9595
"@web/test-runner": {
9696
"optional": true
9797
},

src/builders/karma/application_builder.js

+22-5
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ const fast_glob_1 = __importDefault(require("fast-glob"));
5252
const fs = __importStar(require("fs/promises"));
5353
const path = __importStar(require("path"));
5454
const rxjs_1 = require("rxjs");
55+
const utils_1 = require("../../utils");
5556
const schema_1 = require("../browser-esbuild/schema");
5657
const find_tests_1 = require("./find-tests");
5758
class ApplicationBuildError extends Error {
@@ -305,17 +306,24 @@ async function initializeApplication(options, context, karmaOptions, transforms
305306
index: false,
306307
outputHashing: schema_1.OutputHashing.None,
307308
optimization: false,
308-
sourceMap: {
309-
scripts: true,
310-
styles: true,
311-
vendor: true,
312-
},
309+
sourceMap: options.codeCoverage
310+
? {
311+
scripts: true,
312+
styles: true,
313+
vendor: true,
314+
}
315+
: options.sourceMap,
313316
instrumentForCoverage,
314317
styles: options.styles,
318+
scripts: options.scripts,
315319
polyfills,
316320
webWorkerTsConfig: options.webWorkerTsConfig,
317321
watch: options.watch ?? !karmaOptions.singleRun,
318322
stylePreprocessorOptions: options.stylePreprocessorOptions,
323+
inlineStyleLanguage: options.inlineStyleLanguage,
324+
fileReplacements: options.fileReplacements
325+
? (0, utils_1.normalizeFileReplacements)(options.fileReplacements, './')
326+
: undefined,
319327
};
320328
// Build tests with `application` builder, using test files as entry points.
321329
const [buildOutput, buildIterator] = await first((0, private_1.buildApplicationInternal)(buildOptions, context), { cancel: !buildOptions.watch });
@@ -344,6 +352,15 @@ async function initializeApplication(options, context, karmaOptions, transforms
344352
watched: false,
345353
};
346354
karmaOptions.files ??= [];
355+
if (options.scripts?.length) {
356+
// This should be more granular to support named bundles.
357+
// However, it replicates the behavior of the Karma Webpack-based builder.
358+
karmaOptions.files.push({
359+
pattern: `${outputPath}/scripts.js`,
360+
watched: false,
361+
type: 'js',
362+
});
363+
}
347364
karmaOptions.files.push(
348365
// Serve global setup script.
349366
{ pattern: `${outputPath}/${mainName}.js`, type: 'module', watched: false },

src/utils/normalize-cache.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
1010
exports.normalizeCacheOptions = normalizeCacheOptions;
1111
const node_path_1 = require("node:path");
1212
/** Version placeholder is replaced during the build process with actual package version */
13-
const VERSION = '19.2.0-next.2+sha-486d477';
13+
const VERSION = '19.2.0-next.2+sha-c0c1670';
1414
function hasCacheMetadata(value) {
1515
return (!!value &&
1616
typeof value === 'object' &&

uniqueId

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Fri Feb 14 2025 14:25:40 GMT+0000 (Coordinated Universal Time)
1+
Fri Feb 14 2025 15:42:25 GMT+0000 (Coordinated Universal Time)

0 commit comments

Comments
 (0)