2
2
// MIT-style license that can be found in the LICENSE file or at
3
3
// https://opensource.org/licenses/MIT.
4
4
5
- import * as api from './vendor/sass' ;
5
+ import { deprecations } from './vendor/deprecations' ;
6
+ import { Deprecation , DeprecationOrId } from './vendor/sass' ;
7
+ import { Version } from './version' ;
6
8
9
+ export { deprecations } from './vendor/deprecations' ;
7
10
export { Deprecation , DeprecationOrId , DeprecationStatus } from './vendor/sass' ;
8
11
9
- export class Version implements api . Version {
10
- constructor (
11
- readonly major : number ,
12
- readonly minor : number ,
13
- readonly patch : number
14
- ) { }
15
- static parse ( version : string ) : Version {
16
- const match = version . match ( / ^ ( \d + ) \. ( \d + ) \. ( \d + ) $ / ) ;
17
- if ( match === null ) {
18
- throw new Error ( `Invalid version ${ version } ` ) ;
19
- }
20
- return new Version (
21
- parseInt ( match [ 1 ] ) ,
22
- parseInt ( match [ 2 ] ) ,
23
- parseInt ( match [ 3 ] )
24
- ) ;
25
- }
26
- }
27
-
28
12
/**
29
13
* Returns whether the given deprecation was active in the given version.
30
14
*/
31
- function isActiveIn ( deprecation : api . Deprecation , version : Version ) {
15
+ function isActiveIn ( deprecation : Deprecation , version : Version ) {
32
16
const deprecatedIn = deprecation . deprecatedIn ;
33
17
if ( deprecation . status !== 'active' || ! deprecatedIn ) return false ;
34
18
if ( version . major > deprecatedIn . major ) return true ;
@@ -43,7 +27,7 @@ function isActiveIn(deprecation: api.Deprecation, version: Version) {
43
27
* that's ready to include in a CompileRequest.
44
28
*/
45
29
export function getDeprecationIds (
46
- arr : ( api . DeprecationOrId | Version ) [ ]
30
+ arr : ( DeprecationOrId | Version ) [ ]
47
31
) : string [ ] {
48
32
return arr . flatMap ( item => {
49
33
if ( item instanceof Version ) {
@@ -56,125 +40,3 @@ export function getDeprecationIds(
56
40
return item . id ;
57
41
} ) ;
58
42
}
59
-
60
- export const deprecations : typeof api . deprecations = {
61
- 'call-string' : {
62
- id : 'call-string' ,
63
- status : 'active' ,
64
- deprecatedIn : new Version ( 0 , 0 , 0 ) ,
65
- obsoleteIn : null ,
66
- description : 'Passing a string directly to meta.call().' ,
67
- } ,
68
- elseif : {
69
- id : 'elseif' ,
70
- status : 'active' ,
71
- deprecatedIn : new Version ( 1 , 3 , 2 ) ,
72
- obsoleteIn : null ,
73
- description : '@elseif.' ,
74
- } ,
75
- 'moz-document' : {
76
- id : 'moz-document' ,
77
- status : 'active' ,
78
- deprecatedIn : new Version ( 1 , 7 , 2 ) ,
79
- obsoleteIn : null ,
80
- description : '@-moz-document.' ,
81
- } ,
82
- 'relative-canonical' : {
83
- id : 'relative-canonical' ,
84
- status : 'active' ,
85
- deprecatedIn : new Version ( 1 , 14 , 2 ) ,
86
- obsoleteIn : null ,
87
- } ,
88
- 'new-global' : {
89
- id : 'new-global' ,
90
- status : 'active' ,
91
- deprecatedIn : new Version ( 1 , 17 , 2 ) ,
92
- obsoleteIn : null ,
93
- description : 'Declaring new variables with !global.' ,
94
- } ,
95
- 'color-module-compat' : {
96
- id : 'color-module-compat' ,
97
- status : 'active' ,
98
- deprecatedIn : new Version ( 1 , 23 , 0 ) ,
99
- obsoleteIn : null ,
100
- description :
101
- 'Using color module functions in place of plain CSS functions.' ,
102
- } ,
103
- 'slash-div' : {
104
- id : 'slash-div' ,
105
- status : 'active' ,
106
- deprecatedIn : new Version ( 1 , 33 , 0 ) ,
107
- obsoleteIn : null ,
108
- description : '/ operator for division.' ,
109
- } ,
110
- 'bogus-combinators' : {
111
- id : 'bogus-combinators' ,
112
- status : 'active' ,
113
- deprecatedIn : new Version ( 1 , 54 , 0 ) ,
114
- obsoleteIn : null ,
115
- description : 'Leading, trailing, and repeated combinators.' ,
116
- } ,
117
- 'strict-unary' : {
118
- id : 'strict-unary' ,
119
- status : 'active' ,
120
- deprecatedIn : new Version ( 1 , 55 , 0 ) ,
121
- obsoleteIn : null ,
122
- description : 'Ambiguous + and - operators.' ,
123
- } ,
124
- 'function-units' : {
125
- id : 'function-units' ,
126
- status : 'active' ,
127
- deprecatedIn : new Version ( 1 , 56 , 0 ) ,
128
- obsoleteIn : null ,
129
- description : 'Passing invalid units to built-in functions.' ,
130
- } ,
131
- 'duplicate-var-flags' : {
132
- id : 'duplicate-var-flags' ,
133
- status : 'active' ,
134
- deprecatedIn : new Version ( 1 , 62 , 0 ) ,
135
- obsoleteIn : null ,
136
- description : 'Using !default or !global multiple times for one variable.' ,
137
- } ,
138
- 'null-alpha' : {
139
- id : 'null-alpha' ,
140
- status : 'active' ,
141
- deprecatedIn : new Version ( 1 , 62 , 3 ) ,
142
- obsoleteIn : null ,
143
- description : 'Passing null as alpha in the JS API.' ,
144
- } ,
145
- 'abs-percent' : {
146
- id : 'abs-percent' ,
147
- status : 'active' ,
148
- deprecatedIn : new Version ( 1 , 65 , 0 ) ,
149
- obsoleteIn : null ,
150
- description : 'Passing percentages to the Sass abs() function.' ,
151
- } ,
152
- 'fs-importer-cwd' : {
153
- id : 'fs-importer-cwd' ,
154
- status : 'active' ,
155
- deprecatedIn : new Version ( 1 , 73 , 0 ) ,
156
- obsoleteIn : null ,
157
- description :
158
- 'Using the current working directory as an implicit load path.' ,
159
- } ,
160
- 'css-function-mixin' : {
161
- id : 'css-function-mixin' ,
162
- status : 'active' ,
163
- deprecatedIn : new Version ( 1 , 76 , 0 ) ,
164
- obsoleteIn : null ,
165
- description : 'Function and mixin names beginning with --.' ,
166
- } ,
167
- import : {
168
- id : 'import' ,
169
- status : 'future' ,
170
- deprecatedIn : null ,
171
- obsoleteIn : null ,
172
- description : '@import rules.' ,
173
- } ,
174
- 'user-authored' : {
175
- id : 'user-authored' ,
176
- status : 'user' ,
177
- deprecatedIn : null ,
178
- obsoleteIn : null ,
179
- } ,
180
- } ;
0 commit comments