feat: cls2fn
This commit is contained in:
parent
bf90ea1b7f
commit
7b4c3a35d0
|
@ -3,10 +3,6 @@ import * as babel from '@babel/core';
|
||||||
import { Option } from './types';
|
import { Option } from './types';
|
||||||
import type { Scope } from '@babel/traverse';
|
import type { Scope } from '@babel/traverse';
|
||||||
|
|
||||||
const DECORATOR_PROPS = 'Prop';
|
|
||||||
const DECORATOR_CHILDREN = 'Children';
|
|
||||||
const DECORATOR_WATCH = 'Watch';
|
|
||||||
|
|
||||||
function replaceFnWithClass(path: NodePath<t.FunctionDeclaration>, classTransformer: ClassComponentTransformer) {
|
function replaceFnWithClass(path: NodePath<t.FunctionDeclaration>, classTransformer: ClassComponentTransformer) {
|
||||||
const originalName = path.node.id.name;
|
const originalName = path.node.id.name;
|
||||||
const tempName = path.node.id.name + 'Temp';
|
const tempName = path.node.id.name + 'Temp';
|
||||||
|
@ -208,7 +204,7 @@ class ClassComponentTransformer {
|
||||||
/**
|
/**
|
||||||
* transform node to watch label to watch decorator
|
* transform node to watch label to watch decorator
|
||||||
* e.g.
|
* e.g.
|
||||||
*
|
*
|
||||||
* watch: console.log(state)
|
* watch: console.log(state)
|
||||||
* // transform into
|
* // transform into
|
||||||
* @Watch
|
* @Watch
|
||||||
|
|
Loading…
Reference in New Issue