@plures/pluresdb 1.6.10 → 2.9.6
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/README.md +97 -289
- package/crates/README.md +99 -0
- package/crates/pluresdb-node/README.md +181 -0
- package/crates/pluresdb-node/index.d.ts +0 -0
- package/crates/pluresdb-node/index.js +265 -0
- package/crates/pluresdb-node/package.json +35 -0
- package/dist/napi/index.js +60 -0
- package/embedded.d.ts +1 -0
- package/embedded.js +46 -0
- package/package.json +20 -9
- package/dist/.tsbuildinfo +0 -1
- package/dist/better-sqlite3-shared.d.ts +0 -12
- package/dist/better-sqlite3-shared.d.ts.map +0 -1
- package/dist/better-sqlite3-shared.js +0 -143
- package/dist/better-sqlite3-shared.js.map +0 -1
- package/dist/better-sqlite3.d.ts +0 -4
- package/dist/better-sqlite3.d.ts.map +0 -1
- package/dist/better-sqlite3.js +0 -8
- package/dist/better-sqlite3.js.map +0 -1
- package/dist/cli.d.ts +0 -7
- package/dist/cli.d.ts.map +0 -1
- package/dist/cli.js.map +0 -1
- package/dist/local-first/unified-api.d.ts +0 -110
- package/dist/local-first/unified-api.d.ts.map +0 -1
- package/dist/local-first/unified-api.js +0 -348
- package/dist/local-first/unified-api.js.map +0 -1
- package/dist/node-index.d.ts +0 -150
- package/dist/node-index.d.ts.map +0 -1
- package/dist/node-index.js +0 -668
- package/dist/node-index.js.map +0 -1
- package/dist/node-wrapper.d.ts +0 -44
- package/dist/node-wrapper.d.ts.map +0 -1
- package/dist/node-wrapper.js +0 -296
- package/dist/node-wrapper.js.map +0 -1
- package/dist/types/index.d.ts +0 -28
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/index.js +0 -3
- package/dist/types/index.js.map +0 -1
- package/dist/types/node-types.d.ts +0 -71
- package/dist/types/node-types.d.ts.map +0 -1
- package/dist/types/node-types.js +0 -6
- package/dist/types/node-types.js.map +0 -1
- package/dist/util/debug.d.ts +0 -3
- package/dist/util/debug.d.ts.map +0 -1
- package/dist/util/debug.js +0 -34
- package/dist/util/debug.js.map +0 -1
- package/dist/vscode/extension.d.ts +0 -81
- package/dist/vscode/extension.d.ts.map +0 -1
- package/dist/vscode/extension.js +0 -309
- package/dist/vscode/extension.js.map +0 -1
- package/examples/basic-usage.d.ts +0 -2
- package/examples/basic-usage.d.ts.map +0 -1
- package/examples/basic-usage.js +0 -26
- package/examples/basic-usage.js.map +0 -1
- package/examples/basic-usage.ts +0 -29
- package/examples/browser-demo/README.md +0 -204
- package/examples/browser-demo/index.html +0 -466
- package/examples/browser-wasm-integration.md +0 -411
- package/examples/ipc-demo/README.md +0 -127
- package/examples/local-first-usage.ts +0 -138
- package/examples/native-ipc-integration.md +0 -526
- package/examples/tauri-demo/README.md +0 -240
- package/examples/tauri-integration.md +0 -260
- package/examples/vscode-extension-example/README.md +0 -95
- package/examples/vscode-extension-example/package.json +0 -49
- package/examples/vscode-extension-example/src/extension.ts +0 -172
- package/examples/vscode-extension-example/tsconfig.json +0 -12
- package/examples/vscode-extension-integration.d.ts +0 -31
- package/examples/vscode-extension-integration.d.ts.map +0 -1
- package/examples/vscode-extension-integration.js +0 -319
- package/examples/vscode-extension-integration.js.map +0 -1
- package/examples/vscode-extension-integration.ts +0 -41
- package/legacy/benchmarks/memory-benchmarks.ts +0 -350
- package/legacy/benchmarks/run-benchmarks.ts +0 -315
- package/legacy/better-sqlite3-shared.ts +0 -157
- package/legacy/better-sqlite3.ts +0 -4
- package/legacy/cli.ts +0 -241
- package/legacy/config.ts +0 -50
- package/legacy/core/crdt.ts +0 -107
- package/legacy/core/database.ts +0 -529
- package/legacy/healthcheck.ts +0 -162
- package/legacy/http/api-server.ts +0 -569
- package/legacy/index.ts +0 -31
- package/legacy/local-first/unified-api.ts +0 -449
- package/legacy/logic/rules.ts +0 -46
- package/legacy/main.rs +0 -3
- package/legacy/main.ts +0 -197
- package/legacy/network/websocket-server.ts +0 -115
- package/legacy/node-index.ts +0 -827
- package/legacy/node-wrapper.ts +0 -329
- package/legacy/plugins/README.md +0 -181
- package/legacy/plugins/example-embedding-plugin.ts +0 -56
- package/legacy/plugins/plugin-system.ts +0 -315
- package/legacy/sqlite-compat.ts +0 -633
- package/legacy/sqlite3-compat.ts +0 -55
- package/legacy/storage/kv-storage.ts +0 -73
- package/legacy/tests/core.test.ts +0 -305
- package/legacy/tests/fixtures/performance-data.json +0 -71
- package/legacy/tests/fixtures/test-data.json +0 -129
- package/legacy/tests/integration/api-server.test.ts +0 -334
- package/legacy/tests/integration/mesh-network.test.ts +0 -303
- package/legacy/tests/logic.test.ts +0 -34
- package/legacy/tests/performance/load.test.ts +0 -290
- package/legacy/tests/security/input-validation.test.ts +0 -286
- package/legacy/tests/unit/core.test.ts +0 -226
- package/legacy/tests/unit/local-first-api.test.ts +0 -65
- package/legacy/tests/unit/plugin-system.test.ts +0 -388
- package/legacy/tests/unit/subscriptions.test.ts +0 -135
- package/legacy/tests/unit/vector-search.test.ts +0 -173
- package/legacy/tests/vscode_extension_test.ts +0 -281
- package/legacy/types/index.ts +0 -32
- package/legacy/types/node-types.ts +0 -80
- package/legacy/util/debug.ts +0 -27
- package/legacy/vector/index.ts +0 -59
- package/legacy/vscode/extension.ts +0 -387
- package/scripts/compiled-crud-verify.ts +0 -30
- package/scripts/dogfood.ts +0 -297
- package/scripts/postinstall.js +0 -156
- package/scripts/publish-crates.sh +0 -95
- package/scripts/release-check.js +0 -224
- package/scripts/run-tests.ts +0 -178
- package/scripts/setup-libclang.ps1 +0 -209
- package/scripts/update-changelog.js +0 -214
- package/scripts/validate-npm-publish.js +0 -228
- package/web/README.md +0 -27
- package/web/svelte/package.json +0 -31
package/scripts/release-check.js
DELETED
|
@@ -1,224 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Pre-release validation checks
|
|
5
|
-
* Ensures the repository is ready for a release
|
|
6
|
-
*
|
|
7
|
-
* Usage: node scripts/release-check.js
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
const { execSync } = require('child_process');
|
|
11
|
-
const fs = require('fs');
|
|
12
|
-
const path = require('path');
|
|
13
|
-
|
|
14
|
-
function run(cmd, ignoreError = false) {
|
|
15
|
-
try {
|
|
16
|
-
return execSync(cmd, { encoding: 'utf8', stdio: 'pipe' }).trim();
|
|
17
|
-
} catch (e) {
|
|
18
|
-
if (ignoreError) return null;
|
|
19
|
-
throw e;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
function checkGitStatus() {
|
|
24
|
-
console.log('🔍 Checking git status...');
|
|
25
|
-
const status = run('git status --porcelain', true);
|
|
26
|
-
|
|
27
|
-
if (status && status.length > 0) {
|
|
28
|
-
console.warn('⚠️ Warning: Working directory has uncommitted changes');
|
|
29
|
-
console.log(status);
|
|
30
|
-
} else {
|
|
31
|
-
console.log('✅ Working directory is clean');
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
function checkPackageVersions() {
|
|
36
|
-
console.log('\n🔍 Checking package versions...');
|
|
37
|
-
|
|
38
|
-
const packageJson = JSON.parse(fs.readFileSync('package.json', 'utf8'));
|
|
39
|
-
const cargoToml = fs.readFileSync('Cargo.toml', 'utf8');
|
|
40
|
-
|
|
41
|
-
let denoVersion = null;
|
|
42
|
-
if (fs.existsSync('deno.json')) {
|
|
43
|
-
const denoJson = JSON.parse(fs.readFileSync('deno.json', 'utf8'));
|
|
44
|
-
denoVersion = denoJson.version;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
const packageVersion = packageJson.version;
|
|
48
|
-
const cargoMatch = cargoToml.match(/^version\s*=\s*"([^"]+)"/m);
|
|
49
|
-
const cargoVersion = cargoMatch ? cargoMatch[1] : null;
|
|
50
|
-
|
|
51
|
-
console.log(` package.json: ${packageVersion}`);
|
|
52
|
-
console.log(` Cargo.toml: ${cargoVersion || 'not found'}`);
|
|
53
|
-
if (denoVersion) {
|
|
54
|
-
console.log(` deno.json: ${denoVersion}`);
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
let hasError = false;
|
|
58
|
-
|
|
59
|
-
if (cargoVersion && packageVersion !== cargoVersion) {
|
|
60
|
-
console.error('❌ Version mismatch between package.json and Cargo.toml');
|
|
61
|
-
console.error('');
|
|
62
|
-
console.error('To fix this issue:');
|
|
63
|
-
console.error(` 1. Update package.json version from ${packageVersion} to ${cargoVersion}`);
|
|
64
|
-
console.error(` OR update Cargo.toml version from ${cargoVersion} to ${packageVersion}`);
|
|
65
|
-
console.error(' 2. Ensure both files always have the same version number');
|
|
66
|
-
console.error(' 3. Run this check again: npm run release-check');
|
|
67
|
-
console.error('');
|
|
68
|
-
console.error('Note: The version in both files must be identical for releases.');
|
|
69
|
-
hasError = true;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
if (denoVersion && packageVersion !== denoVersion) {
|
|
73
|
-
console.error('❌ Version mismatch between package.json and deno.json');
|
|
74
|
-
console.error('');
|
|
75
|
-
console.error('To fix this issue:');
|
|
76
|
-
console.error(` 1. Update deno.json version from ${denoVersion} to ${packageVersion}`);
|
|
77
|
-
console.error(` OR update package.json version from ${packageVersion} to ${denoVersion}`);
|
|
78
|
-
console.error(' 2. Ensure both files always have the same version number');
|
|
79
|
-
console.error('');
|
|
80
|
-
hasError = true;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
if (hasError) {
|
|
84
|
-
return false;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
console.log('✅ Package versions are consistent');
|
|
88
|
-
return true;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
function checkChangelog() {
|
|
92
|
-
console.log('\n🔍 Checking CHANGELOG.md...');
|
|
93
|
-
|
|
94
|
-
if (!fs.existsSync('CHANGELOG.md')) {
|
|
95
|
-
console.error('❌ CHANGELOG.md not found');
|
|
96
|
-
return false;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
const changelog = fs.readFileSync('CHANGELOG.md', 'utf8');
|
|
100
|
-
const packageJson = JSON.parse(fs.readFileSync('package.json', 'utf8'));
|
|
101
|
-
const currentVersion = packageJson.version;
|
|
102
|
-
|
|
103
|
-
if (!changelog.includes(`## [${currentVersion}]`)) {
|
|
104
|
-
console.warn(`⚠️ Warning: Current version ${currentVersion} not found in CHANGELOG.md`);
|
|
105
|
-
} else {
|
|
106
|
-
console.log(`✅ CHANGELOG.md includes current version ${currentVersion}`);
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
return true;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
function checkCommitMessages() {
|
|
113
|
-
console.log('\n🔍 Checking recent commit messages...');
|
|
114
|
-
|
|
115
|
-
const lastTag = run('git describe --tags --abbrev=0 2>/dev/null', true);
|
|
116
|
-
const range = lastTag ? `${lastTag}..HEAD` : '--all';
|
|
117
|
-
|
|
118
|
-
const commits = run(`git log --format="%s" ${range}`, true);
|
|
119
|
-
|
|
120
|
-
if (!commits) {
|
|
121
|
-
console.log('ℹ️ No commits to check');
|
|
122
|
-
return true;
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
const commitLines = commits.split('\n').filter(Boolean);
|
|
126
|
-
const conventionalTypes = ['feat', 'fix', 'docs', 'style', 'refactor', 'perf', 'test', 'chore', 'ci', 'build', 'revert'];
|
|
127
|
-
|
|
128
|
-
let conventionalCount = 0;
|
|
129
|
-
commitLines.forEach(commit => {
|
|
130
|
-
const match = commit.match(/^(\w+)(\(.+\))?:/);
|
|
131
|
-
if (match && conventionalTypes.includes(match[1])) {
|
|
132
|
-
conventionalCount++;
|
|
133
|
-
}
|
|
134
|
-
});
|
|
135
|
-
|
|
136
|
-
const percentage = (conventionalCount / commitLines.length * 100).toFixed(0);
|
|
137
|
-
console.log(` ${conventionalCount}/${commitLines.length} commits follow conventional format (${percentage}%)`);
|
|
138
|
-
|
|
139
|
-
if (conventionalCount === 0) {
|
|
140
|
-
console.warn('⚠️ Warning: No conventional commits found');
|
|
141
|
-
} else {
|
|
142
|
-
console.log('✅ Found conventional commits');
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
return true;
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
function checkBuildStatus() {
|
|
149
|
-
console.log('\n🔍 Checking if project builds...');
|
|
150
|
-
|
|
151
|
-
try {
|
|
152
|
-
// Check if npm build works
|
|
153
|
-
console.log(' Running npm run build:lib...');
|
|
154
|
-
run('npm run build:lib');
|
|
155
|
-
console.log('✅ Build successful');
|
|
156
|
-
return true;
|
|
157
|
-
} catch (e) {
|
|
158
|
-
console.error('❌ Build failed');
|
|
159
|
-
console.error(e.message);
|
|
160
|
-
return false;
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
function checkTests() {
|
|
165
|
-
console.log('\n🔍 Checking tests...');
|
|
166
|
-
|
|
167
|
-
try {
|
|
168
|
-
console.log(' Running tests...');
|
|
169
|
-
run('npm test');
|
|
170
|
-
console.log('✅ Tests passed');
|
|
171
|
-
return true;
|
|
172
|
-
} catch (e) {
|
|
173
|
-
console.error('❌ Tests failed');
|
|
174
|
-
console.error(e.message);
|
|
175
|
-
return false;
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
function main() {
|
|
180
|
-
console.log('🚀 Running pre-release checks for pluresdb\n');
|
|
181
|
-
|
|
182
|
-
let allPassed = true;
|
|
183
|
-
|
|
184
|
-
try {
|
|
185
|
-
checkGitStatus();
|
|
186
|
-
|
|
187
|
-
if (!checkPackageVersions()) {
|
|
188
|
-
allPassed = false;
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
if (!checkChangelog()) {
|
|
192
|
-
allPassed = false;
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
checkCommitMessages();
|
|
196
|
-
|
|
197
|
-
// Skip build and test checks in CI for now
|
|
198
|
-
if (process.env.CI !== 'true') {
|
|
199
|
-
if (!checkBuildStatus()) {
|
|
200
|
-
allPassed = false;
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
if (!checkTests()) {
|
|
204
|
-
allPassed = false;
|
|
205
|
-
}
|
|
206
|
-
} else {
|
|
207
|
-
console.log('\nℹ️ Skipping build and test checks in CI');
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
console.log('\n' + '='.repeat(50));
|
|
211
|
-
if (allPassed) {
|
|
212
|
-
console.log('✅ All pre-release checks passed!');
|
|
213
|
-
process.exit(0);
|
|
214
|
-
} else {
|
|
215
|
-
console.log('❌ Some pre-release checks failed');
|
|
216
|
-
process.exit(1);
|
|
217
|
-
}
|
|
218
|
-
} catch (e) {
|
|
219
|
-
console.error('\n❌ Pre-release check error:', e.message);
|
|
220
|
-
process.exit(1);
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
main();
|
package/scripts/run-tests.ts
DELETED
|
@@ -1,178 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env -S deno run -A --unstable-kv
|
|
2
|
-
|
|
3
|
-
// @ts-nocheck
|
|
4
|
-
|
|
5
|
-
interface TestSuite {
|
|
6
|
-
name: string;
|
|
7
|
-
command: string;
|
|
8
|
-
description: string;
|
|
9
|
-
timeout?: number;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
interface TestResults {
|
|
13
|
-
suite: string;
|
|
14
|
-
passed: boolean;
|
|
15
|
-
duration: number;
|
|
16
|
-
output: string;
|
|
17
|
-
error?: string;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
class TestRunner {
|
|
21
|
-
private results: TestResults[] = [];
|
|
22
|
-
|
|
23
|
-
async runTestSuite(suite: TestSuite): Promise<TestResults> {
|
|
24
|
-
console.log(`\n🧪 Running ${suite.name}...`);
|
|
25
|
-
console.log(` ${suite.description}`);
|
|
26
|
-
|
|
27
|
-
const startTime = performance.now();
|
|
28
|
-
|
|
29
|
-
try {
|
|
30
|
-
const command = new Deno.Command("deno", {
|
|
31
|
-
args: suite.command.split(" "),
|
|
32
|
-
stdout: "piped",
|
|
33
|
-
stderr: "piped",
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
const { code, stdout, stderr } = await command.output();
|
|
37
|
-
const duration = performance.now() - startTime;
|
|
38
|
-
|
|
39
|
-
const output = new TextDecoder().decode(stdout);
|
|
40
|
-
const error = new TextDecoder().decode(stderr);
|
|
41
|
-
|
|
42
|
-
const result: TestResults = {
|
|
43
|
-
suite: suite.name,
|
|
44
|
-
passed: code === 0,
|
|
45
|
-
duration,
|
|
46
|
-
output,
|
|
47
|
-
error: code !== 0 ? error : undefined,
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
this.results.push(result);
|
|
51
|
-
|
|
52
|
-
if (result.passed) {
|
|
53
|
-
console.log(` ✅ Passed (${duration.toFixed(2)}ms)`);
|
|
54
|
-
} else {
|
|
55
|
-
console.log(` ❌ Failed (${duration.toFixed(2)}ms)`);
|
|
56
|
-
console.log(` Error: ${result.error}`);
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
return result;
|
|
60
|
-
} catch (error) {
|
|
61
|
-
const duration = performance.now() - startTime;
|
|
62
|
-
|
|
63
|
-
const result: TestResults = {
|
|
64
|
-
suite: suite.name,
|
|
65
|
-
passed: false,
|
|
66
|
-
duration,
|
|
67
|
-
output: "",
|
|
68
|
-
error: error.message,
|
|
69
|
-
};
|
|
70
|
-
|
|
71
|
-
this.results.push(result);
|
|
72
|
-
|
|
73
|
-
console.log(` ❌ Failed (${duration.toFixed(2)}ms)`);
|
|
74
|
-
console.log(` Error: ${error.message}`);
|
|
75
|
-
|
|
76
|
-
return result;
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
printSummary() {
|
|
81
|
-
console.log("\n" + "=".repeat(80));
|
|
82
|
-
console.log("TEST SUMMARY");
|
|
83
|
-
console.log("=".repeat(80));
|
|
84
|
-
|
|
85
|
-
const passed = this.results.filter((r) => r.passed).length;
|
|
86
|
-
const total = this.results.length;
|
|
87
|
-
const totalDuration = this.results.reduce((sum, r) => sum + r.duration, 0);
|
|
88
|
-
|
|
89
|
-
console.log(`Total Tests: ${total}`);
|
|
90
|
-
console.log(`Passed: ${passed}`);
|
|
91
|
-
console.log(`Failed: ${total - passed}`);
|
|
92
|
-
console.log(`Total Duration: ${totalDuration.toFixed(2)}ms`);
|
|
93
|
-
console.log(`Success Rate: ${((passed / total) * 100).toFixed(1)}%`);
|
|
94
|
-
|
|
95
|
-
console.log("\nDetailed Results:");
|
|
96
|
-
this.results.forEach((result) => {
|
|
97
|
-
const status = result.passed ? "✅" : "❌";
|
|
98
|
-
console.log(
|
|
99
|
-
` ${status} ${result.suite} (${result.duration.toFixed(2)}ms)`,
|
|
100
|
-
);
|
|
101
|
-
});
|
|
102
|
-
|
|
103
|
-
if (passed < total) {
|
|
104
|
-
console.log("\nFailed Tests:");
|
|
105
|
-
this.results
|
|
106
|
-
.filter((r) => !r.passed)
|
|
107
|
-
.forEach((result) => {
|
|
108
|
-
console.log(`\n❌ ${result.suite}:`);
|
|
109
|
-
console.log(` Error: ${result.error}`);
|
|
110
|
-
});
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
async function main() {
|
|
116
|
-
console.log("🚀 PluresDB Test Suite Runner");
|
|
117
|
-
console.log("===============================");
|
|
118
|
-
|
|
119
|
-
const testSuites: TestSuite[] = [
|
|
120
|
-
{
|
|
121
|
-
name: "Unit Tests",
|
|
122
|
-
command: "test -A --unstable-kv --parallel src/tests/unit/",
|
|
123
|
-
description:
|
|
124
|
-
"Core functionality tests (CRUD, subscriptions, vector search)",
|
|
125
|
-
timeout: 30000,
|
|
126
|
-
},
|
|
127
|
-
{
|
|
128
|
-
name: "Integration Tests",
|
|
129
|
-
command: "test -A --unstable-kv --parallel src/tests/integration/",
|
|
130
|
-
description: "Mesh networking and API server tests",
|
|
131
|
-
timeout: 60000,
|
|
132
|
-
},
|
|
133
|
-
{
|
|
134
|
-
name: "Performance Tests",
|
|
135
|
-
command: "test -A --unstable-kv --parallel src/tests/performance/",
|
|
136
|
-
description: "Load testing and performance validation",
|
|
137
|
-
timeout: 120000,
|
|
138
|
-
},
|
|
139
|
-
{
|
|
140
|
-
name: "Security Tests",
|
|
141
|
-
command: "test -A --unstable-kv --parallel src/tests/security/",
|
|
142
|
-
description: "Input validation and security testing",
|
|
143
|
-
timeout: 30000,
|
|
144
|
-
},
|
|
145
|
-
{
|
|
146
|
-
name: "Code Quality",
|
|
147
|
-
command: "lint src/",
|
|
148
|
-
description: "Code linting and style checks",
|
|
149
|
-
timeout: 10000,
|
|
150
|
-
},
|
|
151
|
-
{
|
|
152
|
-
name: "Type Checking",
|
|
153
|
-
command: "check src/main.ts",
|
|
154
|
-
description: "TypeScript type checking",
|
|
155
|
-
timeout: 15000,
|
|
156
|
-
},
|
|
157
|
-
];
|
|
158
|
-
|
|
159
|
-
const runner = new TestRunner();
|
|
160
|
-
|
|
161
|
-
for (const suite of testSuites) {
|
|
162
|
-
await runner.runTestSuite(suite);
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
runner.printSummary();
|
|
166
|
-
|
|
167
|
-
const failedTests = runner.results.filter((r) => !r.passed).length;
|
|
168
|
-
if (failedTests > 0) {
|
|
169
|
-
console.log(`\n❌ ${failedTests} test suite(s) failed!`);
|
|
170
|
-
Deno.exit(1);
|
|
171
|
-
} else {
|
|
172
|
-
console.log("\n🎉 All tests passed!");
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
if (import.meta.main) {
|
|
177
|
-
await main();
|
|
178
|
-
}
|
|
@@ -1,209 +0,0 @@
|
|
|
1
|
-
<#
|
|
2
|
-
.SYNOPSIS
|
|
3
|
-
Ensures libclang (LLVM) is installed and configures the LIBCLANG_PATH required by bindgen-based crates.
|
|
4
|
-
|
|
5
|
-
.DESCRIPTION
|
|
6
|
-
This script automates the detection or installation of libclang on Windows machines.
|
|
7
|
-
It will:
|
|
8
|
-
1. Check existing environment variables and well-known locations for libclang.dll
|
|
9
|
-
2. Optionally install LLVM via winget or Chocolatey if libclang is missing
|
|
10
|
-
3. Configure the LIBCLANG_PATH environment variable (user scope) once libclang is found
|
|
11
|
-
4. Optionally append the path to the current session PATH so cargo build/test immediately picks it up
|
|
12
|
-
|
|
13
|
-
Run it from the repository root before building Rust components that depend on bindgen (e.g., zstd-sys).
|
|
14
|
-
|
|
15
|
-
.PARAMETER ForceInstall
|
|
16
|
-
Always attempt to (re)install LLVM even if libclang is already detected.
|
|
17
|
-
|
|
18
|
-
.PARAMETER ConfigureCurrentProcess
|
|
19
|
-
Also updates $env:LIBCLANG_PATH and $env:PATH for the current PowerShell session
|
|
20
|
-
in addition to setting the persisted user-level environment variable.
|
|
21
|
-
|
|
22
|
-
.PARAMETER SkipInstall
|
|
23
|
-
Do not attempt to install LLVM automatically. The script will fail if libclang is not found.
|
|
24
|
-
|
|
25
|
-
.EXAMPLE
|
|
26
|
-
pwsh ./scripts/setup-libclang.ps1
|
|
27
|
-
|
|
28
|
-
.EXAMPLE
|
|
29
|
-
pwsh ./scripts/setup-libclang.ps1 -ConfigureCurrentProcess
|
|
30
|
-
|
|
31
|
-
.NOTES
|
|
32
|
-
- Requires either winget or Chocolatey for automated installation.
|
|
33
|
-
- When installing via winget, administrative consent may be required for the first run.
|
|
34
|
-
- After the user-level environment variable is written you should restart your shell (unless ConfigureCurrentProcess was supplied).
|
|
35
|
-
#>
|
|
36
|
-
[CmdletBinding()]
|
|
37
|
-
param(
|
|
38
|
-
[switch]$ForceInstall,
|
|
39
|
-
[switch]$ConfigureCurrentProcess,
|
|
40
|
-
[switch]$SkipInstall
|
|
41
|
-
)
|
|
42
|
-
|
|
43
|
-
function Write-Info {
|
|
44
|
-
param([string]$Message)
|
|
45
|
-
Write-Host "[INFO] $Message" -ForegroundColor Cyan
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
function Write-Success {
|
|
49
|
-
param([string]$Message)
|
|
50
|
-
Write-Host "[ OK ] $Message" -ForegroundColor Green
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
function Write-WarningMessage {
|
|
54
|
-
param([string]$Message)
|
|
55
|
-
Write-Host "[WARN] $Message" -ForegroundColor Yellow
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
function Write-ErrorMessage {
|
|
59
|
-
param([string]$Message)
|
|
60
|
-
Write-Host "[FAIL] $Message" -ForegroundColor Red
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
function Test-CommandExists {
|
|
64
|
-
param([string]$Name)
|
|
65
|
-
return [bool](Get-Command $Name -ErrorAction SilentlyContinue)
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
function Get-EnvLibClangPath {
|
|
69
|
-
$env:LIBCLANG_PATH
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
function Test-LibClangInPath {
|
|
73
|
-
param([string]$Directory)
|
|
74
|
-
if ([string]::IsNullOrWhiteSpace($Directory)) {
|
|
75
|
-
return $null
|
|
76
|
-
}
|
|
77
|
-
$candidate = Join-Path -Path $Directory -ChildPath "libclang.dll"
|
|
78
|
-
if (Test-Path $candidate) {
|
|
79
|
-
return (Get-Item $candidate).Directory.FullName
|
|
80
|
-
}
|
|
81
|
-
return $null
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
function Get-KnownLibClangLocations {
|
|
85
|
-
$paths = @()
|
|
86
|
-
|
|
87
|
-
# Explicit environment variable first
|
|
88
|
-
$envPath = Get-EnvLibClangPath
|
|
89
|
-
if (-not [string]::IsNullOrWhiteSpace($envPath)) {
|
|
90
|
-
$paths += $envPath
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
# LLVM default installation
|
|
94
|
-
$paths += @(
|
|
95
|
-
"$env:ProgramFiles\LLVM\bin",
|
|
96
|
-
"$env:ProgramFiles\LLVM\lib",
|
|
97
|
-
"$env:ProgramFiles\LLVM\lib64",
|
|
98
|
-
"$env:ProgramFiles(x86)\LLVM\bin",
|
|
99
|
-
"$env:ProgramFiles(x86)\LLVM\lib"
|
|
100
|
-
)
|
|
101
|
-
|
|
102
|
-
# Visual Studio (MSVC) bundled LLVM/Clang
|
|
103
|
-
$vsRoot = Join-Path $env:ProgramFiles "Microsoft Visual Studio"
|
|
104
|
-
if (Test-Path $vsRoot) {
|
|
105
|
-
$paths += Get-ChildItem -Path $vsRoot -Directory -Recurse -Filter "libclang.dll" -ErrorAction SilentlyContinue |
|
|
106
|
-
ForEach-Object { $_.Directory.FullName } |
|
|
107
|
-
Select-Object -Unique
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
# Generic entries that appear in PATH (e.g., if user installed LLVM elsewhere)
|
|
111
|
-
$paths += [Environment]::GetEnvironmentVariable("PATH", "Machine").Split(';')
|
|
112
|
-
$paths += [Environment]::GetEnvironmentVariable("PATH", "User").Split(';')
|
|
113
|
-
|
|
114
|
-
# Remove duplicates/empty
|
|
115
|
-
return $paths | Where-Object { -not [string]::IsNullOrWhiteSpace($_) } | Select-Object -Unique
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
function Find-LibClang {
|
|
119
|
-
$locations = Get-KnownLibClangLocations
|
|
120
|
-
foreach ($location in $locations) {
|
|
121
|
-
$resolved = Test-LibClangInPath -Directory $location
|
|
122
|
-
if ($resolved) {
|
|
123
|
-
return $resolved
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
return $null
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
function Install-LLVM {
|
|
130
|
-
Write-Info "Attempting to install LLVM (includes libclang)..."
|
|
131
|
-
|
|
132
|
-
if (Test-CommandExists -Name "winget") {
|
|
133
|
-
try {
|
|
134
|
-
winget install LLVM.LLVM --silent --accept-package-agreements --accept-source-agreements | Out-Null
|
|
135
|
-
Write-Success "LLVM installed via winget"
|
|
136
|
-
return $true
|
|
137
|
-
}
|
|
138
|
-
catch {
|
|
139
|
-
Write-WarningMessage "winget install failed: $($_.Exception.Message)"
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
elseif (Test-CommandExists -Name "choco") {
|
|
143
|
-
try {
|
|
144
|
-
choco install llvm -y --no-progress | Out-Null
|
|
145
|
-
Write-Success "LLVM installed via Chocolatey"
|
|
146
|
-
return $true
|
|
147
|
-
}
|
|
148
|
-
catch {
|
|
149
|
-
Write-WarningMessage "Chocolatey install failed: $($_.Exception.Message)"
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
else {
|
|
153
|
-
Write-WarningMessage "Neither winget nor Chocolatey is available for automated installation."
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
return $false
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
function Set-LibClangEnvironment {
|
|
160
|
-
param(
|
|
161
|
-
[Parameter(Mandatory = $true)][string]$Directory,
|
|
162
|
-
[switch]$ConfigureProcess
|
|
163
|
-
)
|
|
164
|
-
|
|
165
|
-
Write-Info "Setting LIBCLANG_PATH user environment variable to '$Directory'"
|
|
166
|
-
[Environment]::SetEnvironmentVariable("LIBCLANG_PATH", $Directory, "User")
|
|
167
|
-
|
|
168
|
-
if ($ConfigureProcess) {
|
|
169
|
-
$env:LIBCLANG_PATH = $Directory
|
|
170
|
-
if ($env:PATH -notlike "*$Directory*") {
|
|
171
|
-
$env:PATH = "$Directory;$env:PATH"
|
|
172
|
-
}
|
|
173
|
-
Write-Info "Updated current session PATH for immediate use"
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
Write-Success "LIBCLANG_PATH configured. Restart PowerShell or open a new terminal to pick up user-level changes."
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
try {
|
|
180
|
-
if ($ForceInstall -and $SkipInstall) {
|
|
181
|
-
throw "Cannot use -ForceInstall together with -SkipInstall."
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
$libclangDir = Find-LibClang
|
|
185
|
-
|
|
186
|
-
if ($ForceInstall -or (-not $libclangDir)) {
|
|
187
|
-
if ($SkipInstall) {
|
|
188
|
-
throw "libclang was not found and installation is disabled (SkipInstall)."
|
|
189
|
-
}
|
|
190
|
-
$installed = Install-LLVM
|
|
191
|
-
if (-not $installed) {
|
|
192
|
-
throw "Automatic LLVM installation failed. Please install LLVM manually and rerun this script."
|
|
193
|
-
}
|
|
194
|
-
$libclangDir = Find-LibClang
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
if (-not $libclangDir) {
|
|
198
|
-
throw "libclang.dll could not be located even after installation. Please install LLVM manually and rerun."
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
Write-Success "Found libclang at '$libclangDir'"
|
|
202
|
-
Set-LibClangEnvironment -Directory $libclangDir -ConfigureProcess:$ConfigureCurrentProcess
|
|
203
|
-
|
|
204
|
-
Write-Info "You can now run 'cargo build' / 'cargo test' successfully."
|
|
205
|
-
}
|
|
206
|
-
catch {
|
|
207
|
-
Write-ErrorMessage $_
|
|
208
|
-
exit 1
|
|
209
|
-
}
|