You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Tasks registered with gulp.task are possible by using Error.captureStackTrace as written in the original issue.
And tasks defined as functions are also possible with the following code if those source codes are loaded with require:
And tasks defined as functions in source files loaded with require are also possible with the following code.
(If no source file of a task function is found with the following code, the function is registered with gulp.task/series/parallel in the same source file.)
$ pwd
/path/to/sample
$ cat main.js
const { a, b } = require('./a');
const path = require('node:path');
const configPath = path.resolve('./a.js');
const mod0 = require.cache[configPath];
console.log('a:', findSrcPath(a, mod0));
console.log('b:', findSrcPath(b, mod0));
function findSrcPath(fn, mod) {
if (Object.values(mod.exports).includes(fn)) {
for (const child of mod.children) {
const id = findSrcPath(fn, child);
if (id) return id;
}
return mod.id;
}
}
$ cat a.js
const { b } = require('./b');
exports.a = function() {};
exports.b = b;
$ cat b.js
function b() {}
module.exports = { b };
$ node main.js
a: /path/to/sample/a.js
b: /path/to/sample/b.js
However, I can't come up with any idea about tasks defined as functions in source files loaded with import.
Moved from gulpjs/gulp#1180
The text was updated successfully, but these errors were encountered: