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

reduce Endo build coupling #9395

Merged
merged 2 commits into from
Aug 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading