Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@astrojs/cli-kit

Package Overview
Dependencies
Maintainers
4
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@astrojs/cli-kit - npm Package Compare versions

Comparing version 0.1.0 to 0.1.1

12

dist/messages/index.js
import readline from 'node:readline';
import color from 'chalk';
import logUpdate from 'log-update';
import { random, randomBetween, sleep, isWin } from '../utils/index.js';
import { random, randomBetween, sleep, useAscii } from '../utils/index.js';
import { action } from '../prompt/util/action.js';

@@ -41,6 +41,6 @@ import { strip } from '../prompt/util/clear.js';

const _messages = Array.isArray(messages) ? messages : [messages];
const eyes = isWin ? ['•', '•', 'o', 'o', '•', 'O', '^', '•'] : ['●', '●', '●', '●', '●', '○', '○', '•'];
const mouths = isWin ? ['•', 'O', '*', 'o', 'o', '•', '-'] : ['•', '○', '■', '▪', '▫', '▬', '▭', '-', '○'];
const walls = isWin ? ['—', '|'] : ['─', '│'];
const corners = isWin ? ['+', '+', '+', '+'] : ['╭', '╮', '╰', '╯'];
const eyes = useAscii ? ['•', '•', 'o', 'o', '•', 'O', '^', '•'] : ['●', '●', '●', '●', '●', '○', '○', '•'];
const mouths = useAscii ? ['•', 'O', '*', 'o', 'o', '•', '-'] : ['•', '○', '■', '▪', '▫', '▬', '▭', '-', '○'];
const walls = useAscii ? ['—', '|'] : ['─', '│'];
const corners = useAscii ? ['+', '+', '+', '+'] : ['╭', '╮', '╰', '╯'];
const face = (msg, { mouth = mouths[0], eye = eyes[0] } = {}) => {

@@ -74,3 +74,3 @@ const [h, v] = walls;

await sleep(100);
const text = '\n' + face(_message.join(' '), { mouth: isWin ? 'u' : '◡', eye: isWin ? '^' : '◠' });
const text = '\n' + face(_message.join(' '), { mouth: useAscii ? 'u' : '◡', eye: useAscii ? '^' : '◠' });
logUpdate(text);

@@ -77,0 +77,0 @@ if (!cancelled)

import Prompt from './prompt.js';
import { erase, cursor } from 'sisteransi';
import color from 'chalk';
import { isWin } from '../../utils/index.js';
import { useAscii } from '../../utils/index.js';
import clear, { strip } from '../util/clear.js';

@@ -135,3 +135,3 @@ export default class SelectPrompt extends Prompt {

else {
this.outputText.push(this.choices.map((choice, i) => i === this.cursor ? `${prefix} ${color.green(isWin ? '>' : '●')} ${this.highlight(choice.label)} ${choice.hint ? color.dim(choice.hint) : ''}` : color.dim(`${prefix} ${isWin ? '—' : '○'} ${choice.label} `)).join('\n'));
this.outputText.push(this.choices.map((choice, i) => i === this.cursor ? `${prefix} ${color.green(useAscii ? '>' : '●')} ${this.highlight(choice.label)} ${choice.hint ? color.dim(choice.hint) : ''}` : color.dim(`${prefix} ${useAscii ? '—' : '○'} ${choice.label} `)).join('\n'));
}

@@ -138,0 +138,0 @@ this.outputText = this.outputText.join('');

import Prompt from './prompt.js';
import { erase, cursor } from 'sisteransi';
import color from 'chalk';
import { isWin } from '../../utils/index.js';
import { useAscii } from '../../utils/index.js';
import clear, { lines, strip } from '../util/clear.js';

@@ -198,3 +198,3 @@ /**

if (this.error) {
this.outputError += ` ${color.redBright((isWin ? '> ' : '▶ ') + this.errorMsg)}`;
this.outputError += ` ${color.redBright((useAscii ? '> ' : '▶ ') + this.errorMsg)}`;
}

@@ -201,0 +201,0 @@ this.out.write(erase.line + cursor.to(0) + this.outputText + cursor.save + this.outputError + cursor.restore + cursor.move(this.cursorOffset, 0));

/// <reference types="node" />
export declare const isWin: boolean;
export declare const useAscii: boolean;
export declare const hookExit: () => () => NodeJS.Process;

@@ -4,0 +4,0 @@ export declare const sleep: (ms: number) => Promise<unknown>;

@@ -6,3 +6,5 @@ import color from 'chalk';

import { strip } from '../prompt/util/clear.js';
export const isWin = platform() === 'win32';
const toBoolean = (value) => !['0', 'false'].includes(value);
const { FORCE_UNICODE = '0' } = process.env ?? {};
export const useAscii = platform() === 'darwin' && !toBoolean(FORCE_UNICODE);
export const hookExit = () => {

@@ -9,0 +11,0 @@ const onExit = (code) => {

{
"name": "@astrojs/cli-kit",
"type": "module",
"version": "0.1.0",
"version": "0.1.1",
"license": "MIT",

@@ -6,0 +6,0 @@ "types": "./dist/index.d.ts",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc