shakapacker 7.2.2 → 7.3.0.beta.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -2
- data/README.md +4 -0
- data/lib/shakapacker/version.rb +1 -1
- data/package/config.js +2 -0
- data/package/index.d.ts +1 -0
- data/package/rules/__tests__/babel.js +1 -1
- data/package/rules/__tests__/esbuild.js +1 -1
- data/package/rules/__tests__/file.js +17 -0
- data/package/rules/__tests__/swc.js +1 -1
- data/package/rules/file.js +6 -3
- data/package/rules/jscommon.js +2 -5
- data/package/rules/less.js +5 -6
- data/package/rules/stylus.js +2 -7
- data/package.json +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 32122fb686bab6ec0cfeba217c5d53ad88cf40897fe08564475a4e8fa8b79962
|
4
|
+
data.tar.gz: 1304bdd1f5d735bcc3642ae27a1d9151a75ca1a7c3cf33b1217163577f43a193
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c77d2e756603a02a42e5b3a5917cb77cce6b112edee947572348057adde9b4bb696c7cdffa592dcee63d851c2cbd04c4143504ed5edaa3ced7206b5c6a88f767
|
7
|
+
data.tar.gz: cdfa1f6f2771eef452dc9a0f3d447ff437bb99ac0b5427381d20042b83734d85f7e21eaf7559bd712788db2f788178c663a4b9117babc44441fb29fc079d5053
|
data/CHANGELOG.md
CHANGED
@@ -7,10 +7,14 @@
|
|
7
7
|
## [Unreleased]
|
8
8
|
Changes since the last non-beta release.
|
9
9
|
|
10
|
-
|
10
|
+
## [v7.2.2] - January 19, 2024
|
11
11
|
|
12
|
+
### Added
|
12
13
|
- Allow `compression-webpack-plugin` v11. [PR 406](https://github.com/shakacode/shakapacker/pull/406) by [tagliala](https://github.com/tagliala).
|
13
14
|
|
15
|
+
### Changed
|
16
|
+
- Just like with the `source_path` the paths in `additional_paths` will now also be stripped from asset paths. [PR 403](https://github.com/shakacode/shakapacker/pull/403) by [paypro-leon](https://github.com/paypro-leon).
|
17
|
+
|
14
18
|
## [v7.2.1] - December 30, 2023
|
15
19
|
|
16
20
|
### Fixed
|
@@ -299,7 +303,8 @@ Note: [Rubygem is 6.3.0.pre.rc.1](https://rubygems.org/gems/shakapacker/versions
|
|
299
303
|
## v5.4.3 and prior changes from rails/webpacker
|
300
304
|
See [CHANGELOG.md in rails/webpacker (up to v5.4.3)](https://github.com/rails/webpacker/blob/master/CHANGELOG.md)
|
301
305
|
|
302
|
-
[Unreleased]: https://github.com/shakacode/shakapacker/compare/v7.2.
|
306
|
+
[Unreleased]: https://github.com/shakacode/shakapacker/compare/v7.2.2...master
|
307
|
+
[v7.2.2]: https://github.com/shakacode/shakapacker/compare/v7.2.1...v7.2.2
|
303
308
|
[v7.2.1]: https://github.com/shakacode/shakapacker/compare/v7.2.0...v7.2.1
|
304
309
|
[v7.2.0]: https://github.com/shakacode/shakapacker/compare/v7.1.0...v7.2.0
|
305
310
|
[v7.1.0]: https://github.com/shakacode/shakapacker/compare/v7.0.3...v7.1.0
|
data/README.md
CHANGED
@@ -880,6 +880,10 @@ import 'stylesheets/main'
|
|
880
880
|
import 'images/rails.png'
|
881
881
|
```
|
882
882
|
|
883
|
+
Assets put in these folders will have their directory stripped just like with the `source_path`. For example:
|
884
|
+
|
885
|
+
A file in `app/assets/images/image.svg` with `additional_paths: ['app/assets']` will result in `static/images/image.svg`
|
886
|
+
|
883
887
|
**Note:** Please be careful when adding paths here otherwise it will make the compilation slow, consider adding specific paths instead of the whole parent directory if you just need to reference one or two modules
|
884
888
|
|
885
889
|
**Also note:** While importing assets living outside your `source_path` defined in shakapacker.yml (like, for instance, assets under `app/assets`) from within your packs using _relative_ paths like `import '../../assets/javascripts/file.js'` will work in development, Shakapacker won't recompile the bundle in production unless a file that lives in one of it's watched paths has changed (check out `Shakapacker::MtimeStrategy#latest_modified_timestamp` or `Shakapacker::DigestStrategy#watched_files_digest` depending on strategy configured by `compiler_strategy` option in `shakapacker.yml`). That's why you'd need to add `app/assets` to the additional_paths as stated above and use `import 'javascripts/file.js'` instead.
|
data/lib/shakapacker/version.rb
CHANGED
data/package/config.js
CHANGED
data/package/index.d.ts
CHANGED
@@ -12,7 +12,7 @@ jest.mock("../../config", () => {
|
|
12
12
|
const original = jest.requireActual("../../config");
|
13
13
|
return {
|
14
14
|
...original,
|
15
|
-
|
15
|
+
includePaths: [...original.includePaths, "node_modules/included"]
|
16
16
|
};
|
17
17
|
});
|
18
18
|
|
@@ -1,5 +1,13 @@
|
|
1
1
|
const file = require('../file')
|
2
2
|
|
3
|
+
jest.mock("../../config", () => {
|
4
|
+
const original = jest.requireActual("../../config");
|
5
|
+
return {
|
6
|
+
...original,
|
7
|
+
includePaths: [...original.includePaths, 'app/assets']
|
8
|
+
};
|
9
|
+
});
|
10
|
+
|
3
11
|
describe('file', () => {
|
4
12
|
test('test expected file types', () => {
|
5
13
|
const types = [
|
@@ -59,4 +67,13 @@ describe('file', () => {
|
|
59
67
|
'static/images/nested/deeply/[name]-[hash][ext][query]'
|
60
68
|
);
|
61
69
|
});
|
70
|
+
|
71
|
+
test('correct generated output path is returned for all include paths', () => {
|
72
|
+
const pathData = {
|
73
|
+
filename: 'app/assets/images/image.svg',
|
74
|
+
};
|
75
|
+
expect(file.generator.filename(pathData)).toEqual(
|
76
|
+
'static/images/[name]-[hash][ext][query]'
|
77
|
+
);
|
78
|
+
});
|
62
79
|
})
|
data/package/rules/file.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
const { dirname } = require('path')
|
2
|
-
const {
|
2
|
+
const { includePaths } = require('../config')
|
3
3
|
|
4
4
|
module.exports = {
|
5
5
|
test: /\.(bmp|gif|jpe?g|png|tiff|ico|avif|webp|eot|otf|ttf|woff|woff2|svg)$/,
|
@@ -7,8 +7,11 @@ module.exports = {
|
|
7
7
|
type: 'asset/resource',
|
8
8
|
generator: {
|
9
9
|
filename: (pathData) => {
|
10
|
-
const
|
11
|
-
|
10
|
+
const path = dirname(pathData.filename)
|
11
|
+
const selectedIncludePath = includePaths.find((includePath) => path.includes(includePath))
|
12
|
+
|
13
|
+
const folders = path
|
14
|
+
.replace(`${selectedIncludePath}`, '')
|
12
15
|
.split('/')
|
13
16
|
.filter(Boolean)
|
14
17
|
|
data/package/rules/jscommon.js
CHANGED
@@ -1,11 +1,8 @@
|
|
1
1
|
const { resolve } = require('path')
|
2
2
|
const { realpathSync } = require('fs')
|
3
|
-
const {
|
4
|
-
source_path: sourcePath,
|
5
|
-
additional_paths: additionalPaths
|
6
|
-
} = require('../config')
|
3
|
+
const { includePaths } = require('../config')
|
7
4
|
|
8
|
-
const inclusions =
|
5
|
+
const inclusions = includePaths.map(p => {
|
9
6
|
try {
|
10
7
|
return realpathSync(p)
|
11
8
|
} catch (e) {
|
data/package/rules/less.js
CHANGED
@@ -1,11 +1,7 @@
|
|
1
1
|
const path = require('path')
|
2
2
|
const { canProcess } = require('../utils/helpers')
|
3
3
|
const getStyleRule = require('../utils/get_style_rule')
|
4
|
-
|
5
|
-
const {
|
6
|
-
additional_paths: paths,
|
7
|
-
source_path: sourcePath
|
8
|
-
} = require('../config')
|
4
|
+
const { includePaths } = require('../config')
|
9
5
|
|
10
6
|
module.exports = canProcess('less-loader', (resolvedPath) =>
|
11
7
|
getStyleRule(/\.(less)(\.erb)?$/i, [
|
@@ -13,7 +9,10 @@ module.exports = canProcess('less-loader', (resolvedPath) =>
|
|
13
9
|
loader: resolvedPath,
|
14
10
|
options: {
|
15
11
|
lessOptions: {
|
16
|
-
paths: [
|
12
|
+
paths: [
|
13
|
+
path.resolve(__dirname, 'node_modules'),
|
14
|
+
...includePaths
|
15
|
+
]
|
17
16
|
},
|
18
17
|
sourceMap: true
|
19
18
|
}
|
data/package/rules/stylus.js
CHANGED
@@ -1,11 +1,7 @@
|
|
1
1
|
const path = require('path')
|
2
2
|
const { canProcess } = require('../utils/helpers')
|
3
3
|
const getStyleRule = require('../utils/get_style_rule')
|
4
|
-
|
5
|
-
const {
|
6
|
-
additional_paths: paths,
|
7
|
-
source_path: sourcePath
|
8
|
-
} = require('../config')
|
4
|
+
const { includePaths } = require('../config')
|
9
5
|
|
10
6
|
module.exports = canProcess('stylus-loader', (resolvedPath) =>
|
11
7
|
getStyleRule(/\.(styl(us)?)(\.erb)?$/i, [
|
@@ -15,8 +11,7 @@ module.exports = canProcess('stylus-loader', (resolvedPath) =>
|
|
15
11
|
stylusOptions: {
|
16
12
|
include: [
|
17
13
|
path.resolve(__dirname, 'node_modules'),
|
18
|
-
|
19
|
-
...paths
|
14
|
+
...includePaths
|
20
15
|
]
|
21
16
|
},
|
22
17
|
sourceMap: true
|
data/package.json
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: shakapacker
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 7.
|
4
|
+
version: 7.3.0.beta.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Heinemeier Hansson
|
@@ -566,7 +566,7 @@ homepage: https://github.com/shakacode/shakapacker
|
|
566
566
|
licenses:
|
567
567
|
- MIT
|
568
568
|
metadata:
|
569
|
-
source_code_uri: https://github.com/shakacode/shakapacker/tree/v7.
|
569
|
+
source_code_uri: https://github.com/shakacode/shakapacker/tree/v7.3.0.beta.1
|
570
570
|
post_install_message:
|
571
571
|
rdoc_options: []
|
572
572
|
require_paths:
|
@@ -578,9 +578,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
578
578
|
version: 2.6.0
|
579
579
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
580
580
|
requirements:
|
581
|
-
- - "
|
581
|
+
- - ">"
|
582
582
|
- !ruby/object:Gem::Version
|
583
|
-
version:
|
583
|
+
version: 1.3.1
|
584
584
|
requirements: []
|
585
585
|
rubygems_version: 3.4.12
|
586
586
|
signing_key:
|