@angular-devkit/build-angular 19.0.5 → 19.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,16 +1,16 @@
1
1
  {
2
2
  "name": "@angular-devkit/build-angular",
3
- "version": "19.0.5",
3
+ "version": "19.0.6",
4
4
  "description": "Angular Webpack Build Facade",
5
5
  "main": "src/index.js",
6
6
  "typings": "src/index.d.ts",
7
7
  "builders": "builders.json",
8
8
  "dependencies": {
9
9
  "@ampproject/remapping": "2.3.0",
10
- "@angular-devkit/architect": "0.1900.5",
11
- "@angular-devkit/build-webpack": "0.1900.5",
12
- "@angular-devkit/core": "19.0.5",
13
- "@angular/build": "19.0.5",
10
+ "@angular-devkit/architect": "0.1900.6",
11
+ "@angular-devkit/build-webpack": "0.1900.6",
12
+ "@angular-devkit/core": "19.0.6",
13
+ "@angular/build": "19.0.6",
14
14
  "@babel/core": "7.26.0",
15
15
  "@babel/generator": "7.26.2",
16
16
  "@babel/helper-annotate-as-pure": "7.25.9",
@@ -21,7 +21,7 @@
21
21
  "@babel/preset-env": "7.26.0",
22
22
  "@babel/runtime": "7.26.0",
23
23
  "@discoveryjs/json-ext": "0.6.3",
24
- "@ngtools/webpack": "19.0.5",
24
+ "@ngtools/webpack": "19.0.6",
25
25
  "@vitejs/plugin-basic-ssl": "1.1.0",
26
26
  "ansi-colors": "4.1.3",
27
27
  "autoprefixer": "10.4.20",
@@ -70,7 +70,7 @@
70
70
  "@angular/localize": "^19.0.0",
71
71
  "@angular/platform-server": "^19.0.0",
72
72
  "@angular/service-worker": "^19.0.0",
73
- "@angular/ssr": "^19.0.5",
73
+ "@angular/ssr": "^19.0.6",
74
74
  "@web/test-runner": "^0.19.0",
75
75
  "browser-sync": "^3.0.2",
76
76
  "jest": "^29.5.0",
@@ -126,7 +126,6 @@
126
126
  "devkit",
127
127
  "sdk"
128
128
  ],
129
- "packageManager": "yarn@4.5.0",
130
129
  "repository": {
131
130
  "type": "git",
132
131
  "url": "https://github.com/angular/angular-cli.git"
@@ -149,5 +148,8 @@
149
148
  "puppeteer": {
150
149
  "built": true
151
150
  }
151
+ },
152
+ "pnpm": {
153
+ "onlyBuiltDependencies": []
152
154
  }
153
155
  }
@@ -93,6 +93,57 @@ class AngularAssetsMiddleware {
93
93
  };
94
94
  }
95
95
  }
96
+ class AngularPolyfillsPlugin {
97
+ static $inject = ['config.files'];
98
+ static NAME = 'angular-polyfills';
99
+ static createPlugin(polyfillsFile, jasmineCleanupFiles) {
100
+ return {
101
+ // This has to be a "reporter" because reporters run _after_ frameworks
102
+ // and karma-jasmine-html-reporter injects additional scripts that may
103
+ // depend on Jasmine but aren't modules - which means that they would run
104
+ // _before_ all module code (including jasmine).
105
+ [`reporter:${AngularPolyfillsPlugin.NAME}`]: [
106
+ 'factory',
107
+ Object.assign((files) => {
108
+ // The correct order is zone.js -> jasmine -> zone.js/testing.
109
+ // Jasmine has to see the patched version of the global `setTimeout`
110
+ // function so it doesn't cache the unpatched version. And /testing
111
+ // needs to see the global `jasmine` object so it can patch it.
112
+ const polyfillsIndex = 0;
113
+ files.splice(polyfillsIndex, 0, polyfillsFile);
114
+ // Insert just before test_main.js.
115
+ const zoneTestingIndex = files.findIndex((f) => {
116
+ if (typeof f === 'string') {
117
+ return false;
118
+ }
119
+ return f.pattern.endsWith('/test_main.js');
120
+ });
121
+ if (zoneTestingIndex === -1) {
122
+ throw new Error('Could not find test entrypoint file.');
123
+ }
124
+ files.splice(zoneTestingIndex, 0, jasmineCleanupFiles);
125
+ // We need to ensure that all files are served as modules, otherwise
126
+ // the order in the files list gets really confusing: Karma doesn't
127
+ // set defer on scripts, so all scripts with type=js will run first,
128
+ // even if type=module files appeared earlier in `files`.
129
+ for (const f of files) {
130
+ if (typeof f === 'string') {
131
+ throw new Error(`Unexpected string-based file: "${f}"`);
132
+ }
133
+ if (f.included === false) {
134
+ // Don't worry about files that aren't included on the initial
135
+ // page load. `type` won't affect them.
136
+ continue;
137
+ }
138
+ if ('js' === (f.type ?? 'js')) {
139
+ f.type = 'module';
140
+ }
141
+ }
142
+ }, AngularPolyfillsPlugin),
143
+ ],
144
+ };
145
+ }
146
+ }
96
147
  function injectKarmaReporter(buildOptions, buildIterator, karmaConfig, subscriber) {
97
148
  const reporterName = 'angular-progress-notifier';
98
149
  class ProgressNotifierReporter {
@@ -189,9 +240,21 @@ async function getProjectSourceRoot(context) {
189
240
  }
190
241
  function normalizePolyfills(polyfills) {
191
242
  if (typeof polyfills === 'string') {
192
- return [polyfills];
243
+ polyfills = [polyfills];
193
244
  }
194
- return polyfills ?? [];
245
+ else if (!polyfills) {
246
+ polyfills = [];
247
+ }
248
+ const jasmineGlobalEntryPoint = '@angular-devkit/build-angular/src/builders/karma/jasmine_global.js';
249
+ const jasmineGlobalCleanupEntrypoint = '@angular-devkit/build-angular/src/builders/karma/jasmine_global_cleanup.js';
250
+ const zoneTestingEntryPoint = 'zone.js/testing';
251
+ const polyfillsExludingZoneTesting = polyfills.filter((p) => p !== zoneTestingEntryPoint);
252
+ return [
253
+ polyfillsExludingZoneTesting.concat([jasmineGlobalEntryPoint]),
254
+ polyfillsExludingZoneTesting.length === polyfills.length
255
+ ? [jasmineGlobalCleanupEntrypoint]
256
+ : [jasmineGlobalCleanupEntrypoint, zoneTestingEntryPoint],
257
+ ];
195
258
  }
196
259
  async function collectEntrypoints(options, context, projectSourceRoot) {
197
260
  // Glob for files to test.
@@ -219,6 +282,10 @@ async function initializeApplication(options, context, karmaOptions, transforms
219
282
  const instrumentForCoverage = options.codeCoverage
220
283
  ? createInstrumentationFilter(projectSourceRoot, getInstrumentationExcludedPaths(context.workspaceRoot, options.codeCoverageExclude ?? []))
221
284
  : undefined;
285
+ const [polyfills, jasmineCleanup] = normalizePolyfills(options.polyfills);
286
+ for (let idx = 0; idx < jasmineCleanup.length; ++idx) {
287
+ entryPoints.set(`jasmine-cleanup-${idx}`, jasmineCleanup[idx]);
288
+ }
222
289
  const buildOptions = {
223
290
  assets: options.assets,
224
291
  entryPoints,
@@ -235,7 +302,7 @@ async function initializeApplication(options, context, karmaOptions, transforms
235
302
  },
236
303
  instrumentForCoverage,
237
304
  styles: options.styles,
238
- polyfills: normalizePolyfills(options.polyfills),
305
+ polyfills,
239
306
  webWorkerTsConfig: options.webWorkerTsConfig,
240
307
  watch: options.watch ?? !karmaOptions.singleRun,
241
308
  stylePreprocessorOptions: options.stylePreprocessorOptions,
@@ -250,10 +317,24 @@ async function initializeApplication(options, context, karmaOptions, transforms
250
317
  }
251
318
  // Write test files
252
319
  await writeTestFiles(buildOutput.files, buildOptions.outputPath);
320
+ // We need to add this to the beginning *after* the testing framework has
321
+ // prepended its files.
322
+ const polyfillsFile = {
323
+ pattern: `${outputPath}/polyfills.js`,
324
+ included: true,
325
+ served: true,
326
+ type: 'module',
327
+ watched: false,
328
+ };
329
+ const jasmineCleanupFiles = {
330
+ pattern: `${outputPath}/jasmine-cleanup-*.js`,
331
+ included: true,
332
+ served: true,
333
+ type: 'module',
334
+ watched: false,
335
+ };
253
336
  karmaOptions.files ??= [];
254
337
  karmaOptions.files.push(
255
- // Serve polyfills first.
256
- { pattern: `${outputPath}/polyfills.js`, type: 'module', watched: false },
257
338
  // Serve global setup script.
258
339
  { pattern: `${outputPath}/${mainName}.js`, type: 'module', watched: false },
259
340
  // Serve all source maps.
@@ -295,6 +376,9 @@ async function initializeApplication(options, context, karmaOptions, transforms
295
376
  parsedKarmaConfig.plugins.push(AngularAssetsMiddleware.createPlugin(buildOutput));
296
377
  parsedKarmaConfig.middleware ??= [];
297
378
  parsedKarmaConfig.middleware.push(AngularAssetsMiddleware.NAME);
379
+ parsedKarmaConfig.plugins.push(AngularPolyfillsPlugin.createPlugin(polyfillsFile, jasmineCleanupFiles));
380
+ parsedKarmaConfig.reporters ??= [];
381
+ parsedKarmaConfig.reporters.push(AngularPolyfillsPlugin.NAME);
298
382
  // When using code-coverage, auto-add karma-coverage.
299
383
  // This was done as part of the karma plugin for webpack.
300
384
  if (options.codeCoverage &&
@@ -0,0 +1,18 @@
1
+ /**
2
+ * @license
3
+ * Copyright Google LLC All Rights Reserved.
4
+ *
5
+ * Use of this source code is governed by an MIT-style license that can be
6
+ * found in the LICENSE file at https://angular.dev/license
7
+ */
8
+
9
+ // See: https://github.com/jasmine/jasmine/issues/2015
10
+ (function () {
11
+ 'use strict';
12
+
13
+ // jasmine will ignore `window` unless it returns this specific (but uncommon)
14
+ // value from toString().
15
+ window.toString = function () {
16
+ return '[object GjsGlobal]';
17
+ };
18
+ })();
@@ -0,0 +1,14 @@
1
+ /**
2
+ * @license
3
+ * Copyright Google LLC All Rights Reserved.
4
+ *
5
+ * Use of this source code is governed by an MIT-style license that can be
6
+ * found in the LICENSE file at https://angular.dev/license
7
+ */
8
+
9
+ // See: https://github.com/jasmine/jasmine/issues/2015
10
+ (function () {
11
+ 'use strict';
12
+
13
+ delete window.toString;
14
+ })();
@@ -10,7 +10,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
10
10
  exports.normalizeCacheOptions = normalizeCacheOptions;
11
11
  const node_path_1 = require("node:path");
12
12
  /** Version placeholder is replaced during the build process with actual package version */
13
- const VERSION = '19.0.5';
13
+ const VERSION = '19.0.6';
14
14
  function hasCacheMetadata(value) {
15
15
  return (!!value &&
16
16
  typeof value === 'object' &&
@@ -0,0 +1,6 @@
1
+ {
2
+ "extends": "./tsconfig.json",
3
+ "compilerOptions": {
4
+ "types": ["node"]
5
+ }
6
+ }