Skip to content
Browse files

Improved coding convention and messages.

  • Loading branch information...
1 parent 36a3e03 commit a82aecc008ef9827609f412417b0a09632ce70f2 @blmarket blmarket committed
Showing with 9 additions and 9 deletions.
  1. +4 −4 lib/coffee-script/coffee-script.js
  2. +5 −5 src/coffee-script.coffee
View
8 lib/coffee-script/coffee-script.js
@@ -1,6 +1,6 @@
// Generated by CoffeeScript 1.7.1
(function() {
- var Lexer, SourceMap, compile, ext, formatSourcePosition, fs, getSourceMap, helpers, lexer, parser, path, sourceMaps, vm, withPrettyErrors, _i, _len, _ref,
+ var Lexer, SourceMap, compile, ext, formatSourcePosition, fs, getSourceMap, helpers, lexer, parser, path, sourceMaps, vm, withPrettyErrors, _base, _i, _len, _ref,
__hasProp = {}.hasOwnProperty,
__indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };
@@ -190,9 +190,9 @@
_ref = this.FILE_EXTENSIONS;
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
ext = _ref[_i];
- if (require.extensions[ext] == null) {
- require.extensions[ext] = function() {
- throw new Error('Use CoffeeScript.register() or the coffee-script/register module to dynamically load CoffeeScript files');
+ if ((_base = require.extensions)[ext] == null) {
+ _base[ext] = function() {
+ throw new Error("Use CoffeeScript.register() or require the coffee-script/register module to require " + ext + " files.");
};
}
}
View
10 src/coffee-script.coffee
@@ -158,13 +158,13 @@ exports.eval = (code, options = {}) ->
exports.register = -> require './register'
-# Throw Error to register extension explicitly.
+# Throw error with deprecation warning when depending upon implicit `require.extensions` registration
if require.extensions
for ext in @FILE_EXTENSIONS
- unless require.extensions[ext]?
- require.extensions[ext] = ->
- throw new Error('''Use CoffeeScript.register() or the coffee-script/register module \
- to dynamically load CoffeeScript files''')
+ require.extensions[ext] ?= ->
+ throw new Error """
+ Use CoffeeScript.register() or require the coffee-script/register module to require #{ext} files.
+ """
exports._compileFile = (filename, sourceMap = no) ->
raw = fs.readFileSync filename, 'utf8'

0 comments on commit a82aecc

Please sign in to comment.
Something went wrong with that request. Please try again.