@nuitsukera/refine 1.0.0
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/README.md +370 -0
- package/bin/refine.js +4 -0
- package/dist/CommentRemover.d.ts +22 -0
- package/dist/CommentRemover.d.ts.map +1 -0
- package/dist/ConfigLoader.d.ts +48 -0
- package/dist/ConfigLoader.d.ts.map +1 -0
- package/dist/cli.d.ts +6 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +4220 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +4308 -0
- package/dist/libs/fileUtils.d.ts +17 -0
- package/dist/libs/fileUtils.d.ts.map +1 -0
- package/dist/libs/logger.d.ts +19 -0
- package/dist/libs/logger.d.ts.map +1 -0
- package/dist/libs/prompt.d.ts +4 -0
- package/dist/libs/prompt.d.ts.map +1 -0
- package/dist/libs/safetyGuard.d.ts +29 -0
- package/dist/libs/safetyGuard.d.ts.map +1 -0
- package/dist/parsers/base.d.ts +45 -0
- package/dist/parsers/base.d.ts.map +1 -0
- package/dist/parsers/css.d.ts +10 -0
- package/dist/parsers/css.d.ts.map +1 -0
- package/dist/parsers/factory.d.ts +12 -0
- package/dist/parsers/factory.d.ts.map +1 -0
- package/dist/parsers/html.d.ts +10 -0
- package/dist/parsers/html.d.ts.map +1 -0
- package/dist/parsers/js.d.ts +10 -0
- package/dist/parsers/js.d.ts.map +1 -0
- package/dist/parsers/jsx.d.ts +20 -0
- package/dist/parsers/jsx.d.ts.map +1 -0
- package/dist/parsers/vue.d.ts +30 -0
- package/dist/parsers/vue.d.ts.map +1 -0
- package/dist/postinstall.d.ts +8 -0
- package/dist/postinstall.d.ts.map +1 -0
- package/dist/postinstall.js +300 -0
- package/dist/types/config.d.ts +53 -0
- package/dist/types/config.d.ts.map +1 -0
- package/dist/types/parser.d.ts +25 -0
- package/dist/types/parser.d.ts.map +1 -0
- package/dist/types/scanner.d.ts +27 -0
- package/dist/types/scanner.d.ts.map +1 -0
- package/dist/utils/FileScanner.d.ts +30 -0
- package/dist/utils/FileScanner.d.ts.map +1 -0
- package/package.json +70 -0
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as fs from "node:fs";
|
|
2
|
+
export declare class FileUtils {
|
|
3
|
+
static readFile(filePath: string): Promise<string>;
|
|
4
|
+
static writeFile(filePath: string, content: string): Promise<void>;
|
|
5
|
+
static readDir(dirPath: string): Promise<string[]>;
|
|
6
|
+
static stat(itemPath: string): Promise<fs.Stats>;
|
|
7
|
+
static exists(itemPath: string): Promise<boolean>;
|
|
8
|
+
static isDirectory(itemPath: string): Promise<boolean>;
|
|
9
|
+
static ensureDir(dirPath: string): Promise<void>;
|
|
10
|
+
static copyFile(src: string, dest: string): Promise<void>;
|
|
11
|
+
static getExtension(filePath: string): string;
|
|
12
|
+
static resolvePath(...paths: string[]): string;
|
|
13
|
+
static relativePath(from: string, to: string): string;
|
|
14
|
+
static matchesPattern(filePath: string, pattern: string): boolean;
|
|
15
|
+
static shouldExclude(filePath: string, patterns: string[]): boolean;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=fileUtils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fileUtils.d.ts","sourceRoot":"","sources":["../../src/libs/fileUtils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAK9B,qBAAa,SAAS;WACR,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;WAU3C,SAAS,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;WAY3D,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;WAU3C,IAAI,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,EAAE,CAAC,KAAK,CAAC;WAUzC,MAAM,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;WAS1C,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;WAS/C,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;WAYzC,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAY/D,MAAM,CAAC,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM;IAI7C,MAAM,CAAC,WAAW,CAAC,GAAG,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM;IAI9C,MAAM,CAAC,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,MAAM;IAIrD,MAAM,CAAC,cAAc,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO;IAYjE,MAAM,CAAC,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,OAAO;CAWnE"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { RemovedComment } from "../types/parser";
|
|
2
|
+
export declare class Logger {
|
|
3
|
+
private verbose;
|
|
4
|
+
constructor(verbose?: boolean);
|
|
5
|
+
info(message: string): void;
|
|
6
|
+
success(message: string): void;
|
|
7
|
+
warning(message: string): void;
|
|
8
|
+
error(message: string, error?: Error): void;
|
|
9
|
+
debug(message: string): void;
|
|
10
|
+
title(message: string): void;
|
|
11
|
+
separator(): void;
|
|
12
|
+
stats(stats: Record<string, string | number>): void;
|
|
13
|
+
list(items: string[], bullet?: string): void;
|
|
14
|
+
progress(current: number, total: number, label?: string): void;
|
|
15
|
+
clearLine(): void;
|
|
16
|
+
setVerbose(verbose: boolean): void;
|
|
17
|
+
fileReport(filePath: string, removed: RemovedComment[], dryRun: boolean): void;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=logger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/libs/logger.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAYtD,qBAAa,MAAM;IAClB,OAAO,CAAC,OAAO,CAAU;gBAEb,OAAO,GAAE,OAAe;IAIpC,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAI3B,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAI9B,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAI9B,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,KAAK,GAAG,IAAI;IAO3C,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAM5B,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAI5B,SAAS,IAAI,IAAI;IAIjB,KAAK,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,GAAG,IAAI;IAOnD,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,MAAM,SAAM,GAAG,IAAI;IAMzC,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,SAAK,GAAG,IAAI;IAe1D,SAAS,IAAI,IAAI;IAIjB,UAAU,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI;IAIlC,UAAU,CACT,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,cAAc,EAAE,EACzB,MAAM,EAAE,OAAO,GACb,IAAI;CAsBP"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare function prompt(question: string): Promise<string>;
|
|
2
|
+
export declare function promptChoice(message: string, choices: string[]): Promise<number>;
|
|
3
|
+
export declare function promptText(question: string, defaultValue?: string): Promise<string>;
|
|
4
|
+
//# sourceMappingURL=prompt.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompt.d.ts","sourceRoot":"","sources":["../../src/libs/prompt.ts"],"names":[],"mappings":"AAEA,wBAAsB,MAAM,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAa9D;AAED,wBAAsB,YAAY,CACjC,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,EAAE,GACf,OAAO,CAAC,MAAM,CAAC,CAcjB;AAED,wBAAsB,UAAU,CAC/B,QAAQ,EAAE,MAAM,EAChB,YAAY,SAAK,GACf,OAAO,CAAC,MAAM,CAAC,CAIjB"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file safetyGuard.ts
|
|
3
|
+
* @description Regras de proteção inatas — independentes de config — que impedem
|
|
4
|
+
* a remoção acidental de diretivas de ferramentas, comentários com URLs e
|
|
5
|
+
* outras anotações críticas que NUNCA devem ser apagadas.
|
|
6
|
+
*
|
|
7
|
+
* Estas regras têm prioridade máxima: nenhuma opção de config as desativa.
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Retorna true se o texto do comentário contém uma URL.
|
|
11
|
+
* Usado como proteção de último recurso: se o parser capturou algo que
|
|
12
|
+
* inclui uma URL (ex.: "https://..."), é mais seguro preservar.
|
|
13
|
+
*/
|
|
14
|
+
export declare function containsURL(comment: string): boolean;
|
|
15
|
+
export type GuardMatchResult = {
|
|
16
|
+
/** true = este comentário está protegido e NÃO deve ser removido */
|
|
17
|
+
protected: boolean;
|
|
18
|
+
/** Motivo humano legível (útil para logs verbose futuros) */
|
|
19
|
+
reason?: string;
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* Verifica se um comentário está protegido por alguma regra inata.
|
|
23
|
+
*
|
|
24
|
+
* @param comment - Texto do comentário (com ou sem delimitadores)
|
|
25
|
+
* @returns { protected: true, reason } se deve ser preservado,
|
|
26
|
+
* { protected: false } se pode prosseguir para avaliação normal
|
|
27
|
+
*/
|
|
28
|
+
export declare function checkSafetyGuard(comment: string): GuardMatchResult;
|
|
29
|
+
//# sourceMappingURL=safetyGuard.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"safetyGuard.d.ts","sourceRoot":"","sources":["../../src/libs/safetyGuard.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAqEH;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAEpD;AAMD,MAAM,MAAM,gBAAgB,GAAG;IAC9B,oEAAoE;IACpE,SAAS,EAAE,OAAO,CAAC;IACnB,6DAA6D;IAC7D,MAAM,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,gBAAgB,CAYlE"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file BaseParser.ts
|
|
3
|
+
* @description Classe base abstrata para todos os parsers
|
|
4
|
+
*/
|
|
5
|
+
import type { Config } from "../types/config";
|
|
6
|
+
import type { IParser, ParserOptions, ParserResult } from "../types/parser";
|
|
7
|
+
export declare abstract class BaseParser implements IParser {
|
|
8
|
+
protected config: Config;
|
|
9
|
+
protected fileExtension: string;
|
|
10
|
+
constructor(options: ParserOptions);
|
|
11
|
+
/**
|
|
12
|
+
* Método abstrato que cada parser deve implementar
|
|
13
|
+
*/
|
|
14
|
+
abstract parse(content: string): ParserResult;
|
|
15
|
+
/**
|
|
16
|
+
* Verifica se um comentário deve ser preservado
|
|
17
|
+
*/
|
|
18
|
+
shouldPreserve(comment: string): boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Verifica se é um comentário JSDoc
|
|
21
|
+
*/
|
|
22
|
+
protected isJSDoc(comment: string): boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Verifica se é um comentário TODO
|
|
25
|
+
*/
|
|
26
|
+
protected isTODO(comment: string): boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Verifica se é um comentário FIXME
|
|
29
|
+
*/
|
|
30
|
+
protected isFIXME(comment: string): boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Verifica se é um comentário NOTE
|
|
33
|
+
*/
|
|
34
|
+
protected isNOTE(comment: string): boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Verifica se deve remover baseado nas configurações
|
|
37
|
+
*/
|
|
38
|
+
protected shouldRemove(comment: string): boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Remove espaços em branco extras após remoção de comentários
|
|
41
|
+
*/
|
|
42
|
+
protected cleanupWhitespace(content: string): string;
|
|
43
|
+
protected commentPreview(comment: string): string;
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=base.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../src/parsers/base.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,KAAK,EAAE,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE5E,8BAAsB,UAAW,YAAW,OAAO;IAClD,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC;IACzB,SAAS,CAAC,aAAa,EAAE,MAAM,CAAC;gBAEpB,OAAO,EAAE,aAAa;IAKlC;;OAEG;IACH,QAAQ,CAAC,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,YAAY;IAE7C;;OAEG;IACH,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO;IAuBxC;;OAEG;IACH,SAAS,CAAC,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO;IAI3C;;OAEG;IACH,SAAS,CAAC,MAAM,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO;IAI1C;;OAEG;IACH,SAAS,CAAC,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO;IAI3C;;OAEG;IACH,SAAS,CAAC,MAAM,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO;IAI1C;;OAEG;IACH,SAAS,CAAC,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO;IA+BhD;;OAEG;IACH,SAAS,CAAC,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM;IAIpD,SAAS,CAAC,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM;CAGjD"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file css.ts
|
|
3
|
+
* @description Parser para arquivos CSS, SCSS e LESS
|
|
4
|
+
*/
|
|
5
|
+
import type { ParserResult } from "../types/parser";
|
|
6
|
+
import { BaseParser } from "./base";
|
|
7
|
+
export declare class CSSParser extends BaseParser {
|
|
8
|
+
parse(content: string): ParserResult;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=css.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"css.d.ts","sourceRoot":"","sources":["../../src/parsers/css.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAkB,MAAM,iBAAiB,CAAC;AACpE,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAEpC,qBAAa,SAAU,SAAQ,UAAU;IACxC,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,YAAY;CAmFpC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file ParserFactory.ts
|
|
3
|
+
* @description Factory para criar parsers baseados na extensão do arquivo
|
|
4
|
+
*/
|
|
5
|
+
import type { IParser, ParserOptions } from "../types/parser";
|
|
6
|
+
export declare class ParserFactory {
|
|
7
|
+
/**
|
|
8
|
+
* Cria um parser apropriado para a extensão do arquivo
|
|
9
|
+
*/
|
|
10
|
+
static createParser(options: ParserOptions): IParser;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=factory.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../src/parsers/factory.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAQ9D,qBAAa,aAAa;IACzB;;OAEG;IACH,MAAM,CAAC,YAAY,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO;CA4CpD"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file HTMLParser.ts
|
|
3
|
+
* @description Parser para arquivos HTML (.html, .htm)
|
|
4
|
+
*/
|
|
5
|
+
import type { ParserResult } from "../types/parser";
|
|
6
|
+
import { BaseParser } from "./base";
|
|
7
|
+
export declare class HTMLParser extends BaseParser {
|
|
8
|
+
parse(content: string): ParserResult;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=html.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"html.d.ts","sourceRoot":"","sources":["../../src/parsers/html.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAkB,MAAM,iBAAiB,CAAC;AACpE,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAEpC,qBAAa,UAAW,SAAQ,UAAU;IACzC,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,YAAY;CA8CpC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file JavaScriptParser.ts
|
|
3
|
+
* @description Parser para arquivos JavaScript/TypeScript (.js, .ts, .mjs, .cjs)
|
|
4
|
+
*/
|
|
5
|
+
import type { ParserResult } from "../types/parser";
|
|
6
|
+
import { BaseParser } from "./base";
|
|
7
|
+
export declare class JavaScriptParser extends BaseParser {
|
|
8
|
+
parse(content: string): ParserResult;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=js.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"js.d.ts","sourceRoot":"","sources":["../../src/parsers/js.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAkB,MAAM,iBAAiB,CAAC;AACpE,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAEpC,qBAAa,gBAAiB,SAAQ,UAAU;IAC/C,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,YAAY;CA8OpC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file JSXParser.ts
|
|
3
|
+
* @description Parser para arquivos JSX/TSX (.jsx, .tsx)
|
|
4
|
+
*/
|
|
5
|
+
import type { ParserResult } from "../types/parser";
|
|
6
|
+
import { BaseParser } from "./base";
|
|
7
|
+
export declare class JSXParser extends BaseParser {
|
|
8
|
+
parse(content: string): ParserResult;
|
|
9
|
+
/**
|
|
10
|
+
* Remove comentários JavaScript normais (fora do JSX).
|
|
11
|
+
* Protege comentários JSX ({ /* ... */ }) de serem processados
|
|
12
|
+
* como block comments do JS, delegando ao JavaScriptParser.
|
|
13
|
+
*/
|
|
14
|
+
private removeJavaScriptComments;
|
|
15
|
+
/**
|
|
16
|
+
* Remove comentários JSX ({* ... *})
|
|
17
|
+
*/
|
|
18
|
+
private removeJSXComments;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=jsx.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jsx.d.ts","sourceRoot":"","sources":["../../src/parsers/jsx.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAkB,MAAM,iBAAiB,CAAC;AACpE,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAGpC,qBAAa,SAAU,SAAQ,UAAU;IACxC,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,YAAY;IAgCpC;;;;OAIG;IACH,OAAO,CAAC,wBAAwB;IA6BhC;;OAEG;IACH,OAAO,CAAC,iBAAiB;CAuCzB"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file VueParser.ts
|
|
3
|
+
* @description Parser para arquivos Vue (.vue)
|
|
4
|
+
*/
|
|
5
|
+
import type { ParserResult } from "../types/parser";
|
|
6
|
+
import { BaseParser } from "./base";
|
|
7
|
+
export declare class VueParser extends BaseParser {
|
|
8
|
+
parse(content: string): ParserResult;
|
|
9
|
+
/**
|
|
10
|
+
* Separa as seções do arquivo Vue
|
|
11
|
+
*/
|
|
12
|
+
private parseSections;
|
|
13
|
+
/**
|
|
14
|
+
* Reconstrói o arquivo Vue
|
|
15
|
+
*/
|
|
16
|
+
private reconstructVueFile;
|
|
17
|
+
/**
|
|
18
|
+
* Remove comentários HTML
|
|
19
|
+
*/
|
|
20
|
+
private removeHTMLComments;
|
|
21
|
+
/**
|
|
22
|
+
* Remove comentários JavaScript
|
|
23
|
+
*/
|
|
24
|
+
private removeJavaScriptComments;
|
|
25
|
+
/**
|
|
26
|
+
* Remove comentários CSS
|
|
27
|
+
*/
|
|
28
|
+
private removeCSSComments;
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=vue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vue.d.ts","sourceRoot":"","sources":["../../src/parsers/vue.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAkB,MAAM,iBAAiB,CAAC;AACpE,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAepC,qBAAa,SAAU,SAAQ,UAAU;IACxC,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,YAAY;IA6CpC;;OAEG;IACH,OAAO,CAAC,aAAa;IA6CrB;;OAEG;IACH,OAAO,CAAC,kBAAkB;IAwB1B;;OAEG;IACH,OAAO,CAAC,kBAAkB;IAiC1B;;OAEG;IACH,OAAO,CAAC,wBAAwB;IA0DhC;;OAEG;IACH,OAAO,CAAC,iBAAiB;CAgCzB"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file postinstall.ts
|
|
3
|
+
* @description Roda automaticamente apos "npm install / bun install".
|
|
4
|
+
* Se nenhum arquivo de config for encontrado no projeto, exibe uma dica
|
|
5
|
+
* para o usuario executar "refine init".
|
|
6
|
+
*/
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=postinstall.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"postinstall.d.ts","sourceRoot":"","sources":["../src/postinstall.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"}
|
|
@@ -0,0 +1,300 @@
|
|
|
1
|
+
// src/postinstall.ts
|
|
2
|
+
import * as path3 from "node:path";
|
|
3
|
+
import { fileURLToPath } from "node:url";
|
|
4
|
+
|
|
5
|
+
// src/ConfigLoader.ts
|
|
6
|
+
import * as os from "node:os";
|
|
7
|
+
import * as path2 from "node:path";
|
|
8
|
+
|
|
9
|
+
// src/libs/fileUtils.ts
|
|
10
|
+
import * as fs from "node:fs";
|
|
11
|
+
import * as fsPromises from "node:fs/promises";
|
|
12
|
+
import * as path from "node:path";
|
|
13
|
+
|
|
14
|
+
class FileUtils {
|
|
15
|
+
static async readFile(filePath) {
|
|
16
|
+
try {
|
|
17
|
+
return await fsPromises.readFile(filePath, "utf-8");
|
|
18
|
+
} catch (error) {
|
|
19
|
+
throw new Error(`Failed to read file ${filePath}: ${error.message}`);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
static async writeFile(filePath, content) {
|
|
23
|
+
try {
|
|
24
|
+
const dir = path.dirname(filePath);
|
|
25
|
+
await FileUtils.ensureDir(dir);
|
|
26
|
+
await fsPromises.writeFile(filePath, content, "utf-8");
|
|
27
|
+
} catch (error) {
|
|
28
|
+
throw new Error(`Failed to write file ${filePath}: ${error.message}`);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
static async readDir(dirPath) {
|
|
32
|
+
try {
|
|
33
|
+
return await fsPromises.readdir(dirPath);
|
|
34
|
+
} catch (error) {
|
|
35
|
+
throw new Error(`Failed to read directory ${dirPath}: ${error.message}`);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
static async stat(itemPath) {
|
|
39
|
+
try {
|
|
40
|
+
return await fsPromises.stat(itemPath);
|
|
41
|
+
} catch (error) {
|
|
42
|
+
throw new Error(`Failed to stat ${itemPath}: ${error.message}`);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
static async exists(itemPath) {
|
|
46
|
+
try {
|
|
47
|
+
await fsPromises.access(itemPath, fs.constants.F_OK);
|
|
48
|
+
return true;
|
|
49
|
+
} catch {
|
|
50
|
+
return false;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
static async isDirectory(itemPath) {
|
|
54
|
+
try {
|
|
55
|
+
const stats = await fsPromises.stat(itemPath);
|
|
56
|
+
return stats.isDirectory();
|
|
57
|
+
} catch {
|
|
58
|
+
return false;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
static async ensureDir(dirPath) {
|
|
62
|
+
try {
|
|
63
|
+
if (!await FileUtils.exists(dirPath)) {
|
|
64
|
+
await fsPromises.mkdir(dirPath, { recursive: true });
|
|
65
|
+
}
|
|
66
|
+
} catch (error) {
|
|
67
|
+
throw new Error(`Failed to ensure directory ${dirPath}: ${error.message}`);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
static async copyFile(src, dest) {
|
|
71
|
+
try {
|
|
72
|
+
const destDir = path.dirname(dest);
|
|
73
|
+
await FileUtils.ensureDir(destDir);
|
|
74
|
+
await fsPromises.copyFile(src, dest);
|
|
75
|
+
} catch (error) {
|
|
76
|
+
throw new Error(`Failed to copy file from ${src} to ${dest}: ${error.message}`);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
static getExtension(filePath) {
|
|
80
|
+
return path.extname(filePath);
|
|
81
|
+
}
|
|
82
|
+
static resolvePath(...paths) {
|
|
83
|
+
return path.resolve(...paths);
|
|
84
|
+
}
|
|
85
|
+
static relativePath(from, to) {
|
|
86
|
+
return path.relative(from, to);
|
|
87
|
+
}
|
|
88
|
+
static matchesPattern(filePath, pattern) {
|
|
89
|
+
const regexPattern = pattern.replace(/\./g, "\\.").replace(/\*/g, ".*").replace(/\?/g, ".");
|
|
90
|
+
const regex = new RegExp(`^${regexPattern}$`);
|
|
91
|
+
const fileName = path.basename(filePath);
|
|
92
|
+
return regex.test(fileName);
|
|
93
|
+
}
|
|
94
|
+
static shouldExclude(filePath, patterns) {
|
|
95
|
+
const fileName = path.basename(filePath);
|
|
96
|
+
for (const pattern of patterns) {
|
|
97
|
+
if (FileUtils.matchesPattern(fileName, pattern)) {
|
|
98
|
+
return true;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
return false;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
// src/ConfigLoader.ts
|
|
106
|
+
var CONFIG_CANDIDATES = ["refine.json", ".refine.json"];
|
|
107
|
+
|
|
108
|
+
class ConfigLoader {
|
|
109
|
+
static getGlobalConfigPath() {
|
|
110
|
+
const home = os.homedir();
|
|
111
|
+
const configDir = process.platform === "win32" ? path2.join(process.env.APPDATA ?? home, "refine") : path2.join(home, ".config", "refine");
|
|
112
|
+
return path2.join(configDir, "refine.json");
|
|
113
|
+
}
|
|
114
|
+
static async detectGlobalConfig() {
|
|
115
|
+
const globalPath = ConfigLoader.getGlobalConfigPath();
|
|
116
|
+
if (await FileUtils.exists(globalPath)) {
|
|
117
|
+
return globalPath;
|
|
118
|
+
}
|
|
119
|
+
return null;
|
|
120
|
+
}
|
|
121
|
+
static async detectConfigFile() {
|
|
122
|
+
const cwd = process.cwd();
|
|
123
|
+
for (const name of CONFIG_CANDIDATES) {
|
|
124
|
+
const filePath = path2.join(cwd, name);
|
|
125
|
+
if (await FileUtils.exists(filePath)) {
|
|
126
|
+
return filePath;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
const configJson = path2.join(cwd, "config.json");
|
|
130
|
+
if (await FileUtils.exists(configJson)) {
|
|
131
|
+
try {
|
|
132
|
+
const content = await FileUtils.readFile(configJson);
|
|
133
|
+
const parsed = JSON.parse(content);
|
|
134
|
+
if ("refine" in parsed) {
|
|
135
|
+
return configJson;
|
|
136
|
+
}
|
|
137
|
+
} catch {}
|
|
138
|
+
}
|
|
139
|
+
return null;
|
|
140
|
+
}
|
|
141
|
+
static async load(configPath) {
|
|
142
|
+
const absolutePath = path2.resolve(process.cwd(), configPath);
|
|
143
|
+
if (!await FileUtils.exists(absolutePath)) {
|
|
144
|
+
throw new Error(`Config file not found: ${absolutePath}`);
|
|
145
|
+
}
|
|
146
|
+
const content = await FileUtils.readFile(absolutePath);
|
|
147
|
+
let parsed;
|
|
148
|
+
try {
|
|
149
|
+
parsed = JSON.parse(content);
|
|
150
|
+
} catch (error) {
|
|
151
|
+
throw new Error(`Failed to parse config file: ${error.message}`);
|
|
152
|
+
}
|
|
153
|
+
const raw = "refine" in parsed ? parsed.refine : parsed;
|
|
154
|
+
ConfigLoader.validate(raw);
|
|
155
|
+
raw.targetDirectory = path2.resolve(process.cwd(), raw.targetDirectory);
|
|
156
|
+
if (raw.outputDirectory) {
|
|
157
|
+
raw.outputDirectory = path2.resolve(process.cwd(), raw.outputDirectory);
|
|
158
|
+
}
|
|
159
|
+
return raw;
|
|
160
|
+
}
|
|
161
|
+
static createDefault() {
|
|
162
|
+
return {
|
|
163
|
+
targetDirectory: "./src",
|
|
164
|
+
fileExtensions: [
|
|
165
|
+
".js",
|
|
166
|
+
".mjs",
|
|
167
|
+
".cjs",
|
|
168
|
+
".ts",
|
|
169
|
+
".jsx",
|
|
170
|
+
".tsx",
|
|
171
|
+
".vue",
|
|
172
|
+
".svelte",
|
|
173
|
+
".astro",
|
|
174
|
+
".html",
|
|
175
|
+
".htm",
|
|
176
|
+
".jsonc"
|
|
177
|
+
],
|
|
178
|
+
excludeFiles: ["*.config.js", "*.config.ts"],
|
|
179
|
+
excludeDirs: ["node_modules", "dist", "build", ".git"],
|
|
180
|
+
preserveComments: [
|
|
181
|
+
"// @ts-expect-error",
|
|
182
|
+
"// @ts-ignore",
|
|
183
|
+
"/// <reference",
|
|
184
|
+
"#!/usr/bin/env node",
|
|
185
|
+
"// biome-ignore",
|
|
186
|
+
"/* webpackIgnore:",
|
|
187
|
+
"/* webpackChunkName:"
|
|
188
|
+
],
|
|
189
|
+
preservePatterns: [
|
|
190
|
+
"^\\s*//\\s*@ts-",
|
|
191
|
+
"^\\s*///\\s*<reference",
|
|
192
|
+
"^#!/",
|
|
193
|
+
"biome-ignore",
|
|
194
|
+
"webpack[A-Za-z]"
|
|
195
|
+
],
|
|
196
|
+
removeJSDoc: false,
|
|
197
|
+
removeTODO: true,
|
|
198
|
+
removeFIXME: true,
|
|
199
|
+
removeNOTE: true,
|
|
200
|
+
dryRun: false,
|
|
201
|
+
verbose: false,
|
|
202
|
+
concurrency: 8
|
|
203
|
+
};
|
|
204
|
+
}
|
|
205
|
+
static async mergeIntoExisting(filePath, config) {
|
|
206
|
+
const absolutePath = path2.resolve(process.cwd(), filePath);
|
|
207
|
+
const content = await FileUtils.readFile(absolutePath);
|
|
208
|
+
let parsed;
|
|
209
|
+
try {
|
|
210
|
+
parsed = JSON.parse(content);
|
|
211
|
+
} catch (error) {
|
|
212
|
+
throw new Error(`Failed to parse existing file: ${error.message}`);
|
|
213
|
+
}
|
|
214
|
+
parsed.refine = config;
|
|
215
|
+
await FileUtils.writeFile(absolutePath, JSON.stringify(parsed, null, 2));
|
|
216
|
+
}
|
|
217
|
+
static validate(config) {
|
|
218
|
+
if (!config.targetDirectory) {
|
|
219
|
+
throw new Error("targetDirectory is required in config");
|
|
220
|
+
}
|
|
221
|
+
if (!config.fileExtensions || config.fileExtensions.length === 0) {
|
|
222
|
+
throw new Error("fileExtensions must be a non-empty array");
|
|
223
|
+
}
|
|
224
|
+
if (!config.excludeFiles)
|
|
225
|
+
config.excludeFiles = [];
|
|
226
|
+
if (!config.excludeDirs)
|
|
227
|
+
config.excludeDirs = [];
|
|
228
|
+
if (!config.preserveComments)
|
|
229
|
+
config.preserveComments = [];
|
|
230
|
+
if (!config.preservePatterns)
|
|
231
|
+
config.preservePatterns = [];
|
|
232
|
+
if (config.removeJSDoc === undefined)
|
|
233
|
+
config.removeJSDoc = false;
|
|
234
|
+
if (config.removeTODO === undefined)
|
|
235
|
+
config.removeTODO = true;
|
|
236
|
+
if (config.removeFIXME === undefined)
|
|
237
|
+
config.removeFIXME = true;
|
|
238
|
+
if (config.removeNOTE === undefined)
|
|
239
|
+
config.removeNOTE = true;
|
|
240
|
+
if (config.dryRun === undefined)
|
|
241
|
+
config.dryRun = false;
|
|
242
|
+
if (config.verbose === undefined)
|
|
243
|
+
config.verbose = false;
|
|
244
|
+
}
|
|
245
|
+
static async save(config, configPath) {
|
|
246
|
+
const absolutePath = path2.resolve(process.cwd(), configPath);
|
|
247
|
+
const content = JSON.stringify(config, null, 2);
|
|
248
|
+
await FileUtils.writeFile(absolutePath, content);
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
// src/postinstall.ts
|
|
253
|
+
var isGlobalInstall = process.env.npm_config_global === "true";
|
|
254
|
+
async function main() {
|
|
255
|
+
const cwd = process.cwd();
|
|
256
|
+
const selfPkg = path3.join(fileURLToPath(new URL(".", import.meta.url)), "..", "package.json");
|
|
257
|
+
const cwdPkg = path3.join(cwd, "package.json");
|
|
258
|
+
if (path3.resolve(selfPkg) === path3.resolve(cwdPkg))
|
|
259
|
+
return;
|
|
260
|
+
if (isGlobalInstall) {
|
|
261
|
+
const globalConfigPath = ConfigLoader.getGlobalConfigPath();
|
|
262
|
+
if (!await FileUtils.exists(globalConfigPath)) {
|
|
263
|
+
const defaultConfig = ConfigLoader.createDefault();
|
|
264
|
+
await ConfigLoader.save(defaultConfig, globalConfigPath);
|
|
265
|
+
console.log(`
|
|
266
|
+
${"─".repeat(50)}`);
|
|
267
|
+
console.log(" refine installed globally!");
|
|
268
|
+
console.log(" Default config created at:");
|
|
269
|
+
console.log(` ${globalConfigPath}`);
|
|
270
|
+
console.log(" Edit it to customize the default behavior.");
|
|
271
|
+
console.log(`${"─".repeat(50)}
|
|
272
|
+
`);
|
|
273
|
+
}
|
|
274
|
+
return;
|
|
275
|
+
}
|
|
276
|
+
for (const name of CONFIG_CANDIDATES) {
|
|
277
|
+
if (await FileUtils.exists(path3.join(cwd, name)))
|
|
278
|
+
return;
|
|
279
|
+
}
|
|
280
|
+
const configJson = path3.join(cwd, "config.json");
|
|
281
|
+
if (await FileUtils.exists(configJson)) {
|
|
282
|
+
try {
|
|
283
|
+
const content = await FileUtils.readFile(configJson);
|
|
284
|
+
const parsed = JSON.parse(content);
|
|
285
|
+
if ("refine" in parsed)
|
|
286
|
+
return;
|
|
287
|
+
} catch {}
|
|
288
|
+
}
|
|
289
|
+
console.log(`
|
|
290
|
+
${"─".repeat(50)}`);
|
|
291
|
+
console.log(" refine installed!");
|
|
292
|
+
console.log(" Run the following command in your project root");
|
|
293
|
+
console.log(" to create a config file:");
|
|
294
|
+
console.log(`
|
|
295
|
+
refine init
|
|
296
|
+
`);
|
|
297
|
+
console.log(`${"─".repeat(50)}
|
|
298
|
+
`);
|
|
299
|
+
}
|
|
300
|
+
main().catch(() => {});
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file config.types.ts
|
|
3
|
+
* @description Tipos TypeScript para configuração do Comment Remover
|
|
4
|
+
*/
|
|
5
|
+
export interface Config {
|
|
6
|
+
/** Diretório alvo para processar */
|
|
7
|
+
targetDirectory: string;
|
|
8
|
+
/** Diretório de saída (opcional, se não especificado sobrescreve originais) */
|
|
9
|
+
outputDirectory?: string;
|
|
10
|
+
/** Extensões de arquivos a serem processados */
|
|
11
|
+
fileExtensions: string[];
|
|
12
|
+
/** Arquivos a serem excluídos (suporta glob patterns) */
|
|
13
|
+
excludeFiles: string[];
|
|
14
|
+
/** Diretórios a serem excluídos */
|
|
15
|
+
excludeDirs: string[];
|
|
16
|
+
/** Lista de comentários específicos que devem ser preservados */
|
|
17
|
+
preserveComments: string[];
|
|
18
|
+
/** Padrões regex para preservar comentários */
|
|
19
|
+
preservePatterns: string[];
|
|
20
|
+
/** Remover comentários JSDoc (@param, @returns, etc) */
|
|
21
|
+
removeJSDoc: boolean;
|
|
22
|
+
/** Remover comentários TODO */
|
|
23
|
+
removeTODO: boolean;
|
|
24
|
+
/** Remover comentários FIXME */
|
|
25
|
+
removeFIXME: boolean;
|
|
26
|
+
/** Remover comentários NOTE */
|
|
27
|
+
removeNOTE: boolean;
|
|
28
|
+
/** Modo dry run (não modifica arquivos) */
|
|
29
|
+
dryRun: boolean;
|
|
30
|
+
/** Modo verbose (logs detalhados) */
|
|
31
|
+
verbose: boolean;
|
|
32
|
+
/** Numero maximo de arquivos processados em paralelo (default: 8) */
|
|
33
|
+
concurrency?: number;
|
|
34
|
+
/** Caminho para salvar o report JSON apos o processamento */
|
|
35
|
+
reportPath?: string;
|
|
36
|
+
/** Caminho para o arquivo de ignore no estilo gitignore (default: .refineignore) */
|
|
37
|
+
ignoreFile?: string;
|
|
38
|
+
}
|
|
39
|
+
export interface ProcessingStats {
|
|
40
|
+
/** Total de arquivos processados */
|
|
41
|
+
filesProcessed: number;
|
|
42
|
+
/** Total de arquivos ignorados */
|
|
43
|
+
filesSkipped: number;
|
|
44
|
+
/** Total de comentários removidos */
|
|
45
|
+
commentsRemoved: number;
|
|
46
|
+
/** Total de comentários preservados */
|
|
47
|
+
commentsPreserved: number;
|
|
48
|
+
/** Arquivos com erros */
|
|
49
|
+
filesWithErrors: string[];
|
|
50
|
+
/** Tempo de processamento em ms */
|
|
51
|
+
processingTime: number;
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/types/config.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,WAAW,MAAM;IACtB,oCAAoC;IACpC,eAAe,EAAE,MAAM,CAAC;IAExB,+EAA+E;IAC/E,eAAe,CAAC,EAAE,MAAM,CAAC;IAEzB,gDAAgD;IAChD,cAAc,EAAE,MAAM,EAAE,CAAC;IAEzB,yDAAyD;IACzD,YAAY,EAAE,MAAM,EAAE,CAAC;IAEvB,mCAAmC;IACnC,WAAW,EAAE,MAAM,EAAE,CAAC;IAEtB,iEAAiE;IACjE,gBAAgB,EAAE,MAAM,EAAE,CAAC;IAE3B,+CAA+C;IAC/C,gBAAgB,EAAE,MAAM,EAAE,CAAC;IAE3B,wDAAwD;IACxD,WAAW,EAAE,OAAO,CAAC;IAErB,+BAA+B;IAC/B,UAAU,EAAE,OAAO,CAAC;IAEpB,gCAAgC;IAChC,WAAW,EAAE,OAAO,CAAC;IAErB,+BAA+B;IAC/B,UAAU,EAAE,OAAO,CAAC;IAEpB,2CAA2C;IAC3C,MAAM,EAAE,OAAO,CAAC;IAEhB,qCAAqC;IACrC,OAAO,EAAE,OAAO,CAAC;IAEjB,qEAAqE;IACrE,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB,6DAA6D;IAC7D,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB,oFAAoF;IACpF,UAAU,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,eAAe;IAC/B,oCAAoC;IACpC,cAAc,EAAE,MAAM,CAAC;IAEvB,kCAAkC;IAClC,YAAY,EAAE,MAAM,CAAC;IAErB,qCAAqC;IACrC,eAAe,EAAE,MAAM,CAAC;IAExB,uCAAuC;IACvC,iBAAiB,EAAE,MAAM,CAAC;IAE1B,yBAAyB;IACzB,eAAe,EAAE,MAAM,EAAE,CAAC;IAE1B,mCAAmC;IACnC,cAAc,EAAE,MAAM,CAAC;CACvB"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file parser.types.ts
|
|
3
|
+
* @description Tipos TypeScript para parsers
|
|
4
|
+
*/
|
|
5
|
+
import type { Config } from "./config";
|
|
6
|
+
export interface RemovedComment {
|
|
7
|
+
line: number;
|
|
8
|
+
preview: string;
|
|
9
|
+
}
|
|
10
|
+
export interface ParserResult {
|
|
11
|
+
content: string;
|
|
12
|
+
commentsRemoved: number;
|
|
13
|
+
commentsPreserved: number;
|
|
14
|
+
preservedLines: number[];
|
|
15
|
+
removedComments: RemovedComment[];
|
|
16
|
+
}
|
|
17
|
+
export interface IParser {
|
|
18
|
+
parse(content: string): ParserResult;
|
|
19
|
+
shouldPreserve(comment: string): boolean;
|
|
20
|
+
}
|
|
21
|
+
export interface ParserOptions {
|
|
22
|
+
config: Config;
|
|
23
|
+
fileExtension: string;
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=parser.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parser.d.ts","sourceRoot":"","sources":["../../src/types/parser.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAEvC,MAAM,WAAW,cAAc;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,YAAY;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,eAAe,EAAE,MAAM,CAAC;IACxB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,eAAe,EAAE,cAAc,EAAE,CAAC;CAClC;AAED,MAAM,WAAW,OAAO;IACvB,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,YAAY,CAAC;IACrC,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC;CACzC;AAED,MAAM,WAAW,aAAa;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,EAAE,MAAM,CAAC;CACtB"}
|