@angular-devkit/build-angular 17.3.1 → 17.3.3

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,15 +1,15 @@
1
1
  {
2
2
  "name": "@angular-devkit/build-angular",
3
- "version": "17.3.1",
3
+ "version": "17.3.3",
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.1703.1",
11
- "@angular-devkit/build-webpack": "0.1703.1",
12
- "@angular-devkit/core": "17.3.1",
10
+ "@angular-devkit/architect": "0.1703.3",
11
+ "@angular-devkit/build-webpack": "0.1703.3",
12
+ "@angular-devkit/core": "17.3.3",
13
13
  "@babel/core": "7.24.0",
14
14
  "@babel/generator": "7.23.6",
15
15
  "@babel/helper-annotate-as-pure": "7.22.5",
@@ -20,7 +20,7 @@
20
20
  "@babel/preset-env": "7.24.0",
21
21
  "@babel/runtime": "7.24.0",
22
22
  "@discoveryjs/json-ext": "0.5.7",
23
- "@ngtools/webpack": "17.3.1",
23
+ "@ngtools/webpack": "17.3.3",
24
24
  "@vitejs/plugin-basic-ssl": "1.1.0",
25
25
  "ansi-colors": "4.1.3",
26
26
  "autoprefixer": "10.4.18",
@@ -65,7 +65,7 @@
65
65
  "vite": "5.1.5",
66
66
  "watchpack": "2.4.0",
67
67
  "webpack": "5.90.3",
68
- "webpack-dev-middleware": "6.1.1",
68
+ "webpack-dev-middleware": "6.1.2",
69
69
  "webpack-dev-server": "4.15.1",
70
70
  "webpack-merge": "5.10.0",
71
71
  "webpack-subresource-integrity": "5.1.0"
@@ -75,7 +75,7 @@ async function executePostBundleSteps(options, outputFiles, assetFiles, initialF
75
75
  // If localization is enabled, service worker is handled in the inlining process.
76
76
  if (serviceWorker) {
77
77
  try {
78
- const serviceWorkerResult = await (0, service_worker_1.augmentAppWithServiceWorkerEsbuild)(workspaceRoot, serviceWorker, options.baseHref || '/',
78
+ const serviceWorkerResult = await (0, service_worker_1.augmentAppWithServiceWorkerEsbuild)(workspaceRoot, serviceWorker, options.baseHref || '/', options.indexHtmlOptions?.output,
79
79
  // Ensure additional files recently added are used
80
80
  [...outputFiles, ...additionalOutputFiles], assetFiles);
81
81
  additionalOutputFiles.push((0, utils_1.createOutputFileFromText)('ngsw.json', serviceWorkerResult.manifest, bundler_context_1.BuildOutputFileType.Browser));
@@ -211,7 +211,9 @@ async function normalizeOptions(context, projectName, options, extensions) {
211
211
  fileReplacements,
212
212
  globalStyles,
213
213
  globalScripts,
214
- serviceWorker: typeof serviceWorker === 'string' ? node_path_1.default.join(workspaceRoot, serviceWorker) : undefined,
214
+ serviceWorker: serviceWorker
215
+ ? node_path_1.default.join(workspaceRoot, typeof serviceWorker === 'string' ? serviceWorker : 'src/ngsw-config.json')
216
+ : undefined,
215
217
  indexHtmlOptions,
216
218
  tailwindConfiguration,
217
219
  postcssConfiguration,
@@ -205,15 +205,25 @@ class RelativeUrlRebasingImporter extends UrlRebasingImporter {
205
205
  foundImports = [];
206
206
  cachedEntries = { files: new Set(), directories: new Set() };
207
207
  for (const entry of entries) {
208
- const isDirectory = entry.isDirectory();
208
+ let isDirectory;
209
+ let isFile;
210
+ if (entry.isSymbolicLink()) {
211
+ const stats = (0, node_fs_1.statSync)((0, node_path_1.join)(entry.path, entry.name));
212
+ isDirectory = stats.isDirectory();
213
+ isFile = stats.isFile();
214
+ }
215
+ else {
216
+ isDirectory = entry.isDirectory();
217
+ isFile = entry.isFile();
218
+ }
209
219
  if (isDirectory) {
210
220
  cachedEntries.directories.add(entry.name);
221
+ // Record if the name should be checked as a directory with an index file
222
+ if (checkDirectory && !hasStyleExtension && entry.name === filename) {
223
+ hasPotentialIndex = true;
224
+ }
211
225
  }
212
- // Record if the name should be checked as a directory with an index file
213
- if (checkDirectory && !hasStyleExtension && entry.name === filename && isDirectory) {
214
- hasPotentialIndex = true;
215
- }
216
- if (!entry.isFile()) {
226
+ if (!isFile) {
217
227
  continue;
218
228
  }
219
229
  cachedEntries.files.add(entry.name);
@@ -159,9 +159,11 @@ function createAngularMemoryPlugin(options) {
159
159
  return;
160
160
  }
161
161
  transformIndexHtmlAndAddHeaders(req.url, rawHtml, res, next, async (html) => {
162
+ const resolvedUrls = server.resolvedUrls;
163
+ const baseUrl = resolvedUrls?.local[0] ?? resolvedUrls?.network[0];
162
164
  const { content } = await (0, render_page_1.renderPage)({
163
165
  document: html,
164
- route: new URL(req.originalUrl ?? '/', server.resolvedUrls?.local[0]).toString(),
166
+ route: new URL(req.originalUrl ?? '/', baseUrl).toString(),
165
167
  serverContext: 'ssr',
166
168
  loadBundle: (uri) =>
167
169
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -12,7 +12,7 @@ import { promises as fsPromises } from 'node:fs';
12
12
  import { BuildOutputFile } from '../tools/esbuild/bundler-context';
13
13
  import { BuildOutputAsset } from '../tools/esbuild/bundler-execution-result';
14
14
  export declare function augmentAppWithServiceWorker(appRoot: string, workspaceRoot: string, outputPath: string, baseHref: string, ngswConfigPath?: string, inputputFileSystem?: typeof fsPromises, outputFileSystem?: typeof fsPromises): Promise<void>;
15
- export declare function augmentAppWithServiceWorkerEsbuild(workspaceRoot: string, configPath: string, baseHref: string, outputFiles: BuildOutputFile[], assetFiles: BuildOutputAsset[]): Promise<{
15
+ export declare function augmentAppWithServiceWorkerEsbuild(workspaceRoot: string, configPath: string, baseHref: string, indexHtml: string | undefined, outputFiles: BuildOutputFile[], assetFiles: BuildOutputAsset[]): Promise<{
16
16
  manifest: string;
17
17
  assetFiles: BuildOutputAsset[];
18
18
  }>;
@@ -159,12 +159,15 @@ async function augmentAppWithServiceWorker(appRoot, workspaceRoot, outputPath, b
159
159
  }
160
160
  exports.augmentAppWithServiceWorker = augmentAppWithServiceWorker;
161
161
  // This is currently used by the esbuild-based builder
162
- async function augmentAppWithServiceWorkerEsbuild(workspaceRoot, configPath, baseHref, outputFiles, assetFiles) {
162
+ async function augmentAppWithServiceWorkerEsbuild(workspaceRoot, configPath, baseHref, indexHtml, outputFiles, assetFiles) {
163
163
  // Read the configuration file
164
164
  let config;
165
165
  try {
166
166
  const configurationData = await node_fs_1.promises.readFile(configPath, 'utf-8');
167
167
  config = JSON.parse(configurationData);
168
+ if (indexHtml) {
169
+ config.index = indexHtml;
170
+ }
168
171
  }
169
172
  catch (error) {
170
173
  (0, error_1.assertIsError)(error);