Getting started
Installation
Install unrun using your preferred package manager:
sh
npm install unrunsh
pnpm add unrunsh
yarn add unrunsh
bun add unrunUsage
CLI
You can use unrun via the command line interface (CLI) to run a JavaScript or TypeScript file directly.
sh
npx unrun ./path/to/file.tssh
pnpx unrun ./path/to/file.tssh
yarn dlx unrun ./path/to/file.tsProgrammatic API
You can also use unrun programmatically in your code, either asynchronously or synchronously.
- Async usage
ts
import { unrun } from 'unrun'
const { module } = await unrun({
path: './path/to/file.ts', // Path to the module to load
})- Sync usage
ts
import { unrunSync } from 'unrun'
const { module } = unrunSync({
path: './path/to/file.ts', // Path to the module to load
})WARNING
The synchronous API requires synckit to be installed. If you don't have it installed, please run npm install synckit or the equivalent command for your package manager.