rspack-svg-sprite-loader-plugin 0.1.2 → 0.1.4

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 ADDED
@@ -0,0 +1,60 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ //#region \0rolldown/runtime.js
3
+ var __create = Object.create;
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getProtoOf = Object.getPrototypeOf;
8
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
12
+ key = keys[i];
13
+ if (!__hasOwnProp.call(to, key) && key !== except) {
14
+ __defProp(to, key, {
15
+ get: ((k) => from[k]).bind(null, key),
16
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
17
+ });
18
+ }
19
+ }
20
+ }
21
+ return to;
22
+ };
23
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
24
+ value: mod,
25
+ enumerable: true
26
+ }) : target, mod));
27
+
28
+ //#endregion
29
+ let node_path = require("node:path");
30
+ node_path = __toESM(node_path);
31
+
32
+ //#region src/index.ts
33
+ var SvgSpritePlugin = class {
34
+ options;
35
+ constructor(options = {}) {
36
+ this.options = {
37
+ symbolId: "icon-[name]",
38
+ test: /\.svg$/,
39
+ include: [],
40
+ exclude: [],
41
+ ...options
42
+ };
43
+ }
44
+ apply(compiler) {
45
+ const { symbolId, test, include, exclude } = this.options;
46
+ compiler.options.module.rules.push({
47
+ test,
48
+ include,
49
+ exclude,
50
+ use: [{
51
+ loader: node_path.default.resolve(__dirname, "loader.cjs"),
52
+ options: { symbolId }
53
+ }],
54
+ type: "javascript/auto"
55
+ });
56
+ }
57
+ };
58
+
59
+ //#endregion
60
+ exports.SvgSpritePlugin = SvgSpritePlugin;
@@ -0,0 +1,16 @@
1
+ import { Compiler, RuleSetRule } from "@rspack/core";
2
+
3
+ //#region src/index.d.ts
4
+ declare class SvgSpritePlugin {
5
+ options: {
6
+ symbolId: string;
7
+ test: RegExp;
8
+ include: RuleSetRule["include"];
9
+ exclude: RuleSetRule["exclude"];
10
+ };
11
+ constructor(options?: {});
12
+ apply(compiler: Compiler): void;
13
+ }
14
+ //#endregion
15
+ export { SvgSpritePlugin };
16
+ //# sourceMappingURL=index.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.ts"],"mappings":";;;cAGa,eAAA;EACX,OAAA;IACE,QAAA;IACA,IAAA,EAAM,MAAA;IACN,OAAA,EAAS,WAAA;IACT,OAAA,EAAS,WAAA;EAAA;cAGC,OAAA;EAUZ,KAAA,CAAM,QAAA,EAAU,QAAA;AAAA"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "rspack-svg-sprite-loader-plugin",
3
3
  "description": "SVG Sprite Plugin for Rspack",
4
- "version": "0.1.2",
4
+ "version": "0.1.4",
5
5
  "private": false,
6
6
  "type": "module",
7
7
  "author": "peakercope <peakercope@gmail.com> (https://github.com/peakercope)",
@@ -22,10 +22,12 @@
22
22
  "README.md",
23
23
  "CHANGELOG.md"
24
24
  ],
25
- "types": "dist/index.d.ts",
25
+ "main": "./dist/index.mjs",
26
+ "types": "./dist/index.d.mts",
26
27
  "exports": {
27
28
  ".": {
28
29
  "import": "./dist/index.mjs",
30
+ "require": "./dist/index.cjs",
29
31
  "types": "./dist/index.d.mts"
30
32
  }
31
33
  },