Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/svelte-check/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
},
"homepage": "https://github.com/sveltejs/language-tools#readme",
"dependencies": {
"chalk": "^4.0.0",
"picocolors": "^1.0.0",
"chokidar": "^3.4.1",
"fast-glob": "^3.2.7",
"import-fresh": "^3.2.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/svelte-check/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export default [
...builtins,
// svelte-check dependencies that are system-dependent and should
// be installed as dependencies through npm
'chalk',
'picocolors',
'chokidar',
// Dependencies of svelte-language-server
// we don't want to bundle and instead require them as dependencies
Expand Down
22 changes: 11 additions & 11 deletions packages/svelte-check/src/writers.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import chalk from 'chalk';
import pc from 'picocolors';
import { sep } from 'path';
import { Writable } from 'stream';
import { Diagnostic, DiagnosticSeverity } from 'vscode-languageserver-protocol';
Expand Down Expand Up @@ -54,7 +54,7 @@ export class HumanFriendlyWriter implements Writer {
const { line, character } = diagnostic.range.start;
// eslint-disable-next-line max-len
this.stream.write(
`${workspaceDir}${sep}${chalk.green(filename)}:${line + 1}:${character + 1}\n`
`${workspaceDir}${sep}${pc.green(filename)}:${line + 1}:${character + 1}\n`
);

// Show some context around diagnostic range
Expand All @@ -65,17 +65,17 @@ export class HumanFriendlyWriter implements Writer {

let msg;
if (this.isVerbose) {
msg = `${diagnostic.message} ${source}\n${chalk.cyan(code)}`;
msg = `${diagnostic.message} ${source}\n${pc.cyan(code)}`;
} else {
msg = `${diagnostic.message} ${source}`;
}

if (diagnostic.severity === DiagnosticSeverity.Error) {
this.stream.write(`${chalk.red('Error')}: ${msg}\n`);
this.stream.write(`${pc.red('Error')}: ${msg}\n`);
} else if (diagnostic.severity === DiagnosticSeverity.Warning) {
this.stream.write(`${chalk.yellow('Warn')}: ${msg}\n`);
this.stream.write(`${pc.yellow('Warn')}: ${msg}\n`);
} else {
this.stream.write(`${chalk.gray('Hint')}: ${msg}\n`);
this.stream.write(`${pc.gray('Hint')}: ${msg}\n`);
}

this.stream.write('\n');
Expand All @@ -89,7 +89,7 @@ export class HumanFriendlyWriter implements Writer {
offsetAt({ line: diagnostic.range.start.line, character: 0 }, text),
startOffset
);
const codeHighlight = chalk.magenta(text.substring(startOffset, endOffset));
const codeHighlight = pc.magenta(text.substring(startOffset, endOffset));
const codePost = text.substring(
endOffset,
offsetAt({ line: diagnostic.range.end.line, character: Number.MAX_SAFE_INTEGER }, text)
Expand All @@ -113,13 +113,13 @@ export class HumanFriendlyWriter implements Writer {
`${hintCount} ${hintCount === 1 ? 'hint' : 'hints'}\n`
].join('');
if (errorCount !== 0) {
this.stream.write(chalk.red(message));
this.stream.write(pc.red(message));
} else if (warningCount !== 0) {
this.stream.write(chalk.yellow(message));
this.stream.write(pc.yellow(message));
} else if (hintCount !== 0) {
this.stream.write(chalk.grey(message));
this.stream.write(pc.gray(message));
} else {
this.stream.write(chalk.green(message));
this.stream.write(pc.green(message));
}
if (this.isWatchMode) {
this.stream.write('Watching for file changes...');
Expand Down
5 changes: 5 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2060,6 +2060,11 @@ periscopic@^2.0.2:
estree-walker "^1.0.0"
is-reference "^1.1.4"

picocolors@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/picocolors/-/picocolors-1.0.0.tgz#cb5bdc74ff3f51892236eaf79d68bc44564ab81c"
integrity sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==

picomatch@^2.0.4:
version "2.2.1"
resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.2.1.tgz#21bac888b6ed8601f831ce7816e335bc779f0a4a"
Expand Down