1 | 'use strict';
|
2 |
|
3 | Object.defineProperty(exports, "__esModule", {
|
4 | value: true
|
5 | });
|
6 |
|
7 | exports.default = function (_ref) {
|
8 | var t = _ref.types;
|
9 |
|
10 | var BabelRootImport = function BabelRootImport() {
|
11 | _classCallCheck(this, BabelRootImport);
|
12 |
|
13 | var that = this;
|
14 | return {
|
15 | visitor: {
|
16 | ImportDeclaration: function ImportDeclaration(path, state) {
|
17 | var givenPath = path.node.source.value;
|
18 |
|
19 | var rootPathSuffix = state && state.opts && typeof state.opts.rootPathSuffix === 'string' ? '/' + state.opts.rootPathSuffix.replace(/^(\/)|(\/)$/g, '') : '';
|
20 |
|
21 | if ((0, _helper2.default)().hasRoot(givenPath)) {
|
22 | path.node.source.value = (0, _helper2.default)().transformRelativeToRootPath(givenPath, rootPathSuffix);
|
23 | }
|
24 | }
|
25 | }
|
26 | };
|
27 | };
|
28 |
|
29 |
|
30 |
|
31 |
|
32 |
|
33 |
|
34 |
|
35 | if (global.meteorBabelHelpers) {
|
36 | return {
|
37 | visitor: {}
|
38 | };
|
39 | }
|
40 |
|
41 | return new BabelRootImport();
|
42 | };
|
43 |
|
44 | var _helper = require('./helper');
|
45 |
|
46 | var _helper2 = _interopRequireDefault(_helper);
|
47 |
|
48 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
49 |
|
50 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } |
\ | No newline at end of file |