Improve astro check (#3906)
* Improve astro check * Fix lockfile * Update to latest language-server version * Add simple tests * Fix lock file, again * Fix `astro check` not working on Windows, speeds up tests * Add changeest
This commit is contained in:
parent
07fb544dab
commit
b37695c34c
17 changed files with 355 additions and 186 deletions
18
.changeset/rich-bats-tell.md
Normal file
18
.changeset/rich-bats-tell.md
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
---
|
||||||
|
'astro': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Fixed many long-standing issues with `astro check`
|
||||||
|
|
||||||
|
- Fixed it not working on Windows at all
|
||||||
|
- Fixed red squiggles not showing in the proper place in certain contexts, notably with strings using non-latin characters
|
||||||
|
- Fixed IDE links pointing to the wrong line number and character
|
||||||
|
- Fixed line numbers being off by one
|
||||||
|
- Fixed IDE links not working when the project wasn't at the root of the folder
|
||||||
|
|
||||||
|
Additionally added some features:
|
||||||
|
|
||||||
|
- Added more pretty colors
|
||||||
|
- Fixed it not working at all on Windows
|
||||||
|
- Warnings and hints are now printed alongside errors
|
||||||
|
- Surrounding lines are now shown when relevant (aka not empty)
|
|
@ -83,7 +83,7 @@
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@astrojs/compiler": "^0.19.0",
|
"@astrojs/compiler": "^0.19.0",
|
||||||
"@astrojs/language-server": "^0.13.4",
|
"@astrojs/language-server": "^0.20.0",
|
||||||
"@astrojs/markdown-remark": "^0.11.7",
|
"@astrojs/markdown-remark": "^0.11.7",
|
||||||
"@astrojs/prism": "0.6.0",
|
"@astrojs/prism": "0.6.0",
|
||||||
"@astrojs/telemetry": "^0.4.0",
|
"@astrojs/telemetry": "^0.4.0",
|
||||||
|
|
|
@ -1,117 +0,0 @@
|
||||||
/* eslint-disable no-console */
|
|
||||||
import { AstroCheck, DiagnosticSeverity } from '@astrojs/language-server';
|
|
||||||
import type { AstroConfig } from '../@types/astro';
|
|
||||||
|
|
||||||
import glob from 'fast-glob';
|
|
||||||
import * as fs from 'fs';
|
|
||||||
import { bgWhite, black, bold, cyan, red, yellow } from 'kleur/colors';
|
|
||||||
import * as path from 'path';
|
|
||||||
import { pathToFileURL } from 'url';
|
|
||||||
|
|
||||||
async function openAllDocuments(
|
|
||||||
workspaceUri: URL,
|
|
||||||
filePathsToIgnore: string[],
|
|
||||||
checker: AstroCheck
|
|
||||||
) {
|
|
||||||
const files = await glob('**/*.astro', {
|
|
||||||
cwd: workspaceUri.pathname,
|
|
||||||
ignore: ['node_modules/**'].concat(filePathsToIgnore.map((ignore) => `${ignore}/**`)),
|
|
||||||
});
|
|
||||||
const absFilePaths = files.map((f) => path.resolve(workspaceUri.pathname, f));
|
|
||||||
|
|
||||||
for (const absFilePath of absFilePaths) {
|
|
||||||
const text = fs.readFileSync(absFilePath, 'utf-8');
|
|
||||||
checker.upsertDocument({
|
|
||||||
uri: pathToFileURL(absFilePath).toString(),
|
|
||||||
text,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
interface Result {
|
|
||||||
errors: number;
|
|
||||||
warnings: number;
|
|
||||||
}
|
|
||||||
|
|
||||||
function offsetAt({ line, character }: { line: number; character: number }, text: string) {
|
|
||||||
let i = 0;
|
|
||||||
let l = 0;
|
|
||||||
let c = 0;
|
|
||||||
while (i < text.length) {
|
|
||||||
if (l === line && c === character) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
let char = text[i];
|
|
||||||
switch (char) {
|
|
||||||
case '\n': {
|
|
||||||
l++;
|
|
||||||
c = 0;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
default: {
|
|
||||||
c++;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
|
|
||||||
return i;
|
|
||||||
}
|
|
||||||
|
|
||||||
function generateString(str: string, len: number) {
|
|
||||||
return Array.from({ length: len }, () => str).join('');
|
|
||||||
}
|
|
||||||
|
|
||||||
export async function run() {}
|
|
||||||
|
|
||||||
export async function check(astroConfig: AstroConfig) {
|
|
||||||
const root = astroConfig.root;
|
|
||||||
let checker = new AstroCheck(root.toString());
|
|
||||||
await openAllDocuments(root, [], checker);
|
|
||||||
|
|
||||||
let diagnostics = await checker.getDiagnostics();
|
|
||||||
|
|
||||||
let result: Result = {
|
|
||||||
errors: 0,
|
|
||||||
warnings: 0,
|
|
||||||
};
|
|
||||||
|
|
||||||
diagnostics.forEach((diag) => {
|
|
||||||
diag.diagnostics.forEach((d) => {
|
|
||||||
switch (d.severity) {
|
|
||||||
case DiagnosticSeverity.Error: {
|
|
||||||
console.error(
|
|
||||||
`${bold(cyan(path.relative(root.pathname, diag.filePath)))}:${bold(
|
|
||||||
yellow(d.range.start.line)
|
|
||||||
)}:${bold(yellow(d.range.start.character))} - ${d.message}`
|
|
||||||
);
|
|
||||||
let startOffset = offsetAt({ line: d.range.start.line, character: 0 }, diag.text);
|
|
||||||
let endOffset = offsetAt({ line: d.range.start.line + 1, character: 0 }, diag.text);
|
|
||||||
let str = diag.text.substring(startOffset, endOffset - 1);
|
|
||||||
const lineNumStr = d.range.start.line.toString();
|
|
||||||
const lineNumLen = lineNumStr.length;
|
|
||||||
console.error(`${bgWhite(black(lineNumStr))} ${str}`);
|
|
||||||
let tildes = generateString('~', d.range.end.character - d.range.start.character);
|
|
||||||
let spaces = generateString(' ', d.range.start.character + lineNumLen - 1);
|
|
||||||
console.error(` ${spaces}${bold(red(tildes))}\n`);
|
|
||||||
result.errors++;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case DiagnosticSeverity.Warning: {
|
|
||||||
result.warnings++;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
if (result.errors) {
|
|
||||||
console.error(`Found ${result.errors} errors.`);
|
|
||||||
}
|
|
||||||
|
|
||||||
const exitCode = result.errors ? 1 : 0;
|
|
||||||
return exitCode;
|
|
||||||
}
|
|
96
packages/astro/src/cli/check/index.ts
Normal file
96
packages/astro/src/cli/check/index.ts
Normal file
|
@ -0,0 +1,96 @@
|
||||||
|
/* eslint-disable no-console */
|
||||||
|
import { AstroCheck, DiagnosticSeverity } from '@astrojs/language-server';
|
||||||
|
import type { AstroConfig } from '../../@types/astro';
|
||||||
|
|
||||||
|
import glob from 'fast-glob';
|
||||||
|
import * as fs from 'fs';
|
||||||
|
import { bold, dim, red, yellow } from 'kleur/colors';
|
||||||
|
import ora from 'ora';
|
||||||
|
import { fileURLToPath, pathToFileURL } from 'url';
|
||||||
|
import { printDiagnostic } from './print.js';
|
||||||
|
|
||||||
|
interface Result {
|
||||||
|
errors: number;
|
||||||
|
// The language server cannot actually return any warnings at the moment, but we'll keep this here for future use
|
||||||
|
warnings: number;
|
||||||
|
hints: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function check(astroConfig: AstroConfig) {
|
||||||
|
console.log(bold('astro check'));
|
||||||
|
|
||||||
|
const root = astroConfig.root;
|
||||||
|
|
||||||
|
const spinner = ora(` Getting diagnostics for Astro files in ${fileURLToPath(root)}…`).start();
|
||||||
|
|
||||||
|
let checker = new AstroCheck(root.toString());
|
||||||
|
const filesCount = await openAllDocuments(root, [], checker);
|
||||||
|
|
||||||
|
let diagnostics = await checker.getDiagnostics();
|
||||||
|
|
||||||
|
spinner.succeed();
|
||||||
|
|
||||||
|
let result: Result = {
|
||||||
|
errors: 0,
|
||||||
|
warnings: 0,
|
||||||
|
hints: 0,
|
||||||
|
};
|
||||||
|
|
||||||
|
diagnostics.forEach((diag) => {
|
||||||
|
diag.diagnostics.forEach((d) => {
|
||||||
|
console.log(printDiagnostic(diag.filePath, diag.text, d));
|
||||||
|
|
||||||
|
switch (d.severity) {
|
||||||
|
case DiagnosticSeverity.Error: {
|
||||||
|
result.errors++;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case DiagnosticSeverity.Warning: {
|
||||||
|
result.warnings++;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case DiagnosticSeverity.Hint: {
|
||||||
|
result.hints++;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
console.log(
|
||||||
|
[
|
||||||
|
bold(`Result (${filesCount} file${filesCount === 1 ? '' : 's'}): `),
|
||||||
|
bold(red(`${result.errors} ${result.errors === 1 ? 'error' : 'errors'}`)),
|
||||||
|
bold(yellow(`${result.warnings} ${result.warnings === 1 ? 'warning' : 'warnings'}`)),
|
||||||
|
dim(`${result.hints} ${result.hints === 1 ? 'hint' : 'hints'}\n`),
|
||||||
|
].join(`\n${dim('-')} `)
|
||||||
|
);
|
||||||
|
|
||||||
|
const exitCode = result.errors ? 1 : 0;
|
||||||
|
return exitCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Open all Astro files in the given directory and return the number of files found.
|
||||||
|
*/
|
||||||
|
async function openAllDocuments(
|
||||||
|
workspaceUri: URL,
|
||||||
|
filePathsToIgnore: string[],
|
||||||
|
checker: AstroCheck
|
||||||
|
): Promise<number> {
|
||||||
|
const files = await glob('**/*.astro', {
|
||||||
|
cwd: fileURLToPath(workspaceUri),
|
||||||
|
ignore: ['node_modules/**'].concat(filePathsToIgnore.map((ignore) => `${ignore}/**`)),
|
||||||
|
absolute: true,
|
||||||
|
});
|
||||||
|
|
||||||
|
for (const file of files) {
|
||||||
|
const text = fs.readFileSync(file, 'utf-8');
|
||||||
|
checker.upsertDocument({
|
||||||
|
uri: pathToFileURL(file).toString(),
|
||||||
|
text,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return files.length;
|
||||||
|
}
|
118
packages/astro/src/cli/check/print.ts
Normal file
118
packages/astro/src/cli/check/print.ts
Normal file
|
@ -0,0 +1,118 @@
|
||||||
|
import { Diagnostic, DiagnosticSeverity, offsetAt } from '@astrojs/language-server';
|
||||||
|
import {
|
||||||
|
bgRed,
|
||||||
|
bgWhite,
|
||||||
|
bgYellow,
|
||||||
|
black,
|
||||||
|
bold,
|
||||||
|
cyan,
|
||||||
|
gray,
|
||||||
|
red,
|
||||||
|
white,
|
||||||
|
yellow,
|
||||||
|
} from 'kleur/colors';
|
||||||
|
import stringWidth from 'string-width';
|
||||||
|
|
||||||
|
export function printDiagnostic(filePath: string, text: string, diag: Diagnostic): string {
|
||||||
|
let result = [];
|
||||||
|
|
||||||
|
// Lines and characters are 0-indexed, so we need to add 1 to the offset to get the actual line and character
|
||||||
|
const realStartLine = diag.range.start.line + 1;
|
||||||
|
const realStartCharacter = diag.range.start.character + 1;
|
||||||
|
|
||||||
|
// IDE friendly path that user can CTRL+Click to open the file at a specific line / character
|
||||||
|
const IDEFilePath = `${bold(cyan(filePath))}:${bold(yellow(realStartLine))}:${bold(
|
||||||
|
yellow(realStartCharacter)
|
||||||
|
)}`;
|
||||||
|
result.push(
|
||||||
|
`${IDEFilePath} ${bold(getColorForSeverity(diag, getStringForSeverity(diag)))}: ${diag.message}`
|
||||||
|
);
|
||||||
|
|
||||||
|
// Optionally add the line before the error to add context if not empty
|
||||||
|
const previousLine = getLine(diag.range.start.line - 1, text);
|
||||||
|
if (previousLine) {
|
||||||
|
result.push(`${getPrintableLineNumber(realStartLine - 1)} ${gray(previousLine)}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add the line with the error
|
||||||
|
const str = getLine(diag.range.start.line, text);
|
||||||
|
const lineNumStr = realStartLine.toString().padStart(2, '0');
|
||||||
|
const lineNumLen = lineNumStr.length;
|
||||||
|
result.push(`${getBackgroundForSeverity(diag, lineNumStr)} ${str}`);
|
||||||
|
|
||||||
|
// Adds tildes under the specific range where the diagnostic is
|
||||||
|
const tildes = generateString('~', diag.range.end.character - diag.range.start.character);
|
||||||
|
|
||||||
|
// NOTE: This is not perfect, if the line include any characters that is made of multiple characters, for example
|
||||||
|
// regionals flags, but the terminal can't display it, then the number of spaces will be wrong. Not sure how to fix.
|
||||||
|
const beforeChars = stringWidth(str.substring(0, diag.range.start.character));
|
||||||
|
const spaces = generateString(' ', beforeChars + lineNumLen - 1);
|
||||||
|
result.push(` ${spaces}${bold(getColorForSeverity(diag, tildes))}`);
|
||||||
|
|
||||||
|
const nextLine = getLine(diag.range.start.line + 1, text);
|
||||||
|
if (nextLine) {
|
||||||
|
result.push(`${getPrintableLineNumber(realStartLine + 1)} ${gray(nextLine)}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Force a new line at the end
|
||||||
|
result.push('');
|
||||||
|
|
||||||
|
return result.join('\n');
|
||||||
|
}
|
||||||
|
|
||||||
|
function generateString(str: string, len: number): string {
|
||||||
|
return Array.from({ length: len }, () => str).join('');
|
||||||
|
}
|
||||||
|
|
||||||
|
function getStringForSeverity(diag: Diagnostic): string {
|
||||||
|
switch (diag.severity) {
|
||||||
|
case DiagnosticSeverity.Error:
|
||||||
|
return 'Error';
|
||||||
|
case DiagnosticSeverity.Warning:
|
||||||
|
return 'Warning';
|
||||||
|
case DiagnosticSeverity.Hint:
|
||||||
|
return 'Hint';
|
||||||
|
default:
|
||||||
|
return 'Unknown';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function getColorForSeverity(diag: Diagnostic, text: string): string {
|
||||||
|
switch (diag.severity) {
|
||||||
|
case DiagnosticSeverity.Error:
|
||||||
|
return red(text);
|
||||||
|
case DiagnosticSeverity.Warning:
|
||||||
|
return yellow(text);
|
||||||
|
case DiagnosticSeverity.Hint:
|
||||||
|
return gray(text);
|
||||||
|
default:
|
||||||
|
return text;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function getBackgroundForSeverity(diag: Diagnostic, text: string): string {
|
||||||
|
switch (diag.severity) {
|
||||||
|
case DiagnosticSeverity.Error:
|
||||||
|
return bgRed(white(text));
|
||||||
|
case DiagnosticSeverity.Warning:
|
||||||
|
return bgYellow(white(text));
|
||||||
|
case DiagnosticSeverity.Hint:
|
||||||
|
return bgWhite(black(text));
|
||||||
|
default:
|
||||||
|
return text;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function getPrintableLineNumber(line: number): string {
|
||||||
|
return bgWhite(black(line.toString().padStart(2, '0')));
|
||||||
|
}
|
||||||
|
|
||||||
|
function getLine(line: number, text: string): string {
|
||||||
|
return text
|
||||||
|
.substring(
|
||||||
|
offsetAt({ line, character: 0 }, text),
|
||||||
|
offsetAt({ line, character: Number.MAX_SAFE_INTEGER }, text)
|
||||||
|
)
|
||||||
|
.replace(/\t/g, ' ')
|
||||||
|
.trimEnd();
|
||||||
|
}
|
|
@ -15,7 +15,7 @@ import preview from '../core/preview/index.js';
|
||||||
import { ASTRO_VERSION, createSafeError } from '../core/util.js';
|
import { ASTRO_VERSION, createSafeError } from '../core/util.js';
|
||||||
import * as event from '../events/index.js';
|
import * as event from '../events/index.js';
|
||||||
import { eventConfigError, eventError, telemetry } from '../events/index.js';
|
import { eventConfigError, eventError, telemetry } from '../events/index.js';
|
||||||
import { check } from './check.js';
|
import { check } from './check/index.js';
|
||||||
import { openInBrowser } from './open.js';
|
import { openInBrowser } from './open.js';
|
||||||
import * as telemetryHandler from './telemetry.js';
|
import * as telemetryHandler from './telemetry.js';
|
||||||
|
|
||||||
|
|
|
@ -31,6 +31,31 @@ describe('astro cli', () => {
|
||||||
expect(proc.stdout).to.include('Complete');
|
expect(proc.stdout).to.include('Complete');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('astro check no errors', async () => {
|
||||||
|
let proc = undefined;
|
||||||
|
const projectRootURL = new URL('./fixtures/astro-check-no-errors/', import.meta.url);
|
||||||
|
try {
|
||||||
|
proc = await cli('check', '--root', fileURLToPath(projectRootURL));
|
||||||
|
} catch (err) {}
|
||||||
|
|
||||||
|
expect(proc?.stdout).to.include('0 errors');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('astro check has errors', async () => {
|
||||||
|
let stdout = undefined;
|
||||||
|
const projectRootURL = new URL('./fixtures/astro-check-errors/', import.meta.url);
|
||||||
|
|
||||||
|
// When `astro check` finds errors, it returns an error code. As such, we need to wrap this
|
||||||
|
// in a try/catch because otherwise Mocha will always report this test as a fail
|
||||||
|
try {
|
||||||
|
await cli('check', '--root', fileURLToPath(projectRootURL));
|
||||||
|
} catch (err) {
|
||||||
|
stdout = err.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
expect(stdout).to.include('1 error');
|
||||||
|
});
|
||||||
|
|
||||||
it('astro dev welcome', async () => {
|
it('astro dev welcome', async () => {
|
||||||
const pkgURL = new URL('../package.json', import.meta.url);
|
const pkgURL = new URL('../package.json', import.meta.url);
|
||||||
const pkgVersion = await fs.readFile(pkgURL, 'utf8').then((data) => JSON.parse(data).version);
|
const pkgVersion = await fs.readFile(pkgURL, 'utf8').then((data) => JSON.parse(data).version);
|
||||||
|
|
6
packages/astro/test/fixtures/astro-check-errors/astro.config.mjs
vendored
Normal file
6
packages/astro/test/fixtures/astro-check-errors/astro.config.mjs
vendored
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
import { defineConfig } from 'astro/config';
|
||||||
|
|
||||||
|
// https://astro.build/config
|
||||||
|
export default defineConfig({
|
||||||
|
integrations: [],
|
||||||
|
});
|
8
packages/astro/test/fixtures/astro-check-errors/package.json
vendored
Normal file
8
packages/astro/test/fixtures/astro-check-errors/package.json
vendored
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
{
|
||||||
|
"name": "@test/astro-check-errors",
|
||||||
|
"version": "0.0.0",
|
||||||
|
"private": true,
|
||||||
|
"dependencies": {
|
||||||
|
"astro": "workspace:*"
|
||||||
|
}
|
||||||
|
}
|
15
packages/astro/test/fixtures/astro-check-errors/src/pages/index.astro
vendored
Normal file
15
packages/astro/test/fixtures/astro-check-errors/src/pages/index.astro
vendored
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
---
|
||||||
|
console.log(doesntExist)
|
||||||
|
---
|
||||||
|
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>Document</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div>Hello, Astro!</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
2
packages/astro/test/fixtures/astro-check-errors/tsconfig.json
vendored
Normal file
2
packages/astro/test/fixtures/astro-check-errors/tsconfig.json
vendored
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
// Having a `tsconfig.json`, even empty speeds up the test massively since TypeScript does not have to look for one
|
||||||
|
{}
|
6
packages/astro/test/fixtures/astro-check-no-errors/astro.config.mjs
vendored
Normal file
6
packages/astro/test/fixtures/astro-check-no-errors/astro.config.mjs
vendored
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
import { defineConfig } from 'astro/config';
|
||||||
|
|
||||||
|
// https://astro.build/config
|
||||||
|
export default defineConfig({
|
||||||
|
integrations: [],
|
||||||
|
});
|
8
packages/astro/test/fixtures/astro-check-no-errors/package.json
vendored
Normal file
8
packages/astro/test/fixtures/astro-check-no-errors/package.json
vendored
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
{
|
||||||
|
"name": "@test/astro-check-no-errors",
|
||||||
|
"version": "0.0.0",
|
||||||
|
"private": true,
|
||||||
|
"dependencies": {
|
||||||
|
"astro": "workspace:*"
|
||||||
|
}
|
||||||
|
}
|
11
packages/astro/test/fixtures/astro-check-no-errors/src/pages/index.astro
vendored
Normal file
11
packages/astro/test/fixtures/astro-check-no-errors/src/pages/index.astro
vendored
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>Document</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div>Hello, Astro!</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
2
packages/astro/test/fixtures/astro-check-no-errors/tsconfig.json
vendored
Normal file
2
packages/astro/test/fixtures/astro-check-no-errors/tsconfig.json
vendored
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
// Having a `tsconfig.json`, even empty speeds up the test massively since TypeScript does not have to look for one
|
||||||
|
{}
|
22
packages/webapi/mod.d.ts
vendored
22
packages/webapi/mod.d.ts
vendored
|
@ -1,12 +1,12 @@
|
||||||
export { pathToPosix } from './lib/utils';
|
export { pathToPosix } from './lib/utils';
|
||||||
export { AbortController, AbortSignal, alert, atob, Blob, btoa, ByteLengthQueuingStrategy, cancelAnimationFrame, cancelIdleCallback, CanvasRenderingContext2D, CharacterData, clearTimeout, Comment, CountQueuingStrategy, CSSStyleSheet, CustomElementRegistry, CustomEvent, Document, DocumentFragment, DOMException, Element, Event, EventTarget, fetch, File, FormData, Headers, HTMLBodyElement, HTMLCanvasElement, HTMLDivElement, HTMLDocument, HTMLElement, HTMLHeadElement, HTMLHtmlElement, HTMLImageElement, HTMLSpanElement, HTMLStyleElement, HTMLTemplateElement, HTMLUnknownElement, Image, ImageData, IntersectionObserver, MediaQueryList, MutationObserver, Node, NodeFilter, NodeIterator, OffscreenCanvas, ReadableByteStreamController, ReadableStream, ReadableStreamBYOBReader, ReadableStreamBYOBRequest, ReadableStreamDefaultController, ReadableStreamDefaultReader, Request, requestAnimationFrame, requestIdleCallback, ResizeObserver, Response, setTimeout, ShadowRoot, structuredClone, StyleSheet, Text, TransformStream, TreeWalker, URLPattern, Window, WritableStream, WritableStreamDefaultController, WritableStreamDefaultWriter } from './mod.js';
|
export { AbortController, AbortSignal, alert, atob, Blob, btoa, ByteLengthQueuingStrategy, cancelAnimationFrame, cancelIdleCallback, CanvasRenderingContext2D, CharacterData, clearTimeout, Comment, CountQueuingStrategy, CSSStyleSheet, CustomElementRegistry, CustomEvent, Document, DocumentFragment, DOMException, Element, Event, EventTarget, fetch, File, FormData, Headers, HTMLBodyElement, HTMLCanvasElement, HTMLDivElement, HTMLDocument, HTMLElement, HTMLHeadElement, HTMLHtmlElement, HTMLImageElement, HTMLSpanElement, HTMLStyleElement, HTMLTemplateElement, HTMLUnknownElement, Image, ImageData, IntersectionObserver, MediaQueryList, MutationObserver, Node, NodeFilter, NodeIterator, OffscreenCanvas, ReadableByteStreamController, ReadableStream, ReadableStreamBYOBReader, ReadableStreamBYOBRequest, ReadableStreamDefaultController, ReadableStreamDefaultReader, Request, requestAnimationFrame, requestIdleCallback, ResizeObserver, Response, setTimeout, ShadowRoot, structuredClone, StyleSheet, Text, TransformStream, TreeWalker, URLPattern, Window, WritableStream, WritableStreamDefaultController, WritableStreamDefaultWriter, } from './mod.js';
|
||||||
export declare const polyfill: {
|
export declare const polyfill: {
|
||||||
(target: any, options?: PolyfillOptions): any;
|
(target: any, options?: PolyfillOptions): any;
|
||||||
internals(target: any, name: string): any;
|
internals(target: any, name: string): any;
|
||||||
};
|
};
|
||||||
interface PolyfillOptions {
|
interface PolyfillOptions {
|
||||||
exclude?: string | string[];
|
exclude?: string | string[];
|
||||||
override?: Record<string, {
|
override?: Record<string, {
|
||||||
(...args: any[]): any;
|
(...args: any[]): any;
|
||||||
}>;
|
}>;
|
||||||
}
|
}
|
|
@ -466,7 +466,7 @@ importers:
|
||||||
packages/astro:
|
packages/astro:
|
||||||
specifiers:
|
specifiers:
|
||||||
'@astrojs/compiler': ^0.19.0
|
'@astrojs/compiler': ^0.19.0
|
||||||
'@astrojs/language-server': ^0.13.4
|
'@astrojs/language-server': ^0.20.0
|
||||||
'@astrojs/markdown-remark': ^0.11.7
|
'@astrojs/markdown-remark': ^0.11.7
|
||||||
'@astrojs/prism': 0.6.0
|
'@astrojs/prism': 0.6.0
|
||||||
'@astrojs/telemetry': ^0.4.0
|
'@astrojs/telemetry': ^0.4.0
|
||||||
|
@ -551,7 +551,7 @@ importers:
|
||||||
zod: ^3.17.3
|
zod: ^3.17.3
|
||||||
dependencies:
|
dependencies:
|
||||||
'@astrojs/compiler': 0.19.0
|
'@astrojs/compiler': 0.19.0
|
||||||
'@astrojs/language-server': 0.13.4
|
'@astrojs/language-server': 0.20.0
|
||||||
'@astrojs/markdown-remark': link:../markdown/remark
|
'@astrojs/markdown-remark': link:../markdown/remark
|
||||||
'@astrojs/prism': link:../astro-prism
|
'@astrojs/prism': link:../astro-prism
|
||||||
'@astrojs/telemetry': link:../telemetry
|
'@astrojs/telemetry': link:../telemetry
|
||||||
|
@ -1087,6 +1087,18 @@ importers:
|
||||||
'@astrojs/preact': link:../../../../integrations/preact
|
'@astrojs/preact': link:../../../../integrations/preact
|
||||||
astro: link:../../..
|
astro: link:../../..
|
||||||
|
|
||||||
|
packages/astro/test/fixtures/astro-check-errors:
|
||||||
|
specifiers:
|
||||||
|
astro: workspace:*
|
||||||
|
dependencies:
|
||||||
|
astro: link:../../..
|
||||||
|
|
||||||
|
packages/astro/test/fixtures/astro-check-no-errors:
|
||||||
|
specifiers:
|
||||||
|
astro: workspace:*
|
||||||
|
dependencies:
|
||||||
|
astro: link:../../..
|
||||||
|
|
||||||
packages/astro/test/fixtures/astro-children:
|
packages/astro/test/fixtures/astro-children:
|
||||||
specifiers:
|
specifiers:
|
||||||
'@astrojs/preact': workspace:*
|
'@astrojs/preact': workspace:*
|
||||||
|
@ -2648,18 +2660,16 @@ packages:
|
||||||
resolution: {integrity: sha512-8nvyxZTfCXLyRmYfTttpJT6EPhfBRg0/q4J/Jj3/pNPLzp+vs05ZdktsY6QxAREaOMAnNEtSqcrB4S5DsXOfRg==}
|
resolution: {integrity: sha512-8nvyxZTfCXLyRmYfTttpJT6EPhfBRg0/q4J/Jj3/pNPLzp+vs05ZdktsY6QxAREaOMAnNEtSqcrB4S5DsXOfRg==}
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
/@astrojs/language-server/0.13.4:
|
/@astrojs/language-server/0.20.0:
|
||||||
resolution: {integrity: sha512-xWtzZMEVsEZkRLlHMKiOoQIXyQwdMkBPHsRcO1IbzpCmaMQGfKKYNANJ1FKZSHsybbXG/BBaB+LqgVPFNFufew==}
|
resolution: {integrity: sha512-A2zWnlZLcDtHISX18+f91pzTfz0SsZVvbcIDPQAVHk5ErpvdGEhJSEHhqY+wif5OXP37l+CVLVSnGzdmiXl5wg==}
|
||||||
hasBin: true
|
hasBin: true
|
||||||
dependencies:
|
dependencies:
|
||||||
'@astrojs/svelte-language-integration': 0.1.6_typescript@4.6.4
|
|
||||||
'@vscode/emmet-helper': 2.8.4
|
'@vscode/emmet-helper': 2.8.4
|
||||||
lodash: 4.17.21
|
|
||||||
source-map: 0.7.4
|
source-map: 0.7.4
|
||||||
typescript: 4.6.4
|
typescript: 4.6.4
|
||||||
vscode-css-languageservice: 5.4.2
|
vscode-css-languageservice: 6.0.1
|
||||||
vscode-html-languageservice: 4.2.5
|
vscode-html-languageservice: 5.0.0
|
||||||
vscode-languageserver: 7.0.0
|
vscode-languageserver: 8.0.1
|
||||||
vscode-languageserver-protocol: 3.17.1
|
vscode-languageserver-protocol: 3.17.1
|
||||||
vscode-languageserver-textdocument: 1.0.5
|
vscode-languageserver-textdocument: 1.0.5
|
||||||
vscode-languageserver-types: 3.17.1
|
vscode-languageserver-types: 3.17.1
|
||||||
|
@ -2680,15 +2690,6 @@ packages:
|
||||||
vfile-message: 3.1.2
|
vfile-message: 3.1.2
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
/@astrojs/svelte-language-integration/0.1.6_typescript@4.6.4:
|
|
||||||
resolution: {integrity: sha512-nqczE674kz7GheKSWQwTOL6+NGHghc4INQox048UyHJRaIKHEbCPyFLDBDVY7QJH0jug1komCJ8OZXUn6Z3eLA==}
|
|
||||||
dependencies:
|
|
||||||
svelte: 3.49.0
|
|
||||||
svelte2tsx: 0.5.11_ueozcsexptisi2awlbuwt6eqmq
|
|
||||||
transitivePeerDependencies:
|
|
||||||
- typescript
|
|
||||||
dev: false
|
|
||||||
|
|
||||||
/@babel/code-frame/7.18.6:
|
/@babel/code-frame/7.18.6:
|
||||||
resolution: {integrity: sha512-TDCmlK5eOvH+eH7cdAFlNXeVJqWIQ7gW9tY1GJIpUtFb6CmjVyq2VM3u71bOyR8CRihcCgMUYoDNyLXao3+70Q==}
|
resolution: {integrity: sha512-TDCmlK5eOvH+eH7cdAFlNXeVJqWIQ7gW9tY1GJIpUtFb6CmjVyq2VM3u71bOyR8CRihcCgMUYoDNyLXao3+70Q==}
|
||||||
engines: {node: '>=6.9.0'}
|
engines: {node: '>=6.9.0'}
|
||||||
|
@ -11146,6 +11147,7 @@ packages:
|
||||||
|
|
||||||
/lodash/4.17.21:
|
/lodash/4.17.21:
|
||||||
resolution: {integrity: sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==}
|
resolution: {integrity: sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==}
|
||||||
|
dev: true
|
||||||
|
|
||||||
/log-symbols/4.1.0:
|
/log-symbols/4.1.0:
|
||||||
resolution: {integrity: sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg==}
|
resolution: {integrity: sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg==}
|
||||||
|
@ -14151,21 +14153,6 @@ packages:
|
||||||
svelte: 3.49.0
|
svelte: 3.49.0
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
/svelte2tsx/0.5.11_ueozcsexptisi2awlbuwt6eqmq:
|
|
||||||
resolution: {integrity: sha512-Is95G1wqNvEUJZ9DITRS2zfMwVJRZztMduPs1vJJ0cm65WUg/avBl5vBXjHycQL/qmFpaqa3NG4qWnf7bCHPag==}
|
|
||||||
peerDependencies:
|
|
||||||
svelte: ^3.24
|
|
||||||
typescript: ^4.1.2
|
|
||||||
peerDependenciesMeta:
|
|
||||||
typescript:
|
|
||||||
optional: true
|
|
||||||
dependencies:
|
|
||||||
dedent-js: 1.0.1
|
|
||||||
pascal-case: 3.1.2
|
|
||||||
svelte: 3.49.0
|
|
||||||
typescript: 4.6.4
|
|
||||||
dev: false
|
|
||||||
|
|
||||||
/tailwindcss/3.1.5:
|
/tailwindcss/3.1.5:
|
||||||
resolution: {integrity: sha512-bC/2dy3dGPqxMWAqFSRgQxVCfmO/31ZbeEp8s9DMDh4zgPZ5WW1gxRJkbBkXcTUIzaSUdhWrcsrSOe32ccgB4w==}
|
resolution: {integrity: sha512-bC/2dy3dGPqxMWAqFSRgQxVCfmO/31ZbeEp8s9DMDh4zgPZ5WW1gxRJkbBkXcTUIzaSUdhWrcsrSOe32ccgB4w==}
|
||||||
engines: {node: '>=12.13.0'}
|
engines: {node: '>=12.13.0'}
|
||||||
|
@ -14942,8 +14929,8 @@ packages:
|
||||||
acorn-walk: 8.2.0
|
acorn-walk: 8.2.0
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/vscode-css-languageservice/5.4.2:
|
/vscode-css-languageservice/6.0.1:
|
||||||
resolution: {integrity: sha512-DT7+7vfdT2HDNjDoXWtYJ0lVDdeDEdbMNdK4PKqUl2MS8g7PWt7J5G9B6k9lYox8nOfhCEjLnoNC3UKHHCR1lg==}
|
resolution: {integrity: sha512-81n/eeYuJwQdvpoy6IK1258PtPbO720fl13FcJ5YQECPyHMFkmld1qKHwPJkyLbLPfboqJPM53ys4xW8v+iBVw==}
|
||||||
dependencies:
|
dependencies:
|
||||||
vscode-languageserver-textdocument: 1.0.5
|
vscode-languageserver-textdocument: 1.0.5
|
||||||
vscode-languageserver-types: 3.17.1
|
vscode-languageserver-types: 3.17.1
|
||||||
|
@ -14951,8 +14938,8 @@ packages:
|
||||||
vscode-uri: 3.0.3
|
vscode-uri: 3.0.3
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
/vscode-html-languageservice/4.2.5:
|
/vscode-html-languageservice/5.0.0:
|
||||||
resolution: {integrity: sha512-dbr10KHabB9EaK8lI0XZW7SqOsTfrNyT3Nuj0GoPi4LjGKUmMiLtsqzfedIzRTzqY+w0FiLdh0/kQrnQ0tLxrw==}
|
resolution: {integrity: sha512-KJG13z54aLszskp3ETf8b1EKDypr2Sf5RUsfR6OXmKqEl2ZUfyIxsWz4gbJWjPzoJZx/bGH0ZXVwxJ1rg8OKRQ==}
|
||||||
dependencies:
|
dependencies:
|
||||||
vscode-languageserver-textdocument: 1.0.5
|
vscode-languageserver-textdocument: 1.0.5
|
||||||
vscode-languageserver-types: 3.17.1
|
vscode-languageserver-types: 3.17.1
|
||||||
|
@ -14960,23 +14947,11 @@ packages:
|
||||||
vscode-uri: 3.0.3
|
vscode-uri: 3.0.3
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
/vscode-jsonrpc/6.0.0:
|
|
||||||
resolution: {integrity: sha512-wnJA4BnEjOSyFMvjZdpiOwhSq9uDoK8e/kpRJDTaMYzwlkrhG1fwDIZI94CLsLzlCK5cIbMMtFlJlfR57Lavmg==}
|
|
||||||
engines: {node: '>=8.0.0 || >=10.0.0'}
|
|
||||||
dev: false
|
|
||||||
|
|
||||||
/vscode-jsonrpc/8.0.1:
|
/vscode-jsonrpc/8.0.1:
|
||||||
resolution: {integrity: sha512-N/WKvghIajmEvXpatSzvTvOIz61ZSmOSa4BRA4pTLi+1+jozquQKP/MkaylP9iB68k73Oua1feLQvH3xQuigiQ==}
|
resolution: {integrity: sha512-N/WKvghIajmEvXpatSzvTvOIz61ZSmOSa4BRA4pTLi+1+jozquQKP/MkaylP9iB68k73Oua1feLQvH3xQuigiQ==}
|
||||||
engines: {node: '>=14.0.0'}
|
engines: {node: '>=14.0.0'}
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
/vscode-languageserver-protocol/3.16.0:
|
|
||||||
resolution: {integrity: sha512-sdeUoAawceQdgIfTI+sdcwkiK2KU+2cbEYA0agzM2uqaUy2UpnnGHtWTHVEtS0ES4zHU0eMFRGN+oQgDxlD66A==}
|
|
||||||
dependencies:
|
|
||||||
vscode-jsonrpc: 6.0.0
|
|
||||||
vscode-languageserver-types: 3.16.0
|
|
||||||
dev: false
|
|
||||||
|
|
||||||
/vscode-languageserver-protocol/3.17.1:
|
/vscode-languageserver-protocol/3.17.1:
|
||||||
resolution: {integrity: sha512-BNlAYgQoYwlSgDLJhSG+DeA8G1JyECqRzM2YO6tMmMji3Ad9Mw6AW7vnZMti90qlAKb0LqAlJfSVGEdqMMNzKg==}
|
resolution: {integrity: sha512-BNlAYgQoYwlSgDLJhSG+DeA8G1JyECqRzM2YO6tMmMji3Ad9Mw6AW7vnZMti90qlAKb0LqAlJfSVGEdqMMNzKg==}
|
||||||
dependencies:
|
dependencies:
|
||||||
|
@ -14988,19 +14963,15 @@ packages:
|
||||||
resolution: {integrity: sha512-1ah7zyQjKBudnMiHbZmxz5bYNM9KKZYz+5VQLj+yr8l+9w3g+WAhCkUkWbhMEdC5u0ub4Ndiye/fDyS8ghIKQg==}
|
resolution: {integrity: sha512-1ah7zyQjKBudnMiHbZmxz5bYNM9KKZYz+5VQLj+yr8l+9w3g+WAhCkUkWbhMEdC5u0ub4Ndiye/fDyS8ghIKQg==}
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
/vscode-languageserver-types/3.16.0:
|
|
||||||
resolution: {integrity: sha512-k8luDIWJWyenLc5ToFQQMaSrqCHiLwyKPHKPQZ5zz21vM+vIVUSvsRpcbiECH4WR88K2XZqc4ScRcZ7nk/jbeA==}
|
|
||||||
dev: false
|
|
||||||
|
|
||||||
/vscode-languageserver-types/3.17.1:
|
/vscode-languageserver-types/3.17.1:
|
||||||
resolution: {integrity: sha512-K3HqVRPElLZVVPtMeKlsyL9aK0GxGQpvtAUTfX4k7+iJ4mc1M+JM+zQwkgGy2LzY0f0IAafe8MKqIkJrxfGGjQ==}
|
resolution: {integrity: sha512-K3HqVRPElLZVVPtMeKlsyL9aK0GxGQpvtAUTfX4k7+iJ4mc1M+JM+zQwkgGy2LzY0f0IAafe8MKqIkJrxfGGjQ==}
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
/vscode-languageserver/7.0.0:
|
/vscode-languageserver/8.0.1:
|
||||||
resolution: {integrity: sha512-60HTx5ID+fLRcgdHfmz0LDZAXYEV68fzwG0JWwEPBode9NuMYTIxuYXPg4ngO8i8+Ou0lM7y6GzaYWbiDL0drw==}
|
resolution: {integrity: sha512-sn7SjBwWm3OlmLtgg7jbM0wBULppyL60rj8K5HF0ny/MzN+GzPBX1kCvYdybhl7UW63V5V5tRVnyB8iwC73lSQ==}
|
||||||
hasBin: true
|
hasBin: true
|
||||||
dependencies:
|
dependencies:
|
||||||
vscode-languageserver-protocol: 3.16.0
|
vscode-languageserver-protocol: 3.17.1
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
/vscode-nls/5.0.1:
|
/vscode-nls/5.0.1:
|
||||||
|
|
Loading…
Reference in a new issue