@storybook/angular 6.4.0-beta.8 → 6.4.0-rc.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/dist/ts3.4/builders/build-storybook/index.d.ts +1 -1
  2. package/dist/ts3.4/builders/start-storybook/index.d.ts +1 -1
  3. package/dist/ts3.4/client/preview/config.d.ts +2 -0
  4. package/dist/ts3.4/client/preview/decorateStory.d.ts +1 -0
  5. package/dist/ts3.4/server/angular-cli-webpack-12.2.x.d.ts +1 -0
  6. package/dist/ts3.4/server/angular-cli-webpack-13.x.x.d.ts +1 -0
  7. package/dist/ts3.4/server/angular-cli-webpack-older.d.ts +72 -0
  8. package/dist/ts3.4/server/angular-devkit-build-webpack.d.ts +1 -1
  9. package/dist/ts3.4/server/framework-preset-angular-cli.d.ts +2 -72
  10. package/dist/ts3.4/server/framework-preset-angular-ivy.d.ts +3 -3
  11. package/dist/ts3.4/server/options.d.ts +9 -1
  12. package/dist/ts3.4/server/preset.d.ts +3 -0
  13. package/dist/ts3.9/builders/build-storybook/index.d.ts +1 -1
  14. package/dist/ts3.9/builders/build-storybook/index.js +2 -1
  15. package/dist/ts3.9/builders/build-storybook/schema.json +0 -7
  16. package/dist/ts3.9/builders/start-storybook/index.d.ts +1 -1
  17. package/dist/ts3.9/builders/start-storybook/index.js +2 -1
  18. package/dist/ts3.9/builders/start-storybook/schema.json +1 -16
  19. package/dist/ts3.9/client/preview/config.d.ts +2 -0
  20. package/dist/ts3.9/client/preview/config.js +3 -0
  21. package/dist/ts3.9/client/preview/decorateStory.d.ts +1 -0
  22. package/dist/ts3.9/client/preview/decorateStory.js +2 -0
  23. package/dist/ts3.9/server/__mocks-ng-workspace__/with-angularBrowserTarget/angular.json +32 -0
  24. package/dist/ts3.9/server/angular-cli-webpack-12.2.x.d.ts +1 -0
  25. package/dist/ts3.9/server/angular-cli-webpack-12.2.x.js +93 -0
  26. package/dist/ts3.9/server/angular-cli-webpack-13.x.x.d.ts +1 -0
  27. package/dist/ts3.9/server/angular-cli-webpack-13.x.x.js +93 -0
  28. package/dist/ts3.9/server/angular-cli-webpack-older.d.ts +72 -0
  29. package/dist/ts3.9/server/angular-cli-webpack-older.js +156 -0
  30. package/dist/ts3.9/server/angular-devkit-build-webpack.d.ts +1 -1
  31. package/dist/ts3.9/server/angular-devkit-build-webpack.js +18 -8
  32. package/dist/ts3.9/server/framework-preset-angular-cli.d.ts +2 -72
  33. package/dist/ts3.9/server/framework-preset-angular-cli.js +123 -88
  34. package/dist/ts3.9/server/framework-preset-angular-ivy.d.ts +3 -3
  35. package/dist/ts3.9/server/framework-preset-angular-ivy.js +45 -10
  36. package/dist/ts3.9/server/options.d.ts +9 -1
  37. package/dist/ts3.9/server/options.js +1 -5
  38. package/dist/ts3.9/server/preset.d.ts +3 -0
  39. package/dist/ts3.9/server/preset.js +21 -0
  40. package/package.json +12 -10
  41. package/preset.js +1 -7
  42. package/standalone.d.ts +4 -0
  43. package/types-7-0.d.ts +1 -0
@@ -6,7 +6,7 @@ export declare type StorybookBuilderOptions = JsonObject & {
6
6
  tsConfig?: string;
7
7
  compodoc: boolean;
8
8
  compodocArgs: string[];
9
- } & Pick<CLIOptions, 'staticDir' | 'outputDir' | 'configDir' | 'loglevel' | 'quiet' | 'docs'>;
9
+ } & Pick<CLIOptions, 'outputDir' | 'configDir' | 'loglevel' | 'quiet' | 'docs'>;
10
10
  export declare type StorybookBuilderOutput = JsonObject & BuilderOutput & {};
11
11
  declare const _default: import("@angular-devkit/architect/src/internal").Builder<StorybookBuilderOptions>;
12
12
  export default _default;
@@ -6,7 +6,7 @@ export declare type StorybookBuilderOptions = JsonObject & {
6
6
  tsConfig?: string;
7
7
  compodoc: boolean;
8
8
  compodocArgs: string[];
9
- } & Pick<CLIOptions, 'port' | 'host' | 'staticDir' | 'configDir' | 'https' | 'sslCa' | 'sslCert' | 'sslKey' | 'smokeTest' | 'ci' | 'quiet' | 'docs'>;
9
+ } & Pick<CLIOptions, 'port' | 'host' | 'configDir' | 'https' | 'sslCa' | 'sslCert' | 'sslKey' | 'smokeTest' | 'ci' | 'quiet' | 'docs'>;
10
10
  export declare type StorybookBuilderOutput = JsonObject & BuilderOutput & {};
11
11
  declare const _default: import("@angular-devkit/architect/src/internal").Builder<StorybookBuilderOptions>;
12
12
  export default _default;
@@ -1,4 +1,6 @@
1
+ import './globals';
1
2
  export { render, renderToDOM } from './render';
3
+ export { decorateStory } from './decorateStory';
2
4
  export declare const parameters: {
3
5
  framework: string;
4
6
  };
@@ -1,3 +1,4 @@
1
1
  import { DecoratorFunction, LegacyStoryFn } from '@storybook/csf';
2
2
  import { AngularFramework } from './types-6-0';
3
3
  export default function decorateStory(mainStoryFn: LegacyStoryFn<AngularFramework>, decorators: DecoratorFunction<AngularFramework>[]): LegacyStoryFn<AngularFramework>;
4
+ export { decorateStory };
@@ -0,0 +1 @@
1
+ export function getWebpackConfig(baseConfig: any, { builderOptions, builderContext }: any): Promise<any>;
@@ -0,0 +1 @@
1
+ export function getWebpackConfig(baseConfig: any, { builderOptions, builderContext }: any): Promise<any>;
@@ -0,0 +1,72 @@
1
+ import webpack from 'webpack';
2
+ import TsconfigPathsPlugin from 'tsconfig-paths-webpack-plugin';
3
+ import { PresetOptions } from './options';
4
+ /**
5
+ * Old way currently support version lower than 12.2.x
6
+ */
7
+ export declare function getWebpackConfig(baseConfig: webpack.Configuration, options: PresetOptions): Promise<webpack.Configuration | {
8
+ entry: any[];
9
+ module: {
10
+ rules: webpack.RuleSetRule[];
11
+ noParse?: RegExp | RegExp[] | ((content: string) => boolean);
12
+ unknownContextRequest?: string;
13
+ unknownContextRecursive?: boolean;
14
+ unknownContextRegExp?: RegExp;
15
+ unknownContextCritical?: boolean;
16
+ exprContextRequest?: string;
17
+ exprContextRegExp?: RegExp;
18
+ exprContextRecursive?: boolean;
19
+ exprContextCritical?: boolean;
20
+ wrappedContextRegExp?: RegExp;
21
+ wrappedContextRecursive?: boolean;
22
+ wrappedContextCritical?: boolean;
23
+ strictExportPresence?: boolean;
24
+ };
25
+ plugins: webpack.Plugin[];
26
+ resolve: {
27
+ modules: string[];
28
+ plugins: TsconfigPathsPlugin[];
29
+ descriptionFiles?: string[];
30
+ mainFields?: string[] | string[][];
31
+ aliasFields?: string[] | string[][];
32
+ mainFiles?: string[];
33
+ extensions?: string[];
34
+ enforceExtension?: boolean;
35
+ alias?: {
36
+ [key: string]: string;
37
+ };
38
+ unsafeCache?: boolean | {};
39
+ cachePredicate?(data: {
40
+ path: string;
41
+ request: string;
42
+ }): boolean;
43
+ symlinks?: boolean;
44
+ cacheWithContext?: boolean;
45
+ roots?: string[];
46
+ };
47
+ resolveLoader: webpack.ResolveLoader;
48
+ mode?: "development" | "production" | "none";
49
+ name?: string;
50
+ context?: string;
51
+ devtool?: webpack.Options.Devtool;
52
+ output?: webpack.Output;
53
+ externals?: string | RegExp | webpack.ExternalsObjectElement | webpack.ExternalsFunctionElement | webpack.ExternalsElement[];
54
+ target?: "node" | "web" | "webworker" | "async-node" | "node-webkit" | "atom" | "electron" | "electron-renderer" | "electron-preload" | "electron-main" | ((compiler?: any) => void);
55
+ bail?: boolean;
56
+ profile?: boolean;
57
+ cache?: boolean | object;
58
+ watch?: boolean;
59
+ watchOptions?: webpack.ICompiler.WatchOptions;
60
+ node?: false | webpack.Node;
61
+ amd?: {
62
+ [moduleName: string]: boolean;
63
+ };
64
+ recordsPath?: string;
65
+ recordsInputPath?: string;
66
+ recordsOutputPath?: string;
67
+ stats?: webpack.Stats.ToStringOptions;
68
+ performance?: false | webpack.Options.Performance;
69
+ parallelism?: number;
70
+ optimization?: webpack.Options.Optimization;
71
+ devServer?: import("webpack-dev-server").Configuration;
72
+ }>;
@@ -27,4 +27,4 @@ export declare type AngularCliWebpackConfig = {
27
27
  * Uses angular cli to extract webpack configuration.
28
28
  * The `AngularCliWebpackConfig` type lists the parts used by storybook
29
29
  */
30
- export declare function extractAngularCliWebpackConfig(dirToSearch: string, project: workspaces.ProjectDefinition, target: workspaces.TargetDefinition): Promise<AngularCliWebpackConfig>;
30
+ export declare function extractAngularCliWebpackConfig(dirToSearch: string, project: workspaces.ProjectDefinition, target: workspaces.TargetDefinition, confName?: string): Promise<AngularCliWebpackConfig>;
@@ -1,73 +1,3 @@
1
1
  import webpack from 'webpack';
2
- import TsconfigPathsPlugin from 'tsconfig-paths-webpack-plugin';
3
- import { Options as CoreOptions } from '@storybook/core-common';
4
- export declare type Options = CoreOptions & {
5
- angularBrowserTarget?: string;
6
- tsConfig?: string;
7
- };
8
- export declare function webpackFinal(baseConfig: webpack.Configuration, options: Options): Promise<webpack.Configuration | {
9
- entry: any[];
10
- module: {
11
- rules: webpack.RuleSetRule[];
12
- noParse?: RegExp | RegExp[] | ((content: string) => boolean);
13
- unknownContextRequest?: string;
14
- unknownContextRecursive?: boolean;
15
- unknownContextRegExp?: RegExp;
16
- unknownContextCritical?: boolean;
17
- exprContextRequest?: string;
18
- exprContextRegExp?: RegExp;
19
- exprContextRecursive?: boolean;
20
- exprContextCritical?: boolean;
21
- wrappedContextRegExp?: RegExp;
22
- wrappedContextRecursive?: boolean;
23
- wrappedContextCritical?: boolean;
24
- strictExportPresence?: boolean;
25
- };
26
- plugins: webpack.Plugin[];
27
- resolve: {
28
- modules: string[];
29
- plugins: TsconfigPathsPlugin[];
30
- descriptionFiles?: string[];
31
- mainFields?: string[] | string[][];
32
- aliasFields?: string[] | string[][];
33
- mainFiles?: string[];
34
- extensions?: string[];
35
- enforceExtension?: boolean;
36
- alias?: {
37
- [key: string]: string;
38
- };
39
- unsafeCache?: boolean | {};
40
- cachePredicate?(data: {
41
- path: string;
42
- request: string;
43
- }): boolean;
44
- symlinks?: boolean;
45
- cacheWithContext?: boolean;
46
- roots?: string[];
47
- };
48
- resolveLoader: webpack.ResolveLoader;
49
- mode?: "development" | "production" | "none";
50
- name?: string;
51
- context?: string;
52
- devtool?: webpack.Options.Devtool;
53
- output?: webpack.Output;
54
- externals?: string | RegExp | webpack.ExternalsObjectElement | webpack.ExternalsFunctionElement | webpack.ExternalsElement[];
55
- target?: "node" | "web" | "webworker" | "async-node" | "node-webkit" | "atom" | "electron" | "electron-renderer" | "electron-preload" | "electron-main" | ((compiler?: any) => void);
56
- bail?: boolean;
57
- profile?: boolean;
58
- cache?: boolean | object;
59
- watch?: boolean;
60
- watchOptions?: webpack.ICompiler.WatchOptions;
61
- node?: false | webpack.Node;
62
- amd?: {
63
- [moduleName: string]: boolean;
64
- };
65
- recordsPath?: string;
66
- recordsInputPath?: string;
67
- recordsOutputPath?: string;
68
- stats?: webpack.Stats.ToStringOptions;
69
- performance?: false | webpack.Options.Performance;
70
- parallelism?: number;
71
- optimization?: webpack.Options.Optimization;
72
- devServer?: import("webpack-dev-server").Configuration;
73
- }>;
2
+ import { PresetOptions } from './options';
3
+ export declare function webpackFinal(baseConfig: webpack.Configuration, options: PresetOptions): Promise<webpack.Configuration>;
@@ -1,10 +1,10 @@
1
1
  import { Configuration } from 'webpack';
2
- import { Options } from './framework-preset-angular-cli';
2
+ import { PresetOptions } from './options';
3
3
  /**
4
4
  * Run ngcc for converting modules to ivy format before starting storybook
5
5
  * This step is needed in order to support Ivy in storybook
6
6
  *
7
7
  * Information about Ivy can be found here https://angular.io/guide/ivy
8
8
  */
9
- export declare const runNgcc: () => void;
10
- export declare const webpack: (webpackConfig: Configuration, options: Options) => Promise<Configuration>;
9
+ export declare const runNgcc: () => Promise<void>;
10
+ export declare const webpack: (webpackConfig: Configuration, options: PresetOptions) => Promise<Configuration>;
@@ -1,3 +1,11 @@
1
- import { LoadOptions } from '@storybook/core-common';
1
+ import { LoadOptions, Options as CoreOptions } from '@storybook/core-common';
2
+ import { BuilderContext } from '@angular-devkit/architect';
3
+ import { JsonObject } from '@angular-devkit/core';
4
+ export declare type PresetOptions = CoreOptions & {
5
+ angularBrowserTarget?: string | null;
6
+ angularBuilderOptions?: JsonObject | null;
7
+ angularBuilderContext?: BuilderContext | null;
8
+ tsConfig?: string;
9
+ };
2
10
  declare const _default: LoadOptions;
3
11
  export default _default;
@@ -0,0 +1,3 @@
1
+ import { StorybookConfig } from '@storybook/core-common';
2
+ export declare const config: StorybookConfig['config'];
3
+ export declare const addons: StorybookConfig['addons'];
@@ -6,7 +6,7 @@ export declare type StorybookBuilderOptions = JsonObject & {
6
6
  tsConfig?: string;
7
7
  compodoc: boolean;
8
8
  compodocArgs: string[];
9
- } & Pick<CLIOptions, 'staticDir' | 'outputDir' | 'configDir' | 'loglevel' | 'quiet' | 'docs'>;
9
+ } & Pick<CLIOptions, 'outputDir' | 'configDir' | 'loglevel' | 'quiet' | 'docs'>;
10
10
  export declare type StorybookBuilderOutput = JsonObject & BuilderOutput & {};
11
11
  declare const _default: import("@angular-devkit/architect/src/internal").Builder<StorybookBuilderOptions>;
12
12
  export default _default;
@@ -79,7 +79,8 @@ function commandBuilder(options, context) {
79
79
  }), operators_1.map(function (_a) {
80
80
  var tsConfig = _a.tsConfig;
81
81
  var browserTarget = options.browserTarget, otherOptions = __rest(options, ["browserTarget"]);
82
- return __assign(__assign({}, otherOptions), { angularBrowserTarget: browserTarget, tsConfig: tsConfig });
82
+ var standaloneOptions = __assign(__assign({}, otherOptions), { angularBrowserTarget: browserTarget, angularBuilderContext: context, tsConfig: tsConfig });
83
+ return standaloneOptions;
83
84
  }), operators_1.switchMap(function (standaloneOptions) { return runInstance(__assign(__assign({}, standaloneOptions), { mode: 'static' })); }), operators_1.map(function () {
84
85
  return { success: true };
85
86
  }));
@@ -14,13 +14,6 @@
14
14
  "type": "string",
15
15
  "description": "The full path for the TypeScript configuration file, relative to the current workspace."
16
16
  },
17
- "staticDir": {
18
- "type": "array",
19
- "description": "Directory where to load static files from, array of strings.",
20
- "items": {
21
- "type": "string"
22
- }
23
- },
24
17
  "outputDir": {
25
18
  "type": "string",
26
19
  "description": "Directory where to store built files.",
@@ -6,7 +6,7 @@ export declare type StorybookBuilderOptions = JsonObject & {
6
6
  tsConfig?: string;
7
7
  compodoc: boolean;
8
8
  compodocArgs: string[];
9
- } & Pick<CLIOptions, 'port' | 'host' | 'staticDir' | 'configDir' | 'https' | 'sslCa' | 'sslCert' | 'sslKey' | 'smokeTest' | 'ci' | 'quiet' | 'docs'>;
9
+ } & Pick<CLIOptions, 'port' | 'host' | 'configDir' | 'https' | 'sslCa' | 'sslCert' | 'sslKey' | 'smokeTest' | 'ci' | 'quiet' | 'docs'>;
10
10
  export declare type StorybookBuilderOutput = JsonObject & BuilderOutput & {};
11
11
  declare const _default: import("@angular-devkit/architect/src/internal").Builder<StorybookBuilderOptions>;
12
12
  export default _default;
@@ -79,7 +79,8 @@ function commandBuilder(options, context) {
79
79
  }), operators_1.map(function (_a) {
80
80
  var tsConfig = _a.tsConfig;
81
81
  var browserTarget = options.browserTarget, otherOptions = __rest(options, ["browserTarget"]);
82
- return __assign(__assign({}, otherOptions), { angularBrowserTarget: browserTarget, tsConfig: tsConfig });
82
+ var standaloneOptions = __assign(__assign({}, otherOptions), { angularBrowserTarget: browserTarget, angularBuilderContext: context, tsConfig: tsConfig });
83
+ return standaloneOptions;
83
84
  }), operators_1.switchMap(function (standaloneOptions) { return runInstance(standaloneOptions); }), operators_1.map(function () {
84
85
  return { success: true };
85
86
  }));
@@ -24,13 +24,6 @@
24
24
  "description": "Host to listen on.",
25
25
  "default": "localhost"
26
26
  },
27
- "staticDir": {
28
- "type": "array",
29
- "description": "Directory where to load static files from, array of strings.",
30
- "items": {
31
- "type": "string"
32
- }
33
- },
34
27
  "configDir": {
35
28
  "type": "string",
36
29
  "description": "Directory where to load Storybook configurations from.",
@@ -87,13 +80,5 @@
87
80
  }
88
81
  }
89
82
  },
90
- "additionalProperties": false,
91
- "oneOf": [
92
- {
93
- "required": ["browserTarget"]
94
- },
95
- {
96
- "required": ["tsConfig"]
97
- }
98
- ]
83
+ "additionalProperties": false
99
84
  }
@@ -1,4 +1,6 @@
1
+ import './globals';
1
2
  export { render, renderToDOM } from './render';
3
+ export { decorateStory } from './decorateStory';
2
4
  export declare const parameters: {
3
5
  framework: string;
4
6
  };
@@ -1,7 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.parameters = void 0;
4
+ require("./globals");
4
5
  var render_1 = require("./render");
5
6
  Object.defineProperty(exports, "render", { enumerable: true, get: function () { return render_1.render; } });
6
7
  Object.defineProperty(exports, "renderToDOM", { enumerable: true, get: function () { return render_1.renderToDOM; } });
8
+ var decorateStory_1 = require("./decorateStory");
9
+ Object.defineProperty(exports, "decorateStory", { enumerable: true, get: function () { return decorateStory_1.decorateStory; } });
7
10
  exports.parameters = { framework: 'angular' };
@@ -1,3 +1,4 @@
1
1
  import { DecoratorFunction, LegacyStoryFn } from '@storybook/csf';
2
2
  import { AngularFramework } from './types-6-0';
3
3
  export default function decorateStory(mainStoryFn: LegacyStoryFn<AngularFramework>, decorators: DecoratorFunction<AngularFramework>[]): LegacyStoryFn<AngularFramework>;
4
+ export { decorateStory };
@@ -18,6 +18,7 @@ var __spreadArrays = (this && this.__spreadArrays) || function () {
18
18
  return r;
19
19
  };
20
20
  Object.defineProperty(exports, "__esModule", { value: true });
21
+ exports.decorateStory = void 0;
21
22
  var store_1 = require("@storybook/store");
22
23
  var ComputesTemplateFromComponent_1 = require("./angular-beta/ComputesTemplateFromComponent");
23
24
  function decorateStory(mainStoryFn, decorators) {
@@ -30,6 +31,7 @@ function decorateStory(mainStoryFn, decorators) {
30
31
  return returnDecorators;
31
32
  }
32
33
  exports.default = decorateStory;
34
+ exports.decorateStory = decorateStory;
33
35
  var prepareMain = function (story, context) {
34
36
  var _a;
35
37
  var template = story.template;
@@ -12,6 +12,33 @@
12
12
  }
13
13
  }
14
14
  },
15
+ "no-confs-project": {
16
+ "root": "",
17
+ "architect": {
18
+ "target-build": {
19
+ "options": {
20
+ "tsConfig": "src/tsconfig.app.json",
21
+ "assets": []
22
+ }
23
+ }
24
+ }
25
+ },
26
+ "no-target-conf-project": {
27
+ "root": "",
28
+ "architect": {
29
+ "target-build": {
30
+ "options": {
31
+ "tsConfig": "src/tsconfig.app.json",
32
+ "assets": []
33
+ },
34
+ "configurations": {
35
+ "other-conf": {
36
+ "styles": ["src/styles.css"]
37
+ }
38
+ }
39
+ }
40
+ }
41
+ },
15
42
  "target-project": {
16
43
  "root": "",
17
44
  "architect": {
@@ -19,6 +46,11 @@
19
46
  "options": {
20
47
  "tsConfig": "src/tsconfig.app.json",
21
48
  "assets": []
49
+ },
50
+ "configurations": {
51
+ "target-conf": {
52
+ "styles": ["src/styles.css"]
53
+ }
22
54
  }
23
55
  }
24
56
  }
@@ -0,0 +1 @@
1
+ export function getWebpackConfig(baseConfig: any, { builderOptions, builderContext }: any): Promise<any>;
@@ -0,0 +1,93 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
13
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
14
+ return new (P || (P = Promise))(function (resolve, reject) {
15
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
16
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
17
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
18
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
19
+ });
20
+ };
21
+ var __generator = (this && this.__generator) || function (thisArg, body) {
22
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
23
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
24
+ function verb(n) { return function (v) { return step([n, v]); }; }
25
+ function step(op) {
26
+ if (f) throw new TypeError("Generator is already executing.");
27
+ while (_) try {
28
+ 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;
29
+ if (y = 0, t) op = [op[0] & 2, t.value];
30
+ switch (op[0]) {
31
+ case 0: case 1: t = op; break;
32
+ case 4: _.label++; return { value: op[1], done: false };
33
+ case 5: _.label++; y = op[1]; op = [0]; continue;
34
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
35
+ default:
36
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
37
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
38
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
39
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
40
+ if (t[2]) _.ops.pop();
41
+ _.trys.pop(); continue;
42
+ }
43
+ op = body.call(thisArg, _);
44
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
45
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
46
+ }
47
+ };
48
+ var __spreadArrays = (this && this.__spreadArrays) || function () {
49
+ for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
50
+ for (var r = Array(s), k = 0, i = 0; i < il; i++)
51
+ for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
52
+ r[k] = a[j];
53
+ return r;
54
+ };
55
+ // Private angular devkit stuff
56
+ var generateI18nBrowserWebpackConfigFromContext = require('@angular-devkit/build-angular/src/utils/webpack-browser-config').generateI18nBrowserWebpackConfigFromContext;
57
+ var _a = require('@angular-devkit/build-angular/src/webpack/configs'), getCommonConfig = _a.getCommonConfig, getStylesConfig = _a.getStylesConfig, getTypeScriptConfig = _a.getTypeScriptConfig;
58
+ var filterOutStylingRules = require('./utils/filter-out-styling-rules').filterOutStylingRules;
59
+ /**
60
+ * Extract webpack config from angular-cli 12.2.x
61
+ * ⚠️ This file is in JavaScript to not use TypeScript. Because current storybook TypeScript version is not compatible with Angular CLI.
62
+ * FIXME: Try another way with TypeScript on future storybook version (7 maybe 🤞)
63
+ *
64
+ * @param {*} baseConfig Previous webpack config from storybook
65
+ * @param {*} options { builderOptions, builderContext }
66
+ */
67
+ exports.getWebpackConfig = function (baseConfig, _a) {
68
+ var builderOptions = _a.builderOptions, builderContext = _a.builderContext;
69
+ return __awaiter(void 0, void 0, void 0, function () {
70
+ var cliConfig, entry, rulesExcludingStyles, module, plugins, resolve;
71
+ var _b, _c, _d;
72
+ return __generator(this, function (_e) {
73
+ switch (_e.label) {
74
+ case 0: return [4 /*yield*/, generateI18nBrowserWebpackConfigFromContext(__assign(__assign({
75
+ // Default options
76
+ index: 'noop-index', main: 'noop-main', outputPath: 'noop-out' }, builderOptions), {
77
+ // Fixed options
78
+ optimization: false, namedChunks: false, progress: false, buildOptimizer: false, aot: false }), builderContext, function (wco) { return [getCommonConfig(wco), getStylesConfig(wco), getTypeScriptConfig(wco)]; })];
79
+ case 1:
80
+ cliConfig = (_e.sent()).config;
81
+ entry = __spreadArrays(baseConfig.entry, ((_b = cliConfig.entry.styles) !== null && _b !== void 0 ? _b : []), ((_c = cliConfig.entry.polyfills) !== null && _c !== void 0 ? _c : []));
82
+ rulesExcludingStyles = filterOutStylingRules(baseConfig);
83
+ module = __assign(__assign({}, baseConfig.module), { rules: __spreadArrays(cliConfig.module.rules, rulesExcludingStyles) });
84
+ plugins = __spreadArrays(((_d = cliConfig.plugins) !== null && _d !== void 0 ? _d : []), baseConfig.plugins);
85
+ resolve = __assign(__assign({}, baseConfig.resolve), { modules: Array.from(new Set(__spreadArrays(baseConfig.resolve.modules, cliConfig.resolve.modules))) });
86
+ return [2 /*return*/, __assign(__assign({}, baseConfig), { entry: entry,
87
+ module: module,
88
+ plugins: plugins,
89
+ resolve: resolve, resolveLoader: cliConfig.resolveLoader })];
90
+ }
91
+ });
92
+ });
93
+ };
@@ -0,0 +1 @@
1
+ export function getWebpackConfig(baseConfig: any, { builderOptions, builderContext }: any): Promise<any>;
@@ -0,0 +1,93 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
13
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
14
+ return new (P || (P = Promise))(function (resolve, reject) {
15
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
16
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
17
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
18
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
19
+ });
20
+ };
21
+ var __generator = (this && this.__generator) || function (thisArg, body) {
22
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
23
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
24
+ function verb(n) { return function (v) { return step([n, v]); }; }
25
+ function step(op) {
26
+ if (f) throw new TypeError("Generator is already executing.");
27
+ while (_) try {
28
+ 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;
29
+ if (y = 0, t) op = [op[0] & 2, t.value];
30
+ switch (op[0]) {
31
+ case 0: case 1: t = op; break;
32
+ case 4: _.label++; return { value: op[1], done: false };
33
+ case 5: _.label++; y = op[1]; op = [0]; continue;
34
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
35
+ default:
36
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
37
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
38
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
39
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
40
+ if (t[2]) _.ops.pop();
41
+ _.trys.pop(); continue;
42
+ }
43
+ op = body.call(thisArg, _);
44
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
45
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
46
+ }
47
+ };
48
+ var __spreadArrays = (this && this.__spreadArrays) || function () {
49
+ for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
50
+ for (var r = Array(s), k = 0, i = 0; i < il; i++)
51
+ for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
52
+ r[k] = a[j];
53
+ return r;
54
+ };
55
+ // Private angular devkit stuff
56
+ var generateI18nBrowserWebpackConfigFromContext = require('@angular-devkit/build-angular/src/utils/webpack-browser-config').generateI18nBrowserWebpackConfigFromContext;
57
+ var _a = require('@angular-devkit/build-angular/src/webpack/configs'), getCommonConfig = _a.getCommonConfig, getStylesConfig = _a.getStylesConfig, getTypescriptWorkerPlugin = _a.getTypescriptWorkerPlugin;
58
+ var filterOutStylingRules = require('./utils/filter-out-styling-rules').filterOutStylingRules;
59
+ /**
60
+ * Extract webpack config from angular-cli 13.x.x
61
+ * ⚠️ This file is in JavaScript to not use TypeScript. Because current storybook TypeScript version is not compatible with Angular CLI.
62
+ * FIXME: Try another way with TypeScript on future storybook version (7 maybe 🤞)
63
+ *
64
+ * @param {*} baseConfig Previous webpack config from storybook
65
+ * @param {*} options { builderOptions, builderContext }
66
+ */
67
+ exports.getWebpackConfig = function (baseConfig, _a) {
68
+ var builderOptions = _a.builderOptions, builderContext = _a.builderContext;
69
+ return __awaiter(void 0, void 0, void 0, function () {
70
+ var cliConfig, entry, rulesExcludingStyles, module, plugins, resolve;
71
+ var _b, _c, _d;
72
+ return __generator(this, function (_e) {
73
+ switch (_e.label) {
74
+ case 0: return [4 /*yield*/, generateI18nBrowserWebpackConfigFromContext(__assign(__assign({
75
+ // Default options
76
+ index: 'noop-index', main: 'noop-main', outputPath: 'noop-out' }, builderOptions), {
77
+ // Fixed options
78
+ optimization: false, namedChunks: false, progress: false, buildOptimizer: false, aot: false }), builderContext, function (wco) { return [getCommonConfig(wco), getStylesConfig(wco), getTypescriptWorkerPlugin(wco)]; })];
79
+ case 1:
80
+ cliConfig = (_e.sent()).config;
81
+ entry = __spreadArrays(baseConfig.entry, ((_b = cliConfig.entry.styles) !== null && _b !== void 0 ? _b : []), ((_c = cliConfig.entry.polyfills) !== null && _c !== void 0 ? _c : []));
82
+ rulesExcludingStyles = filterOutStylingRules(baseConfig);
83
+ module = __assign(__assign({}, baseConfig.module), { rules: __spreadArrays(cliConfig.module.rules, rulesExcludingStyles) });
84
+ plugins = __spreadArrays(((_d = cliConfig.plugins) !== null && _d !== void 0 ? _d : []), baseConfig.plugins);
85
+ resolve = __assign(__assign({}, baseConfig.resolve), { modules: Array.from(new Set(__spreadArrays(baseConfig.resolve.modules, cliConfig.resolve.modules))) });
86
+ return [2 /*return*/, __assign(__assign({}, baseConfig), { entry: entry,
87
+ module: module,
88
+ plugins: plugins,
89
+ resolve: resolve, resolveLoader: cliConfig.resolveLoader })];
90
+ }
91
+ });
92
+ });
93
+ };