FDC3 icon indicating copy to clipboard operation
FDC3 copied to clipboard

Missing source maps in npm packages

Open Roaders opened this issue 7 months ago • 3 comments

Area of Issue

  • [ ] App Directory
  • [ ] API
  • [ ] Context Data
  • [ ] Intents
  • [ ] Desktop Agent Bridging
  • [ ] Use Cases
  • [x] Other

Issue Description:

When running vitest in a project that has fdc3 packages installed I get errors:

Sourcemap for "C:/Users/Administrator/Desktop/GitHub/fdc3-web/node_modules/@finos/fdc3/dist/src/index.js" points to missing source files
Sourcemap for "C:/Users/Administrator/Desktop/GitHub/fdc3-web/node_modules/@finos/fdc3-context/dist/src/index.js" points to missing source files
Sourcemap for "C:/Users/Administrator/Desktop/GitHub/fdc3-web/node_modules/@finos/fdc3-context/dist/generated/context/ContextTypes.js" points to missing source files
Sourcemap for "C:/Users/Administrator/Desktop/GitHub/fdc3-web/node_modules/@finos/fdc3-schema/dist/src/index.js" points to missing source files
Sourcemap for "C:/Users/Administrator/Desktop/GitHub/fdc3-web/node_modules/@finos/fdc3-schema/dist/generated/api/BrowserTypes.js" points to missing source files
Sourcemap for "C:/Users/Administrator/Desktop/GitHub/fdc3-web/node_modules/@finos/fdc3-schema/dist/generated/bridging/BridgingTypes.js" points to missing source files
Sourcemap for "C:/Users/Administrator/Desktop/GitHub/fdc3-web/node_modules/@finos/fdc3-standard/dist/src/index.js" points to missing source files
Sourcemap for "C:/Users/Administrator/Desktop/GitHub/fdc3-web/node_modules/@finos/fdc3-standard/dist/src/api/AppIntent.js" points to missing source files
Sourcemap for "C:/Users/Administrator/Desktop/GitHub/fdc3-web/node_modules/@finos/fdc3-standard/dist/src/api/AppMetadata.js" points to missing source files
Sourcemap for "C:/Users/Administrator/Desktop/GitHub/fdc3-web/node_modules/@finos/fdc3-standard/dist/src/api/Channel.js" points to missing source files
Sourcemap for "C:/Users/Administrator/Desktop/GitHub/fdc3-web/node_modules/@finos/fdc3-standard/dist/src/api/ContextMetadata.js" points to missing source files
Sourcemap for "C:/Users/Administrator/Desktop/GitHub/fdc3-web/node_modules/@finos/fdc3-standard/dist/src/api/DesktopAgent.js" points to missing source files
Sourcemap for "C:/Users/Administrator/Desktop/GitHub/fdc3-web/node_modules/@finos/fdc3-standard/dist/src/api/DisplayMetadata.js" points to missing source files
Sourcemap for "C:/Users/Administrator/Desktop/GitHub/fdc3-web/node_modules/@finos/fdc3-standard/dist/src/api/Errors.js" points to missing source files
Sourcemap for "C:/Users/Administrator/Desktop/GitHub/fdc3-web/node_modules/@finos/fdc3-standard/dist/src/api/GetAgent.js" points to missing source files
Sourcemap for "C:/Users/Administrator/Desktop/GitHub/fdc3-web/node_modules/@finos/fdc3-standard/dist/src/api/Icon.js" points to missing source files
Sourcemap for "C:/Users/Administrator/Desktop/GitHub/fdc3-web/node_modules/@finos/fdc3-standard/dist/src/api/Image.js" points to missing source files
Sourcemap for "C:/Users/Administrator/Desktop/GitHub/fdc3-web/node_modules/@finos/fdc3-standard/dist/src/api/ImplementationMetadata.js" points to missing source files
Sourcemap for "C:/Users/Administrator/Desktop/GitHub/fdc3-web/node_modules/@finos/fdc3-standard/dist/src/api/IntentMetadata.js" points to missing source files
Sourcemap for "C:/Users/Administrator/Desktop/GitHub/fdc3-web/node_modules/@finos/fdc3-standard/dist/src/api/IntentResolution.js" points to missing source files
Sourcemap for "C:/Users/Administrator/Desktop/GitHub/fdc3-web/node_modules/@finos/fdc3-standard/dist/src/api/Listener.js" points to missing source files
Sourcemap for "C:/Users/Administrator/Desktop/GitHub/fdc3-web/node_modules/@finos/fdc3-standard/dist/src/api/Methods.js" points to missing source files
Sourcemap for "C:/Users/Administrator/Desktop/GitHub/fdc3-web/node_modules/@finos/fdc3-standard/dist/src/internal/contextConfiguration.js" points to missing source files
Sourcemap for "C:/Users/Administrator/Desktop/GitHub/fdc3-web/node_modules/@finos/fdc3-standard/dist/src/internal/typeHelpers.js" points to missing source files
Sourcemap for "C:/Users/Administrator/Desktop/GitHub/fdc3-web/node_modules/@finos/fdc3-standard/dist/src/internal/intentConfiguration.js" points to missing source files
Sourcemap for "C:/Users/Administrator/Desktop/GitHub/fdc3-web/node_modules/@finos/fdc3-standard/dist/src/api/PrivateChannel.js" points to missing source files
Sourcemap for "C:/Users/Administrator/Desktop/GitHub/fdc3-web/node_modules/@finos/fdc3-standard/dist/src/api/RecommendedChannels.js" points to missing source files
Sourcemap for "C:/Users/Administrator/Desktop/GitHub/fdc3-web/node_modules/@finos/fdc3-standard/dist/src/api/Types.js" points to missing source files
Sourcemap for "C:/Users/Administrator/Desktop/GitHub/fdc3-web/node_modules/@finos/fdc3-standard/dist/src/api/Events.js" points to missing source files
Sourcemap for "C:/Users/Administrator/Desktop/GitHub/fdc3-web/node_modules/@finos/fdc3-standard/dist/src/context/ContextType.js" points to missing source files
Sourcemap for "C:/Users/Administrator/Desktop/GitHub/fdc3-web/node_modules/@finos/fdc3-standard/dist/src/intents/Intents.js" points to missing source files
Sourcemap for "C:/Users/Administrator/Desktop/GitHub/fdc3-web/node_modules/@finos/fdc3-get-agent/dist/src/index.js" points to missing source files
Sourcemap for "C:/Users/Administrator/Desktop/GitHub/fdc3-web/node_modules/@finos/fdc3-get-agent/dist/src/strategies/getAgent.js" points to missing source files
Sourcemap for "C:/Users/Administrator/Desktop/GitHub/fdc3-web/node_modules/@finos/fdc3-get-agent/dist/src/strategies/DesktopAgentPreloadLoader.js" points to missing source files
Sourcemap for "C:/Users/Administrator/Desktop/GitHub/fdc3-web/node_modules/@finos/fdc3-get-agent/dist/src/util/Logger.js" points to missing source files
Sourcemap for "C:/Users/Administrator/Desktop/GitHub/fdc3-web/node_modules/@finos/fdc3-agent-proxy/dist/src/index.js" points to missing source files
Sourcemap for "C:/Users/Administrator/Desktop/GitHub/fdc3-web/node_modules/@finos/fdc3-agent-proxy/dist/src/DesktopAgentProxy.js" points to missing source files
Sourcemap for "C:/Users/Administrator/Desktop/GitHub/fdc3-web/node_modules/@finos/fdc3-agent-proxy/dist/src/util/Logger.js" points to missing source files
Sourcemap for "C:/Users/Administrator/Desktop/GitHub/fdc3-web/node_modules/@finos/fdc3-agent-proxy/dist/src/util/AbstractFDC3Logger.js" points to missing source files
Sourcemap for "C:/Users/Administrator/Desktop/GitHub/fdc3-web/node_modules/@finos/fdc3-agent-proxy/dist/src/messaging/AbstractMessaging.js" points to missing source files
Sourcemap for "C:/Users/Administrator/Desktop/GitHub/fdc3-web/node_modules/@finos/fdc3-agent-proxy/dist/src/channels/DefaultChannel.js" points to missing source files
Sourcemap for "C:/Users/Administrator/Desktop/GitHub/fdc3-web/node_modules/@finos/fdc3-agent-proxy/dist/src/listeners/DefaultContextListener.js" points to missing source files
Sourcemap for "C:/Users/Administrator/Desktop/GitHub/fdc3-web/node_modules/@finos/fdc3-agent-proxy/dist/src/listeners/AbstractListener.js" points to missing source files
Sourcemap for "C:/Users/Administrator/Desktop/GitHub/fdc3-web/node_modules/@finos/fdc3-agent-proxy/dist/src/util/throwIfUndefined.js" points to missing source files
Sourcemap for "C:/Users/Administrator/Desktop/GitHub/fdc3-web/node_modules/@finos/fdc3-agent-proxy/dist/src/intents/DefaultIntentSupport.js" points to missing source files
Sourcemap for "C:/Users/Administrator/Desktop/GitHub/fdc3-web/node_modules/@finos/fdc3-agent-proxy/dist/src/intents/DefaultIntentResolution.js" points to missing source files
Sourcemap for "C:/Users/Administrator/Desktop/GitHub/fdc3-web/node_modules/@finos/fdc3-agent-proxy/dist/src/listeners/DefaultIntentListener.js" points to missing source files
Sourcemap for "C:/Users/Administrator/Desktop/GitHub/fdc3-web/node_modules/@finos/fdc3-agent-proxy/dist/src/channels/DefaultPrivateChannel.js" points to missing source files
Sourcemap for "C:/Users/Administrator/Desktop/GitHub/fdc3-web/node_modules/@finos/fdc3-agent-proxy/dist/src/listeners/PrivateChannelEventListener.js" points to missing source files
Sourcemap for "C:/Users/Administrator/Desktop/GitHub/fdc3-web/node_modules/@finos/fdc3-agent-proxy/dist/src/channels/DefaultChannelSupport.js" points to missing source files
Sourcemap for "C:/Users/Administrator/Desktop/GitHub/fdc3-web/node_modules/@finos/fdc3-agent-proxy/dist/src/listeners/EventListener.js" points to missing source files
Sourcemap for "C:/Users/Administrator/Desktop/GitHub/fdc3-web/node_modules/@finos/fdc3-agent-proxy/dist/src/apps/DefaultAppSupport.js" points to missing source files
Sourcemap for "C:/Users/Administrator/Desktop/GitHub/fdc3-web/node_modules/@finos/fdc3-agent-proxy/dist/src/heartbeat/DefaultHeartbeatSupport.js" points to missing source files
Sourcemap for "C:/Users/Administrator/Desktop/GitHub/fdc3-web/node_modules/@finos/fdc3-agent-proxy/dist/src/listeners/HeartbeatListener.js" points to missing source files
Sourcemap for "C:/Users/Administrator/Desktop/GitHub/fdc3-web/node_modules/@finos/fdc3-get-agent/dist/src/strategies/Timeouts.js" points to missing source files
Sourcemap for "C:/Users/Administrator/Desktop/GitHub/fdc3-web/node_modules/@finos/fdc3-get-agent/dist/src/strategies/PostMessageLoader.js" points to missing source files
Sourcemap for "C:/Users/Administrator/Desktop/GitHub/fdc3-web/node_modules/@finos/fdc3-get-agent/dist/src/messaging/message-port.js" points to missing source files
Sourcemap for "C:/Users/Administrator/Desktop/GitHub/fdc3-web/node_modules/@finos/fdc3-get-agent/dist/src/messaging/MessagePortMessaging.js" points to missing source files
Sourcemap for "C:/Users/Administrator/Desktop/GitHub/fdc3-web/node_modules/@finos/fdc3-get-agent/dist/src/ui/DefaultDesktopAgentIntentResolver.js" points to missing source files
Sourcemap for "C:/Users/Administrator/Desktop/GitHub/fdc3-web/node_modules/@finos/fdc3-get-agent/dist/src/ui/AbstractUIComponent.js" points to missing source files
Sourcemap for "C:/Users/Administrator/Desktop/GitHub/fdc3-web/node_modules/@finos/fdc3-get-agent/dist/src/ui/DefaultDesktopAgentChannelSelector.js" points to missing source files
Sourcemap for "C:/Users/Administrator/Desktop/GitHub/fdc3-web/node_modules/@finos/fdc3-get-agent/dist/src/ui/NullIntentResolver.js" points to missing source files
Sourcemap for "C:/Users/Administrator/Desktop/GitHub/fdc3-web/node_modules/@finos/fdc3-get-agent/dist/src/ui/NullChannelSelector.js" points to missing source files
Sourcemap for "C:/Users/Administrator/Desktop/GitHub/fdc3-web/node_modules/@finos/fdc3-get-agent/dist/src/strategies/HelloHandler.js" points to missing source files
Sourcemap for "C:/Users/Administrator/Desktop/GitHub/fdc3-web/node_modules/@finos/fdc3-get-agent/dist/src/strategies/IdentityValidationHandler.js" points to missing source files
Sourcemap for "C:/Users/Administrator/Desktop/GitHub/fdc3-web/node_modules/@finos/fdc3-get-agent/dist/src/sessionStorage/DesktopAgentDetails.js" points to missing source files
Sourcemap for "C:/Users/Administrator/Desktop/GitHub/fdc3-web/node_modules/@finos/fdc3-get-agent/dist/src/util/Uuid.js" points to missing source files
Sourcemap for "C:/Users/Administrator/Desktop/GitHub/fdc3-web/node_modules/@finos/fdc3-get-agent/dist/src/strategies/FailoverHandler.js" points to missing source files

when I look at the source map files that are referenced they have:

"sources":["../../../src/ui/NullIntentResolver.ts"]

but there is no src folder within the unpacked npm package. There is dist/src but these are the transpiled .js files, not the original .ts files that are required for the source maps.

The fix for this might be as simple as just editing an .npmignore file to include the sources (but probably not given that this is a mono repo and not a simple, small repo).

Roaders avatar May 09 '25 12:05 Roaders

Hey @Roaders, that is caused by the files element in each package's package.json file, e.g.: https://github.com/finos/FDC3/blob/63eceaa9d1f1790c0c6d0f463b010965a187dd07/packages/fdc3-standard/package.json#L16-L18 which is removing the uncompiled /src dir and other files from the npm module.

The change was made on this issue https://github.com/finos/FDC3/issues/996. Removing all the /src dirs wasn't necessary to resolve @bingenito's original issue with some POM files that were getting bundled, so is something we could revert... We removed the source to reduce the npm module size... but I think if you care about file size in a downstream project you are going to be tree shaking your build and stripping out what you don't need from the prod build anyway. If we add the TS source back into module then downstream dev builds can still bundle it if they want to ease debug in the browser?

The old (pre-monorepo) build used to bundle both prod (uglified) and dev (pretty) builds of the source (JS compiled from the TS) to help with debug (making the module bigger again), but with 2.2/mono-repo we've just got the pretty version and leave it to downstream code to uglify it if it wants to. Perhaps we've currently got the worst of both worlds: large/pretty JS and a map pointing to absent TS files. Perhaps we should uglify the JS and bundle the maps and TS source?

Interested in thoughts from @julianna-ciq, @robmoffat and other @finos/fdc3-maintainers, @finos/fdc3-editors and @finos/fdc3-participants.

kriswest avatar May 09 '25 13:05 kriswest

We could fix this in one of 2 ways - remove the sourcemap files (which are of no use anyway) or include the sources that the map files point to. I would strongly suggest that we include the sources 😄 debugging without can be very painful!

IMHO the size of the bundled tgz is not incredibly important. I can't see any way that this would make any actual apps bigger. The only issue would be slower downloads (not sure how much of an issue that would be) and it taking up more space on developers hard drives and making node_modules even bigger than it already is (again in my opinion this is minor compared to the usefulness of the sources).

I would guess ugly / minified js files and pretty original source files would be my choice.

Roaders avatar May 09 '25 14:05 Roaders

Consent requested from SWG and given to make this change 22/05/2025

kriswest avatar May 22 '25 14:05 kriswest