chore: switch to module ESNext + moduleResolution bundler (#2095)
This commit is contained in:
parent
c59dc3aa1a
commit
ee732d64b6
30 changed files with 668 additions and 863 deletions
|
|
@ -43,9 +43,9 @@ import { importSPKI, jwtVerify } from 'jose';
|
|||
import { expect, vi } from 'vitest';
|
||||
import { z } from 'zod/v4';
|
||||
|
||||
import { hostPerSession } from '../helpers/index.js';
|
||||
import { verifies } from '../helpers/verifies.js';
|
||||
import type { TestArgs } from '../types.js';
|
||||
import { hostPerSession } from '../helpers/index';
|
||||
import { verifies } from '../helpers/verifies';
|
||||
import type { TestArgs } from '../types';
|
||||
|
||||
const ISSUER = 'https://auth.example.com';
|
||||
const MCP_URL = 'http://in-process/mcp';
|
||||
|
|
|
|||
|
|
@ -12,9 +12,9 @@ import { completable, McpServer, ProtocolError, ProtocolErrorCode, ResourceTempl
|
|||
import { expect } from 'vitest';
|
||||
import { z } from 'zod/v4';
|
||||
|
||||
import { wire } from '../helpers/index.js';
|
||||
import { verifies } from '../helpers/verifies.js';
|
||||
import type { TestArgs } from '../types.js';
|
||||
import { wire } from '../helpers/index';
|
||||
import { verifies } from '../helpers/verifies';
|
||||
import type { TestArgs } from '../types';
|
||||
|
||||
const COLORS = ['red', 'green', 'blue', 'rebeccapurple'] as const;
|
||||
const FILE_PATHS = ['README.md', 'src/index.ts', 'src/types.ts'] as const;
|
||||
|
|
|
|||
|
|
@ -15,9 +15,9 @@ import { McpServer, ProtocolErrorCode, Server } from '@modelcontextprotocol/serv
|
|||
import { expect, vi } from 'vitest';
|
||||
import { z } from 'zod/v4';
|
||||
|
||||
import { wire } from '../helpers/index.js';
|
||||
import { verifies } from '../helpers/verifies.js';
|
||||
import type { TestArgs } from '../types.js';
|
||||
import { wire } from '../helpers/index';
|
||||
import { verifies } from '../helpers/verifies';
|
||||
import type { TestArgs } from '../types';
|
||||
|
||||
verifies('custom-methods:server-handler:roundtrip', async ({ transport }: TestArgs) => {
|
||||
const SearchParams = z.object({ query: z.string(), limit: z.number().int().default(5) });
|
||||
|
|
|
|||
|
|
@ -12,9 +12,9 @@ import { McpServer, ProtocolErrorCode, Server } from '@modelcontextprotocol/serv
|
|||
import { expect, vi } from 'vitest';
|
||||
import { z } from 'zod/v4';
|
||||
|
||||
import { wire } from '../helpers/index.js';
|
||||
import { verifies } from '../helpers/verifies.js';
|
||||
import type { TestArgs } from '../types.js';
|
||||
import { wire } from '../helpers/index';
|
||||
import { verifies } from '../helpers/verifies';
|
||||
import type { TestArgs } from '../types';
|
||||
|
||||
const newClient = () => new Client({ name: 'c', version: '0' });
|
||||
|
||||
|
|
|
|||
|
|
@ -22,9 +22,9 @@ import {
|
|||
import { expect } from 'vitest';
|
||||
import { z } from 'zod/v4';
|
||||
|
||||
import { tapWire, wire } from '../helpers/index.js';
|
||||
import { verifies } from '../helpers/verifies.js';
|
||||
import type { TestArgs } from '../types.js';
|
||||
import { tapWire, wire } from '../helpers/index';
|
||||
import { verifies } from '../helpers/verifies';
|
||||
import type { TestArgs } from '../types';
|
||||
|
||||
/** Client with form-mode elicitation support. */
|
||||
const formClient = () => new Client({ name: 'c', version: '0' }, { capabilities: { elicitation: { form: {} } } });
|
||||
|
|
|
|||
|
|
@ -24,9 +24,9 @@ import {
|
|||
import { expect } from 'vitest';
|
||||
import { z } from 'zod/v4';
|
||||
|
||||
import { hostPerSession, tapWire, wire } from '../helpers/index.js';
|
||||
import { verifies } from '../helpers/verifies.js';
|
||||
import type { TestArgs } from '../types.js';
|
||||
import { hostPerSession, tapWire, wire } from '../helpers/index';
|
||||
import { verifies } from '../helpers/verifies';
|
||||
import type { TestArgs } from '../types';
|
||||
|
||||
const newClient = () => new Client({ name: 'c', version: '0' });
|
||||
|
||||
|
|
|
|||
|
|
@ -24,10 +24,10 @@ import { McpServer, ProtocolErrorCode, Server, specTypeSchemas, UrlElicitationRe
|
|||
import { expect, vi } from 'vitest';
|
||||
import { z } from 'zod/v4';
|
||||
|
||||
import { hostPerSession, hostResumable, wire } from '../helpers/index.js';
|
||||
import { startLegacySseHost } from '../helpers/sse-host.js';
|
||||
import { verifies } from '../helpers/verifies.js';
|
||||
import type { TestArgs } from '../types.js';
|
||||
import { hostPerSession, hostResumable, wire } from '../helpers/index';
|
||||
import { startLegacySseHost } from '../helpers/sse-host';
|
||||
import { verifies } from '../helpers/verifies';
|
||||
import type { TestArgs } from '../types';
|
||||
|
||||
verifies('flow:compat:dual-transport-server', async (_args: TestArgs) => {
|
||||
// One deployment, one server factory, both transports: the modern Streamable HTTP
|
||||
|
|
|
|||
|
|
@ -15,9 +15,9 @@ import { McpServer } from '@modelcontextprotocol/server';
|
|||
import { expect, vi } from 'vitest';
|
||||
import { z } from 'zod/v4';
|
||||
|
||||
import { hostPerSession, wire } from '../helpers/index.js';
|
||||
import { verifies } from '../helpers/verifies.js';
|
||||
import type { TestArgs } from '../types.js';
|
||||
import { hostPerSession, wire } from '../helpers/index';
|
||||
import { verifies } from '../helpers/verifies';
|
||||
import type { TestArgs } from '../types';
|
||||
|
||||
verifies('mcpserver:context:log-from-handler', async ({ transport }: TestArgs) => {
|
||||
let releaseHandler!: () => void;
|
||||
|
|
|
|||
|
|
@ -31,8 +31,8 @@ import { McpServer, WebStandardStreamableHTTPServerTransport } from '@modelconte
|
|||
import { expect } from 'vitest';
|
||||
import { z } from 'zod/v4';
|
||||
|
||||
import { verifies } from '../helpers/verifies.js';
|
||||
import type { TestArgs } from '../types.js';
|
||||
import { verifies } from '../helpers/verifies';
|
||||
import type { TestArgs } from '../types';
|
||||
|
||||
const VALID_TOKEN = 'analytics-dashboard-access-token';
|
||||
|
||||
|
|
|
|||
|
|
@ -30,9 +30,9 @@ import express from 'express';
|
|||
import { expect } from 'vitest';
|
||||
import { z } from 'zod/v4';
|
||||
|
||||
import { startExpressMinimal, startExpressWithHostValidation } from '../helpers/express.js';
|
||||
import { verifies } from '../helpers/verifies.js';
|
||||
import type { TestArgs } from '../types.js';
|
||||
import { startExpressMinimal, startExpressWithHostValidation } from '../helpers/express';
|
||||
import { verifies } from '../helpers/verifies';
|
||||
import type { TestArgs } from '../types';
|
||||
|
||||
const RESOURCE_METADATA_URL = 'https://mcp.example.com/.well-known/oauth-protected-resource';
|
||||
const VALID_TOKEN = 'analytics-dashboard-token';
|
||||
|
|
|
|||
|
|
@ -19,8 +19,8 @@ import type { FastifyInstance, FastifyRequest } from 'fastify';
|
|||
import { expect } from 'vitest';
|
||||
import { z } from 'zod/v4';
|
||||
|
||||
import { verifies } from '../helpers/verifies.js';
|
||||
import type { TestArgs } from '../types.js';
|
||||
import { verifies } from '../helpers/verifies';
|
||||
import type { TestArgs } from '../types';
|
||||
|
||||
function forecastServer(): McpServer {
|
||||
const s = new McpServer({ name: 'forecast-server', version: '0.3.0' });
|
||||
|
|
|
|||
|
|
@ -20,8 +20,8 @@ import type { Hono } from 'hono';
|
|||
import { expect } from 'vitest';
|
||||
import { z } from 'zod/v4';
|
||||
|
||||
import { verifies } from '../helpers/verifies.js';
|
||||
import type { TestArgs } from '../types.js';
|
||||
import { verifies } from '../helpers/verifies';
|
||||
import type { TestArgs } from '../types';
|
||||
|
||||
function recipeServer(): McpServer {
|
||||
const s = new McpServer({ name: 'recipe-server', version: '1.2.0' });
|
||||
|
|
|
|||
|
|
@ -18,10 +18,10 @@ import { LATEST_PROTOCOL_VERSION, McpServer, WebStandardStreamableHTTPServerTran
|
|||
import { expect, vi } from 'vitest';
|
||||
import { z } from 'zod/v4';
|
||||
|
||||
import type { HttpHandler } from '../helpers/index.js';
|
||||
import { hostPerSession, hostStateless } from '../helpers/index.js';
|
||||
import { verifies } from '../helpers/verifies.js';
|
||||
import type { TestArgs } from '../types.js';
|
||||
import type { HttpHandler } from '../helpers/index';
|
||||
import { hostPerSession, hostStateless } from '../helpers/index';
|
||||
import { verifies } from '../helpers/verifies';
|
||||
import type { TestArgs } from '../types';
|
||||
|
||||
function echoServer(): McpServer {
|
||||
const s = new McpServer({ name: 's', version: '0' });
|
||||
|
|
|
|||
|
|
@ -12,9 +12,9 @@ import { LATEST_PROTOCOL_VERSION, McpServer, parseJSONRPCMessage } from '@modelc
|
|||
import { expect, vi } from 'vitest';
|
||||
import { z } from 'zod/v4';
|
||||
|
||||
import { hostResumable } from '../helpers/index.js';
|
||||
import { verifies } from '../helpers/verifies.js';
|
||||
import type { TestArgs } from '../types.js';
|
||||
import { hostResumable } from '../helpers/index';
|
||||
import { verifies } from '../helpers/verifies';
|
||||
import type { TestArgs } from '../types';
|
||||
|
||||
/**
|
||||
* These three tests assert the raw frame sequence of the POST SSE stream itself, so they cannot run their traffic through a connected client.
|
||||
|
|
|
|||
|
|
@ -19,10 +19,10 @@ import express from 'express';
|
|||
import { expect, vi } from 'vitest';
|
||||
import { z } from 'zod/v4';
|
||||
|
||||
import { startExpressMinimal } from '../helpers/express.js';
|
||||
import { hostPerSession, hostStateless, wire } from '../helpers/index.js';
|
||||
import { verifies } from '../helpers/verifies.js';
|
||||
import type { TestArgs } from '../types.js';
|
||||
import { startExpressMinimal } from '../helpers/express';
|
||||
import { hostPerSession, hostStateless, wire } from '../helpers/index';
|
||||
import { verifies } from '../helpers/verifies';
|
||||
import type { TestArgs } from '../types';
|
||||
|
||||
const newClient = () => new Client({ name: 'c', version: '0' });
|
||||
|
||||
|
|
|
|||
|
|
@ -32,9 +32,9 @@ import {
|
|||
import { expect } from 'vitest';
|
||||
import { z } from 'zod/v4';
|
||||
|
||||
import { tapWire, wire } from '../helpers/index.js';
|
||||
import { verifies } from '../helpers/verifies.js';
|
||||
import type { TestArgs } from '../types.js';
|
||||
import { tapWire, wire } from '../helpers/index';
|
||||
import { verifies } from '../helpers/verifies';
|
||||
import type { TestArgs } from '../types';
|
||||
|
||||
function olderSupportedVersion(): string {
|
||||
const older = SUPPORTED_PROTOCOL_VERSIONS.find(v => v !== LATEST_PROTOCOL_VERSION);
|
||||
|
|
|
|||
|
|
@ -17,9 +17,9 @@ import { isJSONRPCRequest, McpServer, ProtocolError, ProtocolErrorCode, Server,
|
|||
import { expect, vi } from 'vitest';
|
||||
import { z } from 'zod/v4';
|
||||
|
||||
import { tapWire, wire } from '../helpers/index.js';
|
||||
import { verifies } from '../helpers/verifies.js';
|
||||
import type { TestArgs } from '../types.js';
|
||||
import { tapWire, wire } from '../helpers/index';
|
||||
import { verifies } from '../helpers/verifies';
|
||||
import type { TestArgs } from '../types';
|
||||
|
||||
const ALL_LEVELS: LoggingLevel[] = ['debug', 'info', 'notice', 'warning', 'error', 'critical', 'alert', 'emergency'];
|
||||
|
||||
|
|
|
|||
|
|
@ -10,9 +10,9 @@ import { isJSONRPCRequest, McpServer, ProtocolError, ProtocolErrorCode, Resource
|
|||
import { expect } from 'vitest';
|
||||
import { z } from 'zod/v4';
|
||||
|
||||
import { tapWire, wire } from '../helpers/index.js';
|
||||
import { verifies } from '../helpers/verifies.js';
|
||||
import type { TestArgs } from '../types.js';
|
||||
import { tapWire, wire } from '../helpers/index';
|
||||
import { verifies } from '../helpers/verifies';
|
||||
import type { TestArgs } from '../types';
|
||||
|
||||
const newClient = () => new Client({ name: 'c', version: '0' });
|
||||
|
||||
|
|
|
|||
|
|
@ -14,9 +14,9 @@ import { McpServer, ProtocolError, ProtocolErrorCode, Server } from '@modelconte
|
|||
import { expect, vi } from 'vitest';
|
||||
import { z } from 'zod/v4';
|
||||
|
||||
import { wire } from '../helpers/index.js';
|
||||
import { verifies } from '../helpers/verifies.js';
|
||||
import type { TestArgs } from '../types.js';
|
||||
import { wire } from '../helpers/index';
|
||||
import { verifies } from '../helpers/verifies';
|
||||
import type { TestArgs } from '../types';
|
||||
|
||||
const TINY_PNG_BASE64 = 'iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=';
|
||||
const TINY_WAV_BASE64 = 'UklGRiQAAABXQVZFZm10IBAAAAABAAEAQB8AAEAfAAABAAgAZGF0YQAAAAA=';
|
||||
|
|
|
|||
|
|
@ -34,9 +34,9 @@ import {
|
|||
import { expect, vi } from 'vitest';
|
||||
import { z } from 'zod/v4';
|
||||
|
||||
import { tapWire, wire } from '../helpers/index.js';
|
||||
import { verifies } from '../helpers/verifies.js';
|
||||
import type { TestArgs } from '../types.js';
|
||||
import { tapWire, wire } from '../helpers/index';
|
||||
import { verifies } from '../helpers/verifies';
|
||||
import type { TestArgs } from '../types';
|
||||
|
||||
const newClient = () => new Client({ name: 'c', version: '0' });
|
||||
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue