Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/codspeed.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:

- run: pnpm i

- uses: CodSpeedHQ/action@v4
- uses: CodSpeedHQ/action@v5
with:
mode: simulation
run: pnpm run bench
2 changes: 1 addition & 1 deletion benches/__shared__/client-server.fetch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
toStandardLazyResponse,
} from '@standard-server/fetch'

import type { ClientServer } from './client-server.ts'
import type { ClientServer } from './client-server'

export function createFetchClientServer(): ClientServer {
const clientServer: ClientServer = {
Expand Down
2 changes: 1 addition & 1 deletion benches/__shared__/client-server.node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import type { AddressInfo } from 'node:net'
import { toFetchBody, toFetchHeaders, toStandardLazyResponse } from '@standard-server/fetch'
import { sendStandardResponse, toStandardLazyRequest } from '@standard-server/node'

import type { ClientServer } from './client-server.ts'
import type { ClientServer } from './client-server'

export function createNodeClientServer(): ClientServer {
const clientServer: ClientServer = {
Expand Down
2 changes: 1 addition & 1 deletion benches/__shared__/client-server.peer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
ServerPeer,
} from '@standard-server/peer'

import type { ClientServer } from './client-server.ts'
import type { ClientServer } from './client-server'

export function createPeerClientServer(): ClientServer {
const clientServer: ClientServer = {
Expand Down
10 changes: 5 additions & 5 deletions benches/e2e.bench.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { bench, describe } from 'vitest'

import { createFetchClientServer } from './__shared__/client-server.fetch.ts'
import { createNodeClientServer } from './__shared__/client-server.node.ts'
import { createPeerClientServer } from './__shared__/client-server.peer.ts'
import { echoHandler, roundTrip } from './__shared__/client-server.ts'
import { echoHandler, roundTrip } from './__shared__/client-server'
import { createFetchClientServer } from './__shared__/client-server.fetch'
import { createNodeClientServer } from './__shared__/client-server.node'
import { createPeerClientServer } from './__shared__/client-server.peer'
import {
asAsyncIteratorObject,
asReadableStream,
Expand All @@ -13,7 +13,7 @@ import {
FORM_10KB,
JSON_10KB,
USP_10KB,
} from './__shared__/payloads.ts'
} from './__shared__/payloads'

const adapters = [
['node-adapter', createNodeClientServer],
Expand Down
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,14 @@
"express4": "npm:express@^4.22.3",
"fastify": "^5.12.5",
"h3": "2.0.2",
"oxfmt": "^0.76.0",
"oxlint": "^1.91.0",
"oxlint-tsgolint": "^7.0.2005",
"oxfmt": "^0.77.0",
"oxlint": "^1.92.0",
"oxlint-tsgolint": "^7.0.2006",
"pkg-pr-new": "^0.0.91",
"selfsigned": "^5.5.0",
"sherif": "^1.13.0",
"srvx": "^1.0.5",
"tsdown": "^0.23.7",
"typescript": "^7.0.2",
"vitest": "^4.1.10",
"ws": "^8.22.0"
Expand Down
2 changes: 1 addition & 1 deletion packages/aws-lambda/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
}
},
"scripts": {
"prepack": "tsc"
"prepack": "tsdown"
},
"dependencies": {
"@standard-server/core": "workspace:*",
Expand Down
4 changes: 2 additions & 2 deletions packages/aws-lambda/src/body.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import { Buffer } from 'node:buffer'

import type { AsyncIteratorClass } from '@standard-server/shared'

import { toStandardBody } from './body.ts'
import type { AnyAPIGatewayProxyEvent, APIGatewayProxyEvent } from './types.ts'
import { toStandardBody } from './body'
import type { AnyAPIGatewayProxyEvent, APIGatewayProxyEvent } from './types'

function event(override: Partial<APIGatewayProxyEvent>): APIGatewayProxyEvent {
return {
Expand Down
4 changes: 2 additions & 2 deletions packages/aws-lambda/src/body.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import {
import { toAsyncIteratorObject } from '@standard-server/fetch'
import { parseEmptyableJSON } from '@standard-server/shared'

import { toStandardHeaders } from './headers.ts'
import type { AnyAPIGatewayProxyEvent } from './types.ts'
import { toStandardHeaders } from './headers'
import type { AnyAPIGatewayProxyEvent } from './types'

export interface ToStandardBodyOptions {
/**
Expand Down
2 changes: 1 addition & 1 deletion packages/aws-lambda/src/headers.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { toLambdaHeaders, toStandardHeaders } from './headers.ts'
import { toLambdaHeaders, toStandardHeaders } from './headers'

describe('toStandardHeaders (v2)', () => {
it('lowercases keys and restores the cookie header', () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/aws-lambda/src/headers.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { StandardHeaders } from '@standard-server/core'
import { toArray } from '@standard-server/shared'

import type { AnyAPIGatewayProxyEvent } from './types.ts'
import type { AnyAPIGatewayProxyEvent } from './types'

/**
* Convert API Gateway proxy event headers to standard headers.
Expand Down
2 changes: 1 addition & 1 deletion packages/aws-lambda/src/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as index from './index.ts'
import * as index from './index'

it('export something', () => {
expect(Object.keys(index).length).toBeGreaterThan(0)
Expand Down
12 changes: 6 additions & 6 deletions packages/aws-lambda/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export * from './body.ts'
export * from './headers.ts'
export * from './request.ts'
export * from './response.ts'
export * from './types.ts'
export * from './url.ts'
export * from './body'
export * from './headers'
export * from './request'
export * from './response'
export * from './types'
export * from './url'
10 changes: 5 additions & 5 deletions packages/aws-lambda/src/request.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ import Stream from 'node:stream'

import * as StandardServerNode from '@standard-server/node'

import * as Body from './body.ts'
import * as Headers from './headers.ts'
import { toStandardLazyRequest } from './request.ts'
import type { APIGatewayProxyEvent, APIGatewayProxyEventV2, HttpResponseStream } from './types.ts'
import * as Url from './url.ts'
import * as Body from './body'
import * as Headers from './headers'
import { toStandardLazyRequest } from './request'
import type { APIGatewayProxyEvent, APIGatewayProxyEventV2, HttpResponseStream } from './types'
import * as Url from './url'

const toStandardBodySpy = vi.spyOn(Body, 'toStandardBody')
const toStandardHeadersSpy = vi.spyOn(Headers, 'toStandardHeaders')
Expand Down
8 changes: 4 additions & 4 deletions packages/aws-lambda/src/request.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import type { StandardLazyRequest } from '@standard-server/core'
import { toAbortSignal } from '@standard-server/node'

import { toStandardBody } from './body.ts'
import { toStandardHeaders } from './headers.ts'
import type { AnyAPIGatewayProxyEvent, HttpResponseStream } from './types.ts'
import { toStandardUrl } from './url.ts'
import { toStandardBody } from './body'
import { toStandardHeaders } from './headers'
import type { AnyAPIGatewayProxyEvent, HttpResponseStream } from './types'
import { toStandardUrl } from './url'

/**
* Convert an API Gateway proxy event to a standard lazy request.
Expand Down
4 changes: 2 additions & 2 deletions packages/aws-lambda/src/response.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import Stream from 'node:stream'
import type { StandardResponse } from '@standard-server/core'
import * as StandardServerNode from '@standard-server/node'

import { sendStandardResponse } from './response.ts'
import type { HttpResponseStream } from './types.ts'
import { sendStandardResponse } from './response'
import type { HttpResponseStream } from './types'

const toNodeHttpBodySpy = vi.spyOn(StandardServerNode, 'toNodeHttpBody')

Expand Down
4 changes: 2 additions & 2 deletions packages/aws-lambda/src/response.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import {
toNodeHttpBody,
} from '@standard-server/node'

import { toLambdaHeaders } from './headers.ts'
import type { AwsLambdaGlobal, HttpResponseStream } from './types.ts'
import { toLambdaHeaders } from './headers'
import type { AwsLambdaGlobal, HttpResponseStream } from './types'

/**
* Injected by the Lambda runtime when response streaming is enabled.
Expand Down
2 changes: 1 addition & 1 deletion packages/aws-lambda/src/types.test-d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import type {
APIGatewayProxyEvent,
APIGatewayProxyEventV2,
HttpResponseStream,
} from './types.ts'
} from './types'

it('APIGatewayProxyEvent', () => {
expectTypeOf<awsLambda.APIGatewayProxyEvent>().toExtend<APIGatewayProxyEvent>()
Expand Down
2 changes: 1 addition & 1 deletion packages/aws-lambda/src/url.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { toStandardUrl } from './url.ts'
import { toStandardUrl } from './url'

describe('toStandardUrl (v2)', () => {
it('works without query string', () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/aws-lambda/src/url.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { StandardUrl } from '@standard-server/core'
import { safeEncodeURIComponent } from '@standard-server/shared'

import type { AnyAPIGatewayProxyEvent } from './types.ts'
import type { AnyAPIGatewayProxyEvent } from './types'

const UNENCODED_PATH_CHAR_RE = /[\0-\x20"#<>?^`{}\x7F-\u{10FFFF}]/gu

Expand Down
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
}
},
"scripts": {
"prepack": "tsc"
"prepack": "tsdown"
},
"dependencies": {
"@standard-server/shared": "workspace:*"
Expand Down
10 changes: 3 additions & 7 deletions packages/core/src/event-stream/decoder.test.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
import {
decodeEventStreamMessage,
EventStreamDecoder,
EventStreamDecoderStream,
} from './decoder.ts'
import type { EventStreamMessage } from './types.ts'
import { decodeEventStreamMessage, EventStreamDecoder, EventStreamDecoderStream } from './decoder'
import type { EventStreamMessage } from './types'

function feedAll(chunks: string[]): EventStreamMessage[] {
const events: EventStreamMessage[] = []
Expand Down Expand Up @@ -457,7 +453,7 @@ describe('eventStreamDecoderStream', () => {
vi.resetModules()
})

const module = await import('./decoder.ts')
const module = await import('./decoder')

expect(module.EventStreamDecoderStream).toBeDefined()
expect(module.decodeEventStreamMessage('data: hello\n\n')).toEqual({
Expand Down
6 changes: 3 additions & 3 deletions packages/core/src/event-stream/decoder.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { isEventStreamMessageId, isEventStreamMessageRetry } from './encoder.ts'
import { EventStreamDecoderError } from './error.ts'
import type { EventStreamMessage } from './types.ts'
import { isEventStreamMessageId, isEventStreamMessageRetry } from './encoder'
import { EventStreamDecoderError } from './error'
import type { EventStreamMessage } from './types'

// A line ending is CR, LF or CRLF.
const LINE_ENDING_REGEX = /\r\n?|\n/
Expand Down
6 changes: 3 additions & 3 deletions packages/core/src/event-stream/encoder.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { decodeEventStreamMessage } from './decoder.ts'
import { decodeEventStreamMessage } from './decoder'
import {
assertEventStreamMessageComment,
assertEventStreamMessageId,
Expand All @@ -10,8 +10,8 @@ import {
isEventStreamMessageComment,
isEventStreamMessageId,
isEventStreamMessageRetry,
} from './encoder.ts'
import type { EventStreamMessage } from './types.ts'
} from './encoder'
import type { EventStreamMessage } from './types'

describe('predicates', () => {
it('accept valid values', () => {
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/event-stream/encoder.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { EventStreamEncoderError } from './error.ts'
import type { EventStreamMessage } from './types.ts'
import { EventStreamEncoderError } from './error'
import type { EventStreamMessage } from './types'

const EVENT_STREAM_LINE_ENDING_REGEX = /\r\n|[\n\r]/
const EVENT_STREAM_LINE_ENDING_GLOBAL_REGEX = /\r\n|[\n\r]/g
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/event-stream/error.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { EventStreamErrorEvent } from './error.ts'
import { EventStreamErrorEvent } from './error'

it('errorEvent', () => {
const errorEvent = new EventStreamErrorEvent('data', { cause: 'cause' })
Expand Down
10 changes: 5 additions & 5 deletions packages/core/src/event-stream/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export * from './decoder.ts'
export * from './encoder.ts'
export * from './error.ts'
export * from './meta.ts'
export * from './types.ts'
export * from './decoder'
export * from './encoder'
export * from './error'
export * from './meta'
export * from './types'
2 changes: 1 addition & 1 deletion packages/core/src/event-stream/meta.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { getEventMeta, unwrapEvent, withEventMeta } from './meta.ts'
import { getEventMeta, unwrapEvent, withEventMeta } from './meta'

it('get/withEventMeta', () => {
const data = { value: 123, meta: undefined }
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/event-stream/meta.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import {
assertEventStreamMessageComment,
assertEventStreamMessageId,
assertEventStreamMessageRetry,
} from './encoder.ts'
import type { EventMeta } from './types.ts'
} from './encoder'
import type { EventMeta } from './types'

const EVENT_META_SYMBOL = Symbol.for('STANDARD_SERVER_EVENT_META')
const EVENT_SOURCE_SYMBOL = Symbol.for('STANDARD_SERVER_EVENT_SOURCE')
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as index from './index.ts'
import * as index from './index'

it('export something', () => {
expect(Object.keys(index).length).toBeGreaterThan(0)
Expand Down
8 changes: 4 additions & 4 deletions packages/core/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export * from './event-stream/index.ts'
export * from './types.ts'
export * from './utils.ts'
export * from './validators.ts'
export * from './event-stream/index'
export * from './types'
export * from './utils'
export * from './validators'
2 changes: 1 addition & 1 deletion packages/core/src/utils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
mergeStandardHeaders,
parseStandardUrl,
resolveStandardBodyHint,
} from './utils.ts'
} from './utils'

beforeEach(() => {
vi.clearAllMocks()
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
toArray,
} from '@standard-server/shared'

import type { StandardBody, StandardBodyHint, StandardHeaders, StandardUrl } from './types.ts'
import type { StandardBody, StandardBodyHint, StandardHeaders, StandardUrl } from './types'

const FALLBACK_FILENAME_UNSAFE_CHAR_REGEX = /[^\x20-\x7E]|[;=]/g
const QUOTED_STRING_SPECIAL_CHAR_REGEX = /[\\"]/g
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/validators.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
isStandardResponse,
isStandardStatus,
isStandardUrl,
} from './validators.ts'
} from './validators'

describe('isStandardMethod', () => {
it('accepts standard & custom HTTP verbs', () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/validators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import type {
StandardRequest,
StandardResponse,
StandardUrl,
} from './types.ts'
} from './types'

export function isStandardMethod(maybe: unknown): maybe is StandardMethod {
return typeof maybe === 'string'
Expand Down
2 changes: 1 addition & 1 deletion packages/fastify/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
}
},
"scripts": {
"prepack": "tsc"
"prepack": "tsdown"
},
"dependencies": {
"@standard-server/core": "workspace:*",
Expand Down
2 changes: 1 addition & 1 deletion packages/fastify/src/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as index from './index.ts'
import * as index from './index'

it('export something', () => {
expect(Object.keys(index).length).toBeGreaterThan(0)
Expand Down
6 changes: 3 additions & 3 deletions packages/fastify/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export * from './request.ts'
export * from './response.ts'
export * from './types.ts'
export * from './request'
export * from './response'
export * from './types'
Loading
Loading