Compare commits
114 Commits
Author | SHA1 | Date | |
---|---|---|---|
f28557c403 | |||
95fac7da7e | |||
0d1493ca2c | |||
de02ccb0f8 | |||
0261ce3c31 | |||
54c655b15a | |||
206896f552 | |||
383e204ae2 | |||
31f21c7dec | |||
a96db2e036 | |||
18e2a32b8e | |||
6784784f86 | |||
6996193568 | |||
ebc07f4c5b | |||
088a5e6fe5 | |||
04345d1691 | |||
ab6870a193 | |||
d1486c2bef | |||
87e684aa7b | |||
9c31773f31 | |||
c0bb143128 | |||
d3069ebf5f | |||
d0e6bbd162 | |||
9b27ed9e7f | |||
93ed4fbbf9 | |||
8aa5ce6a5d | |||
2992f54f11 | |||
c9929963d7 | |||
5ea199e470 | |||
e729dd8e6f | |||
54335338ab | |||
3109585d30 | |||
b28b79cae6 | |||
a7d0bfc63f | |||
f436fffecd | |||
77b5949a81 | |||
ad9dde6fb6 | |||
e928510886 | |||
7065094a84 | |||
7e210d473f | |||
e3aa4cbbcc | |||
4a7ffa1caf | |||
872eef5de8 | |||
7d464df932 | |||
712000b688 | |||
e2ed8c5f4c | |||
245449ee13 | |||
7cd695fc92 | |||
80223dc038 | |||
7b1df4148d | |||
e81288a9dd | |||
1734a2030b | |||
65b96af6a8 | |||
eec824e959 | |||
d28634a865 | |||
540d9a9b56 | |||
65c70eec98 | |||
1622715a51 | |||
2d063f1fe4 | |||
bc87a24ae8 | |||
dd2f410fdb | |||
acde823f08 | |||
6edd270a92 | |||
be43477dca | |||
03a931a9d3 | |||
f05b790e4d | |||
61dc3347c7 | |||
2de34d9928 | |||
2c69bdd39c | |||
130f8b00d7 | |||
a87263888c | |||
802a348123 | |||
74bbd71ef4 | |||
86f7e0631b | |||
0657edac50 | |||
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 |
11
.gitignore
vendored
11
.gitignore
vendored
@ -1,9 +1,6 @@
|
||||
node_modules/
|
||||
.settings/
|
||||
.idea/
|
||||
npm-debug.log
|
||||
|
||||
ts/*.js
|
||||
ts/*.js.map
|
||||
|
||||
test/result/
|
||||
test/result/
|
||||
coverage/
|
||||
pages/
|
||||
public
|
||||
|
150
.gitlab-ci.yml
Normal file
150
.gitlab-ci.yml
Normal file
@ -0,0 +1,150 @@
|
||||
# gitzone standard
|
||||
image: hosttoday/ht-docker-node:npmci
|
||||
|
||||
cache:
|
||||
paths:
|
||||
- .npmci_cache/
|
||||
key: "$CI_BUILD_STAGE"
|
||||
|
||||
stages:
|
||||
- security
|
||||
- test
|
||||
- release
|
||||
- metadata
|
||||
|
||||
# ====================
|
||||
# security stage
|
||||
# ====================
|
||||
mirror:
|
||||
stage: security
|
||||
script:
|
||||
- npmci git mirror
|
||||
tags:
|
||||
- docker
|
||||
- notpriv
|
||||
|
||||
snyk:
|
||||
stage: security
|
||||
script:
|
||||
- npmci npm prepare
|
||||
- npmci command npm install -g snyk
|
||||
- npmci command npm install --ignore-scripts
|
||||
- npmci command snyk test
|
||||
tags:
|
||||
- docker
|
||||
- notpriv
|
||||
|
||||
sast:
|
||||
stage: security
|
||||
image: registry.gitlab.com/hosttoday/ht-docker-dbase:npmci
|
||||
variables:
|
||||
DOCKER_DRIVER: overlay2
|
||||
allow_failure: true
|
||||
services:
|
||||
- docker:stable-dind
|
||||
script:
|
||||
- npmci npm prepare
|
||||
- npmci npm install
|
||||
- npmci command npm run build
|
||||
- export SP_VERSION=$(echo "$CI_SERVER_VERSION" | sed 's/^\([0-9]*\)\.\([0-9]*\).*/\1-\2-stable/')
|
||||
- docker run
|
||||
--env SAST_CONFIDENCE_LEVEL="${SAST_CONFIDENCE_LEVEL:-3}"
|
||||
--volume "$PWD:/code"
|
||||
--volume /var/run/docker.sock:/var/run/docker.sock
|
||||
"registry.gitlab.com/gitlab-org/security-products/sast:$SP_VERSION" /app/bin/run /code
|
||||
artifacts:
|
||||
reports:
|
||||
sast: gl-sast-report.json
|
||||
tags:
|
||||
- docker
|
||||
- priv
|
||||
|
||||
# ====================
|
||||
# test stage
|
||||
# ====================
|
||||
|
||||
testLTS:
|
||||
stage: test
|
||||
script:
|
||||
- npmci npm prepare
|
||||
- npmci node install lts
|
||||
- npmci npm install
|
||||
- npmci npm test
|
||||
coverage: /\d+.?\d+?\%\s*coverage/
|
||||
tags:
|
||||
- docker
|
||||
- notpriv
|
||||
|
||||
testSTABLE:
|
||||
stage: test
|
||||
script:
|
||||
- npmci npm prepare
|
||||
- npmci node install stable
|
||||
- npmci npm install
|
||||
- npmci npm test
|
||||
coverage: /\d+.?\d+?\%\s*coverage/
|
||||
tags:
|
||||
- docker
|
||||
- notpriv
|
||||
|
||||
release:
|
||||
stage: release
|
||||
script:
|
||||
- npmci node install stable
|
||||
- npmci npm publish
|
||||
only:
|
||||
- tags
|
||||
tags:
|
||||
- docker
|
||||
- notpriv
|
||||
|
||||
# ====================
|
||||
# metadata stage
|
||||
# ====================
|
||||
codequality:
|
||||
stage: metadata
|
||||
image: docker:stable
|
||||
allow_failure: true
|
||||
services:
|
||||
- docker:stable-dind
|
||||
script:
|
||||
- export SP_VERSION=$(echo "$CI_SERVER_VERSION" | sed 's/^\([0-9]*\)\.\([0-9]*\).*/\1-\2-stable/')
|
||||
- docker run
|
||||
--env SOURCE_CODE="$PWD"
|
||||
--volume "$PWD":/code
|
||||
--volume /var/run/docker.sock:/var/run/docker.sock
|
||||
"registry.gitlab.com/gitlab-org/security-products/codequality:$SP_VERSION" /code
|
||||
artifacts:
|
||||
paths: [codeclimate.json]
|
||||
tags:
|
||||
- docker
|
||||
- priv
|
||||
|
||||
trigger:
|
||||
stage: metadata
|
||||
script:
|
||||
- npmci trigger
|
||||
only:
|
||||
- tags
|
||||
tags:
|
||||
- docker
|
||||
- notpriv
|
||||
|
||||
pages:
|
||||
image: hosttoday/ht-docker-node:npmci
|
||||
stage: metadata
|
||||
script:
|
||||
- npmci command npm install -g typedoc typescript
|
||||
- npmci npm prepare
|
||||
- npmci npm install
|
||||
- npmci command typedoc --module "commonjs" --target "ES2016" --out public/ ts/
|
||||
tags:
|
||||
- docker
|
||||
- notpriv
|
||||
only:
|
||||
- tags
|
||||
artifacts:
|
||||
expire_in: 1 week
|
||||
paths:
|
||||
- public
|
||||
allow_failure: true
|
4
.npmignore
Normal file
4
.npmignore
Normal file
@ -0,0 +1,4 @@
|
||||
node_modules
|
||||
test
|
||||
ts
|
||||
coverage/
|
4
.snyk
Normal file
4
.snyk
Normal file
@ -0,0 +1,4 @@
|
||||
# Snyk (https://snyk.io) policy file, patches or ignores known vulnerabilities.
|
||||
version: v1.13.3
|
||||
ignore: {}
|
||||
patch: {}
|
16
.travis.yml
16
.travis.yml
@ -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=
|
2
LICENSE
2
LICENSE
@ -1,6 +1,6 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2015 Push.Rocks
|
||||
Copyright (c) 2015 Lossless GmbH
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
66
README.md
66
README.md
@ -1,31 +1,57 @@
|
||||
# gulp-browser
|
||||
# @pushrocks/gulp-browser
|
||||
browserify and other goodies for gulp
|
||||
|
||||
### Build Status/Dependencies
|
||||
[](https://travis-ci.org/pushrocks/gulp-browser)
|
||||
[](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)
|
||||
## Availabililty and Links
|
||||
* [npmjs.org (npm package)](https://www.npmjs.com/package/@pushrocks/gulp-browser)
|
||||
* [gitlab.com (source)](https://gitlab.com/pushrocks/gulp-browser)
|
||||
* [github.com (source mirror)](https://github.com/pushrocks/gulp-browser)
|
||||
* [docs (typedoc)](https://pushrocks.gitlab.io/gulp-browser/)
|
||||
|
||||
## Status for master
|
||||
[](https://gitlab.com/pushrocks/gulp-browser/commits/master)
|
||||
[](https://gitlab.com/pushrocks/gulp-browser/commits/master)
|
||||
[](https://www.npmjs.com/package/@pushrocks/gulp-browser)
|
||||
[](https://snyk.io/test/npm/@pushrocks/gulp-browser)
|
||||
[](https://nodejs.org/dist/latest-v10.x/docs/api/)
|
||||
[](https://nodejs.org/dist/latest-v10.x/docs/api/)
|
||||
[](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");
|
||||
|
||||
gulp.task('gulpBrowserTest',function() {
|
||||
var stream = gulp.src('./test/*.js')
|
||||
.pipe(gulpBrowser.browserify())
|
||||
.pipe(gulp.dest("./test/browserifiedJS/"));
|
||||
return stream;
|
||||
});
|
||||
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(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.
|
||||
|
||||
### Dev Information:
|
||||
[](https://david-dm.org/pushrocks/gulp-browser#info=devDependencies)
|
||||
[](https://www.bithound.io/github/pushrocks/gulp-browser/master/dependencies/npm)
|
||||
### Contributors
|
||||
|
||||
- [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)
|
||||
|
||||
[](https://maintainedby.lossless.com)
|
||||
|
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;
|
5
npmextra.json
Normal file
5
npmextra.json
Normal file
@ -0,0 +1,5 @@
|
||||
{
|
||||
"npmci": {
|
||||
"npmGlobalTools": []
|
||||
}
|
||||
}
|
6377
package-lock.json
generated
Normal file
6377
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
53
package.json
53
package.json
@ -1,40 +1,47 @@
|
||||
{
|
||||
"name": "gulp-browser",
|
||||
"version": "0.0.18",
|
||||
"name": "@pushrocks/gulp-browser",
|
||||
"version": "3.0.15",
|
||||
"description": "browserify and other goodies for gulp",
|
||||
"main": "index.js",
|
||||
"main": "dist/index.js",
|
||||
"typings": "dist/index.d.ts",
|
||||
"scripts": {
|
||||
"test": "(cd ts/compile && node compile.js) && (node test.js)",
|
||||
"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)",
|
||||
"upgrade": "(npm run update) && (ncu upgradeAll && npm install)"
|
||||
"test": "(tstest test/)",
|
||||
"build": "(tsbuild)"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/pushrocks/gulp-browser.git"
|
||||
"url": "https://gitlab.com/pushrocks/gulp-browser.git"
|
||||
},
|
||||
"keywords": [
|
||||
"json",
|
||||
"jade",
|
||||
"template"
|
||||
"gulpplugin",
|
||||
"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": {
|
||||
"browserify": "12.0.1",
|
||||
"gulp-util": "3.0.7",
|
||||
"pushrocks": "1.0.24",
|
||||
"through2": "2.0.0"
|
||||
"@pushrocks/smartpromise": "^2.0.5",
|
||||
"@types/browserify": "^12.0.36",
|
||||
"@types/through2": "^2.0.34",
|
||||
"browserify": "^16.2.3",
|
||||
"through2": "^3.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"beautylog": "1.0.6",
|
||||
"gulp": "3.9.0",
|
||||
"gulp-callfunction": "0.0.10",
|
||||
"gulp-typescript": "2.10.0"
|
||||
}
|
||||
"@gitzone/tsbuild": "^2.1.8",
|
||||
"@gitzone/tstest": "^1.0.18",
|
||||
"@pushrocks/gulp-function": "^3.0.1",
|
||||
"@pushrocks/tapbundle": "^3.0.7",
|
||||
"@types/gulp": "^4.0.5",
|
||||
"babel-core": "^6.26.3",
|
||||
"babel-preset-es2015": "^6.24.1",
|
||||
"babelify": "^10.0.0",
|
||||
"gulp": "^4.0.0"
|
||||
},
|
||||
"private": true
|
||||
}
|
||||
|
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']);
|
57
test/test.ts
Normal file
57
test/test.ts
Normal file
@ -0,0 +1,57 @@
|
||||
import * as gulp from 'gulp';
|
||||
import * as gulpFunction from '@pushrocks/gulp-function';
|
||||
import * as smartpromise from '@pushrocks/smartpromise';
|
||||
|
||||
import { expect, tap } from '@pushrocks/tapbundle';
|
||||
|
||||
import * as gulpBrowser from '../ts/index';
|
||||
|
||||
tap.test('should run through smoothly', async () => {
|
||||
let done = smartpromise.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 run through with an empty file', async () => {
|
||||
let done = smartpromise.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 = smartpromise.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();
|
0
test/testBrowserifyEmpty.js
Normal file
0
test/testBrowserifyEmpty.js
Normal 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']);
|
@ -1,2 +0,0 @@
|
||||
# How to compile.
|
||||
Make sure gulp and gulp-taypescript from npm are available. Then run the gulpfile in this directory.
|
50
ts/gulpbrowser.browserify.ts
Normal file
50
ts/gulpbrowser.browserify.ts
Normal file
@ -0,0 +1,50 @@
|
||||
import * as stream from 'stream';
|
||||
import plugins = require('./gulpbrowser.plugins');
|
||||
import * as smartpromise from '@pushrocks/smartpromise';
|
||||
|
||||
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;
|
3
ts/gulpbrowser.plugins.ts
Normal file
3
ts/gulpbrowser.plugins.ts
Normal file
@ -0,0 +1,3 @@
|
||||
export import through2 = require('through2');
|
||||
export import path = require('path');
|
||||
export import browserify = require('browserify');
|
16
ts/index.ts
16
ts/index.ts
@ -1,15 +1 @@
|
||||
/// <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:any = {};
|
||||
|
||||
gulpBrowser.browserify = GulpBrowserBrowserify.init();
|
||||
|
||||
module.exports = gulpBrowser;
|
||||
export import browserify = require('./gulpbrowser.browserify');
|
||||
|
@ -1,19 +0,0 @@
|
||||
/// <reference path="./index.ts" />
|
||||
module GulpBrowserBrowserify {
|
||||
export function init() {
|
||||
return function() {
|
||||
return 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 {
|
||||
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']);
|
15
ts/tsd.json
15
ts/tsd.json
@ -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"
|
||||
}
|
||||
}
|
||||
}
|
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" />
|
17
tslint.json
Normal file
17
tslint.json
Normal file
@ -0,0 +1,17 @@
|
||||
{
|
||||
"extends": ["tslint:latest", "tslint-config-prettier"],
|
||||
"rules": {
|
||||
"semicolon": [true, "always"],
|
||||
"no-console": false,
|
||||
"ordered-imports": false,
|
||||
"object-literal-sort-keys": false,
|
||||
"member-ordering": {
|
||||
"options":{
|
||||
"order": [
|
||||
"static-method"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"defaultSeverity": "warning"
|
||||
}
|
Reference in New Issue
Block a user