@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.
@@ -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,7 @@
1
+ import {
2
+ detectTechnologies
3
+ } from "./chunk-3QN2Q75J.js";
4
+ import "./chunk-VS2QQHAK.js";
5
+ export {
6
+ detectTechnologies
7
+ };
@@ -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
+ };