From 16ca97e056f2e354c71302562f3f838ca9d5ab03 Mon Sep 17 00:00:00 2001 From: Turadg Aleahmad Date: Sat, 8 Jun 2024 06:37:58 -0700 Subject: [PATCH] chore(types): define CoreEvalDescriptor --- packages/deploy-script-support/src/externalTypes.js | 12 +++++++++++- .../deploy-script-support/src/writeCoreEvalParts.js | 9 +++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/packages/deploy-script-support/src/externalTypes.js b/packages/deploy-script-support/src/externalTypes.js index ad98a6b44fb..60a3a2ce5dc 100644 --- a/packages/deploy-script-support/src/externalTypes.js +++ b/packages/deploy-script-support/src/externalTypes.js @@ -27,6 +27,16 @@ export {}; * @returns {Promise} */ +/** + * @typedef CoreEvalDescriptor + * @property {string} sourceSpec import specifier for a module + * @property {[manifestGetterName: string, ...manifestGetterArgs: any[]]} getManifestCall + * the name of a function exported by the module and arguments to invoke it + * with in order to get a manifest (a Record that associates functions to be + * invoked and permits defining bootstrap-space powers they will have access + * to, see {@link ../README.md} and {@link runModuleBehaviors}) + */ + /** * @callback CoreEvalBuilder * @param {{ @@ -35,5 +45,5 @@ export {}; * wrapInstall?: (f: T) => T } * } powers * @param {...any} args - * @returns {Promise<{sourceSpec: string, getManifestCall: [exportedGetManifest: string, ...manifestArgs: any[]]}>} + * @returns {Promise} */ diff --git a/packages/deploy-script-support/src/writeCoreEvalParts.js b/packages/deploy-script-support/src/writeCoreEvalParts.js index 4bc45b454f3..06d93a3c1bf 100644 --- a/packages/deploy-script-support/src/writeCoreEvalParts.js +++ b/packages/deploy-script-support/src/writeCoreEvalParts.js @@ -10,6 +10,10 @@ import { permits as defaultPermits, } from './coreProposalBehavior.js'; +/** + * @import {CoreEvalDescriptor} from './externalTypes.js'; + */ + /** * @callback WriteCoreEval write to disk the files needed for a CoreEval (js code to`${filePrefix}.js`, permits to `${filePrefix}-permit.json`, an overall * summary to `${filePrefix}-plan.json), plus whatever bundles bundles the code loads) @@ -54,6 +58,11 @@ export const makeWriteCoreEval = ( return bundlerCache; }; + /** + * + * @param {CoreEvalDescriptor} coreEval + * @param {*} additionalPermits + */ const mergeEvalPermit = async (coreEval, additionalPermits) => { const { sourceSpec,