X Tutup
Skip to content

Commit 511e509

Browse files
committed
Fix an issue found during testing
1 parent d941f49 commit 511e509

File tree

4 files changed

+13
-13
lines changed

4 files changed

+13
-13
lines changed

apps/api-extractor/src/analyzer/ExportAnalyzer.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,14 @@ interface IAstModuleReference {
5353
* generating .d.ts rollups.
5454
*/
5555
export class ExportAnalyzer {
56+
// Captures "@a/b" or "d" from these examples:
57+
// @a/b
58+
// @a/b/c
59+
// d
60+
// d/
61+
// d/e
62+
private static _modulePathRegExp: RegExp = /^((?:@[^@\/\s]+\/)?[^@\/\s]+)(?:.*)$/;
63+
5664
private readonly _program: ts.Program;
5765
private readonly _typeChecker: ts.TypeChecker;
5866
private readonly _bundledPackageNames: Set<string>;
@@ -234,14 +242,6 @@ export class ExportAnalyzer {
234242
return entryPointAstModule.astModuleExportInfo;
235243
}
236244

237-
// Captures "@a/b" or "d" from these examples:
238-
// @a/b
239-
// @a/b/c
240-
// d
241-
// d/
242-
// d/e
243-
private static _modulePathRegExp: RegExp = /^((?:@[^@\/\s]+\/)?[^@\/\s]+)(?:.*)$/;
244-
245245
/**
246246
* Returns true if the module specifier refers to an external package. Ignores packages listed in the
247247
* "bundledPackages" setting from the api-extractor.json config file.
@@ -261,7 +261,7 @@ export class ExportAnalyzer {
261261
const match: RegExpExecArray | null = ExportAnalyzer._modulePathRegExp.exec(moduleSpecifier);
262262
if (match) {
263263
// Extract "@my-scope/my-package" from "@my-scope/my-package/path/module"
264-
const packageName: string = match[0];
264+
const packageName: string = match[1];
265265
if (this._bundledPackageNames.has(packageName)) {
266266
return false;
267267
}

build-tests/api-extractor-scenarios/etc/test-outputs/bundledPackages/api-extractor-scenarios.api.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
55
```ts
66

7-
import { Lib2Class } from 'api-extractor-lib2-test';
7+
import { Lib2Class } from 'api-extractor-lib2-test/lib/index';
88

99
// Warning: (ae-forgotten-export) The symbol "Lib1Class" needs to be exported by the entry point index.d.ts
1010
//

build-tests/api-extractor-scenarios/etc/test-outputs/bundledPackages/rollup.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Lib2Class } from 'api-extractor-lib2-test';
1+
import { Lib2Class } from 'api-extractor-lib2-test/lib/index';
22

33
/** @public */
44
export declare function f(arg1: Lib1Class, arg2: Lib2Class): void;

build-tests/api-extractor-scenarios/src/bundledPackages/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
22
// See LICENSE in the project root for license information.
33

4-
import { Lib1Class } from "api-extractor-lib1-test";
5-
import { Lib2Class } from "api-extractor-lib2-test";
4+
import { Lib1Class } from "api-extractor-lib1-test/lib/index";
5+
import { Lib2Class } from "api-extractor-lib2-test/lib/index";
66

77
/** @public */
88
export function f(arg1: Lib1Class, arg2: Lib2Class): void {

0 commit comments

Comments
 (0)
X Tutup