Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function stringifyDependencyPath(path, options) {
var resolved = getPath(path, options);
var tree = options.tree, ambient = options.ambient, cwd = options.cwd, browser = options.browser, name = options.name, readFiles = options.readFiles, imported = options.imported, meta = options.meta, entry = options.entry, emitter = options.emitter;
var importedPath = importPath(path, path_3.pathFromDefinition(path), options);
if (has(imported, importedPath)) {
return Promise.resolve(null);
}
imported[importedPath] = true;
emitter.emit('compile', { name: name, path: path, tree: tree, browser: browser });
function loadByModuleName(path) {
var _a = getModuleNameParts(path, tree), moduleName = _a[0], modulePath = _a[1];
var compileOptions = { cwd: cwd, browser: browser, readFiles: readFiles, imported: imported, emitter: emitter, name: moduleName, ambient: false, meta: meta };
var stringifyOptions = cachedStringifyOptions(moduleName, compileOptions, options);
if (!stringifyOptions) {
return Promise.resolve(null);
}
return compileDependencyPath(modulePath, stringifyOptions);
}
if (path_3.isModuleName(resolved)) {
return loadByModuleName(resolved);
}
return cachedReadFileFrom(resolved, options)
Delay.prototype.init = function(){
var self = this,
task = self.task;
if(task.resolved){
return task.resolved;
}
return Prom
.resolve(self.xf.init());
};
Delay.prototype.step = function(value, input) {
function rmdirUntil(path, until) {
if (path === until) {
return Promise.resolve();
}
return exports.readdir(path)
.then(function (files) {
if (files.length) {
return;
}
return exports.rmdir(path)
.then(function () { return rmdirUntil(path_1.dirname(path), until); });
})
.catch(function (err) {
if (err.code === 'ENOENT') {
return;
}
return Promise.reject(err);
});
}
function rmdirUntil(path, options) {
if (path === options.cwd) {
return Promise.resolve();
}
return exports.readdir(path)
.then(function (files) {
if (files.length) {
return;
}
return exports.rmdir(path)
.then(function () { return rmdirUntil(path_1.dirname(path), options); });
})
.catch(function (err) {
if (err.code === 'ENOENT') {
return;
}
return Promise.reject(err);
});
}
}
}
else if (options.savePeer) {
if (options.global) {
throw new TypeError('Unable to use `savePeer` with the `global` flag');
}
else {
config.peerDependencies = extend(config.peerDependencies, (_f = {}, _f[name] = raw, _f));
}
}
}
return config;
var _b, _c, _d, _e, _f;
});
}
return Promise.resolve();
}
function writeBundle(results, options) {
if (redirect === REDIRECT_TYPE.FOLLOW_WITH_GET) {
request.set('Content-Length', '0');
return get(newUrl, 'GET');
}
if (redirect === REDIRECT_TYPE.FOLLOW_WITH_CONFIRMATION) {
if (arg.method === 'GET' || arg.method === 'HEAD') {
return get(newUrl, method, body);
}
if (confirmRedirect(req, res)) {
return get(newUrl, method, body);
}
}
}
request.downloadLength = num(res.headers['content-length'], 0);
res.pipe(responseProxy);
return Promise.resolve({
body: responseProxy,
status: status,
statusText: res.statusMessage,
headers: res.headers,
rawHeaders: res.rawHeaders,
url: url
});
}
req.once('response', function (message) {
return transformFile(path, function (contents) {
var indent = contents ? detectIndent(contents).indent : undefined;
var json = contents ? parseJson(stripBom(contents), path, allowEmpty) : undefined;
var eol = contents ? path_2.detectEOL(contents) : undefined;
return Promise.resolve(transform(json))
.then(function (json) { return stringifyJson(json, indent, eol); });
});
}
function loadByModuleName(path) {
var _a = getModuleNameParts(path, tree), moduleName = _a[0], modulePath = _a[1];
var compileOptions = { cwd: cwd, resolution: resolution, readFiles: readFiles, imported: imported, emitter: emitter, name: moduleName, global: false, meta: meta };
var stringifyOptions = cachedStringifyOptions(moduleName, compileOptions, options);
if (!stringifyOptions) {
return Promise.resolve(null);
}
return compileDependencyPath(modulePath, stringifyOptions, moduleOptions);
}
if (path_3.isModuleName(path)) {
function chain(fns, arg) {
return fns.reduce(function (p, fn) {
return p.then(function () { return fn(arg); });
}, Promise.resolve());
}
function emitProgress(request) {