Repository navigation
feat(web): support static extension initializers - #1151
Merged
simolus3 merged 3 commits intoOct 19, 2026
Merged
Conversation
🦋 Changeset detectedLatest commit: 8029d57 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 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 |
simolus3
reviewed
Oct 16, 2026
akpor-kofi
marked this pull request as ready for review
October 16, 2026 15:42
simolus3
approved these changes
Oct 19, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Custom wa-sqlite builds can statically link extensions but need a way to call their exported initialization functions before opening connections. This adds
additionalInitializationFunctions, an optional array of exported function names, to the web database open options.The names are forwarded to local connections and database workers, including read-only workers. One ordered loop calls
powersync_init_staticfirst, then each additional no-argument export, and checks every return code beforeopen_v2. A nonzero return code from the core or an extension aborts initialization; absent exports also reject opening. The default makes no additional calls. The TSDoc describes the initialization contract. Website documentation is tracked separately in powersync-ja/powersync-docs#688.This follows @simolus3's suggested approach in powersync-ja/wa-sqlite#96. The consumer backport in https://github.com/nukoder-ng/nukodes/pull/155 on PowerSync Web 1.39.1 was validated with a decimal build exporting
decimal_init_static, using unmodified wa-sqlite startup code.Validation
tsc -b packages/webpasses, including common/shared-internals references.pnpm --filter @powersync/web buildalso passes, including the worker bundles.git diff --checkpass.pnpm lintcannot run in this checkout because theeslintexecutable is not installed; the repository also has no root ESLint configuration.Changelog / operational notes
@powersync/web. Core initialization failures now reject database opening, using the same return-code check as additional extensions.