shakapacker 9.0.0 → 9.1.0

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: b4cfe1097512ba4c08cc57b061192f0bb0ad8d5d41a508a5f978068d447eae8c
4
- data.tar.gz: 9dfe66dc0d435f1b045bb51455869fb7da0008055e9d062673b666722a360221
3
+ metadata.gz: 2f96f94846c3ee598308246c0098532ba6248fded2b0d3b3aba786e03f7fcfb9
4
+ data.tar.gz: 85d79f4ff3ad8a6e6383e5e30a0f834fa8400ea31588b839ca6dae13b8f77f9f
5
5
  SHA512:
6
- metadata.gz: f09b82882e96e0867be91135dda3eff2d77b629571d4ff7fde8b2a6c4748cb9749ce9e6a80c47ec117b083ef79734d23b99ddb971950f941c328b52877277ccb
7
- data.tar.gz: c19b394a110cd6beebe23715af218fbc932d5052498911ea51824a790c917a4d7fbd76ed92b3144d5d605e886a648b6d05c27b179dacc097fee5936446a1ce65
6
+ metadata.gz: 102139fc016e4eb974e0f9b8888355f64723cc78281c13c7c4688e4f3f8c563f8436fd042838593c7356108212b48b7d298cbd9c4b6a86331a92557120750577
7
+ data.tar.gz: 7cde64aa9e306826463966f1092c365dc7bc8e1d7447c04995408b25d21e1ddac27af2fa998d075afeb6d4c4f04bae83c88e99d89eec150455c862135ed74168
data/CHANGELOG.md CHANGED
@@ -11,11 +11,74 @@
11
11
 
12
12
  Changes since the last non-beta release.
13
13
 
14
+ _No unreleased changes._
15
+
16
+ ## [v9.1.0] - October 8, 2025
17
+
18
+ **⚠️ IMPORTANT:** This release includes a breaking change for SWC users. Please see the [v9 Upgrade Guide - SWC Loose Mode Breaking Change](./docs/v9_upgrade.md#swc-loose-mode-breaking-change-v910) for migration details.
19
+
20
+ ### ⚠️ Breaking Changes
21
+
22
+ - **SWC default configuration now uses `loose: false` for spec-compliant transforms** ([#658](https://github.com/shakacode/shakapacker/pull/658))
23
+ - Previously, Shakapacker set `loose: true` by default in SWC configuration, which caused:
24
+ - Silent failures with Stimulus controllers
25
+ - Incorrect behavior with spread operators on iterables (e.g., `[...new Set()]`)
26
+ - Deviation from both SWC and Babel upstream defaults
27
+ - Now defaults to `loose: false`, matching SWC's default and fixing compatibility with Stimulus
28
+ - This aligns with the previous fix to Babel configuration in [PR #107](https://github.com/shakacode/shakapacker/pull/107)
29
+ - **Migration:** Most projects need no changes as the new default provides spec-compliant behavior. Projects with Stimulus will benefit from this fix. See [v9 Upgrade Guide - SWC Loose Mode](./docs/v9_upgrade.md#swc-loose-mode-breaking-change-v910) for details
30
+ - If you must restore the old behavior (not recommended), add to `config/swc.config.js`:
31
+ ```javascript
32
+ module.exports = {
33
+ options: {
34
+ jsc: {
35
+ // Only use this if you have code that requires loose transforms.
36
+ // This provides slightly faster build performance but may cause runtime bugs.
37
+ loose: true // Restore v9.0.0 behavior
38
+ }
39
+ }
40
+ }
41
+ ```
42
+
43
+ ### Added
44
+
45
+ - **New `shakapacker:switch_bundler` rake task** for easy switching between webpack and rspack
46
+ - Automatically updates `config/shakapacker.yml` to switch bundler configuration
47
+ - Optional `--install-deps` flag to automatically manage dependencies
48
+ - `--no-uninstall` flag for faster switching by keeping both bundlers installed
49
+ - **Supports all package managers**: Auto-detects and uses npm, yarn, pnpm, or bun
50
+ - Shows clear list of packages being added/removed during dependency management
51
+ - Support for custom dependency configuration via `.shakapacker-switch-bundler-dependencies.yml`
52
+ - Includes SWC dependencies (`@swc/core`, `swc-loader`) in default webpack setup
53
+ - Preserves config file structure and comments during updates
54
+ - Updates `javascript_transpiler` to `swc` when switching to rspack (recommended)
55
+ - Ruby 2.7+ compatible YAML loading with proper alias/anchor support
56
+ - Secure command execution (prevents shell injection)
57
+ - Usage: `rails shakapacker:switch_bundler [webpack|rspack] [--install-deps] [--no-uninstall]`
58
+ - See rake task help: `rails shakapacker:switch_bundler --help`
59
+ - **Stimulus compatibility built into SWC migration** ([#658](https://github.com/shakacode/shakapacker/pull/658))
60
+ - `rake shakapacker:migrate_to_swc` now creates `config/swc.config.js` with `keepClassNames: true`
61
+ - Prevents SWC from mangling class names, which breaks Stimulus controller discovery
62
+ - Includes React Fast Refresh configuration by default
63
+ - **Comprehensive Stimulus documentation** for SWC users ([#658](https://github.com/shakacode/shakapacker/pull/658))
64
+ - Added "Using SWC with Stimulus" section to [docs/using_swc_loader.md](./docs/using_swc_loader.md#using-swc-with-stimulus)
65
+ - Documents symptoms of missing configuration (silent failures)
66
+ - Explains common errors like `env` and `jsc.target` conflicts
67
+ - Added Stimulus compatibility checklist to migration guide
68
+ - **Enhanced `rake shakapacker:doctor` for SWC configuration validation** ([#658](https://github.com/shakacode/shakapacker/pull/658))
69
+ - Detects `loose: true` in config and warns about potential issues
70
+ - Detects missing `keepClassNames: true` when Stimulus is installed
71
+ - Detects conflicting `jsc.target` and `env` configuration
72
+ - Provides actionable warnings with links to documentation
73
+
14
74
  ### Fixed
15
75
 
16
- - Fixed NODE_ENV defaulting to production breaking dev server ([Issue 631](https://github.com/shakacode/shakapacker/issues/631)). NODE_ENV now defaults to development unless RAILS_ENV is explicitly set to production. This ensures the dev server works out of the box without requiring NODE_ENV to be set, and fixes incorrect port and 404 asset errors.
76
+ - Fixed `rake shakapacker:migrate_to_swc` to correctly set `javascript_transpiler: "swc"` instead of unused `swc: true` flag ([#659](https://github.com/shakacode/shakapacker/pull/659))
77
+ - The migration now properly configures SWC as the transpiler
78
+ - Users who previously ran the migration should update their `config/shakapacker.yml` to use `javascript_transpiler: "swc"` instead of `swc: true`
79
+ - Restore `RspackPlugin` type as an alias to `RspackPluginInstance` for backward compatibility. The type is now deprecated in favor of `RspackPluginInstance`. [#650](https://github.com/shakacode/shakapacker/issues/650)
17
80
 
18
- ## [v9.0.0-beta.8] - October 3, 2025
81
+ ## [v9.0.0] - October 5, 2025
19
82
 
20
83
  See the [v9 Upgrade Guide](https://github.com/shakacode/shakapacker/blob/main/docs/v9_upgrade.md) for detailed migration instructions.
21
84
 
@@ -26,7 +89,7 @@ See the [v9 Upgrade Guide](https://github.com/shakacode/shakapacker/blob/main/do
26
89
  - Babel dependencies are no longer included as peer dependencies
27
90
  - Improves compilation speed by 20x
28
91
  - **Migration for existing projects:**
29
- - **Option 1 (Recommended):** Switch to SWC - Run `rake shakapacker:migrate:to_swc` or manually:
92
+ - **Option 1 (Recommended):** Switch to SWC - Run `rake shakapacker:migrate_to_swc` or manually:
30
93
  ```yaml
31
94
  # config/shakapacker.yml
32
95
  javascript_transpiler: "swc"
@@ -38,7 +101,7 @@ See the [v9 Upgrade Guide](https://github.com/shakacode/shakapacker/blob/main/do
38
101
  javascript_transpiler: "babel"
39
102
  ```
40
103
 
41
- 2. **CSS Modules now use named exports by default**
104
+ 2. **CSS Modules now use named exports by default** ([PR 599](https://github.com/shakacode/shakapacker/pull/599))
42
105
 
43
106
  - **JavaScript:** Use named imports: `import { className } from './styles.module.css'`
44
107
  - **TypeScript:** Use namespace imports: `import * as styles from './styles.module.css'`
@@ -50,19 +113,20 @@ See the [v9 Upgrade Guide](https://github.com/shakacode/shakapacker/blob/main/do
50
113
 
51
114
  ### Added
52
115
 
53
- - **Rspack support** as an alternative assets bundler to webpack
116
+ - **Rspack support** as an alternative assets bundler to webpack ([PR 589](https://github.com/shakacode/shakapacker/pull/589), [PR 590](https://github.com/shakacode/shakapacker/pull/590))
54
117
  - Configure `assets_bundler: 'rspack'` in `shakapacker.yml`
55
118
  - Faster Rust-based bundling with webpack-compatible APIs
56
119
  - Built-in SWC loader and CSS extraction
57
120
  - Automatic bundler detection in `bin/shakapacker`
58
- - **TypeScript type definitions** for improved IDE support and autocomplete
121
+ - **TypeScript type definitions** for improved IDE support and autocomplete ([PR 602](https://github.com/shakacode/shakapacker/pull/602))
59
122
  - Types available via `import type { WebpackConfig, RspackConfig, EnvironmentConfig } from "shakapacker/types"`
123
+ - Installer automatically creates TypeScript config files when `tsconfig.json` is detected ([PR 633](https://github.com/shakacode/shakapacker/pull/633))
60
124
  - See [TypeScript Documentation](./docs/typescript.md) for migration and usage instructions
61
- - **Optional peer dependencies** - All peer dependencies now marked as optional, preventing installation warnings while maintaining version compatibility tracking
125
+ - **Optional peer dependencies** - All peer dependencies now marked as optional, preventing installation warnings while maintaining version compatibility tracking ([PR 603](https://github.com/shakacode/shakapacker/pull/603))
62
126
  - **Private output path** for server-side rendering bundles ([PR 592](https://github.com/shakacode/shakapacker/pull/592))
63
127
  - Configure `private_output_path` for private server bundles separate from public assets
64
- - **`rake shakapacker:doctor` diagnostic command** to check for configuration issues and missing dependencies
65
- - **`rake shakapacker:migrate:to_swc`** migration helper to assist with switching from Babel to SWC
128
+ - **`rake shakapacker:doctor` diagnostic command** to check for configuration issues and missing dependencies ([PR 609](https://github.com/shakacode/shakapacker/pull/609))
129
+ - **`rake shakapacker:migrate_to_swc`** migration helper to assist with switching from Babel to SWC ([PR 613](https://github.com/shakacode/shakapacker/pull/613), [PR 635](https://github.com/shakacode/shakapacker/pull/635))
66
130
 
67
131
  ### Security
68
132
 
@@ -75,6 +139,8 @@ See the [v9 Upgrade Guide](https://github.com/shakacode/shakapacker/blob/main/do
75
139
 
76
140
  ### Fixed
77
141
 
142
+ - Fixed NODE_ENV defaulting to production breaking dev server ([PR 632](https://github.com/shakacode/shakapacker/pull/632)). NODE_ENV now defaults to development unless RAILS_ENV is explicitly set to production. This ensures the dev server works out of the box without requiring NODE_ENV to be set.
143
+ - Fixed SWC migration to use `config/swc.config.js` instead of `.swcrc` ([PR 635](https://github.com/shakacode/shakapacker/pull/635)). The `.swcrc` file bypasses webpack-merge and overrides Shakapacker's defaults, while `config/swc.config.js` properly merges with defaults.
78
144
  - Fixed private_output_path configuration edge cases ([PR 604](https://github.com/shakacode/shakapacker/pull/604))
79
145
  - Updated webpack-dev-server to secure versions (^4.15.2 || ^5.2.2) ([PR 585](https://github.com/shakacode/shakapacker/pull/585))
80
146
 
@@ -569,8 +635,8 @@ Note: [Rubygem is 6.3.0.pre.rc.1](https://rubygems.org/gems/shakapacker/versions
569
635
 
570
636
  See [CHANGELOG.md in rails/webpacker (up to v5.4.3)](https://github.com/rails/webpacker/blob/master/CHANGELOG.md)
571
637
 
572
- [Unreleased]: https://github.com/shakacode/shakapacker/compare/v9.0.0-beta.8...main
573
- [v9.0.0-beta.8]: https://github.com/shakacode/shakapacker/compare/v8.4.0...v9.0.0-beta.8
638
+ [Unreleased]: https://github.com/shakacode/shakapacker/compare/v9.0.0...main
639
+ [v9.0.0]: https://github.com/shakacode/shakapacker/compare/v8.4.0...v9.0.0
574
640
  [v8.4.0]: https://github.com/shakacode/shakapacker/compare/v8.3.0...v8.4.0
575
641
  [v8.3.0]: https://github.com/shakacode/shakapacker/compare/v8.2.0...v8.3.0
576
642
  [v8.2.0]: https://github.com/shakacode/shakapacker/compare/v8.1.0...v8.2.0
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- shakapacker (9.0.0)
4
+ shakapacker (9.1.0)
5
5
  activesupport (>= 5.2)
6
6
  package_json
7
7
  rack-proxy (>= 0.6.1)