@@ -15,30 +15,23 @@ import type { NormalizedLibraryOptions } from '../types';
1515import { type DiskOutputFile , createDiskOutputFile } from './utils' ;
1616
1717/**
18- * Resolves and collects configured library assets to be emitted to disk,
19- * and registers their source paths with the watch set.
18+ * Resolves and collects configured library assets to be emitted to disk.
2019 *
2120 * @param assets The normalized asset patterns.
2221 * @param workspaceRoot The workspace root directory path.
23- * @param allWatchedFiles Set collecting all watched file paths for watch mode.
2422 * @param modifiedFiles Optional set of modified file paths for incremental copying in watch mode.
2523 * @returns An array of disk file emission descriptors.
2624 */
2725export async function collectAssetsToEmit (
2826 assets : NormalizedLibraryOptions [ 'assets' ] ,
2927 workspaceRoot : string ,
30- allWatchedFiles : Set < string > ,
3128 modifiedFiles ?: ReadonlySet < string > ,
3229) : Promise < DiskOutputFile [ ] > {
33- if ( assets . length === 0 ) {
30+ if ( assets . length === 0 || modifiedFiles ?. size === 0 ) {
3431 return [ ] ;
3532 }
3633
3734 if ( modifiedFiles ) {
38- if ( modifiedFiles . size === 0 ) {
39- return [ ] ;
40- }
41-
4235 const matchers = createAssetMatchers ( assets , workspaceRoot ) ;
4336 const filesToEmit : DiskOutputFile [ ] = [ ] ;
4437
@@ -58,7 +51,6 @@ export async function collectAssetsToEmit(
5851
5952 if ( statSync ( resolvedFile , { throwIfNoEntry : false } ) ?. isFile ( ) ) {
6053 filesToEmit . push ( createDiskOutputFile ( resolvedFile , path . join ( asset . output , relative ) ) ) ;
61- allWatchedFiles . add ( posixFile ) ;
6254 }
6355 }
6456 }
@@ -67,50 +59,8 @@ export async function collectAssetsToEmit(
6759 }
6860
6961 const resolvedAssets = await resolveAssets ( assets , workspaceRoot ) ;
70- const filesToEmit : DiskOutputFile [ ] = [ ] ;
71-
72- for ( const { source, destination } of resolvedAssets ) {
73- filesToEmit . push ( createDiskOutputFile ( source , destination ) ) ;
74- allWatchedFiles . add ( toPosixPath ( source ) ) ;
75- }
76-
77- return filesToEmit ;
78- }
79-
80- /**
81- * Checks whether any configured library assets were modified.
82- *
83- * @param assets The normalized asset patterns.
84- * @param workspaceRoot The workspace root directory path.
85- * @param changedFiles Set of changed file paths.
86- * @returns True if any asset file was modified.
87- */
88- export function checkAssetChanges (
89- assets : NormalizedLibraryOptions [ 'assets' ] ,
90- workspaceRoot : string ,
91- changedFiles : ReadonlySet < string > ,
92- ) : boolean {
93- if ( assets . length === 0 || changedFiles . size === 0 ) {
94- return false ;
95- }
96-
97- const matchers = createAssetMatchers ( assets , workspaceRoot ) ;
98-
99- for ( const file of changedFiles ) {
100- const resolvedFile = path . isAbsolute ( file ) ? file : path . resolve ( workspaceRoot , file ) ;
101- const posixFile = toPosixPath ( resolvedFile ) ;
102-
103- for ( const { posixInputPrefix, isMatch } of matchers ) {
104- if ( posixFile . startsWith ( posixInputPrefix ) ) {
105- const relative = posixFile . slice ( posixInputPrefix . length ) ;
106- if ( isMatch ( relative ) ) {
107- return true ;
108- }
109- }
110- }
111- }
11262
113- return false ;
63+ return resolvedAssets . map ( ( { source , destination } ) => createDiskOutputFile ( source , destination ) ) ;
11464}
11565
11666function createAssetMatchers ( assets : NormalizedLibraryOptions [ 'assets' ] , workspaceRoot : string ) {
0 commit comments