@@ -29,30 +29,10 @@ interface Transformers {
29
29
[ languageName : string ] : TransformerOptions ;
30
30
}
31
31
32
- type AutoPreprocessOptions = {
33
- /** @deprecated for svelte v3 use instead a array of processors */
34
- onBefore ?: ( {
35
- content,
36
- filename,
37
- } : {
38
- content : string ;
39
- filename : string ;
40
- } ) => Promise < string > | string ;
32
+ type AutoPreprocessOptions = Transformers & {
41
33
markupTagName ?: string ;
42
- /** @deprecated add transformer config directly to svelte-preprocess options object */
43
- transformers ?: Transformers ;
44
34
aliases ?: Array < [ string , string ] > ;
45
35
preserve ?: string [ ] ;
46
- typescript ?: TransformerOptions < Options . Typescript > ;
47
- scss ?: TransformerOptions < Options . Sass > ;
48
- sass ?: TransformerOptions < Options . Sass > ;
49
- less ?: TransformerOptions < Options . Less > ;
50
- stylus ?: TransformerOptions < Options . Stylus > ;
51
- postcss ?: TransformerOptions < Options . Postcss > ;
52
- babel ?: TransformerOptions < Options . Babel > ;
53
- coffeescript ?: TransformerOptions < Options . Coffeescript > ;
54
- pug ?: TransformerOptions < Options . Pug > ;
55
- globalStyle ?: Options . GlobalStyle ;
56
36
// workaround while we don't have this
57
37
// https://github.com/microsoft/TypeScript/issues/17867
58
38
[ languageName : string ] :
@@ -63,7 +43,6 @@ type AutoPreprocessOptions = {
63
43
| TransformerOptions ;
64
44
} ;
65
45
66
- const SVELTE_MAJOR_VERSION = + version [ 0 ] ;
67
46
const ALIAS_OPTION_OVERRIDES : Record < string , any > = {
68
47
sass : {
69
48
indentedSyntax : true ,
@@ -72,7 +51,6 @@ const ALIAS_OPTION_OVERRIDES: Record<string, any> = {
72
51
73
52
export function autoPreprocess (
74
53
{
75
- onBefore,
76
54
aliases,
77
55
markupTagName = 'template' ,
78
56
preserve = [ ] ,
@@ -82,7 +60,7 @@ export function autoPreprocess(
82
60
markupTagName = markupTagName . toLocaleLowerCase ( ) ;
83
61
84
62
const optionsCache : Record < string , any > = { } ;
85
- const transformers = rest . transformers || ( rest as Transformers ) ;
63
+ const transformers = rest as Transformers ;
86
64
const markupPattern = new RegExp (
87
65
`<${ markupTagName } ([\\s\\S]*?)(?:>([\\s\\S]*)<\\/${ markupTagName } >|/>)` ,
88
66
) ;
@@ -158,16 +136,6 @@ export function autoPreprocess(
158
136
159
137
return {
160
138
async markup ( { content, filename } ) {
161
- if ( typeof onBefore === 'function' ) {
162
- // istanbul ignore next
163
- if ( SVELTE_MAJOR_VERSION >= 3 ) {
164
- console . warn (
165
- '[svelte-preprocess] For svelte >= v3, instead of onBefore(), prefer to prepend a preprocess object to your array of preprocessors' ,
166
- ) ;
167
- }
168
- content = await onBefore ( { content, filename } ) ;
169
- }
170
-
171
139
if ( transformers . replace ) {
172
140
const transformed = await runTransformer (
173
141
'replace' ,
0 commit comments