-
Notifications
You must be signed in to change notification settings - Fork 122
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
avoid top-level await; import npm:sql.js #1759
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any blocker left? It has a small merge conflict with #1734 but easy to solve (and tested 👍 )
Just want to clean up the sql.js shim if I can. |
The other thing I’m ruminating on is that this isn’t strictly a backwards-compatible change. Previously this would be equivalent to the import SQLite from "npm:@observablehq/sqlite"; Now, however, the explicit import gives you a promise. That’s kinda the same as long as you reference So… We’re kinda stuck with top-level await in the SQLite case if we want to maintain backwards compatibility. But maybe it’s okay to change the semantics slightly, especially if it’s rare and given that top-level await is broken in Safari? Maybe I should break out the DuckDB-Wasm changes since those don’t have the same concern. |
OK… I wouldn't worry too much about the slight change in API because… the default |
lgtm |
Ref. #1750. Avoids top-level await in our SQLite implementation. Also makes it so that importing
npm:sql.js
“just works” (by rewriting the code slightly from what is distributed via npm!). RemovesSQLite
from standard library (because there’s no way to support it without using top-level await) in favor of having people import sql.js directly or useSQLiteDatabaseClient
.Marking as draft because the hacky rewriting of sql.js should be cleaned up before merging.
Also we might also want to fix
DuckDBClient
? Anddot
? But I don’t thinkdot
is fixable without making it async…