@callstack/rspress-preset 0.4.3 → 0.4.5
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/dist/index.cjs +25 -2
- package/dist/index.js +25 -2
- package/package.json +6 -6
package/dist/index.cjs
CHANGED
|
@@ -109,6 +109,8 @@ function validatePresetOptions(options) {
|
|
|
109
109
|
}
|
|
110
110
|
return result.data;
|
|
111
111
|
}
|
|
112
|
+
const CALLSTACK_BASE_URL = 'https://www.callstack.com';
|
|
113
|
+
const CALLSTACK_CONTACT_URL = 'https://www.callstack.com/contact';
|
|
112
114
|
const preset_filename = external_node_url_default().fileURLToPath(__rslib_import_meta_url__);
|
|
113
115
|
const preset_dirname = external_node_path_default().dirname(preset_filename);
|
|
114
116
|
function createSocialLinks(socials) {
|
|
@@ -127,12 +129,33 @@ function extractXHandle(profileUrl) {
|
|
|
127
129
|
throw new Error('Failed to extract X handle from X profile URL');
|
|
128
130
|
}
|
|
129
131
|
}
|
|
132
|
+
function addUTMParameters(url, location, siteTitle) {
|
|
133
|
+
const urlObj = new URL(url);
|
|
134
|
+
urlObj.searchParams.set('utm_campaign', 'open_source');
|
|
135
|
+
urlObj.searchParams.set('utm_source', siteTitle);
|
|
136
|
+
urlObj.searchParams.set('utm_medium', 'documentation');
|
|
137
|
+
urlObj.searchParams.set('utm_content', location);
|
|
138
|
+
return urlObj.toString();
|
|
139
|
+
}
|
|
130
140
|
const createPreset = (config)=>{
|
|
131
|
-
var _docs_socials, _docs_socials1;
|
|
132
|
-
const { context, docs,
|
|
141
|
+
var _config_theme, _docs_socials, _docs_socials1;
|
|
142
|
+
const { context, docs, vercelAnalytics } = config;
|
|
133
143
|
const rootDir = external_node_path_default().join(context, docs.rootDir ?? 'docs');
|
|
134
144
|
const enableVercel = void 0 === vercelAnalytics ? external_node_fs_default().existsSync(external_node_path_default().join(context, 'vercel.json')) : Boolean(vercelAnalytics);
|
|
135
145
|
const vercelOptions = 'object' == typeof vercelAnalytics ? vercelAnalytics : {};
|
|
146
|
+
const defaultLinks = {
|
|
147
|
+
docFooterCTA: addUTMParameters(CALLSTACK_CONTACT_URL, 'FOOTER_CTA', docs.title),
|
|
148
|
+
homeBanner: addUTMParameters(CALLSTACK_CONTACT_URL, 'HOME_BANNER', docs.title),
|
|
149
|
+
homeFooter: CALLSTACK_BASE_URL,
|
|
150
|
+
outlineCTA: addUTMParameters(CALLSTACK_CONTACT_URL, 'OUTLINE_CTA', docs.title)
|
|
151
|
+
};
|
|
152
|
+
const theme = {
|
|
153
|
+
...config.theme,
|
|
154
|
+
links: {
|
|
155
|
+
...defaultLinks,
|
|
156
|
+
...null == (_config_theme = config.theme) ? void 0 : _config_theme.links
|
|
157
|
+
}
|
|
158
|
+
};
|
|
136
159
|
return (0, core_namespaceObject.defineConfig)({
|
|
137
160
|
root: rootDir,
|
|
138
161
|
title: docs.title,
|
package/dist/index.js
CHANGED
|
@@ -66,6 +66,8 @@ function validatePresetOptions(options) {
|
|
|
66
66
|
}
|
|
67
67
|
return result.data;
|
|
68
68
|
}
|
|
69
|
+
const CALLSTACK_BASE_URL = 'https://www.callstack.com';
|
|
70
|
+
const CALLSTACK_CONTACT_URL = 'https://www.callstack.com/contact';
|
|
69
71
|
const preset_filename = node_url.fileURLToPath(import.meta.url);
|
|
70
72
|
const preset_dirname = node_path.dirname(preset_filename);
|
|
71
73
|
function createSocialLinks(socials) {
|
|
@@ -84,12 +86,33 @@ function extractXHandle(profileUrl) {
|
|
|
84
86
|
throw new Error('Failed to extract X handle from X profile URL');
|
|
85
87
|
}
|
|
86
88
|
}
|
|
89
|
+
function addUTMParameters(url, location, siteTitle) {
|
|
90
|
+
const urlObj = new URL(url);
|
|
91
|
+
urlObj.searchParams.set('utm_campaign', 'open_source');
|
|
92
|
+
urlObj.searchParams.set('utm_source', siteTitle);
|
|
93
|
+
urlObj.searchParams.set('utm_medium', 'documentation');
|
|
94
|
+
urlObj.searchParams.set('utm_content', location);
|
|
95
|
+
return urlObj.toString();
|
|
96
|
+
}
|
|
87
97
|
const createPreset = (config)=>{
|
|
88
|
-
var _docs_socials, _docs_socials1;
|
|
89
|
-
const { context, docs,
|
|
98
|
+
var _config_theme, _docs_socials, _docs_socials1;
|
|
99
|
+
const { context, docs, vercelAnalytics } = config;
|
|
90
100
|
const rootDir = node_path.join(context, docs.rootDir ?? 'docs');
|
|
91
101
|
const enableVercel = void 0 === vercelAnalytics ? node_fs.existsSync(node_path.join(context, 'vercel.json')) : Boolean(vercelAnalytics);
|
|
92
102
|
const vercelOptions = 'object' == typeof vercelAnalytics ? vercelAnalytics : {};
|
|
103
|
+
const defaultLinks = {
|
|
104
|
+
docFooterCTA: addUTMParameters(CALLSTACK_CONTACT_URL, 'FOOTER_CTA', docs.title),
|
|
105
|
+
homeBanner: addUTMParameters(CALLSTACK_CONTACT_URL, 'HOME_BANNER', docs.title),
|
|
106
|
+
homeFooter: CALLSTACK_BASE_URL,
|
|
107
|
+
outlineCTA: addUTMParameters(CALLSTACK_CONTACT_URL, 'OUTLINE_CTA', docs.title)
|
|
108
|
+
};
|
|
109
|
+
const theme = {
|
|
110
|
+
...config.theme,
|
|
111
|
+
links: {
|
|
112
|
+
...defaultLinks,
|
|
113
|
+
...null == (_config_theme = config.theme) ? void 0 : _config_theme.links
|
|
114
|
+
}
|
|
115
|
+
};
|
|
93
116
|
return defineConfig({
|
|
94
117
|
root: rootDir,
|
|
95
118
|
title: docs.title,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@callstack/rspress-preset",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.5",
|
|
4
4
|
"description": "Callstack preset for Rspress docs",
|
|
5
5
|
"author": "Jakub Romańczyk <jakub.romanczyk@callstack.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -39,20 +39,20 @@
|
|
|
39
39
|
"typescript"
|
|
40
40
|
],
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@rspress/plugin-llms": "2.0.0-beta.
|
|
43
|
-
"@rspress/plugin-sitemap": "2.0.0-beta.
|
|
42
|
+
"@rspress/plugin-llms": "2.0.0-beta.34",
|
|
43
|
+
"@rspress/plugin-sitemap": "2.0.0-beta.34",
|
|
44
44
|
"@vercel/analytics": "^1.5.0",
|
|
45
45
|
"rsbuild-plugin-open-graph": "^1.0.2",
|
|
46
46
|
"zod": "^3.23.8",
|
|
47
|
-
"@callstack/rspress-theme": "0.4.
|
|
47
|
+
"@callstack/rspress-theme": "0.4.5"
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
|
50
|
-
"@rspress/core": "2.0.0-beta.
|
|
50
|
+
"@rspress/core": "2.0.0-beta.34"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
53
|
"@microsoft/api-extractor": "^7.52.8",
|
|
54
54
|
"@rslib/core": "^0.10.5",
|
|
55
|
-
"@rspress/core": "2.0.0-beta.
|
|
55
|
+
"@rspress/core": "2.0.0-beta.34",
|
|
56
56
|
"@types/node": "^22",
|
|
57
57
|
"typescript": "^5.8.3"
|
|
58
58
|
},
|