@callstack/rspress-preset 0.4.4 → 0.5.0
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 +31 -5
- package/dist/index.js +31 -5
- package/package.json +7 -7
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,18 +129,43 @@ 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
|
+
}
|
|
140
|
+
function getGlobalStyles(context) {
|
|
141
|
+
const stylesPath = external_node_path_default().join(context, 'theme/styles.css');
|
|
142
|
+
return external_node_fs_default().existsSync(stylesPath) ? stylesPath : void 0;
|
|
143
|
+
}
|
|
130
144
|
const createPreset = (config)=>{
|
|
131
|
-
var _docs_socials, _docs_socials1;
|
|
132
|
-
const { context, docs,
|
|
145
|
+
var _config_theme, _docs_socials, _docs_socials1;
|
|
146
|
+
const { context, docs, vercelAnalytics } = config;
|
|
133
147
|
const rootDir = external_node_path_default().join(context, docs.rootDir ?? 'docs');
|
|
134
148
|
const enableVercel = void 0 === vercelAnalytics ? external_node_fs_default().existsSync(external_node_path_default().join(context, 'vercel.json')) : Boolean(vercelAnalytics);
|
|
135
149
|
const vercelOptions = 'object' == typeof vercelAnalytics ? vercelAnalytics : {};
|
|
150
|
+
const defaultLinks = {
|
|
151
|
+
docFooterCTA: addUTMParameters(CALLSTACK_CONTACT_URL, 'FOOTER_CTA', docs.title),
|
|
152
|
+
homeBanner: addUTMParameters(CALLSTACK_CONTACT_URL, 'HOME_BANNER', docs.title),
|
|
153
|
+
homeFooter: CALLSTACK_BASE_URL,
|
|
154
|
+
outlineCTA: addUTMParameters(CALLSTACK_CONTACT_URL, 'OUTLINE_CTA', docs.title)
|
|
155
|
+
};
|
|
156
|
+
const theme = {
|
|
157
|
+
...config.theme,
|
|
158
|
+
links: {
|
|
159
|
+
...defaultLinks,
|
|
160
|
+
...null == (_config_theme = config.theme) ? void 0 : _config_theme.links
|
|
161
|
+
}
|
|
162
|
+
};
|
|
136
163
|
return (0, core_namespaceObject.defineConfig)({
|
|
137
164
|
root: rootDir,
|
|
138
165
|
title: docs.title,
|
|
139
166
|
description: docs.description,
|
|
140
167
|
icon: docs.icon,
|
|
141
|
-
globalStyles:
|
|
168
|
+
globalStyles: getGlobalStyles(context),
|
|
142
169
|
globalUIComponents: enableVercel ? [
|
|
143
170
|
[
|
|
144
171
|
external_node_path_default().join(external_node_path_default().dirname(preset_dirname), 'vendor/VercelAnalytics.ts'),
|
|
@@ -171,8 +198,7 @@ const createPreset = (config)=>{
|
|
|
171
198
|
message: `Copyright \xa9 ${new Date().getFullYear()} Callstack`
|
|
172
199
|
},
|
|
173
200
|
editLink: {
|
|
174
|
-
docRepoBaseUrl: docs.editUrl
|
|
175
|
-
text: 'Edit this page on GitHub'
|
|
201
|
+
docRepoBaseUrl: docs.editUrl
|
|
176
202
|
},
|
|
177
203
|
socialLinks: createSocialLinks(docs.socials)
|
|
178
204
|
},
|
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,18 +86,43 @@ 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
|
+
}
|
|
97
|
+
function getGlobalStyles(context) {
|
|
98
|
+
const stylesPath = node_path.join(context, 'theme/styles.css');
|
|
99
|
+
return node_fs.existsSync(stylesPath) ? stylesPath : void 0;
|
|
100
|
+
}
|
|
87
101
|
const createPreset = (config)=>{
|
|
88
|
-
var _docs_socials, _docs_socials1;
|
|
89
|
-
const { context, docs,
|
|
102
|
+
var _config_theme, _docs_socials, _docs_socials1;
|
|
103
|
+
const { context, docs, vercelAnalytics } = config;
|
|
90
104
|
const rootDir = node_path.join(context, docs.rootDir ?? 'docs');
|
|
91
105
|
const enableVercel = void 0 === vercelAnalytics ? node_fs.existsSync(node_path.join(context, 'vercel.json')) : Boolean(vercelAnalytics);
|
|
92
106
|
const vercelOptions = 'object' == typeof vercelAnalytics ? vercelAnalytics : {};
|
|
107
|
+
const defaultLinks = {
|
|
108
|
+
docFooterCTA: addUTMParameters(CALLSTACK_CONTACT_URL, 'FOOTER_CTA', docs.title),
|
|
109
|
+
homeBanner: addUTMParameters(CALLSTACK_CONTACT_URL, 'HOME_BANNER', docs.title),
|
|
110
|
+
homeFooter: CALLSTACK_BASE_URL,
|
|
111
|
+
outlineCTA: addUTMParameters(CALLSTACK_CONTACT_URL, 'OUTLINE_CTA', docs.title)
|
|
112
|
+
};
|
|
113
|
+
const theme = {
|
|
114
|
+
...config.theme,
|
|
115
|
+
links: {
|
|
116
|
+
...defaultLinks,
|
|
117
|
+
...null == (_config_theme = config.theme) ? void 0 : _config_theme.links
|
|
118
|
+
}
|
|
119
|
+
};
|
|
93
120
|
return defineConfig({
|
|
94
121
|
root: rootDir,
|
|
95
122
|
title: docs.title,
|
|
96
123
|
description: docs.description,
|
|
97
124
|
icon: docs.icon,
|
|
98
|
-
globalStyles:
|
|
125
|
+
globalStyles: getGlobalStyles(context),
|
|
99
126
|
globalUIComponents: enableVercel ? [
|
|
100
127
|
[
|
|
101
128
|
node_path.join(node_path.dirname(preset_dirname), 'vendor/VercelAnalytics.ts'),
|
|
@@ -128,8 +155,7 @@ const createPreset = (config)=>{
|
|
|
128
155
|
message: `Copyright \xa9 ${new Date().getFullYear()} Callstack`
|
|
129
156
|
},
|
|
130
157
|
editLink: {
|
|
131
|
-
docRepoBaseUrl: docs.editUrl
|
|
132
|
-
text: 'Edit this page on GitHub'
|
|
158
|
+
docRepoBaseUrl: docs.editUrl
|
|
133
159
|
},
|
|
134
160
|
socialLinks: createSocialLinks(docs.socials)
|
|
135
161
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@callstack/rspress-preset",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "Callstack preset for Rspress docs",
|
|
5
5
|
"author": "Jakub Romańczyk <jakub.romanczyk@callstack.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -39,22 +39,22 @@
|
|
|
39
39
|
"typescript"
|
|
40
40
|
],
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@rspress/plugin-llms": "2.0.0-
|
|
43
|
-
"@rspress/plugin-sitemap": "2.0.0-
|
|
42
|
+
"@rspress/plugin-llms": "2.0.0-rc.3",
|
|
43
|
+
"@rspress/plugin-sitemap": "2.0.0-rc.3",
|
|
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.
|
|
47
|
+
"@callstack/rspress-theme": "0.5.0"
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
|
50
|
-
"@rspress/core": "2.0.0-
|
|
50
|
+
"@rspress/core": "2.0.0-rc.3"
|
|
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-
|
|
55
|
+
"@rspress/core": "2.0.0-rc.3",
|
|
56
56
|
"@types/node": "^22",
|
|
57
|
-
"typescript": "^5.
|
|
57
|
+
"typescript": "^5.9.3"
|
|
58
58
|
},
|
|
59
59
|
"scripts": {
|
|
60
60
|
"build": "rslib build",
|