stonyx 0.2.3-alpha.53 → 0.2.3-alpha.54
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/util/duplicate-core.js +10 -2
- package/package.json +1 -1
|
@@ -230,6 +230,14 @@ export function findForeignCores(modules, core = undefined, report = IGNORE) {
|
|
|
230
230
|
* Printable ASCII only, and bounded, so a long value cannot push the rest of
|
|
231
231
|
* the message off screen either.
|
|
232
232
|
*/
|
|
233
|
+
/**
|
|
234
|
+
* Roots are clamped at `PATH_MAX` rather than at the version's 64. A root is
|
|
235
|
+
* the one thing in this message a consumer acts on directly, and a truncated
|
|
236
|
+
* path is worse than a long one — the version is a label, the path is an
|
|
237
|
+
* instruction. Nothing longer than this can exist on the filesystems Node runs
|
|
238
|
+
* on, so in practice a root is sanitised and never shortened.
|
|
239
|
+
*/
|
|
240
|
+
const PATH_LIMIT = 1024;
|
|
233
241
|
function display(value, limit = 64) {
|
|
234
242
|
const clamped = value.replace(/[^\x20-\x7e]/g, '?');
|
|
235
243
|
return clamped.length > limit ? `${clamped.slice(0, limit)}...` : clamped;
|
|
@@ -258,8 +266,8 @@ export function duplicateCoreMessage(foreign) {
|
|
|
258
266
|
// with each other.
|
|
259
267
|
const copies = new Set([first.runningCore.root, ...foreign.map(({ moduleCore }) => moduleCore.root)]).size;
|
|
260
268
|
const rows = [
|
|
261
|
-
['running core', display(first.runningCore.version), display(first.runningCore.root,
|
|
262
|
-
...foreign.map(({ moduleName, moduleCore }) => [`seen by "${moduleName}"`, display(moduleCore.version), display(moduleCore.root,
|
|
269
|
+
['running core', display(first.runningCore.version), display(first.runningCore.root, PATH_LIMIT)],
|
|
270
|
+
...foreign.map(({ moduleName, moduleCore }) => [`seen by "${moduleName}"`, display(moduleCore.version), display(moduleCore.root, PATH_LIMIT)]),
|
|
263
271
|
];
|
|
264
272
|
const labelWidth = Math.max(...rows.map(([label]) => label.length));
|
|
265
273
|
const versionWidth = Math.max(...rows.map(([, version]) => version.length));
|