Skip to content

feat(core/core-rest-pipeline): migrate to #platform/* imports#38205

Merged
deyaaeldeen merged 4 commits intomainfrom
platform-imports/core-rest-pipeline
Apr 24, 2026
Merged

feat(core/core-rest-pipeline): migrate to #platform/* imports#38205
deyaaeldeen merged 4 commits intomainfrom
platform-imports/core-rest-pipeline

Conversation

@deyaaeldeen
Copy link
Copy Markdown
Member

@deyaaeldeen deyaaeldeen commented Apr 18, 2026

Migrate @azure/core-rest-pipeline to #platform/* conditional imports:

  • #platform/userAgent — platform-specific user agent string generation
  • #platform/wrapAbortSignal — React Native AbortSignal compatibility shim
  • #platform/createFile — platform-specific File creation (Node raw content vs browser native)
  • Replace NodeJS.ReadableStream/Buffer/ReadableStream with NodeReadableStream/NodeBuffer/WebReadableStream from @typespec/ts-http-runtime
  • Per-platform tsconfigs under config/, updated eslint/vitest/warp configs

@deyaaeldeen deyaaeldeen force-pushed the platform-imports/core-rest-pipeline branch 11 times, most recently from b65314b to a3cb68f Compare April 20, 2026 17:14
@deyaaeldeen deyaaeldeen marked this pull request as ready for review April 20, 2026 19:21
@deyaaeldeen deyaaeldeen requested a review from a team as a code owner April 20, 2026 19:21
Copilot AI review requested due to automatic review settings April 20, 2026 19:21
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR migrates @azure/core-rest-pipeline to internal #platform/* conditional imports to provide per-runtime implementations (browser / react-native / node) while keeping a unified public API surface.

Changes:

  • Introduce #platform/* conditional imports for user agent generation, AbortSignal wrapping, and File creation (with package.json imports mappings).
  • Replace Node/browser stream & buffer types with NodeReadableStream/NodeBuffer/WebReadableStream from @typespec/ts-http-runtime and update API reports accordingly.
  • Restructure build/test configuration to use per-platform tsconfigs under config/, align eslint/vitest configs, and add a react-native Vitest config entrypoint + test script.

Reviewed changes

Copilot reviewed 33 out of 34 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
sdk/core/core-rest-pipeline/warp.config.yml Points warp targets at per-platform tsconfigs under ./config/.
sdk/core/core-rest-pipeline/vitest.react-native.config.ts Adds RN Vitest config re-export from eng/vitestconfigs.
sdk/core/core-rest-pipeline/vitest.browser.config.ts Switches browser Vitest config to eng/vitestconfigs/browser.config.ts.
sdk/core/core-rest-pipeline/tsconfig.json Updates project references to the new config/ tsconfigs.
sdk/core/core-rest-pipeline/tsconfig.test.node.json Removed in favor of config/tsconfig.test.node.json.
sdk/core/core-rest-pipeline/tsconfig.test.json Removed in favor of explicit config/ references.
sdk/core/core-rest-pipeline/tsconfig.src.json Removed in favor of per-platform config/tsconfig.src.*.json.
sdk/core/core-rest-pipeline/tsconfig.snippets.json Removed in favor of config/tsconfig.snippets.json.
sdk/core/core-rest-pipeline/tsconfig.samples.json Removed in favor of config/tsconfig.samples.json.
sdk/core/core-rest-pipeline/tsconfig.browser.config.json Removed in favor of config/tsconfig.test.browser.json.
sdk/core/core-rest-pipeline/test/util.ts Uses @azure/core-util stringToUint8Array when collecting stream chunks.
sdk/core/core-rest-pipeline/test/internal/node/userAgentPlatform.spec.ts Removes the “empty process.versions” test case.
sdk/core/core-rest-pipeline/test/internal/formDataPolicy.spec.ts Adjusts arrayBuffer() access typing to avoid relying on Blob narrowing.
sdk/core/core-rest-pipeline/test/internal/browser/userAgentPlatform.spec.ts Updates to import platform impl via #platform/userAgent and adds header-name assertion.
sdk/core/core-rest-pipeline/src/util/wrapAbortSignal-rn.mts Adds RN-specific AbortSignal shim implementation.
sdk/core/core-rest-pipeline/src/util/userAgentPlatform.ts Updates Node platform detection typing via global augmentation of NodeJS.ProcessVersions.
sdk/core/core-rest-pipeline/src/util/userAgentPlatform-browser.mts Refactors browser user agent data typing and Edge runtime handling.
sdk/core/core-rest-pipeline/src/util/userAgent.ts Switches to #platform/userAgent conditional import.
sdk/core/core-rest-pipeline/src/util/react-native.d.ts Removes custom react-native module typing (now relying on RN types).
sdk/core/core-rest-pipeline/src/util/file.ts Migrates stream/buffer types to ts-http-runtime aliases; adds createRawFile; routes createFile via #platform/createFile.
sdk/core/core-rest-pipeline/src/util/createFile.ts Adds Node/default createFile implementation via createRawFile.
sdk/core/core-rest-pipeline/src/util/createFile-browser.mts Adds browser/RN createFile implementation using native File.
sdk/core/core-rest-pipeline/src/policies/wrapAbortSignalLikePolicy.ts Switches to #platform/wrapAbortSignal import.
sdk/core/core-rest-pipeline/src/interfaces.ts Replaces Buffer/NodeJS.ReadableStream/ReadableStream types with ts-http-runtime aliases.
sdk/core/core-rest-pipeline/src/index.ts Removes DOM stubs and re-exports ts-http-runtime stream/buffer types.
sdk/core/core-rest-pipeline/src/defaultHttpClient.ts Switches to #platform/wrapAbortSignal import.
sdk/core/core-rest-pipeline/review/core-rest-pipeline-react-native.api.diff.md Captures RN API diffs vs node baseline.
sdk/core/core-rest-pipeline/review/core-rest-pipeline-node.api.md Updates node API report for new stream/buffer types and re-exports.
sdk/core/core-rest-pipeline/package.json Adds imports mappings for #platform/*; updates scripts to use new config/ tsconfigs and adds RN test run.
sdk/core/core-rest-pipeline/eslint.config.mjs Aligns eslint config shape with other core packages; points parser project to ./config/tsconfig.lint.json.
sdk/core/core-rest-pipeline/config/tsconfig.*.json Adds per-platform src/test/samples/snippets/lint tsconfigs extending eng/tsconfigs.

Comment thread sdk/core/core-rest-pipeline/src/util/createFile-browser.mts Outdated
Comment thread sdk/core/core-rest-pipeline/src/util/file.ts Outdated
Comment thread sdk/core/core-rest-pipeline/src/util/createFile.ts Outdated
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@deyaaeldeen deyaaeldeen force-pushed the platform-imports/core-rest-pipeline branch from a3cb68f to 7c19ac8 Compare April 20, 2026 19:55
deyaaeldeen and others added 3 commits April 24, 2026 01:33
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Comment thread sdk/core/core-rest-pipeline/review/core-rest-pipeline-node.api.md
Comment thread sdk/core/core-rest-pipeline/src/constants.ts
Comment thread sdk/core/core-rest-pipeline/package.json
@deyaaeldeen deyaaeldeen merged commit 8d8b5b5 into main Apr 24, 2026
32 checks passed
@deyaaeldeen deyaaeldeen deleted the platform-imports/core-rest-pipeline branch April 24, 2026 19:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants