@uniweb/build 0.11.2 → 0.11.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uniweb/build",
3
- "version": "0.11.2",
3
+ "version": "0.11.3",
4
4
  "description": "Build tooling for the Uniweb Component Web Platform",
5
5
  "type": "module",
6
6
  "exports": {
@@ -57,8 +57,8 @@
57
57
  "@uniweb/theming": "0.1.3"
58
58
  },
59
59
  "optionalDependencies": {
60
- "@uniweb/runtime": "0.8.4",
61
- "@uniweb/content-reader": "1.1.5",
60
+ "@uniweb/runtime": "0.8.5",
61
+ "@uniweb/content-reader": "1.1.6",
62
62
  "@uniweb/schemas": "0.2.1"
63
63
  },
64
64
  "peerDependencies": {
@@ -68,7 +68,7 @@
68
68
  "@tailwindcss/vite": "^4.0.0",
69
69
  "@vitejs/plugin-react": "^4.0.0 || ^5.0.0",
70
70
  "vite-plugin-svgr": "^4.0.0",
71
- "@uniweb/core": "0.7.3"
71
+ "@uniweb/core": "0.7.4"
72
72
  },
73
73
  "peerDependenciesMeta": {
74
74
  "vite": {
@@ -1,13 +1,32 @@
1
1
  /**
2
2
  * Clean Content Entry Point
3
3
  *
4
- * Exposes only collectSiteContent and its clean dependency chain
5
- * (Node builtins, js-yaml, @uniweb/theming). No Vite, sharp, or React.
6
- *
7
- * Used by Studio's sidecar (Bun-compiled binary) where those heavy
8
- * peer/native dependencies aren't available.
4
+ * Exposes content-collection helpers and their clean dependency chain
5
+ * (Node builtins, js-yaml, @uniweb/theming, @uniweb/core). No Vite,
6
+ * sharp, or React. Used by Studio's sidecar (Bun-compiled binary) and
7
+ * by @uniweb/unipress (CLI compile path) where those heavy peer/native
8
+ * dependencies aren't available.
9
9
  *
10
10
  * @module @uniweb/build/content
11
11
  */
12
12
 
13
13
  export { collectSiteContent } from '../site/content-collector.js'
14
+
15
+ // Collections + fetch resolution. Pure functions on the clean dep
16
+ // chain — re-exported here so headless callers (unipress, sidecars)
17
+ // can resolve `collections:` declarations without importing
18
+ // `@uniweb/build/site` (which pulls Vite via its plugin index).
19
+ export {
20
+ processCollections,
21
+ writeCollectionFiles,
22
+ getCollectionLastModified,
23
+ } from '../site/collection-processor.js'
24
+ export {
25
+ parseFetchConfig,
26
+ executeFetch,
27
+ applyFilter,
28
+ applySort,
29
+ applyPostProcessing,
30
+ mergeDataIntoContent,
31
+ singularize,
32
+ } from '../site/data-fetcher.js'
@@ -181,13 +181,19 @@ async function readYamlFile(filePath) {
181
181
  /**
182
182
  * Extract inset references from a ProseMirror document.
183
183
  *
184
- * Walks top-level nodes for `inset_ref` (produced by content-reader
185
- * for `![alt](@ComponentName){params}` syntax). Each ref is removed from the
186
- * document and replaced with an `inset_placeholder` node carrying a
187
- * unique refId. The extracted refs are returned as an array.
184
+ * Walks the document recursively for `inset_ref` nodes (produced by
185
+ * content-reader for the `![alt](@ComponentName){params}` /
186
+ * `[text](@ComponentName){params}` / `[@key]{params}` forms). Each ref
187
+ * is removed and replaced in-place with an `inset_placeholder` node
188
+ * carrying a unique refId. The extracted refs are returned as an array.
189
+ *
190
+ * Inline insets (mid-paragraph) are kept as inline placeholders so the
191
+ * paragraph's text flow is preserved; block-level insets (own line)
192
+ * stay at the document root. Both share the same refId/getInset(refId)
193
+ * lookup machinery — only the position differs.
188
194
  *
189
195
  * @param {Object} doc - ProseMirror document (mutated in place)
190
- * @returns {Array} Array of { refId, type, params, description }
196
+ * @returns {Array} Array of { refId, type, params, description, embedKind }
191
197
  */
192
198
  function extractInsets(doc) {
193
199
  if (!doc?.content || !Array.isArray(doc.content)) return []
@@ -195,25 +201,34 @@ function extractInsets(doc) {
195
201
  const insets = []
196
202
  let refIndex = 0
197
203
 
198
- for (let i = 0; i < doc.content.length; i++) {
199
- const node = doc.content[i]
200
- if (node.type === 'inset_ref') {
201
- const { component, alt, ...params } = node.attrs || {}
202
- const refId = `inset_${refIndex++}`
203
- insets.push({
204
- refId,
205
- type: component,
206
- params: Object.keys(params).length > 0 ? params : {},
207
- title: alt || null,
208
- })
209
- // Replace in-place with placeholder
210
- doc.content[i] = {
211
- type: 'inset_placeholder',
212
- attrs: { refId },
204
+ function visit(nodes) {
205
+ if (!Array.isArray(nodes)) return
206
+ for (let i = 0; i < nodes.length; i++) {
207
+ const node = nodes[i]
208
+ if (!node) continue
209
+ if (node.type === 'inset_ref') {
210
+ const { component, alt, embedKind, ...params } = node.attrs || {}
211
+ const refId = `inset_${refIndex++}`
212
+ insets.push({
213
+ refId,
214
+ type: component,
215
+ embedKind: embedKind || 'visual',
216
+ params: Object.keys(params).length > 0 ? params : {},
217
+ title: alt || null,
218
+ })
219
+ nodes[i] = {
220
+ type: 'inset_placeholder',
221
+ attrs: { refId, embedKind: embedKind || 'visual' },
222
+ }
223
+ continue
224
+ }
225
+ if (Array.isArray(node.content)) {
226
+ visit(node.content)
213
227
  }
214
228
  }
215
229
  }
216
230
 
231
+ visit(doc.content)
217
232
  return insets
218
233
  }
219
234