@shotstack/shotstack-canvas 2.0.2 → 2.0.3

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.
@@ -1217,8 +1217,15 @@ var FontRegistry = class _FontRegistry {
1217
1217
  if (this.registeredCanvasFonts.has(family)) {
1218
1218
  return;
1219
1219
  }
1220
+ if (typeof window !== "undefined") {
1221
+ return;
1222
+ }
1220
1223
  try {
1221
- const canvasMod = await import("canvas");
1224
+ const moduleName = "canvas";
1225
+ const canvasMod = await import(
1226
+ /* @vite-ignore */
1227
+ moduleName
1228
+ );
1222
1229
  const GlobalFonts = canvasMod.GlobalFonts;
1223
1230
  if (GlobalFonts && typeof GlobalFonts.register === "function") {
1224
1231
  const buffer = Buffer.from(bytes);
@@ -828,8 +828,15 @@ var FontRegistry = class _FontRegistry {
828
828
  if (this.registeredCanvasFonts.has(family)) {
829
829
  return;
830
830
  }
831
+ if (typeof window !== "undefined") {
832
+ return;
833
+ }
831
834
  try {
832
- const canvasMod = await import("canvas");
835
+ const moduleName = "canvas";
836
+ const canvasMod = await import(
837
+ /* @vite-ignore */
838
+ moduleName
839
+ );
833
840
  const GlobalFonts = canvasMod.GlobalFonts;
834
841
  if (GlobalFonts && typeof GlobalFonts.register === "function") {
835
842
  const buffer = Buffer.from(bytes);
package/dist/entry.web.js CHANGED
@@ -32096,8 +32096,15 @@ var _FontRegistry = class _FontRegistry {
32096
32096
  if (this.registeredCanvasFonts.has(family)) {
32097
32097
  return;
32098
32098
  }
32099
+ if (typeof window !== "undefined") {
32100
+ return;
32101
+ }
32099
32102
  try {
32100
- const canvasMod = await import("canvas");
32103
+ const moduleName = "canvas";
32104
+ const canvasMod = await import(
32105
+ /* @vite-ignore */
32106
+ moduleName
32107
+ );
32101
32108
  const GlobalFonts = canvasMod.GlobalFonts;
32102
32109
  if (GlobalFonts && typeof GlobalFonts.register === "function") {
32103
32110
  const buffer = Buffer.from(bytes);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shotstack/shotstack-canvas",
3
- "version": "2.0.2",
3
+ "version": "2.0.3",
4
4
  "description": "Text layout & animation engine (HarfBuzz) for Node & Web - fully self-contained.",
5
5
  "type": "module",
6
6
  "main": "./dist/entry.node.cjs",