@boxlite-ai/boxlite 0.2.4 → 0.2.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.
- package/dist/browserbox.d.ts +135 -71
- package/dist/browserbox.d.ts.map +1 -1
- package/dist/browserbox.js +373 -124
- package/dist/browserbox.js.map +1 -1
- package/dist/constants.d.ts +3 -7
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +5 -8
- package/dist/constants.js.map +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/simplebox.d.ts +43 -0
- package/dist/simplebox.d.ts.map +1 -1
- package/dist/simplebox.js +26 -1
- package/dist/simplebox.js.map +1 -1
- package/native/boxlite.js +54 -53
- package/package.json +14 -5
package/dist/constants.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* These values match the Python SDK for consistency across language bindings.
|
|
5
5
|
*/
|
|
6
6
|
// ComputerBox (Desktop Automation) defaults
|
|
7
|
-
export const COMPUTERBOX_IMAGE = '
|
|
7
|
+
export const COMPUTERBOX_IMAGE = 'lscr.io/linuxserver/webtop:ubuntu-xfce';
|
|
8
8
|
export const COMPUTERBOX_CPUS = 2;
|
|
9
9
|
export const COMPUTERBOX_MEMORY_MIB = 2048;
|
|
10
10
|
export const COMPUTERBOX_DISPLAY_NUMBER = ':1';
|
|
@@ -16,14 +16,11 @@ export const COMPUTERBOX_GUI_HTTPS_PORT = 3001;
|
|
|
16
16
|
export const DESKTOP_READY_TIMEOUT = 60; // seconds
|
|
17
17
|
export const DESKTOP_READY_RETRY_DELAY = 2; // seconds
|
|
18
18
|
// BrowserBox defaults
|
|
19
|
-
|
|
20
|
-
export const
|
|
21
|
-
export const BROWSERBOX_IMAGE_WEBKIT = 'browserless/webkit:latest';
|
|
22
|
-
// Browser CDP ports
|
|
23
|
-
export const BROWSERBOX_PORT_CHROMIUM = 9222;
|
|
24
|
-
export const BROWSERBOX_PORT_FIREFOX = 9223;
|
|
25
|
-
export const BROWSERBOX_PORT_WEBKIT = 9224;
|
|
19
|
+
// Playwright Server port - single port for all browser types (chromium, firefox, webkit)
|
|
20
|
+
export const BROWSERBOX_PORT = 3000;
|
|
26
21
|
// Default resource limits
|
|
27
22
|
export const DEFAULT_CPUS = 1;
|
|
28
23
|
export const DEFAULT_MEMORY_MIB = 512;
|
|
24
|
+
// Network constants (must match boxlite/src/net/constants.rs)
|
|
25
|
+
export const GUEST_IP = '192.168.127.2';
|
|
29
26
|
//# sourceMappingURL=constants.js.map
|
package/dist/constants.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../lib/constants.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,4CAA4C;AAC5C,MAAM,CAAC,MAAM,iBAAiB,GAAG,
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../lib/constants.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,4CAA4C;AAC5C,MAAM,CAAC,MAAM,iBAAiB,GAAG,wCAAwC,CAAC;AAC1E,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC;AAClC,MAAM,CAAC,MAAM,sBAAsB,GAAG,IAAI,CAAC;AAC3C,MAAM,CAAC,MAAM,0BAA0B,GAAG,IAAI,CAAC;AAC/C,MAAM,CAAC,MAAM,yBAAyB,GAAG,IAAI,CAAC;AAC9C,MAAM,CAAC,MAAM,0BAA0B,GAAG,GAAG,CAAC;AAC9C,MAAM,CAAC,MAAM,yBAAyB,GAAG,IAAI,CAAC;AAC9C,MAAM,CAAC,MAAM,0BAA0B,GAAG,IAAI,CAAC;AAE/C,8BAA8B;AAC9B,MAAM,CAAC,MAAM,qBAAqB,GAAG,EAAE,CAAC,CAAC,UAAU;AACnD,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,CAAC,CAAC,UAAU;AAEtD,sBAAsB;AACtB,yFAAyF;AACzF,MAAM,CAAC,MAAM,eAAe,GAAG,IAAI,CAAC;AAEpC,0BAA0B;AAC1B,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,CAAC;AAC9B,MAAM,CAAC,MAAM,kBAAkB,GAAG,GAAG,CAAC;AAEtC,8DAA8D;AAC9D,MAAM,CAAC,MAAM,QAAQ,GAAG,eAAe,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -19,7 +19,10 @@
|
|
|
19
19
|
* @packageDocumentation
|
|
20
20
|
*/
|
|
21
21
|
import { getNativeModule, getJsBoxlite } from './native.js';
|
|
22
|
+
declare const nativeModule: any;
|
|
22
23
|
export declare const JsBoxlite: any;
|
|
24
|
+
export declare const CopyOptions: any;
|
|
25
|
+
export type CopyOptions = InstanceType<typeof nativeModule.JsCopyOptions>;
|
|
23
26
|
export { getNativeModule, getJsBoxlite };
|
|
24
27
|
export { SimpleBox, type SimpleBoxOptions } from './simplebox.js';
|
|
25
28
|
export { type ExecResult } from './exec.js';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../lib/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAG5D,eAAO,MAAM,SAAS,KAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../lib/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAG5D,QAAA,MAAM,YAAY,KAAoB,CAAC;AACvC,eAAO,MAAM,SAAS,KAAiB,CAAC;AACxC,eAAO,MAAM,WAAW,KAA6B,CAAC;AACtD,MAAM,MAAM,WAAW,GAAG,YAAY,CAAC,OAAO,YAAY,CAAC,aAAa,CAAC,CAAC;AAG1E,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,CAAC;AAGzC,OAAO,EAAE,SAAS,EAAE,KAAK,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClE,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAChF,cAAc,gBAAgB,CAAC;AAG/B,OAAO,EAAE,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,cAAc,CAAC;AAC5D,OAAO,EAAE,UAAU,EAAE,KAAK,iBAAiB,EAAE,KAAK,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACvF,OAAO,EAAE,WAAW,EAAE,KAAK,kBAAkB,EAAE,KAAK,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACzF,OAAO,EAAE,cAAc,EAAE,KAAK,qBAAqB,EAAE,MAAM,qBAAqB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -20,7 +20,9 @@
|
|
|
20
20
|
*/
|
|
21
21
|
import { getNativeModule, getJsBoxlite } from './native.js';
|
|
22
22
|
// Re-export native bindings
|
|
23
|
+
const nativeModule = getNativeModule();
|
|
23
24
|
export const JsBoxlite = getJsBoxlite();
|
|
25
|
+
export const CopyOptions = nativeModule.JsCopyOptions;
|
|
24
26
|
// Export native module loader for advanced use cases
|
|
25
27
|
export { getNativeModule, getJsBoxlite };
|
|
26
28
|
// Re-export TypeScript wrappers
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../lib/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE5D,4BAA4B;AAC5B,MAAM,CAAC,MAAM,SAAS,GAAG,YAAY,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../lib/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE5D,4BAA4B;AAC5B,MAAM,YAAY,GAAG,eAAe,EAAE,CAAC;AACvC,MAAM,CAAC,MAAM,SAAS,GAAG,YAAY,EAAE,CAAC;AACxC,MAAM,CAAC,MAAM,WAAW,GAAG,YAAY,CAAC,aAAa,CAAC;AAGtD,qDAAqD;AACrD,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,CAAC;AAEzC,gCAAgC;AAChC,OAAO,EAAE,SAAS,EAAyB,MAAM,gBAAgB,CAAC;AAElE,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAChF,cAAc,gBAAgB,CAAC;AAE/B,oBAAoB;AACpB,OAAO,EAAE,OAAO,EAAuB,MAAM,cAAc,CAAC;AAC5D,OAAO,EAAE,UAAU,EAA4C,MAAM,iBAAiB,CAAC;AACvF,OAAO,EAAE,WAAW,EAA4C,MAAM,kBAAkB,CAAC;AACzF,OAAO,EAAE,cAAc,EAA8B,MAAM,qBAAqB,CAAC"}
|
package/dist/simplebox.d.ts
CHANGED
|
@@ -17,16 +17,22 @@ type BoxOptions = any;
|
|
|
17
17
|
export interface SimpleBoxOptions {
|
|
18
18
|
/** Container image to use (e.g., 'python:slim', 'alpine:latest') */
|
|
19
19
|
image?: string;
|
|
20
|
+
/** Path to local OCI layout directory (overrides image if provided) */
|
|
21
|
+
rootfsPath?: string;
|
|
20
22
|
/** Memory limit in MiB */
|
|
21
23
|
memoryMib?: number;
|
|
22
24
|
/** Number of CPU cores */
|
|
23
25
|
cpus?: number;
|
|
26
|
+
/** Disk size in GB for container rootfs (sparse, grows as needed) */
|
|
27
|
+
diskSizeGb?: number;
|
|
24
28
|
/** Optional runtime instance (uses global default if not provided) */
|
|
25
29
|
runtime?: Boxlite;
|
|
26
30
|
/** Optional name for the box (must be unique) */
|
|
27
31
|
name?: string;
|
|
28
32
|
/** Remove box when stopped (default: true) */
|
|
29
33
|
autoRemove?: boolean;
|
|
34
|
+
/** If true, reuse an existing box with the same name instead of failing (default: false) */
|
|
35
|
+
reuseExisting?: boolean;
|
|
30
36
|
/** Run box in detached mode (survives parent process exit, default: false) */
|
|
31
37
|
detach?: boolean;
|
|
32
38
|
/** Working directory inside container */
|
|
@@ -45,6 +51,35 @@ export interface SimpleBoxOptions {
|
|
|
45
51
|
guestPort: number;
|
|
46
52
|
protocol?: string;
|
|
47
53
|
}>;
|
|
54
|
+
/**
|
|
55
|
+
* Override image ENTRYPOINT directive.
|
|
56
|
+
*
|
|
57
|
+
* When set, completely replaces the image's ENTRYPOINT.
|
|
58
|
+
* Use with `cmd` to build the full command:
|
|
59
|
+
* Final execution = entrypoint + cmd
|
|
60
|
+
*
|
|
61
|
+
* Example: For `docker:dind`, bypass the failing entrypoint script:
|
|
62
|
+
* `entrypoint: ["dockerd"]`, `cmd: ["--iptables=false"]`
|
|
63
|
+
*/
|
|
64
|
+
entrypoint?: string[];
|
|
65
|
+
/**
|
|
66
|
+
* Override image CMD directive.
|
|
67
|
+
*
|
|
68
|
+
* The image ENTRYPOINT is preserved; these args replace the image's CMD.
|
|
69
|
+
* Final execution = image_entrypoint + cmd.
|
|
70
|
+
*
|
|
71
|
+
* Example: For `docker:dind` (ENTRYPOINT=["dockerd-entrypoint.sh"]),
|
|
72
|
+
* setting `cmd: ["--iptables=false"]` produces:
|
|
73
|
+
* `["dockerd-entrypoint.sh", "--iptables=false"]`
|
|
74
|
+
*/
|
|
75
|
+
cmd?: string[];
|
|
76
|
+
/**
|
|
77
|
+
* Override container user (UID/GID).
|
|
78
|
+
*
|
|
79
|
+
* Format: "uid", "uid:gid", or "username".
|
|
80
|
+
* If not set, uses the image's USER directive (defaults to root "0:0").
|
|
81
|
+
*/
|
|
82
|
+
user?: string;
|
|
48
83
|
}
|
|
49
84
|
/**
|
|
50
85
|
* Base class for specialized container types.
|
|
@@ -90,6 +125,8 @@ export declare class SimpleBox {
|
|
|
90
125
|
protected _boxPromise: Promise<Box> | null;
|
|
91
126
|
protected _name?: string;
|
|
92
127
|
protected _boxOpts: BoxOptions;
|
|
128
|
+
protected _reuseExisting: boolean;
|
|
129
|
+
protected _created: boolean | null;
|
|
93
130
|
/**
|
|
94
131
|
* Create a new SimpleBox.
|
|
95
132
|
*
|
|
@@ -127,6 +164,12 @@ export declare class SimpleBox {
|
|
|
127
164
|
* Get the box name (if set).
|
|
128
165
|
*/
|
|
129
166
|
get name(): string | undefined;
|
|
167
|
+
/**
|
|
168
|
+
* Whether this box was newly created (true) or an existing box was reused (false).
|
|
169
|
+
*
|
|
170
|
+
* Returns null if the box hasn't been created yet.
|
|
171
|
+
*/
|
|
172
|
+
get created(): boolean | null;
|
|
130
173
|
/**
|
|
131
174
|
* Get box metadata.
|
|
132
175
|
*
|
package/dist/simplebox.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"simplebox.d.ts","sourceRoot":"","sources":["../lib/simplebox.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAI5C,KAAK,OAAO,GAAG,GAAG,CAAC;AACnB,KAAK,GAAG,GAAG,GAAG,CAAC;AAEf,KAAK,UAAU,GAAG,GAAG,CAAC;AAEtB;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,oEAAoE;IACpE,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf,0BAA0B;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,0BAA0B;IAC1B,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd,sEAAsE;IACtE,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB,iDAAiD;IACjD,IAAI,CAAC,EAAE,MAAM,C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Q,EAAE,OAAO,GAAG,IAAI,CAAQ;IAE1C;;;;;;;;;;;;;;;;OAgBG;gBACS,OAAO,GAAE,gBAAqB;IAkC1C;;;OAGG;cACa,UAAU,IAAI,OAAO,CAAC,GAAG,CAAC;IAuB1C;;;;OAIG;IACH,IAAI,EAAE,IAAI,MAAM,CAKf;IAED;;OAEG;IACG,KAAK,IAAI,OAAO,CAAC,MAAM,CAAC;IAK9B;;OAEG;IACH,IAAI,IAAI,IAAI,MAAM,GAAG,SAAS,CAE7B;IAED;;;;OAIG;IACH,IAAI,OAAO,IAAI,OAAO,GAAG,IAAI,CAE5B;IAED;;;;OAIG;IACH,IAAI;IAOJ;;OAEG;IACG,OAAO;IAKb;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA4BG;IACG,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC;IACzD,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,UAAU,CAAC;IAsGzF;;;;;;;;;;;;;OAaG;IACG,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAQ3B;;;;;;;;;OASG;IACG,CAAC,MAAM,CAAC,YAAY,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC;CAG7C"}
|
package/dist/simplebox.js
CHANGED
|
@@ -67,6 +67,7 @@ export class SimpleBox {
|
|
|
67
67
|
constructor(options = {}) {
|
|
68
68
|
this._box = null;
|
|
69
69
|
this._boxPromise = null;
|
|
70
|
+
this._created = null;
|
|
70
71
|
const JsBoxlite = getJsBoxlite();
|
|
71
72
|
// Use provided runtime or get global default
|
|
72
73
|
if (options.runtime) {
|
|
@@ -78,8 +79,10 @@ export class SimpleBox {
|
|
|
78
79
|
// Convert options to BoxOptions format (stored for lazy creation)
|
|
79
80
|
this._boxOpts = {
|
|
80
81
|
image: options.image,
|
|
82
|
+
rootfsPath: options.rootfsPath,
|
|
81
83
|
cpus: options.cpus,
|
|
82
84
|
memoryMib: options.memoryMib,
|
|
85
|
+
diskSizeGb: options.diskSizeGb,
|
|
83
86
|
autoRemove: options.autoRemove ?? true,
|
|
84
87
|
detach: options.detach ?? false,
|
|
85
88
|
workingDir: options.workingDir,
|
|
@@ -88,8 +91,12 @@ export class SimpleBox {
|
|
|
88
91
|
: undefined,
|
|
89
92
|
volumes: options.volumes,
|
|
90
93
|
ports: options.ports,
|
|
94
|
+
entrypoint: options.entrypoint,
|
|
95
|
+
cmd: options.cmd,
|
|
96
|
+
user: options.user,
|
|
91
97
|
};
|
|
92
98
|
this._name = options.name;
|
|
99
|
+
this._reuseExisting = options.reuseExisting ?? false;
|
|
93
100
|
}
|
|
94
101
|
/**
|
|
95
102
|
* Ensure the box is created (lazy initialization).
|
|
@@ -101,7 +108,17 @@ export class SimpleBox {
|
|
|
101
108
|
}
|
|
102
109
|
// Avoid race condition with concurrent calls
|
|
103
110
|
if (!this._boxPromise) {
|
|
104
|
-
this._boxPromise =
|
|
111
|
+
this._boxPromise = (async () => {
|
|
112
|
+
if (this._reuseExisting) {
|
|
113
|
+
const result = await this._runtime.getOrCreate(this._boxOpts, this._name);
|
|
114
|
+
this._created = result.created;
|
|
115
|
+
return result.box;
|
|
116
|
+
}
|
|
117
|
+
else {
|
|
118
|
+
this._created = true;
|
|
119
|
+
return this._runtime.create(this._boxOpts, this._name);
|
|
120
|
+
}
|
|
121
|
+
})();
|
|
105
122
|
}
|
|
106
123
|
this._box = await this._boxPromise;
|
|
107
124
|
return this._box;
|
|
@@ -130,6 +147,14 @@ export class SimpleBox {
|
|
|
130
147
|
get name() {
|
|
131
148
|
return this._name;
|
|
132
149
|
}
|
|
150
|
+
/**
|
|
151
|
+
* Whether this box was newly created (true) or an existing box was reused (false).
|
|
152
|
+
*
|
|
153
|
+
* Returns null if the box hasn't been created yet.
|
|
154
|
+
*/
|
|
155
|
+
get created() {
|
|
156
|
+
return this._created;
|
|
157
|
+
}
|
|
133
158
|
/**
|
|
134
159
|
* Get box metadata.
|
|
135
160
|
*
|
package/dist/simplebox.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"simplebox.js","sourceRoot":"","sources":["../lib/simplebox.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"simplebox.js","sourceRoot":"","sources":["../lib/simplebox.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AA+F3C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,MAAM,OAAO,SAAS;IASpB;;;;;;;;;;;;;;;;OAgBG;IACH,YAAY,UAA4B,EAAE;QAxBhC,SAAI,GAAe,IAAI,CAAC;QACxB,gBAAW,GAAwB,IAAI,CAAC;QAIxC,aAAQ,GAAmB,IAAI,CAAC;QAoBxC,MAAM,SAAS,GAAG,YAAY,EAAE,CAAC;QAEjC,6CAA6C;QAC7C,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;YACpB,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC,OAAO,CAAC;QAClC,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,QAAQ,GAAG,SAAS,CAAC,iBAAiB,EAAE,CAAC;QAChD,CAAC;QAED,kEAAkE;QAClE,IAAI,CAAC,QAAQ,GAAG;YACd,KAAK,EAAE,OAAO,CAAC,KAAK;YACpB,UAAU,EAAE,OAAO,CAAC,UAAU;YAC9B,IAAI,EAAE,OAAO,CAAC,IAAI;YAClB,SAAS,EAAE,OAAO,CAAC,SAAS;YAC5B,UAAU,EAAE,OAAO,CAAC,UAAU;YAC9B,UAAU,EAAE,OAAO,CAAC,UAAU,IAAI,IAAI;YACtC,MAAM,EA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AE,CAAC;gBACb,iCAAiC;YACnC,CAAC;QACH,CAAC;QAED,sBAAsB;QACtB,MAAM,MAAM,GAAG,MAAM,SAAS,CAAC,IAAI,EAAE,CAAC;QAEtC,OAAO;YACL,QAAQ,EAAE,MAAM,CAAC,QAAQ;YACzB,MAAM,EAAE,WAAW,CAAC,IAAI,CAAC,EAAE,CAAC;YAC5B,MAAM,EAAE,WAAW,CAAC,IAAI,CAAC,EAAE,CAAC;SAC7B,CAAC;IACJ,CAAC;IAED;;;;;;;;;;;;;OAaG;IACH,KAAK,CAAC,IAAI;QACR,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;YACf,yCAAyC;YACzC,OAAO;QACT,CAAC;QACD,MAAM,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;IACzB,CAAC;IAED;;;;;;;;;OASG;IACH,KAAK,CAAC,CAAC,MAAM,CAAC,YAAY,CAAC;QACzB,MAAM,IAAI,CAAC,IAAI,EAAE,CAAC;IACpB,CAAC;CACF"}
|
package/native/boxlite.js
CHANGED
|
@@ -81,8 +81,8 @@ function requireNative() {
|
|
|
81
81
|
try {
|
|
82
82
|
const binding = require('@boxlite-ai/boxlite-android-arm64')
|
|
83
83
|
const bindingPackageVersion = require('@boxlite-ai/boxlite-android-arm64/package.json').version
|
|
84
|
-
if (bindingPackageVersion !== '0.2.
|
|
85
|
-
throw new Error(`Native binding package version mismatch, expected 0.2.
|
|
84
|
+
if (bindingPackageVersion !== '0.2.6' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
85
|
+
throw new Error(`Native binding package version mismatch, expected 0.2.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
86
86
|
}
|
|
87
87
|
return binding
|
|
88
88
|
} catch (e) {
|
|
@@ -97,8 +97,8 @@ function requireNative() {
|
|
|
97
97
|
try {
|
|
98
98
|
const binding = require('@boxlite-ai/boxlite-android-arm-eabi')
|
|
99
99
|
const bindingPackageVersion = require('@boxlite-ai/boxlite-android-arm-eabi/package.json').version
|
|
100
|
-
if (bindingPackageVersion !== '0.2.
|
|
101
|
-
throw new Error(`Native binding package version mismatch, expected 0.2.
|
|
100
|
+
if (bindingPackageVersion !== '0.2.6' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
101
|
+
throw new Error(`Native binding package version mismatch, expected 0.2.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
102
102
|
}
|
|
103
103
|
return binding
|
|
104
104
|
} catch (e) {
|
|
@@ -118,8 +118,8 @@ function requireNative() {
|
|
|
118
118
|
try {
|
|
119
119
|
const binding = require('@boxlite-ai/boxlite-win32-x64-gnu')
|
|
120
120
|
const bindingPackageVersion = require('@boxlite-ai/boxlite-win32-x64-gnu/package.json').version
|
|
121
|
-
if (bindingPackageVersion !== '0.2.
|
|
122
|
-
throw new Error(`Native binding package version mismatch, expected 0.2.
|
|
121
|
+
if (bindingPackageVersion !== '0.2.6' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
122
|
+
throw new Error(`Native binding package version mismatch, expected 0.2.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
123
123
|
}
|
|
124
124
|
return binding
|
|
125
125
|
} catch (e) {
|
|
@@ -134,8 +134,8 @@ function requireNative() {
|
|
|
134
134
|
try {
|
|
135
135
|
const binding = require('@boxlite-ai/boxlite-win32-x64-msvc')
|
|
136
136
|
const bindingPackageVersion = require('@boxlite-ai/boxlite-win32-x64-msvc/package.json').version
|
|
137
|
-
if (bindingPackageVersion !== '0.2.
|
|
138
|
-
throw new Error(`Native binding package version mismatch, expected 0.2.
|
|
137
|
+
if (bindingPackageVersion !== '0.2.6' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
138
|
+
throw new Error(`Native binding package version mismatch, expected 0.2.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
139
139
|
}
|
|
140
140
|
return binding
|
|
141
141
|
} catch (e) {
|
|
@@ -151,8 +151,8 @@ function requireNative() {
|
|
|
151
151
|
try {
|
|
152
152
|
const binding = require('@boxlite-ai/boxlite-win32-ia32-msvc')
|
|
153
153
|
const bindingPackageVersion = require('@boxlite-ai/boxlite-win32-ia32-msvc/package.json').version
|
|
154
|
-
if (bindingPackageVersion !== '0.2.
|
|
155
|
-
throw new Error(`Native binding package version mismatch, expected 0.2.
|
|
154
|
+
if (bindingPackageVersion !== '0.2.6' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
155
|
+
throw new Error(`Native binding package version mismatch, expected 0.2.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
156
156
|
}
|
|
157
157
|
return binding
|
|
158
158
|
} catch (e) {
|
|
@@ -167,8 +167,8 @@ function requireNative() {
|
|
|
167
167
|
try {
|
|
168
168
|
const binding = require('@boxlite-ai/boxlite-win32-arm64-msvc')
|
|
169
169
|
const bindingPackageVersion = require('@boxlite-ai/boxlite-win32-arm64-msvc/package.json').version
|
|
170
|
-
if (bindingPackageVersion !== '0.2.
|
|
171
|
-
throw new Error(`Native binding package version mismatch, expected 0.2.
|
|
170
|
+
if (bindingPackageVersion !== '0.2.6' && 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.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
172
172
|
}
|
|
173
173
|
return binding
|
|
174
174
|
} catch (e) {
|
|
@@ -186,8 +186,8 @@ function requireNative() {
|
|
|
186
186
|
try {
|
|
187
187
|
const binding = require('@boxlite-ai/boxlite-darwin-universal')
|
|
188
188
|
const bindingPackageVersion = require('@boxlite-ai/boxlite-darwin-universal/package.json').version
|
|
189
|
-
if (bindingPackageVersion !== '0.2.
|
|
190
|
-
throw new Error(`Native binding package version mismatch, expected 0.2.
|
|
189
|
+
if (bindingPackageVersion !== '0.2.6' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
190
|
+
throw new Error(`Native binding package version mismatch, expected 0.2.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
191
191
|
}
|
|
192
192
|
return binding
|
|
193
193
|
} catch (e) {
|
|
@@ -202,8 +202,8 @@ function requireNative() {
|
|
|
202
202
|
try {
|
|
203
203
|
const binding = require('@boxlite-ai/boxlite-darwin-x64')
|
|
204
204
|
const bindingPackageVersion = require('@boxlite-ai/boxlite-darwin-x64/package.json').version
|
|
205
|
-
if (bindingPackageVersion !== '0.2.
|
|
206
|
-
throw new Error(`Native binding package version mismatch, expected 0.2.
|
|
205
|
+
if (bindingPackageVersion !== '0.2.6' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
206
|
+
throw new Error(`Native binding package version mismatch, expected 0.2.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
207
207
|
}
|
|
208
208
|
return binding
|
|
209
209
|
} catch (e) {
|
|
@@ -218,8 +218,8 @@ function requireNative() {
|
|
|
218
218
|
try {
|
|
219
219
|
const binding = require('@boxlite-ai/boxlite-darwin-arm64')
|
|
220
220
|
const bindingPackageVersion = require('@boxlite-ai/boxlite-darwin-arm64/package.json').version
|
|
221
|
-
if (bindingPackageVersion !== '0.2.
|
|
222
|
-
throw new Error(`Native binding package version mismatch, expected 0.2.
|
|
221
|
+
if (bindingPackageVersion !== '0.2.6' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
222
|
+
throw new Error(`Native binding package version mismatch, expected 0.2.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
223
223
|
}
|
|
224
224
|
return binding
|
|
225
225
|
} catch (e) {
|
|
@@ -238,8 +238,8 @@ function requireNative() {
|
|
|
238
238
|
try {
|
|
239
239
|
const binding = require('@boxlite-ai/boxlite-freebsd-x64')
|
|
240
240
|
const bindingPackageVersion = require('@boxlite-ai/boxlite-freebsd-x64/package.json').version
|
|
241
|
-
if (bindingPackageVersion !== '0.2.
|
|
242
|
-
throw new Error(`Native binding package version mismatch, expected 0.2.
|
|
241
|
+
if (bindingPackageVersion !== '0.2.6' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
242
|
+
throw new Error(`Native binding package version mismatch, expected 0.2.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
243
243
|
}
|
|
244
244
|
return binding
|
|
245
245
|
} catch (e) {
|
|
@@ -254,8 +254,8 @@ function requireNative() {
|
|
|
254
254
|
try {
|
|
255
255
|
const binding = require('@boxlite-ai/boxlite-freebsd-arm64')
|
|
256
256
|
const bindingPackageVersion = require('@boxlite-ai/boxlite-freebsd-arm64/package.json').version
|
|
257
|
-
if (bindingPackageVersion !== '0.2.
|
|
258
|
-
throw new Error(`Native binding package version mismatch, expected 0.2.
|
|
257
|
+
if (bindingPackageVersion !== '0.2.6' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
258
|
+
throw new Error(`Native binding package version mismatch, expected 0.2.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
259
259
|
}
|
|
260
260
|
return binding
|
|
261
261
|
} catch (e) {
|
|
@@ -275,8 +275,8 @@ function requireNative() {
|
|
|
275
275
|
try {
|
|
276
276
|
const binding = require('@boxlite-ai/boxlite-linux-x64-musl')
|
|
277
277
|
const bindingPackageVersion = require('@boxlite-ai/boxlite-linux-x64-musl/package.json').version
|
|
278
|
-
if (bindingPackageVersion !== '0.2.
|
|
279
|
-
throw new Error(`Native binding package version mismatch, expected 0.2.
|
|
278
|
+
if (bindingPackageVersion !== '0.2.6' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
279
|
+
throw new Error(`Native binding package version mismatch, expected 0.2.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
280
280
|
}
|
|
281
281
|
return binding
|
|
282
282
|
} catch (e) {
|
|
@@ -291,8 +291,8 @@ function requireNative() {
|
|
|
291
291
|
try {
|
|
292
292
|
const binding = require('@boxlite-ai/boxlite-linux-x64-gnu')
|
|
293
293
|
const bindingPackageVersion = require('@boxlite-ai/boxlite-linux-x64-gnu/package.json').version
|
|
294
|
-
if (bindingPackageVersion !== '0.2.
|
|
295
|
-
throw new Error(`Native binding package version mismatch, expected 0.2.
|
|
294
|
+
if (bindingPackageVersion !== '0.2.6' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
295
|
+
throw new Error(`Native binding package version mismatch, expected 0.2.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
296
296
|
}
|
|
297
297
|
return binding
|
|
298
298
|
} catch (e) {
|
|
@@ -309,8 +309,8 @@ function requireNative() {
|
|
|
309
309
|
try {
|
|
310
310
|
const binding = require('@boxlite-ai/boxlite-linux-arm64-musl')
|
|
311
311
|
const bindingPackageVersion = require('@boxlite-ai/boxlite-linux-arm64-musl/package.json').version
|
|
312
|
-
if (bindingPackageVersion !== '0.2.
|
|
313
|
-
throw new Error(`Native binding package version mismatch, expected 0.2.
|
|
312
|
+
if (bindingPackageVersion !== '0.2.6' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
313
|
+
throw new Error(`Native binding package version mismatch, expected 0.2.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
314
314
|
}
|
|
315
315
|
return binding
|
|
316
316
|
} catch (e) {
|
|
@@ -325,8 +325,8 @@ function requireNative() {
|
|
|
325
325
|
try {
|
|
326
326
|
const binding = require('@boxlite-ai/boxlite-linux-arm64-gnu')
|
|
327
327
|
const bindingPackageVersion = require('@boxlite-ai/boxlite-linux-arm64-gnu/package.json').version
|
|
328
|
-
if (bindingPackageVersion !== '0.2.
|
|
329
|
-
throw new Error(`Native binding package version mismatch, expected 0.2.
|
|
328
|
+
if (bindingPackageVersion !== '0.2.6' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
329
|
+
throw new Error(`Native binding package version mismatch, expected 0.2.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
330
330
|
}
|
|
331
331
|
return binding
|
|
332
332
|
} catch (e) {
|
|
@@ -343,8 +343,8 @@ function requireNative() {
|
|
|
343
343
|
try {
|
|
344
344
|
const binding = require('@boxlite-ai/boxlite-linux-arm-musleabihf')
|
|
345
345
|
const bindingPackageVersion = require('@boxlite-ai/boxlite-linux-arm-musleabihf/package.json').version
|
|
346
|
-
if (bindingPackageVersion !== '0.2.
|
|
347
|
-
throw new Error(`Native binding package version mismatch, expected 0.2.
|
|
346
|
+
if (bindingPackageVersion !== '0.2.6' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
347
|
+
throw new Error(`Native binding package version mismatch, expected 0.2.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
348
348
|
}
|
|
349
349
|
return binding
|
|
350
350
|
} catch (e) {
|
|
@@ -359,8 +359,8 @@ function requireNative() {
|
|
|
359
359
|
try {
|
|
360
360
|
const binding = require('@boxlite-ai/boxlite-linux-arm-gnueabihf')
|
|
361
361
|
const bindingPackageVersion = require('@boxlite-ai/boxlite-linux-arm-gnueabihf/package.json').version
|
|
362
|
-
if (bindingPackageVersion !== '0.2.
|
|
363
|
-
throw new Error(`Native binding package version mismatch, expected 0.2.
|
|
362
|
+
if (bindingPackageVersion !== '0.2.6' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
363
|
+
throw new Error(`Native binding package version mismatch, expected 0.2.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
364
364
|
}
|
|
365
365
|
return binding
|
|
366
366
|
} catch (e) {
|
|
@@ -377,8 +377,8 @@ function requireNative() {
|
|
|
377
377
|
try {
|
|
378
378
|
const binding = require('@boxlite-ai/boxlite-linux-loong64-musl')
|
|
379
379
|
const bindingPackageVersion = require('@boxlite-ai/boxlite-linux-loong64-musl/package.json').version
|
|
380
|
-
if (bindingPackageVersion !== '0.2.
|
|
381
|
-
throw new Error(`Native binding package version mismatch, expected 0.2.
|
|
380
|
+
if (bindingPackageVersion !== '0.2.6' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
381
|
+
throw new Error(`Native binding package version mismatch, expected 0.2.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
382
382
|
}
|
|
383
383
|
return binding
|
|
384
384
|
} catch (e) {
|
|
@@ -393,8 +393,8 @@ function requireNative() {
|
|
|
393
393
|
try {
|
|
394
394
|
const binding = require('@boxlite-ai/boxlite-linux-loong64-gnu')
|
|
395
395
|
const bindingPackageVersion = require('@boxlite-ai/boxlite-linux-loong64-gnu/package.json').version
|
|
396
|
-
if (bindingPackageVersion !== '0.2.
|
|
397
|
-
throw new Error(`Native binding package version mismatch, expected 0.2.
|
|
396
|
+
if (bindingPackageVersion !== '0.2.6' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
397
|
+
throw new Error(`Native binding package version mismatch, expected 0.2.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
398
398
|
}
|
|
399
399
|
return binding
|
|
400
400
|
} catch (e) {
|
|
@@ -411,8 +411,8 @@ function requireNative() {
|
|
|
411
411
|
try {
|
|
412
412
|
const binding = require('@boxlite-ai/boxlite-linux-riscv64-musl')
|
|
413
413
|
const bindingPackageVersion = require('@boxlite-ai/boxlite-linux-riscv64-musl/package.json').version
|
|
414
|
-
if (bindingPackageVersion !== '0.2.
|
|
415
|
-
throw new Error(`Native binding package version mismatch, expected 0.2.
|
|
414
|
+
if (bindingPackageVersion !== '0.2.6' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
415
|
+
throw new Error(`Native binding package version mismatch, expected 0.2.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
416
416
|
}
|
|
417
417
|
return binding
|
|
418
418
|
} catch (e) {
|
|
@@ -427,8 +427,8 @@ function requireNative() {
|
|
|
427
427
|
try {
|
|
428
428
|
const binding = require('@boxlite-ai/boxlite-linux-riscv64-gnu')
|
|
429
429
|
const bindingPackageVersion = require('@boxlite-ai/boxlite-linux-riscv64-gnu/package.json').version
|
|
430
|
-
if (bindingPackageVersion !== '0.2.
|
|
431
|
-
throw new Error(`Native binding package version mismatch, expected 0.2.
|
|
430
|
+
if (bindingPackageVersion !== '0.2.6' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
431
|
+
throw new Error(`Native binding package version mismatch, expected 0.2.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
432
432
|
}
|
|
433
433
|
return binding
|
|
434
434
|
} catch (e) {
|
|
@@ -444,8 +444,8 @@ function requireNative() {
|
|
|
444
444
|
try {
|
|
445
445
|
const binding = require('@boxlite-ai/boxlite-linux-ppc64-gnu')
|
|
446
446
|
const bindingPackageVersion = require('@boxlite-ai/boxlite-linux-ppc64-gnu/package.json').version
|
|
447
|
-
if (bindingPackageVersion !== '0.2.
|
|
448
|
-
throw new Error(`Native binding package version mismatch, expected 0.2.
|
|
447
|
+
if (bindingPackageVersion !== '0.2.6' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
448
|
+
throw new Error(`Native binding package version mismatch, expected 0.2.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
449
449
|
}
|
|
450
450
|
return binding
|
|
451
451
|
} catch (e) {
|
|
@@ -460,8 +460,8 @@ function requireNative() {
|
|
|
460
460
|
try {
|
|
461
461
|
const binding = require('@boxlite-ai/boxlite-linux-s390x-gnu')
|
|
462
462
|
const bindingPackageVersion = require('@boxlite-ai/boxlite-linux-s390x-gnu/package.json').version
|
|
463
|
-
if (bindingPackageVersion !== '0.2.
|
|
464
|
-
throw new Error(`Native binding package version mismatch, expected 0.2.
|
|
463
|
+
if (bindingPackageVersion !== '0.2.6' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
464
|
+
throw new Error(`Native binding package version mismatch, expected 0.2.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
465
465
|
}
|
|
466
466
|
return binding
|
|
467
467
|
} catch (e) {
|
|
@@ -480,8 +480,8 @@ function requireNative() {
|
|
|
480
480
|
try {
|
|
481
481
|
const binding = require('@boxlite-ai/boxlite-openharmony-arm64')
|
|
482
482
|
const bindingPackageVersion = require('@boxlite-ai/boxlite-openharmony-arm64/package.json').version
|
|
483
|
-
if (bindingPackageVersion !== '0.2.
|
|
484
|
-
throw new Error(`Native binding package version mismatch, expected 0.2.
|
|
483
|
+
if (bindingPackageVersion !== '0.2.6' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
484
|
+
throw new Error(`Native binding package version mismatch, expected 0.2.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
485
485
|
}
|
|
486
486
|
return binding
|
|
487
487
|
} catch (e) {
|
|
@@ -496,8 +496,8 @@ function requireNative() {
|
|
|
496
496
|
try {
|
|
497
497
|
const binding = require('@boxlite-ai/boxlite-openharmony-x64')
|
|
498
498
|
const bindingPackageVersion = require('@boxlite-ai/boxlite-openharmony-x64/package.json').version
|
|
499
|
-
if (bindingPackageVersion !== '0.2.
|
|
500
|
-
throw new Error(`Native binding package version mismatch, expected 0.2.
|
|
499
|
+
if (bindingPackageVersion !== '0.2.6' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
500
|
+
throw new Error(`Native binding package version mismatch, expected 0.2.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
501
501
|
}
|
|
502
502
|
return binding
|
|
503
503
|
} catch (e) {
|
|
@@ -512,8 +512,8 @@ function requireNative() {
|
|
|
512
512
|
try {
|
|
513
513
|
const binding = require('@boxlite-ai/boxlite-openharmony-arm')
|
|
514
514
|
const bindingPackageVersion = require('@boxlite-ai/boxlite-openharmony-arm/package.json').version
|
|
515
|
-
if (bindingPackageVersion !== '0.2.
|
|
516
|
-
throw new Error(`Native binding package version mismatch, expected 0.2.
|
|
515
|
+
if (bindingPackageVersion !== '0.2.6' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
516
|
+
throw new Error(`Native binding package version mismatch, expected 0.2.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
517
517
|
}
|
|
518
518
|
return binding
|
|
519
519
|
} catch (e) {
|
|
@@ -579,10 +579,11 @@ if (!nativeBinding) {
|
|
|
579
579
|
throw new Error(`Failed to load native binding`)
|
|
580
580
|
}
|
|
581
581
|
|
|
582
|
-
const { JsBox, JsBoxlite, JsExecStderr, JsExecStdin, JsExecStdout, JsExecution } = nativeBinding
|
|
582
|
+
const { JsBox, JsBoxlite, JsExecStderr, JsExecStdin, JsExecStdout, JsExecution, JsGetOrCreateResult } = nativeBinding
|
|
583
583
|
export { JsBox }
|
|
584
584
|
export { JsBoxlite }
|
|
585
585
|
export { JsExecStderr }
|
|
586
586
|
export { JsExecStdin }
|
|
587
587
|
export { JsExecStdout }
|
|
588
588
|
export { JsExecution }
|
|
589
|
+
export { JsGetOrCreateResult }
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@boxlite-ai/boxlite",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.6",
|
|
4
4
|
"description": "BoxLite - Embeddable micro-VM runtime for secure, isolated code execution",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -37,9 +37,18 @@
|
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"@napi-rs/cli": "^3.0.0-alpha.62",
|
|
39
39
|
"@types/node": "^22.0.0",
|
|
40
|
+
"playwright-core": "1.58.0",
|
|
40
41
|
"typescript": "^5.2.0",
|
|
41
42
|
"vitest": "^2.0.0"
|
|
42
43
|
},
|
|
44
|
+
"peerDependencies": {
|
|
45
|
+
"playwright-core": ">=1.58.0"
|
|
46
|
+
},
|
|
47
|
+
"peerDependenciesMeta": {
|
|
48
|
+
"playwright-core": {
|
|
49
|
+
"optional": true
|
|
50
|
+
}
|
|
51
|
+
},
|
|
43
52
|
"keywords": [
|
|
44
53
|
"boxlite",
|
|
45
54
|
"sandbox",
|
|
@@ -66,9 +75,9 @@
|
|
|
66
75
|
},
|
|
67
76
|
"author": "Dorian Zheng <xingzhengde72@gmail.com>",
|
|
68
77
|
"optionalDependencies": {
|
|
69
|
-
"@boxlite-ai/boxlite-darwin-arm64": "0.2.
|
|
70
|
-
"@boxlite-ai/boxlite-darwin-x64": "0.2.
|
|
71
|
-
"@boxlite-ai/boxlite-linux-x64-gnu": "0.2.
|
|
72
|
-
"@boxlite-ai/boxlite-linux-arm64-gnu": "0.2.
|
|
78
|
+
"@boxlite-ai/boxlite-darwin-arm64": "0.2.6",
|
|
79
|
+
"@boxlite-ai/boxlite-darwin-x64": "0.2.6",
|
|
80
|
+
"@boxlite-ai/boxlite-linux-x64-gnu": "0.2.6",
|
|
81
|
+
"@boxlite-ai/boxlite-linux-arm64-gnu": "0.2.6"
|
|
73
82
|
}
|
|
74
83
|
}
|