@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.
Files changed (49) hide show
  1. package/LICENSE +22 -0
  2. package/README.md +41 -152
  3. package/dist/cjs/browser-unsupported.js +14 -0
  4. package/dist/cjs/browser-unsupported.js.map +1 -0
  5. package/dist/cjs/index.js +77 -0
  6. package/dist/cjs/index.js.map +1 -0
  7. package/dist/cjs/paths.js +45 -0
  8. package/dist/cjs/paths.js.map +1 -0
  9. package/dist/cjs/platform.js +61 -0
  10. package/dist/cjs/platform.js.map +1 -0
  11. package/dist/cjs/version.js +12 -0
  12. package/dist/cjs/version.js.map +1 -0
  13. package/dist/dts/browser-unsupported.d.ts +7 -0
  14. package/dist/dts/browser-unsupported.d.ts.map +1 -0
  15. package/dist/dts/index.d.ts +44 -0
  16. package/dist/dts/index.d.ts.map +1 -0
  17. package/dist/dts/paths.d.ts +38 -0
  18. package/dist/dts/paths.d.ts.map +1 -0
  19. package/dist/dts/platform.d.ts +30 -0
  20. package/dist/dts/platform.d.ts.map +1 -0
  21. package/dist/dts/version.d.ts +6 -0
  22. package/dist/dts/version.d.ts.map +1 -0
  23. package/dist/esm/browser-unsupported.js +10 -0
  24. package/dist/esm/browser-unsupported.js.map +1 -0
  25. package/dist/esm/index.js +68 -0
  26. package/dist/esm/index.js.map +1 -0
  27. package/dist/esm/package.json +8 -0
  28. package/dist/esm/paths.js +38 -0
  29. package/dist/esm/paths.js.map +1 -0
  30. package/dist/esm/platform.js +52 -0
  31. package/dist/esm/platform.js.map +1 -0
  32. package/dist/esm/version.js +6 -0
  33. package/dist/esm/version.js.map +1 -0
  34. package/effect/package.json +6 -0
  35. package/package.json +55 -59
  36. package/paths/package.json +6 -0
  37. package/src/browser-unsupported.ts +9 -0
  38. package/src/effect.ts +117 -0
  39. package/src/index.ts +87 -0
  40. package/src/paths.ts +47 -0
  41. package/src/platform.ts +75 -0
  42. package/src/version.ts +5 -0
  43. package/bin/libcrsql-extension-path.js +0 -10
  44. package/index.d.ts +0 -16
  45. package/index.js +0 -67
  46. package/lib/crsqlite-darwin-aarch64.dylib +0 -0
  47. package/lib/crsqlite-darwin-x86_64.dylib +0 -0
  48. package/react-native.d.ts +0 -13
  49. package/react-native.js +0 -32
package/src/version.ts ADDED
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Underlying cr-sqlite release version bundled with this package.
3
+ * @since 0.16.300
4
+ */
5
+ export const CRSQLITE_VERSION = "0.16.3"
@@ -1,10 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- import { pathToCRSQLiteExtension } from '../index.js';
4
-
5
- try {
6
- console.log(pathToCRSQLiteExtension);
7
- } catch (error) {
8
- console.error(error.message);
9
- process.exit(1);
10
- }
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;