opal-webpack-compile-server 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: f7c196768c2c860d53883ca48c2037958f629d5f69ef682617458948c8fd1aa6
|
4
|
+
data.tar.gz: d227501a5515dc58ad9d5ce641867d9b2139b0babaf536bd7de7e2b7dc3e906b
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 945fb50306c0cf71e2ea61923f42cb69691a50f7eb466c1a39334df93af72917f93105cabf62e154cc5443a63493ce38d57cacaccc71ae2c110cecbc956d995e
|
7
|
+
data.tar.gz: 5cc2badbd65a15802f1b5fdb8c4ea6d591fb67b1a3d61893a547c315ed233ade217710364fdf26ec62836266270a577c7afe53914448fe48cc5cb7a016ea3faa
|
@@ -0,0 +1,50 @@
|
|
1
|
+
require 'oj'
|
2
|
+
require 'eventmachine'
|
3
|
+
require 'opal/source_map'
|
4
|
+
require 'source_map'
|
5
|
+
require 'opal/compiler'
|
6
|
+
|
7
|
+
module OpalWebpackCompileServer
|
8
|
+
|
9
|
+
OWL_CACHE_DIR = './.owl_cache/'
|
10
|
+
OWCS_SOCKET_PATH = OWL_CACHE_DIR + 'owcs_socket'
|
11
|
+
|
12
|
+
class Compiler < EventMachine::Connection
|
13
|
+
def receive_data(data)
|
14
|
+
if data.start_with?('command:kill')
|
15
|
+
EventMachine.stop
|
16
|
+
exit(0)
|
17
|
+
end
|
18
|
+
|
19
|
+
filename = data.chop
|
20
|
+
|
21
|
+
operation = proc do
|
22
|
+
begin
|
23
|
+
source = File.read(filename)
|
24
|
+
c = Opal::Compiler.new(source, es_six_imexable: true)
|
25
|
+
c.compile
|
26
|
+
result = { javascript: c.result }
|
27
|
+
result[:source_map] = c.source_map(filename).as_json
|
28
|
+
Oj.dump(result)
|
29
|
+
rescue Exception => e
|
30
|
+
Oj.dump({ error: { name: e.class, message: e.message, backtrace: e.backtrace } })
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
callback = proc do |json|
|
35
|
+
self.send_data(json)
|
36
|
+
close_connection_after_writing
|
37
|
+
end
|
38
|
+
|
39
|
+
EM.defer(operation, callback)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
class Exe
|
44
|
+
def self.run
|
45
|
+
EventMachine.run do
|
46
|
+
EventMachine.start_unix_domain_server(OWCS_SOCKET_PATH, OpalWebpackCompileServer::Compiler)
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
metadata
ADDED
@@ -0,0 +1,89 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: opal-webpack-compile-server
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Jan Biedermann
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2018-05-20 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: eventmachine
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 1.2.7
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 1.2.7
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: oj
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 3.6.0
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 3.6.0
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: opal
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 0.11.0
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 0.11.0
|
55
|
+
description: Compile opal ruby from webpack
|
56
|
+
email: jan@kursator.de
|
57
|
+
executables:
|
58
|
+
- opal-webpack-compile-server
|
59
|
+
extensions: []
|
60
|
+
extra_rdoc_files: []
|
61
|
+
files:
|
62
|
+
- bin/opal-webpack-compile-server
|
63
|
+
- lib/opal-webpack-compile-server/exe.rb
|
64
|
+
- lib/opal-webpack-compile-server/version.rb
|
65
|
+
homepage: https://github.com/janbiedermann/opal-webpack-compile-server
|
66
|
+
licenses:
|
67
|
+
- MIT
|
68
|
+
metadata: {}
|
69
|
+
post_install_message:
|
70
|
+
rdoc_options: []
|
71
|
+
require_paths:
|
72
|
+
- lib
|
73
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
74
|
+
requirements:
|
75
|
+
- - ">="
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
78
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
requirements: []
|
84
|
+
rubyforge_project:
|
85
|
+
rubygems_version: 2.7.6
|
86
|
+
signing_key:
|
87
|
+
specification_version: 4
|
88
|
+
summary: A compile server for opal-webpack-loader
|
89
|
+
test_files: []
|