@vtj/local 0.8.21 → 0.8.23
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/plugin.d.ts +2 -0
- package/dist/plugin.mjs +17 -2
- package/dist/repository/plugins.d.ts +1 -0
- package/dist/repository/plugins.mjs +14 -4
- package/package.json +4 -4
package/dist/plugin.d.ts
CHANGED
package/dist/plugin.mjs
CHANGED
|
@@ -142,7 +142,7 @@ const aliasPlugin = function(options) {
|
|
|
142
142
|
export function parsePresetPlugins(options) {
|
|
143
143
|
const {
|
|
144
144
|
presetPlugins = [],
|
|
145
|
-
|
|
145
|
+
pluginNodeModulesDir = "node_modules",
|
|
146
146
|
staticBase
|
|
147
147
|
} = options;
|
|
148
148
|
const pkg = readJsonSync(resolve("./package.json"));
|
|
@@ -153,7 +153,7 @@ export function parsePresetPlugins(options) {
|
|
|
153
153
|
const copies = [];
|
|
154
154
|
const staticDirs = [];
|
|
155
155
|
for (const dep of deps) {
|
|
156
|
-
const dist = join(
|
|
156
|
+
const dist = join(pluginNodeModulesDir, dep, "dist");
|
|
157
157
|
if (pathExistsSync(dist)) {
|
|
158
158
|
copies.push({
|
|
159
159
|
from: dist,
|
|
@@ -187,6 +187,8 @@ export function createDevTools(options = {}) {
|
|
|
187
187
|
packageName: "@vtj/pro",
|
|
188
188
|
nodeModulesDir: "node_modules",
|
|
189
189
|
presetPlugins: [/^\@newpearl\/plugin\-/gi, /^\@vtj\/plugin\-/gi],
|
|
190
|
+
pluginNodeModulesDir: "node_modules",
|
|
191
|
+
extensionDir: "",
|
|
190
192
|
hm: "42f2469b4aa27c3f8978f634c0c19d24",
|
|
191
193
|
...options
|
|
192
194
|
};
|
|
@@ -213,6 +215,13 @@ export function createDevTools(options = {}) {
|
|
|
213
215
|
"\n @vtj/materials is not installed, please install it first.\n"
|
|
214
216
|
);
|
|
215
217
|
}
|
|
218
|
+
if (opts.extensionDir && pathExistsSync(opts.extensionDir)) {
|
|
219
|
+
copyOptions.push({
|
|
220
|
+
from: opts.extensionDir,
|
|
221
|
+
to: "@vtj/extension",
|
|
222
|
+
emptyDir: true
|
|
223
|
+
});
|
|
224
|
+
}
|
|
216
225
|
if (copyOptions.length > 0) {
|
|
217
226
|
plugins.push(copyPlugin(copyOptions));
|
|
218
227
|
}
|
|
@@ -241,6 +250,12 @@ export function createDevTools(options = {}) {
|
|
|
241
250
|
"\n @vtj/materials is not installed, please install it first.\n"
|
|
242
251
|
);
|
|
243
252
|
}
|
|
253
|
+
if (opts.extensionDir && pathExistsSync(opts.extensionDir)) {
|
|
254
|
+
staticOptions.push({
|
|
255
|
+
path: `${opts.staticBase}@vtj/extension`,
|
|
256
|
+
dir: opts.extensionDir
|
|
257
|
+
});
|
|
258
|
+
}
|
|
244
259
|
if (staticOptions.length > 0) {
|
|
245
260
|
plugins.push(staticPlugin(staticOptions));
|
|
246
261
|
}
|
|
@@ -16,9 +16,17 @@ export class PluginRepository {
|
|
|
16
16
|
);
|
|
17
17
|
}
|
|
18
18
|
deps = [];
|
|
19
|
+
getName(dep) {
|
|
20
|
+
const { presetPlugins } = this.opts;
|
|
21
|
+
let name = dep;
|
|
22
|
+
for (const regex of presetPlugins) {
|
|
23
|
+
name = name.replace(regex, "v-");
|
|
24
|
+
}
|
|
25
|
+
return upperFirstCamelCase(dep);
|
|
26
|
+
}
|
|
19
27
|
getPlugins() {
|
|
20
28
|
const { vtj = {} } = this.pkg;
|
|
21
|
-
const {
|
|
29
|
+
const { pluginNodeModulesDir = "node_modules", staticBase = "/" } = this.opts;
|
|
22
30
|
const plugins = (vtj.plugins || []).map((n) => {
|
|
23
31
|
n.type = "block";
|
|
24
32
|
n.fromType = "Plugin";
|
|
@@ -27,9 +35,11 @@ export class PluginRepository {
|
|
|
27
35
|
});
|
|
28
36
|
const ext = [".css", ".js", ".json"];
|
|
29
37
|
for (const dep of this.deps) {
|
|
30
|
-
const dist = join(
|
|
38
|
+
const dist = join(pluginNodeModulesDir, dep, "dist");
|
|
31
39
|
if (pathExistsSync(dist)) {
|
|
32
|
-
const pkg = readJsonSync(
|
|
40
|
+
const pkg = readJsonSync(
|
|
41
|
+
join(pluginNodeModulesDir, dep, "package.json")
|
|
42
|
+
);
|
|
33
43
|
const files = readdirSync(dist, { recursive: true, encoding: "utf-8" });
|
|
34
44
|
const urls = files.filter((url) => ext.some((n) => url.endsWith(n))).map(
|
|
35
45
|
(url) => `${staticBase}@vtj/plugins/${url.replace(/\\/gi, "/")}`
|
|
@@ -42,7 +52,7 @@ export class PluginRepository {
|
|
|
42
52
|
fromType: "Plugin",
|
|
43
53
|
preset: true,
|
|
44
54
|
id: dep,
|
|
45
|
-
name,
|
|
55
|
+
name: this.getName(dep),
|
|
46
56
|
title: description || name,
|
|
47
57
|
library: name,
|
|
48
58
|
urls: urls.join(",")
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vtj/local",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.8.
|
|
4
|
+
"version": "0.8.23",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"dependencies": {
|
|
7
7
|
"formidable": "~3.5.1",
|
|
8
|
-
"@vtj/coder": "~0.8.
|
|
9
|
-
"@vtj/core": "~0.8.
|
|
8
|
+
"@vtj/coder": "~0.8.23",
|
|
9
|
+
"@vtj/core": "~0.8.23",
|
|
10
10
|
"@vtj/node": "~0.8.2"
|
|
11
11
|
},
|
|
12
12
|
"devDependencies": {
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"unbuild": "~2.0.0",
|
|
15
15
|
"vite": "~5.2.6",
|
|
16
16
|
"vitest": "~1.5.0",
|
|
17
|
-
"@vtj/cli": "~0.8.
|
|
17
|
+
"@vtj/cli": "~0.8.9"
|
|
18
18
|
},
|
|
19
19
|
"exports": {
|
|
20
20
|
".": {
|