rollup-plugin-local-resolve
Advanced tools
Comparing version 1.0.5 to 1.0.6
@@ -11,19 +11,19 @@ import { statSync } from 'fs'; | ||
if (importee && importer) { | ||
var basename = path.basename(importer); | ||
var directory = importer.split(basename)[0]; | ||
if (!importer) { | ||
return null; | ||
} | ||
var dirIndexFile = './' + path.join(directory + importee, 'index.js'); | ||
var basename = path.basename(importer); | ||
var directory = importer.split(basename)[0]; | ||
// TODO: This should be asynchronous | ||
var stats = statSync(dirIndexFile); | ||
var dirIndexFile = path.join(directory + importee, 'index.js'); | ||
if (stats.isFile()) { | ||
return dirIndexFile; | ||
} | ||
// TODO: This should be asynchronous | ||
var stats = statSync(dirIndexFile); | ||
return null; | ||
if (stats.isFile()) { | ||
return dirIndexFile; | ||
} | ||
return importee; | ||
return null; | ||
} | ||
@@ -30,0 +30,0 @@ }; |
@@ -15,19 +15,19 @@ 'use strict'; | ||
if (importee && importer) { | ||
var basename = path.basename(importer); | ||
var directory = importer.split(basename)[0]; | ||
if (!importer) { | ||
return null; | ||
} | ||
var dirIndexFile = './' + path.join(directory + importee, 'index.js'); | ||
var basename = path.basename(importer); | ||
var directory = importer.split(basename)[0]; | ||
// TODO: This should be asynchronous | ||
var stats = fs.statSync(dirIndexFile); | ||
var dirIndexFile = path.join(directory + importee, 'index.js'); | ||
if (stats.isFile()) { | ||
return dirIndexFile; | ||
} | ||
// TODO: This should be asynchronous | ||
var stats = fs.statSync(dirIndexFile); | ||
return null; | ||
if (stats.isFile()) { | ||
return dirIndexFile; | ||
} | ||
return importee; | ||
return null; | ||
} | ||
@@ -34,0 +34,0 @@ }; |
{ | ||
"name": "rollup-plugin-local-resolve", | ||
"version": "1.0.5", | ||
"version": "1.0.6", | ||
"description": "Resolves index.js files with Rollup", | ||
@@ -18,3 +18,3 @@ "main": "dist/rollup-plugin-local-resolve.js", | ||
"type": "git", | ||
"url": "git+https://github.com/frostney/rollup-plugin-local-resolver.git" | ||
"url": "git+https://github.com/frostney/rollup-plugin-local-resolve.git" | ||
}, | ||
@@ -35,5 +35,5 @@ "keywords": [ | ||
"bugs": { | ||
"url": "https://github.com/frostney/rollup-plugin-local-resolver/issues" | ||
"url": "https://github.com/frostney/rollup-plugin-local-resolve/issues" | ||
}, | ||
"homepage": "https://github.com/frostney/rollup-plugin-local-resolver#readme", | ||
"homepage": "https://github.com/frostney/rollup-plugin-local-resolve#readme", | ||
"devDependencies": { | ||
@@ -40,0 +40,0 @@ "ava": "^0.12.0", |
@@ -25,3 +25,7 @@ # rollup-plugin-local-resolve | ||
## Things to improve on | ||
- Check for `index.js` file asynchronously | ||
- Use absolute paths instead of relative ones to be consistent with how Rollup handles modules | ||
## License | ||
MIT, see `LICENSE` for more information |
@@ -11,21 +11,21 @@ import { statSync } from 'fs'; | ||
if (importee && importer) { | ||
const basename = path.basename(importer); | ||
const directory = importer.split(basename)[0]; | ||
if (!importer) { | ||
return null; | ||
} | ||
const dirIndexFile = './' + path.join(directory + importee, 'index.js'); | ||
const basename = path.basename(importer); | ||
const directory = importer.split(basename)[0]; | ||
// TODO: This should be asynchronous | ||
const stats = statSync(dirIndexFile); | ||
const dirIndexFile = path.join(directory + importee, 'index.js'); | ||
if (stats.isFile()) { | ||
return dirIndexFile; | ||
} | ||
// TODO: This should be asynchronous | ||
const stats = statSync(dirIndexFile); | ||
return null; | ||
if (stats.isFile()) { | ||
return dirIndexFile; | ||
} | ||
return importee; | ||
return null; | ||
}, | ||
}; | ||
} |
6126
31