@soulcraft/brainy 3.7.0 → 3.7.1
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/dist/universal/fs.js +32 -1
- package/package.json +1 -1
package/dist/universal/fs.js
CHANGED
|
@@ -59,13 +59,44 @@ class NodeFS {
|
|
|
59
59
|
await nodeFs.access(path, mode);
|
|
60
60
|
}
|
|
61
61
|
}
|
|
62
|
+
// Browser-safe no-op implementation
|
|
63
|
+
class BrowserFS {
|
|
64
|
+
async readFile(path, encoding = 'utf-8') {
|
|
65
|
+
throw new Error('File system operations not available in browser. Use OPFS, Memory, or S3 storage adapters instead.');
|
|
66
|
+
}
|
|
67
|
+
async writeFile(path, data, encoding = 'utf-8') {
|
|
68
|
+
throw new Error('File system operations not available in browser. Use OPFS, Memory, or S3 storage adapters instead.');
|
|
69
|
+
}
|
|
70
|
+
async mkdir(path, options = { recursive: true }) {
|
|
71
|
+
throw new Error('File system operations not available in browser. Use OPFS, Memory, or S3 storage adapters instead.');
|
|
72
|
+
}
|
|
73
|
+
async exists(path) {
|
|
74
|
+
return false; // Always return false in browser
|
|
75
|
+
}
|
|
76
|
+
async readdir(path, options) {
|
|
77
|
+
if (options?.withFileTypes) {
|
|
78
|
+
return [];
|
|
79
|
+
}
|
|
80
|
+
return [];
|
|
81
|
+
}
|
|
82
|
+
async unlink(path) {
|
|
83
|
+
throw new Error('File system operations not available in browser. Use OPFS, Memory, or S3 storage adapters instead.');
|
|
84
|
+
}
|
|
85
|
+
async stat(path) {
|
|
86
|
+
throw new Error('File system operations not available in browser. Use OPFS, Memory, or S3 storage adapters instead.');
|
|
87
|
+
}
|
|
88
|
+
async access(path, mode) {
|
|
89
|
+
throw new Error('File system operations not available in browser. Use OPFS, Memory, or S3 storage adapters instead.');
|
|
90
|
+
}
|
|
91
|
+
}
|
|
62
92
|
// Create the appropriate filesystem implementation
|
|
63
93
|
let fsImpl;
|
|
64
94
|
if (isNode() && nodeFs) {
|
|
65
95
|
fsImpl = new NodeFS();
|
|
66
96
|
}
|
|
67
97
|
else {
|
|
68
|
-
|
|
98
|
+
// Use browser-safe no-op implementation instead of throwing
|
|
99
|
+
fsImpl = new BrowserFS();
|
|
69
100
|
}
|
|
70
101
|
// Export the filesystem operations
|
|
71
102
|
export const readFile = fsImpl.readFile.bind(fsImpl);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@soulcraft/brainy",
|
|
3
|
-
"version": "3.7.
|
|
3
|
+
"version": "3.7.1",
|
|
4
4
|
"description": "Universal Knowledge Protocol™ - World's first Triple Intelligence database unifying vector, graph, and document search in one API. 31 nouns × 40 verbs for infinite expressiveness.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.js",
|