shakapacker 9.1.0 → 9.3.0.beta.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/.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 +7 -0
- data/CHANGELOG.md +50 -4
- data/CLAUDE.md +6 -1
- data/CONTRIBUTING.md +0 -1
- data/Gemfile.lock +1 -1
- data/README.md +35 -14
- data/TODO.md +10 -2
- data/TODO_v9.md +13 -3
- data/bin/export-bundler-config +11 -0
- 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 +68 -6
- 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 +195 -0
- data/docs/rspack.md +25 -21
- data/docs/rspack_migration_guide.md +363 -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 +122 -23
- 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/knip.ts +54 -0
- data/lib/install/bin/export-bundler-config +11 -0
- data/lib/install/bin/shakapacker +1 -1
- data/lib/install/bin/shakapacker-dev-server +1 -1
- data/lib/install/config/shakapacker.yml +16 -5
- data/lib/shakapacker/bundler_switcher.rb +7 -0
- data/lib/shakapacker/compiler.rb +80 -0
- data/lib/shakapacker/configuration.rb +56 -2
- data/lib/shakapacker/dev_server_runner.rb +140 -1
- data/lib/shakapacker/doctor.rb +302 -57
- data/lib/shakapacker/instance.rb +8 -3
- data/lib/shakapacker/rspack_runner.rb +1 -1
- data/lib/shakapacker/runner.rb +245 -9
- data/lib/shakapacker/version.rb +1 -1
- data/lib/shakapacker/webpack_runner.rb +1 -1
- data/lib/shakapacker.rb +10 -0
- data/lib/tasks/shakapacker/doctor.rake +42 -2
- data/lib/tasks/shakapacker/export_bundler_config.rake +72 -0
- data/package/babel/preset.ts +7 -4
- data/package/config.ts +42 -30
- data/package/configExporter/cli.ts +1274 -0
- data/package/configExporter/configDocs.ts +102 -0
- data/package/configExporter/configFile.ts +520 -0
- data/package/configExporter/fileWriter.ts +96 -0
- data/package/configExporter/index.ts +13 -0
- data/package/configExporter/types.ts +70 -0
- data/package/configExporter/yamlSerializer.ts +280 -0
- 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 +37 -28
- data/scripts/type-check-no-emit.js +1 -1
- 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/helpers.test.js +2 -2
- data/test/package/rules/sass-version-parsing.test.js +71 -0
- data/test/package/rules/sass.test.js +2 -4
- data/test/package/rules/sass1.test.js +1 -3
- data/test/package/rules/sass16.test.js +23 -0
- data/tools/README.md +15 -5
- data/tsconfig.eslint.json +2 -9
- data/yarn.lock +1635 -1442
- metadata +29 -3
- data/.eslintignore +0 -5
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 673dbe7651111125cf2c4c408e128be24f73475825910473ced26eba32929f6e
|
|
4
|
+
data.tar.gz: 83af8568e4d40e9859483ee4d71d7164facb0c5c2131880912e0aa42143aa427
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 302f3c9f98e999524573103dbaf5ecdfc048f5c780a293ddcf1bfb0409a3779e83b0176070a2c7563f74be56a3c118e23812ba8065c048d1eb9fb9765d00a272
|
|
7
|
+
data.tar.gz: ff0f655f57a37baee93a04147b9e2d0e50fd0f2607c2413bac46a420275a0e40c302d41a1a3d4d38e35a0e1d70b525c60ecbc0a742c634c22b202b36d3422fd5
|
|
@@ -1,24 +1,21 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: Bug report
|
|
3
3
|
about: Create a report for a crash or unexpected behavior.
|
|
4
|
-
title:
|
|
4
|
+
title: ""
|
|
5
5
|
labels: bug
|
|
6
|
-
assignees:
|
|
7
|
-
|
|
6
|
+
assignees: ""
|
|
8
7
|
---
|
|
9
8
|
|
|
10
9
|
_Notice: A bug is a crash or incorrect behavior. If you have a debugging or troubleshooting question, please open a discussion on the [Discussions Tab](https://github.com/shakacode/shakapacker/discussions). Otherwise, remove this line and fill out the following sections._
|
|
11
10
|
|
|
12
11
|
## Expected behavior:
|
|
13
12
|
|
|
14
|
-
|
|
15
13
|
## Actual behavior:
|
|
16
14
|
|
|
17
|
-
|
|
18
15
|
## Small, reproducible repo:
|
|
19
16
|
|
|
20
|
-
|
|
21
17
|
## Setup environment:
|
|
22
|
-
|
|
23
|
-
-
|
|
24
|
-
-
|
|
18
|
+
|
|
19
|
+
- Ruby version:
|
|
20
|
+
- Rails version:
|
|
21
|
+
- Shakapacker version:
|
|
@@ -1,21 +1,19 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: Feature request
|
|
3
3
|
about: Create a request for new functionality
|
|
4
|
-
title:
|
|
4
|
+
title: ""
|
|
5
5
|
labels: enhancement
|
|
6
|
-
assignees:
|
|
7
|
-
|
|
6
|
+
assignees: ""
|
|
8
7
|
---
|
|
9
8
|
|
|
10
9
|
_Notice: A feature request describes a suggested improvement. If you have a debugging or troubleshooting question, please open a discussion on the [Discussions Tab](https://github.com/shakacode/shakapacker/discussions). Otherwise, remove this line and fill out the following sections._
|
|
11
10
|
|
|
12
11
|
## Desired behavior:
|
|
13
12
|
|
|
14
|
-
|
|
15
13
|
## Actual behavior:
|
|
16
14
|
|
|
17
|
-
|
|
18
15
|
## Setup environment:
|
|
19
|
-
|
|
20
|
-
-
|
|
21
|
-
-
|
|
16
|
+
|
|
17
|
+
- Ruby version:
|
|
18
|
+
- Rails version:
|
|
19
|
+
- Shakapacker version:
|
|
@@ -17,14 +17,14 @@ jobs:
|
|
|
17
17
|
# github.event.pull_request.user.login == 'external-contributor' ||
|
|
18
18
|
# github.event.pull_request.user.login == 'new-developer' ||
|
|
19
19
|
# github.event.pull_request.author_association == 'FIRST_TIME_CONTRIBUTOR'
|
|
20
|
-
|
|
20
|
+
|
|
21
21
|
runs-on: ubuntu-latest
|
|
22
22
|
permissions:
|
|
23
23
|
contents: read
|
|
24
24
|
pull-requests: read
|
|
25
25
|
issues: read
|
|
26
26
|
id-token: write
|
|
27
|
-
|
|
27
|
+
|
|
28
28
|
steps:
|
|
29
29
|
- name: Checkout repository
|
|
30
30
|
uses: actions/checkout@v4
|
|
@@ -43,12 +43,11 @@ jobs:
|
|
|
43
43
|
- Performance considerations
|
|
44
44
|
- Security concerns
|
|
45
45
|
- Test coverage
|
|
46
|
-
|
|
46
|
+
|
|
47
47
|
Use the repository's CLAUDE.md for guidance on style and conventions. Be constructive and helpful in your feedback.
|
|
48
48
|
|
|
49
49
|
Use `gh pr comment` with your Bash tool to leave your review as a comment on the PR.
|
|
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
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
|
-
|
|
@@ -35,7 +35,7 @@ jobs:
|
|
|
35
35
|
uses: anthropics/claude-code-action@v1
|
|
36
36
|
with:
|
|
37
37
|
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
|
|
38
|
-
|
|
38
|
+
|
|
39
39
|
# This is an optional setting that allows Claude to read CI results on PRs
|
|
40
40
|
additional_permissions: |
|
|
41
41
|
actions: read
|
|
@@ -47,4 +47,3 @@ jobs:
|
|
|
47
47
|
# See https://github.com/anthropics/claude-code-action/blob/main/docs/usage.md
|
|
48
48
|
# or https://docs.claude.com/en/docs/claude-code/sdk#command-line for available options
|
|
49
49
|
# claude_args: '--model claude-opus-4-1-20250805 --allowed-tools Bash(gh pr:*)'
|
|
50
|
-
|
data/.github/workflows/dummy.yml
CHANGED
|
@@ -3,7 +3,7 @@ name: Dummy specs
|
|
|
3
3
|
on:
|
|
4
4
|
push:
|
|
5
5
|
branches:
|
|
6
|
-
-
|
|
6
|
+
- "main"
|
|
7
7
|
pull_request:
|
|
8
8
|
|
|
9
9
|
concurrency:
|
|
@@ -21,10 +21,10 @@ jobs:
|
|
|
21
21
|
persist-credentials: false
|
|
22
22
|
- uses: actions/setup-node@v4
|
|
23
23
|
with:
|
|
24
|
-
node-version:
|
|
24
|
+
node-version: "20"
|
|
25
25
|
- uses: ruby/setup-ruby@v1
|
|
26
26
|
with:
|
|
27
|
-
ruby-version:
|
|
27
|
+
ruby-version: "3.2"
|
|
28
28
|
rubygems: latest
|
|
29
29
|
- name: Install dependencies
|
|
30
30
|
run: |
|
|
@@ -32,7 +32,7 @@ jobs:
|
|
|
32
32
|
yarn install --frozen-lockfile --production=false
|
|
33
33
|
npm install -g yalc
|
|
34
34
|
cd spec/dummy && npm install
|
|
35
|
-
|
|
35
|
+
|
|
36
36
|
- name: Build TypeScript
|
|
37
37
|
run: yarn build
|
|
38
38
|
|
|
@@ -3,7 +3,7 @@ name: Generator specs
|
|
|
3
3
|
on:
|
|
4
4
|
push:
|
|
5
5
|
branches:
|
|
6
|
-
-
|
|
6
|
+
- "main"
|
|
7
7
|
pull_request:
|
|
8
8
|
|
|
9
9
|
concurrency:
|
|
@@ -18,7 +18,7 @@ jobs:
|
|
|
18
18
|
strategy:
|
|
19
19
|
matrix:
|
|
20
20
|
os: [ubuntu-latest]
|
|
21
|
-
ruby: [
|
|
21
|
+
ruby: ["2.7", "3.0", "3.1", "3.2", "3.3", "3.4"]
|
|
22
22
|
gemfile:
|
|
23
23
|
- gemfiles/Gemfile-rails.7.0.x
|
|
24
24
|
- gemfiles/Gemfile-rails.7.1.x
|
|
@@ -28,17 +28,17 @@ jobs:
|
|
|
28
28
|
# upcomming Rails versions, maybe before a release.
|
|
29
29
|
#- gemfiles/Gemfile-rails-edge
|
|
30
30
|
exclude:
|
|
31
|
-
- ruby:
|
|
31
|
+
- ruby: "2.7"
|
|
32
32
|
gemfile: gemfiles/Gemfile-rails.7.2.x
|
|
33
|
-
- ruby:
|
|
33
|
+
- ruby: "2.7"
|
|
34
34
|
gemfile: gemfiles/Gemfile-rails.8.0.x
|
|
35
|
-
- ruby:
|
|
35
|
+
- ruby: "3.0"
|
|
36
36
|
gemfile: gemfiles/Gemfile-rails.7.2.x
|
|
37
|
-
- ruby:
|
|
37
|
+
- ruby: "3.0"
|
|
38
38
|
gemfile: gemfiles/Gemfile-rails.8.0.x
|
|
39
|
-
- ruby:
|
|
39
|
+
- ruby: "3.1"
|
|
40
40
|
gemfile: gemfiles/Gemfile-rails.8.0.x
|
|
41
|
-
- ruby:
|
|
41
|
+
- ruby: "3.4"
|
|
42
42
|
gemfile: gemfiles/Gemfile-rails.7.0.x
|
|
43
43
|
|
|
44
44
|
env:
|
|
@@ -57,7 +57,7 @@ jobs:
|
|
|
57
57
|
with:
|
|
58
58
|
node-version: 20.x
|
|
59
59
|
cache: yarn
|
|
60
|
-
|
|
60
|
+
|
|
61
61
|
- name: Install Node dependencies
|
|
62
62
|
run: yarn install --frozen-lockfile --production=false
|
|
63
63
|
|
data/.github/workflows/node.yml
CHANGED
|
@@ -3,7 +3,7 @@ name: Node based checks
|
|
|
3
3
|
on:
|
|
4
4
|
push:
|
|
5
5
|
branches:
|
|
6
|
-
-
|
|
6
|
+
- "main"
|
|
7
7
|
pull_request:
|
|
8
8
|
|
|
9
9
|
concurrency:
|
|
@@ -31,6 +31,15 @@ jobs:
|
|
|
31
31
|
- name: Node eslint
|
|
32
32
|
run: yarn lint
|
|
33
33
|
|
|
34
|
+
- name: Prettier format check
|
|
35
|
+
run: yarn prettier --check .
|
|
36
|
+
|
|
37
|
+
- name: Detect dead code
|
|
38
|
+
run: yarn knip
|
|
39
|
+
|
|
40
|
+
- name: Detect dead code in production
|
|
41
|
+
run: yarn knip:production
|
|
42
|
+
|
|
34
43
|
type-check:
|
|
35
44
|
name: TypeScript Type Checking
|
|
36
45
|
runs-on: ubuntu-latest
|
|
@@ -54,7 +63,7 @@ jobs:
|
|
|
54
63
|
strategy:
|
|
55
64
|
matrix:
|
|
56
65
|
os: [ubuntu-latest]
|
|
57
|
-
node: [
|
|
66
|
+
node: [20.x, 22.x]
|
|
58
67
|
|
|
59
68
|
runs-on: ${{ matrix.os }}
|
|
60
69
|
|
data/.github/workflows/ruby.yml
CHANGED
|
@@ -3,7 +3,7 @@ name: Ruby based checks
|
|
|
3
3
|
on:
|
|
4
4
|
push:
|
|
5
5
|
branches:
|
|
6
|
-
-
|
|
6
|
+
- "main"
|
|
7
7
|
pull_request:
|
|
8
8
|
|
|
9
9
|
concurrency:
|
|
@@ -23,7 +23,7 @@ jobs:
|
|
|
23
23
|
run: rm -f Gemfile.lock
|
|
24
24
|
- uses: ruby/setup-ruby@v1
|
|
25
25
|
with:
|
|
26
|
-
ruby-version:
|
|
26
|
+
ruby-version: "3.4"
|
|
27
27
|
rubygems: latest
|
|
28
28
|
bundler-cache: true
|
|
29
29
|
|
|
@@ -36,7 +36,7 @@ jobs:
|
|
|
36
36
|
strategy:
|
|
37
37
|
matrix:
|
|
38
38
|
os: [ubuntu-latest]
|
|
39
|
-
ruby: [
|
|
39
|
+
ruby: ["2.7", "3.0", "3.1", "3.2", "3.3", "3.4"]
|
|
40
40
|
gemfile:
|
|
41
41
|
- gemfiles/Gemfile-rails.6.0.x
|
|
42
42
|
- gemfiles/Gemfile-rails.6.1.x
|
|
@@ -48,29 +48,29 @@ jobs:
|
|
|
48
48
|
# upcomming Rails versions, maybe before a release.
|
|
49
49
|
#- gemfiles/Gemfile-rails-edge
|
|
50
50
|
exclude:
|
|
51
|
-
- ruby:
|
|
51
|
+
- ruby: "2.7"
|
|
52
52
|
gemfile: gemfiles/Gemfile-rails.7.2.x
|
|
53
|
-
- ruby:
|
|
53
|
+
- ruby: "2.7"
|
|
54
54
|
gemfile: gemfiles/Gemfile-rails.8.0.x
|
|
55
|
-
- ruby:
|
|
55
|
+
- ruby: "3.0"
|
|
56
56
|
gemfile: gemfiles/Gemfile-rails.7.2.x
|
|
57
|
-
- ruby:
|
|
57
|
+
- ruby: "3.0"
|
|
58
58
|
gemfile: gemfiles/Gemfile-rails.8.0.x
|
|
59
|
-
- ruby:
|
|
59
|
+
- ruby: "3.1"
|
|
60
60
|
gemfile: gemfiles/Gemfile-rails.6.0.x
|
|
61
|
-
- ruby:
|
|
61
|
+
- ruby: "3.1"
|
|
62
62
|
gemfile: gemfiles/Gemfile-rails.8.0.x
|
|
63
|
-
- ruby:
|
|
63
|
+
- ruby: "3.2"
|
|
64
64
|
gemfile: gemfiles/Gemfile-rails.6.0.x
|
|
65
|
-
- ruby:
|
|
65
|
+
- ruby: "3.3"
|
|
66
66
|
gemfile: gemfiles/Gemfile-rails.6.0.x
|
|
67
|
-
- ruby:
|
|
67
|
+
- ruby: "3.3"
|
|
68
68
|
gemfile: gemfiles/Gemfile-rails.6.1.x
|
|
69
|
-
- ruby:
|
|
69
|
+
- ruby: "3.4"
|
|
70
70
|
gemfile: gemfiles/Gemfile-rails.6.0.x
|
|
71
|
-
- ruby:
|
|
71
|
+
- ruby: "3.4"
|
|
72
72
|
gemfile: gemfiles/Gemfile-rails.6.1.x
|
|
73
|
-
- ruby:
|
|
73
|
+
- ruby: "3.4"
|
|
74
74
|
gemfile: gemfiles/Gemfile-rails.7.0.x
|
|
75
75
|
|
|
76
76
|
env:
|
|
@@ -85,7 +85,7 @@ jobs:
|
|
|
85
85
|
ruby-version: ${{ matrix.ruby }}
|
|
86
86
|
rubygems: latest
|
|
87
87
|
bundler-cache: true
|
|
88
|
-
|
|
88
|
+
|
|
89
89
|
- uses: actions/setup-node@v4
|
|
90
90
|
with:
|
|
91
91
|
node-version: 20.x
|
|
@@ -19,15 +19,15 @@ jobs:
|
|
|
19
19
|
- name: Setup Ruby
|
|
20
20
|
uses: ruby/setup-ruby@v1
|
|
21
21
|
with:
|
|
22
|
-
ruby-version:
|
|
22
|
+
ruby-version: "3.2"
|
|
23
23
|
bundler-cache: true
|
|
24
24
|
working-directory: spec/dummy
|
|
25
25
|
|
|
26
26
|
- name: Setup Node
|
|
27
27
|
uses: actions/setup-node@v4
|
|
28
28
|
with:
|
|
29
|
-
node-version:
|
|
30
|
-
cache:
|
|
29
|
+
node-version: "20"
|
|
30
|
+
cache: "yarn"
|
|
31
31
|
cache-dependency-path: spec/dummy/yarn.lock
|
|
32
32
|
|
|
33
33
|
- name: Install yalc
|
|
@@ -72,15 +72,15 @@ jobs:
|
|
|
72
72
|
- name: Setup Ruby
|
|
73
73
|
uses: ruby/setup-ruby@v1
|
|
74
74
|
with:
|
|
75
|
-
ruby-version:
|
|
75
|
+
ruby-version: "3.2"
|
|
76
76
|
bundler-cache: true
|
|
77
77
|
working-directory: spec/dummy
|
|
78
78
|
|
|
79
79
|
- name: Setup Node
|
|
80
80
|
uses: actions/setup-node@v4
|
|
81
81
|
with:
|
|
82
|
-
node-version:
|
|
83
|
-
cache:
|
|
82
|
+
node-version: "20"
|
|
83
|
+
cache: "yarn"
|
|
84
84
|
cache-dependency-path: spec/dummy/yarn.lock
|
|
85
85
|
|
|
86
86
|
- name: Install yalc
|
|
@@ -125,15 +125,15 @@ jobs:
|
|
|
125
125
|
- name: Setup Ruby
|
|
126
126
|
uses: ruby/setup-ruby@v1
|
|
127
127
|
with:
|
|
128
|
-
ruby-version:
|
|
128
|
+
ruby-version: "3.2"
|
|
129
129
|
bundler-cache: true
|
|
130
130
|
working-directory: spec/dummy
|
|
131
131
|
|
|
132
132
|
- name: Setup Node
|
|
133
133
|
uses: actions/setup-node@v4
|
|
134
134
|
with:
|
|
135
|
-
node-version:
|
|
136
|
-
cache:
|
|
135
|
+
node-version: "20"
|
|
136
|
+
cache: "yarn"
|
|
137
137
|
cache-dependency-path: spec/dummy/yarn.lock
|
|
138
138
|
|
|
139
139
|
- name: Install yalc
|
data/.gitignore
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
node_modules
|
|
6
6
|
.byebug_history
|
|
7
7
|
/spec/test_app/tmp
|
|
8
|
+
/test/tmp
|
|
8
9
|
yarn-debug.log*
|
|
9
10
|
yarn-error.log*
|
|
10
11
|
.yarn-integrity
|
|
@@ -16,6 +17,12 @@ gemfiles/*.lock
|
|
|
16
17
|
.yalc
|
|
17
18
|
yalc.lock
|
|
18
19
|
|
|
20
|
+
# npm pack tarballs
|
|
21
|
+
*.tgz
|
|
22
|
+
|
|
23
|
+
# Config exporter output directory
|
|
24
|
+
shakapacker-config-exports/
|
|
25
|
+
|
|
19
26
|
# TypeScript generated files
|
|
20
27
|
package/**/*.d.ts
|
|
21
28
|
package/**/*.d.ts.map
|
data/CHANGELOG.md
CHANGED
|
@@ -11,7 +11,54 @@
|
|
|
11
11
|
|
|
12
12
|
Changes since the last non-beta release.
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
### Changed
|
|
15
|
+
|
|
16
|
+
- Allow ESLint v9 and migrated to flat config format. [PR #677](https://github.com/shakacode/shakapacker/pull/677) by [justin808](https://github.com/justin808).
|
|
17
|
+
|
|
18
|
+
### Fixed
|
|
19
|
+
|
|
20
|
+
- Fixed rspack native bindings installation issue when switching bundlers. [PR #672](https://github.com/shakacode/shakapacker/pull/672) by [justin808](https://github.com/justin808).
|
|
21
|
+
- Running `rake shakapacker:switch_bundler rspack -- --install-deps` now properly installs platform-specific native bindings
|
|
22
|
+
- Fixes "Cannot find native binding" error when switching to rspack
|
|
23
|
+
- Fixed Rails constant error when using custom environments like staging. [PR #681](https://github.com/shakacode/shakapacker/pull/681) by [justin808](https://github.com/justin808).
|
|
24
|
+
- `RAILS_ENV=staging` no longer causes "uninitialized constant Shakapacker::Instance::Rails" error
|
|
25
|
+
- Shakapacker now works in non-Rails contexts (like standalone runner)
|
|
26
|
+
- 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
|
+
- Previously `package/index.d.ts` was exporting all types as `any`, breaking IDE autocomplete
|
|
28
|
+
- Now properly exports typed interfaces for `WebpackConfig`, `RspackConfig`, etc.
|
|
29
|
+
|
|
30
|
+
## [v9.2.0] - October 9, 2025
|
|
31
|
+
|
|
32
|
+
### Added
|
|
33
|
+
|
|
34
|
+
- **New config export utility for debugging webpack/rspack configurations** [PR #647](https://github.com/shakacode/shakapacker/pull/647) by [justin808](https://github.com/justin808).
|
|
35
|
+
- Adds `bin/export-bundler-config` utility with three modes:
|
|
36
|
+
- **Doctor mode** (`--doctor`): Exports all configs (dev + prod, client + server) to `shakapacker-config-exports/` directory - best for troubleshooting
|
|
37
|
+
- **Save mode** (`--save`): Export current environment configs to files
|
|
38
|
+
- **Stdout mode** (default): View configs in terminal
|
|
39
|
+
- **Output formats:** YAML (with optional inline documentation), JSON, or Node.js inspect
|
|
40
|
+
- **Smart features:**
|
|
41
|
+
- Environment isolation ensures dev/prod configs are truly different
|
|
42
|
+
- Auto-detects bundler from `shakapacker.yml`
|
|
43
|
+
- Pretty-prints functions (up to 50 lines)
|
|
44
|
+
- Validates bundler value and output paths
|
|
45
|
+
- Sanitizes filenames to prevent path traversal
|
|
46
|
+
- Helpful `.gitignore` suggestions
|
|
47
|
+
- **Usage:** `bin/export-bundler-config --doctor` or `bundle exec rake shakapacker:export_bundler_config`
|
|
48
|
+
- Works seamlessly with `rake shakapacker:switch_bundler` for comparing webpack vs rspack configs
|
|
49
|
+
- Lays groundwork for future config diff feature (tracked in [#667](https://github.com/shakacode/shakapacker/issues/667))
|
|
50
|
+
|
|
51
|
+
### Fixed
|
|
52
|
+
|
|
53
|
+
- Fixed NoMethodError when custom environment (e.g., staging) is not defined in shakapacker.yml. [PR #669](https://github.com/shakacode/shakapacker/pull/669) by [justin808](https://github.com/justin808).
|
|
54
|
+
- When deploying to environments like Heroku staging with `RAILS_ENV=staging`, shakapacker would crash with `undefined method 'deep_symbolize_keys' for nil:NilClass`
|
|
55
|
+
- **Configuration fallback:** Now properly falls back to production environment configuration (appropriate for staging)
|
|
56
|
+
- **NODE_ENV handling:** `bin/shakapacker` now automatically sets `NODE_ENV=production` for custom environments (staging, etc.)
|
|
57
|
+
- Previously: `RAILS_ENV=staging` would set `NODE_ENV=development`, breaking webpack optimizations
|
|
58
|
+
- Now: `RAILS_ENV` in `[development, test]` uses that value for `NODE_ENV`, everything else uses `production`
|
|
59
|
+
- Logs informational message when falling back to help with debugging
|
|
60
|
+
- This ensures shakapacker works with any Rails environment even if not explicitly defined in shakapacker.yml
|
|
61
|
+
- Fixes [#663](https://github.com/shakacode/shakapacker/issues/663)
|
|
15
62
|
|
|
16
63
|
## [v9.1.0] - October 8, 2025
|
|
17
64
|
|
|
@@ -85,7 +132,6 @@ See the [v9 Upgrade Guide](https://github.com/shakacode/shakapacker/blob/main/do
|
|
|
85
132
|
### ⚠️ Breaking Changes
|
|
86
133
|
|
|
87
134
|
1. **SWC is now the default JavaScript transpiler instead of Babel** ([PR 603](https://github.com/shakacode/shakapacker/pull/603) by [justin808](https://github.com/justin808))
|
|
88
|
-
|
|
89
135
|
- Babel dependencies are no longer included as peer dependencies
|
|
90
136
|
- Improves compilation speed by 20x
|
|
91
137
|
- **Migration for existing projects:**
|
|
@@ -102,7 +148,6 @@ See the [v9 Upgrade Guide](https://github.com/shakacode/shakapacker/blob/main/do
|
|
|
102
148
|
```
|
|
103
149
|
|
|
104
150
|
2. **CSS Modules now use named exports by default** ([PR 599](https://github.com/shakacode/shakapacker/pull/599))
|
|
105
|
-
|
|
106
151
|
- **JavaScript:** Use named imports: `import { className } from './styles.module.css'`
|
|
107
152
|
- **TypeScript:** Use namespace imports: `import * as styles from './styles.module.css'`
|
|
108
153
|
- To keep the old behavior with default imports, see [CSS Modules Export Mode documentation](./docs/css-modules-export-mode.md) for configuration instructions
|
|
@@ -368,7 +413,6 @@ See the [v8 Upgrade Guide](https://github.com/shakacode/shakapacker/blob/main/do
|
|
|
368
413
|
|
|
369
414
|
- Set `source_entry_path` to `packs` and `nested_entries` to `true` in`shakapacker.yml` [PR 284](https://github.com/shakacode/shakapacker/pull/284) by [ahangarha](https://github.com/ahangarha).
|
|
370
415
|
- Dev server configuration is modified to follow [webpack recommended configurations](https://webpack.js.org/configuration/dev-server/) for dev server. [PR276](https://github.com/shakacode/shakapacker/pull/276) by [ahangarha](https://github.com/ahangarha):
|
|
371
|
-
|
|
372
416
|
- Deprecated `https` entry is removed from the default configuration file, allowing to set `server` or `https` as per the project requirements. For more detail, check webpack documentation. The `https` entry can be effective only if there is no `server` entry in the config file.
|
|
373
417
|
- `allowed_hosts` is now set to `auto` instead of `all` by default.
|
|
374
418
|
|
|
@@ -636,6 +680,8 @@ Note: [Rubygem is 6.3.0.pre.rc.1](https://rubygems.org/gems/shakapacker/versions
|
|
|
636
680
|
See [CHANGELOG.md in rails/webpacker (up to v5.4.3)](https://github.com/rails/webpacker/blob/master/CHANGELOG.md)
|
|
637
681
|
|
|
638
682
|
[Unreleased]: https://github.com/shakacode/shakapacker/compare/v9.0.0...main
|
|
683
|
+
[v9.2.0]: https://github.com/shakacode/shakapacker/compare/v9.1.0...v9.2.0
|
|
684
|
+
[v9.1.0]: https://github.com/shakacode/shakapacker/compare/v9.0.0...v9.1.0
|
|
639
685
|
[v9.0.0]: https://github.com/shakacode/shakapacker/compare/v8.4.0...v9.0.0
|
|
640
686
|
[v8.4.0]: https://github.com/shakacode/shakapacker/compare/v8.3.0...v8.4.0
|
|
641
687
|
[v8.3.0]: https://github.com/shakacode/shakapacker/compare/v8.2.0...v8.3.0
|
data/CLAUDE.md
CHANGED
|
@@ -1,29 +1,34 @@
|
|
|
1
1
|
# Shakapacker Project Guidelines
|
|
2
2
|
|
|
3
3
|
## Critical Requirements
|
|
4
|
+
|
|
4
5
|
- **ALWAYS end all files with a trailing newline character.** This is required by the project's linting rules.
|
|
5
6
|
- **ALWAYS use `bundle exec` prefix when running Ruby commands** (rubocop, rspec, rake, etc.)
|
|
6
7
|
- **ALWAYS run `bundle exec rubocop` before committing Ruby changes**
|
|
7
8
|
- **ALWAYS run `yarn lint` before committing JavaScript changes**
|
|
8
9
|
|
|
9
10
|
## Testing
|
|
11
|
+
|
|
10
12
|
- Run corresponding RSpec tests when changing source files
|
|
11
13
|
- For example, when changing `lib/shakapacker/foo.rb`, run `spec/shakapacker/foo_spec.rb`
|
|
12
14
|
- Run the full test suite with `bundle exec rspec` before pushing
|
|
13
15
|
|
|
14
16
|
## Code Style
|
|
17
|
+
|
|
15
18
|
- Follow existing code conventions in the file you're editing
|
|
16
19
|
- Use the project's existing patterns and utilities
|
|
17
20
|
- No unnecessary comments unless requested
|
|
18
21
|
- Keep changes focused and minimal - avoid extraneous diffs
|
|
19
22
|
|
|
20
23
|
## Git Workflow
|
|
24
|
+
|
|
21
25
|
- Create feature branches for all changes
|
|
22
26
|
- Never push directly to main branch
|
|
23
27
|
- Create small, focused PRs that are easy to review
|
|
24
28
|
- Always create a PR immediately after pushing changes
|
|
25
29
|
|
|
26
30
|
## Shakapacker-Specific
|
|
31
|
+
|
|
27
32
|
- This gem supports both webpack and rspack configurations
|
|
28
33
|
- Test changes with both bundlers when modifying core functionality
|
|
29
|
-
- Be aware of the dual package.json/Gemfile dependency management
|
|
34
|
+
- Be aware of the dual package.json/Gemfile dependency management
|
data/CONTRIBUTING.md
CHANGED
|
@@ -72,7 +72,6 @@ yarn lint --cache
|
|
|
72
72
|
|
|
73
73
|
1. Install [Yarn](https://classic.yarnpkg.com/)
|
|
74
74
|
2. To test your changes on a Rails test project do the following steps:
|
|
75
|
-
|
|
76
75
|
- For Ruby gem, update `Gemfile` and point the `shakapacker` to the locally developing Shakapacker project:
|
|
77
76
|
```ruby
|
|
78
77
|
gem 'shakapacker', path: "relative_or_absolute_path_to_local_shakapacker"
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
|
@@ -70,6 +70,7 @@ Read the [full review here](https://clutch.co/profile/shakacode#reviews?sort_by=
|
|
|
70
70
|
- [Concepts](#concepts)
|
|
71
71
|
- [Usage](#usage)
|
|
72
72
|
- [Configuration and Code](#configuration-and-code)
|
|
73
|
+
- [Configuration Guide](./docs/configuration.md)
|
|
73
74
|
- [View Helpers](#view-helpers)
|
|
74
75
|
- [View Helpers `javascript_pack_tag` and `stylesheet_pack_tag`](#view-helpers-javascript_pack_tag-and-stylesheet_pack_tag)
|
|
75
76
|
- [View Helpers `append_javascript_pack_tag`, `prepend_javascript_pack_tag` and `append_stylesheet_pack_tag`](#view-helper-append_javascript_pack_tag-prepend_javascript_pack_tag-and-append_stylesheet_pack_tag)
|
|
@@ -314,6 +315,8 @@ At its core, Shakapacker's essential function is to:
|
|
|
314
315
|
|
|
315
316
|
### Configuration and Code
|
|
316
317
|
|
|
318
|
+
**📖 For a comprehensive guide to all configuration options, see [Configuration Guide](./docs/configuration.md)**
|
|
319
|
+
|
|
317
320
|
You will need your file system to correspond to the setup of your `config/shakapacker.yml` file.
|
|
318
321
|
|
|
319
322
|
Suppose you have the following configuration:
|
|
@@ -348,13 +351,20 @@ public/packs # webpack output
|
|
|
348
351
|
|
|
349
352
|
Webpack intelligently includes only necessary files. In this example, the file `packs/application.js` would reference `../src/my_component.js`
|
|
350
353
|
|
|
351
|
-
`nested_entries` allows
|
|
354
|
+
The `nested_entries` option allows webpack entry points in subdirectories (defaults to `true`). See the [Configuration Guide](./docs/configuration.md#nested_entries) for details.
|
|
355
|
+
|
|
356
|
+
The `useContentHash` option enables content-based cache busting. It's disabled by default (except in production) to speed up development builds. See the [Configuration Guide](./docs/configuration.md#usecontenthash) for details.
|
|
357
|
+
|
|
358
|
+
#### Precompile Hook
|
|
352
359
|
|
|
353
|
-
|
|
360
|
+
Shakapacker supports running custom commands before compilation via the `precompile_hook` configuration option.
|
|
361
|
+
|
|
362
|
+
For configuration details, see [precompile_hook in the Configuration Guide](./docs/configuration.md#precompile_hook).
|
|
363
|
+
For complete usage guide, see the [Precompile Hook Guide](./docs/precompile_hook.md).
|
|
354
364
|
|
|
355
365
|
#### Setting custom config path
|
|
356
366
|
|
|
357
|
-
You can use the environment variable
|
|
367
|
+
You can use the `SHAKAPACKER_CONFIG` environment variable to specify a custom config file path. See [Environment Variables in the Configuration Guide](./docs/configuration.md#environment-variables) for this and other configuration options.
|
|
358
368
|
|
|
359
369
|
### View Helpers
|
|
360
370
|
|
|
@@ -583,11 +593,7 @@ Shakapacker ships with two different strategies that are used to determine wheth
|
|
|
583
593
|
- `digest` - This strategy calculates SHA1 digest of files in your watched paths (see below). The calculated digest is then stored in a temp file. To check whether the assets need to be recompiled, Shakapacker calculates the SHA1 of the watched files and compares it with the one stored. If the digests are equal, no recompilation occurs. If the digests are different or the temp file is missing, files are recompiled.
|
|
584
594
|
- `mtime` - This strategy looks at the last "modified at" timestamps of both files AND directories in your watched paths. The timestamp of the most recent file or directory is then compared with the timestamp of `manifest.json` file generated. If the manifest file timestamp is newer than one of the most recently modified files or directories in the watched paths, no recompilation occurs. If the manifest file is older, files are recompiled.
|
|
585
595
|
|
|
586
|
-
The `
|
|
587
|
-
|
|
588
|
-
In production or CI environments, the `digest` strategy is more suitable, unless you are using incremental builds or caching and can guarantee that the timestamps will not change after e.g. cache restore. However, many production or CI environments will explicitly compile assets, so `compile: false` is more appropriate. Otherwise, you'll waste time either checking file timestamps or computing digests.
|
|
589
|
-
|
|
590
|
-
You can control what strategy is used by the `compiler_strategy` option in `shakapacker.yml` config file. By default `mtime` strategy is used in development environment, `digest` is used elsewhere.
|
|
596
|
+
The `compiler_strategy` option determines how Shakapacker checks if assets need recompilation (`mtime` for development, `digest` for production). See the [Configuration Guide](./docs/configuration.md#compiler_strategy) for detailed comparison and recommendations.
|
|
591
597
|
|
|
592
598
|
> [!NOTE]
|
|
593
599
|
>
|
|
@@ -767,6 +773,27 @@ Please note that if you want opt-in to use esbuild-loader, you can skip [React](
|
|
|
767
773
|
|
|
768
774
|
To switch between Babel, SWC, or esbuild, or to configure environment-specific transpiler settings, see the [Transpiler Migration Guide](./docs/transpiler-migration.md).
|
|
769
775
|
|
|
776
|
+
### Debugging Configuration
|
|
777
|
+
|
|
778
|
+
Shakapacker provides a powerful utility to export and analyze your webpack/rspack configuration:
|
|
779
|
+
|
|
780
|
+
```bash
|
|
781
|
+
# Export all configs for troubleshooting (recommended)
|
|
782
|
+
bin/export-bundler-config --doctor
|
|
783
|
+
|
|
784
|
+
# Or via rake task
|
|
785
|
+
bundle exec rake shakapacker:export_bundler_config -- --doctor
|
|
786
|
+
```
|
|
787
|
+
|
|
788
|
+
This exports development and production configurations for both client and server bundles to `shakapacker-config-exports/` directory in annotated YAML format. Perfect for:
|
|
789
|
+
|
|
790
|
+
- Debugging configuration issues
|
|
791
|
+
- Comparing webpack vs rspack configs (works with `rake shakapacker:switch_bundler`)
|
|
792
|
+
- Understanding differences between development and production
|
|
793
|
+
- Analyzing client vs server bundle configurations
|
|
794
|
+
|
|
795
|
+
For more options and usage examples, see the [Troubleshooting Guide](./docs/troubleshooting.md#exporting-webpack--rspack-configuration).
|
|
796
|
+
|
|
770
797
|
### Integrations
|
|
771
798
|
|
|
772
799
|
Shakapacker out of the box supports JS and static assets (fonts, images etc.) compilation. To enable support for CoffeeScript or TypeScript install relevant packages:
|
|
@@ -1220,12 +1247,6 @@ The following companies support our Open Source projects, and ShakaCode uses the
|
|
|
1220
1247
|
<img alt="BrowserStack" src="https://user-images.githubusercontent.com/4244251/184881129-e1edf4b7-3ae1-4ea8-9e6d-3595cf01609e.png" height="55px">
|
|
1221
1248
|
</picture>
|
|
1222
1249
|
</a>
|
|
1223
|
-
<a href="https://railsautoscale.com">
|
|
1224
|
-
<img src="https://user-images.githubusercontent.com/4244251/184881144-95c2c25c-9879-4069-864d-4e67d6ed39d2.png" alt="Rails Autoscale" height="55px">
|
|
1225
|
-
</a>
|
|
1226
1250
|
<a href="https://www.honeybadger.io">
|
|
1227
1251
|
<img src="https://user-images.githubusercontent.com/4244251/184881133-79ee9c3c-8165-4852-958e-31687b9536f4.png" alt="Honeybadger" height="55px">
|
|
1228
1252
|
</a>
|
|
1229
|
-
<a href="https://reviewable.io">
|
|
1230
|
-
<img src="https://user-images.githubusercontent.com/20628911/230848305-c94510a4-82d7-468f-bf9f-eeb81d3f2ce0.png" alt="Reviewable" height="55px">
|
|
1231
|
-
</a>
|