@parcel/scope-hoisting
Advanced tools
Comparing version 2.0.0-nightly.102 to 2.0.0-nightly.107
@@ -73,3 +73,3 @@ "use strict"; | ||
enter(asset, context) { | ||
if (shouldExcludeAsset(asset, usedExports, bundleGraph)) { | ||
if (shouldExcludeAsset(asset, usedExports)) { | ||
return context; | ||
@@ -85,3 +85,3 @@ } | ||
exit(asset, context) { | ||
if (!context || shouldExcludeAsset(asset, usedExports, bundleGraph)) { | ||
if (!context || shouldExcludeAsset(asset, usedExports)) { | ||
return; | ||
@@ -199,2 +199,16 @@ } | ||
} | ||
} // If the asset is referenced by another bundle, include all exports. | ||
if (bundleGraph.isAssetReferencedByAssetType(asset, 'js')) { | ||
markUsed(asset, '*'); | ||
for (let { | ||
asset: a, | ||
symbol | ||
} of bundleGraph.getExportedSymbols(asset)) { | ||
if (symbol) { | ||
markUsed(a, symbol); | ||
} | ||
} | ||
} | ||
@@ -218,4 +232,4 @@ }); | ||
function shouldExcludeAsset(asset, usedExports, bundleGraph) { | ||
return asset.sideEffects === false && !asset.meta.isCommonJS && !bundleGraph.isAssetReferencedByAssetType(asset, 'js') && (!usedExports.has(asset.id) || (0, _nullthrows.default)(usedExports.get(asset.id)).size === 0); | ||
function shouldExcludeAsset(asset, usedExports) { | ||
return asset.sideEffects === false && !asset.meta.isCommonJS && (!usedExports.has(asset.id) || (0, _nullthrows.default)(usedExports.get(asset.id)).size === 0); | ||
} | ||
@@ -222,0 +236,0 @@ |
{ | ||
"name": "@parcel/scope-hoisting", | ||
"version": "2.0.0-nightly.102+28f7bfd1", | ||
"version": "2.0.0-nightly.107+b2851080", | ||
"description": "Blazing fast, zero configuration web application bundler", | ||
@@ -24,8 +24,8 @@ "license": "MIT", | ||
"@babel/types": "^7.3.3", | ||
"@parcel/diagnostic": "2.0.0-nightly.102+28f7bfd1", | ||
"@parcel/utils": "2.0.0-nightly.102+28f7bfd1", | ||
"@parcel/diagnostic": "2.0.0-nightly.107+b2851080", | ||
"@parcel/utils": "2.0.0-nightly.107+b2851080", | ||
"babylon-walk": "^1.0.2", | ||
"nullthrows": "^1.1.1" | ||
}, | ||
"gitHead": "28f7bfd13f0c03317b75cb70c433681250a70518" | ||
"gitHead": "b2851080dd7c4c1df22b2c512ce50d7424c36927" | ||
} |
@@ -56,3 +56,3 @@ // @flow | ||
enter(asset, context) { | ||
if (shouldExcludeAsset(asset, usedExports, bundleGraph)) { | ||
if (shouldExcludeAsset(asset, usedExports)) { | ||
return context; | ||
@@ -67,3 +67,3 @@ } | ||
exit(asset, context) { | ||
if (!context || shouldExcludeAsset(asset, usedExports, bundleGraph)) { | ||
if (!context || shouldExcludeAsset(asset, usedExports)) { | ||
return; | ||
@@ -181,2 +181,12 @@ } | ||
} | ||
// If the asset is referenced by another bundle, include all exports. | ||
if (bundleGraph.isAssetReferencedByAssetType(asset, 'js')) { | ||
markUsed(asset, '*'); | ||
for (let {asset: a, symbol} of bundleGraph.getExportedSymbols(asset)) { | ||
if (symbol) { | ||
markUsed(a, symbol); | ||
} | ||
} | ||
} | ||
}); | ||
@@ -202,3 +212,2 @@ | ||
usedExports: Map<string, Set<Symbol>>, | ||
bundleGraph: BundleGraph, | ||
) { | ||
@@ -208,3 +217,2 @@ return ( | ||
!asset.meta.isCommonJS && | ||
!bundleGraph.isAssetReferencedByAssetType(asset, 'js') && | ||
(!usedExports.has(asset.id) || | ||
@@ -211,0 +219,0 @@ nullthrows(usedExports.get(asset.id)).size === 0) |
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
164911
4319