Socket
Socket
Sign inDemoInstall

browser-sync-client

Package Overview
Dependencies
Maintainers
1
Versions
100
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

browser-sync-client - npm Package Compare versions

Comparing version 0.0.5 to 0.1.0

.idea/.name

66

gulpfile.js

@@ -1,5 +0,9 @@

var gulp = require("gulp");
var karma = require('gulp-karma');
var jshint = require('gulp-jshint');
var contribs = require('gulp-contribs');
var gulp = require("gulp");
var karma = require('gulp-karma');
var jshint = require('gulp-jshint');
var contribs = require('gulp-contribs');
var browserify = require('gulp-browserify');
var uglify = require('gulp-uglify');
var through2 = require('through2');
var rename = require('gulp-rename');

@@ -14,3 +18,3 @@ var testFiles = [

.pipe(karma({
configFile: 'test/karma.conf.js',
configFile: 'test/karma.conf.ci.js',
action: 'run'

@@ -28,4 +32,4 @@ }));

gulp.task('lint', function () {
gulp.src(['test/client-script/*.js', 'lib/*', 'test/middleware/*.js'])
gulp.task('lint-test', function () {
gulp.src(['test/client-new/*.js', 'test/middleware/*.js'])
.pipe(jshint('test/.jshintrc'))

@@ -36,2 +40,9 @@ .pipe(jshint.reporter("default"))

gulp.task('lint-lib', function () {
gulp.src(['lib/*', '!lib/browser-sync-client.js', '!lib/events.js'])
.pipe(jshint('lib/.jshintrc'))
.pipe(jshint.reporter("default"))
.pipe(jshint.reporter("fail"))
});
gulp.task('contribs', function () {

@@ -42,2 +53,41 @@ gulp.src('README.md')

});
gulp.task('default', ["lint", "test"]);
/**
* Strip debug statements
* @returns {*}
*/
var stripDebug = function () {
return through2.obj(function (file, enc, cb) {
var string = file.contents.toString();
var regex = /\/\*\*debug:start\*\*\/[\s\S]*\/\*\*debug:end\*\*\//g;
var stripped = string.replace(regex, "");
file.contents = new Buffer(stripped);
this.push(file);
cb();
});
};
// Basic usage
gulp.task('build-dist', function() {
// Single entry point to browserify
gulp.src('lib/index.js')
.pipe(browserify())
.pipe(gulp.dest('./dist'))
.pipe(stripDebug())
.pipe(uglify())
.pipe(rename("index.min.js"))
.pipe(gulp.dest('./dist'));
});
gulp.task('build-dev', function() {
// Single entry point to browserify
gulp.src('lib/index.js')
.pipe(browserify())
.pipe(gulp.dest('./dist'))
});
gulp.task("dev", ['build-dev'], function () {
gulp.watch(["lib/*.js", "test/client-new/**/*.js"], ['build-dev']);
});
gulp.task('default', ["lint-lib", "lint-test", "test"]);

14

index.js

@@ -6,3 +6,3 @@ "use strict";

var built = path.resolve(__dirname + "/dist/dist.js");
var script = path.resolve(__dirname + "/dist/index.min.js");

@@ -16,12 +16,6 @@ module.exports.middleware = function () {

if (options && options.minify) {
result = fs.readFileSync(built);
result = fs.readFileSync(script);
} else {
var client = path.resolve(__dirname + "/lib/browser-sync-client.js");
var shims = path.resolve(__dirname + "/lib/client-shims.js");
var jsFile = fs.readFileSync(client);
var jsShims = fs.readFileSync(shims);
result = jsShims + jsFile;
script = path.resolve(__dirname + "/dist/index.js");
result = fs.readFileSync(script);
}

@@ -28,0 +22,0 @@

@@ -1,32 +0,20 @@

"use strict";
// browser-sync shims
if (typeof Array.prototype.indexOf === "undefined") {
Array.prototype.indexOf = function (searchElement, fromIndex) {
if (!this) {
throw new TypeError();
}
if (!("indexOf" in Array.prototype)) {
fromIndex = +fromIndex;
if (isNaN(fromIndex)) {
fromIndex = 0;
Array.prototype.indexOf= function(find, i) {
if (i === undefined) {
i = 0;
}
var length = this.length;
if (length === 0 || fromIndex >= length) {
return -1;
if (i < 0) {
i += this.length;
}
if (fromIndex < 0) {
fromIndex += length;
if (i < 0) {
i= 0;
}
while (fromIndex < length) {
if (this[ fromIndex += 1] === searchElement) {
return fromIndex;
for (var n = this.length; i < n; i += 1) {
if (i in this && this[i]===find) {
return i;
}
}
return -1;
};
}
{
"name": "browser-sync-client",
"description": "Client-side scripts for BrowserSync",
"version": "0.0.5",
"version": "0.1.0",
"homepage": "https://github.com/shakyshane/browser-sync-client",

@@ -28,9 +28,7 @@ "author": {

"scripts": {
"test": "gulp",
"install": "node ./lib/build.js"
"test": "gulp build-dist && gulp && mocha test/middleware",
"install": "gulp build-dist"
},
"devDependencies": {
"gulp": "~3.5.2",
"gulp-karma": "0.0.4",
"gulp-mocha": "~0.4.1",
"gulp-jshint": "~1.4.0",

@@ -43,11 +41,20 @@ "chai": "~1.9.0",

"karma-firefox-launcher": "^0.1.3",
"karma-html2js-preprocessor": "^0.1.0"
"karma-html2js-preprocessor": "^0.1.0",
"gulp-browserify": "^0.5.0",
"gulp-uglify": "^0.2.1",
"gulp": "^3.6.0",
"karma-coverage": "^0.2.1",
"karma-chrome-launcher": "^0.1.3",
"express": "^4.0.0",
"gulp-rename": "^1.2.0",
"mocha": "^1.18.2",
"supertest": "^0.10.0"
},
"keywords": [],
"dependencies": {
"uglify-js": "^2.4.13",
"through2": "^0.4.1",
"vinyl": "^0.2.3",
"vinyl-fs": "^0.1.2"
"gulp": "^3.6.0",
"gulp-browserify": "^0.5.0",
"gulp-uglify": "^0.2.1",
"through2": "^0.4.1"
}
}

@@ -8,3 +8,3 @@ # browser-sync-client [![Build Status](https://travis-ci.org/shakyShane/browser-sync-client.png?branch=master)](https://travis-ci.org/shakyShane/browser-sync-client)

```
20 Shane Osbourne
40 Shane Osbourne
1 Hugo Dias

@@ -11,0 +11,0 @@ 1 Sergey Slipchenko

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc