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

Experimental: JS compression via Closure Compiler #20967

Draft
wants to merge 24 commits into
base: 5.x-dev
Choose a base branch
from

Commits on Jul 7, 2023

  1. Configuration menu
    Copy the full SHA
    e37f532 View commit details
    Browse the repository at this point in the history
  2. Fix: Closure Compiler warning JSC_USELESS_CODE in for-loops

    ```
    var i = 0;
    for (i; i < object.length; i++) {}
    ```
    
    becomes
    
    ```
    var i;
    for (i = 0; i < object.length; i++) {}
    ```
    
    Alternative (unreadable):
    
    ```
    var i = 0;
    for (; i < object.length; i++) {}
    ```
    rr-it committed Jul 7, 2023
    Configuration menu
    Copy the full SHA
    13b1c12 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    e8ea737 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    56d7926 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    7eae018 View commit details
    Browse the repository at this point in the history
  6. Fix: Closure Compiler error JSC_UNDEFINED_VARIABLE - `Matomo_Overla…

    …y_Client` and `piwik_track` undeclared
    rr-it committed Jul 7, 2023
    Configuration menu
    Copy the full SHA
    017ba83 View commit details
    Browse the repository at this point in the history
  7. Experimental: suppress JSDoc type checks in piwik.js for Closure Co…

    …mpiler
    
    This disables type warnings: `JSC_UNRECOGNIZED_TYPE_ERROR`, `JSC_TYPE_MISMATCH`, `JSC_WRONG_ARGUMENT_COUNT` and more.
    rr-it committed Jul 7, 2023
    Configuration menu
    Copy the full SHA
    4aee9fa View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    31e8d64 View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    479d683 View commit details
    Browse the repository at this point in the history
  10. Configuration menu
    Copy the full SHA
    8db0c32 View commit details
    Browse the repository at this point in the history
  11. Configuration menu
    Copy the full SHA
    0f681b6 View commit details
    Browse the repository at this point in the history
  12. Experimental: add public Tracker API methods to externs definition …

    …for `piwik.js`
    
    + Copy all functions that begin with `this.nameOfFunction` from `function Tracker()` in `piwik.js`. Exclude functions inside `/*<DEBUG>*/ … /*</DEBUG>*/`-markers.
    + Rename inside `piwik.externs.js` via find `^this\.` and replace by `Tracker.`
    + Empty method bodies inside `piwik.externs.js` via find `\{(\n .+|\n)+\n\};` and replace by `{};`
    rr-it committed Jul 7, 2023
    Configuration menu
    Copy the full SHA
    fa83100 View commit details
    Browse the repository at this point in the history
  13. Experimental: add public Tracker API methods to externs definition …

    …for `piwik.js` - fix `Tracker.optUserOut`
    rr-it committed Jul 7, 2023
    Configuration menu
    Copy the full SHA
    68a0c14 View commit details
    Browse the repository at this point in the history
  14. JSDoc: declare constructors

    rr-it committed Jul 7, 2023
    Configuration menu
    Copy the full SHA
    a0a6b09 View commit details
    Browse the repository at this point in the history
  15. Configuration menu
    Copy the full SHA
    d7093de View commit details
    Browse the repository at this point in the history
  16. Configuration menu
    Copy the full SHA
    c3c2be8 View commit details
    Browse the repository at this point in the history
  17. Experimental: enclose fixed property names of data-object in quotes t…

    …o exclude them from Closure Compiler munging
    rr-it committed Jul 7, 2023
    Configuration menu
    Copy the full SHA
    f756b7c View commit details
    Browse the repository at this point in the history
  18. Build tracker js

    rr-it committed Jul 7, 2023
    Configuration menu
    Copy the full SHA
    0b2e0fe View commit details
    Browse the repository at this point in the history
  19. Configuration menu
    Copy the full SHA
    542bd46 View commit details
    Browse the repository at this point in the history

Commits on Jul 12, 2023

  1. Experimental: enclose still missing fixed property names of data-obje…

    …ct in quotes to exclude them from Closure Compiler munging
    rr-it committed Jul 12, 2023
    Configuration menu
    Copy the full SHA
    919104c View commit details
    Browse the repository at this point in the history
  2. Experimental: prepend all private property names with an underscore

    Some common JS names defined in the default Closure Compiler `externs` are not munged e.g.:
    location, name, target, type, href, enabled, timeout, interval
    
    When renamed by prepending with an underscore they get correctly munged.
    rr-it committed Jul 12, 2023
    Configuration menu
    Copy the full SHA
    af865aa View commit details
    Browse the repository at this point in the history
  3. Experimental: rename functions colliding with common names

    Some common JS names defined in the default Closure Compiler `externs` are not munged:
    find, push, trim
    
    When renamed the functions and calls get correctly munged.
    rr-it committed Jul 12, 2023
    Configuration menu
    Copy the full SHA
    44c6535 View commit details
    Browse the repository at this point in the history
  4. Experimental: add missing global methods used by Matomo to externs

    …definition for `piwik.js`
    rr-it committed Jul 12, 2023
    Configuration menu
    Copy the full SHA
    ebdfe38 View commit details
    Browse the repository at this point in the history
  5. Build tracker js

    rr-it committed Jul 12, 2023
    Configuration menu
    Copy the full SHA
    29e22e4 View commit details
    Browse the repository at this point in the history