build(iframe-bridge): update module imports and tsconfig for NodeNext

This commit is contained in:
2025-11-15 01:23:40 +08:00
parent b75a4e4564
commit 32c77d9f8e
5 changed files with 16 additions and 13 deletions

View File

@@ -4,9 +4,9 @@
* - 提供便捷的客户端调用navigate/close/ready
*/
import { connectToParent } from 'penpal';
import type { HostApi, ChildApi } from './types';
import { isEmbedded } from './path';
import { log } from './logger';
import type { HostApi, ChildApi } from './types.js';
import { isEmbedded } from './path.js';
import { log } from './logger.js';
// Cached Penpal connections
// 缓存与宿主的连接,以避免重复握手

View File

@@ -4,8 +4,8 @@
* - 返回 child Promise解析为子端暴露的方法与 destroy 销毁函数
*/
import { connectToChild } from 'penpal';
import type { HostApi, ChildApi } from './types';
import { log } from './logger';
import type { HostApi, ChildApi } from './types.js';
import { log } from './logger.js';
/** Establish Penpal host bridge bound to an iframe and expose Host API to child. */
/**

View File

@@ -1,27 +1,27 @@
// 入口文件:仅聚合与导出 API不承载具体逻辑
export type { HostApi, ChildApi } from './types';
export { isEmbedded, toHostPath, toChildPath } from './path';
export type { HostApi, ChildApi } from './types.js';
export { isEmbedded, toHostPath, toChildPath } from './path.js';
export {
getClientHostApi,
clientNavigate,
clientClose,
clientReady,
initChildBridge,
} from './client';
export { createPenpalHostBridge } from './host';
} from './client.js';
export { createPenpalHostBridge } from './host.js';
// 默认导出一个聚合对象:
// - 兼容某些只识别 default 的打包方案或联邦场景
// - 同时保留命名导出,建议优先使用命名导出
import { isEmbedded, toHostPath, toChildPath } from './path';
import { isEmbedded, toHostPath, toChildPath } from './path.js';
import {
getClientHostApi,
clientNavigate,
clientClose,
clientReady,
initChildBridge,
} from './client';
import { createPenpalHostBridge } from './host';
} from './client.js';
import { createPenpalHostBridge } from './host.js';
/**
* 默认聚合导出对象:包含全部对外 API。

View File

@@ -3,7 +3,7 @@
* - 判断是否处于 iframe 场景(需进行跨窗口通信)
* - 提供宿主/子端路径的前缀转换
*/
import { log } from './logger';
import { log } from './logger.js';
/**
* 安全获取当前窗口的 pathname避免跨域等异常导致报错。

View File

@@ -1,6 +1,9 @@
{
"extends": "../../tsconfig.node.json",
"compilerOptions": {
"module": "NodeNext",
"moduleResolution": "NodeNext",
"verbatimModuleSyntax": false,
"outDir": "dist",
"rootDir": "src",
"tsBuildInfoFile": "./dist/.tsbuildinfo",