@storybook/angular 6.4.0-beta.9 → 6.4.0-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ts3.4/client/preview/config.d.ts +2 -0
- package/dist/ts3.4/client/preview/decorateStory.d.ts +1 -0
- package/dist/ts3.4/server/angular-devkit-build-webpack.d.ts +1 -1
- package/dist/ts3.4/server/preset.d.ts +3 -0
- package/dist/ts3.9/client/preview/config.d.ts +2 -0
- package/dist/ts3.9/client/preview/config.js +3 -0
- package/dist/ts3.9/client/preview/decorateStory.d.ts +1 -0
- package/dist/ts3.9/client/preview/decorateStory.js +2 -0
- package/dist/ts3.9/server/__mocks-ng-workspace__/with-angularBrowserTarget/angular.json +32 -0
- package/dist/ts3.9/server/angular-devkit-build-webpack.d.ts +1 -1
- package/dist/ts3.9/server/angular-devkit-build-webpack.js +18 -8
- package/dist/ts3.9/server/framework-preset-angular-cli.js +4 -3
- package/dist/ts3.9/server/options.js +1 -5
- package/dist/ts3.9/server/preset.d.ts +3 -0
- package/dist/ts3.9/server/preset.js +21 -0
- package/package.json +10 -10
- package/preset.js +1 -7
- package/types-7-0.d.ts +1 -0
|
@@ -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 };
|
|
@@ -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,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
|
}
|
|
@@ -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>;
|
|
@@ -122,12 +122,22 @@ var importAngularCliReadTsconfigUtil = function () {
|
|
|
122
122
|
}
|
|
123
123
|
throw new Error('ReadTsconfig not found in "@angular-devkit/build-angular"');
|
|
124
124
|
};
|
|
125
|
-
var buildWebpackConfigOptions = function (dirToSearch, project, target) { return __awaiter(void 0, void 0, void 0, function () {
|
|
126
|
-
var
|
|
127
|
-
return __generator(this, function (
|
|
128
|
-
switch (
|
|
125
|
+
var buildWebpackConfigOptions = function (dirToSearch, project, target, confName) { return __awaiter(void 0, void 0, void 0, function () {
|
|
126
|
+
var conf, projectBuildOptions, requiredOptions, workspaceRootNormalized, projectRootNormalized, sourceRootNormalized, tsConfigPath, tsConfig, ts, scriptTarget, buildOptions;
|
|
127
|
+
return __generator(this, function (_a) {
|
|
128
|
+
switch (_a.label) {
|
|
129
129
|
case 0:
|
|
130
|
-
|
|
130
|
+
conf = {};
|
|
131
|
+
if (confName) {
|
|
132
|
+
if (!target.configurations) {
|
|
133
|
+
throw new Error('Missing "configurations" section in project target');
|
|
134
|
+
}
|
|
135
|
+
if (!target.configurations[confName]) {
|
|
136
|
+
throw new Error("Missing required configuration in project target. Check \"" + confName + "\"");
|
|
137
|
+
}
|
|
138
|
+
conf = target.configurations[confName];
|
|
139
|
+
}
|
|
140
|
+
projectBuildOptions = __assign(__assign({}, target.options), conf);
|
|
131
141
|
requiredOptions = ['tsConfig'];
|
|
132
142
|
if (!requiredOptions.every(function (key) { return !!projectBuildOptions[key]; })) {
|
|
133
143
|
throw new Error("Missing required options in project target. Check \"" + requiredOptions.join(', ') + "\"");
|
|
@@ -141,7 +151,7 @@ var buildWebpackConfigOptions = function (dirToSearch, project, target) { return
|
|
|
141
151
|
tsConfig = importAngularCliReadTsconfigUtil().readTsconfig(tsConfigPath);
|
|
142
152
|
return [4 /*yield*/, Promise.resolve().then(function () { return __importStar(require('typescript')); })];
|
|
143
153
|
case 1:
|
|
144
|
-
ts =
|
|
154
|
+
ts = _a.sent();
|
|
145
155
|
scriptTarget = tsConfig.options.target || ts.ScriptTarget.ES5;
|
|
146
156
|
buildOptions = __assign(__assign({
|
|
147
157
|
// Default options
|
|
@@ -166,7 +176,7 @@ var buildWebpackConfigOptions = function (dirToSearch, project, target) { return
|
|
|
166
176
|
* Uses angular cli to extract webpack configuration.
|
|
167
177
|
* The `AngularCliWebpackConfig` type lists the parts used by storybook
|
|
168
178
|
*/
|
|
169
|
-
function extractAngularCliWebpackConfig(dirToSearch, project, target) {
|
|
179
|
+
function extractAngularCliWebpackConfig(dirToSearch, project, target, confName) {
|
|
170
180
|
var _a;
|
|
171
181
|
return __awaiter(this, void 0, void 0, function () {
|
|
172
182
|
var _b, getCommonConfig, getStylesConfig, webpackConfigOptions, cliCommonConfig, cliStyleConfig;
|
|
@@ -174,7 +184,7 @@ function extractAngularCliWebpackConfig(dirToSearch, project, target) {
|
|
|
174
184
|
switch (_c.label) {
|
|
175
185
|
case 0:
|
|
176
186
|
_b = importAngularCliWebpackConfigGenerator(), getCommonConfig = _b.getCommonConfig, getStylesConfig = _b.getStylesConfig;
|
|
177
|
-
return [4 /*yield*/, buildWebpackConfigOptions(dirToSearch, project, target)];
|
|
187
|
+
return [4 /*yield*/, buildWebpackConfigOptions(dirToSearch, project, target, confName)];
|
|
178
188
|
case 1:
|
|
179
189
|
webpackConfigOptions = _c.sent();
|
|
180
190
|
cliCommonConfig = getCommonConfig(webpackConfigOptions);
|
|
@@ -67,7 +67,7 @@ var module_is_available_1 = require("./utils/module-is-available");
|
|
|
67
67
|
var filter_out_styling_rules_1 = require("./utils/filter-out-styling-rules");
|
|
68
68
|
function webpackFinal(baseConfig, options) {
|
|
69
69
|
return __awaiter(this, void 0, void 0, function () {
|
|
70
|
-
var dirToSearch, workspaceConfig, error_1, project, target, browserTarget, fondProject, angularCliWebpackConfig, error_2;
|
|
70
|
+
var dirToSearch, workspaceConfig, error_1, project, target, confName, browserTarget, fondProject, angularCliWebpackConfig, error_2;
|
|
71
71
|
return __generator(this, function (_a) {
|
|
72
72
|
switch (_a.label) {
|
|
73
73
|
case 0:
|
|
@@ -103,7 +103,8 @@ function webpackFinal(baseConfig, options) {
|
|
|
103
103
|
fondProject = angular_read_workspace_1.findAngularProjectTarget(workspaceConfig, browserTarget.project, browserTarget.target);
|
|
104
104
|
project = fondProject.project;
|
|
105
105
|
target = fondProject.target;
|
|
106
|
-
|
|
106
|
+
confName = browserTarget.configuration;
|
|
107
|
+
node_logger_1.logger.info("=> Using angular project \"" + browserTarget.project + ":" + browserTarget.target + (confName ? ":" + confName : '') + "\" for configuring Storybook");
|
|
107
108
|
}
|
|
108
109
|
// Start storybook when only tsConfig is provided.
|
|
109
110
|
if (options.angularBrowserTarget === null && options.tsConfig) {
|
|
@@ -120,7 +121,7 @@ function webpackFinal(baseConfig, options) {
|
|
|
120
121
|
_a.label = 5;
|
|
121
122
|
case 5:
|
|
122
123
|
_a.trys.push([5, 7, , 8]);
|
|
123
|
-
return [4 /*yield*/, angular_devkit_build_webpack_1.extractAngularCliWebpackConfig(dirToSearch, project, target)];
|
|
124
|
+
return [4 /*yield*/, angular_devkit_build_webpack_1.extractAngularCliWebpackConfig(dirToSearch, project, target, confName)];
|
|
124
125
|
case 6:
|
|
125
126
|
angularCliWebpackConfig = _a.sent();
|
|
126
127
|
node_logger_1.logger.info("=> Using angular-cli webpack config");
|
|
@@ -4,9 +4,5 @@ var read_pkg_up_1 = require("read-pkg-up");
|
|
|
4
4
|
exports.default = {
|
|
5
5
|
packageJson: read_pkg_up_1.sync({ cwd: __dirname }).packageJson,
|
|
6
6
|
framework: 'angular',
|
|
7
|
-
frameworkPresets: [
|
|
8
|
-
require.resolve('./framework-preset-angular'),
|
|
9
|
-
require.resolve('./framework-preset-angular-cli'),
|
|
10
|
-
require.resolve('./framework-preset-angular-ivy'),
|
|
11
|
-
],
|
|
7
|
+
frameworkPresets: [require.resolve('./preset')],
|
|
12
8
|
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __spreadArrays = (this && this.__spreadArrays) || function () {
|
|
3
|
+
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
|
|
4
|
+
for (var r = Array(s), k = 0, i = 0; i < il; i++)
|
|
5
|
+
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
|
|
6
|
+
r[k] = a[j];
|
|
7
|
+
return r;
|
|
8
|
+
};
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.addons = exports.config = void 0;
|
|
11
|
+
exports.config = function (entries) {
|
|
12
|
+
if (entries === void 0) { entries = []; }
|
|
13
|
+
return __spreadArrays(entries, [
|
|
14
|
+
require.resolve('../client/preview/config'),
|
|
15
|
+
]);
|
|
16
|
+
};
|
|
17
|
+
exports.addons = [
|
|
18
|
+
require.resolve('./framework-preset-angular'),
|
|
19
|
+
require.resolve('./framework-preset-angular-cli'),
|
|
20
|
+
require.resolve('./framework-preset-angular-ivy'),
|
|
21
|
+
];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@storybook/angular",
|
|
3
|
-
"version": "6.4.0-
|
|
3
|
+
"version": "6.4.0-rc.0",
|
|
4
4
|
"description": "Storybook for Angular: Develop Angular Components in isolation with Hot Reloading.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"storybook"
|
|
@@ -45,14 +45,14 @@
|
|
|
45
45
|
"prepare": "node ../../scripts/prepare.js"
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@storybook/addons": "6.4.0-
|
|
49
|
-
"@storybook/api": "6.4.0-
|
|
50
|
-
"@storybook/core": "6.4.0-
|
|
51
|
-
"@storybook/core-common": "6.4.0-
|
|
52
|
-
"@storybook/core-events": "6.4.0-
|
|
53
|
-
"@storybook/csf": "0.0.2--canary.
|
|
54
|
-
"@storybook/node-logger": "6.4.0-
|
|
55
|
-
"@storybook/store": "6.4.0-
|
|
48
|
+
"@storybook/addons": "6.4.0-rc.0",
|
|
49
|
+
"@storybook/api": "6.4.0-rc.0",
|
|
50
|
+
"@storybook/core": "6.4.0-rc.0",
|
|
51
|
+
"@storybook/core-common": "6.4.0-rc.0",
|
|
52
|
+
"@storybook/core-events": "6.4.0-rc.0",
|
|
53
|
+
"@storybook/csf": "0.0.2--canary.87bc651.0",
|
|
54
|
+
"@storybook/node-logger": "6.4.0-rc.0",
|
|
55
|
+
"@storybook/store": "6.4.0-rc.0",
|
|
56
56
|
"@types/webpack-env": "^1.16.0",
|
|
57
57
|
"autoprefixer": "^9.8.6",
|
|
58
58
|
"core-js": "^3.8.2",
|
|
@@ -131,5 +131,5 @@
|
|
|
131
131
|
"access": "public"
|
|
132
132
|
},
|
|
133
133
|
"builders": "dist/ts3.9/builders/builders.json",
|
|
134
|
-
"gitHead": "
|
|
134
|
+
"gitHead": "812e75b32c7fe222b872961a83c05cc8ece36a36"
|
|
135
135
|
}
|
package/preset.js
CHANGED
package/types-7-0.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './dist/ts3.9/client/preview/types-7-0.d';
|