import type { IScopedLogger } from '@rushstack/heft'; /** * @public */ export interface ICssOutputFolder { folder: string; shimModuleFormat?: 'commonjs' | 'esnext'; } /** * @public */ export interface ISassProcessorOptions { /** * The logger for this processor. */ logger: IScopedLogger; /** * The project root folder. */ buildFolder: string; /** * How many SASS compiler processes to run in parallel. */ concurrency: number; /** * Source code root directory. * Defaults to "src/". */ srcFolder: string; /** * Output directory for generated Sass typings. * Defaults to "temp/sass-ts/". */ dtsOutputFolders: string[]; /** * Output kinds for generated JS stubs and CSS files. */ cssOutputFolders?: ICssOutputFolder[]; /** * Determines whether export values are wrapped in a default property, or not. */ exportAsDefault: boolean; /** * Files with these extensions will pass through the Sass transpiler for typings generation. * They will be treated as SCSS modules. * Defaults to [".sass", ".scss", ".css"] */ fileExtensions?: string[]; /** * Files with these extensions will pass through the Sass transpiler for typings generation. * They will be treated as non-module SCSS. * Defaults to [".global.sass", ".global.scss", ".global.css"] */ nonModuleFileExtensions?: string[]; /** * A list of file paths relative to the "src" folder that should be excluded from typings generation. */ excludeFiles?: string[]; /** * If set, deprecation warnings from dependencies will be suppressed. */ ignoreDeprecationsInDependencies?: boolean; /** * A list of deprecation codes to silence. This is useful for suppressing warnings from deprecated Sass features that are used in the project and known not to be a problem. */ silenceDeprecations?: readonly string[]; /** * If true, the original file extension will not be trimmed when generating the output CSS file. The generated CSS * file will retain its original extension. For example, "styles.scss" will generate "styles.scss.css" * instead of "styles.css". */ doNotTrimOriginalFileExtension?: boolean; /** * If true, the ICSS `:export` block will be preserved in the emitted CSS output. This is necessary * when the CSS is consumed by a webpack loader (e.g. css-loader's icssParser) that extracts `:export` * values at bundle time to generate JavaScript exports. * * Defaults to false. */ preserveIcssExports?: boolean; /** * A callback to further modify the raw CSS text after it has been generated. Only relevant if emitting CSS files. */ postProcessCssAsync?: (cssText: string) => Promise; } /** * @public */ export interface ISassTypingsGeneratorOptions { buildFolder: string; sassConfiguration: ISassProcessorOptions; } /** * Generates type files (.d.ts) for Sass/SCSS/CSS files and optionally produces CSS files and .scss.js redirector files. * * @public */ export declare class SassProcessor { readonly ignoredFileGlobs: string[] | undefined; readonly inputFileGlob: string; readonly sourceFolderPath: string; private readonly _fileInfo; private readonly _resolutions; private readonly _isFileModule; private readonly _options; private readonly _realpathSync; private readonly _scssOptions; private _configFilePath; constructor(options: ISassProcessorOptions); loadCacheAsync(tempFolderPath: string): Promise; compileFilesAsync(filepaths: Set): Promise; /** * Resolves a `heft:` URL to a physical file path. * @param url - The URL to canonicalize. Will only do the exact URL or the corresponding partial. * @param context - The context in which the canonicalization is being performed * @returns The canonical URL of the target file, or null if it does not resolve */ private _canonicalizeFileAsync; private _canonicalizeFileInnerAsync; /** * Resolves a `pkg:` URL to a physical file path. * @param url - The URL to canonicalize. The URL must be a deep import to a SCSS file in a separate package. * @param context - The context in which the canonicalization is being performed * @returns The canonical URL of the target file, or null if it does not resolve */ private _canonicalizePackageAsync; /** * Resolves a `pkg:` URL to a physical file path, without caching. * @param url - The URL to canonicalize. The URL must be a deep import to a SCSS file in a separate package. * @param context - The context in which the canonicalization is being performed * @returns The canonical URL of the target file, or null if it does not resolve */ private _canonicalizePackageInnerAsync; /** * Resolves a `heft:` URL to a physical file path. * @param url - The URL to canonicalize. The URL must be a deep import to a candidate SCSS file. * @param context - The context in which the canonicalization is being performed * @returns The canonical URL of the target file, or null if it does not resolve */ private _canonicalizeHeftUrlAsync; /** * Resolves a sass request to a physical path * @param url - The URL to canonicalize. The URL may be relative or absolute. * This API supports the `heft:` and `pkg:` protocols. * @param context - The context in which the canonicalization is being performed * @returns The canonical URL of the target file, or null if it does not resolve */ private _canonicalizeAsync; /** * Resolves a `heft:` URL to a physical file path, without caching. * @param url - The URL to canonicalize. The URL must be a deep import to a candidate SCSS file. * @param context - The context in which the canonicalization is being performed * @returns The canonical URL of the target file, or null if it does not resolve */ private _canonicalizeHeftInnerAsync; private get _cache(); /** * Configures the state of this processor using the specified cache file content. * @param cacheFileContent - The contents of the cache file */ private set _cache(value); /** * Reads the contents of a file and returns an object that can be used to access the text and hash of the file. * @param absolutePath - The absolute path to the file * @returns A promise for an object that can be used to access the text and hash of the file. */ private _readFileContentAsync; /** * Gets a record for a SCSS file, creating it if necessary. * @param filePath - The file path to get or create a record for * @returns The tracking record for the specified file */ private _getOrCreateRecord; private _compileFileAsync; } //# sourceMappingURL=SassProcessor.d.ts.map