babel-deps
Advanced tools
Comparing version 0.1.0 to 0.1.1
28
index.js
@@ -35,15 +35,9 @@ 'use strict'; | ||
function fetchDependency(source, filename) { | ||
var dep = source; | ||
if (dep.substr(dep.length - 3) !== '.js') { | ||
dep += '.js'; | ||
} | ||
if (dep[0] === '.') { | ||
dep = path.resolve(path.dirname(filename), dep); | ||
} | ||
if (!hasFile[dep]) { | ||
var fullPath = getFullPath(source, filename); | ||
if (!hasFile[fullPath]) { | ||
filesToCompile.push({ | ||
contents: fs.readFileSync(dep, 'utf8'), | ||
options: {filename: dep} | ||
contents: fs.readFileSync(fullPath, 'utf8'), | ||
options: {filename: fullPath} | ||
}); | ||
hasFile[dep] = true; | ||
hasFile[fullPath] = true; | ||
} | ||
@@ -53,2 +47,13 @@ return source; | ||
function getFullPath(source, filename) { | ||
var fullPath = source; | ||
if (fullPath.substr(fullPath.length - 3) !== '.js') { | ||
fullPath += '.js'; | ||
} | ||
if (fullPath[0] === '.') { | ||
fullPath = path.resolve(path.dirname(filename), fullPath); | ||
} | ||
return fullPath; | ||
} | ||
function normalizeOptions(options) { | ||
@@ -67,1 +72,2 @@ if (options.resolveModuleSource) { | ||
module.exports = compileFiles; | ||
module.exports.getFullPath = getFullPath; |
{ | ||
"name": "babel-deps", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"description": "Compiles javascript files and all their dependencies with babel.", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
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
4739
62