14 lines
522 B
TypeScript
14 lines
522 B
TypeScript
|
/**
|
||
|
* @license
|
||
|
* Copyright Google Inc. All Rights Reserved.
|
||
|
*
|
||
|
* Use of this source code is governed by an MIT-style license that can be
|
||
|
* found in the LICENSE file at https://angular.io/license
|
||
|
*/
|
||
|
import * as ts from 'typescript';
|
||
|
import {AbsoluteFsPath, absoluteFromSourceFile, relative} from '../../../src/ngtsc/file_system';
|
||
|
|
||
|
export function isWithinPackage(packagePath: AbsoluteFsPath, sourceFile: ts.SourceFile): boolean {
|
||
|
return !relative(packagePath, absoluteFromSourceFile(sourceFile)).startsWith('..');
|
||
|
}
|