fundus 0.0.2
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/build-CZYFLLvl.js +191 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +1420 -0
- package/dist/config.d.ts +2 -0
- package/dist/config.js +2 -0
- package/dist/core/image-Dqmz8FXS.js +54 -0
- package/dist/core/index.d.ts +499 -0
- package/dist/core/index.js +962 -0
- package/dist/core/reference-graph-CjuHbLDw.d.ts +280 -0
- package/dist/core/testing.d.ts +27 -0
- package/dist/core/testing.js +80 -0
- package/dist/editor/200.html +37 -0
- package/dist/editor/_app/immutable/assets/0.DLhIsYA_.css +1 -0
- package/dist/editor/_app/immutable/assets/2.DIbbW7U1.css +1 -0
- package/dist/editor/_app/immutable/assets/3.C-9vFQ9A.css +1 -0
- package/dist/editor/_app/immutable/assets/4.BS8ElpOV.css +1 -0
- package/dist/editor/_app/immutable/assets/ConfirmDialog.CHEISE-L.css +1 -0
- package/dist/editor/_app/immutable/assets/LibraryContextMenu.CDjCmdV-.css +1 -0
- package/dist/editor/_app/immutable/chunks/BfPE5wdt.js +1 -0
- package/dist/editor/_app/immutable/chunks/Bjy-W4x2.js +81 -0
- package/dist/editor/_app/immutable/chunks/CNRz3sSw.js +3 -0
- package/dist/editor/_app/immutable/chunks/CO4RBJfa.js +1 -0
- package/dist/editor/_app/immutable/chunks/Cx6qtxJg.js +1 -0
- package/dist/editor/_app/immutable/chunks/DjdrdRzT.js +1 -0
- package/dist/editor/_app/immutable/chunks/DjvOiDmq.js +1 -0
- package/dist/editor/_app/immutable/chunks/n7mvYc42.js +5 -0
- package/dist/editor/_app/immutable/chunks/xihTtKlq.js +1 -0
- package/dist/editor/_app/immutable/entry/app.BkqbfI8n.js +2 -0
- package/dist/editor/_app/immutable/entry/start.C8HHOLly.js +1 -0
- package/dist/editor/_app/immutable/nodes/0.xdMI5GEU.js +2 -0
- package/dist/editor/_app/immutable/nodes/1.D9p2tfoJ.js +1 -0
- package/dist/editor/_app/immutable/nodes/2.BrA0Hyzu.js +3 -0
- package/dist/editor/_app/immutable/nodes/3.WO7tZH_d.js +104 -0
- package/dist/editor/_app/immutable/nodes/4.DQtx17aW.js +2 -0
- package/dist/editor/_app/version.json +1 -0
- package/dist/index.d.ts +370 -0
- package/dist/index.js +4 -0
- package/dist/operations-DYM-5KVl.js +1797 -0
- package/dist/runtime/chroma-key-gl.d.ts +23 -0
- package/dist/runtime/chroma-key-gl.js +290 -0
- package/dist/runtime/components/ChromaKeyVideo.svelte +225 -0
- package/dist/runtime/components/Image.svelte +18 -0
- package/dist/runtime/components/Slice.svelte +35 -0
- package/dist/runtime/components/SliceCanvas.svelte +162 -0
- package/dist/runtime/components/SliceDom.svelte +104 -0
- package/dist/runtime/components/Video.svelte +60 -0
- package/dist/runtime/geometry.d.ts +75 -0
- package/dist/runtime/geometry.js +209 -0
- package/dist/runtime/index.d.ts +9 -0
- package/dist/runtime/index.js +9 -0
- package/dist/runtime/kind-handlers.d.ts +46 -0
- package/dist/runtime/kind-handlers.js +86 -0
- package/dist/runtime/manifest.d.ts +60 -0
- package/dist/runtime/manifest.js +117 -0
- package/dist/runtime/observe-border-box-size.d.ts +5 -0
- package/dist/runtime/observe-border-box-size.js +12 -0
- package/dist/runtime/preload-registry.d.ts +26 -0
- package/dist/runtime/preload-registry.js +68 -0
- package/dist/start-Bhnqt9Dc.js +279 -0
- package/dist/start-D2IXOrni.js +2 -0
- package/package.json +65 -0
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
import { _ as strayGeneratedModuleNames, a as deliveredAssetIds, c as isProxyFileName, f as listRelativeFiles, g as renderManifestModule, h as manifestModuleFileName, i as sha256Hex, l as processAssets, m as generateManifestModules, n as LibraryStore, p as buildManifestEntries, s as expectedProxyRelativePath, u as readCurrentProxy, v as descriptorsByType, w as loadConfig, x as serverPluginsByType } from "./operations-DYM-5KVl.js";
|
|
2
|
+
import { readFile } from "node:fs/promises";
|
|
3
|
+
import { join } from "node:path";
|
|
4
|
+
import { collectAllReferences, compareCodeUnits, computeLibraryMembership, rawFileNameOfPath } from "#fundus/core";
|
|
5
|
+
import { existsSync } from "node:fs";
|
|
6
|
+
//#region src/check.ts
|
|
7
|
+
/**
|
|
8
|
+
* `fundus check` — the verify-only CI gate: no writes, ever. It
|
|
9
|
+
* fails when the library does not validate, when a committed proxy is stale,
|
|
10
|
+
* missing, or orphaned, or when a generated manifest module differs from an
|
|
11
|
+
* in-memory regeneration. Warnings (unreachable asset, raw-hash drift) are
|
|
12
|
+
* treated as errors unless `--allow-warnings` downgrades them — errors are
|
|
13
|
+
* never downgradable.
|
|
14
|
+
*/
|
|
15
|
+
/** The human rendering of a finding — `[assetId] message`, as `fundus check` prints it. */
|
|
16
|
+
function formatCheckFinding(finding) {
|
|
17
|
+
return `${finding.assetId ? `[${finding.assetId}] ` : ""}${finding.message}`;
|
|
18
|
+
}
|
|
19
|
+
async function runCheck(projectRoot, registry = serverPluginsByType) {
|
|
20
|
+
const config = await loadConfig(projectRoot);
|
|
21
|
+
const store = new LibraryStore(config, registry);
|
|
22
|
+
const library = await store.read();
|
|
23
|
+
const report = {
|
|
24
|
+
errors: [],
|
|
25
|
+
warnings: [],
|
|
26
|
+
assetCount: Object.keys(library.assets).length,
|
|
27
|
+
manifestCount: Object.keys(library.manifests).length
|
|
28
|
+
};
|
|
29
|
+
const issues = await store.validate(library);
|
|
30
|
+
for (const issue of issues) report.errors.push({
|
|
31
|
+
kind: "validation",
|
|
32
|
+
message: issue.message,
|
|
33
|
+
...issue.assetId !== void 0 ? { assetId: issue.assetId } : {}
|
|
34
|
+
});
|
|
35
|
+
const delivered = deliveredAssetIds(library, registry);
|
|
36
|
+
const expectedProxyPaths = /* @__PURE__ */ new Set();
|
|
37
|
+
const proxies = {};
|
|
38
|
+
let proxiesComplete = true;
|
|
39
|
+
for (const assetId of [...delivered].sort(compareCodeUnits)) {
|
|
40
|
+
const record = library.assets[assetId];
|
|
41
|
+
let proxy;
|
|
42
|
+
try {
|
|
43
|
+
proxy = await readCurrentProxy(assetId, record, config, registry);
|
|
44
|
+
} catch (cause) {
|
|
45
|
+
if (!issues.some((issue) => issue.assetId === assetId)) report.errors.push({
|
|
46
|
+
kind: "proxy-unresolvable",
|
|
47
|
+
message: cause instanceof Error ? cause.message : String(cause),
|
|
48
|
+
assetId
|
|
49
|
+
});
|
|
50
|
+
proxiesComplete = false;
|
|
51
|
+
continue;
|
|
52
|
+
}
|
|
53
|
+
if (!proxy) {
|
|
54
|
+
const relativePath = expectedProxyRelativePath(assetId, record, config, registry);
|
|
55
|
+
expectedProxyPaths.add(relativePath);
|
|
56
|
+
report.errors.push({
|
|
57
|
+
kind: "proxy-missing",
|
|
58
|
+
message: `Proxy "${relativePath}" is missing or stale — run \`fundus build\` and commit the result.`,
|
|
59
|
+
assetId,
|
|
60
|
+
fileName: relativePath
|
|
61
|
+
});
|
|
62
|
+
proxiesComplete = false;
|
|
63
|
+
continue;
|
|
64
|
+
}
|
|
65
|
+
expectedProxyPaths.add(proxy.relativePath);
|
|
66
|
+
proxies[assetId] = proxy;
|
|
67
|
+
}
|
|
68
|
+
if (existsSync(config.proxyDir)) for (const relativePath of (await listRelativeFiles(config.proxyDir)).sort()) {
|
|
69
|
+
if (!isProxyFileName(rawFileNameOfPath(relativePath)) || expectedProxyPaths.has(relativePath)) continue;
|
|
70
|
+
report.errors.push({
|
|
71
|
+
kind: "proxy-orphaned",
|
|
72
|
+
message: `Orphaned proxy "${relativePath}" — no asset expects it; run \`fundus build\` and commit the result.`,
|
|
73
|
+
fileName: relativePath
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
if (issues.length === 0 && proxiesComplete) {
|
|
77
|
+
await checkGeneratedModules(report, library, config, proxies, registry);
|
|
78
|
+
await checkStrayModules(report, library, config);
|
|
79
|
+
}
|
|
80
|
+
collectUnreachableAssets(report, library, delivered);
|
|
81
|
+
await collectRawHashDrift(report, library, config);
|
|
82
|
+
return report;
|
|
83
|
+
}
|
|
84
|
+
async function checkGeneratedModules(report, library, config, proxies, registry) {
|
|
85
|
+
const referencesByAsset = collectAllReferences(library, descriptorsByType(registry));
|
|
86
|
+
const membershipByManifest = computeLibraryMembership(library, referencesByAsset);
|
|
87
|
+
for (const manifestName of Object.keys(library.manifests).sort(compareCodeUnits)) {
|
|
88
|
+
const fileName = manifestModuleFileName(manifestName);
|
|
89
|
+
const modulePath = join(config.manifestsDir, fileName);
|
|
90
|
+
let expectedContent;
|
|
91
|
+
try {
|
|
92
|
+
expectedContent = renderManifestModule(manifestName, buildManifestEntries({
|
|
93
|
+
membership: membershipByManifest[manifestName],
|
|
94
|
+
library,
|
|
95
|
+
proxies,
|
|
96
|
+
config,
|
|
97
|
+
referencesByAsset,
|
|
98
|
+
registry
|
|
99
|
+
}));
|
|
100
|
+
} catch (cause) {
|
|
101
|
+
report.errors.push({
|
|
102
|
+
kind: "module-regeneration-failed",
|
|
103
|
+
message: `Cannot regenerate module "${fileName}": ${cause instanceof Error ? cause.message : String(cause)}`,
|
|
104
|
+
manifest: manifestName,
|
|
105
|
+
fileName
|
|
106
|
+
});
|
|
107
|
+
continue;
|
|
108
|
+
}
|
|
109
|
+
if (!existsSync(modulePath)) {
|
|
110
|
+
report.errors.push({
|
|
111
|
+
kind: "module-missing",
|
|
112
|
+
message: `Generated module "${fileName}" is missing — run \`fundus build\` and commit the result.`,
|
|
113
|
+
manifest: manifestName,
|
|
114
|
+
fileName
|
|
115
|
+
});
|
|
116
|
+
continue;
|
|
117
|
+
}
|
|
118
|
+
if (await readFile(modulePath, "utf8") !== expectedContent) report.errors.push({
|
|
119
|
+
kind: "module-out-of-sync",
|
|
120
|
+
message: `Generated module "${fileName}" is out of sync with the library — run \`fundus build\` and commit the result.`,
|
|
121
|
+
manifest: manifestName,
|
|
122
|
+
fileName
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
async function checkStrayModules(report, library, config) {
|
|
127
|
+
const expectedFileNames = new Set(Object.keys(library.manifests).map((manifestName) => manifestModuleFileName(manifestName)));
|
|
128
|
+
for (const fileName of await strayGeneratedModuleNames(config.manifestsDir, expectedFileNames)) report.errors.push({
|
|
129
|
+
kind: "module-stray",
|
|
130
|
+
message: `Stray generated module "${fileName}" — its manifest no longer exists; run \`fundus build\`.`,
|
|
131
|
+
fileName
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* The unreachable-asset warning: fires only when nothing delivers the asset —
|
|
136
|
+
* no explicit membership AND no passive membership in any manifest. An asset
|
|
137
|
+
* that is only passively delivered (referenced by a delivered asset) is fine.
|
|
138
|
+
*/
|
|
139
|
+
function collectUnreachableAssets(report, library, delivered) {
|
|
140
|
+
for (const [assetId, record] of Object.entries(library.assets)) if (record.manifests.length === 0 && !delivered.has(assetId)) report.warnings.push({
|
|
141
|
+
kind: "unreachable-asset",
|
|
142
|
+
message: "In no manifest and not referenced by any delivered asset — nothing is processed or generated for it.",
|
|
143
|
+
assetId
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Raw-hash drift: a raw file replaced on disk while the library still pins the
|
|
148
|
+
* old content hash. The proxy name derives from the *recorded* hash, so the
|
|
149
|
+
* name check alone would keep passing while the delivered pixels are outdated.
|
|
150
|
+
*/
|
|
151
|
+
async function collectRawHashDrift(report, library, config) {
|
|
152
|
+
for (const [assetId, record] of Object.entries(library.assets)) {
|
|
153
|
+
const rawPath = join(config.rawDir, record.raw);
|
|
154
|
+
if (!existsSync(rawPath)) continue;
|
|
155
|
+
if (sha256Hex(new Uint8Array(await readFile(rawPath))) !== record.rawHash) report.warnings.push({
|
|
156
|
+
kind: "raw-hash-drift",
|
|
157
|
+
message: `Raw file "${record.raw}" changed since it was ingested (hash drift) — re-ingest or update it through the editor, then run \`fundus build\`.`,
|
|
158
|
+
assetId,
|
|
159
|
+
fileName: record.raw
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
//#endregion
|
|
164
|
+
//#region src/build.ts
|
|
165
|
+
/**
|
|
166
|
+
* `fundus build` — headless pipeline run: validate the library, process all
|
|
167
|
+
* stale/missing proxies, prune orphans, regenerate every manifest module.
|
|
168
|
+
* Throws on validation errors (the CLI exits non-zero).
|
|
169
|
+
*/
|
|
170
|
+
async function runBuild(projectRoot, registry = serverPluginsByType) {
|
|
171
|
+
const config = await loadConfig(projectRoot);
|
|
172
|
+
const store = new LibraryStore(config, registry);
|
|
173
|
+
const library = await store.read();
|
|
174
|
+
await store.syncFolders(library);
|
|
175
|
+
const issues = await store.validate(library);
|
|
176
|
+
if (issues.length > 0) {
|
|
177
|
+
const lines = issues.map((issue) => ` - ${formatCheckFinding({
|
|
178
|
+
kind: "validation",
|
|
179
|
+
assetId: issue.assetId,
|
|
180
|
+
message: issue.message
|
|
181
|
+
})}`);
|
|
182
|
+
throw new Error(`Library validation failed:\n${lines.join("\n")}`);
|
|
183
|
+
}
|
|
184
|
+
const processing = await processAssets(config, library, registry);
|
|
185
|
+
return {
|
|
186
|
+
processing,
|
|
187
|
+
codegen: await generateManifestModules(config, library, processing.proxies, registry)
|
|
188
|
+
};
|
|
189
|
+
}
|
|
190
|
+
//#endregion
|
|
191
|
+
export { formatCheckFinding as n, runCheck as r, runBuild as t };
|
package/dist/cli.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|