-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Service Bus] Add browser support #5128
Conversation
@@ -43,7 +43,7 @@ const ignoreKnownWarnings = (warning) => { | |||
console.error(`(!) ${warning.message}`); | |||
}; | |||
|
|||
export function nodeConfig({ test = false, production = false } = {}) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ramya0820 I am reluctant to take this change without first understanding the reason why the production flag was part of the function signature in the first place.
@bterlson I remember you had a reason to add the production flag here, but can't recall what it was. #2555 was the PR in which we moved away from using process.env.NODE_ENV
to determine "production"
@ramya0820 I see that you had approved that PR. Do you recall the reason?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Discussed offline and addressed this along with other changes per #3373 description.
There was one temporary browser test failure, and we could add in better samples.
Other than these, we should be good to release once changes and contents in PR look okay.
Please take a look at the copyrights notice file.
@ramya-rao-a @bterlson
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please rename PR as this PR no longer about fixing rolling scripts and more of adding browser bundle in the package
@@ -1,3 +1,8 @@ | |||
# 2019-09-19 1.1.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# 2019-09-19 1.1.0 | |
# 2019-09-22 1.1.0 |
We mostly will not be releasing on a Friday
return ServiceBusClient.createFromTokenProvider(host, tokenProvider, options); | ||
} else { | ||
throw new Error("`createFromAadTokenCredentials` is not supported in browser."); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reduce nesting by
if (!isNode) {
// throw error here
}
// existing code that creates and uses aad token provider
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated.
The reason I used isNode
and not !isNode
was keeping in view the rollup's "replace" plugin configuration that looks at the text " if (isNode) " and replaces it with " if (false) " in browser.
The changes seem equivalent though since we aren't enabling tree shaking. Maybe we should remove the replace plugin config? cc @bterlson
Addressed all other comments as well, please take a look
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, better to use if (isNode)
given the current rollup config. Short term fix might be to add the if (!isNode)
pattern to the rollup config. Longer term fix is to have a platform.node.js and platform.browser.js that exports isNode = true
and isNode = false
respectively, that way either form will work fine with Rollup's tree shaker, and no replace plugin is required.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Filed: #5210
const tokenProvider = new AadTokenProvider(credentials); | ||
return ServiceBusClient.createFromTokenProvider(host, tokenProvider, options); | ||
} else { | ||
throw new Error("`createFromAadTokenCredentials` is not supported in browser."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The error message can be improved by alluding to the fact that AAD support is not yet present in browser mode and so createFromAadTokenCredentials
method cannot be used to create ServiceBusClient
Also, it would be great if we can release preview 7 of amqp-common first and use that version in this PR. The benefit of reduced bundle size that preview 7 of amp-common brings to the table will help the browser bundle. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO remove the notices.txt change and we'll update these in one pass later (/cc @jonathandturner)
buffer, is-buffer | ||
process | ||
debug | ||
rollup and related browser bundling utilities |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rollup is not being redistributed, and doesn't need to be included here.
@@ -0,0 +1,85 @@ | |||
NOTICES AND INFORMATION |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copy ThirdPartyNotices.txt from other libraries, not from the open source guidelines for now. I believe our other packages have the most up to date version. The note about 3rdpartysource.microsoft.com is inaccurate anyway.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Addressed comments and updated to use the format / contents used in other 'ThirdPartyNotices.txt' files instead.
|
||
-------------------------------------------------------------------------------- | ||
Component(s): | ||
@azure/ms-rest-node-auth, @azure/amqp-common |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are not third party components and should not be included.
process 1.11.10 - Copyright (c) 2013 Roman Shtylman <[email protected]> | ||
debug 4.1.1 - Copyright (c) 2014 TJ Holowaychuk <[email protected]> | ||
Type Definitions - Copyright https://github.com/DefinitelyTyped/DefinitelyTyped | ||
@types/long 4.0.0 - Project: https://github.com/dcodeIO/long.js |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Types are not being redistributed and do not need to be included.
-------------------------------------------------------------------------------- | ||
|
||
Component(s): | ||
rhea 1.0.4, rhea-promise 0.1.15, long 4.0.0, tslib 1.9.3 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The original copyright lines need to be included for these.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, the original notice description referring to Apache license is being included - did we mean to copy paste the more detailed description as present at https://github.com/amqp/rhea/blob/master/LICENSE ?
@@ -1,11 +1,17 @@ | |||
# 2019-09-23 1.1.0 | |||
|
|||
- Update library to support running all Service Bus operations in browser. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add browser support. Authentication with @azure/identity
is not yet supported – use a connection string instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated
********** | ||
|
||
********** | ||
rhea 1.0.4, rhea-promise 0.1.15, long 4.0.0, tslib 1.9.3 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing copyright notice.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added in the owners
Co-Authored-By: Ramya Rao <[email protected]>
This reverts commit 4c4a859.
This PR addresses following changes as part of enabling browser support for use in production -