@vuepress/plugin-umami-analytics 2.0.0-rc.47 → 2.0.0-rc.52

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.
@@ -1,2 +1,5 @@
1
- declare const _default: import("vuepress/client").ClientConfig;
2
- export default _default;
1
+ import * as vuepress_client from 'vuepress/client';
2
+
3
+ declare const _default: vuepress_client.ClientConfig;
4
+
5
+ export { _default as default };
@@ -1,9 +1,2 @@
1
- import { defineClientConfig } from 'vuepress/client';
2
- import { useUmamiAnalytics } from './composables/index.js';
3
- export default defineClientConfig({
4
- setup() {
5
- if (__VUEPRESS_SSR__)
6
- return;
7
- useUmamiAnalytics(__UMM_OPTIONS__);
8
- },
9
- });
1
+ import{defineClientConfig as _}from"vuepress/client";import{useUmamiAnalytics as i}from"./index.js";var e=_({setup(){__VUEPRESS_SSR__||i(__UMM_OPTIONS__)}});export{e as default};
2
+ //# sourceMappingURL=config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.js","sources":["../../src/client/config.ts"],"sourcesContent":["import { defineClientConfig } from 'vuepress/client'\nimport type { UmamiOptions } from '../shared/index.js'\nimport { useUmamiAnalytics } from './composables/index.js'\n\ndeclare const __UMM_OPTIONS__: UmamiOptions\n\nexport default defineClientConfig({\n setup() {\n if (__VUEPRESS_SSR__) return\n useUmamiAnalytics(__UMM_OPTIONS__)\n },\n})\n"],"names":["config","defineClientConfig","useUmamiAnalytics"],"mappings":"oGAMA,IAAAA,EAAeC,EAAmB,CAChC,OAAQ,CACF,kBACJC,EAAkB,eAAe,CACnC,CACF,CAAC"}
@@ -1 +1,67 @@
1
- export * from './composables/index.js';
1
+ /**
2
+ * Options for @vuepress/plugin-umami-analytics
3
+ */
4
+ interface UmamiOptions {
5
+ /**
6
+ * The website ID in umami Analytics
7
+ *
8
+ * Umami 统计中的网站 ID。
9
+ */
10
+ id: string;
11
+ /**
12
+ * Link of umami analytics script
13
+ *
14
+ * Umami 统计的脚本链接
15
+ *
16
+ * @default 'https://us.umami.is/script.js'
17
+ */
18
+ link?: string;
19
+ /**
20
+ * By default, Umami tracks all pageviews and events for you automatically. You can disable this behavior and track events yourself using the tracker functions.
21
+ *
22
+ * 默认情况下,Umami 会自动跟踪所有页面浏览量和事件。你可以禁用此行为并使用追踪器功能自行追踪事件。
23
+ *
24
+ * @default true
25
+ */
26
+ autoTrack?: boolean;
27
+ /**
28
+ * Cache data to improve the performance of the tracking script.
29
+ *
30
+ * 缓存数据以提高追踪脚本的性能。
31
+ */
32
+ cache?: boolean;
33
+ /**
34
+ * Let the tracker only run on specific domains.
35
+ *
36
+ * 让跟踪器仅在特定的域名上运行。
37
+ */
38
+ domains?: string[];
39
+ /**
40
+ * Location to send data
41
+ *
42
+ * 发送数据的位置
43
+ *
44
+ * @default link
45
+ */
46
+ hostUrl?: string;
47
+ }
48
+
49
+ declare global {
50
+ interface Window {
51
+ umami: {
52
+ track: {
53
+ (payload?: Record<string, unknown>): void;
54
+ (name: string, data?: Record<string, unknown>): void;
55
+ };
56
+ };
57
+ }
58
+ }
59
+ /**
60
+ * Add umami analytics to the site
61
+ *
62
+ * @see https://umami.is/docs/install
63
+ * @see https://umami.is/docs/tracker-functions
64
+ */
65
+ declare const useUmamiAnalytics: ({ link, id, domains, autoTrack, cache, hostUrl, }: UmamiOptions) => void;
66
+
67
+ export { useUmamiAnalytics };
@@ -1 +1,2 @@
1
- export * from './composables/index.js';
1
+ const d=({link:s="https://us.umami.is/script.js",id:i,domains:a,autoTrack:r,cache:c,hostUrl:e})=>{if("umami"in window)return;const t=document.createElement("script");t.src=s,t.async=!0,t.setAttribute("data-website-id",i),r===!1&&t.setAttribute("data-auto-track","false"),c&&t.setAttribute("data-cache","true"),a&&t.setAttribute("data-domains",a.join(",")),e&&t.setAttribute("data-hostUrl",e),document.head.appendChild(t)};export{d as useUmamiAnalytics};
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +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 * Add umami analytics to the site\n *\n * @see https://umami.is/docs/install\n * @see https://umami.is/docs/tracker-functions\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":"AAmBO,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"}
@@ -1,2 +1,53 @@
1
- export * from './umamiAnalyticsPlugin.js';
2
- export type { UmamiOptions as UmamiPluginOptions } from '../shared/index.js';
1
+ import { Plugin } from 'vuepress/core';
2
+
3
+ /**
4
+ * Options for @vuepress/plugin-umami-analytics
5
+ */
6
+ interface UmamiOptions {
7
+ /**
8
+ * The website ID in umami Analytics
9
+ *
10
+ * Umami 统计中的网站 ID。
11
+ */
12
+ id: string;
13
+ /**
14
+ * Link of umami analytics script
15
+ *
16
+ * Umami 统计的脚本链接
17
+ *
18
+ * @default 'https://us.umami.is/script.js'
19
+ */
20
+ link?: string;
21
+ /**
22
+ * By default, Umami tracks all pageviews and events for you automatically. You can disable this behavior and track events yourself using the tracker functions.
23
+ *
24
+ * 默认情况下,Umami 会自动跟踪所有页面浏览量和事件。你可以禁用此行为并使用追踪器功能自行追踪事件。
25
+ *
26
+ * @default true
27
+ */
28
+ autoTrack?: boolean;
29
+ /**
30
+ * Cache data to improve the performance of the tracking script.
31
+ *
32
+ * 缓存数据以提高追踪脚本的性能。
33
+ */
34
+ cache?: boolean;
35
+ /**
36
+ * Let the tracker only run on specific domains.
37
+ *
38
+ * 让跟踪器仅在特定的域名上运行。
39
+ */
40
+ domains?: string[];
41
+ /**
42
+ * Location to send data
43
+ *
44
+ * 发送数据的位置
45
+ *
46
+ * @default link
47
+ */
48
+ hostUrl?: string;
49
+ }
50
+
51
+ declare const umamiAnalyticsPlugin: ({ id, ...options }: UmamiOptions) => Plugin;
52
+
53
+ export { type UmamiOptions as UmamiPluginOptions, umamiAnalyticsPlugin };
package/lib/node/index.js CHANGED
@@ -1 +1,2 @@
1
- export * from './umamiAnalyticsPlugin.js';
1
+ import{Logger as t}from"@vuepress/helper";import{getDirname as a,path as m,colors as s}from"vuepress/utils";const c=a(import.meta.url),n="@vuepress/plugin-umami-analytics",l=new t(n),u=({id:i,...r})=>o=>{const e={name:n};return i?o.env.isDev?e:{...e,define:{__UMM_OPTIONS__:{id:i,...r}},clientConfigFile:m.resolve(c,"../client/config.js")}:(l.warn(`${s.cyan("id")} is required!`),e)};export{u as umamiAnalyticsPlugin};
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +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 = 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,EAAYC,EAAW,YAAY,GAAG,EAEtCC,EAAc,mCAEdC,EAAS,IAAIC,EAAOF,CAAW,EAExBG,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.47",
3
+ "version": "2.0.0-rc.52",
4
4
  "description": "VuePress plugin - umami-analytics",
5
5
  "keywords": [
6
6
  "vuepress-plugin",
@@ -36,14 +36,14 @@
36
36
  "lib"
37
37
  ],
38
38
  "dependencies": {
39
- "@vuepress/helper": "2.0.0-rc.47",
40
- "vue": "^3.5.8"
39
+ "@vuepress/helper": "2.0.0-rc.52",
40
+ "vue": "^3.5.10"
41
41
  },
42
42
  "peerDependencies": {
43
- "vuepress": "2.0.0-rc.15"
43
+ "vuepress": "2.0.0-rc.17"
44
44
  },
45
45
  "publishConfig": {
46
46
  "access": "public"
47
47
  },
48
- "gitHead": "688b739ad50113f8aad17ab18e868d72698a2a54"
48
+ "gitHead": "0c0a6501082d7abdbfc4a3e4b6de48d902011c07"
49
49
  }
@@ -1 +0,0 @@
1
- export * from './useUmamiAnalytics.js';
@@ -1 +0,0 @@
1
- export * from './useUmamiAnalytics.js';
@@ -1,18 +0,0 @@
1
- import type { UmamiOptions } from '../../shared/index.js';
2
- declare global {
3
- interface Window {
4
- umami: {
5
- track: {
6
- (payload?: Record<string, unknown>): void;
7
- (name: string, data?: Record<string, unknown>): void;
8
- };
9
- };
10
- }
11
- }
12
- /**
13
- * Add umami analytics to the site
14
- *
15
- * @see https://umami.is/docs/install
16
- * @see https://umami.is/docs/tracker-functions
17
- */
18
- export declare const useUmamiAnalytics: ({ link, id, domains, autoTrack, cache, hostUrl, }: UmamiOptions) => void;
@@ -1,24 +0,0 @@
1
- /**
2
- * Add umami analytics to the site
3
- *
4
- * @see https://umami.is/docs/install
5
- * @see https://umami.is/docs/tracker-functions
6
- */
7
- export const useUmamiAnalytics = ({ link = 'https://us.umami.is/script.js', id, domains, autoTrack, cache, hostUrl, }) => {
8
- // avoid duplicated import
9
- if ('umami' in window)
10
- return;
11
- const script = document.createElement('script');
12
- script.src = link;
13
- script.async = true;
14
- script.setAttribute('data-website-id', id);
15
- if (autoTrack === false)
16
- script.setAttribute('data-auto-track', 'false');
17
- if (cache)
18
- script.setAttribute('data-cache', 'true');
19
- if (domains)
20
- script.setAttribute('data-domains', domains.join(','));
21
- if (hostUrl)
22
- script.setAttribute('data-hostUrl', hostUrl);
23
- document.head.appendChild(script);
24
- };
@@ -1,3 +0,0 @@
1
- import type { Plugin } from 'vuepress/core';
2
- import type { UmamiOptions } from '../shared/index.js';
3
- export declare const umamiAnalyticsPlugin: ({ id, ...options }: UmamiOptions) => Plugin;
@@ -1,25 +0,0 @@
1
- import { Logger } from '@vuepress/helper';
2
- import { colors, getDirname, path } from 'vuepress/utils';
3
- const __dirname = getDirname(import.meta.url);
4
- const PLUGIN_NAME = '@vuepress/plugin-umami-analytics';
5
- const logger = new Logger(PLUGIN_NAME);
6
- export const umamiAnalyticsPlugin = ({ id, ...options }) => (app) => {
7
- const plugin = {
8
- name: PLUGIN_NAME,
9
- };
10
- if (!id) {
11
- logger.warn(`${colors.cyan('id')} is required!`);
12
- return plugin;
13
- }
14
- // returns an empty plugin in dev mode when debug mode is not enabled
15
- if (app.env.isDev) {
16
- return plugin;
17
- }
18
- return {
19
- ...plugin,
20
- define: {
21
- __UMM_OPTIONS__: { id, ...options },
22
- },
23
- clientConfigFile: path.resolve(__dirname, '../client/config.js'),
24
- };
25
- };
@@ -1 +0,0 @@
1
- export * from './options.js';
@@ -1 +0,0 @@
1
- export * from './options.js';
@@ -1,47 +0,0 @@
1
- /**
2
- * Options for @vuepress/plugin-umami-analytics
3
- */
4
- export interface UmamiOptions {
5
- /**
6
- * The website ID in umami Analytics
7
- *
8
- * Umami 统计中的网站 ID。
9
- */
10
- id: string;
11
- /**
12
- * Link of umami analytics script
13
- *
14
- * Umami 统计的脚本链接
15
- *
16
- * @default 'https://us.umami.is/script.js'
17
- */
18
- link?: string;
19
- /**
20
- * By default, Umami tracks all pageviews and events for you automatically. You can disable this behavior and track events yourself using the tracker functions.
21
- *
22
- * 默认情况下,Umami 会自动跟踪所有页面浏览量和事件。你可以禁用此行为并使用追踪器功能自行追踪事件。
23
- *
24
- * @default true
25
- */
26
- autoTrack?: boolean;
27
- /**
28
- * Cache data to improve the performance of the tracking script.
29
- *
30
- * 缓存数据以提高追踪脚本的性能。
31
- */
32
- cache?: boolean;
33
- /**
34
- * Let the tracker only run on specific domains.
35
- *
36
- * 让跟踪器仅在特定的域名上运行。
37
- */
38
- domains?: string[];
39
- /**
40
- * Location to send data
41
- *
42
- * 发送数据的位置
43
- *
44
- * @default link
45
- */
46
- hostUrl?: string;
47
- }
@@ -1 +0,0 @@
1
- export {};