Skip to content

Commit b914dde

Browse files
committed
type and reformat rollup config file
update dependencies add `BUG` todo comment
1 parent e9c4f82 commit b914dde

3 files changed

Lines changed: 32 additions & 26 deletions

File tree

package-lock.json

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

rollup.config.js

Lines changed: 24 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -7,28 +7,32 @@ import { dependencies } from "./package.json"
77

88
const { readdir: readDirectory } = fsPromises
99

10+
/** @typedef {import("rollup").RollupOptions} RollupOptions */
11+
1012
const sourceDirectory = "src"
1113

12-
export default async () => {
13-
return {
14-
input: Object.fromEntries((await findFiles(sourceDirectory)).filter(path => path.endsWith(".ts")).map(path => [ path.slice(sourceDirectory.length + 1, -3), path ])),
15-
output: {
16-
dir: "."
17-
},
18-
plugins: [
19-
json({ preferConst: true }),
20-
typescript({ tsconfig: `${sourceDirectory}/tsconfig.json` }),
21-
preserveShebang(),
22-
terser()
23-
],
24-
external: [
25-
...Object.keys(dependencies),
26-
"fs",
27-
"path",
28-
"os"
29-
]
30-
}
31-
}
14+
/** @type {(command: Record<string, unknown>) => Promise<RollupOptions>} */
15+
export default async () => ({
16+
input: Object.fromEntries((await findFiles(sourceDirectory))
17+
.filter(path => path.endsWith(".ts"))
18+
.map(path => [ path.slice(sourceDirectory.length + 1, -3), path ])
19+
),
20+
output: {
21+
dir: "."
22+
},
23+
plugins: [
24+
json({ preferConst: true }),
25+
typescript({ tsconfig: `${sourceDirectory}/tsconfig.json` }),
26+
preserveShebang(),
27+
terser()
28+
],
29+
external: [
30+
...Object.keys(dependencies),
31+
"fs",
32+
"path",
33+
"os"
34+
]
35+
})
3236

3337
/**
3438
* @param path the directory to start recursively finding files in

src/processScript.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -394,6 +394,8 @@ export async function processScript(script: string) {
394394
if (token.value.includes("\u0000"))
395395
break
396396

397+
// BUG in the code `({ "-": "bar" })` `"-"` is recognised as a string and is replaced with `_JSON_VALUE_n_` which is not equivalent code
398+
397399
let jsonValueIndex = jsonValues.indexOf(token.value)
398400

399401
if (jsonValueIndex == -1)

0 commit comments

Comments
 (0)