@moneko/core 3.12.0 → 3.12.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/utils/dts.d.mts +14 -1
- package/lib/utils/dts.mjs +1 -1
- package/package.json +1 -1
package/lib/utils/dts.d.mts
CHANGED
|
@@ -1 +1,14 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* 根据ts内容生成声明类型
|
|
3
|
+
* @param {String} source 源码、内容
|
|
4
|
+
* @param {String} filename 文件名
|
|
5
|
+
* @returns {String} declaration
|
|
6
|
+
*/
|
|
7
|
+
export declare function generateDeclaration(source: string, filename: string): string;
|
|
8
|
+
/**
|
|
9
|
+
* 获取ts内容导出key
|
|
10
|
+
* @param {String} source 源码、内容
|
|
11
|
+
* @param {String} filename 文件名
|
|
12
|
+
* @returns {Array<String>} tokens
|
|
13
|
+
*/
|
|
14
|
+
export declare function getExportKeys(source: string, filename: string): string[];
|
package/lib/utils/dts.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import e from"typescript";import{createSystem as t,createDefaultMapFromNodeModules as r,createVirtualTypeScriptEnvironment as i}from"@typescript/vfs";let o={declaration:!0,emitDeclarationOnly:!0,target:e.ScriptTarget.ESNext,skipLibCheck:!0},a=r(o),c=i(t(a),[],e,o);export function generateDeclaration(e,t){return a.set(t,e),c.createFile(t,e),c.languageService.getEmitOutput(t).outputFiles.reduce((e,t)=>e+=t.text,"")}export function getExportKeys(e,t){a.set(t,e),c.createFile(t,e);let r=c.getSourceFile(t)?.symbol;return Array.from(r?.exports?.keys()||[])}
|