mirror of
https://github.com/react/react-native-devtools-frontend.git
synced 2026-10-01 09:47:56 +08:00
- Updates stylelint to 13.8.0 - Updates ESLint to 7.14.0 - Updates @typescript-eslint to 4.9.0 DISABLE_THIRD_PARTY_CHECK=NPM update R=jacktfranklin@chromium.org Change-Id: I207e204607ede782710e042c17d6510c7f696905 Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2566806 Reviewed-by: Jack Franklin <jacktfranklin@chromium.org> Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
34 lines
1.3 KiB
JavaScript
34 lines
1.3 KiB
JavaScript
"use strict";
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
exports.removeLeadingDotSegment = exports.escape = exports.makeAbsolute = exports.unixify = void 0;
|
|
const path = require("path");
|
|
const LEADING_DOT_SEGMENT_CHARACTERS_COUNT = 2; // ./ or .\\
|
|
const UNESCAPED_GLOB_SYMBOLS_RE = /(\\?)([()*?[\]{|}]|^!|[!+@](?=\())/g;
|
|
/**
|
|
* Designed to work only with simple paths: `dir\\file`.
|
|
*/
|
|
function unixify(filepath) {
|
|
return filepath.replace(/\\/g, '/');
|
|
}
|
|
exports.unixify = unixify;
|
|
function makeAbsolute(cwd, filepath) {
|
|
return path.resolve(cwd, filepath);
|
|
}
|
|
exports.makeAbsolute = makeAbsolute;
|
|
function escape(pattern) {
|
|
return pattern.replace(UNESCAPED_GLOB_SYMBOLS_RE, '\\$2');
|
|
}
|
|
exports.escape = escape;
|
|
function removeLeadingDotSegment(entry) {
|
|
// We do not use `startsWith` because this is 10x slower than current implementation for some cases.
|
|
// eslint-disable-next-line @typescript-eslint/prefer-string-starts-ends-with
|
|
if (entry.charAt(0) === '.') {
|
|
const secondCharactery = entry.charAt(1);
|
|
if (secondCharactery === '/' || secondCharactery === '\\') {
|
|
return entry.slice(LEADING_DOT_SEGMENT_CHARACTERS_COUNT);
|
|
}
|
|
}
|
|
return entry;
|
|
}
|
|
exports.removeLeadingDotSegment = removeLeadingDotSegment;
|