Skip to content
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

Unblock react native support when using corev2 packages #17783

Merged
13 commits merged into from
Sep 29, 2021
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions sdk/core/core-amqp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@
"./dist-esm/src/util/runtimeInfo.js": "./dist-esm/src/util/runtimeInfo.browser.js",
"buffer": "buffer"
},
"react-native": {
"./dist/index.js": "./dist-esm/src/index.js"
},
"files": [
"dist/",
"dist-esm/src/",
Expand Down
3 changes: 3 additions & 0 deletions sdk/core/core-client-paging-rest/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
"browser": {
"./dist-esm/src/url.js": "./dist-esm/src/url.browser.js"
},
"react-native": {
"./dist/index.js": "./dist-esm/src/index.js"
},
Comment on lines +12 to +14
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@joheredi is this package still a dep in the rest clients? if not, we could probably skip updating it. Same applies for the lro one.

"scripts": {
"audit": "node ../../../common/scripts/rush-audit.js && rimraf node_modules package-lock.json && npm i --package-lock-only 2>&1 && npm audit",
"build:samples": "echo Obsolete",
Expand Down
3 changes: 3 additions & 0 deletions sdk/core/core-client-rest/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
"browser": {
"./dist-esm/src/url.js": "./dist-esm/src/url.browser.js"
},
"react-native": {
"./dist/index.js": "./dist-esm/src/index.js"
},
"types": "types/latest/core-client-rest.d.ts",
"scripts": {
"audit": "node ../../../common/scripts/rush-audit.js && rimraf node_modules package-lock.json && npm i --package-lock-only 2>&1 && npm audit",
Expand Down
3 changes: 3 additions & 0 deletions sdk/core/core-client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
"browser": {
"./dist-esm/src/base64.js": "./dist-esm/src/base64.browser.js"
},
"react-native": {
"./dist/index.js": "./dist-esm/src/index.js"
},
"types": "types/latest/core-client.d.ts",
"typesVersions": {
"<3.6": {
Expand Down
3 changes: 3 additions & 0 deletions sdk/core/core-crypto/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
"browser": {
"./dist-esm/src/sha256.js": "./dist-esm/src/sha256.browser.js"
},
"react-native": {
"./dist/index.js": "./dist-esm/src/index.js"
},
"types": "types/latest/core-crypto.d.ts",
"typesVersions": {
"<3.6": {
Expand Down
2 changes: 1 addition & 1 deletion sdk/core/core-crypto/src/sha256.browser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export async function computeSha256Hash(
encoding: "base64" | "hex"
): Promise<string> {
const contentBytes = utf8ToBytes(content);
const digest = await getCrypto().digest("SHA-256", contentBytes);
const digest = await getCrypto().digest({name: "SHA-256"}, contentBytes);

switch (encoding) {
case "base64":
Expand Down
3 changes: 3 additions & 0 deletions sdk/core/core-http/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@
"./dist-esm/src/util/inspect.js": "./dist-esm/src/util/inspect.browser.js",
"./dist-esm/src/util/url.js": "./dist-esm/src/util/url.browser.js"
},
"react-native": {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since react native support will be only part of core-v2, should we add the mapping here?

"./dist/index.js": "./dist-esm/src/index.js"
},
"license": "MIT",
"homepage": "https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/core/core-http/README.md",
"repository": "github:Azure/azure-sdk-for-js",
Expand Down
3 changes: 3 additions & 0 deletions sdk/core/core-lro/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@
"os": false,
"process": false
},
"react-native": {
"./dist/index.js": "./dist-esm/src/index.js"
},
"license": "MIT",
"homepage": "https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/core/core-lro/README.md",
"repository": "github:Azure/azure-sdk-for-js",
Expand Down
4 changes: 4 additions & 0 deletions sdk/core/core-rest-pipeline/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@
"./dist-esm/src/util/url.js": "./dist-esm/src/util/url.browser.js",
"./dist-esm/src/util/userAgentPlatform.js": "./dist-esm/src/util/userAgentPlatform.browser.js"
},
"react-native": {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changelog?

"./dist/index.js": "./dist-esm/src/index.js",
"./dist-esm/src/util/userAgentPlatform.js": "./dist-esm/src/util/userAgentPlatform.native.js"
},
"types": "core-rest-pipeline.shims.d.ts",
"typesVersions": {
"<3.6": {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.

/*
* NOTE: When moving this file, please update "browser" section in package.json.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

browser -> react-native?

*/

/**
* @internal
*/
export function getHeaderName(): string {
return "x-ms-useragent";
}

/**
* @internal
*/
export function setPlatformSpecificData(map: Map<string, string>): void {
// TODO: Investigate using `import { Platform } from "react-native"` to get "OS" and "Version".
// This may bring in a lot of overhead if we have to use this package directly, perhaps we can shim
// types.
map.set("OS", `react-native`);
}
3 changes: 3 additions & 0 deletions sdk/core/core-tracing/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
"browser": {
"./dist-esm/src/utils/global.js": "./dist-esm/src/utils/global.browser.js"
},
"react-native": {
"./dist/index.js": "./dist-esm/src/index.js"
},
"types": "types/core-tracing.d.ts",
"scripts": {
"audit": "node ../../../common/scripts/rush-audit.js && rimraf node_modules package-lock.json && npm i --package-lock-only 2>&1 && npm audit",
Expand Down
3 changes: 3 additions & 0 deletions sdk/core/core-util/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
"browser": {
"./dist-esm/src/isNode.js": "./dist-esm/src/isNode.browser.js"
},
"react-native": {
"./dist/index.js": "./dist-esm/src/index.js"
},
"types": "types/latest/core-util.d.ts",
"typesVersions": {
"<3.6": {
Expand Down
3 changes: 3 additions & 0 deletions sdk/core/core-xml/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
"browser": {
"./dist-esm/src/xml.js": "./dist-esm/src/xml.browser.js"
},
"react-native": {
"./dist/index.js": "./dist-esm/src/index.js"
},
"types": "types/latest/core-xml.d.ts",
"typesVersions": {
"<3.6": {
Expand Down
3 changes: 3 additions & 0 deletions sdk/core/logger/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
"./dist-esm/src/log.js": "./dist-esm/src/log.browser.js",
"process": false
},
"react-native": {
"./dist/index.js": "./dist-esm/src/index.js"
},
"engines": {
"node": ">=12.0.0"
},
Expand Down