MCPcopy Create free account
hub / github.com/MetaMask/rpc-errors / expectExports

Function expectExports

yarn.config.cjs:210–222  ·  view source on GitHub ↗

* Expect that the workspace has a valid `exports` field. The `exports` field * is expected to: * * - Export a `types` entrypoint as the first export, or not at all. * * This is required for proper TypeScript support when using `Node16` (or later) * module resolution. * * @param {Workspace} w

(workspace)

Source from the content-addressed store, hash-verified

208 * @returns {void}
209 */
210function expectExports(workspace) {
211 const { exports: manifestExports } = workspace.manifest;
212 Object.entries(manifestExports)
213 .filter(([, exportValue]) => typeof exportValue !== 'string')
214 .forEach(([exportName, exportObject]) => {
215 const keys = Object.keys(exportObject);
216 if (keys.includes('types') && keys[0] !== 'types') {
217 workspace.error(
218 `The "types" export must be the first export in the "exports" field for the export "${exportName}".`,
219 );
220 }
221 });
222}
223
224module.exports = defineConfig({
225 async constraints({ Yarn }) {

Callers 1

constraintsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…