Skip to content

fix: switch to named imports for @sap/ux-specification 1.144.13 ESM compatibility - #5419

Draft
fionan-SAP wants to merge 7 commits into
mainfrom
fix/ux-specification-named-imports
Draft

fionan-SAP wants to merge 7 commits into
mainfrom
fix/ux-specification-named-imports

Conversation

@fionan-SAP

Copy link
Copy Markdown
Contributor

Summary

@sap/ux-specification 1.144.13 ships as pure ESM (main: dist/index-min.mjs) with no CJS fallback. The previous pattern of import uxSpec from '@sap/ux-specification'; const { X } = uxSpec fails at runtime because ESM modules without a default export cannot be imported that way.

Supersedes #5280 (closed — branch was contaminated with stale merge commits and unrelated changes across 150+ files).

Changes:

  • fiori-mcp-server/src — Replace all default import + destructure patterns with direct named imports across 8 source files
  • fiori-mcp-server/src/page-editor-api/sapuxFtfsFileIO.ts — Fix writeFPM to skip minUI5Version for the FPMFragment union member (which has no such property in the 1.144.13 types)
  • fiori-mcp-server/scripts/bundle.mjs — Fix post-processing regex to match $-prefixed require vars on Linux
  • fiori-mcp-server/jest.config.mjs — Exclude @sap/ux-specification from modulePathIgnorePatterns to prevent OOM; update mock routing
  • fiori-mcp-server/eslint.config.mjs — Add @sap/ux-specification to import/no-unresolved ignore list (1.144.13 dropped root types field)
  • fiori-mcp-server/test/__mocks__/@sap/ux-specification.mjs — Update mock to use await import() with absolute path (1.144.13 is ESM-only)
  • fiori-mcp-server/test/__mocks__ — Remove duplicate .cjs stubs for @sap-devx/yeoman-ui-types and @sap-ux/adp-tooling (jest-haste-map duplicate mock error)
  • ui5-test-writer/src — Replace deep dist/types/src/parser/index.js subpaths with public Parser namespace from @sap/ux-specification/dist/types/src (subpaths removed in 1.144.13)
  • ui5-test-writer — Remove 1.120 OPA template bucket (spec no longer returns data for that version range in 1.144.13); delete 25 template files, update snapshots and tests
  • Changesets — patch for fiori-mcp-server, ui5-test-writer, generator-odata-downloader; cascade for fiori-tools-plugin

Type of change

  • Bug (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds a new feature)
  • Breaking change
  • Non-Breaking chores

Test plan

  • pnpm --filter @sap-ux/fiori-mcp-server test
  • pnpm --filter @sap-ux/ui5-test-writer test
  • pnpm --filter @sap-ux/generator-odata-downloader test
  • pnpm lint
  • pnpm validate:changesets
  • Full CI run

…ompatibility

@sap/ux-specification 1.144.13 ships as pure ESM (main: dist/index-min.mjs).
Default imports via `import uxSpec from '@sap/ux-specification'` fail because
ESM modules with no default export cannot be used that way.

- Replace all `import uxSpec from '@sap/ux-specification'; const { X } = uxSpec`
  patterns with direct named imports across fiori-mcp-server src
- Update ui5-test-writer type imports to use the public Parser namespace
  instead of deep dist/ subpaths removed in 1.144.13
- Remove 1.120 OPA template bucket from ui5-test-writer (ux-specification
  1.144.13 no longer returns spec data for that version range)
- Fix writeFPM to skip minUI5Version for FPMFragment union member
- Fix bundle post-processing regex to match $-prefixed require vars on Linux
- Remove duplicate CJS manual mocks (.cjs + .mjs) to fix jest-haste-map errors
- Update ux-specification ESM mock to use await import() with absolute path
- Regenerate affected test snapshots and functionality counts
@changeset-bot

changeset-bot Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 26b2f29

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 10 packages
Name Type
@sap-ux/fiori-mcp-server Patch
@sap-ux/fiori-tools-plugin Patch
@sap-ux/ui5-test-writer Patch
@sap-ux/generator-odata-downloader Patch
@sap-ux/create Patch
@sap-ux/fiori-elements-writer Patch
@sap-ux/fiori-freestyle-writer Patch
@sap-ux/fiori-app-sub-generator Patch
@sap-ux/repo-app-import-sub-generator Patch
@sap-ux/generator-simple-fe Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@hyperspace-pr-bot

Copy link
Copy Markdown
Contributor

Summary

The following content is AI-generated and provides a summary of the pull request:


Description

Title: Fix ux-specification ESM compatibility and OPA generation

Aligns consumers with @sap/ux-specification 1.144.13 to avoid incompatible imports and keep MCP bundling and generated OPA tests working.

  • Replace MCP default imports with named exports and migrate UI5 test-writer imports to consolidated exports and Parser types.
  • Skip unsupported minUI5Version assignment for FPM fragments.
  • Package lz-string alongside the MCP bundle and handle $-prefixed require identifiers.
  • Update Jest exclusions, ESM mocks and ESLint resolution; remove duplicate mocks and legacy MCP test-client mode.
  • Remove the 1.120 OPA template bucket, routing versions below 1.148 to 1.84; restore column, section and sort assertions.
  • Adjust generated journey arguments, identifier casts, page construction and chaining types.
  • Refresh fixtures, snapshots and functionality counts; add patch changesets for affected packages and the plugin cascade.

Type of change

  • Bug (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds a new feature)
  • Breaking change (Bug or New feature that would cause existing functionality/consumers to not work as expected)
  • Non-Breaking chores (Changes to tools, libraries, build process, documentation, etc)
  • None of the above (Reviewers might ask for more clarification)

How have you tested?

Execution results were not provided for this PR. Pending verification:

  • pnpm --filter @sap-ux/fiori-mcp-server test
  • pnpm --filter @sap-ux/ui5-test-writer test
  • pnpm --filter @sap-ux/generator-odata-downloader test
  • pnpm lint
  • pnpm validate:changesets
  • Full CI run

Checklist:

  • The code conforms to the general development principles
  • Supplied as many details as possible on this change
  • The code is easy to read and maintainable by others
  • Corresponding changes to the documentation has been done
  • Already existing and new unit tests pass locally
  • I have reviewed and addressed all Hyperspace bot findings (or explicitly explained dismissals)
  • I have done an Agentic review

Supersedes #5280.


  • 🔄 Regenerate and Update Summary
  • ✏️ Insert as PR Description (deletes this comment)
  • 🗑️ Delete comment
PR Bot Information

Version: 1.33.58

…pecification types

@sap/ux-specification has no exports map, so the shortened
'@sap/ux-specification/dist/types/src' path is not resolvable by TypeScript.
Revert to the explicit file paths that worked before.
…specification 1.144.5

The lz-string Step 1c block was added for @sap/ux-specification 1.144.13 which
uses createRequire to load lz-string at runtime. This branch uses 1.144.5 which
has no lz-string dependency, so the step always threw "No createRequire-based
require("lz-string") found in bundle".
Update OPA journey template expected outputs and Jest snapshots in
fiori-elements-writer and fiori-app-sub-generator to reflect the new
ui5-test-writer OPA journey templates (FirstJourney.js replacing the
old per-entity *Journey.gen.js files for lrop_v4, worklist_v4,
fpm_v4, lrop_v4_ui5_1_120_4).
fionan-SAP and others added 2 commits November 20, 2026 15:32
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

This branch was successfully deployed

No deployments
ci-secrets — 5cf77662 Deployed Nov 16, 2026 by fionan-SAP via build (ubuntu-latest, 22.x) #79522
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant