gulp-ws-sender
Advanced tools
Comparing version 1.1.0 to 1.1.1
@@ -1,8 +0,3 @@ | ||
const server = require('./src/server') | ||
const broadcast = require('./src/broadcast') | ||
module.exports = { | ||
server, | ||
broadcast | ||
} | ||
module.exports = broadcast |
{ | ||
"name": "gulp-ws-sender", | ||
"version": "1.1.0", | ||
"description": "to send js and css to your websocket server", | ||
"version": "1.1.1", | ||
"description": "start the websocket server and send your js and css to it ^^", | ||
"main": "index.js", | ||
@@ -14,3 +14,3 @@ "scripts": { | ||
"chalk": "^2.4.1", | ||
"gulp-util": "^3.0.8", | ||
"plugin-error": "^1.0.1", | ||
"through2": "^3.0.0", | ||
@@ -20,5 +20,5 @@ "ws": "^6.1.0" | ||
"repository": { | ||
"type" : "git", | ||
"url" : "https://github.com/bercly0b/gulp-ws-sender" | ||
"type": "git", | ||
"url": "https://github.com/bercly0b/gulp-ws-sender" | ||
} | ||
} |
## usage | ||
```sh | ||
const gulp = require('gulp') | ||
const broadcast = require('gulp-ws-sender').broadcast(port) | ||
const server = require('gulp-ws-sender').server | ||
const sender = require('gulp-ws-sender')(9999) // port | ||
gulp.task('styles', () => { | ||
return gulp.src('src/**/*.css') | ||
.pipe(sender({ | ||
type: 'css' | ||
})) | ||
.pipe(sender({ type: 'css' })) // or type: 'js' | ||
.pipe(gulp.dest('public')) | ||
}) | ||
gulp.task('server', () => server({ port: port })) | ||
``` | ||
For live injection of your script and styles on any page. Use with [chrome extention](https://github.com/bercly0b/injector-chrome-extension) |
@@ -1,4 +0,5 @@ | ||
const gutil = require('gulp-util') | ||
const PluginError = require('plugin-error'); | ||
const through = require('through2') | ||
const WebSocket = require('ws') | ||
const server = require('./server') | ||
const getMessage = require('./helper').getClientMessage | ||
@@ -8,7 +9,9 @@ | ||
module.exports = port => { | ||
server(port) | ||
const ws = new WebSocket('ws://localhost:' + port) | ||
return options => { | ||
const { type } = options | ||
// const { client: ws, type } = options | ||
return through.obj(function(file, enc, cb) { | ||
@@ -22,3 +25,3 @@ | ||
if (file.isStream()) { | ||
cb(new gutil.PluginError('gulp-ws-sender', 'Streaming not supported')) | ||
cb(new PluginError('gulp-ws-sender', 'Streaming not supported')) | ||
return | ||
@@ -35,3 +38,3 @@ } | ||
} catch (err) { | ||
this.emit('error', new gutil.PluginError('gulp-ws-sender', err)) | ||
this.emit('error', new PluginError('gulp-ws-sender', err, { showStack: true })) | ||
console.log(err) | ||
@@ -38,0 +41,0 @@ } |
const WebSocket = require('ws') | ||
const chalk = require('chalk') | ||
const getMessage = require('./helper').getServerMessage | ||
module.exports = options => { | ||
module.exports = port => { | ||
const { port } = options | ||
const clients = {} | ||
@@ -16,6 +13,6 @@ let needHandler = true | ||
const client = clients.gulp ? 'browser' : 'gulp' | ||
const client = clients.sender ? 'browser' : 'sender' | ||
clients[client] = ws | ||
console.log(getMessage('Connected', client)) | ||
ws.on('close', () => { | ||
@@ -26,5 +23,5 @@ delete clients[client] | ||
if (needHandler && clients.gulp) { | ||
if (needHandler && clients.sender) { | ||
needHandler = false | ||
clients.gulp.on('message', message => { | ||
clients.sender.on('message', message => { | ||
// console.log(getMessage('Received message from', client), `: ${message}`) | ||
@@ -31,0 +28,0 @@ clients.browser && clients.browser.send(message) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
3323
73
15
+ Addedplugin-error@^1.0.1
+ Addedansi-colors@1.1.0(transitive)
+ Addedarr-diff@4.0.0(transitive)
+ Addedarr-union@3.1.0(transitive)
+ Addedassign-symbols@1.0.0(transitive)
+ Addedextend-shallow@3.0.2(transitive)
+ Addedis-extendable@1.0.1(transitive)
+ Addedis-plain-object@2.0.4(transitive)
+ Addedisobject@3.0.1(transitive)
+ Addedplugin-error@1.0.1(transitive)
+ Addedreadable-stream@3.6.2(transitive)
+ Addedsafe-buffer@5.2.1(transitive)
+ Addedstring_decoder@1.3.0(transitive)
- Removedgulp-util@^3.0.8
- Removedansi-gray@0.1.1(transitive)
- Removedansi-regex@2.1.1(transitive)
- Removedansi-styles@2.2.1(transitive)
- Removedarray-differ@1.0.0(transitive)
- Removedarray-uniq@1.0.3(transitive)
- Removedbeeper@1.1.1(transitive)
- Removedchalk@1.1.3(transitive)
- Removedclone@1.0.4(transitive)
- Removedclone-stats@0.0.1(transitive)
- Removedcolor-support@1.1.3(transitive)
- Removedcore-util-is@1.0.3(transitive)
- Removeddateformat@2.2.0(transitive)
- Removedduplexer2@0.0.2(transitive)
- Removedfancy-log@1.3.3(transitive)
- Removedglogg@1.0.2(transitive)
- Removedgulp-util@3.0.8(transitive)
- Removedgulplog@1.0.0(transitive)
- Removedhas-ansi@2.0.0(transitive)
- Removedhas-gulplog@0.1.0(transitive)
- Removedisarray@0.0.11.0.0(transitive)
- Removedlodash._basecopy@3.0.1(transitive)
- Removedlodash._basetostring@3.0.1(transitive)
- Removedlodash._basevalues@3.0.0(transitive)
- Removedlodash._getnative@3.9.1(transitive)
- Removedlodash._isiterateecall@3.0.9(transitive)
- Removedlodash._reescape@3.0.0(transitive)
- Removedlodash._reevaluate@3.0.0(transitive)
- Removedlodash._reinterpolate@3.0.0(transitive)
- Removedlodash._root@3.0.1(transitive)
- Removedlodash.escape@3.2.0(transitive)
- Removedlodash.isarguments@3.1.0(transitive)
- Removedlodash.isarray@3.0.4(transitive)
- Removedlodash.keys@3.1.2(transitive)
- Removedlodash.restparam@3.6.1(transitive)
- Removedlodash.template@3.6.2(transitive)
- Removedlodash.templatesettings@3.1.1(transitive)
- Removedminimist@1.2.8(transitive)
- Removedmultipipe@0.1.2(transitive)
- Removedobject-assign@3.0.0(transitive)
- Removedparse-node-version@1.0.1(transitive)
- Removedprocess-nextick-args@2.0.1(transitive)
- Removedreadable-stream@1.1.142.3.8(transitive)
- Removedreplace-ext@0.0.1(transitive)
- Removedsafe-buffer@5.1.2(transitive)
- Removedsparkles@1.0.1(transitive)
- Removedstring_decoder@0.10.311.1.1(transitive)
- Removedstrip-ansi@3.0.1(transitive)
- Removedsupports-color@2.0.0(transitive)
- Removedthrough2@2.0.5(transitive)
- Removedtime-stamp@1.1.0(transitive)
- Removedvinyl@0.5.3(transitive)
- Removedxtend@4.0.2(transitive)