File tree 5 files changed +26
-2
lines changed
generators/utils/storybook-ast
workspace/src/utilities/typescript
5 files changed +26
-2
lines changed Original file line number Diff line number Diff line change 1
1
import type { Tree } from '@nrwl/devkit' ;
2
2
import { findNodes } from 'nx/src/utils/typescript' ;
3
- import { getSourceNodes } from '@nrwl/workspace/src/utilities/typescript/get-source-nodes ' ;
3
+ import { getSourceNodes } from '@nrwl/js ' ;
4
4
import type { PropertyDeclaration } from 'typescript' ;
5
5
import { getTsSourceFile } from '../../../utils/nx-devkit/ast-utils' ;
6
6
import { ensureTypescript } from '@nrwl/js/src/utils/typescript/ensure-typescript' ;
7
7
8
8
let tsModule : typeof import ( 'typescript' ) ;
9
9
10
10
export type KnobType = 'text' | 'boolean' | 'number' | 'select' ;
11
+
11
12
export interface InputDescriptor {
12
13
name : string ;
13
14
type : KnobType ;
Original file line number Diff line number Diff line change 1
1
import type * as ts from 'typescript' ;
2
2
import { findNodes } from 'nx/src/utils/typescript' ;
3
- import { getSourceNodes } from '@nrwl/workspace/src/utilities/typescript/get-source-nodes ' ;
3
+ import { getSourceNodes } from '@nrwl/js ' ;
4
4
import { dirname , join } from 'path' ;
5
5
import { names , readProjectConfiguration , Tree } from '@nrwl/devkit' ;
6
6
import {
Original file line number Diff line number Diff line change 1
1
export * from './utils/typescript/load-ts-transformers' ;
2
2
export * from './utils/typescript/print-diagnostics' ;
3
3
export * from './utils/typescript/run-type-check' ;
4
+ export * from './utils/typescript/get-source-nodes' ;
4
5
export * from './utils/compiler-helper-dependency' ;
5
6
export * from './utils/typescript/ts-config' ;
6
7
export * from './utils/typescript/create-ts-config' ;
Original file line number Diff line number Diff line change
1
+ import type * as ts from 'typescript' ;
2
+
3
+ export function getSourceNodes ( sourceFile : ts . SourceFile ) : ts . Node [ ] {
4
+ const nodes : ts . Node [ ] = [ sourceFile ] ;
5
+ const result = [ ] ;
6
+
7
+ while ( nodes . length > 0 ) {
8
+ const node = nodes . shift ( ) ;
9
+
10
+ if ( node ) {
11
+ result . push ( node ) ;
12
+ if ( node . getChildCount ( sourceFile ) >= 0 ) {
13
+ nodes . unshift ( ...node . getChildren ( ) ) ;
14
+ }
15
+ }
16
+ }
17
+
18
+ return result ;
19
+ }
Original file line number Diff line number Diff line change 1
1
import type * as ts from 'typescript' ;
2
2
3
+ /**
4
+ * @deprecated This function will be removed from @nrwl/workspace in version 17. Prefer importing from @nrwl/js.
5
+ */
3
6
export function getSourceNodes ( sourceFile : ts . SourceFile ) : ts . Node [ ] {
4
7
const nodes : ts . Node [ ] = [ sourceFile ] ;
5
8
const result = [ ] ;
You can’t perform that action at this time.
0 commit comments