rollup-plugin-visualizer
Advanced tools
Comparing version 3.0.4 to 3.0.5
{ | ||
"name": "rollup-plugin-visualizer", | ||
"version": "3.0.4", | ||
"version": "3.0.5", | ||
"main": "plugin/index.js", | ||
@@ -26,3 +26,3 @@ "author": "Denis Bardadym <bardadymchik@gmail.com>", | ||
"prepare": "yarn run build", | ||
"test": "node build.js --all" | ||
"test": "node build.js --all --e2e" | ||
}, | ||
@@ -29,0 +29,0 @@ "dependencies": { |
@@ -136,10 +136,16 @@ "use strict"; | ||
const removeCommonPrefix = nodeIds => { | ||
const moduleIds = Object.keys(nodeIds); | ||
let commonPrefix = moduleIds[0]; | ||
const skipModule = (id, node) => id.startsWith(PLUGIN_PREFIX) || node.isExternal; | ||
for (const moduleId of moduleIds) { | ||
if (!moduleId.startsWith(PLUGIN_PREFIX)) { | ||
for (let i = 0; i < commonPrefix.length && i < moduleId.length; i++) { | ||
if (commonPrefix[i] !== moduleId[i]) { | ||
const removeCommonPrefix = (nodes, nodeIds) => { | ||
let commonPrefix = null; | ||
for (const [id, uid] of Object.entries(nodeIds)) { | ||
const node = nodes[uid]; | ||
if (commonPrefix == null) { | ||
commonPrefix = id; | ||
} | ||
if (!skipModule(id, node)) { | ||
for (let i = 0; i < commonPrefix.length && i < id.length; i++) { | ||
if (commonPrefix[i] !== id[i]) { | ||
commonPrefix = commonPrefix.slice(0, i); | ||
@@ -153,8 +159,9 @@ break; | ||
const commonPrefixLength = commonPrefix.length; | ||
for (const moduleId of moduleIds) { | ||
if (!moduleId.startsWith(PLUGIN_PREFIX)) { | ||
const newModuleId = moduleId.slice(commonPrefixLength); | ||
const value = nodeIds[moduleId]; | ||
delete nodeIds[moduleId]; | ||
nodeIds[newModuleId] = value; | ||
for (const [id, uid] of Object.entries(nodeIds)) { | ||
const node = nodes[uid]; | ||
if (!skipModule(id, node)) { | ||
const newId = id.slice(commonPrefixLength); | ||
const value = nodeIds[id]; | ||
delete nodeIds[id]; | ||
nodeIds[newId] = value; | ||
} | ||
@@ -161,0 +168,0 @@ } |
@@ -96,3 +96,3 @@ "use strict"; | ||
const { nodes, nodeIds } = mapper; | ||
removeCommonPrefix(nodeIds); | ||
removeCommonPrefix(nodes, nodeIds); | ||
@@ -99,0 +99,0 @@ for (const [id, uid] of Object.entries(nodeIds)) { |
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
413268
12235