Phase 4e. - app.css holds only imports. Its rules moved into files beside their code, in the original cascade order. Dead rules of the deleted TipTap Writer are gone. - workbenchKeys.ts is one table of the workbench shortcuts. Workbench runs the commands. - session.linkTargets is the one link resolution for the link menu and for link opening. - Documents is a rune module (documents.svelte.ts). Workbench reads the tabs and the active path from it, without a copy of all buffers on each change. The editor mount effect now copies the buffer inside untrack, so an edit does not remount the editor. - Unit tests can import .svelte.ts modules through a Node module hook that compiles them with the Svelte compiler. pnpm check, pnpm test (350 of 350), and the full smoke suite pass, except tables/linkCaret, which failed one time under load and passed on retry and 3 of 3 times alone.
16 lines
874 B
JavaScript
16 lines
874 B
JavaScript
// Node module hooks for the unit tests. A `.svelte.ts` module uses Svelte runes, so the
|
|
// Svelte compiler compiles it after Node strips its types. The server output keeps the
|
|
// logic of `$state` fields as plain values, which is enough for tests without a DOM.
|
|
import { readFile } from "node:fs/promises";
|
|
import { stripTypeScriptTypes } from "node:module";
|
|
import { fileURLToPath } from "node:url";
|
|
import { compileModule } from "svelte/compiler";
|
|
|
|
export async function load(url, context, nextLoad) {
|
|
if (!url.startsWith("file:") || !url.endsWith(".svelte.ts")) return nextLoad(url, context);
|
|
const filename = fileURLToPath(url);
|
|
const source = stripTypeScriptTypes(await readFile(filename, "utf8"), { mode: "strip" });
|
|
const { js } = compileModule(source, { filename, generate: "server" });
|
|
return { format: "module", source: js.code, shortCircuit: true };
|
|
}
|