automd
automd copied to clipboard
jsdocs: async arrow function causes error
Environment
Node: v22 automd: v0.3.12
Reproduction
const hoge = async () => {
await something()
}
Describe the bug
It fails:
SyntaxError: Unexpected reserved word
Additional context
No response
Logs
[6:14:24] ✔ Automd updated (667.54ms)
[6:14:24] ─ t.md with issues (205.35ms)
[6:14:24] WARN Some issues happened during automd update:
[6:14:24] t.md
SyntaxError: Unexpected reserved word
[6:14:24]
https://github.com/holyfata-reproduction/automd-issue99-reproduction I made a repo for the issue, the amazing thing is that if you export the async function it will be ok. However, to normal, if will be ok even it is not exported.
import { createJiti } from 'jiti';
import path from 'node:path';
import { defu } from 'defu';
import babelPluginUntyped from 'untyped/babel-plugin';
// const jitiOptions = { fsCache: false, moduleCache: false }
const jitiOptions = { moduleCache: false }
const options: {
jiti?: any
} = { jiti: jitiOptions };
const jiti = createJiti(
process.cwd(),
defu(options.jiti, {
interopDefault: true,
transformOptions: {
babel: {
plugins: [[babelPluginUntyped, { experimentalFunctions: true }]]
}
}
})
);
const rawSchema = await jiti.import(path.join(__dirname, 'func1.ts'));
console.log(rawSchema);
This code cause the issue, i think it's the issue in jiti.
- The scheme is {}
- when fsCache is false, the code will throw a error