1 | 'use strict';
|
2 |
|
3 | const path = require('path');
|
4 | const ensurePosix = require('ensure-posix-path');
|
5 | const { moduleResolve } = require('amd-name-resolver');
|
6 |
|
7 | const BASE_DIR = path.resolve(`${__dirname}/..`);
|
8 |
|
9 | function getRelativeModulePath(modulePath) {
|
10 | return ensurePosix(path.relative(process.cwd(), modulePath));
|
11 | }
|
12 |
|
13 | function resolveRelativeModulePath(name, child) {
|
14 | return moduleResolve(name, getRelativeModulePath(child));
|
15 | }
|
16 |
|
17 | module.exports = {
|
18 | getRelativeModulePath,
|
19 | resolveRelativeModulePath
|
20 | };
|
21 |
|
22 | Object.keys(module.exports).forEach((key) => {
|
23 | module.exports[key].baseDir = () => BASE_DIR;
|
24 |
|
25 | module.exports[key]._parallelBabel = {
|
26 | requireFile: __filename,
|
27 | useMethod: key
|
28 | };
|
29 | });
|