Skip to content

feat(core/core-xml): migrate to #platform/* imports#38209

Merged
deyaaeldeen merged 3 commits intomainfrom
platform-imports/core-xml
Apr 24, 2026
Merged

feat(core/core-xml): migrate to #platform/* imports#38209
deyaaeldeen merged 3 commits intomainfrom
platform-imports/core-xml

Conversation

@deyaaeldeen
Copy link
Copy Markdown
Member

@deyaaeldeen deyaaeldeen commented Apr 18, 2026

Migrate @azure/core-xml to #platform/* conditional imports.

Changes

  • #platform/xml — routes XML parsing/serialization to the correct implementation per platform:
    • Node (xml.ts): uses fast-xml-parser (pure JS, no DOM dependency)
    • Browser (xml-browser.mts): uses native DOM APIs (DOMParser, XMLSerializer)
    • React Native (xml.ts): same as Node — RN has no DOM, so it uses fast-xml-parser
  • Per-platform tsconfigs under config/
  • Updated warp.config.yml to use per-package tsconfigs instead of root-level ones
  • Added vitest.react-native.config.ts and test:react-native script
  • Migrated from root-level tsconfig.*.json / tsconfig.browser.config.json to shared eng/tsconfigs/ base configs

React Native rationale

On main, the RN build accidentally fell back to xml.ts because the polyfillSuffix: "-react-native" target looked for xml-react-native.mts which did not exist. This PR makes the RN→Node mapping explicit and intentional: fast-xml-parser is pure JavaScript and works in all runtimes, while the browser implementation depends on DOM APIs (document, DOMParser, Node, XMLSerializer) that are not available in React Native.

@deyaaeldeen deyaaeldeen force-pushed the platform-imports/core-xml branch 7 times, most recently from 908c484 to 875bbe7 Compare April 19, 2026 17:32
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@deyaaeldeen deyaaeldeen force-pushed the platform-imports/core-xml branch from 875bbe7 to 5a86e4f Compare April 20, 2026 19:16
@deyaaeldeen deyaaeldeen marked this pull request as ready for review April 20, 2026 19:16
@deyaaeldeen deyaaeldeen requested a review from a team as a code owner April 20, 2026 19:16
Copilot AI review requested due to automatic review settings April 20, 2026 19:16
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-xml to Warp/TypeScript’s #platform/* conditional import pattern so the package builds the correct XML implementation per target (browser DOM vs Node/React Native fast-xml-parser) and standardizes per-target TypeScript/Vitest configuration under config/ and eng/tsconfigs.

Changes:

  • Switch public entrypoint to export … from "#platform/xml" and add a package.json#imports mapping for browser/react-native/default platform resolution.
  • Move to per-target tsconfigs under sdk/core/core-xml/config/ and update warp.config.yml to use them.
  • Add React Native Vitest config + script and align browser Vitest config to shared eng/vitestconfigs/*.

Reviewed changes

Copilot reviewed 20 out of 20 changed files in this pull request and generated no comments.

Show a summary per file
File Description
sdk/core/core-xml/warp.config.yml Point Warp targets at per-package tsconfigs under config/ (and drop polyfill suffix usage).
sdk/core/core-xml/vitest.react-native.config.ts Re-export shared React Native Vitest config.
sdk/core/core-xml/vitest.browser.config.ts Re-export shared browser Vitest config.
sdk/core/core-xml/tsconfig.json Replace legacy references with per-target config/ references (src/test/samples/snippets).
sdk/core/core-xml/src/xml-browser.mts Simplify parseXML implementation (async flow) and minor catch cleanup.
sdk/core/core-xml/src/index.ts Route XML APIs through #platform/xml instead of a fixed relative import.
sdk/core/core-xml/package.json Add imports["#platform/xml"] mapping; update scripts to use new config locations and add RN test run.
sdk/core/core-xml/eslint.config.mjs Add local flat-config ESLint setup using config/tsconfig.lint.json.
sdk/core/core-xml/config/tsconfig.test.react-native.json New RN test tsconfig extending shared eng/tsconfigs.
sdk/core/core-xml/config/tsconfig.test.browser.json New browser test tsconfig extending shared eng/tsconfigs.
sdk/core/core-xml/config/tsconfig.src.react-native.json New RN src tsconfig extending shared eng/tsconfigs.
sdk/core/core-xml/config/tsconfig.src.browser.json New browser src tsconfig extending shared eng/tsconfigs.
sdk/core/core-xml/tsconfig.test.node.json Removed legacy test tsconfig (replaced by config/tsconfig.test.node.json).
sdk/core/core-xml/tsconfig.test.json Removed legacy aggregator test tsconfig (replaced by package tsconfig.json references).
sdk/core/core-xml/tsconfig.src.json Removed legacy src tsconfig (replaced by per-target config/ tsconfigs).
sdk/core/core-xml/tsconfig.src.build.json Removed legacy build tsconfig (replaced by per-target config/ tsconfigs).
sdk/core/core-xml/tsconfig.src.browser.json Removed legacy browser src tsconfig (replaced by config/tsconfig.src.browser.json).
sdk/core/core-xml/tsconfig.snippets.json Removed legacy snippets tsconfig (replaced by config/tsconfig.snippets.json).
sdk/core/core-xml/tsconfig.samples.json Removed legacy samples tsconfig (replaced by config/tsconfig.samples.json).
sdk/core/core-xml/tsconfig.browser.config.json Removed legacy browser test config tsconfig (replaced by config/tsconfig.test.browser.json).

deyaaeldeen and others added 2 commits April 24, 2026 01:30
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@deyaaeldeen deyaaeldeen merged commit 419ea4f into main Apr 24, 2026
32 checks passed
@deyaaeldeen deyaaeldeen deleted the platform-imports/core-xml branch April 24, 2026 22:16
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