esperanto-source 0.6.19 → 0.6.20

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: 23b7f099e3d850a4dde0d263dbd2380ab66d4f66
4
- data.tar.gz: 36e14027896978e62b317300bd5c4f20f9eebd36
3
+ metadata.gz: a0eb6ec5e1f7f8c3bf48912dbb967b4b8fb9df9b
4
+ data.tar.gz: d07a32879d1a0db15781b69c417a13266b282a08
5
5
  SHA512:
6
- metadata.gz: dff115dbba50860cdaaab2b3a5ddde4d77ee1de82bfd0d156f6c3799fa4169fb34679d730bf70e41e8c96d0b85602422dd25670174eea775510ba6d619b2ff25
7
- data.tar.gz: 20bb8e09bd1f24fb5e0a559fa5c28389fd9af6c04cbabd21091bf08d07dceeb7d06c9877e1826a2ce00d11b8872b220ef05c08fcb894e6edeb2125c7e55ce3e9
6
+ metadata.gz: 358b60b657fc1bb4c6605443ab527ffef38d4c4438f6199436d45ac054cc7c006da464eddabd1f8aed48e96399e0002f59a9359c2dfc283c0f6e803c2e534560
7
+ data.tar.gz: 3087f035f3090fa1aada5e9f32d4af004aa0426cd7f4e9e31186ee6bca693deab9b3923fa263e3e99a41f4289ef214fd9e7a7dc2380c6de89c10a3b64bf5e089
@@ -1,5 +1,5 @@
1
1
  module Esperanto
2
2
  module Source
3
- VERSION = '0.6.19'
3
+ VERSION = '0.6.20'
4
4
  end
5
5
  end
@@ -1,15 +1,15 @@
1
1
  /*
2
- esperanto.js v0.6.19 - 2015-03-30
2
+ esperanto.js v0.6.20 - 2015-03-30
3
3
  http://esperantojs.org
4
4
 
5
5
  Released under the MIT License.
6
6
  */
7
7
 
8
8
  (function (global, factory) {
9
- typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('acorn'), require('estraverse')) :
10
- typeof define === 'function' && define.amd ? define(['acorn', 'estraverse'], factory) :
11
- global.esperanto = factory(global.acorn, global.estraverse)
12
- }(this, function (acorn, estraverse) { 'use strict';
9
+ typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('acorn')) :
10
+ typeof define === 'function' && define.amd ? define(['acorn'], factory) :
11
+ global.esperanto = factory(global.acorn)
12
+ }(this, function (acorn) { 'use strict';
13
13
 
14
14
  var hasOwnProp = Object.prototype.hasOwnProperty;
15
15
 
@@ -930,6 +930,57 @@
930
930
  return result;
931
931
  }
932
932
 
933
+ function walk ( ast, leave) {var enter = leave.enter, leave = leave.leave;
934
+ visit( ast, null, enter, leave );
935
+ }
936
+
937
+ var walk__context = {
938
+ skip: function() {return walk__context.shouldSkip = true}
939
+ };
940
+
941
+ var walk__childKeys = {};
942
+
943
+ var walk__toString = Object.prototype.toString;
944
+
945
+ function isArray ( thing ) {
946
+ return walk__toString.call( thing ) === '[object Array]';
947
+ }
948
+
949
+ function visit ( node, parent, enter, leave ) {
950
+ if ( enter ) {
951
+ walk__context.shouldSkip = false;
952
+ enter.call( walk__context, node, parent );
953
+ if ( walk__context.shouldSkip ) return;
954
+ }
955
+
956
+ var keys = walk__childKeys[ node.type ] || (
957
+ walk__childKeys[ node.type ] = Object.keys( node ).filter( function(key ) {return typeof node[ key ] === 'object'} )
958
+ );
959
+
960
+ var key, value, i, j;
961
+
962
+ i = keys.length;
963
+ while ( i-- ) {
964
+ key = keys[i];
965
+ value = node[ key ];
966
+
967
+ if ( isArray( value ) ) {
968
+ j = value.length;
969
+ while ( j-- ) {
970
+ visit( value[j], node, enter, leave );
971
+ }
972
+ }
973
+
974
+ else if ( value && value.type ) {
975
+ visit( value, node, enter, leave );
976
+ }
977
+ }
978
+
979
+ if ( leave ) {
980
+ leave( node, parent );
981
+ }
982
+ }
983
+
933
984
  /*
934
985
  This module traverse a module's AST, attaching scope information
935
986
  to nodes as it goes, which is later used to determine which
@@ -970,7 +1021,7 @@
970
1021
 
971
1022
  var envDepth = 0;
972
1023
 
973
- estraverse.traverse( ast, {
1024
+ walk( ast, {
974
1025
  enter: function ( node ) {
975
1026
  if ( node.type === 'ImportDeclaration' || node.type === 'ExportSpecifier' ) {
976
1027
  node._skip = true;
@@ -1324,7 +1375,7 @@
1324
1375
  return hasOwnProp.call( importedNames, name );
1325
1376
  }
1326
1377
 
1327
- estraverse.traverse( mod.ast, {
1378
+ walk( mod.ast, {
1328
1379
  enter: function ( node ) {
1329
1380
  // we're only interested in references, not property names etc
1330
1381
  if ( node._skip ) return this.skip();
@@ -1654,16 +1705,16 @@
1654
1705
 
1655
1706
  function markBundleSourcemapLocations ( bundle ) {
1656
1707
  bundle.modules.forEach( function(mod ) {
1657
- estraverse.traverse( mod.ast, {
1708
+ walk( mod.ast, {
1658
1709
  enter: function(node ) {
1659
1710
  mod.body.addSourcemapLocation( node.start );
1660
1711
  }
1661
1712
  });
1662
- })
1713
+ });
1663
1714
  }
1664
1715
 
1665
1716
  function markModuleSourcemapLocations ( mod ) {
1666
- estraverse.traverse( mod.ast, {
1717
+ walk( mod.ast, {
1667
1718
  enter: function(node ) {
1668
1719
  mod.body.addSourcemapLocation( node.start );
1669
1720
  }
@@ -2127,7 +2178,7 @@
2127
2178
  capturedUpdates = null,
2128
2179
  previousCapturedUpdates = null;
2129
2180
 
2130
- estraverse.traverse( ast, {
2181
+ walk( ast, {
2131
2182
  enter: function ( node, parent ) {
2132
2183
  // we're only interested in references, not property names etc
2133
2184
  if ( node._skip ) return this.skip();
@@ -1,5 +1,5 @@
1
1
  /*
2
- esperanto.js v0.6.19 - 2015-03-30
2
+ esperanto.js v0.6.20 - 2015-03-30
3
3
  http://esperantojs.org
4
4
 
5
5
  Released under the MIT License.
@@ -11,7 +11,6 @@ var acorn = require('acorn');
11
11
  var MagicString = require('magic-string');
12
12
  var path = require('path');
13
13
  var sander = require('sander');
14
- var estraverse = require('estraverse');
15
14
 
16
15
  var hasOwnProp = Object.prototype.hasOwnProperty;
17
16
 
@@ -35,6 +34,57 @@ function hasNamedExports ( mod ) {
35
34
  }
36
35
  }
37
36
 
37
+ function walk ( ast, leave) {var enter = leave.enter, leave = leave.leave;
38
+ visit( ast, null, enter, leave );
39
+ }
40
+
41
+ var walk__context = {
42
+ skip: function() {return walk__context.shouldSkip = true}
43
+ };
44
+
45
+ var walk__childKeys = {};
46
+
47
+ var walk__toString = Object.prototype.toString;
48
+
49
+ function isArray ( thing ) {
50
+ return walk__toString.call( thing ) === '[object Array]';
51
+ }
52
+
53
+ function visit ( node, parent, enter, leave ) {
54
+ if ( enter ) {
55
+ walk__context.shouldSkip = false;
56
+ enter.call( walk__context, node, parent );
57
+ if ( walk__context.shouldSkip ) return;
58
+ }
59
+
60
+ var keys = walk__childKeys[ node.type ] || (
61
+ walk__childKeys[ node.type ] = Object.keys( node ).filter( function(key ) {return typeof node[ key ] === 'object'} )
62
+ );
63
+
64
+ var key, value, i, j;
65
+
66
+ i = keys.length;
67
+ while ( i-- ) {
68
+ key = keys[i];
69
+ value = node[ key ];
70
+
71
+ if ( isArray( value ) ) {
72
+ j = value.length;
73
+ while ( j-- ) {
74
+ visit( value[j], node, enter, leave );
75
+ }
76
+ }
77
+
78
+ else if ( value && value.type ) {
79
+ visit( value, node, enter, leave );
80
+ }
81
+ }
82
+
83
+ if ( leave ) {
84
+ leave( node, parent );
85
+ }
86
+ }
87
+
38
88
  /*
39
89
  This module traverse a module's AST, attaching scope information
40
90
  to nodes as it goes, which is later used to determine which
@@ -75,7 +125,7 @@ function annotateAst ( ast ) {
75
125
 
76
126
  var envDepth = 0;
77
127
 
78
- estraverse.traverse( ast, {
128
+ walk( ast, {
79
129
  enter: function ( node ) {
80
130
  if ( node.type === 'ImportDeclaration' || node.type === 'ExportSpecifier' ) {
81
131
  node._skip = true;
@@ -429,7 +479,7 @@ function getUnscopedNames ( mod ) {
429
479
  return hasOwnProp.call( importedNames, name );
430
480
  }
431
481
 
432
- estraverse.traverse( mod.ast, {
482
+ walk( mod.ast, {
433
483
  enter: function ( node ) {
434
484
  // we're only interested in references, not property names etc
435
485
  if ( node._skip ) return this.skip();
@@ -1160,7 +1210,7 @@ function traverseAst ( ast, body, identifierReplacements, importedBindings, impo
1160
1210
  capturedUpdates = null,
1161
1211
  previousCapturedUpdates = null;
1162
1212
 
1163
- estraverse.traverse( ast, {
1213
+ walk( ast, {
1164
1214
  enter: function ( node, parent ) {
1165
1215
  // we're only interested in references, not property names etc
1166
1216
  if ( node._skip ) return this.skip();
@@ -1743,16 +1793,16 @@ function getRelativePath ( from, to ) {
1743
1793
 
1744
1794
  function markBundleSourcemapLocations ( bundle ) {
1745
1795
  bundle.modules.forEach( function(mod ) {
1746
- estraverse.traverse( mod.ast, {
1796
+ walk( mod.ast, {
1747
1797
  enter: function(node ) {
1748
1798
  mod.body.addSourcemapLocation( node.start );
1749
1799
  }
1750
1800
  });
1751
- })
1801
+ });
1752
1802
  }
1753
1803
 
1754
1804
  function markModuleSourcemapLocations ( mod ) {
1755
- estraverse.traverse( mod.ast, {
1805
+ walk( mod.ast, {
1756
1806
  enter: function(node ) {
1757
1807
  mod.body.addSourcemapLocation( node.start );
1758
1808
  }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: esperanto-source
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.19
4
+ version: 0.6.20
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryunosuke SATO