@brybrant/vite-config 0.0.1 → 0.0.3

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.
@@ -12,14 +12,10 @@ import terserConfig from "@brybrant/terser-config";
12
12
  const svgoPlugin = {
13
13
  name: "@brybrant/vite-plugin-svgo",
14
14
  enforce: "pre",
15
- async load(id) {
16
- const [path, qs] = id.split("?");
15
+ async load(path) {
17
16
  if (!path.endsWith(".svg")) return null;
18
- const convertToJSX = new URLSearchParams(qs).has("jsx");
19
- return readFile(id, "utf8").then((svg) => {
17
+ return readFile(path, "utf8").then((svg) => {
20
18
  const { data } = optimize(svg, Object.assign({}, svgoConfig, { path }));
21
- /** Borrowed from `vite-plugin-solid-svg` */
22
- if (convertToJSX) return `export default (props = {}) => ${data.replace(/([{}])/g, "{\"$1\"}").replace(/<!--\s*([\s\S]*?)\s*-->/g, "{/* $1 */}").replace(/(<svg[^>]*)>/i, "$1{...props}>")}`;
23
19
  return `export default \`${data}\`;`;
24
20
  });
25
21
  }
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@brybrant/vite-config",
3
3
  "author": "brybrant",
4
4
  "license": "GPL-3.0-only",
5
- "version": "0.0.1",
5
+ "version": "0.0.3",
6
6
  "type": "module",
7
7
  "module": "./dist/vite.config.js",
8
8
  "types": "./dist/vite.config.d.ts",