Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Fix incorrect gobal export alias in buildFlatBarrel #558

Merged
merged 1 commit into from
Sep 14, 2023
Merged

fix: Fix incorrect gobal export alias in buildFlatBarrel #558

merged 1 commit into from
Sep 14, 2023

Conversation

sqdk
Copy link
Contributor

@sqdk sqdk commented Sep 6, 2023

This fixes a bug where an invalid export alias was generated when filenames had segments that started with a number preceded by a dash or ".".

Examples using dashes and dots:

export { default as testFile-1 } from "./directory1/test-file-1";

and

export { default as testFile.1 } from "./directory1/test.file.1";

While underscores are allowed in aliases, dashes and dots are not.

Fix is to extend the regex to also include numbers.

This fixes a bug where an invalid export alias was generated when filenames
had segments that started with a number preceded by a dash or ".".

Examples using dashes and dots:
```typescript
export { default as testFile-1 } from "./directory1/test-file-1";
```
and
```typescript
export { default as testFile.1 } from "./directory1/test.file.1";
```

While underscores are allowed in aliases, dashes and dots is not.

Fix is to extend the regex to also include numbers.
@sqdk
Copy link
Contributor Author

sqdk commented Sep 6, 2023

Not sure if the way i mocked the file tree for this particular test case is kosher, but I would otherwise have to go through 17 failing tests and ensure they were fixed correctly which seemed more risky. But maybe I am being overly pragmatic :)

@BitForger BitForger merged commit 865b169 into bencoveney:master Sep 14, 2023
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants