1d98d6c3e0c224da42d83eb9872ed309eb43af61f488c5472579be7df1496b3b9ccc49754a4d1d973edbfebdb43a8afb9b56394a2609bc638f10faa08be1cd 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700
  1. import {DeprecationOrId, Version} from '../deprecations';
  2. import {Logger} from '../logger';
  3. import {LegacyImporter} from './importer';
  4. import {LegacyFunction} from './function';
  5. import {NodePackageImporter} from '../importer';
  6. /**
  7. * Options for {@link render} and {@link renderSync} that are shared between
  8. * {@link LegacyFileOptions} and {@link LegacyStringOptions}.
  9. *
  10. * @typeParam sync - This lets the TypeScript checker verify that {@link
  11. * LegacyAsyncImporter}s and {@link LegacyAsyncFunction}s aren't passed to
  12. * {@link renderSync}.
  13. *
  14. * @category Legacy
  15. * @deprecated This only works with the legacy {@link render} and {@link
  16. * renderSync} APIs. Use {@link Options} with {@link compile}, {@link
  17. * compileString}, {@link compileAsync}, and {@link compileStringAsync} instead.
  18. */
  19. export interface LegacySharedOptions<sync extends 'sync' | 'async'> {
  20. /**
  21. * This array of strings option provides [load
  22. * paths](https://sass-lang.com/documentation/at-rules/import#load-paths) for
  23. * Sass to look for stylesheets. Earlier load paths will take precedence over
  24. * later ones.
  25. *
  26. * ```js
  27. * sass.renderSync({
  28. * file: "style.scss",
  29. * includePaths: ["node_modules/bootstrap/dist/css"]
  30. * });
  31. * ```
  32. *
  33. * Load paths are also loaded from the `SASS_PATH` environment variable, if
  34. * it’s set. This variable should be a list of paths separated by `;` (on
  35. * Windows) or `:` (on other operating systems). Load paths from the
  36. * `includePaths` option take precedence over load paths from `SASS_PATH`.
  37. *
  38. * ```sh
  39. * $ SASS_PATH=node_modules/bootstrap/dist/css sass style.scss style.css
  40. * ```
  41. *
  42. * @category Input
  43. * @compatibility feature: "SASS_PATH", dart: "1.15.0", node: "3.9.0"
  44. *
  45. * Earlier versions of Dart Sass and Node Sass didn’t support the `SASS_PATH`
  46. * environment variable.
  47. */
  48. includePaths?: string[];
  49. /**
  50. * Whether the generated CSS should use spaces or tabs for indentation.
  51. *
  52. * ```js
  53. * const result = sass.renderSync({
  54. * file: "style.scss",
  55. * indentType: "tab",
  56. * indentWidth: 1
  57. * });
  58. *
  59. * result.css.toString();
  60. * // "h1 {\n\tfont-size: 40px;\n}\n"
  61. * ```
  62. *
  63. * @defaultValue `'space'`
  64. * @category Output
  65. * @compatibility dart: true, node: "3.0.0"
  66. */
  67. indentType?: 'space' | 'tab';
  68. /**
  69. * How many spaces or tabs (depending on {@link indentType}) should be used
  70. * per indentation level in the generated CSS. It must be between 0 and 10
  71. * (inclusive).
  72. *
  73. * @defaultValue `2`
  74. * @category Output
  75. * @compatibility dart: true, node: "3.0.0"
  76. */
  77. indentWidth?: number;
  78. /**
  79. * Which character sequence to use at the end of each line in the generated
  80. * CSS. It can have the following values:
  81. *
  82. * * `'lf'` uses U+000A LINE FEED.
  83. * * `'lfcr'` uses U+000A LINE FEED followed by U+000D CARRIAGE RETURN.
  84. * * `'cr'` uses U+000D CARRIAGE RETURN.
  85. * * `'crlf'` uses U+000D CARRIAGE RETURN followed by U+000A LINE FEED.
  86. *
  87. * @defaultValue `'lf'`
  88. * @category Output
  89. * @compatibility dart: true, node: "3.0.0"
  90. */
  91. linefeed?: 'cr' | 'crlf' | 'lf' | 'lfcr';
  92. /**
  93. * If `true`, Sass won't add a link from the generated CSS to the source map.
  94. *
  95. * ```js
  96. * const result = sass.renderSync({
  97. * file: "style.scss",
  98. * sourceMap: "out.map",
  99. * omitSourceMapUrl: true
  100. * })
  101. * console.log(result.css.toString());
  102. * // h1 {
  103. * // font-size: 40px;
  104. * // }
  105. * ```
  106. *
  107. * @defaultValue `false`
  108. * @category Source Maps
  109. */
  110. omitSourceMapUrl?: boolean;
  111. /**
  112. * The location that Sass expects the generated CSS to be saved to. It’s used
  113. * to determine the URL used to link from the generated CSS to the source map,
  114. * and from the source map to the Sass source files.
  115. *
  116. * **Heads up!** Despite the name, Sass does *not* write the CSS output to
  117. * this file. The caller must do that themselves.
  118. *
  119. * ```js
  120. * result = sass.renderSync({
  121. * file: "style.scss",
  122. * sourceMap: true,
  123. * outFile: "out.css"
  124. * })
  125. * console.log(result.css.toString());
  126. * // h1 {
  127. * // font-size: 40px;
  128. * // }
  129. * // /*# sourceMappingURL=out.css.map * /
  130. * ```
  131. *
  132. * @category Source Maps
  133. */
  134. outFile?: string;
  135. /**
  136. * The output style of the compiled CSS. There are four possible output styles:
  137. *
  138. * * `"expanded"` (the default for Dart Sass) writes each selector and
  139. * declaration on its own line.
  140. *
  141. * * `"compressed"` removes as many extra characters as possible, and writes
  142. * the entire stylesheet on a single line.
  143. *
  144. * * `"nested"` (the default for Node Sass, not supported by Dart Sass)
  145. * indents CSS rules to match the nesting of the Sass source.
  146. *
  147. * * `"compact"` (not supported by Dart Sass) puts each CSS rule on its own single line.
  148. *
  149. * @example
  150. *
  151. * ```js
  152. * const source = `
  153. * h1 {
  154. * font-size: 40px;
  155. * code {
  156. * font-face: Roboto Mono;
  157. * }
  158. * }`;
  159. *
  160. * let result = sass.renderSync({
  161. * data: source,
  162. * outputStyle: "expanded"
  163. * });
  164. * console.log(result.css.toString());
  165. * // h1 {
  166. * // font-size: 40px;
  167. * // }
  168. * // h1 code {
  169. * // font-face: Roboto Mono;
  170. * // }
  171. *
  172. * result = sass.renderSync({
  173. * data: source,
  174. * outputStyle: "compressed"
  175. * });
  176. * console.log(result.css.toString());
  177. * // h1{font-size:40px}h1 code{font-face:Roboto Mono}
  178. *
  179. * result = sass.renderSync({
  180. * data: source,
  181. * outputStyle: "nested"
  182. * });
  183. * console.log(result.css.toString());
  184. * // h1 {
  185. * // font-size: 40px; }
  186. * // h1 code {
  187. * // font-face: Roboto Mono; }
  188. *
  189. * result = sass.renderSync({
  190. * data: source,
  191. * outputStyle: "compact"
  192. * });
  193. * console.log(result.css.toString());
  194. * // h1 { font-size: 40px; }
  195. * // h1 code { font-face: Roboto Mono; }
  196. * ```
  197. *
  198. * @category Output
  199. */
  200. outputStyle?: 'compressed' | 'expanded' | 'nested' | 'compact';
  201. /**
  202. * Whether or not Sass should generate a source map. If it does, the source
  203. * map will be available as {@link LegacyResult.map} (unless {@link
  204. * sourceMapEmbed} is `true`).
  205. *
  206. * If this option is a string, it’s the path that the source map is expected
  207. * to be written to, which is used to link to the source map from the
  208. * generated CSS and to link *from* the source map to the Sass source files.
  209. * Note that if `sourceMap` is a string and {@link outFile} isn’t passed, Sass
  210. * assumes that the CSS will be written to the same directory as the file
  211. * option if it’s passed.
  212. *
  213. * If this option is `true`, the path is assumed to be {@link outFile} with
  214. * `.map` added to the end. If it’s `true` and {@link outFile} isn’t passed,
  215. * it has no effect.
  216. *
  217. * @example
  218. *
  219. * ```js
  220. * let result = sass.renderSync({
  221. * file: "style.scss",
  222. * sourceMap: "out.map"
  223. * })
  224. * console.log(result.css.toString());
  225. * // h1 {
  226. * // font-size: 40px;
  227. * // }
  228. * // /*# sourceMappingURL=out.map * /
  229. *
  230. * result = sass.renderSync({
  231. * file: "style.scss",
  232. * sourceMap: true,
  233. * outFile: "out.css"
  234. * })
  235. * console.log(result.css.toString());
  236. * // h1 {
  237. * // font-size: 40px;
  238. * // }
  239. * // /*# sourceMappingURL=out.css.map * /
  240. * ```
  241. *
  242. * @defaultValue `false`
  243. * @category Source Maps
  244. */
  245. sourceMap?: boolean | string;
  246. /**
  247. * Whether to embed the entire contents of the Sass files that contributed to
  248. * the generated CSS in the source map. This may produce very large source
  249. * maps, but it guarantees that the source will be available on any computer
  250. * no matter how the CSS is served.
  251. *
  252. * @example
  253. *
  254. * ```js
  255. * sass.renderSync({
  256. * file: "style.scss",
  257. * sourceMap: "out.map",
  258. * sourceMapContents: true
  259. * })
  260. * ```
  261. *
  262. * @defaultValue `false`
  263. * @category Source Maps
  264. */
  265. sourceMapContents?: boolean;
  266. /**
  267. * Whether to embed the contents of the source map file in the generated CSS,
  268. * rather than creating a separate file and linking to it from the CSS.
  269. *
  270. * @example
  271. *
  272. * ```js
  273. * sass.renderSync({
  274. * file: "style.scss",
  275. * sourceMap: "out.map",
  276. * sourceMapEmbed: true
  277. * });
  278. * ```
  279. *
  280. * @defaultValue `false`
  281. * @category Source Maps
  282. */
  283. sourceMapEmbed?: boolean;
  284. /**
  285. * If this is passed, it's prepended to all the links from the source map to
  286. * the Sass source files.
  287. *
  288. * @category Source Maps
  289. */
  290. sourceMapRoot?: string;
  291. /**
  292. * Additional handler(s) for loading files when a [`@use`
  293. * rule](https://sass-lang.com/documentation/at-rules/use) or an [`@import`
  294. * rule](https://sass-lang.com/documentation/at-rules/import) is encountered.
  295. * It can either be a single {@link LegacyImporter} function, or an array of
  296. * {@link LegacyImporter}s.
  297. *
  298. * Importers take the URL of the `@import` or `@use` rule and return a {@link
  299. * LegacyImporterResult} indicating how to handle that rule. For more details,
  300. * see {@link LegacySyncImporter} and {@link LegacyAsyncImporter}.
  301. *
  302. * Loads are resolved by trying, in order:
  303. *
  304. * * Loading a file from disk relative to the file in which the `@use` or
  305. * `@import` appeared.
  306. *
  307. * * Each custom importer.
  308. *
  309. * * Loading a file relative to the current working directory.
  310. *
  311. * * Each load path in {@link includePaths}.
  312. *
  313. * * Each load path specified in the `SASS_PATH` environment variable, which
  314. * should be semicolon-separated on Windows and colon-separated elsewhere.
  315. *
  316. * @example
  317. *
  318. * ```js
  319. * sass.render({
  320. * file: "style.scss",
  321. * importer: [
  322. * // This importer uses the synchronous API, and can be passed to either
  323. * // renderSync() or render().
  324. * function(url, prev) {
  325. * // This generates a stylesheet from scratch for `@use "big-headers"`.
  326. * if (url != "big-headers") return null;
  327. *
  328. * return {
  329. * contents: `
  330. * h1 {
  331. * font-size: 40px;
  332. * }`
  333. * };
  334. * },
  335. *
  336. * // This importer uses the asynchronous API, and can only be passed to
  337. * // render().
  338. * function(url, prev, done) {
  339. * // Convert `@use "foo/bar"` to "node_modules/foo/sass/bar".
  340. * const components = url.split('/');
  341. * const innerPath = components.slice(1).join('/');
  342. * done({
  343. * file: `node_modules/${components.first}/sass/${innerPath}`
  344. * });
  345. * }
  346. * ]
  347. * }, function(err, result) {
  348. * // ...
  349. * });
  350. * ```
  351. *
  352. * @category Plugins
  353. * @compatibility dart: true, node: "3.0.0"
  354. *
  355. * Versions of Node Sass before 3.0.0 don’t support arrays of importers, nor
  356. * do they support importers that return `Error` objects.
  357. *
  358. * Versions of Node Sass before 2.0.0 don’t support the `importer` option at
  359. * all.
  360. *
  361. * @compatibility feature: "Import order", dart: "1.20.2", node: false
  362. *
  363. * Versions of Dart Sass before 1.20.2 preferred resolving imports using
  364. * {@link includePaths} before resolving them using custom importers.
  365. *
  366. * All versions of Node Sass currently pass imports to importers before
  367. * loading them relative to the file in which the `@import` appears. This
  368. * behavior is considered incorrect and should not be relied on because it
  369. * violates the principle of *locality*, which says that it should be possible
  370. * to reason about a stylesheet without knowing everything about how the
  371. * entire system is set up. If a user tries to import a stylesheet relative to
  372. * another stylesheet, that import should *always* work. It shouldn’t be
  373. * possible for some configuration somewhere else to break it.
  374. */
  375. importer?: LegacyImporter<sync> | LegacyImporter<sync>[];
  376. /**
  377. * Additional built-in Sass functions that are available in all stylesheets.
  378. * This option takes an object whose keys are Sass function signatures and
  379. * whose values are {@link LegacyFunction}s. Each function should take the
  380. * same arguments as its signature.
  381. *
  382. * Functions are passed subclasses of {@link LegacyValue}, and must return the
  383. * same.
  384. *
  385. * **Heads up!** When writing custom functions, it’s important to ensure that
  386. * all the arguments are the types you expect. Otherwise, users’ stylesheets
  387. * could crash in hard-to-debug ways or, worse, compile to meaningless CSS.
  388. *
  389. * @example
  390. *
  391. * ```js
  392. * sass.render({
  393. * data: `
  394. * h1 {
  395. * font-size: pow(2, 5) * 1px;
  396. * }`,
  397. * functions: {
  398. * // This function uses the synchronous API, and can be passed to either
  399. * // renderSync() or render().
  400. * 'pow($base, $exponent)': function(base, exponent) {
  401. * if (!(base instanceof sass.types.Number)) {
  402. * throw "$base: Expected a number.";
  403. * } else if (base.getUnit()) {
  404. * throw "$base: Expected a unitless number.";
  405. * }
  406. *
  407. * if (!(exponent instanceof sass.types.Number)) {
  408. * throw "$exponent: Expected a number.";
  409. * } else if (exponent.getUnit()) {
  410. * throw "$exponent: Expected a unitless number.";
  411. * }
  412. *
  413. * return new sass.types.Number(
  414. * Math.pow(base.getValue(), exponent.getValue()));
  415. * },
  416. *
  417. * // This function uses the asynchronous API, and can only be passed to
  418. * // render().
  419. * 'sqrt($number)': function(number, done) {
  420. * if (!(number instanceof sass.types.Number)) {
  421. * throw "$number: Expected a number.";
  422. * } else if (number.getUnit()) {
  423. * throw "$number: Expected a unitless number.";
  424. * }
  425. *
  426. * done(new sass.types.Number(Math.sqrt(number.getValue())));
  427. * }
  428. * }
  429. * }, function(err, result) {
  430. * console.log(result.css.toString());
  431. * // h1 {
  432. * // font-size: 32px;
  433. * // }
  434. * });
  435. * ```
  436. *
  437. * @category Plugins
  438. */
  439. functions?: {[key: string]: LegacyFunction<sync>};
  440. /**
  441. * By default, if the CSS document contains non-ASCII characters, Sass adds a
  442. * `@charset` declaration (in expanded output mode) or a byte-order mark (in
  443. * compressed mode) to indicate its encoding to browsers or other consumers.
  444. * If `charset` is `false`, these annotations are omitted.
  445. *
  446. * @category Output
  447. * @compatibility dart: "1.39.0", node: false
  448. */
  449. charset?: boolean;
  450. /**
  451. * If this option is set to `true`, Sass won’t print warnings that are caused
  452. * by dependencies. A “dependency” is defined as any file that’s loaded
  453. * through {@link includePaths} or {@link importer}. Stylesheets that are
  454. * imported relative to the entrypoint are not considered dependencies.
  455. *
  456. * This is useful for silencing deprecation warnings that you can’t fix on
  457. * your own. However, please <em>also</em> notify your dependencies of the deprecations
  458. * so that they can get fixed as soon as possible!
  459. *
  460. * **Heads up!** If {@link render} or {@link renderSync} is called without
  461. * {@link LegacyFileOptions.file} or {@link LegacyStringOptions.file},
  462. * <em>all</em> stylesheets it loads will be considered dependencies. Since it
  463. * doesn’t have a path of its own, everything it loads is coming from a load
  464. * path rather than a relative import.
  465. *
  466. * @defaultValue `false`
  467. * @category Messages
  468. * @compatibility dart: "1.35.0", node: false
  469. */
  470. quietDeps?: boolean;
  471. /**
  472. * A set of deprecations to treat as fatal.
  473. *
  474. * If a deprecation warning of any provided type is encountered during
  475. * compilation, the compiler will error instead.
  476. *
  477. * If a `Version` is provided, then all deprecations that were active in that
  478. * compiler version will be treated as fatal.
  479. *
  480. * @category Messages
  481. * @compatiblity dart: "1.78.0", node: false
  482. */
  483. fatalDeprecations?: (DeprecationOrId | Version)[];
  484. /**
  485. * A set of future deprecations to opt into early.
  486. *
  487. * Future deprecations passed here will be treated as active by the compiler,
  488. * emitting warnings as necessary.
  489. *
  490. * @category Messages
  491. * @compatiblity dart: "1.78.0", node: false
  492. */
  493. futureDeprecations?: DeprecationOrId[];
  494. /**
  495. * A set of active deprecations to ignore.
  496. *
  497. * If a deprecation warning of any provided type is encountered during
  498. * compilation, the compiler will ignore it instead.
  499. *
  500. * **Heads up!** The deprecated functionality you're depending on will
  501. * eventually break.
  502. *
  503. * @category Messages
  504. * @compatiblity dart: "1.78.0", node: false
  505. */
  506. silenceDeprecations?: DeprecationOrId[];
  507. /**
  508. * By default, Dart Sass will print only five instances of the same
  509. * deprecation warning per compilation to avoid deluging users in console
  510. * noise. If you set `verbose` to `true`, it will instead print every
  511. * deprecation warning it encounters.
  512. *
  513. * @defaultValue `false`
  514. * @category Messages
  515. * @compatibility dart: "1.35.0", node: false
  516. */
  517. verbose?: boolean;
  518. /**
  519. * An object to use to handle warnings and/or debug messages from Sass.
  520. *
  521. * By default, Sass emits warnings and debug messages to standard error, but
  522. * if {@link Logger.warn} or {@link Logger.debug} is set, this will invoke
  523. * them instead.
  524. *
  525. * The special value {@link Logger.silent} can be used to easily silence all
  526. * messages.
  527. *
  528. * @category Messages
  529. * @compatibility dart: "1.43.0", node: false
  530. */
  531. logger?: Logger;
  532. /**
  533. * If this option is set to an instance of `NodePackageImporter`, Sass will
  534. * use the built-in Node.js package importer to resolve Sass files with a
  535. * `pkg:` URL scheme. Details for library authors and users can be found in
  536. * the {@link NodePackageImporter} documentation.
  537. *
  538. * @example
  539. * ```js
  540. * sass.renderSync({
  541. * data: '@use "pkg:vuetify";',
  542. * pkgImporter: new sass.NodePackageImporter()
  543. * });
  544. * ```
  545. * @category Plugins
  546. * @compatibility dart: "2.0", node: false
  547. */
  548. pkgImporter?: NodePackageImporter;
  549. }
  550. /**
  551. * If {@link file} is passed without {@link data}, Sass will load the stylesheet
  552. * at {@link file} and compile it to CSS.
  553. *
  554. * @typeParam sync - This lets the TypeScript checker verify that {@link
  555. * LegacyAsyncImporter}s and {@link LegacyAsyncFunction}s aren't passed to
  556. * {@link renderSync}.
  557. */
  558. export interface LegacyFileOptions<sync extends 'sync' | 'async'>
  559. extends LegacySharedOptions<sync> {
  560. /**
  561. * The path to the file for Sass to load and compile. If the file’s extension
  562. * is `.scss`, it will be parsed as SCSS; if it’s `.sass`, it will be parsed
  563. * as the indented syntax; and if it’s `.css`, it will be parsed as plain CSS.
  564. * If it has no extension, it will be parsed as SCSS.
  565. *
  566. * @example
  567. *
  568. * ```js
  569. * sass.renderSync({file: "style.scss"});
  570. * ```
  571. *
  572. * @category Input
  573. * @compatibility feature: "Plain CSS files", dart: "1.11.0", node: "partial"
  574. *
  575. * Node Sass and older versions of Dart Sass support loading files with the
  576. * extension `.css`, but contrary to the specification they’re treated as SCSS
  577. * files rather than being parsed as CSS. This behavior has been deprecated
  578. * and should not be relied on. Any files that use Sass features should use
  579. * the `.scss` extension.
  580. *
  581. * All versions of Node Sass and Dart Sass otherwise support the file option
  582. * as described below.
  583. */
  584. file: string;
  585. /**
  586. * See {@link LegacyStringOptions.file} for documentation of passing {@link
  587. * file} along with {@link data}.
  588. *
  589. * @category Input
  590. */
  591. data?: never;
  592. }
  593. /**
  594. * If {@link data} is passed, Sass will use it as the contents of the stylesheet
  595. * to compile.
  596. *
  597. * @typeParam sync - This lets the TypeScript checker verify that {@link
  598. * LegacyAsyncImporter}s and {@link LegacyAsyncFunction}s aren't passed to
  599. * {@link renderSync}.
  600. *
  601. * @category Legacy
  602. * @deprecated This only works with the legacy {@link render} and {@link
  603. * renderSync} APIs. Use {@link StringOptions} with {@link compile}, {@link
  604. * compileString}, {@link compileAsync}, and {@link compileStringAsync} instead.
  605. */
  606. export interface LegacyStringOptions<sync extends 'sync' | 'async'>
  607. extends LegacySharedOptions<sync> {
  608. /**
  609. * The contents of the stylesheet to compile. Unless {@link file} is passed as
  610. * well, the stylesheet’s URL is set to `"stdin"`.
  611. *
  612. * By default, this stylesheet is parsed as SCSS. This can be controlled using
  613. * {@link indentedSyntax}.
  614. *
  615. * @example
  616. *
  617. * ```js
  618. * sass.renderSync({
  619. * data: `
  620. * h1 {
  621. * font-size: 40px;
  622. * }`
  623. * });
  624. * ```
  625. *
  626. * @category Input
  627. */
  628. data: string;
  629. /**
  630. * If `file` and {@link data} are both passed, `file` is used as the path of
  631. * the stylesheet for error reporting, but {@link data} is used as the
  632. * contents of the stylesheet. In this case, `file`’s extension is not used to
  633. * determine the syntax of the stylesheet.
  634. *
  635. * @category Input
  636. */
  637. file?: string;
  638. /**
  639. * This flag controls whether {@link data} is parsed as the indented syntax or
  640. * not.
  641. *
  642. * @example
  643. *
  644. * ```js
  645. * sass.renderSync({
  646. * data: `
  647. * h1
  648. * font-size: 40px`,
  649. * indentedSyntax: true
  650. * });
  651. * ```
  652. *
  653. * @defaultValue `false`
  654. * @category Input
  655. */
  656. indentedSyntax?: boolean;
  657. }
  658. /**
  659. * Options for {@link render} and {@link renderSync}. This can either be {@link
  660. * LegacyFileOptions} to load a file from disk, or {@link LegacyStringOptions}
  661. * to compile a string of Sass code.
  662. *
  663. * See {@link LegacySharedOptions} for options that are shared across both file
  664. * and string inputs.
  665. *
  666. * @category Legacy
  667. * @deprecated This only works with the legacy {@link render} and {@link
  668. * renderSync} APIs. Use {@link Options} with {@link compile}, {@link
  669. * compileString}, {@link compileAsync}, and {@link compileStringAsync} instead.
  670. */
  671. export type LegacyOptions<sync extends 'sync' | 'async'> =
  672. | LegacyFileOptions<sync>
  673. | LegacyStringOptions<sync>;