-
-
Notifications
You must be signed in to change notification settings - Fork 185
Alternative bundling #750
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
Alternative bundling #750
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
9034551
security audit fix
Perryvw d612dd4
Alternative bundling approach
Perryvw 478ff44
Changed default lualib inline to require, support for lualib require …
Perryvw 2cab0ef
Added failing test for entry point resolution
Perryvw e57082c
Fixed bundle transpile test, broke all other bundle tests
Perryvw 029a0bd
Fix bundle tests
Perryvw 9f34b56
Added basic project transpilation test
Perryvw 2a1f595
Fixed test paths
Perryvw 5b2657d
Moved resolution modules to resolve.ts, rewrote them to use configFil…
Perryvw 34a08f3
Fixed bug with getProjectDir
Perryvw 0942443
Use getCommonSourcesDir in all cases
Perryvw 54dc975
Changed path resolution again, using confFilePath again
Perryvw 89f8d72
Renamed transpile/basic test to transpile/project, normalized output …
Perryvw 12fcf2d
Reverted toHaveDiagnostics change
Perryvw 8da608d
Reverted some more forgotten stuff
Perryvw 2308ebf
Final stuff to revert
Perryvw 54924f0
Do not emit lualib bundle when bundling
Perryvw f807b79
Updated emit lualib_bundle logic
Perryvw 5003460
Merge branch 'master' into feature/bundling-v2
Perryvw 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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -20,6 +20,8 @@ export interface TransformerImport { | |
| export type CompilerOptions = OmitIndexSignature<ts.CompilerOptions> & { | ||
| noImplicitSelf?: boolean; | ||
| noHeader?: boolean; | ||
| luaBundle?: string; | ||
| luaBundleEntry?: string; | ||
| luaTarget?: LuaTarget; | ||
| luaLibImport?: LuaLibImportKind; | ||
| noHoisting?: boolean; | ||
|
|
@@ -41,3 +43,42 @@ export enum LuaTarget { | |
| Lua53 = "5.3", | ||
| LuaJIT = "JIT", | ||
| } | ||
|
|
||
| export function validateOptions(options: CompilerOptions): ts.Diagnostic[] { | ||
| const diagnostics: ts.Diagnostic[] = []; | ||
|
|
||
| if (options.luaBundle && !options.luaBundleEntry) { | ||
| diagnostics.push(configErrorDiagnostic(`'luaBundleEntry' is required when 'luaBundle' is enabled.`)); | ||
| } | ||
|
|
||
| if (options.luaBundle && options.luaLibImport === LuaLibImportKind.Inline) { | ||
| diagnostics.push( | ||
| configWarningDiagnostic( | ||
| `Using 'luaBundle' with 'luaLibImport: "inline"' might generate duplicate code. ` + | ||
| `It is recommended to use 'luaLibImport: "require"'` | ||
| ) | ||
| ); | ||
| } | ||
|
|
||
| return diagnostics; | ||
| } | ||
|
|
||
| const configErrorDiagnostic = (message: string): ts.Diagnostic => ({ | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. IMO diagnostic factories should be specified, that would look better once we'll have diagnostic codes |
||
| file: undefined, | ||
| start: undefined, | ||
| length: undefined, | ||
| category: ts.DiagnosticCategory.Error, | ||
| code: 0, | ||
| source: "typescript-to-lua", | ||
| messageText: message, | ||
| }); | ||
|
|
||
| const configWarningDiagnostic = (message: string): ts.Diagnostic => ({ | ||
| file: undefined, | ||
| start: undefined, | ||
| length: undefined, | ||
| category: ts.DiagnosticCategory.Warning, | ||
| code: 0, | ||
| source: "typescript-to-lua", | ||
| messageText: message, | ||
| }); | ||
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
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
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.