Skip to content

feat(zero-svelte): add Svelte integration package - #6090

Open
thomasmol wants to merge 13 commits into
rocicorp:mainfrom
thomasmol:feat/add-zero-svelte-package
Open

feat(zero-svelte): add Svelte integration package#6090
thomasmol wants to merge 13 commits into
rocicorp:mainfrom
thomasmol:feat/add-zero-svelte-package

Conversation

@thomasmol

@thomasmol thomasmol commented May 30, 2026

Copy link
Copy Markdown

Adds the zero-svelte package with context helpers, Query class, ViewStore, and Svelte-friendly bindings. Includes tests and Svelte plugin configuration.

Fixes https://bugs.rocicorp.dev/issue/3592

Just trying to get this working. Tested this package locally in a SvelteKit project and works OK so far

thomasmol added 2 commits May 30, 2026 15:48
Adds the zero-svelte package with context helpers, Query class,
ViewStore, and Svelte-friendly bindings. Includes tests and Svelte
plugin configuration. Exports Svelte integration from zero main package
as `zero/svelte`.
@vercel

vercel Bot commented May 30, 2026

Copy link
Copy Markdown

@thomasmol is attempting to deploy a commit to the Rocicorp Team on Vercel.

A member of the Team first needs to authorize it.

@socket-security

socket-security Bot commented May 30, 2026

Copy link
Copy Markdown

Warning

Review the following alerts detected in dependencies.

According to your organization's Security Policy, it is recommended to resolve "Warn" alerts. Learn more about Socket for GitHub.

Action Severity Alert  (click "▶" to expand/collapse)
Warn Critical
Critical CVE: Vitest Browser: Exposed Browser Mode API Can Proxy CDP and Overwrite Config Files, Leading to RCE in npm @vitest/browser

CVE: GHSA-g8mr-85jm-7xhm Vitest Browser: Exposed Browser Mode API Can Proxy CDP and Overwrite Config Files, Leading to RCE (CRITICAL)

Affected versions: >= 5.0.0-beta.0 < 5.0.0-beta.4; >= 4.0.0 < 4.1.8; >= 3.0.0 < 3.2.5

Patched version: 4.1.8

From: pnpm-lock.yamlnpm/vitest@4.1.7npm/@vitest/browser@4.1.7

ℹ Read more on: This package | This alert | What is a critical CVE?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Remove or replace dependencies that include known critical CVEs. Consumers can use dependency overrides or npm audit fix --force to remove vulnerable dependencies.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/@vitest/browser@4.1.7. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Warn High
Obfuscated code: npm @expo/cli is 90.0% likely obfuscated

Confidence: 0.90

Location: Package overview

From: pnpm-lock.yamlnpm/expo-sqlite@56.0.4npm/@expo/cli@56.1.13

ℹ Read more on: This package | This alert | What is obfuscated code?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Packages should not obfuscate their code. Consider not using packages with obfuscated code.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/@expo/cli@56.1.13. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Warn High
Obfuscated code: npm @internationalized/date is 90.0% likely obfuscated

Confidence: 0.90

Location: Package overview

From: pnpm-lock.yamlnpm/@headlessui/react@2.2.10npm/@internationalized/date@3.12.2

ℹ Read more on: This package | This alert | What is obfuscated code?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Packages should not obfuscate their code. Consider not using packages with obfuscated code.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/@internationalized/date@3.12.2. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Warn High
Obfuscated code: npm caniuse-lite is 90.0% likely obfuscated

Confidence: 0.90

Location: Package overview

From: pnpm-lock.yamlnpm/vite-plugin-svgr@5.2.0npm/vite-plugin-solid@2.11.12npm/@docusaurus/theme-search-algolia@3.10.1npm/expo-sqlite@56.0.4npm/@op-engineering/op-sqlite@16.2.0npm/postcss-preset-env@7.8.3npm/@docusaurus/types@3.9.2npm/@docusaurus/preset-classic@3.9.2npm/@docusaurus/core@3.9.2npm/caniuse-lite@1.0.30001793

ℹ Read more on: This package | This alert | What is obfuscated code?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Packages should not obfuscate their code. Consider not using packages with obfuscated code.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/caniuse-lite@1.0.30001793. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Warn High
Obfuscated code: npm caniuse-lite is 90.0% likely obfuscated

Confidence: 0.90

Location: Package overview

From: pnpm-lock.yamlnpm/vite-plugin-svgr@5.2.0npm/vite-plugin-solid@2.11.12npm/@docusaurus/theme-search-algolia@3.10.1npm/expo-sqlite@56.0.4npm/@op-engineering/op-sqlite@16.2.0npm/postcss-preset-env@7.8.3npm/@docusaurus/types@3.9.2npm/@docusaurus/preset-classic@3.9.2npm/@docusaurus/core@3.9.2npm/caniuse-lite@1.0.30001793

ℹ Read more on: This package | This alert | What is obfuscated code?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Packages should not obfuscate their code. Consider not using packages with obfuscated code.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/caniuse-lite@1.0.30001793. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Warn High
Obfuscated code: npm caniuse-lite is 90.0% likely obfuscated

Confidence: 0.90

Location: Package overview

From: pnpm-lock.yamlnpm/vite-plugin-svgr@5.2.0npm/vite-plugin-solid@2.11.12npm/@docusaurus/theme-search-algolia@3.10.1npm/expo-sqlite@56.0.4npm/@op-engineering/op-sqlite@16.2.0npm/postcss-preset-env@7.8.3npm/@docusaurus/types@3.9.2npm/@docusaurus/preset-classic@3.9.2npm/@docusaurus/core@3.9.2npm/caniuse-lite@1.0.30001793

ℹ Read more on: This package | This alert | What is obfuscated code?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Packages should not obfuscate their code. Consider not using packages with obfuscated code.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/caniuse-lite@1.0.30001793. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Warn High
Obfuscated code: npm caniuse-lite is 90.0% likely obfuscated

Confidence: 0.90

Location: Package overview

From: pnpm-lock.yamlnpm/vite-plugin-svgr@5.2.0npm/vite-plugin-solid@2.11.12npm/@docusaurus/theme-search-algolia@3.10.1npm/expo-sqlite@56.0.4npm/@op-engineering/op-sqlite@16.2.0npm/postcss-preset-env@7.8.3npm/@docusaurus/types@3.9.2npm/@docusaurus/preset-classic@3.9.2npm/@docusaurus/core@3.9.2npm/caniuse-lite@1.0.30001793

ℹ Read more on: This package | This alert | What is obfuscated code?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Packages should not obfuscate their code. Consider not using packages with obfuscated code.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/caniuse-lite@1.0.30001793. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Warn High
Obfuscated code: npm react-stately is 90.0% likely obfuscated

Confidence: 0.90

Location: Package overview

From: pnpm-lock.yamlnpm/@headlessui/react@2.2.10npm/react-stately@3.47.0

ℹ Read more on: This package | This alert | What is obfuscated code?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Packages should not obfuscate their code. Consider not using packages with obfuscated code.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/react-stately@3.47.0. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Warn High
Obfuscated code: npm webpack is 90.0% likely obfuscated

Confidence: 0.90

Location: Package overview

From: pnpm-lock.yamlnpm/@docusaurus/theme-search-algolia@3.10.1npm/@docusaurus/types@3.9.2npm/@docusaurus/preset-classic@3.9.2npm/@docusaurus/core@3.9.2npm/webpack@5.107.2

ℹ Read more on: This package | This alert | What is obfuscated code?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Packages should not obfuscate their code. Consider not using packages with obfuscated code.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/webpack@5.107.2. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

View full report

thomasmol added 5 commits May 30, 2026 16:02
test(tsnapi): add public API snapshot for zero-svelte
Expose schema getter instead of query and mutateBatch for clarity and alignment with Zero client API.
@arv

arv commented Jun 1, 2026

Copy link
Copy Markdown
Contributor

Thanks. This looks pretty great. I will have to review it in greater details.

FYI @stolinski

@thomasmol

Copy link
Copy Markdown
Author

Thank you! Let me know if it needs changes. It is indeed heavily based on https://github.com/stolinski/zero-svelte

Comment thread packages/zero-svelte/src/zero.ts
Comment thread packages/zero-svelte/src/bindings.ts
thomasmol and others added 3 commits June 13, 2026 14:07
Add reference counting to ViewWrapper so shared views are only torn down
after the last consumer is destroyed, and release the previous view when
Query.updateQuery switches queries.

Also rename zero-client.ts to zero.ts and update imports/tests, including
the useZero missing-context error message.
@thomasmol
thomasmol marked this pull request as ready for review June 24, 2026 12:30
@thomasmol
thomasmol requested a review from 0xcadams as a code owner June 24, 2026 12:30
@thomasmol

Copy link
Copy Markdown
Author

FYI for anyone looking for Svelte support with latest version of Zero, there is a workaround:

Add context.ts, query.svelte.ts and query.svelte.ts of this PR directly in your project in your lib folder (e.g. /src/lib/zero/...). You'll have to change the imports a bit to e.g. @rocicorp/zero/bindings and @rocicorp/zero. Create a client.ts like you would with https://github.com/stolinski/zero-svelte, and it should all work as expected.

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.

2 participants