Exporter SDK
The exporter is a set of pure functions over DrawtonomySnapshot.
Adding a new target format is self-contained: a new module, a few
tests, and an optional UI hook.
This page is a quick orientation. The full guide — architecture, API, testing patterns, esmini visual checks — is in the public repo:
➡ Exporter Developer Guide (日本語)
Quick start
Section titled “Quick start”git clone https://github.com/kosuke55/drawtonomy.gitcd drawtonomypnpm installcd packages/drawtonomy-sdkpnpm exec vitest exporter # watch modeMinimal new exporter
Section titled “Minimal new exporter”import type { DrawtonomySnapshot } from '../types'
export function exportToMyFormat(snapshot: DrawtonomySnapshot): string { // Walk shapes, emit your format. return ''}import { describe, it, expect } from 'vitest'import { exportToMyFormat } from '../../src/exporter/my-format'import { createSnapshot, createLane } from '../../src/index'
describe('my-format exporter', () => { it('emits expected payload for a single lane', () => { const snapshot = createSnapshot([createLane(/* ... */)]) expect(exportToMyFormat(snapshot)).toContain('<expected/>') })})Use a real scene as a fixture
Section titled “Use a real scene as a fixture”drawtonomy.svg files round-trip through the SDK, so you can
author a scene in the editor and use it as a regression-test
input:
import { readFileSync } from 'node:fs'import { parseDrawtonomySvg } from '@drawtonomy/sdk'
const svg = readFileSync('./fixtures/my-scene.drawtonomy.svg', 'utf-8')const snapshot = parseDrawtonomySvg(svg)!See also
Section titled “See also”- Exporter architecture — the pipeline and why it’s pure.
@drawtonomy/sdkoverview