@shell-shock/plugin-console 0.1.0 → 0.1.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.
@@ -29,14 +29,14 @@ function AnsiHelpersDeclarations() {
29
29
  name: "cursor",
30
30
  doc: "An object containing ANSI escape codes for controlling the console cursor.",
31
31
  children: __alloy_js_core.code` {
32
- to(x, y) {
32
+ to(x: number, y?: number) {
33
33
  if (!y) {
34
34
  return \`\\x1B[\${x + 1}G\`;
35
35
  }
36
36
 
37
37
  return \`\\x1B[\${y + 1};\${x + 1}H\`;
38
38
  },
39
- move(x, y) {
39
+ move(x: number, y: number) {
40
40
  let ret = '';
41
41
 
42
42
  if (x < 0) {
@@ -2451,14 +2451,9 @@ function SpinnerFunctionDeclaration() {
2451
2451
  }
2452
2452
 
2453
2453
  const streamsToHook = new Set([this.#stream]);
2454
- if (this.#stream === process.stdout || this.#stream === process.stderr) {
2455
- if (isInteractive(process.stdout)) {
2456
- streamsToHook.add(process.stdout);
2457
- }
2458
-
2459
- if (isInteractive(process.stderr)) {
2460
- streamsToHook.add(process.stderr);
2461
- }
2454
+ if (isInteractive && (this.#stream === process.stdout || this.#stream === process.stderr)) {
2455
+ streamsToHook.add(process.stdout);
2456
+ streamsToHook.add(process.stderr);
2462
2457
  }
2463
2458
 
2464
2459
  for (const stream of streamsToHook) {
@@ -2507,7 +2502,7 @@ function SpinnerFunctionDeclaration() {
2507
2502
  }
2508
2503
 
2509
2504
  #stopWithIcon(icon: string, message: string) {
2510
- return this.stop(\`\${icon} \${message ?? this.#message}\`);
2505
+ return this.stop(\` \${icon} \${message ?? this.#message}\`);
2511
2506
  }
2512
2507
 
2513
2508
  #render() {
@@ -2515,7 +2510,6 @@ function SpinnerFunctionDeclaration() {
2515
2510
  return;
2516
2511
  }
2517
2512
 
2518
- const useSynchronizedOutput = isInteractive;
2519
2513
  if (this.#currentFrame === -1 || Date.now() - this.#lastSpinnerFrameTime >= this.#interval) {
2520
2514
  this.#currentFrame = ++this.#currentFrame % this.#frames.length;
2521
2515
  this.#lastSpinnerFrameTime = Date.now();
@@ -2526,7 +2520,7 @@ function SpinnerFunctionDeclaration() {
2526
2520
  display += "\\n";
2527
2521
  }
2528
2522
 
2529
- if (useSynchronizedOutput) {
2523
+ if (isInteractive) {
2530
2524
  this.#withSynchronizedOutput(() => {
2531
2525
  this.clear();
2532
2526
  this.#write(display);
@@ -1 +1 @@
1
- {"version":3,"file":"console-builtin.d.cts","names":[],"sources":["../../src/components/console-builtin.tsx"],"sourcesContent":[],"mappings":";;;;;;iBA+DgB,uBAAA,CAAA,GAAuB;;AAAvC;AA6JA;AAqqDgB,iBArqDA,iBAAA,CAAA,CAqqD4B,EArqDX,QAqqDW;AA8P5C;;;AAA8C,iBA9P9B,4BAAA,CAAA,CA8P8B,EA9PF,QA8PE;AAYnC,KAZC,+BAAA,GAAkC,OAYnC,CAXT,IAWS,CAXJ,wBAWI,EAAA,YAAA,CAAA,CAAA,GAAA;EACD,IAAA,EAAA,SAAA,GAAA,MAAA,GAAA,MAAA,GAAA,OAAA,GAAA,SAAA,GAAA,MAAA,GAAA,QAAA,GAAA,OAAA;EAGC,OAAA,EAJA,mBAIA;EAAQ,KAAA,CAAA,EAHT,mBAGS;EAOH,aAAA,EAAA,KAAA,GAAA,MAA0B,GAAA,MAAA,GACjC,OAAA,GAAA,OAAA;EA2KO,WAAA,EAAA,MAAgB;EA4EhB,MAAA,CAAA,EA/PL,QA+PK;EAmCA,SAAA,CAAA,EAAA,OAAA;AAqFhB,CAAA;AAwCA;AAgiBA;AAQA;AA4nBY,iBA5jDI,0BAAA,CA6jDd,KADgC,EA3jDzB,+BA2jD6B,CAAA,EA3jDE,QA2jDF;AAQtC;;;iBAx5CgB,gBAAA,CAAA,GAAgB;;;;iBA4EhB,4BAAA,CAAA,GAA4B;;;;iBAmC5B,0BAAA,CAAA,GAA0B;;;;iBAqF1B,uBAAA,CAAA,GAAuB;;;;iBAwCvB,0BAAA,CAA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AAmB"}
@@ -1 +1 @@
1
- {"version":3,"file":"console-builtin.d.mts","names":[],"sources":["../../src/components/console-builtin.tsx"],"sourcesContent":[],"mappings":";;;;;;iBA+DgB,uBAAA,CAAA,GAAuB;;AAAvC;AA6JA;AAqqDgB,iBArqDA,iBAAA,CAAA,CAqqD4B,EArqDX,QAqqDW;AA8P5C;;;AAA8C,iBA9P9B,4BAAA,CAAA,CA8P8B,EA9PF,QA8PE;AAYnC,KAZC,+BAAA,GAAkC,OAYnC,CAXT,IAWS,CAXJ,wBAWI,EAAA,YAAA,CAAA,CAAA,GAAA;EACD,IAAA,EAAA,SAAA,GAAA,MAAA,GAAA,MAAA,GAAA,OAAA,GAAA,SAAA,GAAA,MAAA,GAAA,QAAA,GAAA,OAAA;EAGC,OAAA,EAJA,mBAIA;EAAQ,KAAA,CAAA,EAHT,mBAGS;EAOH,aAAA,EAAA,KAAA,GAAA,MAA0B,GAAA,MAAA,GACjC,OAAA,GAAA,OAAA;EA2KO,WAAA,EAAA,MAAgB;EA4EhB,MAAA,CAAA,EA/PL,QA+PK;EAmCA,SAAA,CAAA,EAAA,OAAA;AAqFhB,CAAA;AAwCA;AAgiBA;AAQA;AA4nBY,iBA5jDI,0BAAA,CA6jDd,KADgC,EA3jDzB,+BA2jD6B,CAAA,EA3jDE,QA2jDF;AAQtC;;;iBAx5CgB,gBAAA,CAAA,GAAgB;;;;iBA4EhB,4BAAA,CAAA,GAA4B;;;;iBAmC5B,0BAAA,CAAA,GAA0B;;;;iBAqF1B,uBAAA,CAAA,GAAuB;;;;iBAwCvB,0BAAA,CAAA,GAA0B;;;;KAgiB9B,6BAAA,GAAgC,KAC1C;;;;iBAOc,wBAAA,QAAgC,gCAA6B;KA4nBjE,mBAAA,GAAsB,KAChC;;;;iBAOc,cAAA,QAAsB,sBAAmB"}
1
+ {"version":3,"file":"console-builtin.d.mts","names":[],"sources":["../../src/components/console-builtin.tsx"],"sourcesContent":[],"mappings":";;;;;;iBA+DgB,uBAAA,CAAA,GAAuB;;AAAvC;AA6JA;AAqqDgB,iBArqDA,iBAAA,CAAA,CAqqD4B,EArqDX,QAqqDW;AA8P5C;;;AAA8C,iBA9P9B,4BAAA,CAAA,CA8P8B,EA9PF,QA8PE;AAYnC,KAZC,+BAAA,GAAkC,OAYnC,CAXT,IAWS,CAXJ,wBAWI,EAAA,YAAA,CAAA,CAAA,GAAA;EACD,IAAA,EAAA,SAAA,GAAA,MAAA,GAAA,MAAA,GAAA,OAAA,GAAA,SAAA,GAAA,MAAA,GAAA,QAAA,GAAA,OAAA;EAGC,OAAA,EAJA,mBAIA;EAAQ,KAAA,CAAA,EAHT,mBAGS;EAOH,aAAA,EAAA,KAAA,GAAA,MAA0B,GAAA,MAAA,GACjC,OAAA,GAAA,OAAA;EA2KO,WAAA,EAAA,MAAgB;EA4EhB,MAAA,CAAA,EA/PL,QA+PK;EAmCA,SAAA,CAAA,EAAA,OAAA;AAoFhB,CAAA;AAwCA;AA0hBA;AAQA;AA4nBY,iBArjDI,0BAAA,CAsjDd,KADgC,EApjDzB,+BAojD6B,CAAA,EApjDE,QAojDF;AAQtC;;;iBAj5CgB,gBAAA,CAAA,GAAgB;;;;iBA4EhB,4BAAA,CAAA,GAA4B;;;;iBAmC5B,0BAAA,CAAA,GAA0B;;;;iBAoF1B,uBAAA,CAAA,GAAuB;;;;iBAwCvB,0BAAA,CAAA,GAA0B;;;;KA0hB9B,6BAAA,GAAgC,KAC1C;;;;iBAOc,wBAAA,QAAgC,gCAA6B;KA4nBjE,mBAAA,GAAsB,KAChC;;;;iBAOc,cAAA,QAAsB,sBAAmB"}
@@ -28,14 +28,14 @@ function AnsiHelpersDeclarations() {
28
28
  name: "cursor",
29
29
  doc: "An object containing ANSI escape codes for controlling the console cursor.",
30
30
  children: code` {
31
- to(x, y) {
31
+ to(x: number, y?: number) {
32
32
  if (!y) {
33
33
  return \`\\x1B[\${x + 1}G\`;
34
34
  }
35
35
 
36
36
  return \`\\x1B[\${y + 1};\${x + 1}H\`;
37
37
  },
38
- move(x, y) {
38
+ move(x: number, y: number) {
39
39
  let ret = '';
40
40
 
41
41
  if (x < 0) {
@@ -2450,14 +2450,9 @@ function SpinnerFunctionDeclaration() {
2450
2450
  }
2451
2451
 
2452
2452
  const streamsToHook = new Set([this.#stream]);
2453
- if (this.#stream === process.stdout || this.#stream === process.stderr) {
2454
- if (isInteractive(process.stdout)) {
2455
- streamsToHook.add(process.stdout);
2456
- }
2457
-
2458
- if (isInteractive(process.stderr)) {
2459
- streamsToHook.add(process.stderr);
2460
- }
2453
+ if (isInteractive && (this.#stream === process.stdout || this.#stream === process.stderr)) {
2454
+ streamsToHook.add(process.stdout);
2455
+ streamsToHook.add(process.stderr);
2461
2456
  }
2462
2457
 
2463
2458
  for (const stream of streamsToHook) {
@@ -2506,7 +2501,7 @@ function SpinnerFunctionDeclaration() {
2506
2501
  }
2507
2502
 
2508
2503
  #stopWithIcon(icon: string, message: string) {
2509
- return this.stop(\`\${icon} \${message ?? this.#message}\`);
2504
+ return this.stop(\` \${icon} \${message ?? this.#message}\`);
2510
2505
  }
2511
2506
 
2512
2507
  #render() {
@@ -2514,7 +2509,6 @@ function SpinnerFunctionDeclaration() {
2514
2509
  return;
2515
2510
  }
2516
2511
 
2517
- const useSynchronizedOutput = isInteractive;
2518
2512
  if (this.#currentFrame === -1 || Date.now() - this.#lastSpinnerFrameTime >= this.#interval) {
2519
2513
  this.#currentFrame = ++this.#currentFrame % this.#frames.length;
2520
2514
  this.#lastSpinnerFrameTime = Date.now();
@@ -2525,7 +2519,7 @@ function SpinnerFunctionDeclaration() {
2525
2519
  display += "\\n";
2526
2520
  }
2527
2521
 
2528
- if (useSynchronizedOutput) {
2522
+ if (isInteractive) {
2529
2523
  this.#withSynchronizedOutput(() => {
2530
2524
  this.clear();
2531
2525
  this.#write(display);