source: frontend/node_modules/@babel/helper-module-transforms/lib/get-module-name.js

Last change on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 12 days ago

Fix frontend appearance

  • Property mode set to 100644
File size: 1.7 KB
Line 
1"use strict";
2
3Object.defineProperty(exports, "__esModule", {
4 value: true
5});
6exports.default = getModuleName;
7const originalGetModuleName = getModuleName;
8exports.default = getModuleName = function getModuleName(rootOpts, pluginOpts) {
9 var _pluginOpts$moduleId, _pluginOpts$moduleIds, _pluginOpts$getModule, _pluginOpts$moduleRoo;
10 return originalGetModuleName(rootOpts, {
11 moduleId: (_pluginOpts$moduleId = pluginOpts.moduleId) != null ? _pluginOpts$moduleId : rootOpts.moduleId,
12 moduleIds: (_pluginOpts$moduleIds = pluginOpts.moduleIds) != null ? _pluginOpts$moduleIds : rootOpts.moduleIds,
13 getModuleId: (_pluginOpts$getModule = pluginOpts.getModuleId) != null ? _pluginOpts$getModule : rootOpts.getModuleId,
14 moduleRoot: (_pluginOpts$moduleRoo = pluginOpts.moduleRoot) != null ? _pluginOpts$moduleRoo : rootOpts.moduleRoot
15 });
16};
17function getModuleName(rootOpts, pluginOpts) {
18 const {
19 filename,
20 filenameRelative = filename,
21 sourceRoot = pluginOpts.moduleRoot
22 } = rootOpts;
23 const {
24 moduleId,
25 moduleIds = !!moduleId,
26 getModuleId,
27 moduleRoot = sourceRoot
28 } = pluginOpts;
29 if (!moduleIds) return null;
30 if (moduleId != null && !getModuleId) {
31 return moduleId;
32 }
33 let moduleName = moduleRoot != null ? moduleRoot + "/" : "";
34 if (filenameRelative) {
35 const sourceRootReplacer = sourceRoot != null ? new RegExp("^" + sourceRoot + "/?") : "";
36 moduleName += filenameRelative.replace(sourceRootReplacer, "").replace(/\.\w*$/, "");
37 }
38 moduleName = moduleName.replace(/\\/g, "/");
39 if (getModuleId) {
40 return getModuleId(moduleName) || moduleName;
41 } else {
42 return moduleName;
43 }
44}
45
46//# sourceMappingURL=get-module-name.js.map
Note: See TracBrowser for help on using the repository browser.