Files
open-design/tools/pack/src
44350ad03c fix(packaging): serve baked plugin previews in the packaged app (#4035)
* fix(packaging): serve baked plugin previews in the packaged app

The packaged gallery fell back to live, GPU-expensive iframes instead of the
baked hover-pan clips, because of two gaps that only bite the packaged layout:

1. The baked-preview manifest (data/plugin-previews/manifest.json) was never
   bundled — it's absent from the packaged resource trees. The clips live on R2,
   but without the manifest the daemon has no plugin -> clip mapping.
2. Even bundled, the daemon resolved the manifest dir from PROJECT_ROOT. For the
   prebundled sidecar (Resources/app/prebundled/daemon) PROJECT_ROOT resolves to
   Resources/app — two levels up — which has no data/. The bundled resources
   actually live under OD_RESOURCE_ROOT (Resources/open-design), where every
   other tree (skills, plugins, design-systems…) is resolved from.

Fix both: add data/plugin-previews to BUNDLED_RESOURCE_TREES, and resolve
PLUGIN_PREVIEWS_DIR against DAEMON_RESOURCE_ROOT like the other resource dirs
(explicit OD_PLUGIN_PREVIEWS_DIR override + the dev PROJECT_ROOT layout still
win). Verified end-to-end: a freshly built+installed mac app's packaged daemon
now returns bakedPreview blocks for 126 plugins (R2 URLs) instead of none.

* test(tools-pack): assert the plugin-preview manifest is bundled

* test(daemon): cover packaged plugin-previews dir resolution from OD_RESOURCE_ROOT

Address review: extract resolveDaemonPluginPreviewsDir and prove it resolves the
bundled manifest under the resource root in the packaged layout (and falls back
to PROJECT_ROOT in dev). Also seed data/plugin-previews in the win-resources and
mac packager fixtures so copyBundledResourceTrees' new tree doesn't ENOENT.

* fix(daemon): resolve OD_PLUGIN_PREVIEWS_DIR override from the injected env

Address review: the override branch delegated to resolvePluginPreviewsDir, which
re-reads process.env — so an injected env was ignored and the override path was
untestable. Resolve it directly from env.OD_PLUGIN_PREVIEWS_DIR (absolute
passthrough, relative against projectRoot) and add an override test.

* fix(tools-pack): include plugin-previews in the Windows resource-tree cache key

Address review: adding data/plugin-previews to the bundled tree didn't feed the
Windows resource-tree cache key, so a builder with an existing cache entry would
reuse the old bundle without manifest.json. Hash data/plugin-previews into the
key, bump the cache schema version, and add a regression proving a manifest.json
change forces a cache miss.

---------

Co-authored-by: audit <a@b.c>
2026-06-10 07:45:52 +00:00
..