From ee27d04eab9e6405403baa6e6a329afdcc0063d7 Mon Sep 17 00:00:00 2001 From: Jeremy Meng Date: Mon, 13 Jun 2022 17:20:14 +0000 Subject: [PATCH 01/12] Conditional export for core-rest-pipeline - when bundle, output to index.cjs - add conditional export for "require" and "import" --- common/tools/dev-tool/src/commands/run/bundle.ts | 2 +- sdk/core/core-rest-pipeline/package.json | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/common/tools/dev-tool/src/commands/run/bundle.ts b/common/tools/dev-tool/src/commands/run/bundle.ts index fb6eae4fc958..8d4dee03beaf 100644 --- a/common/tools/dev-tool/src/commands/run/bundle.ts +++ b/common/tools/dev-tool/src/commands/run/bundle.ts @@ -72,7 +72,7 @@ export default leafCommand(commandInfo, async (options) => { const bundle = await rollup.rollup(baseConfig); await bundle.write({ - file: "dist/index.js", + file: "dist/index.cjs", format: "cjs", sourcemap: true, exports: "named", diff --git a/sdk/core/core-rest-pipeline/package.json b/sdk/core/core-rest-pipeline/package.json index 18a77941462a..9bd98ddad1c8 100644 --- a/sdk/core/core-rest-pipeline/package.json +++ b/sdk/core/core-rest-pipeline/package.json @@ -3,8 +3,13 @@ "version": "1.9.1", "description": "Isomorphic client library for making HTTP requests in node.js and browser.", "sdk-type": "client", - "main": "dist/index.js", + "main": "dist/index.cjs", "module": "dist-esm/src/index.js", + "type": "module", + "export": { + "require": "dist/index.cjs", + "import": "dist-esm/src/index.js" + }, "browser": { "./dist-esm/src/defaultHttpClient.js": "./dist-esm/src/defaultHttpClient.browser.js", "./dist-esm/src/policies/decompressResponsePolicy.js": "./dist-esm/src/policies/decompressResponsePolicy.browser.js", @@ -14,7 +19,7 @@ "./dist-esm/src/util/userAgentPlatform.js": "./dist-esm/src/util/userAgentPlatform.browser.js" }, "react-native": { - "./dist/index.js": "./dist-esm/src/index.js", + "./dist/index.cjs": "./dist-esm/src/index.js", "./dist-esm/src/defaultHttpClient.js": "./dist-esm/src/defaultHttpClient.native.js", "./dist-esm/src/util/userAgentPlatform.js": "./dist-esm/src/util/userAgentPlatform.native.js" }, From 1c0c4fb4ddbfcdfd0eccab285f9719789ad45c84 Mon Sep 17 00:00:00 2001 From: Jeremy Meng Date: Mon, 1 Aug 2022 22:27:18 +0000 Subject: [PATCH 02/12] Add an option to dev-tool bundle command for .cjs output extension --- common/tools/dev-tool/src/commands/run/bundle.ts | 7 ++++++- sdk/core/core-rest-pipeline/package.json | 15 ++++++++++----- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/common/tools/dev-tool/src/commands/run/bundle.ts b/common/tools/dev-tool/src/commands/run/bundle.ts index 8d4dee03beaf..530128f97a9e 100644 --- a/common/tools/dev-tool/src/commands/run/bundle.ts +++ b/common/tools/dev-tool/src/commands/run/bundle.ts @@ -39,6 +39,11 @@ export const commandInfo = makeCommandInfo( default: true, description: "include a polyfill for Node.js builtin modules", }, + "output-cjs-ext": { + kind: "boolean", + default: false, + description: "use .cjs extension for bundle output. default is .js extension", + }, } ); @@ -72,7 +77,7 @@ export default leafCommand(commandInfo, async (options) => { const bundle = await rollup.rollup(baseConfig); await bundle.write({ - file: "dist/index.cjs", + file: `dist/index.${options["output-cjs-ext"] ? "cjs" : "js"}`, format: "cjs", sourcemap: true, exports: "named", diff --git a/sdk/core/core-rest-pipeline/package.json b/sdk/core/core-rest-pipeline/package.json index 9bd98ddad1c8..5b681f55cab6 100644 --- a/sdk/core/core-rest-pipeline/package.json +++ b/sdk/core/core-rest-pipeline/package.json @@ -7,8 +7,11 @@ "module": "dist-esm/src/index.js", "type": "module", "export": { - "require": "dist/index.cjs", - "import": "dist-esm/src/index.js" + ".": { + "types": "./types/src/index.js", + "require": "./dist/index.cjs", + "import": "./dist-esm/src/index.js" + } }, "browser": { "./dist-esm/src/defaultHttpClient.js": "./dist-esm/src/defaultHttpClient.browser.js", @@ -34,9 +37,9 @@ "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", - "build:test": "tsc -p . && dev-tool run bundle", + "build:test": "tsc -p . && dev-tool run bundle --output-cjs-ext=true", "build:types": "downlevel-dts types/latest/ types/3.1/", - "build": "npm run clean && tsc -p . && dev-tool run bundle && api-extractor run --local && npm run build:types", + "build": "npm run clean && tsc -p . && dev-tool run bundle --output-cjs-ext=true && api-extractor run --local && npm run build:types", "check-format": "prettier --list-different --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.ts\" \"test/**/*.ts\" \"*.{js,json}\"", "clean": "rimraf dist dist-* temp types *.tgz *.log", "execute:samples": "echo skipped", @@ -50,7 +53,7 @@ "pack": "npm pack 2>&1", "test:browser": "npm run clean && npm run build:test && npm run unit-test:browser && npm run integration-test:browser", "test:node": "npm run clean && tsc -p . && npm run unit-test:node && npm run integration-test:node", - "test": "npm run clean && tsc -p . && npm run unit-test:node && dev-tool run bundle && npm run unit-test:browser && npm run integration-test", + "test": "npm run clean && tsc -p . && npm run unit-test:node && dev-tool run bundle --output-cjs-ext=true && npm run unit-test:browser && npm run integration-test", "unit-test:browser": "karma start --single-run", "unit-test:node": "mocha -r esm -r ts-node/register --reporter ../../../common/tools/mocha-multi-reporter.js --timeout 1200000 --full-trace --exclude \"test/**/browser/*.spec.ts\" \"test/**/*.spec.ts\"", "unit-test": "npm run unit-test:node && npm run unit-test:browser" @@ -58,7 +61,9 @@ "files": [ "dist/", "dist-esm/src/", + "types/3.1/src/", "types/3.1/core-rest-pipeline.d.ts", + "types/latest/src/", "types/latest/core-rest-pipeline.d.ts", "core-rest-pipeline.shims.d.ts", "core-rest-pipeline.shims-3_1.d.ts", From db7e7ef7a8901d695af697850e2d6dfa5698b4ff Mon Sep 17 00:00:00 2001 From: Jeremy Meng Date: Mon, 1 Aug 2022 22:28:33 +0000 Subject: [PATCH 03/12] import "*" => import "*.js" --- common/config/rush/pnpm-lock.yaml | 120 +++++++++++------- sdk/core/core-rest-pipeline/package.json | 8 +- .../src/createPipelineFromOptions.ts | 26 ++-- .../src/defaultHttpClient.browser.ts | 4 +- .../src/defaultHttpClient.native.ts | 4 +- .../src/defaultHttpClient.ts | 4 +- .../core-rest-pipeline/src/fetchHttpClient.ts | 6 +- .../core-rest-pipeline/src/httpHeaders.ts | 2 +- sdk/core/core-rest-pipeline/src/index.ts | 56 ++++---- .../core-rest-pipeline/src/nodeHttpClient.ts | 8 +- sdk/core/core-rest-pipeline/src/pipeline.ts | 2 +- .../core-rest-pipeline/src/pipelineRequest.ts | 6 +- .../bearerTokenAuthenticationPolicy.ts | 8 +- .../src/policies/decompressResponsePolicy.ts | 4 +- .../src/policies/defaultRetryPolicy.ts | 12 +- .../src/policies/exponentialRetryPolicy.ts | 8 +- .../src/policies/formDataPolicy.browser.ts | 4 +- .../src/policies/formDataPolicy.ts | 4 +- .../src/policies/logPolicy.ts | 8 +- .../src/policies/ndJsonPolicy.ts | 4 +- .../src/policies/proxyPolicy.ts | 16 ++- .../src/policies/redirectPolicy.ts | 4 +- .../src/policies/retryPolicy.ts | 12 +- .../src/policies/setClientRequestIdPolicy.ts | 4 +- .../src/policies/systemErrorRetryPolicy.ts | 8 +- .../src/policies/throttlingRetryPolicy.ts | 8 +- .../src/policies/tlsPolicy.ts | 4 +- .../src/policies/tracingPolicy.ts | 12 +- .../src/policies/userAgentPolicy.ts | 6 +- sdk/core/core-rest-pipeline/src/restError.ts | 6 +- .../exponentialRetryStrategy.ts | 8 +- .../src/retryStrategies/retryStrategy.ts | 4 +- .../throttlingRetryStrategy.ts | 6 +- .../core-rest-pipeline/src/util/helpers.ts | 2 +- .../src/util/tokenCycler.ts | 2 +- .../core-rest-pipeline/src/util/userAgent.ts | 4 +- .../core-rest-pipeline/src/xhrHttpClient.ts | 6 +- .../bearerTokenAuthenticationPolicy.spec.ts | 4 +- .../test/browser/decompressResponsePolicy.ts | 2 +- .../test/browser/fetchHttpClient.spec.ts | 10 +- .../test/browser/formDataPolicy.spec.ts | 2 +- .../test/browser/proxyPolicy.spec.ts | 2 +- .../test/defaultRetryPolicy.spec.ts | 4 +- .../test/exponentialRetryPolicy.spec.ts | 4 +- .../test/httpHeaders.spec.ts | 2 +- .../test/ndJsonPolicy.spec.ts | 2 +- ...TokenAuthenticationPolicyChallenge.spec.ts | 2 +- .../test/node/decompressResponsePolicy.ts | 2 +- .../test/node/formDataPolicy.spec.ts | 2 +- .../test/node/getBodyLength.spec.ts | 2 +- .../test/node/nodeHttpClient.spec.ts | 2 +- .../test/node/pipeline.spec.ts | 17 +-- .../test/node/proxyPolicy.spec.ts | 4 +- .../test/node/restError.spec.ts | 7 +- .../core-rest-pipeline/test/pipeline.spec.ts | 2 +- .../test/redirectPolicy.spec.ts | 9 +- .../test/retryPolicy.spec.ts | 4 +- .../core-rest-pipeline/test/sanitizer.spec.ts | 2 +- .../test/systemErrorRetryPolicy.spec.ts | 4 +- .../test/throttlingRetryPolicy.spec.ts | 4 +- .../test/tracingPolicy.spec.ts | 2 +- 61 files changed, 283 insertions(+), 224 deletions(-) diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index 9cd68a249254..4801d1f4a5a4 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -1019,7 +1019,7 @@ packages: resolution: {integrity: sha512-Q71Buur3RMcg6lCnisLL8Im562DBw+ybzgm+YQj/FbAaI8ZNu/zl/5z1fE4k3Q9LSIzYrz6HLRzlhdSBXpydlQ==} engines: {node: '>=8.0.0'} dependencies: - '@azure/core-http': 1.2.3 + '@azure/core-http': 1.2.6 '@azure/core-tracing': 1.0.0-preview.9 '@azure/logger': 1.0.3 '@azure/msal-node': 1.0.0-beta.6_debug@4.3.4 @@ -2348,7 +2348,7 @@ packages: resolution: {integrity: sha512-ALYone6pm6QmwZoAgeyNksccT9Q4AWZQ6PvfwR37GT6r6FWUPguq6sUmNGSMV2Wr761oQoBxwGGa6DR5o1DC9g==} dependencies: '@types/connect': 3.4.35 - '@types/node': 12.20.55 + '@types/node': 18.6.3 dev: false /@types/chai-as-promised/7.1.5: @@ -2374,7 +2374,7 @@ packages: /@types/connect/3.4.35: resolution: {integrity: sha512-cdeYyv4KWoEgpBISTxWvqYsVy444DOqehiF3fM3ne10AmJ62RSyNkUnxMJXHQWRQQX2eR94m5y1IZyDwBjV9FQ==} dependencies: - '@types/node': 12.20.55 + '@types/node': 18.6.3 dev: false /@types/cookie/0.4.1: @@ -2409,7 +2409,7 @@ packages: /@types/express-serve-static-core/4.17.30: resolution: {integrity: sha512-gstzbTWro2/nFed1WXtf+TtrpwxH7Ggs4RLYTLbeVgIkUQOI3WG/JKjgeOU1zXDvezllupjrf8OPIdvTbIaVOQ==} dependencies: - '@types/node': 12.20.55 + '@types/node': 18.6.3 '@types/qs': 6.9.7 '@types/range-parser': 1.2.4 dev: false @@ -2426,20 +2426,20 @@ packages: /@types/fs-extra/8.1.2: resolution: {integrity: sha512-SvSrYXfWSc7R4eqnOzbQF4TZmfpNSM9FrSWLU3EUnWBuyZqNBOrv1B1JA3byUDPUl9z4Ab3jeZG2eDdySlgNMg==} dependencies: - '@types/node': 12.20.55 + '@types/node': 18.6.3 dev: false /@types/fs-extra/9.0.13: resolution: {integrity: sha512-nEnwB++1u5lVDM2UI4c1+5R+FYaKfaAzS4OococimjVm3nQw3TuzH5UNsocrcTBbhnerblyHj4A49qXbIiZdpA==} dependencies: - '@types/node': 12.20.55 + '@types/node': 18.6.3 dev: false /@types/glob/7.2.0: resolution: {integrity: sha512-ZUxbzKl0IfJILTS6t7ip5fQQM/J3TJYubDm3nMbgubNNYS62eXeUpoLUC8/7fJNiFYHTrGPQn7hspDUzIHX3UA==} dependencies: '@types/minimatch': 3.0.5 - '@types/node': 12.20.55 + '@types/node': 18.6.3 dev: false /@types/inquirer/8.2.1: @@ -2452,7 +2452,7 @@ packages: /@types/is-buffer/2.0.0: resolution: {integrity: sha512-0f7N/e3BAz32qDYvgB4d2cqv1DqUwvGxHkXsrucICn8la1Vb6Yl6Eg8mPScGwUiqHJeE7diXlzaK+QMA9m4Gxw==} dependencies: - '@types/node': 12.20.55 + '@types/node': 18.6.3 dev: false /@types/json-schema/7.0.11: @@ -2466,13 +2466,13 @@ packages: /@types/jsonwebtoken/8.5.8: resolution: {integrity: sha512-zm6xBQpFDIDM6o9r6HSgDeIcLy82TKWctCXEPbJJcXb5AKmi5BNNdLXneixK4lplX3PqIVcwLBCGE/kAGnlD4A==} dependencies: - '@types/node': 12.20.55 + '@types/node': 18.6.3 dev: false /@types/jws/3.2.4: resolution: {integrity: sha512-aqtH4dPw1wUjFZaeMD1ak/pf8iXlu/odFe+trJrvw0g1sTh93i+SCykg0Ek8C6B7rVK3oBORbfZAsKO7P10etg==} dependencies: - '@types/node': 12.20.55 + '@types/node': 18.6.3 dev: false /@types/long/4.0.2: @@ -2508,13 +2508,13 @@ packages: /@types/mock-fs/4.13.1: resolution: {integrity: sha512-m6nFAJ3lBSnqbvDZioawRvpLXSaPyn52Srf7OfzjubYbYX8MTUdIgDxQl0wEapm4m/pNYSd9TXocpQ0TvZFlYA==} dependencies: - '@types/node': 12.20.55 + '@types/node': 18.6.3 dev: false /@types/mock-require/2.0.1: resolution: {integrity: sha512-O7U5DVGboY/Crueb5/huUCIRjKtRVRaLmRDbZJBlDQgJn966z3aiFDN+6AtYviu2ExwMkl34LjT/IiC0OPtKuQ==} dependencies: - '@types/node': 12.20.55 + '@types/node': 18.6.3 dev: false /@types/ms/0.7.31: @@ -2532,7 +2532,7 @@ packages: /@types/node-fetch/2.6.2: resolution: {integrity: sha512-DHqhlq5jeESLy19TYhLakJ07kNumXWjcDdxXsLUMJZ6ue8VZJj4kLPQVE/2mdHh3xZziNF1xppu5lwmS53HR+A==} dependencies: - '@types/node': 12.20.55 + '@types/node': 18.6.3 form-data: 3.0.1 dev: false @@ -2579,7 +2579,7 @@ packages: /@types/resolve/1.17.1: resolution: {integrity: sha512-yy7HuzQhj0dhGpD8RLXSZWEkLsV9ibvxvi6EiJ3bkqLAO1RGo0WbkWQiwpRlSFymTJRz0d3k5LM3kkx8ArDbLw==} dependencies: - '@types/node': 12.20.55 + '@types/node': 18.6.3 dev: false /@types/semaphore/1.1.1: @@ -2590,7 +2590,7 @@ packages: resolution: {integrity: sha512-z5xyF6uh8CbjAu9760KDKsH2FcDxZ2tFCsA4HIMWE6IkiYMXfVoa+4f9KX+FN0ZLsaMw1WNG2ETLA6N+/YA+cg==} dependencies: '@types/mime': 3.0.0 - '@types/node': 12.20.55 + '@types/node': 18.6.3 dev: false /@types/sinon/10.0.13: @@ -2612,13 +2612,13 @@ packages: /@types/stoppable/1.1.1: resolution: {integrity: sha512-b8N+fCADRIYYrGZOcmOR8ZNBOqhktWTB/bMUl5LvGtT201QKJZOOH5UsFyI3qtteM6ZAJbJqZoBcLqqxKIwjhw==} dependencies: - '@types/node': 12.20.55 + '@types/node': 18.6.3 dev: false /@types/through/0.0.30: resolution: {integrity: sha512-FvnCJljyxhPM3gkRgWmxmDZyAQSiBQQWLI0A0VFL0K7W1oRUrPJSqNO0NvTnLkBcotdlp3lKvaT0JrnyRDkzOg==} dependencies: - '@types/node': 12.20.55 + '@types/node': 18.6.3 dev: false /@types/tough-cookie/4.0.2: @@ -2632,13 +2632,13 @@ packages: /@types/tunnel/0.0.1: resolution: {integrity: sha512-AOqu6bQu5MSWwYvehMXLukFHnupHrpZ8nvgae5Ggie9UwzDR1CCwoXgSSWNZJuyOlCdfdsWMA5F2LlmvyoTv8A==} dependencies: - '@types/node': 12.20.55 + '@types/node': 18.6.3 dev: false /@types/tunnel/0.0.3: resolution: {integrity: sha512-sOUTGn6h1SfQ+gbgqC364jLFBw2lnFqkgF3q0WovEHRLMrVD1sd5aufqi/aJObLekJO+Aq5z646U4Oxy6shXMA==} dependencies: - '@types/node': 12.20.55 + '@types/node': 18.6.3 dev: false /@types/underscore/1.11.4: @@ -2656,19 +2656,19 @@ packages: /@types/ws/7.4.7: resolution: {integrity: sha512-JQbbmxZTZehdc2iszGKs5oC3NFnjeay7mtAWrdt7qNtAVK0g19muApzAy4bm9byz79xa2ZnO/BOBC2R8RC5Lww==} dependencies: - '@types/node': 12.20.55 + '@types/node': 18.6.3 dev: false /@types/ws/8.5.3: resolution: {integrity: sha512-6YOoWjruKj1uLf3INHH7D3qTXwFfEsg1kf3c0uDdSBJwfa/llkwIjrAGV7j7mVgGNbzTQ3HiHKKDXl6bJPD97w==} dependencies: - '@types/node': 12.20.55 + '@types/node': 18.6.3 dev: false /@types/xml2js/0.4.11: resolution: {integrity: sha512-JdigeAKmCyoJUiQljjr7tQG3if9NkqGUgwEUqBvV0N7LM4HyQk7UXCnusRa1lnvXAEYJ8mw8GtZWioagNztOwA==} dependencies: - '@types/node': 12.20.55 + '@types/node': 18.6.3 dev: false /@types/yargs-parser/21.0.0: @@ -2685,7 +2685,7 @@ packages: resolution: {integrity: sha512-Cn6WYCm0tXv8p6k+A8PvbDG763EDpBoTzHdA+Q/MF6H3sapGjCm9NzoaJncJS9tUKSuCoDs9XHxYYsQDgxR6kw==} requiresBuild: true dependencies: - '@types/node': 12.20.55 + '@types/node': 18.6.3 dev: false optional: true @@ -3003,7 +3003,7 @@ packages: dev: false /array-flatten/1.1.1: - resolution: {integrity: sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg==} + resolution: {integrity: sha1-ml9pkFGx5wczKPKgCJaLZOopVdI=} dev: false /array-includes/3.1.5: @@ -3252,7 +3252,7 @@ packages: dev: false /buffer-equal-constant-time/1.0.1: - resolution: {integrity: sha512-zRpUiDwd/xk6ADqPMATG8vc9VPrkck7T07OIx0gnjmJAnHnTVXNQG3vfvWNuiZIkwu9KrKdA1iJKfsfTVxE6NA==} + resolution: {integrity: sha1-+OcRMvf/5uAaXJaXpMbz5I1cyBk=} dev: false /buffer-from/1.1.2: @@ -3397,7 +3397,7 @@ packages: dev: false /charenc/0.0.2: - resolution: {integrity: sha512-yrLQ/yVUFXkzg7EDQsPieE/53+0RlaWTs+wBrvW36cyilJ2SaDWfl4Yj7MtLTXleV9uEKefbAGUPv2/iWSooRA==} + resolution: {integrity: sha1-wKHS86cJLgN3S/qD8UwPxXkKhmc=} dev: false /check-error/1.0.2: @@ -3535,7 +3535,7 @@ packages: dev: false /concat-map/0.0.1: - resolution: {integrity: sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==} + resolution: {integrity: sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=} dev: false /concurrently/6.5.1: @@ -3598,7 +3598,7 @@ packages: dev: false /cookie-signature/1.0.6: - resolution: {integrity: sha512-QADzlaHc8icV8I7vbaJXJwod9HWYp8uCqf1xa4OfNu1T7JVxQIrUgOWtHdNDtPiywmFbiS12VjotIXLrKM3orQ==} + resolution: {integrity: sha1-4wOogrNCzD7oylE6eZmXNNqzriw=} dev: false /cookie/0.4.2: @@ -3700,7 +3700,7 @@ packages: dev: false /crypt/0.0.2: - resolution: {integrity: sha512-mCxBlsHFYh9C+HVpiEacem8FEBnMXgU9gy4zmNC+SXAZNB/1idgp/aulFJ4FgCi7GPEVbfyng092GqL2k2rmow==} + resolution: {integrity: sha1-iNf/fsDfuG9xPch7u0LQRNPmxBs=} dev: false /csv-parse/5.3.0: @@ -3742,7 +3742,7 @@ packages: resolution: {integrity: sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==} deprecated: Debug versions >=3.2.0 <3.2.7 || >=4 <4.3.1 have a low-severity ReDos regression when used in a Node.js environment. It is recommended you upgrade to 3.2.7 or 4.3.1. (https://github.com/visionmedia/debug/issues/797) dependencies: - ms: 2.1.1 + ms: 2.1.3 dev: false /debug/3.2.7: @@ -3943,7 +3943,7 @@ packages: dependencies: semver: 7.3.7 shelljs: 0.8.5 - typescript: 4.6.4 + typescript: 4.7.4 dev: false /ecdsa-sig-formatter/1.0.11: @@ -3953,11 +3953,11 @@ packages: dev: false /edge-launcher/1.2.2: - resolution: {integrity: sha512-JcD5WBi3BHZXXVSSeEhl6sYO8g5cuynk/hifBzds2Bp4JdzCGLNMHgMCKu5DvrO1yatMgF0goFsxXRGus0yh1g==} + resolution: {integrity: sha1-60Cq+9Bnpup27/+rBke81VCbN7I=} dev: false /ee-first/1.1.1: - resolution: {integrity: sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==} + resolution: {integrity: sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=} dev: false /electron-to-chromium/1.4.206: @@ -3994,7 +3994,7 @@ packages: dependencies: '@types/cookie': 0.4.1 '@types/cors': 2.8.12 - '@types/node': 12.20.55 + '@types/node': 18.6.3 accepts: 1.3.8 base64id: 2.0.0 cookie: 0.4.2 @@ -4838,7 +4838,7 @@ packages: dev: false /fresh/0.5.2: - resolution: {integrity: sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q==} + resolution: {integrity: sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac=} engines: {node: '>= 0.6'} dev: false @@ -4978,7 +4978,7 @@ packages: dev: false /github-from-package/0.0.0: - resolution: {integrity: sha512-SyHy3T1v2NUXn29OsWdxmK6RwHD+vkj3v8en8AOBZ1wBQ/hCAQ5bAQTD02kW4W9tUp/3Qh6J8r9EvntiyCmOOw==} + resolution: {integrity: sha1-l/tdlr/eiXMxPyDoKI75oWf6ZM4=} dev: false /glob-parent/5.1.2: @@ -5005,7 +5005,7 @@ packages: fs.realpath: 1.0.0 inflight: 1.0.6 inherits: 2.0.4 - minimatch: 3.0.4 + minimatch: 3.1.2 once: 1.4.0 path-is-absolute: 1.0.1 dev: false @@ -6360,7 +6360,7 @@ packages: dev: false /media-typer/0.3.0: - resolution: {integrity: sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ==} + resolution: {integrity: sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g=} engines: {node: '>= 0.6'} dev: false @@ -6370,7 +6370,7 @@ packages: dev: false /merge-descriptors/1.0.1: - resolution: {integrity: sha512-cCi6g3/Zr1iqQi6ySbseM1Xvooa98N0w31jzUYrXPX2xqObmFGHJ0tQ5u74H3mVh7wLouTseZyYIq39g8cNp1w==} + resolution: {integrity: sha1-sAqqVW3YtEVoFQ7J0blT8/kMu2E=} dev: false /merge-source-map/1.1.0: @@ -6730,7 +6730,7 @@ packages: dev: false /noms/0.0.0: - resolution: {integrity: sha512-lNDU9VJaOPxUmXcLb+HQFeUgQQPtMI24Gt6hgfuMHRJgMRHMF/qZ4HJD3GDru4sSw9IQl2jPjAYnQrdIeLbwow==} + resolution: {integrity: sha1-2o69nzr51nYJGbJ9nNyAkqczKFk=} dependencies: inherits: 2.0.4 readable-stream: 1.0.34 @@ -8512,6 +8512,37 @@ packages: yn: 3.1.1 dev: false + /ts-node/10.9.1_8977ea9f10e86dfb77a849a356941236: + resolution: {integrity: sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw==} + hasBin: true + peerDependencies: + '@swc/core': '>=1.2.50' + '@swc/wasm': '>=1.2.50' + '@types/node': '*' + typescript: '>=2.7' + peerDependenciesMeta: + '@swc/core': + optional: true + '@swc/wasm': + optional: true + dependencies: + '@cspotcode/source-map-support': 0.8.1 + '@tsconfig/node10': 1.0.9 + '@tsconfig/node12': 1.0.11 + '@tsconfig/node14': 1.0.3 + '@tsconfig/node16': 1.0.3 + '@types/node': 12.20.55 + acorn: 8.8.0 + acorn-walk: 8.2.0 + arg: 4.1.3 + create-require: 1.1.1 + diff: 4.0.2 + make-error: 1.3.6 + typescript: 4.7.4 + v8-compile-cache-lib: 3.0.1 + yn: 3.1.1 + dev: false + /ts-node/10.9.1_b5bd4a8e238709e15d0171692055b18b: resolution: {integrity: sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw==} hasBin: true @@ -8809,7 +8840,7 @@ packages: dev: false /utils-merge/1.0.1: - resolution: {integrity: sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA==} + resolution: {integrity: sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM=} engines: {node: '>= 0.4.0'} dev: false @@ -15400,7 +15431,7 @@ packages: dev: false file:projects/core-rest-pipeline.tgz: - resolution: {integrity: sha512-ogCKDnbP8OQA8XUr8szudiw3+MbWGrNX5uHd0a3X3EZuzFBJ2HGWCn+ohVXDw1MZxZulZx3I1bDqXKJwD4oTIQ==, tarball: file:projects/core-rest-pipeline.tgz} + resolution: {integrity: sha512-dp1y1R8lXpYJrG3Iku357FjtIDUpeMOK34fyqvSF/e9WiMXmYDfESvJS8I9/bahiCtp5Jt0wOKJ1ku1XD2LI/Q==, tarball: file:projects/core-rest-pipeline.tgz} name: '@rush-temp/core-rest-pipeline' version: 0.0.0 dependencies: @@ -15439,11 +15470,14 @@ packages: rimraf: 3.0.2 sinon: 9.2.4 source-map-support: 0.5.21 + ts-node: 10.9.1_8977ea9f10e86dfb77a849a356941236 tslib: 2.4.0 - typescript: 4.6.4 + typescript: 4.7.4 util: 0.12.4 uuid: 8.3.2 transitivePeerDependencies: + - '@swc/core' + - '@swc/wasm' - bufferutil - debug - encoding diff --git a/sdk/core/core-rest-pipeline/package.json b/sdk/core/core-rest-pipeline/package.json index 5b681f55cab6..720df5cb9ebd 100644 --- a/sdk/core/core-rest-pipeline/package.json +++ b/sdk/core/core-rest-pipeline/package.json @@ -55,7 +55,7 @@ "test:node": "npm run clean && tsc -p . && npm run unit-test:node && npm run integration-test:node", "test": "npm run clean && tsc -p . && npm run unit-test:node && dev-tool run bundle --output-cjs-ext=true && npm run unit-test:browser && npm run integration-test", "unit-test:browser": "karma start --single-run", - "unit-test:node": "mocha -r esm -r ts-node/register --reporter ../../../common/tools/mocha-multi-reporter.js --timeout 1200000 --full-trace --exclude \"test/**/browser/*.spec.ts\" \"test/**/*.spec.ts\"", + "unit-test:node": "mocha -r ts-node/register --reporter ../../../common/tools/mocha-multi-reporter.js --timeout 1200000 --full-trace --exclude \"test/**/browser/*.spec.ts\" \"test/**/*.spec.ts\"", "unit-test": "npm run unit-test:node && npm run unit-test:browser" }, "files": [ @@ -141,9 +141,13 @@ "rimraf": "^3.0.0", "sinon": "^9.0.2", "source-map-support": "^0.5.9", - "typescript": "~4.6.0", + "ts-node": "^10.0.0", + "typescript": "~4.7.0", "util": "^0.12.1" }, + "mocha": { + "loader": "ts-node/esm" + }, "//sampleConfiguration": { "skipFolder": true, "disableDocsMs": true, diff --git a/sdk/core/core-rest-pipeline/src/createPipelineFromOptions.ts b/sdk/core/core-rest-pipeline/src/createPipelineFromOptions.ts index 4c94f4409c98..b8501be470ea 100644 --- a/sdk/core/core-rest-pipeline/src/createPipelineFromOptions.ts +++ b/sdk/core/core-rest-pipeline/src/createPipelineFromOptions.ts @@ -1,21 +1,21 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import { LogPolicyOptions, logPolicy } from "./policies/logPolicy"; -import { Pipeline, createEmptyPipeline } from "./pipeline"; -import { PipelineRetryOptions, TlsSettings } from "./interfaces"; -import { RedirectPolicyOptions, redirectPolicy } from "./policies/redirectPolicy"; -import { UserAgentPolicyOptions, userAgentPolicy } from "./policies/userAgentPolicy"; +import { LogPolicyOptions, logPolicy } from "./policies/logPolicy.js"; +import { Pipeline, createEmptyPipeline } from "./pipeline.js"; +import { PipelineRetryOptions, TlsSettings } from "./interfaces.js"; +import { RedirectPolicyOptions, redirectPolicy } from "./policies/redirectPolicy.js"; +import { UserAgentPolicyOptions, userAgentPolicy } from "./policies/userAgentPolicy.js"; -import { ProxySettings } from "."; -import { decompressResponsePolicy } from "./policies/decompressResponsePolicy"; -import { defaultRetryPolicy } from "./policies/defaultRetryPolicy"; -import { formDataPolicy } from "./policies/formDataPolicy"; +import { ProxySettings } from "./interfaces.js"; +import { decompressResponsePolicy } from "./policies/decompressResponsePolicy.js"; +import { defaultRetryPolicy } from "./policies/defaultRetryPolicy.js"; +import { formDataPolicy } from "./policies/formDataPolicy.js"; import { isNode } from "@azure/core-util"; -import { proxyPolicy } from "./policies/proxyPolicy"; -import { setClientRequestIdPolicy } from "./policies/setClientRequestIdPolicy"; -import { tlsPolicy } from "./policies/tlsPolicy"; -import { tracingPolicy } from "./policies/tracingPolicy"; +import { proxyPolicy } from "./policies/proxyPolicy.js"; +import { setClientRequestIdPolicy } from "./policies/setClientRequestIdPolicy.js"; +import { tlsPolicy } from "./policies/tlsPolicy.js"; +import { tracingPolicy } from "./policies/tracingPolicy.js"; /** * Defines options that are used to configure the HTTP pipeline for diff --git a/sdk/core/core-rest-pipeline/src/defaultHttpClient.browser.ts b/sdk/core/core-rest-pipeline/src/defaultHttpClient.browser.ts index bc90779365aa..4d8ac42e889f 100644 --- a/sdk/core/core-rest-pipeline/src/defaultHttpClient.browser.ts +++ b/sdk/core/core-rest-pipeline/src/defaultHttpClient.browser.ts @@ -1,8 +1,8 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import { HttpClient } from "./interfaces"; -import { createFetchHttpClient } from "./fetchHttpClient"; +import { HttpClient } from "./interfaces.js"; +import { createFetchHttpClient } from "./fetchHttpClient.js"; /** * Create the correct HttpClient for the current environment. diff --git a/sdk/core/core-rest-pipeline/src/defaultHttpClient.native.ts b/sdk/core/core-rest-pipeline/src/defaultHttpClient.native.ts index d9708b80da71..d1085c2bf53b 100644 --- a/sdk/core/core-rest-pipeline/src/defaultHttpClient.native.ts +++ b/sdk/core/core-rest-pipeline/src/defaultHttpClient.native.ts @@ -1,8 +1,8 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import { HttpClient } from "./interfaces"; -import { createXhrHttpClient } from "./xhrHttpClient"; +import { HttpClient } from "./interfaces.js"; +import { createXhrHttpClient } from "./xhrHttpClient.js"; /** * Create the correct HttpClient for the current environment. diff --git a/sdk/core/core-rest-pipeline/src/defaultHttpClient.ts b/sdk/core/core-rest-pipeline/src/defaultHttpClient.ts index 9b5def081c74..721e3a2aa750 100644 --- a/sdk/core/core-rest-pipeline/src/defaultHttpClient.ts +++ b/sdk/core/core-rest-pipeline/src/defaultHttpClient.ts @@ -1,8 +1,8 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import { HttpClient } from "./interfaces"; -import { createNodeHttpClient } from "./nodeHttpClient"; +import { HttpClient } from "./interfaces.js"; +import { createNodeHttpClient } from "./nodeHttpClient.js"; /** * Create the correct HttpClient for the current environment. diff --git a/sdk/core/core-rest-pipeline/src/fetchHttpClient.ts b/sdk/core/core-rest-pipeline/src/fetchHttpClient.ts index 17e90b60e0f9..ee38b9978463 100644 --- a/sdk/core/core-rest-pipeline/src/fetchHttpClient.ts +++ b/sdk/core/core-rest-pipeline/src/fetchHttpClient.ts @@ -8,9 +8,9 @@ import { PipelineRequest, PipelineResponse, TransferProgressEvent, -} from "./interfaces"; -import { RestError } from "./restError"; -import { createHttpHeaders } from "./httpHeaders"; +} from "./interfaces.js"; +import { RestError } from "./restError.js"; +import { createHttpHeaders } from "./httpHeaders.js"; /** * Checks if the body is a NodeReadable stream which is not supported in Browsers diff --git a/sdk/core/core-rest-pipeline/src/httpHeaders.ts b/sdk/core/core-rest-pipeline/src/httpHeaders.ts index f00b99b18886..3f94d16026c1 100644 --- a/sdk/core/core-rest-pipeline/src/httpHeaders.ts +++ b/sdk/core/core-rest-pipeline/src/httpHeaders.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import { HttpHeaders, RawHttpHeaders, RawHttpHeadersInput } from "./interfaces"; +import { HttpHeaders, RawHttpHeaders, RawHttpHeadersInput } from "./interfaces.js"; interface HeaderEntry { name: string; diff --git a/sdk/core/core-rest-pipeline/src/index.ts b/sdk/core/core-rest-pipeline/src/index.ts index 516e34327dab..93718a3fde42 100644 --- a/sdk/core/core-rest-pipeline/src/index.ts +++ b/sdk/core/core-rest-pipeline/src/index.ts @@ -20,64 +20,72 @@ export { SendRequest, TlsSettings, TransferProgressEvent, -} from "./interfaces"; +} from "./interfaces.js"; export { AddPolicyOptions as AddPipelineOptions, PipelinePhase, PipelinePolicy, Pipeline, createEmptyPipeline, -} from "./pipeline"; +} from "./pipeline.js"; export { createPipelineFromOptions, InternalPipelineOptions, PipelineOptions, -} from "./createPipelineFromOptions"; -export { createDefaultHttpClient } from "./defaultHttpClient"; -export { createHttpHeaders } from "./httpHeaders"; -export { createPipelineRequest, PipelineRequestOptions } from "./pipelineRequest"; -export { RestError, RestErrorOptions, isRestError } from "./restError"; +} from "./createPipelineFromOptions.js"; +export { createDefaultHttpClient } from "./defaultHttpClient.js"; +export { createHttpHeaders } from "./httpHeaders.js"; +export { createPipelineRequest, PipelineRequestOptions } from "./pipelineRequest.js"; +export { RestError, RestErrorOptions, isRestError } from "./restError.js"; export { decompressResponsePolicy, decompressResponsePolicyName, -} from "./policies/decompressResponsePolicy"; +} from "./policies/decompressResponsePolicy.js"; export { exponentialRetryPolicy, ExponentialRetryPolicyOptions, exponentialRetryPolicyName, -} from "./policies/exponentialRetryPolicy"; +} from "./policies/exponentialRetryPolicy.js"; export { setClientRequestIdPolicy, setClientRequestIdPolicyName, -} from "./policies/setClientRequestIdPolicy"; -export { logPolicy, logPolicyName, LogPolicyOptions } from "./policies/logPolicy"; -export { proxyPolicy, proxyPolicyName, getDefaultProxySettings } from "./policies/proxyPolicy"; +} from "./policies/setClientRequestIdPolicy.js"; +export { logPolicy, logPolicyName, LogPolicyOptions } from "./policies/logPolicy.js"; +export { proxyPolicy, proxyPolicyName, getDefaultProxySettings } from "./policies/proxyPolicy.js"; export { redirectPolicy, redirectPolicyName, RedirectPolicyOptions, -} from "./policies/redirectPolicy"; +} from "./policies/redirectPolicy.js"; export { systemErrorRetryPolicy, SystemErrorRetryPolicyOptions, systemErrorRetryPolicyName, -} from "./policies/systemErrorRetryPolicy"; +} from "./policies/systemErrorRetryPolicy.js"; export { throttlingRetryPolicy, throttlingRetryPolicyName, ThrottlingRetryPolicyOptions, -} from "./policies/throttlingRetryPolicy"; -export { retryPolicy, RetryPolicyOptions } from "./policies/retryPolicy"; -export { RetryStrategy, RetryInformation, RetryModifiers } from "./retryStrategies/retryStrategy"; -export { tracingPolicy, tracingPolicyName, TracingPolicyOptions } from "./policies/tracingPolicy"; -export { defaultRetryPolicy, DefaultRetryPolicyOptions } from "./policies/defaultRetryPolicy"; +} from "./policies/throttlingRetryPolicy.js"; +export { retryPolicy, RetryPolicyOptions } from "./policies/retryPolicy.js"; +export { + RetryStrategy, + RetryInformation, + RetryModifiers, +} from "./retryStrategies/retryStrategy.js"; +export { + tracingPolicy, + tracingPolicyName, + TracingPolicyOptions, +} from "./policies/tracingPolicy.js"; +export { defaultRetryPolicy, DefaultRetryPolicyOptions } from "./policies/defaultRetryPolicy.js"; export { userAgentPolicy, userAgentPolicyName, UserAgentPolicyOptions, -} from "./policies/userAgentPolicy"; -export { tlsPolicy, tlsPolicyName } from "./policies/tlsPolicy"; -export { formDataPolicy, formDataPolicyName } from "./policies/formDataPolicy"; +} from "./policies/userAgentPolicy.js"; +export { tlsPolicy, tlsPolicyName } from "./policies/tlsPolicy.js"; +export { formDataPolicy, formDataPolicyName } from "./policies/formDataPolicy.js"; export { bearerTokenAuthenticationPolicy, BearerTokenAuthenticationPolicyOptions, @@ -85,5 +93,5 @@ export { ChallengeCallbacks, AuthorizeRequestOptions, AuthorizeRequestOnChallengeOptions, -} from "./policies/bearerTokenAuthenticationPolicy"; -export { ndJsonPolicy, ndJsonPolicyName } from "./policies/ndJsonPolicy"; +} from "./policies/bearerTokenAuthenticationPolicy.js"; +export { ndJsonPolicy, ndJsonPolicyName } from "./policies/ndJsonPolicy.js"; diff --git a/sdk/core/core-rest-pipeline/src/nodeHttpClient.ts b/sdk/core/core-rest-pipeline/src/nodeHttpClient.ts index 95361609847d..94f9b12786df 100644 --- a/sdk/core/core-rest-pipeline/src/nodeHttpClient.ts +++ b/sdk/core/core-rest-pipeline/src/nodeHttpClient.ts @@ -14,11 +14,11 @@ import { RequestBodyType, TlsSettings, TransferProgressEvent, -} from "./interfaces"; -import { createHttpHeaders } from "./httpHeaders"; -import { RestError } from "./restError"; +} from "./interfaces.js"; +import { createHttpHeaders } from "./httpHeaders.js"; +import { RestError } from "./restError.js"; import { IncomingMessage } from "http"; -import { logger } from "./log"; +import { logger } from "./log.js"; const DEFAULT_TLS_SETTINGS = {}; diff --git a/sdk/core/core-rest-pipeline/src/pipeline.ts b/sdk/core/core-rest-pipeline/src/pipeline.ts index 717d13b7aa92..c0262f27c18e 100644 --- a/sdk/core/core-rest-pipeline/src/pipeline.ts +++ b/sdk/core/core-rest-pipeline/src/pipeline.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import { HttpClient, PipelineRequest, PipelineResponse, SendRequest } from "./interfaces"; +import { HttpClient, PipelineRequest, PipelineResponse, SendRequest } from "./interfaces.js"; /** * Policies are executed in phases. diff --git a/sdk/core/core-rest-pipeline/src/pipelineRequest.ts b/sdk/core/core-rest-pipeline/src/pipelineRequest.ts index 9cdd6062eeb4..5d0709519b83 100644 --- a/sdk/core/core-rest-pipeline/src/pipelineRequest.ts +++ b/sdk/core/core-rest-pipeline/src/pipelineRequest.ts @@ -9,10 +9,10 @@ import { ProxySettings, RequestBodyType, TransferProgressEvent, -} from "./interfaces"; -import { createHttpHeaders } from "./httpHeaders"; +} from "./interfaces.js"; +import { createHttpHeaders } from "./httpHeaders.js"; import { AbortSignalLike } from "@azure/abort-controller"; -import { generateUuid } from "./util/uuid"; +import { generateUuid } from "./util/uuid.js"; import { OperationTracingOptions } from "@azure/core-tracing"; /** diff --git a/sdk/core/core-rest-pipeline/src/policies/bearerTokenAuthenticationPolicy.ts b/sdk/core/core-rest-pipeline/src/policies/bearerTokenAuthenticationPolicy.ts index c8b374a9e801..605bbd79898e 100644 --- a/sdk/core/core-rest-pipeline/src/policies/bearerTokenAuthenticationPolicy.ts +++ b/sdk/core/core-rest-pipeline/src/policies/bearerTokenAuthenticationPolicy.ts @@ -3,10 +3,10 @@ import { AccessToken, GetTokenOptions, TokenCredential } from "@azure/core-auth"; import { AzureLogger } from "@azure/logger"; -import { PipelineRequest, PipelineResponse, SendRequest } from "../interfaces"; -import { PipelinePolicy } from "../pipeline"; -import { createTokenCycler } from "../util/tokenCycler"; -import { logger as coreLogger } from "../log"; +import { PipelineRequest, PipelineResponse, SendRequest } from "../interfaces.js"; +import { PipelinePolicy } from "../pipeline.js"; +import { createTokenCycler } from "../util/tokenCycler.js"; +import { logger as coreLogger } from "../log.js"; /** * The programmatic identifier of the bearerTokenAuthenticationPolicy. diff --git a/sdk/core/core-rest-pipeline/src/policies/decompressResponsePolicy.ts b/sdk/core/core-rest-pipeline/src/policies/decompressResponsePolicy.ts index f52a2d2fdcb2..53ff3d9a4ea4 100644 --- a/sdk/core/core-rest-pipeline/src/policies/decompressResponsePolicy.ts +++ b/sdk/core/core-rest-pipeline/src/policies/decompressResponsePolicy.ts @@ -1,8 +1,8 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import { PipelineRequest, PipelineResponse, SendRequest } from "../interfaces"; -import { PipelinePolicy } from "../pipeline"; +import { PipelineRequest, PipelineResponse, SendRequest } from "../interfaces.js"; +import { PipelinePolicy } from "../pipeline.js"; /** * The programmatic identifier of the decompressResponsePolicy. diff --git a/sdk/core/core-rest-pipeline/src/policies/defaultRetryPolicy.ts b/sdk/core/core-rest-pipeline/src/policies/defaultRetryPolicy.ts index 90fce25ceddb..66c62aada6f6 100644 --- a/sdk/core/core-rest-pipeline/src/policies/defaultRetryPolicy.ts +++ b/sdk/core/core-rest-pipeline/src/policies/defaultRetryPolicy.ts @@ -1,12 +1,12 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import { PipelineRetryOptions } from "../interfaces"; -import { PipelinePolicy } from "../pipeline"; -import { exponentialRetryStrategy } from "../retryStrategies/exponentialRetryStrategy"; -import { throttlingRetryStrategy } from "../retryStrategies/throttlingRetryStrategy"; -import { retryPolicy } from "./retryPolicy"; -import { DEFAULT_RETRY_POLICY_COUNT } from "../constants"; +import { PipelineRetryOptions } from "../interfaces.js"; +import { PipelinePolicy } from "../pipeline.js"; +import { exponentialRetryStrategy } from "../retryStrategies/exponentialRetryStrategy.js"; +import { throttlingRetryStrategy } from "../retryStrategies/throttlingRetryStrategy.js"; +import { retryPolicy } from "./retryPolicy.js"; +import { DEFAULT_RETRY_POLICY_COUNT } from "../constants.js"; /** * Name of the {@link defaultRetryPolicy} diff --git a/sdk/core/core-rest-pipeline/src/policies/exponentialRetryPolicy.ts b/sdk/core/core-rest-pipeline/src/policies/exponentialRetryPolicy.ts index d1b703865bb4..dd813300b3ef 100644 --- a/sdk/core/core-rest-pipeline/src/policies/exponentialRetryPolicy.ts +++ b/sdk/core/core-rest-pipeline/src/policies/exponentialRetryPolicy.ts @@ -1,10 +1,10 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import { PipelinePolicy } from "../pipeline"; -import { exponentialRetryStrategy } from "../retryStrategies/exponentialRetryStrategy"; -import { retryPolicy } from "./retryPolicy"; -import { DEFAULT_RETRY_POLICY_COUNT } from "../constants"; +import { PipelinePolicy } from "../pipeline.js"; +import { exponentialRetryStrategy } from "../retryStrategies/exponentialRetryStrategy.js"; +import { retryPolicy } from "./retryPolicy.js"; +import { DEFAULT_RETRY_POLICY_COUNT } from "../constants.js"; /** * The programmatic identifier of the exponentialRetryPolicy. diff --git a/sdk/core/core-rest-pipeline/src/policies/formDataPolicy.browser.ts b/sdk/core/core-rest-pipeline/src/policies/formDataPolicy.browser.ts index b8920bf9cbf5..099266eb2ab2 100644 --- a/sdk/core/core-rest-pipeline/src/policies/formDataPolicy.browser.ts +++ b/sdk/core/core-rest-pipeline/src/policies/formDataPolicy.browser.ts @@ -1,8 +1,8 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import { PipelineRequest, PipelineResponse, SendRequest } from "../interfaces"; -import { PipelinePolicy } from "../pipeline"; +import { PipelineRequest, PipelineResponse, SendRequest } from "../interfaces.js"; +import { PipelinePolicy } from "../pipeline.js"; /** * The programmatic identifier of the formDataPolicy. diff --git a/sdk/core/core-rest-pipeline/src/policies/formDataPolicy.ts b/sdk/core/core-rest-pipeline/src/policies/formDataPolicy.ts index 1a039bf28e98..9c222abe9e76 100644 --- a/sdk/core/core-rest-pipeline/src/policies/formDataPolicy.ts +++ b/sdk/core/core-rest-pipeline/src/policies/formDataPolicy.ts @@ -2,8 +2,8 @@ // Licensed under the MIT license. import FormData from "form-data"; -import { FormDataMap, PipelineRequest, PipelineResponse, SendRequest } from "../interfaces"; -import { PipelinePolicy } from "../pipeline"; +import { FormDataMap, PipelineRequest, PipelineResponse, SendRequest } from "../interfaces.js"; +import { PipelinePolicy } from "../pipeline.js"; /** * The programmatic identifier of the formDataPolicy. diff --git a/sdk/core/core-rest-pipeline/src/policies/logPolicy.ts b/sdk/core/core-rest-pipeline/src/policies/logPolicy.ts index 2dacedf0aac5..afef356665f4 100644 --- a/sdk/core/core-rest-pipeline/src/policies/logPolicy.ts +++ b/sdk/core/core-rest-pipeline/src/policies/logPolicy.ts @@ -2,10 +2,10 @@ // Licensed under the MIT license. import { Debugger } from "@azure/logger"; -import { PipelineRequest, PipelineResponse, SendRequest } from "../interfaces"; -import { PipelinePolicy } from "../pipeline"; -import { logger as coreLogger } from "../log"; -import { Sanitizer } from "../util/sanitizer"; +import { PipelineRequest, PipelineResponse, SendRequest } from "../interfaces.js"; +import { PipelinePolicy } from "../pipeline.js"; +import { logger as coreLogger } from "../log.js"; +import { Sanitizer } from "../util/sanitizer.js"; /** * The programmatic identifier of the logPolicy. diff --git a/sdk/core/core-rest-pipeline/src/policies/ndJsonPolicy.ts b/sdk/core/core-rest-pipeline/src/policies/ndJsonPolicy.ts index 04d035c93189..79a646c4f12b 100644 --- a/sdk/core/core-rest-pipeline/src/policies/ndJsonPolicy.ts +++ b/sdk/core/core-rest-pipeline/src/policies/ndJsonPolicy.ts @@ -1,8 +1,8 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import { PipelineRequest, PipelineResponse, SendRequest } from "../interfaces"; -import { PipelinePolicy } from "../pipeline"; +import { PipelineRequest, PipelineResponse, SendRequest } from "../interfaces.js"; +import { PipelinePolicy } from "../pipeline.js"; /** * The programmatic identifier of the ndJsonPolicy. diff --git a/sdk/core/core-rest-pipeline/src/policies/proxyPolicy.ts b/sdk/core/core-rest-pipeline/src/policies/proxyPolicy.ts index 956923d89413..5e700b36af1c 100644 --- a/sdk/core/core-rest-pipeline/src/policies/proxyPolicy.ts +++ b/sdk/core/core-rest-pipeline/src/policies/proxyPolicy.ts @@ -3,11 +3,13 @@ import * as http from "http"; import * as https from "https"; -import { HttpsProxyAgent, HttpsProxyAgentOptions } from "https-proxy-agent"; -import { HttpProxyAgent, HttpProxyAgentOptions } from "http-proxy-agent"; -import { PipelineRequest, PipelineResponse, ProxySettings, SendRequest } from "../interfaces"; -import { PipelinePolicy } from "../pipeline"; -import { logger } from "../log"; +import httpsPA from "https-proxy-agent"; +const { HttpsProxyAgent } = httpsPA; +import httpPA from "http-proxy-agent"; +const { HttpProxyAgent } = httpPA; +import { PipelineRequest, PipelineResponse, ProxySettings, SendRequest } from "../interfaces.js"; +import { PipelinePolicy } from "../pipeline.js"; +import { logger } from "../log.js"; const HTTPS_PROXY = "HTTPS_PROXY"; const HTTP_PROXY = "HTTP_PROXY"; @@ -132,7 +134,7 @@ export function getDefaultProxySettings(proxyUrl?: string): ProxySettings | unde export function getProxyAgentOptions( proxySettings: ProxySettings, { headers, tlsSettings }: PipelineRequest -): HttpProxyAgentOptions { +): httpPA.HttpProxyAgentOptions { let parsedProxyUrl: URL; try { parsedProxyUrl = new URL(proxySettings.host); @@ -148,7 +150,7 @@ export function getProxyAgentOptions( ); } - const proxyAgentOptions: HttpsProxyAgentOptions = { + const proxyAgentOptions: httpsPA.HttpsProxyAgentOptions = { hostname: parsedProxyUrl.hostname, port: proxySettings.port, protocol: parsedProxyUrl.protocol, diff --git a/sdk/core/core-rest-pipeline/src/policies/redirectPolicy.ts b/sdk/core/core-rest-pipeline/src/policies/redirectPolicy.ts index 36314ee4439e..6933586fd4c9 100644 --- a/sdk/core/core-rest-pipeline/src/policies/redirectPolicy.ts +++ b/sdk/core/core-rest-pipeline/src/policies/redirectPolicy.ts @@ -1,8 +1,8 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import { PipelineRequest, PipelineResponse, SendRequest } from "../interfaces"; -import { PipelinePolicy } from "../pipeline"; +import { PipelineRequest, PipelineResponse, SendRequest } from "../interfaces.js"; +import { PipelinePolicy } from "../pipeline.js"; /** * The programmatic identifier of the redirectPolicy. diff --git a/sdk/core/core-rest-pipeline/src/policies/retryPolicy.ts b/sdk/core/core-rest-pipeline/src/policies/retryPolicy.ts index c04102d44b0c..5ccdac9780aa 100644 --- a/sdk/core/core-rest-pipeline/src/policies/retryPolicy.ts +++ b/sdk/core/core-rest-pipeline/src/policies/retryPolicy.ts @@ -1,15 +1,15 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import { PipelineRequest, PipelineResponse, SendRequest } from "../interfaces"; -import { PipelinePolicy } from "../pipeline"; -import { delay } from "../util/helpers"; +import { PipelineRequest, PipelineResponse, SendRequest } from "../interfaces.js"; +import { PipelinePolicy } from "../pipeline.js"; +import { delay } from "../util/helpers.js"; import { createClientLogger } from "@azure/logger"; -import { RetryStrategy } from "../retryStrategies/retryStrategy"; -import { RestError } from "../restError"; +import { RetryStrategy } from "../retryStrategies/retryStrategy.js"; +import { RestError } from "../restError.js"; import { AbortError } from "@azure/abort-controller"; import { AzureLogger } from "@azure/logger"; -import { DEFAULT_RETRY_POLICY_COUNT } from "../constants"; +import { DEFAULT_RETRY_POLICY_COUNT } from "../constants.js"; const retryPolicyLogger = createClientLogger("core-rest-pipeline retryPolicy"); diff --git a/sdk/core/core-rest-pipeline/src/policies/setClientRequestIdPolicy.ts b/sdk/core/core-rest-pipeline/src/policies/setClientRequestIdPolicy.ts index 564634d77e6c..51a4cabe4f2a 100644 --- a/sdk/core/core-rest-pipeline/src/policies/setClientRequestIdPolicy.ts +++ b/sdk/core/core-rest-pipeline/src/policies/setClientRequestIdPolicy.ts @@ -1,8 +1,8 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import { PipelineRequest, PipelineResponse, SendRequest } from "../interfaces"; -import { PipelinePolicy } from "../pipeline"; +import { PipelineRequest, PipelineResponse, SendRequest } from "../interfaces.js"; +import { PipelinePolicy } from "../pipeline.js"; /** * The programmatic identifier of the setClientRequestIdPolicy. diff --git a/sdk/core/core-rest-pipeline/src/policies/systemErrorRetryPolicy.ts b/sdk/core/core-rest-pipeline/src/policies/systemErrorRetryPolicy.ts index bdf4ae2fd65f..280828100b17 100644 --- a/sdk/core/core-rest-pipeline/src/policies/systemErrorRetryPolicy.ts +++ b/sdk/core/core-rest-pipeline/src/policies/systemErrorRetryPolicy.ts @@ -1,10 +1,10 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import { PipelinePolicy } from "../pipeline"; -import { exponentialRetryStrategy } from "../retryStrategies/exponentialRetryStrategy"; -import { retryPolicy } from "./retryPolicy"; -import { DEFAULT_RETRY_POLICY_COUNT } from "../constants"; +import { PipelinePolicy } from "../pipeline.js"; +import { exponentialRetryStrategy } from "../retryStrategies/exponentialRetryStrategy.js"; +import { retryPolicy } from "./retryPolicy.js"; +import { DEFAULT_RETRY_POLICY_COUNT } from "../constants.js"; /** * Name of the {@link systemErrorRetryPolicy} diff --git a/sdk/core/core-rest-pipeline/src/policies/throttlingRetryPolicy.ts b/sdk/core/core-rest-pipeline/src/policies/throttlingRetryPolicy.ts index 7cf262331a6d..33a6ccf3adf4 100644 --- a/sdk/core/core-rest-pipeline/src/policies/throttlingRetryPolicy.ts +++ b/sdk/core/core-rest-pipeline/src/policies/throttlingRetryPolicy.ts @@ -1,10 +1,10 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import { PipelinePolicy } from "../pipeline"; -import { throttlingRetryStrategy } from "../retryStrategies/throttlingRetryStrategy"; -import { retryPolicy } from "./retryPolicy"; -import { DEFAULT_RETRY_POLICY_COUNT } from "../constants"; +import { PipelinePolicy } from "../pipeline.js"; +import { throttlingRetryStrategy } from "../retryStrategies/throttlingRetryStrategy.js"; +import { retryPolicy } from "./retryPolicy.js"; +import { DEFAULT_RETRY_POLICY_COUNT } from "../constants.js"; /** * Name of the {@link throttlingRetryPolicy} diff --git a/sdk/core/core-rest-pipeline/src/policies/tlsPolicy.ts b/sdk/core/core-rest-pipeline/src/policies/tlsPolicy.ts index efba9098af14..cf85d5c3da40 100644 --- a/sdk/core/core-rest-pipeline/src/policies/tlsPolicy.ts +++ b/sdk/core/core-rest-pipeline/src/policies/tlsPolicy.ts @@ -1,8 +1,8 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import { PipelinePolicy } from "../pipeline"; -import { TlsSettings } from "../interfaces"; +import { PipelinePolicy } from "../pipeline.js"; +import { TlsSettings } from "../interfaces.js"; /** * Name of the TLS Policy diff --git a/sdk/core/core-rest-pipeline/src/policies/tracingPolicy.ts b/sdk/core/core-rest-pipeline/src/policies/tracingPolicy.ts index 098bc93c2b9d..33a7c4c76f04 100644 --- a/sdk/core/core-rest-pipeline/src/policies/tracingPolicy.ts +++ b/sdk/core/core-rest-pipeline/src/policies/tracingPolicy.ts @@ -7,13 +7,13 @@ import { TracingSpan, createTracingClient, } from "@azure/core-tracing"; -import { SDK_VERSION } from "../constants"; -import { PipelineRequest, PipelineResponse, SendRequest } from "../interfaces"; -import { PipelinePolicy } from "../pipeline"; -import { getUserAgentValue } from "../util/userAgent"; -import { logger } from "../log"; +import { SDK_VERSION } from "../constants.js"; +import { PipelineRequest, PipelineResponse, SendRequest } from "../interfaces.js"; +import { PipelinePolicy } from "../pipeline.js"; +import { getUserAgentValue } from "../util/userAgent.js"; +import { logger } from "../log.js"; import { getErrorMessage, isError } from "@azure/core-util"; -import { isRestError } from "../restError"; +import { isRestError } from "../restError.js"; /** * The programmatic identifier of the tracingPolicy. diff --git a/sdk/core/core-rest-pipeline/src/policies/userAgentPolicy.ts b/sdk/core/core-rest-pipeline/src/policies/userAgentPolicy.ts index 0ab8d10e1c55..05871573c1d3 100644 --- a/sdk/core/core-rest-pipeline/src/policies/userAgentPolicy.ts +++ b/sdk/core/core-rest-pipeline/src/policies/userAgentPolicy.ts @@ -1,9 +1,9 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import { PipelineRequest, PipelineResponse, SendRequest } from "../interfaces"; -import { PipelinePolicy } from "../pipeline"; -import { getUserAgentHeaderName, getUserAgentValue } from "../util/userAgent"; +import { PipelineRequest, PipelineResponse, SendRequest } from "../interfaces.js"; +import { PipelinePolicy } from "../pipeline.js"; +import { getUserAgentHeaderName, getUserAgentValue } from "../util/userAgent.js"; const UserAgentHeaderName = getUserAgentHeaderName(); diff --git a/sdk/core/core-rest-pipeline/src/restError.ts b/sdk/core/core-rest-pipeline/src/restError.ts index ff1d26d09f11..f4fb54f68d90 100644 --- a/sdk/core/core-rest-pipeline/src/restError.ts +++ b/sdk/core/core-rest-pipeline/src/restError.ts @@ -2,9 +2,9 @@ // Licensed under the MIT license. import { isError } from "@azure/core-util"; -import { PipelineRequest, PipelineResponse } from "./interfaces"; -import { custom } from "./util/inspect"; -import { Sanitizer } from "./util/sanitizer"; +import { PipelineRequest, PipelineResponse } from "./interfaces.js"; +import { custom } from "./util/inspect.js"; +import { Sanitizer } from "./util/sanitizer.js"; const errorSanitizer = new Sanitizer(); diff --git a/sdk/core/core-rest-pipeline/src/retryStrategies/exponentialRetryStrategy.ts b/sdk/core/core-rest-pipeline/src/retryStrategies/exponentialRetryStrategy.ts index 586e1b0c520d..88a4375c58fa 100644 --- a/sdk/core/core-rest-pipeline/src/retryStrategies/exponentialRetryStrategy.ts +++ b/sdk/core/core-rest-pipeline/src/retryStrategies/exponentialRetryStrategy.ts @@ -1,11 +1,11 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import { PipelineResponse } from "../interfaces"; -import { RestError } from "../restError"; +import { PipelineResponse } from "../interfaces.js"; +import { RestError } from "../restError.js"; import { getRandomIntegerInclusive } from "@azure/core-util"; -import { RetryStrategy } from "./retryStrategy"; -import { isThrottlingRetryResponse } from "./throttlingRetryStrategy"; +import { RetryStrategy } from "./retryStrategy.js"; +import { isThrottlingRetryResponse } from "./throttlingRetryStrategy.js"; // intervals are in milliseconds const DEFAULT_CLIENT_RETRY_INTERVAL = 1000; diff --git a/sdk/core/core-rest-pipeline/src/retryStrategies/retryStrategy.ts b/sdk/core/core-rest-pipeline/src/retryStrategies/retryStrategy.ts index e870b853bca0..0ea36b59016c 100644 --- a/sdk/core/core-rest-pipeline/src/retryStrategies/retryStrategy.ts +++ b/sdk/core/core-rest-pipeline/src/retryStrategies/retryStrategy.ts @@ -2,8 +2,8 @@ // Licensed under the MIT license. import { AzureLogger } from "@azure/logger"; -import { PipelineResponse } from "../interfaces"; -import { RestError } from "../restError"; +import { PipelineResponse } from "../interfaces.js"; +import { RestError } from "../restError.js"; /** * Information provided to the retry strategy about the current progress of the retry policy. diff --git a/sdk/core/core-rest-pipeline/src/retryStrategies/throttlingRetryStrategy.ts b/sdk/core/core-rest-pipeline/src/retryStrategies/throttlingRetryStrategy.ts index b64a14efdc44..df6b03d2369d 100644 --- a/sdk/core/core-rest-pipeline/src/retryStrategies/throttlingRetryStrategy.ts +++ b/sdk/core/core-rest-pipeline/src/retryStrategies/throttlingRetryStrategy.ts @@ -1,9 +1,9 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import { PipelineResponse } from ".."; -import { parseHeaderValueAsNumber } from "../util/helpers"; -import { RetryStrategy } from "./retryStrategy"; +import { PipelineResponse } from "../interfaces.js"; +import { parseHeaderValueAsNumber } from "../util/helpers.js"; +import { RetryStrategy } from "./retryStrategy.js"; /** * The header that comes back from Azure services representing diff --git a/sdk/core/core-rest-pipeline/src/util/helpers.ts b/sdk/core/core-rest-pipeline/src/util/helpers.ts index f4ce9dc64b0b..2f9b2c6cf504 100644 --- a/sdk/core/core-rest-pipeline/src/util/helpers.ts +++ b/sdk/core/core-rest-pipeline/src/util/helpers.ts @@ -2,7 +2,7 @@ // Licensed under the MIT license. import { AbortError, AbortSignalLike } from "@azure/abort-controller"; -import { PipelineResponse } from "../interfaces"; +import { PipelineResponse } from "../interfaces.js"; const StandardAbortMessage = "The operation was aborted."; diff --git a/sdk/core/core-rest-pipeline/src/util/tokenCycler.ts b/sdk/core/core-rest-pipeline/src/util/tokenCycler.ts index 3a7c159ccea7..36f45ab24f9f 100644 --- a/sdk/core/core-rest-pipeline/src/util/tokenCycler.ts +++ b/sdk/core/core-rest-pipeline/src/util/tokenCycler.ts @@ -2,7 +2,7 @@ // Licensed under the MIT license. import { AccessToken, GetTokenOptions, TokenCredential } from "@azure/core-auth"; -import { delay } from "./helpers"; +import { delay } from "./helpers.js"; /** * A function that gets a promise of an access token and allows providing diff --git a/sdk/core/core-rest-pipeline/src/util/userAgent.ts b/sdk/core/core-rest-pipeline/src/util/userAgent.ts index cffde1885d94..af452de2073d 100644 --- a/sdk/core/core-rest-pipeline/src/util/userAgent.ts +++ b/sdk/core/core-rest-pipeline/src/util/userAgent.ts @@ -1,8 +1,8 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import { getHeaderName, setPlatformSpecificData } from "./userAgentPlatform"; -import { SDK_VERSION } from "../constants"; +import { getHeaderName, setPlatformSpecificData } from "./userAgentPlatform.js"; +import { SDK_VERSION } from "../constants.js"; function getUserAgentString(telemetryInfo: Map): string { const parts: string[] = []; diff --git a/sdk/core/core-rest-pipeline/src/xhrHttpClient.ts b/sdk/core/core-rest-pipeline/src/xhrHttpClient.ts index 7895e438a478..944d8f54ba18 100644 --- a/sdk/core/core-rest-pipeline/src/xhrHttpClient.ts +++ b/sdk/core/core-rest-pipeline/src/xhrHttpClient.ts @@ -8,9 +8,9 @@ import { PipelineRequest, PipelineResponse, TransferProgressEvent, -} from "./interfaces"; -import { createHttpHeaders } from "./httpHeaders"; -import { RestError } from "./restError"; +} from "./interfaces.js"; +import { createHttpHeaders } from "./httpHeaders.js"; +import { RestError } from "./restError.js"; function isNodeReadableStream(body: any): body is NodeJS.ReadableStream { return body && typeof body.pipe === "function"; diff --git a/sdk/core/core-rest-pipeline/test/bearerTokenAuthenticationPolicy.spec.ts b/sdk/core/core-rest-pipeline/test/bearerTokenAuthenticationPolicy.spec.ts index d49d2a193b92..8d899e112d44 100644 --- a/sdk/core/core-rest-pipeline/test/bearerTokenAuthenticationPolicy.spec.ts +++ b/sdk/core/core-rest-pipeline/test/bearerTokenAuthenticationPolicy.spec.ts @@ -11,8 +11,8 @@ import { bearerTokenAuthenticationPolicy, createHttpHeaders, createPipelineRequest, -} from "../src"; -import { DEFAULT_CYCLER_OPTIONS } from "../src/util/tokenCycler"; +} from "../src/index.js"; +import { DEFAULT_CYCLER_OPTIONS } from "../src/util/tokenCycler.js"; const { refreshWindowInMs: defaultRefreshWindow } = DEFAULT_CYCLER_OPTIONS; diff --git a/sdk/core/core-rest-pipeline/test/browser/decompressResponsePolicy.ts b/sdk/core/core-rest-pipeline/test/browser/decompressResponsePolicy.ts index 719f7a2a7817..030251c7fa06 100644 --- a/sdk/core/core-rest-pipeline/test/browser/decompressResponsePolicy.ts +++ b/sdk/core/core-rest-pipeline/test/browser/decompressResponsePolicy.ts @@ -2,7 +2,7 @@ // Licensed under the MIT license. import { assert } from "chai"; -import { decompressResponsePolicy } from "../../src"; +import { decompressResponsePolicy } from "../../src/index.js"; describe("decompressResponsePolicy (browser)", function () { it("Throws on creation", function () { diff --git a/sdk/core/core-rest-pipeline/test/browser/fetchHttpClient.spec.ts b/sdk/core/core-rest-pipeline/test/browser/fetchHttpClient.spec.ts index c97805fcbcd8..bb1ad95ba54b 100644 --- a/sdk/core/core-rest-pipeline/test/browser/fetchHttpClient.spec.ts +++ b/sdk/core/core-rest-pipeline/test/browser/fetchHttpClient.spec.ts @@ -2,13 +2,13 @@ // Licensed under the MIT license. import { assert } from "chai"; -import { createFetchHttpClient } from "../../src/fetchHttpClient"; -import { createPipelineRequest } from "../../src/pipelineRequest"; -import { png } from "./mocks/encodedPng"; +import { createFetchHttpClient } from "../../src/fetchHttpClient.js"; +import { createPipelineRequest } from "../../src/pipelineRequest.js"; +import { png } from "./mocks/encodedPng.js"; import sinon from "sinon"; -import { createHttpHeaders } from "../../src/httpHeaders"; +import { createHttpHeaders } from "../../src/httpHeaders.js"; import { AbortError, AbortSignalLike } from "@azure/abort-controller"; -import { delay } from "../../src/util/helpers"; +import { delay } from "../../src/util/helpers.js"; const streamBody = new ReadableStream({ async start(controller) { diff --git a/sdk/core/core-rest-pipeline/test/browser/formDataPolicy.spec.ts b/sdk/core/core-rest-pipeline/test/browser/formDataPolicy.spec.ts index 7cea8007f46e..23a28f750b1a 100644 --- a/sdk/core/core-rest-pipeline/test/browser/formDataPolicy.spec.ts +++ b/sdk/core/core-rest-pipeline/test/browser/formDataPolicy.spec.ts @@ -9,7 +9,7 @@ import { createHttpHeaders, createPipelineRequest, formDataPolicy, -} from "../../src"; +} from "../../src/index.js"; describe("formDataPolicy", function () { afterEach(function () { diff --git a/sdk/core/core-rest-pipeline/test/browser/proxyPolicy.spec.ts b/sdk/core/core-rest-pipeline/test/browser/proxyPolicy.spec.ts index 0b47135417cd..8e148ca5132b 100644 --- a/sdk/core/core-rest-pipeline/test/browser/proxyPolicy.spec.ts +++ b/sdk/core/core-rest-pipeline/test/browser/proxyPolicy.spec.ts @@ -2,7 +2,7 @@ // Licensed under the MIT license. import { assert } from "chai"; -import { proxyPolicy } from "../../src"; +import { proxyPolicy } from "../../src/index.js"; describe("proxyPolicy (browser)", function () { it("Throws on creation", function () { diff --git a/sdk/core/core-rest-pipeline/test/defaultRetryPolicy.spec.ts b/sdk/core/core-rest-pipeline/test/defaultRetryPolicy.spec.ts index d4ef9b8cd759..83c3e49b4879 100644 --- a/sdk/core/core-rest-pipeline/test/defaultRetryPolicy.spec.ts +++ b/sdk/core/core-rest-pipeline/test/defaultRetryPolicy.spec.ts @@ -3,8 +3,8 @@ import { assert } from "chai"; import * as sinon from "sinon"; -import { RestError, SendRequest, createPipelineRequest, defaultRetryPolicy } from "../src"; -import { DEFAULT_RETRY_POLICY_COUNT } from "../src/constants"; +import { RestError, SendRequest, createPipelineRequest, defaultRetryPolicy } from "../src/index.js"; +import { DEFAULT_RETRY_POLICY_COUNT } from "../src/constants.js"; describe("defaultRetryPolicy", function () { afterEach(function () { diff --git a/sdk/core/core-rest-pipeline/test/exponentialRetryPolicy.spec.ts b/sdk/core/core-rest-pipeline/test/exponentialRetryPolicy.spec.ts index 9a274c47cf59..4ddd9cedc4d0 100644 --- a/sdk/core/core-rest-pipeline/test/exponentialRetryPolicy.spec.ts +++ b/sdk/core/core-rest-pipeline/test/exponentialRetryPolicy.spec.ts @@ -10,8 +10,8 @@ import { createHttpHeaders, createPipelineRequest, exponentialRetryPolicy, -} from "../src"; -import { DEFAULT_RETRY_POLICY_COUNT } from "../src/constants"; +} from "../src/index.js"; +import { DEFAULT_RETRY_POLICY_COUNT } from "../src/constants.js"; describe("exponentialRetryPolicy", function () { afterEach(function () { diff --git a/sdk/core/core-rest-pipeline/test/httpHeaders.spec.ts b/sdk/core/core-rest-pipeline/test/httpHeaders.spec.ts index 05dd7f8fa74a..b2ca06711109 100644 --- a/sdk/core/core-rest-pipeline/test/httpHeaders.spec.ts +++ b/sdk/core/core-rest-pipeline/test/httpHeaders.spec.ts @@ -2,7 +2,7 @@ // Licensed under the MIT license. import { assert } from "chai"; -import { createHttpHeaders } from "../src/httpHeaders"; +import { createHttpHeaders } from "../src/httpHeaders.js"; describe("HttpHeaders", () => { it("toJSON() should use normalized header names", () => { diff --git a/sdk/core/core-rest-pipeline/test/ndJsonPolicy.spec.ts b/sdk/core/core-rest-pipeline/test/ndJsonPolicy.spec.ts index de5059561630..ab4e4f4e4708 100644 --- a/sdk/core/core-rest-pipeline/test/ndJsonPolicy.spec.ts +++ b/sdk/core/core-rest-pipeline/test/ndJsonPolicy.spec.ts @@ -9,7 +9,7 @@ import { createHttpHeaders, createPipelineRequest, ndJsonPolicy, -} from "../src"; +} from "../src/index.js"; describe("NdJsonPolicy", function () { afterEach(function () { diff --git a/sdk/core/core-rest-pipeline/test/node/bearerTokenAuthenticationPolicyChallenge.spec.ts b/sdk/core/core-rest-pipeline/test/node/bearerTokenAuthenticationPolicyChallenge.spec.ts index 0084f8d6ed78..3607a8c9891e 100644 --- a/sdk/core/core-rest-pipeline/test/node/bearerTokenAuthenticationPolicyChallenge.spec.ts +++ b/sdk/core/core-rest-pipeline/test/node/bearerTokenAuthenticationPolicyChallenge.spec.ts @@ -12,7 +12,7 @@ import { createEmptyPipeline, createHttpHeaders, createPipelineRequest, -} from "../../src"; +} from "../../src/index.js"; import { TextDecoder } from "util"; export interface TestChallenge { diff --git a/sdk/core/core-rest-pipeline/test/node/decompressResponsePolicy.ts b/sdk/core/core-rest-pipeline/test/node/decompressResponsePolicy.ts index 587bb3203278..b49f0c0bae6d 100644 --- a/sdk/core/core-rest-pipeline/test/node/decompressResponsePolicy.ts +++ b/sdk/core/core-rest-pipeline/test/node/decompressResponsePolicy.ts @@ -3,7 +3,7 @@ import { assert } from "chai"; import * as sinon from "sinon"; -import { SendRequest, createPipelineRequest, decompressResponsePolicy } from "../../src"; +import { SendRequest, createPipelineRequest, decompressResponsePolicy } from "../../src/index.js"; describe("decompressResponsePolicy (node)", function () { it("Sets the expected flag on the request", function () { diff --git a/sdk/core/core-rest-pipeline/test/node/formDataPolicy.spec.ts b/sdk/core/core-rest-pipeline/test/node/formDataPolicy.spec.ts index 197fc066a81b..684e50394f7f 100644 --- a/sdk/core/core-rest-pipeline/test/node/formDataPolicy.spec.ts +++ b/sdk/core/core-rest-pipeline/test/node/formDataPolicy.spec.ts @@ -9,7 +9,7 @@ import { createHttpHeaders, createPipelineRequest, formDataPolicy, -} from "../../src"; +} from "../../src/index.js"; describe("formDataPolicy", function () { afterEach(function () { diff --git a/sdk/core/core-rest-pipeline/test/node/getBodyLength.spec.ts b/sdk/core/core-rest-pipeline/test/node/getBodyLength.spec.ts index 97801776f559..5cd1230bd122 100644 --- a/sdk/core/core-rest-pipeline/test/node/getBodyLength.spec.ts +++ b/sdk/core/core-rest-pipeline/test/node/getBodyLength.spec.ts @@ -2,7 +2,7 @@ // Licensed under the MIT license. import { assert } from "chai"; -import { getBodyLength } from "../../src/nodeHttpClient"; +import { getBodyLength } from "../../src/nodeHttpClient.js"; describe("Get Body Length", function () { it("Gets the length of the ASCII string correctly", function () { diff --git a/sdk/core/core-rest-pipeline/test/node/nodeHttpClient.spec.ts b/sdk/core/core-rest-pipeline/test/node/nodeHttpClient.spec.ts index 00606d0fdb37..136bd474ea06 100644 --- a/sdk/core/core-rest-pipeline/test/node/nodeHttpClient.spec.ts +++ b/sdk/core/core-rest-pipeline/test/node/nodeHttpClient.spec.ts @@ -8,7 +8,7 @@ import { ClientRequest, IncomingHttpHeaders, IncomingMessage } from "http"; import * as https from "https"; import * as http from "http"; import { AbortController } from "@azure/abort-controller"; -import { createDefaultHttpClient, createPipelineRequest } from "../../src"; +import { createDefaultHttpClient, createPipelineRequest } from "../../src/index.js"; class FakeResponse extends PassThrough { public statusCode?: number; diff --git a/sdk/core/core-rest-pipeline/test/node/pipeline.spec.ts b/sdk/core/core-rest-pipeline/test/node/pipeline.spec.ts index 4c773f2b4db3..14bf821ce7cf 100644 --- a/sdk/core/core-rest-pipeline/test/node/pipeline.spec.ts +++ b/sdk/core/core-rest-pipeline/test/node/pipeline.spec.ts @@ -4,16 +4,17 @@ import * as http from "https"; import * as https from "https"; -import { proxyPolicy, proxyPolicyName } from "../../src/policies/proxyPolicy"; -import { tlsPolicy, tlsPolicyName } from "../../src/policies/tlsPolicy"; +import { proxyPolicy, proxyPolicyName } from "../../src/policies/proxyPolicy.js"; +import { tlsPolicy, tlsPolicyName } from "../../src/policies/tlsPolicy.js"; -import { HttpClient } from "../../src/interfaces"; -import { HttpsProxyAgent } from "https-proxy-agent"; +import { HttpClient } from "../../src/interfaces.js"; +import httpsPA from "https-proxy-agent"; +const { HttpsProxyAgent } = httpsPA; import { assert } from "chai"; -import { createEmptyPipeline } from "../../src/pipeline"; -import { createHttpHeaders } from "../../src/httpHeaders"; -import { createNodeHttpClient } from "../../src/nodeHttpClient"; -import { createPipelineFromOptions } from "../../src/createPipelineFromOptions"; +import { createEmptyPipeline } from "../../src/pipeline.js"; +import { createHttpHeaders } from "../../src/httpHeaders.js"; +import { createNodeHttpClient } from "../../src/nodeHttpClient.js"; +import { createPipelineFromOptions } from "../../src/createPipelineFromOptions.js"; import sinon from "sinon"; describe("HttpsPipeline", function () { diff --git a/sdk/core/core-rest-pipeline/test/node/proxyPolicy.spec.ts b/sdk/core/core-rest-pipeline/test/node/proxyPolicy.spec.ts index b795cba8c4ab..177467c37b81 100644 --- a/sdk/core/core-rest-pipeline/test/node/proxyPolicy.spec.ts +++ b/sdk/core/core-rest-pipeline/test/node/proxyPolicy.spec.ts @@ -9,12 +9,12 @@ import { createPipelineRequest, getDefaultProxySettings, proxyPolicy, -} from "../../src"; +} from "../../src/index.js"; import { getProxyAgentOptions, globalNoProxyList, loadNoProxy, -} from "../../src/policies/proxyPolicy"; +} from "../../src/policies/proxyPolicy.js"; describe("proxyPolicy (node)", function () { it("Sets proxy settings on the request", function () { diff --git a/sdk/core/core-rest-pipeline/test/node/restError.spec.ts b/sdk/core/core-rest-pipeline/test/node/restError.spec.ts index f316919ae176..70262cb96d48 100644 --- a/sdk/core/core-rest-pipeline/test/node/restError.spec.ts +++ b/sdk/core/core-rest-pipeline/test/node/restError.spec.ts @@ -2,7 +2,12 @@ // Licensed under the MIT license. import { assert } from "chai"; -import { PipelineResponse, RestError, createHttpHeaders, createPipelineRequest } from "../../src"; +import { + PipelineResponse, + RestError, + createHttpHeaders, + createPipelineRequest, +} from "../../src/index.js"; import { inspect } from "util"; describe("RestError", function () { diff --git a/sdk/core/core-rest-pipeline/test/pipeline.spec.ts b/sdk/core/core-rest-pipeline/test/pipeline.spec.ts index bcf5976836d6..8df3659c2ec3 100644 --- a/sdk/core/core-rest-pipeline/test/pipeline.spec.ts +++ b/sdk/core/core-rest-pipeline/test/pipeline.spec.ts @@ -9,7 +9,7 @@ import { createHttpHeaders, createPipelineFromOptions, createPipelineRequest, -} from "../src"; +} from "../src/index.js"; describe("HttpsPipeline", function () { it("Newly created pipeline has no policies", function () { diff --git a/sdk/core/core-rest-pipeline/test/redirectPolicy.spec.ts b/sdk/core/core-rest-pipeline/test/redirectPolicy.spec.ts index 8f608cabec9f..d533ee36fa2d 100644 --- a/sdk/core/core-rest-pipeline/test/redirectPolicy.spec.ts +++ b/sdk/core/core-rest-pipeline/test/redirectPolicy.spec.ts @@ -2,9 +2,14 @@ // Licensed under the MIT license. import { assert } from "chai"; -import { redirectPolicy } from "../src/policies/redirectPolicy"; +import { redirectPolicy } from "../src/policies/redirectPolicy.js"; import * as sinon from "sinon"; -import { PipelineResponse, SendRequest, createHttpHeaders, createPipelineRequest } from "../src"; +import { + PipelineResponse, + SendRequest, + createHttpHeaders, + createPipelineRequest, +} from "../src/index.js"; describe("RedirectPolicy", () => { it("should not follow redirect if no location header", async () => { diff --git a/sdk/core/core-rest-pipeline/test/retryPolicy.spec.ts b/sdk/core/core-rest-pipeline/test/retryPolicy.spec.ts index 7589484801af..8025aaa8074d 100644 --- a/sdk/core/core-rest-pipeline/test/retryPolicy.spec.ts +++ b/sdk/core/core-rest-pipeline/test/retryPolicy.spec.ts @@ -12,8 +12,8 @@ import { createHttpHeaders, createPipelineRequest, retryPolicy, -} from "../src"; -import { DEFAULT_RETRY_POLICY_COUNT } from "../src/constants"; +} from "../src/index.js"; +import { DEFAULT_RETRY_POLICY_COUNT } from "../src/constants.js"; describe("retryPolicy", function () { afterEach(function () { diff --git a/sdk/core/core-rest-pipeline/test/sanitizer.spec.ts b/sdk/core/core-rest-pipeline/test/sanitizer.spec.ts index a00d261f1ec9..b085e74655eb 100644 --- a/sdk/core/core-rest-pipeline/test/sanitizer.spec.ts +++ b/sdk/core/core-rest-pipeline/test/sanitizer.spec.ts @@ -2,7 +2,7 @@ // Licensed under the MIT license. import { assert } from "chai"; -import { Sanitizer } from "../src/util/sanitizer"; +import { Sanitizer } from "../src/util/sanitizer.js"; describe("Sanitizer", function () { it("Redacts query parameters in url properties", function () { diff --git a/sdk/core/core-rest-pipeline/test/systemErrorRetryPolicy.spec.ts b/sdk/core/core-rest-pipeline/test/systemErrorRetryPolicy.spec.ts index f577f26b9ad8..6d726c8447df 100644 --- a/sdk/core/core-rest-pipeline/test/systemErrorRetryPolicy.spec.ts +++ b/sdk/core/core-rest-pipeline/test/systemErrorRetryPolicy.spec.ts @@ -10,8 +10,8 @@ import { createHttpHeaders, createPipelineRequest, systemErrorRetryPolicy, -} from "../src"; -import { DEFAULT_RETRY_POLICY_COUNT } from "../src/constants"; +} from "../src/index.js"; +import { DEFAULT_RETRY_POLICY_COUNT } from "../src/constants.js"; describe("systemErrorRetryPolicy", function () { afterEach(function () { diff --git a/sdk/core/core-rest-pipeline/test/throttlingRetryPolicy.spec.ts b/sdk/core/core-rest-pipeline/test/throttlingRetryPolicy.spec.ts index c2e88b78192c..ec9c038070e2 100644 --- a/sdk/core/core-rest-pipeline/test/throttlingRetryPolicy.spec.ts +++ b/sdk/core/core-rest-pipeline/test/throttlingRetryPolicy.spec.ts @@ -12,9 +12,9 @@ import { createHttpHeaders, createPipelineRequest, throttlingRetryPolicy, -} from "../src"; +} from "../src/index.js"; import { AbortController } from "@azure/abort-controller"; -import { DEFAULT_RETRY_POLICY_COUNT } from "../src/constants"; +import { DEFAULT_RETRY_POLICY_COUNT } from "../src/constants.js"; describe("throttlingRetryPolicy", function () { afterEach(function () { diff --git a/sdk/core/core-rest-pipeline/test/tracingPolicy.spec.ts b/sdk/core/core-rest-pipeline/test/tracingPolicy.spec.ts index 32acd638a67b..5ac62656078d 100644 --- a/sdk/core/core-rest-pipeline/test/tracingPolicy.spec.ts +++ b/sdk/core/core-rest-pipeline/test/tracingPolicy.spec.ts @@ -11,7 +11,7 @@ import { createHttpHeaders, createPipelineRequest, tracingPolicy, -} from "../src"; +} from "../src/index.js"; import { Instrumenter, InstrumenterSpanOptions, From aa393d5d4a1408ab4f5bc25bc46be4fa92bb3f23 Mon Sep 17 00:00:00 2001 From: Jeremy Meng Date: Tue, 2 Aug 2022 00:21:57 +0000 Subject: [PATCH 04/12] bump mocha version to ^10.0.0 --- common/config/rush/pnpm-lock.yaml | 144 ++++++++++++++++++++++- sdk/core/core-rest-pipeline/package.json | 2 +- 2 files changed, 142 insertions(+), 4 deletions(-) diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index 4801d1f4a5a4..d54e9bc49be5 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -2828,6 +2828,10 @@ packages: eslint-visitor-keys: 3.3.0 dev: false + /@ungap/promise-all-settled/1.1.2: + resolution: {integrity: sha512-sL/cEvJWAnClXw0wHk85/2L0G6Sj8UB0Ctc1TEMbKSsmpRosqhwj9gWgFRZSrBr2f9tiXISwNhCPmlfqUqyb9Q==} + dev: false + /abort-controller/3.0.0: resolution: {integrity: sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==} engines: {node: '>=6.5'} @@ -2916,6 +2920,11 @@ packages: engines: {node: '>=6'} dev: false + /ansi-colors/4.1.1: + resolution: {integrity: sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA==} + engines: {node: '>=6'} + dev: false + /ansi-colors/4.1.3: resolution: {integrity: sha512-/6w/C21Pm1A7aZitlI5Ni/2J6FFQN8i1Cvz3kHABAAbw93v/NlvKdVOqz7CCWz/3iv/JplRSEEZ83XION15ovw==} engines: {node: '>=6'} @@ -3320,6 +3329,11 @@ packages: engines: {node: '>=6'} dev: false + /camelcase/6.3.0: + resolution: {integrity: sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==} + engines: {node: '>=10'} + dev: false + /caniuse-lite/1.0.30001373: resolution: {integrity: sha512-pJYArGHrPp3TUqQzFYRmP/lwJlj8RCbVe3Gd3eJQkAV8SAC6b19XS9BjMvRdvaS8RMkaTN8ZhoHP6S1y8zzwEQ==} dev: false @@ -3763,11 +3777,29 @@ packages: ms: 2.1.2 dev: false + /debug/4.3.4_supports-color@8.1.1: + resolution: {integrity: sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==} + engines: {node: '>=6.0'} + peerDependencies: + supports-color: '*' + peerDependenciesMeta: + supports-color: + optional: true + dependencies: + ms: 2.1.2 + supports-color: 8.1.1 + dev: false + /decamelize/1.2.0: resolution: {integrity: sha512-z2S+W9X73hAUUki+N+9Za2lBlun89zigOyGrsax+KUQ6wKW4ZoWpEYBkGhQjwAjjDCkWxhY0VKEhk8wzY7F5cA==} engines: {node: '>=0.10.0'} dev: false + /decamelize/4.0.0: + resolution: {integrity: sha512-9iE1PgSik9HeIIw2JO94IidnE3eBoQrFJ3w7sFuzSX4DpmZ3v5sZpUiV5Swcf6mQEF+Y0ru8Neo+p+nyh2J+hQ==} + engines: {node: '>=10'} + dev: false + /decode-uri-component/0.2.0: resolution: {integrity: sha512-hjf+xovcEn31w/EUYdTXQh/8smFL/dzYjohQGEIgjyNavaJfBY2p5F527Bo1VPATxv0VYTUC2bOcXvqFwk78Og==} engines: {node: '>=0.10'} @@ -3876,6 +3908,11 @@ packages: engines: {node: '>=0.3.1'} dev: false + /diff/5.0.0: + resolution: {integrity: sha512-/VTCrvm5Z0JGty/BWHljh+BAiw3IK+2j87NGMu8Nwc/f48WoDAC395uomO9ZD117ZOBaHmkX1oyLvkVM/aIT3w==} + engines: {node: '>=0.3.1'} + dev: false + /diff/5.1.0: resolution: {integrity: sha512-D+mk+qE8VC/PAUrlAU34N+VfXev0ghe5ywmpqrawphmVZc1bEfn56uo9qpyGp1p4xpzOHkSW4ztBd6L7Xx4ACw==} engines: {node: '>=0.3.1'} @@ -4758,6 +4795,11 @@ packages: is-buffer: 2.0.5 dev: false + /flat/5.0.2: + resolution: {integrity: sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ==} + hasBin: true + dev: false + /flatted/3.2.6: resolution: {integrity: sha512-0sQoMh9s0BYsm+12Huy/rkKxVu4R1+r96YX5cG44rHV0pQ6iC3Q+mkoMFaGWObMFYQxCVT+ssG1ksneA2MI9KQ==} dev: false @@ -5010,6 +5052,17 @@ packages: path-is-absolute: 1.0.1 dev: false + /glob/7.2.0: + resolution: {integrity: sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q==} + dependencies: + fs.realpath: 1.0.0 + inflight: 1.0.6 + inherits: 2.0.4 + minimatch: 3.1.2 + once: 1.4.0 + path-is-absolute: 1.0.1 + dev: false + /glob/7.2.3: resolution: {integrity: sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==} dependencies: @@ -5514,6 +5567,11 @@ packages: engines: {node: '>=0.12.0'} dev: false + /is-plain-obj/2.1.0: + resolution: {integrity: sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA==} + engines: {node: '>=8'} + dev: false + /is-reference/1.2.1: resolution: {integrity: sha512-U82MsXXiFIrjCK4otLT+o2NA2Cd2g5MLoOVXUZjIOhLurrRxpEXzI8O0KZHr3IjLvlAH1kTPYSuqer5T9ZVBKQ==} dependencies: @@ -6467,6 +6525,13 @@ packages: brace-expansion: 1.1.11 dev: false + /minimatch/5.0.1: + resolution: {integrity: sha512-nLDxIFRyhDblz3qMuq+SoRZED4+miJ/G+tdDrjkkkRnjAsBexeGpgjLEQ0blJy7rHhR2b93rhQY4SvyWu9v03g==} + engines: {node: '>=10'} + dependencies: + brace-expansion: 2.0.1 + dev: false + /minimatch/5.1.0: resolution: {integrity: sha512-9TPBGGak4nHfGZsPBohm9AWg6NoT7QTCehS3BIJABslyZbzxfV78QM2Y6+i741OPZIafFAaiiEMh5OyIrJPgtg==} engines: {node: '>=10'} @@ -6515,6 +6580,19 @@ packages: xml: 1.0.1 dev: false + /mocha-junit-reporter/2.0.2_mocha@10.0.0: + resolution: {integrity: sha512-vYwWq5hh3v1lG0gdQCBxwNipBfvDiAM1PHroQRNp96+2l72e9wEUTw+mzoK+O0SudgfQ7WvTQZ9Nh3qkAYAjfg==} + peerDependencies: + mocha: '>=2.2.5' + dependencies: + debug: 2.6.9 + md5: 2.3.0 + mkdirp: 0.5.6 + mocha: 10.0.0 + strip-ansi: 6.0.1 + xml: 1.0.1 + dev: false + /mocha-junit-reporter/2.0.2_mocha@7.2.0: resolution: {integrity: sha512-vYwWq5hh3v1lG0gdQCBxwNipBfvDiAM1PHroQRNp96+2l72e9wEUTw+mzoK+O0SudgfQ7WvTQZ9Nh3qkAYAjfg==} peerDependencies: @@ -6533,6 +6611,35 @@ packages: deprecated: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info. dev: false + /mocha/10.0.0: + resolution: {integrity: sha512-0Wl+elVUD43Y0BqPZBzZt8Tnkw9CMUdNYnUsTfOM1vuhJVZL+kiesFYsqwBkEEuEixaiPe5ZQdqDgX2jddhmoA==} + engines: {node: '>= 14.0.0'} + hasBin: true + dependencies: + '@ungap/promise-all-settled': 1.1.2 + ansi-colors: 4.1.1 + browser-stdout: 1.3.1 + chokidar: 3.5.3 + debug: 4.3.4_supports-color@8.1.1 + diff: 5.0.0 + escape-string-regexp: 4.0.0 + find-up: 5.0.0 + glob: 7.2.0 + he: 1.2.0 + js-yaml: 4.1.0 + log-symbols: 4.1.0 + minimatch: 5.0.1 + ms: 2.1.3 + nanoid: 3.3.3 + serialize-javascript: 6.0.0 + strip-json-comments: 3.1.1 + supports-color: 8.1.1 + workerpool: 6.2.1 + yargs: 16.2.0 + yargs-parser: 20.2.4 + yargs-unparser: 2.0.0 + dev: false + /mocha/7.2.0: resolution: {integrity: sha512-O9CIypScywTVpNaRrCAgoUnJgozpIofjKUYmJhiCIJMiuYnLI6otcb1/kpW9/n/tJODHGZ7i8aLQoDVsMtOKQQ==} engines: {node: '>= 8.10.0'} @@ -6621,6 +6728,12 @@ packages: resolution: {integrity: sha512-UdAqHyFngu7TfQKsCBgAA6pWDkT8MAO7d0jyOecVhN5354xbLqdn8mV9Tat9gepAupm0bt2DbeaSC8vS52MuFA==} dev: false + /nanoid/3.3.3: + resolution: {integrity: sha512-p1sjXuopFs0xg+fPASzQ28agW1oHD7xDsd9Xkf3T15H3c/cifrFHVwrh74PdoklAPi+i7MdRsE47vm2r6JoB+w==} + engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1} + hasBin: true + dev: false + /nanoid/3.3.4: resolution: {integrity: sha512-MqBkQh/OHTS2egovRtLk45wEyNXwF+cokD+1YPf9u5VfJiRdAiRwB2froX5Co9Rh20xs4siNPm8naNotSD6RBw==} engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1} @@ -7887,6 +8000,12 @@ packages: randombytes: 2.1.0 dev: false + /serialize-javascript/6.0.0: + resolution: {integrity: sha512-Qr3TosvguFt8ePWqsvRfrKyQXIiW+nGbYpy8XK24NQHE83caxWt+mIymTT19DGFbNWNLfEwsrkSmN64lVWB9ag==} + dependencies: + randombytes: 2.1.0 + dev: false + /serve-static/1.15.0: resolution: {integrity: sha512-XGuRDNjXUijsUL0vl6nSD7cwURuzEgglbOaFuZM9g3kwDXOWVTck0jLzjPzGD+TazWbboZYu52/9/XPdUgne9g==} engines: {node: '>= 0.8.0'} @@ -8971,6 +9090,10 @@ packages: engines: {node: '>=0.10.0'} dev: false + /workerpool/6.2.1: + resolution: {integrity: sha512-ILEIE97kDZvF9Wb9f6h5aXK4swSlKGUcOEGiIYb2OOu/IrDU9iwj0fD//SsA6E5ibwJxpEvhullJY4Sl4GcpAw==} + dev: false + /wrap-ansi/5.1.0: resolution: {integrity: sha512-QC1/iN/2/RPVJ5jYK8BGttj5z83LmSKmvbvrXPNCLZSEb32KKVDJDl/MOt2N01qU2H/FkzEa9PKto1BqDjtd7Q==} engines: {node: '>=6'} @@ -9135,6 +9258,11 @@ packages: decamelize: 1.2.0 dev: false + /yargs-parser/20.2.4: + resolution: {integrity: sha512-WOkpgNhPTlE73h4VFAFsOnomJVaovO8VqLDzy5saChRBFQFBoMYirowyW+Q9HB4HFF4Z7VZTiG3iSzJJA29yRA==} + engines: {node: '>=10'} + dev: false + /yargs-parser/20.2.9: resolution: {integrity: sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w==} engines: {node: '>=10'} @@ -9154,6 +9282,16 @@ packages: yargs: 13.3.2 dev: false + /yargs-unparser/2.0.0: + resolution: {integrity: sha512-7pRTIA9Qc1caZ0bZ6RYRGbHJthJWuakf+WmHK0rVeLkNrrGhfoabBNdue6kdINI6r4if7ocq9aD/n7xwKOdzOA==} + engines: {node: '>=10'} + dependencies: + camelcase: 6.3.0 + decamelize: 4.0.0 + flat: 5.0.2 + is-plain-obj: 2.1.0 + dev: false + /yargs/13.3.2: resolution: {integrity: sha512-AX3Zw5iPruN5ie6xGRIDgqkT+ZhnRlZMLMHAs8tg7nRruy2Nb+i5o9bwghAogtM08q1dpr2LVoS8KSTMYpWXUw==} dependencies: @@ -15431,7 +15569,7 @@ packages: dev: false file:projects/core-rest-pipeline.tgz: - resolution: {integrity: sha512-dp1y1R8lXpYJrG3Iku357FjtIDUpeMOK34fyqvSF/e9WiMXmYDfESvJS8I9/bahiCtp5Jt0wOKJ1ku1XD2LI/Q==, tarball: file:projects/core-rest-pipeline.tgz} + resolution: {integrity: sha512-94ClQCcj20ya5zFhM4BKL/SfW3IPKLJ67wE2ibmd7AciIywdcXZqAtJSRGZAstynmJcrIr0As5S8RTEHQQ1rZQ==, tarball: file:projects/core-rest-pipeline.tgz} name: '@rush-temp/core-rest-pipeline' version: 0.0.0 dependencies: @@ -15463,8 +15601,8 @@ packages: karma-mocha: 2.0.1 karma-mocha-reporter: 2.2.5_karma@6.4.0 karma-sourcemap-loader: 0.3.8 - mocha: 7.2.0 - mocha-junit-reporter: 2.0.2_mocha@7.2.0 + mocha: 10.0.0 + mocha-junit-reporter: 2.0.2_mocha@10.0.0 prettier: 2.7.1 puppeteer: 14.4.1 rimraf: 3.0.2 diff --git a/sdk/core/core-rest-pipeline/package.json b/sdk/core/core-rest-pipeline/package.json index 720df5cb9ebd..abc14e434efb 100644 --- a/sdk/core/core-rest-pipeline/package.json +++ b/sdk/core/core-rest-pipeline/package.json @@ -135,7 +135,7 @@ "karma-sourcemap-loader": "^0.3.8", "karma": "^6.3.0", "mocha-junit-reporter": "^2.0.0", - "mocha": "^7.1.1", + "mocha": "^10.0.0", "prettier": "^2.5.1", "puppeteer": "^14.0.0", "rimraf": "^3.0.0", From 31632f41cbb963b7a4d9096ca2955a2daaacdc88 Mon Sep 17 00:00:00 2001 From: Jeremy Meng Date: Thu, 4 Aug 2022 17:52:59 +0000 Subject: [PATCH 05/12] - import * as => import - rename karma.conf.js to karma.conf.cjs - update npm scripts --- .../core-rest-pipeline/{karma.conf.js => karma.conf.cjs} | 0 sdk/core/core-rest-pipeline/package.json | 4 ++-- sdk/core/core-rest-pipeline/src/nodeHttpClient.ts | 6 +++--- sdk/core/core-rest-pipeline/src/policies/proxyPolicy.ts | 4 ++-- sdk/core/core-rest-pipeline/src/util/userAgentPlatform.ts | 2 +- .../test/bearerTokenAuthenticationPolicy.spec.ts | 2 +- .../test/browser/formDataPolicy.spec.ts | 2 +- .../core-rest-pipeline/test/defaultRetryPolicy.spec.ts | 2 +- .../test/exponentialRetryPolicy.spec.ts | 2 +- sdk/core/core-rest-pipeline/test/ndJsonPolicy.spec.ts | 2 +- .../node/bearerTokenAuthenticationPolicyChallenge.spec.ts | 2 +- .../test/node/decompressResponsePolicy.ts | 2 +- .../core-rest-pipeline/test/node/formDataPolicy.spec.ts | 2 +- .../core-rest-pipeline/test/node/nodeHttpClient.spec.ts | 8 ++++---- sdk/core/core-rest-pipeline/test/node/pipeline.spec.ts | 4 ++-- sdk/core/core-rest-pipeline/test/node/proxyPolicy.spec.ts | 2 +- sdk/core/core-rest-pipeline/test/redirectPolicy.spec.ts | 2 +- sdk/core/core-rest-pipeline/test/retryPolicy.spec.ts | 2 +- .../test/systemErrorRetryPolicy.spec.ts | 2 +- .../core-rest-pipeline/test/throttlingRetryPolicy.spec.ts | 2 +- sdk/core/core-rest-pipeline/test/tracingPolicy.spec.ts | 2 +- 21 files changed, 28 insertions(+), 28 deletions(-) rename sdk/core/core-rest-pipeline/{karma.conf.js => karma.conf.cjs} (100%) diff --git a/sdk/core/core-rest-pipeline/karma.conf.js b/sdk/core/core-rest-pipeline/karma.conf.cjs similarity index 100% rename from sdk/core/core-rest-pipeline/karma.conf.js rename to sdk/core/core-rest-pipeline/karma.conf.cjs diff --git a/sdk/core/core-rest-pipeline/package.json b/sdk/core/core-rest-pipeline/package.json index abc14e434efb..4c79db649d87 100644 --- a/sdk/core/core-rest-pipeline/package.json +++ b/sdk/core/core-rest-pipeline/package.json @@ -54,8 +54,8 @@ "test:browser": "npm run clean && npm run build:test && npm run unit-test:browser && npm run integration-test:browser", "test:node": "npm run clean && tsc -p . && npm run unit-test:node && npm run integration-test:node", "test": "npm run clean && tsc -p . && npm run unit-test:node && dev-tool run bundle --output-cjs-ext=true && npm run unit-test:browser && npm run integration-test", - "unit-test:browser": "karma start --single-run", - "unit-test:node": "mocha -r ts-node/register --reporter ../../../common/tools/mocha-multi-reporter.js --timeout 1200000 --full-trace --exclude \"test/**/browser/*.spec.ts\" \"test/**/*.spec.ts\"", + "unit-test:browser": "karma start karma.conf.cjs --single-run", + "unit-test:node": "mocha --reporter ../../../common/tools/mocha-multi-reporter.js --timeout 1200000 --full-trace --exclude \"test/**/browser/*.spec.ts\" \"test/**/*.spec.ts\"", "unit-test": "npm run unit-test:node && npm run unit-test:browser" }, "files": [ diff --git a/sdk/core/core-rest-pipeline/src/nodeHttpClient.ts b/sdk/core/core-rest-pipeline/src/nodeHttpClient.ts index 94f9b12786df..05d5033c60a5 100644 --- a/sdk/core/core-rest-pipeline/src/nodeHttpClient.ts +++ b/sdk/core/core-rest-pipeline/src/nodeHttpClient.ts @@ -1,9 +1,9 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import * as http from "http"; -import * as https from "https"; -import * as zlib from "zlib"; +import http from "http"; +import https from "https"; +import zlib from "zlib"; import { Transform } from "stream"; import { AbortController, AbortError } from "@azure/abort-controller"; import { diff --git a/sdk/core/core-rest-pipeline/src/policies/proxyPolicy.ts b/sdk/core/core-rest-pipeline/src/policies/proxyPolicy.ts index 5e700b36af1c..de1e98560974 100644 --- a/sdk/core/core-rest-pipeline/src/policies/proxyPolicy.ts +++ b/sdk/core/core-rest-pipeline/src/policies/proxyPolicy.ts @@ -1,8 +1,8 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import * as http from "http"; -import * as https from "https"; +import http from "http"; +import https from "https"; import httpsPA from "https-proxy-agent"; const { HttpsProxyAgent } = httpsPA; import httpPA from "http-proxy-agent"; diff --git a/sdk/core/core-rest-pipeline/src/util/userAgentPlatform.ts b/sdk/core/core-rest-pipeline/src/util/userAgentPlatform.ts index c1be64874b1c..2388cd2353c6 100644 --- a/sdk/core/core-rest-pipeline/src/util/userAgentPlatform.ts +++ b/sdk/core/core-rest-pipeline/src/util/userAgentPlatform.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import * as os from "os"; +import os from "os"; /** * @internal diff --git a/sdk/core/core-rest-pipeline/test/bearerTokenAuthenticationPolicy.spec.ts b/sdk/core/core-rest-pipeline/test/bearerTokenAuthenticationPolicy.spec.ts index 8d899e112d44..f82fffd85cc5 100644 --- a/sdk/core/core-rest-pipeline/test/bearerTokenAuthenticationPolicy.spec.ts +++ b/sdk/core/core-rest-pipeline/test/bearerTokenAuthenticationPolicy.spec.ts @@ -2,7 +2,7 @@ // Licensed under the MIT license. import { assert } from "chai"; -import * as sinon from "sinon"; +import sinon from "sinon"; import { AccessToken, TokenCredential } from "@azure/core-auth"; import { PipelinePolicy, diff --git a/sdk/core/core-rest-pipeline/test/browser/formDataPolicy.spec.ts b/sdk/core/core-rest-pipeline/test/browser/formDataPolicy.spec.ts index 23a28f750b1a..c8388048de50 100644 --- a/sdk/core/core-rest-pipeline/test/browser/formDataPolicy.spec.ts +++ b/sdk/core/core-rest-pipeline/test/browser/formDataPolicy.spec.ts @@ -2,7 +2,7 @@ // Licensed under the MIT license. import { assert } from "chai"; -import * as sinon from "sinon"; +import sinon from "sinon"; import { PipelineResponse, SendRequest, diff --git a/sdk/core/core-rest-pipeline/test/defaultRetryPolicy.spec.ts b/sdk/core/core-rest-pipeline/test/defaultRetryPolicy.spec.ts index 83c3e49b4879..55e294c3b316 100644 --- a/sdk/core/core-rest-pipeline/test/defaultRetryPolicy.spec.ts +++ b/sdk/core/core-rest-pipeline/test/defaultRetryPolicy.spec.ts @@ -2,7 +2,7 @@ // Licensed under the MIT license. import { assert } from "chai"; -import * as sinon from "sinon"; +import sinon from "sinon"; import { RestError, SendRequest, createPipelineRequest, defaultRetryPolicy } from "../src/index.js"; import { DEFAULT_RETRY_POLICY_COUNT } from "../src/constants.js"; diff --git a/sdk/core/core-rest-pipeline/test/exponentialRetryPolicy.spec.ts b/sdk/core/core-rest-pipeline/test/exponentialRetryPolicy.spec.ts index 4ddd9cedc4d0..24fb98f4d600 100644 --- a/sdk/core/core-rest-pipeline/test/exponentialRetryPolicy.spec.ts +++ b/sdk/core/core-rest-pipeline/test/exponentialRetryPolicy.spec.ts @@ -2,7 +2,7 @@ // Licensed under the MIT license. import { assert } from "chai"; -import * as sinon from "sinon"; +import sinon from "sinon"; import { PipelineResponse, RestError, diff --git a/sdk/core/core-rest-pipeline/test/ndJsonPolicy.spec.ts b/sdk/core/core-rest-pipeline/test/ndJsonPolicy.spec.ts index ab4e4f4e4708..7bdb52386b57 100644 --- a/sdk/core/core-rest-pipeline/test/ndJsonPolicy.spec.ts +++ b/sdk/core/core-rest-pipeline/test/ndJsonPolicy.spec.ts @@ -2,7 +2,7 @@ // Licensed under the MIT license. import { assert } from "chai"; -import * as sinon from "sinon"; +import sinon from "sinon"; import { PipelineResponse, SendRequest, diff --git a/sdk/core/core-rest-pipeline/test/node/bearerTokenAuthenticationPolicyChallenge.spec.ts b/sdk/core/core-rest-pipeline/test/node/bearerTokenAuthenticationPolicyChallenge.spec.ts index 3607a8c9891e..ffeabdc93a28 100644 --- a/sdk/core/core-rest-pipeline/test/node/bearerTokenAuthenticationPolicyChallenge.spec.ts +++ b/sdk/core/core-rest-pipeline/test/node/bearerTokenAuthenticationPolicyChallenge.spec.ts @@ -2,7 +2,7 @@ // Licensed under the MIT license. import { assert } from "chai"; -import * as sinon from "sinon"; +import sinon from "sinon"; import { AccessToken, GetTokenOptions, TokenCredential } from "@azure/core-auth"; import { AuthorizeRequestOnChallengeOptions, diff --git a/sdk/core/core-rest-pipeline/test/node/decompressResponsePolicy.ts b/sdk/core/core-rest-pipeline/test/node/decompressResponsePolicy.ts index b49f0c0bae6d..f8c4819f81f1 100644 --- a/sdk/core/core-rest-pipeline/test/node/decompressResponsePolicy.ts +++ b/sdk/core/core-rest-pipeline/test/node/decompressResponsePolicy.ts @@ -2,7 +2,7 @@ // Licensed under the MIT license. import { assert } from "chai"; -import * as sinon from "sinon"; +import sinon from "sinon"; import { SendRequest, createPipelineRequest, decompressResponsePolicy } from "../../src/index.js"; describe("decompressResponsePolicy (node)", function () { diff --git a/sdk/core/core-rest-pipeline/test/node/formDataPolicy.spec.ts b/sdk/core/core-rest-pipeline/test/node/formDataPolicy.spec.ts index 684e50394f7f..9e40b64f004d 100644 --- a/sdk/core/core-rest-pipeline/test/node/formDataPolicy.spec.ts +++ b/sdk/core/core-rest-pipeline/test/node/formDataPolicy.spec.ts @@ -2,7 +2,7 @@ // Licensed under the MIT license. import { assert } from "chai"; -import * as sinon from "sinon"; +import sinon from "sinon"; import { PipelineResponse, SendRequest, diff --git a/sdk/core/core-rest-pipeline/test/node/nodeHttpClient.spec.ts b/sdk/core/core-rest-pipeline/test/node/nodeHttpClient.spec.ts index 136bd474ea06..28a7b6124cc3 100644 --- a/sdk/core/core-rest-pipeline/test/node/nodeHttpClient.spec.ts +++ b/sdk/core/core-rest-pipeline/test/node/nodeHttpClient.spec.ts @@ -2,11 +2,11 @@ // Licensed under the MIT license. import { assert } from "chai"; -import * as sinon from "sinon"; +import sinon from "sinon"; import { PassThrough, Writable } from "stream"; import { ClientRequest, IncomingHttpHeaders, IncomingMessage } from "http"; -import * as https from "https"; -import * as http from "http"; +import https from "https"; +import http from "http"; import { AbortController } from "@azure/abort-controller"; import { createDefaultHttpClient, createPipelineRequest } from "../../src/index.js"; @@ -71,7 +71,7 @@ describe("NodeHttpClient", function () { const client = createDefaultHttpClient(); const clientRequest = createRequest(); stubbedHttpsRequest.returns(clientRequest); - const request = createPipelineRequest({ url: "https://example.com" }); + const request = createPipelineRequest({ url: "https://whateverhahaha.com" }); const promise = client.sendRequest(request); stubbedHttpsRequest.yield(createResponse(404)); const response = await promise; diff --git a/sdk/core/core-rest-pipeline/test/node/pipeline.spec.ts b/sdk/core/core-rest-pipeline/test/node/pipeline.spec.ts index 14bf821ce7cf..fc67afdeabbf 100644 --- a/sdk/core/core-rest-pipeline/test/node/pipeline.spec.ts +++ b/sdk/core/core-rest-pipeline/test/node/pipeline.spec.ts @@ -1,8 +1,8 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import * as http from "https"; -import * as https from "https"; +import http from "https"; +import https from "https"; import { proxyPolicy, proxyPolicyName } from "../../src/policies/proxyPolicy.js"; import { tlsPolicy, tlsPolicyName } from "../../src/policies/tlsPolicy.js"; diff --git a/sdk/core/core-rest-pipeline/test/node/proxyPolicy.spec.ts b/sdk/core/core-rest-pipeline/test/node/proxyPolicy.spec.ts index 177467c37b81..44e1171bb03e 100644 --- a/sdk/core/core-rest-pipeline/test/node/proxyPolicy.spec.ts +++ b/sdk/core/core-rest-pipeline/test/node/proxyPolicy.spec.ts @@ -2,7 +2,7 @@ // Licensed under the MIT license. import { assert } from "chai"; -import * as sinon from "sinon"; +import sinon from "sinon"; import { ProxySettings, SendRequest, diff --git a/sdk/core/core-rest-pipeline/test/redirectPolicy.spec.ts b/sdk/core/core-rest-pipeline/test/redirectPolicy.spec.ts index d533ee36fa2d..c9632b5aabfe 100644 --- a/sdk/core/core-rest-pipeline/test/redirectPolicy.spec.ts +++ b/sdk/core/core-rest-pipeline/test/redirectPolicy.spec.ts @@ -3,7 +3,7 @@ import { assert } from "chai"; import { redirectPolicy } from "../src/policies/redirectPolicy.js"; -import * as sinon from "sinon"; +import sinon from "sinon"; import { PipelineResponse, SendRequest, diff --git a/sdk/core/core-rest-pipeline/test/retryPolicy.spec.ts b/sdk/core/core-rest-pipeline/test/retryPolicy.spec.ts index 8025aaa8074d..3115c1154c3c 100644 --- a/sdk/core/core-rest-pipeline/test/retryPolicy.spec.ts +++ b/sdk/core/core-rest-pipeline/test/retryPolicy.spec.ts @@ -4,7 +4,7 @@ import { AzureLogger } from "@azure/logger"; import { AbortController } from "@azure/abort-controller"; import { assert } from "chai"; -import * as sinon from "sinon"; +import sinon from "sinon"; import { PipelineResponse, RestError, diff --git a/sdk/core/core-rest-pipeline/test/systemErrorRetryPolicy.spec.ts b/sdk/core/core-rest-pipeline/test/systemErrorRetryPolicy.spec.ts index 6d726c8447df..262ddb0d78bb 100644 --- a/sdk/core/core-rest-pipeline/test/systemErrorRetryPolicy.spec.ts +++ b/sdk/core/core-rest-pipeline/test/systemErrorRetryPolicy.spec.ts @@ -2,7 +2,7 @@ // Licensed under the MIT license. import { assert } from "chai"; -import * as sinon from "sinon"; +import sinon from "sinon"; import { PipelineResponse, RestError, diff --git a/sdk/core/core-rest-pipeline/test/throttlingRetryPolicy.spec.ts b/sdk/core/core-rest-pipeline/test/throttlingRetryPolicy.spec.ts index ec9c038070e2..bab425e7151a 100644 --- a/sdk/core/core-rest-pipeline/test/throttlingRetryPolicy.spec.ts +++ b/sdk/core/core-rest-pipeline/test/throttlingRetryPolicy.spec.ts @@ -5,7 +5,7 @@ import { assert, use as chaiUse } from "chai"; import chaiPromises from "chai-as-promised"; chaiUse(chaiPromises); import { Context } from "mocha"; -import * as sinon from "sinon"; +import sinon from "sinon"; import { PipelineResponse, SendRequest, diff --git a/sdk/core/core-rest-pipeline/test/tracingPolicy.spec.ts b/sdk/core/core-rest-pipeline/test/tracingPolicy.spec.ts index 5ac62656078d..2feb04125872 100644 --- a/sdk/core/core-rest-pipeline/test/tracingPolicy.spec.ts +++ b/sdk/core/core-rest-pipeline/test/tracingPolicy.spec.ts @@ -2,7 +2,7 @@ // Licensed under the MIT license. import { assert } from "chai"; -import * as sinon from "sinon"; +import sinon from "sinon"; import { PipelineRequest, PipelineResponse, From d9fe9ee664f3577935ae3b2b09e95a9b4dd54848 Mon Sep 17 00:00:00 2001 From: Jeremy Meng Date: Thu, 4 Aug 2022 19:59:32 +0000 Subject: [PATCH 06/12] - Fix linter rule to allow `"main": "dist/index.cjs"` --- .../docs/rules/ts-package-json-main-is-cjs.md | 10 +++++- .../src/rules/ts-package-json-main-is-cjs.ts | 4 +-- .../src/rules/ts-use-interface-parameters.ts | 36 +++++++++---------- .../rules/ts-package-json-main-is-cjs.ts | 30 ++++++++++++---- 4 files changed, 51 insertions(+), 29 deletions(-) diff --git a/common/tools/eslint-plugin-azure-sdk/docs/rules/ts-package-json-main-is-cjs.md b/common/tools/eslint-plugin-azure-sdk/docs/rules/ts-package-json-main-is-cjs.md index 8e88d5856240..2d3bdcc47e96 100644 --- a/common/tools/eslint-plugin-azure-sdk/docs/rules/ts-package-json-main-is-cjs.md +++ b/common/tools/eslint-plugin-azure-sdk/docs/rules/ts-package-json-main-is-cjs.md @@ -1,6 +1,6 @@ # ts-package-json-main-is-cjs -Requires `main` in `package.json` to be point to a CommonJS or UMD module. In this case, its assumed that it points to `"dist/index.js"`. +Requires `main` in `package.json` to be point to a CommonJS or UMD module. In this case, its assumed that it points to `"dist/index.js"` or `"dist/index.cjs"`. This rule is fixable using the `--fix` option. @@ -14,6 +14,14 @@ This rule is fixable using the `--fix` option. } ``` +### Good + +```json +{ + "main": "dist/index.cjs" +} +``` + ### Bad ```json diff --git a/common/tools/eslint-plugin-azure-sdk/src/rules/ts-package-json-main-is-cjs.ts b/common/tools/eslint-plugin-azure-sdk/src/rules/ts-package-json-main-is-cjs.ts index ece3560b9b95..13c697b39d83 100644 --- a/common/tools/eslint-plugin-azure-sdk/src/rules/ts-package-json-main-is-cjs.ts +++ b/common/tools/eslint-plugin-azure-sdk/src/rules/ts-package-json-main-is-cjs.ts @@ -45,10 +45,10 @@ export = { const nodeValue = node.value as Literal; const main = nodeValue.value as string; - if (!/^(\.\/)?dist\/index\.js$/.test(main)) { + if (!/^(\.\/)?dist\/index\.(c)?js$/.test(main)) { context.report({ node: nodeValue, - message: `main is set to ${main} when it should be set to dist/index.js`, + message: `main is set to ${main} when it should be set to dist/index.js or dist/index.cjs`, fix: (fixer: Rule.RuleFixer): Rule.Fix => fixer.replaceText(nodeValue, `"dist/index.js"`), }); diff --git a/common/tools/eslint-plugin-azure-sdk/src/rules/ts-use-interface-parameters.ts b/common/tools/eslint-plugin-azure-sdk/src/rules/ts-use-interface-parameters.ts index ccfc2d150870..41ae98c2ee9f 100644 --- a/common/tools/eslint-plugin-azure-sdk/src/rules/ts-use-interface-parameters.ts +++ b/common/tools/eslint-plugin-azure-sdk/src/rules/ts-use-interface-parameters.ts @@ -286,18 +286,17 @@ export = { const symbol = typeChecker .getTypeAtLocation(converter.get(node as TSESTree.Node)) .getSymbol(); - const overloads = - symbol?.declarations - ? symbol.declarations - .filter( - (declaration: Declaration): boolean => - reverter.get(declaration as TSNode) !== undefined - ) - .map((declaration: Declaration): FunctionExpression => { - const method = reverter.get(declaration as TSNode) as MethodDefinition; - return method.value; - }) - : []; + const overloads = symbol?.declarations + ? symbol.declarations + .filter( + (declaration: Declaration): boolean => + reverter.get(declaration as TSNode) !== undefined + ) + .map((declaration: Declaration): FunctionExpression => { + const method = reverter.get(declaration as TSNode) as MethodDefinition; + return method.value; + }) + : []; evaluateOverloads( overloads, converter, @@ -326,13 +325,12 @@ export = { const symbol = typeChecker .getTypeAtLocation(converter.get(node as TSESTree.Node)) .getSymbol(); - const overloads = - symbol?.declarations - ? symbol.declarations.map( - (declaration: Declaration): FunctionDeclaration => - reverter.get(declaration as TSNode) as FunctionDeclaration - ) - : []; + const overloads = symbol?.declarations + ? symbol.declarations.map( + (declaration: Declaration): FunctionDeclaration => + reverter.get(declaration as TSNode) as FunctionDeclaration + ) + : []; evaluateOverloads( overloads, converter, diff --git a/common/tools/eslint-plugin-azure-sdk/tests/rules/ts-package-json-main-is-cjs.ts b/common/tools/eslint-plugin-azure-sdk/tests/rules/ts-package-json-main-is-cjs.ts index 06aab3827107..2b151088e44e 100644 --- a/common/tools/eslint-plugin-azure-sdk/tests/rules/ts-package-json-main-is-cjs.ts +++ b/common/tools/eslint-plugin-azure-sdk/tests/rules/ts-package-json-main-is-cjs.ts @@ -263,6 +263,16 @@ ruleTester.run("ts-package-json-main-is-cjs", rule, { code: '{"main": "./dist/index.js"}', filename: "package.json", }, + { + // correct format #1 + code: '{"main": "dist/index.cjs"}', + filename: "package.json", + }, + { + // correct format #2 + code: '{"main": "./dist/index.cjs"}', + filename: "package.json", + }, { // a full example package.json (taken from https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/eventhub/event-hubs/package.json with "scripts" removed for testing purposes) code: examplePackageGood, @@ -300,7 +310,8 @@ ruleTester.run("ts-package-json-main-is-cjs", rule, { filename: "package.json", errors: [ { - message: "main is set to dist//index.js when it should be set to dist/index.js", + message: + "main is set to dist//index.js when it should be set to dist/index.js or dist/index.cjs", }, ], output: '{"main": "dist/index.js"}', @@ -310,7 +321,8 @@ ruleTester.run("ts-package-json-main-is-cjs", rule, { filename: "package.json", errors: [ { - message: "main is set to .dist/index.js when it should be set to dist/index.js", + message: + "main is set to .dist/index.js when it should be set to dist/index.js or dist/index.cjs", }, ], output: '{"main": "dist/index.js"}', @@ -320,7 +332,8 @@ ruleTester.run("ts-package-json-main-is-cjs", rule, { filename: "package.json", errors: [ { - message: "main is set to /dist/index.js when it should be set to dist/index.js", + message: + "main is set to /dist/index.js when it should be set to dist/index.js or dist/index.cjs", }, ], output: '{"main": "dist/index.js"}', @@ -331,7 +344,7 @@ ruleTester.run("ts-package-json-main-is-cjs", rule, { filename: "package.json", errors: [ { - message: "main is set to dist when it should be set to dist/index.js", + message: "main is set to dist when it should be set to dist/index.js or dist/index.cjs", }, ], output: '{"main": "dist/index.js"}', @@ -341,7 +354,8 @@ ruleTester.run("ts-package-json-main-is-cjs", rule, { filename: "package.json", errors: [ { - message: "main is set to index.js when it should be set to dist/index.js", + message: + "main is set to index.js when it should be set to dist/index.js or dist/index.cjs", }, ], output: '{"main": "dist/index.js"}', @@ -351,7 +365,8 @@ ruleTester.run("ts-package-json-main-is-cjs", rule, { filename: "package.json", errors: [ { - message: "main is set to dist/src/index.js when it should be set to dist/index.js", + message: + "main is set to dist/src/index.js when it should be set to dist/index.js or dist/index.cjs", }, ], output: '{"main": "dist/index.js"}', @@ -362,7 +377,8 @@ ruleTester.run("ts-package-json-main-is-cjs", rule, { filename: "package.json", errors: [ { - message: "main is set to index.js when it should be set to dist/index.js", + message: + "main is set to index.js when it should be set to dist/index.js or dist/index.cjs", }, ], output: examplePackageGood, From d874bc1d5bbe4a08a8c498706f15c10161842178 Mon Sep 17 00:00:00 2001 From: Jeremy Meng Date: Thu, 4 Aug 2022 20:50:13 +0000 Subject: [PATCH 07/12] revert back to awesome example.com --- sdk/core/core-rest-pipeline/test/node/nodeHttpClient.spec.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/core/core-rest-pipeline/test/node/nodeHttpClient.spec.ts b/sdk/core/core-rest-pipeline/test/node/nodeHttpClient.spec.ts index 28a7b6124cc3..b6ecf8521999 100644 --- a/sdk/core/core-rest-pipeline/test/node/nodeHttpClient.spec.ts +++ b/sdk/core/core-rest-pipeline/test/node/nodeHttpClient.spec.ts @@ -71,7 +71,7 @@ describe("NodeHttpClient", function () { const client = createDefaultHttpClient(); const clientRequest = createRequest(); stubbedHttpsRequest.returns(clientRequest); - const request = createPipelineRequest({ url: "https://whateverhahaha.com" }); + const request = createPipelineRequest({ url: "https://example.com" }); const promise = client.sendRequest(request); stubbedHttpsRequest.yield(createResponse(404)); const response = await promise; From 65524e6c0d75dc2bc71641dc6155f3d2c10a199d Mon Sep 17 00:00:00 2001 From: Jeremy Meng Date: Thu, 4 Aug 2022 21:02:40 +0000 Subject: [PATCH 08/12] Fix types export --- sdk/core/core-rest-pipeline/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/core/core-rest-pipeline/package.json b/sdk/core/core-rest-pipeline/package.json index 4c79db649d87..5d134ed52072 100644 --- a/sdk/core/core-rest-pipeline/package.json +++ b/sdk/core/core-rest-pipeline/package.json @@ -8,7 +8,7 @@ "type": "module", "export": { ".": { - "types": "./types/src/index.js", + "types": "core-rest-pipeline.shims.d.ts", "require": "./dist/index.cjs", "import": "./dist-esm/src/index.js" } From 5231081ef9ba097942cd0fe8e749fa525f9ed0da Mon Sep 17 00:00:00 2001 From: Jeremy Meng Date: Thu, 4 Aug 2022 23:13:18 +0000 Subject: [PATCH 09/12] Bump minor version and update CHANGELOG --- sdk/core/core-rest-pipeline/CHANGELOG.md | 4 +++- sdk/core/core-rest-pipeline/package.json | 2 +- sdk/core/core-rest-pipeline/src/constants.ts | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/sdk/core/core-rest-pipeline/CHANGELOG.md b/sdk/core/core-rest-pipeline/CHANGELOG.md index 4fb381b58b80..70207611bbf8 100644 --- a/sdk/core/core-rest-pipeline/CHANGELOG.md +++ b/sdk/core/core-rest-pipeline/CHANGELOG.md @@ -1,9 +1,11 @@ # Release History -## 1.9.2 (Unreleased) +## 1.10.0 (Unreleased) ### Features Added +- Added conditional exports for CommonJS and ESM. [#22804](https://github.com/Azure/azure-sdk-for-js/pull/22804) + ### Breaking Changes ### Bugs Fixed diff --git a/sdk/core/core-rest-pipeline/package.json b/sdk/core/core-rest-pipeline/package.json index 7b975b8aef58..10db5a6aae5a 100644 --- a/sdk/core/core-rest-pipeline/package.json +++ b/sdk/core/core-rest-pipeline/package.json @@ -1,6 +1,6 @@ { "name": "@azure/core-rest-pipeline", - "version": "1.9.2", + "version": "1.10.0", "description": "Isomorphic client library for making HTTP requests in node.js and browser.", "sdk-type": "client", "main": "dist/index.cjs", diff --git a/sdk/core/core-rest-pipeline/src/constants.ts b/sdk/core/core-rest-pipeline/src/constants.ts index 4b79736c7bb4..513bb5ba832e 100644 --- a/sdk/core/core-rest-pipeline/src/constants.ts +++ b/sdk/core/core-rest-pipeline/src/constants.ts @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -export const SDK_VERSION: string = "1.9.2"; +export const SDK_VERSION: string = "1.10.0"; export const DEFAULT_RETRY_POLICY_COUNT = 3; From 10f3fa6165fc88d3f171440af6ec383d9c4e4061 Mon Sep 17 00:00:00 2001 From: Jeremy Meng Date: Thu, 6 Oct 2022 19:40:15 +0000 Subject: [PATCH 10/12] Add copy of our types shim for CommonJS conditional export --- .../core-rest-pipeline/core-rest-pipeline.d.cts | 12 ++++++++++++ .../core-rest-pipeline.shims-3_1.d.cts | 12 ++++++++++++ sdk/core/core-rest-pipeline/package.json | 14 +++++++++++--- 3 files changed, 35 insertions(+), 3 deletions(-) create mode 100644 sdk/core/core-rest-pipeline/core-rest-pipeline.d.cts create mode 100644 sdk/core/core-rest-pipeline/core-rest-pipeline.shims-3_1.d.cts diff --git a/sdk/core/core-rest-pipeline/core-rest-pipeline.d.cts b/sdk/core/core-rest-pipeline/core-rest-pipeline.d.cts new file mode 100644 index 000000000000..718d5fdc777b --- /dev/null +++ b/sdk/core/core-rest-pipeline/core-rest-pipeline.d.cts @@ -0,0 +1,12 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +declare global { + interface FormData {} + interface Blob {} + interface File {} + interface ReadableStream {} + interface TransformStream {} +} + +export * from "./types/latest/core-rest-pipeline"; diff --git a/sdk/core/core-rest-pipeline/core-rest-pipeline.shims-3_1.d.cts b/sdk/core/core-rest-pipeline/core-rest-pipeline.shims-3_1.d.cts new file mode 100644 index 000000000000..abb8bf35b987 --- /dev/null +++ b/sdk/core/core-rest-pipeline/core-rest-pipeline.shims-3_1.d.cts @@ -0,0 +1,12 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +declare global { + interface FormData {} + interface Blob {} + interface File {} + interface ReadableStream {} + interface TransformStream {} +} + +export * from "./types/3.1/core-rest-pipeline"; diff --git a/sdk/core/core-rest-pipeline/package.json b/sdk/core/core-rest-pipeline/package.json index 0bd6c8fd332d..023ca2852427 100644 --- a/sdk/core/core-rest-pipeline/package.json +++ b/sdk/core/core-rest-pipeline/package.json @@ -8,9 +8,14 @@ "type": "module", "export": { ".": { - "types": "core-rest-pipeline.shims.d.ts", - "require": "./dist/index.cjs", - "import": "./dist-esm/src/index.js" + "require": { + "types": "core-rest-pipeline.shims.d.ts", + "default": "./dist/index.cjs" + }, + "import": { + "types": "core-rest-pipeline.shims.d.cts", + "default": "./dist-esm/src/index.js" + } } }, "browser": { @@ -31,6 +36,9 @@ "<3.6": { "core-rest-pipeline.shims.d.ts": [ "core-rest-pipeline.shims-3_1.d.ts" + ], + "core-rest-pipeline.shims.d.cts": [ + "core-rest-pipeline.shims-3_1.d.cts" ] } }, From 5bb5b13b03cdaafd19832cd890103d7362bdc0c6 Mon Sep 17 00:00:00 2001 From: Jeremy Meng Date: Mon, 17 Oct 2022 18:02:22 +0000 Subject: [PATCH 11/12] remove `output-cjs-ext` option and use the `main` entry value in package.json instead. --- common/tools/dev-tool/src/commands/run/bundle.ts | 12 +++++------- sdk/core/core-rest-pipeline/package.json | 4 ++-- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/common/tools/dev-tool/src/commands/run/bundle.ts b/common/tools/dev-tool/src/commands/run/bundle.ts index 530128f97a9e..fff9277934ce 100644 --- a/common/tools/dev-tool/src/commands/run/bundle.ts +++ b/common/tools/dev-tool/src/commands/run/bundle.ts @@ -39,11 +39,6 @@ export const commandInfo = makeCommandInfo( default: true, description: "include a polyfill for Node.js builtin modules", }, - "output-cjs-ext": { - kind: "boolean", - default: false, - description: "use .cjs extension for bundle output. default is .js extension", - }, } ); @@ -75,9 +70,12 @@ export default leafCommand(commandInfo, async (options) => { try { const bundle = await rollup.rollup(baseConfig); - + const cjsFilename = info.packageJson.main; + if (!cjsFilename) { + throw new Error("Expecting valid main entry"); + } await bundle.write({ - file: `dist/index.${options["output-cjs-ext"] ? "cjs" : "js"}`, + file: cjsFilename, format: "cjs", sourcemap: true, exports: "named", diff --git a/sdk/core/core-rest-pipeline/package.json b/sdk/core/core-rest-pipeline/package.json index 023ca2852427..adc40f52b19c 100644 --- a/sdk/core/core-rest-pipeline/package.json +++ b/sdk/core/core-rest-pipeline/package.json @@ -45,9 +45,9 @@ "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", - "build:test": "tsc -p . && dev-tool run bundle --output-cjs-ext=true", + "build:test": "tsc -p . && dev-tool run bundle", "build:types": "downlevel-dts types/latest/ types/3.1/", - "build": "npm run clean && tsc -p . && dev-tool run bundle --output-cjs-ext=true && api-extractor run --local && npm run build:types", + "build": "npm run clean && tsc -p . && dev-tool run bundle && api-extractor run --local && npm run build:types", "check-format": "prettier --list-different --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.ts\" \"test/**/*.ts\" \"*.{js,json}\"", "clean": "rimraf dist dist-* temp types *.tgz *.log", "execute:samples": "echo skipped", From 57705cf12e8de171353a182fbd03657ee2bd526b Mon Sep 17 00:00:00 2001 From: Jeremy Meng Date: Thu, 20 Oct 2022 17:00:34 +0000 Subject: [PATCH 12/12] delete usage of removed dev-tool bundle option --- sdk/core/core-rest-pipeline/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/core/core-rest-pipeline/package.json b/sdk/core/core-rest-pipeline/package.json index e406e50f4401..01bb7aada277 100644 --- a/sdk/core/core-rest-pipeline/package.json +++ b/sdk/core/core-rest-pipeline/package.json @@ -61,7 +61,7 @@ "pack": "npm pack 2>&1", "test:browser": "npm run clean && npm run build:test && npm run unit-test:browser && npm run integration-test:browser", "test:node": "npm run clean && tsc -p . && npm run unit-test:node && npm run integration-test:node", - "test": "npm run clean && tsc -p . && npm run unit-test:node && dev-tool run bundle --output-cjs-ext=true && npm run unit-test:browser && npm run integration-test", + "test": "npm run clean && tsc -p . && npm run unit-test:node && dev-tool run bundle && npm run unit-test:browser && npm run integration-test", "unit-test:browser": "karma start karma.conf.cjs --single-run", "unit-test:node": "mocha --reporter ../../../common/tools/mocha-multi-reporter.js --timeout 1200000 --full-trace --exclude \"test/**/browser/*.spec.ts\" \"test/**/*.spec.ts\"", "unit-test": "npm run unit-test:node && npm run unit-test:browser"