Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/twbs/rewire.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorOded Niv <oded.niv@gmail.com>2018-01-16 14:36:19 +0300
committerOded Niv <oded.niv@gmail.com>2018-01-16 14:36:19 +0300
commit1250667cb3f2adeb8546ef3088d8d053ad26d456 (patch)
tree26fb291a4a609a097fb0cc00387df167d1186363 /lib
parent18c5d0e09ef0f6cf666d664fbbf74435e190f23c (diff)
use 'coffeescript' package
Diffstat (limited to 'lib')
-rw-r--r--lib/moduleEnv.js13
1 files changed, 11 insertions, 2 deletions
diff --git a/lib/moduleEnv.js b/lib/moduleEnv.js
index a9f410a..2f9743c 100644
--- a/lib/moduleEnv.js
+++ b/lib/moduleEnv.js
@@ -89,6 +89,10 @@ function jsExtension(module, filename) {
}
function coffeeExtension(module, filename) {
+ if (!coffee) {
+ throw new Error("please add 'coffeescript' to your devDependencies");
+ }
+
var content = stripBOM(fs.readFileSync(filename, "utf8"));
restoreExtensions();
@@ -113,9 +117,14 @@ function stripBOM(content) {
}
try {
- coffee = require("coffee-script");
+ coffee = require("coffeescript");
} catch (err) {
- // We are not able to provide coffee-script support, but that's ok as long as the user doesn't want it.
+ try {
+ // Trying to load deprecated package
+ coffee = require("coffee-script");
+ } catch (err) {
+ // We are not able to provide coffee-script support, but that's ok as long as the user doesn't want it.
+ }
}
exports.load = load;