Skip to content

Commit

Permalink
Fix an issue found during testing
Browse files Browse the repository at this point in the history
  • Loading branch information
octogonz committed Oct 5, 2019
1 parent d941f49 commit 511e509
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
18 changes: 9 additions & 9 deletions apps/api-extractor/src/analyzer/ExportAnalyzer.ts
Expand Up @@ -53,6 +53,14 @@ interface IAstModuleReference {
* generating .d.ts rollups.
*/
export class ExportAnalyzer {
// Captures "@a/b" or "d" from these examples:
// @a/b
// @a/b/c
// d
// d/
// d/e
private static _modulePathRegExp: RegExp = /^((?:@[^@\/\s]+\/)?[^@\/\s]+)(?:.*)$/;

private readonly _program: ts.Program;
private readonly _typeChecker: ts.TypeChecker;
private readonly _bundledPackageNames: Set<string>;
Expand Down Expand Up @@ -234,14 +242,6 @@ export class ExportAnalyzer {
return entryPointAstModule.astModuleExportInfo;
}

// Captures "@a/b" or "d" from these examples:
// @a/b
// @a/b/c
// d
// d/
// d/e
private static _modulePathRegExp: RegExp = /^((?:@[^@\/\s]+\/)?[^@\/\s]+)(?:.*)$/;

/**
* Returns true if the module specifier refers to an external package. Ignores packages listed in the
* "bundledPackages" setting from the api-extractor.json config file.
Expand All @@ -261,7 +261,7 @@ export class ExportAnalyzer {
const match: RegExpExecArray | null = ExportAnalyzer._modulePathRegExp.exec(moduleSpecifier);
if (match) {
// Extract "@my-scope/my-package" from "@my-scope/my-package/path/module"
const packageName: string = match[0];
const packageName: string = match[1];
if (this._bundledPackageNames.has(packageName)) {
return false;
}
Expand Down
Expand Up @@ -4,7 +4,7 @@
```ts

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

// Warning: (ae-forgotten-export) The symbol "Lib1Class" needs to be exported by the entry point index.d.ts
//
Expand Down
@@ -1,4 +1,4 @@
import { Lib2Class } from 'api-extractor-lib2-test';
import { Lib2Class } from 'api-extractor-lib2-test/lib/index';

/** @public */
export declare function f(arg1: Lib1Class, arg2: Lib2Class): void;
Expand Down
@@ -1,8 +1,8 @@
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
// See LICENSE in the project root for license information.

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

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

0 comments on commit 511e509

Please sign in to comment.