diff --git a/build/build.node.ts b/build/build.node.ts index 446b638394..5a0f9ac30c 100644 --- a/build/build.node.ts +++ b/build/build.node.ts @@ -1398,7 +1398,7 @@ namespace $ { return targets } - + @ $mol_mem_key bundleFiles( [ path , exclude ] : [ path : string , exclude? : readonly string[] ] ) : $mol_file[] { const root = this.root() @@ -1423,8 +1423,7 @@ namespace $ { } const start = Date.now() - const target = file.clone(pack.resolve( `-/${ file.relate( root ) }` ).path()) - target.stat() + const target = file.copy(pack.resolve( `-/${ file.relate( root ) }` ).path()) targets.push( target ) this.logBundle( target , Date.now() - start ) diff --git a/file/file.node.ts b/file/file.node.ts index aebff59a16..8e05d976e0 100644 --- a/file/file.node.ts +++ b/file/file.node.ts @@ -81,7 +81,6 @@ namespace $ { @ $mol_mem override stat(next? : $mol_file_stat | null, virt?: 'virt') { - if (next === undefined) this.copy_sync() let stat = next const path = this.path() @@ -114,8 +113,11 @@ namespace $ { } + @ $mol_mem_key override copy(to: string) { + this.stat() $node.fs.copyFileSync(this.path(), to) + return this.$.$mol_file.absolute(to) } @ $mol_action diff --git a/file/file.ts b/file/file.ts index 166a951d33..07a77d03ae 100644 --- a/file/file.ts +++ b/file/file.ts @@ -35,14 +35,6 @@ namespace $ { return this.resolve( '..' ) } - @ $mol_mem_key - clone(path: string) { - return ( this.constructor as typeof $mol_file ).make({ - path: $mol_const(path), - copy_src: () => this.path() - }) - } - stat(next? : $mol_file_stat | null, virt?: 'virt'): null | $mol_file_stat { return null } @@ -125,20 +117,9 @@ namespace $ { @ $mol_mem buffer( next? : Uint8Array ) { return next ?? new Uint8Array } - @ $mol_mem - copy_src(path?: string) { return path ?? null } - - copy(to: string) {} - - @ $mol_mem - copy_sync() { - const src_path = this.copy_src() - if (! src_path) return false - const src = this.$.$mol_file.absolute(src_path) - src.stat() - src.copy(this.path()) - - return true + @ $mol_mem_key + copy(to: string): $mol_file { + throw new Error('not implemented') } @ $mol_mem diff --git a/file/file.web.ts b/file/file.web.ts index 4f739dd213..5bc6c9d160 100644 --- a/file/file.web.ts +++ b/file/file.web.ts @@ -23,7 +23,6 @@ namespace $ { @ $mol_mem override stat( next? : $mol_file_stat, virt?: 'virt' ) { - this.copy_sync() let stat = next if (next === undefined) { const content = this.text()