pnpm-viz 1.0.1 → 1.0.2
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.
- package/dist/core/parser.js +21 -2
- package/package.json +1 -1
package/dist/core/parser.js
CHANGED
|
@@ -115,9 +115,28 @@ export class LockfileParser {
|
|
|
115
115
|
return graph;
|
|
116
116
|
}
|
|
117
117
|
processDeps(deps, parentId, graph, type) {
|
|
118
|
-
for (const [name,
|
|
118
|
+
for (const [name, refValue] of Object.entries(deps)) {
|
|
119
|
+
// pnpm refs can be: '1.2.3', 'link:../foo', or objects in some versions
|
|
120
|
+
let ref = '';
|
|
121
|
+
if (typeof refValue === 'string') {
|
|
122
|
+
ref = refValue;
|
|
123
|
+
}
|
|
124
|
+
else if (typeof refValue === 'number') {
|
|
125
|
+
ref = String(refValue);
|
|
126
|
+
}
|
|
127
|
+
else if (typeof refValue === 'object' && refValue !== null) {
|
|
128
|
+
if (refValue.version) {
|
|
129
|
+
ref = String(refValue.version);
|
|
130
|
+
}
|
|
131
|
+
else {
|
|
132
|
+
// unexpected format, skip for now
|
|
133
|
+
continue;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
else {
|
|
137
|
+
continue;
|
|
138
|
+
}
|
|
119
139
|
// logic to resolve ref to a package path in 'packages'
|
|
120
|
-
// pnpm refs can be: '1.2.3', '/foo/1.2.3', 'link:../foo'
|
|
121
140
|
let targetId = ref;
|
|
122
141
|
if (ref.startsWith('link:')) {
|
|
123
142
|
// Local workspace link
|