opal 1.7.4 → 1.8.0.alpha1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/build.yml +9 -9
- data/.rubocop/todo.yml +2 -2
- data/.rubocop.yml +17 -10
- data/.rubocop_todo.yml +311 -0
- data/CHANGELOG.md +1 -15
- data/UNRELEASED.md +78 -1
- data/benchmark-ips/bm_block_vs_yield.rb +3 -0
- data/benchmark-ips/bm_slice_or_not.rb +53 -0
- data/docs/bridging.md +112 -0
- data/docs/compiled_ruby.md +10 -10
- data/docs/getting_started.md +18 -22
- data/lib/opal/cli_runners/chrome.rb +1 -5
- data/lib/opal/cli_runners/chrome_cdp_interface.rb +1 -0
- data/lib/opal/cli_runners/firefox_cdp_interface.rb +1 -0
- data/lib/opal/compiler.rb +33 -1
- data/lib/opal/nodes/args/extract_kwoptarg.rb +2 -1
- data/lib/opal/nodes/call.rb +1 -1
- data/lib/opal/nodes/call_special.rb +71 -47
- data/lib/opal/nodes/hash.rb +14 -30
- data/lib/opal/nodes/if.rb +37 -29
- data/lib/opal/nodes/literal.rb +5 -1
- data/lib/opal/nodes/x_string.rb +13 -0
- data/lib/opal/parser/patch.rb +1 -0
- data/lib/opal/rewriters/for_rewriter.rb +36 -24
- data/lib/opal/simple_server.rb +2 -2
- data/lib/opal/source_map/file.rb +1 -1
- data/lib/opal/version.rb +1 -1
- data/opal/corelib/array/pack.rb +1 -0
- data/opal/corelib/array.rb +71 -43
- data/opal/corelib/basic_object.rb +1 -0
- data/opal/corelib/binding.rb +2 -0
- data/opal/corelib/boolean.rb +1 -0
- data/opal/corelib/class.rb +2 -0
- data/opal/corelib/comparable.rb +1 -0
- data/opal/corelib/complex.rb +2 -0
- data/opal/corelib/constants.rb +2 -2
- data/opal/corelib/dir.rb +2 -0
- data/opal/corelib/enumerable.rb +3 -2
- data/opal/corelib/enumerator/arithmetic_sequence.rb +2 -0
- data/opal/corelib/enumerator/chain.rb +1 -0
- data/opal/corelib/enumerator/generator.rb +1 -0
- data/opal/corelib/enumerator/lazy.rb +1 -0
- data/opal/corelib/enumerator/yielder.rb +2 -0
- data/opal/corelib/enumerator.rb +1 -0
- data/opal/corelib/error/errno.rb +2 -0
- data/opal/corelib/error.rb +12 -0
- data/opal/corelib/file.rb +1 -0
- data/opal/corelib/hash.rb +197 -504
- data/opal/corelib/helpers.rb +1 -0
- data/opal/corelib/io.rb +2 -0
- data/opal/corelib/irb.rb +2 -0
- data/opal/corelib/kernel/format.rb +1 -0
- data/opal/corelib/kernel.rb +70 -14
- data/opal/corelib/main.rb +2 -0
- data/opal/corelib/marshal/read_buffer.rb +2 -0
- data/opal/corelib/marshal/write_buffer.rb +2 -0
- data/opal/corelib/math/polyfills.rb +2 -0
- data/opal/corelib/math.rb +1 -0
- data/opal/corelib/method.rb +2 -0
- data/opal/corelib/module.rb +1 -0
- data/opal/corelib/nil.rb +3 -1
- data/opal/corelib/number.rb +2 -0
- data/opal/corelib/numeric.rb +2 -0
- data/opal/corelib/object_space.rb +1 -0
- data/opal/corelib/pack_unpack/format_string_parser.rb +2 -0
- data/opal/corelib/proc.rb +30 -28
- data/opal/corelib/process.rb +2 -0
- data/opal/corelib/random/formatter.rb +2 -0
- data/opal/corelib/random/math_random.js.rb +2 -0
- data/opal/corelib/random/mersenne_twister.rb +2 -0
- data/opal/corelib/random/seedrandom.js.rb +2 -0
- data/opal/corelib/random.rb +1 -0
- data/opal/corelib/range.rb +34 -12
- data/opal/corelib/rational.rb +2 -0
- data/opal/corelib/regexp.rb +1 -0
- data/opal/corelib/runtime.js +187 -231
- data/opal/corelib/set.rb +2 -0
- data/opal/corelib/string/encoding.rb +3 -0
- data/opal/corelib/string/unpack.rb +2 -0
- data/opal/corelib/string.rb +20 -12
- data/opal/corelib/struct.rb +3 -1
- data/opal/corelib/time.rb +1 -0
- data/opal/corelib/trace_point.rb +2 -0
- data/opal/corelib/unsupported.rb +2 -0
- data/opal/corelib/variables.rb +2 -0
- data/opal.gemspec +2 -2
- data/spec/filters/bugs/array.rb +0 -2
- data/spec/filters/bugs/enumerable.rb +0 -3
- data/spec/filters/bugs/hash.rb +0 -13
- data/spec/filters/bugs/kernel.rb +0 -38
- data/spec/filters/bugs/range.rb +0 -1
- data/spec/filters/bugs/ruby-32.rb +0 -2
- data/spec/filters/bugs/string.rb +0 -1
- data/spec/filters/bugs/struct.rb +1 -5
- data/spec/filters/unsupported/hash.rb +1 -0
- data/spec/lib/compiler_spec.rb +24 -17
- data/spec/mspec-opal/formatters.rb +2 -0
- data/spec/mspec-opal/runner.rb +2 -0
- data/spec/opal/core/array/dup_spec.rb +2 -0
- data/spec/opal/core/exception_spec.rb +2 -0
- data/spec/opal/core/hash/internals_spec.rb +154 -206
- data/spec/opal/core/hash_spec.rb +2 -0
- data/spec/opal/core/iterable_props_spec.rb +2 -0
- data/spec/opal/core/kernel/at_exit_spec.rb +2 -0
- data/spec/opal/core/kernel/respond_to_spec.rb +2 -0
- data/spec/opal/core/language/arguments/mlhs_arg_spec.rb +2 -0
- data/spec/opal/core/language/safe_navigator_spec.rb +2 -0
- data/spec/opal/core/language/xstring_send_spec.rb +15 -0
- data/spec/opal/core/language/xstring_spec.rb +2 -0
- data/spec/opal/core/language_spec.rb +2 -0
- data/spec/opal/core/module_spec.rb +44 -0
- data/spec/opal/core/number/to_i_spec.rb +2 -0
- data/spec/opal/core/object_id_spec.rb +2 -0
- data/spec/opal/core/regexp/match_spec.rb +2 -0
- data/spec/opal/core/runtime/bridged_classes_spec.rb +38 -0
- data/spec/opal/core/runtime/constants_spec.rb +2 -0
- data/spec/opal/core/runtime/eval_spec.rb +2 -0
- data/spec/opal/core/runtime/exit_spec.rb +2 -0
- data/spec/opal/core/runtime/is_a_spec.rb +2 -0
- data/spec/opal/core/runtime/loaded_spec.rb +2 -0
- data/spec/opal/core/runtime/method_missing_spec.rb +2 -0
- data/spec/opal/core/runtime/rescue_spec.rb +2 -0
- data/spec/opal/core/runtime/string_spec.rb +2 -0
- data/spec/opal/core/runtime/truthy_spec.rb +2 -0
- data/spec/opal/core/runtime_spec.rb +2 -6
- data/spec/opal/core/string/to_sym_spec.rb +2 -0
- data/spec/opal/stdlib/js_spec.rb +2 -0
- data/spec/opal/stdlib/native/alias_native_spec.rb +2 -0
- data/spec/opal/stdlib/native/array_spec.rb +2 -0
- data/spec/opal/stdlib/native/date_spec.rb +2 -0
- data/spec/opal/stdlib/native/each_spec.rb +2 -0
- data/spec/opal/stdlib/native/element_reference_spec.rb +2 -0
- data/spec/opal/stdlib/native/exposure_spec.rb +2 -0
- data/spec/opal/stdlib/native/ext_spec.rb +2 -0
- data/spec/opal/stdlib/native/hash_spec.rb +30 -2
- data/spec/opal/stdlib/native/initialize_spec.rb +2 -0
- data/spec/opal/stdlib/native/method_missing_spec.rb +2 -0
- data/spec/opal/stdlib/native/native_alias_spec.rb +2 -0
- data/spec/opal/stdlib/native/native_class_spec.rb +2 -0
- data/spec/opal/stdlib/native/native_module_spec.rb +2 -0
- data/spec/opal/stdlib/native/native_reader_spec.rb +2 -0
- data/spec/opal/stdlib/native/native_writer_spec.rb +2 -0
- data/spec/opal/stdlib/native/new_spec.rb +2 -0
- data/spec/opal/stdlib/native/struct_spec.rb +2 -0
- data/spec/spec_helper.rb +2 -0
- data/stdlib/await.rb +1 -0
- data/stdlib/base64.rb +2 -0
- data/stdlib/bigdecimal/bignumber.js.rb +2 -0
- data/stdlib/bigdecimal/util.rb +1 -0
- data/stdlib/bigdecimal.rb +2 -0
- data/stdlib/buffer/array.rb +2 -0
- data/stdlib/buffer/view.rb +2 -0
- data/stdlib/buffer.rb +2 -0
- data/stdlib/cgi.rb +14 -0
- data/stdlib/console.rb +2 -0
- data/stdlib/date/date_time.rb +2 -0
- data/stdlib/date.rb +2 -0
- data/stdlib/delegate.rb +2 -0
- data/stdlib/deno/base.rb +2 -0
- data/stdlib/deno/file.rb +2 -0
- data/stdlib/erb.rb +2 -0
- data/stdlib/gjs/io.rb +2 -0
- data/stdlib/gjs/kernel.rb +2 -0
- data/stdlib/headless_browser/base.rb +2 -0
- data/stdlib/headless_browser/file.rb +1 -0
- data/stdlib/headless_browser.rb +1 -0
- data/stdlib/js.rb +2 -0
- data/stdlib/json.rb +9 -15
- data/stdlib/logger.rb +2 -0
- data/stdlib/nashorn/file.rb +2 -0
- data/stdlib/nashorn/io.rb +2 -0
- data/stdlib/native.rb +48 -48
- data/stdlib/nodejs/base.rb +2 -0
- data/stdlib/nodejs/dir.rb +2 -0
- data/stdlib/nodejs/env.rb +2 -0
- data/stdlib/nodejs/file.rb +2 -0
- data/stdlib/nodejs/fileutils.rb +2 -0
- data/stdlib/nodejs/io.rb +2 -0
- data/stdlib/nodejs/js-yaml-3-6-1.js +1 -1
- data/stdlib/nodejs/kernel.rb +2 -0
- data/stdlib/nodejs/open-uri.rb +2 -0
- data/stdlib/nodejs/pathname.rb +2 -0
- data/stdlib/nodejs/require.rb +2 -0
- data/stdlib/nodejs/yaml.rb +9 -3
- data/stdlib/opal/miniracer.rb +2 -0
- data/stdlib/opal-parser.rb +8 -1
- data/stdlib/opal-platform.rb +2 -0
- data/stdlib/opal-replutils.rb +2 -0
- data/stdlib/open-uri.rb +4 -1
- data/stdlib/ostruct.rb +4 -2
- data/stdlib/pathname.rb +2 -0
- data/stdlib/pp.rb +1 -0
- data/stdlib/promise/v2.rb +2 -0
- data/stdlib/quickjs/io.rb +2 -0
- data/stdlib/quickjs/kernel.rb +2 -0
- data/stdlib/quickjs.rb +2 -0
- data/stdlib/securerandom.rb +2 -0
- data/stdlib/strscan.rb +2 -0
- data/stdlib/time.rb +2 -0
- data/stdlib/uri.rb +1 -0
- data/tasks/performance/optimization_status.rb +2 -0
- data/tasks/testing.rake +1 -0
- data/test/nodejs/test_await.rb +1 -0
- data/test/nodejs/test_dir.rb +2 -0
- data/test/nodejs/test_error.rb +2 -0
- data/test/nodejs/test_file.rb +2 -0
- data/test/nodejs/test_string.rb +2 -0
- data/test/nodejs/test_yaml.rb +20 -0
- metadata +22 -13
- data/spec/filters/bugs/openstruct.rb +0 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c756d4ba883cb8f7c7bdfefa6b88cf4a2db0604d1ef8a906d7c58add76eee1bf
|
4
|
+
data.tar.gz: e88f7de8d6add79b64c7d6b896fbd1c94f51edd34754e6da3ceb59e3fa501134
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1d9e3b8b4cc8decc9fc5644eb842ee84290bb0c6f231de362d259a691570296ac9fab95e400dccda20d317e12b7f3d58334d816a8f5279b304d0435d15ac699f
|
7
|
+
data.tar.gz: '02883fef4e6869c54b718c370ddd03a934e50698eb37638da6788d212286fbc57ecab6c5e0c2c46bd02931ff75e39455f09a6de462157433b03cb8535d1ce76b'
|
data/.github/workflows/build.yml
CHANGED
@@ -4,8 +4,8 @@ on:
|
|
4
4
|
push:
|
5
5
|
branches:
|
6
6
|
- master
|
7
|
-
-
|
8
|
-
-
|
7
|
+
- '*-stable'
|
8
|
+
- '*/ci-check'
|
9
9
|
pull_request: {}
|
10
10
|
|
11
11
|
permissions:
|
@@ -59,13 +59,13 @@ jobs:
|
|
59
59
|
command: bundle exec rake mspec_chrome
|
60
60
|
ruby: '3.0'
|
61
61
|
os: windows-latest
|
62
|
-
- name: windows-mspec-firefox
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
62
|
+
# - name: windows-mspec-firefox
|
63
|
+
# env:
|
64
|
+
# # when changing version, also change it below and above
|
65
|
+
# MOZILLA_FIREFOX_BINARY: 'C:/Program Files/Firefox_106.0.4/firefox.exe'
|
66
|
+
# ruby: '3.0'
|
67
|
+
# command: bundle exec rake mspec_firefox
|
68
|
+
# os: windows-latest
|
69
69
|
- name: macos-mspec-safari
|
70
70
|
command: bundle exec rake mspec_safari
|
71
71
|
ruby: '3.0'
|
data/.rubocop/todo.yml
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# All items in this file require fixing
|
2
2
|
|
3
|
-
|
3
|
+
Layout/LineLength:
|
4
4
|
Enabled: false
|
5
5
|
|
6
6
|
Lint/AssignmentInCondition:
|
@@ -33,7 +33,7 @@ Style/MutableConstant:
|
|
33
33
|
- 'lib/opal/nodes/call.rb'
|
34
34
|
- 'lib/opal/util.rb'
|
35
35
|
|
36
|
-
Lint/
|
36
|
+
Lint/SuppressedException:
|
37
37
|
Exclude:
|
38
38
|
- 'stdlib/ostruct.rb'
|
39
39
|
|
data/.rubocop.yml
CHANGED
@@ -1,8 +1,14 @@
|
|
1
|
+
inherit_from:
|
2
|
+
- .rubocop_todo.yml
|
3
|
+
- .rubocop/todo.yml
|
4
|
+
|
1
5
|
require: rubocop-performance
|
2
|
-
|
6
|
+
|
3
7
|
|
4
8
|
AllCops:
|
5
|
-
TargetRubyVersion:
|
9
|
+
TargetRubyVersion: 3.0
|
10
|
+
NewCops: disable
|
11
|
+
SuggestExtensions: false
|
6
12
|
Exclude:
|
7
13
|
- CHANGELOG.md
|
8
14
|
- CONDUCT.md
|
@@ -78,7 +84,7 @@ Layout/CommentIndentation:
|
|
78
84
|
- 'lib/opal/source_map/file.rb'
|
79
85
|
|
80
86
|
# We need to support older rubies
|
81
|
-
Layout/
|
87
|
+
Layout/HeredocIndentation:
|
82
88
|
Enabled: false
|
83
89
|
|
84
90
|
Style/FrozenStringLiteralComment:
|
@@ -104,7 +110,7 @@ Layout/ExtraSpacing:
|
|
104
110
|
# This files uses extra spaces to show an inheritance tree of error classes
|
105
111
|
- 'opal/corelib/error.rb'
|
106
112
|
|
107
|
-
Layout/
|
113
|
+
Layout/FirstArrayElementIndentation:
|
108
114
|
EnforcedStyle: consistent
|
109
115
|
|
110
116
|
Layout/SpaceAroundOperators:
|
@@ -147,7 +153,7 @@ Lint/RescueException:
|
|
147
153
|
- 'stdlib/promise.rb'
|
148
154
|
- 'opal/corelib/binding.rb'
|
149
155
|
|
150
|
-
Lint/
|
156
|
+
Lint/RedundantStringCoercion:
|
151
157
|
Exclude:
|
152
158
|
# That's what MRI does
|
153
159
|
- 'opal/corelib/error.rb'
|
@@ -208,7 +214,7 @@ Naming/BinaryOperatorParameterName:
|
|
208
214
|
|
209
215
|
Naming/PredicateName:
|
210
216
|
# Ruby has "has_key?" method
|
211
|
-
|
217
|
+
ForbiddenPrefixes: is_, have_
|
212
218
|
|
213
219
|
Performance/FlatMap:
|
214
220
|
Exclude:
|
@@ -267,7 +273,7 @@ Style/InverseMethods:
|
|
267
273
|
- 'opal/corelib/basic_object.rb'
|
268
274
|
- 'opal/corelib/kernel.rb'
|
269
275
|
|
270
|
-
|
276
|
+
Lint/MissingSuper:
|
271
277
|
# Base Opal classes simply can't or shouldn't call super for #method_missing
|
272
278
|
Exclude:
|
273
279
|
- 'opal/corelib/basic_object.rb'
|
@@ -318,7 +324,7 @@ Style/TrailingCommaInArguments:
|
|
318
324
|
# Any style is allowed
|
319
325
|
Enabled: false
|
320
326
|
|
321
|
-
Layout/
|
327
|
+
Layout/ParameterAlignment:
|
322
328
|
EnforcedStyle: with_fixed_indentation
|
323
329
|
|
324
330
|
Layout/MultilineMethodCallBraceLayout:
|
@@ -371,6 +377,7 @@ Naming/ConstantName:
|
|
371
377
|
Exclude:
|
372
378
|
# MRI has a constant BigDecimal::SIGN_NaN
|
373
379
|
- 'stdlib/bigdecimal.rb'
|
380
|
+
- 'stdlib/opal-platform.rb'
|
374
381
|
|
375
382
|
Security/Eval:
|
376
383
|
Exclude:
|
@@ -395,7 +402,7 @@ Style/TrailingCommaInHashLiteral:
|
|
395
402
|
# Any style is allowed
|
396
403
|
Enabled: false
|
397
404
|
|
398
|
-
Naming/
|
405
|
+
Naming/MethodParameterName:
|
399
406
|
Exclude:
|
400
407
|
# This file uses parser's code that doesn't match our styling requirements
|
401
408
|
- 'lib/opal/parser/patch.rb'
|
@@ -436,7 +443,7 @@ Style/MultipleComparison:
|
|
436
443
|
Layout/EmptyLineAfterGuardClause:
|
437
444
|
Enabled: false
|
438
445
|
|
439
|
-
Layout/
|
446
|
+
Layout/HashAlignment:
|
440
447
|
Enabled: false
|
441
448
|
|
442
449
|
# No way to set multiple preferred names
|
data/.rubocop_todo.yml
ADDED
@@ -0,0 +1,311 @@
|
|
1
|
+
# This configuration was generated by
|
2
|
+
# `rubocop --auto-gen-config`
|
3
|
+
# on 2023-05-09 13:13:04 UTC using RuboCop version 1.50.2.
|
4
|
+
# The point is for the user to remove these configuration records
|
5
|
+
# one by one as the offenses are removed from the code base.
|
6
|
+
# Note that changes in the inspected code, or installation of new
|
7
|
+
# versions of RuboCop, may require this file to be generated again.
|
8
|
+
|
9
|
+
# Offense count: 30
|
10
|
+
# This cop supports safe autocorrection (--autocorrect).
|
11
|
+
# Configuration parameters: EnforcedStyle, IndentationWidth.
|
12
|
+
# SupportedStyles: with_first_argument, with_fixed_indentation
|
13
|
+
Layout/ArgumentAlignment:
|
14
|
+
Exclude:
|
15
|
+
- 'lib/opal/builder.rb'
|
16
|
+
- 'lib/opal/cli.rb'
|
17
|
+
- 'lib/opal/cli_options.rb'
|
18
|
+
- 'lib/opal/nodes/call_special.rb'
|
19
|
+
- 'lib/opal/repl.rb'
|
20
|
+
- 'lib/opal/rewriters/arguments.rb'
|
21
|
+
- 'lib/opal/rewriters/forward_args.rb'
|
22
|
+
- 'lib/opal/rewriters/opal_engine_check.rb'
|
23
|
+
- 'lib/opal/rewriters/returnable_logic.rb'
|
24
|
+
- 'opal/corelib/complex.rb'
|
25
|
+
- 'stdlib/date.rb'
|
26
|
+
|
27
|
+
# Offense count: 1
|
28
|
+
# This cop supports safe autocorrection (--autocorrect).
|
29
|
+
# Configuration parameters: EnforcedStyleAlignWith, Severity.
|
30
|
+
# SupportedStylesAlignWith: start_of_line, begin
|
31
|
+
Layout/BeginEndAlignment:
|
32
|
+
Exclude:
|
33
|
+
- 'lib/opal/cache.rb'
|
34
|
+
|
35
|
+
# Offense count: 1
|
36
|
+
# This cop supports safe autocorrection (--autocorrect).
|
37
|
+
# Configuration parameters: AllowForAlignment.
|
38
|
+
Layout/CommentIndentation:
|
39
|
+
Exclude:
|
40
|
+
- 'stdlib/opal-platform.rb'
|
41
|
+
|
42
|
+
# Offense count: 5
|
43
|
+
# This cop supports safe autocorrection (--autocorrect).
|
44
|
+
# Configuration parameters: EmptyLineBetweenMethodDefs, EmptyLineBetweenClassDefs, EmptyLineBetweenModuleDefs, AllowAdjacentOneLineDefs, NumberOfEmptyLines.
|
45
|
+
Layout/EmptyLineBetweenDefs:
|
46
|
+
Exclude:
|
47
|
+
- 'stdlib/bigdecimal/util.rb'
|
48
|
+
|
49
|
+
# Offense count: 1
|
50
|
+
# This cop supports safe autocorrection (--autocorrect).
|
51
|
+
# Configuration parameters: EnforcedStyle.
|
52
|
+
# SupportedStyles: around, only_before
|
53
|
+
Layout/EmptyLinesAroundAccessModifier:
|
54
|
+
Exclude:
|
55
|
+
- 'stdlib/ruby2_keywords.rb'
|
56
|
+
|
57
|
+
# Offense count: 1
|
58
|
+
# This cop supports safe autocorrection (--autocorrect).
|
59
|
+
# Configuration parameters: AllowAliasSyntax, AllowedMethods.
|
60
|
+
# AllowedMethods: alias_method, public, protected, private
|
61
|
+
Layout/EmptyLinesAroundAttributeAccessor:
|
62
|
+
Exclude:
|
63
|
+
- 'opal/corelib/string/encoding.rb'
|
64
|
+
|
65
|
+
# Offense count: 1
|
66
|
+
# This cop supports safe autocorrection (--autocorrect).
|
67
|
+
# Configuration parameters: EnforcedStyle.
|
68
|
+
# SupportedStyles: empty_lines, empty_lines_except_namespace, empty_lines_special, no_empty_lines, beginning_only, ending_only
|
69
|
+
Layout/EmptyLinesAroundClassBody:
|
70
|
+
Exclude:
|
71
|
+
- 'opal/corelib/string/__old__mutable.rb'
|
72
|
+
|
73
|
+
# Offense count: 1
|
74
|
+
# This cop supports safe autocorrection (--autocorrect).
|
75
|
+
# Configuration parameters: AllowForAlignment, EnforcedStyleForExponentOperator.
|
76
|
+
# SupportedStylesForExponentOperator: space, no_space
|
77
|
+
Layout/SpaceAroundOperators:
|
78
|
+
Exclude:
|
79
|
+
- 'lib/opal/regexp_anchors.rb'
|
80
|
+
|
81
|
+
# Offense count: 25
|
82
|
+
# This cop supports safe autocorrection (--autocorrect).
|
83
|
+
# Configuration parameters: EnforcedStyle.
|
84
|
+
# SupportedStyles: space, no_space
|
85
|
+
Layout/SpaceInsideStringInterpolation:
|
86
|
+
Exclude:
|
87
|
+
- 'lib/opal/nodes/literal.rb'
|
88
|
+
- 'opal/corelib/array.rb'
|
89
|
+
- 'opal/corelib/hash.rb'
|
90
|
+
- 'opal/corelib/kernel.rb'
|
91
|
+
- 'opal/corelib/number.rb'
|
92
|
+
|
93
|
+
# Offense count: 2
|
94
|
+
# Configuration parameters: AllowComments.
|
95
|
+
Lint/EmptyFile:
|
96
|
+
Exclude:
|
97
|
+
- 'stdlib/fileutils.rb'
|
98
|
+
- 'stdlib/iconv.rb'
|
99
|
+
|
100
|
+
# Offense count: 1
|
101
|
+
Lint/FloatComparison:
|
102
|
+
Exclude:
|
103
|
+
- 'opal/corelib/rational.rb'
|
104
|
+
|
105
|
+
# Offense count: 13
|
106
|
+
# This cop supports safe autocorrection (--autocorrect).
|
107
|
+
Lint/LiteralInInterpolation:
|
108
|
+
Exclude:
|
109
|
+
- 'opal/corelib/array.rb'
|
110
|
+
- 'opal/corelib/enumerable.rb'
|
111
|
+
- 'opal/corelib/module.rb'
|
112
|
+
- 'opal/corelib/proc.rb'
|
113
|
+
- 'opal/corelib/time.rb'
|
114
|
+
|
115
|
+
# Offense count: 26
|
116
|
+
Lint/MissingSuper:
|
117
|
+
Enabled: false
|
118
|
+
|
119
|
+
# Offense count: 5
|
120
|
+
# This cop supports safe autocorrection (--autocorrect).
|
121
|
+
Lint/RedundantCopDisableDirective:
|
122
|
+
Exclude:
|
123
|
+
- 'lib/opal/cli.rb'
|
124
|
+
- 'lib/opal/rewriters/thrower_finder.rb'
|
125
|
+
- 'stdlib/delegate.rb'
|
126
|
+
|
127
|
+
# Offense count: 2
|
128
|
+
# This cop supports safe autocorrection (--autocorrect).
|
129
|
+
Lint/RedundantRequireStatement:
|
130
|
+
Exclude:
|
131
|
+
- 'stdlib/delegate.rb'
|
132
|
+
- 'stdlib/opal-replutils.rb'
|
133
|
+
|
134
|
+
# Offense count: 11
|
135
|
+
# This cop supports safe autocorrection (--autocorrect).
|
136
|
+
Lint/RedundantStringCoercion:
|
137
|
+
Exclude:
|
138
|
+
- 'lib/opal/cli_runners/safari.rb'
|
139
|
+
- 'opal/corelib/array.rb'
|
140
|
+
- 'opal/corelib/kernel/format.rb'
|
141
|
+
- 'opal/corelib/marshal/read_buffer.rb'
|
142
|
+
- 'opal/corelib/string.rb'
|
143
|
+
- 'stdlib/date.rb'
|
144
|
+
- 'stdlib/nodejs/env.rb'
|
145
|
+
|
146
|
+
# Offense count: 1
|
147
|
+
# Configuration parameters: AllowedPatterns.
|
148
|
+
# AllowedPatterns: (?-mix:(exactly|at_least|at_most)\(\d+\)\.times)
|
149
|
+
Lint/UnreachableLoop:
|
150
|
+
Exclude:
|
151
|
+
- 'opal/corelib/enumerable.rb'
|
152
|
+
|
153
|
+
# Offense count: 6
|
154
|
+
# This cop supports safe autocorrection (--autocorrect).
|
155
|
+
Performance/BindCall:
|
156
|
+
Exclude:
|
157
|
+
- 'opal/corelib/marshal/write_buffer.rb'
|
158
|
+
- 'opal/corelib/method.rb'
|
159
|
+
- 'stdlib/native.rb'
|
160
|
+
|
161
|
+
# Offense count: 2
|
162
|
+
# This cop supports safe autocorrection (--autocorrect).
|
163
|
+
Performance/RedundantBlockCall:
|
164
|
+
Exclude:
|
165
|
+
- 'stdlib/deno/file.rb'
|
166
|
+
- 'stdlib/nodejs/file.rb'
|
167
|
+
|
168
|
+
# Offense count: 21
|
169
|
+
# This cop supports safe autocorrection (--autocorrect).
|
170
|
+
# Configuration parameters: EnforcedStyle.
|
171
|
+
# SupportedStyles: separated, grouped
|
172
|
+
Style/AccessorGrouping:
|
173
|
+
Exclude:
|
174
|
+
- 'lib/opal/cli.rb'
|
175
|
+
- 'lib/opal/nodes/node_with_args.rb'
|
176
|
+
- 'lib/opal/nodes/scope.rb'
|
177
|
+
- 'lib/opal/source_map/file.rb'
|
178
|
+
- 'opal/corelib/string/encoding.rb'
|
179
|
+
- 'stdlib/logger.rb'
|
180
|
+
- 'stdlib/strscan.rb'
|
181
|
+
|
182
|
+
# Offense count: 4
|
183
|
+
# This cop supports unsafe autocorrection (--autocorrect-all).
|
184
|
+
# Configuration parameters: MinBranchesCount.
|
185
|
+
Style/CaseLikeIf:
|
186
|
+
Exclude:
|
187
|
+
- 'lib/opal/nodes/call.rb'
|
188
|
+
- 'opal/corelib/complex.rb'
|
189
|
+
- 'opal/corelib/marshal/read_buffer.rb'
|
190
|
+
- 'opal/corelib/marshal/write_buffer.rb'
|
191
|
+
|
192
|
+
# Offense count: 6
|
193
|
+
# This cop supports safe autocorrection (--autocorrect).
|
194
|
+
# Configuration parameters: AllowedMethods, AllowedPatterns.
|
195
|
+
# AllowedMethods: ==, equal?, eql?
|
196
|
+
Style/ClassEqualityComparison:
|
197
|
+
Exclude:
|
198
|
+
- 'lib/opal/fragment.rb'
|
199
|
+
- 'lib/opal/rewriters/pattern_matching.rb'
|
200
|
+
- 'opal/corelib/marshal/read_buffer.rb'
|
201
|
+
- 'opal/corelib/marshal/write_buffer.rb'
|
202
|
+
- 'opal/corelib/struct.rb'
|
203
|
+
|
204
|
+
# Offense count: 1
|
205
|
+
# This cop supports safe autocorrection (--autocorrect).
|
206
|
+
# Configuration parameters: Keywords, RequireColon.
|
207
|
+
# Keywords: TODO, FIXME, OPTIMIZE, HACK, REVIEW, NOTE
|
208
|
+
Style/CommentAnnotation:
|
209
|
+
Exclude:
|
210
|
+
- 'stdlib/delegate.rb'
|
211
|
+
|
212
|
+
# Offense count: 8
|
213
|
+
# This cop supports safe autocorrection (--autocorrect).
|
214
|
+
Style/ExplicitBlockArgument:
|
215
|
+
Exclude:
|
216
|
+
- 'lib/opal/cli_runners/chrome.rb'
|
217
|
+
- 'lib/opal/cli_runners/firefox.rb'
|
218
|
+
- 'lib/opal/cli_runners/safari.rb'
|
219
|
+
- 'opal/corelib/enumerable.rb'
|
220
|
+
- 'opal/corelib/set.rb'
|
221
|
+
- 'stdlib/date.rb'
|
222
|
+
- 'stdlib/ostruct.rb'
|
223
|
+
|
224
|
+
# Offense count: 16
|
225
|
+
# This cop supports unsafe autocorrection (--autocorrect-all).
|
226
|
+
Style/GlobalStdStream:
|
227
|
+
Exclude:
|
228
|
+
- 'lib/opal/cli_runners/safari.rb'
|
229
|
+
- 'opal/corelib/io.rb'
|
230
|
+
- 'stdlib/deno/base.rb'
|
231
|
+
- 'stdlib/nodejs/base.rb'
|
232
|
+
|
233
|
+
# Offense count: 2
|
234
|
+
# Configuration parameters: MinBranchesCount.
|
235
|
+
Style/HashLikeCase:
|
236
|
+
Exclude:
|
237
|
+
- 'lib/opal/fragment.rb'
|
238
|
+
- 'stdlib/buffer.rb'
|
239
|
+
|
240
|
+
# Offense count: 1
|
241
|
+
# This cop supports safe autocorrection (--autocorrect).
|
242
|
+
Style/MultilineWhenThen:
|
243
|
+
Exclude:
|
244
|
+
- 'lib/opal/builder.rb'
|
245
|
+
|
246
|
+
# Offense count: 43
|
247
|
+
# Configuration parameters: AllowedMethods.
|
248
|
+
# AllowedMethods: respond_to_missing?
|
249
|
+
Style/OptionalBooleanParameter:
|
250
|
+
Enabled: false
|
251
|
+
|
252
|
+
# Offense count: 4
|
253
|
+
# This cop supports safe autocorrection (--autocorrect).
|
254
|
+
Style/RedundantAssignment:
|
255
|
+
Exclude:
|
256
|
+
- 'lib/opal/nodes/args/arity_check.rb'
|
257
|
+
- 'lib/opal/parser/default_config.rb'
|
258
|
+
- 'opal/corelib/file.rb'
|
259
|
+
- 'stdlib/shellwords.rb'
|
260
|
+
|
261
|
+
# Offense count: 13
|
262
|
+
# This cop supports safe autocorrection (--autocorrect).
|
263
|
+
Style/RedundantFreeze:
|
264
|
+
Exclude:
|
265
|
+
- 'lib/opal/erb.rb'
|
266
|
+
- 'lib/opal/magic_comments.rb'
|
267
|
+
- 'lib/opal/nodes/literal.rb'
|
268
|
+
- 'lib/opal/path_reader.rb'
|
269
|
+
- 'lib/opal/rewriters/js_reserved_words.rb'
|
270
|
+
|
271
|
+
# Offense count: 15
|
272
|
+
# This cop supports safe autocorrection (--autocorrect).
|
273
|
+
Style/RedundantRegexpEscape:
|
274
|
+
Exclude:
|
275
|
+
- 'lib/opal/compiler.rb'
|
276
|
+
- 'lib/opal/nodes/helpers.rb'
|
277
|
+
- 'opal/corelib/file.rb'
|
278
|
+
- 'stdlib/shellwords.rb'
|
279
|
+
|
280
|
+
# Offense count: 4
|
281
|
+
# This cop supports safe autocorrection (--autocorrect).
|
282
|
+
# Configuration parameters: AllowMultipleReturnValues.
|
283
|
+
Style/RedundantReturn:
|
284
|
+
Exclude:
|
285
|
+
- 'lib/opal/compiler.rb'
|
286
|
+
- 'stdlib/bigdecimal.rb'
|
287
|
+
- 'stdlib/pathname.rb'
|
288
|
+
|
289
|
+
# Offense count: 35
|
290
|
+
# This cop supports unsafe autocorrection (--autocorrect-all).
|
291
|
+
Style/SlicingWithRange:
|
292
|
+
Enabled: false
|
293
|
+
|
294
|
+
# Offense count: 1
|
295
|
+
# This cop supports safe autocorrection (--autocorrect).
|
296
|
+
# Configuration parameters: AllowModifier.
|
297
|
+
Style/SoleNestedConditional:
|
298
|
+
Exclude:
|
299
|
+
- 'lib/opal/nodes/if.rb'
|
300
|
+
|
301
|
+
# Offense count: 24
|
302
|
+
# This cop supports unsafe autocorrection (--autocorrect-all).
|
303
|
+
# Configuration parameters: Mode.
|
304
|
+
Style/StringConcatenation:
|
305
|
+
Enabled: false
|
306
|
+
|
307
|
+
# Offense count: 3
|
308
|
+
# This cop supports unsafe autocorrection (--autocorrect-all).
|
309
|
+
Style/ZeroLengthPredicate:
|
310
|
+
Exclude:
|
311
|
+
- 'lib/opal/source_map/file.rb'
|
data/CHANGELOG.md
CHANGED
@@ -16,7 +16,7 @@ Changes are grouped as follows:
|
|
16
16
|
|
17
17
|
|
18
18
|
|
19
|
-
## [1.7.
|
19
|
+
## [1.7.3](https://github.com/opal/opal/compare/v1.7.2...v1.7.3) - 2023-03-23
|
20
20
|
|
21
21
|
|
22
22
|
<!--
|
@@ -28,20 +28,6 @@ Changes are grouped as follows:
|
|
28
28
|
### Performance
|
29
29
|
-->
|
30
30
|
|
31
|
-
### Fixed
|
32
|
-
|
33
|
-
- Use a Map instead of a POJO for the jsid_cache ([#2584](https://github.com/opal/opal/pull/2584))
|
34
|
-
- Lowercase response headers in `SimpleServer` for rack 3.0 compatibility ([#2578](https://github.com/opal/opal/pull/2578))
|
35
|
-
- Fix `switch` with Object-wrapped values ([#2542](https://github.com/opal/opal/pull/2542))
|
36
|
-
- Regexp.escape: Cast to String or drop exception ([#2552](https://github.com/opal/opal/pull/2552))
|
37
|
-
- Chrome runner fix: support code that contains `</script>` ([#2581](https://github.com/opal/opal/pull/2581))
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
## [1.7.3](https://github.com/opal/opal/compare/v1.7.2...v1.7.3) - 2023-03-23
|
43
|
-
|
44
|
-
|
45
31
|
### Fixed
|
46
32
|
|
47
33
|
- Disallow to define a singleton class for Number ([#2521](https://github.com/opal/opal/pull/2521))
|
data/UNRELEASED.md
CHANGED
@@ -1,10 +1,87 @@
|
|
1
1
|
<!--
|
2
2
|
### Internal
|
3
|
-
### Changed
|
4
3
|
### Added
|
5
4
|
### Removed
|
6
5
|
### Deprecated
|
7
6
|
### Performance
|
8
7
|
### Fixed
|
8
|
+
### Documentation
|
9
9
|
-->
|
10
10
|
|
11
|
+
## Highlights
|
12
|
+
|
13
|
+
### `Hash` is now bridged to JavaScript `Map`
|
14
|
+
|
15
|
+
This change brings a lot of benefits, but also some incompatibilities. The main benefit is that `Hash` now is both more performant and relies on native JavaScript capabilities.
|
16
|
+
This improves interoperability with JavaScript. As a downside, applications reaching for internal `Hash` data structures will need to be updated.
|
17
|
+
|
18
|
+
Interacting with `Hash` from `JavaScript` is easier than ever:
|
19
|
+
|
20
|
+
```ruby
|
21
|
+
hash = `new Map([['a', 1], ['b', 2]])`
|
22
|
+
hash # => {a: 1, b: 2}
|
23
|
+
`console.log(hash)` # => Map(2) {"a" => 1, "b" => 2}
|
24
|
+
`hash.get('a')` # => 1
|
25
|
+
`hash.set('c', 3)`
|
26
|
+
hash # => {a: 1, b: 2, c: 3}
|
27
|
+
hash.keys # => ["a", "b", "c"]
|
28
|
+
hash.values # => [1, 2, 3]
|
29
|
+
```
|
30
|
+
|
31
|
+
### Performance improvements
|
32
|
+
|
33
|
+
This release brings a lot of performance improvements, our tests on Asciidoctor show a 25% improvement in performance, but we've seen up to 66% performance improvement on some applications.
|
34
|
+
|
35
|
+
## Changelog
|
36
|
+
|
37
|
+
### Deprecated
|
38
|
+
|
39
|
+
- Deprecate using x-string to access JavaScript without an explicit magic-comment (#2543)
|
40
|
+
|
41
|
+
### Compatibility
|
42
|
+
|
43
|
+
- Add a magic-comment that will disable x-string compilation to JavaScript (#2543)
|
44
|
+
|
45
|
+
### Fixed
|
46
|
+
|
47
|
+
- Fix `Kernel#Float` with `exception:` option (#2532)
|
48
|
+
- Fix `Kernel#Integer` with `exception:` option (#2531)
|
49
|
+
- Fix `String#split` with limit and capturing regexp (#2544)
|
50
|
+
- Fix `switch` with Object-wrapped values (#2542)
|
51
|
+
- Fix non-direct subclasses of bridged classes not calling the original constructor (#2546)
|
52
|
+
- Regexp.escape: Cast to String or drop exception (#2552)
|
53
|
+
- Propagate removal of method from included/prepended modules (#2553)
|
54
|
+
- Restore `nodejs/yaml` functionality (#2551)
|
55
|
+
- Fix sine `Range#size` edge cases (#2541)
|
56
|
+
|
57
|
+
### Added
|
58
|
+
|
59
|
+
- SourceMap support for `Kernel#eval` (#2534)
|
60
|
+
- Add `CGI::Util#escapeURIComponent` and `CGI::Util#unescapeURIComponent` (#2566)
|
61
|
+
|
62
|
+
### Changed
|
63
|
+
|
64
|
+
- Change compilation of Regexp nodes that may contain advanced features, so if invalid that they would raise at runtime, not parse-time (#2548)
|
65
|
+
- `Hash` is now bridged to JavaScript `Map` and support for non-symbol keys in keyword arguments (#2568)
|
66
|
+
|
67
|
+
### Documentation
|
68
|
+
|
69
|
+
- Bridging documentation (#2541)
|
70
|
+
|
71
|
+
### Performance
|
72
|
+
|
73
|
+
- Improve performance of `Array#intersect?` and `#intersection` (#2533)
|
74
|
+
- `Proc#call`: Refactor for performance (#2541)
|
75
|
+
- Opal.stub_for: optimize (#2541)
|
76
|
+
- Hash: Optimize `#to_a` (#2541)
|
77
|
+
- Array: Optimize `#collect`/`#map` (#2541)
|
78
|
+
- Optimize argument slicing in runtime for performance (#2555)
|
79
|
+
- Closure: Generate a JavaScript object, not an Error, gain up to 15% on Asciidoctor (#2556)
|
80
|
+
- Optimize `String#split` and `String#start_with` (#2560)
|
81
|
+
|
82
|
+
### Internal
|
83
|
+
|
84
|
+
- Update rubocop (#2535)
|
85
|
+
- Match3Node Cleanup (#2541)
|
86
|
+
- IFlipFlop/EFlipFlop: Refactor for readability (#2541)
|
87
|
+
- ForRewriter: Refactor for readability (#2541)
|
@@ -0,0 +1,53 @@
|
|
1
|
+
%x{
|
2
|
+
// Minify common function calls
|
3
|
+
var $call = Function.prototype.call;
|
4
|
+
var $bind = Function.prototype.bind;
|
5
|
+
var $has_own = Object.hasOwn || $call.bind(Object.prototype.hasOwnProperty);
|
6
|
+
var $set_proto = Object.setPrototypeOf;
|
7
|
+
var $slice = $call.bind(Array.prototype.slice);
|
8
|
+
var $splice = $call.bind(Array.prototype.splice);
|
9
|
+
|
10
|
+
var cnt = 0;
|
11
|
+
var fun = function(a,b,c) {
|
12
|
+
cnt += a + b + c;
|
13
|
+
}
|
14
|
+
}
|
15
|
+
|
16
|
+
Benchmark.ips do |x|
|
17
|
+
ary = [1,2,3]
|
18
|
+
obj = `{0: 1, 1: 2, 2: 3, length: 3}`
|
19
|
+
|
20
|
+
x.report('Array.from(array)') do
|
21
|
+
`fun.apply(null, Array.from(ary))`
|
22
|
+
end
|
23
|
+
|
24
|
+
x.report('Array.from(obj)') do
|
25
|
+
`fun.apply(null, Array.from(obj))`
|
26
|
+
end
|
27
|
+
|
28
|
+
x.report('$slice(array)') do
|
29
|
+
`fun.apply(null, $slice(ary))`
|
30
|
+
end
|
31
|
+
|
32
|
+
x.report('$slice(obj)') do
|
33
|
+
`fun.apply(null, $slice(obj))`
|
34
|
+
end
|
35
|
+
|
36
|
+
x.report('array') do
|
37
|
+
`fun.apply(null, ary)`
|
38
|
+
end
|
39
|
+
|
40
|
+
x.report('obj') do
|
41
|
+
`fun.apply(null, obj)`
|
42
|
+
end
|
43
|
+
|
44
|
+
x.report('$slice?(array)') do
|
45
|
+
`fun.apply(null, ary.$$is_array ? ary : $slice(ary))`
|
46
|
+
end
|
47
|
+
|
48
|
+
x.report('$slice?(obj)') do
|
49
|
+
`fun.apply(null, obj.$$is_array ? obj : $slice(obj))`
|
50
|
+
end
|
51
|
+
|
52
|
+
x.compare!
|
53
|
+
end
|