From 2e23e6a2dc8832e70cd9e975e4ec8e3e2d1f7753 Mon Sep 17 00:00:00 2001 From: Jeremy Ashkenas Date: Sat, 6 Mar 2010 19:05:21 -0500 Subject: [PATCH] removing narwhal.coffee and narwhal.js, because I don't think that anyone was using them. --- lib/narwhal.js | 44 -------------------------------------------- src/narwhal.coffee | 42 ------------------------------------------ 2 files changed, 86 deletions(-) delete mode 100755 lib/narwhal.js delete mode 100644 src/narwhal.coffee diff --git a/lib/narwhal.js b/lib/narwhal.js deleted file mode 100755 index 604fdd41..00000000 --- a/lib/narwhal.js +++ /dev/null @@ -1,44 +0,0 @@ -(function(){ - var coffee, factories, file, loader, os, puts; - // The Narwhal-compatibility wrapper for CoffeeScript. - // Require external dependencies. - os = require('os'); - file = require('file'); - coffee = require('./coffee-script'); - // Alias print to "puts", for Node.js compatibility: - puts = print; - // Compile a string of CoffeeScript into JavaScript. - exports.compile = function compile(source) { - return coffee.compile(source); - }; - // Compile a given CoffeeScript file into JavaScript. - exports.compileFile = function compileFile(path) { - return coffee.compile(file.read(path)); - }; - // Make a factory for the CoffeeScript environment. - exports.makeNarwhalFactory = function makeNarwhalFactory(path) { - var code, factoryText; - code = exports.compileFile(path); - factoryText = "function(require,exports,module,system,print){" + code + "/**/\n}"; - if (system.engine === "rhino") { - return Packages.org.mozilla.javascript.Context.getCurrentContext().compileFunction(global, factoryText, path, 0, null); - } else { - // eval requires parentheses, but parentheses break compileFunction. - return eval("(" + factoryText + ")"); - } - }; - // The Narwhal loader for '.coffee' files. - factories = {}; - loader = {}; - // Reload the coffee-script environment from source. - loader.reload = function reload(topId, path) { - return factories[topId] = function() { - return exports.makeNarwhalFactory(path); - }; - }; - // Ensure that the coffee-script environment is loaded. - loader.load = function load(topId, path) { - return factories[topId] = factories[topId] || this.reload(topId, path); - }; - require.loader.loaders.unshift([".coffee", loader]); -})(); diff --git a/src/narwhal.coffee b/src/narwhal.coffee deleted file mode 100644 index b1ae6c58..00000000 --- a/src/narwhal.coffee +++ /dev/null @@ -1,42 +0,0 @@ -# The Narwhal-compatibility wrapper for CoffeeScript. - -# Require external dependencies. -os: require 'os' -file: require 'file' -coffee: require './coffee-script' - -# Alias print to "puts", for Node.js compatibility: -puts: print - -# Compile a string of CoffeeScript into JavaScript. -exports.compile: (source) -> - coffee.compile source - -# Compile a given CoffeeScript file into JavaScript. -exports.compileFile: (path) -> - coffee.compile file.read path - -# Make a factory for the CoffeeScript environment. -exports.makeNarwhalFactory: (path) -> - code: exports.compileFile path - factoryText: "function(require,exports,module,system,print){$code/**/\n}" - if system.engine is "rhino" - Packages.org.mozilla.javascript.Context.getCurrentContext().compileFunction(global, factoryText, path, 0, null) - else - # eval requires parentheses, but parentheses break compileFunction. - eval "($factoryText)" - -# The Narwhal loader for '.coffee' files. -factories: {} -loader: {} - -# Reload the coffee-script environment from source. -loader.reload: (topId, path) -> - factories[topId]: -> - exports.makeNarwhalFactory path - -# Ensure that the coffee-script environment is loaded. -loader.load: (topId, path) -> - factories[topId] ||= this.reload topId, path - -require.loader.loaders.unshift [".coffee", loader]