perf: dev server (#10904)

* perf: dev server

* fix
This commit is contained in:
shadcn
2026-06-10 11:10:01 +04:00
committed by GitHub
parent 1450bea8d6
commit 1994caba0b
9 changed files with 167 additions and 144 deletions

View File

@@ -1,6 +1,8 @@
// @ts-nocheck
// This file is autogenerated by scripts/build-registry.mts
// Do not edit this file directly.
import "server-only"
import * as React from "react"
export const ExamplesIndex: Record<string, Record<string, any>> = {

View File

@@ -29,9 +29,6 @@ const nextConfig = {
turbopack: {
root: path.resolve(import.meta.dirname, "../.."),
},
experimental: {
turbopackFileSystemCacheForDev: true,
},
redirects() {
return [
// Form redirects to /docs/forms.

View File

@@ -14,8 +14,8 @@
"format:write": "prettier --write \"**/*.{ts,tsx,mdx}\" --cache",
"format:check": "prettier --check \"**/*.{ts,tsx,mdx}\" --cache",
"icons:dev": "tsx --tsconfig ./tsconfig.scripts.json ./scripts/build-icons.ts --watch",
"registry:build": "pnpm --filter=shadcn build && bun run ./scripts/build-registry.mts",
"registry:capture": "tsx --tsconfig ./tsconfig.scripts.json ./scripts/capture-registry.mts",
"registry:build": "pnpm --filter=shadcn build && bun --conditions=react-server run ./scripts/build-registry.mts",
"registry:capture": "tsx --conditions=react-server --tsconfig ./tsconfig.scripts.json ./scripts/capture-registry.mts",
"explore:capture": "tsx --tsconfig ./tsconfig.scripts.json ./scripts/capture-explore.mts",
"validate:registries": "tsx --tsconfig ./tsconfig.scripts.json ./scripts/validate-registries.mts",
"test:apps": "bun run ./scripts/build-test-app.mts",
@@ -61,7 +61,7 @@
"lru-cache": "^11.2.4",
"lucide-react": "0.474.0",
"motion": "^12.12.1",
"next": "16.1.6",
"next": "16.2.7",
"next-themes": "0.4.6",
"nuqs": "^2.8.9",
"postcss": "^8.5.1",

View File

@@ -1,6 +1,8 @@
// @ts-nocheck
// This file is autogenerated by scripts/build-registry.ts
// Do not edit this file directly.
import "server-only"
import * as React from "react"
export const Index: Record<string, Record<string, any>> = {

View File

@@ -61,7 +61,7 @@ function scanIconUsage() {
function generateIconFiles(iconUsage: IconUsage) {
const outputDir = path.join(process.cwd(), "registry/icons")
console.log("✓ Generated icon files:")
const written: string[] = []
Object.entries(iconLibraries).forEach(([libraryName, config]) => {
const icons = Array.from(iconUsage[libraryName as IconLibraryName]).sort()
@@ -75,10 +75,25 @@ ${icons.map((icon) => `export { ${icon} } from "${config.export}"`).join("\n")}
`
const filename = `__${libraryName}__.ts`
fs.writeFileSync(path.join(outputDir, filename), content)
const filepath = path.join(outputDir, filename)
console.log(` - ${config.title}: ${icons.length} icons`)
// Skip unchanged files to avoid mtime bumps that trigger
// unnecessary Turbopack invalidations in watch mode.
if (
fs.existsSync(filepath) &&
fs.readFileSync(filepath, "utf-8") === content
) {
return
}
fs.writeFileSync(filepath, content)
written.push(` - ${config.title}: ${icons.length} icons`)
})
if (written.length > 0) {
console.log("✓ Generated icon files:")
written.forEach((line) => console.log(line))
}
}
function main() {

View File

@@ -1019,6 +1019,7 @@ async function buildExamplesIndex() {
let index = `// @ts-nocheck
// This file is autogenerated by scripts/build-registry.mts
// Do not edit this file directly.
import "server-only"
import * as React from "react"
export const ExamplesIndex: Record<string, Record<string, any>> = {`
@@ -1065,6 +1066,7 @@ async function buildRegistryIndex(styles: { name: string; title: string }[]) {
let index = `// @ts-nocheck
// This file is autogenerated by scripts/build-registry.ts
// Do not edit this file directly.
import "server-only"
import * as React from "react"
export const Index: Record<string, Record<string, any>> = {`