Repository navigation
feat(assets): embed directories with key prefixes and every Vite manifest output - #37
Merged
Merged
Conversation
…fest output - `-a <path>[=<key>]` accepts directories (recursive, POSIX keys under `<key>/`) and optional key remapping for files; fixes #6 - `-m` embeds each chunk's `css` and `assets` in addition to `file`, resolves paths from the Vite outDir (parent of `.vite/`), and only embeds the entry key when it exists as a build output - export `collectAssets`/`collectViteManifestAssets` from the library - CI smoke for both paths on all three platforms Closes #36 Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Contributor
Author
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
BYK
approved these changes
Sep 18, 2026
2 tasks
devin-ai-integration Bot
added a commit
to BYK/loreai
that referenced
this pull request
Sep 19, 2026
Released with BYK/fossilize#37 (directory assets with key prefixes). Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
BYK
added a commit
to BYK/loreai
that referenced
this pull request
Sep 19, 2026
## Summary Follow-up to #1831, stacked on its branch (retarget to `main` once #1831 lands). Pins `fossilize` to `0.11.0` (the release with BYK/fossilize#37) and uses its directory-asset embedding for the UI. `build-binary-sea.ts` stops enumerating the UI files for fossilize. The staged tree is copied to `<staging>/ui` and passed as one directory asset with a key prefix: ```ts // per target await fossilize({ assetManifest: manifestPath, // workers, model, vec0, ORT (unchanged) assets: [`${join(stagingDir, "ui")}=ui/`], // → SEA keys ui/<relative path> ... }, bundlePath); ``` so `ui/index.html`, `ui/assets/index-*.js.br`, `ui/ui-manifest.json`, … are embedded exactly as before and `src/ui-static.ts`'s `getRawAsset("ui/<path>")` is untouched. The `sharedManifest` UI loop and `UiAssetsResult.staged` (its only consumer) are removed; `--from-staging` stays self-contained since the copy lives inside the staging dir. The `.br`/`.gz` variants are still produced by `script/ui-assets.ts` and ride along in the directory — fossilize 0.11.0 does not precompress. Lockfile change is limited to the fossilize entry (same transitive deps as 0.10.1); `pnpm install --frozen-lockfile` accepts it. No effect on `dist/index.cjs` (17,478,460 B, unchanged from #1831) — only the SEA binary build path changes. Verified against the released `fossilize@0.11.0`: `build:binary:sea --platforms linux-x64` logs `Embedding 40 assets` (12 manifest + 27 `ui/` + `manifest.json`), `node scripts/ui-deep-link-smoke.mjs -- <binary>` passes from outside the repo, main JS served `content-encoding: br` (78,658 B) decodes to the 294,264 B identity file, `/ui/favicon.svg` (public asset) 200. `pnpm run typecheck` / `lint` / `format:check` clean. Part of #1797. Link to Devin session: https://app.devin.ai/sessions/5ac126b5d15542608f3dcaccc477ac32 Open in Devin Desktop: https://app.devin.ai/desktop/session/5ac126b5d15542608f3dcaccc477ac32?variant=devin Requested by: @BYK --------- Co-authored-by: Burak Yigit Kaya <madbyk@gmail.com> Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two gaps that made embedding a Vite-built UI need a hand-written asset map (BYK/loreai#1831 currently stages ~27 files and writes its own manifest for fossilize):
-aonly took files, keyed by the literal argument (Add support for asset directories #6).-monly embedded each chunk'sfile, so an HTML entry's CSS (css[]), imported static assets (assets[]) and the manifest's real location underdist/.vite/(Vite ≥ 5) were missed — spotlight only works because it setsbuild.manifest: "manifest.json".Asset resolution moves into
src/assets.ts(also exported from the library):Behaviour kept: file specs without
=keep the literal argument as key (-a asset.txt→getRawAsset("asset.txt")), the manifest is still embedded under its basename,-astill overrides-m. One deliberate change: theisEntrykey (e.g.index.html) is only embedded when<outDir>/<key>exists, instead of failing the build for JS entries whose key is a source path (src/main.ts).Not included from #36: built-in br/gzip precompression (consumers can precompress into the directory they pass to
-a) andnode:vfs(needs Node ≥ 26.4).Test plan
npm run build(tsc + tsup) clean-a assets-dir=data→ binary readsdata/a.txt+data/nested/b.txt;-m vite-dist/.vite/manifest.json→ binary readsindex.html, the JS chunk, its CSS and SVG via the embeddedmanifest.json-a asset.txtsmoke unchangedcollectAssets(["./assets-dir", "vite-dist=", "assets-dir/a.txt=x/y.txt", "vite-dist/assets=static/"])yields the expected normalized keysCloses #6, refs #36.
Link to Devin session: https://app.devin.ai/sessions/5ac126b5d15542608f3dcaccc477ac32
Open in Devin Desktop: https://app.devin.ai/desktop/session/5ac126b5d15542608f3dcaccc477ac32?variant=devin
Requested by: @BYK