8889841csource_location.d.ts000066600000000742150537554030010544 0ustar00/** * A specific location within a source file. * * This is always associated with a [[SourceSpan]] which indicates *which* file * it refers to. * * @category Logger */ export interface SourceLocation { /** * The 0-based index of this location within its source file, in terms of * UTF-16 code units. */ offset: number; /** The 0-based line number of this location. */ line: number; /** The 0-based column number of this location. */ column: number; } source_span.d.ts000066600000001471150537554030007675 0ustar00import {SourceLocation} from './source_location'; /** * A span of text within a source file. * * @category Logger */ export interface SourceSpan { /** The beginning of this span, inclusive. */ start: SourceLocation; /** * The end of this span, exclusive. * * If [[start]] and [[end]] refer to the same location, the span has zero * length and refers to the point immediately after [[start]] and before the * next character. */ end: SourceLocation; /** The canonical URL of the file this span refers to. */ url?: URL; /** The text covered by the span. */ text: string; /** * Text surrounding the span. * * If this is set, it must include only whole lines, and it must include at * least all line(s) which are partially covered by this span. */ context?: string; } index.d.ts000066600000004571150537554030006467 0ustar00import {SourceSpan} from './source_span'; export {SourceLocation} from './source_location'; export {SourceSpan} from './source_span'; /** * An object that can be passed to [[LegacySharedOptions.logger]] to control how * Sass emits warnings and debug messages. * * @example * * ```js * const fs = require('fs'); * const sass = require('sass'); * * let log = ""; * sass.renderSync({ * file: 'input.scss', * logger: { * warn(message, options) { * if (options.span) { * log += `${span.url}:${span.start.line}:${span.start.column}: ` + * `${message}\n`; * } else { * log += `::: ${message}\n`; * } * } * } * }); * * fs.writeFileSync('log.txt', log); * ``` * * @category Logger */ export interface Logger { /** * This method is called when Sass emits a warning, whether due to a [`@warn` * rule](https://sass-lang.com/documentation/at-rules/warn) or a warning * generated by the Sass compiler. * * If this is `undefined`, Sass will print warnings to standard error. * * @param message - The warning message. * @param options.deprecation - Whether this is a deprecation warning. * @param options.span - The location in the Sass source code that generated this * warning. * @param options.stack - The Sass stack trace at the point the warning was issued. */ warn?( message: string, options: { deprecation: boolean; span?: SourceSpan; stack?: string; } ): void; /** * This method is called when Sass emits a debug message due to a [`@debug` * rule](https://sass-lang.com/documentation/at-rules/debug). * * If this is `undefined`, Sass will print debug messages to standard error. * * @param message - The debug message. * @param options.span - The location in the Sass source code that generated this * debug message. */ debug?(message: string, options: {span: SourceSpan}): void; } /** * A namespace for built-in [[Logger]]s. * * @category Logger * @compatibility dart: "1.43.0", node: false */ export namespace Logger { /** * A [[Logger]] that silently ignores all warnings and debug messages. * * @example * * ```js * const sass = require('sass'); * * const result = sass.renderSync({ * file: 'input.scss', * logger: sass.Logger.silent, * }); * ``` */ export const silent: Logger; }