@myst-theme/common 0.13.5 → 0.13.7
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/types.d.ts +1 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +40 -26
- package/package.json +4 -4
package/dist/types.d.ts
CHANGED
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AACjF,OAAO,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC7D,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AACxE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAExD,oBAAY,KAAK;IACf,KAAK,UAAU;IACf,IAAI,SAAS;CACd;AAED,oBAAY,WAAW;IACrB,MAAM,uBAAuB;IAC7B,SAAS,0BAA0B;CACpC;AAED,MAAM,MAAM,OAAO,GAAG;IACpB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC;IACxB,KAAK,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AACjF,OAAO,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC7D,OAAO,KA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C,GAAG;IACF,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE;QAAE,WAAW,CAAC,EAAE,eAAe,CAAC;QAAC,KAAK,EAAE,aAAa,CAAA;KAAE,CAAC,CAAC;IAChF,SAAS,CAAC,EAAE,UAAU,EAAE,CAAC;IACzB,OAAO,CAAC,EAAE,UAAU,EAAE,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG;IACvB,IAAI,EAAE,cAAc,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,4BAA4B,CAAC;IAC1C,KAAK,EAAE,aAAa,CAAC;IACrB,UAAU,EAAE,UAAU,CAAC;IACvB,MAAM,CAAC,EAAE,WAAW,CAAC;IAErB,YAAY,CAAC,EAAE,UAAU,EAAE,CAAC;CAC7B,CAAC"}
|
package/dist/utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAGhD,OAAO,KAAK,EAAE,WAAW,EAAE,OAAO,EAAkB,UAAU,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAGhD,OAAO,KAAK,EAAE,WAAW,EAAE,OAAO,EAAkB,UAAU,EAAE,MAAM,YAAY,CAAC;AAQnF,KAAK,eAAe,GAAG,QAAQ,CAAC,YAAY,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC;AAG7D,wBAAgB,UAAU,CACxB,MAAM,CAAC,EAAE,YAAY,EACrB,WAAW,CAAC,EAAE,MAAM,GACnB,eAAe,GAAG,SAAS,CAM7B;AAED,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,YAAY,EACpB,WAAW,CAAC,EAAE,MAAM,EACpB,IAAI,GAAE;IAAE,SAAS,EAAE,OAAO,CAAA;CAAyB,GAClD,OAAO,EAAE,GAAG,SAAS,CA+BvB;AAeD,wBAAgB,cAAc,CAC5B,MAAM,CAAC,EAAE,YAAY,EACrB,WAAW,CAAC,EAAE,MAAM,EACpB,IAAI,CAAC,EAAE,MAAM,GACZ,WAAW,CAab;AAED,KAAK,SAAS,GAAG,CAAC,GAAG,EAAE,MAAM,KAAK,MAAM,CAAC;AA6BzC,wBAAgB,oCAAoC,CAClD,IAAI,EAAE,YAAY,EAClB,SAAS,EAAE,SAAS,GACnB,YAAY,CA4Ed;AAED,wBAAgB,4BAA4B,CAAC,IAAI,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,GAAG,UAAU,CA8B/F;AAED,wBAAgB,UAAU,CAAC,MAAM,CAAC,EAAE,YAAY,GAAG,OAAO,CAEzD"}
|
package/dist/utils.js
CHANGED
|
@@ -23,6 +23,7 @@ export function getProjectHeadings(config, projectSlug, opts = { addGroups: fals
|
|
|
23
23
|
slug: project.index,
|
|
24
24
|
path: project.slug ? `/${project.slug}` : '/',
|
|
25
25
|
level: 'index',
|
|
26
|
+
enumerator: project.enumerator,
|
|
26
27
|
},
|
|
27
28
|
...project.pages.map((p) => {
|
|
28
29
|
if (!('slug' in p))
|
|
@@ -76,6 +77,34 @@ export function getFooterLinks(config, projectSlug, slug) {
|
|
|
76
77
|
};
|
|
77
78
|
return footer;
|
|
78
79
|
}
|
|
80
|
+
function updateMdastStaticLinksInplace(mdast, updateUrl) {
|
|
81
|
+
// Fix all of the images to point to the CDN
|
|
82
|
+
const images = selectAll('image', mdast);
|
|
83
|
+
images.forEach((node) => {
|
|
84
|
+
node.url = updateUrl(node.url);
|
|
85
|
+
if (node.urlOptimized) {
|
|
86
|
+
node.urlOptimized = updateUrl(node.urlOptimized);
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
const links = selectAll('link,linkBlock,card', mdast);
|
|
90
|
+
const staticLinks = links === null || links === void 0 ? void 0 : links.filter((node) => node.static);
|
|
91
|
+
staticLinks.forEach((node) => {
|
|
92
|
+
// These are static links to thinks like PDFs or other referenced files
|
|
93
|
+
node.url = updateUrl(node.url);
|
|
94
|
+
});
|
|
95
|
+
const outputs = selectAll('output', mdast);
|
|
96
|
+
outputs.forEach((node) => {
|
|
97
|
+
if (!node.data)
|
|
98
|
+
return;
|
|
99
|
+
walkOutputs(node.data, (obj) => {
|
|
100
|
+
// The path will be defined from output of myst
|
|
101
|
+
// Here we are re-assigning it to the current domain
|
|
102
|
+
if (!obj.path)
|
|
103
|
+
return;
|
|
104
|
+
obj.path = updateUrl(obj.path);
|
|
105
|
+
});
|
|
106
|
+
});
|
|
107
|
+
}
|
|
79
108
|
export function updateSiteManifestStaticLinksInplace(data, updateUrl) {
|
|
80
109
|
var _a, _b, _c;
|
|
81
110
|
(_a = data.actions) === null || _a === void 0 ? void 0 : _a.forEach((action) => {
|
|
@@ -120,6 +149,11 @@ export function updateSiteManifestStaticLinksInplace(data, updateUrl) {
|
|
|
120
149
|
data.options.logo_dark = updateUrl(data.options.logo_dark);
|
|
121
150
|
if (data.options.favicon)
|
|
122
151
|
data.options.favicon = updateUrl(data.options.favicon);
|
|
152
|
+
if (data.parts) {
|
|
153
|
+
Object.values(data.parts).forEach(({ mdast }) => {
|
|
154
|
+
updateMdastStaticLinksInplace(mdast, updateUrl);
|
|
155
|
+
});
|
|
156
|
+
}
|
|
123
157
|
// Update the thumbnails to point at the CDN
|
|
124
158
|
(_c = data.projects) === null || _c === void 0 ? void 0 : _c.forEach((project) => {
|
|
125
159
|
if (project.banner)
|
|
@@ -152,6 +186,11 @@ export function updateSiteManifestStaticLinksInplace(data, updateUrl) {
|
|
|
152
186
|
if (page.thumbnailOptimized)
|
|
153
187
|
page.thumbnailOptimized = updateUrl(page.thumbnailOptimized);
|
|
154
188
|
});
|
|
189
|
+
if (project.parts) {
|
|
190
|
+
Object.values(project.parts).forEach(({ mdast }) => {
|
|
191
|
+
updateMdastStaticLinksInplace(mdast, updateUrl);
|
|
192
|
+
});
|
|
193
|
+
}
|
|
155
194
|
});
|
|
156
195
|
return data;
|
|
157
196
|
}
|
|
@@ -185,32 +224,7 @@ export function updatePageStaticLinksInplace(data, updateUrl) {
|
|
|
185
224
|
}
|
|
186
225
|
const allMdastTrees = [data, ...Object.values((_h = (_g = data.frontmatter) === null || _g === void 0 ? void 0 : _g.parts) !== null && _h !== void 0 ? _h : {})];
|
|
187
226
|
allMdastTrees.forEach(({ mdast }) => {
|
|
188
|
-
|
|
189
|
-
const images = selectAll('image', mdast);
|
|
190
|
-
images.forEach((node) => {
|
|
191
|
-
node.url = updateUrl(node.url);
|
|
192
|
-
if (node.urlOptimized) {
|
|
193
|
-
node.urlOptimized = updateUrl(node.urlOptimized);
|
|
194
|
-
}
|
|
195
|
-
});
|
|
196
|
-
const links = selectAll('link,linkBlock,card', mdast);
|
|
197
|
-
const staticLinks = links === null || links === void 0 ? void 0 : links.filter((node) => node.static);
|
|
198
|
-
staticLinks.forEach((node) => {
|
|
199
|
-
// These are static links to thinks like PDFs or other referenced files
|
|
200
|
-
node.url = updateUrl(node.url);
|
|
201
|
-
});
|
|
202
|
-
const outputs = selectAll('output', mdast);
|
|
203
|
-
outputs.forEach((node) => {
|
|
204
|
-
if (!node.data)
|
|
205
|
-
return;
|
|
206
|
-
walkOutputs(node.data, (obj) => {
|
|
207
|
-
// The path will be defined from output of myst
|
|
208
|
-
// Here we are re-assigning it to the current domain
|
|
209
|
-
if (!obj.path)
|
|
210
|
-
return;
|
|
211
|
-
obj.path = updateUrl(obj.path);
|
|
212
|
-
});
|
|
213
|
-
});
|
|
227
|
+
updateMdastStaticLinksInplace(mdast, updateUrl);
|
|
214
228
|
});
|
|
215
229
|
return data;
|
|
216
230
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@myst-theme/common",
|
|
3
|
-
"version": "0.13.
|
|
3
|
+
"version": "0.13.7",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -19,9 +19,9 @@
|
|
|
19
19
|
"build": "npm-run-all -l clean -p build:esm"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"myst-common": "^1.7.
|
|
23
|
-
"myst-config": "^1.7.
|
|
24
|
-
"myst-spec-ext": "^1.7.
|
|
22
|
+
"myst-common": "^1.7.8",
|
|
23
|
+
"myst-config": "^1.7.8",
|
|
24
|
+
"myst-spec-ext": "^1.7.8",
|
|
25
25
|
"nbtx": "^0.2.3",
|
|
26
26
|
"unist-util-select": "^4.0.3"
|
|
27
27
|
}
|