Skip to content

Commit 2b60579

Browse files
committed
can now declare types and variables before function
1 parent 432d6de commit 2b60579

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

index.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -435,12 +435,9 @@ type WildFullsec = Record<string, () => ScriptFailure> & {
435435
export async function processScript(script: string) {
436436
const autocompleteMatch = script.match(/^(?:\/\/ @autocomplete (.+)|function(?: \w+| )?\([^\)]*\)\s*{\s*\/\/(.+))\n/)
437437

438-
if (script.startsWith("export function"))
439-
script = script.replace("export ", "")
440-
441438
script = script
442439
.replace(/[#\$]([\w.]+\()/g, a => "$" + a.slice(1).replace(/\./g, "$"))
443-
.replace(/^function\s*\(/, "function script(")
440+
.replace(/function\s*\(/, "function script(")
444441
.replace(/#G[^\w]/g, "$G")
445442

446443
// compilation
@@ -451,6 +448,8 @@ export async function processScript(script: string) {
451448
}
452449
}).outputText
453450

451+
script = script.replace(/^export /, "")
452+
454453
// minification
455454
script = (await minify(script, { compress: {
456455
keep_fargs: false,

0 commit comments

Comments
 (0)