UNPKG

794 BJavaScriptView Raw
1const { data, string, parameterized } = require("@algebraic/type");
2const { Cause, field, event } = require("@cause/cause");
3
4const Request = data `Request` (
5 input => string );
6
7
8const Plugin = Cause(`Plugin`,
9{
10 [field `path`]: -1,
11 [field `cache`]: -1,
12
13/* [event.on (Cause.Start)]: (plugin)
14 {
15 console.log("hi...");
16 return [
17 },*/
18 [event._on (Request)]: (plugin, { input }) =>
19 {
20 try {
21 const x = [plugin, [require("@isomorphic/compile-javascript")({ input, cache:plugin.cache, options: { presets:[[require.resolve("@isomorphic/babel-preset"), { browser:true, react:true }]]} })]]
22
23 return x;
24 }
25 catch (e)
26 {
27 console.log(e);
28 } }
29});
30
31Plugin.Request = Request;
32
33module.exports = Plugin;