Compare commits
34 Commits
Author | SHA1 | Date | |
---|---|---|---|
01a89ecad1 | |||
213cd764d8 | |||
244048fccb | |||
aee39d4a33 | |||
f5f1d59c79 | |||
895063ec65 | |||
ba29214eea | |||
5fe7d563d0 | |||
29534a3c6d | |||
e5cbefd195 | |||
83ddb95968 | |||
7afda4e508 | |||
f459bd5537 | |||
53dba94a78 | |||
47b5d718ee | |||
e0902b9f6c | |||
5ee39fc04d | |||
40254e394e | |||
9306dcf0a1 | |||
9b6609a2e5 | |||
943fcf8634 | |||
6de689a766 | |||
774269da57 | |||
6a884cda78 | |||
3e46c8c927 | |||
31d1fae5a2 | |||
95e874c8e8 | |||
6594932cbd | |||
9457f3ce8a | |||
eb636603ab | |||
6e2797cd65 | |||
8de47822e4 | |||
cd867e1d6c | |||
462d11da27 |
5
.gitignore
vendored
5
.gitignore
vendored
@ -5,5 +5,10 @@ npm-debug.log
|
||||
|
||||
ts/*.js
|
||||
ts/*.js.map
|
||||
ts/typings/
|
||||
|
||||
test/result/
|
||||
|
||||
coverage/
|
||||
|
||||
docs/
|
@ -1,3 +1,4 @@
|
||||
node_modules
|
||||
test
|
||||
ts
|
||||
coverage/
|
@ -1,8 +1,6 @@
|
||||
language: node_js
|
||||
node_js:
|
||||
- '4.1'
|
||||
before_install:
|
||||
- npm install -g tsd
|
||||
- '4.2.4'
|
||||
deploy:
|
||||
provider: npm
|
||||
email: npm@lossless.digital
|
||||
|
@ -6,7 +6,7 @@ browserify and other goodies for gulp
|
||||
[](https://david-dm.org/pushrocks/gulp-browser)
|
||||
[](https://www.bithound.io/github/pushrocks/gulp-browser/master/dependencies/npm)
|
||||
[](https://www.bithound.io/github/pushrocks/gulp-browser)
|
||||
|
||||
[](https://coveralls.io/github/pushrocks/gulp-browser?branch=master)
|
||||
|
||||
### Usage
|
||||
gulp-browser is meant to be easy:
|
||||
@ -29,3 +29,8 @@ gulp-browser is meant to be easy:
|
||||
### Dev Information:
|
||||
[](https://david-dm.org/pushrocks/gulp-browser#info=devDependencies)
|
||||
[](https://www.bithound.io/github/pushrocks/gulp-browser/master/dependencies/npm)
|
||||
|
||||
### About the authors:
|
||||
[](https://lossless.com/)
|
||||
|
||||
[](https://paypal.me/lossless)
|
20
dist/gulpbrowser.browserify.js
vendored
Normal file
20
dist/gulpbrowser.browserify.js
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
/// <reference path="./typings/main.d.ts" />
|
||||
var plugins = require("./gulpbrowser.plugins");
|
||||
var browserify = function () {
|
||||
return plugins.through.obj(function (file, enc, cb) {
|
||||
var bundleCallback = function (err, bufferedContent) {
|
||||
if (Buffer.isBuffer(bufferedContent)) {
|
||||
file.contents = bufferedContent;
|
||||
}
|
||||
else {
|
||||
plugins.beautylog.error("gulp-browser: .browserify() " + err.message);
|
||||
}
|
||||
cb(null, file);
|
||||
};
|
||||
plugins.browserify(file, { basedir: file.base })
|
||||
.bundle(bundleCallback);
|
||||
});
|
||||
};
|
||||
module.exports = browserify;
|
||||
|
||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImd1bHBicm93c2VyLmJyb3dzZXJpZnkudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsNENBQTRDO0FBQzVDLElBQU8sT0FBTyxXQUFXLHVCQUF1QixDQUFDLENBQUM7QUFDbEQsSUFBSSxVQUFVLEdBQUk7SUFDVixNQUFNLENBQUMsT0FBTyxDQUFDLE9BQU8sQ0FBQyxHQUFHLENBQUMsVUFBQyxJQUFJLEVBQUUsR0FBRyxFQUFFLEVBQUU7UUFDckMsSUFBSSxjQUFjLEdBQUcsVUFBUyxHQUFHLEVBQUUsZUFBZTtZQUM5QyxFQUFFLENBQUMsQ0FBQyxNQUFNLENBQUMsUUFBUSxDQUFDLGVBQWUsQ0FBQyxDQUFDLENBQUEsQ0FBQztnQkFDbEMsSUFBSSxDQUFDLFFBQVEsR0FBRyxlQUFlLENBQUM7WUFDcEMsQ0FBQztZQUFDLElBQ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RDb250ZW50O1xuICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgIHBsdWdpbnMuYmVhdXR5bG9nLmVycm9yKFwiZ3VscC1icm93c2VyOiAuYnJvd3NlcmlmeSgpIFwiICsgZXJyLm1lc3NhZ2UpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBjYihudWxsLGZpbGUpO1xuICAgICAgICAgICAgfTtcbiAgICAgICAgICAgIHBsdWdpbnMuYnJvd3NlcmlmeShmaWxlLCB7IGJhc2VkaXI6IGZpbGUuYmFzZSB9KVxuICAgICAgICAgICAgICAgIC5idW5kbGUoYnVuZGxlQ2FsbGJhY2spXG4gICAgICAgIH0pO1xuIH07XG5cbmV4cG9ydCA9IGJyb3dzZXJpZnk7Il0sInNvdXJjZVJvb3QiOiIvc291cmNlLyJ9
|
11
dist/gulpbrowser.plugins.js
vendored
Normal file
11
dist/gulpbrowser.plugins.js
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
/// <reference path="./typings/main.d.ts" />
|
||||
var plugins = {
|
||||
beautylog: require("beautylog"),
|
||||
through: require("through2"),
|
||||
gutil: require("gulp-util"),
|
||||
path: require("path"),
|
||||
browserify: require("browserify")
|
||||
};
|
||||
module.exports = plugins;
|
||||
|
||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImd1bHBicm93c2VyLnBsdWdpbnMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsNENBQTRDO0FBQzVDLElBQUksT0FBTyxHQUFHO0lBQ1YsU0FBUyxFQUFFLE9BQU8sQ0FBQyxXQUFXLENBQUM7SUFDL0IsT0FBTyxFQUFFLE9BQU8sQ0FBQyxVQUFVLENBQUM7SUFDNUIsS0FBSyxFQUFFLE9BQU8sQ0FBQyxXQUFXLENBQUM7SUFDM0IsSUFBSSxFQUFFLE9BQU8sQ0FBQyxNQUFNLENBQUM7SUFDckIsVUFBVSxFQUFFLE9BQU8sQ0FBQyxZQUFZLENBQUM7Q0FDcEMsQ0FBQztBQUVGLGlCQUFTLE9BQU8sQ0FBQyIsImZpbGUiOiJndWxwYnJvd3Nlci5wbHVnaW5zLmpzIiwic291cmNlc0NvbnRlbnQiOlsiLy8vIDxyZWZlcmVuY2UgcGF0aD1cIi4vdHlwaW5ncy9tYWluLmQudHNcIiAvPlxudmFyIHBsdWdpbnMgPSB7XG4gICAgYmVhdXR5bG9nOiByZXF1aXJlKFwiYmVhdXR5bG9nXCIpLFxuICAgIHRocm91Z2g6IHJlcXVpcmUoXCJ0aHJvdWdoMlwiKSxcbiAgICBndXRpbDogcmVxdWlyZShcImd1bHAtdXRpbFwiKSxcbiAgICBwYXRoOiByZXF1aXJlKFwicGF0aFwiKSxcbiAgICBicm93c2VyaWZ5OiByZXF1aXJlKFwiYnJvd3NlcmlmeVwiKVxufTtcblxuZXhwb3J0ID0gcGx1Z2luczsiXSwic291cmNlUm9vdCI6Ii9zb3VyY2UvIn0=
|
9
dist/index.js
vendored
Normal file
9
dist/index.js
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
/// <reference path="./typings/main.d.ts" />
|
||||
var browserify = require("./gulpbrowser.browserify");
|
||||
//create the return object
|
||||
var gulpBrowser = {
|
||||
browserify: browserify
|
||||
};
|
||||
module.exports = gulpBrowser;
|
||||
|
||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImluZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLDRDQUE0QztBQUU1QyxJQUFPLFVBQVUsV0FBVywwQkFBMEIsQ0FBQyxDQUFDO0FBR3hELDBCQUEwQjtBQUMxQixJQUFJLFdBQVcsR0FBTztJQUNsQixVQUFVLEVBQUUsVUFBVTtDQUN6QixDQUFDO0FBR0YsaUJBQVMsV0FBVyxDQUFDIiwiZmlsZSI6ImluZGV4LmpzIiwic291cmNlc0NvbnRlbnQiOlsiLy8vIDxyZWZlcmVuY2UgcGF0aD1cIi4vdHlwaW5ncy9tYWluLmQudHNcIiAvPlxuXG5pbXBvcnQgYnJvd3NlcmlmeSA9IHJlcXVpcmUoXCIuL2d1bHBicm93c2VyLmJyb3dzZXJpZnlcIik7XG5cblxuLy9jcmVhdGUgdGhlIHJldHVybiBvYmplY3RcbnZhciBndWxwQnJvd3NlcjphbnkgPSB7XG4gICAgYnJvd3NlcmlmeTogYnJvd3NlcmlmeVxufTtcblxuXG5leHBvcnQgPSBndWxwQnJvd3NlcjtcbiJdLCJzb3VyY2VSb290IjoiL3NvdXJjZS8ifQ==
|
12
index.d.ts
vendored
12
index.d.ts
vendored
@ -1,12 +0,0 @@
|
||||
/// <reference path="ts/typings/tsd.d.ts" />
|
||||
declare module GulpBrowserBrowserify {
|
||||
function init(): () => any;
|
||||
}
|
||||
declare var plugins: {
|
||||
beautylog: any;
|
||||
through: any;
|
||||
gutil: any;
|
||||
path: any;
|
||||
browserify: any;
|
||||
};
|
||||
declare var gulpBrowser: any;
|
37
index.js
37
index.js
@ -1,37 +0,0 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
/// <reference path="./index.ts" />
|
||||
var GulpBrowserBrowserify;
|
||||
(function (GulpBrowserBrowserify) {
|
||||
function init() {
|
||||
return function () {
|
||||
return plugins.through.obj(function (file, enc, cb) {
|
||||
var bundleCallback = function (err, bufferedContent) {
|
||||
if (Buffer.isBuffer(bufferedContent)) {
|
||||
file.contents = bufferedContent;
|
||||
}
|
||||
else {
|
||||
plugins.beautylog.error("gulp-browser: .browserify() " + err.message);
|
||||
}
|
||||
cb(null, file);
|
||||
};
|
||||
plugins.browserify(file)
|
||||
.bundle(bundleCallback);
|
||||
});
|
||||
};
|
||||
}
|
||||
GulpBrowserBrowserify.init = init;
|
||||
})(GulpBrowserBrowserify || (GulpBrowserBrowserify = {}));
|
||||
/// <reference path="./typings/tsd.d.ts" />
|
||||
/// <reference path="./modulebrowserify.ts" />
|
||||
var plugins = {
|
||||
beautylog: require("beautylog"),
|
||||
through: require("through2"),
|
||||
gutil: require("gulp-util"),
|
||||
path: require("path"),
|
||||
browserify: require("browserify")
|
||||
};
|
||||
//create the return object
|
||||
var gulpBrowser = {};
|
||||
gulpBrowser.browserify = GulpBrowserBrowserify.init();
|
||||
module.exports = gulpBrowser;
|
4
npmts.json
Normal file
4
npmts.json
Normal file
@ -0,0 +1,4 @@
|
||||
{
|
||||
"mode":"default",
|
||||
"coveralls":true
|
||||
}
|
16
package.json
16
package.json
@ -1,10 +1,10 @@
|
||||
{
|
||||
"name": "gulp-browser",
|
||||
"version": "1.0.1",
|
||||
"version": "1.1.1",
|
||||
"description": "browserify and other goodies for gulp",
|
||||
"main": "index.js",
|
||||
"main": "dist/index.js",
|
||||
"scripts": {
|
||||
"test": "(npmts) && (node test.js)",
|
||||
"test": "(npmts)",
|
||||
"reinstall": "(rm -r node_modules && npm install)",
|
||||
"release": "(git pull origin master && npm version patch && git push origin master && git checkout release && git merge master && git push origin release && git checkout master)",
|
||||
"update": "(git checkout master && git pull origin master && npm install)",
|
||||
@ -25,14 +25,14 @@
|
||||
},
|
||||
"homepage": "https://github.com/pushrocks/gulp-browser",
|
||||
"dependencies": {
|
||||
"beautylog": "3.1.2",
|
||||
"browserify": "13.0.0",
|
||||
"gulp-util": "3.0.7",
|
||||
"through2": "2.0.0"
|
||||
"through2": "2.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"beautylog": "2.0.2",
|
||||
"gulp": "3.9.0",
|
||||
"gulp-callfunction": "0.0.10",
|
||||
"npmts": "^1.0.9"
|
||||
"gulp": "3.9.1",
|
||||
"gulp-function": "1.1.1",
|
||||
"npmts": "^3.3.2"
|
||||
}
|
||||
}
|
||||
|
29
test.js
29
test.js
@ -1,29 +0,0 @@
|
||||
/// <reference path="./typings/tsd.d.ts" />
|
||||
var plugins = {
|
||||
beautylog: require("beautylog"),
|
||||
gulp: require("gulp"),
|
||||
gulpBrowser: require("./index.js"),
|
||||
gulpCallFunction: require("gulp-callfunction")
|
||||
};
|
||||
var pipeWorked = function () {
|
||||
plugins.beautylog.info("Pipe didn't break! Ready for Primetime!");
|
||||
};
|
||||
plugins.beautylog.log('Now trying to browserify a testfile...');
|
||||
plugins.gulp.task('gulpBrowserTest', function (cb) {
|
||||
var stream = plugins.gulp.src('./test/browserifyGulpTest.js')
|
||||
.pipe(plugins.gulpBrowser.browserify())
|
||||
.pipe(plugins.gulp.dest("./test/result/"))
|
||||
.pipe(plugins.gulpCallFunction(pipeWorked));
|
||||
return stream;
|
||||
});
|
||||
plugins.gulp.task('gulpBrowserTestError', function (cb) {
|
||||
var stream = plugins.gulp.src('./test/browserifyGulpTestError.js')
|
||||
.pipe(plugins.gulpBrowser.browserify())
|
||||
.pipe(plugins.gulp.dest("./test/result/"))
|
||||
.pipe(plugins.gulpCallFunction(pipeWorked));
|
||||
return stream;
|
||||
});
|
||||
plugins.gulp.task("default", ['gulpBrowserTest', 'gulpBrowserTestError'], function () {
|
||||
plugins.beautylog.success("Test passed!");
|
||||
});
|
||||
plugins.gulp.start.apply(plugins.gulp, ['default']);
|
24
test/test.js
Normal file
24
test/test.js
Normal file
@ -0,0 +1,24 @@
|
||||
/// <reference path="../ts/typings/main.d.ts" />
|
||||
var plugins = {
|
||||
beautylog: require("beautylog"),
|
||||
gulp: require("gulp"),
|
||||
gulpBrowser: require("../dist/index.js"),
|
||||
gulpFunction: require("gulp-function")
|
||||
};
|
||||
describe("gulpBrowser", function () {
|
||||
describe(".browserify", function () {
|
||||
it("should run through smoothly", function (done) {
|
||||
this.timeout(30000);
|
||||
plugins.gulp.task('gulpBrowserNormal', function (cb) {
|
||||
var stream = plugins.gulp.src('./test/browserifyGulpTest.js')
|
||||
.pipe(plugins.gulpBrowser.browserify())
|
||||
.pipe(plugins.gulp.dest("./test/result/"))
|
||||
.pipe(plugins.gulpFunction(done));
|
||||
return stream;
|
||||
});
|
||||
plugins.gulp.start.apply(plugins.gulp, ['gulpBrowserNormal']);
|
||||
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ZGVzdChcIi4vdGVzdC9yZXN1bHQvXCIpKVxuICAgICAgICAgICAgICAgICAgICAucGlwZShwbHVnaW5zLmd1bHBGdW5jdGlvbihkb25lKSk7XG4gICAgICAgICAgICAgICAgcmV0dXJuIHN0cmVhbTtcbiAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgcGx1Z2lucy5ndWxwLnN0YXJ0LmFwcGx5KHBsdWdpbnMuZ3VscCwgWydndWxwQnJvd3Nlck5vcm1hbCddKTtcbiAgICAgICAgfSk7XG4gICAgfSk7XG59KTtcbiJdLCJzb3VyY2VSb290IjoiL3NvdXJjZS8ifQ==
|
1
test/test.js.map
Normal file
1
test/test.js.map
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"test.js","sourceRoot":"","sources":["test.ts"],"names":[],"mappings":"AAAA,gDAAgD;AAChD,IAAI,OAAO,GAAG;IACV,SAAS,EAAE,OAAO,CAAC,WAAW,CAAC;IAC/B,IAAI,EAAE,OAAO,CAAC,MAAM,CAAC;IACrB,WAAW,EAAE,OAAO,CAAC,kBAAkB,CAAC;IACxC,YAAY,EAAE,OAAO,CAAC,eAAe,CAAC;CACzC,CAAC;AAEF,QAAQ,CAAC,aAAa,EAAC;IACnB,QAAQ,CAAC,aAAa,EAAC;QACnB,EAAE,CAAC,6BAA6B,EAAC,UAAS,IAAI;YAC1C,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;YACpB,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,mBAAmB,EAAC,UAAS,EAAE;gBAC7C,IAAI,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,8BAA8B,CAAC;qBACxD,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,UAAU,EAAE,CAAC;qBACtC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;qBACzC,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC;gBACtC,MAAM,CAAC,MAAM,CAAC;YAClB,CAAC,CAAC,CAAC;YACH,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,mBAAmB,CAAC,CAAC,CAAC;QAClE,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
|
23
test/test.ts
Normal file
23
test/test.ts
Normal file
@ -0,0 +1,23 @@
|
||||
/// <reference path="../ts/typings/main.d.ts" />
|
||||
var plugins = {
|
||||
beautylog: require("beautylog"),
|
||||
gulp: require("gulp"),
|
||||
gulpBrowser: require("../dist/index.js"),
|
||||
gulpFunction: require("gulp-function")
|
||||
};
|
||||
|
||||
describe("gulpBrowser",function(){
|
||||
describe(".browserify",function(){
|
||||
it("should run through smoothly",function(done){
|
||||
this.timeout(30000);
|
||||
plugins.gulp.task('gulpBrowserNormal',function(cb) {
|
||||
var stream = plugins.gulp.src('./test/browserifyGulpTest.js')
|
||||
.pipe(plugins.gulpBrowser.browserify())
|
||||
.pipe(plugins.gulp.dest("./test/result/"))
|
||||
.pipe(plugins.gulpFunction(done));
|
||||
return stream;
|
||||
});
|
||||
plugins.gulp.start.apply(plugins.gulp, ['gulpBrowserNormal']);
|
||||
});
|
||||
});
|
||||
});
|
18
ts/gulpbrowser.browserify.ts
Normal file
18
ts/gulpbrowser.browserify.ts
Normal file
@ -0,0 +1,18 @@
|
||||
/// <reference path="./typings/main.d.ts" />
|
||||
import plugins = require("./gulpbrowser.plugins");
|
||||
let browserify = function() {
|
||||
return plugins.through.obj((file, enc, cb) => { //this is the through object that gets returned by gulpBrowser.browserify();
|
||||
var bundleCallback = function(err, bufferedContent) {
|
||||
if (Buffer.isBuffer(bufferedContent)){
|
||||
file.contents = bufferedContent;
|
||||
} else {
|
||||
plugins.beautylog.error("gulp-browser: .browserify() " + err.message);
|
||||
}
|
||||
cb(null,file);
|
||||
};
|
||||
plugins.browserify(file, { basedir: file.base })
|
||||
.bundle(bundleCallback)
|
||||
});
|
||||
};
|
||||
|
||||
export = browserify;
|
10
ts/gulpbrowser.plugins.ts
Normal file
10
ts/gulpbrowser.plugins.ts
Normal file
@ -0,0 +1,10 @@
|
||||
/// <reference path="./typings/main.d.ts" />
|
||||
var plugins = {
|
||||
beautylog: require("beautylog"),
|
||||
through: require("through2"),
|
||||
gutil: require("gulp-util"),
|
||||
path: require("path"),
|
||||
browserify: require("browserify")
|
||||
};
|
||||
|
||||
export = plugins;
|
18
ts/index.ts
18
ts/index.ts
@ -1,18 +1,12 @@
|
||||
/// <reference path="./typings/tsd.d.ts" />
|
||||
/// <reference path="./modulebrowserify.ts" />
|
||||
/// <reference path="./typings/main.d.ts" />
|
||||
|
||||
var plugins = {
|
||||
beautylog: require("beautylog"),
|
||||
through: require("through2"),
|
||||
gutil: require("gulp-util"),
|
||||
path: require("path"),
|
||||
browserify: require("browserify")
|
||||
};
|
||||
import browserify = require("./gulpbrowser.browserify");
|
||||
|
||||
|
||||
//create the return object
|
||||
var gulpBrowser:any = {};
|
||||
var gulpBrowser:any = {
|
||||
browserify: browserify
|
||||
};
|
||||
|
||||
gulpBrowser.browserify = GulpBrowserBrowserify.init();
|
||||
|
||||
module.exports = gulpBrowser;
|
||||
export = gulpBrowser;
|
||||
|
@ -1,19 +0,0 @@
|
||||
/// <reference path="./index.ts" />
|
||||
module GulpBrowserBrowserify {
|
||||
export function init() {
|
||||
return function() {
|
||||
return plugins.through.obj((file, enc, cb) => { //this is the through object that gets returned by gulpBrowser.browserify();
|
||||
var bundleCallback = function(err, bufferedContent) {
|
||||
if (Buffer.isBuffer(bufferedContent)){
|
||||
file.contents = bufferedContent;
|
||||
} else {
|
||||
plugins.beautylog.error("gulp-browser: .browserify() " + err.message);
|
||||
}
|
||||
cb(null,file);
|
||||
};
|
||||
plugins.browserify(file)
|
||||
.bundle(bundleCallback)
|
||||
});
|
||||
};
|
||||
}
|
||||
}
|
33
ts/test.ts
33
ts/test.ts
@ -1,33 +0,0 @@
|
||||
/// <reference path="./typings/tsd.d.ts" />
|
||||
|
||||
var plugins = {
|
||||
beautylog: require("beautylog"),
|
||||
gulp: require("gulp"),
|
||||
gulpBrowser: require("./index.js"),
|
||||
gulpCallFunction: require("gulp-callfunction")
|
||||
};
|
||||
|
||||
|
||||
var pipeWorked = function() {
|
||||
plugins.beautylog.info("Pipe didn't break! Ready for Primetime!");
|
||||
};
|
||||
|
||||
plugins.beautylog.log('Now trying to browserify a testfile...');
|
||||
plugins.gulp.task('gulpBrowserTest',function(cb) {
|
||||
var stream = plugins.gulp.src('./test/browserifyGulpTest.js')
|
||||
.pipe(plugins.gulpBrowser.browserify())
|
||||
.pipe(plugins.gulp.dest("./test/result/"))
|
||||
.pipe(plugins.gulpCallFunction(pipeWorked));
|
||||
return stream;
|
||||
});
|
||||
plugins.gulp.task('gulpBrowserTestError',function(cb) {
|
||||
var stream = plugins.gulp.src('./test/browserifyGulpTestError.js')
|
||||
.pipe(plugins.gulpBrowser.browserify())
|
||||
.pipe(plugins.gulp.dest("./test/result/"))
|
||||
.pipe(plugins.gulpCallFunction(pipeWorked));
|
||||
return stream;
|
||||
});
|
||||
plugins.gulp.task("default",['gulpBrowserTest','gulpBrowserTestError'],function(){
|
||||
plugins.beautylog.success("Test passed!");
|
||||
});
|
||||
plugins.gulp.start.apply(plugins.gulp, ['default']);
|
7
ts/typings.json
Normal file
7
ts/typings.json
Normal file
@ -0,0 +1,7 @@
|
||||
{
|
||||
"ambientDependencies": {
|
||||
"browserify": "github:DefinitelyTyped/DefinitelyTyped/browserify/browserify.d.ts",
|
||||
"mocha": "github:Bartvds/tsd-deftools/typings/DefinitelyTyped/mocha/mocha.d.ts",
|
||||
"node": "github:DefinitelyTyped/DefinitelyTyped/node/node.d.ts"
|
||||
}
|
||||
}
|
41
ts/typings/browserify/browserify.d.ts
vendored
41
ts/typings/browserify/browserify.d.ts
vendored
@ -1,41 +0,0 @@
|
||||
// Type definitions for Browserify
|
||||
// Project: http://browserify.org/
|
||||
// Definitions by: Andrew Gaspar <https://github.com/AndrewGaspar/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
|
||||
interface BrowserifyObject extends NodeJS.EventEmitter {
|
||||
add(file:string, opts?:any): BrowserifyObject;
|
||||
require(file:string, opts?:{
|
||||
expose: string;
|
||||
}): BrowserifyObject;
|
||||
bundle(opts?:{
|
||||
insertGlobals?: boolean;
|
||||
detectGlobals?: boolean;
|
||||
debug?: boolean;
|
||||
standalone?: string;
|
||||
insertGlobalVars?: any;
|
||||
}, cb?:(err:any, src:any) => void): NodeJS.ReadableStream;
|
||||
|
||||
external(file:string, opts?:any): BrowserifyObject;
|
||||
ignore(file:string, opts?:any): BrowserifyObject;
|
||||
transform(tr:string, opts?:any): BrowserifyObject;
|
||||
transform(tr:Function, opts?:any): BrowserifyObject;
|
||||
plugin(plugin:string, opts?:any): BrowserifyObject;
|
||||
plugin(plugin:Function, opts?:any): BrowserifyObject;
|
||||
}
|
||||
|
||||
interface Browserify {
|
||||
(): BrowserifyObject;
|
||||
(files:string[]): BrowserifyObject;
|
||||
(opts:{
|
||||
entries?: string[];
|
||||
noParse?: string[];
|
||||
}): BrowserifyObject;
|
||||
}
|
||||
|
||||
declare module "browserify" {
|
||||
var browserify: Browserify;
|
||||
export = browserify;
|
||||
}
|
2092
ts/typings/node/node.d.ts
vendored
2092
ts/typings/node/node.d.ts
vendored
File diff suppressed because it is too large
Load Diff
2
ts/typings/tsd.d.ts
vendored
2
ts/typings/tsd.d.ts
vendored
@ -1,2 +0,0 @@
|
||||
/// <reference path="node/node.d.ts" />
|
||||
/// <reference path="browserify/browserify.d.ts" />
|
Reference in New Issue
Block a user