File tree 2 files changed +47
-4
lines changed
packages/angular_devkit/build_angular/src
2 files changed +47
-4
lines changed Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ import { checkCommonJSModules } from '../../tools/esbuild/commonjs-checker';
15
15
import { extractLicenses } from '../../tools/esbuild/license-extractor' ;
16
16
import { calculateEstimatedTransferSizes , logBuildStats } from '../../tools/esbuild/utils' ;
17
17
import { BudgetCalculatorResult , checkBudgets } from '../../utils/bundle-calculator' ;
18
- import { copyAssets } from '../../utils/copy -assets' ;
18
+ import { resolveAssets } from '../../utils/resolve -assets' ;
19
19
import { getSupportedBrowsers } from '../../utils/supported-browsers' ;
20
20
import { executePostBundleSteps } from './execute-post-bundle' ;
21
21
import { inlineI18n , loadActiveTranslations } from './i18n' ;
@@ -129,9 +129,7 @@ export async function executeBuild(
129
129
130
130
// Copy assets
131
131
if ( assets ) {
132
- // The webpack copy assets helper is used with no base paths defined. This prevents the helper
133
- // from directly writing to disk. This should eventually be replaced with a more optimized helper.
134
- executionResult . addAssets ( await copyAssets ( assets , [ ] , workspaceRoot ) ) ;
132
+ executionResult . addAssets ( await resolveAssets ( assets , workspaceRoot ) ) ;
135
133
}
136
134
137
135
// Extract and write licenses for used packages
Original file line number Diff line number Diff line change
1
+ /**
2
+ * @license
3
+ * Copyright Google LLC All Rights Reserved.
4
+ *
5
+ * Use of this source code is governed by an MIT-style license that can be
6
+ * found in the LICENSE file at https://angular.io/license
7
+ */
8
+
9
+ import glob from 'fast-glob' ;
10
+ import path from 'node:path' ;
11
+
12
+ export async function resolveAssets (
13
+ entries : {
14
+ glob : string ;
15
+ ignore ?: string [ ] ;
16
+ input : string ;
17
+ output : string ;
18
+ flatten ?: boolean ;
19
+ followSymlinks ?: boolean ;
20
+ } [ ] ,
21
+ root : string ,
22
+ ) : Promise < { source : string ; destination : string } [ ] > {
23
+ const defaultIgnore = [ '.gitkeep' , '**/.DS_Store' , '**/Thumbs.db' ] ;
24
+
25
+ const outputFiles : { source : string ; destination : string } [ ] = [ ] ;
26
+
27
+ for ( const entry of entries ) {
28
+ const cwd = path . resolve ( root , entry . input ) ;
29
+ const files = await glob ( entry . glob , {
30
+ cwd,
31
+ dot : true ,
32
+ ignore : entry . ignore ? defaultIgnore . concat ( entry . ignore ) : defaultIgnore ,
33
+ followSymbolicLinks : entry . followSymlinks ,
34
+ } ) ;
35
+
36
+ for ( const file of files ) {
37
+ const src = path . join ( cwd , file ) ;
38
+ const filePath = entry . flatten ? path . basename ( file ) : file ;
39
+
40
+ outputFiles . push ( { source : src , destination : path . join ( entry . output , filePath ) } ) ;
41
+ }
42
+ }
43
+
44
+ return outputFiles ;
45
+ }
You can’t perform that action at this time.
0 commit comments