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

Minifier rule proposal: mangle private fileds and methods in class #1917

Open
Brooooooklyn opened this issue Jul 14, 2021 · 2 comments
Open

Comments

@Brooooooklyn
Copy link
Member

Describe the feature

class WhatEver {
  private someThingUsedInternalOnlyButVeryLongLikeObjectiveCStyle = 0

  public thePublicMethodShouldNotBeMangled() {
    this.privateClassMethodNameShouldAlsoBeMangled()
    return this.someThingUsedInternalOnlyButVeryLongLikeObjectiveCStyle
  }

  private privateClassMethodNameShouldAlsoBeMangled() {
    this.someThingUsedInternalOnlyButVeryLongLikeObjectiveCStyle += 1
  }
}

↓ ↓ ↓ ↓ ↓ ↓

class A {
  private a = 0
  thePublicMethodShouldNotBeMangled() {
    this.b()
    return this.a
  }

  b() {
    this.a += 1
  }
}

This should be an optional rule, it's very dangerous, but very useful.

@kdy1
Copy link
Member

kdy1 commented Jul 14, 2021

I agree that this would be useful.
Marking private methods using special Mark within typescript pass and using the info from the minifier will work.

The logic for private properties (from ecmascript spec) can be applied to such nodes.

@kdy1 kdy1 added this to the Planned milestone Mar 12, 2022
@kdy1 kdy1 removed this from the Planned milestone May 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants