Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

added a sourceURL comment that provides context in certain environments

Also, this is the first rebuild since beta 1, so the comment at the top
has been updated.
  • Loading branch information...
commit 435f874637a29f47006b534b1b6c905c3ad9cde7 1 parent d39a7cf
@michaelficarra authored
View
4 Makefile
@@ -36,12 +36,12 @@ lib/coffee-script/parser.js: src/grammar.pegjs bootstraps lib/coffee-script
lib/coffee-script/bootstrap/parser.js: src/grammar.pegjs lib/coffee-script/bootstrap
$(PEGJS) <"$<" >"$@"
lib/coffee-script/bootstrap/%.js: src/%.coffee lib/coffee-script/bootstrap
- $(COFFEE) <"$<" >"$@"
+ $(COFFEE) -i "$<" >"$@"
bootstraps: $(BOOTSTRAPS) lib/coffee-script/bootstrap
mv lib/coffee-script/bootstrap/* lib/coffee-script
rmdir lib/coffee-script/bootstrap
lib/coffee-script/%.js: src/%.coffee lib/coffee-script/bootstrap/%.js bootstraps lib/coffee-script
- $(COFFEE) <"$<" >"$(@:%=%.tmp)" && mv "$(@:%=%.tmp)" "$@"
+ $(COFFEE) -i "$<" >"$(@:%=%.tmp)" && mv "$(@:%=%.tmp)" "$@"
CoffeeScriptRedux.js: $(LIB)
View
26 lib/coffee-script/command.js
@@ -1,4 +1,4 @@
-// Generated by CoffeeScript 2.0.0-dev
+// Generated by CoffeeScript 2.0.0-beta1
var $0, $0, additionalArgs, additionalArgs, additionalArgs, arg, args, CoffeeScript, concat, cscodegen, escodegen, esmangle, foldl, formatOptions, fs, humanReadable, input, input, inputSource, inspect, leftColumnWidth, longOptionArguments, longParameterArguments, match, match, match, maxWidth, numberLines, o, o, o, Optimiser, optionArguments, optionMap, optionRows, options, opts, opts, parameterArguments, parameterRows, path, pkg, positionalArgs, positionalArgs, Preprocessor, processInput, reLongOption, reLongParameter, reShortOptions, reShortOptionsShortParameter, reShortParameter, row, rows, runMain, shortOptionArguments, shortParameterArguments, wrap;
fs = require('fs');
path = require('path');
@@ -463,20 +463,29 @@ if (options.help) {
}
try {
js = CoffeeScript.js(jsAST, { compact: options.minify });
+ if (null != options.input)
+ js = '' + js + '\n//@ sourceURL=' + options.input;
} catch (e$5) {
e = e$5;
console.error(e.stack || e.message);
process.exit(1);
}
- if (options.js)
- if (null != js) {
- console.log(js);
- process.exit(0);
- } else {
+ if (options.js) {
+ if (!(null != js))
process.exit(1);
- }
- if (options['eval'])
+ console.log(js);
+ return process.exit(0);
+ } else if (options.output) {
+ if (!(null != js))
+ process.exit(1);
+ return fs.writeFile(options.output, js, function (err) {
+ if (null != err)
+ throw err;
+ return process.exit(0);
+ });
+ } else if (options['eval']) {
return runMain(input, js, jsAST, inputSource);
+ }
};
if (null != options.input) {
fs.stat(options.input, function (err, stats) {
@@ -511,3 +520,4 @@ function in$(member, list) {
return true;
return false;
}
+//@ sourceURL=src/command.coffee
View
3  lib/coffee-script/compiler.js
@@ -1,4 +1,4 @@
-// Generated by CoffeeScript 2.0.0-dev
+// Generated by CoffeeScript 2.0.0-beta1
var any, assignment, beingDeclared, collectIdentifiers, concat, concatMap, CS, declarationsNeeded, declarationsNeededRecursive, difference, divMod, dynamicMemberAccess, enabledHelpers, envEnrichments, exports, expr, fn, fn, foldl1, forceBlock, generateMutatingWalker, generateSoak, genSym, h, h, hasSoak, helperNames, helpers, inlineHelpers, isIdentifierName, JS, jsReserved, makeReturn, makeVarDeclaration, map, memberAccess, needsCaching, nub, owns, partition, span, stmt, union, usedAsExpression;
cache$ = require('./functional-helpers');
any = cache$.any;
@@ -2324,3 +2324,4 @@ function in$(member, list) {
function isOwn$(o, p) {
return {}.hasOwnProperty.call(o, p);
}
+//@ sourceURL=src/compiler.coffee
View
3  lib/coffee-script/functional-helpers.js
@@ -1,4 +1,4 @@
-// Generated by CoffeeScript 2.0.0-dev
+// Generated by CoffeeScript 2.0.0-beta1
var concat, foldl, map, nub, span;
this.any = function (list, fn) {
var e;
@@ -153,3 +153,4 @@ function in$(member, list) {
return true;
return false;
}
+//@ sourceURL=src/functional-helpers.coffee
View
3  lib/coffee-script/helpers.js
@@ -1,4 +1,4 @@
-// Generated by CoffeeScript 2.0.0-dev
+// Generated by CoffeeScript 2.0.0-beta1
var beingDeclared, cleanMarkers, concat, concatMap, CS, difference, envEnrichments, envEnrichments_, foldl, humanReadable, map, nub, numberLines, pointToErrorLocation, usedAsExpression, usedAsExpression_;
cache$ = require('./functional-helpers');
concat = cache$.concat;
@@ -171,3 +171,4 @@ function in$(member, list) {
return true;
return false;
}
+//@ sourceURL=src/helpers.coffee
View
3  lib/coffee-script/js-nodes.js
@@ -1,4 +1,4 @@
-// Generated by CoffeeScript 2.0.0-dev
+// Generated by CoffeeScript 2.0.0-beta1
var ArrayExpression, AssignmentExpression, BinaryExpression, BlockStatement, CallExpression, createNode, ctor, difference, exports, FunctionDeclaration, FunctionExpression, GenSym, handleLists, handlePrimitives, Identifier, isStatement, Literal, MemberExpression, NewExpression, node, nodeData, Nodes, ObjectExpression, params, Program, SequenceExpression, SwitchCase, SwitchStatement, TryStatement, UnaryExpression, UpdateExpression, VariableDeclaration, VariableDeclaration;
difference = require('./functional-helpers').difference;
exports = null != ('undefined' !== typeof module && null != module ? module.exports : void 0) ? 'undefined' !== typeof module && null != module ? module.exports : void 0 : this;
@@ -467,3 +467,4 @@ function in$(member, list) {
return true;
return false;
}
+//@ sourceURL=src/js-nodes.coffee
View
3  lib/coffee-script/module.js
@@ -1,4 +1,4 @@
-// Generated by CoffeeScript 2.0.0-dev
+// Generated by CoffeeScript 2.0.0-beta1
var CoffeeScript, Compiler, cscodegen, escodegen, escodegenCompactDefaults, escodegenFormatDefaults, formatParserError, fs, Nodes, Optimiser, Parser, path, pkg, Preprocessor;
fs = require('fs');
path = require('path');
@@ -106,3 +106,4 @@ module.exports = {
};
CoffeeScript = module.exports.CoffeeScript = module.exports;
require('./run');
+//@ sourceURL=src/module.coffee
View
3  lib/coffee-script/nodes.js
@@ -1,4 +1,4 @@
-// Generated by CoffeeScript 2.0.0-dev
+// Generated by CoffeeScript 2.0.0-beta1
var ArrayInitialiser, Block, Bool, Class, CompoundAssignOp, concat, concatMap, Conditional, createNodes, difference, exports, ForOf, FunctionApplications, Functions, GenSym, handleLists, handlePrimitives, HeregExp, Identifier, Identifiers, map, NegatedConditional, NewOp, Nodes, nub, ObjectInitialiser, Primitives, Range, RegExp, RegExps, Slice, StaticMemberAccessOps, Super, Switch, SwitchCase, union, While;
cache$ = require('./functional-helpers');
map = cache$.map;
@@ -585,3 +585,4 @@ function in$(member, list) {
return true;
return false;
}
+//@ sourceURL=src/nodes.coffee
View
3  lib/coffee-script/optimiser.js
@@ -1,4 +1,4 @@
-// Generated by CoffeeScript 2.0.0-dev
+// Generated by CoffeeScript 2.0.0-beta1
var all, any, beingDeclared, concat, concatMap, CS, declarationsFor, difference, envEnrichments, exports, foldl, foldl1, isFalsey, isTruthy, makeDispatcher, mayHaveSideEffects, union, usedAsExpression;
cache$ = require('./functional-helpers');
all = cache$.all;
@@ -807,3 +807,4 @@ function in$(member, list) {
return true;
return false;
}
+//@ sourceURL=src/optimiser.coffee
View
3  lib/coffee-script/preprocessor.js
@@ -1,4 +1,4 @@
-// Generated by CoffeeScript 2.0.0-dev
+// Generated by CoffeeScript 2.0.0-beta1
var EventEmitter, fs, inspect, pointToErrorLocation, Preprocessor, StringScanner;
fs = require('fs');
EventEmitter = require('events').EventEmitter;
@@ -329,3 +329,4 @@ function extends$(child, parent) {
child.__super__ = parent.prototype;
return child;
}
+//@ sourceURL=src/preprocessor.coffee
View
3  lib/coffee-script/run.js
@@ -1,4 +1,4 @@
-// Generated by CoffeeScript 2.0.0-dev
+// Generated by CoffeeScript 2.0.0-beta1
var CoffeeScript, formatSourcePosition, fs, Module, patched, patchStackTrace, path, runModule, SourceMapConsumer;
fs = require('fs');
path = require('path');
@@ -106,3 +106,4 @@ require.extensions['.coffee'] = function (module, filename) {
js = CoffeeScript.js(jsAst);
return runModule(module, js, jsAst, filename);
};
+//@ sourceURL=src/run.coffee
View
19 src/command.coffee
@@ -320,20 +320,29 @@ else
else process.exit 1
# js code gen
- try js = CoffeeScript.js jsAST, compact: options.minify
+ try
+ js = CoffeeScript.js jsAST, compact: options.minify
+ if options.input?
+ js = "#{js}\n//@ sourceURL=#{options.input}"
catch e
console.error (e.stack or e.message)
process.exit 1
# --js
if options.js
- if js?
- console.log js
+ process.exit 1 unless js?
+ console.log js
+ process.exit 0
+
+ # --output
+ else if options.output
+ process.exit 1 unless js?
+ fs.writeFile options.output, js, (err) ->
+ throw err if err?
process.exit 0
- else process.exit 1
# --eval
- if options.eval
+ else if options.eval
runMain input, js, jsAST, inputSource
# choose input source

0 comments on commit 435f874

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