Skip to content

Commit 9374202

Browse files
committed
refactor(src): migrate from .lzz to .cpp/.hpp
- Split monolithic LZZ-generated files into modular C++ components - Create separate .hpp/.cpp files for each original .lzz source - Maintain single compilation unit architecture via strategic includes - Add proper forward declarations to resolve circular dependencies - Update binding.gyp to compile all individual source files - Add standard LLVM formatting with .clang-format - Add npm script for formatting C++ code
1 parent b19b73a commit 9374202

35 files changed

+3486
-3209
lines changed

.clang-format

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
BasedOnStyle: LLVM

.claude/settings.local.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,13 @@
66
"Bash(ls:*)",
77
"Bash(find:*)",
88
"Bash(lzz:*)",
9-
"Bash(cp:*)"
9+
"Bash(cp:*)",
10+
"Bash(npm run:*)",
11+
"Bash(chmod:*)",
12+
"Bash(python3:*)",
13+
"Bash(npm test:*)",
14+
"Bash(timeout:*)",
15+
"Bash(awk:*)"
1016
]
1117
},
1218
"enableAllProjectMcpServers": false

binding.gyp

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,22 @@
88
{
99
'target_name': 'better_sqlite3',
1010
'dependencies': ['deps/sqlite3.gyp:sqlite3'],
11-
'sources': ['src/better_sqlite3.cpp'],
11+
'sources': [
12+
'src/better_sqlite3.cpp',
13+
'src/objects/database.cpp',
14+
'src/objects/statement.cpp',
15+
'src/objects/statement-iterator.cpp',
16+
'src/objects/backup.cpp',
17+
'src/util/macros.cpp',
18+
'src/util/constants.cpp',
19+
'src/util/bind-map.cpp',
20+
'src/util/binder.cpp',
21+
'src/util/data-converter.cpp',
22+
'src/util/custom-function.cpp',
23+
'src/util/custom-aggregate.cpp',
24+
'src/util/custom-table.cpp',
25+
'src/util/data.cpp'
26+
],
1227
'cflags_cc': ['-std=c++20'],
1328
'xcode_settings': {
1429
'OTHER_CPLUSPLUSFLAGS': ['-std=c++20', '-stdlib=libc++'],

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
"test": "mocha --exit --slow=75 --timeout=5000",
4242
"benchmark": "node benchmark",
4343
"download": "bash ./deps/download.sh",
44+
"fmt": "find src -name '*.cpp' -o -name '*.hpp' | grep -v withlines | xargs clang-format -i",
4445
"lzz": "lzz -hx hpp -sx cpp -k BETTER_SQLITE3 -d -hl -sl -e ./src/better_sqlite3.lzz"
4546
},
4647
"license": "MIT",

src/better_sqlite3.cpp

Lines changed: 68 additions & 2181 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)