camoufox-js 0.8.3 → 0.8.5
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/fingerprints.js +1 -1
- package/dist/webgl/sample.js +24 -3
- package/package.json +3 -3
package/dist/fingerprints.js
CHANGED
|
@@ -23,7 +23,7 @@ function _castToProperties(camoufoxData, castEnum, bfDict, ffVersion) {
|
|
|
23
23
|
data = 0;
|
|
24
24
|
}
|
|
25
25
|
if (ffVersion && typeof data === "string") {
|
|
26
|
-
data = data.
|
|
26
|
+
data = data.replaceAll(/(?<!\d)(1[0-9]{2})(\.0)(?!\d)/gi, `${ffVersion}$2`);
|
|
27
27
|
}
|
|
28
28
|
camoufoxData[typeKey] = data;
|
|
29
29
|
}
|
package/dist/webgl/sample.js
CHANGED
|
@@ -1,13 +1,34 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
|
-
import Database from "better-sqlite3";
|
|
3
2
|
import { OS_ARCH_MATRIX } from "../pkgman.js";
|
|
3
|
+
// Cached Database constructor - loaded lazily on first use
|
|
4
|
+
let DatabaseConstructor = null;
|
|
5
|
+
/**
|
|
6
|
+
* Opens a SQLite database using the appropriate driver for the runtime.
|
|
7
|
+
* Uses bun:sqlite in Bun, better-sqlite3 in Node.js.
|
|
8
|
+
* The Database constructor is cached after first load.
|
|
9
|
+
*/
|
|
10
|
+
async function openDatabase(pathName) {
|
|
11
|
+
if (!DatabaseConstructor) {
|
|
12
|
+
if (typeof Bun !== "undefined") {
|
|
13
|
+
// @ts-ignore - bun:sqlite only exists in Bun runtime
|
|
14
|
+
const { Database: BunDatabase } = await import("bun:sqlite");
|
|
15
|
+
DatabaseConstructor = BunDatabase;
|
|
16
|
+
}
|
|
17
|
+
else {
|
|
18
|
+
const { default: NodeDatabase } = await import("better-sqlite3");
|
|
19
|
+
DatabaseConstructor = NodeDatabase;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
// DatabaseConstructor is guaranteed to be set at this point
|
|
23
|
+
return new DatabaseConstructor(pathName);
|
|
24
|
+
}
|
|
4
25
|
// Get database path relative to this file
|
|
5
26
|
const DB_PATH = path.join(import.meta.dirname, "..", "data-files", "webgl_data.db");
|
|
6
27
|
export async function sampleWebGL(os, vendor, renderer) {
|
|
7
28
|
if (!OS_ARCH_MATRIX[os]) {
|
|
8
29
|
throw new Error(`Invalid OS: ${os}. Must be one of: win, mac, lin`);
|
|
9
30
|
}
|
|
10
|
-
const db =
|
|
31
|
+
const db = await openDatabase(DB_PATH);
|
|
11
32
|
let query = "";
|
|
12
33
|
let params = [];
|
|
13
34
|
if (vendor && renderer) {
|
|
@@ -63,7 +84,7 @@ export async function sampleWebGL(os, vendor, renderer) {
|
|
|
63
84
|
});
|
|
64
85
|
}
|
|
65
86
|
export async function getPossiblePairs() {
|
|
66
|
-
const db =
|
|
87
|
+
const db = await openDatabase(DB_PATH);
|
|
67
88
|
const result = {};
|
|
68
89
|
return new Promise((resolve, reject) => {
|
|
69
90
|
try {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "camoufox-js",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.5",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"scripts": {
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
},
|
|
29
29
|
"license": "MPL-2.0",
|
|
30
30
|
"description": "Experimental JS port of Camoufox for Python.",
|
|
31
|
-
"packageManager": "yarn@4.
|
|
31
|
+
"packageManager": "yarn@4.12.0",
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"adm-zip": "^0.5.16",
|
|
34
34
|
"better-sqlite3": "^12.2.0",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"xml2js": "^0.6.2"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"@biomejs/biome": "2.3.
|
|
46
|
+
"@biomejs/biome": "2.3.11",
|
|
47
47
|
"@types/adm-zip": "^0.5.7",
|
|
48
48
|
"@types/better-sqlite3": "^7.6.13",
|
|
49
49
|
"@types/language-tags": "^1.0.4",
|