automd icon indicating copy to clipboard operation
automd copied to clipboard

jsdocs: async arrow function causes error

Open sevenc-nanashi opened this issue 11 months ago • 3 comments

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] 

sevenc-nanashi avatar Jan 13 '25 21:01 sevenc-nanashi

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.

holyfata avatar Apr 05 '25 10:04 holyfata

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.

holyfata avatar Apr 05 '25 11:04 holyfata

  1. The scheme is {}
  2. when fsCache is false, the code will throw a error

holyfata avatar Apr 05 '25 11:04 holyfata