Skip to content

Commit

Permalink
Look for .framework libraries on macOS/iOS (#2)
Browse files Browse the repository at this point in the history
  • Loading branch information
kasperisager authored Sep 6, 2024
1 parent 4c95264 commit 7110029
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
14 changes: 13 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -242,12 +242,24 @@ exports.linked = function * (name, version = null, opts = {}) {

if (linked === false || host === null) return false

if (host.startsWith('darwin-') || host.startsWith('ios-')) {
if (host.startsWith('darwin-')) {
if (version !== null) {
yield { resolution: new URL(linkedProtocol + 'lib' + name + '.' + version + '.dylib') }
yield { resolution: new URL(linkedProtocol + name + '.' + version + '.framework/' + name + '.' + version) }
}

yield { resolution: new URL(linkedProtocol + 'lib' + name + '.dylib') }
yield { resolution: new URL(linkedProtocol + name + '.framework/' + name) }

return true
}

if (host.startsWith('ios-')) {
if (version !== null) {
yield { resolution: new URL(linkedProtocol + name + '.' + version + '.framework/' + name + '.' + version) }
}

yield { resolution: new URL(linkedProtocol + name + '.framework/' + name) }

return true
}
Expand Down
8 changes: 5 additions & 3 deletions test.js
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,9 @@ test('linked module, darwin', (t) => {

t.alike(result, [
'linked:libe.1.2.3.dylib',
'linked:libe.dylib'
'linked:e.1.2.3.framework/e.1.2.3',
'linked:libe.dylib',
'linked:e.framework/e'
])
})

Expand All @@ -427,8 +429,8 @@ test('linked module, ios', (t) => {
}

t.alike(result, [
'linked:libe.1.2.3.dylib',
'linked:libe.dylib'
'linked:e.1.2.3.framework/e.1.2.3',
'linked:e.framework/e'
])
})

Expand Down

0 comments on commit 7110029

Please sign in to comment.