Skip to content

Conversation

@Roaders
Copy link
Contributor

@Roaders Roaders commented Sep 25, 2025

Describe your change

This is an initial attempt to fis the module formats of the libraries published from this repo. I think that the current issues with the published packages are:

  • despite using ESM2022 module format the tpye of the package is not marked as module - this means that node does not know that it should treat the files as mjs rather than cjs
  • module resolution is not set to NodeNext which means that we do not specify extensions on our imports and esm consuming apps will not be able to consume the files (unless bundler magic deals with this which I think webpack and angular build systems do)

To fix these issues this PR:

  • marks published libraries as "type": "module"
  • sets module resolution to "NodeNext"
  • adds extensions to imports

Related Issue

fixes #1609

Contributor License Agreement

  • I acknowledge that a contributor license agreement is required and that I have one in place or will seek to put one in place ASAP.

Review Checklist

  • Issue: If a change was made to the FDC3 Standard, was an issue linked above?
  • CHANGELOG: Is a CHANGELOG.md entry included?
  • API changes: Does this PR include changes to any of the FDC3 APIs (DesktopAgent, Channel, PrivateChannel, Listener, Bridging)?
    • Docs & Sources: If yes, were both documentation (/docs) and sources updated?

      JSDoc comments on interfaces and types should be matched to the main documentation in /docs
    • Conformance tests: If yes, are conformance test definitions (/toolbox/fdc3-conformance) still correct and complete?

      Conformance test definitions should cover all required aspects of an FDC3 Desktop Agent implementation, which are usually marked with a MUST keyword, and optional features (SHOULD or MAY) where the format of those features is defined
    • Schemas: If yes, were changes applied to the Bridging and FDC3 for Web protocol schemas?

      The Web Connection protocol and Desktop Agent Communication Protocol schemas must be able to support all necessary aspects of the Desktop Agent API, while Bridging must support those aspects necessary for Desktop Agents to communicate with each other
      • If yes, was code generation (npm run build) run and the results checked in?

        Generated code will be found at /src/api/BrowserTypes.ts and/or /src/bridging/BridgingTypes.ts
  • Context types: Were new Context type schemas created or modified in this PR?
    • Were the field type conventions adhered to?
    • Was the BaseContext schema applied via allOf (as it is in existing types)?
    • Was a title and description provided for all properties defined in the schema?
    • Was at least one example provided?
    • Was code generation (npm run build) run and the results checked in?

      Generated code will be found at /src/context/ContextTypes.ts
  • Intents: Were new Intents created in this PR?

THIS SOFTWARE IS CONTRIBUTED SUBJECT TO THE TERMS OF THE FINOS CORPORATE CONTRIBUTOR LICENSE AGREEMENT.

THIS SOFTWARE IS LICENSED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE AND ANY WARRANTY OF NON-INFRINGEMENT, ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. THIS SOFTWARE MAY BE REDISTRIBUTED TO OTHERS ONLY BY EFFECTIVELY USING THIS OR ANOTHER EQUIVALENT DISCLAIMER IN ADDITION TO ANY OTHER REQUIRED LICENSE TERMS.

@Roaders Roaders requested a review from a team as a code owner September 25, 2025 16:43
@netlify
Copy link

netlify bot commented Sep 25, 2025

Deploy Preview for fdc3 ready!

Name Link
🔨 Latest commit 6ae93bb
🔍 Latest deploy log https://app.netlify.com/projects/fdc3/deploys/6968e05e22aa9f00082234d1
😎 Deploy Preview https://deploy-preview-1677.preview-fdc3.finos.org
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@Roaders Roaders marked this pull request as draft September 25, 2025 16:43
@Roaders
Copy link
Contributor Author

Roaders commented Sep 25, 2025

Currently this PR successfully builds all packages but it does not run the demo app when npm run dev is executed. There are issues with the demo web server.

The testing and fdc3-conformance packages are not converted to ESM as there were issues there with some imports (AJV seems to be used in a non standard way that ESM was not happy with) not working and other issues. As these are not publiushed I think this is OK.

I still need to get the demo server working correctly but I ran out of time today.

@Roaders
Copy link
Contributor Author

Roaders commented Sep 25, 2025

I imagine this PR will be a merge nightmare as it has touched so many files.... I don't know what the best way to deal with that will be.

@kriswest
Copy link
Contributor

kriswest commented Oct 9, 2025

@Roaders

I imagine this PR will be a merge nightmare as it has touched so many files.... I don't know what the best way to deal with that will be.

I don't think it will be that bad as most of the changes are in the imports into files. It would pick up conflicts with new additions, but won't with many other PRs. Regardless, we should try and get this done and merged ASAP.

@hughtroeger has offered to try and get this tested as a solution for @enewsome's issue #1609

However, the tests / cucumber see quite unhappy with the change and need further work. The SAST scan failing is down to the rename of a script file that needs to be in .semgrepignore here:

FDC3/.semgrepignore

Lines 4 to 5 in 16100f5

s2tQuicktypeUtil.js
t2sQuicktypeUtil.js
(.js extension changes to .cjs)

@Roaders
Copy link
Contributor Author

Roaders commented Oct 9, 2025

yes I think that the tests will be an issue. Converting to ESM is usually fairly painless other than things liks jest / karma / webpack / ts-node. I have already replaced ts-node with tsx as it's much happier with esm but have no idea how hard it will be to convince the testing framework to work - especially as I have no experience with this test runner.

@Roaders
Copy link
Contributor Author

Roaders commented Oct 14, 2025

I've spent a bit more time on this today and it's not good news I am afraid....
Apparently everything now builds correctly with no errors.... but unfortunately when I try to run the demo app I get runtime errors about not being able to find certain imports so more work is obviously required there.
The other issue that could take much longer to fix is the tests as @kriswest mentioned before. Cucumber does apparently support esm but I don't know if nyc does (I have never come across nyc before and have not done anything with cucumber for a very long time).
After a quick google it seems that nyc is supposed to support ESM through node's own esm loader. I have not had much luck with that which is why I have replaces ts-node with tsx.

This could end up being a much bigger job that we first thought.

@Roaders
Copy link
Contributor Author

Roaders commented Nov 4, 2025

I have confirmed that the fixes that I have put into this PR so far have fixed my issues when trying to run vitest in my local app. This is the case where my lib depends on @morgan-stanley/fdc3-web which depends on @finos/fdc3 and fails due to there being no file extensions on any of the imports.

The fix is good.... we "just" need to get the rest of the tooling in the mono repo working in an esm environment.

@kriswest
Copy link
Contributor

kriswest commented Nov 4, 2025

The fix is good.... we "just" need to get the rest of the tooling in the mono repo working in an esm environment.

Many thanks for your work on this issue @Roaders! @hughtroeger and @enewsome it would be worth confirming if this branch resolves some of your issues...

@Roaders which tooling most needs looking at?

  • You mentioned nyc,
  • semgrep needs its ignore file updating (s2tQuicktypeUtil.cjs change extension so is not being ignored),
  • CVE scanning with audit.js is broken on main (@robmoffat can we get FINOS' help with that - could be an account issue: https://github.com/finos/FDC3/actions/runs/19058409074/job/54433286532)
  • Lots seems broken in the tests - so I assume this is the area most in need of looking at...

@hughtroeger
Copy link
Contributor

Also want to express thanks for working on this @Roaders. We will test the changes in this PR and get back to you shortly.

@Roaders
Copy link
Contributor Author

Roaders commented Nov 6, 2025

I'm afraid that to test it you're going to have to check it out locally and build it locally then install each of the built packages one by one in your app. This worked for me. It's the tests that are not working in the PR.

@hughtroeger
Copy link
Contributor

@Roaders understood, I have built this branch and npm packed each of the individual packages and handed them over to @enewsome for testing. Thanks!

@Roaders Roaders force-pushed the esm-modules-fix branch 2 times, most recently from 2ec636c to e9f62f0 Compare January 15, 2026 12:14
@github-actions
Copy link

@github-actions
Copy link

Coverage Report

Commit: 6ae93bb
Base: main@7befa21

Type Base This PR
Total Statements Coverage  97.16%  96.29% (-0.87%)
Total Branches Coverage  86%  90.89% (+4.89%)
Total Functions Coverage  96.13%  97.04% (+0.91%)
Total Lines Coverage  97.32%  96.29% (-1.03%)
Details (changed files)
FileStatementsBranchesFunctionsLines
packages/fdc3-agent-proxy/src/DesktopAgentProxy.ts 100% 100% 100% 100%
packages/fdc3-agent-proxy/src/Messaging.ts 100% 100% 100% 100%
packages/fdc3-agent-proxy/src/index.ts 100% 100% 100% 100%
packages/fdc3-agent-proxy/src/apps/DefaultAppSupport.ts 86.45% 77.77% 100% 86.45%
packages/fdc3-agent-proxy/src/channels/DefaultChannel.ts 80% 100% 75% 80%
packages/fdc3-agent-proxy/src/channels/DefaultChannelSupport.ts 99.04% 97.22% 100% 99.04%
packages/fdc3-agent-proxy/src/channels/DefaultPrivateChannel.ts 98.93% 82.35% 100% 98.93%
packages/fdc3-agent-proxy/src/heartbeat/DefaultHeartbeatSupport.ts 100% 100% 100% 100%
packages/fdc3-agent-proxy/src/intents/DefaultIntentResolution.ts 100% 100% 100% 100%
packages/fdc3-agent-proxy/src/intents/DefaultIntentSupport.ts 100% 100% 100% 100%
packages/fdc3-agent-proxy/src/listeners/AbstractListener.ts 97.18% 57.14% 100% 97.18%
packages/fdc3-agent-proxy/src/listeners/DefaultContextListener.ts 100% 91.66% 100% 100%
packages/fdc3-agent-proxy/src/listeners/DefaultIntentListener.ts 100% 87.5% 100% 100%
packages/fdc3-agent-proxy/src/listeners/EventListener.ts 100% 100% 100% 100%
packages/fdc3-agent-proxy/src/listeners/HeartbeatListener.ts 100% 100% 100% 100%
packages/fdc3-agent-proxy/src/listeners/PrivateChannelEventListener.ts 95.89% 83.33% 100% 95.89%
packages/fdc3-agent-proxy/src/listeners/RegisterableListener.ts 100% 100% 100% 100%
packages/fdc3-agent-proxy/src/listeners/UserChannelContextListener.ts 100% 100% 100% 100%
packages/fdc3-agent-proxy/src/messaging/AbstractMessaging.ts 95% 100% 75% 95%
packages/fdc3-agent-proxy/src/util/Logger.ts 57.14% 50% 50% 57.14%
packages/fdc3-agent-proxy/src/util/throwIfUndefined.ts 100% 100% 100% 100%
packages/fdc3-get-agent/src/index.ts 100% 100% 100% 100%
packages/fdc3-get-agent/src/messaging/MessagePortMessaging.ts 100% 100% 100% 100%
packages/fdc3-get-agent/src/messaging/message-port.ts 98.27% 81.81% 100% 98.27%
packages/fdc3-get-agent/src/sessionStorage/DesktopAgentDetails.ts 96.87% 88.23% 100% 96.87%
packages/fdc3-get-agent/src/strategies/DesktopAgentPreloadLoader.ts 100% 80.95% 100% 100%
packages/fdc3-get-agent/src/strategies/FailoverHandler.ts 100% 81.81% 100% 100%
packages/fdc3-get-agent/src/strategies/HelloHandler.ts 87.27% 83.33% 100% 87.27%
packages/fdc3-get-agent/src/strategies/IdentityValidationHandler.ts 89.58% 73.33% 100% 89.58%
packages/fdc3-get-agent/src/strategies/PostMessageLoader.ts 98.3% 88% 100% 98.3%
packages/fdc3-get-agent/src/strategies/getAgent.ts 100% 100% 100% 100%
packages/fdc3-get-agent/src/ui/AbstractUIComponent.ts 91.04% 91.66% 100% 91.04%
packages/fdc3-get-agent/src/ui/DefaultDesktopAgentChannelSelector.ts 100% 88.88% 100% 100%
packages/fdc3-get-agent/src/ui/DefaultDesktopAgentIntentResolver.ts 100% 90% 100% 100%
packages/fdc3-standard/src/index.ts 100% 100% 100% 100%
packages/fdc3-standard/src/api/AppIntent.ts 100% 100% 100% 100%
packages/fdc3-standard/src/api/AppMetadata.ts 100% 100% 100% 100%
packages/fdc3-standard/src/api/Channel.ts 100% 100% 100% 100%
packages/fdc3-standard/src/api/ContextMetadata.ts 100% 100% 100% 100%
packages/fdc3-standard/src/api/DesktopAgent.ts 100% 100% 100% 100%
packages/fdc3-standard/src/api/GetAgent.ts 100% 100% 100% 100%
packages/fdc3-standard/src/api/ImplementationMetadata.ts 100% 100% 100% 100%
packages/fdc3-standard/src/api/IntentMetadata.ts 100% 100% 100% 100%
packages/fdc3-standard/src/api/IntentResolution.ts 100% 100% 100% 100%
packages/fdc3-standard/src/api/Methods.ts 94.2% 85.18% 100% 94.2%
packages/fdc3-standard/src/api/PrivateChannel.ts 100% 100% 100% 100%
packages/fdc3-standard/src/api/RecommendedChannels.ts 100% 100% 100% 100%
packages/fdc3-standard/src/api/Types.ts 100% 100% 100% 100%
packages/fdc3-standard/src/internal/contextConfiguration.ts 100% 100% 100% 100%
packages/fdc3-standard/src/internal/intentConfiguration.ts 100% 100% 100% 100%
packages/fdc3-standard/src/ui/ChannelSelector.ts 100% 100% 100% 100%
packages/fdc3-standard/src/ui/IntentResolver.ts 100% 100% 100% 100%
toolbox/fdc3-for-web/fdc3-web-impl/src/BasicFDC3Server.ts 100% 100% 100% 100%
toolbox/fdc3-for-web/fdc3-web-impl/src/FDC3Server.ts 100% 100% 100% 100%
toolbox/fdc3-for-web/fdc3-web-impl/src/ServerContext.ts 100% 100% 100% 100%
toolbox/fdc3-for-web/fdc3-web-impl/src/index.ts 0% 0% 0% 0%
toolbox/fdc3-for-web/fdc3-web-impl/src/directory/BasicDirectory.ts 98.64% 90% 100% 98.64%
toolbox/fdc3-for-web/fdc3-web-impl/src/directory/DirectoryInterface.ts 100% 100% 100% 100%
toolbox/fdc3-for-web/fdc3-web-impl/src/handlers/BroadcastHandler.ts 97.88% 90.65% 100% 97.88%
toolbox/fdc3-for-web/fdc3-web-impl/src/handlers/HeartbeatHandler.ts 92.59% 87.87% 87.5% 92.59%
toolbox/fdc3-for-web/fdc3-web-impl/src/handlers/IntentHandler.ts 97.4% 96.72% 100% 97.4%
toolbox/fdc3-for-web/fdc3-web-impl/src/handlers/OpenHandler.ts 98.29% 92.3% 100% 98.29%
toolbox/fdc3-for-web/fdc3-web-impl/src/handlers/support.ts 100% 100% 100% 100%
Details (all files)
FileStatementsBranchesFunctionsLines
packages/fdc3-agent-proxy/src/DesktopAgentProxy.ts 100% 100% 100% 100%
packages/fdc3-agent-proxy/src/Messaging.ts 100% 100% 100% 100%
packages/fdc3-agent-proxy/src/index.ts 100% 100% 100% 100%
packages/fdc3-agent-proxy/src/apps/AppSupport.ts 100% 100% 100% 100%
packages/fdc3-agent-proxy/src/apps/DefaultAppSupport.ts 86.45% 77.77% 100% 86.45%
packages/fdc3-agent-proxy/src/channels/ChannelSupport.ts 100% 100% 100% 100%
packages/fdc3-agent-proxy/src/channels/DefaultChannel.ts 80% 100% 75% 80%
packages/fdc3-agent-proxy/src/channels/DefaultChannelSupport.ts 99.04% 97.22% 100% 99.04%
packages/fdc3-agent-proxy/src/channels/DefaultPrivateChannel.ts 98.93% 82.35% 100% 98.93%
packages/fdc3-agent-proxy/src/heartbeat/DefaultHeartbeatSupport.ts 100% 100% 100% 100%
packages/fdc3-agent-proxy/src/heartbeat/HeartbeatSupport.ts 100% 100% 100% 100%
packages/fdc3-agent-proxy/src/intents/DefaultIntentResolution.ts 100% 100% 100% 100%
packages/fdc3-agent-proxy/src/intents/DefaultIntentSupport.ts 100% 100% 100% 100%
packages/fdc3-agent-proxy/src/intents/IntentSupport.ts 100% 100% 100% 100%
packages/fdc3-agent-proxy/src/listeners/AbstractListener.ts 97.18% 57.14% 100% 97.18%
packages/fdc3-agent-proxy/src/listeners/DefaultContextListener.ts 100% 91.66% 100% 100%
packages/fdc3-agent-proxy/src/listeners/DefaultIntentListener.ts 100% 87.5% 100% 100%
packages/fdc3-agent-proxy/src/listeners/EventListener.ts 100% 100% 100% 100%
packages/fdc3-agent-proxy/src/listeners/HeartbeatListener.ts 100% 100% 100% 100%
packages/fdc3-agent-proxy/src/listeners/PrivateChannelEventListener.ts 95.89% 83.33% 100% 95.89%
packages/fdc3-agent-proxy/src/listeners/RegisterableListener.ts 100% 100% 100% 100%
packages/fdc3-agent-proxy/src/listeners/UserChannelContextListener.ts 100% 100% 100% 100%
packages/fdc3-agent-proxy/src/messaging/AbstractMessaging.ts 95% 100% 75% 95%
packages/fdc3-agent-proxy/src/util/AbstractFDC3Logger.ts 83.56% 69.23% 91.66% 83.56%
packages/fdc3-agent-proxy/src/util/Logger.ts 57.14% 50% 50% 57.14%
packages/fdc3-agent-proxy/src/util/throwIfUndefined.ts 100% 100% 100% 100%
packages/fdc3-get-agent/src/Fdc3Version.ts 0% 0% 0% 0%
packages/fdc3-get-agent/src/index.ts 100% 100% 100% 100%
packages/fdc3-get-agent/src/apps/NoopAppSupport.ts 0% 100% 100% 0%
packages/fdc3-get-agent/src/messaging/MessagePortMessaging.ts 100% 100% 100% 100%
packages/fdc3-get-agent/src/messaging/message-port.ts 98.27% 81.81% 100% 98.27%
packages/fdc3-get-agent/src/sessionStorage/DesktopAgentDetails.ts 96.87% 88.23% 100% 96.87%
packages/fdc3-get-agent/src/strategies/DesktopAgentPreloadLoader.ts 100% 80.95% 100% 100%
packages/fdc3-get-agent/src/strategies/FailoverHandler.ts 100% 81.81% 100% 100%
packages/fdc3-get-agent/src/strategies/HelloHandler.ts 87.27% 83.33% 100% 87.27%
packages/fdc3-get-agent/src/strategies/IdentityValidationHandler.ts 89.58% 73.33% 100% 89.58%
packages/fdc3-get-agent/src/strategies/Loader.ts 100% 100% 100% 100%
packages/fdc3-get-agent/src/strategies/PostMessageLoader.ts 98.3% 88% 100% 98.3%
packages/fdc3-get-agent/src/strategies/Timeouts.ts 100% 100% 100% 100%
packages/fdc3-get-agent/src/strategies/getAgent.ts 100% 100% 100% 100%
packages/fdc3-get-agent/src/ui/AbstractUIComponent.ts 91.04% 91.66% 100% 91.04%
packages/fdc3-get-agent/src/ui/DefaultDesktopAgentChannelSelector.ts 100% 88.88% 100% 100%
packages/fdc3-get-agent/src/ui/DefaultDesktopAgentIntentResolver.ts 100% 90% 100% 100%
packages/fdc3-get-agent/src/ui/NullChannelSelector.ts 100% 100% 100% 100%
packages/fdc3-get-agent/src/ui/NullIntentResolver.ts 100% 100% 66.66% 100%
packages/fdc3-get-agent/src/util/Logger.ts 62.5% 100% 50% 62.5%
packages/fdc3-get-agent/src/util/Uuid.ts 100% 100% 100% 100%
packages/fdc3-standard/src/index.ts 100% 100% 100% 100%
packages/fdc3-standard/src/api/AppIdentifier.ts 100% 100% 100% 100%
packages/fdc3-standard/src/api/AppIntent.ts 100% 100% 100% 100%
packages/fdc3-standard/src/api/AppMetadata.ts 100% 100% 100% 100%
packages/fdc3-standard/src/api/Channel.ts 100% 100% 100% 100%
packages/fdc3-standard/src/api/ContextMetadata.ts 100% 100% 100% 100%
packages/fdc3-standard/src/api/DesktopAgent.ts 100% 100% 100% 100%
packages/fdc3-standard/src/api/DesktopAgentIdentifier.ts 100% 100% 100% 100%
packages/fdc3-standard/src/api/DisplayMetadata.ts 100% 100% 100% 100%
packages/fdc3-standard/src/api/Errors.ts 100% 100% 100% 100%
packages/fdc3-standard/src/api/Events.ts 100% 100% 100% 100%
packages/fdc3-standard/src/api/GetAgent.ts 100% 100% 100% 100%
packages/fdc3-standard/src/api/Icon.ts 100% 100% 100% 100%
packages/fdc3-standard/src/api/Image.ts 100% 100% 100% 100%
packages/fdc3-standard/src/api/ImplementationMetadata.ts 100% 100% 100% 100%
packages/fdc3-standard/src/api/IntentMetadata.ts 100% 100% 100% 100%
packages/fdc3-standard/src/api/IntentResolution.ts 100% 100% 100% 100%
packages/fdc3-standard/src/api/Listener.ts 100% 100% 100% 100%
packages/fdc3-standard/src/api/Methods.ts 94.2% 85.18% 100% 94.2%
packages/fdc3-standard/src/api/PrivateChannel.ts 100% 100% 100% 100%
packages/fdc3-standard/src/api/RecommendedChannels.ts 100% 100% 100% 100%
packages/fdc3-standard/src/api/Types.ts 100% 100% 100% 100%
packages/fdc3-standard/src/context/ContextType.ts 100% 100% 100% 100%
packages/fdc3-standard/src/intents/Intents.ts 100% 100% 100% 100%
packages/fdc3-standard/src/internal/contextConfiguration.ts 100% 100% 100% 100%
packages/fdc3-standard/src/internal/intentConfiguration.ts 100% 100% 100% 100%
packages/fdc3-standard/src/internal/typeHelpers.ts 100% 100% 100% 100%
packages/fdc3-standard/src/ui/ChannelSelector.ts 100% 100% 100% 100%
packages/fdc3-standard/src/ui/Connectable.ts 100% 100% 100% 100%
packages/fdc3-standard/src/ui/IntentResolver.ts 100% 100% 100% 100%
toolbox/fdc3-for-web/fdc3-web-impl/src/BasicFDC3Server.ts 100% 100% 100% 100%
toolbox/fdc3-for-web/fdc3-web-impl/src/FDC3Server.ts 100% 100% 100% 100%
toolbox/fdc3-for-web/fdc3-web-impl/src/ServerContext.ts 100% 100% 100% 100%
toolbox/fdc3-for-web/fdc3-web-impl/src/index.ts 0% 0% 0% 0%
toolbox/fdc3-for-web/fdc3-web-impl/src/directory/BasicDirectory.ts 98.64% 90% 100% 98.64%
toolbox/fdc3-for-web/fdc3-web-impl/src/directory/DirectoryInterface.ts 100% 100% 100% 100%
toolbox/fdc3-for-web/fdc3-web-impl/src/handlers/BroadcastHandler.ts 97.88% 90.65% 100% 97.88%
toolbox/fdc3-for-web/fdc3-web-impl/src/handlers/HeartbeatHandler.ts 92.59% 87.87% 87.5% 92.59%
toolbox/fdc3-for-web/fdc3-web-impl/src/handlers/IntentHandler.ts 97.4% 96.72% 100% 97.4%
toolbox/fdc3-for-web/fdc3-web-impl/src/handlers/OpenHandler.ts 98.29% 92.3% 100% 98.29%
toolbox/fdc3-for-web/fdc3-web-impl/src/handlers/support.ts 100% 100% 100% 100%

@Roaders
Copy link
Contributor Author

Roaders commented Jan 15, 2026

this pr now switches all of the testing over to vitest. It seems much faster to me, is a much more "standard" testing setup and works with esm. jest has been completely removed and nyc has been removed from most places. It is still used in the root package.json to generate a report. I guess we could probably do that another way but I'm not sure what it's doing so I didn't want to touch that.

@Roaders Roaders marked this pull request as ready for review January 15, 2026 12:49
});

setupGenericSteps();
// Inlined generic steps from @finos/testing (migrated to quickpickle)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok, we don't want to do this.....


export class CustomWorld extends PropsWorld {
messaging: TestMessaging | null = null;
export interface CustomWorldInterface extends QuickPickleWorldInterface {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

we are no longer extending PropsWorld here....

// for testing app launch timeouts the Mock server sets a 2 second timeout
// if that is ignored it defaults to 100 seconds so test should timeout and catch that
async function (this: CustomWorld, appId: string, field: string) {
async (world: CustomWorld, appId: string, field: string) => {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

we are no longer setting the 3 second timeout here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

where has this file come from?

},
});
});

Copy link
Contributor Author

Choose a reason for hiding this comment

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

put back this commented code


export class CustomWorld extends PropsWorld {
mockFDC3Server: MockFDC3Server | null = null;
export interface CustomWorldInterface extends QuickPickleWorldInterface {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

no longer extending PropsWorld

"files": ["dist"],
"scripts": {
"build": "tsc",
"test": "vitest run",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

missing tsc call

"build": "tsc",
"test": "vitest run",
"test:watch": "vitest",
"test:coverage": "vitest run --coverage",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

we can probably get rid of this script as coverage is calculated normally

Copy link
Contributor Author

Choose a reason for hiding this comment

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

remove BrowserTypes as it should not have changed

"import": "./dist/src/index.js",
"require": "./dist/src/index.js"
},
"./dist/src/agent": {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

do we need these additional exports?

world.server.shutdown();
});

// Inlined generic steps from @finos/testing (migrated to quickpickle)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

we don't want to do this

"nyc": "17.1.0",
"prettier": "3.4.1"
"tsx": "^4.20.5",
"pixelmatch": "^5.3.0",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

what is pixelmatch for?

Copy link
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 the FDC3 repository to proper ESM (ECMAScript Module) support by addressing module format issues in published packages. The changes enable Node.js and ESM-consuming applications to properly import FDC3 packages without bundler magic.

Changes:

  • Updated TypeScript compiler settings from CommonJS to NodeNext module resolution
  • Added "type": "module" to package.json files to mark packages as ESM
  • Added .js extensions to all relative imports to comply with ESM requirements
  • Migrated test framework from Jest/Cucumber to Vitest/Quickpickle for ESM compatibility
  • Fixed code generation utilities and import attribute syntax

Reviewed changes

Copilot reviewed 199 out of 204 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
tsconfig.root.json Updated module and moduleResolution to NodeNext for ESM support
packages/*/package.json Added "type": "module" and updated build/test scripts
packages//src/**/.ts Added .js extensions to relative imports for ESM compliance
toolbox/fdc3-workbench/src/**/*.tsx Added .js extensions and fixed import formatting
packages//test/**/.ts Migrated tests from Jest/Cucumber to Vitest/Quickpickle
packages/fdc3-schema/s2tQuicktypeUtil.cjs Renamed from .js to .cjs for proper CommonJS identification
packages/fdc3-standard/src/api/Channel.ts Fixed trailing whitespace issue
toolbox/fdc3-workbench/src/App.tsx Added CSS import attribute syntax

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

import { Intents } from './components/Intents.js';
import { AppChannels } from './components/AppChannels.js';
import snackbarStore from './store/SnackbarStore.js';
import './App.css' with { type: 'css' };
Copy link

Copilot AI Jan 15, 2026

Choose a reason for hiding this comment

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

Import attributes using with syntax are experimental and not yet standardized. For CSS imports in TypeScript/JavaScript applications, the standard approach is to use regular imports without attributes. Most bundlers (webpack, vite, etc.) handle CSS imports without the with { type: 'css' } syntax. This syntax is only needed for JSON modules and may not be supported by all tooling.

Copilot uses AI. Check for mistakes.
import * as draft7MetaSchema from 'ajv/dist/refs/json-schema-draft-07.json';
import addFormats from 'ajv-formats';
import * as AjvModule from 'ajv/dist/2019.js';
import * as draft7MetaSchema from 'ajv/dist/refs/json-schema-draft-07.json' with { type: 'json' };
Copy link

Copilot AI Jan 15, 2026

Choose a reason for hiding this comment

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

While JSON import attributes are part of the import attributes proposal, they require specific bundler/runtime support. Consider loading JSON files using fs.readFileSync and JSON.parse for better compatibility across different environments, especially for published packages that need to work in various contexts.

Copilot uses AI. Check for mistakes.
// used to debug tests not ending - only available as a commonJs module
// eslint-disable-next-line @typescript-eslint/no-require-imports
const wtf = require('wtfnode');
import wtf from 'wtfnode';
Copy link

Copilot AI Jan 15, 2026

Choose a reason for hiding this comment

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

The wtfnode import has been changed from require to ES import. Ensure that wtfnode is properly exported as an ES module. If it's a CommonJS-only package, you may need to use import * as wtf from 'wtfnode' or continue using dynamic import/require for compatibility.

Copilot uses AI. Check for mistakes.
TypeAliasDeclaration,
} from 'ts-morph';
import print from 'message-await';
import messageAwait, { MessageAwait } from 'message-await';
Copy link

Copilot AI Jan 15, 2026

Choose a reason for hiding this comment

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

Unused import MessageAwait.

Copilot uses AI. Check for mistakes.
@@ -1,4 +1,5 @@
import { mock } from 'jest-mock-extended';
import { vi, beforeEach, beforeAll, afterAll, describe, test, expect } from 'vitest';
Copy link

Copilot AI Jan 15, 2026

Choose a reason for hiding this comment

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

Unused import beforeAll.

Copilot uses AI. Check for mistakes.
import { codeExamples } from '../fixtures/codeExamples';
import { openApiDocsLink } from '../fixtures/openApiDocs';
import { ContextTemplates } from './ContextTemplates.js';
import { ContextType, Fdc3Listener } from '../utility/Fdc3Api.js';
Copy link

Copilot AI Jan 15, 2026

Choose a reason for hiding this comment

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

Unused import Fdc3Listener.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

help wanted Extra attention is needed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CJS build changes breaking Node consumers

4 participants