@glissade/cli 0.5.0 → 0.6.0-pre.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/dist/cli.js CHANGED
@@ -42,7 +42,7 @@ function parseArgs(argv) {
42
42
  const USAGE = `usage:
43
43
  gs render <scene-module> [options]
44
44
  gs dev <scene-module> [--record] [--port <n>]
45
- gs import <lottie.json> [--out <dir>] [--allow-degraded]
45
+ gs import <lottie.json|asset.svg> [--out <dir>] [--allow-degraded]
46
46
  gs narrate <scene-module|script.narration.json> [--provider <id>] [--align <id>] [--force]
47
47
  gs sfx <scene-module|script.sfx.json> [--verbose]
48
48
  gs prepare <scene-module> [--provider <id>] [--align <id>] [--force]
@@ -63,9 +63,9 @@ dev options:
63
63
  --record add a Record button; writes .trace.json sidecars next to the module
64
64
  --port <n> listen port (default: any free port)
65
65
 
66
- import options:
66
+ import options (.json = Lottie; .svg = static SVG → a scene that defers to @glissade/svg):
67
67
  --out <dir> output directory for the generated scene module (default: .)
68
- --allow-degraded downgrade degradable rejections (expressions, merge-paths modes != 1) to warnings
68
+ --allow-degraded (Lottie only) downgrade degradable rejections (expressions, merge-paths modes != 1) to warnings
69
69
 
70
70
  narrate options (the explicit TTS prepare step; render itself stays offline):
71
71
  --provider <id> fake | espeak | piper | openai (default: the script's provider, else espeak)
@@ -80,7 +80,7 @@ async function main() {
80
80
  }
81
81
  const { positional, flags } = parseArgs(rest);
82
82
  const modulePath = positional[0];
83
- if (!modulePath) fail(`missing ${command === "import" ? "<lottie.json>" : "<scene-module>"}\n${USAGE}`);
83
+ if (!modulePath) fail(`missing ${command === "import" ? "<lottie.json|asset.svg>" : "<scene-module>"}\n${USAGE}`);
84
84
  if (command === "narrate") {
85
85
  const { narrateCommand } = await import("./narrate.js");
86
86
  try {
package/dist/import.js CHANGED
@@ -2,14 +2,49 @@ import { t as __exportAll } from "./rolldown-runtime.js";
2
2
  import { mkdirSync, readFileSync, writeFileSync } from "node:fs";
3
3
  import { basename, join, resolve } from "node:path";
4
4
  import { generateSceneModule, importLottie } from "@glissade/lottie";
5
+ import { importSvg } from "@glissade/svg";
5
6
  //#region src/import.ts
6
7
  /**
7
- * gs import (lottie-import.md §3.1): Lottie/bodymovin .json → a generated
8
- * TypeScript scene module (nodes + inline Timeline) consumable by gs render.
8
+ * gs import (lottie-import.md §3.1): a vector asset → a generated TypeScript
9
+ * scene module consumable by gs render. `.json` → Lottie/bodymovin (nodes +
10
+ * inline Timeline); `.svg` → a static SVG scene (a wrapper deferring to
11
+ * `@glissade/svg`'s `importSvg`, the single source of truth for the conversion).
9
12
  */
10
13
  var import_exports = /* @__PURE__ */ __exportAll({ importCommand: () => importCommand });
14
+ /** Emit a renderable scene module that re-imports the SVG at module load. */
15
+ function generateSvgModule(svg, source) {
16
+ const embedded = svg.replace(/\\/g, "\\\\").replace(/`/g, "\\`").replace(/\$\{/g, "\\${");
17
+ return [
18
+ `// Generated from ${source} by gs import. Re-imported via @glissade/svg at load;`,
19
+ `// edit the source SVG and re-run, or replace this with hand-authored nodes.`,
20
+ `import { importSvg } from '@glissade/svg';`,
21
+ ``,
22
+ `const SVG = \`${embedded}\`;`,
23
+ ``,
24
+ `export default importSvg(SVG).toSceneModule();`,
25
+ ``
26
+ ].join("\n");
27
+ }
11
28
  async function importCommand(opts) {
12
29
  const inputAbs = resolve(opts.input);
30
+ const outDir = resolve(opts.out);
31
+ mkdirSync(outDir, { recursive: true });
32
+ if (/\.svg$/i.test(inputAbs)) {
33
+ let svg;
34
+ try {
35
+ svg = readFileSync(inputAbs, "utf8");
36
+ } catch (err) {
37
+ throw new Error(`${opts.input}: ${err instanceof Error ? err.message : String(err)}`);
38
+ }
39
+ const result = importSvg(svg);
40
+ const code = generateSvgModule(svg, basename(inputAbs));
41
+ const outFile = join(outDir, `${basename(inputAbs).replace(/\.svg$/i, "")}.ts`);
42
+ writeFileSync(outFile, code);
43
+ return {
44
+ out: outFile,
45
+ warnings: result.warnings
46
+ };
47
+ }
13
48
  let json;
14
49
  try {
15
50
  json = JSON.parse(readFileSync(inputAbs, "utf8"));
@@ -18,8 +53,6 @@ async function importCommand(opts) {
18
53
  }
19
54
  const result = importLottie(json, { allowDegraded: opts.allowDegraded === true });
20
55
  const code = generateSceneModule(result, { source: basename(inputAbs) });
21
- const outDir = resolve(opts.out);
22
- mkdirSync(outDir, { recursive: true });
23
56
  const outFile = join(outDir, `${basename(inputAbs).replace(/\.json$/i, "")}.ts`);
24
57
  writeFileSync(outFile, code);
25
58
  return {
package/dist/index.d.ts CHANGED
@@ -149,8 +149,10 @@ declare function dev(opts: DevOptions): Promise<DevServer>;
149
149
  //#endregion
150
150
  //#region src/import.d.ts
151
151
  /**
152
- * gs import (lottie-import.md §3.1): Lottie/bodymovin .json → a generated
153
- * TypeScript scene module (nodes + inline Timeline) consumable by gs render.
152
+ * gs import (lottie-import.md §3.1): a vector asset → a generated TypeScript
153
+ * scene module consumable by gs render. `.json` → Lottie/bodymovin (nodes +
154
+ * inline Timeline); `.svg` → a static SVG scene (a wrapper deferring to
155
+ * `@glissade/svg`'s `importSvg`, the single source of truth for the conversion).
154
156
  */
155
157
  interface ImportOptions {
156
158
  input: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@glissade/cli",
3
- "version": "0.5.0",
3
+ "version": "0.6.0-pre.1",
4
4
  "description": "glissade CLI: headless rendering via backend-skia (+ FFmpeg mux).",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
@@ -20,14 +20,15 @@
20
20
  "@napi-rs/canvas": "^0.1.65",
21
21
  "esbuild": "^0.28.0",
22
22
  "jiti": "^2.4.2",
23
- "@glissade/backend-skia": "0.5.0",
24
- "@glissade/core": "0.5.0",
25
- "@glissade/interact": "0.5.0",
26
- "@glissade/lottie": "0.5.0",
27
- "@glissade/narrate": "0.5.0",
28
- "@glissade/player": "0.5.0",
29
- "@glissade/scene": "0.5.0",
30
- "@glissade/sfx": "0.5.0"
23
+ "@glissade/backend-skia": "0.6.0-pre.1",
24
+ "@glissade/core": "0.6.0-pre.1",
25
+ "@glissade/interact": "0.6.0-pre.1",
26
+ "@glissade/lottie": "0.6.0-pre.1",
27
+ "@glissade/svg": "0.6.0-pre.1",
28
+ "@glissade/narrate": "0.6.0-pre.1",
29
+ "@glissade/player": "0.6.0-pre.1",
30
+ "@glissade/scene": "0.6.0-pre.1",
31
+ "@glissade/sfx": "0.6.0-pre.1"
31
32
  },
32
33
  "repository": {
33
34
  "type": "git",