'use strict';

var assign = require('object-assign');
var crypto = require('crypto');
var events = require('events');
var path = require('path');
var VinylFile = require('vinyl');

function File() {
    VinylFile.apply(this, arguments);
    addProps(this);
}

File.prototype = Object.create(VinylFile.prototype);

function addProps(file) {
    return assign(file, {
        // data piped to browser-pack
        _hash: sha1(file.path),
        _deps: {},
        // whether transforms were run
        _transformed: false
    });
}

function sha1(str) {
    return crypto.createHash('sha1').update(str).digest('hex').substring(0, 7);
}

module.exports = function (file) {
    if (typeof file === 'string') {
        return new File({path: path.resolve(file)});
    }

    if (!file.path || !path.isAbsolute(file.path)) {
        throw new Error('file.path must be non-empty and absolute');
    }

    return addProps(file.clone());
};

@@ -83,40 +83,8 @@
 ');%0A
-var events = require('events');%0A
 var 
@@ -886,16 +886,8 @@
 file
-.clone()
 );%0A%7D

revert a couple unnecessary changes from 5eaa4ba