From 70ac6d68c25d398435d0fb0f11d8f5067556598d Mon Sep 17 00:00:00 2001 From: Patrik Oldsberg Date: Thu, 22 Apr 2021 18:24:41 +0200 Subject: [PATCH] scripts/api-extractor: some more explanations Signed-off-by: Patrik Oldsberg --- scripts/api-extractor.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/scripts/api-extractor.ts b/scripts/api-extractor.ts index 7bbf955f9a..7da9fac515 100644 --- a/scripts/api-extractor.ts +++ b/scripts/api-extractor.ts @@ -35,7 +35,13 @@ import { MarkdownDocumenter } from '@microsoft/api-documenter/lib/documenters/Ma const tmpDir = resolvePath(__dirname, '../node_modules/.cache/api-extractor'); /** - * Yup + * All of this monkey patching below is because MUI has these bare package.json file as a method + * for making TypeScript accept imports like `@material-ui/core/Button`, and improve tree-shaking + * by declaring them side effect free. + * + * The package.json lookup logic in api-extractor really doesn't like that though, as it enforces + * that the 'name' field exists in all package.json files that it discovers. This below is just + * making sure that we ignore those file package.json files instead of crashing. */ const { PackageJsonLookup, @@ -61,6 +67,7 @@ const DOCUMENTED_PACKAGES = [ 'packages/cli-common', 'packages/config', 'packages/config-loader', + // TODO(Rugvip): Enable these once `import * as ...` and `import()` PRs have landed, #1796 & #1916. // 'packages/core', // 'packages/core-api', 'packages/dev-utils',