All Projects → dropbox → ts-transform-react-constant-elements

dropbox / ts-transform-react-constant-elements

Licence: Apache-2.0 license
A TypeScript AST Transformer that can speed up reconciliation and reduce garbage collection pressure by hoisting React elements to the highest possible scope.

Programming Languages

typescript
32286 projects

Projects that are alternatives of or similar to ts-transform-react-constant-elements

ts-transform-react-jsx-source
TypeScript AST Transformer that adds source file and line number to JSX elements
Stars: ✭ 12 (-72.73%)
Mutual labels:  ast, transform
Ts Transform Css Modules
Extract css class names from required css module files for TypeScript
Stars: ✭ 75 (+70.45%)
Mutual labels:  ast, transform
Ts Transform Import Path Rewrite
TS AST transformer to rewrite import path
Stars: ✭ 104 (+136.36%)
Mutual labels:  ast, transform
gogoAST
The simplest tool to parse/transform/generate code on ast
Stars: ✭ 29 (-34.09%)
Mutual labels:  ast
scope-analyzer
simple scope analysis for javascript ASTs
Stars: ✭ 20 (-54.55%)
Mutual labels:  ast
Similar-Craft
Find similar elements
Stars: ✭ 32 (-27.27%)
Mutual labels:  elements
toast
Plugin-driven CLI utility for code generation using Go source as IDL
Stars: ✭ 52 (+18.18%)
Mutual labels:  ast
ReactPropTypes-Plugin
A Jetbrains Plugin for react PropTypes
Stars: ✭ 62 (+40.91%)
Mutual labels:  ast
code summarization public
source code for 'Improving automatic source code summarization via deep reinforcement learning'
Stars: ✭ 71 (+61.36%)
Mutual labels:  ast
freAST
Fast, simple Free Monads using ScalaMeta macro annotations. Port of Freasy-Monad.
Stars: ✭ 14 (-68.18%)
Mutual labels:  ast
dft
Discrete Fourier transform
Stars: ✭ 25 (-43.18%)
Mutual labels:  transform
klara
Automatic test case generation for python and static analysis library
Stars: ✭ 250 (+468.18%)
Mutual labels:  ast
sortboard
A small ES6 library for easy sorting and filtering of elements.
Stars: ✭ 29 (-34.09%)
Mutual labels:  elements
gram-js
Gram in javascript.
Stars: ✭ 21 (-52.27%)
Mutual labels:  ast
flutter ast
Flutter and Dart AST Analyzer/Parser
Stars: ✭ 87 (+97.73%)
Mutual labels:  ast
jest-preset-coffeescript
🃏 Easily write your Jests in @coffeescript.
Stars: ✭ 18 (-59.09%)
Mutual labels:  transform
XYFSnowAnimation
A category of NSTimer for showing 3D Fluttered animation for iOS, which is used very simply. Lightweight CALayer animation, core animation, 3D transform, performance safety. iOS 3D三维飘落下雪落花动画,轻量级CALayer图层动画,核心动画,3D形变,性能安全,定时器NSTimer分类,直接使用,很简单
Stars: ✭ 15 (-65.91%)
Mutual labels:  transform
navis
Python 3 library for analysis of neuroanatomical data
Stars: ✭ 68 (+54.55%)
Mutual labels:  transform
Python3Generator
A toolkit to generate Python 3 source code from Pharo.
Stars: ✭ 25 (-43.18%)
Mutual labels:  ast
c-compiler
A compiler that accepts any valid program written in C. It is made using Lex and Yacc. Returns a symbol table, parse tree, annotated syntax tree and intermediate code.
Stars: ✭ 37 (-15.91%)
Mutual labels:  ast

ts-transform-react-constant-elements

build status

This is a TypeScript AST Transformer that can speed up reconciliation and reduce garbage collection pressure by hoisting React elements to the highest possible scope, preventing multiple unnecessary reinstantiations, similar to babel-plugin-transform-react-constant-elements.

Example:

const Hr = () => {
  return <hr className="hr" />;
};

// becomes 
const _ref = <hr className="hr" />;

const Hr = () => {
  return _ref;
};

This is especially useful for hoisting static but expensive content such as SVG.

Usage

First of all, you need some level of familiarity with the TypeScript Compiler API.

compile.ts & tests should have examples of how this works. The available options are:

verbose?: boolean

Enabling this will allow this transformer to log out which nodes are hoisted.

License

Copyright (c) 2018 Dropbox, Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].