sass 1.45.0-rc.1 → 1.45.0-rc.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1 +1 @@
1
- {"name":"sass","description":"A pure JavaScript implementation of Sass.","license":"MIT","bugs":"https://github.com/sass/dart-sass/issues","homepage":"https://github.com/sass/dart-sass","repository":{"type":"git","url":"https://github.com/sass/dart-sass"},"author":{"name":"Natalie Weizenbaum","email":"nweiz@google.com","url":"https://github.com/nex3"},"engines":{"node":">=8.9.0"},"dependencies":{"chokidar":">=3.0.0 <4.0.0","immutable":"^4.0.0"},"keywords":["style","scss","sass","preprocessor","css"],"version":"1.45.0-rc.1","bin":{"sass":"sass.js"},"main":"sass.default.dart.js","exports":{"default":"./sass.default.dart.js"}}
1
+ {"name":"sass","description":"A pure JavaScript implementation of Sass.","license":"MIT","bugs":"https://github.com/sass/dart-sass/issues","homepage":"https://github.com/sass/dart-sass","repository":{"type":"git","url":"https://github.com/sass/dart-sass"},"author":{"name":"Natalie Weizenbaum","email":"nweiz@google.com","url":"https://github.com/nex3"},"engines":{"node":">=8.9.0"},"dependencies":{"chokidar":">=3.0.0 <4.0.0","immutable":"^4.0.0","source-map-js":">=0.6.2 <2.0.0"},"keywords":["style","scss","sass","preprocessor","css"],"types":"types/index.d.ts","version":"1.45.0-rc.2","bin":{"sass":"sass.js"},"main":"sass.default.dart.js","exports":{"default":"./sass.default.dart.js"}}
package/sass.dart.js CHANGED
@@ -1867,7 +1867,7 @@ self.readline = _cli_pkg_requires.readline;
1867
1867
  J.set$sassFalse$x(self.exports, C.SassBoolean_false0);
1868
1868
  J.set$Exception$x(self.exports, $.$get$exceptionClass());
1869
1869
  J.set$Logger$x(self.exports, {silent: {warn: B.allowInteropNamed("sass.Logger.silent.warn", new B.main_closure0()), debug: B.allowInteropNamed("sass.Logger.silent.debug", new B.main_closure1())}});
1870
- J.set$info$x(self.exports, "dart-sass\t1.45.0-rc.1\t(Sass Compiler)\t[Dart]\ndart2js\t2.14.4\t(Dart Compiler)\t[Dart]");
1870
+ J.set$info$x(self.exports, "dart-sass\t1.45.0-rc.2\t(Sass Compiler)\t[Dart]\ndart2js\t2.14.4\t(Dart Compiler)\t[Dart]");
1871
1871
  V.updateSourceSpanPrototype();
1872
1872
  J.set$render$x(self.exports, B.allowInteropNamed("sass.render", Q.legacy__render$closure()));
1873
1873
  J.set$renderSync$x(self.exports, B.allowInteropNamed("sass.renderSync", Q.legacy__renderSync$closure()));
@@ -20418,7 +20418,7 @@ self.readline = _cli_pkg_requires.readline;
20418
20418
  switch ($async$goto) {
20419
20419
  case 0:
20420
20420
  // Function start
20421
- $async$returnValue = "1.45.0-rc.1 compiled with dart2js 2.14.4";
20421
+ $async$returnValue = "1.45.0-rc.2 compiled with dart2js 2.14.4";
20422
20422
  // goto return
20423
20423
  $async$goto = 1;
20424
20424
  break;
@@ -0,0 +1,153 @@
1
+ import {URL} from 'url';
2
+ import {RawSourceMap} from 'source-map-js';
3
+
4
+ import {Options, StringOptions} from './options';
5
+
6
+ /**
7
+ * The result of compiling Sass to CSS. Returned by [[compile]],
8
+ * [[compileAsync]], [[compileString]], and [[compileStringAsync]].
9
+ *
10
+ * @category Compile
11
+ */
12
+ export interface CompileResult {
13
+ /**
14
+ * The generated CSS.
15
+ *
16
+ * Note that this *never* includes a `sourceMapUrl` comment—it's up to the
17
+ * caller to determine where to save the source map and how to link to it from
18
+ * the stylesheet.
19
+ */
20
+ css: string;
21
+
22
+ /**
23
+ * The canonical URLs of all the stylesheets that were loaded during the
24
+ * Sass compilation. The order of these URLs is not guaranteed.
25
+ */
26
+ loadedUrls: URL[];
27
+
28
+ /**
29
+ * The object representation of the source map that maps locations in the
30
+ * generated CSS back to locations in the Sass source code.
31
+ *
32
+ * This typically uses absolute `file:` URLs to refer to Sass files, although
33
+ * this can be controlled by having a custom [[Importer]] return
34
+ * [[ImporterResult.sourceMapUrl]].
35
+ *
36
+ * This is set if and only if [[Options.sourceMap]] is `true`.
37
+ */
38
+ sourceMap?: RawSourceMap;
39
+ }
40
+
41
+ /**
42
+ * Synchronously compiles the Sass file at `path` to CSS. If it succeeds it
43
+ * returns a [[CompileResult]], and if it fails it throws an [[Exception]].
44
+ *
45
+ * This only allows synchronous [[Importer]]s and [[CustomFunction]]s.
46
+ *
47
+ * @example
48
+ *
49
+ * ```js
50
+ * const sass = require('sass');
51
+ *
52
+ * const result = sass.compile("style.scss");
53
+ * console.log(result.css);
54
+ * ```
55
+ *
56
+ * @category Compile
57
+ * @compatibility dart: "1.45.0", node: false
58
+ */
59
+ export function compile(path: string, options?: Options<'sync'>): CompileResult;
60
+
61
+ /**
62
+ * Asynchronously compiles the Sass file at `path` to CSS. Returns a promise
63
+ * that resolves with a [[CompileResult]] if it succeeds and rejects with an
64
+ * [[Exception]] if it fails.
65
+ *
66
+ * This only allows synchronous or asynchronous [[Importer]]s and
67
+ * [[CustomFunction]]s.
68
+ *
69
+ * **Heads up!** When using Dart Sass, **[[compile]] is almost twice as fast as
70
+ * [[compileAsync]]**, due to the overhead of making the entire evaluation
71
+ * process asynchronous.
72
+ *
73
+ * @example
74
+ *
75
+ * ```js
76
+ * const sass = require('sass');
77
+ *
78
+ * const result = await sass.compileAsync("style.scss");
79
+ * console.log(result.css);
80
+ * ```
81
+ *
82
+ * @category Compile
83
+ * @compatibility dart: "1.45.0", node: false
84
+ */
85
+ export function compileAsync(
86
+ path: string,
87
+ options?: Options<'async'>
88
+ ): Promise<CompileResult>;
89
+
90
+ /**
91
+ * Synchronously compiles a stylesheet whose contents is `source` to CSS. If it
92
+ * succeeds it returns a [[CompileResult]], and if it fails it throws an
93
+ * [[Exception]].
94
+ *
95
+ * This only allows synchronous [[Importer]]s and [[CustomFunction]]s.
96
+ *
97
+ * @example
98
+ *
99
+ * ```js
100
+ * const sass = require('sass');
101
+ *
102
+ * const result = sass.compileString(`
103
+ * h1 {
104
+ * font-size: 40px;
105
+ * code {
106
+ * font-face: Roboto Mono;
107
+ * }
108
+ * }`);
109
+ * console.log(result.css);
110
+ * ```
111
+ *
112
+ * @category Compile
113
+ * @compatibility dart: "1.45.0", node: false
114
+ */
115
+ export function compileString(
116
+ source: string,
117
+ options?: StringOptions<'sync'>
118
+ ): CompileResult;
119
+
120
+ /**
121
+ * Asynchronously compiles a stylesheet whose contents is `source` to CSS.
122
+ * Returns a promise that resolves with a [[CompileResult]] if it succeeds and
123
+ * rejects with an [[Exception]] if it fails.
124
+ *
125
+ * This only allows synchronous or asynchronous [[Importer]]s and
126
+ * [[CustomFunction]]s.
127
+ *
128
+ * **Heads up!** When using Dart Sass, **[[compile]] is almost twice as fast as
129
+ * [[compileAsync]]**, due to the overhead of making the entire evaluation
130
+ * process asynchronous.
131
+ *
132
+ * @example
133
+ *
134
+ * ```js
135
+ * const sass = require('sass');
136
+ *
137
+ * const result = await sass.compileStringAsync(`
138
+ * h1 {
139
+ * font-size: 40px;
140
+ * code {
141
+ * font-face: Roboto Mono;
142
+ * }
143
+ * }`);
144
+ * console.log(result.css);
145
+ * ```
146
+ *
147
+ * @category Compile
148
+ * @compatibility dart: "1.45.0", node: false
149
+ */
150
+ export function compileStringAsync(
151
+ source: string,
152
+ options?: StringOptions<'async'>
153
+ ): Promise<CompileResult>;
@@ -0,0 +1,41 @@
1
+ import {SourceSpan} from './logger';
2
+
3
+ /**
4
+ * An exception thrown because a Sass compilation failed.
5
+ *
6
+ * @category Other
7
+ */
8
+ export class Exception extends Error {
9
+ private constructor();
10
+
11
+ /**
12
+ * A human-friendly representation of the exception.
13
+ *
14
+ * Because many tools simply print `Error.message` directly, this includes not
15
+ * only the textual description of what went wrong (the [[sassMessage]]) but
16
+ * also an indication of where in the Sass stylesheet the error occurred (the
17
+ * [[span]]) and the Sass stack trace at the point of error (the
18
+ * [[sassStack]]).
19
+ */
20
+ message: string;
21
+
22
+ /**
23
+ * A textual description of what went wrong.
24
+ *
25
+ * Unlike [[message]], this does *not* include representations of [[span]] or
26
+ * [[sassStack]].
27
+ */
28
+ readonly sassMessage: string;
29
+
30
+ /**
31
+ * A human-friendly representation of the Sass stack trace at the point of
32
+ * error.
33
+ */
34
+ readonly sassStack: string;
35
+
36
+ /** The location the error occurred in the Sass file that triggered it. */
37
+ readonly span: SourceSpan;
38
+
39
+ /** Returns the same string as [[message]]. */
40
+ toString(): string;
41
+ }
@@ -0,0 +1,296 @@
1
+ import {URL} from 'url';
2
+
3
+ import {Syntax} from './options';
4
+ import {PromiseOr} from './util/promise_or';
5
+
6
+ /**
7
+ * A special type of importer that redirects all loads to existing files on
8
+ * disk. Although this is less powerful than a full [[Importer]], it
9
+ * automatically takes care of Sass features like resolving partials and file
10
+ * extensions and of loading the file from disk.
11
+ *
12
+ * Like all importers, this implements custom Sass loading logic for [`@use`
13
+ * rules](https://sass-lang.com/documentation/at-rules/use) and [`@import`
14
+ * rules](https://sass-lang.com/documentation/at-rules/import). It can be passed
15
+ * to [[Options.importers]] or [[StringOptionsWithImporter.importer]].
16
+ *
17
+ * @typeParam sync - A `FileImporter<'sync'>`'s [[findFileUrl]] must return
18
+ * synchronously, but in return it can be passed to [[compile]] and
19
+ * [[compileString]] in addition to [[compileAsync]] and [[compileStringAsync]].
20
+ *
21
+ * A `FileImporter<'async'>`'s [[findFileUrl]] may either return synchronously
22
+ * or asynchronously, but it can only be used with [[compileAsync]] and
23
+ * [[compileStringAsync]].
24
+ *
25
+ * @example
26
+ *
27
+ * ```js
28
+ * const {fileURLToPath} = require('url');
29
+ *
30
+ * sass.compile('style.scss', {
31
+ * importers: [{
32
+ * // An importer that redirects relative URLs starting with "~" to
33
+ * // `node_modules`.
34
+ * findFileUrl(url) {
35
+ * if (!url.startsWith('~')) return null;
36
+ * return new URL(url.substring(1), pathToFileURL('node_modules'));
37
+ * }
38
+ * }]
39
+ * });
40
+ * ```
41
+ *
42
+ * @category Importer
43
+ */
44
+ export interface FileImporter<
45
+ sync extends 'sync' | 'async' = 'sync' | 'async'
46
+ > {
47
+ /**
48
+ * A callback that's called to partially resolve a load (such as
49
+ * [`@use`](https://sass-lang.com/documentation/at-rules/use) or
50
+ * [`@import`](https://sass-lang.com/documentation/at-rules/import)) to a file
51
+ * on disk.
52
+ *
53
+ * Unlike an [[Importer]], the compiler will automatically handle relative
54
+ * loads for a [[FileImporter]]. See [[Options.importers]] for more details on
55
+ * the way loads are resolved.
56
+ *
57
+ * @param url - The loaded URL. Since this might be relative, it's represented
58
+ * as a string rather than a [[URL]] object.
59
+ *
60
+ * @param options.fromImport - Whether this is being invoked because of a Sass
61
+ * `@import` rule, as opposed to a `@use` or `@forward` rule.
62
+ *
63
+ * This should *only* be used for determining whether or not to load
64
+ * [import-only files](https://sass-lang.com/documentation/at-rules/import#import-only-files).
65
+ *
66
+ * @returns An absolute `file:` URL if this importer recognizes the `url`.
67
+ * This may be only partially resolved: the compiler will automatically look
68
+ * for [partials](https://sass-lang.com/documentation/at-rules/use#partials),
69
+ * [index files](https://sass-lang.com/documentation/at-rules/use#index-files),
70
+ * and file extensions based on the returned URL. An importer may also return
71
+ * a fully resolved URL if it so chooses.
72
+ *
73
+ * If this importer doesn't recognize the URL, it should return `null` instead
74
+ * to allow other importers or {@link Options.loadPaths | load paths} to
75
+ * handle it.
76
+ *
77
+ * This may also return a `Promise`, but if it does the importer may only be
78
+ * passed to [[compileAsync]] and [[compileStringAsync]], not [[compile]] or
79
+ * [[compileString]].
80
+ *
81
+ * @throws any - If this importer recognizes `url` but determines that it's
82
+ * invalid, it may throw an exception that will be wrapped by Sass. If the
83
+ * exception object has a `message` property, it will be used as the wrapped
84
+ * exception's message; otherwise, the exception object's `toString()` will be
85
+ * used. This means it's safe for importers to throw plain strings.
86
+ */
87
+ findFileUrl(
88
+ url: string,
89
+ options: {fromImport: boolean}
90
+ ): PromiseOr<URL | null, sync>;
91
+
92
+ /** @hidden */
93
+ canonicalize?: never;
94
+ }
95
+
96
+ /**
97
+ * An object that implements custom Sass loading logic for [`@use`
98
+ * rules](https://sass-lang.com/documentation/at-rules/use) and [`@import`
99
+ * rules](https://sass-lang.com/documentation/at-rules/import). It can be passed
100
+ * to [[Options.importers]] or [[StringOptionsWithImporter.importer]].
101
+ *
102
+ * Importers that simply redirect to files on disk are encouraged to use the
103
+ * [[FileImporter]] interface instead.
104
+ *
105
+ * See [[Options.importers]] for more details on the way loads are resolved.
106
+ *
107
+ * @typeParam sync - An `Importer<'sync'>`'s [[canonicalize]] and [[load]] must
108
+ * return synchronously, but in return it can be passed to [[compile]] and
109
+ * [[compileString]] in addition to [[compileAsync]] and [[compileStringAsync]].
110
+ *
111
+ * An `Importer<'async'>`'s [[canonicalize]] and [[load]] may either return
112
+ * synchronously or asynchronously, but it can only be used with
113
+ * [[compileAsync]] and [[compileStringAsync]].
114
+ *
115
+ * @example Resolving a Load
116
+ *
117
+ * This is the process of resolving a load using a custom importer:
118
+ *
119
+ * - The compiler encounters `@use "db:foo/bar/baz"`.
120
+ * - It calls [[canonicalize]] with `"db:foo/bar/baz"`.
121
+ * - [[canonicalize]] returns `new URL("db:foo/bar/baz/_index.scss")`.
122
+ * - If the compiler has already loaded a stylesheet with this canonical URL, it
123
+ * re-uses the existing module.
124
+ * - Otherwise, it calls [[load]] with `new URL("db:foo/bar/baz/_index.scss")`.
125
+ * - [[load]] returns an [[ImporterResult]] that the compiler uses as the
126
+ * contents of the module.
127
+ *
128
+ * @example Code Sample
129
+ *
130
+ * ```js
131
+ * sass.compile('style.scss', {
132
+ * // An importer for URLs like `bgcolor:orange` that generates a
133
+ * // stylesheet with the given background color.
134
+ * importers: [{
135
+ * canonicalize(url) {
136
+ * if (!url.startsWith('bgcolor:')) return null;
137
+ * return new URL(url);
138
+ * },
139
+ * load(canonicalUrl) {
140
+ * return {
141
+ * contents: `body {background-color: ${canonicalUrl.pathname}}`,
142
+ * syntax: 'scss'
143
+ * };
144
+ * }
145
+ * }]
146
+ * });
147
+ * ```
148
+ *
149
+ * @category Importer
150
+ */
151
+ export interface Importer<sync extends 'sync' | 'async' = 'sync' | 'async'> {
152
+ /**
153
+ * If `url` is recognized by this importer, returns its canonical format.
154
+ *
155
+ * If Sass has already loaded a stylesheet with the returned canonical URL, it
156
+ * re-uses the existing parse tree (and the loaded module for `@use`). This
157
+ * means that importers **must ensure** that the same canonical URL always
158
+ * refers to the same stylesheet, *even across different importers*. As such,
159
+ * importers are encouraged to use unique URL schemes to disambiguate between
160
+ * one another.
161
+ *
162
+ * As much as possible, custom importers should canonicalize URLs the same way
163
+ * as the built-in filesystem importer:
164
+ *
165
+ * - The importer should look for stylesheets by adding the prefix `_` to the
166
+ * URL's basename, and by adding the extensions `.sass` and `.scss` if the
167
+ * URL doesn't already have one of those extensions. For example, if the
168
+ * URL was `foo/bar/baz`, the importer would look for:
169
+ * - `foo/bar/baz.sass`
170
+ * - `foo/bar/baz.scss`
171
+ * - `foo/bar/_baz.sass`
172
+ * - `foo/bar/_baz.scss`
173
+ *
174
+ * If the URL was `foo/bar/baz.scss`, the importer would just look for:
175
+ * - `foo/bar/baz.scss`
176
+ * - `foo/bar/_baz.scss`
177
+ *
178
+ * If the importer finds a stylesheet at more than one of these URLs, it
179
+ * should throw an exception indicating that the URL is ambiguous. Note that
180
+ * if the extension is explicitly specified, a stylesheet with the opposite
181
+ * extension is allowed to exist.
182
+ *
183
+ * - If none of the possible paths is valid, the importer should perform the
184
+ * same resolution on the URL followed by `/index`. In the example above,
185
+ * it would look for:
186
+ * - `foo/bar/baz/index.sass`
187
+ * - `foo/bar/baz/index.scss`
188
+ * - `foo/bar/baz/_index.sass`
189
+ * - `foo/bar/baz/_index.scss`
190
+ *
191
+ * As above, if the importer finds a stylesheet at more than one of these
192
+ * URLs, it should throw an exception indicating that the import is
193
+ * ambiguous.
194
+ *
195
+ * If no stylesheets are found, the importer should return `null`.
196
+ *
197
+ * Calling [[canonicalize]] multiple times with the same URL must return the
198
+ * same result. Calling [[canonicalize]] with a URL returned by a previous
199
+ * call to [[canonicalize]] must return that URL.
200
+ *
201
+ * Relative loads in stylesheets loaded from an importer are handled by
202
+ * resolving the loaded URL relative to the canonical URL of the stylesheet
203
+ * that contains it, and passing that URL back to the importer's
204
+ * [[canonicalize]] method. For example, suppose the "Resolving a Load"
205
+ * example {@link Importer | above} returned a stylesheet that contained
206
+ * `@use "mixins"`:
207
+ *
208
+ * - The compiler resolves the URL `mixins` relative to the current
209
+ * stylesheet's canonical URL `db:foo/bar/baz/_index.scss` to get
210
+ * `db:foo/bar/baz/mixins`.
211
+ * - It calls [[canonicalize]] with `"db:foo/bar/baz/mixins"`.
212
+ * - [[canonicalize]] returns `new URL("db:foo/bar/baz/_mixins.scss")`.
213
+ *
214
+ * Because of this, [[canonicalize]] must return a meaningful result when
215
+ * called with a URL relative to one returned by an earlier call to
216
+ * [[canonicalize]].
217
+ *
218
+ * @param url - The loaded URL. Since this might be relative, it's represented
219
+ * as a string rather than a [[URL]] object.
220
+ *
221
+ * @param options.fromImport - Whether this is being invoked because of a Sass
222
+ * `@import` rule, as opposed to a `@use` or `@forward` rule.
223
+ *
224
+ * This should *only* be used for determining whether or not to load
225
+ * [import-only files](https://sass-lang.com/documentation/at-rules/import#import-only-files).
226
+ *
227
+ * @returns An absolute URL if this importer recognizes the `url`, or `null`
228
+ * if it doesn't. If this returns `null`, other importers or {@link
229
+ * Options.loadPaths | load paths} may handle the load.
230
+ *
231
+ * This may also return a `Promise`, but if it does the importer may only be
232
+ * passed to [[compileAsync]] and [[compileStringAsync]], not [[compile]] or
233
+ * [[compileString]].
234
+ *
235
+ * @throws any - If this importer recognizes `url` but determines that it's
236
+ * invalid, it may throw an exception that will be wrapped by Sass. If the
237
+ * exception object has a `message` property, it will be used as the wrapped
238
+ * exception's message; otherwise, the exception object's `toString()` will be
239
+ * used. This means it's safe for importers to throw plain strings.
240
+ */
241
+ canonicalize(
242
+ url: string,
243
+ options: {fromImport: boolean}
244
+ ): PromiseOr<URL | null, sync>;
245
+
246
+ /**
247
+ * Loads the Sass text for the given `canonicalUrl`, or returns `null` if this
248
+ * importer can't find the stylesheet it refers to.
249
+ *
250
+ * @param canonicalUrl - The canonical URL of the stylesheet to load. This is
251
+ * guaranteed to come from a call to [[canonicalize]], although not every call
252
+ * to [[canonicalize]] will result in a call to [[load]].
253
+ *
254
+ * @returns The contents of the stylesheet at `canonicalUrl` if it can be
255
+ * loaded, or `null` if it can't.
256
+ *
257
+ * This may also return a `Promise`, but if it does the importer may only be
258
+ * passed to [[compileAsync]] and [[compileStringAsync]], not [[compile]] or
259
+ * [[compileString]].
260
+ *
261
+ * @throws any - If this importer finds a stylesheet at `url` but it fails to
262
+ * load for some reason, or if `url` is uniquely associated with this importer
263
+ * but doesn't refer to a real stylesheet, the importer may throw an exception
264
+ * that will be wrapped by Sass. If the exception object has a `message`
265
+ * property, it will be used as the wrapped exception's message; otherwise,
266
+ * the exception object's `toString()` will be used. This means it's safe for
267
+ * importers to throw plain strings.
268
+ */
269
+ load(canonicalUrl: URL): PromiseOr<ImporterResult | null, sync>;
270
+
271
+ /** @hidden */
272
+ findFileUrl?: never;
273
+ }
274
+
275
+ /**
276
+ * The result of successfully loading a stylesheet with an [[Importer]].
277
+ *
278
+ * @category Importer
279
+ */
280
+ export interface ImporterResult {
281
+ /** The contents of the stylesheet. */
282
+ contents: string;
283
+
284
+ /** The syntax with which to parse [[contents]]. */
285
+ syntax: Syntax;
286
+
287
+ /**
288
+ * The URL to use to link to the loaded stylesheet's source code in source
289
+ * maps. A `file:` URL is ideal because it's accessible to both browsers and
290
+ * other build tools, but an `http:` URL is also acceptable.
291
+ *
292
+ * If this isn't set, it defaults to a `data:` URL that contains the contents
293
+ * of the loaded stylesheet.
294
+ */
295
+ sourceMapUrl?: URL;
296
+ }
@@ -0,0 +1,76 @@
1
+ // This is a mirror of the JS API definitions in `spec/js-api`, but with comments
2
+ // written to provide user-facing documentation rather than to specify behavior for
3
+ // implementations.
4
+
5
+ export {
6
+ CompileResult,
7
+ compile,
8
+ compileAsync,
9
+ compileString,
10
+ compileStringAsync,
11
+ } from './compile';
12
+ export {Exception} from './exception';
13
+ export {FileImporter, Importer, ImporterResult} from './importer';
14
+ export {Logger, SourceSpan, SourceLocation} from './logger';
15
+ export {
16
+ CustomFunction,
17
+ Options,
18
+ OutputStyle,
19
+ StringOptions,
20
+ StringOptionsWithImporter,
21
+ StringOptionsWithoutImporter,
22
+ Syntax,
23
+ } from './options';
24
+ export {PromiseOr} from './util/promise_or';
25
+ export {
26
+ ListSeparator,
27
+ SassArgumentList,
28
+ SassBoolean,
29
+ SassColor,
30
+ SassFunction,
31
+ SassList,
32
+ SassMap,
33
+ SassNumber,
34
+ SassString,
35
+ Value,
36
+ sassFalse,
37
+ sassNull,
38
+ sassTrue,
39
+ } from './value';
40
+
41
+ // Legacy APIs
42
+ export {LegacyException} from './legacy/exception';
43
+ export {
44
+ LegacyAsyncFunction,
45
+ LegacySyncFunction,
46
+ LegacyFunction,
47
+ LegacyValue,
48
+ types,
49
+ } from './legacy/function';
50
+ export {
51
+ LegacyAsyncImporter,
52
+ LegacyImporter,
53
+ LegacyImporterResult,
54
+ LegacyImporterThis,
55
+ LegacySyncImporter,
56
+ } from './legacy/importer';
57
+ export {
58
+ LegacySharedOptions,
59
+ LegacyFileOptions,
60
+ LegacyStringOptions,
61
+ LegacyOptions,
62
+ } from './legacy/options';
63
+ export {LegacyPluginThis} from './legacy/plugin_this';
64
+ export {LegacyResult, render, renderSync} from './legacy/render';
65
+
66
+ /**
67
+ * Information about the Sass implementation. This always begins with a unique
68
+ * identifier for the Sass implementation, followed by U+0009 TAB, followed by
69
+ * its npm package version. Some implementations include additional information
70
+ * as well, but not in any standardized format.
71
+ *
72
+ * * For Dart Sass, the implementation name is `dart-sass`.
73
+ * * For Node Sass, the implementation name is `node-sass`.
74
+ * * For the embedded host, the implementation name is `sass-embedded`.
75
+ */
76
+ export const info: string;
@@ -0,0 +1,54 @@
1
+ /**
2
+ * The exception type thrown by [[renderSync]] and passed as the error to
3
+ * [[render]]'s callback.
4
+ *
5
+ * @category Legacy
6
+ * @deprecated This is only thrown by the legacy [[render]] and [[renderSync]]
7
+ * APIs. Use [[compile]], [[compileString]], [[compileAsync]], and
8
+ * [[compileStringAsync]] instead.
9
+ */
10
+ export interface LegacyException extends Error {
11
+ /**
12
+ * The error message. For Dart Sass, when possible this includes a highlighted
13
+ * indication of where in the source file the error occurred as well as the
14
+ * Sass stack trace.
15
+ */
16
+ message: string;
17
+
18
+ /**
19
+ * The error message. For Dart Sass, this is the same as the result of calling
20
+ * [[toString]], which is itself the same as [[message]] but with the prefix
21
+ * "Error:".
22
+ */
23
+ formatted: string;
24
+
25
+ /**
26
+ * The (1-based) line number on which the error occurred, if this exception is
27
+ * associated with a specific Sass file location.
28
+ */
29
+ line?: number;
30
+
31
+ /**
32
+ * The (1-based) column number within [[line]] at which the error occurred, if
33
+ * this exception is associated with a specific Sass file location.
34
+ */
35
+ column?: number;
36
+
37
+ /**
38
+ * Analogous to the exit code for an executable. `1` for an error caused by a
39
+ * Sass file, `3` for any other type of error.
40
+ */
41
+ status: number;
42
+
43
+ /**
44
+ * If this exception was caused by an error in a Sass file, this will
45
+ * represent the Sass file's location. It can be in one of three formats:
46
+ *
47
+ * * If the Sass file was loaded from disk, this is the path to that file.
48
+ * * If the Sass file was generated by an importer, this is its canonical URL.
49
+ * * If the Sass file was passed as [[LegacyStringOptions.data]] without a
50
+ * corresponding [[LegacyStringOptions.file]], this is the special string
51
+ * `"stdin"`.
52
+ */
53
+ file?: string;
54
+ }