svg-sprite-generation-loader 2.2.8 → 2.3.1

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.
@@ -4,7 +4,6 @@ about: Create a report to help us improve
4
4
  title: ''
5
5
  labels: ''
6
6
  assignees: ''
7
-
8
7
  ---
9
8
 
10
9
  **Describe the bug**
@@ -12,6 +11,7 @@ A clear and concise description of what the bug is.
12
11
 
13
12
  **To Reproduce**
14
13
  Steps to reproduce the behavior:
14
+
15
15
  1. Go to '...'
16
16
  2. Click on '....'
17
17
  3. Scroll down to '....'
@@ -24,15 +24,17 @@ A clear and concise description of what you expected to happen.
24
24
  If applicable, add screenshots to help explain your problem.
25
25
 
26
26
  **Desktop (please complete the following information):**
27
- - OS: [e.g. iOS]
28
- - Browser [e.g. chrome, safari]
29
- - Version [e.g. 22]
27
+
28
+ - OS: [e.g. iOS]
29
+ - Browser [e.g. chrome, safari]
30
+ - Version [e.g. 22]
30
31
 
31
32
  **Smartphone (please complete the following information):**
32
- - Device: [e.g. iPhone6]
33
- - OS: [e.g. iOS8.1]
34
- - Browser [e.g. stock browser, safari]
35
- - Version [e.g. 22]
33
+
34
+ - Device: [e.g. iPhone6]
35
+ - OS: [e.g. iOS8.1]
36
+ - Browser [e.g. stock browser, safari]
37
+ - Version [e.g. 22]
36
38
 
37
39
  **Additional context**
38
40
  Add any other context about the problem here.
@@ -4,7 +4,6 @@ about: Suggest an idea for this project
4
4
  title: ''
5
5
  labels: ''
6
6
  assignees: ''
7
-
8
7
  ---
9
8
 
10
9
  **Is your feature request related to a problem? Please describe.**
@@ -5,7 +5,14 @@
5
5
 
6
6
  version: 2
7
7
  updates:
8
+ # npm packages
8
9
  - package-ecosystem: 'npm' # See documentation for possible values
9
10
  directory: '/' # Location of package manifests
10
11
  schedule:
11
12
  interval: 'monthly'
13
+
14
+ # GitHub Actions used in workflows
15
+ - package-ecosystem: 'github-actions'
16
+ directory: '/'
17
+ schedule:
18
+ interval: 'monthly'
@@ -10,7 +10,7 @@ jobs:
10
10
  stale:
11
11
  runs-on: ubuntu-latest
12
12
  steps:
13
- - uses: actions/stale@v5
13
+ - uses: actions/stale@eb5cf3af3ac0a1aa4c9c45633dd1ae542a27a899 # v10.3.0
14
14
  with:
15
15
  days-before-stale: 14
16
16
  stale-issue-message: ''
@@ -9,14 +9,14 @@
9
9
  # the `language` matrix defined below to confirm you have the correct set of
10
10
  # supported CodeQL languages.
11
11
  #
12
- name: "CodeQL"
12
+ name: 'CodeQL'
13
13
 
14
14
  on:
15
15
  push:
16
- branches: [ "main" ]
16
+ branches: ['main']
17
17
  pull_request:
18
18
  # The branches below must be a subset of the branches above
19
- branches: [ "main" ]
19
+ branches: ['main']
20
20
  schedule:
21
21
  - cron: '41 5 * * 1'
22
22
 
@@ -32,41 +32,40 @@ jobs:
32
32
  strategy:
33
33
  fail-fast: false
34
34
  matrix:
35
- language: [ 'javascript' ]
35
+ language: ['javascript']
36
36
  # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
37
37
  # Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
38
38
 
39
39
  steps:
40
- - name: Checkout repository
41
- uses: actions/checkout@v3
40
+ - name: Checkout repository
41
+ uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
42
42
 
43
- # Initializes the CodeQL tools for scanning.
44
- - name: Initialize CodeQL
45
- uses: github/codeql-action/init@v2
46
- with:
47
- languages: ${{ matrix.language }}
48
- # If you wish to specify custom queries, you can do so here or in a config file.
49
- # By default, queries listed here will override any specified in a config file.
50
- # Prefix the list here with "+" to use these queries and those in the config file.
51
-
52
- # Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
53
- # queries: security-extended,security-and-quality
43
+ # Initializes the CodeQL tools for scanning.
44
+ - name: Initialize CodeQL
45
+ uses: github/codeql-action/init@8aad20d150bbac5944a9f9d289da16a4b0d87c1e # v4.36.2
46
+ with:
47
+ languages: ${{ matrix.language }}
48
+ # If you wish to specify custom queries, you can do so here or in a config file.
49
+ # By default, queries listed here will override any specified in a config file.
50
+ # Prefix the list here with "+" to use these queries and those in the config file.
54
51
 
55
-
56
- # Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
57
- # If this step fails, then you should remove it and run the build manually (see below)
58
- - name: Autobuild
59
- uses: github/codeql-action/autobuild@v2
52
+ # Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
53
+ # queries: security-extended,security-and-quality
60
54
 
61
- # ℹ️ Command-line programs to run using the OS shell.
62
- # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
55
+ # Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
56
+ # If this step fails, then you should remove it and run the build manually (see below)
57
+ - name: Autobuild
58
+ uses: github/codeql-action/autobuild@8aad20d150bbac5944a9f9d289da16a4b0d87c1e # v4.36.2
63
59
 
64
- # If the Autobuild fails above, remove it and uncomment the following three lines.
65
- # modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
60
+ # ℹ️ Command-line programs to run using the OS shell.
61
+ # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
66
62
 
67
- # - run: |
68
- # echo "Run, Build Application using script"
69
- # ./location_of_script_within_repo/buildscript.sh
63
+ # If the Autobuild fails above, remove it and uncomment the following three lines.
64
+ # modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
70
65
 
71
- - name: Perform CodeQL Analysis
72
- uses: github/codeql-action/analyze@v2
66
+ # - run: |
67
+ # echo "Run, Build Application using script"
68
+ # ./location_of_script_within_repo/buildscript.sh
69
+
70
+ - name: Perform CodeQL Analysis
71
+ uses: github/codeql-action/analyze@8aad20d150bbac5944a9f9d289da16a4b0d87c1e # v4.36.2
@@ -15,6 +15,6 @@ jobs:
15
15
  runs-on: ubuntu-latest
16
16
  steps:
17
17
  - name: 'Checkout Repository'
18
- uses: actions/checkout@v3
18
+ uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
19
19
  - name: 'Dependency Review'
20
- uses: actions/dependency-review-action@v2
20
+ uses: actions/dependency-review-action@a1d282b36b6f3519aa1f3fc636f609c47dddb294 # v5.0.0
@@ -8,19 +8,24 @@ on:
8
8
  types: [created]
9
9
 
10
10
  jobs:
11
+ quality-check:
12
+ uses: ./.github/workflows/quality-check.yml
13
+ secrets: inherit
14
+
11
15
  publish:
16
+ needs: quality-check
12
17
  runs-on: ubuntu-latest
13
18
  permissions:
14
19
  contents: read
15
20
  id-token: write
16
21
  steps:
17
- - uses: actions/checkout@v4
22
+ - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
18
23
 
19
24
  - name: Install pnpm
20
- uses: pnpm/action-setup@v4
25
+ uses: pnpm/action-setup@0ebf47130e4866e96fce0953f49152a61190b271 # v6.0.9
21
26
 
22
27
  - name: Set Node.js
23
- uses: actions/setup-node@v6
28
+ uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
24
29
  with:
25
30
  node-version: 24
26
31
  cache: 'pnpm'
@@ -0,0 +1,31 @@
1
+ name: Quality Check
2
+
3
+ on:
4
+ pull_request:
5
+ push:
6
+ branches: [main]
7
+ workflow_call:
8
+
9
+ jobs:
10
+ checks:
11
+ runs-on: ubuntu-latest
12
+ steps:
13
+ - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
14
+
15
+ - name: Install pnpm
16
+ uses: pnpm/action-setup@0ebf47130e4866e96fce0953f49152a61190b271 # v6.0.9
17
+
18
+ - name: Set Node.js
19
+ uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
20
+ with:
21
+ node-version: 24
22
+ cache: 'pnpm'
23
+
24
+ - name: Install dependencies
25
+ run: pnpm i --frozen-lockfile
26
+
27
+ - name: Lint
28
+ run: pnpm lint
29
+
30
+ - name: Format check
31
+ run: pnpm format:check
package/.husky/pre-commit CHANGED
@@ -1,4 +1 @@
1
- #!/bin/sh
2
- . "$(dirname "$0")/_/husky.sh"
3
-
4
1
  npx lint-staged
@@ -0,0 +1,4 @@
1
+ node_modules
2
+ pnpm-lock.yaml
3
+ package-lock.json
4
+ yarn.lock
@@ -17,23 +17,23 @@ diverse, inclusive, and healthy community.
17
17
  Examples of behavior that contributes to a positive environment for our
18
18
  community include:
19
19
 
20
- * Demonstrating empathy and kindness toward other people
21
- * Being respectful of differing opinions, viewpoints, and experiences
22
- * Giving and gracefully accepting constructive feedback
23
- * Accepting responsibility and apologizing to those affected by our mistakes,
20
+ - Demonstrating empathy and kindness toward other people
21
+ - Being respectful of differing opinions, viewpoints, and experiences
22
+ - Giving and gracefully accepting constructive feedback
23
+ - Accepting responsibility and apologizing to those affected by our mistakes,
24
24
  and learning from the experience
25
- * Focusing on what is best not just for us as individuals, but for the
25
+ - Focusing on what is best not just for us as individuals, but for the
26
26
  overall community
27
27
 
28
28
  Examples of unacceptable behavior include:
29
29
 
30
- * The use of sexualized language or imagery, and sexual attention or
30
+ - The use of sexualized language or imagery, and sexual attention or
31
31
  advances of any kind
32
- * Trolling, insulting or derogatory comments, and personal or political attacks
33
- * Public or private harassment
34
- * Publishing others' private information, such as a physical or email
32
+ - Trolling, insulting or derogatory comments, and personal or political attacks
33
+ - Public or private harassment
34
+ - Publishing others' private information, such as a physical or email
35
35
  address, without their explicit permission
36
- * Other conduct which could reasonably be considered inappropriate in a
36
+ - Other conduct which could reasonably be considered inappropriate in a
37
37
  professional setting
38
38
 
39
39
  ## Enforcement Responsibilities
@@ -106,7 +106,7 @@ Violating these terms may lead to a permanent ban.
106
106
  ### 4. Permanent Ban
107
107
 
108
108
  **Community Impact**: Demonstrating a pattern of violation of community
109
- standards, including sustained inappropriate behavior, harassment of an
109
+ standards, including sustained inappropriate behavior, harassment of an
110
110
  individual, or aggression toward or disparagement of classes of individuals.
111
111
 
112
112
  **Consequence**: A permanent ban from any sort of public interaction within
package/CONTRIBUTING.md CHANGED
@@ -26,6 +26,7 @@ git checkout -b feature/your-feature-name
26
26
  ## Reporting Issues
27
27
 
28
28
  If you find a bug or want to request a feature:
29
+
29
30
  - Check if it hasn’t already been reported or requested.
30
31
  - Open a new issue with a clear title and detailed description.
31
32
 
package/README.md CHANGED
@@ -108,9 +108,9 @@ import iconData from 'path/to/some/icon-file-name.svg';
108
108
 
109
109
  ## Options
110
110
 
111
- | Name | Type | Default value | Description |
112
- | -------------- | -------------------------------- | ------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
113
- | symbolId | `string`&nbsp;\|&nbsp;`function` | `"[name]"` | Sprite item (single icon) `<symbol>`&nbsp;`id` attribute value.<br />`string` or `function` that takes the file path of the original icon as an argument and returns `string`.<br /><br />You can use [interpolateName](https://github.com/webpack/loader-utils#interpolatename) patterns.<br /> Default value (`"[name]"`) is equal to icon filename (without extension). For example, by default symbolId for `file1.svg` file will be `file1` |
114
- | spriteFilePath | `string` | `sprite.svg` | Path to sprite file.<br /> `webpack.output.path` is included. You can use [interpolateName](https://github.com/webpack/loader-utils#interpolatename) patterns. |
115
- | svgoOptimize | `boolean` \| `object` | `true` | Enable/Disable/Customize source svg file optimization with [svgo.optimize](https://github.com/svg/svgo#optimize). The following options are used by default: <br /><pre>`{`<br />&nbsp;&nbsp;`plugins: [`<br />&nbsp;&nbsp;&nbsp;&nbsp;`{`<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;`name: 'preset-default',`<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;`params: {`<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;`overrides: {`<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;`removeViewBox: false,`<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;`},`<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;`},`<br />&nbsp;&nbsp;&nbsp;&nbsp;`},`<br />&nbsp;&nbsp;&nbsp;&nbsp;`'removeXMLNS',`<br />&nbsp;&nbsp;`],`<br />`}`</pre> You can disable it completely (by passing `false`) or use your own configuration (see [svgo docs](https://github.com/svg/svgo#optimize)) |
116
- | **addContent** | `boolean` | `false` | Add svg content as property to transformed svg object (may increase bundle size when enabled) |
111
+ | Name | Type | Default value | Description |
112
+ | -------------- | -------------------------------- | ------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
113
+ | symbolId | `string`&nbsp;\|&nbsp;`function` | `"[name]"` | Sprite item (single icon) `<symbol>`&nbsp;`id` attribute value.<br />`string` or `function` that takes the file path of the original icon as an argument and returns `string`.<br /><br />You can use [interpolateName](https://github.com/webpack/loader-utils#interpolatename) patterns.<br /> Default value (`"[name]"`) is equal to icon filename (without extension). For example, by default symbolId for `file1.svg` file will be `file1` |
114
+ | spriteFilePath | `string` | `sprite.svg` | Path to sprite file.<br /> `webpack.output.path` is included. You can use [interpolateName](https://github.com/webpack/loader-utils#interpolatename) patterns. |
115
+ | svgoOptimize | `boolean` \| `object` | `true` | Enable/Disable/Customize source svg file optimization with [svgo.optimize](https://github.com/svg/svgo#optimize). The following options are used by default: <br /><pre>`{`<br />&nbsp;&nbsp;`plugins: ['preset-default', 'removeXMLNS'],`<br />`}`</pre> You can disable it completely (by passing `false`) or use your own configuration (see [svgo docs](https://github.com/svg/svgo#optimize)) |
116
+ | **addContent** | `boolean` | `false` | Add svg content as property to transformed svg object (may increase bundle size when enabled) |
@@ -0,0 +1,19 @@
1
+ const js = require('@eslint/js');
2
+ const globals = require('globals');
3
+ const importPlugin = require('eslint-plugin-import');
4
+ const prettier = require('eslint-config-prettier');
5
+
6
+ module.exports = [
7
+ js.configs.recommended,
8
+ importPlugin.flatConfigs.recommended,
9
+ {
10
+ languageOptions: {
11
+ ecmaVersion: 'latest',
12
+ sourceType: 'commonjs',
13
+ globals: {
14
+ ...globals.node,
15
+ },
16
+ },
17
+ },
18
+ prettier,
19
+ ];
package/index.js CHANGED
@@ -94,17 +94,7 @@ function svgSpriteGenerationLoader(source) {
94
94
  const svgoOptimizeConfig =
95
95
  options.svgoOptimize === true
96
96
  ? {
97
- plugins: [
98
- {
99
- name: 'preset-default',
100
- params: {
101
- overrides: {
102
- removeViewBox: false,
103
- },
104
- },
105
- },
106
- 'removeXMLNS',
107
- ],
97
+ plugins: ['preset-default', 'removeXMLNS'],
108
98
  }
109
99
  : options.svgoOptimize;
110
100
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "svg-sprite-generation-loader",
3
- "version": "2.2.8",
3
+ "version": "2.3.1",
4
4
  "description": "Webpack loader for generating external svg symbol sprite files",
5
5
  "main": "index.js",
6
6
  "repository": {
@@ -33,22 +33,26 @@
33
33
  "dependencies": {
34
34
  "loader-utils": "^3.2.1",
35
35
  "schema-utils": "^4.2.0",
36
- "svgo": "^3.0.2"
36
+ "svgo": "^4.0.2"
37
37
  },
38
38
  "devDependencies": {
39
- "eslint": "^7.32.0 || ^8.2.0",
40
- "eslint-config-airbnb-base": "^15.0.0",
41
- "eslint-config-prettier": "^10.1.1",
42
- "eslint-plugin-import": "^2.25.2",
39
+ "@eslint/js": "^10.0.1",
40
+ "eslint": "^10.8.0",
41
+ "eslint-config-prettier": "^10.1.8",
42
+ "eslint-plugin-import": "^2.32.0",
43
+ "globals": "^17.8.0",
43
44
  "husky": ">=6",
44
- "lint-staged": ">=10",
45
- "prettier": "^3.8.3"
45
+ "lint-staged": "^17.2.0",
46
+ "prettier": "^3.9.6"
46
47
  },
47
48
  "lint-staged": {
48
49
  "*.js": "eslint --cache --fix",
49
50
  "*.{js,css,md}": "prettier --write"
50
51
  },
51
52
  "scripts": {
53
+ "lint": "eslint .",
54
+ "format": "prettier --write .",
55
+ "format:check": "prettier --check .",
52
56
  "test": "echo \"Error: no test specified\" && exit 1"
53
57
  }
54
58
  }
package/plugin.js CHANGED
@@ -6,7 +6,6 @@ class SvgSpriteGeneratorPlugin {
6
6
  this.params = params;
7
7
  }
8
8
 
9
- // eslint-disable-next-line class-methods-use-this
10
9
  apply(compiler) {
11
10
  // webpack module instance can be accessed from the compiler object,
12
11
  // this ensures that correct version of the module is used
@@ -1,8 +1,4 @@
1
1
  overrides:
2
- brace-expansion@<1.1.13: '>=1.1.13'
3
- fast-uri@<=3.1.0: '>=3.1.1'
4
- fast-uri@<=3.1.1: '>=3.1.2'
5
- flatted@<3.4.0: '>=3.4.0'
6
- flatted@<=3.4.1: '>=3.4.2'
7
- picomatch@<2.3.2: '>=2.3.2'
8
- yaml@>=2.0.0 <2.8.3: '>=2.8.3'
2
+ brace-expansion@<=5.0.7: '>=5.0.8'
3
+ fast-uri@>=3.0.0 <3.1.3: '>=3.1.3'
4
+ fast-uri@>=3.0.0 <=3.1.3: '>=3.1.4'
@@ -6,7 +6,6 @@ function transformSvg(source) {
6
6
  .reduce((result, attribute) => {
7
7
  const [name, unformattedValue] = attribute.split('=');
8
8
 
9
- // eslint-disable-next-line no-param-reassign
10
9
  result[name] = unformattedValue
11
10
  ? unformattedValue.replace(/['"]/g, '')
12
11
  : true;
package/.eslintrc.json DELETED
@@ -1,12 +0,0 @@
1
- {
2
- "env": {
3
- "commonjs": true,
4
- "es2021": true,
5
- "node": true
6
- },
7
- "extends": ["airbnb-base", "prettier"],
8
- "parserOptions": {
9
- "ecmaVersion": "latest"
10
- },
11
- "rules": {}
12
- }