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,13 @@
import { useEffect, useState } from 'react'
import seedrandom from 'seedrandom'
const rng = seedrandom('hello')
export default function () {
const [value, setValue] = useState(null)
useEffect(() => {
if (value) return
setValue(rng())
}, [value])
return <div>{value == null ? 'loading' : value.toString()}</div>
}

View File

@@ -0,0 +1,68 @@
/* eslint-env jest */
import { remove } from 'fs-extra'
import { nextBuild } from 'next-test-utils'
import { join } from 'path'
import { readFileSync, statSync } from 'fs'
const fixturesDir = join(__dirname, '..', 'fixtures')
describe('Fallback Modules', () => {
;(process.env.TURBOPACK_DEV ? describe.skip : describe)(
'production mode',
() => {
describe('Crypto Application', () => {
const appDir = join(fixturesDir, 'with-crypto')
beforeAll(async () => {
await remove(join(appDir, '.next'))
})
it('should not include crypto', async () => {
if (process.env.NEXT_PRIVATE_SKIP_SIZE_TESTS) {
return
}
await nextBuild(appDir, [], {
stdout: true,
})
// Read build manifest to get chunk files for the index page
const buildManifestPath = join(appDir, '.next', 'build-manifest.json')
const buildManifest = JSON.parse(
readFileSync(buildManifestPath, 'utf8')
)
// Get chunks for the '/' page
const indexPageChunks = buildManifest.pages['/'] || []
// Calculate total size of all chunks for the index page
let totalSize = 0
for (const chunkPath of indexPageChunks) {
const fullChunkPath = join(appDir, '.next', chunkPath)
try {
const stats = statSync(fullChunkPath)
totalSize += stats.size
} catch (error) {
console.warn(`Could not read chunk: ${chunkPath}`, error.message)
}
}
// Convert to kB for easier comparison
const totalSizeKB = totalSize / 1024
console.log(`Index page total size: ${totalSizeKB.toFixed(2)} kB`)
console.log(`Index page chunks: ${indexPageChunks.join(', ')}`)
// Assert on reasonable size bounds
// The total should be reasonable for a simple page without crypto
expect(totalSizeKB).toBeGreaterThan(10) // At least 10kB (has some framework code)
expect(totalSizeKB).toBeLessThan(400) // Less than 400kB (no large crypto libraries)
// Ensure we have the expected chunks
expect(indexPageChunks.length).toBeGreaterThan(0)
})
})
}
)
})