@@ -61,6 +61,8 @@ const MAX_INSTALLED_ROOT_PACKAGE_JSON_BYTES = 1024 * 1024;
6161const MAX_INSTALLED_ROOT_DIST_JS_BYTES = 6 * 1024 * 1024 ;
6262const MAX_INSTALLED_ROOT_DIST_JS_FILES = 5000 ;
6363const ROOT_DIST_JAVASCRIPT_MODULE_FILE_RE = / \. (?: c | m ) ? j s $ / u;
64+ const INSTALLED_FACADE_ACTIVATION_RUNTIME_RELATIVE_PATH_RE =
65+ / ^ f a c a d e - a c t i v a t i o n - c h e c k \. r u n t i m e \. (?: c | m ) ? j s $ / u;
6466const OPTIONAL_OR_EXTERNALIZED_RUNTIME_IMPORTS = new Set ( [
6567 // Optional A2UI markdown renderer. The Canvas host bundle catches the missing
6668 // package and falls back when the optional renderer is unavailable.
@@ -350,6 +352,15 @@ function listInstalledRootDistJavaScriptFiles(packageRoot: string): string[] {
350352 } ) ;
351353}
352354
355+ function listInstalledFacadeActivationRuntimeFiles ( packageRoot : string ) : string [ ] {
356+ const distRoot = join ( packageRoot , "dist" ) ;
357+ return listInstalledRootDistJavaScriptFiles ( packageRoot ) . filter ( ( filePath ) =>
358+ INSTALLED_FACADE_ACTIVATION_RUNTIME_RELATIVE_PATH_RE . test (
359+ relative ( distRoot , filePath ) . replaceAll ( "\\" , "/" ) ,
360+ ) ,
361+ ) ;
362+ }
363+
353364type ParsedImportSpecifiersResult =
354365 | { ok : true ; specifiers : Set < string > }
355366 | { ok : false ; error : string } ;
@@ -525,7 +536,7 @@ function isSafeBundledRuntimeFacadeDirName(value: string): boolean {
525536
526537export function collectInstalledAlwaysAllowedRuntimeFacadeErrors ( packageRoot : string ) : string [ ] {
527538 const errors : string [ ] = [ ] ;
528- for ( const filePath of listInstalledRootDistJavaScriptFiles ( packageRoot ) ) {
539+ for ( const filePath of listInstalledFacadeActivationRuntimeFiles ( packageRoot ) ) {
529540 const fileStat = lstatSync ( filePath ) ;
530541 const relativePath = relative ( packageRoot , filePath ) . replaceAll ( "\\" , "/" ) ;
531542 if ( ! fileStat . isFile ( ) || fileStat . size > MAX_INSTALLED_ROOT_DIST_JS_BYTES ) {
0 commit comments