* @param {FakeMap | FakeMapType} fakeMap fake map * @param {boolean=} asyncModule is async module * @param {string=} asyncDeps async deps for deferred module * @param {string=} fakeMapDataExpression fake map data expression * @returns {string} module object source
( fakeMap, asyncModule, asyncDeps, fakeMapDataExpression = "fakeMap[id]" )
| 810 | * @returns {string} module object source |
| 811 | */ |
| 812 | getReturnModuleObjectSource( |
| 813 | fakeMap, |
| 814 | asyncModule, |
| 815 | asyncDeps, |
| 816 | fakeMapDataExpression = "fakeMap[id]" |
| 817 | ) { |
| 818 | const source = |
| 819 | typeof fakeMap === "number" |
| 820 | ? this.getReturn(fakeMap, asyncModule) |
| 821 | : `${RuntimeGlobals.createFakeNamespaceObject}(id, ${fakeMapDataExpression}${asyncModule ? " | 16" : ""})`; |
| 822 | if (asyncDeps) { |
| 823 | if (!asyncModule) { |
| 824 | throw new Error("Must be async when module is deferred"); |
| 825 | } |
| 826 | const type = |
| 827 | typeof fakeMap === "number" ? fakeMap : fakeMapDataExpression; |
| 828 | return `${asyncDeps} ? ${asyncDeps}.length ? ${RuntimeGlobals.deferredModuleAsyncTransitiveDependencies}(${asyncDeps}).then(${RuntimeGlobals.makeDeferredNamespaceObject}.bind(${RuntimeGlobals.require}, id, ${type} ^ 1, true)) : ${RuntimeGlobals.makeDeferredNamespaceObject}(id, ${type} ^ 1 | 16) : ${source}`; |
| 829 | } |
| 830 | return source; |
| 831 | } |
| 832 | |
| 833 | /** |
| 834 | * @param {Dependency[]} dependencies dependencies |
no test coverage detected