spindb 0.17.2 → 0.17.3

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 (2) hide show
  1. package/bin/cli.js +15 -8
  2. package/package.json +1 -1
package/bin/cli.js CHANGED
@@ -4,6 +4,7 @@ import { fileURLToPath, pathToFileURL } from 'node:url'
4
4
  import { dirname, join } from 'node:path'
5
5
  import { spawn } from 'node:child_process'
6
6
  import { existsSync } from 'node:fs'
7
+ import { createRequire } from 'node:module'
7
8
 
8
9
  // Get the directory of this file
9
10
  const __filename = fileURLToPath(import.meta.url)
@@ -20,18 +21,24 @@ const mainScript = join(packageRoot, 'cli', 'bin.ts')
20
21
  // 3. Arguments pass through without shell interpretation (shell: false)
21
22
  // 4. Works on Windows without needing to spawn .cmd files
22
23
 
23
- // Find tsx ESM loader - check common paths
24
- const tsxLoaderPaths = [
25
- join(packageRoot, 'node_modules', 'tsx', 'dist', 'esm', 'index.mjs'),
26
- join(packageRoot, 'node_modules', 'tsx', 'dist', 'loader.mjs'),
27
- ]
24
+ // Find tsx ESM loader using Node's module resolution
25
+ // This works with npm, pnpm, yarn regardless of hoisting/symlink structure
26
+ let tsxLoader = null
28
27
 
29
- const tsxLoader = tsxLoaderPaths.find((p) => existsSync(p))
28
+ try {
29
+ const require = createRequire(import.meta.url)
30
+ const tsxDir = dirname(require.resolve('tsx/package.json'))
31
+ const loaderPaths = [
32
+ join(tsxDir, 'dist', 'esm', 'index.mjs'),
33
+ join(tsxDir, 'dist', 'loader.mjs'),
34
+ ]
35
+ tsxLoader = loaderPaths.find((p) => existsSync(p))
36
+ } catch {
37
+ // tsx not found via module resolution
38
+ }
30
39
 
31
40
  if (!tsxLoader) {
32
41
  console.error('Error: tsx loader not found.')
33
- console.error('Searched paths:')
34
- tsxLoaderPaths.forEach((p) => console.error(` - ${p}`))
35
42
  console.error('\nTry running: pnpm install')
36
43
  process.exit(1)
37
44
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "spindb",
3
- "version": "0.17.2",
3
+ "version": "0.17.3",
4
4
  "description": "Zero-config Docker-free local database containers. Create, backup, and clone a variety of popular databases.",
5
5
  "type": "module",
6
6
  "bin": {