esperanto-source 0.6.26 → 0.6.27

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: faeafe3bdb616966f261dcd7dd3abe8467668d2f
4
- data.tar.gz: b93c1b7a70090e50d1e0075fa88226ef05144d3e
3
+ metadata.gz: 15656f4e11baf2f9856b86a74309909f89f20471
4
+ data.tar.gz: 85595a972d43429af8c2ef17eff85440015a6330
5
5
  SHA512:
6
- metadata.gz: dd3a9f07be6cf222e3629227377436ec5233e8c0ebb9a26efe88dd1ca9a52eab46e6d42a20183c5a42fb8c209fb9d919bcd10358a64bc42b827f755693f6aeca
7
- data.tar.gz: b3cb3b3d54ccf930d8dc8c3a12be35a0ea949a92ed0e4cec7b577caa1b168a137322640f8fc131c1fb2d6f4c6d13a2e835dfb45beb0bdf17aa942e39d9858288
6
+ metadata.gz: 32788d21ca6ca4beac23076040b8c39e900970917fb986483b7285de61439a976dcbdd26ea3ebf323f8936756f655748cb648443c8b5f17651b958f42bf8df23
7
+ data.tar.gz: d57bce8e433e126d7ecbb78703e342e86cc20d56064e2a5bd390e562fd78b4aa0760f961f6e03289f02cf78ac6343d2efc13713b3b83fcb32afaa58cce7b6807
@@ -1,5 +1,5 @@
1
1
  module Esperanto
2
2
  module Source
3
- VERSION = '0.6.26'
3
+ VERSION = '0.6.27'
4
4
  end
5
5
  end
@@ -1,5 +1,5 @@
1
1
  /*
2
- esperanto.js v0.6.26 - 2015-04-03
2
+ esperanto.js v0.6.27 - 2015-04-16
3
3
  http://esperantojs.org
4
4
 
5
5
  Released under the MIT License.
@@ -147,9 +147,9 @@
147
147
  );
148
148
 
149
149
  return new src_SourceMap({
150
- file: options.file.split( /[\/\\]/ ).pop(),
150
+ file: ( options.file ? options.file.split( /[\/\\]/ ).pop() : null ),
151
151
  sources: this.sources.map( function ( source ) {
152
- return utils_getRelativePath__getRelativePath( options.file, source.filename );
152
+ return options.file ? utils_getRelativePath__getRelativePath( options.file, source.filename ) : source.filename;
153
153
  }),
154
154
  sourcesContent: this.sources.map( function ( source ) {
155
155
  return options.includeContent ? source.content.original : null;
@@ -558,7 +558,7 @@
558
558
  options = options || {};
559
559
 
560
560
  return new src_SourceMap({
561
- file: ( options.file ? options.file.split( '/' ).pop() : null ),
561
+ file: ( options.file ? options.file.split( /[\/\\]/ ).pop() : null ),
562
562
  sources: [ options.source ? utils_getRelativePath__getRelativePath( options.file || '', options.source ) : null ],
563
563
  sourcesContent: options.includeContent ? [ this.original ] : [ null ],
564
564
  names: [],
@@ -686,9 +686,7 @@
686
686
  throw new TypeError( 'inserted content must be a string' );
687
687
  }
688
688
 
689
- if ( index === 0 ) {
690
- this.prepend( content );
691
- } else if ( index === this.original.length ) {
689
+ if ( index === this.original.length ) {
692
690
  this.append( content );
693
691
  } else {
694
692
  var mapped = this.locate(index);
@@ -1501,11 +1499,20 @@
1501
1499
  var SOURCEMAPPINGURL_REGEX = /^# sourceMappingURL=/;
1502
1500
 
1503
1501
  function getStandaloneModule ( options ) {
1502
+ var code, ast;
1503
+
1504
+ if ( typeof options.source === 'object' ) {
1505
+ code = options.source.code;
1506
+ ast = options.source.ast;
1507
+ } else {
1508
+ code = options.source;
1509
+ }
1510
+
1504
1511
  var toRemove = [];
1505
1512
 
1506
1513
  var mod = {
1507
- body: new magic_string( options.source ),
1508
- ast: acorn.parse( options.source, {
1514
+ body: new magic_string( code ),
1515
+ ast: ast || ( acorn.parse( code, {
1509
1516
  ecmaVersion: 6,
1510
1517
  sourceType: 'module',
1511
1518
  onComment: function ( block, text, start, end ) {
@@ -1514,12 +1521,12 @@
1514
1521
  toRemove.push({ start: start, end: end });
1515
1522
  }
1516
1523
  }
1517
- })
1524
+ }))
1518
1525
  };
1519
1526
 
1520
1527
  toRemove.forEach( function(end) {var start = end.start, end = end.end;return mod.body.remove( start, end )} );
1521
1528
 
1522
- var imports = (exports = findImportsAndExports( mod, options.source, mod.ast ))[0], exports = exports[1];
1529
+ var imports = (exports = findImportsAndExports( mod, code, mod.ast ))[0], exports = exports[1];
1523
1530
 
1524
1531
  disallowConflictingImports( imports );
1525
1532
 
@@ -1839,7 +1846,7 @@
1839
1846
  return ids.length ? '[' + ids.map( quote ).join( ', ' ) + '], ' : '';
1840
1847
  }
1841
1848
 
1842
- function amdIntro (absolutePaths) {var name = absolutePaths.name, imports = absolutePaths.imports, hasExports = absolutePaths.hasExports, indentStr = absolutePaths.indentStr, absolutePaths = absolutePaths.absolutePaths;
1849
+ function amdIntro (useStrict) {var name = useStrict.name, imports = useStrict.imports, hasExports = useStrict.hasExports, indentStr = useStrict.indentStr, absolutePaths = useStrict.absolutePaths, useStrict = useStrict.useStrict;
1843
1850
  var ids = (names = getImportSummary({ name: name, imports: imports, absolutePaths: absolutePaths })).ids, names = names.names;
1844
1851
 
1845
1852
  if ( hasExports ) {
@@ -1850,11 +1857,13 @@
1850
1857
  var intro = (("\
1851
1858
  \ndefine(" + (processName(name))) + ("" + (processIds(ids))) + ("function (" + (names.join( ', ' ))) + ") {\
1852
1859
  \n\
1853
- \n 'use strict';\
1854
- \n\
1855
1860
  \n");
1856
1861
 
1857
- return intro.replace( /\t/g, indentStr );
1862
+ if ( useStrict ) {
1863
+ intro += (("" + indentStr) + "'use strict';\n\n");
1864
+ }
1865
+
1866
+ return intro;
1858
1867
  }
1859
1868
 
1860
1869
  function defaultsMode_amd__amd ( mod, options ) {
@@ -1868,7 +1877,8 @@
1868
1877
  name: options.amdName,
1869
1878
  imports: mod.imports,
1870
1879
  absolutePaths: options.absolutePaths,
1871
- indentStr: mod.body.getIndentString()
1880
+ indentStr: mod.body.getIndentString(),
1881
+ useStrict: options.useStrict !== false
1872
1882
  });
1873
1883
 
1874
1884
  mod.body.trim()
@@ -1910,21 +1920,24 @@
1910
1920
  }
1911
1921
  }
1912
1922
 
1913
- mod.body.prepend( "'use strict';\n\n" ).trimLines();
1923
+ if ( options.useStrict !== false ) {
1924
+ mod.body.prepend( "'use strict';\n\n" ).trimLines();
1925
+ }
1914
1926
 
1915
1927
  return packageResult( mod, mod.body, options, 'toCjs' );
1916
1928
  }
1917
1929
 
1918
- 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;
1930
+ function umdIntro (useStrict) {var amdName = useStrict.amdName, name = useStrict.name, hasExports = useStrict.hasExports, imports = useStrict.imports, absolutePaths = useStrict.absolutePaths, externalDefaults = useStrict.externalDefaults, indentStr = useStrict.indentStr, strict = useStrict.strict, useStrict = useStrict.useStrict;
1931
+ var useStrictPragma = useStrict ? (" 'use strict';") : '';
1919
1932
  var intro;
1920
1933
 
1921
1934
  if ( !hasExports && !imports.length ) {
1922
1935
  intro =
1923
1936
  (("(function (factory) {\
1924
1937
  \n !(typeof exports === 'object' && typeof module !== 'undefined') &&\
1925
- \n typeof define === 'function' && define.amd ? define(" + (processName(amdName))) + "factory) :\
1938
+ \n typeof define === 'function' && define.amd ? define(" + (processName(amdName))) + ("factory) :\
1926
1939
  \n factory()\
1927
- \n }(function () { 'use strict';\
1940
+ \n }(function () {" + useStrictPragma) + "\
1928
1941
  \n\
1929
1942
  \n ");
1930
1943
  }
@@ -1965,7 +1978,7 @@
1965
1978
  \n typeof exports === 'object' && typeof module !== 'undefined' ? " + cjsExport) + (" :\
1966
1979
  \n typeof define === 'function' && define.amd ? " + amdExport) + (" :\
1967
1980
  \n " + globalExport) + ("\
1968
- \n }(this, function (" + (names.join( ', ' ))) + (") { 'use strict';\
1981
+ \n }(this, function (" + (names.join( ', ' ))) + (") {" + useStrictPragma) + ("\
1969
1982
  \n\
1970
1983
  \n " + defaultsBlock) + "");
1971
1984
 
@@ -2014,7 +2027,8 @@
2014
2027
  amdName: options.amdName,
2015
2028
  absolutePaths: options.absolutePaths,
2016
2029
  name: options.name,
2017
- indentStr: mod.body.getIndentString()
2030
+ indentStr: mod.body.getIndentString(),
2031
+ useStrict: options.useStrict !== false
2018
2032
  });
2019
2033
 
2020
2034
  transformExportDeclaration( mod.exports[0], mod.body );
@@ -2363,7 +2377,8 @@
2363
2377
  absolutePaths: options.absolutePaths,
2364
2378
  imports: mod.imports,
2365
2379
  indentStr: mod.body.getIndentString(),
2366
- hasExports: mod.exports.length
2380
+ hasExports: mod.exports.length,
2381
+ useStrict: options.useStrict !== false
2367
2382
  });
2368
2383
 
2369
2384
  transformBody( mod, mod.body, {
@@ -2396,7 +2411,9 @@
2396
2411
  _evilES3SafeReExports: options._evilES3SafeReExports
2397
2412
  });
2398
2413
 
2399
- mod.body.prepend( "'use strict';\n\n" ).trimLines();
2414
+ if ( options.useStrict !== false ) {
2415
+ mod.body.prepend( "'use strict';\n\n" ).trimLines();
2416
+ }
2400
2417
 
2401
2418
  return packageResult( mod, mod.body, options, 'toCjs' );
2402
2419
  }
@@ -2411,7 +2428,8 @@
2411
2428
  absolutePaths: options.absolutePaths,
2412
2429
  name: options.name,
2413
2430
  indentStr: mod.body.getIndentString(),
2414
- strict: true
2431
+ strict: true,
2432
+ useStrict: options.useStrict !== false
2415
2433
  });
2416
2434
 
2417
2435
  transformBody( mod, mod.body, {
@@ -2444,7 +2462,8 @@
2444
2462
  var intro = amdIntro({
2445
2463
  name: options.amdName,
2446
2464
  imports: bundle.externalModules,
2447
- indentStr: bundle.body.getIndentString()
2465
+ indentStr: bundle.body.getIndentString(),
2466
+ useStrict: options.useStrict !== false
2448
2467
  });
2449
2468
 
2450
2469
  bundle.body.indent().prepend( intro ).trimLines().append( '\n\n});' );
@@ -2465,7 +2484,9 @@
2465
2484
  bundle.body.append( (("\n\nmodule.exports = " + defaultName) + ";") );
2466
2485
  }
2467
2486
 
2468
- bundle.body.prepend("'use strict';\n\n").trimLines();
2487
+ if ( options.useStrict !== false ) {
2488
+ bundle.body.prepend("'use strict';\n\n").trimLines();
2489
+ }
2469
2490
 
2470
2491
  return packageResult( bundle, bundle.body, options, 'toCjs', true );
2471
2492
  }
@@ -2480,7 +2501,8 @@
2480
2501
  imports: bundle.externalModules,
2481
2502
  amdName: options.amdName,
2482
2503
  name: options.name,
2483
- indentStr: bundle.body.getIndentString()
2504
+ indentStr: bundle.body.getIndentString(),
2505
+ useStrict: options.useStrict !== false
2484
2506
  });
2485
2507
 
2486
2508
  if ( entry.defaultExport ) {
@@ -2529,7 +2551,8 @@
2529
2551
  name: options.amdName,
2530
2552
  imports: bundle.externalModules,
2531
2553
  hasExports: entry.exports.length,
2532
- indentStr: bundle.body.getIndentString()
2554
+ indentStr: bundle.body.getIndentString(),
2555
+ useStrict: options.useStrict !== false
2533
2556
  });
2534
2557
 
2535
2558
  bundle.body.indent().prepend( intro ).trimLines().append( '\n\n});' );
@@ -2563,7 +2586,9 @@
2563
2586
  bundle.body.append( '\n\n' + getExportBlock( entry ) );
2564
2587
  }
2565
2588
 
2566
- bundle.body.prepend("'use strict';\n\n").trimLines();
2589
+ if ( options.useStrict !== false ) {
2590
+ bundle.body.prepend("'use strict';\n\n").trimLines();
2591
+ }
2567
2592
 
2568
2593
  return packageResult( bundle, bundle.body, options, 'toCjs', true );
2569
2594
  }
@@ -2580,7 +2605,8 @@
2580
2605
  amdName: options.amdName,
2581
2606
  name: options.name,
2582
2607
  indentStr: bundle.body.getIndentString(),
2583
- strict: true
2608
+ strict: true,
2609
+ useStrict: options.useStrict !== false
2584
2610
  });
2585
2611
 
2586
2612
  if ( entry.defaultExport ) {
data/vendor/esperanto.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*
2
- esperanto.js v0.6.26 - 2015-04-03
2
+ esperanto.js v0.6.27 - 2015-04-16
3
3
  http://esperantojs.org
4
4
 
5
5
  Released under the MIT License.
@@ -601,11 +601,20 @@ function splitPath ( path ) {
601
601
  var SOURCEMAPPINGURL_REGEX = /^# sourceMappingURL=/;
602
602
 
603
603
  function getStandaloneModule ( options ) {
604
+ var code, ast;
605
+
606
+ if ( typeof options.source === 'object' ) {
607
+ code = options.source.code;
608
+ ast = options.source.ast;
609
+ } else {
610
+ code = options.source;
611
+ }
612
+
604
613
  var toRemove = [];
605
614
 
606
615
  var mod = {
607
- body: new MagicString( options.source ),
608
- ast: acorn.parse( options.source, {
616
+ body: new MagicString( code ),
617
+ ast: ast || ( acorn.parse( code, {
609
618
  ecmaVersion: 6,
610
619
  sourceType: 'module',
611
620
  onComment: function ( block, text, start, end ) {
@@ -614,12 +623,12 @@ function getStandaloneModule ( options ) {
614
623
  toRemove.push({ start: start, end: end });
615
624
  }
616
625
  }
617
- })
626
+ }))
618
627
  };
619
628
 
620
629
  toRemove.forEach( function(end) {var start = end.start, end = end.end;return mod.body.remove( start, end )} );
621
630
 
622
- var imports = (exports = findImportsAndExports( mod, options.source, mod.ast ))[0], exports = exports[1];
631
+ var imports = (exports = findImportsAndExports( mod, code, mod.ast ))[0], exports = exports[1];
623
632
 
624
633
  disallowConflictingImports( imports );
625
634
 
@@ -1444,12 +1453,12 @@ function combine ( bundle ) {
1444
1453
  }
1445
1454
 
1446
1455
  function getModule ( mod ) {
1447
- mod.body = new MagicString( mod.source );
1456
+ mod.body = new MagicString( mod.code );
1448
1457
 
1449
1458
  var toRemove = [];
1450
1459
 
1451
1460
  try {
1452
- mod.ast = acorn.parse( mod.source, {
1461
+ mod.ast = mod.ast || ( acorn.parse( mod.code, {
1453
1462
  ecmaVersion: 6,
1454
1463
  sourceType: 'module',
1455
1464
  onComment: function ( block, text, start, end ) {
@@ -1458,7 +1467,7 @@ function getModule ( mod ) {
1458
1467
  toRemove.push({ start: start, end: end });
1459
1468
  }
1460
1469
  }
1461
- });
1470
+ }));
1462
1471
 
1463
1472
  toRemove.forEach( function(end) {var start = end.start, end = end.end;return mod.body.remove( start, end )} );
1464
1473
  annotateAst( mod.ast );
@@ -1472,7 +1481,7 @@ function getModule ( mod ) {
1472
1481
  throw err;
1473
1482
  }
1474
1483
 
1475
- var imports = (exports = findImportsAndExports( mod, mod.source, mod.ast ))[0], exports = exports[1];
1484
+ var imports = (exports = findImportsAndExports( mod, mod.code, mod.ast ))[0], exports = exports[1];
1476
1485
 
1477
1486
  disallowConflictingImports( imports );
1478
1487
 
@@ -1514,6 +1523,7 @@ var bundler_getBundle__Promise = sander.Promise;
1514
1523
 
1515
1524
  function getBundle ( options ) {
1516
1525
  var entry = options.entry.replace( /\.js$/, '' );
1526
+ var userModules = options.modules || {};
1517
1527
  var modules = [];
1518
1528
  var moduleLookup = {};
1519
1529
  var promiseByPath = {};
@@ -1527,8 +1537,8 @@ function getBundle ( options ) {
1527
1537
  entry = entry.substring( base.length );
1528
1538
  }
1529
1539
 
1530
- return resolvePath( base, entry, null ).then( function(entryPath ) {
1531
- return fetchModule( entry, entryPath ).then( function() {
1540
+ return resolvePath( base, userModules, entry, null ).then( function(relativePath ) {
1541
+ return fetchModule( entry, relativePath ).then( function() {
1532
1542
  var entryModule = moduleLookup[ entry ];
1533
1543
  modules = sortModules( entryModule, moduleLookup ); // TODO is this necessary? surely it's already sorted because of the fetch order? or do we need to prevent parallel reads?
1534
1544
 
@@ -1557,30 +1567,46 @@ function getBundle ( options ) {
1557
1567
  throw err;
1558
1568
  });
1559
1569
 
1560
- function fetchModule ( moduleId, modulePath ) {
1561
- if ( !utils_hasOwnProp.call( promiseByPath, modulePath ) ) {
1562
- promiseByPath[ modulePath ] = sander.readFile( modulePath ).then( String ).then( function ( source ) {
1563
- var module, promises;
1570
+ function fetchModule ( moduleId, relativePath ) {
1571
+ var absolutePath = _path.resolve( base, relativePath );
1572
+
1573
+ if ( !utils_hasOwnProp.call( promiseByPath, relativePath ) ) {
1574
+ promiseByPath[ relativePath ] = (
1575
+ utils_hasOwnProp.call( userModules, relativePath ) ?
1576
+ bundler_getBundle__Promise.resolve( userModules[ relativePath ] ) :
1577
+ sander.readFile( absolutePath ).then( String )
1578
+ ).then( function ( source ) {
1579
+ var code, ast;
1580
+
1581
+ // normalise
1582
+ if ( typeof source === 'object' ) {
1583
+ code = source.code;
1584
+ ast = source.ast;
1585
+ } else {
1586
+ code = source;
1587
+ ast = null;
1588
+ }
1564
1589
 
1565
1590
  if ( options.transform ) {
1566
- source = options.transform( source, modulePath );
1591
+ code = options.transform( code, absolutePath );
1567
1592
 
1568
- if ( typeof source !== 'string' && !isThenable( source ) ) {
1593
+ if ( typeof code !== 'string' && !isThenable( code ) ) {
1569
1594
  throw new Error( 'transform should return String or Promise' );
1570
1595
  }
1571
1596
  }
1572
1597
 
1573
- module = getModule({
1574
- source: source,
1598
+ var module = getModule({
1575
1599
  id: moduleId,
1576
- relativePath: _path.relative( base, modulePath ),
1577
- path: modulePath
1600
+ path: absolutePath,
1601
+ code: code,
1602
+ ast: ast,
1603
+ relativePath: relativePath
1578
1604
  });
1579
1605
 
1580
1606
  modules.push( module );
1581
1607
  moduleLookup[ moduleId ] = module;
1582
1608
 
1583
- promises = module.imports.map( function(x ) {
1609
+ var promises = module.imports.map( function(x ) {
1584
1610
  x.id = resolveId( x.path, module.relativePath );
1585
1611
 
1586
1612
  if ( x.id === moduleId ) {
@@ -1592,13 +1618,13 @@ function getBundle ( options ) {
1592
1618
  return;
1593
1619
  }
1594
1620
 
1595
- return resolvePath( base, x.id, modulePath, options.resolvePath ).then( function(modulePath ) {
1621
+ return resolvePath( base, userModules, x.id, absolutePath, options.resolvePath ).then( function(relativePath ) {
1596
1622
  // short-circuit cycles
1597
- if ( utils_hasOwnProp.call( promiseByPath, modulePath ) ) {
1623
+ if ( utils_hasOwnProp.call( promiseByPath, relativePath ) ) {
1598
1624
  return;
1599
1625
  }
1600
1626
 
1601
- return fetchModule( x.id, modulePath );
1627
+ return fetchModule( x.id, relativePath );
1602
1628
  }, function handleError ( err ) {
1603
1629
  if ( err.code === 'ENOENT' ) {
1604
1630
  // Most likely an external module
@@ -1620,13 +1646,13 @@ function getBundle ( options ) {
1620
1646
  });
1621
1647
  }
1622
1648
 
1623
- return promiseByPath[ modulePath ];
1649
+ return promiseByPath[ relativePath ];
1624
1650
  }
1625
1651
  }
1626
1652
 
1627
- function resolvePath ( base, moduleId, importerPath, resolver ) {
1628
- return tryPath( _path.resolve( base, moduleId + '.js' ) )
1629
- .catch( function() {return tryPath( _path.resolve( base, moduleId, 'index.js' ) )} )
1653
+ function resolvePath ( base, userModules, moduleId, importerPath, resolver ) {
1654
+ return tryPath( base, moduleId + '.js', userModules )
1655
+ .catch( function() {return tryPath( base, moduleId + _path.sep + 'index.js', userModules )} )
1630
1656
  .catch( function ( err ) {
1631
1657
  if ( resolver ) {
1632
1658
  return resolver( moduleId, importerPath );
@@ -1636,8 +1662,11 @@ function resolvePath ( base, moduleId, importerPath, resolver ) {
1636
1662
  });
1637
1663
  }
1638
1664
 
1639
- function tryPath ( path ) {
1640
- return sander.stat( path ).then( function() {return path} );
1665
+ function tryPath ( base, filename, userModules ) {
1666
+ if ( utils_hasOwnProp.call( userModules, filename ) ) {
1667
+ return bundler_getBundle__Promise.resolve( filename );
1668
+ }
1669
+ return sander.stat( base, filename ).then( function() {return filename} );
1641
1670
  }
1642
1671
 
1643
1672
  function isThenable ( obj ) {
@@ -1838,7 +1867,7 @@ function processIds ( ids ) {
1838
1867
  return ids.length ? '[' + ids.map( quote ).join( ', ' ) + '], ' : '';
1839
1868
  }
1840
1869
 
1841
- function amdIntro (absolutePaths) {var name = absolutePaths.name, imports = absolutePaths.imports, hasExports = absolutePaths.hasExports, indentStr = absolutePaths.indentStr, absolutePaths = absolutePaths.absolutePaths;
1870
+ function amdIntro (useStrict) {var name = useStrict.name, imports = useStrict.imports, hasExports = useStrict.hasExports, indentStr = useStrict.indentStr, absolutePaths = useStrict.absolutePaths, useStrict = useStrict.useStrict;
1842
1871
  var ids = (names = getImportSummary({ name: name, imports: imports, absolutePaths: absolutePaths })).ids, names = names.names;
1843
1872
 
1844
1873
  if ( hasExports ) {
@@ -1849,11 +1878,13 @@ function amdIntro (absolutePaths) {var name = absolutePaths.name, imports = abso
1849
1878
  var intro = (("\
1850
1879
  \ndefine(" + (processName(name))) + ("" + (processIds(ids))) + ("function (" + (names.join( ', ' ))) + ") {\
1851
1880
  \n\
1852
- \n 'use strict';\
1853
- \n\
1854
1881
  \n");
1855
1882
 
1856
- return intro.replace( /\t/g, indentStr );
1883
+ if ( useStrict ) {
1884
+ intro += (("" + indentStr) + "'use strict';\n\n");
1885
+ }
1886
+
1887
+ return intro;
1857
1888
  }
1858
1889
 
1859
1890
  function defaultsMode_amd__amd ( mod, options ) {
@@ -1867,7 +1898,8 @@ function defaultsMode_amd__amd ( mod, options ) {
1867
1898
  name: options.amdName,
1868
1899
  imports: mod.imports,
1869
1900
  absolutePaths: options.absolutePaths,
1870
- indentStr: mod.body.getIndentString()
1901
+ indentStr: mod.body.getIndentString(),
1902
+ useStrict: options.useStrict !== false
1871
1903
  });
1872
1904
 
1873
1905
  mod.body.trim()
@@ -1909,21 +1941,24 @@ function defaultsMode_cjs__cjs ( mod, options ) {
1909
1941
  }
1910
1942
  }
1911
1943
 
1912
- mod.body.prepend( "'use strict';\n\n" ).trimLines();
1944
+ if ( options.useStrict !== false ) {
1945
+ mod.body.prepend( "'use strict';\n\n" ).trimLines();
1946
+ }
1913
1947
 
1914
1948
  return packageResult( mod, mod.body, options, 'toCjs' );
1915
1949
  }
1916
1950
 
1917
- 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;
1951
+ function umdIntro (useStrict) {var amdName = useStrict.amdName, name = useStrict.name, hasExports = useStrict.hasExports, imports = useStrict.imports, absolutePaths = useStrict.absolutePaths, externalDefaults = useStrict.externalDefaults, indentStr = useStrict.indentStr, strict = useStrict.strict, useStrict = useStrict.useStrict;
1952
+ var useStrictPragma = useStrict ? (" 'use strict';") : '';
1918
1953
  var intro;
1919
1954
 
1920
1955
  if ( !hasExports && !imports.length ) {
1921
1956
  intro =
1922
1957
  (("(function (factory) {\
1923
1958
  \n !(typeof exports === 'object' && typeof module !== 'undefined') &&\
1924
- \n typeof define === 'function' && define.amd ? define(" + (processName(amdName))) + "factory) :\
1959
+ \n typeof define === 'function' && define.amd ? define(" + (processName(amdName))) + ("factory) :\
1925
1960
  \n factory()\
1926
- \n }(function () { 'use strict';\
1961
+ \n }(function () {" + useStrictPragma) + "\
1927
1962
  \n\
1928
1963
  \n ");
1929
1964
  }
@@ -1964,7 +1999,7 @@ function umdIntro (strict) {var amdName = strict.amdName, name = strict.name, ha
1964
1999
  \n typeof exports === 'object' && typeof module !== 'undefined' ? " + cjsExport) + (" :\
1965
2000
  \n typeof define === 'function' && define.amd ? " + amdExport) + (" :\
1966
2001
  \n " + globalExport) + ("\
1967
- \n }(this, function (" + (names.join( ', ' ))) + (") { 'use strict';\
2002
+ \n }(this, function (" + (names.join( ', ' ))) + (") {" + useStrictPragma) + ("\
1968
2003
  \n\
1969
2004
  \n " + defaultsBlock) + "");
1970
2005
 
@@ -2013,7 +2048,8 @@ function defaultsMode_umd__umd ( mod, options ) {
2013
2048
  amdName: options.amdName,
2014
2049
  absolutePaths: options.absolutePaths,
2015
2050
  name: options.name,
2016
- indentStr: mod.body.getIndentString()
2051
+ indentStr: mod.body.getIndentString(),
2052
+ useStrict: options.useStrict !== false
2017
2053
  });
2018
2054
 
2019
2055
  transformExportDeclaration( mod.exports[0], mod.body );
@@ -2176,7 +2212,8 @@ function strictMode_amd__amd ( mod, options ) {
2176
2212
  absolutePaths: options.absolutePaths,
2177
2213
  imports: mod.imports,
2178
2214
  indentStr: mod.body.getIndentString(),
2179
- hasExports: mod.exports.length
2215
+ hasExports: mod.exports.length,
2216
+ useStrict: options.useStrict !== false
2180
2217
  });
2181
2218
 
2182
2219
  utils_transformBody__transformBody( mod, mod.body, {
@@ -2209,7 +2246,9 @@ function strictMode_cjs__cjs ( mod, options ) {
2209
2246
  _evilES3SafeReExports: options._evilES3SafeReExports
2210
2247
  });
2211
2248
 
2212
- mod.body.prepend( "'use strict';\n\n" ).trimLines();
2249
+ if ( options.useStrict !== false ) {
2250
+ mod.body.prepend( "'use strict';\n\n" ).trimLines();
2251
+ }
2213
2252
 
2214
2253
  return packageResult( mod, mod.body, options, 'toCjs' );
2215
2254
  }
@@ -2224,7 +2263,8 @@ function strictMode_umd__umd ( mod, options ) {
2224
2263
  absolutePaths: options.absolutePaths,
2225
2264
  name: options.name,
2226
2265
  indentStr: mod.body.getIndentString(),
2227
- strict: true
2266
+ strict: true,
2267
+ useStrict: options.useStrict !== false
2228
2268
  });
2229
2269
 
2230
2270
  utils_transformBody__transformBody( mod, mod.body, {
@@ -2257,7 +2297,8 @@ function builders_defaultsMode_amd__amd ( bundle, options ) {
2257
2297
  var intro = amdIntro({
2258
2298
  name: options.amdName,
2259
2299
  imports: bundle.externalModules,
2260
- indentStr: bundle.body.getIndentString()
2300
+ indentStr: bundle.body.getIndentString(),
2301
+ useStrict: options.useStrict !== false
2261
2302
  });
2262
2303
 
2263
2304
  bundle.body.indent().prepend( intro ).trimLines().append( '\n\n});' );
@@ -2278,7 +2319,9 @@ function builders_defaultsMode_cjs__cjs ( bundle, options ) {
2278
2319
  bundle.body.append( (("\n\nmodule.exports = " + defaultName) + ";") );
2279
2320
  }
2280
2321
 
2281
- bundle.body.prepend("'use strict';\n\n").trimLines();
2322
+ if ( options.useStrict !== false ) {
2323
+ bundle.body.prepend("'use strict';\n\n").trimLines();
2324
+ }
2282
2325
 
2283
2326
  return packageResult( bundle, bundle.body, options, 'toCjs', true );
2284
2327
  }
@@ -2293,7 +2336,8 @@ function builders_defaultsMode_umd__umd ( bundle, options ) {
2293
2336
  imports: bundle.externalModules,
2294
2337
  amdName: options.amdName,
2295
2338
  name: options.name,
2296
- indentStr: bundle.body.getIndentString()
2339
+ indentStr: bundle.body.getIndentString(),
2340
+ useStrict: options.useStrict !== false
2297
2341
  });
2298
2342
 
2299
2343
  if ( entry.defaultExport ) {
@@ -2342,7 +2386,8 @@ function builders_strictMode_amd__amd ( bundle, options ) {
2342
2386
  name: options.amdName,
2343
2387
  imports: bundle.externalModules,
2344
2388
  hasExports: entry.exports.length,
2345
- indentStr: bundle.body.getIndentString()
2389
+ indentStr: bundle.body.getIndentString(),
2390
+ useStrict: options.useStrict !== false
2346
2391
  });
2347
2392
 
2348
2393
  bundle.body.indent().prepend( intro ).trimLines().append( '\n\n});' );
@@ -2376,7 +2421,9 @@ function builders_strictMode_cjs__cjs ( bundle, options ) {
2376
2421
  bundle.body.append( '\n\n' + getExportBlock( entry ) );
2377
2422
  }
2378
2423
 
2379
- bundle.body.prepend("'use strict';\n\n").trimLines();
2424
+ if ( options.useStrict !== false ) {
2425
+ bundle.body.prepend("'use strict';\n\n").trimLines();
2426
+ }
2380
2427
 
2381
2428
  return packageResult( bundle, bundle.body, options, 'toCjs', true );
2382
2429
  }
@@ -2393,7 +2440,8 @@ function builders_strictMode_umd__umd ( bundle, options ) {
2393
2440
  amdName: options.amdName,
2394
2441
  name: options.name,
2395
2442
  indentStr: bundle.body.getIndentString(),
2396
- strict: true
2443
+ strict: true,
2444
+ useStrict: options.useStrict !== false
2397
2445
  });
2398
2446
 
2399
2447
  if ( entry.defaultExport ) {
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: esperanto-source
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.26
4
+ version: 0.6.27
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryunosuke SATO
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-04-07 00:00:00.000000000 Z
11
+ date: 2015-04-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler