fix(exportNamespace): allow export * as ns2 from 'foo'
MODIFY
src/babelPlugin.js
src/babelPlugin.js
@@ -361,9 +361,10 @@ function makeModulePlugins(options) {
specs.forEach(spec => {
const { local, exported } = spec;
+ const importFrom =
+ spec.type === 'ExportNamespaceSpecifier' ? '*' : local.name;
// If local.name is reexported we omit it.
- const importFrom = local.name;
const importTo = exported.name;
let myUpdaterSources = updaterSources[importFrom];
if (myImportSources) {

MODIFY
src/index.js
src/index.js
@@ -17,7 +17,6 @@ const makeModuleTransformer = (babelCore, importer) => {
// This list taken and amended from:
// https://github.com/prettier/prettier/tree/master/src/language-js/parser-babylon.js#L21
parserPlugins.push(
- 'eventualSend',
'doExpressions',
'objectRestSpread',
'classProperties',
@@ -47,8 +46,6 @@ const makeModuleTransformer = (babelCore, importer) => {
const modulePlugins = makeModulePlugins(sourceOptions);
const output = babelCore.transformSync(source, {
parserOpts: {
- allowAwaitOutsideFunction: true,
- allowImportExportEverywhere: true,
plugins: parserPlugins,
},
generatorOpts: {
@@ -91,8 +88,6 @@ const makeModuleTransformer = (babelCore, importer) => {
// Record of imported module specifier names to list of importNames.
// The importName '*' is that module's module namespace object.
imports: {},
- // List of module specifiers that we export all from.
- exportAlls: [],
// exportNames of variables that are assigned to, or reexported and
// therefore assumed live. A reexported variable might not have any
// localName.
@@ -116,7 +111,7 @@ const makeModuleTransformer = (babelCore, importer) => {
.map(([exp, upds]) => `[${js(exp)}, [${upds.join(',')}]]`)
.join(',')}])]`,
)
- .join(',')}]), ${js(sourceOptions.exportAlls)});`;
+ .join(',')}]));`;
preamble += sourceOptions.hoistedDecls
.map(vname => `${h.HIDDEN_LIVE}.${vname}();`)
.join('');
@@ -142,7 +137,6 @@ const makeModuleTransformer = (babelCore, importer) => {
imports: sourceOptions.imports,
liveExportMap: sourceOptions.liveExportMap,
fixedExportMap: sourceOptions.fixedExportMap,
- exportAlls: sourceOptions.exportAlls,
functorSource,
};
// console.log(moduleStaticRecord);

fix(exportNamespace): allow export * as ns2 from 'foo'