Socket
Socket
Sign inDemoInstall

es6-module-crosspiler

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

es6-module-crosspiler - npm Package Compare versions

Comparing version 0.0.2 to 0.1.0

4

lib/common.js

@@ -32,3 +32,5 @@

// this function is called require()
if (path.node.id.name === 'require') return true
var id = path.node.id
if (!id) return false // UNTESTED: skip anonymous functions
if (id.name === 'require') return true
return false

@@ -35,0 +37,0 @@ }

var esprima = require('esprima')
var memo = require('memorizer')

@@ -9,2 +10,20 @@ var recast = require('recast')

Module.parse = function (string, options) {
options = options || {}
options.esprima = esprima
return recast.parse(string, options)
}
Module.infer = function (string) {
var ast = Module.parse(string)
mod = new Module(ast)
mod.type
mod.default
mod.imports
mod.exports
// we don't need to keep the AST in memory
mod.ast = null
return mod
}
function Module(ast, options) {

@@ -99,3 +118,3 @@ if (!(this instanceof Module)) return new Module(ast, options)

this.defaultifyRequires()
if (!module) return
if (!module) return this.ast
// handle imports, which go below exports

@@ -102,0 +121,0 @@ this.buildRequires()

{
"name": "es6-module-crosspiler",
"description": "An ES6 and CommonJS cross-compatible transpiler",
"version": "0.0.2",
"version": "0.1.0",
"author": {

@@ -6,0 +6,0 @@ "name": "Jonathan Ong",

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc