Lines Matching refs:ts
16 import * as ts from 'typescript';
55 return (context: ts.TransformationContext) => {
56 const visitor: ts.Visitor = node => {
58 if (ts.isImportDeclaration(node) || (ts.isExportDeclaration(node) && node.moduleSpecifier)) {
59 … const moduleRequest: string = (node.moduleSpecifier as ts.StringLiteral).text.replace(/'|"/g, '');
78 return (node: ts.SourceFile) => {
84 if (ts.hasTsNoCheckOrTsIgnoreFlag(node)) {
87 return ts.visitEachChild(node, visitor, context); // this node used for [writeFile]
90 const processedNode: ts.SourceFile =
91 … ts.visitEachChild(ts.getTypeExportImportAndConstEnumTransformer(context)(node), visitor, context);
96 return ts.visitEachChild(node, visitor, context);
117 declare type TSspecifier = ts.ImportSpecifier | ts.ExportSpecifier;
118 declare type TSModuleDeclaration = ts.ImportDeclaration | ts.ExportDeclaration;
191 private kitNodeModifier: readonly ts.Modifier[] | undefined; property in KitInfo
200 …this.kitNodeModifier = ts.canHaveDecorators(this.kitNode) ? ts.getModifiers(this.kitNode) : undefi…
203 static init(node: ts.SourceFile, context: ts.TransformationContext): void {
213 if (projectConfig.processTs === true && !ts.hasTsNoCheckOrTsIgnoreFlag(node)) {
242 static needSkipTypeSymbolOfNode(node: ts.Node): boolean {
251 case ts.SyntaxKind.ImportDeclaration:
252 case ts.SyntaxKind.ImportClause: {
253 … const importClause = ts.isImportClause(node) ? node : (node as ts.ImportDeclaration).importClause;
263 case ts.SyntaxKind.ImportSpecifier: {
264 isTypeSymbol = (node as ts.ImportSpecifier).isTypeOnly;
270 case ts.SyntaxKind.ExportDeclaration: {
271 isTypeSymbol = (node as ts.ExportDeclaration).isTypeOnly;
274 case ts.SyntaxKind.ExportSpecifier: {
275 isTypeSymbol = (node as ts.ExportSpecifier).isTypeOnly;
285 static processImportDecl(kitNode: ts.ImportDeclaration, symbols: Record<string, KitSymbol>) {
287 const namedBindings: ts.NamedImportBindings = kitNode.importClause.namedBindings;
288 if (ts.isNamespaceImport(namedBindings)) {
292 if (ts.isNamedImports(namedBindings) && namedBindings.elements.length !== 0) {
309 static processExportDecl(kitNode: ts.ExportDeclaration, symbols: Record<string, KitSymbol>) {
311 const namedExportBindings: ts.NamedExportBindings = kitNode.exportClause;
312 if (ts.isNamespaceExport(namedExportBindings)) {
315 … } else if (ts.isNamedExports(namedExportBindings) && namedExportBindings.elements.length !== 0) {
329 if (ts.isImportDeclaration(kitNode) && kitNode.importClause) {
336 if (ts.isExportDeclaration(kitNode) && kitNode.moduleSpecifier) {
354 getKitNodeModifier(): readonly ts.Modifier[] | undefined {
403 …constructor(kitNode: ts.ImportDeclaration | ts.ExportDeclaration, symbols: Record<string, KitSymbo…
418 private namedBindings: ts.ImportSpecifier[] = [];
419 private specifierDefaultName: ts.Identifier | undefined = undefined;
421 constructor(kitNode: ts.ImportDeclaration, symbols: Record<string, KitSymbol>) {
435 const node: ts.ImportDeclaration = this.getKitNode() as ts.ImportDeclaration;
441 this.specifierDefaultName = ts.factory.createIdentifier(specifier.getLocalName());
444 ts.factory.createImportSpecifier(
446 …(specifier.getOriginElementNode() as ts.ImportSpecifier).isTypeOnly : node.importClause.isTypeOnly,
447 … specifier.isRenamed() ? ts.factory.createIdentifier(specifier.getBindings()) : undefined,
448 ts.factory.createIdentifier(specifier.getLocalName())
454 this.getOhosImportNodes().push(ts.factory.createImportDeclaration(
456 ts.factory.createImportClause(
459 this.hasNamedBindings() ? ts.factory.createNamedImports(this.namedBindings) : undefined
461 ts.factory.createStringLiteral(trimSourceSuffix(source))
470 private namedBindings: ts.ExportSpecifier[] = [];
472 constructor(kitNode: ts.ExportDeclaration, symbols: Record<string, KitSymbol>) {
485 const node: ts.ExportDeclaration = this.getKitNode() as ts.ExportDeclaration;
490 ts.factory.createExportSpecifier(
491 (specifier.getOriginElementNode() as ts.ExportSpecifier).isTypeOnly,
492 … specifier.isRenamed() ? ts.factory.createIdentifier(specifier.getBindings()) : undefined,
493 ts.factory.createIdentifier(specifier.getLocalName())
498 this.getOhosImportNodes().push(ts.factory.createExportDeclaration(
501 this.hasNamedBindings() ? ts.factory.createNamedExports(this.namedBindings) : undefined,
502 ts.factory.createStringLiteral(trimSourceSuffix(source)),
514 constructor(kitNode: ts.ExportDeclaration, symbols: Record<string, KitSymbol>) {
529 const node: ts.ExportDeclaration = this.getKitNode() as ts.ExportDeclaration;
532 this.getOhosImportNodes().push(ts.factory.createExportDeclaration(
536 ts.factory.createStringLiteral(trimSourceSuffix(source)),