@@ -5,27 +5,35 @@ import type {
55 TemplateManager ,
66 JavaScriptManager ,
77} from '@garfish/loader' ;
8- import { AppInfo } from './app' ;
8+ import type { AppInfo } from './app' ;
9+ import type { interfaces } from '../interface' ;
910
1011// Fetch `script`, `link` and `module meta` elements
1112function fetchStaticResources (
1213 appName : string ,
1314 loader : Loader ,
1415 entryManager : TemplateManager ,
16+ sandboxConfig : false | interfaces . SandboxConfig | undefined ,
1517) {
1618 const toBoolean = ( val ) => typeof val !== 'undefined' && val !== 'false' ;
1719
1820 // Get all script elements
1921 const jsNodes = Promise . all (
2022 entryManager
2123 . findAllJsNodes ( )
24+ . filter ( ( node ) => {
25+ if ( sandboxConfig && sandboxConfig . excludeAssetFilter ) {
26+ const src = entryManager . findAttributeValue ( node , 'src' ) ;
27+ if ( src && sandboxConfig . excludeAssetFilter ( src ) ) {
28+ return false ;
29+ }
30+ }
31+ return true ;
32+ } )
2233 . map ( ( node ) => {
2334 const src = entryManager . findAttributeValue ( node , 'src' ) ;
2435 const type = entryManager . findAttributeValue ( node , 'type' ) ;
25- let crossOrigin = entryManager . findAttributeValue (
26- node ,
27- 'crossorigin' ,
28- ) ;
36+ let crossOrigin = entryManager . findAttributeValue ( node , 'crossorigin' ) ;
2937 if ( crossOrigin === '' ) {
3038 crossOrigin = 'anonymous' ;
3139 }
@@ -150,6 +158,7 @@ export async function processAppResources(loader: Loader, appInfo: AppInfo) {
150158 appInfo . name ,
151159 loader ,
152160 entryManager ,
161+ appInfo . sandbox ,
153162 ) ;
154163 resources . js = js ;
155164 resources . link = link ;
0 commit comments