1
Fork 0

remove file.paths

This commit is contained in:
Conduitry 2018-03-16 00:31:16 -04:00
parent 9427a01040
commit ebb2adb535
3 changed files with 2 additions and 8 deletions

4
API.md
View file

@ -18,10 +18,6 @@ A new `File` instance to serve as the representation of a physical file, a virtu
The relative path to the file, from some understood root. The path is always separated by forward slashes, regardless of platform. Updating `dir`, `filename`, or `ext` also updates this.
### `paths`
An array of all `path`s this file has had, in chronological order. Automatically updated by setting `path`, `dir`, `filename`, and `ext`.
### `dir`
The directory (not including the trailing slash) containing the file.

View file

@ -4,7 +4,7 @@
Defiler's concept of a file is something that can come from one of two places: a physical file on the disk, or a virtual file that is generated by your code. These two types of files differ very slightly in how they are treated, but for the most part Defiler handles them both the same.
`File`s have a `path` property containing the relative path to the file, as well as `dir`, `filename`, and `ext` properties containing portions of the path. All of these can be updated and keep the others in sync. `paths` contains an array of all historical paths this `File` instance has had since its creation.
`File`s have a `path` property containing the relative path to the file, as well as `dir`, `filename`, and `ext` properties containing portions of the path. All of these can be updated and keep the others in sync.
For physical files, the `stats` property contains the `fs.Stats` object retrieved for the original file.
@ -56,7 +56,7 @@ Then, call its [`exec()` method](API.md#exec) to set everything in motion. This
Useful things available on the `Defiler` instance for you to use in the transform or the generators are:
- [`defiler.paths`](API.md#paths-1) - a `Set` of the paths of all of the physical files
- [`defiler.paths`](API.md#paths) - a `Set` of the paths of all of the physical files
- [`defiler.files`](API.md#files) - a `Map` of original paths to the transformed `File` instances
- [`defiler.get(path)`](API.md#getpath) - a method to retrieve one or more transformed `File`s based on their original paths
- [`defiler.add(file)`](API.md#addfile) - a method to add a virtual file, which is then transformed like a physical one is, and which can be depended on by other files

View file

@ -8,7 +8,6 @@ export default class File {
[_dir]: null, //cached dir
[_filename]: null, // cached filename
[_ext]: null, // cached ext
paths: [], // all historical paths of file
stats: null, // stats of file
[_enc]: 'utf8', // encoding
[_bytes]: null, // Buffer of file contents
@ -25,7 +24,6 @@ export default class File {
if (this[_path] !== path) {
this[_path] = path
this[_dir] = this[_filename] = this[_ext] = null
this.paths.push(path)
}
}