palette-mcp 1.1.1 → 1.1.2

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.
@@ -24,6 +24,7 @@ export declare class CodeGenerator {
24
24
  generateReactComponent(figmaData: FigmaFile, componentName: string): Promise<string>;
25
25
  /**
26
26
  * HTML을 렌더링하여 이미지로 변환
27
+ * puppeteer가 없으면 빈 문자열 반환
27
28
  */
28
29
  private generateImagePreview;
29
30
  /**
@@ -1,5 +1,12 @@
1
1
  import { saveFile, saveBinaryFile, saveMetadata, generateRequestId, getRequestFolderPath } from '../utils/request-manager.js';
2
- import puppeteer from 'puppeteer';
2
+ // puppeteer optional dependency로, 없으면 이미지 프리뷰 기능이 비활성화됨
3
+ let puppeteer = null;
4
+ try {
5
+ puppeteer = (await import('puppeteer')).default;
6
+ }
7
+ catch (e) {
8
+ console.warn('puppeteer를 로드할 수 없습니다. 이미지 프리뷰 기능이 비활성화됩니다.');
9
+ }
3
10
  export class CodeGenerator {
4
11
  designSystemService;
5
12
  constructor(designSystemService) {
@@ -44,8 +51,14 @@ export class CodeGenerator {
44
51
  }
45
52
  /**
46
53
  * HTML을 렌더링하여 이미지로 변환
54
+ * puppeteer가 없으면 빈 문자열 반환
47
55
  */
48
56
  async generateImagePreview(htmlContent, componentName, requestId) {
57
+ // puppeteer가 없으면 이미지 생성 불가
58
+ if (!puppeteer) {
59
+ console.warn('puppeteer가 설치되지 않아 이미지 프리뷰를 생성할 수 없습니다.');
60
+ return '';
61
+ }
49
62
  const browser = await puppeteer.launch({
50
63
  headless: true,
51
64
  args: ['--no-sandbox', '--disable-setuid-sandbox']
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "palette-mcp",
3
- "version": "1.1.1",
3
+ "version": "1.1.2",
4
4
  "description": "MCP server for converting Figma designs to React/Vue components using design system",
5
5
  "main": "dist/index.js",
6
6
  "module": "src/smithery.ts",
@@ -72,9 +72,11 @@
72
72
  "@modelcontextprotocol/sdk": "^0.4.0",
73
73
  "axios": "^1.6.0",
74
74
  "dotenv": "^17.2.3",
75
- "puppeteer": "^21.0.0",
76
75
  "zod": "^3.22.0"
77
76
  },
77
+ "optionalDependencies": {
78
+ "puppeteer": "^21.0.0"
79
+ },
78
80
  "peerDependencies": {
79
81
  "@dealicious/design-system": "*",
80
82
  "@dealicious/design-system-react": "*"
@@ -1,7 +1,14 @@
1
1
  import { FigmaFile, FigmaNode } from './figma.js';
2
2
  import { DesignSystemService, DesignSystemComponent } from './design-system.js';
3
3
  import { saveFile, saveBinaryFile, saveMetadata, generateRequestId, getRequestFolderPath } from '../utils/request-manager.js';
4
- import puppeteer from 'puppeteer';
4
+
5
+ // puppeteer는 optional dependency로, 없으면 이미지 프리뷰 기능이 비활성화됨
6
+ let puppeteer: any = null;
7
+ try {
8
+ puppeteer = (await import('puppeteer')).default;
9
+ } catch (e) {
10
+ console.warn('puppeteer를 로드할 수 없습니다. 이미지 프리뷰 기능이 비활성화됩니다.');
11
+ }
5
12
 
6
13
  export interface GeneratedComponent {
7
14
  name: string;
@@ -77,12 +84,19 @@ export class CodeGenerator {
77
84
 
78
85
  /**
79
86
  * HTML을 렌더링하여 이미지로 변환
87
+ * puppeteer가 없으면 빈 문자열 반환
80
88
  */
81
89
  private async generateImagePreview(
82
90
  htmlContent: string,
83
91
  componentName: string,
84
92
  requestId: string
85
93
  ): Promise<string> {
94
+ // puppeteer가 없으면 이미지 생성 불가
95
+ if (!puppeteer) {
96
+ console.warn('puppeteer가 설치되지 않아 이미지 프리뷰를 생성할 수 없습니다.');
97
+ return '';
98
+ }
99
+
86
100
  const browser = await puppeteer.launch({
87
101
  headless: true,
88
102
  args: ['--no-sandbox', '--disable-setuid-sandbox']