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