@@ -6,6 +6,10 @@ import * as path from 'path'
66import { Plugin } from "postcss" ;
77
88
9+ type Dictionary < T > = {
10+ [ key : string ] : T | undefined ;
11+ } ;
12+
913export default class FileSystemLoader {
1014 private root : string ;
1115 private sources : Dictionary < string > ;
@@ -65,35 +69,4 @@ export default class FileSystemLoader {
6569 }
6670 } )
6771 }
68-
69- private get finalSource ( ) : string {
70- return Object . keys ( this . sources ) . sort ( traceKeySorter ) . map ( s => this . sources [ s ] )
71- . join ( "" )
72- }
73-
74- private clear ( ) : FileSystemLoader {
75- this . tokensByFile = { } ;
76- return this ;
77- }
7872}
79-
80- // Sorts dependencies in the following way:
81- // AAA comes before AA and A
82- // AB comes after AA and before A
83- // All Bs come after all As
84- // This ensures that the files are always returned in the following order:
85- // - In the order they were required, except
86- // - After all their dependencies
87- function traceKeySorter ( a : string , b : string ) : number {
88- if ( a . length < b . length ) {
89- return a < b . substring ( 0 , a . length ) ? - 1 : 1
90- } else if ( a . length > b . length ) {
91- return a . substring ( 0 , b . length ) <= b ? - 1 : 1
92- } else {
93- return a < b ? - 1 : 1
94- }
95- } ;
96-
97- type Dictionary < T > = {
98- [ key : string ] : T | undefined ;
99- } ;
0 commit comments