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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 00e2999e211a2e3ee480426bf3c9eed1a8c0b8760ece361bc2f1fde28db92cad
4
- data.tar.gz: b10e48835271556ee652882db960a95087d3a896b2c6fe009b434c0ceb820acf
3
+ metadata.gz: c391cb28a74732f550d94ffc69602383111cf3b99673d2fbcd6d451945db1c3f
4
+ data.tar.gz: f8a4e392dbf8e240932643bcdf9cba80726cec1c2d3146d9c0ae03141b389e9b
5
5
  SHA512:
6
- metadata.gz: d32e355e981ed307fcd1793cab79952cb3512708d1cbeb868e1db90cf60d21e847611b4ade10c9c440f2aee2640ac56af67ea95c25420ef1768dddfe32b266bb
7
- data.tar.gz: 939da8ab954c0df051fb00c678a2147ada31fc16447f23a69dc75943a79a50a638d919bf4c85e9f9d1e9f824008d956fd39410ba0b2d43f9d5a5a7826a2baa17
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
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Camoufox
4
- VERSION = "0.2.0"
4
+ VERSION = "0.3.0"
5
5
  end
@@ -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 playwright = loadPlaywright();
50
- const browserType = playwright.firefox;
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.2.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-03 00:00:00.000000000 Z
10
+ date: 2025-11-10 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: base64