https://github.com/steelydylan/browser-type-resolver
Get all definition files necessary for the library to work with monaco-editor
https://github.com/steelydylan/browser-type-resolver
Last synced: about 1 year ago
JSON representation
Get all definition files necessary for the library to work with monaco-editor
- Host: GitHub
- URL: https://github.com/steelydylan/browser-type-resolver
- Owner: steelydylan
- Created: 2023-08-29T03:52:45.000Z (almost 3 years ago)
- Default Branch: master
- Last Pushed: 2023-10-01T01:47:15.000Z (over 2 years ago)
- Last Synced: 2024-10-11T23:25:37.484Z (over 1 year ago)
- Language: TypeScript
- Homepage: https://browser-type-resolver.vercel.app
- Size: 602 KB
- Stars: 5
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Browser Type Resolver

## Demo Page
https://browser-type-resolver.vercel.app
## Install
```bash
npm i browser-type-resolver
```
## Usage
```ts
const dependencies = {
"react": "18.2.0",
"react-dom": "18.2.0",
"react-hook-form": "7.45.4",
"@hookform/resolvers": "3.3.0",
"zod": "3.22.2"
}
resolveAllModuleType(dependencies).then(result => {
console.log(result)
})
```
### Use with monaco editor
```ts
const dependencies = {
"react": "18.2.0",
"react-dom": "18.2.0",
"react-hook-form": "7.45.4",
"@hookform/resolvers": "3.3.0",
"zod": "3.22.2"
}
const libs = await resolveAllModuleType(dependencies);
Object.entries(libs).forEach(([name, content]) => {
monaco.languages.typescript.typescriptDefaults.addExtraLib(content, `file:///node_modules/${name}`)
})
```