@storybook/angular 6.4.8 → 6.5.0-alpha.11

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.
@@ -38,6 +38,19 @@ export declare abstract class AbstractRenderer {
38
38
  parameters: Parameters;
39
39
  targetDOMNode: HTMLElement;
40
40
  }): Promise<void>;
41
+ /**
42
+ * Only ASCII alphanumerics can be used as HTML tag name.
43
+ * https://html.spec.whatwg.org/#elements-2
44
+ *
45
+ * Therefore, stories break when non-ASCII alphanumerics are included in target selector.
46
+ * https://github.com/storybookjs/storybook/issues/15147
47
+ *
48
+ * This method returns storyId when it doesn't contain any non-ASCII alphanumerics.
49
+ * Otherwise, it generates a valid HTML tag name from storyId by removing non-ASCII alphanumerics from storyId, prefixing "sb-", and suffixing "-component"
50
+ * @protected
51
+ * @memberof AbstractRenderer
52
+ */
53
+ protected generateTargetSelectorFromStoryId(): string;
41
54
  protected initAngularRootElement(targetDOMNode: HTMLElement, targetSelector: string): void;
42
55
  private fullRendererRequired;
43
56
  }
@@ -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
  */
@@ -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
  });
@@ -38,6 +38,19 @@ export declare abstract class AbstractRenderer {
38
38
  parameters: Parameters;
39
39
  targetDOMNode: HTMLElement;
40
40
  }): Promise<void>;
41
+ /**
42
+ * Only ASCII alphanumerics can be used as HTML tag name.
43
+ * https://html.spec.whatwg.org/#elements-2
44
+ *
45
+ * Therefore, stories break when non-ASCII alphanumerics are included in target selector.
46
+ * https://github.com/storybookjs/storybook/issues/15147
47
+ *
48
+ * This method returns storyId when it doesn't contain any non-ASCII alphanumerics.
49
+ * Otherwise, it generates a valid HTML tag name from storyId by removing non-ASCII alphanumerics from storyId, prefixing "sb-", and suffixing "-component"
50
+ * @protected
51
+ * @memberof AbstractRenderer
52
+ */
53
+ protected generateTargetSelectorFromStoryId(): string;
41
54
  protected initAngularRootElement(targetDOMNode: HTMLElement, targetSelector: string): void;
42
55
  private fullRendererRequired;
43
56
  }
@@ -125,7 +125,7 @@ var AbstractRenderer = /** @class */ (function () {
125
125
  return __generator(this, function (_c) {
126
126
  switch (_c.label) {
127
127
  case 0:
128
- targetSelector = "" + this.storyId;
128
+ targetSelector = "" + this.generateTargetSelectorFromStoryId();
129
129
  newStoryProps$ = new rxjs_1.BehaviorSubject(storyFnAngular.props);
130
130
  moduleMetadata = StorybookModule_1.getStorybookModuleMetadata({ storyFnAngular: storyFnAngular, component: component, targetSelector: targetSelector }, newStoryProps$);
131
131
  if (!this.fullRendererRequired({
@@ -156,6 +156,25 @@ var AbstractRenderer = /** @class */ (function () {
156
156
  });
157
157
  });
158
158
  };
159
+ /**
160
+ * Only ASCII alphanumerics can be used as HTML tag name.
161
+ * https://html.spec.whatwg.org/#elements-2
162
+ *
163
+ * Therefore, stories break when non-ASCII alphanumerics are included in target selector.
164
+ * https://github.com/storybookjs/storybook/issues/15147
165
+ *
166
+ * This method returns storyId when it doesn't contain any non-ASCII alphanumerics.
167
+ * Otherwise, it generates a valid HTML tag name from storyId by removing non-ASCII alphanumerics from storyId, prefixing "sb-", and suffixing "-component"
168
+ * @protected
169
+ * @memberof AbstractRenderer
170
+ */
171
+ AbstractRenderer.prototype.generateTargetSelectorFromStoryId = function () {
172
+ var invalidHtmlTag = /[^A-Za-z0-9-]/g;
173
+ var storyIdIsInvalidHtmlTagName = invalidHtmlTag.test(this.storyId);
174
+ return storyIdIsInvalidHtmlTagName
175
+ ? "sb-" + this.storyId.replace(invalidHtmlTag, '') + "-component"
176
+ : this.storyId;
177
+ };
159
178
  AbstractRenderer.prototype.initAngularRootElement = function (targetDOMNode, targetSelector) {
160
179
  // Adds DOM element that angular will use as bootstrap component
161
180
  // eslint-disable-next-line no-param-reassign
@@ -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
  }
@@ -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, getTypescriptWorkerPlugin = _a.getTypescriptWorkerPlugin;
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
+ getTypescriptWorkerPlugin ? getTypescriptWorkerPlugin(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 : []));
@@ -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' }, builderOptions), legacyDefaultOptions),
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.4.8",
3
+ "version": "6.5.0-alpha.11",
4
4
  "description": "Storybook for Angular: Develop Angular Components in isolation with Hot Reloading.",
5
5
  "keywords": [
6
6
  "storybook"
@@ -45,15 +45,16 @@
45
45
  "prepare": "node ../../scripts/prepare.js"
46
46
  },
47
47
  "dependencies": {
48
- "@storybook/addons": "6.4.8",
49
- "@storybook/api": "6.4.8",
50
- "@storybook/core": "6.4.8",
51
- "@storybook/core-common": "6.4.8",
52
- "@storybook/core-events": "6.4.8",
48
+ "@storybook/addons": "6.5.0-alpha.11",
49
+ "@storybook/api": "6.5.0-alpha.11",
50
+ "@storybook/core": "6.5.0-alpha.11",
51
+ "@storybook/core-common": "6.5.0-alpha.11",
52
+ "@storybook/core-events": "6.5.0-alpha.11",
53
53
  "@storybook/csf": "0.0.2--canary.87bc651.0",
54
- "@storybook/node-logger": "6.4.8",
54
+ "@storybook/node-logger": "6.5.0-alpha.11",
55
55
  "@storybook/semver": "^7.3.2",
56
- "@storybook/store": "6.4.8",
56
+ "@storybook/store": "6.5.0-alpha.11",
57
+ "@types/node": "^14.14.20 || ^16.0.0",
57
58
  "@types/webpack-env": "^1.16.0",
58
59
  "autoprefixer": "^9.8.6",
59
60
  "core-js": "^3.8.2",
@@ -69,7 +70,7 @@
69
70
  "regenerator-runtime": "^0.13.7",
70
71
  "sass-loader": "^10.1.0",
71
72
  "strip-json-comments": "3.1.1",
72
- "telejson": "^5.3.2",
73
+ "telejson": "^5.3.3",
73
74
  "ts-dedent": "^2.0.0",
74
75
  "ts-loader": "^8.0.14",
75
76
  "tsconfig-paths-webpack-plugin": "^3.3.0",
@@ -85,14 +86,12 @@
85
86
  "@angular/compiler": "^11.2.14",
86
87
  "@angular/compiler-cli": "^11.2.14",
87
88
  "@angular/core": "^11.2.14",
88
- "@angular/elements": "^11.2.14",
89
89
  "@angular/forms": "^11.2.14",
90
90
  "@angular/platform-browser": "^11.2.14",
91
91
  "@angular/platform-browser-dynamic": "^11.2.14",
92
92
  "@nrwl/workspace": "^11.6.3",
93
93
  "@types/autoprefixer": "^9.7.2",
94
94
  "@types/jest": "^26.0.16",
95
- "@webcomponents/custom-elements": "^1.4.3",
96
95
  "jest": "^26.6.3",
97
96
  "jest-preset-angular": "^8.3.2",
98
97
  "ts-jest": "^26.4.4"
@@ -106,13 +105,11 @@
106
105
  "@angular/compiler": ">=6.0.0",
107
106
  "@angular/compiler-cli": ">=6.0.0",
108
107
  "@angular/core": ">=6.0.0",
109
- "@angular/elements": ">=6.0.0",
110
108
  "@angular/forms": ">=6.0.0",
111
109
  "@angular/platform-browser": ">=6.0.0",
112
110
  "@angular/platform-browser-dynamic": ">=6.0.0",
113
111
  "@babel/core": "*",
114
112
  "@nrwl/workspace": ">=11.1.0",
115
- "@webcomponents/custom-elements": ">=1.4.3",
116
113
  "rxjs": "^6.0.0 || ^7.4.0",
117
114
  "typescript": "^3.4.0 || >=4.0.0",
118
115
  "zone.js": "^0.8.29 || ^0.9.0 || ^0.10.0 || ^0.11.0"
@@ -121,14 +118,8 @@
121
118
  "@angular/cli": {
122
119
  "optional": true
123
120
  },
124
- "@angular/elements": {
125
- "optional": true
126
- },
127
121
  "@nrwl/workspace": {
128
122
  "optional": true
129
- },
130
- "@webcomponents/custom-elements": {
131
- "optional": true
132
123
  }
133
124
  },
134
125
  "engines": {
@@ -138,5 +129,5 @@
138
129
  "access": "public"
139
130
  },
140
131
  "builders": "dist/ts3.9/builders/builders.json",
141
- "gitHead": "d6b59f78a528a5c7922e71d28b583dd31ad67e7d"
132
+ "gitHead": "c79e86424b1828328e12ad66e84f73eb58d70c09"
142
133
  }