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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6613d4b52d4526e1ead4d4711e9daab007e98076f3af92e2cd9a61a65386cf74
4
- data.tar.gz: 7d31d8f1cfbfe305a6a6e2cc0159150ab6d7c7a3c36ef0608c13389b85a7424b
3
+ metadata.gz: 32122fb686bab6ec0cfeba217c5d53ad88cf40897fe08564475a4e8fa8b79962
4
+ data.tar.gz: 1304bdd1f5d735bcc3642ae27a1d9151a75ca1a7c3cf33b1217163577f43a193
5
5
  SHA512:
6
- metadata.gz: 5d60bca460bbbba6f9944368cab33d63e1958b607d12aac91aba71eb9a00066cbce92893fcc01034c33e347e4f938321bbba2c27650436577ed3078cad13c753
7
- data.tar.gz: 80d705dd8d7b5fae172909a5f334cd774dcd57c5864d3c051cc7a33d6b2ef82412f5d104e4a0284d65c3c8a630992798812925e9f5f4e4389b0ec05f8b357889
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
- ### Added
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.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
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.
@@ -1,4 +1,4 @@
1
1
  module Shakapacker
2
2
  # Change the version in package.json too, please!
3
- VERSION = "7.2.2".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.2",
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": {
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.2
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.2.2
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: