@effect-native/libcrsql 0.16.3-1 → 0.16.300
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/LICENSE +22 -0
- package/README.md +41 -152
- package/dist/cjs/browser-unsupported.js +14 -0
- package/dist/cjs/browser-unsupported.js.map +1 -0
- package/dist/cjs/index.js +77 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/paths.js +45 -0
- package/dist/cjs/paths.js.map +1 -0
- package/dist/cjs/platform.js +61 -0
- package/dist/cjs/platform.js.map +1 -0
- package/dist/cjs/version.js +12 -0
- package/dist/cjs/version.js.map +1 -0
- package/dist/dts/browser-unsupported.d.ts +7 -0
- package/dist/dts/browser-unsupported.d.ts.map +1 -0
- package/dist/dts/index.d.ts +44 -0
- package/dist/dts/index.d.ts.map +1 -0
- package/dist/dts/paths.d.ts +38 -0
- package/dist/dts/paths.d.ts.map +1 -0
- package/dist/dts/platform.d.ts +30 -0
- package/dist/dts/platform.d.ts.map +1 -0
- package/dist/dts/version.d.ts +6 -0
- package/dist/dts/version.d.ts.map +1 -0
- package/dist/esm/browser-unsupported.js +10 -0
- package/dist/esm/browser-unsupported.js.map +1 -0
- package/dist/esm/index.js +68 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/package.json +8 -0
- package/dist/esm/paths.js +38 -0
- package/dist/esm/paths.js.map +1 -0
- package/dist/esm/platform.js +52 -0
- package/dist/esm/platform.js.map +1 -0
- package/dist/esm/version.js +6 -0
- package/dist/esm/version.js.map +1 -0
- package/effect/package.json +6 -0
- package/package.json +55 -59
- package/paths/package.json +6 -0
- package/src/browser-unsupported.ts +9 -0
- package/src/effect.ts +117 -0
- package/src/index.ts +87 -0
- package/src/paths.ts +47 -0
- package/src/platform.ts +75 -0
- package/src/version.ts +5 -0
- package/bin/libcrsql-extension-path.js +0 -10
- package/index.d.ts +0 -16
- package/index.js +0 -67
- package/lib/crsqlite-darwin-aarch64.dylib +0 -0
- package/lib/crsqlite-darwin-x86_64.dylib +0 -0
- package/react-native.d.ts +0 -13
- package/react-native.js +0 -32
package/src/version.ts
ADDED
package/index.d.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Get the absolute path to the bundled CR-SQLite extension
|
|
3
|
-
* @returns Absolute path to crsqlite.dylib/.so
|
|
4
|
-
*/
|
|
5
|
-
export declare function getExtensionPath(): string;
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Path to CR-SQLite extension - for use with db.loadExtension()
|
|
9
|
-
*/
|
|
10
|
-
export declare const pathToCRSQLiteExtension: string;
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Default export - same as pathToCRSQLiteExtension
|
|
14
|
-
*/
|
|
15
|
-
declare const _default: string;
|
|
16
|
-
export default _default;
|
package/index.js
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import { fileURLToPath } from 'node:url';
|
|
2
|
-
import { dirname, resolve } from 'node:path';
|
|
3
|
-
import { existsSync } from 'node:fs';
|
|
4
|
-
|
|
5
|
-
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Get the absolute path to the bundled CR-SQLite extension
|
|
9
|
-
* Automatically detects platform and architecture
|
|
10
|
-
* @returns {string} Absolute path to crsqlite.dylib/.so
|
|
11
|
-
*/
|
|
12
|
-
export function getExtensionPath() {
|
|
13
|
-
// Browser check - prevent misuse in browsers
|
|
14
|
-
if (typeof window !== 'undefined') {
|
|
15
|
-
throw new Error(
|
|
16
|
-
'@effect-native/libcrsql is for Node.js server environments only. ' +
|
|
17
|
-
'For browsers, use sql.js or a server-side database API.'
|
|
18
|
-
);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
// Detect current platform and architecture
|
|
22
|
-
const platform = process.platform === 'darwin' ? 'darwin' : 'linux';
|
|
23
|
-
const arch = process.arch === 'arm64' ? 'aarch64' : 'x86_64';
|
|
24
|
-
const ext = platform === 'darwin' ? 'dylib' : 'so';
|
|
25
|
-
|
|
26
|
-
const libDir = resolve(__dirname, 'lib');
|
|
27
|
-
|
|
28
|
-
// Try platform-specific extension first (highest priority)
|
|
29
|
-
const specificExt = resolve(libDir, `crsqlite-${platform}-${arch}.${ext}`);
|
|
30
|
-
if (existsSync(specificExt)) {
|
|
31
|
-
return specificExt;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
// Fallback to any available extension for the current platform
|
|
35
|
-
const fallbackCandidates = [
|
|
36
|
-
resolve(libDir, `crsqlite.${ext}`), // Generic for platform
|
|
37
|
-
resolve(libDir, 'crsqlite.dylib'), // macOS generic
|
|
38
|
-
resolve(libDir, 'crsqlite.so'), // Linux generic
|
|
39
|
-
];
|
|
40
|
-
|
|
41
|
-
for (const candidate of fallbackCandidates) {
|
|
42
|
-
if (existsSync(candidate)) {
|
|
43
|
-
return candidate;
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
// Helpful error message with available platforms
|
|
48
|
-
const availablePlatforms = [];
|
|
49
|
-
const expectedExt = `crsqlite-${platform}-${arch}.${ext}`;
|
|
50
|
-
throw new Error(
|
|
51
|
-
`CR-SQLite extension not found for ${platform}/${arch}. ` +
|
|
52
|
-
`Expected: ${expectedExt}. ` +
|
|
53
|
-
`Available platforms: ${availablePlatforms.join(', ')}. ` +
|
|
54
|
-
`This package supports: Intel/AMD Linux (Docker, most servers), ARM64 Linux (Raspberry Pi 4+, AWS Graviton), Intel Mac, Apple Silicon Mac (M1/M2/M3)`
|
|
55
|
-
);
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* Path to CR-SQLite extension - for use with db.loadExtension()
|
|
60
|
-
* Automatically detects your platform and returns the right extension
|
|
61
|
-
*/
|
|
62
|
-
export const pathToCRSQLiteExtension = getExtensionPath();
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
* Default export - same as pathToCRSQLiteExtension
|
|
66
|
-
*/
|
|
67
|
-
export default pathToCRSQLiteExtension;
|
|
Binary file
|
|
Binary file
|
package/react-native.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* React Native placeholder for getExtensionPath
|
|
3
|
-
* @throws Always throws with helpful message for React Native users
|
|
4
|
-
*/
|
|
5
|
-
export declare function getExtensionPath(): never;
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* React Native placeholder for pathToCRSQLiteExtension
|
|
9
|
-
* @throws Always throws with helpful message for React Native users
|
|
10
|
-
*/
|
|
11
|
-
export declare const pathToCRSQLiteExtension: never;
|
|
12
|
-
|
|
13
|
-
export default pathToCRSQLiteExtension;
|
package/react-native.js
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
// React Native specific entry point
|
|
2
|
-
// CR-SQLite extensions don't work in React Native
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* React Native placeholder for getExtensionPath
|
|
6
|
-
* @throws Always throws with helpful message for React Native users
|
|
7
|
-
*/
|
|
8
|
-
export function getExtensionPath() {
|
|
9
|
-
throw new Error(
|
|
10
|
-
'\u{1f6ab} @effect-native/libcrsql is for Node.js / Bun server environments only.\n\n' +
|
|
11
|
-
'\u{1f4f1} For React Native, use one of these instead:\n' +
|
|
12
|
-
' \u2022 @op-engineering/op-sqlite: https://www.npmjs.com/package/@op-engineering/op-sqlite\n' +
|
|
13
|
-
' \u2022 expo-sqlite: https://docs.expo.dev/versions/latest/sdk/sqlite/\n' +
|
|
14
|
-
'\u{1f4a1} This package provides native CR-SQLite extensions for Node.js / Bun servers, not mobile apps.'
|
|
15
|
-
);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* React Native placeholder for pathToCRSQLiteExtension
|
|
20
|
-
* @throws Always throws with helpful message
|
|
21
|
-
*/
|
|
22
|
-
export const pathToCRSQLiteExtension = (() => {
|
|
23
|
-
throw new Error(
|
|
24
|
-
'\u{1f6ab} @effect-native/libcrsql is for Node.js / Bun server environments only.\n\n' +
|
|
25
|
-
'\u{1f4f1} For React Native, use one of these instead:\n' +
|
|
26
|
-
' \u2022 @op-engineering/op-sqlite: https://www.npmjs.com/package/@op-engineering/op-sqlite\n' +
|
|
27
|
-
' \u2022 expo-sqlite: https://docs.expo.dev/versions/latest/sdk/sqlite/\n' +
|
|
28
|
-
'\u{1f4a1} This package provides native CR-SQLite extensions for Node.js / Bun servers, not mobile apps.'
|
|
29
|
-
);
|
|
30
|
-
})();
|
|
31
|
-
|
|
32
|
-
export default pathToCRSQLiteExtension;
|