@wildshard/sdk 0.2.12 → 0.3.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/GUIDE.md +16 -11
- package/bin/wildshard.mjs +2 -1
- package/docs/api/EXPORT-TIERS.md +12 -3
- package/lint/export-tiers.json +9 -0
- package/lint/tile-bake-debt.json +26 -1
- package/package.json +17 -5
- package/scripts/build-shardfiles.mjs +7 -2
- package/scripts/preparation-preview.mjs +6 -1
- package/scripts/prepare-product.mjs +2 -2
- package/scripts/scratch-sweep.mjs +180 -0
- package/scripts/wildshard.mjs +1 -1
- package/skills/wildshard-mockup-to-model/SKILL.md +5 -3
- package/skills/wildshard-upgrade/SKILL.md +4 -4
- package/src/cli/help.ts +9 -5
- package/src/cli/upload/validate.ts +7 -5
- package/src/sharddev/assets.ts +1 -1
- package/src/sharddev/bake/compactGlb.ts +1 -1
- package/src/sharddev/bake/glbCompression.ts +1 -1
- package/src/sharddev/bake/gltfSource.ts +1 -1
- package/src/sharddev/bake/placeholders.ts +1 -1
- package/src/sharddev/bake/terrain.ts +1 -1
- package/src/sharddev/blobBytes.ts +1 -1
- package/src/sharddev/blobs.ts +2 -2
- package/src/sharddev/cli.ts +17 -4
- package/src/sharddev/formatJsonSchema.ts +1 -1
- package/src/sharddev/materialGraphFiles.ts +1 -1
- package/src/sharddev/newProject.ts +18 -10
- package/src/sharddev/outputProduct.ts +2 -2
- package/src/sharddev/productOutput.ts +2 -2
- package/src/sharddev/project.ts +1 -1
- package/src/sharddev/projectMap.ts +1 -1
- package/src/sharddev/refusals.ts +4 -2
- package/src/sharddev/reportCard.ts +1 -1
- package/src/sharddev/scene/author.ts +79 -0
- package/src/sharddev/scene/canvas.ts +213 -0
- package/src/sharddev/scene/description.ts +170 -0
- package/src/sharddev/scene/hash.ts +23 -0
- package/src/sharddev/scene/lower.ts +226 -0
- package/src/sharddev/scene/shard.ts +38 -0
- package/src/sharddev/scene/shardfile.ts +328 -0
- package/src/sharddev/threeGate.mjs +14 -0
- package/src/sharddev/threePin.mjs +40 -0
- package/src/sharddev/watch/page.ts +197 -0
- package/src/sharddev/watch/pageEntry.ts +23 -0
- package/src/sharddev/watch/proof.mjs +92 -0
- package/src/sharddev/watch/protocol.ts +108 -0
- package/src/sharddev/watch/socket.ts +57 -0
- package/src/sharddev/watch/watch.ts +209 -0
- package/src/shards/_template/card/landscape.jpg +0 -0
- package/src/shards/_template/card/portrait.jpg +0 -0
- package/src/shards/_template/card/thumb.jpg +0 -0
- package/src/shards/_template/data/card.json +21 -14
- package/src/shards/_template/data/clientScripts.json +27 -27
- package/src/shards/_template/data/creatures.json +5 -5
- package/src/shards/_template/data/encounters.json +2 -2
- package/src/shards/_template/data/layout.json +56 -25
- package/src/shards/_template/data/look.json +450 -220
- package/src/shards/_template/data/quests.json +2 -2
- package/src/shards/_template/data/water.json +131 -4
- package/src/shards/_template/generators/landscape.ts +19 -7
- package/src/shards/_template/generators/product.ts +7 -5
- package/src/shards/_template/generators/templatePropsSource.ts +3 -1
- package/src/shards/_template/generators/terrain.ts +28 -4
- package/src/shards/_template/generators/weather.ts +128 -0
- package/src/shards/_template/generators/world.ts +274 -98
- package/src/shards/_template/hero.json +6 -6
- package/src/shards/_template/manifest.json +21 -14
- package/src/shards/authoring-slice/generators/shard.ts +6 -0
- package/src/shards/authoring-slice/generators/textures.ts +173 -0
- package/src/shards/authoring-slice/generators/world.ts +415 -0
- package/src/shards/authoring-slice/shard.config.ts +7 -0
- package/src/shards/_template/assets/f2db05998615ce1cb79ea96be32c168842eb6a2b34ec01feb86d36404603ee54 +0 -0
package/GUIDE.md
CHANGED
|
@@ -54,9 +54,10 @@ with `rule`, `fix` and `guide`) for agents and scripts.
|
|
|
54
54
|
|
|
55
55
|
| Verb | What it is for |
|
|
56
56
|
|---|---|
|
|
57
|
-
| `wildshard new <dir> [slug] [--template sdk
|
|
57
|
+
| `wildshard new <dir> [slug] [--template sdk] [--empty]` | Start a shard repo in a folder that does not exist yet, its shard source at `src/`. The slug is the folder's name unless you give one. It copies the reference world (`--template sdk`, the only template); any other template refuses before writing, and `--template blender` is retired (below). `--empty` writes a bare shard source instead of the reference world |
|
|
58
58
|
| `wildshard update [dir] [--pins[=<version>]]` | Rewrite this guide and the four `wildshard` skills from the installed sdk. `--pins` first moves the repo to a newer sdk release (npm's latest, or `--pins=<version>`), installs it and applies its codemods, and runs `check` after (section 7) |
|
|
59
59
|
| `wildshard dev <source>` | Serve the shard source on localhost and rebuild on every save (section 4). The first run fetches engine's dev client once ("Walking your shard") |
|
|
60
|
+
| `wildshard watch <source>` | For a shard written as a three.js scene (`@wildshard/sdk/scene/shard`): serve it once, then swap each edited part into the running page in about a second, no reload. A look, ground or spawn edit still reloads |
|
|
60
61
|
| `wildshard check <source> [folder] [--json]` | The loop's check: lint, build, validate, prove, report card, verdict |
|
|
61
62
|
| `wildshard hero <source> --base <url>` | Capture the hero from a served build and stamp `hero.json`. `--stamp-existing` marks the images already there as current: only when you have looked at them and they show the current world |
|
|
62
63
|
| `wildshard upload <file> --channel staging\|prod` | Send a prepared shard file to the API (section 5) |
|
|
@@ -206,14 +207,11 @@ source at `src/`, or at the one `src/shards/<slug>/` a repo holds; in a repo wit
|
|
|
206
207
|
into the repo's `public/shardfiles/`; a `src/shards/<slug>/` source into its own folder's. SA24 moves the existing
|
|
207
208
|
single-shard repos to `src/`.
|
|
208
209
|
|
|
209
|
-
**
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
the whole folder, then writes the built folder and shard file as any build does. A changed blob is a new file under
|
|
215
|
-
its new hash, with every row that names it changed to match. `package.json` lists only `@wildshard/sdk` (the CLI) and
|
|
216
|
-
shard-format, as dev dependencies; there is no `tsconfig.json`.
|
|
210
|
+
**Blender makes models, not shards (J341).** A shard is TypeScript three.js scene source: `shard.config.ts`, its
|
|
211
|
+
`generators/` and `data/`. Blender makes the `.glb` models that code loads; export them into `assets/`. The old
|
|
212
|
+
hand-written template (`new --template blender`, a shard file folder held by hand) is retired, and `new` refuses it.
|
|
213
|
+
A repo started that way before still checks and uploads: `wildshard check .` packs and validates its `src/` folder as
|
|
214
|
+
it always did.
|
|
217
215
|
|
|
218
216
|
**What a shard may declare.** The runtime contract lists every section, `client/plan` kind, named file, script rule,
|
|
219
217
|
budget and limit a shard file may carry, and what validation refuses:
|
|
@@ -320,6 +318,12 @@ the rule is chosen by that code, and each heading below that one names lists its
|
|
|
320
318
|
|
|
321
319
|
### Any command
|
|
322
320
|
|
|
321
|
+
#### three-version
|
|
322
|
+
|
|
323
|
+
`three` is a peer of the sdk, pinned exact (J317): every `wildshard` run first checks that the `three` the sdk would
|
|
324
|
+
import is the version it pins, and refuses naming both before anything else runs. Install that version:
|
|
325
|
+
`pnpm add three@<version> --save-exact`. `wildshard --version` prints the chain the sdk pins, `three` included.
|
|
326
|
+
|
|
323
327
|
#### usage
|
|
324
328
|
|
|
325
329
|
A verb got arguments or flags it does not take. `wildshard <verb> --help` prints what it takes.
|
|
@@ -333,8 +337,9 @@ an existing folder.
|
|
|
333
337
|
|
|
334
338
|
#### new-template
|
|
335
339
|
|
|
336
|
-
`--template` names `sdk` (the reference world, the default
|
|
337
|
-
|
|
340
|
+
`--template` names `sdk` (the reference world, the default and only template). Any other name refuses before `new`
|
|
341
|
+
writes anything. `--template blender` is retired (J341): a shard is TypeScript three.js scene source, and Blender
|
|
342
|
+
makes the `.glb` models it loads (section 2). Leave the flag out or pass `--template sdk`.
|
|
338
343
|
|
|
339
344
|
#### new-refused
|
|
340
345
|
|
package/bin/wildshard.mjs
CHANGED
|
@@ -2,12 +2,13 @@
|
|
|
2
2
|
// `wildshard`: the author commands run through scripts/wildshard.mjs, which bundles the CLI once; pack, upload and serve are
|
|
3
3
|
// this repo's own, and so is `build <folder>` (SA3): a built shard file folder needs no author bundle, only its shard file.
|
|
4
4
|
// Node strips no types under node_modules, so J82's hook goes first and every import below it is dynamic.
|
|
5
|
+
import '../src/sharddev/threeGate.mjs';
|
|
5
6
|
import { pathToFileURL } from 'node:url';
|
|
6
7
|
import { resolve } from 'node:path';
|
|
7
8
|
import { existsSync } from 'node:fs';
|
|
8
9
|
import '../src/sharddev/bake/format-hook.mjs';
|
|
9
10
|
|
|
10
|
-
const AUTHOR = new Set(['new', 'update', 'check', 'synth', 'build', 'validate', 'prove', 'dev', 'schema', '--prepare-compiler']);
|
|
11
|
+
const AUTHOR = new Set(['new', 'update', 'check', 'synth', 'build', 'validate', 'prove', 'dev', 'watch', 'schema', '--prepare-compiler']);
|
|
11
12
|
const [command, operand] = process.argv.slice(2);
|
|
12
13
|
// SA2: `wildshard <verb> --help` and `wildshard help [verb]` print help (src/cli/help.ts) before any verb runs.
|
|
13
14
|
const verbHelp = command === 'help' || (command !== undefined && !command.startsWith('-') && process.argv.slice(3).some(arg => arg === '--help' || arg === '-h'));
|
package/docs/api/EXPORT-TIERS.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
<!-- generated by scripts/export-tiers.mjs from package.json exports and lint/export-tiers.json: do not edit -->
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
173 exports. A shard project imports from contract, rows, scripts and the bake kit; internal may change in any release. A new export needs a row in `lint/export-tiers.json` (`test/export-tiers.test.ts` fails without one); then run `node scripts/export-tiers.mjs`.
|
|
6
6
|
|
|
7
7
|
## contract (28)
|
|
8
8
|
|
|
@@ -105,7 +105,7 @@ Scripts: the decision and client script compilers, their AssemblyScript helpers
|
|
|
105
105
|
| `@wildshard/sdk/directorAbi` | scripts | `./src/sharddev/directorAbi.ts` |
|
|
106
106
|
| `@wildshard/sdk/returnProjectionV2` | scripts | `./src/sharddev/returnProjectionV2.ts` |
|
|
107
107
|
|
|
108
|
-
## bake kit (
|
|
108
|
+
## bake kit (85)
|
|
109
109
|
|
|
110
110
|
The bake kit: build-time geometry, texture, map and commons helpers; nothing here runs in the game.
|
|
111
111
|
|
|
@@ -189,8 +189,15 @@ The bake kit: build-time geometry, texture, map and commons helpers; nothing her
|
|
|
189
189
|
| `@wildshard/sdk/kit/geometryPack` | bake kit | `./src/sharddev/kit/geometryPack.ts` |
|
|
190
190
|
| `@wildshard/sdk/noise` | bake kit | `./src/sharddev/noise.ts` |
|
|
191
191
|
| `@wildshard/sdk/random` | bake kit | `./src/sharddev/random.ts` |
|
|
192
|
+
| `@wildshard/sdk/scene/author` | bake kit | `./src/sharddev/scene/author.ts` |
|
|
193
|
+
| `@wildshard/sdk/scene/canvas` | bake kit | `./src/sharddev/scene/canvas.ts` |
|
|
194
|
+
| `@wildshard/sdk/scene/description` | bake kit | `./src/sharddev/scene/description.ts` |
|
|
195
|
+
| `@wildshard/sdk/scene/lower` | bake kit | `./src/sharddev/scene/lower.ts` |
|
|
196
|
+
| `@wildshard/sdk/scene/shard` | bake kit | `./src/sharddev/scene/shard.ts` |
|
|
197
|
+
| `@wildshard/sdk/scene/shardfile` | bake kit | `./src/sharddev/scene/shardfile.ts` |
|
|
198
|
+
| `@wildshard/sdk/watch/protocol` | bake kit | `./src/sharddev/watch/protocol.ts` |
|
|
192
199
|
|
|
193
|
-
## internal (
|
|
200
|
+
## internal (8)
|
|
194
201
|
|
|
195
202
|
Internal: exported for sharddev's own tools and tests; a shard project must not import it, and it may change in any release.
|
|
196
203
|
|
|
@@ -202,3 +209,5 @@ Internal: exported for sharddev's own tools and tests; a shard project must not
|
|
|
202
209
|
| `@wildshard/sdk/scripts/*` | internal | `./scripts/*` |
|
|
203
210
|
| `@wildshard/sdk/sourceReader` | internal | `./src/sharddev/sourceReader.ts` |
|
|
204
211
|
| `@wildshard/sdk/test/compileDualScriptV2` | internal | `./src/sharddev/test/compileDualScriptV2.ts` |
|
|
212
|
+
| `@wildshard/sdk/watch/page` | internal | `./src/sharddev/watch/page.ts` |
|
|
213
|
+
| `@wildshard/sdk/watch/watch` | internal | `./src/sharddev/watch/watch.ts` |
|
package/lint/export-tiers.json
CHANGED
|
@@ -11,6 +11,15 @@
|
|
|
11
11
|
"./package.json": "contract",
|
|
12
12
|
"./entryReads": "contract",
|
|
13
13
|
"./immutable": "contract",
|
|
14
|
+
"./scene/shard": "bake kit",
|
|
15
|
+
"./scene/author": "bake kit",
|
|
16
|
+
"./scene/canvas": "bake kit",
|
|
17
|
+
"./scene/lower": "bake kit",
|
|
18
|
+
"./scene/description": "bake kit",
|
|
19
|
+
"./scene/shardfile": "bake kit",
|
|
20
|
+
"./watch/watch": "internal",
|
|
21
|
+
"./watch/protocol": "bake kit",
|
|
22
|
+
"./watch/page": "internal",
|
|
14
23
|
"./bake/tileEncoder": "bake kit",
|
|
15
24
|
"./bake/wholePartition": "bake kit",
|
|
16
25
|
"./bake/basisGlb": "bake kit",
|
package/lint/tile-bake-debt.json
CHANGED
|
@@ -1,7 +1,32 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 1,
|
|
3
3
|
"products": {
|
|
4
|
-
"_template": {
|
|
4
|
+
"_template": {
|
|
5
|
+
"tile/0/3/3/resident": 5250188,
|
|
6
|
+
"tile/0/3/3/compressed": 2569008,
|
|
7
|
+
"tile/0/3/3/draws": 11,
|
|
8
|
+
"tile/0/3/4/compressed": 1541492,
|
|
9
|
+
"tile/0/4/3/compressed": 1939692,
|
|
10
|
+
"tile/0/4/3/draws": 10,
|
|
11
|
+
"tile/0/4/4/compressed": 1388148,
|
|
12
|
+
"tile/1/2/1/compressed": 253704,
|
|
13
|
+
"window/2/2/compressed": 8463160,
|
|
14
|
+
"window/2/3/compressed": 8432224,
|
|
15
|
+
"window/2/4/compressed": 8472284,
|
|
16
|
+
"window/2/5/compressed": 8512940,
|
|
17
|
+
"window/3/2/compressed": 8412040,
|
|
18
|
+
"window/3/3/compressed": 8441060,
|
|
19
|
+
"window/3/4/compressed": 8454888,
|
|
20
|
+
"window/3/5/compressed": 8456068,
|
|
21
|
+
"window/4/2/compressed": 8435332,
|
|
22
|
+
"window/4/3/compressed": 8479180,
|
|
23
|
+
"window/4/4/compressed": 8444912,
|
|
24
|
+
"window/4/5/compressed": 8412132,
|
|
25
|
+
"window/5/2/compressed": 8420460,
|
|
26
|
+
"window/5/3/compressed": 8430040,
|
|
27
|
+
"window/5/4/compressed": 8401416,
|
|
28
|
+
"window/5/5/compressed": 8401560
|
|
29
|
+
},
|
|
5
30
|
"blender-template": {
|
|
6
31
|
"missing/0/0/0": 1,
|
|
7
32
|
"missing/0/0/1": 1,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wildshard/sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "The author's toolbox: the `wildshard` CLI that bakes shard source into a shardfile, the author SDK, the local dev server (engine client against engine server), the explorers, arena and drafts tool.",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"repository": {
|
|
@@ -83,8 +83,8 @@
|
|
|
83
83
|
"@types/three": "0.186.0",
|
|
84
84
|
"@typescript/typescript6": "6.0.2",
|
|
85
85
|
"@valibot/to-json-schema": "1.8.0",
|
|
86
|
-
"@wildshard/engine": "0.1.
|
|
87
|
-
"@wildshard/format": "npm:@wildshard/shard-format@0.
|
|
86
|
+
"@wildshard/engine": "0.1.19",
|
|
87
|
+
"@wildshard/format": "npm:@wildshard/shard-format@0.5.3",
|
|
88
88
|
"ajv": "6.15.0",
|
|
89
89
|
"assemblyscript": "0.28.20",
|
|
90
90
|
"binaryen": "132.0.0",
|
|
@@ -97,11 +97,13 @@
|
|
|
97
97
|
"postprocessing": "6.39.5",
|
|
98
98
|
"preact": "11.1.1",
|
|
99
99
|
"sharp": "0.35.5",
|
|
100
|
-
"three": "0.186.0",
|
|
101
100
|
"valibot": "1.5.0",
|
|
102
101
|
"vite": "8.3.0",
|
|
103
102
|
"vitest": "5.0.1"
|
|
104
103
|
},
|
|
104
|
+
"peerDependencies": {
|
|
105
|
+
"three": "0.186.0"
|
|
106
|
+
},
|
|
105
107
|
"devDependencies": {
|
|
106
108
|
"@playwright/test": "1.65.0",
|
|
107
109
|
"@types/node": "24.3.1",
|
|
@@ -110,6 +112,7 @@
|
|
|
110
112
|
"oxfmt": "0.74.0",
|
|
111
113
|
"oxlint": "1.89.0",
|
|
112
114
|
"oxlint-tsgolint": "7.0.2004",
|
|
115
|
+
"three": "0.186.0",
|
|
113
116
|
"typescript": "7.0.2"
|
|
114
117
|
},
|
|
115
118
|
"pnpm": {
|
|
@@ -198,7 +201,7 @@
|
|
|
198
201
|
"overrides": {
|
|
199
202
|
"binaryen": "npm:@pre-bundled/binaryen@132.0.0-patch-1",
|
|
200
203
|
"assemblyscript>binaryen": "npm:@pre-bundled/binaryen@131.0.0-nightly.20260721-patch-1",
|
|
201
|
-
"@wildshard/format": "npm:@wildshard/shard-format@0.
|
|
204
|
+
"@wildshard/format": "npm:@wildshard/shard-format@0.5.3"
|
|
202
205
|
}
|
|
203
206
|
},
|
|
204
207
|
"exports": {
|
|
@@ -298,6 +301,15 @@
|
|
|
298
301
|
"./test/compileDualScriptV2": "./src/sharddev/test/compileDualScriptV2.ts",
|
|
299
302
|
"./buildBehaviour": "./src/sharddev/buildBehaviour.ts",
|
|
300
303
|
"./scene": "./src/sharddev/scene.ts",
|
|
304
|
+
"./scene/shard": "./src/sharddev/scene/shard.ts",
|
|
305
|
+
"./scene/author": "./src/sharddev/scene/author.ts",
|
|
306
|
+
"./scene/canvas": "./src/sharddev/scene/canvas.ts",
|
|
307
|
+
"./scene/lower": "./src/sharddev/scene/lower.ts",
|
|
308
|
+
"./scene/description": "./src/sharddev/scene/description.ts",
|
|
309
|
+
"./scene/shardfile": "./src/sharddev/scene/shardfile.ts",
|
|
310
|
+
"./watch/watch": "./src/sharddev/watch/watch.ts",
|
|
311
|
+
"./watch/protocol": "./src/sharddev/watch/protocol.ts",
|
|
312
|
+
"./watch/page": "./src/sharddev/watch/page.ts",
|
|
301
313
|
"./physics": "./src/sharddev/physics.ts",
|
|
302
314
|
"./entries": "./src/sharddev/entries.ts",
|
|
303
315
|
"./spawns": "./src/sharddev/spawns.ts",
|
|
@@ -14,7 +14,7 @@ import { randomBytes } from 'node:crypto';
|
|
|
14
14
|
import { InputHashMemo } from '@wildshard/engine/scripts/bake-input-hashes.mjs';
|
|
15
15
|
import { productInputKey, productToolchainKey, matchingProductInputKey, publishProductInputs } from '@wildshard/engine/scripts/shardfile-inputs.mjs';
|
|
16
16
|
import { quietCli } from '@wildshard/engine/scripts/quiet-cli.mjs';
|
|
17
|
-
import { outputManifest, shardOutputs, shardSourceDir, shardSourceFolders } from '@wildshard/engine/scripts/shard-outputs.mjs';
|
|
17
|
+
import { manifestFolders, outputManifest, shardOutputs, shardSourceDir, shardSourceFolders } from '@wildshard/engine/scripts/shard-outputs.mjs';
|
|
18
18
|
import { usesProgramDiscovery } from '@wildshard/engine/scripts/program-discovery.mjs';
|
|
19
19
|
import { shardfileValidationRevision } from '@wildshard/engine/scripts/shardfile-validation-revision.mjs';
|
|
20
20
|
import { runShardBuild, runShardBuildPool } from './shard-build-pool.mjs';
|
|
@@ -61,7 +61,12 @@ async function buildShardfilesWork(root, { strict = [process.env.CI, process.env
|
|
|
61
61
|
};
|
|
62
62
|
// SA42 (SA16's rule): a single-shard repo's source is `src/` (its folder named by its slug), a multi-shard repo's is
|
|
63
63
|
// `src/shards/<folder>/`. The engine's shard-outputs owns the layout, so every product helper below agrees with it.
|
|
64
|
-
|
|
64
|
+
// SHARD-SOURCE AP7: a `src/shards/<folder>` with no manifest declares no product (the products tests read the manifests),
|
|
65
|
+
// so it is a source proof that `wildshard check` and `watch` take by path (src/shards/authoring-slice), never built here.
|
|
66
|
+
const declared = new Set(manifestFolders(root));
|
|
67
|
+
const proofs = shardSourceFolders(root, ['shard.config.ts']).filter(folder => !declared.has(folder) && existsSync(resolve(root, 'src/shards', folder)));
|
|
68
|
+
for (const folder of proofs) console.info(`build-shards: src/shards/${folder} has no manifest: a source proof, not a product; skipped`);
|
|
69
|
+
const folders = shardSourceFolders(root, ['shard.config.ts']).filter(folder => !proofs.includes(folder)).sort((a, b) => a.localeCompare(b));
|
|
65
70
|
// SF88g: a folder with declared outputs (scripts/shard-outputs.mjs) builds one product per output, each to out/<slug>
|
|
66
71
|
const products = folders.flatMap(folder => (shardOutputs(root, folder) ?? [{ slug: folder }]).map(row => ({ name: row.slug, folder, output: row.slug === folder ? undefined : row.slug })));
|
|
67
72
|
const built = products.map(row => row.name).sort((a, b) => a.localeCompare(b));
|
|
@@ -25,6 +25,10 @@ export async function preparationPreview(client,dir,{clientPage}){
|
|
|
25
25
|
const recorded=existsSync(resolve(dir,'programs',`${slug}.json`));
|
|
26
26
|
const page=clientPage(readFileSync(resolve(client,'index.html'),'utf8'),header.trim().replaceAll('<','\\u003c'),slug,recorded);
|
|
27
27
|
const shardRoot=`/shardfiles/${slug}/`;
|
|
28
|
+
// S12f: the candidate's mounts (its discovery.json under mounts/shardfiles/<slug>/, the public files it owns) are
|
|
29
|
+
// served at their URLs from where cook.json says the product keeps them (mounts/, or the blob with the same bytes).
|
|
30
|
+
const cook=existsSync(resolve(dir,'cook.json'))?JSON.parse(readFileSync(resolve(dir,'cook.json'),'utf8')):{};
|
|
31
|
+
const mounts=new Map((Array.isArray(cook.mounts)?cook.mounts:[]).filter(row=>typeof row?.url==='string'&&typeof row.path==='string').map(row=>[row.url,row.path]));
|
|
28
32
|
const server=createServer((request,response)=>{
|
|
29
33
|
response.setHeader('Cache-Control','no-store');
|
|
30
34
|
try{
|
|
@@ -33,7 +37,8 @@ export async function preparationPreview(client,dir,{clientPage}){
|
|
|
33
37
|
if(path==='/'||path==='/index.html'){response.setHeader('Content-Type','text/html');response.end(request.method==='HEAD'?undefined:page);return;}
|
|
34
38
|
// The inline product reads beside the page, as `wildshard build` lays the client over the product folder (the
|
|
35
39
|
// client's file wins); the in-page server reads where a release serves the shard.
|
|
36
|
-
const
|
|
40
|
+
const mounted=mounts.get(path);
|
|
41
|
+
const file=mounted!==undefined?inside(dir,mounted):path.startsWith(shardRoot)?inside(dir,path.slice(shardRoot.length)):inside(client,path.slice(1))??inside(dir,path.slice(1));
|
|
37
42
|
if(file===undefined){response.writeHead(404);response.end();return;}
|
|
38
43
|
response.setHeader('Content-Type',MIME[extname(file)]??'application/octet-stream');
|
|
39
44
|
if(request.method==='HEAD')response.end();else createReadStream(file).on('error',()=>{response.destroy();}).pipe(response);
|
|
@@ -14,8 +14,8 @@ import {parseOutputIndex,assembleOutputShardfile} from '@wildshard/format/output
|
|
|
14
14
|
import {controlFileHashes,playLibrarySteps} from '@wildshard/format/admissionControl';
|
|
15
15
|
import {entryFileSteps} from '@wildshard/format/tierSelection';
|
|
16
16
|
import {validationSourceBytes} from '@wildshard/format/validationReceipt';
|
|
17
|
-
import {prepareAssetDecoders} from '@wildshard/format/
|
|
18
|
-
import {validateShardfileProduct} from '@wildshard/format/
|
|
17
|
+
import {prepareAssetDecoders} from '@wildshard/format/shardfileAssets';
|
|
18
|
+
import {validateShardfileFolder as validateShardfileProduct} from '@wildshard/format/shardfileValidation';
|
|
19
19
|
|
|
20
20
|
const hash=bytes=>createHash('sha256').update(bytes).digest('hex');
|
|
21
21
|
const json=(dir,name)=>JSON.parse(readFileSync(join(dir,name),'utf8'));
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// repo-kit's 3-day scratch sweep (meta REPO-DISK-PLAN DK6, was TEMP-HYGIENE T7). One copy lives in repo-kit; every org
|
|
3
|
+
// repo carries a byte-identical copy at scripts/scratch-sweep.mjs, beside scratch-dir.mjs (DK3) and vite-tmp.mjs.
|
|
4
|
+
//
|
|
5
|
+
// node scripts/scratch-sweep.mjs [--live] [--root <repo>] [--days <n>]
|
|
6
|
+
//
|
|
7
|
+
// It looks at each folder directly under <repo>/tmp/ and would remove one in which nothing (the folder or anything in
|
|
8
|
+
// it) changed for <n> days (3 by default), with or without a DK3 `.owner`. It keeps:
|
|
9
|
+
// - a folder holding `.keep`, or named in `tmp/keep` (one name per line, `#` comments);
|
|
10
|
+
// - a folder that is, or holds, some process's cwd (lsof -d cwd; /proc on Linux); an unreadable table keeps all;
|
|
11
|
+
// - a folder holding a Git root with dirty files or commits no remote has (DS14's list: the reason names the root);
|
|
12
|
+
// - dot folders, symlinks, and `tmp/vitest` (vite-tmp.mjs's own).
|
|
13
|
+
// Dry run is the default until Jake's yes (REPO-DISK decision 1) and a week of dry-run log; `--live` removes. Every
|
|
14
|
+
// decision is appended to tmp/.sweep.log, one line each, and a summary line goes to stdout.
|
|
15
|
+
import { spawnSync } from 'node:child_process';
|
|
16
|
+
import { appendFileSync, lstatSync, readdirSync, readFileSync, readlinkSync, realpathSync, rmSync } from 'node:fs';
|
|
17
|
+
import { join, resolve, sep } from 'node:path';
|
|
18
|
+
import { pathToFileURL } from 'node:url';
|
|
19
|
+
|
|
20
|
+
const DEFAULT_DAYS = 3;
|
|
21
|
+
const MINUTES_A_DAY = 1440;
|
|
22
|
+
const OWNED_ELSEWHERE = new Set(['vitest']);
|
|
23
|
+
|
|
24
|
+
/** Every process cwd as a real path, or null when the table can't be read (the same read as scratch-end.mjs). */
|
|
25
|
+
export function processCwds() {
|
|
26
|
+
if (process.platform === 'linux') {
|
|
27
|
+
let pids;
|
|
28
|
+
try {
|
|
29
|
+
pids = readdirSync('/proc').filter(name => /^\d+$/u.test(name));
|
|
30
|
+
} catch {
|
|
31
|
+
return null;
|
|
32
|
+
}
|
|
33
|
+
const cwds = [];
|
|
34
|
+
for (const pid of pids) {
|
|
35
|
+
try {
|
|
36
|
+
cwds.push(readlinkSync(`/proc/${pid}/cwd`).replace(/ \(deleted\)$/u, ''));
|
|
37
|
+
} catch {}
|
|
38
|
+
}
|
|
39
|
+
return cwds;
|
|
40
|
+
}
|
|
41
|
+
// A timed-out or failed lsof printed only part of the table: treat it as unreadable.
|
|
42
|
+
const lsof = spawnSync('lsof', ['-nP', '-w', '-d', 'cwd', '-Fn'], { encoding: 'utf8', maxBuffer: 64 * 1024 * 1024, timeout: 10_000 });
|
|
43
|
+
if (lsof.error || lsof.signal || lsof.status !== 0) return null;
|
|
44
|
+
const cwds = (lsof.stdout || '').split('\n').filter(line => line.startsWith('n')).map(line => line.slice(1));
|
|
45
|
+
return cwds.length > 0 ? cwds : null;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/** @param {string} path */
|
|
49
|
+
function stat(path) {
|
|
50
|
+
try {
|
|
51
|
+
return lstatSync(path);
|
|
52
|
+
} catch {
|
|
53
|
+
return null;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/** Names in tmp/keep. @param {string} tmp */
|
|
58
|
+
function keepList(tmp) {
|
|
59
|
+
let text = '';
|
|
60
|
+
try {
|
|
61
|
+
text = readFileSync(join(tmp, 'keep'), 'utf8');
|
|
62
|
+
} catch {
|
|
63
|
+
return new Set();
|
|
64
|
+
}
|
|
65
|
+
return new Set(text.split('\n').map(line => line.replace(/#.*/u, '').trim()).filter(Boolean));
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/** True when anything under `dir` (itself included) changed in the last `days` days, or the walk failed.
|
|
69
|
+
* @param {string} dir @param {number} days */
|
|
70
|
+
function touched(dir, days) {
|
|
71
|
+
const find = spawnSync('find', [dir, '-mmin', `-${String(days * MINUTES_A_DAY)}`, '-print', '-quit'], { encoding: 'utf8', maxBuffer: 1024 * 1024 });
|
|
72
|
+
return find.status !== 0 || find.stdout.trim() !== '';
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/** @param {string} root @param {readonly string[]} args */
|
|
76
|
+
function git(root, args) {
|
|
77
|
+
// GIT_OPTIONAL_LOCKS=0: `git status` must not refresh the index, or reading a stale clone would touch it.
|
|
78
|
+
const run = spawnSync('git', ['-C', root, ...args], { encoding: 'utf8', maxBuffer: 16 * 1024 * 1024, env: { ...process.env, GIT_OPTIONAL_LOCKS: '0' } });
|
|
79
|
+
return run.status === 0 ? run.stdout.trim() : null;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/** The first Git root under `dir` with dirty files or unpublished commits, and why; a Git error counts as unpublished.
|
|
83
|
+
* @param {string} dir @returns {string | null} */
|
|
84
|
+
function unpublished(dir) {
|
|
85
|
+
const find = spawnSync('find', [dir, '-maxdepth', '4', '-name', '.git', '-prune', '-print'], { encoding: 'utf8', maxBuffer: 16 * 1024 * 1024 });
|
|
86
|
+
if (find.status !== 0) return `${dir}: Git roots unreadable`;
|
|
87
|
+
for (const marker of find.stdout.split('\n').filter(Boolean)) {
|
|
88
|
+
const root = resolve(marker, '..');
|
|
89
|
+
const status = git(root, ['status', '--porcelain', '--ignore-submodules']);
|
|
90
|
+
if (status === null) return `${root}: git status failed`;
|
|
91
|
+
if (status !== '') return `${root}: dirty files`;
|
|
92
|
+
const ahead = git(root, ['log', '--branches', '--tags', '--not', '--remotes', '--oneline', '-1']);
|
|
93
|
+
if (ahead === null) return `${root}: git log failed`;
|
|
94
|
+
if (ahead !== '') return `${root}: commits no remote has`;
|
|
95
|
+
}
|
|
96
|
+
return null;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/** Each tmp/ folder and what the sweep does with it, removing nothing.
|
|
100
|
+
* @param {{ root: string, days?: number, cwds?: readonly string[] | null }} options
|
|
101
|
+
* @returns {{ name: string, action: 'remove' | 'keep', reason: string }[]} */
|
|
102
|
+
export function plan({ root, days = DEFAULT_DAYS, cwds = processCwds() }) {
|
|
103
|
+
const tmp = join(root, 'tmp');
|
|
104
|
+
const rows = [];
|
|
105
|
+
let names = [];
|
|
106
|
+
try {
|
|
107
|
+
names = readdirSync(tmp).toSorted();
|
|
108
|
+
} catch {
|
|
109
|
+
return rows;
|
|
110
|
+
}
|
|
111
|
+
const kept = keepList(tmp);
|
|
112
|
+
const real = cwds?.map(cwd => {
|
|
113
|
+
try {
|
|
114
|
+
return realpathSync(cwd);
|
|
115
|
+
} catch {
|
|
116
|
+
return cwd;
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
for (const name of names) {
|
|
120
|
+
const dir = join(tmp, name), info = stat(dir);
|
|
121
|
+
if (info === null || !info.isDirectory() || name.startsWith('.') || OWNED_ELSEWHERE.has(name)) continue;
|
|
122
|
+
const at = realpathSync(dir);
|
|
123
|
+
/** @param {string} reason */
|
|
124
|
+
const keep = reason => rows.push({ name, action: /** @type {const} */ ('keep'), reason });
|
|
125
|
+
if (stat(join(dir, '.keep')) !== null) keep('.keep');
|
|
126
|
+
else if (kept.has(name)) keep('tmp/keep');
|
|
127
|
+
else if (real === undefined || real === null) keep('process table unreadable');
|
|
128
|
+
else if (real.some(cwd => cwd === at || cwd.startsWith(at + sep))) keep('busy: a process cwd inside');
|
|
129
|
+
else if (touched(dir, days)) keep(`changed within ${String(days)} days`);
|
|
130
|
+
else {
|
|
131
|
+
const why = unpublished(dir);
|
|
132
|
+
if (why === null) rows.push({ name, action: /** @type {const} */ ('remove'), reason: `untouched ${String(days)} days` });
|
|
133
|
+
else keep(`unpublished (DS14): ${why}`);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
return rows;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/** Plans, logs every row to tmp/.sweep.log, and removes the planned folders when live.
|
|
140
|
+
* @param {{ root: string, live?: boolean, days?: number, cwds?: readonly string[] | null, now?: Date }} options */
|
|
141
|
+
export function sweep({ root, live = false, days = DEFAULT_DAYS, cwds, now = new Date() }) {
|
|
142
|
+
const rows = plan({ root, days, ...(cwds === undefined ? {} : { cwds }) });
|
|
143
|
+
const stamp = now.toISOString(), lines = [];
|
|
144
|
+
let removed = 0;
|
|
145
|
+
for (const row of rows) {
|
|
146
|
+
let verb = row.action === 'keep' ? `keep (${row.reason})` : 'would remove';
|
|
147
|
+
if (row.action === 'remove' && live) {
|
|
148
|
+
try {
|
|
149
|
+
rmSync(join(root, 'tmp', row.name), { recursive: true, force: true });
|
|
150
|
+
verb = 'removed';
|
|
151
|
+
removed += 1;
|
|
152
|
+
} catch (error) {
|
|
153
|
+
verb = `remove failed (${error instanceof Error ? error.message : String(error)})`;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
lines.push(`${stamp} ${verb} tmp/${row.name}${row.action === 'remove' ? ` (${row.reason})` : ''}\n`);
|
|
157
|
+
}
|
|
158
|
+
if (lines.length > 0) {
|
|
159
|
+
try {
|
|
160
|
+
appendFileSync(join(root, 'tmp/.sweep.log'), lines.join(''));
|
|
161
|
+
} catch {}
|
|
162
|
+
}
|
|
163
|
+
const planned = rows.filter(row => row.action === 'remove').length;
|
|
164
|
+
return { rows, planned, removed };
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
if (process.argv[1] !== undefined && import.meta.url === pathToFileURL(process.argv[1]).href) {
|
|
168
|
+
const args = process.argv.slice(2);
|
|
169
|
+
const flag = (/** @type {string} */ name) => {
|
|
170
|
+
const at = args.indexOf(name);
|
|
171
|
+
return at === -1 ? undefined : args[at + 1];
|
|
172
|
+
};
|
|
173
|
+
const days = Number(flag('--days') ?? DEFAULT_DAYS);
|
|
174
|
+
if (!Number.isInteger(days) || days < 1) throw new Error('--days takes a whole number of days, 1 or more');
|
|
175
|
+
const root = resolve(flag('--root') ?? resolve(import.meta.dirname, '..'));
|
|
176
|
+
const live = args.includes('--live');
|
|
177
|
+
const { rows, planned, removed } = sweep({ root, live, days });
|
|
178
|
+
const keptRows = rows.filter(row => row.action === 'keep');
|
|
179
|
+
process.stdout.write(`scratch-sweep ${live ? 'live' : '(dry run)'} ${root}/tmp: ${live ? `removed ${String(removed)} of ${String(planned)}` : `would remove ${String(planned)}`}, kept ${String(keptRows.length)}; log tmp/.sweep.log\n`);
|
|
180
|
+
}
|
package/scripts/wildshard.mjs
CHANGED
|
@@ -17,7 +17,7 @@ import { outputManifest, shardOutputs } from '@wildshard/engine/scripts/shard-ou
|
|
|
17
17
|
import { findShardSource, shardFolderName } from '../src/sharddev/shardSource.ts';
|
|
18
18
|
|
|
19
19
|
/** The verbs whose first operand is a shard source (or, for validate and prove, a built folder). */
|
|
20
|
-
const SOURCE_VERBS = new Set(['check', 'synth', 'build', 'dev', 'validate', 'prove']);
|
|
20
|
+
const SOURCE_VERBS = new Set(['check', 'synth', 'build', 'dev', 'watch', 'validate', 'prove']);
|
|
21
21
|
|
|
22
22
|
let runner;
|
|
23
23
|
/** SA3 (J170): `build` and `check` end by writing the folder's shard file, the step `pack` was. It stays out of the author
|
|
@@ -22,7 +22,8 @@ Read `GUIDE.md#2-the-shard-source` before your first edit: it says what ships in
|
|
|
22
22
|
3. **Pick one way to build it.**
|
|
23
23
|
- **Code:** a generator in `generators/` that builds the mesh at build time. Pick it when the shape follows numbers
|
|
24
24
|
or data (stairs, fences, a row of posts), or changes often. Generators run only at build time and must not import
|
|
25
|
-
runtime code (`GUIDE.md#lint-no-runtime-in-build`).
|
|
25
|
+
runtime code (`GUIDE.md#lint-no-runtime-in-build`). An old repo made with the retired `--template blender` has
|
|
26
|
+
no generators: use Blender.
|
|
26
27
|
- **Blender:** model it by hand or with a Blender script, keep the `.blend` or script in `blender/`, and export a
|
|
27
28
|
GLB. Pick it for an organic shape, a UV unwrap, a baked texture or a bevel.
|
|
28
29
|
- **An image-to-3D tool or a CC0 model** you are licensed to use: treat its GLB as the Blender path's export.
|
|
@@ -37,8 +38,9 @@ Read `GUIDE.md#2-the-shard-source` before your first edit: it says what ships in
|
|
|
37
38
|
nothing names it. A creature's GLB is named in `data/skins.json` and its skin file together with measured sizes:
|
|
38
39
|
replacing one needs the Wildshard team today. If nothing names a model of its kind yet, ask the Wildshard team
|
|
39
40
|
how it is loaded; the guide does not say yet.
|
|
40
|
-
- **
|
|
41
|
-
names it changes to match; `wildshard check .` settles the sizes
|
|
41
|
+
- **An old `--template blender` repo** (retired, J341; still checks and uploads): the GLB goes in `blobs/glb/` as
|
|
42
|
+
`<sha256>.glb`, and every `sections/` row that names it changes to match; `wildshard check .` settles the sizes
|
|
43
|
+
(`GUIDE.md#2-the-shard-source`).
|
|
42
44
|
Done when `git status` shows the new file and the changed rows or imports.
|
|
43
45
|
6. **Check.** `wildshard check .` (`GUIDE.md#1-the-loop`). The report card measures draws, triangles, memory and
|
|
44
46
|
download against their limits (`GUIDE.md#3-budgets`); a refusal names its fix, for example
|
|
@@ -5,10 +5,10 @@ description: Move a Wildshard shard repo to a newer @wildshard/sdk - its pins in
|
|
|
5
5
|
|
|
6
6
|
# wildshard-upgrade
|
|
7
7
|
|
|
8
|
-
`package.json` pins `@wildshard/sdk`, `@wildshard/format`, `@wildshard/engine` and `three` exactly; a
|
|
9
|
-
blender`
|
|
10
|
-
moves every pin together, then the shard source must build again on them. `GUIDE.md` at the
|
|
11
|
-
facts; a pointer `GUIDE.md#<anchor>` is the guide heading with that anchor.
|
|
8
|
+
`package.json` pins `@wildshard/sdk`, `@wildshard/format`, `@wildshard/engine` and `three` exactly; a repo made
|
|
9
|
+
with the retired `--template blender` pins only the first two, as dev dependencies (`GUIDE.md#2-the-shard-source`).
|
|
10
|
+
Moving to a newer sdk moves every pin together, then the shard source must build again on them. `GUIDE.md` at the
|
|
11
|
+
repo root holds the facts; a pointer `GUIDE.md#<anchor>` is the guide heading with that anchor.
|
|
12
12
|
|
|
13
13
|
Run the newest CLI once to move, whatever sdk the repo is on now:
|
|
14
14
|
|
package/src/cli/help.ts
CHANGED
|
@@ -16,13 +16,13 @@ const PACK_ALIAS = `pack <folder> [--out <file>]
|
|
|
16
16
|
|
|
17
17
|
/** Each verb's entry: its usage lines, then what it does, indented. */
|
|
18
18
|
const VERBS: Readonly<Record<string, string>> = {
|
|
19
|
-
new: `new <dir> [slug] [--template sdk
|
|
19
|
+
new: `new <dir> [slug] [--template sdk] [--empty]
|
|
20
20
|
Start a shard repo in <dir>, a folder that does not
|
|
21
21
|
exist yet, with its shard source at src/ (slug: the
|
|
22
|
-
folder's name unless given).
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
22
|
+
folder's name unless given). It copies the reference
|
|
23
|
+
world (--template sdk, the only template; blender is
|
|
24
|
+
retired: Blender makes models, code makes the
|
|
25
|
+
shard). --empty writes a
|
|
26
26
|
bare shard source instead`,
|
|
27
27
|
update: `update [dir] [--pins[=<version>]]
|
|
28
28
|
Rewrite GUIDE.md and the four wildshard skills in
|
|
@@ -39,6 +39,10 @@ const VERBS: Readonly<Record<string, string>> = {
|
|
|
39
39
|
Serve the shard source on localhost (port 0, the
|
|
40
40
|
default, picks a free one) and build it again on
|
|
41
41
|
every edit`,
|
|
42
|
+
watch: `watch <source> [port]
|
|
43
|
+
For a shard written as a three.js scene
|
|
44
|
+
(@wildshard/sdk/scene): serve it, then swap each
|
|
45
|
+
edited part into the running page, no reload`,
|
|
42
46
|
check: `check <source> [folder] [--json]
|
|
43
47
|
Lint, build, validate, prove (with the shard
|
|
44
48
|
source's proof.json) and read the report card, then
|
|
@@ -6,7 +6,7 @@ import { heroHashOf } from './hero.ts'
|
|
|
6
6
|
|
|
7
7
|
import type { HeroCard } from './hero.ts'
|
|
8
8
|
import type { AudioReport } from '@wildshard/format/audioRules'
|
|
9
|
-
import type { ProductFiles } from '@wildshard/format/
|
|
9
|
+
import type { ShardfileFiles as ProductFiles } from '@wildshard/format/shardfileValidation'
|
|
10
10
|
|
|
11
11
|
// The same check api-server runs on commit, run first on the author's
|
|
12
12
|
// machine: a shardfile the server would refuse should not cost a Brotli
|
|
@@ -52,10 +52,12 @@ async function validateShardfile(
|
|
|
52
52
|
tarball: Readonly<Uint8Array>,
|
|
53
53
|
): Promise<ValidShardfile> {
|
|
54
54
|
installFormatHook()
|
|
55
|
-
const { prepareAssetDecoders } =
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
55
|
+
const { prepareAssetDecoders } =
|
|
56
|
+
await import('@wildshard/format/shardfileAssets')
|
|
57
|
+
const { validateShardfileFolder: validateShardfileProduct } =
|
|
58
|
+
await import('@wildshard/format/shardfileValidation')
|
|
59
|
+
const { shardfileAudioReport: productAudioReport } =
|
|
60
|
+
await import('@wildshard/format/shardfileAudio')
|
|
59
61
|
const { readTar } = await import('@wildshard/format/tar')
|
|
60
62
|
await prepareAssetDecoders()
|
|
61
63
|
const product = productFiles(readTar(tarball))
|
package/src/sharddev/assets.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ScriptContract } from '@wildshard/format/scriptContract';
|
|
2
|
-
import { assetCost as cost, assetOverdraw as raster, parseAudio as audio, parseGlb as glb, prepareAssetDecoders, type AssetCost as Cost } from '@wildshard/format/
|
|
2
|
+
import { assetCost as cost, assetOverdraw as raster, parseAudio as audio, parseGlb as glb, prepareAssetDecoders, type AssetCost as Cost } from '@wildshard/format/shardfileAssets';
|
|
3
3
|
import { parseKtx2 as ktx2 } from '@wildshard/format/ktx2Cost';
|
|
4
4
|
|
|
5
5
|
// Author-only facade: keep synchronous cost APIs ready without suspending app modules.
|
|
@@ -8,7 +8,7 @@ import { hashImmutableBytes } from '../immutable';
|
|
|
8
8
|
import { nameBlob, nameMeshoptBlob, type BlobOptions, type NamedBlob } from '../blobs';
|
|
9
9
|
import { entryFootprints, obstructsEntry } from '@wildshard/format/entryGeometry';
|
|
10
10
|
import type { ShardEntryways } from '@wildshard/format/entryways';
|
|
11
|
-
import { visitGlbTriangles } from '@wildshard/format/
|
|
11
|
+
import { visitGlbTriangles } from '@wildshard/format/shardfileAssets';
|
|
12
12
|
|
|
13
13
|
/** The brotli size a phone pays for a file over the wire: the deploy's own encoding, quality 3 (Vercel's responses match it
|
|
14
14
|
* byte for byte). */
|
|
@@ -3,7 +3,7 @@ import { EXTMeshoptCompression, KHRMeshQuantization } from '@gltf-transform/exte
|
|
|
3
3
|
import { dedup } from '@gltf-transform/functions';
|
|
4
4
|
import { MeshoptDecoder } from 'meshoptimizer';
|
|
5
5
|
import { MeshoptEncoder } from 'meshoptimizer/encoder';
|
|
6
|
-
import { parseGlb, prepareAssetDecoders } from '@wildshard/format/
|
|
6
|
+
import { parseGlb, prepareAssetDecoders } from '@wildshard/format/shardfileAssets';
|
|
7
7
|
|
|
8
8
|
await MeshoptEncoder.ready;
|
|
9
9
|
await prepareAssetDecoders();
|
|
@@ -3,7 +3,7 @@ import { ALL_EXTENSIONS } from '@gltf-transform/extensions';
|
|
|
3
3
|
import { MeshoptDecoder, MeshoptEncoder } from 'meshoptimizer';
|
|
4
4
|
import * as v from 'valibot';
|
|
5
5
|
import { isJsonData } from '@wildshard/format/json';
|
|
6
|
-
import { parseGlb } from '@wildshard/format/
|
|
6
|
+
import { parseGlb } from '@wildshard/format/shardfileAssets';
|
|
7
7
|
|
|
8
8
|
const MAX_BYTES = 25_000_000;
|
|
9
9
|
const count = v.pipe(v.number(), v.integer(), v.minValue(0));
|