@vuepress/plugin-umami-analytics 2.0.0-rc.106 → 2.0.0-rc.108
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/lib/client/index.d.ts +56 -14
- package/lib/client/index.js.map +1 -1
- package/lib/node/index.d.ts +72 -12
- package/lib/node/index.js.map +1 -1
- package/package.json +4 -4
- package/LICENSE +0 -21
package/lib/client/index.d.ts
CHANGED
|
@@ -1,45 +1,77 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Options for @vuepress/plugin-umami-analytics
|
|
3
|
+
*
|
|
4
|
+
* @vuepress/plugin-umami-analytics 插件选项
|
|
3
5
|
*/
|
|
4
6
|
interface UmamiOptions {
|
|
5
7
|
/**
|
|
6
|
-
*
|
|
8
|
+
* Umami Analytics website ID
|
|
9
|
+
*
|
|
10
|
+
* Umami Analytics 网站 ID
|
|
11
|
+
*
|
|
12
|
+
* @description The website ID from your Umami Analytics dashboard
|
|
7
13
|
*
|
|
8
|
-
* Umami
|
|
14
|
+
* 从 Umami Analytics 仪表板获取的网站 ID
|
|
9
15
|
*/
|
|
10
16
|
id: string;
|
|
11
17
|
/**
|
|
12
|
-
*
|
|
18
|
+
* Umami Analytics script URL
|
|
19
|
+
*
|
|
20
|
+
* Umami Analytics 脚本链接
|
|
21
|
+
*
|
|
22
|
+
* @description URL to the Umami tracking script
|
|
13
23
|
*
|
|
14
|
-
* Umami
|
|
24
|
+
* Umami 追踪脚本的 URL
|
|
15
25
|
*
|
|
16
26
|
* @default 'https://us.umami.is/script.js'
|
|
17
27
|
*/
|
|
18
28
|
link?: string;
|
|
19
29
|
/**
|
|
20
|
-
*
|
|
30
|
+
* Enable automatic tracking
|
|
21
31
|
*
|
|
22
|
-
*
|
|
32
|
+
* 启用自动追踪
|
|
33
|
+
*
|
|
34
|
+
* @description When enabled, Umami automatically tracks pageviews and events.
|
|
35
|
+
* Set to `false` to use manual tracking with tracker functions.
|
|
36
|
+
*
|
|
37
|
+
* 启用时,Umami 会自动追踪页面浏览和事件。
|
|
38
|
+
* 设为 `false` 可使用手动追踪功能。
|
|
23
39
|
*
|
|
24
40
|
* @default true
|
|
25
41
|
*/
|
|
26
42
|
autoTrack?: boolean;
|
|
27
43
|
/**
|
|
28
|
-
*
|
|
44
|
+
* Enable data caching
|
|
45
|
+
*
|
|
46
|
+
* 启用数据缓存
|
|
47
|
+
*
|
|
48
|
+
* @description Cache data to improve tracking script performance.
|
|
49
|
+
* Uses session storage and may require user notification.
|
|
29
50
|
*
|
|
30
|
-
*
|
|
51
|
+
* 缓存数据以提高追踪脚本性能。
|
|
52
|
+
* 使用会话存储,可能需要通知用户。
|
|
53
|
+
*
|
|
54
|
+
* @default false
|
|
31
55
|
*/
|
|
32
56
|
cache?: boolean;
|
|
33
57
|
/**
|
|
34
|
-
*
|
|
58
|
+
* Restrict tracking to specific domains
|
|
59
|
+
*
|
|
60
|
+
* 限制追踪到特定域名
|
|
61
|
+
*
|
|
62
|
+
* @description Array of domains where tracking should be active
|
|
35
63
|
*
|
|
36
|
-
*
|
|
64
|
+
* 限制追踪活跃的域名数组
|
|
37
65
|
*/
|
|
38
66
|
domains?: string[];
|
|
39
67
|
/**
|
|
40
|
-
*
|
|
68
|
+
* Data collection endpoint
|
|
69
|
+
*
|
|
70
|
+
* 数据收集端点
|
|
71
|
+
*
|
|
72
|
+
* @description Custom URL for sending tracking data
|
|
41
73
|
*
|
|
42
|
-
*
|
|
74
|
+
* 发送追踪数据的自定义 URL
|
|
43
75
|
*
|
|
44
76
|
* @default link
|
|
45
77
|
*/
|
|
@@ -57,10 +89,20 @@ declare global {
|
|
|
57
89
|
}
|
|
58
90
|
}
|
|
59
91
|
/**
|
|
60
|
-
*
|
|
92
|
+
* Initialize Umami Analytics tracking
|
|
93
|
+
*
|
|
94
|
+
* 初始化 Umami Analytics 追踪
|
|
95
|
+
*
|
|
96
|
+
* @param options - Umami Analytics options
|
|
97
|
+
*
|
|
98
|
+
* @description Injects Umami tracking script and configures tracking behavior.
|
|
99
|
+
* The global `umami.track()` function will be available for custom event tracking.
|
|
100
|
+
*
|
|
101
|
+
* 注入 Umami 追踪脚本并配置追踪行为。
|
|
102
|
+
* 全局 `umami.track()` 函数可用于自定义事件追踪。
|
|
61
103
|
*
|
|
62
|
-
* @see https://umami.is/docs/install
|
|
63
104
|
* @see https://umami.is/docs/tracker-functions
|
|
105
|
+
* @see https://umami.is/docs/tracker-configuration
|
|
64
106
|
*/
|
|
65
107
|
declare const useUmamiAnalytics: ({ link, id, domains, autoTrack, cache, hostUrl, }: UmamiOptions) => void;
|
|
66
108
|
|
package/lib/client/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../src/client/composables/useUmamiAnalytics.ts"],"sourcesContent":["import type { UmamiOptions } from '../../shared/index.js'\n\ndeclare global {\n interface Window {\n umami: {\n track: {\n (payload?: Record<string, unknown>): void\n (name: string, data?: Record<string, unknown>): void\n }\n }\n }\n}\n\n/**\n *
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/client/composables/useUmamiAnalytics.ts"],"sourcesContent":["import type { UmamiOptions } from '../../shared/index.js'\n\ndeclare global {\n interface Window {\n umami: {\n track: {\n (payload?: Record<string, unknown>): void\n (name: string, data?: Record<string, unknown>): void\n }\n }\n }\n}\n\n/**\n * Initialize Umami Analytics tracking\n *\n * 初始化 Umami Analytics 追踪\n *\n * @param options - Umami Analytics options\n *\n * @description Injects Umami tracking script and configures tracking behavior.\n * The global `umami.track()` function will be available for custom event tracking.\n *\n * 注入 Umami 追踪脚本并配置追踪行为。\n * 全局 `umami.track()` 函数可用于自定义事件追踪。\n *\n * @see https://umami.is/docs/tracker-functions\n * @see https://umami.is/docs/tracker-configuration\n */\nexport const useUmamiAnalytics = ({\n link = 'https://us.umami.is/script.js',\n id,\n domains,\n autoTrack,\n cache,\n hostUrl,\n}: UmamiOptions): void => {\n // avoid duplicated import\n if ('umami' in window) return\n\n const script = document.createElement('script')\n script.src = link!\n script.async = true\n script.setAttribute('data-website-id', id)\n\n if (autoTrack === false) script.setAttribute('data-auto-track', 'false')\n if (cache) script.setAttribute('data-cache', 'true')\n if (domains) script.setAttribute('data-domains', domains.join(','))\n if (hostUrl) script.setAttribute('data-hostUrl', hostUrl)\n\n document.head.appendChild(script)\n}\n"],"names":["useUmamiAnalytics","link","id","domains","autoTrack","cache","hostUrl","script"],"mappings":"AA6BO,MAAMA,EAAoB,CAAC,CAChC,KAAAC,EAAO,gCACP,GAAAC,EACA,QAAAC,EACA,UAAAC,EACA,MAAAC,EACA,QAAAC,CACF,IAA0B,CAExB,GAAI,UAAW,OAAQ,OAEvB,MAAMC,EAAS,SAAS,cAAc,QAAQ,EAC9CA,EAAO,IAAMN,EACbM,EAAO,MAAQ,GACfA,EAAO,aAAa,kBAAmBL,CAAE,EAErCE,IAAc,IAAOG,EAAO,aAAa,kBAAmB,OAAO,EACnEF,GAAOE,EAAO,aAAa,aAAc,MAAM,EAC/CJ,GAASI,EAAO,aAAa,eAAgBJ,EAAQ,KAAK,GAAG,CAAC,EAC9DG,GAASC,EAAO,aAAa,eAAgBD,CAAO,EAExD,SAAS,KAAK,YAAYC,CAAM,CAClC"}
|
package/lib/node/index.d.ts
CHANGED
|
@@ -2,52 +2,112 @@ import { Plugin } from 'vuepress/core';
|
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Options for @vuepress/plugin-umami-analytics
|
|
5
|
+
*
|
|
6
|
+
* @vuepress/plugin-umami-analytics 插件选项
|
|
5
7
|
*/
|
|
6
8
|
interface UmamiOptions {
|
|
7
9
|
/**
|
|
8
|
-
*
|
|
10
|
+
* Umami Analytics website ID
|
|
9
11
|
*
|
|
10
|
-
* Umami
|
|
12
|
+
* Umami Analytics 网站 ID
|
|
13
|
+
*
|
|
14
|
+
* @description The website ID from your Umami Analytics dashboard
|
|
15
|
+
*
|
|
16
|
+
* 从 Umami Analytics 仪表板获取的网站 ID
|
|
11
17
|
*/
|
|
12
18
|
id: string;
|
|
13
19
|
/**
|
|
14
|
-
*
|
|
20
|
+
* Umami Analytics script URL
|
|
21
|
+
*
|
|
22
|
+
* Umami Analytics 脚本链接
|
|
23
|
+
*
|
|
24
|
+
* @description URL to the Umami tracking script
|
|
15
25
|
*
|
|
16
|
-
* Umami
|
|
26
|
+
* Umami 追踪脚本的 URL
|
|
17
27
|
*
|
|
18
28
|
* @default 'https://us.umami.is/script.js'
|
|
19
29
|
*/
|
|
20
30
|
link?: string;
|
|
21
31
|
/**
|
|
22
|
-
*
|
|
32
|
+
* Enable automatic tracking
|
|
23
33
|
*
|
|
24
|
-
*
|
|
34
|
+
* 启用自动追踪
|
|
35
|
+
*
|
|
36
|
+
* @description When enabled, Umami automatically tracks pageviews and events.
|
|
37
|
+
* Set to `false` to use manual tracking with tracker functions.
|
|
38
|
+
*
|
|
39
|
+
* 启用时,Umami 会自动追踪页面浏览和事件。
|
|
40
|
+
* 设为 `false` 可使用手动追踪功能。
|
|
25
41
|
*
|
|
26
42
|
* @default true
|
|
27
43
|
*/
|
|
28
44
|
autoTrack?: boolean;
|
|
29
45
|
/**
|
|
30
|
-
*
|
|
46
|
+
* Enable data caching
|
|
47
|
+
*
|
|
48
|
+
* 启用数据缓存
|
|
49
|
+
*
|
|
50
|
+
* @description Cache data to improve tracking script performance.
|
|
51
|
+
* Uses session storage and may require user notification.
|
|
31
52
|
*
|
|
32
|
-
*
|
|
53
|
+
* 缓存数据以提高追踪脚本性能。
|
|
54
|
+
* 使用会话存储,可能需要通知用户。
|
|
55
|
+
*
|
|
56
|
+
* @default false
|
|
33
57
|
*/
|
|
34
58
|
cache?: boolean;
|
|
35
59
|
/**
|
|
36
|
-
*
|
|
60
|
+
* Restrict tracking to specific domains
|
|
61
|
+
*
|
|
62
|
+
* 限制追踪到特定域名
|
|
37
63
|
*
|
|
38
|
-
*
|
|
64
|
+
* @description Array of domains where tracking should be active
|
|
65
|
+
*
|
|
66
|
+
* 限制追踪活跃的域名数组
|
|
39
67
|
*/
|
|
40
68
|
domains?: string[];
|
|
41
69
|
/**
|
|
42
|
-
*
|
|
70
|
+
* Data collection endpoint
|
|
71
|
+
*
|
|
72
|
+
* 数据收集端点
|
|
43
73
|
*
|
|
44
|
-
*
|
|
74
|
+
* @description Custom URL for sending tracking data
|
|
75
|
+
*
|
|
76
|
+
* 发送追踪数据的自定义 URL
|
|
45
77
|
*
|
|
46
78
|
* @default link
|
|
47
79
|
*/
|
|
48
80
|
hostUrl?: string;
|
|
49
81
|
}
|
|
50
82
|
|
|
83
|
+
/**
|
|
84
|
+
* Umami Analytics plugin for VuePress
|
|
85
|
+
*
|
|
86
|
+
* VuePress 的 Umami Analytics 插件
|
|
87
|
+
*
|
|
88
|
+
* @param options - Plugin options
|
|
89
|
+
* @returns VuePress plugin
|
|
90
|
+
*
|
|
91
|
+
* @description Integrates Umami Analytics tracking into VuePress applications.
|
|
92
|
+
* Only active in production builds when a valid website ID is provided.
|
|
93
|
+
*
|
|
94
|
+
* 集成 Umami Analytics 追踪到 VuePress 应用中。
|
|
95
|
+
* 仅在生产构建且提供有效网站 ID 时启用。
|
|
96
|
+
*
|
|
97
|
+
* @example
|
|
98
|
+
* ```ts
|
|
99
|
+
* import { umamiAnalyticsPlugin } from '@vuepress/plugin-umami-analytics'
|
|
100
|
+
*
|
|
101
|
+
* export default {
|
|
102
|
+
* plugins: [
|
|
103
|
+
* umamiAnalyticsPlugin({
|
|
104
|
+
* id: 'your-website-id',
|
|
105
|
+
* link: 'https://your-umami-instance.com/script.js'
|
|
106
|
+
* })
|
|
107
|
+
* ]
|
|
108
|
+
* }
|
|
109
|
+
* ```
|
|
110
|
+
*/
|
|
51
111
|
declare const umamiAnalyticsPlugin: ({ id, ...options }: UmamiOptions) => Plugin;
|
|
52
112
|
|
|
53
113
|
export { umamiAnalyticsPlugin };
|
package/lib/node/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../src/node/umamiAnalyticsPlugin.ts"],"sourcesContent":["import { Logger } from '@vuepress/helper'\nimport type { Plugin, PluginObject } from 'vuepress/core'\nimport { colors, getDirname, path } from 'vuepress/utils'\nimport type { UmamiOptions } from '../shared/index.js'\n\nconst __dirname = import.meta.dirname || getDirname(import.meta.url)\n\nconst PLUGIN_NAME = '@vuepress/plugin-umami-analytics'\n\nconst logger = new Logger(PLUGIN_NAME)\n\nexport const umamiAnalyticsPlugin =\n ({ id, ...options }: UmamiOptions): Plugin =>\n (app) => {\n const plugin: PluginObject = {\n name: PLUGIN_NAME,\n }\n\n if (!id) {\n logger.warn(`${colors.cyan('id')} is required!`)\n\n return plugin\n }\n\n // returns an empty plugin in dev mode when debug mode is not enabled\n if (app.env.isDev) {\n return plugin\n }\n\n return {\n ...plugin,\n\n define: {\n __UMM_OPTIONS__: { id, ...options },\n },\n\n clientConfigFile: path.resolve(__dirname, '../client/config.js'),\n }\n }\n"],"names":["__dirname","getDirname","PLUGIN_NAME","logger","Logger","umamiAnalyticsPlugin","id","options","app","plugin","path","colors"],"mappings":"4GAKA,MAAMA,EAAY,YAAY,SAAWC,EAAW,YAAY,GAAG,EAE7DC,EAAc,mCAEdC,EAAS,IAAIC,EAAOF,CAAW,
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/node/umamiAnalyticsPlugin.ts"],"sourcesContent":["import { Logger } from '@vuepress/helper'\nimport type { Plugin, PluginObject } from 'vuepress/core'\nimport { colors, getDirname, path } from 'vuepress/utils'\nimport type { UmamiOptions } from '../shared/index.js'\n\nconst __dirname = import.meta.dirname || getDirname(import.meta.url)\n\nconst PLUGIN_NAME = '@vuepress/plugin-umami-analytics'\n\nconst logger = new Logger(PLUGIN_NAME)\n\n/**\n * Umami Analytics plugin for VuePress\n *\n * VuePress 的 Umami Analytics 插件\n *\n * @param options - Plugin options\n * @returns VuePress plugin\n *\n * @description Integrates Umami Analytics tracking into VuePress applications.\n * Only active in production builds when a valid website ID is provided.\n *\n * 集成 Umami Analytics 追踪到 VuePress 应用中。\n * 仅在生产构建且提供有效网站 ID 时启用。\n *\n * @example\n * ```ts\n * import { umamiAnalyticsPlugin } from '@vuepress/plugin-umami-analytics'\n *\n * export default {\n * plugins: [\n * umamiAnalyticsPlugin({\n * id: 'your-website-id',\n * link: 'https://your-umami-instance.com/script.js'\n * })\n * ]\n * }\n * ```\n */\nexport const umamiAnalyticsPlugin =\n ({ id, ...options }: UmamiOptions): Plugin =>\n (app) => {\n const plugin: PluginObject = {\n name: PLUGIN_NAME,\n }\n\n if (!id) {\n logger.warn(`${colors.cyan('id')} is required!`)\n\n return plugin\n }\n\n // returns an empty plugin in dev mode when debug mode is not enabled\n if (app.env.isDev) {\n return plugin\n }\n\n return {\n ...plugin,\n\n define: {\n __UMM_OPTIONS__: { id, ...options },\n },\n\n clientConfigFile: path.resolve(__dirname, '../client/config.js'),\n }\n }\n"],"names":["__dirname","getDirname","PLUGIN_NAME","logger","Logger","umamiAnalyticsPlugin","id","options","app","plugin","path","colors"],"mappings":"4GAKA,MAAMA,EAAY,YAAY,SAAWC,EAAW,YAAY,GAAG,EAE7DC,EAAc,mCAEdC,EAAS,IAAIC,EAAOF,CAAW,EA8BxBG,EACX,CAAC,CAAE,GAAAC,EAAI,GAAGC,CAAQ,IACjBC,GAAQ,CACP,MAAMC,EAAuB,CAC3B,KAAMP,CACR,EAEA,OAAKI,EAODE,EAAI,IAAI,MACHC,EAGF,CACL,GAAGA,EAEH,OAAQ,CACN,gBAAiB,CAAE,GAAAH,EAAI,GAAGC,CAAQ,CACpC,EAEA,iBAAkBG,EAAK,QAAQV,EAAW,qBAAqB,CACjE,GAlBEG,EAAO,KAAK,GAAGQ,EAAO,KAAK,IAAI,CAAC,eAAe,EAExCF,EAiBX"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vuepress/plugin-umami-analytics",
|
|
3
|
-
"version": "2.0.0-rc.
|
|
3
|
+
"version": "2.0.0-rc.108",
|
|
4
4
|
"description": "VuePress plugin - umami-analytics",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"vuepress-plugin",
|
|
@@ -36,8 +36,8 @@
|
|
|
36
36
|
"lib"
|
|
37
37
|
],
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@vuepress/helper": "2.0.0-rc.
|
|
40
|
-
"vue": "^3.5.
|
|
39
|
+
"@vuepress/helper": "2.0.0-rc.108",
|
|
40
|
+
"vue": "^3.5.16"
|
|
41
41
|
},
|
|
42
42
|
"peerDependencies": {
|
|
43
43
|
"vuepress": "2.0.0-rc.23"
|
|
@@ -45,5 +45,5 @@
|
|
|
45
45
|
"publishConfig": {
|
|
46
46
|
"access": "public"
|
|
47
47
|
},
|
|
48
|
-
"gitHead": "
|
|
48
|
+
"gitHead": "784e7ede72095dc9d3dd47ed387e1f77d49c0cd7"
|
|
49
49
|
}
|
package/LICENSE
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
The MIT License (MIT)
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2018-present, VuePress Community
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in
|
|
13
|
-
all copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
-
THE SOFTWARE.
|