From 8f58c26e273a07a9f51c7d5a4d465912eee4a5ff Mon Sep 17 00:00:00 2001 From: Silvertakana <62156548+silvertakana@users.noreply.github.com> Date: Fri, 29 May 2026 10:46:04 +1200 Subject: [PATCH 1/5] fix(sync): inline process.env, inlineDynamicImports, and CSS copy for local plugins (#201) * fix(sync): add process.env replacement, inlineDynamicImports, and CSS copy to syncToPublic - Inline replace-process-env Rollup plugin transforms process.env.NODE_ENV to "production" to prevent ReferenceError in browser bundles that lack a Node.js environment - Switch codeSplitting to inlineDynamicImports: true so the build produces a single self-contained ES module with no bare chunk specifiers that the browser cannot resolve - Add rollup-plugin-external-globals to remap shared host deps (react, cesium, zustand, SDK) to globalThis.__WWV_HOST__.* at bundle time - syncToPublic now copies any .css files emitted alongside the .mjs bundle (e.g. from gridstack or other CSS-importing libs) into public/plugins-local// * docs(plugin): add bundle footguns -- CSP/CSS, inlineDynamicImports, process.env, CORS --- .agents/rules/plugin-architecture.md | 93 ++++ pnpm-lock.yaml | 646 +++++++++++++++++++++++++++ scripts/sync-local-plugins.mjs | 23 +- 3 files changed, 760 insertions(+), 2 deletions(-) diff --git a/.agents/rules/plugin-architecture.md b/.agents/rules/plugin-architecture.md index 493caae4..057daa2f 100644 --- a/.agents/rules/plugin-architecture.md +++ b/.agents/rules/plugin-architecture.md @@ -486,3 +486,96 @@ Seeders in `wwv-data-engine/src/seeders/` provide the backend data. - **Cron Seeder**: Uses `registerSeeder({ name: "plugin-id", cron: "..." })` and pushes to Redis via `setLiveSnapshot()`. - **Init Seeder**: High-frequency or persistent websockets via `init: () => void`. - **Constraint**: Seeder `name` MUST exactly match the frontend plugin `id`. Do not bundle workspace dependencies like `ws` or `zod` into the seeder `dist`. + +--- + +## Plugin Bundle Footguns + +### 1. CSP blocks CDN stylesheets -- use `?inline` + `