@semacode/cli 2.3.0 → 2.3.1
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/LICENSE +39 -39
- package/README.md +251 -228
- package/dist/agentEntryPoints.js +551 -550
- package/dist/angular-consumer-standalone.d.ts +3 -1
- package/dist/angular-consumer-standalone.js +12 -8
- package/dist/drift.part01.d.ts +32 -2
- package/dist/drift.part01.js +2 -0
- package/dist/drift.part04.d.ts +3 -2
- package/dist/drift.part04.js +6 -3
- package/dist/drift.part05.d.ts +2 -1
- package/dist/drift.part05.js +4 -3
- package/dist/drift.part06.d.ts +2 -1
- package/dist/drift.part06.js +9 -5
- package/dist/drift.part07.d.ts +11 -10
- package/dist/drift.part07.js +40 -30
- package/dist/drift.part08.d.ts +2 -1
- package/dist/drift.part08.js +4 -3
- package/dist/drift.part11.js +71 -6
- package/dist/drift.part12.js +14 -1
- package/dist/drift.part13.d.ts +42 -7
- package/dist/drift.part13.js +660 -36
- package/dist/driftCache.d.ts +49 -0
- package/dist/driftCache.js +311 -0
- package/dist/driftCacheIncremental.d.ts +98 -0
- package/dist/driftCacheIncremental.js +596 -0
- package/dist/driftCatalogo.d.ts +91 -0
- package/dist/driftCatalogo.js +657 -0
- package/dist/driftCatalogoPersistente.d.ts +8 -0
- package/dist/driftCatalogoPersistente.js +77 -0
- package/dist/driftEscopo.d.ts +23 -0
- package/dist/driftEscopo.js +563 -0
- package/dist/driftEscopoReferencias.d.ts +4 -0
- package/dist/driftEscopoReferencias.js +265 -0
- package/dist/driftOrcamento.d.ts +12 -0
- package/dist/driftOrcamento.js +19 -3
- package/dist/execucoesExternas.js +5 -19
- package/dist/iaPrompts.js +310 -310
- package/dist/index.part01.d.ts +16 -1
- package/dist/index.part01.js +80 -4
- package/dist/index.part02.js +21 -21
- package/dist/index.part03.d.ts +2 -2
- package/dist/index.part03.js +14 -3
- package/dist/index.part04.d.ts +2 -2
- package/dist/index.part04.js +113 -101
- package/dist/index.part05.d.ts +1 -1
- package/dist/index.part05.js +99 -22
- package/dist/index.part06.js +3 -2
- package/dist/index.part07.js +24 -24
- package/dist/index.part08.js +1 -1
- package/dist/init/templates.part01.js +393 -393
- package/dist/init/templates.part02.js +189 -189
- package/dist/initTemplatesBackend.js +73 -73
- package/dist/initTemplatesBase.js +81 -81
- package/dist/initTemplatesFlutter.js +137 -137
- package/dist/initTemplatesRuntime.js +350 -350
- package/dist/initTemplatesWeb.js +309 -309
- package/dist/pipelineConteudo/command.js +1 -36
- package/dist/projeto.d.ts +1 -1
- package/dist/projetoCarregar.d.ts +2 -2
- package/dist/projetoCarregar.js +47 -24
- package/dist/projetoCatalogo.d.ts +7 -0
- package/dist/projetoCatalogo.js +125 -0
- package/dist/projetoTipos.d.ts +14 -5
- package/dist/sync/index.js +35 -35
- package/docs/README.md +34 -34
- package/docs/ai-integration.md +1 -7
- package/docs/ai-onboarding.md +62 -62
- package/docs/ai-workflow.md +4 -0
- package/docs/auth.md +26 -26
- package/docs/cli.md +79 -79
- package/docs/commands.md +16 -13
- package/docs/database.md +15 -15
- package/docs/deploy.md +41 -41
- package/docs/descoberta-capacidades.md +106 -106
- package/docs/documentation.md +37 -46
- package/docs/env.md +16 -16
- package/docs/frontend.md +41 -41
- package/docs/getting-started.md +57 -57
- package/docs/i18n.md +15 -15
- package/docs/pipeline-conteudo.md +246 -246
- package/docs/profiles.md +54 -54
- package/docs/repositories.md +43 -43
- package/docs/rollback.md +31 -31
- package/docs/security.md +32 -32
- package/docs/sistemas-interativos.md +373 -378
- package/docs/support.md +8 -8
- package/docs/testing.md +51 -44
- package/docs/vocabulary.md +29 -29
- package/exemplos/agendamento.sema +1 -1
- package/exemplos/assinatura.sema +1 -1
- package/exemplos/auditoria.sema +1 -1
- package/exemplos/autenticacao.sema +1 -1
- package/exemplos/author_obra_comum.sema +1 -1
- package/exemplos/author_tema_sensivel.sema +1 -1
- package/exemplos/automacao.sema +1 -1
- package/exemplos/cadastro_usuario.sema +1 -1
- package/exemplos/calculadora.sema +1 -1
- package/exemplos/crud_simples.sema +1 -1
- package/exemplos/estoque.sema +1 -1
- package/exemplos/exportacao.sema +1 -1
- package/exemplos/fila.sema +1 -1
- package/exemplos/integracao_externa.sema +1 -1
- package/exemplos/multi_tenant.sema +1 -1
- package/exemplos/notificacao.sema +1 -1
- package/exemplos/operacao_estrategia.sema +132 -132
- package/exemplos/operacao_estrategia_discovery.sema +220 -220
- package/exemplos/operacao_estrategia_fluxo.sema +114 -114
- package/exemplos/operacao_estrategia_gates.sema +106 -106
- package/exemplos/operacao_estrategia_quarentena.sema +133 -133
- package/exemplos/operacao_estrategia_rollout.sema +124 -124
- package/exemplos/pagamento.sema +1 -1
- package/exemplos/pagamento_dominio.sema +1 -1
- package/exemplos/pedido.sema +1 -1
- package/exemplos/permissao.sema +1 -1
- package/exemplos/persistencia_vendor_first.sema +1 -1
- package/exemplos/pipeline-conteudo/README.md +44 -44
- package/exemplos/pipeline-conteudo/alvos.json +23 -23
- package/exemplos/pipeline-conteudo/definicao.json +136 -136
- package/exemplos/profile_conversas.sema +165 -165
- package/exemplos/profile_game.sema +1 -1
- package/exemplos/profile_legal.sema +1 -1
- package/exemplos/profile_ops.sema +1 -1
- package/exemplos/profile_research.sema +1 -1
- package/exemplos/profile_simulation.sema +211 -211
- package/exemplos/profile_software.sema +1 -1
- package/exemplos/profile_workflow_n8n.sema +1 -1
- package/exemplos/relatorio.sema +1 -1
- package/exemplos/replica_analitica_erp.sema +1 -1
- package/exemplos/sistemas-interativos/README.md +100 -100
- package/exemplos/sistemas-interativos/advanced/acceptance-context-evaluate-valid.json +5 -5
- package/exemplos/sistemas-interativos/advanced/acceptance-lock-valid.json +16 -16
- package/exemplos/sistemas-interativos/advanced/asset-provenance-valid.json +32 -32
- package/exemplos/sistemas-interativos/advanced/autonomy-repair-valid.json +93 -93
- package/exemplos/sistemas-interativos/advanced/control-run-definition-valid.json +78 -78
- package/exemplos/sistemas-interativos/advanced/control-run-valid.json +27 -27
- package/exemplos/sistemas-interativos/advanced/distributed-workers-valid.json +79 -79
- package/exemplos/sistemas-interativos/advanced/editor-state-valid.json +42 -42
- package/exemplos/sistemas-interativos/advanced/engine-snapshot-after-valid.json +32 -32
- package/exemplos/sistemas-interativos/advanced/engine-snapshot-before-valid.json +23 -23
- package/exemplos/sistemas-interativos/advanced/job-orchestration-valid.json +39 -39
- package/exemplos/sistemas-interativos/advanced/multimodal-evidence-valid.json +46 -46
- package/exemplos/sistemas-interativos/advanced/multiplayer-authority-valid.json +39 -39
- package/exemplos/sistemas-interativos/advanced/playtest-fuzz-valid.json +37 -37
- package/exemplos/sistemas-interativos/advanced/portability-valid.json +104 -104
- package/exemplos/sistemas-interativos/advanced/temporal-evidence-valid.json +27 -27
- package/exemplos/sistemas-interativos/advanced/temporal-valid.json +118 -118
- package/exemplos/sistemas-interativos/experience-ir-valid.json +459 -459
- package/exemplos/sistemas-interativos/game-2d.json +83 -83
- package/exemplos/sistemas-interativos/game-3d-human.json +81 -81
- package/exemplos/sistemas-interativos/game-pixel-16-bit.json +97 -97
- package/exemplos/sistemas-interativos/game-pixel-8-bit.json +94 -94
- package/exemplos/sistemas-interativos/game-xr-human.json +80 -80
- package/exemplos/sistemas-interativos/hybrid-2-5d.json +108 -108
- package/exemplos/sistemas-interativos/protocol-mutating-rollback-valid.json +75 -75
- package/exemplos/sistemas-interativos/protocol-read-only-valid.json +58 -58
- package/exemplos/sistemas-interativos/simulation-2d-controlled.json +97 -97
- package/exemplos/sistemas-interativos/simulation-3d-calibrated-autonomous.json +141 -141
- package/exemplos/sistemas-interativos/simulation-headless-autonomous-batch.json +112 -112
- package/exemplos/sistemas-interativos/simulation-pixel-16-bit.json +103 -103
- package/exemplos/sistemas-interativos/simulation-text-controlled.json +95 -95
- package/exemplos/testes_embutidos.sema +1 -1
- package/exemplos/tratamento_erro.sema +1 -1
- package/exemplos/upload_arquivo.sema +1 -1
- package/exemplos/webhook.sema +1 -1
- package/node_modules/@sema/gerador-cpp/dist/index.js +176 -176
- package/node_modules/@sema/gerador-cpp/package.json +1 -1
- package/node_modules/@sema/gerador-css/dist/index.part01.js +10 -10
- package/node_modules/@sema/gerador-css/dist/index.part02.js +460 -460
- package/node_modules/@sema/gerador-dotnet/dist/index.js +169 -169
- package/node_modules/@sema/gerador-dotnet/package.json +1 -1
- package/node_modules/@sema/gerador-html/dist/index.js +17 -17
- package/node_modules/@sema/gerador-lua/dist/index.js +51 -51
- package/node_modules/@sema/gerador-php/dist/index.js +113 -113
- package/node_modules/@sema/gerador-python/dist/index.part02.js +3 -3
- package/node_modules/@sema/gerador-typescript/dist/index.part02.js +11 -11
- package/node_modules/@sema/nucleo/dist/diagnosticos/melhorador.js +42 -42
- package/package.json +3 -3
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import ts from "typescript";
|
|
1
2
|
export interface SuperficieAngularStandaloneConsumer {
|
|
2
3
|
rota: string;
|
|
3
4
|
arquivo: string;
|
|
4
5
|
tipoArquivo: "app" | "component";
|
|
5
6
|
}
|
|
6
|
-
export
|
|
7
|
+
export type LeitorTextoAngularConsumer = (arquivo: string) => Promise<string>;
|
|
8
|
+
export declare function coletarSuperficiesAngularStandaloneConsumer(baseProjeto: string, arquivos: string[], leitorTexto?: LeitorTextoAngularConsumer, sourceFiles?: ReadonlyMap<string, ts.SourceFile>): Promise<SuperficieAngularStandaloneConsumer[]>;
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
// SEMA-GOVERNED: sema.produto.governanca_ia.drift
|
|
2
|
+
// Descricao: extrai superficies Angular usando o leitor compartilhado do plano de drift quando disponivel.
|
|
1
3
|
import { readFile } from "node:fs/promises";
|
|
2
4
|
import path from "node:path";
|
|
3
5
|
import ts from "typescript";
|
|
@@ -134,7 +136,7 @@ function extrairIdentificadorImportado(expressao) {
|
|
|
134
136
|
}
|
|
135
137
|
return undefined;
|
|
136
138
|
}
|
|
137
|
-
async function extrairTemplateAngularStandalone(baseProjeto, relacaoArquivo, metadata) {
|
|
139
|
+
async function extrairTemplateAngularStandalone(baseProjeto, relacaoArquivo, metadata, leitorTexto) {
|
|
138
140
|
const templateInline = extrairTextoLiteral(obterExpressaoPropriedade(metadata, "template"));
|
|
139
141
|
if (templateInline) {
|
|
140
142
|
return templateInline;
|
|
@@ -148,19 +150,21 @@ async function extrairTemplateAngularStandalone(baseProjeto, relacaoArquivo, met
|
|
|
148
150
|
return "";
|
|
149
151
|
}
|
|
150
152
|
try {
|
|
151
|
-
|
|
153
|
+
const arquivo = path.join(baseProjeto, templateRelativo);
|
|
154
|
+
return leitorTexto ? await leitorTexto(arquivo) : await readFile(arquivo, "utf8");
|
|
152
155
|
}
|
|
153
156
|
catch {
|
|
154
157
|
return "";
|
|
155
158
|
}
|
|
156
159
|
}
|
|
157
|
-
async function indexarComponenteAngularStandalone(baseProjeto, arquivo) {
|
|
160
|
+
async function indexarComponenteAngularStandalone(baseProjeto, arquivo, leitorTexto, sourceFiles) {
|
|
158
161
|
const relacaoArquivo = normalizarCaminhoConsumer(path.relative(baseProjeto, arquivo));
|
|
159
162
|
if (!arquivoEhComponenteAngularStandalone(relacaoArquivo)) {
|
|
160
163
|
return undefined;
|
|
161
164
|
}
|
|
162
|
-
const codigo = await readFile(arquivo, "utf8");
|
|
163
|
-
const sourceFile =
|
|
165
|
+
const codigo = leitorTexto ? await leitorTexto(arquivo) : await readFile(arquivo, "utf8");
|
|
166
|
+
const sourceFile = sourceFiles?.get(path.resolve(arquivo))
|
|
167
|
+
?? ts.createSourceFile(arquivo, codigo, ts.ScriptTarget.Latest, true, ts.ScriptKind.TS);
|
|
164
168
|
const imports = extrairImportsTypeScriptAngular(relacaoArquivo, codigo);
|
|
165
169
|
for (const statement of sourceFile.statements) {
|
|
166
170
|
if (!ts.isClassDeclaration(statement)) {
|
|
@@ -192,7 +196,7 @@ async function indexarComponenteAngularStandalone(baseProjeto, arquivo) {
|
|
|
192
196
|
arquivo: relacaoArquivo,
|
|
193
197
|
selector: extrairTextoLiteral(obterExpressaoPropriedade(metadata, "selector")),
|
|
194
198
|
imports: [...importsArquivos],
|
|
195
|
-
template: await extrairTemplateAngularStandalone(baseProjeto, relacaoArquivo, metadata),
|
|
199
|
+
template: await extrairTemplateAngularStandalone(baseProjeto, relacaoArquivo, metadata, leitorTexto),
|
|
196
200
|
raiz: arquivoEhRaizAngularStandalone(relacaoArquivo),
|
|
197
201
|
};
|
|
198
202
|
}
|
|
@@ -205,10 +209,10 @@ function templateReferenciaSelector(template, selector) {
|
|
|
205
209
|
const escapado = selector.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
206
210
|
return new RegExp(`<${escapado}(?:\\s|>)`, "i").test(template);
|
|
207
211
|
}
|
|
208
|
-
export async function coletarSuperficiesAngularStandaloneConsumer(baseProjeto, arquivos) {
|
|
212
|
+
export async function coletarSuperficiesAngularStandaloneConsumer(baseProjeto, arquivos, leitorTexto, sourceFiles) {
|
|
209
213
|
const componentes = new Map();
|
|
210
214
|
for (const arquivo of arquivos) {
|
|
211
|
-
const componente = await indexarComponenteAngularStandalone(baseProjeto, arquivo);
|
|
215
|
+
const componente = await indexarComponenteAngularStandalone(baseProjeto, arquivo, leitorTexto, sourceFiles);
|
|
212
216
|
if (componente) {
|
|
213
217
|
componentes.set(componente.arquivo, componente);
|
|
214
218
|
}
|
package/dist/drift.part01.d.ts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import type { EngineBanco, NivelConfiancaSemantica, NivelRiscoSemantico, TipoRecursoPersistencia } from "@sema/nucleo";
|
|
2
2
|
import type { ContextoProjetoCarregado } from "./projeto.js";
|
|
3
|
+
import type { PoliticaCacheDrift } from "./driftCache.js";
|
|
4
|
+
import type { MetricasCacheIncrementalDrift } from "./driftCacheIncremental.js";
|
|
5
|
+
import type { MetricasCatalogoDrift, ObservadorOperacaoDrift } from "./driftCatalogo.js";
|
|
3
6
|
export type OrigemCodigoDrift = "ts" | "js" | "py" | "dart" | "lua" | "cs" | "java" | "go" | "rust" | "cpp" | "php";
|
|
4
7
|
export type OrigemSimboloDrift = OrigemCodigoDrift | "sql";
|
|
5
8
|
export interface SimboloResolvido {
|
|
@@ -31,9 +34,11 @@ export interface OpcoesDriftLegado {
|
|
|
31
34
|
escopo?: EscopoDriftReal;
|
|
32
35
|
ignorarWorktrees?: boolean;
|
|
33
36
|
ignorarConsumidoresLaterais?: boolean;
|
|
37
|
+
cache?: PoliticaCacheDrift;
|
|
38
|
+
observador?: ObservadorOperacaoDrift;
|
|
34
39
|
}
|
|
35
40
|
export interface DiagnosticoDrift {
|
|
36
|
-
tipo: "impl_quebrado" | "task_sem_impl" | "rota_divergente" | "recurso_divergente" | "vinculo_quebrado" | "seguranca_frouxa" | "pontuacao_semantica_insuficiente" | "contrato_monolitico" | "codigo_monolitico" | "codigo_governado_sem_cabecalho";
|
|
41
|
+
tipo: "impl_quebrado" | "task_sem_impl" | "rota_divergente" | "recurso_divergente" | "vinculo_quebrado" | "seguranca_frouxa" | "pontuacao_semantica_insuficiente" | "contrato_monolitico" | "codigo_monolitico" | "codigo_governado_sem_cabecalho" | "escopo_estreito_sem_vinculos";
|
|
37
42
|
modulo: string;
|
|
38
43
|
task?: string;
|
|
39
44
|
route?: string;
|
|
@@ -159,6 +164,28 @@ export interface ConfiguracaoEscopoDriftAplicada {
|
|
|
159
164
|
ignorarWorktrees: boolean;
|
|
160
165
|
ignorarConsumidoresLaterais: boolean;
|
|
161
166
|
termosEscopo: string[];
|
|
167
|
+
estrategia?: "arquivos_vinculados" | "projeto";
|
|
168
|
+
cobertura?: "completa" | "parcial";
|
|
169
|
+
arquivosPlanejados?: string[];
|
|
170
|
+
arquivosDeclarados?: string[];
|
|
171
|
+
arquivosInferidos?: string[];
|
|
172
|
+
arquivosAusentes?: string[];
|
|
173
|
+
bloqueios?: string[];
|
|
174
|
+
cache?: {
|
|
175
|
+
politica: PoliticaCacheDrift;
|
|
176
|
+
origem: "cache" | "calculado" | "nao_aplicavel";
|
|
177
|
+
chave?: string;
|
|
178
|
+
incremental?: MetricasCacheIncrementalDrift;
|
|
179
|
+
fasesMs?: {
|
|
180
|
+
planejamento: number;
|
|
181
|
+
catalogacao: number;
|
|
182
|
+
dependencias: number;
|
|
183
|
+
assinaturas: number;
|
|
184
|
+
indexacao: number;
|
|
185
|
+
total: number;
|
|
186
|
+
};
|
|
187
|
+
};
|
|
188
|
+
catalogo?: MetricasCatalogoDrift;
|
|
162
189
|
}
|
|
163
190
|
export interface RegistroImpactoSemanticoArquivo {
|
|
164
191
|
arquivo: string;
|
|
@@ -251,7 +278,10 @@ export declare function obterDiretoriosIgnoradosAtivos(): Set<string>;
|
|
|
251
278
|
export declare function definirDiretoriosIgnoradosAtivos(diretorios: Set<string>): void;
|
|
252
279
|
export declare function normalizarFragmentoArquivo(valor: string): string;
|
|
253
280
|
export declare function normalizarEscopoDrift(valor?: string): EscopoDriftReal;
|
|
254
|
-
export
|
|
281
|
+
export type OpcoesDriftLegadoResolvidas = Required<Omit<OpcoesDriftLegado, "observador">> & {
|
|
282
|
+
observador?: ObservadorOperacaoDrift;
|
|
283
|
+
};
|
|
284
|
+
export declare function resolverOpcoesDrift(opcoes?: OpcoesDriftLegado): OpcoesDriftLegadoResolvidas;
|
|
255
285
|
export declare function resolverDiretoriosIgnoradosAtivos(opcoes?: OpcoesDriftLegado): Set<string>;
|
|
256
286
|
export declare function quebrarTermosEscopo(valor: string): string[];
|
|
257
287
|
export declare function quebrarTermosModuloEscopo(nomeModulo: string): string[];
|
package/dist/drift.part01.js
CHANGED
|
@@ -91,6 +91,8 @@ export function resolverOpcoesDrift(opcoes) {
|
|
|
91
91
|
escopo: normalizarEscopoDrift(opcoes?.escopo),
|
|
92
92
|
ignorarWorktrees: opcoes?.ignorarWorktrees !== false,
|
|
93
93
|
ignorarConsumidoresLaterais: opcoes?.ignorarConsumidoresLaterais !== false,
|
|
94
|
+
cache: opcoes?.cache === "refresh" || opcoes?.cache === "off" ? opcoes.cache : "auto",
|
|
95
|
+
observador: opcoes?.observador,
|
|
94
96
|
};
|
|
95
97
|
}
|
|
96
98
|
export function resolverDiretoriosIgnoradosAtivos(opcoes) {
|
package/dist/drift.part04.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import ts from "typescript";
|
|
|
2
2
|
import type { IrModulo, IrSuperficie, IrTask, IrVinculo, NivelConfiancaSemantica, NivelRiscoSemantico } from "@sema/nucleo";
|
|
3
3
|
import { ResultadoDrift, SimboloResolvido } from "./drift.part01.js";
|
|
4
4
|
import { type PoliticaPontuacaoSemantica } from "./driftScore.js";
|
|
5
|
+
import type { CatalogoDrift } from "./driftCatalogo.js";
|
|
5
6
|
export declare function resolverArquivoOuSimboloAncora(vinculos: IrVinculo[], simbolos: SimboloResolvido[], mapaImpl: Map<string, SimboloResolvido>, arquivos: string[]): {
|
|
6
7
|
arquivo?: string;
|
|
7
8
|
simbolo?: string;
|
|
@@ -37,9 +38,9 @@ export declare function lerDecorator(node: ts.Node, nomes: string[]): {
|
|
|
37
38
|
argumentos: ts.NodeArray<ts.Expression>;
|
|
38
39
|
} | undefined;
|
|
39
40
|
export declare function juntarCaminhoHttp(base: string | undefined, sufixo: string | undefined): string;
|
|
40
|
-
export declare function listarArquivosRecursivos(diretorio: string, extensoes: string[]): Promise<string[]>;
|
|
41
|
+
export declare function listarArquivosRecursivos(diretorio: string, extensoes: string[], catalogo?: CatalogoDrift): Promise<string[]>;
|
|
41
42
|
export declare const EXTENSOES_ARQUIVOS_RASTREAVEIS_DRIFT: string[];
|
|
42
|
-
export declare function indexarArquivosRastreaveis(diretorios: string[]): Promise<string[]>;
|
|
43
|
+
export declare function indexarArquivosRastreaveis(diretorios: string[], catalogo?: CatalogoDrift): Promise<string[]>;
|
|
43
44
|
export declare function caminhosSimbolicos(baseDiretorio: string, arquivo: string): string[];
|
|
44
45
|
export declare function registrarSimboloTypeScript(simbolos: Map<string, SimboloResolvido>, basesSimbolicas: string[], arquivo: string, nome: string, nomeClasse?: string, origem?: "ts" | "js"): void;
|
|
45
46
|
export declare function desembrulharExpressaoTypeScript(expr: ts.Expression): ts.Expression;
|
package/dist/drift.part04.js
CHANGED
|
@@ -258,7 +258,10 @@ export function juntarCaminhoHttp(base, sufixo) {
|
|
|
258
258
|
const caminho = `/${partes.join("/")}`.replace(/\/+/g, "/");
|
|
259
259
|
return caminho === "//" ? "/" : caminho;
|
|
260
260
|
}
|
|
261
|
-
export async function listarArquivosRecursivos(diretorio, extensoes) {
|
|
261
|
+
export async function listarArquivosRecursivos(diretorio, extensoes, catalogo) {
|
|
262
|
+
if (catalogo) {
|
|
263
|
+
return catalogo.listarPorRaiz(diretorio, extensoes);
|
|
264
|
+
}
|
|
262
265
|
let entradas;
|
|
263
266
|
try {
|
|
264
267
|
entradas = await readdir(diretorio, { withFileTypes: true, encoding: "utf8" });
|
|
@@ -291,10 +294,10 @@ export const EXTENSOES_ARQUIVOS_RASTREAVEIS_DRIFT = [
|
|
|
291
294
|
".yml", ".yaml", ".toml", ".xml", ".html", ".htm", ".css",
|
|
292
295
|
".Caddyfile", ".caddyfile",
|
|
293
296
|
];
|
|
294
|
-
export async function indexarArquivosRastreaveis(diretorios) {
|
|
297
|
+
export async function indexarArquivosRastreaveis(diretorios, catalogo) {
|
|
295
298
|
const arquivos = new Set();
|
|
296
299
|
for (const diretorio of diretorios) {
|
|
297
|
-
for (const arquivo of await listarArquivosRecursivos(diretorio, EXTENSOES_ARQUIVOS_RASTREAVEIS_DRIFT)) {
|
|
300
|
+
for (const arquivo of await listarArquivosRecursivos(diretorio, EXTENSOES_ARQUIVOS_RASTREAVEIS_DRIFT, catalogo)) {
|
|
298
301
|
arquivos.add(arquivo);
|
|
299
302
|
}
|
|
300
303
|
}
|
package/dist/drift.part05.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import ts from "typescript";
|
|
2
2
|
import { RegistroConsumerSurfaceDrift, SimboloResolvido } from "./drift.part01.js";
|
|
3
|
+
import type { CatalogoDrift } from "./driftCatalogo.js";
|
|
3
4
|
export declare function registrarMetodoTypeScriptProtoOuObjeto(simbolos: Map<string, SimboloResolvido>, basesSimbolicas: string[], arquivo: string, nomeMetodo: string, nomeClasse?: string, origem?: "ts" | "js"): void;
|
|
4
5
|
export declare function registrarMetodosObjectAssignTypeScript(simbolos: Map<string, SimboloResolvido>, basesSimbolicas: string[], arquivo: string, objeto: ts.ObjectLiteralExpression, sourceFile: ts.SourceFile, nomeClasse?: string, origem?: "ts" | "js"): void;
|
|
5
6
|
export declare function registrarAtribuicaoPrototypeTypeScript(simbolos: Map<string, SimboloResolvido>, basesSimbolicas: string[], arquivo: string, sourceFile: ts.SourceFile, esquerda: ts.Expression, direita: ts.Expression, origem?: "ts" | "js"): void;
|
|
@@ -43,5 +44,5 @@ export declare function extrairRotasReactViteConsumer(relacaoArquivo: string, co
|
|
|
43
44
|
export declare function normalizarRotaDeclaradaFlutter(caminhoCru: string): string;
|
|
44
45
|
export declare function extrairRotasFlutterConsumer(relacaoArquivo: string, codigo: string): RotaFlutterConsumerDrift[];
|
|
45
46
|
export declare function extrairRotasAngularConsumerDiretas(relacaoArquivo: string, codigo: string, prefixo?: string): RotaAngularConsumerDrift[];
|
|
46
|
-
export declare function extrairRotasAngularConsumer(diretorioBase: string, relacaoArquivo: string, prefixo?: string, visitados?: Set<string
|
|
47
|
+
export declare function extrairRotasAngularConsumer(diretorioBase: string, relacaoArquivo: string, prefixo?: string, visitados?: Set<string>, catalogo?: CatalogoDrift): Promise<RotaAngularConsumerDrift[]>;
|
|
47
48
|
export declare function simboloEhBridgeConsumer(caminho: string, arquivo: string): boolean;
|
package/dist/drift.part05.js
CHANGED
|
@@ -318,7 +318,7 @@ export function extrairRotasAngularConsumerDiretas(relacaoArquivo, codigo, prefi
|
|
|
318
318
|
}
|
|
319
319
|
return rotas;
|
|
320
320
|
}
|
|
321
|
-
export async function extrairRotasAngularConsumer(diretorioBase, relacaoArquivo, prefixo = "/", visitados = new Set()) {
|
|
321
|
+
export async function extrairRotasAngularConsumer(diretorioBase, relacaoArquivo, prefixo = "/", visitados = new Set(), catalogo) {
|
|
322
322
|
const relacaoNormalizada = normalizarRelacaoConsumer(relacaoArquivo);
|
|
323
323
|
if (visitados.has(relacaoNormalizada)) {
|
|
324
324
|
return [];
|
|
@@ -326,7 +326,8 @@ export async function extrairRotasAngularConsumer(diretorioBase, relacaoArquivo,
|
|
|
326
326
|
visitados.add(relacaoNormalizada);
|
|
327
327
|
let codigo = "";
|
|
328
328
|
try {
|
|
329
|
-
|
|
329
|
+
const arquivo = path.join(diretorioBase, relacaoNormalizada);
|
|
330
|
+
codigo = catalogo ? await catalogo.lerTexto(arquivo) : await readFile(arquivo, "utf8");
|
|
330
331
|
}
|
|
331
332
|
catch {
|
|
332
333
|
return [];
|
|
@@ -337,7 +338,7 @@ export async function extrairRotasAngularConsumer(diretorioBase, relacaoArquivo,
|
|
|
337
338
|
if (!rota.arquivoRotasFilhas) {
|
|
338
339
|
continue;
|
|
339
340
|
}
|
|
340
|
-
filhas.push(...await extrairRotasAngularConsumer(diretorioBase, rota.arquivoRotasFilhas, rota.rota, visitados));
|
|
341
|
+
filhas.push(...await extrairRotasAngularConsumer(diretorioBase, rota.arquivoRotasFilhas, rota.rota, visitados, catalogo));
|
|
341
342
|
}
|
|
342
343
|
return [...rotas, ...filhas];
|
|
343
344
|
}
|
package/dist/drift.part06.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import type { FonteLegado } from "./tipos.js";
|
|
2
2
|
import { ConsumerFramework, RecursoResolvido, RegistroConsumerBridgeDrift, RegistroConsumerSurfaceDrift, RotaResolvida, SimboloResolvido } from "./drift.part01.js";
|
|
3
|
+
import type { CatalogoDrift } from "./driftCatalogo.js";
|
|
3
4
|
export declare function inferirConsumerFrameworkPrincipal(fontesLegado: FonteLegado[], consumerSurfaces: RegistroConsumerSurfaceDrift[], consumerBridges: RegistroConsumerBridgeDrift[]): ConsumerFramework | null;
|
|
4
5
|
export declare function extrairColecoesFirebase(arquivo: string, codigo: string): RecursoResolvido[];
|
|
5
|
-
export declare function indexarTypeScript(diretorios: string[]): Promise<{
|
|
6
|
+
export declare function indexarTypeScript(diretorios: string[], catalogo?: CatalogoDrift): Promise<{
|
|
6
7
|
simbolos: SimboloResolvido[];
|
|
7
8
|
rotas: RotaResolvida[];
|
|
8
9
|
recursos: RecursoResolvido[];
|
package/dist/drift.part06.js
CHANGED
|
@@ -126,13 +126,15 @@ function aplicarReexportacoesTypeScript(simbolos, reexportacoes) {
|
|
|
126
126
|
}
|
|
127
127
|
}
|
|
128
128
|
}
|
|
129
|
-
export async function indexarTypeScript(diretorios) {
|
|
129
|
+
export async function indexarTypeScript(diretorios, catalogo) {
|
|
130
|
+
catalogo?.emitir("extractor.run");
|
|
130
131
|
const simbolos = new Map();
|
|
131
132
|
const rotas = [];
|
|
132
133
|
const recursos = new Map();
|
|
133
134
|
const consumerSurfaces = new Map();
|
|
135
|
+
const sourceFiles = new Map();
|
|
134
136
|
for (const diretorio of diretorios) {
|
|
135
|
-
const arquivos = (await listarArquivosRecursivos(diretorio, [".ts", ".tsx", ".js", ".jsx", ".mjs", ".cjs"]))
|
|
137
|
+
const arquivos = (await listarArquivosRecursivos(diretorio, [".ts", ".tsx", ".js", ".jsx", ".mjs", ".cjs"], catalogo))
|
|
136
138
|
.filter((arquivo) => !arquivo.endsWith(".d.ts")
|
|
137
139
|
&& !arquivo.endsWith(".spec.ts")
|
|
138
140
|
&& !arquivo.endsWith(".test.ts"));
|
|
@@ -144,7 +146,7 @@ export async function indexarTypeScript(diretorios) {
|
|
|
144
146
|
let encontrouSuperficieAngularPorRotas = false;
|
|
145
147
|
const reexportacoes = [];
|
|
146
148
|
for (const arquivo of arquivos) {
|
|
147
|
-
const codigo = await readFile(arquivo, "utf8");
|
|
149
|
+
const codigo = catalogo ? await catalogo.lerTexto(arquivo) : await readFile(arquivo, "utf8");
|
|
148
150
|
const origemArquivo = /\.(?:js|jsx|mjs|cjs)$/i.test(arquivo) ? "js" : "ts";
|
|
149
151
|
const scriptKind = arquivo.endsWith(".tsx")
|
|
150
152
|
? ts.ScriptKind.TSX
|
|
@@ -153,7 +155,9 @@ export async function indexarTypeScript(diretorios) {
|
|
|
153
155
|
: origemArquivo === "js"
|
|
154
156
|
? ts.ScriptKind.JS
|
|
155
157
|
: ts.ScriptKind.TS;
|
|
158
|
+
catalogo?.emitir("ast.create", arquivo);
|
|
156
159
|
const sourceFile = ts.createSourceFile(arquivo, codigo, ts.ScriptTarget.Latest, true, scriptKind);
|
|
160
|
+
sourceFiles.set(path.resolve(arquivo), sourceFile);
|
|
157
161
|
const basesSimbolicas = caminhosSimbolicos(diretorio, arquivo);
|
|
158
162
|
const relacao = path.relative(diretorio, arquivo);
|
|
159
163
|
for (const recurso of extrairRecursosPersistenciaCodigoVivo(arquivo, codigo)) {
|
|
@@ -228,7 +232,7 @@ export async function indexarTypeScript(diretorios) {
|
|
|
228
232
|
}
|
|
229
233
|
if (arquivoEhRotasAngularConsumer(relacao) && (!usarApenasRotasAngularRaiz || arquivosRotasAngularRaiz.has(path.resolve(arquivo)))) {
|
|
230
234
|
encontrouSuperficieAngularPorRotas = true;
|
|
231
|
-
for (const rotaAngular of await extrairRotasAngularConsumer(diretorio, relacao)) {
|
|
235
|
+
for (const rotaAngular of await extrairRotasAngularConsumer(diretorio, relacao, "/", new Set(), catalogo)) {
|
|
232
236
|
const arquivoRotasAngular = path.join(diretorio, rotaAngular.arquivoRotas);
|
|
233
237
|
consumerSurfaces.set(`${rotaAngular.rota}:${arquivoRotasAngular}:routes`, {
|
|
234
238
|
rota: rotaAngular.rota,
|
|
@@ -328,7 +332,7 @@ export async function indexarTypeScript(diretorios) {
|
|
|
328
332
|
}
|
|
329
333
|
}
|
|
330
334
|
if (!encontrouSuperficieAngularPorRotas) {
|
|
331
|
-
for (const superficie of await coletarSuperficiesAngularStandaloneConsumer(diretorio, arquivos)) {
|
|
335
|
+
for (const superficie of await coletarSuperficiesAngularStandaloneConsumer(diretorio, arquivos, catalogo ? (arquivo) => catalogo.lerTexto(arquivo) : undefined, sourceFiles)) {
|
|
332
336
|
const arquivoSuperficie = path.join(diretorio, superficie.arquivo);
|
|
333
337
|
consumerSurfaces.set(`${superficie.rota}:${arquivoSuperficie}:${superficie.tipoArquivo}`, {
|
|
334
338
|
rota: superficie.rota,
|
package/dist/drift.part07.d.ts
CHANGED
|
@@ -1,51 +1,52 @@
|
|
|
1
1
|
import type { EngineBanco } from "@sema/nucleo";
|
|
2
2
|
import { OrigemRecursoDrift, RecursoResolvido, RegistroColunaPersistenciaDrift, RegistroConsumerSurfaceDrift, RotaResolvida, SimboloResolvido } from "./drift.part01.js";
|
|
3
|
-
|
|
3
|
+
import type { CatalogoDrift } from "./driftCatalogo.js";
|
|
4
|
+
export declare function indexarPython(diretorios: string[], catalogo?: CatalogoDrift): Promise<{
|
|
4
5
|
simbolos: SimboloResolvido[];
|
|
5
6
|
rotas: RotaResolvida[];
|
|
6
7
|
recursos: RecursoResolvido[];
|
|
7
8
|
}>;
|
|
8
|
-
export declare function indexarDart(diretorios: string[]): Promise<{
|
|
9
|
+
export declare function indexarDart(diretorios: string[], catalogo?: CatalogoDrift): Promise<{
|
|
9
10
|
simbolos: SimboloResolvido[];
|
|
10
11
|
rotas: RotaResolvida[];
|
|
11
12
|
recursos: RecursoResolvido[];
|
|
12
13
|
consumerSurfaces: RegistroConsumerSurfaceDrift[];
|
|
13
14
|
}>;
|
|
14
15
|
export declare function registrarSimboloGenerico(simbolos: Map<string, SimboloResolvido>, origem: SimboloResolvido["origem"], basesSimbolicas: string[], arquivo: string, simbolo: string): void;
|
|
15
|
-
export declare function indexarDotnet(diretorios: string[]): Promise<{
|
|
16
|
+
export declare function indexarDotnet(diretorios: string[], catalogo?: CatalogoDrift): Promise<{
|
|
16
17
|
simbolos: SimboloResolvido[];
|
|
17
18
|
rotas: RotaResolvida[];
|
|
18
19
|
recursos: RecursoResolvido[];
|
|
19
20
|
}>;
|
|
20
|
-
export declare function indexarJava(diretorios: string[]): Promise<{
|
|
21
|
+
export declare function indexarJava(diretorios: string[], catalogo?: CatalogoDrift): Promise<{
|
|
21
22
|
simbolos: SimboloResolvido[];
|
|
22
23
|
rotas: RotaResolvida[];
|
|
23
24
|
recursos: RecursoResolvido[];
|
|
24
25
|
}>;
|
|
25
|
-
export declare function indexarGo(diretorios: string[]): Promise<{
|
|
26
|
+
export declare function indexarGo(diretorios: string[], catalogo?: CatalogoDrift): Promise<{
|
|
26
27
|
simbolos: SimboloResolvido[];
|
|
27
28
|
rotas: RotaResolvida[];
|
|
28
29
|
recursos: RecursoResolvido[];
|
|
29
30
|
}>;
|
|
30
|
-
export declare function indexarRust(diretorios: string[]): Promise<{
|
|
31
|
+
export declare function indexarRust(diretorios: string[], catalogo?: CatalogoDrift): Promise<{
|
|
31
32
|
simbolos: SimboloResolvido[];
|
|
32
33
|
rotas: RotaResolvida[];
|
|
33
34
|
recursos: RecursoResolvido[];
|
|
34
35
|
}>;
|
|
35
|
-
export declare function indexarCpp(diretorios: string[]): Promise<{
|
|
36
|
+
export declare function indexarCpp(diretorios: string[], catalogo?: CatalogoDrift): Promise<{
|
|
36
37
|
simbolos: SimboloResolvido[];
|
|
37
38
|
recursos: RecursoResolvido[];
|
|
38
39
|
}>;
|
|
39
|
-
export declare function indexarPhp(diretorios: string[]): Promise<{
|
|
40
|
+
export declare function indexarPhp(diretorios: string[], catalogo?: CatalogoDrift): Promise<{
|
|
40
41
|
simbolos: SimboloResolvido[];
|
|
41
42
|
rotas: RotaResolvida[];
|
|
42
43
|
recursos: RecursoResolvido[];
|
|
43
44
|
}>;
|
|
44
|
-
export declare function indexarLua(diretorios: string[]): Promise<{
|
|
45
|
+
export declare function indexarLua(diretorios: string[], catalogo?: CatalogoDrift): Promise<{
|
|
45
46
|
simbolos: SimboloResolvido[];
|
|
46
47
|
recursos: RecursoResolvido[];
|
|
47
48
|
}>;
|
|
48
|
-
export declare function indexarPersistenciaDeclarativa(diretorios: string[]): Promise<{
|
|
49
|
+
export declare function indexarPersistenciaDeclarativa(diretorios: string[], catalogo?: CatalogoDrift): Promise<{
|
|
49
50
|
recursos: RecursoResolvido[];
|
|
50
51
|
simbolos: SimboloResolvido[];
|
|
51
52
|
}>;
|
package/dist/drift.part07.js
CHANGED
|
@@ -16,15 +16,16 @@ import { extrairRecursosPersistenciaCodigoVivo, extrairRecursosPrisma, extrairSi
|
|
|
16
16
|
import { registrarRotasPython, registrarSimboloPython } from "./drift.part06.js";
|
|
17
17
|
import { arquivoEhRotasFlutterConsumer, extrairRotasFlutterConsumer, inferirRotaFlutterConsumer } from "./drift.part05.js";
|
|
18
18
|
import { fecharPrefixoRecurso, limparLiteralRecurso, normalizarNomeRecursoDrift } from "./drift.part02.js";
|
|
19
|
-
export async function indexarPython(diretorios) {
|
|
19
|
+
export async function indexarPython(diretorios, catalogo) {
|
|
20
|
+
catalogo?.emitir("extractor.run");
|
|
20
21
|
const simbolos = new Map();
|
|
21
22
|
const rotas = [];
|
|
22
23
|
const recursos = new Map();
|
|
23
24
|
for (const diretorio of diretorios) {
|
|
24
|
-
const arquivos = (await listarArquivosRecursivos(diretorio, [".py"]))
|
|
25
|
+
const arquivos = (await listarArquivosRecursivos(diretorio, [".py"], catalogo))
|
|
25
26
|
.filter((arquivo) => !arquivo.endsWith("__init__.py") && !/tests?[\\/]/i.test(arquivo));
|
|
26
27
|
for (const arquivo of arquivos) {
|
|
27
|
-
const texto = await readFile(arquivo, "utf8");
|
|
28
|
+
const texto = catalogo ? await catalogo.lerTexto(arquivo) : await readFile(arquivo, "utf8");
|
|
28
29
|
const basesSimbolicas = caminhosSimbolicos(diretorio, arquivo);
|
|
29
30
|
const prefixo = texto.match(/APIRouter\s*\(\s*prefix\s*=\s*["']([^"']+)["']/)?.[1];
|
|
30
31
|
for (const recurso of extrairRecursosPersistenciaCodigoVivo(arquivo, texto)) {
|
|
@@ -83,16 +84,17 @@ export async function indexarPython(diretorios) {
|
|
|
83
84
|
}
|
|
84
85
|
return { simbolos: [...simbolos.values()], rotas, recursos: [...recursos.values()] };
|
|
85
86
|
}
|
|
86
|
-
export async function indexarDart(diretorios) {
|
|
87
|
+
export async function indexarDart(diretorios, catalogo) {
|
|
88
|
+
catalogo?.emitir("extractor.run");
|
|
87
89
|
const simbolos = new Map();
|
|
88
90
|
const rotas = [];
|
|
89
91
|
const recursos = new Map();
|
|
90
92
|
const consumerSurfaces = new Map();
|
|
91
93
|
for (const diretorio of diretorios) {
|
|
92
|
-
const arquivos = (await listarArquivosRecursivos(diretorio, [".dart"]))
|
|
94
|
+
const arquivos = (await listarArquivosRecursivos(diretorio, [".dart"], catalogo))
|
|
93
95
|
.filter((arquivo) => !arquivo.endsWith(".g.dart") && !arquivo.endsWith(".freezed.dart"));
|
|
94
96
|
for (const arquivo of arquivos) {
|
|
95
|
-
const texto = await readFile(arquivo, "utf8");
|
|
97
|
+
const texto = catalogo ? await catalogo.lerTexto(arquivo) : await readFile(arquivo, "utf8");
|
|
96
98
|
const basesSimbolicas = caminhosSimbolicos(diretorio, arquivo);
|
|
97
99
|
const relacao = path.relative(diretorio, arquivo);
|
|
98
100
|
for (const recurso of extrairRecursosPersistenciaCodigoVivo(arquivo, texto)) {
|
|
@@ -173,15 +175,16 @@ export function registrarSimboloGenerico(simbolos, origem, basesSimbolicas, arqu
|
|
|
173
175
|
}
|
|
174
176
|
}
|
|
175
177
|
}
|
|
176
|
-
export async function indexarDotnet(diretorios) {
|
|
178
|
+
export async function indexarDotnet(diretorios, catalogo) {
|
|
179
|
+
catalogo?.emitir("extractor.run");
|
|
177
180
|
const simbolos = new Map();
|
|
178
181
|
const rotas = [];
|
|
179
182
|
const recursos = new Map();
|
|
180
183
|
for (const diretorio of diretorios) {
|
|
181
|
-
const arquivos = (await listarArquivosRecursivos(diretorio, [".cs"]))
|
|
184
|
+
const arquivos = (await listarArquivosRecursivos(diretorio, [".cs"], catalogo))
|
|
182
185
|
.filter((arquivo) => !/(^|[\\/])(bin|obj|Test[s]?)([\\/]|$)/i.test(arquivo));
|
|
183
186
|
for (const arquivo of arquivos) {
|
|
184
|
-
const codigo = await readFile(arquivo, "utf8");
|
|
187
|
+
const codigo = catalogo ? await catalogo.lerTexto(arquivo) : await readFile(arquivo, "utf8");
|
|
185
188
|
const basesSimbolicas = caminhosSimbolicos(diretorio, arquivo);
|
|
186
189
|
for (const recurso of extrairRecursosPersistenciaCodigoVivo(arquivo, codigo)) {
|
|
187
190
|
registrarRecursoDrift(recursos, recurso.origem, recurso.tipo, recurso.nome, recurso.arquivo, recurso.simbolo);
|
|
@@ -202,15 +205,16 @@ export async function indexarDotnet(diretorios) {
|
|
|
202
205
|
}
|
|
203
206
|
return { simbolos: [...simbolos.values()], rotas, recursos: [...recursos.values()] };
|
|
204
207
|
}
|
|
205
|
-
export async function indexarJava(diretorios) {
|
|
208
|
+
export async function indexarJava(diretorios, catalogo) {
|
|
209
|
+
catalogo?.emitir("extractor.run");
|
|
206
210
|
const simbolos = new Map();
|
|
207
211
|
const rotas = [];
|
|
208
212
|
const recursos = new Map();
|
|
209
213
|
for (const diretorio of diretorios) {
|
|
210
|
-
const arquivos = (await listarArquivosRecursivos(diretorio, [".java"]))
|
|
214
|
+
const arquivos = (await listarArquivosRecursivos(diretorio, [".java"], catalogo))
|
|
211
215
|
.filter((arquivo) => !/(^|[\\/])(target|build|out|Test[s]?)([\\/]|$)/i.test(arquivo));
|
|
212
216
|
for (const arquivo of arquivos) {
|
|
213
|
-
const codigo = await readFile(arquivo, "utf8");
|
|
217
|
+
const codigo = catalogo ? await catalogo.lerTexto(arquivo) : await readFile(arquivo, "utf8");
|
|
214
218
|
const basesSimbolicas = caminhosSimbolicos(diretorio, arquivo);
|
|
215
219
|
for (const recurso of extrairRecursosPersistenciaCodigoVivo(arquivo, codigo)) {
|
|
216
220
|
registrarRecursoDrift(recursos, recurso.origem, recurso.tipo, recurso.nome, recurso.arquivo, recurso.simbolo);
|
|
@@ -231,14 +235,15 @@ export async function indexarJava(diretorios) {
|
|
|
231
235
|
}
|
|
232
236
|
return { simbolos: [...simbolos.values()], rotas, recursos: [...recursos.values()] };
|
|
233
237
|
}
|
|
234
|
-
export async function indexarGo(diretorios) {
|
|
238
|
+
export async function indexarGo(diretorios, catalogo) {
|
|
239
|
+
catalogo?.emitir("extractor.run");
|
|
235
240
|
const simbolos = new Map();
|
|
236
241
|
const rotas = [];
|
|
237
242
|
const recursos = new Map();
|
|
238
243
|
for (const diretorio of diretorios) {
|
|
239
|
-
const arquivos = await listarArquivosRecursivos(diretorio, [".go"]);
|
|
244
|
+
const arquivos = await listarArquivosRecursivos(diretorio, [".go"], catalogo);
|
|
240
245
|
for (const arquivo of arquivos) {
|
|
241
|
-
const codigo = await readFile(arquivo, "utf8");
|
|
246
|
+
const codigo = catalogo ? await catalogo.lerTexto(arquivo) : await readFile(arquivo, "utf8");
|
|
242
247
|
const basesSimbolicas = caminhosSimbolicos(diretorio, arquivo);
|
|
243
248
|
for (const recurso of extrairRecursosPersistenciaCodigoVivo(arquivo, codigo)) {
|
|
244
249
|
registrarRecursoDrift(recursos, recurso.origem, recurso.tipo, recurso.nome, recurso.arquivo, recurso.simbolo);
|
|
@@ -259,14 +264,15 @@ export async function indexarGo(diretorios) {
|
|
|
259
264
|
}
|
|
260
265
|
return { simbolos: [...simbolos.values()], rotas, recursos: [...recursos.values()] };
|
|
261
266
|
}
|
|
262
|
-
export async function indexarRust(diretorios) {
|
|
267
|
+
export async function indexarRust(diretorios, catalogo) {
|
|
268
|
+
catalogo?.emitir("extractor.run");
|
|
263
269
|
const simbolos = new Map();
|
|
264
270
|
const rotas = [];
|
|
265
271
|
const recursos = new Map();
|
|
266
272
|
for (const diretorio of diretorios) {
|
|
267
|
-
const arquivos = await listarArquivosRecursivos(diretorio, [".rs"]);
|
|
273
|
+
const arquivos = await listarArquivosRecursivos(diretorio, [".rs"], catalogo);
|
|
268
274
|
for (const arquivo of arquivos) {
|
|
269
|
-
const codigo = await readFile(arquivo, "utf8");
|
|
275
|
+
const codigo = catalogo ? await catalogo.lerTexto(arquivo) : await readFile(arquivo, "utf8");
|
|
270
276
|
const basesSimbolicas = caminhosSimbolicos(diretorio, arquivo);
|
|
271
277
|
for (const recurso of extrairRecursosPersistenciaCodigoVivo(arquivo, codigo)) {
|
|
272
278
|
registrarRecursoDrift(recursos, recurso.origem, recurso.tipo, recurso.nome, recurso.arquivo, recurso.simbolo);
|
|
@@ -287,14 +293,15 @@ export async function indexarRust(diretorios) {
|
|
|
287
293
|
}
|
|
288
294
|
return { simbolos: [...simbolos.values()], rotas, recursos: [...recursos.values()] };
|
|
289
295
|
}
|
|
290
|
-
export async function indexarCpp(diretorios) {
|
|
296
|
+
export async function indexarCpp(diretorios, catalogo) {
|
|
297
|
+
catalogo?.emitir("extractor.run");
|
|
291
298
|
const simbolos = new Map();
|
|
292
299
|
const recursos = new Map();
|
|
293
300
|
for (const diretorio of diretorios) {
|
|
294
|
-
const arquivos = (await listarArquivosRecursivos(diretorio, [".cpp", ".cc", ".cxx", ".hpp", ".h"]))
|
|
301
|
+
const arquivos = (await listarArquivosRecursivos(diretorio, [".cpp", ".cc", ".cxx", ".hpp", ".h"], catalogo))
|
|
295
302
|
.filter((arquivo) => !/(^|[\\/])(windows|linux|macos|runner|flutter|ephemeral|build|vendor)([\\/]|$)/i.test(arquivo));
|
|
296
303
|
for (const arquivo of arquivos) {
|
|
297
|
-
const codigo = await readFile(arquivo, "utf8");
|
|
304
|
+
const codigo = catalogo ? await catalogo.lerTexto(arquivo) : await readFile(arquivo, "utf8");
|
|
298
305
|
const basesSimbolicas = caminhosSimbolicos(diretorio, arquivo);
|
|
299
306
|
for (const recurso of extrairRecursosPersistenciaCodigoVivo(arquivo, codigo)) {
|
|
300
307
|
registrarRecursoDrift(recursos, recurso.origem, recurso.tipo, recurso.nome, recurso.arquivo, recurso.simbolo);
|
|
@@ -309,15 +316,16 @@ export async function indexarCpp(diretorios) {
|
|
|
309
316
|
recursos: [...recursos.values()],
|
|
310
317
|
};
|
|
311
318
|
}
|
|
312
|
-
export async function indexarPhp(diretorios) {
|
|
319
|
+
export async function indexarPhp(diretorios, catalogo) {
|
|
320
|
+
catalogo?.emitir("extractor.run");
|
|
313
321
|
const simbolos = new Map();
|
|
314
322
|
const rotas = [];
|
|
315
323
|
const recursos = new Map();
|
|
316
324
|
for (const diretorio of diretorios) {
|
|
317
|
-
const arquivos = (await listarArquivosRecursivos(diretorio, [".php"]))
|
|
325
|
+
const arquivos = (await listarArquivosRecursivos(diretorio, [".php"], catalogo))
|
|
318
326
|
.filter((arquivo) => !/(^|[\\/])(vendor|storage|bootstrap[\\/]cache|cache|tests?)([\\/]|$)/i.test(arquivo));
|
|
319
327
|
for (const arquivo of arquivos) {
|
|
320
|
-
const codigo = await readFile(arquivo, "utf8");
|
|
328
|
+
const codigo = catalogo ? await catalogo.lerTexto(arquivo) : await readFile(arquivo, "utf8");
|
|
321
329
|
const basesSimbolicas = caminhosSimbolicos(diretorio, arquivo);
|
|
322
330
|
for (const recurso of extrairRecursosPersistenciaCodigoVivo(arquivo, codigo)) {
|
|
323
331
|
registrarRecursoDrift(recursos, recurso.origem, recurso.tipo, recurso.nome, recurso.arquivo, recurso.simbolo);
|
|
@@ -350,14 +358,15 @@ export async function indexarPhp(diretorios) {
|
|
|
350
358
|
recursos: [...recursos.values()],
|
|
351
359
|
};
|
|
352
360
|
}
|
|
353
|
-
export async function indexarLua(diretorios) {
|
|
361
|
+
export async function indexarLua(diretorios, catalogo) {
|
|
362
|
+
catalogo?.emitir("extractor.run");
|
|
354
363
|
const simbolos = new Map();
|
|
355
364
|
const recursos = new Map();
|
|
356
365
|
for (const diretorio of diretorios) {
|
|
357
|
-
const arquivos = (await listarArquivosRecursivos(diretorio, [".lua"]))
|
|
366
|
+
const arquivos = (await listarArquivosRecursivos(diretorio, [".lua"], catalogo))
|
|
358
367
|
.filter((arquivo) => !/(^|[\\/])(vendor|build|dist|generated|tests?)([\\/]|$)/i.test(arquivo));
|
|
359
368
|
for (const arquivo of arquivos) {
|
|
360
|
-
const codigo = await readFile(arquivo, "utf8");
|
|
369
|
+
const codigo = catalogo ? await catalogo.lerTexto(arquivo) : await readFile(arquivo, "utf8");
|
|
361
370
|
const basesSimbolicas = caminhosSimbolicos(diretorio, arquivo);
|
|
362
371
|
for (const recurso of extrairRecursosPersistenciaCodigoVivo(arquivo, codigo)) {
|
|
363
372
|
registrarRecursoDrift(recursos, recurso.origem, recurso.tipo, recurso.nome, recurso.arquivo, recurso.simbolo);
|
|
@@ -372,7 +381,8 @@ export async function indexarLua(diretorios) {
|
|
|
372
381
|
recursos: [...recursos.values()],
|
|
373
382
|
};
|
|
374
383
|
}
|
|
375
|
-
export async function indexarPersistenciaDeclarativa(diretorios) {
|
|
384
|
+
export async function indexarPersistenciaDeclarativa(diretorios, catalogo) {
|
|
385
|
+
catalogo?.emitir("extractor.run");
|
|
376
386
|
const recursos = new Map();
|
|
377
387
|
const simbolos = new Map();
|
|
378
388
|
for (const diretorio of diretorios) {
|
|
@@ -380,9 +390,9 @@ export async function indexarPersistenciaDeclarativa(diretorios) {
|
|
|
380
390
|
".sql", ".psql", ".ddl", ".prisma",
|
|
381
391
|
".ts", ".tsx", ".js", ".jsx", ".mjs", ".cjs",
|
|
382
392
|
".py", ".dart", ".lua", ".cs", ".java", ".go", ".rs", ".cpp", ".cc", ".cxx", ".hpp", ".h", ".php",
|
|
383
|
-
]);
|
|
393
|
+
], catalogo);
|
|
384
394
|
for (const arquivo of arquivos) {
|
|
385
|
-
const codigo = await readFile(arquivo, "utf8");
|
|
395
|
+
const codigo = catalogo ? await catalogo.lerTexto(arquivo) : await readFile(arquivo, "utf8");
|
|
386
396
|
const extracoes = arquivo.endsWith(".prisma")
|
|
387
397
|
? extrairRecursosPrisma(arquivo, codigo)
|
|
388
398
|
: extrairRecursosPersistenciaCodigoVivo(arquivo, codigo);
|
package/dist/drift.part08.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { IrBancoDados, IrModulo, IrTask } from "@sema/nucleo";
|
|
2
2
|
import { OrigemRecursoDrift, RecursoEsperadoDrift, RecursoResolvido, RegistroColunaPersistenciaDrift, RegistroPersistenciaRealDrift, RegistroRepositorioPersistenciaDrift, SimboloResolvido, TipoRecursoDrift } from "./drift.part01.js";
|
|
3
|
+
import type { CatalogoDrift } from "./driftCatalogo.js";
|
|
3
4
|
export declare function registrarRepositorioPersistenciaDrift(repositorios: Map<string, RegistroRepositorioPersistenciaDrift>, origem: OrigemRecursoDrift, recurso: string, arquivo: string): void;
|
|
4
5
|
export declare function extrairColunasSqlDetalhadas(arquivo: string, codigo: string): RegistroColunaPersistenciaDrift[];
|
|
5
6
|
export declare function extrairColunasPrismaDetalhadas(arquivo: string, codigo: string): RegistroColunaPersistenciaDrift[];
|
|
@@ -7,7 +8,7 @@ export declare function extrairCamposMongoDetalhados(arquivo: string, codigo: st
|
|
|
7
8
|
export declare function extrairCamposRedisDetalhados(arquivo: string, codigo: string): RegistroColunaPersistenciaDrift[];
|
|
8
9
|
export declare function extrairCamposArquivoLocalDetalhados(arquivo: string, codigo: string): RegistroColunaPersistenciaDrift[];
|
|
9
10
|
export declare function registrarRepositoriosPorRecursos(repositorios: Map<string, RegistroRepositorioPersistenciaDrift>, arquivo: string, codigo: string, recursos: RecursoResolvido[]): void;
|
|
10
|
-
export declare function indexarPersistenciaDetalhada(diretorios: string[]): Promise<{
|
|
11
|
+
export declare function indexarPersistenciaDetalhada(diretorios: string[], catalogo?: CatalogoDrift): Promise<{
|
|
11
12
|
colunas: RegistroColunaPersistenciaDrift[];
|
|
12
13
|
repositorios: RegistroRepositorioPersistenciaDrift[];
|
|
13
14
|
}>;
|
package/dist/drift.part08.js
CHANGED
|
@@ -172,7 +172,8 @@ export function registrarRepositoriosPorRecursos(repositorios, arquivo, codigo,
|
|
|
172
172
|
registrarRepositorioPersistenciaDrift(repositorios, recurso.origem, recurso.nome, arquivo);
|
|
173
173
|
}
|
|
174
174
|
}
|
|
175
|
-
export async function indexarPersistenciaDetalhada(diretorios) {
|
|
175
|
+
export async function indexarPersistenciaDetalhada(diretorios, catalogo) {
|
|
176
|
+
catalogo?.emitir("extractor.run");
|
|
176
177
|
const colunas = new Map();
|
|
177
178
|
const repositorios = new Map();
|
|
178
179
|
for (const diretorio of diretorios) {
|
|
@@ -180,9 +181,9 @@ export async function indexarPersistenciaDetalhada(diretorios) {
|
|
|
180
181
|
".ts", ".tsx", ".js", ".jsx", ".mjs", ".cjs",
|
|
181
182
|
".py", ".dart", ".lua", ".cs", ".java", ".go", ".rs", ".cpp", ".cc", ".cxx", ".hpp", ".h", ".php",
|
|
182
183
|
".sql", ".psql", ".ddl", ".prisma",
|
|
183
|
-
]);
|
|
184
|
+
], catalogo);
|
|
184
185
|
for (const arquivo of arquivos) {
|
|
185
|
-
const codigo = await readFile(arquivo, "utf8");
|
|
186
|
+
const codigo = catalogo ? await catalogo.lerTexto(arquivo) : await readFile(arquivo, "utf8");
|
|
186
187
|
const recursos = arquivo.endsWith(".prisma")
|
|
187
188
|
? extrairRecursosPrisma(arquivo, codigo)
|
|
188
189
|
: extrairRecursosPersistenciaCodigoVivo(arquivo, codigo);
|