Skip to content

Commit

Permalink
Update to use latest Dojo releases
Browse files Browse the repository at this point in the history
  • Loading branch information
bryanforbes authored and jason0x43 committed Dec 4, 2017
1 parent 0564eb5 commit 463f793
Show file tree
Hide file tree
Showing 10 changed files with 8,943 additions and 5,818 deletions.
14,073 changes: 8,527 additions & 5,546 deletions docs/api.json

Large diffs are not rendered by default.

601 changes: 376 additions & 225 deletions package-lock.json

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@
},
"license": "BSD-3-Clause",
"dependencies": {
"@dojo/core": "~0.1.0",
"@dojo/has": "~0.1.0",
"@dojo/interfaces": "~0.1.0",
"@dojo/shim": "~0.1.0",
"@dojo/core": "~0.3.0",
"@dojo/has": "~0.1.1",
"@dojo/interfaces": "~0.2.0",
"@dojo/shim": "~0.2.3",
"decompress": "~4.2.0",
"semver": "~5.4.1",
"tslib": "~1.8.0"
},
"devDependencies": {
"@dojo/loader": "~0.1.0",
"@theintern/dev": "~0.6.0",
"@dojo/loader": "~0.1.1",
"@theintern/dev": "~0.6.1",
"@types/node": "~7.0.23",
"@types/semver": "~5.4.0",
"@types/shelljs": "~0.7.1",
Expand All @@ -30,7 +30,7 @@
"build": "npm run clean && concurrently intern-dev-build intern-dev-api",
"ci": "intern-dev-build && intern-dev-test",
"clean": "intern-dev-clean",
"devpack": "intern-dev-build && cd _build/src && npm pack && mv *.tgz ../../",
"devpack": "intern-dev-build && npm pack ./_build/src",
"lint": "intern-dev-lint",
"release": "intern-dev-release",
"test": "intern-dev-build && intern-dev-test",
Expand All @@ -51,4 +51,4 @@
"bin": {
"digdugEnvironments": "./bin/digdugEnvironments.js"
}
}
}
5 changes: 2 additions & 3 deletions src/BrowserStackTunnel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ import Tunnel, {
TunnelProperties,
DownloadOptions,
ChildExecutor,
NormalizedEnvironment,
StatusEvent
NormalizedEnvironment
} from './Tunnel';
import { parse as parseUrl, Url } from 'url';
import { mixin } from '@dojo/core/lang';
Expand Down Expand Up @@ -230,7 +229,7 @@ export default class BrowserStackTunnel extends Tunnel {
/^Connecting to BrowserStack/.test(line) ||
/^Connected/.test(line)
) {
this.emit<StatusEvent>({
this.emit({
type: 'status',
target: this,
status: line
Expand Down
5 changes: 2 additions & 3 deletions src/SauceLabsTunnel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ import Tunnel, {
TunnelProperties,
DownloadOptions,
ChildExecutor,
NormalizedEnvironment,
StatusEvent
NormalizedEnvironment
} from './Tunnel';
import { JobState } from './interfaces';
import { chmodSync, watchFile, unwatchFile } from 'fs';
Expand Down Expand Up @@ -429,7 +428,7 @@ export default class SauceLabsTunnel extends Tunnel
// Sauce Connect 3
message.indexOf('You may start your tests') === -1
) {
this.emit<StatusEvent>({
this.emit({
type: 'status',
target: this,
status: message
Expand Down
2 changes: 1 addition & 1 deletion src/SeleniumTunnel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { format } from 'util';
import { join } from 'path';
import Task from '@dojo/core/async/Task';
import { fileExists, on, writeFile } from './util';
import { Handle } from '@dojo/interfaces/core';
import { Handle } from '@dojo/core/interfaces';
import { mixin } from '@dojo/core/lang';
import { satisfies } from 'semver';

Expand Down
5 changes: 2 additions & 3 deletions src/TestingBotTunnel.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import Tunnel, {
TunnelProperties,
ChildExecutor,
NormalizedEnvironment,
StatusEvent
NormalizedEnvironment
} from './Tunnel';
import { existsSync, watchFile, unlinkSync, unwatchFile } from 'fs';
import UrlSearchParams from '@dojo/core/UrlSearchParams';
Expand Down Expand Up @@ -213,7 +212,7 @@ export default class TestingBotTunnel extends Tunnel
message.indexOf('>> [') === -1 &&
message.indexOf('<< [') === -1
) {
this.emit<StatusEvent>({
this.emit({
type: 'status',
target: this,
status: message
Expand Down
50 changes: 23 additions & 27 deletions src/Tunnel.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import Evented, { BaseEventedEvents } from '@dojo/core/Evented';
import Evented from '@dojo/core/Evented';
import {
EventObject,
EventTargettedObject,
Handle
} from '@dojo/interfaces/core';
} from '@dojo/core/interfaces';
import { createCompositeHandle, mixin } from '@dojo/core/lang';
import Task, { State } from '@dojo/core/async/Task';
import sendRequest from '@dojo/core/request';
Expand All @@ -22,7 +21,7 @@ import decompress = require('decompress');
* securely exposes local services for testing within the service provider’s
* network.
*/
export default class Tunnel extends Evented implements TunnelProperties, Url {
export default class Tunnel extends Evented<TunnelEvents, string> implements TunnelProperties, Url {
constructor(options?: TunnelOptions) {
super();
mixin(
Expand All @@ -40,9 +39,6 @@ export default class Tunnel extends Evented implements TunnelProperties, Url {
);
}

/** Register an event listener */
on: RegisterListener;

/**
* The URL of a service that provides a list of environments supported by
* the tunnel.
Expand Down Expand Up @@ -228,7 +224,7 @@ export default class Tunnel extends Evented implements TunnelProperties, Url {

response.download.subscribe({
next: received => {
this.emit<DownloadProgressEvent>({
this.emit({
type: 'downloadprogress',
target: this,
url,
Expand Down Expand Up @@ -439,7 +435,7 @@ export default class Tunnel extends Evented implements TunnelProperties, Url {
.then(() => {
this._startTask = undefined;
this._state = 'running';
this.emit<StatusEvent>({
this.emit({
type: 'status',
target: this,
status: 'Ready'
Expand All @@ -448,7 +444,7 @@ export default class Tunnel extends Evented implements TunnelProperties, Url {
.catch(error => {
this._startTask = undefined;
this._state = 'stopped';
this.emit<StatusEvent>({
this.emit({
type: 'status',
target: this,
status:
Expand Down Expand Up @@ -508,7 +504,7 @@ export default class Tunnel extends Evented implements TunnelProperties, Url {

this._state = 'stopping';

this.emit<StatusEvent>({
this.emit({
type: 'status',
target: this,
status: 'Stopping'
Expand All @@ -521,7 +517,7 @@ export default class Tunnel extends Evented implements TunnelProperties, Url {
}
this._process = this._handle = undefined;
this._state = 'stopped';
this.emit<StatusEvent>({
this.emit({
type: 'status',
target: this,
status: 'Stopped'
Expand Down Expand Up @@ -629,11 +625,22 @@ export default class Tunnel extends Evented implements TunnelProperties, Url {
}
}

export interface TunnelEventObject<T> extends EventObject<string> {
readonly target: T;
}

export interface TunnelEvents {
stdout: IOEvent;
stderr: IOEvent;
status: StatusEvent;
downloadprogress: DownloadProgressEvent;
}

/**
* A chunk of raw string data output by the tunnel software to stdout or stderr.
*/
// tslint:disable-next-line:interface-name
export interface IOEvent extends EventTargettedObject<Tunnel> {
export interface IOEvent extends TunnelEventObject<Tunnel> {
readonly type: 'stdout' | 'stderr';
readonly data: string;
}
Expand All @@ -642,7 +649,7 @@ export interface IOEvent extends EventTargettedObject<Tunnel> {
* An event containing information about the status of the tunnel setup process
* that is suitable for presentation to end-users.
*/
export interface StatusEvent extends EventTargettedObject<Tunnel> {
export interface StatusEvent extends TunnelEventObject<Tunnel> {
readonly type: 'status';
readonly status: string;
}
Expand All @@ -651,7 +658,7 @@ export interface StatusEvent extends EventTargettedObject<Tunnel> {
* An event indicating that part of a tunnel binary has been downloaded from the
* server.
*/
export interface DownloadProgressEvent extends EventTargettedObject<Tunnel> {
export interface DownloadProgressEvent extends TunnelEventObject<Tunnel> {
/** The event type */
readonly type: 'downloadprogress';
/** The URL being downloaded from */
Expand Down Expand Up @@ -723,20 +730,9 @@ export interface TunnelProperties extends DownloadOptions {
/** Options used to configure a tunnel */
export type TunnelOptions = Partial<TunnelProperties>;

/** Event registration call signatures */
export interface RegisterListener extends BaseEventedEvents {
(type: 'stderr' | 'stdout', listener: (event: IOEvent) => void): Handle;
(type: 'status', listener: (event: StatusEvent) => void): Handle;
(
type: 'downloadprogress',
listener: (event: DownloadProgressEvent) => void
): Handle;
(type: string, listener: (event: EventObject) => void): Handle;
}

function proxyIOEvent(target: Tunnel, type: 'stdout' | 'stderr') {
return function(data: any) {
target.emit<IOEvent>({
target.emit({
type,
target,
data: String(data)
Expand Down
2 changes: 1 addition & 1 deletion src/util.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { createHandle } from '@dojo/core/lang';
import { Handle } from '@dojo/interfaces/core';
import { Handle } from '@dojo/core/interfaces';
import { mkdirSync, statSync, writeFile as fsWriteFile } from 'fs';
import { dirname } from 'path';

Expand Down
2 changes: 1 addition & 1 deletion tests/support/integration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import Test = require('intern/lib/Test');

import Tunnel, { IOEvent, NormalizedEnvironment } from 'src/Tunnel';
import { createCompositeHandle } from '@dojo/core/lang';
import { Handle } from '@dojo/interfaces/core';
import { Handle } from '@dojo/core/interfaces';

function writeIOEvent(event: IOEvent) {
process.stdout.write(event.data);
Expand Down

0 comments on commit 463f793

Please sign in to comment.