{"action":"closed","issue":{"url":"https://api.github.com/repos/makojs/tree/issues/9","repository_url":"https://api.github.com/repos/makojs/tree","labels_url":"https://api.github.com/repos/makojs/tree/issues/9/labels{/name}","comments_url":"https://api.github.com/repos/makojs/tree/issues/9/comments","events_url":"https://api.github.com/repos/makojs/tree/issues/9/events","html_url":"https://github.com/makojs/tree/issues/9","id":156905072,"number":9,"title":"Switch to Vinyl","user":{"login":"dominicbarnes","id":160197,"avatar_url":"https://avatars.githubusercontent.com/u/160197?v=3","gravatar_id":"","url":"https://api.github.com/users/dominicbarnes","html_url":"https://github.com/dominicbarnes","followers_url":"https://api.github.com/users/dominicbarnes/followers","following_url":"https://api.github.com/users/dominicbarnes/following{/other_user}","gists_url":"https://api.github.com/users/dominicbarnes/gists{/gist_id}","starred_url":"https://api.github.com/users/dominicbarnes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dominicbarnes/subscriptions","organizations_url":"https://api.github.com/users/dominicbarnes/orgs","repos_url":"https://api.github.com/users/dominicbarnes/repos","events_url":"https://api.github.com/users/dominicbarnes/events{/privacy}","received_events_url":"https://api.github.com/users/dominicbarnes/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":8,"created_at":"2016-05-26T05:15:46Z","updated_at":"2016-06-05T04:37:56Z","closed_at":"2016-06-05T04:37:56Z","body":"I want to seriously consider replacing the `File` internals here with [vinyl](https://www.npmjs.com/package/vinyl). This issue will be my brainstorming/scratchpad for this transition.\r\n\r\nLet's start with the benefits:\r\n\r\n - Going 3rd-party means less to maintain in core\r\n - Gulp has been using this for a long time, and there are a lot of really solid design decisions they've made (as they continue to press it forward, I can ride their coat-tails)\r\n - The internals of `path` and `history`  is just more flexible and intuitive than what I have\r\n - The addition of `base` being included (along with `cwd`) is also more robust that what I have\r\n\r\nTo successfully switch, there are a few things I'll need to rework/consider:\r\n\r\nFirst, I've been relying on `file.path` as an \"immutable\" ID for files in the tree, which doesn't always make sense, especially if:\r\n\r\n - you want to indicate the file needs to be output elsewhere (a separate `file.output` is really awkward)\r\n - files go through several steps of change throughout the build (eg: transpile and change extension)\r\n - you are adding build-only files, like `*.map` and `shared.js`\r\n\r\nI think the better long-term solution here is to generate UUIDs for each file and use other mechanisms for querying by path. This could have other implications for plugins, as finding other files could become less straightforward. I'm hoping that is not the case, as long as things like `File#getDependencies()` still continues to work as-is.\r\n\r\nSecond, I'll need to make sure that behavior like `File#dirty()` can continue working as well. In fact, I'll need to be careful about all the props I've started to rely on internally.\r\n\r\nThird, I don't (yet) know of a way to serialize a vinyl object so it can be saved using mako-cache. I'm sure there's another module for just this case, I just need to do more research.\r\n\r\nFourth, by adopting vinyl, I'm not sure how well mako will interoperate with other vinyl-* plugins. If those plugins only really work within Gulp, I could be setting myself up to just create confusion for mako plugin devs. (where they assume things are more Gulp-like than they really are)\r\n\r\nFifth, vinyl does not use strings for `file.contents`, the closest thing is buffers, which will be an extra step that plugin authors will need to deal with. It's probably for the best, since memory-usage for buffers is better than with strings, plus vinyl complains pretty loudly when you do the wrong thing.\r\n\r\nI'll start a branch very soon to start playing around with this concept. It looks like it'll be a pretty big disruption to mako, but I think it'll be for the best, especially so early on in the project."}}
{"actor":{"display_login":"dominicbarnes"}}