mirror of
https://github.com/react/react-native-devtools-frontend.git
synced 2026-10-01 01:38:07 +08:00
There don't appear to be any relevant breaking changes in https://github.com/monounity/karma-typescript/releases/tag/v5.0.0 R=jacktfranklin@chromium.org DISABLE_THIRD_PARTY_CHECK=Update karma-typescript Bug: 1068145 Change-Id: I780d8c572bbfc4253f3ff5e52a33c23733d4262a Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2137388 Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org> Reviewed-by: Jack Franklin <jacktfranklin@chromium.org> Auto-Submit: Tim van der Lippe <tvanderlippe@chromium.org>
42 lines
1.2 KiB
JavaScript
42 lines
1.2 KiB
JavaScript
"use strict";
|
|
|
|
Object.defineProperty(exports, "__esModule", {
|
|
value: true
|
|
});
|
|
exports.default = getModuleName;
|
|
|
|
function getModuleName(rootOpts, pluginOpts) {
|
|
var _pluginOpts$moduleRoo, _rootOpts$moduleIds, _rootOpts$moduleRoot;
|
|
|
|
const {
|
|
filename,
|
|
filenameRelative = filename,
|
|
sourceRoot = (_pluginOpts$moduleRoo = pluginOpts.moduleRoot) != null ? _pluginOpts$moduleRoo : rootOpts.moduleRoot
|
|
} = rootOpts;
|
|
const {
|
|
moduleId = rootOpts.moduleId,
|
|
moduleIds = (_rootOpts$moduleIds = rootOpts.moduleIds) != null ? _rootOpts$moduleIds : !!moduleId,
|
|
getModuleId = rootOpts.getModuleId,
|
|
moduleRoot = (_rootOpts$moduleRoot = rootOpts.moduleRoot) != null ? _rootOpts$moduleRoot : sourceRoot
|
|
} = pluginOpts;
|
|
if (!moduleIds) return null;
|
|
|
|
if (moduleId != null && !getModuleId) {
|
|
return moduleId;
|
|
}
|
|
|
|
let moduleName = moduleRoot != null ? moduleRoot + "/" : "";
|
|
|
|
if (filenameRelative) {
|
|
const sourceRootReplacer = sourceRoot != null ? new RegExp("^" + sourceRoot + "/?") : "";
|
|
moduleName += filenameRelative.replace(sourceRootReplacer, "").replace(/\.(\w*?)$/, "");
|
|
}
|
|
|
|
moduleName = moduleName.replace(/\\/g, "/");
|
|
|
|
if (getModuleId) {
|
|
return getModuleId(moduleName) || moduleName;
|
|
} else {
|
|
return moduleName;
|
|
}
|
|
} |