-
Notifications
You must be signed in to change notification settings - Fork 208
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
reduce ambient imports and drop maxNodeModuleJsDepth #9373
Conversation
Deploying agoric-sdk with Cloudflare Pages
|
a925bba
to
d371cb3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good stuff so far...
@@ -2,7 +2,6 @@ import chalk from 'chalk'; | |||
import { makePspawn } from './helpers.js'; | |||
|
|||
/// <reference types="@endo/captp/src/types.js" /> | |||
/// <reference types="@agoric/swingset-vat/exported.js" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removing that file seems like a breaking change
for example, consider a dapp that imports it.
comment belongs on the deleted file, but I don't see how to do that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
true. in practice we know all the code that relies on it:
https://github.com/search?q=org%3AAgoric+swingset-vat%2Fexported&type=code
that looks ok to me to drop but if you want a BREAKING CHANGE commit I'm game. the package hasn't hit version 1 yet so it won't be a major version bump
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In order to accommodate 3rd party developers, yes, I think a BREAKING CHANGE commit is worthwhile.
For example:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
None of the exported.js imported in that repo have been removed https://github.com/search?q=repo%3AKryha%2FKREAd%20exported&type=code
But a few have and I it'll be faster to do this than convince you otherwise ;-) I'll amend the commit message before I merge. I do wish we didn't have to modify commit history in order to note such things
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh. I misread this PR as deleting @agoric/zoe/exported.js
.
* @property {Installation} installation | ||
* @property {import('./zoeService/utils.js').Installation<any>} installation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd like to understand the motivation for this change better.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the Installation
it was referencing before is available only ambiently. That one was just an alias for what's here
// XXX ambient types runtime imports until https://github.com/Agoric/agoric-sdk/issues/6512 | ||
import '@agoric/zoe/exported.js'; | ||
import '@agoric/zoe/src/contracts/exported.js'; | ||
/// <reference types="@agoric/zoe/exported" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👏
I'm curious about the impact on bundle sizes for these contracts.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
before
22135 bundle-econCommitteeCharter-js-meta.json
1166313 bundle-econCommitteeCharter.js
28423 bundle-fluxAggregatorKit-js-meta.json
1534301 bundle-fluxAggregatorKit.js
28121 bundle-psm-js-meta.json
1496517 bundle-psm.js
after
20614 bundle-econCommitteeCharter-js-meta.json
1105853 bundle-econCommitteeCharter.js
26868 bundle-fluxAggregatorKit-js-meta.json
1474173 bundle-fluxAggregatorKit.js
26566 bundle-psm-js-meta.json
1435797 bundle-psm.js
bundle | abs drop | rel drop |
---|---|---|
psm | 60,720 | 4.1% |
fluxAggregatorKit | 3.9% | |
econCommitteeCharter | 60,460 | 5.2% |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
at 2844e7c
1104273 bundle-econCommitteeCharter.js
1472593 bundle-fluxAggregatorKit.js
1434213 bundle-psm.js
bundle | abs drop | rel drop |
---|---|---|
econCommitteeCharter | 62,040 | 5.3% |
fluxAggregatorKit | 61,708 | 4.0% |
psm | 60,720 | 4.0% |
@@ -1,7 +1,7 @@ | |||
// @jessie-check | |||
|
|||
// XXX ambient types runtime imports until https://github.com/Agoric/agoric-sdk/issues/6512 | |||
import '@agoric/zoe/exported.js'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
prune the XXX comment too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll do that. Any other requested changes? I'm putting this in to R4R since all the tests are passing. (I don't know what's up with the Cloudflare build but it works for me locally)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like a nice cleanup, and I'm surprised we can simply use an exported.d.ts
files that does imports of .js
files which do the actual ambient side effects.
import '@agoric/zoe/exported.js'; | ||
/// <reference path="./types.js" /> | ||
/// <reference types="@agoric/zoe/exported" /> | ||
/// <reference path="./types-ambient.js" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm confused, I thought you couldn't reference .js
files?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for reference types
, but path
works.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How does this file work in the first place? I don't see it referenced anywhere
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hm, yeah, some cruft. I'll remove
import '@agoric/ertp/exported.js'; | ||
import '@agoric/store/exported.js'; | ||
import '@agoric/swingset-vat/exported.js'; | ||
// Dummy file for .d.ts twin to declare ambients |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That seems like a cheap trick, what's the drawback of doing that everywhere?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you mean carrying out the best practice written here? https://github.com/Agoric/agoric-sdk/blob/master/docs/typescript.md#dts-modules
Or something more specific? If it's about exported.js
, I'd like to move away from that pattern altogether. Zoe is just recalcitrant
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok... I think I get it now.
Though #6512 doesn't seem to be scheduled, I presume addressing it is worth the potential release branch complications. cc @gibson042 @mhofman
I'd be more comfortable if the schedule for releasing from master (#9252) were more clear. Again, I presume this progress is worth any downsides. cc @ivanlei
It didn't have any ambient exports. The named exports are in the package entrypoint.
refs: #6512
Description
maxNodeModuleJsDepth
now that the types resolve withoutI put commit checkpoints of type coverage to guard against any regression, though I took them out again when merging
Security Considerations
Scaling Considerations
Documentation Considerations
Testing Considerations
Upgrade Considerations