@jingyi0605/codingns 0.8.1 → 0.8.5
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/bin/codingns.mjs +180 -0
- package/dist/public/assets/{AdaptiveButlerPage-b7s6F_sd.js → AdaptiveButlerPage-CJw8Ae62.js} +3 -3
- package/dist/public/assets/App-BOHBGFOd.js +30 -0
- package/dist/public/assets/{BootstrapPage-jFfl7KNK.js → BootstrapPage-BxHQT4nA.js} +1 -1
- package/dist/public/assets/{ConversationPage-sj_rn4q0.js → ConversationPage-DWFsF6BB.js} +6 -6
- package/dist/public/assets/{DesktopDetachPreviewPage-C5c88SOX.js → DesktopDetachPreviewPage-DOgEjYEf.js} +1 -1
- package/dist/public/assets/DesktopModal-D_A8sgQU.js +1 -0
- package/dist/public/assets/DesktopWindowPage-DK7L7osV.js +2 -0
- package/dist/public/assets/FileContextPanel-BdCoubcJ.js +1 -0
- package/dist/public/assets/GitSidebar-BeZ0hj7A.js +6 -0
- package/dist/public/assets/MobileCreateSessionSheet-DfLMVu8q.js +1 -0
- package/dist/public/assets/MobileSheet-5kZ-w-gU.js +1 -0
- package/dist/public/assets/{MobileTopHeaderFrame-_I0t7cC_.js → MobileTopHeaderFrame-lcp2GscV.js} +1 -1
- package/dist/public/assets/MobileWorkspaceSwitcherHeader-C6JMiOq_.js +1 -0
- package/dist/public/assets/PluginAccessOverview-DGcKAMQl.js +1 -0
- package/dist/public/assets/PluginContainerPage-BlY-xJDh.js +1 -0
- package/dist/public/assets/PluginDetailPage-CAJ7LFpD.js +1 -0
- package/dist/public/assets/PluginsListPage-BxZG1NyT.js +1 -0
- package/dist/public/assets/{RelayConnectEntryPage-CMtDWyGS.js → RelayConnectEntryPage-CfNO_TIl.js} +1 -1
- package/dist/public/assets/ServerSettingsModal-by36Z_5k.js +1 -0
- package/dist/public/assets/SessionIndexPage-DkBp9Mqz.js +1 -0
- package/dist/public/assets/SettingsPage-C-ASmJAG.js +2 -0
- package/dist/public/assets/TerminalManagerPanel-NVZRxxmH.js +1 -0
- package/dist/public/assets/{TerminalPage-CBIKHI33.js → TerminalPage-C4LNoPBp.js} +3 -3
- package/dist/public/assets/TerminalRuntimeFallbackModal-Bzum5nZ0.js +1 -0
- package/dist/public/assets/ToolFilesPage-47zbdgTW.js +1 -0
- package/dist/public/assets/ToolGitPage-Fuk_b_jg.js +1 -0
- package/dist/public/assets/ToolProcessesPage-sWSMWD-9.js +1 -0
- package/dist/public/assets/ToolsHomePage-R1mZlbZi.js +1 -0
- package/dist/public/assets/WorkbenchLandingPage-CqmiFH2u.js +1 -0
- package/dist/public/assets/WorkbenchLayout-OFi6CWgH.js +244 -0
- package/dist/public/assets/WorkbenchModal-C7qoQElW.js +1 -0
- package/dist/public/assets/WorkbenchShellRoute-BAQe_E0O.js +1 -0
- package/dist/public/assets/WorkspaceDebugDetailPage-DhKa6e9y.js +1 -0
- package/dist/public/assets/WorkspaceDetailPage-BPsrFffw.js +1 -0
- package/dist/public/assets/WorkspaceHomePage-KAtqZOAb.js +1 -0
- package/dist/public/assets/{client-runtime-manager-CdJP7nUp.js → client-runtime-manager-wmCJZKYd.js} +1 -1
- package/dist/public/assets/file-tree-icon-Mg1DiBRX.js +590 -0
- package/dist/public/assets/{index-VVxfF0s5.css → index-C4t-vvqk.css} +1 -1
- package/dist/public/assets/index-CL97fwWB.js +42 -0
- package/dist/public/assets/{login-direct-candidate-resolver-C-mo698r.js → login-direct-candidate-resolver-BOAgTuUf.js} +1 -1
- package/dist/public/assets/plugin-permission-copy-Cq99cnzV.js +1 -0
- package/dist/public/assets/plugins-api-BQTV5DOp.js +1 -0
- package/dist/public/assets/{preferences-service-CnaTvZq2.js → preferences-service-DJxbEEeg.js} +1 -1
- package/dist/public/assets/realtime-client-CLafKzzJ.js +1 -0
- package/dist/public/assets/{relay-entry-D7OgZZN-.js → relay-entry-D-LfvdiX.js} +1 -1
- package/dist/public/assets/{terminal-runtime-meta-BCtAYB0E.js → terminal-runtime-meta-BJmy8dyK.js} +1 -1
- package/dist/public/assets/useRegisteredDebugTemplates-DQAWVdCo.js +1 -0
- package/dist/public/assets/workbench-navigation-MEzCSmsK.js +1 -0
- package/dist/public/index.html +2 -2
- package/dist/server/config/env.d.ts +1 -0
- package/dist/server/config/env.js +4 -0
- package/dist/server/config/env.js.map +1 -1
- package/dist/server/helpers/wechat-claw-runtime/modules/runtime-state-store.js +1 -1
- package/dist/server/helpers/wechat-claw-runtime/modules/runtime-state-store.js.map +1 -1
- package/dist/server/modules/channels/wechat-claw-client.d.ts +51 -0
- package/dist/server/modules/channels/wechat-claw-client.js +245 -0
- package/dist/server/modules/channels/wechat-claw-client.js.map +1 -0
- package/dist/server/modules/file/file-access-guard.d.ts +2 -0
- package/dist/server/modules/file/file-access-guard.js +24 -2
- package/dist/server/modules/file/file-access-guard.js.map +1 -1
- package/dist/server/modules/file/file-controller.d.ts +153 -1
- package/dist/server/modules/file/file-controller.js +215 -1
- package/dist/server/modules/file/file-controller.js.map +1 -1
- package/dist/server/modules/file/file-preview-link-service.d.ts +2 -0
- package/dist/server/modules/file/file-preview-link-service.js +5 -1
- package/dist/server/modules/file/file-preview-link-service.js.map +1 -1
- package/dist/server/modules/file/runtime/codingns-workspace-bridge.js +911 -0
- package/dist/server/modules/file/workspace-file-bridge-service.d.ts +126 -0
- package/dist/server/modules/file/workspace-file-bridge-service.js +471 -0
- package/dist/server/modules/file/workspace-file-bridge-service.js.map +1 -0
- package/dist/server/modules/file/workspace-file-bridge-watch-service.d.ts +42 -0
- package/dist/server/modules/file/workspace-file-bridge-watch-service.js +304 -0
- package/dist/server/modules/file/workspace-file-bridge-watch-service.js.map +1 -0
- package/dist/server/modules/model-switch/cc-switch-adapter.js +1 -1
- package/dist/server/modules/model-switch/cc-switch-adapter.js.map +1 -1
- package/dist/server/modules/plugins/plugin-controller.d.ts +131 -0
- package/dist/server/modules/plugins/plugin-controller.js +277 -0
- package/dist/server/modules/plugins/plugin-controller.js.map +1 -0
- package/dist/server/modules/plugins/plugin-file-gateway-service.d.ts +38 -0
- package/dist/server/modules/plugins/plugin-file-gateway-service.js +178 -0
- package/dist/server/modules/plugins/plugin-file-gateway-service.js.map +1 -0
- package/dist/server/modules/plugins/plugin-manifest.d.ts +8 -0
- package/dist/server/modules/plugins/plugin-manifest.js +420 -0
- package/dist/server/modules/plugins/plugin-manifest.js.map +1 -0
- package/dist/server/modules/plugins/plugin-permission-service.d.ts +49 -0
- package/dist/server/modules/plugins/plugin-permission-service.js +267 -0
- package/dist/server/modules/plugins/plugin-permission-service.js.map +1 -0
- package/dist/server/modules/plugins/plugin-process-runner.d.ts +21 -0
- package/dist/server/modules/plugins/plugin-process-runner.js +127 -0
- package/dist/server/modules/plugins/plugin-process-runner.js.map +1 -0
- package/dist/server/modules/plugins/plugin-registry-service.d.ts +41 -0
- package/dist/server/modules/plugins/plugin-registry-service.js +238 -0
- package/dist/server/modules/plugins/plugin-registry-service.js.map +1 -0
- package/dist/server/modules/plugins/plugin-runtime-service.d.ts +55 -0
- package/dist/server/modules/plugins/plugin-runtime-service.js +252 -0
- package/dist/server/modules/plugins/plugin-runtime-service.js.map +1 -0
- package/dist/server/modules/plugins/plugin-runtime-session-service.d.ts +21 -0
- package/dist/server/modules/plugins/plugin-runtime-session-service.js +83 -0
- package/dist/server/modules/plugins/plugin-runtime-session-service.js.map +1 -0
- package/dist/server/modules/plugins/plugin-scheduler-service.d.ts +31 -0
- package/dist/server/modules/plugins/plugin-scheduler-service.js +232 -0
- package/dist/server/modules/plugins/plugin-scheduler-service.js.map +1 -0
- package/dist/server/modules/plugins/plugin-static-service.d.ts +11 -0
- package/dist/server/modules/plugins/plugin-static-service.js +145 -0
- package/dist/server/modules/plugins/plugin-static-service.js.map +1 -0
- package/dist/server/modules/presentation/presentation-controller.d.ts +3 -0
- package/dist/server/modules/presentation/presentation-controller.js +11 -0
- package/dist/server/modules/presentation/presentation-controller.js.map +1 -1
- package/dist/server/modules/presentation/presentation-export-task-service.d.ts +6 -0
- package/dist/server/modules/presentation/presentation-export-task-service.js +52 -8
- package/dist/server/modules/presentation/presentation-export-task-service.js.map +1 -1
- package/dist/server/modules/presentation/presentation-pptx-export-service.js +200 -14
- package/dist/server/modules/presentation/presentation-pptx-export-service.js.map +1 -1
- package/dist/server/modules/presentation/presentation-renderer.d.ts +50 -0
- package/dist/server/modules/presentation/presentation-renderer.js +450 -37
- package/dist/server/modules/presentation/presentation-renderer.js.map +1 -1
- package/dist/server/modules/tasks/task-types.d.ts +2 -0
- package/dist/server/modules/tasks/task-types.js +2 -0
- package/dist/server/modules/tasks/task-types.js.map +1 -1
- package/dist/server/modules/terminal/runtime/terminal-log-writer-process.js +1 -1
- package/dist/server/modules/terminal/runtime/terminal-log-writer-process.js.map +1 -1
- package/dist/server/routes/files.js +40 -0
- package/dist/server/routes/files.js.map +1 -1
- package/dist/server/routes/plugins-public.d.ts +3 -0
- package/dist/server/routes/plugins-public.js +5 -0
- package/dist/server/routes/plugins-public.js.map +1 -0
- package/dist/server/routes/plugins.d.ts +3 -0
- package/dist/server/routes/plugins.js +19 -0
- package/dist/server/routes/plugins.js.map +1 -0
- package/dist/server/routes/presentation.js +1 -0
- package/dist/server/routes/presentation.js.map +1 -1
- package/dist/server/server/create-server.d.ts +20 -0
- package/dist/server/server/create-server.js +47 -1
- package/dist/server/server/create-server.js.map +1 -1
- package/dist/server/shared/http/error-handler.js +10 -6
- package/dist/server/shared/http/error-handler.js.map +1 -1
- package/dist/server/shared/runtime/better-sqlite3.d.ts +5 -0
- package/dist/server/shared/runtime/better-sqlite3.js +6 -0
- package/dist/server/shared/runtime/better-sqlite3.js.map +1 -0
- package/dist/server/storage/repositories/plugin-audit-event-repository.d.ts +8 -0
- package/dist/server/storage/repositories/plugin-audit-event-repository.js +49 -0
- package/dist/server/storage/repositories/plugin-audit-event-repository.js.map +1 -0
- package/dist/server/storage/repositories/plugin-definition-repository.d.ts +10 -0
- package/dist/server/storage/repositories/plugin-definition-repository.js +84 -0
- package/dist/server/storage/repositories/plugin-definition-repository.js.map +1 -0
- package/dist/server/storage/repositories/plugin-enablement-repository.d.ts +9 -0
- package/dist/server/storage/repositories/plugin-enablement-repository.js +74 -0
- package/dist/server/storage/repositories/plugin-enablement-repository.js.map +1 -0
- package/dist/server/storage/repositories/plugin-permission-grant-repository.d.ts +12 -0
- package/dist/server/storage/repositories/plugin-permission-grant-repository.js +142 -0
- package/dist/server/storage/repositories/plugin-permission-grant-repository.js.map +1 -0
- package/dist/server/storage/repositories/plugin-run-repository.d.ts +10 -0
- package/dist/server/storage/repositories/plugin-run-repository.js +111 -0
- package/dist/server/storage/repositories/plugin-run-repository.js.map +1 -0
- package/dist/server/storage/repositories/plugin-runtime-session-repository.d.ts +10 -0
- package/dist/server/storage/repositories/plugin-runtime-session-repository.js +86 -0
- package/dist/server/storage/repositories/plugin-runtime-session-repository.js.map +1 -0
- package/dist/server/storage/sqlite/client.d.ts +2 -2
- package/dist/server/storage/sqlite/client.js +250 -1
- package/dist/server/storage/sqlite/client.js.map +1 -1
- package/dist/server/storage/sqlite/schema.sql +140 -0
- package/dist/server/types/domain.d.ts +122 -0
- package/package.json +10 -3
- package/scripts/postinstall.mjs +248 -11
- package/vendor/better-sqlite3-win32-x64-node22/LICENSE +21 -0
- package/vendor/better-sqlite3-win32-x64-node22/README.md +12 -0
- package/vendor/better-sqlite3-win32-x64-node22/README.upstream.md +99 -0
- package/vendor/better-sqlite3-win32-x64-node22/binding.gyp +38 -0
- package/vendor/better-sqlite3-win32-x64-node22/build/Release/better_sqlite3.node +0 -0
- package/vendor/better-sqlite3-win32-x64-node22/deps/common.gypi +68 -0
- package/vendor/better-sqlite3-win32-x64-node22/deps/copy.js +31 -0
- package/vendor/better-sqlite3-win32-x64-node22/deps/defines.gypi +41 -0
- package/vendor/better-sqlite3-win32-x64-node22/deps/download.sh +122 -0
- package/vendor/better-sqlite3-win32-x64-node22/deps/patches/1208.patch +15 -0
- package/vendor/better-sqlite3-win32-x64-node22/deps/sqlite3/sqlite3.c +265994 -0
- package/vendor/better-sqlite3-win32-x64-node22/deps/sqlite3/sqlite3.h +13968 -0
- package/vendor/better-sqlite3-win32-x64-node22/deps/sqlite3/sqlite3ext.h +730 -0
- package/vendor/better-sqlite3-win32-x64-node22/deps/sqlite3.gyp +80 -0
- package/vendor/better-sqlite3-win32-x64-node22/deps/test_extension.c +21 -0
- package/vendor/better-sqlite3-win32-x64-node22/lib/database.js +90 -0
- package/vendor/better-sqlite3-win32-x64-node22/lib/index.js +3 -0
- package/vendor/better-sqlite3-win32-x64-node22/lib/methods/aggregate.js +43 -0
- package/vendor/better-sqlite3-win32-x64-node22/lib/methods/backup.js +67 -0
- package/vendor/better-sqlite3-win32-x64-node22/lib/methods/function.js +31 -0
- package/vendor/better-sqlite3-win32-x64-node22/lib/methods/inspect.js +7 -0
- package/vendor/better-sqlite3-win32-x64-node22/lib/methods/pragma.js +12 -0
- package/vendor/better-sqlite3-win32-x64-node22/lib/methods/serialize.js +16 -0
- package/vendor/better-sqlite3-win32-x64-node22/lib/methods/table.js +189 -0
- package/vendor/better-sqlite3-win32-x64-node22/lib/methods/transaction.js +78 -0
- package/vendor/better-sqlite3-win32-x64-node22/lib/methods/wrappers.js +54 -0
- package/vendor/better-sqlite3-win32-x64-node22/lib/sqlite-error.js +20 -0
- package/vendor/better-sqlite3-win32-x64-node22/lib/util.js +12 -0
- package/vendor/better-sqlite3-win32-x64-node22/package.json +38 -0
- package/vendor/better-sqlite3-win32-x64-node22/scripts/verify-runtime.cjs +42 -0
- package/vendor/better-sqlite3-win32-x64-node22/src/addon.cpp +47 -0
- package/vendor/better-sqlite3-win32-x64-node22/src/better_sqlite3.cpp +74 -0
- package/vendor/better-sqlite3-win32-x64-node22/src/objects/backup.cpp +120 -0
- package/vendor/better-sqlite3-win32-x64-node22/src/objects/backup.hpp +36 -0
- package/vendor/better-sqlite3-win32-x64-node22/src/objects/database.cpp +417 -0
- package/vendor/better-sqlite3-win32-x64-node22/src/objects/database.hpp +103 -0
- package/vendor/better-sqlite3-win32-x64-node22/src/objects/statement-iterator.cpp +113 -0
- package/vendor/better-sqlite3-win32-x64-node22/src/objects/statement-iterator.hpp +50 -0
- package/vendor/better-sqlite3-win32-x64-node22/src/objects/statement.cpp +383 -0
- package/vendor/better-sqlite3-win32-x64-node22/src/objects/statement.hpp +58 -0
- package/vendor/better-sqlite3-win32-x64-node22/src/util/bind-map.cpp +73 -0
- package/vendor/better-sqlite3-win32-x64-node22/src/util/binder.cpp +193 -0
- package/vendor/better-sqlite3-win32-x64-node22/src/util/constants.cpp +172 -0
- package/vendor/better-sqlite3-win32-x64-node22/src/util/custom-aggregate.cpp +121 -0
- package/vendor/better-sqlite3-win32-x64-node22/src/util/custom-function.cpp +59 -0
- package/vendor/better-sqlite3-win32-x64-node22/src/util/custom-table.cpp +409 -0
- package/vendor/better-sqlite3-win32-x64-node22/src/util/data-converter.cpp +17 -0
- package/vendor/better-sqlite3-win32-x64-node22/src/util/data.cpp +194 -0
- package/vendor/better-sqlite3-win32-x64-node22/src/util/helpers.cpp +109 -0
- package/vendor/better-sqlite3-win32-x64-node22/src/util/macros.cpp +83 -0
- package/vendor/better-sqlite3-win32-x64-node22/src/util/query-macros.cpp +71 -0
- package/vendor/better-sqlite3-win32-x64-node22/src/util/row-builder.cpp +49 -0
- package/vendor/node-pty-fork/README.md +1 -0
- package/vendor/node-pty-fork/scripts/runtime-install-context.cjs +24 -0
- package/vendor/node-pty-fork/scripts/verify-runtime.cjs +8 -0
- package/vendor/node-pty-fork/scripts/verify-runtime.test.cjs +30 -0
- package/vendor-src/better-sqlite3-win32-x64-node22/README.md +12 -0
- package/dist/public/assets/App-B0q8uDA-.js +0 -30
- package/dist/public/assets/DesktopWindowPage-BdKUZrKG.js +0 -2
- package/dist/public/assets/FileContextPanel-lM5mBcfn.js +0 -1
- package/dist/public/assets/GitSidebar-CmXAhyjo.js +0 -6
- package/dist/public/assets/MobileCreateSessionSheet-CceV0-AH.js +0 -1
- package/dist/public/assets/MobileWorkspaceSwitcherHeader-DhaM9fgx.js +0 -1
- package/dist/public/assets/ServerSettingsModal-Rkgn3jft.js +0 -1
- package/dist/public/assets/SessionIndexPage-BOumP3ij.js +0 -1
- package/dist/public/assets/SettingsPage-vx_c-00-.js +0 -2
- package/dist/public/assets/TerminalManagerPanel-D9JHCS6d.js +0 -1
- package/dist/public/assets/TerminalRuntimeFallbackModal-W5NjqFEz.js +0 -1
- package/dist/public/assets/ToolFilesPage-DWtpaN_7.js +0 -1
- package/dist/public/assets/ToolGitPage-MpGXsw4_.js +0 -1
- package/dist/public/assets/ToolProcessesPage-B1jHQKhZ.js +0 -1
- package/dist/public/assets/ToolsHomePage-CJrn8ZFl.js +0 -1
- package/dist/public/assets/WorkbenchLandingPage-CJQ1V5U-.js +0 -1
- package/dist/public/assets/WorkbenchLayout-D48i71PU.js +0 -244
- package/dist/public/assets/WorkbenchModal-BYNuMIoV.js +0 -1
- package/dist/public/assets/WorkbenchShellRoute-CGKjy4J-.js +0 -1
- package/dist/public/assets/WorkspaceDebugDetailPage-DCAYgays.js +0 -1
- package/dist/public/assets/WorkspaceDetailPage-D5v-nUIi.js +0 -1
- package/dist/public/assets/WorkspaceHomePage-I5G1p5SR.js +0 -1
- package/dist/public/assets/file-tree-icon-BFwaPxKs.js +0 -590
- package/dist/public/assets/index-CjewzOUG.js +0 -42
- package/dist/public/assets/model-switch-api-Br0ivfe5.js +0 -1
- package/dist/public/assets/realtime-client-BlQRqVmm.js +0 -1
- package/dist/public/assets/useRegisteredDebugTemplates-CXmxu69X.js +0 -1
package/scripts/postinstall.mjs
CHANGED
|
@@ -12,6 +12,11 @@ const cliVersionRange = packageJson.dependencies?.["@openai/codex"];
|
|
|
12
12
|
const sdkVersionRange = packageJson.dependencies?.["@openai/codex-sdk"];
|
|
13
13
|
const sessionSyncCoreRange = packageJson.dependencies?.["@codingns/session-sync-core"];
|
|
14
14
|
const windowsNodePtyRange = packageJson.optionalDependencies?.["@codingns/node-pty"];
|
|
15
|
+
const betterSqliteRuntimeRange =
|
|
16
|
+
packageJson.codingnsRuntimeDependencies?.betterSqlite3 ??
|
|
17
|
+
packageJson.optionalDependencies?.["better-sqlite3"] ??
|
|
18
|
+
packageJson.dependencies?.["better-sqlite3"];
|
|
19
|
+
const windowsBetterSqlitePackageSpec = packageJson.codingnsWindowsRuntimePackages?.betterSqlite3;
|
|
15
20
|
|
|
16
21
|
if (!sdkVersionRange) {
|
|
17
22
|
logInfo("[codingns] 未声明 @openai/codex-sdk,跳过 Codex 安装校验");
|
|
@@ -34,6 +39,10 @@ if (!verifyPtyRuntimeDependency()) {
|
|
|
34
39
|
process.exit(1);
|
|
35
40
|
}
|
|
36
41
|
|
|
42
|
+
if (!(await ensureBetterSqliteRuntimeDependency())) {
|
|
43
|
+
process.exit(1);
|
|
44
|
+
}
|
|
45
|
+
|
|
37
46
|
if (await verifyCodexRuntime()) {
|
|
38
47
|
logInfo("[codingns] Codex 运行时依赖已就绪");
|
|
39
48
|
process.exit(0);
|
|
@@ -47,14 +56,7 @@ if (process.env.CODINGNS_SKIP_POSTINSTALL_REENTRY === "1") {
|
|
|
47
56
|
logInfo("[codingns] 正在修复 Codex SDK 与当前平台二进制,请稍候...");
|
|
48
57
|
cleanupBrokenCodexPackages();
|
|
49
58
|
|
|
50
|
-
const repairResult =
|
|
51
|
-
"install",
|
|
52
|
-
"--no-save",
|
|
53
|
-
"--include=optional",
|
|
54
|
-
"--package-lock=false",
|
|
55
|
-
cliVersionRange ? `@openai/codex@${cliVersionRange}` : null,
|
|
56
|
-
`@openai/codex-sdk@${sdkVersionRange}`
|
|
57
|
-
].filter(Boolean));
|
|
59
|
+
const repairResult = repairCodexRuntime();
|
|
58
60
|
|
|
59
61
|
if (repairResult.status !== 0) {
|
|
60
62
|
process.exit(repairResult.status ?? 1);
|
|
@@ -91,6 +93,79 @@ function verifyPtyRuntimeDependency() {
|
|
|
91
93
|
return true;
|
|
92
94
|
}
|
|
93
95
|
|
|
96
|
+
|
|
97
|
+
async function ensureBetterSqliteRuntimeDependency() {
|
|
98
|
+
let packageJsonPath = resolveModuleExportFile("better-sqlite3", "package.json");
|
|
99
|
+
|
|
100
|
+
if (!packageJsonPath) {
|
|
101
|
+
const installSpec = resolveBetterSqliteInstallSpec();
|
|
102
|
+
|
|
103
|
+
if (!installSpec) {
|
|
104
|
+
console.error(
|
|
105
|
+
`[codingns] 未找到 SQLite 运行时依赖:better-sqlite3${betterSqliteRuntimeRange ? `(默认上游版本 ${betterSqliteRuntimeRange})` : ""}`
|
|
106
|
+
);
|
|
107
|
+
return false;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
if (process.env.CODINGNS_SKIP_POSTINSTALL_REENTRY === "1") {
|
|
111
|
+
console.error(`[codingns] SQLite 运行时依赖修复后仍然缺失:${installSpec}`);
|
|
112
|
+
return false;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
logInfo(`[codingns] 正在补装 SQLite 运行时依赖:${installSpec}`);
|
|
116
|
+
if (isWindowsManagedBetterSqliteInstallSpec(installSpec)) {
|
|
117
|
+
if (!copyManagedBetterSqliteRuntime(installSpec)) {
|
|
118
|
+
return false;
|
|
119
|
+
}
|
|
120
|
+
} else {
|
|
121
|
+
const installResult = runNpmInstall([
|
|
122
|
+
"install",
|
|
123
|
+
"--no-save",
|
|
124
|
+
"--package-lock=false",
|
|
125
|
+
"--install-strategy=nested",
|
|
126
|
+
installSpec
|
|
127
|
+
]);
|
|
128
|
+
|
|
129
|
+
if (installResult.status !== 0) {
|
|
130
|
+
return false;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
packageJsonPath = resolveModuleExportFile("better-sqlite3", "package.json");
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
if (!packageJsonPath) {
|
|
138
|
+
console.error(
|
|
139
|
+
`[codingns] 未找到 SQLite 运行时依赖:better-sqlite3${betterSqliteRuntimeRange ? `(默认上游版本 ${betterSqliteRuntimeRange})` : ""}`
|
|
140
|
+
);
|
|
141
|
+
return false;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
const sqlitePackageRoot = findPackageRoot(packageJsonPath) ?? path.dirname(packageJsonPath);
|
|
145
|
+
const sqlitePackageJsonPath = path.join(sqlitePackageRoot, "package.json");
|
|
146
|
+
const packageVersion = readPackageVersion(sqlitePackageJsonPath);
|
|
147
|
+
const actualPackageName = readPackageName(sqlitePackageJsonPath) || "better-sqlite3";
|
|
148
|
+
const packageSummary = packageVersion
|
|
149
|
+
? `${actualPackageName}@${packageVersion}`
|
|
150
|
+
: actualPackageName;
|
|
151
|
+
|
|
152
|
+
if (actualPackageName !== "better-sqlite3") {
|
|
153
|
+
console.error(
|
|
154
|
+
`[codingns] 当前平台需要 better-sqlite3,但实际解析到了 ${actualPackageName},说明安装结果混入了错误的平台包`
|
|
155
|
+
);
|
|
156
|
+
return false;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
const nativeBindingPath = path.join(sqlitePackageRoot, "build", "Release", "better_sqlite3.node");
|
|
160
|
+
if (!fs.existsSync(nativeBindingPath)) {
|
|
161
|
+
console.error(`[codingns] SQLite 运行时缺少预编译产物:${actualPackageName}`);
|
|
162
|
+
return false;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
logInfo(`[codingns] SQLite 运行时依赖已就绪:${packageSummary}`);
|
|
166
|
+
return true;
|
|
167
|
+
}
|
|
168
|
+
|
|
94
169
|
async function verifyCodexRuntime() {
|
|
95
170
|
try {
|
|
96
171
|
const sdkEntryPath =
|
|
@@ -138,6 +213,101 @@ async function verifyCodexRuntime() {
|
|
|
138
213
|
}
|
|
139
214
|
}
|
|
140
215
|
|
|
216
|
+
|
|
217
|
+
|
|
218
|
+
function repairCodexRuntime() {
|
|
219
|
+
const installRoot = fs.mkdtempSync(path.join(packageRoot, ".codingns-codex-repair-"));
|
|
220
|
+
|
|
221
|
+
try {
|
|
222
|
+
const result = runNpmInstall([
|
|
223
|
+
"install",
|
|
224
|
+
"--no-save",
|
|
225
|
+
"--omit=optional",
|
|
226
|
+
"--package-lock=false",
|
|
227
|
+
...resolveCodexRepairInstallSpecs()
|
|
228
|
+
], {
|
|
229
|
+
prefix: installRoot,
|
|
230
|
+
cwd: installRoot
|
|
231
|
+
});
|
|
232
|
+
|
|
233
|
+
if (result.status !== 0) {
|
|
234
|
+
return result;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
copyRepairedCodexPackages(installRoot);
|
|
238
|
+
return result;
|
|
239
|
+
} finally {
|
|
240
|
+
fs.rmSync(installRoot, { recursive: true, force: true });
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
function copyRepairedCodexPackages(installRoot) {
|
|
245
|
+
const sourceOpenAiRoot = path.join(installRoot, "node_modules", "@openai");
|
|
246
|
+
const targetNodeModulesRoot = path.join(packageRoot, "node_modules");
|
|
247
|
+
const targetOpenAiRoot = path.join(targetNodeModulesRoot, "@openai");
|
|
248
|
+
const targetBinRoot = path.join(targetNodeModulesRoot, ".bin");
|
|
249
|
+
|
|
250
|
+
if (!fs.existsSync(sourceOpenAiRoot)) {
|
|
251
|
+
throw new Error(`[codingns] Codex 修复结果缺少 @openai 包目录:${sourceOpenAiRoot}`);
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
fs.rmSync(targetOpenAiRoot, { recursive: true, force: true });
|
|
255
|
+
fs.mkdirSync(targetNodeModulesRoot, { recursive: true });
|
|
256
|
+
fs.cpSync(sourceOpenAiRoot, targetOpenAiRoot, { recursive: true });
|
|
257
|
+
|
|
258
|
+
copyRepairedCodexBin(installRoot, targetBinRoot);
|
|
259
|
+
logInfo(`[codingns] Codex 运行时依赖已复制到:${targetOpenAiRoot}`);
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
function copyRepairedCodexBin(installRoot, targetBinRoot) {
|
|
263
|
+
const sourceBinRoot = path.join(installRoot, "node_modules", ".bin");
|
|
264
|
+
|
|
265
|
+
fs.mkdirSync(targetBinRoot, { recursive: true });
|
|
266
|
+
for (const fileName of ["codex", "codex.cmd", "codex.ps1"]) {
|
|
267
|
+
const sourcePath = path.join(sourceBinRoot, fileName);
|
|
268
|
+
const targetPath = path.join(targetBinRoot, fileName);
|
|
269
|
+
|
|
270
|
+
fs.rmSync(targetPath, { force: true });
|
|
271
|
+
if (fs.existsSync(sourcePath)) {
|
|
272
|
+
fs.cpSync(sourcePath, targetPath);
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
function resolveCodexRepairInstallSpecs() {
|
|
278
|
+
const specs = [
|
|
279
|
+
cliVersionRange ? `@openai/codex@${cliVersionRange}` : null,
|
|
280
|
+
`@openai/codex-sdk@${sdkVersionRange}`,
|
|
281
|
+
resolveCodexPlatformInstallSpec()
|
|
282
|
+
];
|
|
283
|
+
|
|
284
|
+
return specs.filter(Boolean);
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
function resolveCodexPlatformInstallSpec() {
|
|
288
|
+
const platformPackage = resolveCodexPlatformPackageName();
|
|
289
|
+
const platformVersion = resolveCodexPlatformPackageVersion();
|
|
290
|
+
|
|
291
|
+
if (!platformPackage || !platformVersion) {
|
|
292
|
+
return null;
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
return `${platformPackage}@npm:@openai/codex@${platformVersion}`;
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
function resolveCodexPlatformPackageVersion() {
|
|
299
|
+
if (typeof cliVersionRange !== "string") {
|
|
300
|
+
return null;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
const exactVersionMatch = cliVersionRange.match(/^(\d+\.\d+\.\d+(?:[-+][0-9A-Za-z-.]+)?)$/u);
|
|
304
|
+
if (!exactVersionMatch) {
|
|
305
|
+
return null;
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
return `${exactVersionMatch[1]}-${process.platform}-${process.arch}`;
|
|
309
|
+
}
|
|
310
|
+
|
|
141
311
|
function cleanupBrokenCodexPackages() {
|
|
142
312
|
const openAiRoot = path.join(packageRoot, "node_modules", "@openai");
|
|
143
313
|
const binRoot = path.join(packageRoot, "node_modules", ".bin");
|
|
@@ -148,7 +318,7 @@ function cleanupBrokenCodexPackages() {
|
|
|
148
318
|
fs.rmSync(path.join(binRoot, "codex.ps1"), { force: true });
|
|
149
319
|
}
|
|
150
320
|
|
|
151
|
-
function runNpmInstall(args) {
|
|
321
|
+
function runNpmInstall(args, options = {}) {
|
|
152
322
|
const env = {
|
|
153
323
|
...process.env,
|
|
154
324
|
CODINGNS_SKIP_POSTINSTALL_REENTRY: "1",
|
|
@@ -158,11 +328,13 @@ function runNpmInstall(args) {
|
|
|
158
328
|
delete env.npm_config_prefix;
|
|
159
329
|
delete env.npm_command;
|
|
160
330
|
|
|
331
|
+
const installPrefix = options.prefix ?? packageRoot;
|
|
332
|
+
const installCwd = options.cwd ?? packageRoot;
|
|
161
333
|
const installArgs = [
|
|
162
334
|
...args,
|
|
163
335
|
"--global=false",
|
|
164
336
|
"--prefix",
|
|
165
|
-
|
|
337
|
+
installPrefix,
|
|
166
338
|
"--install-strategy=nested"
|
|
167
339
|
];
|
|
168
340
|
|
|
@@ -172,7 +344,7 @@ function runNpmInstall(args) {
|
|
|
172
344
|
);
|
|
173
345
|
|
|
174
346
|
const result = spawnSync(command.file, command.args, {
|
|
175
|
-
cwd:
|
|
347
|
+
cwd: installCwd,
|
|
176
348
|
env,
|
|
177
349
|
stdio: "inherit"
|
|
178
350
|
});
|
|
@@ -362,6 +534,71 @@ function readPackageVersion(packageJsonPath) {
|
|
|
362
534
|
}
|
|
363
535
|
}
|
|
364
536
|
|
|
537
|
+
function readPackageName(packageJsonPath) {
|
|
538
|
+
try {
|
|
539
|
+
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, "utf8"));
|
|
540
|
+
return typeof packageJson?.name === "string" ? packageJson.name : "";
|
|
541
|
+
} catch {
|
|
542
|
+
return "";
|
|
543
|
+
}
|
|
544
|
+
}
|
|
545
|
+
|
|
546
|
+
function resolveBetterSqliteInstallSpec() {
|
|
547
|
+
if (
|
|
548
|
+
process.platform === "win32" &&
|
|
549
|
+
process.arch === "x64" &&
|
|
550
|
+
Number((process.versions.node || "").split(".")[0]) === 22
|
|
551
|
+
) {
|
|
552
|
+
return windowsBetterSqlitePackageSpec ?? null;
|
|
553
|
+
}
|
|
554
|
+
|
|
555
|
+
if (betterSqliteRuntimeRange) {
|
|
556
|
+
return `better-sqlite3@${betterSqliteRuntimeRange}`;
|
|
557
|
+
}
|
|
558
|
+
|
|
559
|
+
return "better-sqlite3";
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
function isWindowsManagedBetterSqliteInstallSpec(installSpec) {
|
|
563
|
+
return (
|
|
564
|
+
process.platform === "win32" &&
|
|
565
|
+
process.arch === "x64" &&
|
|
566
|
+
Number((process.versions.node || "").split(".")[0]) === 22 &&
|
|
567
|
+
typeof installSpec === "string" &&
|
|
568
|
+
installSpec.startsWith("file:")
|
|
569
|
+
);
|
|
570
|
+
}
|
|
571
|
+
|
|
572
|
+
function copyManagedBetterSqliteRuntime(installSpec) {
|
|
573
|
+
const sourceDirectory = resolveFileInstallSpecPath(installSpec);
|
|
574
|
+
if (!sourceDirectory || !fs.existsSync(path.join(sourceDirectory, "package.json"))) {
|
|
575
|
+
console.error(`[codingns] Windows SQLite 受控包不存在:${installSpec}`);
|
|
576
|
+
return false;
|
|
577
|
+
}
|
|
578
|
+
|
|
579
|
+
const sourceBinaryPath = path.join(sourceDirectory, "build", "Release", "better_sqlite3.node");
|
|
580
|
+
if (!fs.existsSync(sourceBinaryPath)) {
|
|
581
|
+
console.error(`[codingns] Windows SQLite 受控包缺少预编译产物:${sourceBinaryPath}`);
|
|
582
|
+
return false;
|
|
583
|
+
}
|
|
584
|
+
|
|
585
|
+
const targetDirectory = path.join(packageRoot, "node_modules", "better-sqlite3");
|
|
586
|
+
fs.rmSync(targetDirectory, { recursive: true, force: true });
|
|
587
|
+
fs.mkdirSync(path.dirname(targetDirectory), { recursive: true });
|
|
588
|
+
fs.cpSync(sourceDirectory, targetDirectory, { recursive: true });
|
|
589
|
+
logInfo(`[codingns] SQLite 运行时依赖已复制到:${targetDirectory}`);
|
|
590
|
+
return true;
|
|
591
|
+
}
|
|
592
|
+
|
|
593
|
+
function resolveFileInstallSpecPath(installSpec) {
|
|
594
|
+
if (typeof installSpec !== "string" || !installSpec.startsWith("file:")) {
|
|
595
|
+
return null;
|
|
596
|
+
}
|
|
597
|
+
|
|
598
|
+
const filePath = installSpec.slice("file:".length);
|
|
599
|
+
return path.resolve(packageRoot, filePath);
|
|
600
|
+
}
|
|
601
|
+
|
|
365
602
|
function resolveRequiredPtyPackageName() {
|
|
366
603
|
if (
|
|
367
604
|
process.platform === "win32" &&
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2017 Joshua Wise
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# `better-sqlite3`(CodingNS Windows 受控包)
|
|
2
|
+
|
|
3
|
+
这是 CodingNS 自维护的 `better-sqlite3` Windows 运行时包。
|
|
4
|
+
|
|
5
|
+
目标很窄:
|
|
6
|
+
|
|
7
|
+
- 只支持 `win32 + x64 + Node 22`
|
|
8
|
+
- 包名保持 `better-sqlite3`,这样 npm 安装时不会再把“依赖名”和“真实包名”装成两套
|
|
9
|
+
- 只给 `@jingyi0605/codingns` 的正式安装使用
|
|
10
|
+
- 不接受安装阶段再回退到本机 `node-gyp rebuild`
|
|
11
|
+
|
|
12
|
+
它不是通用发布包,也不是给工作区开发时直接依赖的源码包。
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
# better-sqlite3 [](https://github.com/JoshuaWise/better-sqlite3/actions/workflows/build.yml?query=branch%3Amaster)
|
|
2
|
+
|
|
3
|
+
The fastest and simplest library for SQLite in Node.js.
|
|
4
|
+
|
|
5
|
+
- Full transaction support
|
|
6
|
+
- High performance, efficiency, and safety
|
|
7
|
+
- Easy-to-use synchronous API *(better concurrency than an asynchronous API... yes, you read that correctly)*
|
|
8
|
+
- Support for user-defined functions, aggregates, virtual tables, and extensions
|
|
9
|
+
- 64-bit integers *(invisible until you need them)*
|
|
10
|
+
- Worker thread support *(for large/slow queries)*
|
|
11
|
+
|
|
12
|
+
## Help this project stay strong! 💪
|
|
13
|
+
|
|
14
|
+
`better-sqlite3` is used by thousands of developers and engineers on a daily basis. Long nights and weekends were spent keeping this project strong and dependable, with no ask for compensation or funding, until now. If your company uses `better-sqlite3`, ask your manager to consider supporting the project:
|
|
15
|
+
|
|
16
|
+
- [Become a GitHub sponsor](https://github.com/sponsors/JoshuaWise)
|
|
17
|
+
- [Become a backer on Patreon](https://www.patreon.com/joshuawise)
|
|
18
|
+
- [Make a one-time donation on PayPal](https://www.paypal.me/joshuathomaswise)
|
|
19
|
+
|
|
20
|
+
## How other libraries compare
|
|
21
|
+
|
|
22
|
+
| |select 1 row `get()` |select 100 rows `all()` |select 100 rows `iterate()` 1-by-1|insert 1 row `run()`|insert 100 rows in a transaction|
|
|
23
|
+
|---|---|---|---|---|---|
|
|
24
|
+
|better-sqlite3|1x|1x|1x|1x|1x|
|
|
25
|
+
|[sqlite](https://www.npmjs.com/package/sqlite) and [sqlite3](https://www.npmjs.com/package/sqlite3)|11.7x slower|2.9x slower|24.4x slower|2.8x slower|15.6x slower|
|
|
26
|
+
|
|
27
|
+
> You can verify these results by [running the benchmark yourself](./docs/benchmark.md).
|
|
28
|
+
|
|
29
|
+
## Installation
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
npm install better-sqlite3
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
> Requires a [currently supported Node.js](https://nodejs.org/en/about/previous-releases) version. Prebuilt binaries are available for [LTS versions](https://nodejs.org/en/about/previous-releases). If you have trouble installing, check the [troubleshooting guide](./docs/troubleshooting.md).
|
|
36
|
+
|
|
37
|
+
## Usage
|
|
38
|
+
|
|
39
|
+
```js
|
|
40
|
+
const db = require('better-sqlite3')('foobar.db', options);
|
|
41
|
+
|
|
42
|
+
const row = db.prepare('SELECT * FROM users WHERE id = ?').get(userId);
|
|
43
|
+
console.log(row.firstName, row.lastName, row.email);
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
Though not required, [it is generally important to set the WAL pragma for performance reasons](https://github.com/WiseLibs/better-sqlite3/blob/master/docs/performance.md).
|
|
47
|
+
|
|
48
|
+
```js
|
|
49
|
+
db.pragma('journal_mode = WAL');
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
##### In ES6 module notation:
|
|
53
|
+
|
|
54
|
+
```js
|
|
55
|
+
import Database from 'better-sqlite3';
|
|
56
|
+
const db = new Database('foobar.db', options);
|
|
57
|
+
db.pragma('journal_mode = WAL');
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Why should I use this instead of [node-sqlite3](https://github.com/mapbox/node-sqlite3)?
|
|
61
|
+
|
|
62
|
+
- `node-sqlite3` uses asynchronous APIs for tasks that are either CPU-bound or serialized. That's not only bad design, but it wastes tons of resources. It also causes [mutex thrashing](https://en.wikipedia.org/wiki/Resource_contention) which has devastating effects on performance.
|
|
63
|
+
- `node-sqlite3` exposes low-level (C language) memory management functions. `better-sqlite3` does it the JavaScript way, allowing the garbage collector to worry about memory management.
|
|
64
|
+
- `better-sqlite3` is simpler to use, and it provides nice utilities for some operations that are very difficult or impossible in `node-sqlite3`.
|
|
65
|
+
- `better-sqlite3` is much faster than `node-sqlite3` in most cases, and just as fast in all other cases.
|
|
66
|
+
|
|
67
|
+
#### When is this library not appropriate?
|
|
68
|
+
|
|
69
|
+
In most cases, if you're attempting something that cannot be reasonably accomplished with `better-sqlite3`, it probably cannot be reasonably accomplished with SQLite in general. For example, if you're executing queries that take one second to complete, and you expect to have many concurrent users executing those queries, no amount of asynchronicity will save you from SQLite's serialized nature. Fortunately, SQLite is very *very* fast. With proper indexing, we've been able to achieve upward of 2000 queries per second with 5-way-joins in a 60 GB database, where each query was handling 5–50 kilobytes of real data.
|
|
70
|
+
|
|
71
|
+
If you have a performance problem, the most likely causes are inefficient queries, improper indexing, or a lack of [WAL mode](./docs/performance.md)—not `better-sqlite3` itself. However, there are some cases where `better-sqlite3` could be inappropriate:
|
|
72
|
+
|
|
73
|
+
- If you expect a high volume of concurrent reads each returning many megabytes of data (i.e., videos)
|
|
74
|
+
- If you expect a high volume of concurrent writes (i.e., a social media site)
|
|
75
|
+
- If your database's size is near the terabyte range
|
|
76
|
+
|
|
77
|
+
For these situations, you should probably use a full-fledged RDBMS such as [PostgreSQL](https://www.postgresql.org/).
|
|
78
|
+
|
|
79
|
+
## Upgrading
|
|
80
|
+
|
|
81
|
+
Upgrading your `better-sqlite3` dependency can potentially introduce breaking changes, either in the `better-sqlite3` API (if you upgrade to a new [major version](https://semver.org/)), or between your existing database(s) and the underlying version of SQLite. Before upgrading, review:
|
|
82
|
+
|
|
83
|
+
* [`better-sqlite3` release notes](https://github.com/WiseLibs/better-sqlite3/releases)
|
|
84
|
+
* [SQLite release history](https://www.sqlite.org/changes.html)
|
|
85
|
+
|
|
86
|
+
# Documentation
|
|
87
|
+
|
|
88
|
+
- [API documentation](./docs/api.md)
|
|
89
|
+
- [Performance](./docs/performance.md) (also see [benchmark results](./docs/benchmark.md))
|
|
90
|
+
- [64-bit integer support](./docs/integer.md)
|
|
91
|
+
- [Worker thread support](./docs/threads.md)
|
|
92
|
+
- [Unsafe mode (advanced)](./docs/unsafe.md)
|
|
93
|
+
- [SQLite compilation (advanced)](./docs/compilation.md)
|
|
94
|
+
- [Contribution rules](./docs/contribution.md)
|
|
95
|
+
- [Code of conduct](./docs/conduct.md)
|
|
96
|
+
|
|
97
|
+
# License
|
|
98
|
+
|
|
99
|
+
[MIT](./LICENSE)
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# ===
|
|
2
|
+
# This is the main GYP file, which builds better-sqlite3 with SQLite itself.
|
|
3
|
+
# ===
|
|
4
|
+
|
|
5
|
+
{
|
|
6
|
+
'includes': ['deps/common.gypi'],
|
|
7
|
+
'targets': [
|
|
8
|
+
{
|
|
9
|
+
'target_name': 'better_sqlite3',
|
|
10
|
+
'dependencies': ['deps/sqlite3.gyp:sqlite3'],
|
|
11
|
+
'sources': ['src/better_sqlite3.cpp'],
|
|
12
|
+
'cflags_cc': ['-std=c++20'],
|
|
13
|
+
'xcode_settings': {
|
|
14
|
+
'OTHER_CPLUSPLUSFLAGS': ['-std=c++20', '-stdlib=libc++'],
|
|
15
|
+
},
|
|
16
|
+
'msvs_settings': {
|
|
17
|
+
'VCCLCompilerTool': {
|
|
18
|
+
'AdditionalOptions': [
|
|
19
|
+
'/std:c++20',
|
|
20
|
+
],
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
'conditions': [
|
|
24
|
+
['OS=="linux"', {
|
|
25
|
+
'ldflags': [
|
|
26
|
+
'-Wl,-Bsymbolic',
|
|
27
|
+
'-Wl,--exclude-libs,ALL',
|
|
28
|
+
],
|
|
29
|
+
}],
|
|
30
|
+
],
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
'target_name': 'test_extension',
|
|
34
|
+
'dependencies': ['deps/sqlite3.gyp:sqlite3'],
|
|
35
|
+
'conditions': [['sqlite3 == ""', { 'sources': ['deps/test_extension.c'] }]],
|
|
36
|
+
},
|
|
37
|
+
],
|
|
38
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
# ===
|
|
2
|
+
# This configuration defines the differences between Release and Debug builds.
|
|
3
|
+
# Some miscellaneous Windows settings are also defined here.
|
|
4
|
+
# ===
|
|
5
|
+
|
|
6
|
+
{
|
|
7
|
+
'variables': { 'sqlite3%': '' },
|
|
8
|
+
'target_defaults': {
|
|
9
|
+
'default_configuration': 'Release',
|
|
10
|
+
'msvs_settings': {
|
|
11
|
+
'VCCLCompilerTool': {
|
|
12
|
+
'ExceptionHandling': 1,
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
'conditions': [
|
|
16
|
+
['OS == "win"', {
|
|
17
|
+
'defines': ['WIN32'],
|
|
18
|
+
}],
|
|
19
|
+
],
|
|
20
|
+
'configurations': {
|
|
21
|
+
'Debug': {
|
|
22
|
+
'defines!': [
|
|
23
|
+
'NDEBUG',
|
|
24
|
+
],
|
|
25
|
+
'defines': [
|
|
26
|
+
'DEBUG',
|
|
27
|
+
'_DEBUG',
|
|
28
|
+
'SQLITE_DEBUG',
|
|
29
|
+
'SQLITE_MEMDEBUG',
|
|
30
|
+
'SQLITE_ENABLE_API_ARMOR',
|
|
31
|
+
'SQLITE_WIN32_MALLOC_VALIDATE',
|
|
32
|
+
],
|
|
33
|
+
'cflags': [
|
|
34
|
+
'-O0',
|
|
35
|
+
],
|
|
36
|
+
'xcode_settings': {
|
|
37
|
+
'MACOSX_DEPLOYMENT_TARGET': '10.7',
|
|
38
|
+
'GCC_OPTIMIZATION_LEVEL': '0',
|
|
39
|
+
'GCC_GENERATE_DEBUGGING_SYMBOLS': 'YES',
|
|
40
|
+
},
|
|
41
|
+
'msvs_settings': {
|
|
42
|
+
'VCLinkerTool': {
|
|
43
|
+
'GenerateDebugInformation': 'true',
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
'Release': {
|
|
48
|
+
'defines!': [
|
|
49
|
+
'DEBUG',
|
|
50
|
+
'_DEBUG',
|
|
51
|
+
],
|
|
52
|
+
'defines': [
|
|
53
|
+
'NDEBUG',
|
|
54
|
+
],
|
|
55
|
+
'cflags': [
|
|
56
|
+
'-O3',
|
|
57
|
+
],
|
|
58
|
+
'xcode_settings': {
|
|
59
|
+
'MACOSX_DEPLOYMENT_TARGET': '10.7',
|
|
60
|
+
'GCC_OPTIMIZATION_LEVEL': '3',
|
|
61
|
+
'GCC_GENERATE_DEBUGGING_SYMBOLS': 'NO',
|
|
62
|
+
'DEAD_CODE_STRIPPING': 'YES',
|
|
63
|
+
'GCC_INLINES_ARE_PRIVATE_EXTERN': 'YES',
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
const path = require('path');
|
|
3
|
+
const fs = require('fs');
|
|
4
|
+
|
|
5
|
+
const dest = process.argv[2];
|
|
6
|
+
const source = path.resolve(path.sep, process.argv[3] || path.join(__dirname, 'sqlite3'));
|
|
7
|
+
const files = [
|
|
8
|
+
{ filename: 'sqlite3.c', optional: false },
|
|
9
|
+
{ filename: 'sqlite3.h', optional: false },
|
|
10
|
+
];
|
|
11
|
+
|
|
12
|
+
if (process.argv[3]) {
|
|
13
|
+
// Support "_HAVE_SQLITE_CONFIG_H" in custom builds.
|
|
14
|
+
files.push({ filename: 'config.h', optional: true });
|
|
15
|
+
} else {
|
|
16
|
+
// Required for some tests.
|
|
17
|
+
files.push({ filename: 'sqlite3ext.h', optional: false });
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
for (const { filename, optional } of files) {
|
|
21
|
+
const sourceFilepath = path.join(source, filename);
|
|
22
|
+
const destFilepath = path.join(dest, filename);
|
|
23
|
+
|
|
24
|
+
if (optional && !fs.existsSync(sourceFilepath)) {
|
|
25
|
+
continue;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
fs.accessSync(sourceFilepath);
|
|
29
|
+
fs.mkdirSync(path.dirname(destFilepath), { recursive: true });
|
|
30
|
+
fs.copyFileSync(sourceFilepath, destFilepath);
|
|
31
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# THIS FILE IS AUTOMATICALLY GENERATED BY deps/download.sh (DO NOT EDIT)
|
|
2
|
+
|
|
3
|
+
{
|
|
4
|
+
'defines': [
|
|
5
|
+
'HAVE_INT16_T=1',
|
|
6
|
+
'HAVE_INT32_T=1',
|
|
7
|
+
'HAVE_INT8_T=1',
|
|
8
|
+
'HAVE_STDINT_H=1',
|
|
9
|
+
'HAVE_UINT16_T=1',
|
|
10
|
+
'HAVE_UINT32_T=1',
|
|
11
|
+
'HAVE_UINT8_T=1',
|
|
12
|
+
'HAVE_USLEEP=1',
|
|
13
|
+
'SQLITE_DEFAULT_CACHE_SIZE=-16000',
|
|
14
|
+
'SQLITE_DEFAULT_FOREIGN_KEYS=1',
|
|
15
|
+
'SQLITE_DEFAULT_MEMSTATUS=0',
|
|
16
|
+
'SQLITE_DEFAULT_WAL_SYNCHRONOUS=1',
|
|
17
|
+
'SQLITE_DQS=0',
|
|
18
|
+
'SQLITE_ENABLE_COLUMN_METADATA',
|
|
19
|
+
'SQLITE_ENABLE_DBSTAT_VTAB',
|
|
20
|
+
'SQLITE_ENABLE_DESERIALIZE',
|
|
21
|
+
'SQLITE_ENABLE_FTS3',
|
|
22
|
+
'SQLITE_ENABLE_FTS3_PARENTHESIS',
|
|
23
|
+
'SQLITE_ENABLE_FTS4',
|
|
24
|
+
'SQLITE_ENABLE_FTS5',
|
|
25
|
+
'SQLITE_ENABLE_GEOPOLY',
|
|
26
|
+
'SQLITE_ENABLE_JSON1',
|
|
27
|
+
'SQLITE_ENABLE_MATH_FUNCTIONS',
|
|
28
|
+
'SQLITE_ENABLE_RTREE',
|
|
29
|
+
'SQLITE_ENABLE_STAT4',
|
|
30
|
+
'SQLITE_ENABLE_UPDATE_DELETE_LIMIT',
|
|
31
|
+
'SQLITE_LIKE_DOESNT_MATCH_BLOBS',
|
|
32
|
+
'SQLITE_OMIT_DEPRECATED',
|
|
33
|
+
'SQLITE_OMIT_PROGRESS_CALLBACK',
|
|
34
|
+
'SQLITE_OMIT_SHARED_CACHE',
|
|
35
|
+
'SQLITE_OMIT_TCL_VARIABLE',
|
|
36
|
+
'SQLITE_SOUNDEX',
|
|
37
|
+
'SQLITE_THREADSAFE=2',
|
|
38
|
+
'SQLITE_TRACE_SIZE_LIMIT=32',
|
|
39
|
+
'SQLITE_USE_URI=0',
|
|
40
|
+
],
|
|
41
|
+
}
|