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

New emit pipeline and API/CLI refactor #511

Merged
merged 45 commits into from May 2, 2019

Conversation

ark120202
Copy link
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)

src/API.ts Outdated Show resolved Hide resolved
src/API.ts Outdated Show resolved Hide resolved
src/API.ts Outdated Show resolved Hide resolved
src/CommandLineParser.ts Show resolved Hide resolved
src/Emit.ts Show resolved Hide resolved
src/Transpile.ts Outdated Show resolved Hide resolved
src/Emit.ts Outdated Show resolved Hide resolved
src/LuaPrinter.ts Outdated Show resolved Hide resolved
src/Transpile.ts Outdated Show resolved Hide resolved
test/unit/commandLineParser.spec.ts Show resolved Hide resolved
test/unit/commandLineParser.spec.ts Show resolved Hide resolved
@ark120202 ark120202 marked this pull request as ready for review April 27, 2019 21:02
build_lualib.ts Show resolved Hide resolved
src/CommandLineParser.ts Show resolved Hide resolved
src/index.ts Show resolved Hide resolved
Copy link
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
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.

@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