From 8b4dc27282d064ed06a296c71b004dab0f09ad93 Mon Sep 17 00:00:00 2001 From: Jason Miller Date: Mon, 21 Sep 2020 15:58:19 -0400 Subject: [PATCH 1/2] Add `terse` option --- packages/babel-plugin-transform-jsx-to-htm/index.mjs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/packages/babel-plugin-transform-jsx-to-htm/index.mjs b/packages/babel-plugin-transform-jsx-to-htm/index.mjs index 2fcbb4a..8e311fe 100644 --- a/packages/babel-plugin-transform-jsx-to-htm/index.mjs +++ b/packages/babel-plugin-transform-jsx-to-htm/index.mjs @@ -4,6 +4,7 @@ import jsx from '@babel/plugin-syntax-jsx'; * @param {Babel} babel * @param {object} [options] * @param {string} [options.tag='html'] The tagged template "tag" function name to produce. + * @param {boolean} [options.terse=true] Output `` for closing component tags * @param {string | boolean | object} [options.import=false] Import the tag automatically */ export default function jsxToHtmBabelPlugin({ types: t }, options = {}) { @@ -130,9 +131,14 @@ export default function jsxToHtmBabelPlugin({ types: t }, options = {}) { if (!isFragment) { if (isComponentName(name)) { - raw(''); + if (options.terse) { + raw(''); + } + else { + raw(''); + } } else { raw(' Date: Mon, 21 Sep 2020 15:58:40 -0400 Subject: [PATCH 2/2] Update index.mjs --- packages/babel-plugin-transform-jsx-to-htm/index.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/babel-plugin-transform-jsx-to-htm/index.mjs b/packages/babel-plugin-transform-jsx-to-htm/index.mjs index 8e311fe..2f7dc93 100644 --- a/packages/babel-plugin-transform-jsx-to-htm/index.mjs +++ b/packages/babel-plugin-transform-jsx-to-htm/index.mjs @@ -4,7 +4,7 @@ import jsx from '@babel/plugin-syntax-jsx'; * @param {Babel} babel * @param {object} [options] * @param {string} [options.tag='html'] The tagged template "tag" function name to produce. - * @param {boolean} [options.terse=true] Output `` for closing component tags + * @param {boolean} [options.terse=false] Output `` for closing component tags * @param {string | boolean | object} [options.import=false] Import the tag automatically */ export default function jsxToHtmBabelPlugin({ types: t }, options = {}) {