(
packageName: string,
options: NativeAssetOptions = {},
)
| 241 | } |
| 242 | |
| 243 | export function getNativePackageRoot( |
| 244 | packageName: string, |
| 245 | options: NativeAssetOptions = {}, |
| 246 | ): string | null { |
| 247 | const source = options.source ?? getSeaAssetSource(); |
| 248 | if (source === null) return null; |
| 249 | |
| 250 | const manifest = |
| 251 | options.manifest ?? getEmbeddedNativeAssetManifest(source, currentTarget()); |
| 252 | if (manifest === null) return null; |
| 253 | |
| 254 | const pkg = manifest.packages.find((entry) => entry.name === packageName); |
| 255 | if (pkg === undefined) return null; |
| 256 | |
| 257 | const cacheRoot = ensureNativeAssetTree({ ...options, source, manifest }); |
| 258 | return cacheRoot === null ? null : join(cacheRoot, pkg.root); |
| 259 | } |
| 260 | |
| 261 | export function hasNativePackage(packageName: string, manifest: NativeAssetManifest): boolean { |
| 262 | return manifest.packages.some((pkg) => pkg.name === packageName); |
no test coverage detected