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

wildcardExports naming change #13

Merged
merged 3 commits into from
Jun 18, 2024
Merged

wildcardExports naming change #13

merged 3 commits into from
Jun 18, 2024

Conversation

guybedford
Copy link
Collaborator

@guybedford guybedford commented May 23, 2024

This changes ModuleSource.prototype.starExports() to instead be referred to as ModuleSource.prototype.wildcardExports(), since the term "star exports" is currently only an internal spec naming, which is not used outside of the spec itself.

README.md Outdated
@@ -138,12 +138,12 @@ interface Import {

Returns a list of the explicit named exports of the module of the form `String[]`.

### `AbstractModuleSource.prototype.starExports()`
### `AbstractModuleSource.prototype.namespaceReexports()`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
### `AbstractModuleSource.prototype.namespaceReexports()`
### `AbstractModuleSource.prototype.namespaceReExports()`

what about?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or, reExportAlls()?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I always wonder about the camelcasing of reexports too. Strictly speaking, isn't the prefix part of the same word though?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

excepts camel casing, namespace reexports makes me think of export * as ns from ...

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a good point. Maybe namespacedExports or namespacedReexports with a d could help disambiguate?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think? cc @nicolo-ribaudo

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

export * as ns from would still be in this list, though, no? since it's statically creating an ns named export?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

export * as ns from would still be in this list, though, no? since it's statically creating an ns named export?

No, I think? It only refers to all specifiers from export * from.

export * as x from 'x'
export * from 'y'

only "y" appears in this list

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

by the way, I don't know if these two have observable differences in the language.

export * as x from 'x'
import * as <unique identifier> from 'x'
export { <unique identifier> as x }

@ljharb
Copy link
Member

ljharb commented May 28, 2024

To be honest i think "star" being inside the spec is irrelevant - the reason that name makes the most sense is because it uses a *, which is a "star".

@guybedford
Copy link
Collaborator Author

guybedford commented May 28, 2024

Another name that we could use here is "barrel export". So we could call the method barrelExports().

In references I've found it's commonly used to refer directly to export * from. For example, https://basarat.gitbook.io/typescript/main-1/barrel.

@Jack-Works
Copy link
Member

Another name that we could use here is "barrel export". So we could call the method barrelExports().

In references I've found it's commonly used to refer directly to export * from. For example, basarat.gitbook.io/typescript/main-1/barrel.

In my understanding, "barrel" is used to refer to the file that only contains a list of export statements.

If a file looks like this:

export function a() {
    // a lot of logic
}
export function b() {
    // a lot of logic
}
// ....
export * from './constants.js'

I won't call it a "barrel" export

@guybedford
Copy link
Collaborator Author

Another name we might use that is used on MDN is the term "wildcard export", so wildcardExports as the function.

@guybedford guybedford changed the title namespaceReexports naming change wildcardExports naming change Jun 7, 2024
@guybedford
Copy link
Collaborator Author

I've updated this PR to use the term wildcardExports.

@guybedford guybedford merged commit 5d32071 into main Jun 18, 2024
1 check passed
@guybedford guybedford deleted the naming branch June 18, 2024 01:03
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.

3 participants