Skip to content

Suggestion: --exclude-after-remap #224

Closed

Description

@robpalme

The exclusions (--include/--exclude) for the recently introduced --all feature are applied to the executable script paths rather than the source script paths. So when working with compiled code the user needs to know the filepaths of the generated code. This is awkward for users of systems like ours that perform filepath mangling during compilation.

nyc used to have this behavior, but it was swapped via the awesome --exclude-after-remap feature that later became the default behavior via istanbuljs/nyc#1010. So in nyc now, exclusions are applied to the source script paths.

I'd like to propose that c8 should match the nyc behavior. As this would be a breaking change, I guess we should introduce it behind a similar opt-in flag (--exclude-after-remap).

If you are happy with the suggestion, I'll work with @j03m to prepare a PR tomorrow.

Activity

  1. j03m commented on May 18, 2020

    @j03m
    Collaborator

    @bcoe I was thinking that here: https://github.com/bcoe/c8/blob/master/lib/report.js#L153 since we will already have the source map url in hand, the most simple approach would be to extract the source file and supply it to shouldInstrument instead of the executable file from the v8 json blob.

    From there, I think the call to globSync for --all could then be simplified to supply the source file itself. This would in theory lose the fileio required to fake the sourcemap cache.

    Any thoughts?

  2. bcoe commented on May 21, 2020

    @bcoe
    Owner

    @j03m this approach sounds smart to me, but would we only get this optimization if we were to make --exclude-after-remap the default behavior?

    @robpalme I think that this would be a good configuration option to add.

  3. added a commit that references this issue on Mar 30, 2021
    2f57a5d
  4. added a commit that references this issue on Mar 30, 2021
    53c4234
  5. added a commit that references this issue on Feb 2, 2024
    593484c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions