From 98d422a7a66e28b423cb818566776ec8d7695cbf Mon Sep 17 00:00:00 2001 From: Anillc Date: Sun, 8 Aug 2021 22:05:29 +0800 Subject: [PATCH] chore(puppeteer): remove wrapFactory function --- packages/plugin-puppeteer/src/worker.ts | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/packages/plugin-puppeteer/src/worker.ts b/packages/plugin-puppeteer/src/worker.ts index 76e2538136..da4d491694 100644 --- a/packages/plugin-puppeteer/src/worker.ts +++ b/packages/plugin-puppeteer/src/worker.ts @@ -4,15 +4,13 @@ import { renderToStaticMarkup } from 'react-dom/server' import { segment } from 'koishi-core' import { inspect } from 'util' -function wrapFactory any>(func: F) { - return (...args: Parameters) => { - const node = Object.create(func.apply(null, args)) - node[inspect.custom] = function () { - return segment('fragment', { content: renderToStaticMarkup(this) }) - } - return node +function customJsxFactory(...args: Parameters) { + const node = Object.create(createElement.apply(null, args)) + node[inspect.custom] = function () { + return segment('fragment', { content: renderToStaticMarkup(this) }) } + return node } -internal.setGlobal(config.loaderConfig.jsxFactory, wrapFactory(createElement)) +internal.setGlobal(config.loaderConfig.jsxFactory, customJsxFactory) internal.setGlobal(config.loaderConfig.jsxFragment, Fragment)