build(iframe-bridge): update module imports and tsconfig for NodeNext
This commit is contained in:
@@ -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
|
||||
// 缓存与宿主的连接,以避免重复握手
|
||||
|
||||
@@ -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. */
|
||||
/**
|
||||
|
||||
@@ -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。
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* - 判断是否处于 iframe 场景(需进行跨窗口通信)
|
||||
* - 提供宿主/子端路径的前缀转换
|
||||
*/
|
||||
import { log } from './logger';
|
||||
import { log } from './logger.js';
|
||||
|
||||
/**
|
||||
* 安全获取当前窗口的 pathname,避免跨域等异常导致报错。
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
{
|
||||
"extends": "../../tsconfig.node.json",
|
||||
"compilerOptions": {
|
||||
"module": "NodeNext",
|
||||
"moduleResolution": "NodeNext",
|
||||
"verbatimModuleSyntax": false,
|
||||
"outDir": "dist",
|
||||
"rootDir": "src",
|
||||
"tsBuildInfoFile": "./dist/.tsbuildinfo",
|
||||
|
||||
Reference in New Issue
Block a user