-
Notifications
You must be signed in to change notification settings - Fork 3
Review Request #1
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
Comments
I love the idea 😄 |
I can see the usefulness in documenting these in great specificity so more tools can make use of them. Currently the spec for PURE and such is spread out in issue comments and the source code of the tools (as far as I know). But I don't think changes to annotations are going to happen. |
@fabiosantoscode Yeah I think the goal is here not to force every tool to align, but more like documenting that are already working. |
The I have some tests before, the minimal spec of PURE in esbuild can roughly be:
Note that pure annotation is not the only way that can control the tree shaking process. In esbuild the // package/some-folder/package.json
{ "sideEffects": false }
// package/test.js
import { foo } from './some-folder/some-file' // this line will be tree-shaked |
Does this spec also include processing related to mangling and inline expansion (mainly terser does that)? https://github.com/terser/terser#annotations According to this document, there are Also a bit special is TypeScript's https://www.typescriptlang.org/tsconfig#stripInternal Of course, these are advanced things that are some distance from bundle, and their feasibility depends on the compiler design. So I don't think all bundlers should have this feature, but having a reference may increase interoperability. My contextI am experimenting with a minifier using TypeScript's LanguageService. The goal of this repository is to do type-level mangling and DCE, which is not possible with terser. (DCE has not been started yet). https://github.com/mizchi/packelyze/tree/main/transformer Example of working mangling: https://github.com/mizchi/packelyze/blob/main/transformer/src/transformer/mangler.test.ts#L472-L542 As per the motivation of this spec, documentation on |
@mizchi AFAIK, For |
@antfu In that light, I guess you could say that what this repository deals with is the spec for combining multiple files that cannot be achieved in a single file. |
The
Would you be fine with changing the documentation in such a way? |
Oh yeah, thanks for pointing out @lukastaegert! I guess I was mistakenly mixed the code for no-side-effect. If you'd like, it would be great if you could help update directly with a PR :) |
Hi all,
We have been supporting
#__PURE__
for a long time but I think there is lacking a proper documentation/specification for it. If you Google it, the top result is a StackOverflow answer that points to a very long webpack docs with a lot of other concepts involved.So, here I want to kickstart the specs for the
#__PURE__
notation as well as the other notations we support or going to support. For easier reference and documentation.I have written some very basic drafts here and seeking collaborations and contributions to improving them together.
Will shall find a better org name for sure. If you are a maintainer of bundlers/minifiers, let me know if you are interested in joining the org :)
/cc @lukastaegert @skyrpex @Andarist @alexlamsl @evanw @kdy1 @TheLarkInn @fabiosantoscode
(sorry for pinging, feel free to unsubscribe)
Any feedback is greatly welcome, thank you!
The text was updated successfully, but these errors were encountered: