execjs-xtrn 1.1.2 → 1.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +10 -3
- data/Gemfile +2 -0
- data/README.md +7 -1
- data/appveyor.yml +36 -0
- data/execjs-xtrn.gemspec +4 -1
- data/lib/execjs/node/package.json +1 -0
- data/lib/execjs/wsh/es5.js +13 -0
- data/lib/execjs/wsh/repl.js +17 -12
- data/lib/execjs/xtrn.rb +8 -2
- data/lib/execjs/xtrn/child.rb +1 -0
- data/lib/execjs/xtrn/version.rb +1 -1
- data/lib/execjs/xtrn/wsh.rb +2 -0
- data/test/child.rb +1 -1
- data/test/engine.rb +2 -9
- data/test/nvm.rb +2 -5
- data/test/top.rb +17 -0
- metadata +45 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7006a7dbaff18583232a21dec541ac5aabbe990c
|
4
|
+
data.tar.gz: 87fa10ad61fb6be63aca1f564c31d6bbad3de260
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a69efc3cf4ac48d7dbd419fc11e36d456edb08f314c826b23890d0fa31e155f5167fa712b9517d6b66f74f6c095e1d6f0b2292b45978bcebda58382bf034cdca
|
7
|
+
data.tar.gz: bbd08a8d11fcd3f8e6c341f8488ce31f8b791247ecf0ba8345f71b52acf3cd7f7d2cf00234345440d37b42ede81e67b2e36bc9cd03e1444acdcff5d195eb4df9
|
data/.travis.yml
CHANGED
@@ -1,12 +1,19 @@
|
|
1
|
+
sudo: false
|
2
|
+
|
1
3
|
language: ruby
|
4
|
+
|
2
5
|
rvm:
|
3
6
|
- '2.2'
|
4
7
|
- '2.1'
|
5
8
|
- '2.0'
|
6
9
|
- 1.9.3
|
7
|
-
|
8
|
-
|
9
|
-
-
|
10
|
+
|
11
|
+
env:
|
12
|
+
- NODEV=node
|
13
|
+
- NODEV=0
|
14
|
+
|
10
15
|
install:
|
16
|
+
- nvm install $NODEV
|
17
|
+
- gem install bundler
|
11
18
|
- bundle install
|
12
19
|
- bundle exec rake npm
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
# ExecJS::Xtrn
|
2
2
|
|
3
3
|
[![Build Status](https://travis-ci.org/ukoloff/execjs-xtrn.svg?branch=master)](https://travis-ci.org/ukoloff/execjs-xtrn)
|
4
|
+
[![Build status](https://ci.appveyor.com/api/projects/status/tw7av89nj591fg8w?svg=true)](https://ci.appveyor.com/project/ukoloff/execjs-xtrn)
|
4
5
|
[![Gem Version](https://badge.fury.io/rb/execjs-xtrn.svg)](http://badge.fury.io/rb/execjs-xtrn)
|
5
6
|
|
6
7
|
Drop-in replacement for ExecJS. The latter spawns separate process for every JavaScript compilation
|
@@ -198,12 +199,15 @@ The following packages have been tested to run under ExecJS::Xtrn out-of-box:
|
|
198
199
|
CoffeeScript since v1.9.0 introduces new incompatibility:
|
199
200
|
it uses `Object.create` that is missing from WSH.
|
200
201
|
To fix it, `Object.create` was manually defined in ExecJS::Xtrn::Wsh
|
201
|
-
(sort of [ExecJS::Xtrn::Wsh::Preload](#preloading))
|
202
|
+
(sort of [ExecJS::Xtrn::Wsh::Preload](#preloading)).
|
203
|
+
Path to this polyfill is available as `ExecJS::Xtrn::Wsh::ES5` constant.
|
202
204
|
|
203
205
|
Gem [coffee-script](https://rubygems.org/gems/coffee-script) since v2.4.0 introduces another incompatibility:
|
204
206
|
it silently creates global function. This approach works in regular ExecJS but fails in ExecJS::Xtrn.
|
205
207
|
As a workaround pin `coffee-script` gem version to 2.3.0.
|
206
208
|
|
209
|
+
Later [uglifier](https://github.com/lautis/uglifier) from v3 started to use globals either. Pin it to '~> 2'.
|
210
|
+
|
207
211
|
## Testing
|
208
212
|
|
209
213
|
After git checkout, required NPM modules must be installed. Simply run:
|
@@ -227,3 +231,5 @@ And `bundle exec` may be ommited in most cases.
|
|
227
231
|
* [therubyracer](https://github.com/cowboyd/therubyracer)
|
228
232
|
* [Node.js](http://nodejs.org/)
|
229
233
|
* [Windows Script Host](http://en.wikipedia.org/wiki/Windows_Script_Host)
|
234
|
+
* [Travis CI](https://travis-ci.org/)
|
235
|
+
* [AppVeyor](http://www.appveyor.com/)
|
data/appveyor.yml
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
version: 1.0.{build}-{branch}
|
2
|
+
|
3
|
+
cache:
|
4
|
+
- vendor/bundle
|
5
|
+
|
6
|
+
environment:
|
7
|
+
matrix:
|
8
|
+
- RUBY_VERSION: 23
|
9
|
+
- RUBY_VERSION: 22
|
10
|
+
- RUBY_VERSION: 21
|
11
|
+
- RUBY_VERSION: 200
|
12
|
+
- RUBY_VERSION: 193
|
13
|
+
|
14
|
+
install:
|
15
|
+
- set PATH=C:\Ruby%RUBY_VERSION%\bin;%PATH%
|
16
|
+
- bundle config --local path vendor/bundle
|
17
|
+
- bundle install
|
18
|
+
- bundle exec rake npm
|
19
|
+
|
20
|
+
build: off
|
21
|
+
|
22
|
+
before_test:
|
23
|
+
- ruby -v
|
24
|
+
- gem -v
|
25
|
+
- bundle -v
|
26
|
+
- node -v
|
27
|
+
|
28
|
+
test_script:
|
29
|
+
- bundle exec rake
|
30
|
+
|
31
|
+
after_test:
|
32
|
+
- bundle exec rake build
|
33
|
+
|
34
|
+
artifacts:
|
35
|
+
- path: pkg/*.gem
|
36
|
+
name: Gem
|
data/execjs-xtrn.gemspec
CHANGED
@@ -19,9 +19,12 @@ Gem::Specification.new do |spec|
|
|
19
19
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
20
20
|
spec.require_paths = ["lib"]
|
21
21
|
|
22
|
+
spec.add_dependency "json"
|
23
|
+
|
22
24
|
spec.add_development_dependency "bundler", "~> 1.3"
|
23
25
|
spec.add_development_dependency "rake"
|
24
26
|
spec.add_development_dependency "minitest"
|
25
27
|
spec.add_development_dependency "coffee-script", '2.3.0'
|
26
|
-
spec.add_development_dependency "uglifier"
|
28
|
+
spec.add_development_dependency "uglifier", '~> 2'
|
29
|
+
spec.add_development_dependency "appveyor-worker"
|
27
30
|
end
|
data/lib/execjs/wsh/repl.js
CHANGED
@@ -1,12 +1,14 @@
|
|
1
|
-
|
1
|
+
//
|
2
|
+
// Communicate with cscript via stdin/stderr
|
3
|
+
//
|
4
|
+
+function(){
|
2
5
|
|
3
6
|
var
|
4
7
|
w = WScript,
|
5
8
|
i = w.StdIn,
|
6
9
|
o = w.StdErr
|
7
10
|
|
8
|
-
json2
|
9
|
-
oCreate()
|
11
|
+
loadShivs('json2 es5')
|
10
12
|
|
11
13
|
while(!i.AtEndOfStream)
|
12
14
|
o.WriteLine(wrap(i.ReadLine()))
|
@@ -42,16 +44,19 @@ function json2()
|
|
42
44
|
new Function(fso.OpenTextFile(j2).ReadAll())()
|
43
45
|
}
|
44
46
|
|
45
|
-
|
46
|
-
function oCreate()
|
47
|
+
function loadJS(name)
|
47
48
|
{
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
49
|
+
var
|
50
|
+
fso = new ActiveXObject("Scripting.FileSystemObject")
|
51
|
+
name = fso.GetParentFolderName(w.ScriptFullName)+"/"+name+".js"
|
52
|
+
new Function(fso.OpenTextFile(name).ReadAll())()
|
53
|
+
}
|
54
|
+
|
55
|
+
function loadShivs(names)
|
56
|
+
{
|
57
|
+
names = names.split(' ')
|
58
|
+
for(var i in names)
|
59
|
+
loadJS(names[i])
|
55
60
|
}
|
56
61
|
|
57
62
|
}()
|
data/lib/execjs/xtrn.rb
CHANGED
@@ -14,8 +14,14 @@ module ExecJS::Xtrn
|
|
14
14
|
# Install into ExecJS
|
15
15
|
def self.init
|
16
16
|
slf=self
|
17
|
-
sc=(class<<ExecJS;self;end)
|
18
|
-
Engine.methods(false).each
|
17
|
+
sc=(class << ExecJS; self ;end)
|
18
|
+
Engine.methods(false).each do |m|
|
19
|
+
sc.instance_eval do
|
20
|
+
define_method(m) do |*args|
|
21
|
+
slf.engine.send m, *args
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
19
25
|
end
|
20
26
|
|
21
27
|
init
|
data/lib/execjs/xtrn/child.rb
CHANGED
data/lib/execjs/xtrn/version.rb
CHANGED
data/lib/execjs/xtrn/wsh.rb
CHANGED
data/test/child.rb
CHANGED
@@ -18,7 +18,7 @@ class TestChild < Shagi
|
|
18
18
|
ancestors[1].instance_methods(false).grep(/^shag_/).each do |m|
|
19
19
|
Children.each_with_index do |klass, idx|
|
20
20
|
(1..Spawn).each do |n|
|
21
|
-
define_method("test_#{m.to_s.sub
|
21
|
+
define_method("test_#{m.to_s.sub(/.*?_/, '')}_#{klass.name.split(/\W+/).last}_#{n}")do
|
22
22
|
skip unless @child=(@@children||=children)[n-1][idx]
|
23
23
|
send m
|
24
24
|
end
|
data/test/engine.rb
CHANGED
@@ -103,7 +103,7 @@ class TestEngine < Minitest::Test
|
|
103
103
|
instance_methods(false).grep(/^shag_/).each do |m|
|
104
104
|
Engines.each_with_index do |klass, idx|
|
105
105
|
(1..Spawn).each do |n|
|
106
|
-
define_method("test_#{m.to_s.sub
|
106
|
+
define_method("test_#{m.to_s.sub(/.*?_/, '')}_#{klass.name.split(/\W+/).last}_#{n}")do
|
107
107
|
skip unless @engine=(@@engines||=engines)[n-1][idx]
|
108
108
|
send m
|
109
109
|
end
|
@@ -113,7 +113,7 @@ class TestEngine < Minitest::Test
|
|
113
113
|
|
114
114
|
instance_methods(false).grep(/^klas_/).each do |m|
|
115
115
|
Engines.each do |klass|
|
116
|
-
define_method("test_#{m.to_s.sub
|
116
|
+
define_method("test_#{m.to_s.sub(/.*?_/, '')}_#{klass.name.split(/\W+/).last}_class")do
|
117
117
|
skip unless klass::Valid
|
118
118
|
@class=klass
|
119
119
|
send m
|
@@ -124,11 +124,4 @@ class TestEngine < Minitest::Test
|
|
124
124
|
|
125
125
|
build
|
126
126
|
|
127
|
-
ObjectSpace.define_finalizer(M)do
|
128
|
-
puts "Statistics:"
|
129
|
-
s=M.stats
|
130
|
-
len=s.keys.map(&:length).max+1
|
131
|
-
s.each{|k, v| puts "#{' '*(len-k.length)}#{k}: "+v.map{|k, v| "#{k}=#{v.round(3).to_s.sub /[.]?0*$/, ''}"}*', ' }
|
132
|
-
end
|
133
|
-
|
134
127
|
end
|
data/test/nvm.rb
CHANGED
@@ -5,10 +5,7 @@ class TestNvm < Shagi
|
|
5
5
|
Child=M::Nvm
|
6
6
|
|
7
7
|
def say(code)
|
8
|
-
|
9
|
-
r=@child.say vm: @vm, js: code
|
10
|
-
# puts "r: #{r}"
|
11
|
-
r
|
8
|
+
@child.say vm: @vm, js: code
|
12
9
|
end
|
13
10
|
|
14
11
|
def buildVMs
|
@@ -21,7 +18,7 @@ class TestNvm < Shagi
|
|
21
18
|
def self.build
|
22
19
|
ancestors[1].instance_methods(false).grep(/^shag_/).each do |m|
|
23
20
|
(1..Spawn).each do |n|
|
24
|
-
define_method("test_#{m.to_s.sub
|
21
|
+
define_method("test_#{m.to_s.sub(/.*?_/, '')}_#{n}")do
|
25
22
|
skip unless Child::Valid
|
26
23
|
@vm=(@@vms||=buildVMs)[n-1]
|
27
24
|
@child=@@child
|
data/test/top.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'coffee-script'
|
2
2
|
require 'uglifier'
|
3
|
+
|
3
4
|
ExecJS::Xtrn.init
|
4
5
|
|
5
6
|
class TestTop < Minitest::Test
|
@@ -70,6 +71,22 @@ class TestTop < Minitest::Test
|
|
70
71
|
assert_equal 42, ExecJS.eval('21*2')
|
71
72
|
end
|
72
73
|
|
74
|
+
def test_info
|
75
|
+
at_exit do
|
76
|
+
puts "Statistics:"
|
77
|
+
s=ExecJS::Xtrn.stats
|
78
|
+
len=s.keys.map(&:length).max+1
|
79
|
+
z = s.map do |k, v|
|
80
|
+
"#{' '*(len-k.length)}#{k}: "+
|
81
|
+
v.map do |kx, vx|
|
82
|
+
"#{kx}=#{vx.round(3).to_s.sub(/[.]?0*$/, '')}"
|
83
|
+
end * ', '
|
84
|
+
end * "\n"
|
85
|
+
puts z
|
86
|
+
AppVeyor::Worker.message "Compilations: #{s['Engine'][:n]}", z
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
73
90
|
end
|
74
91
|
|
75
92
|
class FakeEngine < ExecJS::Xtrn::Engine
|
metadata
CHANGED
@@ -1,55 +1,69 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: execjs-xtrn
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stas Ukolov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-08-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: json
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
13
27
|
- !ruby/object:Gem::Dependency
|
14
28
|
name: bundler
|
15
29
|
requirement: !ruby/object:Gem::Requirement
|
16
30
|
requirements:
|
17
|
-
- - ~>
|
31
|
+
- - "~>"
|
18
32
|
- !ruby/object:Gem::Version
|
19
33
|
version: '1.3'
|
20
34
|
type: :development
|
21
35
|
prerelease: false
|
22
36
|
version_requirements: !ruby/object:Gem::Requirement
|
23
37
|
requirements:
|
24
|
-
- - ~>
|
38
|
+
- - "~>"
|
25
39
|
- !ruby/object:Gem::Version
|
26
40
|
version: '1.3'
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: rake
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
30
44
|
requirements:
|
31
|
-
- -
|
45
|
+
- - ">="
|
32
46
|
- !ruby/object:Gem::Version
|
33
47
|
version: '0'
|
34
48
|
type: :development
|
35
49
|
prerelease: false
|
36
50
|
version_requirements: !ruby/object:Gem::Requirement
|
37
51
|
requirements:
|
38
|
-
- -
|
52
|
+
- - ">="
|
39
53
|
- !ruby/object:Gem::Version
|
40
54
|
version: '0'
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
56
|
name: minitest
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
44
58
|
requirements:
|
45
|
-
- -
|
59
|
+
- - ">="
|
46
60
|
- !ruby/object:Gem::Version
|
47
61
|
version: '0'
|
48
62
|
type: :development
|
49
63
|
prerelease: false
|
50
64
|
version_requirements: !ruby/object:Gem::Requirement
|
51
65
|
requirements:
|
52
|
-
- -
|
66
|
+
- - ">="
|
53
67
|
- !ruby/object:Gem::Version
|
54
68
|
version: '0'
|
55
69
|
- !ruby/object:Gem::Dependency
|
@@ -70,14 +84,28 @@ dependencies:
|
|
70
84
|
name: uglifier
|
71
85
|
requirement: !ruby/object:Gem::Requirement
|
72
86
|
requirements:
|
73
|
-
- -
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '2'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '2'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: appveyor-worker
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
74
102
|
- !ruby/object:Gem::Version
|
75
103
|
version: '0'
|
76
104
|
type: :development
|
77
105
|
prerelease: false
|
78
106
|
version_requirements: !ruby/object:Gem::Requirement
|
79
107
|
requirements:
|
80
|
-
- -
|
108
|
+
- - ">="
|
81
109
|
- !ruby/object:Gem::Version
|
82
110
|
version: '0'
|
83
111
|
description: Drop-in replacement for ExecJS with persistent external runtime
|
@@ -87,18 +115,20 @@ executables: []
|
|
87
115
|
extensions: []
|
88
116
|
extra_rdoc_files: []
|
89
117
|
files:
|
90
|
-
- .gitignore
|
91
|
-
- .travis.yml
|
118
|
+
- ".gitignore"
|
119
|
+
- ".travis.yml"
|
92
120
|
- FarMenu.ini
|
93
121
|
- Gemfile
|
94
122
|
- LICENSE.txt
|
95
123
|
- README.md
|
96
124
|
- Rakefile
|
125
|
+
- appveyor.yml
|
97
126
|
- execjs-xtrn.gemspec
|
98
127
|
- lib/execjs/node/index.js
|
99
128
|
- lib/execjs/node/node_modules/split/index.js
|
100
129
|
- lib/execjs/node/node_modules/through/index.js
|
101
130
|
- lib/execjs/node/package.json
|
131
|
+
- lib/execjs/wsh/es5.js
|
102
132
|
- lib/execjs/wsh/json2.js
|
103
133
|
- lib/execjs/wsh/repl.js
|
104
134
|
- lib/execjs/xtrn.rb
|
@@ -127,17 +157,17 @@ require_paths:
|
|
127
157
|
- lib
|
128
158
|
required_ruby_version: !ruby/object:Gem::Requirement
|
129
159
|
requirements:
|
130
|
-
- -
|
160
|
+
- - ">="
|
131
161
|
- !ruby/object:Gem::Version
|
132
162
|
version: '0'
|
133
163
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
134
164
|
requirements:
|
135
|
-
- -
|
165
|
+
- - ">="
|
136
166
|
- !ruby/object:Gem::Version
|
137
167
|
version: '0'
|
138
168
|
requirements: []
|
139
169
|
rubyforge_project:
|
140
|
-
rubygems_version: 2.
|
170
|
+
rubygems_version: 2.2.3
|
141
171
|
signing_key:
|
142
172
|
specification_version: 4
|
143
173
|
summary: 'Proof-of-concept: make ExecJS fast even without therubyracer'
|