topotopo 0.3.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 +40 -10
- package/README.md +475 -111
- package/dist/cli.js +328 -133
- package/dist/config.d.ts +48 -0
- package/dist/config.js +170 -0
- package/dist/core/analysis.d.ts +5 -1
- package/dist/core/analysis.js +8 -3
- package/dist/core/bake.d.ts +16 -8
- package/dist/core/bake.js +165 -29
- package/dist/core/bevel.d.ts +3 -1
- package/dist/core/bevel.js +238 -97
- 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 +204 -4
- package/dist/core/heightfield.d.ts +27 -4
- package/dist/core/heightfield.js +54 -16
- package/dist/core/imageops.d.ts +6 -0
- package/dist/core/imageops.js +51 -0
- 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 +11 -0
- package/dist/core/materials.js +56 -0
- package/dist/core/noise.d.ts +9 -0
- package/dist/core/noise.js +10 -1
- package/dist/core/packed.js +11 -0
- package/dist/core/particles.d.ts +1 -1
- package/dist/core/particles.js +1 -1
- package/dist/core/polymerge.d.ts +21 -0
- package/dist/core/polymerge.js +327 -0
- package/dist/core/rbd.js +13 -1
- 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/scatter.d.ts +1 -1
- package/dist/core/scatter.js +1 -1
- package/dist/core/scene.d.ts +20 -0
- package/dist/core/scene.js +72 -0
- 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 +15 -2
- package/dist/core/snippet-lib.js +40 -14
- package/dist/core/solidify.d.ts +38 -0
- package/dist/core/solidify.js +356 -0
- package/dist/core/tangents.d.ts +54 -0
- package/dist/core/tangents.js +218 -0
- package/dist/core/texcoord.d.ts +4 -0
- package/dist/core/texcoord.js +14 -0
- 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 +32 -0
- package/dist/core/topology.js +238 -7
- package/dist/core/traceimage.d.ts +7 -0
- package/dist/core/traceimage.js +221 -0
- package/dist/core/tritri.d.ts +5 -0
- package/dist/core/tritri.js +120 -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 +15 -16
- package/dist/core/uv.js +36 -189
- 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 +127 -0
- package/dist/core/uvreport.js +372 -0
- 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 +95 -61
- 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 +5 -3
- package/dist/index.js +3 -2
- package/dist/inspect.d.ts +84 -1
- package/dist/inspect.js +271 -24
- package/dist/io/common.d.ts +33 -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 +355 -51
- 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 +149 -14
- 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 +816 -119
- package/dist/mcp/inputs.d.ts +12 -5
- package/dist/mcp/inputs.js +50 -13
- package/dist/mcp/server.js +70 -24
- package/dist/mcp/tools.d.ts +14 -7
- package/dist/mcp/tools.js +207 -108
- 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 +207 -83
- package/dist/nodes/beam.d.ts +1 -0
- package/dist/nodes/beam.js +201 -0
- package/dist/nodes/bevel.js +54 -5
- package/dist/nodes/cloth.js +2 -0
- package/dist/nodes/code.js +22 -10
- package/dist/nodes/curves.js +440 -93
- package/dist/nodes/flow.js +53 -33
- package/dist/nodes/generate.js +13 -39
- package/dist/nodes/heightfield.js +248 -77
- package/dist/nodes/imageops.d.ts +1 -0
- package/dist/nodes/imageops.js +203 -0
- package/dist/nodes/index.d.ts +4 -0
- package/dist/nodes/index.js +4 -0
- package/dist/nodes/material.js +91 -23
- package/dist/nodes/measure.js +45 -18
- package/dist/nodes/particles.js +2 -0
- package/dist/nodes/pcg.js +6 -5
- package/dist/nodes/procedural.js +4 -3
- package/dist/nodes/rbd.js +1 -1
- package/dist/nodes/remesh.js +71 -15
- package/dist/nodes/scene.d.ts +1 -0
- package/dist/nodes/scene.js +55 -0
- package/dist/nodes/sdf.js +10 -5
- package/dist/nodes/solid.js +20 -5
- package/dist/nodes/solidify.d.ts +1 -0
- package/dist/nodes/solidify.js +52 -0
- 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 +11 -3
- package/dist/nodes/util.d.ts +1 -1
- package/dist/nodes/uv.js +192 -174
- package/dist/nodes/wasmcall.js +6 -2
- 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/pbr.d.ts +28 -0
- package/dist/render/pbr.js +378 -0
- package/dist/render/preview.d.ts +69 -0
- package/dist/render/preview.js +26 -0
- package/dist/render/raster.d.ts +78 -7
- package/dist/render/raster.js +600 -145
- package/dist/render/texview.d.ts +7 -1
- package/dist/render/texview.js +34 -2
- 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/camera.js +1 -1
- package/dist/viewer/app/cooking.js +78 -0
- package/dist/viewer/app/embed.js +100 -0
- package/dist/viewer/app/export-popover.js +118 -16
- package/dist/viewer/app/grid.js +6 -2
- package/dist/viewer/app/guides.js +123 -1
- package/dist/viewer/app/keymap.js +7 -4
- package/dist/viewer/app/layers.js +5 -5
- package/dist/viewer/app/main.js +186 -53
- package/dist/viewer/app/markers.js +61 -1
- 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 +177 -53
- package/dist/viewer/app/scene.js +35 -6
- package/dist/viewer/app/select.js +5 -4
- package/dist/viewer/app/selection.js +1 -1
- package/dist/viewer/app/status.js +12 -15
- package/dist/viewer/app/style.css +66 -8
- package/dist/viewer/app/units.js +1 -1
- package/dist/viewer/app/vars.js +48 -1
- 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 +24 -11
- 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 +24 -7
- package/dist/viewer/server.js +289 -31
- package/dist/web/app/web.css +419 -0
- package/dist/web/app/web.js +188 -0
- package/dist/web/bake.d.ts +34 -0
- package/dist/web/bake.js +153 -0
- 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 -105
- package/dist/workspace.js +359 -375
- 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 +23 -29
- package/kernels/pkg-simd/README.md +23 -29
- 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 +23 -8
- package/dist/graph/migrate.d.ts +0 -23
- package/dist/graph/migrate.js +0 -58
- package/shelf/index.json +0 -190
|
@@ -0,0 +1,796 @@
|
|
|
1
|
+
import type { Engine } from '../graph/engine.ts';
|
|
2
|
+
import type { Kind } from '../graph/outputs.ts';
|
|
3
|
+
import type { PackageIssue, PackageResolver, Scope } from '../graph/scope.ts';
|
|
4
|
+
import type { GraphSpec, NodeDef } from '../graph/types.ts';
|
|
5
|
+
import type { SessionPackages } from '../session.ts';
|
|
6
|
+
import type { CopyStore, Libraries, PackageManifest } from '../package.ts';
|
|
7
|
+
/** Publishing warns about a version above this size: every package that uses it keeps a copy. */
|
|
8
|
+
export declare const MAX_VERSION_BYTES: number;
|
|
9
|
+
/** The owner of TopoTopo's own packages: nobody else publishes under it. */
|
|
10
|
+
export declare const RESERVED_OWNER = "topotopo";
|
|
11
|
+
/** A library as messages name it: library "game", and TopoTopo's built-in library by its name and what it is. */
|
|
12
|
+
export declare const libraryText: (name: string) => string;
|
|
13
|
+
export interface LockEntry {
|
|
14
|
+
hash: string;
|
|
15
|
+
library: string;
|
|
16
|
+
uses: Record<string, string>;
|
|
17
|
+
}
|
|
18
|
+
/** packages/lock.json: every copied version, by package and version. */
|
|
19
|
+
export interface Lock {
|
|
20
|
+
packages: Record<string, Record<string, LockEntry>>;
|
|
21
|
+
}
|
|
22
|
+
export interface SliderInfo {
|
|
23
|
+
type: string;
|
|
24
|
+
default?: unknown;
|
|
25
|
+
min?: number;
|
|
26
|
+
max?: number;
|
|
27
|
+
options?: (string | number)[];
|
|
28
|
+
label?: string;
|
|
29
|
+
desc?: string;
|
|
30
|
+
}
|
|
31
|
+
export interface InputInfo {
|
|
32
|
+
index: number;
|
|
33
|
+
label: string;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* A published output: the graph and node it cooks, what it is (its kind as it cooked, its tags, its description: the
|
|
37
|
+
* output's own or else its graph's, none when neither has one), its params (the graph's vars) and its inputs (its input
|
|
38
|
+
* nodes).
|
|
39
|
+
*/
|
|
40
|
+
export interface OutputInfo {
|
|
41
|
+
graph: string;
|
|
42
|
+
node: string;
|
|
43
|
+
label?: string;
|
|
44
|
+
kind: Kind;
|
|
45
|
+
tags: string[];
|
|
46
|
+
description?: string;
|
|
47
|
+
sliders: Record<string, SliderInfo>;
|
|
48
|
+
inputs: InputInfo[];
|
|
49
|
+
/** a material output: per material, the size of each map it carries (slot → [width, height]) */
|
|
50
|
+
maps?: Record<string, Record<string, [number, number]>>;
|
|
51
|
+
}
|
|
52
|
+
/** version.json */
|
|
53
|
+
export interface VersionInfo {
|
|
54
|
+
package: string;
|
|
55
|
+
version: string;
|
|
56
|
+
note: string;
|
|
57
|
+
/** ISO time */
|
|
58
|
+
published: string;
|
|
59
|
+
/** the author marked it big (publish --big) */
|
|
60
|
+
big: boolean;
|
|
61
|
+
hash: string;
|
|
62
|
+
/**
|
|
63
|
+
* every published output, and the default output (the output node of the graph the manifest shows; its tags and
|
|
64
|
+
* description are those of the named output it is, if any)
|
|
65
|
+
*/
|
|
66
|
+
outputs: Record<string, OutputInfo>;
|
|
67
|
+
default: OutputInfo;
|
|
68
|
+
/** the TopoTopo version that published it */
|
|
69
|
+
topotopo: string;
|
|
70
|
+
}
|
|
71
|
+
/** Is `o` the version's default output (the graph the manifest shows, at its output node)? */
|
|
72
|
+
export declare const isDefaultOutput: (v: Pick<VersionInfo, 'default'>, o: {
|
|
73
|
+
graph: string;
|
|
74
|
+
node: string;
|
|
75
|
+
}) => boolean;
|
|
76
|
+
/** The named output that is the default one too, or null when the default output is one of its own. */
|
|
77
|
+
export declare const defaultOutputName: (v: Pick<VersionInfo, 'outputs' | 'default'>) => string | null;
|
|
78
|
+
export declare const compareVersions: (a: string, b: string) => number;
|
|
79
|
+
/** A version that starts a big version: 2.0, 3.0, 10.0 (1.0 is the first one, 1.10 a small one). */
|
|
80
|
+
export declare const startsBigVersion: (v: string) => boolean;
|
|
81
|
+
/**
|
|
82
|
+
* A file's content as a version's hash reads it: a text file with its CRLF line ends read as LF, so that a checkout that
|
|
83
|
+
* turns LF into CRLF (core.autocrlf) keeps the hash; anything else as it is. Text is what version control takes for
|
|
84
|
+
* text: no NUL byte in the first 8000 bytes, and no binary format by its name.
|
|
85
|
+
*/
|
|
86
|
+
export declare function textContent(name: string, bytes: Uint8Array): Uint8Array;
|
|
87
|
+
/** The SHA-256 a version's hash takes of a file: of its text with LF line ends, or of its bytes (textContent). */
|
|
88
|
+
export declare const contentSha: (name: string, bytes: Uint8Array) => string;
|
|
89
|
+
/** The hash of a set of files: their sorted posix paths, each with the SHA-256 of its content (contentSha). */
|
|
90
|
+
export declare function filesHash(files: {
|
|
91
|
+
rel: string;
|
|
92
|
+
sha: string;
|
|
93
|
+
}[]): string;
|
|
94
|
+
/**
|
|
95
|
+
* The hash a version published from the package folder `dir` now would have, which tells whether a working folder
|
|
96
|
+
* differs from its versions (its files are re-read only when they change).
|
|
97
|
+
*/
|
|
98
|
+
export declare function workingHash(dir: string): string;
|
|
99
|
+
/** The hash of a version folder as published: every file but its version.json. */
|
|
100
|
+
export declare function versionHash(dir: string, cached?: boolean): string;
|
|
101
|
+
export declare const lockFile: (dir: string) => string;
|
|
102
|
+
/** A folder's packages/lock.json (empty when there is none); throws naming the file when it is not valid. */
|
|
103
|
+
export declare function readLock(dir: string): Lock;
|
|
104
|
+
/** The lock.json of a folder of copies (packages/, a workspace's topotopo-packages/). */
|
|
105
|
+
export declare function readLockAt(packages: string): Lock;
|
|
106
|
+
/** An output a package names that cannot be published as it is: its name, the graphs that name it, and why. */
|
|
107
|
+
export interface InvalidOutput {
|
|
108
|
+
id: string;
|
|
109
|
+
graphs: string[];
|
|
110
|
+
message: string;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* A published output of a package folder as an engine cook names it (packageOutputs): its id (its name; the default
|
|
114
|
+
* output's is its name when it is a named output too, else the package id), the graph and node it cooks, the graph's
|
|
115
|
+
* file, its label and pinned kind, and whether it is the default output.
|
|
116
|
+
*/
|
|
117
|
+
export interface PackageOutput {
|
|
118
|
+
id: string;
|
|
119
|
+
/** the output's name in its graph's "outputs"; null for a default output that is no named output */
|
|
120
|
+
name: string | null;
|
|
121
|
+
graph: string;
|
|
122
|
+
/** the graph's file (graphs/<graph>.json, or a graph file beside the manifest) */
|
|
123
|
+
file: string;
|
|
124
|
+
spec: GraphSpec;
|
|
125
|
+
node: string;
|
|
126
|
+
label?: string;
|
|
127
|
+
kind?: Kind;
|
|
128
|
+
default: boolean;
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* What a package folder publishes, by the rule publishing uses (folderOutputs): every named output of every graph
|
|
132
|
+
* without "publish": false, and the default output (the output node of the graph the manifest shows), named after the
|
|
133
|
+
* package id when it is no named output. `invalid`: names that cannot be published as they are (two graphs naming one
|
|
134
|
+
* output, a default output whose name, the package id, a named output has too, an output naming no node or with a
|
|
135
|
+
* malformed field), each with why; `problems`: the rest of what is wrong (graphs that cannot be read, names that are no
|
|
136
|
+
* ids, no default output). Throws for a folder that is no package. Sorted by id.
|
|
137
|
+
*/
|
|
138
|
+
export declare function packageOutputs(dir: string): {
|
|
139
|
+
outputs: PackageOutput[];
|
|
140
|
+
invalid: InvalidOutput[];
|
|
141
|
+
problems: string[];
|
|
142
|
+
};
|
|
143
|
+
/**
|
|
144
|
+
* Move the copies of the packages inside a workspace that keep their own (their manifest's "uses", their packages/)
|
|
145
|
+
* into the workspace's one shared copy, as topotopo workspace init does: each package at one version for the whole
|
|
146
|
+
* game (two packages that used different versions get the newer, said), the lock entries merged, the packages' uses
|
|
147
|
+
* and copies removed. A package that publishes versions keeps its own (its uses are published with it). A package whose
|
|
148
|
+
* copies differ from the workspace's for the same version (edited by hand) is left as it is, said. Returns what it did,
|
|
149
|
+
* a line each.
|
|
150
|
+
*/
|
|
151
|
+
export declare function gatherCopies(ws: string): string[];
|
|
152
|
+
/** A package version (or a followed working folder) loaded into the engine: its scope and its output node types. */
|
|
153
|
+
export interface Loaded {
|
|
154
|
+
package: string;
|
|
155
|
+
version: string | null;
|
|
156
|
+
dir: string;
|
|
157
|
+
hash: string;
|
|
158
|
+
scope: Scope;
|
|
159
|
+
named: Map<string, NodeDef>;
|
|
160
|
+
default: NodeDef | null;
|
|
161
|
+
/** why it has no default output */
|
|
162
|
+
noDefault?: string;
|
|
163
|
+
/** outputs that name each other in a loop (by name, "" for the default output), and the loop, said */
|
|
164
|
+
loops: Map<string, string>;
|
|
165
|
+
/** what loading it found: its copy edited by hand, files it cannot read, loops (each said with the version) */
|
|
166
|
+
problems: string[];
|
|
167
|
+
/** its graphs and assets that cannot be read or registered, said by file ("assets/bark.json: …") */
|
|
168
|
+
fileProblems: string[];
|
|
169
|
+
/** a copy that loaded with a warning (edited by hand, not in the lock): loaded afresh when the package is checked again */
|
|
170
|
+
warned: boolean;
|
|
171
|
+
/** the versions it uses, as its scope resolves them */
|
|
172
|
+
deps: () => (Loaded | PackageIssue)[];
|
|
173
|
+
}
|
|
174
|
+
/** Which used packages to follow by their working folder, besides those followed by name (a workspace's opt-in). */
|
|
175
|
+
export type FollowPolicy = (working: {
|
|
176
|
+
package: string;
|
|
177
|
+
dir: string;
|
|
178
|
+
place: string;
|
|
179
|
+
}) => boolean;
|
|
180
|
+
/**
|
|
181
|
+
* A package's folder in a place: its versions/, and `working` when it is the package's working folder (it holds its
|
|
182
|
+
* manifest). `at`: the place itself (the folderKey of its root), which two places of one name do not share.
|
|
183
|
+
*/
|
|
184
|
+
interface PackageFolder {
|
|
185
|
+
package: string;
|
|
186
|
+
library: string;
|
|
187
|
+
place: string;
|
|
188
|
+
at: string;
|
|
189
|
+
dir: string;
|
|
190
|
+
working: boolean;
|
|
191
|
+
}
|
|
192
|
+
export interface UseResult {
|
|
193
|
+
version: string;
|
|
194
|
+
copied: string[];
|
|
195
|
+
text: string;
|
|
196
|
+
}
|
|
197
|
+
/** A package in use, and the newer versions its place has. */
|
|
198
|
+
export interface Outdated {
|
|
199
|
+
package: string;
|
|
200
|
+
/** the version in use */
|
|
201
|
+
version: string;
|
|
202
|
+
/** the newest version with the same big number, when it is newer: a small update */
|
|
203
|
+
small?: string;
|
|
204
|
+
/** the newest version, when its big number is higher: a big update */
|
|
205
|
+
big?: string;
|
|
206
|
+
/** every version after the one in use, oldest first */
|
|
207
|
+
newer: VersionInfo[];
|
|
208
|
+
/** the place that has the package, as people read it (the workspace "x", library "props", TopoTopo's built-in library); none when it could not be looked up */
|
|
209
|
+
places: string[];
|
|
210
|
+
/** its working folder there (none for one of TopoTopo's own outside TopoTopo's repository) */
|
|
211
|
+
working: {
|
|
212
|
+
place: string;
|
|
213
|
+
dir: string;
|
|
214
|
+
}[];
|
|
215
|
+
/** later places that have the package too, which are not used */
|
|
216
|
+
also?: string[];
|
|
217
|
+
/** why its versions could not be looked up */
|
|
218
|
+
error?: string;
|
|
219
|
+
}
|
|
220
|
+
/** What an Update goes to: the version in use, the version it goes to, the versions between them. */
|
|
221
|
+
export interface UpdateTarget {
|
|
222
|
+
package: string;
|
|
223
|
+
from: string;
|
|
224
|
+
to: string;
|
|
225
|
+
/** `to` has another big number than `from` */
|
|
226
|
+
big: boolean;
|
|
227
|
+
/** the record of `from` (its copy's, else its place's; null when neither has it) and of `to` */
|
|
228
|
+
fromInfo: VersionInfo | null;
|
|
229
|
+
toInfo: VersionInfo;
|
|
230
|
+
/** the versions after `from` up to `to`, oldest first; going back to an older `to`, the ones it leaves */
|
|
231
|
+
between: VersionInfo[];
|
|
232
|
+
/** the place that holds `to`: the label the lock records, as people read it, and the version's folder there */
|
|
233
|
+
library: string;
|
|
234
|
+
place: string;
|
|
235
|
+
dir: string;
|
|
236
|
+
}
|
|
237
|
+
export interface UpdateResult {
|
|
238
|
+
copied: string[];
|
|
239
|
+
deleted: string[];
|
|
240
|
+
text: string;
|
|
241
|
+
}
|
|
242
|
+
/** An update asked for when there is none to make (the version in use is the newest of its big number): not a failure. */
|
|
243
|
+
export declare class NothingToUpdate extends Error {
|
|
244
|
+
constructor(message: string);
|
|
245
|
+
}
|
|
246
|
+
/**
|
|
247
|
+
* The packages one package uses, in one engine: the resolver of the engine's root scope (the package's uses), a scope per
|
|
248
|
+
* copied version (its own assets, graphs, files and uses), adding packages on first use, the session's followed
|
|
249
|
+
* working folders. openPackages attaches one to an engine.
|
|
250
|
+
*/
|
|
251
|
+
export declare class PackageUses implements SessionPackages {
|
|
252
|
+
readonly engine: Engine;
|
|
253
|
+
/** the package folder; null when the folder belongs to no package */
|
|
254
|
+
readonly dir: string | null;
|
|
255
|
+
/** where the package's copies, their lock and its uses are (copiesFor): its own, or its workspace's shared copy */
|
|
256
|
+
readonly store: CopyStore | null;
|
|
257
|
+
/** the folder of TopoTopo's built-in library, which every package looks in */
|
|
258
|
+
readonly builtin: string;
|
|
259
|
+
/** the folder it was opened for: the package's, or a folder in no package (a workspace's root, say), where lookups start */
|
|
260
|
+
readonly start: string;
|
|
261
|
+
manifest: PackageManifest | null;
|
|
262
|
+
/** the package id, its manifest's name (null while it cannot be read) */
|
|
263
|
+
id: string | null;
|
|
264
|
+
/** why the manifest or the lock could not be read */
|
|
265
|
+
error: string | null;
|
|
266
|
+
/**
|
|
267
|
+
* what the last look at TopoTopo's built-in library found wrong with its packages (the catalog's offer of them):
|
|
268
|
+
* replaced by each look
|
|
269
|
+
*/
|
|
270
|
+
libraryProblems: string[];
|
|
271
|
+
/** what the engine's root scope resolves package names with */
|
|
272
|
+
readonly resolver: PackageResolver;
|
|
273
|
+
private root;
|
|
274
|
+
private loaded;
|
|
275
|
+
/** versions read apart from the copies (Context.library), by folder */
|
|
276
|
+
private apart;
|
|
277
|
+
private loading;
|
|
278
|
+
private followed;
|
|
279
|
+
private policy;
|
|
280
|
+
private followLoaded;
|
|
281
|
+
/** the hash of every followed folder: what their outputs' results are keyed by */
|
|
282
|
+
private joint;
|
|
283
|
+
/** the package itself, its graphs as they are now ("" until its graphs name one of its outputs) */
|
|
284
|
+
private selfStamp;
|
|
285
|
+
private selfLoaded;
|
|
286
|
+
/** the same, its uses resolving to the published copies whatever this session follows (publishing) */
|
|
287
|
+
private selfPublished;
|
|
288
|
+
/** why first use could not add a package, said when a graph names it */
|
|
289
|
+
private unavailable;
|
|
290
|
+
private disk;
|
|
291
|
+
private watchers;
|
|
292
|
+
private watchTimer;
|
|
293
|
+
private onChange;
|
|
294
|
+
/**
|
|
295
|
+
* `builtin`: the folder of TopoTopo's built-in library (default: the one TopoTopo ships, BUILTIN_LIBRARY); `start`: the
|
|
296
|
+
* folder it was opened for, when that is in no package (default: the package's folder, else the engine's)
|
|
297
|
+
*/
|
|
298
|
+
constructor(engine: Engine, dir: string | null, opts?: {
|
|
299
|
+
builtin?: string;
|
|
300
|
+
start?: string;
|
|
301
|
+
});
|
|
302
|
+
/** "package lantern (D:/lib/props/lantern)" */
|
|
303
|
+
get label(): string;
|
|
304
|
+
/** Who it is for, for messages: the package, the workspace at whose root the folder is, or this folder. */
|
|
305
|
+
get who(): string;
|
|
306
|
+
/**
|
|
307
|
+
* The copies the uses of this folder are kept in: the package's (its own, or its workspace's), or at a workspace's
|
|
308
|
+
* root the workspace's; throws for a folder in no package and no workspace.
|
|
309
|
+
*/
|
|
310
|
+
lookStore(): CopyStore;
|
|
311
|
+
/** The versions in use as they are on disk now: the package's (its own or its workspace's), or at a workspace's root the workspace's. */
|
|
312
|
+
usesHere(): Record<string, string>;
|
|
313
|
+
/** Who holds the uses and copies, for messages: the package, or its workspace (one copy for every package in it). */
|
|
314
|
+
get holder(): string;
|
|
315
|
+
/** The file whose "uses" name the versions in use, for messages: the package's manifest ("forest.topo"), or the workspace's file. */
|
|
316
|
+
get usesFileName(): string;
|
|
317
|
+
/** The versions the package uses (its own, or its workspace's), as last read. */
|
|
318
|
+
uses(): Record<string, string>;
|
|
319
|
+
/**
|
|
320
|
+
* What exports and publishing resolve package names with: the published copies, whatever this session follows
|
|
321
|
+
* (following a working folder is for looking: the viewer, renders). The package's own resolver while nothing is
|
|
322
|
+
* followed.
|
|
323
|
+
*/
|
|
324
|
+
publishedResolver(): PackageResolver;
|
|
325
|
+
private publishedAt;
|
|
326
|
+
/**
|
|
327
|
+
* SessionPackages.published: while this session follows working folders, the scope exports cook in, like the root
|
|
328
|
+
* (its assets, graphs and folder) but resolving packages to their published copies; null while nothing is followed
|
|
329
|
+
* (exports cook in the root, as everything else).
|
|
330
|
+
*/
|
|
331
|
+
published(): Scope | null;
|
|
332
|
+
/**
|
|
333
|
+
* What an export of `graph` made while following says (null when the graph names no followed package): the
|
|
334
|
+
* published versions it used, the working folders being for looking only.
|
|
335
|
+
*/
|
|
336
|
+
publishedNote(graph: GraphSpec): string | null;
|
|
337
|
+
/** SessionPackages: why the graphs cannot use packages (a folder in no package, a manifest that is not valid). */
|
|
338
|
+
notice(): string | null;
|
|
339
|
+
/** Load afresh, when next named, the copies that could not load or loaded with a warning (edited by hand). */
|
|
340
|
+
private forgetWarned;
|
|
341
|
+
/** Read the manifest and the lock again (the tools wrote them, or another process did). */
|
|
342
|
+
private reload;
|
|
343
|
+
private diskStamp;
|
|
344
|
+
/**
|
|
345
|
+
* PackageOutput.rootPath: a file as the root names it. Relative to the root's folder (where its relative paths read:
|
|
346
|
+
* the package's, or the folder of a graph file in it) when it lies in the folder of the package's copies (the
|
|
347
|
+
* package's, or its workspace's), as copies do, so exports name no folder of this machine; absolute when it lies
|
|
348
|
+
* elsewhere (a followed working folder in another library).
|
|
349
|
+
*/
|
|
350
|
+
private rootPath;
|
|
351
|
+
/** A path for messages: relative to the package when inside it, else to the workspace that holds its copies. */
|
|
352
|
+
private shown;
|
|
353
|
+
/** The package's manifest file as it is on disk now ('' when it has none it can read). */
|
|
354
|
+
private manifestPath;
|
|
355
|
+
/** The package folder and its manifest; throws when the folder is in no package or its manifest is not valid. */
|
|
356
|
+
package(): {
|
|
357
|
+
dir: string;
|
|
358
|
+
manifest: PackageManifest;
|
|
359
|
+
};
|
|
360
|
+
/**
|
|
361
|
+
* The package itself (when it publishes versions) as its graphs are now, loaded as a package that uses it would: its own
|
|
362
|
+
* scope with its graphs, assets, files and copies, a node type per published output. null for a package that names
|
|
363
|
+
* no name to publish under.
|
|
364
|
+
*/
|
|
365
|
+
ownPackage(published?: boolean): Loaded | PackageIssue | null;
|
|
366
|
+
/** The package in use that needs version `v` of `pkg`: `pkg` itself, or one that uses it. */
|
|
367
|
+
private directUser;
|
|
368
|
+
private resolverOf;
|
|
369
|
+
private resolveIn;
|
|
370
|
+
private namesIn;
|
|
371
|
+
private packageIn;
|
|
372
|
+
private loadCopy;
|
|
373
|
+
private loadCopyNow;
|
|
374
|
+
/**
|
|
375
|
+
* The package's copy of a version, when it holds one that loads: the same files as the version `elsewhere` (whose
|
|
376
|
+
* hash is `expected`) must be there, TopoTopo never picks between two. null when the package has no such copy.
|
|
377
|
+
*/
|
|
378
|
+
private ownCopy;
|
|
379
|
+
/**
|
|
380
|
+
* A version where a library holds it (Context.library), or a copy that such a version holds: read there without
|
|
381
|
+
* copying it, apart from the package's copies, in a scope of its own whose results are keyed by its folder.
|
|
382
|
+
*/
|
|
383
|
+
private loadApart;
|
|
384
|
+
private loadFollowed;
|
|
385
|
+
/**
|
|
386
|
+
* The package itself (it publishes as `pkg`) as its graphs are now: its graphs name their own
|
|
387
|
+
* outputs, which cook from the package's folder, as they would from a working folder the session follows.
|
|
388
|
+
*/
|
|
389
|
+
private loadSelf;
|
|
390
|
+
/** the package itself from its graphs as they are now, its uses following this session's folders or not */
|
|
391
|
+
private buildSelf;
|
|
392
|
+
/**
|
|
393
|
+
* A version's (or working folder's) scope with its graphs, assets and uses, and a node type per output: what each is
|
|
394
|
+
* as the version's record (`info`) says, or in a working folder as its author pinned and tagged it. Its graphs and
|
|
395
|
+
* assets name its own outputs by full name: they resolve to what this builds (Context.self).
|
|
396
|
+
*/
|
|
397
|
+
private build;
|
|
398
|
+
/**
|
|
399
|
+
* What is wrong with the versions `start` reaches (each loaded as it is used, then those they use): copies edited by
|
|
400
|
+
* hand, files they cannot read, versions that do not load. Each once.
|
|
401
|
+
*/
|
|
402
|
+
private problemsOf;
|
|
403
|
+
/**
|
|
404
|
+
* Check every version the package uses (and those they use) as the files are now: what is wrong with them, worked out
|
|
405
|
+
* afresh each time (a copy restored by hand, a lock fixed since, shows no more). Also the package itself and
|
|
406
|
+
* the working folders this session follows. Each problem once.
|
|
407
|
+
*/
|
|
408
|
+
check(): string[];
|
|
409
|
+
/** The copies the package's uses need, checked now: one the lock does not list, one missing, one edited by hand. */
|
|
410
|
+
verifyCopies(): string[];
|
|
411
|
+
/**
|
|
412
|
+
* What keeps a graph from cooking with the package exactly as it is (a build machine's --locked): a package it names
|
|
413
|
+
* that the package does not use, a copy missing or edited by hand. Writes nothing.
|
|
414
|
+
*/
|
|
415
|
+
locked(graph: GraphSpec): string[];
|
|
416
|
+
/** The packages a graph names that the package does not use yet (nor follows, nor is). */
|
|
417
|
+
private freshIn;
|
|
418
|
+
/**
|
|
419
|
+
* SessionPackages: add the packages a graph names that the package does not use yet, once the graph is valid as a
|
|
420
|
+
* dry run checks it (dryRun: those packages at the version first use adds, read where their library holds them). A
|
|
421
|
+
* graph that does not validate adds nothing and writes nothing; why a package could not be added is said when the
|
|
422
|
+
* graph names it.
|
|
423
|
+
*/
|
|
424
|
+
addFor(graph: GraphSpec): string[];
|
|
425
|
+
/**
|
|
426
|
+
* Use a package: its newest version in the place the package finds it (or `version`), copied in with
|
|
427
|
+
* the versions it uses, recorded in the manifest's "uses" and in the lock. For a package in use already, the
|
|
428
|
+
* copies of the version in use (and of those it uses) that went missing are copied again.
|
|
429
|
+
*/
|
|
430
|
+
use(pkg: string, o?: {
|
|
431
|
+
version?: string;
|
|
432
|
+
}): UseResult;
|
|
433
|
+
/**
|
|
434
|
+
* The version of a package that is added (`v`, else the newest in the place the package finds it, TopoTopo's built-in
|
|
435
|
+
* library among the places) and where that place holds it; throws saying why there is none.
|
|
436
|
+
*/
|
|
437
|
+
private versionToAdd;
|
|
438
|
+
/**
|
|
439
|
+
* SessionPackages.dryRun: the packages a graph is checked with where nothing may be written (a dry run, a trial of
|
|
440
|
+
* a person's values). A package it names for the first time is the version its first use would add, the newest in
|
|
441
|
+
* the libraries the package looks in (TopoTopo's built-in library among them), read where that library holds it:
|
|
442
|
+
* nothing is copied, and the manifest and the lock stay as they are. The notes say what build or edit add, and
|
|
443
|
+
* `unavailable` why the others could not be added; `adds` the versions first use adds. Outside a package, and for a
|
|
444
|
+
* graph that names nothing new, it is the package's own resolver. `id`: the id of a scope that resolves with it, the
|
|
445
|
+
* root's own ("") for the package's resolver, else one for the uses it resolves by.
|
|
446
|
+
*/
|
|
447
|
+
dryRun(graph: GraphSpec): {
|
|
448
|
+
resolver: PackageResolver;
|
|
449
|
+
notes: string[];
|
|
450
|
+
adds: {
|
|
451
|
+
package: string;
|
|
452
|
+
version: string;
|
|
453
|
+
}[];
|
|
454
|
+
unavailable: Map<string, string>;
|
|
455
|
+
id: string;
|
|
456
|
+
};
|
|
457
|
+
/** Copy a version as published, and the versions it holds copies of, into the package; record them in the lock. */
|
|
458
|
+
private copyIn;
|
|
459
|
+
/**
|
|
460
|
+
* The places the package finds packages in (librariesFor), in order: its workspace and the shared libraries the
|
|
461
|
+
* workspace lists, or outside a workspace the library it is in and every registered library; and what is wrong with
|
|
462
|
+
* them (the others still count). TopoTopo's built-in library, which comes after them, is not one of them.
|
|
463
|
+
*/
|
|
464
|
+
libraries(): Libraries;
|
|
465
|
+
/** The packages of TopoTopo's built-in library: their versions, and in TopoTopo's repository their working folders. */
|
|
466
|
+
private builtinPackages;
|
|
467
|
+
/** The places the package looks in and the packages in them, TopoTopo's built-in library last (scanPlaces). */
|
|
468
|
+
private scanLibraries;
|
|
469
|
+
/** Who looks, for messages: this package, or the workspace at whose root the folder is. */
|
|
470
|
+
private get looker();
|
|
471
|
+
/**
|
|
472
|
+
* A package where the places the package looks in have it (the first that has it); throws saying where it is not. A
|
|
473
|
+
* name the last scan did not find is looked for once more in a new scan (a package made since).
|
|
474
|
+
*/
|
|
475
|
+
private find;
|
|
476
|
+
/** The packages followed this session, with their working folders. */
|
|
477
|
+
following(): {
|
|
478
|
+
package: string;
|
|
479
|
+
dir: string;
|
|
480
|
+
place: string;
|
|
481
|
+
}[];
|
|
482
|
+
/**
|
|
483
|
+
* Follow a package's working folder for this session, or stop: while it lasts the package resolves to its working
|
|
484
|
+
* folder in the place the package finds it instead of its copy, under a scope that changes whenever its files do. Nothing
|
|
485
|
+
* about it is saved.
|
|
486
|
+
*/
|
|
487
|
+
follow(pkg: string, on?: boolean): string;
|
|
488
|
+
/**
|
|
489
|
+
* Follow, for this session, every package in use whose one working folder the policy accepts (a
|
|
490
|
+
* workspace's "follow my own packages live": the working folders inside the workspace), besides those followed by
|
|
491
|
+
* name; null stops it. Applied again whenever the manifest changes (a package added, removed or updated). Returns
|
|
492
|
+
* the packages it follows.
|
|
493
|
+
*/
|
|
494
|
+
setFollowPolicy(policy: FollowPolicy | null): string[];
|
|
495
|
+
private applyPolicy;
|
|
496
|
+
private restamp;
|
|
497
|
+
/** The package itself, once its graphs named one of its outputs: true when its files changed since. */
|
|
498
|
+
private restampSelf;
|
|
499
|
+
/**
|
|
500
|
+
* SessionPackages: read again what changed on disk: the manifest and the lock, followed working folders, and the
|
|
501
|
+
* package's own graphs when they name its own outputs.
|
|
502
|
+
*/
|
|
503
|
+
refresh(): boolean;
|
|
504
|
+
/**
|
|
505
|
+
* SessionPackages: a stamp of what package names resolve to: the manifest and the lock as they are on disk now,
|
|
506
|
+
* and the files of the followed working folders and of the package itself as refresh() last found them.
|
|
507
|
+
*/
|
|
508
|
+
revision(): string;
|
|
509
|
+
/** Call `onChange` after a followed working folder changed on disk (and refresh() has taken it in). */
|
|
510
|
+
watch(onChange: () => void): void;
|
|
511
|
+
/**
|
|
512
|
+
* What a change in a followed working folder sets off, without waiting for the file watcher (which a test, or a host
|
|
513
|
+
* that knows a folder changed, calls): refresh, and `onChange` when anything changed. Says whether it did.
|
|
514
|
+
*/
|
|
515
|
+
poke(): boolean;
|
|
516
|
+
unwatch(): void;
|
|
517
|
+
private rewatch;
|
|
518
|
+
/**
|
|
519
|
+
* Every package the places the package looks in give (each name from the first place that has it; a name two folders
|
|
520
|
+
* of one place publish is left out, said): its folder (a working folder, or for one of TopoTopo's own the folder of
|
|
521
|
+
* its versions), its versions with their records, and the later places that have it too. What is wrong with a place,
|
|
522
|
+
* an entry of the workspace's "libraries" or a version goes into `problems`.
|
|
523
|
+
*/
|
|
524
|
+
catalog(problems?: string[]): (PackageFolder & {
|
|
525
|
+
versions: VersionInfo[];
|
|
526
|
+
also: string[];
|
|
527
|
+
})[];
|
|
528
|
+
/**
|
|
529
|
+
* For each package in use: the version in use, the small and the big update, every version after it, in the place
|
|
530
|
+
* the package finds it. What is wrong with a place or an entry of the workspace's "libraries" goes into `problems`; a
|
|
531
|
+
* package whose versions could not be looked up says why (error).
|
|
532
|
+
*/
|
|
533
|
+
outdated(problems?: string[]): Outdated[];
|
|
534
|
+
/**
|
|
535
|
+
* What an Update of a package in use goes to: `to`, or else the newest version with the same big number. A
|
|
536
|
+
* big version is a step of its own: it is named. Throws saying why there is none.
|
|
537
|
+
*/
|
|
538
|
+
updateTarget(pkg: string, to?: string): UpdateTarget;
|
|
539
|
+
/**
|
|
540
|
+
* The package resolvers of Update's before/after: the package as its copies cook it now (what this session follows
|
|
541
|
+
* plays no part) and as it would after the update, which reads the new version where its library holds it. Nothing
|
|
542
|
+
* is copied. `key` tells pairs apart, for the ids of scopes made with them; `problems` says what is wrong with the
|
|
543
|
+
* version the update goes to and those it uses, as they load (worked out when asked, for this update only).
|
|
544
|
+
*/
|
|
545
|
+
updateResolvers(t: UpdateTarget): {
|
|
546
|
+
before: PackageResolver;
|
|
547
|
+
after: PackageResolver;
|
|
548
|
+
key: string;
|
|
549
|
+
problems: () => string[];
|
|
550
|
+
};
|
|
551
|
+
/**
|
|
552
|
+
* Apply an update: copy the version in with the versions it uses, name it in "uses" and the lock, and delete the
|
|
553
|
+
* copies nothing uses any more (those the package's uses needed before and need no more).
|
|
554
|
+
*/
|
|
555
|
+
applyUpdate(t: UpdateTarget): UpdateResult;
|
|
556
|
+
/**
|
|
557
|
+
* Delete the copies the uses needed `before` and the package's uses (`uses`, as the manifest now holds them) need no
|
|
558
|
+
* more, with their entries in the lock; the folders of a package and an owner go once they are empty. Says which.
|
|
559
|
+
* When the lock misses a version, every copy stays.
|
|
560
|
+
*/
|
|
561
|
+
private dropUnused;
|
|
562
|
+
/**
|
|
563
|
+
* Remove a package in use: drop it from "uses", and delete its copy and the copies it needed that nothing
|
|
564
|
+
* else uses, with their entries in the lock. `places`: where the package's graphs still name it (file and node); while
|
|
565
|
+
* one does, it is refused, listing them.
|
|
566
|
+
*/
|
|
567
|
+
remove(pkg: string, places: string[]): {
|
|
568
|
+
deleted: string[];
|
|
569
|
+
text: string;
|
|
570
|
+
};
|
|
571
|
+
/**
|
|
572
|
+
* PackageResolver.offered: the outputs of TopoTopo's own packages it does not use, at the newest version its
|
|
573
|
+
* built-in library holds, read there (nothing is copied): the catalog and help list them, and a graph's first use adds
|
|
574
|
+
* the package. Outside a package as well, where naming one is an error that says how to make the folder a package.
|
|
575
|
+
*/
|
|
576
|
+
private offered;
|
|
577
|
+
/** A published version where its library holds it, read there apart from the package's copies (nothing is copied). */
|
|
578
|
+
private readApart;
|
|
579
|
+
/**
|
|
580
|
+
* The node type of a package output the package does not use (yet), at the newest version in the libraries it looks in,
|
|
581
|
+
* read where its library holds it, nothing copied: what help and the catalog say about an output search found. null
|
|
582
|
+
* when no library it looks in has it (and for a package it uses: those resolve as they cook).
|
|
583
|
+
*/
|
|
584
|
+
describe(name: string): NodeDef | null;
|
|
585
|
+
/** The version record of a copy the package holds, null when it is missing. */
|
|
586
|
+
copyInfo(pkg: string, v: string): VersionInfo | null;
|
|
587
|
+
/** The lock's entries for the versions the package uses, and those they use. */
|
|
588
|
+
lockEntries(): {
|
|
589
|
+
package: string;
|
|
590
|
+
version: string;
|
|
591
|
+
entry: LockEntry | null;
|
|
592
|
+
direct: boolean;
|
|
593
|
+
}[];
|
|
594
|
+
}
|
|
595
|
+
/** The records of a package's published versions (its versions/ folder), oldest first; unreadable ones are left out. */
|
|
596
|
+
export declare function publishedVersions(dir: string, pkg: string): VersionInfo[];
|
|
597
|
+
/** The records of the versions TopoTopo's built-in library holds of a package, oldest first (none of a package not TopoTopo's). */
|
|
598
|
+
export declare function builtinVersions(pkg: string, builtin?: string): VersionInfo[];
|
|
599
|
+
/** A package of TopoTopo's built-in library, as the web app and the viewer list it. */
|
|
600
|
+
export interface BuiltinPackage {
|
|
601
|
+
/** "street": its folder, and its id in the built-in library */
|
|
602
|
+
id: string;
|
|
603
|
+
/** "topotopo/street" */
|
|
604
|
+
name: string;
|
|
605
|
+
dir: string;
|
|
606
|
+
/** where its manifest and graphs are read: its working folder (in TopoTopo's repository), else its newest version */
|
|
607
|
+
from: string;
|
|
608
|
+
manifest: PackageManifest;
|
|
609
|
+
/** every version, oldest first */
|
|
610
|
+
versions: VersionInfo[];
|
|
611
|
+
}
|
|
612
|
+
/** The packages of TopoTopo's built-in library, by id; one that cannot be read is left out. */
|
|
613
|
+
export declare function builtinLibrary(builtin?: string): BuiltinPackage[];
|
|
614
|
+
/** The record of a version a package holds a copy of (packages/<owner>/<name>/<version>/), null when it holds none. */
|
|
615
|
+
export declare function copyRecord(dir: string, pkg: string, v: string): VersionInfo | null;
|
|
616
|
+
/**
|
|
617
|
+
* The packages used by the package a folder belongs to (the folder itself or the nearest one above with a .topo file),
|
|
618
|
+
* attached to the engine's root scope, and the working folders to follow this session. `builtin`: the folder of
|
|
619
|
+
* TopoTopo's built-in library (default: the one TopoTopo ships).
|
|
620
|
+
*/
|
|
621
|
+
export declare function openPackages(engine: Engine, start: string, opts?: {
|
|
622
|
+
follow?: string[];
|
|
623
|
+
builtin?: string;
|
|
624
|
+
}): PackageUses;
|
|
625
|
+
/**
|
|
626
|
+
* A package's assets and graphs in a scope (default: the engine's root) as a session has them, read without writing
|
|
627
|
+
* anything (a session makes its folders): for a command that cooks the package's graphs and leaves the package as it
|
|
628
|
+
* is, or for the viewer of a graph file, whose session folder is not the package. Says what could not be read.
|
|
629
|
+
*/
|
|
630
|
+
export declare function loadPackage(engine: Engine, dir: string, scope?: Scope): string[];
|
|
631
|
+
/**
|
|
632
|
+
* What changed between two versions' interfaces: what makes a big version (an output, param or input that goes away
|
|
633
|
+
* or means something else: removed or renamed, another type, a narrower range, a removed option, an input moved, an
|
|
634
|
+
* output of another kind), and the rest (added outputs, params, options and inputs, wider ranges, changed defaults,
|
|
635
|
+
* labels, tags and descriptions).
|
|
636
|
+
*/
|
|
637
|
+
export declare function compareInterfaces(prev: Pick<VersionInfo, 'outputs' | 'default'>, next: Pick<VersionInfo, 'outputs' | 'default'>): {
|
|
638
|
+
big: string[];
|
|
639
|
+
small: string[];
|
|
640
|
+
};
|
|
641
|
+
export interface PublishOptions {
|
|
642
|
+
/** the author's one-line note (required) */
|
|
643
|
+
note?: string;
|
|
644
|
+
/** mark the version big though the rule finds nothing that makes it big */
|
|
645
|
+
big?: boolean;
|
|
646
|
+
/**
|
|
647
|
+
* publish one of TopoTopo's own packages: a folder <name> of TopoTopo's built-in library (PackageUses.builtin),
|
|
648
|
+
* the package topotopo/<name>. TopoTopo's repository publishes its own packages this way; the tools never do, and the
|
|
649
|
+
* owner "topotopo" is refused for every other package.
|
|
650
|
+
*/
|
|
651
|
+
builtin?: boolean;
|
|
652
|
+
/**
|
|
653
|
+
* a dry run: every check, every output cooked, the number the version would get, its changes, blocks and warnings,
|
|
654
|
+
* and nothing written (the note may still be missing: publishing needs it)
|
|
655
|
+
*/
|
|
656
|
+
dryRun?: boolean;
|
|
657
|
+
}
|
|
658
|
+
export interface PublishResult {
|
|
659
|
+
ok: boolean;
|
|
660
|
+
/** a dry run (PublishOptions.dryRun): ok says it would publish, and nothing was written */
|
|
661
|
+
dryRun: boolean;
|
|
662
|
+
package: string;
|
|
663
|
+
/** the version written, or that a dry run would write (none while something blocks) */
|
|
664
|
+
version?: string;
|
|
665
|
+
/** the version before it */
|
|
666
|
+
previous?: string;
|
|
667
|
+
note: string;
|
|
668
|
+
/** why the number is big: the rule's findings, and the author's mark */
|
|
669
|
+
bigBecause: string[];
|
|
670
|
+
/** the other changes since the previous version */
|
|
671
|
+
changes: string[];
|
|
672
|
+
/** what kept it from being published */
|
|
673
|
+
blocks: string[];
|
|
674
|
+
warnings: string[];
|
|
675
|
+
/** the records of the outputs, as version.json holds them (each one's kind, tags and description) */
|
|
676
|
+
outputs?: Record<string, OutputInfo>;
|
|
677
|
+
default?: OutputInfo;
|
|
678
|
+
dir?: string;
|
|
679
|
+
hash?: string;
|
|
680
|
+
files?: number;
|
|
681
|
+
bytes?: number;
|
|
682
|
+
}
|
|
683
|
+
/**
|
|
684
|
+
* Publish the package as the next version of its package, in steps, each of which stops publishing (and a dry run)
|
|
685
|
+
* when it blocks, so that a problem is said once, at its cause, and a version number only for what would publish:
|
|
686
|
+
* 1. what the package declares: its name, the note, its outputs (names, kinds, tags, descriptions, clashes, the
|
|
687
|
+
* default output), outputs that name each other in a loop, files it cannot read, its copies (none missing or
|
|
688
|
+
* edited by hand), a package the session follows, versions/ of another package name;
|
|
689
|
+
* 2. every published output cooked as a package that uses the package cooks it, through the package's own scope
|
|
690
|
+
* (its graphs, assets, files and copies, as the version will hold them): an output that does not cook, cooks to
|
|
691
|
+
* nothing or to another kind than its author pinned blocks, and the kind it cooks to is recorded;
|
|
692
|
+
* 3. its files: nothing changed since the previous version blocks;
|
|
693
|
+
* 4. the number, by comparing with the previous version (and the author's `big`), its changes and the warnings: an
|
|
694
|
+
* output without tags or a description, one whose graph has vars it does not read (they are not its params), an
|
|
695
|
+
* output of another kind than before, files it reads that the version does not hold, the size;
|
|
696
|
+
* 5. versions/<big>.<small>/ written through a .part folder, never over one that is there.
|
|
697
|
+
* A dry run (o.dryRun) goes through every step and writes nothing.
|
|
698
|
+
*/
|
|
699
|
+
export declare function publishPackage(pk: PackageUses, o: PublishOptions): Promise<PublishResult>;
|
|
700
|
+
/**
|
|
701
|
+
* An output's kind and tags, as every listing says them: "mesh [conifer, low-poly]", "instances" without tags. A kind
|
|
702
|
+
* not known (a working folder's output that pins none) is "kind not pinned".
|
|
703
|
+
*/
|
|
704
|
+
export declare const kindTagsText: (o: {
|
|
705
|
+
kind?: Kind;
|
|
706
|
+
tags?: string[];
|
|
707
|
+
maps?: OutputInfo['maps'];
|
|
708
|
+
}) => string;
|
|
709
|
+
/** A material output's maps in a few words: "maps baseColor 2048, normal 4096" (with the material when it has several). */
|
|
710
|
+
export declare function mapsText(maps: NonNullable<OutputInfo['maps']>): string;
|
|
711
|
+
/** The outputs of version `b` whose kind differs from version `a`'s: 'output "pine": mesh → scene'. */
|
|
712
|
+
export declare function kindChanges(a: Pick<VersionInfo, 'outputs' | 'default'>, b: Pick<VersionInfo, 'outputs' | 'default'>): string[];
|
|
713
|
+
/** A publish result as the CLI and the workspace tool say it; a dry run says what publishing would do. */
|
|
714
|
+
export declare function publishText(r: PublishResult): string;
|
|
715
|
+
/**
|
|
716
|
+
* The packages a package uses and can use, as `topotopo packages` and the workspace tool list them, one line each: those
|
|
717
|
+
* it uses (version, outputs, up to date or the newer version that is out), then the others the places it looks in give,
|
|
718
|
+
* each with its place (and the later places that have it too, not used); the places; what could not be checked. At a
|
|
719
|
+
* workspace's root, in no package, the same for the workspace. `packages owner/name` (packageText) shows one with its
|
|
720
|
+
* outputs.
|
|
721
|
+
*/
|
|
722
|
+
export declare function packagesText(pk: PackageUses, mcp?: boolean): string;
|
|
723
|
+
/**
|
|
724
|
+
* One package in the places this package looks in (`topotopo packages owner/name`): where it is, the version the
|
|
725
|
+
* package uses, its versions with their notes, and the outputs of the version in use (else of the newest) with their
|
|
726
|
+
* kinds, tags, params and inputs, by the node type a graph names them with. At a workspace's root, for the workspace.
|
|
727
|
+
*/
|
|
728
|
+
export declare function packageText(pk: PackageUses, pkg: string, mcp?: boolean): string;
|
|
729
|
+
export interface SearchQuery {
|
|
730
|
+
/** words, each of which must start a word of the output's full name, label, description or tags, or of its package's title or package tags */
|
|
731
|
+
query?: string;
|
|
732
|
+
/** only outputs of this kind */
|
|
733
|
+
kind?: string;
|
|
734
|
+
/** only outputs with this tag */
|
|
735
|
+
tag?: string;
|
|
736
|
+
}
|
|
737
|
+
/** An output a search found, in the newest version of its package that a place holds. */
|
|
738
|
+
export interface SearchHit {
|
|
739
|
+
/** the node type a graph names it with: "owner/name/output", or "owner/name" for a default output that is no named output */
|
|
740
|
+
type: string;
|
|
741
|
+
/** "owner/name": it is the package's default output as well */
|
|
742
|
+
alias?: string;
|
|
743
|
+
package: string;
|
|
744
|
+
version: string;
|
|
745
|
+
label?: string;
|
|
746
|
+
kind: Kind;
|
|
747
|
+
tags: string[];
|
|
748
|
+
description?: string;
|
|
749
|
+
/** the version of the package the open package (or workspace) uses, when it uses it */
|
|
750
|
+
used?: string;
|
|
751
|
+
/** the open package is the package: its graphs name its outputs */
|
|
752
|
+
self?: boolean;
|
|
753
|
+
/** later places that have the package too, which are not used */
|
|
754
|
+
also?: string[];
|
|
755
|
+
}
|
|
756
|
+
/** A place a search looked in, and how the open package stands to it. */
|
|
757
|
+
export interface SearchLibrary {
|
|
758
|
+
/** the workspace's or library's name, "topotopo" for TopoTopo's built-in library */
|
|
759
|
+
name: string;
|
|
760
|
+
/** as people read it: the workspace "x", library "props", TopoTopo's built-in library */
|
|
761
|
+
place: string;
|
|
762
|
+
root: string;
|
|
763
|
+
/**
|
|
764
|
+
* "self": the workspace the package is in, or the library it is in; "listed": a shared library the workspace lists;
|
|
765
|
+
* "registered": outside a workspace, a registered library (every one counts); "builtin": TopoTopo's built-in library;
|
|
766
|
+
* "unlisted": in a workspace, a registered library the workspace does not list (its packages are not used)
|
|
767
|
+
*/
|
|
768
|
+
standing: 'self' | 'listed' | 'registered' | 'builtin' | 'unlisted';
|
|
769
|
+
hits: SearchHit[];
|
|
770
|
+
}
|
|
771
|
+
export interface SearchResult {
|
|
772
|
+
query: SearchQuery;
|
|
773
|
+
/** the open package ("package forest"), null when the folder is in no package */
|
|
774
|
+
package: string | null;
|
|
775
|
+
/** the workspace around the folder, by name, or null */
|
|
776
|
+
workspace: string | null;
|
|
777
|
+
/** its folder, or null */
|
|
778
|
+
workspaceDir: string | null;
|
|
779
|
+
/** the places looked in, in the order a lookup takes them, TopoTopo's built-in library after them; then, in a workspace, the registered libraries it does not list */
|
|
780
|
+
libraries: SearchLibrary[];
|
|
781
|
+
problems: string[];
|
|
782
|
+
}
|
|
783
|
+
/**
|
|
784
|
+
* Search the outputs of the newest version of every package the places a folder's package looks in give (its
|
|
785
|
+
* workspace and the shared libraries the workspace lists, or outside a workspace the library it is in and every
|
|
786
|
+
* registered library; then TopoTopo's built-in library), by words, kind and tag; inside a workspace also the registered
|
|
787
|
+
* libraries it does not list, said as such (the person lists one: the tools never do). A name later places have too is
|
|
788
|
+
* found in the first, which says so. `start`: the open package's folder, or any folder (a workspace's root uses the
|
|
789
|
+
* workspace's lookup). Throws for a kind that is none.
|
|
790
|
+
*/
|
|
791
|
+
export declare function searchPackages(start: string, q: SearchQuery, opts?: {
|
|
792
|
+
builtin?: string;
|
|
793
|
+
}): SearchResult;
|
|
794
|
+
/** A search as the CLI (or, `mcp`, the workspace tool) says it: the hits by place, and whether the package can use them. */
|
|
795
|
+
export declare function searchText(r: SearchResult, mcp?: boolean): string;
|
|
796
|
+
export {};
|