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

propose import.meta.command #4

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

guybedford
Copy link

@guybedford guybedford commented Jan 22, 2024

This is a proposal for a new import.meta.command key on import meta, exactly matching the definition of import.meta.main. NodeJS has had difficulty finding alignment on import.meta.main (see nodejs/node#49440), primarily because of a lack of clarify as to what exactly it means.

The name command is used here to indicate that this is the module that defines the POSIX-style command behaviour. The description has been further clarified to note that this is specifically only set for a process execution as well as for the top-level execution context in that process - workers, custom realms, other loader registries pointing to the same URL etc etc are therefore excluded from matching this condition (where perhaps a direct process.argv[1] equality might.

This PR is created in conjunction with the Node.js PR to introduce the behaviour.

@ljharb
Copy link
Member

ljharb commented Jan 22, 2024

This sounds good; “main” is a horrifically overloaded and thus confusing name.

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