8000 refactor(@angular-devkit/build-angular): remove duplicate namespaces … · angular/angular-cli@79578fc · GitHub
[go: up one dir, main page]

Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 79578fc

Browse files
clydinalan-agius4
authored andcommitted
refactor(@angular-devkit/build-angular): remove duplicate namespaces in esbuild metafile paths
Within the experimental esbuild-based browser application builder, the internal paths for angular component stylesheets were being displayed in the esbuild metafile with a duplicate namespace prefix. This had no functional difference to the build output but it did make the paths in the metafile unnecessarily long and potentially confusing. The paths now only contain the prefix a single time. This also has the benefit of reducing the length of the filter regular expressions for the stylesheet plugins used for Angular component styles by not needing to match the namespace in the path in addition to the namespace option. (cherry picked from commit 64b6628)
1 parent 17f9136 commit 79578fc

File tree

2 files changed

+11
-14
lines changed

2 files changed

+11
-14
lines changed

packages/angular_devkit/build_angular/src/builders/browser-esbuild/sass-plugin.ts

+7-10
Original file line numberDiff line numberDiff line change
@@ -62,18 +62,15 @@ export function createSassPlugin(options: SassPluginOptions): Plugin {
6262
return result;
6363
};
6464

65-
build.< 8000 /span>onLoad(
66-
{ filter: /^angular:styles\/component;s[ac]ss;/, namespace: 'angular:styles/component' },
67-
async (args) => {
68-
const data = options.inlineComponentData?.[args.path];
69-
assert(data, `component style name should always be found [${args.path}]`);
65+
build.onLoad({ filter: /^s[ac]ss;/, namespace: 'angular:styles/component' }, async (args) => {
66+
const data = options.inlineComponentData?.[args.path];
67+
assert(data, `component style name should always be found [${args.path}]`);
7068

71-
const [, language, , filePath] = args.path.split(';', 4);
72-
const syntax = language === 'sass' ? 'indented' : 'scss';
69+
const [language, , filePath] = args.path.split(';', 3);
70+
const syntax = language === 'sass' ? 'indented' : 'scss';
7371

74-
return compileString(data, filePath, syntax, options, resolveUrl);
75-
},
76-
);
72+
return compileString(data, filePath, syntax, options, resolveUrl);
73+
});
7774

7875
build.onLoad({ filter: /\.s[ac]ss$/ }, async (args) => {
7976
const data = await readFile(args.path, 'utf-8');

packages/angular_devkit/build_angular/src/builders/browser-esbuild/stylesheets.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,10 @@ export async function bundleComponentStylesheet(
8181
options: BundleStylesheetOptions,
8282
) {
8383
const namespace = 'angular:styles/component';
84-
const entry = [namespace, language, identifier, filename].join(';');
84+
const entry = [language, identifier, filename].join(';');
8585

8686
const buildOptions = createStylesheetBundleOptions(options, { [entry]: data });
87-
buildOptions.entryPoints = [entry];
87+
buildOptions.entryPoints = [`${namespace};${entry}`];
8888
buildOptions.plugins.push({
8989
name: 'angular-component-styles',
9090
setup(build) {
@@ -95,7 +95,7 @@ export async function bundleComponentStylesheet(
9595

9696
if (inline) {
9797
return {
98-
path: args.path,
98+
path: entry,
9999
namespace,
100100
};
101101
} else {
@@ -104,7 +104,7 @@ export async function bundleComponentStylesheet(
104104
};
105105
}
106106
});
107-
build.onLoad({ filter: /^< 5AD0 /span>angular:styles\/component;css;/, namespace }, async () => {
107+
build.onLoad({ filter: /^css;/, namespace }, async () => {
108108
return {
109109
contents: data,
110110
loader: 'css',

0 commit comments

Comments
 (0)
0