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

Avoid require cache busting whenever possible. #130

Closed
wants to merge 4 commits into from

Commits on Oct 11, 2018

  1. Failing test showing AST plugins "bleed" through all instances.

    This test demonstrates how each "layer" in an ember app is transpiling
    its own templates. Each is _supposed_ to be able to provide its own AST
    plugins, **but** this test shows how this falls down and fails.
    
    The current mechanism for registering AST plugins is fundamentally
    flawed. This forced us (long ago) to add some shenanigans to clear the
    require cache (to avoid this exact state leakage).
    rwjblue committed Oct 11, 2018
    Configuration menu
    Copy the full SHA
    ace8ea8 View commit details
    Browse the repository at this point in the history
  2. Pass plugins directly to precompile.

    This avoids calling `registerPlugin` (and therefore mutating global
    state) but maintains support for custom AST plugins by passing for each
    compilation.
    
    This works for Ember 1.13 and higher.
    rwjblue committed Oct 11, 2018
    Configuration menu
    Copy the full SHA
    73172f4 View commit details
    Browse the repository at this point in the history
  3. Fallback to "cache busting" mode if _anyone_ is mutating globally.

    In order to stop the cache busting system, we need to:
    
    * Update the actual compilation code to pass in our custom options (done
    in a prior commit)
    * Ensure that **no one** is mutating the global list of plugins (if they
    are, then we will always get their plugins and therefore our compilation
    is "spoiled" by their AST plugins)
    * Avoid purging the `require.cache` when the requirements are met
    rwjblue committed Oct 11, 2018
    Configuration menu
    Copy the full SHA
    03f299a View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    b67b6e9 View commit details
    Browse the repository at this point in the history