Skip to content

Beautiful, AI-native markdown IDE and LLM wiki

Give asset-embed e2e specs unique asset identities per test (#3284)

Nick Gomezf570bfc801b8
diff --git a/knip.config.ts b/knip.config.ts
index 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/meta/upload-fixtures.test.ts b/packages/app/tests/meta/upload-fixtures.test.ts
new file mode 100644
index 000000000..001c35095
--- /dev/null
+++ b/packages/app/tests/meta/upload-fixtures.test.ts
@@ -0,0 +1,51 @@
+import { describe, expect, test } from 'vitest';
+// Leaf modules, not the `_helpers` barrel: the barrel re-exports
+// Playwright-dependent helpers, which do not load under vitest.
+import { escapeRegExp } from '../stress/_helpers/regexp.ts';
+import { uniqueAssetName } from '../stress/_helpers/upload-fixtures.ts';
+
+describe('uniqueAssetName', () => {
+ test('inserts the runId before the final extension', () => {
+ expect(uniqueAssetName('shot.png', 'abc12345')).toBe('shot-abc12345.png');
+ });
+
+ test('appends the runId when the filename has no extension', () => {
+ expect(uniqueAssetName('README', 'abc12345')).toBe('README-abc12345');
+ });
+
+ test('salts before only the last extension segment of a multi-dot name', () => {
+ expect(uniqueAssetName('archive.tar.gz', 'abc12345')).toBe('archive.tar-abc12345.gz');
+ });
+});
+
+describe('escapeRegExp', () => {
+ test('an escaped dot matches only a literal dot', () => {
+ const re = new RegExp(`^${escapeRegExp('shot-abc.png')}$`);
+ expect(re.test('shot-abc.png')).toBe(true);
+ expect(re.test('shot-abcXpng')).toBe(false);
+ });
+
+ // Asserting only that the escaped pattern matches the string it was built
+ // from is a tautology for the characters that matter: an unescaped `.`
+ // still matches its own literal `.`, so the regression this helper exists
+ // to prevent would pass. Each metacharacter is probed with a NEAR-MISS —
+ // a string that differs only where the unescaped form would have matched
+ // anyway — so a dropped escape fails.
+ test.each([
+ ['.', 'a.b', 'aXb'],
+ ['*', 'ab*', 'abbb'],
+ ['+', 'ab+', 'abb'],
+ ['?', 'ab?', 'a'],
+ ['^', 'a^b', 'ab'],
+ ['$', 'a$b', 'ab'],
+ ['{}', 'a{2}', 'aa'],
+ ['()', 'a(b)', 'ab'],
+ ['|', 'a|b', 'a'],
+ ['[]', 'a[bc]', 'ab'],
+ ['\\', 'a\\db', 'a5b'],
+ ])('escapes %s so the pattern is literal, not a matcher', (_name, raw, nearMiss) => {
+ const re = new RegExp(`^${escapeRegExp(raw)}$`);
+ expect(re.test(raw)).toBe(true);
+ expect(re.test(nearMiss)).toBe(false);
+ });
+});
diff --git a/packages/app/tests/stress/_helpers/index.ts b/packages/app/tests/stress/_helpers/index.ts
index 0cb262faa..762a0ddfd 100644
--- a/packages/app/tests/stress/_helpers/index.ts
+++ b/packages/app/tests/stress/_helpers/index.ts
@@ -43,6 +43,7 @@ export {
type WaitForProviderOptions,
waitForActiveProviderSynced,
} from './provider.ts';
+export { escapeRegExp } from './regexp.ts';
export { matchIsWithinReadableScrollport } from './scrollport.ts';
export {
checkCollabSync,
@@ -67,4 +68,9 @@ export {
waitForSlashMenuOpen,
} from './slash-menu.ts';
export { blockMarker, generateTallDoc } from './tall-doc-fixture.ts';
-export { createMp3Buffer, createMp4Buffer, createPngBuffer } from './upload-fixtures.ts';
+export {
+ createMp3Buffer,
+ createMp4Buffer,
+ createPngBuffer,
+ uniqueAssetName,
+} from './upload-fixtures.ts';
diff --git a/packages/app/tests/stress/_helpers/regexp.ts b/packages/app/tests/stress/_helpers/regexp.ts
new file mode 100644
index 000000000..f2dc5e309
--- /dev/null
+++ b/packages/app/tests/stress/_helpers/regexp.ts
@@ -0,0 +1,24 @@
+/**
+ * Regex helpers shared across the stress suite.
+ *
+ * `escapeRegExp` lived in private copies across `sidebar.ts`,
+ * `showall-lazy-tree.e2e.ts`, `upload-fixtures.ts` (whose own header scopes it
+ * to "magic-byte buffers for upload e2e tests" — the wrong home for a general
+ * string primitive), and `graph-panel-surfaces.e2e.ts` under the near-miss name
+ * `escapeRegex`, which is why a grep for the canonical spelling missed it. One
+ * definition here, re-exported from the barrel.
+ *
+ * (A copy also exists in product code at
+ * `src/components/command-palette-search.ts`. Test helpers must not be
+ * imported from `src/`, so that one stays where it is.)
+ */
+
+/**
+ * Escape a string for embedding in a `RegExp`. Callers build patterns around
+ * filenames and labels that carry a literal `.` — unescaped, it matches any
+ * character, so an assertion meant to pin `shot-a3f9.png` would also accept
+ * `shot-a3f9Xpng`.
+ */
+export function escapeRegExp(value: string): string {
+ return value.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
+}
diff --git a/packages/app/tests/stress/_helpers/sidebar.ts b/packages/app/tests/stress/_helpers/sidebar.ts
index dd3c00307..650e76310 100644
--- a/packages/app/tests/stress/_helpers/sidebar.ts
+++ b/packages/app/tests/stress/_helpers/sidebar.ts
@@ -12,6 +12,7 @@
import type { Locator, Page } from '@playwright/test';
import { expect } from './fixtures.ts';
+import { escapeRegExp } from './regexp.ts';
/**
* Sidebar-scoped locator for the file-row button matching `name` exactly.
@@ -22,10 +23,6 @@ export function sidebarFileButton(page: Page, name: string): Locator {
return sidebar.getByText(name, { exact: true });
}
-function escapeRegExp(value: string): string {
- return value.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
-}
-
function sidebarTreeItem(page: Page, name: string): Locator {
return page
.locator('[data-slot="sidebar-container"]')
diff --git a/packages/app/tests/stress/_helpers/upload-fixtures.ts b/packages/app/tests/stress/_helpers/upload-fixtures.ts
index be0993719..6816dc59a 100644
--- a/packages/app/tests/stress/_helpers/upload-fixtures.ts
+++ b/packages/app/tests/stress/_helpers/upload-fixtures.ts
@@ -14,6 +14,28 @@
* with a no-op rename. Pass distinct salts when a test needs distinct uploads.
*/
+/**
+ * Per-test asset filename for the worker-shared `contentDir`.
+ *
+ * The `workerServer` fixture hands every spec on a worker the same
+ * `contentDir`, and uploads land in it keyed by filename. When a name is
+ * already taken by bytes that don't dedup, the upload takes a `-1`
+ * collision suffix (`linkTempToFinalWithCollisionRetry` in
+ * `server/src/upload-streaming.ts`), so a spec asserting on an exact asset
+ * path has to own a name no sibling spec can claim. Per-test docName
+ * isolation does not cover this — assets are keyed by filename, not by doc.
+ *
+ * Pass the same `runId` used for the test's docName. Pair with a matching
+ * `salt` on the byte fixtures below: a unique name still resolves to a
+ * sibling's file when the bytes are byte-identical and dedup hits.
+ */
+export function uniqueAssetName(filename: string, runId: string): string {
+ const dot = filename.lastIndexOf('.');
+ return dot === -1
+ ? `${filename}-${runId}`
+ : `${filename.slice(0, dot)}-${runId}${filename.slice(dot)}`;
+}
+
/** Minimal valid PNG (1×1 transparent pixel). `file-type` detects as image/png. */
export function createPngBuffer(salt?: string): Buffer {
const base = Buffer.from(
diff --git a/packages/app/tests/stress/asset-embed-real-fidelity.e2e.ts b/packages/app/tests/stress/asset-embed-real-fidelity.e2e.ts
index 0f5e553a1..6710f21bc 100644
--- a/packages/app/tests/stress/asset-embed-real-fidelity.e2e.ts
+++ b/packages/app/tests/stress/asset-embed-real-fidelity.e2e.ts
@@ -21,12 +21,18 @@
* Real Chromium, real bytes, real disk verification.
*/
-import { createHash } from 'node:crypto';
+import { createHash, randomUUID } from 'node:crypto';
import { readFileSync } from 'node:fs';
import { dirname, join } from 'node:path';
import { fileURLToPath } from 'node:url';
import type { Page } from '@playwright/test';
-import { expect, test, waitForActiveProviderSynced as waitForProvider } from './_helpers';
+import {
+ escapeRegExp,
+ expect,
+ test,
+ uniqueAssetName,
+ waitForActiveProviderSynced as waitForProvider,
+} from './_helpers';
const HELPERS_DIR = dirname(fileURLToPath(import.meta.url));
const FIXTURES_DIR = join(HELPERS_DIR, '_fixtures');
@@ -106,9 +112,24 @@ async function waitForDiskFile(
}
test.describe('asset-embed — real-fidelity byte-identity (QA-001/002/003/004/005/006/010)', () => {
+ // Per-test token shared by the docName and every asset name this test
+ // uploads. Uploads land in the worker-shared contentDir keyed by filename,
+ // so a hardcoded name is claimable by any sibling spec on the same worker —
+ // whoever loses gets a `-1` collision suffix and fails its exact-path
+ // assertion. The fixture bytes stay unsalted: they are distinct real files
+ // no other spec uploads, and each test asserts the on-disk sha256 against
+ // them. Unsalted bytes are `--repeat-each`-safe too, though not because of
+ // the worker hash: `repeatEachIndex` is a property of the TestCase, not of
+ // worker identity. Each repeat schedules as an independent test instance
+ // and the per-test `runId` below re-salts every filename, so no two repeats
+ // present the same name to same-dir dedup regardless of which worker runs
+ // them.
+ let runId: string;
+
test.beforeEach(async ({ page, api }) => {
// Create a fresh doc for each test so uploads co-locate predictably.
- const docName = `real-${Math.random().toString(36).slice(2, 10)}`;
+ runId = randomUUID().slice(0, 8);
+ const docName = `real-${runId}`;
await api.createPage(`${docName}.md`);
await api.replaceDoc(docName, '# Real\n');
await page.goto(`/#/${docName}`);
@@ -128,15 +149,16 @@ test.describe('asset-embed — real-fidelity byte-identity (QA-001/002/003/004/0
expect(pdf.subarray(0, 8).toString('utf8')).toBe('%PDF-1.4');
const expectedSha = sha256(pdf);
- await dropFileBytesIntoEditor(page, pdf, 'draft.pdf', 'application/pdf');
+ const pdfName = uniqueAssetName('draft.pdf', runId);
+ await dropFileBytesIntoEditor(page, pdf, pdfName, 'application/pdf');
// Y.Text assertion
await expect
.poll(async () => await getSourceText(page), { timeout: 10_000 })
- .toContain('![[draft.pdf]]');
+ .toContain(`![[${pdfName}]]`);
// Disk assertion — file lands co-located beside the doc (same dir as docName.md).
- const onDisk = await waitForDiskFile(workerServer.contentDir, 'draft.pdf');
+ const onDisk = await waitForDiskFile(workerServer.contentDir, pdfName);
expect(onDisk.length).toBe(pdf.length);
expect(sha256(onDisk)).toBe(expectedSha);
@@ -157,16 +179,17 @@ test.describe('asset-embed — real-fidelity byte-identity (QA-001/002/003/004/0
}) => {
const mp4 = readFileSync(join(FIXTURES_DIR, 'real-video.mp4'));
const expectedSha = sha256(mp4);
- await dropFileBytesIntoEditor(page, mp4, 'test.mp4', 'video/mp4');
+ const mp4Name = uniqueAssetName('test.mp4', runId);
+ await dropFileBytesIntoEditor(page, mp4, mp4Name, 'video/mp4');
await expect
.poll(async () => await getSourceText(page), { timeout: 10_000 })
- .toMatch(/<video\s+src="\/?test\.mp4"/);
+ .toMatch(new RegExp(`<video\\s+src="/?${escapeRegExp(mp4Name)}"`));
const text = await getSourceText(page);
// `controls={true}` matches the descriptor default — emit-time
// omit-on-default strips the attr; renderer applies the default at
// load. See `serialize-helpers.ts` reconstructAttrs.
expect(text).not.toMatch(/controls(=|\s|\/>|>)/);
- const onDisk = await waitForDiskFile(workerServer.contentDir, 'test.mp4');
+ const onDisk = await waitForDiskFile(workerServer.contentDir, mp4Name);
expect(sha256(onDisk)).toBe(expectedSha);
});
@@ -176,13 +199,14 @@ test.describe('asset-embed — real-fidelity byte-identity (QA-001/002/003/004/0
}) => {
const mp3 = readFileSync(join(FIXTURES_DIR, 'real-sound.mp3'));
const expectedSha = sha256(mp3);
- await dropFileBytesIntoEditor(page, mp3, 'test.mp3', 'audio/mpeg');
+ const mp3Name = uniqueAssetName('test.mp3', runId);
+ await dropFileBytesIntoEditor(page, mp3, mp3Name, 'audio/mpeg');
await expect
.poll(async () => await getSourceText(page), { timeout: 10_000 })
- .toMatch(/<audio\s+src="\/?test\.mp3"/);
+ .toMatch(new RegExp(`<audio\\s+src="/?${escapeRegExp(mp3Name)}"`));
const text = await getSourceText(page);
expect(text).not.toMatch(/controls(=|\s|\/>|>)/);
- const onDisk = await waitForDiskFile(workerServer.contentDir, 'test.mp3');
+ const onDisk = await waitForDiskFile(workerServer.contentDir, mp3Name);
expect(sha256(onDisk)).toBe(expectedSha);
});
@@ -192,17 +216,18 @@ test.describe('asset-embed — real-fidelity byte-identity (QA-001/002/003/004/0
}) => {
const zip = readFileSync(join(FIXTURES_DIR, 'real-archive.zip'));
const expectedSha = sha256(zip);
- await dropFileBytesIntoEditor(page, zip, 'archive.zip', 'application/zip');
+ const zipName = uniqueAssetName('archive.zip', runId);
+ await dropFileBytesIntoEditor(page, zip, zipName, 'application/zip');
await expect
.poll(async () => await getSourceText(page), { timeout: 10_000 })
- .toContain('archive.zip');
+ .toContain(zipName);
const text = await getSourceText(page);
// zip is a FILE_ATTACHMENT_EXTENSIONS member: drops route through
// pickInsertShape 'jsx-file' -> WikiEmbedFile, whose serialize emits the
// wiki-embed source bytes so the file persists as a File row, not an
// opaque markdown link.
- expect(text).toContain('![[archive.zip]]');
- const onDisk = await waitForDiskFile(workerServer.contentDir, 'archive.zip');
+ expect(text).toContain(`![[${zipName}]]`);
+ const onDisk = await waitForDiskFile(workerServer.contentDir, zipName);
expect(sha256(onDisk)).toBe(expectedSha);
});
@@ -221,7 +246,8 @@ test.describe('asset-embed — real-fidelity byte-identity (QA-001/002/003/004/0
expect(svg.toString('utf-8')).toContain('<script>');
const expectedSha = sha256(svg);
- await dropFileBytesIntoEditor(page, svg, 'xss.svg', 'image/svg+xml');
+ const svgName = uniqueAssetName('xss.svg', runId);
+ await dropFileBytesIntoEditor(page, svg, svgName, 'image/svg+xml');
// SVG is in IMAGE_EXTENSIONS — drops emit the canonical `<img>` JSX shape.
// The XSS payload is still the bytes-on-disk
// concern: render-time XSS protection is unchanged whether the chip
@@ -229,10 +255,10 @@ test.describe('asset-embed — real-fidelity byte-identity (QA-001/002/003/004/0
// the browser's <img> element which doesn't execute embedded <script>.
await expect
.poll(async () => await getSourceText(page), { timeout: 10_000 })
- .toMatch(/<img\s+src="\/?xss\.svg"/);
+ .toMatch(new RegExp(`<img\\s+src="/?${escapeRegExp(svgName)}"`));
// Byte-identical on disk (server stores verbatim — it's render-time that protects us).
- const onDisk = await waitForDiskFile(workerServer.contentDir, 'xss.svg');
+ const onDisk = await waitForDiskFile(workerServer.contentDir, svgName);
expect(sha256(onDisk)).toBe(expectedSha);
// WYSIWYG must NOT inject the SVG bytes as inline DOM. Image.tsx
@@ -264,15 +290,16 @@ test.describe('asset-embed — real-fidelity byte-identity (QA-001/002/003/004/0
}) => {
const csv = readFileSync(join(FIXTURES_DIR, 'real-data.csv'));
const expectedSha = sha256(csv);
- await dropFileBytesIntoEditor(page, csv, 'data.csv', 'text/csv');
+ const csvName = uniqueAssetName('data.csv', runId);
+ await dropFileBytesIntoEditor(page, csv, csvName, 'text/csv');
await expect
.poll(async () => await getSourceText(page), { timeout: 10_000 })
- .toContain('data.csv');
+ .toContain(csvName);
const text = await getSourceText(page);
// csv is a FILE_ATTACHMENT_EXTENSIONS member, so the drop serializes to the
// wiki-embed source bytes rather than a fall-through markdown link.
- expect(text).toContain('![[data.csv]]');
- const onDisk = await waitForDiskFile(workerServer.contentDir, 'data.csv');
+ expect(text).toContain(`![[${csvName}]]`);
+ const onDisk = await waitForDiskFile(workerServer.contentDir, csvName);
expect(sha256(onDisk)).toBe(expectedSha);
expect(onDisk.toString('utf-8')).toBe('name,age,city\nAlice,30,NYC\nBob,25,LA\n');
});
@@ -288,22 +315,23 @@ test.describe('asset-embed — real-fidelity byte-identity (QA-001/002/003/004/0
// the scenario was calibrated against that size and it's a
// realistic large-asset drop.
const docName = (page as unknown as { __docName: string }).__docName;
+ const binName = uniqueAssetName('big.bin', runId);
const payloadBytes = 24 * 1024 * 1024;
const resultJson = await page.evaluate(
- async ({ docName, size }: { docName: string; size: number }) => {
+ async ({ docName, size, fileName }: { docName: string; size: number; fileName: string }) => {
const bytes = new Uint8Array(size);
for (let i = 0; i < size; i++) bytes[i] = (i * 13) & 0xff;
const blob = new Blob([bytes], { type: 'application/octet-stream' });
const fd = new FormData();
fd.append('parentDocName', `${docName}.md`);
- fd.append('file', blob, 'big.bin');
+ fd.append('file', blob, fileName);
const t0 = performance.now();
const res = await fetch('/api/upload', { method: 'POST', body: fd });
const elapsedMs = performance.now() - t0;
const body = (await res.json()) as { src?: string; path?: string; deduped?: boolean };
return { status: res.status, body, elapsedMs, sentBytes: size };
},
- { docName, size: payloadBytes },
+ { docName, size: payloadBytes, fileName: binName },
);
expect(resultJson.status).toBe(200);
@@ -320,7 +348,7 @@ test.describe('asset-embed — real-fidelity byte-identity (QA-001/002/003/004/0
expect(resultJson.elapsedMs).toBeLessThan(10_000);
// Disk bytes are exactly what we sent, end-to-end.
- const onDisk = await waitForDiskFile(workerServer.contentDir, 'big.bin');
+ const onDisk = await waitForDiskFile(workerServer.contentDir, binName);
expect(onDisk.length).toBe(payloadBytes);
// Log as evidence — include the smoke ceiling
@@ -345,39 +373,44 @@ test.describe('asset-embed — real-fidelity byte-identity (QA-001/002/003/004/0
workerServer,
}) => {
// Image-extension drops emit `<img>` JSX. Dedup is asserted
- // against filename collision-suffix shape (no `shot-1.png`), not the
- // wikiembed text shape.
+ // against the filename collision-suffix shape (no `-1` collision
+ // variant — `collisionName`), not the wikiembed text shape.
const png = readFileSync(join(FIXTURES_DIR, 'real-shot.png'));
const expectedSha = sha256(png);
- await dropFileBytesIntoEditor(page, png, 'shot.png', 'image/png');
+ const pngName = uniqueAssetName('shot.png', runId);
+ // What the server would emit if the second drop failed to dedup and had
+ // to take a collision suffix instead.
+ const collisionName = pngName.replace(/\.png$/, '-1.png');
+ await dropFileBytesIntoEditor(page, png, pngName, 'image/png');
await expect
.poll(async () => await getSourceText(page), { timeout: 10_000 })
- .toMatch(/<img\s+src="\/?shot\.png"/);
+ .toMatch(new RegExp(`<img\\s+src="/?${escapeRegExp(pngName)}"`));
// Second drop with identical bytes
- await dropFileBytesIntoEditor(page, png, 'shot.png', 'image/png');
+ await dropFileBytesIntoEditor(page, png, pngName, 'image/png');
- // Two `<img …shot.png…>` tags should appear, BOTH pointing at shot.png
- // (not shot-1.png).
+ // Two `<img …>` tags should appear, BOTH pointing at `pngName`
+ // (not the `-1` collision variant).
await expect
.poll(
async () => {
const t = await getSourceText(page);
- return (t.match(/<img\s+[^>]*src="\/?shot\.png"/g) ?? []).length;
+ return (t.match(new RegExp(`<img\\s+[^>]*src="/?${escapeRegExp(pngName)}"`, 'g')) ?? [])
+ .length;
},
{ timeout: 10_000 },
)
.toBeGreaterThanOrEqual(2);
const text = await getSourceText(page);
- expect(text).not.toContain('shot-1.png');
+ expect(text).not.toContain(collisionName);
// Single file on disk, byte-exact.
- const onDisk = await waitForDiskFile(workerServer.contentDir, 'shot.png');
+ const onDisk = await waitForDiskFile(workerServer.contentDir, pngName);
expect(sha256(onDisk)).toBe(expectedSha);
// No collision-suffix file.
await expect(async () => {
- await waitForDiskFile(workerServer.contentDir, 'shot-1.png', 500);
+ await waitForDiskFile(workerServer.contentDir, collisionName, 500);
}).rejects.toThrow(/not found/);
});
});
diff --git a/packages/app/tests/stress/asset-embed.e2e.ts b/packages/app/tests/stress/asset-embed.e2e.ts
index 6c6795110..d2706c331 100644
--- a/packages/app/tests/stress/asset-embed.e2e.ts
+++ b/packages/app/tests/stress/asset-embed.e2e.ts
@@ -23,8 +23,10 @@ import { randomUUID } from 'node:crypto';
import type { Page } from '@playwright/test';
import {
createPngBuffer,
+ escapeRegExp,
expect,
test,
+ uniqueAssetName,
waitForActiveProviderSynced as waitForProvider,
} from './_helpers';
@@ -83,21 +85,25 @@ async function getSourceText(page: Page): Promise<string> {
}
const FAKE_PDF_HEADER = '%PDF-1.4\n%fake pdf bytes for e2e test\n';
-// 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 (asset-click-dispatch.e2e.ts and drop-pipeline-
-// auto-open.e2e.ts use the same base PNG payload). P3.1's same-bytes-twice
-// dedup assertion still holds because both drops in that test reuse this
-// same constant — intra-file collisions are exactly what dedup is supposed
-// to catch.
-const TINY_PNG = Array.from(createPngBuffer('asset-embed'));
test.describe('asset-embed — drop UX (SPEC §6 FR-1, FR-1a, FR-2, FR-8)', () => {
let docName: string;
+ // Per-test token shared by the docName and every asset this test uploads.
+ let runId: string;
+ let tinyPng: number[];
test.beforeEach(async ({ page, api }) => {
- docName = `asset-embed-${randomUUID().slice(0, 8)}`;
+ // 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. Each test therefore mints both a unique
+ // asset name (`uniqueAssetName`) and unique bytes (the `runId` salt).
+ // Within a single test the bytes stay identical, which is what P3.1's
+ // same-bytes-twice dedup assertion exercises.
+ runId = randomUUID().slice(0, 8);
+ docName = `asset-embed-${runId}`;
+ tinyPng = Array.from(createPngBuffer(`asset-embed-${runId}`));
await api.createPage(`${docName}.md`);
await api.replaceDoc(docName, '# Test\n');
await page.goto(`/#/${docName}`);
@@ -107,12 +113,13 @@ test.describe('asset-embed — drop UX (SPEC §6 FR-1, FR-1a, FR-2, FR-8)', () =
});
test('P1.1: drop a PDF → server stores + Y.Text contains ![[draft.pdf]]', async ({ page }) => {
- const pdfBytes = Array.from(Buffer.from(FAKE_PDF_HEADER, 'utf-8'));
- await dropFileIntoEditor(page, pdfBytes, 'draft.pdf', 'application/pdf');
+ const pdfName = uniqueAssetName('draft.pdf', runId);
+ const pdfBytes = Array.from(Buffer.from(`${FAKE_PDF_HEADER}%${runId}\n`, 'utf-8'));
+ await dropFileIntoEditor(page, pdfBytes, pdfName, 'application/pdf');
await expect
.poll(async () => await getSourceText(page), { timeout: 5_000 })
- .toContain('![[draft.pdf]]');
+ .toContain(`![[${pdfName}]]`);
});
test('P1.2: drop a CSV (FILE_ATTACHMENT_EXTENSIONS) → emits as ![[data.csv]] wikilink', async ({
@@ -128,12 +135,13 @@ test.describe('asset-embed — drop UX (SPEC §6 FR-1, FR-1a, FR-2, FR-8)', () =
//
// Truly-opaque extensions (NOT in any extension set, e.g. `.xyz`)
// still fall through to the plain markdown link emit.
- const csvBytes = Array.from(Buffer.from('a,b,c\n1,2,3\n', 'utf-8'));
- await dropFileIntoEditor(page, csvBytes, 'data.csv', 'text/csv');
+ const csvName = uniqueAssetName('data.csv', runId);
+ const csvBytes = Array.from(Buffer.from(`a,b,c\n1,2,3\n${runId},4,5\n`, 'utf-8'));
+ await dropFileIntoEditor(page, csvBytes, csvName, 'text/csv');
await expect
.poll(async () => await getSourceText(page), { timeout: 5_000 })
- .toContain('![[data.csv]]');
+ .toContain(`![[${csvName}]]`);
});
test('P3.1: same PNG dropped twice → second drop dedups, single file on disk', async ({
@@ -142,31 +150,38 @@ test.describe('asset-embed — drop UX (SPEC §6 FR-1, FR-1a, FR-2, FR-8)', () =
// Image-extension drops emit the OK-canonical `<img>` JSX shape —
// drag/drop/paste land on the same Image.tsx renderer as slash-menu
// insert + CommonMarkImage compat. On-disk markdown is
- // `<img src="/shot.png" />` (alt omitted on drop so the chrome-bar
+ // `<img src="/<pngName>" />` (alt omitted on drop so the chrome-bar
// gear nudge fires); dedup is asserted by the server returning the
- // same path for both drops (no `shot-1.png` collision-suffix).
- await dropFileIntoEditor(page, TINY_PNG, 'shot.png', 'image/png');
+ // same path for both drops (no `-1` collision-suffix — `collisionName`).
+ const pngName = uniqueAssetName('shot.png', runId);
+ // What the server would emit if the second drop failed to dedup and had
+ // to take a collision suffix instead.
+ const collisionName = pngName.replace(/\.png$/, '-1.png');
+
+ await dropFileIntoEditor(page, tinyPng, pngName, 'image/png');
await expect
.poll(async () => await getSourceText(page), { timeout: 5_000 })
- .toMatch(/<img\s+src="\/?shot\.png"/);
+ .toMatch(new RegExp(`<img\\s+src="/?${escapeRegExp(pngName)}"`));
// Second drop with identical bytes — server returns deduped:true and
// the filename in the second emit matches the existing on-disk file.
- await dropFileIntoEditor(page, TINY_PNG, 'shot.png', 'image/png');
+ await dropFileIntoEditor(page, tinyPng, pngName, 'image/png');
- // Two `<img …shot.png…>` tags appear after both inserts; both reference
+ // Two `<img …>` tags appear after both inserts; both reference
// the same filename (no collision-suffix). Counts the JSX shape.
await expect
.poll(
async () => {
const text = await getSourceText(page);
- return (text.match(/<img\s+[^>]*src="\/?shot\.png"/g) ?? []).length;
+ return (
+ text.match(new RegExp(`<img\\s+[^>]*src="/?${escapeRegExp(pngName)}"`, 'g')) ?? []
+ ).length;
},
{ timeout: 5_000 },
)
.toBeGreaterThanOrEqual(2);
const text = await getSourceText(page);
- expect(text).not.toContain('shot-1.png');
+ expect(text).not.toContain(collisionName);
});
test('P1.1-paste: paste a PNG via ClipboardEvent → Y.Text contains <img src=".../shot.png">', async ({
@@ -179,6 +194,12 @@ test.describe('asset-embed — drop UX (SPEC §6 FR-1, FR-1a, FR-2, FR-8)', () =
// break the dominant screenshot-paste workflow on macOS. The below
// synthesizes a paste event with a single PNG file, matching what
// Cmd+V produces when the clipboard contains a pasted image.
+ //
+ // The per-test name + salt matter for what this asserts: with the drop
+ // test's name and bytes, the paste would resolve to that test's existing
+ // file through same-dir dedup and pass without ever exercising a fresh
+ // paste-side store.
+ const pngName = uniqueAssetName('shot.png', runId);
await page.evaluate(
({ bytes, name, type }) => {
// Use the active editor (`window.__activeEditor.view.dom`) — see
@@ -199,12 +220,12 @@ test.describe('asset-embed — drop UX (SPEC §6 FR-1, FR-1a, FR-2, FR-8)', () =
}),
);
},
- { bytes: TINY_PNG, name: 'shot.png', type: 'image/png' },
+ { bytes: tinyPng, name: pngName, type: 'image/png' },
);
await expect
.poll(async () => await getSourceText(page), { timeout: 5_000 })
- .toMatch(/<img\s+src="\/?shot\.png"/);
+ .toMatch(new RegExp(`<img\\s+src="/?${escapeRegExp(pngName)}"`));
});
test('SVG drop emits as <img> JSX (image extension; NFR-3 sniff-fallback path)', async ({
@@ -214,12 +235,13 @@ test.describe('asset-embed — drop UX (SPEC §6 FR-1, FR-1a, FR-2, FR-8)', () =
// image/svg+xml so the file lands as an image. SVG is in
// IMAGE_EXTENSIONS so the drop routes through the canonical
// `<img>` JSX shape.
+ const svgName = uniqueAssetName('diagram.svg', runId);
const svgBytes = Array.from(
- Buffer.from('<svg xmlns="http://www.w3.org/2000/svg"><rect/></svg>', 'utf-8'),
+ Buffer.from(`<svg xmlns="http://www.w3.org/2000/svg"><rect id="${runId}"/></svg>`, 'utf-8'),
);
- await dropFileIntoEditor(page, svgBytes, 'diagram.svg', 'image/svg+xml');
+ await dropFileIntoEditor(page, svgBytes, svgName, 'image/svg+xml');
await expect
.poll(async () => await getSourceText(page), { timeout: 5_000 })
- .toMatch(/<img\s+src="\/?diagram\.svg"/);
+ .toMatch(new RegExp(`<img\\s+src="/?${escapeRegExp(svgName)}"`));
});
});
diff --git a/packages/app/tests/stress/graph-panel-surfaces.e2e.ts b/packages/app/tests/stress/graph-panel-surfaces.e2e.ts
index d41be281b..1ce7b20aa 100644
--- a/packages/app/tests/stress/graph-panel-surfaces.e2e.ts
+++ b/packages/app/tests/stress/graph-panel-surfaces.e2e.ts
@@ -1,6 +1,12 @@
import { randomUUID } from 'node:crypto';
import type { Page } from '@playwright/test';
-import { type ApiHelpers, expect, test, waitForGraphSimulationSettled } from './_helpers';
+import {
+ type ApiHelpers,
+ escapeRegExp,
+ expect,
+ test,
+ waitForGraphSimulationSettled,
+} from './_helpers';
type GraphHarness = {
clickDoc: (docName: string) => boolean;
@@ -31,10 +37,6 @@ interface GraphFixtures {
zeta: string;
}
-function escapeRegex(s: string): string {
- return s.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
-}
-
/**
* Seed four per-test unique graph fixtures. Returns the suffix-bearing
* docNames so tests can thread them through helpers and assertions. We do
@@ -332,7 +334,7 @@ test('fullscreen graph exposes Explore, Orphans, Hubs, and a visible orphan togg
await expect(orphanPanel.getByRole('button', { name: fixtures.beta })).toBeVisible();
await orphanPanel.getByRole('button', { name: fixtures.gamma }).click();
- await expect(page).toHaveURL(new RegExp(`#/${escapeRegex(fixtures.gamma)}$`));
+ await expect(page).toHaveURL(new RegExp(`#/${escapeRegExp(fixtures.gamma)}$`));
const hubsResponse = page.waitForResponse(
(response) => response.ok() && response.url().includes('/api/hubs?limit=50'),
@@ -343,7 +345,7 @@ test('fullscreen graph exposes Explore, Orphans, Hubs, and a visible orphan togg
const hubsPanel = page.locator('section').filter({ has: page.getByText('Top linked pages') });
await expect(hubsPanel.getByRole('button', { name: fixtures.beta })).toBeVisible();
await hubsPanel.getByRole('button', { name: fixtures.beta }).click();
- await expect(page).toHaveURL(new RegExp(`#/${escapeRegex(fixtures.beta)}$`));
+ await expect(page).toHaveURL(new RegExp(`#/${escapeRegExp(fixtures.beta)}$`));
});
test('fullscreen graph selects a document before explicitly opening it', async ({
@@ -357,7 +359,7 @@ test('fullscreen graph selects a document before explicitly opening it', async (
await waitForGraphNode(page, fixtures.beta);
expect(await clickGraphDoc(page, fixtures.beta)).toBe(true);
- await expect(page).toHaveURL(new RegExp(`#/${escapeRegex(fixtures.alpha)}$`));
+ await expect(page).toHaveURL(new RegExp(`#/${escapeRegExp(fixtures.alpha)}$`));
const selectedDoc = page.getByRole('status', { name: 'Selected graph item' });
await expect(selectedDoc).toBeVisible();
@@ -368,7 +370,7 @@ test('fullscreen graph selects a document before explicitly opening it', async (
await selectedDoc.getByRole('button', { name: 'Open' }).click();
await expect(getExpandedGraphIndicator(page)).toHaveCount(0);
- await expect(page).toHaveURL(new RegExp(`#/${escapeRegex(fixtures.beta)}#deep-link$`));
+ await expect(page).toHaveURL(new RegExp(`#/${escapeRegExp(fixtures.beta)}#deep-link$`));
});
test('fullscreen graph selecting the active document shows the already-open state', async ({
@@ -390,7 +392,7 @@ test('fullscreen graph selecting the active document shows the already-open stat
await selectedDoc.getByRole('button', { name: 'Open' }).click();
await expect(getExpandedGraphIndicator(page)).toHaveCount(0);
- await expect(page).toHaveURL(new RegExp(`#/${escapeRegex(fixtures.alpha)}$`));
+ await expect(page).toHaveURL(new RegExp(`#/${escapeRegExp(fixtures.alpha)}$`));
});
test('fullscreen graph background click clears selection', async ({ page, api, baseURL }) => {
@@ -569,5 +571,5 @@ test('docked graph clicks still navigate immediately with anchor-preserving hash
await openGraph(page, { docName: fixtures.alpha });
await waitForGraphNode(page, fixtures.beta);
expect(await clickGraphDoc(page, fixtures.beta)).toBe(true);
- await expect(page).toHaveURL(new RegExp(`#/${escapeRegex(fixtures.beta)}#deep-link$`));
+ await expect(page).toHaveURL(new RegExp(`#/${escapeRegExp(fixtures.beta)}#deep-link$`));
});
diff --git a/packages/app/tests/stress/showall-lazy-tree.e2e.ts b/packages/app/tests/stress/showall-lazy-tree.e2e.ts
index 244b30155..aa7ec6327 100644
--- a/packages/app/tests/stress/showall-lazy-tree.e2e.ts
+++ b/packages/app/tests/stress/showall-lazy-tree.e2e.ts
@@ -21,7 +21,7 @@
import { mkdirSync, readFileSync, writeFileSync } from 'node:fs';
import { join } from 'node:path';
import type { Page } from '@playwright/test';
-import { expect, test } from './_helpers';
+import { escapeRegExp, expect, test } from './_helpers';
/** Show All entry cap for this file's dedicated worker server. */
const SHOW_ALL_CAP = 25;
@@ -30,10 +30,6 @@ const OVERFLOW_CHILD_COUNT = SHOW_ALL_CAP + 5;
test.use({ workerServerEnv: { OK_SHOWALL_MAX_ENTRIES: String(SHOW_ALL_CAP) } });
-function escapeRegExp(value: string): string {
- return value.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
-}
-
function uniqueStamp(): string {
return `${Date.now().toString(36)}${Math.floor(Math.random() * 1e8).toString(36)}`;
}
diff --git a/packages/core/src/bridge/bind-frontmatter-doc.ts b/packages/core/src/bridge/bind-frontmatter-doc.ts
index 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.ts
index 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.ts
index 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.ts
index 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.ts
index 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.ts
index 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.ts
index 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.ts
index 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.ts
index 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.ts
index 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.ts
index 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.ts
index 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.ts
index 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.ts
index 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.ts
index 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.ts
index 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.ts
index 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.ts
index 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.ts
index 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.ts
index 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.ts
index 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.ts
index 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.ts
index 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): MdastRo
throw 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.ts
index 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.ts
index 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?: StructuralFreshnessChec
return 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.ts
index 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.ts
index 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.ts
index 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.ts
index 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, MarkdownlintRuleSetting
MD013: 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.ts
index 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.ts
index 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.ts
index 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.ts
index 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.ts
index 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.ts
index 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.ts
index 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.ts
index 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.ts
index 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.ts
index 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.ts
index 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.ts
index 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.ts
index 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.ts
index 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.ts
index 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.ts
index 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.ts
index 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.ts
index 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.ts
index 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.ts
index 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.ts
index 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.ts
index 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.ts
index 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.ts
index 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.ts
index 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.ts
index 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.ts
index 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.ts
index 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.ts
index 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.ts
index 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.ts
index 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.ts
index 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.ts
index 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.ts
index 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.ts
index 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) {