mirror of
https://github.com/withastro/astro.git
synced 2024-12-16 21:46:22 -05:00
Vendor Vite's importMeta.d.ts inside our repo to workaround issue with tsc
on Linux (#4499)
* Update @astrojs/language-server to latest version * Vendor importMeta.d.ts from Vite inside our repo to workaround TypeScript issue on Linux * Remove unnecessary change * Add changeset
This commit is contained in:
parent
78e06c8ec0
commit
1f42c0791c
3 changed files with 43 additions and 1 deletions
5
.changeset/hungry-adults-juggle.md
Normal file
5
.changeset/hungry-adults-juggle.md
Normal file
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
'astro': patch
|
||||
---
|
||||
|
||||
Fix `tsc` not being able to find Vite's import.meta types on Linux
|
2
packages/astro/client-base.d.ts
vendored
2
packages/astro/client-base.d.ts
vendored
|
@ -1,4 +1,4 @@
|
|||
/// <reference types="vite/types/importMeta" />
|
||||
/// <reference path="./import-meta.d.ts" />
|
||||
|
||||
// CSS modules
|
||||
type CSSModuleClasses = { readonly [key: string]: string };
|
||||
|
|
37
packages/astro/import-meta.d.ts
vendored
Normal file
37
packages/astro/import-meta.d.ts
vendored
Normal file
|
@ -0,0 +1,37 @@
|
|||
// File vendored from Vite itself, as a workaround to https://github.com/vitejs/vite/pull/9827 until Vite 4 comes out
|
||||
|
||||
// This file is an augmentation to the built-in ImportMeta interface
|
||||
// Thus cannot contain any top-level imports
|
||||
// <https://www.typescriptlang.org/docs/handbook/declaration-merging.html#module-augmentation>
|
||||
|
||||
/* eslint-disable @typescript-eslint/consistent-type-imports */
|
||||
|
||||
// Duplicate of import('../src/node/importGlob').GlobOptions in order to
|
||||
// avoid breaking the production client type. Because this file is referenced
|
||||
// in vite/client.d.ts and in production src/node/importGlob.ts doesn't exist.
|
||||
interface GlobOptions {
|
||||
as?: string;
|
||||
}
|
||||
|
||||
interface ImportMeta {
|
||||
url: string;
|
||||
|
||||
readonly hot?: import('vite/types/hot').ViteHotContext;
|
||||
|
||||
readonly env: ImportMetaEnv;
|
||||
|
||||
glob: import('vite/types/importGlob').ImportGlobFunction;
|
||||
/**
|
||||
* @deprecated Use `import.meta.glob('*', { eager: true })` instead
|
||||
*/
|
||||
globEager: import('vite/types/importGlob').ImportGlobEagerFunction;
|
||||
}
|
||||
|
||||
interface ImportMetaEnv {
|
||||
[key: string]: any;
|
||||
BASE_URL: string;
|
||||
MODE: string;
|
||||
DEV: boolean;
|
||||
PROD: boolean;
|
||||
SSR: boolean;
|
||||
}
|
Loading…
Reference in a new issue