@local-sandbox/lsb-nodejs 0.1.0 → 0.2.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/README.md +71 -26
- package/index.d.ts +245 -12
- package/index.js +52 -50
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -48,11 +48,9 @@ const dataDir = `${process.env.HOME}/.local/share/lsb`
|
|
|
48
48
|
const sandbox = await Sandbox.start({
|
|
49
49
|
dataDir,
|
|
50
50
|
cpus: 2,
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
'./src': '/workspace',
|
|
55
|
-
},
|
|
51
|
+
memoryMb: 2048,
|
|
52
|
+
mounts: [{ type: 'overlay', hostPath: './src', guestPath: '/workspace' }],
|
|
53
|
+
network: { allow: ['registry.npmjs.org'] },
|
|
56
54
|
})
|
|
57
55
|
|
|
58
56
|
const result = await sandbox.exec('echo hello from lsb')
|
|
@@ -123,15 +121,17 @@ import { Sandbox } from '@local-sandbox/lsb-nodejs'
|
|
|
123
121
|
|
|
124
122
|
const sandbox = await Sandbox.start({
|
|
125
123
|
cpus: 4,
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
124
|
+
memoryMb: 4096,
|
|
125
|
+
diskSizeMb: 8192,
|
|
126
|
+
ports: [{ host: 8080, guest: 80 }],
|
|
127
|
+
mounts: [{ type: 'direct', hostPath: './src', guestPath: '/workspace', flags: 0 }],
|
|
128
|
+
network: {
|
|
129
|
+
allow: ['api.openai.com', 'registry.npmjs.org'],
|
|
130
|
+
exposeHost: [{ host: 3000, guest: 3000 }],
|
|
131
|
+
secrets: {
|
|
132
|
+
API_KEY: { value: 'sk-test', hosts: ['api.openai.com'] },
|
|
133
|
+
},
|
|
133
134
|
},
|
|
134
|
-
network: { allow: ['api.openai.com', 'registry.npmjs.org'] },
|
|
135
135
|
})
|
|
136
136
|
|
|
137
137
|
console.log(sandbox.instanceDir)
|
|
@@ -141,19 +141,64 @@ await sandbox.stop()
|
|
|
141
141
|
|
|
142
142
|
### Start options
|
|
143
143
|
|
|
144
|
-
| Option
|
|
145
|
-
|
|
146
|
-
| `
|
|
147
|
-
| `
|
|
148
|
-
| `
|
|
149
|
-
| `
|
|
150
|
-
| `
|
|
151
|
-
| `
|
|
152
|
-
| `
|
|
153
|
-
| `
|
|
154
|
-
| `
|
|
155
|
-
|
|
156
|
-
|
|
144
|
+
| Option | Type | Description |
|
|
145
|
+
| ------------ | ----------------------------------- | ------------------------------ |
|
|
146
|
+
| `instanceId` | `string` | Stable instance directory name |
|
|
147
|
+
| `from` | `string` | Checkpoint name to start from |
|
|
148
|
+
| `cpus` | `number` | Number of vCPUs |
|
|
149
|
+
| `memoryMb` | `number` | Memory in MB |
|
|
150
|
+
| `diskSizeMb` | `number` | Disk size in MB |
|
|
151
|
+
| `dataDir` | `string` | lsb runtime data directory |
|
|
152
|
+
| `ports` | `{ host: number; guest: number }[]` | Host-to-guest port forwards |
|
|
153
|
+
| `mounts` | `MountConfig[]` | Directory mounts |
|
|
154
|
+
| `network` | `NetworkConfig` | Network access policy |
|
|
155
|
+
|
|
156
|
+
`mounts` accepts discriminated entries:
|
|
157
|
+
|
|
158
|
+
| Type | Shape | Behavior |
|
|
159
|
+
| --------- | ------------------------------------------------------------------------ | --------------------------------------------- |
|
|
160
|
+
| `overlay` | `{ type: 'overlay'; hostPath: string; guestPath: string }` | Host is read-only; guest writes go to overlay |
|
|
161
|
+
| `direct` | `{ type: 'direct'; hostPath: string; guestPath: string; flags: number }` | Mounts VirtioFS directly with libc flags |
|
|
162
|
+
|
|
163
|
+
For direct mounts, `flags: 0` is read-write and `flags: 1` is `MS_RDONLY`.
|
|
164
|
+
|
|
165
|
+
`network` enables proxy networking when present. It accepts:
|
|
166
|
+
|
|
167
|
+
| Option | Type | Description |
|
|
168
|
+
| ------------ | ------------------------------------ | ---------------------------------- |
|
|
169
|
+
| `allow` | `string[]` | Allowed outbound host patterns |
|
|
170
|
+
| `exposeHost` | `{ host: number; guest?: number }[]` | Host ports exposed to the guest |
|
|
171
|
+
| `secrets` | `Record<string, SecretConfig>` | Secrets injected via the lsb proxy |
|
|
172
|
+
|
|
173
|
+
### Stream process output
|
|
174
|
+
|
|
175
|
+
```ts
|
|
176
|
+
import { Sandbox } from '@local-sandbox/lsb-nodejs'
|
|
177
|
+
|
|
178
|
+
const sandbox = await Sandbox.start()
|
|
179
|
+
const proc = await sandbox.spawn('echo out; echo err >&2')
|
|
180
|
+
|
|
181
|
+
for await (const chunk of proc.stdout) {
|
|
182
|
+
process.stdout.write(chunk)
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
console.log(await proc.exited)
|
|
186
|
+
|
|
187
|
+
await sandbox.stop()
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
### Watch files
|
|
191
|
+
|
|
192
|
+
```ts
|
|
193
|
+
import { Sandbox } from '@local-sandbox/lsb-nodejs'
|
|
194
|
+
|
|
195
|
+
const sandbox = await Sandbox.start()
|
|
196
|
+
const events = await sandbox.watch('/tmp')
|
|
197
|
+
|
|
198
|
+
for await (const event of events) {
|
|
199
|
+
console.log(event.path, event.event)
|
|
200
|
+
}
|
|
201
|
+
```
|
|
157
202
|
|
|
158
203
|
## Scripts
|
|
159
204
|
|
package/index.d.ts
CHANGED
|
@@ -1,106 +1,339 @@
|
|
|
1
1
|
/* auto-generated by NAPI-RS */
|
|
2
2
|
/* eslint-disable */
|
|
3
|
+
/**
|
|
4
|
+
* Async byte stream returned by process stdout and stderr.
|
|
5
|
+
*
|
|
6
|
+
* Usage: `for await (const chunk of proc.stdout) process.stdout.write(chunk)`
|
|
7
|
+
*
|
|
8
|
+
* This type implements JavaScript's async iterable protocol.
|
|
9
|
+
* It can be used with `for await...of` loops.
|
|
10
|
+
*
|
|
11
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#the_async_iterator_and_async_iterable_protocols
|
|
12
|
+
*/
|
|
13
|
+
export declare class ByteStream {
|
|
14
|
+
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Running sandbox VM instance.
|
|
19
|
+
*
|
|
20
|
+
* Usage: `const sandbox = await Sandbox.start(); await sandbox.stop()`
|
|
21
|
+
*/
|
|
3
22
|
export declare class Sandbox {
|
|
23
|
+
/**
|
|
24
|
+
* Boot a new sandbox VM.
|
|
25
|
+
*
|
|
26
|
+
* Usage: `const sandbox = await Sandbox.start({ cpus: 2, mounts: [{ type: 'overlay', hostPath: '.', guestPath: '/workspace' }] })`
|
|
27
|
+
*/
|
|
4
28
|
static start(opts?: StartOptions | undefined | null): Promise<Sandbox>
|
|
29
|
+
/**
|
|
30
|
+
* Execute a command and wait for stdout, stderr, and exit code.
|
|
31
|
+
*
|
|
32
|
+
* Usage: `const result = await sandbox.exec('npm test', { cwd: '/workspace' })`
|
|
33
|
+
*/
|
|
5
34
|
exec(command: string | Array<string>, opts?: ExecOptions | undefined | null): Promise<ExecResult>
|
|
6
|
-
|
|
35
|
+
/**
|
|
36
|
+
* Execute a shell command string with the SDK shell runner.
|
|
37
|
+
*
|
|
38
|
+
* Usage: `const result = await sandbox.execShell('echo $PWD && ls', { cwd: '/workspace' })`
|
|
39
|
+
*/
|
|
40
|
+
execShell(command: string, opts?: ExecOptions | undefined | null): Promise<ExecResult>
|
|
41
|
+
/**
|
|
42
|
+
* Start a long-running process with streamable stdout and stderr.
|
|
43
|
+
*
|
|
44
|
+
* Usage: `const proc = await sandbox.spawn(['node', 'server.js'], { cwd: '/workspace' })`
|
|
45
|
+
*/
|
|
7
46
|
spawn(command: string | Array<string>, opts?: SpawnOptions | undefined | null): Promise<SpawnedProcess>
|
|
8
|
-
|
|
47
|
+
/**
|
|
48
|
+
* Watch a guest path for file changes.
|
|
49
|
+
*
|
|
50
|
+
* Usage: `for await (const event of await sandbox.watch('/workspace')) console.log(event.path, event.event)`
|
|
51
|
+
*/
|
|
52
|
+
watch(path: string, opts?: WatchOptions | undefined | null): Promise<WatchStream>
|
|
53
|
+
/**
|
|
54
|
+
* Read a guest file as a Buffer.
|
|
55
|
+
*
|
|
56
|
+
* Usage: `const content = await sandbox.readFile('/workspace/package.json')`
|
|
57
|
+
*/
|
|
9
58
|
readFile(path: string): Promise<Buffer>
|
|
59
|
+
/**
|
|
60
|
+
* Write a string or Uint8Array to a guest file.
|
|
61
|
+
*
|
|
62
|
+
* Usage: `await sandbox.writeFile('/tmp/input.txt', 'hello')`
|
|
63
|
+
*/
|
|
10
64
|
writeFile(path: string, content: string | Uint8Array): Promise<void>
|
|
65
|
+
/**
|
|
66
|
+
* Create a guest directory.
|
|
67
|
+
*
|
|
68
|
+
* Usage: `await sandbox.mkdir('/workspace/out', { recursive: true })`
|
|
69
|
+
*/
|
|
11
70
|
mkdir(path: string, opts?: MkdirOptions | undefined | null): Promise<void>
|
|
71
|
+
/**
|
|
72
|
+
* List entries in a guest directory.
|
|
73
|
+
*
|
|
74
|
+
* Usage: `const entries = await sandbox.readDir('/workspace')`
|
|
75
|
+
*/
|
|
12
76
|
readDir(path: string): Promise<Array<DirEntry>>
|
|
77
|
+
/**
|
|
78
|
+
* Return metadata for a guest path.
|
|
79
|
+
*
|
|
80
|
+
* Usage: `const stat = await sandbox.stat('/workspace/package.json')`
|
|
81
|
+
*/
|
|
13
82
|
stat(path: string): Promise<StatResult>
|
|
83
|
+
/**
|
|
84
|
+
* Remove a guest file or directory.
|
|
85
|
+
*
|
|
86
|
+
* Usage: `await sandbox.remove('/workspace/out', { recursive: true })`
|
|
87
|
+
*/
|
|
14
88
|
remove(path: string, opts?: RemoveOptions | undefined | null): Promise<void>
|
|
89
|
+
/**
|
|
90
|
+
* Rename or move a guest file or directory.
|
|
91
|
+
*
|
|
92
|
+
* Usage: `await sandbox.rename('/tmp/a.txt', '/tmp/b.txt')`
|
|
93
|
+
*/
|
|
15
94
|
rename(oldPath: string, newPath: string): Promise<void>
|
|
95
|
+
/**
|
|
96
|
+
* Copy a guest file or directory.
|
|
97
|
+
*
|
|
98
|
+
* Usage: `await sandbox.copy('/workspace/src', '/workspace/src-copy', { recursive: true })`
|
|
99
|
+
*/
|
|
16
100
|
copy(src: string, dst: string, opts?: CopyOptions | undefined | null): Promise<void>
|
|
101
|
+
/**
|
|
102
|
+
* Change permission bits on a guest path.
|
|
103
|
+
*
|
|
104
|
+
* Usage: `await sandbox.chmod('/workspace/script.sh', 0o755)`
|
|
105
|
+
*/
|
|
17
106
|
chmod(path: string, mode: number): Promise<void>
|
|
107
|
+
/**
|
|
108
|
+
* Check whether a guest path exists.
|
|
109
|
+
*
|
|
110
|
+
* Usage: `if (await sandbox.exists('/workspace/package.json')) console.log('found')`
|
|
111
|
+
*/
|
|
18
112
|
exists(path: string): Promise<boolean>
|
|
113
|
+
/**
|
|
114
|
+
* Save a named VM checkpoint that can be used with `Sandbox.start({ from })`.
|
|
115
|
+
*
|
|
116
|
+
* Usage: `await sandbox.checkpoint('deps-installed')`
|
|
117
|
+
*/
|
|
19
118
|
checkpoint(name: string): Promise<void>
|
|
119
|
+
/**
|
|
120
|
+
* Stop the sandbox VM and release runtime resources.
|
|
121
|
+
*
|
|
122
|
+
* Usage: `await sandbox.stop()`
|
|
123
|
+
*/
|
|
20
124
|
stop(): Promise<void>
|
|
125
|
+
/**
|
|
126
|
+
* Absolute host path for this sandbox instance directory.
|
|
127
|
+
*
|
|
128
|
+
* Usage: `console.log(sandbox.instanceDir)`
|
|
129
|
+
*/
|
|
21
130
|
get instanceDir(): string
|
|
22
131
|
}
|
|
23
132
|
|
|
133
|
+
/**
|
|
134
|
+
* Handle for a process spawned inside the sandbox.
|
|
135
|
+
*
|
|
136
|
+
* Usage: `const proc = await sandbox.spawn('npm test')`
|
|
137
|
+
*/
|
|
24
138
|
export declare class SpawnedProcess {
|
|
25
|
-
|
|
139
|
+
/**
|
|
140
|
+
* Stream stdout chunks from the spawned process.
|
|
141
|
+
*
|
|
142
|
+
* Usage: `for await (const chunk of proc.stdout) process.stdout.write(chunk)`
|
|
143
|
+
*/
|
|
144
|
+
get stdout(): ByteStream
|
|
145
|
+
/**
|
|
146
|
+
* Stream stderr chunks from the spawned process.
|
|
147
|
+
*
|
|
148
|
+
* Usage: `for await (const chunk of proc.stderr) process.stderr.write(chunk)`
|
|
149
|
+
*/
|
|
150
|
+
get stderr(): ByteStream
|
|
151
|
+
/**
|
|
152
|
+
* Write data to the process stdin.
|
|
153
|
+
*
|
|
154
|
+
* Usage: `proc.write('hello')`
|
|
155
|
+
*/
|
|
26
156
|
write(data: string | Uint8Array): void
|
|
27
|
-
|
|
28
|
-
|
|
157
|
+
/**
|
|
158
|
+
* Request termination of the process.
|
|
159
|
+
*
|
|
160
|
+
* Usage: `proc.kill()`
|
|
161
|
+
*/
|
|
162
|
+
kill(): void
|
|
163
|
+
/**
|
|
164
|
+
* Promise resolving to the process exit code.
|
|
165
|
+
*
|
|
166
|
+
* Usage: `const exitCode = await proc.exited`
|
|
167
|
+
*/
|
|
29
168
|
get exited(): Promise<number>
|
|
30
169
|
}
|
|
31
170
|
|
|
171
|
+
/**
|
|
172
|
+
* Async stream of file change events returned by `sandbox.watch`.
|
|
173
|
+
*
|
|
174
|
+
* Usage: `for await (const event of await sandbox.watch('/workspace')) console.log(event.path)`
|
|
175
|
+
*
|
|
176
|
+
* This type implements JavaScript's async iterable protocol.
|
|
177
|
+
* It can be used with `for await...of` loops.
|
|
178
|
+
*
|
|
179
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#the_async_iterator_and_async_iterable_protocols
|
|
180
|
+
*/
|
|
181
|
+
export declare class WatchStream {
|
|
182
|
+
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
/** Options for copying files or directories. */
|
|
32
186
|
export interface CopyOptions {
|
|
187
|
+
/** Copy directory trees recursively. Defaults to false. */
|
|
33
188
|
recursive?: boolean
|
|
34
189
|
}
|
|
35
190
|
|
|
191
|
+
/** Directory entry returned by `readDir`. */
|
|
36
192
|
export interface DirEntry {
|
|
193
|
+
/** Entry basename. */
|
|
37
194
|
name: string
|
|
195
|
+
/** Entry type such as `file`, `dir`, or `symlink`. */
|
|
38
196
|
type: string
|
|
197
|
+
/** Entry size in bytes. */
|
|
39
198
|
size: number
|
|
40
199
|
}
|
|
41
200
|
|
|
201
|
+
/** Per-command execution options. */
|
|
42
202
|
export interface ExecOptions {
|
|
203
|
+
/** Guest working directory. */
|
|
204
|
+
cwd?: string
|
|
205
|
+
/** Additional environment variables. */
|
|
206
|
+
env?: Record<string, string>
|
|
207
|
+
/** Shell used when the command is a string. Defaults to `sh`. */
|
|
43
208
|
shell?: string
|
|
44
209
|
}
|
|
45
210
|
|
|
211
|
+
/** Completed command result. */
|
|
46
212
|
export interface ExecResult {
|
|
213
|
+
/** Captured stdout as UTF-8 text. */
|
|
47
214
|
stdout: string
|
|
215
|
+
/** Captured stderr as UTF-8 text. */
|
|
48
216
|
stderr: string
|
|
217
|
+
/** Process exit code. */
|
|
49
218
|
exitCode: number
|
|
50
219
|
}
|
|
51
220
|
|
|
221
|
+
/** Host port made reachable from inside the guest via host.lsb.internal. */
|
|
222
|
+
export interface ExposeHostConfig {
|
|
223
|
+
/** Port on the host machine. */
|
|
224
|
+
host: number
|
|
225
|
+
/** Port visible to the guest. Defaults to `host` when omitted. */
|
|
226
|
+
guest?: number
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
/** File watcher event. */
|
|
52
230
|
export interface FileChangeEvent {
|
|
231
|
+
/** Changed guest path. */
|
|
53
232
|
path: string
|
|
233
|
+
/** Event kind reported by the guest watcher. */
|
|
54
234
|
event: string
|
|
55
235
|
}
|
|
56
236
|
|
|
237
|
+
/** Options for directory creation. */
|
|
57
238
|
export interface MkdirOptions {
|
|
239
|
+
/** Create parent directories as needed. Defaults to true. */
|
|
58
240
|
recursive?: boolean
|
|
59
241
|
}
|
|
60
242
|
|
|
243
|
+
/** Directory mount configuration. */
|
|
244
|
+
export interface MountConfig {
|
|
245
|
+
/** Mount behavior: `overlay` isolates writes, `direct` applies libc mount flags. */
|
|
246
|
+
type: 'overlay' | 'direct'
|
|
247
|
+
/** Existing host directory to share with the VM. */
|
|
248
|
+
hostPath: string
|
|
249
|
+
/** Absolute guest path where the directory appears. */
|
|
250
|
+
guestPath: string
|
|
251
|
+
/** libc mount flags for direct mounts. Use `0` for read-write, `1` for MS_RDONLY. */
|
|
252
|
+
flags?: number
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
/** Network policy for a sandbox. */
|
|
61
256
|
export interface NetworkConfig {
|
|
257
|
+
/** Outbound host patterns allowed by the proxy. */
|
|
62
258
|
allow?: Array<string>
|
|
259
|
+
/** Host ports exposed to the guest. */
|
|
260
|
+
exposeHost?: Array<ExposeHostConfig>
|
|
261
|
+
/** Secrets injected by the proxy for allowed hosts. */
|
|
262
|
+
secrets?: Record<string, SecretConfig>
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
/** Host-to-guest TCP port forwarding rule. */
|
|
266
|
+
export interface PortMappingConfig {
|
|
267
|
+
/** Host port to listen on. */
|
|
268
|
+
host: number
|
|
269
|
+
/** Guest port to forward to. */
|
|
270
|
+
guest: number
|
|
63
271
|
}
|
|
64
272
|
|
|
273
|
+
/** Options for removing files or directories. */
|
|
65
274
|
export interface RemoveOptions {
|
|
275
|
+
/** Remove directory trees recursively. Defaults to false. */
|
|
66
276
|
recursive?: boolean
|
|
67
277
|
}
|
|
68
278
|
|
|
279
|
+
/** Secret value that is only exposed to requests for the listed hosts. */
|
|
69
280
|
export interface SecretConfig {
|
|
281
|
+
/** Secret payload or source value. */
|
|
70
282
|
value: string
|
|
283
|
+
/** Host allowlist for this secret. */
|
|
71
284
|
hosts: Array<string>
|
|
72
285
|
}
|
|
73
286
|
|
|
287
|
+
/** Options for spawned processes. */
|
|
74
288
|
export interface SpawnOptions {
|
|
289
|
+
/** Guest working directory. */
|
|
75
290
|
cwd?: string
|
|
291
|
+
/** Additional environment variables. */
|
|
76
292
|
env?: Record<string, string>
|
|
293
|
+
/** Shell used when the command is a string. Defaults to `sh`. */
|
|
77
294
|
shell?: string
|
|
78
295
|
}
|
|
79
296
|
|
|
297
|
+
/** Options used when booting a sandbox. */
|
|
80
298
|
export interface StartOptions {
|
|
299
|
+
/** Stable instance directory name. */
|
|
81
300
|
instanceId?: string
|
|
301
|
+
/** Checkpoint name to resume from. */
|
|
82
302
|
from?: string
|
|
303
|
+
/** Number of virtual CPUs. */
|
|
83
304
|
cpus?: number
|
|
84
|
-
memory
|
|
85
|
-
|
|
305
|
+
/** Guest memory in MiB. */
|
|
306
|
+
memoryMb?: number
|
|
307
|
+
/** Writable root disk size in MiB. */
|
|
308
|
+
diskSizeMb?: number
|
|
309
|
+
/** Runtime data directory containing VM assets and instances. */
|
|
86
310
|
dataDir?: string
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
mounts?:
|
|
91
|
-
|
|
311
|
+
/** Host-to-guest port forwards. */
|
|
312
|
+
ports?: Array<PortMappingConfig>
|
|
313
|
+
/** Directory mounts applied during boot. */
|
|
314
|
+
mounts?: Array<{ type: 'overlay'; hostPath: string; guestPath: string } | { type: 'direct'; hostPath: string; guestPath: string; flags: number }>
|
|
315
|
+
/** Network proxy, host exposure, and secret policy. */
|
|
92
316
|
network?: NetworkConfig
|
|
93
317
|
}
|
|
94
318
|
|
|
319
|
+
/** File metadata returned by `stat`. */
|
|
95
320
|
export interface StatResult {
|
|
321
|
+
/** Size in bytes. */
|
|
96
322
|
size: number
|
|
323
|
+
/** POSIX mode bits. */
|
|
97
324
|
mode: number
|
|
325
|
+
/** Modified time as a Unix timestamp in milliseconds. */
|
|
98
326
|
mtime: number
|
|
327
|
+
/** True when the path is a directory. */
|
|
99
328
|
isDir: boolean
|
|
329
|
+
/** True when the path is a regular file. */
|
|
100
330
|
isFile: boolean
|
|
331
|
+
/** True when the path is a symbolic link. */
|
|
101
332
|
isSymlink: boolean
|
|
102
333
|
}
|
|
103
334
|
|
|
335
|
+
/** Options for file watching. */
|
|
104
336
|
export interface WatchOptions {
|
|
337
|
+
/** Watch subdirectories recursively. Defaults to true. */
|
|
105
338
|
recursive?: boolean
|
|
106
339
|
}
|
package/index.js
CHANGED
|
@@ -80,8 +80,8 @@ function requireNative() {
|
|
|
80
80
|
try {
|
|
81
81
|
const binding = require('@local-sandbox/lsb-nodejs-android-arm64')
|
|
82
82
|
const bindingPackageVersion = require('@local-sandbox/lsb-nodejs-android-arm64/package.json').version
|
|
83
|
-
if (bindingPackageVersion !== '0.
|
|
84
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
83
|
+
if (bindingPackageVersion !== '0.2.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
84
|
+
throw new Error(`Native binding package version mismatch, expected 0.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
85
85
|
}
|
|
86
86
|
return binding
|
|
87
87
|
} catch (e) {
|
|
@@ -96,8 +96,8 @@ function requireNative() {
|
|
|
96
96
|
try {
|
|
97
97
|
const binding = require('@local-sandbox/lsb-nodejs-android-arm-eabi')
|
|
98
98
|
const bindingPackageVersion = require('@local-sandbox/lsb-nodejs-android-arm-eabi/package.json').version
|
|
99
|
-
if (bindingPackageVersion !== '0.
|
|
100
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
99
|
+
if (bindingPackageVersion !== '0.2.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
100
|
+
throw new Error(`Native binding package version mismatch, expected 0.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
101
101
|
}
|
|
102
102
|
return binding
|
|
103
103
|
} catch (e) {
|
|
@@ -116,8 +116,8 @@ function requireNative() {
|
|
|
116
116
|
try {
|
|
117
117
|
const binding = require('@local-sandbox/lsb-nodejs-win32-x64-msvc')
|
|
118
118
|
const bindingPackageVersion = require('@local-sandbox/lsb-nodejs-win32-x64-msvc/package.json').version
|
|
119
|
-
if (bindingPackageVersion !== '0.
|
|
120
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
119
|
+
if (bindingPackageVersion !== '0.2.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
120
|
+
throw new Error(`Native binding package version mismatch, expected 0.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
121
121
|
}
|
|
122
122
|
return binding
|
|
123
123
|
} catch (e) {
|
|
@@ -132,8 +132,8 @@ function requireNative() {
|
|
|
132
132
|
try {
|
|
133
133
|
const binding = require('@local-sandbox/lsb-nodejs-win32-ia32-msvc')
|
|
134
134
|
const bindingPackageVersion = require('@local-sandbox/lsb-nodejs-win32-ia32-msvc/package.json').version
|
|
135
|
-
if (bindingPackageVersion !== '0.
|
|
136
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
135
|
+
if (bindingPackageVersion !== '0.2.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
136
|
+
throw new Error(`Native binding package version mismatch, expected 0.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
137
137
|
}
|
|
138
138
|
return binding
|
|
139
139
|
} catch (e) {
|
|
@@ -148,8 +148,8 @@ function requireNative() {
|
|
|
148
148
|
try {
|
|
149
149
|
const binding = require('@local-sandbox/lsb-nodejs-win32-arm64-msvc')
|
|
150
150
|
const bindingPackageVersion = require('@local-sandbox/lsb-nodejs-win32-arm64-msvc/package.json').version
|
|
151
|
-
if (bindingPackageVersion !== '0.
|
|
152
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
151
|
+
if (bindingPackageVersion !== '0.2.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
152
|
+
throw new Error(`Native binding package version mismatch, expected 0.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
153
153
|
}
|
|
154
154
|
return binding
|
|
155
155
|
} catch (e) {
|
|
@@ -167,8 +167,8 @@ function requireNative() {
|
|
|
167
167
|
try {
|
|
168
168
|
const binding = require('@local-sandbox/lsb-nodejs-darwin-universal')
|
|
169
169
|
const bindingPackageVersion = require('@local-sandbox/lsb-nodejs-darwin-universal/package.json').version
|
|
170
|
-
if (bindingPackageVersion !== '0.
|
|
171
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
170
|
+
if (bindingPackageVersion !== '0.2.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
171
|
+
throw new Error(`Native binding package version mismatch, expected 0.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
172
172
|
}
|
|
173
173
|
return binding
|
|
174
174
|
} catch (e) {
|
|
@@ -183,8 +183,8 @@ function requireNative() {
|
|
|
183
183
|
try {
|
|
184
184
|
const binding = require('@local-sandbox/lsb-nodejs-darwin-x64')
|
|
185
185
|
const bindingPackageVersion = require('@local-sandbox/lsb-nodejs-darwin-x64/package.json').version
|
|
186
|
-
if (bindingPackageVersion !== '0.
|
|
187
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
186
|
+
if (bindingPackageVersion !== '0.2.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
187
|
+
throw new Error(`Native binding package version mismatch, expected 0.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
188
188
|
}
|
|
189
189
|
return binding
|
|
190
190
|
} catch (e) {
|
|
@@ -199,8 +199,8 @@ function requireNative() {
|
|
|
199
199
|
try {
|
|
200
200
|
const binding = require('@local-sandbox/lsb-nodejs-darwin-arm64')
|
|
201
201
|
const bindingPackageVersion = require('@local-sandbox/lsb-nodejs-darwin-arm64/package.json').version
|
|
202
|
-
if (bindingPackageVersion !== '0.
|
|
203
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
202
|
+
if (bindingPackageVersion !== '0.2.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
203
|
+
throw new Error(`Native binding package version mismatch, expected 0.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
204
204
|
}
|
|
205
205
|
return binding
|
|
206
206
|
} catch (e) {
|
|
@@ -219,8 +219,8 @@ function requireNative() {
|
|
|
219
219
|
try {
|
|
220
220
|
const binding = require('@local-sandbox/lsb-nodejs-freebsd-x64')
|
|
221
221
|
const bindingPackageVersion = require('@local-sandbox/lsb-nodejs-freebsd-x64/package.json').version
|
|
222
|
-
if (bindingPackageVersion !== '0.
|
|
223
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
222
|
+
if (bindingPackageVersion !== '0.2.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
223
|
+
throw new Error(`Native binding package version mismatch, expected 0.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
224
224
|
}
|
|
225
225
|
return binding
|
|
226
226
|
} catch (e) {
|
|
@@ -235,8 +235,8 @@ function requireNative() {
|
|
|
235
235
|
try {
|
|
236
236
|
const binding = require('@local-sandbox/lsb-nodejs-freebsd-arm64')
|
|
237
237
|
const bindingPackageVersion = require('@local-sandbox/lsb-nodejs-freebsd-arm64/package.json').version
|
|
238
|
-
if (bindingPackageVersion !== '0.
|
|
239
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
238
|
+
if (bindingPackageVersion !== '0.2.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
239
|
+
throw new Error(`Native binding package version mismatch, expected 0.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
240
240
|
}
|
|
241
241
|
return binding
|
|
242
242
|
} catch (e) {
|
|
@@ -256,8 +256,8 @@ function requireNative() {
|
|
|
256
256
|
try {
|
|
257
257
|
const binding = require('@local-sandbox/lsb-nodejs-linux-x64-musl')
|
|
258
258
|
const bindingPackageVersion = require('@local-sandbox/lsb-nodejs-linux-x64-musl/package.json').version
|
|
259
|
-
if (bindingPackageVersion !== '0.
|
|
260
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
259
|
+
if (bindingPackageVersion !== '0.2.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
260
|
+
throw new Error(`Native binding package version mismatch, expected 0.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
261
261
|
}
|
|
262
262
|
return binding
|
|
263
263
|
} catch (e) {
|
|
@@ -272,8 +272,8 @@ function requireNative() {
|
|
|
272
272
|
try {
|
|
273
273
|
const binding = require('@local-sandbox/lsb-nodejs-linux-x64-gnu')
|
|
274
274
|
const bindingPackageVersion = require('@local-sandbox/lsb-nodejs-linux-x64-gnu/package.json').version
|
|
275
|
-
if (bindingPackageVersion !== '0.
|
|
276
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
275
|
+
if (bindingPackageVersion !== '0.2.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
276
|
+
throw new Error(`Native binding package version mismatch, expected 0.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
277
277
|
}
|
|
278
278
|
return binding
|
|
279
279
|
} catch (e) {
|
|
@@ -290,8 +290,8 @@ function requireNative() {
|
|
|
290
290
|
try {
|
|
291
291
|
const binding = require('@local-sandbox/lsb-nodejs-linux-arm64-musl')
|
|
292
292
|
const bindingPackageVersion = require('@local-sandbox/lsb-nodejs-linux-arm64-musl/package.json').version
|
|
293
|
-
if (bindingPackageVersion !== '0.
|
|
294
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
293
|
+
if (bindingPackageVersion !== '0.2.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
294
|
+
throw new Error(`Native binding package version mismatch, expected 0.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
295
295
|
}
|
|
296
296
|
return binding
|
|
297
297
|
} catch (e) {
|
|
@@ -306,8 +306,8 @@ function requireNative() {
|
|
|
306
306
|
try {
|
|
307
307
|
const binding = require('@local-sandbox/lsb-nodejs-linux-arm64-gnu')
|
|
308
308
|
const bindingPackageVersion = require('@local-sandbox/lsb-nodejs-linux-arm64-gnu/package.json').version
|
|
309
|
-
if (bindingPackageVersion !== '0.
|
|
310
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
309
|
+
if (bindingPackageVersion !== '0.2.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
310
|
+
throw new Error(`Native binding package version mismatch, expected 0.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
311
311
|
}
|
|
312
312
|
return binding
|
|
313
313
|
} catch (e) {
|
|
@@ -324,8 +324,8 @@ function requireNative() {
|
|
|
324
324
|
try {
|
|
325
325
|
const binding = require('@local-sandbox/lsb-nodejs-linux-arm-musleabihf')
|
|
326
326
|
const bindingPackageVersion = require('@local-sandbox/lsb-nodejs-linux-arm-musleabihf/package.json').version
|
|
327
|
-
if (bindingPackageVersion !== '0.
|
|
328
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
327
|
+
if (bindingPackageVersion !== '0.2.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
328
|
+
throw new Error(`Native binding package version mismatch, expected 0.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
329
329
|
}
|
|
330
330
|
return binding
|
|
331
331
|
} catch (e) {
|
|
@@ -340,8 +340,8 @@ function requireNative() {
|
|
|
340
340
|
try {
|
|
341
341
|
const binding = require('@local-sandbox/lsb-nodejs-linux-arm-gnueabihf')
|
|
342
342
|
const bindingPackageVersion = require('@local-sandbox/lsb-nodejs-linux-arm-gnueabihf/package.json').version
|
|
343
|
-
if (bindingPackageVersion !== '0.
|
|
344
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
343
|
+
if (bindingPackageVersion !== '0.2.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
344
|
+
throw new Error(`Native binding package version mismatch, expected 0.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
345
345
|
}
|
|
346
346
|
return binding
|
|
347
347
|
} catch (e) {
|
|
@@ -358,8 +358,8 @@ function requireNative() {
|
|
|
358
358
|
try {
|
|
359
359
|
const binding = require('@local-sandbox/lsb-nodejs-linux-loong64-musl')
|
|
360
360
|
const bindingPackageVersion = require('@local-sandbox/lsb-nodejs-linux-loong64-musl/package.json').version
|
|
361
|
-
if (bindingPackageVersion !== '0.
|
|
362
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
361
|
+
if (bindingPackageVersion !== '0.2.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
362
|
+
throw new Error(`Native binding package version mismatch, expected 0.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
363
363
|
}
|
|
364
364
|
return binding
|
|
365
365
|
} catch (e) {
|
|
@@ -374,8 +374,8 @@ function requireNative() {
|
|
|
374
374
|
try {
|
|
375
375
|
const binding = require('@local-sandbox/lsb-nodejs-linux-loong64-gnu')
|
|
376
376
|
const bindingPackageVersion = require('@local-sandbox/lsb-nodejs-linux-loong64-gnu/package.json').version
|
|
377
|
-
if (bindingPackageVersion !== '0.
|
|
378
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
377
|
+
if (bindingPackageVersion !== '0.2.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
378
|
+
throw new Error(`Native binding package version mismatch, expected 0.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
379
379
|
}
|
|
380
380
|
return binding
|
|
381
381
|
} catch (e) {
|
|
@@ -392,8 +392,8 @@ function requireNative() {
|
|
|
392
392
|
try {
|
|
393
393
|
const binding = require('@local-sandbox/lsb-nodejs-linux-riscv64-musl')
|
|
394
394
|
const bindingPackageVersion = require('@local-sandbox/lsb-nodejs-linux-riscv64-musl/package.json').version
|
|
395
|
-
if (bindingPackageVersion !== '0.
|
|
396
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
395
|
+
if (bindingPackageVersion !== '0.2.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
396
|
+
throw new Error(`Native binding package version mismatch, expected 0.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
397
397
|
}
|
|
398
398
|
return binding
|
|
399
399
|
} catch (e) {
|
|
@@ -408,8 +408,8 @@ function requireNative() {
|
|
|
408
408
|
try {
|
|
409
409
|
const binding = require('@local-sandbox/lsb-nodejs-linux-riscv64-gnu')
|
|
410
410
|
const bindingPackageVersion = require('@local-sandbox/lsb-nodejs-linux-riscv64-gnu/package.json').version
|
|
411
|
-
if (bindingPackageVersion !== '0.
|
|
412
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
411
|
+
if (bindingPackageVersion !== '0.2.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
412
|
+
throw new Error(`Native binding package version mismatch, expected 0.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
413
413
|
}
|
|
414
414
|
return binding
|
|
415
415
|
} catch (e) {
|
|
@@ -425,8 +425,8 @@ function requireNative() {
|
|
|
425
425
|
try {
|
|
426
426
|
const binding = require('@local-sandbox/lsb-nodejs-linux-ppc64-gnu')
|
|
427
427
|
const bindingPackageVersion = require('@local-sandbox/lsb-nodejs-linux-ppc64-gnu/package.json').version
|
|
428
|
-
if (bindingPackageVersion !== '0.
|
|
429
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
428
|
+
if (bindingPackageVersion !== '0.2.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
429
|
+
throw new Error(`Native binding package version mismatch, expected 0.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
430
430
|
}
|
|
431
431
|
return binding
|
|
432
432
|
} catch (e) {
|
|
@@ -441,8 +441,8 @@ function requireNative() {
|
|
|
441
441
|
try {
|
|
442
442
|
const binding = require('@local-sandbox/lsb-nodejs-linux-s390x-gnu')
|
|
443
443
|
const bindingPackageVersion = require('@local-sandbox/lsb-nodejs-linux-s390x-gnu/package.json').version
|
|
444
|
-
if (bindingPackageVersion !== '0.
|
|
445
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
444
|
+
if (bindingPackageVersion !== '0.2.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
445
|
+
throw new Error(`Native binding package version mismatch, expected 0.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
446
446
|
}
|
|
447
447
|
return binding
|
|
448
448
|
} catch (e) {
|
|
@@ -461,8 +461,8 @@ function requireNative() {
|
|
|
461
461
|
try {
|
|
462
462
|
const binding = require('@local-sandbox/lsb-nodejs-openharmony-arm64')
|
|
463
463
|
const bindingPackageVersion = require('@local-sandbox/lsb-nodejs-openharmony-arm64/package.json').version
|
|
464
|
-
if (bindingPackageVersion !== '0.
|
|
465
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
464
|
+
if (bindingPackageVersion !== '0.2.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
465
|
+
throw new Error(`Native binding package version mismatch, expected 0.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
466
466
|
}
|
|
467
467
|
return binding
|
|
468
468
|
} catch (e) {
|
|
@@ -477,8 +477,8 @@ function requireNative() {
|
|
|
477
477
|
try {
|
|
478
478
|
const binding = require('@local-sandbox/lsb-nodejs-openharmony-x64')
|
|
479
479
|
const bindingPackageVersion = require('@local-sandbox/lsb-nodejs-openharmony-x64/package.json').version
|
|
480
|
-
if (bindingPackageVersion !== '0.
|
|
481
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
480
|
+
if (bindingPackageVersion !== '0.2.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
481
|
+
throw new Error(`Native binding package version mismatch, expected 0.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
482
482
|
}
|
|
483
483
|
return binding
|
|
484
484
|
} catch (e) {
|
|
@@ -493,8 +493,8 @@ function requireNative() {
|
|
|
493
493
|
try {
|
|
494
494
|
const binding = require('@local-sandbox/lsb-nodejs-openharmony-arm')
|
|
495
495
|
const bindingPackageVersion = require('@local-sandbox/lsb-nodejs-openharmony-arm/package.json').version
|
|
496
|
-
if (bindingPackageVersion !== '0.
|
|
497
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
496
|
+
if (bindingPackageVersion !== '0.2.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
497
|
+
throw new Error(`Native binding package version mismatch, expected 0.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
498
498
|
}
|
|
499
499
|
return binding
|
|
500
500
|
} catch (e) {
|
|
@@ -557,5 +557,7 @@ if (!nativeBinding) {
|
|
|
557
557
|
}
|
|
558
558
|
|
|
559
559
|
module.exports = nativeBinding
|
|
560
|
+
module.exports.ByteStream = nativeBinding.ByteStream
|
|
560
561
|
module.exports.Sandbox = nativeBinding.Sandbox
|
|
561
562
|
module.exports.SpawnedProcess = nativeBinding.SpawnedProcess
|
|
563
|
+
module.exports.WatchStream = nativeBinding.WatchStream
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@local-sandbox/lsb-nodejs",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Native Node.js bindings for lsb microVM sandboxes",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
],
|
|
15
15
|
"repository": {
|
|
16
16
|
"type": "git",
|
|
17
|
-
"url": "https://github.com/LocalSandBox/local-sandbox.git",
|
|
17
|
+
"url": "git+https://github.com/LocalSandBox/local-sandbox.git",
|
|
18
18
|
"directory": "bindings/nodejs"
|
|
19
19
|
},
|
|
20
20
|
"keywords": [
|
|
@@ -96,7 +96,7 @@
|
|
|
96
96
|
},
|
|
97
97
|
"packageManager": "yarn@4.12.0",
|
|
98
98
|
"optionalDependencies": {
|
|
99
|
-
"@local-sandbox/lsb-nodejs-darwin-arm64": "0.
|
|
100
|
-
"@local-sandbox/lsb-nodejs-darwin-x64": "0.
|
|
99
|
+
"@local-sandbox/lsb-nodejs-darwin-arm64": "0.2.0",
|
|
100
|
+
"@local-sandbox/lsb-nodejs-darwin-x64": "0.2.0"
|
|
101
101
|
}
|
|
102
102
|
}
|