isomorfeus-speednode 0.4.2 → 0.4.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 40a60ef6cb3270396623b45eeef1284406b77443e726f7ee980682e27e9c3429
4
- data.tar.gz: 552cfa169df4031568d185defff6bd97c8453a00eba629b5533565d7ca9185b6
3
+ metadata.gz: 3f842e689f630194758bcc86a37f75902d1c5aa86ec9600fa5373c2a4349df1f
4
+ data.tar.gz: 56959ce3fd7ed8de02abfd0e0970fc62c7a4ec82957c0e01410e583d69697ca5
5
5
  SHA512:
6
- metadata.gz: 7bca1b13c2f434b71cb07a5402efa9295e9930495ac21562ded9a0abdced399c66c4cd6828fbbac0e7947be7a75270572cc9c114bec267aa6dec98637d648e3f
7
- data.tar.gz: 229c7ee8decfe75a6c3126ef5f3ff230caa23e46c5ab8941bf4ee392e56d76e64e7636bfc926f7ea8b0115f8d4ee19361949eb126b46991498f9ff1dee86f01c
6
+ metadata.gz: eee28f46f8f21b26498e6403c885e0bd27a6ad20980ddff5b2b14e086430df401ad9751cf4e2646ece544ffd18750aa1b7bee9d457d1f55b4cd616d3faf0eede
7
+ data.tar.gz: a01893f46a88c31c7cca49e515a5d214a0fb1b3b6b9d4a62a85b09ff242b3247db9a75fc46037fdd5a1bb54a858de095491736e89d50b12d3dd8ec6676e8d643
data/README.md CHANGED
@@ -1,13 +1,13 @@
1
- # isomorfeus-speednode
1
+ <h1 align="center">
2
+ <img src="https://github.com/isomorfeus/isomorfeus-speednode/blob/master/Logo.png?raw=true" align="center" width="234" height="127"/><br/>
3
+ Isomorfeus Speednode<br/>
4
+ </h1>
2
5
 
3
6
  A fast runtime for execjs using node js. Works on Linux, BSDs, MacOS and Windows.
4
7
  Inspired by [execjs-fastnode](https://github.com/jhawthorn/execjs-fastnode).
5
8
 
6
9
  ### Community and Support
7
- At the [Isomorfeus Framework Project](http://isomorfeus.com)
8
-
9
- ### Tested
10
- [TravisCI](https://travis-ci.org): [![Build Status](https://travis-ci.org/isomorfeus/isomorfeus-speednode.svg?branch=master)](https://travis-ci.org/isomorfeus/isomorfeus-speednode)
10
+ At the [Isomorfeus Framework Project](http://isomorfeus.com)
11
11
 
12
12
  ### Installation
13
13
 
@@ -40,8 +40,8 @@ Example for a compatible context:
40
40
  compat_context = ExecJS.compile('Test = "test"')
41
41
  compat_context.eval('1+1')
42
42
  ```
43
- #### Permissive
44
- A permissive context can be created with `ExecJS.permissive_compile` or code can be executed within a permissive context by using
43
+ #### Permissive
44
+ A permissive context can be created with `ExecJS.permissive_compile` or code can be executed within a permissive context by using
45
45
  `ExecJS.permissive_eval` or `ExecJS.permissive_exec`.
46
46
  Example for a permissive context:
47
47
  ```ruby
@@ -63,7 +63,7 @@ context.eval <<~JAVASCRIPT
63
63
  return new Promise(function (resolve, reject) { resolve(val); });
64
64
  }
65
65
  JAVASCRIPT
66
-
66
+
67
67
  context.await("foo('test')") # => 'test'
68
68
  ```
69
69
 
@@ -2,7 +2,7 @@ module ExecJS
2
2
  module Runtimes
3
3
  Speednode = Isomorfeus::Speednode::Runtime.new(
4
4
  name: 'Isomorfeus Speednode Node.js (V8)',
5
- command: %w[nodejs node],
5
+ command: %w[node nodejs],
6
6
  runner_path: File.join(File.dirname(__FILE__), 'speednode', 'runner.js'),
7
7
  encoding: 'UTF-8'
8
8
  )
@@ -135,7 +135,7 @@ function attachFunctionSource(responder_path, context, func) {
135
135
  if (!global.__responder_socket) {\n\
136
136
  return new Promise(function(resolve, reject) {\n\
137
137
  setTimeout(function(){\n\
138
- if (os.platform().indexOf('win') > -1) {\n\
138
+ if (os.platform().indexOf('win') == 0) {\n\
139
139
  let socket = net.connect(responder_path);\n\
140
140
  socket.on('connect', function(){\n\
141
141
  global.__responder_socket = true;\n\
@@ -160,9 +160,9 @@ function attachFunctionSource(responder_path, context, func) {
160
160
  socket.on('error', function (err) {\n\
161
161
  if (err.syscall === 'connect') {\n\
162
162
  // ignore, close will handle\n\
163
- } else if (os.platform().indexOf('win') > -1 && err.message.includes('read EPIPE')) {\n\
163
+ } else if ((os.platform().indexOf('win') == 0) && err.message.includes('read EPIPE')) {\n\
164
164
  // ignore, close will handle\n\
165
- } else if (os.platform().indexOf('win') > -1 && err.message.includes('write EPIPE')) {\n\
165
+ } else if ((os.platform().indexOf('win') == 0) && err.message.includes('write EPIPE')) {\n\
166
166
  // ignore, close will handle\n\
167
167
  } else { reject(err); }\n\
168
168
  });\n\
@@ -224,7 +224,7 @@ function getContextOptions(uuid) {
224
224
  if (contexts[uuid].options.timeout) {
225
225
  options.timeout = contexts[uuid].options.timeout;
226
226
  }
227
- return options;
227
+ return options;
228
228
  }
229
229
 
230
230
  function massageStackTrace(stack) {
@@ -242,7 +242,7 @@ let commands = {
242
242
  attach: function(input) {
243
243
  let context = getContext(input.context);
244
244
  let responder_path;
245
- if (os.platform().indexOf('win') > -1) { responder_path = '\\\\\\\\.\\\\pipe\\\\' + socket_path + '_responder'; }
245
+ if (os.platform().indexOf('win') == 0) { responder_path = '\\\\\\\\.\\\\pipe\\\\' + socket_path + '_responder'; }
246
246
  else { responder_path = socket_path + '_responder' }
247
247
  let result = vm.runInContext(attachFunctionSource(responder_path, input.context, input.func), context, { filename: "(execjs)", displayErrors: true });
248
248
  return formatResult(result);
@@ -286,23 +286,23 @@ let server = net.createServer(function(s) {
286
286
  s.on('data', function (data) {
287
287
  received_data.push(data);
288
288
  if (data[data.length - 1] !== 4) { return; }
289
-
289
+
290
290
  let request = received_data.join('').toString('utf8');
291
291
  request = request.substr(0, request.length - 1);
292
292
  received_data = [];
293
-
293
+
294
294
  let input, result;
295
295
  let outputJSON = '';
296
296
 
297
297
  try { input = JSON.parse(request); }
298
- catch(err) {
298
+ catch(err) {
299
299
  outputJSON = JSON.stringify(['err', ['', err].join(''), err.stack]);
300
300
  s.write([outputJSON, "\x04"].join(''));
301
301
  return;
302
302
  }
303
303
 
304
- try { result = commands[input.cmd].apply(null, input.args); }
305
- catch (err) {
304
+ try { result = commands[input.cmd].apply(null, input.args); }
305
+ catch (err) {
306
306
  outputJSON = JSON.stringify(['err', ['', err].join(''), massageStackTrace(err.stack)]);
307
307
  s.write([outputJSON, "\x04"].join(''));
308
308
  return;
@@ -323,5 +323,5 @@ let server = net.createServer(function(s) {
323
323
  });
324
324
  });
325
325
 
326
- if (os.platform().indexOf('win') > -1) { server.listen('\\\\.\\pipe\\' + socket_path); }
326
+ if (os.platform().indexOf('win') == 0) { server.listen('\\\\.\\pipe\\' + socket_path); }
327
327
  else { server.listen(socket_path); }
@@ -56,7 +56,7 @@ module Isomorfeus
56
56
  end
57
57
 
58
58
  def self.finalize(socket, socket_dir, socket_path, pid)
59
- proc do
59
+ proc do
60
60
  Isomorfeus::Speednode::Runtime.responders[socket_path].kill if Isomorfeus::Speednode::Runtime.responders[socket_path]
61
61
  exit_node(socket, socket_dir, socket_path, pid)
62
62
  end
@@ -97,7 +97,7 @@ module Isomorfeus
97
97
 
98
98
  def attach(context, func)
99
99
  create_responder(context) unless responder
100
- command("attach", {'context' => context, 'func' => func })
100
+ command("attach", {'context' => context, 'func' => func })
101
101
  end
102
102
 
103
103
  def delete_context(context)
@@ -127,12 +127,12 @@ module Isomorfeus
127
127
  end
128
128
  @pid = Process.spawn({"SOCKET_PATH" => @socket_path}, @options[:binary], @options[:source_maps], @options[:runner_path])
129
129
 
130
- retries = 20
130
+ retries = 100
131
131
 
132
132
  if ExecJS.windows?
133
133
  timeout_or_connected = false
134
134
  begin
135
- retries -= 1
135
+ retries -= 1
136
136
  begin
137
137
  @socket = Win32::Pipe::Client.new(@socket_path, Win32::Pipe::ACCESS_DUPLEX)
138
138
  rescue
@@ -22,11 +22,7 @@ module Isomorfeus
22
22
  @encoding = options[:encoding]
23
23
  @deprecated = !!options[:deprecated]
24
24
 
25
- @vm = VM.new(
26
- binary: @binary,
27
- source_maps: '--enable-source-maps',
28
- runner_path: @runner_path
29
- )
25
+ @vm = VM.new(binary: @binary, source_maps: '--enable-source-maps', runner_path: @runner_path)
30
26
 
31
27
  @popen_options = {}
32
28
  @popen_options[:external_encoding] = @encoding if @encoding
@@ -1,5 +1,5 @@
1
- module Isomorfeus
2
- module Speednode
3
- VERSION = '0.4.2'
4
- end
5
- end
1
+ module Isomorfeus
2
+ module Speednode
3
+ VERSION = '0.4.6'
4
+ end
5
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: isomorfeus-speednode
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.2
4
+ version: 0.4.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jan Biedermann
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-09-15 00:00:00.000000000 Z
11
+ date: 2021-11-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: execjs
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 3.13.6
33
+ version: 3.13.9
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 3.13.6
40
+ version: 3.13.9
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: win32-pipe
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -150,7 +150,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
150
150
  - !ruby/object:Gem::Version
151
151
  version: '0'
152
152
  requirements: []
153
- rubygems_version: 3.2.15
153
+ rubygems_version: 3.2.22
154
154
  signing_key:
155
155
  specification_version: 4
156
156
  summary: A fast ExecJS runtime based on nodejs, tuned for Isomorfeus.