opal 1.0.3 → 1.1.1.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.codeclimate.yml +13 -12
- data/.gitattributes +1 -1
- data/.github/FUNDING.yml +1 -0
- data/.github/workflows/build.yml +90 -0
- data/.jshintrc +1 -1
- data/.overcommit.yml +35 -0
- data/.rubocop.yml +44 -7
- data/{.rubocop_todo.yml → .rubocop/todo.yml} +4 -5
- data/CHANGELOG.md +152 -1
- data/Gemfile +2 -3
- data/HACKING.md +2 -9
- data/LICENSE +1 -1
- data/README.md +21 -18
- data/UNRELEASED.md +4 -2
- data/benchmark-ips/bm_array_pop_1.rb +8 -0
- data/benchmark-ips/bm_array_shift.rb +7 -0
- data/benchmark-ips/bm_js_symbols_vs_strings.rb +7 -2
- data/benchmark-ips/class_shovel_vs_singleton_class.rb +16 -0
- data/bin/build-browser-source-map-support +4 -0
- data/bin/format-filters +54 -0
- data/bin/git-submodule-fast-install +49 -0
- data/bin/remove-filters +39 -0
- data/bin/setup +4 -0
- data/bin/yarn +11 -0
- data/docs/releasing.md +18 -0
- data/docs/roda-sprockets.md +86 -0
- data/docs/sinatra.md +5 -12
- data/examples/rack/Gemfile +1 -0
- data/examples/rack/app/application.rb +3 -0
- data/examples/rack/config.ru +5 -4
- data/exe/opal-repl +2 -83
- data/lib/opal/ast/builder.rb +1 -1
- data/lib/opal/builder.rb +2 -10
- data/lib/opal/builder_processors.rb +1 -1
- data/lib/opal/cli.rb +4 -1
- data/lib/opal/cli_options.rb +11 -3
- data/lib/opal/cli_runners.rb +27 -37
- data/lib/opal/cli_runners/applescript.rb +5 -44
- data/lib/opal/cli_runners/chrome.js +7 -35
- data/lib/opal/cli_runners/chrome.rb +75 -17
- data/lib/opal/cli_runners/compiler.rb +17 -0
- data/lib/opal/cli_runners/nashorn.rb +9 -43
- data/lib/opal/cli_runners/nodejs.rb +18 -47
- data/lib/opal/cli_runners/server.rb +18 -6
- data/lib/opal/cli_runners/source-map-support-browser.js +6449 -0
- data/lib/opal/cli_runners/source-map-support-node.js +3704 -0
- data/lib/opal/cli_runners/source-map-support.js +639 -0
- data/lib/opal/cli_runners/system_runner.rb +45 -0
- data/lib/opal/compiler.rb +57 -29
- data/lib/opal/config.rb +0 -5
- data/lib/opal/erb.rb +1 -1
- data/lib/opal/magic_comments.rb +34 -0
- data/lib/opal/nodes/args/arity_check.rb +2 -1
- data/lib/opal/nodes/base.rb +1 -1
- data/lib/opal/nodes/call.rb +1 -4
- data/lib/opal/nodes/def.rb +2 -0
- data/lib/opal/nodes/iter.rb +1 -1
- data/lib/opal/nodes/literal.rb +19 -14
- data/lib/opal/nodes/logic.rb +5 -80
- data/lib/opal/nodes/masgn.rb +2 -0
- data/lib/opal/nodes/rescue.rb +1 -1
- data/lib/opal/nodes/super.rb +24 -10
- data/lib/opal/nodes/top.rb +5 -4
- data/lib/opal/parser/with_c_lexer.rb +2 -1
- data/lib/opal/parser/with_ruby_lexer.rb +1 -1
- data/lib/opal/path_reader.rb +2 -2
- data/lib/opal/paths.rb +8 -5
- data/lib/opal/repl.rb +103 -0
- data/lib/opal/rewriter.rb +4 -0
- data/lib/opal/rewriters/for_rewriter.rb +1 -1
- data/lib/opal/rewriters/js_reserved_words.rb +7 -7
- data/lib/opal/rewriters/numblocks.rb +31 -0
- data/lib/opal/rewriters/returnable_logic.rb +33 -0
- data/lib/opal/util.rb +11 -48
- data/lib/opal/version.rb +1 -1
- data/opal.gemspec +26 -26
- data/opal/corelib/array.rb +160 -118
- data/opal/corelib/array/pack.rb +5 -3
- data/opal/corelib/basic_object.rb +4 -4
- data/opal/corelib/class.rb +2 -1
- data/opal/corelib/comparable.rb +49 -31
- data/opal/corelib/constants.rb +5 -5
- data/opal/corelib/enumerable.rb +108 -46
- data/opal/corelib/enumerator.rb +27 -12
- data/opal/corelib/file.rb +3 -1
- data/opal/corelib/hash.rb +6 -1
- data/opal/corelib/helpers.rb +8 -28
- data/opal/corelib/io.rb +12 -7
- data/opal/corelib/kernel.rb +45 -14
- data/opal/corelib/kernel/format.rb +3 -1
- data/opal/corelib/math.rb +8 -6
- data/opal/corelib/method.rb +8 -0
- data/opal/corelib/module.rb +17 -2
- data/opal/corelib/number.rb +3 -12
- data/opal/corelib/proc.rb +16 -0
- data/opal/corelib/random/mersenne_twister.rb +147 -0
- data/opal/corelib/range.rb +3 -13
- data/opal/corelib/regexp.rb +10 -6
- data/opal/corelib/runtime.js +208 -81
- data/opal/corelib/string.rb +55 -49
- data/opal/corelib/string/encoding.rb +109 -32
- data/opal/corelib/string/unpack.rb +2 -17
- data/opal/corelib/struct.rb +14 -1
- data/opal/corelib/time.rb +4 -0
- data/opal/opal.rb +1 -1
- data/opal/opal/mini.rb +1 -1
- data/package.json +16 -0
- data/spec/README.md +10 -0
- data/spec/filters/bugs/array.rb +76 -0
- data/spec/filters/bugs/base64.rb +10 -0
- data/spec/filters/bugs/basicobject.rb +12 -0
- data/spec/filters/bugs/bigdecimal.rb +248 -0
- data/spec/filters/bugs/class.rb +12 -0
- data/spec/filters/bugs/complex.rb +7 -0
- data/spec/filters/bugs/date.rb +104 -0
- data/spec/filters/bugs/encoding.rb +259 -0
- data/spec/filters/bugs/enumerable.rb +26 -0
- data/spec/filters/bugs/enumerator.rb +48 -0
- data/spec/filters/bugs/exception.rb +120 -0
- data/spec/filters/bugs/file.rb +48 -0
- data/spec/filters/bugs/float.rb +74 -0
- data/spec/filters/bugs/hash.rb +60 -0
- data/spec/filters/bugs/integer.rb +78 -0
- data/spec/filters/bugs/io.rb +9 -0
- data/spec/filters/bugs/kernel.rb +401 -0
- data/spec/filters/bugs/language.rb +451 -0
- data/spec/filters/bugs/marshal.rb +50 -0
- data/spec/filters/bugs/math.rb +4 -0
- data/spec/filters/bugs/method.rb +79 -0
- data/spec/filters/bugs/module.rb +281 -0
- data/spec/filters/bugs/nilclass.rb +4 -0
- data/spec/filters/bugs/numeric.rb +27 -0
- data/spec/filters/bugs/openstruct.rb +8 -0
- data/spec/filters/bugs/pack_unpack.rb +138 -0
- data/spec/filters/bugs/pathname.rb +9 -0
- data/spec/filters/bugs/proc.rb +80 -0
- data/spec/filters/bugs/random.rb +20 -0
- data/spec/filters/bugs/range.rb +139 -0
- data/spec/filters/bugs/rational.rb +12 -0
- data/spec/filters/bugs/regexp.rb +91 -0
- data/spec/filters/bugs/set.rb +51 -0
- data/spec/filters/bugs/singleton.rb +7 -0
- data/spec/filters/bugs/string.rb +341 -0
- data/spec/filters/bugs/stringscanner.rb +78 -0
- data/spec/filters/bugs/struct.rb +26 -0
- data/spec/filters/bugs/symbol.rb +7 -0
- data/spec/filters/bugs/time.rb +109 -0
- data/spec/filters/bugs/unboundmethod.rb +33 -0
- data/spec/filters/bugs/warnings.rb +30 -0
- data/spec/filters/unsupported/array.rb +168 -0
- data/spec/filters/unsupported/basicobject.rb +15 -0
- data/spec/filters/unsupported/bignum.rb +55 -0
- data/spec/filters/unsupported/class.rb +5 -0
- data/spec/filters/unsupported/delegator.rb +6 -0
- data/spec/filters/unsupported/enumerable.rb +12 -0
- data/spec/filters/unsupported/enumerator.rb +14 -0
- data/spec/filters/unsupported/file.rb +4 -0
- data/spec/filters/unsupported/fixnum.rb +15 -0
- data/spec/filters/unsupported/float.rb +47 -0
- data/spec/filters/unsupported/freeze.rb +259 -0
- data/spec/filters/unsupported/hash.rb +44 -0
- data/spec/filters/unsupported/integer.rb +101 -0
- data/spec/filters/unsupported/kernel.rb +35 -0
- data/spec/filters/unsupported/language.rb +25 -0
- data/spec/filters/unsupported/marshal.rb +44 -0
- data/spec/filters/unsupported/matchdata.rb +63 -0
- data/spec/filters/unsupported/math.rb +4 -0
- data/spec/filters/unsupported/pathname.rb +4 -0
- data/spec/filters/unsupported/privacy.rb +287 -0
- data/spec/filters/unsupported/proc.rb +4 -0
- data/spec/filters/unsupported/random.rb +5 -0
- data/spec/filters/unsupported/range.rb +8 -0
- data/spec/filters/unsupported/regexp.rb +70 -0
- data/spec/filters/unsupported/set.rb +5 -0
- data/spec/filters/unsupported/singleton.rb +7 -0
- data/spec/filters/unsupported/string.rb +687 -0
- data/spec/filters/unsupported/struct.rb +7 -0
- data/spec/filters/unsupported/symbol.rb +21 -0
- data/spec/filters/unsupported/taint.rb +162 -0
- data/spec/filters/unsupported/thread.rb +10 -0
- data/spec/filters/unsupported/time.rb +204 -0
- data/spec/filters/unsupported/usage_of_files.rb +262 -0
- data/spec/lib/builder_processors_spec.rb +44 -0
- data/spec/lib/builder_spec.rb +133 -0
- data/spec/lib/cli_runners/server_spec.rb +25 -0
- data/spec/lib/cli_runners_spec.rb +16 -0
- data/spec/lib/cli_spec.rb +256 -0
- data/spec/lib/compiler_spec.rb +693 -0
- data/spec/lib/config_spec.rb +112 -0
- data/spec/lib/dependency_resolver_spec.rb +43 -0
- data/spec/lib/deprecations_spec.rb +17 -0
- data/spec/lib/fixtures/complex_sprockets.js.rb.erb +4 -0
- data/spec/lib/fixtures/file_with_directives.js +2 -0
- data/spec/lib/fixtures/jst_file.js.jst +1 -0
- data/spec/lib/fixtures/no_requires.rb +1 -0
- data/spec/lib/fixtures/opal_file.rb +2 -0
- data/spec/lib/fixtures/require_tree_test.rb +3 -0
- data/spec/lib/fixtures/required_file.js +1 -0
- data/spec/lib/fixtures/required_tree_test/required_file1.rb +1 -0
- data/spec/lib/fixtures/required_tree_test/required_file2.rb +1 -0
- data/spec/lib/fixtures/requires.rb +7 -0
- data/spec/lib/fixtures/source_location_test.rb +7 -0
- data/spec/lib/fixtures/source_map.rb +1 -0
- data/spec/lib/fixtures/source_map/subfolder/other_file.rb +1 -0
- data/spec/lib/fixtures/sprockets_file.js.rb +3 -0
- data/spec/lib/fixtures/sprockets_require_tree_test.rb +3 -0
- data/spec/lib/path_reader_spec.rb +47 -0
- data/spec/lib/paths_spec.rb +18 -0
- data/spec/lib/repl_spec.rb +28 -0
- data/spec/lib/rewriters/base_spec.rb +68 -0
- data/spec/lib/rewriters/binary_operator_assignment_spec.rb +153 -0
- data/spec/lib/rewriters/block_to_iter_spec.rb +28 -0
- data/spec/lib/rewriters/dot_js_syntax_spec.rb +108 -0
- data/spec/lib/rewriters/explicit_writer_return_spec.rb +186 -0
- data/spec/lib/rewriters/for_rewriter_spec.rb +92 -0
- data/spec/lib/rewriters/hashes/key_duplicates_rewriter_spec.rb +47 -0
- data/spec/lib/rewriters/js_reserved_words_spec.rb +119 -0
- data/spec/lib/rewriters/logical_operator_assignment_spec.rb +202 -0
- data/spec/lib/rewriters/opal_engine_check_spec.rb +84 -0
- data/spec/lib/rewriters/returnable_logic_spec.rb +52 -0
- data/spec/lib/rewriters/rubyspec/filters_rewriter_spec.rb +59 -0
- data/spec/lib/simple_server_spec.rb +56 -0
- data/spec/lib/source_map/file_spec.rb +67 -0
- data/spec/lib/source_map/index_spec.rb +80 -0
- data/spec/lib/spec_helper.rb +105 -0
- data/spec/mspec-opal/formatters.rb +197 -0
- data/spec/mspec-opal/runner.rb +172 -0
- data/spec/opal/compiler/irb_spec.rb +44 -0
- data/spec/opal/compiler/unicode_spec.rb +10 -0
- data/spec/opal/core/array/dup_spec.rb +23 -0
- data/spec/opal/core/array/intersection_spec.rb +38 -0
- data/spec/opal/core/array/minus_spec.rb +38 -0
- data/spec/opal/core/array/union_spec.rb +38 -0
- data/spec/opal/core/array/uniq_spec.rb +49 -0
- data/spec/opal/core/class/inherited_spec.rb +18 -0
- data/spec/opal/core/enumerable/all_break_spec.rb +5 -0
- data/spec/opal/core/enumerable/any_break_spec.rb +5 -0
- data/spec/opal/core/enumerable/collect_break_spec.rb +13 -0
- data/spec/opal/core/enumerable/count_break_spec.rb +5 -0
- data/spec/opal/core/enumerable/detect_break_spec.rb +5 -0
- data/spec/opal/core/enumerable/drop_while_break_spec.rb +5 -0
- data/spec/opal/core/enumerable/each_slice_break_spec.rb +6 -0
- data/spec/opal/core/enumerable/each_with_index_break_spec.rb +5 -0
- data/spec/opal/core/enumerable/each_with_object_break_spec.rb +5 -0
- data/spec/opal/core/enumerable/find_all_break_spec.rb +5 -0
- data/spec/opal/core/enumerable/find_index_break_spec.rb +5 -0
- data/spec/opal/core/enumerable/grep_break_spec.rb +5 -0
- data/spec/opal/core/enumerable/max_break_spec.rb +5 -0
- data/spec/opal/core/enumerable/max_by_break_spec.rb +5 -0
- data/spec/opal/core/enumerable/min_break_spec.rb +5 -0
- data/spec/opal/core/enumerable/min_by_break_spec.rb +5 -0
- data/spec/opal/core/enumerable/none_break_spec.rb +5 -0
- data/spec/opal/core/enumerable/one_break_spec.rb +5 -0
- data/spec/opal/core/enumerable/reduce_break_spec.rb +5 -0
- data/spec/opal/core/enumerable/take_while_break_spec.rb +5 -0
- data/spec/opal/core/enumerator/with_index_spec.rb +6 -0
- data/spec/opal/core/exception_spec.rb +8 -0
- data/spec/opal/core/fixtures/require_tree_files/file 1.rb +1 -0
- data/spec/opal/core/fixtures/require_tree_files/file 2.rb +1 -0
- data/spec/opal/core/fixtures/require_tree_files/file 3.rb +1 -0
- data/spec/opal/core/fixtures/require_tree_files/file 4.rb +1 -0
- data/spec/opal/core/fixtures/require_tree_files/file 5.rb +1 -0
- data/spec/opal/core/fixtures/require_tree_files/nested/nested 1.rb +1 -0
- data/spec/opal/core/fixtures/require_tree_files/nested/nested 2.rb +1 -0
- data/spec/opal/core/fixtures/require_tree_files/other/other 1.rb +1 -0
- data/spec/opal/core/fixtures/require_tree_with_dot/file 1.rb +1 -0
- data/spec/opal/core/fixtures/require_tree_with_dot/file 2.rb +1 -0
- data/spec/opal/core/fixtures/require_tree_with_dot/file 3.rb +1 -0
- data/spec/opal/core/fixtures/require_tree_with_dot/index.rb +3 -0
- data/spec/opal/core/hash/internals_spec.rb +339 -0
- data/spec/opal/core/helpers_spec.rb +14 -0
- data/spec/opal/core/iterable_props_spec.rb +53 -0
- data/spec/opal/core/kernel/at_exit_spec.rb +70 -0
- data/spec/opal/core/kernel/freeze_spec.rb +15 -0
- data/spec/opal/core/kernel/instance_variables_spec.rb +110 -0
- data/spec/opal/core/kernel/methods_spec.rb +25 -0
- data/spec/opal/core/kernel/public_methods_spec.rb +25 -0
- data/spec/opal/core/kernel/require_tree_spec.rb +18 -0
- data/spec/opal/core/kernel/respond_to_spec.rb +15 -0
- data/spec/opal/core/language/DATA/characters_support_spec.rb +9 -0
- data/spec/opal/core/language/DATA/empty___END___spec.rb +7 -0
- data/spec/opal/core/language/DATA/multiple___END___spec.rb +10 -0
- data/spec/opal/core/language/arguments/mlhs_arg_spec.rb +18 -0
- data/spec/opal/core/language/keyword_arguments_spec.rb +9 -0
- data/spec/opal/core/language/numblocks_spec.rb +16 -0
- data/spec/opal/core/language/safe_navigator_spec.rb +7 -0
- data/spec/opal/core/language/while_spec.rb +31 -0
- data/spec/opal/core/language_spec.rb +29 -0
- data/spec/opal/core/marshal/dump_spec.rb +81 -0
- data/spec/opal/core/marshal/load_spec.rb +13 -0
- data/spec/opal/core/module_spec.rb +27 -0
- data/spec/opal/core/object_id_spec.rb +56 -0
- data/spec/opal/core/regexp/interpolation_spec.rb +40 -0
- data/spec/opal/core/regexp/match_spec.rb +78 -0
- data/spec/opal/core/runtime/bridged_classes_spec.rb +123 -0
- data/spec/opal/core/runtime/constants_spec.rb +16 -0
- data/spec/opal/core/runtime/eval_spec.rb +5 -0
- data/spec/opal/core/runtime/exit_spec.rb +29 -0
- data/spec/opal/core/runtime/is_a_spec.rb +48 -0
- data/spec/opal/core/runtime/loaded_spec.rb +20 -0
- data/spec/opal/core/runtime/main_methods_spec.rb +39 -0
- data/spec/opal/core/runtime/method_missing_spec.rb +68 -0
- data/spec/opal/core/runtime/rescue_spec.rb +37 -0
- data/spec/opal/core/runtime/string_spec.rb +25 -0
- data/spec/opal/core/runtime/truthy_spec.rb +61 -0
- data/spec/opal/core/runtime_spec.rb +58 -0
- data/spec/opal/core/string/each_byte_spec.rb +19 -0
- data/spec/opal/core/string/gsub_spec.rb +35 -0
- data/spec/opal/core/string/to_sym_spec.rb +9 -0
- data/spec/opal/core/string_spec.rb +28 -0
- data/spec/opal/core/struct/dup_spec.rb +11 -0
- data/spec/opal/core/time_spec.rb +68 -0
- data/spec/opal/stdlib/erb/erb_spec.rb +30 -0
- data/spec/opal/stdlib/erb/inline_block.opalerb +3 -0
- data/spec/opal/stdlib/erb/quoted.opalerb +1 -0
- data/spec/opal/stdlib/erb/simple.opalerb +1 -0
- data/spec/opal/stdlib/js_spec.rb +72 -0
- data/spec/opal/stdlib/json/ext_spec.rb +55 -0
- data/spec/opal/stdlib/json/parse_spec.rb +37 -0
- data/spec/opal/stdlib/logger/logger_spec.rb +308 -0
- data/spec/opal/stdlib/native/alias_native_spec.rb +27 -0
- data/spec/opal/stdlib/native/array_spec.rb +11 -0
- data/spec/opal/stdlib/native/date_spec.rb +12 -0
- data/spec/opal/stdlib/native/deprecated_include_spec.rb +8 -0
- data/spec/opal/stdlib/native/each_spec.rb +13 -0
- data/spec/opal/stdlib/native/element_reference_spec.rb +16 -0
- data/spec/opal/stdlib/native/exposure_spec.rb +33 -0
- data/spec/opal/stdlib/native/ext_spec.rb +19 -0
- data/spec/opal/stdlib/native/hash_spec.rb +67 -0
- data/spec/opal/stdlib/native/initialize_spec.rb +17 -0
- data/spec/opal/stdlib/native/method_missing_spec.rb +51 -0
- data/spec/opal/stdlib/native/native_alias_spec.rb +26 -0
- data/spec/opal/stdlib/native/native_class_spec.rb +18 -0
- data/spec/opal/stdlib/native/native_module_spec.rb +13 -0
- data/spec/opal/stdlib/native/native_reader_spec.rb +22 -0
- data/spec/opal/stdlib/native/native_writer_spec.rb +30 -0
- data/spec/opal/stdlib/native/new_spec.rb +92 -0
- data/spec/opal/stdlib/native/struct_spec.rb +12 -0
- data/spec/opal/stdlib/pp_spec.rb +5 -0
- data/spec/opal/stdlib/promise/always_spec.rb +49 -0
- data/spec/opal/stdlib/promise/error_spec.rb +15 -0
- data/spec/opal/stdlib/promise/rescue_spec.rb +53 -0
- data/spec/opal/stdlib/promise/then_spec.rb +79 -0
- data/spec/opal/stdlib/promise/trace_spec.rb +51 -0
- data/spec/opal/stdlib/promise/value_spec.rb +15 -0
- data/spec/opal/stdlib/promise/when_spec.rb +34 -0
- data/spec/opal/stdlib/source_map_spec.rb +8 -0
- data/spec/opal/stdlib/strscan/scan_spec.rb +11 -0
- data/spec/opal/stdlib/template/paths_spec.rb +10 -0
- data/spec/opal/stdlib/thread/mutex_spec.rb +40 -0
- data/spec/opal/stdlib/thread/thread_queue_spec.rb +32 -0
- data/spec/opal/stdlib/thread/thread_spec.rb +60 -0
- data/spec/ruby_specs +183 -0
- data/spec/spec_helper.rb +31 -0
- data/spec/support/guard_platform.rb +4 -0
- data/spec/support/match_helpers.rb +57 -0
- data/spec/support/mspec_rspec_adapter.rb +33 -0
- data/spec/support/rewriters_helper.rb +54 -0
- data/spec/support/source_map_helper.rb +190 -0
- data/stdlib/base64.rb +2 -2
- data/stdlib/bigdecimal.rb +15 -3
- data/stdlib/bigdecimal/bignumber.js.rb +1 -1
- data/stdlib/bigdecimal/util.rb +148 -0
- data/stdlib/delegate.rb +8 -0
- data/stdlib/nodejs/fileutils.rb +1 -1
- data/stdlib/nodejs/kernel.rb +0 -13
- data/stdlib/nodejs/stacktrace.rb +4 -179
- data/stdlib/ostruct.rb +5 -0
- data/stdlib/pp.rb +586 -19
- data/stdlib/prettyprint.rb +556 -0
- data/stdlib/rbconfig/sizeof.rb +2 -0
- data/stdlib/securerandom.rb +32 -0
- data/stdlib/set.rb +36 -0
- data/stdlib/strscan.rb +15 -0
- data/tasks/benchmarking.rake +1 -1
- data/tasks/linting.rake +3 -5
- data/tasks/releasing.rake +2 -5
- data/tasks/testing.rake +16 -11
- data/tasks/testing/mspec_special_calls.rb +1 -19
- data/test/nodejs/fixtures/cat.png +0 -0
- data/test/nodejs/fixtures/hello.rb +1 -0
- data/test/nodejs/fixtures/iso88591.txt +1 -0
- data/test/nodejs/fixtures/utf8.txt +1 -0
- data/test/nodejs/fixtures/win1258.txt +1 -0
- data/test/nodejs/test_dir.rb +39 -0
- data/test/nodejs/test_env.rb +62 -0
- data/test/nodejs/test_error.rb +29 -0
- data/test/nodejs/test_file.rb +206 -0
- data/test/nodejs/test_file_encoding.rb +20 -0
- data/test/nodejs/test_io.rb +18 -0
- data/test/nodejs/test_opal_builder.rb +12 -0
- data/test/nodejs/test_pathname.rb +16 -0
- data/test/opal/cat.png +0 -0
- data/test/opal/http_server.rb +52 -0
- data/test/opal/test_base64.rb +115 -0
- data/test/opal/test_keyword.rb +590 -0
- data/test/opal/test_matrix.rb +661 -0
- data/test/opal/test_openuri.rb +53 -0
- data/test/opal/unsupported_and_bugs.rb +39 -0
- data/yarn.lock +1355 -0
- metadata +905 -40
- data/.travis.yml +0 -109
- data/appveyor.yml +0 -35
- data/lib/opal/nodes/runtime_helpers.rb +0 -51
- data/opal/corelib/random/MersenneTwister.js +0 -137
- data/opal/corelib/random/mersenne_twister.js.rb +0 -13
- data/stdlib/bigdecimal/kernel.rb +0 -5
data/Gemfile
CHANGED
@@ -11,7 +11,6 @@ sprockets_version = ENV['SPROCKETS_VERSION']
|
|
11
11
|
|
12
12
|
gem 'json', '< 1.8.1', platform: :ruby if ruby_version < v['2.2']
|
13
13
|
gem 'rack-test', '< 0.8' if ruby_version <= v['2.0']
|
14
|
-
gem 'rubysl', platform: :rbx
|
15
14
|
gem 'coveralls', platform: :mri
|
16
15
|
|
17
16
|
# Some browsers have problems with WEBrick
|
@@ -48,8 +47,8 @@ end unless ENV['CI']
|
|
48
47
|
|
49
48
|
group :doc do
|
50
49
|
gem 'redcarpet' unless RUBY_ENGINE == 'truffleruby'
|
51
|
-
end
|
50
|
+
end unless ENV['CI']
|
52
51
|
|
53
52
|
platforms :ruby, :mswin, :mswin64, :mingw, :x64_mingw do
|
54
|
-
gem 'c_lexer', '~> 2.6' unless RUBY_ENGINE == 'truffleruby'
|
53
|
+
#gem 'c_lexer', '~> 2.6' unless RUBY_ENGINE == 'truffleruby'
|
55
54
|
end
|
data/HACKING.md
CHANGED
@@ -8,17 +8,10 @@
|
|
8
8
|
$ git clone git://github.com/<YOUR-GITHUB-USERNAME>/opal.git
|
9
9
|
```
|
10
10
|
|
11
|
-
|
11
|
+
Setup the project:
|
12
12
|
|
13
13
|
```
|
14
|
-
$
|
15
|
-
```
|
16
|
-
|
17
|
-
Get dependencies:
|
18
|
-
|
19
|
-
```
|
20
|
-
$ bundle install
|
21
|
-
$ npm install -g jshint
|
14
|
+
$ bin/setup
|
22
15
|
```
|
23
16
|
|
24
17
|
Run the test suite:
|
data/LICENSE
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
Copyright (C) 2013-
|
1
|
+
Copyright (C) 2013-2021 by Adam Beynon and the Opal contributors
|
2
2
|
|
3
3
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
4
|
of this software and associated documentation files (the "Software"), to deal
|
data/README.md
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
<h1 align="center">
|
2
|
-
<img src="https://secure.gravatar.com/avatar/88298620949a6534d403da2e356c9339?s=420"
|
2
|
+
<img src="https://secure.gravatar.com/avatar/88298620949a6534d403da2e356c9339?s=420"
|
3
3
|
align="center" title="Opal logo by Elia Schito" width="105" height="105" />
|
4
4
|
<br/>
|
5
5
|
Opal <br/>
|
@@ -7,24 +7,28 @@
|
|
7
7
|
</h1>
|
8
8
|
|
9
9
|
<p align="center">
|
10
|
-
<em><strong>Opal</strong> is a Ruby to JavaScript source-to-source compiler.<br>
|
10
|
+
<em><strong>Opal</strong> is a Ruby to JavaScript source-to-source compiler.<br>
|
11
11
|
It also has an implementation of the Ruby <code>corelib</code> and <code>stdlib</code>.</em>
|
12
12
|
</p>
|
13
13
|
|
14
14
|
<p align="center">
|
15
15
|
<strong>Community:</strong><br>
|
16
16
|
<a href="https://stackoverflow.com/questions/ask?tags=opalrb"><img src="https://img.shields.io/badge/stackoverflow-%23opalrb-orange.svg?style=flat" alt="Stack Overflow" title="" /></a>
|
17
|
-
<a href="#backers"><img src="https://opencollective.com/opal/backers/badge.svg" alt="Backers on Open Collective" title="" /></a>
|
18
|
-
<a href="#sponsors"><img src="https://opencollective.com/opal/sponsors/badge.svg" alt="Sponsors on Open Collective" title="" /></a>
|
17
|
+
<a href="#backers"><img src="https://opencollective.com/opal/backers/badge.svg" alt="Backers on Open Collective" title="" /></a>
|
18
|
+
<a href="#sponsors"><img src="https://opencollective.com/opal/sponsors/badge.svg" alt="Sponsors on Open Collective" title="" /></a>
|
19
19
|
<a href="https://gitter.im/opal/opal?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge"><img src="https://badges.gitter.im/Join%20Chat.svg" alt="Gitter" title="" /></a>
|
20
20
|
<a href="https://opalrb.com/docs"><img src="https://img.shields.io/badge/docs-updated-blue.svg" alt="Documentation" title="" /></a>
|
21
|
+
|
21
22
|
<br>
|
22
23
|
<strong>Code:</strong><br>
|
23
24
|
<a href="https://badge.fury.io/rb/opal"><img src="https://img.shields.io/gem/v/opal.svg?style=flat" alt="Gem Version" title="" /></a>
|
24
|
-
<a href="https://
|
25
|
-
<a href="https://ci.appveyor.com/project/elia/opal/branch/master"><img src="https://ci.appveyor.com/api/projects/status/jtsvwl8tfgn3u67n/branch/master?svg=true" alt="Build Status (Windows)" title="" /></a>
|
25
|
+
<a href="https://github.com/opal/opal/actions?query=workflow%3Abuild"><img alt="Build Status" src="https://github.com/opal/opal/workflows/build/badge.svg" /></a>
|
26
26
|
<a href="https://codeclimate.com/github/opal/opal"><img src="https://img.shields.io/codeclimate/maintainability-percentage/opal/opal.svg" alt="Code Climate" title="" /></a>
|
27
|
-
<a href="https://coveralls.io/github/opal/opal?branch=
|
27
|
+
<a href="https://coveralls.io/github/opal/opal?branch=master"><img src="https://coveralls.io/repos/opal/opal/badge.svg?branch=master&service=github" alt="Coverage Status" title="" /></a>
|
28
|
+
|
29
|
+
<br>
|
30
|
+
<strong>Sponsors:</strong>
|
31
|
+
<br/><a href="https://nebulab.it?utm_source=github&utm_medium=badge"><img src="https://img.shields.io/static/v1?label=Nebulab&message=Open+Source+Fridays&color=%235dbefd&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAYAAAByDd+UAAAACXBIWXMAABYlAAAWJQFJUiTwAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAMQSURBVHgBrZZNTxNRFIbfczsgIMQiLBCRFDaGhUr9A9iiIa5EEneIwE/AlRsNv8KlIKwFl35RTUBX8rFBdiVKAgqmXSCY0M71nJl+zJTOdKh9k6Yzc8/cZ86555x7CQE0mji5hSyGlQoNaOgIPwrnhtIArWszu4EQFudjdR8rzUV+gw8/ZMZB9IwvIwimJJGafhmjWZwFOJ7QkYzWCwTdj+qUDJGKz8Rou3RAlT4YS+hHWW2u/QdM1MNzrI6+zwyXDrg8FANStIDaSXOIJ5whLgAljOIZiglRK6U4vDfz4S2ElGGJWsEaQkCTUbhtNbV+lb+xgFY2Bs9ET0h/GzBxlfAkqnCUKY5xKfVLbsi1/R126lcF6WgCYp2ES42EBp6tvQFY+alLTUlrUxizJEVNWiVwBkVagGg7oe+CDclLYOfrgMdfTBz8PfWa1lkzbsDEsH/5FyF9YUK0zQ1xwpoZtsm9pwxMRLyA9wyi0A2Jcjl1NNqeeEFEimxYPkmWd014ikIDnDTeBb53DOweaRxnvWGyhnmYfPZWGt487sNi6lsK67/lZ1oZGOtUaD3nhtU7etXXfe0VzrzCBgLKCR68rNDX6oaJlvd0xXnklbSfgSTL/QghXF8EP980cVKyVL/Ys9UDVFJa8Tdt+1lYmcmJM3Vd4UEvWeslRf32h9ubrVRl77gBrCto85OfUU+LXTMGx+JuN2Hoin3/Zkfjj6ObBAknV+KG4jpc9BqXMEpiCMz6Z9ZQ12kvJZxb6co4Zr1W83esY8F2OYsIe+eEyfTiVXczCl7uM2wliHfMEJaRc3Wa++mLUotrF4EW7h6f94Dvh6aVFM60Fy8Xkya+BfBOjh5yUWhqY0vmKi9q1GnVxZ7sHKIWSs7FQ71yUagkRTTCfymnVY1gsgHHC5z8hbUjaz0Fr8ZanXhX0pPOw5SrV8wNGjNscMrTKpXKaj05f9twVYHnMZGPHEuwTwEBNi+3NGiNt6GRcsfEIAfhp2cAV3cQLtXoOz7q8+ZJRLx3kmxn4dy7aas1SrfiBpKraV/9A+PSJLDAXLUvAAAAAElFTkSuQmCC"></a>
|
28
32
|
</p>
|
29
33
|
|
30
34
|
## Usage
|
@@ -133,14 +137,9 @@ on opal.
|
|
133
137
|
|
134
138
|
## Running tests
|
135
139
|
|
136
|
-
|
137
|
-
|
138
|
-
$ git submodule update --init
|
140
|
+
Setup the project:
|
139
141
|
|
140
|
-
|
141
|
-
|
142
|
-
$ bundle install
|
143
|
-
$ npm install -g jshint
|
142
|
+
$ bin/setup
|
144
143
|
|
145
144
|
The test suite can be run using:
|
146
145
|
|
@@ -197,7 +196,7 @@ Holds the **stdlib currently supported by Opal**. This includes `Observable`,
|
|
197
196
|
|
198
197
|
## Browser support
|
199
198
|
|
200
|
-
* Internet Explorer
|
199
|
+
* Internet Explorer 11
|
201
200
|
* Firefox (Current - 1) or Current
|
202
201
|
* Chrome (Current - 1) or Current
|
203
202
|
* Safari (Current - 1) or Current
|
@@ -213,8 +212,6 @@ version of a browser is 24.x, we support the 24.x and 23.x versions.
|
|
213
212
|
as the last 2 versions of Opera. For example, if the current Opera version is 20.x,
|
214
213
|
then we support Opera 12.1x, 19.x and 20.x but not Opera 15.x through 18.x.
|
215
214
|
|
216
|
-
Cross-browser testing is sponsored by [SauceLabs](https://saucelabs.com).
|
217
|
-
|
218
215
|
## Contributors
|
219
216
|
|
220
217
|
This project exists thanks to all the people who contribute. [![contributors](https://opencollective.com/opal/contributors.svg?width=890&button=false")](https://github.com/opal/opal/graphs/contributors)
|
@@ -229,6 +226,8 @@ Thank you to all our backers! 🙏 [[Become a backer](https://opencollective.com
|
|
229
226
|
|
230
227
|
## Sponsors
|
231
228
|
|
229
|
+
### Donations
|
230
|
+
|
232
231
|
Support this project by becoming a sponsor. Your logo will show up here with a link to your website. [[Become a sponsor](https://opencollective.com/opal#sponsor)]
|
233
232
|
|
234
233
|
<a href="https://opencollective.com/opal/sponsor/0/website" target="_blank"><img src="https://opencollective.com/opal/sponsor/0/avatar.svg"></a>
|
@@ -242,12 +241,16 @@ Support this project by becoming a sponsor. Your logo will show up here with a l
|
|
242
241
|
<a href="https://opencollective.com/opal/sponsor/8/website" target="_blank"><img src="https://opencollective.com/opal/sponsor/8/avatar.svg"></a>
|
243
242
|
<a href="https://opencollective.com/opal/sponsor/9/website" target="_blank"><img src="https://opencollective.com/opal/sponsor/9/avatar.svg"></a>
|
244
243
|
|
244
|
+
### Sponsored Contributions
|
245
|
+
|
246
|
+
<a href="https://nebulab.it/?utm_source=github&utm_medium=sponsors" target="_blank"><img src="https://nebulab.it/assets/images/logo-586625a4.svg"></a>
|
247
|
+
|
245
248
|
|
246
249
|
## License
|
247
250
|
|
248
251
|
(The MIT License)
|
249
252
|
|
250
|
-
Copyright (C) 2013-
|
253
|
+
Copyright (C) 2013-2021 by Adam Beynon and the Opal contributors
|
251
254
|
|
252
255
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
253
256
|
of this software and associated documentation files (the "Software"), to deal
|
data/UNRELEASED.md
CHANGED
@@ -0,0 +1,8 @@
|
|
1
|
+
Benchmark.ips do |x|
|
2
|
+
x.report('pop(1)') do
|
3
|
+
a = ['4768', '4964', '4266', '4872', '4231', '4017', '4565', '4793', '4298', '4135', '4639', '4780', '4237', '4548', '4655', '4153', '4654', '4922', '4563', '4042', '4329', '4699', '4352', '4127', '4544', '4906', '4814', '4948', '4977', '4830', '4405', '4642', '4666', '4402', '4679', '4465', '4401', '4155', '4767', '4510', '4747', '4993', '4508', '4697', '4758', '4133', '4348', '4200', '4442', '4970', '4452', '4041', '4103', '4567', '4937', '4047', '4933', '4121', '4860', '4659', '4221', '4312', '4583', '4473', '4973', '4262', '4630', '4123', '4139', '4289', '4147', '4222', '4050', '4019', '4454', '4253', '4552', '4947', '4725', '4457', '4929', '4021', '4502', '4307', '4576', '4124', '4586', '4610', '4027', '4572', '4926', '4753', '4185', '4382', '4394', '4923', '4186', '4254', '4012', '4417', '4556', '4349', '4550', '4330', '4938', '4985', '4778', '4716', '4924', '4045', '4358', '4189', '4591', '4213', '4851', '4825', '4260', '4198', '4342', '4824', '4333', '4244', '4752', '4994', '4488', '4532', '4082', '4595', '4098', '4436', '4540', '4267', '4407', '4998', '4751', '4535', '4861', '4819', '4419', '4031', '4029', '4453', '4698', '4965', '4450', '4668', '4036', '4300', '4519', '4281', '4981', '4818', '4939', '4378', '4140', '4841', '4249', '4290', '4388', '4878', '4884', '4235', '4515', '4638', '4410', '4054', '4383', '4238', '4870', '4295', '4804', '4308', '4614', '4105', '4053', '4446', '4757', '4971', '4637', '4831', '4193', '4912', '4000', '4187', '4606', '4566', '4169', '4641', '4749', '4729', '4928', '4601', '4949', '4210', '4313', '4647', '4495', '4460', '4621', '4605', '4694', '4317', '4226', '4263', '4016', '4997', '4940', '4715', '4907', '4620', '4934', '4996', '4955', '4688', '4304', '4220', '4882', '4772', '4536', '4815', '4693', '4469', '4276', '4409', '4071', '4224', '4020', '4629', '4865', '4813', '4366', '4622', '4129', '4533', '4634', '4564', '4087', '4386', '4161', '4265', '4711', '4009', '4376', '4781', '4837', '4112', '4915', '4592', '4658', '4025', '4987', '4291', '4477', '4503', '4437', '4111', '4707', '4879', '4611', '4549', '4078', '4044', '4853', '4835', '4463', '4577', '4008', '4233', '4741', '4384', '4225', '4024', '4726', '4743', '4160', '4180', '4722', '4609', '4114', '4834', '4742', '4662', '4984', '4299', '4060', '4498', '4755', '4320', '4874', '4528', '4216', '4852', '4951', '4958', '4283', '4239', '4476', '4644', '4143', '4104', '4455', '4126', '4950', '4663', '4013', '4931', '4850', '4242', '4130', '4623', '4871', '4014', '4854', '4293', '4512', '4166', '4740', '4735', '4150', '4651', '4172', '4836', '4530', '4664', '4429', '4511', '4558', '4676', '4085', '4074', '4580', '4794', '4379', '4310', '4817', '4966', '4848', '4202', '4336', '4608', '4351', '4396', '4652', '4033', '4188', '4431', '4916', '4259', '4607', '4816', '4810', '4627', '4527', '4560', '4728', '4589', '4274', '4809', '4790', '4398', '4414', '4516', '4581', '4919', '4665', '4331', '4978', '4543', '4877', '4974', '4284', '4004', '4177', '4466', '4116', '4217', '4901', '4372', '4137', '4806', '4264', '4497', '4294', '4787', '4212', '4215', '4115', '4782', '4739', '4821', '4125', '4505', '4230', '4399', '4395', '4079', '4867', '4381', '4706', '4695', '4404', '4691', '4075', '4353', '4301', '4876', '4731', '4523', '4246', '4529', '4412', '4784', '4449', '4229', '4616', '4158', '4002', '4318', '4377', '4205', '4911', '4777', '4792', '4271', '4763', '4141', '4287', '4890', '4279', '4829', '4646', '4840', '4089', '4880', '4067', '4918', '4059', '4109', '4164', '4863', '4883', '4909', '4361', '4174', '4960', '4302', '4003', '4236', '4846', '4034', '4324', '4513', '4765', '4596', '4900', '4007', '4603', '4474', '4439', '4805', '4015', '4496', '4953', '4363', '4551', '4459', '4063', '4983', '4881', '4365', '4604', '4587', '4798', '4005', '4163', '4421', '4471', '4826', '4144', '4635', '4600', '4913', '4640', '4247', '4766', '4779', '4280', '4391', '4891', '4636', '4546', '4683', '4181', '4081', '4862', '4458', '4037', '4321', '4786', '4717', '4628', '4154', '4326', '4032', '4873', '4151', '4905', '4270', '4156', '4733', '4980', '4866', '4325', '4055', '4467', '4480', '4286', '4191', '4762', '4322', '4574', '4022', '4056', '4770', '4451', '4448', '4845', '4341', '4433', '4245', '4684', '4671', '4093', '4920', '4272', '4745', '4799', '4761', '4250', '4578', '4347', '4499', '4526', '4369', '4162', '4537', '4434', '4893', '4120', '4962', '4667', '4525', '4091', '4462', '4182', '4738', '4935', '4173', '4490', '4571', '4424', '4894', '4051', '4214', '4823', '4096', '4206', '4598', '4943', '4701', '4649', '4807', '4107', '4435', '4456', '4083', '4612', '4721', '4472', '4146', '4925', '4340', '4789', '4277', '4375', '4211', '4427', '4547', '4690', '4613', '4727', '4006', '4203', '4430', '4223', '4039', '4932', '4296', '4108', '4278', '4832', '4422', '4917', '4470', '4183', '4887', '4076', '4485', '4597', '4443', '4257', '4991', '4944', '4196', '4672', '4397', '4097', '4119', '4077', '4773', '4602', '4538', '4479', '4968', '4159', '4539', '4956', '4710', '4812', '4902', '4569', '4954', '4385', '4128', '4936', '4416', '4148', '4632', '4759', '4117', '4896', '4392', '4864', '4316', '4132', '4319', '4969', '4175', '4484', '4903', '4910', '4350', '4332', '4952', '4176', '4594', '4709', '4509', '4178', '4167', '4545', '4857', '4617', '4501', '4859', '4207', '4275', '4687', '4049', '4579', '4046', '4921', '4113', '4898', '4681', '4052', '4415', '4064', '4184', '4895', '4744', '4685', '4084', '4305', '4899', '4559', '4208', '4057', '4507', '4258', '4355', '4086', '4373', '4323', '4541', '4297', '4483', '4889', '4531', '4327', '4441', '4914', '4303', '4677', '4445', '4802', '4343', '4585', '4338', '4524', '4590', '4624', '4288', '4704', '4134', '4043', '4720', '4058', '4328', '4095', '4026', '4423', '4657', '4118', '4633', '4487', '4822', '4904', '4255', '4001', '4387', '4500', '4190', '4686', '4995', '4661', '4783', '4992', '4165', '4065', '4927', '4306', '4856', '4292', '4420', '4963', '4468', '4240', '4724', '4432', '4447', '4518', '4028', '4670', '4339', '4771', '4018', '4489', '4110', '4708', '4945', '4136', '4492', '4930', '4090', '4734', '4886', '4542', '4227', '4486', '4491', '4713', '4986', '4068', '4048', '4975', '4570', '4842', '4475', '4131', '4555', '4428', '4776', '4101', '4273', '4811', '4345', '5000', '4653', '4256', '4209', '4769', '4946', '4561', '4080', '4461', '4820', '4311', '4959', '4750', '4795', '4748', '4368', '4506', '4335', '4346', '4568', '4675', '4692', '4774', '4413', '4370', '4723', '4521', '4885', '4678', '4897', '4066', '4674', '4106', '4626', '4389', '4204', '4839', '4023', '4712', '4145', '4035', '4357', '4756', '4648', '4972', '4157', '4406', '4615', '4061', '4219', '4791', '4660', '4073', '4356', '4072', '4599', '4359', '4094', '4673', '4696', '4796', '4282', '4714', '4522', '4736', '4775', '4760', '4400', '4847', '4228', '4803', '4908', '4732', '4645', '4122', '4218', '4478', '4941', '4892', '4364', '4403', '4152', '4444', '4360', '4354', '4241', '4494', '4367', '4808', '4261', '4088', '4573', '4554', '4248', '4371', '4393', '4268', '4201', '4038', '4788', '4593', '4040', '4801', '4582', '4309', '4976', '4374', '4869', '4380', '4514', '4243', '4362', '4849', '4680', '4888', '4764', '4618', '4838', '4828', '4643', '4010', '4827', '4957', '4099', '4875', '4843', '4737', '4102', '4979', '4011', '4504', '4440', '4746', '4557', '4426', '4553', '4656', '4868', '4689', '4988', '4703', '4967', '4069', '4619', '4334', '4669', '4785', '4464', '4562', '4961', '4625', '4754', '4797', '4481', '4705', '4199', '4337', '4062', '4138', '4702', '4534', '4168', '4418', '4092', '4682', '4520', '4030', '4171', '4650', '4858', '4411', '4999', '4252', '4197', '4170', '4942', '4631', '4990', '4179', '4285', '4700', '4482', '4575', '4800', '4070', '4251', '4344', '4982', '4719', '4390', '4149', '4100', '4194', '4269', '4855', '4314', '4718', '4232', '4730', '4438', '4588', '4195', '4192', '4493', '4517', '4833', '4234', '4989', '4315', '4844', '4142', '4408', '4584', '4425']
|
4
|
+
a.pop(1)
|
5
|
+
end
|
6
|
+
|
7
|
+
x.compare!
|
8
|
+
end
|
@@ -0,0 +1,7 @@
|
|
1
|
+
Benchmark.ips do |x|
|
2
|
+
x.report("shift no arg") do
|
3
|
+
a = ['4768', '4964', '4266', '4872', '4231', '4017', '4565', '4793', '4298', '4135', '4639', '4780', '4237', '4548', '4655', '4153', '4654', '4922', '4563', '4042', '4329', '4699', '4352', '4127', '4544', '4906', '4814', '4948', '4977', '4830', '4405', '4642', '4666', '4402', '4679', '4465', '4401', '4155', '4767', '4510', '4747', '4993', '4508', '4697', '4758', '4133', '4348', '4200', '4442', '4970', '4452', '4041', '4103', '4567', '4937', '4047', '4933', '4121', '4860', '4659', '4221', '4312', '4583', '4473', '4973', '4262', '4630', '4123', '4139', '4289', '4147', '4222', '4050', '4019', '4454', '4253', '4552', '4947', '4725', '4457', '4929', '4021', '4502', '4307', '4576', '4124', '4586', '4610', '4027', '4572', '4926', '4753', '4185', '4382', '4394', '4923', '4186', '4254', '4012', '4417', '4556', '4349', '4550', '4330', '4938', '4985', '4778', '4716', '4924', '4045', '4358', '4189', '4591', '4213', '4851', '4825', '4260', '4198', '4342', '4824', '4333', '4244', '4752', '4994', '4488', '4532', '4082', '4595', '4098', '4436', '4540', '4267', '4407', '4998', '4751', '4535', '4861', '4819', '4419', '4031', '4029', '4453', '4698', '4965', '4450', '4668', '4036', '4300', '4519', '4281', '4981', '4818', '4939', '4378', '4140', '4841', '4249', '4290', '4388', '4878', '4884', '4235', '4515', '4638', '4410', '4054', '4383', '4238', '4870', '4295', '4804', '4308', '4614', '4105', '4053', '4446', '4757', '4971', '4637', '4831', '4193', '4912', '4000', '4187', '4606', '4566', '4169', '4641', '4749', '4729', '4928', '4601', '4949', '4210', '4313', '4647', '4495', '4460', '4621', '4605', '4694', '4317', '4226', '4263', '4016', '4997', '4940', '4715', '4907', '4620', '4934', '4996', '4955', '4688', '4304', '4220', '4882', '4772', '4536', '4815', '4693', '4469', '4276', '4409', '4071', '4224', '4020', '4629', '4865', '4813', '4366', '4622', '4129', '4533', '4634', '4564', '4087', '4386', '4161', '4265', '4711', '4009', '4376', '4781', '4837', '4112', '4915', '4592', '4658', '4025', '4987', '4291', '4477', '4503', '4437', '4111', '4707', '4879', '4611', '4549', '4078', '4044', '4853', '4835', '4463', '4577', '4008', '4233', '4741', '4384', '4225', '4024', '4726', '4743', '4160', '4180', '4722', '4609', '4114', '4834', '4742', '4662', '4984', '4299', '4060', '4498', '4755', '4320', '4874', '4528', '4216', '4852', '4951', '4958', '4283', '4239', '4476', '4644', '4143', '4104', '4455', '4126', '4950', '4663', '4013', '4931', '4850', '4242', '4130', '4623', '4871', '4014', '4854', '4293', '4512', '4166', '4740', '4735', '4150', '4651', '4172', '4836', '4530', '4664', '4429', '4511', '4558', '4676', '4085', '4074', '4580', '4794', '4379', '4310', '4817', '4966', '4848', '4202', '4336', '4608', '4351', '4396', '4652', '4033', '4188', '4431', '4916', '4259', '4607', '4816', '4810', '4627', '4527', '4560', '4728', '4589', '4274', '4809', '4790', '4398', '4414', '4516', '4581', '4919', '4665', '4331', '4978', '4543', '4877', '4974', '4284', '4004', '4177', '4466', '4116', '4217', '4901', '4372', '4137', '4806', '4264', '4497', '4294', '4787', '4212', '4215', '4115', '4782', '4739', '4821', '4125', '4505', '4230', '4399', '4395', '4079', '4867', '4381', '4706', '4695', '4404', '4691', '4075', '4353', '4301', '4876', '4731', '4523', '4246', '4529', '4412', '4784', '4449', '4229', '4616', '4158', '4002', '4318', '4377', '4205', '4911', '4777', '4792', '4271', '4763', '4141', '4287', '4890', '4279', '4829', '4646', '4840', '4089', '4880', '4067', '4918', '4059', '4109', '4164', '4863', '4883', '4909', '4361', '4174', '4960', '4302', '4003', '4236', '4846', '4034', '4324', '4513', '4765', '4596', '4900', '4007', '4603', '4474', '4439', '4805', '4015', '4496', '4953', '4363', '4551', '4459', '4063', '4983', '4881', '4365', '4604', '4587', '4798', '4005', '4163', '4421', '4471', '4826', '4144', '4635', '4600', '4913', '4640', '4247', '4766', '4779', '4280', '4391', '4891', '4636', '4546', '4683', '4181', '4081', '4862', '4458', '4037', '4321', '4786', '4717', '4628', '4154', '4326', '4032', '4873', '4151', '4905', '4270', '4156', '4733', '4980', '4866', '4325', '4055', '4467', '4480', '4286', '4191', '4762', '4322', '4574', '4022', '4056', '4770', '4451', '4448', '4845', '4341', '4433', '4245', '4684', '4671', '4093', '4920', '4272', '4745', '4799', '4761', '4250', '4578', '4347', '4499', '4526', '4369', '4162', '4537', '4434', '4893', '4120', '4962', '4667', '4525', '4091', '4462', '4182', '4738', '4935', '4173', '4490', '4571', '4424', '4894', '4051', '4214', '4823', '4096', '4206', '4598', '4943', '4701', '4649', '4807', '4107', '4435', '4456', '4083', '4612', '4721', '4472', '4146', '4925', '4340', '4789', '4277', '4375', '4211', '4427', '4547', '4690', '4613', '4727', '4006', '4203', '4430', '4223', '4039', '4932', '4296', '4108', '4278', '4832', '4422', '4917', '4470', '4183', '4887', '4076', '4485', '4597', '4443', '4257', '4991', '4944', '4196', '4672', '4397', '4097', '4119', '4077', '4773', '4602', '4538', '4479', '4968', '4159', '4539', '4956', '4710', '4812', '4902', '4569', '4954', '4385', '4128', '4936', '4416', '4148', '4632', '4759', '4117', '4896', '4392', '4864', '4316', '4132', '4319', '4969', '4175', '4484', '4903', '4910', '4350', '4332', '4952', '4176', '4594', '4709', '4509', '4178', '4167', '4545', '4857', '4617', '4501', '4859', '4207', '4275', '4687', '4049', '4579', '4046', '4921', '4113', '4898', '4681', '4052', '4415', '4064', '4184', '4895', '4744', '4685', '4084', '4305', '4899', '4559', '4208', '4057', '4507', '4258', '4355', '4086', '4373', '4323', '4541', '4297', '4483', '4889', '4531', '4327', '4441', '4914', '4303', '4677', '4445', '4802', '4343', '4585', '4338', '4524', '4590', '4624', '4288', '4704', '4134', '4043', '4720', '4058', '4328', '4095', '4026', '4423', '4657', '4118', '4633', '4487', '4822', '4904', '4255', '4001', '4387', '4500', '4190', '4686', '4995', '4661', '4783', '4992', '4165', '4065', '4927', '4306', '4856', '4292', '4420', '4963', '4468', '4240', '4724', '4432', '4447', '4518', '4028', '4670', '4339', '4771', '4018', '4489', '4110', '4708', '4945', '4136', '4492', '4930', '4090', '4734', '4886', '4542', '4227', '4486', '4491', '4713', '4986', '4068', '4048', '4975', '4570', '4842', '4475', '4131', '4555', '4428', '4776', '4101', '4273', '4811', '4345', '5000', '4653', '4256', '4209', '4769', '4946', '4561', '4080', '4461', '4820', '4311', '4959', '4750', '4795', '4748', '4368', '4506', '4335', '4346', '4568', '4675', '4692', '4774', '4413', '4370', '4723', '4521', '4885', '4678', '4897', '4066', '4674', '4106', '4626', '4389', '4204', '4839', '4023', '4712', '4145', '4035', '4357', '4756', '4648', '4972', '4157', '4406', '4615', '4061', '4219', '4791', '4660', '4073', '4356', '4072', '4599', '4359', '4094', '4673', '4696', '4796', '4282', '4714', '4522', '4736', '4775', '4760', '4400', '4847', '4228', '4803', '4908', '4732', '4645', '4122', '4218', '4478', '4941', '4892', '4364', '4403', '4152', '4444', '4360', '4354', '4241', '4494', '4367', '4808', '4261', '4088', '4573', '4554', '4248', '4371', '4393', '4268', '4201', '4038', '4788', '4593', '4040', '4801', '4582', '4309', '4976', '4374', '4869', '4380', '4514', '4243', '4362', '4849', '4680', '4888', '4764', '4618', '4838', '4828', '4643', '4010', '4827', '4957', '4099', '4875', '4843', '4737', '4102', '4979', '4011', '4504', '4440', '4746', '4557', '4426', '4553', '4656', '4868', '4689', '4988', '4703', '4967', '4069', '4619', '4334', '4669', '4785', '4464', '4562', '4961', '4625', '4754', '4797', '4481', '4705', '4199', '4337', '4062', '4138', '4702', '4534', '4168', '4418', '4092', '4682', '4520', '4030', '4171', '4650', '4858', '4411', '4999', '4252', '4197', '4170', '4942', '4631', '4990', '4179', '4285', '4700', '4482', '4575', '4800', '4070', '4251', '4344', '4982', '4719', '4390', '4149', '4100', '4194', '4269', '4855', '4314', '4718', '4232', '4730', '4438', '4588', '4195', '4192', '4493', '4517', '4833', '4234', '4989', '4315', '4844', '4142', '4408', '4584', '4425']
|
4
|
+
a.shift
|
5
|
+
end
|
6
|
+
x.compare!
|
7
|
+
end
|
@@ -4,15 +4,20 @@ Benchmark.ips do |x|
|
|
4
4
|
o[Symbol.for('foo')] = 123
|
5
5
|
o.foo = 123
|
6
6
|
var foo = Symbol('foo')
|
7
|
+
var gfoo = Symbol.for('foo')
|
7
8
|
o[foo] = 123
|
8
9
|
var a = 0, b = 0, c = 0
|
9
10
|
}
|
10
11
|
|
11
|
-
x.report('global symbol') do
|
12
|
+
x.report('live global symbol') do
|
12
13
|
`a += o[Symbol.for('foo')]`
|
13
14
|
end
|
14
15
|
|
15
|
-
x.report('symbol') do
|
16
|
+
x.report('stored global symbol') do
|
17
|
+
`a += o[gfoo]`
|
18
|
+
end
|
19
|
+
|
20
|
+
x.report('stored symbol') do
|
16
21
|
`a += o[foo]`
|
17
22
|
end
|
18
23
|
|
@@ -0,0 +1,4 @@
|
|
1
|
+
#!/usr/bin/env bash
|
2
|
+
|
3
|
+
yarn -s browserify -r ./lib/opal/cli_runners/source-map-support.js -o ./lib/opal/cli_runners/source-map-support-browser.js -s sourceMapSupport
|
4
|
+
yarn -s browserify -r ./lib/opal/cli_runners/source-map-support.js -o ./lib/opal/cli_runners/source-map-support-node.js --bare -s sourceMapSupport
|
data/bin/format-filters
ADDED
@@ -0,0 +1,54 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
sort_lines = -> lines {
|
4
|
+
lines.sort.uniq { |l| l.split('" # ', 2).first }
|
5
|
+
}
|
6
|
+
|
7
|
+
write_group = ->(title:, lines:, type:) {
|
8
|
+
%{#{type} "#{title}" do\n}+
|
9
|
+
sort_lines[lines].join+
|
10
|
+
%{end\n}
|
11
|
+
}
|
12
|
+
|
13
|
+
write_groups = -> groups {
|
14
|
+
%{# NOTE: run bin/format-filters after changing this file\n}+
|
15
|
+
groups.map.with_index do |group, index|
|
16
|
+
puts "- #{group[:type]} #{group[:title].inspect}..."
|
17
|
+
("\n" if index > 0).to_s + write_group.call(**group)
|
18
|
+
end.join
|
19
|
+
}
|
20
|
+
|
21
|
+
group_lines = -> lines {
|
22
|
+
groups = []
|
23
|
+
group = nil
|
24
|
+
lines.each do |line|
|
25
|
+
case line
|
26
|
+
when /^(opal_(?:unsupported_)?filter) *"([^"]+)" *do *\n/
|
27
|
+
raise "bad group for #{line.inspect}!" if group
|
28
|
+
|
29
|
+
group = {
|
30
|
+
type: $1,
|
31
|
+
title: $2,
|
32
|
+
lines: []
|
33
|
+
}
|
34
|
+
|
35
|
+
when /^ fails/
|
36
|
+
group[:lines] << line
|
37
|
+
|
38
|
+
when /^end/
|
39
|
+
groups << group
|
40
|
+
group = nil
|
41
|
+
end
|
42
|
+
end
|
43
|
+
groups
|
44
|
+
}
|
45
|
+
|
46
|
+
format_filter = -> path {
|
47
|
+
File.write path, write_groups[group_lines[File.read(path).lines]]
|
48
|
+
}
|
49
|
+
|
50
|
+
Dir['spec/filters/**/*.rb'].each do |path|
|
51
|
+
puts
|
52
|
+
puts "Formatting #{path} ..."
|
53
|
+
format_filter[path]
|
54
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
def system(*args)
|
4
|
+
puts "== command: #{args.inspect}"
|
5
|
+
super
|
6
|
+
end
|
7
|
+
|
8
|
+
def system!(*args)
|
9
|
+
system(*args) or raise "== command failed: #{args.inspect}"
|
10
|
+
end
|
11
|
+
|
12
|
+
|
13
|
+
Dir.chdir "#{__dir__}/.."
|
14
|
+
Dir.mkdir 'tmp' unless File.directory? 'tmp'
|
15
|
+
|
16
|
+
system 'git submodule --quiet deinit --all -f 2> /dev/null'
|
17
|
+
|
18
|
+
modules = {}
|
19
|
+
`git config -f #{__dir__}/../.gitmodules --list`.lines.each do |line|
|
20
|
+
fullkey, value = line.split('=', 2)
|
21
|
+
_, name, key = fullkey.split('.', 3)
|
22
|
+
modules[name] ||= {}
|
23
|
+
modules[name][key.to_sym] = value.strip
|
24
|
+
end
|
25
|
+
|
26
|
+
`git submodule`.lines.each do |line|
|
27
|
+
sha1, name = line[1..-1].scan(/^(?<sha1>\w+) (?<name>\S+)/).first
|
28
|
+
modules[name][:sha1] = sha1
|
29
|
+
end
|
30
|
+
|
31
|
+
modules.map do |name, config|
|
32
|
+
puts "== installing #{name}..."
|
33
|
+
url, sha1, path = config.values_at(:url, :sha1, :path)
|
34
|
+
dir = File.dirname(path)
|
35
|
+
url.sub!(/\.git$/, '')
|
36
|
+
|
37
|
+
Thread.new do
|
38
|
+
system! "curl -L #{url}/archive/#{sha1}.zip -o #{sha1}.zip"
|
39
|
+
|
40
|
+
system! "unzip -q #{sha1}.zip -d #{dir}"
|
41
|
+
system! "rm #{sha1}.zip"
|
42
|
+
|
43
|
+
system! "rm -rf #{path}" if File.directory? path
|
44
|
+
system! "mv #{dir}/*-#{sha1} #{path}"
|
45
|
+
print "== completed installing #{name}.\n"
|
46
|
+
end
|
47
|
+
end.each(&:join)
|
48
|
+
|
49
|
+
system! 'git submodule init'
|
data/bin/remove-filters
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# This is an utility to automatically remove a group of filters provided
|
3
|
+
# to its standard input.
|
4
|
+
#
|
5
|
+
# This utility is to assist with removing a large group of filters spread
|
6
|
+
# around multiple files that is being output by a command:
|
7
|
+
#
|
8
|
+
# rake mspec_ruby_nodejs RUBYSPECS=true INVERT_RUNNING_MODE=true
|
9
|
+
#
|
10
|
+
# It expects an input of format:
|
11
|
+
# 1) "Set#filter! returns an Enumerator when passed no block"
|
12
|
+
# 2) "Set#filter! yields every element of self"
|
13
|
+
# 3) "Set#filter! keeps every element from self for which the passed block returns true"
|
14
|
+
# 4) "Set#filter! returns self when self was modified"
|
15
|
+
# 5) "Set#filter! returns nil when self was not modified"
|
16
|
+
|
17
|
+
filters = $stdin.read.split("\n").map do |i|
|
18
|
+
# This special example should be rather moved to unsupported for now...
|
19
|
+
next if i =~ /formats the local time following the pattern/
|
20
|
+
|
21
|
+
i.scan(/\d+\) (".*")/).first.first
|
22
|
+
end.compact
|
23
|
+
filters = Regexp.union(*filters)
|
24
|
+
|
25
|
+
remove_filters = -> path {
|
26
|
+
file = File.read(path).split("\n")
|
27
|
+
|
28
|
+
remove, good = file.partition { |i| i =~ filters }
|
29
|
+
|
30
|
+
if remove.length > 0
|
31
|
+
puts "Removing #{remove.length} filters from #{path}"
|
32
|
+
|
33
|
+
File.write(path, good.join("\n")+"\n")
|
34
|
+
end
|
35
|
+
}
|
36
|
+
|
37
|
+
Dir['spec/filters/**/*.rb'].each do |path|
|
38
|
+
remove_filters[path]
|
39
|
+
end
|
data/bin/setup
CHANGED
data/bin/yarn
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
APP_ROOT = File.expand_path('..', __dir__)
|
3
|
+
Dir.chdir(APP_ROOT) do
|
4
|
+
begin
|
5
|
+
exec "yarnpkg", *ARGV
|
6
|
+
rescue Errno::ENOENT
|
7
|
+
$stderr.puts "Yarn executable was not detected in the system."
|
8
|
+
$stderr.puts "Download Yarn at https://yarnpkg.com/en/docs/install"
|
9
|
+
exit 1
|
10
|
+
end
|
11
|
+
end
|
data/docs/releasing.md
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
# Releasing
|
2
|
+
|
3
|
+
_This guide is a work-in-progress._
|
4
|
+
|
5
|
+
## Updating the version
|
6
|
+
|
7
|
+
- Update `lib/opal/version.rb`
|
8
|
+
- Update `opal/corelib/constants.rb` with the same version number along with release dates
|
9
|
+
|
10
|
+
## Updating the changelog
|
11
|
+
|
12
|
+
- Ensure all the unreleased changes are documented in UNRELEASED.md
|
13
|
+
- Run `bin/rake changelog VERSION=v1.2.3` specifying the version number you're about to release
|
14
|
+
|
15
|
+
## The commit
|
16
|
+
|
17
|
+
- Commit the updated changelog along with the version bump using this commmit message:
|
18
|
+
"Release v1.2.3"
|
@@ -0,0 +1,86 @@
|
|
1
|
+
# Using Opal with Roda and Sprockets
|
2
|
+
|
3
|
+
Add Opal-Sprockets and Roda-Sprockets to your Gemfile (or install using `gem`):
|
4
|
+
|
5
|
+
```ruby
|
6
|
+
# Gemfile
|
7
|
+
gem "opal-sprockets"
|
8
|
+
gem "roda-sprockets"
|
9
|
+
gem "puma"
|
10
|
+
```
|
11
|
+
|
12
|
+
Roda-Sprockets uses `sprockets` as its default build system, so the asset-pipeline
|
13
|
+
from rails can be mimicked here to map all ruby assets in the `/assets`
|
14
|
+
path to be compiled using opal.
|
15
|
+
|
16
|
+
## Basic Application
|
17
|
+
|
18
|
+
```ruby
|
19
|
+
# config.ru
|
20
|
+
require 'roda'
|
21
|
+
|
22
|
+
class App < Roda
|
23
|
+
plugin :sprockets, precompile: %w(application.js),
|
24
|
+
prefix: %w(app/),
|
25
|
+
root: __dir__,
|
26
|
+
public_path: 'public/',
|
27
|
+
opal: true,
|
28
|
+
debug: ENV['RACK_ENV'] != 'production'
|
29
|
+
plugin :public
|
30
|
+
|
31
|
+
route do |r|
|
32
|
+
r.public
|
33
|
+
r.sprockets
|
34
|
+
|
35
|
+
r.root do
|
36
|
+
<<~END
|
37
|
+
<!doctype html>
|
38
|
+
<html>
|
39
|
+
<head>
|
40
|
+
#{ javascript_tag 'application' }
|
41
|
+
#{ opal_require 'application' }
|
42
|
+
</head>
|
43
|
+
</html>
|
44
|
+
END
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
run App.app
|
50
|
+
|
51
|
+
```
|
52
|
+
|
53
|
+
This creates a sprockets instance under the `/assets` path, serving Opal assets
|
54
|
+
from `app/` with all the custom opal paths added automatically.
|
55
|
+
|
56
|
+
This `env` object includes all the opal corelib and stdlib paths. To add
|
57
|
+
any custom application directories, you must add them to the load path using
|
58
|
+
`Opal.append_path` or adding them to the `prefix` parameter. You can now add
|
59
|
+
an `app/application.rb` file into this added path with some basic content:
|
60
|
+
|
61
|
+
```ruby
|
62
|
+
# app/application.rb
|
63
|
+
require 'opal'
|
64
|
+
|
65
|
+
puts "wow, running ruby!"
|
66
|
+
```
|
67
|
+
|
68
|
+
It is necessary to require the opal corelib (seen in the `require` call) above.
|
69
|
+
This just makes the Opal runtime and corelib available. Then it is possible to
|
70
|
+
use all the corelib methods and classes, e.g. `Kernel#puts` as seen above.
|
71
|
+
|
72
|
+
### Running Application
|
73
|
+
|
74
|
+
As this is just a simple Roda application, you can run it:
|
75
|
+
|
76
|
+
```sh
|
77
|
+
$ bundle exec rackup
|
78
|
+
```
|
79
|
+
|
80
|
+
And point your browser towards `http://localhost:9292/` and view the browser
|
81
|
+
debug console. You should see this message printed.
|
82
|
+
|
83
|
+
### Extending the integration
|
84
|
+
|
85
|
+
It's possible to extend this integration, for that please look into the
|
86
|
+
[roda-sprockets documentation](https://github.com/hmdne/roda-sprockets)
|