@vtj/local 0.8.22 → 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 CHANGED
@@ -16,6 +16,7 @@ export interface DevToolsOptions {
16
16
  nodeModulesDir: string;
17
17
  presetPlugins: RegExp[];
18
18
  pluginNodeModulesDir?: string;
19
+ extensionDir: string;
19
20
  hm?: string;
20
21
  }
21
22
  export interface LinkOptions {
package/dist/plugin.mjs CHANGED
@@ -188,6 +188,7 @@ export function createDevTools(options = {}) {
188
188
  nodeModulesDir: "node_modules",
189
189
  presetPlugins: [/^\@newpearl\/plugin\-/gi, /^\@vtj\/plugin\-/gi],
190
190
  pluginNodeModulesDir: "node_modules",
191
+ extensionDir: "",
191
192
  hm: "42f2469b4aa27c3f8978f634c0c19d24",
192
193
  ...options
193
194
  };
@@ -214,6 +215,13 @@ export function createDevTools(options = {}) {
214
215
  "\n @vtj/materials is not installed, please install it first.\n"
215
216
  );
216
217
  }
218
+ if (opts.extensionDir && pathExistsSync(opts.extensionDir)) {
219
+ copyOptions.push({
220
+ from: opts.extensionDir,
221
+ to: "@vtj/extension",
222
+ emptyDir: true
223
+ });
224
+ }
217
225
  if (copyOptions.length > 0) {
218
226
  plugins.push(copyPlugin(copyOptions));
219
227
  }
@@ -242,6 +250,12 @@ export function createDevTools(options = {}) {
242
250
  "\n @vtj/materials is not installed, please install it first.\n"
243
251
  );
244
252
  }
253
+ if (opts.extensionDir && pathExistsSync(opts.extensionDir)) {
254
+ staticOptions.push({
255
+ path: `${opts.staticBase}@vtj/extension`,
256
+ dir: opts.extensionDir
257
+ });
258
+ }
245
259
  if (staticOptions.length > 0) {
246
260
  plugins.push(staticPlugin(staticOptions));
247
261
  }
@@ -5,5 +5,6 @@ export declare class PluginRepository {
5
5
  private opts;
6
6
  private deps;
7
7
  constructor(pkg: any, opts: DevToolsOptions);
8
+ getName(dep: string): string;
8
9
  getPlugins(): BlockFile[];
9
10
  }
@@ -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 { nodeModulesDir = "node_modules", staticBase = "/" } = this.opts;
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(nodeModulesDir, dep, "dist");
38
+ const dist = join(pluginNodeModulesDir, dep, "dist");
31
39
  if (pathExistsSync(dist)) {
32
- const pkg = readJsonSync(join(nodeModulesDir, dep, "package.json"));
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.22",
4
+ "version": "0.8.23",
5
5
  "type": "module",
6
6
  "dependencies": {
7
7
  "formidable": "~3.5.1",
8
- "@vtj/coder": "~0.8.22",
9
- "@vtj/core": "~0.8.22",
8
+ "@vtj/coder": "~0.8.23",
9
+ "@vtj/core": "~0.8.23",
10
10
  "@vtj/node": "~0.8.2"
11
11
  },
12
12
  "devDependencies": {