esperanto-source 0.6.16 → 0.6.17
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/esperanto/source/version.rb +1 -1
- data/vendor/esperanto.browser.js +112 -88
- data/vendor/esperanto.js +99 -79
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4e7da637ba9ff5b37efcc590d016cce3cdac9894
|
4
|
+
data.tar.gz: 43618b690433711be54869fa3072d9b22e01d65e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 23b5ac1323f08b6e5e4075342ddcaef5e07d358624aa3d2983f58e0b5422f2794b41020c6a288406cbb6fc65c68f80892e4df8f59bb58ba993fb0d36127b66d6
|
7
|
+
data.tar.gz: 0b14cd2c7c4d1c0f5bcc677a76802b9efdc5ca56b7f0a5282989ad96a7f849f857ed1277d7fdd711b015e51f19880cab1f650f5301691c91f83ae3e342c8350f
|
data/vendor/esperanto.browser.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
/*
|
2
|
-
esperanto.js v0.6.
|
2
|
+
esperanto.js v0.6.17 - 2015-03-01
|
3
3
|
http://esperantojs.org
|
4
4
|
|
5
5
|
Released under the MIT License.
|
@@ -342,17 +342,15 @@
|
|
342
342
|
}
|
343
343
|
|
344
344
|
function encode ( value ) {
|
345
|
-
var result;
|
345
|
+
var result, i;
|
346
346
|
|
347
347
|
if ( typeof value === 'number' ) {
|
348
348
|
result = encodeInteger( value );
|
349
|
-
} else if ( Array.isArray( value ) ) {
|
350
|
-
result = '';
|
351
|
-
value.forEach( function ( num ) {
|
352
|
-
result += encodeInteger( num );
|
353
|
-
});
|
354
349
|
} else {
|
355
|
-
|
350
|
+
result = '';
|
351
|
+
for ( i = 0; i < value.length; i += 1 ) {
|
352
|
+
result += encodeInteger( value[i] );
|
353
|
+
}
|
356
354
|
}
|
357
355
|
|
358
356
|
return result;
|
@@ -383,7 +381,7 @@
|
|
383
381
|
|
384
382
|
var encode__default = encode;
|
385
383
|
|
386
|
-
function encodeMappings ( original, str, mappings, hires, sourceIndex, offsets ) {
|
384
|
+
function encodeMappings ( original, str, mappings, hires, sourcemapLocations, sourceIndex, offsets ) {
|
387
385
|
var lineStart,
|
388
386
|
locations,
|
389
387
|
lines,
|
@@ -427,7 +425,7 @@
|
|
427
425
|
}
|
428
426
|
|
429
427
|
else {
|
430
|
-
if ( !hires && ( origin === lastOrigin + 1 ) ) {
|
428
|
+
if ( !hires && ( origin === lastOrigin + 1 ) && !sourcemapLocations[ origin ] ) {
|
431
429
|
// do nothing
|
432
430
|
} else {
|
433
431
|
location = getLocation( locations, origin );
|
@@ -520,10 +518,16 @@
|
|
520
518
|
this.original = this.str = string;
|
521
519
|
this.mappings = initMappings( string.length );
|
522
520
|
|
521
|
+
this.sourcemapLocations = {};
|
522
|
+
|
523
523
|
this.indentStr = guessIndent( string );
|
524
524
|
};
|
525
525
|
|
526
526
|
MagicString.prototype = {
|
527
|
+
addSourcemapLocation: function ( char ) {
|
528
|
+
this.sourcemapLocations[ char ] = true;
|
529
|
+
},
|
530
|
+
|
527
531
|
append: function ( content ) {
|
528
532
|
this.str += content;
|
529
533
|
return this;
|
@@ -560,7 +564,7 @@
|
|
560
564
|
},
|
561
565
|
|
562
566
|
getMappings: function ( hires, sourceIndex, offsets ) {
|
563
|
-
return encodeMappings( this.original, this.str, this.mappings, hires, sourceIndex, offsets );
|
567
|
+
return encodeMappings( this.original, this.str, this.mappings, hires, this.sourcemapLocations, sourceIndex, offsets );
|
564
568
|
},
|
565
569
|
|
566
570
|
indent: function ( indentStr, options ) {
|
@@ -1489,7 +1493,7 @@
|
|
1489
1493
|
|
1490
1494
|
var warned = {};
|
1491
1495
|
|
1492
|
-
function packageResult ( body, options, methodName, isBundle ) {
|
1496
|
+
function packageResult ( bundleOrModule, body, options, methodName, isBundle ) {
|
1493
1497
|
var code, map;
|
1494
1498
|
|
1495
1499
|
// wrap output
|
@@ -1514,9 +1518,14 @@
|
|
1514
1518
|
sourceMapFile = isAbsolutePath( options.sourceMapFile ) ? options.sourceMapFile : './' + splitPath( options.sourceMapFile ).pop();
|
1515
1519
|
}
|
1516
1520
|
|
1521
|
+
if ( isBundle ) {
|
1522
|
+
markBundleSourcemapLocations( bundleOrModule );
|
1523
|
+
} else {
|
1524
|
+
markModuleSourcemapLocations( bundleOrModule );
|
1525
|
+
}
|
1526
|
+
|
1517
1527
|
map = body.generateMap({
|
1518
1528
|
includeContent: true,
|
1519
|
-
hires: true,
|
1520
1529
|
file: sourceMapFile,
|
1521
1530
|
source: (sourceMapFile && !isBundle) ? packageResult__getRelativePath( sourceMapFile, options.sourceMapSource ) : null
|
1522
1531
|
});
|
@@ -1573,6 +1582,24 @@
|
|
1573
1582
|
}
|
1574
1583
|
}
|
1575
1584
|
|
1585
|
+
function markBundleSourcemapLocations ( bundle ) {
|
1586
|
+
bundle.modules.forEach( function(mod ) {
|
1587
|
+
estraverse.traverse( mod.ast, {
|
1588
|
+
enter: function(node ) {
|
1589
|
+
mod.body.addSourcemapLocation( node.start );
|
1590
|
+
}
|
1591
|
+
});
|
1592
|
+
})
|
1593
|
+
}
|
1594
|
+
|
1595
|
+
function markModuleSourcemapLocations ( mod ) {
|
1596
|
+
estraverse.traverse( mod.ast, {
|
1597
|
+
enter: function(node ) {
|
1598
|
+
mod.body.addSourcemapLocation( node.start );
|
1599
|
+
}
|
1600
|
+
});
|
1601
|
+
}
|
1602
|
+
|
1576
1603
|
/**
|
1577
1604
|
* Creates a template function from a template string. The template
|
1578
1605
|
may have `<%= someVar %>` interpolators, and the returned function
|
@@ -1649,7 +1676,7 @@
|
|
1649
1676
|
|
1650
1677
|
var amd__introTemplate = template( 'define(<%= amdName %><%= paths %>function (<%= names %>) {\n\n' );
|
1651
1678
|
|
1652
|
-
function amd__amd ( mod,
|
1679
|
+
function amd__amd ( mod, options ) {
|
1653
1680
|
var seen = {},
|
1654
1681
|
importNames = [],
|
1655
1682
|
importPaths = [],
|
@@ -1676,10 +1703,10 @@
|
|
1676
1703
|
seen[ path ] = true;
|
1677
1704
|
}
|
1678
1705
|
|
1679
|
-
body.remove( x.start, x.next );
|
1706
|
+
mod.body.remove( x.start, x.next );
|
1680
1707
|
});
|
1681
1708
|
|
1682
|
-
transformExportDeclaration( mod.exports[0], body );
|
1709
|
+
transformExportDeclaration( mod.exports[0], mod.body );
|
1683
1710
|
|
1684
1711
|
intro = amd__introTemplate({
|
1685
1712
|
amdName: options.amdName ? (("'" + (options.amdName)) + "', ") : '',
|
@@ -1687,27 +1714,27 @@
|
|
1687
1714
|
names: importNames.join( ', ' )
|
1688
1715
|
});
|
1689
1716
|
|
1690
|
-
body.trim()
|
1717
|
+
mod.body.trim()
|
1691
1718
|
.prepend( "'use strict';\n\n" )
|
1692
1719
|
.trim()
|
1693
1720
|
.indent()
|
1694
1721
|
.prepend( intro )
|
1695
1722
|
.append( '\n\n});' );
|
1696
1723
|
|
1697
|
-
return packageResult( body, options, 'toAmd' );
|
1724
|
+
return packageResult( mod, mod.body, options, 'toAmd' );
|
1698
1725
|
}
|
1699
1726
|
|
1700
|
-
function cjs__cjs ( mod,
|
1727
|
+
function cjs__cjs ( mod, options ) {
|
1701
1728
|
var seen = {}, exportDeclaration;
|
1702
1729
|
|
1703
1730
|
mod.imports.forEach( function(x ) {
|
1704
1731
|
if ( !hasOwnProp.call( seen, x.path ) ) {
|
1705
1732
|
var replacement = x.isEmpty ? (("" + (req(x.path))) + ";") : (("var " + (x.as)) + (" = " + (req(x.path))) + ";");
|
1706
|
-
body.replace( x.start, x.end, replacement );
|
1733
|
+
mod.body.replace( x.start, x.end, replacement );
|
1707
1734
|
|
1708
1735
|
seen[ x.path ] = true;
|
1709
1736
|
} else {
|
1710
|
-
body.remove( x.start, x.next );
|
1737
|
+
mod.body.remove( x.start, x.next );
|
1711
1738
|
}
|
1712
1739
|
});
|
1713
1740
|
|
@@ -1717,14 +1744,14 @@
|
|
1717
1744
|
switch ( exportDeclaration.type ) {
|
1718
1745
|
case 'namedFunction':
|
1719
1746
|
case 'namedClass':
|
1720
|
-
body.remove( exportDeclaration.start, exportDeclaration.valueStart );
|
1721
|
-
body.replace( exportDeclaration.end, exportDeclaration.end, (("\nmodule.exports = " + (exportDeclaration.node.declaration.id.name)) + ";") );
|
1747
|
+
mod.body.remove( exportDeclaration.start, exportDeclaration.valueStart );
|
1748
|
+
mod.body.replace( exportDeclaration.end, exportDeclaration.end, (("\nmodule.exports = " + (exportDeclaration.node.declaration.id.name)) + ";") );
|
1722
1749
|
break;
|
1723
1750
|
|
1724
1751
|
case 'anonFunction':
|
1725
1752
|
case 'anonClass':
|
1726
1753
|
case 'expression':
|
1727
|
-
body.replace( exportDeclaration.start, exportDeclaration.valueStart, 'module.exports = ' );
|
1754
|
+
mod.body.replace( exportDeclaration.start, exportDeclaration.valueStart, 'module.exports = ' );
|
1728
1755
|
break;
|
1729
1756
|
|
1730
1757
|
default:
|
@@ -1732,9 +1759,9 @@
|
|
1732
1759
|
}
|
1733
1760
|
}
|
1734
1761
|
|
1735
|
-
body.prepend( "'use strict';\n\n" ).trimLines();
|
1762
|
+
mod.body.prepend( "'use strict';\n\n" ).trimLines();
|
1736
1763
|
|
1737
|
-
return packageResult( body, options, 'toCjs' );
|
1764
|
+
return packageResult( mod, mod.body, options, 'toCjs' );
|
1738
1765
|
}
|
1739
1766
|
|
1740
1767
|
function standaloneUmdIntro ( options, indentStr ) {
|
@@ -1811,7 +1838,7 @@
|
|
1811
1838
|
}
|
1812
1839
|
}
|
1813
1840
|
|
1814
|
-
function umd__umd ( mod,
|
1841
|
+
function umd__umd ( mod, options ) {
|
1815
1842
|
var importNames = [];
|
1816
1843
|
var importPaths = [];
|
1817
1844
|
var seen = {};
|
@@ -1826,7 +1853,7 @@
|
|
1826
1853
|
if (!hasImports && !hasExports) {
|
1827
1854
|
intro = standaloneUmdIntro({
|
1828
1855
|
amdName: options.amdName,
|
1829
|
-
}, body.getIndentString() );
|
1856
|
+
}, mod.body.getIndentString() );
|
1830
1857
|
} else {
|
1831
1858
|
// gather imports, and remove import declarations
|
1832
1859
|
mod.imports.forEach( function(x ) {
|
@@ -1846,10 +1873,10 @@
|
|
1846
1873
|
seen[ x.path ] = true;
|
1847
1874
|
}
|
1848
1875
|
|
1849
|
-
body.remove( x.start, x.next );
|
1876
|
+
mod.body.remove( x.start, x.next );
|
1850
1877
|
});
|
1851
1878
|
|
1852
|
-
transformExportDeclaration( mod.exports[0], body );
|
1879
|
+
transformExportDeclaration( mod.exports[0], mod.body );
|
1853
1880
|
|
1854
1881
|
intro = defaultUmdIntro({
|
1855
1882
|
hasExports: hasExports,
|
@@ -1858,12 +1885,12 @@
|
|
1858
1885
|
amdName: options.amdName,
|
1859
1886
|
absolutePaths: options.absolutePaths,
|
1860
1887
|
name: options.name
|
1861
|
-
}, body.getIndentString() );
|
1888
|
+
}, mod.body.getIndentString() );
|
1862
1889
|
}
|
1863
1890
|
|
1864
|
-
body.indent().prepend( intro ).trimLines().append( '\n\n}));' );
|
1891
|
+
mod.body.indent().prepend( intro ).trimLines().append( '\n\n}));' );
|
1865
1892
|
|
1866
|
-
return packageResult( body, options, 'toUmd' );
|
1893
|
+
return packageResult( mod, mod.body, options, 'toUmd' );
|
1867
1894
|
}
|
1868
1895
|
|
1869
1896
|
var defaultsMode = {
|
@@ -2245,7 +2272,7 @@
|
|
2245
2272
|
|
2246
2273
|
strictMode_amd__introTemplate = template( 'define(<%= amdName %><%= paths %>function (<%= names %>) {\n\n\t\'use strict\';\n\n' );
|
2247
2274
|
|
2248
|
-
function strictMode_amd__amd ( mod,
|
2275
|
+
function strictMode_amd__amd ( mod, options ) {var $D$2;
|
2249
2276
|
var importPaths,
|
2250
2277
|
importNames,
|
2251
2278
|
intro;
|
@@ -2261,18 +2288,18 @@
|
|
2261
2288
|
amdName: options.amdName ? (("'" + (options.amdName)) + "', ") : '',
|
2262
2289
|
paths: importPaths.length ? '[' + ( options.absolutePaths ? importPaths.map( resolveAgainst( options.amdName ) ) : importPaths ).map( quote ).join( ', ' ) + '], ' : '',
|
2263
2290
|
names: importNames.join( ', ' )
|
2264
|
-
}).replace( /\t/g, body.getIndentString() );
|
2291
|
+
}).replace( /\t/g, mod.body.getIndentString() );
|
2265
2292
|
|
2266
|
-
transformBody( mod, body, {
|
2293
|
+
transformBody( mod, mod.body, {
|
2267
2294
|
intro: intro,
|
2268
2295
|
outro: '\n\n});',
|
2269
2296
|
_evilES3SafeReExports: options._evilES3SafeReExports
|
2270
2297
|
});
|
2271
2298
|
|
2272
|
-
return packageResult( body, options, 'toAmd' );
|
2299
|
+
return packageResult( mod, mod.body, options, 'toAmd' );
|
2273
2300
|
;$D$2 = void 0}
|
2274
2301
|
|
2275
|
-
function strictMode_cjs__cjs ( mod,
|
2302
|
+
function strictMode_cjs__cjs ( mod, options ) {
|
2276
2303
|
var importBlock, seen = {};
|
2277
2304
|
|
2278
2305
|
// Create block of require statements
|
@@ -2292,14 +2319,14 @@
|
|
2292
2319
|
return replacement;
|
2293
2320
|
}).filter( Boolean ).join( '\n' );
|
2294
2321
|
|
2295
|
-
transformBody( mod, body, {
|
2322
|
+
transformBody( mod, mod.body, {
|
2296
2323
|
header: importBlock,
|
2297
2324
|
_evilES3SafeReExports: options._evilES3SafeReExports
|
2298
2325
|
});
|
2299
2326
|
|
2300
|
-
body.prepend( "'use strict';\n\n" ).trimLines();
|
2327
|
+
mod.body.prepend( "'use strict';\n\n" ).trimLines();
|
2301
2328
|
|
2302
|
-
return packageResult( body, options, 'toCjs' );
|
2329
|
+
return packageResult( mod, mod.body, options, 'toCjs' );
|
2303
2330
|
}
|
2304
2331
|
|
2305
2332
|
function strictUmdIntro ( options, indentStr ) {
|
@@ -2338,7 +2365,7 @@
|
|
2338
2365
|
return intro.replace( /\t/g, indentStr );
|
2339
2366
|
}
|
2340
2367
|
|
2341
|
-
function strictMode_umd__umd ( mod,
|
2368
|
+
function strictMode_umd__umd ( mod, options ) {
|
2342
2369
|
requireName( options );
|
2343
2370
|
|
2344
2371
|
var importPaths = (importNames = getImportSummary( mod ))[0], importNames = importNames[1];
|
@@ -2350,7 +2377,7 @@
|
|
2350
2377
|
if (!hasImports && !hasExports) {
|
2351
2378
|
intro = standaloneUmdIntro({
|
2352
2379
|
amdName: options.amdName,
|
2353
|
-
}, body.getIndentString() );
|
2380
|
+
}, mod.body.getIndentString() );
|
2354
2381
|
} else {
|
2355
2382
|
intro = strictUmdIntro({
|
2356
2383
|
hasExports: hasExports,
|
@@ -2359,16 +2386,16 @@
|
|
2359
2386
|
amdName: options.amdName,
|
2360
2387
|
absolutePaths: options.absolutePaths,
|
2361
2388
|
name: options.name
|
2362
|
-
}, body.getIndentString() );
|
2389
|
+
}, mod.body.getIndentString() );
|
2363
2390
|
}
|
2364
2391
|
|
2365
|
-
transformBody( mod, body, {
|
2392
|
+
transformBody( mod, mod.body, {
|
2366
2393
|
intro: intro,
|
2367
2394
|
outro: '\n\n}));',
|
2368
2395
|
_evilES3SafeReExports: options._evilES3SafeReExports
|
2369
2396
|
});
|
2370
2397
|
|
2371
|
-
return packageResult( body, options, 'toUmd' );
|
2398
|
+
return packageResult( mod, mod.body, options, 'toUmd' );
|
2372
2399
|
}
|
2373
2400
|
|
2374
2401
|
var strictMode = {
|
@@ -2385,46 +2412,46 @@
|
|
2385
2412
|
|
2386
2413
|
var defaultsMode_amd__introTemplate = template( 'define(<%= amdName %><%= amdDeps %>function (<%= names %>) {\n\n\t\'use strict\';\n\n' );
|
2387
2414
|
|
2388
|
-
function defaultsMode_amd__amd ( bundle,
|
2415
|
+
function defaultsMode_amd__amd ( bundle, options ) {
|
2389
2416
|
var defaultName = bundle.entryModule.identifierReplacements.default;
|
2390
2417
|
if ( defaultName ) {
|
2391
|
-
body.append( (("\n\nreturn " + defaultName) + ";") );
|
2418
|
+
bundle.body.append( (("\n\nreturn " + defaultName) + ";") );
|
2392
2419
|
}
|
2393
2420
|
|
2394
2421
|
var intro = defaultsMode_amd__introTemplate({
|
2395
2422
|
amdName: options.amdName ? (("" + (quote(options.amdName))) + ", ") : '',
|
2396
2423
|
amdDeps: bundle.externalModules.length ? '[' + bundle.externalModules.map( quoteId ).join( ', ' ) + '], ' : '',
|
2397
2424
|
names: bundle.externalModules.map( getName ).join( ', ' )
|
2398
|
-
}).replace( /\t/g, body.getIndentString() );
|
2425
|
+
}).replace( /\t/g, bundle.body.getIndentString() );
|
2399
2426
|
|
2400
|
-
body.indent().prepend( intro ).trimLines().append( '\n\n});' );
|
2401
|
-
return packageResult( body, options, 'toAmd', true );
|
2427
|
+
bundle.body.indent().prepend( intro ).trimLines().append( '\n\n});' );
|
2428
|
+
return packageResult( bundle, bundle.body, options, 'toAmd', true );
|
2402
2429
|
}
|
2403
2430
|
|
2404
2431
|
function quoteId ( m ) {
|
2405
2432
|
return "'" + m.id + "'";
|
2406
2433
|
}
|
2407
2434
|
|
2408
|
-
function defaultsMode_cjs__cjs ( bundle,
|
2435
|
+
function defaultsMode_cjs__cjs ( bundle, options ) {
|
2409
2436
|
var importBlock = bundle.externalModules.map( function(x ) {
|
2410
2437
|
return (("var " + (x.name)) + (" = " + (req(x.id))) + ";");
|
2411
2438
|
}).join( '\n' );
|
2412
2439
|
|
2413
2440
|
if ( importBlock ) {
|
2414
|
-
body.prepend( importBlock + '\n\n' );
|
2441
|
+
bundle.body.prepend( importBlock + '\n\n' );
|
2415
2442
|
}
|
2416
2443
|
|
2417
2444
|
var defaultName = bundle.entryModule.identifierReplacements.default;
|
2418
2445
|
if ( defaultName ) {
|
2419
|
-
body.append( (("\n\nmodule.exports = " + defaultName) + ";") );
|
2446
|
+
bundle.body.append( (("\n\nmodule.exports = " + defaultName) + ";") );
|
2420
2447
|
}
|
2421
2448
|
|
2422
|
-
body.prepend("'use strict';\n\n").trimLines();
|
2449
|
+
bundle.body.prepend("'use strict';\n\n").trimLines();
|
2423
2450
|
|
2424
|
-
return packageResult( body, options, 'toCjs', true );
|
2451
|
+
return packageResult( bundle, bundle.body, options, 'toCjs', true );
|
2425
2452
|
}
|
2426
2453
|
|
2427
|
-
function defaultsMode_umd__umd ( bundle,
|
2454
|
+
function defaultsMode_umd__umd ( bundle, options ) {
|
2428
2455
|
requireName( options );
|
2429
2456
|
|
2430
2457
|
var entry = bundle.entryModule;
|
@@ -2436,12 +2463,12 @@
|
|
2436
2463
|
if (!hasImports && !hasExports) {
|
2437
2464
|
intro = standaloneUmdIntro({
|
2438
2465
|
amdName: options.amdName,
|
2439
|
-
}, body.getIndentString() );
|
2466
|
+
}, bundle.body.getIndentString() );
|
2440
2467
|
} else {
|
2441
2468
|
|
2442
2469
|
var defaultName = entry.identifierReplacements.default;
|
2443
2470
|
if ( defaultName ) {
|
2444
|
-
body.append( (("\n\nreturn " + defaultName) + ";") );
|
2471
|
+
bundle.body.append( (("\n\nreturn " + defaultName) + ";") );
|
2445
2472
|
}
|
2446
2473
|
|
2447
2474
|
var importPaths = bundle.externalModules.map( getId );
|
@@ -2453,12 +2480,12 @@
|
|
2453
2480
|
importNames: importNames,
|
2454
2481
|
amdName: options.amdName,
|
2455
2482
|
name: options.name
|
2456
|
-
}, body.getIndentString() );
|
2483
|
+
}, bundle.body.getIndentString() );
|
2457
2484
|
}
|
2458
2485
|
|
2459
|
-
body.indent().prepend( intro ).trimLines().append('\n\n}));');
|
2486
|
+
bundle.body.indent().prepend( intro ).trimLines().append('\n\n}));');
|
2460
2487
|
|
2461
|
-
return packageResult( body, options, 'toUmd', true );
|
2488
|
+
return packageResult( bundle, bundle.body, options, 'toUmd', true );
|
2462
2489
|
}
|
2463
2490
|
|
2464
2491
|
var builders_defaultsMode = {
|
@@ -2474,7 +2501,7 @@
|
|
2474
2501
|
|
2475
2502
|
var builders_strictMode_amd__introTemplate = template( 'define(<%= amdName %><%= amdDeps %>function (<%= names %>) {\n\n\t\'use strict\';\n\n' );
|
2476
2503
|
|
2477
|
-
function builders_strictMode_amd__amd ( bundle,
|
2504
|
+
function builders_strictMode_amd__amd ( bundle, options ) {
|
2478
2505
|
var externalDefaults = bundle.externalModules.filter( builders_strictMode_amd__needsDefault );
|
2479
2506
|
var entry = bundle.entryModule;
|
2480
2507
|
|
@@ -2492,7 +2519,7 @@
|
|
2492
2519
|
return (("var " + (x.name)) + ("__default = ('default' in " + (x.name)) + (" ? " + (x.name)) + ("['default'] : " + (x.name)) + ");");
|
2493
2520
|
}).join( '\n' );
|
2494
2521
|
|
2495
|
-
body.prepend( defaultsBlock + '\n\n' );
|
2522
|
+
bundle.body.prepend( defaultsBlock + '\n\n' );
|
2496
2523
|
}
|
2497
2524
|
|
2498
2525
|
if ( entry.exports.length ) {
|
@@ -2500,7 +2527,7 @@
|
|
2500
2527
|
importNames.unshift( 'exports' );
|
2501
2528
|
|
2502
2529
|
if ( entry.defaultExport ) {
|
2503
|
-
body.append( '\n\n' + getExportBlock( entry ) );
|
2530
|
+
bundle.body.append( '\n\n' + getExportBlock( entry ) );
|
2504
2531
|
}
|
2505
2532
|
}
|
2506
2533
|
|
@@ -2508,17 +2535,17 @@
|
|
2508
2535
|
amdName: options.amdName ? (("" + (quote(options.amdName))) + ", ") : '',
|
2509
2536
|
amdDeps: importIds.length ? '[' + importIds.map( quote ).join( ', ' ) + '], ' : '',
|
2510
2537
|
names: importNames.join( ', ' )
|
2511
|
-
}).replace( /\t/g, body.getIndentString() );
|
2538
|
+
}).replace( /\t/g, bundle.body.getIndentString() );
|
2512
2539
|
|
2513
|
-
body.indent().prepend( intro ).trimLines().append( '\n\n});' );
|
2514
|
-
return packageResult( body, options, 'toAmd', true );
|
2540
|
+
bundle.body.indent().prepend( intro ).trimLines().append( '\n\n});' );
|
2541
|
+
return packageResult( bundle, bundle.body, options, 'toAmd', true );
|
2515
2542
|
}
|
2516
2543
|
|
2517
2544
|
function builders_strictMode_amd__needsDefault ( externalModule ) {
|
2518
2545
|
return externalModule.needsDefault;
|
2519
2546
|
}
|
2520
2547
|
|
2521
|
-
function builders_strictMode_cjs__cjs ( bundle,
|
2548
|
+
function builders_strictMode_cjs__cjs ( bundle, options ) {
|
2522
2549
|
var entry = bundle.entryModule;
|
2523
2550
|
|
2524
2551
|
var importBlock = bundle.externalModules.map( function(x ) {
|
@@ -2534,19 +2561,19 @@
|
|
2534
2561
|
}).join( '\n' );
|
2535
2562
|
|
2536
2563
|
if ( importBlock ) {
|
2537
|
-
body.prepend( importBlock + '\n\n' );
|
2564
|
+
bundle.body.prepend( importBlock + '\n\n' );
|
2538
2565
|
}
|
2539
2566
|
|
2540
2567
|
if ( entry.defaultExport ) {
|
2541
|
-
body.append( '\n\n' + getExportBlock( entry ) );
|
2568
|
+
bundle.body.append( '\n\n' + getExportBlock( entry ) );
|
2542
2569
|
}
|
2543
2570
|
|
2544
|
-
body.prepend("'use strict';\n\n").trimLines();
|
2571
|
+
bundle.body.prepend("'use strict';\n\n").trimLines();
|
2545
2572
|
|
2546
|
-
return packageResult( body, options, 'toCjs', true );
|
2573
|
+
return packageResult( bundle, bundle.body, options, 'toCjs', true );
|
2547
2574
|
}
|
2548
2575
|
|
2549
|
-
function builders_strictMode_umd__umd ( bundle,
|
2576
|
+
function builders_strictMode_umd__umd ( bundle, options ) {
|
2550
2577
|
requireName( options );
|
2551
2578
|
|
2552
2579
|
var entry = bundle.entryModule;
|
@@ -2558,11 +2585,11 @@
|
|
2558
2585
|
if (!hasImports && !hasExports) {
|
2559
2586
|
intro = standaloneUmdIntro({
|
2560
2587
|
amdName: options.amdName,
|
2561
|
-
}, body.getIndentString() );
|
2588
|
+
}, bundle.body.getIndentString() );
|
2562
2589
|
} else {
|
2563
2590
|
|
2564
2591
|
if ( hasExports && entry.defaultExport ) {
|
2565
|
-
body.append( '\n\n' + getExportBlock( entry ) );
|
2592
|
+
bundle.body.append( '\n\n' + getExportBlock( entry ) );
|
2566
2593
|
}
|
2567
2594
|
|
2568
2595
|
var importPaths = bundle.externalModules.map( getId );
|
@@ -2575,12 +2602,12 @@
|
|
2575
2602
|
externalDefaults: bundle.externalModules.filter( builders_strictMode_umd__needsDefault ),
|
2576
2603
|
amdName: options.amdName,
|
2577
2604
|
name: options.name,
|
2578
|
-
}, body.getIndentString() );
|
2605
|
+
}, bundle.body.getIndentString() );
|
2579
2606
|
}
|
2580
2607
|
|
2581
|
-
body.indent().prepend( intro ).trimLines().append('\n\n}));');
|
2608
|
+
bundle.body.indent().prepend( intro ).trimLines().append('\n\n}));');
|
2582
2609
|
|
2583
|
-
return packageResult( body, options, 'toUmd', true );
|
2610
|
+
return packageResult( bundle, bundle.body, options, 'toUmd', true );
|
2584
2611
|
}
|
2585
2612
|
|
2586
2613
|
function builders_strictMode_umd__needsDefault ( externalModule ) {
|
@@ -2600,28 +2627,26 @@
|
|
2600
2627
|
};
|
2601
2628
|
|
2602
2629
|
function concat ( bundle, options ) {
|
2603
|
-
var
|
2630
|
+
var intro, outro, indent;
|
2604
2631
|
|
2605
2632
|
// This bundle must be self-contained - no imports or exports
|
2606
2633
|
if ( bundle.externalModules.length || bundle.entryModule.exports.length ) {
|
2607
2634
|
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(', '))) + "])") );
|
2608
2635
|
}
|
2609
2636
|
|
2610
|
-
body = bundle.body.clone();
|
2611
|
-
|
2612
2637
|
// TODO test these options
|
2613
2638
|
intro = 'intro' in options ? options.intro : ("(function () { 'use strict';\n\n");
|
2614
2639
|
outro = 'outro' in options ? options.outro : '\n\n})();';
|
2615
2640
|
|
2616
2641
|
if ( !( 'indent' in options ) || options.indent === true ) {
|
2617
|
-
indent = body.getIndentString();
|
2642
|
+
indent = bundle.body.getIndentString();
|
2618
2643
|
} else {
|
2619
2644
|
indent = options.indent || '';
|
2620
2645
|
}
|
2621
2646
|
|
2622
|
-
body.trimLines().indent( indent ).prepend( intro ).append( outro );
|
2647
|
+
bundle.body.trimLines().indent( indent ).prepend( intro ).append( outro );
|
2623
2648
|
|
2624
|
-
return packageResult( body, options, 'toString', true );
|
2649
|
+
return packageResult( bundle, bundle.body, options, 'toString', true );
|
2625
2650
|
}
|
2626
2651
|
|
2627
2652
|
var deprecateMessage = 'options.defaultOnly has been deprecated, and is now standard behaviour. To use named imports/exports, pass `strict: true`.',
|
@@ -2634,7 +2659,6 @@
|
|
2634
2659
|
builder;
|
2635
2660
|
|
2636
2661
|
mod = getStandaloneModule({ source: source, getModuleName: options.getModuleName, strict: options.strict });
|
2637
|
-
body = mod.body.clone();
|
2638
2662
|
|
2639
2663
|
if ( 'defaultOnly' in options && !alreadyWarned ) {
|
2640
2664
|
// TODO link to a wiki page explaining this, or something
|
@@ -2657,7 +2681,7 @@
|
|
2657
2681
|
builder = moduleBuilders.strictMode[ format ];
|
2658
2682
|
}
|
2659
2683
|
|
2660
|
-
return builder( mod,
|
2684
|
+
return builder( mod, options );
|
2661
2685
|
};
|
2662
2686
|
}
|
2663
2687
|
|
@@ -2709,7 +2733,7 @@
|
|
2709
2733
|
builder = bundleBuilders.strictMode[ format ];
|
2710
2734
|
}
|
2711
2735
|
|
2712
|
-
return builder( bundle,
|
2736
|
+
return builder( bundle, options );
|
2713
2737
|
}
|
2714
2738
|
});
|
2715
2739
|
}
|
data/vendor/esperanto.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
/*
|
2
|
-
esperanto.js v0.6.
|
2
|
+
esperanto.js v0.6.17 - 2015-03-01
|
3
3
|
http://esperantojs.org
|
4
4
|
|
5
5
|
Released under the MIT License.
|
@@ -1362,7 +1362,7 @@ function combine ( bundle ) {
|
|
1362
1362
|
|
1363
1363
|
body.addSource({
|
1364
1364
|
filename: path.resolve( bundle.base, mod.relativePath ),
|
1365
|
-
content: transformBody__transformBody( bundle, mod, mod.body
|
1365
|
+
content: transformBody__transformBody( bundle, mod, mod.body ),
|
1366
1366
|
indentExclusionRanges: mod.ast._templateLiteralRanges
|
1367
1367
|
});
|
1368
1368
|
});
|
@@ -1614,7 +1614,7 @@ function transformExportDeclaration ( declaration, body ) {
|
|
1614
1614
|
|
1615
1615
|
var warned = {};
|
1616
1616
|
|
1617
|
-
function packageResult ( body, options, methodName, isBundle ) {
|
1617
|
+
function packageResult ( bundleOrModule, body, options, methodName, isBundle ) {
|
1618
1618
|
var code, map;
|
1619
1619
|
|
1620
1620
|
// wrap output
|
@@ -1639,9 +1639,14 @@ function packageResult ( body, options, methodName, isBundle ) {
|
|
1639
1639
|
sourceMapFile = isAbsolutePath( options.sourceMapFile ) ? options.sourceMapFile : './' + splitPath( options.sourceMapFile ).pop();
|
1640
1640
|
}
|
1641
1641
|
|
1642
|
+
if ( isBundle ) {
|
1643
|
+
markBundleSourcemapLocations( bundleOrModule );
|
1644
|
+
} else {
|
1645
|
+
markModuleSourcemapLocations( bundleOrModule );
|
1646
|
+
}
|
1647
|
+
|
1642
1648
|
map = body.generateMap({
|
1643
1649
|
includeContent: true,
|
1644
|
-
hires: true,
|
1645
1650
|
file: sourceMapFile,
|
1646
1651
|
source: (sourceMapFile && !isBundle) ? getRelativePath( sourceMapFile, options.sourceMapSource ) : null
|
1647
1652
|
});
|
@@ -1698,6 +1703,24 @@ function getRelativePath ( from, to ) {
|
|
1698
1703
|
}
|
1699
1704
|
}
|
1700
1705
|
|
1706
|
+
function markBundleSourcemapLocations ( bundle ) {
|
1707
|
+
bundle.modules.forEach( function(mod ) {
|
1708
|
+
estraverse.traverse( mod.ast, {
|
1709
|
+
enter: function(node ) {
|
1710
|
+
mod.body.addSourcemapLocation( node.start );
|
1711
|
+
}
|
1712
|
+
});
|
1713
|
+
})
|
1714
|
+
}
|
1715
|
+
|
1716
|
+
function markModuleSourcemapLocations ( mod ) {
|
1717
|
+
estraverse.traverse( mod.ast, {
|
1718
|
+
enter: function(node ) {
|
1719
|
+
mod.body.addSourcemapLocation( node.start );
|
1720
|
+
}
|
1721
|
+
});
|
1722
|
+
}
|
1723
|
+
|
1701
1724
|
/**
|
1702
1725
|
* Creates a template function from a template string. The template
|
1703
1726
|
may have `<%= someVar %>` interpolators, and the returned function
|
@@ -1715,7 +1738,7 @@ function template ( str ) {
|
|
1715
1738
|
|
1716
1739
|
var amd__introTemplate = template( 'define(<%= amdName %><%= paths %>function (<%= names %>) {\n\n' );
|
1717
1740
|
|
1718
|
-
function amd__amd ( mod,
|
1741
|
+
function amd__amd ( mod, options ) {
|
1719
1742
|
var seen = {},
|
1720
1743
|
importNames = [],
|
1721
1744
|
importPaths = [],
|
@@ -1742,10 +1765,10 @@ function amd__amd ( mod, body, options ) {
|
|
1742
1765
|
seen[ path ] = true;
|
1743
1766
|
}
|
1744
1767
|
|
1745
|
-
body.remove( x.start, x.next );
|
1768
|
+
mod.body.remove( x.start, x.next );
|
1746
1769
|
});
|
1747
1770
|
|
1748
|
-
transformExportDeclaration( mod.exports[0], body );
|
1771
|
+
transformExportDeclaration( mod.exports[0], mod.body );
|
1749
1772
|
|
1750
1773
|
intro = amd__introTemplate({
|
1751
1774
|
amdName: options.amdName ? (("'" + (options.amdName)) + "', ") : '',
|
@@ -1753,27 +1776,27 @@ function amd__amd ( mod, body, options ) {
|
|
1753
1776
|
names: importNames.join( ', ' )
|
1754
1777
|
});
|
1755
1778
|
|
1756
|
-
body.trim()
|
1779
|
+
mod.body.trim()
|
1757
1780
|
.prepend( "'use strict';\n\n" )
|
1758
1781
|
.trim()
|
1759
1782
|
.indent()
|
1760
1783
|
.prepend( intro )
|
1761
1784
|
.append( '\n\n});' );
|
1762
1785
|
|
1763
|
-
return packageResult( body, options, 'toAmd' );
|
1786
|
+
return packageResult( mod, mod.body, options, 'toAmd' );
|
1764
1787
|
}
|
1765
1788
|
|
1766
|
-
function cjs__cjs ( mod,
|
1789
|
+
function cjs__cjs ( mod, options ) {
|
1767
1790
|
var seen = {}, exportDeclaration;
|
1768
1791
|
|
1769
1792
|
mod.imports.forEach( function(x ) {
|
1770
1793
|
if ( !hasOwnProp.call( seen, x.path ) ) {
|
1771
1794
|
var replacement = x.isEmpty ? (("" + (req(x.path))) + ";") : (("var " + (x.as)) + (" = " + (req(x.path))) + ";");
|
1772
|
-
body.replace( x.start, x.end, replacement );
|
1795
|
+
mod.body.replace( x.start, x.end, replacement );
|
1773
1796
|
|
1774
1797
|
seen[ x.path ] = true;
|
1775
1798
|
} else {
|
1776
|
-
body.remove( x.start, x.next );
|
1799
|
+
mod.body.remove( x.start, x.next );
|
1777
1800
|
}
|
1778
1801
|
});
|
1779
1802
|
|
@@ -1783,14 +1806,14 @@ function cjs__cjs ( mod, body, options ) {
|
|
1783
1806
|
switch ( exportDeclaration.type ) {
|
1784
1807
|
case 'namedFunction':
|
1785
1808
|
case 'namedClass':
|
1786
|
-
body.remove( exportDeclaration.start, exportDeclaration.valueStart );
|
1787
|
-
body.replace( exportDeclaration.end, exportDeclaration.end, (("\nmodule.exports = " + (exportDeclaration.node.declaration.id.name)) + ";") );
|
1809
|
+
mod.body.remove( exportDeclaration.start, exportDeclaration.valueStart );
|
1810
|
+
mod.body.replace( exportDeclaration.end, exportDeclaration.end, (("\nmodule.exports = " + (exportDeclaration.node.declaration.id.name)) + ";") );
|
1788
1811
|
break;
|
1789
1812
|
|
1790
1813
|
case 'anonFunction':
|
1791
1814
|
case 'anonClass':
|
1792
1815
|
case 'expression':
|
1793
|
-
body.replace( exportDeclaration.start, exportDeclaration.valueStart, 'module.exports = ' );
|
1816
|
+
mod.body.replace( exportDeclaration.start, exportDeclaration.valueStart, 'module.exports = ' );
|
1794
1817
|
break;
|
1795
1818
|
|
1796
1819
|
default:
|
@@ -1798,9 +1821,9 @@ function cjs__cjs ( mod, body, options ) {
|
|
1798
1821
|
}
|
1799
1822
|
}
|
1800
1823
|
|
1801
|
-
body.prepend( "'use strict';\n\n" ).trimLines();
|
1824
|
+
mod.body.prepend( "'use strict';\n\n" ).trimLines();
|
1802
1825
|
|
1803
|
-
return packageResult( body, options, 'toCjs' );
|
1826
|
+
return packageResult( mod, mod.body, options, 'toCjs' );
|
1804
1827
|
}
|
1805
1828
|
|
1806
1829
|
function standaloneUmdIntro ( options, indentStr ) {
|
@@ -1877,7 +1900,7 @@ function requireName ( options ) {
|
|
1877
1900
|
}
|
1878
1901
|
}
|
1879
1902
|
|
1880
|
-
function umd__umd ( mod,
|
1903
|
+
function umd__umd ( mod, options ) {
|
1881
1904
|
var importNames = [];
|
1882
1905
|
var importPaths = [];
|
1883
1906
|
var seen = {};
|
@@ -1892,7 +1915,7 @@ function umd__umd ( mod, body, options ) {
|
|
1892
1915
|
if (!hasImports && !hasExports) {
|
1893
1916
|
intro = standaloneUmdIntro({
|
1894
1917
|
amdName: options.amdName,
|
1895
|
-
}, body.getIndentString() );
|
1918
|
+
}, mod.body.getIndentString() );
|
1896
1919
|
} else {
|
1897
1920
|
// gather imports, and remove import declarations
|
1898
1921
|
mod.imports.forEach( function(x ) {
|
@@ -1912,10 +1935,10 @@ function umd__umd ( mod, body, options ) {
|
|
1912
1935
|
seen[ x.path ] = true;
|
1913
1936
|
}
|
1914
1937
|
|
1915
|
-
body.remove( x.start, x.next );
|
1938
|
+
mod.body.remove( x.start, x.next );
|
1916
1939
|
});
|
1917
1940
|
|
1918
|
-
transformExportDeclaration( mod.exports[0], body );
|
1941
|
+
transformExportDeclaration( mod.exports[0], mod.body );
|
1919
1942
|
|
1920
1943
|
intro = defaultUmdIntro({
|
1921
1944
|
hasExports: hasExports,
|
@@ -1924,12 +1947,12 @@ function umd__umd ( mod, body, options ) {
|
|
1924
1947
|
amdName: options.amdName,
|
1925
1948
|
absolutePaths: options.absolutePaths,
|
1926
1949
|
name: options.name
|
1927
|
-
}, body.getIndentString() );
|
1950
|
+
}, mod.body.getIndentString() );
|
1928
1951
|
}
|
1929
1952
|
|
1930
|
-
body.indent().prepend( intro ).trimLines().append( '\n\n}));' );
|
1953
|
+
mod.body.indent().prepend( intro ).trimLines().append( '\n\n}));' );
|
1931
1954
|
|
1932
|
-
return packageResult( body, options, 'toUmd' );
|
1955
|
+
return packageResult( mod, mod.body, options, 'toUmd' );
|
1933
1956
|
}
|
1934
1957
|
|
1935
1958
|
var defaultsMode = {
|
@@ -2126,7 +2149,7 @@ var strictMode_amd__introTemplate;
|
|
2126
2149
|
|
2127
2150
|
strictMode_amd__introTemplate = template( 'define(<%= amdName %><%= paths %>function (<%= names %>) {\n\n\t\'use strict\';\n\n' );
|
2128
2151
|
|
2129
|
-
function strictMode_amd__amd ( mod,
|
2152
|
+
function strictMode_amd__amd ( mod, options ) {var $D$4;
|
2130
2153
|
var importPaths,
|
2131
2154
|
importNames,
|
2132
2155
|
intro;
|
@@ -2142,18 +2165,18 @@ function strictMode_amd__amd ( mod, body, options ) {var $D$4;
|
|
2142
2165
|
amdName: options.amdName ? (("'" + (options.amdName)) + "', ") : '',
|
2143
2166
|
paths: importPaths.length ? '[' + ( options.absolutePaths ? importPaths.map( resolveAgainst( options.amdName ) ) : importPaths ).map( quote ).join( ', ' ) + '], ' : '',
|
2144
2167
|
names: importNames.join( ', ' )
|
2145
|
-
}).replace( /\t/g, body.getIndentString() );
|
2168
|
+
}).replace( /\t/g, mod.body.getIndentString() );
|
2146
2169
|
|
2147
|
-
utils_transformBody__transformBody( mod, body, {
|
2170
|
+
utils_transformBody__transformBody( mod, mod.body, {
|
2148
2171
|
intro: intro,
|
2149
2172
|
outro: '\n\n});',
|
2150
2173
|
_evilES3SafeReExports: options._evilES3SafeReExports
|
2151
2174
|
});
|
2152
2175
|
|
2153
|
-
return packageResult( body, options, 'toAmd' );
|
2176
|
+
return packageResult( mod, mod.body, options, 'toAmd' );
|
2154
2177
|
;$D$4 = void 0}
|
2155
2178
|
|
2156
|
-
function strictMode_cjs__cjs ( mod,
|
2179
|
+
function strictMode_cjs__cjs ( mod, options ) {
|
2157
2180
|
var importBlock, seen = {};
|
2158
2181
|
|
2159
2182
|
// Create block of require statements
|
@@ -2173,14 +2196,14 @@ function strictMode_cjs__cjs ( mod, body, options ) {
|
|
2173
2196
|
return replacement;
|
2174
2197
|
}).filter( Boolean ).join( '\n' );
|
2175
2198
|
|
2176
|
-
utils_transformBody__transformBody( mod, body, {
|
2199
|
+
utils_transformBody__transformBody( mod, mod.body, {
|
2177
2200
|
header: importBlock,
|
2178
2201
|
_evilES3SafeReExports: options._evilES3SafeReExports
|
2179
2202
|
});
|
2180
2203
|
|
2181
|
-
body.prepend( "'use strict';\n\n" ).trimLines();
|
2204
|
+
mod.body.prepend( "'use strict';\n\n" ).trimLines();
|
2182
2205
|
|
2183
|
-
return packageResult( body, options, 'toCjs' );
|
2206
|
+
return packageResult( mod, mod.body, options, 'toCjs' );
|
2184
2207
|
}
|
2185
2208
|
|
2186
2209
|
function strictUmdIntro ( options, indentStr ) {
|
@@ -2219,7 +2242,7 @@ function strictUmdIntro ( options, indentStr ) {
|
|
2219
2242
|
return intro.replace( /\t/g, indentStr );
|
2220
2243
|
}
|
2221
2244
|
|
2222
|
-
function strictMode_umd__umd ( mod,
|
2245
|
+
function strictMode_umd__umd ( mod, options ) {
|
2223
2246
|
requireName( options );
|
2224
2247
|
|
2225
2248
|
var importPaths = (importNames = getImportSummary( mod ))[0], importNames = importNames[1];
|
@@ -2231,7 +2254,7 @@ function strictMode_umd__umd ( mod, body, options ) {
|
|
2231
2254
|
if (!hasImports && !hasExports) {
|
2232
2255
|
intro = standaloneUmdIntro({
|
2233
2256
|
amdName: options.amdName,
|
2234
|
-
}, body.getIndentString() );
|
2257
|
+
}, mod.body.getIndentString() );
|
2235
2258
|
} else {
|
2236
2259
|
intro = strictUmdIntro({
|
2237
2260
|
hasExports: hasExports,
|
@@ -2240,16 +2263,16 @@ function strictMode_umd__umd ( mod, body, options ) {
|
|
2240
2263
|
amdName: options.amdName,
|
2241
2264
|
absolutePaths: options.absolutePaths,
|
2242
2265
|
name: options.name
|
2243
|
-
}, body.getIndentString() );
|
2266
|
+
}, mod.body.getIndentString() );
|
2244
2267
|
}
|
2245
2268
|
|
2246
|
-
utils_transformBody__transformBody( mod, body, {
|
2269
|
+
utils_transformBody__transformBody( mod, mod.body, {
|
2247
2270
|
intro: intro,
|
2248
2271
|
outro: '\n\n}));',
|
2249
2272
|
_evilES3SafeReExports: options._evilES3SafeReExports
|
2250
2273
|
});
|
2251
2274
|
|
2252
|
-
return packageResult( body, options, 'toUmd' );
|
2275
|
+
return packageResult( mod, mod.body, options, 'toUmd' );
|
2253
2276
|
}
|
2254
2277
|
|
2255
2278
|
var strictMode = {
|
@@ -2266,46 +2289,46 @@ var moduleBuilders = {
|
|
2266
2289
|
|
2267
2290
|
var defaultsMode_amd__introTemplate = template( 'define(<%= amdName %><%= amdDeps %>function (<%= names %>) {\n\n\t\'use strict\';\n\n' );
|
2268
2291
|
|
2269
|
-
function defaultsMode_amd__amd ( bundle,
|
2292
|
+
function defaultsMode_amd__amd ( bundle, options ) {
|
2270
2293
|
var defaultName = bundle.entryModule.identifierReplacements.default;
|
2271
2294
|
if ( defaultName ) {
|
2272
|
-
body.append( (("\n\nreturn " + defaultName) + ";") );
|
2295
|
+
bundle.body.append( (("\n\nreturn " + defaultName) + ";") );
|
2273
2296
|
}
|
2274
2297
|
|
2275
2298
|
var intro = defaultsMode_amd__introTemplate({
|
2276
2299
|
amdName: options.amdName ? (("" + (quote(options.amdName))) + ", ") : '',
|
2277
2300
|
amdDeps: bundle.externalModules.length ? '[' + bundle.externalModules.map( quoteId ).join( ', ' ) + '], ' : '',
|
2278
2301
|
names: bundle.externalModules.map( getName ).join( ', ' )
|
2279
|
-
}).replace( /\t/g, body.getIndentString() );
|
2302
|
+
}).replace( /\t/g, bundle.body.getIndentString() );
|
2280
2303
|
|
2281
|
-
body.indent().prepend( intro ).trimLines().append( '\n\n});' );
|
2282
|
-
return packageResult( body, options, 'toAmd', true );
|
2304
|
+
bundle.body.indent().prepend( intro ).trimLines().append( '\n\n});' );
|
2305
|
+
return packageResult( bundle, bundle.body, options, 'toAmd', true );
|
2283
2306
|
}
|
2284
2307
|
|
2285
2308
|
function quoteId ( m ) {
|
2286
2309
|
return "'" + m.id + "'";
|
2287
2310
|
}
|
2288
2311
|
|
2289
|
-
function defaultsMode_cjs__cjs ( bundle,
|
2312
|
+
function defaultsMode_cjs__cjs ( bundle, options ) {
|
2290
2313
|
var importBlock = bundle.externalModules.map( function(x ) {
|
2291
2314
|
return (("var " + (x.name)) + (" = " + (req(x.id))) + ";");
|
2292
2315
|
}).join( '\n' );
|
2293
2316
|
|
2294
2317
|
if ( importBlock ) {
|
2295
|
-
body.prepend( importBlock + '\n\n' );
|
2318
|
+
bundle.body.prepend( importBlock + '\n\n' );
|
2296
2319
|
}
|
2297
2320
|
|
2298
2321
|
var defaultName = bundle.entryModule.identifierReplacements.default;
|
2299
2322
|
if ( defaultName ) {
|
2300
|
-
body.append( (("\n\nmodule.exports = " + defaultName) + ";") );
|
2323
|
+
bundle.body.append( (("\n\nmodule.exports = " + defaultName) + ";") );
|
2301
2324
|
}
|
2302
2325
|
|
2303
|
-
body.prepend("'use strict';\n\n").trimLines();
|
2326
|
+
bundle.body.prepend("'use strict';\n\n").trimLines();
|
2304
2327
|
|
2305
|
-
return packageResult( body, options, 'toCjs', true );
|
2328
|
+
return packageResult( bundle, bundle.body, options, 'toCjs', true );
|
2306
2329
|
}
|
2307
2330
|
|
2308
|
-
function defaultsMode_umd__umd ( bundle,
|
2331
|
+
function defaultsMode_umd__umd ( bundle, options ) {
|
2309
2332
|
requireName( options );
|
2310
2333
|
|
2311
2334
|
var entry = bundle.entryModule;
|
@@ -2317,12 +2340,12 @@ function defaultsMode_umd__umd ( bundle, body, options ) {
|
|
2317
2340
|
if (!hasImports && !hasExports) {
|
2318
2341
|
intro = standaloneUmdIntro({
|
2319
2342
|
amdName: options.amdName,
|
2320
|
-
}, body.getIndentString() );
|
2343
|
+
}, bundle.body.getIndentString() );
|
2321
2344
|
} else {
|
2322
2345
|
|
2323
2346
|
var defaultName = entry.identifierReplacements.default;
|
2324
2347
|
if ( defaultName ) {
|
2325
|
-
body.append( (("\n\nreturn " + defaultName) + ";") );
|
2348
|
+
bundle.body.append( (("\n\nreturn " + defaultName) + ";") );
|
2326
2349
|
}
|
2327
2350
|
|
2328
2351
|
var importPaths = bundle.externalModules.map( getId );
|
@@ -2334,12 +2357,12 @@ function defaultsMode_umd__umd ( bundle, body, options ) {
|
|
2334
2357
|
importNames: importNames,
|
2335
2358
|
amdName: options.amdName,
|
2336
2359
|
name: options.name
|
2337
|
-
}, body.getIndentString() );
|
2360
|
+
}, bundle.body.getIndentString() );
|
2338
2361
|
}
|
2339
2362
|
|
2340
|
-
body.indent().prepend( intro ).trimLines().append('\n\n}));');
|
2363
|
+
bundle.body.indent().prepend( intro ).trimLines().append('\n\n}));');
|
2341
2364
|
|
2342
|
-
return packageResult( body, options, 'toUmd', true );
|
2365
|
+
return packageResult( bundle, bundle.body, options, 'toUmd', true );
|
2343
2366
|
}
|
2344
2367
|
|
2345
2368
|
var builders_defaultsMode = {
|
@@ -2355,7 +2378,7 @@ function getExportBlock ( entry ) {
|
|
2355
2378
|
|
2356
2379
|
var builders_strictMode_amd__introTemplate = template( 'define(<%= amdName %><%= amdDeps %>function (<%= names %>) {\n\n\t\'use strict\';\n\n' );
|
2357
2380
|
|
2358
|
-
function builders_strictMode_amd__amd ( bundle,
|
2381
|
+
function builders_strictMode_amd__amd ( bundle, options ) {
|
2359
2382
|
var externalDefaults = bundle.externalModules.filter( builders_strictMode_amd__needsDefault );
|
2360
2383
|
var entry = bundle.entryModule;
|
2361
2384
|
|
@@ -2373,7 +2396,7 @@ function builders_strictMode_amd__amd ( bundle, body, options ) {
|
|
2373
2396
|
return (("var " + (x.name)) + ("__default = ('default' in " + (x.name)) + (" ? " + (x.name)) + ("['default'] : " + (x.name)) + ");");
|
2374
2397
|
}).join( '\n' );
|
2375
2398
|
|
2376
|
-
body.prepend( defaultsBlock + '\n\n' );
|
2399
|
+
bundle.body.prepend( defaultsBlock + '\n\n' );
|
2377
2400
|
}
|
2378
2401
|
|
2379
2402
|
if ( entry.exports.length ) {
|
@@ -2381,7 +2404,7 @@ function builders_strictMode_amd__amd ( bundle, body, options ) {
|
|
2381
2404
|
importNames.unshift( 'exports' );
|
2382
2405
|
|
2383
2406
|
if ( entry.defaultExport ) {
|
2384
|
-
body.append( '\n\n' + getExportBlock( entry ) );
|
2407
|
+
bundle.body.append( '\n\n' + getExportBlock( entry ) );
|
2385
2408
|
}
|
2386
2409
|
}
|
2387
2410
|
|
@@ -2389,17 +2412,17 @@ function builders_strictMode_amd__amd ( bundle, body, options ) {
|
|
2389
2412
|
amdName: options.amdName ? (("" + (quote(options.amdName))) + ", ") : '',
|
2390
2413
|
amdDeps: importIds.length ? '[' + importIds.map( quote ).join( ', ' ) + '], ' : '',
|
2391
2414
|
names: importNames.join( ', ' )
|
2392
|
-
}).replace( /\t/g, body.getIndentString() );
|
2415
|
+
}).replace( /\t/g, bundle.body.getIndentString() );
|
2393
2416
|
|
2394
|
-
body.indent().prepend( intro ).trimLines().append( '\n\n});' );
|
2395
|
-
return packageResult( body, options, 'toAmd', true );
|
2417
|
+
bundle.body.indent().prepend( intro ).trimLines().append( '\n\n});' );
|
2418
|
+
return packageResult( bundle, bundle.body, options, 'toAmd', true );
|
2396
2419
|
}
|
2397
2420
|
|
2398
2421
|
function builders_strictMode_amd__needsDefault ( externalModule ) {
|
2399
2422
|
return externalModule.needsDefault;
|
2400
2423
|
}
|
2401
2424
|
|
2402
|
-
function builders_strictMode_cjs__cjs ( bundle,
|
2425
|
+
function builders_strictMode_cjs__cjs ( bundle, options ) {
|
2403
2426
|
var entry = bundle.entryModule;
|
2404
2427
|
|
2405
2428
|
var importBlock = bundle.externalModules.map( function(x ) {
|
@@ -2415,19 +2438,19 @@ function builders_strictMode_cjs__cjs ( bundle, body, options ) {
|
|
2415
2438
|
}).join( '\n' );
|
2416
2439
|
|
2417
2440
|
if ( importBlock ) {
|
2418
|
-
body.prepend( importBlock + '\n\n' );
|
2441
|
+
bundle.body.prepend( importBlock + '\n\n' );
|
2419
2442
|
}
|
2420
2443
|
|
2421
2444
|
if ( entry.defaultExport ) {
|
2422
|
-
body.append( '\n\n' + getExportBlock( entry ) );
|
2445
|
+
bundle.body.append( '\n\n' + getExportBlock( entry ) );
|
2423
2446
|
}
|
2424
2447
|
|
2425
|
-
body.prepend("'use strict';\n\n").trimLines();
|
2448
|
+
bundle.body.prepend("'use strict';\n\n").trimLines();
|
2426
2449
|
|
2427
|
-
return packageResult( body, options, 'toCjs', true );
|
2450
|
+
return packageResult( bundle, bundle.body, options, 'toCjs', true );
|
2428
2451
|
}
|
2429
2452
|
|
2430
|
-
function builders_strictMode_umd__umd ( bundle,
|
2453
|
+
function builders_strictMode_umd__umd ( bundle, options ) {
|
2431
2454
|
requireName( options );
|
2432
2455
|
|
2433
2456
|
var entry = bundle.entryModule;
|
@@ -2439,11 +2462,11 @@ function builders_strictMode_umd__umd ( bundle, body, options ) {
|
|
2439
2462
|
if (!hasImports && !hasExports) {
|
2440
2463
|
intro = standaloneUmdIntro({
|
2441
2464
|
amdName: options.amdName,
|
2442
|
-
}, body.getIndentString() );
|
2465
|
+
}, bundle.body.getIndentString() );
|
2443
2466
|
} else {
|
2444
2467
|
|
2445
2468
|
if ( hasExports && entry.defaultExport ) {
|
2446
|
-
body.append( '\n\n' + getExportBlock( entry ) );
|
2469
|
+
bundle.body.append( '\n\n' + getExportBlock( entry ) );
|
2447
2470
|
}
|
2448
2471
|
|
2449
2472
|
var importPaths = bundle.externalModules.map( getId );
|
@@ -2456,12 +2479,12 @@ function builders_strictMode_umd__umd ( bundle, body, options ) {
|
|
2456
2479
|
externalDefaults: bundle.externalModules.filter( builders_strictMode_umd__needsDefault ),
|
2457
2480
|
amdName: options.amdName,
|
2458
2481
|
name: options.name,
|
2459
|
-
}, body.getIndentString() );
|
2482
|
+
}, bundle.body.getIndentString() );
|
2460
2483
|
}
|
2461
2484
|
|
2462
|
-
body.indent().prepend( intro ).trimLines().append('\n\n}));');
|
2485
|
+
bundle.body.indent().prepend( intro ).trimLines().append('\n\n}));');
|
2463
2486
|
|
2464
|
-
return packageResult( body, options, 'toUmd', true );
|
2487
|
+
return packageResult( bundle, bundle.body, options, 'toUmd', true );
|
2465
2488
|
}
|
2466
2489
|
|
2467
2490
|
function builders_strictMode_umd__needsDefault ( externalModule ) {
|
@@ -2481,28 +2504,26 @@ var bundleBuilders = {
|
|
2481
2504
|
};
|
2482
2505
|
|
2483
2506
|
function concat ( bundle, options ) {
|
2484
|
-
var
|
2507
|
+
var intro, outro, indent;
|
2485
2508
|
|
2486
2509
|
// This bundle must be self-contained - no imports or exports
|
2487
2510
|
if ( bundle.externalModules.length || bundle.entryModule.exports.length ) {
|
2488
2511
|
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(', '))) + "])") );
|
2489
2512
|
}
|
2490
2513
|
|
2491
|
-
body = bundle.body.clone();
|
2492
|
-
|
2493
2514
|
// TODO test these options
|
2494
2515
|
intro = 'intro' in options ? options.intro : ("(function () { 'use strict';\n\n");
|
2495
2516
|
outro = 'outro' in options ? options.outro : '\n\n})();';
|
2496
2517
|
|
2497
2518
|
if ( !( 'indent' in options ) || options.indent === true ) {
|
2498
|
-
indent = body.getIndentString();
|
2519
|
+
indent = bundle.body.getIndentString();
|
2499
2520
|
} else {
|
2500
2521
|
indent = options.indent || '';
|
2501
2522
|
}
|
2502
2523
|
|
2503
|
-
body.trimLines().indent( indent ).prepend( intro ).append( outro );
|
2524
|
+
bundle.body.trimLines().indent( indent ).prepend( intro ).append( outro );
|
2504
2525
|
|
2505
|
-
return packageResult( body, options, 'toString', true );
|
2526
|
+
return packageResult( bundle, bundle.body, options, 'toString', true );
|
2506
2527
|
}
|
2507
2528
|
|
2508
2529
|
var deprecateMessage = 'options.defaultOnly has been deprecated, and is now standard behaviour. To use named imports/exports, pass `strict: true`.',
|
@@ -2515,7 +2536,6 @@ function transpileMethod ( format ) {
|
|
2515
2536
|
builder;
|
2516
2537
|
|
2517
2538
|
mod = getStandaloneModule({ source: source, getModuleName: options.getModuleName, strict: options.strict });
|
2518
|
-
body = mod.body.clone();
|
2519
2539
|
|
2520
2540
|
if ( 'defaultOnly' in options && !alreadyWarned ) {
|
2521
2541
|
// TODO link to a wiki page explaining this, or something
|
@@ -2538,7 +2558,7 @@ function transpileMethod ( format ) {
|
|
2538
2558
|
builder = moduleBuilders.strictMode[ format ];
|
2539
2559
|
}
|
2540
2560
|
|
2541
|
-
return builder( mod,
|
2561
|
+
return builder( mod, options );
|
2542
2562
|
};
|
2543
2563
|
}
|
2544
2564
|
|
@@ -2590,7 +2610,7 @@ var esperanto = {
|
|
2590
2610
|
builder = bundleBuilders.strictMode[ format ];
|
2591
2611
|
}
|
2592
2612
|
|
2593
|
-
return builder( bundle,
|
2613
|
+
return builder( bundle, options );
|
2594
2614
|
}
|
2595
2615
|
});
|
2596
2616
|
}
|