-
Notifications
You must be signed in to change notification settings - Fork 2
Add option to mark current file as entrypoint #13
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -95,7 +95,7 @@ function deepFind<K>(obj: any, path: string): K | undefined { | |
| return current; | ||
| } | ||
|
|
||
| export default async function (ast: ParseResult<File>, targetedDiscordModApiLibrary: { default: IModImplementation }): Promise<Statement[]> { | ||
| export default async function (ast: ParseResult<File>, targetedDiscordModApiLibrary: { default: IModImplementation }, shouldConvertFormat: boolean = true): Promise<Statement[]> { | ||
| const parsedBody = ast.program.body; | ||
| const importStatements = parsedBody.filter(x => x.type == "ImportDeclaration") as Statement[]; | ||
| const importAliasMap = [] as { internalName: string, codeName: string }[]; | ||
|
|
@@ -183,7 +183,7 @@ export default async function (ast: ParseResult<File>, targetedDiscordModApiLibr | |
| } | ||
| } | ||
| parsedBodyWithoutOurImports.unshift(...await addCode(targetedDiscordModApiLibrary.default)); | ||
| if ((targetedDiscordModApiLibrary as { default: IModImplementation } & { convertFormat: (ast_: Statement[]) => Statement[] }).convertFormat == undefined) | ||
| if (shouldConvertFormat == false || (targetedDiscordModApiLibrary as { default: IModImplementation } & { convertFormat: (ast_: Statement[]) => Statement[] }).convertFormat == undefined) | ||
|
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. Actually, could you use
Member
Author
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. what if it is a string?
Member
Author
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. networking taught me to never trust the user
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.
Member
Author
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. what if somehow user passes a string to that function
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.
|
||
| return parsedBodyWithoutOurImports; | ||
| return (targetedDiscordModApiLibrary as { default: IModImplementation } & { convertFormat: (ast_: Statement[]) => Statement[] }).convertFormat(parsedBodyWithoutOurImports); | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.