(node)
| 1215 | } |
| 1216 | |
| 1217 | replace (node) { |
| 1218 | this[_delistFromMeta]() |
| 1219 | |
| 1220 | // if the name matches, but is not identical, we are intending to clobber |
| 1221 | // something case-insensitively, so merely setting name and path won't |
| 1222 | // have the desired effect. just set the path so it'll collide in the |
| 1223 | // parent's children map, and leave it at that. |
| 1224 | if (node.parent?.children.get(this.name) === node) { |
| 1225 | this.path = resolve(node.parent.path, 'node_modules', this.name) |
| 1226 | } else { |
| 1227 | this.path = node.path |
| 1228 | this.name = node.name |
| 1229 | } |
| 1230 | |
| 1231 | if (!this.isLink) { |
| 1232 | this.realpath = this.path |
| 1233 | } |
| 1234 | this[_refreshLocation]() |
| 1235 | |
| 1236 | // keep children when a node replaces another |
| 1237 | if (!this.isLink) { |
| 1238 | for (const kid of node.children.values()) { |
| 1239 | kid.parent = this |
| 1240 | } |
| 1241 | if (node.isLink && node.target) { |
| 1242 | node.target.root = null |
| 1243 | } |
| 1244 | } |
| 1245 | |
| 1246 | if (!node.isRoot) { |
| 1247 | this.root = node.root |
| 1248 | } |
| 1249 | |
| 1250 | treeCheck(this) |
| 1251 | } |
| 1252 | |
| 1253 | get inShrinkwrap () { |
| 1254 | return this.parent && |
no test coverage detected