* 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)
| 208 | * @returns {void} |
| 209 | */ |
| 210 | function 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 | |
| 224 | module.exports = defineConfig({ |
| 225 | async constraints({ Yarn }) { |
no outgoing calls
no test coverage detected
searching dependent graphs…