@browsersync/bslive 0.16.2 → 0.18.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.js CHANGED
@@ -1,4 +1,4 @@
1
1
  #!/usr/bin/env node
2
- const {startSync} = require("./index.js");
3
- let code = startSync(process.argv.slice(1));
2
+ const { startBlocking } = require("./index.js");
3
+ let code = startBlocking(process.argv.slice(1));
4
4
  process.exit(code);
package/entry.mjs ADDED
@@ -0,0 +1,24 @@
1
+ import { BsSystem } from "./index.js";
2
+
3
+ export function create() {
4
+ return new (class {
5
+ /** @type {Promise<any>} */
6
+ prom;
7
+
8
+ fromArgs(args) {
9
+ let sys = new BsSystem();
10
+ const inputArgs = ["bslive", ...args];
11
+ const controller = new AbortController();
12
+
13
+ this.prom = sys.start(inputArgs, controller.signal);
14
+ this.prom.catch(() => console.error("huh?"));
15
+
16
+ return new (class {
17
+ stop() {
18
+ controller.abort();
19
+ sys.stop();
20
+ }
21
+ })();
22
+ }
23
+ })();
24
+ }
package/index.d.ts CHANGED
@@ -3,6 +3,12 @@
3
3
 
4
4
  /* auto-generated by NAPI-RS */
5
5
 
6
- export declare function start(args: Array<string>): Promise<number>
7
6
  /** Launch in a blocking way */
8
- export declare function startSync(args: Array<string>): number
7
+ export declare function startBlocking(args: Array<string>): number
8
+ export type JsBsSystem = BsSystem
9
+ export class BsSystem {
10
+ constructor()
11
+ start(args: Array<string>, signal: AbortSignal): Promise<unknown>
12
+ send(arg: any): void
13
+ stop(): void
14
+ }
package/index.js CHANGED
@@ -310,7 +310,7 @@ if (!nativeBinding) {
310
310
  throw new Error(`Failed to load native binding`)
311
311
  }
312
312
 
313
- const { start, startSync } = nativeBinding
313
+ const { startBlocking, BsSystem } = nativeBinding
314
314
 
315
- module.exports.start = start
316
- module.exports.startSync = startSync
315
+ module.exports.startBlocking = startBlocking
316
+ module.exports.BsSystem = BsSystem
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@browsersync/bslive",
3
- "version": "0.16.2",
3
+ "version": "0.18.0",
4
4
  "main": "index.js",
5
- "types": "index.d.ts",
6
5
  "bin": {
7
6
  "bslive": "./bin.js"
8
7
  },
9
8
  "files": [
10
9
  "index.js",
10
+ "entry.mjs",
11
11
  "index.d.ts",
12
12
  "bin.js"
13
13
  ],
@@ -65,9 +65,9 @@
65
65
  "node": "22"
66
66
  },
67
67
  "optionalDependencies": {
68
- "@browsersync/bslive-win32-x64-msvc": "0.16.2",
69
- "@browsersync/bslive-darwin-x64": "0.16.2",
70
- "@browsersync/bslive-linux-x64-gnu": "0.16.2",
71
- "@browsersync/bslive-darwin-arm64": "0.16.2"
68
+ "@browsersync/bslive-win32-x64-msvc": "0.18.0",
69
+ "@browsersync/bslive-darwin-x64": "0.18.0",
70
+ "@browsersync/bslive-linux-x64-gnu": "0.18.0",
71
+ "@browsersync/bslive-darwin-arm64": "0.18.0"
72
72
  }
73
73
  }