Files
NapCatQQ/.pnpm-store/v3/files/9f/5e156bb1d8282f24305d8fb42f7a6e38f10d1b9634f0c333e0659c5300d3a8da16584ab8150b04a2b9ccf4837933d28c348ed2f85bd1bd3176800ce9c7fd24
TanTan e311ca3275
Build NapCat Artifacts / Windows Loader Test (push) Canceled after 0s
Build NapCat Artifacts / Type Check & Test (push) Canceled after 0s
Build NapCat Artifacts / Build NapCat.Framework (push) Canceled after 0s
Build NapCat Artifacts / Build NapCat.Shell (push) Canceled after 0s
docs: 仓库链接指向本镜像仓库
2026-11-13 09:25:58 +08:00

37 lines
1.1 KiB
Plaintext

import type TokenProcessor from "../TokenProcessor";
export type ImportExportSpecifierInfo = {
isType: false;
leftName: string;
rightName: string;
endIndex: number;
} | {
isType: true;
leftName: null;
rightName: null;
endIndex: number;
};
/**
* Determine information about this named import or named export specifier.
*
* This syntax is the `a` from statements like these:
* import {A} from "./foo";
* export {A};
* export {A} from "./foo";
*
* As it turns out, we can exactly characterize the syntax meaning by simply
* counting the number of tokens, which can be from 1 to 4:
* {A}
* {type A}
* {A as B}
* {type A as B}
*
* In the type case, we never actually need the names in practice, so don't get
* them.
*
* TODO: There's some redundancy with the type detection here and the isType
* flag that's already present on tokens in TS mode. This function could
* potentially be simplified and/or pushed to the call sites to avoid the object
* allocation.
*/
export default function getImportExportSpecifierInfo(tokens: TokenProcessor, index?: number): ImportExportSpecifierInfo;