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

feat: Add Deno.standalone API (#15996) #18402

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

Conversation

DerZade
Copy link

@DerZade DerZade commented Mar 23, 2023

This PR fixes #15996 by attempting to add a new runtime API (Deno.standalone) to check whether the current code is running inside a self-contained executable.


#15996 was my issue from half a year ago and since it got a few thumbs up and I stumbled upon a similar issue just a few days ago and therefore needed such an API for the second time now, I just thought "well, why not implement it myself and see what happens". It would be absolutely understandable if this API were rejected due to lack of demand.

I apologize in advance, for code that is not in the right spot. This is just my first time contributing to Deno and the project is veeeeery huge. 😂 Just let me know what to change 🙃

@CLAassistant
Copy link

CLAassistant commented Mar 23, 2023

CLA assistant check
All committers have signed the CLA.

Copy link
Collaborator

@aapoalas aapoalas left a comment

Choose a reason for hiding this comment

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

This looks like a reasonable, good API addition, properly tested and all. Nice work!

I'll have to defer to the core team for approval, however. Adding new APIs to the Deno namespace isn't done that lightly. It might be that eg. Deno.build would be a better location for the standalone boolean but I cannot decide that myself.

Thank you for the contribution, and nice work!

@DerZade
Copy link
Author

DerZade commented Mar 25, 2023

Cool. Thank you very much. Totally reasonable that this will take time to get approved.

I thought about Deno.build, but the docs say the following, and so I decided against it:

Users are discouraged from code branching based on this information, as assumptions about what is available in what build environment might change over time. Developers should specifically sniff out the features they intend to use.
The intended use for the information is for logging and debugging purposes.

I'm happy to change this tho, if required :)

@DerZade
Copy link
Author

DerZade commented May 25, 2023

This has been open for over two months now.

Anything I can do to advance this?

I'm happy to fix the merge conflicts and tests, but wanted to wait for at least some comment, whether there is any realistic chance if this getting merged.

@@ -4758,6 +4758,13 @@ declare namespace Deno {
*/
export const mainModule: string;

/** A flag that indicates if the current module is running in a self-contained executable.
*
* @tags allow-read
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think allow-read isn't needed for this data so this tag is unnecessary.

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.

Runtime API to check whether in self-contained exe
3 participants