UNPKG

@medusajs/framework

Version:
64 lines 2.58 kB
import type { AdminOptions, Logger } from "@medusajs/types"; import type tsStatic from "typescript"; /** * The compiler exposes the opinionated APIs for compiling Medusa * applications and plugins. You can perform the following * actions. * * - loadTSConfigFile: Load and parse the TypeScript config file. All errors * will be reported using the logger. * * - buildAppBackend: Compile the Medusa application backend source code to the * ".medusa/server" directory. The admin source and integration-tests are * skipped. * * - buildAppFrontend: Compile the admin extensions using the "@medusjs/admin-bundler" * package. Admin can be compiled for self hosting (aka adminOnly), or can be compiled * to be bundled with the backend output. */ export declare class Compiler { #private; constructor(projectRoot: string, logger: Logger); /** * Loads and parses the TypeScript config file. In case of an error, the errors * will be logged using the logger and undefined it returned */ loadTSConfigFile(): Promise<tsStatic.ParsedCommandLine | undefined>; /** * Builds the application backend source code using * TypeScript's official compiler. Also performs * type-checking */ buildAppBackend(tsConfig: tsStatic.ParsedCommandLine): Promise<boolean>; /** * Builds the frontend source code of a Medusa application * using the "@medusajs/admin-bundler" package. */ buildAppFrontend(adminOnly: boolean, tsConfig: tsStatic.ParsedCommandLine, adminBundler: { build: (options: AdminOptions & { sources: string[]; plugins: string[]; outDir: string; }) => Promise<void>; }): Promise<boolean>; /** * Compiles the plugin source code to JavaScript using the * TypeScript's official compiler */ buildPluginBackend(tsConfig: tsStatic.ParsedCommandLine): Promise<boolean>; /** * Compiles the backend source code of a plugin project in watch * mode. Type-checking is disabled to keep compilation fast. * * The "onFileChange" argument can be used to get notified when * a file has changed. */ developPluginBackend(transformer: (filePath: string) => Promise<string>, onFileChange?: (filePath: string, action: "add" | "change" | "unlink") => void): Promise<void>; buildPluginAdminExtensions(bundler: { plugin: (options: { root: string; outDir: string; }) => Promise<void>; }): Promise<boolean>; } //# sourceMappingURL=compiler.d.ts.map