LinkedSoftwareDependencies / Components.js

🧩 A semantic dependency injection framework
https://componentsjs.readthedocs.io/
Other
41 stars 6 forks source link

Generics issue when building in different Monrepo #90

Open jeswr opened 2 years ago

jeswr commented 2 years ago

Issue type:


Description:

I've got reasoning components working for Comunica V2 by copy/pasting the components to https://github.com/comunica/comunica/tree/reasoning-experiments, but whenever I try to build the components in a separate monrepo (https://github.com/comunica/comunica-feature-reasoning/tree/incremental-engine-build) I get the following trace (https://pastebin.com/mXMZSREx).

The notable error is

generic <https://linkedsoftwaredependencies.org/bundles/npm/@comunica/core/^2.0.0/components/Actor.jsonld#Actor__generic_I> with existing range \"https://linkedsoftwaredependencies.org/bundles/npm/@comunica/core/^2.0.0/components/Actor.jsonld#IAction\" can not be bound to range \"urn:npm:@comunica/bus-rdf-resolve-quad-pattern:IActionRdfResolveQuadPattern\"

Environment:

Componentsjs version 5 Node v17.4.0

github-actions[bot] commented 2 years ago

Thanks for reporting!

jeswr commented 2 years ago

~So it looks like the solution on my end was to replace~

The error changes to

Error: Resource urn:npm:@comunica/bus-rdf-resolve-quad-pattern:IActorRdfResolveQuadPatternOutput is not a valid component, either it is not defined, has no type, or is incorrectly referenced by https://linkedsoftwaredependencies.org/bundles/npm/@comunica/bus-rdf-resolve-quad-pattern-intercept/^1.0.0/components/ActorRdfResolveQuadPatternIntercept.jsonld#IActorRdfResolveQuadPatternInterceptOutput.

If we replace

export type IActionRdfResolveQuadPatternIntercept = IActionRdfResolveQuadPattern;
export type IActorRdfResolveQuadPatternInterceptOutput = IActorRdfResolveQuadPatternOutput;
export type MediatorRdfResolveQuadPatternIntercept = MediatorRdfResolveQuadPattern;

with


// Revert to type = pattern once
export interface IActionRdfResolveQuadPatternIntercept extends IActionRdfResolveQuadPattern {};
export interface IActorRdfResolveQuadPatternInterceptOutput extends IActorRdfResolveQuadPatternOutput {};
export interface MediatorRdfResolveQuadPatternIntercept extends MediatorRdfResolveQuadPattern {};

Still weird that this only happens in a separate monrepo

rubensworks commented 2 years ago

Not sure what the problem is at first glance.

The fact that you get urn:npm:@comunica/bus-rdf-resolve-quad-pattern:IActorRdfResolveQuadPatternOutput, and not a proper HTTPS URL seems to indicate that CJS doesn't find the CJS components of that package, which may indicate a dependency issue.

But it may also simply be a CJS bug in generics handling, since that stuff is pretty complex.