parseport
v0.1.0-beta.0
Published
Get static value from a JavaScript or TypeScript file
Downloads
70
Readme
parseport
Get static value from a JavaScript or TypeScript file.
Usage
import { parseport } from 'parseport'
const { value } = await parseport('./file', { meta: import.meta })
Or use more basic functions:
import {
parseportFile,
parseportCode,
parseportNode,
} from 'parseport'
await parseportFile('/path/to/file', { meta: import.meta })
await parseportCode('export default 2 + [1, 3].length as never', { lang: 'ts' }) // { value: 4 }
await parseportNode(babelNode)