camoufox 0.2.0 → 0.3.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/camoufox/__version__.rb +1 -1
- data/lib/camoufox/visit.js +55 -3
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c391cb28a74732f550d94ffc69602383111cf3b99673d2fbcd6d451945db1c3f
|
|
4
|
+
data.tar.gz: f8a4e392dbf8e240932643bcdf9cba80726cec1c2d3146d9c0ae03141b389e9b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ea6e830b939932a3b906c77bedc5e2a28b5328c5194bafe420f5fbd2dedf0a96e3c631ea0f617389d52c6717970b2c192ca062656f92e6db2c0655276f0d1fa5
|
|
7
|
+
data.tar.gz: b7aa87886a1a0312d8ecc77868e13f5b9748055e429131c091f8e95583290ed9c97763809953f5abe9615694a160d0180af4408ccdb3db0959b940c61e68ad9f
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.3.0
|
|
4
|
+
- Improve Playwright bridge: unwrap driver bundles that only expose `createPlaywright`/`default`
|
|
5
|
+
exports so `Camoufox::SyncAPI` can always reach `playwright.firefox`.
|
|
6
|
+
|
|
3
7
|
## 0.2.0
|
|
4
8
|
- Fix native launch options so the provided `headless` flag is respected by Playwright.
|
|
5
9
|
|
data/lib/camoufox/__version__.rb
CHANGED
data/lib/camoufox/visit.js
CHANGED
|
@@ -11,6 +11,57 @@ function readStdinAsBase64() {
|
|
|
11
11
|
});
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
+
function withDefault(value, extractor) {
|
|
15
|
+
if (!value) {
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
try {
|
|
20
|
+
return extractor(value);
|
|
21
|
+
} catch (error) {
|
|
22
|
+
// Surface the original failure to the caller.
|
|
23
|
+
console.warn(`camoufox: failed to initialize Playwright shim (${error.message || error})`);
|
|
24
|
+
return null;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function resolvePlaywrightApi(candidate) {
|
|
29
|
+
if (!candidate) {
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
if (candidate.firefox) {
|
|
34
|
+
return candidate;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
if (candidate.default) {
|
|
38
|
+
const resolved = resolvePlaywrightApi(candidate.default);
|
|
39
|
+
if (resolved) {
|
|
40
|
+
return resolved;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
if (typeof candidate.createInProcessPlaywright === 'function') {
|
|
45
|
+
const resolved = withDefault(candidate, (mod) => mod.createInProcessPlaywright());
|
|
46
|
+
if (resolved) {
|
|
47
|
+
return resolved;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
if (typeof candidate.createPlaywright === 'function') {
|
|
52
|
+
const resolved = withDefault(candidate, (mod) => mod.createPlaywright({ sdkLanguage: process.env.PW_LANG_NAME || 'javascript' }));
|
|
53
|
+
if (resolved && resolved.firefox) {
|
|
54
|
+
return resolved;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
if (candidate.playwright) {
|
|
59
|
+
return resolvePlaywrightApi(candidate.playwright);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
return null;
|
|
63
|
+
}
|
|
64
|
+
|
|
14
65
|
function loadPlaywright() {
|
|
15
66
|
const override = process.env.CAMOUFOX_PLAYWRIGHT_JS_REQUIRE;
|
|
16
67
|
if (override) {
|
|
@@ -46,10 +97,11 @@ async function main() {
|
|
|
46
97
|
delete options.executablePath;
|
|
47
98
|
}
|
|
48
99
|
|
|
49
|
-
const
|
|
50
|
-
const
|
|
100
|
+
const playwrightModule = loadPlaywright();
|
|
101
|
+
const playwright = resolvePlaywrightApi(playwrightModule);
|
|
102
|
+
const browserType = playwright && playwright.firefox;
|
|
51
103
|
if (!browserType) {
|
|
52
|
-
console.error('Playwright module does not expose `firefox`.');
|
|
104
|
+
console.error('Playwright module does not expose `firefox`. Provide a driver bundle or module that exports Playwright.firefox.');
|
|
53
105
|
process.exit(1);
|
|
54
106
|
}
|
|
55
107
|
|
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: camoufox
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.3.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Camoufox contributors
|
|
8
8
|
bindir: bin
|
|
9
9
|
cert_chain: []
|
|
10
|
-
date: 2025-11-
|
|
10
|
+
date: 2025-11-10 00:00:00.000000000 Z
|
|
11
11
|
dependencies:
|
|
12
12
|
- !ruby/object:Gem::Dependency
|
|
13
13
|
name: base64
|