This commit is contained in:
2026-04-25 16:36:34 +08:00
commit db90e7579b
1876 changed files with 189777 additions and 0 deletions

View File

@@ -0,0 +1,26 @@
/**
* This is bar
*/
export function bar() {
console.log('Anything else');
}
interface E {
f: symbol;
}
interface Options {
a: number;
b: string;
c: {
d: string;
e: E;
};
}
/**
* This is bar with complex input
*/
export function complexBar(input: Options) {
console.log('Anything else', input);
}

View File

@@ -0,0 +1,13 @@
import * as mkdirp from 'mkdirp';
/**
* This is foo
*/
export function foo(input: string) {
console.log('Anything', input);
mkdirp('./foo/foo/foo/foo/foo/foo/foo');
return input + 1;
}
export const fooVar = 'fooVar' as string;

View File

@@ -0,0 +1,9 @@
export { foo, fooVar } from '@/foo';
export { bar, complexBar } from '@/bar';
/**
* Root export
*/
export function main() {
console.log('main');
}

View File

@@ -0,0 +1,7 @@
{
"compilerOptions": {
"paths": {
"@/*": ["./*"],
}
}
}

View File

@@ -0,0 +1,4 @@
declare module '@capital/foo' {
export const a: any;
export const b: string;
}

View File

@@ -0,0 +1,20 @@
import { parseExports, parseModuleDeclaration } from '../src/tsgenerator';
import path from 'path';
const { exportModules } = parseExports(
path.resolve(__dirname, './demo/index.ts'),
{
paths: { '@/*': ['./*'] },
}
);
console.log('exportModules', exportModules);
const { modules } = parseModuleDeclaration(
path.resolve(__dirname, './index.d.ts'),
{
paths: { '@/*': ['./*'] },
}
);
console.log('modules', modules);

View File

@@ -0,0 +1,14 @@
import { parseDeclarationEntry } from '../src/parser';
import path from 'path';
const project = parseDeclarationEntry({
entryPath: path.resolve(__dirname, './demo/index.ts'),
project: {
tsConfigFilePath: path.resolve(__dirname, './demo/tsconfig.json'),
},
});
console.log(
'sourceFile',
project.getSourceFiles().map((item) => item.getFilePath())
);