metadatafy 1.0.1 → 1.0.3

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.
@@ -1,1329 +0,0 @@
1
- import ts3 from 'typescript';
2
- import * as path2 from 'path';
3
- import * as fs from 'fs';
4
- import * as crypto from 'crypto';
5
- import { glob } from 'glob';
6
- import * as fs3 from 'fs/promises';
7
-
8
- // src/core/config.ts
9
- var DEFAULT_FILE_TYPE_MAPPING = {
10
- // Next.js App Router
11
- "app/**/page.tsx": "route",
12
- "app/**/page.ts": "route",
13
- "app/**/layout.tsx": "route",
14
- "app/**/layout.ts": "route",
15
- "app/**/route.tsx": "api",
16
- "app/**/route.ts": "api",
17
- "app/api/**/*.ts": "api",
18
- "app/api/**/*.tsx": "api",
19
- // Pages Router (레거시)
20
- "pages/**/*.tsx": "route",
21
- "pages/**/*.ts": "route",
22
- "pages/api/**/*.ts": "api",
23
- // Components
24
- "components/**/*.tsx": "component",
25
- "components/**/*.ts": "component",
26
- "src/components/**/*.tsx": "component",
27
- "src/components/**/*.ts": "component",
28
- // Hooks
29
- "hooks/**/*.ts": "hook",
30
- "hooks/**/*.tsx": "hook",
31
- "src/hooks/**/*.ts": "hook",
32
- "src/hooks/**/*.tsx": "hook",
33
- // Services
34
- "services/**/*.ts": "service",
35
- "src/services/**/*.ts": "service",
36
- // Utilities
37
- "lib/**/*.ts": "utility",
38
- "src/lib/**/*.ts": "utility",
39
- "utils/**/*.ts": "utility",
40
- "src/utils/**/*.ts": "utility",
41
- // Database
42
- "supabase/migrations/*.sql": "table",
43
- "prisma/migrations/**/*.sql": "table"
44
- };
45
- var DEFAULT_INCLUDE_PATTERNS = [
46
- "app/**/*.{ts,tsx}",
47
- "pages/**/*.{ts,tsx}",
48
- "components/**/*.{ts,tsx}",
49
- "hooks/**/*.{ts,tsx}",
50
- "services/**/*.ts",
51
- "lib/**/*.ts",
52
- "utils/**/*.ts",
53
- "src/**/*.{ts,tsx}",
54
- "supabase/migrations/*.sql"
55
- ];
56
- var DEFAULT_EXCLUDE_PATTERNS = [
57
- "**/node_modules/**",
58
- "**/.next/**",
59
- "**/dist/**",
60
- "**/*.test.{ts,tsx}",
61
- "**/*.spec.{ts,tsx}",
62
- "**/__tests__/**",
63
- "**/*.d.ts",
64
- "**/coverage/**"
65
- ];
66
- function createDefaultConfig(overrides = {}) {
67
- return {
68
- projectId: overrides.projectId || "default",
69
- include: overrides.include || DEFAULT_INCLUDE_PATTERNS,
70
- exclude: overrides.exclude || DEFAULT_EXCLUDE_PATTERNS,
71
- fileTypeMapping: {
72
- ...DEFAULT_FILE_TYPE_MAPPING,
73
- ...overrides.fileTypeMapping
74
- },
75
- output: {
76
- file: {
77
- enabled: true,
78
- path: "project-metadata.json",
79
- ...overrides.output?.file
80
- },
81
- api: {
82
- enabled: false,
83
- endpoint: "",
84
- ...overrides.output?.api
85
- }
86
- },
87
- koreanKeywords: overrides.koreanKeywords,
88
- mode: overrides.mode || "production",
89
- verbose: overrides.verbose || false
90
- };
91
- }
92
- function validateConfig(config) {
93
- const errors = [];
94
- if (!config.projectId) {
95
- errors.push("projectId is required");
96
- }
97
- if (config.output.api?.enabled && !config.output.api.endpoint) {
98
- errors.push("API endpoint is required when api output is enabled");
99
- }
100
- if (config.include.length === 0) {
101
- errors.push("At least one include pattern is required");
102
- }
103
- return errors;
104
- }
105
- function globToRegex(pattern) {
106
- const escaped = pattern.replace(/[.+^${}()|[\]\\]/g, "\\$&").replace(/\*\*/g, "{{GLOBSTAR}}").replace(/\*/g, "[^/]*").replace(/{{GLOBSTAR}}/g, ".*").replace(/\{([^}]+)\}/g, (_, group) => {
107
- const alternatives = group.split(",").map((s) => s.trim());
108
- return `(${alternatives.join("|")})`;
109
- });
110
- return new RegExp(`^${escaped}$`);
111
- }
112
- var TypeScriptParser = class {
113
- constructor() {
114
- this.compilerOptions = {
115
- target: ts3.ScriptTarget.ESNext,
116
- module: ts3.ModuleKind.ESNext,
117
- jsx: ts3.JsxEmit.React,
118
- esModuleInterop: true,
119
- allowSyntheticDefaultImports: true,
120
- strict: false
121
- };
122
- }
123
- /**
124
- * 소스 코드를 AST로 파싱
125
- */
126
- parse(content, filePath) {
127
- return ts3.createSourceFile(
128
- filePath,
129
- content,
130
- this.compilerOptions.target,
131
- true,
132
- this.getScriptKind(filePath)
133
- );
134
- }
135
- /**
136
- * 파일 확장자에 따른 ScriptKind 결정
137
- */
138
- getScriptKind(filePath) {
139
- const ext = filePath.toLowerCase();
140
- if (ext.endsWith(".tsx")) return ts3.ScriptKind.TSX;
141
- if (ext.endsWith(".ts")) return ts3.ScriptKind.TS;
142
- if (ext.endsWith(".jsx")) return ts3.ScriptKind.JSX;
143
- if (ext.endsWith(".js")) return ts3.ScriptKind.JS;
144
- return ts3.ScriptKind.Unknown;
145
- }
146
- /**
147
- * AST 노드 순회
148
- */
149
- traverse(node, visitor) {
150
- const shouldContinue = visitor(node);
151
- if (shouldContinue === false) return;
152
- ts3.forEachChild(node, (child) => this.traverse(child, visitor));
153
- }
154
- /**
155
- * 특정 조건을 만족하는 노드 수집
156
- */
157
- findNodes(sourceFile, predicate) {
158
- const results = [];
159
- this.traverse(sourceFile, (node) => {
160
- if (predicate(node)) {
161
- results.push(node);
162
- }
163
- });
164
- return results;
165
- }
166
- /**
167
- * 노드의 텍스트 추출
168
- */
169
- getNodeText(node, sourceFile) {
170
- return node.getText(sourceFile);
171
- }
172
- /**
173
- * JSDoc 코멘트 추출
174
- */
175
- getJSDocComment(node) {
176
- const jsDocNodes = ts3.getJSDocCommentsAndTags(node);
177
- if (jsDocNodes.length === 0) return void 0;
178
- return jsDocNodes.filter(ts3.isJSDoc).map((doc) => doc.comment).filter(Boolean).join("\n");
179
- }
180
- };
181
- new TypeScriptParser();
182
- var SQLParser = class {
183
- /**
184
- * SQL 파일 파싱
185
- */
186
- parse(content, relativePath) {
187
- const tables = this.extractTables(content);
188
- const tableName = tables[0]?.name || this.extractNameFromPath(relativePath);
189
- return {
190
- path: relativePath,
191
- type: "table",
192
- name: tableName,
193
- imports: [],
194
- exports: tables.map((t) => ({
195
- name: t.name,
196
- isDefault: false,
197
- isTypeOnly: false,
198
- kind: "variable"
199
- })),
200
- metadata: {
201
- tableName,
202
- columns: tables[0]?.columns || []
203
- }
204
- };
205
- }
206
- /**
207
- * CREATE TABLE 문에서 테이블 정보 추출
208
- */
209
- extractTables(content) {
210
- const tables = [];
211
- const createTableRegex = /CREATE\s+TABLE\s+(?:IF\s+NOT\s+EXISTS\s+)?["']?(\w+)["']?\s*\(([\s\S]*?)\);/gi;
212
- let match;
213
- while ((match = createTableRegex.exec(content)) !== null) {
214
- const tableName = match[1];
215
- const columnsBlock = match[2];
216
- const columns = this.parseColumns(columnsBlock);
217
- tables.push({ name: tableName, columns });
218
- }
219
- const alterTableRegex = /ALTER\s+TABLE\s+["']?(\w+)["']?\s+ADD\s+(?:COLUMN\s+)?["']?(\w+)["']?\s+(\w+)/gi;
220
- while ((match = alterTableRegex.exec(content)) !== null) {
221
- const tableName = match[1];
222
- const columnName = match[2];
223
- const columnType = match[3];
224
- let table = tables.find((t) => t.name === tableName);
225
- if (!table) {
226
- table = { name: tableName, columns: [] };
227
- tables.push(table);
228
- }
229
- table.columns.push({
230
- name: columnName,
231
- type: columnType,
232
- nullable: true,
233
- isPrimaryKey: false,
234
- isForeignKey: false
235
- });
236
- }
237
- return tables;
238
- }
239
- /**
240
- * 컬럼 정의 파싱
241
- */
242
- parseColumns(columnsBlock) {
243
- const columns = [];
244
- const lines = columnsBlock.split(",").map((line) => line.trim()).filter(
245
- (line) => line && !line.toUpperCase().startsWith("CONSTRAINT") && !line.toUpperCase().startsWith("PRIMARY KEY") && !line.toUpperCase().startsWith("FOREIGN KEY") && !line.toUpperCase().startsWith("UNIQUE") && !line.toUpperCase().startsWith("CHECK")
246
- );
247
- for (const line of lines) {
248
- const column = this.parseColumnDefinition(line);
249
- if (column) {
250
- columns.push(column);
251
- }
252
- }
253
- return columns;
254
- }
255
- /**
256
- * 단일 컬럼 정의 파싱
257
- */
258
- parseColumnDefinition(line) {
259
- const match = line.match(/^["']?(\w+)["']?\s+(\w+(?:\([^)]+\))?)/i);
260
- if (!match) return null;
261
- const [, name, type] = match;
262
- const upperLine = line.toUpperCase();
263
- return {
264
- name,
265
- type: type.toUpperCase(),
266
- nullable: !upperLine.includes("NOT NULL"),
267
- isPrimaryKey: upperLine.includes("PRIMARY KEY"),
268
- isForeignKey: upperLine.includes("REFERENCES"),
269
- references: this.extractReference(line)
270
- };
271
- }
272
- /**
273
- * REFERENCES 절에서 참조 정보 추출
274
- */
275
- extractReference(line) {
276
- const match = line.match(
277
- /REFERENCES\s+["']?(\w+)["']?\s*\(["']?(\w+)["']?\)/i
278
- );
279
- if (!match) return void 0;
280
- return {
281
- table: match[1],
282
- column: match[2]
283
- };
284
- }
285
- /**
286
- * 파일 경로에서 테이블 이름 추출
287
- */
288
- extractNameFromPath(filePath) {
289
- const filename = path2.basename(filePath);
290
- const match = filename.match(/create_(\w+)_table/i);
291
- return match ? match[1] : filename.replace(".sql", "");
292
- }
293
- };
294
- var ImportExtractor = class {
295
- /**
296
- * SourceFile에서 모든 import 정보 추출
297
- */
298
- extract(sourceFile) {
299
- const imports = [];
300
- ts3.forEachChild(sourceFile, (node) => {
301
- if (ts3.isImportDeclaration(node)) {
302
- const importInfo = this.parseImportDeclaration(node);
303
- if (importInfo) {
304
- imports.push(importInfo);
305
- }
306
- }
307
- });
308
- return imports;
309
- }
310
- /**
311
- * ImportDeclaration 노드를 ImportInfo로 변환
312
- */
313
- parseImportDeclaration(node) {
314
- const moduleSpecifier = node.moduleSpecifier;
315
- if (!ts3.isStringLiteral(moduleSpecifier)) {
316
- return null;
317
- }
318
- const source = moduleSpecifier.text;
319
- const specifiers = [];
320
- let isDefault = false;
321
- const isTypeOnly = node.importClause?.isTypeOnly || false;
322
- const importClause = node.importClause;
323
- if (!importClause) {
324
- return {
325
- source,
326
- specifiers: [],
327
- isDefault: false,
328
- isTypeOnly: false
329
- };
330
- }
331
- if (importClause.name) {
332
- specifiers.push(importClause.name.text);
333
- isDefault = true;
334
- }
335
- const namedBindings = importClause.namedBindings;
336
- if (namedBindings) {
337
- if (ts3.isNamespaceImport(namedBindings)) {
338
- specifiers.push(`* as ${namedBindings.name.text}`);
339
- } else if (ts3.isNamedImports(namedBindings)) {
340
- for (const element of namedBindings.elements) {
341
- const name = element.name.text;
342
- const propertyName = element.propertyName?.text;
343
- if (propertyName) {
344
- specifiers.push(`${propertyName} as ${name}`);
345
- } else {
346
- specifiers.push(name);
347
- }
348
- }
349
- }
350
- }
351
- return {
352
- source,
353
- specifiers,
354
- isDefault,
355
- isTypeOnly
356
- };
357
- }
358
- };
359
- var ExportExtractor = class {
360
- /**
361
- * SourceFile에서 모든 export 정보 추출
362
- */
363
- extract(sourceFile) {
364
- const exports$1 = [];
365
- ts3.forEachChild(sourceFile, (node) => {
366
- const exportInfos = this.extractFromNode(node, sourceFile);
367
- exports$1.push(...exportInfos);
368
- });
369
- return exports$1;
370
- }
371
- /**
372
- * 노드에서 export 정보 추출
373
- */
374
- extractFromNode(node, sourceFile) {
375
- const results = [];
376
- if (ts3.isFunctionDeclaration(node) && this.hasExportModifier(node)) {
377
- results.push({
378
- name: node.name?.text || "anonymous",
379
- isDefault: this.hasDefaultModifier(node),
380
- isTypeOnly: false,
381
- kind: "function"
382
- });
383
- }
384
- if (ts3.isClassDeclaration(node) && this.hasExportModifier(node)) {
385
- results.push({
386
- name: node.name?.text || "anonymous",
387
- isDefault: this.hasDefaultModifier(node),
388
- isTypeOnly: false,
389
- kind: "class"
390
- });
391
- }
392
- if (ts3.isVariableStatement(node) && this.hasExportModifier(node)) {
393
- for (const declaration of node.declarationList.declarations) {
394
- if (ts3.isIdentifier(declaration.name)) {
395
- results.push({
396
- name: declaration.name.text,
397
- isDefault: false,
398
- isTypeOnly: false,
399
- kind: "variable"
400
- });
401
- }
402
- }
403
- }
404
- if (ts3.isTypeAliasDeclaration(node) && this.hasExportModifier(node)) {
405
- results.push({
406
- name: node.name.text,
407
- isDefault: false,
408
- isTypeOnly: true,
409
- kind: "type"
410
- });
411
- }
412
- if (ts3.isInterfaceDeclaration(node) && this.hasExportModifier(node)) {
413
- results.push({
414
- name: node.name.text,
415
- isDefault: false,
416
- isTypeOnly: true,
417
- kind: "interface"
418
- });
419
- }
420
- if (ts3.isExportAssignment(node) && !node.isExportEquals) {
421
- const name = this.getExportDefaultName(node, sourceFile);
422
- results.push({
423
- name,
424
- isDefault: true,
425
- isTypeOnly: false,
426
- kind: "variable"
427
- });
428
- }
429
- if (ts3.isExportDeclaration(node)) {
430
- const exportClause = node.exportClause;
431
- if (exportClause && ts3.isNamedExports(exportClause)) {
432
- for (const element of exportClause.elements) {
433
- results.push({
434
- name: element.name.text,
435
- isDefault: false,
436
- isTypeOnly: node.isTypeOnly,
437
- kind: "variable"
438
- });
439
- }
440
- }
441
- }
442
- return results;
443
- }
444
- /**
445
- * export 키워드가 있는지 확인
446
- */
447
- hasExportModifier(node) {
448
- const modifiers = ts3.canHaveModifiers(node) ? ts3.getModifiers(node) : void 0;
449
- return modifiers?.some((m) => m.kind === ts3.SyntaxKind.ExportKeyword) || false;
450
- }
451
- /**
452
- * default 키워드가 있는지 확인
453
- */
454
- hasDefaultModifier(node) {
455
- const modifiers = ts3.canHaveModifiers(node) ? ts3.getModifiers(node) : void 0;
456
- return modifiers?.some((m) => m.kind === ts3.SyntaxKind.DefaultKeyword) || false;
457
- }
458
- /**
459
- * export default의 이름 추출
460
- */
461
- getExportDefaultName(node, _sourceFile) {
462
- const expr = node.expression;
463
- if (ts3.isIdentifier(expr)) {
464
- return expr.text;
465
- }
466
- if (ts3.isArrowFunction(expr) || ts3.isFunctionExpression(expr)) {
467
- return "default";
468
- }
469
- if (ts3.isCallExpression(expr) && ts3.isIdentifier(expr.expression)) {
470
- const firstArg = expr.arguments[0];
471
- if (firstArg && ts3.isIdentifier(firstArg)) {
472
- return firstArg.text;
473
- }
474
- }
475
- return "default";
476
- }
477
- };
478
- var PropsExtractor = class {
479
- /**
480
- * SourceFile에서 Props 정보 추출
481
- */
482
- extract(sourceFile) {
483
- const props = [];
484
- const propsType = this.findPropsType(sourceFile);
485
- if (propsType) {
486
- props.push(...this.extractFromTypeNode(propsType, sourceFile));
487
- }
488
- const componentFunction = this.findComponentFunction(sourceFile);
489
- if (componentFunction) {
490
- props.push(
491
- ...this.extractFromFunctionParams(componentFunction, sourceFile)
492
- );
493
- }
494
- return this.deduplicateProps(props);
495
- }
496
- /**
497
- * Props 타입 정의 찾기
498
- */
499
- findPropsType(sourceFile) {
500
- let propsType;
501
- ts3.forEachChild(sourceFile, (node) => {
502
- if (ts3.isInterfaceDeclaration(node) && node.name.text.endsWith("Props")) {
503
- propsType = node;
504
- }
505
- if (ts3.isTypeAliasDeclaration(node) && node.name.text.endsWith("Props")) {
506
- propsType = node.type;
507
- }
508
- });
509
- return propsType;
510
- }
511
- /**
512
- * 컴포넌트 함수 찾기
513
- */
514
- findComponentFunction(sourceFile) {
515
- let component;
516
- ts3.forEachChild(sourceFile, (node) => {
517
- if (ts3.isFunctionDeclaration(node) && this.isExported(node)) {
518
- component = node;
519
- }
520
- if (ts3.isVariableStatement(node) && this.isExported(node)) {
521
- for (const decl of node.declarationList.declarations) {
522
- if (decl.initializer && (ts3.isArrowFunction(decl.initializer) || ts3.isFunctionExpression(decl.initializer))) {
523
- component = decl.initializer;
524
- }
525
- }
526
- }
527
- });
528
- return component;
529
- }
530
- /**
531
- * 타입 노드에서 Props 추출
532
- */
533
- extractFromTypeNode(typeNode, sourceFile) {
534
- const props = [];
535
- if (ts3.isInterfaceDeclaration(typeNode)) {
536
- for (const member of typeNode.members) {
537
- const propInfo = this.extractMemberProp(member, sourceFile);
538
- if (propInfo) {
539
- props.push(propInfo);
540
- }
541
- }
542
- return props;
543
- }
544
- if (ts3.isTypeLiteralNode(typeNode)) {
545
- for (const member of typeNode.members) {
546
- const propInfo = this.extractMemberProp(member, sourceFile);
547
- if (propInfo) {
548
- props.push(propInfo);
549
- }
550
- }
551
- }
552
- if (ts3.isIntersectionTypeNode(typeNode)) {
553
- for (const type of typeNode.types) {
554
- props.push(...this.extractFromTypeNode(type, sourceFile));
555
- }
556
- }
557
- return props;
558
- }
559
- /**
560
- * 타입 멤버에서 PropInfo 추출
561
- */
562
- extractMemberProp(member, sourceFile) {
563
- if (!ts3.isPropertySignature(member)) {
564
- return null;
565
- }
566
- const name = member.name;
567
- if (!ts3.isIdentifier(name) && !ts3.isStringLiteral(name)) {
568
- return null;
569
- }
570
- const propName = ts3.isIdentifier(name) ? name.text : name.text;
571
- const required = !member.questionToken;
572
- const type = member.type ? member.type.getText(sourceFile) : "any";
573
- return {
574
- name: propName,
575
- type,
576
- required
577
- };
578
- }
579
- /**
580
- * 함수 매개변수에서 Props 추출
581
- */
582
- extractFromFunctionParams(func, sourceFile) {
583
- const props = [];
584
- const firstParam = func.parameters[0];
585
- if (!firstParam) return props;
586
- if (ts3.isObjectBindingPattern(firstParam.name)) {
587
- for (const element of firstParam.name.elements) {
588
- if (ts3.isBindingElement(element) && ts3.isIdentifier(element.name)) {
589
- props.push({
590
- name: element.name.text,
591
- type: "unknown",
592
- required: !element.initializer,
593
- defaultValue: element.initializer?.getText(sourceFile)
594
- });
595
- }
596
- }
597
- }
598
- return props;
599
- }
600
- /**
601
- * export 키워드가 있는지 확인
602
- */
603
- isExported(node) {
604
- const modifiers = ts3.canHaveModifiers(node) ? ts3.getModifiers(node) : void 0;
605
- return modifiers?.some((m) => m.kind === ts3.SyntaxKind.ExportKeyword) || false;
606
- }
607
- /**
608
- * 중복 Props 제거
609
- */
610
- deduplicateProps(props) {
611
- const seen = /* @__PURE__ */ new Set();
612
- return props.filter((prop) => {
613
- if (seen.has(prop.name)) return false;
614
- seen.add(prop.name);
615
- return true;
616
- });
617
- }
618
- };
619
-
620
- // src/utils/naming-utils.ts
621
- function splitCamelCase(str) {
622
- return str.replace(/([a-z])([A-Z])/g, "$1 $2").split(" ").filter(Boolean);
623
- }
624
- function splitPascalCase(str) {
625
- return str.replace(/([A-Z])([A-Z][a-z])/g, "$1 $2").replace(/([a-z])([A-Z])/g, "$1 $2").split(" ").filter(Boolean);
626
- }
627
- function splitSnakeCase(str) {
628
- return str.split("_").filter(Boolean);
629
- }
630
- function splitKebabCase(str) {
631
- return str.split("-").filter(Boolean);
632
- }
633
- function splitIntoWords(str) {
634
- const words = /* @__PURE__ */ new Set();
635
- const parts = str.split(/[-_]/);
636
- for (const part of parts) {
637
- const camelSplit = splitCamelCase(part);
638
- camelSplit.forEach((w) => words.add(w.toLowerCase()));
639
- }
640
- return [...words];
641
- }
642
- function extractAcronyms(str) {
643
- const acronyms = [];
644
- const matches = str.match(/[A-Z]{2,}/g);
645
- if (matches) {
646
- acronyms.push(...matches);
647
- }
648
- return acronyms;
649
- }
650
- function toAllCases(str) {
651
- const words = splitIntoWords(str);
652
- return {
653
- camel: words.map(
654
- (w, i) => i === 0 ? w.toLowerCase() : w.charAt(0).toUpperCase() + w.slice(1).toLowerCase()
655
- ).join(""),
656
- pascal: words.map((w) => w.charAt(0).toUpperCase() + w.slice(1).toLowerCase()).join(""),
657
- snake: words.map((w) => w.toLowerCase()).join("_"),
658
- kebab: words.map((w) => w.toLowerCase()).join("-")
659
- };
660
- }
661
-
662
- // src/utils/korean-mapper.ts
663
- var KOREAN_KEYWORD_MAP = {
664
- // 공통 동작
665
- create: ["\uC0DD\uC131", "\uB9CC\uB4E4\uAE30", "\uCD94\uAC00"],
666
- read: ["\uC77D\uAE30", "\uC870\uD68C"],
667
- update: ["\uC218\uC815", "\uC5C5\uB370\uC774\uD2B8", "\uBCC0\uACBD"],
668
- delete: ["\uC0AD\uC81C", "\uC81C\uAC70"],
669
- list: ["\uBAA9\uB85D", "\uB9AC\uC2A4\uD2B8"],
670
- search: ["\uAC80\uC0C9", "\uCC3E\uAE30"],
671
- filter: ["\uD544\uD130", "\uD544\uD130\uB9C1"],
672
- sort: ["\uC815\uB82C"],
673
- submit: ["\uC81C\uCD9C", "\uC804\uC1A1"],
674
- cancel: ["\uCDE8\uC18C"],
675
- confirm: ["\uD655\uC778"],
676
- save: ["\uC800\uC7A5"],
677
- load: ["\uB85C\uB4DC", "\uBD88\uB7EC\uC624\uAE30"],
678
- fetch: ["\uAC00\uC838\uC624\uAE30", "\uBD88\uB7EC\uC624\uAE30"],
679
- // UI 요소
680
- button: ["\uBC84\uD2BC"],
681
- modal: ["\uBAA8\uB2EC", "\uD31D\uC5C5"],
682
- dialog: ["\uB2E4\uC774\uC5BC\uB85C\uADF8", "\uB300\uD654\uC0C1\uC790"],
683
- form: ["\uD3FC", "\uC591\uC2DD"],
684
- input: ["\uC785\uB825", "\uC778\uD48B"],
685
- select: ["\uC120\uD0DD", "\uC140\uB809\uD2B8", "\uB4DC\uB86D\uB2E4\uC6B4"],
686
- checkbox: ["\uCCB4\uD06C\uBC15\uC2A4", "\uCCB4\uD06C"],
687
- table: ["\uD14C\uC774\uBE14", "\uD45C"],
688
- card: ["\uCE74\uB4DC"],
689
- tab: ["\uD0ED"],
690
- menu: ["\uBA54\uB274"],
691
- header: ["\uD5E4\uB354", "\uBA38\uB9AC\uAE00"],
692
- footer: ["\uD478\uD130", "\uBC14\uB2E5\uAE00"],
693
- sidebar: ["\uC0AC\uC774\uB4DC\uBC14"],
694
- navbar: ["\uB124\uBE44\uAC8C\uC774\uC158", "\uB124\uBE44\uBC14"],
695
- // 인증/사용자
696
- auth: ["\uC778\uC99D", "\uB85C\uADF8\uC778"],
697
- login: ["\uB85C\uADF8\uC778"],
698
- logout: ["\uB85C\uADF8\uC544\uC6C3"],
699
- register: ["\uD68C\uC6D0\uAC00\uC785", "\uAC00\uC785"],
700
- signup: ["\uD68C\uC6D0\uAC00\uC785", "\uAC00\uC785"],
701
- user: ["\uC0AC\uC6A9\uC790", "\uC720\uC800", "\uD68C\uC6D0"],
702
- profile: ["\uD504\uB85C\uD544"],
703
- password: ["\uBE44\uBC00\uBC88\uD638", "\uC554\uD638"],
704
- permission: ["\uAD8C\uD55C"],
705
- // 비즈니스
706
- attendance: ["\uCD9C\uC11D", "\uCD9C\uACB0"],
707
- check: ["\uCCB4\uD06C", "\uD655\uC778"],
708
- schedule: ["\uC2A4\uCF00\uC904", "\uC77C\uC815"],
709
- calendar: ["\uCE98\uB9B0\uB354", "\uB2EC\uB825"],
710
- notification: ["\uC54C\uB9BC", "\uD1B5\uC9C0"],
711
- message: ["\uBA54\uC2DC\uC9C0", "\uC54C\uB9BC"],
712
- setting: ["\uC124\uC815"],
713
- settings: ["\uC124\uC815"],
714
- payment: ["\uACB0\uC81C", "\uC9C0\uBD88"],
715
- order: ["\uC8FC\uBB38"],
716
- product: ["\uC0C1\uD488", "\uC81C\uD488"],
717
- cart: ["\uC7A5\uBC14\uAD6C\uB2C8"],
718
- checkout: ["\uACB0\uC81C", "\uCCB4\uD06C\uC544\uC6C3"],
719
- invoice: ["\uC1A1\uC7A5", "\uCCAD\uAD6C\uC11C"],
720
- report: ["\uB9AC\uD3EC\uD2B8", "\uBCF4\uACE0\uC11C"],
721
- dashboard: ["\uB300\uC2DC\uBCF4\uB4DC"],
722
- analytics: ["\uBD84\uC11D", "\uD1B5\uACC4"],
723
- statistics: ["\uD1B5\uACC4"],
724
- // 상태
725
- status: ["\uC0C1\uD0DC"],
726
- pending: ["\uB300\uAE30\uC911", "\uB300\uAE30"],
727
- active: ["\uD65C\uC131", "\uD65C\uC131\uD654"],
728
- inactive: ["\uBE44\uD65C\uC131", "\uBE44\uD65C\uC131\uD654"],
729
- completed: ["\uC644\uB8CC"],
730
- error: ["\uC5D0\uB7EC", "\uC624\uB958"],
731
- success: ["\uC131\uACF5"],
732
- loading: ["\uB85C\uB529", "\uB85C\uB4DC\uC911"],
733
- // 기타
734
- date: ["\uB0A0\uC9DC"],
735
- time: ["\uC2DC\uAC04"],
736
- image: ["\uC774\uBBF8\uC9C0", "\uC0AC\uC9C4"],
737
- file: ["\uD30C\uC77C"],
738
- upload: ["\uC5C5\uB85C\uB4DC", "\uC62C\uB9AC\uAE30"],
739
- download: ["\uB2E4\uC6B4\uB85C\uB4DC", "\uB0B4\uB824\uBC1B\uAE30"],
740
- export: ["\uB0B4\uBCF4\uB0B4\uAE30", "\uC775\uC2A4\uD3EC\uD2B8"],
741
- import: ["\uAC00\uC838\uC624\uAE30", "\uC784\uD3EC\uD2B8"],
742
- api: ["API", "\uC5D0\uC774\uD53C\uC544\uC774"],
743
- service: ["\uC11C\uBE44\uC2A4"],
744
- hook: ["\uD6C5"],
745
- component: ["\uCEF4\uD3EC\uB10C\uD2B8"],
746
- page: ["\uD398\uC774\uC9C0"],
747
- route: ["\uB77C\uC6B0\uD2B8", "\uACBD\uB85C"]
748
- };
749
- function findKoreanKeywords(englishKeyword) {
750
- const lower = englishKeyword.toLowerCase();
751
- if (KOREAN_KEYWORD_MAP[lower]) {
752
- return KOREAN_KEYWORD_MAP[lower];
753
- }
754
- const results = [];
755
- for (const [key, values] of Object.entries(KOREAN_KEYWORD_MAP)) {
756
- if (lower.includes(key) || key.includes(lower)) {
757
- results.push(...values);
758
- }
759
- }
760
- return [...new Set(results)];
761
- }
762
- function extendKoreanMap(customMap) {
763
- return {
764
- ...KOREAN_KEYWORD_MAP,
765
- ...customMap
766
- };
767
- }
768
-
769
- // src/core/extractors/keyword-extractor.ts
770
- var KeywordExtractor = class {
771
- constructor(customKoreanMap) {
772
- this.customKoreanMap = customKoreanMap || {};
773
- }
774
- /**
775
- * 다양한 소스에서 키워드 추출
776
- */
777
- extract(name, path5, exports$1 = [], props = []) {
778
- const keywords = /* @__PURE__ */ new Set();
779
- this.extractFromName(name, keywords);
780
- this.extractFromPath(path5, keywords);
781
- for (const exportName of exports$1) {
782
- this.extractFromName(exportName, keywords);
783
- }
784
- for (const propName of props) {
785
- this.extractFromName(propName, keywords);
786
- }
787
- const allEnglishKeywords = [...keywords];
788
- for (const keyword of allEnglishKeywords) {
789
- const koreanKeywords = this.findKorean(keyword);
790
- koreanKeywords.forEach((k) => keywords.add(k));
791
- }
792
- return [...keywords].filter((k) => k.length > 1);
793
- }
794
- /**
795
- * 이름에서 키워드 추출
796
- */
797
- extractFromName(name, keywords) {
798
- keywords.add(name.toLowerCase());
799
- const camelParts = splitCamelCase(name);
800
- camelParts.forEach((part) => keywords.add(part.toLowerCase()));
801
- const pascalParts = splitPascalCase(name);
802
- pascalParts.forEach((part) => keywords.add(part.toLowerCase()));
803
- const snakeParts = splitSnakeCase(name);
804
- snakeParts.forEach((part) => keywords.add(part.toLowerCase()));
805
- const acronyms = extractAcronyms(name);
806
- acronyms.forEach((acr) => keywords.add(acr.toLowerCase()));
807
- }
808
- /**
809
- * 경로에서 키워드 추출
810
- */
811
- extractFromPath(path5, keywords) {
812
- const excludeNames = /* @__PURE__ */ new Set([
813
- "src",
814
- "app",
815
- "components",
816
- "hooks",
817
- "services",
818
- "lib",
819
- "utils",
820
- "pages",
821
- "api"
822
- ]);
823
- const segments = path5.replace(/\.[^/.]+$/, "").split("/").filter((s) => !excludeNames.has(s));
824
- for (const segment of segments) {
825
- this.extractFromName(segment, keywords);
826
- }
827
- }
828
- /**
829
- * 영어 키워드에 대응하는 한글 키워드 찾기
830
- */
831
- findKorean(englishKeyword) {
832
- const customMatch = this.customKoreanMap[englishKeyword.toLowerCase()];
833
- if (customMatch) {
834
- return customMatch;
835
- }
836
- return findKoreanKeywords(englishKeyword);
837
- }
838
- };
839
- var DependencyResolver = class {
840
- constructor(aliasMap = {}, extensions = [".ts", ".tsx", ".js", ".jsx"]) {
841
- this.aliasMap = new Map(Object.entries(aliasMap));
842
- this.extensions = extensions;
843
- }
844
- /**
845
- * import 경로를 실제 파일 경로로 해석
846
- */
847
- resolve(importSource, importerPath, rootDir) {
848
- if (this.isExternalPackage(importSource)) {
849
- return null;
850
- }
851
- const aliasResolved = this.resolveAlias(importSource);
852
- let targetPath;
853
- if (aliasResolved.startsWith("./") || aliasResolved.startsWith("../")) {
854
- const importerDir = path2.dirname(path2.resolve(rootDir, importerPath));
855
- targetPath = path2.resolve(importerDir, aliasResolved);
856
- } else if (aliasResolved !== importSource) {
857
- targetPath = path2.resolve(rootDir, aliasResolved);
858
- } else {
859
- return null;
860
- }
861
- const resolvedPath = this.resolveWithExtensions(targetPath);
862
- if (resolvedPath) {
863
- return path2.relative(rootDir, resolvedPath);
864
- }
865
- return null;
866
- }
867
- /**
868
- * 외부 패키지인지 확인
869
- */
870
- isExternalPackage(source) {
871
- if (source.startsWith("./") || source.startsWith("../")) {
872
- return false;
873
- }
874
- for (const alias of this.aliasMap.keys()) {
875
- if (source.startsWith(alias)) {
876
- return false;
877
- }
878
- }
879
- return true;
880
- }
881
- /**
882
- * alias 해석
883
- */
884
- resolveAlias(source) {
885
- for (const [alias, target] of this.aliasMap.entries()) {
886
- if (source === alias) {
887
- return target;
888
- }
889
- if (source.startsWith(alias + "/")) {
890
- return source.replace(alias, target);
891
- }
892
- }
893
- return source;
894
- }
895
- /**
896
- * 확장자를 추가하여 파일 경로 해석
897
- */
898
- resolveWithExtensions(targetPath) {
899
- if (fs.existsSync(targetPath)) {
900
- try {
901
- const stat = fs.statSync(targetPath);
902
- if (stat.isFile()) {
903
- return targetPath;
904
- }
905
- if (stat.isDirectory()) {
906
- return this.findIndexFile(targetPath);
907
- }
908
- } catch {
909
- }
910
- }
911
- for (const ext of this.extensions) {
912
- const withExt = targetPath + ext;
913
- if (fs.existsSync(withExt)) {
914
- return withExt;
915
- }
916
- }
917
- return this.findIndexFile(targetPath);
918
- }
919
- /**
920
- * 디렉토리에서 index 파일 찾기
921
- */
922
- findIndexFile(dirPath) {
923
- for (const ext of this.extensions) {
924
- const indexPath = path2.join(dirPath, `index${ext}`);
925
- if (fs.existsSync(indexPath)) {
926
- return indexPath;
927
- }
928
- }
929
- return null;
930
- }
931
- };
932
-
933
- // src/core/resolvers/call-graph-builder.ts
934
- var CallGraphBuilder = class {
935
- constructor(aliasMap) {
936
- const defaultAliases = {
937
- "@": "src",
938
- "@/": "src/",
939
- "~": "src",
940
- "~/": "src/"
941
- };
942
- this.resolver = new DependencyResolver({
943
- ...defaultAliases,
944
- ...aliasMap
945
- });
946
- }
947
- /**
948
- * 파싱된 파일들로부터 호출 그래프 구축
949
- */
950
- build(parsedFiles, rootDir) {
951
- const graph = /* @__PURE__ */ new Map();
952
- const filePathSet = new Set(parsedFiles.map((f) => f.path));
953
- for (const file of parsedFiles) {
954
- const calls = this.resolveCalls(file, rootDir, filePathSet);
955
- graph.set(file.path, {
956
- calls,
957
- calledBy: []
958
- });
959
- }
960
- for (const [filePath, entry] of graph.entries()) {
961
- for (const calledPath of entry.calls) {
962
- const calledEntry = graph.get(calledPath);
963
- if (calledEntry) {
964
- calledEntry.calledBy.push(filePath);
965
- }
966
- }
967
- }
968
- return graph;
969
- }
970
- /**
971
- * 파일이 호출하는 다른 파일들을 해석
972
- */
973
- resolveCalls(file, rootDir, validPaths) {
974
- const calls = [];
975
- for (const imp of file.imports) {
976
- if (imp.isTypeOnly) continue;
977
- const resolvedPath = this.resolver.resolve(
978
- imp.source,
979
- file.path,
980
- rootDir
981
- );
982
- if (resolvedPath && validPaths.has(resolvedPath)) {
983
- calls.push(resolvedPath);
984
- }
985
- }
986
- return [...new Set(calls)];
987
- }
988
- };
989
- function generateId(projectId, filePath) {
990
- const input = `${projectId}:${filePath}`;
991
- return crypto.createHash("sha256").update(input).digest("hex").slice(0, 16);
992
- }
993
- var ProjectAnalyzer = class {
994
- constructor(config) {
995
- this.config = config;
996
- this.tsParser = new TypeScriptParser();
997
- this.sqlParser = new SQLParser();
998
- this.importExtractor = new ImportExtractor();
999
- this.exportExtractor = new ExportExtractor();
1000
- this.propsExtractor = new PropsExtractor();
1001
- this.keywordExtractor = new KeywordExtractor(config.koreanKeywords);
1002
- this.callGraphBuilder = new CallGraphBuilder();
1003
- }
1004
- /**
1005
- * 프로젝트 분석 실행
1006
- */
1007
- async analyze(rootDir) {
1008
- const startTime = Date.now();
1009
- const parseErrors = [];
1010
- const files = await this.collectFiles(rootDir);
1011
- if (this.config.verbose) {
1012
- console.log(`[metadata-plugin] Found ${files.length} files to analyze`);
1013
- }
1014
- const parsedFiles = [];
1015
- for (const filePath of files) {
1016
- try {
1017
- const parsed = await this.parseFile(filePath, rootDir);
1018
- if (parsed) {
1019
- parsedFiles.push(parsed);
1020
- }
1021
- } catch (error) {
1022
- const errorMessage = error instanceof Error ? error.message : "Unknown error";
1023
- parseErrors.push(`${filePath}: ${errorMessage}`);
1024
- }
1025
- }
1026
- const callGraph = this.callGraphBuilder.build(parsedFiles, rootDir);
1027
- const items = parsedFiles.map(
1028
- (parsed) => this.createIndexItem(parsed, callGraph)
1029
- );
1030
- const stats = this.calculateStats(items, parseErrors);
1031
- if (this.config.verbose) {
1032
- console.log(
1033
- `[metadata-plugin] Analysis completed in ${Date.now() - startTime}ms`
1034
- );
1035
- console.log(`[metadata-plugin] Processed ${items.length} items`);
1036
- }
1037
- return {
1038
- items,
1039
- stats,
1040
- timestamp: (/* @__PURE__ */ new Date()).toISOString()
1041
- };
1042
- }
1043
- /**
1044
- * 대상 파일 수집
1045
- */
1046
- async collectFiles(rootDir) {
1047
- const allFiles = [];
1048
- for (const pattern of this.config.include) {
1049
- const matches = await glob(pattern, {
1050
- cwd: rootDir,
1051
- ignore: this.config.exclude,
1052
- absolute: true
1053
- });
1054
- allFiles.push(...matches);
1055
- }
1056
- return [...new Set(allFiles)];
1057
- }
1058
- /**
1059
- * 단일 파일 파싱
1060
- */
1061
- async parseFile(filePath, rootDir) {
1062
- const relativePath = path2.relative(rootDir, filePath);
1063
- const fileType = this.determineFileType(relativePath);
1064
- if (!fileType) {
1065
- return null;
1066
- }
1067
- const content = await fs3.readFile(filePath, "utf-8");
1068
- const ext = path2.extname(filePath);
1069
- if (ext === ".sql") {
1070
- return this.sqlParser.parse(content, relativePath);
1071
- }
1072
- const sourceFile = this.tsParser.parse(content, filePath);
1073
- const imports = this.importExtractor.extract(sourceFile);
1074
- const exports$1 = this.exportExtractor.extract(sourceFile);
1075
- const props = fileType === "component" ? this.propsExtractor.extract(sourceFile) : void 0;
1076
- return {
1077
- path: relativePath,
1078
- type: fileType,
1079
- name: this.extractName(relativePath, exports$1),
1080
- imports,
1081
- exports: exports$1,
1082
- props
1083
- };
1084
- }
1085
- /**
1086
- * 파일 타입 결정
1087
- */
1088
- determineFileType(relativePath) {
1089
- const sortedPatterns = Object.entries(this.config.fileTypeMapping).sort(
1090
- ([a], [b]) => b.length - a.length
1091
- );
1092
- for (const [pattern, type] of sortedPatterns) {
1093
- const regex = globToRegex(pattern);
1094
- if (regex.test(relativePath)) {
1095
- return type;
1096
- }
1097
- }
1098
- return null;
1099
- }
1100
- /**
1101
- * 파일/컴포넌트 이름 추출
1102
- */
1103
- extractName(relativePath, exports$1) {
1104
- const defaultExport = exports$1.find((e) => e.isDefault);
1105
- if (defaultExport && defaultExport.name !== "default") {
1106
- return defaultExport.name;
1107
- }
1108
- const basename3 = path2.basename(relativePath, path2.extname(relativePath));
1109
- if (["index", "page", "layout", "route"].includes(basename3)) {
1110
- const dirname4 = path2.dirname(relativePath);
1111
- const parentName = path2.basename(dirname4);
1112
- return parentName !== "." ? parentName : basename3;
1113
- }
1114
- return basename3;
1115
- }
1116
- /**
1117
- * CodeIndexItem 생성
1118
- */
1119
- createIndexItem(parsed, callGraph) {
1120
- const graphEntry = callGraph.get(parsed.path) || {
1121
- calls: [],
1122
- calledBy: []
1123
- };
1124
- const keywords = this.keywordExtractor.extract(
1125
- parsed.name,
1126
- parsed.path,
1127
- parsed.exports.map((e) => e.name),
1128
- parsed.props?.map((p) => p.name)
1129
- );
1130
- const searchText = this.buildSearchText(parsed, keywords);
1131
- return {
1132
- id: generateId(this.config.projectId, parsed.path),
1133
- projectId: this.config.projectId,
1134
- type: parsed.type,
1135
- name: parsed.name,
1136
- path: parsed.path,
1137
- keywords,
1138
- searchText,
1139
- calls: graphEntry.calls,
1140
- calledBy: graphEntry.calledBy,
1141
- metadata: {
1142
- exports: parsed.exports.map((e) => e.name),
1143
- props: parsed.props?.map((p) => p.name),
1144
- ...parsed.metadata
1145
- }
1146
- };
1147
- }
1148
- /**
1149
- * 검색용 텍스트 생성
1150
- */
1151
- buildSearchText(parsed, keywords) {
1152
- const parts = [
1153
- parsed.name,
1154
- parsed.path,
1155
- ...keywords,
1156
- ...parsed.exports.map((e) => e.name),
1157
- ...parsed.props?.map((p) => p.name) || []
1158
- ];
1159
- return parts.join(" ").toLowerCase();
1160
- }
1161
- /**
1162
- * 분석 통계 계산
1163
- */
1164
- calculateStats(items, parseErrors) {
1165
- const byType = {
1166
- route: 0,
1167
- component: 0,
1168
- hook: 0,
1169
- service: 0,
1170
- api: 0,
1171
- table: 0,
1172
- utility: 0
1173
- };
1174
- for (const item of items) {
1175
- byType[item.type]++;
1176
- }
1177
- return {
1178
- totalFiles: items.length,
1179
- byType,
1180
- parseErrors
1181
- };
1182
- }
1183
- };
1184
- var FileWriter = class {
1185
- constructor(config) {
1186
- this.config = config;
1187
- }
1188
- /**
1189
- * 분석 결과를 파일로 저장
1190
- */
1191
- async write(result, outputPath) {
1192
- const dir = path2.dirname(outputPath);
1193
- await fs3.mkdir(dir, { recursive: true });
1194
- const output = this.formatOutput(result);
1195
- await fs3.writeFile(outputPath, output, "utf-8");
1196
- }
1197
- /**
1198
- * 출력 형식 생성
1199
- */
1200
- formatOutput(result) {
1201
- const output = {
1202
- version: "1.0.0",
1203
- projectId: this.config.projectId,
1204
- generatedAt: result.timestamp,
1205
- stats: result.stats,
1206
- items: result.items
1207
- };
1208
- if (this.config.mode === "production") {
1209
- return JSON.stringify(output);
1210
- }
1211
- return JSON.stringify(output, null, 2);
1212
- }
1213
- };
1214
-
1215
- // src/core/output/api-sender.ts
1216
- var ApiSender = class {
1217
- constructor(config, options = {}) {
1218
- this.config = config;
1219
- this.maxRetries = options.maxRetries ?? 3;
1220
- this.retryDelay = options.retryDelay ?? 1e3;
1221
- }
1222
- /**
1223
- * 분석 결과를 API로 전송
1224
- */
1225
- async send(result) {
1226
- const apiConfig = this.config.output.api;
1227
- if (!apiConfig?.enabled || !apiConfig.endpoint) {
1228
- return;
1229
- }
1230
- const payload = {
1231
- projectId: this.config.projectId,
1232
- timestamp: result.timestamp,
1233
- items: result.items,
1234
- stats: result.stats
1235
- };
1236
- let lastError = null;
1237
- for (let attempt = 0; attempt < this.maxRetries; attempt++) {
1238
- try {
1239
- await this.sendRequest(
1240
- apiConfig.endpoint,
1241
- payload,
1242
- apiConfig.headers
1243
- );
1244
- return;
1245
- } catch (error) {
1246
- lastError = error instanceof Error ? error : new Error(String(error));
1247
- if (this.config.verbose) {
1248
- console.warn(
1249
- `[metadata-plugin] API send attempt ${attempt + 1} failed:`,
1250
- lastError.message
1251
- );
1252
- }
1253
- if (attempt < this.maxRetries - 1) {
1254
- await this.delay(this.retryDelay * (attempt + 1));
1255
- }
1256
- }
1257
- }
1258
- throw new Error(
1259
- `Failed to send metadata after ${this.maxRetries} attempts: ${lastError?.message}`
1260
- );
1261
- }
1262
- /**
1263
- * HTTP POST 요청
1264
- */
1265
- async sendRequest(endpoint, payload, headers) {
1266
- const response = await fetch(endpoint, {
1267
- method: "POST",
1268
- headers: {
1269
- "Content-Type": "application/json",
1270
- ...headers
1271
- },
1272
- body: JSON.stringify(payload)
1273
- });
1274
- if (!response.ok) {
1275
- const errorText = await response.text();
1276
- throw new Error(`API request failed: ${response.status} ${errorText}`);
1277
- }
1278
- }
1279
- /**
1280
- * 지연 함수
1281
- */
1282
- delay(ms) {
1283
- return new Promise((resolve2) => setTimeout(resolve2, ms));
1284
- }
1285
- };
1286
- var SupabaseApiSender = class extends ApiSender {
1287
- /**
1288
- * Supabase upsert 형식으로 전송
1289
- */
1290
- async send(result) {
1291
- const apiConfig = this.config.output.api;
1292
- if (!apiConfig?.enabled || !apiConfig.endpoint) {
1293
- return;
1294
- }
1295
- const records = result.items.map((item) => ({
1296
- id: item.id,
1297
- project_id: item.projectId,
1298
- type: item.type,
1299
- name: item.name,
1300
- path: item.path,
1301
- keywords: item.keywords,
1302
- search_text: item.searchText,
1303
- calls: item.calls,
1304
- called_by: item.calledBy,
1305
- metadata: item.metadata,
1306
- updated_at: result.timestamp
1307
- }));
1308
- const batchSize = 500;
1309
- for (let i = 0; i < records.length; i += batchSize) {
1310
- const batch = records.slice(i, i + batchSize);
1311
- const response = await fetch(apiConfig.endpoint, {
1312
- method: "POST",
1313
- headers: {
1314
- "Content-Type": "application/json",
1315
- Prefer: "resolution=merge-duplicates",
1316
- ...apiConfig.headers
1317
- },
1318
- body: JSON.stringify(batch)
1319
- });
1320
- if (!response.ok) {
1321
- throw new Error(`Supabase upsert failed: ${response.status}`);
1322
- }
1323
- }
1324
- }
1325
- };
1326
-
1327
- export { ApiSender, CallGraphBuilder, DEFAULT_EXCLUDE_PATTERNS, DEFAULT_FILE_TYPE_MAPPING, DEFAULT_INCLUDE_PATTERNS, DependencyResolver, ExportExtractor, FileWriter, ImportExtractor, KOREAN_KEYWORD_MAP, KeywordExtractor, ProjectAnalyzer, PropsExtractor, SQLParser, SupabaseApiSender, TypeScriptParser, createDefaultConfig, extendKoreanMap, extractAcronyms, findKoreanKeywords, generateId, splitCamelCase, splitIntoWords, splitKebabCase, splitPascalCase, splitSnakeCase, toAllCases, validateConfig };
1328
- //# sourceMappingURL=chunk-ECKCIPM5.js.map
1329
- //# sourceMappingURL=chunk-ECKCIPM5.js.map