shakapacker 7.2.1 → 7.3.0.beta.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1e486b8d36133595f767f26dd8461b1b57fbea6daeba86eaa79b2f3ffcf7dbd2
4
- data.tar.gz: 94b19f6397652a9abbfc3e80ef51ead55d0aec78191ab7bd36383e3ae37f5fce
3
+ metadata.gz: 32122fb686bab6ec0cfeba217c5d53ad88cf40897fe08564475a4e8fa8b79962
4
+ data.tar.gz: 1304bdd1f5d735bcc3642ae27a1d9151a75ca1a7c3cf33b1217163577f43a193
5
5
  SHA512:
6
- metadata.gz: 328d290b9d5bf040aea4239675196975569fb0606e1d93c49bdaf73b0b87d5d2267b3f1069ff26297991016e1c6aad5a8d9fad782bfa17a4898cac95cf421d6d
7
- data.tar.gz: d3067ddec4711898c5a0dcc63b854372917600ecb2019b57c4153bd2a16bf24ce56ec015de3023f46980f7a660ee25e610623339a5b49b1f0e342cbb7dfbead4
6
+ metadata.gz: c77d2e756603a02a42e5b3a5917cb77cce6b112edee947572348057adde9b4bb696c7cdffa592dcee63d851c2cbd04c4143504ed5edaa3ced7206b5c6a88f767
7
+ data.tar.gz: cdfa1f6f2771eef452dc9a0f3d447ff437bb99ac0b5427381d20042b83734d85f7e21eaf7559bd712788db2f788178c663a4b9117babc44441fb29fc079d5053
data/CHANGELOG.md CHANGED
@@ -7,7 +7,13 @@
7
7
  ## [Unreleased]
8
8
  Changes since the last non-beta release.
9
9
 
10
- _Please add entries here for your pull requests that are not yet released._
10
+ ## [v7.2.2] - January 19, 2024
11
+
12
+ ### Added
13
+ - Allow `compression-webpack-plugin` v11. [PR 406](https://github.com/shakacode/shakapacker/pull/406) by [tagliala](https://github.com/tagliala).
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).
11
17
 
12
18
  ## [v7.2.1] - December 30, 2023
13
19
 
@@ -297,7 +303,8 @@ Note: [Rubygem is 6.3.0.pre.rc.1](https://rubygems.org/gems/shakapacker/versions
297
303
  ## v5.4.3 and prior changes from rails/webpacker
298
304
  See [CHANGELOG.md in rails/webpacker (up to v5.4.3)](https://github.com/rails/webpacker/blob/master/CHANGELOG.md)
299
305
 
300
- [Unreleased]: https://github.com/shakacode/shakapacker/compare/v7.2.1...master
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
301
308
  [v7.2.1]: https://github.com/shakacode/shakapacker/compare/v7.2.0...v7.2.1
302
309
  [v7.2.0]: https://github.com/shakacode/shakapacker/compare/v7.1.0...v7.2.0
303
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.
@@ -1,4 +1,4 @@
1
1
  module Shakapacker
2
2
  # Change the version in package.json too, please!
3
- VERSION = "7.2.1".freeze
3
+ VERSION = "7.3.0.beta.1".freeze
4
4
  end
data/package/config.js CHANGED
@@ -53,4 +53,6 @@ if (config.manifest_path) {
53
53
  config.manifestPath = resolve(config.outputPath, 'manifest.json')
54
54
  }
55
55
 
56
+ config.includePaths = [config.source_path, ...config.additional_paths]
57
+
56
58
  module.exports = config
data/package/index.d.ts CHANGED
@@ -22,6 +22,7 @@ declare module 'shakapacker' {
22
22
  publicPath: string
23
23
  publicPathWithoutCDN: string
24
24
  manifestPath: string
25
+ includePaths: string[]
25
26
  }
26
27
 
27
28
  export interface Env {
@@ -12,7 +12,7 @@ jest.mock("../../config", () => {
12
12
  const original = jest.requireActual("../../config");
13
13
  return {
14
14
  ...original,
15
- additional_paths: [...original.additional_paths, "node_modules/included"],
15
+ includePaths: [...original.includePaths, "node_modules/included"]
16
16
  };
17
17
  });
18
18
 
@@ -13,7 +13,7 @@ jest.mock("../../config", () => {
13
13
  return {
14
14
  ...original,
15
15
  webpack_loader: "esbuild",
16
- additional_paths: [...original.additional_paths, "node_modules/included"],
16
+ includePaths: [...original.includePaths, "node_modules/included"]
17
17
  };
18
18
  });
19
19
 
@@ -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
  })
@@ -12,7 +12,7 @@ jest.mock("../../config", () => {
12
12
  return {
13
13
  ...original,
14
14
  webpack_loader: "swc",
15
- additional_paths: [...original.additional_paths, "node_modules/included"],
15
+ includePaths: [...original.includePaths, "node_modules/included"],
16
16
  };
17
17
  });
18
18
 
@@ -1,5 +1,5 @@
1
1
  const { dirname } = require('path')
2
- const { source_path: sourcePath } = require('../config')
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 folders = dirname(pathData.filename)
11
- .replace(`${sourcePath}`, '')
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
 
@@ -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 = [sourcePath, ...additionalPaths].map(p => {
5
+ const inclusions = includePaths.map(p => {
9
6
  try {
10
7
  return realpathSync(p)
11
8
  } catch (e) {
@@ -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: [path.resolve(__dirname, 'node_modules'), sourcePath, ...paths]
12
+ paths: [
13
+ path.resolve(__dirname, 'node_modules'),
14
+ ...includePaths
15
+ ]
17
16
  },
18
17
  sourceMap: true
19
18
  }
@@ -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
- sourcePath,
19
- ...paths
14
+ ...includePaths
20
15
  ]
21
16
  },
22
17
  sourceMap: true
data/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shakapacker",
3
- "version": "7.2.1",
3
+ "version": "7.3.0-beta.1",
4
4
  "description": "Use webpack to manage app-like JavaScript modules in Rails",
5
5
  "homepage": "https://github.com/shakacode/shakapacker",
6
6
  "bugs": {
@@ -63,7 +63,7 @@
63
63
  "@types/babel__core": "^7.0.0",
64
64
  "@types/webpack": "^5.0.0",
65
65
  "babel-loader": "^8.2.4 || ^9.0.0",
66
- "compression-webpack-plugin": "^9.0.0 || ^10.0.0",
66
+ "compression-webpack-plugin": "^9.0.0 || ^10.0.0|| ^11.0.0",
67
67
  "terser-webpack-plugin": "^5.3.1",
68
68
  "webpack": "^5.72.0",
69
69
  "webpack-assets-manifest": "^5.0.6",
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.2.1
4
+ version: 7.3.0.beta.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Heinemeier Hansson
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2024-01-01 00:00:00.000000000 Z
13
+ date: 2024-01-20 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activesupport
@@ -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.2.1
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: '0'
583
+ version: 1.3.1
584
584
  requirements: []
585
585
  rubygems_version: 3.4.12
586
586
  signing_key: