Compare commits
48 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 | |||
d0445361eb | |||
d580d486fa | |||
8053a34581 | |||
2b6a95a45a | |||
c4e8ce846d | |||
462d11da27 | |||
92ad03fc65 | |||
50dd2b193a | |||
fb3e693f2a | |||
92841c1715 | |||
07b6fea447 | |||
809a1f7450 | |||
9e1716cba5 | |||
66ac210e5e | |||
663e8f1984 |
8
.gitignore
vendored
8
.gitignore
vendored
@ -1,8 +1,14 @@
|
|||||||
node_modules/
|
node_modules/
|
||||||
.settings/
|
.settings/
|
||||||
.idea/
|
.idea/
|
||||||
|
npm-debug.log
|
||||||
|
|
||||||
ts/*.js
|
ts/*.js
|
||||||
ts/*.js.map
|
ts/*.js.map
|
||||||
|
ts/typings/
|
||||||
|
|
||||||
test/result/
|
test/result/
|
||||||
|
|
||||||
|
coverage/
|
||||||
|
|
||||||
|
docs/
|
4
.npmignore
Normal file
4
.npmignore
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
node_modules
|
||||||
|
test
|
||||||
|
ts
|
||||||
|
coverage/
|
@ -1,13 +1,11 @@
|
|||||||
language: node_js
|
language: node_js
|
||||||
node_js:
|
node_js:
|
||||||
- "4.1"
|
- '4.2.4'
|
||||||
before_install:
|
|
||||||
- npm install -g tsd
|
|
||||||
deploy:
|
deploy:
|
||||||
provider: npm
|
provider: npm
|
||||||
email: npm@smart-coordination.com
|
email: npm@lossless.digital
|
||||||
api_key:
|
api_key:
|
||||||
secure: G2kV5r0/ZYzNYRxq3eL9in2uuXlE3xj2OAL8q/Xa2GVczMn/hU1FZItfnCYH7wOD1CqeUX1W5J87Fw0iqkfl/6FsTO3h2UpUoTea0mCK/HYj0HlpIudOeXklYfo0HpYqKnhsbR0oB/AkeDldNwBlf3uzyEMu24Bb5VbtWZ8Qmjm7k2CT17ZNX0dJwQ8c1LdsNjYRCUIQrvSFVFypkIwx5WCsWbBzyZSR2e8r7BkuyfdHl7dEN41ULGcq5hTy/x1qKTIS9AY/JbWW/tdzARREsnqUxNiRmtM8BR85BYxRfgFdOO+0FcDBbJJyFC9NHn7FSpbc5kuX/vOEcbpGye7V6rM3D33emKhW8sAER4UaXZjSYJD5LHXrRFm0eexGnSRGmXPvuSt1oa0kuE2w1jTR6ixmL5M4kmcsUQt+OnOha/ImeE1Aa88JKgBBA7K5QIaiCLsJAulZeVvcqpbFD2SH/4L+lOdev9z6cR485x5eHi5ehIeKlRiWoy4ZMydSyMcYQJlvsc2zFgR4QKatz1/iryeti6taJG8FWx4+XWwxQm57sxDrXK3FTsy9uu3wg39iUQJRVhmU52Oyg3obmsa9B3OLVqZFkOEgqy1R9XeJTJHe7ka4MTynRlkjWK7KX9eNCC+tSPMtUf8/bmH+YNS7Y3dQvnNNvvxs3U8XCH/rQ0M=
|
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:
|
on:
|
||||||
tags: true
|
tags: true
|
||||||
repo: pushrocks/gulp-browser
|
repo: pushrocks/gulp-browser
|
||||||
|
17
README.md
17
README.md
@ -4,7 +4,9 @@ browserify and other goodies for gulp
|
|||||||
### Build Status/Dependencies
|
### Build Status/Dependencies
|
||||||
[](https://travis-ci.org/pushrocks/gulp-browser)
|
[](https://travis-ci.org/pushrocks/gulp-browser)
|
||||||
[](https://david-dm.org/pushrocks/gulp-browser)
|
[](https://david-dm.org/pushrocks/gulp-browser)
|
||||||
[](https://david-dm.org/pushrocks/gulp-browser#info=devDependencies)
|
[](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
|
### Usage
|
||||||
gulp-browser is meant to be easy:
|
gulp-browser is meant to be easy:
|
||||||
@ -20,4 +22,15 @@ gulp-browser is meant to be easy:
|
|||||||
.pipe(gulp.dest("./test/browserifiedJS/"));
|
.pipe(gulp.dest("./test/browserifiedJS/"));
|
||||||
return stream;
|
return stream;
|
||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
|
||||||
|
> **Note:** Be aware of how gulp.src creates values of file.base and file.path since that is important to the require statements.
|
||||||
|
|
||||||
|
### 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,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImd1bHBicm93c2VyLmJyb3dzZXJpZnkudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsNENBQTRDO0FBQzVDLElBQU8sT0FBTyxXQUFXLHVCQUF1QixDQUFDLENBQUM7QUFDbEQsSUFBSSxVQUFVLEdBQUk7SUFDVixNQUFNLENBQUMsT0FBTyxDQUFDLE9BQU8sQ0FBQyxHQUFHLENBQUMsVUFBQyxJQUFJLEVBQUUsR0FBRyxFQUFFLEVBQUU7UUFDckMsSUFBSSxjQUFjLEdBQ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FyIGJ1bmRsZUNhbGxiYWNrID0gZnVuY3Rpb24oZXJyLCBidWZmZXJlZENvbnRlbnQpIHtcbiAgICAgICAgICAgICAgICBpZiAoQnVmZmVyLmlzQnVmZmVyKGJ1ZmZlcmVkQ29udGVudCkpe1xuICAgICAgICAgICAgICAgICAgICBmaWxlLmNvbnRlbnRzID0gYnVmZmVyZWRDb250ZW50O1xuICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgIHBsdWdpbnMuYmVhdXR5bG9nLmVycm9yKFwiZ3VscC1icm93c2VyOiAuYnJvd3NlcmlmeSgpIFwiICsgZXJyLm1lc3NhZ2UpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBjYihudWxsLGZpbGUpO1xuICAgICAgICAgICAgfTtcbiAgICAgICAgICAgIHBsdWdpbnMuYnJvd3NlcmlmeShmaWxlLCB7IGJhc2VkaXI6IGZpbGUuYmFzZSB9KVxuICAgICAgICAgICAgICAgIC5idW5kbGUoYnVuZGxlQ2FsbGJhY2spXG4gICAgICAgIH0pO1xuIH07XG5cbmV4cG9ydCA9IGJyb3dzZXJpZnk7Il0sInNvdXJjZVJvb3QiOiIvc291cmNlLyJ9
|
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==
|
33
index.js
33
index.js
@ -1,33 +0,0 @@
|
|||||||
/// <reference path="./index.ts" />
|
|
||||||
var GulpBrowserBrowserify;
|
|
||||||
(function (GulpBrowserBrowserify) {
|
|
||||||
function init() {
|
|
||||||
return function () {
|
|
||||||
return through.obj(function (file, enc, cb) {
|
|
||||||
var bundleCallback = function (err, bufferedContent) {
|
|
||||||
if (Buffer.isBuffer(bufferedContent)) {
|
|
||||||
file.contents = bufferedContent;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
pr.beautylog.error("gulp-browser: .browserify() " + err.message);
|
|
||||||
}
|
|
||||||
cb(null, file);
|
|
||||||
};
|
|
||||||
browserify(file)
|
|
||||||
.bundle(bundleCallback);
|
|
||||||
});
|
|
||||||
};
|
|
||||||
}
|
|
||||||
GulpBrowserBrowserify.init = init;
|
|
||||||
})(GulpBrowserBrowserify || (GulpBrowserBrowserify = {}));
|
|
||||||
/// <reference path="./typings/tsd.d.ts" />
|
|
||||||
/// <reference path="./modulebrowserify.ts" />
|
|
||||||
var through = require("through2");
|
|
||||||
var gutil = require("gulp-util");
|
|
||||||
var path = require("path");
|
|
||||||
var browserify = require("browserify");
|
|
||||||
var pr = require("pushrocks");
|
|
||||||
//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
|
||||||
|
}
|
24
package.json
24
package.json
@ -1,10 +1,10 @@
|
|||||||
{
|
{
|
||||||
"name": "gulp-browser",
|
"name": "gulp-browser",
|
||||||
"version": "0.0.15",
|
"version": "1.1.1",
|
||||||
"description": "browserify and other goodies for gulp",
|
"description": "browserify and other goodies for gulp",
|
||||||
"main": "index.js",
|
"main": "dist/index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "(cd ts/compile && node compile.js) && (node test.js)",
|
"test": "(npmts)",
|
||||||
"reinstall": "(rm -r node_modules && npm install)",
|
"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)",
|
"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)",
|
"update": "(git checkout master && git pull origin master && npm install)",
|
||||||
@ -15,9 +15,8 @@
|
|||||||
"url": "https://github.com/pushrocks/gulp-browser.git"
|
"url": "https://github.com/pushrocks/gulp-browser.git"
|
||||||
},
|
},
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"json",
|
"gulpplugin",
|
||||||
"jade",
|
"browserify"
|
||||||
"template"
|
|
||||||
],
|
],
|
||||||
"author": "Smart Coordination GmbH <office@push.rocks> (https://push.rocks)",
|
"author": "Smart Coordination GmbH <office@push.rocks> (https://push.rocks)",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
@ -26,15 +25,14 @@
|
|||||||
},
|
},
|
||||||
"homepage": "https://github.com/pushrocks/gulp-browser",
|
"homepage": "https://github.com/pushrocks/gulp-browser",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"browserify": "12.0.1",
|
"beautylog": "3.1.2",
|
||||||
|
"browserify": "13.0.0",
|
||||||
"gulp-util": "3.0.7",
|
"gulp-util": "3.0.7",
|
||||||
"pushrocks": "1.0.23",
|
"through2": "2.0.1"
|
||||||
"through2": "2.0.0"
|
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"beautylog": "1.0.6",
|
"gulp": "3.9.1",
|
||||||
"gulp": "3.9.0",
|
"gulp-function": "1.1.1",
|
||||||
"gulp-callfunction": "0.0.10",
|
"npmts": "^3.3.2"
|
||||||
"gulp-typescript": "2.10.0"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
27
test.js
27
test.js
@ -1,27 +0,0 @@
|
|||||||
/// <reference path="./typings/tsd.d.ts" />
|
|
||||||
var gulp = require("gulp");
|
|
||||||
var gulpBrowser = require("./index.js");
|
|
||||||
var pr = require("pushrocks");
|
|
||||||
var gulpCallFunction = require("gulp-callfunction");
|
|
||||||
var pipeWorked = function () {
|
|
||||||
pr.beautylog.info("Pipe didn't break! Ready for Primetime!");
|
|
||||||
};
|
|
||||||
pr.beautylog.log('Now trying to browserify a testfile...');
|
|
||||||
gulp.task('gulpBrowserTest', function (cb) {
|
|
||||||
var stream = gulp.src('./test/browserifyGulpTest.js')
|
|
||||||
.pipe(gulpBrowser.browserify())
|
|
||||||
.pipe(gulp.dest("./test/result/"))
|
|
||||||
.pipe(gulpCallFunction(pipeWorked));
|
|
||||||
return stream;
|
|
||||||
});
|
|
||||||
gulp.task('gulpBrowserTestError', function (cb) {
|
|
||||||
var stream = gulp.src('./test/browserifyGulpTestError.js')
|
|
||||||
.pipe(gulpBrowser.browserify())
|
|
||||||
.pipe(gulp.dest("./test/result/"))
|
|
||||||
.pipe(gulpCallFunction(pipeWorked));
|
|
||||||
return stream;
|
|
||||||
});
|
|
||||||
gulp.task("default", ['gulpBrowserTest', 'gulpBrowserTestError'], function () {
|
|
||||||
pr.beautylog.success("Test passed!");
|
|
||||||
});
|
|
||||||
gulp.start.apply(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']);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInRlc3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsZ0RBQWdEO0FBQ2hELElBQUksT0FBTyxHQUFHO0lBQ1YsU0FBUyxFQUFFLE9BQU8sQ0FBQyxXQUFXLENBQUM7SUFDL0IsSUFBSSxFQUFFLE9BQU8sQ0FBQyxNQUFNLENBQUM7SUFD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7XG4gICAgfSk7XG59KTtcbiJdLCJzb3VyY2VSb290IjoiL3NvdXJjZS8ifQ==
|
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']);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
@ -1,27 +0,0 @@
|
|||||||
// import gulp
|
|
||||||
var gulp = require("gulp")
|
|
||||||
var gulpTypescript = require("gulp-typescript");
|
|
||||||
var pr = require("pushrocks");
|
|
||||||
|
|
||||||
gulp.task('compileTS', function() {
|
|
||||||
var stream = gulp.src('../index.ts')
|
|
||||||
.pipe(gulpTypescript({
|
|
||||||
out: "index.js"
|
|
||||||
}))
|
|
||||||
.pipe(gulp.dest("../../"));
|
|
||||||
return stream;
|
|
||||||
});
|
|
||||||
|
|
||||||
gulp.task('compileTestTS', function() {
|
|
||||||
var stream = gulp.src('../test.ts')
|
|
||||||
.pipe(gulpTypescript({
|
|
||||||
out: "test.js"
|
|
||||||
}))
|
|
||||||
.pipe(gulp.dest("../../"));
|
|
||||||
return stream;
|
|
||||||
});
|
|
||||||
|
|
||||||
gulp.task('default',['compileTS','compileTestTS'], function() {
|
|
||||||
pr.beautylog.success('Typescript compiled');
|
|
||||||
});
|
|
||||||
gulp.start.apply(gulp, ['default']);
|
|
@ -1,2 +0,0 @@
|
|||||||
# How to compile.
|
|
||||||
Make sure gulp and gulp-taypescript from npm are available. Then run the gulpfile in this directory.
|
|
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;
|
17
ts/index.ts
17
ts/index.ts
@ -1,15 +1,12 @@
|
|||||||
/// <reference path="./typings/tsd.d.ts" />
|
/// <reference path="./typings/main.d.ts" />
|
||||||
/// <reference path="./modulebrowserify.ts" />
|
|
||||||
|
import browserify = require("./gulpbrowser.browserify");
|
||||||
|
|
||||||
var through = require("through2");
|
|
||||||
var gutil = require("gulp-util");
|
|
||||||
var path = require("path");
|
|
||||||
var browserify = require("browserify");
|
|
||||||
var pr = require("pushrocks");
|
|
||||||
|
|
||||||
//create the return object
|
//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 through.obj((file, enc, cb) => { //this is the trough object that gets returned by gulpBrowser.browserify();
|
|
||||||
var bundleCallback = function(err, bufferedContent) {
|
|
||||||
if (Buffer.isBuffer(bufferedContent)){
|
|
||||||
file.contents = bufferedContent;
|
|
||||||
} else {
|
|
||||||
pr.beautylog.error("gulp-browser: .browserify() " + err.message);
|
|
||||||
}
|
|
||||||
cb(null,file);
|
|
||||||
};
|
|
||||||
browserify(file)
|
|
||||||
.bundle(bundleCallback)
|
|
||||||
});
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
29
ts/test.ts
29
ts/test.ts
@ -1,29 +0,0 @@
|
|||||||
/// <reference path="./typings/tsd.d.ts" />
|
|
||||||
var gulp = require("gulp");
|
|
||||||
var gulpBrowser = require("./index.js");
|
|
||||||
var pr = require("pushrocks");
|
|
||||||
var gulpCallFunction = require("gulp-callfunction");
|
|
||||||
|
|
||||||
var pipeWorked = function() {
|
|
||||||
pr.beautylog.info("Pipe didn't break! Ready for Primetime!");
|
|
||||||
};
|
|
||||||
|
|
||||||
pr.beautylog.log('Now trying to browserify a testfile...');
|
|
||||||
gulp.task('gulpBrowserTest',function(cb) {
|
|
||||||
var stream =gulp.src('./test/browserifyGulpTest.js')
|
|
||||||
.pipe(gulpBrowser.browserify())
|
|
||||||
.pipe(gulp.dest("./test/result/"))
|
|
||||||
.pipe(gulpCallFunction(pipeWorked));
|
|
||||||
return stream;
|
|
||||||
});
|
|
||||||
gulp.task('gulpBrowserTestError',function(cb) {
|
|
||||||
var stream = gulp.src('./test/browserifyGulpTestError.js')
|
|
||||||
.pipe(gulpBrowser.browserify())
|
|
||||||
.pipe(gulp.dest("./test/result/"))
|
|
||||||
.pipe(gulpCallFunction(pipeWorked));
|
|
||||||
return stream;
|
|
||||||
});
|
|
||||||
gulp.task("default",['gulpBrowserTest','gulpBrowserTestError'],function(){
|
|
||||||
pr.beautylog.success("Test passed!");
|
|
||||||
});
|
|
||||||
gulp.start.apply(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