ruvector 0.2.14 → 0.2.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.
- package/bin/mcp-server.js +1 -1
- package/dist/core/adaptive-embedder.d.ts.map +1 -1
- package/dist/core/adaptive-embedder.js +4 -3
- package/dist/core/onnx/loader.js +348 -0
- package/dist/core/onnx/pkg/LICENSE +21 -0
- package/dist/core/onnx/pkg/loader.js +348 -0
- package/dist/core/onnx/pkg/package.json +3 -0
- package/dist/core/onnx/pkg/ruvector_onnx_embeddings_wasm.d.ts +112 -0
- package/dist/core/onnx/pkg/ruvector_onnx_embeddings_wasm.js +5 -0
- package/dist/core/onnx/pkg/ruvector_onnx_embeddings_wasm_bg.js +638 -0
- package/dist/core/onnx/pkg/ruvector_onnx_embeddings_wasm_bg.wasm +0 -0
- package/dist/core/onnx/pkg/ruvector_onnx_embeddings_wasm_bg.wasm.d.ts +29 -0
- package/dist/workers/native-worker.d.ts.map +1 -1
- package/dist/workers/native-worker.js +46 -3
- package/package.json +2 -2
|
@@ -49,7 +49,49 @@ exports.createAnalysisWorker = createAnalysisWorker;
|
|
|
49
49
|
exports.createLearningWorker = createLearningWorker;
|
|
50
50
|
const fs = __importStar(require("fs"));
|
|
51
51
|
const path = __importStar(require("path"));
|
|
52
|
-
|
|
52
|
+
let cachedGlob = null;
|
|
53
|
+
// Fallback glob implementation using fs
|
|
54
|
+
function createFallbackGlob() {
|
|
55
|
+
return async (pattern, options) => {
|
|
56
|
+
const cwd = options?.cwd || process.cwd();
|
|
57
|
+
const results = [];
|
|
58
|
+
const walk = (dir) => {
|
|
59
|
+
try {
|
|
60
|
+
const entries = fs.readdirSync(dir, { withFileTypes: true });
|
|
61
|
+
for (const entry of entries) {
|
|
62
|
+
const fullPath = path.join(dir, entry.name);
|
|
63
|
+
if (entry.isDirectory() && !entry.name.startsWith('.') && entry.name !== 'node_modules') {
|
|
64
|
+
walk(fullPath);
|
|
65
|
+
}
|
|
66
|
+
else if (entry.isFile()) {
|
|
67
|
+
results.push(path.relative(cwd, fullPath));
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
catch { /* ignore permission errors */ }
|
|
72
|
+
};
|
|
73
|
+
walk(cwd);
|
|
74
|
+
// Simple pattern matching for *.ext patterns
|
|
75
|
+
const ext = pattern.match(/\*\.(\w+)$/)?.[1];
|
|
76
|
+
return ext ? results.filter(f => f.endsWith('.' + ext)) : results;
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
async function getGlob() {
|
|
80
|
+
if (cachedGlob)
|
|
81
|
+
return cachedGlob;
|
|
82
|
+
try {
|
|
83
|
+
// Dynamic import - may fail if glob not installed
|
|
84
|
+
const mod = await Function('return import("glob")')();
|
|
85
|
+
if (mod && typeof mod.glob === 'function') {
|
|
86
|
+
cachedGlob = mod.glob;
|
|
87
|
+
return cachedGlob;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
catch { /* glob not available */ }
|
|
91
|
+
// Fallback to simple implementation
|
|
92
|
+
cachedGlob = createFallbackGlob();
|
|
93
|
+
return cachedGlob;
|
|
94
|
+
}
|
|
53
95
|
const onnx_embedder_1 = require("../core/onnx-embedder");
|
|
54
96
|
const security_1 = require("../analysis/security");
|
|
55
97
|
const complexity_1 = require("../analysis/complexity");
|
|
@@ -184,13 +226,14 @@ class NativeWorker {
|
|
|
184
226
|
const patterns = config?.patterns || ['**/*.ts', '**/*.js', '**/*.tsx', '**/*.jsx'];
|
|
185
227
|
const exclude = config?.exclude || ['**/node_modules/**', '**/dist/**', '**/.git/**'];
|
|
186
228
|
const files = [];
|
|
229
|
+
const glob = await getGlob();
|
|
187
230
|
for (const pattern of patterns) {
|
|
188
|
-
const matches = await
|
|
231
|
+
const matches = await glob(pattern, {
|
|
189
232
|
cwd: context.targetPath,
|
|
190
233
|
ignore: exclude,
|
|
191
234
|
nodir: true,
|
|
192
235
|
});
|
|
193
|
-
files.push(...matches.map(f => path.join(context.targetPath, f)));
|
|
236
|
+
files.push(...matches.map((f) => path.join(context.targetPath, f)));
|
|
194
237
|
}
|
|
195
238
|
this.stats.filesAnalyzed = files.length;
|
|
196
239
|
return { ...context, files };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ruvector",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.16",
|
|
4
4
|
"description": "High-performance vector database for Node.js with automatic native/WASM fallback",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"ruvector": "./bin/cli.js"
|
|
9
9
|
},
|
|
10
10
|
"scripts": {
|
|
11
|
-
"build": "tsc && cp src/core/onnx
|
|
11
|
+
"build": "tsc && cp -r src/core/onnx dist/core/",
|
|
12
12
|
"prepublishOnly": "npm run build",
|
|
13
13
|
"test": "node test/integration.js && node test/cli-commands.js"
|
|
14
14
|
},
|