mirror of
https://github.com/jashkenas/coffeescript.git
synced 2022-11-09 12:23:24 -05:00
Remove (compiled) from filenames, to keep __filename accurate
This commit is contained in:
parent
c435647589
commit
dfd6025d04
2 changed files with 5 additions and 7 deletions
|
@ -10,8 +10,7 @@
|
||||||
require.extensions['.coffee'] = function(module, filename) {
|
require.extensions['.coffee'] = function(module, filename) {
|
||||||
var content;
|
var content;
|
||||||
content = compile(fs.readFileSync(filename, 'utf8'));
|
content = compile(fs.readFileSync(filename, 'utf8'));
|
||||||
module.filename = ("" + (filename) + " (compiled)");
|
return module._compile(content, filename);
|
||||||
return module._compile(content, module.filename);
|
|
||||||
};
|
};
|
||||||
} else if (require.registerExtension) {
|
} else if (require.registerExtension) {
|
||||||
require.registerExtension('.coffee', function(content) {
|
require.registerExtension('.coffee', function(content) {
|
||||||
|
@ -37,12 +36,12 @@
|
||||||
return parser.parse(lexer.tokenize(code));
|
return parser.parse(lexer.tokenize(code));
|
||||||
};
|
};
|
||||||
exports.run = function(code, options) {
|
exports.run = function(code, options) {
|
||||||
var __filename, root;
|
var root;
|
||||||
root = module;
|
root = module;
|
||||||
while (root.parent) {
|
while (root.parent) {
|
||||||
root = root.parent;
|
root = root.parent;
|
||||||
}
|
}
|
||||||
root.filename = (__filename = ("" + (options.fileName) + " (compiled)"));
|
root.filename = options.fileName;
|
||||||
if (root.moduleCache) {
|
if (root.moduleCache) {
|
||||||
root.moduleCache = {};
|
root.moduleCache = {};
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,8 +15,7 @@ if require.extensions
|
||||||
fs = require 'fs'
|
fs = require 'fs'
|
||||||
require.extensions['.coffee'] = (module, filename) ->
|
require.extensions['.coffee'] = (module, filename) ->
|
||||||
content = compile fs.readFileSync filename, 'utf8'
|
content = compile fs.readFileSync filename, 'utf8'
|
||||||
module.filename = "#{filename} (compiled)"
|
module._compile content, filename
|
||||||
module._compile content, module.filename
|
|
||||||
else if require.registerExtension
|
else if require.registerExtension
|
||||||
require.registerExtension '.coffee', (content) -> compile content
|
require.registerExtension '.coffee', (content) -> compile content
|
||||||
|
|
||||||
|
@ -51,7 +50,7 @@ exports.run = (code, options) ->
|
||||||
while root.parent
|
while root.parent
|
||||||
root = root.parent
|
root = root.parent
|
||||||
# Set the filename
|
# Set the filename
|
||||||
root.filename = __filename = "#{options.fileName} (compiled)"
|
root.filename = options.fileName
|
||||||
# Clear the module cache
|
# Clear the module cache
|
||||||
root.moduleCache = {} if root.moduleCache
|
root.moduleCache = {} if root.moduleCache
|
||||||
# Compile
|
# Compile
|
||||||
|
|
Loading…
Reference in a new issue