input.d.ts 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. import CssSyntaxError from './css-syntax-error';
  2. import PreviousMap from './previous-map';
  3. import LazyResult from './lazy-result';
  4. import * as postcss from './postcss';
  5. import Result from './result';
  6. export default class Input implements postcss.Input {
  7. /**
  8. * The absolute path to the CSS source file defined with the "from" option.
  9. */
  10. file: string;
  11. /**
  12. * The unique ID of the CSS source. Used if "from" option is not provided
  13. * (because PostCSS does not know the file path).
  14. */
  15. id: string;
  16. /**
  17. * Represents the input source map passed from a compilation step before
  18. * PostCSS (e.g., from the Sass compiler).
  19. */
  20. map: PreviousMap;
  21. css: string;
  22. /**
  23. * Represents the source CSS.
  24. */
  25. constructor(css: string | {
  26. toString(): string;
  27. } | LazyResult | Result, opts?: {
  28. safe?: boolean | any;
  29. from?: string;
  30. });
  31. /**
  32. * The CSS source identifier. Contains input.file if the user set the "from"
  33. * option, or input.id if they did not.
  34. */
  35. from: string;
  36. error(message: string, line: number, column: number, opts?: {
  37. plugin?: string;
  38. }): CssSyntaxError;
  39. /**
  40. * Reads the input source map.
  41. * @returns A symbol position in the input source (e.g., in a Sass file
  42. * that was compiled to CSS before being passed to PostCSS):
  43. */
  44. origin(line: number, column: number): postcss.InputOrigin;
  45. private mapResolve(file);
  46. }