Skip to content

Commit

Permalink
Merge pull request #6643 from alibaba/feat/rax_compat_default_export_…
Browse files Browse the repository at this point in the history
…support

Default export support for rax-compat
  • Loading branch information
linbudu599 authored Nov 23, 2023
2 parents 4aea12e + 60dd208 commit 508d893
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 48 deletions.
5 changes: 5 additions & 0 deletions .changeset/proud-buckets-beg.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'rax-compat': patch
---

default export support
46 changes: 46 additions & 0 deletions packages/rax-compat/src/exports.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import { createElement } from './create-element.js';
import render from './render.js';
import {
useState,
useContext,
useEffect,
useLayoutEffect,
useRef,
useCallback,
useMemo,
useReducer,
useImperativeHandle,
} from './hooks.js';
import Fragment from './fragment.js';
import { forwardRef, createRef } from './ref.js';
import { Component, PureComponent, memo } from './component.js';
import { createContext } from './context.js';
import shared from './shared.js';

// Mocked version for rax.
const version = '1.2.2-compat';

export {
Component,
Fragment,
PureComponent,
createContext,
createElement,
createRef,
forwardRef,
memo,
render,

// This is mocked object for rax compatible.
shared,
useCallback,
useContext,
useEffect,
useImperativeHandle,
useLayoutEffect,
useMemo,
useReducer,
useRef,
useState,
version,
};
51 changes: 3 additions & 48 deletions packages/rax-compat/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,50 +1,5 @@
import { createElement } from './create-element.js';
import render from './render.js';
import {
useState,
useContext,
useEffect,
useLayoutEffect,
useRef,
useCallback,
useMemo,
useReducer,
useImperativeHandle,
} from './hooks.js';
import Fragment from './fragment.js';
import { forwardRef, createRef } from './ref.js';
import { Component, PureComponent, memo } from './component.js';
import { createContext } from './context.js';
import shared from './shared.js';
import * as Rax from './exports.js';

// Mocked version for rax.
const version = '1.2.2-compat';
export * from './exports.js';

export {
Component,
Fragment,
PureComponent,

createContext,
createElement,
createRef,
forwardRef,
memo,

render,

// This is mocked object for rax compatible.
shared,

useCallback,
useContext,
useEffect,
useImperativeHandle,
useLayoutEffect,
useMemo,
useReducer,
useRef,
useState,

version,
};
export default Rax;

0 comments on commit 508d893

Please sign in to comment.