opal 1.8.3 → 1.8.4.rc1
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/.github/workflows/build.yml +16 -11
- data/.rubocop.yml +9 -2
- data/Gemfile +3 -1
- data/UNRELEASED.md +41 -5
- data/bin/test +43 -0
- data/eslint.await.config.mjs +17 -0
- data/eslint.config.mjs +58 -0
- data/lib/opal/builder.rb +1 -1
- data/lib/opal/builder_scheduler.rb +4 -1
- data/lib/opal/cli_runners/bun.rb +32 -0
- data/lib/opal/cli_runners/chrome.rb +7 -1
- data/lib/opal/cli_runners/deno.rb +2 -0
- data/lib/opal/cli_runners/firefox.rb +13 -1
- data/lib/opal/cli_runners/node_modules/.package-lock.json +9 -3
- data/lib/opal/cli_runners/node_modules/chrome-remote-interface/LICENSE +1 -1
- data/lib/opal/cli_runners/node_modules/chrome-remote-interface/README.md +15 -9
- data/lib/opal/cli_runners/node_modules/chrome-remote-interface/chrome-remote-interface.js +1 -1
- data/lib/opal/cli_runners/node_modules/chrome-remote-interface/lib/chrome.js +16 -1
- data/lib/opal/cli_runners/node_modules/chrome-remote-interface/lib/devtools.js +2 -0
- data/lib/opal/cli_runners/node_modules/chrome-remote-interface/lib/external-request.js +2 -1
- data/lib/opal/cli_runners/node_modules/chrome-remote-interface/lib/protocol.json +4970 -2150
- data/lib/opal/cli_runners/node_modules/chrome-remote-interface/package.json +1 -1
- data/lib/opal/cli_runners/node_modules/ws/lib/websocket-server.js +3 -1
- data/lib/opal/cli_runners/node_modules/ws/lib/websocket.js +3 -1
- data/lib/opal/cli_runners/node_modules/ws/package.json +1 -1
- data/lib/opal/cli_runners/package-lock.json +10 -20
- data/lib/opal/cli_runners/package.json +1 -1
- data/lib/opal/cli_runners.rb +1 -0
- data/lib/opal/nodes/defined.rb +1 -1
- data/lib/opal/nodes/if.rb +46 -37
- data/lib/opal/nodes/scope.rb +3 -1
- data/lib/opal/repl.rb +6 -2
- data/lib/opal/rewriters/block_to_iter.rb +1 -1
- data/lib/opal/util.rb +1 -1
- data/lib/opal/version.rb +1 -1
- data/opal/corelib/array.rb +3 -3
- data/opal/corelib/binding.rb +2 -1
- data/opal/corelib/constants.rb +1 -1
- data/opal/corelib/enumerable.rb +1 -0
- data/opal/corelib/error.rb +1 -1
- data/opal/corelib/io.rb +1 -1
- data/opal/corelib/kernel.rb +1 -0
- data/opal/corelib/math.rb +1 -1
- data/opal/corelib/runtime.js +11 -2
- data/opal/corelib/unsupported.rb +4 -4
- data/opal.gemspec +1 -0
- data/package.json +3 -3
- data/spec/filters/bugs/binding.rb +1 -0
- data/spec/filters/bugs/file.rb +1 -2
- data/spec/filters/bugs/kernel.rb +6 -7
- data/spec/lib/builder_spec.rb +1 -1
- data/spec/lib/cli_spec.rb +66 -31
- data/spec/lib/compiler_spec.rb +4 -4
- data/spec/lib/rake_dist_spec.rb +19 -2
- data/spec/mspec-opal/formatters.rb +4 -4
- data/spec/mspec-opal/runner.rb +2 -1
- data/spec/opal/core/language/defined_spec.rb +10 -0
- data/spec/opal/core/module/include_spec.rb +63 -0
- data/spec/ruby_specs +15 -0
- data/spec/spec_helper.rb +1 -0
- data/stdlib/base64.rb +4 -4
- data/stdlib/bigdecimal/bignumber.js.rb +0 -1
- data/stdlib/logger.rb +4 -3
- data/stdlib/nodejs/file.rb +1 -1
- data/stdlib/opal-replutils.rb +1 -1
- data/tasks/linting.rake +1 -1
- metadata +29 -13
- data/.eslintrc.js +0 -39
- data/bin/opal-mspec +0 -11
- data/lib/opal/cli_runners/node_modules/.bin/chrome-remote-interface.cmd +0 -17
- data/lib/opal/cli_runners/node_modules/.bin/chrome-remote-interface.ps1 +0 -28
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: '08bd2086cde5e7cdc4878b2bd1e7cd4d11e9a1234698905ec21ec0355df14151'
|
|
4
|
+
data.tar.gz: 85694adb4f63d60793776a9ffcf50f276cfba2aa457796631503f21e889d0159
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c956cf5fd21ec2b7bb2e0f06dcf7e0015f147d4c05da67eae607c62437ae9e687e7302cea1669e6a5ce121f3e1335517a07f80dfb43b00e55648a8eecdcaaeba
|
|
7
|
+
data.tar.gz: 8661bbef6e06101eac3f2fd4829ec5a3cf3dd5028b40020d2ba9157cc3d51808ba2a2f662222c38f2014db8c6a6237a5bb132cb96f58f47d7204084336d3aec1
|
data/.github/workflows/build.yml
CHANGED
|
@@ -15,7 +15,7 @@ jobs:
|
|
|
15
15
|
rake:
|
|
16
16
|
name: ${{ matrix.combo.name || matrix.combo.ruby }}
|
|
17
17
|
env:
|
|
18
|
-
DEFAULT_RUBY: '3.
|
|
18
|
+
DEFAULT_RUBY: '3.4'
|
|
19
19
|
strategy:
|
|
20
20
|
fail-fast: false
|
|
21
21
|
matrix:
|
|
@@ -25,7 +25,7 @@ jobs:
|
|
|
25
25
|
- name: mspec-chrome
|
|
26
26
|
command: bin/rake mspec_chrome
|
|
27
27
|
- name: mspec-firefox
|
|
28
|
-
firefox: '
|
|
28
|
+
firefox: 'latest-esr'
|
|
29
29
|
command: xvfb-run bin/rake mspec_firefox
|
|
30
30
|
- name: minitest
|
|
31
31
|
command: bin/rake minitest
|
|
@@ -35,14 +35,20 @@ jobs:
|
|
|
35
35
|
# - name: head-ruby
|
|
36
36
|
# ruby: head
|
|
37
37
|
# permissive: true
|
|
38
|
-
- name:
|
|
39
|
-
ruby: '3.3'
|
|
40
|
-
- name: previous-ruby
|
|
41
|
-
ruby: '3.2'
|
|
42
|
-
- name: older-ruby
|
|
43
|
-
ruby: '3.1'
|
|
44
|
-
- name: near-eol-ruby
|
|
38
|
+
- name: ruby-3.0
|
|
45
39
|
ruby: '3.0'
|
|
40
|
+
- name: ruby-3.1
|
|
41
|
+
ruby: '3.1'
|
|
42
|
+
- name: ruby-3.2
|
|
43
|
+
ruby: '3.2'
|
|
44
|
+
- name: ruby-3.3
|
|
45
|
+
ruby: '3.3'
|
|
46
|
+
- name: ruby-3.4
|
|
47
|
+
ruby: '3.4'
|
|
48
|
+
- name: ruby-4.0
|
|
49
|
+
ruby: '4.0'
|
|
50
|
+
- name: jruby
|
|
51
|
+
ruby: 'jruby'
|
|
46
52
|
- name: smoke-test
|
|
47
53
|
command: bin/rake smoke_test
|
|
48
54
|
- name: windows-mspec-nodejs
|
|
@@ -52,7 +58,7 @@ jobs:
|
|
|
52
58
|
command: bundle exec rake mspec_chrome
|
|
53
59
|
os: windows-latest
|
|
54
60
|
# - name: windows-mspec-firefox
|
|
55
|
-
# firefox: '
|
|
61
|
+
# firefox: 'latest-esr'
|
|
56
62
|
# command: bundle exec rake mspec_firefox
|
|
57
63
|
# os: windows-latest
|
|
58
64
|
- name: macos-mspec-safari
|
|
@@ -79,7 +85,6 @@ jobs:
|
|
|
79
85
|
|
|
80
86
|
# Currently failing:
|
|
81
87
|
# - ruby: truffleruby
|
|
82
|
-
# - ruby: jruby
|
|
83
88
|
|
|
84
89
|
runs-on: ${{ matrix.combo.os || 'ubuntu-latest' }}
|
|
85
90
|
continue-on-error: ${{ matrix.combo.permissive || false }}
|
data/.rubocop.yml
CHANGED
|
@@ -2,7 +2,8 @@ inherit_from:
|
|
|
2
2
|
- .rubocop_todo.yml
|
|
3
3
|
- .rubocop/todo.yml
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
plugins:
|
|
6
|
+
- rubocop-performance
|
|
6
7
|
|
|
7
8
|
|
|
8
9
|
AllCops:
|
|
@@ -158,6 +159,10 @@ Lint/RedundantStringCoercion:
|
|
|
158
159
|
# That's what MRI does
|
|
159
160
|
- 'opal/corelib/error.rb'
|
|
160
161
|
|
|
162
|
+
Lint/RedundantRequireStatement:
|
|
163
|
+
Exclude:
|
|
164
|
+
- 'lib/opal/nodes/if.rb'
|
|
165
|
+
|
|
161
166
|
Lint/UnusedBlockArgument:
|
|
162
167
|
Exclude:
|
|
163
168
|
# Variable from Ruby can be accessed in JS, rubocop can't catch it (but JSHint can)
|
|
@@ -212,7 +217,7 @@ Naming/BinaryOperatorParameterName:
|
|
|
212
217
|
- 'opal/**/*.rb'
|
|
213
218
|
- 'stdlib/**/*.rb'
|
|
214
219
|
|
|
215
|
-
Naming/
|
|
220
|
+
Naming/PredicatePrefix:
|
|
216
221
|
# Ruby has "has_key?" method
|
|
217
222
|
ForbiddenPrefixes:
|
|
218
223
|
- is_
|
|
@@ -385,6 +390,8 @@ Security/Eval:
|
|
|
385
390
|
Exclude:
|
|
386
391
|
# That's what parser does
|
|
387
392
|
- 'stdlib/opal-parser.rb'
|
|
393
|
+
# Binding#eval necessarily uses eval
|
|
394
|
+
- 'opal/corelib/binding.rb'
|
|
388
395
|
|
|
389
396
|
Naming/AccessorMethodName:
|
|
390
397
|
Exclude:
|
data/Gemfile
CHANGED
|
@@ -41,6 +41,8 @@ group :development do
|
|
|
41
41
|
gem 'guard', require: false
|
|
42
42
|
gem 'listen', require: false
|
|
43
43
|
gem 'simplecov', require: false
|
|
44
|
+
gem 'ruby-lsp', require: false
|
|
45
|
+
gem 'uri', '> 1', require: false
|
|
44
46
|
|
|
45
47
|
if RUBY_PLATFORM =~ /darwin/
|
|
46
48
|
gem 'terminal-notifier-guard'
|
|
@@ -49,5 +51,5 @@ group :development do
|
|
|
49
51
|
end unless ENV['CI']
|
|
50
52
|
|
|
51
53
|
group :doc do
|
|
52
|
-
gem 'redcarpet' unless RUBY_ENGINE
|
|
54
|
+
gem 'redcarpet' unless %w[truffleruby jruby].include?(RUBY_ENGINE)
|
|
53
55
|
end unless ENV['CI']
|
data/UNRELEASED.md
CHANGED
|
@@ -1,10 +1,46 @@
|
|
|
1
1
|
<!--
|
|
2
|
-
###
|
|
3
|
-
|
|
2
|
+
### Deprecated
|
|
3
|
+
-->
|
|
4
|
+
|
|
4
5
|
### Added
|
|
6
|
+
|
|
7
|
+
- Support JRuby in the builder scheduler and system runner ([#2686](https://github.com/opal/opal/pull/2686))
|
|
8
|
+
- Allow `BUN_OPTS` and `DENO_OPTS` to pass extra options to the Bun and Deno runners ([#2695](https://github.com/opal/opal/pull/2695))
|
|
9
|
+
|
|
10
|
+
### Changed
|
|
11
|
+
|
|
12
|
+
- Refresh bundled npm dependencies and migrate development linting to ESLint 9 ([#2685](https://github.com/opal/opal/pull/2685))
|
|
13
|
+
- Update unsupported `String` method definitions ([#2717](https://github.com/opal/opal/pull/2717))
|
|
14
|
+
|
|
5
15
|
### Removed
|
|
6
|
-
|
|
7
|
-
|
|
16
|
+
|
|
17
|
+
- Drop `bin/opal-mspec` in favor of the generic `bin/test` helper ([#2735](https://github.com/opal/opal/pull/2735))
|
|
18
|
+
|
|
8
19
|
### Fixed
|
|
9
|
-
-->
|
|
10
20
|
|
|
21
|
+
- Detect Chromium on macOS when running Chrome-based specs ([#2681](https://github.com/opal/opal/pull/2681))
|
|
22
|
+
- Fix the Firefox runner ([#2694](https://github.com/opal/opal/pull/2694))
|
|
23
|
+
- Fix browser runner failures with `INVERT_RUNNING_MODE` and `PATTERN` ([#2696](https://github.com/opal/opal/pull/2696), [#2711](https://github.com/opal/opal/pull/2711))
|
|
24
|
+
- Require `::Math` for mspec compatibility ([#2708](https://github.com/opal/opal/pull/2708))
|
|
25
|
+
- Fix `Module#include` behavior after `#prepend` ([#2722](https://github.com/opal/opal/pull/2722))
|
|
26
|
+
- Require the `Thread` shim from `if` node compilation support ([#2727](https://github.com/opal/opal/pull/2727))
|
|
27
|
+
- Fix `Array#flatten` maximum call stack errors ([#2729](https://github.com/opal/opal/pull/2729))
|
|
28
|
+
- Fix `Kernel#frozen?` for singleton classes ([#2731](https://github.com/opal/opal/pull/2731))
|
|
29
|
+
- Fix `defined?` for constants set to `0` ([#2744](https://github.com/opal/opal/pull/2744))
|
|
30
|
+
- Fix Terser invocation ([#2749](https://github.com/opal/opal/pull/2749))
|
|
31
|
+
- Fix `Enumerable#first` return values ([#2753](https://github.com/opal/opal/pull/2753))
|
|
32
|
+
- Support keyword arguments when initializing Logger ([#2772](https://github.com/opal/opal/pull/2772))
|
|
33
|
+
- Avoid an additional boot error when `$stderr` is unavailable ([#2703](https://github.com/opal/opal/pull/2703))
|
|
34
|
+
|
|
35
|
+
### Performance
|
|
36
|
+
|
|
37
|
+
- Reduce RSpec runtime overhead ([#2781](https://github.com/opal/opal/pull/2781))
|
|
38
|
+
|
|
39
|
+
### Internal
|
|
40
|
+
|
|
41
|
+
- Rename and sort Ruby CI jobs ([#2752](https://github.com/opal/opal/pull/2752))
|
|
42
|
+
- Add Ruby LSP to the development Gemfile ([#2724](https://github.com/opal/opal/pull/2724))
|
|
43
|
+
- Backport JRuby and TruffleRuby lint follow-ups ([#2690](https://github.com/opal/opal/pull/2690))
|
|
44
|
+
- Restore the stable ES3 generated-JS lint contract after the ESLint 9 backport.
|
|
45
|
+
- Update CI coverage for Ruby 3.4 and Ruby 4.0 ([#2779](https://github.com/opal/opal/pull/2779))
|
|
46
|
+
- Add the `ostruct` development dependency needed by the test harness on Ruby 4 ([#2786](https://github.com/opal/opal/pull/2786))
|
data/bin/test
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
|
|
3
|
+
require 'shellwords'
|
|
4
|
+
require 'pathname'
|
|
5
|
+
require 'fileutils'
|
|
6
|
+
extend FileUtils
|
|
7
|
+
|
|
8
|
+
def system(*args)
|
|
9
|
+
if Hash === args.first
|
|
10
|
+
env_string = "env #{args.first.map { |k, v| "#{k}=#{v.shellescape}" }.join(' ')} "
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
warn "$ #{env_string}#{args.select{String === _1}.shelljoin}"
|
|
14
|
+
super(*args, exception: true) rescue exit(1)
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
ENV["NODE_ENV"] = "test"
|
|
18
|
+
|
|
19
|
+
files = []
|
|
20
|
+
args = []
|
|
21
|
+
ARGV.each do |arg|
|
|
22
|
+
if File.directory?(arg)
|
|
23
|
+
files += Dir.glob("#{arg}/**/{*_spec.rb,test_*.rb}")
|
|
24
|
+
elsif File.file?(arg)
|
|
25
|
+
files << arg
|
|
26
|
+
else
|
|
27
|
+
args << arg
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
files.map! do |file|
|
|
32
|
+
file = Pathname(file).expand_path
|
|
33
|
+
base = Pathname("#{__dir__}/..").expand_path
|
|
34
|
+
file.relative_path_from(base).to_s
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
mspec, minitest = files.partition { |file| file.end_with?('_spec.rb') }
|
|
38
|
+
opalspec, rubyspec = mspec.partition { _1.start_with?('spec/opal') }
|
|
39
|
+
to_glob = ->(files) { "{#{files.join(',')}}" }
|
|
40
|
+
|
|
41
|
+
system({"PATTERN" => to_glob[opalspec]}, "bundle", "exec", "rake", "mspec_opal_nodejs") if opalspec.any?
|
|
42
|
+
system({"PATTERN" => to_glob[mspec]}, "bundle", "exec", "rake", "mspec_ruby_nodejs") if mspec.any?
|
|
43
|
+
system({"PATTERN" => to_glob[minitest]}, "bundle", "exec", "rake", "minitest_nodejs") if minitest.any?
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import config from "./eslint.config.mjs";
|
|
2
|
+
|
|
3
|
+
export default config.map((entry) => {
|
|
4
|
+
if (!entry.languageOptions) return entry;
|
|
5
|
+
|
|
6
|
+
return {
|
|
7
|
+
...entry,
|
|
8
|
+
languageOptions: {
|
|
9
|
+
...entry.languageOptions,
|
|
10
|
+
ecmaVersion: 8,
|
|
11
|
+
parserOptions: {
|
|
12
|
+
...entry.languageOptions.parserOptions,
|
|
13
|
+
allowReserved: false,
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
};
|
|
17
|
+
});
|
data/eslint.config.mjs
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import globals from "globals";
|
|
2
|
+
import js from "@eslint/js";
|
|
3
|
+
|
|
4
|
+
export default [
|
|
5
|
+
js.configs.recommended,
|
|
6
|
+
{
|
|
7
|
+
languageOptions: {
|
|
8
|
+
ecmaVersion: 3,
|
|
9
|
+
sourceType: "commonjs",
|
|
10
|
+
parserOptions: {
|
|
11
|
+
allowReserved: true,
|
|
12
|
+
},
|
|
13
|
+
globals: {
|
|
14
|
+
...globals.browser,
|
|
15
|
+
...globals.node,
|
|
16
|
+
ArrayBuffer: "readonly",
|
|
17
|
+
DataView: "readonly",
|
|
18
|
+
globalThis: "readonly",
|
|
19
|
+
JSON: "readonly",
|
|
20
|
+
Opal: "readonly",
|
|
21
|
+
Promise: "readonly",
|
|
22
|
+
Proxy: "readonly",
|
|
23
|
+
Reflect: "readonly",
|
|
24
|
+
Uint8Array: "readonly",
|
|
25
|
+
Int32Array: "readonly",
|
|
26
|
+
WeakRef: "readonly",
|
|
27
|
+
Map: "readonly",
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
|
|
31
|
+
rules: {
|
|
32
|
+
"no-unused-vars": ["error", {
|
|
33
|
+
varsIgnorePattern: "($($|$$|yield|post_args|[a-z])|self)",
|
|
34
|
+
argsIgnorePattern: "($($|$$|yield|post_args|[a-z])|self)",
|
|
35
|
+
caughtErrorsIgnorePattern: "^e$",
|
|
36
|
+
}],
|
|
37
|
+
|
|
38
|
+
"no-extra-semi": "off",
|
|
39
|
+
"no-empty": "off",
|
|
40
|
+
"no-unreachable": "off",
|
|
41
|
+
"no-cond-assign": "off",
|
|
42
|
+
"no-prototype-builtins": "off",
|
|
43
|
+
|
|
44
|
+
"no-constant-condition": ["error", {
|
|
45
|
+
checkLoops: false,
|
|
46
|
+
}],
|
|
47
|
+
|
|
48
|
+
"no-useless-escape": "off",
|
|
49
|
+
|
|
50
|
+
"no-fallthrough": ["error", {
|
|
51
|
+
commentPattern: "raise|no-break",
|
|
52
|
+
}],
|
|
53
|
+
|
|
54
|
+
"no-regex-spaces": "off",
|
|
55
|
+
"no-control-regex": "off",
|
|
56
|
+
},
|
|
57
|
+
}
|
|
58
|
+
];
|
data/lib/opal/builder.rb
CHANGED
|
@@ -13,7 +13,10 @@ module Opal
|
|
|
13
13
|
|
|
14
14
|
singleton_class.attr_accessor :builder_scheduler
|
|
15
15
|
|
|
16
|
-
if RUBY_ENGINE
|
|
16
|
+
if RUBY_ENGINE == 'opal'
|
|
17
|
+
require 'opal/builder_scheduler/sequential'
|
|
18
|
+
Opal.builder_scheduler = BuilderScheduler::Sequential
|
|
19
|
+
elsif RUBY_ENGINE == 'ruby'
|
|
17
20
|
# Windows has a faulty `fork`.
|
|
18
21
|
if OS.windows? || ENV['OPAL_PREFORK_DISABLE']
|
|
19
22
|
require 'opal/builder_scheduler/sequential'
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'shellwords'
|
|
4
|
+
require 'opal/paths'
|
|
5
|
+
require 'opal/cli_runners/system_runner'
|
|
6
|
+
require 'opal/os'
|
|
7
|
+
|
|
8
|
+
module Opal
|
|
9
|
+
module CliRunners
|
|
10
|
+
class Bun
|
|
11
|
+
def self.call(data)
|
|
12
|
+
argv = data[:argv].dup.to_a
|
|
13
|
+
|
|
14
|
+
SystemRunner.call(data) do |tempfile|
|
|
15
|
+
opts = Shellwords.shellwords(ENV['BUN_OPTS'] || '')
|
|
16
|
+
[
|
|
17
|
+
'bun',
|
|
18
|
+
'run',
|
|
19
|
+
*opts,
|
|
20
|
+
tempfile.path,
|
|
21
|
+
*argv
|
|
22
|
+
]
|
|
23
|
+
end
|
|
24
|
+
rescue Errno::ENOENT
|
|
25
|
+
raise MissingBun, 'Please install Bun to be able to run Opal scripts.'
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
class MissingBun < RunnerError
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
@@ -201,7 +201,13 @@ module Opal
|
|
|
201
201
|
return path
|
|
202
202
|
end
|
|
203
203
|
elsif OS.macos?
|
|
204
|
-
|
|
204
|
+
[
|
|
205
|
+
'/Applications/Google Chrome.app/Contents/MacOS/Google Chrome',
|
|
206
|
+
'/Applications/Chromium.app/Contents/MacOS/Chromium'
|
|
207
|
+
].each do |path|
|
|
208
|
+
next unless File.exist? path
|
|
209
|
+
return path
|
|
210
|
+
end
|
|
205
211
|
else
|
|
206
212
|
%w[
|
|
207
213
|
google-chrome-stable
|
|
@@ -12,11 +12,13 @@ module Opal
|
|
|
12
12
|
argv = data[:argv].dup.to_a
|
|
13
13
|
|
|
14
14
|
SystemRunner.call(data) do |tempfile|
|
|
15
|
+
opts = Shellwords.shellwords(ENV['DENO_OPTS'] || '')
|
|
15
16
|
[
|
|
16
17
|
'deno',
|
|
17
18
|
'run',
|
|
18
19
|
'--allow-read',
|
|
19
20
|
'--allow-write',
|
|
21
|
+
*opts,
|
|
20
22
|
tempfile.path,
|
|
21
23
|
*argv
|
|
22
24
|
]
|
|
@@ -167,7 +167,12 @@ module Opal
|
|
|
167
167
|
return path
|
|
168
168
|
end
|
|
169
169
|
elsif OS.macos?
|
|
170
|
-
|
|
170
|
+
[
|
|
171
|
+
'/Applications/Firefox.app/Contents/MacOS/Firefox',
|
|
172
|
+
'/Applications/Firefox.app/Contents/MacOS/firefox',
|
|
173
|
+
].each do |path|
|
|
174
|
+
return path if File.exist? path
|
|
175
|
+
end
|
|
171
176
|
else
|
|
172
177
|
%w[
|
|
173
178
|
firefox
|
|
@@ -303,6 +308,8 @@ module Opal
|
|
|
303
308
|
'network.cookie.cookieBehavior': 0,
|
|
304
309
|
# Disable experimental feature that is only available in Nightly
|
|
305
310
|
'network.cookie.sameSite.laxByDefault': false,
|
|
311
|
+
# Avoid cookie expiry date to be affected by server time, which can result in flaky tests.
|
|
312
|
+
'network.cookie.useServerTime': false,
|
|
306
313
|
# Do not prompt for temporary redirects
|
|
307
314
|
'network.http.prompt-temp-redirect': false,
|
|
308
315
|
# Disable speculative connections so they are not reported as leaking
|
|
@@ -315,6 +322,11 @@ module Opal
|
|
|
315
322
|
# Disable Flash.
|
|
316
323
|
'plugin.state.flash': 0,
|
|
317
324
|
'privacy.trackingprotection.enabled': false,
|
|
325
|
+
# To enable remote protocols use:
|
|
326
|
+
# const WEBDRIVER_BIDI_ACTIVE = 0x1;
|
|
327
|
+
# const CDP_ACTIVE = 0x2;
|
|
328
|
+
# Enable only CDP for now
|
|
329
|
+
'remote.active-protocols': 2,
|
|
318
330
|
# Can be removed once Firefox 89 is no longer supported
|
|
319
331
|
# https://bugzilla.mozilla.org/show_bug.cgi?id=1710839
|
|
320
332
|
'remote.enabled': true,
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cli_runners",
|
|
3
|
-
"lockfileVersion":
|
|
3
|
+
"lockfileVersion": 3,
|
|
4
4
|
"requires": true,
|
|
5
5
|
"packages": {
|
|
6
6
|
"node_modules/chrome-remote-interface": {
|
|
7
|
-
"version": "0.
|
|
7
|
+
"version": "0.33.2",
|
|
8
|
+
"resolved": "https://registry.npmjs.org/chrome-remote-interface/-/chrome-remote-interface-0.33.2.tgz",
|
|
9
|
+
"integrity": "sha512-wvm9cOeBTrb218EC+6DteGt92iXr2iY0+XJP30f15JVDhqvWvJEVACh9GvUm8b9Yd8bxQivaLSb8k7mgrbyomQ==",
|
|
8
10
|
"license": "MIT",
|
|
9
11
|
"dependencies": {
|
|
10
12
|
"commander": "2.11.x",
|
|
@@ -16,10 +18,14 @@
|
|
|
16
18
|
},
|
|
17
19
|
"node_modules/commander": {
|
|
18
20
|
"version": "2.11.0",
|
|
21
|
+
"resolved": "https://registry.npmjs.org/commander/-/commander-2.11.0.tgz",
|
|
22
|
+
"integrity": "sha512-b0553uYA5YAEGgyYIGYROzKQ7X5RAqedkfjiZxwi0kL1g3bOaBNNZfYkzt/CL0umgD5wc9Jec2FbB98CjkMRvQ==",
|
|
19
23
|
"license": "MIT"
|
|
20
24
|
},
|
|
21
25
|
"node_modules/ws": {
|
|
22
|
-
"version": "7.5.
|
|
26
|
+
"version": "7.5.10",
|
|
27
|
+
"resolved": "https://registry.npmjs.org/ws/-/ws-7.5.10.tgz",
|
|
28
|
+
"integrity": "sha512-+dbF1tHwZpXcbOJdVOkzLDxZP1ailvSxM6ZweXTegylPny803bFhA+vqBYw4s31NSAk4S2Qz+AKXK9a4wkdjcQ==",
|
|
23
29
|
"license": "MIT",
|
|
24
30
|
"engines": {
|
|
25
31
|
"node": ">=8.3.0"
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
Copyright (c)
|
|
1
|
+
Copyright (c) 2024 Andrea Cardaci <cyrus.and@gmail.com>
|
|
2
2
|
|
|
3
3
|
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
4
4
|
this software and associated documentation files (the "Software"), to deal in
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
# chrome-remote-interface
|
|
1
|
+
# chrome-remote-interface
|
|
2
2
|
|
|
3
|
-
[
|
|
4
|
-
[travis]: https://app.travis-ci.com/cyrus-and/chrome-remote-interface
|
|
3
|
+
[](https://github.com/cyrus-and/chrome-remote-interface/actions?query=workflow:CI)
|
|
5
4
|
|
|
6
5
|
[Chrome Debugging Protocol] interface that helps to instrument Chrome (or any
|
|
7
6
|
other suitable [implementation](#implementations)) by providing a simple
|
|
@@ -131,14 +130,14 @@ Since version 59, additionally use the `--headless` option, for example:
|
|
|
131
130
|
|
|
132
131
|
#### Android
|
|
133
132
|
|
|
134
|
-
Plug the device and
|
|
133
|
+
Plug the device and make sure to authorize the connection from the device itself. Then
|
|
134
|
+
enable the port forwarding, for example:
|
|
135
135
|
|
|
136
|
-
adb forward tcp:9222 localabstract:chrome_devtools_remote
|
|
136
|
+
adb -d forward tcp:9222 localabstract:chrome_devtools_remote
|
|
137
137
|
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
[adb]: https://developer.chrome.com/devtools/docs/remote-debugging-legacy
|
|
138
|
+
After that you should be able to use `http://127.0.0.1:9222` as usual, but note that in
|
|
139
|
+
Android, Chrome does not have its own protocol available, so a local version must be used.
|
|
140
|
+
See [here](#chrome-debugging-protocol-versions) for more information.
|
|
142
141
|
|
|
143
142
|
##### WebView
|
|
144
143
|
|
|
@@ -400,6 +399,7 @@ To generate a JavaScript file that can be used with a `<script>` element:
|
|
|
400
399
|
</script>
|
|
401
400
|
<script src="chrome-remote-interface.js"></script>
|
|
402
401
|
```
|
|
402
|
+
|
|
403
403
|
## TypeScript Support
|
|
404
404
|
|
|
405
405
|
[TypeScript][] definitions are kindly provided by [Khairul Azhar Kasmiran][] and [Seth Westphal][], and can be installed from [DefinitelyTyped][]:
|
|
@@ -408,6 +408,12 @@ To generate a JavaScript file that can be used with a `<script>` element:
|
|
|
408
408
|
npm install --save-dev @types/chrome-remote-interface
|
|
409
409
|
```
|
|
410
410
|
|
|
411
|
+
Note that the TypeScript definitions are automatically generated from the npm package `devtools-protocol@0.0.927104`. For other versions of devtools-protocol:
|
|
412
|
+
|
|
413
|
+
1. Install patch-package using [the instructions given](https://github.com/ds300/patch-package#set-up).
|
|
414
|
+
2. Copy the contents of the corresponding https://github.com/ChromeDevTools/devtools-protocol/tree/master/types folder (according to commit) into `node_modules/devtools-protocol/types`.
|
|
415
|
+
3. Run `npx patch-package devtools-protocol` so that the changes persist across an `npm install`.
|
|
416
|
+
|
|
411
417
|
[TypeScript]: https://www.typescriptlang.org/
|
|
412
418
|
[Khairul Azhar Kasmiran]: https://github.com/kazarmy
|
|
413
419
|
[Seth Westphal]: https://github.com/westy92
|