-
-
Notifications
You must be signed in to change notification settings - Fork 185
New emit pipeline and API/CLI refactor #511
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
Merged
Merged
Changes from all commits
Commits
Show all changes
45 commits
Select commit
Hold shift + click to select a range
19d47de
New emit pipeline and API/CLI refactor
ark120202 e87c8ee
Move high-level API to index file
ark120202 8b8eaca
Extract multi-file `transpileString` input to `transpileVirtualProgram`
ark120202 02699cd
Return an results from emitTranspiledFiles instead of a using a callback
ark120202 de5ec24
Refactor CommandLineParser and further CLI refactor
ark120202 503cc68
Merge remote-tracking branch 'upstream/master' into new-emit-pipeline
ark120202 e767750
Fix strict issues
ark120202 c2b8812
Fix rootDir and outDir defaults always being used
ark120202 ff9a233
Remove failing test
ark120202 5ca24e0
Remove command line parser tests that test standard TS parser features
ark120202 021d940
Use tsconfig source file during parse to get better diagnostics
ark120202 b99b6b9
Parse command line options more similar to typescript
ark120202 e738b58
Refactor commandLineParser tests
ark120202 68c767a
Rename transpileVirtualProgram to transpileVirtualProject
ark120202 000793d
Remove export from CLI
ark120202 b51b916
Add expect(received).toHaveDiagnostics() matcher
ark120202 2d02ce1
Parse command line options case-insensitively
ark120202 6c36fe0
Disallow unknown options in "tstl" config object
ark120202 64c0962
Rename compiler tests to CLI tests
ark120202 9cc5be7
Refactor CLI tests
ark120202 52b5c50
Add transpile tests
ark120202 28b5b52
Fix invalid behavior with relative outFile and outDir
ark120202 c211764
Rename getTranspileOutput to getTranspilationResult
ark120202 65e5183
Remove `options` argument from `getTranspilationResult`
ark120202 07c23dc
Rename getTranspilationResult to transpile
ark120202 2fc099e
Extract luaLibImport to a variable
ark120202 e072bb0
Add command line parsing integration tests
ark120202 4045b47
Make diagnostics use node's source file instead of transformed one
ark120202 1b62fd9
Cast getCompilerOptions calls to custom compiler options
ark120202 946f16a
Export TranspileError and all LuaTransformer exports from package index
ark120202 4c76457
Remove options argument from LuaTransformer
ark120202 6a595b1
Rename sourceFile variable
ark120202 e821d7f
Set printer default during destructuring
ark120202 4982c44
Rename
ark120202 280ed35
Use emitTranspiledFiles in transpileFiles and transpileProject
ark120202 55acfd7
Use transpileFiles in transpile tests runner
ark120202 7f8a198
Fix typos
ark120202 96e0895
Deprecate root-level options
ark120202 f8ef95f
Move TranspileError diagnostic to diagnostics.ts
ark120202 f0e82ce
Add source to custom diagnostics
ark120202 f78e0d0
Show custom diagnostics as `TSTL<code>` in CLI
ark120202 dc53f26
Fix quotes
ark120202 8378cdf
Always import tstl as a namespace in tests
ark120202 d5b8e65
Simplify tstl object formatting in deprecation warning
ark120202 e8b89cd
Add Lua AST to TranspiledFile interface
ark120202 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,34 +1,27 @@ | ||
| import * as fs from "fs"; | ||
| import * as glob from "glob"; | ||
| import { compile } from "./src/Compiler"; | ||
| import { LuaLib as luaLib, LuaLibFeature } from "./src/LuaLib"; | ||
| import * as path from "path"; | ||
| import * as ts from "typescript"; | ||
| import * as tstl from "./src"; | ||
| import { LuaLib } from "./src/LuaLib"; | ||
|
|
||
| const bundlePath = "./dist/lualib/lualib_bundle.lua"; | ||
| const options: tstl.CompilerOptions = { | ||
| skipLibCheck: true, | ||
| types: [], | ||
| luaLibImport: tstl.LuaLibImportKind.None, | ||
| luaTarget: tstl.LuaTarget.Lua51, | ||
| noHeader: true, | ||
| outDir: path.join(__dirname, "./dist/lualib"), | ||
| rootDir: path.join(__dirname, "./src/lualib"), | ||
| }; | ||
|
|
||
| compile([ | ||
| "--skipLibCheck", | ||
| "--types", | ||
| "node", | ||
| "--luaLibImport", | ||
| "none", | ||
| "--luaTarget", | ||
| "5.1", | ||
| "--noHeader", | ||
| "--outDir", | ||
| "./dist/lualib", | ||
| "--rootDir", | ||
| "./src/lualib", | ||
| "--noHeader", | ||
| "true", | ||
| ...glob.sync("./src/lualib/**/*.ts"), | ||
| ]); | ||
| // TODO: Check diagnostics | ||
| const { emitResult } = tstl.transpileFiles(glob.sync("./src/lualib/**/*.ts"), options); | ||
| emitResult.forEach(({ name, text }) => ts.sys.writeFile(name, text)); | ||
|
|
||
| const bundlePath = path.join(__dirname, "./dist/lualib/lualib_bundle.lua"); | ||
| if (fs.existsSync(bundlePath)) { | ||
| fs.unlinkSync(bundlePath); | ||
| } | ||
|
|
||
| const features = Object.keys(LuaLibFeature).map( | ||
| lib => LuaLibFeature[lib as keyof typeof LuaLibFeature], | ||
| ); | ||
| const bundle = luaLib.loadFeatures(features); | ||
| fs.writeFileSync(bundlePath, bundle); | ||
| fs.writeFileSync(bundlePath, LuaLib.loadFeatures(Object.values(tstl.LuaLibFeature))); | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.