@nx/angular-rspack-compiler 21.6.1-beta.2 → 21.6.1-beta.4
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/dist/compilation/setup-compilation.d.ts +8 -1
- package/dist/compilation/setup-compilation.d.ts.map +1 -1
- package/dist/compilation/setup-compilation.js +6 -2
- package/dist/compilation/setup-with-angular-compilation.d.ts +7 -1
- package/dist/compilation/setup-with-angular-compilation.d.ts.map +1 -1
- package/dist/compilation/setup-with-angular-compilation.js +18 -2
- package/package.json +1 -1
|
@@ -2,6 +2,13 @@ import { RsbuildConfig } from '@rsbuild/core';
|
|
|
2
2
|
import * as ts from 'typescript';
|
|
3
3
|
import { InlineStyleLanguage, FileReplacement, type Sass } from '../models';
|
|
4
4
|
import { ComponentStylesheetBundler } from '@angular/build/private';
|
|
5
|
+
export interface StylesheetTransformResult {
|
|
6
|
+
contents: string;
|
|
7
|
+
outputFiles?: Array<{
|
|
8
|
+
path: string;
|
|
9
|
+
text: string;
|
|
10
|
+
}>;
|
|
11
|
+
}
|
|
5
12
|
export interface SetupCompilationOptions {
|
|
6
13
|
root: string;
|
|
7
14
|
tsConfig: string;
|
|
@@ -19,5 +26,5 @@ export declare function setupCompilation(config: Pick<RsbuildConfig, 'mode' | 's
|
|
|
19
26
|
compilerOptions: import("@angular/compiler-cli").AngularCompilerOptions;
|
|
20
27
|
componentStylesheetBundler: ComponentStylesheetBundler;
|
|
21
28
|
}>;
|
|
22
|
-
export declare function styleTransform(componentStylesheetBundler: ComponentStylesheetBundler): (styles: string, containingFile: string, stylesheetFile?: string) => Promise<
|
|
29
|
+
export declare function styleTransform(componentStylesheetBundler: ComponentStylesheetBundler): (styles: string, containingFile: string, stylesheetFile?: string) => Promise<StylesheetTransformResult>;
|
|
23
30
|
//# sourceMappingURL=setup-compilation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setup-compilation.d.ts","sourceRoot":"","sources":["../../src/compilation/setup-compilation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AACjC,OAAO,EAAE,mBAAmB,EAAE,eAAe,EAAE,KAAK,IAAI,EAAE,MAAM,WAAW,CAAC;AAE5E,OAAO,EAAE,0BAA0B,EAAE,MAAM,wBAAwB,CAAC;AAIpE,MAAM,WAAW,uBAAuB;IACtC,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,GAAG,EAAE,OAAO,CAAC;IACb,mBAAmB,EAAE,mBAAmB,CAAC;IACzC,gBAAgB,EAAE,KAAK,CAAC,eAAe,CAAC,CAAC;IACzC,sBAAsB,CAAC,EAAE,OAAO,CAAC;IACjC,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,IAAI,CAAC,EAAE,IAAI,CAAC;CACb;AAED,eAAO,MAAM,2BAA2B,EAAE,EAAE,CAAC,eAc5C,CAAC;AAEF,wBAAsB,gBAAgB,CACpC,MAAM,EAAE,IAAI,CAAC,aAAa,EAAE,MAAM,GAAG,QAAQ,CAAC,EAC9C,OAAO,EAAE,uBAAuB;;;;GAiDjC;AAED,wBAAgB,cAAc,CAC5B,0BAA0B,EAAE,0BAA0B,IAGpD,QAAQ,MAAM,EACd,gBAAgB,MAAM,EACtB,iBAAiB,MAAM,
|
|
1
|
+
{"version":3,"file":"setup-compilation.d.ts","sourceRoot":"","sources":["../../src/compilation/setup-compilation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AACjC,OAAO,EAAE,mBAAmB,EAAE,eAAe,EAAE,KAAK,IAAI,EAAE,MAAM,WAAW,CAAC;AAE5E,OAAO,EAAE,0BAA0B,EAAE,MAAM,wBAAwB,CAAC;AAIpE,MAAM,WAAW,yBAAyB;IACxC,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CACrD;AAED,MAAM,WAAW,uBAAuB;IACtC,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,GAAG,EAAE,OAAO,CAAC;IACb,mBAAmB,EAAE,mBAAmB,CAAC;IACzC,gBAAgB,EAAE,KAAK,CAAC,eAAe,CAAC,CAAC;IACzC,sBAAsB,CAAC,EAAE,OAAO,CAAC;IACjC,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,IAAI,CAAC,EAAE,IAAI,CAAC;CACb;AAED,eAAO,MAAM,2BAA2B,EAAE,EAAE,CAAC,eAc5C,CAAC;AAEF,wBAAsB,gBAAgB,CACpC,MAAM,EAAE,IAAI,CAAC,aAAa,EAAE,MAAM,GAAG,QAAQ,CAAC,EAC9C,OAAO,EAAE,uBAAuB;;;;GAiDjC;AAED,wBAAgB,cAAc,CAC5B,0BAA0B,EAAE,0BAA0B,IAGpD,QAAQ,MAAM,EACd,gBAAgB,MAAM,EACtB,iBAAiB,MAAM,KACtB,OAAO,CAAC,yBAAyB,CAAC,CAoCtC"}
|
|
@@ -72,11 +72,15 @@ function styleTransform(componentStylesheetBundler) {
|
|
|
72
72
|
console.error('Failed to compile styles. Continuing execution ignoring failing stylesheet...', error.text);
|
|
73
73
|
}
|
|
74
74
|
}
|
|
75
|
-
|
|
75
|
+
// Return both contents and outputFiles
|
|
76
|
+
return {
|
|
77
|
+
contents: stylesheetResult.contents,
|
|
78
|
+
outputFiles: stylesheetResult.outputFiles,
|
|
79
|
+
};
|
|
76
80
|
}
|
|
77
81
|
catch (e) {
|
|
78
82
|
console.error('Failed to compile styles. Continuing execution ignoring failing stylesheet...', e);
|
|
79
|
-
return '';
|
|
83
|
+
return { contents: '', outputFiles: undefined };
|
|
80
84
|
}
|
|
81
85
|
};
|
|
82
86
|
}
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import type { RsbuildConfig } from '@rsbuild/core';
|
|
2
2
|
import { AngularCompilation, SourceFileCache } from '../models';
|
|
3
3
|
import { SetupCompilationOptions } from './setup-compilation';
|
|
4
|
-
export declare function setupCompilationWithAngularCompilation(config: Pick<RsbuildConfig, 'source'>, options: SetupCompilationOptions, sourceFileCache?: SourceFileCache, angularCompilation?: AngularCompilation, modifiedFiles?: Set<string>): Promise<
|
|
4
|
+
export declare function setupCompilationWithAngularCompilation(config: Pick<RsbuildConfig, 'source'>, options: SetupCompilationOptions, sourceFileCache?: SourceFileCache, angularCompilation?: AngularCompilation, modifiedFiles?: Set<string>): Promise<{
|
|
5
|
+
angularCompilation: AngularCompilation;
|
|
6
|
+
collectedStylesheetAssets: {
|
|
7
|
+
path: string;
|
|
8
|
+
text: string;
|
|
9
|
+
}[];
|
|
10
|
+
}>;
|
|
5
11
|
//# sourceMappingURL=setup-with-angular-compilation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setup-with-angular-compilation.d.ts","sourceRoot":"","sources":["../../src/compilation/setup-with-angular-compilation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAEL,kBAAkB,EAClB,eAAe,EAChB,MAAM,WAAW,CAAC;AACnB,OAAO,EAGL,uBAAuB,
|
|
1
|
+
{"version":3,"file":"setup-with-angular-compilation.d.ts","sourceRoot":"","sources":["../../src/compilation/setup-with-angular-compilation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAEL,kBAAkB,EAClB,eAAe,EAChB,MAAM,WAAW,CAAC;AACnB,OAAO,EAGL,uBAAuB,EAExB,MAAM,qBAAqB,CAAC;AAE7B,wBAAsB,sCAAsC,CAC1D,MAAM,EAAE,IAAI,CAAC,aAAa,EAAE,QAAQ,CAAC,EACrC,OAAO,EAAE,uBAAuB,EAChC,eAAe,CAAC,EAAE,eAAe,EACjC,kBAAkB,CAAC,EAAE,kBAAkB,EACvC,aAAa,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC;;;cAkBoB,MAAM;cAAQ,MAAM;;GA4CpE"}
|
|
@@ -11,12 +11,25 @@ async function setupCompilationWithAngularCompilation(config, options, sourceFil
|
|
|
11
11
|
r[f.replace] = f.with;
|
|
12
12
|
return r;
|
|
13
13
|
}, {});
|
|
14
|
+
// Store collected stylesheet output files
|
|
15
|
+
const collectedStylesheetAssets = [];
|
|
16
|
+
// Create a wrapper around styleTransform to collect outputFiles
|
|
17
|
+
const transformFn = (0, setup_compilation_1.styleTransform)(componentStylesheetBundler);
|
|
18
|
+
const wrappedTransformStylesheet = async (styles, containingFile, stylesheetFile) => {
|
|
19
|
+
const result = await transformFn(styles, containingFile, stylesheetFile);
|
|
20
|
+
// Collect outputFiles if present
|
|
21
|
+
if (result.outputFiles && result.outputFiles.length > 0) {
|
|
22
|
+
collectedStylesheetAssets.push(...result.outputFiles);
|
|
23
|
+
}
|
|
24
|
+
// Return just the contents string as expected by Angular compilation
|
|
25
|
+
return result.contents;
|
|
26
|
+
};
|
|
14
27
|
try {
|
|
15
28
|
const { referencedFiles } = await angularCompilation.initialize(config.source?.tsconfigPath ?? options.tsConfig, {
|
|
16
29
|
sourceFileCache,
|
|
17
30
|
fileReplacements,
|
|
18
31
|
modifiedFiles,
|
|
19
|
-
transformStylesheet:
|
|
32
|
+
transformStylesheet: wrappedTransformStylesheet,
|
|
20
33
|
processWebWorker(workerFile) {
|
|
21
34
|
return workerFile;
|
|
22
35
|
},
|
|
@@ -28,5 +41,8 @@ async function setupCompilationWithAngularCompilation(config, options, sourceFil
|
|
|
28
41
|
catch (e) {
|
|
29
42
|
console.error('Failed to initialize Angular Compilation', e);
|
|
30
43
|
}
|
|
31
|
-
return
|
|
44
|
+
return {
|
|
45
|
+
angularCompilation,
|
|
46
|
+
collectedStylesheetAssets,
|
|
47
|
+
};
|
|
32
48
|
}
|