1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 | 'use strict';
|
8 |
|
9 | var path = require('path');
|
10 |
|
11 | function requirePaths(parentModule, paths) {
|
12 | if (!parentModule) {
|
13 | return paths;
|
14 | }
|
15 |
|
16 | return paths.slice(0).map(function(p) {
|
17 | return path.resolve(parentModule.filepath, p);
|
18 | });
|
19 | }
|
20 |
|
21 | exports.before = function before(targetPath, parentModule, opts) {
|
22 | var resolvedPaths = requirePaths(parentModule, opts);
|
23 | return 'module.paths = ' + JSON.stringify(resolvedPaths) + '.concat(module.paths);\n';
|
24 | };
|
25 |
|
26 | exports.after = function after(targetPath, parentModule, opts) {
|
27 | return '';
|
28 | };
|