opal 1.2.0.beta1 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.eslintrc.await.js +6 -0
- data/.eslintrc.js +34 -0
- data/.github/workflows/build.yml +11 -1
- data/.rubocop.yml +11 -1
- data/CHANGELOG.md +164 -0
- data/README.md +1 -1
- data/Rakefile +1 -0
- data/UNRELEASED.md +1 -41
- data/docs/async.md +109 -0
- data/docs/roda-sprockets.md +0 -2
- data/examples/rack/Gemfile +1 -0
- data/examples/rack/Gemfile.lock +11 -7
- data/examples/rack-esm/.gitignore +1 -0
- data/examples/rack-esm/Gemfile +5 -0
- data/examples/rack-esm/app/application.rb +27 -0
- data/examples/rack-esm/app/user.rb +24 -0
- data/examples/rack-esm/config.ru +25 -0
- data/examples/rack-esm/index.html.erb +11 -0
- data/examples/sinatra/Gemfile.lock +21 -19
- data/exe/opal +2 -0
- data/exe/opal-repl +2 -2
- data/lib/opal/builder.rb +44 -24
- data/lib/opal/builder_processors.rb +13 -3
- data/lib/opal/cache/file_cache.rb +120 -0
- data/lib/opal/cache.rb +71 -0
- data/lib/opal/cli.rb +35 -1
- data/lib/opal/cli_options.rb +21 -0
- data/lib/opal/cli_runners/chrome.rb +33 -21
- data/lib/opal/cli_runners/{chrome.js → chrome_cdp_interface.rb} +27 -6
- data/lib/opal/cli_runners/compiler.rb +2 -1
- data/lib/opal/cli_runners/gjs.rb +27 -0
- data/lib/opal/cli_runners/mini_racer.rb +36 -0
- data/lib/opal/cli_runners/nodejs.rb +3 -2
- data/lib/opal/cli_runners/quickjs.rb +28 -0
- data/lib/opal/cli_runners/source-map-support-browser.js +276 -91
- data/lib/opal/cli_runners/source-map-support-node.js +276 -91
- data/lib/opal/cli_runners/source-map-support.js +60 -18
- data/lib/opal/cli_runners.rb +3 -0
- data/lib/opal/compiler.rb +105 -10
- data/lib/opal/config.rb +5 -0
- data/lib/opal/fragment.rb +77 -14
- data/lib/opal/nodes/args/extract_kwrestarg.rb +6 -4
- data/lib/opal/nodes/args/extract_restarg.rb +10 -12
- data/lib/opal/nodes/args.rb +28 -0
- data/lib/opal/nodes/base.rb +29 -5
- data/lib/opal/nodes/call.rb +168 -28
- data/lib/opal/nodes/case.rb +7 -1
- data/lib/opal/nodes/class.rb +12 -2
- data/lib/opal/nodes/def.rb +3 -23
- data/lib/opal/nodes/definitions.rb +21 -4
- data/lib/opal/nodes/helpers.rb +3 -3
- data/lib/opal/nodes/if.rb +39 -9
- data/lib/opal/nodes/iter.rb +15 -3
- data/lib/opal/nodes/lambda.rb +3 -1
- data/lib/opal/nodes/literal.rb +13 -7
- data/lib/opal/nodes/logic.rb +2 -2
- data/lib/opal/nodes/module.rb +12 -2
- data/lib/opal/nodes/rescue.rb +59 -34
- data/lib/opal/nodes/scope.rb +88 -6
- data/lib/opal/nodes/super.rb +52 -25
- data/lib/opal/nodes/top.rb +10 -7
- data/lib/opal/nodes/while.rb +7 -1
- data/lib/opal/parser/patch.rb +11 -0
- data/lib/opal/repl.rb +137 -49
- data/lib/opal/rewriter.rb +2 -0
- data/lib/opal/rewriters/binary_operator_assignment.rb +10 -10
- data/lib/opal/rewriters/block_to_iter.rb +3 -3
- data/lib/opal/rewriters/for_rewriter.rb +7 -7
- data/lib/opal/rewriters/js_reserved_words.rb +5 -3
- data/lib/opal/rewriters/pattern_matching.rb +287 -0
- data/lib/opal/rewriters/rubyspec/filters_rewriter.rb +16 -0
- data/lib/opal/simple_server.rb +7 -2
- data/lib/opal/source_map/file.rb +7 -4
- data/lib/opal/source_map/map.rb +17 -3
- data/lib/opal/util.rb +1 -1
- data/lib/opal/version.rb +1 -1
- data/opal/corelib/array.rb +2 -2
- data/opal/corelib/binding.rb +46 -0
- data/opal/corelib/boolean.rb +54 -4
- data/opal/corelib/class.rb +2 -0
- data/opal/corelib/complex/base.rb +15 -0
- data/opal/corelib/complex.rb +3 -15
- data/opal/corelib/constants.rb +2 -2
- data/opal/corelib/error.rb +98 -12
- data/opal/corelib/hash.rb +9 -0
- data/opal/corelib/helpers.rb +10 -0
- data/opal/corelib/io.rb +254 -38
- data/opal/corelib/kernel/format.rb +5 -2
- data/opal/corelib/kernel.rb +64 -27
- data/opal/corelib/main.rb +9 -0
- data/opal/corelib/method.rb +5 -0
- data/opal/corelib/module.rb +67 -16
- data/opal/corelib/number.rb +12 -1
- data/opal/corelib/pattern_matching/base.rb +35 -0
- data/opal/corelib/pattern_matching.rb +125 -0
- data/opal/corelib/process/base.rb +9 -0
- data/opal/corelib/process.rb +1 -11
- data/opal/corelib/random/seedrandom.js.rb +2 -2
- data/opal/corelib/random.rb +4 -0
- data/opal/corelib/rational/base.rb +11 -0
- data/opal/corelib/rational.rb +3 -10
- data/opal/corelib/regexp.rb +48 -4
- data/opal/corelib/runtime.js +190 -15
- data/opal/corelib/string/encoding.rb +17 -17
- data/opal/corelib/string.rb +2 -0
- data/opal/corelib/struct.rb +10 -3
- data/opal/corelib/trace_point.rb +57 -0
- data/opal/opal/full.rb +6 -2
- data/opal/opal.rb +12 -11
- data/package.json +4 -3
- data/spec/filters/bugs/array.rb +0 -2
- data/spec/filters/bugs/basicobject.rb +0 -1
- data/spec/filters/bugs/bigdecimal.rb +0 -1
- data/spec/filters/bugs/binding.rb +27 -0
- data/spec/filters/bugs/enumerator.rb +137 -0
- data/spec/filters/bugs/exception.rb +70 -93
- data/spec/filters/bugs/float.rb +3 -1
- data/spec/filters/bugs/hash.rb +1 -6
- data/spec/filters/bugs/kernel.rb +5 -18
- data/spec/filters/bugs/language.rb +19 -118
- data/spec/filters/bugs/main.rb +16 -0
- data/spec/filters/bugs/marshal.rb +3 -0
- data/spec/filters/bugs/matrix.rb +39 -0
- data/spec/filters/bugs/method.rb +1 -4
- data/spec/filters/bugs/module.rb +36 -85
- data/spec/filters/bugs/proc.rb +0 -1
- data/spec/filters/bugs/rational.rb +1 -0
- data/spec/filters/bugs/regexp.rb +0 -17
- data/spec/filters/bugs/string.rb +1 -0
- data/spec/filters/bugs/struct.rb +0 -10
- data/spec/filters/bugs/trace_point.rb +12 -0
- data/spec/filters/bugs/warnings.rb +0 -4
- data/spec/filters/unsupported/freeze.rb +2 -0
- data/spec/filters/unsupported/privacy.rb +4 -0
- data/spec/lib/compiler_spec.rb +9 -3
- data/spec/lib/repl_spec.rb +4 -2
- data/spec/lib/source_map/file_spec.rb +1 -1
- data/spec/mspec-opal/formatters.rb +18 -4
- data/spec/mspec-opal/runner.rb +3 -2
- data/spec/opal/core/boolean_spec.rb +44 -0
- data/spec/opal/core/hash_spec.rb +8 -0
- data/spec/opal/core/language/pattern_matching_spec.rb +124 -0
- data/spec/opal/core/number/to_s_spec.rb +11 -0
- data/spec/opal/stdlib/json/ext_spec.rb +3 -3
- data/spec/opal/stdlib/logger/logger_spec.rb +10 -1
- data/spec/ruby_specs +18 -0
- data/stdlib/await.rb +83 -0
- data/stdlib/base64.rb +4 -4
- data/stdlib/benchmark.rb +14 -0
- data/stdlib/bigdecimal/bignumber.js.rb +4 -2
- data/stdlib/bigdecimal.rb +1 -0
- data/stdlib/buffer.rb +4 -0
- data/stdlib/gjs/io.rb +33 -0
- data/stdlib/gjs/kernel.rb +5 -0
- data/stdlib/gjs.rb +2 -0
- data/stdlib/js.rb +4 -0
- data/stdlib/json.rb +3 -3
- data/stdlib/logger.rb +1 -1
- data/stdlib/nashorn/file.rb +4 -0
- data/stdlib/native.rb +63 -58
- data/stdlib/nodejs/argf.rb +110 -0
- data/stdlib/nodejs/env.rb +19 -0
- data/stdlib/nodejs/file.rb +16 -41
- data/stdlib/nodejs/io.rb +21 -5
- data/stdlib/nodejs/js-yaml-3-6-1.js +2 -2
- data/stdlib/nodejs/kernel.rb +56 -0
- data/stdlib/nodejs.rb +1 -0
- data/stdlib/opal/miniracer.rb +6 -0
- data/stdlib/opal/platform.rb +6 -0
- data/stdlib/opal/repl_js.rb +5 -0
- data/stdlib/opal/replutils.rb +271 -0
- data/stdlib/opal-parser.rb +24 -11
- data/stdlib/opal-platform.rb +11 -0
- data/stdlib/pathname.rb +4 -0
- data/stdlib/promise/v1.rb +1 -0
- data/stdlib/promise/v2.rb +398 -0
- data/stdlib/promise.rb +14 -0
- data/stdlib/quickjs/io.rb +22 -0
- data/stdlib/quickjs/kernel.rb +5 -0
- data/stdlib/quickjs.rb +2 -0
- data/stdlib/securerandom.rb +2 -0
- data/stdlib/stringio.rb +13 -110
- data/stdlib/thread.rb +29 -0
- data/tasks/building.rake +10 -4
- data/tasks/linting-parse-eslint-results.js +39 -0
- data/tasks/linting.rake +38 -28
- data/tasks/performance/asciidoctor_test.rb.erb +6 -0
- data/tasks/performance/optimization_status.rb +77 -0
- data/tasks/performance.rake +150 -0
- data/tasks/releasing.rake +1 -1
- data/tasks/testing.rake +9 -2
- data/test/nodejs/test_await.rb +169 -0
- data/test/opal/promisev2/test_always.rb +63 -0
- data/test/opal/promisev2/test_error.rb +22 -0
- data/test/opal/promisev2/test_rescue.rb +59 -0
- data/test/opal/promisev2/test_then.rb +90 -0
- data/test/opal/promisev2/test_trace.rb +52 -0
- data/test/opal/promisev2/test_value.rb +16 -0
- data/test/opal/promisev2/test_when.rb +35 -0
- data/test/opal/unsupported_and_bugs.rb +5 -0
- data/vendored-minitest/minitest/benchmark.rb +9 -7
- data/vendored-minitest/minitest/test.rb +14 -12
- data/vendored-minitest/minitest.rb +19 -16
- data/yarn.lock +686 -117
- metadata +104 -23
- data/.jshintrc +0 -41
- data/spec/filters/unsupported/refinements.rb +0 -5
- data/vendored-minitest/minitest/hell.rb +0 -11
- data/vendored-minitest/minitest/parallel.rb +0 -65
- data/vendored-minitest/minitest/pride.rb +0 -4
- data/vendored-minitest/minitest/pride_plugin.rb +0 -142
- data/vendored-minitest/minitest/unit.rb +0 -45
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0b7a4b076832e2c4f5cf807f40bf1a9d7e1a0328e1ef4b245f1514ae2ff145dd
|
4
|
+
data.tar.gz: 5df94eda8d910641c918d913b7421796b5e513b05600e51d1debd0cd3944cf20
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 04050f1589cf7ee4a3be39907e4618434659157968b63f225c6ae27a46da5f9e77c57080ca0c741aa333c3a3e48e2bbe38a3719f8540e55aefe26a3b6c4d3710
|
7
|
+
data.tar.gz: 867a69aa3810572ff1636f4b6dc0df14435fa54dc06655101dde8017e71ab1892393e5a61517194f4828d596301097876e36734d9c4039f2d2109c70a011a3cb
|
data/.eslintrc.await.js
ADDED
data/.eslintrc.js
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
module.exports = {
|
2
|
+
"env": {
|
3
|
+
"browser": true,
|
4
|
+
"node": true
|
5
|
+
},
|
6
|
+
"extends": "eslint:recommended",
|
7
|
+
"parserOptions": {
|
8
|
+
"ecmaVersion": 3
|
9
|
+
},
|
10
|
+
"rules": {
|
11
|
+
"no-unused-vars": ["error", {
|
12
|
+
"varsIgnorePattern": "(\$(\$|\$\$|yield|post_args|[a-z])|self)",
|
13
|
+
"argsIgnorePattern": "(\$(\$|\$\$|yield|post_args|[a-z])|self)",
|
14
|
+
}],
|
15
|
+
"no-extra-semi": "off",
|
16
|
+
"no-empty": "off",
|
17
|
+
"no-unreachable": "off",
|
18
|
+
"no-cond-assign": "off",
|
19
|
+
"no-prototype-builtins": "off",
|
20
|
+
"no-constant-condition": ["error", { "checkLoops": false }],
|
21
|
+
"no-useless-escape": "off",
|
22
|
+
"no-fallthrough": ["error", { "commentPattern": "raise|no-break" }],
|
23
|
+
"no-regex-spaces": "off",
|
24
|
+
"no-control-regex": "off",
|
25
|
+
},
|
26
|
+
"globals": {
|
27
|
+
"Opal": "readonly",
|
28
|
+
"DataView": "readonly",
|
29
|
+
"ArrayBuffer": "readonly",
|
30
|
+
"globalThis": "readonly",
|
31
|
+
"Uint8Array": "readonly",
|
32
|
+
"Promise": "readonly",
|
33
|
+
}
|
34
|
+
};
|
data/.github/workflows/build.yml
CHANGED
@@ -49,6 +49,12 @@ jobs:
|
|
49
49
|
ruby: 3.0
|
50
50
|
- name: timezone
|
51
51
|
ruby: 3.0
|
52
|
+
- name: performance
|
53
|
+
ruby: 3.0
|
54
|
+
permissive: true
|
55
|
+
fetchdepth: '0'
|
56
|
+
command: bin/rake performance:compare
|
57
|
+
os: ryzen
|
52
58
|
|
53
59
|
# Currently failing:
|
54
60
|
# - ruby: truffleruby
|
@@ -56,9 +62,13 @@ jobs:
|
|
56
62
|
# - ruby: ruby-head
|
57
63
|
|
58
64
|
runs-on: ${{ matrix.combo.os || 'ubuntu-latest' }}
|
65
|
+
continue-on-error: ${{ matrix.combo.permissive || false }}
|
59
66
|
steps:
|
60
67
|
- uses: actions/checkout@v2
|
61
|
-
|
68
|
+
with:
|
69
|
+
fetch-depth: ${{ fromJSON(matrix.combo.fetchdepth || '1') }}
|
70
|
+
- if: ${{ matrix.combo.os != 'ryzen' }}
|
71
|
+
uses: ruby/setup-ruby@v1
|
62
72
|
with:
|
63
73
|
ruby-version: ${{ matrix.combo.ruby }}
|
64
74
|
# NOTE: Bundler 2.2.0 fails to install libv8
|
data/.rubocop.yml
CHANGED
@@ -71,6 +71,7 @@ Layout/CommentIndentation:
|
|
71
71
|
Exclude:
|
72
72
|
- 'lib/opal/rewriters/binary_operator_assignment.rb'
|
73
73
|
- 'lib/opal/rewriters/logical_operator_assignment.rb'
|
74
|
+
- 'lib/opal/source_map/file.rb'
|
74
75
|
|
75
76
|
# We need to support older rubies
|
76
77
|
Layout/IndentHeredoc:
|
@@ -92,6 +93,7 @@ Style/GlobalVars:
|
|
92
93
|
- 'stdlib/nodejs/irb.rb'
|
93
94
|
- 'stdlib/console.rb'
|
94
95
|
- 'stdlib/native.rb'
|
96
|
+
- 'stdlib/await.rb'
|
95
97
|
|
96
98
|
Layout/ExtraSpacing:
|
97
99
|
Exclude:
|
@@ -107,8 +109,9 @@ Layout/SpaceAroundOperators:
|
|
107
109
|
|
108
110
|
Lint/BooleanSymbol:
|
109
111
|
Exclude:
|
110
|
-
# There are AST nodes with types :true and :false
|
112
|
+
# There are AST nodes and rewriters with types :true and :false
|
111
113
|
- 'lib/opal/nodes/**/*.rb'
|
114
|
+
- 'lib/opal/rewriters/**/*.rb'
|
112
115
|
|
113
116
|
Lint/InheritException:
|
114
117
|
Exclude:
|
@@ -123,6 +126,11 @@ Lint/LiteralAsCondition:
|
|
123
126
|
- 'opal/**/*.rb'
|
124
127
|
- 'stdlib/**/*.rb'
|
125
128
|
|
129
|
+
Lint/Loop:
|
130
|
+
Exclude:
|
131
|
+
# This is for optimization purposes mostly
|
132
|
+
- 'opal/corelib/io.rb'
|
133
|
+
|
126
134
|
# Allow the use of if/unless inside blocks
|
127
135
|
Style/Next:
|
128
136
|
Enabled: false
|
@@ -133,6 +141,7 @@ Lint/RescueException:
|
|
133
141
|
- 'opal/corelib/enumerator.rb'
|
134
142
|
# Promises must care about all exceptions
|
135
143
|
- 'stdlib/promise.rb'
|
144
|
+
- 'opal/corelib/binding.rb'
|
136
145
|
|
137
146
|
Lint/StringConversionInInterpolation:
|
138
147
|
Exclude:
|
@@ -411,6 +420,7 @@ Style/ConditionalAssignment:
|
|
411
420
|
Naming/MemoizedInstanceVariableName:
|
412
421
|
Exclude:
|
413
422
|
- lib/opal/parser/patch.rb # it's a monkey-patch on the parser gem
|
423
|
+
- lib/opal/nodes/rescue.rb # we know what we are doing here and no, it's not memoization
|
414
424
|
|
415
425
|
Style/AccessModifierDeclarations:
|
416
426
|
Enabled: false
|
data/CHANGELOG.md
CHANGED
@@ -15,6 +15,170 @@ Changes are grouped as follows:
|
|
15
15
|
|
16
16
|
|
17
17
|
|
18
|
+
## [1.3.0](https://github.com/opal/opal/compare/v1.2.0...v1.3.0) - 2021-10-27
|
19
|
+
|
20
|
+
|
21
|
+
### Added
|
22
|
+
|
23
|
+
- Add support for `retry` ([#2264](https://github.com/opal/opal/pull/2264))
|
24
|
+
- Modernize Exceptions ([#2264](https://github.com/opal/opal/pull/2264))
|
25
|
+
- Add `#cause`, `#backtrace_locations`, `#full_message` to `Exception`
|
26
|
+
- Normalize backtraces across platforms
|
27
|
+
- Add `Thread::Backtrace::Location`
|
28
|
+
- Output Exception#full_message on uncaught exceptions ([#2269](https://github.com/opal/opal/pull/2269))
|
29
|
+
- TracePoint `:class` support ([#2049](https://github.com/opal/opal/pull/2049))
|
30
|
+
- Implement the Flip-Flop operators ([#2261](https://github.com/opal/opal/pull/2261))
|
31
|
+
- Add `JS[]` to access properties on the global object ([#2259](https://github.com/opal/opal/pull/2259))
|
32
|
+
- Add `ENV.fetch` to the Nodejs implementation of `ENV` ([#2259](https://github.com/opal/opal/pull/2259))
|
33
|
+
- Opal::Cache, an optional compiler cache (enabled by default) (#2242, #2278, #2329)
|
34
|
+
- Alias for gvars, alias on main ([#2270](https://github.com/opal/opal/pull/2270))
|
35
|
+
- Support for GJS (GNOME's JavaScript runtime) runner ([#2280](https://github.com/opal/opal/pull/2280))
|
36
|
+
- Scope variables support for `eval()` ([#2256](https://github.com/opal/opal/pull/2256))
|
37
|
+
- Add support for `Kernel#binding` ([#2256](https://github.com/opal/opal/pull/2256))
|
38
|
+
- A (mostly) correct support for refinements ([#2256](https://github.com/opal/opal/pull/2256))
|
39
|
+
- Add support for ECMAScript modules with an `--esm` CLI option ([#2286](https://github.com/opal/opal/pull/2286))
|
40
|
+
- Implement `Regexp#names` and add named captures support ([#2272](https://github.com/opal/opal/pull/2272))
|
41
|
+
- REPL improvements: ([#2285](https://github.com/opal/opal/pull/2285))
|
42
|
+
- Colored output & history support
|
43
|
+
- `ls` to show available constants and variable
|
44
|
+
- Add `Method#===` as an alias to `Method#call`, works the same as `Proc#===` ([#2305](https://github.com/opal/opal/pull/2305))
|
45
|
+
- Add `IO#gets` and `IO#read_proc` along with other supporting methods ([#2309](https://github.com/opal/opal/pull/2309))
|
46
|
+
- Support `#gets` on most platforms, including browsers (via `prompt`)
|
47
|
+
- Move the REPL to a `--repl` CLI option of the main executable
|
48
|
+
- Completely refactor IO, now supporting methods like `#each_line` throughout the entire IO chain
|
49
|
+
- Add a runner for MiniRacer (as `miniracer`)
|
50
|
+
- Support Windows on the Chrome runner
|
51
|
+
- Support Windows on the REPL
|
52
|
+
- Platforms an IO implementations should either set `IO#read_proc` or overwrite `IO#sysread`
|
53
|
+
- [experimental] Add support for JavaScript async/await ([#2221](https://github.com/opal/opal/pull/2221))
|
54
|
+
- Enable the feature by adding a magic comment: `# await: true`
|
55
|
+
- The magic comment can be also used to mark specific method patterns to be awaited
|
56
|
+
(e.g. `# await: *_await, sleep` will make any method ending in `_await` or named `sleep` to be awaited)
|
57
|
+
- Add `Kernel#__await__` as a bridge to the `await` keyword (inspired by CoffeeScript await support)
|
58
|
+
- Require `opal/await` to get additional support
|
59
|
+
- Read more on the newly added documentation page
|
60
|
+
- Better interoperability between legacy Promise (v1) and native Promise (v2) ([#2221](https://github.com/opal/opal/pull/2221))
|
61
|
+
- Add `PromiseV1` as an alias to the original (legacy) Promise class
|
62
|
+
- Add `#to_v1` and `#to_v2` to both classes
|
63
|
+
- `Promise#to_n` will convert it to a native Promise (v2)
|
64
|
+
- Add `Opal::Config.esm` to enable/disable ES modules ([#2316](https://github.com/opal/opal/pull/2316))
|
65
|
+
- If Config.esm is enabled, SimpleServer does type="module"
|
66
|
+
- Add new rack-esm example
|
67
|
+
- Add a QuickJS (https://bellard.org/quickjs/) runner ([#2331](https://github.com/opal/opal/pull/2331))
|
68
|
+
- Add `IO#fileno`, `Method#curry`, `Buffer#to_s`, `Pathname.pwd` ([#2332](https://github.com/opal/opal/pull/2332))
|
69
|
+
- Add NodeJS support for `ARGF`, `ENV.{inspect,to_h,to_hash,merge}`, `File.{delete,unlink}`, `Kernel#system`, <code>Kernel#\`</code>, `Process::Status` ([#2332](https://github.com/opal/opal/pull/2332))
|
70
|
+
- Introduce `__dir__` support ([#2323](https://github.com/opal/opal/pull/2323))
|
71
|
+
- Full autoload support ([#2323](https://github.com/opal/opal/pull/2323))
|
72
|
+
- Now compatible with `opal-zeitwerk` and `isomorfeus`
|
73
|
+
- Allow toplevel autoloads
|
74
|
+
- Allow dynamic autoloads (e.g. can be hooked to fetch a URL upon autoload with a custom loader)
|
75
|
+
- Allow overwriting `require` (e.g. like rubygems does)
|
76
|
+
- Allow autoloading trees with `require_tree "./foo", autoload: true`
|
77
|
+
- Add Module#autoload?
|
78
|
+
- Autoload parts of the corelib ([#2323](https://github.com/opal/opal/pull/2323))
|
79
|
+
|
80
|
+
### Fixed
|
81
|
+
|
82
|
+
- Fixed multiple line `Regexp` literal to not generate invalid syntax as JavaScript ([#1616](https://github.com/opal/opal/pull/1616))
|
83
|
+
- Fix `Kernel#{try,catch}` along with `UncaughtThrowError` ([#2264](https://github.com/opal/opal/pull/2264))
|
84
|
+
- Update source-map-support to fix an off-by-one error ([#2264](https://github.com/opal/opal/pull/2264))
|
85
|
+
- Source map: lines should start from 1, not 0 ([#2273](https://github.com/opal/opal/pull/2273))
|
86
|
+
- Allow for multiple underscored args with the same name in strict mode ([#2292](https://github.com/opal/opal/pull/2292))
|
87
|
+
- Show instance variables in `Kernel#inspect` ([#2285](https://github.com/opal/opal/pull/2285))
|
88
|
+
- `0.digits` was returning an empty array in strict mode ([#2301](https://github.com/opal/opal/pull/2301))
|
89
|
+
- Non Integer numbers were responding to `#digits` ([#2301](https://github.com/opal/opal/pull/2301))
|
90
|
+
- Correctly delete hash members when dealing with boxed strings ([#2306](https://github.com/opal/opal/pull/2306))
|
91
|
+
- Escape string components in interpolated strings (`dstrs`) correctly ([#2308](https://github.com/opal/opal/pull/2308))
|
92
|
+
- Don't try to return the JS `debugger` statement, just return `nil` ([#2307](https://github.com/opal/opal/pull/2307))
|
93
|
+
- Retain the `-` while stringifying `-0.0` ([#2304](https://github.com/opal/opal/pull/2304))
|
94
|
+
- Fix super support for rest args and re-assignments with implicit arguments ([#2315](https://github.com/opal/opal/pull/2315))
|
95
|
+
- Fix calling `Regexp#last_match` when `$~` is nil ([#2328](https://github.com/opal/opal/pull/2328))
|
96
|
+
- Windows support for chrome runner ([#2324](https://github.com/opal/opal/pull/2324))
|
97
|
+
- Use correct node separator for NODE_PATH on Windows
|
98
|
+
- Pass dir and emulate exec a bit on Windows
|
99
|
+
- Use Gem.win_platform?, match supported platform to ruby, simplify run
|
100
|
+
- NodeJS: Drop the first `--` argument in `ARGV` ([#2332](https://github.com/opal/opal/pull/2332))
|
101
|
+
- Fix `Object#require` not pointing to `Kernel#require` ([#2323](https://github.com/opal/opal/pull/2323))
|
102
|
+
|
103
|
+
### Changed
|
104
|
+
|
105
|
+
- Fast-track bad constant names passed to `Struct.new` ([#2259](https://github.com/opal/opal/pull/2259))
|
106
|
+
- Renamed internal `super` related helpers,
|
107
|
+
`find_super_dispatcher` is now `find_super`, `find_iter_super_dispatcher` is now `find_block_super` ([#2090](https://github.com/opal/opal/pull/2090))
|
108
|
+
- The `opal-repl` CLI now requires files to be passed with `--require` (or `-r`) instead of the bare filename ([#2309](https://github.com/opal/opal/pull/2309))
|
109
|
+
- `Process` is now a Module, not a Class - just like in MRI ([#2332](https://github.com/opal/opal/pull/2332))
|
110
|
+
- `s = StringIO.new("a"); s << "b"; s.string` now returns "b", like MRI, but Opal used to return "ab" ([#2309](https://github.com/opal/opal/pull/2309))
|
111
|
+
|
112
|
+
### Deprecated
|
113
|
+
|
114
|
+
### Removed
|
115
|
+
|
116
|
+
### Internal
|
117
|
+
|
118
|
+
- Switch from jshint to ESLint ([#2289](https://github.com/opal/opal/pull/2289))
|
119
|
+
- Switch from UglifyJS to Terser ([#2318](https://github.com/opal/opal/pull/2318))
|
120
|
+
- [CI] Performance regression check (#2276, #2282)
|
121
|
+
|
122
|
+
|
123
|
+
|
124
|
+
|
125
|
+
## [1.2.0](https://github.com/opal/opal/compare/v1.1.1...v1.2.0) - 2021-07-28
|
126
|
+
|
127
|
+
|
128
|
+
### Added
|
129
|
+
|
130
|
+
- Support for multiple arguments in Hash#{merge, merge!, update} ([#2187](https://github.com/opal/opal/pull/2187))
|
131
|
+
- Support for Ruby 3.0 forward arguments: `def a(...) puts(...) end` ([#2153](https://github.com/opal/opal/pull/2153))
|
132
|
+
- Support for beginless and endless ranges: `(1..)`, `(..1)` ([#2150](https://github.com/opal/opal/pull/2150))
|
133
|
+
- Preliminary support for `**nil` argument - see #2240 to note limitations ([#2152](https://github.com/opal/opal/pull/2152))
|
134
|
+
- Support for `Random::Formatters` which add methods `#{hex,base64,urlsafe_base64,uuid,random_float,random_number,alphanumeric}` to `Random` and `SecureRandom` ([#2218](https://github.com/opal/opal/pull/2218))
|
135
|
+
- Basic support for ObjectSpace finalizers and ObjectSpace::WeakMap ([#2247](https://github.com/opal/opal/pull/2247))
|
136
|
+
- A more robust support for encodings (especially binary strings) ([#2235](https://github.com/opal/opal/pull/2235))
|
137
|
+
- Support for `"\x80"` syntax in String literals ([#2235](https://github.com/opal/opal/pull/2235))
|
138
|
+
- Added `String#+@`, `String#-@` ([#2235](https://github.com/opal/opal/pull/2235))
|
139
|
+
- Support for `begin <CODE> end while <CONDITION>` ([#2255](https://github.com/opal/opal/pull/2255))
|
140
|
+
- Added Hash#except and `Hash#except!` ([#2243](https://github.com/opal/opal/pull/2243))
|
141
|
+
- Parser 3.0: Implement pattern matching (as part of this `{Array,Hash,Struct}#{deconstruct,deconstruct_keys} methods were added)` ([#2243](https://github.com/opal/opal/pull/2243))
|
142
|
+
- [experimental] Reimplement Promise to make it bridged with JS native Promise, this new implementation can be used by requiring `promise/v2` ([#2220](https://github.com/opal/opal/pull/2220))
|
143
|
+
|
144
|
+
### Fixed
|
145
|
+
|
146
|
+
- Encoding lookup was working only with uppercase names, not giving any errors for wrong ones (#2181, #2183, #2190)
|
147
|
+
- Fix `Number#to_i` with huge number ([#2191](https://github.com/opal/opal/pull/2191))
|
148
|
+
- Add regexp support to `String#start_with` ([#2198](https://github.com/opal/opal/pull/2198))
|
149
|
+
- `String#bytes` now works in strict mode ([#2194](https://github.com/opal/opal/pull/2194))
|
150
|
+
- Fix nested module inclusion ([#2053](https://github.com/opal/opal/pull/2053))
|
151
|
+
- SecureRandom is now cryptographically secure on most platforms (#2218, #2170)
|
152
|
+
- Fix performance regression for `Array#unshift` on v8 > 7.1 ([#2116](https://github.com/opal/opal/pull/2116))
|
153
|
+
- String subclasses now call `#initialize` with multiple arguments correctly (with a limitation caused by the String immutability issue, that a source string must be the first argument and `#initialize` can't change its value) (#2238, #2185)
|
154
|
+
- Number#step is moved to Numeric ([#2100](https://github.com/opal/opal/pull/2100))
|
155
|
+
- Fix class Class < superclass for invalid superclasses ([#2123](https://github.com/opal/opal/pull/2123))
|
156
|
+
- Fix `String#unpack("U*")` on binary strings with latin1 high characters, fix performance regression on that call (#2235, #2189, #2129, #2099, #2094, #2000, #2128)
|
157
|
+
- Fix `String#to_json` output on some edge cases ([#2235](https://github.com/opal/opal/pull/2235))
|
158
|
+
- Rework class variables to support inheritance correctly ([#2251](https://github.com/opal/opal/pull/2251))
|
159
|
+
- ISO-8859-1 and US-ASCII encodings are now separated as in MRI ([#2235](https://github.com/opal/opal/pull/2235))
|
160
|
+
- `String#b` no longer modifies object strings in-place ([#2235](https://github.com/opal/opal/pull/2235))
|
161
|
+
- Parser::Builder::Default.check_lvar_name patch ([#2195](https://github.com/opal/opal/pull/2195))
|
162
|
+
|
163
|
+
### Changed
|
164
|
+
|
165
|
+
- `String#unpack`, `Array#pack`, `String#chars`, `String#length`, `Number#chr`, and (only partially) `String#+` are now encoding aware ([#2235](https://github.com/opal/opal/pull/2235))
|
166
|
+
- `String#inspect` now uses `\x` for binary stirngs ([#2235](https://github.com/opal/opal/pull/2235))
|
167
|
+
- `if RUBY_ENGINE == "opal"` and friends are now outputing less JS code (#2159, #1965)
|
168
|
+
- `Array`: `to_a`, `slice`/`[]`, `uniq`, `*`, `difference`/`-`, `intersection`/`&`, `union`/`|`, flatten now return Array, not a subclass, as Ruby 3.0 does ([#2237](https://github.com/opal/opal/pull/2237))
|
169
|
+
- `Array`: `difference`, `intersection`, `union` now accept multiple arguments ([#2237](https://github.com/opal/opal/pull/2237))
|
170
|
+
|
171
|
+
### Deprecated
|
172
|
+
|
173
|
+
- Stopped testing Opal on Ruby 2.5 since it reached EOL.
|
174
|
+
|
175
|
+
### Removed
|
176
|
+
|
177
|
+
- Removed support for the outdated `c_lexer`, it was optional and didn't work for the last few releases of parser ([#2235](https://github.com/opal/opal/pull/2235))
|
178
|
+
|
179
|
+
|
180
|
+
|
181
|
+
|
18
182
|
## [1.1.1](https://github.com/opal/opal/compare/v1.1.0...v1.1.1) - 2021-02-23
|
19
183
|
|
20
184
|
|
data/README.md
CHANGED
@@ -116,7 +116,7 @@ your web applications.
|
|
116
116
|
<html>
|
117
117
|
<head>
|
118
118
|
<meta charset="utf-8">
|
119
|
-
<script src="https://cdn.opalrb.com/opal/current/opal.js"
|
119
|
+
<script src="https://cdn.opalrb.com/opal/current/opal.js"></script>
|
120
120
|
<script src="https://cdn.opalrb.com/opal/current/opal-parser.js" onload="Opal.load('opal-parser')"></script>
|
121
121
|
|
122
122
|
<script type="text/ruby">
|
data/Rakefile
CHANGED
data/UNRELEASED.md
CHANGED
@@ -1,46 +1,6 @@
|
|
1
1
|
### Added
|
2
|
-
|
3
|
-
- Support for multiple arguments in Hash#{merge, merge!, update} (#2187)
|
4
|
-
- Support for Ruby 3.0 forward arguments: `def a(...) puts(...) end` (#2153)
|
5
|
-
- Support for beginless and endless ranges: `(1..)`, `(..1)` (#2150)
|
6
|
-
- Preliminary support for `**nil` argument - see #2240 to note limitations (#2152)
|
7
|
-
- Support for `Random::Formatters` which add methods `#{hex,base64,urlsafe_base64,uuid,random_float,random_number,alphanumeric}` to `Random` and `SecureRandom` (#2218)
|
8
|
-
- Basic support for ObjectSpace finalizers and ObjectSpace::WeakMap (#2247)
|
9
|
-
- A more robust support for encodings (especially binary strings) (#2235)
|
10
|
-
- Support for `"\x80"` syntax in String literals (#2235)
|
11
|
-
- Added `String#+@`, `String#-@` (#2235)
|
12
|
-
- Support for `begin <CODE> end while <CONDITION>` (#2255)
|
13
|
-
|
14
2
|
### Fixed
|
15
|
-
|
16
|
-
- Encoding lookup was working only with uppercase names, not giving any errors for wrong ones (#2181, #2183, #2190)
|
17
|
-
- Fix `Number#to_i` with huge number (#2191)
|
18
|
-
- Add regexp support to `String#start_with` (#2198)
|
19
|
-
- `String#bytes` now works in strict mode (#2194)
|
20
|
-
- Fix nested module inclusion (#2053)
|
21
|
-
- SecureRandom is now cryptographically secure on most platforms (#2218, #2170)
|
22
|
-
- Fix performance regression for `Array#unshift` on v8 > 7.1 (#2116)
|
23
|
-
- String subclasses now call `#initialize` with multiple arguments correctly (with a limitation caused by the String immutability issue, that a source string must be the first argument and `#initialize` can't change its value) (#2238, #2185)
|
24
|
-
- Number#step is moved to Numeric (#2100)
|
25
|
-
- Fix class Class < superclass for invalid superclasses (#2123)
|
26
|
-
- Fix `String#unpack("U*")` on binary strings with latin1 high characters, fix performance regression on that call (#2235, #2189, #2129, #2099, #2094, #2000, #2128)
|
27
|
-
- Fix `String#to_json` output on some edge cases (#2235)
|
28
|
-
- Rework class variables to support inheritance correctly (#2251)
|
29
|
-
- ISO-8859-1 and US-ASCII encodings are now separated as in MRI (#2235)
|
30
|
-
- `String#b` no longer modifies object strings in-place (#2235)
|
31
|
-
|
32
3
|
### Changed
|
33
|
-
|
34
|
-
- `String#unpack`, `Array#pack`, `String#chars`, `String#length`, `Number#chr`, and (only partially) `String#+` are now encoding aware (#2235)
|
35
|
-
- `String#inspect` now uses `\x` for binary stirngs (#2235)
|
36
|
-
- `if RUBY_ENGINE == "opal"` and friends are now outputing less JS code (#2159, #1965)
|
37
|
-
- `Array`: `to_a`, `slice`/`[]`, `uniq`, `*`, `difference`/`-`, `intersection`/`&`, `union`/`|`, flatten now return Array, not a subclass, as Ruby 3.0 does (#2237)
|
38
|
-
- `Array`: `difference`, `intersection`, `union` now accept multiple arguments (#2237)
|
39
|
-
|
40
4
|
### Deprecated
|
41
|
-
|
42
|
-
- Stopped testing Opal on Ruby 2.5 since it reached EOL.
|
43
|
-
|
44
5
|
### Removed
|
45
|
-
|
46
|
-
- Removed support for the outdated `c_lexer`, it was optional and didn't work for the last few releases of parser (#2235)
|
6
|
+
### Internal
|
data/docs/async.md
ADDED
@@ -0,0 +1,109 @@
|
|
1
|
+
# Asynchronous code (PromiseV2 / async / await)
|
2
|
+
|
3
|
+
Please be aware that this functionality is marked as experimental and may change
|
4
|
+
in the future.
|
5
|
+
|
6
|
+
In order to disable the warnings that will be shown if you use those experimental
|
7
|
+
features, add the following line before requiring `promise/v2` or `await` and after
|
8
|
+
requiring `opal`.
|
9
|
+
|
10
|
+
```ruby
|
11
|
+
`Opal.config.experimental_features_severity = 'ignore'`
|
12
|
+
```
|
13
|
+
|
14
|
+
## PromiseV2
|
15
|
+
|
16
|
+
In Opal 1.2 we introduced PromiseV2 which is to replace the default Promise in Opal 2.0
|
17
|
+
(which will become PromiseV1). Right now it's experimental, but the interface of PromiseV1
|
18
|
+
stay unchanged and will continue to be supported.
|
19
|
+
|
20
|
+
It is imperative that during the transition period you either `require 'promise/v1'` or
|
21
|
+
`require 'promise/v2'` and then use either `PromiseV1` or `PromiseV2`.
|
22
|
+
|
23
|
+
If you write library code it's imperative that you don't require the promise itself, but
|
24
|
+
detect if `PromiseV2` is defined and use the newer implementation, for instance using the
|
25
|
+
following code:
|
26
|
+
|
27
|
+
```ruby
|
28
|
+
module MyLibrary
|
29
|
+
Promise = defined?(PromiseV2) ? PromiseV2 : ::Promise
|
30
|
+
end
|
31
|
+
```
|
32
|
+
|
33
|
+
The difference between `PromiseV1` and `PromiseV2` is that `PromiseV1` is a pure-Ruby
|
34
|
+
implementation of a Promise, while `PromiseV2` is reusing the JavaScript `Promise`. Both are
|
35
|
+
incompatible with each other, but `PromiseV2` can be awaited (see below) and they translate
|
36
|
+
1 to 1 to the JavaScript native `Promise` (they are bridged; you can directly return a
|
37
|
+
`Promise` from JavaScript API without a need to translate it). The other difference is that
|
38
|
+
`PromiseV2` always runs a `#then` block a tick later, while `PromiseV1` would could run it
|
39
|
+
instantaneously.
|
40
|
+
|
41
|
+
## Async/await
|
42
|
+
|
43
|
+
In Opal 1.3 we implemented the CoffeeScript pattern of async/await. As of now, it's hidden
|
44
|
+
behind a magic comment, but this behavior may change in the future.
|
45
|
+
|
46
|
+
Example:
|
47
|
+
|
48
|
+
```ruby
|
49
|
+
# await: true
|
50
|
+
|
51
|
+
require "await"
|
52
|
+
|
53
|
+
def wait_5_seconds
|
54
|
+
puts "Let's wait 5 seconds..."
|
55
|
+
sleep(5).await
|
56
|
+
puts "Done!"
|
57
|
+
end
|
58
|
+
|
59
|
+
wait_5_seconds.__await__
|
60
|
+
```
|
61
|
+
|
62
|
+
It's important to understand what happens under the hood: every scope in which `#__await__` is
|
63
|
+
encountered will become async, which means that it will return a Promise that will resolve
|
64
|
+
to a value. This includes methods, blocks and the top scope. This means, that `#__await__` is
|
65
|
+
infectious and you need to remember to `#__await__` everything along the way, otherwise
|
66
|
+
a program will finish too early and the values may be incorrect.
|
67
|
+
|
68
|
+
[You can take a look at how we ported Minitest to support asynchronous tests.](https://github.com/opal/opal/pull/2221/commits/8383c7b45a94fe4628778f429508b9c08c8948b0) Take note, that
|
69
|
+
it was ported to use `#await` while the finally accepted version uses `#__await__`.
|
70
|
+
|
71
|
+
It is certainly correct to `#__await__` any value, including non-Promises, for instance
|
72
|
+
`5.__await__` will correctly resolve to `5` (except that it will make the scope an async
|
73
|
+
function, with all the limitations described above).
|
74
|
+
|
75
|
+
The `await` stdlib module includes a few useful functions, like async-aware `each_await`
|
76
|
+
function and `sleep` that doesn't block the thread. It also includes a method `#await`
|
77
|
+
which is an alias of `#itself` - it makes sense to auto-await that method.
|
78
|
+
|
79
|
+
This approach is certainly incompatible with what Ruby does, but due to a dynamic nature
|
80
|
+
of Ruby and a different model of JavaScript this was the least invasive way to catch up
|
81
|
+
with the latest JavaScript trends and support `Promise` heavy APIs and asynchronous code.
|
82
|
+
|
83
|
+
## Auto-await
|
84
|
+
|
85
|
+
The magic comment also accepts a comma-separated list of methods to be automatically
|
86
|
+
awaited. An individual value can contain a wildcard character `*`. For instance,
|
87
|
+
those two blocks of code are equivalent:
|
88
|
+
|
89
|
+
```ruby
|
90
|
+
# await: true
|
91
|
+
|
92
|
+
require "await"
|
93
|
+
|
94
|
+
[1,2,3].each_await do |i|
|
95
|
+
p i
|
96
|
+
sleep(i).__await__
|
97
|
+
end.__await__
|
98
|
+
```
|
99
|
+
|
100
|
+
```ruby
|
101
|
+
# await: sleep, *await*
|
102
|
+
|
103
|
+
require "await"
|
104
|
+
|
105
|
+
[1,2,3].each_await do |i|
|
106
|
+
p i
|
107
|
+
sleep i
|
108
|
+
end
|
109
|
+
```
|
data/docs/roda-sprockets.md
CHANGED
data/examples/rack/Gemfile
CHANGED
data/examples/rack/Gemfile.lock
CHANGED
@@ -1,24 +1,28 @@
|
|
1
1
|
PATH
|
2
2
|
remote: ../..
|
3
3
|
specs:
|
4
|
-
opal (1.0.
|
4
|
+
opal (1.3.0.dev)
|
5
5
|
ast (>= 2.3.0)
|
6
|
-
parser (~>
|
6
|
+
parser (~> 3.0)
|
7
7
|
|
8
8
|
GEM
|
9
9
|
remote: https://rubygems.org/
|
10
10
|
specs:
|
11
|
-
ast (2.4.
|
12
|
-
|
13
|
-
|
14
|
-
|
11
|
+
ast (2.4.2)
|
12
|
+
nio4r (2.5.8)
|
13
|
+
parser (3.0.2.0)
|
14
|
+
ast (~> 2.4.1)
|
15
|
+
puma (5.5.0)
|
16
|
+
nio4r (~> 2.0)
|
17
|
+
rack (2.2.3)
|
15
18
|
|
16
19
|
PLATFORMS
|
17
20
|
ruby
|
18
21
|
|
19
22
|
DEPENDENCIES
|
20
23
|
opal!
|
24
|
+
puma
|
21
25
|
rack
|
22
26
|
|
23
27
|
BUNDLED WITH
|
24
|
-
1.
|
28
|
+
2.1.4
|
@@ -0,0 +1 @@
|
|
1
|
+
tmp
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'opal'
|
2
|
+
require 'user'
|
3
|
+
require 'opal/platform'
|
4
|
+
|
5
|
+
module MyApp
|
6
|
+
class Application
|
7
|
+
def initialize
|
8
|
+
@user = User.new('Bob')
|
9
|
+
end
|
10
|
+
|
11
|
+
def title
|
12
|
+
"#{@user.name} is #{:not unless @user.authenticated?} authenticated"
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
$app = MyApp::Application.new
|
18
|
+
|
19
|
+
require 'native'
|
20
|
+
|
21
|
+
$$[:document][:title] = "#{$app.title}"
|
22
|
+
|
23
|
+
bill = User.new('Bill')
|
24
|
+
|
25
|
+
$$.alert "The user is named #{bill.name}."
|
26
|
+
|
27
|
+
bill.authenticated?
|
@@ -0,0 +1,24 @@
|
|
1
|
+
class User
|
2
|
+
def initialize(name)
|
3
|
+
puts "wow"
|
4
|
+
@name = name
|
5
|
+
end
|
6
|
+
|
7
|
+
attr_reader :name
|
8
|
+
|
9
|
+
def authenticated?
|
10
|
+
if admin? or special_permission?
|
11
|
+
true
|
12
|
+
else
|
13
|
+
raise "not authenticated"
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def admin?
|
18
|
+
@name == 'Bob'
|
19
|
+
end
|
20
|
+
|
21
|
+
def special_permission?
|
22
|
+
false
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'bundler'
|
2
|
+
Bundler.require
|
3
|
+
|
4
|
+
# Instructions: bundle in this directory
|
5
|
+
# then run `bundle exec rackup` to start the server
|
6
|
+
# and browse to http://localhost:9292
|
7
|
+
|
8
|
+
# a very small application that just tries to authenticate a user and fails
|
9
|
+
# it just writes to the console in the browser (no visible html)
|
10
|
+
|
11
|
+
# with gems like opal-jquery or opal-browser you could manipulate the dom directly
|
12
|
+
|
13
|
+
# the directory where the code is (add to opal load path )
|
14
|
+
Opal.append_path 'app'
|
15
|
+
|
16
|
+
# Enable ESM
|
17
|
+
Opal::Config.esm = true
|
18
|
+
|
19
|
+
run Opal::SimpleServer.new { |s|
|
20
|
+
# the name of the ruby file to load. To use more files they must be required from here (see app)
|
21
|
+
s.main = 'application'
|
22
|
+
# need to set the index explicitly for opal server to pick it up
|
23
|
+
s.index_path = 'index.html.erb'
|
24
|
+
}
|
25
|
+
|