Browse Source

correct behaviour with export {...} from ...

contingency-plan
Rich-Harris 10 years ago
parent
commit
b9d2f7198a
  1. 2
      src/Module.js
  2. 5
      test/function/export-as/_config.js
  3. 2
      test/function/export-as/foo.js
  4. 2
      test/function/export-as/main.js
  5. 9
      test/function/export-from-renamed/_config.js
  6. 1
      test/function/export-from-renamed/foo.js
  7. 1
      test/function/export-from-renamed/main.js

2
src/Module.js

@ -120,7 +120,7 @@ export default class Module {
this.imports[ localName ] = {
source,
localName,
name: exportedName
name: localName
};
}
});

5
test/function/export-as/_config.js

@ -0,0 +1,5 @@
var assert = require( 'assert' );
module.exports = {
description: 'allows export { x as y }'
};

2
test/function/export-as/foo.js

@ -0,0 +1,2 @@
var x = 42;
export { x as y };

2
test/function/export-as/main.js

@ -0,0 +1,2 @@
import { y } from './foo';
assert.equal( y, 42 );

9
test/function/export-from-renamed/_config.js

@ -0,0 +1,9 @@
var assert = require( 'assert' );
module.exports = {
description: 'allows export { x as y } from ...',
exports: function ( exports ) {
assert.equal( exports.y, 42 );
assert.ok( !( 'x' in exports ) );
}
};

1
test/function/export-from-renamed/foo.js

@ -0,0 +1 @@
export var x = 42;

1
test/function/export-from-renamed/main.js

@ -0,0 +1 @@
export { x as y } from './foo';
Loading…
Cancel
Save