@storybook/angular 6.5.9 → 7.0.0-alpha.2

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 (268) hide show
  1. package/dist/{ts3.9 → types}/builders/build-storybook/index.d.ts +1 -1
  2. package/dist/types/builders/build-storybook/index.js +58 -0
  3. package/dist/{ts3.9 → types}/builders/build-storybook/schema.json +0 -0
  4. package/dist/{ts3.9 → types}/builders/builders.json +0 -0
  5. package/dist/{ts3.9 → types}/builders/start-storybook/index.d.ts +1 -1
  6. package/dist/types/builders/start-storybook/index.js +66 -0
  7. package/dist/{ts3.9 → types}/builders/start-storybook/schema.json +0 -0
  8. package/dist/{ts3.9 → types}/builders/utils/build-standalone-errors-handler.d.ts +0 -0
  9. package/dist/{ts3.9 → types}/builders/utils/build-standalone-errors-handler.js +5 -5
  10. package/dist/{ts3.9 → types}/builders/utils/run-compodoc.d.ts +0 -0
  11. package/dist/{ts3.9 → types}/builders/utils/run-compodoc.js +9 -4
  12. package/dist/{ts3.9 → types}/client/docs/compodoc.d.ts +0 -0
  13. package/dist/{ts3.9 → types}/client/docs/compodoc.js +47 -34
  14. package/dist/{ts3.9 → types}/client/docs/config.d.ts +2 -3
  15. package/dist/{ts3.9 → types}/client/docs/config.js +0 -2
  16. package/dist/{ts3.9 → types}/client/docs/index.d.ts +0 -0
  17. package/dist/{ts3.9 → types}/client/docs/index.js +6 -2
  18. package/dist/{ts3.9 → types}/client/docs/sourceDecorator.d.ts +0 -0
  19. package/dist/{ts3.9 → types}/client/docs/sourceDecorator.js +10 -9
  20. package/dist/{ts3.9 → types}/client/docs/types.d.ts +0 -0
  21. package/dist/{ts3.9 → types}/client/docs/types.js +0 -0
  22. package/dist/{ts3.9 → types}/client/index.d.ts +0 -0
  23. package/dist/{ts3.9 → types}/client/index.js +9 -5
  24. package/dist/{ts3.9 → types}/client/preview/angular/app.token.d.ts +0 -0
  25. package/dist/{ts3.9 → types}/client/preview/angular/app.token.js +0 -0
  26. package/dist/{ts3.9 → types}/client/preview/angular/components/app.component.d.ts +0 -0
  27. package/dist/{ts3.9 → types}/client/preview/angular/components/app.component.js +4 -4
  28. package/dist/{ts3.9 → types}/client/preview/angular/helpers.d.ts +0 -0
  29. package/dist/{ts3.9 → types}/client/preview/angular/helpers.js +6 -6
  30. package/dist/{ts3.9 → types}/client/preview/angular-beta/AbstractRenderer.d.ts +0 -0
  31. package/dist/{ts3.9 → types}/client/preview/angular-beta/AbstractRenderer.js +40 -48
  32. package/dist/{ts3.9 → types}/client/preview/angular-beta/CanvasRenderer.d.ts +0 -0
  33. package/dist/types/client/preview/angular-beta/CanvasRenderer.js +16 -0
  34. package/dist/{ts3.9 → types}/client/preview/angular-beta/ComputesTemplateFromComponent.d.ts +0 -0
  35. package/dist/{ts3.9 → types}/client/preview/angular-beta/ComputesTemplateFromComponent.js +10 -8
  36. package/dist/{ts3.9 → types}/client/preview/angular-beta/DocsRenderer.d.ts +0 -0
  37. package/dist/types/client/preview/angular-beta/DocsRenderer.js +41 -0
  38. package/dist/{ts3.9 → types}/client/preview/angular-beta/RendererFactory.d.ts +0 -0
  39. package/dist/types/client/preview/angular-beta/RendererFactory.js +55 -0
  40. package/dist/{ts3.9 → types}/client/preview/angular-beta/StorybookModule.d.ts +0 -0
  41. package/dist/{ts3.9 → types}/client/preview/angular-beta/StorybookModule.js +17 -16
  42. package/dist/{ts3.9 → types}/client/preview/angular-beta/StorybookProvider.d.ts +0 -0
  43. package/dist/{ts3.9 → types}/client/preview/angular-beta/StorybookProvider.js +2 -1
  44. package/dist/{ts3.9 → types}/client/preview/angular-beta/StorybookWrapperComponent.d.ts +0 -0
  45. package/dist/{ts3.9 → types}/client/preview/angular-beta/StorybookWrapperComponent.js +11 -10
  46. package/dist/{ts3.9 → types}/client/preview/angular-beta/utils/NgComponentAnalyzer.d.ts +0 -0
  47. package/dist/{ts3.9 → types}/client/preview/angular-beta/utils/NgComponentAnalyzer.js +24 -13
  48. package/dist/{ts3.9 → types}/client/preview/angular-beta/utils/NgModulesAnalyzer.d.ts +0 -0
  49. package/dist/{ts3.9 → types}/client/preview/angular-beta/utils/NgModulesAnalyzer.js +3 -2
  50. package/dist/{ts3.9 → types}/client/preview/angular-polyfills.d.ts +0 -0
  51. package/dist/{ts3.9 → types}/client/preview/angular-polyfills.js +0 -0
  52. package/dist/{ts3.9 → types}/client/preview/config.d.ts +0 -0
  53. package/dist/{ts3.9 → types}/client/preview/config.js +1 -1
  54. package/dist/{ts3.9 → types}/client/preview/decorateStory.d.ts +0 -0
  55. package/dist/{ts3.9 → types}/client/preview/decorateStory.js +11 -6
  56. package/dist/{ts3.9 → types}/client/preview/decorators.d.ts +0 -0
  57. package/dist/{ts3.9 → types}/client/preview/decorators.js +23 -11
  58. package/dist/{ts3.9 → types}/client/preview/globals.d.ts +0 -0
  59. package/dist/{ts3.9 → types}/client/preview/globals.js +0 -0
  60. package/dist/{ts3.9 → types}/client/preview/index.d.ts +0 -0
  61. package/dist/{ts3.9 → types}/client/preview/index.js +6 -4
  62. package/dist/{ts3.9 → types}/client/preview/render.d.ts +0 -0
  63. package/dist/types/client/preview/render.js +24 -0
  64. package/dist/{ts3.9 → types}/client/preview/types-6-0.d.ts +0 -0
  65. package/dist/{ts3.9 → types}/client/preview/types-6-0.js +0 -0
  66. package/dist/{ts3.9 → types}/client/preview/types-7-0.d.ts +0 -0
  67. package/dist/{ts3.9 → types}/client/preview/types-7-0.js +0 -0
  68. package/dist/{ts3.9 → types}/client/preview/types.d.ts +0 -0
  69. package/dist/{ts3.9 → types}/client/preview/types.js +0 -0
  70. package/dist/{ts3.4/public_api.d.ts → types/index.d.ts} +2 -1
  71. package/dist/{ts3.9/public_api.js → types/index.js} +7 -2
  72. package/dist/types/preset.d.ts +13 -0
  73. package/dist/types/preset.js +32 -0
  74. package/dist/{ts3.9 → types}/renderer.d.ts +0 -0
  75. package/dist/{ts3.9 → types}/renderer.js +1 -0
  76. package/dist/{ts3.9 → types}/server/__mocks-ng-workspace__/empty-projects-entry/angular.json +0 -0
  77. package/dist/{ts3.9 → types}/server/__mocks-ng-workspace__/minimal-config/angular.json +0 -0
  78. package/dist/{ts3.9 → types}/server/__mocks-ng-workspace__/minimal-config/src/main.d.ts +0 -0
  79. package/dist/{ts3.9 → types}/server/__mocks-ng-workspace__/minimal-config/src/main.js +0 -0
  80. package/dist/{ts3.9 → types}/server/__mocks-ng-workspace__/minimal-config/src/tsconfig.app.json +0 -0
  81. package/dist/{ts3.9 → types}/server/__mocks-ng-workspace__/minimal-config/tsconfig.json +0 -0
  82. package/dist/{ts3.9 → types}/server/__mocks-ng-workspace__/some-config/angular.json +0 -0
  83. package/dist/{ts3.9 → types}/server/__mocks-ng-workspace__/some-config/src/main.d.ts +0 -0
  84. package/dist/{ts3.9 → types}/server/__mocks-ng-workspace__/some-config/src/main.js +0 -0
  85. package/dist/{ts3.9 → types}/server/__mocks-ng-workspace__/some-config/src/tsconfig.app.json +0 -0
  86. package/dist/{ts3.9 → types}/server/__mocks-ng-workspace__/some-config/tsconfig.json +0 -0
  87. package/dist/{ts3.9 → types}/server/__mocks-ng-workspace__/with-angularBrowserTarget/angular.json +0 -0
  88. package/dist/{ts3.9 → types}/server/__mocks-ng-workspace__/with-angularBrowserTarget/src/main.d.ts +0 -0
  89. package/dist/{ts3.9 → types}/server/__mocks-ng-workspace__/with-angularBrowserTarget/src/main.js +0 -0
  90. package/dist/{ts3.9 → types}/server/__mocks-ng-workspace__/with-angularBrowserTarget/src/tsconfig.app.json +0 -0
  91. package/dist/{ts3.9 → types}/server/__mocks-ng-workspace__/with-angularBrowserTarget/tsconfig.json +0 -0
  92. package/dist/{ts3.9 → types}/server/__mocks-ng-workspace__/with-lib/angular.json +0 -0
  93. package/dist/{ts3.9 → types}/server/__mocks-ng-workspace__/with-lib/projects/pattern-lib/src/main.d.ts +0 -0
  94. package/dist/{ts3.9 → types}/server/__mocks-ng-workspace__/with-lib/projects/pattern-lib/src/main.js +0 -0
  95. package/dist/{ts3.9 → types}/server/__mocks-ng-workspace__/with-lib/projects/pattern-lib/tsconfig.lib.json +0 -0
  96. package/dist/{ts3.9 → types}/server/__mocks-ng-workspace__/with-lib/tsconfig.json +0 -0
  97. package/dist/{ts3.9 → types}/server/__mocks-ng-workspace__/with-nx/angular.json +0 -0
  98. package/dist/{ts3.9 → types}/server/__mocks-ng-workspace__/with-nx/nx.json +0 -0
  99. package/dist/{ts3.9 → types}/server/__mocks-ng-workspace__/with-nx/src/main.d.ts +0 -0
  100. package/dist/{ts3.9 → types}/server/__mocks-ng-workspace__/with-nx/src/main.js +0 -0
  101. package/dist/{ts3.9 → types}/server/__mocks-ng-workspace__/with-nx/src/tsconfig.app.json +0 -0
  102. package/dist/{ts3.9 → types}/server/__mocks-ng-workspace__/with-nx/tsconfig.json +0 -0
  103. package/dist/{ts3.9 → types}/server/__mocks-ng-workspace__/with-nx-workspace/nx.json +0 -0
  104. package/dist/{ts3.9 → types}/server/__mocks-ng-workspace__/with-nx-workspace/src/main.d.ts +0 -0
  105. package/dist/{ts3.9 → types}/server/__mocks-ng-workspace__/with-nx-workspace/src/main.js +0 -0
  106. package/dist/{ts3.9 → types}/server/__mocks-ng-workspace__/with-nx-workspace/src/tsconfig.app.json +0 -0
  107. package/dist/{ts3.9 → types}/server/__mocks-ng-workspace__/with-nx-workspace/tsconfig.json +0 -0
  108. package/dist/{ts3.9 → types}/server/__mocks-ng-workspace__/with-nx-workspace/workspace.json +0 -0
  109. package/dist/{ts3.9 → types}/server/__mocks-ng-workspace__/with-options-styles/angular.json +0 -0
  110. package/dist/{ts3.9 → types}/server/__mocks-ng-workspace__/with-options-styles/src/main.d.ts +0 -0
  111. package/dist/{ts3.9 → types}/server/__mocks-ng-workspace__/with-options-styles/src/main.js +0 -0
  112. package/dist/{ts3.9 → types}/server/__mocks-ng-workspace__/with-options-styles/src/tsconfig.app.json +0 -0
  113. package/dist/{ts3.9 → types}/server/__mocks-ng-workspace__/with-options-styles/tsconfig.json +0 -0
  114. package/dist/{ts3.9 → types}/server/__mocks-ng-workspace__/without-architect-build/angular.json +0 -0
  115. package/dist/{ts3.9 → types}/server/__mocks-ng-workspace__/without-architect-build-options/angular.json +0 -0
  116. package/dist/{ts3.9 → types}/server/__mocks-ng-workspace__/without-compatible-projects/angular.json +0 -0
  117. package/dist/{ts3.9 → types}/server/__mocks-ng-workspace__/without-projects-entry/angular.json +0 -0
  118. package/dist/{ts3.9 → types}/server/__mocks-ng-workspace__/without-projects-entry/projects/pattern-lib/src/main.d.ts +0 -0
  119. package/dist/{ts3.9 → types}/server/__mocks-ng-workspace__/without-projects-entry/projects/pattern-lib/src/main.js +0 -0
  120. package/dist/{ts3.9 → types}/server/__mocks-ng-workspace__/without-projects-entry/projects/pattern-lib/tsconfig.lib.json +0 -0
  121. package/dist/{ts3.9 → types}/server/__mocks-ng-workspace__/without-projects-entry/tsconfig.json +0 -0
  122. package/dist/{ts3.9 → types}/server/__mocks-ng-workspace__/without-tsConfig/angular.json +0 -0
  123. package/dist/{ts3.9 → types}/server/__mocks-ng-workspace__/without-tsConfig/src/main.d.ts +0 -0
  124. package/dist/{ts3.9 → types}/server/__mocks-ng-workspace__/without-tsConfig/src/main.js +0 -0
  125. package/dist/{ts3.9 → types}/server/__mocks-ng-workspace__/without-tsConfig/src/tsconfig.app.json +0 -0
  126. package/dist/{ts3.9 → types}/server/__mocks-ng-workspace__/without-tsConfig/tsconfig.json +0 -0
  127. package/dist/{ts3.9 → types}/server/angular-cli-webpack-12.2.x.d.ts +0 -0
  128. package/dist/types/server/angular-cli-webpack-12.2.x.js +66 -0
  129. package/dist/{ts3.9 → types}/server/angular-cli-webpack-13.x.x.d.ts +0 -0
  130. package/dist/types/server/angular-cli-webpack-13.x.x.js +70 -0
  131. package/dist/types/server/angular-cli-webpack-older.d.ts +6 -0
  132. package/dist/types/server/angular-cli-webpack-older.js +111 -0
  133. package/dist/{ts3.9 → types}/server/angular-devkit-build-webpack.d.ts +6 -6
  134. package/dist/{ts3.9 → types}/server/angular-devkit-build-webpack.js +66 -54
  135. package/dist/{ts3.9 → types}/server/angular-read-workspace.d.ts +0 -0
  136. package/dist/{ts3.9 → types}/server/angular-read-workspace.js +8 -14
  137. package/dist/{ts3.9 → types}/server/create-fork-ts-checker-plugin.d.ts +0 -0
  138. package/dist/{ts3.9 → types}/server/create-fork-ts-checker-plugin.js +1 -1
  139. package/dist/{ts3.9 → types}/server/framework-preset-angular-cli.d.ts +1 -1
  140. package/dist/types/server/framework-preset-angular-cli.js +175 -0
  141. package/dist/{ts3.9 → types}/server/framework-preset-angular-docs.d.ts +0 -0
  142. package/dist/{ts3.9 → types}/server/framework-preset-angular-docs.js +4 -3
  143. package/dist/{ts3.9 → types}/server/framework-preset-angular-ivy.d.ts +1 -1
  144. package/dist/{ts3.9 → types}/server/framework-preset-angular-ivy.js +26 -22
  145. package/dist/{ts3.9 → types}/server/framework-preset-angular.d.ts +0 -0
  146. package/dist/types/server/framework-preset-angular.js +103 -0
  147. package/dist/{ts3.9 → types}/server/ngx-template-loader/index.d.ts +0 -0
  148. package/dist/{ts3.9 → types}/server/ngx-template-loader/index.js +0 -0
  149. package/dist/{ts3.9/server/options.d.ts → types/server/preset-options.d.ts} +1 -3
  150. package/dist/{ts3.9/types/index.js → types/server/preset-options.js} +0 -0
  151. package/dist/{ts3.9 → types}/server/ts_config.d.ts +0 -0
  152. package/dist/{ts3.9 → types}/server/ts_config.js +0 -0
  153. package/dist/{ts3.9 → types}/server/utils/filter-out-styling-rules.d.ts +0 -0
  154. package/dist/{ts3.9 → types}/server/utils/filter-out-styling-rules.js +2 -1
  155. package/dist/{ts3.9 → types}/server/utils/module-is-available.d.ts +0 -0
  156. package/dist/{ts3.9 → types}/server/utils/module-is-available.js +2 -1
  157. package/dist/{ts3.4 → types}/server/utils/normalize-asset-patterns.d.ts +7 -6
  158. package/dist/{ts3.9 → types}/server/utils/normalize-asset-patterns.js +9 -9
  159. package/dist/{ts3.9 → types}/server/utils/normalize-optimization.d.ts +1 -1
  160. package/dist/{ts3.9 → types}/server/utils/normalize-optimization.js +3 -2
  161. package/dist/types/types.d.ts +13 -0
  162. package/dist/types/types.js +2 -0
  163. package/jest.config.js +1 -0
  164. package/package.json +47 -56
  165. package/preset.js +1 -1
  166. package/renderer.d.ts +1 -1
  167. package/renderer.js +1 -1
  168. package/standalone.js +2 -3
  169. package/types-6-0.d.ts +1 -1
  170. package/types-7-0.d.ts +1 -1
  171. package/bin/build.js +0 -4
  172. package/bin/index.js +0 -3
  173. package/demo.d.ts +0 -4
  174. package/demo.js +0 -5
  175. package/dist/ts3.4/builders/build-storybook/index.d.ts +0 -15
  176. package/dist/ts3.4/builders/start-storybook/index.d.ts +0 -15
  177. package/dist/ts3.4/builders/utils/build-standalone-errors-handler.d.ts +0 -1
  178. package/dist/ts3.4/builders/utils/run-compodoc.d.ts +0 -6
  179. package/dist/ts3.4/client/docs/compodoc.d.ts +0 -18
  180. package/dist/ts3.4/client/docs/config.d.ts +0 -15
  181. package/dist/ts3.4/client/docs/index.d.ts +0 -1
  182. package/dist/ts3.4/client/docs/prepareForInline.d.ts +0 -7
  183. package/dist/ts3.4/client/docs/sourceDecorator.d.ts +0 -9
  184. package/dist/ts3.4/client/docs/types.d.ts +0 -102
  185. package/dist/ts3.4/client/index.d.ts +0 -4
  186. package/dist/ts3.4/client/preview/angular/app.token.d.ts +0 -3
  187. package/dist/ts3.4/client/preview/angular/components/app.component.d.ts +0 -38
  188. package/dist/ts3.4/client/preview/angular/helpers.d.ts +0 -8
  189. package/dist/ts3.4/client/preview/angular-beta/AbstractRenderer.d.ts +0 -57
  190. package/dist/ts3.4/client/preview/angular-beta/CanvasRenderer.d.ts +0 -14
  191. package/dist/ts3.4/client/preview/angular-beta/ComputesTemplateFromComponent.d.ts +0 -17
  192. package/dist/ts3.4/client/preview/angular-beta/DocsRenderer.d.ts +0 -14
  193. package/dist/ts3.4/client/preview/angular-beta/RendererFactory.d.ts +0 -11
  194. package/dist/ts3.4/client/preview/angular-beta/StorybookModule.d.ts +0 -9
  195. package/dist/ts3.4/client/preview/angular-beta/StorybookProvider.d.ts +0 -5
  196. package/dist/ts3.4/client/preview/angular-beta/StorybookWrapperComponent.d.ts +0 -9
  197. package/dist/ts3.4/client/preview/angular-beta/utils/NgComponentAnalyzer.d.ts +0 -29
  198. package/dist/ts3.4/client/preview/angular-beta/utils/NgModulesAnalyzer.d.ts +0 -6
  199. package/dist/ts3.4/client/preview/angular-polyfills.d.ts +0 -41
  200. package/dist/ts3.4/client/preview/config.d.ts +0 -6
  201. package/dist/ts3.4/client/preview/decorateStory.d.ts +0 -4
  202. package/dist/ts3.4/client/preview/decorators.d.ts +0 -6
  203. package/dist/ts3.4/client/preview/globals.d.ts +0 -1
  204. package/dist/ts3.4/client/preview/index.d.ts +0 -25
  205. package/dist/ts3.4/client/preview/render.d.ts +0 -7
  206. package/dist/ts3.4/client/preview/types-6-0.d.ts +0 -42
  207. package/dist/ts3.4/client/preview/types-7-0.d.ts +0 -9
  208. package/dist/ts3.4/client/preview/types.d.ts +0 -29
  209. package/dist/ts3.4/demo/button.component.d.ts +0 -5
  210. package/dist/ts3.4/demo/welcome.component.d.ts +0 -4
  211. package/dist/ts3.4/renderer.d.ts +0 -4
  212. package/dist/ts3.4/server/__mocks-ng-workspace__/minimal-config/src/main.d.ts +0 -1
  213. package/dist/ts3.4/server/__mocks-ng-workspace__/some-config/src/main.d.ts +0 -1
  214. package/dist/ts3.4/server/__mocks-ng-workspace__/with-angularBrowserTarget/src/main.d.ts +0 -1
  215. package/dist/ts3.4/server/__mocks-ng-workspace__/with-lib/projects/pattern-lib/src/main.d.ts +0 -1
  216. package/dist/ts3.4/server/__mocks-ng-workspace__/with-nx/src/main.d.ts +0 -1
  217. package/dist/ts3.4/server/__mocks-ng-workspace__/with-nx-workspace/src/main.d.ts +0 -1
  218. package/dist/ts3.4/server/__mocks-ng-workspace__/with-options-styles/src/main.d.ts +0 -1
  219. package/dist/ts3.4/server/__mocks-ng-workspace__/without-projects-entry/projects/pattern-lib/src/main.d.ts +0 -1
  220. package/dist/ts3.4/server/__mocks-ng-workspace__/without-tsConfig/src/main.d.ts +0 -1
  221. package/dist/ts3.4/server/angular-cli-webpack-12.2.x.d.ts +0 -1
  222. package/dist/ts3.4/server/angular-cli-webpack-13.x.x.d.ts +0 -1
  223. package/dist/ts3.4/server/angular-cli-webpack-older.d.ts +0 -73
  224. package/dist/ts3.4/server/angular-devkit-build-webpack.d.ts +0 -30
  225. package/dist/ts3.4/server/angular-read-workspace.d.ts +0 -13
  226. package/dist/ts3.4/server/build.d.ts +0 -1
  227. package/dist/ts3.4/server/create-fork-ts-checker-plugin.d.ts +0 -3
  228. package/dist/ts3.4/server/framework-preset-angular-cli.d.ts +0 -3
  229. package/dist/ts3.4/server/framework-preset-angular-docs.d.ts +0 -2
  230. package/dist/ts3.4/server/framework-preset-angular-ivy.d.ts +0 -10
  231. package/dist/ts3.4/server/framework-preset-angular.d.ts +0 -5
  232. package/dist/ts3.4/server/index.d.ts +0 -1
  233. package/dist/ts3.4/server/ngx-template-loader/index.d.ts +0 -1
  234. package/dist/ts3.4/server/options.d.ts +0 -14
  235. package/dist/ts3.4/server/preset.d.ts +0 -3
  236. package/dist/ts3.4/server/ts_config.d.ts +0 -2
  237. package/dist/ts3.4/server/utils/filter-out-styling-rules.d.ts +0 -2
  238. package/dist/ts3.4/server/utils/module-is-available.d.ts +0 -1
  239. package/dist/ts3.4/server/utils/normalize-optimization.d.ts +0 -3
  240. package/dist/ts3.4/types/index.d.ts +0 -6
  241. package/dist/ts3.9/builders/build-storybook/index.js +0 -65
  242. package/dist/ts3.9/builders/start-storybook/index.js +0 -73
  243. package/dist/ts3.9/client/docs/prepareForInline.d.ts +0 -7
  244. package/dist/ts3.9/client/docs/prepareForInline.js +0 -45
  245. package/dist/ts3.9/client/preview/angular-beta/CanvasRenderer.js +0 -34
  246. package/dist/ts3.9/client/preview/angular-beta/DocsRenderer.js +0 -59
  247. package/dist/ts3.9/client/preview/angular-beta/RendererFactory.js +0 -65
  248. package/dist/ts3.9/client/preview/render.js +0 -34
  249. package/dist/ts3.9/demo/button.component.d.ts +0 -5
  250. package/dist/ts3.9/demo/button.component.js +0 -46
  251. package/dist/ts3.9/demo/welcome.component.d.ts +0 -4
  252. package/dist/ts3.9/demo/welcome.component.js +0 -99
  253. package/dist/ts3.9/public_api.d.ts +0 -1
  254. package/dist/ts3.9/server/angular-cli-webpack-12.2.x.js +0 -56
  255. package/dist/ts3.9/server/angular-cli-webpack-13.x.x.js +0 -60
  256. package/dist/ts3.9/server/angular-cli-webpack-older.d.ts +0 -73
  257. package/dist/ts3.9/server/angular-cli-webpack-older.js +0 -110
  258. package/dist/ts3.9/server/build.d.ts +0 -1
  259. package/dist/ts3.9/server/build.js +0 -28
  260. package/dist/ts3.9/server/framework-preset-angular-cli.js +0 -177
  261. package/dist/ts3.9/server/framework-preset-angular.js +0 -100
  262. package/dist/ts3.9/server/index.d.ts +0 -1
  263. package/dist/ts3.9/server/index.js +0 -8
  264. package/dist/ts3.9/server/options.js +0 -8
  265. package/dist/ts3.9/server/preset.d.ts +0 -3
  266. package/dist/ts3.9/server/preset.js +0 -13
  267. package/dist/ts3.9/server/utils/normalize-asset-patterns.d.ts +0 -6
  268. package/dist/ts3.9/types/index.d.ts +0 -6
@@ -0,0 +1,70 @@
1
+ // Private angular devkit stuff
2
+ const { generateI18nBrowserWebpackConfigFromContext, } = require('@angular-devkit/build-angular/src/utils/webpack-browser-config');
3
+ const { getCommonConfig, getStylesConfig, getDevServerConfig, getTypeScriptConfig, } = require('@angular-devkit/build-angular/src/webpack/configs');
4
+ const TsconfigPathsPlugin = require('tsconfig-paths-webpack-plugin');
5
+ const { filterOutStylingRules } = require('./utils/filter-out-styling-rules');
6
+ /**
7
+ * Extract webpack config from angular-cli 13.x.x
8
+ * ⚠️ This file is in JavaScript to not use TypeScript. Because current storybook TypeScript version is not compatible with Angular CLI.
9
+ * FIXME: Try another way with TypeScript on future storybook version (7 maybe 🤞)
10
+ *
11
+ * @param {*} baseConfig Previous webpack config from storybook
12
+ * @param {*} options { builderOptions, builderContext }
13
+ */
14
+ exports.getWebpackConfig = async (baseConfig, { builderOptions, builderContext }) => {
15
+ /**
16
+ * Get angular-cli Webpack config
17
+ */
18
+ const { config: cliConfig } = await generateI18nBrowserWebpackConfigFromContext({
19
+ // Default options
20
+ index: 'noop-index',
21
+ main: 'noop-main',
22
+ outputPath: 'noop-out',
23
+ // Options provided by user
24
+ ...builderOptions,
25
+ // Fixed options
26
+ optimization: false,
27
+ namedChunks: false,
28
+ progress: false,
29
+ buildOptimizer: false,
30
+ aot: false,
31
+ }, builderContext, (wco) => [
32
+ getCommonConfig(wco),
33
+ getStylesConfig(wco),
34
+ getTypeScriptConfig ? getTypeScriptConfig(wco) : getDevServerConfig(wco),
35
+ ]);
36
+ /**
37
+ * Merge baseConfig Webpack with angular-cli Webpack
38
+ */
39
+ const entry = [
40
+ ...baseConfig.entry,
41
+ ...(cliConfig.entry.styles ?? []),
42
+ ...(cliConfig.entry.polyfills ?? []),
43
+ ];
44
+ // Don't use storybooks styling rules because we have to use rules created by @angular-devkit/build-angular
45
+ // because @angular-devkit/build-angular created rules have include/exclude for global style files.
46
+ const rulesExcludingStyles = filterOutStylingRules(baseConfig);
47
+ const module = {
48
+ ...baseConfig.module,
49
+ rules: [...cliConfig.module.rules, ...rulesExcludingStyles],
50
+ };
51
+ const plugins = [...(cliConfig.plugins ?? []), ...baseConfig.plugins];
52
+ const resolve = {
53
+ ...baseConfig.resolve,
54
+ modules: Array.from(new Set([...baseConfig.resolve.modules, ...cliConfig.resolve.modules])),
55
+ plugins: [
56
+ new TsconfigPathsPlugin({
57
+ configFile: builderOptions.tsConfig,
58
+ mainFields: ['browser', 'module', 'main'],
59
+ }),
60
+ ],
61
+ };
62
+ return {
63
+ ...baseConfig,
64
+ entry,
65
+ module,
66
+ plugins,
67
+ resolve,
68
+ resolveLoader: cliConfig.resolveLoader,
69
+ };
70
+ };
@@ -0,0 +1,6 @@
1
+ import webpack, { Configuration } from 'webpack';
2
+ import type { PresetOptions } from './preset-options';
3
+ /**
4
+ * Old way currently support version lower than 12.2.x
5
+ */
6
+ export declare function getWebpackConfig(baseConfig: webpack.Configuration, options: PresetOptions): Promise<Configuration>;
@@ -0,0 +1,111 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.getWebpackConfig = void 0;
7
+ const node_logger_1 = require("@storybook/node-logger");
8
+ const tsconfig_paths_webpack_plugin_1 = __importDefault(require("tsconfig-paths-webpack-plugin"));
9
+ const architect_1 = require("@angular-devkit/architect");
10
+ const angular_read_workspace_1 = require("./angular-read-workspace");
11
+ const angular_devkit_build_webpack_1 = require("./angular-devkit-build-webpack");
12
+ const filter_out_styling_rules_1 = require("./utils/filter-out-styling-rules");
13
+ /**
14
+ * Old way currently support version lower than 12.2.x
15
+ */
16
+ async function getWebpackConfig(baseConfig, options) {
17
+ const dirToSearch = process.cwd();
18
+ // Read angular workspace
19
+ let workspaceConfig;
20
+ try {
21
+ workspaceConfig = await (0, angular_read_workspace_1.readAngularWorkspaceConfig)(dirToSearch);
22
+ }
23
+ catch (error) {
24
+ node_logger_1.logger.error(`=> Could not find angular workspace config (angular.json) on this path "${dirToSearch}"`);
25
+ node_logger_1.logger.info(`=> Fail to load angular-cli config. Using base config`);
26
+ return baseConfig;
27
+ }
28
+ // Find angular project target
29
+ let project;
30
+ let target;
31
+ let confName;
32
+ try {
33
+ // Default behavior when `angularBrowserTarget` are not explicitly defined to null
34
+ if (options.angularBrowserTarget !== null) {
35
+ const browserTarget = options.angularBrowserTarget
36
+ ? (0, architect_1.targetFromTargetString)(options.angularBrowserTarget)
37
+ : {
38
+ configuration: undefined,
39
+ project: (0, angular_read_workspace_1.getDefaultProjectName)(workspaceConfig),
40
+ target: 'build',
41
+ };
42
+ const fondProject = (0, angular_read_workspace_1.findAngularProjectTarget)(workspaceConfig, browserTarget.project, browserTarget.target);
43
+ project = fondProject.project;
44
+ target = fondProject.target;
45
+ confName = browserTarget.configuration;
46
+ node_logger_1.logger.info(`=> Using angular project "${browserTarget.project}:${browserTarget.target}${confName ? `:${confName}` : ''}" for configuring Storybook`);
47
+ }
48
+ // Start storybook when only tsConfig is provided.
49
+ if (options.angularBrowserTarget === null && options.tsConfig) {
50
+ node_logger_1.logger.info(`=> Using default angular project with "tsConfig:${options.tsConfig}"`);
51
+ project = { root: '', extensions: {}, targets: undefined };
52
+ target = { builder: '', options: { tsConfig: options.tsConfig } };
53
+ }
54
+ }
55
+ catch (error) {
56
+ node_logger_1.logger.error(`=> Could not find angular project: ${error.message}`);
57
+ node_logger_1.logger.info(`=> Fail to load angular-cli config. Using base config`);
58
+ return baseConfig;
59
+ }
60
+ // Use angular-cli to get some webpack config
61
+ let angularCliWebpackConfig;
62
+ try {
63
+ angularCliWebpackConfig = await (0, angular_devkit_build_webpack_1.extractAngularCliWebpackConfig)(dirToSearch, project, target, confName);
64
+ node_logger_1.logger.info(`=> Using angular-cli webpack config`);
65
+ }
66
+ catch (error) {
67
+ node_logger_1.logger.error(`=> Could not get angular cli webpack config`);
68
+ throw error;
69
+ }
70
+ return mergeAngularCliWebpackConfig(angularCliWebpackConfig, baseConfig);
71
+ }
72
+ exports.getWebpackConfig = getWebpackConfig;
73
+ function mergeAngularCliWebpackConfig({ cliCommonWebpackConfig, cliStyleWebpackConfig, tsConfigPath }, baseConfig) {
74
+ // Don't use storybooks styling rules because we have to use rules created by @angular-devkit/build-angular
75
+ // because @angular-devkit/build-angular created rules have include/exclude for global style files.
76
+ const rulesExcludingStyles = (0, filter_out_styling_rules_1.filterOutStylingRules)(baseConfig);
77
+ // styleWebpackConfig.entry adds global style files to the webpack context
78
+ const entry = [
79
+ ...baseConfig.entry,
80
+ // @ts-ignore
81
+ ...Object.values(cliStyleWebpackConfig.entry).reduce((acc, item) => acc.concat(item), []),
82
+ ];
83
+ const module = {
84
+ ...baseConfig.module,
85
+ rules: [...cliStyleWebpackConfig.module.rules, ...rulesExcludingStyles],
86
+ };
87
+ // We use cliCommonConfig plugins to serve static assets files.
88
+ const plugins = [
89
+ ...cliStyleWebpackConfig.plugins,
90
+ ...cliCommonWebpackConfig.plugins,
91
+ ...baseConfig.plugins,
92
+ ];
93
+ const resolve = {
94
+ ...baseConfig.resolve,
95
+ modules: Array.from(new Set([...baseConfig.resolve.modules, ...cliCommonWebpackConfig.resolve.modules])),
96
+ plugins: [
97
+ new tsconfig_paths_webpack_plugin_1.default({
98
+ configFile: tsConfigPath,
99
+ mainFields: ['browser', 'module', 'main'],
100
+ }),
101
+ ],
102
+ };
103
+ return {
104
+ ...baseConfig,
105
+ entry,
106
+ module,
107
+ plugins,
108
+ resolve,
109
+ resolveLoader: cliCommonWebpackConfig.resolveLoader,
110
+ };
111
+ }
@@ -4,22 +4,22 @@
4
4
  *
5
5
  * It uses code block of angular cli to extract parts of webpack configuration
6
6
  */
7
- import webpack from 'webpack';
7
+ import { Configuration } from 'webpack';
8
8
  import { workspaces } from '@angular-devkit/core';
9
9
  export declare type AngularCliWebpackConfig = {
10
10
  cliCommonWebpackConfig: {
11
- plugins: webpack.Plugin[];
11
+ plugins: Configuration['plugins'];
12
12
  resolve: {
13
13
  modules: string[];
14
14
  };
15
- resolveLoader: webpack.ResolveLoader;
15
+ resolveLoader: Configuration['resolveLoader'];
16
16
  };
17
17
  cliStyleWebpackConfig: {
18
- entry: string | string[] | webpack.Entry | webpack.EntryFunc;
18
+ entry: Configuration['entry'];
19
19
  module: {
20
- rules: webpack.RuleSetRule[];
20
+ rules: Configuration['module']['rules'];
21
21
  };
22
- plugins: webpack.Plugin[];
22
+ plugins: Configuration['plugins'];
23
23
  };
24
24
  tsConfigPath: string;
25
25
  };
@@ -7,7 +7,11 @@
7
7
  */
8
8
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
9
9
  if (k2 === undefined) k2 = k;
10
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
10
+ var desc = Object.getOwnPropertyDescriptor(m, k);
11
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
12
+ desc = { enumerable: true, get: function() { return m[k]; } };
13
+ }
14
+ Object.defineProperty(o, k2, desc);
11
15
  }) : (function(o, m, k, k2) {
12
16
  if (k2 === undefined) k2 = k;
13
17
  o[k2] = m[k];
@@ -20,19 +24,10 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
20
24
  var __importStar = (this && this.__importStar) || function (mod) {
21
25
  if (mod && mod.__esModule) return mod;
22
26
  var result = {};
23
- if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
27
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
24
28
  __setModuleDefault(result, mod);
25
29
  return result;
26
30
  };
27
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
28
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
29
- return new (P || (P = Promise))(function (resolve, reject) {
30
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
31
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
32
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
33
- step((generator = generator.apply(thisArg, _arguments || [])).next());
34
- });
35
- };
36
31
  var __importDefault = (this && this.__importDefault) || function (mod) {
37
32
  return (mod && mod.__esModule) ? mod : { "default": mod };
38
33
  };
@@ -47,12 +42,12 @@ const normalize_optimization_1 = require("./utils/normalize-optimization");
47
42
  const importAngularCliWebpackConfigGenerator = () => {
48
43
  let angularWebpackConfig;
49
44
  // First we look for webpack config according to directory structure of Angular 11
50
- if (module_is_available_1.moduleIsAvailable('@angular-devkit/build-angular/src/webpack/configs')) {
45
+ if ((0, module_is_available_1.moduleIsAvailable)('@angular-devkit/build-angular/src/webpack/configs')) {
51
46
  // eslint-disable-next-line global-require
52
47
  angularWebpackConfig = require('@angular-devkit/build-angular/src/webpack/configs');
53
48
  }
54
49
  // We fallback on directory structure of Angular 10 (and below)
55
- else if (module_is_available_1.moduleIsAvailable('@angular-devkit/build-angular/src/angular-cli-files/models/webpack-configs')) {
50
+ else if ((0, module_is_available_1.moduleIsAvailable)('@angular-devkit/build-angular/src/angular-cli-files/models/webpack-configs')) {
56
51
  // eslint-disable-next-line global-require
57
52
  angularWebpackConfig = require('@angular-devkit/build-angular/src/angular-cli-files/models/webpack-configs');
58
53
  }
@@ -66,18 +61,18 @@ const importAngularCliWebpackConfigGenerator = () => {
66
61
  };
67
62
  const importAngularCliReadTsconfigUtil = () => {
68
63
  // First we look for webpack config according to directory structure of Angular 11
69
- if (module_is_available_1.moduleIsAvailable('@angular-devkit/build-angular/src/utils/read-tsconfig')) {
64
+ if ((0, module_is_available_1.moduleIsAvailable)('@angular-devkit/build-angular/src/utils/read-tsconfig')) {
70
65
  // eslint-disable-next-line global-require
71
66
  return require('@angular-devkit/build-angular/src/utils/read-tsconfig');
72
67
  }
73
68
  // We fallback on directory structure of Angular 10 (and below)
74
- if (module_is_available_1.moduleIsAvailable('@angular-devkit/build-angular/src/angular-cli-files/utilities/read-tsconfig')) {
69
+ if ((0, module_is_available_1.moduleIsAvailable)('@angular-devkit/build-angular/src/angular-cli-files/utilities/read-tsconfig')) {
75
70
  // eslint-disable-next-line global-require
76
71
  return require('@angular-devkit/build-angular/src/angular-cli-files/utilities/read-tsconfig');
77
72
  }
78
73
  throw new Error('ReadTsconfig not found in "@angular-devkit/build-angular"');
79
74
  };
80
- const buildWebpackConfigOptions = (dirToSearch, project, target, confName) => __awaiter(void 0, void 0, void 0, function* () {
75
+ const buildWebpackConfigOptions = async (dirToSearch, project, target, confName) => {
81
76
  let conf = {};
82
77
  if (confName) {
83
78
  if (!target.configurations) {
@@ -88,65 +83,82 @@ const buildWebpackConfigOptions = (dirToSearch, project, target, confName) => __
88
83
  }
89
84
  conf = target.configurations[confName];
90
85
  }
91
- const projectBuildOptions = Object.assign(Object.assign({}, target.options), conf);
86
+ const projectBuildOptions = { ...target.options, ...conf };
92
87
  const requiredOptions = ['tsConfig'];
93
88
  if (!requiredOptions.every((key) => !!projectBuildOptions[key])) {
94
89
  throw new Error(`Missing required options in project target. Check "${requiredOptions.join(', ')}"`);
95
90
  }
96
- const workspaceRootNormalized = core_1.normalize(dirToSearch);
97
- const projectRootNormalized = core_1.resolve(workspaceRootNormalized, core_1.normalize(project.root || ''));
91
+ const workspaceRootNormalized = (0, core_1.normalize)(dirToSearch);
92
+ const projectRootNormalized = (0, core_1.resolve)(workspaceRootNormalized, (0, core_1.normalize)(project.root || ''));
98
93
  const sourceRootNormalized = project.sourceRoot
99
- ? core_1.resolve(workspaceRootNormalized, core_1.normalize(project.sourceRoot))
94
+ ? (0, core_1.resolve)(workspaceRootNormalized, (0, core_1.normalize)(project.sourceRoot))
100
95
  : undefined;
101
- const tsConfigPath = path_1.default.resolve(core_1.getSystemPath(workspaceRootNormalized), projectBuildOptions.tsConfig);
102
- const tsConfig = importAngularCliReadTsconfigUtil().readTsconfig(tsConfigPath);
103
- const ts = yield Promise.resolve().then(() => __importStar(require('typescript')));
96
+ const tsConfigPath = path_1.default.resolve((0, core_1.getSystemPath)(workspaceRootNormalized), projectBuildOptions.tsConfig);
97
+ const tsConfig = await importAngularCliReadTsconfigUtil().readTsconfig(tsConfigPath);
98
+ const ts = await Promise.resolve().then(() => __importStar(require('typescript')));
104
99
  const scriptTarget = tsConfig.options.target || ts.ScriptTarget.ES5;
105
- const buildOptions = Object.assign(Object.assign({
100
+ const buildOptions = {
106
101
  // Default options
107
- budgets: [], fileReplacements: [], main: '', outputPath: 'dist/storybook-angular', scripts: [], sourceMap: {}, styles: [], lazyModules: [] }, projectBuildOptions), { assets: normalize_asset_patterns_1.normalizeAssetPatterns(projectBuildOptions.assets || [], workspaceRootNormalized, projectRootNormalized, sourceRootNormalized), optimization: normalize_optimization_1.normalizeOptimization(projectBuildOptions.optimization),
102
+ budgets: [],
103
+ fileReplacements: [],
104
+ main: '',
105
+ outputPath: 'dist/storybook-angular',
106
+ scripts: [],
107
+ sourceMap: {},
108
+ styles: [],
109
+ // Deleted in angular 12. Keep for compatibility with versions lower than angular 12
110
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
111
+ // @ts-ignore
112
+ lazyModules: [],
113
+ // Project Options
114
+ ...projectBuildOptions,
115
+ assets: (0, normalize_asset_patterns_1.normalizeAssetPatterns)(projectBuildOptions.assets || [], workspaceRootNormalized, projectRootNormalized, sourceRootNormalized),
116
+ optimization: (0, normalize_optimization_1.normalizeOptimization)(projectBuildOptions.optimization),
108
117
  // Forced options
109
- statsJson: false, forkTypeChecker: false });
118
+ statsJson: false,
119
+ // Deleted in angular 12. Keep for compatibility with versions lower than angular 12
120
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
121
+ // @ts-ignore
122
+ forkTypeChecker: false,
123
+ };
110
124
  return {
111
- root: core_1.getSystemPath(workspaceRootNormalized),
125
+ projectName: 'this-is-just-a-fake-name-for-getting-rid-of-the-error',
126
+ root: (0, core_1.getSystemPath)(workspaceRootNormalized),
112
127
  // The dependency of `@angular-devkit/build-angular` to `@angular-devkit/core` is not exactly the same version as the one for storybook (node modules of node modules ^^)
113
- logger: node_1.createConsoleLogger(),
114
- projectRoot: core_1.getSystemPath(projectRootNormalized),
115
- sourceRoot: sourceRootNormalized ? core_1.getSystemPath(sourceRootNormalized) : undefined,
128
+ logger: (0, node_1.createConsoleLogger)(),
129
+ projectRoot: (0, core_1.getSystemPath)(projectRootNormalized),
130
+ sourceRoot: sourceRootNormalized ? (0, core_1.getSystemPath)(sourceRootNormalized) : undefined,
116
131
  buildOptions,
117
132
  tsConfig,
118
133
  tsConfigPath,
119
134
  scriptTarget,
120
135
  };
121
- });
136
+ };
122
137
  /**
123
138
  * Uses angular cli to extract webpack configuration.
124
139
  * The `AngularCliWebpackConfig` type lists the parts used by storybook
125
140
  */
126
- function extractAngularCliWebpackConfig(dirToSearch, project, target, confName) {
127
- var _a;
128
- return __awaiter(this, void 0, void 0, function* () {
129
- const { getCommonConfig, getStylesConfig } = importAngularCliWebpackConfigGenerator();
130
- const webpackConfigOptions = yield buildWebpackConfigOptions(dirToSearch, project, target, confName);
131
- const cliCommonConfig = getCommonConfig(webpackConfigOptions);
132
- const cliStyleConfig = getStylesConfig(webpackConfigOptions);
133
- return {
134
- cliCommonWebpackConfig: {
135
- plugins: cliCommonConfig.plugins,
136
- resolve: {
137
- modules: (_a = cliCommonConfig.resolve) === null || _a === void 0 ? void 0 : _a.modules,
138
- },
139
- resolveLoader: cliCommonConfig.resolveLoader,
141
+ async function extractAngularCliWebpackConfig(dirToSearch, project, target, confName) {
142
+ const { getCommonConfig, getStylesConfig } = importAngularCliWebpackConfigGenerator();
143
+ const webpackConfigOptions = await buildWebpackConfigOptions(dirToSearch, project, target, confName);
144
+ const cliCommonConfig = getCommonConfig(webpackConfigOptions);
145
+ const cliStyleConfig = getStylesConfig(webpackConfigOptions);
146
+ return {
147
+ cliCommonWebpackConfig: {
148
+ plugins: cliCommonConfig.plugins,
149
+ resolve: {
150
+ modules: cliCommonConfig.resolve?.modules,
140
151
  },
141
- cliStyleWebpackConfig: {
142
- entry: cliStyleConfig.entry,
143
- module: {
144
- rules: [...cliStyleConfig.module.rules],
145
- },
146
- plugins: cliStyleConfig.plugins,
152
+ resolveLoader: cliCommonConfig.resolveLoader,
153
+ },
154
+ cliStyleWebpackConfig: {
155
+ entry: cliStyleConfig.entry,
156
+ module: {
157
+ rules: [...cliStyleConfig.module.rules],
147
158
  },
148
- tsConfigPath: webpackConfigOptions.tsConfigPath,
149
- };
150
- });
159
+ plugins: cliStyleConfig.plugins,
160
+ },
161
+ tsConfigPath: webpackConfigOptions.tsConfigPath,
162
+ };
151
163
  }
152
164
  exports.extractAngularCliWebpackConfig = extractAngularCliWebpackConfig;
@@ -1,13 +1,4 @@
1
1
  "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
2
  Object.defineProperty(exports, "__esModule", { value: true });
12
3
  exports.findAngularProjectTarget = exports.getDefaultProjectName = exports.readAngularWorkspaceConfig = void 0;
13
4
  const node_1 = require("@angular-devkit/core/node");
@@ -18,7 +9,7 @@ const core_1 = require("@angular-devkit/core");
18
9
  * - Either from NX if it is present
19
10
  * - Either from `@angular-devkit/core` -> https://github.com/angular/angular-cli/tree/master/packages/angular_devkit/core
20
11
  */
21
- exports.readAngularWorkspaceConfig = (dirToSearch) => __awaiter(void 0, void 0, void 0, function* () {
12
+ const readAngularWorkspaceConfig = async (dirToSearch) => {
22
13
  const host = core_1.workspaces.createWorkspaceHost(new node_1.NodeJsSyncHost());
23
14
  try {
24
15
  /**
@@ -49,9 +40,10 @@ exports.readAngularWorkspaceConfig = (dirToSearch) => __awaiter(void 0, void 0,
49
40
  catch (e) {
50
41
  // Ignore if the client does not use NX
51
42
  }
52
- return (yield core_1.workspaces.readWorkspace(dirToSearch, host)).workspace;
53
- });
54
- exports.getDefaultProjectName = (workspace) => {
43
+ return (await core_1.workspaces.readWorkspace(dirToSearch, host)).workspace;
44
+ };
45
+ exports.readAngularWorkspaceConfig = readAngularWorkspaceConfig;
46
+ const getDefaultProjectName = (workspace) => {
55
47
  const environmentProjectName = process.env.STORYBOOK_ANGULAR_PROJECT;
56
48
  if (environmentProjectName) {
57
49
  return environmentProjectName;
@@ -68,7 +60,8 @@ exports.getDefaultProjectName = (workspace) => {
68
60
  }
69
61
  throw new Error('No angular projects found');
70
62
  };
71
- exports.findAngularProjectTarget = (workspace, projectName, targetName) => {
63
+ exports.getDefaultProjectName = getDefaultProjectName;
64
+ const findAngularProjectTarget = (workspace, projectName, targetName) => {
72
65
  if (!workspace.projects || !Object.keys(workspace.projects).length) {
73
66
  throw new Error('No angular projects found');
74
67
  }
@@ -82,3 +75,4 @@ exports.findAngularProjectTarget = (workspace, projectName, targetName) => {
82
75
  const target = project.targets.get(targetName);
83
76
  return { project, target };
84
77
  };
78
+ exports.findAngularProjectTarget = findAngularProjectTarget;
@@ -9,7 +9,7 @@ const node_logger_1 = require("@storybook/node-logger");
9
9
  function default_1(tsLoaderOptions) {
10
10
  if (tsLoaderOptions && tsLoaderOptions.configFile) {
11
11
  return new fork_ts_checker_webpack_plugin_1.default({
12
- tsconfig: tsLoaderOptions.configFile,
12
+ typescript: { configFile: tsLoaderOptions.configFile },
13
13
  async: true,
14
14
  });
15
15
  }
@@ -1,3 +1,3 @@
1
1
  import webpack from 'webpack';
2
- import { PresetOptions } from './options';
2
+ import type { PresetOptions } from './preset-options';
3
3
  export declare function webpackFinal(baseConfig: webpack.Configuration, options: PresetOptions): Promise<webpack.Configuration>;
@@ -0,0 +1,175 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ var __importDefault = (this && this.__importDefault) || function (mod) {
26
+ return (mod && mod.__esModule) ? mod : { "default": mod };
27
+ };
28
+ Object.defineProperty(exports, "__esModule", { value: true });
29
+ exports.webpackFinal = void 0;
30
+ const node_logger_1 = require("@storybook/node-logger");
31
+ const architect_1 = require("@angular-devkit/architect");
32
+ const find_up_1 = require("find-up");
33
+ const semver_1 = __importDefault(require("@storybook/semver"));
34
+ const ts_dedent_1 = __importDefault(require("ts-dedent"));
35
+ const core_1 = require("@angular-devkit/core");
36
+ const module_is_available_1 = require("./utils/module-is-available");
37
+ const angular_cli_webpack_12_2_x_1 = require("./angular-cli-webpack-12.2.x");
38
+ const angular_cli_webpack_13_x_x_1 = require("./angular-cli-webpack-13.x.x");
39
+ const angular_cli_webpack_older_1 = require("./angular-cli-webpack-older");
40
+ const angular_read_workspace_1 = require("./angular-read-workspace");
41
+ async function webpackFinal(baseConfig, options) {
42
+ if (!(0, module_is_available_1.moduleIsAvailable)('@angular-devkit/build-angular')) {
43
+ node_logger_1.logger.info('=> Using base config because "@angular-devkit/build-angular" is not installed');
44
+ return baseConfig;
45
+ }
46
+ const angularCliVersion = await Promise.resolve().then(() => __importStar(require('@angular/cli'))).then((m) => semver_1.default.coerce(m.VERSION.full));
47
+ /**
48
+ * Ordered array to use the specific getWebpackConfig according to some condition like angular-cli version
49
+ */
50
+ const webpackGetterByVersions = [
51
+ {
52
+ info: '=> Loading angular-cli config for angular >= 13.0.0',
53
+ condition: semver_1.default.satisfies(angularCliVersion, '>=13.0.0'),
54
+ getWebpackConfig: async (_baseConfig, _options) => {
55
+ const builderContext = getBuilderContext(_options);
56
+ const builderOptions = await getBuilderOptions(_options, builderContext);
57
+ const legacyDefaultOptions = await getLegacyDefaultBuildOptions(_options);
58
+ return (0, angular_cli_webpack_13_x_x_1.getWebpackConfig)(_baseConfig, {
59
+ builderOptions: {
60
+ watch: options.configType === 'DEVELOPMENT',
61
+ ...legacyDefaultOptions,
62
+ ...builderOptions,
63
+ },
64
+ builderContext,
65
+ });
66
+ },
67
+ },
68
+ {
69
+ info: '=> Loading angular-cli config for angular 12.2.x',
70
+ condition: semver_1.default.satisfies(angularCliVersion, '12.2.x') && options.angularBuilderContext,
71
+ getWebpackConfig: async (_baseConfig, _options) => {
72
+ const builderContext = getBuilderContext(_options);
73
+ const builderOptions = await getBuilderOptions(_options, builderContext);
74
+ return (0, angular_cli_webpack_12_2_x_1.getWebpackConfig)(_baseConfig, {
75
+ builderOptions,
76
+ builderContext,
77
+ });
78
+ },
79
+ },
80
+ {
81
+ info: '=> Loading angular-cli config for angular lower than 12.2.0',
82
+ condition: true,
83
+ getWebpackConfig: angular_cli_webpack_older_1.getWebpackConfig,
84
+ },
85
+ ];
86
+ const webpackGetter = webpackGetterByVersions.find((wg) => wg.condition);
87
+ node_logger_1.logger.info(webpackGetter.info);
88
+ return Promise.resolve(webpackGetter.getWebpackConfig(baseConfig, options));
89
+ }
90
+ exports.webpackFinal = webpackFinal;
91
+ /**
92
+ * Get Builder Context
93
+ * If storybook is not start by angular builder create dumb BuilderContext
94
+ */
95
+ function getBuilderContext(options) {
96
+ return (options.angularBuilderContext ??
97
+ {
98
+ target: { project: 'noop-project', builder: '', options: {} },
99
+ workspaceRoot: process.cwd(),
100
+ getProjectMetadata: () => ({}),
101
+ getTargetOptions: () => ({}),
102
+ logger: new core_1.logging.Logger('Storybook'),
103
+ });
104
+ }
105
+ /**
106
+ * Get builder options
107
+ * Merge target options from browser target and from storybook options
108
+ */
109
+ async function getBuilderOptions(options, builderContext) {
110
+ /**
111
+ * Get Browser Target options
112
+ */
113
+ let browserTargetOptions = {};
114
+ if (options.angularBrowserTarget) {
115
+ const browserTarget = (0, architect_1.targetFromTargetString)(options.angularBrowserTarget);
116
+ node_logger_1.logger.info(`=> Using angular browser target options from "${browserTarget.project}:${browserTarget.target}${browserTarget.configuration ? `:${browserTarget.configuration}` : ''}"`);
117
+ browserTargetOptions = await builderContext.getTargetOptions(browserTarget);
118
+ }
119
+ /**
120
+ * Merge target options from browser target options and from storybook options
121
+ */
122
+ const builderOptions = {
123
+ ...browserTargetOptions,
124
+ ...options.angularBuilderOptions,
125
+ tsConfig: options.tsConfig ??
126
+ (0, find_up_1.sync)('tsconfig.json', { cwd: options.configDir }) ??
127
+ browserTargetOptions.tsConfig,
128
+ };
129
+ node_logger_1.logger.info(`=> Using angular project with "tsConfig:${builderOptions.tsConfig}"`);
130
+ return builderOptions;
131
+ }
132
+ /**
133
+ * Get options from legacy way
134
+ * /!\ This is only for backward compatibility and would be removed on Storybook 7.0
135
+ * only work for angular.json with [defaultProject].build or "storybook.build" config
136
+ */
137
+ async function getLegacyDefaultBuildOptions(options) {
138
+ if (options.angularBrowserTarget !== undefined) {
139
+ // Not use legacy way with builder (`angularBrowserTarget` is defined or null with builder and undefined without)
140
+ return {};
141
+ }
142
+ node_logger_1.logger.warn((0, ts_dedent_1.default) `Your Storybook startup uses a solution that will not be supported in version 7.0.
143
+ You must use angular builder to have an explicit configuration on the project used in angular.json
144
+ Read more at:
145
+ - https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#sb-angular-builder)
146
+ - https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#angular13)
147
+ `);
148
+ const dirToSearch = process.cwd();
149
+ // Read angular workspace
150
+ let workspaceConfig;
151
+ try {
152
+ workspaceConfig = await (0, angular_read_workspace_1.readAngularWorkspaceConfig)(dirToSearch);
153
+ }
154
+ catch (error) {
155
+ node_logger_1.logger.error(`=> Could not find angular workspace config (angular.json) on this path "${dirToSearch}"`);
156
+ node_logger_1.logger.info(`=> Fail to load angular-cli config. Using base config`);
157
+ return {};
158
+ }
159
+ // Find angular project target
160
+ try {
161
+ const browserTarget = {
162
+ configuration: undefined,
163
+ project: (0, angular_read_workspace_1.getDefaultProjectName)(workspaceConfig),
164
+ target: 'build',
165
+ };
166
+ const { target } = (0, angular_read_workspace_1.findAngularProjectTarget)(workspaceConfig, browserTarget.project, browserTarget.target);
167
+ node_logger_1.logger.info(`=> Using angular project "${browserTarget.project}:${browserTarget.target}" for configuring Storybook`);
168
+ return { ...target.options };
169
+ }
170
+ catch (error) {
171
+ node_logger_1.logger.error(`=> Could not find angular project: ${error.message}`);
172
+ node_logger_1.logger.info(`=> Fail to load angular-cli config. Using base config`);
173
+ return {};
174
+ }
175
+ }