sass 1.72.0 → 1.74.1

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/sass.default.js CHANGED
@@ -43,3 +43,5 @@ export const FALSE = _cliPkgExports.FALSE;
43
43
  export const NULL = _cliPkgExports.NULL;
44
44
  export const types = _cliPkgExports.types;
45
45
  export const NodePackageImporter = _cliPkgExports.NodePackageImporter;
46
+ export const deprecations = _cliPkgExports.deprecations;
47
+ export const Version = _cliPkgExports.Version;
package/sass.node.mjs CHANGED
@@ -37,6 +37,8 @@ export const FALSE = cjs.FALSE;
37
37
  export const NULL = cjs.NULL;
38
38
  export const types = cjs.types;
39
39
  export const NodePackageImporter = cjs.NodePackageImporter;
40
+ export const deprecations = cjs.deprecations;
41
+ export const Version = cjs.Version;
40
42
 
41
43
  let printedDefaultExportDeprecation = false;
42
44
  function defaultExportDeprecation() {
@@ -196,4 +198,12 @@ export default {
196
198
  defaultExportDeprecation();
197
199
  return cjs.NodePackageImporter;
198
200
  },
201
+ get deprecations() {
202
+ defaultExportDeprecation();
203
+ return cjs.deprecations;
204
+ },
205
+ get Version() {
206
+ defaultExportDeprecation();
207
+ return cjs.Version;
208
+ },
199
209
  };
@@ -0,0 +1,209 @@
1
+ /**
2
+ * All of the deprecation types currently used by Sass.
3
+ *
4
+ * Any of these IDs or the deprecation objects they point to can be passed to
5
+ * `fatalDeprecations`, `futureDeprecations`, or `silenceDeprecations`.
6
+ */
7
+ export interface Deprecations {
8
+ /**
9
+ * Deprecation for passing a string to `call` instead of using `get-function`.
10
+ *
11
+ * This deprecation has been active in all versions of Dart Sass.
12
+ */
13
+ 'call-string': Deprecation<'call-string'>;
14
+
15
+ /**
16
+ * Deprecation for `@elseif`.
17
+ *
18
+ * This deprecation became active in Dart Sass 1.3.2.
19
+ */
20
+ elseif: Deprecation<'elseif'>;
21
+
22
+ /**
23
+ * Deprecation for parsing `@-moz-document`.
24
+ *
25
+ * This deprecation became active in Dart Sass 1.7.2.
26
+ */
27
+ 'moz-document': Deprecation<'moz-document'>;
28
+
29
+ /**
30
+ * Deprecation for imports using relative canonical URLs.
31
+ *
32
+ * This deprecation became active in Dart Sass 1.17.2.
33
+ */
34
+ 'relative-canonical': Deprecation<'relative-canonical'>;
35
+
36
+ /**
37
+ * Deprecation for declaring new variables with `!global`.
38
+ *
39
+ * This deprecation became active in Dart Sass 1.17.2.
40
+ */
41
+ 'new-global': Deprecation<'new-global'>;
42
+
43
+ /**
44
+ * Deprecation for using color module functions in place of plain CSS
45
+ * functions.
46
+ *
47
+ * This deprecation became active in Dart Sass 1.23.0.
48
+ */
49
+ 'color-module-compat': Deprecation<'color-module-compat'>;
50
+
51
+ /**
52
+ * Deprecation for treating `/` as division.
53
+ *
54
+ * This deprecation became active in Dart Sass 1.33.0.
55
+ */
56
+ 'slash-div': Deprecation<'slash-div'>;
57
+
58
+ /**
59
+ * Deprecation for leading, trailing, and repeated combinators.
60
+ *
61
+ * This deprecation became active in Dart Sass 1.54.0.
62
+ */
63
+ 'bogus-combinators': Deprecation<'bogus-combinators'>;
64
+
65
+ /**
66
+ * Deprecation for ambiguous `+` and `-` operators.
67
+ *
68
+ * This deprecation became active in Dart Sass 1.55.0.
69
+ */
70
+ 'strict-unary': Deprecation<'strict-unary'>;
71
+
72
+ /**
73
+ * Deprecation for passing invalid units to certain built-in functions.
74
+ *
75
+ * This deprecation became active in Dart Sass 1.56.0.
76
+ */
77
+ 'function-units': Deprecation<'function-units'>;
78
+
79
+ /**
80
+ * Deprecation for using `!default` or `!global` multiple times for one
81
+ * variable.
82
+ *
83
+ * This deprecation became active in Dart Sass 1.62.0.
84
+ */
85
+ 'duplicate-var-flags': Deprecation<'duplicate-var-flags'>;
86
+
87
+ /**
88
+ * Deprecation for passing null as alpha in the JS API.
89
+ *
90
+ * This deprecation became active in Dart Sass 1.62.3.
91
+ */
92
+ 'null-alpha': Deprecation<'null-alpha'>;
93
+
94
+ /**
95
+ * Deprecation for passing percentages to the Sass `abs()` function.
96
+ *
97
+ * This deprecation became active in Dart Sass 1.65.0.
98
+ */
99
+ 'abs-percent': Deprecation<'abs-percent'>;
100
+
101
+ /**
102
+ * Deprecation for using the current working directory as an implicit load
103
+ * path.
104
+ *
105
+ * This deprecation became active in Dart Sass 1.73.0.
106
+ */
107
+ 'fs-importer-cwd': Deprecation<'fs-importer-cwd'>;
108
+
109
+ /**
110
+ * Deprecation for `@import` rules.
111
+ *
112
+ * This deprecation is not yet active, but will be soon.
113
+ */
114
+ import: Deprecation<'import'>;
115
+
116
+ /**
117
+ * Used for any user-emitted deprecation warnings.
118
+ */
119
+ 'user-authored': Deprecation<'user-authored', 'user'>;
120
+ }
121
+
122
+ /**
123
+ * Either a deprecation or its ID, either of which can be passed to any of
124
+ * the relevant compiler options.
125
+ *
126
+ * @category Messages
127
+ * @compatibility dart: "1.74.0", node: false
128
+ */
129
+ export type DeprecationOrId = Deprecation | keyof Deprecations;
130
+
131
+ /**
132
+ * The possible statuses that each deprecation can have.
133
+ *
134
+ * "active" deprecations are currently emitting deprecation warnings.
135
+ * "future" deprecations are not yet active, but will be in the future.
136
+ * "obsolete" deprecations were once active, but no longer are.
137
+ *
138
+ * The only "user" deprecation is "user-authored", which is used for deprecation
139
+ * warnings coming from user code.
140
+ *
141
+ * @category Messages
142
+ * @compatibility dart: "1.74.0", node: false
143
+ */
144
+ export type DeprecationStatus = 'active' | 'user' | 'future' | 'obsolete';
145
+
146
+ /**
147
+ * A deprecated feature in the language.
148
+ *
149
+ * @category Messages
150
+ * @compatibility dart: "1.74.0", node: false
151
+ */
152
+ export interface Deprecation<
153
+ id extends keyof Deprecations = keyof Deprecations,
154
+ status extends DeprecationStatus = DeprecationStatus
155
+ > {
156
+ /** The unique ID of this deprecation. */
157
+ id: id;
158
+
159
+ /** The current status of this deprecation. */
160
+ status: status;
161
+
162
+ /** A human-readable description of this deprecation. */
163
+ description?: string;
164
+
165
+ /** The version this deprecation first became active in. */
166
+ deprecatedIn: status extends 'future' | 'user' ? null : Version;
167
+
168
+ /** The version this deprecation became obsolete in. */
169
+ obsoleteIn: status extends 'obsolete' ? Version : null;
170
+ }
171
+
172
+ /**
173
+ * A semantic version of the compiler.
174
+ *
175
+ * @category Messages
176
+ * @compatibility dart: "1.74.0", node: false
177
+ */
178
+ export class Version {
179
+ /**
180
+ * Constructs a new version.
181
+ *
182
+ * All components must be non-negative integers.
183
+ *
184
+ * @param major - The major version.
185
+ * @param minor - The minor version.
186
+ * @param patch - The patch version.
187
+ */
188
+ constructor(major: number, minor: number, patch: number);
189
+ readonly major: number;
190
+ readonly minor: number;
191
+ readonly patch: number;
192
+
193
+ /**
194
+ * Parses a version from a string.
195
+ *
196
+ * This throws an error if a valid version can't be parsed.
197
+ *
198
+ * @param version - A string in the form "major.minor.patch".
199
+ */
200
+ static parse(version: string): Version;
201
+ }
202
+
203
+ /**
204
+ * An object containing all deprecation types.
205
+ *
206
+ * @category Messages
207
+ * @compatibility dart: "1.74.0", node: false
208
+ */
209
+ export const deprecations: Deprecations;
package/types/index.d.ts CHANGED
@@ -13,6 +13,14 @@ export {
13
13
  initCompiler,
14
14
  initAsyncCompiler,
15
15
  } from './compile';
16
+ export {
17
+ deprecations,
18
+ Deprecation,
19
+ Deprecations,
20
+ DeprecationOrId,
21
+ DeprecationStatus,
22
+ Version,
23
+ } from './deprecations';
16
24
  export {Exception} from './exception';
17
25
  export {
18
26
  CanonicalizeContext,
@@ -1,3 +1,4 @@
1
+ import {Deprecation} from '../deprecations';
1
2
  import {SourceSpan} from './source_span';
2
3
 
3
4
  export {SourceLocation} from './source_location';
@@ -43,17 +44,21 @@ export interface Logger {
43
44
  *
44
45
  * @param message - The warning message.
45
46
  * @param options.deprecation - Whether this is a deprecation warning.
47
+ * @param options.deprecationType - The type of deprecation this warning is
48
+ * for, if any.
46
49
  * @param options.span - The location in the Sass source code that generated this
47
50
  * warning.
48
51
  * @param options.stack - The Sass stack trace at the point the warning was issued.
49
52
  */
50
53
  warn?(
51
54
  message: string,
52
- options: {
53
- deprecation: boolean;
54
- span?: SourceSpan;
55
- stack?: string;
56
- }
55
+ options: (
56
+ | {
57
+ deprecation: true;
58
+ deprecationType: Deprecation;
59
+ }
60
+ | {deprecation: false}
61
+ ) & {span?: SourceSpan; stack?: string}
57
62
  ): void;
58
63
 
59
64
  /**
@@ -1,3 +1,4 @@
1
+ import {DeprecationOrId, Version} from './deprecations';
1
2
  import {FileImporter, Importer, NodePackageImporter} from './importer';
2
3
  import {Logger} from './logger';
3
4
  import {Value} from './value';
@@ -122,6 +123,20 @@ export interface Options<sync extends 'sync' | 'async'> {
122
123
  */
123
124
  charset?: boolean;
124
125
 
126
+ /**
127
+ * A set of deprecations to treat as fatal.
128
+ *
129
+ * If a deprecation warning of any provided type is encountered during
130
+ * compilation, the compiler will error instead.
131
+ *
132
+ * If a `Version` is provided, then all deprecations that were active in that
133
+ * compiler version will be treated as fatal.
134
+ *
135
+ * @category Messages
136
+ * @compatiblity dart: "1.74.0", node: false
137
+ */
138
+ fatalDeprecations?: (DeprecationOrId | Version)[];
139
+
125
140
  /**
126
141
  * Additional built-in Sass functions that are available in all stylesheets.
127
142
  * This option takes an object whose keys are Sass function signatures like
@@ -198,6 +213,17 @@ export interface Options<sync extends 'sync' | 'async'> {
198
213
  */
199
214
  functions?: Record<string, CustomFunction<sync>>;
200
215
 
216
+ /**
217
+ * A set of future deprecations to opt into early.
218
+ *
219
+ * Future deprecations passed here will be treated as active by the compiler,
220
+ * emitting warnings as necessary.
221
+ *
222
+ * @category Messages
223
+ * @compatiblity dart: "1.74.0", node: false
224
+ */
225
+ futureDeprecations?: DeprecationOrId[];
226
+
201
227
  /**
202
228
  * Custom importers that control how Sass resolves loads from rules like
203
229
  * [`@use`](https://sass-lang.com/documentation/at-rules/use) and
@@ -276,6 +302,20 @@ export interface Options<sync extends 'sync' | 'async'> {
276
302
  */
277
303
  quietDeps?: boolean;
278
304
 
305
+ /**
306
+ * A set of active deprecations to ignore.
307
+ *
308
+ * If a deprecation warning of any provided type is encountered during
309
+ * compilation, the compiler will ignore it instead.
310
+ *
311
+ * **Heads up!** The deprecated functionality you're depending on will
312
+ * eventually break.
313
+ *
314
+ * @category Messages
315
+ * @compatiblity dart: "1.74.0", node: false
316
+ */
317
+ silenceDeprecations?: DeprecationOrId[];
318
+
279
319
  /**
280
320
  * Whether or not Sass should generate a source map. If it does, the source
281
321
  * map will be available as {@link CompileResult.sourceMap}.