UNPKG

@storm-stack/core

Version:

A build toolkit and runtime used by Storm Software in TypeScript applications

96 lines (93 loc) 3.33 kB
import MagicString from 'magic-string'; import { cx as Context, aw as CompilerInterface, aC as LogFn, av as CompilerOptions, au as TranspilerOptions, at as SourceFile, as as CompilerResult } from '../build-B-FJ5_Zf.cjs'; import '@storm-software/config-tools/types'; import '@stryke/types/base'; import '@stryke/types/configuration'; import 'esbuild'; import 'hookable'; import 'vite'; import '@babel/core'; import '@rspack/core'; import '@storm-software/build-tools/types'; import '@storm-software/config/types'; import '@storm-software/esbuild/types'; import '@storm-software/unbuild/types'; import 'c12'; import 'rolldown'; import 'rollup'; import 'unplugin'; import 'webpack'; import '@babel/types'; import '@storm-stack/core/deepkit/type'; import '@stryke/env/get-env-paths'; import '@stryke/types/package-json'; import 'jest-worker'; import 'jiti'; import 'memfs'; import 'unimport'; import '@stryke/capnp'; import 'semver'; import '../types/tsconfig.cjs'; import '@stryke/types/tsconfig'; import 'typescript'; import '../types/vfs.cjs'; import 'node:fs'; import 'unionfs'; declare class Compiler<TContext extends Context = Context> implements CompilerInterface<TContext> { #private; /** * The logger function to use */ protected log: LogFn; /** * The cache directory */ protected cacheDir: string; /** * Create a new compiler instance. * * @param context - The compiler context. * @param options - The compiler options. */ constructor(context: TContext, options?: CompilerOptions<TContext>); /** * Transform the module. * * @param context - The compiler context. * @param fileName - The name of the file to compile. * @param code - The source code to compile. * @param options - The transpile options. * @returns The transpiled module. */ transform(context: TContext, fileName: string, code: string | MagicString, options?: CompilerOptions): Promise<string>; /** * Transpile the module. * * @param context - The compiler context. * @param id - The name of the file to compile. * @param code - The source code to compile. * @returns The transpiled module. */ transpile(context: TContext, id: string, code: string | MagicString, options?: TranspilerOptions): Promise<string>; /** * Compile the source code. * * @param context - The compiler context. * @param id - The name of the file to compile. * @param code - The source code to compile. * @returns The compiled source code and source map. */ compile(context: TContext, id: string, code: string | MagicString, options?: CompilerOptions): Promise<string>; /** * Get the result of the compiler. * * @param sourceFile - The source file. * @param transpiled - The transpiled source code. * @returns The result of the compiler. */ getResult(sourceFile: SourceFile, transpiled?: string): CompilerResult; protected getCache(context: TContext, sourceFile: SourceFile): Promise<string | undefined>; protected setCache(context: TContext, sourceFile: SourceFile, transpiled?: string): Promise<void>; protected shouldSkip(context: TContext, id: string, code: string | MagicString): Promise<boolean>; } export { Compiler };