bun:sqlite (#167)

* ✂️

* Add the slow version

* draw the rest of the owl

* Fix crash when allocating lots of memory

* [Bun.Transipiler] Support passing objects

* [JS Parser] Support passing objects to macros via Bun.Transpiler

* Update JSSQLStatement.cpp

* Embed SQLite

* Add SQLite to Dockerfile

* [sqlite] Add quick one-off queries without creating a whole object

* [sqlite] Add `columnsCount`, rename raw() to `values()`, remove `rebind`

* Implement `bun:sqlite`

* return null

* Fix updating query

* Update bun.d.ts

* more tests

* Support variadic arguments, write tests and add types

* Update sqlite.d.ts

* Update sqlite.d.ts

* latest

* Implement `Database.loadExtension` and `Database.setCustomSQLite`

* Support `require.resolve`

* [napi] Improve string performance

* [bun.js] Support some of `node:module`

* another test

* [sqlite] Support serialize & deserialize

* [`bun:ffi`] Implement `CFunction` and `linkSymbols`

* [bun.js] Fix crash in `Buffer.from`

* Update sqlite.test.js

* Document linkSymbols

* docs

* Update README.md
This commit is contained in:
Jarred Sumner
2022-05-16 15:46:20 -07:00
committed by GitHub
parent 2bd0dcfdfa
commit a37f86e89d
52 changed files with 258365 additions and 139 deletions

View File

@@ -1173,6 +1173,28 @@ pub const VirtualMachine = struct {
.hash = 0,
};
},
.@"bun:sqlite" => {
return ResolvedSource{
.allocator = null,
.source_code = ZigString.init(
@as(string, @embedFile("./bindings/sqlite/sqlite.exports.js")),
),
.specifier = ZigString.init("bun:sqlite"),
.source_url = ZigString.init("bun:sqlite"),
.hash = 0,
};
},
.@"node:module" => {
return ResolvedSource{
.allocator = null,
.source_code = ZigString.init(
@as(string, @embedFile("./module.exports.js")),
),
.specifier = ZigString.init("node:module"),
.source_url = ZigString.init("node:module"),
.hash = 0,
};
},
}
} else if (_specifier.len > js_ast.Macro.namespaceWithColon.len and
strings.eqlComptimeIgnoreLen(_specifier[0..js_ast.Macro.namespaceWithColon.len], js_ast.Macro.namespaceWithColon))
@@ -2891,6 +2913,8 @@ pub const HardcodedModule = enum {
@"node:fs",
@"node:path",
@"detect-libc",
@"bun:sqlite",
@"node:module",
pub const Map = bun.ComptimeStringMap(
HardcodedModule,
@@ -2905,6 +2929,9 @@ pub const HardcodedModule = enum {
.{ "node:path/win32", HardcodedModule.@"node:path" },
.{ "node:path/posix", HardcodedModule.@"node:path" },
.{ "detect-libc", HardcodedModule.@"detect-libc" },
.{ "bun:sqlite", HardcodedModule.@"bun:sqlite" },
.{ "node:module", HardcodedModule.@"node:module" },
.{ "module", HardcodedModule.@"node:module" },
},
);
pub const LinkerMap = bun.ComptimeStringMap(
@@ -2919,6 +2946,9 @@ pub const HardcodedModule = enum {
.{ "node:path", "node:path" },
.{ "path", "node:path" },
.{ "bun:wrap", "bun:wrap" },
.{ "bun:sqlite", "bun:sqlite" },
.{ "node:module", "node:module" },
.{ "module", "node:module" },
},
);
};