vite-plugin-svgr 4.3.0 → 4.5.0
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/dist/index.cjs +27 -8
- package/dist/index.js +10 -1
- package/package.json +5 -5
package/dist/index.cjs
CHANGED
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
36
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
37
|
};
|
|
@@ -30,6 +40,11 @@ exports.default = vitePluginSvgr;
|
|
|
30
40
|
const pluginutils_1 = require("@rollup/pluginutils");
|
|
31
41
|
const fs_1 = __importDefault(require("fs"));
|
|
32
42
|
const vite_1 = require("vite");
|
|
43
|
+
const viteModule = __importStar(require("vite"));
|
|
44
|
+
// @ts-ignore - check if transformWithOxc is available, i.e. rolldown-vite is installed and aliased
|
|
45
|
+
let useOxc = viteModule.transformWithOxc != null;
|
|
46
|
+
// @ts-ignore - assign transformer function
|
|
47
|
+
let transformWith = useOxc ? viteModule.transformWithOxc : vite_1.transformWithEsbuild;
|
|
33
48
|
function vitePluginSvgr({ svgrOptions, esbuildOptions, include = "**/*.svg?react", exclude, } = {}) {
|
|
34
49
|
const filter = (0, pluginutils_1.createFilter)(include, exclude);
|
|
35
50
|
const postfixRE = /[?#].*$/s;
|
|
@@ -48,7 +63,11 @@ function vitePluginSvgr({ svgrOptions, esbuildOptions, include = "**/*.svg?react
|
|
|
48
63
|
defaultPlugins: [jsx],
|
|
49
64
|
},
|
|
50
65
|
});
|
|
51
|
-
const res = await (
|
|
66
|
+
const res = await transformWith(componentCode, id, useOxc ? {
|
|
67
|
+
// @ts-ignore - "lang" is required for transformWithOxc
|
|
68
|
+
lang: "jsx",
|
|
69
|
+
...esbuildOptions,
|
|
70
|
+
} : {
|
|
52
71
|
loader: "jsx",
|
|
53
72
|
...esbuildOptions,
|
|
54
73
|
});
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import { createFilter } from "@rollup/pluginutils";
|
|
2
2
|
import fs from "fs";
|
|
3
3
|
import { transformWithEsbuild } from "vite";
|
|
4
|
+
import * as viteModule from "vite";
|
|
5
|
+
// @ts-ignore - check if transformWithOxc is available, i.e. rolldown-vite is installed and aliased
|
|
6
|
+
let useOxc = viteModule.transformWithOxc != null;
|
|
7
|
+
// @ts-ignore - assign transformer function
|
|
8
|
+
let transformWith = useOxc ? viteModule.transformWithOxc : transformWithEsbuild;
|
|
4
9
|
export default function vitePluginSvgr({ svgrOptions, esbuildOptions, include = "**/*.svg?react", exclude, } = {}) {
|
|
5
10
|
const filter = createFilter(include, exclude);
|
|
6
11
|
const postfixRE = /[?#].*$/s;
|
|
@@ -19,7 +24,11 @@ export default function vitePluginSvgr({ svgrOptions, esbuildOptions, include =
|
|
|
19
24
|
defaultPlugins: [jsx],
|
|
20
25
|
},
|
|
21
26
|
});
|
|
22
|
-
const res = await
|
|
27
|
+
const res = await transformWith(componentCode, id, useOxc ? {
|
|
28
|
+
// @ts-ignore - "lang" is required for transformWithOxc
|
|
29
|
+
lang: "jsx",
|
|
30
|
+
...esbuildOptions,
|
|
31
|
+
} : {
|
|
23
32
|
loader: "jsx",
|
|
24
33
|
...esbuildOptions,
|
|
25
34
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vite-plugin-svgr",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.5.0",
|
|
4
4
|
"description": "Vite plugin to transform SVGs into React components",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -33,16 +33,16 @@
|
|
|
33
33
|
"author": "Rongjian Zhang",
|
|
34
34
|
"license": "MIT",
|
|
35
35
|
"devDependencies": {
|
|
36
|
-
"@types/node": "^
|
|
37
|
-
"typescript": "^5.
|
|
36
|
+
"@types/node": "^24.3.0",
|
|
37
|
+
"typescript": "^5.9.2"
|
|
38
38
|
},
|
|
39
39
|
"peerDependencies": {
|
|
40
40
|
"vite": ">=2.6.0"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@rollup/pluginutils": "^5.
|
|
43
|
+
"@rollup/pluginutils": "^5.2.0",
|
|
44
44
|
"@svgr/core": "^8.1.0",
|
|
45
45
|
"@svgr/plugin-jsx": "^8.1.0"
|
|
46
46
|
},
|
|
47
|
-
"packageManager": "pnpm@
|
|
47
|
+
"packageManager": "pnpm@10.15.0+sha256.84c19e788d7d7ee248e4a6b7152f8ebba0f4fe7380a5f443ca17d76c030052d2"
|
|
48
48
|
}
|