@bendyline/molen-tooling 0.0.1
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/LICENSE +21 -0
- package/NOTICE.md +15 -0
- package/README.md +91 -0
- package/dist/capture/THIRD-PARTY-NOTICES.md +223 -0
- package/dist/capture/basis/LICENSE.txt +55 -0
- package/dist/capture/basis/basis_transcoder.js +19 -0
- package/dist/capture/basis/basis_transcoder.wasm +0 -0
- package/dist/capture/capture.html +15 -0
- package/dist/capture/harness.js +4671 -0
- package/dist/capture/worldgen-preview.html +15 -0
- package/dist/capture/worldgen-preview.js +4617 -0
- package/dist/cli.d.mts +1 -0
- package/dist/cli.mjs +1276 -0
- package/dist/docs-src/guide/3d-art-guidelines.md +157 -0
- package/dist/docs-src/guide/3d-model-assets.md +286 -0
- package/dist/docs-src/guide/adaptive-performance.md +89 -0
- package/dist/docs-src/guide/agent-loop.md +156 -0
- package/dist/docs-src/guide/aircraft.md +225 -0
- package/dist/docs-src/guide/browser-mount.md +185 -0
- package/dist/docs-src/guide/building-interiors.md +175 -0
- package/dist/docs-src/guide/capability-authoring.md +69 -0
- package/dist/docs-src/guide/determinism.md +285 -0
- package/dist/docs-src/guide/entities.md +47 -0
- package/dist/docs-src/guide/examples.md +58 -0
- package/dist/docs-src/guide/experience-playback.md +57 -0
- package/dist/docs-src/guide/figures.md +164 -0
- package/dist/docs-src/guide/game-samples.md +100 -0
- package/dist/docs-src/guide/graphics-performance.md +167 -0
- package/dist/docs-src/guide/input.md +205 -0
- package/dist/docs-src/guide/materials.md +125 -0
- package/dist/docs-src/guide/project.md +157 -0
- package/dist/docs-src/guide/quickstart.md +63 -0
- package/dist/docs-src/guide/recognizable-places.md +158 -0
- package/dist/docs-src/guide/rendering-backends.md +231 -0
- package/dist/docs-src/guide/scripting.md +330 -0
- package/dist/docs-src/guide/sky.md +192 -0
- package/dist/docs-src/guide/source-bundles.md +42 -0
- package/dist/docs-src/guide/structure-library.md +114 -0
- package/dist/docs-src/guide/surface-rendering.md +203 -0
- package/dist/docs-src/guide/terrain.md +389 -0
- package/dist/docs-src/guide/three-surface.md +70 -0
- package/dist/docs-src/guide/vehicle-interiors.md +126 -0
- package/dist/docs-src/guide/vehicles.md +110 -0
- package/dist/docs-src/guide/weather.md +123 -0
- package/dist/docs-src/guide/worldgen.md +434 -0
- package/dist/docs-src/llms.txt +129 -0
- package/dist/docs-src/schemas/README.md +36 -0
- package/dist/docs-src/schemas/archstyle.md +2340 -0
- package/dist/docs-src/schemas/assert.md +169 -0
- package/dist/docs-src/schemas/asset.md +543 -0
- package/dist/docs-src/schemas/business-catalog.md +162 -0
- package/dist/docs-src/schemas/cameratrack.md +132 -0
- package/dist/docs-src/schemas/command.md +112 -0
- package/dist/docs-src/schemas/components.md +5826 -0
- package/dist/docs-src/schemas/delta.md +204 -0
- package/dist/docs-src/schemas/experience-play.md +452 -0
- package/dist/docs-src/schemas/figure.md +290 -0
- package/dist/docs-src/schemas/interior-catalog.md +230 -0
- package/dist/docs-src/schemas/keyframe.md +314 -0
- package/dist/docs-src/schemas/landmark-catalog.md +56 -0
- package/dist/docs-src/schemas/landmark.md +293 -0
- package/dist/docs-src/schemas/matgraph.md +1163 -0
- package/dist/docs-src/schemas/pack-index.md +82 -0
- package/dist/docs-src/schemas/pack-source.md +139 -0
- package/dist/docs-src/schemas/pack.md +225 -0
- package/dist/docs-src/schemas/pixelgrid.md +108 -0
- package/dist/docs-src/schemas/prefab.md +106 -0
- package/dist/docs-src/schemas/project.md +271 -0
- package/dist/docs-src/schemas/region-atlas.md +612 -0
- package/dist/docs-src/schemas/replay.md +807 -0
- package/dist/docs-src/schemas/scatter.md +541 -0
- package/dist/docs-src/schemas/scene.md +1152 -0
- package/dist/docs-src/schemas/source-bundle.md +266 -0
- package/dist/docs-src/schemas/stylepack.md +420 -0
- package/dist/docs-src/schemas/terrain-package.md +731 -0
- package/dist/docs-src/schemas/terrain.md +313 -0
- package/dist/docs-src/schemas/types.md +218 -0
- package/dist/docs-src/schemas/uvpaint.md +149 -0
- package/dist/docs-src/schemas/worldgen-batch.md +743 -0
- package/dist/index.d.mts +1271 -0
- package/dist/index.mjs +78 -0
- package/dist/mcp-BFnCWrg0.mjs +796 -0
- package/dist/ops-BGxhSP6w.mjs +7246 -0
- package/package.json +96 -0
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { $ as importAsset, A as verifyContentPack, B as describeOps, C as listTypes, D as extractContentPack, E as buildContentPack, F as exportFrames, G as stageAssets, H as checkScripts, I as driveScene, K as screenshotAsset, L as locateDocsRoot, M as renderTypesModule, O as fetchContentPack, Q as assetFileIndex, R as searchDocs, S as checkTypesOp, T as reserveNamespace, U as schemaToTsType, V as formatOp, W as ASSET_INDEX_FILE, X as inspectAsset, Y as packAsset, Z as listAssets, a as lineupBatchDoc, at as parseExperiencePlayScenario, b as runReplayFile, c as validateAsset, d as runSimulation, et as findProjectFile, f as screenshotScene, g as listSchemasOp, h as listComponentsOp, i as bakeWorldgen, it as updateProjectFile, j as generateTypes, k as inspectContentPack, l as applyUvPaintOp, m as getSchemaOp, n as worldgenStats, nt as loadSceneDocument, o as loadStylePackFromDisk, ot as playExperience, p as getComponentOp, r as previewWorldgen, rt as loadSetupLike, s as simWatch, st as registerExperiencePlaySchema, tt as loadProject, u as testTypes, v as scaffoldExperience, w as projectInfo, x as rasterizeMaterial, y as diffSnapshots, z as OPS_CATALOG } from "./ops-BGxhSP6w.mjs";
|
|
2
|
+
import { access, copyFile, mkdir, readFile, writeFile } from "node:fs/promises";
|
|
3
|
+
import { dirname } from "node:path";
|
|
4
|
+
import pixelmatch from "pixelmatch";
|
|
5
|
+
import { PNG } from "pngjs";
|
|
6
|
+
//#region src/golden.ts
|
|
7
|
+
async function exists(p) {
|
|
8
|
+
try {
|
|
9
|
+
await access(p);
|
|
10
|
+
return true;
|
|
11
|
+
} catch {
|
|
12
|
+
return false;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
async function readPng(path) {
|
|
16
|
+
return PNG.sync.read(await readFile(path));
|
|
17
|
+
}
|
|
18
|
+
/** Pixel-diff two PNGs; writes a diff image. Per-pixel threshold 0.1. */
|
|
19
|
+
async function diffImages(aPath, bPath, diffPath, maxDiffRatio = .003) {
|
|
20
|
+
const a = await readPng(aPath);
|
|
21
|
+
const b = await readPng(bPath);
|
|
22
|
+
if (a.width !== b.width || a.height !== b.height) return {
|
|
23
|
+
match: false,
|
|
24
|
+
diffPixels: a.width * a.height,
|
|
25
|
+
diffRatio: 1,
|
|
26
|
+
reason: `size mismatch: ${a.width}x${a.height} vs ${b.width}x${b.height}`
|
|
27
|
+
};
|
|
28
|
+
const diff = new PNG({
|
|
29
|
+
width: a.width,
|
|
30
|
+
height: a.height
|
|
31
|
+
});
|
|
32
|
+
const diffPixels = pixelmatch(a.data, b.data, diff.data, a.width, a.height, { threshold: .1 });
|
|
33
|
+
await mkdir(dirname(diffPath), { recursive: true });
|
|
34
|
+
await writeFile(diffPath, PNG.sync.write(diff));
|
|
35
|
+
const diffRatio = diffPixels / (a.width * a.height);
|
|
36
|
+
return {
|
|
37
|
+
match: diffRatio <= maxDiffRatio,
|
|
38
|
+
diffPixels,
|
|
39
|
+
diffRatio
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Compare a freshly rendered candidate PNG against a committed golden. Records the golden only
|
|
44
|
+
* when UPDATE_GOLDENS=1. Tolerance: per-pixel threshold 0.1, max `maxDiffRatio` differing
|
|
45
|
+
* pixels (default 0.3%).
|
|
46
|
+
*
|
|
47
|
+
* A missing golden **fails**. Silently adopting the candidate would make "this test has no
|
|
48
|
+
* reference image" indistinguishable from "this test passed" — and in a fresh CI checkout every
|
|
49
|
+
* uncommitted golden would take that branch, so a suite could report green while comparing
|
|
50
|
+
* nothing.
|
|
51
|
+
*/
|
|
52
|
+
async function compareGolden(candidatePath, goldenPath, diffPath, opts = {}) {
|
|
53
|
+
if (process.env.UPDATE_GOLDENS === "1") {
|
|
54
|
+
await mkdir(dirname(goldenPath), { recursive: true });
|
|
55
|
+
await copyFile(candidatePath, goldenPath);
|
|
56
|
+
return {
|
|
57
|
+
ok: true,
|
|
58
|
+
created: true
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
if (!await exists(goldenPath)) return {
|
|
62
|
+
ok: false,
|
|
63
|
+
created: false,
|
|
64
|
+
reason: `no committed golden at ${goldenPath}; the candidate is at ${candidatePath}. Record one with UPDATE_GOLDENS=1 (locally that produces a candidate only — the authoritative refresh is the "Update goldens" workflow, which records in the pinned CI container).`
|
|
65
|
+
};
|
|
66
|
+
const result = await diffImages(goldenPath, candidatePath, diffPath, opts.maxDiffRatio);
|
|
67
|
+
return {
|
|
68
|
+
ok: result.match,
|
|
69
|
+
created: false,
|
|
70
|
+
...result.reason !== void 0 ? { reason: result.reason } : {},
|
|
71
|
+
diffRatio: result.diffRatio
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
//#endregion
|
|
75
|
+
//#region src/index.ts
|
|
76
|
+
const TOOLING_PACKAGE = "@bendyline/molen-tooling";
|
|
77
|
+
//#endregion
|
|
78
|
+
export { ASSET_INDEX_FILE, OPS_CATALOG, TOOLING_PACKAGE, applyUvPaintOp, assetFileIndex, bakeWorldgen, buildContentPack, checkScripts, checkTypesOp, compareGolden, describeOps, diffImages, diffSnapshots, driveScene, exportFrames, extractContentPack, fetchContentPack, findProjectFile, formatOp, generateTypes, getComponentOp, getSchemaOp, importAsset, inspectAsset, inspectContentPack, lineupBatchDoc, listAssets, listComponentsOp, listSchemasOp, listTypes, loadProject, loadSceneDocument, loadSetupLike, loadStylePackFromDisk, locateDocsRoot, packAsset, parseExperiencePlayScenario, playExperience, previewWorldgen, projectInfo, rasterizeMaterial, registerExperiencePlaySchema, renderTypesModule, reserveNamespace, runReplayFile, runSimulation, scaffoldExperience, schemaToTsType, screenshotAsset, screenshotScene, searchDocs, simWatch, stageAssets, testTypes, updateProjectFile, validateAsset, verifyContentPack, worldgenStats };
|