🚀 Feature Request
Affected Languages
General Information
Description
While building a JSii wrapper for a Clojure CDK API, I've come to realize that it is beneficial to rely on npm & node_modules for JSii libraries. The bundling of the Java JSii runtime with the maven CDK modules opens the door to dependency conflicts that can be avoided by relying directly on node_modules. Additionally, maven modules are hard to load dynamically into a JVM which makes it hard to dynamically work with CDK constructs.
Right now the JSii protocol only allows for archived modules to be loaded (from the classpath in the Java case). If the JSii protocol was expanded to allow modules to be loaded locally from a node_modules folder it would make it easier to enable more dynamic workflows in REPL-friendly languages.
Proposed Solution
I can see two plausible solutions - both non-breaking:
-
Amend the load request to allow an optional boolean local argument. When this argument is supplied as true then modules are loaded from the local directory's node_modules folder. This would keep the surface area of the protocol largely unchanged and allows for a non-breaking change by falling back to the current behavior when the argument is not present.
-
Add a new require request that would allow a local module to be loaded. This increases the surface area of the API but prevents decreasing the complexity of the load API request. The commonality that would be shared between require and load could be factored into shared private functions to prevent drift between the two APIs.
I'm happy to put together a PR for either of these solutions (or an alternative solution) if this change is desirable.
🚀 Feature Request
Affected Languages
TypeScriptorJavascriptPythonJavaC#,F#, ...)General Information
JSII Version: n/a
Platform: n/a
I may be able to implement this feature request
This feature might incur a breaking change
Description
While building a JSii wrapper for a Clojure CDK API, I've come to realize that it is beneficial to rely on
npm&node_modulesfor JSii libraries. The bundling of the Java JSii runtime with the maven CDK modules opens the door to dependency conflicts that can be avoided by relying directly onnode_modules. Additionally, maven modules are hard to load dynamically into a JVM which makes it hard to dynamically work with CDK constructs.Right now the JSii protocol only allows for archived modules to be loaded (from the classpath in the Java case). If the JSii protocol was expanded to allow modules to be loaded locally from a
node_modulesfolder it would make it easier to enable more dynamic workflows in REPL-friendly languages.Proposed Solution
I can see two plausible solutions - both non-breaking:
Amend the
loadrequest to allow an optional booleanlocalargument. When this argument is supplied astruethen modules are loaded from the local directory'snode_modulesfolder. This would keep the surface area of the protocol largely unchanged and allows for a non-breaking change by falling back to the current behavior when the argument is not present.Add a new
requirerequest that would allow a local module to be loaded. This increases the surface area of the API but prevents decreasing the complexity of theloadAPI request. The commonality that would be shared betweenrequireandloadcould be factored into shared private functions to prevent drift between the two APIs.I'm happy to put together a PR for either of these solutions (or an alternative solution) if this change is desirable.