build/JSXTransformer.js in react-source-0.3.0 vs build/JSXTransformer.js in react-source-0.3.2
- old
+ new
@@ -1,7 +1,7 @@
/**
- * JSXTransformer v0.3.0
+ * JSXTransformer v0.3.2
*/
(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;
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){
/**
* Copyright 2013 Facebook, Inc.
@@ -727,298 +727,11 @@
exports.transform = transform;
})()
-},{"./utils":8,"source-map":9,"esprima":10}],11:[function(require,module,exports){
-(function(){/**
- * Copyright 2013 Facebook, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/*global exports:true*/
-"use strict";
-var catchup = require('../lib/utils').catchup;
-var append = require('../lib/utils').append;
-var move = require('../lib/utils').move;
-
-var knownTags = {
- a: true,
- abbr: true,
- address: true,
- applet: true,
- area: true,
- article: true,
- aside: true,
- audio: true,
- b: true,
- base: true,
- bdi: true,
- bdo: true,
- blockquote: true,
- body: true,
- br: true,
- button: true,
- canvas: true,
- circle: true,
- ellipse: true,
- caption: true,
- cite: true,
- code: true,
- col: true,
- colgroup: true,
- command: true,
- data: true,
- datalist: true,
- dd: true,
- del: true,
- details: true,
- dfn: true,
- dialog: true,
- div: true,
- dl: true,
- dt: true,
- em: true,
- embed: true,
- fieldset: true,
- figcaption: true,
- figure: true,
- footer: true,
- form: true,
- g: true,
- h1: true,
- h2: true,
- h3: true,
- h4: true,
- h5: true,
- h6: true,
- head: true,
- header: true,
- hgroup: true,
- hr: true,
- html: true,
- i: true,
- iframe: true,
- img: true,
- input: true,
- ins: true,
- kbd: true,
- keygen: true,
- label: true,
- legend: true,
- li: true,
- line: true,
- link: true,
- map: true,
- mark: true,
- marquee: true,
- menu: true,
- meta: true,
- meter: true,
- nav: true,
- noscript: true,
- object: true,
- ol: true,
- optgroup: true,
- option: true,
- output: true,
- p: true,
- path: true,
- param: true,
- pre: true,
- progress: true,
- q: true,
- rect: true,
- rp: true,
- rt: true,
- ruby: true,
- s: true,
- samp: true,
- script: true,
- section: true,
- select: true,
- small: true,
- source: true,
- span: true,
- strong: true,
- style: true,
- sub: true,
- summary: true,
- sup: true,
- svg: true,
- table: true,
- tbody: true,
- td: true,
- text: true,
- textarea: true,
- tfoot: true,
- th: true,
- thead: true,
- time: true,
- title: true,
- tr: true,
- track: true,
- u: true,
- ul: true,
- 'var': true,
- video: true,
- wbr: true
-};
-
-function safeTrim(string) {
- return string.replace(/^[ \t]+/, '').replace(/[ \t]+$/, '');
-}
-
-// Replace all trailing whitespace characters with a single space character
-function trimWithSingleSpace(string) {
- return string.replace(/^[ \t\xA0]{2,}/, ' ').
- replace(/[ \t\xA0]{2,}$/, ' ').replace(/^\s+$/, '');
-}
-
-/**
- * Special handling for multiline string literals
- * print lines:
- *
- * line
- * line
- *
- * as:
- *
- * "line "+
- * "line"
- */
-function renderXJSLiteral(object, isLast, state, start, end) {
- /** Added blank check filtering and triming*/
- var trimmedChildValue = safeTrim(object.value);
-
- if (trimmedChildValue) {
- // head whitespace
- append(object.value.match(/^[\t ]*/)[0], state);
- if (start) {
- append(start, state);
- }
-
- var trimmedChildValueWithSpace = trimWithSingleSpace(object.value);
-
- /**
- */
- var initialLines = trimmedChildValue.split(/\r\n|\n|\r/);
-
- var lines = initialLines.filter(function(line) {
- return safeTrim(line).length > 0;
- });
-
- var hasInitialNewLine = initialLines[0] !== lines[0];
- var hasFinalNewLine =
- initialLines[initialLines.length - 1] !== lines[lines.length - 1];
-
- var numLines = lines.length;
- lines.forEach(function (line, ii) {
- var lastLine = ii === numLines - 1;
- var trimmedLine = safeTrim(line);
- if (trimmedLine === '' && !lastLine) {
- append(line, state);
- } else {
- var preString = '';
- var postString = '';
- var leading = '';
-
- if (ii === 0) {
- if (hasInitialNewLine) {
- preString = ' ';
- leading = '\n';
- }
- if (trimmedChildValueWithSpace.substring(0, 1) === ' ') {
- // If this is the first line, and the original content starts with
- // whitespace, place a single space at the beginning.
- preString = ' ';
- }
- } else {
- leading = line.match(/^[ \t]*/)[0];
- }
- if (!lastLine || trimmedChildValueWithSpace.substr(
- trimmedChildValueWithSpace.length - 1, 1) === ' ' ||
- hasFinalNewLine
- ) {
- // If either not on the last line, or the original content ends with
- // whitespace, place a single character at the end.
- postString = ' ';
- }
-
- append(
- leading +
- JSON.stringify(
- preString + trimmedLine + postString
- ) +
- (lastLine ? '' : '+') +
- line.match(/[ \t]*$/)[0],
- state);
- }
- if (!lastLine) {
- append('\n', state);
- }
- });
- } else {
- if (start) {
- append(start, state);
- }
- append('""', state);
- }
- if (end) {
- append(end, state);
- }
-
- // add comma before trailing whitespace
- if (!isLast) {
- append(',', state);
- }
-
- // tail whitespace
- append(object.value.match(/[ \t]*$/)[0], state);
- move(object.range[1], state);
-}
-
-function renderXJSExpression(traverse, object, isLast, path, state) {
- // Plus 1 to skip `{`.
- move(object.range[0] + 1, state);
- traverse(object.value, path, state);
- if (!isLast) {
- // If we need to append a comma, make sure to do so after the expression.
- catchup(object.value.range[1], state);
- append(',', state);
- }
- // Minus 1 to skip `}`.
- catchup(object.range[1] - 1, state);
- move(object.range[1], state);
- return false;
-}
-
-function quoteAttrName(attr) {
- // Quote invalid JS identifiers.
- if (!/^[a-z_$][a-z\d_$]*$/i.test(attr)) {
- return "'" + attr + "'";
- }
- return attr;
-}
-
-exports.knownTags = knownTags;
-exports.renderXJSExpression = renderXJSExpression;
-exports.renderXJSLiteral = renderXJSLiteral;
-exports.quoteAttrName = quoteAttrName;
-
-})()
-},{"../lib/utils":8}],10:[function(require,module,exports){
+},{"./utils":8,"esprima":9,"source-map":10}],9:[function(require,module,exports){
(function(){/*
Copyright (C) 2013 Thaddee Tyl <thaddee.tyl@gmail.com>
Copyright (C) 2012 Ariya Hidayat <ariya.hidayat@gmail.com>
Copyright (C) 2012 Mathias Bynens <mathias@qiwi.be>
Copyright (C) 2012 Joost-Wim Boekesteijn <joost-wim@boekesteijn.nl>
@@ -7164,11 +6877,298 @@
}));
/* vim: set sw=4 ts=4 et tw=80 : */
})()
-},{}],9:[function(require,module,exports){
+},{}],11:[function(require,module,exports){
+(function(){/**
+ * Copyright 2013 Facebook, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/*global exports:true*/
+"use strict";
+var catchup = require('../lib/utils').catchup;
+var append = require('../lib/utils').append;
+var move = require('../lib/utils').move;
+
+var knownTags = {
+ a: true,
+ abbr: true,
+ address: true,
+ applet: true,
+ area: true,
+ article: true,
+ aside: true,
+ audio: true,
+ b: true,
+ base: true,
+ bdi: true,
+ bdo: true,
+ blockquote: true,
+ body: true,
+ br: true,
+ button: true,
+ canvas: true,
+ circle: true,
+ ellipse: true,
+ caption: true,
+ cite: true,
+ code: true,
+ col: true,
+ colgroup: true,
+ command: true,
+ data: true,
+ datalist: true,
+ dd: true,
+ del: true,
+ details: true,
+ dfn: true,
+ dialog: true,
+ div: true,
+ dl: true,
+ dt: true,
+ em: true,
+ embed: true,
+ fieldset: true,
+ figcaption: true,
+ figure: true,
+ footer: true,
+ form: true,
+ g: true,
+ h1: true,
+ h2: true,
+ h3: true,
+ h4: true,
+ h5: true,
+ h6: true,
+ head: true,
+ header: true,
+ hgroup: true,
+ hr: true,
+ html: true,
+ i: true,
+ iframe: true,
+ img: true,
+ input: true,
+ ins: true,
+ kbd: true,
+ keygen: true,
+ label: true,
+ legend: true,
+ li: true,
+ line: true,
+ link: true,
+ map: true,
+ mark: true,
+ marquee: true,
+ menu: true,
+ meta: true,
+ meter: true,
+ nav: true,
+ noscript: true,
+ object: true,
+ ol: true,
+ optgroup: true,
+ option: true,
+ output: true,
+ p: true,
+ path: true,
+ param: true,
+ pre: true,
+ progress: true,
+ q: true,
+ rect: true,
+ rp: true,
+ rt: true,
+ ruby: true,
+ s: true,
+ samp: true,
+ script: true,
+ section: true,
+ select: true,
+ small: true,
+ source: true,
+ span: true,
+ strong: true,
+ style: true,
+ sub: true,
+ summary: true,
+ sup: true,
+ svg: true,
+ table: true,
+ tbody: true,
+ td: true,
+ text: true,
+ textarea: true,
+ tfoot: true,
+ th: true,
+ thead: true,
+ time: true,
+ title: true,
+ tr: true,
+ track: true,
+ u: true,
+ ul: true,
+ 'var': true,
+ video: true,
+ wbr: true
+};
+
+function safeTrim(string) {
+ return string.replace(/^[ \t]+/, '').replace(/[ \t]+$/, '');
+}
+
+// Replace all trailing whitespace characters with a single space character
+function trimWithSingleSpace(string) {
+ return string.replace(/^[ \t\xA0]{2,}/, ' ').
+ replace(/[ \t\xA0]{2,}$/, ' ').replace(/^\s+$/, '');
+}
+
+/**
+ * Special handling for multiline string literals
+ * print lines:
+ *
+ * line
+ * line
+ *
+ * as:
+ *
+ * "line "+
+ * "line"
+ */
+function renderXJSLiteral(object, isLast, state, start, end) {
+ /** Added blank check filtering and triming*/
+ var trimmedChildValue = safeTrim(object.value);
+
+ if (trimmedChildValue) {
+ // head whitespace
+ append(object.value.match(/^[\t ]*/)[0], state);
+ if (start) {
+ append(start, state);
+ }
+
+ var trimmedChildValueWithSpace = trimWithSingleSpace(object.value);
+
+ /**
+ */
+ var initialLines = trimmedChildValue.split(/\r\n|\n|\r/);
+
+ var lines = initialLines.filter(function(line) {
+ return safeTrim(line).length > 0;
+ });
+
+ var hasInitialNewLine = initialLines[0] !== lines[0];
+ var hasFinalNewLine =
+ initialLines[initialLines.length - 1] !== lines[lines.length - 1];
+
+ var numLines = lines.length;
+ lines.forEach(function (line, ii) {
+ var lastLine = ii === numLines - 1;
+ var trimmedLine = safeTrim(line);
+ if (trimmedLine === '' && !lastLine) {
+ append(line, state);
+ } else {
+ var preString = '';
+ var postString = '';
+ var leading = '';
+
+ if (ii === 0) {
+ if (hasInitialNewLine) {
+ preString = ' ';
+ leading = '\n';
+ }
+ if (trimmedChildValueWithSpace.substring(0, 1) === ' ') {
+ // If this is the first line, and the original content starts with
+ // whitespace, place a single space at the beginning.
+ preString = ' ';
+ }
+ } else {
+ leading = line.match(/^[ \t]*/)[0];
+ }
+ if (!lastLine || trimmedChildValueWithSpace.substr(
+ trimmedChildValueWithSpace.length - 1, 1) === ' ' ||
+ hasFinalNewLine
+ ) {
+ // If either not on the last line, or the original content ends with
+ // whitespace, place a single character at the end.
+ postString = ' ';
+ }
+
+ append(
+ leading +
+ JSON.stringify(
+ preString + trimmedLine + postString
+ ) +
+ (lastLine ? '' : '+') +
+ line.match(/[ \t]*$/)[0],
+ state);
+ }
+ if (!lastLine) {
+ append('\n', state);
+ }
+ });
+ } else {
+ if (start) {
+ append(start, state);
+ }
+ append('""', state);
+ }
+ if (end) {
+ append(end, state);
+ }
+
+ // add comma before trailing whitespace
+ if (!isLast) {
+ append(',', state);
+ }
+
+ // tail whitespace
+ append(object.value.match(/[ \t]*$/)[0], state);
+ move(object.range[1], state);
+}
+
+function renderXJSExpression(traverse, object, isLast, path, state) {
+ // Plus 1 to skip `{`.
+ move(object.range[0] + 1, state);
+ traverse(object.value, path, state);
+ if (!isLast) {
+ // If we need to append a comma, make sure to do so after the expression.
+ catchup(object.value.range[1], state);
+ append(',', state);
+ }
+ // Minus 1 to skip `}`.
+ catchup(object.range[1] - 1, state);
+ move(object.range[1], state);
+ return false;
+}
+
+function quoteAttrName(attr) {
+ // Quote invalid JS identifiers.
+ if (!/^[a-z_$][a-z\d_$]*$/i.test(attr)) {
+ return "'" + attr + "'";
+ }
+ return attr;
+}
+
+exports.knownTags = knownTags;
+exports.renderXJSExpression = renderXJSExpression;
+exports.renderXJSLiteral = renderXJSLiteral;
+exports.quoteAttrName = quoteAttrName;
+
+})()
+},{"../lib/utils":8}],10:[function(require,module,exports){
/*
* Copyright 2009-2011 Mozilla Foundation and contributors
* Licensed under the New BSD license. See LICENSE.txt or:
* http://opensource.org/licenses/BSD-3-Clause
*/
@@ -7669,11 +7669,11 @@
exports.visitClassExpression = visitClassExpression;
exports.visitSuperCall = visitSuperCall;
exports.visitPrivateProperty = visitPrivateProperty;
})()
-},{"../lib/utils":8,"../lib/docblock":4,"esprima":10,"base62":15}],6:[function(require,module,exports){
+},{"../lib/utils":8,"../lib/docblock":4,"esprima":9,"base62":15}],6:[function(require,module,exports){
(function(){/**
* Copyright 2013 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -7870,11 +7870,11 @@
};
exports.visitReactTag = visitReactTag;
})()
-},{"../lib/utils":8,"./xjs":11,"esprima":10}],7:[function(require,module,exports){
+},{"../lib/utils":8,"./xjs":11,"esprima":9}],7:[function(require,module,exports){
(function(){/**
* Copyright 2013 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -7909,41 +7909,37 @@
* displayName: 'MyComponent',
* render: ...
* });
*/
function visitReactDisplayName(traverse, object, path, state) {
- object.declarations.forEach(function(dec) {
- if (dec.type === Syntax.VariableDeclarator &&
- dec.id.type === Syntax.Identifier &&
- dec.init &&
- dec.init.type === Syntax.CallExpression &&
- dec.init.callee.type === Syntax.MemberExpression &&
- dec.init.callee.object.type === Syntax.Identifier &&
- dec.init.callee.object.name === 'React' &&
- dec.init.callee.property.type === Syntax.Identifier &&
- dec.init.callee.property.name === 'createClass' &&
- dec.init['arguments'].length === 1 &&
- dec.init['arguments'][0].type === Syntax.ObjectExpression) {
+ if (object.id.type === Syntax.Identifier &&
+ object.init &&
+ object.init.type === Syntax.CallExpression &&
+ object.init.callee.type === Syntax.MemberExpression &&
+ object.init.callee.object.type === Syntax.Identifier &&
+ object.init.callee.object.name === 'React' &&
+ object.init.callee.property.type === Syntax.Identifier &&
+ object.init.callee.property.name === 'createClass' &&
+ object.init['arguments'].length === 1 &&
+ object.init['arguments'][0].type === Syntax.ObjectExpression) {
- var displayName = dec.id.name;
- catchup(dec.init['arguments'][0].range[0] + 1, state);
- append("displayName: '" + displayName + "',", state);
- }
- });
+ var displayName = object.id.name;
+ catchup(object.init['arguments'][0].range[0] + 1, state);
+ append("displayName: '" + displayName + "',", state);
+ }
}
-
/**
* Will only run on @jsx files for now.
*/
visitReactDisplayName.test = function(object, path, state) {
- return object.type === Syntax.VariableDeclaration && !!getDocblock(state).jsx;
+ return object.type === Syntax.VariableDeclarator && !!getDocblock(state).jsx;
};
exports.visitReactDisplayName = visitReactDisplayName;
})()
-},{"../lib/utils":8,"esprima":10}],15:[function(require,module,exports){
+},{"../lib/utils":8,"esprima":9}],15:[function(require,module,exports){
var Base62 = (function (my) {
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"]
my.encode = function(i){
if (i === 0) {return '0'}
\ No newline at end of file