@nrwl/angular 13.10.0-beta.6 → 13.10.0-beta.9

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 (158) hide show
  1. package/esm2020/mfe/index.mjs +2 -2
  2. package/executors.json +4 -4
  3. package/fesm2015/nrwl-angular-mfe.mjs +1 -1
  4. package/fesm2015/nrwl-angular-mfe.mjs.map +1 -1
  5. package/fesm2015/nrwl-angular-testing.mjs.map +1 -1
  6. package/fesm2015/nrwl-angular.mjs.map +1 -1
  7. package/fesm2020/nrwl-angular-mfe.mjs +1 -1
  8. package/fesm2020/nrwl-angular-mfe.mjs.map +1 -1
  9. package/fesm2020/nrwl-angular-testing.mjs.map +1 -1
  10. package/fesm2020/nrwl-angular.mjs.map +1 -1
  11. package/generators.json +9 -11
  12. package/mfe/index.d.ts +1 -1
  13. package/mfe/index.js +2 -1
  14. package/mfe/index.js.map +1 -1
  15. package/migrations.json +2 -407
  16. package/package.json +7 -7
  17. package/src/builders/webpack-browser/schema.json +18 -1
  18. package/src/builders/webpack-server/schema.json +6 -0
  19. package/src/executors/ng-packagr-lite/schema.json +14 -0
  20. package/src/executors/package/schema.json +14 -0
  21. package/src/executors/utilities/tailwindcss.js +2 -2
  22. package/src/executors/utilities/tailwindcss.js.map +1 -1
  23. package/src/generators/application/lib/add-mfe.js +1 -0
  24. package/src/generators/application/lib/add-mfe.js.map +1 -1
  25. package/src/generators/application/schema.d.ts +1 -0
  26. package/src/generators/application/schema.json +9 -3
  27. package/src/generators/component/schema.json +4 -4
  28. package/src/generators/convert-to-with-mf/convert-to-with-mf.js +2 -1
  29. package/src/generators/convert-to-with-mf/convert-to-with-mf.js.map +1 -1
  30. package/src/generators/convert-to-with-mf/lib/write-new-webpack-config.d.ts +1 -1
  31. package/src/generators/convert-to-with-mf/lib/write-new-webpack-config.js +17 -14
  32. package/src/generators/convert-to-with-mf/lib/write-new-webpack-config.js.map +1 -1
  33. package/src/generators/convert-tslint-to-eslint/schema.json +4 -4
  34. package/src/generators/downgrade-module/schema.json +1 -0
  35. package/src/generators/init/schema.json +1 -1
  36. package/src/generators/karma/karma.d.ts +1 -1
  37. package/src/generators/karma/karma.js +17 -15
  38. package/src/generators/karma/karma.js.map +1 -1
  39. package/src/generators/karma/schema.json +1 -0
  40. package/src/generators/karma-project/karma-project.js +2 -0
  41. package/src/generators/karma-project/karma-project.js.map +1 -1
  42. package/src/generators/karma-project/schema.d.ts +1 -0
  43. package/src/generators/karma-project/schema.json +6 -0
  44. package/src/generators/library/schema.json +2 -1
  45. package/src/generators/library-secondary-entry-point/schema.json +1 -0
  46. package/src/generators/mfe-host/mfe-host.js +1 -0
  47. package/src/generators/mfe-host/mfe-host.js.map +1 -1
  48. package/src/generators/mfe-host/schema.d.ts +1 -0
  49. package/src/generators/mfe-host/schema.json +11 -10
  50. package/src/generators/mfe-remote/schema.json +2 -2
  51. package/src/generators/move/lib/update-ng-package.js +1 -1
  52. package/src/generators/move/lib/update-ng-package.js.map +1 -1
  53. package/src/generators/move/schema.json +3 -3
  54. package/src/generators/ng-add/compat.d.ts +1 -1
  55. package/src/generators/ng-add/files/{root → root-karma}/karma.conf.js__tmpl__ +0 -0
  56. package/src/generators/ng-add/migrate-from-angular-cli.d.ts +2 -2
  57. package/src/generators/ng-add/migrate-from-angular-cli.js +38 -607
  58. package/src/generators/ng-add/migrate-from-angular-cli.js.map +1 -1
  59. package/src/generators/ng-add/ng-add.d.ts +3 -3
  60. package/src/generators/ng-add/ng-add.js +2 -2
  61. package/src/generators/ng-add/ng-add.js.map +1 -1
  62. package/src/generators/ng-add/schema.d.ts +1 -1
  63. package/src/generators/ng-add/utilities/app.migrator.d.ts +18 -0
  64. package/src/generators/ng-add/utilities/app.migrator.js +182 -0
  65. package/src/generators/ng-add/utilities/app.migrator.js.map +1 -0
  66. package/src/generators/ng-add/utilities/e2e-project.migrator.d.ts +19 -0
  67. package/src/generators/ng-add/utilities/e2e-project.migrator.js +186 -0
  68. package/src/generators/ng-add/utilities/e2e-project.migrator.js.map +1 -0
  69. package/src/generators/ng-add/utilities/e2e-utils.d.ts +7 -0
  70. package/src/generators/ng-add/utilities/e2e-utils.js +46 -0
  71. package/src/generators/ng-add/utilities/e2e-utils.js.map +1 -0
  72. package/src/generators/ng-add/utilities/get-all-projects.d.ts +3 -0
  73. package/src/generators/ng-add/utilities/get-all-projects.js +26 -0
  74. package/src/generators/ng-add/utilities/get-all-projects.js.map +1 -0
  75. package/src/generators/ng-add/utilities/normalize-options.d.ts +3 -0
  76. package/src/generators/ng-add/utilities/normalize-options.js +24 -0
  77. package/src/generators/ng-add/utilities/normalize-options.js.map +1 -0
  78. package/src/generators/ng-add/utilities/project.migrator.d.ts +21 -0
  79. package/src/generators/ng-add/utilities/project.migrator.js +53 -0
  80. package/src/generators/ng-add/utilities/project.migrator.js.map +1 -0
  81. package/src/generators/ng-add/utilities/types.d.ts +10 -0
  82. package/src/generators/ng-add/utilities/types.js +3 -0
  83. package/src/generators/ng-add/utilities/types.js.map +1 -0
  84. package/src/generators/ng-add/utilities/workspace.d.ts +12 -0
  85. package/src/generators/ng-add/utilities/workspace.js +258 -0
  86. package/src/generators/ng-add/utilities/workspace.js.map +1 -0
  87. package/src/generators/ngrx/schema.json +1 -0
  88. package/src/generators/scam/schema.json +6 -6
  89. package/src/generators/scam-directive/schema.json +3 -3
  90. package/src/generators/scam-pipe/schema.json +1 -1
  91. package/src/generators/setup-mfe/files/webpack/mfe.config.js__tmpl__ +7 -0
  92. package/src/generators/setup-mfe/files/webpack/webpack.config.js__tmpl__ +2 -7
  93. package/src/generators/setup-mfe/lib/add-remote-to-host.d.ts +2 -2
  94. package/src/generators/setup-mfe/lib/add-remote-to-host.js +49 -24
  95. package/src/generators/setup-mfe/lib/add-remote-to-host.js.map +1 -1
  96. package/src/generators/setup-mfe/lib/fix-bootstrap.d.ts +2 -1
  97. package/src/generators/setup-mfe/lib/fix-bootstrap.js +13 -4
  98. package/src/generators/setup-mfe/lib/fix-bootstrap.js.map +1 -1
  99. package/src/generators/setup-mfe/lib/generate-config.js +2 -1
  100. package/src/generators/setup-mfe/lib/generate-config.js.map +1 -1
  101. package/src/generators/setup-mfe/lib/index.d.ts +1 -0
  102. package/src/generators/setup-mfe/lib/index.js +1 -0
  103. package/src/generators/setup-mfe/lib/index.js.map +1 -1
  104. package/src/generators/setup-mfe/lib/setup-host-if-dynamic.d.ts +3 -0
  105. package/src/generators/setup-mfe/lib/setup-host-if-dynamic.js +15 -0
  106. package/src/generators/setup-mfe/lib/setup-host-if-dynamic.js.map +1 -0
  107. package/src/generators/setup-mfe/schema.d.ts +1 -0
  108. package/src/generators/setup-mfe/schema.json +7 -1
  109. package/src/generators/setup-mfe/setup-mfe.d.ts +1 -1
  110. package/src/generators/setup-mfe/setup-mfe.js +16 -13
  111. package/src/generators/setup-mfe/setup-mfe.js.map +1 -1
  112. package/src/generators/stories/schema.json +2 -0
  113. package/src/generators/storybook-configuration/schema.json +2 -0
  114. package/src/generators/storybook-migrate-defaults-5-to-6/schema.json +2 -0
  115. package/src/generators/storybook-migrate-stories-to-6-2/schema.json +2 -0
  116. package/src/generators/upgrade-module/schema.json +1 -0
  117. package/src/migrations/update-12-3-0/update-storybook.js +1 -1
  118. package/src/utils/mfe/mfe-webpack.js +2 -2
  119. package/src/utils/mfe/mfe-webpack.js.map +1 -1
  120. package/src/utils/mfe/with-module-federation.js +4 -1
  121. package/src/utils/mfe/with-module-federation.js.map +1 -1
  122. package/src/utils/versions.js +1 -1
  123. package/src/generators/ng-add/files/decorate-angular-cli/decorate-angular-cli.js__tmpl__ +0 -69
  124. package/src/generators/ng-add/files/root/nx.json__tmpl__ +0 -29
  125. package/src/migrations/update-10-0-0/update-10-0-0.d.ts +0 -1
  126. package/src/migrations/update-10-0-0/update-10-0-0.js +0 -15
  127. package/src/migrations/update-10-0-0/update-10-0-0.js.map +0 -1
  128. package/src/migrations/update-10-2-0/update-10-2-0.d.ts +0 -1
  129. package/src/migrations/update-10-2-0/update-10-2-0.js +0 -14
  130. package/src/migrations/update-10-2-0/update-10-2-0.js.map +0 -1
  131. package/src/migrations/update-10-3-0/files/tsconfig.editor.json +0 -11
  132. package/src/migrations/update-10-3-0/update-10-3-0.d.ts +0 -2
  133. package/src/migrations/update-10-3-0/update-10-3-0.js +0 -79
  134. package/src/migrations/update-10-3-0/update-10-3-0.js.map +0 -1
  135. package/src/migrations/update-10-4-0/update-10-4-0.d.ts +0 -2
  136. package/src/migrations/update-10-4-0/update-10-4-0.js +0 -36
  137. package/src/migrations/update-10-4-0/update-10-4-0.js.map +0 -1
  138. package/src/migrations/update-10-5-0/add-template-support-and-presets-to-eslint.d.ts +0 -2
  139. package/src/migrations/update-10-5-0/add-template-support-and-presets-to-eslint.js +0 -118
  140. package/src/migrations/update-10-5-0/add-template-support-and-presets-to-eslint.js.map +0 -1
  141. package/src/migrations/update-11-0-0/update-builders-config.d.ts +0 -2
  142. package/src/migrations/update-11-0-0/update-builders-config.js +0 -55
  143. package/src/migrations/update-11-0-0/update-builders-config.js.map +0 -1
  144. package/src/migrations/update-8-12-0/change-angular-lib-builder.d.ts +0 -2
  145. package/src/migrations/update-8-12-0/change-angular-lib-builder.js +0 -25
  146. package/src/migrations/update-8-12-0/change-angular-lib-builder.js.map +0 -1
  147. package/src/migrations/update-8-3-0/upgrade-ngrx-8-0.d.ts +0 -1
  148. package/src/migrations/update-8-3-0/upgrade-ngrx-8-0.js +0 -49
  149. package/src/migrations/update-8-3-0/upgrade-ngrx-8-0.js.map +0 -1
  150. package/src/migrations/update-8-5-0/upgrade-cli-8-3.d.ts +0 -1
  151. package/src/migrations/update-8-5-0/upgrade-cli-8-3.js +0 -55
  152. package/src/migrations/update-8-5-0/upgrade-cli-8-3.js.map +0 -1
  153. package/src/migrations/update-9-0-0/add-postinstall.d.ts +0 -1
  154. package/src/migrations/update-9-0-0/add-postinstall.js +0 -22
  155. package/src/migrations/update-9-0-0/add-postinstall.js.map +0 -1
  156. package/src/migrations/update-9-0-0/update-9-0-0.d.ts +0 -2
  157. package/src/migrations/update-9-0-0/update-9-0-0.js +0 -18
  158. package/src/migrations/update-9-0-0/update-9-0-0.js.map +0 -1
@@ -1,2 +1,2 @@
1
- export { setRemoteUrlResolver, loadRemoteModule } from './mfe';
2
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9tZmUvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLG9CQUFvQixFQUFFLGdCQUFnQixFQUFFLE1BQU0sT0FBTyxDQUFDIiwic291cmNlc0NvbnRlbnQiOlsiZXhwb3J0IHsgc2V0UmVtb3RlVXJsUmVzb2x2ZXIsIGxvYWRSZW1vdGVNb2R1bGUgfSBmcm9tICcuL21mZSc7XG4iXX0=
1
+ export { setRemoteUrlResolver, setRemoteDefinitions, loadRemoteModule, } from './mfe';
2
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9tZmUvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUNMLG9CQUFvQixFQUNwQixvQkFBb0IsRUFDcEIsZ0JBQWdCLEdBQ2pCLE1BQU0sT0FBTyxDQUFDIiwic291cmNlc0NvbnRlbnQiOlsiZXhwb3J0IHtcbiAgc2V0UmVtb3RlVXJsUmVzb2x2ZXIsXG4gIHNldFJlbW90ZURlZmluaXRpb25zLFxuICBsb2FkUmVtb3RlTW9kdWxlLFxufSBmcm9tICcuL21mZSc7XG4iXX0=
package/executors.json CHANGED
@@ -18,12 +18,12 @@
18
18
  "webpack-browser": {
19
19
  "implementation": "./src/builders/webpack-browser/webpack-browser.impl",
20
20
  "schema": "./src/builders/webpack-browser/schema.json",
21
- "description": "The webpack-browser executor is very similar to the standard browser builder provided by the Angular Devkit. It allows you to build your Angular application to a build artifact that can be hosted online. There are some key differences: \n- Supports Custom Webpack Configurations \n- Supports Incremental Building"
21
+ "description": "The `webpack-browser` executor is very similar to the standard `browser` builder provided by the Angular Devkit. It allows you to build your Angular application to a build artifact that can be hosted online. There are some key differences: \n- Supports Custom Webpack Configurations \n- Supports Incremental Building"
22
22
  },
23
23
  "webpack-server": {
24
24
  "implementation": "./src/builders/webpack-server/webpack-server.impl",
25
25
  "schema": "./src/builders/webpack-server/schema.json",
26
- "description": "The webpack-server executor is very similar to the standard dev server builder provided by the Angular Devkit. It is usually used in tandem with `@nrwl/angular:webpack-browser` when your Angular application uses a custom webpack configuration."
26
+ "description": "The `webpack-server` executor is very similar to the standard `dev-server` builder provided by the Angular Devkit. It is usually used in tandem with `@nrwl/angular:webpack-browser` when your Angular application uses a custom webpack configuration."
27
27
  }
28
28
  },
29
29
  "builders": {
@@ -45,12 +45,12 @@
45
45
  "webpack-browser": {
46
46
  "implementation": "./src/builders/webpack-browser/webpack-browser.impl",
47
47
  "schema": "./src/builders/webpack-browser/schema.json",
48
- "description": "The webpack-browser executor is very similar to the standard browser builder provided by the Angular Devkit. It allows you to build your Angular application to a build artifact that can be hosted online. There are some key differences: \n- Supports Custom Webpack Configurations \n- Supports Incremental Building"
48
+ "description": "The `webpack-browser` executor is very similar to the standard `browser` builder provided by the Angular Devkit. It allows you to build your Angular application to a build artifact that can be hosted online. There are some key differences: \n- Supports Custom Webpack Configurations \n- Supports Incremental Building"
49
49
  },
50
50
  "webpack-server": {
51
51
  "implementation": "./src/builders/webpack-server/webpack-server.impl",
52
52
  "schema": "./src/builders/webpack-server/schema.json",
53
- "description": "The webpack-server executor is very similar to the standard dev server builder provided by the Angular Devkit. It is usually used in tandem with `@nrwl/angular:webpack-browser` when your Angular application uses a custom webpack configuration."
53
+ "description": "The `webpack-server` executor is very similar to the standard `dev-server` builder provided by the Angular Devkit. It is usually used in tandem with `@nrwl/angular:webpack-browser` when your Angular application uses a custom webpack configuration."
54
54
  }
55
55
  }
56
56
  }
@@ -53,5 +53,5 @@ function loadRemoteContainer(remoteName) {
53
53
  * Generated bundle index. Do not edit.
54
54
  */
55
55
 
56
- export { loadRemoteModule, setRemoteUrlResolver };
56
+ export { loadRemoteModule, setRemoteDefinitions, setRemoteUrlResolver };
57
57
  //# sourceMappingURL=nrwl-angular-mfe.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"nrwl-angular-mfe.mjs","sources":["../../mfe/mfe.ts","../../mfe/nrwl-angular-mfe.ts"],"sourcesContent":["export type ResolveRemoteUrlFunction = (\n remoteName: string\n) => string | Promise<string>;\n\ndeclare const __webpack_init_sharing__: (scope: 'default') => Promise<void>;\ndeclare const __webpack_share_scopes__: { default: unknown };\n\nlet resolveRemoteUrl: ResolveRemoteUrlFunction;\nexport function setRemoteUrlResolver(\n _resolveRemoteUrl: ResolveRemoteUrlFunction\n) {\n resolveRemoteUrl = _resolveRemoteUrl;\n}\n\nlet remoteUrlDefinitions: Record<string, string>;\nexport function setRemoteDefinitions(definitions: Record<string, string>) {\n remoteUrlDefinitions = definitions;\n}\n\nlet remoteModuleMap = new Map<string, unknown>();\nlet remoteContainerMap = new Map<string, unknown>();\nexport async function loadRemoteModule(remoteName: string, moduleName: string) {\n const remoteModuleKey = `${remoteName}:${moduleName}`;\n if (remoteModuleMap.has(remoteModuleKey)) {\n return remoteModuleMap.get(remoteModuleKey);\n }\n\n const container = remoteContainerMap.has(remoteName)\n ? remoteContainerMap.get(remoteName)\n : await loadRemoteContainer(remoteName);\n\n const factory = await container.get(moduleName);\n const Module = factory();\n\n remoteModuleMap.set(remoteModuleKey, Module);\n\n return Module;\n}\n\nfunction loadModule(url: string) {\n return import(/* webpackIgnore:true */ url);\n}\n\nlet initialSharingScopeCreated = false;\nasync function loadRemoteContainer(remoteName: string) {\n if (!resolveRemoteUrl && !remoteUrlDefinitions) {\n throw new Error(\n 'Call setRemoteDefinitions or setRemoteUrlResolver to allow Dynamic Federation to find the remote apps correctly.'\n );\n }\n\n if (!initialSharingScopeCreated) {\n initialSharingScopeCreated = true;\n await __webpack_init_sharing__('default');\n }\n\n const remoteUrl = remoteUrlDefinitions\n ? remoteUrlDefinitions[remoteName]\n : await resolveRemoteUrl(remoteName);\n\n const containerUrl = `${remoteUrl}${\n remoteUrl.endsWith('/') ? '' : '/'\n }remoteEntry.mjs`;\n\n const container = await loadModule(containerUrl);\n await container.init(__webpack_share_scopes__.default);\n\n remoteContainerMap.set(remoteName, container);\n return container;\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;AAOA,IAAI,gBAA0C,CAAC;SAC/B,oBAAoB,CAClC,iBAA2C;IAE3C,gBAAgB,GAAG,iBAAiB,CAAC;AACvC,CAAC;AAED,IAAI,oBAA4C,CAAC;SACjC,oBAAoB,CAAC,WAAmC;IACtE,oBAAoB,GAAG,WAAW,CAAC;AACrC,CAAC;AAED,IAAI,eAAe,GAAG,IAAI,GAAG,EAAmB,CAAC;AACjD,IAAI,kBAAkB,GAAG,IAAI,GAAG,EAAmB,CAAC;SAC9B,gBAAgB,CAAC,UAAkB,EAAE,UAAkB;;QAC3E,MAAM,eAAe,GAAG,GAAG,UAAU,IAAI,UAAU,EAAE,CAAC;QACtD,IAAI,eAAe,CAAC,GAAG,CAAC,eAAe,CAAC,EAAE;YACxC,OAAO,eAAe,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC;SAC7C;QAED,MAAM,SAAS,GAAG,kBAAkB,CAAC,GAAG,CAAC,UAAU,CAAC;cAChD,kBAAkB,CAAC,GAAG,CAAC,UAAU,CAAC;cAClC,MAAM,mBAAmB,CAAC,UAAU,CAAC,CAAC;QAE1C,MAAM,OAAO,GAAG,MAAM,SAAS,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;QAChD,MAAM,MAAM,GAAG,OAAO,EAAE,CAAC;QAEzB,eAAe,CAAC,GAAG,CAAC,eAAe,EAAE,MAAM,CAAC,CAAC;QAE7C,OAAO,MAAM,CAAC;KACf;CAAA;AAED,SAAS,UAAU,CAAC,GAAW;IAC7B,OAAO,gCAAgC,GAAG,CAAC,CAAC;AAC9C,CAAC;AAED,IAAI,0BAA0B,GAAG,KAAK,CAAC;AACvC,SAAe,mBAAmB,CAAC,UAAkB;;QACnD,IAAI,CAAC,gBAAgB,IAAI,CAAC,oBAAoB,EAAE;YAC9C,MAAM,IAAI,KAAK,CACb,kHAAkH,CACnH,CAAC;SACH;QAED,IAAI,CAAC,0BAA0B,EAAE;YAC/B,0BAA0B,GAAG,IAAI,CAAC;YAClC,MAAM,wBAAwB,CAAC,SAAS,CAAC,CAAC;SAC3C;QAED,MAAM,SAAS,GAAG,oBAAoB;cAClC,oBAAoB,CAAC,UAAU,CAAC;cAChC,MAAM,gBAAgB,CAAC,UAAU,CAAC,CAAC;QAEvC,MAAM,YAAY,GAAG,GAAG,SAAS,GAC/B,SAAS,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,GACjC,iBAAiB,CAAC;QAElB,MAAM,SAAS,GAAG,MAAM,UAAU,CAAC,YAAY,CAAC,CAAC;QACjD,MAAM,SAAS,CAAC,IAAI,CAAC,wBAAwB,CAAC,OAAO,CAAC,CAAC;QAEvD,kBAAkB,CAAC,GAAG,CAAC,UAAU,EAAE,SAAS,CAAC,CAAC;QAC9C,OAAO,SAAS,CAAC;KAClB;;;ACrED;;;;;;"}
1
+ {"version":3,"file":"nrwl-angular-mfe.mjs","sources":["../../mfe/mfe.ts","../../mfe/nrwl-angular-mfe.ts"],"sourcesContent":["export type ResolveRemoteUrlFunction = (\n remoteName: string\n) => string | Promise<string>;\n\ndeclare const __webpack_init_sharing__: (scope: 'default') => Promise<void>;\ndeclare const __webpack_share_scopes__: { default: unknown };\n\nlet resolveRemoteUrl: ResolveRemoteUrlFunction;\nexport function setRemoteUrlResolver(\n _resolveRemoteUrl: ResolveRemoteUrlFunction\n) {\n resolveRemoteUrl = _resolveRemoteUrl;\n}\n\nlet remoteUrlDefinitions: Record<string, string>;\nexport function setRemoteDefinitions(definitions: Record<string, string>) {\n remoteUrlDefinitions = definitions;\n}\n\nlet remoteModuleMap = new Map<string, unknown>();\nlet remoteContainerMap = new Map<string, unknown>();\nexport async function loadRemoteModule(remoteName: string, moduleName: string) {\n const remoteModuleKey = `${remoteName}:${moduleName}`;\n if (remoteModuleMap.has(remoteModuleKey)) {\n return remoteModuleMap.get(remoteModuleKey);\n }\n\n const container = remoteContainerMap.has(remoteName)\n ? remoteContainerMap.get(remoteName)\n : await loadRemoteContainer(remoteName);\n\n const factory = await container.get(moduleName);\n const Module = factory();\n\n remoteModuleMap.set(remoteModuleKey, Module);\n\n return Module;\n}\n\nfunction loadModule(url: string) {\n return import(/* webpackIgnore:true */ url);\n}\n\nlet initialSharingScopeCreated = false;\nasync function loadRemoteContainer(remoteName: string) {\n if (!resolveRemoteUrl && !remoteUrlDefinitions) {\n throw new Error(\n 'Call setRemoteDefinitions or setRemoteUrlResolver to allow Dynamic Federation to find the remote apps correctly.'\n );\n }\n\n if (!initialSharingScopeCreated) {\n initialSharingScopeCreated = true;\n await __webpack_init_sharing__('default');\n }\n\n const remoteUrl = remoteUrlDefinitions\n ? remoteUrlDefinitions[remoteName]\n : await resolveRemoteUrl(remoteName);\n\n const containerUrl = `${remoteUrl}${\n remoteUrl.endsWith('/') ? '' : '/'\n }remoteEntry.mjs`;\n\n const container = await loadModule(containerUrl);\n await container.init(__webpack_share_scopes__.default);\n\n remoteContainerMap.set(remoteName, container);\n return container;\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;AAOA,IAAI,gBAA0C,CAAC;AACzC,SAAU,oBAAoB,CAClC,iBAA2C,EAAA;IAE3C,gBAAgB,GAAG,iBAAiB,CAAC;AACvC,CAAC;AAED,IAAI,oBAA4C,CAAC;AAC3C,SAAU,oBAAoB,CAAC,WAAmC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,CAAC,SAAS,CAAC,CAAC;AAC3C,SAAA;QAED,MAAM,SAAS,GAAG,oBAAoB;AACpC,cAAE,oBAAoB,CAAC,UAAU,CAAC;AAClC,cAAE,MAAM,gBAAgB,CAAC,UAAU,CAAC,CAAC;QAEvC,MAAM,YAAY,GAAG,CAAG,EAAA,SAAS,GAC/B,SAAS,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,GACjC,iBAAiB,CAAC;AAElB,QAAA,MAAM,SAAS,GAAG,MAAM,UAAU,CAAC,YAAY,CAAC,CAAC;QACjD,MAAM,SAAS,CAAC,IAAI,CAAC,wBAAwB,CAAC,OAAO,CAAC,CAAC;AAEvD,QAAA,kBAAkB,CAAC,GAAG,CAAC,UAAU,EAAE,SAAS,CAAC,CAAC;AAC9C,QAAA,OAAO,SAAS,CAAC;KAClB,CAAA,CAAA;AAAA;;ACrED;;AAEG;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"nrwl-angular-testing.mjs","sources":["../../testing/src/testing-utils.ts","../../testing/index.ts","../../testing/nrwl-angular-testing.ts"],"sourcesContent":["import type { Observable } from 'rxjs';\nimport { first, toArray } from 'rxjs/operators';\n\n/**\n * @whatItDoes reads all the values from an observable and returns a promise\n * with an array of all values. This should be used in combination with async/await.\n *\n * ## Example\n *\n * ```typescript\n * const obs = of(1, 2, 3, 4);\n * const res = await readAll(obs)\n * expect(res).toEqual([1, 2, 3, 4]);\n * ```\n */\nexport function readAll<T>(o: Observable<T>): Promise<T[]> {\n return o.pipe(toArray()).toPromise();\n}\n\n/**\n * @whatItDoes reads the first value from an observable and returns a promise\n * with it. This should be used in combination with async/await.\n *\n * ## Example\n *\n * ```typescript\n * const obs = of(1, 2, 3, 4);\n * const res = await readFirst(obs)\n * expect(res).toEqual(1);\n * ```\n */\nexport function readFirst<T>(o: Observable<T>): Promise<T> {\n return o.pipe(first()).toPromise();\n}\n","import {\n cold as rxjsMarblesCold,\n hot as rxjsMarblesHot,\n getTestScheduler as rxjsMarblesTestScheduler,\n time as rxjsMarblesTime,\n} from 'jasmine-marbles';\n\n/**\n * @deprecated Import from 'jasmine-marbles' instead\n */\nexport const cold = rxjsMarblesCold;\n/**\n * @deprecated Import from 'jasmine-marbles' instead\n */\nexport const hot = rxjsMarblesHot;\n/**\n * @deprecated Import from 'jasmine-marbles' instead\n */\nexport const getTestScheduler = rxjsMarblesTestScheduler;\n/**\n * @deprecated Import from 'jasmine-marbles' instead\n */\nexport const time = rxjsMarblesTime;\n\nexport { readAll, readFirst } from './src/testing-utils';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["rxjsMarblesCold","rxjsMarblesHot","rxjsMarblesTestScheduler","rxjsMarblesTime"],"mappings":";;;AAGA;;;;;;;;;;;;SAYgB,OAAO,CAAI,CAAgB;IACzC,OAAO,CAAC,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC,SAAS,EAAE,CAAC;AACvC,CAAC;AAED;;;;;;;;;;;;SAYgB,SAAS,CAAI,CAAgB;IAC3C,OAAO,CAAC,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC,SAAS,EAAE,CAAC;AACrC;;AC1BA;;;MAGa,IAAI,GAAGA,OAAgB;AACpC;;;MAGa,GAAG,GAAGC,MAAe;AAClC;;;MAGa,gBAAgB,GAAGC,mBAAyB;AACzD;;;MAGa,IAAI,GAAGC;;ACtBpB;;;;;;"}
1
+ {"version":3,"file":"nrwl-angular-testing.mjs","sources":["../../testing/src/testing-utils.ts","../../testing/index.ts","../../testing/nrwl-angular-testing.ts"],"sourcesContent":["import type { Observable } from 'rxjs';\nimport { first, toArray } from 'rxjs/operators';\n\n/**\n * @whatItDoes reads all the values from an observable and returns a promise\n * with an array of all values. This should be used in combination with async/await.\n *\n * ## Example\n *\n * ```typescript\n * const obs = of(1, 2, 3, 4);\n * const res = await readAll(obs)\n * expect(res).toEqual([1, 2, 3, 4]);\n * ```\n */\nexport function readAll<T>(o: Observable<T>): Promise<T[]> {\n return o.pipe(toArray()).toPromise();\n}\n\n/**\n * @whatItDoes reads the first value from an observable and returns a promise\n * with it. This should be used in combination with async/await.\n *\n * ## Example\n *\n * ```typescript\n * const obs = of(1, 2, 3, 4);\n * const res = await readFirst(obs)\n * expect(res).toEqual(1);\n * ```\n */\nexport function readFirst<T>(o: Observable<T>): Promise<T> {\n return o.pipe(first()).toPromise();\n}\n","import {\n cold as rxjsMarblesCold,\n hot as rxjsMarblesHot,\n getTestScheduler as rxjsMarblesTestScheduler,\n time as rxjsMarblesTime,\n} from 'jasmine-marbles';\n\n/**\n * @deprecated Import from 'jasmine-marbles' instead\n */\nexport const cold = rxjsMarblesCold;\n/**\n * @deprecated Import from 'jasmine-marbles' instead\n */\nexport const hot = rxjsMarblesHot;\n/**\n * @deprecated Import from 'jasmine-marbles' instead\n */\nexport const getTestScheduler = rxjsMarblesTestScheduler;\n/**\n * @deprecated Import from 'jasmine-marbles' instead\n */\nexport const time = rxjsMarblesTime;\n\nexport { readAll, readFirst } from './src/testing-utils';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["rxjsMarblesCold","rxjsMarblesHot","rxjsMarblesTestScheduler","rxjsMarblesTime"],"mappings":";;;AAGA;;;;;;;;;;;AAWG;AACG,SAAU,OAAO,CAAI,CAAgB,EAAA;IACzC,OAAO,CAAC,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC,SAAS,EAAE,CAAC;AACvC,CAAC;AAED;;;;;;;;;;;AAWG;AACG,SAAU,SAAS,CAAI,CAAgB,EAAA;IAC3C,OAAO,CAAC,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC,SAAS,EAAE,CAAC;AACrC;;AC1BA;;AAEG;AACI,MAAM,IAAI,GAAGA,OAAgB;AACpC;;AAEG;AACI,MAAM,GAAG,GAAGC,MAAe;AAClC;;AAEG;AACI,MAAM,gBAAgB,GAAGC,mBAAyB;AACzD;;AAEG;AACI,MAAM,IAAI,GAAGC;;ACtBpB;;AAEG;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"nrwl-angular.mjs","sources":["../../src/runtime/nx/data-persistence.ts","../../src/runtime/nx/nx.module.ts","../../nrwl-angular.ts"],"sourcesContent":["import { Injectable, Type } from '@angular/core';\nimport { ActivatedRouteSnapshot, RouterStateSnapshot } from '@angular/router';\nimport { Actions, ofType } from '@ngrx/effects';\nimport { ROUTER_NAVIGATION, RouterNavigationAction } from '@ngrx/router-store';\nimport { Action, Store, ActionCreator } from '@ngrx/store';\nimport { isObservable, Observable, of } from 'rxjs';\nimport {\n catchError,\n concatMap,\n filter,\n groupBy,\n map,\n mergeMap,\n switchMap,\n withLatestFrom,\n} from 'rxjs/operators';\n\n/**\n * See {@link DataPersistence.pessimisticUpdate} for more information.\n */\nexport interface PessimisticUpdateOpts<T extends Array<unknown>, A> {\n run(a: A, ...slices: [...T]): Observable<Action> | Action | void;\n onError(a: A, e: any): Observable<any> | any;\n}\n/**\n * See {@link DataPersistence.pessimisticUpdate} for more information.\n */\nexport interface OptimisticUpdateOpts<T extends Array<unknown>, A> {\n run(a: A, ...slices: [...T]): Observable<Action> | Action | void;\n undoAction(a: A, e: any): Observable<Action> | Action;\n}\n\n/**\n * See {@link DataPersistence.fetch} for more information.\n */\nexport interface FetchOpts<T extends Array<unknown>, A> {\n id?(a: A, ...slices: [...T]): any;\n run(a: A, ...slices: [...T]): Observable<Action> | Action | void;\n onError?(a: A, e: any): Observable<any> | any;\n}\n\n/**\n * See {@link DataPersistence.navigation} for more information.\n */\nexport interface HandleNavigationOpts<T extends Array<unknown>> {\n run(\n a: ActivatedRouteSnapshot,\n ...slices: [...T]\n ): Observable<Action> | Action | void;\n onError?(a: ActivatedRouteSnapshot, e: any): Observable<any> | any;\n}\n\nexport type ActionOrActionWithStates<T extends Array<unknown>, A> =\n | A\n | [A, ...T];\nexport type ActionOrActionWithState<T, A> = ActionOrActionWithStates<[T], A>;\nexport type ActionStatesStream<T extends Array<unknown>, A> = Observable<\n ActionOrActionWithStates<T, A>\n>;\nexport type ActionStateStream<T, A> = Observable<\n ActionOrActionWithStates<[T], A>\n>;\n\nexport function pessimisticUpdate<T extends Array<unknown>, A extends Action>(\n opts: PessimisticUpdateOpts<T, A>\n) {\n return (source: ActionStatesStream<T, A>): Observable<Action> => {\n return source.pipe(\n mapActionAndState(),\n concatMap(runWithErrorHandling(opts.run, opts.onError))\n );\n };\n}\n\nexport function optimisticUpdate<T extends Array<unknown>, A extends Action>(\n opts: OptimisticUpdateOpts<T, A>\n) {\n return (source: ActionStatesStream<T, A>): Observable<Action> => {\n return source.pipe(\n mapActionAndState(),\n concatMap(runWithErrorHandling(opts.run, opts.undoAction))\n );\n };\n}\n\nexport function fetch<T extends Array<unknown>, A extends Action>(\n opts: FetchOpts<T, A>\n) {\n return (source: ActionStatesStream<T, A>): Observable<Action> => {\n if (opts.id) {\n const groupedFetches = source.pipe(\n mapActionAndState(),\n groupBy(([action, ...store]) => {\n return opts.id(action, ...store);\n })\n );\n\n return groupedFetches.pipe(\n mergeMap((pairs) =>\n pairs.pipe(switchMap(runWithErrorHandling(opts.run, opts.onError)))\n )\n );\n }\n\n return source.pipe(\n mapActionAndState(),\n concatMap(runWithErrorHandling(opts.run, opts.onError))\n );\n };\n}\n\nexport function navigation<T extends Array<unknown>, A extends Action>(\n component: Type<any>,\n opts: HandleNavigationOpts<T>\n) {\n return (source: ActionStatesStream<T, A>) => {\n const nav = source.pipe(\n mapActionAndState(),\n filter(([action]) => isStateSnapshot(action)),\n map(([action, ...slices]) => {\n if (!isStateSnapshot(action)) {\n // Because of the above filter we'll never get here,\n // but this properly type narrows `action`\n return;\n }\n\n return [\n findSnapshot(component, action.payload.routerState.root),\n ...slices,\n ] as [ActivatedRouteSnapshot, ...T];\n }),\n filter(([snapshot]) => !!snapshot)\n );\n\n return nav.pipe(switchMap(runWithErrorHandling(opts.run, opts.onError)));\n };\n}\n\nfunction isStateSnapshot(\n action: any\n): action is RouterNavigationAction<RouterStateSnapshot> {\n return action.type === ROUTER_NAVIGATION;\n}\n\nfunction runWithErrorHandling<T extends Array<unknown>, A, R>(\n run: (a: A, ...slices: [...T]) => Observable<R> | R | void,\n onError: any\n) {\n return ([action, ...slices]: [A, ...T]): Observable<R> => {\n try {\n const r = wrapIntoObservable(run(action, ...slices));\n return r.pipe(catchError((e) => wrapIntoObservable(onError(action, e))));\n } catch (e) {\n return wrapIntoObservable(onError(action, e));\n }\n };\n}\n\n/**\n * @whatItDoes maps Observable<Action | [Action, State]> to\n * Observable<[Action, State]>\n */\nfunction mapActionAndState<T extends Array<unknown>, A>() {\n return (source: Observable<ActionOrActionWithStates<T, A>>) => {\n return source.pipe(\n map((value) => normalizeActionAndState(value) as [A, ...T])\n );\n };\n}\n\n/**\n * @whatItDoes Normalizes either a bare action or an array of action and slices\n * into an array of action and slices (or undefined)\n */\nfunction normalizeActionAndState<T extends Array<unknown>, A>(\n args: ActionOrActionWithStates<T, A>\n): [A, ...T] {\n let action: A, slices: T;\n\n if (args instanceof Array) {\n [action, ...slices] = args;\n } else {\n slices = [] as T;\n action = args;\n }\n\n return [action, ...slices];\n}\n\n/**\n * @whatItDoes Provides convenience methods for implementing common operations of persisting data.\n */\n@Injectable()\nexport class DataPersistence<T> {\n constructor(public store: Store<T>, public actions: Actions) {}\n\n /**\n *\n * @whatItDoes Handles pessimistic updates (updating the server first).\n *\n * Update the server implemented naively suffers from race conditions and poor error handling.\n *\n * `pessimisticUpdate` addresses these problems--it runs all fetches in order, which removes race conditions\n * and forces the developer to handle errors.\n *\n * ## Example:\n *\n * ```typescript\n * @Injectable()\n * class TodoEffects {\n * @Effect() updateTodo = this.s.pessimisticUpdate<UpdateTodo>('UPDATE_TODO', {\n * // provides an action and the current state of the store\n * run(a, state) {\n * // update the backend first, and then dispatch an action that will\n * // update the client side\n * return this.backend(state.user, a.payload).map(updated => ({\n * type: 'TODO_UPDATED',\n * payload: updated\n * }));\n * },\n *\n * onError(a, e: any) {\n * // we don't need to undo the changes on the client side.\n * // we can dispatch an error, or simply log the error here and return `null`\n * return null;\n * }\n * });\n *\n * constructor(private s: DataPersistence<TodosState>, private backend: Backend) {}\n * }\n * ```\n *\n * Note that if you don't return a new action from the run callback, you must set the dispatch property\n * of the effect to false, like this:\n *\n * ```\n * class TodoEffects {\n * @Effect({dispatch: false})\n * updateTodo; //...\n * }\n * ```\n */\n pessimisticUpdate<A extends Action = Action>(\n actionType: string | ActionCreator,\n opts: PessimisticUpdateOpts<[T], A>\n ): Observable<any> {\n return this.actions.pipe(\n ofType<A>(actionType),\n withLatestFrom(this.store),\n pessimisticUpdate(opts)\n );\n }\n\n /**\n *\n * @whatItDoes Handles optimistic updates (updating the client first).\n *\n * `optimisticUpdate` addresses these problems--it runs all fetches in order, which removes race conditions\n * and forces the developer to handle errors.\n *\n * `optimisticUpdate` is different from `pessimisticUpdate`. In case of a failure, when using `optimisticUpdate`,\n * the developer already updated the state locally, so the developer must provide an undo action.\n *\n * The error handling must be done in the callback, or by means of the undo action.\n *\n * ## Example:\n *\n * ```typescript\n * @Injectable()\n * class TodoEffects {\n * @Effect() updateTodo = this.s.optimisticUpdate<UpdateTodo>('UPDATE_TODO', {\n * // provides an action and the current state of the store\n * run: (a, state) => {\n * return this.backend(state.user, a.payload);\n * },\n *\n * undoAction: (a, e: any) => {\n * // dispatch an undo action to undo the changes in the client state\n * return ({\n * type: 'UNDO_UPDATE_TODO',\n * payload: a\n * });\n * }\n * });\n *\n * constructor(private s: DataPersistence<TodosState>, private backend: Backend) {}\n * }\n * ```\n *\n * Note that if you don't return a new action from the run callback, you must set the dispatch property\n * of the effect to false, like this:\n *\n * ```\n * class TodoEffects {\n * @Effect({dispatch: false})\n * updateTodo; //...\n * }\n * ```\n */\n optimisticUpdate<A extends Action = Action>(\n actionType: string | ActionCreator,\n opts: OptimisticUpdateOpts<[T], A>\n ): Observable<any> {\n return this.actions.pipe(\n ofType<A>(actionType),\n withLatestFrom(this.store),\n optimisticUpdate(opts)\n );\n }\n\n /**\n *\n * @whatItDoes Handles data fetching.\n *\n * Data fetching implemented naively suffers from race conditions and poor error handling.\n *\n * `fetch` addresses these problems--it runs all fetches in order, which removes race conditions\n * and forces the developer to handle errors.\n *\n * ## Example:\n *\n * ```typescript\n * @Injectable()\n * class TodoEffects {\n * @Effect() loadTodos = this.s.fetch<GetTodos>('GET_TODOS', {\n * // provides an action and the current state of the store\n * run: (a, state) => {\n * return this.backend(state.user, a.payload).map(r => ({\n * type: 'TODOS',\n * payload: r\n * });\n * },\n *\n * onError: (a, e: any) => {\n * // dispatch an undo action to undo the changes in the client state\n * }\n * });\n *\n * constructor(private s: DataPersistence<TodosState>, private backend: Backend) {}\n * }\n * ```\n *\n * This is correct, but because it set the concurrency to 1, it may not be performant.\n *\n * To fix that, you can provide the `id` function, like this:\n *\n * ```typescript\n * @Injectable()\n * class TodoEffects {\n * @Effect() loadTodo = this.s.fetch<GetTodo>('GET_TODO', {\n * id: (a, state) => {\n * return a.payload.id;\n * }\n *\n * // provides an action and the current state of the store\n * run: (a, state) => {\n * return this.backend(state.user, a.payload).map(r => ({\n * type: 'TODO',\n * payload: r\n * });\n * },\n *\n * onError: (a, e: any) => {\n * // dispatch an undo action to undo the changes in the client state\n * return null;\n * }\n * });\n *\n * constructor(private s: DataPersistence<TodosState>, private backend: Backend) {}\n * }\n * ```\n *\n * With this setup, the requests for Todo 1 will run concurrently with the requests for Todo 2.\n *\n * In addition, if DataPersistence notices that there are multiple requests for Todo 1 scheduled,\n * it will only run the last one.\n */\n fetch<A extends Action = Action>(\n actionType: string | ActionCreator,\n opts: FetchOpts<[T], A>\n ): Observable<any> {\n return this.actions.pipe(\n ofType<A>(actionType),\n withLatestFrom(this.store),\n fetch(opts)\n );\n }\n\n /**\n * @whatItDoes Handles data fetching as part of router navigation.\n *\n * Data fetching implemented naively suffers from race conditions and poor error handling.\n *\n * `navigation` addresses these problems.\n *\n * It checks if an activated router state contains the passed in component type, and, if it does, runs the `run`\n * callback. It provides the activated snapshot associated with the component and the current state. And it only runs\n * the last request.\n *\n * ## Example:\n *\n * ```typescript\n * @Injectable()\n * class TodoEffects {\n * @Effect() loadTodo = this.s.navigation(TodoComponent, {\n * run: (a, state) => {\n * return this.backend.fetchTodo(a.params['id']).map(todo => ({\n * type: 'TODO_LOADED',\n * payload: todo\n * }));\n * },\n * onError: (a, e: any) => {\n * // we can log and error here and return null\n * // we can also navigate back\n * return null;\n * }\n * });\n * constructor(private s: DataPersistence<TodosState>, private backend: Backend) {}\n * }\n * ```\n */\n navigation(\n component: Type<any>,\n opts: HandleNavigationOpts<[T]>\n ): Observable<any> {\n return this.actions.pipe(\n withLatestFrom(this.store),\n navigation(component, opts)\n );\n }\n}\n\nfunction findSnapshot(\n component: Type<any>,\n s: ActivatedRouteSnapshot\n): ActivatedRouteSnapshot {\n if (s.routeConfig && s.routeConfig.component === component) {\n return s;\n }\n for (const c of s.children) {\n const ss = findSnapshot(component, c);\n if (ss) {\n return ss;\n }\n }\n return null;\n}\n\nfunction wrapIntoObservable<O>(obj: Observable<O> | O | void): Observable<O> {\n if (isObservable(obj)) {\n return obj;\n } else if (!obj) {\n return of();\n } else {\n return of(obj as O);\n }\n}\n","import { ModuleWithProviders, NgModule } from '@angular/core';\nimport { DataPersistence } from './data-persistence';\n\n/**\n * @whatItDoes Provides services for enterprise Angular applications.\n *\n * See {@link DataPersistence} for more information.\n */\n@NgModule({})\nexport class NxModule {\n static forRoot(): ModuleWithProviders<NxModule> {\n return { ngModule: NxModule, providers: [DataPersistence] };\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;SA+DgB,iBAAiB,CAC/B,IAAiC;IAEjC,OAAO,CAAC,MAAgC;QACtC,OAAO,MAAM,CAAC,IAAI,CAChB,iBAAiB,EAAE,EACnB,SAAS,CAAC,oBAAoB,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC,CACxD,CAAC;KACH,CAAC;AACJ,CAA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AA+B;QAE/B,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CACtB,cAAc,CAAC,IAAI,CAAC,KAAK,CAAC,EAC1B,UAAU,CAAC,SAAS,EAAE,IAAI,CAAC,CAC5B,CAAC;KACH;;4GA5OU,eAAe;gHAAf,eAAe;2FAAf,eAAe;kBAD3B,UAAU;;AAgPX,SAAS,YAAY,CACnB,SAAoB,EACpB,CAAyB;IAEzB,IAAI,CAAC,CAAC,WAAW,IAAI,CAAC,CAAC,WAAW,CAAC,SAAS,KAAK,SAAS,EAAE;QAC1D,OAAO,CAAC,CAAC;KACV;IACD,KAAK,MAAM,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE;QAC1B,MAAM,EAAE,GAAG,YAAY,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC;QACtC,IAAI,EAAE,EAAE;YACN,OAAO,EAAE,CAAC;SACX;KACF;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED,SAAS,kBAAkB,CAAI,GAA6B;IAC1D,IAAI,YAAY,CAAC,GAAG,CAAC,EAAE;QACrB,OAAO,GAAG,CAAC;KACZ;SAAM,IAAI,CAAC,GAAG,EAAE;QACf,OAAO,EAAE,EAAE,CAAC;KACb;SAAM;QACL,OAAO,EAAE,CAAC,GAAQ,CAAC,CAAC;KACrB;AACH;;ACrcA;;;;;MAMa,QAAQ;IACnB,OAAO,OAAO;QACZ,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC,eAAe,CAAC,EAAE,CAAC;KAC7D;;qGAHU,QAAQ;sGAAR,QAAQ;sGAAR,QAAQ;2FAAR,QAAQ;kBADpB,QAAQ;mBAAC,EAAE;;;ACRZ;;;;;;"}
1
+ {"version":3,"file":"nrwl-angular.mjs","sources":["../../src/runtime/nx/data-persistence.ts","../../src/runtime/nx/nx.module.ts","../../nrwl-angular.ts"],"sourcesContent":["import { Injectable, Type } from '@angular/core';\nimport { ActivatedRouteSnapshot, RouterStateSnapshot } from '@angular/router';\nimport { Actions, ofType } from '@ngrx/effects';\nimport { ROUTER_NAVIGATION, RouterNavigationAction } from '@ngrx/router-store';\nimport { Action, Store, ActionCreator } from '@ngrx/store';\nimport { isObservable, Observable, of } from 'rxjs';\nimport {\n catchError,\n concatMap,\n filter,\n groupBy,\n map,\n mergeMap,\n switchMap,\n withLatestFrom,\n} from 'rxjs/operators';\n\n/**\n * See {@link DataPersistence.pessimisticUpdate} for more information.\n */\nexport interface PessimisticUpdateOpts<T extends Array<unknown>, A> {\n run(a: A, ...slices: [...T]): Observable<Action> | Action | void;\n onError(a: A, e: any): Observable<any> | any;\n}\n/**\n * See {@link DataPersistence.pessimisticUpdate} for more information.\n */\nexport interface OptimisticUpdateOpts<T extends Array<unknown>, A> {\n run(a: A, ...slices: [...T]): Observable<Action> | Action | void;\n undoAction(a: A, e: any): Observable<Action> | Action;\n}\n\n/**\n * See {@link DataPersistence.fetch} for more information.\n */\nexport interface FetchOpts<T extends Array<unknown>, A> {\n id?(a: A, ...slices: [...T]): any;\n run(a: A, ...slices: [...T]): Observable<Action> | Action | void;\n onError?(a: A, e: any): Observable<any> | any;\n}\n\n/**\n * See {@link DataPersistence.navigation} for more information.\n */\nexport interface HandleNavigationOpts<T extends Array<unknown>> {\n run(\n a: ActivatedRouteSnapshot,\n ...slices: [...T]\n ): Observable<Action> | Action | void;\n onError?(a: ActivatedRouteSnapshot, e: any): Observable<any> | any;\n}\n\nexport type ActionOrActionWithStates<T extends Array<unknown>, A> =\n | A\n | [A, ...T];\nexport type ActionOrActionWithState<T, A> = ActionOrActionWithStates<[T], A>;\nexport type ActionStatesStream<T extends Array<unknown>, A> = Observable<\n ActionOrActionWithStates<T, A>\n>;\nexport type ActionStateStream<T, A> = Observable<\n ActionOrActionWithStates<[T], A>\n>;\n\nexport function pessimisticUpdate<T extends Array<unknown>, A extends Action>(\n opts: PessimisticUpdateOpts<T, A>\n) {\n return (source: ActionStatesStream<T, A>): Observable<Action> => {\n return source.pipe(\n mapActionAndState(),\n concatMap(runWithErrorHandling(opts.run, opts.onError))\n );\n };\n}\n\nexport function optimisticUpdate<T extends Array<unknown>, A extends Action>(\n opts: OptimisticUpdateOpts<T, A>\n) {\n return (source: ActionStatesStream<T, A>): Observable<Action> => {\n return source.pipe(\n mapActionAndState(),\n concatMap(runWithErrorHandling(opts.run, opts.undoAction))\n );\n };\n}\n\nexport function fetch<T extends Array<unknown>, A extends Action>(\n opts: FetchOpts<T, A>\n) {\n return (source: ActionStatesStream<T, A>): Observable<Action> => {\n if (opts.id) {\n const groupedFetches = source.pipe(\n mapActionAndState(),\n groupBy(([action, ...store]) => {\n return opts.id(action, ...store);\n })\n );\n\n return groupedFetches.pipe(\n mergeMap((pairs) =>\n pairs.pipe(switchMap(runWithErrorHandling(opts.run, opts.onError)))\n )\n );\n }\n\n return source.pipe(\n mapActionAndState(),\n concatMap(runWithErrorHandling(opts.run, opts.onError))\n );\n };\n}\n\nexport function navigation<T extends Array<unknown>, A extends Action>(\n component: Type<any>,\n opts: HandleNavigationOpts<T>\n) {\n return (source: ActionStatesStream<T, A>) => {\n const nav = source.pipe(\n mapActionAndState(),\n filter(([action]) => isStateSnapshot(action)),\n map(([action, ...slices]) => {\n if (!isStateSnapshot(action)) {\n // Because of the above filter we'll never get here,\n // but this properly type narrows `action`\n return;\n }\n\n return [\n findSnapshot(component, action.payload.routerState.root),\n ...slices,\n ] as [ActivatedRouteSnapshot, ...T];\n }),\n filter(([snapshot]) => !!snapshot)\n );\n\n return nav.pipe(switchMap(runWithErrorHandling(opts.run, opts.onError)));\n };\n}\n\nfunction isStateSnapshot(\n action: any\n): action is RouterNavigationAction<RouterStateSnapshot> {\n return action.type === ROUTER_NAVIGATION;\n}\n\nfunction runWithErrorHandling<T extends Array<unknown>, A, R>(\n run: (a: A, ...slices: [...T]) => Observable<R> | R | void,\n onError: any\n) {\n return ([action, ...slices]: [A, ...T]): Observable<R> => {\n try {\n const r = wrapIntoObservable(run(action, ...slices));\n return r.pipe(catchError((e) => wrapIntoObservable(onError(action, e))));\n } catch (e) {\n return wrapIntoObservable(onError(action, e));\n }\n };\n}\n\n/**\n * @whatItDoes maps Observable<Action | [Action, State]> to\n * Observable<[Action, State]>\n */\nfunction mapActionAndState<T extends Array<unknown>, A>() {\n return (source: Observable<ActionOrActionWithStates<T, A>>) => {\n return source.pipe(\n map((value) => normalizeActionAndState(value) as [A, ...T])\n );\n };\n}\n\n/**\n * @whatItDoes Normalizes either a bare action or an array of action and slices\n * into an array of action and slices (or undefined)\n */\nfunction normalizeActionAndState<T extends Array<unknown>, A>(\n args: ActionOrActionWithStates<T, A>\n): [A, ...T] {\n let action: A, slices: T;\n\n if (args instanceof Array) {\n [action, ...slices] = args;\n } else {\n slices = [] as T;\n action = args;\n }\n\n return [action, ...slices];\n}\n\n/**\n * @whatItDoes Provides convenience methods for implementing common operations of persisting data.\n */\n@Injectable()\nexport class DataPersistence<T> {\n constructor(public store: Store<T>, public actions: Actions) {}\n\n /**\n *\n * @whatItDoes Handles pessimistic updates (updating the server first).\n *\n * Update the server implemented naively suffers from race conditions and poor error handling.\n *\n * `pessimisticUpdate` addresses these problems--it runs all fetches in order, which removes race conditions\n * and forces the developer to handle errors.\n *\n * ## Example:\n *\n * ```typescript\n * @Injectable()\n * class TodoEffects {\n * @Effect() updateTodo = this.s.pessimisticUpdate<UpdateTodo>('UPDATE_TODO', {\n * // provides an action and the current state of the store\n * run(a, state) {\n * // update the backend first, and then dispatch an action that will\n * // update the client side\n * return this.backend(state.user, a.payload).map(updated => ({\n * type: 'TODO_UPDATED',\n * payload: updated\n * }));\n * },\n *\n * onError(a, e: any) {\n * // we don't need to undo the changes on the client side.\n * // we can dispatch an error, or simply log the error here and return `null`\n * return null;\n * }\n * });\n *\n * constructor(private s: DataPersistence<TodosState>, private backend: Backend) {}\n * }\n * ```\n *\n * Note that if you don't return a new action from the run callback, you must set the dispatch property\n * of the effect to false, like this:\n *\n * ```\n * class TodoEffects {\n * @Effect({dispatch: false})\n * updateTodo; //...\n * }\n * ```\n */\n pessimisticUpdate<A extends Action = Action>(\n actionType: string | ActionCreator,\n opts: PessimisticUpdateOpts<[T], A>\n ): Observable<any> {\n return this.actions.pipe(\n ofType<A>(actionType),\n withLatestFrom(this.store),\n pessimisticUpdate(opts)\n );\n }\n\n /**\n *\n * @whatItDoes Handles optimistic updates (updating the client first).\n *\n * `optimisticUpdate` addresses these problems--it runs all fetches in order, which removes race conditions\n * and forces the developer to handle errors.\n *\n * `optimisticUpdate` is different from `pessimisticUpdate`. In case of a failure, when using `optimisticUpdate`,\n * the developer already updated the state locally, so the developer must provide an undo action.\n *\n * The error handling must be done in the callback, or by means of the undo action.\n *\n * ## Example:\n *\n * ```typescript\n * @Injectable()\n * class TodoEffects {\n * @Effect() updateTodo = this.s.optimisticUpdate<UpdateTodo>('UPDATE_TODO', {\n * // provides an action and the current state of the store\n * run: (a, state) => {\n * return this.backend(state.user, a.payload);\n * },\n *\n * undoAction: (a, e: any) => {\n * // dispatch an undo action to undo the changes in the client state\n * return ({\n * type: 'UNDO_UPDATE_TODO',\n * payload: a\n * });\n * }\n * });\n *\n * constructor(private s: DataPersistence<TodosState>, private backend: Backend) {}\n * }\n * ```\n *\n * Note that if you don't return a new action from the run callback, you must set the dispatch property\n * of the effect to false, like this:\n *\n * ```\n * class TodoEffects {\n * @Effect({dispatch: false})\n * updateTodo; //...\n * }\n * ```\n */\n optimisticUpdate<A extends Action = Action>(\n actionType: string | ActionCreator,\n opts: OptimisticUpdateOpts<[T], A>\n ): Observable<any> {\n return this.actions.pipe(\n ofType<A>(actionType),\n withLatestFrom(this.store),\n optimisticUpdate(opts)\n );\n }\n\n /**\n *\n * @whatItDoes Handles data fetching.\n *\n * Data fetching implemented naively suffers from race conditions and poor error handling.\n *\n * `fetch` addresses these problems--it runs all fetches in order, which removes race conditions\n * and forces the developer to handle errors.\n *\n * ## Example:\n *\n * ```typescript\n * @Injectable()\n * class TodoEffects {\n * @Effect() loadTodos = this.s.fetch<GetTodos>('GET_TODOS', {\n * // provides an action and the current state of the store\n * run: (a, state) => {\n * return this.backend(state.user, a.payload).map(r => ({\n * type: 'TODOS',\n * payload: r\n * });\n * },\n *\n * onError: (a, e: any) => {\n * // dispatch an undo action to undo the changes in the client state\n * }\n * });\n *\n * constructor(private s: DataPersistence<TodosState>, private backend: Backend) {}\n * }\n * ```\n *\n * This is correct, but because it set the concurrency to 1, it may not be performant.\n *\n * To fix that, you can provide the `id` function, like this:\n *\n * ```typescript\n * @Injectable()\n * class TodoEffects {\n * @Effect() loadTodo = this.s.fetch<GetTodo>('GET_TODO', {\n * id: (a, state) => {\n * return a.payload.id;\n * }\n *\n * // provides an action and the current state of the store\n * run: (a, state) => {\n * return this.backend(state.user, a.payload).map(r => ({\n * type: 'TODO',\n * payload: r\n * });\n * },\n *\n * onError: (a, e: any) => {\n * // dispatch an undo action to undo the changes in the client state\n * return null;\n * }\n * });\n *\n * constructor(private s: DataPersistence<TodosState>, private backend: Backend) {}\n * }\n * ```\n *\n * With this setup, the requests for Todo 1 will run concurrently with the requests for Todo 2.\n *\n * In addition, if DataPersistence notices that there are multiple requests for Todo 1 scheduled,\n * it will only run the last one.\n */\n fetch<A extends Action = Action>(\n actionType: string | ActionCreator,\n opts: FetchOpts<[T], A>\n ): Observable<any> {\n return this.actions.pipe(\n ofType<A>(actionType),\n withLatestFrom(this.store),\n fetch(opts)\n );\n }\n\n /**\n * @whatItDoes Handles data fetching as part of router navigation.\n *\n * Data fetching implemented naively suffers from race conditions and poor error handling.\n *\n * `navigation` addresses these problems.\n *\n * It checks if an activated router state contains the passed in component type, and, if it does, runs the `run`\n * callback. It provides the activated snapshot associated with the component and the current state. And it only runs\n * the last request.\n *\n * ## Example:\n *\n * ```typescript\n * @Injectable()\n * class TodoEffects {\n * @Effect() loadTodo = this.s.navigation(TodoComponent, {\n * run: (a, state) => {\n * return this.backend.fetchTodo(a.params['id']).map(todo => ({\n * type: 'TODO_LOADED',\n * payload: todo\n * }));\n * },\n * onError: (a, e: any) => {\n * // we can log and error here and return null\n * // we can also navigate back\n * return null;\n * }\n * });\n * constructor(private s: DataPersistence<TodosState>, private backend: Backend) {}\n * }\n * ```\n */\n navigation(\n component: Type<any>,\n opts: HandleNavigationOpts<[T]>\n ): Observable<any> {\n return this.actions.pipe(\n withLatestFrom(this.store),\n navigation(component, opts)\n );\n }\n}\n\nfunction findSnapshot(\n component: Type<any>,\n s: ActivatedRouteSnapshot\n): ActivatedRouteSnapshot {\n if (s.routeConfig && s.routeConfig.component === component) {\n return s;\n }\n for (const c of s.children) {\n const ss = findSnapshot(component, c);\n if (ss) {\n return ss;\n }\n }\n return null;\n}\n\nfunction wrapIntoObservable<O>(obj: Observable<O> | O | void): Observable<O> {\n if (isObservable(obj)) {\n return obj;\n } else if (!obj) {\n return of();\n } else {\n return of(obj as O);\n }\n}\n","import { ModuleWithProviders, NgModule } from '@angular/core';\nimport { DataPersistence } from './data-persistence';\n\n/**\n * @whatItDoes Provides services for enterprise Angular applications.\n *\n * See {@link DataPersistence} for more information.\n */\n@NgModule({})\nexport class NxModule {\n static forRoot(): ModuleWithProviders<NxModule> {\n return { ngModule: NxModule, providers: [DataPersistence] };\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;AA+DM,SAAU,iBAAiB,CAC/B,IAAiC,EAAA;IAEjC,OAAO,CAAC,MAAgC,KAAwB;QAC9D,OAAO,MAAM,CAAC,IAAI,CAChB,iBAAiB,EAAE,EACnB,SAAS,CAAC,oBAAoB,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC,CACxD,CAAC;AACJ,KAAC,CAAC;AACJ,CAAC;AAEK,SAAU,gBAAgB,CAC9B,IAAgC,EAAA;IAEhC,OAAO,CAAC,MAAgC,KAAwB;QAC9D,OAAO,MAAM,CAAC,IAAI,CAChB,iBAAiB,EAAE,EACnB,SAAS,CAAC,oBAAoB,CAAC,IAAI,CAAC,GAAG,EAAE,I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,OAAO,EAAE,EAAE,CAAC;AACb,KAAA;AAAM,SAAA;AACL,QAAA,OAAO,EAAE,CAAC,GAAQ,CAAC,CAAC;AACrB,KAAA;AACH;;ACrcA;;;;AAIG;MAEU,QAAQ,CAAA;AACnB,IAAA,OAAO,OAAO,GAAA;QACZ,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC,eAAe,CAAC,EAAE,CAAC;KAC7D;;qGAHU,QAAQ,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA,CAAA;sGAAR,QAAQ,EAAA,CAAA,CAAA;sGAAR,QAAQ,EAAA,CAAA,CAAA;2FAAR,QAAQ,EAAA,UAAA,EAAA,CAAA;kBADpB,QAAQ;mBAAC,EAAE,CAAA;;;ACRZ;;AAEG;;;;"}
@@ -47,5 +47,5 @@ async function loadRemoteContainer(remoteName) {
47
47
  * Generated bundle index. Do not edit.
48
48
  */
49
49
 
50
- export { loadRemoteModule, setRemoteUrlResolver };
50
+ export { loadRemoteModule, setRemoteDefinitions, setRemoteUrlResolver };
51
51
  //# sourceMappingURL=nrwl-angular-mfe.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"nrwl-angular-mfe.mjs","sources":["../../mfe/mfe.ts","../../mfe/nrwl-angular-mfe.ts"],"sourcesContent":["export type ResolveRemoteUrlFunction = (\n remoteName: string\n) => string | Promise<string>;\n\ndeclare const __webpack_init_sharing__: (scope: 'default') => Promise<void>;\ndeclare const __webpack_share_scopes__: { default: unknown };\n\nlet resolveRemoteUrl: ResolveRemoteUrlFunction;\nexport function setRemoteUrlResolver(\n _resolveRemoteUrl: ResolveRemoteUrlFunction\n) {\n resolveRemoteUrl = _resolveRemoteUrl;\n}\n\nlet remoteUrlDefinitions: Record<string, string>;\nexport function setRemoteDefinitions(definitions: Record<string, string>) {\n remoteUrlDefinitions = definitions;\n}\n\nlet remoteModuleMap = new Map<string, unknown>();\nlet remoteContainerMap = new Map<string, unknown>();\nexport async function loadRemoteModule(remoteName: string, moduleName: string) {\n const remoteModuleKey = `${remoteName}:${moduleName}`;\n if (remoteModuleMap.has(remoteModuleKey)) {\n return remoteModuleMap.get(remoteModuleKey);\n }\n\n const container = remoteContainerMap.has(remoteName)\n ? remoteContainerMap.get(remoteName)\n : await loadRemoteContainer(remoteName);\n\n const factory = await container.get(moduleName);\n const Module = factory();\n\n remoteModuleMap.set(remoteModuleKey, Module);\n\n return Module;\n}\n\nfunction loadModule(url: string) {\n return import(/* webpackIgnore:true */ url);\n}\n\nlet initialSharingScopeCreated = false;\nasync function loadRemoteContainer(remoteName: string) {\n if (!resolveRemoteUrl && !remoteUrlDefinitions) {\n throw new Error(\n 'Call setRemoteDefinitions or setRemoteUrlResolver to allow Dynamic Federation to find the remote apps correctly.'\n );\n }\n\n if (!initialSharingScopeCreated) {\n initialSharingScopeCreated = true;\n await __webpack_init_sharing__('default');\n }\n\n const remoteUrl = remoteUrlDefinitions\n ? remoteUrlDefinitions[remoteName]\n : await resolveRemoteUrl(remoteName);\n\n const containerUrl = `${remoteUrl}${\n remoteUrl.endsWith('/') ? '' : '/'\n }remoteEntry.mjs`;\n\n const container = await loadModule(containerUrl);\n await container.init(__webpack_share_scopes__.default);\n\n remoteContainerMap.set(remoteName, container);\n return container;\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":"AAOA,IAAI,gBAA0C,CAAC;SAC/B,oBAAoB,CAClC,iBAA2C;IAE3C,gBAAgB,GAAG,iBAAiB,CAAC;AACvC,CAAC;AAED,IAAI,oBAA4C,CAAC;SACjC,oBAAoB,CAAC,WAAmC;IACtE,oBAAoB,GAAG,WAAW,CAAC;AACrC,CAAC;AAED,IAAI,eAAe,GAAG,IAAI,GAAG,EAAmB,CAAC;AACjD,IAAI,kBAAkB,GAAG,IAAI,GAAG,EAAmB,CAAC;AAC7C,eAAe,gBAAgB,CAAC,UAAkB,EAAE,UA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AAC,IAAI,CAAC,wBAAwB,CAAC,OAAO,CAAC,CAAC;IAEvD,kBAAkB,CAAC,GAAG,CAAC,UAAU,EAAE,SAAS,CAAC,CAAC;IAC9C,OAAO,SAAS,CAAC;AACnB;;ACrEA;;;;;;"}
1
+ {"version":3,"file":"nrwl-angular-mfe.mjs","sources":["../../mfe/mfe.ts","../../mfe/nrwl-angular-mfe.ts"],"sourcesContent":["export type ResolveRemoteUrlFunction = (\n remoteName: string\n) => string | Promise<string>;\n\ndeclare const __webpack_init_sharing__: (scope: 'default') => Promise<void>;\ndeclare const __webpack_share_scopes__: { default: unknown };\n\nlet resolveRemoteUrl: ResolveRemoteUrlFunction;\nexport function setRemoteUrlResolver(\n _resolveRemoteUrl: ResolveRemoteUrlFunction\n) {\n resolveRemoteUrl = _resolveRemoteUrl;\n}\n\nlet remoteUrlDefinitions: Record<string, string>;\nexport function setRemoteDefinitions(definitions: Record<string, string>) {\n remoteUrlDefinitions = definitions;\n}\n\nlet remoteModuleMap = new Map<string, unknown>();\nlet remoteContainerMap = new Map<string, unknown>();\nexport async function loadRemoteModule(remoteName: string, moduleName: string) {\n const remoteModuleKey = `${remoteName}:${moduleName}`;\n if (remoteModuleMap.has(remoteModuleKey)) {\n return remoteModuleMap.get(remoteModuleKey);\n }\n\n const container = remoteContainerMap.has(remoteName)\n ? remoteContainerMap.get(remoteName)\n : await loadRemoteContainer(remoteName);\n\n const factory = await container.get(moduleName);\n const Module = factory();\n\n remoteModuleMap.set(remoteModuleKey, Module);\n\n return Module;\n}\n\nfunction loadModule(url: string) {\n return import(/* webpackIgnore:true */ url);\n}\n\nlet initialSharingScopeCreated = false;\nasync function loadRemoteContainer(remoteName: string) {\n if (!resolveRemoteUrl && !remoteUrlDefinitions) {\n throw new Error(\n 'Call setRemoteDefinitions or setRemoteUrlResolver to allow Dynamic Federation to find the remote apps correctly.'\n );\n }\n\n if (!initialSharingScopeCreated) {\n initialSharingScopeCreated = true;\n await __webpack_init_sharing__('default');\n }\n\n const remoteUrl = remoteUrlDefinitions\n ? remoteUrlDefinitions[remoteName]\n : await resolveRemoteUrl(remoteName);\n\n const containerUrl = `${remoteUrl}${\n remoteUrl.endsWith('/') ? '' : '/'\n }remoteEntry.mjs`;\n\n const container = await loadModule(containerUrl);\n await container.init(__webpack_share_scopes__.default);\n\n remoteContainerMap.set(remoteName, container);\n return container;\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":"AAOA,IAAI,gBAA0C,CAAC;AACzC,SAAU,oBAAoB,CAClC,iBAA2C,EAAA;IAE3C,gBAAgB,GAAG,iBAAiB,CAAC;AACvC,CAAC;AAED,IAAI,oBAA4C,CAAC;AAC3C,SAAU,oBAAoB,CAAC,WAAmC,EAAA;IACtE,oBAAoB,GAAG,WAAW,CAAC;AACrC,CAAC;AAED,IAAI,eAAe,GAAG,IAAI,GAAG,EAAmB,CAAC;AACjD,IAAI,kBAAkB,GAAG,IAAI,GAAG,EAAmB,CAAC;AAC7C,eAAe,gBAAgB,CAAC,UAAkB,EAAE,UAAkB,EAAA;AAC3E,IAAA,MAAM,eAAe,GAAG,CAAA,EAAG,UAAU,CAAI,CAAA,EAAA,UAAU,EAAE,CAAC;AACtD,IAAA,IAAI,eAAe,CAAC,GAAG,CAAC,eAAe,CAAC,EAAE;AACxC,QAAA,OAAO,eAAe,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC;AAC7C,KAAA;AAED,IAAA,MAAM,SAAS,GAAG,kBAAkB,CAAC,GAAG,CAAC,UAAU,CAAC;AAClD,UAAE,kBAAkB,CAAC,GAAG,CAAC,UAAU,CAAC;AACpC,UAAE,MAAM,mBAAmB,CAAC,UAAU,CAAC,CAAC;IAE1C,MAAM,OAAO,GAAG,MAAM,SAAS,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;AAChD,IAAA,MAAM,MAAM,GAAG,OAAO,EAAE,CAAC;AAEzB,IAAA,eAAe,CAAC,GAAG,CAAC,eAAe,EAAE,MAAM,CAAC,CAAC;AAE7C,IAAA,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,SAAS,UAAU,CAAC,GAAW,EAAA;AAC7B,IAAA,OAAO,gCAAgC,GAAG,CAAC,CAAC;AAC9C,CAAC;AAED,IAAI,0BAA0B,GAAG,KAAK,CAAC;AACvC,eAAe,mBAAmB,CAAC,UAAkB,EAAA;AACnD,IAAA,IAAI,CAAC,gBAAgB,IAAI,CAAC,oBAAoB,EAAE;AAC9C,QAAA,MAAM,IAAI,KAAK,CACb,kHAAkH,CACnH,CAAC;AACH,KAAA;IAED,IAAI,CAAC,0BAA0B,EAAE;QAC/B,0BAA0B,GAAG,IAAI,CAAC;AAClC,QAAA,MAAM,wBAAwB,CAAC,SAAS,CAAC,CAAC;AAC3C,KAAA;IAED,MAAM,SAAS,GAAG,oBAAoB;AACpC,UAAE,oBAAoB,CAAC,UAAU,CAAC;AAClC,UAAE,MAAM,gBAAgB,CAAC,UAAU,CAAC,CAAC;IAEvC,MAAM,YAAY,GAAG,CAAG,EAAA,SAAS,GAC/B,SAAS,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,GACjC,iBAAiB,CAAC;AAElB,IAAA,MAAM,SAAS,GAAG,MAAM,UAAU,CAAC,YAAY,CAAC,CAAC;IACjD,MAAM,SAAS,CAAC,IAAI,CAAC,wBAAwB,CAAC,OAAO,CAAC,CAAC;AAEvD,IAAA,kBAAkB,CAAC,GAAG,CAAC,UAAU,EAAE,SAAS,CAAC,CAAC;AAC9C,IAAA,OAAO,SAAS,CAAC;AACnB;;ACrEA;;AAEG;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"nrwl-angular-testing.mjs","sources":["../../testing/src/testing-utils.ts","../../testing/index.ts","../../testing/nrwl-angular-testing.ts"],"sourcesContent":["import type { Observable } from 'rxjs';\nimport { first, toArray } from 'rxjs/operators';\n\n/**\n * @whatItDoes reads all the values from an observable and returns a promise\n * with an array of all values. This should be used in combination with async/await.\n *\n * ## Example\n *\n * ```typescript\n * const obs = of(1, 2, 3, 4);\n * const res = await readAll(obs)\n * expect(res).toEqual([1, 2, 3, 4]);\n * ```\n */\nexport function readAll<T>(o: Observable<T>): Promise<T[]> {\n return o.pipe(toArray()).toPromise();\n}\n\n/**\n * @whatItDoes reads the first value from an observable and returns a promise\n * with it. This should be used in combination with async/await.\n *\n * ## Example\n *\n * ```typescript\n * const obs = of(1, 2, 3, 4);\n * const res = await readFirst(obs)\n * expect(res).toEqual(1);\n * ```\n */\nexport function readFirst<T>(o: Observable<T>): Promise<T> {\n return o.pipe(first()).toPromise();\n}\n","import {\n cold as rxjsMarblesCold,\n hot as rxjsMarblesHot,\n getTestScheduler as rxjsMarblesTestScheduler,\n time as rxjsMarblesTime,\n} from 'jasmine-marbles';\n\n/**\n * @deprecated Import from 'jasmine-marbles' instead\n */\nexport const cold = rxjsMarblesCold;\n/**\n * @deprecated Import from 'jasmine-marbles' instead\n */\nexport const hot = rxjsMarblesHot;\n/**\n * @deprecated Import from 'jasmine-marbles' instead\n */\nexport const getTestScheduler = rxjsMarblesTestScheduler;\n/**\n * @deprecated Import from 'jasmine-marbles' instead\n */\nexport const time = rxjsMarblesTime;\n\nexport { readAll, readFirst } from './src/testing-utils';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["rxjsMarblesCold","rxjsMarblesHot","rxjsMarblesTestScheduler","rxjsMarblesTime"],"mappings":";;;AAGA;;;;;;;;;;;;SAYgB,OAAO,CAAI,CAAgB;IACzC,OAAO,CAAC,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC,SAAS,EAAE,CAAC;AACvC,CAAC;AAED;;;;;;;;;;;;SAYgB,SAAS,CAAI,CAAgB;IAC3C,OAAO,CAAC,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC,SAAS,EAAE,CAAC;AACrC;;AC1BA;;;MAGa,IAAI,GAAGA,OAAgB;AACpC;;;MAGa,GAAG,GAAGC,MAAe;AAClC;;;MAGa,gBAAgB,GAAGC,mBAAyB;AACzD;;;MAGa,IAAI,GAAGC;;ACtBpB;;;;;;"}
1
+ {"version":3,"file":"nrwl-angular-testing.mjs","sources":["../../testing/src/testing-utils.ts","../../testing/index.ts","../../testing/nrwl-angular-testing.ts"],"sourcesContent":["import type { Observable } from 'rxjs';\nimport { first, toArray } from 'rxjs/operators';\n\n/**\n * @whatItDoes reads all the values from an observable and returns a promise\n * with an array of all values. This should be used in combination with async/await.\n *\n * ## Example\n *\n * ```typescript\n * const obs = of(1, 2, 3, 4);\n * const res = await readAll(obs)\n * expect(res).toEqual([1, 2, 3, 4]);\n * ```\n */\nexport function readAll<T>(o: Observable<T>): Promise<T[]> {\n return o.pipe(toArray()).toPromise();\n}\n\n/**\n * @whatItDoes reads the first value from an observable and returns a promise\n * with it. This should be used in combination with async/await.\n *\n * ## Example\n *\n * ```typescript\n * const obs = of(1, 2, 3, 4);\n * const res = await readFirst(obs)\n * expect(res).toEqual(1);\n * ```\n */\nexport function readFirst<T>(o: Observable<T>): Promise<T> {\n return o.pipe(first()).toPromise();\n}\n","import {\n cold as rxjsMarblesCold,\n hot as rxjsMarblesHot,\n getTestScheduler as rxjsMarblesTestScheduler,\n time as rxjsMarblesTime,\n} from 'jasmine-marbles';\n\n/**\n * @deprecated Import from 'jasmine-marbles' instead\n */\nexport const cold = rxjsMarblesCold;\n/**\n * @deprecated Import from 'jasmine-marbles' instead\n */\nexport const hot = rxjsMarblesHot;\n/**\n * @deprecated Import from 'jasmine-marbles' instead\n */\nexport const getTestScheduler = rxjsMarblesTestScheduler;\n/**\n * @deprecated Import from 'jasmine-marbles' instead\n */\nexport const time = rxjsMarblesTime;\n\nexport { readAll, readFirst } from './src/testing-utils';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["rxjsMarblesCold","rxjsMarblesHot","rxjsMarblesTestScheduler","rxjsMarblesTime"],"mappings":";;;AAGA;;;;;;;;;;;AAWG;AACG,SAAU,OAAO,CAAI,CAAgB,EAAA;IACzC,OAAO,CAAC,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC,SAAS,EAAE,CAAC;AACvC,CAAC;AAED;;;;;;;;;;;AAWG;AACG,SAAU,SAAS,CAAI,CAAgB,EAAA;IAC3C,OAAO,CAAC,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC,SAAS,EAAE,CAAC;AACrC;;AC1BA;;AAEG;AACI,MAAM,IAAI,GAAGA,OAAgB;AACpC;;AAEG;AACI,MAAM,GAAG,GAAGC,MAAe;AAClC;;AAEG;AACI,MAAM,gBAAgB,GAAGC,mBAAyB;AACzD;;AAEG;AACI,MAAM,IAAI,GAAGC;;ACtBpB;;AAEG;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"nrwl-angular.mjs","sources":["../../src/runtime/nx/data-persistence.ts","../../src/runtime/nx/nx.module.ts","../../nrwl-angular.ts"],"sourcesContent":["import { Injectable, Type } from '@angular/core';\nimport { ActivatedRouteSnapshot, RouterStateSnapshot } from '@angular/router';\nimport { Actions, ofType } from '@ngrx/effects';\nimport { ROUTER_NAVIGATION, RouterNavigationAction } from '@ngrx/router-store';\nimport { Action, Store, ActionCreator } from '@ngrx/store';\nimport { isObservable, Observable, of } from 'rxjs';\nimport {\n catchError,\n concatMap,\n filter,\n groupBy,\n map,\n mergeMap,\n switchMap,\n withLatestFrom,\n} from 'rxjs/operators';\n\n/**\n * See {@link DataPersistence.pessimisticUpdate} for more information.\n */\nexport interface PessimisticUpdateOpts<T extends Array<unknown>, A> {\n run(a: A, ...slices: [...T]): Observable<Action> | Action | void;\n onError(a: A, e: any): Observable<any> | any;\n}\n/**\n * See {@link DataPersistence.pessimisticUpdate} for more information.\n */\nexport interface OptimisticUpdateOpts<T extends Array<unknown>, A> {\n run(a: A, ...slices: [...T]): Observable<Action> | Action | void;\n undoAction(a: A, e: any): Observable<Action> | Action;\n}\n\n/**\n * See {@link DataPersistence.fetch} for more information.\n */\nexport interface FetchOpts<T extends Array<unknown>, A> {\n id?(a: A, ...slices: [...T]): any;\n run(a: A, ...slices: [...T]): Observable<Action> | Action | void;\n onError?(a: A, e: any): Observable<any> | any;\n}\n\n/**\n * See {@link DataPersistence.navigation} for more information.\n */\nexport interface HandleNavigationOpts<T extends Array<unknown>> {\n run(\n a: ActivatedRouteSnapshot,\n ...slices: [...T]\n ): Observable<Action> | Action | void;\n onError?(a: ActivatedRouteSnapshot, e: any): Observable<any> | any;\n}\n\nexport type ActionOrActionWithStates<T extends Array<unknown>, A> =\n | A\n | [A, ...T];\nexport type ActionOrActionWithState<T, A> = ActionOrActionWithStates<[T], A>;\nexport type ActionStatesStream<T extends Array<unknown>, A> = Observable<\n ActionOrActionWithStates<T, A>\n>;\nexport type ActionStateStream<T, A> = Observable<\n ActionOrActionWithStates<[T], A>\n>;\n\nexport function pessimisticUpdate<T extends Array<unknown>, A extends Action>(\n opts: PessimisticUpdateOpts<T, A>\n) {\n return (source: ActionStatesStream<T, A>): Observable<Action> => {\n return source.pipe(\n mapActionAndState(),\n concatMap(runWithErrorHandling(opts.run, opts.onError))\n );\n };\n}\n\nexport function optimisticUpdate<T extends Array<unknown>, A extends Action>(\n opts: OptimisticUpdateOpts<T, A>\n) {\n return (source: ActionStatesStream<T, A>): Observable<Action> => {\n return source.pipe(\n mapActionAndState(),\n concatMap(runWithErrorHandling(opts.run, opts.undoAction))\n );\n };\n}\n\nexport function fetch<T extends Array<unknown>, A extends Action>(\n opts: FetchOpts<T, A>\n) {\n return (source: ActionStatesStream<T, A>): Observable<Action> => {\n if (opts.id) {\n const groupedFetches = source.pipe(\n mapActionAndState(),\n groupBy(([action, ...store]) => {\n return opts.id(action, ...store);\n })\n );\n\n return groupedFetches.pipe(\n mergeMap((pairs) =>\n pairs.pipe(switchMap(runWithErrorHandling(opts.run, opts.onError)))\n )\n );\n }\n\n return source.pipe(\n mapActionAndState(),\n concatMap(runWithErrorHandling(opts.run, opts.onError))\n );\n };\n}\n\nexport function navigation<T extends Array<unknown>, A extends Action>(\n component: Type<any>,\n opts: HandleNavigationOpts<T>\n) {\n return (source: ActionStatesStream<T, A>) => {\n const nav = source.pipe(\n mapActionAndState(),\n filter(([action]) => isStateSnapshot(action)),\n map(([action, ...slices]) => {\n if (!isStateSnapshot(action)) {\n // Because of the above filter we'll never get here,\n // but this properly type narrows `action`\n return;\n }\n\n return [\n findSnapshot(component, action.payload.routerState.root),\n ...slices,\n ] as [ActivatedRouteSnapshot, ...T];\n }),\n filter(([snapshot]) => !!snapshot)\n );\n\n return nav.pipe(switchMap(runWithErrorHandling(opts.run, opts.onError)));\n };\n}\n\nfunction isStateSnapshot(\n action: any\n): action is RouterNavigationAction<RouterStateSnapshot> {\n return action.type === ROUTER_NAVIGATION;\n}\n\nfunction runWithErrorHandling<T extends Array<unknown>, A, R>(\n run: (a: A, ...slices: [...T]) => Observable<R> | R | void,\n onError: any\n) {\n return ([action, ...slices]: [A, ...T]): Observable<R> => {\n try {\n const r = wrapIntoObservable(run(action, ...slices));\n return r.pipe(catchError((e) => wrapIntoObservable(onError(action, e))));\n } catch (e) {\n return wrapIntoObservable(onError(action, e));\n }\n };\n}\n\n/**\n * @whatItDoes maps Observable<Action | [Action, State]> to\n * Observable<[Action, State]>\n */\nfunction mapActionAndState<T extends Array<unknown>, A>() {\n return (source: Observable<ActionOrActionWithStates<T, A>>) => {\n return source.pipe(\n map((value) => normalizeActionAndState(value) as [A, ...T])\n );\n };\n}\n\n/**\n * @whatItDoes Normalizes either a bare action or an array of action and slices\n * into an array of action and slices (or undefined)\n */\nfunction normalizeActionAndState<T extends Array<unknown>, A>(\n args: ActionOrActionWithStates<T, A>\n): [A, ...T] {\n let action: A, slices: T;\n\n if (args instanceof Array) {\n [action, ...slices] = args;\n } else {\n slices = [] as T;\n action = args;\n }\n\n return [action, ...slices];\n}\n\n/**\n * @whatItDoes Provides convenience methods for implementing common operations of persisting data.\n */\n@Injectable()\nexport class DataPersistence<T> {\n constructor(public store: Store<T>, public actions: Actions) {}\n\n /**\n *\n * @whatItDoes Handles pessimistic updates (updating the server first).\n *\n * Update the server implemented naively suffers from race conditions and poor error handling.\n *\n * `pessimisticUpdate` addresses these problems--it runs all fetches in order, which removes race conditions\n * and forces the developer to handle errors.\n *\n * ## Example:\n *\n * ```typescript\n * @Injectable()\n * class TodoEffects {\n * @Effect() updateTodo = this.s.pessimisticUpdate<UpdateTodo>('UPDATE_TODO', {\n * // provides an action and the current state of the store\n * run(a, state) {\n * // update the backend first, and then dispatch an action that will\n * // update the client side\n * return this.backend(state.user, a.payload).map(updated => ({\n * type: 'TODO_UPDATED',\n * payload: updated\n * }));\n * },\n *\n * onError(a, e: any) {\n * // we don't need to undo the changes on the client side.\n * // we can dispatch an error, or simply log the error here and return `null`\n * return null;\n * }\n * });\n *\n * constructor(private s: DataPersistence<TodosState>, private backend: Backend) {}\n * }\n * ```\n *\n * Note that if you don't return a new action from the run callback, you must set the dispatch property\n * of the effect to false, like this:\n *\n * ```\n * class TodoEffects {\n * @Effect({dispatch: false})\n * updateTodo; //...\n * }\n * ```\n */\n pessimisticUpdate<A extends Action = Action>(\n actionType: string | ActionCreator,\n opts: PessimisticUpdateOpts<[T], A>\n ): Observable<any> {\n return this.actions.pipe(\n ofType<A>(actionType),\n withLatestFrom(this.store),\n pessimisticUpdate(opts)\n );\n }\n\n /**\n *\n * @whatItDoes Handles optimistic updates (updating the client first).\n *\n * `optimisticUpdate` addresses these problems--it runs all fetches in order, which removes race conditions\n * and forces the developer to handle errors.\n *\n * `optimisticUpdate` is different from `pessimisticUpdate`. In case of a failure, when using `optimisticUpdate`,\n * the developer already updated the state locally, so the developer must provide an undo action.\n *\n * The error handling must be done in the callback, or by means of the undo action.\n *\n * ## Example:\n *\n * ```typescript\n * @Injectable()\n * class TodoEffects {\n * @Effect() updateTodo = this.s.optimisticUpdate<UpdateTodo>('UPDATE_TODO', {\n * // provides an action and the current state of the store\n * run: (a, state) => {\n * return this.backend(state.user, a.payload);\n * },\n *\n * undoAction: (a, e: any) => {\n * // dispatch an undo action to undo the changes in the client state\n * return ({\n * type: 'UNDO_UPDATE_TODO',\n * payload: a\n * });\n * }\n * });\n *\n * constructor(private s: DataPersistence<TodosState>, private backend: Backend) {}\n * }\n * ```\n *\n * Note that if you don't return a new action from the run callback, you must set the dispatch property\n * of the effect to false, like this:\n *\n * ```\n * class TodoEffects {\n * @Effect({dispatch: false})\n * updateTodo; //...\n * }\n * ```\n */\n optimisticUpdate<A extends Action = Action>(\n actionType: string | ActionCreator,\n opts: OptimisticUpdateOpts<[T], A>\n ): Observable<any> {\n return this.actions.pipe(\n ofType<A>(actionType),\n withLatestFrom(this.store),\n optimisticUpdate(opts)\n );\n }\n\n /**\n *\n * @whatItDoes Handles data fetching.\n *\n * Data fetching implemented naively suffers from race conditions and poor error handling.\n *\n * `fetch` addresses these problems--it runs all fetches in order, which removes race conditions\n * and forces the developer to handle errors.\n *\n * ## Example:\n *\n * ```typescript\n * @Injectable()\n * class TodoEffects {\n * @Effect() loadTodos = this.s.fetch<GetTodos>('GET_TODOS', {\n * // provides an action and the current state of the store\n * run: (a, state) => {\n * return this.backend(state.user, a.payload).map(r => ({\n * type: 'TODOS',\n * payload: r\n * });\n * },\n *\n * onError: (a, e: any) => {\n * // dispatch an undo action to undo the changes in the client state\n * }\n * });\n *\n * constructor(private s: DataPersistence<TodosState>, private backend: Backend) {}\n * }\n * ```\n *\n * This is correct, but because it set the concurrency to 1, it may not be performant.\n *\n * To fix that, you can provide the `id` function, like this:\n *\n * ```typescript\n * @Injectable()\n * class TodoEffects {\n * @Effect() loadTodo = this.s.fetch<GetTodo>('GET_TODO', {\n * id: (a, state) => {\n * return a.payload.id;\n * }\n *\n * // provides an action and the current state of the store\n * run: (a, state) => {\n * return this.backend(state.user, a.payload).map(r => ({\n * type: 'TODO',\n * payload: r\n * });\n * },\n *\n * onError: (a, e: any) => {\n * // dispatch an undo action to undo the changes in the client state\n * return null;\n * }\n * });\n *\n * constructor(private s: DataPersistence<TodosState>, private backend: Backend) {}\n * }\n * ```\n *\n * With this setup, the requests for Todo 1 will run concurrently with the requests for Todo 2.\n *\n * In addition, if DataPersistence notices that there are multiple requests for Todo 1 scheduled,\n * it will only run the last one.\n */\n fetch<A extends Action = Action>(\n actionType: string | ActionCreator,\n opts: FetchOpts<[T], A>\n ): Observable<any> {\n return this.actions.pipe(\n ofType<A>(actionType),\n withLatestFrom(this.store),\n fetch(opts)\n );\n }\n\n /**\n * @whatItDoes Handles data fetching as part of router navigation.\n *\n * Data fetching implemented naively suffers from race conditions and poor error handling.\n *\n * `navigation` addresses these problems.\n *\n * It checks if an activated router state contains the passed in component type, and, if it does, runs the `run`\n * callback. It provides the activated snapshot associated with the component and the current state. And it only runs\n * the last request.\n *\n * ## Example:\n *\n * ```typescript\n * @Injectable()\n * class TodoEffects {\n * @Effect() loadTodo = this.s.navigation(TodoComponent, {\n * run: (a, state) => {\n * return this.backend.fetchTodo(a.params['id']).map(todo => ({\n * type: 'TODO_LOADED',\n * payload: todo\n * }));\n * },\n * onError: (a, e: any) => {\n * // we can log and error here and return null\n * // we can also navigate back\n * return null;\n * }\n * });\n * constructor(private s: DataPersistence<TodosState>, private backend: Backend) {}\n * }\n * ```\n */\n navigation(\n component: Type<any>,\n opts: HandleNavigationOpts<[T]>\n ): Observable<any> {\n return this.actions.pipe(\n withLatestFrom(this.store),\n navigation(component, opts)\n );\n }\n}\n\nfunction findSnapshot(\n component: Type<any>,\n s: ActivatedRouteSnapshot\n): ActivatedRouteSnapshot {\n if (s.routeConfig && s.routeConfig.component === component) {\n return s;\n }\n for (const c of s.children) {\n const ss = findSnapshot(component, c);\n if (ss) {\n return ss;\n }\n }\n return null;\n}\n\nfunction wrapIntoObservable<O>(obj: Observable<O> | O | void): Observable<O> {\n if (isObservable(obj)) {\n return obj;\n } else if (!obj) {\n return of();\n } else {\n return of(obj as O);\n }\n}\n","import { ModuleWithProviders, NgModule } from '@angular/core';\nimport { DataPersistence } from './data-persistence';\n\n/**\n * @whatItDoes Provides services for enterprise Angular applications.\n *\n * See {@link DataPersistence} for more information.\n */\n@NgModule({})\nexport class NxModule {\n static forRoot(): ModuleWithProviders<NxModule> {\n return { ngModule: NxModule, providers: [DataPersistence] };\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;SA+DgB,iBAAiB,CAC/B,IAAiC;IAEjC,OAAO,CAAC,MAAgC;QACtC,OAAO,MAAM,CAAC,IAAI,CAChB,iBAAiB,EAAE,EACnB,SAAS,CAAC,oBAAoB,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC,CACxD,CAAC;KACH,CAAC;AACJ,CAAC;SAEe,gBAAgB,CAC9B,IAAgC;IAEhC,OAAO,CAAC,MAAgC;QACtC,OAAO,MAAM,CAAC,IAAI,CAChB,iBAAiB,EAAE,EACnB,SAAS,CAAC,oBAAoB,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC,CAC3D,CAAC;KACH,CAAC;AACJ,CAAC;SAEe,KAAK,CACnB,IAAqB;IAErB,OAAO,CAAC,MAAgC;QACtC,IAAI,IAAI,CAAC,EAAE,EAAE;YACX,MAAM,cAAc,GAAG,MAAM,CAAC,IAAI,CAChC,iBAAiB,EAAE,EACnB,OAAO,CAAC,CAAC,CAAC,MAAM,EAAE,GAAG,KAAK,CAAC;gBACzB,OAAO,IAAI,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,KAAK,CAAC,CAAC;aAClC,CAAC,CACH,CAAC;YAEF,OAAO,cAAc,CAAC,IAAI,CACxB,QAAQ,CAAC,CAAC,KAAK,KACb,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,oBAAoB,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CACpE,CACF,CAAC;SACH;QAED,OAAO,MAAM,CAAC,IAAI,CAChB,iBAAiB,EAAE,EACnB,SAAS,CAAC,o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ACrB;AACH;;ACrcA;;;;;MAMa,QAAQ;IACnB,OAAO,OAAO;QACZ,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC,eAAe,CAAC,EAAE,CAAC;KAC7D;;qGAHU,QAAQ;sGAAR,QAAQ;sGAAR,QAAQ;2FAAR,QAAQ;kBADpB,QAAQ;mBAAC,EAAE;;;ACRZ;;;;;;"}
1
+ {"version":3,"file":"nrwl-angular.mjs","sources":["../../src/runtime/nx/data-persistence.ts","../../src/runtime/nx/nx.module.ts","../../nrwl-angular.ts"],"sourcesContent":["import { Injectable, Type } from '@angular/core';\nimport { ActivatedRouteSnapshot, RouterStateSnapshot } from '@angular/router';\nimport { Actions, ofType } from '@ngrx/effects';\nimport { ROUTER_NAVIGATION, RouterNavigationAction } from '@ngrx/router-store';\nimport { Action, Store, ActionCreator } from '@ngrx/store';\nimport { isObservable, Observable, of } from 'rxjs';\nimport {\n catchError,\n concatMap,\n filter,\n groupBy,\n map,\n mergeMap,\n switchMap,\n withLatestFrom,\n} from 'rxjs/operators';\n\n/**\n * See {@link DataPersistence.pessimisticUpdate} for more information.\n */\nexport interface PessimisticUpdateOpts<T extends Array<unknown>, A> {\n run(a: A, ...slices: [...T]): Observable<Action> | Action | void;\n onError(a: A, e: any): Observable<any> | any;\n}\n/**\n * See {@link DataPersistence.pessimisticUpdate} for more information.\n */\nexport interface OptimisticUpdateOpts<T extends Array<unknown>, A> {\n run(a: A, ...slices: [...T]): Observable<Action> | Action | void;\n undoAction(a: A, e: any): Observable<Action> | Action;\n}\n\n/**\n * See {@link DataPersistence.fetch} for more information.\n */\nexport interface FetchOpts<T extends Array<unknown>, A> {\n id?(a: A, ...slices: [...T]): any;\n run(a: A, ...slices: [...T]): Observable<Action> | Action | void;\n onError?(a: A, e: any): Observable<any> | any;\n}\n\n/**\n * See {@link DataPersistence.navigation} for more information.\n */\nexport interface HandleNavigationOpts<T extends Array<unknown>> {\n run(\n a: ActivatedRouteSnapshot,\n ...slices: [...T]\n ): Observable<Action> | Action | void;\n onError?(a: ActivatedRouteSnapshot, e: any): Observable<any> | any;\n}\n\nexport type ActionOrActionWithStates<T extends Array<unknown>, A> =\n | A\n | [A, ...T];\nexport type ActionOrActionWithState<T, A> = ActionOrActionWithStates<[T], A>;\nexport type ActionStatesStream<T extends Array<unknown>, A> = Observable<\n ActionOrActionWithStates<T, A>\n>;\nexport type ActionStateStream<T, A> = Observable<\n ActionOrActionWithStates<[T], A>\n>;\n\nexport function pessimisticUpdate<T extends Array<unknown>, A extends Action>(\n opts: PessimisticUpdateOpts<T, A>\n) {\n return (source: ActionStatesStream<T, A>): Observable<Action> => {\n return source.pipe(\n mapActionAndState(),\n concatMap(runWithErrorHandling(opts.run, opts.onError))\n );\n };\n}\n\nexport function optimisticUpdate<T extends Array<unknown>, A extends Action>(\n opts: OptimisticUpdateOpts<T, A>\n) {\n return (source: ActionStatesStream<T, A>): Observable<Action> => {\n return source.pipe(\n mapActionAndState(),\n concatMap(runWithErrorHandling(opts.run, opts.undoAction))\n );\n };\n}\n\nexport function fetch<T extends Array<unknown>, A extends Action>(\n opts: FetchOpts<T, A>\n) {\n return (source: ActionStatesStream<T, A>): Observable<Action> => {\n if (opts.id) {\n const groupedFetches = source.pipe(\n mapActionAndState(),\n groupBy(([action, ...store]) => {\n return opts.id(action, ...store);\n })\n );\n\n return groupedFetches.pipe(\n mergeMap((pairs) =>\n pairs.pipe(switchMap(runWithErrorHandling(opts.run, opts.onError)))\n )\n );\n }\n\n return source.pipe(\n mapActionAndState(),\n concatMap(runWithErrorHandling(opts.run, opts.onError))\n );\n };\n}\n\nexport function navigation<T extends Array<unknown>, A extends Action>(\n component: Type<any>,\n opts: HandleNavigationOpts<T>\n) {\n return (source: ActionStatesStream<T, A>) => {\n const nav = source.pipe(\n mapActionAndState(),\n filter(([action]) => isStateSnapshot(action)),\n map(([action, ...slices]) => {\n if (!isStateSnapshot(action)) {\n // Because of the above filter we'll never get here,\n // but this properly type narrows `action`\n return;\n }\n\n return [\n findSnapshot(component, action.payload.routerState.root),\n ...slices,\n ] as [ActivatedRouteSnapshot, ...T];\n }),\n filter(([snapshot]) => !!snapshot)\n );\n\n return nav.pipe(switchMap(runWithErrorHandling(opts.run, opts.onError)));\n };\n}\n\nfunction isStateSnapshot(\n action: any\n): action is RouterNavigationAction<RouterStateSnapshot> {\n return action.type === ROUTER_NAVIGATION;\n}\n\nfunction runWithErrorHandling<T extends Array<unknown>, A, R>(\n run: (a: A, ...slices: [...T]) => Observable<R> | R | void,\n onError: any\n) {\n return ([action, ...slices]: [A, ...T]): Observable<R> => {\n try {\n const r = wrapIntoObservable(run(action, ...slices));\n return r.pipe(catchError((e) => wrapIntoObservable(onError(action, e))));\n } catch (e) {\n return wrapIntoObservable(onError(action, e));\n }\n };\n}\n\n/**\n * @whatItDoes maps Observable<Action | [Action, State]> to\n * Observable<[Action, State]>\n */\nfunction mapActionAndState<T extends Array<unknown>, A>() {\n return (source: Observable<ActionOrActionWithStates<T, A>>) => {\n return source.pipe(\n map((value) => normalizeActionAndState(value) as [A, ...T])\n );\n };\n}\n\n/**\n * @whatItDoes Normalizes either a bare action or an array of action and slices\n * into an array of action and slices (or undefined)\n */\nfunction normalizeActionAndState<T extends Array<unknown>, A>(\n args: ActionOrActionWithStates<T, A>\n): [A, ...T] {\n let action: A, slices: T;\n\n if (args instanceof Array) {\n [action, ...slices] = args;\n } else {\n slices = [] as T;\n action = args;\n }\n\n return [action, ...slices];\n}\n\n/**\n * @whatItDoes Provides convenience methods for implementing common operations of persisting data.\n */\n@Injectable()\nexport class DataPersistence<T> {\n constructor(public store: Store<T>, public actions: Actions) {}\n\n /**\n *\n * @whatItDoes Handles pessimistic updates (updating the server first).\n *\n * Update the server implemented naively suffers from race conditions and poor error handling.\n *\n * `pessimisticUpdate` addresses these problems--it runs all fetches in order, which removes race conditions\n * and forces the developer to handle errors.\n *\n * ## Example:\n *\n * ```typescript\n * @Injectable()\n * class TodoEffects {\n * @Effect() updateTodo = this.s.pessimisticUpdate<UpdateTodo>('UPDATE_TODO', {\n * // provides an action and the current state of the store\n * run(a, state) {\n * // update the backend first, and then dispatch an action that will\n * // update the client side\n * return this.backend(state.user, a.payload).map(updated => ({\n * type: 'TODO_UPDATED',\n * payload: updated\n * }));\n * },\n *\n * onError(a, e: any) {\n * // we don't need to undo the changes on the client side.\n * // we can dispatch an error, or simply log the error here and return `null`\n * return null;\n * }\n * });\n *\n * constructor(private s: DataPersistence<TodosState>, private backend: Backend) {}\n * }\n * ```\n *\n * Note that if you don't return a new action from the run callback, you must set the dispatch property\n * of the effect to false, like this:\n *\n * ```\n * class TodoEffects {\n * @Effect({dispatch: false})\n * updateTodo; //...\n * }\n * ```\n */\n pessimisticUpdate<A extends Action = Action>(\n actionType: string | ActionCreator,\n opts: PessimisticUpdateOpts<[T], A>\n ): Observable<any> {\n return this.actions.pipe(\n ofType<A>(actionType),\n withLatestFrom(this.store),\n pessimisticUpdate(opts)\n );\n }\n\n /**\n *\n * @whatItDoes Handles optimistic updates (updating the client first).\n *\n * `optimisticUpdate` addresses these problems--it runs all fetches in order, which removes race conditions\n * and forces the developer to handle errors.\n *\n * `optimisticUpdate` is different from `pessimisticUpdate`. In case of a failure, when using `optimisticUpdate`,\n * the developer already updated the state locally, so the developer must provide an undo action.\n *\n * The error handling must be done in the callback, or by means of the undo action.\n *\n * ## Example:\n *\n * ```typescript\n * @Injectable()\n * class TodoEffects {\n * @Effect() updateTodo = this.s.optimisticUpdate<UpdateTodo>('UPDATE_TODO', {\n * // provides an action and the current state of the store\n * run: (a, state) => {\n * return this.backend(state.user, a.payload);\n * },\n *\n * undoAction: (a, e: any) => {\n * // dispatch an undo action to undo the changes in the client state\n * return ({\n * type: 'UNDO_UPDATE_TODO',\n * payload: a\n * });\n * }\n * });\n *\n * constructor(private s: DataPersistence<TodosState>, private backend: Backend) {}\n * }\n * ```\n *\n * Note that if you don't return a new action from the run callback, you must set the dispatch property\n * of the effect to false, like this:\n *\n * ```\n * class TodoEffects {\n * @Effect({dispatch: false})\n * updateTodo; //...\n * }\n * ```\n */\n optimisticUpdate<A extends Action = Action>(\n actionType: string | ActionCreator,\n opts: OptimisticUpdateOpts<[T], A>\n ): Observable<any> {\n return this.actions.pipe(\n ofType<A>(actionType),\n withLatestFrom(this.store),\n optimisticUpdate(opts)\n );\n }\n\n /**\n *\n * @whatItDoes Handles data fetching.\n *\n * Data fetching implemented naively suffers from race conditions and poor error handling.\n *\n * `fetch` addresses these problems--it runs all fetches in order, which removes race conditions\n * and forces the developer to handle errors.\n *\n * ## Example:\n *\n * ```typescript\n * @Injectable()\n * class TodoEffects {\n * @Effect() loadTodos = this.s.fetch<GetTodos>('GET_TODOS', {\n * // provides an action and the current state of the store\n * run: (a, state) => {\n * return this.backend(state.user, a.payload).map(r => ({\n * type: 'TODOS',\n * payload: r\n * });\n * },\n *\n * onError: (a, e: any) => {\n * // dispatch an undo action to undo the changes in the client state\n * }\n * });\n *\n * constructor(private s: DataPersistence<TodosState>, private backend: Backend) {}\n * }\n * ```\n *\n * This is correct, but because it set the concurrency to 1, it may not be performant.\n *\n * To fix that, you can provide the `id` function, like this:\n *\n * ```typescript\n * @Injectable()\n * class TodoEffects {\n * @Effect() loadTodo = this.s.fetch<GetTodo>('GET_TODO', {\n * id: (a, state) => {\n * return a.payload.id;\n * }\n *\n * // provides an action and the current state of the store\n * run: (a, state) => {\n * return this.backend(state.user, a.payload).map(r => ({\n * type: 'TODO',\n * payload: r\n * });\n * },\n *\n * onError: (a, e: any) => {\n * // dispatch an undo action to undo the changes in the client state\n * return null;\n * }\n * });\n *\n * constructor(private s: DataPersistence<TodosState>, private backend: Backend) {}\n * }\n * ```\n *\n * With this setup, the requests for Todo 1 will run concurrently with the requests for Todo 2.\n *\n * In addition, if DataPersistence notices that there are multiple requests for Todo 1 scheduled,\n * it will only run the last one.\n */\n fetch<A extends Action = Action>(\n actionType: string | ActionCreator,\n opts: FetchOpts<[T], A>\n ): Observable<any> {\n return this.actions.pipe(\n ofType<A>(actionType),\n withLatestFrom(this.store),\n fetch(opts)\n );\n }\n\n /**\n * @whatItDoes Handles data fetching as part of router navigation.\n *\n * Data fetching implemented naively suffers from race conditions and poor error handling.\n *\n * `navigation` addresses these problems.\n *\n * It checks if an activated router state contains the passed in component type, and, if it does, runs the `run`\n * callback. It provides the activated snapshot associated with the component and the current state. And it only runs\n * the last request.\n *\n * ## Example:\n *\n * ```typescript\n * @Injectable()\n * class TodoEffects {\n * @Effect() loadTodo = this.s.navigation(TodoComponent, {\n * run: (a, state) => {\n * return this.backend.fetchTodo(a.params['id']).map(todo => ({\n * type: 'TODO_LOADED',\n * payload: todo\n * }));\n * },\n * onError: (a, e: any) => {\n * // we can log and error here and return null\n * // we can also navigate back\n * return null;\n * }\n * });\n * constructor(private s: DataPersistence<TodosState>, private backend: Backend) {}\n * }\n * ```\n */\n navigation(\n component: Type<any>,\n opts: HandleNavigationOpts<[T]>\n ): Observable<any> {\n return this.actions.pipe(\n withLatestFrom(this.store),\n navigation(component, opts)\n );\n }\n}\n\nfunction findSnapshot(\n component: Type<any>,\n s: ActivatedRouteSnapshot\n): ActivatedRouteSnapshot {\n if (s.routeConfig && s.routeConfig.component === component) {\n return s;\n }\n for (const c of s.children) {\n const ss = findSnapshot(component, c);\n if (ss) {\n return ss;\n }\n }\n return null;\n}\n\nfunction wrapIntoObservable<O>(obj: Observable<O> | O | void): Observable<O> {\n if (isObservable(obj)) {\n return obj;\n } else if (!obj) {\n return of();\n } else {\n return of(obj as O);\n }\n}\n","import { ModuleWithProviders, NgModule } from '@angular/core';\nimport { DataPersistence } from './data-persistence';\n\n/**\n * @whatItDoes Provides services for enterprise Angular applications.\n *\n * See {@link DataPersistence} for more information.\n */\n@NgModule({})\nexport class NxModule {\n static forRoot(): ModuleWithProviders<NxModule> {\n return { ngModule: NxModule, providers: [DataPersistence] };\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;AA+DM,SAA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KAAA;AACD,IAAA,KAAK,MAAM,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE;QAC1B,MAAM,EAAE,GAAG,YAAY,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC;AACtC,QAAA,IAAI,EAAE,EAAE;AACN,YAAA,OAAO,EAAE,CAAC;AACX,SAAA;AACF,KAAA;AACD,IAAA,OAAO,IAAI,CAAC;AACd,CAAC;AAED,SAAS,kBAAkB,CAAI,GAA6B,EAAA;AAC1D,IAAA,IAAI,YAAY,CAAC,GAAG,CAAC,EAAE;AACrB,QAAA,OAAO,GAAG,CAAC;AACZ,KAAA;SAAM,IAAI,CAAC,GAAG,EAAE;QACf,OAAO,EAAE,EAAE,CAAC;AACb,KAAA;AAAM,SAAA;AACL,QAAA,OAAO,EAAE,CAAC,GAAQ,CAAC,CAAC;AACrB,KAAA;AACH;;ACrcA;;;;AAIG;MAEU,QAAQ,CAAA;AACnB,IAAA,OAAO,OAAO,GAAA;QACZ,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC,eAAe,CAAC,EAAE,CAAC;KAC7D;;qGAHU,QAAQ,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA,CAAA;sGAAR,QAAQ,EAAA,CAAA,CAAA;sGAAR,QAAQ,EAAA,CAAA,CAAA;2FAAR,QAAQ,EAAA,UAAA,EAAA,CAAA;kBADpB,QAAQ;mBAAC,EAAE,CAAA;;;ACRZ;;AAEG;;;;"}
package/generators.json CHANGED
@@ -30,8 +30,7 @@
30
30
  "component-story": {
31
31
  "factory": "./src/generators/component-story/compat",
32
32
  "schema": "./src/generators/component-story/schema.json",
33
- "description": "Creates a stories.ts file for a component.",
34
- "hidden": true
33
+ "description": "Creates a `stories.ts` file for a component."
35
34
  },
36
35
  "convert-tslint-to-eslint": {
37
36
  "factory": "./src/generators/convert-tslint-to-eslint/convert-tslint-to-eslint#conversionSchematic",
@@ -46,7 +45,7 @@
46
45
  "init": {
47
46
  "factory": "./src/generators/init/init.compat#initSchematic",
48
47
  "schema": "./src/generators/init/schema.json",
49
- "description": "Initializes the @nrwl/angular plugin.",
48
+ "description": "Initializes the `@nrwl/angular` plugin.",
50
49
  "hidden": true
51
50
  },
52
51
  "karma": {
@@ -87,7 +86,7 @@
87
86
  "convert-to-with-mf": {
88
87
  "factory": "./src/generators/convert-to-with-mf/convert-to-with-mf.compat",
89
88
  "schema": "./src/generators/convert-to-with-mf/schema.json",
90
- "description": "Converts an old micro frontend configuration to use the new withModuleFederation helper. It will run successfully if the following conditions are met: \n - Is either a host or remote application \n - Shared npm package configurations have not been modified \n - Name used to identify the Micro Frontend application matches the project name \n\n _**Note:** This generator will overwrite your webpack config. If you have additional custom configuration in your config file, it will be lost!_"
89
+ "description": "Converts an old micro frontend configuration to use the new `withModuleFederation` helper. It will run successfully if the following conditions are met: \n - Is either a host or remote application \n - Shared npm package configurations have not been modified \n - Name used to identify the Micro Frontend application matches the project name \n\n _**Note:** This generator will overwrite your webpack config. If you have additional custom configuration in your config file, it will be lost!_"
91
90
  },
92
91
  "mfe-host": {
93
92
  "factory": "./src/generators/mfe-host/mfe-host.compat",
@@ -144,12 +143,12 @@
144
143
  "storybook-migrate-defaults-5-to-6": {
145
144
  "factory": "./src/generators/storybook-migrate-defaults-5-to-6/compat",
146
145
  "schema": "./src/generators/storybook-migrate-defaults-5-to-6/schema.json",
147
- "description": "Generates default Storybook configuration files using Storybook version >=6.x specs, for projects that already have Storybook instances and configurations of versions <6.x."
146
+ "description": "Generates default Storybook configuration files using Storybook version `>=6.x` specs, for projects that already have Storybook instances and configurations of versions `<6.x`."
148
147
  },
149
148
  "storybook-migrate-stories-to-6-2": {
150
149
  "factory": "./src/generators/storybook-migrate-stories-to-6-2/compat",
151
150
  "schema": "./src/generators/storybook-migrate-stories-to-6-2/schema.json",
152
- "description": "Migrates stories to match the new syntax in v6.2 where the component declaration should be in the default export."
151
+ "description": "Migrates stories to match the new syntax in `v6.2` where the component declaration should be in the default export."
153
152
  },
154
153
  "upgrade-module": {
155
154
  "factory": "./src/generators/upgrade-module/compat",
@@ -190,8 +189,7 @@
190
189
  "component-story": {
191
190
  "factory": "./src/generators/component-story/component-story",
192
191
  "schema": "./src/generators/component-story/schema.json",
193
- "description": "Creates a stories.ts file for a component.",
194
- "hidden": true
192
+ "description": "Creates a stories.ts file for a component."
195
193
  },
196
194
  "convert-tslint-to-eslint": {
197
195
  "factory": "./src/generators/convert-tslint-to-eslint/convert-tslint-to-eslint#conversionGenerator",
@@ -206,7 +204,7 @@
206
204
  "init": {
207
205
  "factory": "./src/generators/init/init",
208
206
  "schema": "./src/generators/init/schema.json",
209
- "description": "Initializes the @nrwl/angular plugin.",
207
+ "description": "Initializes the `@nrwl/angular` plugin.",
210
208
  "hidden": true
211
209
  },
212
210
  "karma": {
@@ -304,12 +302,12 @@
304
302
  "storybook-migrate-defaults-5-to-6": {
305
303
  "factory": "./src/generators/storybook-migrate-defaults-5-to-6/storybook-migrate-defaults-5-to-6",
306
304
  "schema": "./src/generators/storybook-migrate-defaults-5-to-6/schema.json",
307
- "description": "Generates default Storybook configuration files using Storybook version >=6.x specs, for projects that already have Storybook instances and configurations of versions <6.x."
305
+ "description": "Generates default Storybook configuration files using Storybook version `>=6.x` specs, for projects that already have Storybook instances and configurations of versions `<6.x`."
308
306
  },
309
307
  "storybook-migrate-stories-to-6-2": {
310
308
  "factory": "./src/generators/storybook-migrate-stories-to-6-2/migrate-stories-to-6-2",
311
309
  "schema": "./src/generators/storybook-migrate-stories-to-6-2/schema.json",
312
- "description": "Migrates stories to match the new syntax in v6.2 where the component declaration should be in the default export."
310
+ "description": "Migrates stories to match the new syntax in `v6.2` where the component declaration should be in the default export."
313
311
  },
314
312
  "upgrade-module": {
315
313
  "factory": "./src/generators/upgrade-module/upgrade-module",
package/mfe/index.d.ts CHANGED
@@ -1 +1 @@
1
- export { setRemoteUrlResolver, loadRemoteModule } from './mfe';
1
+ export { setRemoteUrlResolver, setRemoteDefinitions, loadRemoteModule, } from './mfe';
package/mfe/index.js CHANGED
@@ -1,7 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.loadRemoteModule = exports.setRemoteUrlResolver = void 0;
3
+ exports.loadRemoteModule = exports.setRemoteDefinitions = exports.setRemoteUrlResolver = void 0;
4
4
  var mfe_1 = require("./mfe");
5
5
  Object.defineProperty(exports, "setRemoteUrlResolver", { enumerable: true, get: function () { return mfe_1.setRemoteUrlResolver; } });
6
+ Object.defineProperty(exports, "setRemoteDefinitions", { enumerable: true, get: function () { return mfe_1.setRemoteDefinitions; } });
6
7
  Object.defineProperty(exports, "loadRemoteModule", { enumerable: true, get: function () { return mfe_1.loadRemoteModule; } });
7
8
  //# sourceMappingURL=index.js.map
package/mfe/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../packages/angular/mfe/index.ts"],"names":[],"mappings":";;;AAAA,6BAA+D;AAAtD,2GAAA,oBAAoB,OAAA;AAAE,uGAAA,gBAAgB,OAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../packages/angular/mfe/index.ts"],"names":[],"mappings":";;;AAAA,6BAIe;AAHb,2GAAA,oBAAoB,OAAA;AACpB,2GAAA,oBAAoB,OAAA;AACpB,uGAAA,gBAAgB,OAAA"}