Skip to content

Add support for source maps #8

@paulmedynski

Description

@paulmedynski

Would you consider adding support for source maps? This would allow build tools that include a c-preprocessor step to accurately map line numbers back to the original source files during downstream compilation and unit testing. Imagine this flow:

  1. Write some TypeScript code in several files.
  2. Run build:
    a) Strip some code with c-preprocessor.
    b) Compile post-processed code.
    c) Package everything into a single file.
  3. Run tests and errors occur on line X of package file.
  4. Apply source map generated during Asking for advice on if/ifdef/ifndef and such #1 to map the errors back to source code lines in #0.

But the stripping in 1a) altered the source code, so the source maps generated by b) and c) don't line up with the originals.

For my purposes, having c-preprocessor take an existing source map as an additional arg to the processing step, and then altering it accordingly as it processes the contents, would be ideal.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions