$ npm install jsx-compiler
Transform JSX styled Rax Components into miniapp parts.
input:
import { Component } from 'rax';
export default class extends Component {
render() {
return (<view>hello world</view>);
}
}
Run jsx compiler.
app
, page
, component
.const compile = require('jsx-compiler');
const { baseOptions } = compile;
const output = compile(code, { ...baseOptions, type: 'component' });
output:
eg.
{
ast: ASTNodeTree,
imported: {
rax: [
{
local: "Component",
default: false,
importFrom: "Component",
name: "rax",
external: true
}
]
},
exported: ["default"],
code:
'import { createComponent as __create_component__, Component as __component__ } from "jsx2mp-runtime";\n\nconst __def__ = class extends __component__ {\n render() {\n return {};\n }\n\n};\n\nComponent(__create_component__(__def__, {\n events: []\n}));',
map: null,
config: {
component: true
},
style: "",
usingComponents: {},
template: "<view>hello world</view>"
}
© 2010 - cnpmjs.org x YWFE | Home | YWFE