opal 1.0.0.beta1 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +11 -2
- data/README.md +28 -20
- data/UNRELEASED.md +9 -1
- data/lib/opal/cli_runners/chrome.js +1 -1
- data/lib/opal/version.rb +1 -1
- data/opal.gemspec +1 -1
- data/opal/corelib/constants.rb +2 -2
- data/opal/corelib/error.rb +4 -0
- data/opal/corelib/runtime.js +33 -33
- data/opal/corelib/string.rb +12 -1
- data/opal/corelib/string/encoding.rb +16 -0
- data/opal/corelib/time.rb +1 -1
- data/stdlib/native.rb +1 -2
- data/stdlib/nodejs/stacktrace.rb +1 -1
- data/tasks/testing.rake +1 -0
- metadata +10 -10
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b19165946a12d9809dfc921cb6a493f43341604eee8be9e88a464dd7544be303
|
|
4
|
+
data.tar.gz: 89bb5ea2d36bc47b12694506c1473f03e367fae8e5568e304c8ee1f2e9ec4019
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 0fdd6c709d32eea146ed3bee706d9306c4aab8646dde7f7188a5d16a4c1970a58889211c7f6f1d2cce7491e7e942b73444412817a8ecab395901e446ef27a6ce
|
|
7
|
+
data.tar.gz: a827e8d5f9a640dee5cf24dd7b5b5b9c7a5cbe0cead3138d8827e6efa27a930fc99e90848467011a583970b4bd9b8bb0b8c66b3d0fa6d36334144d4c05be2d18
|
data/CHANGELOG.md
CHANGED
|
@@ -15,8 +15,7 @@ Changes are grouped as follows:
|
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
|
|
18
|
-
## [
|
|
19
|
-
|
|
18
|
+
## [1.0.0](https://github.com/opal/opal/compare/v0.11.4...v1.0.0) - 2019-05-12
|
|
20
19
|
|
|
21
20
|
<!--
|
|
22
21
|
Whitespace conventions:
|
|
@@ -149,6 +148,16 @@ Whitespace conventions:
|
|
|
149
148
|
- Fixed compilation of empty/whitespace-only x-strings ([#1811](https://github.com/opal/opal/pull/1811))
|
|
150
149
|
- Fix `||=` assignments on constants when the constant is not yet defined ([#1935](https://github.com/opal/opal/pull/1935))
|
|
151
150
|
- Fix `String#chomp` to return an empty String when `arg == self` ([#1936](https://github.com/opal/opal/pull/1936))
|
|
151
|
+
- Fix methods of `Comparable` when `<=>` does not return Numeric ([#1945](https://github.com/opal/opal/pull/1945))
|
|
152
|
+
- Fix `Class#native_alias` error message ([#1946](https://github.com/opal/opal/pull/1946))
|
|
153
|
+
- Fix `gmt_offset` (alias `utc_offset`) should return 0 if the date is UTC ([#1941](https://github.com/opal/opal/pull/1941))
|
|
154
|
+
- `exceptionDetails.stackTrace` can be undefined ([#1955](https://github.com/opal/opal/pull/1955))
|
|
155
|
+
- Implement `String#each_codepoint` and `String#codepoints` (#1944, #1947)
|
|
156
|
+
- [internal] Terminate statement with semi-colon and remove unecessary semi-colon ([#1948](https://github.com/opal/opal/pull/1948))
|
|
157
|
+
- Some steps toward "strict mode" ([#1953](https://github.com/opal/opal/pull/1953))
|
|
158
|
+
- Preserve `Exception.stack`, in some cases the backtrace was lost ([#1963](https://github.com/opal/opal/pull/1963))
|
|
159
|
+
- Make `String#ascii_only?` a little less wrong ([#1951](https://github.com/opal/opal/pull/1951))
|
|
160
|
+
- Minor fixes to `::Native` ([#1957](https://github.com/opal/opal/pull/1957))
|
|
152
161
|
|
|
153
162
|
|
|
154
163
|
|
data/README.md
CHANGED
|
@@ -1,23 +1,31 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
Opal is a Ruby to JavaScript source-to-source compiler
|
|
11
|
-
implementation of the Ruby corelib
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
1
|
+
<h1 align="center">
|
|
2
|
+
<img src="https://secure.gravatar.com/avatar/88298620949a6534d403da2e356c9339?s=420"
|
|
3
|
+
align="center" title="Opal logo by Elia Schito" width="105" height="105" />
|
|
4
|
+
<br/>
|
|
5
|
+
Opal <br/>
|
|
6
|
+
<img src="https://img.shields.io/badge/Opal-Ruby%20💛%20JavaScript-yellow.svg?logo=ruby&style=social&logoColor=777"/>
|
|
7
|
+
</h1>
|
|
8
|
+
|
|
9
|
+
<p align="center">
|
|
10
|
+
<em><strong>Opal</strong> is a Ruby to JavaScript source-to-source compiler.<br>
|
|
11
|
+
It also has an implementation of the Ruby <code>corelib</code> and <code>stdlib</code>.</em>
|
|
12
|
+
</p>
|
|
13
|
+
|
|
14
|
+
<p align="center">
|
|
15
|
+
<strong>Community:</strong><br>
|
|
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>
|
|
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
|
+
<a href="https://opalrb.com/docs"><img src="https://img.shields.io/badge/docs-updated-blue.svg" alt="Documentation" title="" /></a>
|
|
21
|
+
<br>
|
|
22
|
+
<strong>Code:</strong><br>
|
|
23
|
+
<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://travis-ci.org/opal/opal"><img src="https://img.shields.io/travis/opal/opal/master.svg?style=flat" alt="Build Status (Linux)" title="" /></a>
|
|
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>
|
|
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=elia%2Fcoveralls"><img src="https://coveralls.io/repos/opal/opal/badge.svg?branch=master&service=github" alt="Coverage Status" title="" /></a>
|
|
28
|
+
</p>
|
|
21
29
|
|
|
22
30
|
## Usage
|
|
23
31
|
|
data/UNRELEASED.md
CHANGED
|
@@ -130,4 +130,12 @@ Whitespace conventions:
|
|
|
130
130
|
- Fix `||=` assignments on constants when the constant is not yet defined (#1935)
|
|
131
131
|
- Fix `String#chomp` to return an empty String when `arg == self` (#1936)
|
|
132
132
|
- Fix methods of `Comparable` when `<=>` does not return Numeric (#1945)
|
|
133
|
-
- Fix Class#native_alias error message (#1946)
|
|
133
|
+
- Fix `Class#native_alias` error message (#1946)
|
|
134
|
+
- Fix `gmt_offset` (alias `utc_offset`) should return 0 if the date is UTC (#1941)
|
|
135
|
+
- `exceptionDetails.stackTrace` can be undefined (#1955)
|
|
136
|
+
- Implement `String#each_codepoint` and `String#codepoints` (#1944, #1947)
|
|
137
|
+
- [internal] Terminate statement with semi-colon and remove unecessary semi-colon (#1948)
|
|
138
|
+
- Some steps toward "strict mode" (#1953)
|
|
139
|
+
- Preserve `Exception.stack`, in some cases the backtrace was lost (#1963)
|
|
140
|
+
- Make `String#ascii_only?` a little less wrong (#1951)
|
|
141
|
+
- Minor fixes to `::Native` (#1957)
|
|
@@ -91,7 +91,7 @@ CDP(options, function(client) {
|
|
|
91
91
|
Runtime.exceptionThrown(function(exception) {
|
|
92
92
|
var exceptionDetails = exception.exceptionDetails,
|
|
93
93
|
properties = exceptionDetails.exception.preview.properties,
|
|
94
|
-
stackTrace = exceptionDetails.stackTrace.callFrames,
|
|
94
|
+
stackTrace = exceptionDetails.stackTrace ? exceptionDetails.stackTrace.callFrames : [],
|
|
95
95
|
name, message, trace = [], i;
|
|
96
96
|
|
|
97
97
|
|
data/lib/opal/version.rb
CHANGED
data/opal.gemspec
CHANGED
|
@@ -33,7 +33,7 @@ Gem::Specification.new do |spec|
|
|
|
33
33
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
|
34
34
|
spec.require_paths = ['lib']
|
|
35
35
|
|
|
36
|
-
spec.required_ruby_version = '>= 2.
|
|
36
|
+
spec.required_ruby_version = '>= 2.3'
|
|
37
37
|
|
|
38
38
|
spec.add_dependency 'ast', '>= 2.3.0'
|
|
39
39
|
spec.add_dependency 'parser', '= 2.5.3.0'
|
data/opal/corelib/constants.rb
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
RUBY_PLATFORM = 'opal'
|
|
2
2
|
RUBY_ENGINE = 'opal'
|
|
3
3
|
RUBY_VERSION = '2.5.3'
|
|
4
|
-
RUBY_ENGINE_VERSION = '1.0.0
|
|
5
|
-
RUBY_RELEASE_DATE = '2019-
|
|
4
|
+
RUBY_ENGINE_VERSION = '1.0.0'
|
|
5
|
+
RUBY_RELEASE_DATE = '2019-05-12'
|
|
6
6
|
RUBY_PATCHLEVEL = 0
|
|
7
7
|
RUBY_REVISION = 0
|
|
8
8
|
RUBY_COPYRIGHT = 'opal - Copyright (C) 2013-2019 Adam Beynon and the Opal contributors'
|
data/opal/corelib/error.rb
CHANGED
|
@@ -61,6 +61,7 @@ class Exception < `Error`
|
|
|
61
61
|
|
|
62
62
|
var cloned = #{clone};
|
|
63
63
|
cloned.message = str;
|
|
64
|
+
cloned.stack = self.stack;
|
|
64
65
|
return cloned;
|
|
65
66
|
}
|
|
66
67
|
end
|
|
@@ -81,8 +82,10 @@ class Exception < `Error`
|
|
|
81
82
|
|
|
82
83
|
if (backtrace === nil) {
|
|
83
84
|
self.backtrace = nil;
|
|
85
|
+
self.stack = '';
|
|
84
86
|
} else if (backtrace.$$is_string) {
|
|
85
87
|
self.backtrace = [backtrace];
|
|
88
|
+
self.stack = backtrace;
|
|
86
89
|
} else {
|
|
87
90
|
if (backtrace.$$is_array) {
|
|
88
91
|
for (i = 0, ii = backtrace.length; i < ii; i++) {
|
|
@@ -100,6 +103,7 @@ class Exception < `Error`
|
|
|
100
103
|
}
|
|
101
104
|
|
|
102
105
|
self.backtrace = backtrace;
|
|
106
|
+
self.stack = backtrace.join('\n');
|
|
103
107
|
}
|
|
104
108
|
|
|
105
109
|
return backtrace;
|
data/opal/corelib/runtime.js
CHANGED
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
missing_require_severity: 'error', // error, warning, ignore
|
|
64
64
|
unsupported_features_severity: 'warning', // error, warning, ignore
|
|
65
65
|
enable_stack_trace: true // true, false
|
|
66
|
-
}
|
|
66
|
+
};
|
|
67
67
|
|
|
68
68
|
// Minify common function calls
|
|
69
69
|
var $hasOwn = Object.hasOwnProperty;
|
|
@@ -90,7 +90,7 @@
|
|
|
90
90
|
if (obj.$$is_number) return (obj * 2)+1;
|
|
91
91
|
if (obj.$$id != null) {
|
|
92
92
|
return obj.$$id;
|
|
93
|
-
}
|
|
93
|
+
}
|
|
94
94
|
$defineProperty(obj, '$$id', Opal.uid());
|
|
95
95
|
return obj.$$id;
|
|
96
96
|
};
|
|
@@ -109,7 +109,7 @@
|
|
|
109
109
|
// Pops an exception from the stack and updates `$!`.
|
|
110
110
|
Opal.pop_exception = function() {
|
|
111
111
|
Opal.gvars["!"] = Opal.exceptions.pop() || nil;
|
|
112
|
-
}
|
|
112
|
+
};
|
|
113
113
|
|
|
114
114
|
// Inspect any kind of object, including non Ruby ones
|
|
115
115
|
Opal.inspect = function(obj) {
|
|
@@ -125,7 +125,7 @@
|
|
|
125
125
|
else {
|
|
126
126
|
return obj.$inspect();
|
|
127
127
|
}
|
|
128
|
-
}
|
|
128
|
+
};
|
|
129
129
|
|
|
130
130
|
function $defineProperty(object, name, initialValue) {
|
|
131
131
|
if (typeof(object) === "string") {
|
|
@@ -239,7 +239,7 @@
|
|
|
239
239
|
|
|
240
240
|
result = const_get_name(cref, name); if (result != null) return result;
|
|
241
241
|
result = const_missing(cref, name, skip_missing); if (result != null) return result;
|
|
242
|
-
}
|
|
242
|
+
};
|
|
243
243
|
|
|
244
244
|
// Look for the constant relative to a cref or call `#const_missing` (when the
|
|
245
245
|
// constant is prefixed by `::`).
|
|
@@ -453,10 +453,10 @@
|
|
|
453
453
|
// If superclass has metaclass then we have explicitely inherit it.
|
|
454
454
|
Opal.build_class_singleton_class(klass);
|
|
455
455
|
}
|
|
456
|
-
}
|
|
456
|
+
}
|
|
457
457
|
|
|
458
458
|
return klass;
|
|
459
|
-
}
|
|
459
|
+
};
|
|
460
460
|
|
|
461
461
|
|
|
462
462
|
function find_existing_class(scope, name) {
|
|
@@ -528,7 +528,7 @@
|
|
|
528
528
|
}
|
|
529
529
|
|
|
530
530
|
return klass;
|
|
531
|
-
}
|
|
531
|
+
};
|
|
532
532
|
|
|
533
533
|
// Define new module (or return existing module). The given `scope` is basically
|
|
534
534
|
// the current `self` value the `module` statement was defined in. If this is
|
|
@@ -575,7 +575,7 @@
|
|
|
575
575
|
$setPrototype(module, Opal.Module.prototype);
|
|
576
576
|
|
|
577
577
|
return module;
|
|
578
|
-
}
|
|
578
|
+
};
|
|
579
579
|
|
|
580
580
|
function find_existing_module(scope, name) {
|
|
581
581
|
var module = const_get_name(scope, name);
|
|
@@ -612,7 +612,7 @@
|
|
|
612
612
|
Opal.const_set(scope, name, module);
|
|
613
613
|
|
|
614
614
|
return module;
|
|
615
|
-
}
|
|
615
|
+
};
|
|
616
616
|
|
|
617
617
|
// Return the singleton class for the passed object.
|
|
618
618
|
//
|
|
@@ -687,7 +687,7 @@
|
|
|
687
687
|
$defineProperty(mod, '$$class', Opal.Module);
|
|
688
688
|
|
|
689
689
|
return meta;
|
|
690
|
-
}
|
|
690
|
+
};
|
|
691
691
|
|
|
692
692
|
// Build the singleton class for a Ruby (non class) Object.
|
|
693
693
|
//
|
|
@@ -711,7 +711,7 @@
|
|
|
711
711
|
|
|
712
712
|
Opal.is_method = function(prop) {
|
|
713
713
|
return (prop[0] === '$' && prop[1] !== '$');
|
|
714
|
-
}
|
|
714
|
+
};
|
|
715
715
|
|
|
716
716
|
Opal.instance_methods = function(mod) {
|
|
717
717
|
var exclude = [], results = [], ancestors = Opal.ancestors(mod);
|
|
@@ -745,7 +745,7 @@
|
|
|
745
745
|
}
|
|
746
746
|
|
|
747
747
|
return results;
|
|
748
|
-
}
|
|
748
|
+
};
|
|
749
749
|
|
|
750
750
|
Opal.own_instance_methods = function(mod) {
|
|
751
751
|
var results = [],
|
|
@@ -771,22 +771,22 @@
|
|
|
771
771
|
}
|
|
772
772
|
|
|
773
773
|
return results;
|
|
774
|
-
}
|
|
774
|
+
};
|
|
775
775
|
|
|
776
776
|
Opal.methods = function(obj) {
|
|
777
777
|
return Opal.instance_methods(Opal.get_singleton_class(obj));
|
|
778
|
-
}
|
|
778
|
+
};
|
|
779
779
|
|
|
780
780
|
Opal.own_methods = function(obj) {
|
|
781
781
|
return Opal.own_instance_methods(Opal.get_singleton_class(obj));
|
|
782
|
-
}
|
|
782
|
+
};
|
|
783
783
|
|
|
784
784
|
Opal.receiver_methods = function(obj) {
|
|
785
785
|
var mod = Opal.get_singleton_class(obj);
|
|
786
786
|
var singleton_methods = Opal.own_instance_methods(mod);
|
|
787
787
|
var instance_methods = Opal.own_instance_methods(mod.$$super);
|
|
788
788
|
return singleton_methods.concat(instance_methods);
|
|
789
|
-
}
|
|
789
|
+
};
|
|
790
790
|
|
|
791
791
|
// Returns an object containing all pairs of names/values
|
|
792
792
|
// for all class variables defined in provided +module+
|
|
@@ -808,7 +808,7 @@
|
|
|
808
808
|
}
|
|
809
809
|
|
|
810
810
|
return result;
|
|
811
|
-
}
|
|
811
|
+
};
|
|
812
812
|
|
|
813
813
|
// Sets class variable with specified +name+ to +value+
|
|
814
814
|
// in provided +module+
|
|
@@ -832,7 +832,7 @@
|
|
|
832
832
|
module.$$cvars[name] = value;
|
|
833
833
|
|
|
834
834
|
return value;
|
|
835
|
-
}
|
|
835
|
+
};
|
|
836
836
|
|
|
837
837
|
function isRoot(proto) {
|
|
838
838
|
return proto.hasOwnProperty('$$iclass') && proto.hasOwnProperty('$$root');
|
|
@@ -976,7 +976,7 @@
|
|
|
976
976
|
includer.$$own_included_modules = own_included_modules(includer);
|
|
977
977
|
|
|
978
978
|
Opal.const_cache_version++;
|
|
979
|
-
}
|
|
979
|
+
};
|
|
980
980
|
|
|
981
981
|
Opal.prepend_features = function(module, prepender) {
|
|
982
982
|
// Here we change the ancestors chain from
|
|
@@ -1064,7 +1064,7 @@
|
|
|
1064
1064
|
prepender.$$own_prepended_modules = own_prepended_modules(prepender);
|
|
1065
1065
|
|
|
1066
1066
|
Opal.const_cache_version++;
|
|
1067
|
-
}
|
|
1067
|
+
};
|
|
1068
1068
|
|
|
1069
1069
|
function flush_methods_in(module) {
|
|
1070
1070
|
var proto = module.$$prototype,
|
|
@@ -1222,7 +1222,7 @@
|
|
|
1222
1222
|
module.$$ancestors = result;
|
|
1223
1223
|
|
|
1224
1224
|
return result;
|
|
1225
|
-
}
|
|
1225
|
+
};
|
|
1226
1226
|
|
|
1227
1227
|
Opal.included_modules = function(module) {
|
|
1228
1228
|
var result = [], mod = null, proto = Object.getPrototypeOf(module.$$prototype);
|
|
@@ -1235,7 +1235,7 @@
|
|
|
1235
1235
|
}
|
|
1236
1236
|
|
|
1237
1237
|
return result;
|
|
1238
|
-
}
|
|
1238
|
+
};
|
|
1239
1239
|
|
|
1240
1240
|
|
|
1241
1241
|
// Method Missing
|
|
@@ -1608,7 +1608,7 @@
|
|
|
1608
1608
|
else {
|
|
1609
1609
|
return Opal.hash2([], {});
|
|
1610
1610
|
}
|
|
1611
|
-
}
|
|
1611
|
+
};
|
|
1612
1612
|
|
|
1613
1613
|
// Used to get a list of rest keyword arguments. Method takes the given
|
|
1614
1614
|
// keyword args, i.e. the hash literal passed to the method containing all
|
|
@@ -1624,7 +1624,7 @@
|
|
|
1624
1624
|
Opal.kwrestargs = function(given_args, used_args) {
|
|
1625
1625
|
var keys = [],
|
|
1626
1626
|
map = {},
|
|
1627
|
-
key
|
|
1627
|
+
key ,
|
|
1628
1628
|
given_map = given_args.$$smap;
|
|
1629
1629
|
|
|
1630
1630
|
for (key in given_map) {
|
|
@@ -1672,12 +1672,12 @@
|
|
|
1672
1672
|
}
|
|
1673
1673
|
|
|
1674
1674
|
return recv.$method_missing.apply(recv, [method].concat(args));
|
|
1675
|
-
}
|
|
1675
|
+
};
|
|
1676
1676
|
|
|
1677
1677
|
Opal.lambda = function(block) {
|
|
1678
1678
|
block.$$is_lambda = true;
|
|
1679
1679
|
return block;
|
|
1680
|
-
}
|
|
1680
|
+
};
|
|
1681
1681
|
|
|
1682
1682
|
// Used to define methods on an object. This is a helper method, used by the
|
|
1683
1683
|
// compiled source to define methods on special case objects when the compiler
|
|
@@ -1759,7 +1759,7 @@
|
|
|
1759
1759
|
else if (singleton_of && singleton_of.$singleton_method_added && !singleton_of.$singleton_method_added.$$stub) {
|
|
1760
1760
|
singleton_of.$singleton_method_added(jsid.substr(1));
|
|
1761
1761
|
}
|
|
1762
|
-
}
|
|
1762
|
+
};
|
|
1763
1763
|
|
|
1764
1764
|
// Define a singleton method on the given object (see Opal.def).
|
|
1765
1765
|
Opal.defs = function(obj, jsid, body) {
|
|
@@ -2342,10 +2342,10 @@
|
|
|
2342
2342
|
|
|
2343
2343
|
// Initialization
|
|
2344
2344
|
// --------------
|
|
2345
|
-
function $BasicObject() {}
|
|
2346
|
-
function $Object() {}
|
|
2347
|
-
function $Module() {}
|
|
2348
|
-
function $Class() {}
|
|
2345
|
+
function $BasicObject() {}
|
|
2346
|
+
function $Object() {}
|
|
2347
|
+
function $Module() {}
|
|
2348
|
+
function $Class() {}
|
|
2349
2349
|
|
|
2350
2350
|
Opal.BasicObject = BasicObject = Opal.allocate_class('BasicObject', null, $BasicObject);
|
|
2351
2351
|
Opal.Object = _Object = Opal.allocate_class('Object', Opal.BasicObject, $Object);
|
|
@@ -2398,7 +2398,7 @@
|
|
|
2398
2398
|
|
|
2399
2399
|
|
|
2400
2400
|
// Nil
|
|
2401
|
-
function $NilClass() {}
|
|
2401
|
+
function $NilClass() {}
|
|
2402
2402
|
Opal.NilClass = Opal.allocate_class('NilClass', Opal.Object, $NilClass);
|
|
2403
2403
|
Opal.const_set(_Object, 'NilClass', Opal.NilClass);
|
|
2404
2404
|
nil = Opal.nil = new Opal.NilClass();
|
data/opal/corelib/string.rb
CHANGED
|
@@ -691,7 +691,18 @@ class String < `String`
|
|
|
691
691
|
end
|
|
692
692
|
|
|
693
693
|
def ascii_only?
|
|
694
|
-
|
|
694
|
+
# non-ASCII-compatible encoding must return false
|
|
695
|
+
# NOTE: Encoding::UTF_16LE is also non-ASCII-compatible encoding,
|
|
696
|
+
# but since the default encoding in JavaScript is UTF_16LE,
|
|
697
|
+
# we cannot return false otherwise the following will (incorrectly) return false: "hello".ascii_only?
|
|
698
|
+
# In other words, we cannot tell the difference between:
|
|
699
|
+
# - "hello".force_encoding("UTF-16LE")
|
|
700
|
+
# - "hello"
|
|
701
|
+
# The problem is that "ascii_only" should return false in the first case and true in the second case.
|
|
702
|
+
if encoding == Encoding::UTF_16BE
|
|
703
|
+
return false
|
|
704
|
+
end
|
|
705
|
+
`/^[\x00-\x7F]*$/.test(self)`
|
|
695
706
|
end
|
|
696
707
|
|
|
697
708
|
def match(pattern, pos = undefined, &block)
|
|
@@ -181,6 +181,22 @@ class String
|
|
|
181
181
|
self
|
|
182
182
|
end
|
|
183
183
|
|
|
184
|
+
def each_codepoint(&block)
|
|
185
|
+
return enum_for :each_codepoint unless block_given?
|
|
186
|
+
%x{
|
|
187
|
+
for (var i = 0, length = self.length; i < length; i++) {
|
|
188
|
+
#{yield `self.codePointAt(i)`};
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
self
|
|
192
|
+
end
|
|
193
|
+
|
|
194
|
+
def codepoints(&block)
|
|
195
|
+
# If a block is given, which is a deprecated form, works the same as each_codepoint.
|
|
196
|
+
return each_codepoint(&block) if block_given?
|
|
197
|
+
each_codepoint.to_a
|
|
198
|
+
end
|
|
199
|
+
|
|
184
200
|
def encode(encoding)
|
|
185
201
|
dup.force_encoding(encoding)
|
|
186
202
|
end
|
data/opal/corelib/time.rb
CHANGED
data/stdlib/native.rb
CHANGED
|
@@ -127,7 +127,7 @@ module Native
|
|
|
127
127
|
# @example
|
|
128
128
|
#
|
|
129
129
|
# class Element
|
|
130
|
-
#
|
|
130
|
+
# extend Native::Helpers
|
|
131
131
|
#
|
|
132
132
|
# alias_native :add_class, :addClass
|
|
133
133
|
# alias_native :show
|
|
@@ -208,7 +208,6 @@ module Native
|
|
|
208
208
|
def self.included(base)
|
|
209
209
|
warn 'Including ::Native is deprecated. Please include Native::Wrapper instead.'
|
|
210
210
|
base.include Wrapper
|
|
211
|
-
base.extend Helpers
|
|
212
211
|
end
|
|
213
212
|
end
|
|
214
213
|
|
data/stdlib/nodejs/stacktrace.rb
CHANGED
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
|
|
39
39
|
var ObjectToString = Object.prototype.toString;
|
|
40
40
|
|
|
41
|
-
var NODE = ObjectToString.call(
|
|
41
|
+
var NODE = ObjectToString.call(process) === "[object process]";
|
|
42
42
|
|
|
43
43
|
// https://github.com/v8/v8/blob/cab94bbe3d532d85705950ed049a294050fcb4c9/src/messages.js#L1112-L1124 [converted to JS]
|
|
44
44
|
function GetTypeName(receiver, requireConstructor) {
|
data/tasks/testing.rake
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: opal
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.0.0
|
|
4
|
+
version: 1.0.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Elia Schito
|
|
@@ -10,7 +10,7 @@ authors:
|
|
|
10
10
|
autorequire:
|
|
11
11
|
bindir: exe
|
|
12
12
|
cert_chain: []
|
|
13
|
-
date: 2019-
|
|
13
|
+
date: 2019-05-12 00:00:00.000000000 Z
|
|
14
14
|
dependencies:
|
|
15
15
|
- !ruby/object:Gem::Dependency
|
|
16
16
|
name: ast
|
|
@@ -735,10 +735,10 @@ licenses:
|
|
|
735
735
|
- MIT
|
|
736
736
|
metadata:
|
|
737
737
|
bug_tracker_uri: https://github.com/opal/opal/issues
|
|
738
|
-
changelog_uri: https://github.com/opal/opal/blob/v1.0.0
|
|
739
|
-
readme_uri: https://github.com/opal/opal/blob/v1.0.0
|
|
740
|
-
api_documentation_uri: http://opalrb.com/docs/api/v1.0.0
|
|
741
|
-
guides_uri: http://opalrb.com/docs/guides/v1.0.0
|
|
738
|
+
changelog_uri: https://github.com/opal/opal/blob/v1.0.0/CHANGELOG.md
|
|
739
|
+
readme_uri: https://github.com/opal/opal/blob/v1.0.0/README.md
|
|
740
|
+
api_documentation_uri: http://opalrb.com/docs/api/v1.0.0/index.html
|
|
741
|
+
guides_uri: http://opalrb.com/docs/guides/v1.0.0/index.html
|
|
742
742
|
homepage_uri: https://opalrb.com/
|
|
743
743
|
chat_uri: https://gitter.im/opal/opal
|
|
744
744
|
source_code_uri: https://github.com/opal/opal
|
|
@@ -750,14 +750,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
750
750
|
requirements:
|
|
751
751
|
- - ">="
|
|
752
752
|
- !ruby/object:Gem::Version
|
|
753
|
-
version: 2.
|
|
753
|
+
version: '2.3'
|
|
754
754
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
755
755
|
requirements:
|
|
756
|
-
- - "
|
|
756
|
+
- - ">="
|
|
757
757
|
- !ruby/object:Gem::Version
|
|
758
|
-
version:
|
|
758
|
+
version: '0'
|
|
759
759
|
requirements: []
|
|
760
|
-
rubygems_version: 3.0.
|
|
760
|
+
rubygems_version: 3.0.3
|
|
761
761
|
signing_key:
|
|
762
762
|
specification_version: 4
|
|
763
763
|
summary: Ruby runtime and core library for JavaScript
|