webpacker 6.0.0.beta.7 → 6.0.0.pre.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (84) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/jest.yml +1 -1
  3. data/.github/workflows/js-lint.yml +1 -1
  4. data/.github/workflows/ruby.yml +6 -9
  5. data/.rubocop.yml +0 -105
  6. data/CHANGELOG.md +6 -22
  7. data/CONTRIBUTING.md +1 -1
  8. data/Gemfile.lock +90 -93
  9. data/README.md +110 -308
  10. data/docs/assets.md +135 -0
  11. data/docs/cloud9.md +310 -0
  12. data/docs/css.md +303 -0
  13. data/docs/deployment.md +29 -9
  14. data/docs/docker.md +68 -0
  15. data/docs/engines.md +213 -0
  16. data/docs/env.md +68 -0
  17. data/docs/es6.md +72 -0
  18. data/docs/folder-structure.md +66 -0
  19. data/docs/integrations.md +220 -0
  20. data/docs/misc.md +23 -0
  21. data/docs/props.md +187 -0
  22. data/docs/react.md +183 -0
  23. data/docs/target.md +22 -0
  24. data/docs/testing.md +147 -0
  25. data/docs/troubleshooting.md +3 -5
  26. data/docs/typescript.md +190 -0
  27. data/docs/v4-upgrade.md +142 -0
  28. data/docs/webpack-dev-server.md +94 -0
  29. data/docs/webpack.md +315 -0
  30. data/docs/yarn.md +23 -0
  31. data/lib/install/config/webpacker.yml +3 -5
  32. data/lib/install/examples/vue3/app.vue +27 -0
  33. data/lib/install/examples/vue3/hello_vue.js +15 -0
  34. data/lib/install/javascript/packs/application.css +9 -0
  35. data/lib/install/{packs/entrypoints → javascript/packs}/application.js +2 -4
  36. data/lib/install/template.rb +9 -16
  37. data/lib/tasks/webpacker/binstubs.rake +2 -2
  38. data/lib/tasks/webpacker/check_node.rake +0 -1
  39. data/lib/tasks/webpacker/check_yarn.rake +0 -1
  40. data/lib/tasks/webpacker/install.rake +2 -2
  41. data/lib/webpacker/commands.rb +1 -2
  42. data/lib/webpacker/compiler.rb +3 -9
  43. data/lib/webpacker/configuration.rb +4 -4
  44. data/lib/webpacker/dev_server_runner.rb +0 -2
  45. data/lib/webpacker/helper.rb +43 -13
  46. data/lib/webpacker/manifest.rb +1 -1
  47. data/lib/webpacker/version.rb +1 -1
  48. data/lib/webpacker/webpack_runner.rb +0 -1
  49. data/package.json +1 -1
  50. data/package/__tests__/development.js +1 -2
  51. data/package/babel/preset-react.js +62 -0
  52. data/package/babel/preset.js +13 -24
  53. data/package/environments/__tests__/base.js +5 -5
  54. data/package/environments/base.js +20 -15
  55. data/package/environments/development.js +0 -1
  56. data/package/environments/production.js +30 -28
  57. data/package/index.js +2 -7
  58. data/package/rules/babel.js +1 -1
  59. data/package/rules/coffee.js +5 -5
  60. data/package/rules/erb.js +3 -5
  61. data/package/rules/file.js +3 -5
  62. data/package/rules/index.js +17 -9
  63. data/package/rules/less.js +10 -14
  64. data/package/rules/sass.js +9 -13
  65. data/package/rules/svg.js +23 -0
  66. data/package/utils/get_style_rule.js +31 -27
  67. data/package/utils/helpers.js +0 -25
  68. data/test/configuration_test.rb +2 -2
  69. data/test/dev_server_runner_test.rb +2 -10
  70. data/test/helper_test.rb +39 -33
  71. data/test/manifest_test.rb +0 -8
  72. data/test/mounted_app/test/dummy/config/webpacker.yml +3 -3
  73. data/test/test_app/app/{packs/entrypoints → javascript/packs}/application.js +1 -1
  74. data/test/test_app/app/{packs/entrypoints → javascript/packs}/multi_entry.css +0 -0
  75. data/test/test_app/app/{packs/entrypoints → javascript/packs}/multi_entry.js +0 -0
  76. data/test/test_app/config/webpacker.yml +3 -3
  77. data/test/test_app/public/packs/manifest.json +0 -7
  78. metadata +36 -18
  79. data/config/README.md +0 -3
  80. data/config/webpacker.yml +0 -1
  81. data/docs/v6_upgrade.md +0 -86
  82. data/package/__tests__/index.js +0 -9
  83. data/package/rules/raw.js +0 -5
  84. data/package/rules/stylus.js +0 -26
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: webpacker
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.0.0.beta.7
4
+ version: 6.0.0.pre.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Heinemeier Hansson
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2021-04-22 00:00:00.000000000 Z
12
+ date: 2020-12-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
@@ -133,11 +133,27 @@ files:
133
133
  - MIT-LICENSE
134
134
  - README.md
135
135
  - Rakefile
136
- - config/README.md
137
- - config/webpacker.yml
136
+ - docs/assets.md
137
+ - docs/cloud9.md
138
+ - docs/css.md
138
139
  - docs/deployment.md
140
+ - docs/docker.md
141
+ - docs/engines.md
142
+ - docs/env.md
143
+ - docs/es6.md
144
+ - docs/folder-structure.md
145
+ - docs/integrations.md
146
+ - docs/misc.md
147
+ - docs/props.md
148
+ - docs/react.md
149
+ - docs/target.md
150
+ - docs/testing.md
139
151
  - docs/troubleshooting.md
140
- - docs/v6_upgrade.md
152
+ - docs/typescript.md
153
+ - docs/v4-upgrade.md
154
+ - docs/webpack-dev-server.md
155
+ - docs/webpack.md
156
+ - docs/yarn.md
141
157
  - gemfiles/Gemfile-rails-edge
142
158
  - gemfiles/Gemfile-rails.5.2.x
143
159
  - gemfiles/Gemfile-rails.6.0.x
@@ -149,7 +165,10 @@ files:
149
165
  - lib/install/config/webpack/production.js
150
166
  - lib/install/config/webpack/test.js
151
167
  - lib/install/config/webpacker.yml
152
- - lib/install/packs/entrypoints/application.js
168
+ - lib/install/examples/vue3/app.vue
169
+ - lib/install/examples/vue3/hello_vue.js
170
+ - lib/install/javascript/packs/application.css
171
+ - lib/install/javascript/packs/application.js
153
172
  - lib/install/template.rb
154
173
  - lib/tasks/webpacker.rake
155
174
  - lib/tasks/webpacker/binstubs.rake
@@ -183,10 +202,10 @@ files:
183
202
  - package/__tests__/dev_server.js
184
203
  - package/__tests__/development.js
185
204
  - package/__tests__/env.js
186
- - package/__tests__/index.js
187
205
  - package/__tests__/production.js
188
206
  - package/__tests__/staging.js
189
207
  - package/__tests__/test.js
208
+ - package/babel/preset-react.js
190
209
  - package/babel/preset.js
191
210
  - package/config.js
192
211
  - package/configPath.js
@@ -205,9 +224,8 @@ files:
205
224
  - package/rules/file.js
206
225
  - package/rules/index.js
207
226
  - package/rules/less.js
208
- - package/rules/raw.js
209
227
  - package/rules/sass.js
210
- - package/rules/stylus.js
228
+ - package/rules/svg.js
211
229
  - package/utils/get_style_rule.js
212
230
  - package/utils/helpers.js
213
231
  - test/command_test.rb
@@ -230,9 +248,9 @@ files:
230
248
  - test/mounted_app/test/dummy/package.json
231
249
  - test/rake_tasks_test.rb
232
250
  - test/test_app/Rakefile
233
- - test/test_app/app/packs/entrypoints/application.js
234
- - test/test_app/app/packs/entrypoints/multi_entry.css
235
- - test/test_app/app/packs/entrypoints/multi_entry.js
251
+ - test/test_app/app/javascript/packs/application.js
252
+ - test/test_app/app/javascript/packs/multi_entry.css
253
+ - test/test_app/app/javascript/packs/multi_entry.js
236
254
  - test/test_app/bin/webpack
237
255
  - test/test_app/bin/webpack-dev-server
238
256
  - test/test_app/config.ru
@@ -254,8 +272,8 @@ homepage: https://github.com/rails/webpacker
254
272
  licenses:
255
273
  - MIT
256
274
  metadata:
257
- source_code_uri: https://github.com/rails/webpacker/tree/v6.0.0.beta.7
258
- changelog_uri: https://github.com/rails/webpacker/blob/v6.0.0.beta.7/CHANGELOG.md
275
+ source_code_uri: https://github.com/rails/webpacker/tree/v6.0.0.pre.1
276
+ changelog_uri: https://github.com/rails/webpacker/blob/v6.0.0.pre.1/CHANGELOG.md
259
277
  post_install_message:
260
278
  rdoc_options: []
261
279
  require_paths:
@@ -271,7 +289,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
271
289
  - !ruby/object:Gem::Version
272
290
  version: 1.3.1
273
291
  requirements: []
274
- rubygems_version: 3.2.3
292
+ rubygems_version: 3.0.3
275
293
  signing_key:
276
294
  specification_version: 4
277
295
  summary: Use webpack to manage app-like JavaScript modules in Rails
@@ -296,9 +314,9 @@ test_files:
296
314
  - test/mounted_app/test/dummy/package.json
297
315
  - test/rake_tasks_test.rb
298
316
  - test/test_app/Rakefile
299
- - test/test_app/app/packs/entrypoints/application.js
300
- - test/test_app/app/packs/entrypoints/multi_entry.css
301
- - test/test_app/app/packs/entrypoints/multi_entry.js
317
+ - test/test_app/app/javascript/packs/application.js
318
+ - test/test_app/app/javascript/packs/multi_entry.css
319
+ - test/test_app/app/javascript/packs/multi_entry.js
302
320
  - test/test_app/bin/webpack
303
321
  - test/test_app/bin/webpack-dev-server
304
322
  - test/test_app/config.ru
data/config/README.md DELETED
@@ -1,3 +0,0 @@
1
- # Note
2
-
3
- This directory exists for Jest specs that execute code expecting the Rails config directory at this path.
data/config/webpacker.yml DELETED
@@ -1 +0,0 @@
1
- config/lib/install/config/webpacker.yml
data/docs/v6_upgrade.md DELETED
@@ -1,86 +0,0 @@
1
- # To Webpacker v6 from v5
2
-
3
- This guide aims to help you migrating to Webpacker 6. If you are using vanilla Webpacker install then hopefully, the upgrade should be really straightforward.
4
-
5
- ## Main differences with v5
6
-
7
- The main goal for Webpacker v6 is to manage the JavaScript in your Rails application with Webpack. This will allows you, for example, to use JavaScript modules, automatic code splitting using multiple entry points, use PostCSS or use [Vue](https://vuejs.org/) or [React](https://reactjs.org/).
8
-
9
- You probably don't want to install Webpacker and Webpack if you only need some JavaScript Sprinkles, Sass integration, images and fonts support.
10
-
11
- ### Default integrations
12
-
13
- By default, Webpacker v6 out of the box supports JS and static assets (fonts, images etc.) compilation. Webpacker now detects automatically relevant packages to support more tools.
14
-
15
- See [Integrations](https://github.com/rails/webpacker#integrations) for more information.
16
-
17
- Why? Because most developers don't need to handle CSS, SASS or another tools with Webpack. [Sprockets](https://github.com/rails/sprockets) is probably enough and we don't want to make things harder.
18
-
19
- ### Simpler API
20
-
21
- Webpacker is still a wrapper around [Webpack](https://webpack.js.org/) to simplify the integration in your Rails application.
22
-
23
- But we noticed that the [Webpacker v5 configuration](https://github.com/rails/webpacker/blob/5-x-stable/docs/webpack.md) was a bit confusing mostly because Webpack is a complicated beast to manage.
24
-
25
- There are so many different toolchains in JavaScript these days, it would be impossible to create te perfect configuration for everybody. That is also why defaults installers have been removed.
26
-
27
- In order to simplify even more the configuration, the custom API to manage the Webpack configuration has been removed.
28
-
29
- Now you have a straight access to the Webpack configuration and you can change it very easily with webpack-merge. So now, you can refer to the documentation of the tools you want to install it with Webpack. Here is an example with [Vue](https://github.com/rails/webpacker#other-frameworks).
30
-
31
- ## How to upgrade to Webpacker v6
32
-
33
- 1. If your `source_path` is `app/javascript`, rename it to `app/packs`
34
- 2. If your `source_entry_path` is `packs`, rename it to `entrypoints`
35
- 3. Rename `config/webpack` to `config/webpack_old`
36
- 4. Rename `config/webpacker.yml` to `config/webpacker_old.yml`
37
- 5. Uninstall the current version of `webpack-dev-server`: `yarn remove webpack-dev-server`
38
- 6. Upgrade Webpacker
39
-
40
- ```ruby
41
- # Gemfile
42
- gem 'webpacker', '~> 6.0.0.pre.2'
43
- ```
44
-
45
- ```bash
46
- bundle install
47
- ```
48
-
49
- ```bash
50
- yarn add @rails/webpacker@next
51
- ```
52
-
53
- ```bash
54
- bundle exec rails webpacker:install
55
- ```
56
-
57
- - Change `javascript_packs_with_chunks_tag` and `stylesheet_packs_with_chunks_tag` to `javascript_pack_tag` and
58
- `stylesheet_pack_tag`.
59
-
60
- 7. If you are using any integrations like `css`, `React` or `TypeScript`. Please see https://github.com/rails/webpacker#integrations section on how they work in v6.
61
-
62
- 8. Copy over any custom webpack config from `config/webpack_old`
63
-
64
- - Common code previously called 'environment' changed to 'base'
65
- - import `environment` changed name to `webpackConfig`.
66
-
67
- ```js
68
- // config/webpack/base.js
69
- const { webpackConfig, merge } = require('@rails/webpacker')
70
- const customConfig = require('./custom')
71
-
72
- module.exports = merge(webpackConfig, customConfig)
73
- ```
74
-
75
- 9. Copy over custom browserlist config from `.browserlistrc` if it exists into the `"browserlist"` key in `package.json` and remove `.browserslistrc`.
76
-
77
- 10. `extensions` was removed from the webpacker.yml file. Move custom extensions to
78
- your configuration by by merging an object like this. For more details, see docs for
79
- [Webpack Configuration](https://github.com/rails/webpacker/blob/master/README.md#webpack-configuration)
80
- ```js
81
- {
82
- resolve: {
83
- extensions: ['.ts', '.tsx']
84
- }
85
- }
86
- ```
@@ -1,9 +0,0 @@
1
- const index = require('../index')
2
-
3
- describe('index', () => {
4
- test('exports webpack-merge v5 functions', () => {
5
- expect(index.merge).toBeInstanceOf(Function)
6
- expect(index.mergeWithRules).toBeInstanceOf(Function)
7
- expect(index.mergeWithCustomize).toBeInstanceOf(Function)
8
- })
9
- })
data/package/rules/raw.js DELETED
@@ -1,5 +0,0 @@
1
- module.exports = {
2
- test: [/\.html$/],
3
- exclude: [/\.(js|mjs|jsx|ts|tsx)$/],
4
- type: 'asset/source'
5
- }
@@ -1,26 +0,0 @@
1
- const path = require('path')
2
- const { canProcess } = require('../utils/helpers')
3
- const getStyleRule = require('../utils/get_style_rule')
4
-
5
- const {
6
- additional_paths: paths,
7
- source_path: sourcePath
8
- } = require('../config')
9
-
10
- module.exports = canProcess('stylus-loader', (resolvedPath) =>
11
- getStyleRule(/\.(styl(us)?)(\.erb)?$/i, [
12
- {
13
- loader: resolvedPath,
14
- options: {
15
- stylusOptions: {
16
- include: [
17
- path.resolve(__dirname, 'node_modules'),
18
- sourcePath,
19
- ...paths
20
- ]
21
- },
22
- sourceMap: true
23
- }
24
- }
25
- ])
26
- )