fix(core): allow duplicate qwik via shared singletons#8609
Conversation
🦋 Changeset detectedLatest commit: c0af151 The changes in this PR will be included in the next version bump. This PR includes changesets to release 5 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
@qwik.dev/core
@qwik.dev/router
eslint-plugin-qwik
create-qwik
@qwik.dev/optimizer
commit: |
There was a problem hiding this comment.
Pull request overview
This PR refactors selected mutable runtime state into a version-aware global singleton registry so same-version Qwik copies can share state, primarily to support externalized third-party Qwik libraries on the server without tripping duplicate-runtime issues.
Changes:
- Added a new
shared/singletonsregistry onglobalThis.__qwik__and moved several runtime registries/state holders to use it. - Updated server/testing symbol resolution and build-time allowlists so the new singleton/version plumbing can be imported in server/optimizer builds.
- Added/updated tests and a changeset describing the shared-singleton behavior.
Reviewed changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| scripts/submodule-server.ts | Allows core/version imports in the server submodule build. |
| scripts/submodule-optimizer.ts | Allows core/version imports in the optimizer submodule build. |
| packages/qwik/src/testing/platform.ts | Switches test symbol lookup to the shared singleton registry. |
| packages/qwik/src/server/qwik-copy.ts | Re-exports the singleton accessor for server runtime code. |
| packages/qwik/src/server/platform.unit.ts | Updates server platform tests to use _regSymbol/new global state. |
| packages/qwik/src/server/platform.ts | Switches server symbol lookup/chunk mapping checks to shared singletons. |
| packages/qwik/src/core/use/use-locale.ts | Moves locale and async-local storage handles into singleton-backed state. |
| packages/qwik/src/core/shared/singletons.ts | Introduces the new global singleton registry and duplicate-version check. |
| packages/qwik/src/core/shared/serdes/inflate.ts | Moves deserialization loading state into the singleton registry. |
| packages/qwik/src/core/shared/serdes/deser-proxy.ts | Moves deserializer proxy cache into the singleton registry. |
| packages/qwik/src/core/shared/serdes/allocate.ts | Moves deserialization resolver/store-target maps into the singleton registry. |
| packages/qwik/src/core/shared/qrl/qrl.ts | Registers inline QRL symbols via the singleton-backed registry. |
| packages/qwik/src/core/shared/qrl/qrl-class.ts | Reads the singleton-backed deserialization loading state. |
| packages/qwik/src/core/index.ts | Replaces inline duplicate-import guard with singleton module side effect import. |
| .changeset/shared-singletons-global.md | Records the patch release note for shared global singletons. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
built with Refined Cloudflare Pages Action⚡ Cloudflare Pages Deployment
|
|
hmm _captures is also a singleton, we need to change it to a holder object |
Another step towards QwikDev/qwik-evolution#318