Skip to content

Commit

Permalink
chore(lint): Prettier fix
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Feb 17, 2022
1 parent f127889 commit d2e7faf
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 23 deletions.
3 changes: 1 addition & 2 deletions demo/src/icons/radix.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { createIconPack } from "astro-icon/pack";

export default createIconPack({
url:
"https://raw.githubusercontent.com/radix-ui/icons/master/packages/radix-icons/icons/"
url: "https://raw.githubusercontent.com/radix-ui/icons/master/packages/radix-icons/icons/",
});
9 changes: 4 additions & 5 deletions packages/core/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ yarn add astro-icon
export default {
vite: {
ssr: {
external: ["svgo"]
}
}
external: ["svgo"],
},
},
};
```

Expand Down Expand Up @@ -119,8 +119,7 @@ export default createIconPack({ package: "heroicons", dir: "outline" });

// Resolves `name` from a remote server, like GitHub!
export default createIconPack({
url:
"https://raw.githubusercontent.com/radix-ui/icons/master/packages/radix-icons/icons/"
url: "https://raw.githubusercontent.com/radix-ui/icons/master/packages/radix-icons/icons/",
});
```

Expand Down
2 changes: 1 addition & 1 deletion packages/core/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,5 @@ export {
Spritesheet,
SpriteSheet,
SpriteProvider,
Sprite
Sprite,
};
2 changes: 1 addition & 1 deletion packages/core/lib/context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export function trackSprite(result: any, name: string) {
result[AstroIcon]["sprites"].add(name);
} else {
result[AstroIcon] = {
sprites: new Set([name])
sprites: new Set([name]),
};
}
}
Expand Down
4 changes: 2 additions & 2 deletions packages/core/lib/createIconPack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export interface CreateIconPackOptions {
export function createIconPack({
package: pkg,
dir,
url
url,
}: CreateIconPackOptions) {
if (pkg) {
return async (name: string) => {
Expand All @@ -24,7 +24,7 @@ export function createIconPack({
`[astro-icon] Unable to load "${path}"! Does the file exist?"`
);
}
const svg = await fs.readFile(path).then(res => res.toString());
const svg = await fs.readFile(path).then((res) => res.toString());
return svg;
};
}
Expand Down
23 changes: 12 additions & 11 deletions packages/core/lib/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ import { optimize as optimizeSVGNative } from "svgo";

// Adapted from https://github.com/developit/htmlParser
const splitAttrsTokenizer = /([a-z0-9_\:\-]*)\s*?=\s*?(['"]?)(.*?)\2\s+/gim;
const domParserTokenizer = /(?:<(\/?)([a-zA-Z][a-zA-Z0-9\:]*)(?:\s([^>]*?))?((?:\s*\/)?)>|(<\!\-\-)([\s\S]*?)(\-\->)|(<\!\[CDATA\[)([\s\S]*?)(\]\]>))/gm;
const domParserTokenizer =
/(?:<(\/?)([a-zA-Z][a-zA-Z0-9\:]*)(?:\s([^>]*?))?((?:\s*\/)?)>|(<\!\-\-)([\s\S]*?)(\-\->)|(<\!\[CDATA\[)([\s\S]*?)(\]\]>))/gm;

const splitAttrs = str => {
const splitAttrs = (str) => {
let res = {};
let token;
if (str) {
Expand Down Expand Up @@ -39,7 +40,7 @@ function optimizeSvg(
"convertStyleToAttrs",
{
name: "cleanupIDs",
params: { prefix: `${SPRITESHEET_NAMESPACE}:${name}` }
params: { prefix: `${SPRITESHEET_NAMESPACE}:${name}` },
},
"removeRasterImages",
"removeUselessDefs",
Expand Down Expand Up @@ -68,8 +69,8 @@ function optimizeSvg(
"removeDesc",
"removeDimensions",
"removeStyleElement",
"removeScriptElement"
]
"removeScriptElement",
],
}).data;
}

Expand Down Expand Up @@ -122,8 +123,8 @@ export const fallback = {
fill: "none",
viewBox: "0 0 24 24",
stroke: "currentColor",
"aria-hidden": "true"
}
"aria-hidden": "true",
},
};

export default async function load(
Expand All @@ -149,7 +150,7 @@ export default async function load(
`/src/icons/**/*.{js,ts,cjs,mjc,cts,mts}`
);
const keys = Object.fromEntries(
Object.keys(files).map(key => [key.replace(/\.[cm]?[jt]s$/, ""), key])
Object.keys(files).map((key) => [key.replace(/\.[cm]?[jt]s$/, ""), key])
);

if (!(filepath in keys)) {
Expand Down Expand Up @@ -190,8 +191,8 @@ ${contents}`
try {
const files = import.meta.globEager(`/src/icons/**/*.svg`, {
assert: {
type: "raw"
}
type: "raw",
},
});

if (!(filepath in files)) {
Expand Down Expand Up @@ -223,6 +224,6 @@ ${contents}`

return {
innerHTML,
props: { ...defaultProps, ...normalizeProps(inputProps) }
props: { ...defaultProps, ...normalizeProps(inputProps) },
};
}
2 changes: 1 addition & 1 deletion packages/service/api/v1/icon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import etag from "etag";

const packAliases = new Map([
["logo", "fa-brands"],
["radix", "radix-icons"]
["radix", "radix-icons"],
]);

const handler: VercelApiHandler = async (req, res) => {
Expand Down

2 comments on commit d2e7faf

@vercel
Copy link

@vercel vercel bot commented on d2e7faf Feb 17, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

api-astroicon – ./packages/service

api-astroicon-nmoo.vercel.app
api.astroicon.dev
api-astroicon-git-main-nmoo.vercel.app

@vercel
Copy link

@vercel vercel bot commented on d2e7faf Feb 17, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

astroicon – ./packages/www/

astroicon-nmoo.vercel.app
www.astroicon.dev
astroicon.dev
astro-icon-www.vercel.app
astroicon-git-main-nmoo.vercel.app

Please sign in to comment.