PowerCraft.Word.psm1
|
# PowerCraft.Word: thin PowerShell shell over the PowerCraft.Word.Core kernel. # The shell owns binding, output shaping and safety affordances; every algorithm lives in the kernel. # lib/ is populated by build.ps1 from the kernel build and shipped inside the module. $script:ModuleRoot = $PSScriptRoot $libDir = Join-Path $PSScriptRoot 'lib' $kernelDll = Join-Path $libDir 'PowerCraft.Word.Core.dll' if (-not (Test-Path -LiteralPath $kernelDll)) { throw "PowerCraft.Word kernel not found at '$kernelDll'. Run build.ps1 at the repository root to populate module/lib/." } foreach ($dll in Get-ChildItem -Path $libDir -Filter '*.dll' | Sort-Object Name) { try { Add-Type -Path $dll.FullName -ErrorAction Stop } catch { # Assemblies the PowerShell runtime already provides (System.IO.Packaging and friends) are fine to skip. if ($_.Exception -is [System.IO.FileLoadException] -or $_.Exception.Message -match 'already (been )?loaded') { Write-Verbose "Skipped $($dll.Name): already provided by the runtime." } else { throw } } } foreach ($function in Get-ChildItem -Path (Join-Path $PSScriptRoot 'Public') -Filter '*.ps1' | Sort-Object Name) { . $function.FullName } Export-ModuleMember -Function 'Convert-PCMarkdownToWord', 'New-PCWordTheme', 'Test-PCWordTheme' |