snyk 1.1127.0 → 1.1128.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -154134,15 +154134,15 @@ const getChildNodeKey = (name, ancestry, pkgs, pkgKeysByName) => {
154134
154134
  keysFilteredByParentKey = possibleFilteredKeys;
154135
154135
  }
154136
154136
  }
154137
- // If not in bundle then we can just see if it is scoped by parent
154138
- // and then just look directly for it
154139
- if (ancestry.length === 1) {
154140
- return `node_modules/${name}`;
154141
- }
154142
- const parentName = ancestry[ancestry.length - 1].name;
154143
- return pkgs[`node_modules/${parentName}/node_modules/${name}`]
154144
- ? `node_modules/${parentName}/node_modules/${name}`
154145
- : `node_modules/${name}`;
154137
+ const ancestry_names = ancestry.map((el) => el.name).concat(name);
154138
+ while (ancestry_names.length > 0) {
154139
+ const possible_key = `node_modules/${ancestry_names.join('/node_modules/')}`;
154140
+ if (pkgs[possible_key]) {
154141
+ return possible_key;
154142
+ }
154143
+ ancestry_names.shift();
154144
+ }
154145
+ return undefined;
154146
154146
  };
154147
154147
  //# sourceMappingURL=index.js.map
154148
154148