mirror of
https://github.com/bendtherules/ts-transformer-visualizer.git
synced 2026-08-18 13:51:48 +00:00
init create-react-library@2.6.7
This commit is contained in:
@@ -0,0 +1,9 @@
|
|||||||
|
root = true
|
||||||
|
|
||||||
|
[*]
|
||||||
|
charset = utf-8
|
||||||
|
indent_style = space
|
||||||
|
indent_size = 2
|
||||||
|
end_of_line = lf
|
||||||
|
insert_final_newline = true
|
||||||
|
trim_trailing_whitespace = true
|
||||||
+22
@@ -0,0 +1,22 @@
|
|||||||
|
|
||||||
|
# See https://help.github.com/ignore-files/ for more about ignoring files.
|
||||||
|
|
||||||
|
# dependencies
|
||||||
|
node_modules
|
||||||
|
|
||||||
|
# builds
|
||||||
|
build
|
||||||
|
dist
|
||||||
|
.rpt2_cache
|
||||||
|
|
||||||
|
# misc
|
||||||
|
.DS_Store
|
||||||
|
.env
|
||||||
|
.env.local
|
||||||
|
.env.development.local
|
||||||
|
.env.test.local
|
||||||
|
.env.production.local
|
||||||
|
|
||||||
|
npm-debug.log*
|
||||||
|
yarn-debug.log*
|
||||||
|
yarn-error.log*
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
language: node_js
|
||||||
|
node_js:
|
||||||
|
- 9
|
||||||
|
- 8
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
# ts-transformer-visualizer
|
||||||
|
|
||||||
|
> Visualize AST changes caused by a typescript transformer, live. Very helpful for demo.
|
||||||
|
|
||||||
|
[](https://www.npmjs.com/package/ts-transformer-visualizer) [](https://standardjs.com)
|
||||||
|
|
||||||
|
## Install
|
||||||
|
|
||||||
|
```bash
|
||||||
|
npm install --save ts-transformer-visualizer
|
||||||
|
```
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
```tsx
|
||||||
|
import * as React from 'react'
|
||||||
|
|
||||||
|
import MyComponent from 'ts-transformer-visualizer'
|
||||||
|
|
||||||
|
class Example extends React.Component {
|
||||||
|
render () {
|
||||||
|
return (
|
||||||
|
<MyComponent />
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
MIT © [bendtherules](https://github.com/bendtherules)
|
||||||
+2164
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,20 @@
|
|||||||
|
{
|
||||||
|
"name": "ts-transformer-visualizer-example",
|
||||||
|
"homepage": "https://bendtherules.github.io/ts-transformer-visualizer",
|
||||||
|
"version": "0.0.0",
|
||||||
|
"license": "MIT",
|
||||||
|
"private": true,
|
||||||
|
"dependencies": {
|
||||||
|
"prop-types": "^15.6.2",
|
||||||
|
"react": "^16.4.1",
|
||||||
|
"react-dom": "^16.4.1",
|
||||||
|
"react-scripts": "^1.1.4",
|
||||||
|
"ts-transformer-visualizer": "link:.."
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"start": "react-scripts start",
|
||||||
|
"build": "react-scripts build",
|
||||||
|
"test": "react-scripts test --env=jsdom",
|
||||||
|
"eject": "react-scripts eject"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
<!doctype html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||||
|
<meta name="theme-color" content="#000000">
|
||||||
|
|
||||||
|
<link rel="manifest" href="%PUBLIC_URL%/manifest.json">
|
||||||
|
|
||||||
|
<title>ts-transformer-visualizer</title>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<noscript>
|
||||||
|
You need to enable JavaScript to run this app.
|
||||||
|
</noscript>
|
||||||
|
|
||||||
|
<div id="root"></div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"short_name": "ts-transformer-visualizer",
|
||||||
|
"name": "ts-transformer-visualizer",
|
||||||
|
"start_url": "./index.html",
|
||||||
|
"display": "standalone",
|
||||||
|
"theme_color": "#000000",
|
||||||
|
"background_color": "#ffffff"
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
import React, { Component } from 'react'
|
||||||
|
|
||||||
|
import ExampleComponent from 'ts-transformer-visualizer'
|
||||||
|
|
||||||
|
export default class App extends Component {
|
||||||
|
render () {
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
<ExampleComponent text='Modern React component module' />
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
body {
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
font-family: sans-serif;
|
||||||
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
import React from 'react'
|
||||||
|
import ReactDOM from 'react-dom'
|
||||||
|
|
||||||
|
import './index.css'
|
||||||
|
import App from './App'
|
||||||
|
|
||||||
|
ReactDOM.render(<App />, document.getElementById('root'))
|
||||||
+8325
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,55 @@
|
|||||||
|
{
|
||||||
|
"name": "ts-transformer-visualizer",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"description": "Visualize AST changes caused by a typescript transformer, live. Very helpful for demo.",
|
||||||
|
"author": "bendtherules",
|
||||||
|
"license": "MIT",
|
||||||
|
"repository": "bendtherules/ts-transformer-visualizer",
|
||||||
|
"main": "dist/index.js",
|
||||||
|
"module": "dist/index.es.js",
|
||||||
|
"jsnext:main": "dist/index.es.js",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=8",
|
||||||
|
"npm": ">=5"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"test": "cross-env CI=1 react-scripts-ts test --env=jsdom",
|
||||||
|
"test:watch": "react-scripts-ts test --env=jsdom",
|
||||||
|
"build": "rollup -c",
|
||||||
|
"start": "rollup -c -w",
|
||||||
|
"prepare": "yarn run build",
|
||||||
|
"predeploy": "cd example && yarn install && yarn run build",
|
||||||
|
"deploy": "gh-pages -d example/build"
|
||||||
|
},
|
||||||
|
"dependencies": {},
|
||||||
|
"peerDependencies": {
|
||||||
|
"prop-types": "^15.5.4",
|
||||||
|
"react": "^15.0.0 || ^16.0.0",
|
||||||
|
"react-dom": "^15.0.0 || ^16.0.0"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@svgr/rollup": "^2.4.1",
|
||||||
|
"@types/jest": "^23.1.5",
|
||||||
|
"@types/react": "^16.3.13",
|
||||||
|
"@types/react-dom": "^16.0.5",
|
||||||
|
"babel-core": "^6.26.3",
|
||||||
|
"babel-runtime": "^6.26.0",
|
||||||
|
"cross-env": "^5.1.4",
|
||||||
|
"gh-pages": "^1.2.0",
|
||||||
|
"react": "^16.4.1",
|
||||||
|
"react-dom": "^16.4.1",
|
||||||
|
"react-scripts-ts": "^2.16.0",
|
||||||
|
"rollup": "^0.62.0",
|
||||||
|
"rollup-plugin-babel": "^3.0.7",
|
||||||
|
"rollup-plugin-commonjs": "^9.1.3",
|
||||||
|
"rollup-plugin-node-resolve": "^3.3.0",
|
||||||
|
"rollup-plugin-peer-deps-external": "^2.2.0",
|
||||||
|
"rollup-plugin-postcss": "^1.6.2",
|
||||||
|
"rollup-plugin-typescript2": "^0.17.0",
|
||||||
|
"rollup-plugin-url": "^1.4.0",
|
||||||
|
"typescript": "^2.8.3"
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
"dist"
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
import typescript from 'rollup-plugin-typescript2'
|
||||||
|
import commonjs from 'rollup-plugin-commonjs'
|
||||||
|
import external from 'rollup-plugin-peer-deps-external'
|
||||||
|
// import postcss from 'rollup-plugin-postcss-modules'
|
||||||
|
import postcss from 'rollup-plugin-postcss'
|
||||||
|
import resolve from 'rollup-plugin-node-resolve'
|
||||||
|
import url from 'rollup-plugin-url'
|
||||||
|
import svgr from '@svgr/rollup'
|
||||||
|
|
||||||
|
import pkg from './package.json'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
input: 'src/index.tsx',
|
||||||
|
output: [
|
||||||
|
{
|
||||||
|
file: pkg.main,
|
||||||
|
format: 'cjs',
|
||||||
|
exports: 'named',
|
||||||
|
sourcemap: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
file: pkg.module,
|
||||||
|
format: 'es',
|
||||||
|
exports: 'named',
|
||||||
|
sourcemap: true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
plugins: [
|
||||||
|
external(),
|
||||||
|
postcss({
|
||||||
|
modules: true
|
||||||
|
}),
|
||||||
|
url(),
|
||||||
|
svgr(),
|
||||||
|
resolve(),
|
||||||
|
typescript({
|
||||||
|
rollupCommonJSResolveHack: true,
|
||||||
|
clean: true
|
||||||
|
}),
|
||||||
|
commonjs()
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
/**
|
||||||
|
* @class ExampleComponent
|
||||||
|
*/
|
||||||
|
|
||||||
|
import * as React from 'react'
|
||||||
|
|
||||||
|
import styles from './styles.css'
|
||||||
|
|
||||||
|
export type Props = { text: string }
|
||||||
|
|
||||||
|
export default class ExampleComponent extends React.Component<Props> {
|
||||||
|
render() {
|
||||||
|
const {
|
||||||
|
text
|
||||||
|
} = this.props
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className={styles.test}>
|
||||||
|
Example Component: {text}
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
/* add css styles here (optional) */
|
||||||
|
|
||||||
|
.test {
|
||||||
|
display: inline-block;
|
||||||
|
margin: 2em auto;
|
||||||
|
border: 2px solid #000;
|
||||||
|
font-size: 2em;
|
||||||
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
import ExampleComponent from './'
|
||||||
|
|
||||||
|
describe('ExampleComponent', () => {
|
||||||
|
it('is truthy', () => {
|
||||||
|
expect(ExampleComponent).toBeTruthy()
|
||||||
|
})
|
||||||
|
})
|
||||||
Vendored
+17
@@ -0,0 +1,17 @@
|
|||||||
|
/**
|
||||||
|
* Default CSS definition for typescript,
|
||||||
|
* will be overridden with file-specific definitions by rollup
|
||||||
|
*/
|
||||||
|
declare module '*.css' {
|
||||||
|
const content: { [className: string]: string };
|
||||||
|
export default content;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface SvgrComponent extends React.StatelessComponent<React.SVGAttributes<SVGElement>> {}
|
||||||
|
|
||||||
|
declare module '*.svg' {
|
||||||
|
const svgUrl: string;
|
||||||
|
const svgComponent: SvgrComponent;
|
||||||
|
export default svgUrl;
|
||||||
|
export { svgComponent as ReactComponent }
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"outDir": "build",
|
||||||
|
"module": "esnext",
|
||||||
|
"target": "es5",
|
||||||
|
"lib": ["es6", "dom", "es2016", "es2017"],
|
||||||
|
"sourceMap": true,
|
||||||
|
"allowJs": false,
|
||||||
|
"jsx": "react",
|
||||||
|
"declaration": true,
|
||||||
|
"moduleResolution": "node",
|
||||||
|
"forceConsistentCasingInFileNames": true,
|
||||||
|
"noImplicitReturns": true,
|
||||||
|
"noImplicitThis": true,
|
||||||
|
"noImplicitAny": true,
|
||||||
|
"strictNullChecks": true,
|
||||||
|
"suppressImplicitAnyIndexErrors": true,
|
||||||
|
"noUnusedLocals": true,
|
||||||
|
"noUnusedParameters": true
|
||||||
|
},
|
||||||
|
"include": ["src"],
|
||||||
|
"exclude": ["node_modules", "build", "dist", "example", "rollup.config.js"]
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"extends": "./tsconfig.json",
|
||||||
|
"compilerOptions": {
|
||||||
|
"module": "commonjs"
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user