@docusaurus/plugin-google-tag-manager 0.0.0-5990 → 0.0.0-5994

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/index.d.ts CHANGED
@@ -6,6 +6,6 @@
6
6
  */
7
7
  import type { LoadContext, Plugin, OptionValidationContext } from '@docusaurus/types';
8
8
  import type { PluginOptions, Options } from './options';
9
- export default function pluginGoogleAnalytics(context: LoadContext, options: PluginOptions): Plugin;
9
+ export default function pluginGoogleAnalytics(context: LoadContext, options: PluginOptions): Plugin | null;
10
10
  export declare function validateOptions({ validate, options, }: OptionValidationContext<Options, PluginOptions>): PluginOptions;
11
11
  export type { PluginOptions, Options };
package/lib/index.js CHANGED
@@ -10,17 +10,16 @@ exports.default = pluginGoogleAnalytics;
10
10
  exports.validateOptions = validateOptions;
11
11
  const utils_validation_1 = require("@docusaurus/utils-validation");
12
12
  function pluginGoogleAnalytics(context, options) {
13
+ if (process.env.NODE_ENV !== 'production') {
14
+ return null;
15
+ }
13
16
  const { containerId } = options;
14
- const isProd = process.env.NODE_ENV === 'production';
15
17
  return {
16
18
  name: 'docusaurus-plugin-google-tag-manager',
17
19
  contentLoaded({ actions }) {
18
20
  actions.setGlobalData(options);
19
21
  },
20
22
  injectHtmlTags() {
21
- if (!isProd) {
22
- return {};
23
- }
24
23
  return {
25
24
  preBodyTags: [
26
25
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@docusaurus/plugin-google-tag-manager",
3
- "version": "0.0.0-5990",
3
+ "version": "0.0.0-5994",
4
4
  "description": "Google Tag Manager (gtm.js) plugin for Docusaurus.",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -18,9 +18,9 @@
18
18
  },
19
19
  "license": "MIT",
20
20
  "dependencies": {
21
- "@docusaurus/core": "0.0.0-5990",
22
- "@docusaurus/types": "0.0.0-5990",
23
- "@docusaurus/utils-validation": "0.0.0-5990",
21
+ "@docusaurus/core": "0.0.0-5994",
22
+ "@docusaurus/types": "0.0.0-5994",
23
+ "@docusaurus/utils-validation": "0.0.0-5994",
24
24
  "tslib": "^2.6.0"
25
25
  },
26
26
  "peerDependencies": {
@@ -30,5 +30,5 @@
30
30
  "engines": {
31
31
  "node": ">=18.0"
32
32
  },
33
- "gitHead": "2de345260f1a6ff1e5f0f9e0b3c72b3cd49fc05a"
33
+ "gitHead": "4905b76b4b39c2f102bbc78d018933f57ea39b78"
34
34
  }
package/src/index.ts CHANGED
@@ -16,10 +16,12 @@ import type {PluginOptions, Options} from './options';
16
16
  export default function pluginGoogleAnalytics(
17
17
  context: LoadContext,
18
18
  options: PluginOptions,
19
- ): Plugin {
20
- const {containerId} = options;
21
- const isProd = process.env.NODE_ENV === 'production';
19
+ ): Plugin | null {
20
+ if (process.env.NODE_ENV !== 'production') {
21
+ return null;
22
+ }
22
23
 
24
+ const {containerId} = options;
23
25
  return {
24
26
  name: 'docusaurus-plugin-google-tag-manager',
25
27
 
@@ -28,9 +30,6 @@ export default function pluginGoogleAnalytics(
28
30
  },
29
31
 
30
32
  injectHtmlTags() {
31
- if (!isProd) {
32
- return {};
33
- }
34
33
  return {
35
34
  preBodyTags: [
36
35
  {