coffee-react 3.0.0 → 3.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +2 -3
  3. data/coffee-react-transform.js +28 -13
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f8a515b02275f255110abe5a0bbe63e5d4b1d2ea
4
- data.tar.gz: 1a614989e9196b5f191c4569036cc7ffccc9aff5
3
+ metadata.gz: 074c1cabd8126d6fc9769880963d4c6a3caf371d
4
+ data.tar.gz: 6134f73dd4c6e6dabbc0ace03b0565486eb94b41
5
5
  SHA512:
6
- metadata.gz: f15c5577d945ab15a494e237e43fff06b1d7bc3fb66dcd94711aeb6afb6a33729d9302f6b313e17fdebd81cf3ce2f58af48547cbdae92b0c31cd4b09e7686947
7
- data.tar.gz: 2a7cb5ece216e1daf9e2d7c1f8152f00589555f157f6b2f0339bd555359c8ca10a05d185db8b304d7e5deeb575fc290068f670f0a721ac5309d49b2d48f8d098
6
+ metadata.gz: 0ac1a198e414e3dc97b1d391bb219ba746de070ba0d224fc22f59e14c0ca8bf9fb676a0696002c9b27fbf87795259da00a75d7bc80ed02bb07a1f6707ecb6a84
7
+ data.tar.gz: 3caff90e35ba9afeb8b9693274281a437b8fae7e82afedc1506987674b577b4cec4269107fbe776a33f4a6a9725125099ff4d208483d03a9c28274bfa56b5533
data/README.md CHANGED
@@ -14,9 +14,8 @@ Installation
14
14
 
15
15
  Compatibility
16
16
  ------------
17
- ruby-coffee-react 2.x is compatible with react ^0.12.0
18
-
19
- ruby-coffee-react 0.x is compatible with react <=0.11.2
17
+ The version numbers of this gem follow those of the `coffee-react-transform` npm
18
+ package. See information about [compatibility with different versions of React](https://github.com/jsdf/coffee-react-transform#version-compatibility).
20
19
 
21
20
  Dependencies
22
21
  ------------
@@ -950,20 +950,26 @@ Serialiser = (function() {
950
950
  };
951
951
 
952
952
  Serialiser.prototype.serialiseSpreadAndPairAttributes = function(children) {
953
- var accumulatedWhitespace, assignIndex, assignItem, assigns, assignsWithWhitespace, child, childIndex, flushPairs, lastAssignWithWhitespace, pairAttrsBuffer, _i, _j, _len, _len1, _ref1;
953
+ var accumulatedWhitespace, assignIndex, assignItem, assigns, assignsWithWhitespace, child, childIndex, flushPairs, joinedAssigns, lastAssignWithWhitespace, pairAttrsBuffer, trailingWhiteplace, _i, _j, _len, _len1, _ref1;
954
954
  assigns = [];
955
955
  pairAttrsBuffer = [];
956
956
  flushPairs = (function(_this) {
957
957
  return function() {
958
- var serialisedChild;
958
+ var serialisedChild, serialisedPairs;
959
959
  if (pairAttrsBuffer.length) {
960
960
  serialisedChild = _this.serialiseAttributePairs(pairAttrsBuffer);
961
961
  if (serialisedChild) {
962
- assigns.push(serialisedChild);
962
+ assigns.push({
963
+ type: $.CS,
964
+ value: serialisedChild
965
+ });
963
966
  } else {
967
+ serialisedPairs = pairAttrsBuffer.map(function(p) {
968
+ return _this.serialiseNode(p);
969
+ }).join('').replace('\n', '\\\n');
964
970
  assigns.push({
965
971
  type: $.CJSX_WHITESPACE,
966
- value: pairAttrsBuffer.map(_this.serialiseNode.bind(_this)).join('').replace('\n', '\\\n')
972
+ value: serialisedPairs
967
973
  });
968
974
  }
969
975
  return pairAttrsBuffer = [];
@@ -971,13 +977,19 @@ Serialiser = (function() {
971
977
  };
972
978
  })(this);
973
979
  if (((_ref1 = firstNonWhitespaceChild(children)) != null ? _ref1.type : void 0) === $.CJSX_ATTR_SPREAD) {
974
- assigns.push('{}');
980
+ assigns.push({
981
+ type: $.CS,
982
+ value: '{}'
983
+ });
975
984
  }
976
985
  for (childIndex = _i = 0, _len = children.length; _i < _len; childIndex = ++_i) {
977
986
  child = children[childIndex];
978
987
  if (child.type === $.CJSX_ATTR_SPREAD) {
979
988
  flushPairs();
980
- assigns.push(child.value);
989
+ assigns.push({
990
+ type: $.CS,
991
+ value: child.value
992
+ });
981
993
  } else {
982
994
  pairAttrsBuffer.push(child);
983
995
  }
@@ -987,18 +999,21 @@ Serialiser = (function() {
987
999
  assignsWithWhitespace = [];
988
1000
  for (assignIndex = _j = 0, _len1 = assigns.length; _j < _len1; assignIndex = ++_j) {
989
1001
  assignItem = assigns[assignIndex];
990
- if (typeof assignItem === 'object' && (assignItem != null ? assignItem.type : void 0) === $.CJSX_WHITESPACE) {
991
- accumulatedWhitespace += assignItem.value;
992
- }
993
- if (typeof assignItem === 'string') {
994
- assignsWithWhitespace.push(accumulatedWhitespace + assignItem);
995
- accumulatedWhitespace = '';
1002
+ if (assignItem != null) {
1003
+ if (assignItem.type === $.CJSX_WHITESPACE) {
1004
+ accumulatedWhitespace += this.serialiseNode(assignItem);
1005
+ } else {
1006
+ assignsWithWhitespace.push(accumulatedWhitespace + this.serialiseNode(assignItem));
1007
+ accumulatedWhitespace = '';
1008
+ }
996
1009
  }
997
1010
  }
998
1011
  if (assignsWithWhitespace.length) {
999
1012
  lastAssignWithWhitespace = assignsWithWhitespace.pop();
1000
- assignsWithWhitespace.push(lastAssignWithWhitespace + accumulatedWhitespace);
1013
+ trailingWhiteplace = accumulatedWhitespace.replace('\\\n', '\n');
1014
+ assignsWithWhitespace.push(lastAssignWithWhitespace + trailingWhiteplace);
1001
1015
  }
1016
+ joinedAssigns = joinList(assignsWithWhitespace);
1002
1017
  return "React.__spread(" + (joinList(assignsWithWhitespace)) + ")";
1003
1018
  };
1004
1019
 
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: 3.0.0
4
+ version: 3.0.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: 2015-03-17 00:00:00.000000000 Z
11
+ date: 2015-03-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: execjs