@vtj/local 0.8.130 → 0.8.132

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
@@ -22,7 +22,6 @@ export interface DevToolsOptions {
22
22
  }
23
23
  export interface LinkOptions {
24
24
  entry?: string;
25
- href?: string;
26
25
  serveOnly?: boolean;
27
26
  }
28
27
  export declare function parsePresetPlugins(options: DevToolsOptions): {
package/dist/plugin.mjs CHANGED
@@ -6,6 +6,7 @@ import { pathExistsSync, readJsonSync } from "@vtj/node";
6
6
  import { join, resolve } from "path";
7
7
  import bodyParser from "body-parser";
8
8
  import { router } from "./controller.mjs";
9
+ import { CLIENT_DIR } from "./shared.mjs";
9
10
  const setApis = (server, options) => {
10
11
  server.middlewares.use(
11
12
  bodyParser.json({ type: "application/json", limit: "50000kb" })
@@ -36,11 +37,7 @@ const apiServerPlugin = function(options) {
36
37
  };
37
38
  };
38
39
  const linkPlugin = function(options) {
39
- const {
40
- entry = "/index.html",
41
- href = "",
42
- serveOnly = true
43
- } = options.linkOptions || {};
40
+ const { entry = "/index.html", serveOnly = true } = options.linkOptions || {};
44
41
  let config;
45
42
  return {
46
43
  name: "vtj-link-plugin",
@@ -56,12 +53,11 @@ const linkPlugin = function(options) {
56
53
  if (ctx.path !== entry) {
57
54
  return html;
58
55
  }
59
- const link = typeof options.link === "string" ? options.link : `${options.packageName}/link.js`;
56
+ const link = typeof options.link === "string" ? options.link : `${CLIENT_DIR}/entry/index.js`;
60
57
  const url = `${config.base}${link}`;
61
58
  return html.replace(
62
59
  /<\/body>/,
63
60
  `
64
- <script>window.__VTJ_LINK__ = { href: '${href}' }<\/script>
65
61
  <script src="${url}"><\/script></body>
66
62
  `
67
63
  );
@@ -173,7 +169,7 @@ export function parsePresetPlugins(options) {
173
169
  }
174
170
  export function createDevTools(options = {}) {
175
171
  const opts = {
176
- baseURL: "/vtj/local/repository",
172
+ baseURL: `/${CLIENT_DIR}/api`,
177
173
  copy: true,
178
174
  server: true,
179
175
  staticBase: "/",
@@ -242,7 +238,7 @@ export function createDevTools(options = {}) {
242
238
  const staticOptions = [];
243
239
  if (pathExistsSync(proPath)) {
244
240
  staticOptions.push({
245
- path: `${opts.staticBase}${opts.packageName}`,
241
+ path: `${opts.staticBase}${CLIENT_DIR}`,
246
242
  dir: proPath
247
243
  });
248
244
  }
package/dist/shared.d.ts CHANGED
@@ -14,3 +14,4 @@ export declare enum Result {
14
14
  }
15
15
  export declare const success: (data: any) => ApiResponse;
16
16
  export declare const fail: (msg: string, data?: any) => ApiResponse;
17
+ export declare const CLIENT_DIR = "__vtj__";
package/dist/shared.mjs CHANGED
@@ -19,3 +19,4 @@ export const fail = (msg, data = null) => {
19
19
  success: false
20
20
  };
21
21
  };
22
+ export const CLIENT_DIR = "__vtj__";
package/package.json CHANGED
@@ -1,20 +1,20 @@
1
1
  {
2
2
  "name": "@vtj/local",
3
3
  "private": false,
4
- "version": "0.8.130",
4
+ "version": "0.8.132",
5
5
  "type": "module",
6
6
  "dependencies": {
7
7
  "formidable": "~3.5.1",
8
- "@vtj/coder": "~0.8.130",
9
- "@vtj/core": "~0.8.130",
10
- "@vtj/node": "~0.8.11"
8
+ "@vtj/coder": "~0.8.132",
9
+ "@vtj/node": "~0.8.11",
10
+ "@vtj/core": "~0.8.132"
11
11
  },
12
12
  "devDependencies": {
13
13
  "@types/formidable": "~3.4.5",
14
14
  "unbuild": "~2.0.0",
15
15
  "vite": "~5.4.0",
16
16
  "vitest": "~2.0.3",
17
- "@vtj/cli": "~0.8.28"
17
+ "@vtj/cli": "~0.8.29"
18
18
  },
19
19
  "exports": {
20
20
  ".": {