nothing-browser 0.0.18 → 0.0.19
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/launch/detect.js +8 -0
- package/dist/launch/spawn.js +8 -0
- package/dist/piggy/launch/detect.d.ts +1 -1
- package/dist/piggy/launch/detect.d.ts.map +1 -1
- package/dist/piggy.d.ts +1 -0
- package/dist/piggy.d.ts.map +1 -1
- package/dist/piggy.js +8 -0
- package/package.json +1 -1
- package/piggy/launch/detect.ts +13 -4
- package/piggy.ts +9 -4
package/dist/launch/detect.js
CHANGED
|
@@ -739,6 +739,14 @@ var BINARY_NAMES = {
|
|
|
739
739
|
headful: "nothing-browser-headful"
|
|
740
740
|
};
|
|
741
741
|
function detectBinary(mode = "headless") {
|
|
742
|
+
if (mode !== "headless" && mode !== "headful") {
|
|
743
|
+
if (existsSync(mode)) {
|
|
744
|
+
logger_default.success(`Binary found (custom path): ${mode}`);
|
|
745
|
+
return mode;
|
|
746
|
+
}
|
|
747
|
+
logger_default.error(`❌ Binary not found at custom path: ${mode}`);
|
|
748
|
+
return null;
|
|
749
|
+
}
|
|
742
750
|
const cwd = process.cwd();
|
|
743
751
|
const name = BINARY_NAMES[mode];
|
|
744
752
|
if (process.platform === "win32") {
|
package/dist/launch/spawn.js
CHANGED
|
@@ -744,6 +744,14 @@ var BINARY_NAMES = {
|
|
|
744
744
|
headful: "nothing-browser-headful"
|
|
745
745
|
};
|
|
746
746
|
function detectBinary(mode = "headless") {
|
|
747
|
+
if (mode !== "headless" && mode !== "headful") {
|
|
748
|
+
if (existsSync(mode)) {
|
|
749
|
+
logger_default.success(`Binary found (custom path): ${mode}`);
|
|
750
|
+
return mode;
|
|
751
|
+
}
|
|
752
|
+
logger_default.error(`❌ Binary not found at custom path: ${mode}`);
|
|
753
|
+
return null;
|
|
754
|
+
}
|
|
747
755
|
const cwd = process.cwd();
|
|
748
756
|
const name = BINARY_NAMES[mode];
|
|
749
757
|
if (process.platform === "win32") {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"detect.d.ts","sourceRoot":"","sources":["../../../piggy/launch/detect.ts"],"names":[],"mappings":"AAIA,MAAM,MAAM,UAAU,GAAG,UAAU,GAAG,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"detect.d.ts","sourceRoot":"","sources":["../../../piggy/launch/detect.ts"],"names":[],"mappings":"AAIA,MAAM,MAAM,UAAU,GAAG,UAAU,GAAG,SAAS,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC;AAOhE,wBAAgB,YAAY,CAAC,IAAI,GAAE,UAAuB,GAAG,MAAM,GAAG,IAAI,CAwCzE"}
|
package/dist/piggy.d.ts
CHANGED
package/dist/piggy.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"piggy.d.ts","sourceRoot":"","sources":["../piggy.ts"],"names":[],"mappings":"AAIA,OAAO,EAA6C,KAAK,UAAU,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"piggy.d.ts","sourceRoot":"","sources":["../piggy.ts"],"names":[],"mappings":"AAIA,OAAO,EAA6C,KAAK,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAa9F,MAAM,MAAM,UAAU,GAAG,UAAU,GAAG,UAAU,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC;AAOjE,QAAA,MAAM,KAAK,EAAE,GAwLZ,CAAC;AAGF,KAAK,UAAU,CAAC,KAAK,SAAS,MAAM,IAAI,OAAO,KAAK,GAAG;KACpD,CAAC,IAAI,KAAK,GAAG,UAAU;CACzB,CAAC;AAEF,wBAAgB,QAAQ,CAAC,KAAK,SAAS,MAAM,KAAK,UAAU,CAAC,KAAK,CAAC,CAElE;AAED,YAAY,EAAE,UAAU,EAAE,CAAC;AAC3B,eAAe,KAAK,CAAC;AACrB,OAAO,EAAE,KAAK,EAAE,CAAC"}
|
package/dist/piggy.js
CHANGED
|
@@ -6870,6 +6870,14 @@ var BINARY_NAMES = {
|
|
|
6870
6870
|
headful: "nothing-browser-headful"
|
|
6871
6871
|
};
|
|
6872
6872
|
function detectBinary(mode = "headless") {
|
|
6873
|
+
if (mode !== "headless" && mode !== "headful") {
|
|
6874
|
+
if (existsSync(mode)) {
|
|
6875
|
+
logger_default.success(`Binary found (custom path): ${mode}`);
|
|
6876
|
+
return mode;
|
|
6877
|
+
}
|
|
6878
|
+
logger_default.error(`❌ Binary not found at custom path: ${mode}`);
|
|
6879
|
+
return null;
|
|
6880
|
+
}
|
|
6873
6881
|
const cwd = process.cwd();
|
|
6874
6882
|
const name = BINARY_NAMES[mode];
|
|
6875
6883
|
if (process.platform === "win32") {
|
package/package.json
CHANGED
package/piggy/launch/detect.ts
CHANGED
|
@@ -2,16 +2,26 @@ import { existsSync } from 'fs';
|
|
|
2
2
|
import { join } from 'path';
|
|
3
3
|
import logger from '../logger';
|
|
4
4
|
|
|
5
|
-
export type BinaryMode = 'headless' | 'headful';
|
|
5
|
+
export type BinaryMode = 'headless' | 'headful' | (string & {});
|
|
6
6
|
|
|
7
|
-
const BINARY_NAMES: Record<
|
|
7
|
+
const BINARY_NAMES: Record<'headless' | 'headful', string> = {
|
|
8
8
|
headless: 'nothing-browser-headless',
|
|
9
9
|
headful: 'nothing-browser-headful',
|
|
10
10
|
};
|
|
11
11
|
|
|
12
12
|
export function detectBinary(mode: BinaryMode = 'headless'): string | null {
|
|
13
|
+
// If it's an arbitrary path, just verify it exists and return it as-is
|
|
14
|
+
if (mode !== 'headless' && mode !== 'headful') {
|
|
15
|
+
if (existsSync(mode)) {
|
|
16
|
+
logger.success(`Binary found (custom path): ${mode}`);
|
|
17
|
+
return mode;
|
|
18
|
+
}
|
|
19
|
+
logger.error(`❌ Binary not found at custom path: ${mode}`);
|
|
20
|
+
return null;
|
|
21
|
+
}
|
|
22
|
+
|
|
13
23
|
const cwd = process.cwd();
|
|
14
|
-
|
|
24
|
+
const name = BINARY_NAMES[mode as 'headless' | 'headful'];
|
|
15
25
|
|
|
16
26
|
// Windows
|
|
17
27
|
if (process.platform === 'win32') {
|
|
@@ -38,6 +48,5 @@ export function detectBinary(mode: BinaryMode = 'headless'): string | null {
|
|
|
38
48
|
if (process.platform !== 'win32') {
|
|
39
49
|
logger.error(`Then run: chmod +x ${name}`);
|
|
40
50
|
}
|
|
41
|
-
|
|
42
51
|
return null;
|
|
43
52
|
}
|
package/piggy.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// piggy.ts
|
|
2
|
-
import { detectBinary
|
|
2
|
+
import { detectBinary } from "./piggy/launch/detect";
|
|
3
3
|
import { spawnBrowser, killBrowser, spawnBrowserOnSocket } from "./piggy/launch/spawn";
|
|
4
4
|
import { PiggyClient } from "./piggy/client";
|
|
5
5
|
import { setClient, setHumanMode, createSiteObject, type SiteObject } from "./piggy/register";
|
|
@@ -9,6 +9,14 @@ import logger from "./piggy/logger";
|
|
|
9
9
|
|
|
10
10
|
type TabMode = "tab" | "process";
|
|
11
11
|
|
|
12
|
+
// "headless" and "headfull" are the built-in modes.
|
|
13
|
+
// Any other string is treated as a raw path to a binary —
|
|
14
|
+
// e.g. "../my-browser/browser", "C:\\browsers\\mybrowser.exe",
|
|
15
|
+
// "/opt/weird-browser/bin/wb", etc.
|
|
16
|
+
// The (string & {}) trick keeps autocomplete for the two literals
|
|
17
|
+
// while still accepting any arbitrary string.
|
|
18
|
+
export type BinaryMode = "headless" | "headfull" | (string & {});
|
|
19
|
+
|
|
12
20
|
let _client: PiggyClient | null = null;
|
|
13
21
|
let _tabMode: TabMode = "tab";
|
|
14
22
|
const _extraProcs: { socket: string; client: PiggyClient }[] = [];
|
|
@@ -201,9 +209,6 @@ const piggy: any = {
|
|
|
201
209
|
};
|
|
202
210
|
|
|
203
211
|
// ── usePiggy ──────────────────────────────────────────────────────────────────
|
|
204
|
-
// Typed accessor — call AFTER register() so sites exist on piggy.
|
|
205
|
-
// const { amazon, ebay } = usePiggy<"amazon" | "ebay">()
|
|
206
|
-
|
|
207
212
|
type TypedPiggy<Sites extends string> = typeof piggy & {
|
|
208
213
|
[K in Sites]: SiteObject;
|
|
209
214
|
};
|