Skip to content

Migrate Admin UI plugins to native ESM and support local extension development - #717

Merged
pozylon merged 16 commits into
masterfrom
admin-ui-iife-esm
Sep 7, 2026
Merged

Migrate Admin UI plugins to native ESM and support local extension development#717
pozylon merged 16 commits into
masterfrom
admin-ui-iife-esm

Conversation

@Mikearaya

@Mikearaya Mikearaya commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Admin UI plugins now load as native ES modules through a shared browser import map. Plugin builds emit dist/index.js; Express and Fastify serve the plugin bundles and packaged SDK, preserve route-specific HTML, and support CSP nonces. Existing plugins must be rebuilt and their bundlePath changed from .global.js to .js.

Client projects can develop extensions against the prebuilt Admin UI package. Both Kitchensink examples build their local Bookmark Manager before backend startup and watch its source alongside the backend; refreshing the browser loads the rebuilt extension. The examples and SDK documentation describe setup and the distinction from developing the Admin UI through Next.js.

The change also validates plugin exports and SDK versions, keeps optional Admin UI dependencies lazy, adds runtime and HTML-routing tests, adjusts bookmark search input spacing, and includes the workspace's dependency lockfile refresh.

Validation: 729 unit tests pass; both Bookmark Manager builds pass; plugin watch rebuilding verified. Full Admin UI production build, including SDK bundles and TypeScript declarations, passes after merging the latest master.

CodeQL identified potentially expensive route-normalization regexes. Trailing slash removal now uses a linear scan, with regression coverage for long slash-heavy paths and mount prefixes. Targeted ESLint checks pass.

@Mikearaya
Mikearaya force-pushed the admin-ui-iife-esm branch from 8278c4c to 09e8221 Compare July 6, 2026 16:36
@Mikearaya
Mikearaya requested a review from pozylon July 7, 2026 10:11
@Mikearaya

Copy link
Copy Markdown
Contributor Author

Also added a sortOrder to nav items so that the plugin-injected side navigation items can be displayed anywhere in the side nav

@Mikearaya
Mikearaya removed the request for review from pozylon July 7, 2026 15:36
@Mikearaya
Mikearaya marked this pull request as draft July 7, 2026 15:36
@Mikearaya
Mikearaya force-pushed the admin-ui-iife-esm branch from 587599f to 339cd14 Compare July 7, 2026 20:31
@Mikearaya
Mikearaya marked this pull request as ready for review July 7, 2026 20:31
Comment thread packages/api/src/express/index.ts Fixed
@Mikearaya
Mikearaya requested a review from pozylon July 8, 2026 09:37
@Mikearaya

Mikearaya commented Jul 8, 2026

Copy link
Copy Markdown
Contributor Author

@pozylon I changed my mind on this.

Earlier, I was leaning toward the IIFE approach because it was simpler, and ESM kept running into issues I couldn't explain. But after digging deeper, those turned out to be a Next.js build/dev cache bug that affects the IIFE branch too. ESM was never the real issue.
What really changed my mind is the long-term maintenance. IIFE relies on manually keeping export lists in sync, which is easy to forget and only fails at runtime. ESM handles all of that automatically, and plugins can share the host's SDK instead of bundling their own copy.

IIFE is simpler to get started with, but I think ESM is simpler to live with. The migration is already done, please review and merge :)

@Mikearaya
Mikearaya force-pushed the admin-ui-iife-esm branch 2 times, most recently from 20908ef to d78021b Compare July 8, 2026 20:57
@Mikearaya
Mikearaya force-pushed the admin-ui-iife-esm branch 2 times, most recently from d27782d to b3be64f Compare September 2, 2026 11:07
@pozylon pozylon changed the title Change admin ui plugin from using IIFE to esm Migrate Admin UI plugins to native ESM and support local extension development Sep 7, 2026
Comment thread packages/api/src/adminUiPlugins.ts Fixed
@pozylon
pozylon merged commit 139b6a7 into master Sep 7, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants