@@ -127,51 +127,38 @@ export class KeymanDeveloperProjectOptions {
127127 }
128128} ;
129129
130- export type KeymanDeveloperProjectFile = KeymanDeveloperProjectFile10 | KeymanDeveloperProjectFile20 ;
131-
132- export class KeymanDeveloperProjectFile10 {
133- readonly id : string ; // 1.0 only
134- readonly filename : string ;
130+ export interface KeymanDeveloperProjectFile {
131+ get filename ( ) : string ;
132+ get fileType ( ) : string ;
135133 readonly filePath : string ;
136- readonly fileVersion : string ; // 1.0 only
137- /**
138- * file extension of filename; warning: .model.ts is technically not the fileType because of 2 periods
139- * @deprecated use `getFileType()`
140- */
141- readonly fileType : KeymanFileTypes . Any ; // 1.0 only
134+ } ;
135+
136+ export class KeymanDeveloperProjectFile10 implements KeymanDeveloperProjectFile {
137+ get filename ( ) : string {
138+ return this . callbacks . path . basename ( this . filePath ) ;
139+ }
140+ get fileType ( ) : string {
141+ return KeymanFileTypes . fromFilename ( this . filename ) ;
142+ }
142143 details : KeymanDeveloperProjectFileDetail_Kmn & KeymanDeveloperProjectFileDetail_Kps ; // 1.0 only
143144 childFiles : KeymanDeveloperProjectFile [ ] ; // 1.0 only
144- constructor ( id : string , filename : string , filePath : string , fileVersion :string , fileType : KeymanFileTypes . Any ) {
145+
146+ constructor ( public readonly id : string , public readonly filePath : string , public readonly fileVersion :string , private readonly callbacks : CompilerCallbacks ) {
145147 this . details = { } ;
146148 this . childFiles = [ ] ;
147- this . id = id ;
148- this . filename = filename ;
149- this . filePath = filePath ;
150- this . fileVersion = fileVersion ;
151- this . fileType = fileType ;
152- }
153- getFileType ( ) {
154- return KeymanFileTypes . sourceTypeFromFilename ( this . filename ) ;
155149 }
156150} ;
157151
158152export type KeymanDeveloperProjectFileType20 = KeymanFileTypes . Source ;
159153
160- export class KeymanDeveloperProjectFile20 {
161- readonly filename : string ;
162- readonly filePath : string ;
163- /**
164- * file extension of filename, but .model.ts is technically not the ext because of 2 periods
165- * @deprecated TODO: remove this from 2.0 or make it private
166- */
167- readonly fileType : KeymanFileTypes . Source ;
168- constructor ( filePath : string , private callbacks : CompilerCallbacks ) {
169- this . filename = this . callbacks . path . basename ( filePath ) ;
170- this . filePath = filePath ;
171- this . fileType = KeymanFileTypes . sourceTypeFromFilename ( this . filename ) ;
154+ export class KeymanDeveloperProjectFile20 implements KeymanDeveloperProjectFile {
155+ get filename ( ) : string {
156+ return this . callbacks . path . basename ( this . filePath ) ;
157+ }
158+ get fileType ( ) {
159+ return KeymanFileTypes . fromFilename ( this . filename ) ;
172160 }
173- getFileType ( ) {
174- return this . fileType ;
161+ constructor ( public readonly filePath : string , private readonly callbacks : CompilerCallbacks ) {
175162 }
176163} ;
177164
0 commit comments