rollup
Advanced tools
Comparing version 0.11.0 to 0.11.1
# rollup changelog | ||
## 0.11.1 | ||
* Support for `export * from '..'` ([#46](https://github.com/rollup/rollup/pull/46)) | ||
## 0.11.0 | ||
@@ -4,0 +8,0 @@ |
{ | ||
"name": "rollup", | ||
"version": "0.11.0", | ||
"version": "0.11.1", | ||
"description": "Next-generation ES6 module bundler", | ||
@@ -5,0 +5,0 @@ "main": "dist/rollup.js", |
@@ -9,3 +9,3 @@ import { dirname } from './utils/path'; | ||
import { blank, keys } from './utils/object'; | ||
import { sequence } from './utils/promise'; | ||
import { first, sequence } from './utils/promise'; | ||
import { isImportDeclaration, isExportDeclaration } from './utils/map-helpers'; | ||
@@ -47,2 +47,7 @@ import getLocation from './utils/getLocation'; | ||
this.exportAlls = blank(); | ||
// array of all-export sources | ||
this.exportDelegates = []; | ||
this.canonicalNames = blank(); | ||
@@ -129,2 +134,11 @@ | ||
} | ||
// Store `export * from '...'` statements in an array of delegates. | ||
// When an unknown import is encountered, we see if one of them can satisfy it. | ||
else { | ||
this.exportDelegates.push({ | ||
statement, | ||
source | ||
}); | ||
} | ||
} | ||
@@ -201,2 +215,9 @@ | ||
const exportAllDeclaration = this.exportAlls[ name ]; | ||
if ( exportAllDeclaration && exportAllDeclaration.module && !exportAllDeclaration.module.isExternal ) { | ||
strongDependencies[ exportAllDeclaration.module.id ] = exportAllDeclaration.module; | ||
return; | ||
} | ||
const importDeclaration = this.imports[ name ]; | ||
@@ -294,3 +315,9 @@ | ||
const exportDeclaration = module.exports[ importDeclaration.name ]; | ||
exporterLocalName = exportDeclaration.localName; | ||
// The export declaration of the particular name is known. | ||
if (exportDeclaration) { | ||
exporterLocalName = exportDeclaration.localName; | ||
} else { // export * from '...' | ||
exporterLocalName = importDeclaration.name; | ||
} | ||
} | ||
@@ -370,3 +397,23 @@ | ||
if ( !exportDeclaration ) { | ||
throw new Error( `Module ${module.id} does not export ${importDeclaration.name} (imported by ${this.id})` ); | ||
const noExport = new Error( `Module ${module.id} does not export ${importDeclaration.name} (imported by ${this.id})` ); | ||
// See if there exists an export delegate that defines `name`. | ||
return first( module.exportDelegates, noExport, declaration => { | ||
return module.bundle.fetchModule( declaration.source, module.id ).then( submodule => { | ||
declaration.module = submodule; | ||
return submodule.mark( name ).then( result => { | ||
if ( !result.length ) throw noExport; | ||
// It's found! This module exports `name` through declaration. | ||
// It is however not imported into this scope. | ||
module.exportAlls[ name ] = declaration; | ||
declaration.statement.dependsOn[ name ] = | ||
declaration.statement.stronglyDependsOn[ name ] = result; | ||
return result; | ||
}); | ||
}); | ||
}); | ||
} | ||
@@ -373,0 +420,0 @@ |
@@ -34,2 +34,3 @@ import { blank, keys } from './utils/object'; | ||
this.isExportDeclaration = /^Export/.test( node.type ); | ||
this.isExportAllDeclaration = /^ExportAll/.test( node.type ); | ||
} | ||
@@ -36,0 +37,0 @@ |
@@ -22,2 +22,22 @@ import { Promise } from 'sander'; | ||
return promise.then( () => results ); | ||
} | ||
} | ||
export function first ( arr, fail, callback ) { | ||
const len = arr.length; | ||
let promise = Promise.reject( fail ); | ||
function next ( i ) { | ||
return promise | ||
.catch(() => callback( arr[i], i )); | ||
} | ||
let i; | ||
for ( i = 0; i < len; i += 1 ) { | ||
promise = next( i ); | ||
} | ||
return promise; | ||
} |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
890767
11217
1
4
16