bare-addon-resolve
Advanced tools
Comparing version 1.9.0 to 1.9.1
109
index.js
@@ -381,3 +381,2 @@ const resolve = require('bare-module-resolve') | ||
linked = true, | ||
linkedProtocol = 'linked:', | ||
host = null, // Shorthand for single host resolution | ||
@@ -399,30 +398,20 @@ hosts = host !== null ? [host] : [], | ||
if (platform === 'darwin' || platform === 'ios') { | ||
if (version !== null) { | ||
if ( | ||
yield { | ||
resolution: new URL( | ||
`${linkedProtocol}${name}.${version}.framework/${name}.${version}` | ||
) | ||
} | ||
) { | ||
return RESOLVED | ||
} | ||
status |= yield* platformArtefact(name, version, platform, opts) | ||
if (platform === 'darwin') { | ||
if ( | ||
yield { | ||
resolution: new URL( | ||
`${linkedProtocol}lib${name}.${version}.dylib` | ||
) | ||
} | ||
) { | ||
return RESOLVED | ||
} | ||
} | ||
} | ||
matchedConditions.pop() | ||
} | ||
return status | ||
} | ||
function* platformArtefact(name, version = null, platform, opts = {}) { | ||
const { linkedProtocol = 'linked:' } = opts | ||
if (platform === 'darwin' || platform === 'ios') { | ||
if (version !== null) { | ||
if ( | ||
yield { | ||
resolution: new URL(`${linkedProtocol}${name}.framework/${name}`) | ||
resolution: new URL( | ||
`${linkedProtocol}${name}.${version}.framework/${name}.${version}` | ||
) | ||
} | ||
@@ -436,3 +425,3 @@ ) { | ||
yield { | ||
resolution: new URL(`${linkedProtocol}lib${name}.dylib`) | ||
resolution: new URL(`${linkedProtocol}lib${name}.${version}.dylib`) | ||
} | ||
@@ -443,18 +432,16 @@ ) { | ||
} | ||
} | ||
status = YIELDED | ||
} else if (platform === 'linux' || platform === 'android') { | ||
if (version !== null) { | ||
if ( | ||
yield { | ||
resolution: new URL(`${linkedProtocol}lib${name}.${version}.so`) | ||
} | ||
) { | ||
return RESOLVED | ||
} | ||
if ( | ||
yield { | ||
resolution: new URL(`${linkedProtocol}${name}.framework/${name}`) | ||
} | ||
) { | ||
return RESOLVED | ||
} | ||
if (platform === 'darwin') { | ||
if ( | ||
yield { | ||
resolution: new URL(`${linkedProtocol}lib${name}.so`) | ||
resolution: new URL(`${linkedProtocol}lib${name}.dylib`) | ||
} | ||
@@ -464,18 +451,34 @@ ) { | ||
} | ||
} | ||
status = YIELDED | ||
} else if (platform === 'win32') { | ||
if (version !== null) { | ||
if ( | ||
yield { | ||
resolution: new URL(`${linkedProtocol}${name}-${version}.dll`) | ||
} | ||
) { | ||
return RESOLVED | ||
return YIELDED | ||
} | ||
if (platform === 'linux' || platform === 'android') { | ||
if (version !== null) { | ||
if ( | ||
yield { | ||
resolution: new URL(`${linkedProtocol}lib${name}.${version}.so`) | ||
} | ||
) { | ||
return RESOLVED | ||
} | ||
} | ||
if ( | ||
yield { | ||
resolution: new URL(`${linkedProtocol}lib${name}.so`) | ||
} | ||
) { | ||
return RESOLVED | ||
} | ||
return YIELDED | ||
} | ||
if (platform === 'win32') { | ||
if (version !== null) { | ||
if ( | ||
yield { | ||
resolution: new URL(`${linkedProtocol}${name}.dll`) | ||
resolution: new URL(`${linkedProtocol}${name}-${version}.dll`) | ||
} | ||
@@ -485,10 +488,14 @@ ) { | ||
} | ||
} | ||
status = YIELDED | ||
if ( | ||
yield { | ||
resolution: new URL(`${linkedProtocol}${name}.dll`) | ||
} | ||
) { | ||
return RESOLVED | ||
} | ||
matchedConditions.pop() | ||
} | ||
return status | ||
return UNRESOLVED | ||
} | ||
@@ -495,0 +502,0 @@ |
{ | ||
"name": "bare-addon-resolve", | ||
"version": "1.9.0", | ||
"version": "1.9.1", | ||
"description": "Low-level addon resolution algorithm for Bare", | ||
@@ -5,0 +5,0 @@ "exports": { |
412
28559