shakapacker 10.1.0.rc.1 → 10.1.0.rc.2

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b2dbe6638add4651d5bd04b2c7138619f43427c71af173bc73ff10d231cefbed
4
- data.tar.gz: 298bb003983f87e10e1cf61665e6bfab52bee6a8c632320f01323a6212de7c0e
3
+ metadata.gz: d36ec9e941315cd710726a116edf81a344d8f5557330c4e7dfcbe4facbbbf0c0
4
+ data.tar.gz: d3f3c4c28525eae6a01bd081b302e70008463b24e464bdbabfa69465f9f0b524
5
5
  SHA512:
6
- metadata.gz: 40b41c276daa9b229524738cb969b3e3e6f1aa6b6c31ff7e4e77d18e1a72291a48dd9c4efca11fddfeebdeb886f16632cd6af0b94a4dde652333afb6c6d0b10d
7
- data.tar.gz: 6c1b242e31123d3a331028305181fc0ca99650606b9d8273287f37cf4670d1103dd0fc670e48b91335ee5f222e605df94dbfa18d44e2555e7fd3dc25e1bae326
6
+ metadata.gz: a3b25c4c07c913755c6d2b03fbd12cb45b64c3b076d60b2166f3f1c74b3b8bfd85131decbec440d9a7d133397e8d410b1f26f8483d3d4a5b361af7ec09d0452e
7
+ data.tar.gz: 50e61dfd3b36c21f9875225dc587dab9897153e7e4c7825c97720927a6690325ec7a2e1f8d69f5a1a9a46eb8ddc6521c5780490bbf51cbb07cdc7de4a41b60f0
data/CHANGELOG.md CHANGED
@@ -9,7 +9,7 @@
9
9
 
10
10
  ## [Unreleased]
11
11
 
12
- ## [v10.1.0-rc.1] - May 21, 2026
12
+ ## [v10.1.0-rc.2] - May 23, 2026
13
13
 
14
14
  ### Added
15
15
 
@@ -33,11 +33,13 @@
33
33
 
34
34
  ### Changed
35
35
 
36
+ - **Restructured `shakapacker-webpack` and `shakapacker-rspack` dependency declarations**. [PR #1133](https://github.com/shakacode/shakapacker/pull/1133) by [justin808](https://github.com/justin808). In response to [#1131](https://github.com/shakacode/shakapacker/issues/1131), bundler singletons (`webpack`, `webpack-cli`, `webpack-assets-manifest` for webpack; `@rspack/core`, `@rspack/cli`, `rspack-manifest-plugin` for rspack) are now **required peer dependencies** instead of direct `dependencies`. This eliminates the silent duplicate-bundler failure mode that direct deps could cause when an app or transitive dep pinned a different bundler version. npm 7+ auto-installs required peers, preserving the one-command install experience there; pnpm and Yarn PnP users should keep packages imported by app config files as explicit app dependencies (the Rails installer handles this automatically). The tilde (`~`) constraints from the v10.1.0-rc.1 shape have also been loosened to caret (`^`) for all non-`shakapacker` packages, so consumers can pick up upstream patch/minor releases without waiting for a coordinated Shakapacker release. `terser-webpack-plugin` moved from optional peer to direct dependency on `shakapacker-webpack` because `package/optimization/webpack.ts` always requires it for the default production minimizer.
36
37
  - **Changed `shakapacker:install` to default fresh Rspack installs to v2 (`^2.0.0-0`)**. [PR #1091](https://github.com/shakacode/shakapacker/pull/1091) by [ihabadham](https://github.com/ihabadham). `lib/install/package.json` now declares `@rspack/core` and `@rspack/cli` as `^1.0.0 || ^2.0.0-0`; fresh installs pick the v2 range. Existing apps are unaffected. Note: Rspack v2 requires Node.js 20.19.0+.
37
- - **Slimmed the published gem from ~486K (294 files) to ~121K (75 files)**. [PR #1110](https://github.com/shakacode/shakapacker/pull/1110) by [justin808](https://github.com/justin808). Replaced the broad `git ls-files` gem manifest with an explicit runtime/install allowlist (`CHANGELOG.md`, `MIT-LICENSE`, `README.md`, gemspec, `lib`, `sig`), excluding repo-only docs, tests, JavaScript package source, CI/tooling files, and `test_files` metadata from the published gem. Fixes [#987](https://github.com/shakacode/shakapacker/issues/987).
38
+ - **Slimmed the published gem from ~486K (294 files) to ~121K (75 files)**. [PR #1110](https://github.com/shakacode/shakapacker/pull/1110), [PR #1120](https://github.com/shakacode/shakapacker/pull/1120) by [justin808](https://github.com/justin808). Replaced the broad `git ls-files` gem manifest with an explicit runtime/install allowlist (`CHANGELOG.md`, `MIT-LICENSE`, `README.md`, gemspec, `lib`, `sig`, `package.json`), excluding repo-only docs, tests, JavaScript package source, CI/tooling files, and `test_files` metadata from the published gem. Fixes [#987](https://github.com/shakacode/shakapacker/issues/987).
38
39
 
39
40
  ### Fixed
40
41
 
42
+ - **Fixed config helper binstubs and `shakapacker:export_bundler_config` dispatch for upgraded apps**. [PR #1132](https://github.com/shakacode/shakapacker/pull/1132) by [justin808](https://github.com/justin808). The export task now runs legacy JavaScript `bin/shakapacker-config` binstubs via Node while keeping Ruby binstubs on Ruby. Generated helper binstubs now map `NODE_ENV` from `RAILS_ENV`, locate Node without executing it during lookup, and print useful messages for non-`Error` CLI rejections. Fixes [#1123](https://github.com/shakacode/shakapacker/issues/1123).
41
43
  - **Fixed webpack-dev-server `static` config defaulting to watch `public/` directory unnecessarily**. [PR #1032](https://github.com/shakacode/shakapacker/pull/1032) by [ihabadham](https://github.com/ihabadham). Three bugs fixed: (1) `static` now defaults to `false` instead of a misconfigured object that caused webpack-dev-server to watch the `public/` directory, which is already served by Rails via `ActionDispatch::Static`; (2) setting `static: false` in `shakapacker.yml` is no longer silently ignored; (3) the default template no longer includes `static.watch`, which was a v3→v4 migration artifact. Fixes [#1031](https://github.com/shakacode/shakapacker/issues/1031).
42
44
  - **Fixed Rspack React Refresh plugin loading with `@rspack/plugin-react-refresh` v2**. [PR #1116](https://github.com/shakacode/shakapacker/pull/1116) by [justin808](https://github.com/justin808). Shakapacker now reads the v2 named `ReactRefreshRspackPlugin` export while retaining compatibility with v1 direct/default CommonJS export shapes, preventing `TypeError: ReactRefreshRspackPlugin is not a constructor` during rspack dev-server startup.
43
45
  - **Widened `@rspack/plugin-react-refresh` peer range to `^1.0.0 || ^2.0.0-0`**. [PR #1091](https://github.com/shakacode/shakapacker/pull/1091) by [ihabadham](https://github.com/ihabadham). Fixes the `ERESOLVE` conflict when installing `@rspack/plugin-react-refresh@^2.0.0` alongside `shakapacker@10.0.0`.
@@ -947,8 +949,8 @@ Note: [Rubygem is 6.3.0.pre.rc.1](https://rubygems.org/gems/shakapacker/versions
947
949
 
948
950
  See [CHANGELOG.md in rails/webpacker (up to v5.4.3)](https://github.com/rails/webpacker/blob/master/CHANGELOG.md)
949
951
 
950
- [Unreleased]: https://github.com/shakacode/shakapacker/compare/v10.1.0-rc.1...main
951
- [v10.1.0-rc.1]: https://github.com/shakacode/shakapacker/compare/v10.0.0...v10.1.0-rc.1
952
+ [Unreleased]: https://github.com/shakacode/shakapacker/compare/v10.1.0-rc.2...main
953
+ [v10.1.0-rc.2]: https://github.com/shakacode/shakapacker/compare/v10.0.0...v10.1.0-rc.2
952
954
  [v10.0.0]: https://github.com/shakacode/shakapacker/compare/v9.7.0...v10.0.0
953
955
  [v9.7.0]: https://github.com/shakacode/shakapacker/compare/v9.6.1...v9.7.0
954
956
  [v9.6.1]: https://github.com/shakacode/shakapacker/compare/v9.6.0...v9.6.1
data/README.md CHANGED
@@ -1,3 +1,9 @@
1
+ <p align="center">
2
+ <a href="https://shakapacker.com">
3
+ <img src="./assets/brand/lockup-light.png?raw=true" alt="Shakapacker: Rails asset bundling with modern build systems" width="760">
4
+ </a>
5
+ </p>
6
+
1
7
  # Shakapacker (v10)
2
8
 
3
9
  ---
@@ -11,6 +17,7 @@ _📖 **Full documentation at [shakapacker.com](https://shakapacker.com)**_
11
17
  _Official, actively maintained successor to [rails/webpacker](https://github.com/rails/webpacker). ShakaCode stands behind the long-term maintenance and development of this project for the Rails community._
12
18
 
13
19
  - ⚠️ See the [6-stable](https://github.com/shakacode/shakapacker/tree/6-stable) branch for Shakapacker v6.x code and documentation. :warning:
20
+ - **New in 10.1: optional `shakapacker-webpack` and `shakapacker-rspack` packages let you replace four `devDependencies` with one. See the [v10.1 supplemental packages migration guide](./docs/migration/v10.1-supplemental-packages.md).**
14
21
  - **See the [v10.0.0 release notes](https://github.com/shakacode/shakapacker/releases/tag/v10.0.0) for upgrading from v9 to v10.**
15
22
  - **See [V9 Upgrade](./docs/v9_upgrade.md) for upgrading from v8 to v9.**
16
23
  - See [V8 Upgrade](./docs/v8_upgrade.md) for upgrading from the v7 release.
@@ -1,8 +1,13 @@
1
1
  #!/usr/bin/env ruby
2
2
  # frozen_string_literal: true
3
3
 
4
- # Keep in sync with lib/install/bin/shakapacker-config and the template in
5
- # package/configExporter/cli.ts (createBinStub).
4
+ require "rbconfig"
5
+
6
+ # Keep helper logic in sync across:
7
+ # - lib/install/bin/shakapacker-config
8
+ # - lib/install/bin/diff-bundler-config
9
+ # - spec/dummy/bin/shakapacker-config
10
+ # - package/configExporter/cli.ts (createBinStub).
6
11
  def shakapacker_app_root
7
12
  candidate = File.expand_path("..", __dir__)
8
13
  return candidate if File.exist?(File.join(candidate, "Gemfile"))
@@ -12,17 +17,42 @@ def shakapacker_app_root
12
17
  Dir.pwd
13
18
  end
14
19
 
20
+ def shakapacker_executable_candidates(executable)
21
+ extensions = [
22
+ RbConfig::CONFIG["EXEEXT"],
23
+ *ENV.fetch("PATHEXT", "").split(File::PATH_SEPARATOR)
24
+ ].compact.reject(&:empty?)
25
+ return [executable] if extensions.empty? || File.extname(executable) != ""
26
+
27
+ ([executable] + extensions.map { |extension| "#{executable}#{extension}" }).uniq
28
+ end
29
+
30
+ def shakapacker_find_executable(executable)
31
+ ENV.fetch("PATH", "").split(File::PATH_SEPARATOR).each do |path|
32
+ shakapacker_executable_candidates(executable).each do |candidate|
33
+ executable_path = File.join(path, candidate)
34
+ return executable_path if File.file?(executable_path) && File.executable?(executable_path)
35
+ end
36
+ end
37
+
38
+ nil
39
+ end
40
+
15
41
  def shakapacker_node_binary
16
- node_bin = "node"
17
- return node_bin if system(node_bin, "--version", out: File::NULL, err: File::NULL)
42
+ node_bin = shakapacker_find_executable("node")
43
+ return node_bin if node_bin
18
44
 
19
- warn "[Shakapacker] Could not find Node.js executable #{node_bin.inspect}. " \
45
+ warn '[Shakapacker] Could not find Node.js executable "node". ' \
20
46
  "Install Node.js and try again."
21
47
  exit 1
22
48
  end
23
49
 
50
+ def shakapacker_node_env
51
+ %w[development test].include?(ENV["RAILS_ENV"]) ? "development" : "production"
52
+ end
53
+
24
54
  ENV["RAILS_ENV"] ||= ENV["RACK_ENV"] || "development"
25
- ENV["NODE_ENV"] ||= "development"
55
+ ENV["NODE_ENV"] ||= shakapacker_node_env
26
56
 
27
57
  app_root = shakapacker_app_root
28
58
  node_bin = shakapacker_node_binary
@@ -1,8 +1,13 @@
1
1
  #!/usr/bin/env ruby
2
2
  # frozen_string_literal: true
3
3
 
4
- # Keep in sync with lib/install/bin/diff-bundler-config and the template in
5
- # package/configExporter/cli.ts (createBinStub).
4
+ require "rbconfig"
5
+
6
+ # Keep helper logic in sync across:
7
+ # - lib/install/bin/shakapacker-config
8
+ # - lib/install/bin/diff-bundler-config
9
+ # - spec/dummy/bin/shakapacker-config
10
+ # - package/configExporter/cli.ts (createBinStub).
6
11
  def shakapacker_app_root
7
12
  candidate = File.expand_path("..", __dir__)
8
13
  return candidate if File.exist?(File.join(candidate, "Gemfile"))
@@ -12,17 +17,42 @@ def shakapacker_app_root
12
17
  Dir.pwd
13
18
  end
14
19
 
20
+ def shakapacker_executable_candidates(executable)
21
+ extensions = [
22
+ RbConfig::CONFIG["EXEEXT"],
23
+ *ENV.fetch("PATHEXT", "").split(File::PATH_SEPARATOR)
24
+ ].compact.reject(&:empty?)
25
+ return [executable] if extensions.empty? || File.extname(executable) != ""
26
+
27
+ ([executable] + extensions.map { |extension| "#{executable}#{extension}" }).uniq
28
+ end
29
+
30
+ def shakapacker_find_executable(executable)
31
+ ENV.fetch("PATH", "").split(File::PATH_SEPARATOR).each do |path|
32
+ shakapacker_executable_candidates(executable).each do |candidate|
33
+ executable_path = File.join(path, candidate)
34
+ return executable_path if File.file?(executable_path) && File.executable?(executable_path)
35
+ end
36
+ end
37
+
38
+ nil
39
+ end
40
+
15
41
  def shakapacker_node_binary
16
- node_bin = "node"
17
- return node_bin if system(node_bin, "--version", out: File::NULL, err: File::NULL)
42
+ node_bin = shakapacker_find_executable("node")
43
+ return node_bin if node_bin
18
44
 
19
- warn "[Shakapacker] Could not find Node.js executable #{node_bin.inspect}. " \
45
+ warn '[Shakapacker] Could not find Node.js executable "node". ' \
20
46
  "Install Node.js and try again."
21
47
  exit 1
22
48
  end
23
49
 
50
+ def shakapacker_node_env
51
+ %w[development test].include?(ENV["RAILS_ENV"]) ? "development" : "production"
52
+ end
53
+
24
54
  ENV["RAILS_ENV"] ||= ENV["RACK_ENV"] || "development"
25
- ENV["NODE_ENV"] ||= "development"
55
+ ENV["NODE_ENV"] ||= shakapacker_node_env
26
56
 
27
57
  app_root = shakapacker_app_root
28
58
  node_bin = shakapacker_node_binary
@@ -1,4 +1,4 @@
1
1
  module Shakapacker
2
2
  # Change the version in package.json too, please!
3
- VERSION = "10.1.0.rc.1".freeze
3
+ VERSION = "10.1.0.rc.2".freeze
4
4
  end
@@ -1,4 +1,21 @@
1
1
  namespace :shakapacker do
2
+ def shakapacker_config_binstub_command(bin_path)
3
+ # Read in binary mode so Windows CRLF line endings do not leak \r into the shebang.
4
+ shebang = File.open(bin_path, "rb", &:gets).to_s
5
+ command = shebang.delete_prefix("#!").strip.split(/\s+/)
6
+ executable = File.basename(command.first.to_s)
7
+
8
+ if executable == "env"
9
+ executable = File.basename(command.drop(1).find { |part| !part.start_with?("-") }.to_s)
10
+ end
11
+
12
+ # Legacy JS binstubs are dispatched via PATH lookup; Kernel#exec resolves
13
+ # "node" through the shell's PATH. The Ruby binstubs perform their own
14
+ # explicit lookup via shakapacker_find_executable, which matters more on
15
+ # Windows where PATHEXT is involved.
16
+ executable == "node" ? ["node", bin_path.to_s] : [RbConfig.ruby, bin_path.to_s]
17
+ end
18
+
2
19
  desc <<~DESC
3
20
  Export webpack or rspack configuration for debugging and analysis
4
21
 
@@ -54,14 +71,14 @@ namespace :shakapacker do
54
71
  $stderr.puts ""
55
72
 
56
73
  Dir.chdir(Rails.root) do
57
- exec(RbConfig.ruby, gem_bin_path, *ARGV[1..])
74
+ Kernel.exec(RbConfig.ruby, gem_bin_path, *ARGV[1..])
58
75
  end
59
76
  else
60
77
  # Pass through command-line arguments after the task name.
61
- # Invoke with RbConfig.ruby so the binstub runs under the same Ruby as Rake
62
- # (avoids version-manager/shebang mismatches and works on Windows).
78
+ # Ruby binstubs run under the same Ruby as Rake; legacy JavaScript
79
+ # binstubs from upgraded apps still need Node until users refresh them.
63
80
  Dir.chdir(Rails.root) do
64
- exec(RbConfig.ruby, bin_path.to_s, *ARGV[1..])
81
+ Kernel.exec(*shakapacker_config_binstub_command(bin_path), *ARGV[1..])
65
82
  end
66
83
  end
67
84
  end
data/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shakapacker",
3
- "version": "10.1.0-rc.1",
3
+ "version": "10.1.0-rc.2",
4
4
  "description": "Use webpack to manage app-like JavaScript modules in Rails",
5
5
  "homepage": "https://github.com/shakacode/shakapacker",
6
6
  "bugs": {
@@ -108,14 +108,14 @@
108
108
  "@babel/runtime": "^7.17.9",
109
109
  "@rspack/cli": "^1.0.0 || ^2.0.0-0",
110
110
  "@rspack/core": "^1.0.0 || ^2.0.0-0",
111
- "@rspack/plugin-react-refresh": "^1.0.0 || ^2.0.0-0",
111
+ "@rspack/plugin-react-refresh": "^1.0.0 || ^2.0.0",
112
112
  "@swc/core": "^1.3.0",
113
113
  "@types/babel__core": "^7.0.0",
114
114
  "@types/webpack": "^5.0.0",
115
115
  "babel-loader": "^8.2.4 || ^9.0.0 || ^10.0.0",
116
116
  "compression-webpack-plugin": "^9.0.0 || ^10.0.0 || ^11.0.0 || ^12.0.0",
117
117
  "css-loader": "^6.8.1 || ^7.0.0",
118
- "esbuild": "^0.14.0 || ^0.15.0 || ^0.16.0 || ^0.17.0 || ^0.18.0 || ^0.19.0 || ^0.20.0 || ^0.21.0 || ^0.22.0 || ^0.23.0 || ^0.24.0 || ^0.25.0 || ^0.26.0 || ^0.27.0",
118
+ "esbuild": ">=0.14.0 <1.0.0",
119
119
  "esbuild-loader": "^2.0.0 || ^3.0.0 || ^4.0.0",
120
120
  "mini-css-extract-plugin": "^2.0.0",
121
121
  "rspack-manifest-plugin": "^5.0.0",
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shakapacker
3
3
  version: !ruby/object:Gem::Version
4
- version: 10.1.0.rc.1
4
+ version: 10.1.0.rc.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Heinemeier Hansson
@@ -225,7 +225,7 @@ homepage: https://github.com/shakacode/shakapacker
225
225
  licenses:
226
226
  - MIT
227
227
  metadata:
228
- source_code_uri: https://github.com/shakacode/shakapacker/tree/v10.1.0-rc.1
228
+ source_code_uri: https://github.com/shakacode/shakapacker/tree/v10.1.0-rc.2
229
229
  rdoc_options: []
230
230
  require_paths:
231
231
  - lib