better jsx mapper, versatile jsx config
This commit is contained in:
parent
bfeb85b674
commit
ebcce354d0
@ -49,7 +49,7 @@ export const HMR =
|
|||||||
|
|
||||||
export type StateType = boolean|number|string|Record<string, string>
|
export type StateType = boolean|number|string|Record<string, string>
|
||||||
export type StateCapture = {state:StateType, set:ReactParts.StateUpdater<StateType>, reload:number};
|
export type StateCapture = {state:StateType, set:ReactParts.StateUpdater<StateType>, reload:number};
|
||||||
type FuncArgs = [element:keyof ReactParts.JSX.IntrinsicElements, props:Record<string, string>, children:ReactParts.JSX.Element[]];
|
type FuncArgs = [element:keyof ReactParts.JSX.IntrinsicElements, props:Record<string, string>, children?:ReactParts.JSX.Element[]];
|
||||||
|
|
||||||
|
|
||||||
const H = ReactParts.createElement;
|
const H = ReactParts.createElement;
|
||||||
@ -172,6 +172,8 @@ const ProxyReducer =(inReducer:(inState:Storelike, inAction:string)=>Storelike,
|
|||||||
};
|
};
|
||||||
|
|
||||||
export * from "react-original";
|
export * from "react-original";
|
||||||
const Fragment = ReactParts.Fragment;
|
|
||||||
export {ProxyCreate as createElement, ProxyCreate as jsx, ProxyCreate as jsxs, Fragment, ProxyState as useState, ProxyReducer as useReducer };
|
const ProxyFragment = ReactParts.Fragment;
|
||||||
export default {...ReactParts, createElement:ProxyCreate, jsx:ProxyCreate, jsxs:ProxyCreate, Fragment, useState:ProxyState, useReducer:ProxyReducer};
|
const ProxyJSX = (type:keyof ReactParts.JSX.IntrinsicElements, props:object, key:string)=>ProxyCreate(type, {...props, key});
|
||||||
|
export {ProxyCreate as createElement, ProxyJSX as jsx, ProxyJSX as jsxs, ProxyFragment as Fragment, ProxyState as useState, ProxyReducer as useReducer };
|
||||||
|
export default {...ReactParts, createElement:ProxyCreate, jsx:ProxyJSX, jsxs:ProxyJSX, Fragment: ProxyFragment, useState:ProxyState, useReducer:ProxyReducer};
|
@ -90,7 +90,7 @@ for(const key in denoBody.imports)
|
|||||||
denoBody.imports[key] = "/>/"+value;
|
denoBody.imports[key] = "/>/"+value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const react = denoBody.compilerOptions.jsxImportSource;
|
const react = denoBody.compilerOptions.jsxImportSource || "react";
|
||||||
denoBody.imports["react-original"] = denoBody.imports[react];
|
denoBody.imports["react-original"] = denoBody.imports[react];
|
||||||
denoBody.imports[react] = "/^/hmr/hmr-react.tsx";
|
denoBody.imports[react] = "/^/hmr/hmr-react.tsx";
|
||||||
denoBody.imports[react+"/jsx-runtime"] = "/^/hmr/hmr-react.tsx";
|
denoBody.imports[react+"/jsx-runtime"] = "/^/hmr/hmr-react.tsx";
|
||||||
|
Loading…
Reference in New Issue
Block a user