@liner-fe/internal-icon 1.0.44 → 1.0.46

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/.ultra.cache.json CHANGED
@@ -1 +1 @@
1
- {"files":{"lib":"1777427175120.917","node_modules":"1777427162557.5881","CHANGELOG.md":"cae98c429f412cac5a6f0e573055b050eef4e717","README.md":"e0a89d4fcf5bddf1f816bfb20a928ddb301b8d2c","figma.json":"59f77fec62cc40cbfa38d3cc1851e37cad331146","package.json":"1accd1d77b6eeaf895bdbab11a37efd92a707cb8","src/generate-svg-files.ts":"6e4949b774de5b509eaab4a1a8efa600ee9a17fc","src/generate-tsx-components.ts":"52991558d51f4d6261d637f36f0ff457c78a9670","src/index.ts":"9e03c9c45c92fc534262982bce233b91892c05f1","tsconfig.json":"298030567ca332304807fcdbb95d1218c9c0814f","tsup.config.ts":"8460f94f8ebd1d42fb4cc968298195ae5dd67cde"},"deps":{}}
1
+ {"files":{"lib":"1778047140151.011","node_modules":"1778047125418.0737","CHANGELOG.md":"4cb59c0a03001fa11b7262a208191de8e48dc596","README.md":"e0a89d4fcf5bddf1f816bfb20a928ddb301b8d2c","figma.json":"59f77fec62cc40cbfa38d3cc1851e37cad331146","package.json":"693c54264a46a41b2fb8b06e3e44f8e5e72272e9","src/generate-svg-files.ts":"6e4949b774de5b509eaab4a1a8efa600ee9a17fc","src/generate-tsx-components.ts":"209fd8782cb7788e7fce3dbd79aee875ee7f317f","src/index.ts":"9e03c9c45c92fc534262982bce233b91892c05f1","tsconfig.json":"298030567ca332304807fcdbb95d1218c9c0814f","tsup.config.ts":"8460f94f8ebd1d42fb4cc968298195ae5dd67cde"},"deps":{}}
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @internal/icon
2
2
 
3
+ ## 1.0.46
4
+
5
+ ### Patch Changes
6
+
7
+ - 112e68c: generate-tsx-components의 SVGO 설정에서 `cleanupIds`를 비활성화. 같은 페이지에 inline 렌더되는 아이콘들이 축약된 generic id(`a`, `b` 등)를 공유해 `url(#a)` 참조가 다른 아이콘의 정의를 가리키며 깨지던 문제 수정 (예: color-hwp가 color-table의 clipPath를 참조해 깨짐).
8
+
9
+ ## 1.0.45
10
+
11
+ ### Patch Changes
12
+
13
+ - dc55569: generate-tsx-components 에도 SVGO 적용. 아이콘 TSX 번들 크기 감소: @liner-fe/icon -26.4% (902 → 664 KB unpacked), @liner-fe/icon-rn -30.0% (448 → 314 KB unpacked).
14
+
3
15
  ## 1.0.44
4
16
 
5
17
  ### Patch Changes
package/lib/index.js CHANGED
@@ -52,7 +52,25 @@ var generateSvgFiles = /* @__PURE__ */ __name(() => {
52
52
  // src/generate-tsx-components.ts
53
53
  import fs2 from "fs";
54
54
  import path3 from "path";
55
+ import { optimize as optimize2 } from "svgo";
55
56
  var generateTsxComponents = /* @__PURE__ */ __name(() => {
57
+ function optimizeSvg(svgString) {
58
+ return optimize2(svgString, {
59
+ multipass: true,
60
+ plugins: [
61
+ {
62
+ name: "preset-default",
63
+ params: {
64
+ overrides: {
65
+ convertColors: false,
66
+ cleanupIds: false
67
+ }
68
+ }
69
+ }
70
+ ]
71
+ }).data;
72
+ }
73
+ __name(optimizeSvg, "optimizeSvg");
56
74
  const FIGMA_DATA_PATH = path3.resolve(__dirname, "../figma.json");
57
75
  const OUTPUT_DIR = "./assets";
58
76
  const INDEX_FILE_PATH = "./index.tsx";
@@ -104,7 +122,9 @@ var generateTsxComponents = /* @__PURE__ */ __name(() => {
104
122
  };
105
123
  Object.entries(variants).forEach(([variant, svgString]) => {
106
124
  if (svgString && svgString.trim() !== "") {
107
- variantSvgs[variant] = normalizeSvgAttributes(convertToCurrentColor(svgString));
125
+ variantSvgs[variant] = normalizeSvgAttributes(
126
+ convertToCurrentColor(optimizeSvg(svgString))
127
+ );
108
128
  }
109
129
  });
110
130
  return variantSvgs;
@@ -153,7 +173,7 @@ export const Icon${componentName} = forwardRef<SVGSVGElement, IconProps>(
153
173
  const tsxCode = generateColorTsxComponent(
154
174
  componentName,
155
175
  // @ts-ignore
156
- normalizeSvgAttributes(variants.default)
176
+ normalizeSvgAttributes(optimizeSvg(variants.default))
157
177
  );
158
178
  const filePath = path3.join(iconDir, "index.tsx");
159
179
  fs2.writeFileSync(filePath, tsxCode);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@liner-fe/internal-icon",
3
- "version": "1.0.44",
3
+ "version": "1.0.46",
4
4
  "type": "module",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -1,7 +1,25 @@
1
1
  import fs from 'fs';
2
2
  import path from 'path';
3
+ import { optimize } from 'svgo';
3
4
 
4
5
  export const generateTsxComponents = () => {
6
+ function optimizeSvg(svgString: string): string {
7
+ return optimize(svgString, {
8
+ multipass: true,
9
+ plugins: [
10
+ {
11
+ name: 'preset-default',
12
+ params: {
13
+ overrides: {
14
+ convertColors: false,
15
+ cleanupIds: false,
16
+ },
17
+ },
18
+ },
19
+ ],
20
+ }).data;
21
+ }
22
+
5
23
  // 상수 정의
6
24
  const FIGMA_DATA_PATH = path.resolve(__dirname, '../figma.json');
7
25
  const OUTPUT_DIR = './assets';
@@ -86,7 +104,9 @@ export const generateTsxComponents = () => {
86
104
  Object.entries(variants).forEach(([variant, svgString]) => {
87
105
  if (svgString && svgString.trim() !== '') {
88
106
  // @ts-ignore
89
- variantSvgs[variant] = normalizeSvgAttributes(convertToCurrentColor(svgString));
107
+ variantSvgs[variant] = normalizeSvgAttributes(
108
+ convertToCurrentColor(optimizeSvg(svgString)),
109
+ );
90
110
  }
91
111
  });
92
112
 
@@ -147,7 +167,7 @@ export const Icon${componentName} = forwardRef<SVGSVGElement, IconProps>(
147
167
  const tsxCode = generateColorTsxComponent(
148
168
  componentName,
149
169
  // @ts-ignore
150
- normalizeSvgAttributes(variants.default),
170
+ normalizeSvgAttributes(optimizeSvg(variants.default)),
151
171
  );
152
172
 
153
173
  const filePath = path.join(iconDir, 'index.tsx');