sproutsite 0.5.9 → 0.5.13

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/README.md CHANGED
@@ -1,6 +1,9 @@
1
1
  # Sproutsite
2
2
 
3
- [![GitHub Release](https://img.shields.io/github/v/release/sproutsite/sproutsite?display_name=tag&sort=semver)](https://github.com/sproutsite/sproutsite/releases)
3
+ [![npm version](https://img.shields.io/npm/v/sproutsite?logo=npm)](https://www.npmjs.com/package/sproutsite)
4
+ [![License](https://img.shields.io/npm/l/sproutsite)](LICENSE)
5
+ [![Node.js version](https://img.shields.io/node/v/sproutsite?logo=nodedotjs)](https://www.npmjs.com/package/sproutsite)
6
+ [![Documentation](https://img.shields.io/badge/docs-sproutsite.dev-0875C9)](https://sproutsite.dev/documentation/)
4
7
 
5
8
  **Sproutsite — The Agent-Ready Static CMS**
6
9
 
@@ -10,7 +13,7 @@ Sproutsite is an npm-based developer tool for file-based content, page structure
10
13
 
11
14
  _Plant an idea. Grow your website._
12
15
 
13
- Official website: [sproutsite.dev](https://sproutsite.dev) · [Documentation](https://sproutsite.dev/documentation/) · [Component showcase](https://sproutsite.dev/showcase/) · [Source code](https://github.com/sproutsite/sproutsite)
16
+ Official website: [sproutsite.dev](https://sproutsite.dev) · [Documentation](https://sproutsite.dev/documentation/) · [Component showcase](https://sproutsite.dev/showcase/) · [Source code](https://github.com/sproutsite/sproutsite) · [Release notes](https://github.com/sproutsite/sproutsite/releases)
14
17
 
15
18
  ## Installation
16
19
 
@@ -40,7 +43,7 @@ The library is available on [npm](https://www.npmjs.com/package/sproutsite). For
40
43
  mkdir my-website
41
44
  cd my-website
42
45
  npm init -y
43
- npm install sproutsite astro@^7.4.4 @astrojs/mdx@^8.1.2
46
+ npm install sproutsite astro@^7.4.12 @astrojs/mdx@^8.1.6
44
47
  npm install --save-dev @astrojs/check typescript
45
48
  ```
46
49
 
@@ -521,7 +524,7 @@ These local error documents preserve the original error status. For a subpath de
521
524
 
522
525
  ## Validation and Limitations
523
526
 
524
- A new website without blog articles currently emits warnings about a missing or empty blog collection. The build still generates an empty blog overview; these warnings do not prevent the regular pages from building.
527
+ A website without blog articles does not need `src/content/blog/`. Missing, empty and asset-only blog directories are handled without missing-directory or empty-collection warnings. The existing empty blog overview remains available; no page URLs are removed. Once source files exist, Astro's glob loader performs the normal loading, schema validation and content watching. A small optional-blog loader waits for the first source file using Astro's public loader watcher API; it does not create placeholders or filter diagnostics for actual content. Page rendering and language navigation query optional collections only after Astro has stored their first entry. A small internal readiness collection records this state through the public loader store API, including watcher updates; files appearing on disk alone do not imply that parsing has finished. This avoids empty-collection warnings during first-article loading and also supports a custom blog directory. The package test checks both warning-free builds and adding, editing and removing the first article without restarting the dev server, with deliberately delayed parsing to exercise requests while loading is still in progress.
525
528
 
526
529
  The demo keeps English showcase and documentation sources in the standard files and German translations in their `.de.md`, `.de.mdx`, and `page.de.yaml` counterparts. English routes use `/showcase/` and `/documentation/`; German routes use `/de/showcase/` and `/de/dokumentation/`, including localized URL segments. Keep both versions up to date when editing examples, labels, image descriptions, or metadata. Markdown links use the source file's locale, and Button applies the active locale and deployment base exactly once. Theme messages are bundled from the local YAML files using Vite raw imports; they are not read from paths relative to generated build chunks.
527
530
 
@@ -544,7 +547,7 @@ npm pack
544
547
  Use the filename printed by npm. In your separate consumer project, replace the registry installation command with:
545
548
 
546
549
  ```sh
547
- npm install /absolute/path/to/sproutsite-VERSION.tgz astro@^7.4.4 @astrojs/mdx@^8.1.2
550
+ npm install /absolute/path/to/sproutsite-VERSION.tgz astro@^7.4.12 @astrojs/mdx@^8.1.6
548
551
  npm install --save-dev @astrojs/check typescript
549
552
  ```
550
553
 
@@ -601,12 +604,20 @@ Brand colors are separate `--color-brand-*` tokens in `styles/foundation/tokens.
601
604
 
602
605
  ## Publication Checks
603
606
 
604
- Run `npm run test:package` to test the actual npm archive in a fresh consumer project. It checks package metadata/version consistency, required exports and license files, and exclusion of demo/development files. It then installs the local tarball (not a registry package named Sproutsite), runs Astro/TypeScript checking, and builds the consumer for `/` and `/demo/`. The fixture exercises English/German routes, a Markdown section, an MDX accordion with a Lucide icon, theme CSS and fonts, version display, error documents, manifest, and multilingual sitemap. It also verifies that the installed library is a real copy rather than a symlink to this checkout.
607
+ Run `npm run test:package` to test the actual npm archive in a fresh consumer project. It checks package metadata/version consistency, required exports and license files, and exclusion of demo/development files. It then installs the local tarball (not a registry package named Sproutsite), runs Astro/TypeScript checking, and builds the consumer for `/` and `/demo/`. The fixture exercises English/German routes, a Markdown section, an MDX accordion with a Lucide icon, theme CSS and fonts, version display, error documents, manifest, and multilingual sitemap. It also verifies that the installed library is a real copy rather than a symlink to this checkout. Missing and asset-only blogs must build without optional-blog warnings. A temporary Astro dev server then checks adding, editing and removing the first article without a restart, and is stopped after the test.
605
608
 
606
609
  The test uses `scripts/fixtures/package-consumer/`, pins its direct Astro/MDX/checking dependencies to versions in the repository lockfile, and lets npm resolve the library's published dependency ranges. npm may need network access and uses its normal cache. Temporary files are removed after success and retained with their path printed after failure. Lifecycle scripts are suppressed during packing and installation to prevent recursive publication checks and ensure the archive already contains everything it needs. During `npm publish --dry-run`, the nested checks still create and install a real local archive; only their child processes override the inherited dry-run setting, so the outer publication remains a dry run.
607
610
 
608
611
  `npm run prepublishOnly` runs formatting, TypeScript-source enforcement, content/Astro checking, unit tests, the demo build/output checks, and the consumer installation test. npm runs this gate automatically before publishing from this repository; any failing command stops the sequence. Neither running the gate manually nor running the package test publishes anything. A normal `npm pack` remains separate from this gate. Run the existing Storybook and accessibility checks as well when changing components or interactions. Do not bypass the gate with `--ignore-scripts` when publishing; publishing an existing tarball also requires checking that exact artifact beforehand.
609
612
 
613
+ ## Dependency Security
614
+
615
+ Reviewed on 2026-11-18. The tested Astro version is 7.4.12, which is also the minimum accepted by this package's peer range. It includes the fixes for [dynamic-tag attribute injection](https://github.com/advisories/GHSA-mh32-jxcr-mh9f) and the [Node image endpoint path issue](https://github.com/advisories/GHSA-r3h5-4585-7x3w). The default Sproutsite website uses static output without the Node adapter, but the supported Astro range excludes those affected versions regardless.
616
+
617
+ The transitive [picomatch ReDoS advisory GHSA-fc5q-39xc-vjpf](https://github.com/advisories/GHSA-fc5q-39xc-vjpf) remains open: the latest published picomatch version is 4.0.7 and the advisory lists no patched release. npm reports it through several Astro, globbing and developer-tool dependency paths; these are not separate root vulnerabilities. No audit exception or replacement package has been added to hide these reports.
618
+
619
+ This finding concerns Node-based tooling. Deploying `dist/` does not deploy a Node runtime or its npm dependencies. The static output does not eliminate the need to review build inputs and development tooling, and this project does not claim the dependency tree is free of vulnerabilities. Recheck `npm audit` after upstream patches are published. Do not use `npm audit fix --force` without reviewing the proposed changes; its current suggestions include incompatible Astro/MDX downgrades.
620
+
610
621
  ## License
611
622
 
612
623
  Sproutsite is licensed under the Apache License, Version 2.0.
package/VERSION CHANGED
@@ -1 +1 @@
1
- 0.5.9
1
+ 0.5.13
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sproutsite",
3
- "version": "0.5.9",
3
+ "version": "0.5.13",
4
4
  "license": "Apache-2.0",
5
5
  "author": "Björn Hempel",
6
6
  "description": "Agent-ready, Markdown-first Static CMS powered by Astro and TypeScript.",
@@ -59,11 +59,11 @@
59
59
  "build:storybook": "storybook build"
60
60
  },
61
61
  "peerDependencies": {
62
- "@astrojs/mdx": "^8.1.2",
63
- "astro": "^7.4.4"
62
+ "@astrojs/mdx": "^8.1.6",
63
+ "astro": "^7.4.12"
64
64
  },
65
65
  "dependencies": {
66
- "@astrojs/markdown-remark": "^7.3.1",
66
+ "@astrojs/markdown-remark": "^7.3.9",
67
67
  "@astrojs/sitemap": "^3.7.4",
68
68
  "@lucide/astro": "^1.73.0",
69
69
  "@shikijs/langs": "^4.5.0",
@@ -82,15 +82,15 @@
82
82
  "zod": "^4.3.6"
83
83
  },
84
84
  "devDependencies": {
85
- "@astrojs/check": "^0.9.10",
86
- "@astrojs/mdx": "^8.1.2",
85
+ "@astrojs/check": "^0.9.12",
86
+ "@astrojs/mdx": "^8.1.6",
87
87
  "@axe-core/playwright": "^4.13.0",
88
88
  "@playwright/test": "^1.63.0",
89
89
  "@storybook-astro/framework": "^1.15.0",
90
90
  "@storybook/addon-docs": "^10.6.6",
91
91
  "@storybook/builder-vite": "^10.6.6",
92
92
  "@types/fontkit": "^2.0.9",
93
- "astro": "^7.4.4",
93
+ "astro": "^7.4.12",
94
94
  "axe-core": "^4.13.0",
95
95
  "fontkit": "^2.0.4",
96
96
  "playwright": "^1.63.0",
@@ -0,0 +1,18 @@
1
+ import { existsSync, globSync } from 'node:fs';
2
+ import { resolve } from 'node:path';
3
+
4
+ export const blogPatterns = {
5
+ blogPages: '*/page*.yaml',
6
+ blogDocuments: '*/*.{md,mdx}',
7
+ } as const;
8
+
9
+ /** Check optional sources only; Astro still loads and validates their content. */
10
+ export function hasBlogSources(
11
+ collection: keyof typeof blogPatterns,
12
+ directory = resolve(process.cwd(), 'src/content/blog'),
13
+ ): boolean {
14
+ return (
15
+ existsSync(directory) &&
16
+ globSync(blogPatterns[collection], { cwd: directory }).length > 0
17
+ );
18
+ }
@@ -0,0 +1,26 @@
1
+ import type { Loader } from 'astro/loaders';
2
+ import type { blogPatterns } from '../lib/sproutsite/blog-sources.js';
3
+
4
+ /** Persist readiness alongside Astro's content, rather than infer it from files. */
5
+ export function createBlogReadinessLoader() {
6
+ const readiness = { blogPages: false, blogDocuments: false };
7
+ let context: Parameters<Loader['load']>[0] | undefined;
8
+ const write = () => {
9
+ context?.store.set({ id: 'readiness', data: { ...readiness } });
10
+ };
11
+ const loader: Loader = {
12
+ name: 'sproutsite/blog-readiness',
13
+ async load(nextContext) {
14
+ context = nextContext;
15
+ write();
16
+ },
17
+ };
18
+ return {
19
+ loader,
20
+ setReady(collection: keyof typeof blogPatterns, ready: boolean) {
21
+ if (readiness[collection] === ready) return;
22
+ readiness[collection] = ready;
23
+ write();
24
+ },
25
+ };
26
+ }
@@ -0,0 +1,10 @@
1
+ import { getCollection, getEntry } from 'astro:content';
2
+ import type { blogPatterns } from '../lib/sproutsite/blog-sources.js';
3
+
4
+ /** Query optional collections only after Astro has written their first entry. */
5
+ export async function getBlogCollection<C extends keyof typeof blogPatterns>(
6
+ collection: C,
7
+ ) {
8
+ const state = await getEntry('sproutsiteBlogState', 'readiness');
9
+ return state?.data[collection] ? getCollection(collection) : [];
10
+ }
@@ -2,6 +2,8 @@ import { defineCollection, type ImageFunction } from 'astro:content';
2
2
  import { glob } from 'astro/loaders';
3
3
  import { z } from 'astro/zod';
4
4
  import { heroTypes, sectionSpacings, tones } from '../lib/sproutsite/types.js';
5
+ import { optionalBlogLoader } from './optional-blog-loader.js';
6
+ import { createBlogReadinessLoader } from './blog-state.js';
5
7
 
6
8
  function blogDirectoryId(entry: string): string {
7
9
  const match = entry.match(
@@ -19,6 +21,14 @@ export function createSproutsiteCollections(
19
21
  contentDirectory = './src/content/pages',
20
22
  blogDirectory = './src/content/blog',
21
23
  ) {
24
+ const readiness = createBlogReadinessLoader();
25
+ const sproutsiteBlogState = defineCollection({
26
+ loader: readiness.loader,
27
+ schema: z.object({
28
+ blogPages: z.boolean(),
29
+ blogDocuments: z.boolean(),
30
+ }),
31
+ });
22
32
  const tone = z
23
33
  .union(
24
34
  [
@@ -89,11 +99,12 @@ export function createSproutsiteCollections(
89
99
  });
90
100
 
91
101
  const blogPages = defineCollection({
92
- loader: glob({
93
- base: blogDirectory,
94
- pattern: '*/page*.yaml',
95
- generateId: ({ entry }) => blogDirectoryId(entry),
96
- }),
102
+ loader: optionalBlogLoader(
103
+ 'blogPages',
104
+ blogDirectory,
105
+ ({ entry }) => blogDirectoryId(entry),
106
+ (ready) => readiness.setReady('blogPages', ready),
107
+ ),
97
108
  schema: ({ image }: { image: ImageFunction }) =>
98
109
  z.object({
99
110
  title: z.string().trim().min(1),
@@ -105,13 +116,14 @@ export function createSproutsiteCollections(
105
116
  });
106
117
 
107
118
  const blogDocuments = defineCollection({
108
- loader: glob({
109
- base: blogDirectory,
110
- pattern: '*/*.{md,mdx}',
111
- generateId: ({ entry }) => entry.replace(/\.(?:md|mdx)$/, ''),
112
- }),
119
+ loader: optionalBlogLoader(
120
+ 'blogDocuments',
121
+ blogDirectory,
122
+ ({ entry }) => entry.replace(/\.(?:md|mdx)$/, ''),
123
+ (ready) => readiness.setReady('blogDocuments', ready),
124
+ ),
113
125
  schema: documentSchema,
114
126
  });
115
127
 
116
- return { pages, documents, blogPages, blogDocuments };
128
+ return { pages, documents, blogPages, blogDocuments, sproutsiteBlogState };
117
129
  }
@@ -0,0 +1,77 @@
1
+ import { glob, type Loader } from 'astro/loaders';
2
+ import { fileURLToPath } from 'node:url';
3
+ import {
4
+ blogPatterns,
5
+ hasBlogSources,
6
+ } from '../lib/sproutsite/blog-sources.js';
7
+
8
+ /** Keep an absent/empty optional blog quiet; delegate actual loading to Astro. */
9
+ export function optionalBlogLoader(
10
+ collection: keyof typeof blogPatterns,
11
+ base: string,
12
+ generateId: (options: { entry: string }) => string,
13
+ onReady: (ready: boolean) => void,
14
+ ): Loader {
15
+ const loader = glob({
16
+ base,
17
+ pattern: blogPatterns[collection],
18
+ generateId,
19
+ });
20
+ return {
21
+ name: `sproutsite/optional-${collection}`,
22
+ async load(context) {
23
+ // The filesystem may contain new files before Astro has parsed them.
24
+ // Track actual store writes, including the native loader's watchers.
25
+ const updateReadiness = () =>
26
+ onReady(context.store.keys().length > 0);
27
+ const store: typeof context.store = {
28
+ ...context.store,
29
+ set(entry) {
30
+ const result = context.store.set(entry);
31
+ updateReadiness();
32
+ return result;
33
+ },
34
+ delete(id) {
35
+ context.store.delete(id);
36
+ updateReadiness();
37
+ },
38
+ clear() {
39
+ onReady(false);
40
+ context.store.clear();
41
+ },
42
+ };
43
+ const nativeContext = { ...context, store };
44
+ updateReadiness();
45
+ const directory = fileURLToPath(new URL(base, context.config.root));
46
+ if (hasBlogSources(collection, directory)) {
47
+ await loader.load(nativeContext);
48
+ return;
49
+ }
50
+ store.clear();
51
+ const watcher = context.watcher;
52
+ if (!watcher) return;
53
+ // The native glob loader takes over as soon as the first matching
54
+ // source is created. Do not create folders, placeholder entries or
55
+ // suppress Astro's diagnostics for content that actually exists.
56
+ watcher.add(directory);
57
+ let loading = false;
58
+ const onAdd = async () => {
59
+ if (loading || !hasBlogSources(collection, directory)) return;
60
+ loading = true;
61
+ try {
62
+ await loader.load(nativeContext);
63
+ watcher.off('add', onAdd);
64
+ watcher.off('change', onAdd);
65
+ } catch (error) {
66
+ context.logger.error(
67
+ error instanceof Error ? error.message : String(error),
68
+ );
69
+ } finally {
70
+ loading = false;
71
+ }
72
+ };
73
+ watcher.on('add', onAdd);
74
+ watcher.on('change', onAdd);
75
+ },
76
+ };
77
+ }
@@ -10,6 +10,7 @@ import BlogPost from '../themes/default/components/organisms/BlogPost/BlogPost.a
10
10
  import Hero from '../themes/default/components/organisms/Hero/Hero.astro';
11
11
  import PageTitle from '../themes/default/components/organisms/PageTitle/PageTitle.astro';
12
12
  import Section from '../themes/default/components/organisms/Section/Section.astro';
13
+ import { getBlogCollection } from './blog.js';
13
14
 
14
15
  type Locale = 'en' | 'de';
15
16
 
@@ -33,7 +34,7 @@ export async function getSproutsiteStaticPaths(locale: Locale = 'en') {
33
34
  },
34
35
  props: { page, locale },
35
36
  }));
36
- const posts = (await getCollection('blogPages'))
37
+ const posts = (await getBlogCollection('blogPages'))
37
38
  .filter((entry) => localeOf(entry.id) === locale)
38
39
  .sort(
39
40
  (left, right) =>
@@ -41,7 +42,7 @@ export async function getSproutsiteStaticPaths(locale: Locale = 'en') {
41
42
  );
42
43
  const assembledPosts = assemblePages(
43
44
  posts,
44
- (await getCollection('blogDocuments')).filter(
45
+ (await getBlogCollection('blogDocuments')).filter(
45
46
  (entry) => localeOf(entry.id) === locale,
46
47
  ),
47
48
  (entry) => blogRouteFromId(logicalId(entry.id)),
@@ -8,6 +8,7 @@ import { t } from '../../../i18n/index.js';
8
8
  import Icon from '../../atoms/Icon/Icon.astro';
9
9
  import englishFlag from 'flag-icons/flags/4x3/gb.svg?url&no-inline';
10
10
  import germanFlag from 'flag-icons/flags/4x3/de.svg?url&no-inline';
11
+ import { getBlogCollection } from '../../../../../package/blog.js';
11
12
 
12
13
  interface Props {
13
14
  site: SiteConfig;
@@ -16,7 +17,7 @@ interface Props {
16
17
  const { site, route } = Astro.props;
17
18
  const [pages, posts] = await Promise.all([
18
19
  getCollection('pages'),
19
- getCollection('blogPages'),
20
+ getBlogCollection('blogPages'),
20
21
  ]);
21
22
  const flags: Record<string, string> = { en: englishFlag, de: germanFlag };
22
23
  const options = languageLinks(