@rocicorp/zero-sqlite3 1.0.15 → 1.0.16

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.
@@ -368,6 +368,10 @@ struct sqlite3_api_routines {
368
368
  int (*set_clientdata)(sqlite3*, const char*, void*, void(*)(void*));
369
369
  /* Version 3.50.0 and later */
370
370
  int (*setlk_timeout)(sqlite3*,int,int);
371
+ /* Version 3.51.0 and later */
372
+ int (*set_errmsg)(sqlite3*,int,const char*);
373
+ int (*db_status64)(sqlite3*,int,sqlite3_int64*,sqlite3_int64*,int);
374
+
371
375
  };
372
376
 
373
377
  /*
@@ -703,6 +707,9 @@ typedef int (*sqlite3_loadext_entry)(
703
707
  #define sqlite3_set_clientdata sqlite3_api->set_clientdata
704
708
  /* Version 3.50.0 and later */
705
709
  #define sqlite3_setlk_timeout sqlite3_api->setlk_timeout
710
+ /* Version 3.51.0 and later */
711
+ #define sqlite3_set_errmsg sqlite3_api->set_errmsg
712
+ #define sqlite3_db_status64 sqlite3_api->db_status64
706
713
  #endif /* !defined(SQLITE_CORE) && !defined(SQLITE_OMIT_LOAD_EXTENSION) */
707
714
 
708
715
  #if !defined(SQLITE_CORE) && !defined(SQLITE_OMIT_LOAD_EXTENSION)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rocicorp/zero-sqlite3",
3
- "version": "1.0.15",
3
+ "version": "1.0.16",
4
4
  "description": "better-sqlite3 on bedrock",
5
5
  "homepage": "https://github.com/rocicorp/zero-sqlite3",
6
6
  "author": "Rocicorp",
@@ -20,7 +20,7 @@
20
20
  "shell.js"
21
21
  ],
22
22
  "engines": {
23
- "node": "20.x || 22.x || 23.x || 24.x",
23
+ "node": "20.x || 22.x || 23.x || 24.x || 25.x",
24
24
  "bun": ">=1.1.0"
25
25
  },
26
26
  "types": "lib/index.d.ts",
@@ -30,7 +30,7 @@
30
30
  },
31
31
  "overrides": {
32
32
  "prebuild": {
33
- "node-abi": "4.13.1"
33
+ "node-abi": "^4.25.0"
34
34
  }
35
35
  },
36
36
  "devDependencies": {
@@ -46,7 +46,12 @@ class Backup;
46
46
  #include "objects/statement-iterator.cpp"
47
47
 
48
48
  NODE_MODULE_INIT(/* exports, context */) {
49
+ #if defined(NODE_MODULE_VERSION) && NODE_MODULE_VERSION >= 140
50
+ // Use Isolate::GetCurrent as stated in deprecation message within v8_context.h 13.9.72320122
51
+ v8::Isolate* isolate = v8::Isolate::GetCurrent();
52
+ #else
49
53
  v8::Isolate* isolate = context->GetIsolate();
54
+ #endif
50
55
  v8::HandleScope scope(isolate);
51
56
  Addon::ConfigureURI();
52
57
 
@@ -62,7 +67,7 @@ NODE_MODULE_INIT(/* exports, context */) {
62
67
  exports->Set(context, InternalizedFromLatin1(isolate, "Backup"), Backup::Init(isolate, data)).FromJust();
63
68
  exports->Set(context, InternalizedFromLatin1(isolate, "setErrorConstructor"), v8::FunctionTemplate::New(isolate, Addon::JS_setErrorConstructor, data)->GetFunction(context).ToLocalChecked()).FromJust();
64
69
 
65
- // Export SQLITE_SCANSTAT_* constants
70
+ // Export SQLITE_SCANSTAT_* constants
66
71
  exports->Set(context, InternalizedFromLatin1(isolate, "SQLITE_SCANSTAT_NLOOP"), v8::Int32::New(isolate, SQLITE_SCANSTAT_NLOOP)).FromJust();
67
72
  exports->Set(context, InternalizedFromLatin1(isolate, "SQLITE_SCANSTAT_NVISIT"), v8::Int32::New(isolate, SQLITE_SCANSTAT_NVISIT)).FromJust();
68
73
  exports->Set(context, InternalizedFromLatin1(isolate, "SQLITE_SCANSTAT_EST"), v8::Int32::New(isolate, SQLITE_SCANSTAT_EST)).FromJust();
@@ -383,10 +383,10 @@ NODE_METHOD(Database::JS_unsafeMode) {
383
383
  }
384
384
 
385
385
  NODE_GETTER(Database::JS_open) {
386
- info.GetReturnValue().Set(Unwrap<Database>(info.This())->open);
386
+ info.GetReturnValue().Set(Unwrap<Database>(PROPERTY_HOLDER(info))->open);
387
387
  }
388
388
 
389
389
  NODE_GETTER(Database::JS_inTransaction) {
390
- Database* db = Unwrap<Database>(info.This());
390
+ Database* db = Unwrap<Database>(PROPERTY_HOLDER(info));
391
391
  info.GetReturnValue().Set(db->open && !static_cast<bool>(sqlite3_get_autocommit(db->db_handle)));
392
392
  }
@@ -450,7 +450,7 @@ NODE_METHOD(Statement::JS_columns) {
450
450
  );
451
451
  columns.emplace_back(
452
452
  v8::Object::New(isolate,
453
- v8::Object::New(isolate)->GetPrototype(),
453
+ GET_PROTOTYPE(v8::Object::New(isolate)),
454
454
  keys.data(),
455
455
  values.data(),
456
456
  keys.size()
@@ -546,6 +546,6 @@ NODE_METHOD(Statement::JS_scanStatusReset) {
546
546
  }
547
547
 
548
548
  NODE_GETTER(Statement::JS_busy) {
549
- Statement* stmt = Unwrap<Statement>(info.This());
549
+ Statement* stmt = Unwrap<Statement>(PROPERTY_HOLDER(info));
550
550
  info.GetReturnValue().Set(stmt->alive && stmt->locked);
551
551
  }
@@ -33,10 +33,10 @@ private:
33
33
  };
34
34
 
35
35
  static bool IsPlainObject(v8::Isolate* isolate, v8::Local<v8::Object> obj) {
36
- v8::Local<v8::Value> proto = obj->GetPrototype();
36
+ v8::Local<v8::Value> proto = GET_PROTOTYPE(obj);
37
37
  v8::Local<v8::Context> ctx = obj->GetCreationContext().ToLocalChecked();
38
38
  ctx->Enter();
39
- v8::Local<v8::Value> baseProto = v8::Object::New(isolate)->GetPrototype();
39
+ v8::Local<v8::Value> baseProto = GET_PROTOTYPE(v8::Object::New(isolate));
40
40
  ctx->Exit();
41
41
  return proto->StrictEquals(baseProto) || proto->StrictEquals(v8::Null(isolate));
42
42
  }
package/src/util/data.cpp CHANGED
@@ -146,7 +146,7 @@ namespace Data {
146
146
  }
147
147
  return v8::Object::New(
148
148
  isolate,
149
- v8::Object::New(isolate)->GetPrototype(),
149
+ GET_PROTOTYPE(v8::Object::New(isolate)),
150
150
  keys.data(),
151
151
  values.data(),
152
152
  column_count
@@ -4,6 +4,26 @@
4
4
  #define NODE_GETTER(name) void name(v8::Local<v8::Name> _, const v8::PropertyCallbackInfo<v8::Value>& info)
5
5
  #define INIT(name) v8::Local<v8::Function> name(v8::Isolate* isolate, v8::Local<v8::External> data)
6
6
 
7
+ #if defined(V8_MAJOR_VERSION) && V8_MAJOR_VERSION >= 13
8
+ // v8::Object::GetPrototype has been deprecated. See http://crbug.com/333672197
9
+ #define GET_PROTOTYPE(obj) ((obj)->GetPrototypeV2())
10
+ #else
11
+ #define GET_PROTOTYPE(obj) ((obj)->GetPrototype())
12
+ #endif
13
+
14
+ // PropertyCallbackInfo::This() and Holder() were removed; use HolderV2().
15
+ // Tracking bug for V8 API removals: http://crbug.com/333672197
16
+ // V8 head has since restored Holder() and deprecated HolderV2():
17
+ // https://chromium.googlesource.com/v8/v8/+/main/include/v8-function-callback.h
18
+ // V8_INLINE Local<Object> Holder() const;
19
+ // V8_DEPRECATE_SOON("Use Holder().")
20
+ // V8_INLINE Local<Object> HolderV2() const;
21
+ #if defined(V8_MAJOR_VERSION) && V8_MAJOR_VERSION >= 13
22
+ #define PROPERTY_HOLDER(info) (info).HolderV2()
23
+ #else
24
+ #define PROPERTY_HOLDER(info) (info).This()
25
+ #endif
26
+
7
27
  #define EasyIsolate v8::Isolate* isolate = v8::Isolate::GetCurrent()
8
28
  #define OnlyIsolate info.GetIsolate()
9
29
  #define OnlyContext isolate->GetCurrentContext()
@@ -33,7 +33,7 @@ public:
33
33
  }
34
34
 
35
35
  return v8::Object::New(isolate,
36
- v8::Object::New(isolate)->GetPrototype(),
36
+ GET_PROTOTYPE(v8::Object::New(isolate)),
37
37
  keys.data(),
38
38
  values.data(),
39
39
  column_count
@@ -1,15 +0,0 @@
1
- diff --git a/deps/sqlite3/sqlite3.c b/deps/sqlite3/sqlite3.c
2
- index b1a807f..38bd1e6 100644
3
- --- a/deps/sqlite3/sqlite3.c
4
- +++ b/deps/sqlite3/sqlite3.c
5
- @@ -24887,8 +24887,8 @@ static const struct {
6
- /* 1 */ { 6, "minute", 7.7379e+12, 60.0 },
7
- /* 2 */ { 4, "hour", 1.2897e+11, 3600.0 },
8
- /* 3 */ { 3, "day", 5373485.0, 86400.0 },
9
- - /* 4 */ { 5, "month", 176546.0, 30.0*86400.0 },
10
- - /* 5 */ { 4, "year", 14713.0, 365.0*86400.0 },
11
- + /* 4 */ { 5, "month", 176546.0, 2592000.0 },
12
- + /* 5 */ { 4, "year", 14713.0, 31536000.0 },
13
- };
14
-
15
- /*