opal-webpack-loader 0.11.0 → 0.11.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -1
- data/bin/opal-webpack-compile-server +0 -1
- data/bin/opal-webpack-windows-compile-server +7 -4
- data/bin/owl-compiler +7 -4
- data/lib/opal-webpack-loader.rb +24 -20
- data/lib/opal-webpack-loader/templates/debug.js.erb +9 -10
- data/lib/opal-webpack-loader/templates/development.js.erb +10 -11
- data/lib/opal-webpack-loader/templates/package.json.erb +1 -1
- data/lib/opal-webpack-loader/version.rb +1 -1
- metadata +2 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6e7e5f3b220d06e291ef7a5805237d73c53b27313766b7891e0bc18a8b00ccc8
|
4
|
+
data.tar.gz: 5d1078190a7c4b286de96c8114e9692728b87f6063c558c7de5737e3513f4b0d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e4bd10876231791a4a9368212950c81e1b8f007daa895db6ae95d0c01571a3ea3672650e35bda7765c74b06e02000a1164deb264dc22980e413d290bae9cc3e4
|
7
|
+
data.tar.gz: 70ba5421ca317f15126577d6990d30d9b354ee1c6864b28518756d07d99b9df13a25912331fe67a8e6034a1d4f9fc40da5e8941cc2aa7402d21b5f540bedfefd
|
data/README.md
CHANGED
@@ -23,7 +23,7 @@ At the [Isomorfeus Framework Project](http://isomorfeus.com)
|
|
23
23
|
opal-webpack-loader-0.7.1 compiles all of opal, a bunch of gems and over 19000SLC on a
|
24
24
|
Intel® Core™ i7-7700HQ CPU @ 2.80GHz × 8, with 8 workers in around 1850ms
|
25
25
|
- support for memcached or redis as compiler cache
|
26
|
-
- fast builds on windows too, parallel when building multiple assets with parallel
|
26
|
+
- fast builds on windows too, parallel when building multiple assets with parallel-webpack
|
27
27
|
- opal modules are packaged as es6 modules
|
28
28
|
- support for rails with webpacker
|
29
29
|
- other webpack features become available, like:
|
@@ -36,6 +36,7 @@ Intel® Core™ i7-7700HQ CPU @ 2.80GHz × 8, with 8 workers in around 1850ms
|
|
36
36
|
- everything else webpack can do, like loading stylesheets, etc.
|
37
37
|
|
38
38
|
### Requirements
|
39
|
+
- npm or yarn
|
39
40
|
- opal-webpack-loader consists of 2 parts, the npm package and the gem, both are required and must be the same version.
|
40
41
|
- webpack ^4.46
|
41
42
|
- webpack-dev-server ^3.11.0
|
@@ -1,7 +1,6 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
require 'digest'
|
3
3
|
require 'oj'
|
4
|
-
require 'c_lexer'
|
5
4
|
require 'optparse'
|
6
5
|
require 'opal/paths'
|
7
6
|
require 'opal/source_map'
|
@@ -64,6 +63,10 @@ modules_to_require.each do |mod|
|
|
64
63
|
require mod
|
65
64
|
end
|
66
65
|
|
66
|
+
def compiler_options_digest(compiler_options)
|
67
|
+
@compiler_options_digest ||= Digest::SHA1.hexdigest(Oj.dump(compiler_options, mode: :strict))
|
68
|
+
end
|
69
|
+
|
67
70
|
def compile(request, cache, compiler_options)
|
68
71
|
begin
|
69
72
|
request_json = Oj.load(request.chop!, mode: :strict)
|
@@ -73,7 +76,7 @@ def compile(request, cache, compiler_options)
|
|
73
76
|
source = File.read(filename)
|
74
77
|
if cache
|
75
78
|
source_digest = Digest::SHA1.hexdigest(source)
|
76
|
-
key = "owl_#{compiler_options_digest}_#{source_digest}_#{compile_source_map}"
|
79
|
+
key = "owl_#{compiler_options_digest(compiler_options)}_#{source_digest}_#{compile_source_map}"
|
77
80
|
result_json = cache.get(key)
|
78
81
|
return result_json if result_json
|
79
82
|
end
|
@@ -95,6 +98,7 @@ end
|
|
95
98
|
if ARGV[0] == 'start'
|
96
99
|
number_of_instances = ARGV[1].to_i
|
97
100
|
number_of_instances == 4 if number_of_instances == 0
|
101
|
+
number_of_instances == 16 if number_of_instances > 16
|
98
102
|
else
|
99
103
|
raise 'arguments must be either "stop" or "start number_of_instances"'
|
100
104
|
exit(1)
|
@@ -112,8 +116,7 @@ begin
|
|
112
116
|
STDERR.puts "Exiting with drama."
|
113
117
|
exit(0)
|
114
118
|
else
|
115
|
-
|
116
|
-
result
|
119
|
+
compile(request, cache, compiler_options)
|
117
120
|
end
|
118
121
|
end
|
119
122
|
end.run
|
data/bin/owl-compiler
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
require 'digest'
|
3
3
|
require 'oj'
|
4
|
-
require 'c_lexer'
|
5
4
|
require 'optparse'
|
6
5
|
require 'opal/paths'
|
7
6
|
require 'opal/source_map'
|
@@ -73,19 +72,23 @@ compile_source_map = compile_server_options[:source_map]
|
|
73
72
|
filename = compile_server_options[:source_file]
|
74
73
|
source = File.read(filename)
|
75
74
|
compiler_options.merge!(es6_modules: true)
|
76
|
-
|
75
|
+
|
76
|
+
def compiler_options_digest(compiler_options)
|
77
|
+
@compiler_options_digest ||= Digest::SHA1.hexdigest(Oj.dump(compiler_options, mode: :strict))
|
78
|
+
end
|
77
79
|
|
78
80
|
begin
|
79
81
|
if compile_server_options[:cache]
|
80
82
|
source_digest = Digest::SHA1.hexdigest(source)
|
81
|
-
key = "owl_#{compiler_options_digest}_#{source_digest}_#{compile_source_map}"
|
83
|
+
key = "owl_#{compiler_options_digest(compiler_options)}_#{source_digest}_#{compile_source_map}"
|
82
84
|
result_json = compile_server_options[:cache].get(key)
|
83
85
|
if result_json
|
84
86
|
STDOUT.puts result_json
|
85
87
|
exit 0
|
86
88
|
end
|
87
89
|
end
|
88
|
-
|
90
|
+
|
91
|
+
c = Opal::Compiler.new(source, compiler_options.merge(file: filename))
|
89
92
|
result = { 'javascript' => c.compile }
|
90
93
|
if compile_source_map
|
91
94
|
result['source_map'] = c.source_map.as_json
|
data/lib/opal-webpack-loader.rb
CHANGED
@@ -38,27 +38,31 @@ OpalWebpackLoader.manifest_path = File.join(Dir.getwd, 'public', 'assets', 'mani
|
|
38
38
|
OpalWebpackLoader.client_asset_path = 'http://localhost:3035/assets/'
|
39
39
|
OpalWebpackLoader.use_manifest = false
|
40
40
|
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
41
|
+
owl_npm_version = nil
|
42
|
+
begin
|
43
|
+
yarn = if Gem.win_platform?
|
44
|
+
`where yarn`.chop.lines.last.include?('yarn')
|
45
|
+
else
|
46
|
+
`which yarn`.chop.include?('yarn')
|
47
|
+
end
|
48
|
+
owl_npm_version = `yarn run -s opal-webpack-loader-npm-version`.chop if yarn
|
47
49
|
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
50
|
+
unless owl_npm_version
|
51
|
+
npm = if Gem.win_platform?
|
52
|
+
`where npm`.chop.lines.last.include?('npm')
|
53
|
+
else
|
54
|
+
`which npm`.chop.include?('npm')
|
55
|
+
end
|
56
|
+
owl_npm_version = `npm exec opal-webpack-loader-npm-version`.chop if npm
|
54
57
|
end
|
58
|
+
rescue
|
59
|
+
owl_npm_version = nil
|
60
|
+
end
|
55
61
|
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
end
|
62
|
-
else
|
63
|
-
STDERR.puts "opal-webpack-loader: Unable to check npm package version. Please check your npm installation."
|
62
|
+
if owl_npm_version != OpalWebpackLoader::VERSION
|
63
|
+
STDERR.puts "opal-webpack-loader: Incorrect version of npm package found or npm package not installed.\n" +
|
64
|
+
"Please install the npm package for opal-webpack-loader:\n" +
|
65
|
+
"\twith npm:\tnpm install opal-webpack-loader@#{OpalWebpackLoader::VERSION}\n" +
|
66
|
+
"\tor with yarn:\tyarn add opal-webpack-loader@#{OpalWebpackLoader::VERSION}\n"
|
64
67
|
end
|
68
|
+
|
@@ -99,26 +99,25 @@ const common_config = {
|
|
99
99
|
devServer: {
|
100
100
|
<%= dev_server_before %>
|
101
101
|
open: false,
|
102
|
-
lazy: false,
|
103
102
|
port: 3035,
|
104
103
|
hot: true,
|
105
|
-
// hotOnly: true,
|
106
|
-
inline: true,
|
107
104
|
https: false,
|
108
|
-
|
105
|
+
allowedHosts: 'all',
|
109
106
|
headers: {
|
110
107
|
"Access-Control-Allow-Origin": "*",
|
111
108
|
"Access-Control-Allow-Methods": "GET, POST, PUT, DELETE, PATCH, OPTIONS",
|
112
109
|
"Access-Control-Allow-Headers": "X-Requested-With, content-type, Authorization"
|
113
110
|
},
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
111
|
+
static: {
|
112
|
+
directory: path.resolve(__dirname, 'public'),
|
113
|
+
watch: {
|
114
|
+
// in case of problems with hot reloading uncomment the following two lines:
|
115
|
+
// aggregateTimeout: 250,
|
116
|
+
// poll: 50,
|
118
117
|
ignored: /\bnode_modules\b/
|
118
|
+
}
|
119
119
|
},
|
120
|
-
|
121
|
-
useLocalIp: false
|
120
|
+
host: 'local-ip'
|
122
121
|
}
|
123
122
|
};
|
124
123
|
|
@@ -84,26 +84,25 @@ const common_config = {
|
|
84
84
|
devServer: {
|
85
85
|
<%= dev_server_before %>
|
86
86
|
open: false,
|
87
|
-
lazy: false,
|
88
87
|
port: 3035,
|
89
|
-
hot:
|
90
|
-
// hotOnly: true,
|
91
|
-
inline: true,
|
88
|
+
hot: false,
|
92
89
|
https: false,
|
93
|
-
|
90
|
+
allowedHosts: 'all',
|
94
91
|
headers: {
|
95
92
|
"Access-Control-Allow-Origin": "*",
|
96
93
|
"Access-Control-Allow-Methods": "GET, POST, PUT, DELETE, PATCH, OPTIONS",
|
97
94
|
"Access-Control-Allow-Headers": "X-Requested-With, content-type, Authorization"
|
98
95
|
},
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
96
|
+
static: {
|
97
|
+
directory: path.resolve(__dirname, 'public'),
|
98
|
+
watch: {
|
99
|
+
// in case of problems with hot reloading uncomment the following two lines:
|
100
|
+
// aggregateTimeout: 250,
|
101
|
+
// poll: 50,
|
103
102
|
ignored: /\bnode_modules\b/
|
103
|
+
}
|
104
104
|
},
|
105
|
-
|
106
|
-
useLocalIp: false
|
105
|
+
host: 'local-ip'
|
107
106
|
}
|
108
107
|
};
|
109
108
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: opal-webpack-loader
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.11.
|
4
|
+
version: 0.11.4
|
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-05
|
11
|
+
date: 2021-08-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: opal
|
@@ -24,20 +24,6 @@ dependencies:
|
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 1.0.0
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: c_lexer
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - ">="
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '0'
|
34
|
-
type: :runtime
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - ">="
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '0'
|
41
27
|
- !ruby/object:Gem::Dependency
|
42
28
|
name: dalli
|
43
29
|
requirement: !ruby/object:Gem::Requirement
|