shakapacker 9.0.0.beta.5 → 9.0.0.beta.7

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 (46) hide show
  1. checksums.yaml +4 -4
  2. data/.eslintignore +1 -0
  3. data/.github/workflows/claude-code-review.yml +1 -1
  4. data/.github/workflows/generator.yml +6 -0
  5. data/.github/workflows/test-bundlers.yml +9 -9
  6. data/.gitignore +0 -1
  7. data/.npmignore +55 -0
  8. data/CONTRIBUTING.md +64 -0
  9. data/Gemfile.lock +1 -1
  10. data/README.md +81 -0
  11. data/docs/optional-peer-dependencies.md +198 -0
  12. data/docs/transpiler-migration.md +191 -0
  13. data/docs/typescript-migration.md +378 -0
  14. data/docs/v9_upgrade.md +65 -1
  15. data/lib/install/template.rb +54 -7
  16. data/lib/shakapacker/doctor.rb +1 -2
  17. data/lib/shakapacker/version.rb +1 -1
  18. data/package/.npmignore +4 -0
  19. data/package/config.ts +23 -10
  20. data/package/env.ts +15 -2
  21. data/package/environments/base.ts +2 -1
  22. data/package/environments/{development.js → development.ts} +30 -8
  23. data/package/environments/{production.js → production.ts} +18 -4
  24. data/package/environments/test.ts +53 -0
  25. data/package/environments/types.ts +90 -0
  26. data/package/index.ts +2 -1
  27. data/package/loaders.d.ts +1 -0
  28. data/package/types/README.md +87 -0
  29. data/package/types/index.ts +60 -0
  30. data/package/utils/errorCodes.ts +219 -0
  31. data/package/utils/errorHelpers.ts +68 -2
  32. data/package/utils/pathValidation.ts +139 -0
  33. data/package/utils/typeGuards.ts +161 -47
  34. data/package/webpack-types.d.ts +1 -0
  35. data/package.json +111 -5
  36. data/scripts/remove-use-strict.js +45 -0
  37. data/test/package/transpiler-defaults.test.js +127 -0
  38. data/test/peer-dependencies.sh +85 -0
  39. data/test/scripts/remove-use-strict.test.js +125 -0
  40. data/test/typescript/build.test.js +3 -2
  41. data/test/typescript/environments.test.js +107 -0
  42. data/test/typescript/pathValidation.test.js +142 -0
  43. data/test/typescript/securityValidation.test.js +182 -0
  44. metadata +28 -6
  45. data/package/environments/base.js +0 -116
  46. data/package/environments/test.js +0 -19
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c4e7529c9a1e2dee69667d688581f6c684c775c18a17ac527a3328876d45c523
4
- data.tar.gz: 305d71e3efd30913c856066b7195ff259094bafb2cc2f7fa7f1730cdbfc49cdf
3
+ metadata.gz: ca5207ce21d40303f0a0250d140763ca93000a318ba28a9ac8efff358ce59310
4
+ data.tar.gz: f494c9a43b2c9fc704ca6dc1e3110f0c7048759a13e3f8254c44735e91a58da0
5
5
  SHA512:
6
- metadata.gz: cdba0281b3a0bc4e43d50ac4e84fa1a9b029ff6999afeabea56eada8ffded1c366e4b084734758566f009c1214ac36d7da874ea4887c70010551330f678bccbc
7
- data.tar.gz: 97a96fa177348c19929aae4fe53865f9f738f21c060e77863dfd79c3cc22869c4a6eb78af34d2139eb842baf61f59b3a9040b1e42cec3ed2fa216d1818124ca1
6
+ metadata.gz: a13fd3b73ffb91546e25c8226731efd4cdf6e8024893011795e32f379d2c3ffd14a4b5286b2a32499447405a01624b50805aafd6749112538e560ab21bc58e7e
7
+ data.tar.gz: d9911ec4c3a53a6baf3598e48b29e74684113a6514e979c73b69479905399e94abc67c0792a51c1cf12c5961a771c9de1f19e1800991f9a638dfab5ebcd1e606
data/.eslintignore CHANGED
@@ -2,3 +2,4 @@ lib/*
2
2
  node_modules/*
3
3
  vendor/*
4
4
  spec/*
5
+ package/*
@@ -50,5 +50,5 @@ jobs:
50
50
 
51
51
  # See https://github.com/anthropics/claude-code-action/blob/main/docs/usage.md
52
52
  # or https://docs.claude.com/en/docs/claude-code/sdk#command-line for available options
53
- claude_args: '--allowed-tools "Bash(gh issue view:*),Bash(gh search:*),Bash(gh issue list:*),Bash(gh pr comment:*),Bash(gh pr diff:*),Bash(gh pr view:*),Bash(gh pr list:*)"'
53
+ claude_args: '--model claude-sonnet-4-5-20250929 --allowed-tools "Bash(gh issue view:*),Bash(gh search:*),Bash(gh issue list:*),Bash(gh pr comment:*),Bash(gh pr diff:*),Bash(gh pr view:*),Bash(gh pr list:*)"'
54
54
 
@@ -64,4 +64,10 @@ jobs:
64
64
  - name: Build TypeScript
65
65
  run: yarn build
66
66
 
67
+ - name: Pack npm package for testing
68
+ run: |
69
+ TARBALL=$(npm pack)
70
+ echo "SHAKAPACKER_NPM_PACKAGE=$(pwd)/$TARBALL" >> $GITHUB_ENV
71
+ echo "Created package: $TARBALL"
72
+
67
73
  - run: bundle exec rake run_spec:generator
@@ -27,8 +27,8 @@ jobs:
27
27
  uses: actions/setup-node@v4
28
28
  with:
29
29
  node-version: '20'
30
- cache: 'npm'
31
- cache-dependency-path: spec/dummy/package-lock.json
30
+ cache: 'yarn'
31
+ cache-dependency-path: spec/dummy/yarn.lock
32
32
 
33
33
  - name: Install yalc
34
34
  run: npm install -g yalc
@@ -47,7 +47,7 @@ jobs:
47
47
  - name: Install dependencies
48
48
  run: |
49
49
  yalc link shakapacker
50
- npm ci
50
+ yarn install
51
51
 
52
52
  - name: Switch to Webpack
53
53
  run: bin/test-bundler webpack
@@ -80,8 +80,8 @@ jobs:
80
80
  uses: actions/setup-node@v4
81
81
  with:
82
82
  node-version: '20'
83
- cache: 'npm'
84
- cache-dependency-path: spec/dummy/package-lock.json
83
+ cache: 'yarn'
84
+ cache-dependency-path: spec/dummy/yarn.lock
85
85
 
86
86
  - name: Install yalc
87
87
  run: npm install -g yalc
@@ -100,7 +100,7 @@ jobs:
100
100
  - name: Install dependencies
101
101
  run: |
102
102
  yalc link shakapacker
103
- npm ci
103
+ yarn install
104
104
 
105
105
  - name: Switch to RSpack
106
106
  run: bin/test-bundler rspack
@@ -133,8 +133,8 @@ jobs:
133
133
  uses: actions/setup-node@v4
134
134
  with:
135
135
  node-version: '20'
136
- cache: 'npm'
137
- cache-dependency-path: spec/dummy/package-lock.json
136
+ cache: 'yarn'
137
+ cache-dependency-path: spec/dummy/yarn.lock
138
138
 
139
139
  - name: Install yalc
140
140
  run: npm install -g yalc
@@ -153,7 +153,7 @@ jobs:
153
153
  - name: Install dependencies
154
154
  run: |
155
155
  yalc link shakapacker
156
- npm ci
156
+ yarn install
157
157
 
158
158
  - name: Test switching between bundlers
159
159
  run: |
data/.gitignore CHANGED
@@ -27,7 +27,6 @@ package/**/*.js
27
27
  !package/webpack-types.d.ts
28
28
  !package/babel/preset.js
29
29
  !package/babel/preset-react.js
30
- !package/environments/*.js
31
30
  !package/rules/*.js
32
31
  !package/loaders/*.js
33
32
  !package/plugins/*.js
data/.npmignore ADDED
@@ -0,0 +1,55 @@
1
+ # .npmignore
2
+ # This file controls what gets published to npm
3
+ # It overrides .gitignore for npm publishing
4
+
5
+ # Exclude development and test files
6
+ /.bundle
7
+ /pkg
8
+ /spec
9
+ /test
10
+ /gemfiles
11
+ /.github
12
+ /.circleci
13
+ /.byebug_history
14
+ .DS_Store
15
+ yarn-debug.log*
16
+ yarn-error.log*
17
+ .yarn-integrity
18
+ .yalc
19
+ yalc.lock
20
+ .yalcignore
21
+
22
+ # Exclude Ruby files not needed for npm package
23
+ Gemfile
24
+ Gemfile.lock
25
+ Rakefile
26
+ *.gemspec
27
+ .rubocop.yml
28
+ .ruby-version
29
+
30
+ # Exclude TypeScript config
31
+ tsconfig.json
32
+
33
+ # Exclude source maps (optional - remove these lines to include source maps)
34
+ *.js.map
35
+ *.d.ts.map
36
+
37
+ # Exclude git and editor files
38
+ .git
39
+ .gitignore
40
+ .gitattributes
41
+ .editorconfig
42
+ .vscode
43
+ .idea
44
+
45
+ # Exclude CI/CD files
46
+ .travis.yml
47
+ appveyor.yml
48
+
49
+ # Exclude documentation source files (keep compiled docs if any)
50
+ docs/
51
+
52
+ # CRITICAL: Exclude TypeScript source files (must be at the end)
53
+ # Only include compiled .js and .d.ts files
54
+ *.ts
55
+ !*.d.ts
data/CONTRIBUTING.md CHANGED
@@ -50,6 +50,34 @@ We welcome pull requests that fix bugs, add new features, or improve existing on
50
50
  yarn install
51
51
  ```
52
52
 
53
+ ## Understanding Optional Peer Dependencies
54
+
55
+ Shakapacker uses optional peer dependencies (via `peerDependenciesMeta`) for maximum flexibility:
56
+
57
+ - **All peer dependencies are optional** - Users only install what they need
58
+ - **No installation warnings** - Package managers won't warn about missing optional dependencies
59
+ - **Version constraints still apply** - When a package is installed, version compatibility is enforced
60
+
61
+ ### When modifying dependencies:
62
+ 1. Add new peer dependencies to both `peerDependencies` and `peerDependenciesMeta` (marking as optional)
63
+ 2. Keep version ranges synchronized between `devDependencies` and `peerDependencies`
64
+ 3. Test with multiple package managers: `npm`, `yarn`, and `pnpm`
65
+
66
+ ### Testing peer dependency changes:
67
+ ```bash
68
+ # Test with npm (no warnings expected)
69
+ cd /tmp && mkdir test-npm && cd test-npm
70
+ npm init -y && npm install /path/to/shakapacker
71
+
72
+ # Test with yarn (no warnings expected)
73
+ cd /tmp && mkdir test-yarn && cd test-yarn
74
+ yarn init -y && yarn add /path/to/shakapacker
75
+
76
+ # Test with pnpm (no warnings expected)
77
+ cd /tmp && mkdir test-pnpm && cd test-pnpm
78
+ pnpm init && pnpm add /path/to/shakapacker
79
+ ```
80
+
53
81
  ## Making sure your changes pass all tests
54
82
 
55
83
  There are several specs, covering different aspects of Shakapacker gem. You may run them locally or rely on GitHub CI actions configured to test the gem functionality if different Ruby, Rails, and Node environment.
@@ -125,3 +153,39 @@ To ensure that your installer works as expected, either you can run `bundle exec
125
153
  3. Run `bundle exec rails shakapacker:install` to confirm that you got the right changes.
126
154
 
127
155
  **Note:** Ensure that you use bundle exec otherwise the installed shakapacker gem will run and not the one you are working on.
156
+
157
+ ## CI Workflows
158
+
159
+ Shakapacker uses GitHub Actions for continuous integration. The CI workflows use **Yarn** as the package manager for consistency and reliability.
160
+
161
+ ### Package Manager Choice
162
+
163
+ The project uses Yarn in CI workflows for the following reasons:
164
+ - Deterministic dependency resolution with `yarn.lock`
165
+ - Faster installation with offline mirror support
166
+ - Better workspace support for monorepo-style testing
167
+ - Consistent behavior across different Node.js versions
168
+
169
+ ### Key CI Workflow Files
170
+
171
+ - `.github/workflows/test-bundlers.yml` - Tests webpack, rspack, and bundler switching
172
+ - `.github/workflows/ruby.yml` - Ruby test suite across Ruby/Rails versions
173
+ - `.github/workflows/node.yml` - Node.js test suite across Node versions
174
+ - `.github/workflows/generator.yml` - Generator installation tests
175
+
176
+ All workflows use:
177
+ ```yaml
178
+ - uses: actions/setup-node@v4
179
+ with:
180
+ cache: 'yarn'
181
+ cache-dependency-path: spec/dummy/yarn.lock
182
+ ```
183
+
184
+ And install dependencies with:
185
+ ```bash
186
+ yarn install
187
+ ```
188
+
189
+ ### Testing with Other Package Managers
190
+
191
+ While CI uses Yarn, the gem supports all major package managers (npm, yarn, pnpm, bun). Generator specs test against all package managers to ensure compatibility.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- shakapacker (9.0.0.beta.5)
4
+ shakapacker (9.0.0.beta.7)
5
5
  activesupport (>= 5.2)
6
6
  package_json
7
7
  rack-proxy (>= 0.6.1)
data/README.md CHANGED
@@ -199,6 +199,83 @@ Note, in v6+, most JS packages are peer dependencies. Thus, the installer will a
199
199
  Previously, these "webpack" and "babel" packages were direct dependencies for `shakapacker`. By
200
200
  making these peer dependencies, you have control over the versions used in your webpack and babel configs.
201
201
 
202
+ ### Optional Peer Dependencies
203
+
204
+ All peer dependencies in Shakapacker are marked as optional via `peerDependenciesMeta`. This design decision ensures:
205
+ - **No warnings during package installation** when dependencies are not needed
206
+ - **Clear visibility of supported package versions** for upgrades
207
+ - **Flexibility to choose only the tools you need** (webpack vs rspack, babel vs swc vs esbuild)
208
+
209
+ The optional peer dependencies approach means you only install what you actually use, while still maintaining
210
+ version compatibility constraints when you do install those packages.
211
+
212
+ #### Required Dependencies by Configuration
213
+
214
+ Depending on your setup, you'll need different subsets of the optional peer dependencies:
215
+
216
+ **For Webpack + Babel (traditional setup):**
217
+ ```json
218
+ {
219
+ "dependencies": {
220
+ "shakapacker": "^9.0.0",
221
+ "@babel/core": "^7.17.9",
222
+ "@babel/plugin-transform-runtime": "^7.17.0",
223
+ "@babel/preset-env": "^7.16.11",
224
+ "@babel/runtime": "^7.17.9",
225
+ "babel-loader": "^8.2.4",
226
+ "compression-webpack-plugin": "^9.0.0",
227
+ "terser-webpack-plugin": "^5.3.1",
228
+ "webpack": "^5.76.0",
229
+ "webpack-assets-manifest": "^5.0.6",
230
+ "webpack-cli": "^5.0.0",
231
+ "webpack-dev-server": "^5.0.0"
232
+ }
233
+ }
234
+ ```
235
+
236
+ **For Webpack + SWC (faster alternative):**
237
+ ```json
238
+ {
239
+ "dependencies": {
240
+ "shakapacker": "^9.0.0",
241
+ "@swc/core": "^1.3.0",
242
+ "swc-loader": "^0.2.0",
243
+ "compression-webpack-plugin": "^9.0.0",
244
+ "terser-webpack-plugin": "^5.3.1",
245
+ "webpack": "^5.76.0",
246
+ "webpack-assets-manifest": "^5.0.6",
247
+ "webpack-cli": "^5.0.0",
248
+ "webpack-dev-server": "^5.0.0"
249
+ }
250
+ }
251
+ ```
252
+
253
+ **For Rspack + SWC (10x faster bundling):**
254
+ ```json
255
+ {
256
+ "dependencies": {
257
+ "shakapacker": "^9.0.0",
258
+ "@rspack/core": "^1.0.0",
259
+ "@rspack/cli": "^1.0.0",
260
+ "@swc/core": "^1.3.0",
261
+ "swc-loader": "^0.2.0",
262
+ "rspack-manifest-plugin": "^5.0.0"
263
+ }
264
+ }
265
+ ```
266
+
267
+ **For CSS/Sass processing (add to any config above):**
268
+ ```json
269
+ {
270
+ "dependencies": {
271
+ "css-loader": "^6.8.1",
272
+ "mini-css-extract-plugin": "^2.0.0",
273
+ "sass": "^1.50.0",
274
+ "sass-loader": "^13.0.0"
275
+ }
276
+ }
277
+ ```
278
+
202
279
  ## Concepts
203
280
 
204
281
  At its core, Shakapacker's essential function is to:
@@ -645,6 +722,10 @@ You can try out experimental integration with the esbuild-loader. You can read m
645
722
 
646
723
  Please note that if you want opt-in to use esbuild-loader, you can skip [React](#react) integration instructions as it is supported out of the box.
647
724
 
725
+ ### Switching between transpilers
726
+
727
+ To switch between Babel, SWC, or esbuild, or to configure environment-specific transpiler settings, see the [Transpiler Migration Guide](./docs/transpiler-migration.md).
728
+
648
729
  ### Integrations
649
730
 
650
731
  Shakapacker out of the box supports JS and static assets (fonts, images etc.) compilation. To enable support for CoffeeScript or TypeScript install relevant packages:
@@ -0,0 +1,198 @@
1
+ # Optional Peer Dependencies in Shakapacker
2
+
3
+ ## Overview
4
+
5
+ As of Shakapacker v9, all peer dependencies are marked as optional via `peerDependenciesMeta`. This design provides maximum flexibility while maintaining clear version constraints.
6
+
7
+ ## Key Benefits
8
+
9
+ 1. **No Installation Warnings** - Package managers (npm, yarn, pnpm) won't warn about missing peer dependencies
10
+ 2. **Install Only What You Need** - Users only install packages for their chosen configuration
11
+ 3. **Clear Version Constraints** - When packages are installed, version compatibility is still enforced
12
+ 4. **Smaller Node Modules** - Reduced disk usage by not installing unnecessary packages
13
+
14
+ ## Implementation Details
15
+
16
+ ### Package.json Structure
17
+
18
+ ```json
19
+ {
20
+ "dependencies": {
21
+ "js-yaml": "^4.1.0",
22
+ "path-complete-extname": "^1.0.0",
23
+ "webpack-merge": "^5.8.0" // Direct dependency - always available
24
+ },
25
+ "peerDependencies": {
26
+ "webpack": "^5.76.0",
27
+ "@rspack/core": "^1.0.0",
28
+ // ... all build tools
29
+ },
30
+ "peerDependenciesMeta": {
31
+ "webpack": { "optional": true },
32
+ "@rspack/core": { "optional": true },
33
+ // ... all marked as optional
34
+ }
35
+ }
36
+ ```
37
+
38
+ ### TypeScript Type-Only Imports
39
+
40
+ To prevent runtime errors when optional packages aren't installed, all webpack imports use type-only syntax:
41
+
42
+ ```typescript
43
+ // @ts-ignore: webpack is an optional peer dependency (using type-only import)
44
+ import type { Configuration } from "webpack"
45
+ ```
46
+
47
+ Type-only imports are erased during compilation and don't trigger module resolution at runtime.
48
+
49
+ ## Configuration Examples
50
+
51
+ ### Webpack + Babel (Traditional)
52
+ ```json
53
+ {
54
+ "dependencies": {
55
+ "shakapacker": "^9.0.0",
56
+ "webpack": "^5.76.0",
57
+ "webpack-cli": "^5.0.0",
58
+ "babel-loader": "^8.2.4",
59
+ "@babel/core": "^7.17.9",
60
+ "@babel/preset-env": "^7.16.11"
61
+ }
62
+ }
63
+ ```
64
+
65
+ ### Webpack + SWC (20x Faster)
66
+ ```json
67
+ {
68
+ "dependencies": {
69
+ "shakapacker": "^9.0.0",
70
+ "webpack": "^5.76.0",
71
+ "webpack-cli": "^5.0.0",
72
+ "@swc/core": "^1.3.0",
73
+ "swc-loader": "^0.2.0"
74
+ }
75
+ }
76
+ ```
77
+
78
+ ### Rspack + SWC (10x Faster Bundling)
79
+ ```json
80
+ {
81
+ "dependencies": {
82
+ "shakapacker": "^9.0.0",
83
+ "@rspack/core": "^1.0.0",
84
+ "@rspack/cli": "^1.0.0",
85
+ "rspack-manifest-plugin": "^5.0.0"
86
+ }
87
+ }
88
+ ```
89
+
90
+ ## Migration Guide
91
+
92
+ ### From v8 to v9
93
+
94
+ If upgrading from Shakapacker v8:
95
+
96
+ 1. **No action required** - Your existing dependencies will continue to work
97
+ 2. **No more warnings** - Peer dependency warnings will disappear after upgrading
98
+ 3. **Option to optimize** - You can now remove unused dependencies (e.g., remove Babel if using SWC)
99
+
100
+ ### New Installations
101
+
102
+ The installer (`rails shakapacker:install`) only adds packages needed for your configuration:
103
+ - Detects your preferred bundler (webpack/rspack)
104
+ - Installs appropriate JavaScript transpiler (babel/swc/esbuild)
105
+ - Adds only required dependencies
106
+
107
+ ## Version Constraints
108
+
109
+ Version ranges are carefully chosen for compatibility:
110
+
111
+ - **Broader ranges for peer deps** - Allows flexibility (e.g., `^5.76.0` for webpack)
112
+ - **Specific versions in devDeps** - Ensures testing against known versions
113
+ - **Forward compatibility** - Ranges include future minor versions (e.g., `^5.0.0 || ^6.0.0`)
114
+
115
+ ## Testing
116
+
117
+ ### Installation Tests
118
+
119
+ Test that no warnings appear during installation:
120
+
121
+ ```bash
122
+ # Test script available at test/peer-dependencies.sh
123
+ ./test/peer-dependencies.sh
124
+ ```
125
+
126
+ ### Runtime Tests
127
+
128
+ Verify Shakapacker loads without optional dependencies:
129
+
130
+ ```javascript
131
+ // This works even without webpack installed (when using rspack)
132
+ const shakapacker = require('shakapacker');
133
+ ```
134
+
135
+ ### CI Integration
136
+
137
+ The test suite includes:
138
+ - `spec/shakapacker/optional_dependencies_spec.rb` - Package.json structure validation
139
+ - `spec/shakapacker/doctor_optional_peer_spec.rb` - Doctor command validation
140
+ - `test/peer-dependencies.sh` - Installation warning tests
141
+
142
+ ## Troubleshooting
143
+
144
+ ### Still seeing peer dependency warnings?
145
+
146
+ 1. Ensure you're using Shakapacker v9.0.0 or later
147
+ 2. Clear your package manager cache:
148
+ - npm: `npm cache clean --force`
149
+ - yarn: `yarn cache clean`
150
+ - pnpm: `pnpm store prune`
151
+ 3. Reinstall dependencies
152
+
153
+ ### Module not found errors?
154
+
155
+ 1. Check you've installed required dependencies for your configuration
156
+ 2. Refer to the configuration examples above
157
+ 3. Run `rails shakapacker:doctor` for diagnostics
158
+
159
+ ### TypeScript errors?
160
+
161
+ The `@ts-ignore` comments are intentional and necessary for optional dependencies.
162
+ They prevent TypeScript errors when optional packages aren't installed.
163
+
164
+ ## Contributing
165
+
166
+ When adding new dependencies:
167
+
168
+ 1. Add to `peerDependencies` with appropriate version range
169
+ 2. Mark as optional in `peerDependenciesMeta`
170
+ 3. Use type-only imports in TypeScript: `import type { ... }`
171
+ 4. Test with all package managers (npm, yarn, pnpm)
172
+ 5. Update this documentation if needed
173
+
174
+ ## Design Rationale
175
+
176
+ This approach balances several concerns:
177
+
178
+ 1. **User Experience** - No confusing warnings during installation
179
+ 2. **Flexibility** - Support multiple configurations without forcing unnecessary installs
180
+ 3. **Compatibility** - Maintain version constraints for safety
181
+ 4. **Performance** - Reduce installation time and disk usage
182
+ 5. **Type Safety** - TypeScript support without runtime dependencies
183
+
184
+ ## Future Improvements
185
+
186
+ Potential enhancements for future versions:
187
+
188
+ 1. **Conditional exports** - Use package.json exports field for better tree-shaking
189
+ 2. **Dynamic imports** - Load bundler-specific code only when needed
190
+ 3. **Doctor updates** - Enhance doctor command to better understand optional dependencies
191
+ 4. **Automated testing** - Add CI jobs testing each configuration combination
192
+
193
+ ## References
194
+
195
+ - [npm: peerDependenciesMeta](https://docs.npmjs.com/cli/v8/configuring-npm/package-json#peerdependenciesmeta)
196
+ - [TypeScript: Type-Only Imports](https://www.typescriptlang.org/docs/handbook/modules.html#type-only-imports-and-exports)
197
+ - [Shakapacker Issue #565](https://github.com/shakacode/shakapacker/issues/565)
198
+ - [Pull Request #615](https://github.com/shakacode/shakapacker/pull/615)