puppeteer-bidi 0.0.1.beta3 → 0.0.1.beta5

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: 4a297f926102da482b6ffaecf8f894cb95dffb910f6743ebc75d0414f1aae00f
4
- data.tar.gz: 81c8b08b57b53ca739af7e864723686965278d60bd5d0d1197aff31dd37b299f
3
+ metadata.gz: 552201477c25d25546b8336a6b38d49eb26d57158ab848deed7ad01223484a17
4
+ data.tar.gz: abf59f3c09e19997883e8c6867268741225cdea474bb6aff8c4547593758f760
5
5
  SHA512:
6
- metadata.gz: 519a8a8e1dccfc046de5c8bea356a59d3b5e40e79e8040f85fbbe370f1530170ccbd555b32a242841d132130ef4da85eeedc58bac3f554ab34159faa0b807826
7
- data.tar.gz: d60e4cb2eb5caf33a055d394861814f4ecd3f8b561796ff5cb69cce17a5efe59ae3e07cc98e9e5c46b90a68944f20090cfccb6726849cf774f0f0f015fbffaf1
6
+ metadata.gz: e5cd4ab729b1bde62808ac953baa64d8ea46b2a5d5b3bc64c758cc0a2f20602aa9bb0be707124bcefcd888201290f8de516ee24411292441b78f6e98d92e03ff
7
+ data.tar.gz: f582a4541d667b1456a0543bab37fc066f556da6a9630b41cf77383d1bd9d18401494efda0089f214f4680f733ccc47e232fd90d027c7ee2c836eccb352ac272
data/CLAUDE.md CHANGED
@@ -108,6 +108,10 @@ end
108
108
  - Public methods should have type annotations
109
109
  - **Do NOT use `@rbs!` blocks** - RubyMine IDE doesn't recognize them
110
110
  - **Use direct union types** instead of type aliases: `BrowserTarget | PageTarget | FrameTarget` not `target`
111
+ - **Do NOT use `**options` in public APIs** - RubyMine shows as `untyped`. Use explicit keyword arguments:
112
+ - Optional params: `param: nil`
113
+ - Boolean params with default: `headless: true` or `enabled: false`
114
+ - Internal/Core layer methods may still use `**options` for flexibility
111
115
 
112
116
  **Generate RBS files:**
113
117
  ```bash
@@ -69,18 +69,18 @@ module Puppeteer
69
69
  end
70
70
 
71
71
  # Launch a new Firefox browser instance
72
- # @rbs executable_path: String
73
- # @rbs user_data_dir: String
74
- # @rbs headless: bool
75
- # @rbs args: Array[String]
76
- # @rbs timeout: Numeric
72
+ # @rbs executable_path: String? -- Path to browser executable
73
+ # @rbs user_data_dir: String? -- Path to user data directory
74
+ # @rbs headless: bool -- Run browser in headless mode
75
+ # @rbs args: Array[String]? -- Additional browser arguments
76
+ # @rbs timeout: Numeric? -- Launch timeout in seconds
77
77
  # @rbs return: Browser -- Browser instance
78
- def self.launch(**options)
78
+ def self.launch(executable_path: nil, user_data_dir: nil, headless: true, args: nil, timeout: nil)
79
79
  launcher = BrowserLauncher.new(
80
- executable_path: options[:executable_path],
81
- user_data_dir: options[:user_data_dir],
82
- headless: options.fetch(:headless, true),
83
- args: options.fetch(:args, [])
80
+ executable_path: executable_path,
81
+ user_data_dir: user_data_dir,
82
+ headless: headless,
83
+ args: args || []
84
84
  )
85
85
 
86
86
  ws_endpoint = launcher.launch
@@ -90,7 +90,7 @@ module Puppeteer
90
90
 
91
91
  # Start transport connection in background thread with Sync reactor
92
92
  # Sync is the preferred way to run async code at the top level
93
- AsyncUtils.async_timeout(options.fetch(:timeout, 30) * 1000, transport.connect).wait
93
+ AsyncUtils.async_timeout((timeout || 30) * 1000, transport.connect).wait
94
94
 
95
95
  connection = Connection.new(transport)
96
96
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Puppeteer
4
4
  module Bidi
5
- VERSION = "0.0.1.beta3"
5
+ VERSION = "0.0.1.beta5"
6
6
  end
7
7
  end
@@ -33,14 +33,38 @@ require "puppeteer/bidi/browser"
33
33
  module Puppeteer
34
34
  module Bidi
35
35
  # Launch a new browser instance
36
- # @rbs executable_path: String
37
- # @rbs user_data_dir: String
38
- # @rbs headless: bool
39
- # @rbs args: Array[String]
40
- # @rbs timeout: Numeric
41
- # @rbs return: Browser -- Browser instance
42
- def self.launch(**options)
43
- Browser.launch(**options)
36
+ # @rbs executable_path: String? -- Path to browser executable
37
+ # @rbs user_data_dir: String? -- Path to user data directory
38
+ # @rbs headless: bool -- Run browser in headless mode
39
+ # @rbs args: Array[String]? -- Additional browser arguments
40
+ # @rbs timeout: Numeric? -- Launch timeout in seconds
41
+ # @rbs block: (Browser -> void)? -- Optional block to execute with the browser instance
42
+ # @rbs return: Browser? -- Browser instance (if no block given)
43
+ def self.launch(executable_path: nil, user_data_dir: nil, headless: true, args: nil, timeout: nil, &block)
44
+ if block
45
+ Sync do
46
+ begin
47
+ browser = Browser.launch(
48
+ executable_path: executable_path,
49
+ user_data_dir: user_data_dir,
50
+ headless: headless,
51
+ args: args,
52
+ timeout: timeout
53
+ )
54
+ block.call(browser)
55
+ ensure
56
+ browser&.close
57
+ end
58
+ end
59
+ else
60
+ Browser.launch(
61
+ executable_path: executable_path,
62
+ user_data_dir: user_data_dir,
63
+ headless: headless,
64
+ args: args,
65
+ timeout: timeout
66
+ )
67
+ end
44
68
  end
45
69
 
46
70
  # Connect to an existing browser instance
@@ -23,13 +23,13 @@ module Puppeteer
23
23
  def initialize: (connection: Connection, launcher: BrowserLauncher?, core_browser: Core::Browser, session: Core::Session) -> void
24
24
 
25
25
  # Launch a new Firefox browser instance
26
- # @rbs executable_path: String
27
- # @rbs user_data_dir: String
28
- # @rbs headless: bool
29
- # @rbs args: Array[String]
30
- # @rbs timeout: Numeric
26
+ # @rbs executable_path: String? -- Path to browser executable
27
+ # @rbs user_data_dir: String? -- Path to user data directory
28
+ # @rbs headless: bool -- Run browser in headless mode
29
+ # @rbs args: Array[String]? -- Additional browser arguments
30
+ # @rbs timeout: Numeric? -- Launch timeout in seconds
31
31
  # @rbs return: Browser -- Browser instance
32
- def self.launch: (**untyped options) -> Browser
32
+ def self.launch: (?executable_path: String?, ?user_data_dir: String?, ?headless: bool, ?args: Array[String]?, ?timeout: Numeric?) -> Browser
33
33
 
34
34
  # Connect to an existing Firefox browser instance
35
35
  # @rbs ws_endpoint: String -- WebSocket endpoint URL
@@ -3,13 +3,14 @@
3
3
  module Puppeteer
4
4
  module Bidi
5
5
  # Launch a new browser instance
6
- # @rbs executable_path: String
7
- # @rbs user_data_dir: String
8
- # @rbs headless: bool
9
- # @rbs args: Array[String]
10
- # @rbs timeout: Numeric
11
- # @rbs return: Browser -- Browser instance
12
- def self.launch: (**untyped options) -> Browser
6
+ # @rbs executable_path: String? -- Path to browser executable
7
+ # @rbs user_data_dir: String? -- Path to user data directory
8
+ # @rbs headless: bool -- Run browser in headless mode
9
+ # @rbs args: Array[String]? -- Additional browser arguments
10
+ # @rbs timeout: Numeric? -- Launch timeout in seconds
11
+ # @rbs block: (Browser -> void)? -- Optional block to execute with the browser instance
12
+ # @rbs return: Browser? -- Browser instance (if no block given)
13
+ def self.launch: (?executable_path: String?, ?user_data_dir: String?, ?headless: bool, ?args: Array[String]?, ?timeout: Numeric?) ?{ (?) -> untyped } -> Browser?
13
14
 
14
15
  # Connect to an existing browser instance
15
16
  # @rbs ws_endpoint: String -- WebSocket endpoint URL
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: puppeteer-bidi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1.beta3
4
+ version: 0.0.1.beta5
5
5
  platform: ruby
6
6
  authors:
7
7
  - YusukeIwaki