added typings, removed beautylog
This commit is contained in:
parent
c9929963d7
commit
2992f54f11
11
.gitignore
vendored
11
.gitignore
vendored
@ -1,14 +1,7 @@
|
|||||||
node_modules/
|
node_modules/
|
||||||
.settings/
|
|
||||||
.idea/
|
|
||||||
npm-debug.log
|
npm-debug.log
|
||||||
|
|
||||||
ts/*.js
|
|
||||||
ts/*.js.map
|
|
||||||
ts/typings/
|
|
||||||
|
|
||||||
test/result/
|
test/result/
|
||||||
|
|
||||||
coverage/
|
coverage/
|
||||||
|
|
||||||
docs/
|
docs/
|
||||||
|
pages/
|
||||||
|
public
|
||||||
|
15
.travis.yml
15
.travis.yml
@ -1,15 +0,0 @@
|
|||||||
language: node_js
|
|
||||||
node_js:
|
|
||||||
- 4
|
|
||||||
- stable
|
|
||||||
deploy:
|
|
||||||
provider: npm
|
|
||||||
email: npm@lossless.digital
|
|
||||||
api_key:
|
|
||||||
secure: MNBFCPscAm1+rY1qIHbye3Bwif9W/bPyHxvXyoKbi8G2URQjZKNYTpRT0bVShj6UBJihBrnXa40cxmU/F+rcQhPeY4uFIC5oBIyYkSrn0XvhJEqn/yQnBl0DrdImYSuYx480jLKvvNq3RIft2K+5y6+qb8QuumV/1p4QYbiM6Ibwz54SPfmJtzsMsei8bHzbDvOtKeoX8l3mGqyIVX1D/Nnnq9rH0UZnbqf7W5IH/QlCTpVAj5v/HRCSbCbJkbmwTYtx4PV0xS9vYgXklwFr0FcJXyZPmzqSRM/EYnhOg61uQCWM1JG12nDmdv8lkE+x5L6fV+YXTeBAKmnCBAZy8D7CYX0jDELrpKp4wKFofl/AkTDAlVsjEb4U+DVXuJOWt8KQzjYGLX6nXXOUzDD9OXNmB6010a2g3SQ4vCX3jHomycPZTgKPd4MN5xiJBfg/EXn1HlJdtO8jYFB2S87VVmFrJfwQ6x4iZxabmWPtasye3DP/OLX+8/8aWNGLMjP/Lr4muPS4B9OOlI3EvVo+DR3B381NPwzKaM9NLkeM3pHgMhm0K2mqOnbvhUhhkmmMkQI1T+RRf91zraPXAh7fMRDh2lDqKfrhtKobFBmONgXAtO7QPz2Bhp+kszwRo/Vx//H2VpUD45CNfMKnN99VYY/FHGYICBYH2mK/MX50HAA=
|
|
||||||
on:
|
|
||||||
tags: true
|
|
||||||
repo: pushrocks/gulp-browser
|
|
||||||
notifications:
|
|
||||||
slack:
|
|
||||||
secure: f5Uss0z9RPl/QcA/DroB8loyE93aOYI6bqCkrsiUscmZtlv/TVQtT4dxqGA6uvcG6iTQDBi3Ul88dQxWkRm4IqbhY35/iMaV2dHW4FVYMAh8GQMbsfL2sALCcufxD9blw47awv3iFcwhV1EeyesscjgL0JIjduk96v/7G/6QIO2838M1lzlgtj+kRUkim8qkaEs1je3gRrhMUIjLuAdscMXyUKYFMjWo9ACSjVUl30R/ZNemb18itIja6i92GotreBgcfEMczvy58ovDC7xdJUsY8LjMI01DwY+WPRnI0tAhsuI8moBwwcdM4e3bAjKjucQRjO33O5bMWRZ6QCiYd0DnCEFyCPQLJ4GSy/tkD00n8ijLHAOSV3AH1zNbdK1EAdSPQXDvlI36KJn/2hyQLoitGHVUPr76ujJWP82ypO2tgIp3XQU0dJVCxDuHnwJO2+hjdI+gCPqxNTpjeujHx3UdkTGNRjuuf9dlZ/D08fApjYxy2fxItTqo3QjP/nrqvBXUOPP8yPHpjIT4H2t5Pr4SJjBGI6X4qhKyFj6s9rA/Xu1rL+45zu1C3uC3z+u3T9UwrbzJ/cZM6r6UQvQmUvIfBNaMlg4I/diQCDIPL+Rhop2nylY3IcHmJnk2itn7kOqj1tohCpFEml5pRuSZy4udWywkdtyBAsHWFLF7oiQ=
|
|
3
dist/gulpbrowser.browserify.d.ts
vendored
3
dist/gulpbrowser.browserify.d.ts
vendored
@ -1,3 +1,4 @@
|
|||||||
/// <reference types="node" />
|
/// <reference types="node" />
|
||||||
declare let browserify: (transforms?: any[]) => NodeJS.ReadWriteStream;
|
import * as stream from 'stream';
|
||||||
|
declare let browserify: (transforms?: any[]) => stream.Transform;
|
||||||
export = browserify;
|
export = browserify;
|
||||||
|
6
dist/gulpbrowser.browserify.js
vendored
6
dist/gulpbrowser.browserify.js
vendored
@ -10,7 +10,7 @@ let browserify = function (transforms = []) {
|
|||||||
file.contents = bufferedContent;
|
file.contents = bufferedContent;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
plugins.beautylog.error("gulp-browser: .browserify() " + err.message);
|
console.log('gulp-browser: .browserify() ' + err.message);
|
||||||
cb(new Error(err.message), file);
|
cb(new Error(err.message), file);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -29,7 +29,7 @@ let browserify = function (transforms = []) {
|
|||||||
browserified.bundle(bundleCallback);
|
browserified.bundle(bundleCallback);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
plugins.beautylog.warn("gulp-browser: .browserify() file.contents appears to be empty");
|
console.warn('gulp-browser: .browserify() file.contents appears to be empty');
|
||||||
cb(null, file);
|
cb(null, file);
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
@ -40,4 +40,4 @@ let browserify = function (transforms = []) {
|
|||||||
return plugins.through2.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;
|
module.exports = browserify;
|
||||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZ3VscGJyb3dzZXIuYnJvd3NlcmlmeS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL2d1bHBicm93c2VyLmJyb3dzZXJpZnkudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLE1BQU8sT0FBTyxXQUFXLHVCQUF1QixDQUFDLENBQUM7QUFHbEQsSUFBSSxVQUFVLEdBQUksVUFBUyxVQUFVLEdBQUcsRUFBRTtJQUV0QyxFQUFFLENBQUMsQ0FBQyxDQUFDLEtBQUssQ0FBQ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DbEMsRUFBRSxDQUFDLENBQUMsT0FBTyxTQUFTLEtBQUssVUFBVSxDQUFDLENBQUMsQ0FBQztvQkFDbEMsWUFBWSxDQUFDLFNBQVMsQ0FBQyxTQUFTLENBQUMsQ0FBQTtnQkFDckMsQ0FBQztnQkFBQyxJQUFJLENBQUMsQ0FBQztvQkFDSixZQUFZLENBQUMsU0FBUyxDQUFDLFNBQVMsQ0FBQyxTQUFTLEVBQUUsU0FBUyxDQUFDLE9BQU8sQ0FBQyxDQUFBO2dCQUNsRSxDQUFDO1lBQ0wsQ0FBQyxDQUFDLENBQUE7WUFFRixZQUFZLENBQUMsTUFBTSxDQUFDLGNBQWMsQ0FBQyxDQUFBO1FBQ3ZDLENBQUM7UUFBQyxJQUFJLENBQUMsQ0FBQztZQUNKLE9BQU8sQ0FBQyxJQUFJLENBQUMsK0RBQStELENBQUMsQ0FBQTtZQUM3RSxFQUFFLENBQUMsSUFBSSxFQUFFLElBQUksQ0FBQyxDQUFBO1FBQ2xCLENBQUM7UUFBQSxDQUFDO0lBQ04sQ0FBQyxDQUFBO0lBRUQsSUFBSSxLQUFLLEdBQUcsVUFBVSxFQUFFO1FBQ3BCLEVBQUUsRUFBRSxDQUFBO0lBQ1IsQ0FBQyxDQUFBLENBQUMsc0NBQXNDO0lBRXhDLE1BQU0sQ0FBQyxPQUFPLENBQUMsUUFBUSxDQUFDLEdBQUcsQ0FBQyxPQUFPLEVBQUUsS0FBSyxDQUFDLENBQUEsQ0FBQyw2RUFBNkU7QUFDN0gsQ0FBQyxDQUFBO0FBRUQsaUJBQVMsVUFBVSxDQUFBIn0=
|
9
dist/gulpbrowser.plugins.d.ts
vendored
9
dist/gulpbrowser.plugins.d.ts
vendored
@ -1,5 +1,4 @@
|
|||||||
import "typings-global";
|
import 'typings-global';
|
||||||
export import beautylog = require("beautylog");
|
export import through2 = require('through2');
|
||||||
export import through2 = require("through2");
|
export import path = require('path');
|
||||||
export import path = require("path");
|
export import browserify = require('browserify');
|
||||||
export import browserify = require("browserify");
|
|
||||||
|
3
dist/gulpbrowser.plugins.js
vendored
3
dist/gulpbrowser.plugins.js
vendored
@ -1,7 +1,6 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
require("typings-global");
|
require("typings-global");
|
||||||
exports.beautylog = require("beautylog");
|
|
||||||
exports.through2 = require("through2");
|
exports.through2 = require("through2");
|
||||||
exports.path = require("path");
|
exports.path = require("path");
|
||||||
exports.browserify = require("browserify");
|
exports.browserify = require("browserify");
|
||||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZ3VscGJyb3dzZXIucGx1Z2lucy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL2d1bHBicm93c2VyLnBsdWdpbnMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLFFBQU8sZ0JBQWdCLENBQUMsQ0FBQTtBQUNWLGlCQUFTLFdBQVcsV0FBVyxDQUFDLENBQUM7QUFDakMsZ0JBQVEsV0FBVyxVQUFVLENBQUMsQ0FBQztBQUMvQixZQUFJLFdBQVcsTUFBTSxDQUFDLENBQUM7QUFDdkIsa0JBQVUsV0FBVyxZQUFZLENBQUMsQ0FBQyJ9
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZ3VscGJyb3dzZXIucGx1Z2lucy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL2d1bHBicm93c2VyLnBsdWdpbnMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLDBCQUF1QjtBQUN2Qix1Q0FBNEM7QUFDNUMsK0JBQW9DO0FBQ3BDLDJDQUFnRCJ9
|
2
dist/index.js
vendored
2
dist/index.js
vendored
@ -1,3 +1,3 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
exports.browserify = require("./gulpbrowser.browserify");
|
exports.browserify = require("./gulpbrowser.browserify");
|
||||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQWMsa0JBQVUsV0FBVywwQkFBMEIsQ0FBQyxDQUFDIn0=
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEseURBQStEIn0=
|
27
package.json
27
package.json
@ -3,6 +3,7 @@
|
|||||||
"version": "3.0.2",
|
"version": "3.0.2",
|
||||||
"description": "browserify and other goodies for gulp",
|
"description": "browserify and other goodies for gulp",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
|
"typings": "dist/index.d.ts",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "(npmts)",
|
"test": "(npmts)",
|
||||||
"reinstall": "(rm -r node_modules && npm install)",
|
"reinstall": "(rm -r node_modules && npm install)",
|
||||||
@ -25,20 +26,24 @@
|
|||||||
},
|
},
|
||||||
"homepage": "https://gitlab.com/pushrocks/gulp-browser",
|
"homepage": "https://gitlab.com/pushrocks/gulp-browser",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@types/browserify": "^12.0.29",
|
"@types/browserify": "^12.0.30",
|
||||||
"@types/through2": "^0.0.28",
|
"@types/q": "0.0.32",
|
||||||
"beautylog": "^5.0.18",
|
"@types/through2": "^2.0.32",
|
||||||
"browserify": "^13.1.0",
|
"browserify": "^13.1.1",
|
||||||
"through2": "^2.0.1",
|
"q": "^1.4.1",
|
||||||
"typings-global": "^1.0.6"
|
"through2": "^2.0.3",
|
||||||
|
"typings-global": "^1.0.14"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"babel-preset-es2015": "^6.9.0",
|
"@types/gulp": "^3.8.32",
|
||||||
|
"@types/should": "^8.1.30",
|
||||||
|
"babel-preset-es2015": "^6.18.0",
|
||||||
"babelify": "^7.3.0",
|
"babelify": "^7.3.0",
|
||||||
|
"beautylog": "^6.0.0",
|
||||||
"gulp": "^3.9.1",
|
"gulp": "^3.9.1",
|
||||||
"gulp-function": "^1.3.6",
|
"gulp-function": "^2.2.3",
|
||||||
"npmts-g": "^5.2.6",
|
"npmts-g": "^5.2.10",
|
||||||
"should": "^10.0.0",
|
"should": "^11.1.2",
|
||||||
"typings-test": "^1.0.1"
|
"typings-test": "^1.0.3"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
3
test/test.d.ts
vendored
3
test/test.d.ts
vendored
@ -1,2 +1 @@
|
|||||||
import "typings-test";
|
import 'typings-test';
|
||||||
import "should";
|
|
||||||
|
65
test/test.js
65
test/test.js
@ -1,55 +1,56 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
require("typings-test");
|
require("typings-test");
|
||||||
let plugins = {
|
const gulp = require("gulp");
|
||||||
beautylog: require("beautylog"),
|
const gulpBrowser = require("../dist/index.js");
|
||||||
gulp: require("gulp"),
|
const gulpFunction = require("gulp-function");
|
||||||
gulpBrowser: require("../dist/index.js"),
|
const q = require("q");
|
||||||
gulpFunction: require("gulp-function")
|
describe('gulpBrowser', function () {
|
||||||
};
|
describe('.browserify', function () {
|
||||||
require("should");
|
it('should run through smoothly', function (done) {
|
||||||
describe("gulpBrowser", function () {
|
|
||||||
describe(".browserify", function () {
|
|
||||||
it("should run through smoothly", function (done) {
|
|
||||||
this.timeout(30000);
|
this.timeout(30000);
|
||||||
let stream = plugins.gulp.src('./test/testBrowserifyNormal.js')
|
let stream = gulp.src('./test/testBrowserifyNormal.js')
|
||||||
.pipe(plugins.gulpBrowser.browserify())
|
.pipe(gulpBrowser.browserify())
|
||||||
.pipe(plugins.gulp.dest("./test/result/"))
|
.pipe(gulp.dest('./test/result/'))
|
||||||
.pipe(plugins.gulpFunction(done));
|
.pipe(gulpFunction.atEnd(() => {
|
||||||
|
let done2 = q.defer();
|
||||||
|
done();
|
||||||
|
done2.resolve();
|
||||||
|
return done2.promise;
|
||||||
|
}));
|
||||||
});
|
});
|
||||||
it("should throw an error, when a module is not found", function (done) {
|
it('should throw an error, when a module is not found', function (done) {
|
||||||
let d = require('domain').create();
|
let d = require('domain').create();
|
||||||
let doneCalled = false;
|
let doneCalled = false;
|
||||||
d.on("error", function (error) {
|
d.on('error', function (error) {
|
||||||
console.log(error.message);
|
|
||||||
if (!doneCalled) {
|
if (!doneCalled) {
|
||||||
done();
|
done();
|
||||||
doneCalled = true;
|
doneCalled = true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
d.run(function () {
|
d.run(function () {
|
||||||
let stream = plugins.gulp.src("./test/testBrowserifyError.js")
|
let stream = gulp.src('./test/testBrowserifyError.js')
|
||||||
.pipe(plugins.gulpBrowser.browserify());
|
.pipe(gulpBrowser.browserify());
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
it("should run through with an empty file", function (done) {
|
it('should run through with an empty file', function (done) {
|
||||||
let stream = plugins.gulp.src('./test/testBrowserifyEmpty.js')
|
let stream = gulp.src('./test/testBrowserifyEmpty.js')
|
||||||
.pipe(plugins.gulpBrowser.browserify())
|
.pipe(gulpBrowser.browserify())
|
||||||
.pipe(plugins.gulp.dest("./test/result/"))
|
.pipe(gulp.dest('./test/result/'))
|
||||||
.pipe(plugins.gulpFunction(done));
|
.pipe(gulpFunction.atEnd(done));
|
||||||
});
|
});
|
||||||
it("should run through work with transforms", function (done) {
|
it('should run through work with transforms', function (done) {
|
||||||
this.timeout(30000);
|
this.timeout(30000);
|
||||||
let transforms = [
|
let transforms = [
|
||||||
{
|
{
|
||||||
transform: "babelify",
|
transform: 'babelify',
|
||||||
options: { presets: ["es2015"] }
|
options: { presets: ['es2015'] }
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
let stream = plugins.gulp.src('./test/testBrowserifyNormal.js')
|
let stream = gulp.src('./test/testBrowserifyNormal.js')
|
||||||
.pipe(plugins.gulpBrowser.browserify(transforms))
|
.pipe(gulpBrowser.browserify(transforms))
|
||||||
.pipe(plugins.gulp.dest("./test/result/"))
|
.pipe(gulp.dest('./test/result/'))
|
||||||
.pipe(plugins.gulpFunction(done));
|
.pipe(gulpFunction.atEnd(done));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGVzdC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbInRlc3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLFFBQU8sY0FDUCxDQUFDLENBRG9CO0FBQ3JCLElBQUksT0FBTyxHQUFHO0lBQ1YsU0FBUyxFQUFFLE9BQU8sQ0FBQyxXQUFXLENBQUM7SUFDL0IsSUFBSSxFQUFFLE9BQU8sQ0FBQyxNQUFNLENBQUM7SUFDckIsV0FBVyxFQUFFLE9BQU8sQ0FBQyxrQkFBa0IsQ0FBQztJQUN4QyxZQUFZLEVBQUUsT0FBTyxDQUFDLGVBQWUsQ0FBQztDQUN6QyxDQUFDO0FBQ0YsUUFBTyxRQUFRLENBQUMsQ0FBQTtBQUdoQixRQUFRLENBQUMsYUFBYSxFQUFFO0lBQ3BCLFFBQVEsQ0FBQyxhQUFhLEVBQUU7UUFDcEIsRUFBRSxDQUFDLDZCQUE2QixFQUFFLFVBQVUsSUFBSTtZQUM1QyxJQUFJLENBQUMsT0FBTyxDQUFDLEtBQUssQ0FBQyxDQUFDO1lBQ3BCLElBQUksTUFBTSxHQUFHLE9BQU8sQ0FBQyxJQUFJLENBQUMsR0FBRyxDQUFDLGdDQUFnQyxDQUFDO2lCQUMxRCxJQUFJLENBQUMsT0FBTyxDQUFDLFdBQVcsQ0FBQyxVQUFVLEVBQUUsQ0FB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UNsRCxJQUFJLENBQUMsV0FBVyxDQUFDLFVBQVUsQ0FBQyxVQUFVLENBQUMsQ0FBQztpQkFDeEMsSUFBSSxDQUFDLElBQUksQ0FBQyxJQUFJLENBQUMsZ0JBQWdCLENBQUMsQ0FBQztpQkFDakMsSUFBSSxDQUFDLFlBQVksQ0FBQyxLQUFLLENBQUMsSUFBSSxDQUFDLENBQUMsQ0FBQTtRQUN2QyxDQUFDLENBQUMsQ0FBQTtJQUNOLENBQUMsQ0FBQyxDQUFBO0FBQ04sQ0FBQyxDQUFDLENBQUEifQ==
|
99
test/test.ts
99
test/test.ts
@ -1,57 +1,62 @@
|
|||||||
import "typings-test"
|
import 'typings-test'
|
||||||
let plugins = {
|
|
||||||
beautylog: require("beautylog"),
|
import * as beautylog from 'beautylog'
|
||||||
gulp: require("gulp"),
|
import * as gulp from 'gulp'
|
||||||
gulpBrowser: require("../dist/index.js"),
|
import * as gulpBrowser from '../dist/index.js'
|
||||||
gulpFunction: require("gulp-function")
|
import * as gulpFunction from 'gulp-function'
|
||||||
};
|
|
||||||
import "should";
|
import * as should from 'should'
|
||||||
|
import * as q from 'q'
|
||||||
|
|
||||||
|
|
||||||
describe("gulpBrowser", function () {
|
describe('gulpBrowser', function () {
|
||||||
describe(".browserify", function () {
|
describe('.browserify', function () {
|
||||||
it("should run through smoothly", function (done) {
|
it('should run through smoothly', function (done) {
|
||||||
this.timeout(30000);
|
this.timeout(30000)
|
||||||
let stream = plugins.gulp.src('./test/testBrowserifyNormal.js')
|
let stream = gulp.src('./test/testBrowserifyNormal.js')
|
||||||
.pipe(plugins.gulpBrowser.browserify())
|
.pipe(gulpBrowser.browserify())
|
||||||
.pipe(plugins.gulp.dest("./test/result/"))
|
.pipe(gulp.dest('./test/result/'))
|
||||||
.pipe(plugins.gulpFunction(done));
|
.pipe(gulpFunction.atEnd(() => {
|
||||||
});
|
let done2 = q.defer()
|
||||||
|
done()
|
||||||
|
done2.resolve()
|
||||||
|
return done2.promise
|
||||||
|
}))
|
||||||
|
})
|
||||||
|
|
||||||
it("should throw an error, when a module is not found", function (done) {
|
it('should throw an error, when a module is not found', function (done) {
|
||||||
let d = require('domain').create();
|
let d = require('domain').create()
|
||||||
let doneCalled = false
|
let doneCalled = false
|
||||||
d.on("error",function(error){
|
d.on('error',function(error){
|
||||||
console.log(error.message)
|
if (!doneCalled) {
|
||||||
if(!doneCalled){
|
done()
|
||||||
done();
|
doneCalled = true
|
||||||
doneCalled = true;
|
|
||||||
}
|
}
|
||||||
});
|
})
|
||||||
d.run(function() {
|
d.run(function() {
|
||||||
let stream = plugins.gulp.src("./test/testBrowserifyError.js")
|
let stream = gulp.src('./test/testBrowserifyError.js')
|
||||||
.pipe(plugins.gulpBrowser.browserify());
|
.pipe(gulpBrowser.browserify())
|
||||||
});
|
})
|
||||||
});
|
})
|
||||||
|
|
||||||
it("should run through with an empty file", function (done) {
|
it('should run through with an empty file', function (done) {
|
||||||
let stream = plugins.gulp.src('./test/testBrowserifyEmpty.js')
|
let stream = gulp.src('./test/testBrowserifyEmpty.js')
|
||||||
.pipe(plugins.gulpBrowser.browserify())
|
.pipe(gulpBrowser.browserify())
|
||||||
.pipe(plugins.gulp.dest("./test/result/"))
|
.pipe(gulp.dest('./test/result/'))
|
||||||
.pipe(plugins.gulpFunction(done));
|
.pipe(gulpFunction.atEnd(done))
|
||||||
});
|
})
|
||||||
it("should run through work with transforms", function (done) {
|
it('should run through work with transforms', function (done) {
|
||||||
this.timeout(30000);
|
this.timeout(30000)
|
||||||
let transforms = [
|
let transforms = [
|
||||||
{
|
{
|
||||||
transform: "babelify",
|
transform: 'babelify',
|
||||||
options: {presets: ["es2015"]}
|
options: {presets: ['es2015']}
|
||||||
}
|
}
|
||||||
];
|
]
|
||||||
let stream = plugins.gulp.src('./test/testBrowserifyNormal.js')
|
let stream = gulp.src('./test/testBrowserifyNormal.js')
|
||||||
.pipe(plugins.gulpBrowser.browserify(transforms))
|
.pipe(gulpBrowser.browserify(transforms))
|
||||||
.pipe(plugins.gulp.dest("./test/result/"))
|
.pipe(gulp.dest('./test/result/'))
|
||||||
.pipe(plugins.gulpFunction(done));
|
.pipe(gulpFunction.atEnd(done))
|
||||||
});
|
})
|
||||||
});
|
})
|
||||||
});
|
})
|
||||||
|
@ -1,48 +1,49 @@
|
|||||||
import plugins = require("./gulpbrowser.plugins");
|
import * as stream from 'stream'
|
||||||
|
import plugins = require('./gulpbrowser.plugins')
|
||||||
|
import * as q from 'q'
|
||||||
|
|
||||||
|
let browserify = function (transforms = []) {
|
||||||
let browserify = function(transforms = []) {
|
|
||||||
|
|
||||||
if (!Array.isArray(transforms)) {
|
if (!Array.isArray(transforms)) {
|
||||||
transforms = [transforms];
|
transforms = [transforms]
|
||||||
}
|
}
|
||||||
|
|
||||||
let forEach = function(file, enc, cb){ // do this with every chunk (file in gulp terms)
|
let forEach = function (file, enc, cb) { // do this with every chunk (file in gulp terms)
|
||||||
|
|
||||||
let bundleCallback = function(err, bufferedContent) { // our bundle callback for when browserify is finished
|
let bundleCallback = function (err, bufferedContent) { // our bundle callback for when browserify is finished
|
||||||
if (Buffer.isBuffer(bufferedContent)){
|
if (Buffer.isBuffer(bufferedContent)) {
|
||||||
file.contents = bufferedContent;
|
file.contents = bufferedContent
|
||||||
} else {
|
} else {
|
||||||
plugins.beautylog.error("gulp-browser: .browserify() " + err.message);
|
console.log('gulp-browser: .browserify() ' + err.message)
|
||||||
cb(new Error(err.message),file);
|
cb(new Error(err.message), file)
|
||||||
return;
|
return
|
||||||
|
}
|
||||||
|
cb(null, file)
|
||||||
}
|
}
|
||||||
cb(null,file);
|
|
||||||
};
|
|
||||||
|
|
||||||
if(file.contents.length > 0){
|
if (file.contents.length > 0) {
|
||||||
let browserified = plugins.browserify(file, { basedir: file.base });
|
let browserified = plugins.browserify(file, { basedir: file.base })
|
||||||
|
|
||||||
transforms.forEach(function (transform) {
|
transforms.forEach(function (transform) {
|
||||||
if (typeof transform === 'function') {
|
if (typeof transform === 'function') {
|
||||||
browserified.transform(transform);
|
browserified.transform(transform)
|
||||||
} else {
|
} else {
|
||||||
browserified.transform(transform.transform, transform.options);
|
browserified.transform(transform.transform, transform.options)
|
||||||
}
|
}
|
||||||
});
|
})
|
||||||
|
|
||||||
browserified.bundle(bundleCallback);
|
browserified.bundle(bundleCallback)
|
||||||
} else {
|
} else {
|
||||||
plugins.beautylog.warn("gulp-browser: .browserify() file.contents appears to be empty");
|
console.warn('gulp-browser: .browserify() file.contents appears to be empty')
|
||||||
cb(null,file);
|
cb(null, file)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
let atEnd = function(cb){
|
let atEnd = function (cb) {
|
||||||
cb();
|
cb()
|
||||||
} // no need to clean up after ourselves
|
} // no need to clean up after ourselves
|
||||||
|
|
||||||
return plugins.through2.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;
|
export = browserify
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
import "typings-global";
|
import 'typings-global'
|
||||||
export import beautylog = require("beautylog");
|
export import through2 = require('through2')
|
||||||
export import through2 = require("through2");
|
export import path = require('path')
|
||||||
export import path = require("path");
|
export import browserify = require('browserify')
|
||||||
export import browserify = require("browserify");
|
|
||||||
|
3
tslint.json
Normal file
3
tslint.json
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"extends": "tslint-config-standard"
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user