vizmatic 0.1.8 → 0.1.10
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 +17 -3
- package/dist/index.cjs +21 -7
- package/dist/index.js +17 -3
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -4706,7 +4706,6 @@ function Legend({ items, c, title }) {
|
|
|
4706
4706
|
}
|
|
4707
4707
|
|
|
4708
4708
|
// src/render.ts
|
|
4709
|
-
import satori from "satori";
|
|
4710
4709
|
import { Resvg } from "@resvg/resvg-js";
|
|
4711
4710
|
import { homedir } from "os";
|
|
4712
4711
|
import { readFile, writeFile, mkdir } from "fs/promises";
|
|
@@ -4972,6 +4971,22 @@ function detectOverflow(pixels, width, height, bgColor, edgeTolerance = 3, minDe
|
|
|
4972
4971
|
};
|
|
4973
4972
|
}
|
|
4974
4973
|
|
|
4974
|
+
// src/satori.ts
|
|
4975
|
+
import * as satoriModule from "satori";
|
|
4976
|
+
function resolveSatori(api) {
|
|
4977
|
+
if (typeof api === "function") return api;
|
|
4978
|
+
if (api && typeof api === "object") {
|
|
4979
|
+
const fallback = api.default;
|
|
4980
|
+
if (typeof fallback === "function") return fallback;
|
|
4981
|
+
if (fallback && typeof fallback === "object") {
|
|
4982
|
+
const nestedFallback = fallback.default;
|
|
4983
|
+
if (typeof nestedFallback === "function") return nestedFallback;
|
|
4984
|
+
}
|
|
4985
|
+
}
|
|
4986
|
+
throw new Error("satori export could not be resolved");
|
|
4987
|
+
}
|
|
4988
|
+
var satori = resolveSatori(satoriModule);
|
|
4989
|
+
|
|
4975
4990
|
// src/render.ts
|
|
4976
4991
|
var FONT_DIR = process.env.VIZMATIC_FONT_DIR ?? join(process.env.XDG_CACHE_HOME ?? join(homedir(), ".cache"), "vizmatic", "fonts");
|
|
4977
4992
|
var FONT_URLS = {
|
|
@@ -5208,7 +5223,6 @@ async function renderToSvg(element, width, height, options = {}) {
|
|
|
5208
5223
|
}
|
|
5209
5224
|
|
|
5210
5225
|
// src/animate.ts
|
|
5211
|
-
import satori2 from "satori";
|
|
5212
5226
|
import { Resvg as Resvg2 } from "@resvg/resvg-js";
|
|
5213
5227
|
import { mkdir as mkdir2, writeFile as writeFile2 } from "fs/promises";
|
|
5214
5228
|
import { dirname as dirname2 } from "path";
|
|
@@ -5226,7 +5240,7 @@ function resolveGifenc(api) {
|
|
|
5226
5240
|
var { GIFEncoder, applyPalette, quantize } = resolveGifenc(gifenc);
|
|
5227
5241
|
async function renderToPixels(element, width, height, scale) {
|
|
5228
5242
|
const fonts = await getFonts();
|
|
5229
|
-
const svg = await
|
|
5243
|
+
const svg = await satori(element, {
|
|
5230
5244
|
width,
|
|
5231
5245
|
height,
|
|
5232
5246
|
fonts,
|
package/dist/index.cjs
CHANGED
|
@@ -4720,7 +4720,6 @@ function Legend({ items, c, title }) {
|
|
|
4720
4720
|
}
|
|
4721
4721
|
|
|
4722
4722
|
// src/render.ts
|
|
4723
|
-
var import_satori = __toESM(require("satori"), 1);
|
|
4724
4723
|
var import_resvg_js = require("@resvg/resvg-js");
|
|
4725
4724
|
var import_os = require("os");
|
|
4726
4725
|
var import_promises = require("fs/promises");
|
|
@@ -4986,6 +4985,22 @@ function detectOverflow(pixels, width, height, bgColor, edgeTolerance = 3, minDe
|
|
|
4986
4985
|
};
|
|
4987
4986
|
}
|
|
4988
4987
|
|
|
4988
|
+
// src/satori.ts
|
|
4989
|
+
var satoriModule = __toESM(require("satori"), 1);
|
|
4990
|
+
function resolveSatori(api) {
|
|
4991
|
+
if (typeof api === "function") return api;
|
|
4992
|
+
if (api && typeof api === "object") {
|
|
4993
|
+
const fallback = api.default;
|
|
4994
|
+
if (typeof fallback === "function") return fallback;
|
|
4995
|
+
if (fallback && typeof fallback === "object") {
|
|
4996
|
+
const nestedFallback = fallback.default;
|
|
4997
|
+
if (typeof nestedFallback === "function") return nestedFallback;
|
|
4998
|
+
}
|
|
4999
|
+
}
|
|
5000
|
+
throw new Error("satori export could not be resolved");
|
|
5001
|
+
}
|
|
5002
|
+
var satori = resolveSatori(satoriModule);
|
|
5003
|
+
|
|
4989
5004
|
// src/render.ts
|
|
4990
5005
|
var FONT_DIR = process.env.VIZMATIC_FONT_DIR ?? (0, import_path.join)(process.env.XDG_CACHE_HOME ?? (0, import_path.join)((0, import_os.homedir)(), ".cache"), "vizmatic", "fonts");
|
|
4991
5006
|
var FONT_URLS = {
|
|
@@ -5108,7 +5123,7 @@ function resolveWatermark(options) {
|
|
|
5108
5123
|
}
|
|
5109
5124
|
async function renderToPng(element, options, createFn, theme) {
|
|
5110
5125
|
const fonts = await getFonts();
|
|
5111
|
-
let svg = await (
|
|
5126
|
+
let svg = await satori(element, {
|
|
5112
5127
|
width: options.width,
|
|
5113
5128
|
height: options.height,
|
|
5114
5129
|
fonts,
|
|
@@ -5160,7 +5175,7 @@ async function renderToPng(element, options, createFn, theme) {
|
|
|
5160
5175
|
theme || "dark",
|
|
5161
5176
|
watermark
|
|
5162
5177
|
) : finalElement;
|
|
5163
|
-
let finalSvg = await (
|
|
5178
|
+
let finalSvg = await satori(outputElement, {
|
|
5164
5179
|
width: finalWidth,
|
|
5165
5180
|
height: finalHeight,
|
|
5166
5181
|
fonts,
|
|
@@ -5189,7 +5204,7 @@ async function renderToBuffer(element, width, height, options = {}) {
|
|
|
5189
5204
|
"dark",
|
|
5190
5205
|
watermark
|
|
5191
5206
|
) : element;
|
|
5192
|
-
let svg = await (
|
|
5207
|
+
let svg = await satori(outputElement, {
|
|
5193
5208
|
width,
|
|
5194
5209
|
height,
|
|
5195
5210
|
fonts,
|
|
@@ -5212,7 +5227,7 @@ async function renderToSvg(element, width, height, options = {}) {
|
|
|
5212
5227
|
"dark",
|
|
5213
5228
|
watermark
|
|
5214
5229
|
) : element;
|
|
5215
|
-
const svg = await (
|
|
5230
|
+
const svg = await satori(outputElement, {
|
|
5216
5231
|
width,
|
|
5217
5232
|
height,
|
|
5218
5233
|
fonts,
|
|
@@ -5222,7 +5237,6 @@ async function renderToSvg(element, width, height, options = {}) {
|
|
|
5222
5237
|
}
|
|
5223
5238
|
|
|
5224
5239
|
// src/animate.ts
|
|
5225
|
-
var import_satori2 = __toESM(require("satori"), 1);
|
|
5226
5240
|
var import_resvg_js2 = require("@resvg/resvg-js");
|
|
5227
5241
|
var import_promises2 = require("fs/promises");
|
|
5228
5242
|
var import_path2 = require("path");
|
|
@@ -5240,7 +5254,7 @@ function resolveGifenc(api) {
|
|
|
5240
5254
|
var { GIFEncoder, applyPalette, quantize } = resolveGifenc(gifenc);
|
|
5241
5255
|
async function renderToPixels(element, width, height, scale) {
|
|
5242
5256
|
const fonts = await getFonts();
|
|
5243
|
-
const svg = await (
|
|
5257
|
+
const svg = await satori(element, {
|
|
5244
5258
|
width,
|
|
5245
5259
|
height,
|
|
5246
5260
|
fonts,
|
package/dist/index.js
CHANGED
|
@@ -4594,7 +4594,6 @@ function Legend({ items, c, title }) {
|
|
|
4594
4594
|
}
|
|
4595
4595
|
|
|
4596
4596
|
// src/render.ts
|
|
4597
|
-
import satori from "satori";
|
|
4598
4597
|
import { Resvg } from "@resvg/resvg-js";
|
|
4599
4598
|
import { homedir } from "os";
|
|
4600
4599
|
import { readFile, writeFile, mkdir } from "fs/promises";
|
|
@@ -4860,6 +4859,22 @@ function detectOverflow(pixels, width, height, bgColor, edgeTolerance = 3, minDe
|
|
|
4860
4859
|
};
|
|
4861
4860
|
}
|
|
4862
4861
|
|
|
4862
|
+
// src/satori.ts
|
|
4863
|
+
import * as satoriModule from "satori";
|
|
4864
|
+
function resolveSatori(api) {
|
|
4865
|
+
if (typeof api === "function") return api;
|
|
4866
|
+
if (api && typeof api === "object") {
|
|
4867
|
+
const fallback = api.default;
|
|
4868
|
+
if (typeof fallback === "function") return fallback;
|
|
4869
|
+
if (fallback && typeof fallback === "object") {
|
|
4870
|
+
const nestedFallback = fallback.default;
|
|
4871
|
+
if (typeof nestedFallback === "function") return nestedFallback;
|
|
4872
|
+
}
|
|
4873
|
+
}
|
|
4874
|
+
throw new Error("satori export could not be resolved");
|
|
4875
|
+
}
|
|
4876
|
+
var satori = resolveSatori(satoriModule);
|
|
4877
|
+
|
|
4863
4878
|
// src/render.ts
|
|
4864
4879
|
var FONT_DIR = process.env.VIZMATIC_FONT_DIR ?? join(process.env.XDG_CACHE_HOME ?? join(homedir(), ".cache"), "vizmatic", "fonts");
|
|
4865
4880
|
var FONT_URLS = {
|
|
@@ -5096,7 +5111,6 @@ async function renderToSvg(element, width, height, options = {}) {
|
|
|
5096
5111
|
}
|
|
5097
5112
|
|
|
5098
5113
|
// src/animate.ts
|
|
5099
|
-
import satori2 from "satori";
|
|
5100
5114
|
import { Resvg as Resvg2 } from "@resvg/resvg-js";
|
|
5101
5115
|
import { mkdir as mkdir2, writeFile as writeFile2 } from "fs/promises";
|
|
5102
5116
|
import { dirname as dirname2 } from "path";
|
|
@@ -5114,7 +5128,7 @@ function resolveGifenc(api) {
|
|
|
5114
5128
|
var { GIFEncoder, applyPalette, quantize } = resolveGifenc(gifenc);
|
|
5115
5129
|
async function renderToPixels(element, width, height, scale) {
|
|
5116
5130
|
const fonts = await getFonts();
|
|
5117
|
-
const svg = await
|
|
5131
|
+
const svg = await satori(element, {
|
|
5118
5132
|
width,
|
|
5119
5133
|
height,
|
|
5120
5134
|
fonts,
|
package/package.json
CHANGED