@uniweb/unipress 0.4.20 → 0.4.22

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
@@ -40,7 +40,7 @@ Foundations consume [@uniweb/press](https://github.com/uniweb/press) for the byt
40
40
  brew install uniweb/unipress/unipress
41
41
  ```
42
42
 
43
- Updates land via `brew upgrade unipress`. The macOS binary is signed with the Proximify Inc. Developer ID and Apple-notarized — no Gatekeeper warnings.
43
+ Updates land via `brew upgrade unipress`. On recent Homebrew (6.x), the first `install` or `upgrade` may refuse the tap until you trust it once — run `brew trust uniweb/unipress`, then re-run the command. The macOS binary is signed with the Proximify Inc. Developer ID and Apple-notarized — no Gatekeeper warnings.
44
44
 
45
45
  **Manual download (Windows, or any platform without Homebrew).** Grab the asset for your platform from [the releases page](https://github.com/uniweb/unipress/releases), make it executable (Unix), and put it somewhere on your `PATH`. On macOS and Linux, `/usr/local/bin/unipress` is a common location.
46
46
 
@@ -1,11 +1,24 @@
1
1
  # Troubleshooting
2
2
 
3
- When `unipress compile` fails, the error message names a class and a cause. This file pairs each with what it usually means and how to fix it.
3
+ `unipress` surfaces actionable failures at install and compile time each names a class and a cause. This file pairs each with what it usually means and how to fix it.
4
4
 
5
- Every `unipress` error exits with code `1` (user-addressable). Unknown errors exit with code `2` — those are internal bugs; re-run with `--verbose` and open an issue.
5
+ Every `unipress` *compile* error exits with code `1` (user-addressable). Unknown errors exit with code `2` — those are internal bugs; re-run with `--verbose` and open an issue.
6
6
 
7
7
  ---
8
8
 
9
+ ## Homebrew: `Error: Refusing to load formula ... from untrusted tap uniweb/unipress`
10
+
11
+ Recent Homebrew (6.x) won't load a formula from a third-party tap until you've trusted it once. This blocks both the first `brew install uniweb/unipress/unipress` and later `brew upgrade unipress`.
12
+
13
+ Trust the tap once, then re-run the command:
14
+
15
+ ```bash
16
+ brew trust uniweb/unipress
17
+ brew upgrade unipress # or: brew install uniweb/unipress/unipress
18
+ ```
19
+
20
+ This is a Homebrew policy for third-party taps, not specific to unipress. The npm install (`npm i -g @uniweb/unipress`) and the prebuilt binaries on the [releases page](https://github.com/uniweb/unipress/releases) are unaffected.
21
+
9
22
  ## `ContentDirectoryError: content directory does not exist: <path>`
10
23
 
11
24
  The positional argument to `unipress compile` is wrong. Check your `cd` and the spelling. Paths are relative to the current working directory.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uniweb/unipress",
3
- "version": "0.4.20",
3
+ "version": "0.4.22",
4
4
  "description": "Compile a content directory into a document (PDF, EPUB, Paged.js HTML, Typst source bundle, DOCX, XLSX) using a Uniweb foundation. Five built-in templates: book, monograph, report, data-report, directory.",
5
5
  "type": "module",
6
6
  "publishConfig": {
@@ -49,14 +49,18 @@
49
49
  "prompts": "^2.4.2",
50
50
  "react": "^19.0.0",
51
51
  "react-dom": "^19.0.0",
52
- "@uniweb/runtime": "0.8.18",
53
- "@uniweb/core": "0.7.13",
54
- "@uniweb/semantic-parser": "1.1.17",
55
52
  "@uniweb/content-reader": "1.1.12",
56
- "@uniweb/build": "0.14.14"
53
+ "@uniweb/semantic-parser": "1.1.17",
54
+ "@uniweb/build": "0.14.15",
55
+ "@uniweb/core": "0.7.14",
56
+ "@uniweb/runtime": "0.8.19"
57
+ },
58
+ "devDependencies": {
59
+ "vitest": "^4.1.7"
57
60
  },
58
61
  "scripts": {
59
- "test": "echo \"no tests yet\" && exit 0",
62
+ "test": "vitest run",
63
+ "test:watch": "vitest",
60
64
  "lint": "echo \"no lint yet\" && exit 0",
61
65
  "audit:docs": "node scripts/audit-documents.js"
62
66
  }
@@ -41,13 +41,21 @@ function findCollectionRecords(fetchConfig, resolved) {
41
41
  return records
42
42
  }
43
43
 
44
- function attachSectionFetches(sections, resolved) {
44
+ // Walk a section tree attaching collection records to each section's
45
+ // parsedContent.data.<schema>. A section's OWN fetch is attached first
46
+ // (so it wins under attachData's first-writer-wins guard); the page-level
47
+ // `cascade` ({ schema, records }) then fills any remaining gap — for this
48
+ // section AND every nested subsection. Threading the cascade through the
49
+ // recursion is what lets a page-level `data:` declaration reach nested
50
+ // children (declared via page.yml `nest:`), not just top-level sections.
51
+ function attachSectionFetches(sections, resolved, cascade = null) {
45
52
  if (!Array.isArray(sections)) return
46
53
  for (const section of sections) {
47
54
  const records = findCollectionRecords(section.fetch, resolved)
48
55
  if (records) attachData(section, section.fetch.schema, records)
56
+ if (cascade) attachData(section, cascade.schema, cascade.records)
49
57
  if (Array.isArray(section.subsections) && section.subsections.length) {
50
- attachSectionFetches(section.subsections, resolved)
58
+ attachSectionFetches(section.subsections, resolved, cascade)
51
59
  }
52
60
  }
53
61
  }
@@ -86,13 +94,14 @@ async function resolveLocalCollections(siteContent, sitePath) {
86
94
  )
87
95
 
88
96
  for (const page of siteContent.pages || []) {
97
+ // Page-level fetch cascades to every section on the page — top-level
98
+ // and nested alike. attachSectionFetches threads it through the whole
99
+ // section tree; a section's own fetch still takes priority.
89
100
  const pageRecords = findCollectionRecords(page.fetch, resolved)
90
- if (pageRecords) {
91
- for (const section of page.sections || []) {
92
- attachData(section, page.fetch.schema, pageRecords)
93
- }
94
- }
95
- attachSectionFetches(page.sections, resolved)
101
+ const cascade = pageRecords
102
+ ? { schema: page.fetch.schema, records: pageRecords }
103
+ : null
104
+ attachSectionFetches(page.sections, resolved, cascade)
96
105
  }
97
106
 
98
107
  // Stash the resolved arrays on the website config too, so any section