Skip to content

Commit

Permalink
feat: tweak
Browse files Browse the repository at this point in the history
  • Loading branch information
TrickyPi committed Dec 2, 2022
1 parent 4f2de32 commit e50bd5c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
10 changes: 4 additions & 6 deletions src/Module.ts
Expand Up @@ -301,19 +301,17 @@ export default class Module {
return dynamicImporters.sort();
},
get exportedBindings() {
const reexportBindings: Record<string, string[]> = {};
const exportBindings: Record<string, string[]> = { '.': [...exports.keys()] };

for (const [name, { source }] of reexportDescriptions) {
(reexportBindings[source] ??= []).push(name);
(exportBindings[source] ??= []).push(name);
}

for (const source of exportAllSources) {
(reexportBindings[source] ??= []).push('*');
(exportBindings[source] ??= []).push('*');
}

const exportBindings = { '.': [...exports.keys()] };

return { ...exportBindings, ...reexportBindings };
return exportBindings;
},
get exports() {
return [
Expand Down
Expand Up @@ -11,8 +11,8 @@ const expectedResult = {
exportedBindings: { '.': [], './module.js': ['moduleAlias', '*'] }
},
[ID_MODULE]: {
exports: ['default', 'module', 'module2'],
exportedBindings: { '.': ['default', 'module'], './module2.js': ['module2'] }
exports: ['default', 'module', '*'],
exportedBindings: { '.': ['default', 'module'], './module2.js': ['*'] }
},
[ID_MODULE_2]: {
exports: ['module2'],
Expand Down
@@ -1,3 +1,3 @@
export * as module2 from './module2.js';
export * from './module2.js';
export default 1;
export const module = 1;

0 comments on commit e50bd5c

Please sign in to comment.