fix(core): update to latest standards

This commit is contained in:
Philipp Kunz 2019-02-13 00:22:18 +01:00
parent 31f21c7dec
commit 383e204ae2
11 changed files with 6401 additions and 105 deletions

View File

@ -54,7 +54,7 @@ gulp.task('gulpBrowserTest', function() {
* [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.
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)

View File

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

View File

@ -1,44 +0,0 @@
"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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZ3VscGJyb3dzZXIuYnJvd3NlcmlmeS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL2d1bHBicm93c2VyLmJyb3dzZXJpZnk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BSSxFQUFFLEVBQUUsT0FBTyxFQUFFLElBQUksQ0FBQyxJQUFJLEVBQUUsQ0FBQyxDQUFDO1lBRXBFLFVBQVUsQ0FBQyxPQUFPLENBQUMsVUFBUyxTQUFTO2dCQUNuQyxFQUFFLENBQUMsQ0FBQyxPQUFPLFNBQVMsS0FBSyxVQUFVLENBQUMsQ0FBQyxDQUFDO29CQUNwQyxZQUFZLENBQUMsU0FBUyxDQUFDLFNBQVMsQ0FBQyxDQUFDO2dCQUNwQyxDQUFDO2dCQUFDLElBQUksQ0FBQyxDQUFDO29CQUNOLFlBQVksQ0FBQyxTQUFTLENBQUMsU0FBUyxDQUFDLFNBQVMsRUFBRSxTQUFTLENBQUMsT0FBTyxDQUFDLENBQUM7Z0JBQ2pFLENBQUM7WUFDSCxDQUFDLENBQUMsQ0FBQztZQUVILFlBQVksQ0FBQyxNQUFNLENBQUMsY0FBYyxDQUFDLENBQUM7UUFDdEMsQ0FBQztRQUFDLElBQUksQ0FBQyxDQUFDO1lBQ04sT0FBTyxDQUFDLElBQUksQ0FBQywrREFBK0QsQ0FBQyxDQUFDO1lBQzlFLEVBQUUsQ0FBQyxJQUFJLEVBQUUsSUFBSSxDQUFDLENBQUM7UUFDakIsQ0FBQztJQUNILENBQUMsQ0FBQztJQUVGLElBQUksS0FBSyxHQUFHLFVBQVMsRUFBRTtRQUNyQixFQUFFLEVBQUUsQ0FBQztJQUNQLENBQUMsQ0FBQyxDQUFDLHNDQUFzQztJQUV6QyxNQUFNLENBQUMsT0FBTyxDQUFDLFFBQVEsQ0FBQyxHQUFHLENBQUMsT0FBTyxFQUFFLEtBQUssQ0FBQyxDQUFDLENBQUMsNkVBQTZFO0FBQzVILENBQUMsQ0FBQztBQUVGLGlCQUFTLFVBQVUsQ0FBQyJ9

View File

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

View File

@ -1,6 +0,0 @@
"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
View File

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

4
dist/index.js vendored
View File

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

6377
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,15 +1,12 @@
{
"name": "gulp-browser",
"name": "@pushrocks/gulp-browser",
"version": "3.0.11",
"description": "browserify and other goodies for gulp",
"main": "dist/index.js",
"typings": "dist/index.d.ts",
"scripts": {
"test": "(npmts)",
"reinstall": "(rm -r node_modules && npm install)",
"release": "(git pull origin master && npm version patch && git push origin master && git checkout release && git merge master && git push origin release && git checkout master)",
"update": "(git checkout master && git pull origin master && npm install)",
"upgrade": "(npm run update) && (ncu upgradeAll && npm install)"
"test": "(tstest test/)",
"build": "(tsbuild)"
},
"repository": {
"type": "git",
@ -29,20 +26,21 @@
},
"homepage": "https://gitlab.com/pushrocks/gulp-browser",
"dependencies": {
"@types/browserify": "^12.0.32",
"@types/through2": "^2.0.33",
"browserify": "^16.1.1",
"smartq": "^1.1.8",
"through2": "^2.0.3"
"@pushrocks/smartpromise": "^2.0.5",
"@types/browserify": "^12.0.36",
"@types/through2": "^2.0.34",
"browserify": "^16.2.3",
"through2": "^3.0.0"
},
"devDependencies": {
"@types/gulp": "^4.0.4",
"babel-core": "^6.26.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": "^8.0.0",
"beautylog": "^6.1.10",
"gulp": "^3.9.1",
"gulp-function": "^2.2.9",
"tapbundle": "^2.0.0"
"babelify": "^10.0.0",
"gulp": "^4.0.0"
}
}

View File

@ -1,14 +1,13 @@
import * as beautylog from 'beautylog';
import * as gulp from 'gulp';
import * as gulpFunction from 'gulp-function';
import * as smartq from 'smartq';
import * as gulpFunction from '@pushrocks/gulp-function';
import * as smartpromise from '@pushrocks/smartpromise';
import { expect, tap } from 'tapbundle';
import { expect, tap } from '@pushrocks/tapbundle';
import * as gulpBrowser from '../ts/index';
tap.test('should run through smoothly', async () => {
let done = smartq.defer();
let done = smartpromise.defer();
let stream = gulp
.src('./test/testBrowserifyNormal.js')
.pipe(gulpBrowser.browserify())
@ -21,24 +20,8 @@ tap.test('should run through smoothly', async () => {
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 done = smartpromise.defer();
let stream = gulp
.src('./test/testBrowserifyEmpty.js')
.pipe(gulpBrowser.browserify())
@ -52,7 +35,7 @@ tap.test('should run through with an empty file', async () => {
});
tap.test('should run through work with transforms', async () => {
let done = smartq.defer();
let done = smartpromise.defer();
let transforms = [
{
transform: 'babelify',

View File

@ -1,6 +1,6 @@
import * as stream from 'stream';
import plugins = require('./gulpbrowser.plugins');
import * as q from 'smartq';
import * as smartpromise from '@pushrocks/smartpromise';
let browserify = function(transforms = []) {
if (!Array.isArray(transforms)) {