@brandon_m_behring/book-scaffold-astro 4.27.0 → 4.27.1
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.mjs +16 -0
- package/layouts/Base.astro +10 -0
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1130,6 +1130,21 @@ function defineMdxComponents(components) {
|
|
|
1130
1130
|
// src/integration.ts
|
|
1131
1131
|
var BOOK_CONFIG_VIRTUAL_ID = "virtual:book-scaffold/book-config";
|
|
1132
1132
|
var BOOK_CONFIG_RESOLVED_ID = "\0" + BOOK_CONFIG_VIRTUAL_ID;
|
|
1133
|
+
function makeRobotoFontDisplayVitePlugin() {
|
|
1134
|
+
return {
|
|
1135
|
+
name: "book-scaffold:roboto-font-display",
|
|
1136
|
+
enforce: "pre",
|
|
1137
|
+
transform(code, id) {
|
|
1138
|
+
const [path = id] = id.split("?");
|
|
1139
|
+
const normalizedPath = path.replaceAll("\\", "/");
|
|
1140
|
+
if (!normalizedPath.endsWith("/@fontsource-variable/roboto/index.css")) {
|
|
1141
|
+
return null;
|
|
1142
|
+
}
|
|
1143
|
+
const transformed = code.replace(/font-display:\s*swap/g, "font-display: optional");
|
|
1144
|
+
return transformed === code ? null : { code: transformed, map: null };
|
|
1145
|
+
}
|
|
1146
|
+
};
|
|
1147
|
+
}
|
|
1133
1148
|
function makeBookConfigVitePlugin(config) {
|
|
1134
1149
|
const serialized = `export default ${JSON.stringify(config)};`;
|
|
1135
1150
|
return {
|
|
@@ -1302,6 +1317,7 @@ function bookScaffoldIntegration(opts) {
|
|
|
1302
1317
|
updateConfig({
|
|
1303
1318
|
vite: {
|
|
1304
1319
|
plugins: [
|
|
1320
|
+
makeRobotoFontDisplayVitePlugin(),
|
|
1305
1321
|
makeMdxComponentsVitePlugin(resolvedMdxPath),
|
|
1306
1322
|
makeBookConfigVitePlugin({
|
|
1307
1323
|
title: title ?? null,
|
package/layouts/Base.astro
CHANGED
|
@@ -39,6 +39,7 @@
|
|
|
39
39
|
* — or the page ends up with duplicate `<main>` landmarks (a11y, #91).
|
|
40
40
|
*/
|
|
41
41
|
import '@fontsource-variable/roboto';
|
|
42
|
+
import robotoLatinUrl from '@fontsource-variable/roboto/files/roboto-latin-wght-normal.woff2?url';
|
|
42
43
|
import '@fontsource-variable/source-code-pro';
|
|
43
44
|
// KaTeX CSS is injected by bookScaffoldIntegration for academic profile
|
|
44
45
|
// only (since v3.0 alpha.8) — tools/minimal profiles don't install katex
|
|
@@ -128,6 +129,15 @@ const baseUrl = normalizeBase(import.meta.env.BASE_URL);
|
|
|
128
129
|
<head>
|
|
129
130
|
<meta charset="utf-8" />
|
|
130
131
|
<link rel="icon" type="image/svg+xml" href={`${baseUrl}favicon.svg`} />
|
|
132
|
+
{/* #187: start the common Latin body face early. Its Fontsource rules use
|
|
133
|
+
font-display: optional, so a slow response never swaps after paint. */}
|
|
134
|
+
<link
|
|
135
|
+
rel="preload"
|
|
136
|
+
href={robotoLatinUrl}
|
|
137
|
+
as="font"
|
|
138
|
+
type="font/woff2"
|
|
139
|
+
crossorigin="anonymous"
|
|
140
|
+
/>
|
|
131
141
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
132
142
|
<meta name="color-scheme" content="light dark" />
|
|
133
143
|
<meta name="generator" content={Astro.generator} />
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@brandon_m_behring/book-scaffold-astro",
|
|
3
3
|
"description": "Astro 6 + MDX toolkit for long-form technical books with five typed presets, Tufte typography, citations, search, PDF, and Cloudflare deployment.",
|
|
4
|
-
"version": "4.27.
|
|
4
|
+
"version": "4.27.1",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"author": "Brandon Behring",
|