0.0.4 • Published 7 years ago

babel-plugin-isotropy-webservices v0.0.4

Weekly downloads
2
License
MIT
Repository
github
Last release
7 years ago

Isotropy Babel Plugin for RPC

This module is a babel plugin that transpiles function calls from the designated server module(s) into corresponding server calls.

It uses isotropy-ast-analyzer-webservices for AST analysis.

This is part of the isotropy framework (www.isotropy.org).

Usage

Create a module "server.js" containing a set of exported function that mock the server. The filename can be changed in configuration.

//In my-server/index.js
export function getAllTodos() {
  return todos
}

Perform a RPC

import * as myServer from "../my-server";

async function getAllTodos() {
  return await myServer.postsAPI.getAllTodos();
}

Configuration

In .babelrc include

plugins: ["transform-to-isotropy-rpc",
  {
    projects:
      [
        {
          dir: "src",
          modules: [{ source: "server/my-server", url: "https://www.example.com" }]
        }
      ]
  }
]

Specify the filesystem directory in which your project lies and include the module's path and the url it translates to.