@davidlj95/ngx-meta
Version:
Set your Angular site's metadata: standard meta tags, Open Graph, Twitter Cards, JSON-LD structured data and more. Supports SSR (and Angular Universal). Use a service. Use routes' data. Set it up in a flash! 🚀
34 lines • 1.66 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.getAllTypescriptFiles = getAllTypescriptFiles;
const typescript_1 = require("typescript");
// https://github.com/ngxtension/ngxtension-platform/blob/4.0.0/libs/plugin/src/migrations/rename-computeds/rename-computeds.ts
// https://github.com/nrwl/nx/blob/20.0.6/packages/devkit/src/generators/visit-not-ignored-files.ts
// https://github.com/ngrx/platform/blob/18.1.1/modules/store/schematics-core/utility/visitors.ts
function* getAllTypescriptFiles(tree, options = {}) {
for (const filePath of getAllTypescriptFilePaths(tree.root)) {
const content = tree.readText(filePath);
if (options.contentFilter && !options.contentFilter(content)) {
continue;
}
const sourceFile = (0, typescript_1.createSourceFile)(filePath, tree.readText(filePath), typescript_1.ScriptTarget.Latest, true);
yield [filePath, sourceFile];
}
}
const TYPESCRIPT_FILE_EXTENSIONS = ['.mts', '.ts'];
const TYPESCRIPT_DEFINITION_FILE_EXTENSION_PREFIX = '.d';
function* getAllTypescriptFilePaths(dir) {
for (const path of dir.subfiles) {
if (TYPESCRIPT_FILE_EXTENSIONS.some((typescriptFileExtension) => path.endsWith(typescriptFileExtension) &&
!path.endsWith(`${TYPESCRIPT_DEFINITION_FILE_EXTENSION_PREFIX}${typescriptFileExtension}`))) {
yield dir.file(path).path;
}
}
for (const path of dir.subdirs) {
if (path === 'node_modules') {
continue;
}
yield* getAllTypescriptFilePaths(dir.dir(path));
}
}
//# sourceMappingURL=get-all-typescript-files.js.map