TypeScript improvements and tslib dep (#2692)
This commit is contained in:
parent
cef7dfcdbb
commit
c1aa708a8b
|
|
@ -15,7 +15,7 @@
|
|||
</PropertyGroup>
|
||||
<Target Name="RestoreNpm" Condition="'$(PreflightRestore)' != 'True'">
|
||||
<Message Text="Restoring NPM modules" Importance="high" />
|
||||
<Exec Command="npm install --no-optional" WorkingDirectory="$(RepositoryRoot)clients/ts" />
|
||||
<Exec Command="npm install --no-optional" WorkingDirectory="$(RepositoryRoot)clients/ts/common" />
|
||||
<Exec Command="npm install --no-optional" WorkingDirectory="$(RepositoryRoot)clients/ts/FunctionalTests" />
|
||||
<Exec Command="npm install --no-optional" WorkingDirectory="$(RepositoryRoot)clients/ts/signalr" />
|
||||
<Exec Command="npm install --no-optional" WorkingDirectory="$(RepositoryRoot)clients/ts/signalr-protocol-msgpack" />
|
||||
|
|
|
|||
|
|
@ -10,6 +10,10 @@
|
|||
"es6-promise": {
|
||||
"version": "4.2.2",
|
||||
"bundled": true
|
||||
},
|
||||
"tslib": {
|
||||
"version": "1.9.3",
|
||||
"bundled": true
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
@ -111,6 +115,10 @@
|
|||
"safe-buffer": "~5.1.0"
|
||||
}
|
||||
},
|
||||
"tslib": {
|
||||
"version": "1.9.3",
|
||||
"bundled": true
|
||||
},
|
||||
"util-deprecate": {
|
||||
"version": "1.0.2",
|
||||
"bundled": true
|
||||
|
|
@ -791,9 +799,9 @@
|
|||
}
|
||||
},
|
||||
"circular-json": {
|
||||
"version": "0.5.4",
|
||||
"resolved": "https://registry.npmjs.org/circular-json/-/circular-json-0.5.4.tgz",
|
||||
"integrity": "sha512-vnJA8KS0BfOihugYEUkLRcnmq21FbuivbxgzDLXNs3zIk4KllV4Mx4UuTzBXht9F00C7QfD1YqMXg1zP6EXpig==",
|
||||
"version": "0.5.5",
|
||||
"resolved": "https://registry.npmjs.org/circular-json/-/circular-json-0.5.5.tgz",
|
||||
"integrity": "sha512-13YaR6kiz0kBNmIVM87Io8Hp7bWOo4r61vkEANy8iH9R9bc6avud/1FT0SBpqR1RpIQADOh/Q+yHZDA1iL6ysA==",
|
||||
"dev": true
|
||||
},
|
||||
"class-utils": {
|
||||
|
|
@ -875,9 +883,9 @@
|
|||
}
|
||||
},
|
||||
"commander": {
|
||||
"version": "2.15.1",
|
||||
"resolved": "https://registry.npmjs.org/commander/-/commander-2.15.1.tgz",
|
||||
"integrity": "sha512-VlfT9F3V0v+jr4yxPc5gg9s62/fIVWsd2Bk2iD435um1NlGMYdVCq+MjcXnhYq2icNOizHr1kK+5TI6H0Hy0ag==",
|
||||
"version": "2.16.0",
|
||||
"resolved": "https://registry.npmjs.org/commander/-/commander-2.16.0.tgz",
|
||||
"integrity": "sha512-sVXqklSaotK9at437sFlFpyOcJonxe0yST/AG9DkQKUdIE6IqGIMv4SfAQSKaJbSdVEJYItASCrBiVQHq1HQew==",
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
|
|
@ -1259,9 +1267,9 @@
|
|||
"dev": true
|
||||
},
|
||||
"escodegen": {
|
||||
"version": "1.10.0",
|
||||
"resolved": "https://registry.npmjs.org/escodegen/-/escodegen-1.10.0.tgz",
|
||||
"integrity": "sha512-fjUOf8johsv23WuIKdNQU4P9t9jhQ4Qzx6pC2uW890OloK3Zs1ZAoCNpg/2larNF501jLl3UNy0kIRcF6VI22g==",
|
||||
"version": "1.11.0",
|
||||
"resolved": "https://registry.npmjs.org/escodegen/-/escodegen-1.11.0.tgz",
|
||||
"integrity": "sha512-IeMV45ReixHS53K/OmfKAIztN/igDHzTJUhZM3k1jMhIZWjk45SMwAtBsEXiJp3vSPmTcu6CXn7mDvFHRN66fw==",
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
|
|
@ -3004,9 +3012,9 @@
|
|||
}
|
||||
},
|
||||
"log4js": {
|
||||
"version": "2.10.0",
|
||||
"resolved": "https://registry.npmjs.org/log4js/-/log4js-2.10.0.tgz",
|
||||
"integrity": "sha512-NnhN9PjFF9zhxinAjlmDYvkqqrIW+yA3LLJAoTJ3fs6d1zru86OqQHfsxiUcc1kRq3z+faGR4DeyXUfiNbVxKQ==",
|
||||
"version": "2.11.0",
|
||||
"resolved": "https://registry.npmjs.org/log4js/-/log4js-2.11.0.tgz",
|
||||
"integrity": "sha512-z1XdwyGFg8/WGkOyF6DPJjivCWNLKrklGdViywdYnSKOvgtEBo2UyEMZS5sD2mZrQlU3TvO8wDWLc8mzE1ncBQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"amqplib": "^0.5.2",
|
||||
|
|
@ -3688,6 +3696,19 @@
|
|||
"pac-resolver": "^3.0.0",
|
||||
"raw-body": "^2.2.0",
|
||||
"socks-proxy-agent": "^3.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"socks-proxy-agent": {
|
||||
"version": "3.0.1",
|
||||
"resolved": "https://registry.npmjs.org/socks-proxy-agent/-/socks-proxy-agent-3.0.1.tgz",
|
||||
"integrity": "sha512-ZwEDymm204mTzvdqyUqOdovVr2YRd2NYskrYrF2LXyZ9qDiMAoFESGK8CRphiO7rtbo2Y757k2Nia3x2hGtalA==",
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"agent-base": "^4.1.0",
|
||||
"socks": "^1.1.10"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"pac-resolver": {
|
||||
|
|
@ -3822,9 +3843,9 @@
|
|||
}
|
||||
},
|
||||
"proxy-agent": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/proxy-agent/-/proxy-agent-3.0.0.tgz",
|
||||
"integrity": "sha512-g6n6vnk8fRf705ShN+FEXFG/SDJaW++lSs0d9KaJh4uBWW/wi7en4Cpo5VYQW3SZzAE121lhB/KLQrbURoubZw==",
|
||||
"version": "3.0.1",
|
||||
"resolved": "https://registry.npmjs.org/proxy-agent/-/proxy-agent-3.0.1.tgz",
|
||||
"integrity": "sha512-mAZexaz9ZxQhYPWfAjzlrloEjW+JHiBFryE4AJXFDTnaXfmH/FKqC1swTRKuEPbHWz02flQNXFOyDUF7zfEG6A==",
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
|
|
@ -3835,7 +3856,7 @@
|
|||
"lru-cache": "^4.1.2",
|
||||
"pac-proxy-agent": "^2.0.1",
|
||||
"proxy-from-env": "^1.0.0",
|
||||
"socks-proxy-agent": "^3.0.0"
|
||||
"socks-proxy-agent": "^4.0.1"
|
||||
}
|
||||
},
|
||||
"proxy-from-env": {
|
||||
|
|
@ -4140,7 +4161,8 @@
|
|||
"version": "1.1.15",
|
||||
"resolved": "https://registry.npmjs.org/smart-buffer/-/smart-buffer-1.1.15.tgz",
|
||||
"integrity": "sha1-fxFLW2X6s+KjWqd1uxLw0cZJvxY=",
|
||||
"dev": true
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"smtp-connection": {
|
||||
"version": "2.12.0",
|
||||
|
|
@ -4371,19 +4393,41 @@
|
|||
"resolved": "https://registry.npmjs.org/socks/-/socks-1.1.10.tgz",
|
||||
"integrity": "sha1-W4t/x8jzQcU+0FbpKbe/Tei6e1o=",
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"ip": "^1.1.4",
|
||||
"smart-buffer": "^1.0.13"
|
||||
}
|
||||
},
|
||||
"socks-proxy-agent": {
|
||||
"version": "3.0.1",
|
||||
"resolved": "https://registry.npmjs.org/socks-proxy-agent/-/socks-proxy-agent-3.0.1.tgz",
|
||||
"integrity": "sha512-ZwEDymm204mTzvdqyUqOdovVr2YRd2NYskrYrF2LXyZ9qDiMAoFESGK8CRphiO7rtbo2Y757k2Nia3x2hGtalA==",
|
||||
"version": "4.0.1",
|
||||
"resolved": "https://registry.npmjs.org/socks-proxy-agent/-/socks-proxy-agent-4.0.1.tgz",
|
||||
"integrity": "sha512-Kezx6/VBguXOsEe5oU3lXYyKMi4+gva72TwJ7pQY5JfqUx2nMk7NXA6z/mpNqIlfQjWYVfeuNvQjexiTaTn6Nw==",
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"agent-base": "^4.1.0",
|
||||
"socks": "^1.1.10"
|
||||
"agent-base": "~4.2.0",
|
||||
"socks": "~2.2.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"smart-buffer": {
|
||||
"version": "4.0.1",
|
||||
"resolved": "https://registry.npmjs.org/smart-buffer/-/smart-buffer-4.0.1.tgz",
|
||||
"integrity": "sha512-RFqinRVJVcCAL9Uh1oVqE6FZkqsyLiVOYEZ20TqIOjuX7iFVJ+zsbs4RIghnw/pTs7mZvt8ZHhvm1ZUrR4fykg==",
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"socks": {
|
||||
"version": "2.2.1",
|
||||
"resolved": "https://registry.npmjs.org/socks/-/socks-2.2.1.tgz",
|
||||
"integrity": "sha512-0GabKw7n9mI46vcNrVfs0o6XzWzjVa3h6GaSo2UPxtWAROXUWavfJWh1M4PR5tnE0dcnQXZIDFP4yrAysLze/w==",
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"ip": "^1.1.5",
|
||||
"smart-buffer": "^4.0.1"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"source-map": {
|
||||
|
|
@ -4728,6 +4772,12 @@
|
|||
"mime-types": "~2.1.18"
|
||||
}
|
||||
},
|
||||
"typescript": {
|
||||
"version": "3.0.1",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-3.0.1.tgz",
|
||||
"integrity": "sha512-zQIMOmC+372pC/CCVLqnQ0zSBiY7HHodU7mpQdjiZddek4GMj31I3dUJ7gAs9o65X7mnRma6OokOkc6f9jjfBg==",
|
||||
"dev": true
|
||||
},
|
||||
"ultron": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/ultron/-/ultron-1.1.1.tgz",
|
||||
|
|
|
|||
|
|
@ -29,13 +29,14 @@
|
|||
"karma-sauce-launcher": "^1.2.0",
|
||||
"karma-sourcemap-loader": "^0.3.7",
|
||||
"karma-summary-reporter": "^1.5.0",
|
||||
"ts-node": "^4.1.0"
|
||||
"ts-node": "^4.1.0",
|
||||
"typescript": "^3.0.1"
|
||||
},
|
||||
"scripts": {
|
||||
"clean": "node ../node_modules/rimraf/bin.js ./wwwroot/dist ./obj/js",
|
||||
"clean": "node ../common/node_modules/rimraf/bin.js ./wwwroot/dist ./obj/js",
|
||||
"build": "npm run clean && npm run build:lint && npm run build:webpack",
|
||||
"build:lint": "node ../node_modules/tslint/bin/tslint -c ../tslint.json -p ./tsconfig.json",
|
||||
"build:webpack": "node ../node_modules/webpack-cli/bin/cli.js",
|
||||
"build:lint": "node ../common/node_modules/tslint/bin/tslint -c ../tslint.json -p ./tsconfig.json",
|
||||
"build:webpack": "node ../common/node_modules/webpack-cli/bin/cli.js",
|
||||
"build:parent": "cd .. && npm run build",
|
||||
"pretest": "npm run build:parent && npm run build && dotnet build",
|
||||
"test": "npm run test:local --",
|
||||
|
|
|
|||
|
|
@ -1,6 +1,9 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||
|
||||
// This code uses a lot of `.then` instead of `await` and TSLint doesn't like it.
|
||||
// tslint:disable:no-floating-promises
|
||||
|
||||
import { HttpTransportType, IHttpConnectionOptions, TransferFormat } from "@aspnet/signalr";
|
||||
import { eachTransport, ECHOENDPOINT_URL } from "./Common";
|
||||
import { TestLogger } from "./TestLogger";
|
||||
|
|
@ -23,13 +26,13 @@ describe("connection", () => {
|
|||
...commonOptions,
|
||||
});
|
||||
|
||||
connection.onreceive = (data) => {
|
||||
connection.onreceive = async (data: any) => {
|
||||
if (data === message) {
|
||||
connection.stop();
|
||||
}
|
||||
};
|
||||
|
||||
connection.onclose = (error) => {
|
||||
connection.onclose = (error: any) => {
|
||||
expect(error).toBeUndefined();
|
||||
done();
|
||||
};
|
||||
|
|
@ -53,20 +56,20 @@ describe("connection", () => {
|
|||
transport: transportType,
|
||||
});
|
||||
|
||||
connection.onreceive = (data) => {
|
||||
connection.onreceive = (data: any) => {
|
||||
if (data === message) {
|
||||
connection.stop();
|
||||
}
|
||||
};
|
||||
|
||||
connection.onclose = (error) => {
|
||||
connection.onclose = (error: any) => {
|
||||
expect(error).toBeUndefined();
|
||||
done();
|
||||
};
|
||||
|
||||
connection.start(TransferFormat.Text).then(() => {
|
||||
connection.send(message);
|
||||
}).catch((e) => {
|
||||
}).catch((e: any) => {
|
||||
fail(e);
|
||||
done();
|
||||
});
|
||||
|
|
@ -82,15 +85,17 @@ describe("connection", () => {
|
|||
transport: transportType,
|
||||
});
|
||||
|
||||
connection.onreceive = (data) => {
|
||||
connection.onreceive = (data: any) => {
|
||||
if (data === message) {
|
||||
connection.stop();
|
||||
}
|
||||
};
|
||||
|
||||
// @ts-ignore: We don't use the error parameter intentionally.
|
||||
connection.onclose = (error) => {
|
||||
// Search the logs for the message content
|
||||
expect(TestLogger.instance.currentLog.messages.length).toBeGreaterThan(0);
|
||||
// @ts-ignore: We don't use the _ or __ parameters intentionally.
|
||||
for (const [_, __, logMessage] of TestLogger.instance.currentLog.messages) {
|
||||
expect(logMessage).not.toContain(message);
|
||||
}
|
||||
|
|
@ -116,16 +121,18 @@ describe("connection", () => {
|
|||
transport: transportType,
|
||||
});
|
||||
|
||||
connection.onreceive = (data) => {
|
||||
connection.onreceive = (data: any) => {
|
||||
if (data === message) {
|
||||
connection.stop();
|
||||
}
|
||||
};
|
||||
|
||||
// @ts-ignore: We don't use the error parameter intentionally.
|
||||
connection.onclose = (error) => {
|
||||
// Search the logs for the message content
|
||||
let matches = 0;
|
||||
expect(TestLogger.instance.currentLog.messages.length).toBeGreaterThan(0);
|
||||
// @ts-ignore: We don't use the _ or __ parameters intentionally.
|
||||
for (const [_, __, logMessage] of TestLogger.instance.currentLog.messages) {
|
||||
if (logMessage.indexOf(message) !== -1) {
|
||||
matches += 1;
|
||||
|
|
@ -139,7 +146,7 @@ describe("connection", () => {
|
|||
|
||||
connection.start(TransferFormat.Text).then(() => {
|
||||
connection.send(message);
|
||||
}).catch((e) => {
|
||||
}).catch((e: any) => {
|
||||
fail(e);
|
||||
done();
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,6 +1,9 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||
|
||||
// This code uses a lot of `.then` instead of `await` and TSLint doesn't like it.
|
||||
// tslint:disable:no-floating-promises
|
||||
|
||||
import { AbortError, DefaultHttpClient, HttpClient, HttpRequest, HttpResponse, HttpTransportType, HubConnectionBuilder, IHttpConnectionOptions, JsonHubProtocol } from "@aspnet/signalr";
|
||||
import { MessagePackHubProtocol } from "@aspnet/signalr-protocol-msgpack";
|
||||
|
||||
|
|
@ -221,7 +224,7 @@ describe("hubConnection", () => {
|
|||
hubConnection.stop();
|
||||
done();
|
||||
},
|
||||
next(item) {
|
||||
next() {
|
||||
hubConnection.stop();
|
||||
fail();
|
||||
},
|
||||
|
|
@ -248,7 +251,7 @@ describe("hubConnection", () => {
|
|||
hubConnection.stop();
|
||||
done();
|
||||
},
|
||||
next(item) {
|
||||
next() {
|
||||
hubConnection.stop();
|
||||
fail();
|
||||
},
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
export class LogBannerReporter implements jasmine.CustomReporter {
|
||||
public jasmineStarted(suiteInfo: jasmine.SuiteInfo): void {
|
||||
public jasmineStarted(): void {
|
||||
console.log("*** JASMINE SUITE STARTED ***");
|
||||
}
|
||||
|
||||
public jasmineDone(runDetails: jasmine.RunDetails): void {
|
||||
public jasmineDone(): void {
|
||||
console.log("*** JASMINE SUITE FINISHED ***");
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||
|
||||
const path = require("path");
|
||||
const webpack = require("webpack");
|
||||
const webpack = require("../common/node_modules/webpack");
|
||||
|
||||
module.exports = {
|
||||
entry: path.resolve(__dirname, "ts", "index.ts"),
|
||||
|
|
@ -24,6 +24,10 @@ module.exports = {
|
|||
}
|
||||
]
|
||||
},
|
||||
resolveLoader: {
|
||||
// Special resolution rules for loaders (which are in the 'common' directory)
|
||||
modules: [ path.resolve(__dirname, "..", "common", "node_modules") ],
|
||||
},
|
||||
resolve: {
|
||||
extensions: [".ts", ".js"]
|
||||
},
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,26 @@
|
|||
{
|
||||
"name": "common",
|
||||
"version": "1.0.0",
|
||||
"description": "Common dependencies used during dev time. DO NOT PUBLISH",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"keywords": [],
|
||||
"author": "",
|
||||
"license": "ISC",
|
||||
"devDependencies": {
|
||||
"@types/jest": "^22.2.3",
|
||||
"@types/node": "^8.5.2",
|
||||
"@types/webpack": "^4.4.0",
|
||||
"jest": "^22.4.3",
|
||||
"rimraf": "^2.6.2",
|
||||
"ts-jest": "^22.4.6",
|
||||
"ts-loader": "^4.4.1",
|
||||
"tslint": "^5.9.1",
|
||||
"typescript": "^2.7.1",
|
||||
"uglify-js": "^3.3.5",
|
||||
"webpack": "^4.12.0",
|
||||
"webpack-cli": "^3.0.3"
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
|
|
@ -1,30 +1,16 @@
|
|||
{
|
||||
"name": "client-ts",
|
||||
"version": "0.0.0",
|
||||
"description": "Common dev-time dependencies for SignalR NPM packages. NOT FOR PUBLISHING",
|
||||
"main": "index.js",
|
||||
"description": "Provides a root to run npm scripts from. DO NOT PUBLISH",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"build": "cd ./signalr && npm run build && cd ../signalr-protocol-msgpack && npm run build",
|
||||
"pretest": "tslint -c ./tslint.json -p ./signalr/tests/tsconfig.json && tslint -c ./tslint.json -p ./signalr-protocol-msgpack/tests/tsconfig.json",
|
||||
"test": "jest",
|
||||
"coverage": "jest --coverage"
|
||||
"pretest": "node ./common/node_modules/tslint/bin/tslint -c ./tslint.json -p ./signalr/tests/tsconfig.json && node ./common/node_modules/tslint/bin/tslint -c ./tslint.json -p ./signalr-protocol-msgpack/tests/tsconfig.json",
|
||||
"test": "node ./common/node_modules/jest/bin/jest.js",
|
||||
"coverage": "node ./common/node_modules/jest/bin/jest.js --coverage"
|
||||
},
|
||||
"author": "Microsoft",
|
||||
"license": "Apache-2.0",
|
||||
"devDependencies": {
|
||||
"@types/jest": "^22.2.3",
|
||||
"@types/node": "^8.5.2",
|
||||
"@types/webpack": "^4.4.0",
|
||||
"jest": "^22.4.3",
|
||||
"rimraf": "^2.6.2",
|
||||
"ts-jest": "^22.4.6",
|
||||
"ts-loader": "^4.4.1",
|
||||
"tslint": "^5.9.1",
|
||||
"typescript": "^2.7.1",
|
||||
"uglify-js": "^3.3.5",
|
||||
"webpack": "^4.12.0",
|
||||
"webpack-cli": "^3.0.3"
|
||||
},
|
||||
"jest": {
|
||||
"globals": {
|
||||
"ts-jest": {
|
||||
|
|
@ -34,12 +20,13 @@
|
|||
}
|
||||
},
|
||||
"transform": {
|
||||
"^.+\\.tsx?$": "ts-jest"
|
||||
"^.+\\.tsx?$": "./common/node_modules/ts-jest"
|
||||
},
|
||||
"testEnvironment": "node",
|
||||
"testRegex": "(/__tests__/.*|(\\.|/)(test|spec))\\.(jsx?|tsx?)$",
|
||||
"moduleNameMapper": {
|
||||
"^@aspnet/signalr$": "<rootDir>/signalr/src/index.ts"
|
||||
"^ts-jest$": "<rootDir>/common/node_modules/ts-jest",
|
||||
"^@aspnet/signalr$": "<rootDir>/signalr/dist/cjs/index.js"
|
||||
},
|
||||
"moduleFileExtensions": [
|
||||
"ts",
|
||||
|
|
|
|||
|
|
@ -1,43 +0,0 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||
|
||||
import path from 'path';
|
||||
|
||||
import resolve from 'rollup-plugin-node-resolve'
|
||||
import sourceMaps from 'rollup-plugin-sourcemaps'
|
||||
import commonjs from 'rollup-plugin-commonjs'
|
||||
|
||||
let polyfills = [ 'es6-promise', 'buffer', 'base64-js', 'ieee754' ];
|
||||
let allowed_externals = [ ];
|
||||
|
||||
export default function(rootDir, moduleGlobals) {
|
||||
let pkg = require(path.join(rootDir, "package.json"));
|
||||
return {
|
||||
input: path.join(rootDir, "dist", "cjs", "browser-index.js"),
|
||||
output: {
|
||||
file: pkg.umd,
|
||||
format: "umd",
|
||||
name: pkg.umd_name,
|
||||
sourcemap: true,
|
||||
banner: "/** \r\n" +
|
||||
" * @overview ASP.NET Core SignalR JavaScript Client.\r\n" +
|
||||
" * @version 0.0.0-DEV_BUILD.\r\n" +
|
||||
" * @license\r\n" +
|
||||
" * Copyright (c) .NET Foundation. All rights reserved.\r\n" +
|
||||
" * Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.\r\n" +
|
||||
" */",
|
||||
globals: moduleGlobals,
|
||||
},
|
||||
|
||||
// Mark everything in the dependencies list as external
|
||||
external: Object.keys(pkg.dependencies || {}),
|
||||
|
||||
plugins: [
|
||||
commonjs(),
|
||||
resolve({
|
||||
preferBuiltins: false
|
||||
}),
|
||||
sourceMaps()
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
@ -11,13 +11,13 @@
|
|||
"test": "spec"
|
||||
},
|
||||
"scripts": {
|
||||
"clean": "node ../node_modules/rimraf/bin.js ./dist",
|
||||
"clean": "node ../common/node_modules/rimraf/bin.js ./dist",
|
||||
"build": "npm run clean && npm run build:lint && npm run build:esm && npm run build:cjs && npm run build:browser && npm run build:uglify",
|
||||
"build:lint": "node ../node_modules/tslint/bin/tslint -c ../tslint.json -p ./tsconfig.json",
|
||||
"build:esm": "node ../node_modules/typescript/bin/tsc --project ./tsconfig.json --module es2015 --outDir ./dist/esm -d",
|
||||
"build:cjs": "node ../node_modules/typescript/bin/tsc --project ./tsconfig.json --module commonjs --outDir ./dist/cjs",
|
||||
"build:browser": "node ../node_modules/webpack-cli/bin/cli.js",
|
||||
"build:uglify": "node ../node_modules/uglify-js/bin/uglifyjs --source-map \"url='signalr-protocol-msgpack.min.js.map',content='./dist/browser/signalr-protocol-msgpack.js.map'\" --comments -o ./dist/browser/signalr-protocol-msgpack.min.js ./dist/browser/signalr-protocol-msgpack.js",
|
||||
"build:lint": "node ../common/node_modules/tslint/bin/tslint -c ../tslint.json -p ./tsconfig.json",
|
||||
"build:esm": "node ../common/node_modules/typescript/bin/tsc --project ./tsconfig.json --module es2015 --outDir ./dist/esm -d",
|
||||
"build:cjs": "node ../common/node_modules/typescript/bin/tsc --project ./tsconfig.json --module commonjs --outDir ./dist/cjs",
|
||||
"build:browser": "node ../common/node_modules/webpack-cli/bin/cli.js",
|
||||
"build:uglify": "node ../common/node_modules/uglify-js/bin/uglifyjs --source-map \"url='signalr-protocol-msgpack.min.js.map',content='./dist/browser/signalr-protocol-msgpack.js.map'\" --comments -o ./dist/browser/signalr-protocol-msgpack.min.js ./dist/browser/signalr-protocol-msgpack.js",
|
||||
"prepack": "node ../build/embed-version.js",
|
||||
"test": "echo \"Run 'npm test' in the 'clients\\ts' folder to test this package\" && exit 1"
|
||||
},
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
const path = require("path");
|
||||
const baseConfig = require("../webpack.config.base");
|
||||
|
||||
module.exports = baseConfig(__dirname, "signalr-protocol-msgpack", {
|
||||
externals: {
|
||||
msgpack5: "msgpack5",
|
||||
|
|
|
|||
|
|
@ -11,13 +11,13 @@
|
|||
"test": "spec"
|
||||
},
|
||||
"scripts": {
|
||||
"clean": "node ../node_modules/rimraf/bin.js ./dist",
|
||||
"clean": "node ../common/node_modules/rimraf/bin.js ./dist",
|
||||
"build": "npm run clean && npm run build:lint && npm run build:esm && npm run build:cjs && npm run build:browser && npm run build:uglify",
|
||||
"build:lint": "node ../node_modules/tslint/bin/tslint -c ../tslint.json -p ./tsconfig.json",
|
||||
"build:esm": "node ../node_modules/typescript/bin/tsc --project ./tsconfig.json --module es2015 --outDir ./dist/esm -d && node ./build/process-dts.js",
|
||||
"build:cjs": "node ../node_modules/typescript/bin/tsc --project ./tsconfig.json --module commonjs --outDir ./dist/cjs",
|
||||
"build:browser": "node ../node_modules/webpack-cli/bin/cli.js",
|
||||
"build:uglify": "node ../node_modules/uglify-js/bin/uglifyjs --source-map \"url='signalr.min.js.map',content='./dist/browser/signalr.js.map'\" --comments -o ./dist/browser/signalr.min.js ./dist/browser/signalr.js",
|
||||
"build:lint": "node ../common/node_modules/tslint/bin/tslint -c ../tslint.json -p ./tsconfig.json",
|
||||
"build:esm": "node ../common/node_modules/typescript/bin/tsc --project ./tsconfig.json --module es2015 --outDir ./dist/esm -d && node ./build/process-dts.js",
|
||||
"build:cjs": "node ../common/node_modules/typescript/bin/tsc --project ./tsconfig.json --module commonjs --outDir ./dist/cjs",
|
||||
"build:browser": "node ../common/node_modules/webpack-cli/bin/cli.js",
|
||||
"build:uglify": "node ../common/node_modules/uglify-js/bin/uglifyjs --source-map \"url='signalr.min.js.map',content='./dist/browser/signalr.js.map'\" --comments -o ./dist/browser/signalr.min.js ./dist/browser/signalr.js",
|
||||
"prepack": "node ../build/embed-version.js",
|
||||
"test": "echo \"Run 'npm test' in the 'clients\\ts' folder to test this package\" && exit 1"
|
||||
},
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
/** Error thrown when an HTTP request fails. */
|
||||
export class HttpError extends Error {
|
||||
// @ts-ignore: Intentionally unused.
|
||||
// tslint:disable-next-line:variable-name
|
||||
private __proto__: Error;
|
||||
|
||||
|
|
@ -27,6 +28,7 @@ export class HttpError extends Error {
|
|||
|
||||
/** Error thrown when a timeout elapses. */
|
||||
export class TimeoutError extends Error {
|
||||
// @ts-ignore: Intentionally unused.
|
||||
// tslint:disable-next-line:variable-name
|
||||
private __proto__: Error;
|
||||
|
||||
|
|
@ -46,6 +48,7 @@ export class TimeoutError extends Error {
|
|||
|
||||
/** Error thrown when an action is aborted. */
|
||||
export class AbortError extends Error {
|
||||
// @ts-ignore: Intentionally unused.
|
||||
// tslint:disable-next-line:variable-name
|
||||
private __proto__: Error;
|
||||
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ export class NullLogger implements ILogger {
|
|||
private constructor() {}
|
||||
|
||||
/** @inheritDoc */
|
||||
public log(logLevel: LogLevel, message: string): void {
|
||||
// tslint:disable-next-line
|
||||
public log(_logLevel: LogLevel, _message: string): void {
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,8 +45,7 @@ export interface IStreamResult<T> {
|
|||
*
|
||||
* @typeparam T The type of the items being sent by the server.
|
||||
*/
|
||||
// We can't remove this, it's a breaking change, but it's not used.
|
||||
// tslint:disable-next-line:no-unused-variable
|
||||
// @ts-ignore: We can't remove this, it's a breaking change, but it's not used.
|
||||
export interface ISubscription<T> {
|
||||
/** Disconnects the {@link IStreamSubscriber} associated with this subscription from the stream. */
|
||||
dispose(): void;
|
||||
|
|
|
|||
|
|
@ -48,7 +48,8 @@ export class WebSocketTransport implements ITransport {
|
|||
webSocket.binaryType = "arraybuffer";
|
||||
}
|
||||
|
||||
webSocket.onopen = (event: Event) => {
|
||||
// tslint:disable-next-line:variable-name
|
||||
webSocket.onopen = (_event: Event) => {
|
||||
this.logger.log(LogLevel.Information, `WebSocket connected to ${url}`);
|
||||
this.webSocket = webSocket;
|
||||
resolve();
|
||||
|
|
|
|||
|
|
@ -10,6 +10,8 @@
|
|||
"experimentalDecorators": true,
|
||||
"removeComments": false,
|
||||
"noImplicitAny": true,
|
||||
"noUnusedLocals": true,
|
||||
"noUnusedParameters": true,
|
||||
"suppressImplicitAnyIndexErrors": true,
|
||||
"noEmitOnError": true,
|
||||
"stripInternal": true,
|
||||
|
|
|
|||
|
|
@ -1,7 +1,12 @@
|
|||
{
|
||||
"extends": "./tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"module": "commonjs"
|
||||
"module": "commonjs",
|
||||
"noUnusedLocals": false,
|
||||
"noUnusedParameters": false,
|
||||
"typeRoots": [
|
||||
"./common/node_modules/@types"
|
||||
]
|
||||
},
|
||||
"include": [
|
||||
"./*/tests/**/*"
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@
|
|||
"unified-signatures": false,
|
||||
"max-classes-per-file": false,
|
||||
"no-floating-promises": true,
|
||||
"no-unused-variable": [true, {"ignore-pattern": "^_"}],
|
||||
"no-empty": false,
|
||||
"no-bitwise": false,
|
||||
"no-console": false
|
||||
|
|
|
|||
|
|
@ -1,103 +0,0 @@
|
|||
<html>
|
||||
<head>
|
||||
<title>Test Page</title>
|
||||
<style>
|
||||
.test-success {
|
||||
color: green;
|
||||
}
|
||||
.test-failed {
|
||||
color: red;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Test Page</h1>
|
||||
<p>This page validates that the UMD builds of the signalr-client and signalr-protocol-msgpack modules are available in the global scope when in a browser.</p>
|
||||
<h2>Test Results</h2>
|
||||
<ul id="results-list">
|
||||
</ul>
|
||||
<script src="./signalr-protocol-msgpack/node_modules/msgpack5/dist/msgpack5.js"></script>
|
||||
<script type="text/javascript">
|
||||
function getParameterByName(name, url) {
|
||||
if (!url) {
|
||||
url = window.location.href;
|
||||
}
|
||||
name = name.replace(/[\[\]]/g, "\\$&");
|
||||
var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"),
|
||||
results = regex.exec(url);
|
||||
if (!results) return null;
|
||||
if (!results[2]) return '';
|
||||
return decodeURIComponent(results[2].replace(/\+/g, " "));
|
||||
}
|
||||
|
||||
function importSignalR() {
|
||||
var minified = getParameterByName('min') === 'true' ? '.min' : '';
|
||||
document.write('<script type="text/javascript" src="./signalr/dist/browser/signalr' + minified + '.js"><\/script>');
|
||||
document.write('<script type="text/javascript" src="./signalr-protocol-msgpack/dist/browser/signalr-protocol-msgpack' + minified + '.js"><\/script>');
|
||||
}
|
||||
|
||||
var resultsList = document.getElementById("results-list");
|
||||
// Run tests
|
||||
function test(name, impl) {
|
||||
var result = ""
|
||||
var success = false;
|
||||
try {
|
||||
impl();
|
||||
result = "success";
|
||||
success = true;
|
||||
} catch(e) {
|
||||
console.error(e);
|
||||
result = "error: " + e;
|
||||
success = false;
|
||||
}
|
||||
|
||||
var cssClass = success ? "test-success": "test-failed";
|
||||
resultsList.innerHTML += "<li class=\"" + cssClass + "\">" + name + ": " + result + "</li>";
|
||||
}
|
||||
|
||||
test("Promise may not be available before the polyfill", function() {
|
||||
if(!Promise) {
|
||||
throw "Promise is falsey: " + Promise;
|
||||
}
|
||||
});
|
||||
|
||||
test("Buffer is not available before the polyfill", function() {
|
||||
if(typeof Buffer !== "undefined") {
|
||||
throw "Buffer is truthy: " + Buffer;
|
||||
}
|
||||
});
|
||||
|
||||
importSignalR();
|
||||
</script>
|
||||
|
||||
<script>
|
||||
test("Promise is available after the polyfill", function() {
|
||||
if(!Promise) {
|
||||
throw "Promise is falsey: " + Promise;
|
||||
}
|
||||
});
|
||||
|
||||
test("Buffer is not available after the polyfill", function() {
|
||||
if(typeof Buffer !== "undefined") {
|
||||
throw "Buffer is truthy: " + Buffer;
|
||||
}
|
||||
});
|
||||
|
||||
test("signalR is available", function() {
|
||||
if(!window.signalR){
|
||||
throw "window.signalR is falsey: " + window.signalR;
|
||||
}
|
||||
});
|
||||
test("msgpack5 is available", function() {
|
||||
if(!window.msgpack5){
|
||||
throw "window.msgpack5 is falsey: " + window.msgpack5;
|
||||
}
|
||||
});
|
||||
test("signalR.protocols.msgpack.MessagePackHubProtocol is available", function() {
|
||||
if(!window.signalR.protocols.msgpack.MessagePackHubProtocol){
|
||||
throw "signalR.protocols.msgpack is falsey: " + signalR.protocols.msgpack.MessagePackHubProtocol;
|
||||
}
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -2,7 +2,7 @@
|
|||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||
|
||||
const path = require("path");
|
||||
const webpack = require("webpack");
|
||||
const webpack = require("./common/node_modules/webpack");
|
||||
|
||||
module.exports = function (modulePath, browserBaseName, options) {
|
||||
const pkg = require(path.resolve(modulePath, "package.json"));
|
||||
|
|
@ -17,6 +17,10 @@ module.exports = function (modulePath, browserBaseName, options) {
|
|||
process: false,
|
||||
Buffer: false,
|
||||
},
|
||||
resolveLoader: {
|
||||
// Special resolution rules for loaders (which are in the 'common' directory)
|
||||
modules: [ path.resolve(__dirname, "common", "node_modules") ],
|
||||
},
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue