0.2.2 • Published 6 years ago

@twist/babel-plugin-transform v0.2.2

Weekly downloads
3
License
Apache-2.0
Repository
github
Last release
6 years ago

babel-plugin-transform-twist

Build Status

This babel plugin provides support for the syntax features of twist that are common to any UI framework that you might use twist with. Specifically, it implements:

  • Configuring decorators for auto-import.
  • Allowing
  • Configuring JSX tags for auto-import.

Quick Reference

Plugin Options:

{
    autoImport: {
        'Store': {
            module: '@twist/core',
            export: 'StoreDecorator',
            inherits: {
                module: '@twist/core',
                export: 'Store'
            }
        }
        'ui:button': {
            module: 'my-ui-library',
            export: 'Button'
        }
    }
}

With the above options, the following code:

@Store
class MyStore {
    getView() {
        return <ui:button>My Button</ui:button>;
    }
}

becomes:

import { StoreDecorator, Store } from '@twist/core';
import { Button } from 'my-ui-library';

@StoreDecorator
class MyStore extends Store {
    getView() {
        return <Button>My Button</Button>;
    }
}