common-shakeify
Advanced tools
Comparing version 0.5.1 to 0.5.2
@@ -7,2 +7,5 @@ # common-shakeify change log | ||
## 0.5.2 | ||
* Fix removing exports that are parenthesized expressions. ([#20](https://github.com/browserify/common-shakeify/pull/20)) | ||
## 0.5.1 | ||
@@ -9,0 +12,0 @@ * Fix file names in source maps. ([#16](https://github.com/browserify/common-shakeify/pull/16)) |
10
index.js
@@ -197,3 +197,11 @@ 'use strict' | ||
} | ||
string.overwrite(node.start, node.right.start, prefix) | ||
// Acorn silently strips parens, and node.right.start might be after one | ||
// or more parenthesis that we need to keep. Eg, exports.a = (1+1) | ||
if (node.right.end !== node.end) { | ||
// Replace entire expression. node.start - node.end will wrap the entire expression. | ||
string.overwrite(node.start, node.end, prefix + '(' + node.right.getSource() + ')') | ||
} else { | ||
string.overwrite(node.start, node.right.start, prefix) | ||
} | ||
return | ||
@@ -200,0 +208,0 @@ } else if (node.type === 'Property') { |
{ | ||
"name": "common-shakeify", | ||
"version": "0.5.1", | ||
"version": "0.5.2", | ||
"description": "browserify tree shaking plugin using @indutny common-shake", | ||
@@ -19,2 +19,7 @@ "main": "index.js", | ||
"author": "Renée Kooi <renee@kooi.me>", | ||
"contributors": [ | ||
"Damian Krzeminski (https://github.com/pirxpilot)", | ||
"Seph Gentle (https://github.com/josephg)", | ||
"Titus (https://github.com/wooorm)" | ||
], | ||
"license": "MIT", | ||
@@ -21,0 +26,0 @@ "bugs": { |
@@ -66,2 +66,5 @@ var test = require('tape') | ||
}) | ||
test('paren-exports', function (t) { | ||
runTest(t, 'paren-exports') | ||
}) | ||
@@ -68,0 +71,0 @@ test('external', function (t) { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
34969
60
687
35