@glissade/cli 0.53.0 → 0.54.0-pre.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/dist/export.js CHANGED
@@ -18,11 +18,13 @@ async function exportCommand(opts) {
18
18
  const height = opts.height ?? scene.size.h;
19
19
  const warnings = [];
20
20
  const measurer = await buildSceneMeasurer(mod, opts.input);
21
+ const encodePng = await buildPngEncoder();
21
22
  const doc = exportLottie(mod, {
22
23
  width,
23
24
  height,
24
25
  ...opts.fps !== void 0 ? { fps: opts.fps } : {},
25
26
  measurer,
27
+ encodePng,
26
28
  onWarn: (w) => warnings.push(w)
27
29
  });
28
30
  const outAbs = resolve(opts.out);
@@ -48,5 +50,20 @@ async function buildSceneMeasurer(mod, input) {
48
50
  for (const face of fontRegistry.faces()) fonts[face.family] = resolveAssetPath(face.url, input);
49
51
  return createMeasurer({ fonts });
50
52
  }
53
+ /**
54
+ * A deterministic PNG encoder over @napi-rs/canvas (SkiaBackend.putPixels →
55
+ * encodePng), handed to `exportLottie` so a mesh fill can be rasterized and
56
+ * embedded as a base64 ty:2 image. A fresh backend per encode sizes to the
57
+ * raster's own w×h. backend-skia stays a lottie DEV-dep — the CLI (which already
58
+ * depends on it) does the encoding and threads the closure in.
59
+ */
60
+ async function buildPngEncoder() {
61
+ const { SkiaBackend } = await import("@glissade/backend-skia");
62
+ return (rgba, w, h) => {
63
+ const backend = new SkiaBackend(w, h);
64
+ backend.putPixels(rgba);
65
+ return backend.encodePng().toString("base64");
66
+ };
67
+ }
51
68
  //#endregion
52
69
  export { export_exports as n, exportCommand as t };
package/dist/parity.js CHANGED
@@ -215,11 +215,17 @@ async function lottieSource(mod, w, h, fps, modulePath) {
215
215
  backend: measurer,
216
216
  modulePath
217
217
  });
218
+ const encodePng = (rgba, rw, rh) => {
219
+ const b = new SkiaBackend(rw, rh);
220
+ b.putPixels(rgba);
221
+ return b.encodePng().toString("base64");
222
+ };
218
223
  return skiaSource(importLottie(exportLottie(mod, {
219
224
  width: w,
220
225
  height: h,
221
226
  fps,
222
- measurer
227
+ measurer,
228
+ encodePng
223
229
  })).toSceneModule(), w, h, modulePath);
224
230
  }
225
231
  function makeSource(backend, mod, w, h, fps, modulePath) {
package/dist/render.js CHANGED
@@ -429,9 +429,16 @@ async function prepareSkiaRenderEnv(o) {
429
429
  });
430
430
  for (const [assetId, ref] of Object.entries(doc.assets ?? {})) if (ref.kind === "font") {} else if (ref.kind === "image") {
431
431
  const { loadImage } = await import("@napi-rs/canvas");
432
- const imgPath = resolveAsset(ref.url, modulePath);
433
- assetDigests.set(`image:${assetId}`, digestBytes(await readFile(imgPath)));
434
- backend.setImageAsset(assetId, await loadImage(imgPath));
432
+ if (ref.url.startsWith("data:")) {
433
+ const b64 = ref.url.slice(ref.url.indexOf(",") + 1);
434
+ const buf = Buffer.from(b64, "base64");
435
+ assetDigests.set(`image:${assetId}`, digestBytes(buf));
436
+ backend.setImageAsset(assetId, await loadImage(buf));
437
+ } else {
438
+ const imgPath = resolveAsset(ref.url, modulePath);
439
+ assetDigests.set(`image:${assetId}`, digestBytes(await readFile(imgPath)));
440
+ backend.setImageAsset(assetId, await loadImage(imgPath));
441
+ }
435
442
  } else if (ref.kind === "video") {
436
443
  if (!ffmpegAvailable()) throw new Error(`video asset '${assetId}' needs FFmpeg on PATH for frame extraction (§5.4)`);
437
444
  const { FfmpegVideoFrameSource } = await import("./videoSource.js").then((n) => n.i);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@glissade/cli",
3
- "version": "0.53.0",
3
+ "version": "0.54.0-pre.0",
4
4
  "description": "glissade CLI: headless rendering via backend-skia (+ FFmpeg mux).",
5
5
  "license": "Apache-2.0",
6
6
  "engines": {
@@ -28,15 +28,15 @@
28
28
  "@napi-rs/canvas": "^0.1.65",
29
29
  "esbuild": "0.28.0",
30
30
  "jiti": "^2.4.2",
31
- "@glissade/backend-skia": "0.53.0",
32
- "@glissade/core": "0.53.0",
33
- "@glissade/interact": "0.53.0",
34
- "@glissade/lottie": "0.53.0",
35
- "@glissade/narrate": "0.53.0",
36
- "@glissade/player": "0.53.0",
37
- "@glissade/scene": "0.53.0",
38
- "@glissade/sfx": "0.53.0",
39
- "@glissade/svg": "0.53.0"
31
+ "@glissade/backend-skia": "0.54.0-pre.0",
32
+ "@glissade/core": "0.54.0-pre.0",
33
+ "@glissade/interact": "0.54.0-pre.0",
34
+ "@glissade/lottie": "0.54.0-pre.0",
35
+ "@glissade/narrate": "0.54.0-pre.0",
36
+ "@glissade/player": "0.54.0-pre.0",
37
+ "@glissade/scene": "0.54.0-pre.0",
38
+ "@glissade/sfx": "0.54.0-pre.0",
39
+ "@glissade/svg": "0.54.0-pre.0"
40
40
  },
41
41
  "repository": {
42
42
  "type": "git",