diff --git a/__test__/utils.ts b/__test__/utils.ts index 2fc0ac7..6d97497 100644 --- a/__test__/utils.ts +++ b/__test__/utils.ts @@ -1,11 +1,7 @@ import * as acorn from 'acorn' import tsPlugin from '../src' -export const Parser = acorn.Parser.extend(tsPlugin({ - jsx: { - allowNamespaces: true - } -})) +export const Parser = acorn.Parser.extend(tsPlugin()) export const DtsParser = acorn.Parser.extend(tsPlugin({ dts: true diff --git a/src/extentions/jsx/index.ts b/src/extentions/jsx/index.ts index f88f436..04de4da 100644 --- a/src/extentions/jsx/index.ts +++ b/src/extentions/jsx/index.ts @@ -44,10 +44,10 @@ export default function generateJsxParser( const tok = acornTypeScript.tokTypes const isNewLine = acorn.isNewLine const isIdentifierChar = acorn.isIdentifierChar - const options = { - allowNamespaces: (Boolean(jsxOptions?.allowNamespaces)) !== false, - allowNamespacedObjects: !!(jsxOptions?.allowNamespacedObjects) - } + const options = Object.assign({ + allowNamespaces: true, + allowNamespacedObjects: true + }, jsxOptions || {}) return class JsxParser extends Parser { // Reads inline JSX contents token.