fix(babelPlugin): track importTo names in topLevelExported[importFrom]
Allow for live exports to be exported under a different name.  Current
problem was that live exports were always exported under their own name.
MODIFY
src/babelPlugin.js
src/babelPlugin.js
@@ -73,7 +73,9 @@ function makeModulePlugins(options) {
),
),
);
- liveExportMap[name] = [name, true];
+ for (const importTo of topLevelExported[name]) {
+ liveExportMap[importTo] = [name, true];
+ }
} else {
// Make this variable mutable with: let name = $c_name;
soften(id);
@@ -323,7 +325,14 @@ function makeModulePlugins(options) {
prior.push(...collectPatternIdentifiers(path, pat));
return prior;
}, []);
- vids.forEach(({ name }) => (topLevelExported[name] = true));
+ vids.forEach(({ name }) => {
+ let tle = topLevelExported[name];
+ if (!tle) {
+ tle = [];
+ topLevelExported[name] = tle;
+ }
+ tle.push(name);
+ });
}
specs.forEach(spec => {
@@ -353,7 +362,12 @@ function makeModulePlugins(options) {
// Not declared, so make it a live export without proxy.
liveExportMap[importTo] = [importFrom, false];
} else {
- topLevelExported[importFrom] = true;
+ let tle = topLevelExported[importFrom];
+ if (!tle) {
+ tle = [];
+ topLevelExported[importFrom] = tle;
+ }
+ tle.push(importTo);
}
});
}

MODIFY
src/index.js
src/index.js
@@ -102,6 +102,7 @@ const makeModuleTransformer = (babelCore, importer) => {
})`;
// console.log(functorSource);
+ // console.log(sourceOptions.liveExportMap);
const moduleStaticRecord = {
moduleSource,
imports: sourceOptions.imports,

fix(babelPlugin): track importTo names in topLevelExported[importFrom]

Allow for live exports to be exported under a different name.  Current
problem was that live exports were always exported under their own name.