Skip to content

Commit

Permalink
chore: update deps
Browse files Browse the repository at this point in the history
  • Loading branch information
anncwb committed Apr 3, 2021
1 parent c7d95d4 commit d876f7c
Show file tree
Hide file tree
Showing 4 changed files with 213 additions and 176 deletions.
10 changes: 5 additions & 5 deletions example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@
"test:br": "npm run build && http-server dist --cors --brotli -c-1"
},
"dependencies": {
"vue": "^3.0.7"
"vue": "^3.0.11"
},
"devDependencies": {
"@vitejs/plugin-vue": "^1.1.5",
"@vitejs/plugin-vue-jsx": "^1.1.2",
"@vue/compiler-sfc": "^3.0.7",
"@vitejs/plugin-vue": "^1.2.1",
"@vitejs/plugin-vue-jsx": "^1.1.3",
"@vue/compiler-sfc": "^3.0.11",
"cross-env": "^7.0.3",
"http-server": "^0.12.3",
"typescript": "^4.2.3",
"vite": "^2.1.2"
"vite": "^2.1.5"
}
}
26 changes: 13 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,36 +48,36 @@
"etag": "^1.8.1",
"fs-extra": "^9.1.0",
"svg-baker": "1.7.0",
"svgo": "^2.2.2"
"svgo": "^2.3.0"
},
"peerDependencies": {
"vite": ">=2.0.0"
},
"devDependencies": {
"@commitlint/cli": "^12.1.0",
"@commitlint/config-conventional": "^12.1.0",
"@commitlint/cli": "^12.1.1",
"@commitlint/config-conventional": "^12.1.1",
"@types/debug": "^4.1.5",
"@types/etag": "^1.8.0",
"@types/fs-extra": "^9.0.8",
"@types/jest": "^26.0.21",
"@types/node": "^14.14.35",
"@typescript-eslint/eslint-plugin": "^4.18.0",
"@typescript-eslint/parser": "^4.18.0",
"@types/fs-extra": "^9.0.10",
"@types/jest": "^26.0.22",
"@types/node": "^14.14.37",
"@typescript-eslint/eslint-plugin": "^4.20.0",
"@typescript-eslint/parser": "^4.20.0",
"commitizen": "^4.2.3",
"conventional-changelog-cli": "^2.1.1",
"eslint": "^7.22.0",
"eslint": "^7.23.0",
"eslint-config-prettier": "^8.1.0",
"eslint-plugin-jest": "^24.3.2",
"husky": "^5.1.3",
"eslint-plugin-jest": "^24.3.3",
"husky": "^5.2.0",
"jest": "^26.6.3",
"lint-staged": "^10.5.4",
"pinst": "^2.1.6",
"prettier": "^2.2.1",
"pretty-quick": "^3.1.0",
"rimraf": "^3.0.2",
"ts-jest": "^26.5.4",
"tsup": "^4.8.18",
"tsup": "^4.8.21",
"typescript": "^4.2.3",
"vite": "^2.1.2"
"vite": "^2.1.5"
}
}
9 changes: 6 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ interface FileStats {

export default (opt: ViteSvgIconsPlugin): Plugin => {
const cache = new Map<string, FileStats>();
let isBuild = false;

let isBuild = false;
const options = {
svgoOptions: true,
symbolId: 'icon-[dir]-[name]',
Expand All @@ -52,6 +52,7 @@ export default (opt: ViteSvgIconsPlugin): Plugin => {

let { svgoOptions } = options;
const { symbolId } = options;

if (!symbolId.includes('[name]')) {
throw new Error('SymbolId must contain [name] string!');
}
Expand Down Expand Up @@ -200,14 +201,17 @@ export async function compilerIcon(
symbolId: string,
svgOptions: SvgoOptions
): Promise<string | null> {
if (!file) return null;
if (!file) {
return null;
}

let content = fs.readFileSync(file, 'utf-8');

if (svgOptions) {
const { data } = await optimize(content, svgOptions);
content = data;
}

const svgSymbol = await new SVGCompiler().addSymbol({
id: symbolId,
content,
Expand Down Expand Up @@ -247,7 +251,6 @@ export function discreteDir(name: string) {
}

const strList = name.split('/');

const fileName = strList.pop();
const dirName = strList.join('-');
return { fileName, dirName };
Expand Down
Loading

0 comments on commit d876f7c

Please sign in to comment.