react-source 0.3.0 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- data/build/JSXTransformer.js +469 -473
- data/build/react.js +507 -507
- data/build/react.min.js +2 -2
- metadata +2 -2
data/build/JSXTransformer.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
/**
|
2
|
-
* JSXTransformer v0.3.
|
2
|
+
* JSXTransformer v0.3.2
|
3
3
|
*/
|
4
4
|
(function(e){if("function"==typeof bootstrap)bootstrap("jsxtransformer",e);else if("object"==typeof exports)module.exports=e();else if("function"==typeof define&&define.amd)define(e);else if("undefined"!=typeof ses){if(!ses.ok())return;ses.makeJSXTransformer=e}else"undefined"!=typeof window?window.JSXTransformer=e():global.JSXTransformer=e()})(function(){var define,ses,bootstrap,module,exports;
|
5
5
|
return (function(e,t,n){function i(n,s){if(!t[n]){if(!e[n]){var o=typeof require=="function"&&require;if(!s&&o)return o(n,!0);if(r)return r(n,!0);throw new Error("Cannot find module '"+n+"'")}var u=t[n]={exports:{}};e[n][0].call(u.exports,function(t){var r=e[n][1][t];return i(r?r:t)},u,u.exports)}return t[n].exports}var r=typeof require=="function"&&require;for(var s=0;s<n.length;s++)i(n[s]);return i})({1:[function(require,module,exports){
|
@@ -729,294 +729,7 @@ function transform(visitors, source, options) {
|
|
729
729
|
exports.transform = transform;
|
730
730
|
|
731
731
|
})()
|
732
|
-
},{"./utils":8,"
|
733
|
-
(function(){/**
|
734
|
-
* Copyright 2013 Facebook, Inc.
|
735
|
-
*
|
736
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
737
|
-
* you may not use this file except in compliance with the License.
|
738
|
-
* You may obtain a copy of the License at
|
739
|
-
*
|
740
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
741
|
-
*
|
742
|
-
* Unless required by applicable law or agreed to in writing, software
|
743
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
744
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
745
|
-
* See the License for the specific language governing permissions and
|
746
|
-
* limitations under the License.
|
747
|
-
*/
|
748
|
-
/*global exports:true*/
|
749
|
-
"use strict";
|
750
|
-
var catchup = require('../lib/utils').catchup;
|
751
|
-
var append = require('../lib/utils').append;
|
752
|
-
var move = require('../lib/utils').move;
|
753
|
-
|
754
|
-
var knownTags = {
|
755
|
-
a: true,
|
756
|
-
abbr: true,
|
757
|
-
address: true,
|
758
|
-
applet: true,
|
759
|
-
area: true,
|
760
|
-
article: true,
|
761
|
-
aside: true,
|
762
|
-
audio: true,
|
763
|
-
b: true,
|
764
|
-
base: true,
|
765
|
-
bdi: true,
|
766
|
-
bdo: true,
|
767
|
-
blockquote: true,
|
768
|
-
body: true,
|
769
|
-
br: true,
|
770
|
-
button: true,
|
771
|
-
canvas: true,
|
772
|
-
circle: true,
|
773
|
-
ellipse: true,
|
774
|
-
caption: true,
|
775
|
-
cite: true,
|
776
|
-
code: true,
|
777
|
-
col: true,
|
778
|
-
colgroup: true,
|
779
|
-
command: true,
|
780
|
-
data: true,
|
781
|
-
datalist: true,
|
782
|
-
dd: true,
|
783
|
-
del: true,
|
784
|
-
details: true,
|
785
|
-
dfn: true,
|
786
|
-
dialog: true,
|
787
|
-
div: true,
|
788
|
-
dl: true,
|
789
|
-
dt: true,
|
790
|
-
em: true,
|
791
|
-
embed: true,
|
792
|
-
fieldset: true,
|
793
|
-
figcaption: true,
|
794
|
-
figure: true,
|
795
|
-
footer: true,
|
796
|
-
form: true,
|
797
|
-
g: true,
|
798
|
-
h1: true,
|
799
|
-
h2: true,
|
800
|
-
h3: true,
|
801
|
-
h4: true,
|
802
|
-
h5: true,
|
803
|
-
h6: true,
|
804
|
-
head: true,
|
805
|
-
header: true,
|
806
|
-
hgroup: true,
|
807
|
-
hr: true,
|
808
|
-
html: true,
|
809
|
-
i: true,
|
810
|
-
iframe: true,
|
811
|
-
img: true,
|
812
|
-
input: true,
|
813
|
-
ins: true,
|
814
|
-
kbd: true,
|
815
|
-
keygen: true,
|
816
|
-
label: true,
|
817
|
-
legend: true,
|
818
|
-
li: true,
|
819
|
-
line: true,
|
820
|
-
link: true,
|
821
|
-
map: true,
|
822
|
-
mark: true,
|
823
|
-
marquee: true,
|
824
|
-
menu: true,
|
825
|
-
meta: true,
|
826
|
-
meter: true,
|
827
|
-
nav: true,
|
828
|
-
noscript: true,
|
829
|
-
object: true,
|
830
|
-
ol: true,
|
831
|
-
optgroup: true,
|
832
|
-
option: true,
|
833
|
-
output: true,
|
834
|
-
p: true,
|
835
|
-
path: true,
|
836
|
-
param: true,
|
837
|
-
pre: true,
|
838
|
-
progress: true,
|
839
|
-
q: true,
|
840
|
-
rect: true,
|
841
|
-
rp: true,
|
842
|
-
rt: true,
|
843
|
-
ruby: true,
|
844
|
-
s: true,
|
845
|
-
samp: true,
|
846
|
-
script: true,
|
847
|
-
section: true,
|
848
|
-
select: true,
|
849
|
-
small: true,
|
850
|
-
source: true,
|
851
|
-
span: true,
|
852
|
-
strong: true,
|
853
|
-
style: true,
|
854
|
-
sub: true,
|
855
|
-
summary: true,
|
856
|
-
sup: true,
|
857
|
-
svg: true,
|
858
|
-
table: true,
|
859
|
-
tbody: true,
|
860
|
-
td: true,
|
861
|
-
text: true,
|
862
|
-
textarea: true,
|
863
|
-
tfoot: true,
|
864
|
-
th: true,
|
865
|
-
thead: true,
|
866
|
-
time: true,
|
867
|
-
title: true,
|
868
|
-
tr: true,
|
869
|
-
track: true,
|
870
|
-
u: true,
|
871
|
-
ul: true,
|
872
|
-
'var': true,
|
873
|
-
video: true,
|
874
|
-
wbr: true
|
875
|
-
};
|
876
|
-
|
877
|
-
function safeTrim(string) {
|
878
|
-
return string.replace(/^[ \t]+/, '').replace(/[ \t]+$/, '');
|
879
|
-
}
|
880
|
-
|
881
|
-
// Replace all trailing whitespace characters with a single space character
|
882
|
-
function trimWithSingleSpace(string) {
|
883
|
-
return string.replace(/^[ \t\xA0]{2,}/, ' ').
|
884
|
-
replace(/[ \t\xA0]{2,}$/, ' ').replace(/^\s+$/, '');
|
885
|
-
}
|
886
|
-
|
887
|
-
/**
|
888
|
-
* Special handling for multiline string literals
|
889
|
-
* print lines:
|
890
|
-
*
|
891
|
-
* line
|
892
|
-
* line
|
893
|
-
*
|
894
|
-
* as:
|
895
|
-
*
|
896
|
-
* "line "+
|
897
|
-
* "line"
|
898
|
-
*/
|
899
|
-
function renderXJSLiteral(object, isLast, state, start, end) {
|
900
|
-
/** Added blank check filtering and triming*/
|
901
|
-
var trimmedChildValue = safeTrim(object.value);
|
902
|
-
|
903
|
-
if (trimmedChildValue) {
|
904
|
-
// head whitespace
|
905
|
-
append(object.value.match(/^[\t ]*/)[0], state);
|
906
|
-
if (start) {
|
907
|
-
append(start, state);
|
908
|
-
}
|
909
|
-
|
910
|
-
var trimmedChildValueWithSpace = trimWithSingleSpace(object.value);
|
911
|
-
|
912
|
-
/**
|
913
|
-
*/
|
914
|
-
var initialLines = trimmedChildValue.split(/\r\n|\n|\r/);
|
915
|
-
|
916
|
-
var lines = initialLines.filter(function(line) {
|
917
|
-
return safeTrim(line).length > 0;
|
918
|
-
});
|
919
|
-
|
920
|
-
var hasInitialNewLine = initialLines[0] !== lines[0];
|
921
|
-
var hasFinalNewLine =
|
922
|
-
initialLines[initialLines.length - 1] !== lines[lines.length - 1];
|
923
|
-
|
924
|
-
var numLines = lines.length;
|
925
|
-
lines.forEach(function (line, ii) {
|
926
|
-
var lastLine = ii === numLines - 1;
|
927
|
-
var trimmedLine = safeTrim(line);
|
928
|
-
if (trimmedLine === '' && !lastLine) {
|
929
|
-
append(line, state);
|
930
|
-
} else {
|
931
|
-
var preString = '';
|
932
|
-
var postString = '';
|
933
|
-
var leading = '';
|
934
|
-
|
935
|
-
if (ii === 0) {
|
936
|
-
if (hasInitialNewLine) {
|
937
|
-
preString = ' ';
|
938
|
-
leading = '\n';
|
939
|
-
}
|
940
|
-
if (trimmedChildValueWithSpace.substring(0, 1) === ' ') {
|
941
|
-
// If this is the first line, and the original content starts with
|
942
|
-
// whitespace, place a single space at the beginning.
|
943
|
-
preString = ' ';
|
944
|
-
}
|
945
|
-
} else {
|
946
|
-
leading = line.match(/^[ \t]*/)[0];
|
947
|
-
}
|
948
|
-
if (!lastLine || trimmedChildValueWithSpace.substr(
|
949
|
-
trimmedChildValueWithSpace.length - 1, 1) === ' ' ||
|
950
|
-
hasFinalNewLine
|
951
|
-
) {
|
952
|
-
// If either not on the last line, or the original content ends with
|
953
|
-
// whitespace, place a single character at the end.
|
954
|
-
postString = ' ';
|
955
|
-
}
|
956
|
-
|
957
|
-
append(
|
958
|
-
leading +
|
959
|
-
JSON.stringify(
|
960
|
-
preString + trimmedLine + postString
|
961
|
-
) +
|
962
|
-
(lastLine ? '' : '+') +
|
963
|
-
line.match(/[ \t]*$/)[0],
|
964
|
-
state);
|
965
|
-
}
|
966
|
-
if (!lastLine) {
|
967
|
-
append('\n', state);
|
968
|
-
}
|
969
|
-
});
|
970
|
-
} else {
|
971
|
-
if (start) {
|
972
|
-
append(start, state);
|
973
|
-
}
|
974
|
-
append('""', state);
|
975
|
-
}
|
976
|
-
if (end) {
|
977
|
-
append(end, state);
|
978
|
-
}
|
979
|
-
|
980
|
-
// add comma before trailing whitespace
|
981
|
-
if (!isLast) {
|
982
|
-
append(',', state);
|
983
|
-
}
|
984
|
-
|
985
|
-
// tail whitespace
|
986
|
-
append(object.value.match(/[ \t]*$/)[0], state);
|
987
|
-
move(object.range[1], state);
|
988
|
-
}
|
989
|
-
|
990
|
-
function renderXJSExpression(traverse, object, isLast, path, state) {
|
991
|
-
// Plus 1 to skip `{`.
|
992
|
-
move(object.range[0] + 1, state);
|
993
|
-
traverse(object.value, path, state);
|
994
|
-
if (!isLast) {
|
995
|
-
// If we need to append a comma, make sure to do so after the expression.
|
996
|
-
catchup(object.value.range[1], state);
|
997
|
-
append(',', state);
|
998
|
-
}
|
999
|
-
// Minus 1 to skip `}`.
|
1000
|
-
catchup(object.range[1] - 1, state);
|
1001
|
-
move(object.range[1], state);
|
1002
|
-
return false;
|
1003
|
-
}
|
1004
|
-
|
1005
|
-
function quoteAttrName(attr) {
|
1006
|
-
// Quote invalid JS identifiers.
|
1007
|
-
if (!/^[a-z_$][a-z\d_$]*$/i.test(attr)) {
|
1008
|
-
return "'" + attr + "'";
|
1009
|
-
}
|
1010
|
-
return attr;
|
1011
|
-
}
|
1012
|
-
|
1013
|
-
exports.knownTags = knownTags;
|
1014
|
-
exports.renderXJSExpression = renderXJSExpression;
|
1015
|
-
exports.renderXJSLiteral = renderXJSLiteral;
|
1016
|
-
exports.quoteAttrName = quoteAttrName;
|
1017
|
-
|
1018
|
-
})()
|
1019
|
-
},{"../lib/utils":8}],10:[function(require,module,exports){
|
732
|
+
},{"./utils":8,"esprima":9,"source-map":10}],9:[function(require,module,exports){
|
1020
733
|
(function(){/*
|
1021
734
|
Copyright (C) 2013 Thaddee Tyl <thaddee.tyl@gmail.com>
|
1022
735
|
Copyright (C) 2012 Ariya Hidayat <ariya.hidayat@gmail.com>
|
@@ -6965,30 +6678,135 @@ parseYieldExpression: true
|
|
6965
6678
|
labelSet: {},
|
6966
6679
|
inFunctionBody: false,
|
6967
6680
|
inIteration: false,
|
6968
|
-
inSwitch: false
|
6681
|
+
inSwitch: false
|
6682
|
+
};
|
6683
|
+
|
6684
|
+
extra = {};
|
6685
|
+
|
6686
|
+
// Options matching.
|
6687
|
+
options = options || {};
|
6688
|
+
|
6689
|
+
// Of course we collect tokens here.
|
6690
|
+
options.tokens = true;
|
6691
|
+
extra.tokens = [];
|
6692
|
+
extra.tokenize = true;
|
6693
|
+
// The following two fields are necessary to compute the Regex tokens.
|
6694
|
+
extra.openParenToken = -1;
|
6695
|
+
extra.openCurlyToken = -1;
|
6696
|
+
|
6697
|
+
extra.range = (typeof options.range === 'boolean') && options.range;
|
6698
|
+
extra.loc = (typeof options.loc === 'boolean') && options.loc;
|
6699
|
+
|
6700
|
+
if (typeof options.comment === 'boolean' && options.comment) {
|
6701
|
+
extra.comments = [];
|
6702
|
+
}
|
6703
|
+
if (typeof options.tolerant === 'boolean' && options.tolerant) {
|
6704
|
+
extra.errors = [];
|
6705
|
+
}
|
6706
|
+
|
6707
|
+
if (length > 0) {
|
6708
|
+
if (typeof source[0] === 'undefined') {
|
6709
|
+
// Try first to convert to a string. This is good as fast path
|
6710
|
+
// for old IE which understands string indexing for string
|
6711
|
+
// literals only and not for string object.
|
6712
|
+
if (code instanceof String) {
|
6713
|
+
source = code.valueOf();
|
6714
|
+
}
|
6715
|
+
}
|
6716
|
+
}
|
6717
|
+
|
6718
|
+
patch();
|
6719
|
+
|
6720
|
+
try {
|
6721
|
+
peek();
|
6722
|
+
if (lookahead.type === Token.EOF) {
|
6723
|
+
return extra.tokens;
|
6724
|
+
}
|
6725
|
+
|
6726
|
+
token = lex();
|
6727
|
+
while (lookahead.type !== Token.EOF) {
|
6728
|
+
try {
|
6729
|
+
token = lex();
|
6730
|
+
} catch (lexError) {
|
6731
|
+
token = lookahead;
|
6732
|
+
if (extra.errors) {
|
6733
|
+
extra.errors.push(lexError);
|
6734
|
+
// We have to break on the first error
|
6735
|
+
// to avoid infinite loops.
|
6736
|
+
break;
|
6737
|
+
} else {
|
6738
|
+
throw lexError;
|
6739
|
+
}
|
6740
|
+
}
|
6741
|
+
}
|
6742
|
+
|
6743
|
+
filterTokenLocation();
|
6744
|
+
tokens = extra.tokens;
|
6745
|
+
if (typeof extra.comments !== 'undefined') {
|
6746
|
+
filterCommentLocation();
|
6747
|
+
tokens.comments = extra.comments;
|
6748
|
+
}
|
6749
|
+
if (typeof extra.errors !== 'undefined') {
|
6750
|
+
tokens.errors = extra.errors;
|
6751
|
+
}
|
6752
|
+
} catch (e) {
|
6753
|
+
throw e;
|
6754
|
+
} finally {
|
6755
|
+
unpatch();
|
6756
|
+
extra = {};
|
6757
|
+
}
|
6758
|
+
return tokens;
|
6759
|
+
}
|
6760
|
+
|
6761
|
+
function parse(code, options) {
|
6762
|
+
var program, toString;
|
6763
|
+
|
6764
|
+
toString = String;
|
6765
|
+
if (typeof code !== 'string' && !(code instanceof String)) {
|
6766
|
+
code = toString(code);
|
6767
|
+
}
|
6768
|
+
|
6769
|
+
delegate = SyntaxTreeDelegate;
|
6770
|
+
source = code;
|
6771
|
+
index = 0;
|
6772
|
+
lineNumber = (source.length > 0) ? 1 : 0;
|
6773
|
+
lineStart = 0;
|
6774
|
+
length = source.length;
|
6775
|
+
lookahead = null;
|
6776
|
+
state = {
|
6777
|
+
allowIn: true,
|
6778
|
+
labelSet: {},
|
6779
|
+
parenthesizedCount: 0,
|
6780
|
+
inFunctionBody: false,
|
6781
|
+
inIteration: false,
|
6782
|
+
inSwitch: false,
|
6783
|
+
yieldAllowed: false,
|
6784
|
+
yieldFound: false
|
6969
6785
|
};
|
6970
6786
|
|
6971
6787
|
extra = {};
|
6788
|
+
if (typeof options !== 'undefined') {
|
6789
|
+
extra.range = (typeof options.range === 'boolean') && options.range;
|
6790
|
+
extra.loc = (typeof options.loc === 'boolean') && options.loc;
|
6972
6791
|
|
6973
|
-
|
6974
|
-
|
6975
|
-
|
6976
|
-
|
6977
|
-
|
6978
|
-
|
6979
|
-
|
6980
|
-
|
6981
|
-
extra.openParenToken = -1;
|
6982
|
-
extra.openCurlyToken = -1;
|
6983
|
-
|
6984
|
-
extra.range = (typeof options.range === 'boolean') && options.range;
|
6985
|
-
extra.loc = (typeof options.loc === 'boolean') && options.loc;
|
6792
|
+
if (extra.loc && options.source !== null && options.source !== undefined) {
|
6793
|
+
delegate = extend(delegate, {
|
6794
|
+
'postProcess': function (node) {
|
6795
|
+
node.loc.source = toString(options.source);
|
6796
|
+
return node;
|
6797
|
+
}
|
6798
|
+
});
|
6799
|
+
}
|
6986
6800
|
|
6987
|
-
|
6988
|
-
|
6989
|
-
|
6990
|
-
|
6991
|
-
|
6801
|
+
if (typeof options.tokens === 'boolean' && options.tokens) {
|
6802
|
+
extra.tokens = [];
|
6803
|
+
}
|
6804
|
+
if (typeof options.comment === 'boolean' && options.comment) {
|
6805
|
+
extra.comments = [];
|
6806
|
+
}
|
6807
|
+
if (typeof options.tolerant === 'boolean' && options.tolerant) {
|
6808
|
+
extra.errors = [];
|
6809
|
+
}
|
6992
6810
|
}
|
6993
6811
|
|
6994
6812
|
if (length > 0) {
|
@@ -7003,170 +6821,352 @@ parseYieldExpression: true
|
|
7003
6821
|
}
|
7004
6822
|
|
7005
6823
|
patch();
|
7006
|
-
|
7007
6824
|
try {
|
7008
|
-
|
7009
|
-
if (
|
7010
|
-
|
6825
|
+
program = parseProgram();
|
6826
|
+
if (typeof extra.comments !== 'undefined') {
|
6827
|
+
filterCommentLocation();
|
6828
|
+
program.comments = extra.comments;
|
6829
|
+
}
|
6830
|
+
if (typeof extra.tokens !== 'undefined') {
|
6831
|
+
filterTokenLocation();
|
6832
|
+
program.tokens = extra.tokens;
|
6833
|
+
}
|
6834
|
+
if (typeof extra.errors !== 'undefined') {
|
6835
|
+
program.errors = extra.errors;
|
6836
|
+
}
|
6837
|
+
if (extra.range || extra.loc) {
|
6838
|
+
program.body = filterGroup(program.body);
|
6839
|
+
}
|
6840
|
+
} catch (e) {
|
6841
|
+
throw e;
|
6842
|
+
} finally {
|
6843
|
+
unpatch();
|
6844
|
+
extra = {};
|
6845
|
+
}
|
6846
|
+
|
6847
|
+
return program;
|
6848
|
+
}
|
6849
|
+
|
6850
|
+
// Sync with package.json and component.json.
|
6851
|
+
exports.version = '1.1.0-dev-harmony';
|
6852
|
+
|
6853
|
+
exports.tokenize = tokenize;
|
6854
|
+
|
6855
|
+
exports.parse = parse;
|
6856
|
+
|
6857
|
+
// Deep copy.
|
6858
|
+
exports.Syntax = (function () {
|
6859
|
+
var name, types = {};
|
6860
|
+
|
6861
|
+
if (typeof Object.create === 'function') {
|
6862
|
+
types = Object.create(null);
|
6863
|
+
}
|
6864
|
+
|
6865
|
+
for (name in Syntax) {
|
6866
|
+
if (Syntax.hasOwnProperty(name)) {
|
6867
|
+
types[name] = Syntax[name];
|
7011
6868
|
}
|
6869
|
+
}
|
6870
|
+
|
6871
|
+
if (typeof Object.freeze === 'function') {
|
6872
|
+
Object.freeze(types);
|
6873
|
+
}
|
6874
|
+
|
6875
|
+
return types;
|
6876
|
+
}());
|
6877
|
+
|
6878
|
+
}));
|
6879
|
+
/* vim: set sw=4 ts=4 et tw=80 : */
|
6880
|
+
|
6881
|
+
})()
|
6882
|
+
},{}],11:[function(require,module,exports){
|
6883
|
+
(function(){/**
|
6884
|
+
* Copyright 2013 Facebook, Inc.
|
6885
|
+
*
|
6886
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
6887
|
+
* you may not use this file except in compliance with the License.
|
6888
|
+
* You may obtain a copy of the License at
|
6889
|
+
*
|
6890
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
6891
|
+
*
|
6892
|
+
* Unless required by applicable law or agreed to in writing, software
|
6893
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
6894
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
6895
|
+
* See the License for the specific language governing permissions and
|
6896
|
+
* limitations under the License.
|
6897
|
+
*/
|
6898
|
+
/*global exports:true*/
|
6899
|
+
"use strict";
|
6900
|
+
var catchup = require('../lib/utils').catchup;
|
6901
|
+
var append = require('../lib/utils').append;
|
6902
|
+
var move = require('../lib/utils').move;
|
6903
|
+
|
6904
|
+
var knownTags = {
|
6905
|
+
a: true,
|
6906
|
+
abbr: true,
|
6907
|
+
address: true,
|
6908
|
+
applet: true,
|
6909
|
+
area: true,
|
6910
|
+
article: true,
|
6911
|
+
aside: true,
|
6912
|
+
audio: true,
|
6913
|
+
b: true,
|
6914
|
+
base: true,
|
6915
|
+
bdi: true,
|
6916
|
+
bdo: true,
|
6917
|
+
blockquote: true,
|
6918
|
+
body: true,
|
6919
|
+
br: true,
|
6920
|
+
button: true,
|
6921
|
+
canvas: true,
|
6922
|
+
circle: true,
|
6923
|
+
ellipse: true,
|
6924
|
+
caption: true,
|
6925
|
+
cite: true,
|
6926
|
+
code: true,
|
6927
|
+
col: true,
|
6928
|
+
colgroup: true,
|
6929
|
+
command: true,
|
6930
|
+
data: true,
|
6931
|
+
datalist: true,
|
6932
|
+
dd: true,
|
6933
|
+
del: true,
|
6934
|
+
details: true,
|
6935
|
+
dfn: true,
|
6936
|
+
dialog: true,
|
6937
|
+
div: true,
|
6938
|
+
dl: true,
|
6939
|
+
dt: true,
|
6940
|
+
em: true,
|
6941
|
+
embed: true,
|
6942
|
+
fieldset: true,
|
6943
|
+
figcaption: true,
|
6944
|
+
figure: true,
|
6945
|
+
footer: true,
|
6946
|
+
form: true,
|
6947
|
+
g: true,
|
6948
|
+
h1: true,
|
6949
|
+
h2: true,
|
6950
|
+
h3: true,
|
6951
|
+
h4: true,
|
6952
|
+
h5: true,
|
6953
|
+
h6: true,
|
6954
|
+
head: true,
|
6955
|
+
header: true,
|
6956
|
+
hgroup: true,
|
6957
|
+
hr: true,
|
6958
|
+
html: true,
|
6959
|
+
i: true,
|
6960
|
+
iframe: true,
|
6961
|
+
img: true,
|
6962
|
+
input: true,
|
6963
|
+
ins: true,
|
6964
|
+
kbd: true,
|
6965
|
+
keygen: true,
|
6966
|
+
label: true,
|
6967
|
+
legend: true,
|
6968
|
+
li: true,
|
6969
|
+
line: true,
|
6970
|
+
link: true,
|
6971
|
+
map: true,
|
6972
|
+
mark: true,
|
6973
|
+
marquee: true,
|
6974
|
+
menu: true,
|
6975
|
+
meta: true,
|
6976
|
+
meter: true,
|
6977
|
+
nav: true,
|
6978
|
+
noscript: true,
|
6979
|
+
object: true,
|
6980
|
+
ol: true,
|
6981
|
+
optgroup: true,
|
6982
|
+
option: true,
|
6983
|
+
output: true,
|
6984
|
+
p: true,
|
6985
|
+
path: true,
|
6986
|
+
param: true,
|
6987
|
+
pre: true,
|
6988
|
+
progress: true,
|
6989
|
+
q: true,
|
6990
|
+
rect: true,
|
6991
|
+
rp: true,
|
6992
|
+
rt: true,
|
6993
|
+
ruby: true,
|
6994
|
+
s: true,
|
6995
|
+
samp: true,
|
6996
|
+
script: true,
|
6997
|
+
section: true,
|
6998
|
+
select: true,
|
6999
|
+
small: true,
|
7000
|
+
source: true,
|
7001
|
+
span: true,
|
7002
|
+
strong: true,
|
7003
|
+
style: true,
|
7004
|
+
sub: true,
|
7005
|
+
summary: true,
|
7006
|
+
sup: true,
|
7007
|
+
svg: true,
|
7008
|
+
table: true,
|
7009
|
+
tbody: true,
|
7010
|
+
td: true,
|
7011
|
+
text: true,
|
7012
|
+
textarea: true,
|
7013
|
+
tfoot: true,
|
7014
|
+
th: true,
|
7015
|
+
thead: true,
|
7016
|
+
time: true,
|
7017
|
+
title: true,
|
7018
|
+
tr: true,
|
7019
|
+
track: true,
|
7020
|
+
u: true,
|
7021
|
+
ul: true,
|
7022
|
+
'var': true,
|
7023
|
+
video: true,
|
7024
|
+
wbr: true
|
7025
|
+
};
|
7026
|
+
|
7027
|
+
function safeTrim(string) {
|
7028
|
+
return string.replace(/^[ \t]+/, '').replace(/[ \t]+$/, '');
|
7029
|
+
}
|
7030
|
+
|
7031
|
+
// Replace all trailing whitespace characters with a single space character
|
7032
|
+
function trimWithSingleSpace(string) {
|
7033
|
+
return string.replace(/^[ \t\xA0]{2,}/, ' ').
|
7034
|
+
replace(/[ \t\xA0]{2,}$/, ' ').replace(/^\s+$/, '');
|
7035
|
+
}
|
7012
7036
|
|
7013
|
-
|
7014
|
-
|
7015
|
-
|
7016
|
-
|
7017
|
-
|
7018
|
-
|
7019
|
-
|
7020
|
-
|
7021
|
-
|
7022
|
-
|
7023
|
-
|
7024
|
-
|
7025
|
-
|
7026
|
-
|
7027
|
-
|
7028
|
-
}
|
7037
|
+
/**
|
7038
|
+
* Special handling for multiline string literals
|
7039
|
+
* print lines:
|
7040
|
+
*
|
7041
|
+
* line
|
7042
|
+
* line
|
7043
|
+
*
|
7044
|
+
* as:
|
7045
|
+
*
|
7046
|
+
* "line "+
|
7047
|
+
* "line"
|
7048
|
+
*/
|
7049
|
+
function renderXJSLiteral(object, isLast, state, start, end) {
|
7050
|
+
/** Added blank check filtering and triming*/
|
7051
|
+
var trimmedChildValue = safeTrim(object.value);
|
7029
7052
|
|
7030
|
-
|
7031
|
-
|
7032
|
-
|
7033
|
-
|
7034
|
-
|
7035
|
-
}
|
7036
|
-
if (typeof extra.errors !== 'undefined') {
|
7037
|
-
tokens.errors = extra.errors;
|
7038
|
-
}
|
7039
|
-
} catch (e) {
|
7040
|
-
throw e;
|
7041
|
-
} finally {
|
7042
|
-
unpatch();
|
7043
|
-
extra = {};
|
7044
|
-
}
|
7045
|
-
return tokens;
|
7053
|
+
if (trimmedChildValue) {
|
7054
|
+
// head whitespace
|
7055
|
+
append(object.value.match(/^[\t ]*/)[0], state);
|
7056
|
+
if (start) {
|
7057
|
+
append(start, state);
|
7046
7058
|
}
|
7047
7059
|
|
7048
|
-
|
7049
|
-
var program, toString;
|
7050
|
-
|
7051
|
-
toString = String;
|
7052
|
-
if (typeof code !== 'string' && !(code instanceof String)) {
|
7053
|
-
code = toString(code);
|
7054
|
-
}
|
7060
|
+
var trimmedChildValueWithSpace = trimWithSingleSpace(object.value);
|
7055
7061
|
|
7056
|
-
|
7057
|
-
|
7058
|
-
|
7059
|
-
lineNumber = (source.length > 0) ? 1 : 0;
|
7060
|
-
lineStart = 0;
|
7061
|
-
length = source.length;
|
7062
|
-
lookahead = null;
|
7063
|
-
state = {
|
7064
|
-
allowIn: true,
|
7065
|
-
labelSet: {},
|
7066
|
-
parenthesizedCount: 0,
|
7067
|
-
inFunctionBody: false,
|
7068
|
-
inIteration: false,
|
7069
|
-
inSwitch: false,
|
7070
|
-
yieldAllowed: false,
|
7071
|
-
yieldFound: false
|
7072
|
-
};
|
7062
|
+
/**
|
7063
|
+
*/
|
7064
|
+
var initialLines = trimmedChildValue.split(/\r\n|\n|\r/);
|
7073
7065
|
|
7074
|
-
|
7075
|
-
|
7076
|
-
|
7077
|
-
extra.loc = (typeof options.loc === 'boolean') && options.loc;
|
7066
|
+
var lines = initialLines.filter(function(line) {
|
7067
|
+
return safeTrim(line).length > 0;
|
7068
|
+
});
|
7078
7069
|
|
7079
|
-
|
7080
|
-
|
7081
|
-
|
7082
|
-
node.loc.source = toString(options.source);
|
7083
|
-
return node;
|
7084
|
-
}
|
7085
|
-
});
|
7086
|
-
}
|
7070
|
+
var hasInitialNewLine = initialLines[0] !== lines[0];
|
7071
|
+
var hasFinalNewLine =
|
7072
|
+
initialLines[initialLines.length - 1] !== lines[lines.length - 1];
|
7087
7073
|
|
7088
|
-
|
7089
|
-
|
7090
|
-
|
7091
|
-
|
7092
|
-
|
7093
|
-
|
7094
|
-
|
7095
|
-
|
7096
|
-
|
7097
|
-
|
7074
|
+
var numLines = lines.length;
|
7075
|
+
lines.forEach(function (line, ii) {
|
7076
|
+
var lastLine = ii === numLines - 1;
|
7077
|
+
var trimmedLine = safeTrim(line);
|
7078
|
+
if (trimmedLine === '' && !lastLine) {
|
7079
|
+
append(line, state);
|
7080
|
+
} else {
|
7081
|
+
var preString = '';
|
7082
|
+
var postString = '';
|
7083
|
+
var leading = '';
|
7098
7084
|
|
7099
|
-
if (
|
7100
|
-
|
7101
|
-
|
7102
|
-
|
7103
|
-
|
7104
|
-
|
7105
|
-
|
7106
|
-
|
7107
|
-
|
7085
|
+
if (ii === 0) {
|
7086
|
+
if (hasInitialNewLine) {
|
7087
|
+
preString = ' ';
|
7088
|
+
leading = '\n';
|
7089
|
+
}
|
7090
|
+
if (trimmedChildValueWithSpace.substring(0, 1) === ' ') {
|
7091
|
+
// If this is the first line, and the original content starts with
|
7092
|
+
// whitespace, place a single space at the beginning.
|
7093
|
+
preString = ' ';
|
7094
|
+
}
|
7095
|
+
} else {
|
7096
|
+
leading = line.match(/^[ \t]*/)[0];
|
7108
7097
|
}
|
7109
|
-
|
7110
|
-
|
7111
|
-
|
7112
|
-
|
7113
|
-
|
7114
|
-
|
7115
|
-
|
7116
|
-
}
|
7117
|
-
if (typeof extra.tokens !== 'undefined') {
|
7118
|
-
filterTokenLocation();
|
7119
|
-
program.tokens = extra.tokens;
|
7120
|
-
}
|
7121
|
-
if (typeof extra.errors !== 'undefined') {
|
7122
|
-
program.errors = extra.errors;
|
7123
|
-
}
|
7124
|
-
if (extra.range || extra.loc) {
|
7125
|
-
program.body = filterGroup(program.body);
|
7126
|
-
}
|
7127
|
-
} catch (e) {
|
7128
|
-
throw e;
|
7129
|
-
} finally {
|
7130
|
-
unpatch();
|
7131
|
-
extra = {};
|
7098
|
+
if (!lastLine || trimmedChildValueWithSpace.substr(
|
7099
|
+
trimmedChildValueWithSpace.length - 1, 1) === ' ' ||
|
7100
|
+
hasFinalNewLine
|
7101
|
+
) {
|
7102
|
+
// If either not on the last line, or the original content ends with
|
7103
|
+
// whitespace, place a single character at the end.
|
7104
|
+
postString = ' ';
|
7132
7105
|
}
|
7133
7106
|
|
7134
|
-
|
7107
|
+
append(
|
7108
|
+
leading +
|
7109
|
+
JSON.stringify(
|
7110
|
+
preString + trimmedLine + postString
|
7111
|
+
) +
|
7112
|
+
(lastLine ? '' : '+') +
|
7113
|
+
line.match(/[ \t]*$/)[0],
|
7114
|
+
state);
|
7115
|
+
}
|
7116
|
+
if (!lastLine) {
|
7117
|
+
append('\n', state);
|
7118
|
+
}
|
7119
|
+
});
|
7120
|
+
} else {
|
7121
|
+
if (start) {
|
7122
|
+
append(start, state);
|
7135
7123
|
}
|
7124
|
+
append('""', state);
|
7125
|
+
}
|
7126
|
+
if (end) {
|
7127
|
+
append(end, state);
|
7128
|
+
}
|
7136
7129
|
|
7137
|
-
|
7138
|
-
|
7139
|
-
|
7140
|
-
|
7141
|
-
|
7142
|
-
exports.parse = parse;
|
7143
|
-
|
7144
|
-
// Deep copy.
|
7145
|
-
exports.Syntax = (function () {
|
7146
|
-
var name, types = {};
|
7147
|
-
|
7148
|
-
if (typeof Object.create === 'function') {
|
7149
|
-
types = Object.create(null);
|
7150
|
-
}
|
7130
|
+
// add comma before trailing whitespace
|
7131
|
+
if (!isLast) {
|
7132
|
+
append(',', state);
|
7133
|
+
}
|
7151
7134
|
|
7152
|
-
|
7153
|
-
|
7154
|
-
|
7155
|
-
|
7156
|
-
}
|
7135
|
+
// tail whitespace
|
7136
|
+
append(object.value.match(/[ \t]*$/)[0], state);
|
7137
|
+
move(object.range[1], state);
|
7138
|
+
}
|
7157
7139
|
|
7158
|
-
|
7159
|
-
|
7160
|
-
|
7140
|
+
function renderXJSExpression(traverse, object, isLast, path, state) {
|
7141
|
+
// Plus 1 to skip `{`.
|
7142
|
+
move(object.range[0] + 1, state);
|
7143
|
+
traverse(object.value, path, state);
|
7144
|
+
if (!isLast) {
|
7145
|
+
// If we need to append a comma, make sure to do so after the expression.
|
7146
|
+
catchup(object.value.range[1], state);
|
7147
|
+
append(',', state);
|
7148
|
+
}
|
7149
|
+
// Minus 1 to skip `}`.
|
7150
|
+
catchup(object.range[1] - 1, state);
|
7151
|
+
move(object.range[1], state);
|
7152
|
+
return false;
|
7153
|
+
}
|
7161
7154
|
|
7162
|
-
|
7163
|
-
|
7155
|
+
function quoteAttrName(attr) {
|
7156
|
+
// Quote invalid JS identifiers.
|
7157
|
+
if (!/^[a-z_$][a-z\d_$]*$/i.test(attr)) {
|
7158
|
+
return "'" + attr + "'";
|
7159
|
+
}
|
7160
|
+
return attr;
|
7161
|
+
}
|
7164
7162
|
|
7165
|
-
|
7166
|
-
|
7163
|
+
exports.knownTags = knownTags;
|
7164
|
+
exports.renderXJSExpression = renderXJSExpression;
|
7165
|
+
exports.renderXJSLiteral = renderXJSLiteral;
|
7166
|
+
exports.quoteAttrName = quoteAttrName;
|
7167
7167
|
|
7168
7168
|
})()
|
7169
|
-
},{}],
|
7169
|
+
},{"../lib/utils":8}],10:[function(require,module,exports){
|
7170
7170
|
/*
|
7171
7171
|
* Copyright 2009-2011 Mozilla Foundation and contributors
|
7172
7172
|
* Licensed under the New BSD license. See LICENSE.txt or:
|
@@ -7671,7 +7671,7 @@ exports.visitSuperCall = visitSuperCall;
|
|
7671
7671
|
exports.visitPrivateProperty = visitPrivateProperty;
|
7672
7672
|
|
7673
7673
|
})()
|
7674
|
-
},{"../lib/utils":8,"../lib/docblock":4,"esprima":
|
7674
|
+
},{"../lib/utils":8,"../lib/docblock":4,"esprima":9,"base62":15}],6:[function(require,module,exports){
|
7675
7675
|
(function(){/**
|
7676
7676
|
* Copyright 2013 Facebook, Inc.
|
7677
7677
|
*
|
@@ -7872,7 +7872,7 @@ visitReactTag.test = function(object, path, state) {
|
|
7872
7872
|
exports.visitReactTag = visitReactTag;
|
7873
7873
|
|
7874
7874
|
})()
|
7875
|
-
},{"../lib/utils":8,"./xjs":11,"esprima":
|
7875
|
+
},{"../lib/utils":8,"./xjs":11,"esprima":9}],7:[function(require,module,exports){
|
7876
7876
|
(function(){/**
|
7877
7877
|
* Copyright 2013 Facebook, Inc.
|
7878
7878
|
*
|
@@ -7911,38 +7911,34 @@ var getDocblock = require('../lib/utils').getDocblock;
|
|
7911
7911
|
* });
|
7912
7912
|
*/
|
7913
7913
|
function visitReactDisplayName(traverse, object, path, state) {
|
7914
|
-
object.
|
7915
|
-
|
7916
|
-
|
7917
|
-
|
7918
|
-
|
7919
|
-
|
7920
|
-
|
7921
|
-
|
7922
|
-
|
7923
|
-
|
7924
|
-
|
7925
|
-
|
7926
|
-
|
7927
|
-
|
7928
|
-
|
7929
|
-
append("displayName: '" + displayName + "',", state);
|
7930
|
-
}
|
7931
|
-
});
|
7914
|
+
if (object.id.type === Syntax.Identifier &&
|
7915
|
+
object.init &&
|
7916
|
+
object.init.type === Syntax.CallExpression &&
|
7917
|
+
object.init.callee.type === Syntax.MemberExpression &&
|
7918
|
+
object.init.callee.object.type === Syntax.Identifier &&
|
7919
|
+
object.init.callee.object.name === 'React' &&
|
7920
|
+
object.init.callee.property.type === Syntax.Identifier &&
|
7921
|
+
object.init.callee.property.name === 'createClass' &&
|
7922
|
+
object.init['arguments'].length === 1 &&
|
7923
|
+
object.init['arguments'][0].type === Syntax.ObjectExpression) {
|
7924
|
+
|
7925
|
+
var displayName = object.id.name;
|
7926
|
+
catchup(object.init['arguments'][0].range[0] + 1, state);
|
7927
|
+
append("displayName: '" + displayName + "',", state);
|
7928
|
+
}
|
7932
7929
|
}
|
7933
7930
|
|
7934
|
-
|
7935
7931
|
/**
|
7936
7932
|
* Will only run on @jsx files for now.
|
7937
7933
|
*/
|
7938
7934
|
visitReactDisplayName.test = function(object, path, state) {
|
7939
|
-
return object.type === Syntax.
|
7935
|
+
return object.type === Syntax.VariableDeclarator && !!getDocblock(state).jsx;
|
7940
7936
|
};
|
7941
7937
|
|
7942
7938
|
exports.visitReactDisplayName = visitReactDisplayName;
|
7943
7939
|
|
7944
7940
|
})()
|
7945
|
-
},{"../lib/utils":8,"esprima":
|
7941
|
+
},{"../lib/utils":8,"esprima":9}],15:[function(require,module,exports){
|
7946
7942
|
var Base62 = (function (my) {
|
7947
7943
|
my.chars = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"]
|
7948
7944
|
|