[question] how to create program from function in runtime
Open
- Dominant language
- TypeScript
- Stars
- 6.2k
- Forks
- 238
- Avg merge
- 2m
- Merged PRs (30d)
- 1
Description
As a library maintainer, I have some `main` function that used as entry-point by developers
`program.ts` by third-party developers, that uses `main.ts`
```ts
import { main } from 'my-library'
const app = async () => {
// some code
}
await main("app", app)
```
As a library maintainer, I want to get AST of running `program`. Can I do this in runtime, inside `main` function?
Something like (pseudo-code):
`main.ts` - library code, that used by developers
```ts
import { createRuntimeProgram } from 'ts-morph'
async function main(name: string, app: async () => Promise) {
const program = createRuntimeProgram(app)
// manipulate program here
}
```
Contributor guide
Assessment
This issue has not been assessed yet.