-
Notifications
You must be signed in to change notification settings - Fork 155
Only export main module from package #340
Conversation
|
I'm unclear how this addresses anything, but maybe this is interacting with other parts of the system? This only removes stack graph rules, so how does the |
|
@BekaValentine The So far it's only the example! I haven't had time to write text yet. At least you can already see which parts of the graph come from the different files, but I'll write more text in the coming days. |
|
@hendrikvanantwerpen it seems to be the case that there's a special piece of rust code that handles this stuff in a custom way? I think it's Is this correct? If so, do you have any thoughts on how we might make it possible for external contributors to do something? One thought I have is that we might want instead to not use custom rust code, but rather use a tsg file that processes [packages]
config = "package.json"
library = "package.tsg"or something like that, I dunno. We could also use those kinds of files to describe how packages relate to source directories, if there's a language-specific or packaging-system-specific convention, etc. We might even want to think about how packages and languages might be orthogonal or partially orthogonal issues (since multi-lingual environments beyond just the NPM ecosystem do exist and are quite widespread). |
6339180 to
d8b4540
Compare
Yep! The
So external contributors can already contribute that Rust code. This is convenient, but it is perhaps not most desirable, for two reasons: (1) contributors have to suddenly think about the lower level Rust API, instead of the higher-level DSL code, and (2) we have have externally Rust code that will run in our production system. Having a higher-level and safer way to write these rules would be nice! Previously I was not sure using Tree-sitter and TSG was really the right approach, because it would mean pulling in a new grammar dependency for the config file, and because the TSG would need to match on concrete names (e.g., keys in JSON). But perhaps it won't be as bad, and it might be worth an experiment.
Yes! The package detection stuff is all in Aleph right now, which is not nice for testing this logic. A general solution could be to add something similar to It would be great to have an issue for this, as you suggested to write up, to develop these ideas! |
#347 »
Packages would export every module as if it was the main module. This PR changes that so that only the main module is exported. If the main module is missing,
indexis used.Note that for packages that specify a build artifact as the main module (along the lines of
build/dist.js), the package will not export anything anymore! If this turns out to be too strict, we can look at the following alternatives for that:Always include
index, even if the main module is explicitly specified.Fall back to
indexif the specified main module does not exist. I think we (can) have enough information in the function processingpackage.jsonto determine this.I started documenting the package structure as well (rendered).
Fixes #337.