topotopo 0.4.0 → 0.5.0
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/NOTICE +10 -10
- package/README.md +460 -117
- package/dist/cli.js +323 -146
- package/dist/config.d.ts +48 -0
- package/dist/config.js +170 -0
- package/dist/core/bake.d.ts +14 -3
- package/dist/core/bake.js +153 -4
- package/dist/core/bevel.d.ts +3 -1
- package/dist/core/bevel.js +76 -3
- package/dist/core/decimate.d.ts +65 -0
- package/dist/core/decimate.js +409 -3
- package/dist/core/erosion.d.ts +37 -0
- package/dist/core/erosion.js +41 -1
- package/dist/core/geometry.d.ts +5 -1
- package/dist/core/geometry.js +203 -3
- package/dist/core/heightfield.d.ts +27 -4
- package/dist/core/heightfield.js +54 -16
- package/dist/core/intrinsics.d.ts +7 -0
- package/dist/core/intrinsics.js +94 -0
- package/dist/core/manifold.d.ts +12 -1
- package/dist/core/manifold.js +78 -6
- package/dist/core/materials.d.ts +7 -0
- package/dist/core/materials.js +45 -0
- package/dist/core/noise.d.ts +9 -0
- package/dist/core/noise.js +10 -1
- package/dist/core/polymerge.d.ts +21 -0
- package/dist/core/polymerge.js +327 -0
- package/dist/core/repair.d.ts +2 -0
- package/dist/core/repair.js +2 -0
- package/dist/core/report.d.ts +70 -0
- package/dist/core/report.js +275 -0
- package/dist/core/scene.js +2 -1
- package/dist/core/sha256.d.ts +4 -0
- package/dist/core/sha256.js +69 -0
- package/dist/core/shapes.d.ts +3 -0
- package/dist/core/shapes.js +34 -0
- package/dist/core/snippet-lib.d.ts +14 -1
- package/dist/core/snippet-lib.js +39 -13
- package/dist/core/tangents.d.ts +2 -0
- package/dist/core/tangents.js +5 -1
- package/dist/core/texnoise.d.ts +6 -1
- package/dist/core/texnoise.js +6 -2
- package/dist/core/texsdf.d.ts +131 -0
- package/dist/core/texsdf.js +637 -0
- package/dist/core/texture.d.ts +163 -9
- package/dist/core/texture.js +844 -20
- package/dist/core/topology.d.ts +10 -0
- package/dist/core/topology.js +168 -0
- package/dist/core/unwrap.d.ts +72 -0
- package/dist/core/unwrap.js +800 -0
- package/dist/core/usercode.d.ts +27 -0
- package/dist/core/usercode.js +87 -0
- package/dist/core/uv.d.ts +4 -18
- package/dist/core/uv.js +35 -188
- package/dist/core/uvislands.d.ts +62 -0
- package/dist/core/uvislands.js +574 -0
- package/dist/core/uvoverlap.d.ts +58 -0
- package/dist/core/uvoverlap.js +220 -0
- package/dist/core/uvpack.d.ts +64 -0
- package/dist/core/uvpack.js +628 -0
- package/dist/core/uvreport.d.ts +61 -0
- package/dist/core/uvreport.js +207 -143
- package/dist/core/wrangle.d.ts +6 -1
- package/dist/core/wrangle.js +27 -16
- package/dist/core/xatlas.d.ts +16 -1
- package/dist/core/xatlas.js +66 -62
- package/dist/engines.d.ts +63 -0
- package/dist/engines.js +180 -0
- package/dist/explain.d.ts +4 -3
- package/dist/explain.js +129 -12
- package/dist/graph/engine.d.ts +92 -29
- package/dist/graph/engine.js +298 -148
- package/dist/graph/expr.d.ts +6 -3
- package/dist/graph/expr.js +18 -8
- package/dist/graph/outputs.d.ts +23 -0
- package/dist/graph/outputs.js +41 -0
- package/dist/graph/packages.d.ts +72 -0
- package/dist/graph/packages.js +261 -0
- package/dist/graph/parallel.d.ts +3 -1
- package/dist/graph/parallel.js +4 -1
- package/dist/graph/params.d.ts +6 -0
- package/dist/graph/params.js +34 -7
- package/dist/graph/scope.d.ts +55 -0
- package/dist/graph/scope.js +14 -0
- package/dist/graph/types.d.ts +75 -12
- package/dist/graph/types.js +4 -2
- package/dist/graph/vars.d.ts +16 -0
- package/dist/graph/vars.js +80 -0
- package/dist/host/artifacts.d.ts +10 -1
- package/dist/host/artifacts.js +37 -6
- package/dist/host/cook.d.ts +241 -0
- package/dist/host/cook.js +844 -0
- package/dist/host/export-targets.d.ts +42 -5
- package/dist/host/export-targets.js +72 -13
- package/dist/host/godot-commands.d.ts +4 -0
- package/dist/host/godot-commands.js +21 -0
- package/dist/host/godot.d.ts +183 -0
- package/dist/host/godot.js +916 -0
- package/dist/host/node.d.ts +12 -7
- package/dist/host/node.js +27 -9
- package/dist/host/pool.js +51 -2
- package/dist/host/sidecars.d.ts +8 -0
- package/dist/host/sidecars.js +50 -0
- package/dist/host/types.d.ts +19 -6
- package/dist/host/version.d.ts +1 -0
- package/dist/host/version.js +3 -0
- package/dist/host/worker.js +5 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/inspect.d.ts +80 -2
- package/dist/inspect.js +265 -30
- package/dist/io/common.d.ts +25 -5
- package/dist/io/export.js +2 -1
- package/dist/io/files.d.ts +23 -4
- package/dist/io/files.js +60 -8
- package/dist/io/gltf.js +134 -47
- package/dist/io/heightmap.d.ts +3 -0
- package/dist/io/heightmap.js +1 -0
- package/dist/io/import.js +10 -0
- package/dist/io/inspect-scene.d.ts +55 -0
- package/dist/io/inspect-scene.js +155 -0
- package/dist/io/kinds.d.ts +81 -0
- package/dist/io/kinds.js +163 -0
- package/dist/io/points.d.ts +2 -1
- package/dist/io/points.js +3 -1
- package/dist/io/sidecars.d.ts +24 -0
- package/dist/io/sidecars.js +57 -0
- package/dist/io/source.d.ts +65 -0
- package/dist/io/source.js +112 -0
- package/dist/io/targets.d.ts +47 -3
- package/dist/io/targets.js +148 -13
- package/dist/io/textures.js +21 -1
- package/dist/io/unreal.js +5 -1
- package/dist/mcp/docs.d.ts +10 -1
- package/dist/mcp/docs.js +786 -143
- package/dist/mcp/inputs.d.ts +12 -5
- package/dist/mcp/inputs.js +50 -13
- package/dist/mcp/server.js +56 -27
- package/dist/mcp/tools.d.ts +14 -7
- package/dist/mcp/tools.js +196 -103
- package/dist/mcp/verify.d.ts +2 -2
- package/dist/mcp/verify.js +1 -1
- package/dist/mcp/workspace.d.ts +15 -0
- package/dist/mcp/workspace.js +349 -0
- package/dist/nodes/attributes.js +198 -1
- package/dist/nodes/bake.js +151 -47
- package/dist/nodes/beam.d.ts +1 -0
- package/dist/nodes/beam.js +201 -0
- package/dist/nodes/bevel.js +51 -3
- package/dist/nodes/cloth.js +2 -0
- package/dist/nodes/code.js +21 -9
- package/dist/nodes/curves.js +433 -93
- package/dist/nodes/flow.js +53 -33
- package/dist/nodes/generate.js +12 -38
- package/dist/nodes/heightfield.js +248 -77
- package/dist/nodes/imageops.js +16 -19
- package/dist/nodes/index.d.ts +1 -0
- package/dist/nodes/index.js +1 -0
- package/dist/nodes/material.js +89 -24
- package/dist/nodes/measure.js +43 -17
- package/dist/nodes/particles.js +2 -0
- package/dist/nodes/pcg.js +6 -5
- package/dist/nodes/procedural.js +4 -3
- package/dist/nodes/remesh.js +71 -15
- package/dist/nodes/scene.js +4 -2
- package/dist/nodes/sdf.js +10 -5
- package/dist/nodes/solid.js +20 -5
- package/dist/nodes/splines.d.ts +15 -1
- package/dist/nodes/splines.js +112 -105
- package/dist/nodes/texture.d.ts +21 -6
- package/dist/nodes/texture.js +1318 -185
- package/dist/nodes/topology.d.ts +7 -0
- package/dist/nodes/topology.js +133 -6
- package/dist/nodes/transform.js +6 -2
- package/dist/nodes/uv.js +192 -174
- package/dist/nodes/wasmcall.js +5 -1
- package/dist/open.d.ts +19 -0
- package/dist/open.js +12 -0
- package/dist/package.d.ts +288 -0
- package/dist/package.js +772 -0
- package/dist/packages/check.d.ts +32 -0
- package/dist/packages/check.js +169 -0
- package/dist/packages/commands.d.ts +57 -0
- package/dist/packages/commands.js +537 -0
- package/dist/packages/registry.d.ts +796 -0
- package/dist/packages/registry.js +2998 -0
- package/dist/packages/update.d.ts +124 -0
- package/dist/packages/update.js +476 -0
- package/dist/render/options.d.ts +2 -0
- package/dist/render/options.js +44 -5
- package/dist/render/preview.d.ts +15 -4
- package/dist/render/preview.js +6 -4
- package/dist/render/raster.d.ts +66 -5
- package/dist/render/raster.js +506 -138
- package/dist/render/texview.d.ts +6 -0
- package/dist/render/texview.js +27 -0
- package/dist/scan.d.ts +61 -0
- package/dist/scan.js +228 -0
- package/dist/session.d.ts +311 -0
- package/dist/session.js +849 -0
- package/dist/viewer/app/api.js +48 -6
- package/dist/viewer/app/cooking.js +78 -0
- package/dist/viewer/app/embed.js +27 -7
- package/dist/viewer/app/export-popover.js +118 -16
- package/dist/viewer/app/grid.js +5 -1
- package/dist/viewer/app/guides.js +122 -0
- package/dist/viewer/app/keymap.js +6 -3
- package/dist/viewer/app/layers.js +4 -4
- package/dist/viewer/app/main.js +185 -52
- package/dist/viewer/app/markers.js +60 -0
- package/dist/viewer/app/outliner.js +72 -27
- package/dist/viewer/app/output-info.js +45 -0
- package/dist/viewer/app/outputs.css +147 -8
- package/dist/viewer/app/outputs.js +168 -54
- package/dist/viewer/app/packages.js +614 -0
- package/dist/viewer/app/props.js +176 -52
- package/dist/viewer/app/scene.js +30 -5
- package/dist/viewer/app/select.js +4 -3
- package/dist/viewer/app/status.js +12 -15
- package/dist/viewer/app/style.css +65 -7
- package/dist/viewer/app/vars.js +47 -0
- package/dist/viewer/app/welcome.js +72 -0
- package/dist/viewer/graph-file.d.ts +62 -0
- package/dist/viewer/graph-file.js +175 -0
- package/dist/viewer/index.html +23 -10
- package/dist/viewer/json-edit.d.ts +13 -0
- package/dist/viewer/json-edit.js +274 -0
- package/dist/viewer/outputs.d.ts +49 -5
- package/dist/viewer/outputs.js +264 -56
- package/dist/viewer/packages.d.ts +121 -0
- package/dist/viewer/packages.js +584 -0
- package/dist/viewer/server.d.ts +14 -9
- package/dist/viewer/server.js +266 -28
- package/dist/web/app/web.css +419 -0
- package/dist/web/app/web.js +188 -0
- package/dist/{gallery → web}/bake.d.ts +4 -4
- package/dist/{gallery → web}/bake.js +24 -15
- package/dist/web/folder-page.d.ts +101 -0
- package/dist/web/folder-page.js +146 -0
- package/dist/web/folders.d.ts +280 -0
- package/dist/web/folders.js +970 -0
- package/dist/web/library.d.ts +91 -0
- package/dist/web/library.js +228 -0
- package/dist/web/markdown.d.ts +45 -0
- package/dist/web/markdown.js +677 -0
- package/dist/web/pages.d.ts +258 -0
- package/dist/web/pages.js +301 -0
- package/dist/web/server.d.ts +24 -0
- package/dist/web/server.js +1068 -0
- package/dist/workspace.d.ts +88 -118
- package/dist/workspace.js +358 -460
- package/integrations/godot/addons/topotopo/LICENSE +202 -0
- package/integrations/godot/addons/topotopo/README.md +57 -0
- package/integrations/godot/addons/topotopo/context_menu.gd +43 -0
- package/integrations/godot/addons/topotopo/dock.gd +266 -0
- package/integrations/godot/addons/topotopo/dock.tscn +72 -0
- package/integrations/godot/addons/topotopo/export_filter.gd +72 -0
- package/integrations/godot/addons/topotopo/gltf_instancing.gd +131 -0
- package/integrations/godot/addons/topotopo/icons/topotopo.svg +1 -0
- package/integrations/godot/addons/topotopo/inspector.gd +38 -0
- package/integrations/godot/addons/topotopo/instances_post_import.gd +111 -0
- package/integrations/godot/addons/topotopo/package.gd +23 -0
- package/integrations/godot/addons/topotopo/package_importer.gd +187 -0
- package/integrations/godot/addons/topotopo/plugin.cfg +7 -0
- package/integrations/godot/addons/topotopo/plugin.gd +970 -0
- package/integrations/godot/addons/topotopo/record.gd +435 -0
- package/integrations/godot/addons/topotopo/runner.gd +458 -0
- package/integrations/godot/addons/topotopo/tools/check.gd +42 -0
- package/integrations/godot/addons/topotopo/watcher.gd +199 -0
- package/kernels/pkg/README.md +2 -1
- package/kernels/pkg-simd/README.md +2 -1
- package/library/architecture/versions/1.0/architecture.topo +12 -0
- package/{shelf → library/architecture/versions/1.0/graphs}/arch.json +3 -3
- package/{shelf → library/architecture/versions/1.0/graphs}/beam_truss.json +6 -6
- package/{shelf → library/architecture/versions/1.0/graphs}/brick_wall.json +8 -8
- package/{shelf → library/architecture/versions/1.0/graphs}/door_frame.json +3 -3
- package/{shelf → library/architecture/versions/1.0/graphs}/hex_grid_floor.json +3 -2
- package/{shelf → library/architecture/versions/1.0/graphs}/house.json +8 -8
- package/library/architecture/versions/1.0/graphs/lineup.json +42 -0
- package/{shelf → library/architecture/versions/1.0/graphs}/pillar.json +3 -2
- package/{shelf → library/architecture/versions/1.0/graphs}/railing.json +5 -5
- package/{shelf → library/architecture/versions/1.0/graphs}/roof_gable.json +2 -2
- package/{shelf → library/architecture/versions/1.0/graphs}/roof_hip.json +2 -2
- package/{shelf → library/architecture/versions/1.0/graphs}/roof_skeleton.json +2 -1
- package/{shelf → library/architecture/versions/1.0/graphs}/scaffold.json +4 -4
- package/{shelf → library/architecture/versions/1.0/graphs}/spiral_stairs.json +3 -2
- package/{shelf → library/architecture/versions/1.0/graphs}/stairs.json +6 -6
- package/{shelf → library/architecture/versions/1.0/graphs}/tile_floor.json +3 -2
- package/{shelf → library/architecture/versions/1.0/graphs}/wall_segment.json +10 -10
- package/{shelf → library/architecture/versions/1.0/graphs}/window_frame.json +2 -2
- package/library/architecture/versions/1.0/version.json +1119 -0
- package/{shelf → library/nature/versions/1.0/graphs}/bush.json +2 -2
- package/{shelf → library/nature/versions/1.0/graphs}/cliff_block.json +4 -3
- package/{shelf → library/nature/versions/1.0/graphs}/forest_patch.json +5 -5
- package/{shelf → library/nature/versions/1.0/graphs}/grass_clumps.json +2 -2
- package/library/nature/versions/1.0/graphs/lineup.json +24 -0
- package/{shelf → library/nature/versions/1.0/graphs}/log.json +6 -6
- package/{shelf → library/nature/versions/1.0/graphs}/rock.json +5 -4
- package/{shelf → library/nature/versions/1.0/graphs}/scatter_rocks.json +5 -5
- package/{shelf → library/nature/versions/1.0/graphs}/tree_lowpoly.json +3 -2
- package/library/nature/versions/1.0/nature.topo +12 -0
- package/library/nature/versions/1.0/version.json +534 -0
- package/{shelf → library/props/versions/1.0/graphs}/barrel.json +5 -4
- package/{shelf → library/props/versions/1.0/graphs}/crate.json +3 -3
- package/library/props/versions/1.0/graphs/lineup.json +18 -0
- package/{shelf → library/props/versions/1.0/graphs}/pallet.json +4 -3
- package/{shelf → library/props/versions/1.0/graphs}/pipe_run.json +3 -3
- package/{shelf → library/props/versions/1.0/graphs}/sandbag_wall.json +5 -5
- package/library/props/versions/1.0/props.topo +12 -0
- package/library/props/versions/1.0/version.json +336 -0
- package/{shelf → library/street/versions/1.0/graphs}/bench.json +5 -5
- package/{shelf → library/street/versions/1.0/graphs}/bollard.json +2 -1
- package/{shelf → library/street/versions/1.0/graphs}/cable.json +4 -4
- package/{shelf → library/street/versions/1.0/graphs}/fence.json +7 -7
- package/{shelf → library/street/versions/1.0/graphs}/lamp_post.json +2 -2
- package/library/street/versions/1.0/graphs/lineup.json +22 -0
- package/{shelf → library/street/versions/1.0/graphs}/road_strip.json +2 -2
- package/{shelf → library/street/versions/1.0/graphs}/sign_post.json +1 -1
- package/library/street/versions/1.0/street.topo +12 -0
- package/library/street/versions/1.0/version.json +421 -0
- package/package.json +17 -8
- package/dist/gallery/app/gallery.css +0 -100
- package/dist/gallery/app/gallery.js +0 -80
- package/dist/gallery/cli.d.ts +0 -4
- package/dist/gallery/cli.js +0 -157
- package/dist/gallery/library.d.ts +0 -124
- package/dist/gallery/library.js +0 -366
- package/dist/gallery/pages.d.ts +0 -94
- package/dist/gallery/pages.js +0 -148
- package/dist/gallery/server.d.ts +0 -21
- package/dist/gallery/server.js +0 -391
- package/dist/graph/migrate.d.ts +0 -23
- package/dist/graph/migrate.js +0 -58
- package/dist/mcp/library.d.ts +0 -12
- package/dist/mcp/library.js +0 -159
- package/shelf/index.json +0 -190
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type { HostFiles } from '../host/types.ts';
|
|
2
|
+
import type { GraphSpec, NodeDef } from './types.ts';
|
|
3
|
+
/** An asset node type: the graph it cooks, its definition and the hash of the graph (Engine.registerAsset). */
|
|
4
|
+
export interface AssetEntry {
|
|
5
|
+
name: string;
|
|
6
|
+
graph: GraphSpec;
|
|
7
|
+
def: NodeDef;
|
|
8
|
+
hash: string;
|
|
9
|
+
}
|
|
10
|
+
/** Why a package output's name does not resolve: said as the node's error, with a hint for what to do. */
|
|
11
|
+
export interface PackageIssue {
|
|
12
|
+
error: string;
|
|
13
|
+
hint?: string;
|
|
14
|
+
}
|
|
15
|
+
/** How a scope resolves package outputs (Scope.packages). */
|
|
16
|
+
export interface PackageResolver {
|
|
17
|
+
/** the node type a name with a slash names in this scope, or why there is none (never a guess) */
|
|
18
|
+
resolve(name: string): NodeDef | PackageIssue;
|
|
19
|
+
/** every package output name the scope resolves ("owner/name" and "owner/name/output"), for did-you-mean and the catalog */
|
|
20
|
+
names(): string[];
|
|
21
|
+
/**
|
|
22
|
+
* the node types of package outputs the scope does not use yet but a graph may name, which its first use adds
|
|
23
|
+
* (TopoTopo's own packages): for the catalog, help and did-you-mean, never for cooking
|
|
24
|
+
*/
|
|
25
|
+
offered?(): NodeDef[];
|
|
26
|
+
}
|
|
27
|
+
export interface Scope {
|
|
28
|
+
/**
|
|
29
|
+
* "" for the root scope. Outside the root, the results that depend on a scope are cached under its id: within one
|
|
30
|
+
* engine, an id always means the same assets, graphs and folder.
|
|
31
|
+
*/
|
|
32
|
+
readonly id: string;
|
|
33
|
+
/** the scope's own asset node types by bare name (Engine.registerAsset) */
|
|
34
|
+
readonly assets: Map<string, AssetEntry>;
|
|
35
|
+
/** the graphs graph_ref reads, by name; absent: graph_ref has none */
|
|
36
|
+
graphs?: (name: string) => GraphSpec | undefined;
|
|
37
|
+
/** the files nodes read: relative paths resolve against the scope's folder */
|
|
38
|
+
readonly files: HostFiles;
|
|
39
|
+
/** the package outputs its graphs name; absent: none (a name with a slash is then an error that says so) */
|
|
40
|
+
packages?: PackageResolver;
|
|
41
|
+
}
|
|
42
|
+
/** Signature material of a result that depends on its scope (NodeDef.usesScope): the scope's id, none for the root. */
|
|
43
|
+
export declare const scopeSig: (scope: Scope) => string;
|
|
44
|
+
/**
|
|
45
|
+
* A package id, a library name, and each part of a package output's name (owner, name, output): lower-case letters,
|
|
46
|
+
* digits, "-" and "_", starting with a letter or digit, at most 64 characters.
|
|
47
|
+
*/
|
|
48
|
+
export declare const ID_RE: RegExp;
|
|
49
|
+
/** A package output's name: the package ("owner/name") and the output, null for the package's default output. */
|
|
50
|
+
export interface PackageName {
|
|
51
|
+
package: string;
|
|
52
|
+
output: string | null;
|
|
53
|
+
}
|
|
54
|
+
/** "owner/name/output" or "owner/name" parsed; a message saying what is wrong with any other name with a slash. */
|
|
55
|
+
export declare function parsePackageName(name: string): PackageName | string;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/** Signature material of a result that depends on its scope (NodeDef.usesScope): the scope's id, none for the root. */
|
|
2
|
+
export const scopeSig = (scope) => (scope.id ? `|S:${scope.id}` : '');
|
|
3
|
+
/**
|
|
4
|
+
* A package id, a library name, and each part of a package output's name (owner, name, output): lower-case letters,
|
|
5
|
+
* digits, "-" and "_", starting with a letter or digit, at most 64 characters.
|
|
6
|
+
*/
|
|
7
|
+
export const ID_RE = /^[a-z0-9][a-z0-9_-]{0,63}$/;
|
|
8
|
+
/** "owner/name/output" or "owner/name" parsed; a message saying what is wrong with any other name with a slash. */
|
|
9
|
+
export function parsePackageName(name) {
|
|
10
|
+
const parts = name.split('/');
|
|
11
|
+
if ((parts.length !== 2 && parts.length !== 3) || !parts.every((p) => ID_RE.test(p)))
|
|
12
|
+
return `"${name}" is not a package output: write "owner/name/output", or "owner/name" for the package's default output (each part lower-case letters, digits, - and _, starting with a letter or digit)`;
|
|
13
|
+
return { package: `${parts[0]}/${parts[1]}`, output: parts[2] ?? null };
|
|
14
|
+
}
|
package/dist/graph/types.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import type { Geometry } from '../core/geometry.ts';
|
|
2
|
-
import type { CookOptions, CookReport, Engine } from './engine.ts';
|
|
2
|
+
import type { CookOptions, CookReport, Engine, StopSignal } from './engine.ts';
|
|
3
|
+
import type { PackageOutput } from './packages.ts';
|
|
4
|
+
import type { Kind } from './outputs.ts';
|
|
3
5
|
import type { KernelJob, ParallelOptions, ParallelRun } from './parallel.ts';
|
|
4
|
-
|
|
5
|
-
export declare const GRAPH_VERSION = 1;
|
|
6
|
+
import type { Scope } from './scope.ts';
|
|
6
7
|
export type ParamType = 'float' | 'int' | 'bool' | 'string' | 'enum' | 'vec2' | 'vec3' | 'vec4' | 'ivec2' | 'ivec3' | 'color' | 'code' | 'group' | 'ramp' | 'json' | 'graph' | 'path';
|
|
7
8
|
export interface ParamDef {
|
|
8
9
|
type: ParamType;
|
|
@@ -10,7 +11,8 @@ export interface ParamDef {
|
|
|
10
11
|
default?: any;
|
|
11
12
|
min?: number;
|
|
12
13
|
max?: number;
|
|
13
|
-
options
|
|
14
|
+
/** enum choices: strings or numbers; the param's value is the option itself (numeric options give numbers) */
|
|
15
|
+
options?: (string | number)[];
|
|
14
16
|
aliases?: string[];
|
|
15
17
|
/** for 'group' params: which element class the pattern selects */
|
|
16
18
|
groupClass?: 'point' | 'prim' | 'vertex' | 'edge';
|
|
@@ -36,16 +38,39 @@ export interface NodeDef {
|
|
|
36
38
|
outputs?: string;
|
|
37
39
|
/** a minimal example node spec (or small graph) for docs */
|
|
38
40
|
example?: any;
|
|
39
|
-
/**
|
|
40
|
-
|
|
41
|
+
/**
|
|
42
|
+
* The node's code reads graph vars by their bare name, so they key its cache: a function giving the code it runs
|
|
43
|
+
* (from the resolved params; only the vars named in it count, src/core/usercode.ts codeVarNames), or true for any
|
|
44
|
+
* var (loop bodies, and scripts, whose lib.run "=expr" params can read every var).
|
|
45
|
+
*/
|
|
46
|
+
usesVars?: true | ((p: Record<string, any>) => string);
|
|
41
47
|
/**
|
|
42
48
|
* the node always depends on the cook time (e.g. solver): frame/time are mixed into its signature.
|
|
43
49
|
* Other nodes become time-dependent per cook when their "=expr" params read frame/time/fps or when
|
|
44
50
|
* their cook reads ctx.frame / ctx.time / ctx.fps / ctx.timeInc.
|
|
45
51
|
*/
|
|
46
52
|
usesTime?: boolean;
|
|
53
|
+
/**
|
|
54
|
+
* The result depends on the scope the node cooks in (CookContext.scope): the node reads files or graphs through it,
|
|
55
|
+
* or cooks nested graphs in it (subcook, lib.run), whose node types resolve there. Outside the root scope the scope's
|
|
56
|
+
* id is then part of its signature. The engine finds this by itself, as it finds time dependence: when signatureExtra
|
|
57
|
+
* reads the scope it is given, or the cook reads ctx.scope or calls ctx.subcook without naming a scope. Saying it
|
|
58
|
+
* here keys the very first cook by the scope too, before the engine has seen the node read it.
|
|
59
|
+
*/
|
|
60
|
+
usesScope?: boolean;
|
|
61
|
+
/**
|
|
62
|
+
* The result depends on the node's own name (CookContext.node), e.g. an image named after the node that made it:
|
|
63
|
+
* true, or a function deciding from the resolved params. The name is then part of its signature, so two otherwise
|
|
64
|
+
* identical nodes do not share one cached result.
|
|
65
|
+
*/
|
|
66
|
+
usesNodeName?: boolean | ((p: Record<string, any>) => boolean);
|
|
47
67
|
/** deprecation notice naming the replacement; hidden from the catalog, warned about on cook */
|
|
48
68
|
deprecated?: string;
|
|
69
|
+
/**
|
|
70
|
+
* params that were renamed or removed: the old name → what to write now. The old name is not accepted (no
|
|
71
|
+
* compatibility layer); the unknown-param error says this instead of guessing at near names.
|
|
72
|
+
*/
|
|
73
|
+
renamed?: Record<string, string>;
|
|
49
74
|
/**
|
|
50
75
|
* Packed primitives: 'keep' = the node handles packed prims (instances) in its inputs; 'unpack' (default) = the
|
|
51
76
|
* engine expands them before cooking the node, with a warning. A function decides per cook from the resolved params.
|
|
@@ -62,8 +87,10 @@ export interface NodeDef {
|
|
|
62
87
|
* selected candidate). Inputs marked false are not cooked and appear as null. Default: all inputs.
|
|
63
88
|
*/
|
|
64
89
|
inputsUsed?: (p: Record<string, any>, count: number) => boolean[];
|
|
65
|
-
/** extra cache-key material (e.g. file mtime) */
|
|
66
|
-
signatureExtra?: (p: Record<string, any>,
|
|
90
|
+
/** extra cache-key material (e.g. file mtime), from the scope the node cooks in */
|
|
91
|
+
signatureExtra?: (p: Record<string, any>, scope: Scope) => string;
|
|
92
|
+
/** a package output's node type (src/graph/packages.ts): the package, its version and what it cooks */
|
|
93
|
+
package?: PackageOutput;
|
|
67
94
|
cook(ctx: CookContext): Geometry | Promise<Geometry>;
|
|
68
95
|
}
|
|
69
96
|
export interface NodeSpec {
|
|
@@ -81,7 +108,8 @@ export interface VarDef {
|
|
|
81
108
|
desc?: string;
|
|
82
109
|
min?: number;
|
|
83
110
|
max?: number;
|
|
84
|
-
|
|
111
|
+
/** choices (type enum): strings or numbers, and the var holds the option itself */
|
|
112
|
+
options?: (string | number)[];
|
|
85
113
|
/** control label for humans (default: the var name) */
|
|
86
114
|
label?: string;
|
|
87
115
|
/** slider step (default: 1 for ints, else derived from the range) */
|
|
@@ -100,24 +128,39 @@ export type ExportTarget = string | {
|
|
|
100
128
|
path?: string;
|
|
101
129
|
[option: string]: unknown;
|
|
102
130
|
};
|
|
131
|
+
/** A value shaped like a graph: an object with a nodes object (a nested graph in a node's params). */
|
|
132
|
+
export declare const isGraph: (v: unknown) => v is GraphSpec;
|
|
103
133
|
export interface GraphSpec {
|
|
104
|
-
/** graph format
|
|
134
|
+
/** the graph format a tool wrote it in (informational: graphs are read as they are, with no migrations) */
|
|
105
135
|
version?: number;
|
|
106
136
|
nodes: Record<string, NodeSpec>;
|
|
107
137
|
output?: string;
|
|
108
138
|
/** where the default output exports to (io/targets.ts): a format ("glb"), or {format, path?, ...export options} */
|
|
109
139
|
export?: ExportTarget;
|
|
110
|
-
/**
|
|
140
|
+
/**
|
|
141
|
+
* Named deliverables for the viewer. `output` remains the default cook target. A package that publishes versions publishes
|
|
142
|
+
* every named output of its graphs but those with `publish: false` (viewer-only previews), with its kind (detected,
|
|
143
|
+
* or pinned here and checked), its tags and its description (else the graph's): src/graph/outputs.ts.
|
|
144
|
+
*/
|
|
111
145
|
outputs?: Record<string, {
|
|
112
146
|
node: string;
|
|
113
147
|
label?: string;
|
|
114
148
|
export?: ExportTarget;
|
|
149
|
+
publish?: boolean;
|
|
150
|
+
kind?: Kind;
|
|
151
|
+
tags?: string[];
|
|
152
|
+
description?: string;
|
|
115
153
|
}>;
|
|
116
154
|
vars?: Record<string, any>;
|
|
117
155
|
/** metadata for exposed vars: asset parameters, and the controls the live viewer shows for them */
|
|
118
156
|
params?: Record<string, VarDef>;
|
|
119
157
|
description?: string;
|
|
120
158
|
meta?: GraphMeta;
|
|
159
|
+
/**
|
|
160
|
+
* a piece another graph or a script completes (merges more nodes into it): never cooked on its own, so topotopo
|
|
161
|
+
* check skips it
|
|
162
|
+
*/
|
|
163
|
+
fragment?: boolean;
|
|
121
164
|
}
|
|
122
165
|
export interface CookContext {
|
|
123
166
|
node: string;
|
|
@@ -130,6 +173,11 @@ export interface CookContext {
|
|
|
130
173
|
warn(msg: string): void;
|
|
131
174
|
vars: Record<string, any>;
|
|
132
175
|
engine: Engine;
|
|
176
|
+
/**
|
|
177
|
+
* The scope the node cooks in (src/graph/scope.ts): the files it reads, the graphs graph_ref reads and the node
|
|
178
|
+
* types of nested cooks, which run in it too. Reading it makes the result depend on it (NodeDef.usesScope).
|
|
179
|
+
*/
|
|
180
|
+
scope: Scope;
|
|
133
181
|
/** cache signatures of the inputs (for nested cooks) */
|
|
134
182
|
inputSigs: string[];
|
|
135
183
|
depth: number;
|
|
@@ -143,7 +191,20 @@ export interface CookContext {
|
|
|
143
191
|
readonly timeInc: number;
|
|
144
192
|
/** mark the result as depending on time (when the dependency is not visible to the engine) */
|
|
145
193
|
markTimeDependent(): void;
|
|
146
|
-
/**
|
|
194
|
+
/**
|
|
195
|
+
* The cook's stop signal (CookOptions.signal), if it has one. The engine stops at node boundaries; pool tasks of the
|
|
196
|
+
* node (parallelMap, big WASM calls) stop with it, and a long node calls checkpoint() between its steps.
|
|
197
|
+
*/
|
|
198
|
+
readonly signal?: StopSignal;
|
|
199
|
+
/**
|
|
200
|
+
* Between the steps of a long node (iterations, simulation steps): lets the host serve requests meanwhile (a stop
|
|
201
|
+
* among them), and throws NodeError(STOPPED) once the cook was asked to stop. Cheap when the cook has no signal.
|
|
202
|
+
*/
|
|
203
|
+
checkpoint(): Promise<void>;
|
|
204
|
+
/**
|
|
205
|
+
* cook a nested graph (foreach body, asset, solver step) inheriting the time and the scope (unless opts.scope is
|
|
206
|
+
* given); propagates time dependence
|
|
207
|
+
*/
|
|
147
208
|
subcook(graph: GraphSpec, opts?: CookOptions): Promise<CookReport>;
|
|
148
209
|
/** input i cooked at another frame (the current result if the input is not time-dependent) */
|
|
149
210
|
inputAt(i: number, frame: number): Promise<{
|
|
@@ -164,3 +225,5 @@ export declare class NodeError extends Error {
|
|
|
164
225
|
hint?: string;
|
|
165
226
|
constructor(msg: string, hint?: string);
|
|
166
227
|
}
|
|
228
|
+
/** The error of a node that a stopped cook did not cook, or stopped while it cooked (CookOptions.signal). */
|
|
229
|
+
export declare const STOPPED = "cook stopped";
|
package/dist/graph/types.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/**
|
|
2
|
-
export const
|
|
1
|
+
/** A value shaped like a graph: an object with a nodes object (a nested graph in a node's params). */
|
|
2
|
+
export const isGraph = (v) => !!v && typeof v === 'object' && !Array.isArray(v) && !!v.nodes && typeof v.nodes === 'object';
|
|
3
3
|
export class NodeError extends Error {
|
|
4
4
|
hint;
|
|
5
5
|
constructor(msg, hint) {
|
|
@@ -7,3 +7,5 @@ export class NodeError extends Error {
|
|
|
7
7
|
this.hint = hint;
|
|
8
8
|
}
|
|
9
9
|
}
|
|
10
|
+
/** The error of a node that a stopped cook did not cook, or stopped while it cooked (CookOptions.signal). */
|
|
11
|
+
export const STOPPED = 'cook stopped';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { GraphSpec } from './types.ts';
|
|
2
|
+
/** What a var-name error says about reading vars (the hint of the validation error). */
|
|
3
|
+
export declare const VAR_NAME_HINT = "expressions and code read graph vars by their bare name (\"=height * 0.5\", @P.y += height), so a var needs a name of its own";
|
|
4
|
+
/** Why a graph cannot declare a var of this name, or null when it can. */
|
|
5
|
+
export declare function varNameError(name: string): string | null;
|
|
6
|
+
/**
|
|
7
|
+
* A var value from text: a number ("8", "-0.5", "1e3"), true / false, JSON (null, [1, 2], {"a": 1}, "quoted"), or
|
|
8
|
+
* else the text itself as a string. Text that starts like JSON but does not parse is an error.
|
|
9
|
+
*/
|
|
10
|
+
export declare function parseVarValue(text: string): unknown;
|
|
11
|
+
/** "name=value" → [name, value]; the value is parsed by parseVarValue. */
|
|
12
|
+
export declare function parseVarArg(arg: string): [string, unknown];
|
|
13
|
+
/** The vars a graph knows: those it sets and those it declares as params. */
|
|
14
|
+
export declare function knownVars(spec: GraphSpec): string[];
|
|
15
|
+
/** The graph with these vars set (a new object; the input is not changed). An unknown var throws, naming the known ones. */
|
|
16
|
+
export declare function withVars(spec: GraphSpec, vars: [string, unknown][]): GraphSpec;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { didYouMean } from './params.js';
|
|
2
|
+
import { EXPR_HELPERS, REF_FUNCS, TIME_KEYS } from './expr.js';
|
|
3
|
+
import { SNIPPET_LIB_NAMES } from '../core/snippet-lib.js';
|
|
4
|
+
import { JS_GLOBALS, RESERVED_WORDS } from '../core/usercode.js';
|
|
5
|
+
import { WRANGLE_NAMES } from '../core/wrangle.js';
|
|
6
|
+
const HELPERS = new Set([...EXPR_HELPERS, ...REF_FUNCS, ...SNIPPET_LIB_NAMES]);
|
|
7
|
+
/** What a var-name error says about reading vars (the hint of the validation error). */
|
|
8
|
+
export const VAR_NAME_HINT = 'expressions and code read graph vars by their bare name ("=height * 0.5", @P.y += height), so a var needs a name of its own';
|
|
9
|
+
/** Why a graph cannot declare a var of this name, or null when it can. */
|
|
10
|
+
export function varNameError(name) {
|
|
11
|
+
const rename = 'rename the var';
|
|
12
|
+
if (!/^[A-Za-z_$][\w$]*$/.test(name))
|
|
13
|
+
return `var "${name}" is not a name code can read: use letters, digits and _ (not starting with a digit)`;
|
|
14
|
+
if (name.startsWith('__'))
|
|
15
|
+
return `var "${name}": names starting with __ belong to the engine; ${rename}`;
|
|
16
|
+
if (name === 'vars')
|
|
17
|
+
return 'var "vars": code reads graph vars by their bare name and has no vars object; rename the var';
|
|
18
|
+
if (RESERVED_WORDS.has(name))
|
|
19
|
+
return `var "${name}" is a JavaScript keyword, which code cannot read as a name; ${rename}`;
|
|
20
|
+
if (TIME_KEYS.has(name))
|
|
21
|
+
return `var "${name}" would hide the cook time (frame, time, fps, timeInc) from expressions; ${rename}`;
|
|
22
|
+
if (HELPERS.has(name))
|
|
23
|
+
return `var "${name}" would hide the helper ${name} from expressions and code; ${rename}`;
|
|
24
|
+
if (WRANGLE_NAMES.has(name))
|
|
25
|
+
return `var "${name}" would hide @${name} in wrangles; ${rename}`;
|
|
26
|
+
if (JS_GLOBALS.has(name))
|
|
27
|
+
return `var "${name}" would hide JavaScript's ${name} from code; ${rename}`;
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
30
|
+
const NUMBER = /^[+-]?(?:\d+\.?\d*|\.\d+)(?:e[+-]?\d+)?$/i;
|
|
31
|
+
/**
|
|
32
|
+
* A var value from text: a number ("8", "-0.5", "1e3"), true / false, JSON (null, [1, 2], {"a": 1}, "quoted"), or
|
|
33
|
+
* else the text itself as a string. Text that starts like JSON but does not parse is an error.
|
|
34
|
+
*/
|
|
35
|
+
export function parseVarValue(text) {
|
|
36
|
+
const t = text.trim();
|
|
37
|
+
if (NUMBER.test(t))
|
|
38
|
+
return Number(t);
|
|
39
|
+
if (t === 'true' || t === 'false')
|
|
40
|
+
return t === 'true';
|
|
41
|
+
if (t === 'null' || /^[[{"]/.test(t)) {
|
|
42
|
+
try {
|
|
43
|
+
return JSON.parse(t);
|
|
44
|
+
}
|
|
45
|
+
catch (e) {
|
|
46
|
+
throw new Error(`${JSON.stringify(text)} is not valid JSON (${e.message})`);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
return text;
|
|
50
|
+
}
|
|
51
|
+
/** "name=value" → [name, value]; the value is parsed by parseVarValue. */
|
|
52
|
+
export function parseVarArg(arg) {
|
|
53
|
+
const i = arg.indexOf('=');
|
|
54
|
+
const name = i > 0 ? arg.slice(0, i).trim() : '';
|
|
55
|
+
if (!name)
|
|
56
|
+
throw new Error(`expects name=value (e.g. relief=8), got ${JSON.stringify(arg)}`);
|
|
57
|
+
try {
|
|
58
|
+
return [name, parseVarValue(arg.slice(i + 1))];
|
|
59
|
+
}
|
|
60
|
+
catch (e) {
|
|
61
|
+
throw new Error(`${name}: ${e.message}`);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
/** The vars a graph knows: those it sets and those it declares as params. */
|
|
65
|
+
export function knownVars(spec) {
|
|
66
|
+
return [...new Set([...Object.keys(spec.vars ?? {}), ...Object.keys(spec.params ?? {})])];
|
|
67
|
+
}
|
|
68
|
+
/** The graph with these vars set (a new object; the input is not changed). An unknown var throws, naming the known ones. */
|
|
69
|
+
export function withVars(spec, vars) {
|
|
70
|
+
if (!vars.length)
|
|
71
|
+
return spec;
|
|
72
|
+
const known = knownVars(spec);
|
|
73
|
+
for (const [name] of vars) {
|
|
74
|
+
if (known.includes(name))
|
|
75
|
+
continue;
|
|
76
|
+
const s = didYouMean(name, known);
|
|
77
|
+
throw new Error(`unknown var "${name}"${s.length ? ` (did you mean ${s.join(', ')}?)` : ''}; ${known.length ? `the graph's vars: ${known.join(', ')}` : 'the graph has no vars'}`);
|
|
78
|
+
}
|
|
79
|
+
return { ...spec, vars: { ...(spec.vars ?? {}), ...Object.fromEntries(vars) } };
|
|
80
|
+
}
|
package/dist/host/artifacts.d.ts
CHANGED
|
@@ -14,8 +14,17 @@ export declare class ArtifactStore {
|
|
|
14
14
|
dir: string;
|
|
15
15
|
constructor(dir: string);
|
|
16
16
|
get manifest(): string;
|
|
17
|
+
/** the folder the receipts' paths are relative to: the package (exports/'s folder) */
|
|
18
|
+
private get base();
|
|
19
|
+
/** A path as the receipts file holds it: relative to the package, with "/" (absolute only on another drive). */
|
|
20
|
+
private stored;
|
|
21
|
+
/** The receipts, their paths absolute on this machine. */
|
|
17
22
|
records(): Artifact[];
|
|
18
23
|
record(files: string[], info?: Partial<Omit<Artifact, 'id' | 'files'>>): Artifact;
|
|
19
|
-
/**
|
|
24
|
+
/**
|
|
25
|
+
* Discover unregistered agent-written files too, one output each; an export's sidecar among them (a heightmap's
|
|
26
|
+
* .json, <file>.source.json …: io/sidecars.ts) joins the output of the file it describes. Never follow
|
|
27
|
+
* symlinks/junctions while scanning.
|
|
28
|
+
*/
|
|
20
29
|
list(): Artifact[];
|
|
21
30
|
}
|
package/dist/host/artifacts.js
CHANGED
|
@@ -1,17 +1,30 @@
|
|
|
1
1
|
// Persistent output receipts shared by the CLI, MCP and viewer. Paths are registered by trusted host code;
|
|
2
|
-
// HTTP callers only receive identifiers, never a route that reads an arbitrary absolute path.
|
|
2
|
+
// HTTP callers only receive identifiers, never a route that reads an arbitrary absolute path. The receipts file
|
|
3
|
+
// (exports/.outputs.json) holds the paths relative to the package, the folder exports/ is in ("exports/crate.glb"),
|
|
4
|
+
// never a machine's absolute paths: the package folder can move, or be checked out elsewhere.
|
|
3
5
|
import fs from 'node:fs';
|
|
4
6
|
import path from 'node:path';
|
|
5
7
|
import { createHash } from 'node:crypto';
|
|
8
|
+
import { sidecarFile } from './sidecars.js';
|
|
9
|
+
import { isEngineFile } from '../engines.js';
|
|
6
10
|
export const artifactId = (p) => createHash('sha256').update(path.resolve(p)).digest('hex').slice(0, 24);
|
|
7
11
|
export class ArtifactStore {
|
|
8
12
|
dir;
|
|
9
13
|
constructor(dir) { this.dir = path.resolve(dir); }
|
|
10
14
|
get manifest() { return path.join(this.dir, '.outputs.json'); }
|
|
15
|
+
/** the folder the receipts' paths are relative to: the package (exports/'s folder) */
|
|
16
|
+
get base() { return path.dirname(this.dir); }
|
|
17
|
+
/** A path as the receipts file holds it: relative to the package, with "/" (absolute only on another drive). */
|
|
18
|
+
stored(p) {
|
|
19
|
+
const rel = path.relative(this.base, path.resolve(p));
|
|
20
|
+
return path.isAbsolute(rel) ? path.resolve(p) : rel.split(path.sep).join('/');
|
|
21
|
+
}
|
|
22
|
+
/** The receipts, their paths absolute on this machine. */
|
|
11
23
|
records() {
|
|
12
24
|
try {
|
|
13
25
|
const j = JSON.parse(fs.readFileSync(this.manifest, 'utf8'));
|
|
14
|
-
return Array.isArray(j) ? j.filter((a) => a && typeof a.id === 'string' && Array.isArray(a.files) && a.files.every((p) => typeof p === 'string'))
|
|
26
|
+
return Array.isArray(j) ? j.filter((a) => a && typeof a.id === 'string' && Array.isArray(a.files) && a.files.every((p) => typeof p === 'string'))
|
|
27
|
+
.map((a) => ({ ...a, files: a.files.map((p) => path.resolve(this.base, ...p.split('/'))) })) : [];
|
|
15
28
|
}
|
|
16
29
|
catch {
|
|
17
30
|
return [];
|
|
@@ -26,14 +39,19 @@ export class ArtifactStore {
|
|
|
26
39
|
all.push(a);
|
|
27
40
|
fs.mkdirSync(this.dir, { recursive: true });
|
|
28
41
|
const temp = this.manifest + '.part';
|
|
29
|
-
fs.writeFileSync(temp, JSON.stringify(all, null, 2) + '\n');
|
|
42
|
+
fs.writeFileSync(temp, JSON.stringify(all.map((x) => ({ ...x, files: x.files.map((p) => this.stored(p)) })), null, 2) + '\n');
|
|
30
43
|
fs.renameSync(temp, this.manifest);
|
|
31
44
|
return a;
|
|
32
45
|
}
|
|
33
|
-
/**
|
|
46
|
+
/**
|
|
47
|
+
* Discover unregistered agent-written files too, one output each; an export's sidecar among them (a heightmap's
|
|
48
|
+
* .json, <file>.source.json …: io/sidecars.ts) joins the output of the file it describes. Never follow
|
|
49
|
+
* symlinks/junctions while scanning.
|
|
50
|
+
*/
|
|
34
51
|
list() {
|
|
35
52
|
const all = this.records().filter((a) => a.files.some((p) => fs.statSync(p, { throwIfNoEntry: false })?.isFile()));
|
|
36
53
|
const known = new Set(all.flatMap((a) => a.files.map((p) => path.resolve(p))));
|
|
54
|
+
const found = [];
|
|
37
55
|
const walk = (dir) => {
|
|
38
56
|
// a folder can be missing, or vanish between listing its parent and reading it
|
|
39
57
|
const entries = (() => { try {
|
|
@@ -43,16 +61,29 @@ export class ArtifactStore {
|
|
|
43
61
|
return [];
|
|
44
62
|
} })();
|
|
45
63
|
for (const e of entries.sort((a, b) => a.name.localeCompare(b.name, 'en'))) {
|
|
46
|
-
|
|
64
|
+
// files an engine writes beside the exports it imports (*.import, *.uasset …) are not TopoTopo's
|
|
65
|
+
if (e.name.startsWith('.') || e.isSymbolicLink() || (e.isFile() && isEngineFile(e.name)))
|
|
47
66
|
continue;
|
|
48
67
|
const p = path.join(dir, e.name);
|
|
49
68
|
if (e.isDirectory())
|
|
50
69
|
walk(p);
|
|
51
70
|
else if (e.isFile() && !known.has(p))
|
|
52
|
-
|
|
71
|
+
found.push({ id: artifactId(p), label: path.relative(this.dir, p).split(path.sep).join('/'), files: [p] });
|
|
53
72
|
}
|
|
54
73
|
};
|
|
55
74
|
walk(this.dir);
|
|
75
|
+
const owner = new Map();
|
|
76
|
+
for (const a of [...all, ...found])
|
|
77
|
+
for (const p of a.files)
|
|
78
|
+
if (!owner.has(path.resolve(p)))
|
|
79
|
+
owner.set(path.resolve(p), a);
|
|
80
|
+
for (const a of found) {
|
|
81
|
+
const s = sidecarFile(a.files[0]), of = s?.of ? owner.get(path.resolve(s.of)) : undefined;
|
|
82
|
+
if (of && of !== a)
|
|
83
|
+
of.files.push(a.files[0]);
|
|
84
|
+
else
|
|
85
|
+
all.push(a);
|
|
86
|
+
}
|
|
56
87
|
return all;
|
|
57
88
|
}
|
|
58
89
|
}
|