Skip to content

Commit 1a0b547

Browse files
author
Angular Builds
committedMar 25, 2024
e22d677 fix(@angular-devkit/build-angular): ensure proper resolution of linked SCSS files
1 parent 94d828a commit 1a0b547

File tree

7 files changed

+31
-16
lines changed

7 files changed

+31
-16
lines changed
 

‎package.json

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
{
22
"name": "@angular-devkit/build-angular",
3-
"version": "18.0.0-next.0+sha-31e8ad3",
3+
"version": "18.0.0-next.0+sha-e22d677",
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#31e8ad3",
11-
"@angular-devkit/build-webpack": "github:angular/angular-devkit-build-webpack-builds#31e8ad3",
12-
"@angular-devkit/core": "github:angular/angular-devkit-core-builds#31e8ad3",
10+
"@angular-devkit/architect": "github:angular/angular-devkit-architect-builds#e22d677",
11+
"@angular-devkit/build-webpack": "github:angular/angular-devkit-build-webpack-builds#e22d677",
12+
"@angular-devkit/core": "github:angular/angular-devkit-core-builds#e22d677",
1313
"@babel/core": "7.24.3",
1414
"@babel/generator": "7.24.1",
1515
"@babel/helper-annotate-as-pure": "7.22.5",
@@ -20,7 +20,7 @@
2020
"@babel/preset-env": "7.24.3",
2121
"@babel/runtime": "7.24.1",
2222
"@discoveryjs/json-ext": "0.5.7",
23-
"@ngtools/webpack": "github:angular/ngtools-webpack-builds#31e8ad3",
23+
"@ngtools/webpack": "github:angular/ngtools-webpack-builds#e22d677",
2424
"@vitejs/plugin-basic-ssl": "1.1.0",
2525
"ansi-colors": "4.1.3",
2626
"autoprefixer": "10.4.19",

‎src/builders/application/execute-post-bundle.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ async function executePostBundleSteps(options, outputFiles, assetFiles, initialF
7575
// If localization is enabled, service worker is handled in the inlining process.
7676
if (serviceWorker) {
7777
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,
7979
// Ensure additional files recently added are used
8080
[...outputFiles, ...additionalOutputFiles], assetFiles);
8181
additionalOutputFiles.push((0, utils_1.createOutputFileFromText)('ngsw.json', serviceWorkerResult.manifest, bundler_context_1.BuildOutputFileType.Browser));

‎src/builders/application/options.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,9 @@ async function normalizeOptions(context, projectName, options, extensions) {
211211
fileReplacements,
212212
globalStyles,
213213
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,
215217
indexHtmlOptions,
216218
tailwindConfiguration,
217219
postcssConfiguration,

‎src/tools/sass/rebasing-importer.js

+16-6
Original file line numberDiff line numberDiff line change
@@ -205,15 +205,25 @@ class RelativeUrlRebasingImporter extends UrlRebasingImporter {
205205
foundImports = [];
206206
cachedEntries = { files: new Set(), directories: new Set() };
207207
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+
}
209219
if (isDirectory) {
210220
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+
}
211225
}
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) {
217227
continue;
218228
}
219229
cachedEntries.files.add(entry.name);

‎src/utils/service-worker.d.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import { promises as fsPromises } from 'node:fs';
1212
import { BuildOutputFile } from '../tools/esbuild/bundler-context';
1313
import { BuildOutputAsset } from '../tools/esbuild/bundler-execution-result';
1414
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<{
1616
manifest: string;
1717
assetFiles: BuildOutputAsset[];
1818
}>;

‎src/utils/service-worker.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -159,12 +159,15 @@ async function augmentAppWithServiceWorker(appRoot, workspaceRoot, outputPath, b
159159
}
160160
exports.augmentAppWithServiceWorker = augmentAppWithServiceWorker;
161161
// 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) {
163163
// Read the configuration file
164164
let config;
165165
try {
166166
const configurationData = await node_fs_1.promises.readFile(configPath, 'utf-8');
167167
config = JSON.parse(configurationData);
168+
if (indexHtml) {
169+
config.index = indexHtml;
170+
}
168171
}
169172
catch (error) {
170173
(0, error_1.assertIsError)(error);

‎uniqueId

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Mon Mar 25 2024 10:21:14 GMT+0000 (Coordinated Universal Time)
1+
Mon Mar 25 2024 12:40:37 GMT+0000 (Coordinated Universal Time)

0 commit comments

Comments
 (0)
Please sign in to comment.