@sinch/cli 0.4.1 → 0.4.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 (3) hide show
  1. package/bin/sinch +34 -2
  2. package/dist/index.js +354 -349
  3. package/package.json +2 -2
package/bin/sinch CHANGED
@@ -1,4 +1,36 @@
1
- #!/usr/bin/env bun
1
+ #!/usr/bin/env node
2
2
 
3
- // Use compiled TypeScript output
3
+ // Prefer compiled Bun binary (fast, single-file, no module issues).
4
+ // Falls back to tsx→source for dev, or bun→dist for npm installs.
5
+ const { execFileSync, execSync } = require('child_process');
6
+ const path = require('path');
7
+ const fs = require('fs');
8
+
9
+ const binName = process.platform === 'win32' ? 'sinch-bun.exe' : 'sinch-bun';
10
+ const binary = path.join(__dirname, '..', 'dist', binName);
11
+
12
+ if (fs.existsSync(binary)) {
13
+ try {
14
+ const result = require('child_process').spawnSync(binary, process.argv.slice(2), {
15
+ stdio: 'inherit',
16
+ windowsHide: false,
17
+ });
18
+ process.exit(result.status ?? 1);
19
+ } catch { /* fall through */ }
20
+ }
21
+
22
+ // Fallback: run source directly via tsx (works with ESM, no CJS issues)
23
+ try {
24
+ const src = path.join(__dirname, '..', 'src', 'index.ts');
25
+ if (fs.existsSync(src)) {
26
+ const result = require('child_process').spawnSync('npx', ['tsx', src, ...process.argv.slice(2)], {
27
+ stdio: 'inherit',
28
+ windowsHide: false,
29
+ shell: true,
30
+ });
31
+ process.exit(result.status ?? 1);
32
+ }
33
+ } catch { /* fall through */ }
34
+
35
+ // Last resort: try requiring dist (works if module format is compatible)
4
36
  require('../dist/index.js');