@@ -21,7 +21,6 @@ const outFile = join(distDir, 'legacy-test-bundle.spec.js');
21
21
const ngcBinFile = join ( nodeModulesDir , '@angular/compiler-cli/bundles/src/bin/ngc.js' ) ;
22
22
const legacyOutputDir = join ( distDir , 'legacy-test-out' ) ;
23
23
24
-
25
24
/**
26
25
* This script builds the whole library in `angular/components` together with its
27
26
* spec files into a single IIFE bundle.
@@ -72,10 +71,10 @@ async function compileSassFiles() {
72
71
for ( const file of sassFiles ) {
73
72
const outRelativePath = relative ( projectDir , file ) . replace ( / \. s c s s $ / , '.css' ) ;
74
73
const outPath = join ( projectDir , outRelativePath ) ;
75
- const task = renderSassFileAsync ( file ) . then ( async ( content ) => {
74
+ const task = renderSassFileAsync ( file ) . then ( async content => {
76
75
console . info ( 'Compiled, now writing:' , outRelativePath ) ;
77
76
await fs . promises . mkdir ( dirname ( outPath ) , { recursive : true } ) ;
78
- await fs . promises . writeFile ( outPath , content )
77
+ await fs . promises . writeFile ( outPath , content ) ;
79
78
} ) ;
80
79
81
80
sassTasks . push ( task ) ;
@@ -93,7 +92,10 @@ async function compileSassFiles() {
93
92
async function compileProjectWithNgtsc ( ) {
94
93
// Build the project with Ngtsc so that external resources are inlined.
95
94
const ngcProcess = child_process . spawnSync (
96
- 'node' , [ ngcBinFile , '--project' , legacyTsconfigPath ] , { shell : true , stdio : 'inherit' } ) ;
95
+ 'node' ,
96
+ [ ngcBinFile , '--project' , legacyTsconfigPath ] ,
97
+ { shell : true , stdio : 'inherit' } ,
98
+ ) ;
97
99
98
100
if ( ngcProcess . error || ngcProcess . status !== 0 ) {
99
101
throw Error ( 'Unable to compile tests and library. See error above.' ) ;
@@ -137,9 +139,9 @@ async function createEntryPointSpecFile() {
137
139
/** Helper function to render a Sass file asynchronously using promises. */
138
140
async function renderSassFileAsync ( inputFile ) {
139
141
return new Promise ( ( resolve , reject ) => {
140
- sass . render (
141
- { file : inputFile , includePaths : [ nodeModulesDir ] } ,
142
- ( err , result ) => err ? reject ( err ) : resolve ( result . css ) ) ;
142
+ sass . render ( { file : inputFile , includePaths : [ nodeModulesDir ] } , ( err , result ) =>
143
+ err ? reject ( err ) : resolve ( result . css ) ,
144
+ ) ;
143
145
} ) ;
144
146
}
145
147
@@ -149,10 +151,11 @@ async function renderSassFileAsync(inputFile) {
149
151
*/
150
152
async function createResolveEsbuildPlugin ( ) {
151
153
return {
152
- name : 'ng-resolve-esbuild' , setup : ( build ) => {
153
- build . onResolve ( { filter : / @ a n g u l a r \/ / } , async ( args ) => {
154
+ name : 'ng-resolve-esbuild' ,
155
+ setup : build => {
156
+ build . onResolve ( { filter : / @ a n g u l a r \/ / } , async args => {
154
157
const pkgName = args . path . substr ( '@angular/' . length ) ;
155
- let resolvedPath = join ( legacyOutputDir , pkgName )
158
+ let resolvedPath = join ( legacyOutputDir , pkgName ) ;
156
159
let stats = await statGraceful ( resolvedPath ) ;
157
160
158
161
// If the resolved path points to a directory, resolve the contained `index.js` file
@@ -168,8 +171,8 @@ async function createResolveEsbuildPlugin() {
168
171
169
172
return stats !== null ? { path : resolvedPath } : undefined ;
170
173
} ) ;
171
- }
172
- }
174
+ } ,
175
+ } ;
173
176
}
174
177
175
178
/** Creates an ESBuild plugin that runs the Angular linker on framework packages. */
@@ -183,8 +186,8 @@ async function createLinkerEsbuildPlugin() {
183
186
184
187
return {
185
188
name : 'ng-linker-esbuild' ,
186
- setup : ( build ) => {
187
- build . onLoad ( { filter : / f e s m 2 0 2 0 / } , async ( args ) => {
189
+ setup : build => {
190
+ build . onLoad ( { filter : / f e s m 2 0 2 0 / } , async args => {
188
191
const filePath = args . path ;
189
192
const content = await fs . promises . readFile ( filePath , 'utf8' ) ;
190
193
const { code} = await transformAsync ( content , {
0 commit comments