Skip to content

New emit pipeline and API/CLI refactor#511

Merged
Perryvw merged 45 commits intoTypeScriptToLua:masterfrom
ark120202:new-emit-pipeline
May 2, 2019
Merged

New emit pipeline and API/CLI refactor#511
Perryvw merged 45 commits intoTypeScriptToLua:masterfrom
ark120202:new-emit-pipeline

Conversation

@ark120202
Copy link
Copy Markdown
Contributor

@ark120202 ark120202 commented Apr 6, 2019

  • API was refactored (closes CLI/Lib Refactor #393):

    • BREAKING CHANGE: LuaTranspiler was removed
    • Added a new function transpile, that runs program.emit with custom transformers and collects emitted results
    • Added emitTranspiledFiles function, that writes results to disk. Later it would be replaced by Compilation class (New module resolution and Compilation structure #432).
    • All public transformation APIs now return ts.Diagnostic[] instead of throwing/logging/exiting (Return ts diagnostics instead of throwing errors from transformer #412 still isn't completely resolved, since for now it just catches TranspileError thrown from transformer).
    • All public APIs now are exported from package index file
    • Added 3 new high-level API functions - transpileFiles, transpileProject, and transpileVirtualProject
    • BREAKING CHANGE: Changed signature of transpileString to receive only a string and options. Old features may be done with transpileVirtualProject.
    • BREAKING CHANGE: CompilerOptions aren't case-insensitive anymore. It should be normalized before using from the API.
    • BREAKING CHANGE: CLI-related functions aren't exported anymore.
  • CLI was refactored:

    • Internal structure now is more similar to tsc
    • Diagnostics are formatted like in tsc now, with a support of pretty reporter
    • Since transformation pipeline now returns diagnostics, transpilation errors are reported just like any other diagnostics. Resolves Improve error reporting #368.
    • Watch mode now supports reloading of config file
    • Running CLI without a project or files now searches for tsconfig.json (like tsc)
    • Option names in CLI are case-insensitive now
    • Root-level options are deprecated
    • BREAKING CHANGE: Boolean options as strings ("true" and "false") are no longer allowed
    • BREAKING CHANGE: Unknown options in tstl config object are considered as errors now
  • Added support for some emit-related flags:

    • declaration
    • declarationMap
    • emitDeclarationOnly
    • noEmit
    • noEmitOnError (it's not default anymore)

@ark120202 ark120202 force-pushed the new-emit-pipeline branch from 1c3bd4b to 8b8eaca Compare April 6, 2019 14:13
@ark120202 ark120202 force-pushed the new-emit-pipeline branch from 1dea9b7 to 2d62202 Compare April 6, 2019 14:56
@ark120202 ark120202 force-pushed the new-emit-pipeline branch from 2d62202 to 02699cd Compare April 6, 2019 14:57
@ark120202 ark120202 marked this pull request as ready for review April 27, 2019 21:02
Copy link
Copy Markdown
Member

@lolleko lolleko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there no way to retrieve the transpiled AST anymore?
Also would be nice to know if this can run in a browser.

This is relevant for the website.

@ark120202
Copy link
Copy Markdown
Contributor Author

Ah, so that's where it was used.
I don't really like exposing ast as a part of TranspiledFile interface, as it's an implementation detail, but I guess it's okay if there are use cases.

transpile doesn't use any node-specific API so it should work fine.
emitTranspiledFiles probably would would work, but it won't after module resolution would be implemented. Though it's not relevant for single-file use case anyway.

@ark120202 ark120202 force-pushed the new-emit-pipeline branch from be51ac2 to e8b89cd Compare May 2, 2019 06:38
@Perryvw Perryvw merged commit 5d4ed09 into TypeScriptToLua:master May 2, 2019
@ark120202 ark120202 deleted the new-emit-pipeline branch November 26, 2019 08:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CLI/Lib Refactor Improve error reporting

4 participants