shakapacker 10.0.0 → 10.1.0.rc.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 (232) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +40 -1
  3. data/README.md +23 -14
  4. data/lib/install/bin/diff-bundler-config +45 -64
  5. data/lib/install/bin/shakapacker-config +43 -9
  6. data/lib/install/config/shakapacker.yml +0 -3
  7. data/lib/install/package.json +2 -2
  8. data/lib/shakapacker/compiler.rb +29 -0
  9. data/lib/shakapacker/doctor.rb +325 -13
  10. data/lib/shakapacker/version.rb +1 -1
  11. data/lib/shakapacker/version_checker.rb +24 -3
  12. data/lib/tasks/shakapacker/check_node.rake +17 -13
  13. data/lib/tasks/shakapacker/export_bundler_config.rake +5 -5
  14. data/package.json +23 -17
  15. data/shakapacker.gemspec +2 -6
  16. metadata +3 -268
  17. data/.claude/commands/address-review.md +0 -234
  18. data/.claude/commands/update-changelog.md +0 -354
  19. data/.claude/commands/verify.md +0 -12
  20. data/.claude/rules/coding-style.md +0 -7
  21. data/.claude/rules/git-workflow.md +0 -6
  22. data/.claude/rules/open-source.md +0 -7
  23. data/.claude/rules/testing.md +0 -9
  24. data/.github/FUNDING.yml +0 -1
  25. data/.github/ISSUE_TEMPLATE/bug_report.md +0 -21
  26. data/.github/ISSUE_TEMPLATE/feature_request.md +0 -19
  27. data/.github/PULL_REQUEST_TEMPLATE.md +0 -21
  28. data/.github/STATUS.md +0 -1
  29. data/.github/actionlint-matcher.json +0 -17
  30. data/.github/workflows/claude-code-review.yml +0 -45
  31. data/.github/workflows/claude.yml +0 -55
  32. data/.github/workflows/dummy.yml +0 -48
  33. data/.github/workflows/eslint-validation.yml +0 -46
  34. data/.github/workflows/generator.yml +0 -86
  35. data/.github/workflows/node.yml +0 -171
  36. data/.github/workflows/ruby.yml +0 -132
  37. data/.github/workflows/test-bundlers.yml +0 -183
  38. data/.github/workflows/trigger-docs-site.yml +0 -24
  39. data/.gitignore +0 -46
  40. data/.husky/pre-commit +0 -2
  41. data/.node-version +0 -1
  42. data/.npmignore +0 -56
  43. data/.prettierignore +0 -8
  44. data/.rspec +0 -1
  45. data/.rubocop.yml +0 -231
  46. data/.yalcignore +0 -26
  47. data/CLAUDE.md +0 -74
  48. data/CONTRIBUTING.md +0 -379
  49. data/ESLINT_TECHNICAL_DEBT.md +0 -165
  50. data/Gemfile +0 -5
  51. data/Gemfile.development_dependencies +0 -15
  52. data/Rakefile +0 -88
  53. data/TODO.md +0 -58
  54. data/TODO_v9.md +0 -97
  55. data/__mocks__/nonexistent/package.json +0 -4
  56. data/__mocks__/sass-loader/package.json +0 -4
  57. data/bin/conductor-exec +0 -24
  58. data/bin/diff-bundler-config +0 -64
  59. data/bin/setup +0 -36
  60. data/bin/shakapacker-config +0 -11
  61. data/conductor-setup.sh +0 -147
  62. data/conductor.json +0 -9
  63. data/config/README.md +0 -3
  64. data/config/shakapacker.yml +0 -1
  65. data/docs/api-reference.md +0 -497
  66. data/docs/cdn_setup.md +0 -384
  67. data/docs/common-upgrades.md +0 -695
  68. data/docs/config-diff.md +0 -159
  69. data/docs/configuration.md +0 -845
  70. data/docs/css-modules-export-mode.md +0 -525
  71. data/docs/customizing_babel_config.md +0 -89
  72. data/docs/deployment.md +0 -195
  73. data/docs/developing_shakapacker.md +0 -35
  74. data/docs/early_hints.md +0 -433
  75. data/docs/early_hints_manual_api.md +0 -454
  76. data/docs/feature_testing.md +0 -492
  77. data/docs/node_package_api.md +0 -70
  78. data/docs/optional-peer-dependencies.md +0 -205
  79. data/docs/peer-dependencies.md +0 -77
  80. data/docs/precompile_hook.md +0 -487
  81. data/docs/preventing_fouc.md +0 -132
  82. data/docs/react.md +0 -83
  83. data/docs/releasing.md +0 -293
  84. data/docs/rspack.md +0 -218
  85. data/docs/rspack_migration_guide.md +0 -849
  86. data/docs/sprockets.md +0 -11
  87. data/docs/style_loader_vs_mini_css.md +0 -48
  88. data/docs/subresource_integrity.md +0 -60
  89. data/docs/transpiler-migration.md +0 -212
  90. data/docs/transpiler-performance.md +0 -200
  91. data/docs/troubleshooting.md +0 -521
  92. data/docs/typescript-migration.md +0 -388
  93. data/docs/typescript.md +0 -103
  94. data/docs/using_esbuild_loader.md +0 -128
  95. data/docs/using_swc_loader.md +0 -258
  96. data/docs/v6_upgrade.md +0 -195
  97. data/docs/v7_upgrade.md +0 -61
  98. data/docs/v8_upgrade.md +0 -193
  99. data/docs/v9_upgrade.md +0 -618
  100. data/eslint.config.fast.js +0 -254
  101. data/eslint.config.js +0 -309
  102. data/gemfiles/Gemfile-rails-edge +0 -12
  103. data/gemfiles/Gemfile-rails.6.0.x +0 -10
  104. data/gemfiles/Gemfile-rails.6.1.x +0 -12
  105. data/gemfiles/Gemfile-rails.7.0.x +0 -12
  106. data/gemfiles/Gemfile-rails.7.1.x +0 -11
  107. data/gemfiles/Gemfile-rails.7.2.x +0 -11
  108. data/gemfiles/Gemfile-rails.8.0.x +0 -11
  109. data/jest.config.js +0 -12
  110. data/knip.ts +0 -69
  111. data/package/.npmignore +0 -4
  112. data/package/babel/preset.ts +0 -59
  113. data/package/config.ts +0 -189
  114. data/package/configExporter/buildValidator.ts +0 -906
  115. data/package/configExporter/cli.ts +0 -1748
  116. data/package/configExporter/configDocs.ts +0 -102
  117. data/package/configExporter/configFile.ts +0 -663
  118. data/package/configExporter/fileWriter.ts +0 -112
  119. data/package/configExporter/index.ts +0 -15
  120. data/package/configExporter/types.ts +0 -159
  121. data/package/configExporter/yamlSerializer.ts +0 -391
  122. data/package/dev_server.ts +0 -27
  123. data/package/env.ts +0 -92
  124. data/package/environments/__type-tests__/rspack-plugin-compatibility.ts +0 -36
  125. data/package/environments/base.ts +0 -147
  126. data/package/environments/development.ts +0 -88
  127. data/package/environments/production.ts +0 -82
  128. data/package/environments/test.ts +0 -55
  129. data/package/environments/types.ts +0 -98
  130. data/package/esbuild/index.ts +0 -40
  131. data/package/index.d.ts +0 -72
  132. data/package/index.d.ts.template +0 -72
  133. data/package/index.ts +0 -104
  134. data/package/loaders.d.ts +0 -28
  135. data/package/optimization/rspack.ts +0 -36
  136. data/package/optimization/webpack.ts +0 -55
  137. data/package/plugins/envFilter.ts +0 -82
  138. data/package/plugins/rspack.ts +0 -119
  139. data/package/plugins/webpack.ts +0 -82
  140. data/package/rspack/index.ts +0 -91
  141. data/package/rules/babel.ts +0 -19
  142. data/package/rules/coffee.ts +0 -6
  143. data/package/rules/css.ts +0 -3
  144. data/package/rules/erb.ts +0 -21
  145. data/package/rules/esbuild.ts +0 -10
  146. data/package/rules/file.ts +0 -41
  147. data/package/rules/jscommon.ts +0 -27
  148. data/package/rules/less.ts +0 -22
  149. data/package/rules/raw.ts +0 -28
  150. data/package/rules/rspack.ts +0 -174
  151. data/package/rules/sass.ts +0 -21
  152. data/package/rules/stylus.ts +0 -22
  153. data/package/rules/swc.ts +0 -10
  154. data/package/rules/webpack.ts +0 -15
  155. data/package/swc/index.ts +0 -54
  156. data/package/types/README.md +0 -90
  157. data/package/types/index.ts +0 -69
  158. data/package/types.ts +0 -105
  159. data/package/utils/bundlerUtils.ts +0 -232
  160. data/package/utils/configPath.ts +0 -6
  161. data/package/utils/debug.ts +0 -45
  162. data/package/utils/defaultConfigPath.ts +0 -7
  163. data/package/utils/ensureManifestExists.ts +0 -17
  164. data/package/utils/errorCodes.ts +0 -249
  165. data/package/utils/errorHelpers.ts +0 -152
  166. data/package/utils/getStyleRule.ts +0 -75
  167. data/package/utils/helpers.ts +0 -99
  168. data/package/utils/inliningCss.ts +0 -8
  169. data/package/utils/pathValidation.ts +0 -207
  170. data/package/utils/requireOrError.ts +0 -24
  171. data/package/utils/snakeToCamelCase.ts +0 -5
  172. data/package/utils/typeGuards.ts +0 -388
  173. data/package/utils/validateDependencies.ts +0 -61
  174. data/package/webpack-types.d.ts +0 -33
  175. data/package/webpackDevServerConfig.ts +0 -151
  176. data/prettier.config.js +0 -4
  177. data/scripts/remove-use-strict.js +0 -44
  178. data/scripts/type-check-no-emit.js +0 -27
  179. data/test/configExporter/buildValidator.test.js +0 -1295
  180. data/test/configExporter/configFile.test.js +0 -393
  181. data/test/configExporter/integration.test.js +0 -262
  182. data/test/helpers.js +0 -67
  183. data/test/package/bundlerUtils.rspack.test.js +0 -149
  184. data/test/package/bundlerUtils.test.js +0 -97
  185. data/test/package/config.test.js +0 -111
  186. data/test/package/configExporter/cli.test.js +0 -440
  187. data/test/package/configExporter/types.test.js +0 -163
  188. data/test/package/configExporter.test.js +0 -491
  189. data/test/package/dev_server.test.js +0 -44
  190. data/test/package/development.test.js +0 -52
  191. data/test/package/env.test.js +0 -92
  192. data/test/package/environments/base.test.js +0 -124
  193. data/test/package/environments/development.test.js +0 -59
  194. data/test/package/environments/production.test.js +0 -115
  195. data/test/package/helpers.test.js +0 -11
  196. data/test/package/index.test.js +0 -54
  197. data/test/package/plugins/envFiltering.test.js +0 -453
  198. data/test/package/plugins/webpackSubresourceIntegrity.test.js +0 -89
  199. data/test/package/production.test.js +0 -41
  200. data/test/package/rspack/index.test.js +0 -293
  201. data/test/package/rspack/optimization.test.js +0 -86
  202. data/test/package/rspack/plugins.test.js +0 -185
  203. data/test/package/rspack/rules.test.js +0 -229
  204. data/test/package/rules/babel.test.js +0 -85
  205. data/test/package/rules/esbuild.test.js +0 -68
  206. data/test/package/rules/file.test.js +0 -87
  207. data/test/package/rules/raw.test.js +0 -45
  208. data/test/package/rules/sass-version-parsing.test.js +0 -71
  209. data/test/package/rules/sass.test.js +0 -28
  210. data/test/package/rules/sass1.test.js +0 -26
  211. data/test/package/rules/sass16.test.js +0 -24
  212. data/test/package/rules/swc.test.js +0 -70
  213. data/test/package/rules/webpack.test.js +0 -35
  214. data/test/package/staging.test.js +0 -41
  215. data/test/package/test.test.js +0 -37
  216. data/test/package/transpiler-defaults.test.js +0 -169
  217. data/test/package/utils/ensureManifestExists.test.js +0 -51
  218. data/test/package/webpackDevServerConfig.test.js +0 -55
  219. data/test/package/yamlSerializer.test.js +0 -204
  220. data/test/peer-dependencies.sh +0 -85
  221. data/test/resolver.js +0 -44
  222. data/test/scripts/remove-use-strict.test.js +0 -125
  223. data/test/typescript/build.test.js +0 -118
  224. data/test/typescript/environments.test.js +0 -107
  225. data/test/typescript/pathValidation.test.js +0 -186
  226. data/test/typescript/requireOrError.test.js +0 -49
  227. data/test/typescript/securityValidation.test.js +0 -182
  228. data/tools/README.md +0 -134
  229. data/tools/css-modules-v9-codemod.js +0 -179
  230. data/tsconfig.eslint.json +0 -9
  231. data/tsconfig.json +0 -38
  232. data/yarn.lock +0 -6806
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '08b8b40c44fa65d3a426d14596e15d7e5da7e486f0659c03822aa34a7f7e5474'
4
- data.tar.gz: eadf1441efba9b99b1e9918075d12eb5cb08f4d71c63bb00d8c58c93d36d4ab6
3
+ metadata.gz: b2dbe6638add4651d5bd04b2c7138619f43427c71af173bc73ff10d231cefbed
4
+ data.tar.gz: 298bb003983f87e10e1cf61665e6bfab52bee6a8c632320f01323a6212de7c0e
5
5
  SHA512:
6
- metadata.gz: c50b9fe63645ef4f2890ed6e0ddeeb73a21afe51e827ed39d5daebafda00517bf5299e72ad056ecf74650214d21407f0de948a876a7a5ac789de1581240f8e64
7
- data.tar.gz: 6651deb390179edc5aea7f0abe9db2a6065b5674be9e4d8eee13de5642d590f600673eab5f7178caa12d14547cce9e1ad376e784ebee2c1377205e9112e38a05
6
+ metadata.gz: 40b41c276daa9b229524738cb969b3e3e6f1aa6b6c31ff7e4e77d18e1a72291a48dd9c4efca11fddfeebdeb886f16632cd6af0b94a4dde652333afb6c6d0b10d
7
+ data.tar.gz: 6c1b242e31123d3a331028305181fc0ca99650606b9d8273287f37cf4670d1103dd0fc670e48b91335ee5f222e605df94dbfa18d44e2555e7fd3dc25e1bae326
data/CHANGELOG.md CHANGED
@@ -9,6 +9,44 @@
9
9
 
10
10
  ## [Unreleased]
11
11
 
12
+ ## [v10.1.0-rc.1] - May 21, 2026
13
+
14
+ ### Added
15
+
16
+ - **Added supplemental npm packages `shakapacker-webpack` and `shakapacker-rspack`**. [PR #1096](https://github.com/shakacode/shakapacker/pull/1096) by [justin808](https://github.com/justin808). Optional packages that lockstep with core and bundle the managed-build stack as direct `dependencies` (so a single `yarn add shakapacker-webpack` pulls in `shakapacker`, `webpack`, `webpack-cli`, and `webpack-assets-manifest`; the rspack package bundles `shakapacker`, `@rspack/core`, `@rspack/cli`, and `rspack-manifest-plugin`). Optional features (transpilers, dev-server, CSS preprocessors, react-refresh) remain as opt-in `peerDependencies` so SCSS/native-binding bloat isn't forced on every install. The wrappers emit structured warnings (`SHAKAPACKER_BUNDLER_MISMATCH`, `SHAKAPACKER_NO_TRANSPILER`) when `config.assets_bundler` or `javascript_transpiler` doesn't match the installed peers. See the [v10.1 migration guide](docs/migration/v10.1-supplemental-packages.md) for adoption steps and [`docs/dependency-strategy.md`](docs/dependency-strategy.md) for the design rationale and v11 roadmap.
17
+ - **Added `shakapacker:doctor` check for disabled Rspack cache**. [PR #1100](https://github.com/shakacode/shakapacker/pull/1100) by [justin808](https://github.com/justin808). The doctor now inspects the Rspack config file for an explicit `cache: false`, warns when found (disabling cache causes significantly slower builds), and also flags Rspack v1 installs (where persistent cache is experimental) with a recommendation to upgrade to v2.
18
+ - **Added a `shakapacker:doctor` hint to compiler output**. [PR #1100](https://github.com/shakacode/shakapacker/pull/1100) by [justin808](https://github.com/justin808). The compiler now logs a one-time tip suggesting `bundle exec rake shakapacker:doctor` after a failed compilation, so healthy build loops stay quiet.
19
+
20
+ ### Migration Notes
21
+
22
+ - **Simplify your `package.json` by adopting a supplemental package**. Existing apps can drop the explicit managed-build deps from `devDependencies` and rely on the bundled stack:
23
+ - **Rspack apps** can replace `shakapacker` + `@rspack/core` + `@rspack/cli` + `rspack-manifest-plugin` with a single `shakapacker-rspack`. See `packages/shakapacker-rspack/README.md` §"Simplifying an existing rspack install" for the before/after.
24
+ - **Webpack apps** can replace `shakapacker` + `webpack` + `webpack-cli` + `webpack-assets-manifest` with a single `shakapacker-webpack`. See `packages/shakapacker-webpack/README.md` §"Simplifying an existing webpack install" for the before/after.
25
+ - Optional peers (transpilers, `webpack-dev-server`, CSS preprocessors, react-refresh) stay only if your app uses those features.
26
+ - Adoption is opt-in: leaving your `package.json` untouched on v10.1 also continues to work.
27
+
28
+ - **Adopting `shakapacker-webpack` requires `webpack-assets-manifest@^6.0.0`**. Core `shakapacker` still accepts both v5 and v6 (`^5.0.6 || ^6.0.0`), but `shakapacker-webpack` pins `~6.5.1`. Apps still on `webpack-assets-manifest@5.x` must upgrade when switching to the supplemental package; v6 fixed an ENOENT crash on clean builds with `merge: true` and dropped a Node 14 install path. See [the v5→v6 release notes](https://github.com/webdeveric/webpack-assets-manifest/releases) and `packages/shakapacker-webpack/README.md` for details.
29
+
30
+ ### ⚠️ Breaking Changes
31
+
32
+ - **Breaking: tightened `package.json` `engines.node` to `^20.19.0 || >=22.12.0`**. [PR #1099](https://github.com/shakacode/shakapacker/pull/1099) by [justin808](https://github.com/justin808). Raised from `>= 20`, dropping support for Node 20.0.0–20.18.x and Node 21.x to match `@rspack/core@2.0.0-rc.0`. Consumers on those versions will hit an engine error with `--engine-strict` or yarn workspaces and need to upgrade. The PR also bumps `.node-version` to `22.20.0` and updates `conductor-setup.sh` to enforce the same disjoint range up front, so contributors get a clear error before `yarn install` fails with a confusing engine mismatch.
33
+
34
+ ### Changed
35
+
36
+ - **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
+
39
+ ### Fixed
40
+
41
+ - **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
+ - **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
+ - **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`.
44
+ - **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.
45
+ - **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).
46
+ - **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).
47
+ - **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.
48
+ - **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.
49
+
12
50
  ## [v10.0.0] - April 8, 2026
13
51
 
14
52
  ### Added
@@ -909,7 +947,8 @@ Note: [Rubygem is 6.3.0.pre.rc.1](https://rubygems.org/gems/shakapacker/versions
909
947
 
910
948
  See [CHANGELOG.md in rails/webpacker (up to v5.4.3)](https://github.com/rails/webpacker/blob/master/CHANGELOG.md)
911
949
 
912
- [Unreleased]: https://github.com/shakacode/shakapacker/compare/v10.0.0...main
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
913
952
  [v10.0.0]: https://github.com/shakacode/shakapacker/compare/v9.7.0...v10.0.0
914
953
  [v9.7.0]: https://github.com/shakacode/shakapacker/compare/v9.6.1...v9.7.0
915
954
  [v9.6.1]: https://github.com/shakacode/shakapacker/compare/v9.6.0...v9.6.1
data/README.md CHANGED
@@ -1,8 +1,8 @@
1
- # Shakapacker (v9)
1
+ # Shakapacker (v10)
2
2
 
3
3
  ---
4
4
 
5
- _🚀 Shakapacker 9 supports [Rspack](https://rspack.rs/)! 10x faster than webpack!_
5
+ _🚀 Shakapacker 10 supports [Rspack](https://rspack.rs/) up to 17x faster than webpack per [upstream benchmarks](./docs/transpiler-performance.md#published-benchmarks)!_
6
6
 
7
7
  _📖 **Full documentation at [shakapacker.com](https://shakapacker.com)**_
8
8
 
@@ -11,7 +11,8 @@ _📖 **Full documentation at [shakapacker.com](https://shakapacker.com)**_
11
11
  _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
12
 
13
13
  - ⚠️ See the [6-stable](https://github.com/shakacode/shakapacker/tree/6-stable) branch for Shakapacker v6.x code and documentation. :warning:
14
- - **See [V9 Upgrade](./docs/v9_upgrade.md) for upgrading from the v8 release.**
14
+ - **See the [v10.0.0 release notes](https://github.com/shakacode/shakapacker/releases/tag/v10.0.0) for upgrading from v9 to v10.**
15
+ - **See [V9 Upgrade](./docs/v9_upgrade.md) for upgrading from v8 to v9.**
15
16
  - See [V8 Upgrade](./docs/v8_upgrade.md) for upgrading from the v7 release.
16
17
  - See [V7 Upgrade](./docs/v7_upgrade.md) for upgrading from the v6 release.
17
18
  - See [V6 Upgrade](./docs/v6_upgrade.md) for upgrading from v5 or prior v6 releases.
@@ -21,7 +22,7 @@ _Official, actively maintained successor to [rails/webpacker](https://github.com
21
22
  [![Rubocop](https://github.com/shakacode/shakapacker/workflows/Rubocop/badge.svg)](https://github.com/shakacode/shakapacker/actions)
22
23
  [![JS lint](https://github.com/shakacode/shakapacker/workflows/JS%20lint/badge.svg)](https://github.com/shakacode/shakapacker/actions)
23
24
 
24
- [![node.js](https://img.shields.io/badge/node-%3E%3D%2020-brightgreen.svg)](https://www.npmjs.com/package/shakapacker)
25
+ [![node.js](https://img.shields.io/badge/node-%5E20.19.0%20%7C%7C%20%3E%3D22.12.0-brightgreen.svg)](https://www.npmjs.com/package/shakapacker)
25
26
  [![Gem](https://img.shields.io/gem/v/shakapacker.svg)](https://rubygems.org/gems/shakapacker)
26
27
  [![npm version](https://badge.fury.io/js/shakapacker.svg)](https://badge.fury.io/js/shakapacker)
27
28
 
@@ -133,7 +134,7 @@ Here's a testimonial from Jon Rajavuori of [Academia.edu](https://www.academia.e
133
134
 
134
135
  - Ruby 2.7+
135
136
  - Rails 5.2+
136
- - Node.js 20+
137
+ - Node.js `^20.19.0` or `>=22.12.0`
137
138
 
138
139
  ## Features
139
140
 
@@ -159,6 +160,8 @@ _Requires extra packages to be installed._
159
160
 
160
161
  ## Installation
161
162
 
163
+ See the [Installation guide](./docs/installation.md) for a step-by-step walkthrough.
164
+
162
165
  ### Rails v6+
163
166
 
164
167
  With Rails v6+, skip JavaScript for a new app and follow below Manual Installation Steps to manually add the `shakapacker` gem to your Gemfile.
@@ -238,7 +241,7 @@ Depending on your setup, you'll need different subsets of the optional peer depe
238
241
  ```json
239
242
  {
240
243
  "dependencies": {
241
- "shakapacker": "^9.0.0",
244
+ "shakapacker": "^10.0.0",
242
245
  "@babel/core": "^7.17.9",
243
246
  "@babel/plugin-transform-runtime": "^7.17.0",
244
247
  "@babel/preset-env": "^7.16.11",
@@ -261,7 +264,7 @@ Depending on your setup, you'll need different subsets of the optional peer depe
261
264
  ```json
262
265
  {
263
266
  "dependencies": {
264
- "shakapacker": "^9.0.0",
267
+ "shakapacker": "^10.0.0",
265
268
  "@swc/core": "^1.3.0",
266
269
  "swc-loader": "^0.2.0",
267
270
  "compression-webpack-plugin": "^9.0.0",
@@ -274,14 +277,14 @@ Depending on your setup, you'll need different subsets of the optional peer depe
274
277
  }
275
278
  ```
276
279
 
277
- **For Rspack + SWC (10x faster bundling):**
280
+ **For Rspack + SWC (largest end-to-end speedup — see [transpiler-performance guide](./docs/transpiler-performance.md#published-benchmarks)):**
278
281
 
279
282
  ```json
280
283
  {
281
284
  "dependencies": {
282
- "shakapacker": "^9.0.0",
283
- "@rspack/core": "^1.0.0",
284
- "@rspack/cli": "^1.0.0",
285
+ "shakapacker": "^10.0.0",
286
+ "@rspack/core": "^2.0.0-0",
287
+ "@rspack/cli": "^2.0.0-0",
285
288
  "@swc/core": "^1.3.0",
286
289
  "swc-loader": "^0.2.0",
287
290
  "rspack-manifest-plugin": "^5.0.0"
@@ -923,7 +926,7 @@ You can also change your Babel configuration by removing these lines in your `pa
923
926
 
924
927
  ### SWC configuration
925
928
 
926
- SWC is the recommended JavaScript transpiler in Shakapacker v9+ (20x faster than Babel). New installations use SWC by default via the installation template. You can read more at [SWC usage docs](./docs/using_swc_loader.md).
929
+ SWC is the recommended JavaScript transpiler in Shakapacker v10 (this default was introduced in v9). SWC's own benchmark reports being [20x faster than Babel on a single thread and 70x faster on four cores](https://swc.rs/); end-to-end Shakapacker speedups are typically smaller but still substantial. New installations use SWC by default via the installation template. You can read more at [SWC usage docs](./docs/using_swc_loader.md).
927
930
 
928
931
  **Note on defaults**: The installation template explicitly sets `javascript_transpiler: "swc"` for new projects. However, for backward compatibility, webpack's runtime default (when no explicit config exists) remains `"babel"`. Rspack always defaults to `"swc"`.
929
932
 
@@ -1272,13 +1275,19 @@ npm install shakapacker@next
1272
1275
 
1273
1276
  Also, consult the [CHANGELOG](./CHANGELOG.md) for additional upgrade links.
1274
1277
 
1278
+ #### Automating Updates with Dependabot
1279
+
1280
+ Shakapacker is shipped as both a Ruby gem and an npm package, so they must be
1281
+ upgraded together. See [Dependabot configuration for Shakapacker](./docs/dependabot.md)
1282
+ for a `.github/dependabot.yml` example that updates both in a single PR.
1283
+
1275
1284
  #### Common Upgrade Scenarios
1276
1285
 
1277
1286
  For step-by-step guides on common migrations, see the [Common Upgrades Guide](./docs/common-upgrades.md):
1278
1287
 
1279
1288
  - [Migrating Package Managers](./docs/common-upgrades.md#migrating-package-managers) (Yarn ↔ npm, pnpm)
1280
- - [Migrating from Babel to SWC](./docs/common-upgrades.md#migrating-from-babel-to-swc) (20-70x faster builds)
1281
- - [Migrating from Webpack to Rspack](./docs/common-upgrades.md#migrating-from-webpack-to-rspack) (5-10x faster builds)
1289
+ - [Migrating from Babel to SWC](./docs/common-upgrades.md#migrating-from-babel-to-swc) (upstream: ~20x faster transpilation)
1290
+ - [Migrating from Webpack to Rspack](./docs/common-upgrades.md#migrating-from-webpack-to-rspack) (upstream: ~8–17x faster bundler)
1282
1291
 
1283
1292
  ### Paths
1284
1293
 
@@ -1,64 +1,45 @@
1
- #!/usr/bin/env node
2
-
3
- const { createRequire } = require("module")
4
-
5
- const PACK_CONFIG_DIFF_PACKAGE = "pack-config-diff"
6
-
7
- function formatError(error) {
8
- return error instanceof Error ? error.message : String(error)
9
- }
10
-
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
- }
18
-
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
- }
23
-
24
- let run
25
-
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
- }
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
- }
47
-
48
- try {
49
- const runResult = run(process.argv.slice(2))
50
-
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
- }
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ # Keep in sync with lib/install/bin/shakapacker-config and the template in
5
+ # package/configExporter/cli.ts (createBinStub).
6
+ def shakapacker_app_root
7
+ candidate = File.expand_path("..", __dir__)
8
+ return candidate if File.exist?(File.join(candidate, "Gemfile"))
9
+
10
+ warn "[Shakapacker] No Gemfile found at #{candidate.inspect}; " \
11
+ "falling back to the current directory (#{Dir.pwd.inspect})."
12
+ Dir.pwd
13
+ end
14
+
15
+ def shakapacker_node_binary
16
+ node_bin = "node"
17
+ return node_bin if system(node_bin, "--version", out: File::NULL, err: File::NULL)
18
+
19
+ warn "[Shakapacker] Could not find Node.js executable #{node_bin.inspect}. " \
20
+ "Install Node.js and try again."
21
+ exit 1
22
+ end
23
+
24
+ ENV["RAILS_ENV"] ||= ENV["RACK_ENV"] || "development"
25
+ ENV["NODE_ENV"] ||= "development"
26
+
27
+ app_root = shakapacker_app_root
28
+ node_bin = shakapacker_node_binary
29
+ script_path = File.join(
30
+ app_root,
31
+ "node_modules",
32
+ "shakapacker",
33
+ "package",
34
+ "bin",
35
+ "diff-bundler-config.cjs"
36
+ )
37
+
38
+ unless File.file?(script_path)
39
+ warn "[Shakapacker] Could not find #{script_path}. Run your package manager install command and try again."
40
+ exit 1
41
+ end
42
+
43
+ Dir.chdir(app_root) do
44
+ exec node_bin, script_path, *ARGV
45
+ end
@@ -1,11 +1,45 @@
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
+ # Keep in sync with lib/install/bin/diff-bundler-config and the template in
5
+ # package/configExporter/cli.ts (createBinStub).
6
+ def shakapacker_app_root
7
+ candidate = File.expand_path("..", __dir__)
8
+ return candidate if File.exist?(File.join(candidate, "Gemfile"))
5
9
 
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
- })
10
+ warn "[Shakapacker] No Gemfile found at #{candidate.inspect}; " \
11
+ "falling back to the current directory (#{Dir.pwd.inspect})."
12
+ Dir.pwd
13
+ end
14
+
15
+ def shakapacker_node_binary
16
+ node_bin = "node"
17
+ return node_bin if system(node_bin, "--version", out: File::NULL, err: File::NULL)
18
+
19
+ warn "[Shakapacker] Could not find Node.js executable #{node_bin.inspect}. " \
20
+ "Install Node.js and try again."
21
+ exit 1
22
+ end
23
+
24
+ ENV["RAILS_ENV"] ||= ENV["RACK_ENV"] || "development"
25
+ ENV["NODE_ENV"] ||= "development"
26
+
27
+ app_root = shakapacker_app_root
28
+ node_bin = shakapacker_node_binary
29
+ script_path = File.join(
30
+ app_root,
31
+ "node_modules",
32
+ "shakapacker",
33
+ "package",
34
+ "bin",
35
+ "shakapacker-config.cjs"
36
+ )
37
+
38
+ unless File.file?(script_path)
39
+ warn "[Shakapacker] Could not find #{script_path}. Run your package manager install command and try again."
40
+ exit 1
41
+ end
42
+
43
+ Dir.chdir(app_root) do
44
+ exec node_bin, script_path, *ARGV
45
+ 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,7 +1,7 @@
1
1
  {
2
2
  "rspack": {
3
- "@rspack/cli": "^1.0.0",
4
- "@rspack/core": "^1.0.0",
3
+ "@rspack/cli": "^1.0.0 || ^2.0.0-0",
4
+ "@rspack/core": "^1.0.0 || ^2.0.0-0",
5
5
  "rspack-manifest-plugin": "^5.0.0"
6
6
  },
7
7
  "webpack": {
@@ -9,6 +9,14 @@ class Shakapacker::Compiler
9
9
  # Shakapacker::Compiler.env['FRONTEND_API_KEY'] = 'your_secret_key'
10
10
  cattr_accessor(:env) { {} }
11
11
 
12
+ # Class-level state keeps the compile-time doctor hint once-per-process.
13
+ @doctor_hint_shown = false
14
+ DOCTOR_HINT_MUTEX = Mutex.new
15
+
16
+ class << self
17
+ attr_accessor :doctor_hint_shown
18
+ end
19
+
12
20
  delegate :config, :logger, :strategy, to: :instance
13
21
  delegate :fresh?, :stale?, :after_compile_hook, to: :strategy
14
22
 
@@ -184,6 +192,7 @@ class Shakapacker::Compiler
184
192
  else
185
193
  non_empty_streams = [stdout, stderr].delete_if(&:empty?)
186
194
  logger.error "\nCOMPILATION FAILED:\nEXIT STATUS: #{status}\nOUTPUTS:\n#{non_empty_streams.join("\n\n")}"
195
+ show_doctor_hint_once
187
196
  end
188
197
 
189
198
  status.success?
@@ -201,4 +210,24 @@ class Shakapacker::Compiler
201
210
  def bin_shakapacker_path
202
211
  config.root_path.join("bin/shakapacker")
203
212
  end
213
+
214
+ # Fires only after a failed compile, so users in a healthy loop never see the tip.
215
+ def show_doctor_hint_once
216
+ return if self.class.doctor_hint_shown
217
+
218
+ DOCTOR_HINT_MUTEX.synchronize do
219
+ return if self.class.doctor_hint_shown
220
+
221
+ begin
222
+ logger.info "Tip: run 'bundle exec rake shakapacker:doctor' to diagnose configuration issues."
223
+ rescue StandardError => _e
224
+ # Non-critical tip; never abort a build because the logger failed.
225
+ # Named (but unused) variable makes the deliberate swallow explicit.
226
+ return
227
+ end
228
+
229
+ # Assignment is outside the rescue so a flag-setter failure propagates rather than being silenced.
230
+ self.class.doctor_hint_shown = true
231
+ end
232
+ end
204
233
  end