(process.env.NODE_PATH || '') .split(path.delimiter) .filter(folder => folder && !path.isAbsolute(folder)) .map(folder => path.resolve(appDirectory, folder)) .join(path.delimiter)
async function removeSourceContentIfMatch(sourceMapURL, compiledURL, payload) { const {sourcesContent, sources} = payload; if (!sourcesContent || !sources) return; for (let i = 0; i < sources.length; ++i) { if (!sources[i] || !sourcesContent[i]) continue; let url = sources[i]; if (!path.isAbsolute(url)) url = path.join(path.dirname(compiledURL), url); if (!fs.existsSync(url)) continue; const sourceContentStream = new StringStream(sourcesContent[i]); const sourceContentLines = await readLines(sourceContentStream); const fileStream = fs.createReadStream(url); const fileStreamLines = await readLines(fileStream); if (sourceContentLines.length === fileStreamLines.length) { let equal = true; for (let i = 0; i < sourceContentLines.length; ++i) { if (sourceContentLines[i] !== fileStreamLines[i]) { equal = false; break; } } if (equal) sourcesContent[i] = undefined; } } }
if (path.isAbsolute(filename)) { return { filePath: filename
if (path.isAbsolute(filename)) { filename = path.relative(dir, filename); if (filename[0] !== ".") {
let filePath; if (this.flags.config) { filePath = path.isAbsolute(this.flags.config) ? this.flags.config : path.resolve(process.cwd(), this.flags.config);
const svcDir = path.isAbsolute(serviceDir) ? serviceDir : path.resolve(process.cwd(), serviceDir); const svcPath = path.isAbsolute(p) ? p : path.resolve(svcDir, p);
/** * Initialize this restriction. * @param {DefinitionData} def The definition of a restriction. */ constructor({ name, message }) { const names = Array.isArray(name) ? name : [name] const matchers = names.map(raw => { const negate = raw[0] === "!" && raw[1] !== "(" const pattern = negate ? raw.slice(1) : raw const absolute = path.isAbsolute(pattern) const matcher = new Minimatch(pattern, { dot: true }) return { absolute, matcher, negate } }) this.matchers = matchers this.message = message ? ` ${message}` : "" }
asAbsolute(file, baseDir) { return path.isAbsolute(file) ? file : path.resolve(baseDir || process.cwd(), file); }
/** * Determines if a given string represents a filepath or not using the same * conventions as require(), meaning that the first character must be nonalphanumeric * and not the @ sign which is used for scoped packages to be considered a file path. * @param {string} filePath The string to check. * @returns {boolean} True if it's a filepath, false if not. * @private */ function isFilePath(filePath) { return path.isAbsolute(filePath) || !/\w|@/.test(filePath.charAt(0)); }
relativeTo(file, origFile) { return path.isAbsolute(file) ? file : path.resolve(path.dirname(origFile), file); }
(process.env.NODE_PATH || '') .split(path.delimiter) .filter(folder => folder && !path.isAbsolute(folder)) .map(folder => path.resolve(appDirectory, folder)) .join(path.delimiter)
(process.env.NODE_PATH || '') .split(path.delimiter) .filter(folder => folder && !path.isAbsolute(folder)) .map(folder => path.resolve(appDirectory, folder)) .join(path.delimiter)
if (path.isAbsolute(filename)) { return { filePath: filename
if (path.isAbsolute(filename)) { filename = path.relative(dir, filename); if (filename[0] !== ".") {
(process.env.NODE_PATH || '') .split(path.delimiter) .filter(folder => folder && !path.isAbsolute(folder)) .map(folder => path.resolve(appDirectory, folder)) .join(path.delimiter)