Skip to content

Commit

Permalink
reduce Endo build coupling (#9395)
Browse files Browse the repository at this point in the history
#endo-branch: master

## Description

Removes some build code that references Endo code that's no longer there.

Also slips in a typedefs fix to re-spin CI after I changed the endo-branch target. These fixes are good to get in ASAP and didn't seem worth a whole other PR.

After this merges I think #9385 can be reset to master

### Security Considerations

none

### Scaling Considerations

none

### Documentation Considerations

none

### Testing Considerations

CI suffices

### Upgrade Considerations

none
  • Loading branch information
mergify[bot] authored Aug 21, 2024
2 parents 9986152 + b117ef8 commit dfc7a48
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 24 deletions.
2 changes: 1 addition & 1 deletion packages/base-zone/src/make-once.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export const makeOnceKit = (debugName, stores, backingStore = undefined) => {
* Ensure the wrapped function is only called once per incarnation. It is
* expected to update the backing store directly.
*
* @template {(key: string, ...rest: unknown[]) => any} T
* @template {(key: string, ...rest: any[]) => any} T
* @param {T} provider
* @param {(label: string) => string[]} [labelToKeys]
* @returns {T}
Expand Down
24 changes: 12 additions & 12 deletions packages/internal/src/callback.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const isPropertyKey = key => {
/**
* Synchronously call a callback.
*
* @template {(...args: unknown[]) => any} I
* @template {(...args: any[]) => any} I
* @param {SyncCallback<I>} callback
* @param {Parameters<I>} args
* @returns {ReturnType<I>}
Expand All @@ -58,7 +58,7 @@ harden(callSync);
/**
* Eventual send to a callback.
*
* @template {(...args: unknown[]) => any} I
* @template {(...args: any[]) => any} I
* @param {Callback<I>} callback
* @param {Parameters<I>} args
* @returns {Promise<Awaited<ReturnType<I>>>}
Expand All @@ -75,9 +75,9 @@ harden(callE);
/**
* Create a callback from a near function.
*
* @template {(...args: unknown[]) => any} I
* @template {(...args: any[]) => any} I
* @template {(...args: [...B, ...Parameters<I>]) => ReturnType<I>} [T=I]
* @template {unknown[]} [B=[]]
* @template {any[]} [B=[]]
* @param {T} target
* @param {B} bound
* @returns {SyncCallback<I>}
Expand All @@ -94,9 +94,9 @@ harden(makeSyncFunctionCallback);
/**
* Create a callback from a potentially far function.
*
* @template {(...args: unknown[]) => any} I
* @template {(...args: any[]) => any} I
* @template {ERef<(...args: [...B, ...Parameters<I>]) => ReturnType<I>>} [T=ERef<I>]
* @template {unknown[]} [B=[]]
* @template {any[]} [B=[]]
* @param {T} target
* @param {B} bound
* @returns {Callback<I>}
Expand All @@ -113,12 +113,12 @@ harden(makeFunctionCallback);
/**
* Create a callback from a near method.
*
* @template {(...args: unknown[]) => any} I
* @template {(...args: any[]) => any} I
* @template {PropertyKey} P
* @template {{
* [x in P]: (...args: [...B, ...Parameters<I>]) => ReturnType<I>;
* }} [T={ [x in P]: I }]
* @template {unknown[]} [B=[]]
* @template {any[]} [B=[]]
* @param {T} target
* @param {P} methodName
* @param {B} bound
Expand All @@ -139,12 +139,12 @@ harden(makeSyncMethodCallback);
/**
* Create a callback from a potentially far method.
*
* @template {(...args: unknown[]) => any} I
* @template {(...args: any[]) => any} I
* @template {PropertyKey} P
* @template {ERef<{
* [x in P]: (...args: [...B, ...Parameters<I>]) => ReturnType<I>;
* }>} [T=ERef<{ [x in P]: I }>]
* @template {unknown[]} [B=[]]
* @template {any[]} [B=[]]
* @param {T} target
* @param {P} methodName
* @param {B} bound
Expand Down Expand Up @@ -200,11 +200,11 @@ export const prepareAttenuator = (
{ interfaceGuard, tag = 'Attenuator' } = {},
) => {
/**
* @typedef {(this: any, ...args: unknown[]) => any} Method
* @typedef {(this: any, ...args: any[]) => any} Method
*
* @typedef {{ [K in M]?: Callback<any> | null }} Overrides
*
* @typedef {{ [K in M]: (this: any, ...args: unknown[]) => any }} Methods
* @typedef {{ [K in M]: (this: any, ...args: any[]) => any }} Methods
*/
const methods = /** @type {Methods} */ (
fromEntries(
Expand Down
2 changes: 1 addition & 1 deletion packages/internal/src/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export type TotalMap<K, V> = Omit<Map<K, V>, 'get'> & {
export type TotalMapFrom<M extends Map> =
M extends Map<infer K, infer V> ? TotalMap<K, V> : never;

export declare class Callback<I extends (...args: unknown[]) => any> {
export declare class Callback<I extends (...args: any[]) => any> {
private iface: I;

public target: any;
Expand Down
13 changes: 13 additions & 0 deletions patches/@endo+eventual-send+1.2.4.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/node_modules/@endo/eventual-send/src/types.d.ts b/node_modules/@endo/eventual-send/src/types.d.ts
index d847557..64bb686 100644
--- a/node_modules/@endo/eventual-send/src/types.d.ts
+++ b/node_modules/@endo/eventual-send/src/types.d.ts
@@ -17,7 +17,7 @@ export type * from './track-turns.js';
// Types exposed to modules.
//

-export type Callable = (...args: unknown[]) => any;
+export type Callable = (...args: any[]) => any;

/**
* Nominal type to carry the local and remote interfaces of a Remotable.
2 changes: 0 additions & 2 deletions scripts/get-packed-versions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ corepack enable
yarn install 1>&2
yarn build 1>&2

yarn lerna run build:types 1>&2

npm query .workspace | jq -r '.[].location' | while read -r dir; do
# Skip private packages.
echo "dir=$dir" 1>&2
Expand Down
6 changes: 0 additions & 6 deletions scripts/registry.sh
Original file line number Diff line number Diff line change
Expand Up @@ -70,17 +70,11 @@ publish() {
yarn build
git commit --allow-empty -am "chore: prepare for publishing"

# Convention used in Endo
yarn lerna run build:types

# Publish the packages to our local service.
# without concurrency until https://github.com/Agoric/agoric-sdk/issues/8091
yarn lerna version --concurrency 1 prerelease --exact \
--preid=dev --no-push --no-git-tag-version --yes

# Convention used in Endo
yarn lerna run clean:types

# Change any version prefices to an exact match, and merge our versions.
VERSIONSHASH=$(jq --slurpfile versions <(popd > /dev/null && git cat-file blob "$VERSIONSHASH") \
'[to_entries[] | { key: .key, value: (.value | sub("^[~^]"; "")) }]
Expand Down
3 changes: 1 addition & 2 deletions scripts/replace-packages.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ DSTDIR=${2-$PWD/node_modules}
pushd "$SRCDIR"
yarn install
npm run build
# Endo requires this
npx lerna run build:types || true

npm query .workspace | jq -r '.[].location' | while read -r dir; do
# Skip private packages.
test "$(jq .private < "$dir/package.json")" != true || continue
Expand Down

0 comments on commit dfc7a48

Please sign in to comment.