bare-runtime 1.9.3 → 1.10.0

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/bin/bare CHANGED
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- require('../lib/spawn')(__filename)
2
+ require('../lib/spawn')(__filename, { stdio: 'inherit' }).on('exit', (exitCode) => { process.exitCode = exitCode })
package/index.js CHANGED
@@ -1,3 +1,4 @@
1
+ const os = require('os')
1
2
  const path = require('path')
2
3
 
3
4
  module.exports = function runtime (referrer, opts) {
@@ -11,24 +12,26 @@ module.exports = function runtime (referrer, opts) {
11
12
  if (!opts) opts = {}
12
13
 
13
14
  const {
14
- platform = process.platform,
15
- arch = process.arch
15
+ platform = os.platform(),
16
+ arch = os.arch()
16
17
  } = opts
17
18
 
18
19
  const filename = path.basename(referrer)
19
20
 
20
- const base = `bare-runtime-${platform}-${arch}`
21
-
22
21
  let mod
23
22
  try {
24
- mod = require.resolve(`${base}/package.json`)
23
+ mod = require(`bare-runtime-${platform}-${arch}`)
25
24
  } catch (err) {
26
25
  if (err.code === 'MODULE_NOT_FOUND') {
27
- throw new Error(`No binary found for target '${platform}-${arch}'`)
26
+ throw new Error(`No binaries found for target '${platform}-${arch}'`)
28
27
  } else {
29
28
  throw err
30
29
  }
31
30
  }
32
31
 
33
- return path.join(mod, '..', require(mod).bin[filename])
32
+ if (filename in mod === false) {
33
+ throw new Error(`No binary found for target '${platform}-${arch}' for referrer '${referrer}'`)
34
+ }
35
+
36
+ return mod[filename]
34
37
  }
package/lib/spawn.js CHANGED
@@ -1,9 +1,20 @@
1
+ /* global Bare */
2
+ const childProcess = require('child_process')
1
3
  const runtime = require('..')
2
4
 
3
5
  module.exports = function spawn (referrer, opts) {
4
- try {
5
- require('child_process').execFileSync(runtime(referrer, opts), process.argv.slice(2), { stdio: 'inherit' })
6
- } catch (err) {
7
- process.exitCode = err.status || 1
6
+ if (typeof referrer === 'object' && referrer !== null) {
7
+ opts = referrer
8
+ referrer = 'ninja'
9
+ } else if (typeof referrer !== 'string') {
10
+ referrer = 'ninja'
8
11
  }
12
+
13
+ if (!opts) opts = {}
14
+
15
+ const {
16
+ args = typeof Bare !== 'undefined' ? Bare.argv.slice(2) : process.argv.slice(2)
17
+ } = opts
18
+
19
+ return childProcess.spawn(runtime(referrer, opts), args, opts)
9
20
  }
package/package.json CHANGED
@@ -1,9 +1,10 @@
1
1
  {
2
2
  "name": "bare-runtime",
3
- "version": "1.9.3",
3
+ "version": "1.10.0",
4
4
  "description": "Prebuilt Bare binaries for macOS, iOS, Linux, Android, and Windows",
5
5
  "exports": {
6
6
  ".": "./index.js",
7
+ "./package": "./package.json",
7
8
  "./spawn": "./lib/spawn.js"
8
9
  },
9
10
  "bin": {
@@ -11,10 +12,30 @@
11
12
  },
12
13
  "files": [
13
14
  "NOTICE",
15
+ "index.js",
14
16
  "bin",
15
- "lib",
16
- "index.js"
17
+ "lib"
17
18
  ],
19
+ "workspaces": [
20
+ "npm/*"
21
+ ],
22
+ "imports": {
23
+ "child_process": {
24
+ "bare": "bare-subprocess",
25
+ "default": "child_process"
26
+ },
27
+ "os": {
28
+ "bare": "bare-os",
29
+ "default": "os"
30
+ },
31
+ "path": {
32
+ "bare": "bare-path",
33
+ "default": "path"
34
+ }
35
+ },
36
+ "scripts": {
37
+ "test": "standard"
38
+ },
18
39
  "repository": {
19
40
  "type": "git",
20
41
  "url": "git+https://github.com/holepunchto/bare-runtime.git"
@@ -25,22 +46,27 @@
25
46
  "url": "https://github.com/holepunchto/bare-runtime/issues"
26
47
  },
27
48
  "homepage": "https://github.com/holepunchto/bare-runtime",
49
+ "dependencies": {
50
+ "bare-os": "^3.0.1",
51
+ "bare-path": "^3.0.0",
52
+ "bare-subprocess": "^4.0.2"
53
+ },
28
54
  "optionalDependencies": {
29
- "bare-runtime-android-arm": "1.9.3",
30
- "bare-runtime-android-arm64": "1.9.3",
31
- "bare-runtime-android-ia32": "1.9.3",
32
- "bare-runtime-android-x64": "1.9.3",
33
- "bare-runtime-darwin-arm64": "1.9.3",
34
- "bare-runtime-darwin-x64": "1.9.3",
35
- "bare-runtime-ios-arm64": "1.9.3",
36
- "bare-runtime-ios-arm64-simulator": "1.9.3",
37
- "bare-runtime-ios-x64-simulator": "1.9.3",
38
- "bare-runtime-linux-arm64": "1.9.3",
39
- "bare-runtime-linux-x64": "1.9.3",
40
- "bare-runtime-win32-arm64": "1.9.3",
41
- "bare-runtime-win32-x64": "1.9.3"
55
+ "bare-runtime-android-arm": "1.10.0",
56
+ "bare-runtime-android-arm64": "1.10.0",
57
+ "bare-runtime-android-ia32": "1.10.0",
58
+ "bare-runtime-android-x64": "1.10.0",
59
+ "bare-runtime-darwin-arm64": "1.10.0",
60
+ "bare-runtime-darwin-x64": "1.10.0",
61
+ "bare-runtime-ios-arm64": "1.10.0",
62
+ "bare-runtime-ios-arm64-simulator": "1.10.0",
63
+ "bare-runtime-ios-x64-simulator": "1.10.0",
64
+ "bare-runtime-linux-arm64": "1.10.0",
65
+ "bare-runtime-linux-x64": "1.10.0",
66
+ "bare-runtime-win32-arm64": "1.10.0",
67
+ "bare-runtime-win32-x64": "1.10.0"
42
68
  },
43
69
  "devDependencies": {
44
- "bare-headers": "1.9.3"
70
+ "standard": "^17.0.0"
45
71
  }
46
72
  }