Skip to content

Commit fc2cd48

Browse files
authored
fix(ubergen): expose exports in core module for v2 (#20176)
Due to an oversight, embedded exports from core were not exported in cdk v2. This is necessary for #19773 to work. The export logic added in that PR would not get executed for `core`, but it is supposed to. ---- ### All Submissions: * [x] Have you followed the guidelines in our [Contributing guide?](https://github.com/aws/aws-cdk/blob/master/CONTRIBUTING.md) ### Adding new Unconventional Dependencies: * [ ] This PR adds new unconventional dependencies following the process described [here](https://github.com/aws/aws-cdk/blob/master/CONTRIBUTING.md/#adding-new-unconventional-dependencies) ### New Features * [ ] Have you added the new feature to an [integration test](https://github.com/aws/aws-cdk/blob/master/INTEGRATION_TESTS.md)? * [ ] Did you use `yarn integ` to deploy the infrastructure and generate the snapshot (i.e. `yarn integ` without `--dry-run`)? *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
1 parent c58fa44 commit fc2cd48

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

tools/@aws-cdk/ubergen/bin/ubergen.ts

+6-4
Original file line numberDiff line numberDiff line change
@@ -292,8 +292,8 @@ async function prepareSourceFiles(libraries: readonly LibraryReference[], packag
292292
indexStatements.push(`export * from './${library.shortName}';`);
293293
} else {
294294
indexStatements.push(`export * as ${library.shortName.replace(/-/g, '_')} from './${library.shortName}';`);
295-
copySubmoduleExports(packageJson.exports, library, library.shortName);
296295
}
296+
copySubmoduleExports(packageJson.exports, library, library.shortName);
297297
}
298298

299299
await fs.writeFile(path.join(libRoot, 'index.ts'), indexStatements.join('\n'), { encoding: 'utf8' });
@@ -317,9 +317,11 @@ function copySubmoduleExports(targetExports: Record<string, string>, library: Li
317317
}
318318
}
319319

320-
// If there was an export for '.' in the original submodule, this assignment will overwrite it,
321-
// which is exactly what we want.
322-
targetExports[`./${unixPath(visibleName)}`] = `./${unixPath(subdirectory)}/index.js`;
320+
if (visibleName !== 'core') {
321+
// If there was an export for '.' in the original submodule, this assignment will overwrite it,
322+
// which is exactly what we want.
323+
targetExports[`./${unixPath(visibleName)}`] = `./${unixPath(subdirectory)}/index.js`;
324+
}
323325
}
324326

325327
async function combineRosettaFixtures(libraries: readonly LibraryReference[], uberPackageJson: PackageJson) {

0 commit comments

Comments
 (0)