-
Notifications
You must be signed in to change notification settings - Fork 223
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
sharing module specifier paths with xs #57
Comments
Turns out the default implementation of I wonder when is the last time I used @dtribble you had strong opinions about this Oh... the moddable guys might not like my PR, so I guess we should stand by to see what they think. We might want to define our own platform anyway, so we might not need them to take this fix upstream. But it would be convenient. |
Hm. Does I haven't had a chance to talk (argue?) with @dtribble about this yet. The goal is to share code within the SwingSet library. I'm worried that the alternative to |
@dtribble wrote elsewhere:
So I'm just standing by to hear from moddable now. |
The switch to a monorepo (#267) seems to conflict with my earlier approach to this issue. The earlier approach involved putting the xs code at the top level directory. That'll be awkward for several packages at once. |
ugh. this module search path thing has got me down again. I found an algorithm for generating manifests that worked well enough to test eventual-send and (with one kludge) marshal, but when I try it out on cosmic-swingset... the generated manifest resolves Looking at how I dealt with this before, I totally hacked up the import site: https://github.com/dckc/agoric-sdk/blob/xs-platform/packages/cosmic-swingset/lib/ag-solo/start.js#L9-L19 I might try tweaking module lookup in our xs platform, but I'm afraid that by that point the info is lost. The xsc compiler might need to cooperate. And then I'm not sure how to handle the makefile stuff. for reference: moddable folks Aug 21
|
@erights @michaelfig In the changes above, Dan had to basically change the imports to avoid the common pattern of an index.js files importing local definitions and re-exporting them (compare with the version in master). The "naming path" for a file in nodejs is some mangling of the directory structure of the files and the "mounting" of packages. That mangling is not the same in the XS view of the world, so the How do we harmonize the structure so that the module import patterns work in both XS and node? |
It's much uglier and somewhat violates the package abstraction, but we can change the import sites to: import ... from '@agoric/swingset-vats/src/index.js'; |
chatted with @warner about this today; he reminded me about the Jetpack Modules project he worked on at Mozilla. Here's hoping to study it to see if it provides / inspires a solution. p.s. He adds:
|
idea: use Compartment map to reconcile paths
|
This compartment map approach is going reasonably well. https://github.com/dckc/tape-xs/blob/master/bin/modlinks.js is a refinement of As shown in https://gist.github.com/dckc/f3ca2ed672174eadeb17de489adc9df2 , we then make a ~25 line manifest that includes the above as well as a ~25 line main that uses the compartment info to make compartments. It's starting to be able to run the SwingSet/test/test*.js scripts, though there are various bundling issues to re-integrate. I also moved stuff around a little bit here in my branch of agoric-sdk 714fecf .. 05dd667 |
I got I was disappointed to learn that relative specifier handling is done relative to the bin/ag-solo-xs.js ~50 lines xs-build-lite branch 3444cfe |
@kriskowal writes in keybase:
I've done overlapping work. output: tool (messy): |
The endo compartmap approach is working pretty well in the context of #1407 , but before we close this... I wrote:
@warner writes in #1407 (comment) :
cc @kriskowal |
The present design does not share a type, though the difference looks arbitrary and is probably straightforward to reconcile. https://github.com/dckc/agoric-sdk/commits/endo-types |
The plan we worked out in #2107 is to use rollup, for now. It seems to be working: #2194 Meanwhile,
But to address this fully, we'll need
|
Let's track the Compartment constructor with module loading as endojs/endo#536 |
I'm struggling with
Unfortunately,
mcconfig
doesn't say which occurrence is the problem. I thought../..
would never work, but then it seemed to for a while. Now I'm struggling with it again.There are many occurrences:
https://gist.github.com/dckc/c5f7b8a1c5834199cd36bf29f7f085e3
Aug 20: struggling
Moddable-OpenSource/moddable#251
Sep 2: solved some parts of it
https://github.com/Agoric/SwingSet/issues/126#issuecomment-527226803
cc @dtribble
The text was updated successfully, but these errors were encountered: