opal-webpack-loader 0.5.1 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/opal-webpack-loader/installer_cli.rb +22 -0
- data/lib/opal-webpack-loader/templates/application.js.erb +1 -6
- data/lib/opal-webpack-loader/templates/application_common.js.erb +4 -1
- data/lib/opal-webpack-loader/templates/application_debug.js.erb +1 -5
- data/lib/opal-webpack-loader/templates/application_ssr.js.erb +2 -5
- data/lib/opal-webpack-loader/templates/debug.js.erb +5 -1
- data/lib/opal-webpack-loader/templates/development.js.erb +7 -0
- data/lib/opal-webpack-loader/templates/package.json.erb +1 -0
- data/lib/opal-webpack-loader/templates/production.js.erb +2 -1
- data/lib/opal-webpack-loader/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 36ee4b4cf00990f01430447febbf5e4653baa4943ba2a51291c99f823f693da2
|
4
|
+
data.tar.gz: f49ae31c397e48d3ce57db5a8ecca450122a535c98a7f02f984cfde26d3a243b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 42eab87b24e890cd9968d7ecbb0d972f165acdc8a48ea8a6924935f3e4849cf9349b66553165e7dc63c7d7bad9603e7203ed0c7dd81554259a48a773605ce12e
|
7
|
+
data.tar.gz: dbf524e9ec8777290df3eb436ff9f890073eb83c458b03a70ad308644a7ec78236a4710d749fea9166706e55d6371e72b00988c10b45b2f340cb24a284a5f5b5
|
@@ -183,6 +183,7 @@ module OpalWebpackLoader
|
|
183
183
|
package_json["scripts"]["development"] = development_script
|
184
184
|
package_json["scripts"]["production_build"] = production_script
|
185
185
|
package_json["devDependencies"] = {} unless package_json.has_key?("devDependencies")
|
186
|
+
package_json["devDependencies"]["chokidar"] = gem_package_json["devDependencies"]["chokidar"]
|
186
187
|
package_json["devDependencies"]["compression-webpack-plugin"] = gem_package_json["devDependencies"]["compression-webpack-plugin"]
|
187
188
|
package_json["devDependencies"]["opal-webpack-loader"] = OpalWebpackLoader::VERSION
|
188
189
|
package_json["devDependencies"]["webpack"] = gem_package_json["devDependencies"]["webpack"]
|
@@ -240,7 +241,28 @@ module OpalWebpackLoader
|
|
240
241
|
js_ssr_entry: File.join(@conf_rel_prefix, @js_entrypoints_directory, 'application_ssr.js'),
|
241
242
|
opal_directory: File.join(@conf_rel_prefix, @opal_directory),
|
242
243
|
stylesheets_directory: File.join(@conf_rel_prefix, @styles_directory),
|
244
|
+
hmr_hook: ''
|
243
245
|
}
|
246
|
+
if @js_entrypoints_directory.start_with?('app')
|
247
|
+
erb_hash[:dev_server_before] = <<~JAVASCRIPT
|
248
|
+
// enable page reload for updates within the app/views directory
|
249
|
+
before: function(app, server) {
|
250
|
+
chokidar.watch(path.resolve(__dirname, path.join('..', '..', 'app', 'views'))).on('all', function () {
|
251
|
+
server.sockWrite(server.sockets, 'content-changed');
|
252
|
+
})
|
253
|
+
},
|
254
|
+
JAVASCRIPT
|
255
|
+
else
|
256
|
+
erb_hash[:dev_server_before] = <<~JAVASCRIPT
|
257
|
+
// uncomment to enable page reload for updates within another directory, which may contain just html files,
|
258
|
+
// for example the 'views' directory:
|
259
|
+
// before: function(app, server) {
|
260
|
+
// chokidar.watch(path.resolve(__dirname, path.join('..', 'views')).on('all', function () {
|
261
|
+
// server.sockWrite(server.sockets, 'content-changed');
|
262
|
+
// })
|
263
|
+
// },
|
264
|
+
JAVASCRIPT
|
265
|
+
end
|
244
266
|
create_file_from_template('debug.js.erb', File.join(@webpack_config_directory, 'debug.js'), erb_hash)
|
245
267
|
create_file_from_template('development.js.erb', File.join(@webpack_config_directory, 'development.js'), erb_hash)
|
246
268
|
create_file_from_template('production.js.erb', File.join(@webpack_config_directory, 'production.js'), erb_hash)
|
@@ -16,10 +16,5 @@ import init_app from '<%= opal_dir %>/<%= opal_name %>_loader.rb';
|
|
16
16
|
init_app();
|
17
17
|
Opal.load('<%= opal_name %>_loader');
|
18
18
|
|
19
|
-
|
20
19
|
// allow for hot reloading
|
21
|
-
if (module.hot) {
|
22
|
-
module.hot.accept('./application.js', function() {
|
23
|
-
console.log('Accepting the updated application.js!');
|
24
|
-
})
|
25
|
-
}
|
20
|
+
if (module.hot) { module.hot.accept(); }
|
@@ -6,8 +6,4 @@ import './application.js';
|
|
6
6
|
// space additional modules for debugging or helper code
|
7
7
|
|
8
8
|
// allow for hot reloading
|
9
|
-
if (module.hot) {
|
10
|
-
module.hot.accept('./application_debug.js', function() {
|
11
|
-
console.log('Accepting the updated application_debug.js!');
|
12
|
-
})
|
13
|
-
}
|
9
|
+
if (module.hot) { module.hot.accept(); }
|
@@ -16,8 +16,5 @@ import init_app from '<%= opal_dir %>/<%= opal_name %>_loader.rb';
|
|
16
16
|
init_app();
|
17
17
|
Opal.load('<%= opal_name %>_loader');
|
18
18
|
|
19
|
-
|
20
|
-
|
21
|
-
console.log('Accepting the updated application_ssr.js!');
|
22
|
-
})
|
23
|
-
}
|
19
|
+
// allow for hot reloading
|
20
|
+
if (module.hot) { module.hot.accept(); }
|
@@ -1,6 +1,7 @@
|
|
1
1
|
// require requirements used below
|
2
2
|
const path = require('path');
|
3
3
|
const webpack = require('webpack');
|
4
|
+
const chokidar = require('chokidar');
|
4
5
|
const OwlResolver = require('opal-webpack-loader/resolver'); // to resolve ruby files
|
5
6
|
|
6
7
|
module.exports = {
|
@@ -110,7 +111,9 @@ module.exports = {
|
|
110
111
|
{
|
111
112
|
loader: 'opal-webpack-loader',
|
112
113
|
options: {
|
113
|
-
sourceMap: true
|
114
|
+
sourceMap: true,
|
115
|
+
hmr: true,
|
116
|
+
hmrHook: '<%= hmr_hook %>'
|
114
117
|
}
|
115
118
|
}
|
116
119
|
]
|
@@ -119,6 +122,7 @@ module.exports = {
|
|
119
122
|
},
|
120
123
|
// configuration for webpack-dev-server
|
121
124
|
devServer: {
|
125
|
+
<%= dev_server_before %>
|
122
126
|
open: false,
|
123
127
|
lazy: false,
|
124
128
|
port: 3035,
|
@@ -1,6 +1,7 @@
|
|
1
1
|
// require requirements used below
|
2
2
|
const path = require('path');
|
3
3
|
const webpack = require('webpack');
|
4
|
+
const chokidar = require('chokidar');
|
4
5
|
const OwlResolver = require('opal-webpack-loader/resolver'); // to resolve ruby files
|
5
6
|
|
6
7
|
module.exports = {
|
@@ -97,6 +98,11 @@ module.exports = {
|
|
97
98
|
use: [
|
98
99
|
{
|
99
100
|
loader: 'opal-webpack-loader',
|
101
|
+
options: {
|
102
|
+
sourceMap: false,
|
103
|
+
hmr: true,
|
104
|
+
hmrHook: '<%= hmr_hook %>'
|
105
|
+
}
|
100
106
|
}
|
101
107
|
]
|
102
108
|
}
|
@@ -104,6 +110,7 @@ module.exports = {
|
|
104
110
|
},
|
105
111
|
// configuration for webpack-dev-server
|
106
112
|
devServer: {
|
113
|
+
<%= dev_server_before %>
|
107
114
|
open: false,
|
108
115
|
lazy: false,
|
109
116
|
port: 3035,
|
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.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jan Biedermann
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-04-
|
11
|
+
date: 2019-04-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: opal
|