Skip to content

Commit d0979a3

Browse files
authoredFeb 8, 2025
build: optimize
* test(pkgs): optimize imports * securerpc fixes * sitemap update * fix(docs): links * chore(format): apply * fix(ui): remove resizable comp * build(nextjs): no ie11
1 parent 45c8a25 commit d0979a3

32 files changed

+1242
-499
lines changed
 

‎.browserslistrc

-23
This file was deleted.

‎CHANGELOG.md

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
### Changelog
2+
3+
All notable changes to this project will be documented in this file. Dates are displayed in UTC.
4+
5+
Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
6+
7+
#### [v0.0.1](https://github.com/manifoldfinance/www-frontend/compare/v0.0.0...v0.0.1)
8+
9+
> 4 February 2025
10+
11+
- fix(site): enforce black bg css [`da59a90`](https://github.com/manifoldfinance/www-frontend/commit/da59a90dfa10621f5f8e3750ec131acc6b1af479)
12+
- fix(types): two step cast type fix [`17dfc88`](https://github.com/manifoldfinance/www-frontend/commit/17dfc88cf820abb7ae464c0178c3e77d3b196376)
13+
14+
#### v0.0.0
15+
16+
> 4 February 2025
17+
18+
- feat(repo): init [`0c2c696`](https://github.com/manifoldfinance/www-frontend/commit/0c2c696bc290273633b02677ed412dfb08606999)
19+
- feat(app): finalize styling [`3e45f8b`](https://github.com/manifoldfinance/www-frontend/commit/3e45f8b806c648fcf3faaaccd6d2100a4170b67f)
20+
- fix(biome): fmt [`f03367f`](https://github.com/manifoldfinance/www-frontend/commit/f03367fabd916be518925a309f788baea51aca04)

‎analyze-packages.js

+145
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,145 @@
1+
const fs = require("fs")
2+
const path = require("path")
3+
const parser = require("@babel/parser")
4+
const traverse = require("@babel/traverse").default
5+
const glob = require("glob")
6+
7+
// Function to get all JS/TS files in the project
8+
function getProjectFiles(projectRoot) {
9+
return glob.sync("**/*.{js,jsx,ts,tsx}", {
10+
cwd: projectRoot,
11+
ignore: ["node_modules/**", ".next/**", "out/**", "build/**", "dist/**"],
12+
})
13+
}
14+
15+
// Function to parse package.json and get dependencies
16+
function getDependencies(projectRoot) {
17+
const packageJson = JSON.parse(fs.readFileSync(path.join(projectRoot, "package.json"), "utf8"))
18+
return {
19+
...packageJson.dependencies,
20+
...packageJson.devDependencies,
21+
}
22+
}
23+
24+
// Function to get all exports from a package
25+
function getPackageExports(packageName) {
26+
try {
27+
const packagePath = require.resolve(packageName)
28+
const pkg = require(packagePath)
29+
return Object.keys(pkg)
30+
} catch (error) {
31+
console.warn(`Could not analyze exports for package: ${packageName}`)
32+
return []
33+
}
34+
}
35+
36+
// Function to analyze imports in a file
37+
function analyzeFileImports(filePath, projectRoot) {
38+
const content = fs.readFileSync(path.join(projectRoot, filePath), "utf8")
39+
const imports = new Set()
40+
41+
try {
42+
const ast = parser.parse(content, {
43+
sourceType: "module",
44+
plugins: ["jsx", "typescript", "decorators-legacy"],
45+
})
46+
47+
traverse(ast, {
48+
ImportDeclaration(path) {
49+
const source = path.node.source.value
50+
if (!source.startsWith(".") && !source.startsWith("/")) {
51+
const packageName = source.split("/")[0]
52+
path.node.specifiers.forEach((specifier) => {
53+
if (specifier.type === "ImportSpecifier") {
54+
imports.add(`${packageName}:${specifier.imported.name}`)
55+
}
56+
})
57+
}
58+
},
59+
})
60+
} catch (error) {
61+
console.warn(`Error parsing file ${filePath}:`, error.message)
62+
}
63+
64+
return imports
65+
}
66+
67+
// Main function to analyze the project
68+
async function analyzeProject(projectRoot) {
69+
const files = getProjectFiles(projectRoot)
70+
const dependencies = getDependencies(projectRoot)
71+
const packageImports = new Map()
72+
const unusedExports = new Map()
73+
74+
// Initialize package exports
75+
for (const pkg of Object.keys(dependencies)) {
76+
const exports = getPackageExports(pkg)
77+
if (exports.length > 0) {
78+
unusedExports.set(pkg, new Set(exports))
79+
}
80+
}
81+
82+
// Analyze each file
83+
for (const file of files) {
84+
const imports = analyzeFileImports(file, projectRoot)
85+
86+
for (const imp of imports) {
87+
const [pkg, exportName] = imp.split(":")
88+
if (unusedExports.has(pkg)) {
89+
unusedExports.get(pkg).delete(exportName)
90+
}
91+
92+
if (!packageImports.has(pkg)) {
93+
packageImports.set(pkg, new Set())
94+
}
95+
packageImports.get(pkg).add(exportName)
96+
}
97+
}
98+
99+
// Find packages with unused exports
100+
const packagesWithUnusedExports = []
101+
for (const [pkg, unused] of unusedExports) {
102+
if (unused.size > 0) {
103+
packagesWithUnusedExports.push({
104+
package: pkg,
105+
unusedCount: unused.size,
106+
totalExports: getPackageExports(pkg).length,
107+
unusedExports: Array.from(unused),
108+
})
109+
}
110+
}
111+
112+
return packagesWithUnusedExports
113+
}
114+
115+
// Run the analysis
116+
const projectRoot = process.cwd()
117+
analyzeProject(projectRoot)
118+
.then((results) => {
119+
console.log("\nPackages with unused exports:")
120+
console.log("============================")
121+
122+
const optimizePackageImports = results
123+
.filter((pkg) => pkg.unusedCount > 5) // Threshold for significant unused exports
124+
.map((pkg) => pkg.package)
125+
126+
results.forEach((pkg) => {
127+
console.log(`\n${pkg.package}:`)
128+
console.log(`- ${pkg.unusedCount} unused exports out of ${pkg.totalExports} total exports`)
129+
console.log(
130+
"- Unused exports:",
131+
pkg.unusedExports.slice(0, 5).join(", ") +
132+
(pkg.unusedExports.length > 5 ? ` and ${pkg.unusedExports.length - 5} more...` : ""),
133+
)
134+
})
135+
136+
console.log("\nRecommended optimizePackageImports configuration:")
137+
console.log("=============================================")
138+
console.log("Add this to your next.config.js:")
139+
console.log("optimizePackageImports: [")
140+
optimizePackageImports.forEach((pkg) => console.log(` '${pkg}',`))
141+
console.log("]")
142+
})
143+
.catch((error) => {
144+
console.error("Error analyzing project:", error)
145+
})

‎app/components/docs-sidebar.tsx

+2-6
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,8 @@ const docs: DocLink[] = [
4141
},
4242
{
4343
title: "SecureRPC",
44-
href: "/docs/securerpc",
45-
items: [
46-
{ title: "API Reference", href: "/docs/securerpc/api-reference" },
47-
{ title: "Authentication", href: "/docs/securerpc/authentication" },
48-
{ title: "Rate Limiting", href: "/docs/securerpc/rate-limiting" },
49-
],
44+
href: "https://securerpc.com",
45+
items: [],
5046
},
5147
{
5248
title: "FAQ",

‎app/components/footer.tsx

+3-2
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export function Footer() {
1919
<div className="mb-4 md:mb-0">
2020
<nav>
2121
<ul className="flex flex-wrap justify-center md:justify-start space-x-4 md:space-x-6">
22-
{/* {sitemapLinks.map((link) => (
22+
{/* {sitemapLinks.map((link) => (
2323
<li key={link.name}>
2424
<Link
2525
href={link.href}
@@ -30,7 +30,8 @@ export function Footer() {
3030
</li>
3131
))
3232
}
33-
*/} </ul>
33+
*/}{" "}
34+
</ul>
3435
</nav>
3536
</div>
3637
<div className="flex items-center space-x-4">

‎app/components/header.tsx

+10-9
Original file line numberDiff line numberDiff line change
@@ -33,21 +33,21 @@ const solutions: { title: string; href: string; description: string }[] = [
3333
description: "Maximize MEV earnings with our advanced integrations and tools.",
3434
},
3535
{
36-
title: "MEV Relay+Protect",
36+
title: "Relay + Protect",
3737
href: "/solutions/mev-relay-protect",
3838
description: "Prevent MEV extraction for any protocol/transaction seamlessly.",
3939
},
4040
]
4141

4242
const products: { title: string; href: string; description: string }[] = [
4343
{
44-
title: "FOLD Staking",
44+
title: "FOLD Token",
4545
href: "/products/fold-staking",
4646
description: "Stake your FOLD tokens and earn rewards.",
4747
},
4848
{
4949
title: "SecureRPC",
50-
href: "/products/securerpc",
50+
href: "https://securerpc.com",
5151
description: "Censorship resistant RPC service for uncompromised blockchain access.",
5252
},
5353
{
@@ -69,14 +69,15 @@ const resources: { title: string; href: string; description: string }[] = [
6969
description: "Insights and updates from the Manifold Finance team.",
7070
},
7171
{
72-
title: "Changelog",
73-
href: "/changelog",
74-
description: "Stay up to date with our latest features and improvements.",
72+
title: "Telegram",
73+
href: "https://t.me/manifoldfinance",
74+
description:
75+
"Join our community and stay up to date with our latest features and improvements.",
7576
},
7677
{
77-
title: "Support",
78-
href: "/support",
79-
description: "Get help from our team and community.",
78+
title: "GitHub",
79+
href: "https://github.com/manifoldfinance",
80+
description: "Contribute to our open source projects.",
8081
},
8182
{
8283
title: "Forums",

‎app/components/lst-apy-graph.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ interface LSTData {
1818
const lstData: LSTData[] = [
1919
{ name: "mevETH", apy: 4.6 },
2020
{ name: "stETH", apy: 2.8 },
21-
{ name: "rETH", apy: 2.9},
21+
{ name: "rETH", apy: 2.9 },
2222
{ name: "oETH", apy: 2.85 },
2323
]
2424

‎app/components/lst-apy-trend-graph.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ interface LSTTrendData {
2020
}
2121

2222
const lstTrendData: LSTTrendData[] = [
23-
{ quarter: "Q1 2024", mevETH: 4.3, stETH: 3.6, rETH: 3.0, cETH: 3.7},
23+
{ quarter: "Q1 2024", mevETH: 4.3, stETH: 3.6, rETH: 3.0, cETH: 3.7 },
2424
{ quarter: "Q2 2024", mevETH: 4.2, stETH: 3.4, rETH: 3.1, cETH: 3.7 },
2525
{ quarter: "Q3 2024", mevETH: 4.4, stETH: 3.1, rETH: 3.0, cETH: 3.3 },
2626
{ quarter: "Q4 2024", mevETH: 4.6, stETH: 3.1, rETH: 2.8, cETH: 3.4 },

‎app/components/main-nav.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ const products: { title: string; href: string; description: string }[] = [
4949
},
5050
{
5151
title: "SecureRPC",
52-
href: "/products/securerpc",
53-
description: "Enterprise-grade RPC service for secure blockchain interactions.",
52+
href: "https://securerpc.com",
53+
description: "",
5454
},
5555
{
5656
title: "XGA",

0 commit comments

Comments
 (0)