animader-cli 0.1.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/adapters/build-node.mjs +7 -3
- package/adapters/export-node.mjs +4 -2
- package/adapters/generations.mjs +1 -29
- package/adapters/node-fs.mjs +12 -0
- package/adapters/snapshot.mjs +29 -15
- package/lib/editor-resources.mjs +422 -0
- package/lib/new.mjs +11 -0
- package/lib/rmtree.mjs +49 -0
- package/package.json +5 -4
- package/resources/editor/.animader/schemas/bridge.sjon +79 -0
- package/resources/editor/.animader/schemas/it.sjon +836 -0
- package/resources/editor/.animader/schemas/machine.sjon +305 -0
- package/resources/editor/.animader/schemas/metadata.json +112 -0
- package/resources/editor/.animader/schemas/midi.sjon +373 -0
- package/resources/editor/.animader/schemas/pacer.sjon +384 -0
- package/resources/editor/.animader/schemas/piece.sjon +176 -0
- package/resources/editor/.animader/schemas/pngine.sjon +2626 -0
- package/resources/editor/.animader/schemas/session.sjon +311 -0
- package/resources/editor/.animader/schemas/tempura.sjon +519 -0
- package/resources/editor/.animader/schemas/world.sjon +279 -0
- package/resources/editor/sjon-lsp.sjon +16 -0
- package/starters/circle/README.md +20 -0
- package/starters/ember/README.md +48 -0
- package/toolchain/manifest.json +13 -13
package/lib/rmtree.mjs
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
// The one retrying recursive tree removal: the disposal guard. A recursive
|
|
2
|
+
// removal can answer a transient code when the directory is observed while
|
|
3
|
+
// it changes underneath (an entry landing between the walk and the rmdir, a
|
|
4
|
+
// tree swapped mid-walk); the fix for those is upstream — every tree has
|
|
5
|
+
// one owner, and writers are quiesced before disposal — so this retry is
|
|
6
|
+
// only the last guard, never the mechanism. The codes, the attempt count
|
|
7
|
+
// and the backoff are the contract; do not lengthen them here.
|
|
8
|
+
//
|
|
9
|
+
// This module is portable: no `node:` import, no process state, no DOM.
|
|
10
|
+
// The removal and the delay are injected ports; the Node binding every
|
|
11
|
+
// caller uses lives in adapters/node-fs.mjs.
|
|
12
|
+
|
|
13
|
+
/** The transient codes a recursive removal answers while it races an observer. */
|
|
14
|
+
export const REMOVAL_RETRY_CODES = Object.freeze(new Set(['ENOTEMPTY', 'EBUSY', 'ENOTDIR']));
|
|
15
|
+
/** A few short attempts: enough to clear a transient observer, never a leak. */
|
|
16
|
+
export const REMOVAL_ATTEMPTS = 4;
|
|
17
|
+
export const REMOVAL_BACKOFF_MS = 25;
|
|
18
|
+
|
|
19
|
+
const defaultDelay = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Remove one tree, retrying the transient codes a short fixed number of
|
|
23
|
+
* times and rejecting with the last observed error when they persist.
|
|
24
|
+
*
|
|
25
|
+
* @param {string} path the tree to remove
|
|
26
|
+
* @param {Object} ports
|
|
27
|
+
* @param {(path: string) => Promise<void>} ports.remove the recursive
|
|
28
|
+
* removal port (Node binds `fsp.rm(path, { recursive: true, force: true })`)
|
|
29
|
+
* @param {(ms: number) => Promise<void>} [ports.delay] the backoff port
|
|
30
|
+
*/
|
|
31
|
+
export async function removeTree(path, { remove, delay = defaultDelay }) {
|
|
32
|
+
if (typeof remove !== 'function') {
|
|
33
|
+
throw new TypeError('removeTree needs an injected remove(path) port');
|
|
34
|
+
}
|
|
35
|
+
let lastError = null;
|
|
36
|
+
for (let attempt = 1; attempt <= REMOVAL_ATTEMPTS; attempt += 1) {
|
|
37
|
+
try {
|
|
38
|
+
await remove(path);
|
|
39
|
+
return;
|
|
40
|
+
} catch (cause) {
|
|
41
|
+
if (!REMOVAL_RETRY_CODES.has(cause?.code)) throw cause;
|
|
42
|
+
lastError = cause;
|
|
43
|
+
if (attempt < REMOVAL_ATTEMPTS) {
|
|
44
|
+
await delay(REMOVAL_BACKOFF_MS * attempt);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
throw lastError;
|
|
49
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "animader-cli",
|
|
3
|
-
"version": "0.1
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "The animader command line: project creation, dev server, build, standalone export and host/project doctor checks",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -11,14 +11,14 @@
|
|
|
11
11
|
},
|
|
12
12
|
"license": "CC0-1.0",
|
|
13
13
|
"dependencies": {
|
|
14
|
-
"animader": "0.1
|
|
14
|
+
"animader": "0.2.1",
|
|
15
15
|
"esbuild": "0.24.2",
|
|
16
16
|
"@mr_hugo/pacer": "0.2.0",
|
|
17
|
-
"pngine": "4.0
|
|
17
|
+
"pngine": "4.1.0"
|
|
18
18
|
},
|
|
19
19
|
"optionalDependencies": {
|
|
20
20
|
"@mr_hugo/pacer-darwin-arm64": "0.2.0",
|
|
21
|
-
"@pngine/darwin-arm64": "4.0
|
|
21
|
+
"@pngine/darwin-arm64": "4.1.0"
|
|
22
22
|
},
|
|
23
23
|
"files": [
|
|
24
24
|
"bin",
|
|
@@ -28,6 +28,7 @@
|
|
|
28
28
|
"player",
|
|
29
29
|
"hello",
|
|
30
30
|
"starters",
|
|
31
|
+
"resources",
|
|
31
32
|
"toolchain",
|
|
32
33
|
"LICENSE"
|
|
33
34
|
],
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
; animader bridge schema - the machine's public surface (plan 03).
|
|
2
|
+
;
|
|
3
|
+
; Two core forms live in the machine document (the machine document is
|
|
4
|
+
; validated against the aggregate of `machine.sjon` and this manifest,
|
|
5
|
+
; because the machine's public surface belongs beside the machine):
|
|
6
|
+
;
|
|
7
|
+
; (output :name phase :arity 1) what the machine exposes
|
|
8
|
+
; (route :output phase :target "particles.phase" :registry 0)
|
|
9
|
+
; optional: where it goes
|
|
10
|
+
;
|
|
11
|
+
; Without a route an output joins the host's registries by its own name;
|
|
12
|
+
; with one it joins by `:target` in `:registry`. Every form is closed
|
|
13
|
+
; (the default), so each key set is exact and an extra key is SJON's own
|
|
14
|
+
; `unknown_key` diagnostic.
|
|
15
|
+
;
|
|
16
|
+
; A route's `:output` is a cross-reference to an `(output ...)` in the
|
|
17
|
+
; same document: SJON owns the unresolved-name diagnostic (`not_cross_ref`
|
|
18
|
+
; with the candidate span), so the bridge never re-checks it. Whether the
|
|
19
|
+
; named target exists in the host's join list is the bridge's own
|
|
20
|
+
; business: `Bridge.load` reports `output_unrouted`/`output_arity_mismatch`,
|
|
21
|
+
; and a registry index at or above the host's count is `registry_unknown`.
|
|
22
|
+
; The registry index is bounded here only by the wire (u8); the host's
|
|
23
|
+
; count is what the bridge checks, so a host with two registries rejects a
|
|
24
|
+
; route to registry 2 even though the house's own hosts expose three
|
|
25
|
+
; (0 pngine uniforms, 1 audio params, 2 pacer control pins).
|
|
26
|
+
;
|
|
27
|
+
; `Bridge.Target`/`Output`/`Route` mirror these forms as plain structs;
|
|
28
|
+
; `Bridge.load(gpa, targets, outputs, routes)` joins them with pacer's
|
|
29
|
+
; `'PACT'` list, and `Bridge.encode` writes the frame's `'PACW'` bytes.
|
|
30
|
+
(plugin :name animader
|
|
31
|
+
|
|
32
|
+
; ---- value kinds ----
|
|
33
|
+
|
|
34
|
+
(value-kind :name output-arity
|
|
35
|
+
:description "Value lanes an output carries: 1..4, pacer's Entry ncomp range."
|
|
36
|
+
:underlying number
|
|
37
|
+
:numeric (numeric-bounds :min 1 :max 4 :integer true)
|
|
38
|
+
:unit (unit-shape :reject true))
|
|
39
|
+
|
|
40
|
+
; A host registry index. Pacer declares the same concept by the same name
|
|
41
|
+
; (`registry-index`, `pacer/schema/pacer.sjon`): a bare name two preloaded
|
|
42
|
+
; plugins claim is `ambiguous_element_kind` in every aggregate that holds
|
|
43
|
+
; both, while this manifest is preloaded on its own (machine + bridge, no
|
|
44
|
+
; pacer), so the kind must stay here under a name no loaded sibling declares.
|
|
45
|
+
; The reference stays bare on purpose: a qualified kind reference consults
|
|
46
|
+
; only the FIRST plugin bearing that namespace (`SJON/src/Schema.zig`,
|
|
47
|
+
; `lookupGeneric`), and the three animader manifests share the plugin name
|
|
48
|
+
; `animader`, so `animader/bridge-registry-index` would resolve against
|
|
49
|
+
; machine.sjon, which declares no such kind. Ruled 2026-10-06, the eighth
|
|
50
|
+
; ruling (expansible-player `docs/README.md`).
|
|
51
|
+
(value-kind :name bridge-registry-index
|
|
52
|
+
:description "Host registry index: 0 pngine uniforms, 1 audio params, 2 pacer control pins. The wire carries it as one u8; the host's own count is checked by Bridge.load, not here."
|
|
53
|
+
:underlying number
|
|
54
|
+
:numeric (numeric-bounds :min 0 :max 255 :integer true)
|
|
55
|
+
:unit (unit-shape :reject true))
|
|
56
|
+
|
|
57
|
+
(value-kind :name output-name
|
|
58
|
+
:description "Reference to an (output :name ...) declared in the same document."
|
|
59
|
+
:underlying symbol
|
|
60
|
+
:cross-ref (cross-ref :target output))
|
|
61
|
+
|
|
62
|
+
; ---- the bridge forms ----
|
|
63
|
+
|
|
64
|
+
(form :name output
|
|
65
|
+
:description "A named numeric value the machine computes; required for every value the machine exposes."
|
|
66
|
+
(key :name name :type symbol
|
|
67
|
+
:description "Output name; the join key when no route exists.")
|
|
68
|
+
(key :name arity :type output-arity
|
|
69
|
+
:description "Number of value lanes this output carries."))
|
|
70
|
+
|
|
71
|
+
(form :name route
|
|
72
|
+
:description "Optional redirect: the output joins :target in :registry instead of by its own name. At most one route per output (route_duplicate)."
|
|
73
|
+
(key :name output :type output-name
|
|
74
|
+
:description "The output this route redirects.")
|
|
75
|
+
(key :name target :type string
|
|
76
|
+
:description "Host target name in the registry join list.")
|
|
77
|
+
(key :name registry :type bridge-registry-index :optional true :default 0
|
|
78
|
+
:description "Host registry index the target lives in; defaults to 0, the visual bus."))
|
|
79
|
+
)
|