@liner-fe/icon 0.1.19 → 0.1.20

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/package.json CHANGED
@@ -1,10 +1,12 @@
1
1
  {
2
2
  "name": "@liner-fe/icon",
3
- "version": "0.1.19",
3
+ "version": "0.1.20",
4
4
  "type": "module",
5
5
  "sideEffects": false,
6
6
  "scripts": {
7
- "build": "yarn tsup --config ./config/tsup/tsup.config.ts"
7
+ "build": "yarn tsup --config ./config/tsup/tsup.config.ts && yarn forward-ref-pure",
8
+ "ts-node": "tsx --tsconfig ./tsconfig.build.json",
9
+ "forward-ref-pure": "yarn ts-node ./scripts/forward-ref-pure.ts"
8
10
  },
9
11
  "publishConfig": {
10
12
  "access": "public",
@@ -15,21 +17,11 @@
15
17
  ],
16
18
  "main": "./lib/index.js",
17
19
  "types": "./lib/index.d.ts",
18
- "exports": {
19
- ".": {
20
- "import": "./lib/index.js",
21
- "types": "./lib/index.d.ts"
22
- },
23
- "./assets/*": {
24
- "import": "./lib/assets/*/index.js",
25
- "types": "./lib/assets/*/index.d.ts"
26
- }
27
- },
28
20
  "dependencies": {
29
- "@liner-fe/design-token-primitive": "workspace:^"
21
+ "@liner-fe/design-token-primitive": "workspace:^",
22
+ "tsx": "^4.20.5"
30
23
  },
31
24
  "devDependencies": {
32
- "glob": "^10.3.10",
33
25
  "tsup": "^8.5.0"
34
26
  }
35
27
  }
@@ -0,0 +1,51 @@
1
+ import fs from 'fs';
2
+ import path from 'path';
3
+ import { fileURLToPath } from 'url';
4
+
5
+ // TypeScript/JavaScript 파일에서 forwardRef 앞에 /* @__PURE__ */ 주석을 추가하는 함수
6
+ function addPureAnnotationToForwardRef(filePath: string): void {
7
+ const content = fs.readFileSync(filePath, 'utf-8');
8
+
9
+ // forwardRef 앞에 이미 /* @__PURE__ */ 주석이 있는지 확인하고, 없으면 추가
10
+ const forwardRefPattern = /(?<!\/\*\s*@__PURE__\s*\*\/\s*)forwardRef/g;
11
+
12
+ if (forwardRefPattern.test(content)) {
13
+ const updatedContent = content.replace(
14
+ /(?<!\/\*\s*@__PURE__\s*\*\/\s*)forwardRef/g,
15
+ '/* @__PURE__ */ forwardRef',
16
+ );
17
+
18
+ if (updatedContent !== content) {
19
+ fs.writeFileSync(filePath, updatedContent);
20
+ console.log(`✅ Updated: ${filePath}`);
21
+ }
22
+ }
23
+ }
24
+
25
+ // 메인 실행 함수
26
+ function main(): void {
27
+ try {
28
+ // 특정 파일 경로
29
+ const targetFile = './lib/index.js';
30
+
31
+ if (!fs.existsSync(targetFile)) {
32
+ console.error(`❌ File not found: ${targetFile}`);
33
+ process.exit(1);
34
+ }
35
+
36
+ console.log(`🔍 Processing file: ${targetFile}`);
37
+
38
+ addPureAnnotationToForwardRef(targetFile);
39
+
40
+ console.log('✨ Processing completed!');
41
+ } catch (error) {
42
+ console.error('❌ Error:', error);
43
+ process.exit(1);
44
+ }
45
+ }
46
+
47
+ // ES 모듈에서 스크립트 직접 실행 체크
48
+ const __filename = fileURLToPath(import.meta.url);
49
+ if (process.argv[1] === __filename) {
50
+ main();
51
+ }