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..a311da9f7b 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,15 +42,16 @@ "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", - "/src" + "/src", + "/browser" ] } 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..c079a9424d --- /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 { BrowserWebSocket } from './browserWebSocket'; +export { WebSocketClient } from './webSocketClient'; +export { WebSocketServer } from './webSocketServer'; +export { WebSocketTransport } 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