From 034d4643fa5eac93b4ef3fc83ee7c870c23a2018 Mon Sep 17 00:00:00 2001 From: stgum <14935595+stevengum@users.noreply.github.com> Date: Fri, 21 Feb 2020 11:13:08 -0800 Subject: [PATCH 1/3] create browser (es5) output in botframework-streaming --- libraries/botframework-streaming/.gitignore | 1 + libraries/botframework-streaming/package.json | 7 +++-- .../src/index-browser.ts | 29 +++++++++++++++++++ .../src/webSocket/index-browser.ts | 12 ++++++++ .../tsconfig-browser.json | 22 ++++++++++++++ .../botframework-streaming/tsconfig.json | 6 ++++ 6 files changed, 74 insertions(+), 3 deletions(-) create mode 100644 libraries/botframework-streaming/src/index-browser.ts create mode 100644 libraries/botframework-streaming/src/webSocket/index-browser.ts create mode 100644 libraries/botframework-streaming/tsconfig-browser.json diff --git a/libraries/botframework-streaming/.gitignore b/libraries/botframework-streaming/.gitignore index 392f0b0976..ae8afb3dab 100644 --- a/libraries/botframework-streaming/.gitignore +++ b/libraries/botframework-streaming/.gitignore @@ -1,3 +1,4 @@ +/browser /lib /node_modules *.js.map diff --git a/libraries/botframework-streaming/package.json b/libraries/botframework-streaming/package.json index 01d74d1692..d479514aee 100644 --- a/libraries/botframework-streaming/package.json +++ b/libraries/botframework-streaming/package.json @@ -20,6 +20,7 @@ "url": "https://github.com/microsoft/botbuilder-js.git" }, "main": "lib/index.js", + "browser": "browser/index-browser.js", "typings": "lib/index.d.ts", "dependencies": { "@types/ws": "^6.0.3", @@ -41,12 +42,12 @@ "typescript": "3.5.3" }, "scripts": { - "build": "tsc", - "clean": "erase /q /s .\\lib", + "build": "tsc -p tsconfig.json && tsc -p tsconfig-browser.json", + "clean": "erase /q /s .\\lib .\\browser", "eslint": "eslint ./src/*.ts ./src/**/*.ts", "eslint-fix": "eslint ./src/*.ts ./src/**/*.ts --fix", "set-version": "npm version --allow-same-version ${Version}", - "test": "tsc && nyc mocha tests/" + "test": "npm run build && nyc mocha tests/" }, "files": [ "/lib", diff --git a/libraries/botframework-streaming/src/index-browser.ts b/libraries/botframework-streaming/src/index-browser.ts new file mode 100644 index 0000000000..d42e2e19da --- /dev/null +++ b/libraries/botframework-streaming/src/index-browser.ts @@ -0,0 +1,29 @@ +/** + * @module botframework-streaming + */ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. + */ + +export { ContentStream } from './contentStream'; +export { HttpContent } from './httpContentStream'; +export { + INodeBuffer, + INodeIncomingMessage, + INodeSocket, + IReceiveRequest, + IReceiveResponse, + ISocket, + IStreamingTransportClient, + IStreamingTransportServer, +} from './interfaces'; +export { RequestHandler } from './requestHandler'; +export { StreamingRequest } from './streamingRequest'; +export { StreamingResponse } from './streamingResponse'; +export { SubscribableStream } from './subscribableStream'; +export { + BrowserWebSocket, + WebSocketClient, + WebSocketServer +} from './webSocket/index-browser'; diff --git a/libraries/botframework-streaming/src/webSocket/index-browser.ts b/libraries/botframework-streaming/src/webSocket/index-browser.ts new file mode 100644 index 0000000000..3f525532ac --- /dev/null +++ b/libraries/botframework-streaming/src/webSocket/index-browser.ts @@ -0,0 +1,12 @@ +/** + * @module botframework-streaming + */ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. + */ + +export * from './browserWebSocket'; +export * from './webSocketClient'; +export * from './webSocketServer'; +export * from './webSocketTransport'; diff --git a/libraries/botframework-streaming/tsconfig-browser.json b/libraries/botframework-streaming/tsconfig-browser.json new file mode 100644 index 0000000000..6312133e58 --- /dev/null +++ b/libraries/botframework-streaming/tsconfig-browser.json @@ -0,0 +1,22 @@ +{ + "compilerOptions": { + "target": "es5", + "lib": ["es2015"], + "module": "commonjs", + "declaration": true, + "declarationMap": true, + "sourceMap": true, + "outDir": "./browser", + "rootDir": "./src", + "types" : ["node"] + }, + "exclude": [ + "browser", + "lib", + "node_modules", + "./src/index.ts", + "./src/webSocket/index.ts", + "./src/webSocket/nodeWebSocket.ts", + "src/namedPipe" + ] +} diff --git a/libraries/botframework-streaming/tsconfig.json b/libraries/botframework-streaming/tsconfig.json index 4c2de6ee67..70668d39b9 100644 --- a/libraries/botframework-streaming/tsconfig.json +++ b/libraries/botframework-streaming/tsconfig.json @@ -10,4 +10,10 @@ "rootDir": "./src", "types" : ["node"] }, + "exclude": [ + "**/index-browser.ts", + "browser", + "lib", + "node_modules" + ] } \ No newline at end of file From cb4ee67c0521ab097f2a54acda85458efebcfc3d Mon Sep 17 00:00:00 2001 From: stevengum <14935595+stevengum@users.noreply.github.com> Date: Sun, 23 Feb 2020 17:07:25 -0800 Subject: [PATCH 2/3] include new browser folder in packed files --- libraries/botframework-streaming/package.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libraries/botframework-streaming/package.json b/libraries/botframework-streaming/package.json index d479514aee..a311da9f7b 100644 --- a/libraries/botframework-streaming/package.json +++ b/libraries/botframework-streaming/package.json @@ -51,6 +51,7 @@ }, "files": [ "/lib", - "/src" + "/src", + "/browser" ] } From 4035d2c89ceb7a72c2a04d0e81a45395aa6d4057 Mon Sep 17 00:00:00 2001 From: stevengum <14935595+stevengum@users.noreply.github.com> Date: Mon, 24 Feb 2020 11:42:27 -0800 Subject: [PATCH 3/3] apply PR feedback around exports --- .../botframework-streaming/src/webSocket/index-browser.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libraries/botframework-streaming/src/webSocket/index-browser.ts b/libraries/botframework-streaming/src/webSocket/index-browser.ts index 3f525532ac..c079a9424d 100644 --- a/libraries/botframework-streaming/src/webSocket/index-browser.ts +++ b/libraries/botframework-streaming/src/webSocket/index-browser.ts @@ -6,7 +6,7 @@ * Licensed under the MIT License. */ -export * from './browserWebSocket'; -export * from './webSocketClient'; -export * from './webSocketServer'; -export * from './webSocketTransport'; +export { BrowserWebSocket } from './browserWebSocket'; +export { WebSocketClient } from './webSocketClient'; +export { WebSocketServer } from './webSocketServer'; +export { WebSocketTransport } from './webSocketTransport';