@hagicode/hagilight-starlight 0.9.1-dev.98.1.e071fc7 → 0.9.2-dev.102.1.daf22c1
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/Footer.astro +19 -0
- package/README.md +5 -1
- package/dist/index.js +5 -0
- package/package.json +2 -2
package/Footer.astro
CHANGED
|
@@ -3,6 +3,7 @@ import Copyright from '@hagicode/hagilight-core/Copyright';
|
|
|
3
3
|
import DefaultFooter from '@astrojs/starlight/components/Footer.astro';
|
|
4
4
|
import { siteLinkGaAttributes } from '@hagicode/hagilight-core/analytics-events';
|
|
5
5
|
import { resolveSiteLinks, type SiteLinksOptions } from '@hagicode/hagilight-core/links';
|
|
6
|
+
import { buildInfoItems, type BuildInfo } from '@hagicode/hagilight-core/build-info';
|
|
6
7
|
import manifest from './package.json';
|
|
7
8
|
|
|
8
9
|
interface Props {
|
|
@@ -10,6 +11,7 @@ interface Props {
|
|
|
10
11
|
links?: SiteLinksOptions;
|
|
11
12
|
rssFeedUrl?: string;
|
|
12
13
|
rssLocaleFeedUrls?: Readonly<Record<string, string>>;
|
|
14
|
+
buildInfo?: BuildInfo;
|
|
13
15
|
}
|
|
14
16
|
|
|
15
17
|
const {
|
|
@@ -17,7 +19,9 @@ const {
|
|
|
17
19
|
links,
|
|
18
20
|
rssFeedUrl,
|
|
19
21
|
rssLocaleFeedUrls,
|
|
22
|
+
buildInfo,
|
|
20
23
|
} = Astro.props;
|
|
24
|
+
const buildItems = buildInfoItems(buildInfo);
|
|
21
25
|
if (typeof manifest.version !== 'string' || manifest.version.trim().length === 0) {
|
|
22
26
|
throw new Error('@hagicode/hagilight-starlight requires a nonempty string version in its package.json.');
|
|
23
27
|
}
|
|
@@ -106,6 +110,17 @@ const resolvedLinks = resolveSiteLinks(currentLanguage ?? locale, {
|
|
|
106
110
|
<Copyright name="HagiCode" />
|
|
107
111
|
{' | '}
|
|
108
112
|
<span class="hagilight-copyright__attribution">Powered By hagilight-starlight@{manifest.version}</span>
|
|
113
|
+
{buildItems.map((item) => (
|
|
114
|
+
<>
|
|
115
|
+
{' | '}
|
|
116
|
+
<span
|
|
117
|
+
class="hagilight-copyright__build"
|
|
118
|
+
data-build-field={item.field}
|
|
119
|
+
title={item.title}
|
|
120
|
+
data-build-commit={item.title}
|
|
121
|
+
>{item.label}: {item.datetime ? <time datetime={item.datetime}>{item.text}</time> : item.text}</span>
|
|
122
|
+
</>
|
|
123
|
+
))}
|
|
109
124
|
</p>
|
|
110
125
|
|
|
111
126
|
<style>
|
|
@@ -166,4 +181,8 @@ const resolvedLinks = resolveSiteLinks(currentLanguage ?? locale, {
|
|
|
166
181
|
.hagilight-copyright__attribution {
|
|
167
182
|
overflow-wrap: anywhere;
|
|
168
183
|
}
|
|
184
|
+
|
|
185
|
+
.hagilight-copyright__build {
|
|
186
|
+
overflow-wrap: anywhere;
|
|
187
|
+
}
|
|
169
188
|
</style>
|
package/README.md
CHANGED
|
@@ -41,11 +41,15 @@ Disable the picker to keep Starlight's built-in toggle or compose `@hagicode/hag
|
|
|
41
41
|
hagilight({ themes: { enabled: false } })
|
|
42
42
|
```
|
|
43
43
|
|
|
44
|
+
### Build line
|
|
45
|
+
|
|
46
|
+
The plugin footer shows the same build line as the Astro package: `Branch:`, `Commit:`, and `Built:` after the attribution. It is always on and has no option of its own. The values come from `HAGILIGHT_BUILD_BRANCH` and `HAGILIGHT_BUILD_COMMIT`, then Git, then `unknown`; the core README gives the order. Detached-HEAD CI checkouts report `Branch: unknown` unless the build step sets `HAGILIGHT_BUILD_BRANCH`, as shown in the Astro README. Footer components mounted directly in a page (`@hagicode/hagilight-starlight/Footer` and `PromotoFooter`) render no build text.
|
|
47
|
+
|
|
44
48
|
### Body images
|
|
45
49
|
|
|
46
50
|
`hagilight()` registers the content-image plugin from `@hagicode/hagilight-core/content-images` for the whole site. Every Markdown or MDX body image outside a `<picture>` element gets `loading="lazy"`, `decoding="async"`, and the class `hagilight-content-image`. Values the author set are kept, and logos and showcase images are not changed.
|
|
47
51
|
|
|
48
|
-
Local
|
|
52
|
+
Local body images in `.md` and `.mdx` files are also wrapped in a `<picture>` element with AVIF and WebP `<source>` elements, produced by Astro's image service. The rule is the same for both file types: a relative local image that is not `.svg` or `.gif` and does not resolve into `public/` is wrapped. A Markdown image in an `.mdx` page therefore renders as `picture` with an inner `<img>`, the same as in `.md`. The default sharp service encodes AVIF. With the passthrough no-op service, the wrapper is skipped and one warning is logged. Site-root and remote images, and raw HTML `<img>` tags, are not wrapped. Encoding adds build time, which Astro caches. In `.md`, each `<source>` also carries `src`, `loading`, `decoding`, `width`, and `height` from Astro's output; in `.mdx`, `<source>` carries only `srcset` and `type`. Browsers ignore the extra attributes on `source`, but they are not valid HTML there. The opt-out below turns this step off too. The step adds no option of its own.
|
|
49
53
|
|
|
50
54
|
Turn it off for the site:
|
|
51
55
|
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { randomUUID } from 'node:crypto';
|
|
2
2
|
import { fileURLToPath } from 'node:url';
|
|
3
3
|
import { resolveFaviconHeadEntry } from '@hagicode/hagilight-core/favicon';
|
|
4
|
+
import { resolveBuildInfo } from '@hagicode/hagilight-core/build-info-resolver';
|
|
4
5
|
import { checkContentImageRegistration, registerContentImages } from '@hagicode/hagilight-core/content-images';
|
|
5
6
|
import { resolveRssLocales } from '@hagicode/hagilight-core/rss';
|
|
6
7
|
import { RSS_OWNER, registerStarlightRssOwner, } from '@hagicode/hagilight-core/rss-ownership';
|
|
@@ -239,6 +240,7 @@ import options from '${optionsId}';
|
|
|
239
240
|
links={options.links}
|
|
240
241
|
rssFeedUrl={options.rssFeedUrl}
|
|
241
242
|
rssLocaleFeedUrls={options.rssLocaleFeedUrls}
|
|
243
|
+
buildInfo={options.buildInfo}
|
|
242
244
|
/>
|
|
243
245
|
${promotionRender}
|
|
244
246
|
${analyticsRender}
|
|
@@ -279,6 +281,7 @@ const isNotFound = /(?:^|\\/)404(?:\\.html)?\\/?$/u.test(Astro.url.pathname);
|
|
|
279
281
|
...(componentIds.markdownContent ? [[componentIds.markdownContent, markdownContentSource]] : []),
|
|
280
282
|
...(componentIds.head ? [[componentIds.head, headSource]] : []),
|
|
281
283
|
]);
|
|
284
|
+
let buildInfo;
|
|
282
285
|
const vitePlugin = {
|
|
283
286
|
name: `@hagicode/hagilight-starlight:${instanceId}`,
|
|
284
287
|
resolveId(id) {
|
|
@@ -293,6 +296,7 @@ const isNotFound = /(?:^|\\/)404(?:\\.html)?\\/?$/u.test(Astro.url.pathname);
|
|
|
293
296
|
...serializedOptions,
|
|
294
297
|
rssFeedUrl: getConfiguredRssFeed(),
|
|
295
298
|
rssLocaleFeedUrls,
|
|
299
|
+
buildInfo,
|
|
296
300
|
})};`;
|
|
297
301
|
}
|
|
298
302
|
if (moduleId === rssConfigId)
|
|
@@ -306,6 +310,7 @@ const isNotFound = /(?:^|\\/)404(?:\\.html)?\\/?$/u.test(Astro.url.pathname);
|
|
|
306
310
|
hooks: {
|
|
307
311
|
'astro:config:setup'({ config, injectRoute, updateConfig, logger }) {
|
|
308
312
|
registerContentImages({ config, logger, enabled: contentImagesEnabled });
|
|
313
|
+
buildInfo = resolveBuildInfo({ root: fileURLToPath(config.root) });
|
|
309
314
|
if (generateRss) {
|
|
310
315
|
injectRoute({
|
|
311
316
|
pattern: '/rss.xml',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hagicode/hagilight-starlight",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.2-dev.102.1.daf22c1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Starlight plugin and components for HagiCode documentation",
|
|
6
6
|
"repository": {
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"assets/showcase/*"
|
|
54
54
|
],
|
|
55
55
|
"dependencies": {
|
|
56
|
-
"@hagicode/hagilight-core": "0.9.
|
|
56
|
+
"@hagicode/hagilight-core": "0.9.2-dev.102.1.daf22c1"
|
|
57
57
|
},
|
|
58
58
|
"peerDependencies": {
|
|
59
59
|
"@astrojs/starlight": "^0.42.4",
|