Types/OpenPackage/get_PowerShellManifest.ps1

<#
.SYNOPSIS
    Gets a package's PowerShell manifest files
.DESCRIPTION
    Gets a package's PowerShell manifest files.
    
    These are any `*.psd1` files in the package that:
    
    * Are valid PowerShell data blocks
    * Contain a ModuleVersion
#>

[OutputType([PSObject])]
param()

foreach ($part in $this.GetParts()) {
    if ($part.Uri -notmatch '\.psd1$') { continue }
    try {
        $psd1 = $part.Read()
        if (-not $psd1.ModuleVersion) { continue }
        $psd1
    } catch {
        Write-Debug "Could not read $($part.Uri): $_"
    }    
}