From 1f396143970696d39824855fa626423812f89b9f Mon Sep 17 00:00:00 2001 From: * <*> Date: Wed, 15 Mar 2023 21:04:26 +0800 Subject: [PATCH 1/3] Match-id-42e6b77b81d3f947899d8ede0998c2c788be124a --- CHANGELOG.md | 4 ++ libs/horizon/index.ts | 25 +++++++---- libs/horizon/package.json | 2 +- .../src/renderer/components/ForwardRef.ts | 1 + scripts/rollup/rollup.config.js | 42 ++++++++++++------- 5 files changed, 49 insertions(+), 25 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e67f773f..a9f1b53f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.0.41 (2023-03-15) +- **core**: #105 redux + forwardRef组合使用场景会报错,redux获取组件类型不对 +- **core**: 增加jsx-dev-runtime文件,给vite使用 + ## 0.0.40 (2023-03-08) - **core**: #103 使用Memo、React.forwardRef包装组件后,defaultProps失效 - **core**: #104 --max-segment-num的style无法使用 diff --git a/libs/horizon/index.ts b/libs/horizon/index.ts index 5fffa7c9..02244280 100644 --- a/libs/horizon/index.ts +++ b/libs/horizon/index.ts @@ -18,6 +18,8 @@ import { TYPE_PROFILER as Profiler, TYPE_STRICT_MODE as StrictMode, TYPE_SUSPENSE as Suspense, + TYPE_FORWARD_REF as ForwardRef, + TYPE_MEMO as Memo, } from './src/external/JSXElementType'; import { Component, PureComponent } from './src/renderer/components/BaseClassComponent'; @@ -87,10 +89,6 @@ const Horizon = { useReducer, useRef, useState, - Fragment, - Profiler, - StrictMode, - Suspense, createElement, cloneElement, isValidElement, @@ -115,9 +113,16 @@ const Horizon = { isPortal, isContextProvider, isContextConsumer, + ForwardRef, + Memo, + Fragment, + Profiler, + StrictMode, + Suspense, }; -export const version = __VERSION__; +// export const version = __VERSION__; +export const version = '0.0.40'; export { Children, createRef, @@ -137,10 +142,6 @@ export { useReducer, useRef, useState, - Fragment, - Profiler, - StrictMode, - Suspense, createElement, cloneElement, isValidElement, @@ -167,6 +168,12 @@ export { isPortal, isContextProvider, isContextConsumer, + ForwardRef, + Memo, + Fragment, + Profiler, + StrictMode, + Suspense, }; export default Horizon; diff --git a/libs/horizon/package.json b/libs/horizon/package.json index 7393bdbc..c28cbac2 100644 --- a/libs/horizon/package.json +++ b/libs/horizon/package.json @@ -4,7 +4,7 @@ "keywords": [ "horizon" ], - "version": "0.0.40", + "version": "0.0.41", "homepage": "", "bugs": "", "main": "index.js", diff --git a/libs/horizon/src/renderer/components/ForwardRef.ts b/libs/horizon/src/renderer/components/ForwardRef.ts index 80270175..509d4c93 100644 --- a/libs/horizon/src/renderer/components/ForwardRef.ts +++ b/libs/horizon/src/renderer/components/ForwardRef.ts @@ -18,6 +18,7 @@ import { TYPE_FORWARD_REF } from '../../external/JSXElementType'; export function forwardRef(render: Function) { return { vtype: TYPE_FORWARD_REF, + $$typeof: TYPE_FORWARD_REF, // 规避三方件hoist-non-react-statics中,通过$$typeof获取类型,但获取不到导致的错误 render, }; } diff --git a/scripts/rollup/rollup.config.js b/scripts/rollup/rollup.config.js index 4e2e7cfd..b1677e44 100644 --- a/scripts/rollup/rollup.config.js +++ b/scripts/rollup/rollup.config.js @@ -20,8 +20,8 @@ import fs from 'fs'; import replace from '@rollup/plugin-replace'; import copy from './copy-plugin'; import execute from 'rollup-plugin-execute'; -import { terser } from 'rollup-plugin-terser'; -import { version as horizonVersion } from '@cloudsop/horizon/package.json'; +import {terser} from 'rollup-plugin-terser'; +import {version as horizonVersion} from '@cloudsop/horizon/package.json'; const extensions = ['.js', '.ts']; @@ -107,17 +107,29 @@ function genConfig(mode) { } function genJSXRuntimeConfig(mode) { - return { - input: path.resolve(libDir, 'jsx-runtime.ts'), - output: [ - { - file: outputResolve('jsx-runtime.js'), - format: 'cjs', - } - ], - plugins: [ - ...getBasicPlugins(mode) - ] - }; + return { + input: path.resolve(libDir, 'jsx-runtime.ts'), + output: { + file: outputResolve('jsx-runtime.js'), + format: 'cjs', + }, + plugins: [ + ...getBasicPlugins(mode) + ] + }; } -export default [genConfig('development'), genConfig('production'), genJSXRuntimeConfig('')]; + +function genJSXDEVRuntimeConfig(mode) { + return { + input: path.resolve(libDir, 'jsx-dev-runtime.ts'), + output: { + file: outputResolve('jsx-dev-runtime.js'), + format: 'cjs', + }, + plugins: [ + ...getBasicPlugins(mode) + ] + }; +} + +export default [genConfig('development'), genConfig('production'), genJSXRuntimeConfig(''), genJSXDEVRuntimeConfig('')]; From 54d611e3470cab2aa808e8e5b94312eb0963e5c7 Mon Sep 17 00:00:00 2001 From: * <*> Date: Thu, 16 Mar 2023 12:31:08 +0800 Subject: [PATCH 2/3] Match-id-0338b4ba7000d8c21aa851908bc5dc85900328f5 --- libs/horizon/index.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/libs/horizon/index.ts b/libs/horizon/index.ts index 02244280..efe6df6b 100644 --- a/libs/horizon/index.ts +++ b/libs/horizon/index.ts @@ -121,8 +121,7 @@ const Horizon = { Suspense, }; -// export const version = __VERSION__; -export const version = '0.0.40'; +export const version = __VERSION__; export { Children, createRef, From b7dc4dc2bdf19281e5b2c3b311bdc931e7c2320f Mon Sep 17 00:00:00 2001 From: * <*> Date: Thu, 16 Mar 2023 12:47:58 +0800 Subject: [PATCH 3/3] Match-id-2a744b8329166dfe01fb3ba057f453f79ff0d4c8 --- libs/horizon/jsx-dev-runtime.ts | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 libs/horizon/jsx-dev-runtime.ts diff --git a/libs/horizon/jsx-dev-runtime.ts b/libs/horizon/jsx-dev-runtime.ts new file mode 100644 index 00000000..f768f977 --- /dev/null +++ b/libs/horizon/jsx-dev-runtime.ts @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2020 Huawei Technologies Co.,Ltd. + * + * openGauss is licensed under Mulan PSL v2. + * You can use this software according to the terms and conditions of the Mulan PSL v2. + * You may obtain a copy of Mulan PSL v2 at: + * + * http://license.coscl.org.cn/MulanPSL2 + * + * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, + * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, + * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. + * See the Mulan PSL v2 for more details. + */ + +import { + TYPE_FRAGMENT as Fragment, +} from './src/external/JSXElementType'; +import { jsx as jsxDEV } from './src/external/JSXElement'; + +export { + jsxDEV, + Fragment +};