UNPKG

23.1 kBJavaScriptView Raw
1
2 import {createRequire as __cjsCompatRequire} from 'module';
3 const require = __cjsCompatRequire(import.meta.url);
4 const __ESM_IMPORT_META_URL__ = import.meta.url;
5
6// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/reflection/src/typescript.mjs
7import ts4 from "typescript";
8
9// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/reflection/src/host.mjs
10import ts from "typescript";
11var Decorator = {
12 nodeForError: (decorator) => {
13 if (decorator.node !== null) {
14 return decorator.node;
15 } else {
16 return decorator.synthesizedFor;
17 }
18 }
19};
20function isDecoratorIdentifier(exp) {
21 return ts.isIdentifier(exp) || ts.isPropertyAccessExpression(exp) && ts.isIdentifier(exp.expression) && ts.isIdentifier(exp.name);
22}
23var ClassMemberKind;
24(function(ClassMemberKind2) {
25 ClassMemberKind2[ClassMemberKind2["Constructor"] = 0] = "Constructor";
26 ClassMemberKind2[ClassMemberKind2["Getter"] = 1] = "Getter";
27 ClassMemberKind2[ClassMemberKind2["Setter"] = 2] = "Setter";
28 ClassMemberKind2[ClassMemberKind2["Property"] = 3] = "Property";
29 ClassMemberKind2[ClassMemberKind2["Method"] = 4] = "Method";
30})(ClassMemberKind || (ClassMemberKind = {}));
31var KnownDeclaration;
32(function(KnownDeclaration2) {
33 KnownDeclaration2[KnownDeclaration2["JsGlobalObject"] = 0] = "JsGlobalObject";
34 KnownDeclaration2[KnownDeclaration2["TsHelperAssign"] = 1] = "TsHelperAssign";
35 KnownDeclaration2[KnownDeclaration2["TsHelperSpread"] = 2] = "TsHelperSpread";
36 KnownDeclaration2[KnownDeclaration2["TsHelperSpreadArrays"] = 3] = "TsHelperSpreadArrays";
37 KnownDeclaration2[KnownDeclaration2["TsHelperSpreadArray"] = 4] = "TsHelperSpreadArray";
38 KnownDeclaration2[KnownDeclaration2["TsHelperRead"] = 5] = "TsHelperRead";
39})(KnownDeclaration || (KnownDeclaration = {}));
40function isConcreteDeclaration(decl) {
41 return decl.kind === 0;
42}
43
44// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/reflection/src/type_to_value.mjs
45import ts2 from "typescript";
46function typeToValue(typeNode, checker) {
47 if (typeNode === null) {
48 return missingType();
49 }
50 if (!ts2.isTypeReferenceNode(typeNode)) {
51 return unsupportedType(typeNode);
52 }
53 const symbols = resolveTypeSymbols(typeNode, checker);
54 if (symbols === null) {
55 return unknownReference(typeNode);
56 }
57 const { local, decl } = symbols;
58 if (decl.valueDeclaration === void 0 || decl.flags & ts2.SymbolFlags.ConstEnum) {
59 let typeOnlyDecl = null;
60 if (decl.declarations !== void 0 && decl.declarations.length > 0) {
61 typeOnlyDecl = decl.declarations[0];
62 }
63 return noValueDeclaration(typeNode, typeOnlyDecl);
64 }
65 const firstDecl = local.declarations && local.declarations[0];
66 if (firstDecl !== void 0) {
67 if (ts2.isImportClause(firstDecl) && firstDecl.name !== void 0) {
68 if (firstDecl.isTypeOnly) {
69 return typeOnlyImport(typeNode, firstDecl);
70 }
71 return {
72 kind: 0,
73 expression: firstDecl.name,
74 defaultImportStatement: firstDecl.parent
75 };
76 } else if (ts2.isImportSpecifier(firstDecl)) {
77 if (firstDecl.isTypeOnly) {
78 return typeOnlyImport(typeNode, firstDecl);
79 }
80 if (firstDecl.parent.parent.isTypeOnly) {
81 return typeOnlyImport(typeNode, firstDecl.parent.parent);
82 }
83 const importedName = (firstDecl.propertyName || firstDecl.name).text;
84 const [_localName, ...nestedPath] = symbols.symbolNames;
85 const moduleName = extractModuleName(firstDecl.parent.parent.parent);
86 return {
87 kind: 1,
88 valueDeclaration: decl.valueDeclaration,
89 moduleName,
90 importedName,
91 nestedPath
92 };
93 } else if (ts2.isNamespaceImport(firstDecl)) {
94 if (firstDecl.parent.isTypeOnly) {
95 return typeOnlyImport(typeNode, firstDecl.parent);
96 }
97 if (symbols.symbolNames.length === 1) {
98 return namespaceImport(typeNode, firstDecl.parent);
99 }
100 const [_ns, importedName, ...nestedPath] = symbols.symbolNames;
101 const moduleName = extractModuleName(firstDecl.parent.parent);
102 return {
103 kind: 1,
104 valueDeclaration: decl.valueDeclaration,
105 moduleName,
106 importedName,
107 nestedPath
108 };
109 }
110 }
111 const expression = typeNodeToValueExpr(typeNode);
112 if (expression !== null) {
113 return {
114 kind: 0,
115 expression,
116 defaultImportStatement: null
117 };
118 } else {
119 return unsupportedType(typeNode);
120 }
121}
122function unsupportedType(typeNode) {
123 return {
124 kind: 2,
125 reason: { kind: 5, typeNode }
126 };
127}
128function noValueDeclaration(typeNode, decl) {
129 return {
130 kind: 2,
131 reason: { kind: 1, typeNode, decl }
132 };
133}
134function typeOnlyImport(typeNode, node) {
135 return {
136 kind: 2,
137 reason: { kind: 2, typeNode, node }
138 };
139}
140function unknownReference(typeNode) {
141 return {
142 kind: 2,
143 reason: { kind: 3, typeNode }
144 };
145}
146function namespaceImport(typeNode, importClause) {
147 return {
148 kind: 2,
149 reason: { kind: 4, typeNode, importClause }
150 };
151}
152function missingType() {
153 return {
154 kind: 2,
155 reason: { kind: 0 }
156 };
157}
158function typeNodeToValueExpr(node) {
159 if (ts2.isTypeReferenceNode(node)) {
160 return entityNameToValue(node.typeName);
161 } else {
162 return null;
163 }
164}
165function resolveTypeSymbols(typeRef, checker) {
166 const typeName = typeRef.typeName;
167 const typeRefSymbol = checker.getSymbolAtLocation(typeName);
168 if (typeRefSymbol === void 0) {
169 return null;
170 }
171 let local = typeRefSymbol;
172 let leftMost = typeName;
173 const symbolNames = [];
174 while (ts2.isQualifiedName(leftMost)) {
175 symbolNames.unshift(leftMost.right.text);
176 leftMost = leftMost.left;
177 }
178 symbolNames.unshift(leftMost.text);
179 if (leftMost !== typeName) {
180 const localTmp = checker.getSymbolAtLocation(leftMost);
181 if (localTmp !== void 0) {
182 local = localTmp;
183 }
184 }
185 let decl = typeRefSymbol;
186 if (typeRefSymbol.flags & ts2.SymbolFlags.Alias) {
187 decl = checker.getAliasedSymbol(typeRefSymbol);
188 }
189 return { local, decl, symbolNames };
190}
191function entityNameToValue(node) {
192 if (ts2.isQualifiedName(node)) {
193 const left = entityNameToValue(node.left);
194 return left !== null ? ts2.createPropertyAccess(left, node.right) : null;
195 } else if (ts2.isIdentifier(node)) {
196 return ts2.getMutableClone(node);
197 } else {
198 return null;
199 }
200}
201function extractModuleName(node) {
202 if (!ts2.isStringLiteral(node.moduleSpecifier)) {
203 throw new Error("not a module specifier");
204 }
205 return node.moduleSpecifier.text;
206}
207
208// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/reflection/src/util.mjs
209import ts3 from "typescript";
210function isNamedClassDeclaration(node) {
211 return ts3.isClassDeclaration(node) && isIdentifier(node.name);
212}
213function isNamedFunctionDeclaration(node) {
214 return ts3.isFunctionDeclaration(node) && isIdentifier(node.name);
215}
216function isNamedVariableDeclaration(node) {
217 return ts3.isVariableDeclaration(node) && isIdentifier(node.name);
218}
219function isIdentifier(node) {
220 return node !== void 0 && ts3.isIdentifier(node);
221}
222
223// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/reflection/src/typescript.mjs
224var TypeScriptReflectionHost = class {
225 constructor(checker) {
226 this.checker = checker;
227 }
228 getDecoratorsOfDeclaration(declaration) {
229 if (declaration.decorators === void 0 || declaration.decorators.length === 0) {
230 return null;
231 }
232 return declaration.decorators.map((decorator) => this._reflectDecorator(decorator)).filter((dec) => dec !== null);
233 }
234 getMembersOfClass(clazz) {
235 const tsClazz = castDeclarationToClassOrDie(clazz);
236 return tsClazz.members.map((member) => this._reflectMember(member)).filter((member) => member !== null);
237 }
238 getConstructorParameters(clazz) {
239 const tsClazz = castDeclarationToClassOrDie(clazz);
240 const isDeclaration = tsClazz.getSourceFile().isDeclarationFile;
241 const ctor = tsClazz.members.find((member) => ts4.isConstructorDeclaration(member) && (isDeclaration || member.body !== void 0));
242 if (ctor === void 0) {
243 return null;
244 }
245 return ctor.parameters.map((node) => {
246 const name = parameterName(node.name);
247 const decorators = this.getDecoratorsOfDeclaration(node);
248 let originalTypeNode = node.type || null;
249 let typeNode = originalTypeNode;
250 if (typeNode && ts4.isUnionTypeNode(typeNode)) {
251 let childTypeNodes = typeNode.types.filter((childTypeNode) => !(ts4.isLiteralTypeNode(childTypeNode) && childTypeNode.literal.kind === ts4.SyntaxKind.NullKeyword));
252 if (childTypeNodes.length === 1) {
253 typeNode = childTypeNodes[0];
254 }
255 }
256 const typeValueReference = typeToValue(typeNode, this.checker);
257 return {
258 name,
259 nameNode: node.name,
260 typeValueReference,
261 typeNode: originalTypeNode,
262 decorators
263 };
264 });
265 }
266 getImportOfIdentifier(id) {
267 const directImport = this.getDirectImportOfIdentifier(id);
268 if (directImport !== null) {
269 return directImport;
270 } else if (ts4.isQualifiedName(id.parent) && id.parent.right === id) {
271 return this.getImportOfNamespacedIdentifier(id, getQualifiedNameRoot(id.parent));
272 } else if (ts4.isPropertyAccessExpression(id.parent) && id.parent.name === id) {
273 return this.getImportOfNamespacedIdentifier(id, getFarLeftIdentifier(id.parent));
274 } else {
275 return null;
276 }
277 }
278 getExportsOfModule(node) {
279 if (!ts4.isSourceFile(node)) {
280 throw new Error(`getExportsOfModule() called on non-SourceFile in TS code`);
281 }
282 const symbol = this.checker.getSymbolAtLocation(node);
283 if (symbol === void 0) {
284 return null;
285 }
286 const map = /* @__PURE__ */ new Map();
287 this.checker.getExportsOfModule(symbol).forEach((exportSymbol) => {
288 const decl = this.getDeclarationOfSymbol(exportSymbol, null);
289 if (decl !== null) {
290 map.set(exportSymbol.name, decl);
291 }
292 });
293 return map;
294 }
295 isClass(node) {
296 return isNamedClassDeclaration(node);
297 }
298 hasBaseClass(clazz) {
299 return this.getBaseClassExpression(clazz) !== null;
300 }
301 getBaseClassExpression(clazz) {
302 if (!(ts4.isClassDeclaration(clazz) || ts4.isClassExpression(clazz)) || clazz.heritageClauses === void 0) {
303 return null;
304 }
305 const extendsClause = clazz.heritageClauses.find((clause) => clause.token === ts4.SyntaxKind.ExtendsKeyword);
306 if (extendsClause === void 0) {
307 return null;
308 }
309 const extendsType = extendsClause.types[0];
310 if (extendsType === void 0) {
311 return null;
312 }
313 return extendsType.expression;
314 }
315 getDeclarationOfIdentifier(id) {
316 let symbol = this.checker.getSymbolAtLocation(id);
317 if (symbol === void 0) {
318 return null;
319 }
320 return this.getDeclarationOfSymbol(symbol, id);
321 }
322 getDefinitionOfFunction(node) {
323 if (!ts4.isFunctionDeclaration(node) && !ts4.isMethodDeclaration(node) && !ts4.isFunctionExpression(node)) {
324 return null;
325 }
326 return {
327 node,
328 body: node.body !== void 0 ? Array.from(node.body.statements) : null,
329 parameters: node.parameters.map((param) => {
330 const name = parameterName(param.name);
331 const initializer = param.initializer || null;
332 return { name, node: param, initializer };
333 })
334 };
335 }
336 getGenericArityOfClass(clazz) {
337 if (!ts4.isClassDeclaration(clazz)) {
338 return null;
339 }
340 return clazz.typeParameters !== void 0 ? clazz.typeParameters.length : 0;
341 }
342 getVariableValue(declaration) {
343 return declaration.initializer || null;
344 }
345 getDtsDeclaration(_) {
346 return null;
347 }
348 getInternalNameOfClass(clazz) {
349 return clazz.name;
350 }
351 getAdjacentNameOfClass(clazz) {
352 return clazz.name;
353 }
354 isStaticallyExported(decl) {
355 let topLevel = decl;
356 if (ts4.isVariableDeclaration(decl) && ts4.isVariableDeclarationList(decl.parent)) {
357 topLevel = decl.parent.parent;
358 }
359 if (topLevel.modifiers !== void 0 && topLevel.modifiers.some((modifier) => modifier.kind === ts4.SyntaxKind.ExportKeyword)) {
360 return true;
361 }
362 if (topLevel.parent === void 0 || !ts4.isSourceFile(topLevel.parent)) {
363 return false;
364 }
365 const localExports = this.getLocalExportedDeclarationsOfSourceFile(decl.getSourceFile());
366 return localExports.has(decl);
367 }
368 getDirectImportOfIdentifier(id) {
369 const symbol = this.checker.getSymbolAtLocation(id);
370 if (symbol === void 0 || symbol.declarations === void 0 || symbol.declarations.length !== 1) {
371 return null;
372 }
373 const decl = symbol.declarations[0];
374 const importDecl = getContainingImportDeclaration(decl);
375 if (importDecl === null) {
376 return null;
377 }
378 if (!ts4.isStringLiteral(importDecl.moduleSpecifier)) {
379 return null;
380 }
381 return { from: importDecl.moduleSpecifier.text, name: getExportedName(decl, id) };
382 }
383 getImportOfNamespacedIdentifier(id, namespaceIdentifier) {
384 if (namespaceIdentifier === null) {
385 return null;
386 }
387 const namespaceSymbol = this.checker.getSymbolAtLocation(namespaceIdentifier);
388 if (!namespaceSymbol || namespaceSymbol.declarations === void 0) {
389 return null;
390 }
391 const declaration = namespaceSymbol.declarations.length === 1 ? namespaceSymbol.declarations[0] : null;
392 if (!declaration) {
393 return null;
394 }
395 const namespaceDeclaration = ts4.isNamespaceImport(declaration) ? declaration : null;
396 if (!namespaceDeclaration) {
397 return null;
398 }
399 const importDeclaration = namespaceDeclaration.parent.parent;
400 if (!ts4.isStringLiteral(importDeclaration.moduleSpecifier)) {
401 return null;
402 }
403 return {
404 from: importDeclaration.moduleSpecifier.text,
405 name: id.text
406 };
407 }
408 getDeclarationOfSymbol(symbol, originalId) {
409 let valueDeclaration = void 0;
410 if (symbol.valueDeclaration !== void 0) {
411 valueDeclaration = symbol.valueDeclaration;
412 } else if (symbol.declarations !== void 0 && symbol.declarations.length > 0) {
413 valueDeclaration = symbol.declarations[0];
414 }
415 if (valueDeclaration !== void 0 && ts4.isShorthandPropertyAssignment(valueDeclaration)) {
416 const shorthandSymbol = this.checker.getShorthandAssignmentValueSymbol(valueDeclaration);
417 if (shorthandSymbol === void 0) {
418 return null;
419 }
420 return this.getDeclarationOfSymbol(shorthandSymbol, originalId);
421 } else if (valueDeclaration !== void 0 && ts4.isExportSpecifier(valueDeclaration)) {
422 const targetSymbol = this.checker.getExportSpecifierLocalTargetSymbol(valueDeclaration);
423 if (targetSymbol === void 0) {
424 return null;
425 }
426 return this.getDeclarationOfSymbol(targetSymbol, originalId);
427 }
428 const importInfo = originalId && this.getImportOfIdentifier(originalId);
429 const viaModule = importInfo !== null && importInfo.from !== null && !importInfo.from.startsWith(".") ? importInfo.from : null;
430 while (symbol.flags & ts4.SymbolFlags.Alias) {
431 symbol = this.checker.getAliasedSymbol(symbol);
432 }
433 if (symbol.valueDeclaration !== void 0) {
434 return {
435 node: symbol.valueDeclaration,
436 known: null,
437 viaModule,
438 identity: null,
439 kind: 0
440 };
441 } else if (symbol.declarations !== void 0 && symbol.declarations.length > 0) {
442 return {
443 node: symbol.declarations[0],
444 known: null,
445 viaModule,
446 identity: null,
447 kind: 0
448 };
449 } else {
450 return null;
451 }
452 }
453 _reflectDecorator(node) {
454 let decoratorExpr = node.expression;
455 let args = null;
456 if (ts4.isCallExpression(decoratorExpr)) {
457 args = Array.from(decoratorExpr.arguments);
458 decoratorExpr = decoratorExpr.expression;
459 }
460 if (!isDecoratorIdentifier(decoratorExpr)) {
461 return null;
462 }
463 const decoratorIdentifier = ts4.isIdentifier(decoratorExpr) ? decoratorExpr : decoratorExpr.name;
464 const importDecl = this.getImportOfIdentifier(decoratorIdentifier);
465 return {
466 name: decoratorIdentifier.text,
467 identifier: decoratorExpr,
468 import: importDecl,
469 node,
470 args
471 };
472 }
473 _reflectMember(node) {
474 let kind = null;
475 let value = null;
476 let name = null;
477 let nameNode = null;
478 if (ts4.isPropertyDeclaration(node)) {
479 kind = ClassMemberKind.Property;
480 value = node.initializer || null;
481 } else if (ts4.isGetAccessorDeclaration(node)) {
482 kind = ClassMemberKind.Getter;
483 } else if (ts4.isSetAccessorDeclaration(node)) {
484 kind = ClassMemberKind.Setter;
485 } else if (ts4.isMethodDeclaration(node)) {
486 kind = ClassMemberKind.Method;
487 } else if (ts4.isConstructorDeclaration(node)) {
488 kind = ClassMemberKind.Constructor;
489 } else {
490 return null;
491 }
492 if (ts4.isConstructorDeclaration(node)) {
493 name = "constructor";
494 } else if (ts4.isIdentifier(node.name)) {
495 name = node.name.text;
496 nameNode = node.name;
497 } else if (ts4.isStringLiteral(node.name)) {
498 name = node.name.text;
499 nameNode = node.name;
500 } else {
501 return null;
502 }
503 const decorators = this.getDecoratorsOfDeclaration(node);
504 const isStatic = node.modifiers !== void 0 && node.modifiers.some((mod) => mod.kind === ts4.SyntaxKind.StaticKeyword);
505 return {
506 node,
507 implementation: node,
508 kind,
509 type: node.type || null,
510 name,
511 nameNode,
512 decorators,
513 value,
514 isStatic
515 };
516 }
517 getLocalExportedDeclarationsOfSourceFile(file) {
518 const cacheSf = file;
519 if (cacheSf[LocalExportedDeclarations] !== void 0) {
520 return cacheSf[LocalExportedDeclarations];
521 }
522 const exportSet = /* @__PURE__ */ new Set();
523 cacheSf[LocalExportedDeclarations] = exportSet;
524 const sfSymbol = this.checker.getSymbolAtLocation(cacheSf);
525 if (sfSymbol === void 0 || sfSymbol.exports === void 0) {
526 return exportSet;
527 }
528 const iter = sfSymbol.exports.values();
529 let item = iter.next();
530 while (item.done !== true) {
531 let exportedSymbol = item.value;
532 if (exportedSymbol.flags & ts4.SymbolFlags.Alias) {
533 exportedSymbol = this.checker.getAliasedSymbol(exportedSymbol);
534 }
535 if (exportedSymbol.valueDeclaration !== void 0 && exportedSymbol.valueDeclaration.getSourceFile() === file) {
536 exportSet.add(exportedSymbol.valueDeclaration);
537 }
538 item = iter.next();
539 }
540 return exportSet;
541 }
542};
543function reflectTypeEntityToDeclaration(type, checker) {
544 let realSymbol = checker.getSymbolAtLocation(type);
545 if (realSymbol === void 0) {
546 throw new Error(`Cannot resolve type entity ${type.getText()} to symbol`);
547 }
548 while (realSymbol.flags & ts4.SymbolFlags.Alias) {
549 realSymbol = checker.getAliasedSymbol(realSymbol);
550 }
551 let node = null;
552 if (realSymbol.valueDeclaration !== void 0) {
553 node = realSymbol.valueDeclaration;
554 } else if (realSymbol.declarations !== void 0 && realSymbol.declarations.length === 1) {
555 node = realSymbol.declarations[0];
556 } else {
557 throw new Error(`Cannot resolve type entity symbol to declaration`);
558 }
559 if (ts4.isQualifiedName(type)) {
560 if (!ts4.isIdentifier(type.left)) {
561 throw new Error(`Cannot handle qualified name with non-identifier lhs`);
562 }
563 const symbol = checker.getSymbolAtLocation(type.left);
564 if (symbol === void 0 || symbol.declarations === void 0 || symbol.declarations.length !== 1) {
565 throw new Error(`Cannot resolve qualified type entity lhs to symbol`);
566 }
567 const decl = symbol.declarations[0];
568 if (ts4.isNamespaceImport(decl)) {
569 const clause = decl.parent;
570 const importDecl = clause.parent;
571 if (!ts4.isStringLiteral(importDecl.moduleSpecifier)) {
572 throw new Error(`Module specifier is not a string`);
573 }
574 return { node, from: importDecl.moduleSpecifier.text };
575 } else if (ts4.isModuleDeclaration(decl)) {
576 return { node, from: null };
577 } else {
578 throw new Error(`Unknown import type?`);
579 }
580 } else {
581 return { node, from: null };
582 }
583}
584function filterToMembersWithDecorator(members, name, module) {
585 return members.filter((member) => !member.isStatic).map((member) => {
586 if (member.decorators === null) {
587 return null;
588 }
589 const decorators = member.decorators.filter((dec) => {
590 if (dec.import !== null) {
591 return dec.import.name === name && (module === void 0 || dec.import.from === module);
592 } else {
593 return dec.name === name && module === void 0;
594 }
595 });
596 if (decorators.length === 0) {
597 return null;
598 }
599 return { member, decorators };
600 }).filter((value) => value !== null);
601}
602function reflectObjectLiteral(node) {
603 const map = /* @__PURE__ */ new Map();
604 node.properties.forEach((prop) => {
605 if (ts4.isPropertyAssignment(prop)) {
606 const name = propertyNameToString(prop.name);
607 if (name === null) {
608 return;
609 }
610 map.set(name, prop.initializer);
611 } else if (ts4.isShorthandPropertyAssignment(prop)) {
612 map.set(prop.name.text, prop.name);
613 } else {
614 return;
615 }
616 });
617 return map;
618}
619function castDeclarationToClassOrDie(declaration) {
620 if (!ts4.isClassDeclaration(declaration)) {
621 throw new Error(`Reflecting on a ${ts4.SyntaxKind[declaration.kind]} instead of a ClassDeclaration.`);
622 }
623 return declaration;
624}
625function parameterName(name) {
626 if (ts4.isIdentifier(name)) {
627 return name.text;
628 } else {
629 return null;
630 }
631}
632function propertyNameToString(node) {
633 if (ts4.isIdentifier(node) || ts4.isStringLiteral(node) || ts4.isNumericLiteral(node)) {
634 return node.text;
635 } else {
636 return null;
637 }
638}
639function getQualifiedNameRoot(qualifiedName) {
640 while (ts4.isQualifiedName(qualifiedName.left)) {
641 qualifiedName = qualifiedName.left;
642 }
643 return ts4.isIdentifier(qualifiedName.left) ? qualifiedName.left : null;
644}
645function getFarLeftIdentifier(propertyAccess) {
646 while (ts4.isPropertyAccessExpression(propertyAccess.expression)) {
647 propertyAccess = propertyAccess.expression;
648 }
649 return ts4.isIdentifier(propertyAccess.expression) ? propertyAccess.expression : null;
650}
651function getContainingImportDeclaration(node) {
652 return ts4.isImportSpecifier(node) ? node.parent.parent.parent : ts4.isNamespaceImport(node) ? node.parent.parent : null;
653}
654function getExportedName(decl, originalId) {
655 return ts4.isImportSpecifier(decl) ? (decl.propertyName !== void 0 ? decl.propertyName : decl.name).text : originalId.text;
656}
657var LocalExportedDeclarations = Symbol("LocalExportedDeclarations");
658
659export {
660 Decorator,
661 isDecoratorIdentifier,
662 ClassMemberKind,
663 KnownDeclaration,
664 isConcreteDeclaration,
665 typeNodeToValueExpr,
666 isNamedClassDeclaration,
667 isNamedFunctionDeclaration,
668 isNamedVariableDeclaration,
669 TypeScriptReflectionHost,
670 reflectTypeEntityToDeclaration,
671 filterToMembersWithDecorator,
672 reflectObjectLiteral
673};
674/**
675 * @license
676 * Copyright Google LLC All Rights Reserved.
677 *
678 * Use of this source code is governed by an MIT-style license that can be
679 * found in the LICENSE file at https://angular.io/license
680 */
681//# sourceMappingURL=chunk-Q5GIQ3RV.js.map