2
2
cloneResponseMonitorProgress ,
3
3
ProgressTracker ,
4
4
} from '@php-wasm/progress' ;
5
- import { FileTree , UniversalPHP } from '@php-wasm/universal' ;
5
+ import { FileTree , FileTreeAsync , UniversalPHP } from '@php-wasm/universal' ;
6
6
import { dirname , joinPaths , Semaphore } from '@php-wasm/util' ;
7
7
import {
8
8
listDescendantFiles ,
@@ -27,6 +27,12 @@ export type VFSReference = {
27
27
/** The path to the file in the VFS */
28
28
path : string ;
29
29
} ;
30
+ export type VFSDirectoryReference = {
31
+ /** Identifies the file resource as Virtual File System (VFS) */
32
+ resource : 'vfs' ;
33
+ /** The path to the file in the VFS */
34
+ path : string ;
35
+ } ;
30
36
export type LiteralReference = {
31
37
/** Identifies the file resource as a literal file */
32
38
resource : 'literal' ;
@@ -79,13 +85,14 @@ export type BlueprintAssetDirectoryReference = {
79
85
} ;
80
86
81
87
export interface Directory {
82
- // TODO: I think FileTree contains data that is already read. Can/should we have this lazily read instead?
83
- files : FileTree ;
88
+ files : FileTreeAsync ;
84
89
name : string ;
85
90
}
86
- export type DirectoryLiteralReference = Directory & {
91
+ export type DirectoryLiteralReference = {
87
92
/** Identifies the file resource as a git directory */
88
93
resource : 'literal:directory' ;
94
+ files : FileTree ;
95
+ name : string ;
89
96
} ;
90
97
91
98
export type FileReference =
@@ -99,6 +106,7 @@ export type FileReference =
99
106
export type DirectoryReference =
100
107
| GitDirectoryReference
101
108
| DirectoryLiteralReference
109
+ | VFSDirectoryReference
102
110
| BlueprintAssetDirectoryReference ;
103
111
104
112
export function isResourceReference ( ref : any ) : ref is FileReference {
@@ -339,7 +347,8 @@ export class BlueprintAssetDirectoryResource extends VFSDirectoryResource {
339
347
}
340
348
}
341
349
342
- export async function createLazyVFSFileTree (
350
+ // TODO: Should we export this?
351
+ async function createLazyVFSFileTree (
343
352
path : string ,
344
353
playground : UniversalPHP
345
354
) : Promise < FileTree > {
0 commit comments