figma-metadata-extractor 1.0.5 → 1.0.6

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
@@ -124,6 +124,7 @@ function generateImageCSSVariables({
124
124
  }
125
125
  const Logger = {
126
126
  isHTTP: false,
127
+ enableLogging: false,
127
128
  log: (...args) => {
128
129
  if (Logger.isHTTP) {
129
130
  console.log("[INFO]", ...args);
@@ -136,6 +137,7 @@ const Logger = {
136
137
  }
137
138
  };
138
139
  function writeLogs(name, value) {
140
+ if (!Logger.enableLogging) return;
139
141
  if (process.env.NODE_ENV !== "development") return;
140
142
  try {
141
143
  const logsDir = "logs";
@@ -1375,8 +1377,10 @@ async function getFigmaMetadata(figmaUrl, options = {}) {
1375
1377
  localPath,
1376
1378
  imageFormat = "png",
1377
1379
  pngScale = 2,
1378
- useRelativePaths = true
1380
+ useRelativePaths = true,
1381
+ enableLogging = false
1379
1382
  } = options;
1383
+ Logger.enableLogging = enableLogging;
1380
1384
  if (!apiKey && !oauthToken) {
1381
1385
  throw new Error("Either apiKey or oauthToken is required");
1382
1386
  }
@@ -1451,7 +1455,8 @@ async function getFigmaMetadata(figmaUrl, options = {}) {
1451
1455
  }
1452
1456
  }
1453
1457
  async function downloadFigmaImages(figmaUrl, nodes, options) {
1454
- const { apiKey, oauthToken, useOAuth = false, pngScale = 2, localPath } = options;
1458
+ const { apiKey, oauthToken, useOAuth = false, pngScale = 2, localPath, enableLogging = false } = options;
1459
+ Logger.enableLogging = enableLogging;
1455
1460
  if (!apiKey && !oauthToken) {
1456
1461
  throw new Error("Either apiKey or oauthToken is required");
1457
1462
  }
@@ -1487,8 +1492,10 @@ async function downloadFigmaFrameImage(figmaUrl, options) {
1487
1492
  pngScale = 2,
1488
1493
  localPath,
1489
1494
  fileName,
1490
- format = "png"
1495
+ format = "png",
1496
+ enableLogging = false
1491
1497
  } = options;
1498
+ Logger.enableLogging = enableLogging;
1492
1499
  if (!apiKey && !oauthToken) {
1493
1500
  throw new Error("Either apiKey or oauthToken is required");
1494
1501
  }
package/dist/index.js CHANGED
@@ -122,6 +122,7 @@ function generateImageCSSVariables({
122
122
  }
123
123
  const Logger = {
124
124
  isHTTP: false,
125
+ enableLogging: false,
125
126
  log: (...args) => {
126
127
  if (Logger.isHTTP) {
127
128
  console.log("[INFO]", ...args);
@@ -134,6 +135,7 @@ const Logger = {
134
135
  }
135
136
  };
136
137
  function writeLogs(name, value) {
138
+ if (!Logger.enableLogging) return;
137
139
  if (process.env.NODE_ENV !== "development") return;
138
140
  try {
139
141
  const logsDir = "logs";
@@ -1373,8 +1375,10 @@ async function getFigmaMetadata(figmaUrl, options = {}) {
1373
1375
  localPath,
1374
1376
  imageFormat = "png",
1375
1377
  pngScale = 2,
1376
- useRelativePaths = true
1378
+ useRelativePaths = true,
1379
+ enableLogging = false
1377
1380
  } = options;
1381
+ Logger.enableLogging = enableLogging;
1378
1382
  if (!apiKey && !oauthToken) {
1379
1383
  throw new Error("Either apiKey or oauthToken is required");
1380
1384
  }
@@ -1449,7 +1453,8 @@ async function getFigmaMetadata(figmaUrl, options = {}) {
1449
1453
  }
1450
1454
  }
1451
1455
  async function downloadFigmaImages(figmaUrl, nodes, options) {
1452
- const { apiKey, oauthToken, useOAuth = false, pngScale = 2, localPath } = options;
1456
+ const { apiKey, oauthToken, useOAuth = false, pngScale = 2, localPath, enableLogging = false } = options;
1457
+ Logger.enableLogging = enableLogging;
1453
1458
  if (!apiKey && !oauthToken) {
1454
1459
  throw new Error("Either apiKey or oauthToken is required");
1455
1460
  }
@@ -1485,8 +1490,10 @@ async function downloadFigmaFrameImage(figmaUrl, options) {
1485
1490
  pngScale = 2,
1486
1491
  localPath,
1487
1492
  fileName,
1488
- format = "png"
1493
+ format = "png",
1494
+ enableLogging = false
1489
1495
  } = options;
1496
+ Logger.enableLogging = enableLogging;
1490
1497
  if (!apiKey && !oauthToken) {
1491
1498
  throw new Error("Either apiKey or oauthToken is required");
1492
1499
  }
package/dist/lib.d.ts CHANGED
@@ -25,6 +25,8 @@ export interface FigmaMetadataOptions {
25
25
  * Default: true
26
26
  */
27
27
  useRelativePaths?: boolean | string;
28
+ /** Enable JSON debug log files (defaults to false) */
29
+ enableLogging?: boolean;
28
30
  }
29
31
  export interface FigmaImageOptions {
30
32
  /** Export scale for PNG images (defaults to 2) */
@@ -77,6 +79,8 @@ export interface FigmaFrameImageOptions {
77
79
  fileName: string;
78
80
  /** Image format to download (defaults to 'png') */
79
81
  format?: 'png' | 'svg';
82
+ /** Enable JSON debug log files (defaults to false) */
83
+ enableLogging?: boolean;
80
84
  }
81
85
  /**
82
86
  * Extract metadata from a Figma file or specific nodes
@@ -1,5 +1,6 @@
1
1
  export declare const Logger: {
2
2
  isHTTP: boolean;
3
+ enableLogging: boolean;
3
4
  log: (...args: any[]) => void;
4
5
  error: (...args: any[]) => void;
5
6
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "figma-metadata-extractor",
3
- "version": "1.0.5",
3
+ "version": "1.0.6",
4
4
  "description": "Extract metadata and download images from Figma files. A standalone library for accessing Figma design data and downloading frame images programmatically.",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs",