Replies: 1 comment
-
Hi Vladimir, I think the last two examples are the ones that we should select. They are easier to understand and follow. We should stick to the one without version ( Also could you estimate how much of an effort would be to swap our Regards, |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Currently, the Dirigible JS APIs are available only by
require
-ing them. With the support of ES6 modules (coming from GraalVM) we should choose a path convention for importing Dirigible modules. Let's look at thebase64
package. As of now, it could be imported like:With the ES6 modules support, at first glance, it could be something like:
or
Those two ways of importing look relatively nice but there is a possible issue with the
from
paths. The problem is that if we want to enable at a later point the GraalVM's ownrequire
function, in order not to support our own one, those paths would be treated like annpm
package name as they are neither absolute nor relative paths. By specification, allnpm
package names should not have URL unfriendly names. In our case, the/
would not be supported and GraalVM would throw an exception. So, we could change the paths to something like:or
But by doing that, those paths start to become a little bit verbose, especially the first one. Another issue for all these approaches is that it's also a bit hard for new users to understand from where are those packages coming from actually. We could solve these issues with a
scoped
name and a more modular way of importing:Having this, it's still a bit verbose if we must append the version at the end. It would maybe be better in terms of readability to have the imported module at the end of the
from
path:In this way, in my opinion, it would be a bit more readable and enables the users to easily change the used version when at some point in time we release a
v5
.Although to have an explicit version stated by the user, we could still support the current way of importing the latest module version by having something like:
I believe the best way of enabling users to
import
Dirigible modules is by supporting the last two examples. In terms of implementation, they seem to be relatively simple to support and don't have any major shortcomings.Beta Was this translation helpful? Give feedback.
All reactions