@wtdlee/repomap 0.3.0 → 0.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/dist/analyzers/index.d.ts +69 -5
- package/dist/analyzers/index.js +1 -5
- package/dist/chunk-3PWXDB7B.js +153 -0
- package/dist/{generators/page-map-generator.js → chunk-3YFXZAP7.js} +322 -358
- package/dist/chunk-6F4PWJZI.js +1 -0
- package/dist/{generators/rails-map-generator.js → chunk-E4WRODSI.js} +86 -94
- package/dist/chunk-GNBMJMET.js +2519 -0
- package/dist/{server/doc-server.js → chunk-M6YNU536.js} +702 -303
- package/dist/chunk-OWM6WNLE.js +2610 -0
- package/dist/chunk-SSU6QFTX.js +1058 -0
- package/dist/cli.d.ts +0 -1
- package/dist/cli.js +348 -452
- package/dist/dataflow-analyzer-BfAiqVUp.d.ts +180 -0
- package/dist/env-detector-EEMVUEIA.js +1 -0
- package/dist/generators/index.d.ts +431 -3
- package/dist/generators/index.js +2 -3
- package/dist/index.d.ts +53 -10
- package/dist/index.js +8 -11
- package/dist/page-map-generator-6MJGPBVA.js +1 -0
- package/dist/rails-UWSDRS33.js +1 -0
- package/dist/rails-map-generator-D2URLMVJ.js +2 -0
- package/dist/server/index.d.ts +33 -1
- package/dist/server/index.js +7 -1
- package/dist/types.d.ts +39 -37
- package/dist/types.js +1 -5
- package/package.json +4 -2
- package/dist/analyzers/base-analyzer.d.ts +0 -45
- package/dist/analyzers/base-analyzer.js +0 -47
- package/dist/analyzers/dataflow-analyzer.d.ts +0 -29
- package/dist/analyzers/dataflow-analyzer.js +0 -425
- package/dist/analyzers/graphql-analyzer.d.ts +0 -22
- package/dist/analyzers/graphql-analyzer.js +0 -386
- package/dist/analyzers/pages-analyzer.d.ts +0 -84
- package/dist/analyzers/pages-analyzer.js +0 -1695
- package/dist/analyzers/rails/index.d.ts +0 -46
- package/dist/analyzers/rails/index.js +0 -145
- package/dist/analyzers/rails/rails-controller-analyzer.d.ts +0 -82
- package/dist/analyzers/rails/rails-controller-analyzer.js +0 -478
- package/dist/analyzers/rails/rails-grpc-analyzer.d.ts +0 -44
- package/dist/analyzers/rails/rails-grpc-analyzer.js +0 -262
- package/dist/analyzers/rails/rails-model-analyzer.d.ts +0 -88
- package/dist/analyzers/rails/rails-model-analyzer.js +0 -493
- package/dist/analyzers/rails/rails-react-analyzer.d.ts +0 -41
- package/dist/analyzers/rails/rails-react-analyzer.js +0 -529
- package/dist/analyzers/rails/rails-routes-analyzer.d.ts +0 -62
- package/dist/analyzers/rails/rails-routes-analyzer.js +0 -540
- package/dist/analyzers/rails/rails-view-analyzer.d.ts +0 -49
- package/dist/analyzers/rails/rails-view-analyzer.js +0 -386
- package/dist/analyzers/rails/ruby-parser.d.ts +0 -63
- package/dist/analyzers/rails/ruby-parser.js +0 -212
- package/dist/analyzers/rest-api-analyzer.d.ts +0 -65
- package/dist/analyzers/rest-api-analyzer.js +0 -479
- package/dist/core/cache.d.ts +0 -47
- package/dist/core/cache.js +0 -151
- package/dist/core/engine.d.ts +0 -46
- package/dist/core/engine.js +0 -319
- package/dist/core/index.d.ts +0 -2
- package/dist/core/index.js +0 -2
- package/dist/generators/markdown-generator.d.ts +0 -25
- package/dist/generators/markdown-generator.js +0 -782
- package/dist/generators/mermaid-generator.d.ts +0 -35
- package/dist/generators/mermaid-generator.js +0 -364
- package/dist/generators/page-map-generator.d.ts +0 -22
- package/dist/generators/rails-map-generator.d.ts +0 -21
- package/dist/server/doc-server.d.ts +0 -30
- package/dist/utils/env-detector.d.ts +0 -31
- package/dist/utils/env-detector.js +0 -188
- package/dist/utils/parallel.d.ts +0 -23
- package/dist/utils/parallel.js +0 -70
- package/dist/utils/port.d.ts +0 -15
- package/dist/utils/port.js +0 -41
|
@@ -1,5 +1,69 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { B as BaseAnalyzer } from '../dataflow-analyzer-BfAiqVUp.js';
|
|
2
|
+
export { D as DataFlowAnalyzer, G as GraphQLAnalyzer, P as PagesAnalyzer } from '../dataflow-analyzer-BfAiqVUp.js';
|
|
3
|
+
import { RepositoryConfig, AnalysisResult } from '../types.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Analyzer for REST API calls (fetch, axios, useSWR, etc.)
|
|
7
|
+
* REST API呼び出しの分析器
|
|
8
|
+
*/
|
|
9
|
+
declare class RestApiAnalyzer extends BaseAnalyzer {
|
|
10
|
+
private project;
|
|
11
|
+
private apiCallCounter;
|
|
12
|
+
constructor(config: RepositoryConfig);
|
|
13
|
+
getName(): string;
|
|
14
|
+
analyze(): Promise<Partial<AnalysisResult>>;
|
|
15
|
+
/**
|
|
16
|
+
* Find fetch() calls
|
|
17
|
+
*/
|
|
18
|
+
private findFetchCalls;
|
|
19
|
+
/**
|
|
20
|
+
* Find axios calls (axios.get, axios.post, etc.)
|
|
21
|
+
*/
|
|
22
|
+
private findAxiosCalls;
|
|
23
|
+
/**
|
|
24
|
+
* Find useSWR calls
|
|
25
|
+
*/
|
|
26
|
+
private findSwrCalls;
|
|
27
|
+
/**
|
|
28
|
+
* Extract API call info from fetch()
|
|
29
|
+
*/
|
|
30
|
+
private extractFetchCall;
|
|
31
|
+
/**
|
|
32
|
+
* Extract API call info from axios.method()
|
|
33
|
+
*/
|
|
34
|
+
private extractAxiosCall;
|
|
35
|
+
/**
|
|
36
|
+
* Extract API call info from axios() direct call
|
|
37
|
+
*/
|
|
38
|
+
private extractAxiosDirectCall;
|
|
39
|
+
/**
|
|
40
|
+
* Extract API call info from useSWR()
|
|
41
|
+
*/
|
|
42
|
+
private extractSwrCall;
|
|
43
|
+
/**
|
|
44
|
+
* Get the name of the containing function/component
|
|
45
|
+
*/
|
|
46
|
+
private getContainingFunctionName;
|
|
47
|
+
/**
|
|
48
|
+
* Extract URL from argument (handles literals, variables, function calls)
|
|
49
|
+
*/
|
|
50
|
+
private extractUrlFromArg;
|
|
51
|
+
/**
|
|
52
|
+
* Clean string literal (remove quotes)
|
|
53
|
+
*/
|
|
54
|
+
private cleanStringLiteral;
|
|
55
|
+
/**
|
|
56
|
+
* Check if URL looks like an API endpoint
|
|
57
|
+
*/
|
|
58
|
+
private isApiUrl;
|
|
59
|
+
/**
|
|
60
|
+
* Categorize API by URL pattern
|
|
61
|
+
*/
|
|
62
|
+
private categorizeApi;
|
|
63
|
+
/**
|
|
64
|
+
* Normalize HTTP method
|
|
65
|
+
*/
|
|
66
|
+
private normalizeMethod;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export { BaseAnalyzer, RestApiAnalyzer };
|
package/dist/analyzers/index.js
CHANGED
|
@@ -1,5 +1 @@
|
|
|
1
|
-
export
|
|
2
|
-
export * from './pages-analyzer.js';
|
|
3
|
-
export * from './graphql-analyzer.js';
|
|
4
|
-
export * from './dataflow-analyzer.js';
|
|
5
|
-
export * from './rest-api-analyzer.js';
|
|
1
|
+
export { BaseAnalyzer, DataFlowAnalyzer, GraphQLAnalyzer, PagesAnalyzer, RestApiAnalyzer } from '../chunk-GNBMJMET.js';
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import * as fs from 'fs/promises';
|
|
2
|
+
import * as path from 'path';
|
|
3
|
+
|
|
4
|
+
// src/utils/env-detector.ts
|
|
5
|
+
async function detectEnvironments(rootPath) {
|
|
6
|
+
const environments = [];
|
|
7
|
+
const railsEnv = await detectRails(rootPath);
|
|
8
|
+
if (railsEnv.detected) {
|
|
9
|
+
environments.push(railsEnv);
|
|
10
|
+
}
|
|
11
|
+
const jsEnv = await detectJsEnvironment(rootPath);
|
|
12
|
+
if (jsEnv.detected) {
|
|
13
|
+
environments.push(jsEnv);
|
|
14
|
+
}
|
|
15
|
+
const hasNextjs = environments.some((e) => e.type === "nextjs");
|
|
16
|
+
const hasReact = environments.some((e) => e.type === "react" || e.type === "nextjs");
|
|
17
|
+
const hasRails = environments.some((e) => e.type === "rails");
|
|
18
|
+
let primary = "generic";
|
|
19
|
+
if (hasNextjs) {
|
|
20
|
+
primary = "nextjs";
|
|
21
|
+
} else if (hasReact) {
|
|
22
|
+
primary = "react";
|
|
23
|
+
} else if (hasRails) {
|
|
24
|
+
primary = "rails";
|
|
25
|
+
}
|
|
26
|
+
return {
|
|
27
|
+
environments,
|
|
28
|
+
hasNextjs,
|
|
29
|
+
hasReact,
|
|
30
|
+
hasRails,
|
|
31
|
+
primary
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
async function detectRails(rootPath) {
|
|
35
|
+
const result = {
|
|
36
|
+
type: "rails",
|
|
37
|
+
detected: false,
|
|
38
|
+
path: rootPath,
|
|
39
|
+
features: []
|
|
40
|
+
};
|
|
41
|
+
try {
|
|
42
|
+
const gemfilePath = path.join(rootPath, "Gemfile");
|
|
43
|
+
const routesPath = path.join(rootPath, "config", "routes.rb");
|
|
44
|
+
await fs.access(gemfilePath);
|
|
45
|
+
await fs.access(routesPath);
|
|
46
|
+
const gemfile = await fs.readFile(gemfilePath, "utf-8");
|
|
47
|
+
const isRails = gemfile.includes("gem 'rails'") || gemfile.includes('gem "rails"');
|
|
48
|
+
if (!isRails) {
|
|
49
|
+
return result;
|
|
50
|
+
}
|
|
51
|
+
result.detected = true;
|
|
52
|
+
const versionMatch = gemfile.match(/gem ['"]rails['"],\s*['"]([^'"]+)['"]/);
|
|
53
|
+
if (versionMatch) {
|
|
54
|
+
result.version = versionMatch[1];
|
|
55
|
+
}
|
|
56
|
+
const features = [];
|
|
57
|
+
try {
|
|
58
|
+
await fs.access(path.join(rootPath, "app", "grpc_services"));
|
|
59
|
+
features.push("grpc");
|
|
60
|
+
} catch {
|
|
61
|
+
}
|
|
62
|
+
try {
|
|
63
|
+
const appConfig = await fs.readFile(path.join(rootPath, "config", "application.rb"), "utf-8");
|
|
64
|
+
if (appConfig.includes("config.api_only = true")) {
|
|
65
|
+
features.push("api-only");
|
|
66
|
+
}
|
|
67
|
+
} catch {
|
|
68
|
+
}
|
|
69
|
+
if (gemfile.includes("gem 'graphql'") || gemfile.includes('gem "graphql"')) {
|
|
70
|
+
features.push("graphql");
|
|
71
|
+
}
|
|
72
|
+
if (gemfile.includes("gem 'devise'") || gemfile.includes('gem "devise"')) {
|
|
73
|
+
features.push("devise");
|
|
74
|
+
}
|
|
75
|
+
result.features = features;
|
|
76
|
+
} catch {
|
|
77
|
+
}
|
|
78
|
+
return result;
|
|
79
|
+
}
|
|
80
|
+
async function detectJsEnvironment(rootPath) {
|
|
81
|
+
const result = {
|
|
82
|
+
type: "react",
|
|
83
|
+
detected: false,
|
|
84
|
+
path: rootPath,
|
|
85
|
+
features: []
|
|
86
|
+
};
|
|
87
|
+
try {
|
|
88
|
+
const packageJsonPath = path.join(rootPath, "package.json");
|
|
89
|
+
const packageJson = JSON.parse(await fs.readFile(packageJsonPath, "utf-8"));
|
|
90
|
+
const deps = { ...packageJson.dependencies, ...packageJson.devDependencies };
|
|
91
|
+
if (!deps["react"]) {
|
|
92
|
+
return result;
|
|
93
|
+
}
|
|
94
|
+
result.detected = true;
|
|
95
|
+
result.version = deps["react"];
|
|
96
|
+
const features = [];
|
|
97
|
+
if (deps["next"]) {
|
|
98
|
+
result.type = "nextjs";
|
|
99
|
+
result.version = deps["next"];
|
|
100
|
+
try {
|
|
101
|
+
await fs.access(path.join(rootPath, "app"));
|
|
102
|
+
features.push("app-router");
|
|
103
|
+
} catch {
|
|
104
|
+
}
|
|
105
|
+
try {
|
|
106
|
+
await fs.access(path.join(rootPath, "pages"));
|
|
107
|
+
features.push("pages-router");
|
|
108
|
+
} catch {
|
|
109
|
+
}
|
|
110
|
+
try {
|
|
111
|
+
await fs.access(path.join(rootPath, "src", "pages"));
|
|
112
|
+
features.push("pages-router");
|
|
113
|
+
} catch {
|
|
114
|
+
}
|
|
115
|
+
try {
|
|
116
|
+
await fs.access(path.join(rootPath, "src", "app"));
|
|
117
|
+
features.push("app-router");
|
|
118
|
+
} catch {
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
if (deps["@apollo/client"] || deps["graphql"] || deps["graphql-request"] || deps["urql"]) {
|
|
122
|
+
features.push("graphql");
|
|
123
|
+
}
|
|
124
|
+
if (deps["typescript"]) {
|
|
125
|
+
features.push("typescript");
|
|
126
|
+
}
|
|
127
|
+
if (deps["redux"] || deps["@reduxjs/toolkit"]) {
|
|
128
|
+
features.push("redux");
|
|
129
|
+
}
|
|
130
|
+
if (deps["zustand"]) {
|
|
131
|
+
features.push("zustand");
|
|
132
|
+
}
|
|
133
|
+
if (deps["jotai"] || deps["recoil"]) {
|
|
134
|
+
features.push("atomic-state");
|
|
135
|
+
}
|
|
136
|
+
result.features = features;
|
|
137
|
+
} catch {
|
|
138
|
+
}
|
|
139
|
+
return result;
|
|
140
|
+
}
|
|
141
|
+
function getAnalyzersForEnvironments(envResult) {
|
|
142
|
+
const frontend = [];
|
|
143
|
+
const backend = [];
|
|
144
|
+
if (envResult.hasNextjs || envResult.hasReact) {
|
|
145
|
+
frontend.push("pages", "graphql", "dataflow", "rest-api");
|
|
146
|
+
}
|
|
147
|
+
if (envResult.hasRails) {
|
|
148
|
+
backend.push("routes", "controllers", "models", "grpc");
|
|
149
|
+
}
|
|
150
|
+
return { frontend, backend };
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
export { detectEnvironments, getAnalyzersForEnvironments };
|