Precise DOM morphing
morphing typescript dom

Simple build

+26
+16
build.ts
··· 1 + import { build } from "bun" 2 + import { $ } from "bun" 3 + 4 + // Build and minify with Bun 5 + await build({ 6 + entrypoints: ["./src/morphlex.ts"], 7 + outdir: "./dist", 8 + minify: true, 9 + sourcemap: "external", 10 + naming: "[dir]/[name].min.[ext]", 11 + }) 12 + 13 + // Generate TypeScript declarations (skip lib check to avoid node type errors) 14 + await $`tsc --emitDeclarationOnly --declaration --outDir dist --skipLibCheck` 15 + 16 + console.log("Build complete")
bun.lockb

This is a binary file and will not be displayed.

+2
package.json
··· 16 16 "url": "https://github.com/sponsors/joeldrapper" 17 17 }, 18 18 "scripts": { 19 + "build": "bun run build.ts", 19 20 "test": "vitest run", 20 21 "test:watch": "vitest", 21 22 "test:ui": "vitest --ui" 22 23 }, 23 24 "devDependencies": { 25 + "@types/bun": "^1.3.1", 24 26 "@vitest/coverage-v8": "^4.0.5", 25 27 "@vitest/ui": "^4.0.5", 26 28 "gzip-size-cli": "^5.1.0",
+7
src/morphlex.ts
··· 1 + // Type declaration for moveBefore API (not yet in TypeScript DOM types) 2 + declare global { 3 + interface Element { 4 + moveBefore?(node: Node, child: Node | null): Node 5 + } 6 + } 7 + 1 8 type IdSet = Set<string> 2 9 type IdMap = WeakMap<ReadonlyNode<Node>, IdSet> 3 10
+1
tsconfig.json
··· 8 8 "target": "es2022", 9 9 "removeComments": false, 10 10 "outDir": "dist", 11 + "skipLibCheck": true, 11 12 "baseUrl": ".", 12 13 "noEmit": false, 13 14 "declaration": true,