coffee-react 2.4.1 → 3.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/coffee-react-transform.js +30 -152
- 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: f8a515b02275f255110abe5a0bbe63e5d4b1d2ea
|
|
4
|
+
data.tar.gz: 1a614989e9196b5f191c4569036cc7ffccc9aff5
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f15c5577d945ab15a494e237e43fff06b1d7bc3fb66dcd94711aeb6afb6a33729d9302f6b313e17fdebd81cf3ce2f58af48547cbdae92b0c31cd4b09e7686947
|
|
7
|
+
data.tar.gz: 2a7cb5ece216e1daf9e2d7c1f8152f00589555f157f6b2f0339bd555359c8ca10a05d185db8b304d7e5deeb575fc290068f670f0a721ac5309d49b2d48f8d098
|
data/coffee-react-transform.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),f.coffeeReactTransform=e()}}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(_dereq_,module,exports){
|
|
3
3
|
module.exports = _dereq_('./lib/transformer').transform;
|
|
4
4
|
|
|
5
|
-
},{"./lib/transformer":
|
|
5
|
+
},{"./lib/transformer":8}],2:[function(_dereq_,module,exports){
|
|
6
6
|
// from esprima-fb/esprima.js
|
|
7
7
|
|
|
8
8
|
var XHTMLEntities = {
|
|
@@ -458,146 +458,8 @@ exports.nameWhitespaceCharacter = function(string) {
|
|
|
458
458
|
};
|
|
459
459
|
|
|
460
460
|
},{}],4:[function(_dereq_,module,exports){
|
|
461
|
-
// from react-tools/vendor/fbtransform/transforms/xjs.js
|
|
462
|
-
|
|
463
|
-
module.exports = {
|
|
464
|
-
a: true,
|
|
465
|
-
abbr: true,
|
|
466
|
-
address: true,
|
|
467
|
-
applet: true,
|
|
468
|
-
area: true,
|
|
469
|
-
article: true,
|
|
470
|
-
aside: true,
|
|
471
|
-
audio: true,
|
|
472
|
-
b: true,
|
|
473
|
-
base: true,
|
|
474
|
-
bdi: true,
|
|
475
|
-
bdo: true,
|
|
476
|
-
big: true,
|
|
477
|
-
blockquote: true,
|
|
478
|
-
body: true,
|
|
479
|
-
br: true,
|
|
480
|
-
button: true,
|
|
481
|
-
canvas: true,
|
|
482
|
-
caption: true,
|
|
483
|
-
circle: true,
|
|
484
|
-
cite: true,
|
|
485
|
-
code: true,
|
|
486
|
-
col: true,
|
|
487
|
-
colgroup: true,
|
|
488
|
-
command: true,
|
|
489
|
-
data: true,
|
|
490
|
-
datalist: true,
|
|
491
|
-
dd: true,
|
|
492
|
-
defs: true,
|
|
493
|
-
del: true,
|
|
494
|
-
details: true,
|
|
495
|
-
dfn: true,
|
|
496
|
-
dialog: true,
|
|
497
|
-
div: true,
|
|
498
|
-
dl: true,
|
|
499
|
-
dt: true,
|
|
500
|
-
ellipse: true,
|
|
501
|
-
em: true,
|
|
502
|
-
embed: true,
|
|
503
|
-
fieldset: true,
|
|
504
|
-
figcaption: true,
|
|
505
|
-
figure: true,
|
|
506
|
-
footer: true,
|
|
507
|
-
form: true,
|
|
508
|
-
g: true,
|
|
509
|
-
h1: true,
|
|
510
|
-
h2: true,
|
|
511
|
-
h3: true,
|
|
512
|
-
h4: true,
|
|
513
|
-
h5: true,
|
|
514
|
-
h6: true,
|
|
515
|
-
head: true,
|
|
516
|
-
header: true,
|
|
517
|
-
hgroup: true,
|
|
518
|
-
hr: true,
|
|
519
|
-
html: true,
|
|
520
|
-
i: true,
|
|
521
|
-
iframe: true,
|
|
522
|
-
img: true,
|
|
523
|
-
input: true,
|
|
524
|
-
ins: true,
|
|
525
|
-
kbd: true,
|
|
526
|
-
keygen: true,
|
|
527
|
-
label: true,
|
|
528
|
-
legend: true,
|
|
529
|
-
li: true,
|
|
530
|
-
line: true,
|
|
531
|
-
linearGradient: true,
|
|
532
|
-
link: true,
|
|
533
|
-
main: true,
|
|
534
|
-
map: true,
|
|
535
|
-
mark: true,
|
|
536
|
-
marquee: true,
|
|
537
|
-
mask: false,
|
|
538
|
-
menu: true,
|
|
539
|
-
menuitem: true,
|
|
540
|
-
meta: true,
|
|
541
|
-
meter: true,
|
|
542
|
-
nav: true,
|
|
543
|
-
noscript: true,
|
|
544
|
-
object: true,
|
|
545
|
-
ol: true,
|
|
546
|
-
optgroup: true,
|
|
547
|
-
option: true,
|
|
548
|
-
output: true,
|
|
549
|
-
p: true,
|
|
550
|
-
param: true,
|
|
551
|
-
path: true,
|
|
552
|
-
pattern: false,
|
|
553
|
-
picture: true,
|
|
554
|
-
polygon: true,
|
|
555
|
-
polyline: true,
|
|
556
|
-
pre: true,
|
|
557
|
-
progress: true,
|
|
558
|
-
q: true,
|
|
559
|
-
radialGradient: true,
|
|
560
|
-
rect: true,
|
|
561
|
-
rp: true,
|
|
562
|
-
rt: true,
|
|
563
|
-
ruby: true,
|
|
564
|
-
s: true,
|
|
565
|
-
samp: true,
|
|
566
|
-
script: true,
|
|
567
|
-
section: true,
|
|
568
|
-
select: true,
|
|
569
|
-
small: true,
|
|
570
|
-
source: true,
|
|
571
|
-
span: true,
|
|
572
|
-
stop: true,
|
|
573
|
-
strong: true,
|
|
574
|
-
style: true,
|
|
575
|
-
sub: true,
|
|
576
|
-
summary: true,
|
|
577
|
-
sup: true,
|
|
578
|
-
svg: true,
|
|
579
|
-
table: true,
|
|
580
|
-
tbody: true,
|
|
581
|
-
td: true,
|
|
582
|
-
text: true,
|
|
583
|
-
textarea: true,
|
|
584
|
-
tfoot: true,
|
|
585
|
-
th: true,
|
|
586
|
-
thead: true,
|
|
587
|
-
time: true,
|
|
588
|
-
title: true,
|
|
589
|
-
tr: true,
|
|
590
|
-
track: true,
|
|
591
|
-
tspan: true,
|
|
592
|
-
u: true,
|
|
593
|
-
ul: true,
|
|
594
|
-
'var': true,
|
|
595
|
-
video: true,
|
|
596
|
-
wbr: true
|
|
597
|
-
};
|
|
598
|
-
},{}],5:[function(_dereq_,module,exports){
|
|
599
461
|
// Generated by CoffeeScript 1.9.0
|
|
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;
|
|
462
|
+
var $, BOM, CJSX_ESC_COMMENT, 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
463
|
|
|
602
464
|
_ref = _dereq_('./helpers'), count = _ref.count, starts = _ref.starts, compact = _ref.compact, last = _ref.last, repeat = _ref.repeat, throwSyntaxError = _ref.throwSyntaxError;
|
|
603
465
|
|
|
@@ -644,7 +506,7 @@ module.exports = Parser = (function() {
|
|
|
644
506
|
if (this.activeStates.length === 0) {
|
|
645
507
|
break;
|
|
646
508
|
}
|
|
647
|
-
consumed = ((_ref1 = this.currentState()) !== $.CJSX_EL && _ref1 !== $.CJSX_ATTRIBUTES ? this.csComment() || this.csHeredoc() || this.csString() || this.csRegex() || this.jsEscaped() : void 0) || this.cjsxStart() || this.cjsxAttribute() || this.cjsxEscape() || this.cjsxUnescape() || this.cjsxEnd() || this.cjsxText() || this.coffeescriptCode();
|
|
509
|
+
consumed = ((_ref1 = this.currentState()) !== $.CJSX_EL && _ref1 !== $.CJSX_ATTRIBUTES ? this.csComment() || this.csHeredoc() || this.csString() || this.csRegex() || this.jsEscaped() : void 0) || this.cjsxStart() || this.cjsxAttribute() || this.cjsxComment() || this.cjsxEscape() || this.cjsxUnescape() || this.cjsxEnd() || this.cjsxText() || this.coffeescriptCode();
|
|
648
510
|
_ref2 = this.getLineAndColumnFromChunk(consumed), this.chunkLine = _ref2[0], this.chunkColumn = _ref2[1];
|
|
649
511
|
i += consumed;
|
|
650
512
|
}
|
|
@@ -828,6 +690,16 @@ module.exports = Parser = (function() {
|
|
|
828
690
|
}
|
|
829
691
|
};
|
|
830
692
|
|
|
693
|
+
Parser.prototype.cjsxComment = function() {
|
|
694
|
+
var match;
|
|
695
|
+
match = this.chunk.match(CJSX_ESC_COMMENT);
|
|
696
|
+
if (!match) {
|
|
697
|
+
return 0;
|
|
698
|
+
}
|
|
699
|
+
this.addLeafNodeToActiveBranch(ParseTreeLeafNode($.CJSX_COMMENT, match[1]));
|
|
700
|
+
return match[0].length;
|
|
701
|
+
};
|
|
702
|
+
|
|
831
703
|
Parser.prototype.cjsxEscape = function() {
|
|
832
704
|
var _ref1;
|
|
833
705
|
if (!(this.chunk.charAt(0) === '{' && ((_ref1 = this.currentState()) === $.CJSX_EL || _ref1 === $.CJSX_ATTR_PAIR))) {
|
|
@@ -995,7 +867,7 @@ module.exports = Parser = (function() {
|
|
|
995
867
|
}
|
|
996
868
|
prev = letter;
|
|
997
869
|
}
|
|
998
|
-
return
|
|
870
|
+
return throwSyntaxError("missing " + (stack.pop()) + ", starting");
|
|
999
871
|
};
|
|
1000
872
|
|
|
1001
873
|
return Parser;
|
|
@@ -1010,6 +882,8 @@ TAG_ATTRIBUTES = /(?:([-A-Za-z0-9_]+)(?:\s*=\s*(?:(?:"((?:\\.|[^"])*)")|(?:'((?:
|
|
|
1010
882
|
|
|
1011
883
|
PRAGMA = /^\s*#\s*@cjsx\s+(\S*)/i;
|
|
1012
884
|
|
|
885
|
+
CJSX_ESC_COMMENT = /^\{#(.*)\}/;
|
|
886
|
+
|
|
1013
887
|
BOM = 65279;
|
|
1014
888
|
|
|
1015
889
|
WHITESPACE = /^[^\n\S]+/;
|
|
@@ -1028,16 +902,14 @@ REGEX = /^(\/(?![\s=])[^[\/\n\\]*(?:(?:\\[\s\S]|\[[^\]\n\\]*(?:\\[\s\S][^\]\n\\]
|
|
|
1028
902
|
|
|
1029
903
|
HEREGEX = /^\/{3}((?:\\?[\s\S])+?)\/{3}([imgy]{0,4})(?!\w)/;
|
|
1030
904
|
|
|
1031
|
-
},{"./helpers":3,"./symbols":
|
|
905
|
+
},{"./helpers":3,"./symbols":7}],5:[function(_dereq_,module,exports){
|
|
1032
906
|
// Generated by CoffeeScript 1.9.0
|
|
1033
|
-
var $,
|
|
907
|
+
var $, SPACES_ONLY, Serialiser, TEXT_LEADING_WHITESPACE, TEXT_TRAILING_WHITESPACE, WHITESPACE_ONLY, containsNewlines, entityDecode, exports, find, firstNonWhitespaceChild, genericBranchSerialiser, genericLeafSerialiser, joinList, last, nodeSerialisers, serialise, stringEscape, tagConvention, _ref;
|
|
1034
908
|
|
|
1035
909
|
_ref = _dereq_('./helpers'), last = _ref.last, find = _ref.find;
|
|
1036
910
|
|
|
1037
911
|
$ = _dereq_('./symbols');
|
|
1038
912
|
|
|
1039
|
-
HTML_ELEMENTS = _dereq_('./htmlelements');
|
|
1040
|
-
|
|
1041
913
|
stringEscape = _dereq_('./stringescape');
|
|
1042
914
|
|
|
1043
915
|
entityDecode = _dereq_('./entitydecode');
|
|
@@ -1191,6 +1063,8 @@ genericLeafSerialiser = function(node) {
|
|
|
1191
1063
|
return node.value;
|
|
1192
1064
|
};
|
|
1193
1065
|
|
|
1066
|
+
tagConvention = /^[a-z]|\-/;
|
|
1067
|
+
|
|
1194
1068
|
nodeSerialisers = {
|
|
1195
1069
|
ROOT: genericBranchSerialiser,
|
|
1196
1070
|
CJSX_PRAGMA: function() {
|
|
@@ -1205,7 +1079,7 @@ nodeSerialisers = {
|
|
|
1205
1079
|
child = _ref1[_i];
|
|
1206
1080
|
serialisedChild = this.serialiseNode(child);
|
|
1207
1081
|
if (child != null) {
|
|
1208
|
-
if (WHITESPACE_ONLY.test(serialisedChild)) {
|
|
1082
|
+
if (serialisedChild.length === 0 || WHITESPACE_ONLY.test(serialisedChild)) {
|
|
1209
1083
|
accumulatedWhitespace += serialisedChild;
|
|
1210
1084
|
} else {
|
|
1211
1085
|
serialisedChildren.push(accumulatedWhitespace + serialisedChild);
|
|
@@ -1217,13 +1091,16 @@ nodeSerialisers = {
|
|
|
1217
1091
|
serialisedChildren[serialisedChildren.length - 1] += accumulatedWhitespace;
|
|
1218
1092
|
accumulatedWhitespace = '';
|
|
1219
1093
|
}
|
|
1220
|
-
if (
|
|
1094
|
+
if (tagConvention.test(node.value)) {
|
|
1221
1095
|
element = '"' + node.value + '"';
|
|
1222
1096
|
} else {
|
|
1223
1097
|
element = node.value;
|
|
1224
1098
|
}
|
|
1225
1099
|
return this.reactObject + ".createElement(" + element + ", " + (joinList(serialisedChildren)) + ")";
|
|
1226
1100
|
},
|
|
1101
|
+
CJSX_COMMENT: function(node) {
|
|
1102
|
+
return '';
|
|
1103
|
+
},
|
|
1227
1104
|
CJSX_ESC: function(node) {
|
|
1228
1105
|
var childrenSerialised;
|
|
1229
1106
|
childrenSerialised = node.children.map((function(_this) {
|
|
@@ -1334,7 +1211,7 @@ exports.Serialiser = Serialiser;
|
|
|
1334
1211
|
|
|
1335
1212
|
exports.nodeSerialisers = nodeSerialisers;
|
|
1336
1213
|
|
|
1337
|
-
},{"./entitydecode":2,"./helpers":3,"./
|
|
1214
|
+
},{"./entitydecode":2,"./helpers":3,"./stringescape":6,"./symbols":7}],6:[function(_dereq_,module,exports){
|
|
1338
1215
|
|
|
1339
1216
|
var hex = '0123456789abcdef'.split('');
|
|
1340
1217
|
|
|
@@ -1388,7 +1265,7 @@ function encodeChar(inputChar, preserveNewlines) {
|
|
|
1388
1265
|
}
|
|
1389
1266
|
}
|
|
1390
1267
|
|
|
1391
|
-
},{}],
|
|
1268
|
+
},{}],7:[function(_dereq_,module,exports){
|
|
1392
1269
|
// Generated by CoffeeScript 1.9.0
|
|
1393
1270
|
module.exports = {
|
|
1394
1271
|
ROOT: 'ROOT',
|
|
@@ -1410,12 +1287,13 @@ module.exports = {
|
|
|
1410
1287
|
CJSX_ATTR_SPREAD: 'CJSX_ATTR_SPREAD',
|
|
1411
1288
|
CJSX_START: 'CJSX_START',
|
|
1412
1289
|
CJSX_END: 'CJSX_END',
|
|
1290
|
+
CJSX_COMMENT: 'CJSX_COMMENT',
|
|
1413
1291
|
CJSX_ESC_START: 'CJSX_ESC_START',
|
|
1414
1292
|
CJSX_ESC_END: 'CJSX_ESC_END',
|
|
1415
1293
|
CJSX_PRAGMA: 'CJSX_PRAGMA'
|
|
1416
1294
|
};
|
|
1417
1295
|
|
|
1418
|
-
},{}],
|
|
1296
|
+
},{}],8:[function(_dereq_,module,exports){
|
|
1419
1297
|
// Generated by CoffeeScript 1.9.0
|
|
1420
1298
|
var Parser, serialise;
|
|
1421
1299
|
|
|
@@ -1427,6 +1305,6 @@ module.exports.transform = function(code, opts) {
|
|
|
1427
1305
|
return serialise(new Parser().parse(code, opts));
|
|
1428
1306
|
};
|
|
1429
1307
|
|
|
1430
|
-
},{"./parser":
|
|
1308
|
+
},{"./parser":4,"./serialiser":5}]},{},[1])
|
|
1431
1309
|
(1)
|
|
1432
1310
|
});;var coffeeReactTransform = coffeeReactTransform || (typeof global == 'object' && global.coffeeReactTransform) || require('coffee-react-transform');
|
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:
|
|
4
|
+
version: 3.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: 2015-
|
|
11
|
+
date: 2015-03-17 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: execjs
|