Skip to content
Myr

chore(builld): tsconfig project references (#4797)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

* chore(builld): tsconfig project references * ci: apply automated fixes * chore(perf-measures): include type-check scripts * chore(perf-measures): install and build ---------

authored by Jonathan Haines · committed by GitHub · parent 8217d9e · Browse files · 24 files+140 added−77 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Trailers

  • Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>

Diff stats

24 files+140 added−77 removed

  • tests:+22 added−11 removed
  • other:+118 added−66 removed

24 files+140 added−77 removed

modified:.github/actions/perf-measures/action.yml+3 added-1 removed
added:perf-measures/type-check/scripts/tsconfig.json+7 added
modified:perf-measures/type-check/tsconfig.build.json+7 added-4 removed
deleted:perf-measures/tsconfig.json-10 removed
modified:runtime-tests/bun/index.test.tsx+10 added-5 removed
7 unmodified lines
8import { Context } from '../../src/context'9import { env, getRuntimeKey } from '../../src/helper/adapter'10import type { WSMessageReceive } from '../../src/helper/websocket'11import { Hono } from '../../src/index'12// eslint-disable-next-line @typescript-eslint/no-unused-vars13import { jsx } from '../../src/jsx'12import type { PropsWithChildren } from '../../src/jsx'13import { basicAuth } from '../../src/middleware/basic-auth'14import { jwt } from '../../src/middleware/jwt'1516declare module '../../src/index' {17 interface ContextRenderer {18 (content: string | Promise<string>, head: { title: string }): Response | Promise<Response>19 }20}2122// Test just only minimal patterns.23// Because others are tested well in Cloudflare Workers environment already.2425Bun.env.NAME = 'Bun'
179 unmodified lines
205// set "jsxImportSource": "hono/jsx" in the tsconfig.json206describe('JSX Middleware', () => {207 const app = new Hono()208204 const Layout = (props: { children?: string }) => {209 const Layout = (props: PropsWithChildren) => {210 return <html>{props.children}</html>211 }212213 app.get('/', (c) => {
67 unmodified lines
281 })282283 it('Should correctly generate static HTML files for Hono routes', async () => {284 const result = await toSSG(app, { dir: './static' })280 expect(result.success).toBeTruly285 expect(result.success).toBeTruthy()286 expect(result.error).toBeUndefined()287 expect(result.files).toBeDefined()288 afterAll(async () => {289 await deleteDirectory('./static')
37 unmodified lines
327 expect(receivedMessage).toBe(message)328 })329})330326async function deleteDirectory(dirPath) {331async function deleteDirectory(dirPath: string) {332 if (333 await fs334 .stat(dirPath)335 .then((stat) => stat.isDirectory())
124 unmodified lines
added:runtime-tests/bun/tsconfig.json+12 added
modified:runtime-tests/fastly/index.test.ts+5 added-1 removed
added:runtime-tests/fastly/tsconfig.json+10 added
1{2 "extends": "../../tsconfig.base.json",3 "compilerOptions": {4 "noEmit": true,5 "types": ["vitest/globals"]6 },7 "references": [8 { "path": "../../tsconfig.build.json" }9 ]10}
modified:runtime-tests/lambda/index.test.ts+6 added-4 removed
18 unmodified lines
19 LatticeRequestContextV2,20 LambdaContext,21} from '../../src/adapter/aws-lambda/types'22import { getCookie, setCookie } from '../../src/helper/cookie'23import { streamSSE } from '../../src/helper/streaming'23import { streamSSE, streamText } from '../../src/helper/streaming'24import { Hono } from '../../src/hono'25import { basicAuth } from '../../src/middleware/basic-auth'26import './mock'27
894 unmodified lines
922 return c.text('Hello Lambda!')923 })924925 app.get('/stream/text', async (c) => {926 return c.streamText(async (stream) => {926 return streamText(c, async (stream) => {927 for (let i = 0; i < 3; i++) {928 await stream.writeln(`${i}`)929 await stream.sleep(1)930 }
37 unmodified lines
968 mockReadableStream.push('2\n')969 mockReadableStream.push('3\n')970 mockReadableStream.push(null) // EOF971972 // @ts-expect-error should this be a ReadbleStream?972 await handler(event, mockReadableStream)973 await handler(event, mockReadableStream, vi.fn())974975 const chunks = []976 for await (const chunk of mockReadableStream) {977 chunks.push(chunk)
35 unmodified lines
1013 mockReadableStream.push('data: Message\ndata: It is 0\n\n')1014 mockReadableStream.push('data: Message\ndata: It is 1\n\n')1015 mockReadableStream.push(null) // EOF10161017 // @ts-expect-error should this be a ReadbleStream?1016 await handler(event, mockReadableStream)1018 await handler(event, mockReadableStream, vi.fn())10191020 const chunks = []1021 for await (const chunk of mockReadableStream) {1022 chunks.push(chunk)
67 unmodified lines
modified:runtime-tests/lambda/mock.ts+5 added-9 removed
1import { vi } from 'vitest'2import type {3 APIGatewayProxyEvent,4 APIGatewayProxyEventV2,5 LambdaFunctionUrlEvent,6} from '../../src/adapter/aws-lambda/handler'2import type { LambdaEvent } from '../../src/adapter/aws-lambda/handler'3import type { LambdaContext } from '../../src/adapter/aws-lambda/types'45type StreamifyResponseHandler = (6 handlerFunc: (11 event: APIGatewayProxyEvent | APIGatewayProxyEventV2 | LambdaFunctionUrlEvent,7 event: LambdaEvent,8 responseStream: NodeJS.WritableStream,9 context: LambdaContext10 ) => Promise<void>15) => (event: APIGatewayProxyEvent, context: LambdaContext) => Promise<NodeJS.WritableStream>11) => (event: LambdaEvent, context: LambdaContext) => Promise<NodeJS.WritableStream>1213const mockStreamifyResponse: StreamifyResponseHandler = (handlerFunc) => {14 return async (event, context) => {15 const mockWritableStream: NodeJS.WritableStream = new (require('stream').Writable)({20 write(chunk, _encoding, callback) {16 write(chunk: Buffer, _encoding: string, callback: () => void) {17 console.log('Writing chunk:', chunk.toString())18 callback()19 },24 final(callback) {20 final(callback: () => void) {21 console.log('Finalizing stream.')22 callback()23 },24 })
14 unmodified lines
modified:runtime-tests/lambda/stream-mock.ts+2 added-1 removed
14 unmodified lines
15) => (event: APIGatewayProxyEvent, context: LambdaContext) => Promise<NodeJS.WritableStream>1617const mockStreamifyResponse: StreamifyResponseHandler = (handlerFunc) => {18 return async (event, context) => {19 const chunks = []19 const chunks: unknown[] = []20 const mockWritableStream = new Writable({21 write(chunk, _encoding, callback) {22 chunks.push(chunk)23 callback()24 },25 })26 // @ts-expect-error chunks property for testing27 mockWritableStream.chunks = chunks28 await handlerFunc(event, mockWritableStream, context)29 mockWritableStream.end()30 return mockWritableStream
14 unmodified lines
modified:runtime-tests/lambda/stream.test.ts+1 added-1 removed
65 unmodified lines
66 isBase64Encoded: false,67 requestContext: testApiGatewayRequestContextV2,68 }6970 const stream = await handler(event)70 const stream = await handler(event, {} as LambdaContext, vi.fn())7172 const metadata = JSON.parse(stream.chunks[0].toString())73 expect(metadata.cookies).toEqual(['cookie1=value1', 'cookie2=value2'])74 })
1 unmodified line
added:runtime-tests/lambda/tsconfig.json+10 added
1{2 "extends": "../../tsconfig.base.json",3 "compilerOptions": {4 "noEmit": true,5 "types": ["vitest/globals"]6 },7 "references": [8 { "path": "../../tsconfig.build.json" }9 ]10}
added:runtime-tests/lambda-edge/tsconfig.json+10 added
1{2 "extends": "../../tsconfig.base.json",3 "compilerOptions": {4 "noEmit": true,5 "types": ["vitest/globals"]6 },7 "references": [8 { "path": "../../tsconfig.build.json" }9 ]10}
added:runtime-tests/node/tsconfig.json+10 added
1{2 "extends": "../../tsconfig.base.json",3 "compilerOptions": {4 "noEmit": true,5 "types": ["vitest/globals"]6 },7 "references": [8 { "path": "../../tsconfig.build.json" }9 ]10}
added:runtime-tests/workerd/tsconfig.json+10 added
1{2 "extends": "../../tsconfig.base.json",3 "compilerOptions": {4 "noEmit": true,5 "types": ["vitest/globals"]6 },7 "references": [8 { "path": "../../tsconfig.build.json" }9 ]10}
deleted:runtime-tests/tsconfig.json-4 removed
1{2 "extends": "../tsconfig.json",3 "include": ["**/*.ts", "**/*.tsx"]4}
modified:src/adapter/aws-lambda/handler.ts+1 added-6 removed
451 unmodified lines
452 .join('&')453 }454 }455456 protected getCookies(457 // eslint-disable-next-line @typescript-eslint/no-unused-vars458 event: APIGatewayProxyEvent,459 // eslint-disable-next-line @typescript-eslint/no-unused-vars460 headers: Headers461 ): void {456 protected getCookies(_event: APIGatewayProxyEvent, _headers: Headers): void {457 // nop458 }459460 protected getHeaders(event: APIGatewayProxyEvent): Headers {
215 unmodified lines
modified:src/jsx/types.ts+1 added-2 removed
20 unmodified lines
21 props: P22 key: string | null23}24type ReactNode = ReactElement | string | number | boolean | null | undefined25// eslint-disable-next-line @typescript-eslint/no-unused-vars26type ComponentClass<P = {}, S = {}> = unknown25type ComponentClass<_P = {}, _S = {}> = unknown2627export type { ReactElement, ReactNode, ComponentClass }2829export type Event = globalThis.Event
11 unmodified lines
modified:bun.lock+3 added
7 unmodified lines
8 "@hono/node-server": "^1.13.5",9 "@types/glob": "^9.0.0",10 "@types/jsdom": "^21.1.7",11 "@types/node": "^24.3.0",12 "@types/ws": "^8.18.1",13 "@typescript/native-preview": "7.0.0-dev.20260210.1",14 "@vitest/coverage-v8": "^3.2.4",15 "arg": "^5.0.2",16 "bun-types": "^1.2.20",
436 unmodified lines
453 "@types/statuses": ["@types/statuses@2.0.5", "", {}, "sha512-jmIUGWrAiwu3dZpxntxieC+1n/5c3mjrImkmOSQ2NC5uP6cYO4aAZDdSmRcI5C1oiTmqlZGHC+/NmJrKogbP5A=="],454455 "@types/tough-cookie": ["@types/tough-cookie@4.0.5", "", {}, "sha512-/Ad8+nIOV7Rl++6f1BdKxFSMgmoqEoYbHRpPcx3JEfv8VRsQe9Z4mCXeJBzxs7mbHY/XOZZuXlRNfhpVPbs6ZA=="],456457 "@types/ws": ["@types/ws@8.18.1", "", { "dependencies": { "@types/node": "*" } }, "sha512-ThVF6DCVhA8kUGy+aazFQ4kXQ7E1Ty7A3ypFOe0IcJV8O/M511G99AW24irKrW56Wt44yG9+ij8FaqoBGkuBXg=="],458459 "@typescript-eslint/eslint-plugin": ["@typescript-eslint/eslint-plugin@8.56.1", "", { "dependencies": { "@eslint-community/regexpp": "^4.12.2", "@typescript-eslint/scope-manager": "8.56.1", "@typescript-eslint/type-utils": "8.56.1", "@typescript-eslint/utils": "8.56.1", "@typescript-eslint/visitor-keys": "8.56.1", "ignore": "^7.0.5", "natural-compare": "^1.4.0", "ts-api-utils": "^2.4.0" }, "peerDependencies": { "@typescript-eslint/parser": "^8.56.1", "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0", "typescript": ">=4.8.4 <6.0.0" } }, "sha512-Jz9ZztpB37dNC+HU2HI28Bs9QXpzCz+y/twHOwhyrIRdbuVDxSytJNDl6z/aAKlaRIwC7y8wJdkBv7FxYGgi0A=="],460461 "@typescript-eslint/parser": ["@typescript-eslint/parser@8.56.1", "", { "dependencies": { "@typescript-eslint/scope-manager": "8.56.1", "@typescript-eslint/types": "8.56.1", "@typescript-eslint/typescript-estree": "8.56.1", "@typescript-eslint/visitor-keys": "8.56.1", "debug": "^4.4.3" }, "peerDependencies": { "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0", "typescript": ">=4.8.4 <6.0.0" } }, "sha512-klQbnPAAiGYFyI02+znpBRLyjL4/BrBd0nyWkdC0s/6xFLkXYQ8OoRrSkqacS1ddVxf/LDyODIKbQ5TgKAf/Fg=="],462
1831 unmodified lines
modified:package.json+1 added
659 unmodified lines
660 "@hono/node-server": "^1.13.5",661 "@types/glob": "^9.0.0",662 "@types/jsdom": "^21.1.7",663 "@types/node": "^24.3.0",664 "@types/ws": "^8.18.1",665 "@typescript/native-preview": "7.0.0-dev.20260210.1",666 "@vitest/coverage-v8": "^3.2.4",667 "arg": "^5.0.2",668 "bun-types": "^1.2.20",
24 unmodified lines
added:tsconfig.base.json+15 added
1{2 "compilerOptions": {3 "composite": true,4 "target": "ES2022",5 "declaration": true,6 "moduleResolution": "Bundler",7 "outDir": "${configDir}/dist",8 "esModuleInterop": true,9 "forceConsistentCasingInFileNames": true,10 "strict": true,11 "skipLibCheck": true,12 "noUnusedLocals": false,13 "noUnusedParameters": false14 }15}
modified:tsconfig.build.json+1 added-1 removed
1{2 "extends": "./tsconfig.json",2 "extends": "./tsconfig.base.json",3 "compilerOptions": {4 "module": "ES2020",5 "rootDir": "./src/",6 "outDir": "./dist/types/",
17 unmodified lines
modified:tsconfig.json+10 added-28 removed
1{2 "compilerOptions": {3 "target": "ES2022",4 "declaration": true,5 "moduleResolution": "Bundler",6 "outDir": "./dist",7 "esModuleInterop": true,8 "forceConsistentCasingInFileNames": true,9 "strict": true,10 "skipLibCheck": true,11 "noUnusedLocals": false,12 "noUnusedParameters": false,13 "types": [14 "node",15 "vitest/globals"16 ],17 "jsx": "react",18 "jsxFactory": "jsx",19 "jsxFragmentFactory": "Fragment"20 },21 "include": [22 "src/**/*.ts",23 "src/**/*.d.ts",24 "src/**/*.mts",25 "src/**/*.test.ts",26 "src/**/*.test.tsx"27 ],28 "exclude": [29 "node_modules/*"2 "files": [],3 "references": [4 { "path": "./tsconfig.build.json" },5 { "path": "./perf-measures/type-check/scripts/tsconfig.json" },6 { "path": "./runtime-tests/bun/tsconfig.json" },7 { "path": "./runtime-tests/fastly/tsconfig.json" },8 { "path": "./runtime-tests/lambda/tsconfig.json" },9 { "path": "./runtime-tests/lambda-edge/tsconfig.json" },10 { "path": "./runtime-tests/node/tsconfig.json" },11 { "path": "./runtime-tests/workerd/tsconfig.json" },12 ]13}