vite-plugin-svgr 2.2.1 → 2.2.2

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.
package/client.d.ts CHANGED
@@ -1,9 +1,10 @@
1
1
  // https://github.com/facebook/create-react-app/blob/0ee4765c39f820e5f4820abf4bf2e47b3324da7f/packages/react-scripts/lib/react-app.d.ts#L47-L56
2
+ // https://github.com/pd4d10/vite-plugin-svgr/pull/56 for preact compatiblility
2
3
 
3
4
  declare module '*.svg' {
4
5
  import * as React from 'react'
5
6
 
6
7
  export const ReactComponent: React.FunctionComponent<
7
- React.SVGProps<SVGSVGElement> & { title?: string }
8
+ React.ComponentProps<'svg'> & { title?: string }
8
9
  >
9
10
  }
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
+ const pluginutils = require("@rollup/pluginutils");
2
3
  const fs = require("fs");
3
4
  const vite = require("vite");
4
- const pluginutils = require("@rollup/pluginutils");
5
5
  const _interopDefaultLegacy = (e) => e && typeof e === "object" && "default" in e ? e : { default: e };
6
6
  function _interopNamespace(e) {
7
7
  if (e && e.__esModule)
@@ -35,7 +35,10 @@ function viteSvgr({
35
35
  async transform(code, id) {
36
36
  if (filter(id)) {
37
37
  const { transform } = await Promise.resolve().then(() => /* @__PURE__ */ _interopNamespace(require("@svgr/core")));
38
- const svgCode = await fs__default.default.promises.readFile(id, "utf8");
38
+ const svgCode = await fs__default.default.promises.readFile(
39
+ id.replace(/\?.*$/, ""),
40
+ "utf8"
41
+ );
39
42
  const componentCode = await transform(svgCode, svgrOptions, {
40
43
  filePath: id,
41
44
  caller: {
package/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
+ import { createFilter } from "@rollup/pluginutils";
1
2
  import fs from "fs";
2
3
  import { transformWithEsbuild } from "vite";
3
- import { createFilter } from "@rollup/pluginutils";
4
4
  function viteSvgr({
5
5
  exportAsDefault,
6
6
  svgrOptions,
@@ -14,7 +14,10 @@ function viteSvgr({
14
14
  async transform(code, id) {
15
15
  if (filter(id)) {
16
16
  const { transform } = await import("@svgr/core");
17
- const svgCode = await fs.promises.readFile(id, "utf8");
17
+ const svgCode = await fs.promises.readFile(
18
+ id.replace(/\?.*$/, ""),
19
+ "utf8"
20
+ );
18
21
  const componentCode = await transform(svgCode, svgrOptions, {
19
22
  filePath: id,
20
23
  caller: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vite-plugin-svgr",
3
- "version": "2.2.1",
3
+ "version": "2.2.2",
4
4
  "description": "Vite plugin to transform SVGs into React components",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -29,16 +29,16 @@
29
29
  "author": "Rongjian Zhang",
30
30
  "license": "MIT",
31
31
  "devDependencies": {
32
- "@types/node": "^18.0.6",
33
- "tsdv": "^0.6.0",
34
- "typescript": "^4.7.4",
35
- "vite": "^3.0.2"
32
+ "@types/node": "^18.8.5",
33
+ "tsdv": "^0.7.0",
34
+ "typescript": "^4.8.4",
35
+ "vite": "^3.1.7"
36
36
  },
37
37
  "peerDependencies": {
38
38
  "vite": "^2.6.0 || 3"
39
39
  },
40
40
  "dependencies": {
41
- "@rollup/pluginutils": "^4.2.1",
42
- "@svgr/core": "^6.3.1"
41
+ "@rollup/pluginutils": "^5.0.0",
42
+ "@svgr/core": "^6.4.0"
43
43
  }
44
44
  }