babel-plugin-isotropy-rpc
v0.0.1
Published
Babel plugin for transpiling to isotropy-lib-rpc
Downloads
1
Readme
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-rpc 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.