hybrid-navigation 2.13.0-beta.3 → 2.13.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. package/android/src/main/java/com/reactnative/hybridnavigation/ReactFragment.java +3 -20
  2. package/lib/Event.d.ts +12 -16
  3. package/lib/Event.js +20 -66
  4. package/lib/Garden.d.ts +49 -6
  5. package/lib/Garden.js +56 -32
  6. package/lib/Navigation.d.ts +68 -0
  7. package/lib/Navigation.js +162 -0
  8. package/lib/NavigationComponentWrap.d.ts +19 -0
  9. package/lib/NavigationComponentWrap.js +46 -0
  10. package/lib/Navigator.d.ts +46 -32
  11. package/lib/Navigator.js +110 -169
  12. package/lib/ReactRegistry.d.ts +19 -13
  13. package/lib/ReactRegistry.js +21 -73
  14. package/lib/Route.d.ts +13 -8
  15. package/lib/handler/BarButtonEventHandler.d.ts +10 -0
  16. package/lib/handler/BarButtonEventHandler.js +38 -0
  17. package/lib/handler/DispatchCommandHandler.d.ts +26 -0
  18. package/lib/handler/DispatchCommandHandler.js +28 -0
  19. package/lib/handler/LayoutCommandHandler.d.ts +11 -0
  20. package/lib/handler/LayoutCommandHandler.js +39 -0
  21. package/lib/handler/ResultEventHandler.d.ts +15 -0
  22. package/lib/handler/ResultEventHandler.js +47 -0
  23. package/lib/handler/VisibilityEventHandler.d.ts +13 -0
  24. package/lib/handler/VisibilityEventHandler.js +32 -0
  25. package/lib/hooks.d.ts +4 -0
  26. package/lib/hooks.js +13 -18
  27. package/lib/index.d.ts +8 -1
  28. package/lib/index.js +26 -2
  29. package/lib/router/drawer.d.ts +3 -1
  30. package/lib/router/drawer.js +17 -17
  31. package/lib/router/index.d.ts +19 -15
  32. package/lib/router/index.js +140 -116
  33. package/lib/router/screen.d.ts +5 -1
  34. package/lib/router/screen.js +29 -0
  35. package/lib/router/stack.d.ts +5 -1
  36. package/lib/router/stack.js +59 -46
  37. package/lib/router/tabs.d.ts +3 -1
  38. package/lib/router/tabs.js +18 -28
  39. package/package.json +1 -1
  40. package/src/Event.ts +25 -90
  41. package/src/Garden.ts +60 -38
  42. package/src/Navigation.ts +253 -0
  43. package/src/NavigationComponentWrap.tsx +73 -0
  44. package/src/Navigator.ts +124 -233
  45. package/src/ReactRegistry.tsx +23 -99
  46. package/src/Route.ts +14 -9
  47. package/src/handler/BarButtonEventHandler.ts +50 -0
  48. package/src/handler/DispatchCommandHandler.ts +58 -0
  49. package/src/handler/LayoutCommandHandler.ts +49 -0
  50. package/src/handler/ResultEventHandler.ts +67 -0
  51. package/src/handler/VisibilityEventHandler.ts +44 -0
  52. package/src/hooks.ts +18 -30
  53. package/src/index.ts +38 -4
  54. package/src/router/drawer.ts +20 -17
  55. package/src/router/index.ts +150 -119
  56. package/src/router/screen.ts +34 -1
  57. package/src/router/stack.ts +61 -48
  58. package/src/router/tabs.ts +19 -29
@@ -1,8 +1,4 @@
1
1
  import { pathToRegexp, match } from 'path-to-regexp'
2
- import { stackRouteHandler } from './stack'
3
- import { tabsRouteHandler } from './tabs'
4
- import { drawerRouteHandler } from './drawer'
5
- import { Navigator } from '../Navigator'
6
2
  import {
7
3
  RouteConfig,
8
4
  RouteData,
@@ -12,162 +8,197 @@ import {
12
8
  RouteInterceptor,
13
9
  } from '../Route'
14
10
  import { NavigationItem } from '../Options'
11
+ import Navigation from '../Navigation'
12
+ import { StackRouteHandler } from './stack'
13
+ import { ScreenRouteHandler } from './screen'
14
+ import { TabsRouteHandler } from './tabs'
15
+ import { DrawerRouteHandler } from './drawer'
15
16
 
16
17
  interface IndexType {
17
18
  [index: string]: any
18
19
  }
19
20
 
20
- let routeDatas = new Map<string, RouteData>()
21
- let interceptors = new Set<RouteInterceptor>()
22
- let handlers = new Set<RouteHandler>([drawerRouteHandler, tabsRouteHandler, stackRouteHandler])
23
-
24
- const traverseHandlers: RouteHandler = async (
25
- graph: RouteGraph,
26
- route: RouteInfo,
27
- next: RouteHandler,
28
- ) => {
29
- for (let handler of handlers.values()) {
30
- if (await handler(graph, route, next)) {
31
- return true
32
- }
33
- }
34
- return false
21
+ function pathParams(path: string) {
22
+ const pathMatch = match<IndexType>(path, {
23
+ encode: encodeURI,
24
+ decode: decodeURIComponent,
25
+ })(path)
26
+ return pathMatch ? pathMatch.params : {}
35
27
  }
36
28
 
37
- function addInterceptor(func: RouteInterceptor) {
38
- interceptors.add(func)
29
+ function queryParams(queryString: string) {
30
+ return (queryString || '').split('&').reduce((result: IndexType, item: string) => {
31
+ if (item !== '') {
32
+ const nextResult = result || {}
33
+ const [key, value] = item.split('=')
34
+ nextResult[key] = value
35
+ return nextResult
36
+ }
37
+ return result
38
+ }, {})
39
39
  }
40
40
 
41
- function removeInterceptor(func: RouteInterceptor) {
42
- interceptors.delete(func)
43
- }
41
+ class Router {
42
+ constructor() {
43
+ this.registerRouteHandler('screen', new ScreenRouteHandler())
44
+ this.registerRouteHandler('stack', new StackRouteHandler())
45
+ this.registerRouteHandler('tabs', new TabsRouteHandler())
46
+ this.registerRouteHandler('drawer', new DrawerRouteHandler())
47
+ }
44
48
 
45
- function use(handler: RouteHandler) {
46
- handlers.add(handler)
47
- }
49
+ private handlers = new Map<string, RouteHandler>()
48
50
 
49
- function registerRoute(moduleName: string, route: RouteConfig) {
50
- let { path, dependency, mode } = route
51
- let regexp: RegExp | undefined
52
- if (path) {
53
- if (!path.startsWith('/')) {
54
- route.path = '/' + route.path
55
- }
56
- regexp = pathToRegexp(path)
51
+ registerRouteHandler(layout: string, handler: RouteHandler) {
52
+ this.handlers.set(layout, handler)
57
53
  }
58
- mode = mode || 'push'
59
- routeDatas.set(moduleName, { moduleName, mode, path, regexp, dependency })
60
- }
61
54
 
62
- async function open(path: string, props: object = {}, options: NavigationItem = {}) {
63
- let intercepted = false
64
- for (let interceptor of interceptors.values()) {
65
- const result = interceptor(path)
66
- if (result instanceof Promise) {
67
- intercepted = await result
68
- } else {
69
- intercepted = result
55
+ private convertConfigToData(moduleName: string, route: RouteConfig) {
56
+ let { path, dependency, mode } = route
57
+ let regexp: RegExp | undefined
58
+ if (path) {
59
+ if (!path.startsWith('/')) {
60
+ route.path = '/' + route.path
61
+ }
62
+ regexp = pathToRegexp(path)
70
63
  }
64
+ mode = mode || 'push'
65
+ return { moduleName, mode, path, regexp, dependency }
66
+ }
71
67
 
72
- if (intercepted) {
68
+ private isRouteConfigInflated = false
69
+ private routeDatas = new Map<string, RouteData>()
70
+
71
+ private inflateRouteData() {
72
+ if (this.isRouteConfigInflated) {
73
73
  return
74
74
  }
75
+ this.isRouteConfigInflated = true
76
+ const routeConfigs = Navigation.routeConfigs()
77
+ for (const [moduleName, config] of routeConfigs) {
78
+ const data = this.convertConfigToData(moduleName, config)
79
+ this.routeDatas.set(moduleName, data)
80
+ }
75
81
  }
76
82
 
77
- const route = pathToRoute(path, props, options)
83
+ private interceptors: RouteInterceptor[] = []
84
+
85
+ addInterceptor(interceptor: RouteInterceptor) {
86
+ this.interceptors.push(interceptor)
87
+ }
78
88
 
79
- if (!route) {
80
- return
89
+ removeInterceptor(interceptor: RouteInterceptor) {
90
+ this.interceptors = this.interceptors.filter(item => item !== interceptor)
81
91
  }
82
92
 
83
- const graphArray = await Navigator.routeGraph()
84
- if (graphArray.length > 1) {
85
- for (let index = graphArray.length - 1; index > 0; index--) {
86
- const { mode: layoutMode } = graphArray[index]
87
- const navigator = await Navigator.current()
88
- if (layoutMode === 'present') {
89
- await navigator.dismiss()
90
- } else if (layoutMode === 'modal') {
91
- await navigator.hideModal()
92
- } else {
93
- console.warn('尚未处理的 layout mode:' + layoutMode)
93
+ private async intercept(path: string) {
94
+ for (let interceptor of this.interceptors.values()) {
95
+ const result = interceptor(path)
96
+ if (result instanceof Promise) {
97
+ return await result
94
98
  }
99
+ return result
95
100
  }
96
101
  }
97
102
 
98
- if (!(await traverseHandlers(graphArray[0], route, traverseHandlers))) {
99
- const navigator = await Navigator.current()
100
- navigator.closeMenu()
101
- const { moduleName, mode: routeMode, props: initialProps } = route
102
- if (routeMode === 'present') {
103
- navigator.present(moduleName, initialProps)
104
- } else if (routeMode === 'modal') {
105
- navigator.showModal(moduleName, initialProps)
106
- } else {
107
- // default push
108
- navigator.push(moduleName, initialProps)
103
+ private pathToRoute(path: string, props: object, options: NavigationItem): RouteInfo | undefined {
104
+ for (const data of this.routeDatas.values()) {
105
+ if (!data.regexp) {
106
+ continue
107
+ }
108
+
109
+ const [pathName, queryString] = path.split('?')
110
+
111
+ if (data.regexp.exec(pathName)) {
112
+ const moduleName = data.moduleName
113
+ const params = pathParams(pathName)
114
+ const query = queryParams(queryString)
115
+ props = { ...query, ...params, ...props }
116
+ const dependencies = this.routeDependencies(data)
117
+ const mode = data.mode
118
+ return { moduleName, props, dependencies, mode, options }
119
+ }
109
120
  }
110
121
  }
111
- }
112
122
 
113
- function pathToRoute(path: string, props: object, options: NavigationItem): RouteInfo | undefined {
114
- for (const data of routeDatas.values()) {
115
- if (!data.regexp) {
116
- continue
123
+ private routeDependencies(routeData: RouteData) {
124
+ let dependencies: string[] = []
125
+ let data: RouteData | undefined = routeData
126
+ while (data && data.dependency) {
127
+ dependencies.push(data.dependency)
128
+ data = this.routeDatas.get(data.dependency)
117
129
  }
130
+ return dependencies.reverse()
131
+ }
118
132
 
119
- const [pathName, queryString] = path.split('?')
133
+ private async processRoute(route: RouteInfo, graph: RouteGraph): Promise<boolean> {
134
+ const handler = this.handlers.get(graph.layout)
135
+ if (!handler) {
136
+ return false
137
+ }
120
138
 
121
- if (data.regexp.exec(pathName)) {
122
- const moduleName = data.moduleName
123
- const params = pathParams(pathName)
124
- const query = queryParams(queryString)
125
- props = { ...query, ...params, ...props }
126
- const dependencies = routeDependencies(data)
127
- const mode = data.mode
128
- return { moduleName, props, dependencies, mode, options }
139
+ const [consumed, childGraph] = await handler.process(graph, route)
140
+ if (consumed && childGraph) {
141
+ return await this.processRoute(route, childGraph)
129
142
  }
143
+ return consumed
130
144
  }
131
- }
132
145
 
133
- function pathParams(path: string) {
134
- const pathMatch = match<IndexType>(path, {
135
- encode: encodeURI,
136
- decode: decodeURIComponent,
137
- })(path)
138
- return pathMatch ? pathMatch.params : {}
139
- }
146
+ async open(path: string, props: object = {}, options: NavigationItem = {}) {
147
+ this.inflateRouteData()
140
148
 
141
- function queryParams(queryString: string) {
142
- return (queryString || '').split('&').reduce((result: IndexType, item: string) => {
143
- if (item !== '') {
144
- const nextResult = result || {}
145
- const [key, value] = item.split('=')
146
- nextResult[key] = value
147
- return nextResult
149
+ const intercepted = await this.intercept(path)
150
+ if (intercepted) {
151
+ return
148
152
  }
149
- return result
150
- }, {})
151
- }
152
153
 
153
- function routeDependencies(routeData: RouteData) {
154
- let dependencies: string[] = []
155
- let data: RouteData | undefined = routeData
156
- while (data && data.dependency) {
157
- dependencies.push(data.dependency)
158
- data = routeDatas.get(data.dependency)
154
+ const route = this.pathToRoute(path, props, options)
155
+
156
+ if (!route) {
157
+ return
158
+ }
159
+
160
+ const graphArray = await Navigation.routeGraph()
161
+ if (graphArray.length > 1) {
162
+ for (let index = graphArray.length - 1; index > 0; index--) {
163
+ const { mode: layoutMode } = graphArray[index]
164
+ const { sceneId, moduleName } = await Navigation.currentRoute()
165
+ if (layoutMode === 'present') {
166
+ await Navigation.dispatch(sceneId, 'dismiss', { from: moduleName })
167
+ } else if (layoutMode === 'modal') {
168
+ await Navigation.dispatch(sceneId, 'hideModal', { from: moduleName })
169
+ } else {
170
+ console.warn('尚未处理的 layout mode:' + layoutMode)
171
+ }
172
+ }
173
+ }
174
+
175
+ const routeGraph = graphArray[0]
176
+
177
+ const consumed = await this.processRoute(route, routeGraph)
178
+
179
+ if (consumed) {
180
+ return
181
+ }
182
+
183
+ const { sceneId, moduleName: from } = await Navigation.currentRoute()
184
+ Navigation.dispatch(sceneId, 'closeMenu', { from })
185
+ const { moduleName, mode: routeMode, props: initialProps } = route
186
+ let action = 'push'
187
+ if (routeMode === 'present') {
188
+ action = 'present'
189
+ } else if (routeMode === 'modal') {
190
+ action = 'showModal'
191
+ }
192
+ Navigation.dispatch(sceneId, action, {
193
+ moduleName,
194
+ props: initialProps,
195
+ from,
196
+ to: moduleName,
197
+ })
159
198
  }
160
- return dependencies.reverse()
161
199
  }
162
200
 
163
- export const router = {
164
- addInterceptor,
165
- removeInterceptor,
166
- registerRoute,
167
- use,
168
- open,
169
- pathToRoute,
170
- }
201
+ export const router = new Router()
171
202
 
172
203
  export * from './drawer'
173
204
  export * from './screen'
@@ -1,4 +1,4 @@
1
- import { LayoutMode, RouteGraph } from '../Route'
1
+ import { LayoutMode, RouteGraph, RouteHandler, RouteInfo } from '../Route'
2
2
 
3
3
  export interface ScreenGraph extends RouteGraph {
4
4
  layout: 'screen'
@@ -10,3 +10,36 @@ export interface ScreenGraph extends RouteGraph {
10
10
  export function isScreenGraph(graph: RouteGraph): graph is ScreenGraph {
11
11
  return graph.layout === 'screen'
12
12
  }
13
+
14
+ function extractModuleNames(graph: RouteGraph, set: string[]) {
15
+ if (isScreenGraph(graph)) {
16
+ set.push(graph.moduleName)
17
+ } else {
18
+ const children = graph.children!
19
+ for (let i = 0; i < children.length; i++) {
20
+ extractModuleNames(children[i], set)
21
+ }
22
+ }
23
+ }
24
+
25
+ export function isTargetLocateIn(graph: RouteGraph, target: RouteInfo) {
26
+ const existings: string[] = []
27
+ extractModuleNames(graph, existings)
28
+ const { dependencies, moduleName } = target
29
+ const expectations = [...dependencies, moduleName]
30
+ return expectations.some(name => existings.includes(name))
31
+ }
32
+
33
+ export class ScreenRouteHandler implements RouteHandler {
34
+ process(graph: RouteGraph, target: RouteInfo): Promise<[boolean, RouteGraph | null]> {
35
+ if (!isScreenGraph(graph)) {
36
+ throw new Error(`${graph} is Not a ScreenGraph`)
37
+ }
38
+
39
+ if (graph.moduleName === target.moduleName) {
40
+ return Promise.resolve([true, null])
41
+ }
42
+
43
+ return Promise.resolve([false, graph])
44
+ }
45
+ }
@@ -1,6 +1,6 @@
1
- import { isScreenGraph } from './screen'
2
- import { Navigator } from '../Navigator'
1
+ import { ScreenGraph, isScreenGraph, isTargetLocateIn } from './screen'
3
2
  import { LayoutMode, RouteGraph, RouteHandler, RouteInfo } from '../Route'
3
+ import Navigation from '../Navigation'
4
4
 
5
5
  export interface StackGraph extends RouteGraph {
6
6
  layout: 'stack'
@@ -13,68 +13,81 @@ export function isStackGraph(graph: RouteGraph): graph is StackGraph {
13
13
  return graph.layout === 'stack'
14
14
  }
15
15
 
16
- export async function stackRouteHandler(graph: RouteGraph, route: RouteInfo, next: RouteHandler) {
17
- if (!isStackGraph(graph)) {
18
- return false
19
- }
20
-
21
- const { mode, moduleName, dependencies, props } = route
16
+ export class StackRouteHandler implements RouteHandler {
17
+ async process(graph: RouteGraph, target: RouteInfo): Promise<[boolean, RouteGraph | null]> {
18
+ if (!isStackGraph(graph)) {
19
+ throw new Error(`${graph} is Not a StackGraph`)
20
+ }
22
21
 
23
- if (mode !== 'push') {
24
- return false
25
- }
22
+ const { children } = graph
26
23
 
27
- const { children } = graph
28
- const expectedModuleNames = [...dependencies, moduleName]
29
- let expectedIndex = -1
30
- let childIndex = -1
24
+ for (let i = children.length - 1; i > -1; i--) {
25
+ const childGraph = children[i]
26
+ if (isTargetLocateIn(childGraph, target)) {
27
+ if (isScreenGraph(childGraph)) {
28
+ this.navigateTo(childGraph, target)
29
+ return [true, null]
30
+ }
31
31
 
32
- for (let i = children.length - 1; i > -1; i--) {
33
- const existingModuleNames: string[] = []
34
- extractModuleNames(children[i], existingModuleNames)
35
- expectedIndex = expectedModuleNames.findIndex(name => existingModuleNames.includes(name))
36
- if (expectedIndex !== -1) {
37
- childIndex = i
38
- break
32
+ await this.popToIfNeeded(childGraph, i === children.length - 1)
33
+ return [true, childGraph]
34
+ }
39
35
  }
36
+
37
+ return [false, graph]
40
38
  }
41
39
 
42
- if (expectedIndex !== -1) {
43
- if (!isScreenGraph(children[childIndex])) {
44
- await next(children[childIndex], route, next)
40
+ private async popToIfNeeded(childGraph: RouteGraph, isLastChildAtStack: boolean) {
41
+ if (!isLastChildAtStack) {
42
+ await Navigation.dispatch(childGraph.sceneId, 'popTo', {
43
+ moduleName: childGraph.sceneId,
44
+ })
45
45
  }
46
+ }
47
+
48
+ private navigateTo(childGraph: ScreenGraph, target: RouteInfo) {
49
+ const { mode, moduleName, dependencies, props } = target
50
+ const expectations = [...dependencies, moduleName]
51
+ const index = expectations.findIndex(name => name === childGraph.moduleName)
52
+ const pendings = expectations.slice(index + 1)
53
+ console.log('pendings', pendings, 'moduleName', childGraph.moduleName)
54
+ const sceneId = childGraph.sceneId
46
55
 
47
- let pendingModuleNames = expectedModuleNames.slice(expectedIndex + 1)
48
- const navigator = Navigator.of(children[children.length - 1].sceneId)
56
+ const moduleExisting = pendings.length === 0
49
57
 
50
- if (pendingModuleNames.length === 0) {
58
+ if (moduleExisting) {
51
59
  if (JSON.stringify(props) === '{}') {
52
- await navigator.popTo(moduleName)
60
+ Navigation.dispatch(sceneId, 'popTo', {
61
+ moduleName,
62
+ from: childGraph.moduleName,
63
+ to: moduleName,
64
+ })
53
65
  } else {
54
- navigator.redirectTo(moduleName, props)
66
+ Navigation.dispatch(sceneId, 'redirectTo', {
67
+ moduleName,
68
+ from: childGraph.moduleName,
69
+ to: moduleName,
70
+ props,
71
+ })
55
72
  }
56
73
  } else {
57
- for (let i = 0; i < pendingModuleNames.length; i++) {
58
- if (i === pendingModuleNames.length - 1) {
59
- navigator.push(moduleName, props)
74
+ for (let i = 0; i < pendings.length; i++) {
75
+ const isLast = i === pendings.length - 1
76
+ if (isLast) {
77
+ Navigation.dispatch(sceneId, 'push', {
78
+ moduleName,
79
+ from: childGraph.moduleName,
80
+ to: moduleName,
81
+ props,
82
+ })
60
83
  } else {
61
- navigator.push(pendingModuleNames[i], {}, {})
84
+ Navigation.dispatch(sceneId, 'push', {
85
+ moduleName: pendings[i],
86
+ from: childGraph.moduleName,
87
+ to: pendings[i],
88
+ })
62
89
  }
63
90
  }
64
91
  }
65
- return true
66
- }
67
-
68
- return false
69
- }
70
-
71
- function extractModuleNames(graph: RouteGraph, set: string[]) {
72
- if (isScreenGraph(graph)) {
73
- set.push(graph.moduleName)
74
- } else {
75
- const children = graph.children!
76
- for (let i = 0; i < children.length; i++) {
77
- extractModuleNames(children[i], set)
78
- }
79
92
  }
80
93
  }
@@ -1,6 +1,6 @@
1
- import { Navigator } from '../Navigator'
2
- import { isScreenGraph } from './screen'
1
+ import { isTargetLocateIn } from './screen'
3
2
  import { LayoutMode, RouteGraph, RouteHandler, RouteInfo } from '../Route'
3
+ import Navigation from '../Navigation'
4
4
 
5
5
  export interface TabsGraph extends RouteGraph {
6
6
  layout: 'tabs'
@@ -13,37 +13,27 @@ export interface TabsGraph extends RouteGraph {
13
13
  export function isTabsGraph(graph: RouteGraph): graph is TabsGraph {
14
14
  return graph.layout === 'tabs'
15
15
  }
16
+ export class TabsRouteHandler implements RouteHandler {
17
+ async process(graph: RouteGraph, target: RouteInfo): Promise<[boolean, RouteGraph]> {
18
+ if (!isTabsGraph(graph)) {
19
+ throw new Error(`${graph} is NOT a TabsGraph`)
20
+ }
16
21
 
17
- export async function tabsRouteHandler(graph: RouteGraph, route: RouteInfo, next: RouteHandler) {
18
- if (!isTabsGraph(graph)) {
19
- return false
20
- }
21
-
22
- const { children, selectedIndex } = graph
23
- const { dependencies, moduleName } = route
24
- const expectedModuleNames = [...dependencies, moduleName]
22
+ const { children, selectedIndex } = graph
25
23
 
26
- for (let i = 0; i < children.length; i++) {
27
- const existingModuleNames: string[] = []
28
- extractModuleNames(children[i], existingModuleNames)
29
- if (expectedModuleNames.some(name => existingModuleNames.includes(name))) {
30
- if (selectedIndex !== i) {
31
- const navigator = Navigator.of(children[i].sceneId)
32
- await navigator.switchTab(i, true)
24
+ for (let i = 0; i < children.length; i++) {
25
+ if (isTargetLocateIn(children[i], target)) {
26
+ if (selectedIndex !== i) {
27
+ await Navigation.dispatch(children[selectedIndex].sceneId, 'switchTab', {
28
+ from: selectedIndex,
29
+ to: i,
30
+ popToRoot: true,
31
+ })
32
+ }
33
+ return [true, children[i]]
33
34
  }
34
- return next(children[i], route, next)
35
35
  }
36
- }
37
- return false
38
- }
39
36
 
40
- function extractModuleNames(graph: RouteGraph, set: string[]) {
41
- if (isScreenGraph(graph)) {
42
- set.push(graph.moduleName)
43
- } else {
44
- const children = graph.children!
45
- for (let i = 0; i < children.length; i++) {
46
- extractModuleNames(children[i], set)
47
- }
37
+ return [false, graph]
48
38
  }
49
39
  }