Skip to content

Commit b6963c5

Browse files
committed
remove timeTook from object returned by processScript()
the caller can do it themselves
1 parent b4ec0ac commit b6963c5

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

src/bin/hsm.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,9 @@ for (const argument of process.argv.slice(2)) {
346346
if (!minify && mangleNames)
347347
console.warn(`warning: \`--mangle-names\` has no effect while \`--skip-minify\` is active`)
348348

349-
const { script, srcLength, warnings, timeTook } = await processScript(
349+
const timeStart = performance.now()
350+
351+
const { script, srcLength, warnings } = await processScript(
350352
source,
351353
{
352354
minify,
@@ -357,6 +359,8 @@ for (const argument of process.argv.slice(2)) {
357359
}
358360
)
359361

362+
const timeTook = performance.now() - timeStart
363+
360364
for (const { message, line } of warnings)
361365
console.log(`warning "${chalk.bold(message)}" on line ${chalk.bold(String(line))}`)
362366

src/processScript/index.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ import rollupPluginJSON from "@rollup/plugin-json"
2828
import rollupPluginNodeResolve from "@rollup/plugin-node-resolve"
2929
import { assert, countHackmudCharacters } from "@samual/lib"
3030
import { resolve as resolvePath } from "path"
31-
import { performance } from "perf_hooks"
3231
import prettier from "prettier"
3332
import { rollup } from "rollup"
3433
import { supportedExtensions as extensions } from "../constants.json"
@@ -87,11 +86,9 @@ export async function processScript(
8786
srcLength: number
8887
script: string
8988
warnings: { message: string, line: number }[]
90-
timeTook: number
9189
}> {
9290
assert(/^\w{11}$/.exec(uniqueID))
9391

94-
const time = performance.now()
9592
const sourceCode = code
9693
let autocomplete
9794
let statedSeclevel
@@ -337,13 +334,10 @@ export async function processScript(
337334
if (includesIllegalString(code))
338335
throw new Error(`you found a weird edge case where I wasn't able to replace illegal strings like "SC$", please report thx`)
339336

340-
// TODO it is not neccesary to record the time took since the caller can do that
341-
342337
return {
343338
srcLength: sourceLength,
344339
script: code,
345-
warnings: [],
346-
timeTook: performance.now() - time
340+
warnings: []
347341
}
348342
}
349343

0 commit comments

Comments
 (0)