esperanto-source 0.6.11 → 0.6.12

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d8635fadd4a3ed4cb39f5efa5367a34f1283dc7a
4
- data.tar.gz: 9cbd863d7d4448d891054486108fa35d14dbcd03
3
+ metadata.gz: 8d3a38527ae2716f01b7c709513abbde27bd53c1
4
+ data.tar.gz: 399a28496cfa10ad15a4e8e37deb4f0baece6a54
5
5
  SHA512:
6
- metadata.gz: 85d9e6571545fd796263690e92da21881b8f1b48236fc19d5a7249aab99dcca136d0ca72b6e566d95fd0f372c234999e33e4beea3f480dc2acfcc2c49bd6e49d
7
- data.tar.gz: 46b7683b40cc0e3c5e05af61a86273c173bf174b45bcbf9adb2c726eaac86c6773a3296f989f33f93a91be4511f4f1de97c5b37f6f02b1358811c6330a548717
6
+ metadata.gz: 712611a44bc8d7c3932a49f1266c7f3b7df74fc789aa8ec179b55aa3c6157328873a62ded8e2231c9e9ebfb9b20065b97bbc97186446d4b94505a50c7df6ba40
7
+ data.tar.gz: 1e533cf64c625262113c8f04b83c905061ac823936a1c20cae772f4c6c1f606efdc3a297aa3f881adb01301b391e965b3a4711fd0378ca71825198ef358a4a91
@@ -1,5 +1,5 @@
1
1
  module Esperanto
2
2
  module Source
3
- VERSION = '0.6.11'
3
+ VERSION = '0.6.12'
4
4
  end
5
5
  end
@@ -1,5 +1,5 @@
1
1
  /*
2
- esperanto.js v0.6.11 - 2015-02-08
2
+ esperanto.js v0.6.12 - 2015-02-09
3
3
  http://esperantojs.org
4
4
 
5
5
  Released under the MIT License.
data/vendor/esperanto.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*
2
- esperanto.js v0.6.11 - 2015-02-08
2
+ esperanto.js v0.6.12 - 2015-02-09
3
3
  http://esperantojs.org
4
4
 
5
5
  Released under the MIT License.
@@ -1367,7 +1367,7 @@ function getBundle ( options ) {
1367
1367
  var entry = options.entry.replace( /\.js$/, '' ),
1368
1368
  modules = [],
1369
1369
  moduleLookup = {},
1370
- promiseById = {},
1370
+ promiseByPath = {},
1371
1371
  skip = options.skip,
1372
1372
  names = options.names,
1373
1373
  base = ( options.base ? path.resolve( options.base ) : process.cwd() ) + '/',
@@ -1378,98 +1378,102 @@ function getBundle ( options ) {
1378
1378
  entry = entry.substring( base.length );
1379
1379
  }
1380
1380
 
1381
- return fetchModule( entry, null ).then( function() {
1382
- var entryModule, bundle;
1383
-
1384
- entryModule = moduleLookup[ entry ];
1385
- modules = sortModules( entryModule, moduleLookup ); // TODO is this necessary? surely it's already sorted because of the fetch order? or do we need to prevent parallel reads?
1381
+ return resolvePath( base, entry, null ).then( function(entryPath ) {
1382
+ return fetchModule( entry, entryPath ).then( function() {
1383
+ var entryModule, bundle;
1384
+
1385
+ entryModule = moduleLookup[ entry ];
1386
+ modules = sortModules( entryModule, moduleLookup ); // TODO is this necessary? surely it's already sorted because of the fetch order? or do we need to prevent parallel reads?
1387
+
1388
+ bundle = {
1389
+ entry: entry,
1390
+ entryModule: entryModule,
1391
+ base: base,
1392
+ modules: modules,
1393
+ moduleLookup: moduleLookup,
1394
+ externalModules: externalModules,
1395
+ externalModuleLookup: externalModuleLookup,
1396
+ skip: skip,
1397
+ names: names,
1398
+ chains: resolveChains( modules, moduleLookup )
1399
+ };
1386
1400
 
1387
- bundle = {
1388
- entry: entry,
1389
- entryModule: entryModule,
1390
- base: base,
1391
- modules: modules,
1392
- moduleLookup: moduleLookup,
1393
- externalModules: externalModules,
1394
- externalModuleLookup: externalModuleLookup,
1395
- skip: skip,
1396
- names: names,
1397
- chains: resolveChains( modules, moduleLookup )
1398
- };
1401
+ combine( bundle );
1399
1402
 
1400
- combine( bundle );
1403
+ return bundle;
1404
+ });
1405
+ }, function ( err ) {
1406
+ if ( err.code === 'ENOENT' ) {
1407
+ throw new Error( 'Could not find entry module (' + entry + ')' );
1408
+ }
1401
1409
 
1402
- return bundle;
1410
+ throw err;
1403
1411
  });
1404
1412
 
1405
- function fetchModule ( moduleId, importerPath ) {
1406
- if ( !hasOwnProp.call( promiseById, moduleId ) ) {
1407
- promiseById[ moduleId ] = resolvePath( base, moduleId, importerPath, options.resolvePath ).then( function(modulePath ) {
1408
- return sander.readFile( modulePath ).then( String ).then( function ( source ) {
1409
- var module, promises;
1413
+ function fetchModule ( moduleId, modulePath ) {
1414
+ if ( !hasOwnProp.call( promiseByPath, modulePath ) ) {
1415
+ promiseByPath[ modulePath ] = sander.readFile( modulePath ).then( String ).then( function ( source ) {
1416
+ var module, promises;
1410
1417
 
1411
- if ( options.transform ) {
1412
- source = options.transform( source, modulePath );
1418
+ if ( options.transform ) {
1419
+ source = options.transform( source, modulePath );
1413
1420
 
1414
- if ( typeof source !== 'string' && !isThenable( source ) ) {
1415
- throw new Error( 'transform should return String or Promise' );
1416
- }
1421
+ if ( typeof source !== 'string' && !isThenable( source ) ) {
1422
+ throw new Error( 'transform should return String or Promise' );
1417
1423
  }
1424
+ }
1418
1425
 
1419
- module = getModule({
1420
- source: source,
1421
- id: moduleId,
1422
- relativePath: path.relative( base, modulePath ),
1423
- path: modulePath
1424
- });
1426
+ module = getModule({
1427
+ source: source,
1428
+ id: moduleId,
1429
+ relativePath: path.relative( base, modulePath ),
1430
+ path: modulePath
1431
+ });
1425
1432
 
1426
- modules.push( module );
1427
- moduleLookup[ moduleId ] = module;
1433
+ modules.push( module );
1434
+ moduleLookup[ moduleId ] = module;
1428
1435
 
1429
- promises = module.imports.map( function(x ) {
1430
- x.id = resolveId( x.path, module.relativePath );
1436
+ promises = module.imports.map( function(x ) {
1437
+ x.id = resolveId( x.path, module.relativePath );
1431
1438
 
1432
- if ( x.id === moduleId ) {
1433
- throw new Error( 'A module (' + moduleId + ') cannot import itself' );
1434
- }
1439
+ if ( x.id === moduleId ) {
1440
+ throw new Error( 'A module (' + moduleId + ') cannot import itself' );
1441
+ }
1435
1442
 
1436
- // Some modules can be skipped
1437
- if ( skip && ~skip.indexOf( x.id ) ) {
1438
- return;
1439
- }
1443
+ // Some modules can be skipped
1444
+ if ( skip && ~skip.indexOf( x.id ) ) {
1445
+ return;
1446
+ }
1440
1447
 
1448
+ return resolvePath( base, x.id, modulePath, options.resolvePath ).then( function(modulePath ) {
1441
1449
  // short-circuit cycles
1442
- if ( hasOwnProp.call( promiseById, x.id ) ) {
1450
+ if ( hasOwnProp.call( promiseByPath, modulePath ) ) {
1443
1451
  return;
1444
1452
  }
1445
1453
 
1446
1454
  return fetchModule( x.id, modulePath );
1447
- });
1448
-
1449
- return getBundle__Promise.all( promises );
1455
+ }, function handleError ( err ) {
1456
+ if ( err.code === 'ENOENT' ) {
1457
+ // Most likely an external module
1458
+ if ( !hasOwnProp.call( externalModuleLookup, x.id ) ) {
1459
+ var externalModule = {
1460
+ id: x.id
1461
+ };
1462
+
1463
+ externalModules.push( externalModule );
1464
+ externalModuleLookup[ x.id ] = externalModule;
1465
+ }
1466
+ } else {
1467
+ throw err;
1468
+ }
1469
+ } );
1450
1470
  });
1451
- }, function ( err ) {
1452
- if ( err.code === 'ENOENT' ) {
1453
- if ( moduleId === entry ) {
1454
- throw new Error( 'Could not find entry module (' + entry + ')' );
1455
- }
1456
-
1457
- // Most likely an external module
1458
- if ( !hasOwnProp.call( externalModuleLookup, moduleId ) ) {
1459
- var externalModule = {
1460
- id: moduleId
1461
- };
1462
1471
 
1463
- externalModules.push( externalModule );
1464
- externalModuleLookup[ moduleId ] = externalModule;
1465
- }
1466
- } else {
1467
- throw err;
1468
- }
1472
+ return getBundle__Promise.all( promises );
1469
1473
  });
1470
1474
  }
1471
1475
 
1472
- return promiseById[ moduleId ];
1476
+ return promiseByPath[ modulePath ];
1473
1477
  }
1474
1478
  }
1475
1479
 
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.11
4
+ version: 0.6.12
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-02-08 00:00:00.000000000 Z
11
+ date: 2015-02-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler