coffee-react 2.1.0 → 2.4.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/coffee-react-transform.js +34 -13
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 879ccfa099010be355141b5f18366e3244ea7d4f
4
- data.tar.gz: 3b4f8733de395e927ec71ba6f814baf9348ea4d2
3
+ metadata.gz: f5ea63c9a4fdf8cb716f0e4ccc4392b2dd4bb0ba
4
+ data.tar.gz: 9c487805bdebe546c2d7a98ed63a815bae70a4fa
5
5
  SHA512:
6
- metadata.gz: d42e6c7c7ea7bcddf8261d39f410784eb2e526a73e1f45c0bff55442046a29fe5982679dad98581aac3fb513ffcf791fa89ca9b08e250938e04c16d48cdd6f87
7
- data.tar.gz: 04f87f82c0ab4cce302bd54d5bbaa5983bc88694390f0911335be522d40d4b389910cc8cfea5fe555989ea6d3a4756b646523aa5df9ab85f0bb7e3a6964079e6
6
+ metadata.gz: 8d5dfb56626dd8ffa4dd1376a28e4e5e2a685ec6328e309666da075e34c1399cb64a439d342cf970e9b111df22debea119645ce09b7ca5195f329cafb9bf82a9
7
+ data.tar.gz: 0cace8d1c38c61e94ecfb1aa8feb6c3ae3080be59b4d4399cf021d3e51d0d2dac824ceb97204e4f9292130dfef3b007d2786e02d3939540bec21f751a528f3f6
@@ -285,7 +285,7 @@ module.exports = function decode(str) {
285
285
  }
286
286
 
287
287
  },{}],3:[function(_dereq_,module,exports){
288
- // Generated by CoffeeScript 1.7.1
288
+ // Generated by CoffeeScript 1.9.0
289
289
  var extend, flatten, last, repeat, syntaxErrorToString, _ref, _ref1;
290
290
 
291
291
  exports.starts = function(string, literal, start) {
@@ -439,7 +439,7 @@ syntaxErrorToString = function() {
439
439
  codeLine = codeLine.slice(0, start) + colorize(codeLine.slice(start, end)) + codeLine.slice(end);
440
440
  marker = colorize(marker);
441
441
  }
442
- return "" + filename + ":" + (first_line + 1) + ":" + (first_column + 1) + ": error: " + this.message + "\n" + codeLine + "\n" + marker;
442
+ return filename + ":" + (first_line + 1) + ":" + (first_column + 1) + ": error: " + this.message + "\n" + codeLine + "\n" + marker;
443
443
  };
444
444
 
445
445
  exports.nameWhitespaceCharacter = function(string) {
@@ -596,7 +596,7 @@ module.exports = {
596
596
  wbr: true
597
597
  };
598
598
  },{}],5:[function(_dereq_,module,exports){
599
- // Generated by CoffeeScript 1.7.1
599
+ // Generated by CoffeeScript 1.9.0
600
600
  var $, BOM, CLOSING_TAG, COMMENT, HEREDOC, HEREGEX, JSTOKEN, OPENING_TAG, PRAGMA, ParseTreeBranchNode, ParseTreeLeafNode, Parser, REGEX, SIMPLESTR, TAG_ATTRIBUTES, TRAILING_SPACES, WHITESPACE, compact, count, last, repeat, starts, throwSyntaxError, _ref;
601
601
 
602
602
  _ref = _dereq_('./helpers'), count = _ref.count, starts = _ref.starts, compact = _ref.compact, last = _ref.last, repeat = _ref.repeat, throwSyntaxError = _ref.throwSyntaxError;
@@ -630,9 +630,9 @@ ParseTreeBranchNode = function(type, value, children) {
630
630
  module.exports = Parser = (function() {
631
631
  function Parser() {}
632
632
 
633
- Parser.prototype.parse = function(code, opts) {
633
+ Parser.prototype.parse = function(code, _at_opts) {
634
634
  var consumed, i, message, _ref1, _ref2;
635
- this.opts = opts != null ? opts : {};
635
+ this.opts = _at_opts != null ? _at_opts : {};
636
636
  this.parseTree = ParseTreeBranchNode(this.opts.root || $.ROOT);
637
637
  this.activeStates = [this.parseTree];
638
638
  this.chunkLine = 0;
@@ -1029,7 +1029,7 @@ REGEX = /^(\/(?![\s=])[^[\/\n\\]*(?:(?:\\[\s\S]|\[[^\]\n\\]*(?:\\[\s\S][^\]\n\\]
1029
1029
  HEREGEX = /^\/{3}((?:\\?[\s\S])+?)\/{3}([imgy]{0,4})(?!\w)/;
1030
1030
 
1031
1031
  },{"./helpers":3,"./symbols":8}],6:[function(_dereq_,module,exports){
1032
- // Generated by CoffeeScript 1.7.1
1032
+ // Generated by CoffeeScript 1.9.0
1033
1033
  var $, HTML_ELEMENTS, SPACES_ONLY, Serialiser, TEXT_LEADING_WHITESPACE, TEXT_TRAILING_WHITESPACE, WHITESPACE_ONLY, containsNewlines, entityDecode, exports, find, firstNonWhitespaceChild, genericBranchSerialiser, genericLeafSerialiser, joinList, last, nodeSerialisers, serialise, stringEscape, _ref;
1034
1034
 
1035
1035
  _ref = _dereq_('./helpers'), last = _ref.last, find = _ref.find;
@@ -1078,7 +1078,7 @@ Serialiser = (function() {
1078
1078
  };
1079
1079
 
1080
1080
  Serialiser.prototype.serialiseSpreadAndPairAttributes = function(children) {
1081
- var assigns, child, childIndex, flushPairs, pairAttrsBuffer, _i, _len, _ref1;
1081
+ var accumulatedWhitespace, assignIndex, assignItem, assigns, assignsWithWhitespace, child, childIndex, flushPairs, lastAssignWithWhitespace, pairAttrsBuffer, _i, _j, _len, _len1, _ref1;
1082
1082
  assigns = [];
1083
1083
  pairAttrsBuffer = [];
1084
1084
  flushPairs = (function(_this) {
@@ -1088,6 +1088,11 @@ Serialiser = (function() {
1088
1088
  serialisedChild = _this.serialiseAttributePairs(pairAttrsBuffer);
1089
1089
  if (serialisedChild) {
1090
1090
  assigns.push(serialisedChild);
1091
+ } else {
1092
+ assigns.push({
1093
+ type: $.CJSX_WHITESPACE,
1094
+ value: pairAttrsBuffer.map(_this.serialiseNode.bind(_this)).join('').replace('\n', '\\\n')
1095
+ });
1091
1096
  }
1092
1097
  return pairAttrsBuffer = [];
1093
1098
  }
@@ -1104,9 +1109,25 @@ Serialiser = (function() {
1104
1109
  } else {
1105
1110
  pairAttrsBuffer.push(child);
1106
1111
  }
1107
- flushPairs();
1108
1112
  }
1109
- return "React.__spread(" + (joinList(assigns)) + ")";
1113
+ flushPairs();
1114
+ accumulatedWhitespace = '';
1115
+ assignsWithWhitespace = [];
1116
+ for (assignIndex = _j = 0, _len1 = assigns.length; _j < _len1; assignIndex = ++_j) {
1117
+ assignItem = assigns[assignIndex];
1118
+ if (typeof assignItem === 'object' && (assignItem != null ? assignItem.type : void 0) === $.CJSX_WHITESPACE) {
1119
+ accumulatedWhitespace += assignItem.value;
1120
+ }
1121
+ if (typeof assignItem === 'string') {
1122
+ assignsWithWhitespace.push(accumulatedWhitespace + assignItem);
1123
+ accumulatedWhitespace = '';
1124
+ }
1125
+ }
1126
+ if (assignsWithWhitespace.length) {
1127
+ lastAssignWithWhitespace = assignsWithWhitespace.pop();
1128
+ assignsWithWhitespace.push(lastAssignWithWhitespace + accumulatedWhitespace);
1129
+ }
1130
+ return "React.__spread(" + (joinList(assignsWithWhitespace)) + ")";
1110
1131
  };
1111
1132
 
1112
1133
  Serialiser.prototype.serialiseAttributePairs = function(children) {
@@ -1173,7 +1194,7 @@ genericLeafSerialiser = function(node) {
1173
1194
  nodeSerialisers = {
1174
1195
  ROOT: genericBranchSerialiser,
1175
1196
  CJSX_PRAGMA: function() {
1176
- return null;
1197
+ return "`/** @jsx " + this.domObject + " */`";
1177
1198
  },
1178
1199
  CJSX_EL: function(node) {
1179
1200
  var accumulatedWhitespace, child, element, serialisedChild, serialisedChildren, _i, _len, _ref1;
@@ -1201,7 +1222,7 @@ nodeSerialisers = {
1201
1222
  } else {
1202
1223
  element = node.value;
1203
1224
  }
1204
- return "" + this.reactObject + ".createElement(" + element + ", " + (joinList(serialisedChildren)) + ")";
1225
+ return this.reactObject + ".createElement(" + element + ", " + (joinList(serialisedChildren)) + ")";
1205
1226
  },
1206
1227
  CJSX_ESC: function(node) {
1207
1228
  var childrenSerialised;
@@ -1368,7 +1389,7 @@ function encodeChar(inputChar, preserveNewlines) {
1368
1389
  }
1369
1390
 
1370
1391
  },{}],8:[function(_dereq_,module,exports){
1371
- // Generated by CoffeeScript 1.7.1
1392
+ // Generated by CoffeeScript 1.9.0
1372
1393
  module.exports = {
1373
1394
  ROOT: 'ROOT',
1374
1395
  CJSX_EL: 'CJSX_EL',
@@ -1395,7 +1416,7 @@ module.exports = {
1395
1416
  };
1396
1417
 
1397
1418
  },{}],9:[function(_dereq_,module,exports){
1398
- // Generated by CoffeeScript 1.7.1
1419
+ // Generated by CoffeeScript 1.9.0
1399
1420
  var Parser, serialise;
1400
1421
 
1401
1422
  Parser = _dereq_('./parser');
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: coffee-react
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0
4
+ version: 2.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Friend
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-01 00:00:00.000000000 Z
11
+ date: 2015-02-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: execjs