Skip to content

Commit d0b5f8d

Browse files
committed
refactor: 💡 remove more deprecated things
1 parent bb0cef8 commit d0b5f8d

File tree

3 files changed

+17
-27
lines changed

3 files changed

+17
-27
lines changed

‎src/autoProcess.ts

Lines changed: 2 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -7,39 +7,16 @@ import {
77
Processed,
88
TransformerArgs,
99
TransformerOptions,
10+
Transformers,
1011
} from './types';
1112
import { hasPostCssInstalled } from './modules/hasPostcssInstalled';
1213
import { concat } from './modules/concat';
1314
import { parseFile } from './modules/parseFile';
1415
import { addLanguageAlias } from './modules/language';
1516
import { throwError } from './modules/errors';
1617

17-
interface Transformers {
18-
typescript?: TransformerOptions<Options.Typescript>;
19-
scss?: TransformerOptions<Options.Sass>;
20-
sass?: TransformerOptions<Options.Sass>;
21-
less?: TransformerOptions<Options.Less>;
22-
stylus?: TransformerOptions<Options.Stylus>;
23-
postcss?: TransformerOptions<Options.Postcss>;
24-
coffeescript?: TransformerOptions<Options.Coffeescript>;
25-
pug?: TransformerOptions<Options.Pug>;
26-
globalStyle?: Options.GlobalStyle;
27-
replace?: Options.Replace;
28-
[languageName: string]: TransformerOptions;
29-
}
30-
31-
type AutoPreprocessOptions = {
32-
/** @deprecated for svelte v3 use instead a array of processors */
33-
onBefore?: ({
34-
content,
35-
filename,
36-
}: {
37-
content: string;
38-
filename: string;
39-
}) => Promise<string> | string;
18+
type AutoPreprocessOptions = Transformers & {
4019
markupTagName?: string;
41-
/** @deprecated add transformer config directly to svelte-preprocess options object */
42-
transformers?: Transformers;
4320
aliases?: Array<[string, string]>;
4421
preserve?: string[];
4522
typescript?: TransformerOptions<Options.Typescript>;

‎src/types/index.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,16 @@ export type TransformerOptions<T = any> =
3838
| boolean
3939
| Record<keyof T | string, T[keyof T] | any>
4040
| Transformer<T>;
41+
42+
export interface Transformers {
43+
typescript?: TransformerOptions<Options.Typescript>;
44+
scss?: TransformerOptions<Options.Sass>;
45+
sass?: TransformerOptions<Options.Sass>;
46+
less?: TransformerOptions<Options.Less>;
47+
stylus?: TransformerOptions<Options.Stylus>;
48+
postcss?: TransformerOptions<Options.Postcss>;
49+
coffeescript?: TransformerOptions<Options.Coffeescript>;
50+
pug?: TransformerOptions<Options.Pug>;
51+
globalStyle?: Options.GlobalStyle;
52+
replace?: Options.Replace;
53+
}

‎test/autoProcess/markup.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,10 @@ MARKUP_LANGS.forEach(([lang, ext]) => {
4545
`template.${ext}`,
4646
)}</template>`;
4747

48-
it(`should throw parsing ${lang} when { ${lang}: false }`, async () => {
48+
it(`should NOT throw parsing ${lang} when { ${lang}: false }`, async () => {
4949
const opts = getAutoPreprocess({ pug: false });
5050

51-
expect(await doesCompileThrow(template, opts)).toBe(true);
51+
expect(await doesCompileThrow(template, opts)).toBe(false);
5252
});
5353

5454
it(`should parse ${lang}`, async () => {

0 commit comments

Comments
 (0)