opal 0.9.2 → 0.9.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d1807c61ca759c1e89335b946b08fcebeb0489c6
4
- data.tar.gz: cc62c65a9f441184ddbf8b1eb5ad868c79b7f994
3
+ metadata.gz: 17581ea0e05aa539b7f8cebf864a0a316d9fb0df
4
+ data.tar.gz: 00eb15387a84f96086cdd90e1a76a224ab336db9
5
5
  SHA512:
6
- metadata.gz: 9c54cf764c264553a60607d99566ff3b9505c0126c817c742befcde3dfbe711a4199361e51253dfffcb29674b94b67672bb1b7b099812df94a9a770376c7e9ac
7
- data.tar.gz: 75ad446d4d72c8d940a42f50f020823c8e4ee2772a69652cb4eaf857fc549b0a0f643e862b72847c704b0df31e11650ac7149046a5ac59f45533034093e44eb1
6
+ metadata.gz: ffa319d4be3c02b56592538e36a4280beace7e4e9482b7ed332ce3ebfd394a1e030a19c316770057f42b0a2648aaef70613c2d7aff197d10a38c8bc1f90ea112
7
+ data.tar.gz: 37c94c2ccb8c533b4a8d1de580e2fa79ac8fed78767988d59f66b2330a5094a407aee9e87d2417e6ebffda2cdbfa654749d20495b3f786827ae05d7e7215153e
data/.gitignore CHANGED
@@ -15,3 +15,6 @@ build/
15
15
 
16
16
  # Ignore the location of the older (0.8 and below) rubyspec submodule location
17
17
  spec/corelib
18
+ # Ignore the location of newer stuff
19
+ spec/mspec
20
+ spec/ruby
@@ -1,3 +1,7 @@
1
+ ## 0.9.3 2016-06-06
2
+
3
+ * `Hash#initialize` now accepts JS `null` as well as `undefined`, restoring its 0.8 behavior
4
+
1
5
  ## 0.9.2 2016-01-10
2
6
 
3
7
  * Rebuilt the gem with Ruby 2.2 as building with 2.3 would make the gem un-installable
data/Gemfile CHANGED
@@ -23,4 +23,5 @@ unless ENV['CI']
23
23
  gem 'terminal-notifier-guard'
24
24
  end
25
25
 
26
- gem 'mspec', github: 'ruby/mspec'
26
+ gem 'mspec', github: 'ruby/mspec', ref: '7cb4c8310677e41e48a78bc0b0029faf7a74c3c8'
27
+ gem 'listen', '< 3.1'
@@ -1,5 +1,5 @@
1
1
  module Opal
2
2
  # WHEN RELEASING:
3
3
  # Remember to update RUBY_ENGINE_VERSION in opal/corelib/constants.rb too!
4
- VERSION = '0.9.2'
4
+ VERSION = '0.9.3'
5
5
  end
@@ -1,8 +1,8 @@
1
1
  RUBY_PLATFORM = 'opal'
2
2
  RUBY_ENGINE = 'opal'
3
3
  RUBY_VERSION = '2.2.3'
4
- RUBY_ENGINE_VERSION = '0.9.2'
5
- RUBY_RELEASE_DATE = '2016-01-10'
4
+ RUBY_ENGINE_VERSION = '0.9.3'
5
+ RUBY_RELEASE_DATE = '2016-06-06'
6
6
  RUBY_PATCHLEVEL = 0
7
7
  RUBY_REVISION = 0
8
8
  RUBY_COPYRIGHT = 'opal - Copyright (C) 2013-2015 Adam Beynon'
@@ -526,7 +526,7 @@ class Hash
526
526
 
527
527
  def initialize(defaults = undefined, &block)
528
528
  %x{
529
- if (defaults !== undefined && defaults.constructor === Object) {
529
+ if (defaults != null && defaults.constructor === Object) {
530
530
  var smap = self.$$smap,
531
531
  keys = self.$$keys,
532
532
  key, value;
@@ -0,0 +1 @@
1
+ ../js-yaml/bin/js-yaml.js
@@ -0,0 +1 @@
1
+ ../esprima/bin/esparse.js
@@ -0,0 +1 @@
1
+ ../esprima/bin/esvalidate.js
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: opal
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.2
4
+ version: 0.9.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Beynon
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-01-09 00:00:00.000000000 Z
11
+ date: 2016-06-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sourcemap
@@ -1104,7 +1104,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
1104
1104
  version: '0'
1105
1105
  requirements: []
1106
1106
  rubyforge_project:
1107
- rubygems_version: 2.4.8
1107
+ rubygems_version: 2.6.4
1108
1108
  signing_key:
1109
1109
  specification_version: 4
1110
1110
  summary: Ruby runtime and core library for JavaScript
@@ -1,140 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
-
4
- 'use strict';
5
-
6
-
7
- // stdlib
8
- var fs = require('fs');
9
-
10
-
11
- // 3rd-party
12
- var argparse = require('argparse');
13
-
14
-
15
- // internal
16
- var yaml = require('..');
17
-
18
-
19
- ////////////////////////////////////////////////////////////////////////////////
20
-
21
-
22
- var cli = new argparse.ArgumentParser({
23
- prog: 'js-yaml',
24
- version: require('../package.json').version,
25
- addHelp: true
26
- });
27
-
28
-
29
- cli.addArgument(['-c', '--compact'], {
30
- help: 'Display errors in compact mode',
31
- action: 'storeTrue'
32
- });
33
-
34
-
35
- // deprecated (not needed after we removed output colors)
36
- // option suppressed, but not completely removed for compatibility
37
- cli.addArgument(['-j', '--to-json'], {
38
- help: argparse.Const.SUPPRESS,
39
- dest: 'json',
40
- action: 'storeTrue'
41
- });
42
-
43
-
44
- cli.addArgument(['-t', '--trace'], {
45
- help: 'Show stack trace on error',
46
- action: 'storeTrue'
47
- });
48
-
49
- cli.addArgument(['file'], {
50
- help: 'File to read, utf-8 encoded without BOM',
51
- nargs: '?',
52
- defaultValue: '-'
53
- });
54
-
55
-
56
- ////////////////////////////////////////////////////////////////////////////////
57
-
58
-
59
- var options = cli.parseArgs();
60
-
61
-
62
- ////////////////////////////////////////////////////////////////////////////////
63
-
64
- function readFile(filename, encoding, callback) {
65
- if (options.file === '-') {
66
- // read from stdin
67
-
68
- var chunks = [];
69
-
70
- process.stdin.on('data', function(chunk) {
71
- chunks.push(chunk);
72
- });
73
-
74
- process.stdin.on('end', function() {
75
- return callback(null, Buffer.concat(chunks).toString(encoding));
76
- });
77
- } else {
78
- fs.readFile(filename, encoding, callback);
79
- }
80
- }
81
-
82
- readFile(options.file, 'utf8', function (error, input) {
83
- var output, isYaml;
84
-
85
- if (error) {
86
- if ('ENOENT' === error.code) {
87
- console.error('File not found: ' + options.file);
88
- process.exit(2);
89
- }
90
-
91
- console.error(
92
- options.trace && error.stack ||
93
- error.message ||
94
- String(error));
95
-
96
- process.exit(1);
97
- }
98
-
99
- try {
100
- output = JSON.parse(input);
101
- isYaml = false;
102
- } catch (error) {
103
- if (error instanceof SyntaxError) {
104
- try {
105
- output = [];
106
- yaml.loadAll(input, function (doc) { output.push(doc); }, {});
107
- isYaml = true;
108
-
109
- if (0 === output.length) {
110
- output = null;
111
- } else if (1 === output.length) {
112
- output = output[0];
113
- }
114
- } catch (error) {
115
- if (options.trace && error.stack) {
116
- console.error(error.stack);
117
- } else {
118
- console.error(error.toString(options.compact));
119
- }
120
-
121
- process.exit(1);
122
- }
123
- } else {
124
- console.error(
125
- options.trace && error.stack ||
126
- error.message ||
127
- String(error));
128
-
129
- process.exit(1);
130
- }
131
- }
132
-
133
- if (isYaml) {
134
- console.log(JSON.stringify(output, null, ' '));
135
- } else {
136
- console.log(yaml.dump(output));
137
- }
138
-
139
- process.exit(0);
140
- });
@@ -1,117 +0,0 @@
1
- #!/usr/bin/env node
2
- /*
3
- Copyright (C) 2012 Ariya Hidayat <ariya.hidayat@gmail.com>
4
- Copyright (C) 2011 Ariya Hidayat <ariya.hidayat@gmail.com>
5
-
6
- Redistribution and use in source and binary forms, with or without
7
- modification, are permitted provided that the following conditions are met:
8
-
9
- * Redistributions of source code must retain the above copyright
10
- notice, this list of conditions and the following disclaimer.
11
- * Redistributions in binary form must reproduce the above copyright
12
- notice, this list of conditions and the following disclaimer in the
13
- documentation and/or other materials provided with the distribution.
14
-
15
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
16
- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17
- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18
- ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
19
- DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20
- (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21
- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
22
- ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24
- THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25
- */
26
-
27
- /*jslint sloppy:true node:true rhino:true */
28
-
29
- var fs, esprima, fname, content, options, syntax;
30
-
31
- if (typeof require === 'function') {
32
- fs = require('fs');
33
- esprima = require('esprima');
34
- } else if (typeof load === 'function') {
35
- try {
36
- load('esprima.js');
37
- } catch (e) {
38
- load('../esprima.js');
39
- }
40
- }
41
-
42
- // Shims to Node.js objects when running under Rhino.
43
- if (typeof console === 'undefined' && typeof process === 'undefined') {
44
- console = { log: print };
45
- fs = { readFileSync: readFile };
46
- process = { argv: arguments, exit: quit };
47
- process.argv.unshift('esparse.js');
48
- process.argv.unshift('rhino');
49
- }
50
-
51
- function showUsage() {
52
- console.log('Usage:');
53
- console.log(' esparse [options] file.js');
54
- console.log();
55
- console.log('Available options:');
56
- console.log();
57
- console.log(' --comment Gather all line and block comments in an array');
58
- console.log(' --loc Include line-column location info for each syntax node');
59
- console.log(' --range Include index-based range for each syntax node');
60
- console.log(' --raw Display the raw value of literals');
61
- console.log(' --tokens List all tokens in an array');
62
- console.log(' --tolerant Tolerate errors on a best-effort basis (experimental)');
63
- console.log(' -v, --version Shows program version');
64
- console.log();
65
- process.exit(1);
66
- }
67
-
68
- if (process.argv.length <= 2) {
69
- showUsage();
70
- }
71
-
72
- options = {};
73
-
74
- process.argv.splice(2).forEach(function (entry) {
75
-
76
- if (entry === '-h' || entry === '--help') {
77
- showUsage();
78
- } else if (entry === '-v' || entry === '--version') {
79
- console.log('ECMAScript Parser (using Esprima version', esprima.version, ')');
80
- console.log();
81
- process.exit(0);
82
- } else if (entry === '--comment') {
83
- options.comment = true;
84
- } else if (entry === '--loc') {
85
- options.loc = true;
86
- } else if (entry === '--range') {
87
- options.range = true;
88
- } else if (entry === '--raw') {
89
- options.raw = true;
90
- } else if (entry === '--tokens') {
91
- options.tokens = true;
92
- } else if (entry === '--tolerant') {
93
- options.tolerant = true;
94
- } else if (entry.slice(0, 2) === '--') {
95
- console.log('Error: unknown option ' + entry + '.');
96
- process.exit(1);
97
- } else if (typeof fname === 'string') {
98
- console.log('Error: more than one input file.');
99
- process.exit(1);
100
- } else {
101
- fname = entry;
102
- }
103
- });
104
-
105
- if (typeof fname !== 'string') {
106
- console.log('Error: no input file.');
107
- process.exit(1);
108
- }
109
-
110
- try {
111
- content = fs.readFileSync(fname, 'utf-8');
112
- syntax = esprima.parse(content, options);
113
- console.log(JSON.stringify(syntax, null, 4));
114
- } catch (e) {
115
- console.log('Error: ' + e.message);
116
- process.exit(1);
117
- }
@@ -1,177 +0,0 @@
1
- #!/usr/bin/env node
2
- /*
3
- Copyright (C) 2012 Ariya Hidayat <ariya.hidayat@gmail.com>
4
-
5
- Redistribution and use in source and binary forms, with or without
6
- modification, are permitted provided that the following conditions are met:
7
-
8
- * Redistributions of source code must retain the above copyright
9
- notice, this list of conditions and the following disclaimer.
10
- * Redistributions in binary form must reproduce the above copyright
11
- notice, this list of conditions and the following disclaimer in the
12
- documentation and/or other materials provided with the distribution.
13
-
14
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
15
- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16
- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17
- ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
18
- DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
19
- (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
20
- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
21
- ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23
- THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
- */
25
-
26
- /*jslint sloppy:true plusplus:true node:true rhino:true */
27
-
28
- var fs, esprima, options, fnames, count;
29
-
30
- if (typeof require === 'function') {
31
- fs = require('fs');
32
- esprima = require('esprima');
33
- } else if (typeof load === 'function') {
34
- try {
35
- load('esprima.js');
36
- } catch (e) {
37
- load('../esprima.js');
38
- }
39
- }
40
-
41
- // Shims to Node.js objects when running under Rhino.
42
- if (typeof console === 'undefined' && typeof process === 'undefined') {
43
- console = { log: print };
44
- fs = { readFileSync: readFile };
45
- process = { argv: arguments, exit: quit };
46
- process.argv.unshift('esvalidate.js');
47
- process.argv.unshift('rhino');
48
- }
49
-
50
- function showUsage() {
51
- console.log('Usage:');
52
- console.log(' esvalidate [options] file.js');
53
- console.log();
54
- console.log('Available options:');
55
- console.log();
56
- console.log(' --format=type Set the report format, plain (default) or junit');
57
- console.log(' -v, --version Print program version');
58
- console.log();
59
- process.exit(1);
60
- }
61
-
62
- if (process.argv.length <= 2) {
63
- showUsage();
64
- }
65
-
66
- options = {
67
- format: 'plain'
68
- };
69
-
70
- fnames = [];
71
-
72
- process.argv.splice(2).forEach(function (entry) {
73
-
74
- if (entry === '-h' || entry === '--help') {
75
- showUsage();
76
- } else if (entry === '-v' || entry === '--version') {
77
- console.log('ECMAScript Validator (using Esprima version', esprima.version, ')');
78
- console.log();
79
- process.exit(0);
80
- } else if (entry.slice(0, 9) === '--format=') {
81
- options.format = entry.slice(9);
82
- if (options.format !== 'plain' && options.format !== 'junit') {
83
- console.log('Error: unknown report format ' + options.format + '.');
84
- process.exit(1);
85
- }
86
- } else if (entry.slice(0, 2) === '--') {
87
- console.log('Error: unknown option ' + entry + '.');
88
- process.exit(1);
89
- } else {
90
- fnames.push(entry);
91
- }
92
- });
93
-
94
- if (fnames.length === 0) {
95
- console.log('Error: no input file.');
96
- process.exit(1);
97
- }
98
-
99
- if (options.format === 'junit') {
100
- console.log('<?xml version="1.0" encoding="UTF-8"?>');
101
- console.log('<testsuites>');
102
- }
103
-
104
- count = 0;
105
- fnames.forEach(function (fname) {
106
- var content, timestamp, syntax, name;
107
- try {
108
- content = fs.readFileSync(fname, 'utf-8');
109
-
110
- if (content[0] === '#' && content[1] === '!') {
111
- content = '//' + content.substr(2, content.length);
112
- }
113
-
114
- timestamp = Date.now();
115
- syntax = esprima.parse(content, { tolerant: true });
116
-
117
- if (options.format === 'junit') {
118
-
119
- name = fname;
120
- if (name.lastIndexOf('/') >= 0) {
121
- name = name.slice(name.lastIndexOf('/') + 1);
122
- }
123
-
124
- console.log('<testsuite name="' + fname + '" errors="0" ' +
125
- ' failures="' + syntax.errors.length + '" ' +
126
- ' tests="' + syntax.errors.length + '" ' +
127
- ' time="' + Math.round((Date.now() - timestamp) / 1000) +
128
- '">');
129
-
130
- syntax.errors.forEach(function (error) {
131
- var msg = error.message;
132
- msg = msg.replace(/^Line\ [0-9]*\:\ /, '');
133
- console.log(' <testcase name="Line ' + error.lineNumber + ': ' + msg + '" ' +
134
- ' time="0">');
135
- console.log(' <error type="SyntaxError" message="' + error.message + '">' +
136
- error.message + '(' + name + ':' + error.lineNumber + ')' +
137
- '</error>');
138
- console.log(' </testcase>');
139
- });
140
-
141
- console.log('</testsuite>');
142
-
143
- } else if (options.format === 'plain') {
144
-
145
- syntax.errors.forEach(function (error) {
146
- var msg = error.message;
147
- msg = msg.replace(/^Line\ [0-9]*\:\ /, '');
148
- msg = fname + ':' + error.lineNumber + ': ' + msg;
149
- console.log(msg);
150
- ++count;
151
- });
152
-
153
- }
154
- } catch (e) {
155
- ++count;
156
- if (options.format === 'junit') {
157
- console.log('<testsuite name="' + fname + '" errors="1" failures="0" tests="1" ' +
158
- ' time="' + Math.round((Date.now() - timestamp) / 1000) + '">');
159
- console.log(' <testcase name="' + e.message + '" ' + ' time="0">');
160
- console.log(' <error type="ParseError" message="' + e.message + '">' +
161
- e.message + '(' + fname + ((e.lineNumber) ? ':' + e.lineNumber : '') +
162
- ')</error>');
163
- console.log(' </testcase>');
164
- console.log('</testsuite>');
165
- } else {
166
- console.log('Error: ' + e.message);
167
- }
168
- }
169
- });
170
-
171
- if (options.format === 'junit') {
172
- console.log('</testsuites>');
173
- }
174
-
175
- if (count > 0) {
176
- process.exit(1);
177
- }