New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

gulp-remote-src

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gulp-remote-src - npm Package Compare versions

Comparing version 0.1.0 to 0.2.0

73

Gulpfile.js
var remoteSrc = require('./');
var gulp = require('gulp');
var uglify = require('gulp-uglify');
var clean = require('gulp-clean');
gulp.task('test', function() {
remoteSrc(['source.js'], {
stream: false,
base: 'https://raw.githubusercontent.com/ddliu/gulp-remote-src/master/tests/'
var FILES = [
"src/node.js",
"lib/_debugger.js",
"lib/_linklist.js",
"lib/_stream_duplex.js",
"lib/_stream_passthrough.js",
"lib/_stream_readable.js",
"lib/_stream_transform.js",
"lib/_stream_writable.js",
"lib/assert.js",
"lib/buffer.js",
"lib/child_process.js",
"lib/cluster.js",
"lib/console.js",
"lib/constants.js",
"lib/crypto.js",
"lib/dgram.js",
"lib/dns.js",
"lib/domain.js",
"lib/events.js",
"lib/freelist.js",
"lib/fs.js",
"lib/http.js",
"lib/https.js",
"lib/module.js",
"lib/net.js",
"lib/os.js",
"lib/path.js",
"lib/punycode.js",
"lib/querystring.js",
"lib/readline.js",
"lib/repl.js",
"lib/stream.js",
"lib/string_decoder.js",
"lib/sys.js",
"lib/timers.js",
"lib/tls.js",
"lib/tty.js",
"lib/url.js",
"lib/util.js",
"lib/vm.js",
"lib/zlib.js"
];
var URL = "https://raw.githubusercontent.com/joyent/node/v0.10.29/"
gulp.task('clean', function() {
return gulp.src('dist', {read: false})
.pipe(clean());
});
gulp.task('nostream', ['clean'], function() {
return remoteSrc(FILES, {
base: URL
})
.pipe(uglify())
.pipe(gulp.dest('dist'));
});
.pipe(gulp.dest('dist/nostream'));
});
gulp.task('stream', ['clean'], function() {
return remoteSrc(FILES, {
buffer: false,
base: URL
})
.pipe(gulp.dest('dist/stream'));
});
gulp.task('test', ['stream', 'nostream']);

21

index.js

@@ -5,8 +5,5 @@ var util = require('util');

var File = require('vinyl');
var through2 = require('through2');
module.exports = function(urls, options) {
var doSrc = function(_file, callback) {
// var file =
};
if (options === undefined) {

@@ -20,4 +17,4 @@ options = {};

if (typeof options.stream !== 'boolean') {
options.stream = true;
if (typeof options.buffer !== 'boolean') {
options.buffer = true;
}

@@ -31,3 +28,3 @@

var url = options.base + data;
if (options.stream) {
if (!options.buffer) {
var file = new File({

@@ -37,3 +34,4 @@ cwd: '/',

path: url,
contents: request(url)
// request must be piped out once created, or we'll get this error: "You cannot pipe after data has been emitted from the response."
contents: request(url).pipe(through2())
});

@@ -43,3 +41,6 @@

} else {
request(url, function(error, response, body) {
request({
url: url,
encoding: null
}, function(error, response, body) {
if (!error && response.statusCode == 200) {

@@ -50,3 +51,3 @@ var file = new File({

path: url,
contents: new Buffer(body)
contents: body
});

@@ -53,0 +54,0 @@ cb(null, file);

{
"name": "gulp-remote-src",
"description": "Remote gulp.src",
"version": "0.1.0",
"version": "0.2.0",
"main": "index.js",

@@ -27,3 +27,4 @@ "scripts": {

"gulp": "~3.8.5",
"gulp-uglify": "~0.3.1"
"gulp-uglify": "~0.3.1",
"gulp-clean": "~0.3.1"
},

@@ -33,7 +34,10 @@ "dependencies": {

"vinyl": "~0.2.3",
"request": "~2.36.0"
"request": "~2.36.0",
"through2": "~0.5.1"
},
"keywords": [
"gulpplugin"
"gulpplugin",
"remote",
"src"
]
}

@@ -23,3 +23,2 @@ # gulp-remote-src

remoteSrc(['app.js', 'jquery.js'], {
stream: false,
base: 'http://myapps.com/assets/',

@@ -38,5 +37,5 @@ })

- `stream`
- `buffer` (default is true)
Pipe out files as stream or not. Note that some plugins does not support streaming.
Pipe out files as buffer or as stream. Note that some plugins does not support streaming.

@@ -47,2 +46,8 @@ ## Changelog

First release.
First release.
### v0.2.0 (2014-07-01)
Fix streaming pipe.
Add tests for streaming pipe.
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