├── .commitlintrc ├── .editorconfig ├── .github ├── pull_request_template.md └── workflows │ ├── release.yml │ └── test.yml ├── .gitignore ├── .prettierrc ├── .simple-git-hooks.json ├── changelog.md ├── client └── index.ts ├── eslint.config.ts ├── index.ts ├── license ├── package.json ├── pnpm-lock.yaml ├── readme.md ├── server └── index.ts └── tsconfig.json /.commitlintrc: -------------------------------------------------------------------------------- 1 | { 2 | extends: ["@commitlint/config-conventional"] 3 | } 4 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | indent_style = space 5 | indent_size = 2 6 | end_of_line = lf 7 | charset = utf-8 8 | trim_trailing_whitespace = true 9 | insert_final_newline = true 10 | 11 | [{makefile,**.mk}] 12 | indent_style = tab 13 | -------------------------------------------------------------------------------- /.github/pull_request_template.md: -------------------------------------------------------------------------------- 1 | # Description 2 | 3 | Please include a summary of the changes. 4 | -------------------------------------------------------------------------------- /.github/workflows/release.yml: -------------------------------------------------------------------------------- 1 | name: release 2 | 3 | on: 4 | push: 5 | tags: 6 | - 'v*' 7 | workflow_dispatch: 8 | 9 | jobs: 10 | release: 11 | runs-on: ubuntu-latest 12 | 13 | steps: 14 | - name: checkout 15 | uses: actions/checkout@v3 16 | 17 | - name: create release 18 | id: release_tag 19 | uses: yyx990803/release-tag@master 20 | env: 21 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 22 | with: 23 | tag_name: ${{ github.ref }} 24 | body: | 25 | Please refer to [changelog.md](https://github.com/${{ github.repository }}/blob/main/changelog.md) for details. 26 | -------------------------------------------------------------------------------- /.github/workflows/test.yml: -------------------------------------------------------------------------------- 1 | name: test 2 | 3 | on: 4 | push: 5 | branches: 6 | - 'main' 7 | pull_request: 8 | 9 | jobs: 10 | test: 11 | runs-on: ubuntu-latest 12 | strategy: 13 | matrix: 14 | node-version: 15 | - 20 16 | - 18 17 | 18 | steps: 19 | - name: checkout 20 | uses: actions/checkout@v2 21 | 22 | - name: install pnpm 23 | uses: pnpm/action-setup@v2 24 | with: 25 | version: 10 26 | 27 | - name: install node ${{ matrix.node-version }} 28 | uses: actions/setup-node@v3 29 | with: 30 | node-version: ${{ matrix.node-version }} 31 | cache: pnpm 32 | 33 | - name: install dependencies 34 | run: pnpm install --frozen-lockfile --ignore-scripts 35 | 36 | - name: test 37 | run: pnpm run test 38 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Node.js 2 | node_modules/ 3 | 4 | # Build 5 | dist/ 6 | -------------------------------------------------------------------------------- /.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "arrowParens": "avoid", 3 | "bracketSpacing": true, 4 | "endOfLine": "lf", 5 | "printWidth": 80, 6 | "quoteProps": "as-needed", 7 | "semi": false, 8 | "singleQuote": true, 9 | "tabWidth": 2, 10 | "trailingComma": "all", 11 | "useTabs": false 12 | } 13 | -------------------------------------------------------------------------------- /.simple-git-hooks.json: -------------------------------------------------------------------------------- 1 | { 2 | "pre-commit": "pnpm exec nano-staged nano-staged.json", 3 | "commit-msg": "pnpm exec commitlint -e \"$@\"" 4 | } 5 | -------------------------------------------------------------------------------- /changelog.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. 4 | 5 | ## [1.20.0](https://github.com/azat-io/vuepress-plugin-umami-analytics/compare/v1.19.0...v1.20.0) (2025-05-15) 6 | 7 | 8 | ### Features 9 | 10 | * update vuepress to v2.0.0-rc.23 ([ae4be4f](https://github.com/azat-io/vuepress-plugin-umami-analytics/commit/ae4be4ff247063f9b8846b6a10407f060643ecb4)) 11 | 12 | ## [1.19.0](https://github.com/azat-io/vuepress-plugin-umami-analytics/compare/v1.18.0...v1.19.0) (2025-04-30) 13 | 14 | 15 | ### Features 16 | 17 | * update vuepress to v2.0.0-rc.22 ([00b12cb](https://github.com/azat-io/vuepress-plugin-umami-analytics/commit/00b12cb1a0b7cc3fe02fee827c3f36009f7faae8)) 18 | 19 | ## [1.18.0](https://github.com/azat-io/vuepress-plugin-umami-analytics/compare/v1.17.0...v1.18.0) (2025-04-17) 20 | 21 | 22 | ### Features 23 | 24 | * update vuepress to v2.0.0-rc.21 ([08bccd6](https://github.com/azat-io/vuepress-plugin-umami-analytics/commit/08bccd623d86a450ed7ca38f4a06a501aa24c4f7)) 25 | 26 | ## [1.17.0](https://github.com/azat-io/vuepress-plugin-umami-analytics/compare/v1.16.0...v1.17.0) (2025-02-25) 27 | 28 | 29 | ### Features 30 | 31 | * update vuepress to v2.0.0-rc.20 ([4c99565](https://github.com/azat-io/vuepress-plugin-umami-analytics/commit/4c99565a2ad66d77a48ad4af47de0b33674c2d23)) 32 | 33 | ## [1.16.0](https://github.com/azat-io/vuepress-plugin-umami-analytics/compare/v1.15.0...v1.16.0) (2024-12-15) 34 | 35 | 36 | ### Features 37 | 38 | * update vuepress to v2.0.0-rc.19 ([f069867](https://github.com/azat-io/vuepress-plugin-umami-analytics/commit/f069867e35d6760a4406b650012303596e04cd49)) 39 | 40 | ## [1.15.0](https://github.com/azat-io/vuepress-plugin-umami-analytics/compare/v1.14.0...v1.15.0) (2024-10-02) 41 | 42 | 43 | ### Features 44 | 45 | * update vuepress to v2.0.0-rc.17 ([e648d3d](https://github.com/azat-io/vuepress-plugin-umami-analytics/commit/e648d3d4e26b2fadeeed32f473f7f9cb6231bfc7)) 46 | 47 | ## [1.14.0](https://github.com/azat-io/vuepress-plugin-umami-analytics/compare/v1.13.0...v1.14.0) (2024-09-30) 48 | 49 | 50 | ### Features 51 | 52 | * update vuepress to v2.0.0-rc.16 ([8fb122b](https://github.com/azat-io/vuepress-plugin-umami-analytics/commit/8fb122b9e85786104f6ff3c76ef8566d6f569831)) 53 | 54 | ## [1.13.0](https://github.com/azat-io/vuepress-plugin-umami-analytics/compare/v1.12.0...v1.13.0) (2024-08-22) 55 | 56 | 57 | ### Features 58 | 59 | * update vuepress to v2.0.0-rc.15 ([2ad8928](https://github.com/azat-io/vuepress-plugin-umami-analytics/commit/2ad8928c9f1ad38510faf01031c9c39ec5e3056b)) 60 | 61 | ## [1.12.0](https://github.com/azat-io/vuepress-plugin-umami-analytics/compare/v1.11.0...v1.12.0) (2024-07-28) 62 | 63 | 64 | ### Features 65 | 66 | * update vuepress to v2.0.0-rc.14 ([8007b75](https://github.com/azat-io/vuepress-plugin-umami-analytics/commit/8007b7543312734361c7ff086c2fff55eebfee3e)) 67 | 68 | ## [1.11.0](https://github.com/azat-io/vuepress-plugin-umami-analytics/compare/v1.10.0...v1.11.0) (2024-06-05) 69 | 70 | 71 | ### Features 72 | 73 | * update vuepress to v2.0.0-rc.13 ([37ed96c](https://github.com/azat-io/vuepress-plugin-umami-analytics/commit/37ed96cad490a0ef1380cda33aec6d4a0903a55c)) 74 | 75 | ## [1.10.0](https://github.com/azat-io/vuepress-plugin-umami-analytics/compare/v1.9.0...v1.10.0) (2024-05-30) 76 | 77 | 78 | ### Features 79 | 80 | * update vuepress to v2.0.0-rc.12 ([95814c3](https://github.com/azat-io/vuepress-plugin-umami-analytics/commit/95814c360b36b5b0a652d17531204e872e9b8b10)) 81 | 82 | ## [1.9.0](https://github.com/azat-io/vuepress-plugin-umami-analytics/compare/v1.8.1...v1.9.0) (2024-05-04) 83 | 84 | 85 | ### Features 86 | 87 | * update vuepress to v2.0.0-rc.9 ([15b1d75](https://github.com/azat-io/vuepress-plugin-umami-analytics/commit/15b1d754ea36e95832511e7027c48fbca21738d9)) 88 | 89 | ### [1.8.1](https://github.com/azat-io/vuepress-plugin-umami-analytics/compare/v1.8.0...v1.8.1) (2024-02-27) 90 | 91 | 92 | ### Bug Fixes 93 | 94 | * handle potentially undefined variables ([a8e5101](https://github.com/azat-io/vuepress-plugin-umami-analytics/commit/a8e5101cc79e6fff0f3fdc69e59e64d2de9b5294)) 95 | 96 | ## [1.8.0](https://github.com/azat-io/vuepress-plugin-umami-analytics/compare/v1.7.0...v1.8.0) (2024-01-28) 97 | 98 | 99 | ### Features 100 | 101 | * enable tracker configuration ([8fcdd19](https://github.com/azat-io/vuepress-plugin-umami-analytics/commit/8fcdd193dd9e05e8e7bd9ee8ca0a0976113202e6)) 102 | * update vuepress to v2.0.0-rc.2 ([49d657c](https://github.com/azat-io/vuepress-plugin-umami-analytics/commit/49d657ca6bba3b9febc7388349aeaee36b2eb7f7)) 103 | 104 | ## [1.7.0](https://github.com/azat-io/vuepress-plugin-umami-analytics/compare/v1.6.0...v1.7.0) (2023-11-19) 105 | 106 | 107 | ### Features 108 | 109 | * update vuepress to v2.0.0-rc.0 ([8d43d24](https://github.com/azat-io/vuepress-plugin-umami-analytics/commit/8d43d246e39a0ac509d6b10b221b03ba95a8a0d9)) 110 | 111 | ## [1.6.0](https://github.com/azat-io/vuepress-plugin-umami-analytics/compare/v1.5.0...v1.6.0) (2023-11-14) 112 | 113 | 114 | ### Features 115 | 116 | * update vuepress to v2.0.0-beta.68 ([e323ae5](https://github.com/azat-io/vuepress-plugin-umami-analytics/commit/e323ae5b4913a5ffe05d8827297355bd39fd5400)) 117 | 118 | ## [1.5.0](https://github.com/azat-io/vuepress-plugin-umami-analytics/compare/v1.4.0...v1.5.0) (2023-09-20) 119 | 120 | 121 | ### Features 122 | 123 | * update vuepress to v2.0.0-beta.67 ([62068f7](https://github.com/azat-io/vuepress-plugin-umami-analytics/commit/62068f7434e191c8f9ad0b60c1c45e22cb5ca073)) 124 | 125 | ## [1.4.0](https://github.com/azat-io/vuepress-plugin-umami-analytics/compare/v1.3.0...v1.4.0) (2023-07-13) 126 | 127 | 128 | ### Features 129 | 130 | * update vuepress to v2.0.0-beta.66 ([7f2193b](https://github.com/azat-io/vuepress-plugin-umami-analytics/commit/7f2193b57de3b83df4b10932e57a3d095e667f4a)) 131 | 132 | ## [1.3.0](https://github.com/azat-io/vuepress-plugin-umami-analytics/compare/v1.2.0...v1.3.0) (2023-07-01) 133 | 134 | 135 | ### Features 136 | 137 | * update vuepress to v2.0.0-beta.63 ([20cca17](https://github.com/azat-io/vuepress-plugin-umami-analytics/commit/20cca175a6f1deafa2c5b0c30fafacb862f0163c)) 138 | 139 | ## [1.2.0](https://github.com/azat-io/vuepress-plugin-umami-analytics/compare/v1.1.0...v1.2.0) (2023-05-11) 140 | 141 | 142 | ### Features 143 | 144 | * update vuepress ([8d6490e](https://github.com/azat-io/vuepress-plugin-umami-analytics/commit/8d6490ef26e15cfa4bdae1358d4223b79cb3c00d)) 145 | 146 | ## 1.1.0 (2023-04-14) 147 | 148 | 149 | ### Features 150 | 151 | * clean configuration data ([31d3e80](https://github.com/azat-io/vuepress-plugin-umami-analytics/commit/31d3e80ff7833a568135adaa4592b13320d2d16a)) 152 | * drop nodejs v14 support ([b51f2f8](https://github.com/azat-io/vuepress-plugin-umami-analytics/commit/b51f2f8df5bce60b4f4da105605dd2af9a8826fb)) 153 | 154 | ### 1.0.0 (2023-03-02) 155 | 156 | initial release 157 | -------------------------------------------------------------------------------- /client/index.ts: -------------------------------------------------------------------------------- 1 | import { defineClientConfig } from '@vuepress/client' 2 | 3 | declare let __UMAMI_ANALYTICS_ID__: string 4 | declare let __UMAMI_ANALYTICS_SRC__: string 5 | declare let __UMAMI_ANALYTICS_HOST_URL__: undefined | string | null 6 | declare let __UMAMI_ANALYTICS_AUTO_TRACK__: undefined | boolean | null 7 | declare let __UMAMI_ANALYTICS_DO_NOT_TRACK__: undefined | boolean | null 8 | declare let __UMAMI_ANALYTICS_CACHE__: undefined | boolean | null 9 | declare let __UMAMI_ANALYTICS_DOMAINS__: undefined | string[] | null 10 | 11 | export default defineClientConfig({ 12 | enhance: () => { 13 | if (__VUEPRESS_SSR__) { 14 | return 15 | } 16 | 17 | let scriptTag = document.createElement('script') 18 | scriptTag.async = true 19 | scriptTag.src = __UMAMI_ANALYTICS_SRC__ 20 | scriptTag.dataset.websiteId = __UMAMI_ANALYTICS_ID__ 21 | if (__UMAMI_ANALYTICS_HOST_URL__) { 22 | scriptTag.dataset.hostUrl = __UMAMI_ANALYTICS_HOST_URL__ 23 | } 24 | if (__UMAMI_ANALYTICS_AUTO_TRACK__) { 25 | scriptTag.dataset.autoTrack = `${__UMAMI_ANALYTICS_AUTO_TRACK__}` 26 | } 27 | if (__UMAMI_ANALYTICS_DO_NOT_TRACK__) { 28 | scriptTag.dataset.doNotTrack = `${__UMAMI_ANALYTICS_DO_NOT_TRACK__}` 29 | } 30 | if (__UMAMI_ANALYTICS_CACHE__) { 31 | scriptTag.dataset.cache = `${__UMAMI_ANALYTICS_CACHE__}` 32 | } 33 | if (__UMAMI_ANALYTICS_DOMAINS__) { 34 | scriptTag.dataset.domains = __UMAMI_ANALYTICS_DOMAINS__.join(',') 35 | } 36 | document.body.append(scriptTag) 37 | }, 38 | }) 39 | -------------------------------------------------------------------------------- /eslint.config.ts: -------------------------------------------------------------------------------- 1 | import type { Linter } from 'eslint' 2 | 3 | import eslintConfig from '@azat-io/eslint-config' 4 | 5 | export default eslintConfig({ 6 | perfectionist: true, 7 | typescript: true, 8 | vitest: true, 9 | node: true, 10 | }) satisfies Promise 11 | -------------------------------------------------------------------------------- /index.ts: -------------------------------------------------------------------------------- 1 | export * from './server/index.js' 2 | -------------------------------------------------------------------------------- /license: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright 2022 Azat S. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | this software and associated documentation files (the "Software"), to deal in 7 | the Software without restriction, including without limitation the rights to 8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | the Software, and to permit persons to whom the Software is furnished to do so, 10 | subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | 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, FITNESS 17 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "vuepress-plugin-umami-analytics", 3 | "version": "1.20.0", 4 | "description": "VuePress plugin for using Umami analytics", 5 | "keywords": [ 6 | "analytics", 7 | "umami", 8 | "vuepress", 9 | "vuepress2", 10 | "vuepress-plugin" 11 | ], 12 | "repository": "azat-io/vuepress-plugin-umami-analytics", 13 | "license": "MIT", 14 | "author": "Azat S. ", 15 | "type": "module", 16 | "exports": { 17 | ".": "./dist/index.js" 18 | }, 19 | "main": "./dist/index.js", 20 | "types": "./dist/index.d.ts", 21 | "files": [ 22 | "dist" 23 | ], 24 | "scripts": { 25 | "build": "tsc -b", 26 | "clean": "node -e \"fs.rmSync('./dist', { recursive: true, force: true })\"", 27 | "release": "pnpm release:check && pnpm release:version && pnpm release:publish", 28 | "release:changelog": "standard-version --infile changelog.md --same-file --skip.bump --skip.commit --skip.tag", 29 | "release:check": "pnpm test && pnpm build", 30 | "release:publish": "clean-publish", 31 | "release:version": "bumpp package.json --execute=\"pnpm release:changelog && git add changelog.md\" --commit \"build: publish v%s\" --tag --all", 32 | "start": "tsc -b --watch", 33 | "test": "pnpm run /^test:/", 34 | "test:js": "eslint .", 35 | "test:packages": "pnpm dedupe --check", 36 | "test:types": "tsc --noEmit --pretty" 37 | }, 38 | "dependencies": { 39 | "@vuepress/client": "2.0.0-rc.23", 40 | "@vuepress/core": "2.0.0-rc.23", 41 | "@vuepress/utils": "2.0.0-rc.23" 42 | }, 43 | "devDependencies": { 44 | "@azat-io/eslint-config": "^2.25.0", 45 | "bumpp": "^10.1.0", 46 | "clean-publish": "^5.1.0", 47 | "eslint": "^9.24.0", 48 | "standard-version": "^9.5.0", 49 | "typescript": "^5.8.3" 50 | }, 51 | "engines": { 52 | "node": "^16.0.0 || >=18.0.0" 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | # vuepress-plugin-umami-analytics 2 | 3 | VuePress 4 | 5 | [![Version](https://img.shields.io/npm/v/vuepress-plugin-umami-analytics.svg?color=4fb17b&labelColor=2a2f44)](https://npmjs.com/package/vuepress-plugin-umami-analytics) 6 | [![Monthly Download](https://img.shields.io/npm/dm/vuepress-plugin-umami-analytics.svg?color=4fb17b&labelColor=2a2f44)](https://npmjs.com/package/vuepress-plugin-umami-analytics) 7 | [![GitHub License](https://img.shields.io/badge/license-MIT-4fb17b.svg?color=4fb17b&labelColor=2a2f44)](https://github.com/azat-io/eslint-plugin-de-morgan/blob/main/license.md) 8 | 9 | VuePress v2 plugin for injecting [Umami](https://umami.is) analytics script into your app code. Umami is a self-hosted, privacy-friendly alternative to Google Analytics. 10 | 11 | ## Installation 12 | 13 | ```sh 14 | npm install --save vuepress-plugin-umami-analytics 15 | ``` 16 | 17 | ## Usage 18 | 19 | Add plugin to your VuePress config: 20 | 21 | ```js 22 | import { umamiAnalyticsPlugin } from 'vuepress-plugin-umami-analytics' 23 | 24 | let isProd = process.env.NODE_ENV === 'production' 25 | 26 | export default { 27 | plugins: [ 28 | isProd 29 | ? umamiAnalyticsPlugin({ 30 | /* options */ 31 | }) 32 | : [], 33 | ], 34 | } 35 | ``` 36 | 37 | ## Options 38 | 39 | For more details on the configuration of the tracker, see the [official documentation](https://umami.is/docs/tracker-configuration). 40 | 41 | ### id 42 | 43 | - Type: `string` 44 | 45 | - Required: `true` 46 | 47 | - Details: 48 | 49 | Add website to Umami analytics and get parameters from tracking code. Put data-website-id here. 50 | 51 | ### src 52 | 53 | - Type: `string` 54 | 55 | - Required: `true` 56 | 57 | - Details: 58 | 59 | Link to Umami analytics script. 60 | 61 | ### hostUrl 62 | 63 | - Type: `string` 64 | 65 | - Required: `false` 66 | 67 | - Default value: `null` 68 | 69 | - Details: 70 | 71 | Send data to this host instead of the one where the script is located. 72 | 73 | ### autoTrack 74 | 75 | - Type: `boolean` 76 | 77 | - Required: `false` 78 | 79 | - Default value: `true` 80 | 81 | - Details: 82 | 83 | Set to false to disable tracking all pageviews and events. 84 | 85 | ### doNotTrack 86 | 87 | - Type: `boolean` 88 | 89 | - Required: `false` 90 | 91 | - Default value: `false` 92 | 93 | - Details: 94 | 95 | Whether to respect the browser's Do Not Track setting. 96 | 97 | ### cache 98 | 99 | - Type: `boolean` 100 | 101 | - Required: `false` 102 | 103 | - Default value: `false` 104 | 105 | - Details: 106 | 107 | Whether to cache some data to improve performance. Be careful, it will use session storage, you may have to inform your users. 108 | 109 | ### domains 110 | 111 | - Type: `string[]` 112 | 113 | - Required: `false` 114 | 115 | - Default value: `null` 116 | 117 | - Details: 118 | 119 | Only run the tracker on the domains specified. With a `null` value, tracker is active everywhere. 120 | 121 | ![Umami tracking code](https://user-images.githubusercontent.com/5698350/190417132-fcedc6cb-636d-4634-a682-837a6f56c797.png) 122 | 123 | ## Contribution 124 | 125 | Pull requests are welcome. 126 | -------------------------------------------------------------------------------- /server/index.ts: -------------------------------------------------------------------------------- 1 | import type { Plugin } from '@vuepress/core' 2 | 3 | import { getDirname, path } from '@vuepress/utils' 4 | 5 | interface UmamiAnalyticsPluginOptions { 6 | doNotTrack?: boolean 7 | autoTrack?: boolean 8 | domains?: string[] 9 | hostUrl?: string 10 | cache?: boolean 11 | src: string 12 | id: string 13 | } 14 | 15 | let __dirname = getDirname(import.meta.url) 16 | 17 | export let umamiAnalyticsPlugin = 18 | ({ 19 | doNotTrack, 20 | autoTrack, 21 | hostUrl, 22 | domains, 23 | cache, 24 | src, 25 | id, 26 | }: UmamiAnalyticsPluginOptions): Plugin => 27 | app => { 28 | let plugin = { 29 | name: 'vuepress-plugin-umami-analytics', 30 | } 31 | 32 | if (app.env.isDev) { 33 | return plugin 34 | } 35 | 36 | return { 37 | ...plugin, 38 | define: { 39 | __UMAMI_ANALYTICS_DO_NOT_TRACK__: doNotTrack, 40 | __UMAMI_ANALYTICS_AUTO_TRACK__: autoTrack, 41 | __UMAMI_ANALYTICS_HOST_URL__: hostUrl, 42 | __UMAMI_ANALYTICS_DOMAINS__: domains, 43 | __UMAMI_ANALYTICS_CACHE__: cache, 44 | __UMAMI_ANALYTICS_SRC__: src, 45 | __UMAMI_ANALYTICS_ID__: id, 46 | }, 47 | clientConfigFile: path.resolve(__dirname, '../client/index.js'), 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "forceConsistentCasingInFileNames": true, 4 | "types": ["@vuepress/client/types"], 5 | "moduleResolution": "bundler", 6 | "verbatimModuleSyntax": true, 7 | "resolveJsonModule": true, 8 | "isolatedModules": true, 9 | "esModuleInterop": true, 10 | "skipLibCheck": true, 11 | "declaration": true, 12 | "module": "esnext", 13 | "target": "es2020", 14 | "outDir": "./dist", 15 | "jsx": "preserve", 16 | "rootDir": "./", 17 | "noEmit": false, 18 | "allowJs": true, 19 | "strict": true, 20 | "baseUrl": "." 21 | }, 22 | "include": ["./**/*"], 23 | "exclude": ["./dist"] 24 | } 25 | --------------------------------------------------------------------------------