UNPKG

6.03 kBTypeScriptView Raw
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 */
7export interface Deprecations {
8 // START AUTOGENERATED LIST
9 // Checksum: 309e4f1f008f08379b824ab6094e13df2e18e187
10
11 /**
12 * Deprecation for passing a string directly to meta.call().
13 *
14 * This deprecation was active in the first version of Dart Sass.
15 */
16 'call-string': Deprecation<'call-string'>;
17
18 /**
19 * Deprecation for @elseif.
20 *
21 * This deprecation became active in Dart Sass 1.3.2.
22 */
23 elseif: Deprecation<'elseif'>;
24
25 /**
26 * Deprecation for @-moz-document.
27 *
28 * This deprecation became active in Dart Sass 1.7.2.
29 */
30 'moz-document': Deprecation<'moz-document'>;
31
32 /**
33 * Deprecation for imports using relative canonical URLs.
34 *
35 * This deprecation became active in Dart Sass 1.14.2.
36 */
37 'relative-canonical': Deprecation<'relative-canonical'>;
38
39 /**
40 * Deprecation for declaring new variables with !global.
41 *
42 * This deprecation became active in Dart Sass 1.17.2.
43 */
44 'new-global': Deprecation<'new-global'>;
45
46 /**
47 * Deprecation for using color module functions in place of plain CSS functions.
48 *
49 * This deprecation became active in Dart Sass 1.23.0.
50 */
51 'color-module-compat': Deprecation<'color-module-compat'>;
52
53 /**
54 * Deprecation for / operator for division.
55 *
56 * This deprecation became active in Dart Sass 1.33.0.
57 */
58 'slash-div': Deprecation<'slash-div'>;
59
60 /**
61 * Deprecation for leading, trailing, and repeated combinators.
62 *
63 * This deprecation became active in Dart Sass 1.54.0.
64 */
65 'bogus-combinators': Deprecation<'bogus-combinators'>;
66
67 /**
68 * Deprecation for ambiguous + and - operators.
69 *
70 * This deprecation became active in Dart Sass 1.55.0.
71 */
72 'strict-unary': Deprecation<'strict-unary'>;
73
74 /**
75 * Deprecation for passing invalid units to built-in functions.
76 *
77 * This deprecation became active in Dart Sass 1.56.0.
78 */
79 'function-units': Deprecation<'function-units'>;
80
81 /**
82 * Deprecation for using !default or !global multiple times for one variable.
83 *
84 * This deprecation became active in Dart Sass 1.62.0.
85 */
86 'duplicate-var-flags': Deprecation<'duplicate-var-flags'>;
87
88 /**
89 * Deprecation for passing null as alpha in the JS API.
90 *
91 * This deprecation became active in Dart Sass 1.62.3.
92 */
93 'null-alpha': Deprecation<'null-alpha'>;
94
95 /**
96 * Deprecation for passing percentages to the Sass abs() function.
97 *
98 * This deprecation became active in Dart Sass 1.65.0.
99 */
100 'abs-percent': Deprecation<'abs-percent'>;
101
102 /**
103 * Deprecation for using the current working directory as an implicit load 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 function and mixin names beginning with --.
111 *
112 * This deprecation became active in Dart Sass 1.76.0.
113 */
114 'css-function-mixin': Deprecation<'css-function-mixin'>;
115
116 /**
117 * Deprecation for declarations after or between nested rules.
118 *
119 * This deprecation became active in Dart Sass 1.77.7.
120 */
121 'mixed-decls': Deprecation<'mixed-decls'>;
122
123 /**
124 * Deprecation for @import rules.
125 *
126 * This deprecation is not yet active, but will be soon.
127 */
128 import: Deprecation<'import'>;
129
130 // END AUTOGENERATED LIST
131
132 /**
133 * Used for any user-emitted deprecation warnings.
134 */
135 'user-authored': Deprecation<'user-authored', 'user'>;
136}
137
138/**
139 * Either a deprecation or its ID, either of which can be passed to any of
140 * the relevant compiler options.
141 *
142 * @category Messages
143 * @compatibility dart: "1.74.0", node: false
144 */
145export type DeprecationOrId = Deprecation | keyof Deprecations;
146
147/**
148 * The possible statuses that each deprecation can have.
149 *
150 * "active" deprecations are currently emitting deprecation warnings.
151 * "future" deprecations are not yet active, but will be in the future.
152 * "obsolete" deprecations were once active, but no longer are.
153 *
154 * The only "user" deprecation is "user-authored", which is used for deprecation
155 * warnings coming from user code.
156 *
157 * @category Messages
158 * @compatibility dart: "1.74.0", node: false
159 */
160export type DeprecationStatus = 'active' | 'user' | 'future' | 'obsolete';
161
162/**
163 * A deprecated feature in the language.
164 *
165 * @category Messages
166 * @compatibility dart: "1.74.0", node: false
167 */
168export interface Deprecation<
169 id extends keyof Deprecations = keyof Deprecations,
170 status extends DeprecationStatus = DeprecationStatus
171> {
172 /** The unique ID of this deprecation. */
173 id: id;
174
175 /** The current status of this deprecation. */
176 status: status;
177
178 /** A human-readable description of this deprecation. */
179 description?: string;
180
181 /** The version this deprecation first became active in. */
182 deprecatedIn: status extends 'future' | 'user' ? null : Version;
183
184 /** The version this deprecation became obsolete in. */
185 obsoleteIn: status extends 'obsolete' ? Version : null;
186}
187
188/**
189 * A semantic version of the compiler.
190 *
191 * @category Messages
192 * @compatibility dart: "1.74.0", node: false
193 */
194export class Version {
195 /**
196 * Constructs a new version.
197 *
198 * All components must be non-negative integers.
199 *
200 * @param major - The major version.
201 * @param minor - The minor version.
202 * @param patch - The patch version.
203 */
204 constructor(major: number, minor: number, patch: number);
205 readonly major: number;
206 readonly minor: number;
207 readonly patch: number;
208
209 /**
210 * Parses a version from a string.
211 *
212 * This throws an error if a valid version can't be parsed.
213 *
214 * @param version - A string in the form "major.minor.patch".
215 */
216 static parse(version: string): Version;
217}
218
219/**
220 * An object containing all deprecation types.
221 *
222 * @category Messages
223 * @compatibility dart: "1.74.0", node: false
224 */
225export const deprecations: Deprecations;