@foxlight/core 0.1.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 +53 -0
- package/dist/index.d.ts +669 -0
- package/dist/index.js +1484 -0
- package/package.json +39 -0
package/README.md
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# @foxlight/core
|
|
2
|
+
|
|
3
|
+
Shared data layer for [Foxlight](https://github.com/josegabrielcruz/foxlight) — the open-source front-end intelligence platform.
|
|
4
|
+
|
|
5
|
+
## What's Inside
|
|
6
|
+
|
|
7
|
+
- **Component Registry** — stores and queries component metadata, props, relationships, bundle info, and health scores
|
|
8
|
+
- **Dependency Graph** — directed graph with cycle detection, topological sort, and impact analysis
|
|
9
|
+
- **Health Scorer** — 6-metric weighted scoring system (bundle size, test coverage, accessibility, freshness, performance, reliability)
|
|
10
|
+
- **Cost Estimator** — hosting cost estimation with pre-configured models for Vercel, Netlify, AWS, and Cloudflare
|
|
11
|
+
- **Upgrade Analyzer** — dependency upgrade impact analysis (semver risk, peer deps, deprecation)
|
|
12
|
+
- **Config Loader** — loads `.foxlight.json` config with framework auto-detection
|
|
13
|
+
|
|
14
|
+
## Installation
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
npm install @foxlight/core
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Usage
|
|
21
|
+
|
|
22
|
+
```typescript
|
|
23
|
+
import {
|
|
24
|
+
ComponentRegistry,
|
|
25
|
+
DependencyGraph,
|
|
26
|
+
computeComponentHealth,
|
|
27
|
+
estimateCostImpact,
|
|
28
|
+
COST_MODELS,
|
|
29
|
+
loadConfig,
|
|
30
|
+
} from '@foxlight/core';
|
|
31
|
+
|
|
32
|
+
// Create a registry and add components
|
|
33
|
+
const registry = new ComponentRegistry();
|
|
34
|
+
registry.addComponents([{ id: 'Button', name: 'Button' /* ... */ }]);
|
|
35
|
+
|
|
36
|
+
// Build a dependency graph from imports
|
|
37
|
+
const graph = DependencyGraph.fromImports(imports);
|
|
38
|
+
const cycles = graph.detectCycles();
|
|
39
|
+
|
|
40
|
+
// Score component health
|
|
41
|
+
const health = computeComponentHealth({
|
|
42
|
+
component: myComponent,
|
|
43
|
+
bundleInfo: myBundleInfo,
|
|
44
|
+
testCoverage: 85,
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
// Estimate hosting costs
|
|
48
|
+
const cost = estimateCostImpact(currentBundles, updatedBundles, COST_MODELS.vercel);
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## License
|
|
52
|
+
|
|
53
|
+
MIT
|