@storybook/angular 6.4.0-rc.0 → 6.4.0-rc.4
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/builders/build-storybook/index.d.ts +1 -1
- package/dist/ts3.4/builders/start-storybook/index.d.ts +1 -1
- package/dist/ts3.4/server/angular-cli-webpack-12.2.x.d.ts +1 -0
- package/dist/ts3.4/server/angular-cli-webpack-13.x.x.d.ts +1 -0
- package/dist/ts3.4/server/angular-cli-webpack-older.d.ts +72 -0
- package/dist/ts3.4/server/framework-preset-angular-cli.d.ts +2 -72
- package/dist/ts3.4/server/framework-preset-angular-ivy.d.ts +3 -3
- package/dist/ts3.4/server/options.d.ts +9 -1
- package/dist/ts3.9/builders/build-storybook/index.d.ts +1 -1
- package/dist/ts3.9/builders/build-storybook/index.js +2 -1
- package/dist/ts3.9/builders/build-storybook/schema.json +0 -7
- package/dist/ts3.9/builders/start-storybook/index.d.ts +1 -1
- package/dist/ts3.9/builders/start-storybook/index.js +2 -1
- package/dist/ts3.9/builders/start-storybook/schema.json +1 -16
- package/dist/ts3.9/server/angular-cli-webpack-12.2.x.d.ts +1 -0
- package/dist/ts3.9/server/angular-cli-webpack-12.2.x.js +93 -0
- package/dist/ts3.9/server/angular-cli-webpack-13.x.x.d.ts +1 -0
- package/dist/ts3.9/server/angular-cli-webpack-13.x.x.js +93 -0
- package/dist/ts3.9/server/angular-cli-webpack-older.d.ts +72 -0
- package/dist/ts3.9/server/angular-cli-webpack-older.js +156 -0
- package/dist/ts3.9/server/framework-preset-angular-cli.d.ts +2 -72
- package/dist/ts3.9/server/framework-preset-angular-cli.js +119 -87
- package/dist/ts3.9/server/framework-preset-angular-ivy.d.ts +3 -3
- package/dist/ts3.9/server/framework-preset-angular-ivy.js +45 -10
- package/dist/ts3.9/server/options.d.ts +9 -1
- package/package.json +16 -9
- package/standalone.d.ts +4 -0
|
@@ -6,7 +6,7 @@ export declare type StorybookBuilderOptions = JsonObject & {
|
|
|
6
6
|
tsConfig?: string;
|
|
7
7
|
compodoc: boolean;
|
|
8
8
|
compodocArgs: string[];
|
|
9
|
-
} & Pick<CLIOptions, '
|
|
9
|
+
} & Pick<CLIOptions, 'outputDir' | 'configDir' | 'loglevel' | 'quiet' | 'docs'>;
|
|
10
10
|
export declare type StorybookBuilderOutput = JsonObject & BuilderOutput & {};
|
|
11
11
|
declare const _default: import("@angular-devkit/architect/src/internal").Builder<StorybookBuilderOptions>;
|
|
12
12
|
export default _default;
|
|
@@ -6,7 +6,7 @@ export declare type StorybookBuilderOptions = JsonObject & {
|
|
|
6
6
|
tsConfig?: string;
|
|
7
7
|
compodoc: boolean;
|
|
8
8
|
compodocArgs: string[];
|
|
9
|
-
} & Pick<CLIOptions, 'port' | 'host' | '
|
|
9
|
+
} & Pick<CLIOptions, 'port' | 'host' | 'configDir' | 'https' | 'sslCa' | 'sslCert' | 'sslKey' | 'smokeTest' | 'ci' | 'quiet' | 'docs'>;
|
|
10
10
|
export declare type StorybookBuilderOutput = JsonObject & BuilderOutput & {};
|
|
11
11
|
declare const _default: import("@angular-devkit/architect/src/internal").Builder<StorybookBuilderOptions>;
|
|
12
12
|
export default _default;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export function getWebpackConfig(baseConfig: any, { builderOptions, builderContext }: any): Promise<any>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export function getWebpackConfig(baseConfig: any, { builderOptions, builderContext }: any): Promise<any>;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import webpack from 'webpack';
|
|
2
|
+
import TsconfigPathsPlugin from 'tsconfig-paths-webpack-plugin';
|
|
3
|
+
import { PresetOptions } from './options';
|
|
4
|
+
/**
|
|
5
|
+
* Old way currently support version lower than 12.2.x
|
|
6
|
+
*/
|
|
7
|
+
export declare function getWebpackConfig(baseConfig: webpack.Configuration, options: PresetOptions): Promise<webpack.Configuration | {
|
|
8
|
+
entry: any[];
|
|
9
|
+
module: {
|
|
10
|
+
rules: webpack.RuleSetRule[];
|
|
11
|
+
noParse?: RegExp | RegExp[] | ((content: string) => boolean);
|
|
12
|
+
unknownContextRequest?: string;
|
|
13
|
+
unknownContextRecursive?: boolean;
|
|
14
|
+
unknownContextRegExp?: RegExp;
|
|
15
|
+
unknownContextCritical?: boolean;
|
|
16
|
+
exprContextRequest?: string;
|
|
17
|
+
exprContextRegExp?: RegExp;
|
|
18
|
+
exprContextRecursive?: boolean;
|
|
19
|
+
exprContextCritical?: boolean;
|
|
20
|
+
wrappedContextRegExp?: RegExp;
|
|
21
|
+
wrappedContextRecursive?: boolean;
|
|
22
|
+
wrappedContextCritical?: boolean;
|
|
23
|
+
strictExportPresence?: boolean;
|
|
24
|
+
};
|
|
25
|
+
plugins: webpack.Plugin[];
|
|
26
|
+
resolve: {
|
|
27
|
+
modules: string[];
|
|
28
|
+
plugins: TsconfigPathsPlugin[];
|
|
29
|
+
descriptionFiles?: string[];
|
|
30
|
+
mainFields?: string[] | string[][];
|
|
31
|
+
aliasFields?: string[] | string[][];
|
|
32
|
+
mainFiles?: string[];
|
|
33
|
+
extensions?: string[];
|
|
34
|
+
enforceExtension?: boolean;
|
|
35
|
+
alias?: {
|
|
36
|
+
[key: string]: string;
|
|
37
|
+
};
|
|
38
|
+
unsafeCache?: boolean | {};
|
|
39
|
+
cachePredicate?(data: {
|
|
40
|
+
path: string;
|
|
41
|
+
request: string;
|
|
42
|
+
}): boolean;
|
|
43
|
+
symlinks?: boolean;
|
|
44
|
+
cacheWithContext?: boolean;
|
|
45
|
+
roots?: string[];
|
|
46
|
+
};
|
|
47
|
+
resolveLoader: webpack.ResolveLoader;
|
|
48
|
+
mode?: "development" | "production" | "none";
|
|
49
|
+
name?: string;
|
|
50
|
+
context?: string;
|
|
51
|
+
devtool?: webpack.Options.Devtool;
|
|
52
|
+
output?: webpack.Output;
|
|
53
|
+
externals?: string | RegExp | webpack.ExternalsObjectElement | webpack.ExternalsFunctionElement | webpack.ExternalsElement[];
|
|
54
|
+
target?: "node" | "web" | "webworker" | "async-node" | "node-webkit" | "atom" | "electron" | "electron-renderer" | "electron-preload" | "electron-main" | ((compiler?: any) => void);
|
|
55
|
+
bail?: boolean;
|
|
56
|
+
profile?: boolean;
|
|
57
|
+
cache?: boolean | object;
|
|
58
|
+
watch?: boolean;
|
|
59
|
+
watchOptions?: webpack.ICompiler.WatchOptions;
|
|
60
|
+
node?: false | webpack.Node;
|
|
61
|
+
amd?: {
|
|
62
|
+
[moduleName: string]: boolean;
|
|
63
|
+
};
|
|
64
|
+
recordsPath?: string;
|
|
65
|
+
recordsInputPath?: string;
|
|
66
|
+
recordsOutputPath?: string;
|
|
67
|
+
stats?: webpack.Stats.ToStringOptions;
|
|
68
|
+
performance?: false | webpack.Options.Performance;
|
|
69
|
+
parallelism?: number;
|
|
70
|
+
optimization?: webpack.Options.Optimization;
|
|
71
|
+
devServer?: import("webpack-dev-server").Configuration;
|
|
72
|
+
}>;
|
|
@@ -1,73 +1,3 @@
|
|
|
1
1
|
import webpack from 'webpack';
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
export declare type Options = CoreOptions & {
|
|
5
|
-
angularBrowserTarget?: string;
|
|
6
|
-
tsConfig?: string;
|
|
7
|
-
};
|
|
8
|
-
export declare function webpackFinal(baseConfig: webpack.Configuration, options: Options): Promise<webpack.Configuration | {
|
|
9
|
-
entry: any[];
|
|
10
|
-
module: {
|
|
11
|
-
rules: webpack.RuleSetRule[];
|
|
12
|
-
noParse?: RegExp | RegExp[] | ((content: string) => boolean);
|
|
13
|
-
unknownContextRequest?: string;
|
|
14
|
-
unknownContextRecursive?: boolean;
|
|
15
|
-
unknownContextRegExp?: RegExp;
|
|
16
|
-
unknownContextCritical?: boolean;
|
|
17
|
-
exprContextRequest?: string;
|
|
18
|
-
exprContextRegExp?: RegExp;
|
|
19
|
-
exprContextRecursive?: boolean;
|
|
20
|
-
exprContextCritical?: boolean;
|
|
21
|
-
wrappedContextRegExp?: RegExp;
|
|
22
|
-
wrappedContextRecursive?: boolean;
|
|
23
|
-
wrappedContextCritical?: boolean;
|
|
24
|
-
strictExportPresence?: boolean;
|
|
25
|
-
};
|
|
26
|
-
plugins: webpack.Plugin[];
|
|
27
|
-
resolve: {
|
|
28
|
-
modules: string[];
|
|
29
|
-
plugins: TsconfigPathsPlugin[];
|
|
30
|
-
descriptionFiles?: string[];
|
|
31
|
-
mainFields?: string[] | string[][];
|
|
32
|
-
aliasFields?: string[] | string[][];
|
|
33
|
-
mainFiles?: string[];
|
|
34
|
-
extensions?: string[];
|
|
35
|
-
enforceExtension?: boolean;
|
|
36
|
-
alias?: {
|
|
37
|
-
[key: string]: string;
|
|
38
|
-
};
|
|
39
|
-
unsafeCache?: boolean | {};
|
|
40
|
-
cachePredicate?(data: {
|
|
41
|
-
path: string;
|
|
42
|
-
request: string;
|
|
43
|
-
}): boolean;
|
|
44
|
-
symlinks?: boolean;
|
|
45
|
-
cacheWithContext?: boolean;
|
|
46
|
-
roots?: string[];
|
|
47
|
-
};
|
|
48
|
-
resolveLoader: webpack.ResolveLoader;
|
|
49
|
-
mode?: "development" | "production" | "none";
|
|
50
|
-
name?: string;
|
|
51
|
-
context?: string;
|
|
52
|
-
devtool?: webpack.Options.Devtool;
|
|
53
|
-
output?: webpack.Output;
|
|
54
|
-
externals?: string | RegExp | webpack.ExternalsObjectElement | webpack.ExternalsFunctionElement | webpack.ExternalsElement[];
|
|
55
|
-
target?: "node" | "web" | "webworker" | "async-node" | "node-webkit" | "atom" | "electron" | "electron-renderer" | "electron-preload" | "electron-main" | ((compiler?: any) => void);
|
|
56
|
-
bail?: boolean;
|
|
57
|
-
profile?: boolean;
|
|
58
|
-
cache?: boolean | object;
|
|
59
|
-
watch?: boolean;
|
|
60
|
-
watchOptions?: webpack.ICompiler.WatchOptions;
|
|
61
|
-
node?: false | webpack.Node;
|
|
62
|
-
amd?: {
|
|
63
|
-
[moduleName: string]: boolean;
|
|
64
|
-
};
|
|
65
|
-
recordsPath?: string;
|
|
66
|
-
recordsInputPath?: string;
|
|
67
|
-
recordsOutputPath?: string;
|
|
68
|
-
stats?: webpack.Stats.ToStringOptions;
|
|
69
|
-
performance?: false | webpack.Options.Performance;
|
|
70
|
-
parallelism?: number;
|
|
71
|
-
optimization?: webpack.Options.Optimization;
|
|
72
|
-
devServer?: import("webpack-dev-server").Configuration;
|
|
73
|
-
}>;
|
|
2
|
+
import { PresetOptions } from './options';
|
|
3
|
+
export declare function webpackFinal(baseConfig: webpack.Configuration, options: PresetOptions): Promise<webpack.Configuration>;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { Configuration } from 'webpack';
|
|
2
|
-
import {
|
|
2
|
+
import { PresetOptions } from './options';
|
|
3
3
|
/**
|
|
4
4
|
* Run ngcc for converting modules to ivy format before starting storybook
|
|
5
5
|
* This step is needed in order to support Ivy in storybook
|
|
6
6
|
*
|
|
7
7
|
* Information about Ivy can be found here https://angular.io/guide/ivy
|
|
8
8
|
*/
|
|
9
|
-
export declare const runNgcc: () => void
|
|
10
|
-
export declare const webpack: (webpackConfig: Configuration, options:
|
|
9
|
+
export declare const runNgcc: () => Promise<void>;
|
|
10
|
+
export declare const webpack: (webpackConfig: Configuration, options: PresetOptions) => Promise<Configuration>;
|
|
@@ -1,3 +1,11 @@
|
|
|
1
|
-
import { LoadOptions } from '@storybook/core-common';
|
|
1
|
+
import { LoadOptions, Options as CoreOptions } from '@storybook/core-common';
|
|
2
|
+
import { BuilderContext } from '@angular-devkit/architect';
|
|
3
|
+
import { JsonObject } from '@angular-devkit/core';
|
|
4
|
+
export declare type PresetOptions = CoreOptions & {
|
|
5
|
+
angularBrowserTarget?: string | null;
|
|
6
|
+
angularBuilderOptions?: JsonObject | null;
|
|
7
|
+
angularBuilderContext?: BuilderContext | null;
|
|
8
|
+
tsConfig?: string;
|
|
9
|
+
};
|
|
2
10
|
declare const _default: LoadOptions;
|
|
3
11
|
export default _default;
|
|
@@ -6,7 +6,7 @@ export declare type StorybookBuilderOptions = JsonObject & {
|
|
|
6
6
|
tsConfig?: string;
|
|
7
7
|
compodoc: boolean;
|
|
8
8
|
compodocArgs: string[];
|
|
9
|
-
} & Pick<CLIOptions, '
|
|
9
|
+
} & Pick<CLIOptions, 'outputDir' | 'configDir' | 'loglevel' | 'quiet' | 'docs'>;
|
|
10
10
|
export declare type StorybookBuilderOutput = JsonObject & BuilderOutput & {};
|
|
11
11
|
declare const _default: import("@angular-devkit/architect/src/internal").Builder<StorybookBuilderOptions>;
|
|
12
12
|
export default _default;
|
|
@@ -79,7 +79,8 @@ function commandBuilder(options, context) {
|
|
|
79
79
|
}), operators_1.map(function (_a) {
|
|
80
80
|
var tsConfig = _a.tsConfig;
|
|
81
81
|
var browserTarget = options.browserTarget, otherOptions = __rest(options, ["browserTarget"]);
|
|
82
|
-
|
|
82
|
+
var standaloneOptions = __assign(__assign({}, otherOptions), { angularBrowserTarget: browserTarget, angularBuilderContext: context, tsConfig: tsConfig });
|
|
83
|
+
return standaloneOptions;
|
|
83
84
|
}), operators_1.switchMap(function (standaloneOptions) { return runInstance(__assign(__assign({}, standaloneOptions), { mode: 'static' })); }), operators_1.map(function () {
|
|
84
85
|
return { success: true };
|
|
85
86
|
}));
|
|
@@ -14,13 +14,6 @@
|
|
|
14
14
|
"type": "string",
|
|
15
15
|
"description": "The full path for the TypeScript configuration file, relative to the current workspace."
|
|
16
16
|
},
|
|
17
|
-
"staticDir": {
|
|
18
|
-
"type": "array",
|
|
19
|
-
"description": "Directory where to load static files from, array of strings.",
|
|
20
|
-
"items": {
|
|
21
|
-
"type": "string"
|
|
22
|
-
}
|
|
23
|
-
},
|
|
24
17
|
"outputDir": {
|
|
25
18
|
"type": "string",
|
|
26
19
|
"description": "Directory where to store built files.",
|
|
@@ -6,7 +6,7 @@ export declare type StorybookBuilderOptions = JsonObject & {
|
|
|
6
6
|
tsConfig?: string;
|
|
7
7
|
compodoc: boolean;
|
|
8
8
|
compodocArgs: string[];
|
|
9
|
-
} & Pick<CLIOptions, 'port' | 'host' | '
|
|
9
|
+
} & Pick<CLIOptions, 'port' | 'host' | 'configDir' | 'https' | 'sslCa' | 'sslCert' | 'sslKey' | 'smokeTest' | 'ci' | 'quiet' | 'docs'>;
|
|
10
10
|
export declare type StorybookBuilderOutput = JsonObject & BuilderOutput & {};
|
|
11
11
|
declare const _default: import("@angular-devkit/architect/src/internal").Builder<StorybookBuilderOptions>;
|
|
12
12
|
export default _default;
|
|
@@ -79,7 +79,8 @@ function commandBuilder(options, context) {
|
|
|
79
79
|
}), operators_1.map(function (_a) {
|
|
80
80
|
var tsConfig = _a.tsConfig;
|
|
81
81
|
var browserTarget = options.browserTarget, otherOptions = __rest(options, ["browserTarget"]);
|
|
82
|
-
|
|
82
|
+
var standaloneOptions = __assign(__assign({}, otherOptions), { angularBrowserTarget: browserTarget, angularBuilderContext: context, tsConfig: tsConfig });
|
|
83
|
+
return standaloneOptions;
|
|
83
84
|
}), operators_1.switchMap(function (standaloneOptions) { return runInstance(standaloneOptions); }), operators_1.map(function () {
|
|
84
85
|
return { success: true };
|
|
85
86
|
}));
|
|
@@ -24,13 +24,6 @@
|
|
|
24
24
|
"description": "Host to listen on.",
|
|
25
25
|
"default": "localhost"
|
|
26
26
|
},
|
|
27
|
-
"staticDir": {
|
|
28
|
-
"type": "array",
|
|
29
|
-
"description": "Directory where to load static files from, array of strings.",
|
|
30
|
-
"items": {
|
|
31
|
-
"type": "string"
|
|
32
|
-
}
|
|
33
|
-
},
|
|
34
27
|
"configDir": {
|
|
35
28
|
"type": "string",
|
|
36
29
|
"description": "Directory where to load Storybook configurations from.",
|
|
@@ -87,13 +80,5 @@
|
|
|
87
80
|
}
|
|
88
81
|
}
|
|
89
82
|
},
|
|
90
|
-
"additionalProperties": false
|
|
91
|
-
"oneOf": [
|
|
92
|
-
{
|
|
93
|
-
"required": ["browserTarget"]
|
|
94
|
-
},
|
|
95
|
-
{
|
|
96
|
-
"required": ["tsConfig"]
|
|
97
|
-
}
|
|
98
|
-
]
|
|
83
|
+
"additionalProperties": false
|
|
99
84
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export function getWebpackConfig(baseConfig: any, { builderOptions, builderContext }: any): Promise<any>;
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
13
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
14
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
15
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
16
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
17
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
18
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
22
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
23
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
24
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
25
|
+
function step(op) {
|
|
26
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
27
|
+
while (_) try {
|
|
28
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
29
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
30
|
+
switch (op[0]) {
|
|
31
|
+
case 0: case 1: t = op; break;
|
|
32
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
33
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
34
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
35
|
+
default:
|
|
36
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
37
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
38
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
39
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
40
|
+
if (t[2]) _.ops.pop();
|
|
41
|
+
_.trys.pop(); continue;
|
|
42
|
+
}
|
|
43
|
+
op = body.call(thisArg, _);
|
|
44
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
45
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
var __spreadArrays = (this && this.__spreadArrays) || function () {
|
|
49
|
+
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
|
|
50
|
+
for (var r = Array(s), k = 0, i = 0; i < il; i++)
|
|
51
|
+
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
|
|
52
|
+
r[k] = a[j];
|
|
53
|
+
return r;
|
|
54
|
+
};
|
|
55
|
+
// Private angular devkit stuff
|
|
56
|
+
var generateI18nBrowserWebpackConfigFromContext = require('@angular-devkit/build-angular/src/utils/webpack-browser-config').generateI18nBrowserWebpackConfigFromContext;
|
|
57
|
+
var _a = require('@angular-devkit/build-angular/src/webpack/configs'), getCommonConfig = _a.getCommonConfig, getStylesConfig = _a.getStylesConfig, getTypeScriptConfig = _a.getTypeScriptConfig;
|
|
58
|
+
var filterOutStylingRules = require('./utils/filter-out-styling-rules').filterOutStylingRules;
|
|
59
|
+
/**
|
|
60
|
+
* Extract webpack config from angular-cli 12.2.x
|
|
61
|
+
* ⚠️ This file is in JavaScript to not use TypeScript. Because current storybook TypeScript version is not compatible with Angular CLI.
|
|
62
|
+
* FIXME: Try another way with TypeScript on future storybook version (7 maybe 🤞)
|
|
63
|
+
*
|
|
64
|
+
* @param {*} baseConfig Previous webpack config from storybook
|
|
65
|
+
* @param {*} options { builderOptions, builderContext }
|
|
66
|
+
*/
|
|
67
|
+
exports.getWebpackConfig = function (baseConfig, _a) {
|
|
68
|
+
var builderOptions = _a.builderOptions, builderContext = _a.builderContext;
|
|
69
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
70
|
+
var cliConfig, entry, rulesExcludingStyles, module, plugins, resolve;
|
|
71
|
+
var _b, _c, _d;
|
|
72
|
+
return __generator(this, function (_e) {
|
|
73
|
+
switch (_e.label) {
|
|
74
|
+
case 0: return [4 /*yield*/, generateI18nBrowserWebpackConfigFromContext(__assign(__assign({
|
|
75
|
+
// Default options
|
|
76
|
+
index: 'noop-index', main: 'noop-main', outputPath: 'noop-out' }, builderOptions), {
|
|
77
|
+
// Fixed options
|
|
78
|
+
optimization: false, namedChunks: false, progress: false, buildOptimizer: false, aot: false }), builderContext, function (wco) { return [getCommonConfig(wco), getStylesConfig(wco), getTypeScriptConfig(wco)]; })];
|
|
79
|
+
case 1:
|
|
80
|
+
cliConfig = (_e.sent()).config;
|
|
81
|
+
entry = __spreadArrays(baseConfig.entry, ((_b = cliConfig.entry.styles) !== null && _b !== void 0 ? _b : []), ((_c = cliConfig.entry.polyfills) !== null && _c !== void 0 ? _c : []));
|
|
82
|
+
rulesExcludingStyles = filterOutStylingRules(baseConfig);
|
|
83
|
+
module = __assign(__assign({}, baseConfig.module), { rules: __spreadArrays(cliConfig.module.rules, rulesExcludingStyles) });
|
|
84
|
+
plugins = __spreadArrays(((_d = cliConfig.plugins) !== null && _d !== void 0 ? _d : []), baseConfig.plugins);
|
|
85
|
+
resolve = __assign(__assign({}, baseConfig.resolve), { modules: Array.from(new Set(__spreadArrays(baseConfig.resolve.modules, cliConfig.resolve.modules))) });
|
|
86
|
+
return [2 /*return*/, __assign(__assign({}, baseConfig), { entry: entry,
|
|
87
|
+
module: module,
|
|
88
|
+
plugins: plugins,
|
|
89
|
+
resolve: resolve, resolveLoader: cliConfig.resolveLoader })];
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
});
|
|
93
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export function getWebpackConfig(baseConfig: any, { builderOptions, builderContext }: any): Promise<any>;
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
13
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
14
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
15
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
16
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
17
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
18
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
22
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
23
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
24
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
25
|
+
function step(op) {
|
|
26
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
27
|
+
while (_) try {
|
|
28
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
29
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
30
|
+
switch (op[0]) {
|
|
31
|
+
case 0: case 1: t = op; break;
|
|
32
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
33
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
34
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
35
|
+
default:
|
|
36
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
37
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
38
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
39
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
40
|
+
if (t[2]) _.ops.pop();
|
|
41
|
+
_.trys.pop(); continue;
|
|
42
|
+
}
|
|
43
|
+
op = body.call(thisArg, _);
|
|
44
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
45
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
var __spreadArrays = (this && this.__spreadArrays) || function () {
|
|
49
|
+
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
|
|
50
|
+
for (var r = Array(s), k = 0, i = 0; i < il; i++)
|
|
51
|
+
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
|
|
52
|
+
r[k] = a[j];
|
|
53
|
+
return r;
|
|
54
|
+
};
|
|
55
|
+
// Private angular devkit stuff
|
|
56
|
+
var generateI18nBrowserWebpackConfigFromContext = require('@angular-devkit/build-angular/src/utils/webpack-browser-config').generateI18nBrowserWebpackConfigFromContext;
|
|
57
|
+
var _a = require('@angular-devkit/build-angular/src/webpack/configs'), getCommonConfig = _a.getCommonConfig, getStylesConfig = _a.getStylesConfig, getTypescriptWorkerPlugin = _a.getTypescriptWorkerPlugin;
|
|
58
|
+
var filterOutStylingRules = require('./utils/filter-out-styling-rules').filterOutStylingRules;
|
|
59
|
+
/**
|
|
60
|
+
* Extract webpack config from angular-cli 13.x.x
|
|
61
|
+
* ⚠️ This file is in JavaScript to not use TypeScript. Because current storybook TypeScript version is not compatible with Angular CLI.
|
|
62
|
+
* FIXME: Try another way with TypeScript on future storybook version (7 maybe 🤞)
|
|
63
|
+
*
|
|
64
|
+
* @param {*} baseConfig Previous webpack config from storybook
|
|
65
|
+
* @param {*} options { builderOptions, builderContext }
|
|
66
|
+
*/
|
|
67
|
+
exports.getWebpackConfig = function (baseConfig, _a) {
|
|
68
|
+
var builderOptions = _a.builderOptions, builderContext = _a.builderContext;
|
|
69
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
70
|
+
var cliConfig, entry, rulesExcludingStyles, module, plugins, resolve;
|
|
71
|
+
var _b, _c, _d;
|
|
72
|
+
return __generator(this, function (_e) {
|
|
73
|
+
switch (_e.label) {
|
|
74
|
+
case 0: return [4 /*yield*/, generateI18nBrowserWebpackConfigFromContext(__assign(__assign({
|
|
75
|
+
// Default options
|
|
76
|
+
index: 'noop-index', main: 'noop-main', outputPath: 'noop-out' }, builderOptions), {
|
|
77
|
+
// Fixed options
|
|
78
|
+
optimization: false, namedChunks: false, progress: false, buildOptimizer: false, aot: false }), builderContext, function (wco) { return [getCommonConfig(wco), getStylesConfig(wco), getTypescriptWorkerPlugin(wco)]; })];
|
|
79
|
+
case 1:
|
|
80
|
+
cliConfig = (_e.sent()).config;
|
|
81
|
+
entry = __spreadArrays(baseConfig.entry, ((_b = cliConfig.entry.styles) !== null && _b !== void 0 ? _b : []), ((_c = cliConfig.entry.polyfills) !== null && _c !== void 0 ? _c : []));
|
|
82
|
+
rulesExcludingStyles = filterOutStylingRules(baseConfig);
|
|
83
|
+
module = __assign(__assign({}, baseConfig.module), { rules: __spreadArrays(cliConfig.module.rules, rulesExcludingStyles) });
|
|
84
|
+
plugins = __spreadArrays(((_d = cliConfig.plugins) !== null && _d !== void 0 ? _d : []), baseConfig.plugins);
|
|
85
|
+
resolve = __assign(__assign({}, baseConfig.resolve), { modules: Array.from(new Set(__spreadArrays(baseConfig.resolve.modules, cliConfig.resolve.modules))) });
|
|
86
|
+
return [2 /*return*/, __assign(__assign({}, baseConfig), { entry: entry,
|
|
87
|
+
module: module,
|
|
88
|
+
plugins: plugins,
|
|
89
|
+
resolve: resolve, resolveLoader: cliConfig.resolveLoader })];
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
});
|
|
93
|
+
};
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import webpack from 'webpack';
|
|
2
|
+
import TsconfigPathsPlugin from 'tsconfig-paths-webpack-plugin';
|
|
3
|
+
import { PresetOptions } from './options';
|
|
4
|
+
/**
|
|
5
|
+
* Old way currently support version lower than 12.2.x
|
|
6
|
+
*/
|
|
7
|
+
export declare function getWebpackConfig(baseConfig: webpack.Configuration, options: PresetOptions): Promise<webpack.Configuration | {
|
|
8
|
+
entry: any[];
|
|
9
|
+
module: {
|
|
10
|
+
rules: webpack.RuleSetRule[];
|
|
11
|
+
noParse?: RegExp | RegExp[] | ((content: string) => boolean);
|
|
12
|
+
unknownContextRequest?: string;
|
|
13
|
+
unknownContextRecursive?: boolean;
|
|
14
|
+
unknownContextRegExp?: RegExp;
|
|
15
|
+
unknownContextCritical?: boolean;
|
|
16
|
+
exprContextRequest?: string;
|
|
17
|
+
exprContextRegExp?: RegExp;
|
|
18
|
+
exprContextRecursive?: boolean;
|
|
19
|
+
exprContextCritical?: boolean;
|
|
20
|
+
wrappedContextRegExp?: RegExp;
|
|
21
|
+
wrappedContextRecursive?: boolean;
|
|
22
|
+
wrappedContextCritical?: boolean;
|
|
23
|
+
strictExportPresence?: boolean;
|
|
24
|
+
};
|
|
25
|
+
plugins: webpack.Plugin[];
|
|
26
|
+
resolve: {
|
|
27
|
+
modules: string[];
|
|
28
|
+
plugins: TsconfigPathsPlugin[];
|
|
29
|
+
descriptionFiles?: string[];
|
|
30
|
+
mainFields?: string[] | string[][];
|
|
31
|
+
aliasFields?: string[] | string[][];
|
|
32
|
+
mainFiles?: string[];
|
|
33
|
+
extensions?: string[];
|
|
34
|
+
enforceExtension?: boolean;
|
|
35
|
+
alias?: {
|
|
36
|
+
[key: string]: string;
|
|
37
|
+
};
|
|
38
|
+
unsafeCache?: boolean | {};
|
|
39
|
+
cachePredicate?(data: {
|
|
40
|
+
path: string;
|
|
41
|
+
request: string;
|
|
42
|
+
}): boolean;
|
|
43
|
+
symlinks?: boolean;
|
|
44
|
+
cacheWithContext?: boolean;
|
|
45
|
+
roots?: string[];
|
|
46
|
+
};
|
|
47
|
+
resolveLoader: webpack.ResolveLoader;
|
|
48
|
+
mode?: "development" | "production" | "none";
|
|
49
|
+
name?: string;
|
|
50
|
+
context?: string;
|
|
51
|
+
devtool?: webpack.Options.Devtool;
|
|
52
|
+
output?: webpack.Output;
|
|
53
|
+
externals?: string | RegExp | webpack.ExternalsObjectElement | webpack.ExternalsFunctionElement | webpack.ExternalsElement[];
|
|
54
|
+
target?: "node" | "web" | "webworker" | "async-node" | "node-webkit" | "atom" | "electron" | "electron-renderer" | "electron-preload" | "electron-main" | ((compiler?: any) => void);
|
|
55
|
+
bail?: boolean;
|
|
56
|
+
profile?: boolean;
|
|
57
|
+
cache?: boolean | object;
|
|
58
|
+
watch?: boolean;
|
|
59
|
+
watchOptions?: webpack.ICompiler.WatchOptions;
|
|
60
|
+
node?: false | webpack.Node;
|
|
61
|
+
amd?: {
|
|
62
|
+
[moduleName: string]: boolean;
|
|
63
|
+
};
|
|
64
|
+
recordsPath?: string;
|
|
65
|
+
recordsInputPath?: string;
|
|
66
|
+
recordsOutputPath?: string;
|
|
67
|
+
stats?: webpack.Stats.ToStringOptions;
|
|
68
|
+
performance?: false | webpack.Options.Performance;
|
|
69
|
+
parallelism?: number;
|
|
70
|
+
optimization?: webpack.Options.Optimization;
|
|
71
|
+
devServer?: import("webpack-dev-server").Configuration;
|
|
72
|
+
}>;
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
14
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
15
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
16
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
17
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
18
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
19
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
23
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
24
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
25
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
26
|
+
function step(op) {
|
|
27
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
28
|
+
while (_) try {
|
|
29
|
+
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;
|
|
30
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
31
|
+
switch (op[0]) {
|
|
32
|
+
case 0: case 1: t = op; break;
|
|
33
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
34
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
35
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
36
|
+
default:
|
|
37
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
38
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
39
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
40
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
41
|
+
if (t[2]) _.ops.pop();
|
|
42
|
+
_.trys.pop(); continue;
|
|
43
|
+
}
|
|
44
|
+
op = body.call(thisArg, _);
|
|
45
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
46
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
var __spreadArrays = (this && this.__spreadArrays) || function () {
|
|
50
|
+
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
|
|
51
|
+
for (var r = Array(s), k = 0, i = 0; i < il; i++)
|
|
52
|
+
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
|
|
53
|
+
r[k] = a[j];
|
|
54
|
+
return r;
|
|
55
|
+
};
|
|
56
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
57
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
58
|
+
};
|
|
59
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
60
|
+
exports.getWebpackConfig = void 0;
|
|
61
|
+
var node_logger_1 = require("@storybook/node-logger");
|
|
62
|
+
var tsconfig_paths_webpack_plugin_1 = __importDefault(require("tsconfig-paths-webpack-plugin"));
|
|
63
|
+
var architect_1 = require("@angular-devkit/architect");
|
|
64
|
+
var angular_read_workspace_1 = require("./angular-read-workspace");
|
|
65
|
+
var angular_devkit_build_webpack_1 = require("./angular-devkit-build-webpack");
|
|
66
|
+
var filter_out_styling_rules_1 = require("./utils/filter-out-styling-rules");
|
|
67
|
+
/**
|
|
68
|
+
* Old way currently support version lower than 12.2.x
|
|
69
|
+
*/
|
|
70
|
+
function getWebpackConfig(baseConfig, options) {
|
|
71
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
72
|
+
var dirToSearch, workspaceConfig, error_1, project, target, confName, browserTarget, fondProject, angularCliWebpackConfig, error_2;
|
|
73
|
+
return __generator(this, function (_a) {
|
|
74
|
+
switch (_a.label) {
|
|
75
|
+
case 0:
|
|
76
|
+
dirToSearch = process.cwd();
|
|
77
|
+
_a.label = 1;
|
|
78
|
+
case 1:
|
|
79
|
+
_a.trys.push([1, 3, , 4]);
|
|
80
|
+
return [4 /*yield*/, angular_read_workspace_1.readAngularWorkspaceConfig(dirToSearch)];
|
|
81
|
+
case 2:
|
|
82
|
+
workspaceConfig = _a.sent();
|
|
83
|
+
return [3 /*break*/, 4];
|
|
84
|
+
case 3:
|
|
85
|
+
error_1 = _a.sent();
|
|
86
|
+
node_logger_1.logger.error("=> Could not find angular workspace config (angular.json) on this path \"" + dirToSearch + "\"");
|
|
87
|
+
node_logger_1.logger.info("=> Fail to load angular-cli config. Using base config");
|
|
88
|
+
return [2 /*return*/, baseConfig];
|
|
89
|
+
case 4:
|
|
90
|
+
try {
|
|
91
|
+
// Default behavior when `angularBrowserTarget` are not explicitly defined to null
|
|
92
|
+
if (options.angularBrowserTarget !== null) {
|
|
93
|
+
browserTarget = options.angularBrowserTarget
|
|
94
|
+
? architect_1.targetFromTargetString(options.angularBrowserTarget)
|
|
95
|
+
: {
|
|
96
|
+
configuration: undefined,
|
|
97
|
+
project: angular_read_workspace_1.getDefaultProjectName(workspaceConfig),
|
|
98
|
+
target: 'build',
|
|
99
|
+
};
|
|
100
|
+
fondProject = angular_read_workspace_1.findAngularProjectTarget(workspaceConfig, browserTarget.project, browserTarget.target);
|
|
101
|
+
project = fondProject.project;
|
|
102
|
+
target = fondProject.target;
|
|
103
|
+
confName = browserTarget.configuration;
|
|
104
|
+
node_logger_1.logger.info("=> Using angular project \"" + browserTarget.project + ":" + browserTarget.target + (confName ? ":" + confName : '') + "\" for configuring Storybook");
|
|
105
|
+
}
|
|
106
|
+
// Start storybook when only tsConfig is provided.
|
|
107
|
+
if (options.angularBrowserTarget === null && options.tsConfig) {
|
|
108
|
+
node_logger_1.logger.info("=> Using default angular project with \"tsConfig:" + options.tsConfig + "\"");
|
|
109
|
+
project = { root: '', extensions: {}, targets: undefined };
|
|
110
|
+
target = { builder: '', options: { tsConfig: options.tsConfig } };
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
catch (error) {
|
|
114
|
+
node_logger_1.logger.error("=> Could not find angular project: " + error.message);
|
|
115
|
+
node_logger_1.logger.info("=> Fail to load angular-cli config. Using base config");
|
|
116
|
+
return [2 /*return*/, baseConfig];
|
|
117
|
+
}
|
|
118
|
+
_a.label = 5;
|
|
119
|
+
case 5:
|
|
120
|
+
_a.trys.push([5, 7, , 8]);
|
|
121
|
+
return [4 /*yield*/, angular_devkit_build_webpack_1.extractAngularCliWebpackConfig(dirToSearch, project, target, confName)];
|
|
122
|
+
case 6:
|
|
123
|
+
angularCliWebpackConfig = _a.sent();
|
|
124
|
+
node_logger_1.logger.info("=> Using angular-cli webpack config");
|
|
125
|
+
return [3 /*break*/, 8];
|
|
126
|
+
case 7:
|
|
127
|
+
error_2 = _a.sent();
|
|
128
|
+
node_logger_1.logger.error("=> Could not get angular cli webpack config");
|
|
129
|
+
throw error_2;
|
|
130
|
+
case 8: return [2 /*return*/, mergeAngularCliWebpackConfig(angularCliWebpackConfig, baseConfig)];
|
|
131
|
+
}
|
|
132
|
+
});
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
exports.getWebpackConfig = getWebpackConfig;
|
|
136
|
+
function mergeAngularCliWebpackConfig(_a, baseConfig) {
|
|
137
|
+
var cliCommonWebpackConfig = _a.cliCommonWebpackConfig, cliStyleWebpackConfig = _a.cliStyleWebpackConfig, tsConfigPath = _a.tsConfigPath;
|
|
138
|
+
// Don't use storybooks styling rules because we have to use rules created by @angular-devkit/build-angular
|
|
139
|
+
// because @angular-devkit/build-angular created rules have include/exclude for global style files.
|
|
140
|
+
var rulesExcludingStyles = filter_out_styling_rules_1.filterOutStylingRules(baseConfig);
|
|
141
|
+
// styleWebpackConfig.entry adds global style files to the webpack context
|
|
142
|
+
var entry = __spreadArrays(baseConfig.entry, Object.values(cliStyleWebpackConfig.entry).reduce(function (acc, item) { return acc.concat(item); }, []));
|
|
143
|
+
var module = __assign(__assign({}, baseConfig.module), { rules: __spreadArrays(cliStyleWebpackConfig.module.rules, rulesExcludingStyles) });
|
|
144
|
+
// We use cliCommonConfig plugins to serve static assets files.
|
|
145
|
+
var plugins = __spreadArrays(cliStyleWebpackConfig.plugins, cliCommonWebpackConfig.plugins, baseConfig.plugins);
|
|
146
|
+
var resolve = __assign(__assign({}, baseConfig.resolve), { modules: Array.from(new Set(__spreadArrays(baseConfig.resolve.modules, cliCommonWebpackConfig.resolve.modules))), plugins: [
|
|
147
|
+
new tsconfig_paths_webpack_plugin_1.default({
|
|
148
|
+
configFile: tsConfigPath,
|
|
149
|
+
mainFields: ['browser', 'module', 'main'],
|
|
150
|
+
}),
|
|
151
|
+
] });
|
|
152
|
+
return __assign(__assign({}, baseConfig), { entry: entry,
|
|
153
|
+
module: module,
|
|
154
|
+
plugins: plugins,
|
|
155
|
+
resolve: resolve, resolveLoader: cliCommonWebpackConfig.resolveLoader });
|
|
156
|
+
}
|
|
@@ -1,73 +1,3 @@
|
|
|
1
1
|
import webpack from 'webpack';
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
export declare type Options = CoreOptions & {
|
|
5
|
-
angularBrowserTarget?: string;
|
|
6
|
-
tsConfig?: string;
|
|
7
|
-
};
|
|
8
|
-
export declare function webpackFinal(baseConfig: webpack.Configuration, options: Options): Promise<webpack.Configuration | {
|
|
9
|
-
entry: any[];
|
|
10
|
-
module: {
|
|
11
|
-
rules: webpack.RuleSetRule[];
|
|
12
|
-
noParse?: RegExp | RegExp[] | ((content: string) => boolean);
|
|
13
|
-
unknownContextRequest?: string;
|
|
14
|
-
unknownContextRecursive?: boolean;
|
|
15
|
-
unknownContextRegExp?: RegExp;
|
|
16
|
-
unknownContextCritical?: boolean;
|
|
17
|
-
exprContextRequest?: string;
|
|
18
|
-
exprContextRegExp?: RegExp;
|
|
19
|
-
exprContextRecursive?: boolean;
|
|
20
|
-
exprContextCritical?: boolean;
|
|
21
|
-
wrappedContextRegExp?: RegExp;
|
|
22
|
-
wrappedContextRecursive?: boolean;
|
|
23
|
-
wrappedContextCritical?: boolean;
|
|
24
|
-
strictExportPresence?: boolean;
|
|
25
|
-
};
|
|
26
|
-
plugins: webpack.Plugin[];
|
|
27
|
-
resolve: {
|
|
28
|
-
modules: string[];
|
|
29
|
-
plugins: TsconfigPathsPlugin[];
|
|
30
|
-
descriptionFiles?: string[];
|
|
31
|
-
mainFields?: string[] | string[][];
|
|
32
|
-
aliasFields?: string[] | string[][];
|
|
33
|
-
mainFiles?: string[];
|
|
34
|
-
extensions?: string[];
|
|
35
|
-
enforceExtension?: boolean;
|
|
36
|
-
alias?: {
|
|
37
|
-
[key: string]: string;
|
|
38
|
-
};
|
|
39
|
-
unsafeCache?: boolean | {};
|
|
40
|
-
cachePredicate?(data: {
|
|
41
|
-
path: string;
|
|
42
|
-
request: string;
|
|
43
|
-
}): boolean;
|
|
44
|
-
symlinks?: boolean;
|
|
45
|
-
cacheWithContext?: boolean;
|
|
46
|
-
roots?: string[];
|
|
47
|
-
};
|
|
48
|
-
resolveLoader: webpack.ResolveLoader;
|
|
49
|
-
mode?: "development" | "production" | "none";
|
|
50
|
-
name?: string;
|
|
51
|
-
context?: string;
|
|
52
|
-
devtool?: webpack.Options.Devtool;
|
|
53
|
-
output?: webpack.Output;
|
|
54
|
-
externals?: string | RegExp | webpack.ExternalsObjectElement | webpack.ExternalsFunctionElement | webpack.ExternalsElement[];
|
|
55
|
-
target?: "node" | "web" | "webworker" | "async-node" | "node-webkit" | "atom" | "electron" | "electron-renderer" | "electron-preload" | "electron-main" | ((compiler?: any) => void);
|
|
56
|
-
bail?: boolean;
|
|
57
|
-
profile?: boolean;
|
|
58
|
-
cache?: boolean | object;
|
|
59
|
-
watch?: boolean;
|
|
60
|
-
watchOptions?: webpack.ICompiler.WatchOptions;
|
|
61
|
-
node?: false | webpack.Node;
|
|
62
|
-
amd?: {
|
|
63
|
-
[moduleName: string]: boolean;
|
|
64
|
-
};
|
|
65
|
-
recordsPath?: string;
|
|
66
|
-
recordsInputPath?: string;
|
|
67
|
-
recordsOutputPath?: string;
|
|
68
|
-
stats?: webpack.Stats.ToStringOptions;
|
|
69
|
-
performance?: false | webpack.Options.Performance;
|
|
70
|
-
parallelism?: number;
|
|
71
|
-
optimization?: webpack.Options.Optimization;
|
|
72
|
-
devServer?: import("webpack-dev-server").Configuration;
|
|
73
|
-
}>;
|
|
2
|
+
import { PresetOptions } from './options';
|
|
3
|
+
export declare function webpackFinal(baseConfig: webpack.Configuration, options: PresetOptions): Promise<webpack.Configuration>;
|
|
@@ -10,6 +10,25 @@ 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
|
+
};
|
|
13
32
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
14
33
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
15
34
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -46,114 +65,127 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
46
65
|
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
47
66
|
}
|
|
48
67
|
};
|
|
49
|
-
var __spreadArrays = (this && this.__spreadArrays) || function () {
|
|
50
|
-
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
|
|
51
|
-
for (var r = Array(s), k = 0, i = 0; i < il; i++)
|
|
52
|
-
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
|
|
53
|
-
r[k] = a[j];
|
|
54
|
-
return r;
|
|
55
|
-
};
|
|
56
68
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
57
69
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
58
70
|
};
|
|
59
71
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
60
72
|
exports.webpackFinal = void 0;
|
|
61
73
|
var node_logger_1 = require("@storybook/node-logger");
|
|
62
|
-
var tsconfig_paths_webpack_plugin_1 = __importDefault(require("tsconfig-paths-webpack-plugin"));
|
|
63
74
|
var architect_1 = require("@angular-devkit/architect");
|
|
64
|
-
var
|
|
65
|
-
var
|
|
75
|
+
var find_up_1 = require("find-up");
|
|
76
|
+
var semver_1 = __importDefault(require("@storybook/semver"));
|
|
77
|
+
var core_1 = require("@angular-devkit/core");
|
|
66
78
|
var module_is_available_1 = require("./utils/module-is-available");
|
|
67
|
-
var
|
|
79
|
+
var angular_cli_webpack_12_2_x_1 = require("./angular-cli-webpack-12.2.x");
|
|
80
|
+
var angular_cli_webpack_13_x_x_1 = require("./angular-cli-webpack-13.x.x");
|
|
81
|
+
var angular_cli_webpack_older_1 = require("./angular-cli-webpack-older");
|
|
68
82
|
function webpackFinal(baseConfig, options) {
|
|
69
83
|
return __awaiter(this, void 0, void 0, function () {
|
|
70
|
-
var
|
|
84
|
+
var angularCliVersion, webpackGetterByVersions, webpackGetter;
|
|
85
|
+
var _this = this;
|
|
71
86
|
return __generator(this, function (_a) {
|
|
72
87
|
switch (_a.label) {
|
|
73
88
|
case 0:
|
|
74
|
-
dirToSearch = process.cwd();
|
|
75
89
|
if (!module_is_available_1.moduleIsAvailable('@angular-devkit/build-angular')) {
|
|
76
90
|
node_logger_1.logger.info('=> Using base config because "@angular-devkit/build-angular" is not installed');
|
|
77
91
|
return [2 /*return*/, baseConfig];
|
|
78
92
|
}
|
|
79
|
-
|
|
80
|
-
_a.label = 1;
|
|
93
|
+
return [4 /*yield*/, Promise.resolve().then(function () { return __importStar(require('@angular/cli')); }).then(function (m) { return semver_1.default.coerce(m.VERSION.full); })];
|
|
81
94
|
case 1:
|
|
82
|
-
_a.
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
node_logger_1.logger.
|
|
132
|
-
|
|
133
|
-
case 8: return [2 /*return*/, mergeAngularCliWebpackConfig(angularCliWebpackConfig, baseConfig)];
|
|
95
|
+
angularCliVersion = _a.sent();
|
|
96
|
+
webpackGetterByVersions = [
|
|
97
|
+
{
|
|
98
|
+
info: '=> Loading angular-cli config for angular >= 13.0.0',
|
|
99
|
+
condition: semver_1.default.satisfies(angularCliVersion, '>=13.0.0'),
|
|
100
|
+
getWebpackConfig: function (_baseConfig, _options) { return __awaiter(_this, void 0, void 0, function () {
|
|
101
|
+
var builderContext, builderOptions;
|
|
102
|
+
return __generator(this, function (_a) {
|
|
103
|
+
switch (_a.label) {
|
|
104
|
+
case 0:
|
|
105
|
+
builderContext = getBuilderContext(_options);
|
|
106
|
+
return [4 /*yield*/, getBuilderOptions(_options, builderContext)];
|
|
107
|
+
case 1:
|
|
108
|
+
builderOptions = _a.sent();
|
|
109
|
+
return [2 /*return*/, angular_cli_webpack_13_x_x_1.getWebpackConfig(_baseConfig, {
|
|
110
|
+
builderOptions: builderOptions,
|
|
111
|
+
builderContext: builderContext,
|
|
112
|
+
})];
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
}); },
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
info: '=> Loading angular-cli config for angular 12.2.x',
|
|
119
|
+
condition: semver_1.default.satisfies(angularCliVersion, '12.2.x') && options.angularBuilderContext,
|
|
120
|
+
getWebpackConfig: function (_baseConfig, _options) { return __awaiter(_this, void 0, void 0, function () {
|
|
121
|
+
var builderContext, builderOptions;
|
|
122
|
+
return __generator(this, function (_a) {
|
|
123
|
+
switch (_a.label) {
|
|
124
|
+
case 0:
|
|
125
|
+
builderContext = getBuilderContext(_options);
|
|
126
|
+
return [4 /*yield*/, getBuilderOptions(_options, builderContext)];
|
|
127
|
+
case 1:
|
|
128
|
+
builderOptions = _a.sent();
|
|
129
|
+
return [2 /*return*/, angular_cli_webpack_12_2_x_1.getWebpackConfig(_baseConfig, {
|
|
130
|
+
builderOptions: builderOptions,
|
|
131
|
+
builderContext: builderContext,
|
|
132
|
+
})];
|
|
133
|
+
}
|
|
134
|
+
});
|
|
135
|
+
}); },
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
info: '=> Loading angular-cli config for angular lower than 12.2.0',
|
|
139
|
+
condition: true,
|
|
140
|
+
getWebpackConfig: angular_cli_webpack_older_1.getWebpackConfig,
|
|
141
|
+
},
|
|
142
|
+
];
|
|
143
|
+
webpackGetter = webpackGetterByVersions.find(function (wg) { return wg.condition; });
|
|
144
|
+
node_logger_1.logger.info(webpackGetter.info);
|
|
145
|
+
return [2 /*return*/, Promise.resolve(webpackGetter.getWebpackConfig(baseConfig, options))];
|
|
134
146
|
}
|
|
135
147
|
});
|
|
136
148
|
});
|
|
137
149
|
}
|
|
138
150
|
exports.webpackFinal = webpackFinal;
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
151
|
+
/**
|
|
152
|
+
* Get Builder Context
|
|
153
|
+
* If storybook is not start by angular builder create dumb BuilderContext
|
|
154
|
+
*/
|
|
155
|
+
function getBuilderContext(options) {
|
|
156
|
+
var _a;
|
|
157
|
+
return ((_a = options.angularBuilderContext) !== null && _a !== void 0 ? _a : {
|
|
158
|
+
target: { project: 'noop-project', builder: '', options: {} },
|
|
159
|
+
workspaceRoot: process.cwd(),
|
|
160
|
+
getProjectMetadata: function () { return ({}); },
|
|
161
|
+
getTargetOptions: function () { return ({}); },
|
|
162
|
+
logger: new core_1.logging.Logger('Storybook'),
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Get builder options
|
|
167
|
+
* Merge target options from browser target and from storybook options
|
|
168
|
+
*/
|
|
169
|
+
function getBuilderOptions(options, builderContext) {
|
|
170
|
+
var _a, _b, _c, _d;
|
|
171
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
172
|
+
var browserTargetOptions, browserTarget, builderOptions;
|
|
173
|
+
return __generator(this, function (_e) {
|
|
174
|
+
switch (_e.label) {
|
|
175
|
+
case 0:
|
|
176
|
+
browserTargetOptions = {};
|
|
177
|
+
if (!options.angularBrowserTarget) return [3 /*break*/, 2];
|
|
178
|
+
browserTarget = architect_1.targetFromTargetString(options.angularBrowserTarget);
|
|
179
|
+
node_logger_1.logger.info("=> Using angular browser target options from \"" + browserTarget.project + ":" + browserTarget.target + (browserTarget.configuration ? ":" + browserTarget.configuration : '') + "\"");
|
|
180
|
+
return [4 /*yield*/, builderContext.getTargetOptions(browserTarget)];
|
|
181
|
+
case 1:
|
|
182
|
+
browserTargetOptions = _e.sent();
|
|
183
|
+
_e.label = 2;
|
|
184
|
+
case 2:
|
|
185
|
+
builderOptions = __assign(__assign(__assign({}, browserTargetOptions), options.angularBuilderOptions), { tsConfig: (_d = (_c = (_a = options.tsConfig) !== null && _a !== void 0 ? _a : (_b = options.angularBuilderOptions) === null || _b === void 0 ? void 0 : _b.tsConfig) !== null && _c !== void 0 ? _c : browserTargetOptions.tsConfig) !== null && _d !== void 0 ? _d : find_up_1.sync('tsconfig.json', { cwd: options.configDir }) });
|
|
186
|
+
node_logger_1.logger.info("=> Using angular project with \"tsConfig:" + builderOptions.tsConfig + "\"");
|
|
187
|
+
return [2 /*return*/, builderOptions];
|
|
188
|
+
}
|
|
189
|
+
});
|
|
190
|
+
});
|
|
159
191
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { Configuration } from 'webpack';
|
|
2
|
-
import {
|
|
2
|
+
import { PresetOptions } from './options';
|
|
3
3
|
/**
|
|
4
4
|
* Run ngcc for converting modules to ivy format before starting storybook
|
|
5
5
|
* This step is needed in order to support Ivy in storybook
|
|
6
6
|
*
|
|
7
7
|
* Information about Ivy can be found here https://angular.io/guide/ivy
|
|
8
8
|
*/
|
|
9
|
-
export declare const runNgcc: () => void
|
|
10
|
-
export declare const webpack: (webpackConfig: Configuration, options:
|
|
9
|
+
export declare const runNgcc: () => Promise<void>;
|
|
10
|
+
export declare const webpack: (webpackConfig: Configuration, options: PresetOptions) => Promise<Configuration>;
|
|
@@ -67,24 +67,59 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
67
67
|
};
|
|
68
68
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
69
69
|
exports.webpack = exports.runNgcc = void 0;
|
|
70
|
-
var ngcc_1 = require("@angular/compiler-cli/ngcc");
|
|
71
70
|
var path = __importStar(require("path"));
|
|
71
|
+
/**
|
|
72
|
+
* Source : https://github.com/angular/angular-cli/blob/ebccb5de4a455af813c5e82483db6af20666bdbd/packages/angular_devkit/build_angular/src/utils/load-esm.ts#L23
|
|
73
|
+
* This uses a dynamic import to load a module which may be ESM.
|
|
74
|
+
* CommonJS code can load ESM code via a dynamic import. Unfortunately, TypeScript
|
|
75
|
+
* will currently, unconditionally downlevel dynamic import into a require call.
|
|
76
|
+
* require calls cannot load ESM code and will result in a runtime error. To workaround
|
|
77
|
+
* this, a Function constructor is used to prevent TypeScript from changing the dynamic import.
|
|
78
|
+
* Once TypeScript provides support for keeping the dynamic import this workaround can
|
|
79
|
+
* be dropped.
|
|
80
|
+
*
|
|
81
|
+
* @param modulePath The path of the module to load.
|
|
82
|
+
* @returns A Promise that resolves to the dynamically imported module.
|
|
83
|
+
*/
|
|
84
|
+
function loadEsmModule(modulePath) {
|
|
85
|
+
// eslint-disable-next-line no-new-func
|
|
86
|
+
return new Function('modulePath', "return import(modulePath);")(modulePath);
|
|
87
|
+
}
|
|
72
88
|
/**
|
|
73
89
|
* Run ngcc for converting modules to ivy format before starting storybook
|
|
74
90
|
* This step is needed in order to support Ivy in storybook
|
|
75
91
|
*
|
|
76
92
|
* Information about Ivy can be found here https://angular.io/guide/ivy
|
|
77
93
|
*/
|
|
78
|
-
exports.runNgcc = function () {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
94
|
+
exports.runNgcc = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
95
|
+
var ngcc, error_1;
|
|
96
|
+
return __generator(this, function (_a) {
|
|
97
|
+
switch (_a.label) {
|
|
98
|
+
case 0:
|
|
99
|
+
_a.trys.push([0, 2, , 4]);
|
|
100
|
+
return [4 /*yield*/, Promise.resolve().then(function () { return __importStar(require('@angular/compiler-cli/ngcc')); })];
|
|
101
|
+
case 1:
|
|
102
|
+
ngcc = _a.sent();
|
|
103
|
+
return [3 /*break*/, 4];
|
|
104
|
+
case 2:
|
|
105
|
+
error_1 = _a.sent();
|
|
106
|
+
return [4 /*yield*/, loadEsmModule('@angular/compiler-cli/ngcc')];
|
|
107
|
+
case 3:
|
|
108
|
+
ngcc = _a.sent();
|
|
109
|
+
return [3 /*break*/, 4];
|
|
110
|
+
case 4:
|
|
111
|
+
ngcc.process({
|
|
112
|
+
// should be async: true but does not work due to
|
|
113
|
+
// https://github.com/storybookjs/storybook/pull/11157/files#r615413803
|
|
114
|
+
async: false,
|
|
115
|
+
basePath: path.join(process.cwd(), 'node_modules'),
|
|
116
|
+
createNewEntryPointFormats: true,
|
|
117
|
+
compileAllFormats: false,
|
|
118
|
+
});
|
|
119
|
+
return [2 /*return*/];
|
|
120
|
+
}
|
|
86
121
|
});
|
|
87
|
-
};
|
|
122
|
+
}); };
|
|
88
123
|
exports.webpack = function (webpackConfig, options) { return __awaiter(void 0, void 0, void 0, function () {
|
|
89
124
|
var angularOptions;
|
|
90
125
|
return __generator(this, function (_a) {
|
|
@@ -1,3 +1,11 @@
|
|
|
1
|
-
import { LoadOptions } from '@storybook/core-common';
|
|
1
|
+
import { LoadOptions, Options as CoreOptions } from '@storybook/core-common';
|
|
2
|
+
import { BuilderContext } from '@angular-devkit/architect';
|
|
3
|
+
import { JsonObject } from '@angular-devkit/core';
|
|
4
|
+
export declare type PresetOptions = CoreOptions & {
|
|
5
|
+
angularBrowserTarget?: string | null;
|
|
6
|
+
angularBuilderOptions?: JsonObject | null;
|
|
7
|
+
angularBuilderContext?: BuilderContext | null;
|
|
8
|
+
tsConfig?: string;
|
|
9
|
+
};
|
|
2
10
|
declare const _default: LoadOptions;
|
|
3
11
|
export default _default;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@storybook/angular",
|
|
3
|
-
"version": "6.4.0-rc.
|
|
3
|
+
"version": "6.4.0-rc.4",
|
|
4
4
|
"description": "Storybook for Angular: Develop Angular Components in isolation with Hot Reloading.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"storybook"
|
|
@@ -45,17 +45,19 @@
|
|
|
45
45
|
"prepare": "node ../../scripts/prepare.js"
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@storybook/addons": "6.4.0-rc.
|
|
49
|
-
"@storybook/api": "6.4.0-rc.
|
|
50
|
-
"@storybook/core": "6.4.0-rc.
|
|
51
|
-
"@storybook/core-common": "6.4.0-rc.
|
|
52
|
-
"@storybook/core-events": "6.4.0-rc.
|
|
48
|
+
"@storybook/addons": "6.4.0-rc.4",
|
|
49
|
+
"@storybook/api": "6.4.0-rc.4",
|
|
50
|
+
"@storybook/core": "6.4.0-rc.4",
|
|
51
|
+
"@storybook/core-common": "6.4.0-rc.4",
|
|
52
|
+
"@storybook/core-events": "6.4.0-rc.4",
|
|
53
53
|
"@storybook/csf": "0.0.2--canary.87bc651.0",
|
|
54
|
-
"@storybook/node-logger": "6.4.0-rc.
|
|
55
|
-
"@storybook/
|
|
54
|
+
"@storybook/node-logger": "6.4.0-rc.4",
|
|
55
|
+
"@storybook/semver": "^7.3.2",
|
|
56
|
+
"@storybook/store": "6.4.0-rc.4",
|
|
56
57
|
"@types/webpack-env": "^1.16.0",
|
|
57
58
|
"autoprefixer": "^9.8.6",
|
|
58
59
|
"core-js": "^3.8.2",
|
|
60
|
+
"find-up": "^5.0.0",
|
|
59
61
|
"fork-ts-checker-webpack-plugin": "^4.1.6",
|
|
60
62
|
"global": "^4.4.0",
|
|
61
63
|
"postcss": "^7.0.36",
|
|
@@ -78,6 +80,7 @@
|
|
|
78
80
|
"@angular-devkit/architect": "~0.1102.0",
|
|
79
81
|
"@angular-devkit/build-angular": "~0.1102.13",
|
|
80
82
|
"@angular-devkit/core": "^11.2.13",
|
|
83
|
+
"@angular/cli": "^11.2.14",
|
|
81
84
|
"@angular/common": "^11.2.14",
|
|
82
85
|
"@angular/compiler": "^11.2.14",
|
|
83
86
|
"@angular/compiler-cli": "^11.2.14",
|
|
@@ -98,6 +101,7 @@
|
|
|
98
101
|
"@angular-devkit/architect": ">=0.8.9",
|
|
99
102
|
"@angular-devkit/build-angular": ">=0.8.9",
|
|
100
103
|
"@angular-devkit/core": "^0.6.1 || >=7.0.0",
|
|
104
|
+
"@angular/cli": ">=6.0.0",
|
|
101
105
|
"@angular/common": ">=6.0.0",
|
|
102
106
|
"@angular/compiler": ">=6.0.0",
|
|
103
107
|
"@angular/compiler-cli": ">=6.0.0",
|
|
@@ -114,6 +118,9 @@
|
|
|
114
118
|
"zone.js": "^0.8.29 || ^0.9.0 || ^0.10.0 || ^0.11.0"
|
|
115
119
|
},
|
|
116
120
|
"peerDependenciesMeta": {
|
|
121
|
+
"@angular/cli": {
|
|
122
|
+
"optional": true
|
|
123
|
+
},
|
|
117
124
|
"@angular/elements": {
|
|
118
125
|
"optional": true
|
|
119
126
|
},
|
|
@@ -131,5 +138,5 @@
|
|
|
131
138
|
"access": "public"
|
|
132
139
|
},
|
|
133
140
|
"builders": "dist/ts3.9/builders/builders.json",
|
|
134
|
-
"gitHead": "
|
|
141
|
+
"gitHead": "43653ad69c8c10840e3f35a831ed8bd36b9c90dd"
|
|
135
142
|
}
|
package/standalone.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { CLIOptions, LoadOptions, BuilderOptions } from '@storybook/core-common';
|
|
2
|
+
import { BuilderContext } from '@angular-devkit/architect';
|
|
3
|
+
import { JsonObject } from '@angular-devkit/core';
|
|
2
4
|
|
|
3
5
|
export type StandaloneOptions = Partial<
|
|
4
6
|
CLIOptions &
|
|
@@ -6,6 +8,8 @@ export type StandaloneOptions = Partial<
|
|
|
6
8
|
BuilderOptions & {
|
|
7
9
|
mode?: 'static' | 'dev';
|
|
8
10
|
angularBrowserTarget?: string | null;
|
|
11
|
+
angularBuilderOptions?: JsonObject;
|
|
12
|
+
angularBuilderContext?: BuilderContext | null;
|
|
9
13
|
tsConfig?: string;
|
|
10
14
|
}
|
|
11
15
|
>;
|