esperanto-source 0.6.23 → 0.6.24

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,5 @@
1
1
  /*
2
- esperanto.js v0.6.23 - 2015-03-31
2
+ esperanto.js v0.6.24 - 2015-03-31
3
3
  http://esperantojs.org
4
4
 
5
5
  Released under the MIT License.
@@ -999,14 +999,14 @@
999
999
  }
1000
1000
 
1001
1001
  function req ( path ) {
1002
- return 'require(' + quote(path) + ')';
1002
+ return (("require(" + (quote(path))) + ")");
1003
1003
  }
1004
1004
 
1005
1005
  function globalify ( name ) {
1006
1006
  if ( /^__dep\d+__$/.test( name ) ) {
1007
1007
  return 'undefined';
1008
1008
  } else {
1009
- return 'global.' + name;
1009
+ return ("global." + name);
1010
1010
  }
1011
1011
  }
1012
1012
 
@@ -1016,12 +1016,12 @@
1016
1016
  identifiers need to be rewritten to avoid collisions
1017
1017
  */
1018
1018
 
1019
- var Scope = function ( options ) {
1019
+ function Scope ( options ) {
1020
1020
  options = options || {};
1021
1021
 
1022
1022
  this.parent = options.parent;
1023
1023
  this.names = options.params || [];
1024
- };
1024
+ }
1025
1025
 
1026
1026
  Scope.prototype = {
1027
1027
  add: function ( name ) {
@@ -1046,7 +1046,11 @@
1046
1046
  };
1047
1047
 
1048
1048
  function annotateAst ( ast ) {
1049
- var scope = new Scope(), blockScope = new Scope(), declared = {}, topLevelFunctionNames = [], templateLiteralRanges = [];
1049
+ var scope = new Scope();
1050
+ var blockScope = new Scope();
1051
+ var declared = {};
1052
+ var topLevelFunctionNames = [];
1053
+ var templateLiteralRanges = [];
1050
1054
 
1051
1055
  var envDepth = 0;
1052
1056
 
@@ -1064,7 +1068,7 @@
1064
1068
  case 'FunctionExpression':
1065
1069
  case 'FunctionDeclaration':
1066
1070
 
1067
- envDepth++;
1071
+ envDepth += 1;
1068
1072
 
1069
1073
  // fallthrough
1070
1074
 
@@ -1133,7 +1137,7 @@
1133
1137
  case 'FunctionExpression':
1134
1138
  case 'FunctionDeclaration':
1135
1139
 
1136
- envDepth--;
1140
+ envDepth -= 1;
1137
1141
 
1138
1142
  // fallthrough
1139
1143
 
@@ -1386,8 +1390,11 @@
1386
1390
  else {
1387
1391
  result.type = 'named';
1388
1392
  result.specifiers = node.specifiers.map( function(s ) {
1389
- return { name: s.local.name };
1390
- }); // TODO as?
1393
+ return {
1394
+ name: s.local.name,
1395
+ as: s.exported.name
1396
+ };
1397
+ });
1391
1398
  }
1392
1399
 
1393
1400
  return result;
@@ -1465,7 +1472,9 @@
1465
1472
  }
1466
1473
  }
1467
1474
 
1468
- var reserved = 'break case class catch const continue debugger default delete do else export extends finally for function if import in instanceof let new return super switch this throw try typeof var void while with yield'.split( ' ' );
1475
+ var RESERVED = 'break case class catch const continue debugger default delete do else export extends finally for function if import in instanceof let new return super switch this throw try typeof var void while with yield'.split( ' ' );
1476
+ var INVALID_CHAR = /[^a-zA-Z0-9_$]/g;
1477
+ var INVALID_LEADING_CHAR = /[^a-zA-Z_$]/;
1469
1478
 
1470
1479
  /**
1471
1480
  * Generates a sanitized (i.e. valid identifier) name from a module ID
@@ -1473,13 +1482,10 @@
1473
1482
  * @returns {string}
1474
1483
  */
1475
1484
  function sanitize ( name ) {
1476
- name = name.replace( /[^a-zA-Z0-9_$]/g, '_' );
1477
- if ( /[^a-zA-Z_$]/.test( name[0] ) ) {
1478
- name = '_' + name;
1479
- }
1485
+ name = name.replace( INVALID_CHAR, '_' );
1480
1486
 
1481
- if ( ~reserved.indexOf( name ) ) {
1482
- name = '_' + name;
1487
+ if ( INVALID_LEADING_CHAR.test( name[0] ) || ~RESERVED.indexOf( name ) ) {
1488
+ name = ("_" + name);
1483
1489
  }
1484
1490
 
1485
1491
  return name;
@@ -1535,12 +1541,12 @@
1535
1541
  }
1536
1542
 
1537
1543
  function determineImportNames ( imports, userFn, usedNames ) {
1538
- var nameById = {}, inferredNames = {};
1539
-
1540
- usedNames = usedNames || {};
1544
+ var nameById = {};
1545
+ var inferredNames = {};
1541
1546
 
1542
1547
  imports.forEach( function(x ) {
1543
- var moduleId, parts, i, prefix = '', name, candidate;
1548
+ var moduleId = x.path;
1549
+ var name;
1544
1550
 
1545
1551
  moduleId = x.path;
1546
1552
 
@@ -1561,7 +1567,10 @@
1561
1567
  }
1562
1568
 
1563
1569
  else {
1564
- parts = splitPath( moduleId );
1570
+ var parts = splitPath( moduleId );
1571
+ var i;
1572
+ var prefix = '';
1573
+ var candidate;
1565
1574
 
1566
1575
  do {
1567
1576
  i = parts.length;
@@ -1641,23 +1650,24 @@
1641
1650
  }
1642
1651
 
1643
1652
  if ( exportedValue ) {
1644
- body.append( '\nreturn ' + exportedValue + ';' );
1653
+ body.append( (("\nreturn " + exportedValue) + ";") );
1645
1654
  }
1646
1655
  }
1647
1656
 
1648
- var warned = {};
1657
+ var ABSOLUTE_PATH = /^(?:[A-Z]:)?[\/\\]/i;
1649
1658
 
1650
- function packageResult ( bundleOrModule, body, options, methodName, isBundle ) {
1651
- var code, map;
1659
+ var utils_packageResult__warned = {};
1652
1660
 
1661
+ function packageResult ( bundleOrModule, body, options, methodName, isBundle ) {
1653
1662
  // wrap output
1654
1663
  if ( options.banner ) body.prepend( options.banner );
1655
1664
  if ( options.footer ) body.append( options.footer );
1656
1665
 
1657
- code = body.toString();
1666
+ var code = body.toString();
1667
+ var map;
1658
1668
 
1659
1669
  if ( !!options.sourceMap ) {
1660
- if ( options.sourceMap !== 'inline' && !options.sourceMapFile) {
1670
+ if ( options.sourceMap !== 'inline' && !options.sourceMapFile ) {
1661
1671
  throw new Error( 'You must provide `sourceMapFile` option' );
1662
1672
  }
1663
1673
 
@@ -1666,10 +1676,10 @@
1666
1676
  }
1667
1677
 
1668
1678
  var sourceMapFile;
1669
- if (options.sourceMap === 'inline') {
1679
+ if ( options.sourceMap === 'inline' ) {
1670
1680
  sourceMapFile = null;
1671
1681
  } else {
1672
- sourceMapFile = isAbsolutePath( options.sourceMapFile ) ? options.sourceMapFile : './' + splitPath( options.sourceMapFile ).pop();
1682
+ sourceMapFile = ABSOLUTE_PATH.test( options.sourceMapFile ) ? options.sourceMapFile : './' + splitPath( options.sourceMapFile ).pop();
1673
1683
  }
1674
1684
 
1675
1685
  if ( isBundle ) {
@@ -1681,7 +1691,7 @@
1681
1691
  map = body.generateMap({
1682
1692
  includeContent: true,
1683
1693
  file: sourceMapFile,
1684
- source: (sourceMapFile && !isBundle) ? utils_packageResult__getRelativePath( sourceMapFile, options.sourceMapSource ) : null
1694
+ source: ( sourceMapFile && !isBundle ) ? utils_packageResult__getRelativePath( sourceMapFile, options.sourceMapSource ) : null
1685
1695
  });
1686
1696
 
1687
1697
  if ( options.sourceMap === 'inline' ) {
@@ -1698,9 +1708,9 @@
1698
1708
  code: code,
1699
1709
  map: map,
1700
1710
  toString: function () {
1701
- if ( !warned[ methodName ] ) {
1702
- console.log( 'Warning: esperanto.' + methodName + '() returns an object with a \'code\' property. You should use this instead of using the returned value directly' );
1703
- warned[ methodName ] = true;
1711
+ if ( !utils_packageResult__warned[ methodName ] ) {
1712
+ console.log( (("Warning: esperanto." + methodName) + "() returns an object with a 'code' property. You should use this instead of using the returned value directly") );
1713
+ utils_packageResult__warned[ methodName ] = true;
1704
1714
  }
1705
1715
 
1706
1716
  return code;
@@ -1708,10 +1718,6 @@
1708
1718
  };
1709
1719
  }
1710
1720
 
1711
- function isAbsolutePath ( path ) {
1712
- return /^(?:[A-Z]:)?[\/\\]/i.test( path );
1713
- }
1714
-
1715
1721
  function utils_packageResult__getRelativePath ( from, to ) {
1716
1722
  var fromParts, toParts, i;
1717
1723
 
@@ -1754,21 +1760,6 @@
1754
1760
  });
1755
1761
  }
1756
1762
 
1757
- /**
1758
- * Creates a template function from a template string. The template
1759
- may have `<%= someVar %>` interpolators, and the returned function
1760
- should be called with a data object e.g. `{ someVar: 'someData' }`
1761
- * @param {string} str - the template string
1762
- * @returns {function}
1763
- */
1764
- function template ( str ) {
1765
- return function ( data ) {
1766
- return str.replace( /<%=\s*([^\s]+)\s*%>/g, function ( match, $1 ) {
1767
- return $1 in data ? data[ $1 ] : match;
1768
- });
1769
- };
1770
- }
1771
-
1772
1763
  function resolveId ( importPath, importerPath ) {
1773
1764
  var resolved, importerParts, importParts;
1774
1765
 
@@ -1804,58 +1795,91 @@
1804
1795
  };
1805
1796
  }
1806
1797
 
1807
- var defaultsMode_amd__introTemplate = template( 'define(<%= amdName %><%= paths %>function (<%= names %>) {\n\n' );
1798
+ function getImportSummary (name) {var imports = name.imports, absolutePaths = name.absolutePaths, name = name.name;
1799
+ var paths = [];
1800
+ var names = [];
1801
+ var seen = {};
1802
+ var placeholders = 0;
1808
1803
 
1809
- function defaultsMode_amd__amd ( mod, options ) {
1810
- var seen = {},
1811
- importNames = [],
1812
- importPaths = [],
1813
- intro,
1814
- placeholders = 0;
1804
+ imports.forEach( function(x ) {
1805
+ var path = x.id || x.path; // TODO unify these
1815
1806
 
1816
- // gather imports, and remove import declarations
1817
- mod.imports.forEach( function(x ) {
1818
- var path = options.absolutePaths ? resolveId( x.path, options.amdName ) : x.path;
1807
+ if ( !seen[ path ] ) {
1808
+ seen[ path ] = true;
1819
1809
 
1820
- if ( !utils_hasOwnProp.call( seen, path ) ) {
1821
- importPaths.push( path );
1810
+ paths.push( path );
1822
1811
 
1823
- if ( x.as ) {
1812
+ // TODO x could be an external module, or an internal one.
1813
+ // they have different shapes, resulting in the confusing
1814
+ // code below
1815
+ if ( ( x.needsDefault || x.needsNamed ) || ( x.specifiers && x.specifiers.length ) ) {
1824
1816
  while ( placeholders ) {
1825
- importNames.push( '__dep' + importNames.length + '__' );
1817
+ names.push( (("__dep" + (names.length)) + "__") );
1826
1818
  placeholders--;
1827
1819
  }
1828
- importNames.push( x.as );
1820
+ names.push( x.name );
1829
1821
  } else {
1830
1822
  placeholders++;
1831
1823
  }
1832
-
1833
- seen[ path ] = true;
1834
1824
  }
1825
+ });
1826
+
1827
+ var ids = absolutePaths ? paths.map( function(relativePath ) {return resolveId( relativePath, name )} ) : paths.slice();
1828
+
1829
+ return { ids: ids, paths: paths, names: names };
1830
+ }
1831
+
1832
+ function processName ( name ) {
1833
+ return name ? quote( name ) + ', ' : '';
1834
+ }
1835
+
1836
+ function processIds ( ids ) {
1837
+ return ids.length ? '[' + ids.map( quote ).join( ', ' ) + '], ' : '';
1838
+ }
1839
+
1840
+ function amdIntro (absolutePaths) {var name = absolutePaths.name, imports = absolutePaths.imports, hasExports = absolutePaths.hasExports, indentStr = absolutePaths.indentStr, absolutePaths = absolutePaths.absolutePaths;
1841
+ var ids = (names = getImportSummary({ name: name, imports: imports, absolutePaths: absolutePaths })).ids, names = names.names;
1842
+
1843
+ if ( hasExports ) {
1844
+ ids.unshift( 'exports' );
1845
+ names.unshift( 'exports' );
1846
+ }
1847
+
1848
+ var intro = (("\
1849
+ \ndefine(" + (processName(name))) + ("" + (processIds(ids))) + ("function (" + (names.join( ', ' ))) + ") {\
1850
+ \n\
1851
+ \n 'use strict';\
1852
+ \n\
1853
+ \n");
1835
1854
 
1855
+ return intro.replace( /\t/g, indentStr );
1856
+ }
1857
+
1858
+ function defaultsMode_amd__amd ( mod, options ) {
1859
+ mod.imports.forEach( function(x ) {
1836
1860
  mod.body.remove( x.start, x.next );
1837
1861
  });
1838
1862
 
1839
1863
  transformExportDeclaration( mod.exports[0], mod.body );
1840
1864
 
1841
- intro = defaultsMode_amd__introTemplate({
1842
- amdName: options.amdName ? (("'" + (options.amdName)) + "', ") : '',
1843
- paths: importPaths.length ? '[' + importPaths.map( quote ).join( ', ' ) + '], ' : '',
1844
- names: importNames.join( ', ' )
1865
+ var intro = amdIntro({
1866
+ name: options.amdName,
1867
+ imports: mod.imports,
1868
+ absolutePaths: options.absolutePaths,
1869
+ indentStr: mod.body.getIndentString()
1845
1870
  });
1846
1871
 
1847
1872
  mod.body.trim()
1848
- .prepend( "'use strict';\n\n" )
1849
- .trim()
1850
1873
  .indent()
1851
1874
  .prepend( intro )
1875
+ .trim()
1852
1876
  .append( '\n\n});' );
1853
1877
 
1854
1878
  return packageResult( mod, mod.body, options, 'toAmd' );
1855
1879
  }
1856
1880
 
1857
1881
  function defaultsMode_cjs__cjs ( mod, options ) {
1858
- var seen = {}, exportDeclaration;
1882
+ var seen = {};
1859
1883
 
1860
1884
  mod.imports.forEach( function(x ) {
1861
1885
  if ( !utils_hasOwnProp.call( seen, x.path ) ) {
@@ -1868,18 +1892,18 @@
1868
1892
  }
1869
1893
  });
1870
1894
 
1871
- exportDeclaration = mod.exports[0];
1895
+ var exportDeclaration = mod.exports[0];
1872
1896
 
1873
1897
  if ( exportDeclaration ) {
1874
1898
  switch ( exportDeclaration.type ) {
1875
1899
  case 'namedFunction':
1876
1900
  case 'namedClass':
1877
- mod.body.remove( exportDeclaration.start, exportDeclaration.node.declaration.start );
1901
+ mod.body.remove( exportDeclaration.start, exportDeclaration.valueStart );
1878
1902
  mod.body.replace( exportDeclaration.end, exportDeclaration.end, (("\nmodule.exports = " + (exportDeclaration.node.declaration.id.name)) + ";") );
1879
1903
  break;
1880
1904
 
1881
1905
  default:
1882
- mod.body.replace( exportDeclaration.start, exportDeclaration.node.declaration.start, 'module.exports = ' );
1906
+ mod.body.replace( exportDeclaration.start, exportDeclaration.valueStart, 'module.exports = ' );
1883
1907
  break;
1884
1908
  }
1885
1909
  }
@@ -1889,53 +1913,63 @@
1889
1913
  return packageResult( mod, mod.body, options, 'toCjs' );
1890
1914
  }
1891
1915
 
1892
- function standaloneUmdIntro ( options, indentStr ) {
1893
- var amdName = options.amdName ?
1894
- quote(options.amdName) + ", " :
1895
- '';
1916
+ function umdIntro (strict) {var amdName = strict.amdName, name = strict.name, hasExports = strict.hasExports, imports = strict.imports, absolutePaths = strict.absolutePaths, externalDefaults = strict.externalDefaults, indentStr = strict.indentStr, strict = strict.strict;
1917
+ var intro;
1896
1918
 
1897
- var intro =
1898
- (("(function (factory) {\
1899
- \n !(typeof exports === 'object' && typeof module !== 'undefined') &&\
1900
- \n typeof define === 'function' && define.amd ? define(" + amdName) + "factory) :\
1901
- \n factory()\
1902
- \n}(function () { 'use strict';\
1919
+ if ( !hasExports && !imports.length ) {
1920
+ intro =
1921
+ (("(function (factory) {\
1922
+ \n !(typeof exports === 'object' && typeof module !== 'undefined') &&\
1923
+ \n typeof define === 'function' && define.amd ? define(" + (processName(amdName))) + "factory) :\
1924
+ \n factory()\
1925
+ \n }(function () { 'use strict';\
1903
1926
  \n\
1904
- \n");
1927
+ \n ");
1928
+ }
1905
1929
 
1906
- return intro.replace( /\t/g, indentStr );
1907
- }
1930
+ else {
1931
+ var ids = (names = getImportSummary({ imports: imports, name: amdName, absolutePaths: absolutePaths })).ids, paths = names.paths, names = names.names;
1908
1932
 
1909
- function defaultUmdIntro ( options, indentStr ) {
1910
- var hasExports = options.hasExports;
1933
+ var amdExport, cjsExport, globalExport, defaultsBlock;
1911
1934
 
1912
- var amdName = options.amdName ?
1913
- quote(options.amdName) + ", " :
1914
- '';
1915
- var amdDeps = options.importPaths.length > 0 ?
1916
- '[' + ( options.absolutePaths ? options.importPaths.map( resolveAgainst( options.amdName ) ) : options.importPaths ).map( quote ).join( ', ' ) + '], ' :
1917
- '';
1918
- var cjsDeps = options.importPaths.map( req ).join( ', ' );
1919
- var globalDeps = options.importNames.map( globalify ).join( ', ' );
1920
- var args = options.importNames.join( ', ' );
1935
+ if ( strict ) {
1936
+ cjsExport = (("factory(" + (( hasExports ? [ 'exports' ] : [] ).concat( paths.map( req ) ).join( ', ' ))) + ")");
1937
+ var globalDeps = ( hasExports ? [ (("(global." + name) + " = {})") ] : [] ).concat( names.map( globalify ) ).join( ', ' );
1938
+ globalExport = (("factory(" + globalDeps) + ")");
1921
1939
 
1922
- var cjsExport =
1923
- (hasExports ? 'module.exports = ' : '') + (("factory(" + cjsDeps) + ")");
1940
+ if ( hasExports ) {
1941
+ ids.unshift( 'exports' );
1942
+ names.unshift( 'exports' );
1943
+ }
1924
1944
 
1925
- var globalExport =
1926
- (hasExports ? (("global." + (options.name)) + " = ") : '') + (("factory(" + globalDeps) + ")");
1945
+ amdExport = (("define(" + (processName(amdName))) + ("" + (processIds(ids))) + "factory)");
1946
+ defaultsBlock = '';
1947
+ if ( externalDefaults && externalDefaults.length > 0 ) {
1948
+ defaultsBlock = externalDefaults.map( function(x )
1949
+ {return '\t' + ( x.needsNamed ? (("var " + (x.name)) + "__default") : x.name ) +
1950
+ ((" = ('default' in " + (x.name)) + (" ? " + (x.name)) + ("['default'] : " + (x.name)) + ");")}
1951
+ ).join('\n') + '\n\n';
1952
+ }
1953
+ } else {
1954
+ amdExport = (("define(" + (processName(amdName))) + ("" + (processIds(ids))) + "factory)");
1955
+ cjsExport = ( hasExports ? 'module.exports = ' : '' ) + (("factory(" + (paths.map( req ).join( ', ' ))) + ")");
1956
+ globalExport = ( hasExports ? (("global." + name) + " = ") : '' ) + (("factory(" + (names.map( globalify ).join( ', ' ))) + ")");
1927
1957
 
1958
+ defaultsBlock = '';
1959
+ }
1928
1960
 
1929
- var intro =
1930
- (("(function (global, factory) {\
1931
- \n typeof exports === 'object' && typeof module !== 'undefined' ? " + cjsExport) + (" :\
1932
- \n typeof define === 'function' && define.amd ? define(" + amdName) + ("" + amdDeps) + ("factory) :\
1933
- \n " + globalExport) + ("\
1934
- \n}(this, function (" + args) + ") { 'use strict';\
1961
+ intro =
1962
+ (("(function (global, factory) {\
1963
+ \n typeof exports === 'object' && typeof module !== 'undefined' ? " + cjsExport) + (" :\
1964
+ \n typeof define === 'function' && define.amd ? " + amdExport) + (" :\
1965
+ \n " + globalExport) + ("\
1966
+ \n }(this, function (" + (names.join( ', ' ))) + (") { 'use strict';\
1935
1967
  \n\
1936
- \n");
1968
+ \n " + defaultsBlock) + "");
1937
1969
 
1938
- return intro.replace( /\t/g, indentStr );
1970
+ }
1971
+
1972
+ return intro.replace( /^\t\t\t/gm, '' ).replace( /\t/g, indentStr );
1939
1973
  }
1940
1974
 
1941
1975
  var EsperantoError = function ( message, data ) {
@@ -1966,54 +2000,22 @@
1966
2000
  }
1967
2001
 
1968
2002
  function defaultsMode_umd__umd ( mod, options ) {
1969
- var importNames = [];
1970
- var importPaths = [];
1971
- var seen = {};
1972
- var placeholders = 0;
1973
-
1974
2003
  requireName( options );
1975
2004
 
1976
- var hasImports = mod.imports.length > 0;
1977
- var hasExports = mod.exports.length > 0;
1978
-
1979
- var intro;
1980
- if (!hasImports && !hasExports) {
1981
- intro = standaloneUmdIntro({
1982
- amdName: options.amdName,
1983
- }, mod.body.getIndentString() );
1984
- } else {
1985
- // gather imports, and remove import declarations
1986
- mod.imports.forEach( function(x ) {
1987
- if ( !utils_hasOwnProp.call( seen, x.path ) ) {
1988
- importPaths.push( x.path );
1989
-
1990
- if ( x.as ) {
1991
- while ( placeholders ) {
1992
- importNames.push( '__dep' + importNames.length + '__' );
1993
- placeholders--;
1994
- }
1995
- importNames.push( x.as );
1996
- } else {
1997
- placeholders++;
1998
- }
1999
-
2000
- seen[ x.path ] = true;
2001
- }
2002
-
2003
- mod.body.remove( x.start, x.next );
2004
- });
2005
+ mod.imports.forEach( function(x ) {
2006
+ mod.body.remove( x.start, x.next );
2007
+ });
2005
2008
 
2006
- transformExportDeclaration( mod.exports[0], mod.body );
2009
+ var intro = umdIntro({
2010
+ hasExports: mod.exports.length > 0,
2011
+ imports: mod.imports,
2012
+ amdName: options.amdName,
2013
+ absolutePaths: options.absolutePaths,
2014
+ name: options.name,
2015
+ indentStr: mod.body.getIndentString()
2016
+ });
2007
2017
 
2008
- intro = defaultUmdIntro({
2009
- hasExports: hasExports,
2010
- importPaths: importPaths,
2011
- importNames: importNames,
2012
- amdName: options.amdName,
2013
- absolutePaths: options.absolutePaths,
2014
- name: options.name
2015
- }, mod.body.getIndentString() );
2016
- }
2018
+ transformExportDeclaration( mod.exports[0], mod.body );
2017
2019
 
2018
2020
  mod.body.indent().prepend( intro ).trimLines().append( '\n\n}));' );
2019
2021
 
@@ -2027,18 +2029,17 @@
2027
2029
  };
2028
2030
 
2029
2031
  function gatherImports ( imports ) {
2030
- var chains = {}, identifierReplacements = {};
2032
+ var chains = {};
2033
+ var identifierReplacements = {};
2031
2034
 
2032
2035
  imports.forEach( function(x ) {
2033
2036
  x.specifiers.forEach( function(s ) {
2034
- var name, replacement;
2035
-
2036
2037
  if ( s.isBatch ) {
2037
2038
  return;
2038
2039
  }
2039
2040
 
2040
- name = s.as;
2041
- replacement = x.name + ( s.isDefault ? ("['default']") : ("." + (s.name)) );
2041
+ var name = s.as;
2042
+ var replacement = x.name + ( s.isDefault ? ("['default']") : ("." + (s.name)) );
2042
2043
 
2043
2044
  if ( !x.passthrough ) {
2044
2045
  identifierReplacements[ name ] = replacement;
@@ -2063,7 +2064,7 @@
2063
2064
  }
2064
2065
 
2065
2066
  x.specifiers.forEach( function(s ) {
2066
- result[ s.name ] = s.name;
2067
+ result[ s.name ] = s.as;
2067
2068
  });
2068
2069
  });
2069
2070
 
@@ -2074,7 +2075,7 @@
2074
2075
  * Scans an array of imports, and determines which identifiers
2075
2076
  are readonly, and which cannot be assigned to. For example
2076
2077
  you cannot `import foo from 'foo'` then do `foo = 42`, nor
2077
- can you `import * from 'foo'` then do `foo.answer = 42`
2078
+ can you `import * as foo from 'foo'` then do `foo.answer = 42`
2078
2079
  * @param {array} imports - the array of imports
2079
2080
  * @returns {array} [ importedBindings, importedNamespaces ]
2080
2081
  */
@@ -2100,7 +2101,7 @@
2100
2101
  namespaceMessage = 'Cannot reassign imported binding of namespace ';
2101
2102
 
2102
2103
  function disallowIllegalReassignment ( node, importedBindings, importedNamespaces, scope ) {
2103
- var assignee, name, isNamespaceAssignment;
2104
+ var assignee, isNamespaceAssignment;
2104
2105
 
2105
2106
  if ( node.type === 'AssignmentExpression' ) {
2106
2107
  assignee = node.left;
@@ -2119,7 +2120,7 @@
2119
2120
  return; // not assigning to a binding
2120
2121
  }
2121
2122
 
2122
- name = assignee.name;
2123
+ var name = assignee.name;
2123
2124
 
2124
2125
  if ( utils_hasOwnProp.call( isNamespaceAssignment ? importedNamespaces : importedBindings, name ) && !scope.contains( name ) ) {
2125
2126
  throw new Error( ( isNamespaceAssignment ? namespaceMessage : bindingMessage ) + '`' + name + '`' );
@@ -2139,7 +2140,7 @@
2139
2140
  }
2140
2141
 
2141
2142
  function rewriteExportAssignments ( body, node, exports, scope, capturedUpdates ) {
2142
- var assignee, name, exportAs;
2143
+ var assignee;
2143
2144
 
2144
2145
  if ( node.type === 'AssignmentExpression' ) {
2145
2146
  assignee = node.left;
@@ -2153,18 +2154,17 @@
2153
2154
  return;
2154
2155
  }
2155
2156
 
2156
- name = assignee.name;
2157
+ var name = assignee.name;
2157
2158
 
2158
2159
  if ( scope.contains( name, true ) ) {
2159
2160
  return; // shadows an export
2160
2161
  }
2161
2162
 
2162
- if ( exports && utils_hasOwnProp.call( exports, name ) && ( exportAs = exports[ name ] ) ) {
2163
+ if ( exports && utils_hasOwnProp.call( exports, name ) ) {
2164
+ var exportAs = exports[ name ];
2165
+
2163
2166
  if ( !!capturedUpdates ) {
2164
- capturedUpdates.push({
2165
- name: name,
2166
- exportAs: exportAs
2167
- });
2167
+ capturedUpdates.push({ name: name, exportAs: exportAs });
2168
2168
  return;
2169
2169
  }
2170
2170
 
@@ -2178,10 +2178,10 @@
2178
2178
  }
2179
2179
 
2180
2180
  function traverseAst ( ast, body, identifierReplacements, importedBindings, importedNamespaces, exportNames ) {
2181
- var scope = ast._scope,
2182
- blockScope = ast._blockScope,
2183
- capturedUpdates = null,
2184
- previousCapturedUpdates = null;
2181
+ var scope = ast._scope;
2182
+ var blockScope = ast._blockScope;
2183
+ var capturedUpdates = null;
2184
+ var previousCapturedUpdates = null;
2185
2185
 
2186
2186
  walk( ast, {
2187
2187
  enter: function ( node, parent ) {
@@ -2206,7 +2206,6 @@
2206
2206
  return;
2207
2207
  }
2208
2208
 
2209
- // Catch illegal reassignments
2210
2209
  disallowIllegalReassignment( node, importedBindings, importedNamespaces, scope );
2211
2210
 
2212
2211
  // Rewrite assignments to exports inside functions, to keep bindings live.
@@ -2245,22 +2244,14 @@
2245
2244
  }
2246
2245
 
2247
2246
  function exportCapturedUpdate ( c ) {
2248
- return ((" exports." + (c.name)) + (" = " + (c.exportAs)) + ";");
2247
+ return ((" exports." + (c.exportAs)) + (" = " + (c.name)) + ";");
2249
2248
  }
2250
2249
 
2251
- function transformBody ( mod, body, options ) {var $D$0;
2252
- var chains,
2253
- identifierReplacements,
2254
- importedBindings = {},
2255
- importedNamespaces = {},
2256
- exportNames,
2257
- earlyExports,
2258
- lateExports;
2259
-
2260
- chains = ($D$0 = gatherImports( mod.imports ))[0], identifierReplacements = $D$0[1], $D$0;
2261
- exportNames = getExportNames( mod.exports );
2250
+ function transformBody ( mod, body, options ) {
2251
+ var chains = (identifierReplacements = gatherImports( mod.imports ))[0], identifierReplacements = identifierReplacements[1];
2252
+ var exportNames = getExportNames( mod.exports );
2262
2253
 
2263
- importedBindings = ($D$0 = getReadOnlyIdentifiers( mod.imports ))[0], importedNamespaces = $D$0[1], $D$0;
2254
+ var importedBindings = (importedNamespaces = getReadOnlyIdentifiers( mod.imports ))[0], importedNamespaces = importedNamespaces[1];
2264
2255
 
2265
2256
  // ensure no conflict with `exports`
2266
2257
  identifierReplacements.exports = deconflict( 'exports', mod.ast._declared );
@@ -2269,12 +2260,6 @@
2269
2260
 
2270
2261
  // Remove import statements from the body of the module
2271
2262
  mod.imports.forEach( function(x ) {
2272
- if ( x.passthrough ) {
2273
- // this is an `export { foo } from './bar'` statement -
2274
- // it will be dealt with in the next section
2275
- return;
2276
- }
2277
-
2278
2263
  body.remove( x.start, x.next );
2279
2264
  });
2280
2265
 
@@ -2315,8 +2300,8 @@
2315
2300
  });
2316
2301
 
2317
2302
  // Append export block (this is the same for all module types, unlike imports)
2318
- earlyExports = [];
2319
- lateExports = [];
2303
+ var earlyExports = [];
2304
+ var lateExports = [];
2320
2305
 
2321
2306
  Object.keys( exportNames ).forEach( function(name ) {
2322
2307
  var exportAs = exportNames[ name ];
@@ -2350,7 +2335,7 @@
2350
2335
  if ( options.intro && options.outro ) {
2351
2336
  body.indent().prepend( options.intro ).trimLines().append( options.outro );
2352
2337
  }
2353
- ;$D$0 = void 0}
2338
+ }
2354
2339
 
2355
2340
  function deconflict ( name, declared ) {
2356
2341
  while ( utils_hasOwnProp.call( declared, name ) ) {
@@ -2360,52 +2345,15 @@
2360
2345
  return name;
2361
2346
  }
2362
2347
 
2363
- function getImportSummary ( mod ) {
2364
- var importPaths = [], importNames = [], seen = {}, placeholders = 0;
2365
-
2366
- mod.imports.forEach( function(x ) {
2367
- if ( !utils_hasOwnProp.call( seen, x.path ) ) {
2368
- importPaths.push( x.path );
2369
-
2370
- if ( x.specifiers.length ) {
2371
- while ( placeholders ) {
2372
- importNames.push( '__dep' + importNames.length + '__' );
2373
- placeholders--;
2374
- }
2375
- importNames.push( x.name );
2376
- } else {
2377
- placeholders++;
2378
- }
2379
-
2380
- seen[ x.path ] = true;
2381
- }
2348
+ function strictMode_amd__amd ( mod, options ) {
2349
+ var intro = amdIntro({
2350
+ name: options.amdName,
2351
+ absolutePaths: options.absolutePaths,
2352
+ imports: mod.imports,
2353
+ indentStr: mod.body.getIndentString(),
2354
+ hasExports: mod.exports.length
2382
2355
  });
2383
2356
 
2384
- return [ importPaths, importNames ];
2385
- }
2386
-
2387
- var strictMode_amd__introTemplate;
2388
-
2389
- strictMode_amd__introTemplate = template( 'define(<%= amdName %><%= paths %>function (<%= names %>) {\n\n\t\'use strict\';\n\n' );
2390
-
2391
- function strictMode_amd__amd ( mod, options ) {var $D$1;
2392
- var importPaths,
2393
- importNames,
2394
- intro;
2395
-
2396
- importPaths = ($D$1 = getImportSummary( mod ))[0], importNames = $D$1[1], $D$1;
2397
-
2398
- if ( mod.exports.length ) {
2399
- importPaths.unshift( 'exports' );
2400
- importNames.unshift( 'exports' );
2401
- }
2402
-
2403
- intro = strictMode_amd__introTemplate({
2404
- amdName: options.amdName ? (("'" + (options.amdName)) + "', ") : '',
2405
- paths: importPaths.length ? '[' + ( options.absolutePaths ? importPaths.map( resolveAgainst( options.amdName ) ) : importPaths ).map( quote ).join( ', ' ) + '], ' : '',
2406
- names: importNames.join( ', ' )
2407
- }).replace( /\t/g, mod.body.getIndentString() );
2408
-
2409
2357
  transformBody( mod, mod.body, {
2410
2358
  intro: intro,
2411
2359
  outro: '\n\n});',
@@ -2413,26 +2361,22 @@
2413
2361
  });
2414
2362
 
2415
2363
  return packageResult( mod, mod.body, options, 'toAmd' );
2416
- ;$D$1 = void 0}
2364
+ }
2417
2365
 
2418
2366
  function strictMode_cjs__cjs ( mod, options ) {
2419
- var importBlock, seen = {};
2367
+ var seen = {};
2420
2368
 
2421
2369
  // Create block of require statements
2422
- importBlock = mod.imports.map( function(x ) {
2423
- var name, replacement;
2424
-
2370
+ var importBlock = mod.imports.map( function(x ) {
2425
2371
  if ( !utils_hasOwnProp.call( seen, x.path ) ) {
2372
+ seen[ x.path ] = true;
2373
+
2426
2374
  if ( x.isEmpty ) {
2427
- replacement = (("" + (req(x.path))) + ";");
2428
- } else {
2429
- replacement = (("var " + (x.name)) + (" = " + (req(x.path))) + ";");
2375
+ return (("" + (req(x.path))) + ";");
2430
2376
  }
2431
2377
 
2432
- seen[ x.path ] = true;
2378
+ return (("var " + (x.name)) + (" = " + (req(x.path))) + ";");
2433
2379
  }
2434
-
2435
- return replacement;
2436
2380
  }).filter( Boolean ).join( '\n' );
2437
2381
 
2438
2382
  transformBody( mod, mod.body, {
@@ -2445,65 +2389,18 @@
2445
2389
  return packageResult( mod, mod.body, options, 'toCjs' );
2446
2390
  }
2447
2391
 
2448
- function strictUmdIntro ( options, indentStr ) {
2449
- var hasExports = options.hasExports;
2450
-
2451
- var amdName = options.amdName ?
2452
- "'" + options.amdName + "', " :
2453
- '';
2454
- var amdDeps = hasExports || options.importPaths.length > 0 ?
2455
- '[' +
2456
- ( hasExports ? [ 'exports' ] : [] ).concat( options.absolutePaths ? options.importPaths.map( resolveAgainst( options.amdName ) ) : options.importPaths ).map( quote ).join( ', ' ) +
2457
- '], ' :
2458
- '';
2459
- var cjsDeps = ( hasExports ? [ 'exports' ] : [] ).concat( options.importPaths.map( req ) ).join( ', ' );
2460
- var globalDeps = ( hasExports ? [ (("(global." + (options.name)) + " = {})") ] : [] )
2461
- .concat( options.importNames.map( globalify ) ).join( ', ' );
2462
- var args = ( hasExports ? [ 'exports' ] : [] ).concat( options.importNames ).join( ', ' );
2463
-
2464
- var defaultsBlock = '';
2465
- if ( options.externalDefaults && options.externalDefaults.length > 0 ) {
2466
- defaultsBlock = options.externalDefaults.map( function(x )
2467
- {return '\t' + ( x.needsNamed ? (("var " + (x.name)) + "__default") : x.name ) +
2468
- ((" = ('default' in " + (x.name)) + (" ? " + (x.name)) + ("['default'] : " + (x.name)) + ");")}
2469
- ).join('\n') + '\n\n';
2470
- }
2471
-
2472
- var intro =
2473
- (("(function (global, factory) {\
2474
- \n typeof exports === 'object' && typeof module !== 'undefined' ? factory(" + cjsDeps) + (") :\
2475
- \n typeof define === 'function' && define.amd ? define(" + amdName) + ("" + amdDeps) + ("factory) :\
2476
- \n factory(" + globalDeps) + (")\
2477
- \n}(this, function (" + args) + (") { 'use strict';\
2478
- \n\
2479
- \n" + defaultsBlock) + "");
2480
-
2481
- return intro.replace( /\t/g, indentStr );
2482
- }
2483
-
2484
2392
  function strictMode_umd__umd ( mod, options ) {
2485
2393
  requireName( options );
2486
2394
 
2487
- var importPaths = (importNames = getImportSummary( mod ))[0], importNames = importNames[1];
2488
-
2489
- var hasImports = mod.imports.length > 0;
2490
- var hasExports = mod.exports.length > 0;
2491
-
2492
- var intro;
2493
- if (!hasImports && !hasExports) {
2494
- intro = standaloneUmdIntro({
2495
- amdName: options.amdName,
2496
- }, mod.body.getIndentString() );
2497
- } else {
2498
- intro = strictUmdIntro({
2499
- hasExports: hasExports,
2500
- importPaths: importPaths,
2501
- importNames: importNames,
2502
- amdName: options.amdName,
2503
- absolutePaths: options.absolutePaths,
2504
- name: options.name
2505
- }, mod.body.getIndentString() );
2506
- }
2395
+ var intro = umdIntro({
2396
+ hasExports: mod.exports.length > 0,
2397
+ imports: mod.imports,
2398
+ amdName: options.amdName,
2399
+ absolutePaths: options.absolutePaths,
2400
+ name: options.name,
2401
+ indentStr: mod.body.getIndentString(),
2402
+ strict: true
2403
+ });
2507
2404
 
2508
2405
  transformBody( mod, mod.body, {
2509
2406
  intro: intro,
@@ -2526,28 +2423,22 @@
2526
2423
  strictMode: strictMode
2527
2424
  };
2528
2425
 
2529
- var builders_defaultsMode_amd__introTemplate = template( 'define(<%= amdName %><%= amdDeps %>function (<%= names %>) {\n\n\t\'use strict\';\n\n' );
2530
-
2531
2426
  function builders_defaultsMode_amd__amd ( bundle, options ) {
2532
2427
  var defaultName = bundle.entryModule.identifierReplacements.default;
2533
2428
  if ( defaultName ) {
2534
2429
  bundle.body.append( (("\n\nreturn " + defaultName) + ";") );
2535
2430
  }
2536
2431
 
2537
- var intro = builders_defaultsMode_amd__introTemplate({
2538
- amdName: options.amdName ? (("" + (quote(options.amdName))) + ", ") : '',
2539
- amdDeps: bundle.externalModules.length ? '[' + bundle.externalModules.map( quoteId ).join( ', ' ) + '], ' : '',
2540
- names: bundle.externalModules.map( getName ).join( ', ' )
2541
- }).replace( /\t/g, bundle.body.getIndentString() );
2432
+ var intro = amdIntro({
2433
+ name: options.amdName,
2434
+ imports: bundle.externalModules,
2435
+ indentStr: bundle.body.getIndentString()
2436
+ });
2542
2437
 
2543
2438
  bundle.body.indent().prepend( intro ).trimLines().append( '\n\n});' );
2544
2439
  return packageResult( bundle, bundle.body, options, 'toAmd', true );
2545
2440
  }
2546
2441
 
2547
- function quoteId ( m ) {
2548
- return "'" + m.id + "'";
2549
- }
2550
-
2551
2442
  function builders_defaultsMode_cjs__cjs ( bundle, options ) {
2552
2443
  var importBlock = bundle.externalModules.map( function(x ) {
2553
2444
  return (("var " + (x.name)) + (" = " + (req(x.id))) + ";");
@@ -2572,31 +2463,16 @@
2572
2463
 
2573
2464
  var entry = bundle.entryModule;
2574
2465
 
2575
- var hasImports = bundle.externalModules.length > 0;
2576
- var hasExports = entry.exports.length > 0;
2577
-
2578
- var intro;
2579
- if (!hasImports && !hasExports) {
2580
- intro = standaloneUmdIntro({
2581
- amdName: options.amdName,
2582
- }, bundle.body.getIndentString() );
2583
- } else {
2584
-
2585
- var defaultName = entry.identifierReplacements.default;
2586
- if ( defaultName ) {
2587
- bundle.body.append( (("\n\nreturn " + defaultName) + ";") );
2588
- }
2589
-
2590
- var importPaths = bundle.externalModules.map( getId );
2591
- var importNames = bundle.externalModules.map( getName );
2466
+ var intro = umdIntro({
2467
+ hasExports: entry.exports.length > 0,
2468
+ imports: bundle.externalModules,
2469
+ amdName: options.amdName,
2470
+ name: options.name,
2471
+ indentStr: bundle.body.getIndentString()
2472
+ });
2592
2473
 
2593
- intro = defaultUmdIntro({
2594
- hasExports: hasExports,
2595
- importPaths: importPaths,
2596
- importNames: importNames,
2597
- amdName: options.amdName,
2598
- name: options.name
2599
- }, bundle.body.getIndentString() );
2474
+ if ( entry.defaultExport ) {
2475
+ bundle.body.append( (("\n\nreturn " + (entry.identifierReplacements.default)) + ";") );
2600
2476
  }
2601
2477
 
2602
2478
  bundle.body.indent().prepend( intro ).trimLines().append('\n\n}));');
@@ -2615,15 +2491,10 @@
2615
2491
  return (("exports['default'] = " + name) + ";");
2616
2492
  }
2617
2493
 
2618
- var builders_strictMode_amd__introTemplate = template( 'define(<%= amdName %><%= amdDeps %>function (<%= names %>) {\n\n\t\'use strict\';\n\n' );
2619
-
2620
2494
  function builders_strictMode_amd__amd ( bundle, options ) {
2621
2495
  var externalDefaults = bundle.externalModules.filter( builders_strictMode_amd__needsDefault );
2622
2496
  var entry = bundle.entryModule;
2623
2497
 
2624
- var importIds = bundle.externalModules.map( getId );
2625
- var importNames = bundle.externalModules.map( getName );
2626
-
2627
2498
  if ( externalDefaults.length ) {
2628
2499
  var defaultsBlock = externalDefaults.map( function(x ) {
2629
2500
  // Case 1: default is used, and named is not
@@ -2638,20 +2509,16 @@
2638
2509
  bundle.body.prepend( defaultsBlock + '\n\n' );
2639
2510
  }
2640
2511
 
2641
- if ( entry.exports.length ) {
2642
- importIds.unshift( 'exports' );
2643
- importNames.unshift( 'exports' );
2644
-
2645
- if ( entry.defaultExport ) {
2646
- bundle.body.append( '\n\n' + getExportBlock( entry ) );
2647
- }
2512
+ if ( entry.defaultExport ) {
2513
+ bundle.body.append( '\n\n' + getExportBlock( entry ) );
2648
2514
  }
2649
2515
 
2650
- var intro = builders_strictMode_amd__introTemplate({
2651
- amdName: options.amdName ? (("" + (quote(options.amdName))) + ", ") : '',
2652
- amdDeps: importIds.length ? '[' + importIds.map( quote ).join( ', ' ) + '], ' : '',
2653
- names: importNames.join( ', ' )
2654
- }).replace( /\t/g, bundle.body.getIndentString() );
2516
+ var intro = amdIntro({
2517
+ name: options.amdName,
2518
+ imports: bundle.externalModules,
2519
+ hasExports: entry.exports.length,
2520
+ indentStr: bundle.body.getIndentString()
2521
+ });
2655
2522
 
2656
2523
  bundle.body.indent().prepend( intro ).trimLines().append( '\n\n});' );
2657
2524
  return packageResult( bundle, bundle.body, options, 'toAmd', true );
@@ -2694,31 +2561,18 @@
2694
2561
 
2695
2562
  var entry = bundle.entryModule;
2696
2563
 
2697
- var hasImports = bundle.externalModules.length > 0;
2698
- var hasExports = entry.exports.length > 0;
2699
-
2700
- var intro;
2701
- if (!hasImports && !hasExports) {
2702
- intro = standaloneUmdIntro({
2703
- amdName: options.amdName,
2704
- }, bundle.body.getIndentString() );
2705
- } else {
2706
-
2707
- if ( hasExports && entry.defaultExport ) {
2708
- bundle.body.append( '\n\n' + getExportBlock( entry ) );
2709
- }
2710
-
2711
- var importPaths = bundle.externalModules.map( getId );
2712
- var importNames = bundle.externalModules.map( getName );
2564
+ var intro = umdIntro({
2565
+ hasExports: entry.exports.length > 0,
2566
+ imports: bundle.externalModules,
2567
+ externalDefaults: bundle.externalModules.filter( builders_strictMode_umd__needsDefault ),
2568
+ amdName: options.amdName,
2569
+ name: options.name,
2570
+ indentStr: bundle.body.getIndentString(),
2571
+ strict: true
2572
+ });
2713
2573
 
2714
- intro = strictUmdIntro({
2715
- hasExports: hasExports,
2716
- importPaths: importPaths,
2717
- importNames: importNames,
2718
- externalDefaults: bundle.externalModules.filter( builders_strictMode_umd__needsDefault ),
2719
- amdName: options.amdName,
2720
- name: options.name,
2721
- }, bundle.body.getIndentString() );
2574
+ if ( entry.defaultExport ) {
2575
+ bundle.body.append( '\n\n' + getExportBlock( entry ) );
2722
2576
  }
2723
2577
 
2724
2578
  bundle.body.indent().prepend( intro ).trimLines().append('\n\n}));');
@@ -2743,16 +2597,15 @@
2743
2597
  };
2744
2598
 
2745
2599
  function concat ( bundle, options ) {
2746
- var intro, outro, indent;
2747
-
2748
2600
  // This bundle must be self-contained - no imports or exports
2749
2601
  if ( bundle.externalModules.length || bundle.entryModule.exports.length ) {
2750
2602
  throw new Error( (("bundle.concat() can only be used with bundles that have no imports/exports (imports: [" + (bundle.externalModules.map(function(x){return x.id}).join(', '))) + ("], exports: [" + (bundle.entryModule.exports.join(', '))) + "])") );
2751
2603
  }
2752
2604
 
2753
2605
  // TODO test these options
2754
- intro = 'intro' in options ? options.intro : ("(function () { 'use strict';\n\n");
2755
- outro = 'outro' in options ? options.outro : '\n\n})();';
2606
+ var intro = 'intro' in options ? options.intro : ("(function () { 'use strict';\n\n");
2607
+ var outro = 'outro' in options ? options.outro : '\n\n})();';
2608
+ var indent;
2756
2609
 
2757
2610
  if ( !( 'indent' in options ) || options.indent === true ) {
2758
2611
  indent = bundle.body.getIndentString();
@@ -2765,27 +2618,29 @@
2765
2618
  return packageResult( bundle, bundle.body, options, 'toString', true );
2766
2619
  }
2767
2620
 
2768
- var deprecateMessage = 'options.defaultOnly has been deprecated, and is now standard behaviour. To use named imports/exports, pass `strict: true`.',
2769
- alreadyWarned = false;
2621
+ var esperanto__deprecateMessage = 'options.defaultOnly has been deprecated, and is now standard behaviour. To use named imports/exports, pass `strict: true`.';
2622
+ var esperanto__alreadyWarned = false;
2770
2623
 
2771
2624
  function transpileMethod ( format ) {
2772
2625
  return function ( source ) {var options = arguments[1];if(options === void 0)options = {};
2773
- var mod,
2774
- body,
2775
- builder;
2776
-
2777
- mod = getStandaloneModule({ source: source, getModuleName: options.getModuleName, strict: options.strict });
2626
+ var mod = getStandaloneModule({
2627
+ source: source,
2628
+ getModuleName: options.getModuleName,
2629
+ strict: options.strict
2630
+ });
2778
2631
 
2779
- if ( 'defaultOnly' in options && !alreadyWarned ) {
2632
+ if ( 'defaultOnly' in options && !esperanto__alreadyWarned ) {
2780
2633
  // TODO link to a wiki page explaining this, or something
2781
- console.log( deprecateMessage );
2782
- alreadyWarned = true;
2634
+ console.log( esperanto__deprecateMessage );
2635
+ esperanto__alreadyWarned = true;
2783
2636
  }
2784
2637
 
2785
2638
  if ( options.absolutePaths && !options.amdName ) {
2786
2639
  throw new Error( 'You must specify an `amdName` in order to use the `absolutePaths` option' );
2787
2640
  }
2788
2641
 
2642
+ var builder;
2643
+
2789
2644
  if ( !options.strict ) {
2790
2645
  // ensure there are no named imports/exports. TODO link to a wiki page...
2791
2646
  if ( hasNamedImports( mod ) || hasNamedExports( mod ) ) {
@@ -2819,17 +2674,15 @@
2819
2674
  concat: function(options ) {return concat( bundle, options || {} )}
2820
2675
  };
2821
2676
 
2822
- function transpile ( format, options ) {
2823
- var builder;
2824
-
2825
- options = options || {};
2826
-
2827
- if ( 'defaultOnly' in options && !alreadyWarned ) {
2677
+ function transpile ( format ) {var options = arguments[1];if(options === void 0)options = {};
2678
+ if ( 'defaultOnly' in options && !esperanto__alreadyWarned ) {
2828
2679
  // TODO link to a wiki page explaining this, or something
2829
- console.log( deprecateMessage );
2830
- alreadyWarned = true;
2680
+ console.log( esperanto__deprecateMessage );
2681
+ esperanto__alreadyWarned = true;
2831
2682
  }
2832
2683
 
2684
+ var builder;
2685
+
2833
2686
  if ( !options.strict ) {
2834
2687
  // ensure there are no named imports/exports
2835
2688
  if ( hasNamedExports( bundle.entryModule ) ) {