Compare commits

...

110 Commits

Author SHA1 Message Date
31f21c7dec 3.0.11 2018-03-16 10:47:10 +01:00
a96db2e036 update dependencies 2018-03-16 10:47:06 +01:00
18e2a32b8e 3.0.10 2018-03-16 10:36:37 +01:00
6784784f86 update dependencies 2018-03-16 10:36:31 +01:00
6996193568 3.0.9 2018-03-16 10:31:06 +01:00
ebc07f4c5b update dependencies 2018-03-16 10:31:01 +01:00
088a5e6fe5 3.0.8 2018-03-15 01:21:25 +01:00
04345d1691 fix typo 2018-03-15 01:21:13 +01:00
ab6870a193 3.0.7 2018-03-15 00:33:50 +01:00
d1486c2bef update to latest Standards 2018-03-15 00:33:43 +01:00
87e684aa7b 3.0.6 2017-07-07 18:35:25 +02:00
9c31773f31 update docs 2017-07-07 18:35:20 +02:00
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
5fe7d563d0 1.0.9 2016-02-09 20:44:35 +01:00
29534a3c6d update npmts 2016-02-09 20:44:10 +01:00
e5cbefd195 updated npmts 2016-02-09 17:11:09 +01:00
83ddb95968 cleanup 2016-02-09 17:06:26 +01:00
7afda4e508 add code coverage badge 2016-02-09 17:04:11 +01:00
f459bd5537 update test 2016-02-09 16:51:06 +01:00
53dba94a78 1.0.8 2016-02-09 16:44:27 +01:00
47b5d718ee some finetuning 2016-02-09 16:44:23 +01:00
e0902b9f6c now running coverage 2016-02-09 16:39:36 +01:00
5ee39fc04d 1.0.7 2016-02-02 15:23:35 +01:00
40254e394e updated deps 2016-02-02 15:23:25 +01:00
9306dcf0a1 bump timeout time for travis 2016-02-01 03:55:50 +01:00
9b6609a2e5 1.0.6 2016-02-01 03:39:11 +01:00
943fcf8634 switch to gulpFunction 2016-02-01 03:38:58 +01:00
6de689a766 1.0.5 2016-02-01 03:11:17 +01:00
774269da57 integrate mocha 2016-02-01 03:10:58 +01:00
6a884cda78 clean up 2016-02-01 02:28:43 +01:00
3e46c8c927 Merge branch 'enigmamarketing-master' 2016-02-01 00:08:11 +01:00
31d1fae5a2 merge PR 2016-02-01 00:07:53 +01:00
95e874c8e8 update npmts and switch to npmts version 2.x.x 2016-02-01 00:04:05 +01:00
6594932cbd pin beautylog version 2016-01-31 17:45:16 +01:00
9457f3ce8a 1.0.4 2016-01-31 17:41:40 +01:00
eb636603ab update beautylog dependency, fixes #13 2016-01-31 17:40:51 +01:00
6e2797cd65 1.0.3 2016-01-28 18:29:01 +01:00
8de47822e4 1.0.2 2016-01-28 18:28:33 +01:00
cd867e1d6c add About to Readme 2016-01-25 05:09:24 +01:00
d0445361eb 1.0.1 2016-01-25 02:13:17 +01:00
d580d486fa update npm keywords 2016-01-25 02:13:06 +01:00
8053a34581 update .travis.yml to use lossless 2016-01-25 00:56:04 +01:00
2b6a95a45a 1.0.0 2016-01-25 00:42:17 +01:00
c4e8ce846d updated to use npmts, removed pushrocks dependency, bumped version major 2016-01-25 00:42:11 +01:00
462d11da27 Bass base directory through to browserify. 2016-01-04 10:41:20 +00:00
92ad03fc65 0.0.18 2015-12-06 22:07:59 +01:00
50dd2b193a 0.0.17 2015-12-06 22:07:25 +01:00
fb3e693f2a updated dependencies 2015-12-06 22:07:18 +01:00
92841c1715 fix comment typo 2015-12-05 22:59:22 +01:00
32 changed files with 3513 additions and 2358 deletions

12
.gitignore vendored
View File

@ -1,8 +1,6 @@
node_modules/ node_modules/
.settings/ npm-debug.log
.idea/ test/result/
coverage/
ts/*.js pages/
ts/*.js.map public
test/result/

95
.gitlab-ci.yml Normal file
View File

@ -0,0 +1,95 @@
# gitzone standard
image: hosttoday/ht-docker-node:npmci
cache:
paths:
- .yarn/
key: "$CI_BUILD_STAGE"
stages:
- security
- test
- release
- trigger
- pages
mirror:
stage: security
script:
- npmci git mirror
tags:
- docker
snyk:
stage: security
script:
- npmci command yarn global add snyk
- npmci command yarn install --ignore-scripts
- npmci command snyk test
tags:
- docker
testLEGACY:
stage: test
script:
- npmci node install legacy
- npmci npm install
- npmci npm test
coverage: /\d+.?\d+?\%\s*coverage/
tags:
- docker
allow_failure: true
testLTS:
stage: test
script:
- npmci node install lts
- npmci npm install
- npmci npm test
coverage: /\d+.?\d+?\%\s*coverage/
tags:
- docker
testSTABLE:
stage: test
script:
- npmci node install stable
- npmci npm install
- npmci npm test
coverage: /\d+.?\d+?\%\s*coverage/
tags:
- docker
release:
stage: release
script:
- npmci npm prepare
- npmci npm 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

4
.npmignore Normal file
View File

@ -0,0 +1,4 @@
node_modules
test
ts
coverage/

View File

@ -1,16 +0,0 @@
language: node_js
node_js:
- "4.1"
before_install:
- npm install -g tsd
deploy:
provider: npm
email: npm@smart-coordination.com
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=
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,31 +1,62 @@
# gulp-browser # gulp-browser
browserify and other goodies for gulp browserify and other goodies for gulp
### Build Status/Dependencies ## Availabililty
[![Build Status](https://travis-ci.org/pushrocks/gulp-browser.svg?branch=master)](https://travis-ci.org/pushrocks/gulp-browser)
[![npm](https://pushrocks.gitlab.io/assets/repo-button-npm.svg)](https://www.npmjs.com/package/gulp-browser)
[![git](https://pushrocks.gitlab.io/assets/repo-button-git.svg)](https://GitLab.com/pushrocks/gulp-browser)
[![git](https://pushrocks.gitlab.io/assets/repo-button-mirror.svg)](https://github.com/pushrocks/gulp-browser)
[![docs](https://pushrocks.gitlab.io/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) [![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 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) [![bitHound Code](https://www.bithound.io/github/pushrocks/gulp-browser/badges/code.svg)](https://www.bithound.io/github/pushrocks/gulp-browser)
[![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
### Usage Use TypeScript for best in class instellisense.
gulp-browser is meant to be easy:
#### Browserify: #### Browserify:
```javascript ```javascript
var gulp = require("gulp"); let gulp = require('gulp');
var gulpBrowser = require("gulp-browser"); let gulpBrowser = require('gulp-browser');
gulp.task('gulpBrowserTest',function() { let transforms = [
var stream = gulp.src('./test/*.js') {
.pipe(gulpBrowser.browserify()) transform: 'babelify',
.pipe(gulp.dest("./test/browserifiedJS/")); options: { presets: ['es2015'] }
return stream; }
}); ];
gulp.task('gulpBrowserTest', function() {
var stream = gulp
.src('./test/*.js')
.pipe(gulpBrowser.browserify(transforms)) // gulp.browserify() accepts an optional array of tansforms
.pipe(gulp.dest('./test/browserifiedJS/'));
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. > **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: ### Contributors
[![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) * [Phil Kunz](https://github.com/philkunz)
* [Steffan Donal](https://github.com/SteffanDonal)
For further information read the linked docs at the top of this README.
> MIT licensed | **©** [Lossless GmbH](https://lossless.gmbh)
> | By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy.html)
[![repo-footer](https://pushrocks.gitlab.io/assets/repo-footer.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;

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

@ -0,0 +1,44 @@
"use strict";
const plugins = require("./gulpbrowser.plugins");
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();
};
module.exports = browserify;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZ3VscGJyb3dzZXIuYnJvd3NlcmlmeS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL2d1bHBicm93c2VyLmJyb3dzZXJpZnkudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUNBLGlEQUFrRDtBQUdsRCxJQUFJLFVBQVUsR0FBRyxVQUFTLFVBQVUsR0FBRyxFQUFFO0lBQ3ZDLEVBQUUsQ0FBQyxDQUFDLENBQUMsS0FBSyxDQUFDLE9BQU8sQ0FBQyxVQUFVLENBQUMsQ0FBQyxDQUFDLENBQUM7UUFDL0IsVUFBVSxHQUFHLENBQUMsVUFBVSxDQUFDLENBQUM7SUFDNUIsQ0FBQztJQUVELElBQUksT0FBTyxHQUFHLFVBQVMsSUFBSSxFQUFFLEdBQUcsRUFBRSxFQUFFO1FBQ2xDLGdEQUFnRDtRQUVoRCxJQUFJLGNBQWMsR0FBRyxVQUFTLEdBQUcsRUFBRSxlQUFlO1lBQ2hELHNEQUFzRDtZQUN0RCxFQUFFLENBQUMsQ0FBQyxNQUFNLENBQUMsUUFBUSxDQUFDLGVBQWUsQ0FBQyxDQUFDLENBQUMsQ0FBQztnQkFDckMsSUFBSSxDQUFDLFFBQVEsR0FBRyxlQUFlLENBQUM7WUFDbEMsQ0FBQztZQUFDLElBQUksQ0FBQyxDQUFDO2dCQUNOLE9BQU8sQ0FBQyxHQUFHLENBQUMsOEJBQThCLEdBQUcsR0FBRyxDQUFDLE9BQU8sQ0FBQyxDQUFDO2dCQUMxRCxFQUFFLENBQUMsSUFBSSxLQUFLLENBQUMsR0FBRyxDQUFDLE9BQU8sQ0FBQyxFQUFFLElBQUksQ0FBQyxDQUFDO2dCQUNqQyxNQUFNLENBQUM7WUFDVCxDQUFDO1lBQ0QsRUFBRSxDQUFDLElBQUksRUFBRSxJQUFJLENBQUMsQ0FBQztRQUNqQixDQUFDLENBQUM7UUFFRixFQUFFLENBQUMsQ0FBQyxJQUFJLENBQUMsUUFBUSxDQUFDLE1BQU0sR0FBRyxDQUFDLENBQUMsQ0FBQyxDQUFDO1lBQzdCLElBQUksWUFBWSxHQUFHLE9BQU8sQ0FBQyxVQUFVLENBQUMsSUFBSSxFQUFFLEVBQUUsT0FBTyxFQUFFLElBQUksQ0FBQyxJQUFJLEVBQUUsQ0FBQyxDQUFDO1lBRXBFLFVBQVUsQ0FBQyxPQUFPLENBQUMsVUFBUyxTQUFTO2dCQUNuQyxFQUFFLENBQUMsQ0FBQyxPQUFPLFNBQVMsS0FBSyxVQUFVLENBQUMsQ0FBQyxDQUFDO29CQUNwQyxZQUFZLENBQUMsU0FBUyxDQUFDLFNBQVMsQ0FBQyxDQUFDO2dCQUNwQyxDQUFDO2dCQUFDLElBQUksQ0FBQyxDQUFDO29CQUNOLFlBQVksQ0FBQyxTQUFTLENBQUMsU0FBUyxDQUFDLFNBQVMsRUFBRSxTQUFTLENBQUMsT0FBTyxDQUFDLENBQUM7Z0JBQ2pFLENBQUM7WUFDSCxDQUFDLENBQUMsQ0FBQztZQUVILFlBQVksQ0FBQyxNQUFNLENBQUMsY0FBYyxDQUFDLENBQUM7UUFDdEMsQ0FBQztRQUFDLElBQUksQ0FBQyxDQUFDO1lBQ04sT0FBTyxDQUFDLElBQUksQ0FBQywrREFBK0QsQ0FBQyxDQUFDO1lBQzlFLEVBQUUsQ0FBQyxJQUFJLEVBQUUsSUFBSSxDQUFDLENBQUM7UUFDakIsQ0FBQztJQUNILENBQUMsQ0FBQztJQUVGLElBQUksS0FBSyxHQUFHLFVBQVMsRUFBRTtRQUNyQixFQUFFLEVBQUUsQ0FBQztJQUNQLENBQUMsQ0FBQyxDQUFDLHNDQUFzQztJQUV6QyxNQUFNLENBQUMsT0FBTyxDQUFDLFFBQVEsQ0FBQyxHQUFHLENBQUMsT0FBTyxFQUFFLEtBQUssQ0FBQyxDQUFDLENBQUMsNkVBQTZFO0FBQzVILENBQUMsQ0FBQztBQUVGLGlCQUFTLFVBQVUsQ0FBQyJ9

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

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

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

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

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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLHlEQUErRCJ9

View File

@ -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;

7
npmextra.json Normal file
View File

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

View File

@ -1,10 +1,11 @@
{ {
"name": "gulp-browser", "name": "gulp-browser",
"version": "0.0.16", "version": "3.0.11",
"description": "browserify and other goodies for gulp", "description": "browserify and other goodies for gulp",
"main": "index.js", "main": "dist/index.js",
"typings": "dist/index.d.ts",
"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)",
@ -12,29 +13,36 @@
}, },
"repository": { "repository": {
"type": "git", "type": "git",
"url": "https://github.com/pushrocks/gulp-browser.git" "url": "https://gitlab.com/pushrocks/gulp-browser.git"
}, },
"keywords": [ "keywords": [
"json", "gulpplugin",
"jade", "browserify",
"template" "browser",
"TypeScript",
"typed"
], ],
"author": "Smart Coordination GmbH <office@push.rocks> (https://push.rocks)", "author": "Smart Coordination GmbH <office@push.rocks> (https://push.rocks)",
"license": "MIT", "license": "MIT",
"bugs": { "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": { "dependencies": {
"browserify": "12.0.1", "@types/browserify": "^12.0.32",
"gulp-util": "3.0.7", "@types/through2": "^2.0.33",
"pushrocks": "1.0.23", "browserify": "^16.1.1",
"through2": "2.0.0" "smartq": "^1.1.8",
"through2": "^2.0.3"
}, },
"devDependencies": { "devDependencies": {
"beautylog": "1.0.6", "@types/gulp": "^4.0.4",
"gulp": "3.9.0", "babel-core": "^6.26.0",
"gulp-callfunction": "0.0.10", "babel-preset-es2015": "^6.24.1",
"gulp-typescript": "2.10.0" "babelify": "^8.0.0",
"beautylog": "^6.1.10",
"gulp": "^3.9.1",
"gulp-function": "^2.2.9",
"tapbundle": "^2.0.0"
} }
} }

27
test.js
View File

@ -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']);

74
test/test.ts Normal file
View File

@ -0,0 +1,74 @@
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 '../ts/index';
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

@ -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']);

View File

@ -1,2 +0,0 @@
# How to compile.
Make sure gulp and gulp-taypescript from npm are available. Then run the gulpfile in this directory.

View File

@ -0,0 +1,50 @@
import * as stream from 'stream';
import plugins = require('./gulpbrowser.plugins');
import * as q from 'smartq';
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,3 @@
export import through2 = require('through2');
export import path = require('path');
export import browserify = require('browserify');

View File

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

View File

@ -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)
});
};
}
}

View File

@ -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']);

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,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;
}

File diff suppressed because it is too large Load Diff

2
ts/typings/tsd.d.ts vendored
View File

@ -1,2 +0,0 @@
/// <reference path="node/node.d.ts" />
/// <reference path="browserify/browserify.d.ts" />

3
tslint.json Normal file
View File

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

3137
yarn.lock Normal file

File diff suppressed because it is too large Load Diff