Socket
Socket
Sign inDemoInstall

cjs-es

Package Overview
Dependencies
Maintainers
1
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cjs-es - npm Package Compare versions

Comparing version 0.6.2 to 0.6.3

8

lib/analyzer.js

@@ -18,2 +18,3 @@ const {walk} = require("estree-walker");

context.nonNamespaceIds = new Set;
context.needDefaultObject = false;
return {analyze};

@@ -107,3 +108,3 @@

function analyzeExports(node) {
function analyzeExports(node, parent) {
if (node.name !== "exports" || context.scope && context.scope.has("exports")) {

@@ -113,2 +114,5 @@ return;

node.rootPos = context.topLevel.get().start;
if (parent.type === "UnaryExpression" && parent.operator === "typeof") {
context.needDefaultObject = true;
}
context.exportsNodes.push(node);

@@ -222,3 +226,3 @@ }

} else if (node.type === "Identifier" && isReference(node, parent)) {
analyzeExports(node);
analyzeExports(node, parent);
analyzeModule(node);

@@ -225,0 +229,0 @@ analyzeRequireId(node);

@@ -349,3 +349,3 @@ function createExportWriter(context) {

const kind = assignment ? "let" : "const";
const defaultValue = assignment ? "" : " = {}";
const defaultValue = !assignment || context.needDefaultObject ? " = {}" : "";
context.s.appendRight(

@@ -352,0 +352,0 @@ topIndex,

{
"name": "cjs-es",
"version": "0.6.2",
"version": "0.6.3",
"description": "Transform CommonJS module into ES module.",

@@ -18,3 +18,3 @@ "keywords": [

"scripts": {
"test": "eslint **/*.js --cache && nyc --reporter=html mocha",
"test": "eslint **/*.js --cache && c8 --reporter=lcov mocha",
"preversion": "npm test",

@@ -27,14 +27,14 @@ "postversion": "git push --follow-tags && npm publish"

"devDependencies": {
"acorn": "^6.0.1",
"eslint": "^5.6.0",
"mocha": "^5.2.0",
"nyc": "^13.0.1",
"sinon": "^6.3.4"
"acorn": "^6.1.1",
"c8": "^5.0.1",
"eslint": "^5.16.0",
"mocha": "^6.1.4",
"sinon": "^7.3.2"
},
"dependencies": {
"estree-walker": "^0.5.2",
"is-reference": "^1.1.0",
"magic-string": "^0.25.1",
"rollup-pluginutils": "^2.3.3"
"estree-walker": "^0.6.1",
"is-reference": "^1.1.2",
"magic-string": "^0.25.2",
"rollup-pluginutils": "^2.8.1"
}
}
cjs-es
======
[![Build Status](https://travis-ci.org/eight04/cjs-es.svg?branch=master)](https://travis-ci.org/eight04/cjs-es)
[![Coverage Status](https://coveralls.io/repos/github/eight04/cjs-es/badge.svg?branch=master)](https://coveralls.io/github/eight04/cjs-es?branch=master)
[![Build Status](https://travis-ci.com/eight04/cjs-es.svg?branch=master)](https://travis-ci.com/eight04/cjs-es)
[![codecov](https://codecov.io/gh/eight04/cjs-es/branch/master/graph/badge.svg)](https://codecov.io/gh/eight04/cjs-es)
[![install size](https://packagephobia.now.sh/badge?p=cjs-es)](https://packagephobia.now.sh/result?p=cjs-es)

@@ -131,6 +131,6 @@

const bar = "bar";
let _exports_ = {};
_exports_.foo = foo;
_exports_.bar = bar;
export default _exports_;
const _module_exports_ = {};
export {_module_exports_ as default};
_module_exports_.foo = foo;
_module_exports_.bar = bar;
```

@@ -174,3 +174,3 @@

let _module_exports_;
export default _module_exports_;
export {_module_exports_ as default};
if (foo) {

@@ -244,5 +244,4 @@ _module_exports_ = () => "foo";

```js
let _module_exports_;
export default _module_exports_;
export {_module_exports_ as default};
if (foo) {

@@ -320,2 +319,6 @@ _module_exports_ = () => "foo";

* 0.6.3 (Jun 6, 2019)
- Fix: assign a default object if `typeof exports` exists.
* 0.6.2 (Sep 19, 2018)

@@ -322,0 +325,0 @@

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