mirror of
https://github.com/jashkenas/coffeescript.git
synced 2022-11-09 12:23:24 -05:00
removing fiddling with require.paths from CoffeeScript
This commit is contained in:
parent
60b3103314
commit
119b80d449
17 changed files with 31 additions and 33 deletions
2
Cakefile
2
Cakefile
|
@ -1,5 +1,5 @@
|
|||
fs: require 'fs'
|
||||
CoffeeScript: require 'coffee-script'
|
||||
CoffeeScript: require './lib/coffee-script'
|
||||
|
||||
# Run a CoffeeScript through our node/coffee interpreter.
|
||||
run: (args) ->
|
||||
|
|
3
bin/cake
3
bin/cake
|
@ -5,5 +5,4 @@ var path = require('path');
|
|||
var fs = require('fs');
|
||||
var lib = path.join(path.dirname(fs.realpathSync(__filename)), '../lib');
|
||||
|
||||
require.paths.unshift(lib);
|
||||
require('cake').run();
|
||||
require('./../lib/cake').run();
|
||||
|
|
|
@ -5,5 +5,4 @@ var path = require('path');
|
|||
var fs = require('fs');
|
||||
var lib = path.join(path.dirname(fs.realpathSync(__filename)), '../lib');
|
||||
|
||||
require.paths.unshift(lib);
|
||||
require('command').run();
|
||||
require('./../lib/command').run();
|
||||
|
|
|
@ -10,8 +10,8 @@
|
|||
// External dependencies.
|
||||
fs = require('fs');
|
||||
path = require('path');
|
||||
optparse = require('optparse');
|
||||
CoffeeScript = require('coffee-script');
|
||||
optparse = require('./optparse');
|
||||
CoffeeScript = require('./coffee-script');
|
||||
// Keep track of the list of defined tasks, the accepted options, and so on.
|
||||
tasks = {};
|
||||
options = {};
|
||||
|
|
|
@ -8,10 +8,10 @@
|
|||
// execute all scripts present in `text/coffeescript` tags.
|
||||
// Set up dependencies correctly for both the server and the browser.
|
||||
if ((typeof process !== "undefined" && process !== null)) {
|
||||
process.mixin(require('nodes'));
|
||||
process.mixin(require('./nodes'));
|
||||
path = require('path');
|
||||
Lexer = require('lexer').Lexer;
|
||||
parser = require('parser').parser;
|
||||
Lexer = require('./lexer').Lexer;
|
||||
parser = require('./parser').parser;
|
||||
} else {
|
||||
this.exports = (this.CoffeeScript = {});
|
||||
Lexer = this.Lexer;
|
||||
|
|
|
@ -8,8 +8,8 @@
|
|||
// External dependencies.
|
||||
fs = require('fs');
|
||||
path = require('path');
|
||||
optparse = require('optparse');
|
||||
CoffeeScript = require('coffee-script');
|
||||
optparse = require('./optparse');
|
||||
CoffeeScript = require('./coffee-script');
|
||||
// The help banner that is printed when `coffee` is called without arguments.
|
||||
BANNER = "coffee compiles CoffeeScript source files into JavaScript.\n\nUsage:\n coffee path/to/script.coffee";
|
||||
// The list of all the valid option flags that `coffee` knows how to handle.
|
||||
|
@ -31,7 +31,7 @@
|
|||
return version();
|
||||
}
|
||||
if (options.interactive) {
|
||||
return require('repl');
|
||||
return require('./repl');
|
||||
}
|
||||
if (options.stdio) {
|
||||
return compile_stdio();
|
||||
|
|
|
@ -8,8 +8,8 @@
|
|||
// Which is a format that can be fed directly into [Jison](http://github.com/zaach/jison).
|
||||
// Set up the Lexer for both Node.js and the browser, depending on where we are.
|
||||
if ((typeof process !== "undefined" && process !== null)) {
|
||||
Rewriter = require('rewriter').Rewriter;
|
||||
helpers = require('helpers').helpers;
|
||||
Rewriter = require('./rewriter').Rewriter;
|
||||
helpers = require('./helpers').helpers;
|
||||
} else {
|
||||
this.exports = this;
|
||||
Rewriter = this.Rewriter;
|
||||
|
|
|
@ -14,8 +14,8 @@
|
|||
// Set up for both **Node.js** and the browser, by
|
||||
// including the [Scope](scope.html) class.
|
||||
if ((typeof process !== "undefined" && process !== null)) {
|
||||
Scope = require('scope').Scope;
|
||||
helpers = require('helpers').helpers;
|
||||
Scope = require('./scope').Scope;
|
||||
helpers = require('./helpers').helpers;
|
||||
} else {
|
||||
this.exports = this;
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
// Using it looks like this:
|
||||
// coffee> puts "$num bottles of beer" for num in [99..1]
|
||||
// Require the **coffee-script** module to get access to the compiler.
|
||||
CoffeeScript = require('coffee-script');
|
||||
CoffeeScript = require('./coffee-script');
|
||||
// Our prompt.
|
||||
prompt = 'coffee> ';
|
||||
// Quick alias for quitting the REPL.
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
// add implicit indentation and parentheses, balance incorrect nestings, and
|
||||
// generally clean things up.
|
||||
// Set up exported variables for both Node.js and the browser.
|
||||
(typeof process !== "undefined" && process !== null) ? (helpers = require('helpers').helpers) : (this.exports = this);
|
||||
(typeof process !== "undefined" && process !== null) ? (helpers = require('./helpers').helpers) : (this.exports = this);
|
||||
// Import the helpers we need.
|
||||
include = helpers.include;
|
||||
// The **Rewriter** class is used by the [Lexer](lexer.html), directly against
|
||||
|
|
|
@ -9,8 +9,8 @@
|
|||
# External dependencies.
|
||||
fs: require 'fs'
|
||||
path: require 'path'
|
||||
optparse: require 'optparse'
|
||||
CoffeeScript: require 'coffee-script'
|
||||
optparse: require './optparse'
|
||||
CoffeeScript: require './coffee-script'
|
||||
|
||||
# Keep track of the list of defined tasks, the accepted options, and so on.
|
||||
tasks: {}
|
||||
|
|
|
@ -8,10 +8,10 @@
|
|||
|
||||
# Set up dependencies correctly for both the server and the browser.
|
||||
if process?
|
||||
process.mixin require 'nodes'
|
||||
process.mixin require './nodes'
|
||||
path: require 'path'
|
||||
Lexer: require('lexer').Lexer
|
||||
parser: require('parser').parser
|
||||
Lexer: require('./lexer').Lexer
|
||||
parser: require('./parser').parser
|
||||
else
|
||||
this.exports: this.CoffeeScript: {}
|
||||
Lexer: this.Lexer
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
# External dependencies.
|
||||
fs: require 'fs'
|
||||
path: require 'path'
|
||||
optparse: require 'optparse'
|
||||
CoffeeScript: require 'coffee-script'
|
||||
optparse: require './optparse'
|
||||
CoffeeScript: require './coffee-script'
|
||||
|
||||
# The help banner that is printed when `coffee` is called without arguments.
|
||||
BANNER: '''
|
||||
|
@ -47,7 +47,7 @@ exports.run: ->
|
|||
parse_options()
|
||||
return usage() if options.help
|
||||
return version() if options.version
|
||||
return require 'repl' if options.interactive
|
||||
return require './repl' if options.interactive
|
||||
return compile_stdio() if options.stdio
|
||||
return compile_script 'console', sources[0] if options.eval
|
||||
return usage() unless sources.length
|
||||
|
|
|
@ -9,8 +9,8 @@
|
|||
|
||||
# Set up the Lexer for both Node.js and the browser, depending on where we are.
|
||||
if process?
|
||||
Rewriter: require('rewriter').Rewriter
|
||||
helpers: require('helpers').helpers
|
||||
Rewriter: require('./rewriter').Rewriter
|
||||
helpers: require('./helpers').helpers
|
||||
else
|
||||
this.exports: this
|
||||
Rewriter: this.Rewriter
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
# Set up for both **Node.js** and the browser, by
|
||||
# including the [Scope](scope.html) class.
|
||||
if process?
|
||||
Scope: require('scope').Scope
|
||||
helpers: require('helpers').helpers
|
||||
Scope: require('./scope').Scope
|
||||
helpers: require('./helpers').helpers
|
||||
else
|
||||
this.exports: this
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
# coffee> puts "$num bottles of beer" for num in [99..1]
|
||||
|
||||
# Require the **coffee-script** module to get access to the compiler.
|
||||
CoffeeScript: require 'coffee-script'
|
||||
CoffeeScript: require './coffee-script'
|
||||
|
||||
# Our prompt.
|
||||
prompt: 'coffee> '
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
# Set up exported variables for both Node.js and the browser.
|
||||
if process?
|
||||
helpers: require('helpers').helpers
|
||||
helpers: require('./helpers').helpers
|
||||
else
|
||||
this.exports: this
|
||||
|
||||
|
|
Loading…
Reference in a new issue