Add explicit .js extensions to relative imports for NodeNext consumers (#705)

Emitted declarations used extensionless relative imports, so types failed to resolve under moduleResolution NodeNext/Node16 (#704).

Closes #704
This commit is contained in:
Olivier Chafik 2026-09-08 13:57:46 +01:00 • committed by GitHub
commit f9c671c323
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 35 additions and 35 deletions

View file

@ -3,8 +3,8 @@ import { Client, InMemoryTransport } from "@modelcontextprotocol/client";
import { Server, type ServerCapabilities } from "@modelcontextprotocol/server"; import { Server, type ServerCapabilities } from "@modelcontextprotocol/server";
import { z } from "zod/v4"; import { z } from "zod/v4";
import { App } from "./app"; import { App } from "./app.js";
import { LATEST_PROTOCOL_VERSION } from "./types"; import { LATEST_PROTOCOL_VERSION } from "./types.js";
import { import {
AppBridge, AppBridge,
buildAllowAttribute, buildAllowAttribute,
@ -13,7 +13,7 @@ import {
isToolVisibilityAppOnly, isToolVisibilityAppOnly,
McpUiOpenLinkResultSchema, McpUiOpenLinkResultSchema,
type McpUiHostCapabilities, type McpUiHostCapabilities,
} from "./app-bridge"; } from "./app-bridge.js";
/** Wait for pending microtasks to complete */ /** Wait for pending microtasks to complete */
const flush = () => new Promise((resolve) => setTimeout(resolve, 0)); const flush = () => new Promise((resolve) => setTimeout(resolve, 0));

View file

@ -34,7 +34,7 @@ import {
EmptyResultSchema, EmptyResultSchema,
LoggingMessageNotificationSchema, LoggingMessageNotificationSchema,
} from "@modelcontextprotocol/core"; } from "@modelcontextprotocol/core";
import { EventDispatcher } from "./events"; import { EventDispatcher } from "./events.js";
import type { ZodLiteral, ZodObject, ZodType } from "zod/v4"; import type { ZodLiteral, ZodObject, ZodType } from "zod/v4";
type MethodSchema = ZodObject<{ type MethodSchema = ZodObject<{
@ -87,11 +87,11 @@ import {
McpUiRequestDisplayModeResultSchema, McpUiRequestDisplayModeResultSchema,
McpUiResourcePermissions, McpUiResourcePermissions,
McpUiToolMeta, McpUiToolMeta,
} from "./types"; } from "./types.js";
export * from "./types"; export * from "./types.js";
export { RESOURCE_URI_META_KEY, RESOURCE_MIME_TYPE } from "./constants"; export { RESOURCE_URI_META_KEY, RESOURCE_MIME_TYPE } from "./constants.js";
import { RESOURCE_URI_META_KEY } from "./constants"; import { RESOURCE_URI_META_KEY } from "./constants.js";
export { PostMessageTransport } from "./message-transport"; export { PostMessageTransport } from "./message-transport.js";
/** /**
* Extract UI resource URI from tool metadata. * Extract UI resource URI from tool metadata.

View file

@ -22,10 +22,10 @@ import {
type Transport, type Transport,
} from "@modelcontextprotocol/client"; } from "@modelcontextprotocol/client";
import { EmptyResultSchema } from "@modelcontextprotocol/core"; import { EmptyResultSchema } from "@modelcontextprotocol/core";
export { RESOURCE_MIME_TYPE, RESOURCE_URI_META_KEY } from "./constants"; export { RESOURCE_MIME_TYPE, RESOURCE_URI_META_KEY } from "./constants.js";
import { EventDispatcher } from "./events"; import { EventDispatcher } from "./events.js";
export { EventDispatcher } from "./events"; export { EventDispatcher } from "./events.js";
import { PostMessageTransport } from "./message-transport"; import { PostMessageTransport } from "./message-transport.js";
import { import {
LATEST_PROTOCOL_VERSION, LATEST_PROTOCOL_VERSION,
McpUiAppCapabilities, McpUiAppCapabilities,
@ -59,12 +59,12 @@ import {
McpUiToolResultNotificationSchema, McpUiToolResultNotificationSchema,
McpUiRequestDisplayModeRequest, McpUiRequestDisplayModeRequest,
McpUiRequestDisplayModeResultSchema, McpUiRequestDisplayModeResultSchema,
} from "./types"; } from "./types.js";
import { import {
StandardSchemaV1, StandardSchemaV1,
standardSchemaToJsonSchema, standardSchemaToJsonSchema,
validateStandardSchema, validateStandardSchema,
} from "./standard-schema"; } from "./standard-schema.js";
import { z, type ZodLiteral, type ZodObject, type ZodType } from "zod/v4"; import { z, type ZodLiteral, type ZodObject, type ZodType } from "zod/v4";
type MethodSchema = ZodObject<{ type MethodSchema = ZodObject<{
@ -92,16 +92,16 @@ function mergeAppCapabilities(
export type { export type {
StandardSchemaV1, StandardSchemaV1,
StandardSchemaWithJSON, StandardSchemaWithJSON,
} from "./standard-schema"; } from "./standard-schema.js";
export { PostMessageTransport } from "./message-transport"; export { PostMessageTransport } from "./message-transport.js";
export * from "./types"; export * from "./types.js";
export { export {
applyHostStyleVariables, applyHostStyleVariables,
applyHostFonts, applyHostFonts,
getDocumentTheme, getDocumentTheme,
applyDocumentTheme, applyDocumentTheme,
} from "./styles"; } from "./styles.js";
/** /**
* Metadata key for associating a UI resource URI with a tool. * Metadata key for associating a UI resource URI with a tool.

View file

@ -1,7 +1,7 @@
import { describe, it, expect, beforeEach, afterEach, mock } from "bun:test"; import { describe, it, expect, beforeEach, afterEach, mock } from "bun:test";
import type { JSONRPCMessage } from "@modelcontextprotocol/client"; import type { JSONRPCMessage } from "@modelcontextprotocol/client";
import { PostMessageTransport } from "./message-transport"; import { PostMessageTransport } from "./message-transport.js";
/** /**
* Minimal `window` stub for bun's DOM-less test environment. * Minimal `window` stub for bun's DOM-less test environment.

View file

@ -5,7 +5,7 @@ import type {
Transport, Transport,
TransportSendOptions, TransportSendOptions,
} from "@modelcontextprotocol/client"; } from "@modelcontextprotocol/client";
import { TOOL_INPUT_PARTIAL_METHOD } from "./spec.types"; import { TOOL_INPUT_PARTIAL_METHOD } from "./spec.types.js";
/** /**
* JSON-RPC transport using `window.postMessage` for iframe↔parent communication. * JSON-RPC transport using `window.postMessage` for iframe↔parent communication.

View file

@ -31,7 +31,7 @@
* } * }
* ``` * ```
*/ */
export * from "./useApp"; export * from "./useApp.js";
export * from "./useAutoResize"; export * from "./useAutoResize.js";
export * from "./useDocumentTheme"; export * from "./useDocumentTheme.js";
export * from "./useHostStyles"; export * from "./useHostStyles.js";

View file

@ -5,8 +5,8 @@ import {
AppOptions, AppOptions,
McpUiAppCapabilities, McpUiAppCapabilities,
PostMessageTransport, PostMessageTransport,
} from "../app"; } from "../app.js";
export * from "../app"; export * from "../app.js";
/** /**
* Options for configuring the {@link useApp `useApp`} hook. * Options for configuring the {@link useApp `useApp`} hook.

View file

@ -1,5 +1,5 @@
import { useEffect, RefObject } from "react"; import { useEffect, RefObject } from "react";
import { App } from "../app"; import { App } from "../app.js";
/** /**
* React hook that automatically reports UI size changes to the host. * React hook that automatically reports UI size changes to the host.

View file

@ -1,6 +1,6 @@
import { useEffect, useState } from "react"; import { useEffect, useState } from "react";
import { getDocumentTheme } from "../styles"; import { getDocumentTheme } from "../styles.js";
import { McpUiTheme } from "../types"; import { McpUiTheme } from "../types.js";
/** /**
* React hook that provides the current document theme reactively. * React hook that provides the current document theme reactively.

View file

@ -1,11 +1,11 @@
import { useEffect, useRef } from "react"; import { useEffect, useRef } from "react";
import { App } from "../app"; import { App } from "../app.js";
import { import {
applyDocumentTheme, applyDocumentTheme,
applyHostFonts, applyHostFonts,
applyHostStyleVariables, applyHostStyleVariables,
} from "../styles"; } from "../styles.js";
import { McpUiHostContext } from "../types"; import { McpUiHostContext } from "../types.js";
/** /**
* React hook that applies host style variables and theme as CSS custom properties. * React hook that applies host style variables and theme as CSS custom properties.

View file

@ -6,7 +6,7 @@ import {
RESOURCE_MIME_TYPE, RESOURCE_MIME_TYPE,
getUiCapability, getUiCapability,
EXTENSION_ID, EXTENSION_ID,
} from "./index"; } from "./index.js";
import type { McpServer } from "@modelcontextprotocol/server"; import type { McpServer } from "@modelcontextprotocol/server";
describe("registerAppTool", () => { describe("registerAppTool", () => {

View file

@ -1,4 +1,4 @@
import { McpUiStyles, McpUiTheme } from "./types"; import { McpUiStyles, McpUiTheme } from "./types.js";
/** /**
* Get the current document theme from the root HTML element. * Get the current document theme from the root HTML element.