first commit
Some checks failed
Test examples / Test Examples (20) (push) Has been cancelled
Test examples / Test Examples (22) (push) Has been cancelled
Lock Threads / action (push) Has been cancelled
Trigger Release / start (push) Has been cancelled
Stale issue handler / stale (push) Has been cancelled
Update Font Data / create-pull-request (push) Has been cancelled
build-and-deploy / deploy-target (push) Has been cancelled
build-and-deploy / build (push) Has been cancelled
build-and-deploy / stable - aarch64-unknown-linux-musl - node@16 (push) Has been cancelled
build-and-deploy / stable - x86_64-unknown-linux-musl - node@16 (push) Has been cancelled
build-and-deploy / stable - aarch64-unknown-linux-gnu - node@16 (push) Has been cancelled
build-and-deploy / stable - x86_64-unknown-linux-gnu - node@16 (push) Has been cancelled
build-and-deploy / stable - aarch64-pc-windows-msvc - node@16 (push) Has been cancelled
build-and-deploy / stable - x86_64-pc-windows-msvc - node@16 (push) Has been cancelled
build-and-deploy / stable - aarch64-apple-darwin - node@16 (push) Has been cancelled
build-and-deploy / stable - x86_64-apple-darwin - node@16 (push) Has been cancelled
build-and-deploy / build-wasm (nodejs) (push) Has been cancelled
build-and-deploy / build-wasm (web) (push) Has been cancelled
build-and-deploy / Deploy preview tarball (push) Has been cancelled
build-and-deploy / Potentially publish release (push) Has been cancelled
build-and-deploy / publish-turbopack-npm-packages (push) Has been cancelled
build-and-deploy / Deploy examples (push) Has been cancelled
build-and-deploy / thank you, build (push) Has been cancelled
build-and-deploy / Upload Turbopack Bytesize metrics to Datadog (push) Has been cancelled
Rspack Next.js development integration tests / Rspack integration tests (push) Has been cancelled
Rspack Next.js production integration tests / Rspack integration tests (push) Has been cancelled
Turbopack Next.js development integration tests / Next.js integration tests (push) Has been cancelled
Turbopack Next.js production integration tests / Next.js integration tests (push) Has been cancelled
Update Rspack test manifest / Update and upload Rspack development test manifest (push) Has been cancelled
Update Rspack test manifest / Update and upload Rspack production test manifest (push) Has been cancelled
Upload bundler test manifests to areweturboyet.com / Upload test results (push) Has been cancelled
Update React / create-pull-request (push) Has been cancelled
test-e2e-project-reset-cron / reset-test-project (push) Has been cancelled
Notify about the top 15 issues/PRs/feature requests (most reacted) in the last 90 days / run (push) Has been cancelled

This commit is contained in:
Arian Tron
2026-03-10 19:37:31 +03:30
commit 61f56f997c
27684 changed files with 2784175 additions and 0 deletions

View File

@@ -0,0 +1,34 @@
import { join } from 'path'
import { nextTestSetup } from 'e2e-utils'
import { waitForNoRedbox } from 'next-test-utils'
// This is implemented in Turbopack, but Turbopack doesn't log the module count.
;(process.env.IS_TURBOPACK_TEST ? describe.skip : describe)(
'Skipped in Turbopack',
() => {
describe('optimizePackageImports - mui', () => {
const { next } = nextTestSetup({
env: {
NEXT_TEST_MODE: '1',
},
files: join(__dirname, 'fixture'),
dependencies: {
'@mui/material': '5.15.15',
'@emotion/react': '11.11.1',
'@emotion/styled': '11.11.0',
},
})
it('should support MUI', async () => {
// Ensure that MUI is working
const $ = await next.render$('/mui')
expect($('#button').text()).toContain('button')
expect($('#typography').text()).toContain('typography')
const browser = await next.browser('/mui')
await waitForNoRedbox(browser)
})
})
}
)

View File

@@ -0,0 +1,25 @@
import { join } from 'path'
import { nextTestSetup } from 'e2e-utils'
import { waitForNoRedbox } from 'next-test-utils'
describe('optimizePackageImports - mui', () => {
const { next } = nextTestSetup({
env: {
NEXT_TEST_MODE: '1',
},
files: join(__dirname, 'fixture-tremor'),
dependencies: {
'@headlessui/react': '^1.7.18',
'@headlessui/tailwindcss': '^0.2.0',
'@remixicon/react': '^4.2.0',
'@tremor/react': '^3.14.1',
},
})
it('should work', async () => {
// Without barrel optimization, the reproduction breaks.
const browser = await next.browser('/')
await waitForNoRedbox(browser)
})
})

View File

@@ -0,0 +1,44 @@
import { join } from 'path'
import { nextTestSetup } from 'e2e-utils'
// This is implemented in Turbopack, but Turbopack doesn't log the module count.
;(process.env.IS_TURBOPACK_TEST ? describe.skip : describe)(
'Skipped in Turbopack',
() => {
describe('optimizePackageImports - basic', () => {
const { next } = nextTestSetup({
env: {
NEXT_TEST_MODE: '1',
},
files: join(__dirname, 'fixture'),
dependencies: {
'lucide-react': '0.264.0',
'@headlessui/react': '1.7.17',
'@heroicons/react': '2.0.18',
'@visx/visx': '3.3.0',
'recursive-barrel': '1.0.0',
},
})
it('should handle recursive wildcard exports', async () => {
const html = await next.render('/recursive')
expect(html).toContain('<h1>42</h1>')
})
it('should support visx', async () => {
const html = await next.render('/visx')
expect(html).toContain('<linearGradient')
})
it('should not break "use client" directive in optimized packages', async () => {
const html = await next.render('/client')
expect(html).toContain('this is a client component')
})
it('should support "use client" directive in barrel file', async () => {
const html = await next.render('/client-boundary')
expect(html).toContain('<button>0</button>')
})
})
}
)

View File

@@ -0,0 +1,11 @@
export default function RootLayout({
children,
}: Readonly<{
children: React.ReactNode
}>) {
return (
<html lang="en">
<body>{children}</body>
</html>
)
}

View File

@@ -0,0 +1,5 @@
import { Card } from '@tremor/react'
export default function Example() {
return <Card></Card>
}

View File

@@ -0,0 +1,4 @@
/** @type {import('next').NextConfig} */
const nextConfig = {}
export default nextConfig

View File

@@ -0,0 +1,5 @@
import { Button } from 'my-client-lib'
export default function Page() {
return <Button />
}

View File

@@ -0,0 +1,9 @@
import { Client } from 'my-lib'
export default function Page() {
return (
<h1>
<Client />
</h1>
)
}

View File

@@ -0,0 +1,23 @@
// The barrel file shouldn't be transformed many times if it's imported multiple times.
import { ImageIcon } from 'lucide-react'
import { IceCream } from 'lucide-react'
import { AccessibilityIcon } from 'lucide-react'
import { VariableIcon } from 'lucide-react'
import { Table2Icon } from 'lucide-react'
import { Package2Icon } from 'lucide-react'
import { ZapIcon } from 'lucide-react'
export default function Page() {
return (
<>
<ImageIcon />
<IceCream />
<AccessibilityIcon />
<VariableIcon />
<Table2Icon />
<Package2Icon />
<ZapIcon />
</>
)
}

View File

@@ -0,0 +1,12 @@
export const metadata = {
title: 'Next.js',
description: 'Generated by Next.js',
}
export default function RootLayout({ children }) {
return (
<html lang="en">
<body>{children}</body>
</html>
)
}

View File

@@ -0,0 +1,13 @@
import { Button } from '@mui/material'
import { Typography } from '@mui/material'
export default function Page() {
return (
<div>
<Button id="button">button</Button>
<Typography id="typography" variant="h1">
typography
</Typography>
</div>
)
}

View File

@@ -0,0 +1,15 @@
import { Comp } from '../components/slow-component'
import { AcademicCapIcon as A } from '@heroicons/react/20/solid'
import { AcademicCapIcon as B } from '@heroicons/react/24/outline'
import { AcademicCapIcon as C } from '@heroicons/react/24/solid'
export default function Page() {
return (
<>
<A />
<B />
<C />
<Comp />
</>
)
}

View File

@@ -0,0 +1,7 @@
'use client'
import { b_8_7_6_4 } from 'recursive-barrel'
export default function Page() {
return <h1>{b_8_7_6_4}</h1>
}

View File

@@ -0,0 +1,5 @@
import { c } from 'my-lib'
export default function Page() {
return <h1>{c}</h1>
}

View File

@@ -0,0 +1,5 @@
import { foo } from 'my-lib'
export default function Page() {
return <h1>{foo}</h1>
}

View File

@@ -0,0 +1,77 @@
'use client'
import {
IceCream,
BackpackIcon,
LucideActivity,
Code,
Menu,
SortAsc,
SortAscIcon,
LucideSortDesc,
VerifiedIcon,
CurlyBraces,
Slash,
SquareGantt,
CircleSlashed,
SquareKanban,
SquareKanbanDashed,
Stars,
Edit,
Edit2,
LucideEdit3,
TextSelection,
createLucideIcon,
} from 'lucide-react'
import { Tab, RadioGroup, Transition } from '@headlessui/react'
export function Comp() {
globalThis.__noop__ = createLucideIcon
return (
<>
<IceCream />
<BackpackIcon />
<LucideActivity />
<Code />
<Menu />
<SortAsc />
<SortAscIcon />
<LucideSortDesc />
<VerifiedIcon />
<CurlyBraces />
<Slash />
<SquareGantt />
<CircleSlashed />
<SquareKanban />
<SquareKanbanDashed />
<Stars />
<Edit />
<Edit2 />
<LucideEdit3 />
<TextSelection />
<Tab.Group>
<Tab.List>
<Tab>Tab 1</Tab>
<Tab>Tab 2</Tab>
<Tab>Tab 3</Tab>
</Tab.List>
<Tab.Panels>
<Tab.Panel>Content 1</Tab.Panel>
<Tab.Panel>Content 2</Tab.Panel>
<Tab.Panel>Content 3</Tab.Panel>
</Tab.Panels>
</Tab.Group>
<RadioGroup>
<RadioGroup.Label>Plan</RadioGroup.Label>
<RadioGroup.Option value="startup">
{({ checked }) => <span>{checked ? 'checked' : ''} Startup</span>}
</RadioGroup.Option>
<RadioGroup.Option value="business">
{({ checked }) => <span>{checked ? 'checked' : ''} Business</span>}
</RadioGroup.Option>
</RadioGroup>
<Transition show>I will fade in and out</Transition>
</>
)
}

View File

@@ -0,0 +1,6 @@
module.exports = {
transpilePackages: ['my-client-lib'],
experimental: {
optimizePackageImports: ['my-lib', 'recursive-barrel', 'my-client-lib'],
},
}

View File

@@ -0,0 +1,6 @@
import { useState } from 'react'
export function Button() {
const [count, setCount] = useState(0)
return <button onClick={() => setCount(count + 1)}>{count}</button>
}

View File

@@ -0,0 +1,3 @@
'use client'
export { Button } from './button'

View File

@@ -0,0 +1,2 @@
export * from './b'
export { foo } from './foo'

View File

@@ -0,0 +1 @@
export * from './c'

View File

@@ -0,0 +1 @@
export const c = 42

View File

@@ -0,0 +1,5 @@
'use client'
export function Client() {
return 'this is a client component'
}

View File

@@ -0,0 +1 @@
export const foo = 'foo'

View File

@@ -0,0 +1,2 @@
export * from './a'
export * from './client'

View File

@@ -0,0 +1,5 @@
import { Comp } from '../components/slow-component'
export default function Page() {
return <Comp />
}

View File

@@ -0,0 +1,5 @@
import { b_8_3_1_1 as v } from 'recursive-barrel'
export default function Page() {
return <h1>{v}</h1>
}

View File

@@ -0,0 +1,10 @@
import { Gradient } from '@visx/visx'
export default function Page() {
return (
<svg width={400} height={400}>
<Gradient.GradientPinkBlue id="g" from="red" to="blue" />
<rect width={400} height={400} fill="url(#g)" />
</svg>
)
}