@docusaurus/preset-classic 3.10.1-canary-6655 → 3.10.2
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.js +6 -9
- package/lib/options.d.ts +6 -0
- package/package.json +20 -19
- package/src/index.ts +8 -9
- package/src/options.ts +6 -0
package/lib/index.js
CHANGED
|
@@ -18,7 +18,7 @@ function preset(context, opts = {}) {
|
|
|
18
18
|
const { themeConfig } = siteConfig;
|
|
19
19
|
const { algolia } = themeConfig;
|
|
20
20
|
const isProd = process.env.NODE_ENV === 'production';
|
|
21
|
-
const { debug, docs, blog, pages, sitemap, svgr, theme, gtag, googleTagManager, ...rest } = opts;
|
|
21
|
+
const { debug, docs, blog, pages, sitemap, svgr, theme, googleAnalytics, gtag, googleTagManager, ...rest } = opts;
|
|
22
22
|
const themes = [];
|
|
23
23
|
themes.push(makePluginConfig('@docusaurus/theme-classic', theme));
|
|
24
24
|
if (algolia) {
|
|
@@ -27,14 +27,8 @@ function preset(context, opts = {}) {
|
|
|
27
27
|
if ('gtag' in themeConfig) {
|
|
28
28
|
throw new Error('The "gtag" field in themeConfig should now be specified as option for plugin-google-gtag. For preset-classic, simply move themeConfig.gtag to preset options. More information at https://github.com/facebook/docusaurus/pull/5832.');
|
|
29
29
|
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
throw new Error(`In Docusaurus v4, the Google Analytics plugin has been removed.
|
|
33
|
-
You can now use either:
|
|
34
|
-
- @docusaurus/plugin-google-gtag - presetOptions.gtag
|
|
35
|
-
- @docusaurus/plugin-google-tag-manager - presetOptions.googleTagManager
|
|
36
|
-
|
|
37
|
-
See also: https://github.com/facebook/docusaurus/issues/7221`);
|
|
30
|
+
if ('googleAnalytics' in themeConfig) {
|
|
31
|
+
throw new Error('The "googleAnalytics" field in themeConfig should now be specified as option for plugin-google-analytics. For preset-classic, simply move themeConfig.googleAnalytics to preset options. More information at https://github.com/facebook/docusaurus/pull/5832.');
|
|
38
32
|
}
|
|
39
33
|
const plugins = [];
|
|
40
34
|
// TODO Docusaurus v4: temporary due to the opt-in flag
|
|
@@ -51,6 +45,9 @@ See also: https://github.com/facebook/docusaurus/issues/7221`);
|
|
|
51
45
|
if (pages !== false) {
|
|
52
46
|
plugins.push(makePluginConfig('@docusaurus/plugin-content-pages', pages));
|
|
53
47
|
}
|
|
48
|
+
if (googleAnalytics) {
|
|
49
|
+
plugins.push(makePluginConfig('@docusaurus/plugin-google-analytics', googleAnalytics));
|
|
50
|
+
}
|
|
54
51
|
if (debug || (debug === undefined && !isProd)) {
|
|
55
52
|
plugins.push(require.resolve('@docusaurus/plugin-debug'));
|
|
56
53
|
}
|
package/lib/options.d.ts
CHANGED
|
@@ -9,6 +9,7 @@ import type { Options as BlogPluginOptions } from '@docusaurus/plugin-content-bl
|
|
|
9
9
|
import type { Options as PagesPluginOptions } from '@docusaurus/plugin-content-pages';
|
|
10
10
|
import type { Options as SitemapPluginOptions } from '@docusaurus/plugin-sitemap';
|
|
11
11
|
import type { Options as SVGRPluginOptions } from '@docusaurus/plugin-svgr';
|
|
12
|
+
import type { Options as GAPluginOptions } from '@docusaurus/plugin-google-analytics';
|
|
12
13
|
import type { Options as GtagPluginOptions } from '@docusaurus/plugin-google-gtag';
|
|
13
14
|
import type { Options as GTMPluginOptions } from '@docusaurus/plugin-google-tag-manager';
|
|
14
15
|
import type { Options as ThemeOptions } from '@docusaurus/theme-classic';
|
|
@@ -33,6 +34,11 @@ export type Options = {
|
|
|
33
34
|
svgr?: false | SVGRPluginOptions;
|
|
34
35
|
/** Options for `@docusaurus/theme-classic`. */
|
|
35
36
|
theme?: ThemeOptions;
|
|
37
|
+
/**
|
|
38
|
+
* Options for `@docusaurus/plugin-google-analytics`. Only enabled when the
|
|
39
|
+
* key is present.
|
|
40
|
+
*/
|
|
41
|
+
googleAnalytics?: GAPluginOptions;
|
|
36
42
|
/**
|
|
37
43
|
* Options for `@docusaurus/plugin-google-gtag`. Only enabled when the key
|
|
38
44
|
* is present.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@docusaurus/preset-classic",
|
|
3
|
-
"version": "3.10.
|
|
3
|
+
"version": "3.10.2",
|
|
4
4
|
"description": "Classic preset for Docusaurus.",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -18,27 +18,28 @@
|
|
|
18
18
|
},
|
|
19
19
|
"license": "MIT",
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@docusaurus/core": "3.10.
|
|
22
|
-
"@docusaurus/plugin-content-blog": "3.10.
|
|
23
|
-
"@docusaurus/plugin-content-docs": "3.10.
|
|
24
|
-
"@docusaurus/plugin-content-pages": "3.10.
|
|
25
|
-
"@docusaurus/plugin-css-cascade-layers": "3.10.
|
|
26
|
-
"@docusaurus/plugin-debug": "3.10.
|
|
27
|
-
"@docusaurus/plugin-google-
|
|
28
|
-
"@docusaurus/plugin-google-
|
|
29
|
-
"@docusaurus/plugin-
|
|
30
|
-
"@docusaurus/plugin-
|
|
31
|
-
"@docusaurus/
|
|
32
|
-
"@docusaurus/theme-
|
|
33
|
-
"@docusaurus/theme-
|
|
34
|
-
"@docusaurus/
|
|
21
|
+
"@docusaurus/core": "3.10.2",
|
|
22
|
+
"@docusaurus/plugin-content-blog": "3.10.2",
|
|
23
|
+
"@docusaurus/plugin-content-docs": "3.10.2",
|
|
24
|
+
"@docusaurus/plugin-content-pages": "3.10.2",
|
|
25
|
+
"@docusaurus/plugin-css-cascade-layers": "3.10.2",
|
|
26
|
+
"@docusaurus/plugin-debug": "3.10.2",
|
|
27
|
+
"@docusaurus/plugin-google-analytics": "3.10.2",
|
|
28
|
+
"@docusaurus/plugin-google-gtag": "3.10.2",
|
|
29
|
+
"@docusaurus/plugin-google-tag-manager": "3.10.2",
|
|
30
|
+
"@docusaurus/plugin-sitemap": "3.10.2",
|
|
31
|
+
"@docusaurus/plugin-svgr": "3.10.2",
|
|
32
|
+
"@docusaurus/theme-classic": "3.10.2",
|
|
33
|
+
"@docusaurus/theme-common": "3.10.2",
|
|
34
|
+
"@docusaurus/theme-search-algolia": "3.10.2",
|
|
35
|
+
"@docusaurus/types": "3.10.2"
|
|
35
36
|
},
|
|
36
37
|
"peerDependencies": {
|
|
37
|
-
"react": "^19.
|
|
38
|
-
"react-dom": "^19.
|
|
38
|
+
"react": "^18.0.0 || ^19.0.0",
|
|
39
|
+
"react-dom": "^18.0.0 || ^19.0.0"
|
|
39
40
|
},
|
|
40
41
|
"engines": {
|
|
41
|
-
"node": ">=
|
|
42
|
+
"node": ">=20.0"
|
|
42
43
|
},
|
|
43
|
-
"gitHead": "
|
|
44
|
+
"gitHead": "f37f9035584917a97a260b91fc2842cba4f8b94f"
|
|
44
45
|
}
|
package/src/index.ts
CHANGED
|
@@ -39,6 +39,7 @@ export default function preset(
|
|
|
39
39
|
sitemap,
|
|
40
40
|
svgr,
|
|
41
41
|
theme,
|
|
42
|
+
googleAnalytics,
|
|
42
43
|
gtag,
|
|
43
44
|
googleTagManager,
|
|
44
45
|
...rest
|
|
@@ -54,16 +55,9 @@ export default function preset(
|
|
|
54
55
|
'The "gtag" field in themeConfig should now be specified as option for plugin-google-gtag. For preset-classic, simply move themeConfig.gtag to preset options. More information at https://github.com/facebook/docusaurus/pull/5832.',
|
|
55
56
|
);
|
|
56
57
|
}
|
|
57
|
-
|
|
58
|
-
// TODO Docusaurus v5: remove
|
|
59
|
-
if ('googleAnalytics' in opts || 'googleAnalytics' in themeConfig) {
|
|
58
|
+
if ('googleAnalytics' in themeConfig) {
|
|
60
59
|
throw new Error(
|
|
61
|
-
|
|
62
|
-
You can now use either:
|
|
63
|
-
- @docusaurus/plugin-google-gtag - presetOptions.gtag
|
|
64
|
-
- @docusaurus/plugin-google-tag-manager - presetOptions.googleTagManager
|
|
65
|
-
|
|
66
|
-
See also: https://github.com/facebook/docusaurus/issues/7221`,
|
|
60
|
+
'The "googleAnalytics" field in themeConfig should now be specified as option for plugin-google-analytics. For preset-classic, simply move themeConfig.googleAnalytics to preset options. More information at https://github.com/facebook/docusaurus/pull/5832.',
|
|
67
61
|
);
|
|
68
62
|
}
|
|
69
63
|
|
|
@@ -84,6 +78,11 @@ See also: https://github.com/facebook/docusaurus/issues/7221`,
|
|
|
84
78
|
if (pages !== false) {
|
|
85
79
|
plugins.push(makePluginConfig('@docusaurus/plugin-content-pages', pages));
|
|
86
80
|
}
|
|
81
|
+
if (googleAnalytics) {
|
|
82
|
+
plugins.push(
|
|
83
|
+
makePluginConfig('@docusaurus/plugin-google-analytics', googleAnalytics),
|
|
84
|
+
);
|
|
85
|
+
}
|
|
87
86
|
if (debug || (debug === undefined && !isProd)) {
|
|
88
87
|
plugins.push(require.resolve('@docusaurus/plugin-debug'));
|
|
89
88
|
}
|
package/src/options.ts
CHANGED
|
@@ -10,6 +10,7 @@ import type {Options as BlogPluginOptions} from '@docusaurus/plugin-content-blog
|
|
|
10
10
|
import type {Options as PagesPluginOptions} from '@docusaurus/plugin-content-pages';
|
|
11
11
|
import type {Options as SitemapPluginOptions} from '@docusaurus/plugin-sitemap';
|
|
12
12
|
import type {Options as SVGRPluginOptions} from '@docusaurus/plugin-svgr';
|
|
13
|
+
import type {Options as GAPluginOptions} from '@docusaurus/plugin-google-analytics';
|
|
13
14
|
import type {Options as GtagPluginOptions} from '@docusaurus/plugin-google-gtag';
|
|
14
15
|
import type {Options as GTMPluginOptions} from '@docusaurus/plugin-google-tag-manager';
|
|
15
16
|
import type {Options as ThemeOptions} from '@docusaurus/theme-classic';
|
|
@@ -35,6 +36,11 @@ export type Options = {
|
|
|
35
36
|
svgr?: false | SVGRPluginOptions;
|
|
36
37
|
/** Options for `@docusaurus/theme-classic`. */
|
|
37
38
|
theme?: ThemeOptions;
|
|
39
|
+
/**
|
|
40
|
+
* Options for `@docusaurus/plugin-google-analytics`. Only enabled when the
|
|
41
|
+
* key is present.
|
|
42
|
+
*/
|
|
43
|
+
googleAnalytics?: GAPluginOptions;
|
|
38
44
|
/**
|
|
39
45
|
* Options for `@docusaurus/plugin-google-gtag`. Only enabled when the key
|
|
40
46
|
* is present.
|