Conceptssvelte-engine-ws

svelte-engine-ws

There are two trees whose names differ by two letters, and mixing them up is the fastest way to destroy a day of work. svelte-engine/ is the bootstrap template. It ships inside the svelte-d package (and, in this repository, as a git submodule). It contains the libwasm src-d/app.d root, the vibe.0 webserver/, the Vite + src-ts glue, and the Combo / ClickField / Panel goldens the printer is judged against. It is source-controlled. It is not your application.

svelte-engine-ws/ is the workspace. drop-ws copies the template there, file by file, skipping node_modules, .dub, build artifacts, and leftover slideshow files. Compile writes generated D, IR JSON, fallthrough.json, and the debug map into that copy. svelte-d wasm and svelte-d host run dub inside that copy. Vite serves from that copy. The workspace is generated. Do not admit it to the host ledger as if it were the template.

node_modules/svelte-d/svelte-engine   packaged bootstrap (or the submodule)
        │  drop-ws

./svelte-engine-ws                    project top-level by default
        src-d/          printed libwasm IR + passthrough goldens
        src-svelte/     ingested kit sources + engine Combo fixtures
        src-ts/         Vite + jsExports + __svelteD.ts
        webserver/      vibe.0 host
        public/         wasm + ingested static files
        .svelte-d/      IR cache, fallthrough.json, debug-map, wasm-ldc.json

The dest is chosen by svelte-d.config.ts workspace, then by “cwd looks like a kit project”, then by an existing sibling. This repository’s own config says ./svelte-engine-ws at the repo root. A consumer should do the same. Dropping into node_modules/svelte-d/svelte-engine-ws was an earlier default and is the wrong place for an application tree: it vanishes on the next bun install and it invites the compiler to treat the package as the project.

drop-ws never removes the workspace directory. It overlays the template: missing files are filled in; --force overwrites template-owned files so a new engine revision can land. Files you added (src-d/my-helper.d, a local dub.sdl tweak you then copied aside, extra public/ assets) stay. node_modules, .dub, .git, and .svelte-d are never deleted. On Windows a leftover Vite process can still lock a file; that file is skip-logged instead of failing the drop. Deleting svelte-engine-ws by hand is the only way the dest disappears — do not do that if you have customised it.

Passthrough files deserve a sentence of their own. src-d/pglite.d, probe.d, jshost.d, and the handwritten navbar.d have no Svelte source. They stay. The printer does not delete unknowns. Engine goldens (Combo*.svelte, Panel.svelte) stay so printer tests have an idiom library. Application trees — the admin routes you actually ship — belong in the project src/ and are ingested on compile. Putting an app route into the template is how the next consumer inherits your site.