@janga/norna 0.7.28 → 0.7.29

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.
Files changed (77) hide show
  1. package/README.md +8 -5
  2. package/astro.config.mjs +14 -2
  3. package/package.json +10 -8
  4. package/schemas/config.schema.json +80 -65
  5. package/schemas/content-frontmatter.schema.json +15 -8
  6. package/schemas/manifest.json +1 -1
  7. package/schemas/page-theme.schema.json +237 -237
  8. package/schemas/root-theme.schema.json +237 -237
  9. package/schemas/sitewide-content.schema.json +18 -18
  10. package/schemas/theme.schema.json +237 -237
  11. package/scripts/add-site-node.mjs +29 -100
  12. package/scripts/dev-local.mjs +34 -7
  13. package/scripts/generate-images.mjs +83 -65
  14. package/scripts/generate-search-index.mjs +3 -2
  15. package/scripts/lib/attachment-render.mjs +23 -0
  16. package/scripts/lib/dev-server-identity.mjs +30 -0
  17. package/scripts/lib/documentation-routes.json +63 -62
  18. package/scripts/lib/docusaurus-migration-audit.mjs +9 -9
  19. package/scripts/lib/editor-attachments.mjs +69 -0
  20. package/scripts/lib/editor-file-policy.mjs +2 -0
  21. package/scripts/lib/editor-language-service.mjs +21 -18
  22. package/scripts/lib/editor-page-addresses.mjs +5 -3
  23. package/scripts/lib/editor-page-placement.mjs +28 -98
  24. package/scripts/lib/editor-resource-actions.mjs +216 -0
  25. package/scripts/lib/editor-site-editing-tree.mjs +44 -9
  26. package/scripts/lib/editor-site-files.mjs +3 -2
  27. package/scripts/lib/editor-site-links.mjs +6 -4
  28. package/scripts/lib/editor-site-preview.mjs +149 -0
  29. package/scripts/lib/editor-site-tree.mjs +10 -3
  30. package/scripts/lib/editor-source-files.mjs +1 -1
  31. package/scripts/lib/logo-assets.mjs +2 -1
  32. package/scripts/lib/markdown-images.mjs +59 -0
  33. package/scripts/lib/markdown-links.mjs +29 -9
  34. package/scripts/lib/norna-markdown-blocks.mjs +0 -57
  35. package/scripts/lib/norna-markdown-render-plugin.mjs +29 -0
  36. package/scripts/lib/page-aliases.mjs +5 -0
  37. package/scripts/lib/page-attachments.mjs +59 -0
  38. package/scripts/lib/page-markdown.mjs +11 -7
  39. package/scripts/lib/page-model.mjs +8 -22
  40. package/scripts/lib/page-move-apply.mjs +6 -4
  41. package/scripts/lib/page-move-plan.mjs +37 -19
  42. package/scripts/lib/page-order-source.mjs +22 -0
  43. package/scripts/lib/page-order.mjs +45 -0
  44. package/scripts/lib/page-placement-cli.mjs +50 -0
  45. package/scripts/lib/project-config.mjs +3 -0
  46. package/scripts/lib/publication-paths.mjs +72 -0
  47. package/scripts/lib/schema-definitions.mjs +4 -0
  48. package/scripts/lib/schema-editor-metadata.mjs +4 -1
  49. package/scripts/lib/site-content.mjs +1 -1
  50. package/scripts/lib/site-link-graph.mjs +88 -18
  51. package/scripts/lib/site-node-create.mjs +47 -34
  52. package/scripts/lib/site-paths.mjs +2 -2
  53. package/scripts/lib/site-source-format.mjs +12 -0
  54. package/scripts/lib/site-structure.mjs +14 -13
  55. package/scripts/lib/site-upgrade.mjs +2 -0
  56. package/scripts/lib/social-image-assets.mjs +2 -1
  57. package/scripts/lib/source-files.mjs +1 -1
  58. package/scripts/lib/structured-blocks.mjs +3 -1
  59. package/scripts/move-site-page.mjs +46 -133
  60. package/scripts/sync-content-sections.mjs +8 -10
  61. package/scripts/sync-site-public.mjs +44 -66
  62. package/src/components/ContentBlocks.astro +2 -1
  63. package/src/components/ImageStack.astro +7 -5
  64. package/src/components/SearchPage.astro +2 -1
  65. package/src/components/SitePage.astro +1 -0
  66. package/src/components/SiteSection.astro +1 -0
  67. package/src/content.config.ts +1 -4
  68. package/src/lib/imagePresentation.ts +3 -0
  69. package/src/lib/markdownImages.ts +101 -0
  70. package/src/lib/sectionContent.ts +64 -19
  71. package/src/lib/sitePages.ts +4 -30
  72. package/src/lib/sitePublicAssets.ts +2 -1
  73. package/src/pages/[...slug].astro +2 -1
  74. package/src/styles/area-navigation.css +14 -5
  75. package/src/styles/content.css +6 -0
  76. package/src/styles/media.css +24 -0
  77. package/starters/basic/site/site-config/settings.yaml +1 -0
package/README.md CHANGED
@@ -60,21 +60,24 @@ site/
60
60
  |-- page-theme.yaml # Optional homepage-only overrides
61
61
  |-- images/
62
62
  `-- pages/
63
- `-- 010-guide/
63
+ `-- guide/
64
64
  |-- content.md
65
65
  |-- tree-theme.yaml # Optional inherited branch overrides
66
66
  |-- images/
67
67
  `-- pages/
68
- `-- 010-install/content.md
68
+ `-- install/content.md
69
69
  ```
70
70
 
71
71
  - `root/content.md` is the required homepage at `/`; `root/pages/` contains its
72
72
  children. The site container holds shared configuration and public files
73
73
  beside this root page. `root/` never becomes a URL segment.
74
- - Every ordered directory under `pages/` contains `content.md` for a routable
74
+ - Every page directory under `pages/` contains `content.md` for a routable
75
75
  page. A parent can append a generated list of its direct child pages with
76
76
  `page.listChildren: true`; see
77
77
  [Child-page lists](https://janga.github.io/norna/reference/site/pages/#list-child-pages).
78
+ - Page directories use their URL slug. Set optional `navigation.order` in each
79
+ page’s frontmatter to order siblings; reordering keeps their paths unchanged.
80
+ New sites declare `sourceFormat: 2` in `site-config/settings.yaml`.
78
81
  - A page may contain local images, visual settings and nested
79
82
  entries under its own `pages/` directory.
80
83
  - `root/tree-theme.yaml` selects shared visual defaults. Optional `page-theme.yaml`
@@ -85,7 +88,7 @@ site/
85
88
  footer content.
86
89
  - `site-config/settings.yaml` holds the public URL and optional language, local and remote
87
90
  source links, navigation model, static search, and scroll behavior.
88
- - `public/` holds static files copied without processing.
91
+ - `public/` holds supported technical files and named site artwork (logo, icons and sharing image). Content images and documents belong in each page's `images/` and `downloads/`.
89
92
 
90
93
  Norna validates this structure, processes managed images when needed, and
91
94
  builds the generated website into `dist/`. Sites using an earlier layout need
@@ -161,7 +164,7 @@ Engine contributors should start with
161
164
  [Engine Development](docs/engine-development.md). Planning and future work are
162
165
  tracked in [BACKLOG.md](BACKLOG.md).
163
166
 
164
- The user reference is authored once under `site/root/pages/032-reference/` and
167
+ The user reference is authored once under `site/root/pages/reference/` and
165
168
  rendered on the documentation site. It describes current development; use the
166
169
  installed release's Git tag when checking older behavior. Tags through 0.7.26
167
170
  keep their reference under `docs/`; later tags use the documentation page tree.
package/astro.config.mjs CHANGED
@@ -1,3 +1,6 @@
1
+ import { compiledOutputDirectory } from './scripts/lib/publication-paths.mjs';
2
+ import { devServerIdentityPlugin } from './scripts/lib/dev-server-identity.mjs';
3
+ import { rewriteAttachmentLinks } from './scripts/lib/attachment-render.mjs';
1
4
  // @ts-check
2
5
  import { execFile } from 'node:child_process';
3
6
  import path from 'node:path';
@@ -16,6 +19,9 @@ import {
16
19
  astroPublicDir,
17
20
  engineRoot,
18
21
  generatedImagesManifestPath,
22
+ siteDir,
23
+ sitePublicDir,
24
+ siteConfigPath,
19
25
  siteContentPath,
20
26
  siteHomePageDir,
21
27
  siteImagesDir,
@@ -73,9 +79,12 @@ const nornaGeneratedImagesWatcher = () => ({
73
79
  const manifestPath = path.resolve(generatedImagesManifestPath);
74
80
  const watchedSourcePaths = [
75
81
  siteContentPath,
82
+ sitePublicDir,
83
+ siteConfigPath,
76
84
  path.join(siteHomePageDir, 'tree-theme.yaml'),
77
85
  path.join(siteHomePageDir, 'page-theme.yaml'),
78
86
  siteImagesDir,
87
+ path.join(siteHomePageDir, 'downloads'),
79
88
  sitePagesDir,
80
89
  ].map((watchedPath) => path.resolve(watchedPath));
81
90
  let refreshTimer;
@@ -95,6 +104,7 @@ const nornaGeneratedImagesWatcher = () => ({
95
104
  .then(async () => {
96
105
  try {
97
106
  await runGenerateImages();
107
+ await execFileAsync(process.execPath, [path.join(engineRoot, 'scripts', 'sync-site-public.mjs')], { cwd: siteProjectRoot });
98
108
  } catch (error) {
99
109
  const message = error instanceof Error ? error.message : String(error);
100
110
  server.config.logger.error(`Norna image refresh failed:\n${message}`);
@@ -153,7 +163,8 @@ markdownProcessor.createRenderer = async (shared) => {
153
163
  const renderer = await createMarkdownRenderer(shared);
154
164
  return {
155
165
  ...renderer,
156
- render(source, options) {
166
+ async render(source, options) {
167
+ source = await rewriteAttachmentLinks(source, options?.fileURL, siteDir);
157
168
  return renderer.render(prepareContentTabs(source, {
158
169
  label: options?.fileURL?.pathname ?? 'Markdown',
159
170
  }), options);
@@ -164,6 +175,7 @@ markdownProcessor.createRenderer = async (shared) => {
164
175
  // https://astro.build/config
165
176
  export default defineConfig({
166
177
  base: projectConfig.site.basePath,
178
+ build: { assets: compiledOutputDirectory },
167
179
  cacheDir: astroCacheDir,
168
180
  prefetch: { prefetchAll: false, defaultStrategy: 'hover' },
169
181
  integrations: [{
@@ -193,6 +205,6 @@ export default defineConfig({
193
205
  server: {
194
206
  strictPort: true,
195
207
  },
196
- plugins: [nornaBasePathRedirect(), nornaGeneratedImagesWatcher()],
208
+ plugins: [nornaBasePathRedirect(), devServerIdentityPlugin(siteDir), nornaGeneratedImagesWatcher()],
197
209
  },
198
210
  });
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@janga/norna",
3
3
  "description": "An opinionated CLI for building responsive websites from Markdown, images, and theme presets.",
4
4
  "type": "module",
5
- "version": "0.7.28",
5
+ "version": "0.7.29",
6
6
  "license": "GPL-3.0-only",
7
7
  "repository": {
8
8
  "type": "git",
@@ -105,11 +105,11 @@
105
105
  "test:fixture:build": "node scripts/test-basic-fixture-build.mjs",
106
106
  "test:examples": "node scripts/test-examples.mjs",
107
107
  "test:examples:browser": "node scripts/test-navigation.mjs --site-dir site tests/examples-gallery.spec.ts",
108
- "test:page-model": "node scripts/test-page-model.mjs",
108
+ "test:page-model": "node scripts/test-page-model.mjs && node --test scripts/test-page-order.mjs scripts/test-page-order-integration.mjs",
109
109
  "test:site-upgrade": "node scripts/test-site-upgrade.mjs",
110
110
  "test:page-markdown": "node scripts/test-page-markdown.mjs && node scripts/test-structured-blocks.mjs && node scripts/test-named-notes.mjs && node scripts/test-content-tabs.mjs",
111
111
  "test:tabs:browser": "node scripts/test-navigation.mjs --site-dir fixtures/content-tabs/site tests/content-tabs.spec.ts",
112
- "test:site-links": "node scripts/test-site-link-graph.mjs",
112
+ "test:site-links": "node scripts/test-site-link-graph.mjs && node --test scripts/test-page-attachments.mjs",
113
113
  "test:page-aliases": "node scripts/test-page-aliases.mjs",
114
114
  "test:sitemap": "node scripts/test-sitemap.mjs",
115
115
  "test:not-found-page": "node scripts/test-not-found-page.mjs",
@@ -129,9 +129,10 @@
129
129
  "test:content-sync-plan": "node scripts/test-content-sync-plan.mjs",
130
130
  "test:content-model": "npm run test:page-content && npm run test:managed-media && npm run test:content-sync && npm run test:markdown-constructs",
131
131
  "test:page-content": "node scripts/test-page-content.mjs",
132
- "test:managed-media": "node scripts/test-managed-media.mjs",
132
+ "test:managed-media": "node scripts/test-managed-media.mjs && node scripts/test-markdown-images.mjs",
133
+ "test:markdown-images:browser": "node scripts/test-navigation.mjs --site-dir fixtures/markdown-images/site tests/markdown-images.spec.ts",
133
134
  "test:content-sync": "node scripts/test-content-sync.mjs",
134
- "test:markdown-constructs": "node scripts/test-markdown-constructs.mjs",
135
+ "test:markdown-constructs": "node scripts/test-markdown-constructs.mjs && node scripts/test-standard-markdown-compatibility.mjs",
135
136
  "test:theme-presets": "node scripts/test-theme-presets.mjs",
136
137
  "test:presentation-contract": "node scripts/test-presentation-contract.mjs",
137
138
  "test:presentation-review": "node scripts/test-presentation-review-fixture.mjs",
@@ -150,13 +151,14 @@
150
151
  "preset:documentation:review:build": "node scripts/review-documentation-preset.mjs --build-only",
151
152
  "palette:review": "node scripts/review-documentation-preset.mjs --palettes",
152
153
  "palette:review:build": "node scripts/review-documentation-preset.mjs --palettes --build-only",
153
- "test:site-public": "node scripts/test-site-public.mjs",
154
+ "test:site-public": "node scripts/test-site-public.mjs && node --test scripts/test-publication-paths.mjs",
154
155
  "test:cli-discovery": "node scripts/test-cli-discovery.mjs",
155
- "test:dev-local": "node scripts/test-dev-local.mjs",
156
+ "test:dev-local": "node scripts/test-dev-local.mjs && npm run test:editor-preview",
157
+ "test:editor-preview": "node --test scripts/test-editor-site-preview.mjs && node --test editors/vscode/test/site-preview-actions-contract.mjs",
156
158
  "test:review-environments": "node scripts/test-review-environments.mjs",
157
159
  "test:review-environments:browser": "node scripts/test-review-environments-browser.mjs",
158
160
  "test:engine-commands": "node scripts/test-engine-commands.mjs",
159
- "test:editor-language": "node scripts/test-editor-language-service.mjs && npm --prefix editors/vscode run check",
161
+ "test:editor-language": "node scripts/test-editor-language-service.mjs && node --test scripts/test-editor-resource-actions.mjs && npm --prefix editors/vscode run check",
160
162
  "test:editor-integration": "npm --prefix editors/vscode run test:integration",
161
163
  "test:editor-integration:minimum": "npm --prefix editors/vscode run test:integration:minimum",
162
164
  "test:documentation": "node scripts/test-documentation.mjs",