Compare commits

...

62 Commits

Author SHA1 Message Date
c0bb143128 3.0.5 2017-07-07 18:32:40 +02:00
d3069ebf5f update to latest standards 2017-07-07 18:32:37 +02:00
d0e6bbd162 3.0.4 2016-12-23 22:09:57 +01:00
9b27ed9e7f improve README and metadata 2016-12-23 22:09:55 +01:00
93ed4fbbf9 3.0.3 2016-12-13 23:02:10 +01:00
8aa5ce6a5d compiled 2016-12-13 23:02:07 +01:00
2992f54f11 added typings, removed beautylog 2016-12-13 23:01:25 +01:00
c9929963d7 3.0.2 2016-07-26 18:50:11 +02:00
5ea199e470 fix README 2016-07-26 18:50:00 +02:00
e729dd8e6f add node 6 badge 2016-07-26 18:48:06 +02:00
54335338ab 3.0.1 2016-07-26 18:30:44 +02:00
3109585d30 fix gitlab ci 2016-07-26 18:30:39 +02:00
b28b79cae6 3.0.0 2016-07-26 18:15:27 +02:00
a7d0bfc63f now fully es6 2016-07-26 18:15:03 +02:00
f436fffecd 2.1.9 2016-06-03 21:05:08 +02:00
77b5949a81 remove react from transform options 2016-06-03 21:05:04 +02:00
ad9dde6fb6 2.1.8 2016-06-03 20:57:40 +02:00
e928510886 compile 2016-06-03 20:57:34 +02:00
7065094a84 add babelify test and example 2016-06-03 20:57:10 +02:00
7e210d473f 2.1.7 2016-06-03 20:11:27 +02:00
e3aa4cbbcc now using typings-global 2016-06-03 20:11:17 +02:00
4a7ffa1caf 2.1.6 2016-06-03 19:39:06 +02:00
872eef5de8 2.1.5 2016-06-03 19:32:37 +02:00
7d464df932 update dependencies 2016-06-03 19:32:32 +02:00
712000b688 2.1.4 2016-05-13 18:22:12 +00:00
e2ed8c5f4c README fix 2016-05-13 18:22:03 +00:00
245449ee13 2.1.3 2016-05-13 18:20:14 +00:00
7cd695fc92 small TypeScript change 2016-05-13 18:20:07 +00:00
80223dc038 2.1.2 2016-05-13 18:18:53 +00:00
7b1df4148d update README 2016-05-13 18:18:49 +00:00
e81288a9dd 2.1.1 2016-05-13 18:15:31 +00:00
1734a2030b update README 2016-05-13 18:15:16 +00:00
65b96af6a8 2.1.0 2016-05-13 18:05:46 +00:00
eec824e959 2.0.2 2016-05-13 18:05:00 +00:00
d28634a865 compiled 2016-05-13 18:04:41 +00:00
540d9a9b56 Merge pull request #56 from enigmamarketing/master
Add ability to pass through transform plugins to browserify.
2016-05-13 19:55:09 +02:00
65c70eec98 Fix bug where passing an object with transform options causes an exception. 2016-05-13 15:31:24 +01:00
1622715a51 Add ability to pass through transform plugins to browserify. 2016-05-12 11:15:04 +01:00
2d063f1fe4 2.0.1 2016-04-05 01:04:01 +02:00
bc87a24ae8 updated deps 2016-04-05 01:04:01 +02:00
dd2f410fdb 2.0.0 2016-04-05 00:18:31 +02:00
acde823f08 update deps 2016-04-05 00:18:26 +02:00
6edd270a92 1.2.3 2016-04-04 23:08:13 +02:00
be43477dca update deps 2016-04-04 23:08:10 +02:00
03a931a9d3 update deps 2016-04-04 23:05:54 +02:00
f05b790e4d update readme 2016-04-02 23:06:11 +02:00
61dc3347c7 1.2.2 2016-04-02 21:06:41 +02:00
2de34d9928 update npmts to latest version 2016-04-02 21:06:36 +02:00
2c69bdd39c update README 2016-04-01 16:26:47 +02:00
130f8b00d7 update travis.yml 2016-04-01 14:14:42 +00:00
a87263888c 1.2.1 2016-04-01 14:11:30 +00:00
802a348123 update main module export 2016-04-01 14:11:23 +00:00
74bbd71ef4 remove ol tsd.json, now using typings with npmts 2016-04-01 14:00:09 +00:00
86f7e0631b 1.2.0 2016-04-01 13:56:51 +00:00
0657edac50 now handling empty files alright and handling errors better. fixes #48 2016-04-01 13:56:35 +00:00
01a89ecad1 1.1.1 2016-02-26 17:59:19 +01:00
213cd764d8 update reamde 2016-02-26 17:59:16 +01:00
244048fccb 1.1.0 2016-02-26 17:58:18 +01:00
aee39d4a33 1.0.11 2016-02-26 17:58:08 +01:00
f5f1d59c79 update deps 2016-02-26 17:57:53 +01:00
895063ec65 1.0.10 2016-02-09 20:49:16 +01:00
ba29214eea update testscript 2016-02-09 20:49:12 +01:00
30 changed files with 3079 additions and 217 deletions

11
.gitignore vendored
View File

@ -1,12 +1,7 @@
node_modules/
.settings/
.idea/
npm-debug.log
ts/*.js
ts/*.js.map
ts/typings/
test/result/
coverage/
docs/
pages/
public

72
.gitlab-ci.yml Normal file
View File

@ -0,0 +1,72 @@
# gitzone standard
image: hosttoday/ht-docker-node:npmci
cache:
paths:
- .yarn/
key: "$CI_BUILD_STAGE"
stages:
- test
- release
- trigger
- pages
testLEGACY:
stage: test
script:
- npmci test legacy
coverage: /\d+.?\d+?\%\s*coverage/
tags:
- docker
allow_failure: true
testLTS:
stage: test
script:
- npmci test lts
coverage: /\d+.?\d+?\%\s*coverage/
tags:
- docker
testSTABLE:
stage: test
script:
- npmci test stable
coverage: /\d+.?\d+?\%\s*coverage/
tags:
- docker
release:
stage: release
script:
- npmci publish
only:
- tags
tags:
- docker
trigger:
stage: trigger
script:
- npmci trigger
only:
- tags
tags:
- docker
pages:
image: hosttoday/ht-docker-node:npmci
stage: pages
script:
- npmci command yarn global add npmpage
- npmci command npmpage
tags:
- docker
only:
- tags
artifacts:
expire_in: 1 week
paths:
- public
allow_failure: true

View File

@ -1,14 +0,0 @@
language: node_js
node_js:
- '4.2.4'
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=

View File

@ -1,24 +1,41 @@
# gulp-browser
browserify and other goodies for gulp
### Build Status/Dependencies
[![Build Status](https://travis-ci.org/pushrocks/gulp-browser.svg?branch=master)](https://travis-ci.org/pushrocks/gulp-browser)
## Availabililty
[![npm](https://push.rocks/assets/repo-button-npm.svg)](https://www.npmjs.com/package/gulp-browser)
[![git](https://push.rocks/assets/repo-button-git.svg)](https://GitLab.com/pushrocks/gulp-browser)
[![git](https://push.rocks/assets/repo-button-mirror.svg)](https://github.com/pushrocks/gulp-browser)
[![docs](https://push.rocks/assets/repo-button-docs.svg)](https://pushrocks.gitlab.io/gulp-browser/)
## Status for master
[![build status](https://GitLab.com/pushrocks/gulp-browser/badges/master/build.svg)](https://GitLab.com/pushrocks/gulp-browser/commits/master)
[![coverage report](https://GitLab.com/pushrocks/gulp-browser/badges/master/coverage.svg)](https://GitLab.com/pushrocks/gulp-browser/commits/master)
[![npm downloads per month](https://img.shields.io/npm/dm/gulp-browser.svg)](https://www.npmjs.com/package/gulp-browser)
[![Dependency Status](https://david-dm.org/pushrocks/gulp-browser.svg)](https://david-dm.org/pushrocks/gulp-browser)
[![bitHound Dependencies](https://www.bithound.io/github/pushrocks/gulp-browser/badges/dependencies.svg)](https://www.bithound.io/github/pushrocks/gulp-browser/master/dependencies/npm)
[![bitHound Code](https://www.bithound.io/github/pushrocks/gulp-browser/badges/code.svg)](https://www.bithound.io/github/pushrocks/gulp-browser)
[![Coverage Status](https://coveralls.io/repos/github/pushrocks/gulp-browser/badge.svg?branch=master)](https://coveralls.io/github/pushrocks/gulp-browser?branch=master)
[![TypeScript](https://img.shields.io/badge/TypeScript-2.x-blue.svg)](https://nodejs.org/dist/latest-v6.x/docs/api/)
[![node](https://img.shields.io/badge/node->=%206.x.x-blue.svg)](https://nodejs.org/dist/latest-v6.x/docs/api/)
[![JavaScript Style Guide](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](http://standardjs.com/)
### Usage
gulp-browser is meant to be easy:
## Usage
Use TypeScript for best in class instellisense.
#### Browserify:
```javascript
var gulp = require("gulp");
var gulpBrowser = require("gulp-browser");
let gulp = require("gulp");
let gulpBrowser = require("gulp-browser");
let transforms = [
{
transform: "babelify",
options: {presets: ["es2015"]}
}
];
gulp.task('gulpBrowserTest',function() {
var stream = gulp.src('./test/*.js')
.pipe(gulpBrowser.browserify())
.pipe(gulpBrowser.browserify(transforms)) // gulp.browserify() accepts an optional array of tansforms
.pipe(gulp.dest("./test/browserifiedJS/"));
return stream;
});
@ -26,11 +43,8 @@ gulp-browser is meant to be easy:
> **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:
[![devDependency Status](https://david-dm.org/pushrocks/gulp-browser/dev-status.svg)](https://david-dm.org/pushrocks/gulp-browser#info=devDependencies)
[![bitHound Dev Dependencies](https://www.bithound.io/github/pushrocks/gulp-browser/badges/devDependencies.svg)](https://www.bithound.io/github/pushrocks/gulp-browser/master/dependencies/npm)
### Contributors
* [Phil Kunz](https://github.com/philkunz)
* [Steffan Donal](https://github.com/SteffanDonal)
### About the authors:
[![Project Phase](https://mediaserve.lossless.digital/lossless.de/img/createdby_github.svg)](https://lossless.com/)
[![Gitter](https://img.shields.io/badge/Support%20us-PayPal-blue.svg)](https://paypal.me/lossless)
[![npm](https://push.rocks/assets/repo-header.svg)](https://push.rocks)

4
dist/gulpbrowser.browserify.d.ts vendored Normal file
View File

@ -0,0 +1,4 @@
/// <reference types="node" />
import * as stream from 'stream';
declare let browserify: (transforms?: any[]) => stream.Transform;
export = browserify;

43
dist/gulpbrowser.browserify.js vendored Normal file
View File

@ -0,0 +1,43 @@
"use strict";
const plugins = require("./gulpbrowser.plugins");
let browserify = function (transforms = []) {
if (!Array.isArray(transforms)) {
transforms = [transforms];
}
let forEach = function (file, enc, cb) {
let bundleCallback = function (err, bufferedContent) {
if (Buffer.isBuffer(bufferedContent)) {
file.contents = bufferedContent;
}
else {
console.log('gulp-browser: .browserify() ' + err.message);
cb(new Error(err.message), file);
return;
}
cb(null, file);
};
if (file.contents.length > 0) {
let browserified = plugins.browserify(file, { basedir: file.base });
transforms.forEach(function (transform) {
if (typeof transform === 'function') {
browserified.transform(transform);
}
else {
browserified.transform(transform.transform, transform.options);
}
});
browserified.bundle(bundleCallback);
}
else {
console.warn('gulp-browser: .browserify() file.contents appears to be empty');
cb(null, file);
}
;
};
let atEnd = function (cb) {
cb();
}; // no need to clean up after ourselves
return plugins.through2.obj(forEach, atEnd); // this is the through object that gets returned by gulpBrowser.browserify();
};
module.exports = browserify;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZ3VscGJyb3dzZXIuYnJvd3NlcmlmeS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL2d1bHBicm93c2VyLmJyb3dzZXJpZnkudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUNBLGlEQUFpRDtBQUdqRCxJQUFJLFVBQVUsR0FBRyxVQUFVLFVBQVUsR0FBRyxFQUFFO0lBRXRDLEVBQUUsQ0FBQyxDQUFDLENBQUMsS0FBSyxDQUFDLE9BQU8sQ0FBQyxVQUFVLENBQUMsQ0FBQyxDQUFDLENBQUM7UUFDN0IsVUFBVSxHQUFHLENBQUMsVUFBVSxDQUFDLENBQUE7SUFDN0IsQ0FBQztJQUVELElBQUksT0FBTyxHQUFHLFVBQVUsSUFBSSxFQUFFLEdBQUcsRUFBRSxFQUFFO1FBRWpDLElBQUksY0FBYyxHQUFHLFVBQVUsR0FBRyxFQUFFLGVBQWU7WUFDL0MsRUFBRSxDQUFDLENBQUMsTUFBTSxDQUFDLFFBQVEsQ0FBQyxlQUFlLENBQUMsQ0FBQyxDQUFDLENBQUM7Z0JBQ25DLElBQUksQ0FBQyxRQUFRLEdBQUcsZUFBZSxDQUFBO1lBQ25DLENBQUM7WUFBQyxJQUFJLENBQUMsQ0FBQztnQkFDSixPQUFPLENBQUMsR0FBRyxDQUFDLDhCQUE4QixHQUFHLEdBQUcsQ0FBQyxPQUFPLENBQUMsQ0FBQTtnQkFDekQsRUFBRSxDQUFDLElBQUksS0FBSyxDQUFDLEdBQUcsQ0FBQyxPQUFPLENBQUMsRUFBRSxJQUFJLENBQUMsQ0FBQTtnQkFDaEMsTUFBTSxDQUFBO1lBQ1YsQ0FBQztZQUNELEVBQUUsQ0FBQyxJQUFJLEVBQUUsSUFBSSxDQUFDLENBQUE7UUFDbEIsQ0FBQyxDQUFBO1FBRUQsRUFBRSxDQUFDLENBQUMsSUFBSSxDQUFDLFFBQVEsQ0FBQyxNQUFNLEdBQUcsQ0FBQyxDQUFDLENBQUMsQ0FBQztZQUMzQixJQUFJLFlBQVksR0FBRyxPQUFPLENBQUMsVUFBVSxDQUFDLElBQUksRUFBRSxFQUFFLE9BQU8sRUFBRSxJQUFJLENBQUMsSUFBSSxFQUFFLENBQUMsQ0FBQTtZQUVuRSxVQUFVLENBQUMsT0FBTyxDQUFDLFVBQVUsU0FBUztnQkFDbEMsRUFBRSxDQUFDLENBQUMsT0FBTyxTQUFTLEtBQUssVUFBVSxDQUFDLENBQUMsQ0FBQztvQkFDbEMsWUFBWSxDQUFDLFNBQVMsQ0FBQyxTQUFTLENBQUMsQ0FBQTtnQkFDckMsQ0FBQztnQkFBQyxJQUFJLENBQUMsQ0FBQztvQkFDSixZQUFZLENBQUMsU0FBUyxDQUFDLFNBQVMsQ0FBQyxTQUFTLEVBQUUsU0FBUyxDQUFDLE9BQU8sQ0FBQyxDQUFBO2dCQUNsRSxDQUFDO1lBQ0wsQ0FBQyxDQUFDLENBQUE7WUFFRixZQUFZLENBQUMsTUFBTSxDQUFDLGNBQWMsQ0FBQyxDQUFBO1FBQ3ZDLENBQUM7UUFBQyxJQUFJLENBQUMsQ0FBQztZQUNKLE9BQU8sQ0FBQyxJQUFJLENBQUMsK0RBQStELENBQUMsQ0FBQTtZQUM3RSxFQUFFLENBQUMsSUFBSSxFQUFFLElBQUksQ0FBQyxDQUFBO1FBQ2xCLENBQUM7UUFBQSxDQUFDO0lBQ04sQ0FBQyxDQUFBO0lBRUQsSUFBSSxLQUFLLEdBQUcsVUFBVSxFQUFFO1FBQ3BCLEVBQUUsRUFBRSxDQUFBO0lBQ1IsQ0FBQyxDQUFBLENBQUMsc0NBQXNDO0lBRXhDLE1BQU0sQ0FBQyxPQUFPLENBQUMsUUFBUSxDQUFDLEdBQUcsQ0FBQyxPQUFPLEVBQUUsS0FBSyxDQUFDLENBQUEsQ0FBQyw2RUFBNkU7QUFDN0gsQ0FBQyxDQUFBO0FBRUQsaUJBQVMsVUFBVSxDQUFBIn0=

4
dist/gulpbrowser.plugins.d.ts vendored Normal file
View File

@ -0,0 +1,4 @@
import 'typings-global';
export import through2 = require('through2');
export import path = require('path');
export import browserify = require('browserify');

7
dist/gulpbrowser.plugins.js vendored Normal file
View File

@ -0,0 +1,7 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
require("typings-global");
exports.through2 = require("through2");
exports.path = require("path");
exports.browserify = require("browserify");
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZ3VscGJyb3dzZXIucGx1Z2lucy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL2d1bHBicm93c2VyLnBsdWdpbnMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSwwQkFBdUI7QUFDdkIsdUNBQTRDO0FBQzVDLCtCQUFvQztBQUNwQywyQ0FBZ0QifQ==

1
dist/index.d.ts vendored Normal file
View File

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

4
dist/index.js vendored Normal file
View File

@ -0,0 +1,4 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.browserify = require("./gulpbrowser.browserify");
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLHlEQUE4RCJ9

12
index.d.ts vendored
View File

@ -1,12 +0,0 @@
/// <reference path="ts/typings/main.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;

View File

@ -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, { basedir: file.base })
.bundle(bundleCallback);
});
};
}
GulpBrowserBrowserify.init = init;
})(GulpBrowserBrowserify || (GulpBrowserBrowserify = {}));
/// <reference path="./typings/main.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;

7
npmextra.json Normal file
View File

@ -0,0 +1,7 @@
{
"npmci": {
"globalNpmTools": [
"npmts"
]
}
}

View File

@ -1,4 +0,0 @@
{
"mode":"default",
"coveralls":true
}

View File

@ -1,8 +1,9 @@
{
"name": "gulp-browser",
"version": "1.0.9",
"version": "3.0.5",
"description": "browserify and other goodies for gulp",
"main": "index.js",
"main": "dist/index.js",
"typings": "dist/index.d.ts",
"scripts": {
"test": "(npmts)",
"reinstall": "(rm -r node_modules && npm install)",
@ -12,27 +13,38 @@
},
"repository": {
"type": "git",
"url": "https://github.com/pushrocks/gulp-browser.git"
"url": "https://gitlab.com/pushrocks/gulp-browser.git"
},
"keywords": [
"gulpplugin",
"browserify"
"browserify",
"browser",
"TypeScript",
"typed"
],
"author": "Smart Coordination GmbH <office@push.rocks> (https://push.rocks)",
"license": "MIT",
"bugs": {
"url": "https://github.com/pushrocks/gulp-browser/issues"
"url": "https://gitlab.com/pushrocks/gulp-browser/issues"
},
"homepage": "https://github.com/pushrocks/gulp-browser",
"homepage": "https://gitlab.com/pushrocks/gulp-browser",
"dependencies": {
"beautylog": "2.0.7",
"browserify": "13.0.0",
"gulp-util": "3.0.7",
"through2": "2.0.1"
"@types/browserify": "^12.0.32",
"@types/q": "1.0.2",
"@types/through2": "^2.0.33",
"browserify": "^14.4.0",
"q": "^1.5.0",
"smartq": "^1.1.6",
"through2": "^2.0.3",
"typings-global": "^1.0.19"
},
"devDependencies": {
"gulp": "3.9.1",
"gulp-function": "1.0.2",
"npmts": "^2.2.2"
"@types/gulp": "^4.0.4",
"babel-preset-es2015": "^6.24.1",
"babelify": "^7.3.0",
"beautylog": "^6.1.10",
"gulp": "^3.9.1",
"gulp-function": "^2.2.9",
"tapbundle": "^1.1.0"
}
}

7
test/test.d.ts vendored
View File

@ -1,7 +0,0 @@
/// <reference path="ts/typings/main.d.ts" />
declare var plugins: {
beautylog: any;
gulp: any;
gulpBrowser: any;
gulpFunction: any;
};

View File

@ -1,24 +0,0 @@
#!/usr/bin/env node
/// <reference path="./typings/main.d.ts" />
var plugins = {
beautylog: require("beautylog"),
gulp: require("gulp"),
gulpBrowser: require("../index.js"),
gulpFunction: require("gulp-function")
};
describe("gulpBrowser", function () {
describe(".browserify", function () {
it("should run through smoothly", function (done) {
this.timeout(20000);
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']);
});
});
});

66
test/test.ts Normal file
View File

@ -0,0 +1,66 @@
import * as beautylog from 'beautylog'
import * as gulp from 'gulp'
import * as gulpFunction from 'gulp-function'
import * as smartq from 'smartq'
import { expect, tap } from 'tapbundle'
import * as gulpBrowser from '../dist/index.js'
tap.test('should run through smoothly', async () => {
let done = smartq.defer()
let stream = gulp.src('./test/testBrowserifyNormal.js')
.pipe(gulpBrowser.browserify())
.pipe(gulp.dest('./test/result/'))
.pipe(gulpFunction.atEnd(async () => {
done.resolve()
}))
await done.promise
})
tap.test('should throw an error, when a module is not found', async () => {
let done = smartq.defer()
let d = require('domain').create()
let doneCalled = false
d.on('error', function (error) {
if (!doneCalled) {
done.resolve()
doneCalled = true
}
})
d.run(function () {
let stream = gulp.src('./test/testBrowserifyError.js')
.pipe(gulpBrowser.browserify())
})
await done.promise
})
tap.test('should run through with an empty file', async () => {
let done = smartq.defer()
let stream = gulp.src('./test/testBrowserifyEmpty.js')
.pipe(gulpBrowser.browserify())
.pipe(gulp.dest('./test/result/'))
.pipe(gulpFunction.atEnd(async () => {
done.resolve()
}))
await done.promise
})
tap.test('should run through work with transforms', async () => {
let done = smartq.defer()
let transforms = [
{
transform: 'babelify',
options: { presets: [ 'es2015' ] }
}
]
let stream = gulp.src('./test/testBrowserifyNormal.js')
.pipe(gulpBrowser.browserify(transforms))
.pipe(gulp.dest('./test/result/'))
.pipe(gulpFunction.atEnd(async () => {
done.resolve()
}))
await done.promise
})
tap.start()

View File

View File

@ -0,0 +1,49 @@
import * as stream from 'stream'
import plugins = require('./gulpbrowser.plugins')
import * as q from 'q'
let browserify = function (transforms = []) {
if (!Array.isArray(transforms)) {
transforms = [transforms]
}
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
if (Buffer.isBuffer(bufferedContent)) {
file.contents = bufferedContent
} else {
console.log('gulp-browser: .browserify() ' + err.message)
cb(new Error(err.message), file)
return
}
cb(null, file)
}
if (file.contents.length > 0) {
let browserified = plugins.browserify(file, { basedir: file.base })
transforms.forEach(function (transform) {
if (typeof transform === 'function') {
browserified.transform(transform)
} else {
browserified.transform(transform.transform, transform.options)
}
})
browserified.bundle(bundleCallback)
} else {
console.warn('gulp-browser: .browserify() file.contents appears to be empty')
cb(null, file)
};
}
let atEnd = function (cb) {
cb()
} // no need to clean up after ourselves
return plugins.through2.obj(forEach, atEnd) // this is the through object that gets returned by gulpBrowser.browserify();
}
export = browserify

View File

@ -0,0 +1,4 @@
import 'typings-global'
export import through2 = require('through2')
export import path = require('path')
export import browserify = require('browserify')

View File

@ -1,18 +1 @@
/// <reference path="./typings/main.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:any = {};
gulpBrowser.browserify = GulpBrowserBrowserify.init();
module.exports = gulpBrowser;
export import browserify = require("./gulpbrowser.browserify")

View File

@ -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, { basedir: file.base })
.bundle(bundleCallback)
});
};
}
}

View File

@ -1,23 +0,0 @@
/// <reference path="./typings/main.d.ts" />
var plugins = {
beautylog: require("beautylog"),
gulp: require("gulp"),
gulpBrowser: require("../index.js"),
gulpFunction: require("gulp-function")
};
describe("gulpBrowser",function(){
describe(".browserify",function(){
it("should run through smoothly",function(done){
this.timeout(20000);
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']);
});
});
});

View File

@ -1,15 +0,0 @@
{
"version": "v4",
"repo": "borisyankov/DefinitelyTyped",
"ref": "master",
"path": "typings",
"bundle": "typings/tsd.d.ts",
"installed": {
"node/node.d.ts": {
"commit": "3191f6e0088eee07c4d8fd24e4d27a40a60d9eb9"
},
"browserify/browserify.d.ts": {
"commit": "3191f6e0088eee07c4d8fd24e4d27a40a60d9eb9"
}
}
}

View File

@ -1,7 +0,0 @@
{
"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"
}
}

3
tslint.json Normal file
View File

@ -0,0 +1,3 @@
{
"extends": "tslint-config-standard"
}

2756
yarn.lock Normal file

File diff suppressed because it is too large Load Diff