| 374 | |
| 375 | /** PackageSource - a common interface for loading and interacting with dependencies. */ |
| 376 | export interface PackageSource { |
| 377 | /** |
| 378 | * Do any work needed before starting the dev server or build. Either will wait |
| 379 | * for this to complete before continuing. Example: For "local", this involves |
| 380 | * running esinstall (if needed) to prepare your local dependencies as ESM. |
| 381 | */ |
| 382 | prepare(): Promise<void>; |
| 383 | /** |
| 384 | * Like prepare(), but only looks at a single file and meant to run at anytime, |
| 385 | * usually after the server has already started and is running. |
| 386 | */ |
| 387 | prepareSingleFile(fileLoc: string): Promise<void>; |
| 388 | /** |
| 389 | * Load a dependency with the given spec (ex: "/pkg/react" -> "react") |
| 390 | * If load fails or is unsuccessful, reject the promise. |
| 391 | */ |
| 392 | load( |
| 393 | spec: string, |
| 394 | options: {isSSR: boolean}, |
| 395 | ): Promise<undefined | {contents: Buffer | string; imports: InstallTarget[]}>; |
| 396 | /** Resolve a package import to URL (ex: "react" -> "/pkg/react") */ |
| 397 | resolvePackageImport( |
| 398 | spec: string, |
| 399 | options?: {source?: string; importMap?: ImportMap; depth?: number}, |
| 400 | ): Promise<string>; |
| 401 | /** Modify the build install config for optimized build install. */ |
| 402 | modifyBuildInstallOptions( |
| 403 | installOptions: EsinstallOptions, |
| 404 | installTargets: InstallTarget[], |
| 405 | ): Promise<EsinstallOptions>; |
| 406 | getCacheFolder(): string; |
| 407 | clearCache(): void | Promise<void>; |
| 408 | } |
| 409 | |
| 410 | export type ScannableExt = |
| 411 | | '.astro' |
no outgoing calls
no test coverage detected