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..efe6df6b 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,6 +113,12 @@ const Horizon = { isPortal, isContextProvider, isContextConsumer, + ForwardRef, + Memo, + Fragment, + Profiler, + StrictMode, + Suspense, }; export const version = __VERSION__; @@ -137,10 +141,6 @@ export { useReducer, useRef, useState, - Fragment, - Profiler, - StrictMode, - Suspense, createElement, cloneElement, isValidElement, @@ -167,6 +167,12 @@ export { isPortal, isContextProvider, isContextConsumer, + ForwardRef, + Memo, + Fragment, + Profiler, + StrictMode, + Suspense, }; export default Horizon; 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 +}; 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('')];