Skip to content
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

refactor(SwingSet): Define SwingSet types as module exported #4729

Merged

Conversation

mhofman
Copy link
Member

@mhofman mhofman commented Mar 3, 2022

Add "re-exporting" ambient file for backwards compatibility

refs: #4560

Description

  • Moves previously ambient type (types.js) definitions as being declared in a module file (types-external.js), requiring them to be explicitly imported for usage, and combine into it the previous types-exported.js (fixing a typo for the type of DynamicVatOptionsWithoutMeter.vatParameters)
    • Even though these ambient types were not previously included in the @agoric/swingset-vat/exported.js file, by being ambient they effectively were made transitively external when someone imported from @agoric/swingset-vat.
  • Add a types-ambient.js file which "typedef re-exports" types from types-external.js
    • This is for backwards compatibility of previous users of ambient types.
    • type.js -> types-ambient.js with the following modifications
      • Remove all @property lines
      • s/@typedef +\{(?:[^@]|\n)*\} +(\w+)( +[0-9a-zA-Z ]+)?$/@typedef { import('./types-external.js').$1 } $1/
      • Double check which line were not substituted (had an @ in the type definition)

Security Considerations

None. Typing only change

Documentation Considerations

The type definitions in types-external.js should probably move to being defined closer to the internal API that use the types, and @typedefed in types-external.js so they can be used by external users through import('@agoric/swingset-vat').ExportedType

The types-ambient.js should over time shrink into oblivion, with ambient usages replaced by the corresponding import().Type

Testing Considerations

yarn lint passing successfully

Add "re-exporting" ambient file for backwards compatibility
@mhofman mhofman requested review from turadg and warner March 3, 2022 20:00
@warner
Copy link
Member

warner commented Mar 3, 2022

Not sure what that test failure was, looks like a temporary network problem, I hit the "re-run all jobs" button

Copy link
Member

@warner warner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sounds at least as plausible as anything else I've seen :)

I'll land into my PR branch once @turadg is ok with it.

@mhofman
Copy link
Member Author

mhofman commented Mar 3, 2022

Not sure what that test failure was, looks like a temporary network problem, I hit the "re-run all jobs" button

Yeah not sure either. @michaelfig any idea?

@warner warner merged commit 996ad6b into 1848-refactor-deliver-to-vat Mar 3, 2022
@warner warner deleted the mhofman/swingset-refactor-ambient-types branch March 3, 2022 21:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants