Fix SignalR TS client build on macOS (#9230)

This commit is contained in:
Stephen Halter 2019-04-13 01:14:57 -07:00 committed by GitHub
parent e04c79bd3d
commit 28970a3e93
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 1192 additions and 453 deletions

View File

@ -5,8 +5,8 @@
"description": "", "description": "",
"main": "index.js", "main": "index.js",
"dependencies": { "dependencies": {
"@aspnet/signalr": "link:../signalr", "@aspnet/signalr": "file:../signalr",
"@aspnet/signalr-protocol-msgpack": "link:../signalr-protocol-msgpack", "@aspnet/signalr-protocol-msgpack": "file:../signalr-protocol-msgpack",
"msgpack5": "^4.0.2" "msgpack5": "^4.0.2"
}, },
"devDependencies": { "devDependencies": {
@ -32,22 +32,23 @@
"karma-summary-reporter": "^1.5.0", "karma-summary-reporter": "^1.5.0",
"rxjs": "^6.3.3", "rxjs": "^6.3.3",
"ts-node": "^4.1.0", "ts-node": "^4.1.0",
"typescript": "^3.0.1", "typescript": "^2.7.1",
"ws": " ^6.0.0" "ws": " ^6.0.0"
}, },
"scripts": { "scripts": {
"preclean": "cd .. && npm run build",
"clean": "node ../common/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", "prebuild": "npm run clean && npm install",
"build": "npm run build:lint && npm run build:webpack",
"build:lint": "node ../common/node_modules/tslint/bin/tslint -c ../tslint.json -p ./tsconfig.json", "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:webpack": "node ../common/node_modules/webpack-cli/bin/cli.js",
"build:parent": "cd .. && npm run build", "pretest": "npm run build && dotnet build FunctionalTests.csproj",
"pretest": "npm run build:parent && npm run build && dotnet build --no-restore FunctionalTests.csproj",
"test": "tsc --noEmit && npm run test:local --", "test": "tsc --noEmit && npm run test:local --",
"test:inner": "npm run build && dotnet build FunctionalTests.csproj && npm run test:local --", "test:inner": "npm run build && dotnet build FunctionalTests.csproj && npm run test:local --",
"test:local": "ts-node --project ./scripts/tsconfig.json ./scripts/run-tests.ts", "test:local": "npm run pretest && ts-node --project ./scripts/tsconfig.json ./scripts/run-tests.ts",
"test:all": "npm run pretest && ts-node --project ./scripts/tsconfig.json ./scripts/run-tests.ts --all-browsers", "test:all": "npm run pretest && ts-node --project ./scripts/tsconfig.json ./scripts/run-tests.ts --all-browsers",
"test:sauce": "ts-node --project ./scripts/tsconfig.json ./scripts/run-tests.ts --sauce", "test:sauce": "npm run pretest && ts-node --project ./scripts/tsconfig.json ./scripts/run-tests.ts --sauce",
"sauce": "npm run pretest && npm run test:sauce" "sauce": "npm run test:sauce"
}, },
"author": "", "author": "",
"license": "Apache-2.0" "license": "Apache-2.0"

View File

@ -50,7 +50,7 @@ function getConnectionBuilder(transportType?: HttpTransportType, url?: string, o
describe("hubConnection", () => { describe("hubConnection", () => {
eachTransportAndProtocol((transportType, protocol) => { eachTransportAndProtocol((transportType, protocol) => {
describe("using " + protocol.name + " over " + HttpTransportType[transportType] + " transport", async () => { describe("using " + protocol.name + " over " + HttpTransportType[transportType] + " transport", () => {
it("can invoke server method and receive result", (done) => { it("can invoke server method and receive result", (done) => {
const message = "你好,世界!"; const message = "你好,世界!";

View File

@ -2,13 +2,17 @@
# yarn lockfile v1 # yarn lockfile v1
"@aspnet/signalr-protocol-msgpack@link:../signalr-protocol-msgpack": "@aspnet/signalr-protocol-msgpack@file:../signalr-protocol-msgpack":
version "0.0.0" version "3.0.0-preview4-t000"
uid "" dependencies:
msgpack5 "^4.0.2"
"@aspnet/signalr@link:../signalr": "@aspnet/signalr@file:../signalr":
version "0.0.0" version "3.0.0-preview4-t000"
uid "" dependencies:
eventsource "^1.0.7"
request "^2.88.0"
ws "^6.0.0"
"@types/bluebird@*": "@types/bluebird@*":
version "3.5.23" version "3.5.23"
@ -2672,10 +2676,10 @@ type-is@~1.6.16:
media-typer "0.3.0" media-typer "0.3.0"
mime-types "~2.1.18" mime-types "~2.1.18"
typescript@^3.0.1: typescript@^2.7.1:
version "3.0.1" version "2.9.2"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.0.1.tgz#43738f29585d3a87575520a4b93ab6026ef11fdb" resolved "https://registry.yarnpkg.com/typescript/-/typescript-2.9.2.tgz#1cbf61d05d6b96269244eb6a3bce4bd914e0f00c"
integrity sha512-zQIMOmC+372pC/CCVLqnQ0zSBiY7HHodU7mpQdjiZddek4GMj31I3dUJ7gAs9o65X7mnRma6OokOkc6f9jjfBg== integrity sha512-Gr4p6nFNaoufRIY4NMdpQRNmgxVIGMs4Fcu/ujdYk3nAZqk7supzBE9idmvfZIlH/Cuj//dvi+019qEue9lV0w==
ultron@~1.1.0: ultron@~1.1.0:
version "1.1.1" version "1.1.1"

View File

@ -13,7 +13,7 @@
"@types/jest": "^23.3.2", "@types/jest": "^23.3.2",
"@types/node": "^8.5.2", "@types/node": "^8.5.2",
"@types/webpack": "^4.4.0", "@types/webpack": "^4.4.0",
"jest": "^23.6.0", "jest": "^24.1.0",
"jest-junit": "^5.1.0", "jest-junit": "^5.1.0",
"rimraf": "^2.6.2", "rimraf": "^2.6.2",
"ts-jest": "^22.4.6", "ts-jest": "^22.4.6",

File diff suppressed because it is too large Load Diff

View File

@ -11,15 +11,17 @@
"test": "spec" "test": "spec"
}, },
"scripts": { "scripts": {
"preclean": "cd ../common && npm install",
"clean": "node ../common/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", "prebuild": "npm run clean && npm install",
"build": "npm run build:lint && npm run build:esm && npm run build:cjs && npm run build:browser && npm run build:uglify",
"build:lint": "node ../common/node_modules/tslint/bin/tslint -c ../tslint.json -p ./tsconfig.json", "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: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: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: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", "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", "prepack": "node ../build/embed-version.js",
"test": "echo \"Run 'npm test' in the 'clients\\ts' folder to test this package\" && exit 1" "test": "echo \"Run 'npm test' in the 'clients/ts' folder to test this package\" && exit 1"
}, },
"keywords": [ "keywords": [
"signalr", "signalr",
@ -27,14 +29,14 @@
], ],
"repository": { "repository": {
"type": "git", "type": "git",
"url": "git+https://github.com/aspnet/SignalR.git" "url": "git+https://github.com/aspnet/AspNetCore.git"
}, },
"author": "Microsoft", "author": "Microsoft",
"license": "Apache-2.0", "license": "Apache-2.0",
"bugs": { "bugs": {
"url": "https://github.com/aspnet/SignalR/issues" "url": "https://github.com/aspnet/AspNetCore/issues"
}, },
"homepage": "https://github.com/aspnet/SignalR#readme", "homepage": "https://github.com/aspnet/AspNetCore/tree/master/src/SignalR#readme",
"files": [ "files": [
"dist/**/*", "dist/**/*",
"src/**/*" "src/**/*"

View File

@ -11,8 +11,10 @@
"test": "spec" "test": "spec"
}, },
"scripts": { "scripts": {
"preclean": "cd ../common && npm install",
"clean": "node ../common/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:webworker && npm run build:uglify", "prebuild": "npm run clean && npm install",
"build": "npm run build:lint && npm run build:esm && npm run build:cjs && npm run build:browser && npm run build:webworker && npm run build:uglify",
"build:lint": "node ../common/node_modules/tslint/bin/tslint -c ../tslint.json -p ./tsconfig.json", "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: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:cjs": "node ../common/node_modules/typescript/bin/tsc --project ./tsconfig.json --module commonjs --outDir ./dist/cjs",
@ -22,8 +24,12 @@
"build:uglify:browser": "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", "build:uglify:browser": "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",
"build:uglify:webworker": "node ../common/node_modules/uglify-js/bin/uglifyjs --source-map \"url='signalr.min.js.map',content='./dist/webworker/signalr.js.map'\" --comments -o ./dist/webworker/signalr.min.js ./dist/webworker/signalr.js", "build:uglify:webworker": "node ../common/node_modules/uglify-js/bin/uglifyjs --source-map \"url='signalr.min.js.map',content='./dist/webworker/signalr.js.map'\" --comments -o ./dist/webworker/signalr.min.js ./dist/webworker/signalr.js",
"prepack": "node ../build/embed-version.js", "prepack": "node ../build/embed-version.js",
"test": "echo \"Run 'npm test' in the 'clients\\ts' folder to test this package\" && exit 1" "test": "echo \"Run 'npm test' in the 'clients/ts' folder to test this package\" && exit 1"
}, },
"keywords": [
"signalr",
"aspnetcore"
],
"repository": { "repository": {
"type": "git", "type": "git",
"url": "git+https://github.com/aspnet/AspNetCore.git" "url": "git+https://github.com/aspnet/AspNetCore.git"

View File

@ -187,7 +187,13 @@ export class HubConnection {
await handshakePromise; await handshakePromise;
// It's important to check the stopDuringStartError instead of just relying on the handshakePromise
// being rejected on close, because this continuation can run after both the handshake completed successfully
// and the connection was closed.
if (this.stopDuringStartError) { if (this.stopDuringStartError) {
// It's important to throw instead of returning a rejected promise, because we don't want to allow any state
// transitions to occur between now and the calling code observing the exceptions. Returning a rejected promise
// will cause the calling continuation to get scheduled to run later.
throw this.stopDuringStartError; throw this.stopDuringStartError;
} }
} catch (e) { } catch (e) {

View File

@ -3,9 +3,7 @@
// Not exported from index // Not exported from index
export interface EventSourceConstructor { export type EventSourceConstructor = new(url: string, eventSourceInitDict?: EventSourceInit) => EventSource;
new(url: string, eventSourceInitDict?: EventSourceInit): EventSource;
}
export interface WebSocketConstructor { export interface WebSocketConstructor {
new(url: string, protocols?: string | string[], options?: any): WebSocket; new(url: string, protocols?: string | string[], options?: any): WebSocket;

View File

@ -14,6 +14,7 @@
"noUnusedParameters": true, "noUnusedParameters": true,
"suppressImplicitAnyIndexErrors": true, "suppressImplicitAnyIndexErrors": true,
"noEmitOnError": true, "noEmitOnError": true,
"skipLibCheck": true,
"stripInternal": true, "stripInternal": true,
"strict": true, "strict": true,
"lib": [ "es5", "es2015.promise", "es2015.iterable", "dom" ], "lib": [ "es5", "es2015.promise", "es2015.iterable", "dom" ],