<# .SYNOPSIS Builds the XSLT engine (libxslt, libexslt, libxml2) to WebAssembly in Docker and copies it, with its worker and the licence notices, to frontend/vendor/local/xslt@2/, where the site serves it from /vendor/. The libraries are pinned by version and SHA-256 in the Dockerfile; these build files are published at /source/xslt/. Nothing is installed on this machine; Docker Desktop must be running. #> $ErrorActionPreference = 'Continue' Set-Location $PSScriptRoot $dist = Join-Path $PSScriptRoot 'dist' if (Test-Path $dist) { Remove-Item -Recurse -Force $dist } & docker build --target export --output "type=local,dest=$dist" . if ($LASTEXITCODE -ne 0) { throw 'docker build failed' } $dest = Join-Path $PSScriptRoot '..\..\vendor\local\xslt@2' New-Item -ItemType Directory -Force $dest | Out-Null Copy-Item (Join-Path $dist 'xslt.mjs') $dest -Force Copy-Item (Join-Path $dist 'xslt.wasm') $dest -Force Copy-Item (Join-Path $PSScriptRoot 'src\run.mjs') $dest -Force Copy-Item (Join-Path $PSScriptRoot 'src\worker.mjs') $dest -Force Copy-Item (Join-Path $PSScriptRoot 'LICENSE-libxslt.txt') $dest -Force Copy-Item (Join-Path $PSScriptRoot 'LICENSE-libxml2.txt') $dest -Force Get-ChildItem $dest | Select-Object Name, Length | Out-String | Write-Host