Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: sqliteai/sqlite-js
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 44528d0
Choose a base ref
...
head repository: sqliteai/sqlite-js
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 9923fe3
Choose a head ref
  • 2 commits
  • 7 files changed
  • 2 contributors

Commits on Nov 12, 2026

  1. fix(node): load the platform package from the ESM build (#21)

    * fix(node): load the platform package from the ESM build
    
    Importing @sqliteai/sqlite-js as an ES module always threw
    ExtensionNotFoundError claiming the platform package was not installed,
    even when it was. The loader used a bare `require`, which the ESM bundle
    replaces with a shim that throws "Dynamic require ... is not supported";
    an empty catch then swallowed that error.
    
    - Load the platform package through createRequire(import.meta.url),
      which works in both the ESM and the CommonJS builds.
    - Only treat MODULE_NOT_FOUND for the platform package itself as "not
      installed". Any other load error is now reported in the message and
      attached as `cause`, and a package without a valid binary path gets
      its own message.
    - Add a smoke test (npm run test:dist) that loads the built dist through
      both import and require against a stub platform package, and run it in
      the release job before publishing.
    
    * fix(node): keep CommonJS bundles of the ESM build working
    
    Resolving the platform package only through createRequire(import.meta.url)
    broke consumers that `import` the package and bundle to CommonJS: esbuild
    leaves import.meta empty, and webpack rewrites the call statically and
    then reports the package as not installed.
    
    Try `require` first, which exists at runtime in the CommonJS build and in
    any CommonJS bundle, and fall back to createRequire(import.meta.url) when
    `require` is unavailable (native ESM) or cannot find the package (webpack
    bundles of the CommonJS build). createRequire is reached through a
    namespace import so webpack leaves it alone, and it is skipped when a
    bundler left import.meta.url empty.
    
    The smoke test now also runs the consumers after bundling them with
    esbuild to CommonJS and ESM, and imports dist through a file URL so it
    works on Windows. esbuild is now an explicit devDependency, and
    ExtensionNotFoundError#cause is non-enumerable like the native one.
    
    * release: 1.4.1
    
    Bump SQLITE_JS_VERSION so merging releases the Node.js fix in this
    branch, and record it in the changelog. It is a patch release: the
    public API is unchanged, and the only difference users can observe
    besides the fix is the more precise ExtensionNotFoundError message.
    
    Package.swift is left alone, since the release job rewrites its URL and
    checksum once the assets exist.
    Gioee authored Nov 12, 2026
    Configuration menu
    Copy the full SHA
    126690b View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    9923fe3 View commit details
    Browse the repository at this point in the history
Loading