@storybook/angular 6.4.0-beta.20 → 6.4.0-beta.24

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 (212) hide show
  1. package/package.json +9 -9
  2. package/types-7-0.d.ts +1 -0
  3. package/dist/ts3.4/builders/build-storybook/index.d.ts +0 -12
  4. package/dist/ts3.4/builders/start-storybook/index.d.ts +0 -12
  5. package/dist/ts3.4/builders/utils/build-standalone-errors-handler.d.ts +0 -1
  6. package/dist/ts3.4/builders/utils/run-compodoc.d.ts +0 -6
  7. package/dist/ts3.4/client/index.d.ts +0 -4
  8. package/dist/ts3.4/client/preview/angular/app.token.d.ts +0 -3
  9. package/dist/ts3.4/client/preview/angular/components/app.component.d.ts +0 -38
  10. package/dist/ts3.4/client/preview/angular/helpers.d.ts +0 -8
  11. package/dist/ts3.4/client/preview/angular-beta/AbstractRenderer.d.ts +0 -44
  12. package/dist/ts3.4/client/preview/angular-beta/CanvasRenderer.d.ts +0 -14
  13. package/dist/ts3.4/client/preview/angular-beta/ComputesTemplateFromComponent.d.ts +0 -17
  14. package/dist/ts3.4/client/preview/angular-beta/DocsRenderer.d.ts +0 -14
  15. package/dist/ts3.4/client/preview/angular-beta/RendererFactory.d.ts +0 -11
  16. package/dist/ts3.4/client/preview/angular-beta/StorybookModule.d.ts +0 -9
  17. package/dist/ts3.4/client/preview/angular-beta/StorybookProvider.d.ts +0 -5
  18. package/dist/ts3.4/client/preview/angular-beta/StorybookWrapperComponent.d.ts +0 -9
  19. package/dist/ts3.4/client/preview/angular-beta/utils/NgComponentAnalyzer.d.ts +0 -26
  20. package/dist/ts3.4/client/preview/angular-beta/utils/NgModulesAnalyzer.d.ts +0 -6
  21. package/dist/ts3.4/client/preview/angular-polyfills.d.ts +0 -41
  22. package/dist/ts3.4/client/preview/config.d.ts +0 -4
  23. package/dist/ts3.4/client/preview/decorateStory.d.ts +0 -3
  24. package/dist/ts3.4/client/preview/decorators.d.ts +0 -6
  25. package/dist/ts3.4/client/preview/globals.d.ts +0 -1
  26. package/dist/ts3.4/client/preview/index.d.ts +0 -25
  27. package/dist/ts3.4/client/preview/render.d.ts +0 -7
  28. package/dist/ts3.4/client/preview/types-6-0.d.ts +0 -42
  29. package/dist/ts3.4/client/preview/types-7-0.d.ts +0 -9
  30. package/dist/ts3.4/client/preview/types.d.ts +0 -29
  31. package/dist/ts3.4/demo/button.component.d.ts +0 -5
  32. package/dist/ts3.4/demo/welcome.component.d.ts +0 -4
  33. package/dist/ts3.4/public_api.d.ts +0 -1
  34. package/dist/ts3.4/renderer.d.ts +0 -4
  35. package/dist/ts3.4/server/__mocks-ng-workspace__/minimal-config/src/main.d.ts +0 -1
  36. package/dist/ts3.4/server/__mocks-ng-workspace__/some-config/src/main.d.ts +0 -1
  37. package/dist/ts3.4/server/__mocks-ng-workspace__/with-angularBrowserTarget/src/main.d.ts +0 -1
  38. package/dist/ts3.4/server/__mocks-ng-workspace__/with-lib/projects/pattern-lib/src/main.d.ts +0 -1
  39. package/dist/ts3.4/server/__mocks-ng-workspace__/with-nx/src/main.d.ts +0 -1
  40. package/dist/ts3.4/server/__mocks-ng-workspace__/with-nx-workspace/src/main.d.ts +0 -1
  41. package/dist/ts3.4/server/__mocks-ng-workspace__/with-options-styles/src/main.d.ts +0 -1
  42. package/dist/ts3.4/server/__mocks-ng-workspace__/without-projects-entry/projects/pattern-lib/src/main.d.ts +0 -1
  43. package/dist/ts3.4/server/__mocks-ng-workspace__/without-tsConfig/src/main.d.ts +0 -1
  44. package/dist/ts3.4/server/angular-devkit-build-webpack.d.ts +0 -30
  45. package/dist/ts3.4/server/angular-read-workspace.d.ts +0 -13
  46. package/dist/ts3.4/server/build.d.ts +0 -1
  47. package/dist/ts3.4/server/create-fork-ts-checker-plugin.d.ts +0 -3
  48. package/dist/ts3.4/server/framework-preset-angular-cli.d.ts +0 -73
  49. package/dist/ts3.4/server/framework-preset-angular-ivy.d.ts +0 -10
  50. package/dist/ts3.4/server/framework-preset-angular.d.ts +0 -4
  51. package/dist/ts3.4/server/index.d.ts +0 -1
  52. package/dist/ts3.4/server/ngx-template-loader/index.d.ts +0 -1
  53. package/dist/ts3.4/server/options.d.ts +0 -3
  54. package/dist/ts3.4/server/preset.d.ts +0 -3
  55. package/dist/ts3.4/server/ts_config.d.ts +0 -2
  56. package/dist/ts3.4/server/utils/filter-out-styling-rules.d.ts +0 -2
  57. package/dist/ts3.4/server/utils/module-is-available.d.ts +0 -1
  58. package/dist/ts3.4/server/utils/normalize-asset-patterns.d.ts +0 -6
  59. package/dist/ts3.4/server/utils/normalize-optimization.d.ts +0 -3
  60. package/dist/ts3.4/types/index.d.ts +0 -6
  61. package/dist/ts3.9/builders/build-storybook/index.d.ts +0 -12
  62. package/dist/ts3.9/builders/build-storybook/index.js +0 -114
  63. package/dist/ts3.9/builders/build-storybook/schema.json +0 -72
  64. package/dist/ts3.9/builders/builders.json +0 -14
  65. package/dist/ts3.9/builders/start-storybook/index.d.ts +0 -12
  66. package/dist/ts3.9/builders/start-storybook/index.js +0 -117
  67. package/dist/ts3.9/builders/start-storybook/schema.json +0 -99
  68. package/dist/ts3.9/builders/utils/build-standalone-errors-handler.d.ts +0 -1
  69. package/dist/ts3.9/builders/utils/build-standalone-errors-handler.js +0 -36
  70. package/dist/ts3.9/builders/utils/run-compodoc.d.ts +0 -6
  71. package/dist/ts3.9/builders/utils/run-compodoc.js +0 -45
  72. package/dist/ts3.9/client/index.d.ts +0 -4
  73. package/dist/ts3.9/client/index.js +0 -28
  74. package/dist/ts3.9/client/preview/angular/app.token.d.ts +0 -3
  75. package/dist/ts3.9/client/preview/angular/app.token.js +0 -5
  76. package/dist/ts3.9/client/preview/angular/components/app.component.d.ts +0 -38
  77. package/dist/ts3.9/client/preview/angular/components/app.component.js +0 -146
  78. package/dist/ts3.9/client/preview/angular/helpers.d.ts +0 -8
  79. package/dist/ts3.9/client/preview/angular/helpers.js +0 -165
  80. package/dist/ts3.9/client/preview/angular-beta/AbstractRenderer.d.ts +0 -44
  81. package/dist/ts3.9/client/preview/angular-beta/AbstractRenderer.js +0 -215
  82. package/dist/ts3.9/client/preview/angular-beta/CanvasRenderer.d.ts +0 -14
  83. package/dist/ts3.9/client/preview/angular-beta/CanvasRenderer.js +0 -97
  84. package/dist/ts3.9/client/preview/angular-beta/ComputesTemplateFromComponent.d.ts +0 -17
  85. package/dist/ts3.9/client/preview/angular-beta/ComputesTemplateFromComponent.js +0 -112
  86. package/dist/ts3.9/client/preview/angular-beta/DocsRenderer.d.ts +0 -14
  87. package/dist/ts3.9/client/preview/angular-beta/DocsRenderer.js +0 -145
  88. package/dist/ts3.9/client/preview/angular-beta/RendererFactory.d.ts +0 -11
  89. package/dist/ts3.9/client/preview/angular-beta/RendererFactory.js +0 -101
  90. package/dist/ts3.9/client/preview/angular-beta/StorybookModule.d.ts +0 -9
  91. package/dist/ts3.9/client/preview/angular-beta/StorybookModule.js +0 -78
  92. package/dist/ts3.9/client/preview/angular-beta/StorybookProvider.d.ts +0 -5
  93. package/dist/ts3.9/client/preview/angular-beta/StorybookProvider.js +0 -27
  94. package/dist/ts3.9/client/preview/angular-beta/StorybookWrapperComponent.d.ts +0 -9
  95. package/dist/ts3.9/client/preview/angular-beta/StorybookWrapperComponent.js +0 -155
  96. package/dist/ts3.9/client/preview/angular-beta/utils/NgComponentAnalyzer.d.ts +0 -26
  97. package/dist/ts3.9/client/preview/angular-beta/utils/NgComponentAnalyzer.js +0 -124
  98. package/dist/ts3.9/client/preview/angular-beta/utils/NgModulesAnalyzer.d.ts +0 -6
  99. package/dist/ts3.9/client/preview/angular-beta/utils/NgModulesAnalyzer.js +0 -44
  100. package/dist/ts3.9/client/preview/angular-polyfills.d.ts +0 -41
  101. package/dist/ts3.9/client/preview/angular-polyfills.js +0 -61
  102. package/dist/ts3.9/client/preview/config.d.ts +0 -4
  103. package/dist/ts3.9/client/preview/config.js +0 -7
  104. package/dist/ts3.9/client/preview/decorateStory.d.ts +0 -3
  105. package/dist/ts3.9/client/preview/decorateStory.js +0 -62
  106. package/dist/ts3.9/client/preview/decorators.d.ts +0 -6
  107. package/dist/ts3.9/client/preview/decorators.js +0 -49
  108. package/dist/ts3.9/client/preview/globals.d.ts +0 -1
  109. package/dist/ts3.9/client/preview/globals.js +0 -9
  110. package/dist/ts3.9/client/preview/index.d.ts +0 -25
  111. package/dist/ts3.9/client/preview/index.js +0 -40
  112. package/dist/ts3.9/client/preview/render.d.ts +0 -7
  113. package/dist/ts3.9/client/preview/render.js +0 -73
  114. package/dist/ts3.9/client/preview/types-6-0.d.ts +0 -42
  115. package/dist/ts3.9/client/preview/types-6-0.js +0 -2
  116. package/dist/ts3.9/client/preview/types-7-0.d.ts +0 -9
  117. package/dist/ts3.9/client/preview/types-7-0.js +0 -2
  118. package/dist/ts3.9/client/preview/types.d.ts +0 -29
  119. package/dist/ts3.9/client/preview/types.js +0 -2
  120. package/dist/ts3.9/demo/button.component.d.ts +0 -5
  121. package/dist/ts3.9/demo/button.component.js +0 -37
  122. package/dist/ts3.9/demo/welcome.component.d.ts +0 -4
  123. package/dist/ts3.9/demo/welcome.component.js +0 -32
  124. package/dist/ts3.9/public_api.d.ts +0 -1
  125. package/dist/ts3.9/public_api.js +0 -24
  126. package/dist/ts3.9/renderer.d.ts +0 -4
  127. package/dist/ts3.9/renderer.js +0 -10
  128. package/dist/ts3.9/server/__mocks-ng-workspace__/empty-projects-entry/angular.json +0 -4
  129. package/dist/ts3.9/server/__mocks-ng-workspace__/minimal-config/angular.json +0 -17
  130. package/dist/ts3.9/server/__mocks-ng-workspace__/minimal-config/src/main.d.ts +0 -1
  131. package/dist/ts3.9/server/__mocks-ng-workspace__/minimal-config/src/main.js +0 -5
  132. package/dist/ts3.9/server/__mocks-ng-workspace__/minimal-config/src/tsconfig.app.json +0 -9
  133. package/dist/ts3.9/server/__mocks-ng-workspace__/minimal-config/tsconfig.json +0 -13
  134. package/dist/ts3.9/server/__mocks-ng-workspace__/some-config/angular.json +0 -18
  135. package/dist/ts3.9/server/__mocks-ng-workspace__/some-config/src/main.d.ts +0 -1
  136. package/dist/ts3.9/server/__mocks-ng-workspace__/some-config/src/main.js +0 -5
  137. package/dist/ts3.9/server/__mocks-ng-workspace__/some-config/src/tsconfig.app.json +0 -9
  138. package/dist/ts3.9/server/__mocks-ng-workspace__/some-config/tsconfig.json +0 -13
  139. package/dist/ts3.9/server/__mocks-ng-workspace__/with-angularBrowserTarget/angular.json +0 -60
  140. package/dist/ts3.9/server/__mocks-ng-workspace__/with-angularBrowserTarget/src/main.d.ts +0 -1
  141. package/dist/ts3.9/server/__mocks-ng-workspace__/with-angularBrowserTarget/src/main.js +0 -5
  142. package/dist/ts3.9/server/__mocks-ng-workspace__/with-angularBrowserTarget/src/tsconfig.app.json +0 -9
  143. package/dist/ts3.9/server/__mocks-ng-workspace__/with-angularBrowserTarget/tsconfig.json +0 -13
  144. package/dist/ts3.9/server/__mocks-ng-workspace__/with-lib/angular.json +0 -28
  145. package/dist/ts3.9/server/__mocks-ng-workspace__/with-lib/projects/pattern-lib/src/main.d.ts +0 -1
  146. package/dist/ts3.9/server/__mocks-ng-workspace__/with-lib/projects/pattern-lib/src/main.js +0 -5
  147. package/dist/ts3.9/server/__mocks-ng-workspace__/with-lib/projects/pattern-lib/tsconfig.lib.json +0 -25
  148. package/dist/ts3.9/server/__mocks-ng-workspace__/with-lib/tsconfig.json +0 -13
  149. package/dist/ts3.9/server/__mocks-ng-workspace__/with-nx/angular.json +0 -17
  150. package/dist/ts3.9/server/__mocks-ng-workspace__/with-nx/nx.json +0 -3
  151. package/dist/ts3.9/server/__mocks-ng-workspace__/with-nx/src/main.d.ts +0 -1
  152. package/dist/ts3.9/server/__mocks-ng-workspace__/with-nx/src/main.js +0 -5
  153. package/dist/ts3.9/server/__mocks-ng-workspace__/with-nx/src/tsconfig.app.json +0 -8
  154. package/dist/ts3.9/server/__mocks-ng-workspace__/with-nx/tsconfig.json +0 -14
  155. package/dist/ts3.9/server/__mocks-ng-workspace__/with-nx-workspace/nx.json +0 -3
  156. package/dist/ts3.9/server/__mocks-ng-workspace__/with-nx-workspace/src/main.d.ts +0 -1
  157. package/dist/ts3.9/server/__mocks-ng-workspace__/with-nx-workspace/src/main.js +0 -5
  158. package/dist/ts3.9/server/__mocks-ng-workspace__/with-nx-workspace/src/tsconfig.app.json +0 -8
  159. package/dist/ts3.9/server/__mocks-ng-workspace__/with-nx-workspace/tsconfig.json +0 -14
  160. package/dist/ts3.9/server/__mocks-ng-workspace__/with-nx-workspace/workspace.json +0 -17
  161. package/dist/ts3.9/server/__mocks-ng-workspace__/with-options-styles/angular.json +0 -17
  162. package/dist/ts3.9/server/__mocks-ng-workspace__/with-options-styles/src/main.d.ts +0 -1
  163. package/dist/ts3.9/server/__mocks-ng-workspace__/with-options-styles/src/main.js +0 -5
  164. package/dist/ts3.9/server/__mocks-ng-workspace__/with-options-styles/src/tsconfig.app.json +0 -9
  165. package/dist/ts3.9/server/__mocks-ng-workspace__/with-options-styles/tsconfig.json +0 -13
  166. package/dist/ts3.9/server/__mocks-ng-workspace__/without-architect-build/angular.json +0 -5
  167. package/dist/ts3.9/server/__mocks-ng-workspace__/without-architect-build-options/angular.json +0 -11
  168. package/dist/ts3.9/server/__mocks-ng-workspace__/without-compatible-projects/angular.json +0 -7
  169. package/dist/ts3.9/server/__mocks-ng-workspace__/without-projects-entry/angular.json +0 -3
  170. package/dist/ts3.9/server/__mocks-ng-workspace__/without-projects-entry/projects/pattern-lib/src/main.d.ts +0 -1
  171. package/dist/ts3.9/server/__mocks-ng-workspace__/without-projects-entry/projects/pattern-lib/src/main.js +0 -5
  172. package/dist/ts3.9/server/__mocks-ng-workspace__/without-projects-entry/projects/pattern-lib/tsconfig.lib.json +0 -25
  173. package/dist/ts3.9/server/__mocks-ng-workspace__/without-projects-entry/tsconfig.json +0 -13
  174. package/dist/ts3.9/server/__mocks-ng-workspace__/without-tsConfig/angular.json +0 -16
  175. package/dist/ts3.9/server/__mocks-ng-workspace__/without-tsConfig/src/main.d.ts +0 -1
  176. package/dist/ts3.9/server/__mocks-ng-workspace__/without-tsConfig/src/main.js +0 -5
  177. package/dist/ts3.9/server/__mocks-ng-workspace__/without-tsConfig/src/tsconfig.app.json +0 -9
  178. package/dist/ts3.9/server/__mocks-ng-workspace__/without-tsConfig/tsconfig.json +0 -13
  179. package/dist/ts3.9/server/angular-devkit-build-webpack.d.ts +0 -30
  180. package/dist/ts3.9/server/angular-devkit-build-webpack.js +0 -213
  181. package/dist/ts3.9/server/angular-read-workspace.d.ts +0 -13
  182. package/dist/ts3.9/server/angular-read-workspace.js +0 -118
  183. package/dist/ts3.9/server/build.d.ts +0 -1
  184. package/dist/ts3.9/server/build.js +0 -65
  185. package/dist/ts3.9/server/create-fork-ts-checker-plugin.d.ts +0 -3
  186. package/dist/ts3.9/server/create-fork-ts-checker-plugin.js +0 -19
  187. package/dist/ts3.9/server/framework-preset-angular-cli.d.ts +0 -73
  188. package/dist/ts3.9/server/framework-preset-angular-cli.js +0 -159
  189. package/dist/ts3.9/server/framework-preset-angular-ivy.d.ts +0 -10
  190. package/dist/ts3.9/server/framework-preset-angular-ivy.js +0 -111
  191. package/dist/ts3.9/server/framework-preset-angular.d.ts +0 -4
  192. package/dist/ts3.9/server/framework-preset-angular.js +0 -74
  193. package/dist/ts3.9/server/index.d.ts +0 -1
  194. package/dist/ts3.9/server/index.js +0 -8
  195. package/dist/ts3.9/server/ngx-template-loader/index.d.ts +0 -1
  196. package/dist/ts3.9/server/ngx-template-loader/index.js +0 -46
  197. package/dist/ts3.9/server/options.d.ts +0 -3
  198. package/dist/ts3.9/server/options.js +0 -8
  199. package/dist/ts3.9/server/preset.d.ts +0 -3
  200. package/dist/ts3.9/server/preset.js +0 -21
  201. package/dist/ts3.9/server/ts_config.d.ts +0 -2
  202. package/dist/ts3.9/server/ts_config.js +0 -28
  203. package/dist/ts3.9/server/utils/filter-out-styling-rules.d.ts +0 -2
  204. package/dist/ts3.9/server/utils/filter-out-styling-rules.js +0 -16
  205. package/dist/ts3.9/server/utils/module-is-available.d.ts +0 -1
  206. package/dist/ts3.9/server/utils/module-is-available.js +0 -12
  207. package/dist/ts3.9/server/utils/normalize-asset-patterns.d.ts +0 -6
  208. package/dist/ts3.9/server/utils/normalize-asset-patterns.js +0 -79
  209. package/dist/ts3.9/server/utils/normalize-optimization.d.ts +0 -3
  210. package/dist/ts3.9/server/utils/normalize-optimization.js +0 -20
  211. package/dist/ts3.9/types/index.d.ts +0 -6
  212. package/dist/ts3.9/types/index.js +0 -2
@@ -1,159 +0,0 @@
1
- "use strict";
2
- var __assign = (this && this.__assign) || function () {
3
- __assign = Object.assign || function(t) {
4
- for (var s, i = 1, n = arguments.length; i < n; i++) {
5
- s = arguments[i];
6
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
- t[p] = s[p];
8
- }
9
- return t;
10
- };
11
- return __assign.apply(this, arguments);
12
- };
13
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
14
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
15
- return new (P || (P = Promise))(function (resolve, reject) {
16
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
17
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
18
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
19
- step((generator = generator.apply(thisArg, _arguments || [])).next());
20
- });
21
- };
22
- var __generator = (this && this.__generator) || function (thisArg, body) {
23
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
24
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
25
- function verb(n) { return function (v) { return step([n, v]); }; }
26
- function step(op) {
27
- if (f) throw new TypeError("Generator is already executing.");
28
- while (_) try {
29
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
30
- if (y = 0, t) op = [op[0] & 2, t.value];
31
- switch (op[0]) {
32
- case 0: case 1: t = op; break;
33
- case 4: _.label++; return { value: op[1], done: false };
34
- case 5: _.label++; y = op[1]; op = [0]; continue;
35
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
36
- default:
37
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
38
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
39
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
40
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
41
- if (t[2]) _.ops.pop();
42
- _.trys.pop(); continue;
43
- }
44
- op = body.call(thisArg, _);
45
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
46
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
47
- }
48
- };
49
- var __spreadArrays = (this && this.__spreadArrays) || function () {
50
- for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
51
- for (var r = Array(s), k = 0, i = 0; i < il; i++)
52
- for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
53
- r[k] = a[j];
54
- return r;
55
- };
56
- var __importDefault = (this && this.__importDefault) || function (mod) {
57
- return (mod && mod.__esModule) ? mod : { "default": mod };
58
- };
59
- Object.defineProperty(exports, "__esModule", { value: true });
60
- exports.webpackFinal = void 0;
61
- var node_logger_1 = require("@storybook/node-logger");
62
- var tsconfig_paths_webpack_plugin_1 = __importDefault(require("tsconfig-paths-webpack-plugin"));
63
- var architect_1 = require("@angular-devkit/architect");
64
- var angular_read_workspace_1 = require("./angular-read-workspace");
65
- var angular_devkit_build_webpack_1 = require("./angular-devkit-build-webpack");
66
- var module_is_available_1 = require("./utils/module-is-available");
67
- var filter_out_styling_rules_1 = require("./utils/filter-out-styling-rules");
68
- function webpackFinal(baseConfig, options) {
69
- return __awaiter(this, void 0, void 0, function () {
70
- var dirToSearch, workspaceConfig, error_1, project, target, confName, browserTarget, fondProject, angularCliWebpackConfig, error_2;
71
- return __generator(this, function (_a) {
72
- switch (_a.label) {
73
- case 0:
74
- dirToSearch = process.cwd();
75
- if (!module_is_available_1.moduleIsAvailable('@angular-devkit/build-angular')) {
76
- node_logger_1.logger.info('=> Using base config because "@angular-devkit/build-angular" is not installed');
77
- return [2 /*return*/, baseConfig];
78
- }
79
- node_logger_1.logger.info('=> Loading angular-cli config');
80
- _a.label = 1;
81
- case 1:
82
- _a.trys.push([1, 3, , 4]);
83
- return [4 /*yield*/, angular_read_workspace_1.readAngularWorkspaceConfig(dirToSearch)];
84
- case 2:
85
- workspaceConfig = _a.sent();
86
- return [3 /*break*/, 4];
87
- case 3:
88
- error_1 = _a.sent();
89
- node_logger_1.logger.error("=> Could not find angular workspace config (angular.json) on this path \"" + dirToSearch + "\"");
90
- node_logger_1.logger.info("=> Fail to load angular-cli config. Using base config");
91
- return [2 /*return*/, baseConfig];
92
- case 4:
93
- try {
94
- // Default behavior when `angularBrowserTarget` are not explicitly defined to null
95
- if (options.angularBrowserTarget !== null) {
96
- browserTarget = options.angularBrowserTarget
97
- ? architect_1.targetFromTargetString(options.angularBrowserTarget)
98
- : {
99
- configuration: undefined,
100
- project: angular_read_workspace_1.getDefaultProjectName(workspaceConfig),
101
- target: 'build',
102
- };
103
- fondProject = angular_read_workspace_1.findAngularProjectTarget(workspaceConfig, browserTarget.project, browserTarget.target);
104
- project = fondProject.project;
105
- target = fondProject.target;
106
- confName = browserTarget.configuration;
107
- node_logger_1.logger.info("=> Using angular project \"" + browserTarget.project + ":" + browserTarget.target + (confName ? ":" + confName : '') + "\" for configuring Storybook");
108
- }
109
- // Start storybook when only tsConfig is provided.
110
- if (options.angularBrowserTarget === null && options.tsConfig) {
111
- node_logger_1.logger.info("=> Using default angular project with \"tsConfig:" + options.tsConfig + "\"");
112
- project = { root: '', extensions: {}, targets: undefined };
113
- target = { builder: '', options: { tsConfig: options.tsConfig } };
114
- }
115
- }
116
- catch (error) {
117
- node_logger_1.logger.error("=> Could not find angular project: " + error.message);
118
- node_logger_1.logger.info("=> Fail to load angular-cli config. Using base config");
119
- return [2 /*return*/, baseConfig];
120
- }
121
- _a.label = 5;
122
- case 5:
123
- _a.trys.push([5, 7, , 8]);
124
- return [4 /*yield*/, angular_devkit_build_webpack_1.extractAngularCliWebpackConfig(dirToSearch, project, target, confName)];
125
- case 6:
126
- angularCliWebpackConfig = _a.sent();
127
- node_logger_1.logger.info("=> Using angular-cli webpack config");
128
- return [3 /*break*/, 8];
129
- case 7:
130
- error_2 = _a.sent();
131
- node_logger_1.logger.error("=> Could not get angular cli webpack config");
132
- throw error_2;
133
- case 8: return [2 /*return*/, mergeAngularCliWebpackConfig(angularCliWebpackConfig, baseConfig)];
134
- }
135
- });
136
- });
137
- }
138
- exports.webpackFinal = webpackFinal;
139
- function mergeAngularCliWebpackConfig(_a, baseConfig) {
140
- var cliCommonWebpackConfig = _a.cliCommonWebpackConfig, cliStyleWebpackConfig = _a.cliStyleWebpackConfig, tsConfigPath = _a.tsConfigPath;
141
- // Don't use storybooks styling rules because we have to use rules created by @angular-devkit/build-angular
142
- // because @angular-devkit/build-angular created rules have include/exclude for global style files.
143
- var rulesExcludingStyles = filter_out_styling_rules_1.filterOutStylingRules(baseConfig);
144
- // styleWebpackConfig.entry adds global style files to the webpack context
145
- var entry = __spreadArrays(baseConfig.entry, Object.values(cliStyleWebpackConfig.entry).reduce(function (acc, item) { return acc.concat(item); }, []));
146
- var module = __assign(__assign({}, baseConfig.module), { rules: __spreadArrays(cliStyleWebpackConfig.module.rules, rulesExcludingStyles) });
147
- // We use cliCommonConfig plugins to serve static assets files.
148
- var plugins = __spreadArrays(cliStyleWebpackConfig.plugins, cliCommonWebpackConfig.plugins, baseConfig.plugins);
149
- var resolve = __assign(__assign({}, baseConfig.resolve), { modules: Array.from(new Set(__spreadArrays(baseConfig.resolve.modules, cliCommonWebpackConfig.resolve.modules))), plugins: [
150
- new tsconfig_paths_webpack_plugin_1.default({
151
- configFile: tsConfigPath,
152
- mainFields: ['browser', 'module', 'main'],
153
- }),
154
- ] });
155
- return __assign(__assign({}, baseConfig), { entry: entry,
156
- module: module,
157
- plugins: plugins,
158
- resolve: resolve, resolveLoader: cliCommonWebpackConfig.resolveLoader });
159
- }
@@ -1,10 +0,0 @@
1
- import { Configuration } from 'webpack';
2
- import { Options } from './framework-preset-angular-cli';
3
- /**
4
- * Run ngcc for converting modules to ivy format before starting storybook
5
- * This step is needed in 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: () => void;
10
- export declare const webpack: (webpackConfig: Configuration, options: Options) => Promise<Configuration>;
@@ -1,111 +0,0 @@
1
- "use strict";
2
- var __assign = (this && this.__assign) || function () {
3
- __assign = Object.assign || function(t) {
4
- for (var s, i = 1, n = arguments.length; i < n; i++) {
5
- s = arguments[i];
6
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
- t[p] = s[p];
8
- }
9
- return t;
10
- };
11
- return __assign.apply(this, arguments);
12
- };
13
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
14
- if (k2 === undefined) k2 = k;
15
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
16
- }) : (function(o, m, k, k2) {
17
- if (k2 === undefined) k2 = k;
18
- o[k2] = m[k];
19
- }));
20
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
21
- Object.defineProperty(o, "default", { enumerable: true, value: v });
22
- }) : function(o, v) {
23
- o["default"] = v;
24
- });
25
- var __importStar = (this && this.__importStar) || function (mod) {
26
- if (mod && mod.__esModule) return mod;
27
- var result = {};
28
- if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
29
- __setModuleDefault(result, mod);
30
- return result;
31
- };
32
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
33
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
34
- return new (P || (P = Promise))(function (resolve, reject) {
35
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
36
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
37
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
38
- step((generator = generator.apply(thisArg, _arguments || [])).next());
39
- });
40
- };
41
- var __generator = (this && this.__generator) || function (thisArg, body) {
42
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
43
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
44
- function verb(n) { return function (v) { return step([n, v]); }; }
45
- function step(op) {
46
- if (f) throw new TypeError("Generator is already executing.");
47
- while (_) try {
48
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
49
- if (y = 0, t) op = [op[0] & 2, t.value];
50
- switch (op[0]) {
51
- case 0: case 1: t = op; break;
52
- case 4: _.label++; return { value: op[1], done: false };
53
- case 5: _.label++; y = op[1]; op = [0]; continue;
54
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
55
- default:
56
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
57
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
58
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
59
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
60
- if (t[2]) _.ops.pop();
61
- _.trys.pop(); continue;
62
- }
63
- op = body.call(thisArg, _);
64
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
65
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
66
- }
67
- };
68
- Object.defineProperty(exports, "__esModule", { value: true });
69
- exports.webpack = exports.runNgcc = void 0;
70
- var ngcc_1 = require("@angular/compiler-cli/ngcc");
71
- var path = __importStar(require("path"));
72
- /**
73
- * Run ngcc for converting modules to ivy format before starting storybook
74
- * This step is needed in order to support Ivy in storybook
75
- *
76
- * Information about Ivy can be found here https://angular.io/guide/ivy
77
- */
78
- exports.runNgcc = function () {
79
- ngcc_1.process({
80
- // should be async: true but does not work due to
81
- // https://github.com/storybookjs/storybook/pull/11157/files#r615413803
82
- async: false,
83
- basePath: path.join(process.cwd(), 'node_modules'),
84
- createNewEntryPointFormats: true,
85
- compileAllFormats: false,
86
- });
87
- };
88
- exports.webpack = function (webpackConfig, options) { return __awaiter(void 0, void 0, void 0, function () {
89
- var angularOptions;
90
- return __generator(this, function (_a) {
91
- switch (_a.label) {
92
- case 0: return [4 /*yield*/, options.presets.apply('angularOptions', {}, options)];
93
- case 1:
94
- angularOptions = _a.sent();
95
- // Default to true, if undefined
96
- if (angularOptions.enableIvy === false) {
97
- return [2 /*return*/, webpackConfig];
98
- }
99
- exports.runNgcc();
100
- return [2 /*return*/, __assign(__assign({}, webpackConfig), { resolve: __assign(__assign({}, webpackConfig.resolve), { mainFields: [
101
- 'es2015_ivy_ngcc',
102
- 'module_ivy_ngcc',
103
- 'main_ivy_ngcc',
104
- 'es2015',
105
- 'browser',
106
- 'module',
107
- 'main',
108
- ] }) })];
109
- }
110
- });
111
- }); };
@@ -1,4 +0,0 @@
1
- import { Configuration } from 'webpack';
2
- export declare function webpack(config: Configuration, { configDir }: {
3
- configDir: string;
4
- }): Configuration;
@@ -1,74 +0,0 @@
1
- "use strict";
2
- var __assign = (this && this.__assign) || function () {
3
- __assign = Object.assign || function(t) {
4
- for (var s, i = 1, n = arguments.length; i < n; i++) {
5
- s = arguments[i];
6
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
- t[p] = s[p];
8
- }
9
- return t;
10
- };
11
- return __assign.apply(this, arguments);
12
- };
13
- var __spreadArrays = (this && this.__spreadArrays) || function () {
14
- for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
15
- for (var r = Array(s), k = 0, i = 0; i < il; i++)
16
- for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
17
- r[k] = a[j];
18
- return r;
19
- };
20
- var __importDefault = (this && this.__importDefault) || function (mod) {
21
- return (mod && mod.__esModule) ? mod : { "default": mod };
22
- };
23
- Object.defineProperty(exports, "__esModule", { value: true });
24
- exports.webpack = void 0;
25
- var path_1 = __importDefault(require("path"));
26
- var webpack_1 = require("webpack");
27
- var autoprefixer_1 = __importDefault(require("autoprefixer"));
28
- var ts_config_1 = __importDefault(require("./ts_config"));
29
- var create_fork_ts_checker_plugin_1 = __importDefault(require("./create-fork-ts-checker-plugin"));
30
- function webpack(config, _a) {
31
- var configDir = _a.configDir;
32
- var tsLoaderOptions = ts_config_1.default(configDir);
33
- return __assign(__assign({}, config), { module: __assign(__assign({}, config.module), { rules: __spreadArrays(config.module.rules, [
34
- {
35
- test: /\.tsx?$/,
36
- use: [
37
- {
38
- loader: require.resolve('ts-loader'),
39
- options: tsLoaderOptions,
40
- },
41
- { loader: path_1.default.resolve(__dirname, 'ngx-template-loader') },
42
- ],
43
- },
44
- {
45
- test: /[/\\]@angular[/\\]core[/\\].+\.js$/,
46
- parser: { system: true },
47
- },
48
- {
49
- test: /\.html$/,
50
- loader: require.resolve('raw-loader'),
51
- exclude: /\.async\.html$/,
52
- },
53
- {
54
- test: /\.s(c|a)ss$/,
55
- use: [
56
- { loader: require.resolve('raw-loader') },
57
- {
58
- loader: require.resolve('postcss-loader'),
59
- options: {
60
- postcssOptions: {
61
- plugins: [autoprefixer_1.default()],
62
- },
63
- },
64
- },
65
- { loader: require.resolve('sass-loader') },
66
- ],
67
- },
68
- ]) }), resolve: __assign({}, config.resolve), plugins: __spreadArrays(config.plugins, [
69
- // See https://github.com/angular/angular/issues/11580#issuecomment-401127742
70
- new webpack_1.ContextReplacementPlugin(/@angular(\\|\/)core(\\|\/)(fesm5|bundles)/, path_1.default.resolve(__dirname, '..')),
71
- create_fork_ts_checker_plugin_1.default(tsLoaderOptions),
72
- ]) });
73
- }
74
- exports.webpack = webpack;
@@ -1 +0,0 @@
1
- export {};
@@ -1,8 +0,0 @@
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
- var server_1 = require("@storybook/core/server");
7
- var options_1 = __importDefault(require("./options"));
8
- server_1.buildDev(options_1.default);
@@ -1 +0,0 @@
1
- export default function (source: string): string;
@@ -1,46 +0,0 @@
1
- "use strict";
2
- /*
3
- * By the time this file was added the repository for angular2-template-loader received no updates in 3 years
4
- * This is just a copy of https://github.com/TheLarkInn/angular2-template-loader/blob/master/index.js in order
5
- * to fix a bug that prevents Storybook from updating raw-loader > ^1.0.0
6
- *
7
- * As suggested in https://github.com/storybookjs/storybook/issues/7877#issuecomment-536556755 this code was
8
- * modified to be compatible with newer versions of raw-loader as well as backwards compatible with raw-loader ^1.0.0
9
- */
10
- Object.defineProperty(exports, "__esModule", { value: true });
11
- // using: regex, capture groups, and capture group variables.
12
- var templateUrlRegex = /templateUrl\s*:(\s*['"`](.*?)['"`]\s*([,}]))/gm;
13
- var stylesRegex = /styleUrls *:(\s*\[[^\]]*?\])/g;
14
- var stringRegex = /(['`"])((?:[^\\]\\\1|.)*?)\1/g;
15
- var replaceStringsWithRequires = function (string) {
16
- return string.replace(stringRegex, function (match, quote, url) {
17
- var newUrl = url;
18
- if (url.charAt(0) !== '.') {
19
- newUrl = "./" + url;
20
- }
21
- var requireString = "(require('" + newUrl + "').default || require('" + newUrl + "'))";
22
- // without the length check an empty style file will throw
23
- // "Expected 'styles' to be an array of strings"
24
- return requireString + ".length ? " + requireString + " : ''";
25
- });
26
- };
27
- function default_1(source) {
28
- var styleProperty = 'styles';
29
- var templateProperty = 'template';
30
- return source
31
- .replace(templateUrlRegex, function (_, templateUrlString) {
32
- // replace: templateUrl: './path/to/template.html'
33
- // with: template: require('./path/to/template.html')
34
- // or: templateUrl: require('./path/to/template.html')
35
- // if `keepUrl` query parameter is set to true.
36
- return templateProperty + ":" + replaceStringsWithRequires(templateUrlString);
37
- })
38
- .replace(stylesRegex, function (_, styleUrlsString) {
39
- // replace: stylesUrl: ['./foo.css', "./baz.css", "./index.component.css"]
40
- // with: styles: [require('./foo.css'), require("./baz.css"), require("./index.component.css")]
41
- // or: styleUrls: [require('./foo.css'), require("./baz.css"), require("./index.component.css")]
42
- // if `keepUrl` query parameter is set to true.
43
- return styleProperty + ":" + replaceStringsWithRequires(styleUrlsString);
44
- });
45
- }
46
- exports.default = default_1;
@@ -1,3 +0,0 @@
1
- import { LoadOptions } from '@storybook/core-common';
2
- declare const _default: LoadOptions;
3
- export default _default;
@@ -1,8 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- var read_pkg_up_1 = require("read-pkg-up");
4
- exports.default = {
5
- packageJson: read_pkg_up_1.sync({ cwd: __dirname }).packageJson,
6
- framework: 'angular',
7
- frameworkPresets: [require.resolve('./preset')],
8
- };
@@ -1,3 +0,0 @@
1
- import type { StorybookConfig } from '@storybook/core-common';
2
- export declare const config: StorybookConfig['config'];
3
- export declare const addons: StorybookConfig['addons'];
@@ -1,21 +0,0 @@
1
- "use strict";
2
- var __spreadArrays = (this && this.__spreadArrays) || function () {
3
- for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
4
- for (var r = Array(s), k = 0, i = 0; i < il; i++)
5
- for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
6
- r[k] = a[j];
7
- return r;
8
- };
9
- Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.addons = exports.config = void 0;
11
- exports.config = function (entries) {
12
- if (entries === void 0) { entries = []; }
13
- return __spreadArrays(entries, [
14
- require.resolve('../client/preview/config'),
15
- ]);
16
- };
17
- exports.addons = [
18
- require.resolve('./framework-preset-angular'),
19
- require.resolve('./framework-preset-angular-cli'),
20
- require.resolve('./framework-preset-angular-ivy'),
21
- ];
@@ -1,2 +0,0 @@
1
- import { Options } from 'ts-loader';
2
- export default function (configDir: string): Partial<Options>;
@@ -1,28 +0,0 @@
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
- var fs_1 = __importDefault(require("fs"));
7
- var path_1 = __importDefault(require("path"));
8
- var node_logger_1 = require("@storybook/node-logger");
9
- function resolveTsConfig(tsConfigPath) {
10
- if (fs_1.default.existsSync(tsConfigPath)) {
11
- node_logger_1.logger.info('=> Found custom tsconfig.json');
12
- return tsConfigPath;
13
- }
14
- return undefined;
15
- }
16
- function default_1(configDir) {
17
- var tsLoaderOptions = {
18
- transpileOnly: true,
19
- compilerOptions: {
20
- emitDecoratorMetadata: true,
21
- },
22
- };
23
- var configFilePath = resolveTsConfig(path_1.default.resolve(configDir, 'tsconfig.json'));
24
- if (configFilePath)
25
- tsLoaderOptions.configFile = configFilePath;
26
- return tsLoaderOptions;
27
- }
28
- exports.default = default_1;
@@ -1,2 +0,0 @@
1
- import { Configuration, RuleSetRule } from 'webpack';
2
- export declare const filterOutStylingRules: (config: Configuration) => RuleSetRule[];
@@ -1,16 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.filterOutStylingRules = void 0;
4
- var isStylingRule = function (rule) {
5
- var test = rule.test;
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
- exports.filterOutStylingRules = function (config) {
15
- return config.module.rules.filter(function (rule) { return !isStylingRule(rule); });
16
- };
@@ -1 +0,0 @@
1
- export declare const moduleIsAvailable: (moduleName: string) => boolean;
@@ -1,12 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.moduleIsAvailable = void 0;
4
- exports.moduleIsAvailable = function (moduleName) {
5
- try {
6
- require.resolve(moduleName);
7
- return true;
8
- }
9
- catch (e) {
10
- return false;
11
- }
12
- };
@@ -1,6 +0,0 @@
1
- import { BaseException, Path } from '@angular-devkit/core';
2
- import { AssetPattern, AssetPatternClass } from '@angular-devkit/build-angular/src/browser/schema';
3
- export declare class MissingAssetSourceRootException extends BaseException {
4
- constructor(path: string);
5
- }
6
- export declare function normalizeAssetPatterns(assetPatterns: AssetPattern[], root: Path, projectRoot: Path, maybeSourceRoot: Path | undefined): AssetPatternClass[];
@@ -1,79 +0,0 @@
1
- "use strict";
2
- var __extends = (this && this.__extends) || (function () {
3
- var extendStatics = function (d, b) {
4
- extendStatics = Object.setPrototypeOf ||
5
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
7
- return extendStatics(d, b);
8
- };
9
- return function (d, b) {
10
- extendStatics(d, b);
11
- function __() { this.constructor = d; }
12
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
13
- };
14
- })();
15
- Object.defineProperty(exports, "__esModule", { value: true });
16
- exports.normalizeAssetPatterns = exports.MissingAssetSourceRootException = void 0;
17
- /**
18
- * Clone of `normalizeAssetPatterns` function from angular-cli v11.2.*
19
- * > https://github.com/angular/angular-cli/blob/de63f41d669e42ada84f94ca1795d2791b9b45cc/packages/angular_devkit/build_angular/src/utils/normalize-asset-patterns.ts
20
- *
21
- * It is not possible to use the original because arguments have changed between version 6.1.* and 11.*.* of angular-cli
22
- */
23
- var fs_1 = require("fs");
24
- var core_1 = require("@angular-devkit/core");
25
- var MissingAssetSourceRootException = /** @class */ (function (_super) {
26
- __extends(MissingAssetSourceRootException, _super);
27
- function MissingAssetSourceRootException(path) {
28
- return _super.call(this, "The " + path + " asset path must start with the project source root.") || this;
29
- }
30
- return MissingAssetSourceRootException;
31
- }(core_1.BaseException));
32
- exports.MissingAssetSourceRootException = MissingAssetSourceRootException;
33
- function normalizeAssetPatterns(assetPatterns, root, projectRoot, maybeSourceRoot) {
34
- // When sourceRoot is not available, we default to ${projectRoot}/src.
35
- var sourceRoot = maybeSourceRoot || core_1.join(projectRoot, 'src');
36
- var resolvedSourceRoot = core_1.resolve(root, sourceRoot);
37
- if (assetPatterns.length === 0) {
38
- return [];
39
- }
40
- return assetPatterns.map(function (assetPattern) {
41
- // Normalize string asset patterns to objects.
42
- if (typeof assetPattern === 'string') {
43
- var assetPath = core_1.normalize(assetPattern);
44
- var resolvedAssetPath = core_1.resolve(root, assetPath);
45
- // Check if the string asset is within sourceRoot.
46
- if (!resolvedAssetPath.startsWith(resolvedSourceRoot)) {
47
- throw new MissingAssetSourceRootException(assetPattern);
48
- }
49
- var glob = void 0;
50
- var input = void 0;
51
- var isDirectory = false;
52
- try {
53
- isDirectory = fs_1.statSync(core_1.getSystemPath(resolvedAssetPath)).isDirectory();
54
- }
55
- catch (_a) {
56
- isDirectory = true;
57
- }
58
- if (isDirectory) {
59
- // Folders get a recursive star glob.
60
- glob = '**/*';
61
- // Input directory is their original path.
62
- input = assetPath;
63
- }
64
- else {
65
- // Files are their own glob.
66
- glob = core_1.basename(assetPath);
67
- // Input directory is their original dirname.
68
- input = core_1.dirname(assetPath);
69
- }
70
- // Output directory for both is the relative path from source root to input.
71
- var output = core_1.relative(resolvedSourceRoot, core_1.resolve(root, input));
72
- // Return the asset pattern in object format.
73
- return { glob: glob, input: input, output: output };
74
- }
75
- // It's already an AssetPatternObject, no need to convert.
76
- return assetPattern;
77
- });
78
- }
79
- exports.normalizeAssetPatterns = normalizeAssetPatterns;
@@ -1,3 +0,0 @@
1
- import { OptimizationUnion } from '@angular-devkit/build-angular/src/browser/schema';
2
- import { NormalizedOptimizationOptions } from '@angular-devkit/build-angular/src/utils/normalize-optimization';
3
- export declare const normalizeOptimization: (options: OptimizationUnion) => NormalizedOptimizationOptions;