uniweb 0.12.21 → 0.12.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.
@@ -94,13 +94,24 @@ export async function scaffoldFoundation(targetDir, context, options = {}) {
94
94
  /**
95
95
  * Scaffold a site from the site package template
96
96
  *
97
+ * Two shapes, by whether a local foundation is wired:
98
+ * - Local foundation (the default for `create`/`add site`): pass
99
+ * `foundationName` + `foundationPath` (a `file:` spec) and the site's
100
+ * package.json gets that dependency.
101
+ * - Referenced foundation (no local sibling — what `uniweb clone` uses):
102
+ * OMIT `foundationName`/`foundationPath` and set `foundationRef` to a
103
+ * registry ref (`@ns/name@ver`) or URL. No `file:` dependency is written;
104
+ * `site.yml::foundation` carries the ref and the runtime loads it as a
105
+ * federated module (runtime mode). Deps still pin to the CLI version
106
+ * matrix via the template's `{{version}}` helper.
107
+ *
97
108
  * @param {string} targetDir - Target directory for the site
98
109
  * @param {Object} context - Template context
99
110
  * @param {string} context.name - Package name
100
111
  * @param {string} context.projectName - Workspace name
101
- * @param {string} context.foundationName - Foundation package name
102
- * @param {string} context.foundationPath - Relative file: path to foundation
103
- * @param {string} [context.foundationRef] - Foundation ref for site.yml (when multiple foundations)
112
+ * @param {string} [context.foundationName] - Local foundation package name (omit for a referenced foundation)
113
+ * @param {string} [context.foundationPath] - Relative file: path to a local foundation (omit for a referenced foundation)
114
+ * @param {string} [context.foundationRef] - Foundation ref written to site.yml (a local package name, a registry ref, or a URL)
104
115
  * @param {Object} [options] - Processing options
105
116
  */
106
117
  export async function scaffoldSite(targetDir, context, options = {}) {
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Dep-free reader for the foundation ref the backend populates on a site-content
3
+ * document.
4
+ *
5
+ * Kept free of `@uniweb/build` so it's importable from `clone` (global, runs before a
6
+ * project exists) — the same constraint that keeps utils/placement.js dependency-free.
7
+ *
8
+ * The site-content `$`-document carries, on its `info` brief, the `foundation` ref the
9
+ * backend fills in when it wires a site. The reader is tolerant — a backend field
10
+ * rename should degrade, not crash — and is the single adjust-point if the wire field
11
+ * name settles differently. (The site's `@uniweb/folder` is NOT read here: the backend
12
+ * resolves it from the site-content uuid, so the framework never holds a folder uuid.)
13
+ */
14
+
15
+ /**
16
+ * The site's foundation ref — a URL or our `@ns/name@ver`. Written verbatim into
17
+ * site.yml; the runtime loads it as a federated module.
18
+ */
19
+ export function extractFoundationRef(info = {}, document = {}) {
20
+ return info?.foundation ?? info?.foundation_name ?? document?.foundation ?? null
21
+ }
@@ -0,0 +1,5 @@
1
+ node_modules
2
+ dist
3
+ _entry.generated.js
4
+ .DS_Store
5
+ *.local
@@ -0,0 +1,5 @@
1
+ node_modules
2
+ dist
3
+ .uniweb/
4
+ .DS_Store
5
+ *.local
@@ -10,8 +10,8 @@
10
10
  "preview": "vite preview"
11
11
  },
12
12
  "dependencies": {
13
- "@uniweb/runtime": "{{version "@uniweb/runtime"}}",
14
- "{{foundationName}}": "{{foundationPath}}"
13
+ "@uniweb/runtime": "{{version "@uniweb/runtime"}}"{{#if foundationPath}},
14
+ "{{foundationName}}": "{{foundationPath}}"{{/if}}
15
15
  },
16
16
  "devDependencies": {
17
17
  "@tailwindcss/vite": "^4.0.0",
@@ -0,0 +1,33 @@
1
+ # Dependencies
2
+ node_modules/
3
+
4
+ # Build outputs
5
+ dist/
6
+ .uniweb/
7
+
8
+ # Generated entry (regenerated by `uniweb build`; never committed)
9
+ _entry.generated.js
10
+
11
+ # Local mock-cloud state (when running `uniweb publish --local` or
12
+ # the unicloud dev server inside this workspace)
13
+ .unicloud/
14
+
15
+ # Environment
16
+ .env
17
+ .env.local
18
+ .env.*.local
19
+
20
+ # IDE
21
+ .vscode/
22
+ .idea/
23
+ *.swp
24
+ *.swo
25
+
26
+ # OS
27
+ .DS_Store
28
+ Thumbs.db
29
+
30
+ # Logs
31
+ *.log
32
+ npm-debug.log*
33
+ pnpm-debug.log*