@homeofthings/sqlite3 0.0.1-alpha0 → 6.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +25 -0
- package/README.md +209 -14
- package/binding.gyp +58 -0
- package/deps/common-sqlite.gypi +60 -0
- package/deps/extract.js +19 -0
- package/deps/sqlite-autoconf-3510300.tar.gz +0 -0
- package/deps/sqlite3.gyp +121 -0
- package/lib/sqlite3-binding.js +1 -0
- package/lib/sqlite3.d.ts +205 -0
- package/lib/sqlite3.js +207 -0
- package/lib/trace.js +38 -0
- package/package.json +82 -3
- package/src/async.h +76 -0
- package/src/backup.cc +418 -0
- package/src/backup.h +209 -0
- package/src/database.cc +751 -0
- package/src/database.h +188 -0
- package/src/gcc-preinclude.h +31 -0
- package/src/macros.h +207 -0
- package/src/node_sqlite3.cc +128 -0
- package/src/statement.cc +939 -0
- package/src/statement.h +246 -0
- package/src/threading.h +10 -0
- package/index.js +0 -1
package/LICENSE
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
Copyright (c) 2013-2026 Mapbox & Ghost Foundation
|
|
2
|
+
All rights reserved.
|
|
3
|
+
|
|
4
|
+
Redistribution and use in source and binary forms, with or without modification,
|
|
5
|
+
are permitted provided that the following conditions are met:
|
|
6
|
+
|
|
7
|
+
- Redistributions of source code must retain the above copyright notice, this
|
|
8
|
+
list of conditions and the following disclaimer.
|
|
9
|
+
- Redistributions in binary form must reproduce the above copyright notice, this
|
|
10
|
+
list of conditions and the following disclaimer in the documentation and/or
|
|
11
|
+
other materials provided with the distribution.
|
|
12
|
+
- Neither the name "MapBox" nor the names of its contributors may be
|
|
13
|
+
used to endorse or promote products derived from this software without
|
|
14
|
+
specific prior written permission.
|
|
15
|
+
|
|
16
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
17
|
+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
18
|
+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
19
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
|
20
|
+
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
21
|
+
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
22
|
+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
|
23
|
+
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
24
|
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
25
|
+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
package/README.md
CHANGED
|
@@ -1,26 +1,76 @@
|
|
|
1
|
-
#
|
|
1
|
+
# gms1/node-sqlite3
|
|
2
2
|
|
|
3
|
+
**Note:** This repository is forked from [TryGhost/node-sqlite3](https://github.com/TryGhost/node-sqlite3) which was marked as deprecated/unmaintained.
|
|
4
|
+
|
|
5
|
+
---
|
|
3
6
|
Asynchronous, non-blocking [SQLite3](https://sqlite.org/) bindings for [Node.js](http://nodejs.org/).
|
|
4
7
|
|
|
5
|
-
|
|
8
|
+
[](https://badge.fury.io/js/%40homeofthings%2Fsqlite3)
|
|
9
|
+
[](https://github.com/gms1/node-sqlite3/actions/workflows/ci.yml)
|
|
10
|
+
[](https://app.fossa.io/projects/git%2Bhttps%3A%2F%2Fgithub.com%2Fmapbox%2Fnode-sqlite3?ref=badge_shield)
|
|
11
|
+
[](https://nodejs.org/dist/latest/docs/api/n-api.html#n_api_n_api)
|
|
12
|
+
[](https://nodejs.org/dist/latest/docs/api/n-api.html#n_api_n_api)
|
|
13
|
+
|
|
14
|
+
# Features
|
|
15
|
+
|
|
16
|
+
- Straightforward query and parameter binding interface
|
|
17
|
+
- Full Buffer/Blob support
|
|
18
|
+
- Extensive [debugging support](https://github.com/gms1/node-sqlite3/wiki/Debugging)
|
|
19
|
+
- [Query serialization](https://github.com/gms1/node-sqlite3/wiki/Control-Flow) API
|
|
20
|
+
- [Extension support](https://github.com/gms1/node-sqlite3/wiki/API#databaseloadextensionpath-callback), including bundled support for the [json1 extension](https://www.sqlite.org/json1.html)
|
|
21
|
+
- Big test suite
|
|
22
|
+
- Written in modern C++ and tested for memory leaks
|
|
23
|
+
- Bundles SQLite v3.51.3, or you can build using a local SQLite
|
|
6
24
|
|
|
7
|
-
|
|
8
|
-
- Full Buffer/Blob support
|
|
9
|
-
- Extensive [debugging support](https://github.com/gms1/node-sqlite3/wiki/Debugging)
|
|
10
|
-
- [Query serialization](https://github.com/gms1/node-sqlite3/wiki/Control-Flow) API
|
|
11
|
-
- [Extension support](https://github.com/gms1/node-sqlite3/wiki/API#databaseloadextensionpath-callback)
|
|
25
|
+
# Installing
|
|
12
26
|
|
|
13
|
-
|
|
27
|
+
You can use [`npm`](https://github.com/npm/cli) or [`yarn`](https://github.com/yarnpkg/yarn) to install `@homeofthings/sqlite3`:
|
|
14
28
|
|
|
29
|
+
* (recommended) Latest published package:
|
|
15
30
|
```bash
|
|
16
31
|
npm install @homeofthings/sqlite3
|
|
17
32
|
# or
|
|
18
33
|
yarn add @homeofthings/sqlite3
|
|
19
34
|
```
|
|
35
|
+
* GitHub's `main` branch: `npm install https://github.com/gms1/node-sqlite3/tarball/main`
|
|
36
|
+
|
|
37
|
+
### Prebuilt binaries
|
|
38
|
+
|
|
39
|
+
`sqlite3` v5+ was rewritten to use [Node-API](https://nodejs.org/api/n-api.html) so prebuilt binaries do not need to be built for specific Node versions. `sqlite3` currently builds for both Node-API v3 and v6. Check the [Node-API version matrix](https://nodejs.org/api/n-api.html#node-api-version-matrix) to ensure your Node version supports one of these. The prebuilt binaries should be supported on Node v20.17.0+.
|
|
40
|
+
|
|
41
|
+
The module uses [`prebuild-install`](https://github.com/prebuild/prebuild-install) to download the prebuilt binary for your platform, if it exists. These binaries are hosted on GitHub Releases for `sqlite3` versions above 5.0.2, and they are hosted on S3 otherwise. The following targets are currently provided:
|
|
42
|
+
|
|
43
|
+
* `darwin-arm64`
|
|
44
|
+
* `darwin-x64`
|
|
45
|
+
* `linux-arm64`
|
|
46
|
+
* `linux-x64`
|
|
47
|
+
* `linuxmusl-arm64`
|
|
48
|
+
* `linuxmusl-x64`
|
|
49
|
+
* `win32-x64`
|
|
50
|
+
|
|
51
|
+
Unfortunately, [prebuild](https://github.com/prebuild/prebuild/issues/174) cannot differentiate between `armv6` and `armv7`, and instead uses `arm` as the `{arch}`. Until that is fixed, you will still need to install `sqlite3` from [source](#source-install).
|
|
52
|
+
|
|
53
|
+
Support for other platforms and architectures may be added in the future if CI supports building on them.
|
|
54
|
+
|
|
55
|
+
If your environment isn't supported, it'll use `node-gyp` to build SQLite, but you will need to install a C++ compiler and linker.
|
|
56
|
+
|
|
57
|
+
### Other ways to install
|
|
58
|
+
|
|
59
|
+
It is also possible to make your own build of `sqlite3` from its source instead of its npm package ([See below.](#source-install)).
|
|
20
60
|
|
|
21
|
-
|
|
61
|
+
The `sqlite3` module also works with [node-webkit](https://github.com/rogerwang/node-webkit) if node-webkit contains a supported version of Node.js engine. [(See below.)](#building-for-node-webkit)
|
|
22
62
|
|
|
23
|
-
|
|
63
|
+
SQLite's [SQLCipher extension](https://github.com/sqlcipher/sqlcipher) is also supported. [(See below.)](#building-for-sqlcipher)
|
|
64
|
+
|
|
65
|
+
# API
|
|
66
|
+
|
|
67
|
+
See the [API documentation](https://github.com/gms1/node-sqlite3/wiki/API) in the wiki.
|
|
68
|
+
|
|
69
|
+
# Usage
|
|
70
|
+
|
|
71
|
+
**Note:** the module must be [installed](#installing) before use.
|
|
72
|
+
|
|
73
|
+
``` js
|
|
24
74
|
const sqlite3 = require('@homeofthings/sqlite3').verbose();
|
|
25
75
|
const db = new sqlite3.Database(':memory:');
|
|
26
76
|
|
|
@@ -41,10 +91,155 @@ db.serialize(() => {
|
|
|
41
91
|
db.close();
|
|
42
92
|
```
|
|
43
93
|
|
|
44
|
-
## Source
|
|
94
|
+
## Source install
|
|
95
|
+
|
|
96
|
+
To skip searching for pre-compiled binaries, and force a build from source, use
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
npm install --build-from-source --sqlite=/usr/local
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
If building against an external sqlite3 make sure to have the development headers available. Mac OS X ships with these by default. If you don't have them installed, install the `-dev` package with your package manager, e.g. `apt-get install libsqlite3-dev` for Debian/Ubuntu. Make sure that you have at least `libsqlite3` >= 3.6.
|
|
103
|
+
|
|
104
|
+
Note, if building against homebrew-installed sqlite on OS X you can do:
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
npm install --build-from-source --sqlite=/usr/local/opt/sqlite/
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
## Custom file header (magic)
|
|
111
|
+
|
|
112
|
+
The default sqlite file header is "SQLite format 3". You can specify a different magic, though this will make standard tools and libraries unable to work with your files.
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
npm install --build-from-source --sqlite_magic="MyCustomMagic15"
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
Note that the magic *must* be exactly 15 characters long (16 bytes including null terminator).
|
|
119
|
+
|
|
120
|
+
## Building for node-webkit
|
|
121
|
+
|
|
122
|
+
Because of ABI differences, `sqlite3` must be built in a custom to be used with [node-webkit](https://github.com/rogerwang/node-webkit).
|
|
123
|
+
|
|
124
|
+
To build `sqlite3` for node-webkit:
|
|
125
|
+
|
|
126
|
+
1. Install [`nw-gyp`](https://github.com/rogerwang/nw-gyp) globally: `npm install nw-gyp -g` *(unless already installed)*
|
|
127
|
+
|
|
128
|
+
2. Build the module with the custom flags of `--runtime`, `--target_arch`, and `--target`:
|
|
129
|
+
|
|
130
|
+
```bash
|
|
131
|
+
NODE_WEBKIT_VERSION="0.8.6" # see latest version at https://github.com/rogerwang/node-webkit#downloads
|
|
132
|
+
npm install @homeofthings/sqlite3 --build-from-source --runtime=node-webkit --target_arch=ia32 --target=$(NODE_WEBKIT_VERSION)
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
You can also run this command from within a `@homeofthings/sqlite3` checkout:
|
|
136
|
+
|
|
137
|
+
```bash
|
|
138
|
+
npm install --build-from-source --runtime=node-webkit --target_arch=ia32 --target=$(NODE_WEBKIT_VERSION)
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
Remember the following:
|
|
142
|
+
|
|
143
|
+
* You must provide the right `--target_arch` flag. `ia32` is needed to target 32bit node-webkit builds, while `x64` will target 64bit node-webkit builds (if available for your platform).
|
|
144
|
+
|
|
145
|
+
* After the `sqlite3` package is built for node-webkit it cannot run in the vanilla Node.js (and vice versa).
|
|
146
|
+
* For example, `npm test` of the node-webkit's package would fail.
|
|
147
|
+
|
|
148
|
+
Visit the “[Using Node modules](https://github.com/rogerwang/node-webkit/wiki/Using-Node-modules)” article in the node-webkit's wiki for more details.
|
|
149
|
+
|
|
150
|
+
## Building for SQLCipher
|
|
151
|
+
|
|
152
|
+
For instructions on building SQLCipher, see [Building SQLCipher for Node.js](https://coolaj86.com/articles/building-sqlcipher-for-node-js-on-raspberry-pi-2/). Alternatively, you can install it with your local package manager.
|
|
153
|
+
|
|
154
|
+
To run against SQLCipher, you need to compile `sqlite3` from source by passing build options like:
|
|
155
|
+
|
|
156
|
+
```bash
|
|
157
|
+
npm install @homeofthings/sqlite3 --build-from-source --sqlite_libname=sqlcipher --sqlite=/usr/
|
|
158
|
+
|
|
159
|
+
node -e 'require("@homeofthings/sqlite3")'
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
If your SQLCipher is installed in a custom location (if you compiled and installed it yourself), you'll need to set some environment variables:
|
|
163
|
+
|
|
164
|
+
### On OS X with Homebrew
|
|
165
|
+
|
|
166
|
+
Set the location where `brew` installed it:
|
|
167
|
+
|
|
168
|
+
```bash
|
|
169
|
+
export LDFLAGS="-L`brew --prefix`/opt/sqlcipher/lib"
|
|
170
|
+
export CPPFLAGS="-I`brew --prefix`/opt/sqlcipher/include/sqlcipher"
|
|
171
|
+
npm install @homeofthings/sqlite3 --build-from-source --sqlite_libname=sqlcipher --sqlite=`brew --prefix`
|
|
172
|
+
|
|
173
|
+
node -e 'require("@homeofthings/sqlite3")'
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
### On most Linuxes (including Raspberry Pi)
|
|
177
|
+
|
|
178
|
+
Set the location where `make` installed it:
|
|
179
|
+
|
|
180
|
+
```bash
|
|
181
|
+
export LDFLAGS="-L/usr/local/lib"
|
|
182
|
+
export CPPFLAGS="-I/usr/local/include -I/usr/local/include/sqlcipher"
|
|
183
|
+
export CXXFLAGS="$CPPFLAGS"
|
|
184
|
+
npm install @homeofthings/sqlite3 --build-from-source --sqlite_libname=sqlcipher --sqlite=/usr/local --verbose
|
|
185
|
+
|
|
186
|
+
node -e 'require("@homeofthings/sqlite3")'
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
### Custom builds and Electron
|
|
190
|
+
|
|
191
|
+
Running `sqlite3` through [electron-rebuild](https://github.com/electron/electron-rebuild) does not preserve the SQLCipher extension, so some additional flags are needed to make this build Electron compatible. Your `npm install @homeofthings/sqlite3 --build-from-source` command needs these additional flags (be sure to replace the target version with the current Electron version you are working with):
|
|
192
|
+
|
|
193
|
+
```bash
|
|
194
|
+
npm install @homeofthings/sqlite3 --build-from-source --runtime=electron --target=18.2.1 --dist-url=https://electronjs.org/headers
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
In the case of MacOS with Homebrew, the command should look like the following:
|
|
198
|
+
|
|
199
|
+
```bash
|
|
200
|
+
npm install @homeofthings/sqlite3 --build-from-source --sqlite_libname=sqlcipher --sqlite=`brew --prefix` --runtime=electron --target=18.2.1 --dist-url=https://electronjs.org/headers
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
# Testing
|
|
204
|
+
|
|
205
|
+
```bash
|
|
206
|
+
npm test
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
# Contributors
|
|
210
|
+
|
|
211
|
+
* [Daniel Lockyer](https://github.com/daniellockyer)
|
|
212
|
+
* [Konstantin Käfer](https://github.com/kkaefer)
|
|
213
|
+
* [Dane Springmeyer](https://github.com/springmeyer)
|
|
214
|
+
* [Will White](https://github.com/willwhite)
|
|
215
|
+
* [Orlando Vazquez](https://github.com/orlandov)
|
|
216
|
+
* [Artem Kustikov](https://github.com/artiz)
|
|
217
|
+
* [Eric Fredricksen](https://github.com/grumdrig)
|
|
218
|
+
* [John Wright](https://github.com/mrjjwright)
|
|
219
|
+
* [Ryan Dahl](https://github.com/ry)
|
|
220
|
+
* [Tom MacWright](https://github.com/tmcw)
|
|
221
|
+
* [Carter Thaxton](https://github.com/carter-thaxton)
|
|
222
|
+
* [Audrius Kažukauskas](https://github.com/audriusk)
|
|
223
|
+
* [Johannes Schauer](https://github.com/pyneo)
|
|
224
|
+
* [Mithgol](https://github.com/Mithgol)
|
|
225
|
+
* [Kewde](https://github.com/kewde)
|
|
226
|
+
|
|
227
|
+
# Acknowledgments
|
|
228
|
+
|
|
229
|
+
Thanks to [Orlando Vazquez](https://github.com/orlandov),
|
|
230
|
+
[Eric Fredricksen](https://github.com/grumdrig) and
|
|
231
|
+
[Ryan Dahl](https://github.com/ry) for their SQLite bindings for node, and to mraleph on Freenode's #v8 for answering questions.
|
|
232
|
+
|
|
233
|
+
This module was originally created by [Mapbox](https://mapbox.com/) & is now maintained by [Ghost](https://ghost.org).
|
|
234
|
+
|
|
235
|
+
# Changelog
|
|
236
|
+
|
|
237
|
+
We use [GitHub releases](https://github.com/gms1/node-sqlite3/releases) for notes on the latest versions. See [CHANGELOG.md](https://github.com/gms1/node-sqlite3/blob/main/CHANGELOG.md) in git history for details on older versions.
|
|
238
|
+
|
|
239
|
+
# Copyright & license
|
|
45
240
|
|
|
46
|
-
|
|
241
|
+
Copyright (c) 2013-2026 Mapbox & Ghost Foundation
|
|
47
242
|
|
|
48
|
-
|
|
243
|
+
`node-sqlite3` is [BSD licensed](https://github.com/gms1/node-sqlite3/raw/main/LICENSE).
|
|
49
244
|
|
|
50
|
-
|
|
245
|
+
[](https://app.fossa.io/projects/git%2Bhttps%3A%2F%2Fgithub.com%2Fmapbox%2Fnode-sqlite3?ref=badge_large)
|
package/binding.gyp
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
{
|
|
2
|
+
"includes": [ "deps/common-sqlite.gypi" ],
|
|
3
|
+
"variables": {
|
|
4
|
+
"sqlite%":"internal",
|
|
5
|
+
"sqlite_libname%":"sqlite3",
|
|
6
|
+
"module_name": "node_sqlite3",
|
|
7
|
+
},
|
|
8
|
+
"targets": [
|
|
9
|
+
{
|
|
10
|
+
"target_name": "<(module_name)",
|
|
11
|
+
"cflags!": [ "-fno-exceptions" ],
|
|
12
|
+
"cflags_cc!": [ "-fno-exceptions" ],
|
|
13
|
+
"xcode_settings": { "GCC_ENABLE_CPP_EXCEPTIONS": "YES",
|
|
14
|
+
"CLANG_CXX_LIBRARY": "libc++",
|
|
15
|
+
"MACOSX_DEPLOYMENT_TARGET": "10.7",
|
|
16
|
+
},
|
|
17
|
+
"msvs_settings": {
|
|
18
|
+
"VCCLCompilerTool": { "ExceptionHandling": 1 },
|
|
19
|
+
},
|
|
20
|
+
"include_dirs": [
|
|
21
|
+
"<!@(node -p \"require('node-addon-api').include\")"],
|
|
22
|
+
"conditions": [
|
|
23
|
+
["sqlite != 'internal'", {
|
|
24
|
+
"include_dirs": [
|
|
25
|
+
"<!@(node -p \"require('node-addon-api').include\")", "<(sqlite)/include" ],
|
|
26
|
+
"libraries": [
|
|
27
|
+
"-l<(sqlite_libname)"
|
|
28
|
+
],
|
|
29
|
+
"conditions": [
|
|
30
|
+
[ "OS=='linux'", {"libraries+":["-Wl,-rpath=<@(sqlite)/lib"]} ],
|
|
31
|
+
[ "OS!='win'", {"libraries+":["-L<@(sqlite)/lib"]} ]
|
|
32
|
+
],
|
|
33
|
+
'msvs_settings': {
|
|
34
|
+
'VCLinkerTool': {
|
|
35
|
+
'AdditionalLibraryDirectories': [
|
|
36
|
+
'<(sqlite)/lib'
|
|
37
|
+
],
|
|
38
|
+
},
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"dependencies": [
|
|
43
|
+
"<!(node -p \"require('node-addon-api').gyp\")",
|
|
44
|
+
"deps/sqlite3.gyp:sqlite3"
|
|
45
|
+
]
|
|
46
|
+
}
|
|
47
|
+
]
|
|
48
|
+
],
|
|
49
|
+
"sources": [
|
|
50
|
+
"src/backup.cc",
|
|
51
|
+
"src/database.cc",
|
|
52
|
+
"src/node_sqlite3.cc",
|
|
53
|
+
"src/statement.cc"
|
|
54
|
+
],
|
|
55
|
+
"defines": [ "NAPI_VERSION=<(napi_build_version)", "NAPI_DISABLE_CPP_EXCEPTIONS=1" ]
|
|
56
|
+
}
|
|
57
|
+
]
|
|
58
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
{
|
|
2
|
+
'variables': {
|
|
3
|
+
'sqlite_version%':'3510300',
|
|
4
|
+
"toolset%":'',
|
|
5
|
+
},
|
|
6
|
+
'target_defaults': {
|
|
7
|
+
'default_configuration': 'Release',
|
|
8
|
+
'conditions': [
|
|
9
|
+
[ 'toolset!=""', {
|
|
10
|
+
'msbuild_toolset':'<(toolset)'
|
|
11
|
+
}]
|
|
12
|
+
],
|
|
13
|
+
'configurations': {
|
|
14
|
+
'Debug': {
|
|
15
|
+
'defines!': [
|
|
16
|
+
'NDEBUG'
|
|
17
|
+
],
|
|
18
|
+
'cflags_cc!': [
|
|
19
|
+
'-O3',
|
|
20
|
+
'-Os',
|
|
21
|
+
'-DNDEBUG'
|
|
22
|
+
],
|
|
23
|
+
'xcode_settings': {
|
|
24
|
+
'OTHER_CPLUSPLUSFLAGS!': [
|
|
25
|
+
'-O3',
|
|
26
|
+
'-Os',
|
|
27
|
+
'-DDEBUG'
|
|
28
|
+
],
|
|
29
|
+
'GCC_OPTIMIZATION_LEVEL': '0',
|
|
30
|
+
'GCC_GENERATE_DEBUGGING_SYMBOLS': 'YES'
|
|
31
|
+
},
|
|
32
|
+
'msvs_settings': {
|
|
33
|
+
'VCCLCompilerTool': {
|
|
34
|
+
'ExceptionHandling': 1, # /EHsc
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
'Release': {
|
|
39
|
+
'defines': [
|
|
40
|
+
'NDEBUG'
|
|
41
|
+
],
|
|
42
|
+
'xcode_settings': {
|
|
43
|
+
'OTHER_CPLUSPLUSFLAGS!': [
|
|
44
|
+
'-Os',
|
|
45
|
+
'-O2'
|
|
46
|
+
],
|
|
47
|
+
'GCC_OPTIMIZATION_LEVEL': '3',
|
|
48
|
+
'GCC_GENERATE_DEBUGGING_SYMBOLS': 'NO',
|
|
49
|
+
'DEAD_CODE_STRIPPING': 'YES',
|
|
50
|
+
'GCC_INLINES_ARE_PRIVATE_EXTERN': 'YES'
|
|
51
|
+
},
|
|
52
|
+
'msvs_settings': {
|
|
53
|
+
'VCCLCompilerTool': {
|
|
54
|
+
'ExceptionHandling': 1, # /EHsc
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
package/deps/extract.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
const tar = require("tar");
|
|
2
|
+
const fs = require("fs");
|
|
3
|
+
const path = require("path");
|
|
4
|
+
const tarball = path.resolve(process.argv[2]);
|
|
5
|
+
const dirname = path.resolve(process.argv[3]);
|
|
6
|
+
|
|
7
|
+
tar.extract({
|
|
8
|
+
sync: true,
|
|
9
|
+
file: tarball,
|
|
10
|
+
cwd: dirname,
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
// SQLite >= 3.49 ships a VERSION file that conflicts with the C++20 <version>
|
|
14
|
+
// header on case-insensitive filesystems (macOS/Windows).
|
|
15
|
+
const base = path.basename(tarball, ".tar.gz");
|
|
16
|
+
const versionFile = path.join(dirname, base, "VERSION");
|
|
17
|
+
if (fs.existsSync(versionFile)) {
|
|
18
|
+
fs.unlinkSync(versionFile);
|
|
19
|
+
}
|
|
Binary file
|
package/deps/sqlite3.gyp
ADDED
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
{
|
|
2
|
+
'includes': [ 'common-sqlite.gypi' ],
|
|
3
|
+
|
|
4
|
+
'variables': {
|
|
5
|
+
'sqlite_magic%': '',
|
|
6
|
+
},
|
|
7
|
+
|
|
8
|
+
'target_defaults': {
|
|
9
|
+
'default_configuration': 'Release',
|
|
10
|
+
'cflags':[
|
|
11
|
+
'-std=c99'
|
|
12
|
+
],
|
|
13
|
+
'configurations': {
|
|
14
|
+
'Debug': {
|
|
15
|
+
'defines': [ 'DEBUG', '_DEBUG' ],
|
|
16
|
+
'msvs_settings': {
|
|
17
|
+
'VCCLCompilerTool': {
|
|
18
|
+
'RuntimeLibrary': 1, # static debug
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
'Release': {
|
|
23
|
+
'defines': [ 'NDEBUG' ],
|
|
24
|
+
'msvs_settings': {
|
|
25
|
+
'VCCLCompilerTool': {
|
|
26
|
+
'RuntimeLibrary': 0, # static release
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
'msvs_settings': {
|
|
32
|
+
'VCCLCompilerTool': {
|
|
33
|
+
},
|
|
34
|
+
'VCLibrarianTool': {
|
|
35
|
+
},
|
|
36
|
+
'VCLinkerTool': {
|
|
37
|
+
'GenerateDebugInformation': 'true',
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
'conditions': [
|
|
41
|
+
['OS == "win"', {
|
|
42
|
+
'defines': [
|
|
43
|
+
'WIN32'
|
|
44
|
+
],
|
|
45
|
+
}]
|
|
46
|
+
],
|
|
47
|
+
},
|
|
48
|
+
|
|
49
|
+
'targets': [
|
|
50
|
+
{
|
|
51
|
+
'target_name': 'action_before_build',
|
|
52
|
+
'type': 'none',
|
|
53
|
+
'hard_dependency': 1,
|
|
54
|
+
'actions': [
|
|
55
|
+
{
|
|
56
|
+
'action_name': 'unpack_sqlite_dep',
|
|
57
|
+
'inputs': [
|
|
58
|
+
'./sqlite-autoconf-<@(sqlite_version).tar.gz'
|
|
59
|
+
],
|
|
60
|
+
'outputs': [
|
|
61
|
+
'<(SHARED_INTERMEDIATE_DIR)/sqlite-autoconf-<@(sqlite_version)/sqlite3.c'
|
|
62
|
+
],
|
|
63
|
+
'action': ['node','./extract.js','./sqlite-autoconf-<@(sqlite_version).tar.gz','<(SHARED_INTERMEDIATE_DIR)']
|
|
64
|
+
}
|
|
65
|
+
],
|
|
66
|
+
'direct_dependent_settings': {
|
|
67
|
+
'include_dirs': [
|
|
68
|
+
'<(SHARED_INTERMEDIATE_DIR)/sqlite-autoconf-<@(sqlite_version)/',
|
|
69
|
+
]
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
'target_name': 'sqlite3',
|
|
74
|
+
'type': 'static_library',
|
|
75
|
+
'include_dirs': [ '<(SHARED_INTERMEDIATE_DIR)/sqlite-autoconf-<@(sqlite_version)/' ],
|
|
76
|
+
'dependencies': [
|
|
77
|
+
'action_before_build'
|
|
78
|
+
],
|
|
79
|
+
'sources': [
|
|
80
|
+
'<(SHARED_INTERMEDIATE_DIR)/sqlite-autoconf-<@(sqlite_version)/sqlite3.c'
|
|
81
|
+
],
|
|
82
|
+
'direct_dependent_settings': {
|
|
83
|
+
'include_dirs': [ '<(SHARED_INTERMEDIATE_DIR)/sqlite-autoconf-<@(sqlite_version)/' ],
|
|
84
|
+
'defines': [
|
|
85
|
+
'SQLITE_THREADSAFE=1',
|
|
86
|
+
'HAVE_USLEEP=1',
|
|
87
|
+
'SQLITE_ENABLE_FTS3',
|
|
88
|
+
'SQLITE_ENABLE_FTS4',
|
|
89
|
+
'SQLITE_ENABLE_FTS5',
|
|
90
|
+
'SQLITE_ENABLE_RTREE',
|
|
91
|
+
'SQLITE_ENABLE_DBSTAT_VTAB=1',
|
|
92
|
+
'SQLITE_ENABLE_MATH_FUNCTIONS'
|
|
93
|
+
],
|
|
94
|
+
},
|
|
95
|
+
'cflags_cc': [
|
|
96
|
+
'-Wno-unused-value'
|
|
97
|
+
],
|
|
98
|
+
'defines': [
|
|
99
|
+
'_REENTRANT=1',
|
|
100
|
+
'SQLITE_THREADSAFE=1',
|
|
101
|
+
'HAVE_USLEEP=1',
|
|
102
|
+
'SQLITE_ENABLE_FTS3',
|
|
103
|
+
'SQLITE_ENABLE_FTS4',
|
|
104
|
+
'SQLITE_ENABLE_FTS5',
|
|
105
|
+
'SQLITE_ENABLE_RTREE',
|
|
106
|
+
'SQLITE_ENABLE_DBSTAT_VTAB=1',
|
|
107
|
+
'SQLITE_ENABLE_MATH_FUNCTIONS'
|
|
108
|
+
],
|
|
109
|
+
'export_dependent_settings': [
|
|
110
|
+
'action_before_build',
|
|
111
|
+
],
|
|
112
|
+
'conditions': [
|
|
113
|
+
["sqlite_magic != ''", {
|
|
114
|
+
'defines': [
|
|
115
|
+
'SQLITE_FILE_HEADER="<(sqlite_magic)"'
|
|
116
|
+
]
|
|
117
|
+
}]
|
|
118
|
+
],
|
|
119
|
+
}
|
|
120
|
+
]
|
|
121
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = require('bindings')('node_sqlite3.node');
|