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
data/package/swc/index.ts
CHANGED
@@ -9,9 +9,11 @@ import type { RuleSetRule } from "webpack"
|
|
9
9
|
const JSX_FILE_REGEX = /\.(jsx|tsx)(\.erb)?$/
|
10
10
|
const TYPESCRIPT_FILE_REGEX = /\.(ts|tsx)(\.erb)?$/
|
11
11
|
|
12
|
-
const isJsxFile = (filename: string): boolean =>
|
12
|
+
const isJsxFile = (filename: string): boolean =>
|
13
|
+
!!filename.match(JSX_FILE_REGEX)
|
13
14
|
|
14
|
-
const isTypescriptFile = (filename: string): boolean =>
|
15
|
+
const isTypescriptFile = (filename: string): boolean =>
|
16
|
+
!!filename.match(TYPESCRIPT_FILE_REGEX)
|
15
17
|
|
16
18
|
const getCustomConfig = (): Partial<RuleSetRule> => {
|
17
19
|
const path = resolve("config", "swc.config.js")
|
@@ -37,7 +39,7 @@ const getSwcLoaderConfig = (filenameToProcess: string): RuleSetRule => {
|
|
37
39
|
syntax: isTs ? "typescript" : "ecmascript",
|
38
40
|
[jsxKey]: isJsx
|
39
41
|
},
|
40
|
-
loose:
|
42
|
+
loose: false
|
41
43
|
},
|
42
44
|
sourceMaps: true,
|
43
45
|
env: {
|
data/package/types/README.md
CHANGED
@@ -41,7 +41,8 @@ import type {
|
|
41
41
|
### Webpack/Rspack Types
|
42
42
|
- `WebpackConfigWithDevServer` - Webpack config with dev server
|
43
43
|
- `RspackConfigWithDevServer` - Rspack config with dev server
|
44
|
-
- `
|
44
|
+
- `RspackPluginInstance` - Rspack plugin instance type
|
45
|
+
- `RspackPlugin` - **⚠️ Deprecated:** Use `RspackPluginInstance` instead
|
45
46
|
- `RspackDevServerConfig` - Rspack dev server configuration
|
46
47
|
- `CompressionPluginOptions` - Options for compression plugin
|
47
48
|
- `CompressionPluginConstructor` - Constructor type for compression plugin
|
data/package/types/index.ts
CHANGED
data/package/utils/debug.ts
CHANGED
@@ -16,24 +16,24 @@ const isDebugMode = (): boolean => {
|
|
16
16
|
)
|
17
17
|
}
|
18
18
|
|
19
|
-
const debug = (message: string, ...args:
|
19
|
+
const debug = (message: string, ...args: unknown[]): void => {
|
20
20
|
if (isDebugMode()) {
|
21
21
|
// eslint-disable-next-line no-console
|
22
22
|
console.log(`[Shakapacker] ${message}`, ...args)
|
23
23
|
}
|
24
24
|
}
|
25
25
|
|
26
|
-
const warn = (message: string, ...args:
|
26
|
+
const warn = (message: string, ...args: unknown[]): void => {
|
27
27
|
// eslint-disable-next-line no-console
|
28
28
|
console.warn(`[Shakapacker] WARNING: ${message}`, ...args)
|
29
29
|
}
|
30
30
|
|
31
|
-
const error = (message: string, ...args:
|
31
|
+
const error = (message: string, ...args: unknown[]): void => {
|
32
32
|
// eslint-disable-next-line no-console
|
33
33
|
console.error(`[Shakapacker] ERROR: ${message}`, ...args)
|
34
34
|
}
|
35
35
|
|
36
|
-
const info = (message: string, ...args:
|
36
|
+
const info = (message: string, ...args: unknown[]): void => {
|
37
37
|
if (isDebugMode()) {
|
38
38
|
// eslint-disable-next-line no-console
|
39
39
|
console.info(`[Shakapacker] INFO: ${message}`, ...args)
|
@@ -46,4 +46,4 @@ export = {
|
|
46
46
|
error,
|
47
47
|
info,
|
48
48
|
isDebugMode
|
49
|
-
}
|
49
|
+
}
|