generated from garronej/ts-ci
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
522 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,242 @@ | ||
/// <reference path="./types/importMeta.d.ts" /> | ||
|
||
// CSS modules | ||
type CSSModuleClasses = { readonly [key: string]: string }; | ||
|
||
declare module "*.module.css" { | ||
const classes: CSSModuleClasses; | ||
export default classes; | ||
} | ||
declare module "*.module.scss" { | ||
const classes: CSSModuleClasses; | ||
export default classes; | ||
} | ||
declare module "*.module.sass" { | ||
const classes: CSSModuleClasses; | ||
export default classes; | ||
} | ||
declare module "*.module.less" { | ||
const classes: CSSModuleClasses; | ||
export default classes; | ||
} | ||
declare module "*.module.styl" { | ||
const classes: CSSModuleClasses; | ||
export default classes; | ||
} | ||
declare module "*.module.stylus" { | ||
const classes: CSSModuleClasses; | ||
export default classes; | ||
} | ||
declare module "*.module.pcss" { | ||
const classes: CSSModuleClasses; | ||
export default classes; | ||
} | ||
declare module "*.module.sss" { | ||
const classes: CSSModuleClasses; | ||
export default classes; | ||
} | ||
|
||
// CSS | ||
declare module "*.css" {} | ||
declare module "*.scss" {} | ||
declare module "*.sass" {} | ||
declare module "*.less" {} | ||
declare module "*.styl" {} | ||
declare module "*.stylus" {} | ||
declare module "*.pcss" {} | ||
declare module "*.sss" {} | ||
|
||
// Built-in asset types | ||
// see `src/node/constants.ts` | ||
|
||
// images | ||
declare module "*.apng" { | ||
const src: string; | ||
export default src; | ||
} | ||
declare module "*.png" { | ||
const src: string; | ||
export default src; | ||
} | ||
declare module "*.jpg" { | ||
const src: string; | ||
export default src; | ||
} | ||
declare module "*.jpeg" { | ||
const src: string; | ||
export default src; | ||
} | ||
declare module "*.jfif" { | ||
const src: string; | ||
export default src; | ||
} | ||
declare module "*.pjpeg" { | ||
const src: string; | ||
export default src; | ||
} | ||
declare module "*.pjp" { | ||
const src: string; | ||
export default src; | ||
} | ||
declare module "*.gif" { | ||
const src: string; | ||
export default src; | ||
} | ||
declare module "*.svg" { | ||
const src: string; | ||
export default src; | ||
} | ||
declare module "*.ico" { | ||
const src: string; | ||
export default src; | ||
} | ||
declare module "*.webp" { | ||
const src: string; | ||
export default src; | ||
} | ||
declare module "*.avif" { | ||
const src: string; | ||
export default src; | ||
} | ||
|
||
// media | ||
declare module "*.mp4" { | ||
const src: string; | ||
export default src; | ||
} | ||
declare module "*.webm" { | ||
const src: string; | ||
export default src; | ||
} | ||
declare module "*.ogg" { | ||
const src: string; | ||
export default src; | ||
} | ||
declare module "*.mp3" { | ||
const src: string; | ||
export default src; | ||
} | ||
declare module "*.wav" { | ||
const src: string; | ||
export default src; | ||
} | ||
declare module "*.flac" { | ||
const src: string; | ||
export default src; | ||
} | ||
declare module "*.aac" { | ||
const src: string; | ||
export default src; | ||
} | ||
declare module "*.opus" { | ||
const src: string; | ||
export default src; | ||
} | ||
declare module "*.mov" { | ||
const src: string; | ||
export default src; | ||
} | ||
declare module "*.m4a" { | ||
const src: string; | ||
export default src; | ||
} | ||
declare module "*.vtt" { | ||
const src: string; | ||
export default src; | ||
} | ||
|
||
// fonts | ||
declare module "*.woff" { | ||
const src: string; | ||
export default src; | ||
} | ||
declare module "*.woff2" { | ||
const src: string; | ||
export default src; | ||
} | ||
declare module "*.eot" { | ||
const src: string; | ||
export default src; | ||
} | ||
declare module "*.ttf" { | ||
const src: string; | ||
export default src; | ||
} | ||
declare module "*.otf" { | ||
const src: string; | ||
export default src; | ||
} | ||
|
||
// other | ||
declare module "*.webmanifest" { | ||
const src: string; | ||
export default src; | ||
} | ||
declare module "*.pdf" { | ||
const src: string; | ||
export default src; | ||
} | ||
declare module "*.txt" { | ||
const src: string; | ||
export default src; | ||
} | ||
|
||
// wasm?init | ||
declare module "*.wasm?init" { | ||
const initWasm: (options?: WebAssembly.Imports) => Promise<WebAssembly.Instance>; | ||
export default initWasm; | ||
} | ||
|
||
// web worker | ||
declare module "*?worker" { | ||
const workerConstructor: { | ||
new (options?: { name?: string }): Worker; | ||
}; | ||
export default workerConstructor; | ||
} | ||
|
||
declare module "*?worker&inline" { | ||
const workerConstructor: { | ||
new (options?: { name?: string }): Worker; | ||
}; | ||
export default workerConstructor; | ||
} | ||
|
||
declare module "*?worker&url" { | ||
const src: string; | ||
export default src; | ||
} | ||
|
||
declare module "*?sharedworker" { | ||
const sharedWorkerConstructor: { | ||
new (options?: { name?: string }): SharedWorker; | ||
}; | ||
export default sharedWorkerConstructor; | ||
} | ||
|
||
declare module "*?sharedworker&inline" { | ||
const sharedWorkerConstructor: { | ||
new (options?: { name?: string }): SharedWorker; | ||
}; | ||
export default sharedWorkerConstructor; | ||
} | ||
|
||
declare module "*?sharedworker&url" { | ||
const src: string; | ||
export default src; | ||
} | ||
|
||
declare module "*?raw" { | ||
const src: string; | ||
export default src; | ||
} | ||
|
||
declare module "*?url" { | ||
const src: string; | ||
export default src; | ||
} | ||
|
||
declare module "*?inline" { | ||
const src: string; | ||
export default src; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import type { ErrorPayload, FullReloadPayload, PrunePayload, UpdatePayload } from "./hmrPayload"; | ||
|
||
export interface CustomEventMap { | ||
"vite:beforeUpdate": UpdatePayload; | ||
"vite:afterUpdate": UpdatePayload; | ||
"vite:beforePrune": PrunePayload; | ||
"vite:beforeFullReload": FullReloadPayload; | ||
"vite:error": ErrorPayload; | ||
"vite:invalidate": InvalidatePayload; | ||
"vite:ws:connect": WebSocketConnectionPayload; | ||
"vite:ws:disconnect": WebSocketConnectionPayload; | ||
} | ||
|
||
export interface WebSocketConnectionPayload { | ||
/** | ||
* @experimental | ||
* We expose this instance experimentally to see potential usage. | ||
* This might be removed in the future if we didn't find reasonable use cases. | ||
* If you find this useful, please open an issue with details so we can discuss and make it stable API. | ||
*/ | ||
webSocket: WebSocket; | ||
} | ||
|
||
export interface InvalidatePayload { | ||
path: string; | ||
message: string | undefined; | ||
} | ||
|
||
export type InferCustomEventPayload<T extends string> = T extends keyof CustomEventMap | ||
? CustomEventMap[T] | ||
: any; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
export type HMRPayload = | ||
| ConnectedPayload | ||
| UpdatePayload | ||
| FullReloadPayload | ||
| CustomPayload | ||
| ErrorPayload | ||
| PrunePayload; | ||
|
||
export interface ConnectedPayload { | ||
type: "connected"; | ||
} | ||
|
||
export interface UpdatePayload { | ||
type: "update"; | ||
updates: Update[]; | ||
} | ||
|
||
export interface Update { | ||
type: "js-update" | "css-update"; | ||
path: string; | ||
acceptedPath: string; | ||
timestamp: number; | ||
/** @internal */ | ||
explicitImportRequired?: boolean; | ||
/** @internal */ | ||
isWithinCircularImport?: boolean; | ||
/** @internal */ | ||
ssrInvalidates?: string[]; | ||
} | ||
|
||
export interface PrunePayload { | ||
type: "prune"; | ||
paths: string[]; | ||
} | ||
|
||
export interface FullReloadPayload { | ||
type: "full-reload"; | ||
path?: string; | ||
} | ||
|
||
export interface CustomPayload { | ||
type: "custom"; | ||
event: string; | ||
data?: any; | ||
} | ||
|
||
export interface ErrorPayload { | ||
type: "error"; | ||
err: { | ||
[name: string]: any; | ||
message: string; | ||
stack: string; | ||
id?: string; | ||
frame?: string; | ||
plugin?: string; | ||
pluginCode?: string; | ||
loc?: { | ||
file?: string; | ||
line: number; | ||
column: number; | ||
}; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import type { InferCustomEventPayload } from "./customEvent"; | ||
|
||
export type ModuleNamespace = Record<string, any> & { | ||
[Symbol.toStringTag]: "Module"; | ||
}; | ||
|
||
export interface ViteHotContext { | ||
readonly data: any; | ||
|
||
accept(): void; | ||
accept(cb: (mod: ModuleNamespace | undefined) => void): void; | ||
accept(dep: string, cb: (mod: ModuleNamespace | undefined) => void): void; | ||
accept(deps: readonly string[], cb: (mods: Array<ModuleNamespace | undefined>) => void): void; | ||
|
||
acceptExports( | ||
exportNames: string | readonly string[], | ||
cb?: (mod: ModuleNamespace | undefined) => void | ||
): void; | ||
|
||
dispose(cb: (data: any) => void): void; | ||
prune(cb: (data: any) => void): void; | ||
invalidate(message?: string): void; | ||
|
||
on<T extends string>(event: T, cb: (payload: InferCustomEventPayload<T>) => void): void; | ||
off<T extends string>(event: T, cb: (payload: InferCustomEventPayload<T>) => void): void; | ||
send<T extends string>(event: T, data?: InferCustomEventPayload<T>): void; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
/// <reference path="./importMeta.d.ts" /> | ||
|
||
// https://github.com/microsoft/TypeScript/issues/45096 | ||
// TypeScript has a bug that makes <reference types="vite/types/importMeta" /> | ||
// not possible in userland. This file provides a workaround for now. |
Oops, something went wrong.