@storybook/angular-vite 11.0.0-alpha.0 → 11.0.0-alpha.2
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 +0 -4
- package/dist/_browser-chunks/{chunk-UJ3I56EP.js → chunk-BFQMI74D.js} +51 -44
- package/dist/_browser-chunks/{chunk-VP3W5GY3.js → chunk-K4OVBYYR.js} +1 -1
- package/dist/_browser-chunks/{chunk-THQDNKQS.js → chunk-ONLO5U66.js} +4 -4
- package/dist/_browser-chunks/{chunk-AL7GEPYM.js → chunk-TN7UZNXT.js} +1 -1
- package/dist/_node-chunks/{chunk-BTSLSRCA.js → chunk-EOBWXGRJ.js} +6 -6
- package/dist/_node-chunks/{chunk-B6TT4IAU.js → chunk-IISTVQWO.js} +6 -6
- package/dist/_node-chunks/{chunk-42UD2U5X.js → chunk-KE55VWWH.js} +22 -7
- package/dist/_node-chunks/{story-docs-template-analysis-HRE7RPUZ.js → story-docs-template-analysis-FVKKDKOD.js} +6 -6
- package/dist/builders/build-storybook/index.js +33 -29
- package/dist/builders/start-storybook/index.js +41 -31
- package/dist/client/config.js +2 -2
- package/dist/client/docs/config.js +2 -2
- package/dist/client/index.js +4 -4
- package/dist/docgen/docgen-worker.js +161 -81
- package/dist/index.d.ts +20 -859
- package/dist/index.js +4 -4
- package/dist/node/index.js +6 -6
- package/dist/node/vitest.js +6 -6
- package/dist/preset.js +20 -20
- package/package.json +7 -9
- package/start-schema.json +0 -4
- package/template/cli/header.component.ts +4 -1
- package/template/cli/page.component.ts +5 -3
package/build-schema.json
CHANGED
|
@@ -76,10 +76,6 @@
|
|
|
76
76
|
"description": "Write stats JSON to disk",
|
|
77
77
|
"default": false
|
|
78
78
|
},
|
|
79
|
-
"previewUrl": {
|
|
80
|
-
"type": "string",
|
|
81
|
-
"description": "Disables the default storybook preview and lets you use your own"
|
|
82
|
-
},
|
|
83
79
|
"styles": {
|
|
84
80
|
"type": "array",
|
|
85
81
|
"description": "Global styles to be included in the build.",
|
|
@@ -105,7 +105,7 @@ var reflectionCapabilities = new ReflectionCapabilities(), getComponentInputsOut
|
|
|
105
105
|
componentMetadata && componentMetadata.inputs && initialValue.inputs.push(
|
|
106
106
|
...componentMetadata.inputs.map((i) => ({
|
|
107
107
|
propName: typeof i == "string" ? i : i.name,
|
|
108
|
-
templateName: typeof i == "string" ? i : i.alias
|
|
108
|
+
templateName: typeof i == "string" ? i : i.alias ?? i.name
|
|
109
109
|
}))
|
|
110
110
|
), componentMetadata && componentMetadata.outputs && initialValue.outputs.push(
|
|
111
111
|
...componentMetadata.outputs.map((i) => ({ propName: i, templateName: i }))
|
|
@@ -170,6 +170,8 @@ var separateInputsOutputsAttributes = (ngComponentInputsOutputs, props = {}) =>
|
|
|
170
170
|
outputs: ngComponentInputsOutputs.outputs.filter((o) => o.templateName in props).map((o) => o.templateName)
|
|
171
171
|
}), computesTemplateFromComponent = (component, initialProps, innerTemplate = "") => {
|
|
172
172
|
let ngComponentMetadata = getComponentDecoratorMetadata(component), ngComponentInputsOutputs = getComponentInputsOutputs(component);
|
|
173
|
+
if (!ngComponentMetadata)
|
|
174
|
+
throw new Error(`${component.name} is not an Angular component`);
|
|
173
175
|
if (!ngComponentMetadata.selector)
|
|
174
176
|
return '<ng-container *ngComponentOutlet="storyComponent"></ng-container>';
|
|
175
177
|
let { inputs, outputs } = separateInputsOutputsAttributes(
|
|
@@ -248,12 +250,6 @@ import {
|
|
|
248
250
|
\u0275ReflectionCapabilities as ReflectionCapabilities3
|
|
249
251
|
} from "@angular/core";
|
|
250
252
|
import { BrowserModule } from "@angular/platform-browser";
|
|
251
|
-
import {
|
|
252
|
-
BrowserAnimationsModule,
|
|
253
|
-
NoopAnimationsModule,
|
|
254
|
-
provideAnimations,
|
|
255
|
-
provideNoopAnimations
|
|
256
|
-
} from "@angular/platform-browser/animations";
|
|
257
253
|
import { dedent } from "ts-dedent";
|
|
258
254
|
|
|
259
255
|
// src/client/renderer/utils/NgModulesAnalyzer.ts
|
|
@@ -281,6 +277,9 @@ var reflectionCapabilities3 = new ReflectionCapabilities3(), REMOVED_MODULES = n
|
|
|
281
277
|
this.metadata = metadata;
|
|
282
278
|
this.component = component;
|
|
283
279
|
this.declarations = [];
|
|
280
|
+
this.imports = [];
|
|
281
|
+
this.providers = [];
|
|
282
|
+
this.applicationProviders = [];
|
|
284
283
|
/**
|
|
285
284
|
* Analyze NgModule Metadata
|
|
286
285
|
*
|
|
@@ -326,25 +325,27 @@ var reflectionCapabilities3 = new ReflectionCapabilities3(), REMOVED_MODULES = n
|
|
|
326
325
|
}
|
|
327
326
|
}
|
|
328
327
|
};
|
|
329
|
-
_PropertyExtractor.analyzeRestricted = (ngModule) =>
|
|
330
|
-
|
|
328
|
+
_PropertyExtractor.analyzeRestricted = (ngModule) => {
|
|
329
|
+
if (ngModule === BrowserModule)
|
|
330
|
+
return console.warn(
|
|
331
|
+
dedent`
|
|
331
332
|
Storybook Warning:
|
|
332
333
|
"BrowserModule" is not needed when using bootstrapApplication — its providers are included automatically.
|
|
333
334
|
Please remove "BrowserModule" from moduleMetadata.imports to remove this warning.
|
|
334
335
|
`
|
|
335
|
-
), [!0]
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
Use the 'applicationConfig' decorator from '@storybook/angular-vite' and add 'provideAnimations()' to its providers instead.
|
|
340
|
-
`
|
|
341
|
-
), [!0, provideAnimations()]) : ngModule === NoopAnimationsModule ? (console.warn(
|
|
342
|
-
dedent`
|
|
336
|
+
), [!0];
|
|
337
|
+
let ngModuleName = ngModule?.name;
|
|
338
|
+
return ngModuleName === "BrowserAnimationsModule" || ngModuleName === "NoopAnimationsModule" ? (console.warn(
|
|
339
|
+
dedent`
|
|
343
340
|
Storybook Warning:
|
|
344
|
-
"
|
|
345
|
-
|
|
341
|
+
"${ngModuleName}" was found and removed from moduleMetadata.imports, but @storybook/angular-vite no longer registers its providers automatically.
|
|
342
|
+
This module is part of Angular's legacy animations API, which is deprecated since Angular 20.2 and intended for removal in v23.
|
|
343
|
+
To migrate:
|
|
344
|
+
- Preferred: Use native CSS transitions or the 'animate.enter'/'animate.leave' bindings (Angular 20.2+).
|
|
345
|
+
- Or: Keep using the legacy animations API yourself by adding '${ngModuleName === "BrowserAnimationsModule" ? "provideAnimations" : "provideNoopAnimations"}()' to the 'providers' array of the 'applicationConfig' decorator from '@storybook/angular-vite'.
|
|
346
346
|
`
|
|
347
|
-
), [!0
|
|
347
|
+
), [!0]) : [!1];
|
|
348
|
+
}, _PropertyExtractor.analyzeDecorators = (component) => {
|
|
348
349
|
let decorators = reflectionCapabilities3.annotations(component), isComponent2 = decorators.some((d) => _PropertyExtractor.isDecoratorInstanceOf(d, "Component")), isDirective = decorators.some((d) => _PropertyExtractor.isDecoratorInstanceOf(d, "Directive")), isPipe = decorators.some((d) => _PropertyExtractor.isDecoratorInstanceOf(d, "Pipe")), isDeclarable = isComponent2 || isDirective || isPipe, isStandalone = (isComponent2 || isDirective) && [...decorators].reverse().find(
|
|
349
350
|
(d) => _PropertyExtractor.isDecoratorInstanceOf(d, "Component") || _PropertyExtractor.isDecoratorInstanceOf(d, "Directive")
|
|
350
351
|
)?.standalone;
|
|
@@ -387,7 +388,7 @@ var getNonInputsOutputsProps = (ngComponentInputsOutputs, props = {}) => {
|
|
|
387
388
|
storyComponent,
|
|
388
389
|
styles,
|
|
389
390
|
moduleMetadata,
|
|
390
|
-
initialProps,
|
|
391
|
+
initialProps = {},
|
|
391
392
|
analyzedMetadata
|
|
392
393
|
}) => {
|
|
393
394
|
let viewChildSelector = storyComponent ?? "__storybook-noop", { imports, declarations, providers } = analyzedMetadata, StorybookComponentModule = class {
|
|
@@ -412,15 +413,16 @@ var getNonInputsOutputsProps = (ngComponentInputsOutputs, props = {}) => {
|
|
|
412
413
|
});
|
|
413
414
|
}
|
|
414
415
|
ngAfterViewInit() {
|
|
415
|
-
|
|
416
|
+
let { storyComponentElementRef, storyComponentViewContainerRef } = this;
|
|
417
|
+
if (storyComponentElementRef && storyComponentViewContainerRef) {
|
|
416
418
|
let ngComponentInputsOutputs = getComponentInputsOutputs(storyComponent);
|
|
417
419
|
getNonInputsOutputsProps(ngComponentInputsOutputs, initialProps).forEach((p) => {
|
|
418
|
-
|
|
419
|
-
}),
|
|
420
|
+
Object.assign(storyComponentElementRef, { [p]: initialProps[p] });
|
|
421
|
+
}), storyComponentViewContainerRef.injector.get(ChangeDetectorRef).markForCheck(), this.changeDetectorRef.detectChanges(), this.storyComponentPropsSubscription = this.storyProps$.pipe(
|
|
420
422
|
skip(1),
|
|
421
|
-
map((props) => getNonInputsOutputsProps(ngComponentInputsOutputs, props).reduce((acc, p) => ({ ...acc, [p]: props[p] }), {}))
|
|
423
|
+
map((props = {}) => getNonInputsOutputsProps(ngComponentInputsOutputs, props).reduce((acc, p) => ({ ...acc, [p]: props[p] }), {}))
|
|
422
424
|
).subscribe((props) => {
|
|
423
|
-
Object.assign(
|
|
425
|
+
Object.assign(storyComponentElementRef, props), storyComponentViewContainerRef.injector.get(ChangeDetectorRef).markForCheck(), this.changeDetectorRef.detectChanges();
|
|
424
426
|
});
|
|
425
427
|
}
|
|
426
428
|
}
|
|
@@ -517,15 +519,15 @@ var applicationRefs = /* @__PURE__ */ new Map(), STORY_UID_ATTRIBUTE = "data-sb-
|
|
|
517
519
|
component,
|
|
518
520
|
targetDOMNode
|
|
519
521
|
}) {
|
|
520
|
-
let targetSelector = this.generateTargetSelectorFromStoryId(storyId), newStoryProps$ = new BehaviorSubject(storyFnAngular.props)
|
|
521
|
-
if (!this.fullRendererRequired({
|
|
522
|
+
let targetSelector = this.generateTargetSelectorFromStoryId(storyId), newStoryProps$ = new BehaviorSubject(storyFnAngular.props), fullRendererRequired = this.fullRendererRequired({
|
|
522
523
|
targetDOMNode,
|
|
523
524
|
storyFnAngular,
|
|
524
525
|
moduleMetadata: {
|
|
525
526
|
...storyFnAngular.moduleMetadata
|
|
526
527
|
},
|
|
527
528
|
forced
|
|
528
|
-
})
|
|
529
|
+
});
|
|
530
|
+
if (this.storyProps$ && !fullRendererRequired) {
|
|
529
531
|
this.storyProps$.next(storyFnAngular.props);
|
|
530
532
|
return;
|
|
531
533
|
}
|
|
@@ -535,7 +537,12 @@ var applicationRefs = /* @__PURE__ */ new Map(), STORY_UID_ATTRIBUTE = "data-sb-
|
|
|
535
537
|
let storyUid = this.generateStoryUIdFromRawStoryUid(
|
|
536
538
|
targetDOMNode.getAttribute(STORY_UID_ATTRIBUTE)
|
|
537
539
|
), componentSelector = storyUid !== null ? `${targetSelector}[${storyUid}]` : targetSelector;
|
|
538
|
-
storyUid !== null
|
|
540
|
+
if (storyUid !== null) {
|
|
541
|
+
let element = targetDOMNode.querySelector(targetSelector);
|
|
542
|
+
if (!element)
|
|
543
|
+
throw new Error(`Storybook could not find the story root element "${targetSelector}"`);
|
|
544
|
+
element.toggleAttribute(storyUid, !0);
|
|
545
|
+
}
|
|
539
546
|
let application = getApplication({
|
|
540
547
|
storyFnAngular,
|
|
541
548
|
component,
|
|
@@ -605,9 +612,7 @@ var applicationRefs = /* @__PURE__ */ new Map(), STORY_UID_ATTRIBUTE = "data-sb-
|
|
|
605
612
|
storyFnAngular,
|
|
606
613
|
moduleMetadataSnapshot: stringify(moduleMetadata, { maxDepth: 50 })
|
|
607
614
|
};
|
|
608
|
-
return this.previousStoryRenderInfo.set(targetDOMNode, currentStoryRender),
|
|
609
|
-
!forced || // if it's the first rendering and storyProps$ is not init
|
|
610
|
-
!this.storyProps$ || !!storyFnAngular?.template && previousStoryRenderInfo?.storyFnAngular?.template !== storyFnAngular.template ? !0 : currentStoryRender.moduleMetadataSnapshot !== previousStoryRenderInfo?.moduleMetadataSnapshot;
|
|
615
|
+
return this.previousStoryRenderInfo.set(targetDOMNode, currentStoryRender), !forced || !!storyFnAngular?.template && previousStoryRenderInfo?.storyFnAngular?.template !== storyFnAngular.template ? !0 : currentStoryRender.moduleMetadataSnapshot !== previousStoryRenderInfo?.moduleMetadataSnapshot;
|
|
611
616
|
}
|
|
612
617
|
};
|
|
613
618
|
|
|
@@ -627,8 +632,7 @@ import { addons } from "storybook/preview-api";
|
|
|
627
632
|
|
|
628
633
|
// src/client/renderer/utils/StoryUID.ts
|
|
629
634
|
var storyCounts = /* @__PURE__ */ new Map(), getNextStoryUID = (storyId) => {
|
|
630
|
-
storyCounts.
|
|
631
|
-
let count = storyCounts.get(storyId) + 1;
|
|
635
|
+
let count = (storyCounts.get(storyId) ?? -1) + 1;
|
|
632
636
|
return storyCounts.set(storyId, count), `${storyId}-${count}`;
|
|
633
637
|
};
|
|
634
638
|
|
|
@@ -656,11 +660,10 @@ var RendererFactory = class {
|
|
|
656
660
|
this.rendererMap = /* @__PURE__ */ new Map();
|
|
657
661
|
}
|
|
658
662
|
async getRendererInstance(targetDOMNode) {
|
|
659
|
-
let targetId = targetDOMNode.id;
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
return this.lastRenderType && this.lastRenderType !== renderType && (await AbstractRenderer.resetApplications(), clearRootHTMLElement(renderType), this.rendererMap.clear()), this.rendererMap.has(targetId) || this.rendererMap.set(targetId, this.buildRenderer(renderType)), this.lastRenderType = renderType, this.rendererMap.get(targetId);
|
|
663
|
+
let targetId = targetDOMNode.id, renderType = getRenderType(targetDOMNode);
|
|
664
|
+
this.lastRenderType && this.lastRenderType !== renderType && (await AbstractRenderer.resetApplications(), clearRootHTMLElement(renderType), this.rendererMap.clear());
|
|
665
|
+
let renderer = this.rendererMap.get(targetId);
|
|
666
|
+
return renderer || (renderer = this.buildRenderer(renderType), this.rendererMap.set(targetId, renderer)), this.lastRenderType = renderType, renderer;
|
|
664
667
|
}
|
|
665
668
|
buildRenderer(renderType) {
|
|
666
669
|
return renderType === "docs" ? new DocsRenderer() : new CanvasRenderer();
|
|
@@ -673,12 +676,16 @@ var RendererFactory = class {
|
|
|
673
676
|
};
|
|
674
677
|
function clearRootHTMLElement(renderType) {
|
|
675
678
|
switch (renderType) {
|
|
676
|
-
case "canvas":
|
|
677
|
-
global.document.getElementById("storybook-docs")
|
|
679
|
+
case "canvas": {
|
|
680
|
+
let docsRoot = global.document.getElementById("storybook-docs");
|
|
681
|
+
docsRoot && (docsRoot.innerHTML = "");
|
|
678
682
|
break;
|
|
679
|
-
|
|
680
|
-
|
|
683
|
+
}
|
|
684
|
+
case "docs": {
|
|
685
|
+
let canvasRoot = global.document.getElementById("storybook-root");
|
|
686
|
+
canvasRoot && (canvasRoot.innerHTML = "");
|
|
681
687
|
break;
|
|
688
|
+
}
|
|
682
689
|
default:
|
|
683
690
|
break;
|
|
684
691
|
}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
config_exports
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-TN7UZNXT.js";
|
|
4
4
|
import {
|
|
5
5
|
config_exports as config_exports2
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-K4OVBYYR.js";
|
|
7
7
|
import {
|
|
8
8
|
computesTemplateFromComponent,
|
|
9
9
|
formatPropInTemplate,
|
|
10
10
|
isComponent,
|
|
11
11
|
render_exports
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-BFQMI74D.js";
|
|
13
13
|
|
|
14
14
|
// src/client/portable-stories.ts
|
|
15
15
|
import {
|
|
@@ -62,7 +62,7 @@ function applicationConfig(config) {
|
|
|
62
62
|
};
|
|
63
63
|
}
|
|
64
64
|
var componentWrapperDecorator = (element, props) => (storyFn, storyContext) => {
|
|
65
|
-
let story = storyFn(), currentProps = typeof props == "function" ? props(storyContext) : props, template = isComponent(element) ? computesTemplateFromComponent(element, currentProps ?? {}, story.template) : element(story.template);
|
|
65
|
+
let story = storyFn(), currentProps = typeof props == "function" ? props(storyContext) : props, template = isComponent(element) ? computesTemplateFromComponent(element, currentProps ?? {}, story.template) : element(story.template ?? "");
|
|
66
66
|
return {
|
|
67
67
|
...story,
|
|
68
68
|
template,
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_ayxk7ta37hg from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_ayxk7ta37hg from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_ayxk7ta37hg from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_ayxk7ta37hg.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_ayxk7ta37hg.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_ayxk7ta37hg.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_ayxk7ta37hg from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_ayxk7ta37hg from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_ayxk7ta37hg from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_ayxk7ta37hg.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_ayxk7ta37hg.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_ayxk7ta37hg.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
@@ -1,23 +1,36 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_ayxk7ta37hg from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_ayxk7ta37hg from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_ayxk7ta37hg from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_ayxk7ta37hg.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_ayxk7ta37hg.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_ayxk7ta37hg.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
11
11
|
// ------------------------------------------------------------
|
|
12
12
|
import {
|
|
13
13
|
up
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-IISTVQWO.js";
|
|
15
15
|
|
|
16
16
|
// ../../../node_modules/empathic/package.mjs
|
|
17
17
|
function up2(options) {
|
|
18
18
|
return up("package.json", options);
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
+
// src/builders/utils/browser-target-options.ts
|
|
22
|
+
import { deepMerge } from "storybook/internal/common";
|
|
23
|
+
function mergeBrowserTargetOptions(own, browserOptions) {
|
|
24
|
+
return browserOptions ? deepMerge(browserOptions, own) : own;
|
|
25
|
+
}
|
|
26
|
+
function requireBuilderTarget(context) {
|
|
27
|
+
if (!context.target)
|
|
28
|
+
throw new Error(
|
|
29
|
+
"The Storybook builder must run as an Angular target to read the options it declares."
|
|
30
|
+
);
|
|
31
|
+
return context.target;
|
|
32
|
+
}
|
|
33
|
+
|
|
21
34
|
// src/builders/utils/error-handler.ts
|
|
22
35
|
import { logger, instance as npmLog } from "storybook/internal/node-logger";
|
|
23
36
|
import { dedent } from "ts-dedent";
|
|
@@ -33,6 +46,8 @@ var printErrorDetails = (error) => {
|
|
|
33
46
|
|
|
34
47
|
export {
|
|
35
48
|
up2 as up,
|
|
49
|
+
mergeBrowserTargetOptions,
|
|
50
|
+
requireBuilderTarget,
|
|
36
51
|
printErrorDetails,
|
|
37
52
|
errorSummary
|
|
38
53
|
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_ayxk7ta37hg from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_ayxk7ta37hg from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_ayxk7ta37hg from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_ayxk7ta37hg.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_ayxk7ta37hg.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_ayxk7ta37hg.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
@@ -1,22 +1,24 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_ayxk7ta37hg from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_ayxk7ta37hg from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_ayxk7ta37hg from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_ayxk7ta37hg.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_ayxk7ta37hg.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_ayxk7ta37hg.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
11
11
|
// ------------------------------------------------------------
|
|
12
12
|
import {
|
|
13
13
|
errorSummary,
|
|
14
|
+
mergeBrowserTargetOptions,
|
|
14
15
|
printErrorDetails,
|
|
16
|
+
requireBuilderTarget,
|
|
15
17
|
up
|
|
16
|
-
} from "../../_node-chunks/chunk-
|
|
18
|
+
} from "../../_node-chunks/chunk-KE55VWWH.js";
|
|
17
19
|
import {
|
|
18
20
|
resolveTsconfig
|
|
19
|
-
} from "../../_node-chunks/chunk-
|
|
21
|
+
} from "../../_node-chunks/chunk-IISTVQWO.js";
|
|
20
22
|
|
|
21
23
|
// src/builders/build-storybook/index.ts
|
|
22
24
|
import { readFileSync } from "node:fs";
|
|
@@ -29,16 +31,15 @@ import { Channel } from "storybook/internal/channels";
|
|
|
29
31
|
addToGlobalContext("cliVersion", versions.storybook);
|
|
30
32
|
var commandBuilder = async (options, context) => {
|
|
31
33
|
options.loglevel && logger.setLogLevel(options.loglevel), options.logfile && logTracker.enableLogWriting(), logger.intro("Building Storybook");
|
|
32
|
-
let { tsConfig } = await setup(options, context);
|
|
33
|
-
|
|
34
|
+
let { tsConfig, browserOptions, browserTarget: resolvedTarget } = await setup(options, context);
|
|
35
|
+
resolvedTarget && logger.info(
|
|
36
|
+
`Using angular browser target options from "${resolvedTarget.project}:${resolvedTarget.target}${resolvedTarget.configuration ? `:${resolvedTarget.configuration}` : ""}"`
|
|
37
|
+
), getEnvConfig(options, {
|
|
34
38
|
staticDir: "SBCONFIG_STATIC_DIR",
|
|
35
39
|
outputDir: "SBCONFIG_OUTPUT_DIR",
|
|
36
40
|
configDir: "SBCONFIG_CONFIG_DIR"
|
|
37
41
|
});
|
|
38
42
|
let {
|
|
39
|
-
browserTarget,
|
|
40
|
-
stylePreprocessorOptions,
|
|
41
|
-
styles,
|
|
42
43
|
configDir,
|
|
43
44
|
docs,
|
|
44
45
|
loglevel,
|
|
@@ -48,13 +49,21 @@ var commandBuilder = async (options, context) => {
|
|
|
48
49
|
enableProdMode = !0,
|
|
49
50
|
statsJson,
|
|
50
51
|
disableTelemetry,
|
|
51
|
-
assets,
|
|
52
|
-
previewUrl,
|
|
53
52
|
sourceMap = !1,
|
|
54
53
|
preserveSymlinks = !1,
|
|
55
54
|
zoneless = !0
|
|
56
|
-
} = options, packageJsonPath = up({ cwd: __dirname }),
|
|
57
|
-
|
|
55
|
+
} = options, packageJsonPath = up({ cwd: __dirname }), packageJson = packageJsonPath != null ? JSON.parse(readFileSync(packageJsonPath, "utf8")) : null, declaredOptions = resolvedTarget ? await context.getTargetOptions(requireBuilderTarget(context)) : options, angularBuilderOptions = mergeBrowserTargetOptions(
|
|
56
|
+
{
|
|
57
|
+
stylePreprocessorOptions: declaredOptions.stylePreprocessorOptions,
|
|
58
|
+
styles: declaredOptions.styles,
|
|
59
|
+
assets: declaredOptions.assets,
|
|
60
|
+
sourceMap,
|
|
61
|
+
preserveSymlinks,
|
|
62
|
+
zoneless
|
|
63
|
+
},
|
|
64
|
+
browserOptions
|
|
65
|
+
), standaloneOptions = {
|
|
66
|
+
packageJson,
|
|
58
67
|
configDir,
|
|
59
68
|
...docs ? { docs } : {},
|
|
60
69
|
loglevel,
|
|
@@ -63,19 +72,11 @@ var commandBuilder = async (options, context) => {
|
|
|
63
72
|
quiet,
|
|
64
73
|
enableProdMode,
|
|
65
74
|
disableTelemetry,
|
|
66
|
-
angularBrowserTarget: browserTarget,
|
|
75
|
+
angularBrowserTarget: options.browserTarget ?? null,
|
|
67
76
|
angularBuilderContext: context,
|
|
68
|
-
angularBuilderOptions
|
|
69
|
-
...stylePreprocessorOptions ? { stylePreprocessorOptions } : {},
|
|
70
|
-
...styles ? { styles } : {},
|
|
71
|
-
...assets ? { assets } : {},
|
|
72
|
-
sourceMap,
|
|
73
|
-
preserveSymlinks,
|
|
74
|
-
zoneless
|
|
75
|
-
},
|
|
77
|
+
angularBuilderOptions,
|
|
76
78
|
tsConfig,
|
|
77
|
-
statsJson
|
|
78
|
-
previewUrl
|
|
79
|
+
statsJson
|
|
79
80
|
};
|
|
80
81
|
if (process.env.STORYBOOK_ANGULAR_BUILDER_OPTIONS_JSON = JSON.stringify(
|
|
81
82
|
standaloneOptions.angularBuilderOptions
|
|
@@ -96,7 +97,9 @@ async function setup(options, context) {
|
|
|
96
97
|
configDir: options.configDir,
|
|
97
98
|
tsConfig: options.tsConfig,
|
|
98
99
|
browserTsConfig: browserOptions?.tsConfig
|
|
99
|
-
})
|
|
100
|
+
}),
|
|
101
|
+
browserOptions,
|
|
102
|
+
browserTarget
|
|
100
103
|
};
|
|
101
104
|
}
|
|
102
105
|
async function runInstance(options) {
|
|
@@ -121,5 +124,6 @@ async function runInstance(options) {
|
|
|
121
124
|
}
|
|
122
125
|
}
|
|
123
126
|
export {
|
|
127
|
+
commandBuilder,
|
|
124
128
|
build_storybook_default as default
|
|
125
129
|
};
|
|
@@ -1,22 +1,24 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_ayxk7ta37hg from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_ayxk7ta37hg from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_ayxk7ta37hg from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_ayxk7ta37hg.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_ayxk7ta37hg.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_ayxk7ta37hg.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
11
11
|
// ------------------------------------------------------------
|
|
12
12
|
import {
|
|
13
13
|
errorSummary,
|
|
14
|
+
mergeBrowserTargetOptions,
|
|
14
15
|
printErrorDetails,
|
|
16
|
+
requireBuilderTarget,
|
|
15
17
|
up
|
|
16
|
-
} from "../../_node-chunks/chunk-
|
|
18
|
+
} from "../../_node-chunks/chunk-KE55VWWH.js";
|
|
17
19
|
import {
|
|
18
20
|
resolveTsconfig
|
|
19
|
-
} from "../../_node-chunks/chunk-
|
|
21
|
+
} from "../../_node-chunks/chunk-IISTVQWO.js";
|
|
20
22
|
|
|
21
23
|
// src/builders/start-storybook/index.ts
|
|
22
24
|
import { readFileSync } from "node:fs";
|
|
@@ -32,8 +34,14 @@ var commandBuilder = (options, context) => new Observable((observer) => {
|
|
|
32
34
|
(async () => {
|
|
33
35
|
try {
|
|
34
36
|
options.loglevel && logger.setLogLevel(options.loglevel), options.logfile && logTracker.enableLogWriting(), logger.intro("Starting Storybook");
|
|
35
|
-
let {
|
|
36
|
-
|
|
37
|
+
let {
|
|
38
|
+
tsConfig,
|
|
39
|
+
browserOptions,
|
|
40
|
+
browserTarget: resolvedTarget
|
|
41
|
+
} = await setup(options, context);
|
|
42
|
+
resolvedTarget && logger.info(
|
|
43
|
+
`Using angular browser target options from "${resolvedTarget.project}:${resolvedTarget.target}${resolvedTarget.configuration ? `:${resolvedTarget.configuration}` : ""}"`
|
|
44
|
+
), getEnvConfig(options, {
|
|
37
45
|
port: "SBCONFIG_PORT",
|
|
38
46
|
host: "SBCONFIG_HOSTNAME",
|
|
39
47
|
staticDir: "SBCONFIG_STATIC_DIR",
|
|
@@ -41,9 +49,6 @@ var commandBuilder = (options, context) => new Observable((observer) => {
|
|
|
41
49
|
ci: "CI"
|
|
42
50
|
}), options.port = parseInt(`${options.port}`, 10);
|
|
43
51
|
let {
|
|
44
|
-
browserTarget,
|
|
45
|
-
stylePreprocessorOptions,
|
|
46
|
-
styles,
|
|
47
52
|
ci,
|
|
48
53
|
configDir,
|
|
49
54
|
docs,
|
|
@@ -57,17 +62,25 @@ var commandBuilder = (options, context) => new Observable((observer) => {
|
|
|
57
62
|
sslCert,
|
|
58
63
|
sslKey,
|
|
59
64
|
disableTelemetry,
|
|
60
|
-
assets,
|
|
61
65
|
initialPath,
|
|
62
66
|
open,
|
|
63
67
|
loglevel,
|
|
64
68
|
statsJson,
|
|
65
|
-
previewUrl,
|
|
66
69
|
sourceMap = !1,
|
|
67
70
|
preserveSymlinks = !1,
|
|
68
71
|
zoneless = !0
|
|
69
|
-
} = options, packageJsonPath = up({ cwd: __dirname }),
|
|
70
|
-
|
|
72
|
+
} = options, packageJsonPath = up({ cwd: __dirname }), packageJson = packageJsonPath != null ? JSON.parse(readFileSync(packageJsonPath, "utf8")) : null, declaredOptions = resolvedTarget ? await context.getTargetOptions(requireBuilderTarget(context)) : options, angularBuilderOptions = mergeBrowserTargetOptions(
|
|
73
|
+
{
|
|
74
|
+
stylePreprocessorOptions: declaredOptions.stylePreprocessorOptions,
|
|
75
|
+
styles: declaredOptions.styles,
|
|
76
|
+
assets: declaredOptions.assets,
|
|
77
|
+
sourceMap,
|
|
78
|
+
preserveSymlinks,
|
|
79
|
+
zoneless
|
|
80
|
+
},
|
|
81
|
+
browserOptions
|
|
82
|
+
), standaloneOptions = {
|
|
83
|
+
packageJson,
|
|
71
84
|
ci,
|
|
72
85
|
configDir,
|
|
73
86
|
...docs ? { docs } : {},
|
|
@@ -81,22 +94,14 @@ var commandBuilder = (options, context) => new Observable((observer) => {
|
|
|
81
94
|
sslCert,
|
|
82
95
|
sslKey,
|
|
83
96
|
disableTelemetry,
|
|
84
|
-
angularBrowserTarget: browserTarget,
|
|
97
|
+
angularBrowserTarget: options.browserTarget ?? null,
|
|
85
98
|
angularBuilderContext: context,
|
|
86
|
-
angularBuilderOptions
|
|
87
|
-
...stylePreprocessorOptions ? { stylePreprocessorOptions } : {},
|
|
88
|
-
...styles ? { styles } : {},
|
|
89
|
-
...assets ? { assets } : {},
|
|
90
|
-
preserveSymlinks,
|
|
91
|
-
sourceMap,
|
|
92
|
-
zoneless
|
|
93
|
-
},
|
|
99
|
+
angularBuilderOptions,
|
|
94
100
|
tsConfig,
|
|
95
101
|
initialPath,
|
|
96
102
|
open,
|
|
97
103
|
statsJson,
|
|
98
|
-
loglevel
|
|
99
|
-
previewUrl
|
|
104
|
+
loglevel
|
|
100
105
|
};
|
|
101
106
|
process.env.STORYBOOK_ANGULAR_BUILDER_OPTIONS_JSON = JSON.stringify(
|
|
102
107
|
standaloneOptions.angularBuilderOptions
|
|
@@ -126,12 +131,14 @@ async function setup(options, context) {
|
|
|
126
131
|
configDir: options.configDir,
|
|
127
132
|
tsConfig: options.tsConfig,
|
|
128
133
|
browserTsConfig: browserOptions?.tsConfig
|
|
129
|
-
})
|
|
134
|
+
}),
|
|
135
|
+
browserOptions,
|
|
136
|
+
browserTarget
|
|
130
137
|
};
|
|
131
138
|
}
|
|
132
139
|
async function runInstance(options) {
|
|
133
140
|
try {
|
|
134
|
-
let
|
|
141
|
+
let result = await withTelemetry(
|
|
135
142
|
"dev",
|
|
136
143
|
{
|
|
137
144
|
cliOptions: options,
|
|
@@ -145,12 +152,15 @@ async function runInstance(options) {
|
|
|
145
152
|
},
|
|
146
153
|
() => buildDevStandalone(options)
|
|
147
154
|
);
|
|
148
|
-
|
|
155
|
+
if (!result)
|
|
156
|
+
throw new Error("Storybook dev server did not start");
|
|
157
|
+
return result.port;
|
|
149
158
|
} catch (error) {
|
|
150
159
|
let summarized = errorSummary(error);
|
|
151
160
|
throw new Error(String(summarized));
|
|
152
161
|
}
|
|
153
162
|
}
|
|
154
163
|
export {
|
|
164
|
+
commandBuilder,
|
|
155
165
|
start_storybook_default as default
|
|
156
166
|
};
|
package/dist/client/config.js
CHANGED
|
@@ -2,11 +2,11 @@ import {
|
|
|
2
2
|
argTypesEnhancers,
|
|
3
3
|
decorateStory,
|
|
4
4
|
parameters
|
|
5
|
-
} from "../_browser-chunks/chunk-
|
|
5
|
+
} from "../_browser-chunks/chunk-TN7UZNXT.js";
|
|
6
6
|
import {
|
|
7
7
|
render,
|
|
8
8
|
renderToCanvas
|
|
9
|
-
} from "../_browser-chunks/chunk-
|
|
9
|
+
} from "../_browser-chunks/chunk-BFQMI74D.js";
|
|
10
10
|
export {
|
|
11
11
|
decorateStory as applyDecorators,
|
|
12
12
|
argTypesEnhancers,
|