@storybook/angular 6.4.12 → 6.4.16

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
  */
@@ -1,4 +1,23 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
11
+ }) : function(o, v) {
12
+ o["default"] = v;
13
+ });
14
+ var __importStar = (this && this.__importStar) || function (mod) {
15
+ if (mod && mod.__esModule) return mod;
16
+ var result = {};
17
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
+ __setModuleDefault(result, mod);
19
+ return result;
20
+ };
2
21
  var __spreadArrays = (this && this.__spreadArrays) || function () {
3
22
  for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
4
23
  for (var r = Array(s), k = 0, i = 0; i < il; i++)
@@ -10,18 +29,30 @@ Object.defineProperty(exports, "__esModule", { value: true });
10
29
  exports.runCompodoc = void 0;
11
30
  var child_process_1 = require("child_process");
12
31
  var rxjs_1 = require("rxjs");
32
+ var path = __importStar(require("path"));
33
+ var hasTsConfigArg = function (args) { return args.indexOf('-p') !== -1; };
34
+ // path.relative is necessary to workaround a compodoc issue with
35
+ // absolute paths on windows machines
36
+ var toRelativePath = function (pathToTsConfig) {
37
+ return path.isAbsolute(pathToTsConfig) ? path.relative('.', pathToTsConfig) : pathToTsConfig;
38
+ };
13
39
  exports.runCompodoc = function (_a, context) {
14
40
  var compodocArgs = _a.compodocArgs, tsconfig = _a.tsconfig;
15
41
  return new rxjs_1.Observable(function (observer) {
42
+ var tsConfigPath = toRelativePath(tsconfig);
16
43
  var finalCompodocArgs = __spreadArrays([
17
- // Default options
18
- '-p',
19
- tsconfig,
44
+ 'compodoc'
45
+ ], (hasTsConfigArg(compodocArgs) ? [] : ['-p', tsConfigPath]), [
20
46
  '-d',
21
47
  "" + context.workspaceRoot
22
48
  ], compodocArgs);
23
49
  try {
24
- var child = child_process_1.spawn('compodoc', finalCompodocArgs);
50
+ context.logger.info(finalCompodocArgs.join(' '));
51
+ var child = child_process_1.spawn('npx', finalCompodocArgs, {
52
+ cwd: context.workspaceRoot,
53
+ env: process.env,
54
+ shell: true,
55
+ });
25
56
  child.stdout.on('data', function (data) {
26
57
  context.logger.info(data.toString());
27
58
  });
@@ -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, getDevServerConfig = _a.getDevServerConfig, 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
  /**
@@ -79,7 +79,7 @@ exports.getWebpackConfig = function (baseConfig, _a) {
79
79
  optimization: false, namedChunks: false, progress: false, buildOptimizer: false, aot: false }), builderContext, function (wco) { return [
80
80
  getCommonConfig(wco),
81
81
  getStylesConfig(wco),
82
- getTypescriptWorkerPlugin ? getTypescriptWorkerPlugin(wco) : getDevServerConfig(wco),
82
+ getTypeScriptConfig ? getTypeScriptConfig(wco) : getDevServerConfig(wco),
83
83
  ]; })];
84
84
  case 1:
85
85
  cliConfig = (_e.sent()).config;
@@ -96,7 +96,9 @@ function webpackFinal(baseConfig, options) {
96
96
  node_logger_1.logger.info('=> Using base config because "@angular-devkit/build-angular" is not installed');
97
97
  return [2 /*return*/, baseConfig];
98
98
  }
99
- return [4 /*yield*/, Promise.resolve().then(function () { return __importStar(require('@angular/cli')); }).then(function (m) { return semver_1.default.coerce(m.VERSION.full); })];
99
+ return [4 /*yield*/, Promise.resolve().then(function () { return __importStar(require('@angular/core')); }).then(function (m) {
100
+ return semver_1.default.coerce(m.VERSION.full);
101
+ })];
100
102
  case 1:
101
103
  angularCliVersion = _a.sent();
102
104
  webpackGetterByVersions = [
@@ -116,7 +118,7 @@ function webpackFinal(baseConfig, options) {
116
118
  case 2:
117
119
  legacyDefaultOptions = _a.sent();
118
120
  return [2 /*return*/, angular_cli_webpack_13_x_x_1.getWebpackConfig(_baseConfig, {
119
- builderOptions: __assign(__assign({ watch: options.configType === 'DEVELOPMENT' }, builderOptions), legacyDefaultOptions),
121
+ builderOptions: __assign(__assign({ watch: options.configType === 'DEVELOPMENT' }, legacyDefaultOptions), builderOptions),
120
122
  builderContext: builderContext,
121
123
  })];
122
124
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storybook/angular",
3
- "version": "6.4.12",
3
+ "version": "6.4.16",
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.4.12",
49
- "@storybook/api": "6.4.12",
50
- "@storybook/core": "6.4.12",
51
- "@storybook/core-common": "6.4.12",
52
- "@storybook/core-events": "6.4.12",
48
+ "@storybook/addons": "6.4.16",
49
+ "@storybook/api": "6.4.16",
50
+ "@storybook/core": "6.4.16",
51
+ "@storybook/core-common": "6.4.16",
52
+ "@storybook/core-events": "6.4.16",
53
53
  "@storybook/csf": "0.0.2--canary.87bc651.0",
54
- "@storybook/node-logger": "6.4.12",
54
+ "@storybook/node-logger": "6.4.16",
55
55
  "@storybook/semver": "^7.3.2",
56
- "@storybook/store": "6.4.12",
56
+ "@storybook/store": "6.4.16",
57
57
  "@types/webpack-env": "^1.16.0",
58
58
  "autoprefixer": "^9.8.6",
59
59
  "core-js": "^3.8.2",
@@ -85,14 +85,12 @@
85
85
  "@angular/compiler": "^11.2.14",
86
86
  "@angular/compiler-cli": "^11.2.14",
87
87
  "@angular/core": "^11.2.14",
88
- "@angular/elements": "^11.2.14",
89
88
  "@angular/forms": "^11.2.14",
90
89
  "@angular/platform-browser": "^11.2.14",
91
90
  "@angular/platform-browser-dynamic": "^11.2.14",
92
91
  "@nrwl/workspace": "^11.6.3",
93
92
  "@types/autoprefixer": "^9.7.2",
94
93
  "@types/jest": "^26.0.16",
95
- "@webcomponents/custom-elements": "^1.4.3",
96
94
  "jest": "^26.6.3",
97
95
  "jest-preset-angular": "^8.3.2",
98
96
  "ts-jest": "^26.4.4"
@@ -106,13 +104,11 @@
106
104
  "@angular/compiler": ">=6.0.0",
107
105
  "@angular/compiler-cli": ">=6.0.0",
108
106
  "@angular/core": ">=6.0.0",
109
- "@angular/elements": ">=6.0.0",
110
107
  "@angular/forms": ">=6.0.0",
111
108
  "@angular/platform-browser": ">=6.0.0",
112
109
  "@angular/platform-browser-dynamic": ">=6.0.0",
113
110
  "@babel/core": "*",
114
111
  "@nrwl/workspace": ">=11.1.0",
115
- "@webcomponents/custom-elements": ">=1.4.3",
116
112
  "rxjs": "^6.0.0 || ^7.4.0",
117
113
  "typescript": "^3.4.0 || >=4.0.0",
118
114
  "zone.js": "^0.8.29 || ^0.9.0 || ^0.10.0 || ^0.11.0"
@@ -121,14 +117,8 @@
121
117
  "@angular/cli": {
122
118
  "optional": true
123
119
  },
124
- "@angular/elements": {
125
- "optional": true
126
- },
127
120
  "@nrwl/workspace": {
128
121
  "optional": true
129
- },
130
- "@webcomponents/custom-elements": {
131
- "optional": true
132
122
  }
133
123
  },
134
124
  "engines": {
@@ -138,5 +128,5 @@
138
128
  "access": "public"
139
129
  },
140
130
  "builders": "dist/ts3.9/builders/builders.json",
141
- "gitHead": "9ce1a3b24f39b4a3307a1a23531271ce1fc738c2"
131
+ "gitHead": "450fb4e44d68bc7b11fe927c390488f336a2431e"
142
132
  }