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

feat: support emitDeclarationOnly #366

Merged
merged 1 commit into from
Jun 24, 2022

Commits on Jun 23, 2022

  1. feat: support emitDeclarationOnly

    - when `emitDeclarationOnly` is set, only perform type-checking and emit declarations, don't transform TS
      - `result.code` actually doesn't exist when `emitDeclarationOnly` is set anyway
        - this caused a confusing situation for users who were trying to use Babel (with Babel plugins) on TS and only use rpt2 for declarations
          - instead of getting any JS code, they would just get empty chunks, bc `result.code` is `undefined`
            - that's kind of buggy, it should probably either be forced to `false` or do what we're doing now, which is likely more intuitive / intended
      - so now, instead of getting an empty chunk, rpt2 will just pass to the next plugin, allowing for other plugins on the chain to process TS
        - this opens up some new use cases, like using in tandem with Babel plugins (as the issue illustrates) or using for type-checking and declaration generation while using Vite / ESBuild for compilation
    
    - add a new paragraph to "Declarations" docs about this new feature and what it does and some examples of how it could be used
      - note that these are unexplored / untested integrations, so point that out in the docs too
      - also modify a self-reference further up in the docs to use code backticks for `rollup-plugin-typescript2`
    - while at it, also add a line about declaration maps
    - and reformat the existing paragraph a bit to match the style and improve readability
      - one sentence per line, which is all on the same paragraph in Markdown anyway
      - add a `<br />` element to add a new-line _within_ the paragraph for better readability / spacing
        - Markdown supports this only with two trailing spaces, which is difficult to see and the trailing whitespace can be trimmed by editors, so prefer `<br />`
    agilgur5 committed Jun 23, 2022
    Configuration menu
    Copy the full SHA
    edeffcf View commit details
    Browse the repository at this point in the history