mimic-browser 0.1.0 → 0.1.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.
@@ -1,12 +1,12 @@
1
1
  {
2
- "release": "v0.2.3",
3
- "manifestSha256": "11964875450f3526da487cc8d66618065fb3e0d1a5d69250a27a8def2b514fb5",
4
- "manifestJson": "{\r\n \"version\": \"v0.2.3\",\r\n \"sourceRevision\": \"cfcabd40e52e86bb30461888fe101f37b4996774\",\r\n \"packagingRevision\": \"cfcabd40e52e86bb30461888fe101f37b4996774\",\r\n \"ciRun\": \"https://github.com/mimic-browser/runtime/actions/runs/37752215291\",\r\n \"binariesReusedUnchanged\": true,\r\n \"license\": \"Prosperity-3.0.0\",\r\n \"exampleLicense\": \"MIT\",\r\n \"requirements\": {\r\n \"windows-amd64\": \"Windows x64; validated on Windows 11\",\r\n \"linux-amd64\": \"glibc 2.39+, libgcc_s, installed fonts; Ubuntu 24.04 / WSL2\"\r\n },\r\n \"clients\": {\r\n \"playwright-core\": \"1.63.0\",\r\n \"puppeteer-core\": \"25.10.0\"\r\n },\r\n \"artifacts\": [\r\n {\r\n \"platform\": \"windows-amd64\",\r\n \"archive\": \"mimic-v0.2.3-windows-amd64.zip\",\r\n \"sha256\": \"6040ed4fa90f7cb42df6cb54d9a1481c0945a3cbde340ffebd5d45883ee49a19\",\r\n \"size\": 47677460,\r\n \"binarySha256\": \"a657174860a4e570ef8e0ee8737a566134f4c1c15d595e8f6f823437c1556cb5\",\r\n \"binaryVersion\": \"v0.2.3\",\r\n \"checks\": [\r\n \"runtimecheck:v8\",\r\n \"runtimecheck:quickjs\",\r\n \"runtimecheck:goja\",\r\n \"examples:puppeteer\",\r\n \"examples:playwright\",\r\n \"examples:concurrency\"\r\n ]\r\n },\r\n {\r\n \"platform\": \"linux-amd64\",\r\n \"archive\": \"mimic-v0.2.3-linux-amd64.tar.gz\",\r\n \"sha256\": \"4fb6a71f7b2c5d5ad49136c9456e6f2cc1e70701e91259ff905ae72218c56a9a\",\r\n \"size\": 51026543,\r\n \"binarySha256\": \"414fc217b24301861c078e0e39dafb79110996ea4c4c23ff7d33fab41175eb32\",\r\n \"binaryVersion\": \"v0.2.3\",\r\n \"checks\": [\r\n \"runtimecheck:v8\",\r\n \"runtimecheck:quickjs\",\r\n \"runtimecheck:goja\",\r\n \"examples:puppeteer\",\r\n \"examples:playwright\",\r\n \"examples:concurrency\"\r\n ]\r\n }\r\n ]\r\n}\r\n",
2
+ "release": "v0.2.4",
3
+ "manifestSha256": "cb263f5cf287ee845670663e2ed33248d32d136f9e67bc82b78f0d27b93b4c38",
4
+ "manifestJson": "{\r\n \"version\": \"v0.2.4\",\r\n \"sourceRevision\": \"ee49a1da8776b63b1c43654a121bcb31dc618106\",\r\n \"packagingRevision\": \"3126b06798eeaa7a767ea4dc64ab34dcce46d276\",\r\n \"ciRun\": \"https://github.com/mimic-browser/runtime/actions/runs/37779657608\",\r\n \"binariesReusedUnchanged\": true,\r\n \"license\": \"Prosperity-3.0.0\",\r\n \"exampleLicense\": \"MIT\",\r\n \"requirements\": {\r\n \"windows-amd64\": \"Windows x64; validated on Windows 11\",\r\n \"linux-amd64\": \"glibc 2.39+, libgcc_s, installed fonts; Ubuntu 24.04 / WSL2\"\r\n },\r\n \"clients\": {\r\n \"playwright-core\": \"1.63.0\",\r\n \"puppeteer-core\": \"25.10.0\"\r\n },\r\n \"artifacts\": [\r\n {\r\n \"platform\": \"windows-amd64\",\r\n \"archive\": \"mimic-v0.2.4-windows-amd64.zip\",\r\n \"sha256\": \"f9e447d63db30673756c75629b82f75ffe32bce0fa15cd0afbda498a2d7774c8\",\r\n \"size\": 47678094,\r\n \"binarySha256\": \"7e7cf7986c0ab0f608f9c948af2ca16af6b88a5e90b8ba4e5d6596ec68a166e7\",\r\n \"binaryVersion\": \"v0.2.4\",\r\n \"checks\": [\r\n \"runtimecheck:v8\",\r\n \"runtimecheck:quickjs\",\r\n \"runtimecheck:goja\",\r\n \"examples:puppeteer\",\r\n \"examples:playwright\",\r\n \"examples:concurrency\"\r\n ]\r\n },\r\n {\r\n \"platform\": \"linux-amd64\",\r\n \"archive\": \"mimic-v0.2.4-linux-amd64.tar.gz\",\r\n \"sha256\": \"8f3b5e0a027235fc1c8cffd787e23e751ec7d134545bb402a67f93ab8d597903\",\r\n \"size\": 51027813,\r\n \"binarySha256\": \"f0b3cb16c4016b3023d31b266883fac131d645e2892ffb96fc0e48e554598581\",\r\n \"binaryVersion\": \"v0.2.4\",\r\n \"checks\": [\r\n \"runtimecheck:v8\",\r\n \"runtimecheck:quickjs\",\r\n \"runtimecheck:goja\",\r\n \"examples:puppeteer\",\r\n \"examples:playwright\",\r\n \"examples:concurrency\"\r\n ]\r\n }\r\n ]\r\n}\r\n",
5
5
  "manifest": {
6
- "version": "v0.2.3",
7
- "sourceRevision": "cfcabd40e52e86bb30461888fe101f37b4996774",
8
- "packagingRevision": "cfcabd40e52e86bb30461888fe101f37b4996774",
9
- "ciRun": "https://github.com/mimic-browser/runtime/actions/runs/37752215291",
6
+ "version": "v0.2.4",
7
+ "sourceRevision": "ee49a1da8776b63b1c43654a121bcb31dc618106",
8
+ "packagingRevision": "3126b06798eeaa7a767ea4dc64ab34dcce46d276",
9
+ "ciRun": "https://github.com/mimic-browser/runtime/actions/runs/37779657608",
10
10
  "binariesReusedUnchanged": true,
11
11
  "license": "Prosperity-3.0.0",
12
12
  "exampleLicense": "MIT",
@@ -21,11 +21,11 @@
21
21
  "artifacts": [
22
22
  {
23
23
  "platform": "windows-amd64",
24
- "archive": "mimic-v0.2.3-windows-amd64.zip",
25
- "sha256": "6040ed4fa90f7cb42df6cb54d9a1481c0945a3cbde340ffebd5d45883ee49a19",
26
- "size": 47677460,
27
- "binarySha256": "a657174860a4e570ef8e0ee8737a566134f4c1c15d595e8f6f823437c1556cb5",
28
- "binaryVersion": "v0.2.3",
24
+ "archive": "mimic-v0.2.4-windows-amd64.zip",
25
+ "sha256": "f9e447d63db30673756c75629b82f75ffe32bce0fa15cd0afbda498a2d7774c8",
26
+ "size": 47678094,
27
+ "binarySha256": "7e7cf7986c0ab0f608f9c948af2ca16af6b88a5e90b8ba4e5d6596ec68a166e7",
28
+ "binaryVersion": "v0.2.4",
29
29
  "checks": [
30
30
  "runtimecheck:v8",
31
31
  "runtimecheck:quickjs",
@@ -37,11 +37,11 @@
37
37
  },
38
38
  {
39
39
  "platform": "linux-amd64",
40
- "archive": "mimic-v0.2.3-linux-amd64.tar.gz",
41
- "sha256": "4fb6a71f7b2c5d5ad49136c9456e6f2cc1e70701e91259ff905ae72218c56a9a",
42
- "size": 51026543,
43
- "binarySha256": "414fc217b24301861c078e0e39dafb79110996ea4c4c23ff7d33fab41175eb32",
44
- "binaryVersion": "v0.2.3",
40
+ "archive": "mimic-v0.2.4-linux-amd64.tar.gz",
41
+ "sha256": "8f3b5e0a027235fc1c8cffd787e23e751ec7d134545bb402a67f93ab8d597903",
42
+ "size": 51027813,
43
+ "binarySha256": "f0b3cb16c4016b3023d31b266883fac131d645e2892ffb96fc0e48e554598581",
44
+ "binaryVersion": "v0.2.4",
45
45
  "checks": [
46
46
  "runtimecheck:v8",
47
47
  "runtimecheck:quickjs",
@@ -53,5 +53,5 @@
53
53
  }
54
54
  ]
55
55
  },
56
- "baseUrl": "https://github.com/mimic-browser/runtime/releases/download/v0.2.3"
56
+ "baseUrl": "https://github.com/mimic-browser/runtime/releases/download/v0.2.4"
57
57
  }
@@ -18,8 +18,17 @@ module MimicSDK
18
18
  VERSION_PATTERN = /\Av?\d+\.\d+\.\d+(?:-beta\.\d+)?\z/
19
19
  SHA_PATTERN = /\A[0-9a-f]{64}\z/
20
20
 
21
- def initialize(**options)
22
- @options = options
21
+ # @param cancelled [Proc, nil] returns true to cancel a pending operation
22
+ def initialize(runtime_version: nil, lock_file: nil, executable_path: nil,
23
+ runtime_dir: nil, archive_path: nil, allow_download: UNSET,
24
+ startup_timeout: 30, lock_timeout: 120, cancelled: nil)
25
+ @options = {
26
+ runtime_version: runtime_version, lock_file: lock_file,
27
+ executable_path: executable_path, runtime_dir: runtime_dir,
28
+ archive_path: archive_path, startup_timeout: startup_timeout,
29
+ lock_timeout: lock_timeout, cancelled: cancelled
30
+ }
31
+ @options[:allow_download] = allow_download unless allow_download.equal?(UNSET)
23
32
  end
24
33
 
25
34
  def normalize_version(value)
@@ -214,9 +214,9 @@ module MimicSDK
214
214
 
215
215
  class Experimental
216
216
  def initialize(sender) = (@sender = sender)
217
- def call(name, params = UNSET, **options)
217
+ def call(name, params = UNSET, timeout: 30, cancelled: nil)
218
218
  raise ArgumentError, 'Expected an exact unqualified wire command leaf' unless name.is_a?(String) && name.match?(/\A[^.\s]+\z/)
219
- @sender.call("Mimic.#{name}", params, **options)
219
+ @sender.call("Mimic.#{name}", params, timeout: timeout, cancelled: cancelled)
220
220
  end
221
221
  def method_missing(name, *args, **options)
222
222
  return super if name.to_s.start_with?('_') || %i[to_ary to_hash to_json inspect].include?(name)
@@ -233,8 +233,63 @@ module MimicSDK
233
233
  super(self)
234
234
  @experimental = Experimental.new(self)
235
235
  end
236
- def call(method, params = UNSET, **options)
237
- @transport.call_raw(method, params, session_id: @session_id, **options)
236
+ def call(method, params = UNSET, timeout: 30, cancelled: nil)
237
+ @transport.call_raw(method, params, session_id: @session_id, timeout: timeout, cancelled: cancelled)
238
+ end
239
+ end
240
+
241
+ # A capability client owns only its extra CDP attachment, never the native Page.
242
+ class PageClient < Client
243
+ attr_reader :session_id
244
+
245
+ def initialize(transport, session_id:, detach:)
246
+ super(transport, session_id: session_id)
247
+ @detach = detach
248
+ @state = Mutex.new
249
+ @close_changed = ConditionVariable.new
250
+ @closed = false
251
+ @closing = false
252
+ end
253
+
254
+ def closed? = @state.synchronize { @closed }
255
+
256
+ def call(method, params = UNSET, timeout: 30, cancelled: nil)
257
+ raise IOError, 'Page capability attachment closed' if closed?
258
+ super(method, params, timeout: timeout, cancelled: cancelled)
259
+ end
260
+
261
+ def invalidate
262
+ @state.synchronize do
263
+ @closed = true
264
+ @detach = nil unless @closing
265
+ !@closing
266
+ end
267
+ end
268
+
269
+ def close
270
+ detach = @state.synchronize do
271
+ @close_changed.wait(@state) while @closing
272
+ if @closed
273
+ raise @close_error if @close_error
274
+ return
275
+ end
276
+ @closed = true
277
+ @closing = true
278
+ @detach
279
+ end
280
+ begin
281
+ detach.call(self)
282
+ nil
283
+ rescue StandardError => error
284
+ @state.synchronize { @close_error = error }
285
+ raise
286
+ ensure
287
+ @state.synchronize do
288
+ @closing = false
289
+ @detach = nil
290
+ @close_changed.broadcast
291
+ end
292
+ end
238
293
  end
239
294
  end
240
295
  end
data/lib/mimic_sdk.rb CHANGED
@@ -3,5 +3,5 @@ require_relative 'mimic_sdk/transport'
3
3
  require_relative 'mimic_sdk/runtime'
4
4
 
5
5
  module MimicSDK
6
- VERSION = '0.1.0'
6
+ VERSION = '0.1.1'
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mimic-browser
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mimic Browser contributors