Types/OpenPackage.Part/ReadPowerShell.ps1

<#
.SYNOPSIS
    Reads Part Content as PowerShell
.DESCRIPTION
    Reads Open Package Part Content as PowerShell
#>

[Reflection.AssemblyMetadata(
    # This should automatically apply to `.ps1` and `.psm1` files
    'FilePattern', 
    '\.psm?1$'
)]
param(
    # An optional input object
    # If provided, content will be read from this object.
    # If not provided, content will be read from this part.
    [Alias('Input')]
    [PSObject]$InputObject = $null,
 
    # Any options used to read the data.
    [Alias('Options')]
    [Collections.IDictionary]$Option = [Ordered]@{}
)

if (-not $this.ReadText) { return }
[ScriptBlock]::Create($this.ReadText($InputObject, $Option))