Skip to content
This repository has been archived by the owner on Mar 29, 2018. It is now read-only.

Support ExportSpecifierSet being "*". #29

Open
domenic opened this issue Jul 15, 2013 · 10 comments
Open

Support ExportSpecifierSet being "*". #29

domenic opened this issue Jul 15, 2013 · 10 comments

Comments

@domenic
Copy link

domenic commented Jul 15, 2013

export * from "crypto";

should transpile to something like

var __dependency1__ = require("crypto");
Object.getOwnPropertyNames(__dependency1__).forEach(function (x) {
    exports[x] = __dependency1__[x];
});
@domenic
Copy link
Author

domenic commented Jul 24, 2013

Per @dherman at https://twitter.com/littlecalculist/status/360052538051014656, export * does not shadow any other exports, so we'll need to transpile

export var whatevs;
export * from "crypto";

to something like

var whatevs;
exports.whatevs = whatevs;

var __dependency1__ = require("crypto");
var __knownExports__ = Object.getOwnPropertyNames(exports);
Object.getOwnPropertyNames(__dependency1__).forEach(function (x) {
    if (__knownExports__.indexOf(x) === -1) {
        exports[x] = __dependency1__[x];
    }
});

@jdalton
Copy link

jdalton commented Nov 16, 2013

I think currently export foo from './foo'; isn't supported either.

@eventualbuddha
Copy link
Contributor

This is still unsupported in v0.5.1. It's not a big priority for me, but if anyone wants to take a stab at it I'll review a PR.

@sandstrom
Copy link

Similarly, it seems import * as ajax from '../utils/ajax' doesn't work either[1].

[1] http://www.2ality.com/2014/09/es6-modules-final.html

@caridy
Copy link
Contributor

caridy commented Oct 9, 2014

@jdalton export foo from './foo'; is invalid.

@sandstrom import * as ajax from '../utils/ajax' is coming as part of the refactor we are working on as a result of the latest update in esprima: https://github.com/ariya/esprima/pull/287

@sandstrom
Copy link

@caridy Awesome!

With some web standards it's painful to wait the 5+ years until adoption is high. The transpiler feels like an awesome time-machine, making it available today 😄

@jdalton
Copy link

jdalton commented Oct 9, 2014

@jdalton export foo from './foo'; is invalid.

Amazing what a year will do :P

@caridy
Copy link
Contributor

caridy commented Oct 9, 2014

@jdalton yeah, we left that one out because it is ambiguous, instead, you can use export {default as foo} from "./foo";, we will revisit the export-from grammar post ES6. For now, we only have two options for it:

export * FromClause ;
export ExportClause FromClause ;

more details here:
https://people.mozilla.org/~jorendorff/es6-draft.html#sec-exports

@caridy caridy mentioned this issue Oct 23, 2014
@caridy
Copy link
Contributor

caridy commented Oct 23, 2014

@sandstrom import * as foo from "foo"; is supported now. We will work on export * from "foo" next.

@sandstrom
Copy link

@caridy awesome! ⛵

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants