common-shakeify
Advanced tools
Comparing version 0.4.2 to 0.4.3
12
index.js
@@ -31,3 +31,4 @@ 'use strict' | ||
const loc = reason.loc.start | ||
console.warn('common-shake: bailed out: ', reason.reason, 'in', `${relative(basedir, resource.resource)}:${loc.line}:${loc.column}`) | ||
const source = reason.source || resource.resource | ||
console.warn('common-shake: bailed out: ', reason.reason, 'in', `${relative(basedir, source)}:${loc.line}:${loc.column}`) | ||
}) | ||
@@ -83,3 +84,6 @@ } | ||
let ast | ||
const string = transformAst(source, { locations: true }, (node) => { | ||
const string = transformAst(source, { | ||
locations: true, | ||
ecmaVersion: 9 | ||
}, (node) => { | ||
if (node.type === 'Program') ast = node | ||
@@ -183,3 +187,5 @@ }) | ||
// which is invalid. | ||
node.right.type === 'AssignmentExpression') { | ||
node.right.type === 'AssignmentExpression' || | ||
// Don't output a statement containing only `void () => {}` | ||
node.right.type === 'ArrowFunctionExpression') { | ||
prefix += 'void 0, ' | ||
@@ -186,0 +192,0 @@ } |
{ | ||
"name": "common-shakeify", | ||
"version": "0.4.2", | ||
"version": "0.4.3", | ||
"description": "browserify tree shaking plugin using @indutny common-shake", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -8,2 +8,3 @@ (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ | ||
exports.exports = function () {} | ||
/* common-shake removed: exports.other = */ void 0, () => { console.log('other') } | ||
@@ -10,0 +11,0 @@ console.log(/* common-shake removed: exports.a = */ 'hello world') |
exports.exports = function () {} | ||
exports.other = () => { console.log('other') } | ||
@@ -3,0 +4,0 @@ console.log(exports.a = 'hello world') |
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
32106
634