@dskripchenko/diagrams 1.0.0 → 1.0.1

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/index.cjs CHANGED
@@ -398,6 +398,7 @@ function context() {
398
398
  canvasContext = null;
399
399
  try {
400
400
  const g = globalThis;
401
+ if (g.navigator?.userAgent?.includes("jsdom")) return canvasContext;
401
402
  if (typeof g.OffscreenCanvas === "function") canvasContext = new g.OffscreenCanvas(1, 1).getContext("2d");
402
403
  else if (g.document && typeof g.document.createElement === "function") canvasContext = g.document.createElement("canvas").getContext("2d");
403
404
  if (canvasContext && canvasContext.measureText("M").width <= 0) canvasContext = null;
package/dist/index.mjs CHANGED
@@ -397,6 +397,7 @@ function context() {
397
397
  canvasContext = null;
398
398
  try {
399
399
  const g = globalThis;
400
+ if (g.navigator?.userAgent?.includes("jsdom")) return canvasContext;
400
401
  if (typeof g.OffscreenCanvas === "function") canvasContext = new g.OffscreenCanvas(1, 1).getContext("2d");
401
402
  else if (g.document && typeof g.document.createElement === "function") canvasContext = g.document.createElement("canvas").getContext("2d");
402
403
  if (canvasContext && canvasContext.measureText("M").width <= 0) canvasContext = null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dskripchenko/diagrams",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "Mermaid-syntax diagrams rendered to SVG with zero runtime dependencies — flowchart, sequence, state, pie, gantt",
5
5
  "keywords": [
6
6
  "diagram",
@@ -30,7 +30,6 @@
30
30
  "engines": {
31
31
  "node": ">=20"
32
32
  },
33
- "packageManager": "pnpm@10.28.0",
34
33
  "publishConfig": {
35
34
  "access": "public"
36
35
  },
@@ -50,21 +49,12 @@
50
49
  "dist",
51
50
  "!dist/**/*.map"
52
51
  ],
53
- "scripts": {
54
- "build": "tsc --noEmit -p tsconfig.build.json && vite build",
55
- "test": "vitest run",
56
- "test:watch": "vitest",
57
- "lint": "eslint src tests scripts",
58
- "typecheck": "tsc --noEmit",
59
- "changeset": "changeset",
60
- "release": "pnpm build && changeset publish",
61
- "check:browser": "node scripts/browser-check.mjs"
62
- },
63
52
  "devDependencies": {
64
53
  "@changesets/cli": "^3.0.3",
65
54
  "@eslint/js": "^10.0.1",
66
55
  "@microsoft/api-extractor": "^7.59.4",
67
56
  "eslint": "^10.13.0",
57
+ "jsdom": "^29.1.1",
68
58
  "playwright": "1.64.1",
69
59
  "prettier": "^3.9.10",
70
60
  "typescript": "^6.0.3",
@@ -72,5 +62,15 @@
72
62
  "vite": "^8.3.5",
73
63
  "vite-plugin-dts": "^5.1.2",
74
64
  "vitest": "^5.0.5"
65
+ },
66
+ "scripts": {
67
+ "build": "tsc --noEmit -p tsconfig.build.json && vite build",
68
+ "test": "vitest run",
69
+ "test:watch": "vitest",
70
+ "lint": "eslint src tests scripts",
71
+ "typecheck": "tsc --noEmit",
72
+ "changeset": "changeset",
73
+ "release": "pnpm build && changeset publish",
74
+ "check:browser": "node scripts/browser-check.mjs"
75
75
  }
76
- }
76
+ }