From e28e04ade65ab8a656c848455f7a1e4fb5cc9fd8 Mon Sep 17 00:00:00 2001 From: neoxpert <18628980+neoxpert@users.noreply.github.com> Date: Wed, 3 Apr 2024 06:16:39 +0200 Subject: [PATCH 1/5] Support builds for Electron v29 (#1151) * update prebuild for latest abi versions * conditional build for Electron 29 and higher * add Electron 29 to prebuild versions --- .github/workflows/build.yml | 2 +- package.json | 2 +- src/better_sqlite3.cpp | 44 ++++++++++++++++++++++++------------- src/better_sqlite3.hpp | 10 +++++++-- src/util/macros.lzz | 22 +++++++++++++++++++ 5 files changed, 61 insertions(+), 19 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ca3ea9ee..e913d422 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -14,7 +14,7 @@ on: env: NODE_BUILD_CMD: npx --no-install prebuild -r node -t 18.0.0 -t 20.0.0 -t 21.0.0 --include-regex 'better_sqlite3.node$' - ELECTRON_BUILD_CMD: npx --no-install prebuild -r electron -t 16.0.0 -t 17.0.0 -t 18.0.0 -t 19.0.0 -t 20.0.0 -t 21.0.0 -t 22.0.0 -t 23.0.0 -t 24.0.0 -t 25.0.0 -t 26.0.0 -t 27.0.0 -t 28.0.0 --include-regex 'better_sqlite3.node$' + ELECTRON_BUILD_CMD: npx --no-install prebuild -r electron -t 16.0.0 -t 17.0.0 -t 18.0.0 -t 19.0.0 -t 20.0.0 -t 21.0.0 -t 22.0.0 -t 23.0.0 -t 24.0.0 -t 25.0.0 -t 26.0.0 -t 27.0.0 -t 28.0.0 -t 29.0.0 --include-regex 'better_sqlite3.node$' jobs: test: diff --git a/package.json b/package.json index e671d631..4e22835e 100644 --- a/package.json +++ b/package.json @@ -25,7 +25,7 @@ "fs-extra": "^11.1.1", "mocha": "^10.2.0", "nodemark": "^0.3.0", - "prebuild": "^12.0.0", + "prebuild": "^13.0.0", "sqlite": "^5.0.1", "sqlite3": "^5.1.6" }, diff --git a/src/better_sqlite3.cpp b/src/better_sqlite3.cpp index 0fe8ee22..4b93ab5f 100644 --- a/src/better_sqlite3.cpp +++ b/src/better_sqlite3.cpp @@ -2,7 +2,35 @@ // #include "better_sqlite3.hpp" -#line 161 "./src/util/macros.lzz" +#line 153 "./src/util/macros.lzz" +void SetPrototypeGetter( + v8::Isolate* isolate, + v8::Local data, + v8::Local recv, + const char* name, + v8::AccessorGetterCallback func +) { + v8::HandleScope scope(isolate); + + #if defined NODE_MODULE_VERSION && NODE_MODULE_VERSION < 121 + recv->InstanceTemplate()->SetAccessor( + InternalizedFromLatin1(isolate, name), + func, + 0, + data, + v8::AccessControl::DEFAULT, + v8::PropertyAttribute::None + ); + #else + recv->InstanceTemplate()->SetAccessor( + InternalizedFromLatin1(isolate, name), + func, + 0, + data + ); + #endif +} +#line 183 "./src/util/macros.lzz" #ifndef V8_COMPRESS_POINTERS_IN_SHARED_CAGE #define SAFE_NEW_BUFFER(env, data, length, finalizeCallback, finalizeHint) node::Buffer::New(env, data, length, finalizeCallback, finalizeHint) #else @@ -119,20 +147,6 @@ void SetPrototypeSymbolMethod (v8::Isolate * isolate, v8::Local d v8::FunctionTemplate::New(isolate, func, data, v8::Signature::New(isolate, recv)) ); } -#line 142 "./src/util/macros.lzz" -void SetPrototypeGetter (v8::Isolate * isolate, v8::Local data, v8::Local recv, char const * name, v8::AccessorGetterCallback func) -#line 148 "./src/util/macros.lzz" - { - v8::HandleScope scope(isolate); - recv->InstanceTemplate()->SetAccessor( - InternalizedFromLatin1(isolate, name), - func, - 0, - data, - v8::AccessControl::DEFAULT, - v8::PropertyAttribute::None - ); -} #line 4 "./src/util/constants.lzz" v8::Local CS::Code (v8::Isolate * isolate, int code) #line 4 "./src/util/constants.lzz" diff --git a/src/better_sqlite3.hpp b/src/better_sqlite3.hpp index 0c0bcfd0..736e8754 100644 --- a/src/better_sqlite3.hpp +++ b/src/better_sqlite3.hpp @@ -18,6 +18,14 @@ #include #line 31 "./src/util/macros.lzz" template using CopyablePersistent = v8::Persistent>; +#line 144 "./src/util/macros.lzz" +void SetPrototypeGetter( + v8::Isolate* isolate, + v8::Local data, + v8::Local recv, + const char* name, + v8::AccessorGetterCallback func +); #line 36 "./src/util/binder.lzz" static bool IsPlainObject(v8::Isolate* isolate, v8::Local obj); #define LZZ_INLINE inline @@ -53,8 +61,6 @@ v8::Local NewConstructorTemplate (v8::Isolate * isolate, void SetPrototypeMethod (v8::Isolate * isolate, v8::Local data, v8::Local recv, char const * name, v8::FunctionCallback func); #line 129 "./src/util/macros.lzz" void SetPrototypeSymbolMethod (v8::Isolate * isolate, v8::Local data, v8::Local recv, v8::Local symbol, v8::FunctionCallback func); -#line 142 "./src/util/macros.lzz" -void SetPrototypeGetter (v8::Isolate * isolate, v8::Local data, v8::Local recv, char const * name, v8::AccessorGetterCallback func); #line 1 "./src/util/constants.lzz" class CS { diff --git a/src/util/macros.lzz b/src/util/macros.lzz index 120be682..31b9850c 100644 --- a/src/util/macros.lzz +++ b/src/util/macros.lzz @@ -139,6 +139,17 @@ void SetPrototypeSymbolMethod( v8::FunctionTemplate::New(isolate, func, data, v8::Signature::New(isolate, recv)) ); } + +#hdr +void SetPrototypeGetter( + v8::Isolate* isolate, + v8::Local data, + v8::Local recv, + const char* name, + v8::AccessorGetterCallback func +); +#end +#src void SetPrototypeGetter( v8::Isolate* isolate, v8::Local data, @@ -147,6 +158,8 @@ void SetPrototypeGetter( v8::AccessorGetterCallback func ) { v8::HandleScope scope(isolate); + + #if defined NODE_MODULE_VERSION && NODE_MODULE_VERSION < 121 recv->InstanceTemplate()->SetAccessor( InternalizedFromLatin1(isolate, name), func, @@ -155,7 +168,16 @@ void SetPrototypeGetter( v8::AccessControl::DEFAULT, v8::PropertyAttribute::None ); + #else + recv->InstanceTemplate()->SetAccessor( + InternalizedFromLatin1(isolate, name), + func, + 0, + data + ); + #endif } +#end #src #ifndef V8_COMPRESS_POINTERS_IN_SHARED_CAGE From e7d0edbbfadaec3117d6ac29920aa5ce8e6b766c Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Wed, 3 Apr 2024 06:17:36 +0200 Subject: [PATCH 2/5] Keep GitHub Actions up to date with GitHub's Dependabot (#1165) Fixes warnings like at the bottom right of https://github.com/WiseLibs/better-sqlite3/actions/runs/7997686043 * https://docs.github.com/en/code-security/dependabot/working-with-dependabot/keeping-your-actions-up-to-date-with-dependabot * https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file#package-ecosystem --- .github/dependabot.yml | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 .github/dependabot.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 00000000..be006de9 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,13 @@ +# Keep GitHub Actions up to date with GitHub's Dependabot... +# https://docs.github.com/en/code-security/dependabot/working-with-dependabot/keeping-your-actions-up-to-date-with-dependabot +# https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file#package-ecosystem +version: 2 +updates: + - package-ecosystem: github-actions + directory: / + groups: + github-actions: + patterns: + - "*" # Group all Actions updates into a single larger pull request + schedule: + interval: weekly From ac8f293424e1e28a828e20a18c0bdb9cfafce004 Mon Sep 17 00:00:00 2001 From: Niklas Wenzel Date: Wed, 3 Apr 2024 06:18:37 +0200 Subject: [PATCH 3/5] Clarify error handling behavior for nested transactions in docs (#1160) --- docs/api.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/api.md b/docs/api.md index a5da1f53..29cf38d9 100644 --- a/docs/api.md +++ b/docs/api.md @@ -72,6 +72,8 @@ insertMany([ Transaction functions can be called from inside other transaction functions. When doing so, the inner transaction becomes a [savepoint](https://www.sqlite.org/lang_savepoint.html). +If an error is thrown inside of a nested transaction function, the nested transaction function will roll back to the state just before the savepoint and rethrow the error. If the error is not caught in the outer transaction function, this will cause the outer transaction function to roll back as well. + ```js const newExpense = db.prepare('INSERT INTO expenses (note, dollars) VALUES (?, ?)'); From 0374765fa6d0ace46d1baf54dcc09608d006ba32 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 2 Apr 2024 23:58:40 -0500 Subject: [PATCH 4/5] Bump the github-actions group with 4 updates (#1167) Bumps the github-actions group with 4 updates: [actions/checkout](https://github.com/actions/checkout), [actions/setup-node](https://github.com/actions/setup-node), [docker/setup-qemu-action](https://github.com/docker/setup-qemu-action) and [stefanzweifel/git-auto-commit-action](https://github.com/stefanzweifel/git-auto-commit-action). Updates `actions/checkout` from 3 to 4 - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/v3...v4) Updates `actions/setup-node` from 3 to 4 - [Release notes](https://github.com/actions/setup-node/releases) - [Commits](https://github.com/actions/setup-node/compare/v3...v4) Updates `docker/setup-qemu-action` from 1 to 3 - [Release notes](https://github.com/docker/setup-qemu-action/releases) - [Commits](https://github.com/docker/setup-qemu-action/compare/v1...v3) Updates `stefanzweifel/git-auto-commit-action` from 4 to 5 - [Release notes](https://github.com/stefanzweifel/git-auto-commit-action/releases) - [Changelog](https://github.com/stefanzweifel/git-auto-commit-action/blob/master/CHANGELOG.md) - [Commits](https://github.com/stefanzweifel/git-auto-commit-action/compare/v4...v5) --- updated-dependencies: - dependency-name: actions/checkout dependency-type: direct:production update-type: version-update:semver-major dependency-group: github-actions - dependency-name: actions/setup-node dependency-type: direct:production update-type: version-update:semver-major dependency-group: github-actions - dependency-name: docker/setup-qemu-action dependency-type: direct:production update-type: version-update:semver-major dependency-group: github-actions - dependency-name: stefanzweifel/git-auto-commit-action dependency-type: direct:production update-type: version-update:semver-major dependency-group: github-actions ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/build.yml | 4 ++-- .github/workflows/bump-version.yml | 4 ++-- .github/workflows/update-sqlite.yml | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e913d422..b95811ee 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -116,7 +116,7 @@ jobs: needs: publish steps: - uses: actions/checkout@v4 - - uses: docker/setup-qemu-action@v1 + - uses: docker/setup-qemu-action@v3 - run: | docker run --rm -v $(pwd):/tmp/project --entrypoint /bin/sh --platform linux/${{ matrix.arch }} node:16-alpine -c "\ apk add build-base git python3 py3-setuptools --update-cache && \ @@ -135,7 +135,7 @@ jobs: needs: publish steps: - uses: actions/checkout@v4 - - uses: docker/setup-qemu-action@v1 + - uses: docker/setup-qemu-action@v3 - run: | docker run --rm -v $(pwd):/tmp/project --entrypoint /bin/sh --platform linux/${{ matrix.arch }} node:16 -c "\ cd /tmp/project && \ diff --git a/.github/workflows/bump-version.yml b/.github/workflows/bump-version.yml index a91b2e4c..6c014fad 100644 --- a/.github/workflows/bump-version.yml +++ b/.github/workflows/bump-version.yml @@ -17,11 +17,11 @@ jobs: name: Bump to a new version runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: token: ${{ secrets.PAT }} fetch-depth: 0 - - uses: actions/setup-node@v3 + - uses: actions/setup-node@v4 with: node-version: 16 - name: Configure user diff --git a/.github/workflows/update-sqlite.yml b/.github/workflows/update-sqlite.yml index d02a9602..341d8d68 100644 --- a/.github/workflows/update-sqlite.yml +++ b/.github/workflows/update-sqlite.yml @@ -18,11 +18,11 @@ jobs: ENV_YEAR: ${{ github.event.inputs.year }} ENV_VERSION: ${{ github.event.inputs.version }} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: token: ${{ secrets.PAT }} fetch-depth: 0 - - uses: actions/setup-node@v3 + - uses: actions/setup-node@v4 with: node-version: 16 - name: Create new update branch @@ -35,7 +35,7 @@ jobs: - name: Download, compile and package SQLite run: npm run download - name: Push update branch - uses: stefanzweifel/git-auto-commit-action@v4 + uses: stefanzweifel/git-auto-commit-action@v5 with: commit_message: Update SQLite to version ${{ env.ENV_TRUE_VERSION }} branch: sqlite-update-${{ env.ENV_VERSION }} From 080f863bfa853f87f1488a17dbee58f9265407c6 Mon Sep 17 00:00:00 2001 From: JoshuaWise Date: Wed, 3 Apr 2024 05:00:04 +0000 Subject: [PATCH 5/5] 9.4.4 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 4e22835e..6a11c909 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "better-sqlite3", - "version": "9.4.3", + "version": "9.4.4", "description": "The fastest and simplest library for SQLite3 in Node.js.", "homepage": "http://github.com/WiseLibs/better-sqlite3", "author": "Joshua Wise ",