Socket
Socket
Sign inDemoInstall

babylon-module-definitons

Package Overview
Dependencies
24
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    babylon-module-definitons

``` npm i babylon-module-definitons --save ```


Version published
Maintainers
1
Install size
4.36 MB
Created

Readme

Source

babylonModuleDefinitions

npm i babylon-module-definitons --save

Why

Needed way of getting deps from a file with the babel syntax. Specifically because acorn does not support async / await.

Usage

Pass in code (sync):

let code = `
import * as one from 'one'
import "two"
import three from "three"
require('four')
let five = require('five')
`

let val = babylonModuleDefinitions({code})
assert.deepEqual(val, ['one', 'two', 'three', 'four', 'five'])

Pass in file (async - returns promise):

let file = './test/index.js'
babylonModuleDefinitions({file}).then(val => {
  assert.deepEqual(val, ['../src/index', 'assert'])
})

FAQs

Last updated on 23 Apr 2016

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc