@storybook/angular 6.5.0-alpha.9 → 6.5.0-beta.0

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 (98) hide show
  1. package/README.md +2 -2
  2. package/dist/ts3.4/client/docs/compodoc.d.ts +18 -0
  3. package/dist/ts3.4/client/docs/config.d.ts +15 -0
  4. package/dist/ts3.4/client/docs/index.d.ts +1 -0
  5. package/dist/ts3.4/client/docs/prepareForInline.d.ts +7 -0
  6. package/dist/ts3.4/client/docs/sourceDecorator.d.ts +9 -0
  7. package/dist/ts3.4/client/docs/types.d.ts +102 -0
  8. package/dist/ts3.4/client/preview/angular-beta/utils/NgComponentAnalyzer.d.ts +4 -2
  9. package/dist/ts3.4/server/angular-cli-webpack-older.d.ts +2 -1
  10. package/dist/ts3.4/server/framework-preset-angular-docs.d.ts +2 -0
  11. package/dist/ts3.4/server/framework-preset-angular.d.ts +3 -2
  12. package/dist/ts3.4/server/preset.d.ts +1 -1
  13. package/dist/ts3.9/builders/build-storybook/index.d.ts +1 -1
  14. package/dist/ts3.9/builders/build-storybook/index.js +33 -84
  15. package/dist/ts3.9/builders/build-storybook/schema.json +1 -2
  16. package/dist/ts3.9/builders/start-storybook/index.d.ts +1 -1
  17. package/dist/ts3.9/builders/start-storybook/index.js +40 -91
  18. package/dist/ts3.9/builders/start-storybook/schema.json +1 -2
  19. package/dist/ts3.9/builders/utils/build-standalone-errors-handler.js +13 -11
  20. package/dist/ts3.9/builders/utils/run-compodoc.js +41 -21
  21. package/dist/ts3.9/client/docs/compodoc.d.ts +18 -0
  22. package/dist/ts3.9/client/docs/compodoc.js +247 -0
  23. package/dist/ts3.9/client/docs/config.d.ts +15 -0
  24. package/dist/ts3.9/client/docs/config.js +22 -0
  25. package/dist/ts3.9/client/docs/index.d.ts +1 -0
  26. package/dist/ts3.9/client/docs/index.js +13 -0
  27. package/dist/ts3.9/client/docs/prepareForInline.d.ts +7 -0
  28. package/dist/ts3.9/client/docs/prepareForInline.js +45 -0
  29. package/dist/ts3.9/client/docs/sourceDecorator.d.ts +9 -0
  30. package/dist/ts3.9/client/docs/sourceDecorator.js +49 -0
  31. package/dist/ts3.9/client/docs/types.d.ts +102 -0
  32. package/dist/ts3.9/client/docs/types.js +2 -0
  33. package/dist/ts3.9/client/preview/angular/app.token.js +1 -1
  34. package/dist/ts3.9/client/preview/angular/components/app.component.js +55 -59
  35. package/dist/ts3.9/client/preview/angular/helpers.d.ts +2 -2
  36. package/dist/ts3.9/client/preview/angular/helpers.js +66 -80
  37. package/dist/ts3.9/client/preview/angular-beta/AbstractRenderer.js +77 -125
  38. package/dist/ts3.9/client/preview/angular-beta/CanvasRenderer.js +18 -81
  39. package/dist/ts3.9/client/preview/angular-beta/ComputesTemplateFromComponent.d.ts +3 -3
  40. package/dist/ts3.9/client/preview/angular-beta/ComputesTemplateFromComponent.js +75 -69
  41. package/dist/ts3.9/client/preview/angular-beta/DocsRenderer.js +41 -127
  42. package/dist/ts3.9/client/preview/angular-beta/RendererFactory.js +30 -66
  43. package/dist/ts3.9/client/preview/angular-beta/StorybookModule.js +42 -46
  44. package/dist/ts3.9/client/preview/angular-beta/StorybookProvider.js +15 -17
  45. package/dist/ts3.9/client/preview/angular-beta/StorybookWrapperComponent.js +58 -98
  46. package/dist/ts3.9/client/preview/angular-beta/utils/NgComponentAnalyzer.d.ts +4 -2
  47. package/dist/ts3.9/client/preview/angular-beta/utils/NgComponentAnalyzer.js +30 -77
  48. package/dist/ts3.9/client/preview/angular-beta/utils/NgModulesAnalyzer.js +10 -14
  49. package/dist/ts3.9/client/preview/decorateStory.d.ts +2 -2
  50. package/dist/ts3.9/client/preview/decorateStory.js +16 -36
  51. package/dist/ts3.9/client/preview/decorators.d.ts +4 -4
  52. package/dist/ts3.9/client/preview/decorators.js +22 -37
  53. package/dist/ts3.9/client/preview/globals.js +2 -2
  54. package/dist/ts3.9/client/preview/index.d.ts +3 -3
  55. package/dist/ts3.9/client/preview/index.js +8 -21
  56. package/dist/ts3.9/client/preview/render.d.ts +3 -3
  57. package/dist/ts3.9/client/preview/render.js +17 -56
  58. package/dist/ts3.9/client/preview/types-6-0.d.ts +2 -2
  59. package/dist/ts3.9/client/preview/types-7-0.d.ts +1 -1
  60. package/dist/ts3.9/demo/button.component.js +31 -22
  61. package/dist/ts3.9/demo/welcome.component.js +85 -18
  62. package/dist/ts3.9/server/__mocks-ng-workspace__/minimal-config/tsconfig.json +4 -1
  63. package/dist/ts3.9/server/__mocks-ng-workspace__/some-config/tsconfig.json +4 -1
  64. package/dist/ts3.9/server/__mocks-ng-workspace__/with-angularBrowserTarget/tsconfig.json +4 -1
  65. package/dist/ts3.9/server/__mocks-ng-workspace__/with-lib/tsconfig.json +4 -1
  66. package/dist/ts3.9/server/__mocks-ng-workspace__/with-nx/tsconfig.json +7 -2
  67. package/dist/ts3.9/server/__mocks-ng-workspace__/with-nx-workspace/tsconfig.json +7 -2
  68. package/dist/ts3.9/server/__mocks-ng-workspace__/with-options-styles/tsconfig.json +4 -1
  69. package/dist/ts3.9/server/__mocks-ng-workspace__/without-projects-entry/tsconfig.json +4 -1
  70. package/dist/ts3.9/server/__mocks-ng-workspace__/without-tsConfig/tsconfig.json +4 -1
  71. package/dist/ts3.9/server/angular-cli-webpack-12.2.x.js +38 -81
  72. package/dist/ts3.9/server/angular-cli-webpack-13.x.x.js +42 -85
  73. package/dist/ts3.9/server/angular-cli-webpack-older.d.ts +2 -1
  74. package/dist/ts3.9/server/angular-cli-webpack-older.js +77 -123
  75. package/dist/ts3.9/server/angular-devkit-build-webpack.js +72 -133
  76. package/dist/ts3.9/server/angular-read-workspace.js +44 -78
  77. package/dist/ts3.9/server/build.js +10 -47
  78. package/dist/ts3.9/server/create-fork-ts-checker-plugin.js +3 -3
  79. package/dist/ts3.9/server/framework-preset-angular-cli.js +111 -179
  80. package/dist/ts3.9/server/framework-preset-angular-docs.d.ts +2 -0
  81. package/dist/ts3.9/server/framework-preset-angular-docs.js +13 -0
  82. package/dist/ts3.9/server/framework-preset-angular-ivy.js +35 -92
  83. package/dist/ts3.9/server/framework-preset-angular.d.ts +3 -2
  84. package/dist/ts3.9/server/framework-preset-angular.js +88 -62
  85. package/dist/ts3.9/server/index.js +2 -2
  86. package/dist/ts3.9/server/ngx-template-loader/index.js +15 -15
  87. package/dist/ts3.9/server/options.d.ts +1 -1
  88. package/dist/ts3.9/server/options.js +1 -1
  89. package/dist/ts3.9/server/preset.d.ts +1 -1
  90. package/dist/ts3.9/server/preset.js +6 -14
  91. package/dist/ts3.9/server/ts_config.js +5 -5
  92. package/dist/ts3.9/server/utils/filter-out-styling-rules.js +4 -4
  93. package/dist/ts3.9/server/utils/module-is-available.js +1 -1
  94. package/dist/ts3.9/server/utils/normalize-asset-patterns.js +16 -31
  95. package/dist/ts3.9/server/utils/normalize-optimization.js +3 -3
  96. package/dist/ts3.9/types/index.d.ts +1 -1
  97. package/package.json +24 -26
  98. package/standalone.d.ts +5 -7
package/README.md CHANGED
@@ -19,5 +19,5 @@ For more information visit: [storybook.js.org](https://storybook.js.org)
19
19
 
20
20
  ---
21
21
 
22
- Storybook also comes with a lot of [addons](https://storybook.js.org/docs/angular/configure/storybook-addons) and a great API to customize as you wish.
23
- You can also build a [static version](https://storybook.js.org/docs/angular/workflows/publish-storybook) of your storybook and deploy it anywhere you want.
22
+ Storybook also comes with a lot of [addons](https://storybook.js.org/addons) and a great API to customize as you wish.
23
+ You can also build a [static version](https://storybook.js.org/docs/angular/sharing/publish-storybook) of your Storybook and deploy it anywhere you want.
@@ -0,0 +1,18 @@
1
+ import { ArgTypes } from '@storybook/api';
2
+ import { Class, CompodocJson, Component, Injectable, Method, Pipe, Property, Directive } from './types';
3
+ export declare const isMethod: (methodOrProp: Method | Property) => methodOrProp is Method;
4
+ export declare const setCompodocJson: (compodocJson: CompodocJson) => void;
5
+ export declare const getCompodocJson: () => CompodocJson;
6
+ export declare const checkValidComponentOrDirective: (component: Component | Directive) => void;
7
+ export declare const checkValidCompodocJson: (compodocJson: CompodocJson) => void;
8
+ export declare const findComponentByName: (name: string, compodocJson: CompodocJson) => Class | Injectable | Pipe | Directive;
9
+ export declare const extractType: (property: Property, defaultValue: any) => {
10
+ name: string;
11
+ value?: undefined;
12
+ } | {
13
+ name: string;
14
+ value: any[];
15
+ };
16
+ export declare const extractArgTypesFromData: (componentData: Class | Directive | Injectable | Pipe) => ArgTypes;
17
+ export declare const extractArgTypes: (component: Component | Directive) => ArgTypes;
18
+ export declare const extractComponentDescription: (component: Component | Directive) => string;
@@ -0,0 +1,15 @@
1
+ import { SourceType } from '@storybook/docs-tools';
2
+ export declare const parameters: {
3
+ docs: {
4
+ inlineStories: boolean;
5
+ prepareForInline: (storyFn: import("@storybook/csf").PartialStoryFn<import("..").AngularFramework, import("@storybook/csf").Args>, { id, parameters, component }: import("..").StoryContext) => import("react").DetailedReactHTMLElement<import("react").HTMLAttributes<undefined>, undefined>;
6
+ extractArgTypes: (component: import("./types").Directive) => import("@storybook/api").ArgTypes;
7
+ extractComponentDescription: (component: import("./types").Directive) => string;
8
+ source: {
9
+ type: SourceType;
10
+ language: string;
11
+ };
12
+ };
13
+ };
14
+ export declare const decorators: ((storyFn: import("@storybook/csf").PartialStoryFn<import("..").AngularFramework, import("@storybook/csf").Args>, context: import("..").StoryContext) => import("..").IStory)[];
15
+ export declare const argTypesEnhancers: (<TFramework extends import("@storybook/csf").AnyFramework>(context: import("@storybook/csf").StoryContextForEnhancers<TFramework, import("@storybook/csf").Args>) => import("@storybook/csf").StrictArgTypes<import("@storybook/csf").Args> | import("@storybook/addons").Parameters)[];
@@ -0,0 +1 @@
1
+ export * from './compodoc';
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ import { PartialStoryFn } from '@storybook/csf';
3
+ import { AngularFramework, StoryContext } from '..';
4
+ /**
5
+ * Uses the angular renderer to generate a story. Uses p-limit to run synchronously
6
+ */
7
+ export declare const prepareForInline: (storyFn: PartialStoryFn<AngularFramework>, { id, parameters, component }: StoryContext) => React.DetailedReactHTMLElement<React.HTMLAttributes<undefined>, undefined>;
@@ -0,0 +1,9 @@
1
+ import { PartialStoryFn } from '@storybook/csf';
2
+ import { StoryContext, AngularFramework } from '..';
3
+ export declare const skipSourceRender: (context: StoryContext) => any;
4
+ /**
5
+ * Angular source decorator.
6
+ * @param storyFn Fn
7
+ * @param context StoryContext
8
+ */
9
+ export declare const sourceDecorator: (storyFn: PartialStoryFn<AngularFramework>, context: StoryContext) => import("..").IStory;
@@ -0,0 +1,102 @@
1
+ export interface Method {
2
+ name: string;
3
+ args: Argument[];
4
+ returnType: string;
5
+ decorators?: Decorator[];
6
+ description?: string;
7
+ rawdescription?: string;
8
+ }
9
+ export interface JsDocTag {
10
+ comment?: string;
11
+ tagName?: {
12
+ escapedText?: string;
13
+ };
14
+ }
15
+ export interface Property {
16
+ name: string;
17
+ decorators?: Decorator[];
18
+ type: string;
19
+ optional: boolean;
20
+ defaultValue?: string;
21
+ description?: string;
22
+ rawdescription?: string;
23
+ jsdoctags?: JsDocTag[];
24
+ }
25
+ export interface Class {
26
+ name: string;
27
+ ngname: string;
28
+ type: 'pipe';
29
+ properties: Property[];
30
+ methods: Method[];
31
+ description?: string;
32
+ rawdescription?: string;
33
+ }
34
+ export interface Injectable {
35
+ name: string;
36
+ type: 'injectable';
37
+ properties: Property[];
38
+ methods: Method[];
39
+ description?: string;
40
+ rawdescription?: string;
41
+ }
42
+ export interface Pipe {
43
+ name: string;
44
+ type: 'class';
45
+ properties: Property[];
46
+ methods: Method[];
47
+ description?: string;
48
+ rawdescription?: string;
49
+ }
50
+ export interface Directive {
51
+ name: string;
52
+ type: 'directive' | 'component';
53
+ propertiesClass: Property[];
54
+ inputsClass: Property[];
55
+ outputsClass: Property[];
56
+ methodsClass: Method[];
57
+ description?: string;
58
+ rawdescription?: string;
59
+ }
60
+ export declare type Component = Directive;
61
+ export interface Argument {
62
+ name: string;
63
+ type: string;
64
+ optional?: boolean;
65
+ }
66
+ export interface Decorator {
67
+ name: string;
68
+ }
69
+ export interface TypeAlias {
70
+ name: string;
71
+ ctype: string;
72
+ subtype: string;
73
+ rawtype: string;
74
+ file: string;
75
+ kind: number;
76
+ description?: string;
77
+ rawdescription?: string;
78
+ }
79
+ export interface EnumType {
80
+ name: string;
81
+ childs: EnumTypeChild[];
82
+ ctype: string;
83
+ subtype: string;
84
+ file: string;
85
+ description?: string;
86
+ rawdescription?: string;
87
+ }
88
+ export interface EnumTypeChild {
89
+ name: string;
90
+ value?: string;
91
+ }
92
+ export interface CompodocJson {
93
+ directives: Directive[];
94
+ components: Component[];
95
+ pipes: Pipe[];
96
+ injectables: Injectable[];
97
+ classes: Class[];
98
+ miscellaneous?: {
99
+ typealiases?: TypeAlias[];
100
+ enumerations?: EnumType[];
101
+ };
102
+ }
@@ -1,4 +1,4 @@
1
- import { Component, Input, Output, Type } from '@angular/core';
1
+ import { Component, Type } from '@angular/core';
2
2
  export declare type ComponentInputsOutputs = {
3
3
  inputs: {
4
4
  propName: string;
@@ -19,7 +19,9 @@ export declare const isComponent: (component: any) => component is Type<unknown>
19
19
  * Returns all component decorator properties
20
20
  * is used to get all `@Input` and `@Output` Decorator
21
21
  */
22
- export declare const getComponentPropsDecoratorMetadata: (component: any) => Record<string, (Input | Output)[]>;
22
+ export declare const getComponentPropsDecoratorMetadata: (component: any) => {
23
+ [key: string]: any[];
24
+ };
23
25
  /**
24
26
  * Returns component decorator `@Component`
25
27
  */
@@ -48,7 +48,7 @@ export declare function getWebpackConfig(baseConfig: webpack.Configuration, opti
48
48
  mode?: "development" | "production" | "none";
49
49
  name?: string;
50
50
  context?: string;
51
- devtool?: webpack.Options.Devtool;
51
+ devtool?: string | boolean;
52
52
  output?: webpack.Output;
53
53
  externals?: string | RegExp | webpack.ExternalsObjectElement | webpack.ExternalsFunctionElement | webpack.ExternalsElement[];
54
54
  target?: "node" | "web" | "webworker" | "async-node" | "node-webkit" | "atom" | "electron" | "electron-renderer" | "electron-preload" | "electron-main" | ((compiler?: any) => void);
@@ -68,5 +68,6 @@ export declare function getWebpackConfig(baseConfig: webpack.Configuration, opti
68
68
  performance?: false | webpack.Options.Performance;
69
69
  parallelism?: number;
70
70
  optimization?: webpack.Options.Optimization;
71
+ infrastructureLogging?: webpack.Options.InfrastructureLogging;
71
72
  devServer?: import("webpack-dev-server").Configuration;
72
73
  }>;
@@ -0,0 +1,2 @@
1
+ import { StorybookConfig } from '@storybook/core-common';
2
+ export declare const previewAnnotations: StorybookConfig['previewAnnotations'];
@@ -1,4 +1,5 @@
1
1
  import { Configuration } from 'webpack';
2
- export declare function webpack(config: Configuration, { configDir }: {
2
+ export declare function webpack(config: Configuration, { configDir, angularBuilderContext }: {
3
3
  configDir: string;
4
- }): Configuration;
4
+ angularBuilderContext: any;
5
+ }): Promise<Configuration>;
@@ -1,3 +1,3 @@
1
1
  import { StorybookConfig } from '@storybook/core-common';
2
- export declare const config: StorybookConfig['config'];
2
+ export declare const previewAnnotations: StorybookConfig['previewAnnotations'];
3
3
  export declare const addons: StorybookConfig['addons'];
@@ -1,6 +1,6 @@
1
1
  import { BuilderOutput } from '@angular-devkit/architect';
2
2
  import { JsonObject } from '@angular-devkit/core';
3
- import { CLIOptions } from '@storybook/core-common';
3
+ import type { CLIOptions } from '@storybook/core-common';
4
4
  import { ExtraEntryPoint, StylePreprocessorOptions } from '@angular-devkit/build-angular';
5
5
  export declare type StorybookBuilderOptions = JsonObject & {
6
6
  browserTarget?: string | null;
@@ -1,15 +1,4 @@
1
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
2
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
14
3
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
15
4
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -19,97 +8,57 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
19
8
  step((generator = generator.apply(thisArg, _arguments || [])).next());
20
9
  });
21
10
  };
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
11
  var __importDefault = (this && this.__importDefault) || function (mod) {
50
12
  return (mod && mod.__esModule) ? mod : { "default": mod };
51
13
  };
52
14
  Object.defineProperty(exports, "__esModule", { value: true });
53
- var architect_1 = require("@angular-devkit/architect");
54
- var rxjs_1 = require("rxjs");
55
- var operators_1 = require("rxjs/operators");
56
- var find_up_1 = require("find-up");
15
+ const architect_1 = require("@angular-devkit/architect");
16
+ const rxjs_1 = require("rxjs");
17
+ const operators_1 = require("rxjs/operators");
18
+ const find_up_1 = require("find-up");
57
19
  // eslint-disable-next-line import/no-extraneous-dependencies
58
- var standalone_1 = __importDefault(require("@storybook/angular/standalone"));
59
- var run_compodoc_1 = require("../utils/run-compodoc");
60
- var build_standalone_errors_handler_1 = require("../utils/build-standalone-errors-handler");
20
+ const standalone_1 = __importDefault(require("@storybook/angular/standalone"));
21
+ const run_compodoc_1 = require("../utils/run-compodoc");
22
+ const build_standalone_errors_handler_1 = require("../utils/build-standalone-errors-handler");
61
23
  exports.default = architect_1.createBuilder(commandBuilder);
62
24
  function commandBuilder(options, context) {
63
- return rxjs_1.from(setup(options, context)).pipe(operators_1.switchMap(function (_a) {
64
- var tsConfig = _a.tsConfig;
65
- var runCompodoc$ = options.compodoc
66
- ? run_compodoc_1.runCompodoc({ compodocArgs: options.compodocArgs, tsconfig: tsConfig }, context).pipe(operators_1.mapTo({ tsConfig: tsConfig }))
25
+ return rxjs_1.from(setup(options, context)).pipe(operators_1.switchMap(({ tsConfig }) => {
26
+ const runCompodoc$ = options.compodoc
27
+ ? run_compodoc_1.runCompodoc({ compodocArgs: options.compodocArgs, tsconfig: tsConfig }, context).pipe(operators_1.mapTo({ tsConfig }))
67
28
  : rxjs_1.of({});
68
- return runCompodoc$.pipe(operators_1.mapTo({ tsConfig: tsConfig }));
69
- }), operators_1.map(function (_a) {
70
- var tsConfig = _a.tsConfig;
71
- var browserTarget = options.browserTarget, stylePreprocessorOptions = options.stylePreprocessorOptions, styles = options.styles, configDir = options.configDir, docs = options.docs, loglevel = options.loglevel, outputDir = options.outputDir, quiet = options.quiet;
72
- var standaloneOptions = {
73
- configDir: configDir,
74
- docs: docs,
75
- loglevel: loglevel,
76
- outputDir: outputDir,
77
- quiet: quiet,
29
+ return runCompodoc$.pipe(operators_1.mapTo({ tsConfig }));
30
+ }), operators_1.map(({ tsConfig }) => {
31
+ const { browserTarget, stylePreprocessorOptions, styles, configDir, docs, loglevel, outputDir, quiet, } = options;
32
+ const standaloneOptions = {
33
+ configDir,
34
+ docs,
35
+ loglevel,
36
+ outputDir,
37
+ quiet,
78
38
  angularBrowserTarget: browserTarget,
79
39
  angularBuilderContext: context,
80
- angularBuilderOptions: __assign(__assign({}, (stylePreprocessorOptions ? { stylePreprocessorOptions: stylePreprocessorOptions } : {})), (styles ? { styles: styles } : {})),
81
- tsConfig: tsConfig,
40
+ angularBuilderOptions: Object.assign(Object.assign({}, (stylePreprocessorOptions ? { stylePreprocessorOptions } : {})), (styles ? { styles } : {})),
41
+ tsConfig,
82
42
  };
83
43
  return standaloneOptions;
84
- }), operators_1.switchMap(function (standaloneOptions) { return runInstance(__assign(__assign({}, standaloneOptions), { mode: 'static' })); }), operators_1.map(function () {
44
+ }), operators_1.switchMap((standaloneOptions) => runInstance(Object.assign(Object.assign({}, standaloneOptions), { mode: 'static' }))), operators_1.map(() => {
85
45
  return { success: true };
86
46
  }));
87
47
  }
88
48
  function setup(options, context) {
89
49
  var _a, _b;
90
- return __awaiter(this, void 0, void 0, function () {
91
- var browserOptions, browserTarget, _c, _d, _e;
92
- return __generator(this, function (_f) {
93
- switch (_f.label) {
94
- case 0:
95
- if (!options.browserTarget) return [3 /*break*/, 4];
96
- browserTarget = architect_1.targetFromTargetString(options.browserTarget);
97
- _d = (_c = context).validateOptions;
98
- return [4 /*yield*/, context.getTargetOptions(browserTarget)];
99
- case 1:
100
- _e = [_f.sent()];
101
- return [4 /*yield*/, context.getBuilderNameForTarget(browserTarget)];
102
- case 2: return [4 /*yield*/, _d.apply(_c, _e.concat([_f.sent()]))];
103
- case 3:
104
- browserOptions = _f.sent();
105
- _f.label = 4;
106
- case 4: return [2 /*return*/, {
107
- tsConfig: (_b = (_a = options.tsConfig) !== null && _a !== void 0 ? _a : find_up_1.sync('tsconfig.json', { cwd: options.configDir })) !== null && _b !== void 0 ? _b : browserOptions.tsConfig,
108
- }];
109
- }
110
- });
50
+ return __awaiter(this, void 0, void 0, function* () {
51
+ let browserOptions;
52
+ let browserTarget;
53
+ if (options.browserTarget) {
54
+ browserTarget = architect_1.targetFromTargetString(options.browserTarget);
55
+ browserOptions = yield context.validateOptions(yield context.getTargetOptions(browserTarget), yield context.getBuilderNameForTarget(browserTarget));
56
+ }
57
+ return {
58
+ tsConfig: (_b = (_a = options.tsConfig) !== null && _a !== void 0 ? _a : find_up_1.sync('tsconfig.json', { cwd: options.configDir })) !== null && _b !== void 0 ? _b : browserOptions.tsConfig,
59
+ };
111
60
  });
112
61
  }
113
62
  function runInstance(options) {
114
- return rxjs_1.from(standalone_1.default(options)).pipe(operators_1.catchError(function (error) { return rxjs_1.throwError(build_standalone_errors_handler_1.buildStandaloneErrorHandler(error)); }));
63
+ return rxjs_1.from(standalone_1.default(options)).pipe(operators_1.catchError((error) => rxjs_1.throwError(build_standalone_errors_handler_1.buildStandaloneErrorHandler(error))));
115
64
  }
@@ -69,8 +69,7 @@
69
69
  "type": "array",
70
70
  "items": {
71
71
  "type": "string"
72
- },
73
- "default": []
72
+ }
74
73
  }
75
74
  },
76
75
  "additionalProperties": false,
@@ -1,7 +1,7 @@
1
1
  import { BuilderOutput } from '@angular-devkit/architect';
2
2
  import { JsonObject } from '@angular-devkit/core';
3
3
  import { ExtraEntryPoint, StylePreprocessorOptions } from '@angular-devkit/build-angular';
4
- import { CLIOptions } from '@storybook/core-common';
4
+ import type { CLIOptions } from '@storybook/core-common';
5
5
  export declare type StorybookBuilderOptions = JsonObject & {
6
6
  browserTarget?: string | null;
7
7
  tsConfig?: string;
@@ -1,15 +1,4 @@
1
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
2
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
14
3
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
15
4
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -19,106 +8,66 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
19
8
  step((generator = generator.apply(thisArg, _arguments || [])).next());
20
9
  });
21
10
  };
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
11
  var __importDefault = (this && this.__importDefault) || function (mod) {
50
12
  return (mod && mod.__esModule) ? mod : { "default": mod };
51
13
  };
52
14
  Object.defineProperty(exports, "__esModule", { value: true });
53
- var architect_1 = require("@angular-devkit/architect");
54
- var rxjs_1 = require("rxjs");
55
- var operators_1 = require("rxjs/operators");
56
- var find_up_1 = require("find-up");
15
+ const architect_1 = require("@angular-devkit/architect");
16
+ const rxjs_1 = require("rxjs");
17
+ const operators_1 = require("rxjs/operators");
18
+ const find_up_1 = require("find-up");
57
19
  // eslint-disable-next-line import/no-extraneous-dependencies
58
- var standalone_1 = __importDefault(require("@storybook/angular/standalone"));
59
- var run_compodoc_1 = require("../utils/run-compodoc");
60
- var build_standalone_errors_handler_1 = require("../utils/build-standalone-errors-handler");
20
+ const standalone_1 = __importDefault(require("@storybook/angular/standalone"));
21
+ const run_compodoc_1 = require("../utils/run-compodoc");
22
+ const build_standalone_errors_handler_1 = require("../utils/build-standalone-errors-handler");
61
23
  exports.default = architect_1.createBuilder(commandBuilder);
62
24
  function commandBuilder(options, context) {
63
- return rxjs_1.from(setup(options, context)).pipe(operators_1.switchMap(function (_a) {
64
- var tsConfig = _a.tsConfig;
65
- var runCompodoc$ = options.compodoc
66
- ? run_compodoc_1.runCompodoc({ compodocArgs: options.compodocArgs, tsconfig: tsConfig }, context).pipe(operators_1.mapTo({ tsConfig: tsConfig }))
25
+ return rxjs_1.from(setup(options, context)).pipe(operators_1.switchMap(({ tsConfig }) => {
26
+ const runCompodoc$ = options.compodoc
27
+ ? run_compodoc_1.runCompodoc({ compodocArgs: options.compodocArgs, tsconfig: tsConfig }, context).pipe(operators_1.mapTo({ tsConfig }))
67
28
  : rxjs_1.of({});
68
- return runCompodoc$.pipe(operators_1.mapTo({ tsConfig: tsConfig }));
69
- }), operators_1.map(function (_a) {
70
- var tsConfig = _a.tsConfig;
71
- var browserTarget = options.browserTarget, stylePreprocessorOptions = options.stylePreprocessorOptions, styles = options.styles, ci = options.ci, configDir = options.configDir, docs = options.docs, host = options.host, https = options.https, port = options.port, quiet = options.quiet, smokeTest = options.smokeTest, sslCa = options.sslCa, sslCert = options.sslCert, sslKey = options.sslKey;
72
- var standaloneOptions = {
73
- ci: ci,
74
- configDir: configDir,
75
- docs: docs,
76
- host: host,
77
- https: https,
78
- port: port,
79
- quiet: quiet,
80
- smokeTest: smokeTest,
81
- sslCa: sslCa,
82
- sslCert: sslCert,
83
- sslKey: sslKey,
29
+ return runCompodoc$.pipe(operators_1.mapTo({ tsConfig }));
30
+ }), operators_1.map(({ tsConfig }) => {
31
+ const { browserTarget, stylePreprocessorOptions, styles, ci, configDir, docs, host, https, port, quiet, smokeTest, sslCa, sslCert, sslKey, } = options;
32
+ const standaloneOptions = {
33
+ ci,
34
+ configDir,
35
+ docs,
36
+ host,
37
+ https,
38
+ port,
39
+ quiet,
40
+ smokeTest,
41
+ sslCa,
42
+ sslCert,
43
+ sslKey,
84
44
  angularBrowserTarget: browserTarget,
85
45
  angularBuilderContext: context,
86
- angularBuilderOptions: __assign(__assign({}, (stylePreprocessorOptions ? { stylePreprocessorOptions: stylePreprocessorOptions } : {})), (styles ? { styles: styles } : {})),
87
- tsConfig: tsConfig,
46
+ angularBuilderOptions: Object.assign(Object.assign({}, (stylePreprocessorOptions ? { stylePreprocessorOptions } : {})), (styles ? { styles } : {})),
47
+ tsConfig,
88
48
  };
89
49
  return standaloneOptions;
90
- }), operators_1.switchMap(function (standaloneOptions) { return runInstance(standaloneOptions); }), operators_1.map(function () {
50
+ }), operators_1.switchMap((standaloneOptions) => runInstance(standaloneOptions)), operators_1.map(() => {
91
51
  return { success: true };
92
52
  }));
93
53
  }
94
54
  function setup(options, context) {
95
55
  var _a, _b;
96
- return __awaiter(this, void 0, void 0, function () {
97
- var browserOptions, browserTarget, _c, _d, _e;
98
- return __generator(this, function (_f) {
99
- switch (_f.label) {
100
- case 0:
101
- if (!options.browserTarget) return [3 /*break*/, 4];
102
- browserTarget = architect_1.targetFromTargetString(options.browserTarget);
103
- _d = (_c = context).validateOptions;
104
- return [4 /*yield*/, context.getTargetOptions(browserTarget)];
105
- case 1:
106
- _e = [_f.sent()];
107
- return [4 /*yield*/, context.getBuilderNameForTarget(browserTarget)];
108
- case 2: return [4 /*yield*/, _d.apply(_c, _e.concat([_f.sent()]))];
109
- case 3:
110
- browserOptions = _f.sent();
111
- _f.label = 4;
112
- case 4: return [2 /*return*/, {
113
- tsConfig: (_b = (_a = options.tsConfig) !== null && _a !== void 0 ? _a : find_up_1.sync('tsconfig.json', { cwd: options.configDir })) !== null && _b !== void 0 ? _b : browserOptions.tsConfig,
114
- }];
115
- }
116
- });
56
+ return __awaiter(this, void 0, void 0, function* () {
57
+ let browserOptions;
58
+ let browserTarget;
59
+ if (options.browserTarget) {
60
+ browserTarget = architect_1.targetFromTargetString(options.browserTarget);
61
+ browserOptions = yield context.validateOptions(yield context.getTargetOptions(browserTarget), yield context.getBuilderNameForTarget(browserTarget));
62
+ }
63
+ return {
64
+ tsConfig: (_b = (_a = options.tsConfig) !== null && _a !== void 0 ? _a : find_up_1.sync('tsconfig.json', { cwd: options.configDir })) !== null && _b !== void 0 ? _b : browserOptions.tsConfig,
65
+ };
117
66
  });
118
67
  }
119
68
  function runInstance(options) {
120
- return new rxjs_1.Observable(function (observer) {
69
+ return new rxjs_1.Observable((observer) => {
121
70
  // This Observable intentionally never complete, leaving the process running ;)
122
- standalone_1.default(options).then(function () { return observer.next(); }, function (error) { return observer.error(build_standalone_errors_handler_1.buildStandaloneErrorHandler(error)); });
71
+ standalone_1.default(options).then(() => observer.next(), (error) => observer.error(build_standalone_errors_handler_1.buildStandaloneErrorHandler(error)));
123
72
  });
124
73
  }
@@ -96,8 +96,7 @@
96
96
  "type": "array",
97
97
  "items": {
98
98
  "type": "string"
99
- },
100
- "default": []
99
+ }
101
100
  }
102
101
  },
103
102
  "additionalProperties": false,
@@ -1,16 +1,12 @@
1
1
  "use strict";
2
- var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
3
- if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
4
- return cooked;
5
- };
6
2
  var __importDefault = (this && this.__importDefault) || function (mod) {
7
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
8
4
  };
9
5
  Object.defineProperty(exports, "__esModule", { value: true });
10
6
  exports.buildStandaloneErrorHandler = void 0;
11
- var node_logger_1 = require("@storybook/node-logger");
12
- var ts_dedent_1 = __importDefault(require("ts-dedent"));
13
- exports.buildStandaloneErrorHandler = function (error) {
7
+ const node_logger_1 = require("@storybook/node-logger");
8
+ const ts_dedent_1 = __importDefault(require("ts-dedent"));
9
+ exports.buildStandaloneErrorHandler = (error) => {
14
10
  var _a;
15
11
  // Duplicate code for Standalone error handling
16
12
  // Source: https://github.com/storybookjs/storybook/blob/39c7ba09ad84fbd466f9c25d5b92791a5450b9f6/lib/core-server/src/build-dev.ts#L136
@@ -20,17 +16,23 @@ exports.buildStandaloneErrorHandler = function (error) {
20
16
  node_logger_1.logger.error(error.error);
21
17
  }
22
18
  else if (error.stats && error.stats.compilation.errors) {
23
- error.stats.compilation.errors.forEach(function (e) { return node_logger_1.logger.plain(e); });
19
+ error.stats.compilation.errors.forEach((e) => node_logger_1.logger.plain(e));
24
20
  }
25
21
  else {
26
22
  node_logger_1.logger.error(error);
27
23
  }
28
24
  }
29
25
  else if ((_a = error.compilation) === null || _a === void 0 ? void 0 : _a.errors) {
30
- error.compilation.errors.forEach(function (e) { return node_logger_1.logger.plain(e); });
26
+ error.compilation.errors.forEach((e) => node_logger_1.logger.plain(e));
31
27
  }
32
28
  node_logger_1.logger.line();
33
29
  return error.close
34
- ? ts_dedent_1.default(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n FATAL broken build!, will close the process,\n Fix the error below and restart storybook.\n "], ["\n FATAL broken build!, will close the process,\n Fix the error below and restart storybook.\n "]))) : ts_dedent_1.default(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n Broken build, fix the error above.\n You may need to refresh the browser.\n "], ["\n Broken build, fix the error above.\n You may need to refresh the browser.\n "])));
30
+ ? ts_dedent_1.default `
31
+ FATAL broken build!, will close the process,
32
+ Fix the error below and restart storybook.
33
+ `
34
+ : ts_dedent_1.default `
35
+ Broken build, fix the error above.
36
+ You may need to refresh the browser.
37
+ `;
35
38
  };
36
- var templateObject_1, templateObject_2;