-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build: introduce TypeScript to the project
- Loading branch information
Showing
15 changed files
with
2,018 additions
and
3,343 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
src | ||
.babelrc | ||
webpack.config.js | ||
assets |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import React from 'react'; | ||
declare type Mode = 'open' | 'element'; | ||
export declare const registerAsWebComponent: (component: React.ElementType, customElementName: string, mode?: Mode) => void; | ||
export {}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import React from 'react'; | ||
export declare const renderReact2Node: (RComponent: React.ElementType, initialProps: {}, targetDomNode: Element | DocumentFragment, onRender: (ref: React.RefObject<any>) => void) => void; | ||
export declare const sendPropsToReact: (propBridgeRef: React.RefObject<any>, props: any) => void; | ||
export declare const getPropsFromNode: (node: HTMLElement) => { | ||
[key: string]: string | JSX.Element; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import React from 'react'; | ||
import 'child-replace-with-polyfill'; | ||
export declare class ReactDomChild extends React.Component { | ||
ref: React.RefObject<HTMLDivElement>; | ||
componentDidMount(): void; | ||
render(): JSX.Element; | ||
} |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
declare module 'react-create-ref' { | ||
import React from 'react'; | ||
|
||
type ReactCreateRef<T> = typeof React.createRef extends Function | ||
? React.RefObject<T> | ||
: () => { current: null }; | ||
|
||
export default function createRef<T>(): ReactCreateRef<T>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"compilerOptions": { | ||
"outDir": "./dist/", | ||
"declaration": true, | ||
"noImplicitAny": true, | ||
"module": "es6", | ||
"sourceMap": true, | ||
"target": "es6", | ||
"allowSyntheticDefaultImports": true, | ||
"jsx": "react", | ||
"typeRoots": [ | ||
"node_modules/@types", | ||
"src/types" | ||
], | ||
"lib": [ | ||
"ES2017", | ||
"DOM" | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,40 @@ | ||
var path = require("path"); | ||
var path = require('path'); | ||
|
||
module.exports = { | ||
entry: "./src/index.js", | ||
mode: "development", | ||
entry: './src/index.ts', | ||
devtool: 'inline-source-map', | ||
mode: 'development', | ||
resolve: { | ||
extensions: ['.ts', '.js', '.tsx'], | ||
}, | ||
output: { | ||
path: path.resolve(__dirname, "dist"), | ||
filename: "build.js", | ||
libraryTarget: "commonjs2" | ||
path: path.resolve(__dirname, 'dist'), | ||
filename: 'build.js', | ||
libraryTarget: 'commonjs2', | ||
}, | ||
devtool: "none", | ||
module: { | ||
rules: [ | ||
{ | ||
test: /\.js$/, | ||
exclude: /(node_modules|bower_components)/, | ||
use: { | ||
loader: "babel-loader" | ||
} | ||
} | ||
] | ||
test: /\.tsx?/, | ||
use: 'ts-loader', | ||
exclude: /node_modules/, | ||
}, | ||
], | ||
}, | ||
externals: { | ||
react: { | ||
root: "React", | ||
commonjs2: "react", | ||
commonjs: "react", | ||
amd: "react", | ||
umd: "react" | ||
root: 'React', | ||
commonjs2: 'react', | ||
commonjs: 'react', | ||
amd: 'react', | ||
umd: 'react', | ||
}, | ||
'react-dom': { | ||
root: 'ReactDOM', | ||
commonjs2: 'react-dom', | ||
commonjs: 'react-dom', | ||
amd: 'react-dom', | ||
umd: 'react-dom', | ||
}, | ||
"react-dom": { | ||
root: "ReactDOM", | ||
commonjs2: "react-dom", | ||
commonjs: "react-dom", | ||
amd: "react-dom", | ||
umd: "react-dom" | ||
} | ||
} | ||
}, | ||
}; |