shakapacker 9.3.0.beta.7 → 9.3.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/.claude/commands/update-changelog.md +224 -0
- data/.github/actionlint-matcher.json +17 -0
- data/.github/workflows/dummy.yml +9 -0
- data/.github/workflows/generator.yml +13 -0
- data/.github/workflows/node.yml +83 -0
- data/.github/workflows/ruby.yml +11 -0
- data/.github/workflows/test-bundlers.yml +10 -0
- data/CHANGELOG.md +55 -111
- data/CLAUDE.md +6 -10
- data/CONTRIBUTING.md +57 -0
- data/Gemfile.lock +1 -1
- data/README.md +84 -8
- data/docs/api-reference.md +519 -0
- data/docs/configuration.md +38 -4
- data/docs/css-modules-export-mode.md +40 -6
- data/docs/rspack_migration_guide.md +238 -2
- data/docs/transpiler-migration.md +12 -9
- data/docs/troubleshooting.md +21 -21
- data/docs/using_swc_loader.md +13 -10
- data/docs/v9_upgrade.md +11 -2
- data/eslint.config.fast.js +128 -8
- data/eslint.config.js +89 -33
- data/knip.ts +8 -1
- data/lib/install/config/shakapacker.yml +20 -7
- data/lib/shakapacker/configuration.rb +274 -8
- data/lib/shakapacker/dev_server.rb +88 -1
- data/lib/shakapacker/dev_server_runner.rb +4 -0
- data/lib/shakapacker/doctor.rb +5 -5
- data/lib/shakapacker/instance.rb +85 -1
- data/lib/shakapacker/manifest.rb +85 -11
- data/lib/shakapacker/version.rb +1 -1
- data/lib/shakapacker.rb +143 -3
- data/lib/tasks/shakapacker/doctor.rake +1 -1
- data/lib/tasks/shakapacker/export_bundler_config.rake +4 -4
- data/package/config.ts +2 -4
- data/package/configExporter/buildValidator.ts +53 -29
- data/package/configExporter/cli.ts +106 -76
- data/package/configExporter/configFile.ts +33 -26
- data/package/configExporter/types.ts +64 -0
- data/package/configExporter/yamlSerializer.ts +118 -43
- data/package/dev_server.ts +3 -2
- data/package/env.ts +2 -2
- data/package/environments/__type-tests__/rspack-plugin-compatibility.ts +6 -6
- data/package/environments/base.ts +6 -6
- data/package/environments/development.ts +7 -9
- data/package/environments/production.ts +7 -8
- data/package/environments/test.ts +4 -2
- data/package/esbuild/index.ts +0 -2
- data/package/index.d.ts +1 -0
- data/package/index.d.ts.template +1 -0
- data/package/index.ts +28 -5
- data/package/loaders.d.ts +2 -2
- data/package/optimization/webpack.ts +29 -31
- data/package/plugins/rspack.ts +3 -1
- data/package/plugins/webpack.ts +5 -3
- data/package/rspack/index.ts +5 -4
- data/package/rules/file.ts +2 -1
- data/package/rules/jscommon.ts +1 -0
- data/package/rules/raw.ts +3 -1
- data/package/rules/rspack.ts +0 -2
- data/package/rules/sass.ts +0 -2
- data/package/rules/webpack.ts +0 -1
- data/package/swc/index.ts +0 -2
- data/package/types.ts +8 -11
- data/package/utils/debug.ts +0 -4
- data/package/utils/getStyleRule.ts +17 -9
- data/package/utils/helpers.ts +8 -4
- data/package/utils/pathValidation.ts +78 -18
- data/package/utils/requireOrError.ts +14 -5
- data/package/utils/typeGuards.ts +43 -46
- data/package/webpack-types.d.ts +2 -2
- data/package/webpackDevServerConfig.ts +5 -4
- data/package.json +2 -3
- data/test/package/configExporter/cli.test.js +440 -0
- data/test/package/configExporter/types.test.js +163 -0
- data/test/package/configExporter.test.js +264 -0
- data/test/package/transpiler-defaults.test.js +42 -0
- data/test/package/yamlSerializer.test.js +204 -0
- data/test/typescript/pathValidation.test.js +44 -0
- data/test/typescript/requireOrError.test.js +49 -0
- data/yarn.lock +0 -32
- metadata +14 -5
- data/.eslintrc.fast.js +0 -40
- data/.eslintrc.js +0 -84
data/eslint.config.js
CHANGED
|
@@ -19,14 +19,18 @@ module.exports = [
|
|
|
19
19
|
"vendor/**", // Vendored dependencies
|
|
20
20
|
"spec/**", // Ruby specs, not JavaScript
|
|
21
21
|
"package/**/*.js", // Generated/compiled JavaScript from TypeScript
|
|
22
|
-
"package/**/*.d.ts"
|
|
23
|
-
// Temporarily ignore TypeScript files until technical debt is resolved
|
|
24
|
-
// See ESLINT_TECHNICAL_DEBT.md for tracking
|
|
25
|
-
// TODO: Remove this once ESLint issues are fixed (tracked in #723)
|
|
26
|
-
"package/**/*.ts"
|
|
22
|
+
"package/**/*.d.ts" // Generated TypeScript declaration files
|
|
27
23
|
]
|
|
28
24
|
},
|
|
29
25
|
|
|
26
|
+
// Global linter options
|
|
27
|
+
{
|
|
28
|
+
linterOptions: {
|
|
29
|
+
reportUnusedDisableDirectives: "error",
|
|
30
|
+
reportUnusedInlineConfigs: "error"
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
|
|
30
34
|
// Base config for all JS files
|
|
31
35
|
...compat.extends("airbnb"),
|
|
32
36
|
{
|
|
@@ -132,10 +136,10 @@ module.exports = [
|
|
|
132
136
|
// Disable base rule in favor of TypeScript version
|
|
133
137
|
"no-use-before-define": "off",
|
|
134
138
|
"@typescript-eslint/no-use-before-define": ["error"],
|
|
135
|
-
// Allow unused vars if they start with underscore (convention for ignored params)
|
|
139
|
+
// Allow unused vars if they start with underscore (convention for ignored params and type tests)
|
|
136
140
|
"@typescript-eslint/no-unused-vars": [
|
|
137
141
|
"error",
|
|
138
|
-
{ argsIgnorePattern: "^_" }
|
|
142
|
+
{ argsIgnorePattern: "^_", varsIgnorePattern: "^_" }
|
|
139
143
|
],
|
|
140
144
|
// Strict: no 'any' types allowed - use 'unknown' or specific types instead
|
|
141
145
|
"@typescript-eslint/no-explicit-any": "error",
|
|
@@ -147,72 +151,105 @@ module.exports = [
|
|
|
147
151
|
}
|
|
148
152
|
},
|
|
149
153
|
|
|
154
|
+
// Global rule for all TypeScript files in package/
|
|
155
|
+
// Suppress require() imports - these are intentional for CommonJS compatibility
|
|
156
|
+
// Will be addressed in Phase 3 (breaking changes) - see #708
|
|
157
|
+
{
|
|
158
|
+
files: ["package/**/*.ts"],
|
|
159
|
+
rules: {
|
|
160
|
+
"@typescript-eslint/no-require-imports": "off",
|
|
161
|
+
"global-require": "off",
|
|
162
|
+
"import/no-import-module-exports": "off"
|
|
163
|
+
}
|
|
164
|
+
},
|
|
165
|
+
|
|
150
166
|
// Temporary overrides for files with remaining errors
|
|
151
167
|
// See ESLINT_TECHNICAL_DEBT.md for detailed documentation
|
|
152
168
|
//
|
|
153
|
-
// These overrides suppress ~
|
|
169
|
+
// These overrides suppress ~94 type safety errors that require:
|
|
154
170
|
// 1. Major type refactoring (any/unsafe-* rules)
|
|
155
|
-
// 2.
|
|
156
|
-
// 3. Significant code restructuring
|
|
171
|
+
// 2. Proper type definitions for config objects
|
|
157
172
|
//
|
|
158
|
-
// GitHub
|
|
159
|
-
// - #
|
|
160
|
-
// - #708: Module System: Modernize to ES6 modules with codemod
|
|
161
|
-
// - #709: Code Style: Fix remaining ESLint style issues
|
|
173
|
+
// GitHub Issue tracking this technical debt:
|
|
174
|
+
// - #790: TypeScript ESLint Phase 2b: Type Safety Improvements (~94 errors)
|
|
162
175
|
{
|
|
163
176
|
// Consolidated override for package/config.ts and package/babel/preset.ts
|
|
164
177
|
// Combines rules from both previous override blocks to avoid duplication
|
|
165
178
|
files: ["package/babel/preset.ts", "package/config.ts"],
|
|
166
179
|
rules: {
|
|
167
|
-
// From first override block
|
|
168
|
-
"@typescript-eslint/no-require-imports": "off",
|
|
169
180
|
"@typescript-eslint/no-unused-vars": "off",
|
|
170
181
|
"@typescript-eslint/no-unsafe-call": "off",
|
|
171
182
|
"import/order": "off",
|
|
172
183
|
"import/newline-after-import": "off",
|
|
173
184
|
"import/first": "off",
|
|
174
|
-
// Additional rules that were in the second override for config.ts
|
|
175
185
|
"@typescript-eslint/no-unsafe-assignment": "off",
|
|
176
186
|
"@typescript-eslint/no-unsafe-member-access": "off",
|
|
177
187
|
"@typescript-eslint/no-unsafe-argument": "off",
|
|
178
188
|
"@typescript-eslint/no-explicit-any": "off",
|
|
179
|
-
"no-useless-escape": "off"
|
|
180
|
-
"no-continue": "off"
|
|
189
|
+
"no-useless-escape": "off"
|
|
181
190
|
}
|
|
182
191
|
},
|
|
183
192
|
{
|
|
193
|
+
// #707: Significant type safety improvements in configExporter module!
|
|
194
|
+
// - configFile.ts: ✅ Fully type-safe (0 type errors)
|
|
195
|
+
// - buildValidator.ts: ✅ Fully type-safe (0 type errors)
|
|
196
|
+
// - yamlSerializer.ts: ✅ Fully type-safe (0 type errors)
|
|
197
|
+
// - cli.ts: ⚠️ Partial (dynamic webpack config loading requires some `any`)
|
|
198
|
+
//
|
|
199
|
+
// Remaining overrides are for:
|
|
200
|
+
// 1. Code style/organization (not type safety)
|
|
201
|
+
// 2. Dynamic require() in cli.ts for webpack config loading
|
|
184
202
|
files: ["package/configExporter/**/*.ts"],
|
|
203
|
+
rules: {
|
|
204
|
+
// Code organization (functions before use due to large file)
|
|
205
|
+
"@typescript-eslint/no-use-before-define": "off",
|
|
206
|
+
// Import style (CommonJS require for dynamic imports)
|
|
207
|
+
"import/no-dynamic-require": "off",
|
|
208
|
+
// Class methods that are part of public API
|
|
209
|
+
"class-methods-use-this": "off",
|
|
210
|
+
// Template expressions (valid use cases with union types)
|
|
211
|
+
"@typescript-eslint/restrict-template-expressions": "off",
|
|
212
|
+
// Style preferences
|
|
213
|
+
"import/prefer-default-export": "off",
|
|
214
|
+
"no-underscore-dangle": "off",
|
|
215
|
+
"no-restricted-globals": "off",
|
|
216
|
+
"@typescript-eslint/no-unused-vars": "off",
|
|
217
|
+
"@typescript-eslint/require-await": "off"
|
|
218
|
+
}
|
|
219
|
+
},
|
|
220
|
+
{
|
|
221
|
+
// cli.ts: Dynamic webpack config loading requires `any` types
|
|
222
|
+
// This is acceptable as webpack configs can have any shape
|
|
223
|
+
files: ["package/configExporter/cli.ts"],
|
|
185
224
|
rules: {
|
|
186
225
|
"@typescript-eslint/no-explicit-any": "off",
|
|
187
226
|
"@typescript-eslint/no-unsafe-assignment": "off",
|
|
188
227
|
"@typescript-eslint/no-unsafe-member-access": "off",
|
|
189
228
|
"@typescript-eslint/no-unsafe-call": "off",
|
|
190
|
-
"@typescript-eslint/no-unsafe-return": "off"
|
|
191
|
-
"@typescript-eslint/no-unsafe-argument": "off",
|
|
192
|
-
"@typescript-eslint/no-unsafe-function-type": "off",
|
|
193
|
-
"@typescript-eslint/no-unused-vars": "off",
|
|
194
|
-
"@typescript-eslint/require-await": "off",
|
|
195
|
-
"no-await-in-loop": "off",
|
|
196
|
-
"import/prefer-default-export": "off",
|
|
197
|
-
"global-require": "off",
|
|
198
|
-
"no-underscore-dangle": "off"
|
|
229
|
+
"@typescript-eslint/no-unsafe-return": "off"
|
|
199
230
|
}
|
|
200
231
|
},
|
|
201
232
|
{
|
|
202
|
-
// Remaining utils files
|
|
233
|
+
// Remaining utils files that need type safety improvements
|
|
234
|
+
// These use dynamic requires and helper functions that return `any`
|
|
203
235
|
files: [
|
|
204
236
|
"package/utils/inliningCss.ts",
|
|
205
237
|
"package/utils/errorCodes.ts",
|
|
206
238
|
"package/utils/errorHelpers.ts",
|
|
207
|
-
"package/utils/pathValidation.ts"
|
|
239
|
+
"package/utils/pathValidation.ts",
|
|
240
|
+
"package/utils/getStyleRule.ts",
|
|
241
|
+
"package/utils/helpers.ts",
|
|
242
|
+
"package/utils/validateDependencies.ts",
|
|
243
|
+
"package/webpackDevServerConfig.ts"
|
|
208
244
|
],
|
|
209
245
|
rules: {
|
|
210
246
|
"@typescript-eslint/no-unsafe-assignment": "off",
|
|
211
247
|
"@typescript-eslint/no-unsafe-member-access": "off",
|
|
212
248
|
"@typescript-eslint/no-unsafe-argument": "off",
|
|
249
|
+
"@typescript-eslint/no-unsafe-call": "off",
|
|
250
|
+
"@typescript-eslint/no-unsafe-return": "off",
|
|
213
251
|
"@typescript-eslint/no-explicit-any": "off",
|
|
214
|
-
"no-useless-escape": "off"
|
|
215
|
-
"no-continue": "off"
|
|
252
|
+
"no-useless-escape": "off"
|
|
216
253
|
}
|
|
217
254
|
},
|
|
218
255
|
{
|
|
@@ -220,13 +257,13 @@ module.exports = [
|
|
|
220
257
|
rules: {
|
|
221
258
|
"@typescript-eslint/no-unsafe-assignment": "off",
|
|
222
259
|
"@typescript-eslint/no-unsafe-call": "off",
|
|
260
|
+
"@typescript-eslint/no-unsafe-member-access": "off",
|
|
223
261
|
"@typescript-eslint/no-redundant-type-constituents": "off",
|
|
224
262
|
"import/prefer-default-export": "off"
|
|
225
263
|
}
|
|
226
264
|
},
|
|
227
265
|
{
|
|
228
266
|
files: [
|
|
229
|
-
"package/environments/**/*.ts",
|
|
230
267
|
"package/index.ts",
|
|
231
268
|
"package/rspack/index.ts",
|
|
232
269
|
"package/rules/**/*.ts",
|
|
@@ -239,6 +276,8 @@ module.exports = [
|
|
|
239
276
|
"@typescript-eslint/no-unsafe-assignment": "off",
|
|
240
277
|
"@typescript-eslint/no-unsafe-call": "off",
|
|
241
278
|
"@typescript-eslint/no-unsafe-return": "off",
|
|
279
|
+
"@typescript-eslint/no-unsafe-member-access": "off",
|
|
280
|
+
"@typescript-eslint/no-unsafe-argument": "off",
|
|
242
281
|
"@typescript-eslint/no-redundant-type-constituents": "off",
|
|
243
282
|
"@typescript-eslint/no-unused-vars": "off",
|
|
244
283
|
"@typescript-eslint/no-unsafe-function-type": "off",
|
|
@@ -246,6 +285,23 @@ module.exports = [
|
|
|
246
285
|
"no-underscore-dangle": "off"
|
|
247
286
|
}
|
|
248
287
|
},
|
|
288
|
+
{
|
|
289
|
+
// package/environments/**/*.ts now passes no-unused-vars rule
|
|
290
|
+
// Type test functions use underscore prefix (argsIgnorePattern: "^_")
|
|
291
|
+
// All other variables are used in the code
|
|
292
|
+
files: ["package/environments/**/*.ts"],
|
|
293
|
+
rules: {
|
|
294
|
+
"@typescript-eslint/no-unsafe-assignment": "off",
|
|
295
|
+
"@typescript-eslint/no-unsafe-call": "off",
|
|
296
|
+
"@typescript-eslint/no-unsafe-return": "off",
|
|
297
|
+
"@typescript-eslint/no-unsafe-member-access": "off",
|
|
298
|
+
"@typescript-eslint/no-unsafe-argument": "off",
|
|
299
|
+
"@typescript-eslint/no-redundant-type-constituents": "off",
|
|
300
|
+
"@typescript-eslint/no-unsafe-function-type": "off",
|
|
301
|
+
"import/prefer-default-export": "off",
|
|
302
|
+
"no-underscore-dangle": "off"
|
|
303
|
+
}
|
|
304
|
+
},
|
|
249
305
|
|
|
250
306
|
// Prettier config must be last to override other configs
|
|
251
307
|
prettierConfig
|
data/knip.ts
CHANGED
|
@@ -47,7 +47,14 @@ const config: KnipConfig = {
|
|
|
47
47
|
"css-loader",
|
|
48
48
|
"esbuild-loader",
|
|
49
49
|
"swc-loader",
|
|
50
|
-
"webpack"
|
|
50
|
+
"webpack",
|
|
51
|
+
// eslint-config-airbnb isn't detected because it's used by compat.extends("airbnb"),
|
|
52
|
+
// the rest are its peerDependencies
|
|
53
|
+
"eslint-config-airbnb",
|
|
54
|
+
"eslint-plugin-import",
|
|
55
|
+
"eslint-plugin-jsx-a11y",
|
|
56
|
+
"eslint-plugin-react",
|
|
57
|
+
"eslint-plugin-react-hooks"
|
|
51
58
|
]
|
|
52
59
|
}
|
|
53
60
|
|
|
@@ -19,6 +19,18 @@ default: &default
|
|
|
19
19
|
# css_extract_ignore_order_warnings to true
|
|
20
20
|
css_extract_ignore_order_warnings: false
|
|
21
21
|
|
|
22
|
+
# CSS Modules export mode
|
|
23
|
+
# Controls how CSS Module class names are exported in JavaScript
|
|
24
|
+
# Defaults to 'named' if not specified. Uncomment and change to 'default' for v8 behavior.
|
|
25
|
+
# Options:
|
|
26
|
+
# - named (default): Use named exports with camelCase conversion (v9 default)
|
|
27
|
+
# Example: import { button } from './styles.module.css'
|
|
28
|
+
# - default: Use default export with both original and camelCase names (v8 behavior)
|
|
29
|
+
# Example: import styles from './styles.module.css'
|
|
30
|
+
# For gradual migration, you can set this to default to maintain v8 behavior
|
|
31
|
+
# See https://github.com/shakacode/shakapacker/blob/main/docs/css-modules-export-mode.md
|
|
32
|
+
# css_modules_export_mode: named
|
|
33
|
+
|
|
22
34
|
public_root_path: public
|
|
23
35
|
public_output_path: packs
|
|
24
36
|
cache_path: tmp/shakapacker
|
|
@@ -41,7 +53,8 @@ default: &default
|
|
|
41
53
|
cache_manifest: false
|
|
42
54
|
|
|
43
55
|
# Select JavaScript transpiler to use
|
|
44
|
-
# Available options: 'swc' (default, 20x faster), 'babel', or '
|
|
56
|
+
# Available options: 'swc' (default, 20x faster), 'babel', 'esbuild', or 'none'
|
|
57
|
+
# Use 'none' when providing a completely custom webpack configuration
|
|
45
58
|
# Note: When using rspack, swc is used automatically regardless of this setting
|
|
46
59
|
javascript_transpiler: "swc"
|
|
47
60
|
|
|
@@ -67,9 +80,8 @@ default: &default
|
|
|
67
80
|
compiler_strategy: digest
|
|
68
81
|
|
|
69
82
|
# Select whether the compiler will always use a content hash and not just in production
|
|
70
|
-
#
|
|
71
|
-
|
|
72
|
-
useContentHash: false
|
|
83
|
+
# Content hashes are recommended for production cache busting
|
|
84
|
+
useContentHash: true
|
|
73
85
|
|
|
74
86
|
# Setting the asset host here will override Rails.application.config.asset_host.
|
|
75
87
|
# Here, you can set different asset_host per environment. Note that
|
|
@@ -101,6 +113,10 @@ development:
|
|
|
101
113
|
compile: true
|
|
102
114
|
compiler_strategy: mtime
|
|
103
115
|
|
|
116
|
+
# Disable content hashes in development for faster builds
|
|
117
|
+
# https://webpack.js.org/guides/caching/
|
|
118
|
+
useContentHash: false
|
|
119
|
+
|
|
104
120
|
# Early hints disabled by default in development
|
|
105
121
|
# To enable: Set enabled: true AND start Puma with: bundle exec puma --early-hints
|
|
106
122
|
# See docs/early_hints_new_api.md for setup instructions
|
|
@@ -164,9 +180,6 @@ production:
|
|
|
164
180
|
# Production depends on precompilation of packs prior to booting for performance.
|
|
165
181
|
compile: false
|
|
166
182
|
|
|
167
|
-
# Use content hash for naming assets. Cannot be overridden in production.
|
|
168
|
-
useContentHash: true
|
|
169
|
-
|
|
170
183
|
# Cache manifest.json for performance
|
|
171
184
|
cache_manifest: true
|
|
172
185
|
|