Which part of gulp’s source code defines. pipe ()?

  node.js, question

I do the simplest demo of gulp locally.

var gulp = require('gulp');
 var less = require('gulp-less');
 var autoprefix = require('gulp-autoprefixer');
 
 gulp.task('css', function(){
 gulp.src('assets/app.less')
 .pipe(less())
 .pipe(autoprefix('last 2 version', 'ie 8', 'ie 9'))
 .pipe(gulp.dest('build/css'));
 });

Now I want to see where. pipe () is defined. I found 3 index.js. js, respectively:

node_modules/gulp-less/node_modules/gulp-util/node_modules/multipipe/index.js
node_modules/gulp-less/node_modules/gulp-less/node_modules/multipipe/index.js
node_modules/gulp-less/node_modules/gulp-autoprefixer/node_modules/multipipe/index.js

For example, the first index.js inside has the following definition:

function pipe(){
 if (arguments.length == 1) return arguments[0];
 var streams = slice.call(arguments);
 var cb;
 if ('function' == typeof streams[streams.length - 1]) {
 cb = streams.splice(-1)[0];
 bracket
 ...
 ...
 return ret;
 bracket

Now, I want to try to add a console.log () to see the internal state of the pipe () function, such as:

function pipe(){
 console.log("Here!"  );
 if (arguments.length == 1) return arguments[0];
 var streams = slice.call(arguments);
 ...
 bracket

Then run gulp css.
As a result, the console did not appear Here as I hoped!

I don’t know where the problem is.

Gulp is based on nodejssstream. for the pipe method, you can see nodejssstream API:https://nodejs.org/api/stream.html#stream_readable_pipe_destination_options

The multipipe you are looking at is also a further encapsulation of nodejssstream. as to why your console.log cannot be output, it is better to use it under debughttps://github.com/node-inspector/node-inspector