@@ -606,6 +606,75 @@ declare module 'svelte/compiler' {
606
606
* @deprecated Replace this with `import { walk } from 'estree-walker'`
607
607
* */
608
608
function walk ( ) : never ;
609
+ /**
610
+ * The result of a preprocessor run. If the preprocessor does not return a result, it is assumed that the code is unchanged.
611
+ */
612
+ interface Processed {
613
+ /**
614
+ * The new code
615
+ */
616
+ code : string ;
617
+ /**
618
+ * A source map mapping back to the original code
619
+ */
620
+ map ?: string | object ; // we are opaque with the type here to avoid dependency on the remapping module for our public types.
621
+ /**
622
+ * A list of additional files to watch for changes
623
+ */
624
+ dependencies ?: string [ ] ;
625
+ /**
626
+ * Only for script/style preprocessors: The updated attributes to set on the tag. If undefined, attributes stay unchanged.
627
+ */
628
+ attributes ?: Record < string , string | boolean > ;
629
+ toString ?: ( ) => string ;
630
+ }
631
+
632
+ /**
633
+ * A markup preprocessor that takes a string of code and returns a processed version.
634
+ */
635
+ type MarkupPreprocessor = ( options : {
636
+ /**
637
+ * The whole Svelte file content
638
+ */
639
+ content : string ;
640
+ /**
641
+ * The filename of the Svelte file
642
+ */
643
+ filename ?: string ;
644
+ } ) => Processed | void | Promise < Processed | void > ;
645
+
646
+ /**
647
+ * A script/style preprocessor that takes a string of code and returns a processed version.
648
+ */
649
+ type Preprocessor = ( options : {
650
+ /**
651
+ * The script/style tag content
652
+ */
653
+ content : string ;
654
+ /**
655
+ * The attributes on the script/style tag
656
+ */
657
+ attributes : Record < string , string | boolean > ;
658
+ /**
659
+ * The whole Svelte file content
660
+ */
661
+ markup : string ;
662
+ /**
663
+ * The filename of the Svelte file
664
+ */
665
+ filename ?: string ;
666
+ } ) => Processed | void | Promise < Processed | void > ;
667
+
668
+ /**
669
+ * A preprocessor group is a set of preprocessors that are applied to a Svelte file.
670
+ */
671
+ interface PreprocessorGroup {
672
+ /** Name of the preprocessor. Will be a required option in the next major version */
673
+ name ?: string ;
674
+ markup ?: MarkupPreprocessor ;
675
+ style ?: Preprocessor ;
676
+ script ?: Preprocessor ;
677
+ }
609
678
/** The return value of `compile` from `svelte/compiler` */
610
679
interface CompileResult {
611
680
/** The compiled JavaScript */
@@ -1823,77 +1892,8 @@ declare module 'svelte/compiler' {
1823
1892
content : Program ;
1824
1893
attributes : Attribute [ ] ;
1825
1894
}
1826
- /**
1827
- * The result of a preprocessor run. If the preprocessor does not return a result, it is assumed that the code is unchanged.
1828
- */
1829
- interface Processed {
1830
- /**
1831
- * The new code
1832
- */
1833
- code : string ;
1834
- /**
1835
- * A source map mapping back to the original code
1836
- */
1837
- map ?: string | object ; // we are opaque with the type here to avoid dependency on the remapping module for our public types.
1838
- /**
1839
- * A list of additional files to watch for changes
1840
- */
1841
- dependencies ?: string [ ] ;
1842
- /**
1843
- * Only for script/style preprocessors: The updated attributes to set on the tag. If undefined, attributes stay unchanged.
1844
- */
1845
- attributes ?: Record < string , string | boolean > ;
1846
- toString ?: ( ) => string ;
1847
- }
1848
-
1849
- /**
1850
- * A markup preprocessor that takes a string of code and returns a processed version.
1851
- */
1852
- type MarkupPreprocessor = ( options : {
1853
- /**
1854
- * The whole Svelte file content
1855
- */
1856
- content : string ;
1857
- /**
1858
- * The filename of the Svelte file
1859
- */
1860
- filename ?: string ;
1861
- } ) => Processed | void | Promise < Processed | void > ;
1862
-
1863
- /**
1864
- * A script/style preprocessor that takes a string of code and returns a processed version.
1865
- */
1866
- type Preprocessor = ( options : {
1867
- /**
1868
- * The script/style tag content
1869
- */
1870
- content : string ;
1871
- /**
1872
- * The attributes on the script/style tag
1873
- */
1874
- attributes : Record < string , string | boolean > ;
1875
- /**
1876
- * The whole Svelte file content
1877
- */
1878
- markup : string ;
1879
- /**
1880
- * The filename of the Svelte file
1881
- */
1882
- filename ?: string ;
1883
- } ) => Processed | void | Promise < Processed | void > ;
1884
-
1885
- /**
1886
- * A preprocessor group is a set of preprocessors that are applied to a Svelte file.
1887
- */
1888
- interface PreprocessorGroup {
1889
- /** Name of the preprocessor. Will be a required option in the next major version */
1890
- name ?: string ;
1891
- markup ?: MarkupPreprocessor ;
1892
- style ?: Preprocessor ;
1893
- script ?: Preprocessor ;
1894
- }
1895
1895
1896
- export { compile , compileModule , parse , walk , preprocess , CompileError , VERSION , migrate } ;
1896
+ export { MarkupPreprocessor , Preprocessor , PreprocessorGroup , Processed , CompileOptions , ModuleCompileOptions , compile , compileModule , parse , walk , preprocess , CompileError , VERSION , migrate } ;
1897
1897
}
1898
1898
1899
1899
declare module 'svelte/easing' {
@@ -2510,7 +2510,7 @@ declare module 'svelte/types/compiler/preprocess' {
2510
2510
}
2511
2511
2512
2512
/**
2513
- * Utility type to extract the type of a preprocessor from a preprocessor group
2513
+ * @description Utility type to extract the type of a preprocessor from a preprocessor group
2514
2514
* @deprecated Create this utility type yourself instead
2515
2515
*/
2516
2516
interface SveltePreprocessor_1 <
0 commit comments