@fangzhongya/icons 0.0.16 → 0.0.17
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/async.cjs +20 -20
- package/dist/async.d.cts +16 -16
- package/dist/async.d.ts +16 -16
- package/dist/async.js +20 -20
- package/dist/{chunk-RDKCKIKJ.js → chunk-CDXRU53D.js} +1 -1
- package/dist/{chunk-5NH4G6UJ.cjs → chunk-P3DB3N7Y.cjs} +1 -1
- package/dist/index.cjs +24 -24
- package/dist/index.js +27 -27
- package/dist/index.json +1 -1
- package/dist/json.cjs +2 -2
- package/dist/json.d.cts +1 -1
- package/dist/json.d.ts +1 -1
- package/dist/json.js +1 -1
- package/dist/vite/index.cjs +109 -106
- package/dist/vite/index.d.cts +3 -1
- package/dist/vite/index.d.ts +3 -1
- package/dist/vite/index.js +107 -104
- package/dist/vite/index2.cjs +3 -3
- package/dist/vite/index2.js +1 -1
- package/dist/vue/index.cjs +23 -23
- package/dist/vue/index.js +27 -27
- package/package.json +1 -1
- package/dist/{chunk-SRJ74PQ7.js → chunk-54HT4HDM.js} +26 -26
- package/dist/{chunk-5ATJRRFS.cjs → chunk-KXZN54UH.cjs} +22 -22
package/dist/vite/index.cjs
CHANGED
|
@@ -8,7 +8,7 @@ var _chunkOSHAEKZLcjs = require('../chunk-OSHAEKZL.cjs');
|
|
|
8
8
|
require('../chunk-IIVF4KK5.cjs');
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
var
|
|
11
|
+
var _chunkP3DB3N7Ycjs = require('../chunk-P3DB3N7Y.cjs');
|
|
12
12
|
require('../chunk-75ZPJI57.cjs');
|
|
13
13
|
|
|
14
14
|
// packages/vite/index.ts
|
|
@@ -20,12 +20,12 @@ function simpleFangIcon(options = {}) {
|
|
|
20
20
|
type = "svg",
|
|
21
21
|
directory = "./svg",
|
|
22
22
|
dynamic = true,
|
|
23
|
+
virtual = false,
|
|
24
|
+
replaced = true,
|
|
23
25
|
customReplacement
|
|
24
26
|
} = options;
|
|
25
|
-
const resolvedVirtualModuleId = "\0" + virtualModuleId;
|
|
26
27
|
if (type === "pub" && options.mobile) {
|
|
27
28
|
const outDir = _path.join.call(void 0, "./public/", directory);
|
|
28
|
-
console.log("outDir", outDir);
|
|
29
29
|
_chunkV6F7B2R3cjs.runDev.call(void 0, {
|
|
30
30
|
issort: true,
|
|
31
31
|
dir: "./node_modules/@fangzhongya/icons/dist/svg",
|
|
@@ -36,112 +36,115 @@ function simpleFangIcon(options = {}) {
|
|
|
36
36
|
isNeader: false
|
|
37
37
|
});
|
|
38
38
|
}
|
|
39
|
-
const
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
const
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
},
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
39
|
+
const plugin = {
|
|
40
|
+
name: "simple-fang-icon"
|
|
41
|
+
};
|
|
42
|
+
if (virtual) {
|
|
43
|
+
const resolvedVirtualModuleId = "\0" + virtualModuleId;
|
|
44
|
+
const pub = `
|
|
45
|
+
import { defineComponent, h,} from 'vue'
|
|
46
|
+
import FangIcon from '@fangzhongya/icons/icon/index'
|
|
47
|
+
const component = defineComponent({
|
|
48
|
+
name: '${name}',
|
|
49
|
+
props: {
|
|
50
|
+
name: {
|
|
51
|
+
type: [String, Object],
|
|
52
|
+
},
|
|
53
|
+
default: {
|
|
54
|
+
type: String,
|
|
55
|
+
default: '${type}'
|
|
56
|
+
},
|
|
57
|
+
directory: {
|
|
58
|
+
type: String,
|
|
59
|
+
default: '${directory}'
|
|
60
|
+
}
|
|
52
61
|
},
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
62
|
+
setup(props, { attrs }) {
|
|
63
|
+
return () => {
|
|
64
|
+
return h(FangIcon, {
|
|
65
|
+
...attrs,
|
|
66
|
+
name: props.name,
|
|
67
|
+
default: props.default,
|
|
68
|
+
directory: props.directory
|
|
69
|
+
});
|
|
70
|
+
};
|
|
56
71
|
}
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
type: {
|
|
86
|
-
type: String,
|
|
87
|
-
},
|
|
88
|
-
default: {
|
|
89
|
-
type: String,
|
|
90
|
-
default: '${type}'
|
|
72
|
+
});
|
|
73
|
+
// \u5BFC\u51FA\u5B89\u88C5\u51FD\u6570
|
|
74
|
+
export const install = (app) => {
|
|
75
|
+
app.component('${name}', component)
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
export default component;`;
|
|
79
|
+
const svg = `
|
|
80
|
+
import { defineComponent, h, computed} from 'vue'
|
|
81
|
+
import FangIcon from '@fangzhongya/icons/icon/index'
|
|
82
|
+
import icons from '@fangzhongya/icons/async'
|
|
83
|
+
const component = defineComponent({
|
|
84
|
+
name: '${name}',
|
|
85
|
+
props: {
|
|
86
|
+
name: {
|
|
87
|
+
type: [String, Object],
|
|
88
|
+
},
|
|
89
|
+
type: {
|
|
90
|
+
type: String,
|
|
91
|
+
},
|
|
92
|
+
default: {
|
|
93
|
+
type: String,
|
|
94
|
+
default: '${type}'
|
|
95
|
+
},
|
|
96
|
+
directory: {
|
|
97
|
+
type: String,
|
|
98
|
+
default: '${directory}'
|
|
99
|
+
}
|
|
91
100
|
},
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
(!props.type && props.default === 'svg'))) {
|
|
102
|
-
const icon = icons[name];
|
|
103
|
-
if(icon){
|
|
104
|
-
return icon;
|
|
101
|
+
setup(props, { attrs }) {
|
|
102
|
+
const iconName = computed(() => {
|
|
103
|
+
const name = props.name;
|
|
104
|
+
if (typeof name === 'string' && (props.type === 'svg' ||
|
|
105
|
+
(!props.type && props.default === 'svg'))) {
|
|
106
|
+
const icon = icons[name];
|
|
107
|
+
if(icon){
|
|
108
|
+
return icon;
|
|
109
|
+
}
|
|
105
110
|
}
|
|
106
|
-
|
|
107
|
-
return name;
|
|
108
|
-
});
|
|
109
|
-
return () => {
|
|
110
|
-
return h(FangIcon, {
|
|
111
|
-
...attrs,
|
|
112
|
-
name: iconName.value,
|
|
113
|
-
type: props.type,
|
|
114
|
-
default: props.default,
|
|
115
|
-
directory: props.directory
|
|
111
|
+
return name;
|
|
116
112
|
});
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
113
|
+
return () => {
|
|
114
|
+
return h(FangIcon, {
|
|
115
|
+
...attrs,
|
|
116
|
+
name: iconName.value,
|
|
117
|
+
type: props.type,
|
|
118
|
+
default: props.default,
|
|
119
|
+
directory: props.directory
|
|
120
|
+
});
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
});
|
|
124
|
+
// \u5BFC\u51FA\u5B89\u88C5\u51FD\u6570
|
|
125
|
+
export const install = (app) => {
|
|
126
|
+
app.component('${name}', component)
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
export default component;`;
|
|
130
|
+
const text = type === "svg" ? svg : pub;
|
|
131
|
+
plugin.resolveId = function(id) {
|
|
130
132
|
if (id === virtualModuleId) {
|
|
131
133
|
return resolvedVirtualModuleId;
|
|
132
134
|
}
|
|
133
135
|
return void 0;
|
|
134
|
-
}
|
|
135
|
-
load(id) {
|
|
136
|
+
};
|
|
137
|
+
plugin.load = function(id) {
|
|
136
138
|
if (id === resolvedVirtualModuleId) {
|
|
137
139
|
return text;
|
|
138
140
|
}
|
|
139
141
|
return null;
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
if (replaced) {
|
|
145
|
+
const targetComponents = Array.isArray(name) ? name : [name];
|
|
146
|
+
plugin.enforce = "pre";
|
|
147
|
+
plugin.transform = function(code, id) {
|
|
145
148
|
if (!shouldProcess(id)) {
|
|
146
149
|
return null;
|
|
147
150
|
}
|
|
@@ -156,15 +159,15 @@ export default component;`;
|
|
|
156
159
|
for (let i = components.length - 1; i >= 0; i--) {
|
|
157
160
|
const component = components[i];
|
|
158
161
|
if (component) {
|
|
159
|
-
const { text
|
|
162
|
+
const { text, imptext } = replaceComponent(
|
|
160
163
|
component,
|
|
161
164
|
type,
|
|
162
165
|
dynamic,
|
|
163
166
|
customReplacement
|
|
164
167
|
);
|
|
165
168
|
imports.add(imptext);
|
|
166
|
-
if (
|
|
167
|
-
transformedCode = transformedCode.slice(0, component.start) +
|
|
169
|
+
if (text !== component.fullMatch) {
|
|
170
|
+
transformedCode = transformedCode.slice(0, component.start) + text + transformedCode.slice(component.end);
|
|
168
171
|
replacedCount++;
|
|
169
172
|
}
|
|
170
173
|
}
|
|
@@ -185,9 +188,8 @@ export default component;`;
|
|
|
185
188
|
console.error(`\u5904\u7406\u6587\u4EF6 ${id} \u65F6\u51FA\u9519:`, error);
|
|
186
189
|
}
|
|
187
190
|
return null;
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
handleHotUpdate({
|
|
191
|
+
};
|
|
192
|
+
plugin.handleHotUpdate = function({
|
|
191
193
|
file,
|
|
192
194
|
server
|
|
193
195
|
}) {
|
|
@@ -197,8 +199,9 @@ export default component;`;
|
|
|
197
199
|
});
|
|
198
200
|
return [];
|
|
199
201
|
}
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
return plugin;
|
|
202
205
|
}
|
|
203
206
|
function parseAttributes(attrString) {
|
|
204
207
|
const attributes = { name: "" };
|
|
@@ -287,7 +290,7 @@ function findComponents(code, name) {
|
|
|
287
290
|
return components;
|
|
288
291
|
}
|
|
289
292
|
function getText(iconName, match) {
|
|
290
|
-
const svg = _chunkOSHAEKZLcjs.getIconifySVG.call(void 0,
|
|
293
|
+
const svg = _chunkOSHAEKZLcjs.getIconifySVG.call(void 0, _chunkP3DB3N7Ycjs.json_default, iconName, 'v-bind="scope"');
|
|
291
294
|
const s = match.fullMatch.replace(`name="${iconName}"`, "").replace(`name='${iconName}'`, "").replace(`</${match.componentName}>`, "");
|
|
292
295
|
const text = `${s}<template #default="scope">${svg}</template></${match.componentName}>`;
|
|
293
296
|
return { text, imptext: "" };
|
|
@@ -310,7 +313,7 @@ function replaceComponent(match, type, dynamic, customReplacement) {
|
|
|
310
313
|
if (customReplacement) {
|
|
311
314
|
return customReplacement(iconName, attributes);
|
|
312
315
|
}
|
|
313
|
-
let svgContent =
|
|
316
|
+
let svgContent = _chunkP3DB3N7Ycjs.json_default.icons[iconName];
|
|
314
317
|
if (!svgContent) {
|
|
315
318
|
return { text: match.fullMatch, imptext: "" };
|
|
316
319
|
}
|
package/dist/vite/index.d.cts
CHANGED
|
@@ -7,8 +7,10 @@ type IconReplacement = (iconName: string, attributes: ComponentAttributes) => {
|
|
|
7
7
|
interface PluginOptions {
|
|
8
8
|
name?: string;
|
|
9
9
|
type?: string;
|
|
10
|
-
customReplacement?: IconReplacement;
|
|
11
10
|
directory?: string;
|
|
11
|
+
customReplacement?: IconReplacement;
|
|
12
|
+
virtual?: boolean;
|
|
13
|
+
replaced?: boolean;
|
|
12
14
|
mobile?: boolean;
|
|
13
15
|
dynamic?: boolean;
|
|
14
16
|
}
|
package/dist/vite/index.d.ts
CHANGED
|
@@ -7,8 +7,10 @@ type IconReplacement = (iconName: string, attributes: ComponentAttributes) => {
|
|
|
7
7
|
interface PluginOptions {
|
|
8
8
|
name?: string;
|
|
9
9
|
type?: string;
|
|
10
|
-
customReplacement?: IconReplacement;
|
|
11
10
|
directory?: string;
|
|
11
|
+
customReplacement?: IconReplacement;
|
|
12
|
+
virtual?: boolean;
|
|
13
|
+
replaced?: boolean;
|
|
12
14
|
mobile?: boolean;
|
|
13
15
|
dynamic?: boolean;
|
|
14
16
|
}
|
package/dist/vite/index.js
CHANGED
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
import "../chunk-MOHILOKE.js";
|
|
9
9
|
import {
|
|
10
10
|
json_default
|
|
11
|
-
} from "../chunk-
|
|
11
|
+
} from "../chunk-CDXRU53D.js";
|
|
12
12
|
import "../chunk-MLKGABMK.js";
|
|
13
13
|
|
|
14
14
|
// packages/vite/index.ts
|
|
@@ -20,12 +20,12 @@ function simpleFangIcon(options = {}) {
|
|
|
20
20
|
type = "svg",
|
|
21
21
|
directory = "./svg",
|
|
22
22
|
dynamic = true,
|
|
23
|
+
virtual = false,
|
|
24
|
+
replaced = true,
|
|
23
25
|
customReplacement
|
|
24
26
|
} = options;
|
|
25
|
-
const resolvedVirtualModuleId = "\0" + virtualModuleId;
|
|
26
27
|
if (type === "pub" && options.mobile) {
|
|
27
28
|
const outDir = join("./public/", directory);
|
|
28
|
-
console.log("outDir", outDir);
|
|
29
29
|
runDev({
|
|
30
30
|
issort: true,
|
|
31
31
|
dir: "./node_modules/@fangzhongya/icons/dist/svg",
|
|
@@ -36,112 +36,115 @@ function simpleFangIcon(options = {}) {
|
|
|
36
36
|
isNeader: false
|
|
37
37
|
});
|
|
38
38
|
}
|
|
39
|
-
const
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
const
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
},
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
39
|
+
const plugin = {
|
|
40
|
+
name: "simple-fang-icon"
|
|
41
|
+
};
|
|
42
|
+
if (virtual) {
|
|
43
|
+
const resolvedVirtualModuleId = "\0" + virtualModuleId;
|
|
44
|
+
const pub = `
|
|
45
|
+
import { defineComponent, h,} from 'vue'
|
|
46
|
+
import FangIcon from '@fangzhongya/icons/icon/index'
|
|
47
|
+
const component = defineComponent({
|
|
48
|
+
name: '${name}',
|
|
49
|
+
props: {
|
|
50
|
+
name: {
|
|
51
|
+
type: [String, Object],
|
|
52
|
+
},
|
|
53
|
+
default: {
|
|
54
|
+
type: String,
|
|
55
|
+
default: '${type}'
|
|
56
|
+
},
|
|
57
|
+
directory: {
|
|
58
|
+
type: String,
|
|
59
|
+
default: '${directory}'
|
|
60
|
+
}
|
|
52
61
|
},
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
62
|
+
setup(props, { attrs }) {
|
|
63
|
+
return () => {
|
|
64
|
+
return h(FangIcon, {
|
|
65
|
+
...attrs,
|
|
66
|
+
name: props.name,
|
|
67
|
+
default: props.default,
|
|
68
|
+
directory: props.directory
|
|
69
|
+
});
|
|
70
|
+
};
|
|
56
71
|
}
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
type: {
|
|
86
|
-
type: String,
|
|
87
|
-
},
|
|
88
|
-
default: {
|
|
89
|
-
type: String,
|
|
90
|
-
default: '${type}'
|
|
72
|
+
});
|
|
73
|
+
// \u5BFC\u51FA\u5B89\u88C5\u51FD\u6570
|
|
74
|
+
export const install = (app) => {
|
|
75
|
+
app.component('${name}', component)
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
export default component;`;
|
|
79
|
+
const svg = `
|
|
80
|
+
import { defineComponent, h, computed} from 'vue'
|
|
81
|
+
import FangIcon from '@fangzhongya/icons/icon/index'
|
|
82
|
+
import icons from '@fangzhongya/icons/async'
|
|
83
|
+
const component = defineComponent({
|
|
84
|
+
name: '${name}',
|
|
85
|
+
props: {
|
|
86
|
+
name: {
|
|
87
|
+
type: [String, Object],
|
|
88
|
+
},
|
|
89
|
+
type: {
|
|
90
|
+
type: String,
|
|
91
|
+
},
|
|
92
|
+
default: {
|
|
93
|
+
type: String,
|
|
94
|
+
default: '${type}'
|
|
95
|
+
},
|
|
96
|
+
directory: {
|
|
97
|
+
type: String,
|
|
98
|
+
default: '${directory}'
|
|
99
|
+
}
|
|
91
100
|
},
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
(!props.type && props.default === 'svg'))) {
|
|
102
|
-
const icon = icons[name];
|
|
103
|
-
if(icon){
|
|
104
|
-
return icon;
|
|
101
|
+
setup(props, { attrs }) {
|
|
102
|
+
const iconName = computed(() => {
|
|
103
|
+
const name = props.name;
|
|
104
|
+
if (typeof name === 'string' && (props.type === 'svg' ||
|
|
105
|
+
(!props.type && props.default === 'svg'))) {
|
|
106
|
+
const icon = icons[name];
|
|
107
|
+
if(icon){
|
|
108
|
+
return icon;
|
|
109
|
+
}
|
|
105
110
|
}
|
|
106
|
-
|
|
107
|
-
return name;
|
|
108
|
-
});
|
|
109
|
-
return () => {
|
|
110
|
-
return h(FangIcon, {
|
|
111
|
-
...attrs,
|
|
112
|
-
name: iconName.value,
|
|
113
|
-
type: props.type,
|
|
114
|
-
default: props.default,
|
|
115
|
-
directory: props.directory
|
|
111
|
+
return name;
|
|
116
112
|
});
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
113
|
+
return () => {
|
|
114
|
+
return h(FangIcon, {
|
|
115
|
+
...attrs,
|
|
116
|
+
name: iconName.value,
|
|
117
|
+
type: props.type,
|
|
118
|
+
default: props.default,
|
|
119
|
+
directory: props.directory
|
|
120
|
+
});
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
});
|
|
124
|
+
// \u5BFC\u51FA\u5B89\u88C5\u51FD\u6570
|
|
125
|
+
export const install = (app) => {
|
|
126
|
+
app.component('${name}', component)
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
export default component;`;
|
|
130
|
+
const text = type === "svg" ? svg : pub;
|
|
131
|
+
plugin.resolveId = function(id) {
|
|
130
132
|
if (id === virtualModuleId) {
|
|
131
133
|
return resolvedVirtualModuleId;
|
|
132
134
|
}
|
|
133
135
|
return void 0;
|
|
134
|
-
}
|
|
135
|
-
load(id) {
|
|
136
|
+
};
|
|
137
|
+
plugin.load = function(id) {
|
|
136
138
|
if (id === resolvedVirtualModuleId) {
|
|
137
139
|
return text;
|
|
138
140
|
}
|
|
139
141
|
return null;
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
if (replaced) {
|
|
145
|
+
const targetComponents = Array.isArray(name) ? name : [name];
|
|
146
|
+
plugin.enforce = "pre";
|
|
147
|
+
plugin.transform = function(code, id) {
|
|
145
148
|
if (!shouldProcess(id)) {
|
|
146
149
|
return null;
|
|
147
150
|
}
|
|
@@ -156,15 +159,15 @@ export default component;`;
|
|
|
156
159
|
for (let i = components.length - 1; i >= 0; i--) {
|
|
157
160
|
const component = components[i];
|
|
158
161
|
if (component) {
|
|
159
|
-
const { text
|
|
162
|
+
const { text, imptext } = replaceComponent(
|
|
160
163
|
component,
|
|
161
164
|
type,
|
|
162
165
|
dynamic,
|
|
163
166
|
customReplacement
|
|
164
167
|
);
|
|
165
168
|
imports.add(imptext);
|
|
166
|
-
if (
|
|
167
|
-
transformedCode = transformedCode.slice(0, component.start) +
|
|
169
|
+
if (text !== component.fullMatch) {
|
|
170
|
+
transformedCode = transformedCode.slice(0, component.start) + text + transformedCode.slice(component.end);
|
|
168
171
|
replacedCount++;
|
|
169
172
|
}
|
|
170
173
|
}
|
|
@@ -185,9 +188,8 @@ export default component;`;
|
|
|
185
188
|
console.error(`\u5904\u7406\u6587\u4EF6 ${id} \u65F6\u51FA\u9519:`, error);
|
|
186
189
|
}
|
|
187
190
|
return null;
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
handleHotUpdate({
|
|
191
|
+
};
|
|
192
|
+
plugin.handleHotUpdate = function({
|
|
191
193
|
file,
|
|
192
194
|
server
|
|
193
195
|
}) {
|
|
@@ -197,8 +199,9 @@ export default component;`;
|
|
|
197
199
|
});
|
|
198
200
|
return [];
|
|
199
201
|
}
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
return plugin;
|
|
202
205
|
}
|
|
203
206
|
function parseAttributes(attrString) {
|
|
204
207
|
const attributes = { name: "" };
|
package/dist/vite/index2.cjs
CHANGED
|
@@ -5,7 +5,7 @@ var _chunkOSHAEKZLcjs = require('../chunk-OSHAEKZL.cjs');
|
|
|
5
5
|
require('../chunk-IIVF4KK5.cjs');
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
var
|
|
8
|
+
var _chunkP3DB3N7Ycjs = require('../chunk-P3DB3N7Y.cjs');
|
|
9
9
|
require('../chunk-75ZPJI57.cjs');
|
|
10
10
|
|
|
11
11
|
// packages/vite/index2.ts
|
|
@@ -96,7 +96,7 @@ function findComponents(code, name) {
|
|
|
96
96
|
return components;
|
|
97
97
|
}
|
|
98
98
|
function getText(iconName, match) {
|
|
99
|
-
const svg = _chunkOSHAEKZLcjs.getIconifySVG.call(void 0,
|
|
99
|
+
const svg = _chunkOSHAEKZLcjs.getIconifySVG.call(void 0, _chunkP3DB3N7Ycjs.json_default, iconName, 'v-bind="scope"');
|
|
100
100
|
const s = match.fullMatch.replace(`name="${iconName}"`, "").replace(`name='${iconName}'`, "").replace(`</${match.componentName}>`, "");
|
|
101
101
|
const text = `${s}<template #default="scope">${svg}</template></${match.componentName}>`;
|
|
102
102
|
return { text, imptext: "" };
|
|
@@ -119,7 +119,7 @@ function replaceComponent(match, type, dynamic, customReplacement) {
|
|
|
119
119
|
if (customReplacement) {
|
|
120
120
|
return customReplacement(iconName, attributes);
|
|
121
121
|
}
|
|
122
|
-
let svgContent =
|
|
122
|
+
let svgContent = _chunkP3DB3N7Ycjs.json_default.icons[iconName];
|
|
123
123
|
if (!svgContent) {
|
|
124
124
|
return { text: match.fullMatch, imptext: "" };
|
|
125
125
|
}
|