coffee-react 0.2.2 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2aea1724f3371e76f346b124e2c4fff219eab1a6
4
- data.tar.gz: bd0b48b699802ac94ea57912592f32082181833f
3
+ metadata.gz: c04bfc827d4ad9e536ef5e0cfb561cb7bc1a408c
4
+ data.tar.gz: df28f7a96a1fb37c1cbac89e1a0f9f31402b94d3
5
5
  SHA512:
6
- metadata.gz: 7a521c92cb0e1308e72692f7ca7e586d30f080d383e90ee25b59201728a63fb5c4e173e2a8052da69128bc59633e4784a7199773f3938b4d5f1d109acee42168
7
- data.tar.gz: 170cc565894fc121a87ac26a05e0e69bedd71129b55255af81a981b683896694b74d4afaf4c34e897badc8ad6d37a06af5392fb57b7d4da2c2146fd80e52445c
6
+ metadata.gz: d0d2961ec9ec4a66b6717be44b15a7762067b35c5208d2e9371c450d885dcefc268179210ccd70131ccfb5291fe2af900365cc8d7c64835df513ae16e3ae6d1b
7
+ data.tar.gz: 1cc5dd1a3ce0eb4dce664a6848e672260475014cad5a70d707faafb17dfae4bc5ac1e8eb1ee1c9c0a159576cd49b2e3dfd74eaeeffd87d1bd63e5d9e764e3a2f
@@ -1,12 +1,291 @@
1
- require=(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})({"GqH0vP":[function(require,module,exports){
2
- module.exports = require('./lib/transformer').transform;
1
+ !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){
2
+ module.exports = _dereq_('./lib/transformer').transform;
3
+
4
+ },{"./lib/transformer":9}],2:[function(_dereq_,module,exports){
5
+ // from esprima-fb/esprima.js
6
+
7
+ var XHTMLEntities = {
8
+ quot: '\u0022',
9
+ amp: '&',
10
+ apos: "\u0027",
11
+ lt: "<",
12
+ gt: ">",
13
+ nbsp: "\u00A0",
14
+ iexcl: "\u00A1",
15
+ cent: "\u00A2",
16
+ pound: "\u00A3",
17
+ curren: "\u00A4",
18
+ yen: "\u00A5",
19
+ brvbar: "\u00A6",
20
+ sect: "\u00A7",
21
+ uml: "\u00A8",
22
+ copy: "\u00A9",
23
+ ordf: "\u00AA",
24
+ laquo: "\u00AB",
25
+ not: "\u00AC",
26
+ shy: "\u00AD",
27
+ reg: "\u00AE",
28
+ macr: "\u00AF",
29
+ deg: "\u00B0",
30
+ plusmn: "\u00B1",
31
+ sup2: "\u00B2",
32
+ sup3: "\u00B3",
33
+ acute: "\u00B4",
34
+ micro: "\u00B5",
35
+ para: "\u00B6",
36
+ middot: "\u00B7",
37
+ cedil: "\u00B8",
38
+ sup1: "\u00B9",
39
+ ordm: "\u00BA",
40
+ raquo: "\u00BB",
41
+ frac14: "\u00BC",
42
+ frac12: "\u00BD",
43
+ frac34: "\u00BE",
44
+ iquest: "\u00BF",
45
+ Agrave: "\u00C0",
46
+ Aacute: "\u00C1",
47
+ Acirc: "\u00C2",
48
+ Atilde: "\u00C3",
49
+ Auml: "\u00C4",
50
+ Aring: "\u00C5",
51
+ AElig: "\u00C6",
52
+ Ccedil: "\u00C7",
53
+ Egrave: "\u00C8",
54
+ Eacute: "\u00C9",
55
+ Ecirc: "\u00CA",
56
+ Euml: "\u00CB",
57
+ Igrave: "\u00CC",
58
+ Iacute: "\u00CD",
59
+ Icirc: "\u00CE",
60
+ Iuml: "\u00CF",
61
+ ETH: "\u00D0",
62
+ Ntilde: "\u00D1",
63
+ Ograve: "\u00D2",
64
+ Oacute: "\u00D3",
65
+ Ocirc: "\u00D4",
66
+ Otilde: "\u00D5",
67
+ Ouml: "\u00D6",
68
+ times: "\u00D7",
69
+ Oslash: "\u00D8",
70
+ Ugrave: "\u00D9",
71
+ Uacute: "\u00DA",
72
+ Ucirc: "\u00DB",
73
+ Uuml: "\u00DC",
74
+ Yacute: "\u00DD",
75
+ THORN: "\u00DE",
76
+ szlig: "\u00DF",
77
+ agrave: "\u00E0",
78
+ aacute: "\u00E1",
79
+ acirc: "\u00E2",
80
+ atilde: "\u00E3",
81
+ auml: "\u00E4",
82
+ aring: "\u00E5",
83
+ aelig: "\u00E6",
84
+ ccedil: "\u00E7",
85
+ egrave: "\u00E8",
86
+ eacute: "\u00E9",
87
+ ecirc: "\u00EA",
88
+ euml: "\u00EB",
89
+ igrave: "\u00EC",
90
+ iacute: "\u00ED",
91
+ icirc: "\u00EE",
92
+ iuml: "\u00EF",
93
+ eth: "\u00F0",
94
+ ntilde: "\u00F1",
95
+ ograve: "\u00F2",
96
+ oacute: "\u00F3",
97
+ ocirc: "\u00F4",
98
+ otilde: "\u00F5",
99
+ ouml: "\u00F6",
100
+ divide: "\u00F7",
101
+ oslash: "\u00F8",
102
+ ugrave: "\u00F9",
103
+ uacute: "\u00FA",
104
+ ucirc: "\u00FB",
105
+ uuml: "\u00FC",
106
+ yacute: "\u00FD",
107
+ thorn: "\u00FE",
108
+ yuml: "\u00FF",
109
+ OElig: "\u0152",
110
+ oelig: "\u0153",
111
+ Scaron: "\u0160",
112
+ scaron: "\u0161",
113
+ Yuml: "\u0178",
114
+ fnof: "\u0192",
115
+ circ: "\u02C6",
116
+ tilde: "\u02DC",
117
+ Alpha: "\u0391",
118
+ Beta: "\u0392",
119
+ Gamma: "\u0393",
120
+ Delta: "\u0394",
121
+ Epsilon: "\u0395",
122
+ Zeta: "\u0396",
123
+ Eta: "\u0397",
124
+ Theta: "\u0398",
125
+ Iota: "\u0399",
126
+ Kappa: "\u039A",
127
+ Lambda: "\u039B",
128
+ Mu: "\u039C",
129
+ Nu: "\u039D",
130
+ Xi: "\u039E",
131
+ Omicron: "\u039F",
132
+ Pi: "\u03A0",
133
+ Rho: "\u03A1",
134
+ Sigma: "\u03A3",
135
+ Tau: "\u03A4",
136
+ Upsilon: "\u03A5",
137
+ Phi: "\u03A6",
138
+ Chi: "\u03A7",
139
+ Psi: "\u03A8",
140
+ Omega: "\u03A9",
141
+ alpha: "\u03B1",
142
+ beta: "\u03B2",
143
+ gamma: "\u03B3",
144
+ delta: "\u03B4",
145
+ epsilon: "\u03B5",
146
+ zeta: "\u03B6",
147
+ eta: "\u03B7",
148
+ theta: "\u03B8",
149
+ iota: "\u03B9",
150
+ kappa: "\u03BA",
151
+ lambda: "\u03BB",
152
+ mu: "\u03BC",
153
+ nu: "\u03BD",
154
+ xi: "\u03BE",
155
+ omicron: "\u03BF",
156
+ pi: "\u03C0",
157
+ rho: "\u03C1",
158
+ sigmaf: "\u03C2",
159
+ sigma: "\u03C3",
160
+ tau: "\u03C4",
161
+ upsilon: "\u03C5",
162
+ phi: "\u03C6",
163
+ chi: "\u03C7",
164
+ psi: "\u03C8",
165
+ omega: "\u03C9",
166
+ thetasym: "\u03D1",
167
+ upsih: "\u03D2",
168
+ piv: "\u03D6",
169
+ ensp: "\u2002",
170
+ emsp: "\u2003",
171
+ thinsp: "\u2009",
172
+ zwnj: "\u200C",
173
+ zwj: "\u200D",
174
+ lrm: "\u200E",
175
+ rlm: "\u200F",
176
+ ndash: "\u2013",
177
+ mdash: "\u2014",
178
+ lsquo: "\u2018",
179
+ rsquo: "\u2019",
180
+ sbquo: "\u201A",
181
+ ldquo: "\u201C",
182
+ rdquo: "\u201D",
183
+ bdquo: "\u201E",
184
+ dagger: "\u2020",
185
+ Dagger: "\u2021",
186
+ bull: "\u2022",
187
+ hellip: "\u2026",
188
+ permil: "\u2030",
189
+ prime: "\u2032",
190
+ Prime: "\u2033",
191
+ lsaquo: "\u2039",
192
+ rsaquo: "\u203A",
193
+ oline: "\u203E",
194
+ frasl: "\u2044",
195
+ euro: "\u20AC",
196
+ image: "\u2111",
197
+ weierp: "\u2118",
198
+ real: "\u211C",
199
+ trade: "\u2122",
200
+ alefsym: "\u2135",
201
+ larr: "\u2190",
202
+ uarr: "\u2191",
203
+ rarr: "\u2192",
204
+ darr: "\u2193",
205
+ harr: "\u2194",
206
+ crarr: "\u21B5",
207
+ lArr: "\u21D0",
208
+ uArr: "\u21D1",
209
+ rArr: "\u21D2",
210
+ dArr: "\u21D3",
211
+ hArr: "\u21D4",
212
+ forall: "\u2200",
213
+ part: "\u2202",
214
+ exist: "\u2203",
215
+ empty: "\u2205",
216
+ nabla: "\u2207",
217
+ isin: "\u2208",
218
+ notin: "\u2209",
219
+ ni: "\u220B",
220
+ prod: "\u220F",
221
+ sum: "\u2211",
222
+ minus: "\u2212",
223
+ lowast: "\u2217",
224
+ radic: "\u221A",
225
+ prop: "\u221D",
226
+ infin: "\u221E",
227
+ ang: "\u2220",
228
+ and: "\u2227",
229
+ or: "\u2228",
230
+ cap: "\u2229",
231
+ cup: "\u222A",
232
+ "int": "\u222B",
233
+ there4: "\u2234",
234
+ sim: "\u223C",
235
+ cong: "\u2245",
236
+ asymp: "\u2248",
237
+ ne: "\u2260",
238
+ equiv: "\u2261",
239
+ le: "\u2264",
240
+ ge: "\u2265",
241
+ sub: "\u2282",
242
+ sup: "\u2283",
243
+ nsub: "\u2284",
244
+ sube: "\u2286",
245
+ supe: "\u2287",
246
+ oplus: "\u2295",
247
+ otimes: "\u2297",
248
+ perp: "\u22A5",
249
+ sdot: "\u22C5",
250
+ lceil: "\u2308",
251
+ rceil: "\u2309",
252
+ lfloor: "\u230A",
253
+ rfloor: "\u230B",
254
+ lang: "\u2329",
255
+ rang: "\u232A",
256
+ loz: "\u25CA",
257
+ spades: "\u2660",
258
+ clubs: "\u2663",
259
+ hearts: "\u2665",
260
+ diams: "\u2666"
261
+ };
262
+
263
+ module.exports = function decode(str) {
264
+ return str
265
+ .replace(/&#(\d+);?/g, function (_, code) {
266
+ return String.fromCharCode(parseInt(code, 10));
267
+ })
268
+ .replace(/&#[xX]([A-Fa-f0-9]+);?/g, function (_, hex) {
269
+ return String.fromCharCode(parseInt(hex, 16));
270
+ })
271
+ .replace(/&([^;\W]+;?)/g, function (m, e) {
272
+ var ee = e.replace(/;$/, '');
273
+ var entity = XHTMLEntities[e]
274
+ || (e.match(/;$/) && XHTMLEntities[ee])
275
+ ;
276
+
277
+ if (entity) {
278
+ return entity;
279
+ }
280
+ else {
281
+ return m;
282
+ }
283
+ })
284
+ }
3
285
 
4
- },{"./lib/transformer":10}],"coffee-react-transform":[function(require,module,exports){
5
- module.exports=require('GqH0vP');
6
- },{}],3:[function(require,module,exports){
7
- (function (process){
286
+ },{}],3:[function(_dereq_,module,exports){
8
287
  // Generated by CoffeeScript 1.7.1
9
- var buildLocationData, extend, flatten, last, repeat, syntaxErrorToString, _ref;
288
+ var extend, flatten, last, repeat, syntaxErrorToString, _ref;
10
289
 
11
290
  exports.starts = function(string, literal, start) {
12
291
  return literal === string.substr(start, literal.length);
@@ -104,94 +383,6 @@ exports.some = (_ref = Array.prototype.some) != null ? _ref : function(fn) {
104
383
  return false;
105
384
  };
106
385
 
107
- exports.invertLiterate = function(code) {
108
- var line, lines, maybe_code;
109
- maybe_code = true;
110
- lines = (function() {
111
- var _i, _len, _ref1, _results;
112
- _ref1 = code.split('\n');
113
- _results = [];
114
- for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
115
- line = _ref1[_i];
116
- if (maybe_code && /^([ ]{4}|[ ]{0,3}\t)/.test(line)) {
117
- _results.push(line);
118
- } else if (maybe_code = /^\s*$/.test(line)) {
119
- _results.push(line);
120
- } else {
121
- _results.push('# ' + line);
122
- }
123
- }
124
- return _results;
125
- })();
126
- return lines.join('\n');
127
- };
128
-
129
- buildLocationData = function(first, last) {
130
- if (!last) {
131
- return first;
132
- } else {
133
- return {
134
- first_line: first.first_line,
135
- first_column: first.first_column,
136
- last_line: last.last_line,
137
- last_column: last.last_column
138
- };
139
- }
140
- };
141
-
142
- exports.addLocationDataFn = function(first, last) {
143
- return function(obj) {
144
- if (((typeof obj) === 'object') && (!!obj['updateLocationDataIfMissing'])) {
145
- obj.updateLocationDataIfMissing(buildLocationData(first, last));
146
- }
147
- return obj;
148
- };
149
- };
150
-
151
- exports.locationDataToString = function(obj) {
152
- var locationData;
153
- if (("2" in obj) && ("first_line" in obj[2])) {
154
- locationData = obj[2];
155
- } else if ("first_line" in obj) {
156
- locationData = obj;
157
- }
158
- if (locationData) {
159
- return ("" + (locationData.first_line + 1) + ":" + (locationData.first_column + 1) + "-") + ("" + (locationData.last_line + 1) + ":" + (locationData.last_column + 1));
160
- } else {
161
- return "No location data";
162
- }
163
- };
164
-
165
- exports.baseFileName = function(file, stripExt, useWinPathSep) {
166
- var parts, pathSep;
167
- if (stripExt == null) {
168
- stripExt = false;
169
- }
170
- if (useWinPathSep == null) {
171
- useWinPathSep = false;
172
- }
173
- pathSep = useWinPathSep ? /\\|\// : /\//;
174
- parts = file.split(pathSep);
175
- file = parts[parts.length - 1];
176
- if (!(stripExt && file.indexOf('.') >= 0)) {
177
- return file;
178
- }
179
- parts = file.split('.');
180
- parts.pop();
181
- if (parts[parts.length - 1] === 'coffee' && parts.length > 1) {
182
- parts.pop();
183
- }
184
- return parts.join('.');
185
- };
186
-
187
- exports.isCoffee = function(file) {
188
- return /\.((lit)?coffee|coffee\.md)$/.test(file);
189
- };
190
-
191
- exports.isLiterate = function(file) {
192
- return /\.(litcoffee|coffee\.md)$/.test(file);
193
- };
194
-
195
386
  exports.throwSyntaxError = function(message, location) {
196
387
  var error;
197
388
  error = new SyntaxError(message);
@@ -255,8 +446,7 @@ exports.nameWhitespaceCharacter = function(string) {
255
446
  }
256
447
  };
257
448
 
258
- }).call(this,require("/usr/local/lib/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js"))
259
- },{"/usr/local/lib/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js":12}],4:[function(require,module,exports){
449
+ },{}],4:[function(_dereq_,module,exports){
260
450
  // from react-tools/vendor/fbtransform/transforms/xjs.js
261
451
 
262
452
  module.exports = {
@@ -390,43 +580,13 @@ module.exports = {
390
580
  video: true,
391
581
  wbr: true
392
582
  };
393
- },{}],5:[function(require,module,exports){
394
- /** Function count the occurrences of substring in a string;
395
- * @param {String} string Required. The string;
396
- * @param {String} subString Required. The string to search for;
397
- * @param {Boolean} allowOverlapping Optional. Default: false;
398
- */
399
- function occurrences(string, subString, allowOverlapping){
400
-
401
- string+=""; subString+="";
402
- if(subString.length<=0) return string.length+1;
403
-
404
- var n=0, pos=0;
405
- var step=(allowOverlapping)?(1):(subString.length);
406
-
407
- while(true){
408
- pos=string.indexOf(subString,pos);
409
- if(pos>=0){ n++; pos+=step; } else break;
410
- }
411
- return(n);
412
- }
413
-
414
- },{}],6:[function(require,module,exports){
583
+ },{}],5:[function(_dereq_,module,exports){
415
584
  // Generated by CoffeeScript 1.7.1
416
- var $, BOM, CLOSING_TAG, COMMENT, HEREDOC, HEREGEX, JSTOKEN, OPENING_TAG, PRAGMA, Parser, REGEX, SIMPLESTR, TAG_ATTRIBUTES, TRAILING_SPACES, WHITESPACE, compact, count, inspect, last, locationDataToString, parseTreeBranchNode, parseTreeLeafNode, repeat, starts, throwSyntaxError, util, _ref;
585
+ var $, BOM, CLOSING_TAG, COMMENT, HEREDOC, HEREGEX, JSTOKEN, OPENING_TAG, PRAGMA, Parser, REGEX, SIMPLESTR, TAG_ATTRIBUTES, TRAILING_SPACES, WHITESPACE, compact, count, last, parseTreeBranchNode, parseTreeLeafNode, repeat, starts, throwSyntaxError, _ref;
417
586
 
418
- util = require('util');
587
+ _ref = _dereq_('./helpers'), count = _ref.count, starts = _ref.starts, compact = _ref.compact, last = _ref.last, repeat = _ref.repeat, throwSyntaxError = _ref.throwSyntaxError;
419
588
 
420
- _ref = require('./helpers'), count = _ref.count, starts = _ref.starts, compact = _ref.compact, last = _ref.last, repeat = _ref.repeat, locationDataToString = _ref.locationDataToString, throwSyntaxError = _ref.throwSyntaxError;
421
-
422
- $ = require('./symbols');
423
-
424
- inspect = function(value) {
425
- return util.inspect(value, {
426
- showHidden: true,
427
- depth: null
428
- });
429
- };
589
+ $ = _dereq_('./symbols');
430
590
 
431
591
  parseTreeLeafNode = function(type, value) {
432
592
  if (value == null) {
@@ -456,7 +616,7 @@ module.exports = Parser = (function() {
456
616
  function Parser() {}
457
617
 
458
618
  Parser.prototype.parse = function(code, opts) {
459
- var consumed, i, message, _ref1;
619
+ var consumed, i, message, _ref1, _ref2;
460
620
  this.opts = opts != null ? opts : {};
461
621
  this.parseTree = parseTreeBranchNode(this.opts.root || $.ROOT);
462
622
  this.activeStates = [this.parseTree];
@@ -469,8 +629,8 @@ module.exports = Parser = (function() {
469
629
  if (this.activeStates.length === 0) {
470
630
  break;
471
631
  }
472
- consumed = (this.currentState() !== $.CJSX_EL && this.currentState() !== $.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();
473
- _ref1 = this.getLineAndColumnFromChunk(consumed), this.chunkLine = _ref1[0], this.chunkColumn = _ref1[1];
632
+ 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();
633
+ _ref2 = this.getLineAndColumnFromChunk(consumed), this.chunkLine = _ref2[0], this.chunkColumn = _ref2[1];
474
634
  i += consumed;
475
635
  }
476
636
  if ((this.activeBranchNode() != null) && this.activeBranchNode() !== this.parseTree) {
@@ -651,7 +811,8 @@ module.exports = Parser = (function() {
651
811
  };
652
812
 
653
813
  Parser.prototype.cjsxEscape = function() {
654
- if (!(this.chunk.charAt(0) === '{' && this.currentState() === $.CJSX_EL || this.currentState() === $.CJSX_ATTR_PAIR)) {
814
+ var _ref1;
815
+ if (!(this.chunk.charAt(0) === '{' && ((_ref1 = this.currentState()) === $.CJSX_EL || _ref1 === $.CJSX_ATTR_PAIR))) {
655
816
  return 0;
656
817
  }
657
818
  this.pushActiveBranchNode(parseTreeBranchNode($.CJSX_ESC));
@@ -758,6 +919,7 @@ module.exports = Parser = (function() {
758
919
  if (code.charCodeAt(0) === BOM) {
759
920
  code = code.slice(1);
760
921
  }
922
+ code = code.replace(/\r/g, '');
761
923
  return code;
762
924
  };
763
925
 
@@ -847,21 +1009,19 @@ REGEX = /^(\/(?![\s=])[^[\/\n\\]*(?:(?:\\[\s\S]|\[[^\]\n\\]*(?:\\[\s\S][^\]\n\\]
847
1009
 
848
1010
  HEREGEX = /^\/{3}((?:\\?[\s\S])+?)\/{3}([imgy]{0,4})(?!\w)/;
849
1011
 
850
- },{"./helpers":3,"./symbols":9,"util":14}],7:[function(require,module,exports){
1012
+ },{"./helpers":3,"./symbols":8}],6:[function(_dereq_,module,exports){
851
1013
  // Generated by CoffeeScript 1.7.1
852
- var $, HTML_ELEMENTS, SPACES_ONLY, TEXT_LEADING_WHITESPACE, TEXT_TRAILING_WHITESPACE, WHITESPACE_ONLY, containsNewlines, genericBranchSerialiser, genericLeafSerialiser, inspect, last, occurrences, serialise, serialiseNode, serialisers, stringEscape;
853
-
854
- last = require('./helpers').last;
1014
+ var $, HTML_ELEMENTS, SPACES_ONLY, TEXT_LEADING_WHITESPACE, TEXT_TRAILING_WHITESPACE, WHITESPACE_ONLY, containsNewlines, entityDecode, genericBranchSerialiser, genericLeafSerialiser, last, serialise, serialiseNode, serialisers, stringEscape;
855
1015
 
856
- inspect = require('util').inspect;
1016
+ last = _dereq_('./helpers').last;
857
1017
 
858
- $ = require('./symbols');
1018
+ $ = _dereq_('./symbols');
859
1019
 
860
- HTML_ELEMENTS = require('./htmlelements');
1020
+ HTML_ELEMENTS = _dereq_('./htmlelements');
861
1021
 
862
- stringEscape = require('./stringescape');
1022
+ stringEscape = _dereq_('./stringescape');
863
1023
 
864
- occurrences = require('./occurrences');
1024
+ entityDecode = _dereq_('./entitydecode');
865
1025
 
866
1026
  module.exports = serialise = function(parseTree) {
867
1027
  var env;
@@ -883,7 +1043,7 @@ serialiseNode = function(node) {
883
1043
  }
884
1044
  serialised = serialisers[node.type](node, this);
885
1045
  if (!(typeof serialised === 'string' || serialised === null)) {
886
- throw new Error("serialiser " + node.type + " didn\'t return a string for node " + (inspect(node)) + ", instead returned " + serialised);
1046
+ throw new Error("serialiser " + node.type + " didn\'t return a string");
887
1047
  }
888
1048
  return serialised;
889
1049
  };
@@ -993,7 +1153,7 @@ serialise.serialisers = serialisers = {
993
1153
  JS_ESC: genericLeafSerialiser,
994
1154
  CJSX_WHITESPACE: genericLeafSerialiser,
995
1155
  CJSX_TEXT: function(node) {
996
- var leftSpace, leftTrim, rightSpace, rightTrim, text, trimmedText;
1156
+ var escapedText, leftSpace, leftTrim, rightSpace, rightTrim, text, trimmedText;
997
1157
  text = node.value;
998
1158
  if (containsNewlines(text)) {
999
1159
  if (WHITESPACE_ONLY.test(text)) {
@@ -1012,13 +1172,16 @@ serialise.serialisers = serialisers = {
1012
1172
  rightTrim = text.length;
1013
1173
  }
1014
1174
  trimmedText = text.substring(leftTrim, rightTrim);
1015
- return '"""' + trimmedText + '"""';
1175
+ escapedText = stringEscape(entityDecode(trimmedText), {
1176
+ preserveNewlines: true
1177
+ });
1178
+ return '"""' + escapedText + '"""';
1016
1179
  }
1017
1180
  } else {
1018
1181
  if (text === '') {
1019
1182
  return null;
1020
1183
  } else {
1021
- return '"' + text + '"';
1184
+ return '"' + stringEscape(entityDecode(text)) + '"';
1022
1185
  }
1023
1186
  }
1024
1187
  },
@@ -1038,67 +1201,61 @@ TEXT_LEADING_WHITESPACE = /^\s*?\n\s*/;
1038
1201
 
1039
1202
  TEXT_TRAILING_WHITESPACE = /\s*?\n\s*?$/;
1040
1203
 
1041
- },{"./helpers":3,"./htmlelements":4,"./occurrences":5,"./stringescape":8,"./symbols":9,"util":14}],8:[function(require,module,exports){
1042
-
1043
- var hex=new Array('0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f');
1044
-
1045
- module.exports = function stringEncode(preescape)
1046
- {
1047
- var escaped="";
1048
-
1049
- var i=0;
1050
- for(i=0;i<preescape.length;i++)
1051
- {
1052
- escaped=escaped+encodeCharx(preescape.charAt(i));
1053
- }
1054
-
1055
- return escaped;
1204
+ },{"./entitydecode":2,"./helpers":3,"./htmlelements":4,"./stringescape":7,"./symbols":8}],7:[function(_dereq_,module,exports){
1205
+
1206
+ var hex = '0123456789abcdef'.split('');
1207
+
1208
+ module.exports = function stringEncode(input, opts) {
1209
+ opts = opts || {};
1210
+ var escaped = "";
1211
+
1212
+ for (var i = 0; i < input.length; i++) {
1213
+ escaped = escaped + encodeChar(input.charAt(i), opts.preserveNewlines);
1214
+ }
1215
+
1216
+ return escaped;
1056
1217
  }
1057
1218
 
1058
- function encodeCharx(original)
1059
- {
1060
- var found=true;
1061
- var thecharchar=original.charAt(0);
1062
- var thechar=original.charCodeAt(0);
1063
- switch(thecharchar) {
1064
- case '\n': return "\\n"; break; //newline
1065
- case '\r': return "\\r"; break; //Carriage return
1066
- case '\'': return "\\'"; break;
1067
- case '"': return "\\\""; break;
1068
- case '\&': return "\\&"; break;
1069
- case '\\': return "\\\\"; break;
1070
- case '\t': return "\\t"; break;
1071
- case '\b': return "\\b"; break;
1072
- case '\f': return "\\f"; break;
1073
- case '/': return "\\x2F"; break;
1074
- case '<': return "\\x3C"; break;
1075
- case '>': return "\\x3E"; break;
1076
- default:
1077
- found=false;
1078
- break;
1079
- }
1080
- if(!found)
1081
- {
1082
- if(thechar>127) {
1083
- var c=thechar;
1084
- var a4=c%16;
1085
- c=Math.floor(c/16);
1086
- var a3=c%16;
1087
- c=Math.floor(c/16);
1088
- var a2=c%16;
1089
- c=Math.floor(c/16);
1090
- var a1=c%16;
1091
- // alert(a1);
1092
- return "\\u"+hex[a1]+hex[a2]+hex[a3]+hex[a4]+"";
1093
- }
1094
- else
1095
- {
1096
- return original;
1097
- }
1098
- }
1219
+ function encodeChar(inputChar, preserveNewlines) {
1220
+ var character = inputChar.charAt(0);
1221
+ var characterCode = inputChar.charCodeAt(0);
1222
+
1223
+ switch(character) {
1224
+ case '\n':
1225
+ if (!preserveNewlines) return "\\n";
1226
+ else return character;
1227
+ case '\r':
1228
+ if (!preserveNewlines) return "\\r";
1229
+ else return character;
1230
+ case '\'': return "\\'";
1231
+ case '"': return "\\\"";
1232
+ case '\&': return "\\&";
1233
+ case '\\': return "\\\\";
1234
+ case '\t': return "\\t";
1235
+ case '\b': return "\\b";
1236
+ case '\f': return "\\f";
1237
+ case '/': return "\\x2F";
1238
+ case '<': return "\\x3C";
1239
+ case '>': return "\\x3E";
1240
+ }
1241
+
1242
+ if (characterCode > 127) {
1243
+ var c = characterCode;
1244
+ var a4 = c % 16;
1245
+ c = ~~(c/16);
1246
+ var a3 = c % 16;
1247
+ c = ~~(c/16);
1248
+ var a2 = c % 16;
1249
+ c = ~~(c/16);
1250
+ var a1 = c % 16;
1251
+
1252
+ return ["\\u", hex[a1], hex[a2], hex[a3], hex[a4]].join('');
1253
+ } else {
1254
+ return inputChar;
1255
+ }
1099
1256
  }
1100
1257
 
1101
- },{}],9:[function(require,module,exports){
1258
+ },{}],8:[function(_dereq_,module,exports){
1102
1259
  // Generated by CoffeeScript 1.7.1
1103
1260
  module.exports = {
1104
1261
  ROOT: 'ROOT',
@@ -1124,700 +1281,18 @@ module.exports = {
1124
1281
  CJSX_PRAGMA: 'CJSX_PRAGMA'
1125
1282
  };
1126
1283
 
1127
- },{}],10:[function(require,module,exports){
1284
+ },{}],9:[function(_dereq_,module,exports){
1128
1285
  // Generated by CoffeeScript 1.7.1
1129
1286
  var Parser, serialise;
1130
1287
 
1131
- Parser = require('./parser');
1288
+ Parser = _dereq_('./parser');
1132
1289
 
1133
- serialise = require('./serialiser');
1290
+ serialise = _dereq_('./serialiser');
1134
1291
 
1135
1292
  module.exports.transform = function(code, opts) {
1136
1293
  return serialise(new Parser().parse(code, opts));
1137
1294
  };
1138
1295
 
1139
- },{"./parser":6,"./serialiser":7}],11:[function(require,module,exports){
1140
- if (typeof Object.create === 'function') {
1141
- // implementation from standard node.js 'util' module
1142
- module.exports = function inherits(ctor, superCtor) {
1143
- ctor.super_ = superCtor
1144
- ctor.prototype = Object.create(superCtor.prototype, {
1145
- constructor: {
1146
- value: ctor,
1147
- enumerable: false,
1148
- writable: true,
1149
- configurable: true
1150
- }
1151
- });
1152
- };
1153
- } else {
1154
- // old school shim for old browsers
1155
- module.exports = function inherits(ctor, superCtor) {
1156
- ctor.super_ = superCtor
1157
- var TempCtor = function () {}
1158
- TempCtor.prototype = superCtor.prototype
1159
- ctor.prototype = new TempCtor()
1160
- ctor.prototype.constructor = ctor
1161
- }
1162
- }
1163
-
1164
- },{}],12:[function(require,module,exports){
1165
- // shim for using process in browser
1166
-
1167
- var process = module.exports = {};
1168
-
1169
- process.nextTick = (function () {
1170
- var canSetImmediate = typeof window !== 'undefined'
1171
- && window.setImmediate;
1172
- var canPost = typeof window !== 'undefined'
1173
- && window.postMessage && window.addEventListener
1174
- ;
1175
-
1176
- if (canSetImmediate) {
1177
- return function (f) { return window.setImmediate(f) };
1178
- }
1179
-
1180
- if (canPost) {
1181
- var queue = [];
1182
- window.addEventListener('message', function (ev) {
1183
- var source = ev.source;
1184
- if ((source === window || source === null) && ev.data === 'process-tick') {
1185
- ev.stopPropagation();
1186
- if (queue.length > 0) {
1187
- var fn = queue.shift();
1188
- fn();
1189
- }
1190
- }
1191
- }, true);
1192
-
1193
- return function nextTick(fn) {
1194
- queue.push(fn);
1195
- window.postMessage('process-tick', '*');
1196
- };
1197
- }
1198
-
1199
- return function nextTick(fn) {
1200
- setTimeout(fn, 0);
1201
- };
1202
- })();
1203
-
1204
- process.title = 'browser';
1205
- process.browser = true;
1206
- process.env = {};
1207
- process.argv = [];
1208
-
1209
- function noop() {}
1210
-
1211
- process.on = noop;
1212
- process.once = noop;
1213
- process.off = noop;
1214
- process.emit = noop;
1215
-
1216
- process.binding = function (name) {
1217
- throw new Error('process.binding is not supported');
1218
- }
1219
-
1220
- // TODO(shtylman)
1221
- process.cwd = function () { return '/' };
1222
- process.chdir = function (dir) {
1223
- throw new Error('process.chdir is not supported');
1224
- };
1225
-
1226
- },{}],13:[function(require,module,exports){
1227
- module.exports = function isBuffer(arg) {
1228
- return arg && typeof arg === 'object'
1229
- && typeof arg.copy === 'function'
1230
- && typeof arg.fill === 'function'
1231
- && typeof arg.readUInt8 === 'function';
1232
- }
1233
- },{}],14:[function(require,module,exports){
1234
- (function (process,global){
1235
- // Copyright Joyent, Inc. and other Node contributors.
1236
- //
1237
- // Permission is hereby granted, free of charge, to any person obtaining a
1238
- // copy of this software and associated documentation files (the
1239
- // "Software"), to deal in the Software without restriction, including
1240
- // without limitation the rights to use, copy, modify, merge, publish,
1241
- // distribute, sublicense, and/or sell copies of the Software, and to permit
1242
- // persons to whom the Software is furnished to do so, subject to the
1243
- // following conditions:
1244
- //
1245
- // The above copyright notice and this permission notice shall be included
1246
- // in all copies or substantial portions of the Software.
1247
- //
1248
- // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
1249
- // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
1250
- // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
1251
- // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
1252
- // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
1253
- // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
1254
- // USE OR OTHER DEALINGS IN THE SOFTWARE.
1255
-
1256
- var formatRegExp = /%[sdj%]/g;
1257
- exports.format = function(f) {
1258
- if (!isString(f)) {
1259
- var objects = [];
1260
- for (var i = 0; i < arguments.length; i++) {
1261
- objects.push(inspect(arguments[i]));
1262
- }
1263
- return objects.join(' ');
1264
- }
1265
-
1266
- var i = 1;
1267
- var args = arguments;
1268
- var len = args.length;
1269
- var str = String(f).replace(formatRegExp, function(x) {
1270
- if (x === '%%') return '%';
1271
- if (i >= len) return x;
1272
- switch (x) {
1273
- case '%s': return String(args[i++]);
1274
- case '%d': return Number(args[i++]);
1275
- case '%j':
1276
- try {
1277
- return JSON.stringify(args[i++]);
1278
- } catch (_) {
1279
- return '[Circular]';
1280
- }
1281
- default:
1282
- return x;
1283
- }
1284
- });
1285
- for (var x = args[i]; i < len; x = args[++i]) {
1286
- if (isNull(x) || !isObject(x)) {
1287
- str += ' ' + x;
1288
- } else {
1289
- str += ' ' + inspect(x);
1290
- }
1291
- }
1292
- return str;
1293
- };
1294
-
1295
-
1296
- // Mark that a method should not be used.
1297
- // Returns a modified function which warns once by default.
1298
- // If --no-deprecation is set, then it is a no-op.
1299
- exports.deprecate = function(fn, msg) {
1300
- // Allow for deprecating things in the process of starting up.
1301
- if (isUndefined(global.process)) {
1302
- return function() {
1303
- return exports.deprecate(fn, msg).apply(this, arguments);
1304
- };
1305
- }
1306
-
1307
- if (process.noDeprecation === true) {
1308
- return fn;
1309
- }
1310
-
1311
- var warned = false;
1312
- function deprecated() {
1313
- if (!warned) {
1314
- if (process.throwDeprecation) {
1315
- throw new Error(msg);
1316
- } else if (process.traceDeprecation) {
1317
- console.trace(msg);
1318
- } else {
1319
- console.error(msg);
1320
- }
1321
- warned = true;
1322
- }
1323
- return fn.apply(this, arguments);
1324
- }
1325
-
1326
- return deprecated;
1327
- };
1328
-
1329
-
1330
- var debugs = {};
1331
- var debugEnviron;
1332
- exports.debuglog = function(set) {
1333
- if (isUndefined(debugEnviron))
1334
- debugEnviron = process.env.NODE_DEBUG || '';
1335
- set = set.toUpperCase();
1336
- if (!debugs[set]) {
1337
- if (new RegExp('\\b' + set + '\\b', 'i').test(debugEnviron)) {
1338
- var pid = process.pid;
1339
- debugs[set] = function() {
1340
- var msg = exports.format.apply(exports, arguments);
1341
- console.error('%s %d: %s', set, pid, msg);
1342
- };
1343
- } else {
1344
- debugs[set] = function() {};
1345
- }
1346
- }
1347
- return debugs[set];
1348
- };
1349
-
1350
-
1351
- /**
1352
- * Echos the value of a value. Trys to print the value out
1353
- * in the best way possible given the different types.
1354
- *
1355
- * @param {Object} obj The object to print out.
1356
- * @param {Object} opts Optional options object that alters the output.
1357
- */
1358
- /* legacy: obj, showHidden, depth, colors*/
1359
- function inspect(obj, opts) {
1360
- // default options
1361
- var ctx = {
1362
- seen: [],
1363
- stylize: stylizeNoColor
1364
- };
1365
- // legacy...
1366
- if (arguments.length >= 3) ctx.depth = arguments[2];
1367
- if (arguments.length >= 4) ctx.colors = arguments[3];
1368
- if (isBoolean(opts)) {
1369
- // legacy...
1370
- ctx.showHidden = opts;
1371
- } else if (opts) {
1372
- // got an "options" object
1373
- exports._extend(ctx, opts);
1374
- }
1375
- // set default options
1376
- if (isUndefined(ctx.showHidden)) ctx.showHidden = false;
1377
- if (isUndefined(ctx.depth)) ctx.depth = 2;
1378
- if (isUndefined(ctx.colors)) ctx.colors = false;
1379
- if (isUndefined(ctx.customInspect)) ctx.customInspect = true;
1380
- if (ctx.colors) ctx.stylize = stylizeWithColor;
1381
- return formatValue(ctx, obj, ctx.depth);
1382
- }
1383
- exports.inspect = inspect;
1384
-
1385
-
1386
- // http://en.wikipedia.org/wiki/ANSI_escape_code#graphics
1387
- inspect.colors = {
1388
- 'bold' : [1, 22],
1389
- 'italic' : [3, 23],
1390
- 'underline' : [4, 24],
1391
- 'inverse' : [7, 27],
1392
- 'white' : [37, 39],
1393
- 'grey' : [90, 39],
1394
- 'black' : [30, 39],
1395
- 'blue' : [34, 39],
1396
- 'cyan' : [36, 39],
1397
- 'green' : [32, 39],
1398
- 'magenta' : [35, 39],
1399
- 'red' : [31, 39],
1400
- 'yellow' : [33, 39]
1401
- };
1402
-
1403
- // Don't use 'blue' not visible on cmd.exe
1404
- inspect.styles = {
1405
- 'special': 'cyan',
1406
- 'number': 'yellow',
1407
- 'boolean': 'yellow',
1408
- 'undefined': 'grey',
1409
- 'null': 'bold',
1410
- 'string': 'green',
1411
- 'date': 'magenta',
1412
- // "name": intentionally not styling
1413
- 'regexp': 'red'
1414
- };
1415
-
1416
-
1417
- function stylizeWithColor(str, styleType) {
1418
- var style = inspect.styles[styleType];
1419
-
1420
- if (style) {
1421
- return '\u001b[' + inspect.colors[style][0] + 'm' + str +
1422
- '\u001b[' + inspect.colors[style][1] + 'm';
1423
- } else {
1424
- return str;
1425
- }
1426
- }
1427
-
1428
-
1429
- function stylizeNoColor(str, styleType) {
1430
- return str;
1431
- }
1432
-
1433
-
1434
- function arrayToHash(array) {
1435
- var hash = {};
1436
-
1437
- array.forEach(function(val, idx) {
1438
- hash[val] = true;
1439
- });
1440
-
1441
- return hash;
1442
- }
1443
-
1444
-
1445
- function formatValue(ctx, value, recurseTimes) {
1446
- // Provide a hook for user-specified inspect functions.
1447
- // Check that value is an object with an inspect function on it
1448
- if (ctx.customInspect &&
1449
- value &&
1450
- isFunction(value.inspect) &&
1451
- // Filter out the util module, it's inspect function is special
1452
- value.inspect !== exports.inspect &&
1453
- // Also filter out any prototype objects using the circular check.
1454
- !(value.constructor && value.constructor.prototype === value)) {
1455
- var ret = value.inspect(recurseTimes, ctx);
1456
- if (!isString(ret)) {
1457
- ret = formatValue(ctx, ret, recurseTimes);
1458
- }
1459
- return ret;
1460
- }
1461
-
1462
- // Primitive types cannot have properties
1463
- var primitive = formatPrimitive(ctx, value);
1464
- if (primitive) {
1465
- return primitive;
1466
- }
1467
-
1468
- // Look up the keys of the object.
1469
- var keys = Object.keys(value);
1470
- var visibleKeys = arrayToHash(keys);
1471
-
1472
- if (ctx.showHidden) {
1473
- keys = Object.getOwnPropertyNames(value);
1474
- }
1475
-
1476
- // IE doesn't make error fields non-enumerable
1477
- // http://msdn.microsoft.com/en-us/library/ie/dww52sbt(v=vs.94).aspx
1478
- if (isError(value)
1479
- && (keys.indexOf('message') >= 0 || keys.indexOf('description') >= 0)) {
1480
- return formatError(value);
1481
- }
1482
-
1483
- // Some type of object without properties can be shortcutted.
1484
- if (keys.length === 0) {
1485
- if (isFunction(value)) {
1486
- var name = value.name ? ': ' + value.name : '';
1487
- return ctx.stylize('[Function' + name + ']', 'special');
1488
- }
1489
- if (isRegExp(value)) {
1490
- return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
1491
- }
1492
- if (isDate(value)) {
1493
- return ctx.stylize(Date.prototype.toString.call(value), 'date');
1494
- }
1495
- if (isError(value)) {
1496
- return formatError(value);
1497
- }
1498
- }
1499
-
1500
- var base = '', array = false, braces = ['{', '}'];
1501
-
1502
- // Make Array say that they are Array
1503
- if (isArray(value)) {
1504
- array = true;
1505
- braces = ['[', ']'];
1506
- }
1507
-
1508
- // Make functions say that they are functions
1509
- if (isFunction(value)) {
1510
- var n = value.name ? ': ' + value.name : '';
1511
- base = ' [Function' + n + ']';
1512
- }
1513
-
1514
- // Make RegExps say that they are RegExps
1515
- if (isRegExp(value)) {
1516
- base = ' ' + RegExp.prototype.toString.call(value);
1517
- }
1518
-
1519
- // Make dates with properties first say the date
1520
- if (isDate(value)) {
1521
- base = ' ' + Date.prototype.toUTCString.call(value);
1522
- }
1523
-
1524
- // Make error with message first say the error
1525
- if (isError(value)) {
1526
- base = ' ' + formatError(value);
1527
- }
1528
-
1529
- if (keys.length === 0 && (!array || value.length == 0)) {
1530
- return braces[0] + base + braces[1];
1531
- }
1532
-
1533
- if (recurseTimes < 0) {
1534
- if (isRegExp(value)) {
1535
- return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
1536
- } else {
1537
- return ctx.stylize('[Object]', 'special');
1538
- }
1539
- }
1540
-
1541
- ctx.seen.push(value);
1542
-
1543
- var output;
1544
- if (array) {
1545
- output = formatArray(ctx, value, recurseTimes, visibleKeys, keys);
1546
- } else {
1547
- output = keys.map(function(key) {
1548
- return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array);
1549
- });
1550
- }
1551
-
1552
- ctx.seen.pop();
1553
-
1554
- return reduceToSingleString(output, base, braces);
1555
- }
1556
-
1557
-
1558
- function formatPrimitive(ctx, value) {
1559
- if (isUndefined(value))
1560
- return ctx.stylize('undefined', 'undefined');
1561
- if (isString(value)) {
1562
- var simple = '\'' + JSON.stringify(value).replace(/^"|"$/g, '')
1563
- .replace(/'/g, "\\'")
1564
- .replace(/\\"/g, '"') + '\'';
1565
- return ctx.stylize(simple, 'string');
1566
- }
1567
- if (isNumber(value))
1568
- return ctx.stylize('' + value, 'number');
1569
- if (isBoolean(value))
1570
- return ctx.stylize('' + value, 'boolean');
1571
- // For some reason typeof null is "object", so special case here.
1572
- if (isNull(value))
1573
- return ctx.stylize('null', 'null');
1574
- }
1575
-
1576
-
1577
- function formatError(value) {
1578
- return '[' + Error.prototype.toString.call(value) + ']';
1579
- }
1580
-
1581
-
1582
- function formatArray(ctx, value, recurseTimes, visibleKeys, keys) {
1583
- var output = [];
1584
- for (var i = 0, l = value.length; i < l; ++i) {
1585
- if (hasOwnProperty(value, String(i))) {
1586
- output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
1587
- String(i), true));
1588
- } else {
1589
- output.push('');
1590
- }
1591
- }
1592
- keys.forEach(function(key) {
1593
- if (!key.match(/^\d+$/)) {
1594
- output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
1595
- key, true));
1596
- }
1597
- });
1598
- return output;
1599
- }
1600
-
1601
-
1602
- function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) {
1603
- var name, str, desc;
1604
- desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] };
1605
- if (desc.get) {
1606
- if (desc.set) {
1607
- str = ctx.stylize('[Getter/Setter]', 'special');
1608
- } else {
1609
- str = ctx.stylize('[Getter]', 'special');
1610
- }
1611
- } else {
1612
- if (desc.set) {
1613
- str = ctx.stylize('[Setter]', 'special');
1614
- }
1615
- }
1616
- if (!hasOwnProperty(visibleKeys, key)) {
1617
- name = '[' + key + ']';
1618
- }
1619
- if (!str) {
1620
- if (ctx.seen.indexOf(desc.value) < 0) {
1621
- if (isNull(recurseTimes)) {
1622
- str = formatValue(ctx, desc.value, null);
1623
- } else {
1624
- str = formatValue(ctx, desc.value, recurseTimes - 1);
1625
- }
1626
- if (str.indexOf('\n') > -1) {
1627
- if (array) {
1628
- str = str.split('\n').map(function(line) {
1629
- return ' ' + line;
1630
- }).join('\n').substr(2);
1631
- } else {
1632
- str = '\n' + str.split('\n').map(function(line) {
1633
- return ' ' + line;
1634
- }).join('\n');
1635
- }
1636
- }
1637
- } else {
1638
- str = ctx.stylize('[Circular]', 'special');
1639
- }
1640
- }
1641
- if (isUndefined(name)) {
1642
- if (array && key.match(/^\d+$/)) {
1643
- return str;
1644
- }
1645
- name = JSON.stringify('' + key);
1646
- if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) {
1647
- name = name.substr(1, name.length - 2);
1648
- name = ctx.stylize(name, 'name');
1649
- } else {
1650
- name = name.replace(/'/g, "\\'")
1651
- .replace(/\\"/g, '"')
1652
- .replace(/(^"|"$)/g, "'");
1653
- name = ctx.stylize(name, 'string');
1654
- }
1655
- }
1656
-
1657
- return name + ': ' + str;
1658
- }
1659
-
1660
-
1661
- function reduceToSingleString(output, base, braces) {
1662
- var numLinesEst = 0;
1663
- var length = output.reduce(function(prev, cur) {
1664
- numLinesEst++;
1665
- if (cur.indexOf('\n') >= 0) numLinesEst++;
1666
- return prev + cur.replace(/\u001b\[\d\d?m/g, '').length + 1;
1667
- }, 0);
1668
-
1669
- if (length > 60) {
1670
- return braces[0] +
1671
- (base === '' ? '' : base + '\n ') +
1672
- ' ' +
1673
- output.join(',\n ') +
1674
- ' ' +
1675
- braces[1];
1676
- }
1677
-
1678
- return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1];
1679
- }
1680
-
1681
-
1682
- // NOTE: These type checking functions intentionally don't use `instanceof`
1683
- // because it is fragile and can be easily faked with `Object.create()`.
1684
- function isArray(ar) {
1685
- return Array.isArray(ar);
1686
- }
1687
- exports.isArray = isArray;
1688
-
1689
- function isBoolean(arg) {
1690
- return typeof arg === 'boolean';
1691
- }
1692
- exports.isBoolean = isBoolean;
1693
-
1694
- function isNull(arg) {
1695
- return arg === null;
1696
- }
1697
- exports.isNull = isNull;
1698
-
1699
- function isNullOrUndefined(arg) {
1700
- return arg == null;
1701
- }
1702
- exports.isNullOrUndefined = isNullOrUndefined;
1703
-
1704
- function isNumber(arg) {
1705
- return typeof arg === 'number';
1706
- }
1707
- exports.isNumber = isNumber;
1708
-
1709
- function isString(arg) {
1710
- return typeof arg === 'string';
1711
- }
1712
- exports.isString = isString;
1713
-
1714
- function isSymbol(arg) {
1715
- return typeof arg === 'symbol';
1716
- }
1717
- exports.isSymbol = isSymbol;
1718
-
1719
- function isUndefined(arg) {
1720
- return arg === void 0;
1721
- }
1722
- exports.isUndefined = isUndefined;
1723
-
1724
- function isRegExp(re) {
1725
- return isObject(re) && objectToString(re) === '[object RegExp]';
1726
- }
1727
- exports.isRegExp = isRegExp;
1728
-
1729
- function isObject(arg) {
1730
- return typeof arg === 'object' && arg !== null;
1731
- }
1732
- exports.isObject = isObject;
1733
-
1734
- function isDate(d) {
1735
- return isObject(d) && objectToString(d) === '[object Date]';
1736
- }
1737
- exports.isDate = isDate;
1738
-
1739
- function isError(e) {
1740
- return isObject(e) &&
1741
- (objectToString(e) === '[object Error]' || e instanceof Error);
1742
- }
1743
- exports.isError = isError;
1744
-
1745
- function isFunction(arg) {
1746
- return typeof arg === 'function';
1747
- }
1748
- exports.isFunction = isFunction;
1749
-
1750
- function isPrimitive(arg) {
1751
- return arg === null ||
1752
- typeof arg === 'boolean' ||
1753
- typeof arg === 'number' ||
1754
- typeof arg === 'string' ||
1755
- typeof arg === 'symbol' || // ES6 symbol
1756
- typeof arg === 'undefined';
1757
- }
1758
- exports.isPrimitive = isPrimitive;
1759
-
1760
- exports.isBuffer = require('./support/isBuffer');
1761
-
1762
- function objectToString(o) {
1763
- return Object.prototype.toString.call(o);
1764
- }
1765
-
1766
-
1767
- function pad(n) {
1768
- return n < 10 ? '0' + n.toString(10) : n.toString(10);
1769
- }
1770
-
1771
-
1772
- var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep',
1773
- 'Oct', 'Nov', 'Dec'];
1774
-
1775
- // 26 Feb 16:19:34
1776
- function timestamp() {
1777
- var d = new Date();
1778
- var time = [pad(d.getHours()),
1779
- pad(d.getMinutes()),
1780
- pad(d.getSeconds())].join(':');
1781
- return [d.getDate(), months[d.getMonth()], time].join(' ');
1782
- }
1783
-
1784
-
1785
- // log is just a thin wrapper to console.log that prepends a timestamp
1786
- exports.log = function() {
1787
- console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments));
1788
- };
1789
-
1790
-
1791
- /**
1792
- * Inherit the prototype methods from one constructor into another.
1793
- *
1794
- * The Function.prototype.inherits from lang.js rewritten as a standalone
1795
- * function (not on Function.prototype). NOTE: If this file is to be loaded
1796
- * during bootstrapping this function needs to be rewritten using some native
1797
- * functions as prototype setup using normal JavaScript does not work as
1798
- * expected during bootstrapping (see mirror.js in r114903).
1799
- *
1800
- * @param {function} ctor Constructor function which needs to inherit the
1801
- * prototype.
1802
- * @param {function} superCtor Constructor function to inherit prototype from.
1803
- */
1804
- exports.inherits = require('inherits');
1805
-
1806
- exports._extend = function(origin, add) {
1807
- // Don't do anything if add isn't an object
1808
- if (!add || !isObject(add)) return origin;
1809
-
1810
- var keys = Object.keys(add);
1811
- var i = keys.length;
1812
- while (i--) {
1813
- origin[keys[i]] = add[keys[i]];
1814
- }
1815
- return origin;
1816
- };
1817
-
1818
- function hasOwnProperty(obj, prop) {
1819
- return Object.prototype.hasOwnProperty.call(obj, prop);
1820
- }
1821
-
1822
- }).call(this,require("/usr/local/lib/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js"),typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
1823
- },{"./support/isBuffer":13,"/usr/local/lib/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js":12,"inherits":11}]},{},[]);coffeeReactTransform = require('coffee-react-transform');
1296
+ },{"./parser":5,"./serialiser":6}]},{},[1])
1297
+ (1)
1298
+ });