@storybook/angular 6.5.0-alpha.2 → 6.5.0-alpha.23

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.
@@ -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
  }>;
@@ -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>;
@@ -10,18 +10,23 @@ Object.defineProperty(exports, "__esModule", { value: true });
10
10
  exports.runCompodoc = void 0;
11
11
  var child_process_1 = require("child_process");
12
12
  var rxjs_1 = require("rxjs");
13
+ var hasTsConfigArg = function (args) { return args.indexOf('-p') !== -1; };
13
14
  exports.runCompodoc = function (_a, context) {
14
15
  var compodocArgs = _a.compodocArgs, tsconfig = _a.tsconfig;
15
16
  return new rxjs_1.Observable(function (observer) {
16
17
  var finalCompodocArgs = __spreadArrays([
17
- // Default options
18
- '-p',
19
- tsconfig,
18
+ 'compodoc'
19
+ ], (hasTsConfigArg(compodocArgs) ? [] : ['-p', tsconfig]), [
20
20
  '-d',
21
21
  "" + context.workspaceRoot
22
22
  ], compodocArgs);
23
23
  try {
24
- var child = child_process_1.spawn('compodoc', finalCompodocArgs);
24
+ context.logger.info(finalCompodocArgs.join(' '));
25
+ var child = child_process_1.spawn('npx', finalCompodocArgs, {
26
+ cwd: context.workspaceRoot,
27
+ env: process.env,
28
+ shell: true,
29
+ });
25
30
  child.stdout.on('data', function (data) {
26
31
  context.logger.info(data.toString());
27
32
  });
@@ -93,6 +93,25 @@ exports.computesTemplateSourceFromComponent = function (component, initialProps,
93
93
  return buildTemplate(ngComponentMetadata.selector, '', templateInputs, templateOutputs);
94
94
  };
95
95
  var buildTemplate = function (selector, innerTemplate, inputs, outputs) {
96
+ // https://www.w3.org/TR/2011/WD-html-markup-20110113/syntax.html#syntax-elements
97
+ var voidElements = [
98
+ 'area',
99
+ 'base',
100
+ 'br',
101
+ 'col',
102
+ 'command',
103
+ 'embed',
104
+ 'hr',
105
+ 'img',
106
+ 'input',
107
+ 'keygen',
108
+ 'link',
109
+ 'meta',
110
+ 'param',
111
+ 'source',
112
+ 'track',
113
+ 'wbr',
114
+ ];
96
115
  var firstSelector = selector.split(',')[0];
97
116
  var templateReplacers = [
98
117
  [/(^.*?)(?=[,])/, '$1'],
@@ -102,7 +121,14 @@ var buildTemplate = function (selector, innerTemplate, inputs, outputs) {
102
121
  [/#([\w-]+)/, " id=\"$1\""],
103
122
  [/((\.[\w-]+)+)/, function (_, c) { return " class=\"" + c.split(templateObject_1 || (templateObject_1 = __makeTemplateObject(["."], ["."]))).join(templateObject_2 || (templateObject_2 = __makeTemplateObject([" "], [" "]))).trim() + "\""; }],
104
123
  [/(\[.+?])/g, function (_, a) { return " " + a.slice(1, -1); }],
105
- [/([\S]+)(.*)/, "<$1$2" + inputs + outputs + ">" + innerTemplate + "</$1>"],
124
+ [
125
+ /([\S]+)(.*)/,
126
+ function (template, elementSelector) {
127
+ return voidElements.some(function (element) { return elementSelector === element; })
128
+ ? template.replace(/([\S]+)(.*)/, "<$1$2" + inputs + outputs + " />")
129
+ : template.replace(/([\S]+)(.*)/, "<$1$2" + inputs + outputs + ">" + innerTemplate + "</$1>");
130
+ },
131
+ ],
106
132
  ];
107
133
  return templateReplacers.reduce(function (prevSelector, _a) {
108
134
  var searchValue = _a[0], replacer = _a[1];
@@ -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
  */
@@ -20,6 +20,7 @@ var __spreadArrays = (this && this.__spreadArrays) || function () {
20
20
  Object.defineProperty(exports, "__esModule", { value: true });
21
21
  exports.getComponentDecoratorMetadata = exports.getComponentPropsDecoratorMetadata = exports.isComponent = exports.isDeclarable = exports.getComponentInputsOutputs = void 0;
22
22
  var core_1 = require("@angular/core");
23
+ var reflectionCapabilities = new core_1.ɵReflectionCapabilities();
23
24
  /**
24
25
  * Returns component Inputs / Outputs by browsing these properties and decorator
25
26
  */
@@ -70,20 +71,14 @@ exports.isDeclarable = function (component) {
70
71
  if (!component) {
71
72
  return false;
72
73
  }
73
- var decoratorKey = '__annotations__';
74
- var decorators = Reflect.getOwnPropertyDescriptor(component, decoratorKey)
75
- ? Reflect.getOwnPropertyDescriptor(component, decoratorKey).value
76
- : component[decoratorKey];
74
+ var decorators = reflectionCapabilities.annotations(component);
77
75
  return !!(decorators || []).find(function (d) { return d instanceof core_1.Directive || d instanceof core_1.Pipe || d instanceof core_1.Component; });
78
76
  };
79
77
  exports.isComponent = function (component) {
80
78
  if (!component) {
81
79
  return false;
82
80
  }
83
- var decoratorKey = '__annotations__';
84
- var decorators = Reflect.getOwnPropertyDescriptor(component, decoratorKey)
85
- ? Reflect.getOwnPropertyDescriptor(component, decoratorKey).value
86
- : component[decoratorKey];
81
+ var decorators = reflectionCapabilities.annotations(component);
87
82
  return (decorators || []).some(function (d) { return d instanceof core_1.Component; });
88
83
  };
89
84
  /**
@@ -91,34 +86,12 @@ exports.isComponent = function (component) {
91
86
  * is used to get all `@Input` and `@Output` Decorator
92
87
  */
93
88
  exports.getComponentPropsDecoratorMetadata = function (component) {
94
- var decoratorKey = '__prop__metadata__';
95
- var propsDecorators = Reflect &&
96
- Reflect.getOwnPropertyDescriptor &&
97
- Reflect.getOwnPropertyDescriptor(component, decoratorKey)
98
- ? Reflect.getOwnPropertyDescriptor(component, decoratorKey).value
99
- : component[decoratorKey];
100
- var parent = Reflect && Reflect.getPrototypeOf && Reflect.getPrototypeOf(component);
101
- if (parent) {
102
- var parentPropsDecorators = exports.getComponentPropsDecoratorMetadata(parent);
103
- propsDecorators = __assign(__assign({}, parentPropsDecorators), propsDecorators);
104
- }
105
- return propsDecorators;
89
+ return reflectionCapabilities.propMetadata(component);
106
90
  };
107
91
  /**
108
92
  * Returns component decorator `@Component`
109
93
  */
110
94
  exports.getComponentDecoratorMetadata = function (component) {
111
- var decoratorKey = '__annotations__';
112
- var decorators = Reflect &&
113
- Reflect.getOwnPropertyDescriptor &&
114
- Reflect.getOwnPropertyDescriptor(component, decoratorKey)
115
- ? Reflect.getOwnPropertyDescriptor(component, decoratorKey).value
116
- : component[decoratorKey];
117
- if (!decorators) {
118
- return (component.decorators &&
119
- component.decorators[0] &&
120
- component.decorators[0].args &&
121
- component.decorators[0].args[0]);
122
- }
123
- return decorators.find(function (d) { return d instanceof core_1.Component; });
95
+ var decorators = reflectionCapabilities.annotations(component);
96
+ return decorators.reverse().find(function (d) { return d instanceof core_1.Component; });
124
97
  };
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.isComponentAlreadyDeclaredInModules = void 0;
4
4
  var core_1 = require("@angular/core");
5
+ var reflectionCapabilities = new core_1.ɵReflectionCapabilities();
5
6
  /**
6
7
  * Avoid component redeclaration
7
8
  *
@@ -27,12 +28,7 @@ exports.isComponentAlreadyDeclaredInModules = function (componentToFind, moduleD
27
28
  };
28
29
  var extractNgModuleMetadata = function (importItem) {
29
30
  var target = importItem && importItem.ngModule ? importItem.ngModule : importItem;
30
- var decoratorKey = '__annotations__';
31
- var decorators = Reflect &&
32
- Reflect.getOwnPropertyDescriptor &&
33
- Reflect.getOwnPropertyDescriptor(target, decoratorKey)
34
- ? Reflect.getOwnPropertyDescriptor(target, decoratorKey).value
35
- : target[decoratorKey];
31
+ var decorators = reflectionCapabilities.annotations(target);
36
32
  if (!decorators || decorators.length === 0) {
37
33
  return null;
38
34
  }
@@ -22,12 +22,14 @@ exports.decorateStory = void 0;
22
22
  var store_1 = require("@storybook/store");
23
23
  var ComputesTemplateFromComponent_1 = require("./angular-beta/ComputesTemplateFromComponent");
24
24
  function decorateStory(mainStoryFn, decorators) {
25
- var returnDecorators = __spreadArrays([cleanArgsDecorator], decorators).reduce(function (previousStoryFn, decorator) { return function (context) {
26
- var decoratedStory = decorator(function (update) {
27
- return previousStoryFn(__assign(__assign({}, context), store_1.sanitizeStoryContextUpdate(update)));
28
- }, context);
29
- return decoratedStory;
30
- }; }, function (context) { return prepareMain(mainStoryFn(context), context); });
25
+ var returnDecorators = __spreadArrays([cleanArgsDecorator], decorators).reduce(function (previousStoryFn, decorator) {
26
+ return function (context) {
27
+ var decoratedStory = decorator(function (update) {
28
+ return previousStoryFn(__assign(__assign({}, context), store_1.sanitizeStoryContextUpdate(update)));
29
+ }, context);
30
+ return decoratedStory;
31
+ };
32
+ }, function (context) { return prepareMain(mainStoryFn(context), context); });
31
33
  return returnDecorators;
32
34
  }
33
35
  exports.default = decorateStory;
@@ -23,27 +23,31 @@ var ComputesTemplateFromComponent_1 = require("./angular-beta/ComputesTemplateFr
23
23
  var NgComponentAnalyzer_1 = require("./angular-beta/utils/NgComponentAnalyzer");
24
24
  // We use `any` here as the default type rather than `Args` because we need something that is
25
25
  // castable to any component-specific args type when the user is being careful.
26
- exports.moduleMetadata = function (metadata) { return function (storyFn) {
27
- var story = storyFn();
28
- var storyMetadata = story.moduleMetadata || {};
29
- metadata = metadata || {};
30
- return __assign(__assign({}, story), { moduleMetadata: {
31
- declarations: __spreadArrays((metadata.declarations || []), (storyMetadata.declarations || [])),
32
- entryComponents: __spreadArrays((metadata.entryComponents || []), (storyMetadata.entryComponents || [])),
33
- imports: __spreadArrays((metadata.imports || []), (storyMetadata.imports || [])),
34
- schemas: __spreadArrays((metadata.schemas || []), (storyMetadata.schemas || [])),
35
- providers: __spreadArrays((metadata.providers || []), (storyMetadata.providers || [])),
36
- } });
37
- }; };
38
- exports.componentWrapperDecorator = function (element, props) { return function (storyFn, storyContext) {
39
- var story = storyFn();
40
- var currentProps = typeof props === 'function' ? props(storyContext) : props;
41
- var template = NgComponentAnalyzer_1.isComponent(element)
42
- ? ComputesTemplateFromComponent_1.computesTemplateFromComponent(element, currentProps !== null && currentProps !== void 0 ? currentProps : {}, story.template)
43
- : element(story.template);
44
- return __assign(__assign(__assign({}, story), { template: template }), (currentProps || story.props
45
- ? {
46
- props: __assign(__assign({}, currentProps), story.props),
47
- }
48
- : {}));
49
- }; };
26
+ exports.moduleMetadata = function (metadata) {
27
+ return function (storyFn) {
28
+ var story = storyFn();
29
+ var storyMetadata = story.moduleMetadata || {};
30
+ metadata = metadata || {};
31
+ return __assign(__assign({}, story), { moduleMetadata: {
32
+ declarations: __spreadArrays((metadata.declarations || []), (storyMetadata.declarations || [])),
33
+ entryComponents: __spreadArrays((metadata.entryComponents || []), (storyMetadata.entryComponents || [])),
34
+ imports: __spreadArrays((metadata.imports || []), (storyMetadata.imports || [])),
35
+ schemas: __spreadArrays((metadata.schemas || []), (storyMetadata.schemas || [])),
36
+ providers: __spreadArrays((metadata.providers || []), (storyMetadata.providers || [])),
37
+ } });
38
+ };
39
+ };
40
+ exports.componentWrapperDecorator = function (element, props) {
41
+ return function (storyFn, storyContext) {
42
+ var story = storyFn();
43
+ var currentProps = typeof props === 'function' ? props(storyContext) : props;
44
+ var template = NgComponentAnalyzer_1.isComponent(element)
45
+ ? ComputesTemplateFromComponent_1.computesTemplateFromComponent(element, currentProps !== null && currentProps !== void 0 ? currentProps : {}, story.template)
46
+ : element(story.template);
47
+ return __assign(__assign(__assign({}, story), { template: template }), (currentProps || story.props
48
+ ? {
49
+ props: __assign(__assign({}, currentProps), story.props),
50
+ }
51
+ : {}));
52
+ };
53
+ };
@@ -54,7 +54,7 @@ var __spreadArrays = (this && this.__spreadArrays) || function () {
54
54
  };
55
55
  // Private angular devkit stuff
56
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;
57
+ var _a = require('@angular-devkit/build-angular/src/webpack/configs'), getCommonConfig = _a.getCommonConfig, getStylesConfig = _a.getStylesConfig, getDevServerConfig = _a.getDevServerConfig, getTypeScriptConfig = _a.getTypeScriptConfig;
58
58
  var TsconfigPathsPlugin = require('tsconfig-paths-webpack-plugin');
59
59
  var filterOutStylingRules = require('./utils/filter-out-styling-rules').filterOutStylingRules;
60
60
  /**
@@ -76,7 +76,11 @@ exports.getWebpackConfig = function (baseConfig, _a) {
76
76
  // Default options
77
77
  index: 'noop-index', main: 'noop-main', outputPath: 'noop-out' }, builderOptions), {
78
78
  // Fixed options
79
- optimization: false, namedChunks: false, progress: false, buildOptimizer: false, aot: false }), builderContext, function (wco) { return [getCommonConfig(wco), getStylesConfig(wco), getTypescriptWorkerPlugin(wco)]; })];
79
+ optimization: false, namedChunks: false, progress: false, buildOptimizer: false, aot: false }), builderContext, function (wco) { return [
80
+ getCommonConfig(wco),
81
+ getStylesConfig(wco),
82
+ getTypeScriptConfig ? getTypeScriptConfig(wco) : getDevServerConfig(wco),
83
+ ]; })];
80
84
  case 1:
81
85
  cliConfig = (_e.sent()).config;
82
86
  entry = __spreadArrays(baseConfig.entry, ((_b = cliConfig.entry.styles) !== null && _b !== void 0 ? _b : []), ((_c = cliConfig.entry.polyfills) !== null && _c !== void 0 ? _c : []));
@@ -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
  }>;
@@ -1,4 +1,8 @@
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
+ };
2
6
  var __assign = (this && this.__assign) || function () {
3
7
  __assign = Object.assign || function(t) {
4
8
  for (var s, i = 1, n = arguments.length; i < n; i++) {
@@ -74,6 +78,7 @@ var node_logger_1 = require("@storybook/node-logger");
74
78
  var architect_1 = require("@angular-devkit/architect");
75
79
  var find_up_1 = require("find-up");
76
80
  var semver_1 = __importDefault(require("@storybook/semver"));
81
+ var ts_dedent_1 = __importDefault(require("ts-dedent"));
77
82
  var core_1 = require("@angular-devkit/core");
78
83
  var module_is_available_1 = require("./utils/module-is-available");
79
84
  var angular_cli_webpack_12_2_x_1 = require("./angular-cli-webpack-12.2.x");
@@ -111,7 +116,7 @@ function webpackFinal(baseConfig, options) {
111
116
  case 2:
112
117
  legacyDefaultOptions = _a.sent();
113
118
  return [2 /*return*/, angular_cli_webpack_13_x_x_1.getWebpackConfig(_baseConfig, {
114
- builderOptions: __assign(__assign({}, builderOptions), legacyDefaultOptions),
119
+ builderOptions: __assign(__assign({ watch: options.configType === 'DEVELOPMENT' }, legacyDefaultOptions), builderOptions),
115
120
  builderContext: builderContext,
116
121
  })];
117
122
  }
@@ -208,6 +213,7 @@ function getLegacyDefaultBuildOptions(options) {
208
213
  // Not use legacy way with builder (`angularBrowserTarget` is defined or null with builder and undefined without)
209
214
  return [2 /*return*/, {}];
210
215
  }
216
+ node_logger_1.logger.warn(ts_dedent_1.default(templateObject_1 || (templateObject_1 = __makeTemplateObject(["Your Storybook startup uses a solution that will not be supported in version 7.0. \n You must use angular builder to have an explicit configuration on the project used in angular.json\n Read more at:\n - https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#sb-angular-builder)\n - https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#angular13)\n "], ["Your Storybook startup uses a solution that will not be supported in version 7.0. \n You must use angular builder to have an explicit configuration on the project used in angular.json\n Read more at:\n - https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#sb-angular-builder)\n - https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#angular13)\n "]))));
211
217
  dirToSearch = process.cwd();
212
218
  _b.label = 1;
213
219
  case 1:
@@ -243,3 +249,4 @@ function getLegacyDefaultBuildOptions(options) {
243
249
  });
244
250
  });
245
251
  }
252
+ var templateObject_1;
@@ -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>;
@@ -10,6 +10,61 @@ var __assign = (this && this.__assign) || function () {
10
10
  };
11
11
  return __assign.apply(this, arguments);
12
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
+ };
13
68
  var __spreadArrays = (this && this.__spreadArrays) || function () {
14
69
  for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
15
70
  for (var r = Array(s), k = 0, i = 0; i < il; i++)
@@ -23,52 +78,76 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
23
78
  Object.defineProperty(exports, "__esModule", { value: true });
24
79
  exports.webpack = void 0;
25
80
  var path_1 = __importDefault(require("path"));
81
+ var semver_1 = __importDefault(require("@storybook/semver"));
26
82
  var webpack_1 = require("webpack");
27
83
  var autoprefixer_1 = __importDefault(require("autoprefixer"));
28
84
  var ts_config_1 = __importDefault(require("./ts_config"));
29
85
  var create_fork_ts_checker_plugin_1 = __importDefault(require("./create-fork-ts-checker-plugin"));
30
86
  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
- ]) });
87
+ var configDir = _a.configDir, angularBuilderContext = _a.angularBuilderContext;
88
+ return __awaiter(this, void 0, void 0, function () {
89
+ var angularCliVersion, error_1, tsLoaderOptions;
90
+ return __generator(this, function (_b) {
91
+ switch (_b.label) {
92
+ case 0:
93
+ _b.trys.push([0, 2, , 3]);
94
+ return [4 /*yield*/, Promise.resolve().then(function () { return __importStar(require('@angular/cli')); }).then(function (m) {
95
+ return semver_1.default.coerce(m.VERSION.full);
96
+ })];
97
+ case 1:
98
+ angularCliVersion = _b.sent();
99
+ if ((semver_1.default.satisfies(angularCliVersion, '12.2.x') && angularBuilderContext) ||
100
+ semver_1.default.satisfies(angularCliVersion, '>=13.0.0')) {
101
+ return [2 /*return*/, config];
102
+ }
103
+ return [3 /*break*/, 3];
104
+ case 2:
105
+ error_1 = _b.sent();
106
+ return [3 /*break*/, 3];
107
+ case 3:
108
+ tsLoaderOptions = ts_config_1.default(configDir);
109
+ return [2 /*return*/, __assign(__assign({}, config), { module: __assign(__assign({}, config.module), { rules: __spreadArrays(config.module.rules, [
110
+ {
111
+ test: /\.tsx?$/,
112
+ use: [
113
+ {
114
+ loader: require.resolve('ts-loader'),
115
+ options: tsLoaderOptions,
116
+ },
117
+ { loader: path_1.default.resolve(__dirname, 'ngx-template-loader') },
118
+ ],
119
+ },
120
+ {
121
+ test: /[/\\]@angular[/\\]core[/\\].+\.js$/,
122
+ parser: { system: true },
123
+ },
124
+ {
125
+ test: /\.html$/,
126
+ loader: require.resolve('raw-loader'),
127
+ exclude: /\.async\.html$/,
128
+ },
129
+ {
130
+ test: /\.s(c|a)ss$/,
131
+ use: [
132
+ { loader: require.resolve('raw-loader') },
133
+ {
134
+ loader: require.resolve('postcss-loader'),
135
+ options: {
136
+ postcssOptions: {
137
+ plugins: [autoprefixer_1.default()],
138
+ },
139
+ },
140
+ },
141
+ { loader: require.resolve('sass-loader') },
142
+ ],
143
+ },
144
+ ]) }), resolve: __assign({}, config.resolve), plugins: __spreadArrays(config.plugins, [
145
+ // See https://github.com/angular/angular/issues/11580#issuecomment-401127742
146
+ new webpack_1.ContextReplacementPlugin(/@angular(\\|\/)core(\\|\/)(fesm5|bundles)/, path_1.default.resolve(__dirname, '..')),
147
+ create_fork_ts_checker_plugin_1.default(tsLoaderOptions),
148
+ ]) })];
149
+ }
150
+ });
151
+ });
73
152
  }
74
153
  exports.webpack = webpack;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storybook/angular",
3
- "version": "6.5.0-alpha.2",
3
+ "version": "6.5.0-alpha.23",
4
4
  "description": "Storybook for Angular: Develop Angular Components in isolation with Hot Reloading.",
5
5
  "keywords": [
6
6
  "storybook"
@@ -45,15 +45,15 @@
45
45
  "prepare": "node ../../scripts/prepare.js"
46
46
  },
47
47
  "dependencies": {
48
- "@storybook/addons": "6.5.0-alpha.2",
49
- "@storybook/api": "6.5.0-alpha.2",
50
- "@storybook/core": "6.5.0-alpha.2",
51
- "@storybook/core-common": "6.5.0-alpha.2",
52
- "@storybook/core-events": "6.5.0-alpha.2",
48
+ "@storybook/addons": "6.5.0-alpha.23",
49
+ "@storybook/api": "6.5.0-alpha.23",
50
+ "@storybook/core": "6.5.0-alpha.23",
51
+ "@storybook/core-common": "6.5.0-alpha.23",
52
+ "@storybook/core-events": "6.5.0-alpha.23",
53
53
  "@storybook/csf": "0.0.2--canary.87bc651.0",
54
- "@storybook/node-logger": "6.5.0-alpha.2",
54
+ "@storybook/node-logger": "6.5.0-alpha.23",
55
55
  "@storybook/semver": "^7.3.2",
56
- "@storybook/store": "6.5.0-alpha.2",
56
+ "@storybook/store": "6.5.0-alpha.23",
57
57
  "@types/node": "^14.14.20 || ^16.0.0",
58
58
  "@types/webpack-env": "^1.16.0",
59
59
  "autoprefixer": "^9.8.6",
@@ -70,7 +70,7 @@
70
70
  "regenerator-runtime": "^0.13.7",
71
71
  "sass-loader": "^10.1.0",
72
72
  "strip-json-comments": "3.1.1",
73
- "telejson": "^5.3.2",
73
+ "telejson": "^5.3.3",
74
74
  "ts-dedent": "^2.0.0",
75
75
  "ts-loader": "^8.0.14",
76
76
  "tsconfig-paths-webpack-plugin": "^3.3.0",
@@ -86,14 +86,12 @@
86
86
  "@angular/compiler": "^11.2.14",
87
87
  "@angular/compiler-cli": "^11.2.14",
88
88
  "@angular/core": "^11.2.14",
89
- "@angular/elements": "^11.2.14",
90
89
  "@angular/forms": "^11.2.14",
91
90
  "@angular/platform-browser": "^11.2.14",
92
91
  "@angular/platform-browser-dynamic": "^11.2.14",
93
92
  "@nrwl/workspace": "^11.6.3",
94
93
  "@types/autoprefixer": "^9.7.2",
95
94
  "@types/jest": "^26.0.16",
96
- "@webcomponents/custom-elements": "^1.4.3",
97
95
  "jest": "^26.6.3",
98
96
  "jest-preset-angular": "^8.3.2",
99
97
  "ts-jest": "^26.4.4"
@@ -107,13 +105,11 @@
107
105
  "@angular/compiler": ">=6.0.0",
108
106
  "@angular/compiler-cli": ">=6.0.0",
109
107
  "@angular/core": ">=6.0.0",
110
- "@angular/elements": ">=6.0.0",
111
108
  "@angular/forms": ">=6.0.0",
112
109
  "@angular/platform-browser": ">=6.0.0",
113
110
  "@angular/platform-browser-dynamic": ">=6.0.0",
114
111
  "@babel/core": "*",
115
112
  "@nrwl/workspace": ">=11.1.0",
116
- "@webcomponents/custom-elements": ">=1.4.3",
117
113
  "rxjs": "^6.0.0 || ^7.4.0",
118
114
  "typescript": "^3.4.0 || >=4.0.0",
119
115
  "zone.js": "^0.8.29 || ^0.9.0 || ^0.10.0 || ^0.11.0"
@@ -122,14 +118,8 @@
122
118
  "@angular/cli": {
123
119
  "optional": true
124
120
  },
125
- "@angular/elements": {
126
- "optional": true
127
- },
128
121
  "@nrwl/workspace": {
129
122
  "optional": true
130
- },
131
- "@webcomponents/custom-elements": {
132
- "optional": true
133
123
  }
134
124
  },
135
125
  "engines": {
@@ -139,5 +129,5 @@
139
129
  "access": "public"
140
130
  },
141
131
  "builders": "dist/ts3.9/builders/builders.json",
142
- "gitHead": "ca9d89393f36d156e34819fe120eb7e6819245f4"
132
+ "gitHead": "0006ec45ff04e42229dbee92cc49764699477e1b"
143
133
  }