@nikelyh/metamorph 2.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/bin/metamorph.js +18 -0
- package/dist/TechDetector-YCDEZ6OR.js +7 -0
- package/dist/chunk-3QN2Q75J.js +101 -0
- package/dist/chunk-DJO6FY4K.js +33 -0
- package/dist/chunk-IIEUXZPM.js +4792 -0
- package/dist/chunk-RCULELX2.js +241770 -0
- package/dist/chunk-VS2QQHAK.js +46 -0
- package/dist/chunk-XHQSMB6V.js +73585 -0
- package/dist/dist-63RNBEIQ.js +63 -0
- package/dist/dist-VCTPPAJN.js +1129 -0
- package/dist/index.js +2700 -0
- package/dist/multipart-parser-ALMYCQSC.js +371 -0
- package/dist/public/assets/index-Bq6f5VIA.css +1 -0
- package/dist/public/assets/index-CO0gJijU.js +66 -0
- package/dist/public/favicon.svg +1 -0
- package/dist/public/icons/angular.svg +1 -0
- package/dist/public/icons/expressjs.svg +1 -0
- package/dist/public/icons/fastify.svg +1 -0
- package/dist/public/icons/hapi.svg +14 -0
- package/dist/public/icons/koa.svg +1 -0
- package/dist/public/icons/nestjs.svg +1 -0
- package/dist/public/icons/nextjs.svg +1 -0
- package/dist/public/icons/react.svg +1 -0
- package/dist/public/icons/svelte.svg +21 -0
- package/dist/public/icons/vue.svg +1 -0
- package/dist/public/icons.svg +24 -0
- package/dist/public/index.html +14 -0
- package/dist/runtime-WTVS3IND.js +24 -0
- package/dist/src-ZMFD37HA.js +1408 -0
- package/dist/ts-morph-LFNGDRSW.js +5 -0
- package/package.json +40 -0
package/bin/metamorph.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// For development, we use tsx to run the typescript file directly.
|
|
4
|
+
import { spawnSync } from 'child_process';
|
|
5
|
+
import { resolve, dirname } from 'path';
|
|
6
|
+
import { fileURLToPath } from 'url';
|
|
7
|
+
|
|
8
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
9
|
+
const __dirname = dirname(__filename);
|
|
10
|
+
|
|
11
|
+
const indexPath = resolve(__dirname, '../src/index.ts');
|
|
12
|
+
|
|
13
|
+
const result = spawnSync('npx', ['tsx', indexPath, ...process.argv.slice(2)], {
|
|
14
|
+
stdio: 'inherit',
|
|
15
|
+
shell: true
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
process.exit(result.status || 0);
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
// ../infrastructure/src/detector/TechDetector.ts
|
|
2
|
+
import { readFileSync, existsSync } from "fs";
|
|
3
|
+
import { join } from "path";
|
|
4
|
+
var DETECTION_RULES = [
|
|
5
|
+
{
|
|
6
|
+
framework: "express",
|
|
7
|
+
packageKeys: ["express"],
|
|
8
|
+
configFiles: []
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
framework: "fastify",
|
|
12
|
+
packageKeys: ["fastify"],
|
|
13
|
+
configFiles: []
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
framework: "nestjs",
|
|
17
|
+
packageKeys: ["@nestjs/core", "@nestjs/common"],
|
|
18
|
+
configFiles: ["nest-cli.json"]
|
|
19
|
+
},
|
|
20
|
+
/*
|
|
21
|
+
{
|
|
22
|
+
framework: 'koa',
|
|
23
|
+
packageKeys: ['koa'],
|
|
24
|
+
configFiles: [],
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
framework: 'hapi',
|
|
28
|
+
packageKeys: ['@hapi/hapi', 'hapi'],
|
|
29
|
+
configFiles: [],
|
|
30
|
+
},
|
|
31
|
+
*/
|
|
32
|
+
{
|
|
33
|
+
framework: "next",
|
|
34
|
+
packageKeys: ["next"],
|
|
35
|
+
configFiles: ["next.config.js", "next.config.ts", "next.config.mjs"]
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
framework: "react",
|
|
39
|
+
packageKeys: ["react"],
|
|
40
|
+
configFiles: []
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
framework: "vue",
|
|
44
|
+
packageKeys: ["vue"],
|
|
45
|
+
configFiles: ["vue.config.js"]
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
framework: "angular",
|
|
49
|
+
packageKeys: ["@angular/core"],
|
|
50
|
+
configFiles: ["angular.json"]
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
framework: "svelte",
|
|
54
|
+
packageKeys: ["svelte"],
|
|
55
|
+
configFiles: ["svelte.config.js", "svelte.config.ts"]
|
|
56
|
+
}
|
|
57
|
+
];
|
|
58
|
+
function detectTechnologies(projectPath) {
|
|
59
|
+
const detected = [];
|
|
60
|
+
const pkgPath = join(projectPath, "package.json");
|
|
61
|
+
let allDeps = {};
|
|
62
|
+
if (existsSync(pkgPath)) {
|
|
63
|
+
try {
|
|
64
|
+
const pkg = JSON.parse(readFileSync(pkgPath, "utf-8"));
|
|
65
|
+
allDeps = {
|
|
66
|
+
...pkg.dependencies || {},
|
|
67
|
+
...pkg.devDependencies || {}
|
|
68
|
+
};
|
|
69
|
+
} catch {
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
for (const rule of DETECTION_RULES) {
|
|
73
|
+
let confidence = 0;
|
|
74
|
+
const evidence = [];
|
|
75
|
+
for (const key of rule.packageKeys) {
|
|
76
|
+
if (allDeps[key]) {
|
|
77
|
+
confidence += 60;
|
|
78
|
+
evidence.push(`package.json: "${key}": "${allDeps[key]}"`);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
for (const configFile of rule.configFiles) {
|
|
82
|
+
if (existsSync(join(projectPath, configFile))) {
|
|
83
|
+
confidence += 30;
|
|
84
|
+
evidence.push(`config file: ${configFile}`);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
if (confidence > 0) {
|
|
88
|
+
detected.push({
|
|
89
|
+
framework: rule.framework,
|
|
90
|
+
confidence: Math.min(confidence, 100),
|
|
91
|
+
evidence
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
detected.sort((a, b) => b.confidence - a.confidence);
|
|
96
|
+
return detected;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
export {
|
|
100
|
+
detectTechnologies
|
|
101
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import {
|
|
2
|
+
RuntimeState,
|
|
3
|
+
defineRuntime
|
|
4
|
+
} from "./chunk-XHQSMB6V.js";
|
|
5
|
+
|
|
6
|
+
// ../application/src/runtime.ts
|
|
7
|
+
var MetamorphState = class extends RuntimeState {
|
|
8
|
+
constructor(repository) {
|
|
9
|
+
super();
|
|
10
|
+
this.repository = repository;
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
var runtimeMethods = defineRuntime();
|
|
14
|
+
var initializeRuntime = runtimeMethods.initializeRuntime;
|
|
15
|
+
var resolveRuntime = runtimeMethods.resolveRuntime;
|
|
16
|
+
var resolveParticipant = runtimeMethods.resolveParticipant;
|
|
17
|
+
var join = runtimeMethods.join;
|
|
18
|
+
var leave = runtimeMethods.leave;
|
|
19
|
+
var sendMessage = runtimeMethods.sendMessage;
|
|
20
|
+
var sendEvent = runtimeMethods.sendEvent;
|
|
21
|
+
var runLoop = runtimeMethods.runLoop;
|
|
22
|
+
|
|
23
|
+
export {
|
|
24
|
+
MetamorphState,
|
|
25
|
+
initializeRuntime,
|
|
26
|
+
resolveRuntime,
|
|
27
|
+
resolveParticipant,
|
|
28
|
+
join,
|
|
29
|
+
leave,
|
|
30
|
+
sendMessage,
|
|
31
|
+
sendEvent,
|
|
32
|
+
runLoop
|
|
33
|
+
};
|