coffee-react 0.5.2 → 2.0.0
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.
- checksums.yaml +4 -4
- data/README.md +6 -0
- data/coffee-react-transform.js +31 -5
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 905445600e62aa5f3f97b4fa02cd3dfcc696bb1c
|
4
|
+
data.tar.gz: 23fc1d6b939116ec60179ab944558b5b966f25c4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a8ec8f1ce4fb69ecdfb2e0096ac197aaff74c6385ab3f23b7797eec46a9d56576e3b8f1d0e6755a4b4828b593944ef56e7e849ca4eae67f23ffddf08f3f64f4c
|
7
|
+
data.tar.gz: 87a81568450586805342892db37537b9d86f5b7074068349f425cf27b5612d81da0570594b329fcae1a0af2332997b4447a94c212d05982a8b27f6164687c2c9
|
data/README.md
CHANGED
data/coffee-react-transform.js
CHANGED
@@ -1030,7 +1030,7 @@ HEREGEX = /^\/{3}((?:\\?[\s\S])+?)\/{3}([imgy]{0,4})(?!\w)/;
|
|
1030
1030
|
|
1031
1031
|
},{"./helpers":3,"./symbols":8}],6:[function(_dereq_,module,exports){
|
1032
1032
|
// Generated by CoffeeScript 1.7.1
|
1033
|
-
var $, HTML_ELEMENTS, SPACES_ONLY, Serialiser, TEXT_LEADING_WHITESPACE, TEXT_TRAILING_WHITESPACE, WHITESPACE_ONLY, containsNewlines, entityDecode, exports, find, firstNonWhitespaceChild, genericBranchSerialiser, genericLeafSerialiser, last, nodeSerialisers, serialise, stringEscape, _ref;
|
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;
|
1036
1036
|
|
@@ -1050,11 +1050,18 @@ Serialiser = (function() {
|
|
1050
1050
|
function Serialiser() {}
|
1051
1051
|
|
1052
1052
|
Serialiser.prototype.serialise = function(parseTree) {
|
1053
|
+
var domObjectParts;
|
1053
1054
|
if (parseTree.children && parseTree.children.length && parseTree.children[0].type === $.CJSX_PRAGMA) {
|
1054
1055
|
this.domObject = parseTree.children[0].value;
|
1055
1056
|
} else {
|
1056
1057
|
this.domObject = 'React.DOM';
|
1057
1058
|
}
|
1059
|
+
domObjectParts = this.domObject.split('.');
|
1060
|
+
if (domObjectParts.length > 0 && domObjectParts[0] !== '') {
|
1061
|
+
this.reactObject = domObjectParts[0];
|
1062
|
+
} else {
|
1063
|
+
this.reactObject = 'React';
|
1064
|
+
}
|
1058
1065
|
return this.serialiseNode(parseTree);
|
1059
1066
|
};
|
1060
1067
|
|
@@ -1099,7 +1106,7 @@ Serialiser = (function() {
|
|
1099
1106
|
}
|
1100
1107
|
flushPairs();
|
1101
1108
|
}
|
1102
|
-
return "Object.assign(" + (assigns
|
1109
|
+
return "Object.assign(" + (joinList(assigns)) + ")";
|
1103
1110
|
};
|
1104
1111
|
|
1105
1112
|
Serialiser.prototype.serialiseAttributePairs = function(children) {
|
@@ -1169,7 +1176,7 @@ nodeSerialisers = {
|
|
1169
1176
|
return null;
|
1170
1177
|
},
|
1171
1178
|
CJSX_EL: function(node) {
|
1172
|
-
var accumulatedWhitespace, child,
|
1179
|
+
var accumulatedWhitespace, child, element, serialisedChild, serialisedChildren, _i, _len, _ref1;
|
1173
1180
|
serialisedChildren = [];
|
1174
1181
|
accumulatedWhitespace = '';
|
1175
1182
|
_ref1 = node.children;
|
@@ -1189,8 +1196,12 @@ nodeSerialisers = {
|
|
1189
1196
|
serialisedChildren[serialisedChildren.length - 1] += accumulatedWhitespace;
|
1190
1197
|
accumulatedWhitespace = '';
|
1191
1198
|
}
|
1192
|
-
|
1193
|
-
|
1199
|
+
if (HTML_ELEMENTS[node.value] != null) {
|
1200
|
+
element = '"' + node.value + '"';
|
1201
|
+
} else {
|
1202
|
+
element = node.value;
|
1203
|
+
}
|
1204
|
+
return "" + this.reactObject + ".createElement(" + element + ", " + (joinList(serialisedChildren)) + ")";
|
1194
1205
|
},
|
1195
1206
|
CJSX_ESC: function(node) {
|
1196
1207
|
var childrenSerialised;
|
@@ -1275,6 +1286,21 @@ containsNewlines = function(text) {
|
|
1275
1286
|
return text.indexOf('\n') > -1;
|
1276
1287
|
};
|
1277
1288
|
|
1289
|
+
joinList = function(items) {
|
1290
|
+
var i, output;
|
1291
|
+
output = items[items.length - 1];
|
1292
|
+
i = items.length - 2;
|
1293
|
+
while (i >= 0) {
|
1294
|
+
if (output.charAt(0) === '\n') {
|
1295
|
+
output = items[i] + ',' + output;
|
1296
|
+
} else {
|
1297
|
+
output = items[i] + ', ' + output;
|
1298
|
+
}
|
1299
|
+
i--;
|
1300
|
+
}
|
1301
|
+
return output;
|
1302
|
+
};
|
1303
|
+
|
1278
1304
|
SPACES_ONLY = /^\s+$/;
|
1279
1305
|
|
1280
1306
|
WHITESPACE_ONLY = /^[\n\s]+$/;
|
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: 0.
|
4
|
+
version: 2.0.0
|
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-
|
11
|
+
date: 2014-10-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: execjs
|