@angular/build 18.0.4 → 18.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,6 +1,6 @@
1
1
  {
2
2
  "name": "@angular/build",
3
- "version": "18.0.4",
3
+ "version": "18.0.6",
4
4
  "description": "Official build system for Angular",
5
5
  "keywords": [
6
6
  "Angular CLI",
@@ -23,7 +23,7 @@
23
23
  "builders": "builders.json",
24
24
  "dependencies": {
25
25
  "@ampproject/remapping": "2.3.0",
26
- "@angular-devkit/architect": "0.1800.4",
26
+ "@angular-devkit/architect": "0.1800.6",
27
27
  "@babel/core": "7.24.5",
28
28
  "@babel/helper-annotate-as-pure": "7.22.5",
29
29
  "@babel/helper-split-export-declaration": "7.24.5",
@@ -509,6 +509,7 @@ function getDepOptimizationConfig({ disabled, exclude, include, target, zoneless
509
509
  supported: (0, internal_1.getFeatureSupport)(target, zoneless),
510
510
  plugins,
511
511
  loader,
512
+ resolveExtensions: ['.mjs', '.js', '.cjs'],
512
513
  },
513
514
  };
514
515
  }
package/src/private.d.ts CHANGED
@@ -22,6 +22,7 @@ export { SassWorkerImplementation } from './tools/sass/sass-service';
22
22
  export { SourceFileCache } from './tools/esbuild/angular/source-file-cache';
23
23
  export { createJitResourceTransformer } from './tools/esbuild/angular/jit-resource-transformer';
24
24
  export { JavaScriptTransformer } from './tools/esbuild/javascript-transformer';
25
+ export { createCompilerPlugin } from './tools/esbuild/angular/compiler-plugin';
25
26
  export * from './utils/bundle-calculator';
26
27
  export { checkPort } from './utils/check-port';
27
28
  export { deleteOutputDir } from './utils/delete-output-dir';
package/src/private.js CHANGED
@@ -21,7 +21,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
21
21
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
22
22
  };
23
23
  Object.defineProperty(exports, "__esModule", { value: true });
24
- exports.assertCompatibleAngularVersion = exports.getSupportedBrowsers = exports.generateBuildStatsTable = exports.augmentAppWithServiceWorker = exports.purgeStaleBuildCache = exports.createTranslationLoader = exports.loadProxyConfiguration = exports.InlineCriticalCssProcessor = exports.IndexHtmlGenerator = exports.loadTranslations = exports.createI18nOptions = exports.deleteOutputDir = exports.checkPort = exports.JavaScriptTransformer = exports.createJitResourceTransformer = exports.SourceFileCache = exports.SassWorkerImplementation = exports.transformSupportedBrowsersToTargets = exports.emitFilesToDisk = exports.serveWithVite = exports.buildApplicationInternal = void 0;
24
+ exports.assertCompatibleAngularVersion = exports.getSupportedBrowsers = exports.generateBuildStatsTable = exports.augmentAppWithServiceWorker = exports.purgeStaleBuildCache = exports.createTranslationLoader = exports.loadProxyConfiguration = exports.InlineCriticalCssProcessor = exports.IndexHtmlGenerator = exports.loadTranslations = exports.createI18nOptions = exports.deleteOutputDir = exports.checkPort = exports.createCompilerPlugin = exports.JavaScriptTransformer = exports.createJitResourceTransformer = exports.SourceFileCache = exports.SassWorkerImplementation = exports.transformSupportedBrowsersToTargets = exports.emitFilesToDisk = exports.serveWithVite = exports.buildApplicationInternal = void 0;
25
25
  /**
26
26
  * @fileoverview
27
27
  * Private exports intended only for use with the @angular-devkit/build-angular package.
@@ -47,6 +47,8 @@ var jit_resource_transformer_1 = require("./tools/esbuild/angular/jit-resource-t
47
47
  Object.defineProperty(exports, "createJitResourceTransformer", { enumerable: true, get: function () { return jit_resource_transformer_1.createJitResourceTransformer; } });
48
48
  var javascript_transformer_1 = require("./tools/esbuild/javascript-transformer");
49
49
  Object.defineProperty(exports, "JavaScriptTransformer", { enumerable: true, get: function () { return javascript_transformer_1.JavaScriptTransformer; } });
50
+ var compiler_plugin_1 = require("./tools/esbuild/angular/compiler-plugin");
51
+ Object.defineProperty(exports, "createCompilerPlugin", { enumerable: true, get: function () { return compiler_plugin_1.createCompilerPlugin; } });
50
52
  // Utilities
51
53
  __exportStar(require("./utils/bundle-calculator"), exports);
52
54
  var check_port_1 = require("./utils/check-port");
@@ -57,8 +57,23 @@ function createCompilerPlugin(pluginOptions, styleOptions) {
57
57
  // Webcontainers currently do not support this persistent cache store.
58
58
  let cacheStore;
59
59
  if (pluginOptions.sourceFileCache?.persistentCachePath && !process.versions.webcontainer) {
60
- const { LmbdCacheStore } = await Promise.resolve().then(() => __importStar(require('../lmdb-cache-store')));
61
- cacheStore = new LmbdCacheStore(path.join(pluginOptions.sourceFileCache.persistentCachePath, 'angular-compiler.db'));
60
+ try {
61
+ const { LmbdCacheStore } = await Promise.resolve().then(() => __importStar(require('../lmdb-cache-store')));
62
+ cacheStore = new LmbdCacheStore(path.join(pluginOptions.sourceFileCache.persistentCachePath, 'angular-compiler.db'));
63
+ }
64
+ catch (e) {
65
+ setupWarnings.push({
66
+ text: 'Unable to initialize JavaScript cache storage.',
67
+ location: null,
68
+ notes: [
69
+ // Only show first line of lmdb load error which has platform support listed
70
+ { text: e?.message.split('\n')[0] ?? `${e}` },
71
+ {
72
+ text: 'This will not affect the build output content but may result in slower builds.',
73
+ },
74
+ ],
75
+ });
76
+ }
62
77
  }
63
78
  const javascriptTransformer = new javascript_transformer_1.JavaScriptTransformer({
64
79
  sourcemap: !!pluginOptions.sourcemap,
@@ -249,7 +249,7 @@ function getEsBuildCommonOptions(options) {
249
249
  format: 'esm',
250
250
  assetNames: outputNames.media,
251
251
  conditions: ['es2020', 'es2015', 'module'],
252
- resolveExtensions: ['.ts', '.tsx', '.mjs', '.js'],
252
+ resolveExtensions: ['.ts', '.tsx', '.mjs', '.js', '.cjs'],
253
253
  metafile: true,
254
254
  legalComments: options.extractLicenses ? 'none' : 'eof',
255
255
  logLevel: options.verbose && !jsonLogs ? 'debug' : 'silent',
@@ -73,7 +73,7 @@ function createGlobalScriptsBundleOptions(options, target, initial) {
73
73
  assetNames: outputNames.media,
74
74
  mainFields: ['script', 'browser', 'main'],
75
75
  conditions: ['script'],
76
- resolveExtensions: ['.mjs', '.js'],
76
+ resolveExtensions: ['.mjs', '.js', '.cjs'],
77
77
  logLevel: options.verbose && !jsonLogs ? 'debug' : 'silent',
78
78
  metafile: true,
79
79
  minify: optimizationOptions.scripts,
@@ -8,6 +8,7 @@
8
8
  */
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
10
10
  exports.useJSONBuildLogs = exports.useTypeChecking = exports.shouldWatchRoot = exports.debugPerformance = exports.useParallelTs = exports.maxWorkers = exports.allowMinify = exports.shouldBeautify = exports.allowMangle = void 0;
11
+ const node_os_1 = require("node:os");
11
12
  function isDisabled(variable) {
12
13
  return variable === '0' || variable.toLowerCase() === 'false';
13
14
  }
@@ -66,7 +67,9 @@ exports.allowMinify = debugOptimize.minify;
66
67
  *
67
68
  */
68
69
  const maxWorkersVariable = process.env['NG_BUILD_MAX_WORKERS'];
69
- exports.maxWorkers = isPresent(maxWorkersVariable) ? +maxWorkersVariable : 4;
70
+ exports.maxWorkers = isPresent(maxWorkersVariable)
71
+ ? +maxWorkersVariable
72
+ : Math.min(4, (0, node_os_1.availableParallelism)());
70
73
  const parallelTsVariable = process.env['NG_BUILD_PARALLEL_TS'];
71
74
  exports.useParallelTs = !isPresent(parallelTsVariable) || !isDisabled(parallelTsVariable);
72
75
  const debugPerfVariable = process.env['NG_BUILD_DEBUG_PERF'];
@@ -25,8 +25,7 @@ async function addNonce(html) {
25
25
  }
26
26
  const { rewriter, transformedContent } = await (0, html_rewriting_stream_1.htmlRewritingStream)(html);
27
27
  rewriter.on('startTag', (tag) => {
28
- if ((tag.tagName === 'style' ||
29
- (tag.tagName === 'script' && !tag.attrs.some((attr) => attr.name === 'src'))) &&
28
+ if ((tag.tagName === 'style' || tag.tagName === 'script') &&
30
29
  !tag.attrs.some((attr) => attr.name === 'nonce')) {
31
30
  tag.attrs.push({ name: 'nonce', value: nonce });
32
31
  }
@@ -10,7 +10,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
10
10
  exports.normalizeCacheOptions = void 0;
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 = '18.0.4';
13
+ const VERSION = '18.0.6';
14
14
  function hasCacheMetadata(value) {
15
15
  return (!!value &&
16
16
  typeof value === 'object' &&