@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.
@@ -1 +1,14 @@
1
- export declare function generateDeclaration(source: string, filename?: string): string;
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 t from"typescript";import{createSystem as e,createDefaultMapFromNodeModules as r,createVirtualTypeScriptEnvironment as i}from"@typescript/vfs";export function generateDeclaration(a,p="index.ts"){let c={declaration:!0,emitDeclarationOnly:!0,target:t.ScriptTarget.ESNext,skipLibCheck:!0},n=r(c);return n.set(p,a),i(e(n),[p],t,c).languageService.getEmitOutput(p,!0).outputFiles.reduce((t,e)=>t+=e.text,"")}
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()||[])}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moneko/core",
3
- "version": "3.12.0",
3
+ "version": "3.12.1",
4
4
  "description": "core",
5
5
  "main": "lib/index.mjs",
6
6
  "type": "module",