Skip to content

Commit

Permalink
Update dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
firefoxic committed Oct 30, 2024
1 parent 59d747f commit 02f4be2
Show file tree
Hide file tree
Showing 7 changed files with 273 additions and 270 deletions.
3 changes: 3 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
engine-strict=true
manage-package-manager-versions=true
package-manager-strict=true
shell-emulator=true
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com), and 

## [Unreleased]

### Changed

- The minimum required `node.js` version has been increased to `20.12.0`, except for version `21`.

## [4.0.0] — 2024–05–11

### Changed
Expand Down
1 change: 1 addition & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { default as firefoxicEslintConfig, globals } from "@firefoxic/eslint-config"

/** @type {import('eslint').Linter.Config[]} */
export default [
{
languageOptions: {
Expand Down
32 changes: 16 additions & 16 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { parse } from "node-html-parser"
import PluginError from "plugin-error"
import Vinyl from "vinyl"

const excessAttrs = [
let excessAttrs = [
`enable-background`,
`height`,
`version`,
Expand All @@ -16,7 +16,7 @@ const excessAttrs = [
`y`,
]

const xlink = `http://www.w3.org/1999/xlink`
const XLINK = `http://www.w3.org/1999/xlink`

/**
* Gulp plugin for combining SVG icons into a single file.
Expand All @@ -25,11 +25,11 @@ const xlink = `http://www.w3.org/1999/xlink`
*/
export function stacksvg () {
let isEmpty = true
const ids = {}
const namespaces = new Map([[`http://www.w3.org/2000/svg`, `xmlns`]])
const stack = parse(`<svg><style>:root svg:not(:target){display:none}</style></svg>`)
const rootSvg = stack.querySelector(`svg`)
const stream = new Transform({ objectMode: true })
let ids = {}
let namespaces = new Map([[`http://www.w3.org/2000/svg`, `xmlns`]])
let stack = parse(`<svg><style>:root svg:not(:target){display:none}</style></svg>`)
let rootSvg = stack.querySelector(`svg`)
let stream = new Transform({ objectMode: true })

/**
* Transform function for the plugin.
Expand All @@ -47,12 +47,12 @@ export function stacksvg () {
return cb()
}

const iconDom = parse(file.contents.toString()).removeWhitespace()
const iconSvg = iconDom.querySelector(`svg`)
let iconDom = parse(file.contents.toString()).removeWhitespace()
let iconSvg = iconDom.querySelector(`svg`)

isEmpty = false

const iconId = basename(
let iconId = basename(
file.relative.split(sep).join(`_`).replace(/\s/g, `-`),
extname(file.relative),
)
Expand All @@ -64,9 +64,9 @@ export function stacksvg () {
ids[iconId] = true
iconSvg.setAttribute(`id`, iconId)

const viewBoxAttr = iconSvg.getAttribute(`viewBox`)
const widthAttr = iconSvg.getAttribute(`width`)?.replace(/[^0-9]/g, ``)
const heightAttr = iconSvg.getAttribute(`height`)?.replace(/[^0-9]/g, ``)
let viewBoxAttr = iconSvg.getAttribute(`viewBox`)
let widthAttr = iconSvg.getAttribute(`width`)?.replace(/[^0-9]/g, ``)
let heightAttr = iconSvg.getAttribute(`height`)?.replace(/[^0-9]/g, ``)

if (!viewBoxAttr && widthAttr && heightAttr) {
iconSvg.setAttribute(`viewBox`, `0 0 ${widthAttr} ${heightAttr}`)
Expand Down Expand Up @@ -105,7 +105,7 @@ export function stacksvg () {
}
}

const attrs = iconSvg._attrs
let attrs = iconSvg._attrs

for (let attrName in attrs) {
if (attrName.startsWith(`xmlns`)) {
Expand All @@ -118,7 +118,7 @@ export function stacksvg () {
newNsAlias = namespaces.get(nsId).slice(6)
changeNsAlias(iconDom, oldNsAlias, newNsAlias)
}
} else if (nsId === xlink) {
} else if (nsId === XLINK) {
newNsAlias = ``
changeNsAlias(iconDom, oldNsAlias, newNsAlias)
} else {
Expand Down Expand Up @@ -165,7 +165,7 @@ export function stacksvg () {
rootSvg.setAttribute(nsAttr, nsId)
}

const file = new Vinyl({ path: `stack.svg`, contents: Buffer.from(stack.toString()) })
let file = new Vinyl({ path: `stack.svg`, contents: Buffer.from(stack.toString()) })

this.push(file)

Expand Down
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,16 @@
"./lib/"
],
"engines": {
"node": "^18.18.2 || ^20.9.0"
"node": "^20.12 || >=22.11"
},
"packageManager": "pnpm@9.1.0",
"packageManager": "pnpm@9.12.3",
"dependencies": {
"node-html-parser": "^6.1.13",
"plugin-error": "^2.0.1",
"vinyl": "^3.0.0"
},
"scripts": {
"prepare": "git config core.hooksPath .git-hooks || echo 'Not in a git repo'",
"prepare": "git config core.hooksPath .git-hooks || true",
"lint": "eslint",
"test": "node --test",
"pretest": "pnpm lint",
Expand All @@ -40,9 +40,9 @@
"postpublish": "git push --follow-tags"
},
"devDependencies": {
"@firefoxic/eslint-config": "^1.0.0",
"@firefoxic/update-changelog": "^0.2.0",
"eslint": "^9.2.0",
"@firefoxic/eslint-config": "^4.0.0",
"@firefoxic/update-changelog": "^1.0.0",
"eslint": "^9.13.0",
"gulp": "^5.0.0"
},
"keywords": [
Expand Down
Loading

0 comments on commit 02f4be2

Please sign in to comment.