now fully es6

This commit is contained in:
Philipp Kunz 2016-07-26 18:15:03 +02:00
parent f436fffecd
commit a7d0bfc63f
11 changed files with 44 additions and 52 deletions

View File

@ -1,3 +1,3 @@
import "typings-global";
declare let browserify: (transforms?: any[]) => any;
/// <reference types="node" />
declare let browserify: (transforms?: any[]) => NodeJS.ReadWriteStream;
export = browserify;

View File

@ -1,13 +1,11 @@
"use strict";
require("typings-global");
var plugins = require("./gulpbrowser.plugins");
var browserify = function (transforms) {
if (transforms === void 0) { transforms = []; }
const plugins = require("./gulpbrowser.plugins");
let browserify = function (transforms = []) {
if (!Array.isArray(transforms)) {
transforms = [transforms];
}
var forEach = function (file, enc, cb) {
var bundleCallback = function (err, bufferedContent) {
let forEach = function (file, enc, cb) {
let bundleCallback = function (err, bufferedContent) {
if (Buffer.isBuffer(bufferedContent)) {
file.contents = bufferedContent;
}
@ -19,16 +17,16 @@ var browserify = function (transforms) {
cb(null, file);
};
if (file.contents.length > 0) {
var browserified_1 = plugins.browserify(file, { basedir: file.base });
let browserified = plugins.browserify(file, { basedir: file.base });
transforms.forEach(function (transform) {
if (typeof transform === 'function') {
browserified_1.transform(transform);
browserified.transform(transform);
}
else {
browserified_1.transform(transform.transform, transform.options);
browserified.transform(transform.transform, transform.options);
}
});
browserified_1.bundle(bundleCallback);
browserified.bundle(bundleCallback);
}
else {
plugins.beautylog.warn("gulp-browser: .browserify() file.contents appears to be empty");
@ -36,11 +34,10 @@ var browserify = function (transforms) {
}
;
};
var atEnd = function (cb) {
let atEnd = function (cb) {
cb();
}; // no need to clean up after ourselves
return plugins.through.obj(forEach, atEnd); // this is the through object that gets returned by gulpBrowser.browserify();
return plugins.through2.obj(forEach, atEnd); // this is the through object that gets returned by gulpBrowser.browserify();
};
module.exports = browserify;
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImd1bHBicm93c2VyLmJyb3dzZXJpZnkudHMiXSwibmFtZXMiOltdLCJtYXBwaW5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DQUFDO0lBQ04sQ0FBQyxDQUFBO0lBRUQsSUFBSSxLQUFLLEdBQUcsVUFBUyxFQUFFO1FBQ25CLEVBQUUsRUFBRSxDQUFDO0lBQ1QsQ0FBQyxDQUFBLENBQUMsc0NBQXNDO0lBRXhDLE1BQU0sQ0FBQyxPQUFPLENBQUMsUUFBUSxDQUFDLEdBQUcsQ0FBQyxPQUFPLEVBQUMsS0FBSyxDQUFDLENBQUMsQ0FBQyw2RUFBNkU7QUFDNUgsQ0FBQyxDQUFDO0FBRUgsaUJBQVMsVUFBVSxDQUFDIn0=

View File

@ -1,5 +1,5 @@
import "typings-global";
export declare let beautylog: any;
export declare let through: any;
export declare let path: any;
export declare let browserify: any;
export import beautylog = require("beautylog");
export import through2 = require("through2");
export import path = require("path");
export import browserify = require("browserify");

View File

@ -1,8 +1,7 @@
"use strict";
require("typings-global");
exports.beautylog = require("beautylog");
exports.through = require("through2");
exports.through2 = require("through2");
exports.path = require("path");
exports.browserify = require("browserify");
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImd1bHBicm93c2VyLnBsdWdpbnMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLFFBQU8sZ0JBQWdCLENBQUMsQ0FBQTtBQUNiLGlCQUFTLEdBQUcsT0FBTyxDQUFDLFdBQVcsQ0FBQyxDQUFDO0FBQ2pDLGVBQU8sR0FBRyxPQUFPLENBQUMsVUFBVSxDQUFDLENBQUM7QUFDOUIsWUFBSSxHQUFHLE9BQU8sQ0FBQyxNQUFNLENBQUMsQ0FBQztBQUN2QixrQkFBVSxHQUFHLE9BQU8sQ0FBQyxZQUFZLENBQUMsQ0FBQyIsImZpbGUiOiJndWxwYnJvd3Nlci5wbHVnaW5zLmpzIiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IFwidHlwaW5ncy1nbG9iYWxcIjtcclxuZXhwb3J0IGxldCBiZWF1dHlsb2cgPSByZXF1aXJlKFwiYmVhdXR5bG9nXCIpO1xyXG5leHBvcnQgbGV0IHRocm91Z2ggPSByZXF1aXJlKFwidGhyb3VnaDJcIik7XHJcbmV4cG9ydCBsZXQgcGF0aCA9IHJlcXVpcmUoXCJwYXRoXCIpO1xyXG5leHBvcnQgbGV0IGJyb3dzZXJpZnkgPSByZXF1aXJlKFwiYnJvd3NlcmlmeVwiKTtcclxuIl19
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZ3VscGJyb3dzZXIucGx1Z2lucy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL2d1bHBicm93c2VyLnBsdWdpbnMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLFFBQU8sZ0JBQWdCLENBQUMsQ0FBQTtBQUNWLGlCQUFTLFdBQVcsV0FBVyxDQUFDLENBQUM7QUFDakMsZ0JBQVEsV0FBVyxVQUFVLENBQUMsQ0FBQztBQUMvQixZQUFJLFdBQVcsTUFBTSxDQUFDLENBQUM7QUFDdkIsa0JBQVUsV0FBVyxZQUFZLENBQUMsQ0FBQyJ9

1
dist/index.d.ts vendored
View File

@ -1,2 +1 @@
import "typings-global";
export import browserify = require("./gulpbrowser.browserify");

4
dist/index.js vendored
View File

@ -1,5 +1,3 @@
"use strict";
require("typings-global");
exports.browserify = require("./gulpbrowser.browserify");
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImluZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQSxRQUFPLGdCQUFnQixDQUFDLENBQUE7QUFFVixrQkFBVSxXQUFXLDBCQUEwQixDQUFDLENBQUMiLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgXCJ0eXBpbmdzLWdsb2JhbFwiO1xyXG5cclxuZXhwb3J0IGltcG9ydCBicm93c2VyaWZ5ID0gcmVxdWlyZShcIi4vZ3VscGJyb3dzZXIuYnJvd3NlcmlmeVwiKTtcclxuXHJcbiJdfQ==
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQWMsa0JBQVUsV0FBVywwQkFBMEIsQ0FBQyxDQUFDIn0=

View File

@ -25,16 +25,20 @@
},
"homepage": "https://gitlab.com/pushrocks/gulp-browser",
"dependencies": {
"beautylog": "^5.0.8",
"browserify": "^13.0.1",
"@types/browserify": "^12.0.29",
"@types/through2": "^0.0.28",
"beautylog": "^5.0.18",
"browserify": "^13.1.0",
"through2": "^2.0.1",
"typings-global": "^1.0.3"
"typings-global": "^1.0.6"
},
"devDependencies": {
"babel-preset-es2015": "^6.9.0",
"babelify": "^7.3.0",
"gulp": "^3.9.1",
"gulp-function": "^1.3.1",
"npmts": "^5.2.1",
"should": "^9.0.0",
"gulp-function": "^1.3.6",
"npmts-g": "^5.2.6",
"should": "^10.0.0",
"typings-test": "^1.0.1"
}
}

File diff suppressed because one or more lines are too long

View File

@ -1,4 +1,3 @@
import "typings-global";
import plugins = require("./gulpbrowser.plugins");
@ -43,7 +42,7 @@ let browserify = function(transforms = []) {
cb();
} // no need to clean up after ourselves
return plugins.through.obj(forEach,atEnd); // this is the through object that gets returned by gulpBrowser.browserify();
return plugins.through2.obj(forEach,atEnd); // this is the through object that gets returned by gulpBrowser.browserify();
};
export = browserify;

View File

@ -1,5 +1,5 @@
import "typings-global";
export let beautylog = require("beautylog");
export let through = require("through2");
export let path = require("path");
export let browserify = require("browserify");
export import beautylog = require("beautylog");
export import through2 = require("through2");
export import path = require("path");
export import browserify = require("browserify");

View File

@ -1,4 +1 @@
import "typings-global";
export import browserify = require("./gulpbrowser.browserify");