esperanto-source 0.6.29 → 0.6.30
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 +80 -77
- data/vendor/esperanto.js +155 -89
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f7678b65420048b28faebd971f2f409738942b66
|
4
|
+
data.tar.gz: e2a1cb859e3d99f8ce0875d3ec8e924bc51ff0c2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cad97fe6f7a8b7619cb142aecf6acad48342ed70c2e35404a7041888107684fb8644ad4f83cec108d7be6f3124838e455496b6674b600a28157aa7c4fe8c72fc
|
7
|
+
data.tar.gz: 80788a678e62c3a807e0676a3436ee83baf5838be36381b96c594551e3f8fb6292d523c70a0977023a6e3037377e292ab0936b39fb474ce71fea90e3c03be350
|
data/vendor/esperanto.browser.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
/*
|
2
|
-
esperanto.js v0.6.
|
2
|
+
esperanto.js v0.6.30 - 2015-04-26
|
3
3
|
http://esperantojs.org
|
4
4
|
|
5
5
|
Released under the MIT License.
|
@@ -12,6 +12,7 @@
|
|
12
12
|
}(this, function (acorn) { 'use strict';
|
13
13
|
|
14
14
|
var hasOwnProp = Object.prototype.hasOwnProperty;
|
15
|
+
var utils_hasOwnProp = hasOwnProp;
|
15
16
|
|
16
17
|
function hasNamedImports ( mod ) {
|
17
18
|
var i = mod.imports.length;
|
@@ -67,7 +68,9 @@
|
|
67
68
|
}
|
68
69
|
};
|
69
70
|
|
70
|
-
|
71
|
+
var src_SourceMap = SourceMap;
|
72
|
+
|
73
|
+
function utils_getRelativePath__getRelativePath ( from, to ) {
|
71
74
|
var fromParts, toParts, i;
|
72
75
|
|
73
76
|
fromParts = from.split( /[\/\\]/ );
|
@@ -143,10 +146,10 @@
|
|
143
146
|
getSemis( this.outro )
|
144
147
|
);
|
145
148
|
|
146
|
-
return new
|
149
|
+
return new src_SourceMap({
|
147
150
|
file: ( options.file ? options.file.split( /[\/\\]/ ).pop() : null ),
|
148
151
|
sources: this.sources.map( function ( source ) {
|
149
|
-
return options.file ?
|
152
|
+
return options.file ? utils_getRelativePath__getRelativePath( options.file, source.filename ) : source.filename;
|
150
153
|
}),
|
151
154
|
sourcesContent: this.sources.map( function ( source ) {
|
152
155
|
return options.includeContent ? source.content.original : null;
|
@@ -252,7 +255,7 @@
|
|
252
255
|
}
|
253
256
|
};
|
254
257
|
|
255
|
-
|
258
|
+
var src_Bundle = Bundle;
|
256
259
|
|
257
260
|
function stringify ( source ) {
|
258
261
|
return source.content.toString();
|
@@ -342,17 +345,15 @@
|
|
342
345
|
}
|
343
346
|
|
344
347
|
function encode ( value ) {
|
345
|
-
var result;
|
348
|
+
var result, i;
|
346
349
|
|
347
350
|
if ( typeof value === 'number' ) {
|
348
351
|
result = encodeInteger( value );
|
349
|
-
} else if ( Array.isArray( value ) ) {
|
350
|
-
result = '';
|
351
|
-
value.forEach( function ( num ) {
|
352
|
-
result += encodeInteger( num );
|
353
|
-
});
|
354
352
|
} else {
|
355
|
-
|
353
|
+
result = '';
|
354
|
+
for ( i = 0; i < value.length; i += 1 ) {
|
355
|
+
result += encodeInteger( value[i] );
|
356
|
+
}
|
356
357
|
}
|
357
358
|
|
358
359
|
return result;
|
@@ -381,7 +382,7 @@
|
|
381
382
|
return result;
|
382
383
|
}
|
383
384
|
|
384
|
-
var
|
385
|
+
var utils_encode = encode;
|
385
386
|
|
386
387
|
function encodeMappings ( original, str, mappings, hires, sourcemapLocations, sourceIndex, offsets ) {
|
387
388
|
var lineStart,
|
@@ -472,7 +473,7 @@
|
|
472
473
|
|
473
474
|
firstSegment = false;
|
474
475
|
|
475
|
-
return
|
476
|
+
return utils_encode( arr );
|
476
477
|
}).join( ',' );
|
477
478
|
}).join( ';' );
|
478
479
|
|
@@ -556,9 +557,9 @@
|
|
556
557
|
generateMap: function ( options ) {
|
557
558
|
options = options || {};
|
558
559
|
|
559
|
-
return new
|
560
|
+
return new src_SourceMap({
|
560
561
|
file: ( options.file ? options.file.split( /[\/\\]/ ).pop() : null ),
|
561
|
-
sources: [ options.source ?
|
562
|
+
sources: [ options.source ? utils_getRelativePath__getRelativePath( options.file || '', options.source ) : null ],
|
562
563
|
sourcesContent: options.includeContent ? [ this.original ] : [ null ],
|
563
564
|
names: [],
|
564
565
|
mappings: this.getMappings( options.hires, 0 )
|
@@ -879,7 +880,7 @@
|
|
879
880
|
}
|
880
881
|
};
|
881
882
|
|
882
|
-
MagicString.Bundle =
|
883
|
+
MagicString.Bundle = src_Bundle;
|
883
884
|
|
884
885
|
function adjust ( mappings, start, end, d ) {
|
885
886
|
var i = end;
|
@@ -930,33 +931,35 @@
|
|
930
931
|
return result;
|
931
932
|
}
|
932
933
|
|
934
|
+
var magic_string = MagicString;
|
935
|
+
|
933
936
|
function walk ( ast, leave) {var enter = leave.enter, leave = leave.leave;
|
934
937
|
visit( ast, null, enter, leave );
|
935
938
|
}
|
936
939
|
|
937
|
-
var
|
938
|
-
skip: function() {return
|
940
|
+
var ast_walk__context = {
|
941
|
+
skip: function() {return ast_walk__context.shouldSkip = true}
|
939
942
|
};
|
940
943
|
|
941
|
-
var
|
944
|
+
var ast_walk__childKeys = {};
|
942
945
|
|
943
|
-
var
|
946
|
+
var ast_walk__toString = Object.prototype.toString;
|
944
947
|
|
945
948
|
function isArray ( thing ) {
|
946
|
-
return
|
949
|
+
return ast_walk__toString.call( thing ) === '[object Array]';
|
947
950
|
}
|
948
951
|
|
949
952
|
function visit ( node, parent, enter, leave ) {
|
950
953
|
if ( !node ) return;
|
951
954
|
|
952
955
|
if ( enter ) {
|
953
|
-
|
954
|
-
enter.call(
|
955
|
-
if (
|
956
|
+
ast_walk__context.shouldSkip = false;
|
957
|
+
enter.call( ast_walk__context, node, parent );
|
958
|
+
if ( ast_walk__context.shouldSkip ) return;
|
956
959
|
}
|
957
960
|
|
958
|
-
var keys =
|
959
|
-
|
961
|
+
var keys = ast_walk__childKeys[ node.type ] || (
|
962
|
+
ast_walk__childKeys[ node.type ] = Object.keys( node ).filter( function(key ) {return typeof node[ key ] === 'object'} )
|
960
963
|
);
|
961
964
|
|
962
965
|
var key, value, i, j;
|
@@ -1253,8 +1256,6 @@
|
|
1253
1256
|
|
1254
1257
|
path: node.source.value,
|
1255
1258
|
specifiers: node.specifiers.map( function(s ) {
|
1256
|
-
var id;
|
1257
|
-
|
1258
1259
|
if ( s.type === 'ImportNamespaceSpecifier' ) {
|
1259
1260
|
return {
|
1260
1261
|
isBatch: true,
|
@@ -1268,7 +1269,7 @@
|
|
1268
1269
|
isDefault: true,
|
1269
1270
|
name: 'default',
|
1270
1271
|
as: s.local.name
|
1271
|
-
}
|
1272
|
+
};
|
1272
1273
|
}
|
1273
1274
|
|
1274
1275
|
return {
|
@@ -1409,7 +1410,7 @@
|
|
1409
1410
|
});
|
1410
1411
|
});
|
1411
1412
|
}
|
1412
|
-
return
|
1413
|
+
return utils_hasOwnProp.call( importedNames, name );
|
1413
1414
|
}
|
1414
1415
|
|
1415
1416
|
walk( mod.ast, {
|
@@ -1461,7 +1462,7 @@
|
|
1461
1462
|
}
|
1462
1463
|
|
1463
1464
|
function checkName ( name ) {
|
1464
|
-
if (
|
1465
|
+
if ( utils_hasOwnProp.call( usedNames, name ) ) {
|
1465
1466
|
throw new SyntaxError( (("Duplicated import ('" + name) + "')") );
|
1466
1467
|
}
|
1467
1468
|
|
@@ -1508,7 +1509,7 @@
|
|
1508
1509
|
var toRemove = [];
|
1509
1510
|
|
1510
1511
|
var mod = {
|
1511
|
-
body: new
|
1512
|
+
body: new magic_string( code ),
|
1512
1513
|
ast: ast || ( acorn.parse( code, {
|
1513
1514
|
ecmaVersion: 6,
|
1514
1515
|
sourceType: 'module',
|
@@ -1557,7 +1558,7 @@
|
|
1557
1558
|
moduleId = x.path;
|
1558
1559
|
|
1559
1560
|
// use existing value
|
1560
|
-
if (
|
1561
|
+
if ( utils_hasOwnProp.call( nameById, moduleId ) ) {
|
1561
1562
|
x.name = nameById[ moduleId ];
|
1562
1563
|
return;
|
1563
1564
|
}
|
@@ -1566,7 +1567,7 @@
|
|
1566
1567
|
if ( userFn && ( name = userFn( moduleId ) ) ) {
|
1567
1568
|
name = sanitize( name );
|
1568
1569
|
|
1569
|
-
if (
|
1570
|
+
if ( utils_hasOwnProp.call( usedNames, name ) ) {
|
1570
1571
|
// TODO write a test for this
|
1571
1572
|
throw new Error( (("Naming collision: module " + moduleId) + (" cannot be called " + name) + "") );
|
1572
1573
|
}
|
@@ -1583,7 +1584,7 @@
|
|
1583
1584
|
while ( i-- > 0 ) {
|
1584
1585
|
candidate = prefix + sanitize( parts.slice( i ).join( '__' ) );
|
1585
1586
|
|
1586
|
-
if ( !
|
1587
|
+
if ( !utils_hasOwnProp.call( usedNames, candidate ) ) {
|
1587
1588
|
name = candidate;
|
1588
1589
|
break;
|
1589
1590
|
}
|
@@ -1602,13 +1603,13 @@
|
|
1602
1603
|
// use inferred names for default imports, wherever they
|
1603
1604
|
// don't clash with path-based names
|
1604
1605
|
imports.forEach( function(x ) {
|
1605
|
-
if ( x.as && !
|
1606
|
+
if ( x.as && !utils_hasOwnProp.call( usedNames, x.as ) ) {
|
1606
1607
|
inferredNames[ x.path ] = x.as;
|
1607
1608
|
}
|
1608
1609
|
});
|
1609
1610
|
|
1610
1611
|
imports.forEach( function(x ) {
|
1611
|
-
if (
|
1612
|
+
if ( utils_hasOwnProp.call( inferredNames, x.path ) ) {
|
1612
1613
|
x.name = inferredNames[ x.path ];
|
1613
1614
|
}
|
1614
1615
|
});
|
@@ -1662,7 +1663,7 @@
|
|
1662
1663
|
|
1663
1664
|
var ABSOLUTE_PATH = /^(?:[A-Z]:)?[\/\\]/i;
|
1664
1665
|
|
1665
|
-
var
|
1666
|
+
var utils_packageResult__warned = {};
|
1666
1667
|
|
1667
1668
|
function packageResult ( bundleOrModule, body, options, methodName, isBundle ) {
|
1668
1669
|
// wrap output
|
@@ -1697,7 +1698,7 @@
|
|
1697
1698
|
map = body.generateMap({
|
1698
1699
|
includeContent: true,
|
1699
1700
|
file: sourceMapFile,
|
1700
|
-
source: ( sourceMapFile && !isBundle ) ?
|
1701
|
+
source: ( sourceMapFile && !isBundle ) ? utils_packageResult__getRelativePath( sourceMapFile, options.sourceMapSource ) : null
|
1701
1702
|
});
|
1702
1703
|
|
1703
1704
|
if ( options.sourceMap === 'inline' ) {
|
@@ -1714,9 +1715,9 @@
|
|
1714
1715
|
code: code,
|
1715
1716
|
map: map,
|
1716
1717
|
toString: function () {
|
1717
|
-
if ( !
|
1718
|
+
if ( !utils_packageResult__warned[ methodName ] ) {
|
1718
1719
|
console.log( (("Warning: esperanto." + methodName) + "() returns an object with a 'code' property. You should use this instead of using the returned value directly") );
|
1719
|
-
|
1720
|
+
utils_packageResult__warned[ methodName ] = true;
|
1720
1721
|
}
|
1721
1722
|
|
1722
1723
|
return code;
|
@@ -1724,7 +1725,7 @@
|
|
1724
1725
|
};
|
1725
1726
|
}
|
1726
1727
|
|
1727
|
-
function
|
1728
|
+
function utils_packageResult__getRelativePath ( from, to ) {
|
1728
1729
|
var fromParts, toParts, i;
|
1729
1730
|
|
1730
1731
|
fromParts = splitPath( from );
|
@@ -1856,9 +1857,9 @@
|
|
1856
1857
|
}
|
1857
1858
|
|
1858
1859
|
var intro = (("\
|
1859
|
-
\
|
1860
|
+
\ndefine(" + (processName(name))) + ("" + (processIds(ids))) + ("function (" + (names.join( ', ' ))) + ") {\
|
1860
1861
|
\n\
|
1861
|
-
\n
|
1862
|
+
\n");
|
1862
1863
|
|
1863
1864
|
if ( useStrict ) {
|
1864
1865
|
intro += (("" + indentStr) + "'use strict';\n\n");
|
@@ -1867,7 +1868,7 @@
|
|
1867
1868
|
return intro;
|
1868
1869
|
}
|
1869
1870
|
|
1870
|
-
function
|
1871
|
+
function defaultsMode_amd__amd ( mod, options ) {
|
1871
1872
|
mod.imports.forEach( function(x ) {
|
1872
1873
|
mod.body.remove( x.start, x.next );
|
1873
1874
|
});
|
@@ -1891,11 +1892,11 @@
|
|
1891
1892
|
return packageResult( mod, mod.body, options, 'toAmd' );
|
1892
1893
|
}
|
1893
1894
|
|
1894
|
-
function
|
1895
|
+
function defaultsMode_cjs__cjs ( mod, options ) {
|
1895
1896
|
var seen = {};
|
1896
1897
|
|
1897
1898
|
mod.imports.forEach( function(x ) {
|
1898
|
-
if ( !
|
1899
|
+
if ( !utils_hasOwnProp.call( seen, x.path ) ) {
|
1899
1900
|
var replacement = x.isEmpty ? (("" + (req(x.path))) + ";") : (("var " + (x.as)) + (" = " + (req(x.path))) + ";");
|
1900
1901
|
mod.body.replace( x.start, x.end, replacement );
|
1901
1902
|
|
@@ -1935,12 +1936,12 @@
|
|
1935
1936
|
if ( !hasExports && !imports.length ) {
|
1936
1937
|
intro =
|
1937
1938
|
(("(function (factory) {\
|
1938
|
-
\n
|
1939
|
-
\n
|
1940
|
-
\n
|
1941
|
-
\n
|
1939
|
+
\n !(typeof exports === 'object' && typeof module !== 'undefined') &&\
|
1940
|
+
\n typeof define === 'function' && define.amd ? define(" + (processName(amdName))) + ("factory) :\
|
1941
|
+
\n factory()\
|
1942
|
+
\n }(function () {" + useStrictPragma) + "\
|
1942
1943
|
\n\
|
1943
|
-
\n
|
1944
|
+
\n ");
|
1944
1945
|
}
|
1945
1946
|
|
1946
1947
|
else {
|
@@ -1964,7 +1965,7 @@
|
|
1964
1965
|
defaultsBlock = externalDefaults.map( function(x )
|
1965
1966
|
{return '\t' + ( x.needsNamed ? (("var " + (x.name)) + "__default") : x.name ) +
|
1966
1967
|
((" = ('default' in " + (x.name)) + (" ? " + (x.name)) + ("['default'] : " + (x.name)) + ");")}
|
1967
|
-
|
1968
|
+
).join('\n') + '\n\n';
|
1968
1969
|
}
|
1969
1970
|
} else {
|
1970
1971
|
amdExport = (("define(" + (processName(amdName))) + ("" + (processIds(ids))) + "factory)");
|
@@ -1976,12 +1977,12 @@
|
|
1976
1977
|
|
1977
1978
|
intro =
|
1978
1979
|
(("(function (global, factory) {\
|
1979
|
-
\n
|
1980
|
-
\n
|
1981
|
-
\n
|
1982
|
-
\n
|
1980
|
+
\n typeof exports === 'object' && typeof module !== 'undefined' ? " + cjsExport) + (" :\
|
1981
|
+
\n typeof define === 'function' && define.amd ? " + amdExport) + (" :\
|
1982
|
+
\n " + globalExport) + ("\
|
1983
|
+
\n }(this, function (" + (names.join( ', ' ))) + (") {" + useStrictPragma) + ("\
|
1983
1984
|
\n\
|
1984
|
-
\n
|
1985
|
+
\n " + defaultsBlock) + "");
|
1985
1986
|
|
1986
1987
|
}
|
1987
1988
|
|
@@ -2005,15 +2006,17 @@
|
|
2005
2006
|
EsperantoError.prototype.constructor = EsperantoError;
|
2006
2007
|
EsperantoError.prototype.name = 'EsperantoError';
|
2007
2008
|
|
2009
|
+
var utils_EsperantoError = EsperantoError;
|
2010
|
+
|
2008
2011
|
function requireName ( options ) {
|
2009
2012
|
if ( !options.name ) {
|
2010
|
-
throw new
|
2013
|
+
throw new utils_EsperantoError( 'You must supply a `name` option for UMD modules', {
|
2011
2014
|
code: 'MISSING_NAME'
|
2012
2015
|
});
|
2013
2016
|
}
|
2014
2017
|
}
|
2015
2018
|
|
2016
|
-
function
|
2019
|
+
function defaultsMode_umd__umd ( mod, options ) {
|
2017
2020
|
requireName( options );
|
2018
2021
|
|
2019
2022
|
mod.imports.forEach( function(x ) {
|
@@ -2038,9 +2041,9 @@
|
|
2038
2041
|
}
|
2039
2042
|
|
2040
2043
|
var defaultsMode = {
|
2041
|
-
amd:
|
2042
|
-
cjs:
|
2043
|
-
umd:
|
2044
|
+
amd: defaultsMode_amd__amd,
|
2045
|
+
cjs: defaultsMode_cjs__cjs,
|
2046
|
+
umd: defaultsMode_umd__umd
|
2044
2047
|
};
|
2045
2048
|
|
2046
2049
|
function gatherImports ( imports ) {
|
@@ -2137,14 +2140,14 @@
|
|
2137
2140
|
|
2138
2141
|
var name = assignee.name;
|
2139
2142
|
|
2140
|
-
if (
|
2143
|
+
if ( utils_hasOwnProp.call( isNamespaceAssignment ? importedNamespaces : importedBindings, name ) && !scope.contains( name ) ) {
|
2141
2144
|
throw new Error( ( isNamespaceAssignment ? namespaceMessage : bindingMessage ) + '`' + name + '`' );
|
2142
2145
|
}
|
2143
2146
|
}
|
2144
2147
|
|
2145
2148
|
function replaceIdentifiers ( body, node, identifierReplacements, scope ) {
|
2146
2149
|
var name = node.name;
|
2147
|
-
var replacement =
|
2150
|
+
var replacement = utils_hasOwnProp.call( identifierReplacements, name ) && identifierReplacements[ name ];
|
2148
2151
|
|
2149
2152
|
// TODO unchanged identifiers shouldn't have got this far -
|
2150
2153
|
// remove the `replacement !== name` safeguard once that's the case
|
@@ -2175,7 +2178,7 @@
|
|
2175
2178
|
return; // shadows an export
|
2176
2179
|
}
|
2177
2180
|
|
2178
|
-
if ( exports &&
|
2181
|
+
if ( exports && utils_hasOwnProp.call( exports, name ) ) {
|
2179
2182
|
var exportAs = exports[ name ];
|
2180
2183
|
|
2181
2184
|
if ( !!capturedUpdates ) {
|
@@ -2189,7 +2192,7 @@
|
|
2189
2192
|
var suffix = ((", exports." + exportAs) + (" = " + name) + "");
|
2190
2193
|
if ( parent.type !== 'ExpressionStatement' ) {
|
2191
2194
|
if ( !node.prefix ) {
|
2192
|
-
suffix += ((", " + name) + (" " + (node.operator === '++' ? '-' : '+')) + " 1")
|
2195
|
+
suffix += ((", " + name) + (" " + (node.operator === '++' ? '-' : '+')) + " 1");
|
2193
2196
|
}
|
2194
2197
|
prefix += ("( ");
|
2195
2198
|
suffix += (" )");
|
@@ -2363,7 +2366,7 @@
|
|
2363
2366
|
}
|
2364
2367
|
|
2365
2368
|
function deconflict ( name, declared ) {
|
2366
|
-
while (
|
2369
|
+
while ( utils_hasOwnProp.call( declared, name ) ) {
|
2367
2370
|
name = '_' + name;
|
2368
2371
|
}
|
2369
2372
|
|
@@ -2394,7 +2397,7 @@
|
|
2394
2397
|
|
2395
2398
|
// Create block of require statements
|
2396
2399
|
var importBlock = mod.imports.map( function(x ) {
|
2397
|
-
if ( !
|
2400
|
+
if ( !utils_hasOwnProp.call( seen, x.path ) ) {
|
2398
2401
|
seen[ x.path ] = true;
|
2399
2402
|
|
2400
2403
|
if ( x.isEmpty ) {
|
@@ -2452,7 +2455,7 @@
|
|
2452
2455
|
strictMode: strictMode
|
2453
2456
|
};
|
2454
2457
|
|
2455
|
-
function
|
2458
|
+
function builders_defaultsMode_amd__amd ( bundle, options ) {
|
2456
2459
|
var defaultName = bundle.entryModule.identifierReplacements.default;
|
2457
2460
|
if ( defaultName ) {
|
2458
2461
|
bundle.body.append( (("\n\nreturn " + defaultName) + ";") );
|
@@ -2469,7 +2472,7 @@
|
|
2469
2472
|
return packageResult( bundle, bundle.body, options, 'toAmd', true );
|
2470
2473
|
}
|
2471
2474
|
|
2472
|
-
function
|
2475
|
+
function builders_defaultsMode_cjs__cjs ( bundle, options ) {
|
2473
2476
|
var importBlock = bundle.externalModules.map( function(x ) {
|
2474
2477
|
return (("var " + (x.name)) + (" = " + (req(x.id))) + ";");
|
2475
2478
|
}).join( '\n' );
|
@@ -2490,7 +2493,7 @@
|
|
2490
2493
|
return packageResult( bundle, bundle.body, options, 'toCjs', true );
|
2491
2494
|
}
|
2492
2495
|
|
2493
|
-
function
|
2496
|
+
function builders_defaultsMode_umd__umd ( bundle, options ) {
|
2494
2497
|
requireName( options );
|
2495
2498
|
|
2496
2499
|
var entry = bundle.entryModule;
|
@@ -2514,9 +2517,9 @@
|
|
2514
2517
|
}
|
2515
2518
|
|
2516
2519
|
var builders_defaultsMode = {
|
2517
|
-
amd:
|
2518
|
-
cjs:
|
2519
|
-
umd:
|
2520
|
+
amd: builders_defaultsMode_amd__amd,
|
2521
|
+
cjs: builders_defaultsMode_cjs__cjs,
|
2522
|
+
umd: builders_defaultsMode_umd__umd
|
2520
2523
|
};
|
2521
2524
|
|
2522
2525
|
function getExportBlock ( entry ) {
|
@@ -2728,7 +2731,7 @@
|
|
2728
2731
|
|
2729
2732
|
bundle.modules.forEach( function(mod ) {
|
2730
2733
|
mod.imports.forEach( function(x ) {
|
2731
|
-
if (
|
2734
|
+
if ( utils_hasOwnProp.call( bundle.externalModuleLookup, x.id ) && ( !x.isDefault && !x.isBatch ) ) {
|
2732
2735
|
throw new Error( 'You can only have named external imports in strict mode (pass `strict: true`)' );
|
2733
2736
|
}
|
2734
2737
|
});
|
data/vendor/esperanto.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
/*
|
2
|
-
esperanto.js v0.6.
|
2
|
+
esperanto.js v0.6.30 - 2015-04-26
|
3
3
|
http://esperantojs.org
|
4
4
|
|
5
5
|
Released under the MIT License.
|
@@ -7,12 +7,13 @@
|
|
7
7
|
|
8
8
|
'use strict';
|
9
9
|
|
10
|
-
var path = require('path');
|
11
|
-
var sander = require('sander');
|
12
10
|
var acorn = require('acorn');
|
13
11
|
var MagicString = require('magic-string');
|
12
|
+
var _path = require('path');
|
13
|
+
var sander = require('sander');
|
14
14
|
|
15
15
|
var hasOwnProp = Object.prototype.hasOwnProperty;
|
16
|
+
var utils_hasOwnProp = hasOwnProp;
|
16
17
|
|
17
18
|
function hasNamedImports ( mod ) {
|
18
19
|
var i = mod.imports.length;
|
@@ -38,29 +39,29 @@ function walk ( ast, leave) {var enter = leave.enter, leave = leave.leave;
|
|
38
39
|
visit( ast, null, enter, leave );
|
39
40
|
}
|
40
41
|
|
41
|
-
var
|
42
|
-
skip: function() {return
|
42
|
+
var ast_walk__context = {
|
43
|
+
skip: function() {return ast_walk__context.shouldSkip = true}
|
43
44
|
};
|
44
45
|
|
45
|
-
var
|
46
|
+
var ast_walk__childKeys = {};
|
46
47
|
|
47
|
-
var
|
48
|
+
var ast_walk__toString = Object.prototype.toString;
|
48
49
|
|
49
50
|
function isArray ( thing ) {
|
50
|
-
return
|
51
|
+
return ast_walk__toString.call( thing ) === '[object Array]';
|
51
52
|
}
|
52
53
|
|
53
54
|
function visit ( node, parent, enter, leave ) {
|
54
55
|
if ( !node ) return;
|
55
56
|
|
56
57
|
if ( enter ) {
|
57
|
-
|
58
|
-
enter.call(
|
59
|
-
if (
|
58
|
+
ast_walk__context.shouldSkip = false;
|
59
|
+
enter.call( ast_walk__context, node, parent );
|
60
|
+
if ( ast_walk__context.shouldSkip ) return;
|
60
61
|
}
|
61
62
|
|
62
|
-
var keys =
|
63
|
-
|
63
|
+
var keys = ast_walk__childKeys[ node.type ] || (
|
64
|
+
ast_walk__childKeys[ node.type ] = Object.keys( node ).filter( function(key ) {return typeof node[ key ] === 'object'} )
|
64
65
|
);
|
65
66
|
|
66
67
|
var key, value, i, j;
|
@@ -357,8 +358,6 @@ function processImport ( node, passthrough ) {
|
|
357
358
|
|
358
359
|
path: node.source.value,
|
359
360
|
specifiers: node.specifiers.map( function(s ) {
|
360
|
-
var id;
|
361
|
-
|
362
361
|
if ( s.type === 'ImportNamespaceSpecifier' ) {
|
363
362
|
return {
|
364
363
|
isBatch: true,
|
@@ -372,7 +371,7 @@ function processImport ( node, passthrough ) {
|
|
372
371
|
isDefault: true,
|
373
372
|
name: 'default',
|
374
373
|
as: s.local.name
|
375
|
-
}
|
374
|
+
};
|
376
375
|
}
|
377
376
|
|
378
377
|
return {
|
@@ -513,7 +512,7 @@ function getUnscopedNames ( mod ) {
|
|
513
512
|
});
|
514
513
|
});
|
515
514
|
}
|
516
|
-
return
|
515
|
+
return utils_hasOwnProp.call( importedNames, name );
|
517
516
|
}
|
518
517
|
|
519
518
|
walk( mod.ast, {
|
@@ -565,7 +564,7 @@ function disallowConflictingImports ( imports ) {
|
|
565
564
|
}
|
566
565
|
|
567
566
|
function checkName ( name ) {
|
568
|
-
if (
|
567
|
+
if ( utils_hasOwnProp.call( usedNames, name ) ) {
|
569
568
|
throw new SyntaxError( (("Duplicated import ('" + name) + "')") );
|
570
569
|
}
|
571
570
|
|
@@ -661,7 +660,7 @@ function determineImportNames ( imports, userFn, usedNames ) {
|
|
661
660
|
moduleId = x.path;
|
662
661
|
|
663
662
|
// use existing value
|
664
|
-
if (
|
663
|
+
if ( utils_hasOwnProp.call( nameById, moduleId ) ) {
|
665
664
|
x.name = nameById[ moduleId ];
|
666
665
|
return;
|
667
666
|
}
|
@@ -670,7 +669,7 @@ function determineImportNames ( imports, userFn, usedNames ) {
|
|
670
669
|
if ( userFn && ( name = userFn( moduleId ) ) ) {
|
671
670
|
name = sanitize( name );
|
672
671
|
|
673
|
-
if (
|
672
|
+
if ( utils_hasOwnProp.call( usedNames, name ) ) {
|
674
673
|
// TODO write a test for this
|
675
674
|
throw new Error( (("Naming collision: module " + moduleId) + (" cannot be called " + name) + "") );
|
676
675
|
}
|
@@ -687,7 +686,7 @@ function determineImportNames ( imports, userFn, usedNames ) {
|
|
687
686
|
while ( i-- > 0 ) {
|
688
687
|
candidate = prefix + sanitize( parts.slice( i ).join( '__' ) );
|
689
688
|
|
690
|
-
if ( !
|
689
|
+
if ( !utils_hasOwnProp.call( usedNames, candidate ) ) {
|
691
690
|
name = candidate;
|
692
691
|
break;
|
693
692
|
}
|
@@ -706,13 +705,13 @@ function determineImportNames ( imports, userFn, usedNames ) {
|
|
706
705
|
// use inferred names for default imports, wherever they
|
707
706
|
// don't clash with path-based names
|
708
707
|
imports.forEach( function(x ) {
|
709
|
-
if ( x.as && !
|
708
|
+
if ( x.as && !utils_hasOwnProp.call( usedNames, x.as ) ) {
|
710
709
|
inferredNames[ x.path ] = x.as;
|
711
710
|
}
|
712
711
|
});
|
713
712
|
|
714
713
|
imports.forEach( function(x ) {
|
715
|
-
if (
|
714
|
+
if ( utils_hasOwnProp.call( inferredNames, x.path ) ) {
|
716
715
|
x.name = inferredNames[ x.path ];
|
717
716
|
}
|
718
717
|
});
|
@@ -754,20 +753,28 @@ function resolveAgainst ( importerPath ) {
|
|
754
753
|
}
|
755
754
|
|
756
755
|
function sortModules ( entry, moduleLookup ) {
|
757
|
-
var seen = {}
|
758
|
-
|
756
|
+
var seen = {};
|
757
|
+
var ordered = [];
|
758
|
+
var swapPairs = [];
|
759
759
|
|
760
760
|
function visit ( mod ) {
|
761
|
-
// ignore external modules, and modules we've
|
762
|
-
// already included
|
763
|
-
if ( !mod || hasOwnProp.call( seen, mod.id ) ) {
|
764
|
-
return;
|
765
|
-
}
|
766
|
-
|
767
761
|
seen[ mod.id ] = true;
|
768
762
|
|
769
763
|
mod.imports.forEach( function(x ) {
|
770
|
-
|
764
|
+
var imported = moduleLookup[ x.id ];
|
765
|
+
|
766
|
+
if ( !imported ) return;
|
767
|
+
|
768
|
+
// ignore modules we've already included
|
769
|
+
if ( utils_hasOwnProp.call( seen, imported.id ) ) {
|
770
|
+
if ( shouldSwap( imported, mod ) ) {
|
771
|
+
swapPairs.push([ imported, mod ]);
|
772
|
+
}
|
773
|
+
|
774
|
+
return;
|
775
|
+
}
|
776
|
+
|
777
|
+
visit( imported );
|
771
778
|
});
|
772
779
|
|
773
780
|
ordered.push( mod );
|
@@ -775,9 +782,66 @@ function sortModules ( entry, moduleLookup ) {
|
|
775
782
|
|
776
783
|
visit( entry );
|
777
784
|
|
785
|
+
swapPairs.forEach( function(b) {var a = b[0], b = b[1];
|
786
|
+
var aIndex = ordered.indexOf( a );
|
787
|
+
var bIndex = ordered.indexOf( b );
|
788
|
+
|
789
|
+
ordered[ aIndex ] = b;
|
790
|
+
ordered[ bIndex ] = a;
|
791
|
+
});
|
792
|
+
|
778
793
|
return ordered;
|
779
794
|
}
|
780
795
|
|
796
|
+
function shouldSwap ( a, b ) {
|
797
|
+
// if these modules don't import each other, abort
|
798
|
+
if ( !( utils_sortModules__imports( a, b ) && utils_sortModules__imports( b, a ) ) ) return;
|
799
|
+
|
800
|
+
return usesAtTopLevel( b, a ) && !usesAtTopLevel( a, b );
|
801
|
+
}
|
802
|
+
|
803
|
+
function utils_sortModules__imports ( a, b ) {
|
804
|
+
var i = a.imports.length;
|
805
|
+
while ( i-- ) {
|
806
|
+
if ( a.imports[i].id === b.id ) {
|
807
|
+
return true;
|
808
|
+
}
|
809
|
+
}
|
810
|
+
}
|
811
|
+
|
812
|
+
function usesAtTopLevel ( a, b ) {
|
813
|
+
var bindings = [];
|
814
|
+
|
815
|
+
// find out which bindings a imports from b
|
816
|
+
var i = a.imports.length;
|
817
|
+
while ( i-- ) {
|
818
|
+
if ( a.imports[i].id === b.id ) {
|
819
|
+
bindings.push.apply( bindings, a.imports[i].specifiers.map( function(x ) {return x.as} ) );
|
820
|
+
}
|
821
|
+
}
|
822
|
+
|
823
|
+
// see if any of those bindings are referenced at the top level
|
824
|
+
var referencedAtTopLevel = false;
|
825
|
+
|
826
|
+
walk( a.ast, {
|
827
|
+
enter: function ( node ) {
|
828
|
+
if ( referencedAtTopLevel ) {
|
829
|
+
return this.skip();
|
830
|
+
}
|
831
|
+
|
832
|
+
if ( /^Import/.test( node.type ) || ( node._scope && node._scope.parent ) ) {
|
833
|
+
return this.skip();
|
834
|
+
}
|
835
|
+
|
836
|
+
if ( node.type === 'Identifier' && ~bindings.indexOf( node.name ) ) {
|
837
|
+
referencedAtTopLevel = true;
|
838
|
+
}
|
839
|
+
}
|
840
|
+
});
|
841
|
+
|
842
|
+
return referencedAtTopLevel;
|
843
|
+
}
|
844
|
+
|
781
845
|
function resolveChains ( modules, moduleLookup ) {
|
782
846
|
var chains = {};
|
783
847
|
|
@@ -790,7 +854,7 @@ function resolveChains ( modules, moduleLookup ) {
|
|
790
854
|
if ( s.isBatch ) {
|
791
855
|
// if this is an internal module, we need to tell that module that
|
792
856
|
// it needs to export an object full of getters
|
793
|
-
if (
|
857
|
+
if ( utils_hasOwnProp.call( moduleLookup, x.id ) ) {
|
794
858
|
moduleLookup[ x.id ]._exportsNamespace = true;
|
795
859
|
}
|
796
860
|
|
@@ -805,7 +869,7 @@ function resolveChains ( modules, moduleLookup ) {
|
|
805
869
|
if ( !x.specifiers ) return;
|
806
870
|
|
807
871
|
x.specifiers.forEach( function(s ) {
|
808
|
-
if (
|
872
|
+
if ( utils_hasOwnProp.call( origin, s.name ) ) {
|
809
873
|
chains[ (("" + (mod.id)) + ("@" + (s.name)) + "") ] = origin[ s.name ];
|
810
874
|
}
|
811
875
|
});
|
@@ -843,7 +907,7 @@ function getUniqueNames ( bundle ) {
|
|
843
907
|
// infer names from default imports - e.g. with `import _ from './utils'`,
|
844
908
|
// use '_' instead of generating a name from 'utils'
|
845
909
|
function inferName ( x ) {
|
846
|
-
if ( x.isDefault && !
|
910
|
+
if ( x.isDefault && !utils_hasOwnProp.call( names, x.id ) && !utils_hasOwnProp.call( used, x.as ) ) {
|
847
911
|
names[ x.id ] = x.as;
|
848
912
|
used[ x.as ] = true;
|
849
913
|
}
|
@@ -856,7 +920,7 @@ function getUniqueNames ( bundle ) {
|
|
856
920
|
// introducing conflicts
|
857
921
|
modules.concat( externalModules ).forEach( function(mod ) {
|
858
922
|
// is this already named?
|
859
|
-
if (
|
923
|
+
if ( utils_hasOwnProp.call( names, mod.id ) ) {
|
860
924
|
mod.name = names[ mod.id ];
|
861
925
|
return;
|
862
926
|
}
|
@@ -868,12 +932,12 @@ function getUniqueNames ( bundle ) {
|
|
868
932
|
while ( i-- ) {
|
869
933
|
name = sanitize( parts.slice( i ).join( '_' ) );
|
870
934
|
|
871
|
-
if ( !
|
935
|
+
if ( !utils_hasOwnProp.call( used, name ) ) {
|
872
936
|
break;
|
873
937
|
}
|
874
938
|
}
|
875
939
|
|
876
|
-
while (
|
940
|
+
while ( utils_hasOwnProp.call( used, name ) ) {
|
877
941
|
name = '_' + name;
|
878
942
|
}
|
879
943
|
|
@@ -944,7 +1008,7 @@ function topLevelScopeConflicts ( bundle ) {
|
|
944
1008
|
|
945
1009
|
// merge this module's top scope with bundle top scope
|
946
1010
|
names.forEach( function(name ) {
|
947
|
-
if (
|
1011
|
+
if ( utils_hasOwnProp.call( inBundle, name ) ) {
|
948
1012
|
conflicts[ name ] = true;
|
949
1013
|
} else {
|
950
1014
|
inBundle[ name ] = true;
|
@@ -968,11 +1032,11 @@ function populateIdentifierReplacements ( bundle ) {
|
|
968
1032
|
var result;
|
969
1033
|
|
970
1034
|
if ( x.hasDeclaration && x.name ) {
|
971
|
-
result =
|
1035
|
+
result = utils_hasOwnProp.call( conflicts, x.name ) || otherModulesDeclare( mod, x.name ) ?
|
972
1036
|
(("" + (mod.name)) + ("__" + (x.name)) + "") :
|
973
1037
|
x.name;
|
974
1038
|
} else {
|
975
|
-
result =
|
1039
|
+
result = utils_hasOwnProp.call( conflicts, mod.name ) || ( x.value !== mod.name && ~mod.ast._topLevelNames.indexOf( mod.name )) || otherModulesDeclare( mod, mod.name ) ?
|
976
1040
|
(("" + (mod.name)) + "__default") :
|
977
1041
|
mod.name;
|
978
1042
|
}
|
@@ -987,7 +1051,7 @@ function populateIdentifierReplacements ( bundle ) {
|
|
987
1051
|
var moduleIdentifiers = mod.identifierReplacements;
|
988
1052
|
|
989
1053
|
mod.ast._topLevelNames.forEach( function(n ) {
|
990
|
-
moduleIdentifiers[n] =
|
1054
|
+
moduleIdentifiers[n] = utils_hasOwnProp.call( conflicts, n ) ?
|
991
1055
|
(("" + (mod.name)) + ("__" + n) + "") :
|
992
1056
|
n;
|
993
1057
|
});
|
@@ -999,7 +1063,7 @@ function populateIdentifierReplacements ( bundle ) {
|
|
999
1063
|
return;
|
1000
1064
|
}
|
1001
1065
|
|
1002
|
-
externalModule =
|
1066
|
+
externalModule = utils_hasOwnProp.call( bundle.externalModuleLookup, x.id ) && bundle.externalModuleLookup[ x.id ];
|
1003
1067
|
|
1004
1068
|
x.specifiers.forEach( function(s ) {
|
1005
1069
|
var moduleId, mod, moduleName, specifierName, replacement, hash, isChained, separatorIndex;
|
@@ -1015,7 +1079,7 @@ function populateIdentifierReplacements ( bundle ) {
|
|
1015
1079
|
|
1016
1080
|
// If this is a chained import, get the origin
|
1017
1081
|
hash = (("" + moduleId) + ("@" + specifierName) + "");
|
1018
|
-
while (
|
1082
|
+
while ( utils_hasOwnProp.call( bundle.chains, hash ) ) {
|
1019
1083
|
hash = bundle.chains[ hash ];
|
1020
1084
|
isChained = true;
|
1021
1085
|
}
|
@@ -1043,7 +1107,7 @@ function populateIdentifierReplacements ( bundle ) {
|
|
1043
1107
|
replacement = mod.identifierReplacements.default;
|
1044
1108
|
}
|
1045
1109
|
} else if ( !externalModule ) {
|
1046
|
-
replacement =
|
1110
|
+
replacement = utils_hasOwnProp.call( conflicts, specifierName ) ?
|
1047
1111
|
(("" + moduleName) + ("__" + specifierName) + "") :
|
1048
1112
|
specifierName;
|
1049
1113
|
} else {
|
@@ -1069,7 +1133,7 @@ function populateIdentifierReplacements ( bundle ) {
|
|
1069
1133
|
continue;
|
1070
1134
|
}
|
1071
1135
|
|
1072
|
-
if (
|
1136
|
+
if ( utils_hasOwnProp.call( otherMod.ast._declared, replacement ) ) {
|
1073
1137
|
return true;
|
1074
1138
|
}
|
1075
1139
|
}
|
@@ -1161,14 +1225,14 @@ function disallowIllegalReassignment ( node, importedBindings, importedNamespace
|
|
1161
1225
|
|
1162
1226
|
var name = assignee.name;
|
1163
1227
|
|
1164
|
-
if (
|
1228
|
+
if ( utils_hasOwnProp.call( isNamespaceAssignment ? importedNamespaces : importedBindings, name ) && !scope.contains( name ) ) {
|
1165
1229
|
throw new Error( ( isNamespaceAssignment ? namespaceMessage : bindingMessage ) + '`' + name + '`' );
|
1166
1230
|
}
|
1167
1231
|
}
|
1168
1232
|
|
1169
1233
|
function replaceIdentifiers ( body, node, identifierReplacements, scope ) {
|
1170
1234
|
var name = node.name;
|
1171
|
-
var replacement =
|
1235
|
+
var replacement = utils_hasOwnProp.call( identifierReplacements, name ) && identifierReplacements[ name ];
|
1172
1236
|
|
1173
1237
|
// TODO unchanged identifiers shouldn't have got this far -
|
1174
1238
|
// remove the `replacement !== name` safeguard once that's the case
|
@@ -1199,7 +1263,7 @@ function rewriteExportAssignments ( body, node, parent, exports, scope, captured
|
|
1199
1263
|
return; // shadows an export
|
1200
1264
|
}
|
1201
1265
|
|
1202
|
-
if ( exports &&
|
1266
|
+
if ( exports && utils_hasOwnProp.call( exports, name ) ) {
|
1203
1267
|
var exportAs = exports[ name ];
|
1204
1268
|
|
1205
1269
|
if ( !!capturedUpdates ) {
|
@@ -1213,7 +1277,7 @@ function rewriteExportAssignments ( body, node, parent, exports, scope, captured
|
|
1213
1277
|
var suffix = ((", exports." + exportAs) + (" = " + name) + "");
|
1214
1278
|
if ( parent.type !== 'ExpressionStatement' ) {
|
1215
1279
|
if ( !node.prefix ) {
|
1216
|
-
suffix += ((", " + name) + (" " + (node.operator === '++' ? '-' : '+')) + " 1")
|
1280
|
+
suffix += ((", " + name) + (" " + (node.operator === '++' ? '-' : '+')) + " 1");
|
1217
1281
|
}
|
1218
1282
|
prefix += ("( ");
|
1219
1283
|
suffix += (" )");
|
@@ -1296,11 +1360,11 @@ function exportCapturedUpdate ( c ) {
|
|
1296
1360
|
return ((" exports." + (c.exportAs)) + (" = " + (c.name)) + ";");
|
1297
1361
|
}
|
1298
1362
|
|
1299
|
-
function
|
1363
|
+
function combine_transformBody__transformBody ( bundle, mod, body ) {
|
1300
1364
|
var identifierReplacements = mod.identifierReplacements;
|
1301
1365
|
var importedBindings = (importedNamespaces = getReadOnlyIdentifiers( mod.imports ))[0], importedNamespaces = importedNamespaces[1];
|
1302
1366
|
|
1303
|
-
var exportNames =
|
1367
|
+
var exportNames = utils_hasOwnProp.call( bundle.exports, mod.id ) && bundle.exports[ mod.id ];
|
1304
1368
|
|
1305
1369
|
traverseAst( mod.ast, body, identifierReplacements, importedBindings, importedNamespaces, exportNames );
|
1306
1370
|
|
@@ -1338,7 +1402,7 @@ function transformBody__transformBody ( bundle, mod, body ) {
|
|
1338
1402
|
if ( name === identifierReplacements.default ) {
|
1339
1403
|
body.remove( x.start, x.end );
|
1340
1404
|
} else {
|
1341
|
-
var original =
|
1405
|
+
var original = utils_hasOwnProp.call( identifierReplacements, name ) ? identifierReplacements[ name ] : name;
|
1342
1406
|
body.replace( x.start, x.end, (("var " + (identifierReplacements.default)) + (" = " + original) + ";") );
|
1343
1407
|
}
|
1344
1408
|
}
|
@@ -1444,8 +1508,8 @@ function combine ( bundle ) {
|
|
1444
1508
|
});
|
1445
1509
|
|
1446
1510
|
bundle.body.addSource({
|
1447
|
-
filename:
|
1448
|
-
content:
|
1511
|
+
filename: _path.resolve( bundle.base, mod.relativePath ),
|
1512
|
+
content: combine_transformBody__transformBody( bundle, mod, mod.body ),
|
1449
1513
|
indentExclusionRanges: mod.ast._templateLiteralRanges
|
1450
1514
|
});
|
1451
1515
|
});
|
@@ -1518,7 +1582,7 @@ function getModule ( mod ) {
|
|
1518
1582
|
return mod;
|
1519
1583
|
}
|
1520
1584
|
|
1521
|
-
var
|
1585
|
+
var bundler_getBundle__Promise = sander.Promise;
|
1522
1586
|
|
1523
1587
|
function getBundle ( options ) {
|
1524
1588
|
var entry = options.entry.replace( /\.js$/, '' );
|
@@ -1528,7 +1592,7 @@ function getBundle ( options ) {
|
|
1528
1592
|
var promiseByPath = {};
|
1529
1593
|
var skip = options.skip;
|
1530
1594
|
var names = options.names;
|
1531
|
-
var base = ( options.base ?
|
1595
|
+
var base = ( options.base ? _path.resolve( options.base ) : process.cwd() ) + '/';
|
1532
1596
|
var externalModules = [];
|
1533
1597
|
var externalModuleLookup = {};
|
1534
1598
|
|
@@ -1539,7 +1603,7 @@ function getBundle ( options ) {
|
|
1539
1603
|
return resolvePath( base, userModules, entry, null ).then( function(relativePath ) {
|
1540
1604
|
return fetchModule( entry, relativePath ).then( function() {
|
1541
1605
|
var entryModule = moduleLookup[ entry ];
|
1542
|
-
modules = sortModules( entryModule, moduleLookup );
|
1606
|
+
modules = sortModules( entryModule, moduleLookup );
|
1543
1607
|
|
1544
1608
|
var bundle = {
|
1545
1609
|
entry: entry,
|
@@ -1567,12 +1631,12 @@ function getBundle ( options ) {
|
|
1567
1631
|
});
|
1568
1632
|
|
1569
1633
|
function fetchModule ( moduleId, relativePath ) {
|
1570
|
-
var absolutePath =
|
1634
|
+
var absolutePath = _path.resolve( base, relativePath );
|
1571
1635
|
|
1572
|
-
if ( !
|
1636
|
+
if ( !utils_hasOwnProp.call( promiseByPath, relativePath ) ) {
|
1573
1637
|
promiseByPath[ relativePath ] = (
|
1574
|
-
|
1575
|
-
|
1638
|
+
utils_hasOwnProp.call( userModules, relativePath ) ?
|
1639
|
+
bundler_getBundle__Promise.resolve( userModules[ relativePath ] ) :
|
1576
1640
|
sander.readFile( absolutePath ).then( String )
|
1577
1641
|
).then( function ( source ) {
|
1578
1642
|
var code, ast;
|
@@ -1619,7 +1683,7 @@ function getBundle ( options ) {
|
|
1619
1683
|
|
1620
1684
|
return resolvePath( base, userModules, x.id, absolutePath, options.resolvePath ).then( function(relativePath ) {
|
1621
1685
|
// short-circuit cycles
|
1622
|
-
if (
|
1686
|
+
if ( utils_hasOwnProp.call( promiseByPath, relativePath ) ) {
|
1623
1687
|
return;
|
1624
1688
|
}
|
1625
1689
|
|
@@ -1627,7 +1691,7 @@ function getBundle ( options ) {
|
|
1627
1691
|
}, function handleError ( err ) {
|
1628
1692
|
if ( err.code === 'ENOENT' ) {
|
1629
1693
|
// Most likely an external module
|
1630
|
-
if ( !
|
1694
|
+
if ( !utils_hasOwnProp.call( externalModuleLookup, x.id ) ) {
|
1631
1695
|
var externalModule = {
|
1632
1696
|
id: x.id
|
1633
1697
|
};
|
@@ -1641,7 +1705,7 @@ function getBundle ( options ) {
|
|
1641
1705
|
} );
|
1642
1706
|
});
|
1643
1707
|
|
1644
|
-
return
|
1708
|
+
return bundler_getBundle__Promise.all( promises );
|
1645
1709
|
});
|
1646
1710
|
}
|
1647
1711
|
|
@@ -1651,9 +1715,9 @@ function getBundle ( options ) {
|
|
1651
1715
|
|
1652
1716
|
function resolvePath ( base, userModules, moduleId, importerPath, resolver ) {
|
1653
1717
|
return tryPath( base, moduleId + '.js', userModules )
|
1654
|
-
.catch( function() {return tryPath( base, moduleId +
|
1718
|
+
.catch( function() {return tryPath( base, moduleId + _path.sep + 'index.js', userModules )} )
|
1655
1719
|
.catch( function ( err ) {
|
1656
|
-
var resolvedPromise = resolver &&
|
1720
|
+
var resolvedPromise = resolver && bundler_getBundle__Promise.resolve( resolver( moduleId, importerPath ) );
|
1657
1721
|
|
1658
1722
|
if ( resolvedPromise ) {
|
1659
1723
|
return resolvedPromise.then( function(resolvedPath ) {
|
@@ -1673,8 +1737,8 @@ function resolvePath ( base, userModules, moduleId, importerPath, resolver ) {
|
|
1673
1737
|
}
|
1674
1738
|
|
1675
1739
|
function tryPath ( base, filename, userModules ) {
|
1676
|
-
if (
|
1677
|
-
return
|
1740
|
+
if ( utils_hasOwnProp.call( userModules, filename ) ) {
|
1741
|
+
return bundler_getBundle__Promise.resolve( filename );
|
1678
1742
|
}
|
1679
1743
|
return sander.stat( base, filename ).then( function() {return filename} );
|
1680
1744
|
}
|
@@ -1731,7 +1795,7 @@ function transformExportDeclaration ( declaration, body ) {
|
|
1731
1795
|
|
1732
1796
|
var ABSOLUTE_PATH = /^(?:[A-Z]:)?[\/\\]/i;
|
1733
1797
|
|
1734
|
-
var
|
1798
|
+
var utils_packageResult__warned = {};
|
1735
1799
|
|
1736
1800
|
function packageResult ( bundleOrModule, body, options, methodName, isBundle ) {
|
1737
1801
|
// wrap output
|
@@ -1783,9 +1847,9 @@ function packageResult ( bundleOrModule, body, options, methodName, isBundle ) {
|
|
1783
1847
|
code: code,
|
1784
1848
|
map: map,
|
1785
1849
|
toString: function () {
|
1786
|
-
if ( !
|
1850
|
+
if ( !utils_packageResult__warned[ methodName ] ) {
|
1787
1851
|
console.log( (("Warning: esperanto." + methodName) + "() returns an object with a 'code' property. You should use this instead of using the returned value directly") );
|
1788
|
-
|
1852
|
+
utils_packageResult__warned[ methodName ] = true;
|
1789
1853
|
}
|
1790
1854
|
|
1791
1855
|
return code;
|
@@ -1901,7 +1965,7 @@ function amdIntro (useStrict) {var name = useStrict.name, imports = useStrict.im
|
|
1901
1965
|
return intro;
|
1902
1966
|
}
|
1903
1967
|
|
1904
|
-
function
|
1968
|
+
function defaultsMode_amd__amd ( mod, options ) {
|
1905
1969
|
mod.imports.forEach( function(x ) {
|
1906
1970
|
mod.body.remove( x.start, x.next );
|
1907
1971
|
});
|
@@ -1925,11 +1989,11 @@ function amd__amd ( mod, options ) {
|
|
1925
1989
|
return packageResult( mod, mod.body, options, 'toAmd' );
|
1926
1990
|
}
|
1927
1991
|
|
1928
|
-
function
|
1992
|
+
function defaultsMode_cjs__cjs ( mod, options ) {
|
1929
1993
|
var seen = {};
|
1930
1994
|
|
1931
1995
|
mod.imports.forEach( function(x ) {
|
1932
|
-
if ( !
|
1996
|
+
if ( !utils_hasOwnProp.call( seen, x.path ) ) {
|
1933
1997
|
var replacement = x.isEmpty ? (("" + (req(x.path))) + ";") : (("var " + (x.as)) + (" = " + (req(x.path))) + ";");
|
1934
1998
|
mod.body.replace( x.start, x.end, replacement );
|
1935
1999
|
|
@@ -2039,15 +2103,17 @@ EsperantoError.prototype = new Error();
|
|
2039
2103
|
EsperantoError.prototype.constructor = EsperantoError;
|
2040
2104
|
EsperantoError.prototype.name = 'EsperantoError';
|
2041
2105
|
|
2106
|
+
var utils_EsperantoError = EsperantoError;
|
2107
|
+
|
2042
2108
|
function requireName ( options ) {
|
2043
2109
|
if ( !options.name ) {
|
2044
|
-
throw new
|
2110
|
+
throw new utils_EsperantoError( 'You must supply a `name` option for UMD modules', {
|
2045
2111
|
code: 'MISSING_NAME'
|
2046
2112
|
});
|
2047
2113
|
}
|
2048
2114
|
}
|
2049
2115
|
|
2050
|
-
function
|
2116
|
+
function defaultsMode_umd__umd ( mod, options ) {
|
2051
2117
|
requireName( options );
|
2052
2118
|
|
2053
2119
|
mod.imports.forEach( function(x ) {
|
@@ -2072,9 +2138,9 @@ function umd__umd ( mod, options ) {
|
|
2072
2138
|
}
|
2073
2139
|
|
2074
2140
|
var defaultsMode = {
|
2075
|
-
amd:
|
2076
|
-
cjs:
|
2077
|
-
umd:
|
2141
|
+
amd: defaultsMode_amd__amd,
|
2142
|
+
cjs: defaultsMode_cjs__cjs,
|
2143
|
+
umd: defaultsMode_umd__umd
|
2078
2144
|
};
|
2079
2145
|
|
2080
2146
|
function gatherImports ( imports ) {
|
@@ -2211,7 +2277,7 @@ function utils_transformBody__transformBody ( mod, body, options ) {
|
|
2211
2277
|
}
|
2212
2278
|
|
2213
2279
|
function deconflict ( name, declared ) {
|
2214
|
-
while (
|
2280
|
+
while ( utils_hasOwnProp.call( declared, name ) ) {
|
2215
2281
|
name = '_' + name;
|
2216
2282
|
}
|
2217
2283
|
|
@@ -2242,7 +2308,7 @@ function strictMode_cjs__cjs ( mod, options ) {
|
|
2242
2308
|
|
2243
2309
|
// Create block of require statements
|
2244
2310
|
var importBlock = mod.imports.map( function(x ) {
|
2245
|
-
if ( !
|
2311
|
+
if ( !utils_hasOwnProp.call( seen, x.path ) ) {
|
2246
2312
|
seen[ x.path ] = true;
|
2247
2313
|
|
2248
2314
|
if ( x.isEmpty ) {
|
@@ -2300,7 +2366,7 @@ var moduleBuilders = {
|
|
2300
2366
|
strictMode: strictMode
|
2301
2367
|
};
|
2302
2368
|
|
2303
|
-
function
|
2369
|
+
function builders_defaultsMode_amd__amd ( bundle, options ) {
|
2304
2370
|
var defaultName = bundle.entryModule.identifierReplacements.default;
|
2305
2371
|
if ( defaultName ) {
|
2306
2372
|
bundle.body.append( (("\n\nreturn " + defaultName) + ";") );
|
@@ -2317,7 +2383,7 @@ function defaultsMode_amd__amd ( bundle, options ) {
|
|
2317
2383
|
return packageResult( bundle, bundle.body, options, 'toAmd', true );
|
2318
2384
|
}
|
2319
2385
|
|
2320
|
-
function
|
2386
|
+
function builders_defaultsMode_cjs__cjs ( bundle, options ) {
|
2321
2387
|
var importBlock = bundle.externalModules.map( function(x ) {
|
2322
2388
|
return (("var " + (x.name)) + (" = " + (req(x.id))) + ";");
|
2323
2389
|
}).join( '\n' );
|
@@ -2338,7 +2404,7 @@ function defaultsMode_cjs__cjs ( bundle, options ) {
|
|
2338
2404
|
return packageResult( bundle, bundle.body, options, 'toCjs', true );
|
2339
2405
|
}
|
2340
2406
|
|
2341
|
-
function
|
2407
|
+
function builders_defaultsMode_umd__umd ( bundle, options ) {
|
2342
2408
|
requireName( options );
|
2343
2409
|
|
2344
2410
|
var entry = bundle.entryModule;
|
@@ -2362,9 +2428,9 @@ function defaultsMode_umd__umd ( bundle, options ) {
|
|
2362
2428
|
}
|
2363
2429
|
|
2364
2430
|
var builders_defaultsMode = {
|
2365
|
-
amd:
|
2366
|
-
cjs:
|
2367
|
-
umd:
|
2431
|
+
amd: builders_defaultsMode_amd__amd,
|
2432
|
+
cjs: builders_defaultsMode_cjs__cjs,
|
2433
|
+
umd: builders_defaultsMode_umd__umd
|
2368
2434
|
};
|
2369
2435
|
|
2370
2436
|
function getExportBlock ( entry ) {
|
@@ -2576,7 +2642,7 @@ var esperanto = {
|
|
2576
2642
|
|
2577
2643
|
bundle.modules.forEach( function(mod ) {
|
2578
2644
|
mod.imports.forEach( function(x ) {
|
2579
|
-
if (
|
2645
|
+
if ( utils_hasOwnProp.call( bundle.externalModuleLookup, x.id ) && ( !x.isDefault && !x.isBatch ) ) {
|
2580
2646
|
throw new Error( 'You can only have named external imports in strict mode (pass `strict: true`)' );
|
2581
2647
|
}
|
2582
2648
|
});
|
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.
|
4
|
+
version: 0.6.30
|
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-
|
11
|
+
date: 2015-04-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|