From 922e30f8a9e5700a47bfdaadfe8caa1992402114 Mon Sep 17 00:00:00 2001 From: Jian Liao Date: Sat, 4 Mar 2023 20:43:12 -0800 Subject: [PATCH] fix: overlay react wrapper generation --- cem-react-wrapper.config.js | 7 ++++++- custom-elements-manifest.config.js | 8 +++++++- scripts/cem-plugin-react-wrapper.js | 6 ++++-- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/cem-react-wrapper.config.js b/cem-react-wrapper.config.js index 847f57c5e2..9695000b8c 100644 --- a/cem-react-wrapper.config.js +++ b/cem-react-wrapper.config.js @@ -16,7 +16,12 @@ import { resolve } from 'path'; import yaml from 'js-yaml'; export default { - globs: ['**/sp-*.ts', '**/src/[A-Z]*.ts'], + globs: [ + '**/sp-*.ts', + '**/active-overlay.ts', + '**/overlay-trigger.ts', + '**/src/[A-Z]*.ts', + ], exclude: [ '**/sp-icon-*.ts', '**/*.d.ts', diff --git a/custom-elements-manifest.config.js b/custom-elements-manifest.config.js index 580009dcd1..76abca6118 100644 --- a/custom-elements-manifest.config.js +++ b/custom-elements-manifest.config.js @@ -13,7 +13,13 @@ governing permissions and limitations under the License. import { moduleFileExtensionsPlugin } from 'cem-plugin-module-file-extensions'; export default { - globs: ['**/sp-*.ts', '**/src/[A-Z]*.ts', '**/src/elements/[A-Z]*.ts'], + globs: [ + '**/sp-*.ts', + '**/active-overlay.ts', + '**/overlay-trigger.ts', + '**/src/[A-Z]*.ts', + '**/src/elements/[A-Z]*.ts', + ], exclude: [ '**/*.d.ts', '**/stories/**', diff --git a/scripts/cem-plugin-react-wrapper.js b/scripts/cem-plugin-react-wrapper.js index 4b1f905b27..1768ecd0ae 100644 --- a/scripts/cem-plugin-react-wrapper.js +++ b/scripts/cem-plugin-react-wrapper.js @@ -175,8 +175,10 @@ export default function genReactWrapper({ const fileImports = modules .filter( (m) => - m.declarations.length === 0 && - m.path.indexOf('sync/') === -1 + m.exports.length === 1 && + m.exports.filter( + (exp) => exp.kind === 'custom-element-definition' + ).length > 0 ) .map( (m) =>