@mimir-labs/core 0.4.0 → 0.6.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 +13 -2
- package/dist/implementation/contracts/descriptor.d.ts +7 -1
- package/dist/implementation/contracts/resource.d.ts +93 -0
- package/dist/implementation/descriptors/descriptor-repository.js +33 -14
- package/dist/implementation/descriptors/descriptor-repository.js.map +1 -1
- package/dist/implementation/generation/generate-service.d.ts +4 -0
- package/dist/implementation/generation/generate-service.js +14 -4
- package/dist/implementation/generation/generate-service.js.map +1 -1
- package/dist/implementation/generation/types.d.ts +1 -0
- package/dist/implementation/io/fs.d.ts +1 -0
- package/dist/implementation/io/fs.js +13 -0
- package/dist/implementation/io/fs.js.map +1 -1
- package/dist/implementation/knowledge/knowledge-engine.d.ts +8 -0
- package/dist/implementation/knowledge/knowledge-engine.js +40 -0
- package/dist/implementation/knowledge/knowledge-engine.js.map +1 -0
- package/dist/implementation/knowledge/knowledge-graph.d.ts +12 -0
- package/dist/implementation/knowledge/knowledge-graph.js +34 -0
- package/dist/implementation/knowledge/knowledge-graph.js.map +1 -0
- package/dist/implementation/knowledge/model.d.ts +44 -0
- package/dist/implementation/knowledge/model.js +3 -0
- package/dist/implementation/knowledge/model.js.map +1 -0
- package/dist/implementation/knowledge/persistence-policy.d.ts +21 -0
- package/dist/implementation/knowledge/persistence-policy.js +51 -0
- package/dist/implementation/knowledge/persistence-policy.js.map +1 -0
- package/dist/implementation/knowledge/providers.d.ts +36 -0
- package/dist/implementation/knowledge/providers.js +150 -0
- package/dist/implementation/knowledge/providers.js.map +1 -0
- package/dist/implementation/resource-discovery/design-token-extractor.d.ts +3 -0
- package/dist/implementation/resource-discovery/design-token-extractor.js +78 -0
- package/dist/implementation/resource-discovery/design-token-extractor.js.map +1 -0
- package/dist/implementation/resource-discovery/react-pattern-extractor.d.ts +3 -0
- package/dist/implementation/resource-discovery/react-pattern-extractor.js +49 -0
- package/dist/implementation/resource-discovery/react-pattern-extractor.js.map +1 -0
- package/dist/implementation/resource-discovery/relationship-extractor.d.ts +3 -0
- package/dist/implementation/resource-discovery/relationship-extractor.js +80 -0
- package/dist/implementation/resource-discovery/relationship-extractor.js.map +1 -0
- package/dist/implementation/resource-discovery/semantic-resource-classifier.d.ts +23 -0
- package/dist/implementation/resource-discovery/semantic-resource-classifier.js +267 -0
- package/dist/implementation/resource-discovery/semantic-resource-classifier.js.map +1 -0
- package/dist/implementation/resource-discovery/storybook-extractor.d.ts +2 -1
- package/dist/implementation/resource-discovery/storybook-extractor.js +83 -44
- package/dist/implementation/resource-discovery/storybook-extractor.js.map +1 -1
- package/dist/implementation/resource-discovery/typescript-analysis.d.ts +7 -0
- package/dist/implementation/resource-discovery/typescript-analysis.js +42 -0
- package/dist/implementation/resource-discovery/typescript-analysis.js.map +1 -0
- package/dist/implementation/resource-discovery/typescript-extractor.d.ts +8 -2
- package/dist/implementation/resource-discovery/typescript-extractor.js +166 -108
- package/dist/implementation/resource-discovery/typescript-extractor.js.map +1 -1
- package/dist/implementation/resource-discovery/typescript-public-api-extractor.d.ts +11 -0
- package/dist/implementation/resource-discovery/typescript-public-api-extractor.js +439 -0
- package/dist/implementation/resource-discovery/typescript-public-api-extractor.js.map +1 -0
- package/dist/implementation/resource-identity.d.ts +1 -0
- package/dist/implementation/resource-identity.js +7 -0
- package/dist/implementation/resource-identity.js.map +1 -1
- package/dist/implementation/services/authoring-service.js +251 -140
- package/dist/implementation/services/authoring-service.js.map +1 -1
- package/package.json +1 -1
|
@@ -3,135 +3,193 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.discoverTypeScriptResources = discoverTypeScriptResources;
|
|
6
7
|
exports.extractTypeScriptComponents = extractTypeScriptComponents;
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
function isPascalCase(name) {
|
|
12
|
-
return /^[A-Z][A-Za-z0-9]*$/.test(name);
|
|
13
|
-
}
|
|
8
|
+
const path_1 = __importDefault(require("path"));
|
|
9
|
+
const typescript_1 = __importDefault(require("typescript"));
|
|
10
|
+
const semantic_resource_classifier_1 = require("./semantic-resource-classifier");
|
|
11
|
+
const typescript_analysis_1 = require("./typescript-analysis");
|
|
14
12
|
function normalizeSlashes(value) {
|
|
15
|
-
return value.split(
|
|
13
|
+
return value.split(path_1.default.sep).join("/");
|
|
16
14
|
}
|
|
17
|
-
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
for (const entry of entries) {
|
|
21
|
-
const absolutePath = node_path_1.default.join(dir, entry.name);
|
|
22
|
-
if (entry.isDirectory()) {
|
|
23
|
-
if (entry.name === "node_modules" || entry.name === "dist" || entry.name.startsWith(".")) {
|
|
24
|
-
continue;
|
|
25
|
-
}
|
|
26
|
-
files.push(...(await collectFiles(absolutePath)));
|
|
15
|
+
function sourceFileHasModuleImport(sourceFile, predicate) {
|
|
16
|
+
for (const statement of sourceFile.statements) {
|
|
17
|
+
if (!typescript_1.default.isImportDeclaration(statement) || !typescript_1.default.isStringLiteral(statement.moduleSpecifier)) {
|
|
27
18
|
continue;
|
|
28
19
|
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
files.push(absolutePath);
|
|
20
|
+
const modulePath = statement.moduleSpecifier.text;
|
|
21
|
+
if (predicate(modulePath)) {
|
|
22
|
+
return true;
|
|
33
23
|
}
|
|
34
24
|
}
|
|
35
|
-
return
|
|
25
|
+
return false;
|
|
36
26
|
}
|
|
37
|
-
function
|
|
38
|
-
|
|
39
|
-
const
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
/export\s+class\s+([A-Z][A-Za-z0-9_]*)\s+/g,
|
|
43
|
-
/export\s+\{\s*([^}]+)\s*\}/g
|
|
44
|
-
];
|
|
45
|
-
for (const pattern of patterns) {
|
|
46
|
-
let match;
|
|
47
|
-
while ((match = pattern.exec(content)) !== null) {
|
|
48
|
-
if (pattern.source.includes("[^}]+")) {
|
|
49
|
-
const tokens = match[1].split(",").map((item) => item.trim());
|
|
50
|
-
for (const token of tokens) {
|
|
51
|
-
const aliasParts = token.split(/\s+as\s+/i).map((part) => part.trim());
|
|
52
|
-
const candidate = aliasParts[aliasParts.length - 1];
|
|
53
|
-
if (isPascalCase(candidate)) {
|
|
54
|
-
names.add(candidate);
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
else {
|
|
59
|
-
const candidate = match[1];
|
|
60
|
-
if (isPascalCase(candidate)) {
|
|
61
|
-
names.add(candidate);
|
|
62
|
-
}
|
|
63
|
-
}
|
|
27
|
+
function declarationContainsSignal(declaration, predicate) {
|
|
28
|
+
let found = false;
|
|
29
|
+
const visit = (node) => {
|
|
30
|
+
if (found) {
|
|
31
|
+
return;
|
|
64
32
|
}
|
|
65
|
-
|
|
66
|
-
|
|
33
|
+
if (predicate(node)) {
|
|
34
|
+
found = true;
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
typescript_1.default.forEachChild(node, visit);
|
|
38
|
+
};
|
|
39
|
+
visit(declaration);
|
|
40
|
+
return found;
|
|
67
41
|
}
|
|
68
|
-
function
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
42
|
+
function hasJsxInDeclaration(declaration) {
|
|
43
|
+
return declarationContainsSignal(declaration, (node) => typescript_1.default.isJsxElement(node) || typescript_1.default.isJsxSelfClosingElement(node) || typescript_1.default.isJsxFragment(node));
|
|
44
|
+
}
|
|
45
|
+
function hasCreateContextCall(declaration) {
|
|
46
|
+
return declarationContainsSignal(declaration, (node) => {
|
|
47
|
+
if (!typescript_1.default.isCallExpression(node)) {
|
|
48
|
+
return false;
|
|
49
|
+
}
|
|
50
|
+
if (typescript_1.default.isIdentifier(node.expression)) {
|
|
51
|
+
return node.expression.text === "createContext";
|
|
52
|
+
}
|
|
53
|
+
return typescript_1.default.isPropertyAccessExpression(node.expression) && node.expression.name.text === "createContext";
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
function hasStyledCall(declaration) {
|
|
57
|
+
return declarationContainsSignal(declaration, (node) => {
|
|
58
|
+
if (!typescript_1.default.isCallExpression(node)) {
|
|
59
|
+
return false;
|
|
76
60
|
}
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
61
|
+
if (typescript_1.default.isIdentifier(node.expression) && node.expression.text === "styled") {
|
|
62
|
+
return true;
|
|
63
|
+
}
|
|
64
|
+
return typescript_1.default.isPropertyAccessExpression(node.expression) && typescript_1.default.isIdentifier(node.expression.expression)
|
|
65
|
+
? node.expression.expression.text === "styled"
|
|
66
|
+
: false;
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
function getExportSymbol(checker, sourceFile, exportSymbol) {
|
|
70
|
+
const importName = exportSymbol.getName();
|
|
71
|
+
if ((exportSymbol.flags & typescript_1.default.SymbolFlags.Alias) !== 0) {
|
|
72
|
+
const aliased = checker.getAliasedSymbol(exportSymbol);
|
|
73
|
+
return {
|
|
74
|
+
symbol: aliased,
|
|
75
|
+
importName
|
|
84
76
|
};
|
|
85
77
|
}
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
const interfacePattern = new RegExp(`interface\\s+${componentName}Props\\s*\\{([\\s\\S]*?)\\}`, "m");
|
|
90
|
-
const typePattern = new RegExp(`type\\s+${componentName}Props\\s*=\\s*\\{([\\s\\S]*?)\\}`, "m");
|
|
91
|
-
const interfaceMatch = interfacePattern.exec(content);
|
|
92
|
-
if (interfaceMatch) {
|
|
93
|
-
return parsePropsBlock(interfaceMatch[1]);
|
|
78
|
+
const moduleSymbol = checker.getSymbolAtLocation(sourceFile);
|
|
79
|
+
if (!moduleSymbol) {
|
|
80
|
+
return null;
|
|
94
81
|
}
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
82
|
+
return {
|
|
83
|
+
symbol: exportSymbol,
|
|
84
|
+
importName
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
function keyForDiscoveredResource(resource) {
|
|
88
|
+
return `${resource.filePath}::${resource.name}`;
|
|
89
|
+
}
|
|
90
|
+
function shouldIgnoreSourceFile(sourceFile, cwd) {
|
|
91
|
+
if (sourceFile.isDeclarationFile) {
|
|
92
|
+
return true;
|
|
98
93
|
}
|
|
99
|
-
|
|
94
|
+
const relative = normalizeSlashes(path_1.default.relative(cwd, sourceFile.fileName));
|
|
95
|
+
return relative.startsWith("../") || relative === "..";
|
|
100
96
|
}
|
|
101
|
-
async function
|
|
102
|
-
const
|
|
103
|
-
const
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
97
|
+
async function discoverTypeScriptResources(cwd, packageName, options = {}, analysis) {
|
|
98
|
+
const resolvedAnalysis = analysis ?? (await (0, typescript_analysis_1.createTypeScriptAnalysis)(cwd));
|
|
99
|
+
const { program, checker } = resolvedAnalysis;
|
|
100
|
+
const policy = (0, semantic_resource_classifier_1.mergeClassificationPolicy)({
|
|
101
|
+
include: options.includeKinds,
|
|
102
|
+
exclude: options.excludeKinds
|
|
103
|
+
});
|
|
104
|
+
const sourceSignalsCache = new Map();
|
|
105
|
+
const resolveSourceSignals = (sourceFile) => {
|
|
106
|
+
const key = sourceFile.fileName;
|
|
107
|
+
const cached = sourceSignalsCache.get(key);
|
|
108
|
+
if (cached) {
|
|
109
|
+
return cached;
|
|
109
110
|
}
|
|
110
|
-
const
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
111
|
+
const resolved = {
|
|
112
|
+
hasReactImport: sourceFileHasModuleImport(sourceFile, (modulePath) => modulePath === "react" || modulePath.startsWith("react/")),
|
|
113
|
+
hasStorybookImport: sourceFileHasModuleImport(sourceFile, (modulePath) => modulePath.includes("storybook") || modulePath.includes("@stories")),
|
|
114
|
+
hasStyledImport: sourceFileHasModuleImport(sourceFile, (modulePath) => modulePath === "styled-components" ||
|
|
115
|
+
modulePath === "@emotion/styled" ||
|
|
116
|
+
modulePath.includes("styled"))
|
|
117
|
+
};
|
|
118
|
+
sourceSignalsCache.set(key, resolved);
|
|
119
|
+
return resolved;
|
|
120
|
+
};
|
|
121
|
+
const resources = new Map();
|
|
122
|
+
for (const sourceFile of program.getSourceFiles()) {
|
|
123
|
+
if (shouldIgnoreSourceFile(sourceFile, cwd)) {
|
|
124
|
+
continue;
|
|
119
125
|
}
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
const key = component.name;
|
|
124
|
-
const previous = unique.get(key);
|
|
125
|
-
if (!previous) {
|
|
126
|
-
unique.set(key, component);
|
|
126
|
+
const relativePath = normalizeSlashes(path_1.default.relative(cwd, sourceFile.fileName));
|
|
127
|
+
const moduleSymbol = checker.getSymbolAtLocation(sourceFile);
|
|
128
|
+
if (!moduleSymbol) {
|
|
127
129
|
continue;
|
|
128
130
|
}
|
|
129
|
-
const
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
131
|
+
for (const exported of checker.getExportsOfModule(moduleSymbol)) {
|
|
132
|
+
const resolved = getExportSymbol(checker, sourceFile, exported);
|
|
133
|
+
if (!resolved) {
|
|
134
|
+
continue;
|
|
135
|
+
}
|
|
136
|
+
const declaration = resolved.symbol.valueDeclaration ?? resolved.symbol.declarations?.[0];
|
|
137
|
+
if (!declaration) {
|
|
138
|
+
continue;
|
|
139
|
+
}
|
|
140
|
+
const declarationFile = declaration.getSourceFile();
|
|
141
|
+
if (shouldIgnoreSourceFile(declarationFile, cwd)) {
|
|
142
|
+
continue;
|
|
143
|
+
}
|
|
144
|
+
const declarationSourceSignals = resolveSourceSignals(declarationFile);
|
|
145
|
+
const declarationFilePath = normalizeSlashes(path_1.default.relative(cwd, declarationFile.fileName));
|
|
146
|
+
const name = resolved.symbol.getName();
|
|
147
|
+
const signals = {
|
|
148
|
+
name,
|
|
149
|
+
filePath: declarationFilePath,
|
|
150
|
+
isPublicExport: true,
|
|
151
|
+
hasReactImport: declarationSourceSignals.hasReactImport,
|
|
152
|
+
hasJsx: hasJsxInDeclaration(declaration),
|
|
153
|
+
hasCreateContextCall: hasCreateContextCall(declaration),
|
|
154
|
+
hasStyledImport: declarationSourceSignals.hasStyledImport,
|
|
155
|
+
hasStyledCall: hasStyledCall(declaration),
|
|
156
|
+
hasStorybookImport: declarationSourceSignals.hasStorybookImport,
|
|
157
|
+
extension: path_1.default.extname(declarationFilePath)
|
|
158
|
+
};
|
|
159
|
+
const classification = (0, semantic_resource_classifier_1.classifyResource)(signals, policy);
|
|
160
|
+
const candidate = {
|
|
161
|
+
name,
|
|
162
|
+
filePath: declarationFilePath,
|
|
163
|
+
importName: resolved.importName,
|
|
164
|
+
packageName,
|
|
165
|
+
classification
|
|
166
|
+
};
|
|
167
|
+
const key = keyForDiscoveredResource(candidate);
|
|
168
|
+
const previous = resources.get(key);
|
|
169
|
+
if (!previous || candidate.classification.confidence > previous.classification.confidence) {
|
|
170
|
+
resources.set(key, candidate);
|
|
171
|
+
}
|
|
133
172
|
}
|
|
134
173
|
}
|
|
135
|
-
return [...
|
|
174
|
+
return [...resources.values()].sort((a, b) => {
|
|
175
|
+
const byFile = a.filePath.localeCompare(b.filePath);
|
|
176
|
+
if (byFile !== 0) {
|
|
177
|
+
return byFile;
|
|
178
|
+
}
|
|
179
|
+
return a.name.localeCompare(b.name);
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
async function extractTypeScriptComponents(cwd, packageName, options = {}) {
|
|
183
|
+
const resources = await discoverTypeScriptResources(cwd, packageName, options);
|
|
184
|
+
return resources
|
|
185
|
+
.filter((resource) => resource.classification.generateDescriptor)
|
|
186
|
+
.map((resource) => ({
|
|
187
|
+
name: resource.name,
|
|
188
|
+
filePath: resource.filePath,
|
|
189
|
+
importName: resource.importName,
|
|
190
|
+
packageName: resource.packageName,
|
|
191
|
+
props: {}
|
|
192
|
+
}))
|
|
193
|
+
.sort((a, b) => a.name.localeCompare(b.name));
|
|
136
194
|
}
|
|
137
195
|
//# sourceMappingURL=typescript-extractor.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typescript-extractor.js","sourceRoot":"","sources":["../../../src/implementation/resource-discovery/typescript-extractor.ts"],"names":[],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"typescript-extractor.js","sourceRoot":"","sources":["../../../src/implementation/resource-discovery/typescript-extractor.ts"],"names":[],"mappings":";;;;;AAuIA,kEA0HC;AAED,kEAiBC;AApRD,gDAAwB;AACxB,4DAA4B;AAC5B,iFAIwC;AAMxC,+DAA0F;AAO1F,SAAS,gBAAgB,CAAC,KAAa;IACrC,OAAO,KAAK,CAAC,KAAK,CAAC,cAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACzC,CAAC;AAED,SAAS,yBAAyB,CAAC,UAAyB,EAAE,SAA0C;IACtG,KAAK,MAAM,SAAS,IAAI,UAAU,CAAC,UAAU,EAAE,CAAC;QAC9C,IAAI,CAAC,oBAAE,CAAC,mBAAmB,CAAC,SAAS,CAAC,IAAI,CAAC,oBAAE,CAAC,eAAe,CAAC,SAAS,CAAC,eAAe,CAAC,EAAE,CAAC;YACzF,SAAS;QACX,CAAC;QAED,MAAM,UAAU,GAAG,SAAS,CAAC,eAAe,CAAC,IAAI,CAAC;QAClD,IAAI,SAAS,CAAC,UAAU,CAAC,EAAE,CAAC;YAC1B,OAAO,IAAI,CAAC;QACd,CAAC;IACH,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC;AAED,SAAS,yBAAyB,CAAC,WAA2B,EAAE,SAAqC;IACnG,IAAI,KAAK,GAAG,KAAK,CAAC;IAElB,MAAM,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type TypeScriptAnalysis } from "./typescript-analysis";
|
|
3
|
+
type ExtractedPublicApiFact = {
|
|
4
|
+
name: string;
|
|
5
|
+
filePath: string;
|
|
6
|
+
api: PublicComponentApi;
|
|
7
|
+
props: Record<string, ExtractedProp>;
|
|
8
|
+
};
|
|
9
|
+
export declare function extractTypeScriptPublicApi(cwd: string, components: ExtractedComponentFact[], analysis?: TypeScriptAnalysis): Promise<Map<string, ExtractedPublicApiFact>>;
|
|
10
|
+
export declare function getComponentPublicApiKey(component: Pick<ExtractedComponentFact, "filePath" | "name">): string;
|
|
11
|
+
export {};
|