numux 1.10.2 → 1.10.3

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.
Files changed (2) hide show
  1. package/dist/numux.js +22 -3
  2. package/package.json +1 -1
package/dist/numux.js CHANGED
@@ -22,7 +22,7 @@ var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports,
22
22
  var require_package = __commonJS((exports, module) => {
23
23
  module.exports = {
24
24
  name: "numux",
25
- version: "1.10.2",
25
+ version: "1.10.3",
26
26
  description: "Terminal multiplexer with dependency orchestration",
27
27
  type: "module",
28
28
  license: "MIT",
@@ -608,6 +608,24 @@ function detectPackageManager(pkgJson, cwd) {
608
608
  function isGlobPattern(name) {
609
609
  return /[*?[]/.test(name);
610
610
  }
611
+ function deriveShortName(pattern, scriptName) {
612
+ let prefixEnd = 0;
613
+ while (prefixEnd < pattern.length && !"*?[".includes(pattern[prefixEnd])) {
614
+ prefixEnd++;
615
+ }
616
+ let suffixStart = pattern.length;
617
+ while (suffixStart > 0 && !"*?[".includes(pattern[suffixStart - 1])) {
618
+ suffixStart--;
619
+ }
620
+ const prefix = pattern.slice(0, prefixEnd);
621
+ const suffix = pattern.slice(suffixStart);
622
+ let short = scriptName;
623
+ if (prefix && short.startsWith(prefix))
624
+ short = short.slice(prefix.length);
625
+ if (suffix && short.endsWith(suffix))
626
+ short = short.slice(0, short.length - suffix.length);
627
+ return short || scriptName;
628
+ }
611
629
  function splitPatternArgs(raw) {
612
630
  const i = raw.indexOf(" ");
613
631
  if (i === -1)
@@ -652,12 +670,13 @@ function expandScriptPatterns(config, cwd) {
652
670
  const singleColor = typeof template.color === "string" ? template.color : undefined;
653
671
  for (let i = 0;i < matches.length; i++) {
654
672
  const scriptName = matches[i];
655
- if (expanded[scriptName]) {
673
+ const displayName = deriveShortName(globPattern, scriptName);
674
+ if (expanded[displayName]) {
656
675
  throw new Error(`"${name}": expanded script "${scriptName}" collides with an existing process name`);
657
676
  }
658
677
  const color = colors ? colors[i % colors.length] : singleColor;
659
678
  const { color: _color, ...rest } = template;
660
- expanded[scriptName] = {
679
+ expanded[displayName] = {
661
680
  ...rest,
662
681
  command: `${pm} run ${scriptName}${extraArgs}`,
663
682
  ...color ? { color } : {}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "numux",
3
- "version": "1.10.2",
3
+ "version": "1.10.3",
4
4
  "description": "Terminal multiplexer with dependency orchestration",
5
5
  "type": "module",
6
6
  "license": "MIT",