@storybook/angular 10.1.0-alpha.1 → 10.1.0-alpha.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build-schema.json +7 -25
- package/dist/_browser-chunks/chunk-6CHBWP5J.js +711 -0
- package/dist/_browser-chunks/{chunk-CV6HSYTZ.js → chunk-T32Z4CGF.js} +13 -28
- package/dist/_node-chunks/chunk-DELQ3DUL.js +62 -0
- package/dist/_node-chunks/chunk-QT7OK2VJ.js +43 -0
- package/dist/builders/build-storybook/index.js +81 -101
- package/dist/builders/start-storybook/index.js +102 -123
- package/dist/client/config.js +84 -179
- package/dist/client/docs/config.js +15 -33
- package/dist/client/index.js +2 -2
- package/dist/index.js +2 -2
- package/dist/node/index.js +6 -10
- package/dist/preset.js +19 -29
- package/dist/server/framework-preset-angular-cli.js +84 -155
- package/dist/server/framework-preset-angular-ivy.js +16 -25
- package/package.json +5 -5
- package/start-schema.json +7 -25
- package/dist/_browser-chunks/chunk-L4GU2V72.js +0 -939
- package/dist/_node-chunks/chunk-33GAHH27.js +0 -17
- package/dist/_node-chunks/chunk-A3BCKGXK.js +0 -93
- package/dist/_node-chunks/chunk-JXFH7WTW.js +0 -58
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
|
-
__name,
|
|
3
2
|
computesTemplateFromComponent,
|
|
4
3
|
formatPropInTemplate,
|
|
5
4
|
isComponent,
|
|
6
5
|
render_exports
|
|
7
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-6CHBWP5J.js";
|
|
8
7
|
|
|
9
8
|
// src/client/portable-stories.ts
|
|
10
9
|
import {
|
|
@@ -12,19 +11,15 @@ import {
|
|
|
12
11
|
setDefaultProjectAnnotations
|
|
13
12
|
} from "storybook/preview-api";
|
|
14
13
|
function setProjectAnnotations(projectAnnotations) {
|
|
15
|
-
setDefaultProjectAnnotations(render_exports)
|
|
16
|
-
return originalSetProjectAnnotations(
|
|
14
|
+
return setDefaultProjectAnnotations(render_exports), originalSetProjectAnnotations(
|
|
17
15
|
projectAnnotations
|
|
18
16
|
);
|
|
19
17
|
}
|
|
20
|
-
__name(setProjectAnnotations, "setProjectAnnotations");
|
|
21
18
|
|
|
22
19
|
// src/client/decorators.ts
|
|
23
|
-
var moduleMetadata =
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
metadata = metadata || {};
|
|
27
|
-
return {
|
|
20
|
+
var moduleMetadata = (metadata) => (storyFn) => {
|
|
21
|
+
let story = storyFn(), storyMetadata = story.moduleMetadata || {};
|
|
22
|
+
return metadata = metadata || {}, {
|
|
28
23
|
...story,
|
|
29
24
|
moduleMetadata: {
|
|
30
25
|
declarations: [...metadata.declarations || [], ...storyMetadata.declarations || []],
|
|
@@ -37,11 +32,10 @@ var moduleMetadata = /* @__PURE__ */ __name((metadata) => (storyFn) => {
|
|
|
37
32
|
providers: [...metadata.providers || [], ...storyMetadata.providers || []]
|
|
38
33
|
}
|
|
39
34
|
};
|
|
40
|
-
}
|
|
35
|
+
};
|
|
41
36
|
function applicationConfig(config) {
|
|
42
37
|
return (storyFn) => {
|
|
43
|
-
|
|
44
|
-
const storyConfig = story.applicationConfig;
|
|
38
|
+
let story = storyFn(), storyConfig = story.applicationConfig;
|
|
45
39
|
return {
|
|
46
40
|
...story,
|
|
47
41
|
applicationConfig: storyConfig || config ? {
|
|
@@ -52,11 +46,8 @@ function applicationConfig(config) {
|
|
|
52
46
|
};
|
|
53
47
|
};
|
|
54
48
|
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
const story = storyFn();
|
|
58
|
-
const currentProps = typeof props === "function" ? props(storyContext) : props;
|
|
59
|
-
const template = isComponent(element) ? computesTemplateFromComponent(element, currentProps ?? {}, story.template) : element(story.template);
|
|
49
|
+
var componentWrapperDecorator = (element, props) => (storyFn, storyContext) => {
|
|
50
|
+
let story = storyFn(), currentProps = typeof props == "function" ? props(storyContext) : props, template = isComponent(element) ? computesTemplateFromComponent(element, currentProps ?? {}, story.template) : element(story.template);
|
|
60
51
|
return {
|
|
61
52
|
...story,
|
|
62
53
|
template,
|
|
@@ -67,21 +58,15 @@ var componentWrapperDecorator = /* @__PURE__ */ __name((element, props) => (stor
|
|
|
67
58
|
}
|
|
68
59
|
} : {}
|
|
69
60
|
};
|
|
70
|
-
}
|
|
61
|
+
};
|
|
71
62
|
|
|
72
63
|
// src/client/argsToTemplate.ts
|
|
73
64
|
function argsToTemplate(args, options = {}) {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
if (includeSet) return includeSet.has(key);
|
|
78
|
-
if (excludeSet) return !excludeSet.has(key);
|
|
79
|
-
return true;
|
|
80
|
-
}).map(
|
|
81
|
-
([key, value]) => typeof value === "function" ? `(${key})="${formatPropInTemplate(key)}($event)"` : `[${key}]="${formatPropInTemplate(key)}"`
|
|
65
|
+
let includeSet = options.include ? new Set(options.include) : null, excludeSet = options.exclude ? new Set(options.exclude) : null;
|
|
66
|
+
return Object.entries(args).filter(([key]) => args[key] !== void 0).filter(([key]) => includeSet ? includeSet.has(key) : excludeSet ? !excludeSet.has(key) : !0).map(
|
|
67
|
+
([key, value]) => typeof value == "function" ? `(${key})="${formatPropInTemplate(key)}($event)"` : `[${key}]="${formatPropInTemplate(key)}"`
|
|
82
68
|
).join(" ");
|
|
83
69
|
}
|
|
84
|
-
__name(argsToTemplate, "argsToTemplate");
|
|
85
70
|
|
|
86
71
|
export {
|
|
87
72
|
setProjectAnnotations,
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import CJS_COMPAT_NODE_URL_rc26l1fdf7f from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_rc26l1fdf7f from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_rc26l1fdf7f from "node:module";
|
|
4
|
+
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_rc26l1fdf7f.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_rc26l1fdf7f.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_rc26l1fdf7f.createRequire(import.meta.url);
|
|
8
|
+
|
|
9
|
+
// ------------------------------------------------------------
|
|
10
|
+
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
11
|
+
// ------------------------------------------------------------
|
|
12
|
+
import {
|
|
13
|
+
up
|
|
14
|
+
} from "./chunk-QT7OK2VJ.js";
|
|
15
|
+
|
|
16
|
+
// ../../node_modules/empathic/package.mjs
|
|
17
|
+
function up2(options) {
|
|
18
|
+
return up("package.json", options);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
// src/builders/utils/error-handler.ts
|
|
22
|
+
import { logger, instance as npmLog } from "storybook/internal/node-logger";
|
|
23
|
+
import { dedent } from "ts-dedent";
|
|
24
|
+
var printErrorDetails = (error) => {
|
|
25
|
+
npmLog.heading = "", error instanceof Error ? error.error ? logger.error(error.error) : error.stats && error.stats.compilation.errors ? error.stats.compilation.errors.forEach((e) => logger.plain(e)) : logger.error(error) : error.compilation?.errors && error.compilation.errors.forEach((e) => logger.plain(e)), logger.line();
|
|
26
|
+
}, errorSummary = (error) => error.close ? dedent`
|
|
27
|
+
FATAL broken build!, will close the process,
|
|
28
|
+
Fix the error below and restart storybook.
|
|
29
|
+
` : dedent`
|
|
30
|
+
Broken build, fix the error above.
|
|
31
|
+
You may need to refresh the browser.
|
|
32
|
+
`;
|
|
33
|
+
|
|
34
|
+
// src/builders/utils/run-compodoc.ts
|
|
35
|
+
import { isAbsolute, relative } from "node:path";
|
|
36
|
+
import { JsPackageManagerFactory } from "storybook/internal/common";
|
|
37
|
+
import { Observable } from "rxjs";
|
|
38
|
+
var hasTsConfigArg = (args) => args.indexOf("-p") !== -1, hasOutputArg = (args) => args.indexOf("-d") !== -1 || args.indexOf("--output") !== -1, toRelativePath = (pathToTsConfig) => isAbsolute(pathToTsConfig) ? relative(".", pathToTsConfig) : pathToTsConfig, runCompodoc = ({ compodocArgs, tsconfig }, context) => new Observable((observer) => {
|
|
39
|
+
let tsConfigPath = toRelativePath(tsconfig), finalCompodocArgs = [
|
|
40
|
+
...hasTsConfigArg(compodocArgs) ? [] : ["-p", tsConfigPath],
|
|
41
|
+
...hasOutputArg(compodocArgs) ? [] : ["-d", `${context.workspaceRoot || "."}`],
|
|
42
|
+
...compodocArgs
|
|
43
|
+
], packageManager = JsPackageManagerFactory.getPackageManager();
|
|
44
|
+
try {
|
|
45
|
+
let stdout = packageManager.runPackageCommandSync(
|
|
46
|
+
"compodoc",
|
|
47
|
+
finalCompodocArgs,
|
|
48
|
+
context.workspaceRoot,
|
|
49
|
+
"inherit"
|
|
50
|
+
);
|
|
51
|
+
context.logger.info(stdout), observer.next(), observer.complete();
|
|
52
|
+
} catch (e) {
|
|
53
|
+
context.logger.error(e), observer.error();
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
export {
|
|
58
|
+
up2 as up,
|
|
59
|
+
printErrorDetails,
|
|
60
|
+
errorSummary,
|
|
61
|
+
runCompodoc
|
|
62
|
+
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import CJS_COMPAT_NODE_URL_rc26l1fdf7f from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_rc26l1fdf7f from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_rc26l1fdf7f from "node:module";
|
|
4
|
+
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_rc26l1fdf7f.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_rc26l1fdf7f.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_rc26l1fdf7f.createRequire(import.meta.url);
|
|
8
|
+
|
|
9
|
+
// ------------------------------------------------------------
|
|
10
|
+
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
11
|
+
// ------------------------------------------------------------
|
|
12
|
+
|
|
13
|
+
// ../../node_modules/empathic/find.mjs
|
|
14
|
+
import { join as join2 } from "node:path";
|
|
15
|
+
import { existsSync, statSync } from "node:fs";
|
|
16
|
+
|
|
17
|
+
// ../../node_modules/empathic/walk.mjs
|
|
18
|
+
import { dirname } from "node:path";
|
|
19
|
+
|
|
20
|
+
// ../../node_modules/empathic/resolve.mjs
|
|
21
|
+
import { isAbsolute, join, resolve } from "node:path";
|
|
22
|
+
function absolute(input, root) {
|
|
23
|
+
return isAbsolute(input) ? input : resolve(root || ".", input);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
// ../../node_modules/empathic/walk.mjs
|
|
27
|
+
function up(base, options) {
|
|
28
|
+
let { last, cwd } = options || {}, tmp = absolute(base, cwd), root = absolute(last || "/", cwd), prev, arr = [];
|
|
29
|
+
for (; prev !== root && (arr.push(tmp), tmp = dirname(prev = tmp), tmp !== prev); )
|
|
30
|
+
;
|
|
31
|
+
return arr;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// ../../node_modules/empathic/find.mjs
|
|
35
|
+
function up2(name, options) {
|
|
36
|
+
let dir, tmp, start = options && options.cwd || "";
|
|
37
|
+
for (dir of up(start, options))
|
|
38
|
+
if (tmp = join2(dir, name), existsSync(tmp)) return tmp;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export {
|
|
42
|
+
up2 as up
|
|
43
|
+
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_rc26l1fdf7f from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_rc26l1fdf7f from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_rc26l1fdf7f from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_rc26l1fdf7f.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_rc26l1fdf7f.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_rc26l1fdf7f.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
@@ -14,13 +14,10 @@ import {
|
|
|
14
14
|
printErrorDetails,
|
|
15
15
|
runCompodoc,
|
|
16
16
|
up as up2
|
|
17
|
-
} from "../../_node-chunks/chunk-
|
|
17
|
+
} from "../../_node-chunks/chunk-DELQ3DUL.js";
|
|
18
18
|
import {
|
|
19
19
|
up
|
|
20
|
-
} from "../../_node-chunks/chunk-
|
|
21
|
-
import {
|
|
22
|
-
__name
|
|
23
|
-
} from "../../_node-chunks/chunk-33GAHH27.js";
|
|
20
|
+
} from "../../_node-chunks/chunk-QT7OK2VJ.js";
|
|
24
21
|
|
|
25
22
|
// src/builders/build-storybook/index.ts
|
|
26
23
|
import { readFileSync } from "node:fs";
|
|
@@ -32,99 +29,83 @@ import { from, of, throwError } from "rxjs";
|
|
|
32
29
|
import { catchError, map, mapTo, switchMap } from "rxjs/operators";
|
|
33
30
|
import { VERSION } from "@angular/core";
|
|
34
31
|
addToGlobalContext("cliVersion", versions.storybook);
|
|
35
|
-
var commandBuilder =
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
return standaloneOptions;
|
|
104
|
-
}),
|
|
105
|
-
switchMap((standaloneOptions) => runInstance({ ...standaloneOptions, mode: "static" })),
|
|
106
|
-
map(() => {
|
|
107
|
-
return { success: true };
|
|
108
|
-
})
|
|
109
|
-
);
|
|
110
|
-
return builder;
|
|
111
|
-
}, "commandBuilder");
|
|
112
|
-
var build_storybook_default = createBuilder(commandBuilder);
|
|
32
|
+
var commandBuilder = (options, context) => from(setup(options, context)).pipe(
|
|
33
|
+
switchMap(({ tsConfig }) => {
|
|
34
|
+
let docTSConfig = up("tsconfig.doc.json", {
|
|
35
|
+
cwd: options.configDir,
|
|
36
|
+
last: getProjectRoot()
|
|
37
|
+
});
|
|
38
|
+
return (options.compodoc ? runCompodoc(
|
|
39
|
+
{ compodocArgs: options.compodocArgs, tsconfig: docTSConfig ?? tsConfig },
|
|
40
|
+
context
|
|
41
|
+
).pipe(mapTo({ tsConfig })) : of({})).pipe(mapTo({ tsConfig }));
|
|
42
|
+
}),
|
|
43
|
+
map(({ tsConfig }) => {
|
|
44
|
+
getEnvConfig(options, {
|
|
45
|
+
staticDir: "SBCONFIG_STATIC_DIR",
|
|
46
|
+
outputDir: "SBCONFIG_OUTPUT_DIR",
|
|
47
|
+
configDir: "SBCONFIG_CONFIG_DIR"
|
|
48
|
+
});
|
|
49
|
+
let {
|
|
50
|
+
browserTarget,
|
|
51
|
+
stylePreprocessorOptions,
|
|
52
|
+
styles,
|
|
53
|
+
configDir,
|
|
54
|
+
docs,
|
|
55
|
+
loglevel,
|
|
56
|
+
test,
|
|
57
|
+
outputDir,
|
|
58
|
+
quiet,
|
|
59
|
+
enableProdMode = !0,
|
|
60
|
+
webpackStatsJson,
|
|
61
|
+
statsJson,
|
|
62
|
+
debugWebpack,
|
|
63
|
+
disableTelemetry,
|
|
64
|
+
assets,
|
|
65
|
+
previewUrl,
|
|
66
|
+
sourceMap = !1,
|
|
67
|
+
preserveSymlinks = !1,
|
|
68
|
+
experimentalZoneless = !!(VERSION.major && Number(VERSION.major) >= 21)
|
|
69
|
+
} = options, packageJsonPath = up2({ cwd: __dirname });
|
|
70
|
+
return {
|
|
71
|
+
packageJson: packageJsonPath != null ? JSON.parse(readFileSync(packageJsonPath, "utf8")) : null,
|
|
72
|
+
configDir,
|
|
73
|
+
...docs ? { docs } : {},
|
|
74
|
+
loglevel,
|
|
75
|
+
outputDir,
|
|
76
|
+
test,
|
|
77
|
+
quiet,
|
|
78
|
+
enableProdMode,
|
|
79
|
+
disableTelemetry,
|
|
80
|
+
angularBrowserTarget: browserTarget,
|
|
81
|
+
angularBuilderContext: context,
|
|
82
|
+
angularBuilderOptions: {
|
|
83
|
+
...stylePreprocessorOptions ? { stylePreprocessorOptions } : {},
|
|
84
|
+
...styles ? { styles } : {},
|
|
85
|
+
...assets ? { assets } : {},
|
|
86
|
+
sourceMap,
|
|
87
|
+
preserveSymlinks,
|
|
88
|
+
experimentalZoneless
|
|
89
|
+
},
|
|
90
|
+
tsConfig,
|
|
91
|
+
webpackStatsJson,
|
|
92
|
+
statsJson,
|
|
93
|
+
debugWebpack,
|
|
94
|
+
previewUrl
|
|
95
|
+
};
|
|
96
|
+
}),
|
|
97
|
+
switchMap((standaloneOptions) => runInstance({ ...standaloneOptions, mode: "static" })),
|
|
98
|
+
map(() => ({ success: !0 }))
|
|
99
|
+
), build_storybook_default = createBuilder(commandBuilder);
|
|
113
100
|
async function setup(options, context) {
|
|
114
|
-
let browserOptions;
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
await context.getTargetOptions(browserTarget),
|
|
120
|
-
await context.getBuilderNameForTarget(browserTarget)
|
|
121
|
-
);
|
|
122
|
-
}
|
|
123
|
-
return {
|
|
101
|
+
let browserOptions, browserTarget;
|
|
102
|
+
return options.browserTarget && (browserTarget = targetFromTargetString(options.browserTarget), browserOptions = await context.validateOptions(
|
|
103
|
+
await context.getTargetOptions(browserTarget),
|
|
104
|
+
await context.getBuilderNameForTarget(browserTarget)
|
|
105
|
+
)), {
|
|
124
106
|
tsConfig: options.tsConfig ?? up("tsconfig.json", { cwd: options.configDir, last: getProjectRoot() }) ?? browserOptions.tsConfig
|
|
125
107
|
};
|
|
126
108
|
}
|
|
127
|
-
__name(setup, "setup");
|
|
128
109
|
function runInstance(options) {
|
|
129
110
|
return from(
|
|
130
111
|
withTelemetry(
|
|
@@ -138,7 +119,6 @@ function runInstance(options) {
|
|
|
138
119
|
)
|
|
139
120
|
).pipe(catchError((error) => throwError(errorSummary(error))));
|
|
140
121
|
}
|
|
141
|
-
__name(runInstance, "runInstance");
|
|
142
122
|
export {
|
|
143
123
|
build_storybook_default as default
|
|
144
124
|
};
|