@metaobjectsdev/docs-site 0.15.10 → 0.15.11
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/dist/load.d.ts.map +1 -1
- package/dist/load.js +31 -2
- package/dist/load.js.map +1 -1
- package/package.json +3 -3
- package/src/load.ts +31 -2
package/dist/load.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"load.d.ts","sourceRoot":"","sources":["../src/load.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"load.d.ts","sourceRoot":"","sources":["../src/load.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAGzF,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,QAAQ,CAAC;IACf,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,UAAU,EAAE,MAAM,EAAE,CAAC;CACtB;AAED;;;;;;;;GAQG;AACH,wBAAsB,SAAS,CAC7B,UAAU,EAAE,MAAM,EAAE,EACpB,cAAc,GAAE,SAAS,oBAAoB,EAAO,GACnD,OAAO,CAAC,WAAW,CAAC,CAmCtB;AAoBD,oGAAoG;AACpG,wBAAgB,MAAM,CAAC,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,WAAW,GAAG,MAAM,CAKjE"}
|
package/dist/load.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { mkdtempSync, rmSync, symlinkSync } from "node:fs";
|
|
1
|
+
import { mkdtempSync, readdirSync, rmSync, statSync, symlinkSync } from "node:fs";
|
|
2
2
|
import { tmpdir } from "node:os";
|
|
3
3
|
import { basename, join, resolve } from "node:path";
|
|
4
4
|
import { MetaDataLoader, composeRegistry, coreTypesProvider, dbProvider, docProvider, promptProvider, uiProvider } from "@metaobjectsdev/metadata";
|
|
5
|
+
import { FileSource } from "@metaobjectsdev/metadata/core";
|
|
5
6
|
/**
|
|
6
7
|
* Load N metadata source dirs into ONE root via a staging dir of symlinks.
|
|
7
8
|
*
|
|
@@ -24,7 +25,15 @@ export async function loadModel(sourceDirs, extraProviders = []) {
|
|
|
24
25
|
symlinkSync(resolve(dir), join(staging, baseName));
|
|
25
26
|
}
|
|
26
27
|
const registry = composeRegistry([coreTypesProvider, dbProvider, docProvider, promptProvider, uiProvider, ...extraProviders]);
|
|
27
|
-
|
|
28
|
+
// Feed files in files-before-subdirs order (the same order the sdk's loadMemory
|
|
29
|
+
// uses), NOT fromDirectory's flat basename sort. Cross-file overlays require the
|
|
30
|
+
// base (typically a top-level file) to load before an overlay that lives in a
|
|
31
|
+
// nested dir; the basename sort can otherwise process e.g.
|
|
32
|
+
// `admin-ui/x.admin.yaml` before its base `x.yaml` and fail with
|
|
33
|
+
// ERR_OVERLAY_NO_TARGET. (fromDirectory's basename order is a cross-port
|
|
34
|
+
// DirectorySource contract, so we order at this boundary rather than change it.)
|
|
35
|
+
const files = collectOrderedMetadataFiles(staging);
|
|
36
|
+
const result = await new MetaDataLoader({ registry, strict: false }).load(files.map((f) => new FileSource(f)));
|
|
28
37
|
if (result.errors.length > 0) {
|
|
29
38
|
throw new Error(`metadata load failed:\n${result.errors.map((e) => String(e)).join("\n")}`);
|
|
30
39
|
}
|
|
@@ -38,6 +47,26 @@ export async function loadModel(sourceDirs, extraProviders = []) {
|
|
|
38
47
|
rmSync(staging, { recursive: true, force: true });
|
|
39
48
|
}
|
|
40
49
|
}
|
|
50
|
+
/** Metadata files under `dir`, files-before-subdirs with each level sorted — the
|
|
51
|
+
* overlay-safe order the sdk's loadMemory uses, so a base loads before an overlay
|
|
52
|
+
* nested under it. Symlinks (the staging dir uses them) are followed. */
|
|
53
|
+
function collectOrderedMetadataFiles(dir) {
|
|
54
|
+
const files = [];
|
|
55
|
+
const subdirs = [];
|
|
56
|
+
for (const entry of readdirSync(dir)) {
|
|
57
|
+
const full = join(dir, entry);
|
|
58
|
+
const s = statSync(full); // follows symlinks — staging entries are symlinked source dirs
|
|
59
|
+
if (s.isDirectory())
|
|
60
|
+
subdirs.push(full);
|
|
61
|
+
else if (s.isFile() && /\.(json|ya?ml)$/i.test(entry))
|
|
62
|
+
files.push(full);
|
|
63
|
+
}
|
|
64
|
+
files.sort();
|
|
65
|
+
const out = [...files];
|
|
66
|
+
for (const sub of subdirs.sort())
|
|
67
|
+
out.push(...collectOrderedMetadataFiles(sub));
|
|
68
|
+
return out;
|
|
69
|
+
}
|
|
41
70
|
/** Which top-level source dir a node came from (first file path segment of its source envelope). */
|
|
42
71
|
export function treeOf(node, model) {
|
|
43
72
|
const src = node.source;
|
package/dist/load.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"load.js","sourceRoot":"","sources":["../src/load.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"load.js","sourceRoot":"","sources":["../src/load.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAClF,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,iBAAiB,EAAE,UAAU,EAAE,WAAW,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAEnJ,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAQ3D;;;;;;;;GAQG;AACH,MAAM,CAAC,KAAK,UAAU,SAAS,CAC7B,UAAoB,EACpB,iBAAkD,EAAE;I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QAAE,GAAG,CAAC,IAAI,CAAC,GAAG,2BAA2B,CAAC,GAAG,CAAC,CAAC,CAAC;IAChF,OAAO,GAAG,CAAC;AACb,CAAC;AAED,oGAAoG;AACpG,MAAM,UAAU,MAAM,CAAC,IAAc,EAAE,KAAkB;IACvD,MAAM,GAAG,GAAG,IAAI,CAAC,MAA8B,CAAC;IAChD,MAAM,CAAC,GAAG,GAAG,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;IAC/B,MAAM,GAAG,GAAG,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;IACtD,OAAO,KAAK,CAAC,UAAU,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;AAC5E,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@metaobjectsdev/docs-site",
|
|
3
|
-
"version": "0.15.
|
|
3
|
+
"version": "0.15.11",
|
|
4
4
|
"description": "HTML documentation-site generator for metaobjects models — a browsable multi-page site (nav, search, per-object/package pages, kind-aware ER diagrams). Powers the `meta docs --site` surface.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -48,8 +48,8 @@
|
|
|
48
48
|
"access": "public"
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|
|
51
|
-
"@metaobjectsdev/metadata": "0.15.
|
|
52
|
-
"@metaobjectsdev/render": "0.15.
|
|
51
|
+
"@metaobjectsdev/metadata": "0.15.11",
|
|
52
|
+
"@metaobjectsdev/render": "0.15.11",
|
|
53
53
|
"yaml": "^2.9.0"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
package/src/load.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { mkdtempSync, rmSync, symlinkSync } from "node:fs";
|
|
1
|
+
import { mkdtempSync, readdirSync, rmSync, statSync, symlinkSync } from "node:fs";
|
|
2
2
|
import { tmpdir } from "node:os";
|
|
3
3
|
import { basename, join, resolve } from "node:path";
|
|
4
4
|
import { MetaDataLoader, composeRegistry, coreTypesProvider, dbProvider, docProvider, promptProvider, uiProvider } from "@metaobjectsdev/metadata";
|
|
5
5
|
import type { MetaData, MetaRoot, MetaDataTypeProvider } from "@metaobjectsdev/metadata";
|
|
6
|
+
import { FileSource } from "@metaobjectsdev/metadata/core";
|
|
6
7
|
|
|
7
8
|
export interface LoadedModel {
|
|
8
9
|
root: MetaRoot;
|
|
@@ -35,7 +36,17 @@ export async function loadModel(
|
|
|
35
36
|
symlinkSync(resolve(dir), join(staging, baseName));
|
|
36
37
|
}
|
|
37
38
|
const registry = composeRegistry([coreTypesProvider, dbProvider, docProvider, promptProvider, uiProvider, ...extraProviders]);
|
|
38
|
-
|
|
39
|
+
// Feed files in files-before-subdirs order (the same order the sdk's loadMemory
|
|
40
|
+
// uses), NOT fromDirectory's flat basename sort. Cross-file overlays require the
|
|
41
|
+
// base (typically a top-level file) to load before an overlay that lives in a
|
|
42
|
+
// nested dir; the basename sort can otherwise process e.g.
|
|
43
|
+
// `admin-ui/x.admin.yaml` before its base `x.yaml` and fail with
|
|
44
|
+
// ERR_OVERLAY_NO_TARGET. (fromDirectory's basename order is a cross-port
|
|
45
|
+
// DirectorySource contract, so we order at this boundary rather than change it.)
|
|
46
|
+
const files = collectOrderedMetadataFiles(staging);
|
|
47
|
+
const result = await new MetaDataLoader({ registry, strict: false }).load(
|
|
48
|
+
files.map((f) => new FileSource(f)),
|
|
49
|
+
);
|
|
39
50
|
if (result.errors.length > 0) {
|
|
40
51
|
throw new Error(`metadata load failed:\n${result.errors.map((e) => String(e)).join("\n")}`);
|
|
41
52
|
}
|
|
@@ -49,6 +60,24 @@ export async function loadModel(
|
|
|
49
60
|
}
|
|
50
61
|
}
|
|
51
62
|
|
|
63
|
+
/** Metadata files under `dir`, files-before-subdirs with each level sorted — the
|
|
64
|
+
* overlay-safe order the sdk's loadMemory uses, so a base loads before an overlay
|
|
65
|
+
* nested under it. Symlinks (the staging dir uses them) are followed. */
|
|
66
|
+
function collectOrderedMetadataFiles(dir: string): string[] {
|
|
67
|
+
const files: string[] = [];
|
|
68
|
+
const subdirs: string[] = [];
|
|
69
|
+
for (const entry of readdirSync(dir)) {
|
|
70
|
+
const full = join(dir, entry);
|
|
71
|
+
const s = statSync(full); // follows symlinks — staging entries are symlinked source dirs
|
|
72
|
+
if (s.isDirectory()) subdirs.push(full);
|
|
73
|
+
else if (s.isFile() && /\.(json|ya?ml)$/i.test(entry)) files.push(full);
|
|
74
|
+
}
|
|
75
|
+
files.sort();
|
|
76
|
+
const out = [...files];
|
|
77
|
+
for (const sub of subdirs.sort()) out.push(...collectOrderedMetadataFiles(sub));
|
|
78
|
+
return out;
|
|
79
|
+
}
|
|
80
|
+
|
|
52
81
|
/** Which top-level source dir a node came from (first file path segment of its source envelope). */
|
|
53
82
|
export function treeOf(node: MetaData, model: LoadedModel): string {
|
|
54
83
|
const src = node.source as { files?: string[] };
|