camoufox-js 0.11.0 → 0.11.1

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 CHANGED
@@ -8,6 +8,17 @@ This is the JavaScript client for Camoufox. It is a port of the Python wrapper (
8
8
  npm install camoufox-js
9
9
  ```
10
10
 
11
+ The Camoufox browser itself is downloaded with `npx camoufox-js fetch` into the
12
+ per-user cache directory (`~/.cache/camoufox` on Linux). Set the
13
+ `CAMOUFOX_INSTALL_DIR` environment variable to install and resolve it from a
14
+ custom location instead — useful in containers and CI images where the home
15
+ directory is ephemeral or persisted separately (similar to Playwright's
16
+ `PLAYWRIGHT_BROWSERS_PATH`):
17
+
18
+ ```bash
19
+ CAMOUFOX_INSTALL_DIR=/opt/camoufox npx camoufox-js fetch
20
+ ```
21
+
11
22
  ## Usage
12
23
 
13
24
  You can launch Playwright-controlled Camoufox using this package like this:
package/dist/pkgman.d.ts CHANGED
@@ -1,6 +1,12 @@
1
1
  import type { PathLike } from "node:fs";
2
2
  import type { Writable } from "node:stream";
3
3
  export declare const OS_NAME: "mac" | "win" | "lin";
4
+ /**
5
+ * Directory the Camoufox browser is downloaded to and launched from.
6
+ * Defaults to the per-user cache directory; set CAMOUFOX_INSTALL_DIR to
7
+ * relocate it (e.g. into a container image layer when the home directory
8
+ * is ephemeral or persisted separately).
9
+ */
4
10
  export declare const INSTALL_DIR: PathLike;
5
11
  export declare const LOCAL_DATA: PathLike;
6
12
  export declare const OS_ARCH_MATRIX: {
package/dist/pkgman.js CHANGED
@@ -1,4 +1,4 @@
1
- import { execSync } from "node:child_process";
1
+ import { execFileSync } from "node:child_process";
2
2
  import * as fs from "node:fs";
3
3
  import * as os from "node:os";
4
4
  import * as path from "node:path";
@@ -35,7 +35,15 @@ if (!(process.platform in OS_MAP)) {
35
35
  }
36
36
  export const OS_NAME = OS_MAP[process.platform];
37
37
  const currentDir = import.meta.dirname ?? path.dirname(fileURLToPath(import.meta.url));
38
- export const INSTALL_DIR = userCacheDir("camoufox");
38
+ /**
39
+ * Directory the Camoufox browser is downloaded to and launched from.
40
+ * Defaults to the per-user cache directory; set CAMOUFOX_INSTALL_DIR to
41
+ * relocate it (e.g. into a container image layer when the home directory
42
+ * is ephemeral or persisted separately).
43
+ */
44
+ export const INSTALL_DIR = process.env.CAMOUFOX_INSTALL_DIR
45
+ ? path.resolve(process.env.CAMOUFOX_INSTALL_DIR)
46
+ : userCacheDir("camoufox");
39
47
  const formatBytes = (v, _, type) => type === "total" || type === "value" ? prettyBytes(v) : String(v);
40
48
  export const LOCAL_DATA = path.join(currentDir, "data-files");
41
49
  export const OS_ARCH_MATRIX = {
@@ -224,7 +232,7 @@ export class CamoufoxFetcher extends GitHubDownloader {
224
232
  await this.extractZip(tempFilePath);
225
233
  this.setVersion();
226
234
  if (OS_NAME !== "win") {
227
- execSync(`chmod -R 755 ${INSTALL_DIR}`);
235
+ execFileSync("chmod", ["-R", "755", INSTALL_DIR.toString()]);
228
236
  }
229
237
  console.log("Camoufox successfully installed.");
230
238
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "camoufox-js",
3
- "version": "0.11.0",
3
+ "version": "0.11.1",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "bin": "dist/__main__.js",
@@ -29,7 +29,7 @@
29
29
  "commander": "^14.0.0",
30
30
  "fingerprint-generator": "^2.1.66",
31
31
  "glob": "^13.0.0",
32
- "impit": "^0.13.0",
32
+ "impit": "^0.14.1",
33
33
  "language-tags": "^2.0.1",
34
34
  "maxmind": "^5.0.0",
35
35
  "pretty-bytes": "^7.1.0",