@luutuankiet/clipboard2markdown 0.2.2 → 0.4.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 +29 -2
- package/bin/cli.js +40 -34
- package/bin/diagrams.js +11 -2
- package/bin/excalidraw.js +118 -12
- package/package.json +10 -3
- package/src/clipboard-convert.js +71 -0
- package/src/diagrams/markdown.js +81 -18
- package/src/diagrams/retry.js +65 -0
- package/src/diagrams/share-link.js +6 -2
- package/src/excalidraw-png.js +217 -0
- package/vendor/excalidraw/VERSION +1 -0
- package/vendor/excalidraw/excalidraw.bundle.mjs +3384 -0
- package/vendor/excalidraw/fonts/Assistant/Assistant-Bold.woff2 +0 -0
- package/vendor/excalidraw/fonts/Assistant/Assistant-Medium.woff2 +0 -0
- package/vendor/excalidraw/fonts/Assistant/Assistant-Regular.woff2 +0 -0
- package/vendor/excalidraw/fonts/Assistant/Assistant-SemiBold.woff2 +0 -0
- package/vendor/excalidraw/fonts/Cascadia/CascadiaCode-Regular.woff2 +0 -0
- package/vendor/excalidraw/fonts/ComicShanns/ComicShanns-Regular-279a7b317d12eb88de06167bd672b4b4.woff2 +0 -0
- package/vendor/excalidraw/fonts/ComicShanns/ComicShanns-Regular-6e066e8de2ac57ea9283adb9c24d7f0c.woff2 +0 -0
- package/vendor/excalidraw/fonts/ComicShanns/ComicShanns-Regular-dc6a8806fa96795d7b3be5026f989a17.woff2 +0 -0
- package/vendor/excalidraw/fonts/ComicShanns/ComicShanns-Regular-fcb0fc02dcbee4c9846b3e2508668039.woff2 +0 -0
- package/vendor/excalidraw/fonts/Excalifont/Excalifont-Regular-349fac6ca4700ffec595a7150a0d1e1d.woff2 +0 -0
- package/vendor/excalidraw/fonts/Excalifont/Excalifont-Regular-3f2c5db56cc93c5a6873b1361d730c16.woff2 +0 -0
- package/vendor/excalidraw/fonts/Excalifont/Excalifont-Regular-41b173a47b57366892116a575a43e2b6.woff2 +0 -0
- package/vendor/excalidraw/fonts/Excalifont/Excalifont-Regular-623ccf21b21ef6b3a0d87738f77eb071.woff2 +0 -0
- package/vendor/excalidraw/fonts/Excalifont/Excalifont-Regular-a88b72a24fb54c9f94e3b5fdaa7481c9.woff2 +0 -0
- package/vendor/excalidraw/fonts/Excalifont/Excalifont-Regular-b9dcf9d2e50a1eaf42fc664b50a3fd0d.woff2 +0 -0
- package/vendor/excalidraw/fonts/Excalifont/Excalifont-Regular-be310b9bcd4f1a43f571c46df7809174.woff2 +0 -0
- package/vendor/excalidraw/fonts/Liberation/LiberationSans-Regular.woff2 +0 -0
- package/vendor/excalidraw/fonts/Lilita/Lilita-Regular-i7dPIFZ9Zz-WBtRtedDbYE98RXi4EwSsbg.woff2 +0 -0
- package/vendor/excalidraw/fonts/Lilita/Lilita-Regular-i7dPIFZ9Zz-WBtRtedDbYEF8RXi4EwQ.woff2 +0 -0
- package/vendor/excalidraw/fonts/Nunito/Nunito-Regular-XRXI3I6Li01BKofiOc5wtlZ2di8HDIkhdTA3j6zbXWjgevT5.woff2 +0 -0
- package/vendor/excalidraw/fonts/Nunito/Nunito-Regular-XRXI3I6Li01BKofiOc5wtlZ2di8HDIkhdTQ3j6zbXWjgeg.woff2 +0 -0
- package/vendor/excalidraw/fonts/Nunito/Nunito-Regular-XRXI3I6Li01BKofiOc5wtlZ2di8HDIkhdTk3j6zbXWjgevT5.woff2 +0 -0
- package/vendor/excalidraw/fonts/Nunito/Nunito-Regular-XRXI3I6Li01BKofiOc5wtlZ2di8HDIkhdTo3j6zbXWjgevT5.woff2 +0 -0
- package/vendor/excalidraw/fonts/Nunito/Nunito-Regular-XRXI3I6Li01BKofiOc5wtlZ2di8HDIkhdTs3j6zbXWjgevT5.woff2 +0 -0
- package/vendor/excalidraw/fonts/Virgil/Virgil-Regular.woff2 +0 -0
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
// Retry policy for scene downloads, used by the CLI paths only. The page calls
|
|
2
|
+
// loadScene with a plain fetch and never loads this file.
|
|
3
|
+
//
|
|
4
|
+
// Each attempt gets its own timeout. A timeout, a network error, HTTP 429 and
|
|
5
|
+
// HTTP 5xx are retried; anything else (404, other 4xx) is handed back at once,
|
|
6
|
+
// and decrypt / decompress failures happen after fetch so are never retried.
|
|
7
|
+
|
|
8
|
+
export const RETRY_POLICY = { attemptTimeoutMs: 3000, delaysMs: [250, 750], deadlineMs: 6000 };
|
|
9
|
+
|
|
10
|
+
const wait = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
11
|
+
|
|
12
|
+
function failure(message, reason) {
|
|
13
|
+
var err = new Error(message);
|
|
14
|
+
err.reason = reason;
|
|
15
|
+
return err;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function attempt(fetchImpl, url, init, timeoutMs) {
|
|
19
|
+
var controller = typeof AbortController === 'function' ? new AbortController() : null;
|
|
20
|
+
var timer;
|
|
21
|
+
// Raced rather than trusted to the signal: a fetch that ignores abort must
|
|
22
|
+
// still lose to the clock.
|
|
23
|
+
var timeout = new Promise(function (_, reject) {
|
|
24
|
+
timer = setTimeout(function () {
|
|
25
|
+
if (controller) controller.abort();
|
|
26
|
+
reject(failure('timed out after ' + timeoutMs + 'ms', 'timeout'));
|
|
27
|
+
}, timeoutMs);
|
|
28
|
+
});
|
|
29
|
+
var request = Promise.resolve()
|
|
30
|
+
.then(function () { return fetchImpl(url, Object.assign({}, init, controller ? { signal: controller.signal } : {})); })
|
|
31
|
+
.catch(function (err) { throw err && err.reason ? err : failure('network error: ' + (err && err.message ? err.message : err), 'network'); });
|
|
32
|
+
return Promise.race([request, timeout]).finally(function () { clearTimeout(timer); });
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const retryable = (status) => status === 429 || status >= 500;
|
|
36
|
+
|
|
37
|
+
// A fetch with the same signature that retries temporary failures.
|
|
38
|
+
export function retryingFetch(fetchImpl, policy) {
|
|
39
|
+
var p = Object.assign({}, RETRY_POLICY, policy);
|
|
40
|
+
return async function (url, init) {
|
|
41
|
+
var last;
|
|
42
|
+
for (var i = 0; i <= p.delaysMs.length; i++) {
|
|
43
|
+
if (i > 0) await wait(p.delaysMs[i - 1]);
|
|
44
|
+
try {
|
|
45
|
+
var res = await attempt(fetchImpl, url, init, p.attemptTimeoutMs);
|
|
46
|
+
if (!retryable(res.status)) return res;
|
|
47
|
+
last = res;
|
|
48
|
+
} catch (err) {
|
|
49
|
+
last = err;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
if (last instanceof Error) throw last;
|
|
53
|
+
return last;
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// Short reason for a failed download, for the one-line notice.
|
|
58
|
+
export function failureReason(err) {
|
|
59
|
+
if (err && err.reason) return err.reason;
|
|
60
|
+
var status = err && err.status;
|
|
61
|
+
if (status === 404) return '404';
|
|
62
|
+
if (status >= 500) return '5xx';
|
|
63
|
+
if (status) return String(status);
|
|
64
|
+
return 'error';
|
|
65
|
+
}
|
|
@@ -142,14 +142,18 @@ export async function loadScene(url, options) {
|
|
|
142
142
|
if (!link) throw new Error('not an excalidraw.com share link');
|
|
143
143
|
var res = await pickFetch(options)(link.backendBase + link.id, { method: 'GET' });
|
|
144
144
|
if (!res.ok) {
|
|
145
|
-
|
|
145
|
+
var httpErr = new Error(res.status === 404 ? 'scene not found (HTTP 404)' : 'HTTP ' + res.status);
|
|
146
|
+
httpErr.status = res.status;
|
|
147
|
+
throw httpErr;
|
|
146
148
|
}
|
|
147
149
|
var bytes = new Uint8Array(await res.arrayBuffer());
|
|
148
150
|
var data;
|
|
149
151
|
try {
|
|
150
152
|
data = await decodePayload(bytes, link.key);
|
|
151
153
|
} catch (e) {
|
|
152
|
-
|
|
154
|
+
var decryptErr = new Error('could not decrypt scene (wrong key or corrupt payload)');
|
|
155
|
+
decryptErr.reason = 'decrypt';
|
|
156
|
+
throw decryptErr;
|
|
153
157
|
}
|
|
154
158
|
return normalizeScene(data);
|
|
155
159
|
}
|
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
// Excalidraw scene -> PNG for `c2m excalidraw --png`. Node only, no browser,
|
|
2
|
+
// no network: excalidraw's own exportToSvg runs under jsdom (bundled into
|
|
3
|
+
// vendor/excalidraw/ by scripts/build-excalidraw-bundle.mjs), then resvg turns
|
|
4
|
+
// the SVG into PNG with the fonts excalidraw embedded in it.
|
|
5
|
+
|
|
6
|
+
import { existsSync, mkdtempSync, readFileSync, readdirSync, rmSync, statSync, unlinkSync, writeFileSync } from 'fs';
|
|
7
|
+
import { homedir, tmpdir } from 'os';
|
|
8
|
+
import { join } from 'path';
|
|
9
|
+
import { fileURLToPath, pathToFileURL } from 'url';
|
|
10
|
+
|
|
11
|
+
const VENDOR = fileURLToPath(new URL('../vendor/excalidraw/', import.meta.url));
|
|
12
|
+
// Font requests go to this origin and are answered from VENDOR/fonts; the
|
|
13
|
+
// .invalid TLD guarantees nothing could ever resolve it.
|
|
14
|
+
const ASSET_ORIGIN = 'http://c2m-fonts.invalid/';
|
|
15
|
+
|
|
16
|
+
export const MAX_PIXELS = 25000000; // Google Docs refuses larger images
|
|
17
|
+
export const DOC_SCALE = 3;
|
|
18
|
+
export const REVIEW_LONG_SIDE = 1000;
|
|
19
|
+
export const CACHE_MAX_AGE_MS = 24 * 3600 * 1000;
|
|
20
|
+
|
|
21
|
+
export function defaultRenderDir(env) {
|
|
22
|
+
env = env || process.env;
|
|
23
|
+
var base = env.XDG_CACHE_HOME || join(env.HOME || homedir(), '.cache');
|
|
24
|
+
return join(base, 'c2m', 'renders');
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// Deletes PNG renders older than maxAge directly in `dir`. Only ever called on
|
|
28
|
+
// the default cache folder; never recurses, never touches anything but *.png.
|
|
29
|
+
export function cleanRenderCache(dir, options) {
|
|
30
|
+
var now = (options && options.now) || Date.now();
|
|
31
|
+
var maxAge = (options && options.maxAgeMs) || CACHE_MAX_AGE_MS;
|
|
32
|
+
var removed = [];
|
|
33
|
+
if (!existsSync(dir)) return removed;
|
|
34
|
+
readdirSync(dir).forEach(function (name) {
|
|
35
|
+
if (!/\.png$/i.test(name)) return;
|
|
36
|
+
var p = join(dir, name);
|
|
37
|
+
var st;
|
|
38
|
+
try { st = statSync(p); } catch { return; }
|
|
39
|
+
if (!st.isFile() || now - st.mtimeMs <= maxAge) return;
|
|
40
|
+
try { unlinkSync(p); removed.push(p); } catch { /* raced with another run */ }
|
|
41
|
+
});
|
|
42
|
+
return removed;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// Largest scale <= DOC_SCALE whose output stays within MAX_PIXELS, stepping
|
|
46
|
+
// down 0.01 at a time from the closed-form guess so rounding never overshoots.
|
|
47
|
+
export function pickScale(width, height) {
|
|
48
|
+
var s = Math.min(DOC_SCALE, Math.floor(Math.sqrt(MAX_PIXELS / (width * height)) * 100) / 100);
|
|
49
|
+
while (s > 0.01 && Math.ceil(width * s) * Math.ceil(height * s) > MAX_PIXELS) s = Math.round((s - 0.01) * 100) / 100;
|
|
50
|
+
return s;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// ------------------------------------------------------------ excalidraw ---
|
|
54
|
+
|
|
55
|
+
var exportToSvgPromise;
|
|
56
|
+
|
|
57
|
+
function installDom() {
|
|
58
|
+
var bundle = join(VENDOR, 'excalidraw.bundle.mjs');
|
|
59
|
+
if (!existsSync(bundle)) {
|
|
60
|
+
throw new Error('the Excalidraw renderer is missing (' + bundle + '); in a clone, run npm install');
|
|
61
|
+
}
|
|
62
|
+
return import('jsdom').then(function (m) {
|
|
63
|
+
var dom = new m.JSDOM('<!doctype html><html><body></body></html>', { url: 'http://localhost/', pretendToBeVisual: true });
|
|
64
|
+
var win = dom.window;
|
|
65
|
+
var g = globalThis;
|
|
66
|
+
['window', 'document', 'navigator', 'HTMLElement', 'Element', 'Node', 'SVGElement', 'DOMParser',
|
|
67
|
+
'XMLSerializer', 'getComputedStyle', 'devicePixelRatio', 'HTMLCanvasElement', 'Image', 'location',
|
|
68
|
+
'requestAnimationFrame', 'cancelAnimationFrame', 'matchMedia'].forEach(function (k) {
|
|
69
|
+
if (win[k] === undefined) return;
|
|
70
|
+
try { Object.defineProperty(g, k, { value: win[k], configurable: true, writable: true }); } catch { /* read-only */ }
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
// jsdom has no canvas. Excalidraw probes a 2D context when its module
|
|
74
|
+
// loads; export uses the text sizes already stored in the scene, so a
|
|
75
|
+
// stand-in context is enough and produces the same SVG as a real one.
|
|
76
|
+
win.HTMLCanvasElement.prototype.getContext = function () {
|
|
77
|
+
var ctx = {
|
|
78
|
+
filter: 'none', font: '20px sans-serif', canvas: this,
|
|
79
|
+
measureText: function (t) {
|
|
80
|
+
var px = parseFloat((/(\d+(?:\.\d+)?)px/.exec(this.font) || [])[1] || 20);
|
|
81
|
+
return { width: t.length * px * 0.55, actualBoundingBoxAscent: px * 0.8, actualBoundingBoxDescent: px * 0.2, fontBoundingBoxAscent: px * 0.9, fontBoundingBoxDescent: px * 0.25 };
|
|
82
|
+
},
|
|
83
|
+
};
|
|
84
|
+
return new Proxy(ctx, {
|
|
85
|
+
get: function (o, k) { return k in o ? o[k] : function () {}; },
|
|
86
|
+
set: function (o, k, v) { o[k] = v; return true; },
|
|
87
|
+
});
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
// No CSS Font Loading API in jsdom either.
|
|
91
|
+
function FontFace(family, source, desc) { Object.assign(this, { family: family, source: source, status: 'loaded' }, desc); }
|
|
92
|
+
FontFace.prototype.load = function () { return Promise.resolve(this); };
|
|
93
|
+
g.FontFace = win.FontFace = FontFace;
|
|
94
|
+
var fonts = new Set();
|
|
95
|
+
Object.defineProperty(win.document, 'fonts', {
|
|
96
|
+
value: {
|
|
97
|
+
add: function (f) { fonts.add(f); }, delete: function (f) { return fonts.delete(f); },
|
|
98
|
+
has: function (f) { return fonts.has(f); }, check: function () { return true; },
|
|
99
|
+
load: function () { return Promise.resolve([]); }, ready: Promise.resolve(),
|
|
100
|
+
forEach: function (cb) { fonts.forEach(cb); }, [Symbol.iterator]: function () { return fonts[Symbol.iterator](); },
|
|
101
|
+
addEventListener: function () {}, removeEventListener: function () {},
|
|
102
|
+
},
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
// Excalidraw fetches the fonts it embeds from its asset path; answer those
|
|
106
|
+
// from the vendored copies. Everything else goes to the real fetch (the
|
|
107
|
+
// only other request during export is a data: URL for the subsetter).
|
|
108
|
+
var realFetch = g.fetch;
|
|
109
|
+
g.fetch = win.fetch = function (url, init) {
|
|
110
|
+
var s = String(url && url.url ? url.url : url);
|
|
111
|
+
if (s.startsWith(ASSET_ORIGIN)) {
|
|
112
|
+
var rel = decodeURIComponent(s.slice(ASSET_ORIGIN.length).split(/[?#]/)[0]);
|
|
113
|
+
var file = join(VENDOR, rel);
|
|
114
|
+
if (!file.startsWith(VENDOR) || !existsSync(file)) return Promise.resolve(new Response(null, { status: 404 }));
|
|
115
|
+
return Promise.resolve(new Response(readFileSync(file), { headers: { 'content-type': 'font/woff2' } }));
|
|
116
|
+
}
|
|
117
|
+
// A font the vendored copy lacks (Xiaolai, CJK) makes excalidraw retry
|
|
118
|
+
// on a public CDN; answer that locally too so no request leaves.
|
|
119
|
+
if (/\/fonts\/[^/]+\/[^/]+\.woff2(?:$|[?#])/.test(s)) return Promise.resolve(new Response(null, { status: 404 }));
|
|
120
|
+
return realFetch(url, init);
|
|
121
|
+
};
|
|
122
|
+
win.EXCALIDRAW_ASSET_PATH = ASSET_ORIGIN;
|
|
123
|
+
return import(pathToFileURL(bundle).href);
|
|
124
|
+
}).then(function (m) { return m.exportToSvg; });
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
export async function sceneToSvg(scene) {
|
|
128
|
+
if (!exportToSvgPromise) exportToSvgPromise = installDom();
|
|
129
|
+
var exportToSvg = await exportToSvgPromise;
|
|
130
|
+
var elements = (scene.elements || []).filter(function (e) { return !e.isDeleted; });
|
|
131
|
+
if (!elements.length) throw new Error('the scene has no elements to draw');
|
|
132
|
+
// Excalidraw reports the missing CJK font on console.error; the caller gets
|
|
133
|
+
// one warning from hasCjkText instead.
|
|
134
|
+
var consoleError = console.error;
|
|
135
|
+
console.error = function (first) {
|
|
136
|
+
if (typeof first === 'string' && /^Failed to fetch font family/.test(first)) return;
|
|
137
|
+
consoleError.apply(console, arguments);
|
|
138
|
+
};
|
|
139
|
+
try {
|
|
140
|
+
var svg = await exportToSvg({
|
|
141
|
+
elements: elements,
|
|
142
|
+
appState: Object.assign({}, scene.appState, { exportBackground: true, viewBackgroundColor: '#ffffff' }),
|
|
143
|
+
files: scene.files || {},
|
|
144
|
+
});
|
|
145
|
+
return svg.outerHTML;
|
|
146
|
+
} finally {
|
|
147
|
+
console.error = consoleError;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
// CJK text needs Xiaolai, which the package leaves out (13 MB); it renders blank.
|
|
152
|
+
export function hasCjkText(scene) {
|
|
153
|
+
return (scene.elements || []).some(function (e) {
|
|
154
|
+
return !e.isDeleted && e.type === 'text' && /[⺀-鿿가-豈--]/.test(e.text || '');
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
// ------------------------------------------------------------------ resvg ---
|
|
159
|
+
|
|
160
|
+
// resvg ignores @font-face, and resvg-js 2.6.2 silently ignores fontBuffers, so
|
|
161
|
+
// the woff2 fonts excalidraw embedded are decoded to TTF files and passed as
|
|
162
|
+
// fontFiles. With system fonts off, a glyph no Excalidraw font has is dropped
|
|
163
|
+
// instead of switching the whole label to a system font.
|
|
164
|
+
async function extractFonts(svgText, dir) {
|
|
165
|
+
var wawoff2 = (await import('wawoff2')).default;
|
|
166
|
+
var files = [];
|
|
167
|
+
var re = /url\(data:font\/woff2;base64,([A-Za-z0-9+/=]+)\)/g;
|
|
168
|
+
var m;
|
|
169
|
+
while ((m = re.exec(svgText))) {
|
|
170
|
+
var f = join(dir, files.length + '.ttf');
|
|
171
|
+
writeFileSync(f, Buffer.from(await wawoff2.decompress(Buffer.from(m[1], 'base64'))));
|
|
172
|
+
files.push(f);
|
|
173
|
+
}
|
|
174
|
+
return files;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
// Returns { png, review, width, height, scale, reviewWidth, reviewHeight }.
|
|
178
|
+
export async function svgToPngs(svgText) {
|
|
179
|
+
var { Resvg } = await import('@resvg/resvg-js');
|
|
180
|
+
var dir = mkdtempSync(join(tmpdir(), 'c2m-fonts-'));
|
|
181
|
+
try {
|
|
182
|
+
var fontFiles = await extractFonts(svgText, dir);
|
|
183
|
+
if (/<text[\s>]/.test(svgText) && !fontFiles.length) {
|
|
184
|
+
// Without this check the text would quietly come out in a fallback font.
|
|
185
|
+
throw new Error('no fonts were embedded in the SVG, text would render in the wrong font');
|
|
186
|
+
}
|
|
187
|
+
var font = { fontFiles: fontFiles, loadSystemFonts: false, defaultFontFamily: 'Excalifont' };
|
|
188
|
+
var render = function (fitTo) {
|
|
189
|
+
return new Resvg(svgText, { fitTo: fitTo, background: '#ffffff', font: font }).render();
|
|
190
|
+
};
|
|
191
|
+
var probe = new Resvg(svgText, { font: font });
|
|
192
|
+
var w = probe.width, h = probe.height;
|
|
193
|
+
|
|
194
|
+
var scale = pickScale(w, h);
|
|
195
|
+
var doc = render({ mode: 'zoom', value: scale });
|
|
196
|
+
while (doc.width * doc.height > MAX_PIXELS && scale > 0.01) {
|
|
197
|
+
scale = Math.round((scale - 0.01) * 100) / 100;
|
|
198
|
+
doc = render({ mode: 'zoom', value: scale });
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
var long = Math.max(w, h);
|
|
202
|
+
var reviewLong = Math.min(REVIEW_LONG_SIDE, Math.round(long * 2));
|
|
203
|
+
var review = render(w >= h ? { mode: 'width', value: reviewLong } : { mode: 'height', value: reviewLong });
|
|
204
|
+
|
|
205
|
+
return {
|
|
206
|
+
png: doc.asPng(), width: doc.width, height: doc.height, scale: scale,
|
|
207
|
+
review: review.asPng(), reviewWidth: review.width, reviewHeight: review.height,
|
|
208
|
+
fonts: fontFiles.length,
|
|
209
|
+
};
|
|
210
|
+
} finally {
|
|
211
|
+
rmSync(dir, { recursive: true, force: true });
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
export async function renderScene(scene) {
|
|
216
|
+
return svgToPngs(await sceneToSvg(scene));
|
|
217
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
0.18.1
|