Skip to content

Commit 80cffff

Browse files
Merge branch 'master' into docs/v9-tokens-search
2 parents 8ab1464 + bad91e9 commit 80cffff

1 file changed

Lines changed: 1 addition & 67 deletions

File tree

scripts/tasks/src/api-extractor.ts

Lines changed: 1 addition & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,10 @@ interface ApiExtractorCliRunCommandArgs {
5151

5252
export function apiExtractor(): TaskFunction {
5353
const { configs, configsToExecute } = getConfig();
54-
const messages = {
54+
const messages: Record<keyof typeof compilerMessages, string[]> = {
5555
TS7016: [] as string[],
5656
TS2305: [] as string[],
5757
};
58-
let configDebug: Parameters<NonNullable<ApiExtractorOptions['onConfigLoaded']>>[0] | null = null;
5958

6059
const args: ReturnType<typeof getJustArgv> & Partial<ApiExtractorCliRunCommandArgs> = getJustArgv();
6160
const { isUsingTsSolutionConfigs, packageJson, tsConfig } = getTsPathAliasesConfig();
@@ -70,8 +69,6 @@ export function apiExtractor(): TaskFunction {
7069
*/
7170
const isLocalBuild = args.local ?? !(process.env.TF_BUILD || isCI);
7271

73-
console.log({ isLocalBuild });
74-
7572
const tasks = configsToExecute.map(([configPath, configName]) => {
7673
const taskName = `api-extractor:${configName}`;
7774

@@ -120,8 +117,6 @@ export function apiExtractor(): TaskFunction {
120117

121118
// NOTE: internally just-tasks calls `options.onConfigLoaded?.(rawConfig);` so we need to mutate object properties (js passes objects by reference)
122119
config.compiler = compilerConfig;
123-
124-
configDebug = config;
125120
}
126121

127122
function messageCallback(message: Parameters<NonNullable<ApiExtractorOptions['messageCallback']>>[0]) {
@@ -150,25 +145,6 @@ export function apiExtractor(): TaskFunction {
150145
return;
151146
}
152147

153-
// Log on CI processed configs for better troubleshooting for https://github.com/microsoft/fluentui/issues/25766
154-
// if (process.env.TF_BUILD) {
155-
logger.info('❌ api-extractor FAIL debug:', {
156-
configsToExecute,
157-
extractorOptions: JSON.stringify(configDebug, null, 2),
158-
});
159-
// }
160-
161-
if (messages.TS2305.length) {
162-
const errTitle = [
163-
chalk.bgRed.white.bold(`api-extractor | API VIOLATION:`),
164-
chalk.red(` Your package public API uses \`@internal\` marked API's from following packages:`),
165-
'\n',
166-
].join('');
167-
const logErr = formatApiViolationMessage(messages.TS2305);
168-
169-
logger.error(errTitle, logErr, '\n');
170-
}
171-
172148
if (messages.TS7016.length) {
173149
const errTitle = [
174150
chalk.bgRed.white.bold(`api-extractor | MISSING DEPENDENCY TYPE DECLARATIONS:`),
@@ -208,48 +184,6 @@ function getConfig() {
208184
return { configsToExecute, configs };
209185
}
210186

211-
/**
212-
*
213-
* @example
214-
*
215-
* ```
216-
(TS2305) Module '"@fluentui/react-shared-contexts"' has no exported member 'ThemeContextValue_unstable'.
217-
(TS2305) Module '"@fluentui/react-shared-contexts"' has no exported member 'TooltipVisibilityContextValue_unstable'.
218-
219-
↓ ↓ ↓
220-
221-
@fluentui/react-shared-contexts:
222-
- TooltipVisibilityContextValue_unstable
223-
- ThemeContextValue_unstable
224-
```
225-
*/
226-
function formatApiViolationMessage(messages: string[]) {
227-
const regexPkg = /'"(@fluentui\/[a-z-]+)"'/i;
228-
const exportedTokenRegex = /'([a-z-_]+)'/i;
229-
230-
const byPackage = messages.reduce((acc, curr) => {
231-
const [, packageName] = regexPkg.exec(curr) ?? [];
232-
const [, exportedToken] = exportedTokenRegex.exec(curr) ?? [];
233-
if (acc[packageName]) {
234-
acc[packageName].add(exportedToken);
235-
return acc;
236-
}
237-
acc[packageName] = new Set([exportedToken]);
238-
return acc;
239-
}, {} as Record<string, Set<string>>);
240-
241-
return Object.entries(byPackage)
242-
.map(([packageName, tokens]) => {
243-
return [
244-
chalk.red.underline(packageName) + ':',
245-
Array.from(tokens)
246-
.map(token => chalk.italic.red(' - ' + token))
247-
.join('\n'),
248-
].join('\n');
249-
})
250-
.join('\n');
251-
}
252-
253187
/**
254188
*
255189
* @example

0 commit comments

Comments
 (0)