New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

jsx-compiler

Package Overview
Dependencies
Maintainers
5
Versions
152
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jsx-compiler

Parser for Rax JSX Statements.

  • 0.4.37
  • latest
  • npm
  • Socket score

Version published
Maintainers
5
Created
Source

jsx-compiler

Transform JSX styled Rax Components into miniapp parts.

example

input:

import { Component } from 'rax';

export default class extends Component {

  render() {
    return (<view>hello world</view>);
  }
}

Run jsx compiler.

  • type: Required, enum of app, page, component.
  • outputPath: Required, string of dist path.
  • sourcePath: Required, string of source path.
  • resourcePath: Required, string of original file path.
const compile = require('jsx-compiler');
const { baseOptions } = compile;

const output = compile(code, { ...baseOptions, type: 'component' });

output:

  • ast
    • Babel 7 format AST of JS code
  • imported
    • Imported modules and local identifiers
  • exported
    • Exported identifiers
  • template
    • axml template for miniapp
  • code
    • Transformed JS code.
  • map
    • Source map of JS code
  • config
    • JS Object, miniapp config
  • style
    • String, acss of style.
  • usingComponents

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>"
}

FAQs

Package last updated on 16 Sep 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc