@vtj/local 0.7.9 → 0.7.11

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
@@ -9,6 +9,7 @@ export interface DevToolsOptions {
9
9
  vtjDir: string;
10
10
  packagesDir: string;
11
11
  devMode: boolean;
12
+ hm?: string;
12
13
  }
13
14
  export interface LinkOptions {
14
15
  entry?: string;
package/dist/plugin.mjs CHANGED
@@ -70,6 +70,28 @@ const linkPlugin = function(options) {
70
70
  }
71
71
  };
72
72
  };
73
+ const hmPlugin = function(options) {
74
+ const { hm } = options;
75
+ return {
76
+ name: "vtj-hm-plugin",
77
+ transformIndexHtml(html) {
78
+ return html.replace(
79
+ /<\/body>/,
80
+ `
81
+ <script>
82
+ (function () {
83
+ window._hmt = window._hmt || [];
84
+ const hm = document.createElement('script');
85
+ hm.src = 'https://hm.baidu.com/hm.js?${hm}';
86
+ var s = document.getElementsByTagName('script')[0];
87
+ s.parentNode.insertBefore(hm, s);
88
+ })();
89
+ <\/script>
90
+ `
91
+ );
92
+ }
93
+ };
94
+ };
73
95
  const aliasPlugin = function(options) {
74
96
  return {
75
97
  name: "vtj-alias-plugin",
@@ -126,6 +148,7 @@ export function createDevTools(options = {}) {
126
148
  vtjDir: ".vtj",
127
149
  packagesDir: "../../packages",
128
150
  devMode: false,
151
+ hm: "42f2469b4aa27c3f8978f634c0c19d24",
129
152
  ...options
130
153
  };
131
154
  const plugins = [aliasPlugin(opts)];
@@ -186,5 +209,8 @@ export function createDevTools(options = {}) {
186
209
  if (!!opts.link) {
187
210
  plugins.push(linkPlugin(opts));
188
211
  }
212
+ if (opts.hm) {
213
+ plugins.push(hmPlugin(opts));
214
+ }
189
215
  return plugins;
190
216
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@vtj/local",
3
3
  "private": false,
4
- "version": "0.7.9",
4
+ "version": "0.7.11",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "build": "unbuild",
@@ -10,12 +10,12 @@
10
10
  "coverage": "vitest run --coverage"
11
11
  },
12
12
  "dependencies": {
13
- "@vtj/coder": "^0.7.9",
14
- "@vtj/core": "^0.7.9",
15
- "@vtj/node": "^0.7.3"
13
+ "@vtj/coder": "^0.7.11",
14
+ "@vtj/core": "^0.7.11",
15
+ "@vtj/node": "^0.7.4"
16
16
  },
17
17
  "devDependencies": {
18
- "@vtj/cli": "^0.7.7",
18
+ "@vtj/cli": "^0.7.8",
19
19
  "unbuild": "~2.0.0",
20
20
  "vite": "~5.0.12",
21
21
  "vitest": "~1.2.1"
@@ -34,7 +34,7 @@
34
34
  "files": [
35
35
  "dist"
36
36
  ],
37
- "gitHead": "923aab791b5aacf1f0e75255ad7aa2b1b71e26bf",
37
+ "gitHead": "c06eab62d9b15ba39fd489316dc9389030b2d040",
38
38
  "publishConfig": {
39
39
  "access": "public"
40
40
  }