import type { OptionalPreprocessor, OptionalPreprocessorSync, Preprocessor, PreprocessorSync } from "@css-blocks/core"; import type { EyeglassOptions, default as Eyeglass } from "eyeglass"; import type SassImplementation from "node-sass"; export declare type Adaptor = (sass: typeof SassImplementation, eyeglass: typeof Eyeglass, options: EyeglassOptions) => Preprocessor; export declare type AdaptorSync = (sass: typeof SassImplementation, eyeglass: typeof Eyeglass, options: EyeglassOptions) => PreprocessorSync; export declare type OptionalAdaptor = (sass: typeof SassImplementation, eyeglass: typeof Eyeglass, options: EyeglassOptions) => OptionalPreprocessor; export declare type OptionalAdaptorSync = (sass: typeof SassImplementation, eyeglass: typeof Eyeglass, options: EyeglassOptions) => OptionalPreprocessorSync; /** * Given a Sass compiler (either dart-sass or node-sass), an Eyeglass * constructor, and common eyeglass/sass options. This function returns a * preprocessor, which is a function that can be used preprocess a single file. * * This function ensures that Sass is properly configured using the common * options for each file and that source map information is passed along to CSS * Blocks for correct error reporting. */ export declare const adaptor: Adaptor; /** * Given a Sass compiler (either dart-sass or node-sass), an Eyeglass * constructor, and common eyeglass/sass options. This function returns a * sync preprocessor, which is a function that can be used preprocess a single file. * * This function ensures that Sass is properly configured using the common * options for each file and that source map information is passed along to CSS * Blocks for correct error reporting. */ export declare const adaptorSync: AdaptorSync; /** * This is the core interface that adaptAll depends on to use an object (as * opposed to an OptionalAdaptor function) to create a preprocessor. */ export interface PreprocessorProvider { init(sass: typeof SassImplementation, eyeglass: typeof Eyeglass, options: EyeglassOptions): void; preprocessor(): Preprocessor | OptionalPreprocessor; preprocessorSync(): PreprocessorSync | OptionalPreprocessorSync; } /** * Provides a preprocessor that only runs on files within a specific directory * (or subdirectories of that directory, recursively). */ export declare class DirectoryScopedPreprocessor implements PreprocessorProvider { protected filePrefix: string; protected scssProcessor: Preprocessor | undefined; protected scssProcessorSync: PreprocessorSync | undefined; /** * Instantiates the preprocessor provider. * * In the case where a preprocessor provider is being provided by a an npm * package that is being consumed by an application, this instantiation * would be performed by the npm package. * * @param packageDirectory The absolute path to the directory that scopes * this preprocessor. */ constructor(packageDirectory: string); /** * Initializes the sass preprocessor that is used to only compile the files * that are in scope. These parameters are provided by the application, * usually via adaptAll(). * * If you need to enforce a version constraint on the Sass or Eyeglass * implementation being used, you can override this and check sass.info and * eyeglass.VERSION. */ init(sass: typeof SassImplementation, eyeglass: typeof Eyeglass, options?: EyeglassOptions): void; /** * Subclasses can override this to manipulate/override the eyeglass options * provided from the application that will be used for compiling this * package's block files. * * Note: If this is being used from a library that is an eyeglass module, * The module will be auto-discovered by eyeglass, you don't need to do * anything here. */ setupOptions(options: EyeglassOptions): EyeglassOptions; /** * Subclasses can override this to manipulate/override the eyeglass options * provided from the application that will be used for compiling this * package's block files synchronously. * * The options passed into this function are a copy of those returned by * setupOptions(), so this method only needs to update those options as * appropriate to support synchronous compilation. * * If not provided, the options returned from setupOptions() are used for * synchronous compilation. */ setupOptionsSync?(options: EyeglassOptions): EyeglassOptions; /** * Subclasses can override this to decide whether a file should be processed. * By default it just checks that the file is within the directory for this * Preprocessor provider. */ shouldProcessFile(file: string): boolean; /** * Subclasses shouldn't need to override this. * @returns the preprocessor expected by adaptAll. */ preprocessor(): OptionalPreprocessor; /** * Subclasses shouldn't need to override this. * @returns the preprocessor expected by adaptAll. */ preprocessorSync(): OptionalPreprocessorSync; } /** * Creates a unified preprocessor for an application to use when consuming * css blocks that have Sass preprocessed. * * The application provides a list of preprocessor adaptors, as well as the * desired versions of sass, eyeglass and common Sass/Eyeglass options for * compiling the sass files with eyeglass support. */ export declare function adaptAll(adaptors: Array, sass: typeof SassImplementation, eyeglass: typeof Eyeglass, options: EyeglassOptions): Preprocessor; /** * Creates a unified preprocessor for an application to use when consuming * css blocks that have Sass preprocessed. * * The application provides a list of preprocessor adaptors, as well as the * desired versions of sass, eyeglass and common Sass/Eyeglass options for * compiling the sass files with eyeglass support. */ export declare function adaptAllSync(adaptors: Array, sass: typeof SassImplementation, eyeglass: typeof Eyeglass, options: EyeglassOptions): PreprocessorSync; //# sourceMappingURL=index.d.ts.map