vite-plugin-svg-sprite 0.6.3 → 0.7.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/cjs/index.d.ts CHANGED
@@ -4,19 +4,9 @@ declare const exportTypes: readonly ["vanilla", "react", "vue"];
4
4
  export interface DefaultExportType {
5
5
  exportType?: (typeof exportTypes)[number];
6
6
  }
7
- interface AdapterOptions {
8
- id: string;
9
- name: string;
10
- symbolXml: string;
11
- attributes: {
12
- width?: string | null;
13
- height?: string | null;
14
- viewBox?: string | null;
15
- };
16
- }
17
7
  export interface CustomExportType {
18
8
  exportType: 'custom';
19
- adapter: (options: AdapterOptions) => unknown;
9
+ adapter: string;
20
10
  }
21
11
  type ExportType = DefaultExportType | CustomExportType;
22
12
  export type { SvgoOptimizeOptions };
package/cjs/index.js CHANGED
@@ -28,9 +28,10 @@ function prepareTemplate(props) {
28
28
  const symbolXml = ${stringify(options.symbolXml)};
29
29
  const { dispose } = addSymbol(symbolXml, id);
30
30
 
31
- export default ${props.adapter};
32
31
  export const attributes = ${stringify(options.attributes)}
33
32
 
33
+ export default ${props.adapter};
34
+
34
35
  if (import.meta.hot) {
35
36
  import.meta.hot.dispose(dispose);
36
37
  import.meta.hot.accept();
@@ -43,7 +44,7 @@ function getModuleTemplate(type = {}) {
43
44
  if (!type.adapter) {
44
45
  throw new Error('Export type is set to "custom", but adapter is not provided. Please add "adapter" option in config.');
45
46
  }
46
- return prepareTemplate({ adapter: type.adapter.toString() });
47
+ return prepareTemplate({ adapter: type.adapter });
47
48
  }
48
49
  const { exportType = 'vanilla' } = type;
49
50
  if (!exportTypes.includes(exportType)) {
package/esm/index.d.ts CHANGED
@@ -4,19 +4,9 @@ declare const exportTypes: readonly ["vanilla", "react", "vue"];
4
4
  export interface DefaultExportType {
5
5
  exportType?: (typeof exportTypes)[number];
6
6
  }
7
- interface AdapterOptions {
8
- id: string;
9
- name: string;
10
- symbolXml: string;
11
- attributes: {
12
- width?: string | null;
13
- height?: string | null;
14
- viewBox?: string | null;
15
- };
16
- }
17
7
  export interface CustomExportType {
18
8
  exportType: 'custom';
19
- adapter: (options: AdapterOptions) => unknown;
9
+ adapter: string;
20
10
  }
21
11
  type ExportType = DefaultExportType | CustomExportType;
22
12
  export type { SvgoOptimizeOptions };
package/esm/index.js CHANGED
@@ -23,9 +23,10 @@ function prepareTemplate(props) {
23
23
  const symbolXml = ${stringify(options.symbolXml)};
24
24
  const { dispose } = addSymbol(symbolXml, id);
25
25
 
26
- export default ${props.adapter};
27
26
  export const attributes = ${stringify(options.attributes)}
28
27
 
28
+ export default ${props.adapter};
29
+
29
30
  if (import.meta.hot) {
30
31
  import.meta.hot.dispose(dispose);
31
32
  import.meta.hot.accept();
@@ -38,7 +39,7 @@ function getModuleTemplate(type = {}) {
38
39
  if (!type.adapter) {
39
40
  throw new Error('Export type is set to "custom", but adapter is not provided. Please add "adapter" option in config.');
40
41
  }
41
- return prepareTemplate({ adapter: type.adapter.toString() });
42
+ return prepareTemplate({ adapter: type.adapter });
42
43
  }
43
44
  const { exportType = 'vanilla' } = type;
44
45
  if (!exportTypes.includes(exportType)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vite-plugin-svg-sprite",
3
- "version": "0.6.3",
3
+ "version": "0.7.0",
4
4
  "description": "SVG sprite plugin for Vite",
5
5
  "type": "module",
6
6
  "exports": {