@r_masseater/tako 0.2.3 → 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/README.md CHANGED
@@ -68,10 +68,10 @@ The agent skill ships `assets/`, one working source per figure type with its lig
68
68
 
69
69
  ```sh
70
70
  tako render figure.typ
71
- tako render figure.typ --theme dark --format pdf
71
+ tako render figure.typ --format pdf
72
72
  ```
73
73
 
74
- Without `--theme`, it writes `figure.light.svg` and `figure.dark.svg` next to the source. `--format` is `svg` or `pdf`.
74
+ It writes `figure.light.svg` and `figure.dark.svg` next to the source. `--format` is `svg` or `pdf`.
75
75
 
76
76
  From code, `renderFigure` returns the bytes.
77
77
 
@@ -1,9 +1,9 @@
1
1
  import { r as failWith, t as renderFigure } from "./render-y19FJtYB.mjs";
2
- import { Console, Effect, FileSystem, Option, Path, Schema } from "effect";
3
- import { runMain } from "@r_masseater/node-main";
2
+ import { Console, Effect, FileSystem, Path, Schema } from "effect";
3
+ import { runMain } from "@r_masseater/masseater-utils/node-main";
4
4
  import { Argument, Command, Flag } from "effect/cli";
5
5
  // package.json
6
- var version = "0.2.3";
6
+ var version = "0.3.0";
7
7
  var description = "Draws infographics from a few lines of Typst: parts for the six kinds of element, flows, a hero number and bars, laid out automatically in light and dark.";
8
8
  // src/entities/figure/model/request.ts
9
9
  const THEMES = ["light", "dark"];
@@ -17,12 +17,8 @@ const writeFigures = Effect.fn("tako.render")(function* writeFigures(input) {
17
17
  const path = yield* Path.Path;
18
18
  const fileSystem = yield* FileSystem.FileSystem;
19
19
  const { file, format } = input;
20
- const themes = Option.match(input.theme, {
21
- onNone: () => THEMES,
22
- onSome: (theme) => [theme]
23
- });
24
20
  const stem = path.join(path.dirname(file), path.basename(file, path.extname(file)));
25
- yield* Effect.forEach(themes, (theme) => Effect.gen(function* writeFigure() {
21
+ yield* Effect.forEach(THEMES, (theme) => Effect.gen(function* writeFigure() {
26
22
  const output = yield* Effect.tryPromise({
27
23
  try: () => renderFigure({
28
24
  file,
@@ -38,7 +34,6 @@ const writeFigures = Effect.fn("tako.render")(function* writeFigures(input) {
38
34
  });
39
35
  const render = Command.make("render", {
40
36
  file: Argument.String("file").pipe(Argument.withDescription("The .typ file to draw")),
41
- theme: Flag.Literals("theme", THEMES).pipe(Flag.withDescription("Draw only this theme (default: both)"), Flag.optional),
42
37
  format: Flag.Literals("format", FORMATS).pipe(Flag.withDescription("The file format to write"), Flag.withDefault(DEFAULT_FORMAT))
43
38
  }, writeFigures).pipe(Command.withDescription("Draws the figure next to the file, once for each theme"));
44
39
  const tako = Command.make("tako").pipe(Command.withDescription(description), Command.withSubcommands([render]));
@@ -47,4 +42,4 @@ const runCli = () => {
47
42
  };
48
43
  export { runCli };
49
44
 
50
- //# sourceMappingURL=cli-POjmOq_8.mjs.map
45
+ //# sourceMappingURL=cli-CtLu13uc.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli-CtLu13uc.mjs","names":["manifest.description","manifest.version"],"sources":["../package.json","../src/entities/figure/model/request.ts","../src/app/cli.ts"],"sourcesContent":["","import { Schema } from \"effect\";\n\nexport const THEMES = [\"light\", \"dark\"] as const;\n\nexport const FORMATS = [\"svg\", \"pdf\"] as const;\n\nconst ThemeSchema = Schema.Literals(THEMES);\n\nconst FormatSchema = Schema.Literals(FORMATS);\n\nexport type Theme = typeof ThemeSchema.Type;\n\nexport type Format = typeof FormatSchema.Type;\n\nexport type Rendered = Uint8Array;\n\nexport interface RenderRequest {\n readonly file: string;\n readonly theme: Theme;\n readonly format: Format;\n}\n","import { runMain } from \"@r_masseater/masseater-utils/node-main\";\nimport manifest from \"@r_masseater/tako/package.json\" with { type: \"json\" };\nimport { Console, Effect, FileSystem, Path } from \"effect\";\nimport { Argument, Command, Flag } from \"effect/cli\";\n\nimport { FORMATS, THEMES } from \"#/entities/figure/index.ts\";\nimport type { Format } from \"#/entities/figure/index.ts\";\nimport { failWith } from \"#/shared/lib/errors.ts\";\n\nimport { renderFigure } from \"./render.ts\";\n\nconst DEFAULT_FORMAT: Format = \"svg\";\nconst SEQUENTIAL = { concurrency: 1 } as const;\n\nconst writeFigures = Effect.fn(\"tako.render\")(function* writeFigures(input: {\n readonly file: string;\n readonly format: Format;\n}) {\n const path = yield* Path.Path;\n const fileSystem = yield* FileSystem.FileSystem;\n const { file, format } = input;\n const stem = path.join(path.dirname(file), path.basename(file, path.extname(file)));\n yield* Effect.forEach(\n THEMES,\n (theme) =>\n Effect.gen(function* writeFigure() {\n const output = yield* Effect.tryPromise({\n try: () => renderFigure({ file, theme, format }),\n catch: failWith,\n });\n const target = `${stem}.${theme}.${format}`;\n yield* fileSystem.writeFile(target, output);\n yield* Console.log(target);\n }),\n SEQUENTIAL,\n );\n});\n\nconst render = Command.make(\n \"render\",\n {\n file: Argument.String(\"file\").pipe(Argument.withDescription(\"The .typ file to draw\")),\n format: Flag.Literals(\"format\", FORMATS).pipe(\n Flag.withDescription(\"The file format to write\"),\n Flag.withDefault(DEFAULT_FORMAT),\n ),\n },\n writeFigures,\n).pipe(Command.withDescription(\"Draws the figure next to the file, once for each theme\"));\n\nconst tako = Command.make(\"tako\").pipe(\n Command.withDescription(manifest.description),\n Command.withSubcommands([render]),\n);\n\nexport const runCli = (): void => {\n runMain(\"tako\")(Command.run(tako, { version: manifest.version }));\n};\n"],"mappings":";;;;;;;;ACEA,MAAa,SAAS,CAAC,SAAS,MAAM;AAEtC,MAAa,UAAU,CAAC,OAAO,KAAK;AAEhB,OAAO,SAAS,MAAM;AAErB,OAAO,SAAS,OAAO;;ACG5C,MAAM,iBAAyB;AAC/B,MAAM,aAAa,EAAE,aAAa,EAAE;AAEpC,MAAM,eAAe,OAAO,GAAG,aAAa,CAAC,CAAC,UAAU,aAAa,OAGlE;CACD,MAAM,OAAO,OAAO,KAAK;CACzB,MAAM,aAAa,OAAO,WAAW;CACrC,MAAM,EAAE,MAAM,WAAW;CACzB,MAAM,OAAO,KAAK,KAAK,KAAK,QAAQ,IAAI,GAAG,KAAK,SAAS,MAAM,KAAK,QAAQ,IAAI,CAAC,CAAC;CAClF,OAAO,OAAO,QACZ,SACC,UACC,OAAO,IAAI,UAAU,cAAc;EACjC,MAAM,SAAS,OAAO,OAAO,WAAW;GACtC,WAAW,aAAa;IAAE;IAAM;IAAO;GAAO,CAAC;GAC/C,OAAO;EACT,CAAC;EACD,MAAM,SAAS,GAAG,KAAK,GAAG,MAAM,GAAG;EACnC,OAAO,WAAW,UAAU,QAAQ,MAAM;EAC1C,OAAO,QAAQ,IAAI,MAAM;CAC3B,CAAC,GACH,UACF;AACF,CAAC;AAED,MAAM,SAAS,QAAQ,KACrB,UACA;CACE,MAAM,SAAS,OAAO,MAAM,CAAC,CAAC,KAAK,SAAS,gBAAgB,uBAAuB,CAAC;CACpF,QAAQ,KAAK,SAAS,UAAU,OAAO,CAAC,CAAC,KACvC,KAAK,gBAAgB,0BAA0B,GAC/C,KAAK,YAAY,cAAc,CACjC;AACF,GACA,YACF,CAAC,CAAC,KAAK,QAAQ,gBAAgB,wDAAwD,CAAC;AAExF,MAAM,OAAO,QAAQ,KAAK,MAAM,CAAC,CAAC,KAChC,QAAQ,gBAAgBA,WAAoB,GAC5C,QAAQ,gBAAgB,CAAC,MAAM,CAAC,CAClC;AAEA,MAAa,eAAqB;CAChC,QAAQ,MAAM,CAAC,CAAC,QAAQ,IAAI,MAAM,EAAWC,QAAiB,CAAC,CAAC;AAClE"}
package/dist/cli.mjs CHANGED
@@ -2,7 +2,7 @@
2
2
  import { enableCompileCache } from "node:module";
3
3
  // bin/tako.ts
4
4
  enableCompileCache();
5
- const { runCli } = await import("./cli-POjmOq_8.mjs");
5
+ const { runCli } = await import("./cli-CtLu13uc.mjs");
6
6
  runCli();
7
7
  export {};
8
8
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@r_masseater/tako",
3
- "version": "0.2.3",
3
+ "version": "0.3.0",
4
4
  "description": "Draws infographics from a few lines of Typst: parts for the six kinds of element, flows, a hero number and bars, laid out automatically in light and dark.",
5
5
  "keywords": [
6
6
  "diagram",
@@ -45,15 +45,15 @@
45
45
  "provenance": true
46
46
  },
47
47
  "dependencies": {
48
- "@effect/platform-node": "^4.1.5",
48
+ "@effect/platform-node": "^4.1.7",
49
49
  "@material-symbols/svg-400": "^0.49.0",
50
50
  "@myriaddreamin/typst-ts-node-compiler": "^0.7.0",
51
- "@r_masseater/node-main": "^0.2.0"
51
+ "@r_masseater/masseater-utils": "^0.1.8"
52
52
  },
53
53
  "devDependencies": {
54
- "@effect/vitest": "4.1.5",
55
- "@types/node": "26.6.10",
56
- "effect": "4.1.5",
54
+ "@effect/vitest": "4.1.7",
55
+ "@types/node": "26.6.11",
56
+ "effect": "4.1.7",
57
57
  "vite-plus": "1.8.0"
58
58
  },
59
59
  "peerDependencies": {
@@ -61,6 +61,5 @@
61
61
  },
62
62
  "engines": {
63
63
  "node": ">=26.13.1"
64
- },
65
- "scripts": {}
64
+ }
66
65
  }
@@ -1 +0,0 @@
1
- {"version":3,"file":"cli-POjmOq_8.mjs","names":["manifest.description","manifest.version"],"sources":["../package.json","../src/entities/figure/model/request.ts","../src/app/cli.ts"],"sourcesContent":["","import { Schema } from \"effect\";\n\nexport const THEMES = [\"light\", \"dark\"] as const;\n\nexport const FORMATS = [\"svg\", \"pdf\"] as const;\n\nconst ThemeSchema = Schema.Literals(THEMES);\n\nconst FormatSchema = Schema.Literals(FORMATS);\n\nexport type Theme = typeof ThemeSchema.Type;\n\nexport type Format = typeof FormatSchema.Type;\n\nexport type Rendered = Uint8Array;\n\nexport interface RenderRequest {\n readonly file: string;\n readonly theme: Theme;\n readonly format: Format;\n}\n","import { runMain } from \"@r_masseater/node-main\";\nimport manifest from \"@r_masseater/tako/package.json\" with { type: \"json\" };\nimport { Console, Effect, FileSystem, Option, Path } from \"effect\";\nimport { Argument, Command, Flag } from \"effect/cli\";\n\nimport { FORMATS, THEMES } from \"#/entities/figure/index.ts\";\nimport type { Format, Theme } from \"#/entities/figure/index.ts\";\nimport { failWith } from \"#/shared/lib/errors.ts\";\n\nimport { renderFigure } from \"./render.ts\";\n\nconst DEFAULT_FORMAT: Format = \"svg\";\nconst SEQUENTIAL = { concurrency: 1 } as const;\n\nconst writeFigures = Effect.fn(\"tako.render\")(function* writeFigures(input: {\n readonly file: string;\n readonly theme: Option.Option<Theme>;\n readonly format: Format;\n}) {\n const path = yield* Path.Path;\n const fileSystem = yield* FileSystem.FileSystem;\n const { file, format } = input;\n const themes = Option.match(input.theme, {\n onNone: (): readonly Theme[] => THEMES,\n onSome: (theme): readonly Theme[] => [theme],\n });\n const stem = path.join(path.dirname(file), path.basename(file, path.extname(file)));\n yield* Effect.forEach(\n themes,\n (theme) =>\n Effect.gen(function* writeFigure() {\n const output = yield* Effect.tryPromise({\n try: () => renderFigure({ file, theme, format }),\n catch: failWith,\n });\n const target = `${stem}.${theme}.${format}`;\n yield* fileSystem.writeFile(target, output);\n yield* Console.log(target);\n }),\n SEQUENTIAL,\n );\n});\n\nconst render = Command.make(\n \"render\",\n {\n file: Argument.String(\"file\").pipe(Argument.withDescription(\"The .typ file to draw\")),\n theme: Flag.Literals(\"theme\", THEMES).pipe(\n Flag.withDescription(\"Draw only this theme (default: both)\"),\n Flag.optional,\n ),\n format: Flag.Literals(\"format\", FORMATS).pipe(\n Flag.withDescription(\"The file format to write\"),\n Flag.withDefault(DEFAULT_FORMAT),\n ),\n },\n writeFigures,\n).pipe(Command.withDescription(\"Draws the figure next to the file, once for each theme\"));\n\nconst tako = Command.make(\"tako\").pipe(\n Command.withDescription(manifest.description),\n Command.withSubcommands([render]),\n);\n\nexport const runCli = (): void => {\n runMain(\"tako\")(Command.run(tako, { version: manifest.version }));\n};\n"],"mappings":";;;;;;;;ACEA,MAAa,SAAS,CAAC,SAAS,MAAM;AAEtC,MAAa,UAAU,CAAC,OAAO,KAAK;AAEhB,OAAO,SAAS,MAAM;AAErB,OAAO,SAAS,OAAO;;ACG5C,MAAM,iBAAyB;AAC/B,MAAM,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