@@ -192,15 +192,11 @@ export async function linkFlatFramework({
192192 }
193193}
194194
195- export async function linkVersionedFramework ( {
196- frameworkPath,
197- newLibraryName,
198- } : LinkFrameworkOptions ) {
199- assert . equal (
200- process . platform ,
201- "darwin" ,
202- "Linking Apple addons are only supported on macOS" ,
203- ) ;
195+ /**
196+ * NPM packages aren't preserving internal symlinks inside versioned frameworks.
197+ * This function attempts to restore those.
198+ */
199+ export async function restoreFrameworkLinks ( frameworkPath : string ) {
204200 // Reconstruct missing symbolic links if needed
205201 const versionAPath = path . join ( frameworkPath , "Versions" , "A" ) ;
206202 const versionCurrentPath = path . join ( frameworkPath , "Versions" , "Current" ) ;
@@ -210,31 +206,47 @@ export async function linkVersionedFramework({
210206 versionCurrentPath ,
211207 ) ;
212208 }
213- const frameworkInfoPath = path . join (
214- frameworkPath ,
215- "Versions" ,
216- "Current" ,
217- "Resources" ,
218- "Info.plist" ,
209+
210+ const { CFBundleExecutable } = await readFrameworkInfo (
211+ path . join ( frameworkPath , "Versions" , "Current" , "Resources" , "Info.plist" ) ,
219212 ) ;
220- const frameworkInfo = await readFrameworkInfo ( frameworkInfoPath ) ;
213+
221214 const libraryRealPath = path . join (
222215 frameworkPath ,
223216 "Versions" ,
224217 "Current" ,
225- frameworkInfo . CFBundleExecutable ,
226- ) ;
227- const libraryLinkPath = path . join (
228- frameworkPath ,
229- frameworkInfo . CFBundleExecutable ,
218+ CFBundleExecutable ,
230219 ) ;
220+ const libraryLinkPath = path . join ( frameworkPath , CFBundleExecutable ) ;
231221 // Reconstruct missing symbolic links if needed
232222 if ( fs . existsSync ( libraryRealPath ) && ! fs . existsSync ( libraryLinkPath ) ) {
233223 await fs . promises . symlink (
234224 path . relative ( path . dirname ( libraryLinkPath ) , libraryRealPath ) ,
235225 libraryLinkPath ,
236226 ) ;
237227 }
228+ }
229+
230+ export async function linkVersionedFramework ( {
231+ frameworkPath,
232+ newLibraryName,
233+ } : LinkFrameworkOptions ) {
234+ assert . equal (
235+ process . platform ,
236+ "darwin" ,
237+ "Linking Apple addons are only supported on macOS" ,
238+ ) ;
239+
240+ await restoreFrameworkLinks ( frameworkPath ) ;
241+
242+ const frameworkInfoPath = path . join (
243+ frameworkPath ,
244+ "Versions" ,
245+ "Current" ,
246+ "Resources" ,
247+ "Info.plist" ,
248+ ) ;
249+ const frameworkInfo = await readFrameworkInfo ( frameworkInfoPath ) ;
238250 // Update install name
239251 await spawn (
240252 "install_name_tool" ,
0 commit comments