@bigtest/agent
Advanced tools
Comparing version 0.1.0-98f8a1a to 0.1.0-b8351bf
@@ -1,2 +0,2 @@ | ||
import*as t from"express";import{join as e}from"path";class r{constructor(t,e){this.agentAppURL=t,this.http=e}get harnessScriptURL(){return this.agentAppURL+"/harness.js"}static*create(n,o,a){void 0===a&&(a=e(__dirname,"app"));var c=t,i=c().use((t,e,r)=>{t.query.connectTo?r():e.redirect(t.url+"?connectTo="+n)}).use(c.static(a)),p=yield function(t,e){return r=>{var{resume:s,fail:n}=r,o=t.listen(e,t=>{t?n(t):s(o)})}}(i,o),u=p.address();return(yield s).ensure(()=>p.close()),new r("http://localhost:"+u.port,p)}static*external(t,e){return new r(t+"/?connectTo="+e)}join(){return t=>{var{resume:e,ensure:r}=t;this.http&&(this.http.on("close",e),r(()=>this.http.off("close",e)))}}}var s=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){this.url=t}static create(t){if(t.externalURL)return new e(t.externalURL);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)}connectURL(t){return this.url+"/?connectTo="+encodeURIComponent(t)}get harnessScriptURL(){return this.url+"/harness.js"}*listen(){}*join(){yield}}class n extends e{constructor(t){super("http://localhost:"+t),this.port=t}*listen(){var e=r(__dirname,"app"),n=t,o=n().use(n.static(e)),i=yield function(t,r){return e=>{var{resume:n,fail:s}=e,o=t.listen(r,t=>{t?s(t):n(o)})}}(o,this.port);this.http=i,(yield s).ensure(()=>i.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){this.agentAppURL=t,this.http=e}get harnessScriptURL(){return this.agentAppURL+"/harness.js"}static*create(n,o,a){void 0===a&&(a=e(__dirname,"app"));var c=t,i=c().use((t,e,r)=>{t.query.connectTo?r():e.redirect(t.url+"?connectTo="+n)}).use(c.static(a)),p=yield function(t,e){return r=>{var{resume:s,fail:n}=r,o=t.listen(e,t=>{t?n(t):s(o)})}}(i,o),u=p.address();return(yield s).ensure(()=>p.close()),new r("http://localhost:"+u.port,p)}static*external(t,e){return new r(t+"/?connectTo="+e)}join(){return t=>{var{resume:e,ensure:r}=t;this.http&&(this.http.on("close",e),r(()=>this.http.off("close",e)))}}}var s=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){this.url=t}static create(t){if(t.externalURL)return new e(t.externalURL);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)}connectURL(t){return this.url+"/?connectTo="+encodeURIComponent(t)}get harnessScriptURL(){return this.url+"/harness.js"}*listen(){}*join(){yield}}class n extends e{constructor(t){super("http://localhost:"+t),this.port=t}*listen(){var e=r(__dirname,"app"),n=t,o=n().use(n.static(e)),i=yield function(t,r){return e=>{var{resume:n,fail:s}=e,o=t.listen(r,t=>{t?s(t):n(o)})}}(o,this.port);this.http=i,(yield s).ensure(()=>i.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,r){class n{constructor(e,t){this.agentAppURL=e,this.http=t}get harnessScriptURL(){return this.agentAppURL+"/harness.js"}static*create(e,o,i){void 0===i&&(i=r.join(__dirname,"app"));var a=t,p=a().use((t,r,n)=>{t.query.connectTo?n():r.redirect(t.url+"?connectTo="+e)}).use(a.static(i)),c=yield function(e,t){return r=>{var{resume:n,fail:s}=r,o=e.listen(t,e=>{e?s(e):n(o)})}}(p,o),u=c.address();return(yield s).ensure(()=>c.close()),new n("http://localhost:"+u.port,c)}static*external(e,t){return new n(e+"/?connectTo="+t)}join(){return e=>{var{resume:t,ensure:r}=e;this.http&&(this.http.on("close",t),r(()=>this.http.off("close",t)))}}}var s=e=>{var{resume:t,context:{parent:r}}=e;return t(r.parent)};e.AgentServer=n}); | ||
!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){this.url=e}static create(e){if(e.externalURL)return new n(e.externalURL);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)}connectURL(e){return this.url+"/?connectTo="+encodeURIComponent(e)}get harnessScriptURL(){return this.url+"/harness.js"}*listen(){}*join(){yield}}class s extends n{constructor(e){super("http://localhost:"+e),this.port=e}*listen(){var e=r.join(__dirname,"app"),n=t,s=n().use(n.static(e)),i=yield function(e,t){return r=>{var{resume:n,fail:s}=r,o=e.listen(t,e=>{e?s(e):n(o)})}}(s,this.port);this.http=i,(yield o).ensure(()=>i.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 o=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 http?; | ||
private constructor(); | ||
url: string; | ||
protected constructor(url: string); | ||
static create(options: Options): 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-98f8a1a", | ||
"version": "0.1.0-b8351bf", | ||
"description": "Agent for connecting test environments (browsers) to BigTest", | ||
@@ -21,3 +21,3 @@ "main": "dist/agent.umd.js", | ||
"bundle": "parcel watch --out-dir dist/app app/index.html", | ||
"prepack": "microbundle --entry index.ts --output dist --format modern,es,umd && parcel build --out-dir dist/app app/index.html" | ||
"prepack": "microbundle --entry index.ts --output dist --format modern,es,umd && parcel build --out-dir dist/app app/index.html app/harness.ts" | ||
}, | ||
@@ -24,0 +24,0 @@ "devDependencies": { |
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
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
98879
14
152
5
3