@bigtest/agent
Advanced tools
Comparing version
@@ -1,2 +0,2 @@ | ||
import*as t from"express";import{join as e}from"path";class r{constructor(t,e,r){this.agentAppURL=t,this.connectBackURL=e,this.http=r}get connectURL(){return this.agentAppURL+"/?connectTo="+this.connectBackURL}get harnessScriptURL(){return this.agentAppURL+"/harness.js"}static*create(s,c,o){void 0===o&&(o=e(__dirname,"app"));var a=t,i=a().use((t,e,r)=>{t.query.connectTo?r():e.redirect(t.url+"?connectTo="+s)}).use(a.static(o)),p=yield function(t,e){return r=>{var{resume:n,fail:s}=r,c=t.listen(e,t=>{t?s(t):n(c)})}}(i,c),h=p.address();return(yield n).ensure(()=>p.close()),new r("http://localhost:"+h.port,s,p)}static*external(t,e){return new URL(t),new r(t,e)}join(){return t=>{var{resume:e,ensure:r}=t;this.http&&(this.http.on("close",e),r(()=>this.http.off("close",e)))}}}var n=t=>{var{resume:e,context:{parent:r}}=t;return e(r.parent)};export{r as AgentServer}; | ||
import*as t from"express";import{join as r}from"path";class e{constructor(t,r){this.url=t,this.appDir=r}static create(t,s){if(void 0===s&&(s=r(__dirname,"app")),t.externalURL)return new e(t.externalURL,s);if(!t.port)throw new Error("An agent server must be created with either an external url or a port number");return new n(t.port,s)}connectURL(t){return this.url+"/?connectTo="+encodeURIComponent(t)}get harnessScriptURL(){return this.url+"/harness.js"}*listen(){}*join(){yield}}class n extends e{constructor(t,r){super("http://localhost:"+t,r),this.port=t}*listen(){var r=t,e=r().use(r.static(this.appDir)),n=yield function(t,r){return e=>{var{resume:n,fail:s}=e,o=t.listen(r,t=>{t?s(t):n(o)})}}(e,this.port);this.http=n,(yield s).ensure(()=>n.close())}join(){return t=>{var{resume:r,ensure:e}=t;if(!this.http)throw new Error("cannot join a server that is not already listening");this.http.on("close",r),e(()=>this.http.off("close",r))}}}var s=t=>{var{resume:r,context:{parent:e}}=t;return r(e.parent)};export{e as AgentServer}; | ||
//# sourceMappingURL=agent.esm.js.map |
@@ -1,2 +0,2 @@ | ||
import*as t from"express";import{join as e}from"path";class r{constructor(t,e,r){this.agentAppURL=t,this.connectBackURL=e,this.http=r}get connectURL(){return this.agentAppURL+"/?connectTo="+this.connectBackURL}get harnessScriptURL(){return this.agentAppURL+"/harness.js"}static*create(s,c,o){void 0===o&&(o=e(__dirname,"app"));var a=t,i=a().use((t,e,r)=>{t.query.connectTo?r():e.redirect(t.url+"?connectTo="+s)}).use(a.static(o)),p=yield function(t,e){return r=>{var{resume:n,fail:s}=r,c=t.listen(e,t=>{t?s(t):n(c)})}}(i,c),h=p.address();return(yield n).ensure(()=>p.close()),new r("http://localhost:"+h.port,s,p)}static*external(t,e){return new URL(t),new r(t,e)}join(){return t=>{var{resume:e,ensure:r}=t;this.http&&(this.http.on("close",e),r(()=>this.http.off("close",e)))}}}var n=t=>{var{resume:e,context:{parent:r}}=t;return e(r.parent)};export{r as AgentServer}; | ||
import*as t from"express";import{join as r}from"path";class e{constructor(t,r){this.url=t,this.appDir=r}static create(t,s){if(void 0===s&&(s=r(__dirname,"app")),t.externalURL)return new e(t.externalURL,s);if(!t.port)throw new Error("An agent server must be created with either an external url or a port number");return new n(t.port,s)}connectURL(t){return this.url+"/?connectTo="+encodeURIComponent(t)}get harnessScriptURL(){return this.url+"/harness.js"}*listen(){}*join(){yield}}class n extends e{constructor(t,r){super("http://localhost:"+t,r),this.port=t}*listen(){var r=t,e=r().use(r.static(this.appDir)),n=yield function(t,r){return e=>{var{resume:n,fail:s}=e,o=t.listen(r,t=>{t?s(t):n(o)})}}(e,this.port);this.http=n,(yield s).ensure(()=>n.close())}join(){return t=>{var{resume:r,ensure:e}=t;if(!this.http)throw new Error("cannot join a server that is not already listening");this.http.on("close",r),e(()=>this.http.off("close",r))}}}var s=t=>{var{resume:r,context:{parent:e}}=t;return r(e.parent)};export{e as AgentServer}; | ||
//# sourceMappingURL=agent.modern.js.map |
@@ -1,2 +0,2 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("express"),require("path")):"function"==typeof define&&define.amd?define(["exports","express","path"],t):t((e=e||self).agent={},e.express,e.path)}(this,function(e,t,n){class r{constructor(e,t,n){this.agentAppURL=e,this.connectBackURL=t,this.http=n}get connectURL(){return this.agentAppURL+"/?connectTo="+this.connectBackURL}get harnessScriptURL(){return this.agentAppURL+"/harness.js"}static*create(e,o,c){void 0===c&&(c=n.join(__dirname,"app"));var i=t,a=i().use((t,n,r)=>{t.query.connectTo?r():n.redirect(t.url+"?connectTo="+e)}).use(i.static(c)),p=yield function(e,t){return n=>{var{resume:r,fail:s}=n,o=e.listen(t,e=>{e?s(e):r(o)})}}(a,o),u=p.address();return(yield s).ensure(()=>p.close()),new r("http://localhost:"+u.port,e,p)}static*external(e,t){return new URL(e),new r(e,t)}join(){return e=>{var{resume:t,ensure:n}=e;this.http&&(this.http.on("close",t),n(()=>this.http.off("close",t)))}}}var s=e=>{var{resume:t,context:{parent:n}}=e;return t(n.parent)};e.AgentServer=r}); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("express"),require("path")):"function"==typeof define&&define.amd?define(["exports","express","path"],t):t((e=e||self).agent={},e.express,e.path)}(this,function(e,t,r){class n{constructor(e,t){this.url=e,this.appDir=t}static create(e,t){if(void 0===t&&(t=r.join(__dirname,"app")),e.externalURL)return new n(e.externalURL,t);if(!e.port)throw new Error("An agent server must be created with either an external url or a port number");return new s(e.port,t)}connectURL(e){return this.url+"/?connectTo="+encodeURIComponent(e)}get harnessScriptURL(){return this.url+"/harness.js"}*listen(){}*join(){yield}}class s extends n{constructor(e,t){super("http://localhost:"+e,t),this.port=e}*listen(){var e=t,r=e().use(e.static(this.appDir)),n=yield function(e,t){return r=>{var{resume:n,fail:s}=r,i=e.listen(t,e=>{e?s(e):n(i)})}}(r,this.port);this.http=n,(yield i).ensure(()=>n.close())}join(){return e=>{var{resume:t,ensure:r}=e;if(!this.http)throw new Error("cannot join a server that is not already listening");this.http.on("close",t),r(()=>this.http.off("close",t))}}}var i=e=>{var{resume:t,context:{parent:r}}=e;return t(r.parent)};e.AgentServer=n}); | ||
//# sourceMappingURL=agent.umd.js.map |
import { Operation } from 'effection'; | ||
interface Options { | ||
port: number; | ||
externalURL?: string; | ||
} | ||
export declare class AgentServer { | ||
agentAppURL: string; | ||
private connectBackURL?; | ||
private http?; | ||
private constructor(); | ||
get connectURL(): string; | ||
url: string; | ||
protected appDir: string; | ||
protected constructor(url: string, appDir: string); | ||
static create(options: Options, appDir?: string): AgentServer; | ||
connectURL(connectBackURL: string): string; | ||
get harnessScriptURL(): string; | ||
static create(connectBackURL: string, port?: number, appDir?: string): Operation; | ||
static external(agentServerURL: string, connectBackURL: string): Operation; | ||
listen(): Operation; | ||
join(): Operation; | ||
} | ||
export {}; |
{ | ||
"name": "@bigtest/agent", | ||
"version": "0.1.0-1baa283", | ||
"version": "0.1.0-41bb35f", | ||
"description": "Agent for connecting test environments (browsers) to BigTest", | ||
@@ -16,6 +16,5 @@ "main": "dist/agent.umd.js", | ||
"scripts": { | ||
"lint": "eslint 'src/**/*.ts' 'bin/**/*.ts'", | ||
"lint": "eslint '**/*.ts'", | ||
"test": "mocha -r ts-node/register test/**/*.test.ts", | ||
"start": "ts-node bin/start.ts", | ||
"build": "echo 'build'", | ||
"bundle": "parcel watch --out-dir dist/app app/index.html", | ||
@@ -22,0 +21,0 @@ "prepack": "microbundle --entry index.ts --output dist --format modern,es,umd && parcel build --out-dir dist/app app/index.html app/harness.ts" |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
99436
0.92%153
2.68%