Beautiful, AI-native markdown IDE and LLM wiki
TypeScript 2nd-brainagent-skillsclaudecodexcompany-braindocsknowledge-knowledge-baseknowledge-managementllmllm-wikillm-wiki-karpathymarkdownmarkdown-editormdmdxnotespkmsecond-brainskills
fix(ok): give asset-click-dispatch and sibling specs unique asset identities (#3313)
Nick Gomez816c2d05307c
diff --git a/knip.config.ts b/knip.config.tsindex bbc8ca7cb..13a6b9fb3 100644--- a/knip.config.ts+++ b/knip.config.ts@@ -123,9 +123,7 @@ export default {'packages/server': {entry: ['src/**/*.test.ts', 'src/parse-worker.ts'],project: 'src/**',- ignoreDependencies: [- '@types/shell-quote',- ],+ ignoreDependencies: ['@types/shell-quote'],},'packages/cli': {entry: ['src/**/*.test.ts', 'scripts/*.ts', 'tests/**/*.ts', 'src/parse-worker.ts'],diff --git a/packages/app/tests/stress/asset-click-dispatch.e2e.ts b/packages/app/tests/stress/asset-click-dispatch.e2e.tsindex 7110fc47c..e6da545e1 100644--- a/packages/app/tests/stress/asset-click-dispatch.e2e.ts+++ b/packages/app/tests/stress/asset-click-dispatch.e2e.ts@@ -29,8 +29,10 @@ import { join } from 'node:path';import type { Page } from '@playwright/test';import {createPngBuffer,+ escapeRegExp,expect,test,+ uniqueAssetName,waitForActiveProviderSynced as waitForProvider,} from './_helpers';@@ -98,20 +100,13 @@ async function dropFileIntoEditor();}-// 1x1 transparent PNG. Salt with the file-name so the server's same-dir-// sha256 dedup (`findDuplicateAsset` in `api-extension.ts`) cannot collapse-// our drops onto a byte-identical upload from a sister stress file sharing-// the worker's contentDir. Byte-identical within this file-// so internal dedup behaviour stays predictable.-const TINY_PNG_BYTES = Array.from(createPngBuffer('asset-click-dispatch'));-// Minimal valid PDF bytes — PDF 1.4 header + catalog + trailer. Chromium's// built-in PDF viewer accepts this shape; adversarial tests would want a// larger corpus but a valid 1-page PDF is enough to verify server Content--// Type + URL resolution.-const TINY_PDF_BYTES = Array.from(- Buffer.from(- `%PDF-1.4+// Type + URL resolution. A per-test salt is appended as a trailing `%`+// comment (ignored by PDF readers, and after the `%PDF-` header `file-type`+// sniffs on) so no two tests upload byte-identical PDFs.+const TINY_PDF_SOURCE = `%PDF-1.41 0 obj<</Type/Catalog/Pages 2 0 R>>endobj2 0 obj<</Type/Pages/Kids[3 0 R]/Count 1>>endobj3 0 obj<</Type/Page/Parent 2 0 R/MediaBox[0 0 612 792]>>endobj@@ -124,16 +119,26 @@ xreftrailer<</Size 4/Root 1 0 R>>startxref140-%%EOF`,- 'utf-8',- ),-);+%%EOF`;test.describe('asset-click dispatcher — P9 E2E scenarios (SPEC 2026-04-23)', () => {let docName: string;+ // Per-test token shared by the docName, every asset this test uploads, and+ // the byte salts. Uploads land in the worker-shared contentDir keyed by+ // filename, so a per-test docName is not enough isolation: a name a sibling+ // spec already stored under different bytes comes back with a `-1`+ // collision suffix, and bytes a sibling already stored come back under the+ // sibling's name via same-dir sha256 dedup. Minting both a unique name+ // (`uniqueAssetName`) and unique bytes (the `runId` salt) closes both.+ let runId: string;+ let tinyPng: number[];+ let tinyPdf: number[];test.beforeEach(async ({ page, api }) => {- docName = `asset-dispatch-${randomUUID().slice(0, 8)}`;+ runId = randomUUID().slice(0, 8);+ tinyPng = Array.from(createPngBuffer(`asset-click-dispatch-${runId}`));+ tinyPdf = Array.from(Buffer.from(`${TINY_PDF_SOURCE}\n%${runId}\n`, 'utf-8'));+ docName = `asset-dispatch-${runId}`;await api.createPage(`${docName}.md`);await api.replaceDoc(docName, '# Dispatch test\n');await page.goto(`/#/${docName}`);@@ -298,18 +303,17 @@ test.describe('asset-click dispatcher — P9 E2E scenarios (SPEC 2026-04-23)', (// (not a racey `.ProseMirror` querySelector that can resolve to a// cached doc's editor under the Activity pool) and dispatches dragover// then drop so TipTap's FileHandler extension completes its sequence.- await dropFileIntoEditor(page, TINY_PNG_BYTES, 'photo.png', 'image/png');+ const pngName = uniqueAssetName('photo.png', runId);+ await dropFileIntoEditor(page, tinyPng, pngName, 'image/png');- await expect- .poll(async () => await getSourceText(page), { timeout: 5_000 })- .toContain('photo.png');+ await expect.poll(async () => await getSourceText(page), { timeout: 5_000 }).toContain(pngName);// Scope to the editor AND content-qualify by src: ProseMirror inserts// hidden trailing-hack / mark-cursor `<img class="ProseMirror-separator">`// widgets inside `.ProseMirror`, so a bare `img` (or `.ProseMirror img`)- // `.first()` resolves to a sourceless separator. The `[src*="photo.png"]`- // qualifier matches only the dropped image — separators carry no src.- const img = page.locator('.ProseMirror img[src*="photo.png"]').first();+ // `.first()` resolves to a sourceless separator. The `[src*=…]` qualifier+ // matches only the dropped image — separators carry no src.+ const img = page.locator(`.ProseMirror img[src*="${pngName}"]`).first();await img.waitFor({ state: 'visible', timeout: 5_000 });// Clicking an image should NOT open a new tab. `waitForEvent` rejects@@ -372,24 +376,26 @@ test.describe('asset-click dispatcher — P9 E2E scenarios (SPEC 2026-04-23)', (await page.waitForSelector('.ProseMirror:not(.composer-prosemirror)');await page.click('.ProseMirror:not(.composer-prosemirror)');- await dropFileIntoEditor(page, TINY_PNG_BYTES, 'photo.png', 'image/png');+ const pngName = uniqueAssetName('photo.png', runId);+ await dropFileIntoEditor(page, tinyPng, pngName, 'image/png');- // Wait for Y.Text to carry a photo.png reference — image-extension- // drops emit the canonical `<img src="…/photo.png" />` JSX shape- // (alt is omitted on drop so the chrome-bar gear nudge fires). The- // substring assertion is shape-tolerant.- await expect- .poll(async () => await getSourceText(page), { timeout: 5_000 })- .toContain('photo.png');+ // Wait for Y.Text to carry the asset reference — image-extension drops+ // emit the canonical `<img src="…/<pngName>" />` JSX shape (alt is+ // omitted on drop so the chrome-bar gear nudge fires). The substring+ // assertion is shape-tolerant.+ await expect.poll(async () => await getSourceText(page), { timeout: 5_000 }).toContain(pngName);// Content-qualify by src so the locator skips ProseMirror's hidden// `<img class="ProseMirror-separator">` widgets (sourceless, naturalWidth// always 0). A bare `.ProseMirror img` `.first()` resolves to a separator- // and the naturalWidth poll below could never pass. `[src*="photo.png"]`- // stays src-shape-agnostic — it matches whether the rendered URL is the- // correct `/docs/sub-XXX/photo.png` or a broken root-relative one — so- // the naturalWidth assertion is what fails if a URL regression exists.- const img = page.locator('.ProseMirror img[src*="photo.png"]').first();+ // and the naturalWidth poll below could never pass. `[src*=…]` stays+ // src-shape-agnostic — it matches whether the rendered URL is the correct+ // `/docs/sub-XXX/<pngName>` or a broken root-relative one — so the+ // naturalWidth assertion is what fails if a URL regression exists. The+ // per-test name is load-bearing for that: under a shared `photo.png`, a+ // sibling spec's decodable root-level upload satisfies naturalWidth for a+ // root-relative src and the regression guard passes on the wrong bytes.+ const img = page.locator(`.ProseMirror img[src*="${pngName}"]`).first();await img.waitFor({ state: 'attached', timeout: 5_000 });// THE assertion: naturalWidth > 0 means the bytes loaded + decoded.@@ -428,16 +434,15 @@ test.describe('asset-click dispatcher — P9 E2E scenarios (SPEC 2026-04-23)', (await page.waitForSelector('.ProseMirror:not(.composer-prosemirror)');await page.click('.ProseMirror:not(.composer-prosemirror)');- await dropFileIntoEditor(page, TINY_PDF_BYTES, 'doc.pdf', 'application/pdf');+ const pdfName = uniqueAssetName('doc.pdf', runId);+ await dropFileIntoEditor(page, tinyPdf, pdfName, 'application/pdf');- await expect- .poll(async () => await getSourceText(page), { timeout: 5_000 })- .toContain('doc.pdf');+ await expect.poll(async () => await getSourceText(page), { timeout: 5_000 }).toContain(pdfName);// Settlement signal: wait for the source to carry the wiki-embed- // canonical form `![[doc.pdf]]`. This is what Observer A emits once it+ // canonical form `![[<pdfName>]]`. This is what Observer A emits once it// has serialized the dropped `wikiLinkEmbed` atom; it does NOT require- // Observer B's re-parse + JSX swap. The earlier 5s poll for 'doc.pdf'+ // Observer B's re-parse + JSX swap. The earlier 5s poll for the bare name// can be satisfied by intermediate states (markdown link forms etc.);// the wiki-embed bracket form is the post-Observer-A canonical and is// sufficient to prove the drop pipeline finished its server-bound work.@@ -456,12 +461,12 @@ test.describe('asset-click dispatcher — P9 E2E scenarios (SPEC 2026-04-23)', (// serve-middleware response, not the JSX paint.await expect.poll(async () => await getSourceText(page), { timeout: 30_000 })- .toContain('![[doc.pdf]]');+ .toContain(`![[${pdfName}]]`);// Reconstruct the expected URL from test inputs: subdirDoc is// `docs/sub-XXXXXX/notes`, the dropped file lives in the doc's- // directory as `doc.pdf`, so the served URL is `/docs/sub-XXXXXX/doc.pdf`.- const expectedHref = `/${subdirDoc.split('/').slice(0, -1).join('/')}/doc.pdf`;+ // directory, so the served URL is `/docs/sub-XXXXXX/<pdfName>`.+ const expectedHref = `/${subdirDoc.split('/').slice(0, -1).join('/')}/${pdfName}`;// Full round-trip assertion: fetch the URL directly and verify the// server serves the PDF correctly (not SPA-fallback HTML).@@ -561,19 +566,25 @@ test.describe('asset-click dispatcher — P9 E2E scenarios (SPEC 2026-04-23)', (// dispatch happens at sirv via mrmime; the test asserts HREF SHAPE// only (full round-trip Content-Type requires the filewatcher's// dirCount to propagate — a timing-dependent surface).+ // Salt bytes trail the `ftyp` box so the sniff still sees `ftypM4V ` while+ // no two tests upload a byte-identical M4V.const TINY_M4V_BYTES = Array.from(- Buffer.concat([Buffer.from([0, 0, 0, 0x18]), Buffer.from('ftypM4V '), Buffer.alloc(8, 0)]),+ Buffer.concat([+ Buffer.from([0, 0, 0, 0x18]),+ Buffer.from('ftypM4V '),+ Buffer.alloc(8, 0),+ Buffer.from(runId, 'utf-8'),+ ]),);- await dropFileIntoEditor(page, TINY_M4V_BYTES, 'clip.m4v', 'video/mp4');+ const m4vName = uniqueAssetName('clip.m4v', runId);+ await dropFileIntoEditor(page, TINY_M4V_BYTES, m4vName, 'video/mp4');- await expect- .poll(async () => await getSourceText(page), { timeout: 5_000 })- .toContain('clip.m4v');+ await expect.poll(async () => await getSourceText(page), { timeout: 5_000 }).toContain(m4vName);const text = await getSourceText(page);// Source emits the lowercase `<video>` JSX shape (descriptor render via// Video.tsx). Server-absolute src so the browser resolves it against// origin under hash routing, not against the doc's hash fragment.- expect(text).toMatch(/<video\s+src="\/docs\/sub-[^/]+\/clip\.m4v"/);+ expect(text).toMatch(new RegExp(`<video\\s+src="/docs/sub-[^/]+/${escapeRegExp(m4vName)}"`));// `controls={true}` matches the canonical `<video>` descriptor's// declared default; emit-time omit-on-default strips the attribute on// the canonical serialize path. Renderer applies controls=true on@@ -583,10 +594,10 @@ test.describe('asset-click dispatcher — P9 E2E scenarios (SPEC 2026-04-23)', (// The Video NodeView renders the lowercase `<video>` element. Pin its// server-absolute src — it was doc-relative (broken under// hash routing).- const videoEl = page.locator('.ProseMirror video[src*="/clip.m4v"]').first();+ const videoEl = page.locator(`.ProseMirror video[src*="/${m4vName}"]`).first();await videoEl.waitFor({ state: 'visible', timeout: 5_000 });const src = await videoEl.getAttribute('src');- expect(src).toMatch(/^\/docs\/sub-[^/]+\/clip\.m4v$/);+ expect(src).toMatch(new RegExp(`^/docs/sub-[^/]+/${escapeRegExp(m4vName)}$`));// Full round-trip: fetching the embedded URL streams the file bytes// with `Content-Disposition: inline` + `Content-Type: video/mp4`diff --git a/packages/app/tests/stress/drop-pipeline-auto-open.e2e.ts b/packages/app/tests/stress/drop-pipeline-auto-open.e2e.tsindex e7946312c..f211ed84e 100644--- a/packages/app/tests/stress/drop-pipeline-auto-open.e2e.ts+++ b/packages/app/tests/stress/drop-pipeline-auto-open.e2e.ts@@ -32,8 +32,10 @@ import {createMp3Buffer,createMp4Buffer,createPngBuffer,+ escapeRegExp,expect,test,+ uniqueAssetName,waitForActiveProviderSynced as waitForProvider,} from './_helpers';@@ -111,39 +113,41 @@ async function getSourceText(page: Page): Promise<string> {// `image-upload/index.ts` is shared across types today; cells stay separate// so a per-type refactor is forced to keep the contract intact for each.-// Per-test-file salt on the magic-byte fixtures so the server's same-dir-// sha256 dedup (`findDuplicateAsset` in `api-extension.ts`) cannot collapse-// our drops onto a byte-identical upload from a sister stress file sharing-// the worker's contentDir. Without salts, asset-embed.e2e.ts's TINY_PNG-// bytes (same base64) land first and our `photo.png` drop returns a deduped-// `shot.png` src — failing the `sourceMarker` assertion below. The salt-// only appends bytes after the format-defining magic header, so the file-// still type-sniffs as the intended format. Bug shape characterized in-// `upload-fixtures.ts` docstring.+// Uploads land in the worker-shared contentDir keyed by filename, and every+// spec that runs on the same worker shares it. Two isolation axes are needed,+// and each closes a different failure:+//+// - a per-test asset NAME (`uniqueAssetName`): a name a sibling spec already+// stored under different bytes comes back with a `-1` collision suffix.+// - a per-test byte SALT: bytes a sibling already stored come back under the+// sibling's name via same-dir sha256 dedup (`findDuplicateAsset`), so a+// `photo.png` drop can resolve to a sibling's `shot.png` and the drop+// never exercises a fresh store. The salt only appends bytes after the+// format-defining magic header, so the file still type-sniffs as intended.+//+// With both in place the source assertion below pins the exact name — a+// collision fails loudly instead of being absorbed by a `-\d+` tolerance.const cases = [{name: 'png-image',label: 'image/png',filename: 'photo.png',mime: 'image/png',- bytes: () => Array.from(createPngBuffer('drop-noautoopen-png')),- sourceMarker: /photo(?:-\d+)?\.png/,+ bytes: (runId: string) => Array.from(createPngBuffer(`drop-noautoopen-png-${runId}`)),},{name: 'mp4-video',label: 'video/mp4',filename: 'clip.mp4',mime: 'video/mp4',- bytes: () => Array.from(createMp4Buffer('drop-noautoopen-mp4')),- sourceMarker: /clip(?:-\d+)?\.mp4/,+ bytes: (runId: string) => Array.from(createMp4Buffer(`drop-noautoopen-mp4-${runId}`)),},{name: 'mp3-audio',label: 'audio/mpeg',filename: 'sound.mp3',mime: 'audio/mpeg',- bytes: () => Array.from(createMp3Buffer('drop-noautoopen-mp3')),- sourceMarker: /sound(?:-\d+)?\.mp3/,+ bytes: (runId: string) => Array.from(createMp3Buffer(`drop-noautoopen-mp3-${runId}`)),},] as const;@@ -153,14 +157,18 @@ test.describe('Drop pipeline does not auto-open the descriptor PropPanel', () =>page,api,}) => {- const docName = `drop-noautoopen-${c.name}-${Math.random().toString(36).slice(2, 10)}`;+ // Per-test token shared by the docName, the asset name, and the byte+ // salt (see the `cases` header for why both name and bytes must differ).+ const runId = Math.random().toString(36).slice(2, 10);+ const assetName = uniqueAssetName(c.filename, runId);+ const docName = `drop-noautoopen-${c.name}-${runId}`;await api.createPage(`${docName}.md`);await page.goto(`/#/${docName}`);await waitForProvider(page);await page.waitForSelector('.ProseMirror:not(.composer-prosemirror)');await page.click('.ProseMirror:not(.composer-prosemirror)');- await dropFileIntoEditor(page, c.bytes(), c.filename, c.mime);+ await dropFileIntoEditor(page, c.bytes(runId), assetName, c.mime);// The drop completes when the source carries a reference to the file.// Y.XmlFragment → Y.Text Observer A serializes the inserted node; once@@ -169,7 +177,7 @@ test.describe('Drop pipeline does not auto-open the descriptor PropPanel', () =>// has executed.await expect.poll(async () => await getSourceText(page), { timeout: 5_000 })- .toMatch(c.sourceMarker);+ .toMatch(new RegExp(escapeRegExp(assetName)));// THE assertion: PropPanel does NOT auto-open. `[data-prop-panel]` is// only rendered when the descriptor's Popover open state is true,diff --git a/packages/app/tests/stress/prop-upload.e2e.ts b/packages/app/tests/stress/prop-upload.e2e.tsindex d74811e33..0ff986772 100644--- a/packages/app/tests/stress/prop-upload.e2e.ts+++ b/packages/app/tests/stress/prop-upload.e2e.ts@@ -49,6 +49,7 @@ import {createPngBuffer,expect,test,+ uniqueAssetName,waitForActiveProviderSynced,} from './_helpers';@@ -125,7 +126,7 @@ interface UploadCase {initialSrc: string;/** Two distinct payloads — the test uploads both in sequence to exercise* initial replace AND second replace through the same wiring. */- payloads: Array<{ name: string; mimeType: string; buffer: Buffer }>;+ payloads: (runId: string) => Array<{ name: string; mimeType: string; buffer: Buffer }>;}const cases: Record<'img' | 'video' | 'audio', UploadCase> = {@@ -136,10 +137,22 @@ const cases: Record<'img' | 'video' | 'audio', UploadCase> = {initialSrc: 'initial.png',// Distinct salts so the two payloads differ in sha256; HEAD's `/api/upload`// same-dir dedup would otherwise collapse byte-identical buffers to one- // stored file, leaving src unchanged on the second upload.- payloads: [- { name: 'first.png', mimeType: 'image/png', buffer: createPngBuffer('first') },- { name: 'second.png', mimeType: 'image/png', buffer: createPngBuffer('second') },+ // stored file, leaving src unchanged on the second upload. The per-test+ // `runId` extends that isolation across specs: uploads are keyed by+ // filename in the worker-shared contentDir, so a bare `first.png` can come+ // back with a `-1` collision suffix (sibling stored that name) or under a+ // sibling's name via dedup (sibling stored these bytes).+ payloads: (runId: string) => [+ {+ name: uniqueAssetName('first.png', runId),+ mimeType: 'image/png',+ buffer: createPngBuffer(`first-${runId}`),+ },+ {+ name: uniqueAssetName('second.png', runId),+ mimeType: 'image/png',+ buffer: createPngBuffer(`second-${runId}`),+ },],},video: {@@ -147,9 +160,17 @@ const cases: Record<'img' | 'video' | 'audio', UploadCase> = {endpoint: '/api/upload',initialMarkdown: '<video src="initial.mp4" controls />',initialSrc: 'initial.mp4',- payloads: [- { name: 'first.mp4', mimeType: 'video/mp4', buffer: createMp4Buffer('first') },- { name: 'second.mp4', mimeType: 'video/mp4', buffer: createMp4Buffer('second') },+ payloads: (runId: string) => [+ {+ name: uniqueAssetName('first.mp4', runId),+ mimeType: 'video/mp4',+ buffer: createMp4Buffer(`first-${runId}`),+ },+ {+ name: uniqueAssetName('second.mp4', runId),+ mimeType: 'video/mp4',+ buffer: createMp4Buffer(`second-${runId}`),+ },],},audio: {@@ -157,9 +178,17 @@ const cases: Record<'img' | 'video' | 'audio', UploadCase> = {endpoint: '/api/upload',initialMarkdown: '<audio src="initial.mp3" controls />',initialSrc: 'initial.mp3',- payloads: [- { name: 'first.mp3', mimeType: 'audio/mpeg', buffer: createMp3Buffer('first') },- { name: 'second.mp3', mimeType: 'audio/mpeg', buffer: createMp3Buffer('second') },+ payloads: (runId: string) => [+ {+ name: uniqueAssetName('first.mp3', runId),+ mimeType: 'audio/mpeg',+ buffer: createMp3Buffer(`first-${runId}`),+ },+ {+ name: uniqueAssetName('second.mp3', runId),+ mimeType: 'audio/mpeg',+ buffer: createMp3Buffer(`second-${runId}`),+ },],},};@@ -176,7 +205,10 @@ for (const kind of ['img', 'video', 'audio'] as const) {api,workerServer,}) => {- const docName = `prop-upload-${kind}-${randomUUID().slice(0, 8)}`;+ // Per-test token shared by the docName and every asset this test uploads.+ const runId = randomUUID().slice(0, 8);+ const payloads = c.payloads(runId);+ const docName = `prop-upload-${kind}-${runId}`;await api.seedDocs([{ name: docName, markdown: c.initialMarkdown }]);await page.goto(`/#/${docName}`);await page.waitForSelector('.ProseMirror:not(.composer-prosemirror)');@@ -198,9 +230,9 @@ for (const kind of ['img', 'video', 'audio'] as const) {// First upload — initial → first payload.await fileInput.setInputFiles({- name: c.payloads[0].name,- mimeType: c.payloads[0].mimeType,- buffer: c.payloads[0].buffer,+ name: payloads[0].name,+ mimeType: payloads[0].mimeType,+ buffer: payloads[0].buffer,});const srcAfterFirst = await waitForSrcChange(page, c.tag, normalizedInitialSrc);expect(srcAfterFirst).not.toBe(c.initialSrc);@@ -210,21 +242,21 @@ for (const kind of ['img', 'video', 'audio'] as const) {// peer-dir assets resolve correctly under hash routing. Mirror of the// drop path's `resolvedSrc = `/${assetContentPath}``.expect(srcAfterFirst.startsWith('/')).toBe(true);- expect(srcAfterFirst).toContain(c.payloads[0].name.replace(/\.\w+$/, ''));+ expect(srcAfterFirst).toContain(payloads[0].name.replace(/\.\w+$/, ''));// Strip the leading `/` before joining with the contentDir.expect(existsSync(join(workerServer.contentDir, srcAfterFirst.replace(/^\//, '')))).toBe(true);// Second upload — first payload → second payload. Same wiring path,// but starting from a populated src (initial-vs-update parity).await fileInput.setInputFiles({- name: c.payloads[1].name,- mimeType: c.payloads[1].mimeType,- buffer: c.payloads[1].buffer,+ name: payloads[1].name,+ mimeType: payloads[1].mimeType,+ buffer: payloads[1].buffer,});const srcAfterSecond = await waitForSrcChange(page, c.tag, srcAfterFirst);expect(srcAfterSecond).not.toBe(srcAfterFirst);expect(srcAfterSecond.startsWith('/')).toBe(true);- expect(srcAfterSecond).toContain(c.payloads[1].name.replace(/\.\w+$/, ''));+ expect(srcAfterSecond).toContain(payloads[1].name.replace(/\.\w+$/, ''));expect(existsSync(join(workerServer.contentDir, srcAfterSecond.replace(/^\//, '')))).toBe(true);});}@@ -270,7 +302,10 @@ test('UPLOAD-IMG-SUBDIR-01: subdir-doc upload renders <img> that fetches the ass// missing prerequisite instead of the upload step.expect(existsSync(join(workerServer.contentDir, 'sidebar-folder', 'nested-doc.md'))).toBe(true);- const docName = `sidebar-folder/upload-${randomUUID().slice(0, 8)}`;+ // Per-test token shared by the docName and the uploaded asset.+ const runId = randomUUID().slice(0, 8);+ const payload = cases.img.payloads(runId)[0];+ const docName = `sidebar-folder/upload-${runId}`;await api.seedDocs([{ name: docName, markdown: cases.img.initialMarkdown }]);await page.goto(`/#/${docName}`);await page.waitForSelector('.ProseMirror:not(.composer-prosemirror)');@@ -289,9 +324,9 @@ test('UPLOAD-IMG-SUBDIR-01: subdir-doc upload renders <img> that fetches the assawait fileInput.waitFor({ state: 'attached', timeout: 5000 });await fileInput.setInputFiles({- name: cases.img.payloads[0].name,- mimeType: cases.img.payloads[0].mimeType,- buffer: cases.img.payloads[0].buffer,+ name: payload.name,+ mimeType: payload.mimeType,+ buffer: payload.buffer,});const newSrc = await waitForSrcChange(page, 'img', normalizedInitialSrc);diff --git a/packages/core/src/bridge/bind-frontmatter-doc.ts b/packages/core/src/bridge/bind-frontmatter-doc.tsindex dfd95ef49..d7a845280 100644--- a/packages/core/src/bridge/bind-frontmatter-doc.ts+++ b/packages/core/src/bridge/bind-frontmatter-doc.ts@@ -1,4 +1,3 @@-import type * as Y from 'yjs';import type { Err, Ok, Result } from '../config/result.ts';import { type FrontmatterValidationError, toFrontmatterIssue } from '../frontmatter/errors.ts';diff --git a/packages/core/src/bridge/bridge-invariant.ts b/packages/core/src/bridge/bridge-invariant.tsindex 8bfdb40cd..005627195 100644--- a/packages/core/src/bridge/bridge-invariant.ts+++ b/packages/core/src/bridge/bridge-invariant.ts@@ -1,4 +1,3 @@-import { fnv1aDigest } from './hash-util.ts';export type BridgeInvariantSite = 'observer-b' | 'persistence' | 'test-harness';diff --git a/packages/core/src/bridge/compose.ts b/packages/core/src/bridge/compose.tsindex 2a597ec3d..f4cc8a286 100644--- a/packages/core/src/bridge/compose.ts+++ b/packages/core/src/bridge/compose.ts@@ -1,4 +1,3 @@-import { prependFrontmatter, stripFrontmatter } from '../extensions/frontmatter.ts';export type ComposeAdjustment = 'none' | 'body' | 'frontmatter' | 'unresolved';diff --git a/packages/core/src/bridge/doc-boundary-space.ts b/packages/core/src/bridge/doc-boundary-space.tsindex 01ef76a9f..8fb428b90 100644--- a/packages/core/src/bridge/doc-boundary-space.ts+++ b/packages/core/src/bridge/doc-boundary-space.ts@@ -1,4 +1,3 @@-import { FRONTMATTER_RE, stripFrontmatter } from '../extensions/frontmatter.ts';import { carriedEdgeEmpties, type DocEdgeEmpties } from '../markdown/doc-edge-blank-runs.ts';diff --git a/packages/core/src/bridge/growth-detect.ts b/packages/core/src/bridge/growth-detect.tsindex 463e89595..9d9c244b0 100644--- a/packages/core/src/bridge/growth-detect.ts+++ b/packages/core/src/bridge/growth-detect.ts@@ -1,4 +1,3 @@-const DEFAULT_MIN_SUBSTANTIVE_LINE_LENGTH = 16;export const DUPLICATION_GATE_MIN_LINE_LENGTH = 8;diff --git a/packages/core/src/bridge/intraline-predicate.ts b/packages/core/src/bridge/intraline-predicate.tsindex 0939885bb..c43fdd7e7 100644--- a/packages/core/src/bridge/intraline-predicate.ts+++ b/packages/core/src/bridge/intraline-predicate.ts@@ -1,4 +1,3 @@-export function rawLineCounts(doc: string): Map<string, number> {const counts = new Map<string, number>();for (const line of doc.split('\n')) {diff --git a/packages/core/src/bridge/merge-three-way.ts b/packages/core/src/bridge/merge-three-way.tsindex c0dc65705..251560a35 100644--- a/packages/core/src/bridge/merge-three-way.ts+++ b/packages/core/src/bridge/merge-three-way.ts@@ -65,7 +65,6 @@ export function tryLineLevelCombine(return { clean: true, merged };}-export type BridgeMergeContentLossSide = 'user' | 'agent';export type BridgeMergeContentLossWhich = 'substring' | 'order' | 'growth';diff --git a/packages/core/src/bridge/normalize.ts b/packages/core/src/bridge/normalize.tsindex dcc5b0690..01ac80099 100644--- a/packages/core/src/bridge/normalize.ts+++ b/packages/core/src/bridge/normalize.ts@@ -1,4 +1,3 @@-import { stripFrontmatter } from '../extensions/frontmatter.ts';import { bodyEdgeEmpties } from './doc-boundary-space.ts';diff --git a/packages/core/src/bridge/pm-structural-equivalence.ts b/packages/core/src/bridge/pm-structural-equivalence.tsindex 0be5203e4..754dc5cc2 100644--- a/packages/core/src/bridge/pm-structural-equivalence.ts+++ b/packages/core/src/bridge/pm-structural-equivalence.ts@@ -32,7 +32,6 @@ const BR_SENTINEL: PmStructuralNode = { type: '__br__' };const BR_LITERAL_RE = /^<br\s*\/?>$/i;-interface DegradeEntry {readonly label: string;readonly severity: ToleranceClassSeverity;@@ -128,7 +127,6 @@ export interface ComparePmStructuralOptions {ignoreAttrs?: (attrKey: string) => boolean;}-/** Rebuild a node with `fn` applied to each child; identity when childless.* Shared by the degrade canonicalizers so none re-implements the walk. */function mapChildren(@@ -250,7 +248,6 @@ function applyDegrades(tree: PmStructuralNode): {return { normalized: current, fired };}-export function comparePmStructural(expected: PmStructuralNode,actual: PmStructuralNode,diff --git a/packages/core/src/bridge/subsequence.ts b/packages/core/src/bridge/subsequence.tsindex dca644141..af20de1e2 100644--- a/packages/core/src/bridge/subsequence.ts+++ b/packages/core/src/bridge/subsequence.ts@@ -1,4 +1,3 @@-/** True when `needle` is a subsequence of `haystack` (two-pointer, O(n+m)):* insertions in `haystack` are free; any dropped or substituted `needle` byte* fails. */diff --git a/packages/core/src/markdown/callout-transformer.ts b/packages/core/src/markdown/callout-transformer.tsindex a363dfd54..83d47404a 100644--- a/packages/core/src/markdown/callout-transformer.ts+++ b/packages/core/src/markdown/callout-transformer.ts@@ -1,4 +1,3 @@-import type { Blockquote, Paragraph, Root } from 'mdast';import type { MdxJsxAttribute, MdxJsxFlowElement } from 'mdast-util-mdx';import { visit } from 'unist-util-visit';diff --git a/packages/core/src/markdown/code-fence.ts b/packages/core/src/markdown/code-fence.tsindex 4499dbc92..9807a7e82 100644--- a/packages/core/src/markdown/code-fence.ts+++ b/packages/core/src/markdown/code-fence.ts@@ -1,4 +1,3 @@-export function selectFenceChar(info: string): '`' | '~' {return info.includes('`') ? '~' : '`';}diff --git a/packages/core/src/markdown/comment-promoter.ts b/packages/core/src/markdown/comment-promoter.tsindex 34704165b..7415c474a 100644--- a/packages/core/src/markdown/comment-promoter.ts+++ b/packages/core/src/markdown/comment-promoter.ts@@ -1,4 +1,3 @@-import type { Nodes, Paragraph, PhrasingContent, Root, RootContent, Text } from 'mdast';import { SKIP, visit } from 'unist-util-visit';import type { VFile } from 'vfile';diff --git a/packages/core/src/markdown/dedent-block-jsx-close.ts b/packages/core/src/markdown/dedent-block-jsx-close.tsindex b6299a948..ece5c02a1 100644--- a/packages/core/src/markdown/dedent-block-jsx-close.ts+++ b/packages/core/src/markdown/dedent-block-jsx-close.ts@@ -1,4 +1,3 @@-import { findFencedRegions, isInsideFence } from './fence-regions.ts';const INDENTED_BLOCK_JSX_CLOSE_RE = /^([ ]{1,3})(<\/[A-Z][A-Za-z0-9_]*\s*>)([ \t]*)$/gm;diff --git a/packages/core/src/markdown/details-accordion-promoter.ts b/packages/core/src/markdown/details-accordion-promoter.tsindex acd398aa6..54774764a 100644--- a/packages/core/src/markdown/details-accordion-promoter.ts+++ b/packages/core/src/markdown/details-accordion-promoter.ts@@ -1,4 +1,3 @@-import type { Nodes, Paragraph, Parent, Root, Text } from 'mdast';import type { MdxJsxAttribute, MdxJsxFlowElement } from 'mdast-util-mdx';import { visit } from 'unist-util-visit';diff --git a/packages/core/src/markdown/div-align-promoter.ts b/packages/core/src/markdown/div-align-promoter.tsindex ba9b56384..43ecdc709 100644--- a/packages/core/src/markdown/div-align-promoter.ts+++ b/packages/core/src/markdown/div-align-promoter.ts@@ -1,4 +1,3 @@-import type { Nodes, Paragraph, Parent, Root, Text } from 'mdast';import type { MdxJsxFlowElement } from 'mdast-util-mdx';import { visit } from 'unist-util-visit';diff --git a/packages/core/src/markdown/fence-regions.ts b/packages/core/src/markdown/fence-regions.tsindex 4513da9bb..6d3f3643e 100644--- a/packages/core/src/markdown/fence-regions.ts+++ b/packages/core/src/markdown/fence-regions.ts@@ -1,4 +1,3 @@-const FENCE_RE = /^(`{3,}|~{3,})/gm;export function findFencedRegions(src: string): Array<[number, number]> {diff --git a/packages/core/src/markdown/fixtures/index.ts b/packages/core/src/markdown/fixtures/index.tsindex 6931623c7..00f5771ee 100644--- a/packages/core/src/markdown/fixtures/index.ts+++ b/packages/core/src/markdown/fixtures/index.ts@@ -1,4 +1,3 @@-import { readFileSync } from 'node:fs';import { dirname, resolve } from 'node:path';import { fileURLToPath } from 'node:url';@@ -9,7 +8,6 @@ function fixturePath(...segments: string[]): string {return resolve(FIXTURES_DIR, ...segments);}-interface GfmExample {section: string;markdown: string;@@ -19,7 +17,6 @@ export function loadGfmExamples(): GfmExample[] {return JSON.parse(readFileSync(fixturePath('gfm', 'examples.json'), 'utf8')) as GfmExample[];}-interface MdxCrashEntry {id: string;input: string;@@ -71,7 +68,6 @@ export function loadLargeEmbedFixtures(): LargeEmbedFixture[] {) as LargeEmbedFixture[];}-export function loadPrd6955Before(): string {return readFileSync(fixturePath('regression', 'prd-6955-before.md'), 'utf8');}@@ -80,7 +76,6 @@ export function loadPrd6955CorruptedTriplicated(): string {return readFileSync(fixturePath('regression', 'prd-6955-corrupted-triplicated.md'), 'utf8');}-export interface NgPinnedCase {id: string;name: string;@@ -97,7 +92,6 @@ export function loadNgPinnedCases(): NgPinnedCase[] {) as NgPinnedCase[];}-export function loadLargeRealistic(): string {return readFileSync(fixturePath('perf', 'large-realistic.md'), 'utf8');}diff --git a/packages/core/src/markdown/fixtures/perf/generate.ts b/packages/core/src/markdown/fixtures/perf/generate.tsindex daa3ef82b..8b1eb8519 100644--- a/packages/core/src/markdown/fixtures/perf/generate.ts+++ b/packages/core/src/markdown/fixtures/perf/generate.ts@@ -1,4 +1,3 @@-import { writeFileSync } from 'node:fs';import { dirname, resolve } from 'node:path';import { fileURLToPath } from 'node:url';@@ -11,7 +10,6 @@ const BASELINE_ONLY_COUNTS = [500, 2500] as const;const SEED = 0xf1de1117;-function mulberry32(seed: number): () => number {let a = seed >>> 0;return () => {@@ -38,7 +36,6 @@ function pickWeighted<T>(rand: () => number, items: readonly [T, number][]): T {return items[items.length - 1][0];}-const WORDS = ['lorem','ipsum',@@ -156,7 +153,6 @@ function mdxBlock(rand: () => number): string {return `<${name}>\n\n${sentence(rand)}\n\n</${name}>`;}-type BlockKind = 'paragraph' | 'heading' | 'list' | 'code' | 'table' | 'mdx';const MIX: readonly [BlockKind, number][] = [@@ -195,7 +191,6 @@ function generateDocument(blockCount: number, seed: number): string {return `${blocks.join('\n\n')}\n`;}-function main(): void {for (const count of [...BLOCK_COUNTS, ...BASELINE_ONLY_COUNTS]) {const doc = generateDocument(count, SEED);diff --git a/packages/core/src/markdown/guard-flanking-matrix.ts b/packages/core/src/markdown/guard-flanking-matrix.tsindex 32c055c5b..420dc0fe5 100644--- a/packages/core/src/markdown/guard-flanking-matrix.ts+++ b/packages/core/src/markdown/guard-flanking-matrix.ts@@ -7,7 +7,6 @@ import {import { BACKSLASH_GUARD_SUBSTITUTIONS, encodeBackslashEscapes } from './backslash-escape-guard.ts';import { ENTITY_REF_GUARD_SUBSTITUTIONS, encodeEntityRefs } from './entity-ref-guard.ts';-export const ATTENTION_DELIMITERS = ['*', '_', '**', '~~', '=='] as const;export type FlankClass = 'whitespace' | 'punctuation' | 'other';diff --git a/packages/core/src/markdown/handler-shadow-audit.ts b/packages/core/src/markdown/handler-shadow-audit.tsindex 283913255..2653473da 100644--- a/packages/core/src/markdown/handler-shadow-audit.ts+++ b/packages/core/src/markdown/handler-shadow-audit.ts@@ -1,4 +1,3 @@-export interface HandlerShadowWitness {input: string;expect: 'byte' | 'byte-and-reparse-type';diff --git a/packages/core/src/markdown/highlight-promoter.ts b/packages/core/src/markdown/highlight-promoter.tsindex 5d1000cc4..da0a81d23 100644--- a/packages/core/src/markdown/highlight-promoter.ts+++ b/packages/core/src/markdown/highlight-promoter.ts@@ -1,4 +1,3 @@-import type { Nodes, Parent, PhrasingContent, Root, Text } from 'mdast';import type { MdxJsxTextElement } from 'mdast-util-mdx';import { SKIP, visit } from 'unist-util-visit';diff --git a/packages/core/src/markdown/html-to-mdast.ts b/packages/core/src/markdown/html-to-mdast.tsindex 9681c0056..787315157 100644--- a/packages/core/src/markdown/html-to-mdast.ts+++ b/packages/core/src/markdown/html-to-mdast.ts@@ -1,4 +1,3 @@-import type { Element as HastElement, Root as HastRoot } from 'hast';import type { List, Nodes as MdastNodes, Root as MdastRoot } from 'mdast';import rehypeParse from 'rehype-parse';@@ -129,8 +128,7 @@ export function htmlToMdast(html: string, options?: HtmlToMdastOptions): MdastRothrow new HtmlPayloadTooLargeError(html.length, maxBytes);}- const processor = unified()- .use(rehypeParse, { fragment: true });+ const processor = unified().use(rehypeParse, { fragment: true });for (const plugin of cleanupPlugins) {processor.use(plugin);diff --git a/packages/core/src/markdown/image-promoter.ts b/packages/core/src/markdown/image-promoter.tsindex 994eb6917..706fa9afb 100644--- a/packages/core/src/markdown/image-promoter.ts+++ b/packages/core/src/markdown/image-promoter.ts@@ -1,4 +1,3 @@-import type { Image, Paragraph, Root } from 'mdast';import type { MdxJsxAttribute, MdxJsxFlowElement } from 'mdast-util-mdx';import { visit } from 'unist-util-visit';diff --git a/packages/core/src/markdown/index.ts b/packages/core/src/markdown/index.tsindex 69221627d..9075aa7f1 100644--- a/packages/core/src/markdown/index.ts+++ b/packages/core/src/markdown/index.ts@@ -1,4 +1,3 @@-import {type FromProseMirrorOptions,fromPmMark,@@ -207,7 +206,6 @@ export class MarkdownManager {}}-const registry = createRegistry();function destructureAttrs(@@ -256,7 +254,6 @@ function destructureAttrs(return result;}-function hasDirtyDescendant(node: PmNode): boolean {let found = false;node.descendants((child) => {@@ -279,7 +276,6 @@ function effectiveDirty(node: PmNode, freshnessChecker?: StructuralFreshnessChecreturn freshnessChecker ? freshnessChecker.isDiverged(node.toJSON()) : false;}-function isEmptyMdastParagraph(node: MdastNodes): boolean {if (node.type !== 'paragraph') return false;const children = node.children ?? [];@@ -348,7 +344,6 @@ function extractTextFromMdastNodes(nodes: MdastNodes[]): string {return out;}-import {AUDIO_EXTENSIONS,FILE_ATTACHMENT_EXTENSIONS,@@ -601,7 +596,6 @@ function buildMdastToPmHandlers(}));}-if (m.emphasis) {handlers.emphasis = toPmMark(m.emphasis, (node: Emphasis) => ({sourceDelimiter: node.data?.sourceDelimiter ?? '*',@@ -682,7 +676,6 @@ function buildMdastToPmHandlers(}));}-if (m.link) {const sourceLiteralMark = m.sourceLiteral;handlers.link = (node: Link, _parent: MdastParent, state: MdastToPmState) => {@@ -980,7 +973,6 @@ function buildMdastToPmHandlers(};}-const blockUnknownHandler = (node: {type: string;position?: { start: { offset: number }; end: { offset: number } };@@ -1106,7 +1098,6 @@ function buildMdastToPmHandlers(return handlers as RemarkProseMirrorOptions['handlers'];}-function buildPmToMdastHandlers(schema: Schema,freshness: FreshnessCheckerHolder,diff --git a/packages/core/src/markdown/lint/applies-to.ts b/packages/core/src/markdown/lint/applies-to.tsindex b79e9aef7..fa0be9e86 100644--- a/packages/core/src/markdown/lint/applies-to.ts+++ b/packages/core/src/markdown/lint/applies-to.ts@@ -1,4 +1,3 @@-import picomatch from 'picomatch';import { SUPPORTED_DOC_EXTENSIONS } from '../../constants/doc-extensions.ts';diff --git a/packages/core/src/markdown/lint/config-files.ts b/packages/core/src/markdown/lint/config-files.tsindex 94b34dee1..312c9c74b 100644--- a/packages/core/src/markdown/lint/config-files.ts+++ b/packages/core/src/markdown/lint/config-files.ts@@ -1,4 +1,3 @@-const MARKDOWNLINT_JSON_CONFIG_FILES: ReadonlySet<string> = new Set(['.markdownlint.json','.markdownlint.jsonc',diff --git a/packages/core/src/markdown/lint/config-schemas.ts b/packages/core/src/markdown/lint/config-schemas.tsindex e413367ef..0ba33b7d8 100644--- a/packages/core/src/markdown/lint/config-schemas.ts+++ b/packages/core/src/markdown/lint/config-schemas.ts@@ -38,7 +38,6 @@ const fullPluginShape = Object.fromEntries(LINT_PLUGINS.map((plugin) => [plugin.id, plugin.sliceSchema]),) as z.ZodRawShape;-export const LinterConfigSchema = z.object({enabled: z.boolean(),plugins: z.object(fullPluginShape),diff --git a/packages/core/src/markdown/lint/default-config.ts b/packages/core/src/markdown/lint/default-config.tsindex a51f2ffb0..d48eea5e4 100644--- a/packages/core/src/markdown/lint/default-config.ts+++ b/packages/core/src/markdown/lint/default-config.ts@@ -6,7 +6,6 @@ export const DEFAULT_MARKDOWNLINT_CONFIG: Record<string, MarkdownlintRuleSettingMD013: false,};-export function resolveMarkdownlintConfig(rules: Record<string, MarkdownlintRuleSetting> | undefined,): Configuration {diff --git a/packages/core/src/markdown/lint/frontmatter-schema-edit.ts b/packages/core/src/markdown/lint/frontmatter-schema-edit.tsindex 9c9542661..ef478e268 100644--- a/packages/core/src/markdown/lint/frontmatter-schema-edit.ts+++ b/packages/core/src/markdown/lint/frontmatter-schema-edit.ts@@ -1,4 +1,3 @@-import { CANONICAL_SCHEMA_DIALECT_URIS, DEFAULT_SCHEMA_DIALECT } from './frontmatter-validate.ts';export interface FrontmatterFieldConstraint {diff --git a/packages/core/src/markdown/lint/frontmatter-validate.ts b/packages/core/src/markdown/lint/frontmatter-validate.tsindex b96d19182..0d4c9a0df 100644--- a/packages/core/src/markdown/lint/frontmatter-validate.ts+++ b/packages/core/src/markdown/lint/frontmatter-validate.ts@@ -1,4 +1,3 @@-import Ajv, { type ValidateFunction } from 'ajv';import Ajv2019 from 'ajv/dist/2019.js';import Ajv2020 from 'ajv/dist/2020.js';diff --git a/packages/core/src/markdown/lint/index.ts b/packages/core/src/markdown/lint/index.tsindex 48d260ed6..00d08265a 100644--- a/packages/core/src/markdown/lint/index.ts+++ b/packages/core/src/markdown/lint/index.ts@@ -1,4 +1,3 @@-import { LINT_PLUGINS, type LinterConfig } from './plugins.ts';import type { LintDiagnostic } from './types.ts';diff --git a/packages/core/src/markdown/lint/plugins.ts b/packages/core/src/markdown/lint/plugins.tsindex be5871ed9..5e832aa19 100644--- a/packages/core/src/markdown/lint/plugins.ts+++ b/packages/core/src/markdown/lint/plugins.ts@@ -1,4 +1,3 @@-import { z } from 'zod';import { DEFAULT_MARKDOWNLINT_CONFIG, resolveMarkdownlintConfig } from './default-config.ts';import {@@ -14,7 +13,6 @@ import {type MarkdownlintSlice,} from './types.ts';-const MarkdownlintRuleSettingSchema = z.union([z.boolean(),z.enum(MARKDOWNLINT_RULE_SEVERITIES),diff --git a/packages/core/src/markdown/lint/types.ts b/packages/core/src/markdown/lint/types.tsindex 833c3a727..3918e657c 100644--- a/packages/core/src/markdown/lint/types.ts+++ b/packages/core/src/markdown/lint/types.ts@@ -1,4 +1,3 @@-export const LINT_PLUGIN_IDS = ['markdownlint', 'frontmatter'] as const;export type LintPluginId = (typeof LINT_PLUGIN_IDS)[number];@@ -72,7 +71,6 @@ export interface FrontmatterSlice {schemas: ResolvedFrontmatterSchemaEntry[];}-interface RuleOptionSpecBase {key: string;description: string;diff --git a/packages/core/src/markdown/lint/validation-counts.ts b/packages/core/src/markdown/lint/validation-counts.tsindex 437cc539a..98238656e 100644--- a/packages/core/src/markdown/lint/validation-counts.ts+++ b/packages/core/src/markdown/lint/validation-counts.ts@@ -1,4 +1,3 @@-export interface ValidationSourceCounts {errorCount: number;warningCount: number;diff --git a/packages/core/src/markdown/math-promoter.ts b/packages/core/src/markdown/math-promoter.tsindex bd79424c7..a5b511f25 100644--- a/packages/core/src/markdown/math-promoter.ts+++ b/packages/core/src/markdown/math-promoter.ts@@ -1,4 +1,3 @@-import type { Code, Root } from 'mdast';import type { Math as MdastMath } from 'mdast-util-math';import type { MdxJsxAttribute, MdxJsxFlowElement } from 'mdast-util-mdx';diff --git a/packages/core/src/markdown/mdast-to-hast-handlers.ts b/packages/core/src/markdown/mdast-to-hast-handlers.tsindex 00fbc0035..ed89371d0 100644--- a/packages/core/src/markdown/mdast-to-hast-handlers.ts+++ b/packages/core/src/markdown/mdast-to-hast-handlers.ts@@ -1,4 +1,3 @@-import type { Comment, Element, ElementContent, Properties } from 'hast';import type { FootnoteDefinition, FootnoteReference } from 'mdast';import type { MdxJsxFlowElement, MdxJsxTextElement } from 'mdast-util-mdx';diff --git a/packages/core/src/markdown/mdast-to-html.ts b/packages/core/src/markdown/mdast-to-html.tsindex df788a80d..8ce2b2492 100644--- a/packages/core/src/markdown/mdast-to-html.ts+++ b/packages/core/src/markdown/mdast-to-html.ts@@ -1,4 +1,3 @@-import type { Element, Root as HastRoot, Text as HastText } from 'hast';import type { Root as MdastRoot, Text as MdastText } from 'mdast';import type { Handler } from 'mdast-util-to-hast';diff --git a/packages/core/src/markdown/merged-walker.ts b/packages/core/src/markdown/merged-walker.tsindex fa3cfcd86..bfd7e3109 100644--- a/packages/core/src/markdown/merged-walker.ts+++ b/packages/core/src/markdown/merged-walker.ts@@ -1,4 +1,3 @@-import type { Nodes, Parent, Root } from 'mdast';import { SKIP, visit } from 'unist-util-visit';import type { VFile } from 'vfile';diff --git a/packages/core/src/markdown/mermaid-promoter.ts b/packages/core/src/markdown/mermaid-promoter.tsindex 17ed2b829..1a897fca8 100644--- a/packages/core/src/markdown/mermaid-promoter.ts+++ b/packages/core/src/markdown/mermaid-promoter.ts@@ -1,4 +1,3 @@-import type { Code, Root } from 'mdast';import type { MdxJsxAttribute, MdxJsxFlowElement } from 'mdast-util-mdx';import { visit } from 'unist-util-visit';diff --git a/packages/core/src/markdown/parse-with-fallback.ts b/packages/core/src/markdown/parse-with-fallback.tsindex 4aa0490c4..d988f4b8b 100644--- a/packages/core/src/markdown/parse-with-fallback.ts+++ b/packages/core/src/markdown/parse-with-fallback.ts@@ -168,7 +168,6 @@ export function parseRecursive(}}-interface VFilePlace {offset?: number;start?: { offset?: number };@@ -187,7 +186,6 @@ function extractErrorOffset(err: unknown): number | undefined {return undefined;}-interface Region {start: number;end: number;@@ -211,7 +209,6 @@ function nearestBlankLineAfter(src: string, offset: number): number | null {return null;}-export interface TagEvent {kind: 'open' | 'close' | 'self-close';name: string;@@ -358,7 +355,6 @@ function findFallbackRegion(src: string, errorOffset: number): Region {return { start: blockStart, end: blockEnd };}-interface SourceBlock {src: string;start: number;@@ -456,7 +452,6 @@ function tryPerBlockFallback(};}-function wholeDocRawText(source: string): JSONContent {return {type: 'doc',diff --git a/packages/core/src/markdown/parser-drop-closure.ts b/packages/core/src/markdown/parser-drop-closure.tsindex 43d420187..e6ab4fd57 100644--- a/packages/core/src/markdown/parser-drop-closure.ts+++ b/packages/core/src/markdown/parser-drop-closure.ts@@ -1,4 +1,3 @@-export type DroppedTokenAdjudication =| {kind: 'format-dof-axis';diff --git a/packages/core/src/markdown/pipeline.ts b/packages/core/src/markdown/pipeline.tsindex 5af2f05f5..449e6f12f 100644--- a/packages/core/src/markdown/pipeline.ts+++ b/packages/core/src/markdown/pipeline.ts@@ -1,4 +1,3 @@-import {type FromProseMirrorOptions,fromProseMirror,diff --git a/packages/core/src/markdown/position-aware-join.ts b/packages/core/src/markdown/position-aware-join.tsindex ccf06e94d..91cdf658f 100644--- a/packages/core/src/markdown/position-aware-join.ts+++ b/packages/core/src/markdown/position-aware-join.ts@@ -1,4 +1,3 @@-import type { Join } from 'mdast-util-to-markdown';import type { Position } from 'unist';import { isBlankLineParagraph } from './zero-emission-blocks.ts';diff --git a/packages/core/src/markdown/position-slice.ts b/packages/core/src/markdown/position-slice.tsindex e5b4c9eba..0f399d34c 100644--- a/packages/core/src/markdown/position-slice.ts+++ b/packages/core/src/markdown/position-slice.ts@@ -1,4 +1,3 @@-import type { Nodes, Root } from 'mdast';import { visit } from 'unist-util-visit';import type { VFile } from 'vfile';@@ -477,8 +476,7 @@ export function applyPositionSliceToNode(const first = source[startOff];if (first !== '[' && first !== '<' && !node.title) {node.data.sourceStyle = 'gfm-autolink';- }- else if (first === '[') {+ } else if (first === '[') {const slice = source.slice(startOff, endOff);const closeBracketIdx = slice.lastIndexOf('](');if (closeBracketIdx !== -1) {diff --git a/packages/core/src/markdown/rehype-plugins/skip-notion-whitespace.ts b/packages/core/src/markdown/rehype-plugins/skip-notion-whitespace.tsindex ca225ce9b..db10fa54b 100644--- a/packages/core/src/markdown/rehype-plugins/skip-notion-whitespace.ts+++ b/packages/core/src/markdown/rehype-plugins/skip-notion-whitespace.ts@@ -1,4 +1,3 @@-import type { Comment, Element, Root, Text } from 'hast';import type { Plugin } from 'unified';diff --git a/packages/core/src/markdown/rehype-plugins/strip-cocoa-meta.ts b/packages/core/src/markdown/rehype-plugins/strip-cocoa-meta.tsindex 3a2524a9a..34068d103 100644--- a/packages/core/src/markdown/rehype-plugins/strip-cocoa-meta.ts+++ b/packages/core/src/markdown/rehype-plugins/strip-cocoa-meta.ts@@ -1,4 +1,3 @@-import type { Element, ElementContent, Root } from 'hast';import type { Plugin } from 'unified';diff --git a/packages/core/src/markdown/rehype-plugins/strip-gdocs-wrapper.ts b/packages/core/src/markdown/rehype-plugins/strip-gdocs-wrapper.tsindex 2279a0189..93151d43b 100644--- a/packages/core/src/markdown/rehype-plugins/strip-gdocs-wrapper.ts+++ b/packages/core/src/markdown/rehype-plugins/strip-gdocs-wrapper.ts@@ -1,4 +1,3 @@-import type { Element, Root } from 'hast';import type { Plugin } from 'unified';diff --git a/packages/core/src/markdown/rehype-plugins/strip-github-hovercard.ts b/packages/core/src/markdown/rehype-plugins/strip-github-hovercard.tsindex a0f467c42..188f02d83 100644--- a/packages/core/src/markdown/rehype-plugins/strip-github-hovercard.ts+++ b/packages/core/src/markdown/rehype-plugins/strip-github-hovercard.ts@@ -1,4 +1,3 @@-import type { Element, Root } from 'hast';import type { Plugin } from 'unified';diff --git a/packages/core/src/markdown/rehype-plugins/strip-gmail-classes.ts b/packages/core/src/markdown/rehype-plugins/strip-gmail-classes.tsindex 4e8542a21..4ba2c3418 100644--- a/packages/core/src/markdown/rehype-plugins/strip-gmail-classes.ts+++ b/packages/core/src/markdown/rehype-plugins/strip-gmail-classes.ts@@ -1,4 +1,3 @@-import type { Element, Root } from 'hast';import type { Plugin } from 'unified';diff --git a/packages/core/src/markdown/rehype-plugins/strip-gsheets-wrapper.ts b/packages/core/src/markdown/rehype-plugins/strip-gsheets-wrapper.tsindex a3c96b24a..1a74b1272 100644--- a/packages/core/src/markdown/rehype-plugins/strip-gsheets-wrapper.ts+++ b/packages/core/src/markdown/rehype-plugins/strip-gsheets-wrapper.ts@@ -1,4 +1,3 @@-import type { Element, ElementContent, Root } from 'hast';import type { Plugin } from 'unified';diff --git a/packages/core/src/markdown/rehype-plugins/strip-mso-styles.ts b/packages/core/src/markdown/rehype-plugins/strip-mso-styles.tsindex e95cf43d6..de35e7b79 100644--- a/packages/core/src/markdown/rehype-plugins/strip-mso-styles.ts+++ b/packages/core/src/markdown/rehype-plugins/strip-mso-styles.ts@@ -1,4 +1,3 @@-import type { Comment, Element, ElementContent, Root } from 'hast';import type { Plugin } from 'unified';diff --git a/packages/core/src/markdown/rehype-plugins/strip-slack-classes.ts b/packages/core/src/markdown/rehype-plugins/strip-slack-classes.tsindex ffdb4d5b5..b4be1b2ea 100644--- a/packages/core/src/markdown/rehype-plugins/strip-slack-classes.ts+++ b/packages/core/src/markdown/rehype-plugins/strip-slack-classes.ts@@ -1,4 +1,3 @@-import type { Element, ElementContent, Root } from 'hast';import type { Plugin } from 'unified';diff --git a/packages/core/src/markdown/rehype-plugins/strip-vscode-spans.ts b/packages/core/src/markdown/rehype-plugins/strip-vscode-spans.tsindex e2a96d1a7..3c8d88b7c 100644--- a/packages/core/src/markdown/rehype-plugins/strip-vscode-spans.ts+++ b/packages/core/src/markdown/rehype-plugins/strip-vscode-spans.ts@@ -1,4 +1,3 @@-import type { Element, Root } from 'hast';import type { Plugin } from 'unified';diff --git a/packages/core/src/markdown/resolve-image-url.ts b/packages/core/src/markdown/resolve-image-url.tsindex 0389575ac..cf2c9da8e 100644--- a/packages/core/src/markdown/resolve-image-url.ts+++ b/packages/core/src/markdown/resolve-image-url.ts@@ -1,4 +1,3 @@-import { isRelativeUrl } from './safe-url.ts';function isDevDiagnosticContext(): boolean {diff --git a/packages/core/src/markdown/safe-url.ts b/packages/core/src/markdown/safe-url.tsindex 8be632ba4..4d3250d3a 100644--- a/packages/core/src/markdown/safe-url.ts+++ b/packages/core/src/markdown/safe-url.ts@@ -1,4 +1,3 @@-export const SAFE_URL_SCHEMES = ['https', 'http', 'mailto', 'tel', 'ftp', 'sms'] as const;const SCHEME_ALT = SAFE_URL_SCHEMES.map((s) => `${s}:`).join('|');diff --git a/packages/core/src/markdown/serialize-fidelity.test-helper.ts b/packages/core/src/markdown/serialize-fidelity.test-helper.tsindex 96304e7a5..0dd54070e 100644--- a/packages/core/src/markdown/serialize-fidelity.test-helper.ts+++ b/packages/core/src/markdown/serialize-fidelity.test-helper.ts@@ -1,4 +1,3 @@-import type { JSONContent } from '@tiptap/core';import type { Nodes } from 'mdast';import { expect } from 'vitest';diff --git a/packages/core/src/markdown/serialize-helpers.ts b/packages/core/src/markdown/serialize-helpers.tsindex 93798cf83..7cac5b042 100644--- a/packages/core/src/markdown/serialize-helpers.ts+++ b/packages/core/src/markdown/serialize-helpers.ts@@ -1,4 +1,3 @@-import type { Node as PmNode } from '@tiptap/pm/model';import type {MdxJsxAttribute,diff --git a/packages/core/src/markdown/single-dollar-math-promoter.ts b/packages/core/src/markdown/single-dollar-math-promoter.tsindex 8c08b7a04..b012a5aff 100644--- a/packages/core/src/markdown/single-dollar-math-promoter.ts+++ b/packages/core/src/markdown/single-dollar-math-promoter.ts@@ -1,4 +1,3 @@-import type { PhrasingContent, Root, Text } from 'mdast';import type { InlineMath } from 'mdast-util-math';import { SKIP, visit } from 'unist-util-visit';diff --git a/packages/core/src/markdown/to-markdown-handlers.ts b/packages/core/src/markdown/to-markdown-handlers.tsindex 959cc0bd2..3e79f8cb6 100644--- a/packages/core/src/markdown/to-markdown-handlers.ts+++ b/packages/core/src/markdown/to-markdown-handlers.ts@@ -1,4 +1,3 @@-import type { Nodes, Parents } from 'mdast';import type { MdxJsxAttribute, MdxJsxExpressionAttribute, MdxJsxFlowElement } from 'mdast-util-mdx';import type { Handle, Info, State } from 'mdast-util-to-markdown';diff --git a/packages/core/src/markdown/underline-promoter.ts b/packages/core/src/markdown/underline-promoter.tsindex 6e6d73400..0f1b0f27d 100644--- a/packages/core/src/markdown/underline-promoter.ts+++ b/packages/core/src/markdown/underline-promoter.ts@@ -1,4 +1,3 @@-import type { Nodes, Parent, Root } from 'mdast';import type { MdxJsxTextElement } from 'mdast-util-mdx';import { visit } from 'unist-util-visit';diff --git a/packages/core/src/markdown/unknown-mdast-guard.ts b/packages/core/src/markdown/unknown-mdast-guard.tsindex 932d7d2a8..1a082bda7 100644--- a/packages/core/src/markdown/unknown-mdast-guard.ts+++ b/packages/core/src/markdown/unknown-mdast-guard.ts@@ -1,4 +1,3 @@-import type { Root as MdastRoot } from 'mdast';import type { VFile } from 'vfile';diff --git a/packages/core/src/markdown/whitespace-char-ref.ts b/packages/core/src/markdown/whitespace-char-ref.tsindex ac9f5239b..d578476a7 100644--- a/packages/core/src/markdown/whitespace-char-ref.ts+++ b/packages/core/src/markdown/whitespace-char-ref.ts@@ -1,4 +1,3 @@-const INLINE_WHITESPACE_BY_CODE: ReadonlyMap<number, string> = new Map([[0x20, ' '],[0x09, '\t'],diff --git a/packages/core/src/markdown/wiki-link-micromark.ts b/packages/core/src/markdown/wiki-link-micromark.tsindex afd9936fe..6dad26200 100644--- a/packages/core/src/markdown/wiki-link-micromark.ts+++ b/packages/core/src/markdown/wiki-link-micromark.ts@@ -17,7 +17,6 @@ declare module 'micromark-util-types' {}}-const CODE_BANG = 33; // !const CODE_LBRACKET = 91; // [const CODE_RBRACKET = 93; // ]@@ -261,7 +260,6 @@ export function wikiLinkSyntax(): Extension {};}-function enterWikiLink(this: CompileContext, token: Token) {this.enter({@@ -387,7 +385,6 @@ export const wikiLinkToMarkdown: {unsafe: [{ character: '[', inConstruct: ['phrasing'] }],};-const MICROMARK_EXT = wikiLinkSyntax();export function remarkWikiLink(this: Processor) {