bare 1.23.4 → 1.23.6

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/bare +5 -14
  2. package/index.d.ts +99 -0
  3. package/package.json +36 -2
package/bin/bare CHANGED
@@ -1,15 +1,6 @@
1
1
  #!/usr/bin/env node
2
- const fs = require('fs')
3
- const bin = require('bare-runtime')(__filename)
4
- try {
5
- fs.accessSync(bin, fs.constants.X_OK)
6
- } catch {
7
- fs.chmodSync(bin, 0o755)
8
- }
9
- try {
10
- require('child_process').execFileSync(bin, process.argv.slice(2), {
11
- stdio: 'inherit'
12
- })
13
- } catch (err) {
14
- process.exitCode = err.status || 1
15
- }
2
+ require('bare-runtime/spawn')(__filename, {
3
+ stdio: 'inherit',
4
+ suppressSignals: true,
5
+ forwardExitCode: true
6
+ })
package/index.d.ts ADDED
@@ -0,0 +1,99 @@
1
+ import EventEmitter, { EventMap } from 'bare-events'
2
+ import Buffer, { BufferEncoding } from 'bare-buffer'
3
+ import URL from 'bare-url'
4
+
5
+ import 'bare-queue-microtask/global'
6
+ import 'bare-buffer/global'
7
+ import 'bare-timers/global'
8
+ import 'bare-structured-clone/global'
9
+ import 'bare-url/global'
10
+ import 'bare-console/global'
11
+
12
+ interface BareEvents extends EventMap {
13
+ uncaughtException: [err: unknown]
14
+ unhandledRejection: [reason: unknown, promise: Promise<unknown>]
15
+ beforeExit: [code: number]
16
+ exit: [code: number]
17
+ suspend: [linger: number]
18
+ wakeup: [deadline: number]
19
+ idle: []
20
+ resume: []
21
+ }
22
+
23
+ interface Bare extends EventEmitter<BareEvents> {
24
+ readonly platform: 'android' | 'darwin' | 'ios' | 'linux' | 'win32'
25
+ readonly arch: 'arm' | 'arm64' | 'ia32' | 'x64' | 'mips' | 'mipsel'
26
+ readonly simulator: boolean
27
+ readonly argv: string[]
28
+ readonly pid: number
29
+ exitCode: number
30
+ readonly suspending: boolean
31
+ readonly suspended: boolean
32
+ readonly exiting: boolean
33
+ readonly version: string
34
+ readonly versions: { readonly [package: string]: string }
35
+
36
+ exit(code?: number): never
37
+ suspend(linger?: number): void
38
+ wakeup(deadline?: number): void
39
+ idle(): void
40
+ resume(): void
41
+
42
+ Addon: typeof Addon
43
+ Thread: typeof Thread
44
+ }
45
+
46
+ interface Addon {
47
+ readonly url: URL
48
+ readonly exports: unknown
49
+ }
50
+
51
+ declare class Addon {}
52
+
53
+ declare namespace Addon {
54
+ export const cache: { readonly [href: string]: Addon }
55
+ export const host: string
56
+
57
+ export function load(url: URL): Addon
58
+ export function resolve(specifier: string, parentURL?: URL): URL
59
+ }
60
+
61
+ interface ThreadOptions {
62
+ data?: unknown
63
+ transfer?: unknown[]
64
+ source?: string | Buffer
65
+ encoding?: BufferEncoding
66
+ stackSize?: number
67
+ }
68
+
69
+ interface Thread {
70
+ readonly joined: boolean
71
+
72
+ join(): void
73
+ suspend(linger?: number): void
74
+ wakeup(deadline?: number): void
75
+ resume(): void
76
+ terminate(): void
77
+ }
78
+
79
+ declare class Thread {
80
+ constructor(options?: ThreadOptions)
81
+ constructor(filename: string, options?: ThreadOptions)
82
+ }
83
+
84
+ declare namespace Thread {
85
+ interface ThreadProxy {
86
+ readonly data: any
87
+ }
88
+
89
+ export const isMainThread: boolean
90
+ export const self: ThreadProxy | null
91
+ }
92
+
93
+ declare const Bare: Bare
94
+
95
+ declare global {
96
+ const Bare: Bare
97
+ }
98
+
99
+ export = Bare
package/package.json CHANGED
@@ -1,9 +1,10 @@
1
1
  {
2
2
  "name": "bare",
3
- "version": "1.23.4",
3
+ "version": "1.23.6",
4
4
  "description": "Small and modular JavaScript runtime for desktop and mobile",
5
5
  "exports": {
6
6
  ".": {
7
+ "types": "./index.d.ts",
7
8
  "require": "./index.cjs",
8
9
  "import": "./index.mjs"
9
10
  }
@@ -14,6 +15,7 @@
14
15
  "files": [
15
16
  "index.cjs",
16
17
  "index.mjs",
18
+ "index.d.ts",
17
19
  "bin"
18
20
  ],
19
21
  "repository": {
@@ -27,6 +29,38 @@
27
29
  },
28
30
  "homepage": "https://github.com/holepunchto/bare",
29
31
  "dependencies": {
30
- "bare-runtime": "1.23.4"
32
+ "bare-runtime": "1.23.6"
33
+ },
34
+ "peerDependencies": {
35
+ "bare-buffer": "*",
36
+ "bare-console": "*",
37
+ "bare-events": "*",
38
+ "bare-queue-microtask": "*",
39
+ "bare-structured-clone": "*",
40
+ "bare-timers": "*",
41
+ "bare-url": "*"
42
+ },
43
+ "peerDependenciesMeta": {
44
+ "bare-buffer": {
45
+ "optional": true
46
+ },
47
+ "bare-console": {
48
+ "optional": true
49
+ },
50
+ "bare-events": {
51
+ "optional": true
52
+ },
53
+ "bare-queue-microtask": {
54
+ "optional": true
55
+ },
56
+ "bare-structured-clone": {
57
+ "optional": true
58
+ },
59
+ "bare-timers": {
60
+ "optional": true
61
+ },
62
+ "bare-url": {
63
+ "optional": true
64
+ }
31
65
  }
32
66
  }