feat: add standalone browser bundle - #261
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
@mridang must be a member of the zitadel team on Vercel to deploy. Learn more about collaboration on Vercel and other options here. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1ef2dc20d8
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
1ef2dc2 to
1f69531
Compare
1f69531 to
90b9e6a
Compare
There was a problem hiding this comment.
Pull request overview
This PR adds a new “standalone” browser-friendly build artifact for @zitadel/components, intended to be loadable directly from a plain HTML page via <script type="module" src=".../standalone.mjs">, while keeping the existing library build behavior unchanged for bundler-based consumers.
Changes:
- Extend the
tsdownbuild to produce an additional self-containeddist/standalone.mjsbundle with third-party runtime deps inlined. - Expose the standalone bundle via
package.json(./standaloneexport plusunpkg/jsdelivrentrypoints). - Add a changeset to publish this as a minor version update.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
packages/components/tsdown.config.ts |
Split build config into library vs. standalone builds; standalone inlines third-party deps. |
packages/components/package.json |
Add unpkg/jsdelivr fields and a new ./standalone export. |
.changeset/components-standalone-bundle.md |
Changeset describing the new standalone bundle as a minor feature. |
90b9e6a to
030daa9
Compare
Inline lit/liquidjs/dompurify/lucide into a single dist/standalone.mjs so the components load on a plain HTML page via <script type=module> with no import map. The library build is unchanged; exposed via the ./standalone export and unpkg/jsdelivr.
17cebc1 to
43f732a
Compare
Configure `<zitadel-login>` and `<zitadel-logout>` from HTML via `project-id`, `proxy-path`, and `url` attributes, so they work on a plain page with no JS and no `configureZitadel()`. The `project` property and the global config still win, in that order. Also fixes the standalone bundle from #261, which was built for Node and emitted an `import "node:module"` that browsers reject. It now builds for the browser, so `dist/standalone.mjs` loads as a plain module script. Verified with 150 unit tests and in a real browser.
This PR was opened by the [Changesets release](https://github.com/changesets/action) GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated.⚠️ ⚠️ ⚠️ ⚠️ ⚠️ ⚠️ `main` is currently in **pre mode** so this branch has prereleases rather than normal releases. If you want to exit prereleases, run `changeset pre exit` on `main`.⚠️ ⚠️ ⚠️ ⚠️ ⚠️ ⚠️ # Releases ## @zitadel/components@0.1.0-alpha.2 ### Minor Changes - [#266](#266) [`01aed1e`](01aed1e) Thanks [@mridang](https://github.com/mridang)! - Allow configuring `<zitadel-login>` and `<zitadel-logout>` declaratively from HTML via `project-id`, `proxy-path`, and `url` attributes, so the components work on a plain page without JS or `configureZitadel()`. Configuration resolves in this order, highest first: the `project` property, then the `configureZitadel()` global, then the HTML attributes. The existing JS paths still win — the attributes are the no-JS fallback. Also fix the standalone bundle so it loads in a browser: it was built for Node and emitted an `import "node:module"` that browsers cannot resolve. It is now built for the browser, so `dist/standalone.mjs` is genuinely self-contained. - [#261](#261) [`09aa2b1`](09aa2b1) Thanks [@mridang](https://github.com/mridang)! - Add a standalone browser bundle (`dist/standalone.mjs`) so the components work on a plain HTML page via `<script type="module">` with no import map or bundler. Exposed via the `./standalone` export and `unpkg`/`jsdelivr`. ### Patch Changes - [#231](#231) [`ce89c59`](ce89c59) Thanks [@bastionstack](https://github.com/bastionstack)! - Tidy the web components package: align README/AGENTS docs with the real SDK-config API, adopt idiomatic Lit patterns (`classMap`, `live()`, `ifDefined`, `@query`, a shared `emit()` helper), make post-step focus deterministic via `updateComplete` instead of `requestAnimationFrame`, centralise SDK/API resolution in a `resolveApi()` helper, correct the manifest registry (e.g. `zl-passkey` `method` attribute), and expand unit/browser test coverage. - [#253](#253) [`c097a5f`](c097a5f) Thanks [@vitorbari](https://github.com/vitorbari)! - Add English labels for the `givenName`, `familyName`, and `dateOfBirth` fields the default register step now collects. ## @zitadel/cli@0.1.0-alpha.2 ### Patch Changes - [#265](#265) [`ceb74d5`](ceb74d5) Thanks [@fforootd](https://github.com/fforootd)! - Derive alpha local runtime images from the installed CLI version, pin generated SDK dependencies to the same alpha train, and emit exact-version follow-up commands for reproducible tester reports. - [#255](#255) [`ca53f61`](ca53f61) Thanks [@fforootd](https://github.com/fforootd)! - Make doctor local-runtime checks advisory for cloud setup, harden fresh Next.js scaffolding, auto-install setup dependencies, normalize public follow-up commands, and avoid assuming Next.js in local-runtime setup guidance. - Updated dependencies [[`b0094f4`](b0094f4)]: - @zitadel/api@0.1.0-alpha.2 ## @zitadel/api@0.1.0-alpha.2 ### Patch Changes - [#268](#268) [`b0094f4`](b0094f4) Thanks [@mridang](https://github.com/mridang)! - Fix `configureZitadel()` so its state survives when more than one copy of `@zitadel/api/config` ends up loaded — the standalone components bundle inlines its own copy, and dual-package hazards / duplicate `node_modules` trees in a monorepo can load a second copy alongside the app's. Previously each module instance held its own `let currentProject`, so a `configureZitadel()` call in one was invisible to `getZitadelConfig()` in another and the components silently saw no config. The slot now lives on `globalThis` under a `Symbol.for(...)` key, which the global symbol registry resolves to the same symbol identity in every copy of the module evaluated in the same JS realm — separate realms (iframes, Node `vm` contexts, worker threads) still have their own registries. ## @zitadel/sdk-angular@0.1.0-alpha.2 ### Patch Changes - Updated dependencies [[`b0094f4`](b0094f4), [`ce89c59`](ce89c59), [`01aed1e`](01aed1e), [`09aa2b1`](09aa2b1), [`c097a5f`](c097a5f)]: - @zitadel/api@0.1.0-alpha.2 - @zitadel/components@0.1.0-alpha.2 ## @zitadel/sdk-next@0.1.0-alpha.2 ### Patch Changes - Updated dependencies [[`b0094f4`](b0094f4), [`ce89c59`](ce89c59), [`01aed1e`](01aed1e), [`09aa2b1`](09aa2b1), [`c097a5f`](c097a5f)]: - @zitadel/api@0.1.0-alpha.2 - @zitadel/components@0.1.0-alpha.2 - @zitadel/sdk-core@0.1.0-alpha.2 ## @zitadel/sdk-nuxt@0.1.0-alpha.2 ### Patch Changes - Updated dependencies [[`b0094f4`](b0094f4), [`ce89c59`](ce89c59), [`01aed1e`](01aed1e), [`09aa2b1`](09aa2b1), [`c097a5f`](c097a5f)]: - @zitadel/api@0.1.0-alpha.2 - @zitadel/components@0.1.0-alpha.2 - @zitadel/sdk-core@0.1.0-alpha.2 ## @zitadel/sdk-react@0.1.0-alpha.2 ### Patch Changes - Updated dependencies [[`b0094f4`](b0094f4), [`ce89c59`](ce89c59), [`01aed1e`](01aed1e), [`09aa2b1`](09aa2b1), [`c097a5f`](c097a5f)]: - @zitadel/api@0.1.0-alpha.2 - @zitadel/components@0.1.0-alpha.2 - @zitadel/sdk-core@0.1.0-alpha.2 ## @zitadel/sdk-vue@0.1.0-alpha.2 ### Patch Changes - Updated dependencies [[`b0094f4`](b0094f4), [`ce89c59`](ce89c59), [`01aed1e`](01aed1e), [`09aa2b1`](09aa2b1), [`c097a5f`](c097a5f)]: - @zitadel/api@0.1.0-alpha.2 - @zitadel/components@0.1.0-alpha.2 - @zitadel/sdk-core@0.1.0-alpha.2 ## @zitadel/sdk-core@0.1.0-alpha.2 Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Adds a single self-contained
standalone.mjsso the components work on a plain HTML page with just:No import map or bundler needed —
lit,liquidjs,dompurify, andlucideare bundled in. The normal@zitadel/componentsbuild is unchanged. Reachable via the./standaloneexport andunpkg/jsdelivr.