Skip to content

Commit

Permalink
Fix build error
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolo-ribaudo committed Jun 4, 2024
1 parent 5cc7b05 commit 961d6dc
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 6 deletions.
4 changes: 0 additions & 4 deletions .github/workflows/e2e-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,5 @@ jobs:
path: /tmp
- name: Unpack published packages
run: tar -C /tmp -xf /tmp/verdaccio-workspace.tar
- name: Setup upterm session
uses: lhotari/action-upterm@v1
with:
limit-access-to-users: nicolo-ribaudo
- name: Test
run: ./scripts/integration-tests/e2e-${{ matrix.project }}.sh
6 changes: 6 additions & 0 deletions packages/babel-helpers/scripts/build-helper-metadata.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,12 @@ export function getHelperMetadata(babel, code, helperName) {
exportName = name;
spansToRemove.push([child.node.start, child.node.end]);
child.remove();
} else if (
child.isExportNamedDeclaration() &&
child.node.specifiers.length === 0
) {
spansToRemove.push([child.node.start, child.node.end]);
child.remove();
} else if (
child.isExportAllDeclaration() ||
child.isExportNamedDeclaration()
Expand Down
36 changes: 34 additions & 2 deletions packages/babel-helpers/scripts/generate-helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,39 @@ const helpers: Record<string, Helper> = {
/**
* @type {import("@babel/core").PluginObj}
*/
{
({ types: t }) => ({
// These pre/post hooks are needed because the TS transform is,
// when building in the old Babel e2e test, removing the
// `export { OverloadYield as default }` in the OverloadYield helper.
// TODO: Remove in Babel 8.
pre(file) {
file.metadata.exportName = null;
file.path.traverse({
ExportSpecifier(path) {
if (path.node.exported.name === "default") {
file.metadata.exportName = path.node.local.name;
}
},
});
},
post(file) {
if (!file.metadata.exportName) return;
file.path.traverse({
ExportNamedDeclaration(path) {
if (
!path.node.declaration &&
path.node.specifiers.length === 0
) {
path.node.specifiers.push(
t.exportSpecifier(
t.identifier(file.metadata.exportName),
t.identifier("default")
)
);
}
},
});
},
visitor: {
ImportDeclaration(path) {
const source = path.node.source;
Expand All @@ -117,7 +149,7 @@ const helpers: Record<string, Helper> = {
}
},
},
},
}),
],
}).code;
code = (
Expand Down

0 comments on commit 961d6dc

Please sign in to comment.