@hackbuild/bake 0.0.0-stage → 0.1.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/how.ts ADDED
@@ -0,0 +1,28 @@
1
+ // how this works: the fold of the package page and of the suite tool. Plain data, no imports;
2
+ // shape in tools/how.d.ts, checked by tsconfig.how.json, shipped in the tarball, never imported
3
+ // by the runtime entry. Text from the README.
4
+ const how: HowDoc = {
5
+ what: "glb optimize with texture hooks, clip bake into compact packs with error, seam and contact reports, and an asset lock file with licence and sha-256. rust core in wasm, plus a native command line tool.",
6
+ how: [
7
+ "one rust crate builds both the hackbuild-bake command line tool and the wasm module this package loads, so a bake in node, in a page and on the command line gives the same bytes.",
8
+ "optimizeModel welds duplicate vertices, simplifies when you ask for a ratio under 1, reorders for the vertex cache and drops unused data. it decodes no images; a resize hook gets each texture with its role and size and returns the new bytes. compressed files are refused with the reason.",
9
+ "bakeClips samples clips into a compact pack with error, seam and foot contact reports. writeLock writes assets.lock.json with each file's sha-256, source, licence and size budget.",
10
+ ],
11
+ packages: ["@hackbuild/bake"],
12
+ install: "npm install @hackbuild/bake",
13
+ today: "git clone https://github.com/hackbuild/hackbuild-motion && cd hackbuild-motion && npm ci && npm run build && npm pack -w @hackbuild/bake",
14
+ code: `import { load, optimizeModel, bakeClips, writeLock, lockEntry } from "@hackbuild/bake";
15
+
16
+ await load();
17
+ const { glb, report } = await optimizeModel(bytes, {
18
+ ratio: 0.5,
19
+ textures: { baseColor: 1024, normal: 512 },
20
+ resize: async (t) => (t.width && t.width > t.maxSize ? { bytes: await shrink(t.data, t.maxSize), mime: "image/webp" } : null),
21
+ });
22
+ const { bytes: pack, report: clips } = bakeClips({ fps: 30, skeleton, clips, contacts: { feet: ["leftFoot", "rightFoot"], height: 0.12, speed: 0.45, minFrames: 2 } });
23
+ const lock = writeLock([lockEntry("dog.glb", glb, "Meshy export", "owner"), lockEntry("ual.hbcp", pack, "Quaternius UAL", "CC0-1.0", 400_000)]);`,
24
+ lang: "ts",
25
+ links: { page: "https://hackbuild.github.io/hackbuild-motion/bake/", source: "https://github.com/hackbuild/hackbuild-motion/tree/main/packages/bake" },
26
+ };
27
+
28
+ export default how;
package/package.json CHANGED
@@ -1,6 +1,40 @@
1
1
  {
2
2
  "name": "@hackbuild/bake",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.1.1",
4
+ "description": "GLB optimize with texture hooks, clip bake into compact packs with error, seam and contact reports, and an asset lock file with licence and SHA-256. Rust core in wasm, plus a native command line tool.",
5
+ "type": "module",
6
+ "license": "MIT",
7
+ "author": "Moheeb Zara <hackbuildvideo@gmail.com>",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/hackbuild/hackbuild-motion.git",
11
+ "directory": "packages/bake"
12
+ },
13
+ "engines": {
14
+ "node": "^22.18.0 || >=24.11.0"
15
+ },
16
+ "sideEffects": false,
17
+ "exports": {
18
+ ".": {
19
+ "types": "./dist/index.d.ts",
20
+ "import": "./dist/index.js"
21
+ },
22
+ "./inline": {
23
+ "types": "./dist/wasm/inline.d.ts",
24
+ "import": "./dist/wasm/inline.js"
25
+ },
26
+ "./wasm": "./dist/wasm/bake_bg.wasm",
27
+ "./iife": "./dist/bake.iife.js"
28
+ },
29
+ "unpkg": "dist/bake.iife.js",
30
+ "jsdelivr": "dist/bake.iife.js",
31
+ "files": [
32
+ "dist",
33
+ "README.md",
34
+ "LICENSE",
35
+ "how.ts"
36
+ ],
37
+ "scripts": {
38
+ "build": "node ../../tools/build-package.mjs bake"
39
+ }
40
+ }