From ce120d7e36b786d09d144a1e2efd0455ce2aeb43 Mon Sep 17 00:00:00 2001 From: Dinh Le Date: Sun, 6 Sep 2026 15:17:18 +0700 Subject: [PATCH 1/2] chore: rename packages to `@standard-server/*` and drop the homepage domain The npm scope moves from `@standardserver` to `@standard-server` across every manifest, import, test, bench, playground, README, and the lockfile. The project no longer has a website, so the `homepage` field is removed from all manifests and the playground READMEs link to the GitHub repository instead. Repository URLs and README badges now point at `middleapi/standard-server`, matching the actual GitHub slug (the manifests still referenced the old `middleapi/standardserver` path). --- benches/__shared__/client-server.fetch.ts | 2 +- benches/__shared__/client-server.node.ts | 4 +- benches/__shared__/client-server.peer.ts | 2 +- benches/__shared__/client-server.ts | 4 +- benches/__shared__/payloads.ts | 2 +- benches/event-stream.bench.ts | 2 +- package.json | 14 ++-- packages/aws-lambda/README.md | 50 ++++++------- packages/aws-lambda/package.json | 15 ++-- packages/aws-lambda/src/body.test.ts | 2 +- packages/aws-lambda/src/body.ts | 8 +-- packages/aws-lambda/src/headers.ts | 4 +- packages/aws-lambda/src/request.test.ts | 2 +- packages/aws-lambda/src/request.ts | 4 +- packages/aws-lambda/src/response.test.ts | 4 +- packages/aws-lambda/src/response.ts | 6 +- packages/aws-lambda/src/url.ts | 2 +- packages/core/README.md | 76 ++++++++++---------- packages/core/package.json | 9 ++- packages/core/src/event-stream/meta.ts | 2 +- packages/core/src/utils.ts | 2 +- packages/core/src/validators.ts | 2 +- packages/fastify/README.md | 52 +++++++------- packages/fastify/package.json | 11 ++- packages/fastify/src/request.test.ts | 4 +- packages/fastify/src/request.ts | 4 +- packages/fastify/src/response.test.ts | 2 +- packages/fastify/src/response.ts | 6 +- packages/fastify/src/types.test-d.ts | 6 +- packages/fastify/tests/http2.test.ts | 2 +- packages/fetch/README.md | 54 +++++++------- packages/fetch/package.json | 11 ++- packages/fetch/src/body.test.ts | 4 +- packages/fetch/src/body.ts | 6 +- packages/fetch/src/event-stream.test.ts | 4 +- packages/fetch/src/event-stream.ts | 4 +- packages/fetch/src/headers.test.ts | 2 +- packages/fetch/src/headers.ts | 2 +- packages/fetch/src/request.ts | 2 +- packages/fetch/src/response.test.ts | 2 +- packages/fetch/src/response.ts | 2 +- packages/fetch/src/url.ts | 2 +- packages/node/README.md | 50 ++++++------- packages/node/package.json | 13 ++-- packages/node/src/body.test.ts | 8 +-- packages/node/src/body.ts | 6 +- packages/node/src/event-stream.test.ts | 4 +- packages/node/src/event-stream.ts | 6 +- packages/node/src/method.ts | 2 +- packages/node/src/request.test.ts | 2 +- packages/node/src/request.ts | 2 +- packages/node/src/response.test.ts | 2 +- packages/node/src/response.ts | 2 +- packages/node/src/signal.test.ts | 2 +- packages/node/src/signal.ts | 2 +- packages/node/src/url.ts | 4 +- packages/peer/README.md | 48 ++++++------- packages/peer/package.json | 11 ++- packages/peer/src/body.test.ts | 6 +- packages/peer/src/body.ts | 8 +-- packages/peer/src/client.test.ts | 4 +- packages/peer/src/client.ts | 6 +- packages/peer/src/codec.ts | 2 +- packages/peer/src/event-stream.test.ts | 4 +- packages/peer/src/event-stream.ts | 6 +- packages/peer/src/hibernation.test.ts | 2 +- packages/peer/src/hibernation.ts | 2 +- packages/peer/src/octet-stream.test.ts | 2 +- packages/peer/src/octet-stream.ts | 2 +- packages/peer/src/server.test.ts | 4 +- packages/peer/src/server.ts | 6 +- packages/peer/src/types.ts | 2 +- packages/peer/src/validators.ts | 4 +- packages/peer/tests/peer.test.ts | 4 +- packages/shared/README.md | 44 ++++++------ packages/shared/package.json | 7 +- playgrounds/hono-node/README.md | 4 +- playgrounds/hono-node/package.json | 6 +- playgrounds/hono-node/src/main.ts | 4 +- playgrounds/node-http/README.md | 4 +- playgrounds/node-http/package.json | 6 +- playgrounds/node-http/src/main.ts | 4 +- pnpm-lock.yaml | 64 ++++++++--------- tests/bun/README.md | 2 +- tests/bun/package.json | 13 ++-- tests/bun/tests/client-server.bun-fetch.ts | 2 +- tests/bun/tests/client-server.bun-ws.ts | 2 +- tests/bun/tests/client-server.ts | 4 +- tests/bun/tests/data-transfer.test.ts | 6 +- tests/bun/tests/signal-and-cancel.test.ts | 2 +- tests/client-server.expressjs.ts | 4 +- tests/client-server.fastify.ts | 4 +- tests/client-server.h3-node-handler.ts | 4 +- tests/client-server.h3-web-handler.ts | 2 +- tests/client-server.hono-fetch.ts | 2 +- tests/client-server.inprogress-fetch.ts | 2 +- tests/client-server.message-port.ts | 2 +- tests/client-server.node-fetch-server.ts | 2 +- tests/client-server.node-http.ts | 4 +- tests/client-server.node-http2.ts | 4 +- tests/client-server.node-https.ts | 4 +- tests/client-server.node-srvx.ts | 2 +- tests/client-server.node-ws.ts | 2 +- tests/client-server.peer.ts | 8 +-- tests/client-server.ts | 4 +- tests/data-transfer.test.ts | 4 +- tests/deno/README.md | 2 +- tests/deno/package.json | 13 ++-- tests/deno/tests/client-server.deno-fetch.ts | 2 +- tests/deno/tests/client-server.deno-ws.ts | 2 +- tests/deno/tests/client-server.ts | 4 +- tests/deno/tests/data-transfer.test.ts | 6 +- tests/deno/tests/signal-and-cancel.test.ts | 2 +- tests/signal-and-cancel.test.ts | 2 +- 114 files changed, 440 insertions(+), 449 deletions(-) diff --git a/benches/__shared__/client-server.fetch.ts b/benches/__shared__/client-server.fetch.ts index 93576ff..ce012d3 100644 --- a/benches/__shared__/client-server.fetch.ts +++ b/benches/__shared__/client-server.fetch.ts @@ -1,5 +1,5 @@ import type { ClientServer } from './client-server' -import { toFetchBody, toFetchHeaders, toFetchResponse, toStandardLazyRequest, toStandardLazyResponse } from '@standardserver/fetch' +import { toFetchBody, toFetchHeaders, toFetchResponse, toStandardLazyRequest, toStandardLazyResponse } from '@standard-server/fetch' export function createFetchClientServer(): ClientServer { const clientServer: ClientServer = { diff --git a/benches/__shared__/client-server.node.ts b/benches/__shared__/client-server.node.ts index 711afd2..04264c6 100644 --- a/benches/__shared__/client-server.node.ts +++ b/benches/__shared__/client-server.node.ts @@ -1,8 +1,8 @@ import type { AddressInfo } from 'node:net' import type { ClientServer } from './client-server' import * as http from 'node:http' -import { toFetchBody, toFetchHeaders, toStandardLazyResponse } from '@standardserver/fetch' -import { sendStandardResponse, toStandardLazyRequest } from '@standardserver/node' +import { toFetchBody, toFetchHeaders, toStandardLazyResponse } from '@standard-server/fetch' +import { sendStandardResponse, toStandardLazyRequest } from '@standard-server/node' export function createNodeClientServer(): ClientServer { const clientServer: ClientServer = { diff --git a/benches/__shared__/client-server.peer.ts b/benches/__shared__/client-server.peer.ts index c248ed7..303ecbf 100644 --- a/benches/__shared__/client-server.peer.ts +++ b/benches/__shared__/client-server.peer.ts @@ -1,5 +1,5 @@ import type { ClientServer } from './client-server' -import { ClientPeer, decodePeerMessage, encodePeerMessage, isClientPeerSendMessage, isServerPeerSendMessage, ServerPeer } from '@standardserver/peer' +import { ClientPeer, decodePeerMessage, encodePeerMessage, isClientPeerSendMessage, isServerPeerSendMessage, ServerPeer } from '@standard-server/peer' export function createPeerClientServer(): ClientServer { let clientPeer: ClientPeer diff --git a/benches/__shared__/client-server.ts b/benches/__shared__/client-server.ts index 8716013..d382271 100644 --- a/benches/__shared__/client-server.ts +++ b/benches/__shared__/client-server.ts @@ -1,5 +1,5 @@ -import type { StandardLazyRequest, StandardLazyResponse, StandardRequest, StandardResponse } from '@standardserver/core' -import { isAsyncIteratorObject } from '@standardserver/shared' +import type { StandardLazyRequest, StandardLazyResponse, StandardRequest, StandardResponse } from '@standard-server/core' +import { isAsyncIteratorObject } from '@standard-server/shared' export interface ClientServer { handler: (request: StandardLazyRequest) => Promise diff --git a/benches/__shared__/payloads.ts b/benches/__shared__/payloads.ts index 3e27a11..dec24e7 100644 --- a/benches/__shared__/payloads.ts +++ b/benches/__shared__/payloads.ts @@ -1,4 +1,4 @@ -import { stringifyJSON } from '@standardserver/shared' +import { stringifyJSON } from '@standard-server/shared' const SIZE_1KB = 1024 const SIZE_10KB = 10 * SIZE_1KB diff --git a/benches/event-stream.bench.ts b/benches/event-stream.bench.ts index ea83e92..64c4e81 100644 --- a/benches/event-stream.bench.ts +++ b/benches/event-stream.bench.ts @@ -1,4 +1,4 @@ -import { decodeEventStreamMessage, encodeEventStreamMessage, EventStreamDecoder } from '@standardserver/core' +import { decodeEventStreamMessage, encodeEventStreamMessage, EventStreamDecoder } from '@standard-server/core' import { bench, describe } from 'vitest' const SIZE_1KB = 1024 diff --git a/package.json b/package.json index b7ae504..86e0d11 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "@standardserver/repo", + "name": "@standard-server/repo", "type": "module", "version": "0.8.3", "private": true, @@ -27,12 +27,12 @@ "@codspeed/vitest-plugin": "^5.7.1", "@hono/node-server": "^2.0.12", "@remix-run/node-fetch-server": "^0.14.0", - "@standardserver/core": "workspace:*", - "@standardserver/fastify": "workspace:*", - "@standardserver/fetch": "workspace:*", - "@standardserver/node": "workspace:*", - "@standardserver/peer": "workspace:*", - "@standardserver/shared": "workspace:*", + "@standard-server/core": "workspace:*", + "@standard-server/fastify": "workspace:*", + "@standard-server/fetch": "workspace:*", + "@standard-server/node": "workspace:*", + "@standard-server/peer": "workspace:*", + "@standard-server/shared": "workspace:*", "@types/express": "^5.0.6", "@types/node": "^26.4.1", "@types/ws": "^8.18.1", diff --git a/packages/aws-lambda/README.md b/packages/aws-lambda/README.md index 198f02e..d766da3 100644 --- a/packages/aws-lambda/README.md +++ b/packages/aws-lambda/README.md @@ -1,41 +1,41 @@ -# @standardserver/aws-lambda +# @standard-server/aws-lambda
- - codecov + + codecov - - weekly downloads + + weekly downloads - + CodSpeed - - MIT License + + MIT License Discord - + Ask DeepWiki
-`@standardserver/aws-lambda` adapts AWS Lambda events and response streams to the transport-agnostic request and response model defined by Standard Server. +`@standard-server/aws-lambda` adapts AWS Lambda events and response streams to the transport-agnostic request and response model defined by Standard Server. Standard Server provides a unified interface for client-server communication across HTTP and message-based transports. It lets you write handlers against the same request, response, body, and streaming primitives whether the underlying transport is the Fetch API, Node.js HTTP, HTTP/2, or a peer-style message channel. Standard Server ships as a small ecosystem of packages: -| Package | Description | -| ------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------- | -| [`@standardserver/core`](https://github.com/middleapi/standardserver/blob/main/packages/core/README.md) | The shared contract: types, body parsing rules, validators, and SSE helpers | -| [`@standardserver/fetch`](https://github.com/middleapi/standardserver/blob/main/packages/fetch/README.md) | Fetch API adapter for browsers, workers, and other Fetch-based runtimes | -| [`@standardserver/node`](https://github.com/middleapi/standardserver/blob/main/packages/node/README.md) | Node.js HTTP and HTTP/2 adapter | -| [`@standardserver/fastify`](https://github.com/middleapi/standardserver/blob/main/packages/fastify/README.md) | Fastify adapter built on the Node.js adapter | -| [`@standardserver/aws-lambda`](https://github.com/middleapi/standardserver/blob/main/packages/aws-lambda/README.md) | AWS Lambda adapter with response streaming | -| [`@standardserver/peer`](https://github.com/middleapi/standardserver/blob/main/packages/peer/README.md) | Message-based adapter for WebSocket, MessagePort, and custom transports | -| [`@standardserver/shared`](https://github.com/middleapi/standardserver/blob/main/packages/shared/README.md) | Internal utilities shared across the ecosystem | +| Package | Description | +| --------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------- | +| [`@standard-server/core`](https://github.com/middleapi/standard-server/blob/main/packages/core/README.md) | The shared contract: types, body parsing rules, validators, and SSE helpers | +| [`@standard-server/fetch`](https://github.com/middleapi/standard-server/blob/main/packages/fetch/README.md) | Fetch API adapter for browsers, workers, and other Fetch-based runtimes | +| [`@standard-server/node`](https://github.com/middleapi/standard-server/blob/main/packages/node/README.md) | Node.js HTTP and HTTP/2 adapter | +| [`@standard-server/fastify`](https://github.com/middleapi/standard-server/blob/main/packages/fastify/README.md) | Fastify adapter built on the Node.js adapter | +| [`@standard-server/aws-lambda`](https://github.com/middleapi/standard-server/blob/main/packages/aws-lambda/README.md) | AWS Lambda adapter with response streaming | +| [`@standard-server/peer`](https://github.com/middleapi/standard-server/blob/main/packages/peer/README.md) | Message-based adapter for WebSocket, MessagePort, and custom transports | +| [`@standard-server/shared`](https://github.com/middleapi/standard-server/blob/main/packages/shared/README.md) | Internal utilities shared across the ecosystem | This package is the AWS Lambda adapter for that model. It converts an API Gateway proxy event — payload format version 1.0 or 2.0, the latter also used by Lambda Function URLs — into a `StandardLazyRequest`, and writes a `StandardResponse` back through the stream provided by `awslambda.streamifyResponse`, so streaming bodies such as server-sent events flow to the client as they are produced instead of being buffered. @@ -56,9 +56,9 @@ The package exposes these helpers: Use `toStandardLazyRequest()` to convert the incoming event into a `StandardLazyRequest`, then `sendStandardResponse()` to write the resulting `StandardResponse` back through the response stream. The handler must be wrapped with `awslambda.streamifyResponse`, and the function must run on the AWS Lambda Node.js runtime with response streaming enabled. ```ts -import type { AwsLambdaGlobal } from '@standardserver/aws-lambda' -import type { StandardLazyRequest, StandardResponse } from '@standardserver/core' -import { sendStandardResponse, toStandardLazyRequest } from '@standardserver/aws-lambda' +import type { AwsLambdaGlobal } from '@standard-server/aws-lambda' +import type { StandardLazyRequest, StandardResponse } from '@standard-server/core' +import { sendStandardResponse, toStandardLazyRequest } from '@standard-server/aws-lambda' // injected by the AWS Lambda Node.js runtime when response streaming is enabled declare const awslambda: AwsLambdaGlobal @@ -93,7 +93,7 @@ export const handler = awslambda.streamifyResponse(async (event, responseStream, ## Resolving Body -The event carries the request body as a fully buffered, optionally base64-encoded string. `resolveBody(hint?)` decodes it and then follows the shared Standard Server resolution rules: an explicit `hint` wins, then the [`standard-server` header](https://github.com/middleapi/standardserver/blob/main/packages/core/README.md#the-standard-server-header), then inference from the content headers. See [how body parsing works](https://github.com/middleapi/standardserver/blob/main/packages/core/README.md#how-body-parsing-works) in the core README for the full algorithm. +The event carries the request body as a fully buffered, optionally base64-encoded string. `resolveBody(hint?)` decodes it and then follows the shared Standard Server resolution rules: an explicit `hint` wins, then the [`standard-server` header](https://github.com/middleapi/standard-server/blob/main/packages/core/README.md#the-standard-server-header), then inference from the content headers. See [how body parsing works](https://github.com/middleapi/standard-server/blob/main/packages/core/README.md#how-body-parsing-works) in the core README for the full algorithm. > [!TIP] > For efficient communication, set the `standard-server` header to explicitly hint the body type, especially for file or binary streaming. For example, if you upload a file with a common `content-type` such as `application/json` but omit the `standard-server` header, the server may interpret it as JSON and parse it unexpectedly. @@ -108,7 +108,7 @@ The event carries the request body as a fully buffered, optionally base64-encode ## Learn more -For the project overview and the shared contract, see the [core documentation](https://github.com/middleapi/standardserver/blob/main/packages/core/README.md). For the Node.js primitives this adapter is built on, see the [Node.js adapter documentation](https://github.com/middleapi/standardserver/blob/main/packages/node/README.md). +For the project overview and the shared contract, see the [core documentation](https://github.com/middleapi/standard-server/blob/main/packages/core/README.md). For the Node.js primitives this adapter is built on, see the [Node.js adapter documentation](https://github.com/middleapi/standard-server/blob/main/packages/node/README.md). ## Sponsors @@ -196,4 +196,4 @@ With thanks to [36 past sponsors](https://htmlpreview.github.io/?https://github. ## License -Distributed under the MIT License. See [LICENCE](https://github.com/middleapi/standardserver/blob/main/LICENCE) for more information. +Distributed under the MIT License. See [LICENCE](https://github.com/middleapi/standard-server/blob/main/LICENCE) for more information. diff --git a/packages/aws-lambda/package.json b/packages/aws-lambda/package.json index 2d4cc4f..480ad42 100644 --- a/packages/aws-lambda/package.json +++ b/packages/aws-lambda/package.json @@ -1,5 +1,5 @@ { - "name": "@standardserver/aws-lambda", + "name": "@standard-server/aws-lambda", "type": "module", "version": "0.8.3", "description": "AWS Lambda adapter for Standard Server: transport-agnostic requests and responses with Lambda response streaming support", @@ -8,14 +8,13 @@ "https://github.com/sponsors/dinwwwh", "https://opencollective.com/middleapi" ], - "homepage": "https://standardserver.dev", "repository": { "type": "git", - "url": "git+https://github.com/middleapi/standardserver.git", + "url": "git+https://github.com/middleapi/standard-server.git", "directory": "packages/aws-lambda" }, "keywords": [ - "standardserver", + "standard-server", "aws", "lambda", "aws-lambda", @@ -51,10 +50,10 @@ "type:check": "tsc -b" }, "dependencies": { - "@standardserver/core": "workspace:*", - "@standardserver/fetch": "workspace:*", - "@standardserver/node": "workspace:*", - "@standardserver/shared": "workspace:*" + "@standard-server/core": "workspace:*", + "@standard-server/fetch": "workspace:*", + "@standard-server/node": "workspace:*", + "@standard-server/shared": "workspace:*" }, "devDependencies": { "@types/aws-lambda": "^8.10.162", diff --git a/packages/aws-lambda/src/body.test.ts b/packages/aws-lambda/src/body.test.ts index 2cb832b..748371b 100644 --- a/packages/aws-lambda/src/body.test.ts +++ b/packages/aws-lambda/src/body.test.ts @@ -1,4 +1,4 @@ -import type { AsyncIteratorClass } from '@standardserver/shared' +import type { AsyncIteratorClass } from '@standard-server/shared' import type { APIGatewayProxyEvent } from './types' import { Buffer } from 'node:buffer' import { toStandardBody } from './body' diff --git a/packages/aws-lambda/src/body.ts b/packages/aws-lambda/src/body.ts index 69e4f50..6142ba4 100644 --- a/packages/aws-lambda/src/body.ts +++ b/packages/aws-lambda/src/body.ts @@ -1,9 +1,9 @@ -import type { StandardBody, StandardBodyHint } from '@standardserver/core' +import type { StandardBody, StandardBodyHint } from '@standard-server/core' import type { AnyAPIGatewayProxyEvent } from './types' import { Buffer } from 'node:buffer' -import { flattenStandardHeader, getFilenameFromContentDisposition, resolveStandardBodyHint } from '@standardserver/core' -import { toAsyncIteratorObject } from '@standardserver/fetch' -import { parseEmptyableJSON } from '@standardserver/shared' +import { flattenStandardHeader, getFilenameFromContentDisposition, resolveStandardBodyHint } from '@standard-server/core' +import { toAsyncIteratorObject } from '@standard-server/fetch' +import { parseEmptyableJSON } from '@standard-server/shared' import { getEventHeader } from './headers' export interface ToStandardBodyOptions { diff --git a/packages/aws-lambda/src/headers.ts b/packages/aws-lambda/src/headers.ts index d4f3ec0..6dfdb07 100644 --- a/packages/aws-lambda/src/headers.ts +++ b/packages/aws-lambda/src/headers.ts @@ -1,6 +1,6 @@ -import type { StandardHeaders } from '@standardserver/core' +import type { StandardHeaders } from '@standard-server/core' import type { AnyAPIGatewayProxyEvent } from './types' -import { toArray } from '@standardserver/shared' +import { toArray } from '@standard-server/shared' /** * Convert API Gateway proxy event headers to standard headers. diff --git a/packages/aws-lambda/src/request.test.ts b/packages/aws-lambda/src/request.test.ts index 8b8d760..cbf6a3d 100644 --- a/packages/aws-lambda/src/request.test.ts +++ b/packages/aws-lambda/src/request.test.ts @@ -1,6 +1,6 @@ import type { APIGatewayProxyEvent, APIGatewayProxyEventV2, HttpResponseStream } from './types' import Stream from 'node:stream' -import * as StandardServerNode from '@standardserver/node' +import * as StandardServerNode from '@standard-server/node' import * as Body from './body' import * as Headers from './headers' import { toStandardLazyRequest } from './request' diff --git a/packages/aws-lambda/src/request.ts b/packages/aws-lambda/src/request.ts index 96a0579..5204943 100644 --- a/packages/aws-lambda/src/request.ts +++ b/packages/aws-lambda/src/request.ts @@ -1,6 +1,6 @@ -import type { StandardLazyRequest } from '@standardserver/core' +import type { StandardLazyRequest } from '@standard-server/core' import type { AnyAPIGatewayProxyEvent, HttpResponseStream } from './types' -import { toAbortSignal } from '@standardserver/node' +import { toAbortSignal } from '@standard-server/node' import { toStandardBody } from './body' import { toStandardHeaders } from './headers' import { toStandardUrl } from './url' diff --git a/packages/aws-lambda/src/response.test.ts b/packages/aws-lambda/src/response.test.ts index df8b52b..1d0c859 100644 --- a/packages/aws-lambda/src/response.test.ts +++ b/packages/aws-lambda/src/response.test.ts @@ -1,8 +1,8 @@ -import type { StandardResponse } from '@standardserver/core' +import type { StandardResponse } from '@standard-server/core' import type { HttpResponseStream } from './types' import { Buffer } from 'node:buffer' import Stream from 'node:stream' -import * as StandardServerNode from '@standardserver/node' +import * as StandardServerNode from '@standard-server/node' import { sendStandardResponse } from './response' const toNodeHttpBodySpy = vi.spyOn(StandardServerNode, 'toNodeHttpBody') diff --git a/packages/aws-lambda/src/response.ts b/packages/aws-lambda/src/response.ts index 767d131..f31912f 100644 --- a/packages/aws-lambda/src/response.ts +++ b/packages/aws-lambda/src/response.ts @@ -1,7 +1,7 @@ -import type { StandardResponse } from '@standardserver/core' -import type { ToNodeHttpBodyOptions } from '@standardserver/node' +import type { StandardResponse } from '@standard-server/core' +import type { ToNodeHttpBodyOptions } from '@standard-server/node' import type { AwsLambdaGlobal, HttpResponseStream } from './types' -import { canWriteToNodeResponse, getNodeResponseError, toNodeHttpBody } from '@standardserver/node' +import { canWriteToNodeResponse, getNodeResponseError, toNodeHttpBody } from '@standard-server/node' import { toLambdaHeaders } from './headers' /** diff --git a/packages/aws-lambda/src/url.ts b/packages/aws-lambda/src/url.ts index 053427c..41b4cc6 100644 --- a/packages/aws-lambda/src/url.ts +++ b/packages/aws-lambda/src/url.ts @@ -1,4 +1,4 @@ -import type { StandardUrl } from '@standardserver/core' +import type { StandardUrl } from '@standard-server/core' import type { AnyAPIGatewayProxyEvent } from './types' /** diff --git a/packages/core/README.md b/packages/core/README.md index 9d11c2d..64bf081 100644 --- a/packages/core/README.md +++ b/packages/core/README.md @@ -1,39 +1,39 @@ # Standard Server
- - codecov + + codecov - - weekly downloads + + weekly downloads - + CodSpeed - - MIT License + + MIT License Discord - + Ask DeepWiki
-`@standardserver/core` is the shared contract package for **Standard Server** — a unified interface for client-server communication across HTTP and message-based transports. It lets you keep handler and client code transport-agnostic by working with the same request, response, body, and streaming abstractions whether the transport is Fetch, Node.js HTTP, or a peer-style message channel. +`@standard-server/core` is the shared contract package for **Standard Server** — a unified interface for client-server communication across HTTP and message-based transports. It lets you keep handler and client code transport-agnostic by working with the same request, response, body, and streaming abstractions whether the transport is Fetch, Node.js HTTP, or a peer-style message channel. Standard Server ships as a small ecosystem of packages: -| Package | Description | -| ------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------- | -| [`@standardserver/core`](https://github.com/middleapi/standardserver/blob/main/packages/core/README.md) | The shared contract: types, body parsing rules, validators, and SSE helpers | -| [`@standardserver/fetch`](https://github.com/middleapi/standardserver/blob/main/packages/fetch/README.md) | Fetch API adapter for browsers, workers, and other Fetch-based runtimes | -| [`@standardserver/node`](https://github.com/middleapi/standardserver/blob/main/packages/node/README.md) | Node.js HTTP and HTTP/2 adapter | -| [`@standardserver/fastify`](https://github.com/middleapi/standardserver/blob/main/packages/fastify/README.md) | Fastify adapter built on the Node.js adapter | -| [`@standardserver/aws-lambda`](https://github.com/middleapi/standardserver/blob/main/packages/aws-lambda/README.md) | AWS Lambda adapter with response streaming | -| [`@standardserver/peer`](https://github.com/middleapi/standardserver/blob/main/packages/peer/README.md) | Message-based adapter for WebSocket, MessagePort, and custom transports | -| [`@standardserver/shared`](https://github.com/middleapi/standardserver/blob/main/packages/shared/README.md) | Internal utilities shared across the ecosystem | +| Package | Description | +| --------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------- | +| [`@standard-server/core`](https://github.com/middleapi/standard-server/blob/main/packages/core/README.md) | The shared contract: types, body parsing rules, validators, and SSE helpers | +| [`@standard-server/fetch`](https://github.com/middleapi/standard-server/blob/main/packages/fetch/README.md) | Fetch API adapter for browsers, workers, and other Fetch-based runtimes | +| [`@standard-server/node`](https://github.com/middleapi/standard-server/blob/main/packages/node/README.md) | Node.js HTTP and HTTP/2 adapter | +| [`@standard-server/fastify`](https://github.com/middleapi/standard-server/blob/main/packages/fastify/README.md) | Fastify adapter built on the Node.js adapter | +| [`@standard-server/aws-lambda`](https://github.com/middleapi/standard-server/blob/main/packages/aws-lambda/README.md) | AWS Lambda adapter with response streaming | +| [`@standard-server/peer`](https://github.com/middleapi/standard-server/blob/main/packages/peer/README.md) | Message-based adapter for WebSocket, MessagePort, and custom transports | +| [`@standard-server/shared`](https://github.com/middleapi/standard-server/blob/main/packages/shared/README.md) | Internal utilities shared across the ecosystem | This package is the foundation of that model. It defines the request and response types every adapter converts to and from, the body parsing rules they all share, runtime validators, header and URL utilities, and event stream (SSE) helpers. @@ -61,7 +61,7 @@ Supporting primitives: By convention, adapters normalize headers to lowercase keys. `signal` is part of `StandardRequest` only and is used to propagate request cancellation. ```ts -import type { StandardLazyRequest, StandardResponse } from '@standardserver/core' +import type { StandardLazyRequest, StandardResponse } from '@standard-server/core' export async function handle(request: StandardLazyRequest): Promise { const body = await request.resolveBody() @@ -98,7 +98,7 @@ export async function handle(request: StandardLazyRequest): Promise Since `File` extends `Blob`, `resolveBody` always returns a `File` when representing either `File` or `Blob` bodies. ```ts -import type { StandardResponse } from '@standardserver/core' +import type { StandardResponse } from '@standard-server/core' const response: StandardResponse = { status: 200, @@ -163,8 +163,8 @@ When sending a file or blob body, adapters automatically set the `content-length Standard Server uses [AsyncIteratorObject](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/AsyncIterator) to represent an event stream body, and you can use `withEventMeta()` to attach additional [SSE event metadata](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#event_stream_format) to each emitted event. ```ts -import type { StandardResponse } from '@standardserver/core' -import { ErrorEvent, withEventMeta } from '@standardserver/core' +import type { StandardResponse } from '@standard-server/core' +import { ErrorEvent, withEventMeta } from '@standard-server/core' const response: StandardResponse = { status: 200, @@ -191,7 +191,7 @@ For explicit SSE encoding, decoding, and metadata handling, see the [Event-Strea Standard Server uses [ReadableStream](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream) to represent a binary streaming body. ```ts -import type { StandardResponse } from '@standardserver/core' +import type { StandardResponse } from '@standard-server/core' const response: StandardResponse = { status: 200, @@ -213,7 +213,7 @@ When sending a binary streaming body, adapters automatically set the `content-ty ## How body parsing works > [!NOTE] -> This section applies to the HTTP adapters (Fetch, Node.js, Fastify, AWS Lambda). It does not apply to the [peer adapter](https://github.com/middleapi/standardserver/blob/main/packages/peer/README.md#body-resolution), which identifies body types through its own message protocol — a different but fairly similar mechanism. +> This section applies to the HTTP adapters (Fetch, Node.js, Fastify, AWS Lambda). It does not apply to the [peer adapter](https://github.com/middleapi/standard-server/blob/main/packages/peer/README.md#body-resolution), which identifies body types through its own message protocol — a different but fairly similar mechanism. `resolveBody(hint?)` on `StandardLazyRequest` and `StandardLazyResponse` resolves the body lazily — the underlying stream is only consumed once you call it. The `StandardBodyHint` that decides how the raw body is parsed comes from three places: an explicit `hint` argument, the `standard-server` header, or inference from the content headers. @@ -256,7 +256,7 @@ The hint is chosen in this order: This resolution is implemented once in this package as `resolveStandardBodyHint(headers)` and shared by every HTTP adapter, so the same body parses the same way regardless of which HTTP transport carried it: ```ts -import { resolveStandardBodyHint } from '@standardserver/core' +import { resolveStandardBodyHint } from '@standard-server/core' resolveStandardBodyHint({ 'content-type': 'application/json' }) // 'json' @@ -285,7 +285,7 @@ Use `generateContentDisposition()` to produce a safe `Content-Disposition` value import { generateContentDisposition, getFilenameFromContentDisposition, -} from '@standardserver/core' +} from '@standard-server/core' const disposition = generateContentDisposition('report "Q2".csv') // inline; filename="report \"Q2\".csv"; filename*=utf-8''report%20%22Q2%22.csv @@ -304,7 +304,7 @@ const filename = getFilenameFromContentDisposition(disposition) import { flattenStandardHeader, mergeStandardHeaders, -} from '@standardserver/core' +} from '@standard-server/core' const headers = mergeStandardHeaders( { 'accept': 'application/json', 'set-cookie': ['a=1'] }, @@ -325,7 +325,7 @@ const cookieHeader = flattenStandardHeader(headers['set-cookie']) `parseStandardUrl()` splits a `StandardUrl` into `[pathname, search, hash]` without requiring a full origin. ```ts -import { parseStandardUrl } from '@standardserver/core' +import { parseStandardUrl } from '@standard-server/core' const [pathname, search, hash] = parseStandardUrl('/users/123?tab=settings#profile') // pathname => '/users/123' @@ -346,7 +346,7 @@ Runtime type guards are useful when requests or responses cross process, transpo | `isStandardResponse()` | | ```ts -import { isStandardRequest } from '@standardserver/core' +import { isStandardRequest } from '@standard-server/core' export function expectStandardRequest(input: unknown) { if (!isStandardRequest(input)) { @@ -374,7 +374,7 @@ The event-stream helpers include: import { decodeEventStreamMessage, encodeEventStreamMessage, -} from '@standardserver/core' +} from '@standard-server/core' const encoded = encodeEventStreamMessage({ comments: ['bootstrap'], @@ -397,7 +397,7 @@ const decoded = decodeEventStreamMessage(encoded) For streaming decode, pipe text chunks through `EventStreamDecoderStream`: ```ts -import { EventStreamDecoderStream } from '@standardserver/core' +import { EventStreamDecoderStream } from '@standard-server/core' const messages = response.body! .pipeThrough(new TextDecoderStream()) @@ -409,8 +409,8 @@ const messages = response.body! `StandardBody` uses async iterators for event-stream bodies. To attach SSE metadata to a yielded value without changing its visible shape, use `withEventMeta()`. ```ts -import type { StandardResponse } from '@standardserver/core' -import { getEventMeta, unwrapEvent, withEventMeta } from '@standardserver/core' +import type { StandardResponse } from '@standard-server/core' +import { getEventMeta, unwrapEvent, withEventMeta } from '@standard-server/core' const event = withEventMeta( { message: 'hello' }, @@ -446,7 +446,7 @@ The package also exports: - `assertEventStreamMessageId()`, `assertEventStreamMessageName()`, `assertEventStreamMessageRetry()`, and `assertEventStreamMessageComment()` for low-level validation when building custom SSE tooling ```ts -import { ErrorEvent } from '@standardserver/core' +import { ErrorEvent } from '@standard-server/core' const error = new ErrorEvent( { code: 'E_STREAM', detail: 'Connection lost' }, @@ -462,7 +462,7 @@ error.data ## Learn more -For transport-specific quick-starts and options, see the adapter documentation: [Fetch](https://github.com/middleapi/standardserver/blob/main/packages/fetch/README.md) · [Node.js](https://github.com/middleapi/standardserver/blob/main/packages/node/README.md) · [Fastify](https://github.com/middleapi/standardserver/blob/main/packages/fastify/README.md) · [AWS Lambda](https://github.com/middleapi/standardserver/blob/main/packages/aws-lambda/README.md) · [Peer](https://github.com/middleapi/standardserver/blob/main/packages/peer/README.md) +For transport-specific quick-starts and options, see the adapter documentation: [Fetch](https://github.com/middleapi/standard-server/blob/main/packages/fetch/README.md) · [Node.js](https://github.com/middleapi/standard-server/blob/main/packages/node/README.md) · [Fastify](https://github.com/middleapi/standard-server/blob/main/packages/fastify/README.md) · [AWS Lambda](https://github.com/middleapi/standard-server/blob/main/packages/aws-lambda/README.md) · [Peer](https://github.com/middleapi/standard-server/blob/main/packages/peer/README.md) ## Sponsors @@ -550,4 +550,4 @@ With thanks to [36 past sponsors](https://htmlpreview.github.io/?https://github. ## License -Distributed under the MIT License. See [LICENCE](https://github.com/middleapi/standardserver/blob/main/LICENCE) for more information. +Distributed under the MIT License. See [LICENCE](https://github.com/middleapi/standard-server/blob/main/LICENCE) for more information. diff --git a/packages/core/package.json b/packages/core/package.json index 02f2cd6..7c9c4b2 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -1,5 +1,5 @@ { - "name": "@standardserver/core", + "name": "@standard-server/core", "type": "module", "version": "0.8.3", "description": "The Standard Server contract: transport-agnostic request, response, body, and streaming types with body parsing rules, runtime validators, and SSE helpers shared by every adapter", @@ -8,14 +8,13 @@ "https://github.com/sponsors/dinwwwh", "https://opencollective.com/middleapi" ], - "homepage": "https://standardserver.dev", "repository": { "type": "git", - "url": "git+https://github.com/middleapi/standardserver.git", + "url": "git+https://github.com/middleapi/standard-server.git", "directory": "packages/core" }, "keywords": [ - "standardserver", + "standard-server", "http", "server", "client", @@ -52,6 +51,6 @@ "type:check": "tsc -b" }, "dependencies": { - "@standardserver/shared": "workspace:*" + "@standard-server/shared": "workspace:*" } } diff --git a/packages/core/src/event-stream/meta.ts b/packages/core/src/event-stream/meta.ts index 1436f37..13add23 100644 --- a/packages/core/src/event-stream/meta.ts +++ b/packages/core/src/event-stream/meta.ts @@ -1,5 +1,5 @@ import type { EventMeta } from './types' -import { getOrBind, isTypescriptObject } from '@standardserver/shared' +import { getOrBind, isTypescriptObject } from '@standard-server/shared' import { assertEventStreamMessageComment, assertEventStreamMessageId, assertEventStreamMessageRetry } from './encoder' const EVENT_META_SYMBOL = Symbol.for('STANDARDSERVER_EVENT_META') diff --git a/packages/core/src/utils.ts b/packages/core/src/utils.ts index 56b85ad..c21e44f 100644 --- a/packages/core/src/utils.ts +++ b/packages/core/src/utils.ts @@ -1,5 +1,5 @@ import type { StandardBodyHint, StandardHeaders, StandardUrl } from './types' -import { toArray, tryDecodeURIComponent } from '@standardserver/shared' +import { toArray, tryDecodeURIComponent } from '@standard-server/shared' export function generateContentDisposition(filename: string, type: 'inline' | 'attachment' = 'inline'): string { const encodedFilename = filename.replace(/[^\x20-\x7E]/g, '_').replace(/[\\"]/g, '\\$&') diff --git a/packages/core/src/validators.ts b/packages/core/src/validators.ts index b684efc..3c9ae9c 100644 --- a/packages/core/src/validators.ts +++ b/packages/core/src/validators.ts @@ -1,5 +1,5 @@ import type { StandardHeaders, StandardMethod, StandardRequest, StandardResponse, StandardUrl } from './types' -import { isTypescriptObject } from '@standardserver/shared' +import { isTypescriptObject } from '@standard-server/shared' export function isStandardMethod(maybe: unknown): maybe is StandardMethod { return typeof maybe === 'string' diff --git a/packages/fastify/README.md b/packages/fastify/README.md index 482e8f4..a474772 100644 --- a/packages/fastify/README.md +++ b/packages/fastify/README.md @@ -1,43 +1,43 @@ -# @standardserver/fastify +# @standard-server/fastify -`@standardserver/fastify` adapts Fastify request and reply objects to the transport-agnostic request and response model defined by Standard Server. +`@standard-server/fastify` adapts Fastify request and reply objects to the transport-agnostic request and response model defined by Standard Server. Standard Server provides a unified interface for client-server communication across HTTP and message-based transports. It lets you write handlers against the same request, response, body, and streaming primitives whether the underlying transport is the Fetch API, Node.js HTTP, HTTP/2, or a peer-style message channel. Standard Server ships as a small ecosystem of packages: -| Package | Description | -| ------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------- | -| [`@standardserver/core`](https://github.com/middleapi/standardserver/blob/main/packages/core/README.md) | The shared contract: types, body parsing rules, validators, and SSE helpers | -| [`@standardserver/fetch`](https://github.com/middleapi/standardserver/blob/main/packages/fetch/README.md) | Fetch API adapter for browsers, workers, and other Fetch-based runtimes | -| [`@standardserver/node`](https://github.com/middleapi/standardserver/blob/main/packages/node/README.md) | Node.js HTTP and HTTP/2 adapter | -| [`@standardserver/fastify`](https://github.com/middleapi/standardserver/blob/main/packages/fastify/README.md) | Fastify adapter built on the Node.js adapter | -| [`@standardserver/aws-lambda`](https://github.com/middleapi/standardserver/blob/main/packages/aws-lambda/README.md) | AWS Lambda adapter with response streaming | -| [`@standardserver/peer`](https://github.com/middleapi/standardserver/blob/main/packages/peer/README.md) | Message-based adapter for WebSocket, MessagePort, and custom transports | -| [`@standardserver/shared`](https://github.com/middleapi/standardserver/blob/main/packages/shared/README.md) | Internal utilities shared across the ecosystem | +| Package | Description | +| --------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------- | +| [`@standard-server/core`](https://github.com/middleapi/standard-server/blob/main/packages/core/README.md) | The shared contract: types, body parsing rules, validators, and SSE helpers | +| [`@standard-server/fetch`](https://github.com/middleapi/standard-server/blob/main/packages/fetch/README.md) | Fetch API adapter for browsers, workers, and other Fetch-based runtimes | +| [`@standard-server/node`](https://github.com/middleapi/standard-server/blob/main/packages/node/README.md) | Node.js HTTP and HTTP/2 adapter | +| [`@standard-server/fastify`](https://github.com/middleapi/standard-server/blob/main/packages/fastify/README.md) | Fastify adapter built on the Node.js adapter | +| [`@standard-server/aws-lambda`](https://github.com/middleapi/standard-server/blob/main/packages/aws-lambda/README.md) | AWS Lambda adapter with response streaming | +| [`@standard-server/peer`](https://github.com/middleapi/standard-server/blob/main/packages/peer/README.md) | Message-based adapter for WebSocket, MessagePort, and custom transports | +| [`@standard-server/shared`](https://github.com/middleapi/standard-server/blob/main/packages/shared/README.md) | Internal utilities shared across the ecosystem | -This package is the Fastify adapter for that model. It builds on [`@standardserver/node`](https://github.com/middleapi/standardserver/blob/main/packages/node/README.md), reusing the same body, URL, and abort-signal primitives, while routing the response back through Fastify's reply lifecycle so hooks, plugins, and serializers keep working. Both `Fastify()` and `Fastify({ http2: true })` instances are supported. +This package is the Fastify adapter for that model. It builds on [`@standard-server/node`](https://github.com/middleapi/standard-server/blob/main/packages/node/README.md), reusing the same body, URL, and abort-signal primitives, while routing the response back through Fastify's reply lifecycle so hooks, plugins, and serializers keep working. Both `Fastify()` and `Fastify({ http2: true })` instances are supported. `fastify` is a peer dependency, so the adapter always uses the Fastify version installed in your project. @@ -52,15 +52,15 @@ The package exposes two helpers and their option shapes: Both helpers accept `AnyFastifyRequest` and `AnyFastifyReply`, which are `FastifyRequest` and `FastifyReply` widened over every raw server. That is what lets the same call site work for `Fastify()`, `Fastify({ http2: true })`, typed route generics, hooks, and encapsulated plugins alike. -Lower-level helpers such as `toStandardBody()`, `toNodeHttpBody()`, and `toEventStream()` are not re-exported here — import them from [`@standardserver/node`](https://github.com/middleapi/standardserver/blob/main/packages/node/README.md) when you need them. +Lower-level helpers such as `toStandardBody()`, `toNodeHttpBody()`, and `toEventStream()` are not re-exported here — import them from [`@standard-server/node`](https://github.com/middleapi/standard-server/blob/main/packages/node/README.md) when you need them. ## Server-side request handling Use `toStandardLazyRequest()` to convert an incoming Fastify request into a `StandardLazyRequest`, then `sendStandardResponse()` to write the resulting `StandardResponse` back through the reply. ```ts -import type { StandardLazyRequest, StandardResponse } from '@standardserver/core' -import { sendStandardResponse, toStandardLazyRequest } from '@standardserver/fastify' +import type { StandardLazyRequest, StandardResponse } from '@standard-server/core' +import { sendStandardResponse, toStandardLazyRequest } from '@standard-server/fastify' import Fastify from 'fastify' async function handle(request: StandardLazyRequest): Promise { @@ -97,7 +97,7 @@ await fastify.listen({ port: 3000 }) ## Resolving Body -`resolveBody(hint?)` returns the body Fastify already parsed with its own content type parsers, if there is one. Otherwise it falls back to `toStandardBody()` from `@standardserver/node`, which follows the shared Standard Server resolution rules: an explicit `hint` wins, then the [`standard-server` header](https://github.com/middleapi/standardserver/blob/main/packages/core/README.md#the-standard-server-header), then inference from the content headers. See [how body parsing works](https://github.com/middleapi/standardserver/blob/main/packages/core/README.md#how-body-parsing-works) in the core README for the full algorithm. +`resolveBody(hint?)` returns the body Fastify already parsed with its own content type parsers, if there is one. Otherwise it falls back to `toStandardBody()` from `@standard-server/node`, which follows the shared Standard Server resolution rules: an explicit `hint` wins, then the [`standard-server` header](https://github.com/middleapi/standard-server/blob/main/packages/core/README.md#the-standard-server-header), then inference from the content headers. See [how body parsing works](https://github.com/middleapi/standard-server/blob/main/packages/core/README.md#how-body-parsing-works) in the core README for the full algorithm. Because Fastify's own parsers win, a `hint` only applies to bodies Fastify left unparsed. Fastify ships parsers for `application/json` and `text/plain`, and rejects every other content type with `415 Unsupported Media Type` unless you register one. To let the adapter own body parsing end to end, register a catch-all parser that leaves the body untouched: @@ -135,7 +135,7 @@ Fastify owns the reply lifecycle, so a few of its rules apply to the response th ## Learn more -For the project overview and the shared contract, see the [core documentation](https://github.com/middleapi/standardserver/blob/main/packages/core/README.md). For the Node.js primitives this adapter is built on, see the [Node.js adapter documentation](https://github.com/middleapi/standardserver/blob/main/packages/node/README.md). +For the project overview and the shared contract, see the [core documentation](https://github.com/middleapi/standard-server/blob/main/packages/core/README.md). For the Node.js primitives this adapter is built on, see the [Node.js adapter documentation](https://github.com/middleapi/standard-server/blob/main/packages/node/README.md). ## Sponsors @@ -223,4 +223,4 @@ With thanks to [36 past sponsors](https://htmlpreview.github.io/?https://github. ## License -Distributed under the MIT License. See [LICENCE](https://github.com/middleapi/standardserver/blob/main/LICENCE) for more information. +Distributed under the MIT License. See [LICENCE](https://github.com/middleapi/standard-server/blob/main/LICENCE) for more information. diff --git a/packages/fastify/package.json b/packages/fastify/package.json index 6c85a60..31a0a0d 100644 --- a/packages/fastify/package.json +++ b/packages/fastify/package.json @@ -1,5 +1,5 @@ { - "name": "@standardserver/fastify", + "name": "@standard-server/fastify", "type": "module", "version": "0.8.3", "description": "Fastify adapter for Standard Server: transport-agnostic requests, responses, and streaming on top of Fastify's request and reply objects", @@ -8,14 +8,13 @@ "https://github.com/sponsors/dinwwwh", "https://opencollective.com/middleapi" ], - "homepage": "https://standardserver.dev", "repository": { "type": "git", - "url": "git+https://github.com/middleapi/standardserver.git", + "url": "git+https://github.com/middleapi/standard-server.git", "directory": "packages/fastify" }, "keywords": [ - "standardserver", + "standard-server", "fastify", "adapter", "http", @@ -57,8 +56,8 @@ } }, "dependencies": { - "@standardserver/core": "workspace:*", - "@standardserver/node": "workspace:*" + "@standard-server/core": "workspace:*", + "@standard-server/node": "workspace:*" }, "devDependencies": { "@fastify/cookie": "^11.1.2", diff --git a/packages/fastify/src/request.test.ts b/packages/fastify/src/request.test.ts index 63105af..0cf59bf 100644 --- a/packages/fastify/src/request.test.ts +++ b/packages/fastify/src/request.test.ts @@ -1,5 +1,5 @@ -import type { StandardLazyRequest } from '@standardserver/core' -import * as StandardServerNode from '@standardserver/node' +import type { StandardLazyRequest } from '@standard-server/core' +import * as StandardServerNode from '@standard-server/node' import Fastify from 'fastify' import request from 'supertest' import { toStandardLazyRequest } from './request' diff --git a/packages/fastify/src/request.ts b/packages/fastify/src/request.ts index 08216e8..9fce499 100644 --- a/packages/fastify/src/request.ts +++ b/packages/fastify/src/request.ts @@ -1,6 +1,6 @@ -import type { StandardLazyRequest } from '@standardserver/core' +import type { StandardLazyRequest } from '@standard-server/core' import type { AnyFastifyReply, AnyFastifyRequest } from './types' -import { toAbortSignal, toStandardBody, toStandardMethod, toStandardUrl } from '@standardserver/node' +import { toAbortSignal, toStandardBody, toStandardMethod, toStandardUrl } from '@standard-server/node' export function toStandardLazyRequest( req: AnyFastifyRequest, diff --git a/packages/fastify/src/response.test.ts b/packages/fastify/src/response.test.ts index fe7749a..12b4e12 100644 --- a/packages/fastify/src/response.test.ts +++ b/packages/fastify/src/response.test.ts @@ -1,7 +1,7 @@ import { Buffer } from 'node:buffer' import { Readable, Writable } from 'node:stream' import FastifyCookie from '@fastify/cookie' -import * as StandardServerNode from '@standardserver/node' +import * as StandardServerNode from '@standard-server/node' import Fastify from 'fastify' import request from 'supertest' import { sendStandardResponse } from './response' diff --git a/packages/fastify/src/response.ts b/packages/fastify/src/response.ts index e2b7f89..a5d9d15 100644 --- a/packages/fastify/src/response.ts +++ b/packages/fastify/src/response.ts @@ -1,7 +1,7 @@ -import type { StandardResponse } from '@standardserver/core' -import type { ToNodeHttpBodyOptions } from '@standardserver/node' +import type { StandardResponse } from '@standard-server/core' +import type { ToNodeHttpBodyOptions } from '@standard-server/node' import type { AnyFastifyReply } from './types' -import { canWriteToNodeResponse, getNodeResponseError, toNodeHttpBody } from '@standardserver/node' +import { canWriteToNodeResponse, getNodeResponseError, toNodeHttpBody } from '@standard-server/node' export interface SendStandardResponseOptions extends ToNodeHttpBodyOptions { } diff --git a/packages/fastify/src/types.test-d.ts b/packages/fastify/src/types.test-d.ts index 06f3afb..0a90e24 100644 --- a/packages/fastify/src/types.test-d.ts +++ b/packages/fastify/src/types.test-d.ts @@ -1,5 +1,5 @@ -import type { StandardHeaders } from '@standardserver/core' -import type { NodeHttpRequest, NodeHttpResponse } from '@standardserver/node' +import type { StandardHeaders } from '@standard-server/core' +import type { NodeHttpRequest, NodeHttpResponse } from '@standard-server/node' import type { AnyFastifyReply, AnyFastifyRequest } from './types' import Fastify from 'fastify' @@ -8,7 +8,7 @@ import Fastify from 'fastify' * aliases accept it, whatever raw server and route generic it came from. */ function accepts(req: AnyFastifyRequest, reply: AnyFastifyReply): void { - // the aliases must expose exactly what `@standardserver/node` consumes + // the aliases must expose exactly what `@standard-server/node` consumes expectTypeOf(req.raw).toExtend() expectTypeOf(req.headers).toExtend() expectTypeOf(reply.raw).toExtend() diff --git a/packages/fastify/tests/http2.test.ts b/packages/fastify/tests/http2.test.ts index a22adf6..9e41b7a 100644 --- a/packages/fastify/tests/http2.test.ts +++ b/packages/fastify/tests/http2.test.ts @@ -4,7 +4,7 @@ import Fastify from 'fastify' import { sendStandardResponse, toStandardLazyRequest } from '../src' /** - * `@standardserver/node` supports both node http and http2, so the fastify adapter + * `@standard-server/node` supports both node http and http2, so the fastify adapter * must keep working when fastify is created with `{ http2: true }`. */ describe('http2', () => { diff --git a/packages/fetch/README.md b/packages/fetch/README.md index 645eb6d..383b9b7 100644 --- a/packages/fetch/README.md +++ b/packages/fetch/README.md @@ -1,43 +1,43 @@ -# @standardserver/fetch +# @standard-server/fetch -`@standardserver/fetch` adapts the Fetch API to the transport-agnostic request and response model defined by Standard Server. +`@standard-server/fetch` adapts the Fetch API to the transport-agnostic request and response model defined by Standard Server. Standard Server provides a unified interface for client-server communication across HTTP and message-based transports. It lets you write handlers and clients against the same request, response, body, and streaming primitives whether the underlying transport is Fetch, Node.js HTTP, or a peer-style message channel. Standard Server ships as a small ecosystem of packages: -| Package | Description | -| ------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------- | -| [`@standardserver/core`](https://github.com/middleapi/standardserver/blob/main/packages/core/README.md) | The shared contract: types, body parsing rules, validators, and SSE helpers | -| [`@standardserver/fetch`](https://github.com/middleapi/standardserver/blob/main/packages/fetch/README.md) | Fetch API adapter for browsers, workers, and other Fetch-based runtimes | -| [`@standardserver/node`](https://github.com/middleapi/standardserver/blob/main/packages/node/README.md) | Node.js HTTP and HTTP/2 adapter | -| [`@standardserver/fastify`](https://github.com/middleapi/standardserver/blob/main/packages/fastify/README.md) | Fastify adapter built on the Node.js adapter | -| [`@standardserver/aws-lambda`](https://github.com/middleapi/standardserver/blob/main/packages/aws-lambda/README.md) | AWS Lambda adapter with response streaming | -| [`@standardserver/peer`](https://github.com/middleapi/standardserver/blob/main/packages/peer/README.md) | Message-based adapter for WebSocket, MessagePort, and custom transports | -| [`@standardserver/shared`](https://github.com/middleapi/standardserver/blob/main/packages/shared/README.md) | Internal utilities shared across the ecosystem | +| Package | Description | +| --------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------- | +| [`@standard-server/core`](https://github.com/middleapi/standard-server/blob/main/packages/core/README.md) | The shared contract: types, body parsing rules, validators, and SSE helpers | +| [`@standard-server/fetch`](https://github.com/middleapi/standard-server/blob/main/packages/fetch/README.md) | Fetch API adapter for browsers, workers, and other Fetch-based runtimes | +| [`@standard-server/node`](https://github.com/middleapi/standard-server/blob/main/packages/node/README.md) | Node.js HTTP and HTTP/2 adapter | +| [`@standard-server/fastify`](https://github.com/middleapi/standard-server/blob/main/packages/fastify/README.md) | Fastify adapter built on the Node.js adapter | +| [`@standard-server/aws-lambda`](https://github.com/middleapi/standard-server/blob/main/packages/aws-lambda/README.md) | AWS Lambda adapter with response streaming | +| [`@standard-server/peer`](https://github.com/middleapi/standard-server/blob/main/packages/peer/README.md) | Message-based adapter for WebSocket, MessagePort, and custom transports | +| [`@standard-server/shared`](https://github.com/middleapi/standard-server/blob/main/packages/shared/README.md) | Internal utilities shared across the ecosystem | -This package is the Fetch API adapter for that model. It converts between native `Request`, `Response`, `Headers`, and stream values and the corresponding Standard Server shapes from [`@standardserver/core`](https://github.com/middleapi/standardserver/blob/main/packages/core/README.md). +This package is the Fetch API adapter for that model. It converts between native `Request`, `Response`, `Headers`, and stream values and the corresponding Standard Server shapes from [`@standard-server/core`](https://github.com/middleapi/standard-server/blob/main/packages/core/README.md). ## Package overview @@ -56,8 +56,8 @@ Use these helpers when you want Standard Server handlers to run in Fetch-based r Use `toStandardLazyRequest()` to convert an incoming Fetch `Request` into a `StandardLazyRequest`, then `toFetchResponse()` to turn the resulting `StandardResponse` back into a Fetch `Response`. ```ts -import type { StandardLazyRequest, StandardResponse } from '@standardserver/core' -import { toFetchResponse, toStandardLazyRequest } from '@standardserver/fetch' +import type { StandardLazyRequest, StandardResponse } from '@standard-server/core' +import { toFetchResponse, toStandardLazyRequest } from '@standard-server/fetch' async function handle(request: StandardLazyRequest): Promise { const body = await request.resolveBody() @@ -86,7 +86,7 @@ export async function fetchHandler(request: Request): Promise { Use `toFetchBody()` and `toFetchHeaders()` to serialize an outgoing request, and `toStandardLazyResponse()` when you receive a Fetch `Response` but want to work with the Standard Server response contract. ```ts -import { toFetchBody, toFetchHeaders, toStandardLazyResponse } from '@standardserver/fetch' +import { toFetchBody, toFetchHeaders, toStandardLazyResponse } from '@standard-server/fetch' const standardRequest = { method: 'POST', @@ -106,21 +106,21 @@ const standardResponse = toStandardLazyResponse(response) const payload = await standardResponse.resolveBody() ``` -`toFetchBody()` also prepares the content headers for the body it serializes — for example, a `Blob` or `File` body gains `standard-server: file`, `content-length`, and a generated `content-disposition`, so the receiver reconstructs the same body type. See [the `standard-server` header](https://github.com/middleapi/standardserver/blob/main/packages/core/README.md#the-standard-server-header) in the core README for why. +`toFetchBody()` also prepares the content headers for the body it serializes — for example, a `Blob` or `File` body gains `standard-server: file`, `content-length`, and a generated `content-disposition`, so the receiver reconstructs the same body type. See [the `standard-server` header](https://github.com/middleapi/standard-server/blob/main/packages/core/README.md#the-standard-server-header) in the core README for why. > [!TIP] > When sending requests or responses, you can pass additional options such as event-stream keep-alive. ## Resolving Body -`resolveBody(hint?)` follows the shared Standard Server resolution rules: an explicit `hint` wins, then the [`standard-server` header](https://github.com/middleapi/standardserver/blob/main/packages/core/README.md#the-standard-server-header), then inference from the content headers. See [how body parsing works](https://github.com/middleapi/standardserver/blob/main/packages/core/README.md#how-body-parsing-works) in the core README for the full algorithm. +`resolveBody(hint?)` follows the shared Standard Server resolution rules: an explicit `hint` wins, then the [`standard-server` header](https://github.com/middleapi/standard-server/blob/main/packages/core/README.md#the-standard-server-header), then inference from the content headers. See [how body parsing works](https://github.com/middleapi/standard-server/blob/main/packages/core/README.md#how-body-parsing-works) in the core README for the full algorithm. > [!TIP] > For efficient communication, set the `standard-server` header to explicitly hint the body type, especially for file or binary streaming. For example, if you upload a file with a common `content-type` such as `application/json` but omit the `standard-server` header, the server may interpret it as JSON and parse it unexpectedly. ## Learn more -For the project overview and the shared contract this adapter implements, see the [core documentation](https://github.com/middleapi/standardserver/blob/main/packages/core/README.md). +For the project overview and the shared contract this adapter implements, see the [core documentation](https://github.com/middleapi/standard-server/blob/main/packages/core/README.md). ## Sponsors @@ -208,4 +208,4 @@ With thanks to [36 past sponsors](https://htmlpreview.github.io/?https://github. ## License -Distributed under the MIT License. See [LICENCE](https://github.com/middleapi/standardserver/blob/main/LICENCE) for more information. +Distributed under the MIT License. See [LICENCE](https://github.com/middleapi/standard-server/blob/main/LICENCE) for more information. diff --git a/packages/fetch/package.json b/packages/fetch/package.json index 4b32bef..ab3ae7f 100644 --- a/packages/fetch/package.json +++ b/packages/fetch/package.json @@ -1,5 +1,5 @@ { - "name": "@standardserver/fetch", + "name": "@standard-server/fetch", "type": "module", "version": "0.8.3", "description": "Fetch API adapter for Standard Server: transport-agnostic requests, responses, and streaming for browsers, workers, Deno, Bun, and any Fetch-based runtime", @@ -8,14 +8,13 @@ "https://github.com/sponsors/dinwwwh", "https://opencollective.com/middleapi" ], - "homepage": "https://standardserver.dev", "repository": { "type": "git", - "url": "git+https://github.com/middleapi/standardserver.git", + "url": "git+https://github.com/middleapi/standard-server.git", "directory": "packages/fetch" }, "keywords": [ - "standardserver", + "standard-server", "fetch", "adapter", "http", @@ -53,7 +52,7 @@ "type:check": "tsc -b" }, "dependencies": { - "@standardserver/core": "workspace:*", - "@standardserver/shared": "workspace:*" + "@standard-server/core": "workspace:*", + "@standard-server/shared": "workspace:*" } } diff --git a/packages/fetch/src/body.test.ts b/packages/fetch/src/body.test.ts index 2d62bc5..7ce2218 100644 --- a/packages/fetch/src/body.test.ts +++ b/packages/fetch/src/body.test.ts @@ -1,5 +1,5 @@ -import * as StandardServerModule from '@standardserver/core' -import { isAsyncIteratorObject } from '@standardserver/shared' +import * as StandardServerModule from '@standard-server/core' +import { isAsyncIteratorObject } from '@standard-server/shared' import { toFetchBody, toStandardBody } from './body' import * as EventStreamModule from './event-stream' import { toFetchHeaders } from './headers' diff --git a/packages/fetch/src/body.ts b/packages/fetch/src/body.ts index fdf39af..87f022b 100644 --- a/packages/fetch/src/body.ts +++ b/packages/fetch/src/body.ts @@ -1,7 +1,7 @@ -import type { StandardBody, StandardBodyHint, StandardHeaders } from '@standardserver/core' +import type { StandardBody, StandardBodyHint, StandardHeaders } from '@standard-server/core' import type { ToEventStreamOptions } from './event-stream' -import { generateContentDisposition, getFilenameFromContentDisposition, resolveStandardBodyHint } from '@standardserver/core' -import { isAsyncIteratorObject, parseEmptyableJSON, stringifyJSON } from '@standardserver/shared' +import { generateContentDisposition, getFilenameFromContentDisposition, resolveStandardBodyHint } from '@standard-server/core' +import { isAsyncIteratorObject, parseEmptyableJSON, stringifyJSON } from '@standard-server/shared' import { toAsyncIteratorObject, toEventStream } from './event-stream' export interface ToStandardBodyOptions { diff --git a/packages/fetch/src/event-stream.test.ts b/packages/fetch/src/event-stream.test.ts index 9bfd7de..a6be1e0 100644 --- a/packages/fetch/src/event-stream.test.ts +++ b/packages/fetch/src/event-stream.test.ts @@ -1,5 +1,5 @@ -import { ErrorEvent, getEventMeta, withEventMeta } from '@standardserver/core' -import { AbortError, isAsyncIteratorObject, sleep } from '@standardserver/shared' +import { ErrorEvent, getEventMeta, withEventMeta } from '@standard-server/core' +import { AbortError, isAsyncIteratorObject, sleep } from '@standard-server/shared' import { toAsyncIteratorObject, toEventStream } from './event-stream' beforeEach(() => { diff --git a/packages/fetch/src/event-stream.ts b/packages/fetch/src/event-stream.ts index 96693ef..64d3b35 100644 --- a/packages/fetch/src/event-stream.ts +++ b/packages/fetch/src/event-stream.ts @@ -1,5 +1,5 @@ -import { encodeEventStreamMessage, ErrorEvent, EventStreamDecoderStream, getEventMeta, unwrapEvent, withEventMeta } from '@standardserver/core' -import { AbortError, AsyncIteratorClass, isTypescriptObject, parseEmptyableJSON, stringifyJSON } from '@standardserver/shared' +import { encodeEventStreamMessage, ErrorEvent, EventStreamDecoderStream, getEventMeta, unwrapEvent, withEventMeta } from '@standard-server/core' +import { AbortError, AsyncIteratorClass, isTypescriptObject, parseEmptyableJSON, stringifyJSON } from '@standard-server/shared' export function toAsyncIteratorObject( stream: ReadableStream> | null, diff --git a/packages/fetch/src/headers.test.ts b/packages/fetch/src/headers.test.ts index f505325..21847a7 100644 --- a/packages/fetch/src/headers.test.ts +++ b/packages/fetch/src/headers.test.ts @@ -1,4 +1,4 @@ -import type { StandardHeaders } from '@standardserver/core' +import type { StandardHeaders } from '@standard-server/core' import { toFetchHeaders, toStandardHeaders } from './headers' it('toStandardHeaders', () => { diff --git a/packages/fetch/src/headers.ts b/packages/fetch/src/headers.ts index cf000b2..51226fc 100644 --- a/packages/fetch/src/headers.ts +++ b/packages/fetch/src/headers.ts @@ -1,4 +1,4 @@ -import type { StandardHeaders } from '@standardserver/core' +import type { StandardHeaders } from '@standard-server/core' /** * Convert fetch headers to standard headers. diff --git a/packages/fetch/src/request.ts b/packages/fetch/src/request.ts index 0ff972d..59cc60e 100644 --- a/packages/fetch/src/request.ts +++ b/packages/fetch/src/request.ts @@ -1,4 +1,4 @@ -import type { StandardLazyRequest } from '@standardserver/core' +import type { StandardLazyRequest } from '@standard-server/core' import { toStandardBody } from './body' import { toStandardHeaders } from './headers' import { toStandardUrl } from './url' diff --git a/packages/fetch/src/response.test.ts b/packages/fetch/src/response.test.ts index f55fbdc..cd7adbc 100644 --- a/packages/fetch/src/response.test.ts +++ b/packages/fetch/src/response.test.ts @@ -1,4 +1,4 @@ -import type { StandardResponse } from '@standardserver/core' +import type { StandardResponse } from '@standard-server/core' import * as Body from './body' import * as Headers from './headers' import { toFetchResponse, toStandardLazyResponse } from './response' diff --git a/packages/fetch/src/response.ts b/packages/fetch/src/response.ts index ac2238d..050a1e7 100644 --- a/packages/fetch/src/response.ts +++ b/packages/fetch/src/response.ts @@ -1,4 +1,4 @@ -import type { StandardLazyResponse, StandardResponse } from '@standardserver/core' +import type { StandardLazyResponse, StandardResponse } from '@standard-server/core' import type { ToFetchBodyOptions } from './body' import { toFetchBody, toStandardBody } from './body' import { toFetchHeaders, toStandardHeaders } from './headers' diff --git a/packages/fetch/src/url.ts b/packages/fetch/src/url.ts index 585be05..256e678 100644 --- a/packages/fetch/src/url.ts +++ b/packages/fetch/src/url.ts @@ -1,4 +1,4 @@ -import type { StandardUrl } from '@standardserver/core' +import type { StandardUrl } from '@standard-server/core' export function toStandardUrl(url: URL): StandardUrl { /* v8 ignore start - url.pathname always start with "/" */ diff --git a/packages/node/README.md b/packages/node/README.md index a2ed704..66250a3 100644 --- a/packages/node/README.md +++ b/packages/node/README.md @@ -1,43 +1,43 @@ -# @standardserver/node +# @standard-server/node -`@standardserver/node` adapts Node.js HTTP request and response objects to the transport-agnostic request and response model defined by Standard Server. +`@standard-server/node` adapts Node.js HTTP request and response objects to the transport-agnostic request and response model defined by Standard Server. Standard Server provides a unified interface for client-server communication across HTTP and message-based transports. It lets you write handlers against the same request, response, body, and streaming primitives whether the underlying transport is the Fetch API, Node.js HTTP, HTTP/2, or a peer-style message channel. Standard Server ships as a small ecosystem of packages: -| Package | Description | -| ------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------- | -| [`@standardserver/core`](https://github.com/middleapi/standardserver/blob/main/packages/core/README.md) | The shared contract: types, body parsing rules, validators, and SSE helpers | -| [`@standardserver/fetch`](https://github.com/middleapi/standardserver/blob/main/packages/fetch/README.md) | Fetch API adapter for browsers, workers, and other Fetch-based runtimes | -| [`@standardserver/node`](https://github.com/middleapi/standardserver/blob/main/packages/node/README.md) | Node.js HTTP and HTTP/2 adapter | -| [`@standardserver/fastify`](https://github.com/middleapi/standardserver/blob/main/packages/fastify/README.md) | Fastify adapter built on the Node.js adapter | -| [`@standardserver/aws-lambda`](https://github.com/middleapi/standardserver/blob/main/packages/aws-lambda/README.md) | AWS Lambda adapter with response streaming | -| [`@standardserver/peer`](https://github.com/middleapi/standardserver/blob/main/packages/peer/README.md) | Message-based adapter for WebSocket, MessagePort, and custom transports | -| [`@standardserver/shared`](https://github.com/middleapi/standardserver/blob/main/packages/shared/README.md) | Internal utilities shared across the ecosystem | +| Package | Description | +| --------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------- | +| [`@standard-server/core`](https://github.com/middleapi/standard-server/blob/main/packages/core/README.md) | The shared contract: types, body parsing rules, validators, and SSE helpers | +| [`@standard-server/fetch`](https://github.com/middleapi/standard-server/blob/main/packages/fetch/README.md) | Fetch API adapter for browsers, workers, and other Fetch-based runtimes | +| [`@standard-server/node`](https://github.com/middleapi/standard-server/blob/main/packages/node/README.md) | Node.js HTTP and HTTP/2 adapter | +| [`@standard-server/fastify`](https://github.com/middleapi/standard-server/blob/main/packages/fastify/README.md) | Fastify adapter built on the Node.js adapter | +| [`@standard-server/aws-lambda`](https://github.com/middleapi/standard-server/blob/main/packages/aws-lambda/README.md) | AWS Lambda adapter with response streaming | +| [`@standard-server/peer`](https://github.com/middleapi/standard-server/blob/main/packages/peer/README.md) | Message-based adapter for WebSocket, MessagePort, and custom transports | +| [`@standard-server/shared`](https://github.com/middleapi/standard-server/blob/main/packages/shared/README.md) | Internal utilities shared across the ecosystem | -This package is the Node.js adapter for that model. It converts between native Node request and response objects and the corresponding Standard Server shapes from [`@standardserver/core`](https://github.com/middleapi/standardserver/blob/main/packages/core/README.md), while also exposing lower-level utilities for body parsing, URL normalization, abort signals, and server-sent events. +This package is the Node.js adapter for that model. It converts between native Node request and response objects and the corresponding Standard Server shapes from [`@standard-server/core`](https://github.com/middleapi/standard-server/blob/main/packages/core/README.md), while also exposing lower-level utilities for body parsing, URL normalization, abort signals, and server-sent events. ## Package overview @@ -57,9 +57,9 @@ Use these helpers when you want Standard Server handlers to run in Node runtimes Use `toStandardLazyRequest()` to convert an incoming Node request into a `StandardLazyRequest`, then `sendStandardResponse()` to write the resulting `StandardResponse` back to the client. ```ts -import type { StandardLazyRequest, StandardResponse } from '@standardserver/core' +import type { StandardLazyRequest, StandardResponse } from '@standard-server/core' import { createServer } from 'node:http' -import { sendStandardResponse, toStandardLazyRequest } from '@standardserver/node' +import { sendStandardResponse, toStandardLazyRequest } from '@standard-server/node' async function handle(request: StandardLazyRequest): Promise { const body = await request.resolveBody() @@ -89,14 +89,14 @@ createServer(async (req, res) => { ## Resolving Body -`resolveBody(hint?)` follows the shared Standard Server resolution rules: an explicit `hint` wins, then the [`standard-server` header](https://github.com/middleapi/standardserver/blob/main/packages/core/README.md#the-standard-server-header), then inference from the content headers. See [how body parsing works](https://github.com/middleapi/standardserver/blob/main/packages/core/README.md#how-body-parsing-works) in the core README for the full algorithm. +`resolveBody(hint?)` follows the shared Standard Server resolution rules: an explicit `hint` wins, then the [`standard-server` header](https://github.com/middleapi/standard-server/blob/main/packages/core/README.md#the-standard-server-header), then inference from the content headers. See [how body parsing works](https://github.com/middleapi/standard-server/blob/main/packages/core/README.md#how-body-parsing-works) in the core README for the full algorithm. > [!TIP] > For efficient communication, set the `standard-server` header to explicitly hint the body type, especially for file or binary streaming. For example, if you upload a file with a common `content-type` such as `application/json` but omit the `standard-server` header, the server may interpret it as JSON and parse it unexpectedly. ## Learn more -For the project overview and the shared contract this adapter implements, see the [core documentation](https://github.com/middleapi/standardserver/blob/main/packages/core/README.md). +For the project overview and the shared contract this adapter implements, see the [core documentation](https://github.com/middleapi/standard-server/blob/main/packages/core/README.md). ## Sponsors @@ -184,4 +184,4 @@ With thanks to [36 past sponsors](https://htmlpreview.github.io/?https://github. ## License -Distributed under the MIT License. See [LICENCE](https://github.com/middleapi/standardserver/blob/main/LICENCE) for more information. +Distributed under the MIT License. See [LICENCE](https://github.com/middleapi/standard-server/blob/main/LICENCE) for more information. diff --git a/packages/node/package.json b/packages/node/package.json index 1536daa..43e860f 100644 --- a/packages/node/package.json +++ b/packages/node/package.json @@ -1,5 +1,5 @@ { - "name": "@standardserver/node", + "name": "@standard-server/node", "type": "module", "version": "0.8.3", "description": "Node.js HTTP and HTTP/2 adapter for Standard Server: transport-agnostic requests, responses, and streaming on top of IncomingMessage and ServerResponse", @@ -8,14 +8,13 @@ "https://github.com/sponsors/dinwwwh", "https://opencollective.com/middleapi" ], - "homepage": "https://standardserver.dev", "repository": { "type": "git", - "url": "git+https://github.com/middleapi/standardserver.git", + "url": "git+https://github.com/middleapi/standard-server.git", "directory": "packages/node" }, "keywords": [ - "standardserver", + "standard-server", "node", "nodejs", "http", @@ -51,9 +50,9 @@ "type:check": "tsc -b" }, "dependencies": { - "@standardserver/core": "workspace:*", - "@standardserver/fetch": "workspace:*", - "@standardserver/shared": "workspace:*" + "@standard-server/core": "workspace:*", + "@standard-server/fetch": "workspace:*", + "@standard-server/shared": "workspace:*" }, "devDependencies": { "@types/node": "^26.4.1", diff --git a/packages/node/src/body.test.ts b/packages/node/src/body.test.ts index 27231d3..b6e52ba 100644 --- a/packages/node/src/body.test.ts +++ b/packages/node/src/body.test.ts @@ -1,12 +1,12 @@ -import type { StandardBody } from '@standardserver/core' +import type { StandardBody } from '@standard-server/core' import type { IncomingMessage, ServerResponse } from 'node:http' import type { NodeHttpRequest } from './types' import { Buffer } from 'node:buffer' import http2 from 'node:http2' import { Readable } from 'node:stream' -import * as StandardServerModule from '@standardserver/core' -import { toFetchHeaders } from '@standardserver/fetch' -import { isAsyncIteratorObject } from '@standardserver/shared' +import * as StandardServerModule from '@standard-server/core' +import { toFetchHeaders } from '@standard-server/fetch' +import { isAsyncIteratorObject } from '@standard-server/shared' import request from 'supertest' import { toNodeHttpBody, toStandardBody } from './body' import * as EventStreamModule from './event-stream' diff --git a/packages/node/src/body.ts b/packages/node/src/body.ts index 532a899..1c4c4d4 100644 --- a/packages/node/src/body.ts +++ b/packages/node/src/body.ts @@ -1,10 +1,10 @@ -import type { StandardBody, StandardBodyHint, StandardHeaders } from '@standardserver/core' +import type { StandardBody, StandardBodyHint, StandardHeaders } from '@standard-server/core' import type { Buffer } from 'node:buffer' import type { ToEventStreamOptions } from './event-stream' import type { NodeHttpRequest } from './types' import { Readable } from 'node:stream' -import { generateContentDisposition, getFilenameFromContentDisposition, resolveStandardBodyHint } from '@standardserver/core' -import { isAsyncIteratorObject, parseEmptyableJSON, stringifyJSON } from '@standardserver/shared' +import { generateContentDisposition, getFilenameFromContentDisposition, resolveStandardBodyHint } from '@standard-server/core' +import { isAsyncIteratorObject, parseEmptyableJSON, stringifyJSON } from '@standard-server/shared' import { toAsyncIteratorObject, toEventStream } from './event-stream' import { toWebReadableStream } from './utils' diff --git a/packages/node/src/event-stream.test.ts b/packages/node/src/event-stream.test.ts index 653fdb5..2c83eb5 100644 --- a/packages/node/src/event-stream.test.ts +++ b/packages/node/src/event-stream.test.ts @@ -1,6 +1,6 @@ import { Readable } from 'node:stream' -import * as FetchAdapter from '@standardserver/fetch' -import { isAsyncIteratorObject } from '@standardserver/shared' +import * as FetchAdapter from '@standard-server/fetch' +import { isAsyncIteratorObject } from '@standard-server/shared' import { toAsyncIteratorObject, toEventStream } from './event-stream' import * as UtilsModule from './utils' diff --git a/packages/node/src/event-stream.ts b/packages/node/src/event-stream.ts index 79b44d6..ce4f81d 100644 --- a/packages/node/src/event-stream.ts +++ b/packages/node/src/event-stream.ts @@ -1,12 +1,12 @@ import type { ToEventStreamOptions as ToEventStreamOptionsFetch, -} from '@standardserver/fetch' -import type { AsyncIteratorClass } from '@standardserver/shared' +} from '@standard-server/fetch' +import type { AsyncIteratorClass } from '@standard-server/shared' import { Readable } from 'node:stream' import { toAsyncIteratorObject as toAsyncIteratorObjectFetch, toEventStream as toEventStreamFetch, -} from '@standardserver/fetch' +} from '@standard-server/fetch' import { toWebReadableStream } from './utils' export function toAsyncIteratorObject( diff --git a/packages/node/src/method.ts b/packages/node/src/method.ts index 81d8b6a..37c096b 100644 --- a/packages/node/src/method.ts +++ b/packages/node/src/method.ts @@ -1,4 +1,4 @@ -import type { StandardMethod } from '@standardserver/core' +import type { StandardMethod } from '@standard-server/core' export function toStandardMethod(method: string | undefined): StandardMethod { return method ?? 'GET' diff --git a/packages/node/src/request.test.ts b/packages/node/src/request.test.ts index 1f1ea99..0e56f36 100644 --- a/packages/node/src/request.test.ts +++ b/packages/node/src/request.test.ts @@ -1,4 +1,4 @@ -import type { StandardLazyRequest } from '@standardserver/core' +import type { StandardLazyRequest } from '@standard-server/core' import type { IncomingMessage, ServerResponse } from 'node:http' import request from 'supertest' import * as Body from './body' diff --git a/packages/node/src/request.ts b/packages/node/src/request.ts index 3113953..1d6b446 100644 --- a/packages/node/src/request.ts +++ b/packages/node/src/request.ts @@ -1,4 +1,4 @@ -import type { StandardLazyRequest } from '@standardserver/core' +import type { StandardLazyRequest } from '@standard-server/core' import type { NodeHttpRequest, NodeHttpResponse } from './types' import { toStandardBody } from './body' import { toStandardMethod } from './method' diff --git a/packages/node/src/response.test.ts b/packages/node/src/response.test.ts index 76bbe95..2801b6e 100644 --- a/packages/node/src/response.test.ts +++ b/packages/node/src/response.test.ts @@ -1,4 +1,4 @@ -import type { StandardResponse } from '@standardserver/core' +import type { StandardResponse } from '@standard-server/core' import type { IncomingMessage, ServerResponse } from 'node:http' import { Buffer } from 'node:buffer' import Stream from 'node:stream' diff --git a/packages/node/src/response.ts b/packages/node/src/response.ts index 57bf07b..ee66ca3 100644 --- a/packages/node/src/response.ts +++ b/packages/node/src/response.ts @@ -1,4 +1,4 @@ -import type { StandardResponse } from '@standardserver/core' +import type { StandardResponse } from '@standard-server/core' import type { ToNodeHttpBodyOptions } from './body' import type { NodeHttpResponse } from './types' import { toNodeHttpBody } from './body' diff --git a/packages/node/src/signal.test.ts b/packages/node/src/signal.test.ts index 661034c..a052f1b 100644 --- a/packages/node/src/signal.test.ts +++ b/packages/node/src/signal.test.ts @@ -1,6 +1,6 @@ import http2 from 'node:http2' import Stream from 'node:stream' -import { AbortError } from '@standardserver/shared' +import { AbortError } from '@standard-server/shared' import { toAbortSignal } from './signal' describe('toAbortSignal', async () => { diff --git a/packages/node/src/signal.ts b/packages/node/src/signal.ts index a1bfca0..852d7e1 100644 --- a/packages/node/src/signal.ts +++ b/packages/node/src/signal.ts @@ -1,6 +1,6 @@ import type Stream from 'node:stream' import type { NodeHttpResponse } from './types' -import { AbortError } from '@standardserver/shared' +import { AbortError } from '@standard-server/shared' import { canWriteToNodeResponse, getNodeResponseError } from './utils' export function toAbortSignal(stream: Stream.Writable | NodeHttpResponse): AbortSignal { diff --git a/packages/node/src/url.ts b/packages/node/src/url.ts index 7b0cd39..3ceeee9 100644 --- a/packages/node/src/url.ts +++ b/packages/node/src/url.ts @@ -1,6 +1,6 @@ -import type { StandardUrl } from '@standardserver/core' +import type { StandardUrl } from '@standard-server/core' import type { NodeHttpRequest } from './types' -import { toStandardUrl as toStandardUrlFetch } from '@standardserver/fetch' +import { toStandardUrl as toStandardUrlFetch } from '@standard-server/fetch' export function toStandardUrl(req: NodeHttpRequest): StandardUrl { // prefer originalUrl over url, especially useful in express.js middleware diff --git a/packages/peer/README.md b/packages/peer/README.md index ff2f6af..00583ae 100644 --- a/packages/peer/README.md +++ b/packages/peer/README.md @@ -1,41 +1,41 @@ -# @standardserver/peer +# @standard-server/peer -`@standardserver/peer` adapts message-based transports to the transport-agnostic request and response model defined by Standard Server. +`@standard-server/peer` adapts message-based transports to the transport-agnostic request and response model defined by Standard Server. Standard Server provides a unified interface for client-server communication across HTTP and message-based transports. It lets you write handlers and clients against the same request, response, body, and streaming primitives whether the underlying transport is Fetch, Node.js HTTP, WebSocket, MessagePort, or another peer-style channel. Standard Server ships as a small ecosystem of packages: -| Package | Description | -| ------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------- | -| [`@standardserver/core`](https://github.com/middleapi/standardserver/blob/main/packages/core/README.md) | The shared contract: types, body parsing rules, validators, and SSE helpers | -| [`@standardserver/fetch`](https://github.com/middleapi/standardserver/blob/main/packages/fetch/README.md) | Fetch API adapter for browsers, workers, and other Fetch-based runtimes | -| [`@standardserver/node`](https://github.com/middleapi/standardserver/blob/main/packages/node/README.md) | Node.js HTTP and HTTP/2 adapter | -| [`@standardserver/fastify`](https://github.com/middleapi/standardserver/blob/main/packages/fastify/README.md) | Fastify adapter built on the Node.js adapter | -| [`@standardserver/aws-lambda`](https://github.com/middleapi/standardserver/blob/main/packages/aws-lambda/README.md) | AWS Lambda adapter with response streaming | -| [`@standardserver/peer`](https://github.com/middleapi/standardserver/blob/main/packages/peer/README.md) | Message-based adapter for WebSocket, MessagePort, and custom transports | -| [`@standardserver/shared`](https://github.com/middleapi/standardserver/blob/main/packages/shared/README.md) | Internal utilities shared across the ecosystem | +| Package | Description | +| --------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------- | +| [`@standard-server/core`](https://github.com/middleapi/standard-server/blob/main/packages/core/README.md) | The shared contract: types, body parsing rules, validators, and SSE helpers | +| [`@standard-server/fetch`](https://github.com/middleapi/standard-server/blob/main/packages/fetch/README.md) | Fetch API adapter for browsers, workers, and other Fetch-based runtimes | +| [`@standard-server/node`](https://github.com/middleapi/standard-server/blob/main/packages/node/README.md) | Node.js HTTP and HTTP/2 adapter | +| [`@standard-server/fastify`](https://github.com/middleapi/standard-server/blob/main/packages/fastify/README.md) | Fastify adapter built on the Node.js adapter | +| [`@standard-server/aws-lambda`](https://github.com/middleapi/standard-server/blob/main/packages/aws-lambda/README.md) | AWS Lambda adapter with response streaming | +| [`@standard-server/peer`](https://github.com/middleapi/standard-server/blob/main/packages/peer/README.md) | Message-based adapter for WebSocket, MessagePort, and custom transports | +| [`@standard-server/shared`](https://github.com/middleapi/standard-server/blob/main/packages/shared/README.md) | Internal utilities shared across the ecosystem | This package is the peer adapter for that model. It converts between Standard Server requests and responses and a structured peer message protocol that can be sent through any transport capable of carrying strings or binary data. @@ -57,7 +57,7 @@ Use these helpers when you want Standard Server handlers or clients to run over `ClientPeer` starts a request and waits for a `StandardLazyResponse`. `ServerPeer` receives peer messages, reconstructs a `StandardLazyRequest`, calls your handler, and sends the resulting `StandardResponse` back over the same transport. ```ts -import type { StandardLazyRequest, StandardResponse } from '@standardserver/core' +import type { StandardLazyRequest, StandardResponse } from '@standard-server/core' import { ClientPeer, decodePeerMessage, @@ -65,7 +65,7 @@ import { isClientPeerSendMessage, isServerPeerSendMessage, ServerPeer, -} from '@standardserver/peer' +} from '@standard-server/peer' async function handle(request: StandardLazyRequest): Promise { const body = await request.resolveBody() @@ -133,7 +133,7 @@ Unlike the HTTP adapters, `resolveBody(hint?)` ignores the `hint` argument in th Use `encodePeerMessage()` and `decodePeerMessage()` to bridge between the peer protocol and your underlying transport. ```ts -import { decodePeerMessage, encodePeerMessage } from '@standardserver/peer' +import { decodePeerMessage, encodePeerMessage } from '@standard-server/peer' const encoded = await encodePeerMessage( { @@ -159,7 +159,7 @@ Encoding rules: ## Learn more -For the project overview and the shared contract this adapter implements, see the [core documentation](https://github.com/middleapi/standardserver/blob/main/packages/core/README.md). +For the project overview and the shared contract this adapter implements, see the [core documentation](https://github.com/middleapi/standard-server/blob/main/packages/core/README.md). ## Sponsors @@ -247,4 +247,4 @@ With thanks to [36 past sponsors](https://htmlpreview.github.io/?https://github. ## License -Distributed under the MIT License. See [LICENCE](https://github.com/middleapi/standardserver/blob/main/LICENCE) for more information. +Distributed under the MIT License. See [LICENCE](https://github.com/middleapi/standard-server/blob/main/LICENCE) for more information. diff --git a/packages/peer/package.json b/packages/peer/package.json index 2174475..34b18ad 100644 --- a/packages/peer/package.json +++ b/packages/peer/package.json @@ -1,5 +1,5 @@ { - "name": "@standardserver/peer", + "name": "@standard-server/peer", "type": "module", "version": "0.8.3", "description": "Message-based adapter for Standard Server: transport-agnostic requests, responses, and streaming over WebSocket, MessagePort, and custom peer transports", @@ -8,14 +8,13 @@ "https://github.com/sponsors/dinwwwh", "https://opencollective.com/middleapi" ], - "homepage": "https://standardserver.dev", "repository": { "type": "git", - "url": "git+https://github.com/middleapi/standardserver.git", + "url": "git+https://github.com/middleapi/standard-server.git", "directory": "packages/peer" }, "keywords": [ - "standardserver", + "standard-server", "peer", "websocket", "messageport", @@ -50,7 +49,7 @@ "type:check": "tsc -b" }, "dependencies": { - "@standardserver/core": "workspace:*", - "@standardserver/shared": "workspace:*" + "@standard-server/core": "workspace:*", + "@standard-server/shared": "workspace:*" } } diff --git a/packages/peer/src/body.test.ts b/packages/peer/src/body.test.ts index 63b3e60..5ffdc07 100644 --- a/packages/peer/src/body.test.ts +++ b/packages/peer/src/body.test.ts @@ -1,7 +1,7 @@ -import type { StandardBodyHint, StandardHeaders } from '@standardserver/core' +import type { StandardBodyHint, StandardHeaders } from '@standard-server/core' import type { PeerRequestMessage } from './types' -import { generateContentDisposition } from '@standardserver/core' -import { AsyncIteratorClass, isAsyncIteratorObject, Queue } from '@standardserver/shared' +import { generateContentDisposition } from '@standard-server/core' +import { AsyncIteratorClass, isAsyncIteratorObject, Queue } from '@standard-server/shared' import { encodeAtomicStandardBody, toStandardBody } from './body' describe('toStandardBody', () => { diff --git a/packages/peer/src/body.ts b/packages/peer/src/body.ts index 8119c49..ecbc676 100644 --- a/packages/peer/src/body.ts +++ b/packages/peer/src/body.ts @@ -1,8 +1,8 @@ -import type { StandardBody, StandardBodyHint, StandardHeaders } from '@standardserver/core' -import type { AsyncCleanupFn } from '@standardserver/shared' +import type { StandardBody, StandardBodyHint, StandardHeaders } from '@standard-server/core' +import type { AsyncCleanupFn } from '@standard-server/shared' import type { PeerEventStreamMessage, PeerOctetStreamMessage, PeerRequestMessage, PeerResponseMessage } from './types' -import { flattenStandardHeader, generateContentDisposition, getFilenameFromContentDisposition } from '@standardserver/core' -import { isAsyncIteratorObject, Queue } from '@standardserver/shared' +import { flattenStandardHeader, generateContentDisposition, getFilenameFromContentDisposition } from '@standard-server/core' +import { isAsyncIteratorObject, Queue } from '@standard-server/shared' import { toAsyncIteratorObject } from './event-stream' import { toOctetStream } from './octet-stream' diff --git a/packages/peer/src/client.test.ts b/packages/peer/src/client.test.ts index 6faaec2..e541926 100644 --- a/packages/peer/src/client.test.ts +++ b/packages/peer/src/client.test.ts @@ -1,6 +1,6 @@ -import type { StandardLazyResponse, StandardRequest } from '@standardserver/core' +import type { StandardLazyResponse, StandardRequest } from '@standard-server/core' import type { ClientPeerSendMessage, PeerCancelMessage, PeerEventStreamMessage, PeerOctetStreamMessage, PeerRequestMessage, PeerResponseMessage, PeerStreamCancelMessage } from './types' -import { AbortError, AsyncIteratorClass, isAsyncIteratorObject, promiseWithResolvers, sleep } from '@standardserver/shared' +import { AbortError, AsyncIteratorClass, isAsyncIteratorObject, promiseWithResolvers, sleep } from '@standard-server/shared' import * as Body from './body' import { ClientPeer } from './client' diff --git a/packages/peer/src/client.ts b/packages/peer/src/client.ts index 1d6e2bc..c5726d3 100644 --- a/packages/peer/src/client.ts +++ b/packages/peer/src/client.ts @@ -1,7 +1,7 @@ -import type { StandardLazyResponse, StandardRequest } from '@standardserver/core' -import type { Queue } from '@standardserver/shared' +import type { StandardLazyResponse, StandardRequest } from '@standard-server/core' +import type { Queue } from '@standard-server/shared' import type { ClientPeerSendMessage, PeerEventStreamMessage, PeerOctetStreamMessage, ServerPeerSendMessage } from './types' -import { AbortError, hasAnyDefinedValue, isAsyncIteratorObject, SequentialIdGenerator } from '@standardserver/shared' +import { AbortError, hasAnyDefinedValue, isAsyncIteratorObject, SequentialIdGenerator } from '@standard-server/shared' import { encodeAtomicStandardBody, toStandardBody } from './body' import { EventStreamTransmitter } from './event-stream' import { OctetStreamTransmitter } from './octet-stream' diff --git a/packages/peer/src/codec.ts b/packages/peer/src/codec.ts index 0dcbdd9..9d0f8aa 100644 --- a/packages/peer/src/codec.ts +++ b/packages/peer/src/codec.ts @@ -1,5 +1,5 @@ import type { PeerMessage } from './types' -import { stringifyJSON } from '@standardserver/shared' +import { stringifyJSON } from '@standard-server/shared' import { isPeerMessage } from './validators' /** diff --git a/packages/peer/src/event-stream.test.ts b/packages/peer/src/event-stream.test.ts index 28a994c..ed47701 100644 --- a/packages/peer/src/event-stream.test.ts +++ b/packages/peer/src/event-stream.test.ts @@ -1,6 +1,6 @@ import type { PeerEventStreamMessage } from './types' -import { ErrorEvent, unwrapEvent, withEventMeta } from '@standardserver/core' -import { AsyncIteratorClass, Queue, sleep } from '@standardserver/shared' +import { ErrorEvent, unwrapEvent, withEventMeta } from '@standard-server/core' +import { AsyncIteratorClass, Queue, sleep } from '@standard-server/shared' import { EventStreamTransmitter, toAsyncIteratorObject } from './event-stream' describe('toAsyncIteratorObject', () => { diff --git a/packages/peer/src/event-stream.ts b/packages/peer/src/event-stream.ts index 1b8ed65..794f799 100644 --- a/packages/peer/src/event-stream.ts +++ b/packages/peer/src/event-stream.ts @@ -1,7 +1,7 @@ -import type { AsyncCleanupFn, Queue } from '@standardserver/shared' +import type { AsyncCleanupFn, Queue } from '@standard-server/shared' import type { PeerEventStreamMessage } from './types' -import { ErrorEvent, unwrapEvent, withEventMeta } from '@standardserver/core' -import { AsyncIteratorClass, isTypescriptObject } from '@standardserver/shared' +import { ErrorEvent, unwrapEvent, withEventMeta } from '@standard-server/core' +import { AsyncIteratorClass, isTypescriptObject } from '@standard-server/shared' export function toAsyncIteratorObject( queue: Queue, diff --git a/packages/peer/src/hibernation.test.ts b/packages/peer/src/hibernation.test.ts index 1268ff6..a22234d 100644 --- a/packages/peer/src/hibernation.test.ts +++ b/packages/peer/src/hibernation.test.ts @@ -1,4 +1,4 @@ -import { isAsyncIteratorObject } from '@standardserver/shared' +import { isAsyncIteratorObject } from '@standard-server/shared' import { HibernationAsyncIteratorClass } from './hibernation' describe('hibernationAsyncIteratorClass', () => { diff --git a/packages/peer/src/hibernation.ts b/packages/peer/src/hibernation.ts index 1436f25..47946c7 100644 --- a/packages/peer/src/hibernation.ts +++ b/packages/peer/src/hibernation.ts @@ -1,4 +1,4 @@ -import { AsyncIteratorClass } from '@standardserver/shared' +import { AsyncIteratorClass } from '@standard-server/shared' export interface HibernationAsyncIteratorClassCallback { (id: string): void | Promise diff --git a/packages/peer/src/octet-stream.test.ts b/packages/peer/src/octet-stream.test.ts index c3053b6..90f82fb 100644 --- a/packages/peer/src/octet-stream.test.ts +++ b/packages/peer/src/octet-stream.test.ts @@ -1,5 +1,5 @@ import type { PeerOctetStreamMessage } from './types' -import { Queue } from '@standardserver/shared' +import { Queue } from '@standard-server/shared' import { OctetStreamTransmitter, toOctetStream } from './octet-stream' describe('toOctetStream', () => { diff --git a/packages/peer/src/octet-stream.ts b/packages/peer/src/octet-stream.ts index 8af74eb..0ed2744 100644 --- a/packages/peer/src/octet-stream.ts +++ b/packages/peer/src/octet-stream.ts @@ -1,4 +1,4 @@ -import type { AsyncCleanupFn, Queue } from '@standardserver/shared' +import type { AsyncCleanupFn, Queue } from '@standard-server/shared' import type { PeerOctetStreamMessage } from './types' export function toOctetStream( diff --git a/packages/peer/src/server.test.ts b/packages/peer/src/server.test.ts index 0f926b0..649fa9e 100644 --- a/packages/peer/src/server.test.ts +++ b/packages/peer/src/server.test.ts @@ -1,6 +1,6 @@ -import type { StandardLazyRequest, StandardResponse } from '@standardserver/core' +import type { StandardLazyRequest, StandardResponse } from '@standard-server/core' import type { PeerCancelMessage, PeerEventStreamMessage, PeerOctetStreamMessage, PeerRequestMessage, PeerResponseMessage, PeerStreamCancelMessage, ServerPeerSendMessage } from './types' -import { AbortError, AsyncIteratorClass, isAsyncIteratorObject, sleep } from '@standardserver/shared' +import { AbortError, AsyncIteratorClass, isAsyncIteratorObject, sleep } from '@standard-server/shared' import { HibernationAsyncIteratorClass } from './hibernation' import { ServerPeer } from './server' diff --git a/packages/peer/src/server.ts b/packages/peer/src/server.ts index e24df9e..a50db65 100644 --- a/packages/peer/src/server.ts +++ b/packages/peer/src/server.ts @@ -1,7 +1,7 @@ -import type { StandardLazyRequest, StandardResponse } from '@standardserver/core' -import type { Queue } from '@standardserver/shared' +import type { StandardLazyRequest, StandardResponse } from '@standard-server/core' +import type { Queue } from '@standard-server/shared' import type { ClientPeerSendMessage, PeerEventStreamMessage, PeerOctetStreamMessage, PeerResponseMessage, ServerPeerSendMessage } from './types' -import { AbortError, hasAnyDefinedValue, isAsyncIteratorObject } from '@standardserver/shared' +import { AbortError, hasAnyDefinedValue, isAsyncIteratorObject } from '@standard-server/shared' import { encodeAtomicStandardBody, toStandardBody } from './body' import { EventStreamTransmitter } from './event-stream' import { HibernationAsyncIteratorClass } from './hibernation' diff --git a/packages/peer/src/types.ts b/packages/peer/src/types.ts index 7854f07..010ab69 100644 --- a/packages/peer/src/types.ts +++ b/packages/peer/src/types.ts @@ -4,7 +4,7 @@ import type { StandardHeaders, StandardMethod, StandardUrl, -} from '@standardserver/core' +} from '@standard-server/core' /** * Base interface for all peer messages. diff --git a/packages/peer/src/validators.ts b/packages/peer/src/validators.ts index 64170ca..083c037 100644 --- a/packages/peer/src/validators.ts +++ b/packages/peer/src/validators.ts @@ -1,6 +1,6 @@ import type { ClientPeerSendMessage, PeerCancelMessage, PeerEventStreamMessage, PeerMessage, PeerOctetStreamMessage, PeerRequestMessage, PeerResponseMessage, PeerStreamCancelMessage, ServerPeerSendMessage } from './types' -import { isStandardHeaders, isStandardMethod, isStandardStatus, isStandardUrl } from '@standardserver/core' -import { isTypescriptObject } from '@standardserver/shared' +import { isStandardHeaders, isStandardMethod, isStandardStatus, isStandardUrl } from '@standard-server/core' +import { isTypescriptObject } from '@standard-server/shared' export function isPeerMessage(maybe: unknown): maybe is PeerMessage { if (!isTypescriptObject(maybe)) { diff --git a/packages/peer/tests/peer.test.ts b/packages/peer/tests/peer.test.ts index 753a4a2..9b3ec84 100644 --- a/packages/peer/tests/peer.test.ts +++ b/packages/peer/tests/peer.test.ts @@ -1,7 +1,7 @@ -import type { StandardLazyRequest, StandardResponse } from '@standardserver/core' +import type { StandardLazyRequest, StandardResponse } from '@standard-server/core' import type { ClientPeer, ServerPeer } from '../src' import type { ClientPeerSendMessage, ServerPeerSendMessage } from '../src/types' -import { ErrorEvent, getEventMeta, withEventMeta } from '@standardserver/core' +import { ErrorEvent, getEventMeta, withEventMeta } from '@standard-server/core' import { ClientPeer as ClientPeerClass, decodePeerMessage, encodePeerMessage, ServerPeer as ServerPeerClass } from '../src' /** diff --git a/packages/shared/README.md b/packages/shared/README.md index 1ea3dfe..ef3fabb 100644 --- a/packages/shared/README.md +++ b/packages/shared/README.md @@ -1,45 +1,45 @@ -# @standardserver/shared +# @standard-server/shared -`@standardserver/shared` contains internal types and utilities shared across the `@standardserver` ecosystem — small helpers for arrays, objects, JSON, iterators, promises, queues, IDs, URIs, and more. +`@standard-server/shared` contains internal types and utilities shared across the `@standard-server` ecosystem — small helpers for arrays, objects, JSON, iterators, promises, queues, IDs, URIs, and more. -It has no runtime dependencies and works in any JavaScript environment. The package exists so the other `@standardserver` packages can share these building blocks without duplication; its API follows their needs and is not designed for direct use in applications. +It has no runtime dependencies and works in any JavaScript environment. The package exists so the other `@standard-server` packages can share these building blocks without duplication; its API follows their needs and is not designed for direct use in applications. Standard Server ships as a small ecosystem of packages: -| Package | Description | -| ------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------- | -| [`@standardserver/core`](https://github.com/middleapi/standardserver/blob/main/packages/core/README.md) | The shared contract: types, body parsing rules, validators, and SSE helpers | -| [`@standardserver/fetch`](https://github.com/middleapi/standardserver/blob/main/packages/fetch/README.md) | Fetch API adapter for browsers, workers, and other Fetch-based runtimes | -| [`@standardserver/node`](https://github.com/middleapi/standardserver/blob/main/packages/node/README.md) | Node.js HTTP and HTTP/2 adapter | -| [`@standardserver/fastify`](https://github.com/middleapi/standardserver/blob/main/packages/fastify/README.md) | Fastify adapter built on the Node.js adapter | -| [`@standardserver/aws-lambda`](https://github.com/middleapi/standardserver/blob/main/packages/aws-lambda/README.md) | AWS Lambda adapter with response streaming | -| [`@standardserver/peer`](https://github.com/middleapi/standardserver/blob/main/packages/peer/README.md) | Message-based adapter for WebSocket, MessagePort, and custom transports | -| [`@standardserver/shared`](https://github.com/middleapi/standardserver/blob/main/packages/shared/README.md) | Internal utilities shared across the ecosystem | +| Package | Description | +| --------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------- | +| [`@standard-server/core`](https://github.com/middleapi/standard-server/blob/main/packages/core/README.md) | The shared contract: types, body parsing rules, validators, and SSE helpers | +| [`@standard-server/fetch`](https://github.com/middleapi/standard-server/blob/main/packages/fetch/README.md) | Fetch API adapter for browsers, workers, and other Fetch-based runtimes | +| [`@standard-server/node`](https://github.com/middleapi/standard-server/blob/main/packages/node/README.md) | Node.js HTTP and HTTP/2 adapter | +| [`@standard-server/fastify`](https://github.com/middleapi/standard-server/blob/main/packages/fastify/README.md) | Fastify adapter built on the Node.js adapter | +| [`@standard-server/aws-lambda`](https://github.com/middleapi/standard-server/blob/main/packages/aws-lambda/README.md) | AWS Lambda adapter with response streaming | +| [`@standard-server/peer`](https://github.com/middleapi/standard-server/blob/main/packages/peer/README.md) | Message-based adapter for WebSocket, MessagePort, and custom transports | +| [`@standard-server/shared`](https://github.com/middleapi/standard-server/blob/main/packages/shared/README.md) | Internal utilities shared across the ecosystem | ## Learn more -For the project overview and the public contract of the ecosystem, see the [core documentation](https://github.com/middleapi/standardserver/blob/main/packages/core/README.md). +For the project overview and the public contract of the ecosystem, see the [core documentation](https://github.com/middleapi/standard-server/blob/main/packages/core/README.md). ## Sponsors @@ -127,4 +127,4 @@ With thanks to [36 past sponsors](https://htmlpreview.github.io/?https://github. ## License -Distributed under the MIT License. See [LICENCE](https://github.com/middleapi/standardserver/blob/main/LICENCE) for more information. +Distributed under the MIT License. See [LICENCE](https://github.com/middleapi/standard-server/blob/main/LICENCE) for more information. diff --git a/packages/shared/package.json b/packages/shared/package.json index f191094..621fca7 100644 --- a/packages/shared/package.json +++ b/packages/shared/package.json @@ -1,5 +1,5 @@ { - "name": "@standardserver/shared", + "name": "@standard-server/shared", "type": "module", "version": "0.8.3", "description": "Internal types and utilities shared across the Standard Server ecosystem", @@ -8,14 +8,13 @@ "https://github.com/sponsors/dinwwwh", "https://opencollective.com/middleapi" ], - "homepage": "https://standardserver.dev", "repository": { "type": "git", - "url": "git+https://github.com/middleapi/standardserver.git", + "url": "git+https://github.com/middleapi/standard-server.git", "directory": "packages/shared" }, "keywords": [ - "standardserver", + "standard-server", "utils", "utilities", "internal", diff --git a/playgrounds/hono-node/README.md b/playgrounds/hono-node/README.md index ad24a08..4d06eb8 100644 --- a/playgrounds/hono-node/README.md +++ b/playgrounds/hono-node/README.md @@ -1,6 +1,6 @@ -# StandardServer Playground +# Standard Server Playground -This is a playground for [StandardServer](https://standardserver.dev) + [Hono Node Server](https://github.com/honojs/node-server). +This is a playground for [Standard Server](https://github.com/middleapi/standard-server) + [Hono Node Server](https://github.com/honojs/node-server). ## Getting Started diff --git a/playgrounds/hono-node/package.json b/playgrounds/hono-node/package.json index ece1e51..5c1560f 100644 --- a/playgrounds/hono-node/package.json +++ b/playgrounds/hono-node/package.json @@ -1,5 +1,5 @@ { - "name": "@standardserver/hono-node-playground", + "name": "@standard-server/hono-node-playground", "type": "module", "version": "0.8.3", "private": true, @@ -9,8 +9,8 @@ }, "devDependencies": { "@hono/node-server": "^2.0.12", - "@standardserver/core": "latest", - "@standardserver/fetch": "latest", + "@standard-server/core": "latest", + "@standard-server/fetch": "latest", "@types/node": "^26.4.1", "tsx": "^4.22.4", "typescript": "^6.0.3" diff --git a/playgrounds/hono-node/src/main.ts b/playgrounds/hono-node/src/main.ts index 54c8164..e0e09ab 100644 --- a/playgrounds/hono-node/src/main.ts +++ b/playgrounds/hono-node/src/main.ts @@ -1,6 +1,6 @@ -import type { StandardLazyRequest, StandardResponse } from '@standardserver/core' +import type { StandardLazyRequest, StandardResponse } from '@standard-server/core' import { serve } from '@hono/node-server' -import { toFetchResponse, toStandardLazyRequest } from '@standardserver/fetch' +import { toFetchResponse, toStandardLazyRequest } from '@standard-server/fetch' async function main(request: StandardLazyRequest): Promise { return { diff --git a/playgrounds/node-http/README.md b/playgrounds/node-http/README.md index 3720df5..9527c0e 100644 --- a/playgrounds/node-http/README.md +++ b/playgrounds/node-http/README.md @@ -1,6 +1,6 @@ -# StandardServer Playground +# Standard Server Playground -This is a playground for [StandardServer](https://standardserver.dev) + [Node.js HTTP](https://nodejs.org/api/http.html). +This is a playground for [Standard Server](https://github.com/middleapi/standard-server) + [Node.js HTTP](https://nodejs.org/api/http.html). ## Getting Started diff --git a/playgrounds/node-http/package.json b/playgrounds/node-http/package.json index 405c27c..1582e40 100644 --- a/playgrounds/node-http/package.json +++ b/playgrounds/node-http/package.json @@ -1,5 +1,5 @@ { - "name": "@standardserver/node-http-playground", + "name": "@standard-server/node-http-playground", "type": "module", "version": "0.8.3", "private": true, @@ -8,8 +8,8 @@ "type:check": "tsc --noEmit" }, "devDependencies": { - "@standardserver/core": "latest", - "@standardserver/node": "latest", + "@standard-server/core": "latest", + "@standard-server/node": "latest", "@types/node": "^26.4.1", "tsx": "^4.22.4", "typescript": "^6.0.3" diff --git a/playgrounds/node-http/src/main.ts b/playgrounds/node-http/src/main.ts index cf19c5e..e8ecf88 100644 --- a/playgrounds/node-http/src/main.ts +++ b/playgrounds/node-http/src/main.ts @@ -1,7 +1,7 @@ -import type { StandardLazyRequest, StandardResponse } from '@standardserver/core' +import type { StandardLazyRequest, StandardResponse } from '@standard-server/core' import { createServer } from 'node:http' -import { sendStandardResponse, toStandardLazyRequest } from '@standardserver/node' +import { sendStandardResponse, toStandardLazyRequest } from '@standard-server/node' async function main(request: StandardLazyRequest): Promise { return { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 51695a9..fe1589e 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -121,22 +121,22 @@ importers: '@remix-run/node-fetch-server': specifier: ^0.14.0 version: 0.14.1 - '@standardserver/core': + '@standard-server/core': specifier: workspace:* version: link:packages/core - '@standardserver/fastify': + '@standard-server/fastify': specifier: workspace:* version: link:packages/fastify - '@standardserver/fetch': + '@standard-server/fetch': specifier: workspace:* version: link:packages/fetch - '@standardserver/node': + '@standard-server/node': specifier: workspace:* version: link:packages/node - '@standardserver/peer': + '@standard-server/peer': specifier: workspace:* version: link:packages/peer - '@standardserver/shared': + '@standard-server/shared': specifier: workspace:* version: link:packages/shared '@types/express': @@ -208,16 +208,16 @@ importers: packages/aws-lambda: dependencies: - '@standardserver/core': + '@standard-server/core': specifier: workspace:* version: link:../core - '@standardserver/fetch': + '@standard-server/fetch': specifier: workspace:* version: link:../fetch - '@standardserver/node': + '@standard-server/node': specifier: workspace:* version: link:../node - '@standardserver/shared': + '@standard-server/shared': specifier: workspace:* version: link:../shared devDependencies: @@ -230,16 +230,16 @@ importers: packages/core: dependencies: - '@standardserver/shared': + '@standard-server/shared': specifier: workspace:* version: link:../shared packages/fastify: dependencies: - '@standardserver/core': + '@standard-server/core': specifier: workspace:* version: link:../core - '@standardserver/node': + '@standard-server/node': specifier: workspace:* version: link:../node devDependencies: @@ -261,22 +261,22 @@ importers: packages/fetch: dependencies: - '@standardserver/core': + '@standard-server/core': specifier: workspace:* version: link:../core - '@standardserver/shared': + '@standard-server/shared': specifier: workspace:* version: link:../shared packages/node: dependencies: - '@standardserver/core': + '@standard-server/core': specifier: workspace:* version: link:../core - '@standardserver/fetch': + '@standard-server/fetch': specifier: workspace:* version: link:../fetch - '@standardserver/shared': + '@standard-server/shared': specifier: workspace:* version: link:../shared devDependencies: @@ -292,10 +292,10 @@ importers: packages/peer: dependencies: - '@standardserver/core': + '@standard-server/core': specifier: workspace:* version: link:../core - '@standardserver/shared': + '@standard-server/shared': specifier: workspace:* version: link:../shared @@ -306,10 +306,10 @@ importers: '@hono/node-server': specifier: ^2.0.12 version: 2.1.1(hono@4.13.5) - '@standardserver/core': + '@standard-server/core': specifier: latest version: link:../../packages/core - '@standardserver/fetch': + '@standard-server/fetch': specifier: latest version: link:../../packages/fetch '@types/node': @@ -324,10 +324,10 @@ importers: playgrounds/node-http: devDependencies: - '@standardserver/core': + '@standard-server/core': specifier: latest version: link:../../packages/core - '@standardserver/node': + '@standard-server/node': specifier: latest version: link:../../packages/node '@types/node': @@ -342,16 +342,16 @@ importers: tests/bun: devDependencies: - '@standardserver/core': + '@standard-server/core': specifier: workspace:* version: link:../../packages/core - '@standardserver/fetch': + '@standard-server/fetch': specifier: workspace:* version: link:../../packages/fetch - '@standardserver/peer': + '@standard-server/peer': specifier: workspace:* version: link:../../packages/peer - '@standardserver/shared': + '@standard-server/shared': specifier: workspace:* version: link:../../packages/shared '@types/bun': @@ -360,16 +360,16 @@ importers: tests/deno: devDependencies: - '@standardserver/core': + '@standard-server/core': specifier: workspace:* version: link:../../packages/core - '@standardserver/fetch': + '@standard-server/fetch': specifier: workspace:* version: link:../../packages/fetch - '@standardserver/peer': + '@standard-server/peer': specifier: workspace:* version: link:../../packages/peer - '@standardserver/shared': + '@standard-server/shared': specifier: workspace:* version: link:../../packages/shared '@std/expect': diff --git a/tests/bun/README.md b/tests/bun/README.md index b096f78..5782018 100644 --- a/tests/bun/README.md +++ b/tests/bun/README.md @@ -1,4 +1,4 @@ -# @standardserver/bun +# @standard-server/bun ## Sponsors diff --git a/tests/bun/package.json b/tests/bun/package.json index 54d3cd7..15c54f4 100644 --- a/tests/bun/package.json +++ b/tests/bun/package.json @@ -1,12 +1,11 @@ { - "name": "@standardserver/bun", + "name": "@standard-server/bun", "type": "module", "version": "0.8.3", "license": "MIT", - "homepage": "https://standardserver.dev", "repository": { "type": "git", - "url": "git+https://github.com/middleapi/standardserver.git", + "url": "git+https://github.com/middleapi/standard-server.git", "directory": "packages/bun" }, "files": [ @@ -17,10 +16,10 @@ "test": "bun test" }, "devDependencies": { - "@standardserver/core": "workspace:*", - "@standardserver/fetch": "workspace:*", - "@standardserver/peer": "workspace:*", - "@standardserver/shared": "workspace:*", + "@standard-server/core": "workspace:*", + "@standard-server/fetch": "workspace:*", + "@standard-server/peer": "workspace:*", + "@standard-server/shared": "workspace:*", "@types/bun": "^1.4.0" } } diff --git a/tests/bun/tests/client-server.bun-fetch.ts b/tests/bun/tests/client-server.bun-fetch.ts index ae3f0f5..2aa025a 100644 --- a/tests/bun/tests/client-server.bun-fetch.ts +++ b/tests/bun/tests/client-server.bun-fetch.ts @@ -1,5 +1,5 @@ import type { ClientServerHandler, ClientServerTest } from './client-server' -import { toFetchBody, toFetchHeaders, toFetchResponse, toStandardLazyRequest, toStandardLazyResponse } from '@standardserver/fetch' +import { toFetchBody, toFetchHeaders, toFetchResponse, toStandardLazyRequest, toStandardLazyResponse } from '@standard-server/fetch' import { NOT_FOUND_HANDLER } from './client-server' export function createBunFetchClientServerTest(): ClientServerTest { diff --git a/tests/bun/tests/client-server.bun-ws.ts b/tests/bun/tests/client-server.bun-ws.ts index 201a38a..bae27d6 100644 --- a/tests/bun/tests/client-server.bun-ws.ts +++ b/tests/bun/tests/client-server.bun-ws.ts @@ -1,5 +1,5 @@ import type { ClientServerHandler, ClientServerTest } from './client-server' -import { ClientPeer, decodePeerMessage, encodePeerMessage, isClientPeerSendMessage, isServerPeerSendMessage, ServerPeer } from '@standardserver/peer' +import { ClientPeer, decodePeerMessage, encodePeerMessage, isClientPeerSendMessage, isServerPeerSendMessage, ServerPeer } from '@standard-server/peer' import { NOT_FOUND_HANDLER, toEncodedPeerMessage } from './client-server' export function createBunWsClientServerTest(): ClientServerTest { diff --git a/tests/bun/tests/client-server.ts b/tests/bun/tests/client-server.ts index f1d99e1..57b5063 100644 --- a/tests/bun/tests/client-server.ts +++ b/tests/bun/tests/client-server.ts @@ -1,5 +1,5 @@ -import type { StandardLazyRequest, StandardLazyResponse, StandardRequest, StandardResponse } from '@standardserver/core' -import { sleep } from '@standardserver/shared' +import type { StandardLazyRequest, StandardLazyResponse, StandardRequest, StandardResponse } from '@standard-server/core' +import { sleep } from '@standard-server/shared' export type ClientServerHandler = (request: StandardLazyRequest) => Promise diff --git a/tests/bun/tests/data-transfer.test.ts b/tests/bun/tests/data-transfer.test.ts index d32fe32..7850b62 100644 --- a/tests/bun/tests/data-transfer.test.ts +++ b/tests/bun/tests/data-transfer.test.ts @@ -1,6 +1,6 @@ -import type { StandardHeaders } from '@standardserver/core' -import { ErrorEvent, unwrapEvent, withEventMeta } from '@standardserver/core' -import { isAsyncIteratorObject, sleep } from '@standardserver/shared' +import type { StandardHeaders } from '@standard-server/core' +import { ErrorEvent, unwrapEvent, withEventMeta } from '@standard-server/core' +import { isAsyncIteratorObject, sleep } from '@standard-server/shared' import { afterAll, beforeEach, describe, expect, it } from 'bun:test' import { NOT_FOUND_HANDLER } from './client-server' import { createBunFetchClientServerTest } from './client-server.bun-fetch' diff --git a/tests/bun/tests/signal-and-cancel.test.ts b/tests/bun/tests/signal-and-cancel.test.ts index 60f42fa..b6f9680 100644 --- a/tests/bun/tests/signal-and-cancel.test.ts +++ b/tests/bun/tests/signal-and-cancel.test.ts @@ -1,4 +1,4 @@ -import { AsyncIteratorClass, isAsyncIteratorObject, sleep } from '@standardserver/shared' +import { AsyncIteratorClass, isAsyncIteratorObject, sleep } from '@standard-server/shared' import { afterAll, beforeEach, describe, expect, it } from 'bun:test' import { NOT_FOUND_HANDLER, waitFor } from './client-server' import { createBunFetchClientServerTest } from './client-server.bun-fetch' diff --git a/tests/client-server.expressjs.ts b/tests/client-server.expressjs.ts index 8c818df..5f18b9d 100644 --- a/tests/client-server.expressjs.ts +++ b/tests/client-server.expressjs.ts @@ -1,7 +1,7 @@ import type { AddressInfo } from 'node:net' import type { ClientServerTest } from './client-server' -import { toFetchBody, toFetchHeaders, toStandardLazyResponse } from '@standardserver/fetch' -import { sendStandardResponse, toStandardLazyRequest } from '@standardserver/node' +import { toFetchBody, toFetchHeaders, toStandardLazyResponse } from '@standard-server/fetch' +import { sendStandardResponse, toStandardLazyRequest } from '@standard-server/node' import express from 'express' export interface ExpressjsClientServerTestOptions { diff --git a/tests/client-server.fastify.ts b/tests/client-server.fastify.ts index 6a72a8f..583611d 100644 --- a/tests/client-server.fastify.ts +++ b/tests/client-server.fastify.ts @@ -1,6 +1,6 @@ import type { ClientServerTest } from './client-server' -import { sendStandardResponse, toStandardLazyRequest } from '@standardserver/fastify' -import { toFetchBody, toFetchHeaders, toStandardLazyResponse } from '@standardserver/fetch' +import { sendStandardResponse, toStandardLazyRequest } from '@standard-server/fastify' +import { toFetchBody, toFetchHeaders, toStandardLazyResponse } from '@standard-server/fetch' import Fastify from 'fastify' export function createFastifyClientServerTest(): ClientServerTest { diff --git a/tests/client-server.h3-node-handler.ts b/tests/client-server.h3-node-handler.ts index 56f30fa..ab9ed77 100644 --- a/tests/client-server.h3-node-handler.ts +++ b/tests/client-server.h3-node-handler.ts @@ -1,6 +1,6 @@ import type { ClientServerTest } from './client-server' -import { toFetchBody, toFetchHeaders, toStandardLazyResponse } from '@standardserver/fetch' -import { sendStandardResponse, toStandardLazyRequest } from '@standardserver/node' +import { toFetchBody, toFetchHeaders, toStandardLazyResponse } from '@standard-server/fetch' +import { sendStandardResponse, toStandardLazyRequest } from '@standard-server/node' import { fromNodeHandler, H3, serve } from 'h3' export function createH3NodeHandlerClientServerTest(): ClientServerTest { diff --git a/tests/client-server.h3-web-handler.ts b/tests/client-server.h3-web-handler.ts index abe7ae9..0624c85 100644 --- a/tests/client-server.h3-web-handler.ts +++ b/tests/client-server.h3-web-handler.ts @@ -1,5 +1,5 @@ import type { ClientServerTest } from './client-server' -import { toFetchBody, toFetchHeaders, toFetchResponse, toStandardLazyRequest, toStandardLazyResponse } from '@standardserver/fetch' +import { toFetchBody, toFetchHeaders, toFetchResponse, toStandardLazyRequest, toStandardLazyResponse } from '@standard-server/fetch' import { fromWebHandler, H3, serve } from 'h3' export function createH3WebHandlerClientServerTest(): ClientServerTest { diff --git a/tests/client-server.hono-fetch.ts b/tests/client-server.hono-fetch.ts index 2e0f096..d43b084 100644 --- a/tests/client-server.hono-fetch.ts +++ b/tests/client-server.hono-fetch.ts @@ -1,7 +1,7 @@ import type { AddressInfo } from 'node:net' import type { ClientServerTest } from './client-server' import { serve } from '@hono/node-server' -import { toFetchBody, toFetchHeaders, toFetchResponse, toStandardLazyRequest, toStandardLazyResponse } from '@standardserver/fetch' +import { toFetchBody, toFetchHeaders, toFetchResponse, toStandardLazyRequest, toStandardLazyResponse } from '@standard-server/fetch' export function createHonoFetchClientServerTest(): ClientServerTest { const handler: ClientServerTest['handler'] = vi.fn(async () => { diff --git a/tests/client-server.inprogress-fetch.ts b/tests/client-server.inprogress-fetch.ts index 546ec6d..26500c7 100644 --- a/tests/client-server.inprogress-fetch.ts +++ b/tests/client-server.inprogress-fetch.ts @@ -1,5 +1,5 @@ import type { ClientServerTest } from './client-server' -import { toFetchBody, toFetchHeaders, toFetchResponse, toStandardLazyRequest, toStandardLazyResponse } from '@standardserver/fetch' +import { toFetchBody, toFetchHeaders, toFetchResponse, toStandardLazyRequest, toStandardLazyResponse } from '@standard-server/fetch' export function createInprogressFetchClientServerTest(): ClientServerTest { const handler: ClientServerTest['handler'] = vi.fn(async () => { diff --git a/tests/client-server.message-port.ts b/tests/client-server.message-port.ts index 8873800..6d117fc 100644 --- a/tests/client-server.message-port.ts +++ b/tests/client-server.message-port.ts @@ -1,6 +1,6 @@ import type { ClientServerTest } from './client-server' import type { PeerClientServerTestOptions } from './client-server.peer' -import { ClientPeer, decodePeerMessage, isClientPeerSendMessage, isServerPeerSendMessage, ServerPeer } from '@standardserver/peer' +import { ClientPeer, decodePeerMessage, isClientPeerSendMessage, isServerPeerSendMessage, ServerPeer } from '@standard-server/peer' import { expectPeerRequestsCleanedUpAfterEach, peerPrefix, randomEncodePeerMessage, toFetchStreamedStandardRequest, wrapFetchStreamedServerHandler } from './client-server.peer' export function createMessagePortClientServerTest(options: PeerClientServerTestOptions = {}): ClientServerTest { diff --git a/tests/client-server.node-fetch-server.ts b/tests/client-server.node-fetch-server.ts index a816bee..d188c15 100644 --- a/tests/client-server.node-fetch-server.ts +++ b/tests/client-server.node-fetch-server.ts @@ -2,7 +2,7 @@ import type { AddressInfo } from 'node:net' import type { ClientServerTest } from './client-server' import * as http from 'node:http' import { createRequestListener } from '@remix-run/node-fetch-server' -import { toFetchBody, toFetchHeaders, toFetchResponse, toStandardLazyRequest, toStandardLazyResponse } from '@standardserver/fetch' +import { toFetchBody, toFetchHeaders, toFetchResponse, toStandardLazyRequest, toStandardLazyResponse } from '@standard-server/fetch' export function createNodeFetchServerClientServerTest(): ClientServerTest { const handler: ClientServerTest['handler'] = vi.fn(async () => { diff --git a/tests/client-server.node-http.ts b/tests/client-server.node-http.ts index 6d59699..fc4fe1f 100644 --- a/tests/client-server.node-http.ts +++ b/tests/client-server.node-http.ts @@ -1,8 +1,8 @@ import type { AddressInfo } from 'node:net' import type { ClientServerTest } from './client-server' import * as http from 'node:http' -import { toFetchBody, toFetchHeaders, toStandardLazyResponse } from '@standardserver/fetch' -import { sendStandardResponse, toStandardLazyRequest } from '@standardserver/node' +import { toFetchBody, toFetchHeaders, toStandardLazyResponse } from '@standard-server/fetch' +import { sendStandardResponse, toStandardLazyRequest } from '@standard-server/node' export function createNodeHttpClientServerTest(): ClientServerTest { const handler: ClientServerTest['handler'] = vi.fn(async () => { diff --git a/tests/client-server.node-http2.ts b/tests/client-server.node-http2.ts index 37d6c24..de1117d 100644 --- a/tests/client-server.node-http2.ts +++ b/tests/client-server.node-http2.ts @@ -3,8 +3,8 @@ import type { AddressInfo } from 'node:net' import type { ClientServerTest } from './client-server' import * as http2 from 'node:http2' import { Readable } from 'node:stream' -import { toFetchBody, toFetchHeaders, toStandardLazyResponse } from '@standardserver/fetch' -import { sendStandardResponse, toStandardLazyRequest } from '@standardserver/node' +import { toFetchBody, toFetchHeaders, toStandardLazyResponse } from '@standard-server/fetch' +import { sendStandardResponse, toStandardLazyRequest } from '@standard-server/node' import { generateTlsCert } from './tls' export interface NodeHttp2ClientServerTestOptions { diff --git a/tests/client-server.node-https.ts b/tests/client-server.node-https.ts index de476a6..724662a 100644 --- a/tests/client-server.node-https.ts +++ b/tests/client-server.node-https.ts @@ -3,8 +3,8 @@ import type { AddressInfo } from 'node:net' import type { ClientServerTest } from './client-server' import * as https from 'node:https' import { Readable } from 'node:stream' -import { toFetchBody, toFetchHeaders, toStandardLazyResponse } from '@standardserver/fetch' -import { sendStandardResponse, toStandardLazyRequest } from '@standardserver/node' +import { toFetchBody, toFetchHeaders, toStandardLazyResponse } from '@standard-server/fetch' +import { sendStandardResponse, toStandardLazyRequest } from '@standard-server/node' import { generateTlsCert } from './tls' export function createNodeHttpsClientServerTest(): ClientServerTest { diff --git a/tests/client-server.node-srvx.ts b/tests/client-server.node-srvx.ts index a71bf57..ca67603 100644 --- a/tests/client-server.node-srvx.ts +++ b/tests/client-server.node-srvx.ts @@ -1,5 +1,5 @@ import type { ClientServerTest } from './client-server' -import { toFetchBody, toFetchHeaders, toFetchResponse, toStandardLazyRequest, toStandardLazyResponse } from '@standardserver/fetch' +import { toFetchBody, toFetchHeaders, toFetchResponse, toStandardLazyRequest, toStandardLazyResponse } from '@standard-server/fetch' import { serve } from 'srvx/node' diff --git a/tests/client-server.node-ws.ts b/tests/client-server.node-ws.ts index 42cc741..5c73ab2 100644 --- a/tests/client-server.node-ws.ts +++ b/tests/client-server.node-ws.ts @@ -1,6 +1,6 @@ import type { ClientServerTest } from './client-server' import type { PeerClientServerTestOptions } from './client-server.peer' -import { ClientPeer, decodePeerMessage, isClientPeerSendMessage, isServerPeerSendMessage, ServerPeer } from '@standardserver/peer' +import { ClientPeer, decodePeerMessage, isClientPeerSendMessage, isServerPeerSendMessage, ServerPeer } from '@standard-server/peer' import { WebSocket, WebSocketServer } from 'ws' import { expectPeerRequestsCleanedUpAfterEach, peerPrefix, randomEncodePeerMessage, toFetchStreamedStandardRequest, wrapFetchStreamedServerHandler, wsMessageDataToEncoded } from './client-server.peer' diff --git a/tests/client-server.peer.ts b/tests/client-server.peer.ts index 2fb8900..f2f9cd3 100644 --- a/tests/client-server.peer.ts +++ b/tests/client-server.peer.ts @@ -1,9 +1,9 @@ -import type { StandardLazyRequest, StandardRequest, StandardResponse } from '@standardserver/core' -import type { ClientPeer, PeerMessage, ServerPeer } from '@standardserver/peer' +import type { StandardLazyRequest, StandardRequest, StandardResponse } from '@standard-server/core' +import type { ClientPeer, PeerMessage, ServerPeer } from '@standard-server/peer' import type { BlobPart } from 'node:buffer' import type { ClientServerTest } from './client-server' -import { toFetchBody, toFetchHeaders, toStandardBody } from '@standardserver/fetch' -import { encodePeerMessage } from '@standardserver/peer' +import { toFetchBody, toFetchHeaders, toStandardBody } from '@standard-server/fetch' +import { encodePeerMessage } from '@standard-server/peer' export const peerPrefix = '__PREFIX__' diff --git a/tests/client-server.ts b/tests/client-server.ts index fb82e37..e212903 100644 --- a/tests/client-server.ts +++ b/tests/client-server.ts @@ -1,5 +1,5 @@ -import type { StandardLazyRequest, StandardLazyResponse, StandardRequest, StandardResponse } from '@standardserver/core' -import type { ClientPeerSendMessage, ServerPeerSendMessage } from '@standardserver/peer' +import type { StandardLazyRequest, StandardLazyResponse, StandardRequest, StandardResponse } from '@standard-server/core' +import type { ClientPeerSendMessage, ServerPeerSendMessage } from '@standard-server/peer' import type { Mock } from 'vitest' export interface ClientServerTest { diff --git a/tests/data-transfer.test.ts b/tests/data-transfer.test.ts index 18f8e4a..5ac313e 100644 --- a/tests/data-transfer.test.ts +++ b/tests/data-transfer.test.ts @@ -1,5 +1,5 @@ -import { ErrorEvent, unwrapEvent, withEventMeta } from '@standardserver/core' -import { isAsyncIteratorObject, sleep } from '@standardserver/shared' +import { ErrorEvent, unwrapEvent, withEventMeta } from '@standard-server/core' +import { isAsyncIteratorObject, sleep } from '@standard-server/shared' import { expectPeerMessages } from './client-server' import { createExpressjsClientServerTest } from './client-server.expressjs' import { createFastifyClientServerTest } from './client-server.fastify' diff --git a/tests/deno/README.md b/tests/deno/README.md index def60e9..b59b8cd 100644 --- a/tests/deno/README.md +++ b/tests/deno/README.md @@ -1,4 +1,4 @@ -# @standardserver/deno +# @standard-server/deno ## Sponsors diff --git a/tests/deno/package.json b/tests/deno/package.json index 5f06111..2572104 100644 --- a/tests/deno/package.json +++ b/tests/deno/package.json @@ -1,12 +1,11 @@ { - "name": "@standardserver/deno", + "name": "@standard-server/deno", "type": "module", "version": "0.8.3", "license": "MIT", - "homepage": "https://standardserver.dev", "repository": { "type": "git", - "url": "git+https://github.com/middleapi/standardserver.git", + "url": "git+https://github.com/middleapi/standard-server.git", "directory": "packages/deno" }, "files": [ @@ -17,10 +16,10 @@ "test": "deno test --no-check --unstable-sloppy-imports --allow-net tests/" }, "devDependencies": { - "@standardserver/core": "workspace:*", - "@standardserver/fetch": "workspace:*", - "@standardserver/peer": "workspace:*", - "@standardserver/shared": "workspace:*", + "@standard-server/core": "workspace:*", + "@standard-server/fetch": "workspace:*", + "@standard-server/peer": "workspace:*", + "@standard-server/shared": "workspace:*", "@std/expect": "jsr:^1.0.20", "@std/testing": "jsr:^1.0.19", "@types/deno": "^2.7.0" diff --git a/tests/deno/tests/client-server.deno-fetch.ts b/tests/deno/tests/client-server.deno-fetch.ts index cea6004..20e7942 100644 --- a/tests/deno/tests/client-server.deno-fetch.ts +++ b/tests/deno/tests/client-server.deno-fetch.ts @@ -1,5 +1,5 @@ import type { ClientServerHandler, ClientServerTest } from './client-server' -import { toFetchBody, toFetchHeaders, toFetchResponse, toStandardLazyRequest, toStandardLazyResponse } from '@standardserver/fetch' +import { toFetchBody, toFetchHeaders, toFetchResponse, toStandardLazyRequest, toStandardLazyResponse } from '@standard-server/fetch' import { NOT_FOUND_HANDLER } from './client-server' export function createDenoFetchClientServerTest(): ClientServerTest { diff --git a/tests/deno/tests/client-server.deno-ws.ts b/tests/deno/tests/client-server.deno-ws.ts index 20a0eed..eb87883 100644 --- a/tests/deno/tests/client-server.deno-ws.ts +++ b/tests/deno/tests/client-server.deno-ws.ts @@ -1,5 +1,5 @@ import type { ClientServerHandler, ClientServerTest } from './client-server' -import { ClientPeer, decodePeerMessage, encodePeerMessage, isClientPeerSendMessage, isServerPeerSendMessage, ServerPeer } from '@standardserver/peer' +import { ClientPeer, decodePeerMessage, encodePeerMessage, isClientPeerSendMessage, isServerPeerSendMessage, ServerPeer } from '@standard-server/peer' import { NOT_FOUND_HANDLER, toEncodedPeerMessage } from './client-server' export function createDenoWsClientServerTest(): ClientServerTest { diff --git a/tests/deno/tests/client-server.ts b/tests/deno/tests/client-server.ts index f1d99e1..57b5063 100644 --- a/tests/deno/tests/client-server.ts +++ b/tests/deno/tests/client-server.ts @@ -1,5 +1,5 @@ -import type { StandardLazyRequest, StandardLazyResponse, StandardRequest, StandardResponse } from '@standardserver/core' -import { sleep } from '@standardserver/shared' +import type { StandardLazyRequest, StandardLazyResponse, StandardRequest, StandardResponse } from '@standard-server/core' +import { sleep } from '@standard-server/shared' export type ClientServerHandler = (request: StandardLazyRequest) => Promise diff --git a/tests/deno/tests/data-transfer.test.ts b/tests/deno/tests/data-transfer.test.ts index d1cfa91..fc6df41 100644 --- a/tests/deno/tests/data-transfer.test.ts +++ b/tests/deno/tests/data-transfer.test.ts @@ -1,6 +1,6 @@ -import type { StandardHeaders } from '@standardserver/core' -import { ErrorEvent, unwrapEvent, withEventMeta } from '@standardserver/core' -import { isAsyncIteratorObject, sleep } from '@standardserver/shared' +import type { StandardHeaders } from '@standard-server/core' +import { ErrorEvent, unwrapEvent, withEventMeta } from '@standard-server/core' +import { isAsyncIteratorObject, sleep } from '@standard-server/shared' import { expect } from '@std/expect' import { afterAll, beforeEach, describe, it } from '@std/testing/bdd' import { NOT_FOUND_HANDLER } from './client-server' diff --git a/tests/deno/tests/signal-and-cancel.test.ts b/tests/deno/tests/signal-and-cancel.test.ts index 82ba37e..5709007 100644 --- a/tests/deno/tests/signal-and-cancel.test.ts +++ b/tests/deno/tests/signal-and-cancel.test.ts @@ -1,4 +1,4 @@ -import { AsyncIteratorClass, isAsyncIteratorObject, sleep } from '@standardserver/shared' +import { AsyncIteratorClass, isAsyncIteratorObject, sleep } from '@standard-server/shared' import { expect } from '@std/expect' import { afterAll, beforeEach, describe, it } from '@std/testing/bdd' import { NOT_FOUND_HANDLER, waitFor } from './client-server' diff --git a/tests/signal-and-cancel.test.ts b/tests/signal-and-cancel.test.ts index 8a6a5b4..dedb7ac 100644 --- a/tests/signal-and-cancel.test.ts +++ b/tests/signal-and-cancel.test.ts @@ -1,4 +1,4 @@ -import { AsyncIteratorClass, isAsyncIteratorObject, sleep } from '@standardserver/shared' +import { AsyncIteratorClass, isAsyncIteratorObject, sleep } from '@standard-server/shared' import { expectPeerMessages } from './client-server' import { createExpressjsClientServerTest } from './client-server.expressjs' import { createFastifyClientServerTest } from './client-server.fastify' From b693dc8035f91fea6926cd4b0b42fa73214ad6ca Mon Sep 17 00:00:00 2001 From: Dinh Le Date: Sun, 6 Sep 2026 15:23:08 +0700 Subject: [PATCH 2/2] chore: rename event meta symbol registry keys to `STANDARD_SERVER_*` The `Symbol.for` keys used to tag event-stream values now follow the `@standard-server` naming. Values tagged by the old `@standardserver/core` package are no longer recognized by this one, which is acceptable since the scope rename already prevents the two from being installed as the same dependency. --- packages/core/src/event-stream/meta.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/core/src/event-stream/meta.ts b/packages/core/src/event-stream/meta.ts index 13add23..15fd9c9 100644 --- a/packages/core/src/event-stream/meta.ts +++ b/packages/core/src/event-stream/meta.ts @@ -2,8 +2,8 @@ import type { EventMeta } from './types' import { getOrBind, isTypescriptObject } from '@standard-server/shared' import { assertEventStreamMessageComment, assertEventStreamMessageId, assertEventStreamMessageRetry } from './encoder' -const EVENT_META_SYMBOL = Symbol.for('STANDARDSERVER_EVENT_META') -const EVENT_SOURCE_SYMBOL = Symbol.for('STANDARDSERVER_EVENT_SOURCE') +const EVENT_META_SYMBOL = Symbol.for('STANDARD_SERVER_EVENT_META') +const EVENT_SOURCE_SYMBOL = Symbol.for('STANDARD_SERVER_EVENT_SOURCE') /** * Returns a new iterator *event value* with attached, validated metadata.