#!/usr/bin/env bash # Pack the package, install the tarball into an empty project, and check the # published entry points (ESM import, CJS require, CSS) load. Guards the # exports map and bundle globals, which Jest (source-only) cannot see. set -euo pipefail ROOT="$(cd "$(dirname "$0")/.." && pwd)" TMP="$(mktemp -d)" trap 'rm -rf "$TMP"' EXIT cd "$ROOT" && npm run build:prod >/dev/null TARBALL="$(npm pack --pack-destination "$TMP" 2>/dev/null | tail -1)" cd "$TMP" && npm init -y >/dev/null PKG="$(node -p "require('$ROOT/package.json').name")" npm i --no-audit --no-fund marked@13 jsdom "./$TARBALL" >/dev/null 2>&1 SETUP="const {JSDOM}=require('jsdom');const d=new JSDOM('',{url:'http://localhost/'}); globalThis.window=globalThis;globalThis.document=d.window.document;globalThis.location=d.window.location; globalThis.localStorage=d.window.localStorage;globalThis.navigator=d.window.navigator;" # The library is browser-only; unhandled indexedDB rejections after load are expected, so check markers, not exit codes. check() { # check