shakapacker 10.1.0.rc.0 → 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: 632a8c1773b8b7168ac13d0b0675e886c3d1359635ddd695b32e12218748708c
4
- data.tar.gz: 8dcd25b6593ff26d8b277c01c54a1df970e69ced4166a5a918c9123fc04bdea1
3
+ metadata.gz: d36ec9e941315cd710726a116edf81a344d8f5557330c4e7dfcbe4facbbbf0c0
4
+ data.tar.gz: d3f3c4c28525eae6a01bd081b302e70008463b24e464bdbabfa69465f9f0b524
5
5
  SHA512:
6
- metadata.gz: 461f192f52757479deb8251b434b34b7c1839f923ae02725917f85ba96b47e1a1f9d45cc1dabf989f9fa33156dbcfa479d613143f2f2e0b95152a589be9bb852
7
- data.tar.gz: a6070c988e4a317f91210f642eb25471fc2827c67e7cdad659a0c040839c0cd2c3adb1b9293eceb17a7586fd2128c4d46a776a8b387f5322bd53a348ec5ece82
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.0] - May 20, 2026
12
+ ## [v10.1.0-rc.2] - May 23, 2026
13
13
 
14
14
  ### Added
15
15
 
@@ -33,16 +33,21 @@
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).
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).
41
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.
42
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`.
43
46
  - **Fixed `NodePackageVersion#find_version` for local-path `shakapacker` installs (e.g. `yalc`, `file:`, relative paths)**. [PR #1086](https://github.com/shakacode/shakapacker/pull/1086) by [justin808](https://github.com/justin808). The version check now consults `package.json` first and short-circuits on `../` or `file:` dependencies, so stale lockfile semvers no longer trigger false gem↔node version mismatches. `package_json_dependency` also consults `devDependencies` in addition to `dependencies`. The `LOCAL_PATH_REGEX` constant replaces a duplicated inline regex and anchors both alternatives to the start of the string, removing a latent false-positive on version strings containing `..` mid-value.
44
47
  - **Detected single-dot (`./...`) local-path declarations in `NodePackageVersion#find_version`**. [PR #1106](https://github.com/shakacode/shakapacker/pull/1106) by [justin808](https://github.com/justin808). Extended `LOCAL_PATH_REGEX` to treat `./vendor/shakapacker`-style declarations as local-path installs (alongside the `../` and `file:` patterns added in [#1086](https://github.com/shakacode/shakapacker/pull/1086)), so version checks short-circuit before consulting potentially stale lockfile semvers. Fixes [#1103](https://github.com/shakacode/shakapacker/issues/1103).
45
48
  - **Fix rspack setup not reusing certain shared webpack-rspack config settings**. [PR #1085](https://github.com/shakacode/shakapacker/pull/1085) by [brunodccarvalho](https://github.com/brunodccarvalho). Default config changes include `optimization.splitChunks.chunks="all"`, `optimization.runtimeChunk="single"`, the webpack compression plugin in production, and the removal of minimization plugins in development. Fixes [#984](https://github.com/shakacode/shakapacker/issues/984).
49
+ - **Fixed Rspack Sass rule blocking `sass-embedded` users by requiring the `sass` package**. [PR #1105](https://github.com/shakacode/shakapacker/pull/1105) by [justin808](https://github.com/justin808). Rspack Sass detection now only checks for `sass-loader`; the implementation (`sass`, `sass-embedded`, etc.) is resolved by the loader at build time, matching the webpack code path.
50
+ - **Fixed `bin/shakapacker-config` and `bin/diff-bundler-config` in ESM apps**. [PR #1104](https://github.com/shakacode/shakapacker/pull/1104) by [justin808](https://github.com/justin808). Apps with `"type": "module"` in `package.json` failed to run the JavaScript binstubs because Node parsed them as ESM. The binstubs are now Ruby wrappers that locate Node and invoke `.cjs` package scripts shipped inside `node_modules/shakapacker/package/bin/`. Existing apps with the old JavaScript binstubs should re-run `bundle exec rake shakapacker:binstubs` to install the new Ruby wrappers.
46
51
 
47
52
  ## [v10.0.0] - April 8, 2026
48
53
 
@@ -944,8 +949,8 @@ Note: [Rubygem is 6.3.0.pre.rc.1](https://rubygems.org/gems/shakapacker/versions
944
949
 
945
950
  See [CHANGELOG.md in rails/webpacker (up to v5.4.3)](https://github.com/rails/webpacker/blob/master/CHANGELOG.md)
946
951
 
947
- [Unreleased]: https://github.com/shakacode/shakapacker/compare/v10.1.0-rc.0...main
948
- [v10.1.0-rc.0]: https://github.com/shakacode/shakapacker/compare/v10.0.0...v10.1.0-rc.0
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
949
954
  [v10.0.0]: https://github.com/shakacode/shakapacker/compare/v9.7.0...v10.0.0
950
955
  [v9.7.0]: https://github.com/shakacode/shakapacker/compare/v9.6.1...v9.7.0
951
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,64 +1,75 @@
1
- #!/usr/bin/env node
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
 
3
- const { createRequire } = require("module")
4
+ require "rbconfig"
4
5
 
5
- const PACK_CONFIG_DIFF_PACKAGE = "pack-config-diff"
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).
11
+ def shakapacker_app_root
12
+ candidate = File.expand_path("..", __dir__)
13
+ return candidate if File.exist?(File.join(candidate, "Gemfile"))
6
14
 
7
- function formatError(error) {
8
- return error instanceof Error ? error.message : String(error)
9
- }
15
+ warn "[Shakapacker] No Gemfile found at #{candidate.inspect}; " \
16
+ "falling back to the current directory (#{Dir.pwd.inspect})."
17
+ Dir.pwd
18
+ end
10
19
 
11
- function exitWithCode(exitCode) {
12
- if (!Number.isInteger(exitCode)) {
13
- console.error(
14
- `[Shakapacker] ${PACK_CONFIG_DIFF_PACKAGE} returned a non-integer exit code: ${String(exitCode)}`
15
- )
16
- process.exit(2)
17
- }
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) != ""
18
26
 
19
- // Forward only pack-config-diff's documented exit codes (0 = no diffs, 1 = diffs found).
20
- // Any other code is a tool failure — normalize to 2.
21
- process.exit(exitCode <= 1 ? exitCode : 2)
22
- }
27
+ ([executable] + extensions.map { |extension| "#{executable}#{extension}" }).uniq
28
+ end
23
29
 
24
- let run
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
25
37
 
26
- try {
27
- // Resolve pack-config-diff via shakapacker's dependency tree so strict package
28
- // managers (pnpm, Yarn PnP) can find the transitive dependency.
29
- const shakapackerRequire = createRequire(
30
- require.resolve("shakapacker/package.json")
31
- )
32
- const loadedModule = shakapackerRequire("pack-config-diff")
33
- run = loadedModule.run
34
- } catch (error) {
35
- console.error(
36
- `[Shakapacker] Failed to load ${PACK_CONFIG_DIFF_PACKAGE}: ${formatError(error)}`
37
- )
38
- process.exit(2)
39
- }
38
+ nil
39
+ end
40
40
 
41
- if (typeof run !== "function") {
42
- console.error(
43
- `[Shakapacker] ${PACK_CONFIG_DIFF_PACKAGE} did not export a run() function`
44
- )
45
- process.exit(2)
46
- }
41
+ def shakapacker_node_binary
42
+ node_bin = shakapacker_find_executable("node")
43
+ return node_bin if node_bin
47
44
 
48
- try {
49
- const runResult = run(process.argv.slice(2))
45
+ warn '[Shakapacker] Could not find Node.js executable "node". ' \
46
+ "Install Node.js and try again."
47
+ exit 1
48
+ end
50
49
 
51
- if (runResult && typeof runResult.then === "function") {
52
- runResult
53
- .then((exitCode) => exitWithCode(exitCode))
54
- .catch((error) => {
55
- console.error(formatError(error))
56
- process.exit(2)
57
- })
58
- } else {
59
- exitWithCode(runResult)
60
- }
61
- } catch (error) {
62
- console.error(formatError(error))
63
- process.exit(2)
64
- }
50
+ def shakapacker_node_env
51
+ %w[development test].include?(ENV["RAILS_ENV"]) ? "development" : "production"
52
+ end
53
+
54
+ ENV["RAILS_ENV"] ||= ENV["RACK_ENV"] || "development"
55
+ ENV["NODE_ENV"] ||= shakapacker_node_env
56
+
57
+ app_root = shakapacker_app_root
58
+ node_bin = shakapacker_node_binary
59
+ script_path = File.join(
60
+ app_root,
61
+ "node_modules",
62
+ "shakapacker",
63
+ "package",
64
+ "bin",
65
+ "diff-bundler-config.cjs"
66
+ )
67
+
68
+ unless File.file?(script_path)
69
+ warn "[Shakapacker] Could not find #{script_path}. Run your package manager install command and try again."
70
+ exit 1
71
+ end
72
+
73
+ Dir.chdir(app_root) do
74
+ exec node_bin, script_path, *ARGV
75
+ end
@@ -1,11 +1,75 @@
1
- #!/usr/bin/env node
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
 
3
- // Minimal shim - all logic is in the TypeScript module
4
- const { run } = require("shakapacker/configExporter")
4
+ require "rbconfig"
5
5
 
6
- run(process.argv.slice(2))
7
- .then((exitCode) => process.exit(exitCode))
8
- .catch((error) => {
9
- console.error(error.message)
10
- process.exit(1)
11
- })
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).
11
+ def shakapacker_app_root
12
+ candidate = File.expand_path("..", __dir__)
13
+ return candidate if File.exist?(File.join(candidate, "Gemfile"))
14
+
15
+ warn "[Shakapacker] No Gemfile found at #{candidate.inspect}; " \
16
+ "falling back to the current directory (#{Dir.pwd.inspect})."
17
+ Dir.pwd
18
+ end
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
+
41
+ def shakapacker_node_binary
42
+ node_bin = shakapacker_find_executable("node")
43
+ return node_bin if node_bin
44
+
45
+ warn '[Shakapacker] Could not find Node.js executable "node". ' \
46
+ "Install Node.js and try again."
47
+ exit 1
48
+ end
49
+
50
+ def shakapacker_node_env
51
+ %w[development test].include?(ENV["RAILS_ENV"]) ? "development" : "production"
52
+ end
53
+
54
+ ENV["RAILS_ENV"] ||= ENV["RACK_ENV"] || "development"
55
+ ENV["NODE_ENV"] ||= shakapacker_node_env
56
+
57
+ app_root = shakapacker_app_root
58
+ node_bin = shakapacker_node_binary
59
+ script_path = File.join(
60
+ app_root,
61
+ "node_modules",
62
+ "shakapacker",
63
+ "package",
64
+ "bin",
65
+ "shakapacker-config.cjs"
66
+ )
67
+
68
+ unless File.file?(script_path)
69
+ warn "[Shakapacker] Could not find #{script_path}. Run your package manager install command and try again."
70
+ exit 1
71
+ end
72
+
73
+ Dir.chdir(app_root) do
74
+ exec node_bin, script_path, *ARGV
75
+ end
@@ -165,9 +165,6 @@ development:
165
165
  # port than your Rails server and the browser blocks cross-origin asset requests):
166
166
  # headers:
167
167
  # "Access-Control-Allow-Origin": "*"
168
- static:
169
- watch:
170
- ignored: "**/node_modules/**"
171
168
 
172
169
  test:
173
170
  <<: *default
@@ -1,4 +1,4 @@
1
1
  module Shakapacker
2
2
  # Change the version in package.json too, please!
3
- VERSION = "10.1.0.rc.0".freeze
3
+ VERSION = "10.1.0.rc.2".freeze
4
4
  end
@@ -6,21 +6,25 @@ namespace :shakapacker do
6
6
  node_version = `node -v || nodejs -v`.strip
7
7
  raise Errno::ENOENT if node_version.blank?
8
8
 
9
- pkg_path = Pathname.new("#{__dir__}/../../../package.json").realpath
10
- node_range = JSON.parse(pkg_path.read)["engines"]["node"]
11
- is_valid = SemanticRange.satisfies?(node_version, node_range) rescue false
12
- semver_major = node_version[/\d+/] rescue nil
13
- is_unstable = semver_major.to_i.odd? rescue false
9
+ # Skip the engines.node range check if the gem-root package.json
10
+ # isn't shipped, so a missing file doesn't masquerade as Node missing.
11
+ pkg_path = Pathname.new("#{__dir__}/../../../package.json")
12
+ if pkg_path.exist?
13
+ node_range = JSON.parse(pkg_path.read)["engines"]["node"]
14
+ is_valid = SemanticRange.satisfies?(node_version, node_range) rescue false
15
+ semver_major = node_version[/\d+/] rescue nil
16
+ is_unstable = semver_major.to_i.odd? rescue false
14
17
 
15
- if is_unstable
16
- $stderr.puts "Warning: you are using an unstable release of Node.js (#{node_version}). If you encounter issues with Node.js, consider switching to an Active LTS release. More info: https://docs.npmjs.com/try-the-latest-stable-version-of-node"
17
- end
18
+ if is_unstable
19
+ $stderr.puts "Warning: you are using an unstable release of Node.js (#{node_version}). If you encounter issues with Node.js, consider switching to an Active LTS release. More info: https://docs.npmjs.com/try-the-latest-stable-version-of-node"
20
+ end
18
21
 
19
- unless is_valid
20
- $stderr.puts "Shakapacker requires Node.js \"#{node_range}\" and you are using #{node_version}"
21
- $stderr.puts "Please upgrade Node.js https://nodejs.org/en/download/"
22
- $stderr.puts "Exiting!"
23
- exit!
22
+ unless is_valid
23
+ $stderr.puts "Shakapacker requires Node.js \"#{node_range}\" and you are using #{node_version}"
24
+ $stderr.puts "Please upgrade Node.js https://nodejs.org/en/download/"
25
+ $stderr.puts "Exiting!"
26
+ exit!
27
+ end
24
28
  end
25
29
  rescue Errno::ENOENT
26
30
  $stderr.puts "Node.js not installed. Please download and install Node.js https://nodejs.org/en/download/"
@@ -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("node", gem_bin_path, *ARGV[1..])
74
+ Kernel.exec(RbConfig.ruby, gem_bin_path, *ARGV[1..])
58
75
  end
59
76
  else
60
- # Pass through command-line arguments after the task name
61
- # Use exec to replace the rake process with the export script
62
- # This ensures proper exit codes and signal handling
77
+ # Pass through command-line arguments after the task name.
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(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 ADDED
@@ -0,0 +1,234 @@
1
+ {
2
+ "name": "shakapacker",
3
+ "version": "10.1.0-rc.2",
4
+ "description": "Use webpack to manage app-like JavaScript modules in Rails",
5
+ "homepage": "https://github.com/shakacode/shakapacker",
6
+ "bugs": {
7
+ "url": "https://github.com/shakacode/shakapacker/issues"
8
+ },
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "git+https://github.com/shakacode/shakapacker.git"
12
+ },
13
+ "license": "MIT",
14
+ "author": "David Heinemeier Hansson <david@basecamp.com>, Justin Gordon <justin@shakacode.com>",
15
+ "main": "package/index.js",
16
+ "types": "package/index.d.ts",
17
+ "exports": {
18
+ ".": "./package/index.js",
19
+ "./types": "./package/types/index.js",
20
+ "./webpack": "./package/webpack/index.js",
21
+ "./rspack": "./package/rspack/index.js",
22
+ "./swc": "./package/swc/index.js",
23
+ "./esbuild": "./package/esbuild/index.js",
24
+ "./configExporter": "./package/configExporter/index.js",
25
+ "./package.json": "./package.json",
26
+ "./package/babel/preset.js": "./package/babel/preset.js",
27
+ "./package/config": "./package/config.js",
28
+ "./package/*": "./package/*"
29
+ },
30
+ "bin": {
31
+ "shakapacker-config": "package/bin/shakapacker-config.cjs",
32
+ "diff-bundler-config": "package/bin/diff-bundler-config.cjs"
33
+ },
34
+ "files": [
35
+ "package",
36
+ "lib/install/config/shakapacker.yml"
37
+ ],
38
+ "scripts": {
39
+ "clean:ts": "find package -name '*.ts' -not -name '*.d.ts' | sed 's/\\.ts$//' | xargs -I {} rm -f {}.js {}.d.ts {}.d.ts.map {}.js.map",
40
+ "build": "tsc && cp package/index.d.ts.template package/index.d.ts && node scripts/remove-use-strict.js && yarn prettier --write 'package/**/*.js' 'package/**/*.ts'",
41
+ "build:types": "tsc",
42
+ "knip": "knip",
43
+ "knip:production": "knip --production",
44
+ "lint": "eslint . --cache",
45
+ "lint:fast": "eslint . --config eslint.config.fast.js --cache",
46
+ "test": "jest",
47
+ "type-check": "tsc --noEmit",
48
+ "prepublishOnly": "yarn build && yarn type-check"
49
+ },
50
+ "dependencies": {
51
+ "js-yaml": "^4.1.0",
52
+ "pack-config-diff": "^0.1.0",
53
+ "path-complete-extname": "^1.0.0",
54
+ "webpack-merge": "^5.8.0",
55
+ "yargs": "^17.7.2"
56
+ },
57
+ "devDependencies": {
58
+ "@babel/core": "7.29.0",
59
+ "@eslint/eslintrc": "^3.2.0",
60
+ "@eslint/js": "^9.37.0",
61
+ "@rspack/cli": "2.0.1",
62
+ "@rspack/core": "2.0.1",
63
+ "@swc/core": "1.15.33",
64
+ "@types/babel__core": "^7.20.5",
65
+ "@types/js-yaml": "^4.0.9",
66
+ "@types/node": "^24.5.2",
67
+ "@types/path-complete-extname": "^1.0.3",
68
+ "@types/webpack": "^5.28.5",
69
+ "@types/webpack-dev-server": "^4.7.2",
70
+ "@types/webpack-merge": "^5.0.0",
71
+ "@types/yargs": "^17.0.33",
72
+ "@typescript-eslint/eslint-plugin": "^8.46.0",
73
+ "@typescript-eslint/parser": "^8.46.0",
74
+ "babel-loader": "10.1.1",
75
+ "compression-webpack-plugin": "^9.0.0",
76
+ "css-loader": "7.1.4",
77
+ "esbuild-loader": "4.4.3",
78
+ "eslint": "^9.37.0",
79
+ "eslint-config-airbnb": "^19.0.4",
80
+ "eslint-config-prettier": "^10.1.8",
81
+ "eslint-plugin-import": "^2.32.0",
82
+ "eslint-plugin-jest": "^29.0.1",
83
+ "eslint-plugin-jsx-a11y": "^6.10.2",
84
+ "eslint-plugin-react": "^7.37.5",
85
+ "eslint-plugin-react-hooks": "^7.0.0",
86
+ "husky": "^9.1.7",
87
+ "jest": "^29.7.0",
88
+ "knip": "^5.64.2",
89
+ "lint-staged": "^15.2.10",
90
+ "memory-fs": "^0.5.0",
91
+ "mini-css-extract-plugin": "2.10.2",
92
+ "prettier": "^3.6.2",
93
+ "rspack-manifest-plugin": "5.2.1",
94
+ "sass-loader": "16.0.7",
95
+ "swc-loader": "0.2.7",
96
+ "thenify": "^3.3.1",
97
+ "ts-jest": "^29.4.5",
98
+ "typescript": "^5.9.2",
99
+ "webpack": "5.106.2",
100
+ "webpack-assets-manifest": "6.5.1",
101
+ "webpack-cli": "7.0.2",
102
+ "webpack-subresource-integrity": "5.1.0"
103
+ },
104
+ "peerDependencies": {
105
+ "@babel/core": "^7.17.9",
106
+ "@babel/plugin-transform-runtime": "^7.17.0",
107
+ "@babel/preset-env": "^7.16.11",
108
+ "@babel/runtime": "^7.17.9",
109
+ "@rspack/cli": "^1.0.0 || ^2.0.0-0",
110
+ "@rspack/core": "^1.0.0 || ^2.0.0-0",
111
+ "@rspack/plugin-react-refresh": "^1.0.0 || ^2.0.0",
112
+ "@swc/core": "^1.3.0",
113
+ "@types/babel__core": "^7.0.0",
114
+ "@types/webpack": "^5.0.0",
115
+ "babel-loader": "^8.2.4 || ^9.0.0 || ^10.0.0",
116
+ "compression-webpack-plugin": "^9.0.0 || ^10.0.0 || ^11.0.0 || ^12.0.0",
117
+ "css-loader": "^6.8.1 || ^7.0.0",
118
+ "esbuild": ">=0.14.0 <1.0.0",
119
+ "esbuild-loader": "^2.0.0 || ^3.0.0 || ^4.0.0",
120
+ "mini-css-extract-plugin": "^2.0.0",
121
+ "rspack-manifest-plugin": "^5.0.0",
122
+ "sass": "^1.50.0",
123
+ "sass-loader": "^13.0.0 || ^14.0.0 || ^15.0.0 || ^16.0.0",
124
+ "swc-loader": "^0.1.15 || ^0.2.0",
125
+ "terser-webpack-plugin": "^5.3.1",
126
+ "webpack": "^5.101.0",
127
+ "webpack-assets-manifest": "^5.0.6 || ^6.0.0",
128
+ "webpack-cli": "^4.9.2 || ^5.0.0 || ^6.0.0 || ^7.0.0",
129
+ "webpack-dev-server": "^5.2.2",
130
+ "webpack-subresource-integrity": "^5.1.0"
131
+ },
132
+ "peerDependenciesMeta": {
133
+ "@babel/core": {
134
+ "optional": true
135
+ },
136
+ "@babel/plugin-transform-runtime": {
137
+ "optional": true
138
+ },
139
+ "@babel/preset-env": {
140
+ "optional": true
141
+ },
142
+ "@babel/runtime": {
143
+ "optional": true
144
+ },
145
+ "@rspack/core": {
146
+ "optional": true
147
+ },
148
+ "@rspack/cli": {
149
+ "optional": true
150
+ },
151
+ "@rspack/plugin-react-refresh": {
152
+ "optional": true
153
+ },
154
+ "@swc/core": {
155
+ "optional": true
156
+ },
157
+ "@types/babel__core": {
158
+ "optional": true
159
+ },
160
+ "@types/webpack": {
161
+ "optional": true
162
+ },
163
+ "babel-loader": {
164
+ "optional": true
165
+ },
166
+ "compression-webpack-plugin": {
167
+ "optional": true
168
+ },
169
+ "css-loader": {
170
+ "optional": true
171
+ },
172
+ "esbuild": {
173
+ "optional": true
174
+ },
175
+ "esbuild-loader": {
176
+ "optional": true
177
+ },
178
+ "mini-css-extract-plugin": {
179
+ "optional": true
180
+ },
181
+ "rspack-manifest-plugin": {
182
+ "optional": true
183
+ },
184
+ "sass": {
185
+ "optional": true
186
+ },
187
+ "sass-loader": {
188
+ "optional": true
189
+ },
190
+ "swc-loader": {
191
+ "optional": true
192
+ },
193
+ "terser-webpack-plugin": {
194
+ "optional": true
195
+ },
196
+ "webpack": {
197
+ "optional": true
198
+ },
199
+ "webpack-assets-manifest": {
200
+ "optional": true
201
+ },
202
+ "webpack-cli": {
203
+ "optional": true
204
+ },
205
+ "webpack-dev-server": {
206
+ "optional": true
207
+ },
208
+ "webpack-subresource-integrity": {
209
+ "optional": true
210
+ }
211
+ },
212
+ "packageManager": "yarn@1.22.22",
213
+ "lint-staged": {
214
+ "*.{js,jsx}": [
215
+ "eslint --fix",
216
+ "prettier --write"
217
+ ],
218
+ "*.{ts,tsx}": [
219
+ "eslint --fix",
220
+ "prettier --write",
221
+ "node scripts/type-check-no-emit.js"
222
+ ],
223
+ "*.{json,yml,yaml,md}": [
224
+ "prettier --write"
225
+ ]
226
+ },
227
+ "engines": {
228
+ "node": "^20.19.0 || >=22.12.0",
229
+ "yarn": ">=1 <5"
230
+ },
231
+ "publishConfig": {
232
+ "access": "public"
233
+ }
234
+ }
data/shakapacker.gemspec CHANGED
@@ -28,6 +28,6 @@ Gem::Specification.new do |s|
28
28
  s.add_development_dependency "rubocop"
29
29
  s.add_development_dependency "rubocop-performance"
30
30
 
31
- s.files = `git ls-files -z CHANGELOG.md MIT-LICENSE README.md shakapacker.gemspec lib sig`.split("\x0")
31
+ s.files = `git ls-files -z CHANGELOG.md MIT-LICENSE README.md package.json shakapacker.gemspec lib sig`.split("\x0")
32
32
  s.test_files = []
33
33
  end
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.0
4
+ version: 10.1.0.rc.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Heinemeier Hansson
@@ -208,6 +208,7 @@ files:
208
208
  - lib/tasks/shakapacker/switch_bundler.rake
209
209
  - lib/tasks/shakapacker/verify_config.rake
210
210
  - lib/tasks/shakapacker/verify_install.rake
211
+ - package.json
211
212
  - shakapacker.gemspec
212
213
  - sig/shakapacker.rbs
213
214
  - sig/shakapacker/commands.rbs
@@ -224,7 +225,7 @@ homepage: https://github.com/shakacode/shakapacker
224
225
  licenses:
225
226
  - MIT
226
227
  metadata:
227
- source_code_uri: https://github.com/shakacode/shakapacker/tree/v10.1.0-rc.0
228
+ source_code_uri: https://github.com/shakacode/shakapacker/tree/v10.1.0-rc.2
228
229
  rdoc_options: []
229
230
  require_paths:
230
231
  - lib