@storybook/angular 9.1.0-alpha.5 → 9.1.0-alpha.7

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 (266) hide show
  1. package/build-schema.json +199 -0
  2. package/builders.json +14 -0
  3. package/dist/builders/build-storybook/index.js +31 -80
  4. package/dist/builders/start-storybook/index.js +31 -101
  5. package/dist/chunk-CUDJAP6K.mjs +3 -0
  6. package/dist/chunk-KMSSK3DZ.mjs +6 -0
  7. package/dist/chunk-LXSTVAFF.mjs +40 -0
  8. package/dist/client/config.d.ts +20 -6
  9. package/dist/client/config.js +49 -20
  10. package/dist/client/config.mjs +10 -13
  11. package/dist/client/docs/config.d.ts +6 -3
  12. package/dist/client/docs/config.js +18 -14
  13. package/dist/client/docs/config.mjs +6 -10
  14. package/dist/client/index.d.ts +144 -6
  15. package/dist/client/index.js +47 -30
  16. package/dist/client/index.mjs +3 -9
  17. package/dist/client/preview-prod.d.ts +2 -1
  18. package/dist/client/preview-prod.js +5 -4
  19. package/dist/client/preview-prod.mjs +1 -0
  20. package/dist/index.d.ts +59 -2
  21. package/dist/index.js +47 -29
  22. package/dist/index.mjs +3 -13
  23. package/dist/preset.js +8 -38
  24. package/dist/server/framework-preset-angular-cli.js +20 -83
  25. package/dist/server/framework-preset-angular-ivy.js +6 -59
  26. package/dist/{client/types.d.ts → types-3b0b7107.d.ts} +9 -9
  27. package/package.json +59 -12
  28. package/start-schema.json +234 -0
  29. package/dist/builders/build-storybook/index.d.ts +0 -25
  30. package/dist/builders/build-storybook/index.mjs +0 -78
  31. package/dist/builders/build-storybook/index.spec.d.ts +0 -1
  32. package/dist/builders/build-storybook/index.spec.js +0 -222
  33. package/dist/builders/build-storybook/index.spec.mjs +0 -187
  34. package/dist/builders/build-storybook/schema.json +0 -199
  35. package/dist/builders/builders.json +0 -14
  36. package/dist/builders/start-storybook/index.d.ts +0 -21
  37. package/dist/builders/start-storybook/index.mjs +0 -99
  38. package/dist/builders/start-storybook/index.spec.d.ts +0 -1
  39. package/dist/builders/start-storybook/index.spec.js +0 -188
  40. package/dist/builders/start-storybook/index.spec.mjs +0 -186
  41. package/dist/builders/start-storybook/schema.json +0 -234
  42. package/dist/builders/utils/error-handler.d.ts +0 -2
  43. package/dist/builders/utils/error-handler.js +0 -38
  44. package/dist/builders/utils/error-handler.mjs +0 -33
  45. package/dist/builders/utils/run-compodoc.d.ts +0 -6
  46. package/dist/builders/utils/run-compodoc.js +0 -35
  47. package/dist/builders/utils/run-compodoc.mjs +0 -31
  48. package/dist/builders/utils/run-compodoc.spec.d.ts +0 -1
  49. package/dist/builders/utils/run-compodoc.spec.js +0 -76
  50. package/dist/builders/utils/run-compodoc.spec.mjs +0 -74
  51. package/dist/builders/utils/standalone-options.d.ts +0 -18
  52. package/dist/builders/utils/standalone-options.js +0 -2
  53. package/dist/builders/utils/standalone-options.mjs +0 -1
  54. package/dist/client/angular-beta/AbstractRenderer.d.ts +0 -75
  55. package/dist/client/angular-beta/AbstractRenderer.js +0 -201
  56. package/dist/client/angular-beta/AbstractRenderer.mjs +0 -164
  57. package/dist/client/angular-beta/CanvasRenderer.d.ts +0 -12
  58. package/dist/client/angular-beta/CanvasRenderer.js +0 -13
  59. package/dist/client/angular-beta/CanvasRenderer.mjs +0 -9
  60. package/dist/client/angular-beta/ComputesTemplateFromComponent.d.ts +0 -24
  61. package/dist/client/angular-beta/ComputesTemplateFromComponent.js +0 -160
  62. package/dist/client/angular-beta/ComputesTemplateFromComponent.mjs +0 -154
  63. package/dist/client/angular-beta/ComputesTemplateFromComponent.test.d.ts +0 -1
  64. package/dist/client/angular-beta/ComputesTemplateFromComponent.test.js +0 -730
  65. package/dist/client/angular-beta/ComputesTemplateFromComponent.test.mjs +0 -728
  66. package/dist/client/angular-beta/DocsRenderer.d.ts +0 -13
  67. package/dist/client/angular-beta/DocsRenderer.js +0 -39
  68. package/dist/client/angular-beta/DocsRenderer.mjs +0 -35
  69. package/dist/client/angular-beta/RendererFactory.d.ts +0 -11
  70. package/dist/client/angular-beta/RendererFactory.js +0 -56
  71. package/dist/client/angular-beta/RendererFactory.mjs +0 -50
  72. package/dist/client/angular-beta/RendererFactory.test.d.ts +0 -1
  73. package/dist/client/angular-beta/RendererFactory.test.js +0 -235
  74. package/dist/client/angular-beta/RendererFactory.test.mjs +0 -233
  75. package/dist/client/angular-beta/StorybookModule.d.ts +0 -8
  76. package/dist/client/angular-beta/StorybookModule.js +0 -27
  77. package/dist/client/angular-beta/StorybookModule.mjs +0 -23
  78. package/dist/client/angular-beta/StorybookModule.test.d.ts +0 -1
  79. package/dist/client/angular-beta/StorybookModule.test.js +0 -321
  80. package/dist/client/angular-beta/StorybookModule.test.mjs +0 -319
  81. package/dist/client/angular-beta/StorybookProvider.d.ts +0 -5
  82. package/dist/client/angular-beta/StorybookProvider.js +0 -26
  83. package/dist/client/angular-beta/StorybookProvider.mjs +0 -22
  84. package/dist/client/angular-beta/StorybookWrapperComponent.d.ts +0 -13
  85. package/dist/client/angular-beta/StorybookWrapperComponent.js +0 -127
  86. package/dist/client/angular-beta/StorybookWrapperComponent.mjs +0 -123
  87. package/dist/client/angular-beta/__testfixtures__/input.component.d.ts +0 -29
  88. package/dist/client/angular-beta/__testfixtures__/input.component.js +0 -76
  89. package/dist/client/angular-beta/__testfixtures__/input.component.mjs +0 -73
  90. package/dist/client/angular-beta/__testfixtures__/test.module.d.ts +0 -2
  91. package/dist/client/angular-beta/__testfixtures__/test.module.js +0 -20
  92. package/dist/client/angular-beta/__testfixtures__/test.module.mjs +0 -17
  93. package/dist/client/angular-beta/utils/BootstrapQueue.d.ts +0 -12
  94. package/dist/client/angular-beta/utils/BootstrapQueue.js +0 -86
  95. package/dist/client/angular-beta/utils/BootstrapQueue.mjs +0 -49
  96. package/dist/client/angular-beta/utils/BootstrapQueue.test.d.ts +0 -1
  97. package/dist/client/angular-beta/utils/BootstrapQueue.test.js +0 -164
  98. package/dist/client/angular-beta/utils/BootstrapQueue.test.mjs +0 -162
  99. package/dist/client/angular-beta/utils/NgComponentAnalyzer.d.ts +0 -22
  100. package/dist/client/angular-beta/utils/NgComponentAnalyzer.js +0 -93
  101. package/dist/client/angular-beta/utils/NgComponentAnalyzer.mjs +0 -84
  102. package/dist/client/angular-beta/utils/NgComponentAnalyzer.test.d.ts +0 -1
  103. package/dist/client/angular-beta/utils/NgComponentAnalyzer.test.js +0 -388
  104. package/dist/client/angular-beta/utils/NgComponentAnalyzer.test.mjs +0 -386
  105. package/dist/client/angular-beta/utils/NgModulesAnalyzer.d.ts +0 -6
  106. package/dist/client/angular-beta/utils/NgModulesAnalyzer.js +0 -41
  107. package/dist/client/angular-beta/utils/NgModulesAnalyzer.mjs +0 -37
  108. package/dist/client/angular-beta/utils/NgModulesAnalyzer.test.d.ts +0 -1
  109. package/dist/client/angular-beta/utils/NgModulesAnalyzer.test.js +0 -24
  110. package/dist/client/angular-beta/utils/NgModulesAnalyzer.test.mjs +0 -22
  111. package/dist/client/angular-beta/utils/PropertyExtractor.d.ts +0 -30
  112. package/dist/client/angular-beta/utils/PropertyExtractor.js +0 -196
  113. package/dist/client/angular-beta/utils/PropertyExtractor.mjs +0 -158
  114. package/dist/client/angular-beta/utils/PropertyExtractor.test.d.ts +0 -1
  115. package/dist/client/angular-beta/utils/PropertyExtractor.test.js +0 -177
  116. package/dist/client/angular-beta/utils/PropertyExtractor.test.mjs +0 -175
  117. package/dist/client/angular-beta/utils/StoryUID.d.ts +0 -22
  118. package/dist/client/angular-beta/utils/StoryUID.js +0 -43
  119. package/dist/client/angular-beta/utils/StoryUID.mjs +0 -38
  120. package/dist/client/argsToTemplate.d.ts +0 -56
  121. package/dist/client/argsToTemplate.js +0 -58
  122. package/dist/client/argsToTemplate.mjs +0 -55
  123. package/dist/client/argsToTemplate.test.d.ts +0 -1
  124. package/dist/client/argsToTemplate.test.js +0 -102
  125. package/dist/client/argsToTemplate.test.mjs +0 -100
  126. package/dist/client/compodoc-types.d.ts +0 -102
  127. package/dist/client/compodoc-types.js +0 -2
  128. package/dist/client/compodoc-types.mjs +0 -1
  129. package/dist/client/compodoc.d.ts +0 -12
  130. package/dist/client/compodoc.js +0 -261
  131. package/dist/client/compodoc.mjs +0 -248
  132. package/dist/client/compodoc.test.d.ts +0 -1
  133. package/dist/client/compodoc.test.js +0 -132
  134. package/dist/client/compodoc.test.mjs +0 -130
  135. package/dist/client/decorateStory.d.ts +0 -4
  136. package/dist/client/decorateStory.js +0 -48
  137. package/dist/client/decorateStory.mjs +0 -45
  138. package/dist/client/decorateStory.test.d.ts +0 -1
  139. package/dist/client/decorateStory.test.js +0 -306
  140. package/dist/client/decorateStory.test.mjs +0 -301
  141. package/dist/client/decorators.d.ts +0 -13
  142. package/dist/client/decorators.js +0 -69
  143. package/dist/client/decorators.mjs +0 -63
  144. package/dist/client/decorators.test.d.ts +0 -1
  145. package/dist/client/decorators.test.js +0 -159
  146. package/dist/client/decorators.test.mjs +0 -157
  147. package/dist/client/docs/__testfixtures__/doc-button/input.d.ts +0 -110
  148. package/dist/client/docs/__testfixtures__/doc-button/input.js +0 -204
  149. package/dist/client/docs/__testfixtures__/doc-button/input.mjs +0 -201
  150. package/dist/client/docs/__testfixtures__/doc-button/tsconfig.json +0 -7
  151. package/dist/client/docs/angular-properties.test.d.ts +0 -1
  152. package/dist/client/docs/angular-properties.test.js +0 -36
  153. package/dist/client/docs/angular-properties.test.mjs +0 -34
  154. package/dist/client/docs/sourceDecorator.d.ts +0 -10
  155. package/dist/client/docs/sourceDecorator.js +0 -53
  156. package/dist/client/docs/sourceDecorator.mjs +0 -48
  157. package/dist/client/globals.d.ts +0 -1
  158. package/dist/client/globals.js +0 -33
  159. package/dist/client/globals.mjs +0 -31
  160. package/dist/client/portable-stories.d.ts +0 -23
  161. package/dist/client/portable-stories.js +0 -62
  162. package/dist/client/portable-stories.mjs +0 -26
  163. package/dist/client/public-types.d.ts +0 -54
  164. package/dist/client/public-types.js +0 -2
  165. package/dist/client/public-types.mjs +0 -1
  166. package/dist/client/render.d.ts +0 -7
  167. package/dist/client/render.js +0 -19
  168. package/dist/client/render.mjs +0 -14
  169. package/dist/client/types.js +0 -2
  170. package/dist/client/types.mjs +0 -1
  171. package/dist/node/index.d.ts +0 -2
  172. package/dist/node/index.js +0 -6
  173. package/dist/node/index.mjs +0 -3
  174. package/dist/preset.d.ts +0 -5
  175. package/dist/preset.mjs +0 -34
  176. package/dist/renderer.d.ts +0 -6
  177. package/dist/renderer.js +0 -15
  178. package/dist/renderer.mjs +0 -6
  179. package/dist/server/__mocks-ng-workspace__/empty-projects-entry/angular.json +0 -4
  180. package/dist/server/__mocks-ng-workspace__/minimal-config/angular.json +0 -18
  181. package/dist/server/__mocks-ng-workspace__/minimal-config/src/main.d.ts +0 -1
  182. package/dist/server/__mocks-ng-workspace__/minimal-config/src/main.js +0 -5
  183. package/dist/server/__mocks-ng-workspace__/minimal-config/src/main.mjs +0 -2
  184. package/dist/server/__mocks-ng-workspace__/minimal-config/src/tsconfig.app.json +0 -9
  185. package/dist/server/__mocks-ng-workspace__/minimal-config/tsconfig.json +0 -13
  186. package/dist/server/__mocks-ng-workspace__/some-config/angular.json +0 -19
  187. package/dist/server/__mocks-ng-workspace__/some-config/src/main.d.ts +0 -1
  188. package/dist/server/__mocks-ng-workspace__/some-config/src/main.js +0 -5
  189. package/dist/server/__mocks-ng-workspace__/some-config/src/main.mjs +0 -2
  190. package/dist/server/__mocks-ng-workspace__/some-config/src/tsconfig.app.json +0 -9
  191. package/dist/server/__mocks-ng-workspace__/some-config/tsconfig.json +0 -13
  192. package/dist/server/__mocks-ng-workspace__/with-angularBrowserTarget/angular.json +0 -64
  193. package/dist/server/__mocks-ng-workspace__/with-angularBrowserTarget/src/main.d.ts +0 -1
  194. package/dist/server/__mocks-ng-workspace__/with-angularBrowserTarget/src/main.js +0 -5
  195. package/dist/server/__mocks-ng-workspace__/with-angularBrowserTarget/src/main.mjs +0 -2
  196. package/dist/server/__mocks-ng-workspace__/with-angularBrowserTarget/src/tsconfig.app.json +0 -9
  197. package/dist/server/__mocks-ng-workspace__/with-angularBrowserTarget/tsconfig.json +0 -13
  198. package/dist/server/__mocks-ng-workspace__/with-lib/angular.json +0 -28
  199. package/dist/server/__mocks-ng-workspace__/with-lib/projects/pattern-lib/src/main.d.ts +0 -1
  200. package/dist/server/__mocks-ng-workspace__/with-lib/projects/pattern-lib/src/main.js +0 -5
  201. package/dist/server/__mocks-ng-workspace__/with-lib/projects/pattern-lib/src/main.mjs +0 -2
  202. package/dist/server/__mocks-ng-workspace__/with-lib/projects/pattern-lib/tsconfig.lib.json +0 -20
  203. package/dist/server/__mocks-ng-workspace__/with-lib/tsconfig.json +0 -13
  204. package/dist/server/__mocks-ng-workspace__/with-nx/angular.json +0 -18
  205. package/dist/server/__mocks-ng-workspace__/with-nx/nx.json +0 -3
  206. package/dist/server/__mocks-ng-workspace__/with-nx/src/main.d.ts +0 -1
  207. package/dist/server/__mocks-ng-workspace__/with-nx/src/main.js +0 -5
  208. package/dist/server/__mocks-ng-workspace__/with-nx/src/main.mjs +0 -2
  209. package/dist/server/__mocks-ng-workspace__/with-nx/src/tsconfig.app.json +0 -8
  210. package/dist/server/__mocks-ng-workspace__/with-nx/tsconfig.json +0 -14
  211. package/dist/server/__mocks-ng-workspace__/with-nx-workspace/nx.json +0 -3
  212. package/dist/server/__mocks-ng-workspace__/with-nx-workspace/src/main.d.ts +0 -1
  213. package/dist/server/__mocks-ng-workspace__/with-nx-workspace/src/main.js +0 -5
  214. package/dist/server/__mocks-ng-workspace__/with-nx-workspace/src/main.mjs +0 -2
  215. package/dist/server/__mocks-ng-workspace__/with-nx-workspace/src/tsconfig.app.json +0 -8
  216. package/dist/server/__mocks-ng-workspace__/with-nx-workspace/tsconfig.json +0 -14
  217. package/dist/server/__mocks-ng-workspace__/with-nx-workspace/workspace.json +0 -18
  218. package/dist/server/__mocks-ng-workspace__/with-options-styles/angular.json +0 -18
  219. package/dist/server/__mocks-ng-workspace__/with-options-styles/src/main.d.ts +0 -1
  220. package/dist/server/__mocks-ng-workspace__/with-options-styles/src/main.js +0 -5
  221. package/dist/server/__mocks-ng-workspace__/with-options-styles/src/main.mjs +0 -2
  222. package/dist/server/__mocks-ng-workspace__/with-options-styles/src/tsconfig.app.json +0 -9
  223. package/dist/server/__mocks-ng-workspace__/with-options-styles/tsconfig.json +0 -13
  224. package/dist/server/__mocks-ng-workspace__/without-architect-build/angular.json +0 -5
  225. package/dist/server/__mocks-ng-workspace__/without-architect-build-options/angular.json +0 -11
  226. package/dist/server/__mocks-ng-workspace__/without-compatible-projects/angular.json +0 -7
  227. package/dist/server/__mocks-ng-workspace__/without-projects-entry/angular.json +0 -3
  228. package/dist/server/__mocks-ng-workspace__/without-projects-entry/projects/pattern-lib/src/main.d.ts +0 -1
  229. package/dist/server/__mocks-ng-workspace__/without-projects-entry/projects/pattern-lib/src/main.js +0 -5
  230. package/dist/server/__mocks-ng-workspace__/without-projects-entry/projects/pattern-lib/src/main.mjs +0 -2
  231. package/dist/server/__mocks-ng-workspace__/without-projects-entry/projects/pattern-lib/tsconfig.lib.json +0 -20
  232. package/dist/server/__mocks-ng-workspace__/without-projects-entry/tsconfig.json +0 -13
  233. package/dist/server/__mocks-ng-workspace__/without-tsConfig/angular.json +0 -16
  234. package/dist/server/__mocks-ng-workspace__/without-tsConfig/src/main.d.ts +0 -1
  235. package/dist/server/__mocks-ng-workspace__/without-tsConfig/src/main.js +0 -5
  236. package/dist/server/__mocks-ng-workspace__/without-tsConfig/src/main.mjs +0 -2
  237. package/dist/server/__mocks-ng-workspace__/without-tsConfig/src/tsconfig.app.json +0 -9
  238. package/dist/server/__mocks-ng-workspace__/without-tsConfig/tsconfig.json +0 -13
  239. package/dist/server/__tests__/angular.json +0 -96
  240. package/dist/server/angular-cli-webpack.d.ts +0 -1
  241. package/dist/server/angular-cli-webpack.js +0 -80
  242. package/dist/server/angular-cli-webpack.mjs +0 -80
  243. package/dist/server/framework-preset-angular-cli.d.ts +0 -3
  244. package/dist/server/framework-preset-angular-cli.mjs +0 -81
  245. package/dist/server/framework-preset-angular-ivy.d.ts +0 -10
  246. package/dist/server/framework-preset-angular-ivy.mjs +0 -56
  247. package/dist/server/plugins/storybook-normalize-angular-entry-plugin.d.ts +0 -12
  248. package/dist/server/plugins/storybook-normalize-angular-entry-plugin.js +0 -55
  249. package/dist/server/plugins/storybook-normalize-angular-entry-plugin.mjs +0 -52
  250. package/dist/server/preset-options.d.ts +0 -9
  251. package/dist/server/preset-options.js +0 -2
  252. package/dist/server/preset-options.mjs +0 -1
  253. package/dist/server/utils/filter-out-styling-rules.d.ts +0 -2
  254. package/dist/server/utils/filter-out-styling-rules.js +0 -17
  255. package/dist/server/utils/filter-out-styling-rules.mjs +0 -13
  256. package/dist/server/utils/module-is-available.d.ts +0 -1
  257. package/dist/server/utils/module-is-available.js +0 -13
  258. package/dist/server/utils/module-is-available.mjs +0 -9
  259. package/dist/test-setup.d.ts +0 -1
  260. package/dist/test-setup.js +0 -6
  261. package/dist/test-setup.mjs +0 -4
  262. package/dist/types.d.ts +0 -27
  263. package/dist/types.js +0 -2
  264. package/dist/types.mjs +0 -1
  265. package/scripts/postbuild.js +0 -17
  266. package/template/cli/.eslintrc.json +0 -5
@@ -1,96 +0,0 @@
1
- {
2
- /* angular.json can have comments */
3
- // angular.json can have comments
4
- "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
5
- "version": 1,
6
- "newProjectRoot": "projects",
7
- "projects": {
8
- "angular-cli": {
9
- "root": "",
10
- "sourceRoot": "src",
11
- "projectType": "application",
12
- "prefix": "app",
13
- "schematics": {},
14
- "architect": {
15
- "build": {
16
- "builder": "@angular-devkit/build-angular:browser",
17
- "options": {
18
- "outputPath": "dist/angular-cli",
19
- "index": "src/index.html",
20
- "main": "src/main.ts",
21
- "polyfills": "src/polyfills.ts",
22
- "tsConfig": "src/tsconfig.app.json",
23
- "assets": ["src/favicon.ico", "src/assets"],
24
- "styles": ["src/styles.css", "src/styles.scss"],
25
- "stylePreprocessorOptions": {
26
- "includePaths": ["src/commons"]
27
- },
28
- "scripts": []
29
- },
30
- "configurations": {
31
- "production": {
32
- "fileReplacements": [
33
- {
34
- "replace": "src/environments/environment.ts",
35
- "with": "src/environments/environment.prod.ts"
36
- }
37
- ],
38
- "optimization": true,
39
- "outputHashing": "all",
40
- "sourceMap": false,
41
- "extractCss": true,
42
- "namedChunks": false,
43
- "aot": true,
44
- "extractLicenses": true,
45
- "vendorChunk": false,
46
- "buildOptimizer": true
47
- }
48
- }
49
- },
50
- "serve": {
51
- "builder": "@angular-devkit/build-angular:dev-server",
52
- "options": {
53
- "browserTarget": "angular-cli:build"
54
- },
55
- "configurations": {
56
- "production": {
57
- "browserTarget": "angular-cli:build:production"
58
- }
59
- }
60
- },
61
- "extract-i18n": {
62
- "builder": "@angular-devkit/build-angular:extract-i18n",
63
- "options": {
64
- "browserTarget": "angular-cli:build"
65
- }
66
- },
67
- "test": {
68
- "builder": "@angular-devkit/build-angular:karma",
69
- "options": {
70
- "main": "src/karma.ts",
71
- "polyfills": "src/polyfills.ts",
72
- "tsConfig": "src/tsconfig.spec.json",
73
- "karmaConfig": "src/karma.conf.js",
74
- "styles": ["styles.css"],
75
- "scripts": [],
76
- "assets": ["src/favicon.ico", "src/assets"]
77
- }
78
- }
79
- }
80
- },
81
- "angular-cli-e2e": {
82
- "root": "e2e/",
83
- "projectType": "application",
84
- "architect": {
85
- "e2e": {
86
- "builder": "@angular-devkit/build-angular:protractor",
87
- "options": {
88
- "protractorConfig": "e2e/protractor.conf.js",
89
- "devServerTarget": "angular-cli:serve"
90
- }
91
- }
92
- }
93
- }
94
- },
95
- "defaultProject": "angular-cli"
96
- }
@@ -1 +0,0 @@
1
- export function getWebpackConfig(baseConfig: any, { builderOptions, builderContext }: any): Promise<any>;
@@ -1,80 +0,0 @@
1
- "use strict";
2
- // Private angular devkit stuff
3
- const { generateI18nBrowserWebpackConfigFromContext, } = require('@angular-devkit/build-angular/src/utils/webpack-browser-config');
4
- const TsconfigPathsPlugin = require('tsconfig-paths-webpack-plugin');
5
- const { filterOutStylingRules } = require('./utils/filter-out-styling-rules');
6
- const { default: StorybookNormalizeAngularEntryPlugin, } = require('./plugins/storybook-normalize-angular-entry-plugin');
7
- const { getCommonConfig, getStylesConfig, getDevServerConfig, getTypeScriptConfig, } = require('@angular-devkit/build-angular/src/tools/webpack/configs');
8
- /**
9
- * Extract webpack config from angular-cli 13.x.x ⚠️ This file is in JavaScript to not use
10
- * TypeScript. Because current storybook TypeScript version is not compatible with Angular CLI.
11
- * FIXME: Try another way with TypeScript on future storybook version (7 maybe 🤞)
12
- *
13
- * @param {any} baseConfig Previous webpack config from storybook
14
- * @param {any} options { builderOptions, builderContext }
15
- */
16
- exports.getWebpackConfig = async (baseConfig, { builderOptions, builderContext }) => {
17
- /** Get angular-cli Webpack config */
18
- const { config: cliConfig } = await generateI18nBrowserWebpackConfigFromContext({
19
- // Default options
20
- index: 'noop-index',
21
- main: 'noop-main',
22
- // Options provided by user
23
- ...builderOptions,
24
- styles: builderOptions.styles
25
- ?.map((style) => (typeof style === 'string' ? style : style.input))
26
- .filter((style) => typeof style === 'string' || style.inject !== false),
27
- outputPath: typeof builderOptions.outputPath === 'string'
28
- ? builderOptions.outputPath
29
- : (builderOptions.outputPath?.base ?? 'noop-out'),
30
- // Fixed options
31
- optimization: false,
32
- namedChunks: false,
33
- progress: false,
34
- buildOptimizer: false,
35
- aot: false,
36
- }, builderContext, (wco) => [
37
- getCommonConfig(wco),
38
- getStylesConfig(wco),
39
- getTypeScriptConfig ? getTypeScriptConfig(wco) : getDevServerConfig(wco),
40
- ]);
41
- if (!builderOptions.experimentalZoneless && !cliConfig.entry.polyfills?.includes('zone.js')) {
42
- cliConfig.entry.polyfills.push('zone.js');
43
- }
44
- /** Merge baseConfig Webpack with angular-cli Webpack */
45
- const entry = [
46
- ...(cliConfig.entry.polyfills ?? []),
47
- ...baseConfig.entry,
48
- ...(cliConfig.entry.styles ?? []),
49
- ];
50
- // Don't use storybooks styling rules because we have to use rules created by @angular-devkit/build-angular
51
- // because @angular-devkit/build-angular created rules have include/exclude for global style files.
52
- const rulesExcludingStyles = filterOutStylingRules(baseConfig);
53
- const module = {
54
- ...baseConfig.module,
55
- rules: [...cliConfig.module.rules, ...rulesExcludingStyles],
56
- };
57
- const plugins = [
58
- ...(cliConfig.plugins ?? []),
59
- ...baseConfig.plugins,
60
- new StorybookNormalizeAngularEntryPlugin(),
61
- ];
62
- const resolve = {
63
- ...baseConfig.resolve,
64
- modules: Array.from(new Set([...baseConfig.resolve.modules, ...cliConfig.resolve.modules])),
65
- plugins: [
66
- new TsconfigPathsPlugin({
67
- configFile: builderOptions.tsConfig,
68
- mainFields: ['browser', 'module', 'main'],
69
- }),
70
- ],
71
- };
72
- return {
73
- ...baseConfig,
74
- entry,
75
- module,
76
- plugins,
77
- resolve,
78
- resolveLoader: cliConfig.resolveLoader,
79
- };
80
- };
@@ -1,80 +0,0 @@
1
- "use strict";
2
- // Private angular devkit stuff
3
- const { generateI18nBrowserWebpackConfigFromContext, } = require('@angular-devkit/build-angular/src/utils/webpack-browser-config');
4
- const TsconfigPathsPlugin = require('tsconfig-paths-webpack-plugin');
5
- const { filterOutStylingRules } = require('./utils/filter-out-styling-rules');
6
- const { default: StorybookNormalizeAngularEntryPlugin, } = require('./plugins/storybook-normalize-angular-entry-plugin');
7
- const { getCommonConfig, getStylesConfig, getDevServerConfig, getTypeScriptConfig, } = require('@angular-devkit/build-angular/src/tools/webpack/configs');
8
- /**
9
- * Extract webpack config from angular-cli 13.x.x ⚠️ This file is in JavaScript to not use
10
- * TypeScript. Because current storybook TypeScript version is not compatible with Angular CLI.
11
- * FIXME: Try another way with TypeScript on future storybook version (7 maybe 🤞)
12
- *
13
- * @param {any} baseConfig Previous webpack config from storybook
14
- * @param {any} options { builderOptions, builderContext }
15
- */
16
- exports.getWebpackConfig = async (baseConfig, { builderOptions, builderContext }) => {
17
- /** Get angular-cli Webpack config */
18
- const { config: cliConfig } = await generateI18nBrowserWebpackConfigFromContext({
19
- // Default options
20
- index: 'noop-index',
21
- main: 'noop-main',
22
- // Options provided by user
23
- ...builderOptions,
24
- styles: builderOptions.styles
25
- ?.map((style) => (typeof style === 'string' ? style : style.input))
26
- .filter((style) => typeof style === 'string' || style.inject !== false),
27
- outputPath: typeof builderOptions.outputPath === 'string'
28
- ? builderOptions.outputPath
29
- : (builderOptions.outputPath?.base ?? 'noop-out'),
30
- // Fixed options
31
- optimization: false,
32
- namedChunks: false,
33
- progress: false,
34
- buildOptimizer: false,
35
- aot: false,
36
- }, builderContext, (wco) => [
37
- getCommonConfig(wco),
38
- getStylesConfig(wco),
39
- getTypeScriptConfig ? getTypeScriptConfig(wco) : getDevServerConfig(wco),
40
- ]);
41
- if (!builderOptions.experimentalZoneless && !cliConfig.entry.polyfills?.includes('zone.js')) {
42
- cliConfig.entry.polyfills.push('zone.js');
43
- }
44
- /** Merge baseConfig Webpack with angular-cli Webpack */
45
- const entry = [
46
- ...(cliConfig.entry.polyfills ?? []),
47
- ...baseConfig.entry,
48
- ...(cliConfig.entry.styles ?? []),
49
- ];
50
- // Don't use storybooks styling rules because we have to use rules created by @angular-devkit/build-angular
51
- // because @angular-devkit/build-angular created rules have include/exclude for global style files.
52
- const rulesExcludingStyles = filterOutStylingRules(baseConfig);
53
- const module = {
54
- ...baseConfig.module,
55
- rules: [...cliConfig.module.rules, ...rulesExcludingStyles],
56
- };
57
- const plugins = [
58
- ...(cliConfig.plugins ?? []),
59
- ...baseConfig.plugins,
60
- new StorybookNormalizeAngularEntryPlugin(),
61
- ];
62
- const resolve = {
63
- ...baseConfig.resolve,
64
- modules: Array.from(new Set([...baseConfig.resolve.modules, ...cliConfig.resolve.modules])),
65
- plugins: [
66
- new TsconfigPathsPlugin({
67
- configFile: builderOptions.tsConfig,
68
- mainFields: ['browser', 'module', 'main'],
69
- }),
70
- ],
71
- };
72
- return {
73
- ...baseConfig,
74
- entry,
75
- module,
76
- plugins,
77
- resolve,
78
- resolveLoader: cliConfig.resolveLoader,
79
- };
80
- };
@@ -1,3 +0,0 @@
1
- import webpack from 'webpack';
2
- import { PresetOptions } from './preset-options';
3
- export declare function webpackFinal(baseConfig: webpack.Configuration, options: PresetOptions): Promise<any>;
@@ -1,81 +0,0 @@
1
- import { logger } from 'storybook/internal/node-logger';
2
- import { AngularLegacyBuildOptionsError } from 'storybook/internal/server-errors';
3
- import { WebpackDefinePlugin, WebpackIgnorePlugin } from '@storybook/builder-webpack5';
4
- import { targetFromTargetString } from '@angular-devkit/architect';
5
- import { logging } from '@angular-devkit/core';
6
- import { sync as findUpSync } from 'find-up';
7
- import { getWebpackConfig as getCustomWebpackConfig } from './angular-cli-webpack';
8
- import { moduleIsAvailable } from './utils/module-is-available';
9
- export async function webpackFinal(baseConfig, options) {
10
- if (!moduleIsAvailable('@angular-devkit/build-angular')) {
11
- logger.info('=> Using base config because "@angular-devkit/build-angular" is not installed');
12
- return baseConfig;
13
- }
14
- checkForLegacyBuildOptions(options);
15
- const builderContext = getBuilderContext(options);
16
- const builderOptions = await getBuilderOptions(options, builderContext);
17
- const webpackConfig = await getCustomWebpackConfig(baseConfig, {
18
- builderOptions: {
19
- watch: options.configType === 'DEVELOPMENT',
20
- ...builderOptions,
21
- },
22
- builderContext,
23
- });
24
- webpackConfig.plugins = webpackConfig.plugins ?? [];
25
- webpackConfig.plugins.push(new WebpackDefinePlugin({
26
- STORYBOOK_ANGULAR_OPTIONS: JSON.stringify({
27
- experimentalZoneless: builderOptions.experimentalZoneless,
28
- }),
29
- }));
30
- try {
31
- require.resolve('@angular/animations');
32
- }
33
- catch (e) {
34
- webpackConfig.plugins.push(new WebpackIgnorePlugin({
35
- resourceRegExp: /@angular\/platform-browser\/animations$/,
36
- }));
37
- }
38
- return webpackConfig;
39
- }
40
- /** Get Builder Context If storybook is not start by angular builder create dumb BuilderContext */
41
- function getBuilderContext(options) {
42
- return (options.angularBuilderContext ??
43
- {
44
- target: { project: 'noop-project', builder: '', options: {} },
45
- workspaceRoot: process.cwd(),
46
- getProjectMetadata: () => ({}),
47
- getTargetOptions: () => ({}),
48
- logger: new logging.Logger('Storybook'),
49
- });
50
- }
51
- /** Get builder options Merge target options from browser target and from storybook options */
52
- async function getBuilderOptions(options, builderContext) {
53
- /** Get Browser Target options */
54
- let browserTargetOptions = {};
55
- if (options.angularBrowserTarget) {
56
- const browserTarget = targetFromTargetString(options.angularBrowserTarget);
57
- logger.info(`=> Using angular browser target options from "${browserTarget.project}:${browserTarget.target}${browserTarget.configuration ? `:${browserTarget.configuration}` : ''}"`);
58
- browserTargetOptions = await builderContext.getTargetOptions(browserTarget);
59
- }
60
- /** Merge target options from browser target options and from storybook options */
61
- const builderOptions = {
62
- ...browserTargetOptions,
63
- ...options.angularBuilderOptions,
64
- tsConfig: options.tsConfig ??
65
- findUpSync('tsconfig.json', { cwd: options.configDir }) ??
66
- browserTargetOptions.tsConfig,
67
- };
68
- logger.info(`=> Using angular project with "tsConfig:${builderOptions.tsConfig}"`);
69
- return builderOptions;
70
- }
71
- /**
72
- * Checks if using legacy configuration that doesn't use builder and logs message referring to
73
- * migration docs.
74
- */
75
- function checkForLegacyBuildOptions(options) {
76
- if (options.angularBrowserTarget !== undefined) {
77
- // Not use legacy way with builder (`angularBrowserTarget` is defined or null with builder and undefined without)
78
- return;
79
- }
80
- throw new AngularLegacyBuildOptionsError();
81
- }
@@ -1,10 +0,0 @@
1
- import { Configuration } from 'webpack';
2
- import { PresetOptions } from './preset-options';
3
- /**
4
- * Run ngcc for converting modules to ivy format before starting storybook This step is needed in
5
- * order to support Ivy in storybook
6
- *
7
- * Information about Ivy can be found here https://angular.io/guide/ivy
8
- */
9
- export declare const runNgcc: () => Promise<void>;
10
- export declare const webpack: (webpackConfig: Configuration, options: PresetOptions) => Promise<Configuration>;
@@ -1,56 +0,0 @@
1
- import { join } from 'node:path';
2
- /**
3
- * Source :
4
- * https://github.com/angular/angular-cli/blob/ebccb5de4a455af813c5e82483db6af20666bdbd/packages/angular_devkit/build_angular/src/utils/load-esm.ts#L23
5
- * This uses a dynamic import to load a module which may be ESM. CommonJS code can load ESM code via
6
- * a dynamic import. Unfortunately, TypeScript will currently, unconditionally downlevel dynamic
7
- * import into a require call. require calls cannot load ESM code and will result in a runtime
8
- * error. To workaround this, a Function constructor is used to prevent TypeScript from changing the
9
- * dynamic import. Once TypeScript provides support for keeping the dynamic import this workaround
10
- * can be dropped.
11
- *
12
- * @param modulePath The path of the module to load.
13
- * @returns A Promise that resolves to the dynamically imported module.
14
- */
15
- function loadEsmModule(modulePath) {
16
- // eslint-disable-next-line @typescript-eslint/no-implied-eval
17
- return new Function('modulePath', `return import(modulePath);`)(modulePath);
18
- }
19
- /**
20
- * Run ngcc for converting modules to ivy format before starting storybook This step is needed in
21
- * order to support Ivy in storybook
22
- *
23
- * Information about Ivy can be found here https://angular.io/guide/ivy
24
- */
25
- export const runNgcc = async () => {
26
- let ngcc;
27
- try {
28
- ngcc = require('@angular/compiler-cli/ngcc');
29
- }
30
- catch (error) {
31
- ngcc = await loadEsmModule('@angular/compiler-cli/ngcc');
32
- }
33
- ngcc.process({
34
- // should be async: true but does not work due to
35
- // https://github.com/storybookjs/storybook/pull/11157/files#r615413803
36
- async: false,
37
- basePath: join(process.cwd(), 'node_modules'), // absolute path to node_modules
38
- createNewEntryPointFormats: true, // --create-ivy-entry-points
39
- compileAllFormats: false, // --first-only
40
- });
41
- };
42
- export const webpack = async (webpackConfig, options) => {
43
- const framework = await options.presets.apply('framework');
44
- const angularOptions = (typeof framework === 'object' ? framework.options : {});
45
- // Default to true, if undefined
46
- if (angularOptions.enableIvy === false) {
47
- return webpackConfig;
48
- }
49
- return {
50
- ...webpackConfig,
51
- resolve: {
52
- ...webpackConfig.resolve,
53
- mainFields: ['browser', 'module', 'main'],
54
- },
55
- };
56
- };
@@ -1,12 +0,0 @@
1
- /**
2
- * This plugin is designed to modify the Webpack configuration for Storybook projects that use
3
- * Angular, specifically to prevent multiple runtime bundle issues by merging 'main' and 'styles'
4
- * entry points. It ensures that only one runtime bundle is generated to avoid
5
- * '**webpack_require**.nmd is not a function' errors.
6
- */
7
- export default class StorybookNormalizeAngularEntryPlugin {
8
- constructor(options: any);
9
- options: any;
10
- apply(compiler: any): void;
11
- compilation: any;
12
- }
@@ -1,55 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const PLUGIN_NAME = 'storybook-normalize-angular-entry-plugin';
4
- /**
5
- * This plugin is designed to modify the Webpack configuration for Storybook projects that use
6
- * Angular, specifically to prevent multiple runtime bundle issues by merging 'main' and 'styles'
7
- * entry points. It ensures that only one runtime bundle is generated to avoid
8
- * '**webpack_require**.nmd is not a function' errors.
9
- */
10
- class StorybookNormalizeAngularEntryPlugin {
11
- constructor(options) {
12
- this.options = options; // Store options if future configuration is needed
13
- }
14
- apply(compiler) {
15
- compiler.hooks.environment.tap(PLUGIN_NAME, () => {
16
- // Store the original entry configuration
17
- const originalEntry = compiler.options.entry;
18
- // Overwrite the entry configuration to normalize it
19
- compiler.options.entry = async () => {
20
- let entryResult;
21
- // Handle the case where the original entry is a function, which could be async
22
- if (typeof originalEntry === 'function') {
23
- try {
24
- // Execute the function and await its result, in case it returns a promise
25
- entryResult = await originalEntry();
26
- }
27
- catch (error) {
28
- // Log the error and re-throw it to ensure it's visible and doesn't silently fail
29
- console.error('Failed to execute the entry function:', error);
30
- throw error;
31
- }
32
- }
33
- else {
34
- // If the original entry is not a function, use it as is
35
- entryResult = originalEntry;
36
- }
37
- // Merge 'main' and 'styles' entries if both exist
38
- if (entryResult && entryResult.main && entryResult.styles) {
39
- // Combine and deduplicate imports from 'main' and 'styles'
40
- return {
41
- main: {
42
- import: Array.from(new Set([...entryResult.main.import, ...entryResult.styles.import])),
43
- },
44
- };
45
- }
46
- // If not both 'main' and 'styles' are present, return the original or resolved entry result
47
- return entryResult;
48
- };
49
- });
50
- compiler.hooks.thisCompilation.tap(PLUGIN_NAME, (compilation) => {
51
- this.compilation = compilation;
52
- });
53
- }
54
- }
55
- exports.default = StorybookNormalizeAngularEntryPlugin;
@@ -1,52 +0,0 @@
1
- const PLUGIN_NAME = 'storybook-normalize-angular-entry-plugin';
2
- /**
3
- * This plugin is designed to modify the Webpack configuration for Storybook projects that use
4
- * Angular, specifically to prevent multiple runtime bundle issues by merging 'main' and 'styles'
5
- * entry points. It ensures that only one runtime bundle is generated to avoid
6
- * '**webpack_require**.nmd is not a function' errors.
7
- */
8
- export default class StorybookNormalizeAngularEntryPlugin {
9
- constructor(options) {
10
- this.options = options; // Store options if future configuration is needed
11
- }
12
- apply(compiler) {
13
- compiler.hooks.environment.tap(PLUGIN_NAME, () => {
14
- // Store the original entry configuration
15
- const originalEntry = compiler.options.entry;
16
- // Overwrite the entry configuration to normalize it
17
- compiler.options.entry = async () => {
18
- let entryResult;
19
- // Handle the case where the original entry is a function, which could be async
20
- if (typeof originalEntry === 'function') {
21
- try {
22
- // Execute the function and await its result, in case it returns a promise
23
- entryResult = await originalEntry();
24
- }
25
- catch (error) {
26
- // Log the error and re-throw it to ensure it's visible and doesn't silently fail
27
- console.error('Failed to execute the entry function:', error);
28
- throw error;
29
- }
30
- }
31
- else {
32
- // If the original entry is not a function, use it as is
33
- entryResult = originalEntry;
34
- }
35
- // Merge 'main' and 'styles' entries if both exist
36
- if (entryResult && entryResult.main && entryResult.styles) {
37
- // Combine and deduplicate imports from 'main' and 'styles'
38
- return {
39
- main: {
40
- import: Array.from(new Set([...entryResult.main.import, ...entryResult.styles.import])),
41
- },
42
- };
43
- }
44
- // If not both 'main' and 'styles' are present, return the original or resolved entry result
45
- return entryResult;
46
- };
47
- });
48
- compiler.hooks.thisCompilation.tap(PLUGIN_NAME, (compilation) => {
49
- this.compilation = compilation;
50
- });
51
- }
52
- }
@@ -1,9 +0,0 @@
1
- import { Options as CoreOptions } from 'storybook/internal/types';
2
- import { BuilderContext } from '@angular-devkit/architect';
3
- import { StandaloneOptions } from '../builders/utils/standalone-options';
4
- export type PresetOptions = CoreOptions & {
5
- angularBrowserTarget?: string | null;
6
- angularBuilderOptions?: StandaloneOptions['angularBuilderOptions'];
7
- angularBuilderContext?: BuilderContext | null;
8
- tsConfig?: string;
9
- };
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1 +0,0 @@
1
- export {};
@@ -1,2 +0,0 @@
1
- import { Configuration, RuleSetRule } from 'webpack';
2
- export declare const filterOutStylingRules: (config: Configuration) => RuleSetRule[];
@@ -1,17 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.filterOutStylingRules = void 0;
4
- const isStylingRule = (rule) => {
5
- const { test } = rule;
6
- if (!test) {
7
- return false;
8
- }
9
- if (!(test instanceof RegExp)) {
10
- return false;
11
- }
12
- return test.test('.css') || test.test('.scss') || test.test('.sass');
13
- };
14
- const filterOutStylingRules = (config) => {
15
- return config.module.rules.filter((rule) => !isStylingRule(rule));
16
- };
17
- exports.filterOutStylingRules = filterOutStylingRules;
@@ -1,13 +0,0 @@
1
- const isStylingRule = (rule) => {
2
- const { test } = rule;
3
- if (!test) {
4
- return false;
5
- }
6
- if (!(test instanceof RegExp)) {
7
- return false;
8
- }
9
- return test.test('.css') || test.test('.scss') || test.test('.sass');
10
- };
11
- export const filterOutStylingRules = (config) => {
12
- return config.module.rules.filter((rule) => !isStylingRule(rule));
13
- };
@@ -1 +0,0 @@
1
- export declare const moduleIsAvailable: (moduleName: string) => boolean;
@@ -1,13 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.moduleIsAvailable = void 0;
4
- const moduleIsAvailable = (moduleName) => {
5
- try {
6
- require.resolve(moduleName);
7
- return true;
8
- }
9
- catch (e) {
10
- return false;
11
- }
12
- };
13
- exports.moduleIsAvailable = moduleIsAvailable;
@@ -1,9 +0,0 @@
1
- export const moduleIsAvailable = (moduleName) => {
2
- try {
3
- require.resolve(moduleName);
4
- return true;
5
- }
6
- catch (e) {
7
- return false;
8
- }
9
- };
@@ -1 +0,0 @@
1
- import '@analogjs/vite-plugin-angular/setup-vitest';
@@ -1,6 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- require("@analogjs/vite-plugin-angular/setup-vitest");
4
- const testing_1 = require("@angular/core/testing");
5
- const testing_2 = require("@angular/platform-browser-dynamic/testing");
6
- (0, testing_1.getTestBed)().initTestEnvironment(testing_2.BrowserDynamicTestingModule, (0, testing_2.platformBrowserDynamicTesting)());
@@ -1,4 +0,0 @@
1
- import '@analogjs/vite-plugin-angular/setup-vitest';
2
- import { getTestBed } from '@angular/core/testing';
3
- import { BrowserDynamicTestingModule, platformBrowserDynamicTesting, } from '@angular/platform-browser-dynamic/testing';
4
- getTestBed().initTestEnvironment(BrowserDynamicTestingModule, platformBrowserDynamicTesting());