vite-plugin-svg-sprite 0.3.0 → 0.3.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/es/index.d.ts CHANGED
File without changes
package/es/index.js CHANGED
@@ -23,7 +23,7 @@ export default (options) => {
23
23
  if (svgoOptions !== false) {
24
24
  const result = (optimize(code, svgoOptions === true ? undefined : svgoOptions));
25
25
  if (result.error != null) {
26
- throw result.error;
26
+ throw new Error(result.error);
27
27
  }
28
28
  code = result.data;
29
29
  }
@@ -42,11 +42,15 @@ export default (options) => {
42
42
  content: code,
43
43
  path: filepath,
44
44
  });
45
- return `
45
+ const codeToReturn = `
46
46
  import addSymbol from 'vite-plugin-svg-sprite/runtime';
47
47
  addSymbol(${stringify(symbol.render())}, ${stringify(id)});
48
48
  export default ${stringify(id)};
49
49
  `;
50
+ return {
51
+ code: codeToReturn,
52
+ map: { mappings: '' },
53
+ };
50
54
  },
51
55
  };
52
56
  return plugin;
package/es/runtime.d.ts CHANGED
File without changes
package/es/runtime.js CHANGED
File without changes
package/lib/index.d.ts CHANGED
File without changes
package/lib/index.js CHANGED
@@ -28,7 +28,7 @@ exports.default = (options) => {
28
28
  if (svgoOptions !== false) {
29
29
  const result = ((0, svgo_1.optimize)(code, svgoOptions === true ? undefined : svgoOptions));
30
30
  if (result.error != null) {
31
- throw result.error;
31
+ throw new Error(result.error);
32
32
  }
33
33
  code = result.data;
34
34
  }
@@ -47,11 +47,15 @@ exports.default = (options) => {
47
47
  content: code,
48
48
  path: filepath,
49
49
  });
50
- return `
50
+ const codeToReturn = `
51
51
  import addSymbol from 'vite-plugin-svg-sprite/runtime';
52
52
  addSymbol(${stringify(symbol.render())}, ${stringify(id)});
53
53
  export default ${stringify(id)};
54
54
  `;
55
+ return {
56
+ code: codeToReturn,
57
+ map: { mappings: '' },
58
+ };
55
59
  },
56
60
  };
57
61
  return plugin;
package/lib/runtime.d.ts CHANGED
File without changes
package/lib/runtime.js CHANGED
File without changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vite-plugin-svg-sprite",
3
- "version": "0.3.0",
3
+ "version": "0.3.2",
4
4
  "description": "SVG sprite plugin for Vite",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -42,7 +42,7 @@
42
42
  "eslint-config-airbnb-typescript": "^12.0.0",
43
43
  "eslint-plugin-import": "^2.22.1",
44
44
  "typescript": "^4.1.2",
45
- "vite": "^3.1.0"
45
+ "vite": "^4.0.0"
46
46
  },
47
47
  "dependencies": {
48
48
  "micromatch": "^4.0.2",
@@ -50,6 +50,6 @@
50
50
  "svgo": "^2.8.0"
51
51
  },
52
52
  "peerDependencies": {
53
- "vite": "^2 || ^3"
53
+ "vite": "^2 || ^3 || ^4"
54
54
  }
55
55
  }
package/src/index.ts CHANGED
@@ -35,7 +35,7 @@ export default (options?: SvgSpriteOptions) => {
35
35
  if (svgoOptions !== false) {
36
36
  const result = (optimize(code, svgoOptions === true ? undefined : svgoOptions));
37
37
  if (result.error != null) {
38
- throw result.error;
38
+ throw new Error(result.error);
39
39
  }
40
40
  code = result.data;
41
41
  }
@@ -60,11 +60,16 @@ export default (options?: SvgSpriteOptions) => {
60
60
  path: filepath,
61
61
  });
62
62
 
63
- return `
63
+ const codeToReturn = `
64
64
  import addSymbol from 'vite-plugin-svg-sprite/runtime';
65
65
  addSymbol(${stringify(symbol.render())}, ${stringify(id)});
66
66
  export default ${stringify(id)};
67
67
  `;
68
+
69
+ return {
70
+ code: codeToReturn,
71
+ map: { mappings: '' },
72
+ }
68
73
  },
69
74
  };
70
75