Skip to content

Commit

Permalink
Update dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
firefoxic committed Aug 19, 2024
1 parent eae4f63 commit 2af891c
Show file tree
Hide file tree
Showing 5 changed files with 232 additions and 207 deletions.
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 @@ -23,7 +23,7 @@
"engines": {
"node": "^18.18.2 || ^20.9.0"
},
"packageManager": "pnpm@9.1.0",
"packageManager": "pnpm@9.7.1",
"dependencies": {
"node-html-parser": "^6.1.13",
"plugin-error": "^2.0.1",
Expand All @@ -35,16 +35,16 @@
"test": "node --test",
"pretest": "pnpm lint",
"preversion": "pnpm test",
"version": "update-changelog && git add CHANGELOG.md",
"version": "update-changelog",
"postversion": "pnpm publish",
"postpublish": "git push --follow-tags"
},
"devDependencies": {
"@firefoxic/eslint-config": "^1.0.0",
"@firefoxic/update-changelog": "^0.1.0",
"eslint": "^9.2.0",
"@firefoxic/eslint-config": "^3.0.0",
"@firefoxic/update-changelog": "^0.2.0",
"eslint": "^9.9.0",
"gulp": "^5.0.0",
"husky": "^9.0.11"
"husky": "^9.1.4"
},
"keywords": [
"gulp",
Expand Down
Loading

0 comments on commit 2af891c

Please sign in to comment.