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 +4 -4
- data/CHANGELOG.md +77 -11
- data/Gemfile.lock +1 -1
- data/README.md +161 -107
- data/docs/common-upgrades.md +615 -0
- data/docs/rspack_migration_guide.md +92 -17
- data/docs/transpiler-migration.md +21 -0
- data/docs/typescript-migration.md +2 -1
- data/docs/using_swc_loader.md +108 -8
- data/docs/v9_upgrade.md +45 -0
- data/lib/shakapacker/bundler_switcher.rb +322 -0
- data/lib/shakapacker/doctor.rb +49 -4
- data/lib/shakapacker/swc_migrator.rb +14 -6
- data/lib/shakapacker/version.rb +1 -1
- data/lib/tasks/shakapacker/switch_bundler.rake +82 -0
- data/lib/tasks/shakapacker.rake +2 -1
- data/package/environments/__type-tests__/rspack-plugin-compatibility.ts +30 -0
- data/package/environments/types.ts +22 -14
- data/package/index.ts +12 -9
- data/package/swc/index.ts +5 -3
- data/package/types/README.md +2 -1
- data/package/types/index.ts +1 -0
- data/package/utils/debug.ts +5 -5
- data/package-lock.json +13047 -0
- data/package.json +6 -1
- data/yarn.lock +196 -115
- metadata +7 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2f96f94846c3ee598308246c0098532ba6248fded2b0d3b3aba786e03f7fcfb9
|
4
|
+
data.tar.gz: 85d79f4ff3ad8a6e6383e5e30a0f834fa8400ea31588b839ca6dae13b8f77f9f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
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
|
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:
|
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:
|
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
|
573
|
-
[v9.0.0
|
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
|