Files
pad/web/package.json
T
xarmian fa2755e183 feat(materialize): headless op-log materializer bundle, goja runner and worker (TASK-2198 U2) (#1678)
* feat(materialize): headless op-log materializer bundle, goja runner and worker (TASK-2198 U2)

Builds the editor's own JS (Yjs -> y-tiptap -> Tiptap schema -> tiptap-markdown
-> the tab's flush pipeline) into one IIFE, embeds it, and runs it in goja. Not
wired into the server yet (U3 supervisor, U4 write path).

- web/src/lib/collab/materializer/: bundle entry (extension list mirrors
  Editor.svelte's collab branch via the U1 shared modules), op-log replay
  mirroring wsProvider's MESSAGE_SYNC arm, linkedom DOM shim and polyfills
  from the spike, and a vendored patch of prosemirror-markdown
  MarkdownSerializerState.atBlank (quadratic under goja; equivalent).
- web/scripts/build-materializer.mjs (esbuild) -> web/build-materializer/,
  run by `npm run build`; embedded as pad.MaterializerJS.
- internal/materialize: Runner (Go-native atob/btoa/TextEncoder/TextDecoder/
  getRandomValues, schema-version check, ctx interrupt with a clean VM after),
  and RunWorker's length-prefixed JSON protocol behind the hidden
  `pad __materialize-worker` command.
- Parity: vitest drives two real Editor.svelte mounts and compares
  materialize() with the tab's flush on 50 seeded cases; the same cases are
  committed as testdata/corpus.json and replayed in goja (TestCorpusParity).
- CI Go jobs, release tests, Docker and Nix produce the bundle; linkedom and
  esbuild are new devDependencies.

Claude-Session: https://claude.ai/code/session_01H63zaWhkb5pAafx2WGjrVC

* test(materialize): pin the atBlank patch's equivalence under V8 too (TASK-2198 U2, codex r1)

Codex r1 claimed upstream's /(^|\n)$/ is true for a trailing CR in JS. It is
not (checked in V8: false for "\r" and "a\u2028", as the patch returns),
but the only equivalence test ran under goja and the patch header cited a
V8-side test that did not exist. This adds it, with the line-terminator edge
cases, and it fails when the patch checks CR instead of LF.

Claude-Session: https://claude.ai/code/session_01H63zaWhkb5pAafx2WGjrVC

* build(nix): vendorHash for goja (TASK-2198 U2)

Taken from the Nix job's recompute on c7fa1931 (specified sha256-iEqv…,
got sha256-P1bQ…), so main does not depend on the heal job after merge.

Claude-Session: https://claude.ai/code/session_01H63zaWhkb5pAafx2WGjrVC
2026-09-30 02:50:10 -04:00

85 lines
2.4 KiB
JSON

{
"name": "web",
"private": true,
"version": "0.0.1",
"license": "Apache-2.0",
"type": "module",
"scripts": {
"dev": "vite dev",
"build": "vite build && node scripts/build-materializer.mjs",
"preview": "vite preview",
"prepare": "svelte-kit sync || echo ''",
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
"test": "vitest run",
"test:watch": "vitest",
"test:e2e": "playwright test",
"test:e2e:ui": "playwright test --ui",
"test:e2e:install": "playwright install --with-deps chromium",
"check:tiptap-pins": "node scripts/check-tiptap-pins.mjs",
"audit:ci": "node scripts/ci-audit.mjs"
},
"devDependencies": {
"@playwright/test": "^1.63.0",
"@sveltejs/adapter-auto": "^7.0.1",
"@sveltejs/adapter-static": "^3.0.10",
"@sveltejs/kit": "^2.70.3",
"@sveltejs/vite-plugin-svelte": "^7.3.1",
"@testing-library/jest-dom": "^7.0.1",
"@testing-library/svelte": "^5.2.8",
"@types/d3-scale": "4.0.9",
"@types/qrcode": "^1.5.6",
"esbuild": "0.28.2",
"fake-indexeddb": "6.2.5",
"jsdom": "^29.1.1",
"linkedom": "0.18.13",
"marked": "^18.0.14",
"svelte": "^5.57.1",
"svelte-check": "^4.7.6",
"typescript": "^6.0.3",
"vite": "^8.3.1",
"vitest": "5.0.2"
},
"overrides": {
"cookie": "^0.7.2",
"linkify-it": "^5.0.2",
"lodash-es": "^4.18.1",
"markdown-it": "^14.3.0",
"layercake": {
"typescript": "$typescript"
}
},
"dependencies": {
"@dagrejs/dagre": "3.1.1",
"@tiptap/core": "3.31.3",
"@tiptap/extension-bubble-menu": "^3.31.3",
"@tiptap/extension-code-block-lowlight": "^3.31.3",
"@tiptap/extension-collaboration": "3.31.3",
"@tiptap/extension-collaboration-caret": "3.31.3",
"@tiptap/extension-link": "^3.22.5",
"@tiptap/extension-placeholder": "^3.31.3",
"@tiptap/extension-table": "^3.31.3",
"@tiptap/extension-task-item": "^3.31.3",
"@tiptap/extension-task-list": "^3.31.3",
"@tiptap/pm": "3.31.3",
"@tiptap/starter-kit": "^3.31.3",
"@tiptap/suggestion": "^3.31.3",
"@tiptap/y-tiptap": "3.0.9",
"3d-force-graph": "1.80.0",
"d3-scale": "4.0.2",
"diff": "^9.0.0",
"dompurify": "^3.4.16",
"idb": "^8.0.3",
"layercake": "11.0.0",
"lowlight": "^3.3.0",
"mermaid": "^12.0.0",
"minisearch": "7.2.0",
"qrcode": "^1.5.4",
"svelte-dnd-action": "^0.9.79",
"three-spritetext": "1.10.0",
"tiptap-markdown": "^0.9.0",
"y-protocols": "^1.0.7",
"yjs": "^13.6.33"
}
}