@myst-theme/site 0.2.2 → 0.2.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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@myst-theme/site",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.3",
|
|
4
4
|
"main": "./src/index.ts",
|
|
5
5
|
"types": "./src/index.ts",
|
|
6
6
|
"files": [
|
|
@@ -16,16 +16,16 @@
|
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"@headlessui/react": "^1.7.13",
|
|
18
18
|
"@heroicons/react": "^2.0.14",
|
|
19
|
-
"@myst-theme/diagrams": "^0.2.
|
|
20
|
-
"@myst-theme/frontmatter": "^0.2.
|
|
21
|
-
"@myst-theme/jupyter": "^0.2.
|
|
22
|
-
"@myst-theme/providers": "^0.2.
|
|
19
|
+
"@myst-theme/diagrams": "^0.2.3",
|
|
20
|
+
"@myst-theme/frontmatter": "^0.2.3",
|
|
21
|
+
"@myst-theme/jupyter": "^0.2.3",
|
|
22
|
+
"@myst-theme/providers": "^0.2.3",
|
|
23
23
|
"classnames": "^2.3.2",
|
|
24
24
|
"lodash.throttle": "^4.1.1",
|
|
25
25
|
"myst-common": "^0.0.16",
|
|
26
26
|
"myst-config": "^0.0.14",
|
|
27
|
-
"myst-demo": "^0.2.
|
|
28
|
-
"myst-to-react": "^0.2.
|
|
27
|
+
"myst-demo": "^0.2.3",
|
|
28
|
+
"myst-to-react": "^0.2.3",
|
|
29
29
|
"nbtx": "^0.2.3",
|
|
30
30
|
"node-cache": "^5.1.2",
|
|
31
31
|
"node-fetch": "^2.6.7",
|
|
@@ -130,10 +130,11 @@ async function getData(
|
|
|
130
130
|
project?: string,
|
|
131
131
|
slug?: string,
|
|
132
132
|
): Promise<PageLoader | null> {
|
|
133
|
-
if (!
|
|
133
|
+
if (!slug || !config) throw responseNoArticle();
|
|
134
134
|
const { id } = config;
|
|
135
135
|
if (!id) throw responseNoSite();
|
|
136
|
-
const
|
|
136
|
+
const projectPart = project ? `${project}/` : '';
|
|
137
|
+
const response = await fetch(withBaseUrl(baseUrl, `content/${projectPart}${slug}.json`));
|
|
137
138
|
if (response.status === 404) throw responseNoArticle();
|
|
138
139
|
const data = (await response.json()) as PageLoader;
|
|
139
140
|
return updatePageStaticLinksInplace(data, (url) => withPublicFolderUrl(baseUrl, url));
|
|
@@ -156,7 +157,9 @@ export async function getPage(
|
|
|
156
157
|
const project = getProject(config, projectName);
|
|
157
158
|
if (!project) throw responseNoArticle();
|
|
158
159
|
if (opts.slug === project.index && opts.redirect) {
|
|
159
|
-
return redirect(
|
|
160
|
+
return redirect(
|
|
161
|
+
`${typeof opts.redirect === 'string' ? opts.redirect : '/'}${projectName ?? ''}`,
|
|
162
|
+
);
|
|
160
163
|
}
|
|
161
164
|
const slug = opts.loadIndexPage || opts.slug == null ? project.index : opts.slug;
|
|
162
165
|
const loader = await getData(baseUrl, config, projectName, slug).catch((e) => {
|