i'm a terrible spellerer #777

This commit is contained in:
Sebastian McKenzie 2015-02-18 11:24:51 +11:00
parent 2541dcf960
commit 7e8cd2ca8a
4 changed files with 8 additions and 8 deletions

View File

@ -7,7 +7,7 @@
* **Bug Fix** * **Bug Fix**
* Fix temp variables not being properly pushed inside of `while` loops. * Fix temp variables not being properly pushed inside of `while` loops.
* **New Feature** * **New Feature**
* Add `auxilaryComment`/`--auxilary-comment` option that prepends comments to auxilary helpers. * Add `auxiliaryComment`/`--auxiliary-comment` option that prepends comments to auxiliary helpers.
## 3.6.5 ## 3.6.5

View File

@ -26,7 +26,7 @@ commander.option("-c, --remove-comments", "Remove comments from the compiled cod
commander.option("-M, --module-ids", "Insert module id in modules", false); commander.option("-M, --module-ids", "Insert module id in modules", false);
commander.option("-R, --react-compat", "Makes the react transformer produce pre-v0.12 code"); commander.option("-R, --react-compat", "Makes the react transformer produce pre-v0.12 code");
commander.option("--keep-module-id-extensions", "Keep extensions when generating module ids", false); commander.option("--keep-module-id-extensions", "Keep extensions when generating module ids", false);
commander.option("-a, --auxilary-comment [comment]", "Comment text to prepend to all auxilary code"); commander.option("-a, --auxiliary-comment [comment]", "Comment text to prepend to all auxiliary code");
commander.on("--help", function () { commander.on("--help", function () {
var outKeys = function (title, obj) { var outKeys = function (title, obj) {
@ -100,7 +100,7 @@ if (errors.length) {
exports.opts = { exports.opts = {
keepModuleIdExtensions: commander.keepModuleIdExtensions, keepModuleIdExtensions: commander.keepModuleIdExtensions,
auxilaryComment: commander.auxilaryComment, auxiliaryComment: commander.auxiliaryComment,
externalHelpers: commander.externalHelpers, externalHelpers: commander.externalHelpers,
sourceMapName: commander.outFile, sourceMapName: commander.outFile,
experimental: commander.experimental, experimental: commander.experimental,

View File

@ -87,7 +87,7 @@ File.validOptions = [
"experimental", "experimental",
"resolveModuleSource", "resolveModuleSource",
"externalHelpers", "externalHelpers",
"auxilaryComment", "auxiliaryComment",
// these are used by plugins // these are used by plugins
"ignore", "ignore",
@ -302,8 +302,8 @@ File.prototype.isConsequenceExpressionStatement = function (node) {
return t.isExpressionStatement(node) && this.lastStatements.indexOf(node) >= 0; return t.isExpressionStatement(node) && this.lastStatements.indexOf(node) >= 0;
}; };
File.prototype.attachAuxilaryComment = function (node) { File.prototype.attachAuxiliaryComment = function (node) {
var comment = this.opts.auxilaryComment; var comment = this.opts.auxiliaryComment;
if (comment) { if (comment) {
node.leadingComments = node.leadingComments || []; node.leadingComments = node.leadingComments || [];
node.leadingComments.push({ node.leadingComments.push({

View File

@ -20,7 +20,7 @@ exports.Program = function (node, parent, scope, file) {
var declarNode = t.variableDeclarator(declar.id, declar.init); var declarNode = t.variableDeclarator(declar.id, declar.init);
if (declar.init) { if (declar.init) {
node.body.unshift(file.attachAuxilaryComment(t.variableDeclaration(kind, [declarNode]))); node.body.unshift(file.attachAuxiliaryComment(t.variableDeclaration(kind, [declarNode])));
} else { } else {
kinds[kind] = kinds[kind] || []; kinds[kind] = kinds[kind] || [];
kinds[kind].push(declarNode); kinds[kind].push(declarNode);
@ -28,7 +28,7 @@ exports.Program = function (node, parent, scope, file) {
} }
for (kind in kinds) { for (kind in kinds) {
node.body.unshift(file.attachAuxilaryComment(t.variableDeclaration(kind, kinds[kind]))); node.body.unshift(file.attachAuxiliaryComment(t.variableDeclaration(kind, kinds[kind])));
} }
}); });