shakapacker 9.3.0.beta.0 → 9.3.0.beta.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +56 -2
- data/Gemfile.lock +1 -1
- data/docs/troubleshooting.md +141 -1
- data/jest.config.js +8 -1
- data/lib/shakapacker/version.rb +1 -1
- data/package/configExporter/buildValidator.ts +883 -0
- data/package/configExporter/cli.ts +183 -12
- data/package/configExporter/index.ts +3 -1
- data/package/configExporter/types.ts +18 -0
- data/package-lock.json +2 -2
- data/package.json +17 -16
- data/test/configExporter/buildValidator.test.js +1292 -0
- data/test/package/environments/base.test.js +6 -3
- data/test/package/rules/babel.test.js +61 -51
- data/test/package/rules/esbuild.test.js +12 -3
- data/test/package/rules/file.test.js +3 -1
- data/test/package/rules/sass.test.js +9 -2
- data/test/package/rules/sass1.test.js +3 -2
- data/test/package/rules/sass16.test.js +3 -2
- data/test/package/rules/swc.test.js +48 -38
- data/yarn.lock +62 -3
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c503694d35261163ce77ef2efb38c85b5365c7e0c817f06d0c3a9b7e9cd8ce0e
|
4
|
+
data.tar.gz: 6bea7b663bdb25fc2428bba429ec2f773a4298e91c2fdf2af9b8d0be5f089dd1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dca52dbb54ea99fd8ad7b3e5cc9de4f0c5446a5c7a2f855032355d5b224fc91e74055784e92733ac6b41548e9676b4ed76c1bf8f4e88d024d6984ddae79f49dd
|
7
|
+
data.tar.gz: 702f88a69f5116ab0bc2bbfbff2d650cc5d542dd71a4716e4083e1ef79785a0a1a3eeb734924f1753ecafbe633a9bc21d29d86c60911caa6fe6e14acc4531d95
|
data/CHANGELOG.md
CHANGED
@@ -11,9 +11,56 @@
|
|
11
11
|
|
12
12
|
Changes since the last non-beta release.
|
13
13
|
|
14
|
+
## [v9.3.0-beta.0] - October 13, 2025
|
15
|
+
|
16
|
+
### Added
|
17
|
+
|
18
|
+
- **New `precompile_hook` configuration option** to run custom commands during asset precompilation. [PR #678](https://github.com/shakacode/shakapacker/pull/678) by [justin808](https://github.com/justin808).
|
19
|
+
- Allows executing custom scripts or tasks during the precompile process
|
20
|
+
- Configure in `shakapacker.yml` with `precompile_hook: "command to run"`
|
21
|
+
- **New `assets_bundler_config_path` configuration option** for custom bundler config locations. [PR #710](https://github.com/shakacode/shakapacker/pull/710) by [justin808](https://github.com/justin808).
|
22
|
+
- Allows specifying a custom path for webpack/rspack configuration files
|
23
|
+
- Useful for complex project structures or shared configurations
|
24
|
+
- **YAML output format support for `bin/export-bundler-config`**. [PR #704](https://github.com/shakacode/shakapacker/pull/704) by [justin808](https://github.com/justin808).
|
25
|
+
- New `--format yaml` option exports bundler configuration as YAML
|
26
|
+
- Easier to read than JSON for debugging and documentation
|
27
|
+
- **Custom help messages for `bin/shakapacker` commands**. [PR #702](https://github.com/shakacode/shakapacker/pull/702) by [justin808](https://github.com/justin808).
|
28
|
+
- Improved help output for better command discoverability
|
29
|
+
- Clear usage examples and option descriptions
|
30
|
+
- **HMR client config export in doctor mode**. [PR #701](https://github.com/shakacode/shakapacker/pull/701) by [justin808](https://github.com/justin808).
|
31
|
+
- `bin/export-bundler-config --doctor` now includes HMR client configuration
|
32
|
+
- Helps debug Hot Module Replacement issues
|
33
|
+
- **Build timing logs** for webpack and rspack. [PR #706](https://github.com/shakacode/shakapacker/pull/706) by [justin808](https://github.com/justin808).
|
34
|
+
- Shows duration of build operations
|
35
|
+
- Helps identify performance bottlenecks
|
36
|
+
- Added Knip for detecting dead code to CI. [PR #675](https://github.com/shakacode/shakapacker/pull/675) by [justin808](https://github.com/justin808).
|
37
|
+
|
14
38
|
### Changed
|
15
39
|
|
16
|
-
-
|
40
|
+
- **Migrated to ESLint v9 with flat config format**. [PR #677](https://github.com/shakacode/shakapacker/pull/677) by [justin808](https://github.com/justin808).
|
41
|
+
- Updated all ESLint plugins to latest versions
|
42
|
+
- Uses new flat config format for better maintainability
|
43
|
+
- **Replaced custom argument parser with yargs**. [PR #692](https://github.com/shakacode/shakapacker/pull/692) by [justin808](https://github.com/justin808).
|
44
|
+
- More robust command-line argument parsing
|
45
|
+
- Better error messages and help output
|
46
|
+
- Replaced `require` with `import` in package/index.ts. [PR #674](https://github.com/shakacode/shakapacker/pull/674) by [justin808](https://github.com/justin808).
|
47
|
+
- Updated @rspack dependencies to 1.5.8. [PR #700](https://github.com/shakacode/shakapacker/pull/700) by [justin808](https://github.com/justin808).
|
48
|
+
|
49
|
+
### Improved
|
50
|
+
|
51
|
+
- **Enhanced rspack migration documentation** with real-world lessons. [PR #713](https://github.com/shakacode/shakapacker/pull/713) by [justin808](https://github.com/justin808).
|
52
|
+
- Added practical migration guidance based on actual project experiences
|
53
|
+
- Common pitfalls and solutions documented
|
54
|
+
- **Consolidated duplicate configuration documentation**. [PR #714](https://github.com/shakacode/shakapacker/pull/714) by [justin808](https://github.com/justin808).
|
55
|
+
- Removed redundant documentation
|
56
|
+
- Single source of truth for configuration options
|
57
|
+
- **Improved error messages** to suggest `assets_bundler_config_path`. [PR #712](https://github.com/shakacode/shakapacker/pull/712) by [justin808](https://github.com/justin808).
|
58
|
+
- More helpful error messages when bundler config is not found
|
59
|
+
- Suggests using `assets_bundler_config_path` for custom locations
|
60
|
+
- **Improved doctor command output** clarity and accuracy. [PR #682](https://github.com/shakacode/shakapacker/pull/682) by [justin808](https://github.com/justin808).
|
61
|
+
- Better formatting and organization of diagnostic information
|
62
|
+
- More actionable recommendations
|
63
|
+
- Formatted all markdown files with prettier. [PR #673](https://github.com/shakacode/shakapacker/pull/673) by [justin808](https://github.com/justin808).
|
17
64
|
|
18
65
|
### Fixed
|
19
66
|
|
@@ -26,6 +73,12 @@ Changes since the last non-beta release.
|
|
26
73
|
- Fixed TypeScript type definitions to export proper types instead of `any`. [PR #684](https://github.com/shakacode/shakapacker/pull/684) by [justin808](https://github.com/justin808).
|
27
74
|
- Previously `package/index.d.ts` was exporting all types as `any`, breaking IDE autocomplete
|
28
75
|
- Now properly exports typed interfaces for `WebpackConfig`, `RspackConfig`, etc.
|
76
|
+
- Fixed integrity config handling and sass-loader version check. [PR #688](https://github.com/shakacode/shakapacker/pull/688) by [justin808](https://github.com/justin808).
|
77
|
+
- Properly handles subresource integrity configuration
|
78
|
+
- Correctly detects sass-loader version for conditional logic
|
79
|
+
- Prevented index.d.ts confusion in build process. [PR #698](https://github.com/shakacode/shakapacker/pull/698) by [justin808](https://github.com/justin808).
|
80
|
+
- TypeScript declaration files no longer interfere with build output
|
81
|
+
- Fixed yarn.lock formatting changes in Conductor setup. [PR #683](https://github.com/shakacode/shakapacker/pull/683) by [justin808](https://github.com/justin808).
|
29
82
|
|
30
83
|
## [v9.2.0] - October 9, 2025
|
31
84
|
|
@@ -679,7 +732,8 @@ Note: [Rubygem is 6.3.0.pre.rc.1](https://rubygems.org/gems/shakapacker/versions
|
|
679
732
|
|
680
733
|
See [CHANGELOG.md in rails/webpacker (up to v5.4.3)](https://github.com/rails/webpacker/blob/master/CHANGELOG.md)
|
681
734
|
|
682
|
-
[Unreleased]: https://github.com/shakacode/shakapacker/compare/v9.0.0...main
|
735
|
+
[Unreleased]: https://github.com/shakacode/shakapacker/compare/v9.3.0-beta.0...main
|
736
|
+
[v9.3.0-beta.0]: https://github.com/shakacode/shakapacker/compare/v9.2.0...v9.3.0-beta.0
|
683
737
|
[v9.2.0]: https://github.com/shakacode/shakapacker/compare/v9.1.0...v9.2.0
|
684
738
|
[v9.1.0]: https://github.com/shakacode/shakapacker/compare/v9.0.0...v9.1.0
|
685
739
|
[v9.0.0]: https://github.com/shakacode/shakapacker/compare/v8.4.0...v9.0.0
|
data/Gemfile.lock
CHANGED
data/docs/troubleshooting.md
CHANGED
@@ -71,7 +71,147 @@
|
|
71
71
|
|
72
72
|
See `bin/export-bundler-config --help` for all available options.
|
73
73
|
|
74
|
-
6.
|
74
|
+
6. **Validate your webpack/rspack builds**: Use `bin/export-bundler-config --validate` to test that all your build configurations compile successfully. This is especially useful for:
|
75
|
+
- **CI/CD pipelines**: Catch configuration errors before deployment
|
76
|
+
- **Migration testing**: Verify builds work after upgrading webpack, rspack, or Shakapacker
|
77
|
+
- **Multi-environment testing**: Ensure all build configurations (dev, prod, HMR) compile correctly
|
78
|
+
|
79
|
+
**Quick validation:**
|
80
|
+
|
81
|
+
```bash
|
82
|
+
# Validate all builds defined in .bundler-config.yml
|
83
|
+
bin/export-bundler-config --validate
|
84
|
+
|
85
|
+
# Validate with full output logs (shows all webpack/rspack compilation output)
|
86
|
+
bin/export-bundler-config --validate --verbose
|
87
|
+
|
88
|
+
# Validate a specific build
|
89
|
+
bin/export-bundler-config --validate-build=dev-hmr
|
90
|
+
```
|
91
|
+
|
92
|
+
**Verbose Mode:**
|
93
|
+
|
94
|
+
When using `--verbose`, you'll see:
|
95
|
+
- A clear header indicating verbose mode is enabled
|
96
|
+
- Full real-time compilation output from webpack/rspack
|
97
|
+
- All warnings and progress messages
|
98
|
+
- Detailed error traces
|
99
|
+
- Separators between builds for clarity
|
100
|
+
|
101
|
+
This is useful for debugging compilation issues or understanding build performance.
|
102
|
+
|
103
|
+
**Setting up build configurations:**
|
104
|
+
|
105
|
+
```bash
|
106
|
+
# Create a .bundler-config.yml file with example builds
|
107
|
+
bin/export-bundler-config --init
|
108
|
+
|
109
|
+
# List all available builds
|
110
|
+
bin/export-bundler-config --list-builds
|
111
|
+
|
112
|
+
# Validate all builds
|
113
|
+
bin/export-bundler-config --validate
|
114
|
+
```
|
115
|
+
|
116
|
+
**Advanced options:**
|
117
|
+
|
118
|
+
The validator uses a default timeout of 2 minutes per build. For large projects or slow CI environments, you can customize this behavior by modifying the `ValidatorOptions` in your code, or by adjusting your build configuration to be more efficient.
|
119
|
+
|
120
|
+
If validation times out, try:
|
121
|
+
- Using `--verbose` to see where the build is hanging
|
122
|
+
- Optimizing your webpack/rspack configuration for faster builds
|
123
|
+
- Running validation on a single build with `--validate-build=build-name`
|
124
|
+
|
125
|
+
**How it works:**
|
126
|
+
|
127
|
+
The validator will:
|
128
|
+
- For HMR builds (with `WEBPACK_SERVE=true`): Start webpack-dev-server, wait for successful compilation, then shut down
|
129
|
+
- For static builds: Run webpack/rspack and check for compilation errors
|
130
|
+
- Report all errors and warnings with clear output
|
131
|
+
- Exit with code 1 if any build fails (perfect for CI)
|
132
|
+
|
133
|
+
**Example output:**
|
134
|
+
|
135
|
+
```text
|
136
|
+
🔍 Validating Builds
|
137
|
+
================================================================================
|
138
|
+
|
139
|
+
📦 Validating build: dev-hmr
|
140
|
+
✅ Build passed
|
141
|
+
|
142
|
+
📦 Validating build: dev
|
143
|
+
✅ Build passed
|
144
|
+
|
145
|
+
📦 Validating build: prod
|
146
|
+
❌ Build failed with 2 error(s)
|
147
|
+
|
148
|
+
================================================================================
|
149
|
+
🔍 Build Validation Results
|
150
|
+
================================================================================
|
151
|
+
|
152
|
+
✅ Build: dev-hmr (2.34s)
|
153
|
+
📦 Outputs: client
|
154
|
+
⚙️ Config: config/webpack/webpack.config.js
|
155
|
+
|
156
|
+
✅ Build: dev (3.12s)
|
157
|
+
📦 Outputs: client, server
|
158
|
+
⚙️ Config: config/webpack/webpack.config.js
|
159
|
+
📁 Output: /app/public/packs
|
160
|
+
|
161
|
+
❌ Build: prod (4.56s)
|
162
|
+
📦 Outputs: client, server
|
163
|
+
⚙️ Config: config/webpack/webpack.config.js
|
164
|
+
📁 Output: /app/public/packs
|
165
|
+
❌ 2 error(s)
|
166
|
+
Module not found: Error: Can't resolve './missing'
|
167
|
+
SyntaxError: Unexpected token
|
168
|
+
|
169
|
+
================================================================================
|
170
|
+
Summary: 2/3 builds passed, 1 failed (Total: 10.02s)
|
171
|
+
================================================================================
|
172
|
+
|
173
|
+
💡 Debugging Tips:
|
174
|
+
To get more details, run individual builds with --verbose:
|
175
|
+
|
176
|
+
bin/export-bundler-config --validate-build prod --verbose
|
177
|
+
|
178
|
+
Or validate all builds with full output: bin/export-bundler-config --validate --verbose
|
179
|
+
================================================================================
|
180
|
+
```
|
181
|
+
|
182
|
+
**Debugging Failed Builds:**
|
183
|
+
|
184
|
+
When builds fail, the validator automatically provides debugging commands. You can:
|
185
|
+
1. **Run a specific build with verbose output** to see full webpack/rspack logs:
|
186
|
+
|
187
|
+
```bash
|
188
|
+
bin/export-bundler-config --validate-build prod --verbose
|
189
|
+
```
|
190
|
+
|
191
|
+
2. **Validate all builds with verbose output** to see everything:
|
192
|
+
|
193
|
+
```bash
|
194
|
+
bin/export-bundler-config --validate --verbose
|
195
|
+
```
|
196
|
+
|
197
|
+
3. **Test individual builds manually** using the same configuration:
|
198
|
+
|
199
|
+
```bash
|
200
|
+
# For static builds
|
201
|
+
NODE_ENV=production RAILS_ENV=production bundle exec webpack --config config/webpack/webpack.config.js
|
202
|
+
|
203
|
+
# For HMR/dev-server builds
|
204
|
+
NODE_ENV=development WEBPACK_SERVE=true bundle exec webpack serve --config config/webpack/webpack.config.js
|
205
|
+
```
|
206
|
+
|
207
|
+
The verbose mode shows:
|
208
|
+
- Full real-time compilation output
|
209
|
+
- All webpack/rspack warnings and progress messages
|
210
|
+
- Detailed stack traces for errors
|
211
|
+
- Timing information for each build phase
|
212
|
+
- Clear separators between different builds
|
213
|
+
|
214
|
+
7. Generate webpack stats for build analysis (useful for bundle size optimization):
|
75
215
|
|
76
216
|
```bash
|
77
217
|
NODE_ENV=development bin/shakapacker --profile --json > /tmp/webpack-stats.json
|
data/jest.config.js
CHANGED
@@ -1,5 +1,12 @@
|
|
1
1
|
module.exports = {
|
2
2
|
roots: ["<rootDir>/test"],
|
3
3
|
testPathIgnorePatterns: ["/__fixtures__/", "/__utils__/"],
|
4
|
-
resolver: "<rootDir>/test/resolver"
|
4
|
+
resolver: "<rootDir>/test/resolver",
|
5
|
+
preset: "ts-jest",
|
6
|
+
testEnvironment: "node",
|
7
|
+
moduleFileExtensions: ["ts", "tsx", "js", "jsx", "json", "node"],
|
8
|
+
transform: {
|
9
|
+
"^.+\\.tsx?$": "ts-jest"
|
10
|
+
},
|
11
|
+
transformIgnorePatterns: ["node_modules/(?!(.*\\.mjs$))"]
|
5
12
|
}
|
data/lib/shakapacker/version.rb
CHANGED