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 @@
export default () => any

View File

@@ -0,0 +1,3 @@
export default () => {
return <>Not aliased to d.ts file</>
}

View File

@@ -0,0 +1,5 @@
import React from 'react'
export function Hello() {
return <>Hello</>
}

View File

@@ -0,0 +1,5 @@
import React, { type JSX } from 'react'
export function World(): JSX.Element {
return <>World</>
}

View File

@@ -0,0 +1 @@
export default () => 'Hello from a'

View File

@@ -0,0 +1 @@
export default () => 'Hello from b'

View File

@@ -0,0 +1 @@
export default () => 'Hello from only b'

View File

@@ -0,0 +1,6 @@
module.exports = {
onDemandEntries: {
// Make sure entries are not getting disposed.
maxInactiveAge: 1000 * 60 * 60,
},
}

View File

@@ -0,0 +1,10 @@
import React, { type JSX } from 'react'
import NotAliasedToDTS from 'd-ts-alias'
export default function HelloPage(): JSX.Element {
return (
<div>
<NotAliasedToDTS />
</div>
)
}

View File

@@ -0,0 +1,9 @@
import React, { type JSX } from 'react'
import { World } from '@c/world'
export default function HelloPage(): JSX.Element {
return (
<div>
<World />
</div>
)
}

View File

@@ -0,0 +1,5 @@
import React, { type JSX } from 'react'
import api from '@lib/b-only'
export default function ResolveOrder(): JSX.Element {
return <div>{api()}</div>
}

View File

@@ -0,0 +1,5 @@
import React, { type JSX } from 'react'
import api from '@lib/api'
export default function ResolveOrder(): JSX.Element {
return <div>{api()}</div>
}

View File

@@ -0,0 +1,9 @@
import { Hello } from '@mycomponent'
export default function SingleAlias() {
return (
<div>
<Hello />
</div>
)
}

View File

@@ -0,0 +1,87 @@
/* eslint-env jest */
import { join } from 'path'
import cheerio from 'cheerio'
import * as path from 'path'
import {
renderViaHTTP,
findPort,
launchApp,
killApp,
File,
} from 'next-test-utils'
import * as JSON5 from 'json5'
const appDir = join(__dirname, '..')
let appPort
let app
async function get$(path, query?: any) {
const html = await renderViaHTTP(appPort, path, query)
return cheerio.load(html)
}
function runTests() {
describe('default behavior', () => {
beforeAll(async () => {
appPort = await findPort()
app = await launchApp(appDir, appPort, {})
})
afterAll(() => killApp(app))
it('should alias components', async () => {
const $ = await get$('/basic-alias')
expect($('body').text()).toMatch(/World/)
})
it('should resolve the first item in the array first', async () => {
const $ = await get$('/resolve-order')
expect($('body').text()).toMatch(/Hello from a/)
})
it('should resolve the second item in as a fallback', async () => {
const $ = await get$('/resolve-fallback')
expect($('body').text()).toMatch(/Hello from only b/)
})
it('should resolve a single matching alias', async () => {
const $ = await get$('/single-alias')
expect($('body').text()).toMatch(/Hello/)
})
it('should not resolve to .d.ts files', async () => {
const $ = await get$('/alias-to-d-ts')
expect($('body').text()).toMatch(/Not aliased to d\.ts file/)
})
})
}
describe('typescript paths', () => {
runTests()
})
const tsconfig = new File(path.resolve(__dirname, '../tsconfig.json'))
describe('typescript paths without baseurl', () => {
beforeAll(async () => {
const tsconfigContent = JSON5.parse(tsconfig.originalContent)
delete tsconfigContent.compilerOptions.baseUrl
tsconfigContent.compilerOptions.paths = {
'isomorphic-unfetch': ['./types/unfetch.d.ts'],
'@c/*': ['./components/*'],
'@lib/*': ['./lib/a/*', './lib/b/*'],
'@mycomponent': ['./components/hello.tsx'],
'd-ts-alias': [
'./components/alias-to-d-ts.d.ts',
'./components/alias-to-d-ts.tsx',
],
}
tsconfig.write(JSON.stringify(tsconfigContent, null, 2))
})
afterAll(() => {
tsconfig.restore()
})
runTests()
})

View File

@@ -0,0 +1,32 @@
/* This is a single line comment to check if that works */ {
"compilerOptions": {
"baseUrl": ".",
"paths": {
"isomorphic-unfetch": ["types/unfetch.d.ts"],
"@c/*": ["components/*"],
"@lib/*": ["lib/a/*", "lib/b/*"],
"@mycomponent": ["components/hello.tsx"],
"d-ts-alias": [
"components/alias-to-d-ts.d.ts",
"components/alias-to-d-ts.tsx"
]
// This is a single line comment to check if that works
},
"esModuleInterop": true,
"module": "esnext",
"jsx": "react-jsx",
"target": "es5",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"noEmit": true,
"incremental": true,
"moduleResolution": "bundler",
"resolveJsonModule": true,
"isolatedModules": true
},
"exclude": ["node_modules", "**/*.test.ts", "**/*.test.tsx"],
"include": ["next-env.d.ts", "components", "pages"]
}