-
Notifications
You must be signed in to change notification settings - Fork 0
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
Unflag --experimental-strip-types
#17
Comments
|
For number 3, it would be amazing to have a tool (published under |
Created a checklist feel free to edit/suggest points |
Hi, I'm the maintainer of unjs/jiti (used by Nuxt, Nitro, ESLint, ...). A while ago, we released v2, which is being widely adopted. In v2, we have enabled a new native mode (opt-in) that depends on runtime type-stripping and only adds a few resolutions add-ons mainly to ease up tooling transition to full-native support and eventually phasing out the need of custom loader. (this feature being backported to supported Node.js releases, certainly speeds this up for us!) We also run tests against Node.js with One other note to add, jiti does not read or depend on |
Astro isn't currently ready to test the new flag, unfortunately. The CLI binary entry point is a JavaScript file (not a TS file), and all our internal modules are pulled from the As a quick test, I renamed our binary to |
Since TypeScript shipped support (via transpilation) for Explicit Resource Management, the I'm not aware of any way to disable support for Some ideas:
|
That falls in the same category of decorators, Node.js will not polyfill until V8 supports them. We might document it as a generic rule. @kdy1 is it the current swc policy right? |
@marco-ippolito have you considered something like option 3 that I proposed above for these syntactic issues? I think the benefit of that would be to fail fast while also giving the opportunity to provide a more meaningful and self-describing error. node --experimental-strip-types -e "(() => { using test = { [Symbol.dispose]() }; })()"
(node:6400) ERROR: --experimental-strip-types is incompatible with the `using` keyword. See: https://nodejs.org/docs/... |
That would also mean to time the swc release (or unflag something) with the v8 update so that we don't block users from using (🥁 ) the new feature. Imho probably not worth it as long as we document it, its like running |
@ematipico if you need some support, or accept PRs I could help |
I see what you mean. Perhaps there's an opportunity for |
I disagree here. Folks who are likely to be users of this flag are ones who are authoring TypeScript. Part of the benefit of authoring TypeScript is the immediate feedback loop from the language services. For users who are not experts in the nuances of transpilation and type-stripping will not get the early feedback they expect and will be confused. Anyway, it's a small thing in service of a more delightful user experience. I understand if it creates too much of a lift. |
Preventing the use of select features because they have a larger downlevel than others seems very much out of the scope of Node.js. If you use these features with strip types (or similar), you aren't even publishing the downleveled code, you're just running it in-memory. Banning these features seems much more like a personal preference and can be pretty easily done in a linter. A runtime is just there to run the user's code. A runtime could even choose to use a transpilation approach to implement newer features and the effect would be the same. |
I agree with both of you on a technical level but feel convinced that the broader user-base that will want to adopt type stripping won't understand what's going on. I'm thinking there's an opportunity to avoid issues being filed across TS and Node.js repos if the docs + implementation adopt a proactive strategy for informing users of these edge cases. |
I agree with @jakebailey that we probably don't need to take any extra steps to prevent feature usage. The reason is that Node/Amaro already uses So it would feel odd to add more error checking that was specific to Conversely, I would support auditing to ensure any errors are consistent across |
To clarify, marking it as stable means that instead of Or does that mean the option will not even be necessary, and that users will be able to directly execute |
This plan is for the unflagging: |
Marking as stable also means further breaking changes would only happen in major releases. |
Can someone help me pinging the right people? Thanks 🙏🏻 |
There's one thing that isn't clear, how can someone use this flag from a binary? In my case, Plus, is it possible to specify a |
My guess here is that the potential Astro CLI use-case is no different to any other CLI use-case for executing TS. If anything, metaframework CLIs might be considered a more sophisticated use-case than the average Node CLI that might want to use this feature. And therefore more of long shot as potential user. Nevertheless I think the pitch being explored is that when this feature becomes unflagged, during development of the Astro CLI itself, you might be able to simplify your tooling stack and have fewer moving parts by using this feature. If and only if you don't need features outside of basic TS, e.g. no downlevelling, no paths aliasing, no custom preprocessing. It depends on how simple the build process for the Astro CLI is today as to how feasible it is. My guess is that in production you would not want to use this feature anyway, because ahead-of-time compilation to JS will give your CLI users better performance. Node won't need to compile the CLI before executing it. So this pitch is all about easing the life of the Astro CLI developer and is not about directly benefitting users of the Astro CLI. You asked about using the flag from a binary, but that shouldn't matter since this topic is discussing the unflagged case. So you'd get the feature for free. |
Once the feature is unflagged it should be possibile to specificy a |
@marco-ippolito But an Astro installed CLI - both in the case of A) local installation in |
I haven't tested it yet, it's a symlink, so it might work locally ( |
Issue to track the work needed to unflag
--experimental-strip-types
, blockers and other considerations.@nodejs/typescript
moduleResolution
and other TS configurations. doc: add suggested tsconfig for type stripping node#55534The text was updated successfully, but these errors were encountered: