shakapacker 9.2.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/.github/ISSUE_TEMPLATE/bug_report.md +6 -9
- data/.github/ISSUE_TEMPLATE/feature_request.md +6 -8
- data/.github/workflows/claude-code-review.yml +4 -5
- data/.github/workflows/claude.yml +1 -2
- data/.github/workflows/dummy.yml +4 -4
- data/.github/workflows/generator.yml +9 -9
- data/.github/workflows/node.yml +11 -2
- data/.github/workflows/ruby.yml +16 -16
- data/.github/workflows/test-bundlers.yml +9 -9
- data/.gitignore +4 -0
- data/CHANGELOG.md +74 -5
- data/CLAUDE.md +6 -1
- data/CONTRIBUTING.md +0 -1
- data/Gemfile.lock +1 -1
- data/README.md +14 -14
- data/TODO.md +10 -2
- data/TODO_v9.md +13 -3
- data/bin/export-bundler-config +1 -1
- data/conductor-setup.sh +1 -1
- data/conductor.json +1 -1
- data/docs/cdn_setup.md +13 -8
- data/docs/common-upgrades.md +2 -1
- data/docs/configuration.md +630 -0
- data/docs/css-modules-export-mode.md +120 -100
- data/docs/customizing_babel_config.md +16 -16
- data/docs/deployment.md +18 -0
- data/docs/developing_shakapacker.md +6 -0
- data/docs/optional-peer-dependencies.md +9 -4
- data/docs/peer-dependencies.md +17 -6
- data/docs/precompile_hook.md +342 -0
- data/docs/react.md +57 -47
- data/docs/releasing.md +0 -2
- data/docs/rspack.md +25 -21
- data/docs/rspack_migration_guide.md +335 -8
- data/docs/sprockets.md +1 -0
- data/docs/style_loader_vs_mini_css.md +12 -12
- data/docs/subresource_integrity.md +13 -7
- data/docs/transpiler-performance.md +40 -19
- data/docs/troubleshooting.md +141 -3
- data/docs/typescript-migration.md +48 -39
- data/docs/typescript.md +12 -8
- data/docs/using_esbuild_loader.md +10 -10
- data/docs/v6_upgrade.md +33 -20
- data/docs/v7_upgrade.md +8 -6
- data/docs/v8_upgrade.md +13 -12
- data/docs/v9_upgrade.md +2 -1
- data/eslint.config.fast.js +134 -0
- data/eslint.config.js +140 -0
- data/jest.config.js +8 -1
- data/knip.ts +54 -0
- data/lib/install/bin/export-bundler-config +1 -1
- data/lib/install/config/shakapacker.yml +16 -5
- data/lib/shakapacker/compiler.rb +80 -0
- data/lib/shakapacker/configuration.rb +33 -5
- data/lib/shakapacker/dev_server_runner.rb +140 -1
- data/lib/shakapacker/doctor.rb +294 -65
- data/lib/shakapacker/instance.rb +8 -3
- data/lib/shakapacker/runner.rb +244 -8
- data/lib/shakapacker/version.rb +1 -1
- data/lib/tasks/shakapacker/doctor.rake +42 -2
- data/package/babel/preset.ts +7 -4
- data/package/config.ts +42 -30
- data/package/configExporter/buildValidator.ts +883 -0
- data/package/configExporter/cli.ts +972 -210
- data/package/configExporter/configFile.ts +520 -0
- data/package/configExporter/fileWriter.ts +12 -8
- data/package/configExporter/index.ts +11 -1
- data/package/configExporter/types.ts +54 -2
- data/package/configExporter/yamlSerializer.ts +22 -8
- data/package/dev_server.ts +1 -1
- data/package/environments/__type-tests__/rspack-plugin-compatibility.ts +11 -5
- data/package/environments/base.ts +18 -13
- data/package/environments/development.ts +1 -1
- data/package/environments/production.ts +4 -1
- data/package/index.d.ts +50 -3
- data/package/index.d.ts.template +50 -0
- data/package/index.ts +7 -7
- data/package/loaders.d.ts +2 -2
- data/package/optimization/rspack.ts +1 -1
- data/package/plugins/rspack.ts +15 -4
- data/package/plugins/webpack.ts +7 -3
- data/package/rspack/index.ts +10 -2
- data/package/rules/raw.ts +3 -2
- data/package/rules/sass.ts +1 -1
- data/package/types/README.md +15 -13
- data/package/types/index.ts +5 -5
- data/package/types.ts +0 -1
- data/package/utils/defaultConfigPath.ts +4 -1
- data/package/utils/errorCodes.ts +129 -100
- data/package/utils/errorHelpers.ts +34 -29
- data/package/utils/getStyleRule.ts +5 -2
- data/package/utils/helpers.ts +21 -11
- data/package/utils/pathValidation.ts +43 -35
- data/package/utils/requireOrError.ts +1 -1
- data/package/utils/snakeToCamelCase.ts +1 -1
- data/package/utils/typeGuards.ts +132 -83
- data/package/utils/validateDependencies.ts +1 -1
- data/package/webpack-types.d.ts +3 -3
- data/package/webpackDevServerConfig.ts +22 -10
- data/package-lock.json +2 -2
- data/package.json +25 -16
- data/scripts/type-check-no-emit.js +1 -1
- data/test/configExporter/buildValidator.test.js +1292 -0
- data/test/configExporter/configFile.test.js +392 -0
- data/test/configExporter/integration.test.js +275 -0
- data/test/helpers.js +1 -1
- data/test/package/configExporter.test.js +154 -0
- data/test/package/environments/base.test.js +6 -3
- data/test/package/helpers.test.js +2 -2
- 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-version-parsing.test.js +71 -0
- data/test/package/rules/sass.test.js +11 -6
- data/test/package/rules/sass1.test.js +4 -5
- data/test/package/rules/sass16.test.js +24 -0
- data/test/package/rules/swc.test.js +48 -38
- data/tools/README.md +15 -5
- data/tsconfig.eslint.json +2 -9
- data/yarn.lock +1954 -1493
- metadata +22 -3
- data/.eslintignore +0 -5
data/tools/README.md
CHANGED
|
@@ -7,12 +7,14 @@ A jscodeshift codemod to help migrate CSS module imports from v8 to v9 format.
|
|
|
7
7
|
### What it does
|
|
8
8
|
|
|
9
9
|
#### For JavaScript files (.js, .jsx):
|
|
10
|
+
|
|
10
11
|
- Converts `import styles from './styles.module.css'` to `import { className1, className2 } from './styles.module.css'`
|
|
11
12
|
- Automatically detects which CSS classes are used in the file
|
|
12
13
|
- Handles kebab-case to camelCase conversion (e.g., `my-button` → `myButton`)
|
|
13
14
|
- Updates all class references from `styles.className` to `className`
|
|
14
15
|
|
|
15
16
|
#### For TypeScript files (.ts, .tsx):
|
|
17
|
+
|
|
16
18
|
- Converts `import styles from './styles.module.css'` to `import * as styles from './styles.module.css'`
|
|
17
19
|
- Preserves the same usage pattern (`styles.className`)
|
|
18
20
|
- Works around TypeScript's limitation with dynamic named exports
|
|
@@ -26,21 +28,25 @@ npm install -g jscodeshift
|
|
|
26
28
|
### Usage
|
|
27
29
|
|
|
28
30
|
#### Dry run (see what would change):
|
|
31
|
+
|
|
29
32
|
```bash
|
|
30
33
|
npx jscodeshift -t tools/css-modules-v9-codemod.js src/ --dry
|
|
31
34
|
```
|
|
32
35
|
|
|
33
36
|
#### Apply to JavaScript files:
|
|
37
|
+
|
|
34
38
|
```bash
|
|
35
39
|
npx jscodeshift -t tools/css-modules-v9-codemod.js src/
|
|
36
40
|
```
|
|
37
41
|
|
|
38
42
|
#### Apply to TypeScript files:
|
|
43
|
+
|
|
39
44
|
```bash
|
|
40
45
|
npx jscodeshift -t tools/css-modules-v9-codemod.js --parser tsx src/
|
|
41
46
|
```
|
|
42
47
|
|
|
43
48
|
#### Apply to specific file patterns:
|
|
49
|
+
|
|
44
50
|
```bash
|
|
45
51
|
# Only .jsx files
|
|
46
52
|
npx jscodeshift -t tools/css-modules-v9-codemod.js src/**/*.jsx
|
|
@@ -59,32 +65,35 @@ npx jscodeshift -t tools/css-modules-v9-codemod.js --parser tsx src/**/*.tsx
|
|
|
59
65
|
### Examples
|
|
60
66
|
|
|
61
67
|
#### Before (JavaScript):
|
|
68
|
+
|
|
62
69
|
```javascript
|
|
63
|
-
import styles from
|
|
70
|
+
import styles from "./Button.module.css"
|
|
64
71
|
|
|
65
72
|
function Button() {
|
|
66
73
|
return (
|
|
67
74
|
<button className={styles.button}>
|
|
68
|
-
<span className={styles[
|
|
75
|
+
<span className={styles["button-text"]}>Click me</span>
|
|
69
76
|
</button>
|
|
70
|
-
)
|
|
77
|
+
)
|
|
71
78
|
}
|
|
72
79
|
```
|
|
73
80
|
|
|
74
81
|
#### After (JavaScript):
|
|
82
|
+
|
|
75
83
|
```javascript
|
|
76
|
-
import { button, buttonText } from
|
|
84
|
+
import { button, buttonText } from "./Button.module.css"
|
|
77
85
|
|
|
78
86
|
function Button() {
|
|
79
87
|
return (
|
|
80
88
|
<button className={button}>
|
|
81
89
|
<span className={buttonText}>Click me</span>
|
|
82
90
|
</button>
|
|
83
|
-
)
|
|
91
|
+
)
|
|
84
92
|
}
|
|
85
93
|
```
|
|
86
94
|
|
|
87
95
|
#### Before (TypeScript):
|
|
96
|
+
|
|
88
97
|
```typescript
|
|
89
98
|
import styles from './Button.module.css';
|
|
90
99
|
|
|
@@ -94,6 +103,7 @@ const Button: React.FC = () => {
|
|
|
94
103
|
```
|
|
95
104
|
|
|
96
105
|
#### After (TypeScript):
|
|
106
|
+
|
|
97
107
|
```typescript
|
|
98
108
|
import * as styles from './Button.module.css';
|
|
99
109
|
|
data/tsconfig.eslint.json
CHANGED
|
@@ -4,13 +4,6 @@
|
|
|
4
4
|
"noEmit": true,
|
|
5
5
|
"rootDir": "."
|
|
6
6
|
},
|
|
7
|
-
"include": [
|
|
8
|
-
|
|
9
|
-
"package/**/*.tsx",
|
|
10
|
-
"package/**/*.test.ts",
|
|
11
|
-
"package/**/*.spec.ts",
|
|
12
|
-
"test/**/*.ts",
|
|
13
|
-
"test/**/*.tsx"
|
|
14
|
-
],
|
|
15
|
-
"exclude": ["node_modules"]
|
|
7
|
+
"include": ["**/*.ts", "**/*.tsx"],
|
|
8
|
+
"exclude": ["node_modules", "vendor"]
|
|
16
9
|
}
|