rsbuild-plugin-google-analytics 1.0.1 → 1.0.3
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/README.md +6 -4
- package/dist/index.cjs +5 -1
- package/dist/index.d.cts +9 -1
- package/dist/index.d.ts +9 -1
- package/dist/index.js +5 -1
- package/package.json +7 -8
package/README.md
CHANGED
|
@@ -6,7 +6,8 @@ An Rsbuild plugin to setup Google Analytics in your website.
|
|
|
6
6
|
<a href="https://npmjs.com/package/rsbuild-plugin-google-analytics">
|
|
7
7
|
<img src="https://img.shields.io/npm/v/rsbuild-plugin-google-analytics?style=flat-square&colorA=564341&colorB=EDED91" alt="npm version" />
|
|
8
8
|
</a>
|
|
9
|
-
|
|
9
|
+
<img src="https://img.shields.io/badge/License-MIT-blue.svg?style=flat-square&colorA=564341&colorB=EDED91" alt="license" />
|
|
10
|
+
<a href="https://npmcharts.com/compare/rsbuild-plugin-google-analytics?minimal=true"><img src="https://img.shields.io/npm/dm/rsbuild-plugin-google-analytics.svg?style=flat-square&colorA=564341&colorB=EDED91" alt="downloads" /></a>
|
|
10
11
|
</p>
|
|
11
12
|
|
|
12
13
|
## Usage
|
|
@@ -38,9 +39,10 @@ export default {
|
|
|
38
39
|
|
|
39
40
|
Here are the available options:
|
|
40
41
|
|
|
41
|
-
| Name
|
|
42
|
-
|
|
|
43
|
-
| id
|
|
42
|
+
| Name | Type | Description | Defaults |
|
|
43
|
+
| ------ | --------- | ---------------------------------- | ----------- |
|
|
44
|
+
| id | `string` | Google tag ID | `undefined` |
|
|
45
|
+
| enable | `boolean` | Whether to enable Google Analytics | `true` |
|
|
44
46
|
|
|
45
47
|
## License
|
|
46
48
|
|
package/dist/index.cjs
CHANGED
|
@@ -24,10 +24,14 @@ __export(src_exports, {
|
|
|
24
24
|
});
|
|
25
25
|
module.exports = __toCommonJS(src_exports);
|
|
26
26
|
var pluginGoogleAnalytics = ({
|
|
27
|
-
id
|
|
27
|
+
id,
|
|
28
|
+
enable = true
|
|
28
29
|
}) => ({
|
|
29
30
|
name: "rsbuild-plugin-google-analytics",
|
|
30
31
|
setup(api) {
|
|
32
|
+
if (!enable) {
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
31
35
|
if (!id) {
|
|
32
36
|
throw new Error(
|
|
33
37
|
"[rsbuild-plugin-google-analytics] Google tag ID is required!"
|
package/dist/index.d.cts
CHANGED
|
@@ -1,8 +1,16 @@
|
|
|
1
1
|
import { RsbuildPlugin } from '@rsbuild/core';
|
|
2
2
|
|
|
3
3
|
type PluginGoogleAnalyticsOptions = {
|
|
4
|
+
/**
|
|
5
|
+
* Google tag ID.
|
|
6
|
+
*/
|
|
4
7
|
id: string;
|
|
8
|
+
/**
|
|
9
|
+
* Whether to enable Google Analytics.
|
|
10
|
+
* @default true
|
|
11
|
+
*/
|
|
12
|
+
enable?: boolean;
|
|
5
13
|
};
|
|
6
|
-
declare const pluginGoogleAnalytics: ({ id, }: PluginGoogleAnalyticsOptions) => RsbuildPlugin;
|
|
14
|
+
declare const pluginGoogleAnalytics: ({ id, enable, }: PluginGoogleAnalyticsOptions) => RsbuildPlugin;
|
|
7
15
|
|
|
8
16
|
export { type PluginGoogleAnalyticsOptions, pluginGoogleAnalytics };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,16 @@
|
|
|
1
1
|
import { RsbuildPlugin } from '@rsbuild/core';
|
|
2
2
|
|
|
3
3
|
type PluginGoogleAnalyticsOptions = {
|
|
4
|
+
/**
|
|
5
|
+
* Google tag ID.
|
|
6
|
+
*/
|
|
4
7
|
id: string;
|
|
8
|
+
/**
|
|
9
|
+
* Whether to enable Google Analytics.
|
|
10
|
+
* @default true
|
|
11
|
+
*/
|
|
12
|
+
enable?: boolean;
|
|
5
13
|
};
|
|
6
|
-
declare const pluginGoogleAnalytics: ({ id, }: PluginGoogleAnalyticsOptions) => RsbuildPlugin;
|
|
14
|
+
declare const pluginGoogleAnalytics: ({ id, enable, }: PluginGoogleAnalyticsOptions) => RsbuildPlugin;
|
|
7
15
|
|
|
8
16
|
export { type PluginGoogleAnalyticsOptions, pluginGoogleAnalytics };
|
package/dist/index.js
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
// src/index.ts
|
|
2
2
|
var pluginGoogleAnalytics = ({
|
|
3
|
-
id
|
|
3
|
+
id,
|
|
4
|
+
enable = true
|
|
4
5
|
}) => ({
|
|
5
6
|
name: "rsbuild-plugin-google-analytics",
|
|
6
7
|
setup(api) {
|
|
8
|
+
if (!enable) {
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
7
11
|
if (!id) {
|
|
8
12
|
throw new Error(
|
|
9
13
|
"[rsbuild-plugin-google-analytics] Google tag ID is required!"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rsbuild-plugin-google-analytics",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"repository": "https://github.com/rspack-contrib/rsbuild-plugin-google-analytics",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -18,21 +18,20 @@
|
|
|
18
18
|
"dist"
|
|
19
19
|
],
|
|
20
20
|
"devDependencies": {
|
|
21
|
-
"@rsbuild/core": "^0.
|
|
22
|
-
"@types/node": "^20.
|
|
23
|
-
"prettier": "^3.
|
|
24
|
-
"tsup": "^8.
|
|
25
|
-
"typescript": "^5.
|
|
21
|
+
"@rsbuild/core": "^1.0.4",
|
|
22
|
+
"@types/node": "^20.16.5",
|
|
23
|
+
"prettier": "^3.3.3",
|
|
24
|
+
"tsup": "^8.2.4",
|
|
25
|
+
"typescript": "^5.6.2"
|
|
26
26
|
},
|
|
27
27
|
"peerDependencies": {
|
|
28
|
-
"@rsbuild/core": "0.x || 1.x"
|
|
28
|
+
"@rsbuild/core": "0.x || 1.x || ^1.0.1-beta.0"
|
|
29
29
|
},
|
|
30
30
|
"peerDependenciesMeta": {
|
|
31
31
|
"@rsbuild/core": {
|
|
32
32
|
"optional": true
|
|
33
33
|
}
|
|
34
34
|
},
|
|
35
|
-
"packageManager": "pnpm@8.15.2",
|
|
36
35
|
"publishConfig": {
|
|
37
36
|
"access": "public",
|
|
38
37
|
"registry": "https://registry.npmjs.org/"
|