@hh.ru/babel-plugin-static-value-extractor
Advanced tools
Comparing version 0.0.4 to 0.0.5
@@ -40,2 +40,13 @@ 'use strict'; | ||
var processImports = function processImports(filePath) { | ||
var defaultFileName = _path2.default.parse(filePath).ext ? '' : 'index.jsx'; | ||
var importPath = _path2.default.resolve(currentFileDir, filePath); | ||
if (_fs2.default.existsSync(importPath)) { | ||
importDeclarationPaths.push(_path2.default.resolve(importPath, defaultFileName)); | ||
} else if (_fs2.default.existsSync(importPath + '.jsx')) { | ||
importDeclarationPaths.push(importPath + '.jsx'); | ||
} | ||
}; | ||
return { | ||
@@ -94,10 +105,13 @@ Program: { | ||
if (node && node.source && !_path2.default.isAbsolute(node.source.value) && node.source.value[0] === '.') { | ||
var defaultFileName = _path2.default.parse(node.source.value).ext ? '' : 'index.jsx'; | ||
var importPath = _path2.default.resolve(currentFileDir, node.source.value); | ||
processImports(node.source.value); | ||
} | ||
} | ||
}, | ||
if (_fs2.default.existsSync(importPath)) { | ||
importDeclarationPaths.push(_path2.default.resolve(importPath, defaultFileName)); | ||
} else if (_fs2.default.existsSync(importPath + '.jsx')) { | ||
importDeclarationPaths.push(importPath + '.jsx'); | ||
} | ||
CallExpression: { | ||
enter: function enter(_ref4) { | ||
var node = _ref4.node; | ||
if (node && node.callee && _babelCore.types.isImport(node.callee)) { | ||
processImports(node.arguments[0].value); | ||
} | ||
@@ -104,0 +118,0 @@ } |
{ | ||
"name": "@hh.ru/babel-plugin-static-value-extractor", | ||
"version": "0.0.4", | ||
"version": "0.0.5", | ||
"main": "lib/index.js", | ||
@@ -5,0 +5,0 @@ "devDependencies": { |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
134294
45
332